-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
81 lines (72 loc) · 2 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import type { Client } from '@elastic/elasticsearch';
export interface MigrationConfig {
/**
* Name of the index in which the migrations
* have to be stored
*/
indexName: string;
/**
* (!!OPTIONAL)
* Name of the index in which the migration lock
* has to be stored.
* If not provided, will be created as
* indexName + '_lock'
*/
lockIndexName?: string;
/**
* Relative path to the directory in which migration
* files are present
*/
directory: string;
/**
* Elasticsearch Node.js client instance
*/
client: Client;
/**
* Timeout to wait until the migration
* lock is released.
* Default: 60000
*/
migrationLockTimeout?: number;
/**
* Flag to disable validation if already executed migrations
* are present in the source directory or not
* Default: false
*/
disableMigrationsValidation?: boolean;
}
export interface MigrationContext extends MigrationConfig {
lockIndexName: string;
initialized: boolean;
migrateInitialized: boolean;
migrationLockTimeout: number;
migrationIndexCreated: boolean;
migrationLockIndexCreated: boolean;
sourceMigrations: SourceMigration[];
pendingMigrations: SourceMigration[];
executedMigrations?: ExecutedMigration[];
lastExecutedMigration: ExecutedMigration | null;
}
interface ExecutedMigration {
name: string;
position: number;
time: string;
}
interface SourceMigration {
path: string;
position: number;
name: string;
}
export declare function migrateLatest(config: MigrationConfig): Promise<void>;
export declare function migrateNext(config: MigrationConfig | MigrationContext): Promise<MigrationContext>;
export declare function forceReleaseMigrationLock(config: MigrationConfig): Promise<void>;
export declare class Migration {
constructor(config: MigrationConfig) {}
latest = async () => {}
next = async () => {}
forceReleaseMigrationLock = async () => {}
}
export interface MigrateFnInput {
client: Client;
}
export type MigrateFn = (_: MigrateFnInput) => Promise<any>;