@oliasoft-open-source/node-json-migrator 4.2.0-beta-1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +7 -6
- package/dist/index.d.mts +7 -6
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -5,6 +5,7 @@ import { IDatabase, IHelpers, ITask } from 'pg-promise';
|
|
|
5
5
|
*/
|
|
6
6
|
declare const createMigration: (directory: string, description: string, entity: string) => Promise<void>;
|
|
7
7
|
|
|
8
|
+
type TPayload = Record<string, unknown>;
|
|
8
9
|
type TMetaData = Record<string, unknown>;
|
|
9
10
|
type TMigration = {
|
|
10
11
|
fileName?: string;
|
|
@@ -16,7 +17,7 @@ type TMigration = {
|
|
|
16
17
|
skippedFileHashes?: string[];
|
|
17
18
|
sequenceFromHistory?: string;
|
|
18
19
|
script?: string;
|
|
19
|
-
migrator?: (payload:
|
|
20
|
+
migrator?: (payload: TPayload, metaData?: TMetaData) => TPayload;
|
|
20
21
|
};
|
|
21
22
|
type TEntityColumnNames = {
|
|
22
23
|
id: string;
|
|
@@ -26,7 +27,7 @@ type TEntityColumnNames = {
|
|
|
26
27
|
version: string;
|
|
27
28
|
created: string;
|
|
28
29
|
};
|
|
29
|
-
type TRecord<T extends TEntityColumnNames = TEntityColumnNames, TData =
|
|
30
|
+
type TRecord<T extends TEntityColumnNames = TEntityColumnNames, TData = TPayload> = {
|
|
30
31
|
[K in T['id']]: number | string;
|
|
31
32
|
} & {
|
|
32
33
|
[K in T['name']]: string;
|
|
@@ -98,11 +99,11 @@ declare const getPlannedVersion: ({ config }: {
|
|
|
98
99
|
* ii) pass in pre-fetched pending migrators via config.pending
|
|
99
100
|
*/
|
|
100
101
|
declare const migrate: ({ payload, config, metaData, }: {
|
|
101
|
-
payload:
|
|
102
|
+
payload: TPayload;
|
|
102
103
|
config: TConfig;
|
|
103
104
|
metaData?: TMetaData;
|
|
104
105
|
}) => Promise<{
|
|
105
|
-
nextPayload:
|
|
106
|
+
nextPayload: TPayload;
|
|
106
107
|
nextVersion: string;
|
|
107
108
|
}>;
|
|
108
109
|
|
|
@@ -127,7 +128,7 @@ declare const migrateAll: ({ config, beforeMigrateRecord, afterMigrateRecord, on
|
|
|
127
128
|
* until module-with-string fixes its stack trace handling (see OW-8879 and
|
|
128
129
|
* https://github.com/exuanbo/module-from-string/issues/18)
|
|
129
130
|
*/
|
|
130
|
-
declare const pipe: (migrations: TMigration[], payload:
|
|
131
|
+
declare const pipe: (migrations: TMigration[], payload: TPayload, metaData?: TMetaData) => TPayload;
|
|
131
132
|
|
|
132
133
|
declare const getVersions: (db: IDatabase<unknown>, entity: string) => Promise<any[]>;
|
|
133
134
|
|
|
@@ -138,4 +139,4 @@ declare const printVersionHistory: ({ config }: {
|
|
|
138
139
|
config: TConfig;
|
|
139
140
|
}) => Promise<void>;
|
|
140
141
|
|
|
141
|
-
export { type TAfterMigrateRecord, type TAfterMigrateRecordPayload, type TBeforeMigrateRecord, type TBeforeMigrateRecordPayload, type TConfig, type TEntityColumnNames, type TMigration, type TMigrationErrorPayload, type TOnMigrationErrors, type TOnMigrationErrorsPayload, type TRecord, createMigration, getPlannedMigrations, getPlannedVersion, getVersions, migrate, migrateAll, pipe, printVersionHistory };
|
|
142
|
+
export { type TAfterMigrateRecord, type TAfterMigrateRecordPayload, type TBeforeMigrateRecord, type TBeforeMigrateRecordPayload, type TConfig, type TEntityColumnNames, type TMetaData, type TMigration, type TMigrationErrorPayload, type TOnMigrationErrors, type TOnMigrationErrorsPayload, type TPayload, type TRecord, createMigration, getPlannedMigrations, getPlannedVersion, getVersions, migrate, migrateAll, pipe, printVersionHistory };
|
package/dist/index.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ import { IDatabase, IHelpers, ITask } from 'pg-promise';
|
|
|
5
5
|
*/
|
|
6
6
|
declare const createMigration: (directory: string, description: string, entity: string) => Promise<void>;
|
|
7
7
|
|
|
8
|
+
type TPayload = Record<string, unknown>;
|
|
8
9
|
type TMetaData = Record<string, unknown>;
|
|
9
10
|
type TMigration = {
|
|
10
11
|
fileName?: string;
|
|
@@ -16,7 +17,7 @@ type TMigration = {
|
|
|
16
17
|
skippedFileHashes?: string[];
|
|
17
18
|
sequenceFromHistory?: string;
|
|
18
19
|
script?: string;
|
|
19
|
-
migrator?: (payload:
|
|
20
|
+
migrator?: (payload: TPayload, metaData?: TMetaData) => TPayload;
|
|
20
21
|
};
|
|
21
22
|
type TEntityColumnNames = {
|
|
22
23
|
id: string;
|
|
@@ -26,7 +27,7 @@ type TEntityColumnNames = {
|
|
|
26
27
|
version: string;
|
|
27
28
|
created: string;
|
|
28
29
|
};
|
|
29
|
-
type TRecord<T extends TEntityColumnNames = TEntityColumnNames, TData =
|
|
30
|
+
type TRecord<T extends TEntityColumnNames = TEntityColumnNames, TData = TPayload> = {
|
|
30
31
|
[K in T['id']]: number | string;
|
|
31
32
|
} & {
|
|
32
33
|
[K in T['name']]: string;
|
|
@@ -98,11 +99,11 @@ declare const getPlannedVersion: ({ config }: {
|
|
|
98
99
|
* ii) pass in pre-fetched pending migrators via config.pending
|
|
99
100
|
*/
|
|
100
101
|
declare const migrate: ({ payload, config, metaData, }: {
|
|
101
|
-
payload:
|
|
102
|
+
payload: TPayload;
|
|
102
103
|
config: TConfig;
|
|
103
104
|
metaData?: TMetaData;
|
|
104
105
|
}) => Promise<{
|
|
105
|
-
nextPayload:
|
|
106
|
+
nextPayload: TPayload;
|
|
106
107
|
nextVersion: string;
|
|
107
108
|
}>;
|
|
108
109
|
|
|
@@ -127,7 +128,7 @@ declare const migrateAll: ({ config, beforeMigrateRecord, afterMigrateRecord, on
|
|
|
127
128
|
* until module-with-string fixes its stack trace handling (see OW-8879 and
|
|
128
129
|
* https://github.com/exuanbo/module-from-string/issues/18)
|
|
129
130
|
*/
|
|
130
|
-
declare const pipe: (migrations: TMigration[], payload:
|
|
131
|
+
declare const pipe: (migrations: TMigration[], payload: TPayload, metaData?: TMetaData) => TPayload;
|
|
131
132
|
|
|
132
133
|
declare const getVersions: (db: IDatabase<unknown>, entity: string) => Promise<any[]>;
|
|
133
134
|
|
|
@@ -138,4 +139,4 @@ declare const printVersionHistory: ({ config }: {
|
|
|
138
139
|
config: TConfig;
|
|
139
140
|
}) => Promise<void>;
|
|
140
141
|
|
|
141
|
-
export { type TAfterMigrateRecord, type TAfterMigrateRecordPayload, type TBeforeMigrateRecord, type TBeforeMigrateRecordPayload, type TConfig, type TEntityColumnNames, type TMigration, type TMigrationErrorPayload, type TOnMigrationErrors, type TOnMigrationErrorsPayload, type TRecord, createMigration, getPlannedMigrations, getPlannedVersion, getVersions, migrate, migrateAll, pipe, printVersionHistory };
|
|
142
|
+
export { type TAfterMigrateRecord, type TAfterMigrateRecordPayload, type TBeforeMigrateRecord, type TBeforeMigrateRecordPayload, type TConfig, type TEntityColumnNames, type TMetaData, type TMigration, type TMigrationErrorPayload, type TOnMigrationErrors, type TOnMigrationErrorsPayload, type TPayload, type TRecord, createMigration, getPlannedMigrations, getPlannedVersion, getVersions, migrate, migrateAll, pipe, printVersionHistory };
|
package/package.json
CHANGED