@oliasoft-open-source/node-json-migrator 4.1.0 → 4.2.0-beta-1

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 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 TMetaData = Record<string, unknown>;
8
9
  type TMigration = {
9
10
  fileName?: string;
10
11
  fileHash?: string;
@@ -15,7 +16,7 @@ type TMigration = {
15
16
  skippedFileHashes?: string[];
16
17
  sequenceFromHistory?: string;
17
18
  script?: string;
18
- migrator?: (payload: unknown) => unknown;
19
+ migrator?: (payload: unknown, metaData?: TMetaData) => unknown;
19
20
  };
20
21
  type TEntityColumnNames = {
21
22
  id: string;
@@ -96,9 +97,10 @@ declare const getPlannedVersion: ({ config }: {
96
97
  * i) function looks up the pending migrations for you (default)
97
98
  * ii) pass in pre-fetched pending migrators via config.pending
98
99
  */
99
- declare const migrate: ({ payload, config, }: {
100
+ declare const migrate: ({ payload, config, metaData, }: {
100
101
  payload: unknown;
101
102
  config: TConfig;
103
+ metaData?: TMetaData;
102
104
  }) => Promise<{
103
105
  nextPayload: unknown;
104
106
  nextVersion: string;
@@ -125,7 +127,7 @@ declare const migrateAll: ({ config, beforeMigrateRecord, afterMigrateRecord, on
125
127
  * until module-with-string fixes its stack trace handling (see OW-8879 and
126
128
  * https://github.com/exuanbo/module-from-string/issues/18)
127
129
  */
128
- declare const pipe: (migrations: TMigration[], payload: unknown) => unknown;
130
+ declare const pipe: (migrations: TMigration[], payload: unknown, metaData?: TMetaData) => unknown;
129
131
 
130
132
  declare const getVersions: (db: IDatabase<unknown>, entity: string) => Promise<any[]>;
131
133
 
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 TMetaData = Record<string, unknown>;
8
9
  type TMigration = {
9
10
  fileName?: string;
10
11
  fileHash?: string;
@@ -15,7 +16,7 @@ type TMigration = {
15
16
  skippedFileHashes?: string[];
16
17
  sequenceFromHistory?: string;
17
18
  script?: string;
18
- migrator?: (payload: unknown) => unknown;
19
+ migrator?: (payload: unknown, metaData?: TMetaData) => unknown;
19
20
  };
20
21
  type TEntityColumnNames = {
21
22
  id: string;
@@ -96,9 +97,10 @@ declare const getPlannedVersion: ({ config }: {
96
97
  * i) function looks up the pending migrations for you (default)
97
98
  * ii) pass in pre-fetched pending migrators via config.pending
98
99
  */
99
- declare const migrate: ({ payload, config, }: {
100
+ declare const migrate: ({ payload, config, metaData, }: {
100
101
  payload: unknown;
101
102
  config: TConfig;
103
+ metaData?: TMetaData;
102
104
  }) => Promise<{
103
105
  nextPayload: unknown;
104
106
  nextVersion: string;
@@ -125,7 +127,7 @@ declare const migrateAll: ({ config, beforeMigrateRecord, afterMigrateRecord, on
125
127
  * until module-with-string fixes its stack trace handling (see OW-8879 and
126
128
  * https://github.com/exuanbo/module-from-string/issues/18)
127
129
  */
128
- declare const pipe: (migrations: TMigration[], payload: unknown) => unknown;
130
+ declare const pipe: (migrations: TMigration[], payload: unknown, metaData?: TMetaData) => unknown;
129
131
 
130
132
  declare const getVersions: (db: IDatabase<unknown>, entity: string) => Promise<any[]>;
131
133