@webiny/data-migration 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.f6dc066313
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/MigrationRunner.d.ts +1 -1
- package/MigrationRunner.js +13 -20
- package/MigrationRunner.js.map +1 -1
- package/README.md +9 -4
- package/cli/CliMigrationRunReporter.d.ts +8 -5
- package/cli/CliMigrationRunReporter.js +15 -20
- package/cli/CliMigrationRunReporter.js.map +1 -1
- package/cli/InteractiveCliStatusReporter.d.ts +3 -3
- package/cli/InteractiveCliStatusReporter.js +4 -12
- package/cli/InteractiveCliStatusReporter.js.map +1 -1
- package/cli/LogReporter.d.ts +1 -1
- package/cli/LogReporter.js +3 -10
- package/cli/LogReporter.js.map +1 -1
- package/cli/LogStream.js +3 -10
- package/cli/LogStream.js.map +1 -1
- package/cli/MigrationRunReporter.d.ts +1 -1
- package/cli/MigrationRunReporter.js +1 -5
- package/cli/MigrationRunReporter.js.map +1 -1
- package/cli/MigrationRunner.d.ts +3 -3
- package/cli/MigrationRunner.js +9 -17
- package/cli/MigrationRunner.js.map +1 -1
- package/cli/MigrationStatusReporter.d.ts +1 -1
- package/cli/MigrationStatusReporter.js +1 -5
- package/cli/MigrationStatusReporter.js.map +1 -1
- package/cli/NonInteractiveCliStatusReporter.d.ts +3 -3
- package/cli/NonInteractiveCliStatusReporter.js +1 -8
- package/cli/NonInteractiveCliStatusReporter.js.map +1 -1
- package/cli/VoidStatusReporter.d.ts +1 -1
- package/cli/VoidStatusReporter.js +1 -8
- package/cli/VoidStatusReporter.js.map +1 -1
- package/cli/getDuration.js +1 -8
- package/cli/getDuration.js.map +1 -1
- package/cli/index.d.ts +10 -10
- package/cli/index.js +10 -115
- package/cli/index.js.map +1 -1
- package/createPinoLogger.d.ts +2 -2
- package/createPinoLogger.js +9 -18
- package/createPinoLogger.js.map +1 -1
- package/createTable.d.ts +2 -2
- package/createTable.js +3 -10
- package/createTable.js.map +1 -1
- package/handlers/createDdbEsProjectMigration.d.ts +3 -3
- package/handlers/createDdbEsProjectMigration.js +22 -29
- package/handlers/createDdbEsProjectMigration.js.map +1 -1
- package/handlers/createDdbProjectMigration.d.ts +3 -3
- package/handlers/createDdbProjectMigration.js +20 -27
- package/handlers/createDdbProjectMigration.js.map +1 -1
- package/handlers/createPatternMatcher.d.ts +1 -1
- package/handlers/createPatternMatcher.js +3 -11
- package/handlers/createPatternMatcher.js.map +1 -1
- package/handlers/devVersionErrorResponse.js +1 -8
- package/handlers/devVersionErrorResponse.js.map +1 -1
- package/index.d.ts +6 -6
- package/index.js +6 -60
- package/index.js.map +1 -1
- package/package.json +20 -24
- package/repository/migrations.repository.d.ts +2 -2
- package/repository/migrations.repository.js +38 -64
- package/repository/migrations.repository.js.map +1 -1
- package/symbols.js +7 -13
- package/symbols.js.map +1 -1
- package/types.js +1 -5
- package/repository/createStandardEntity.d.ts +0 -52
- package/repository/createStandardEntity.js +0 -39
- package/repository/createStandardEntity.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["inject","makeInjectable","PrimaryDynamoTableSymbol","createGlobalEntity","MigrationRepositoryImpl","constructor","table","run","name","migration","checkpoint","getLastRun","result","queryOne","partitionKey","options","index","gt","reverse","data","saveRun","put","PK","id","SK","TYPE","GSI1_PK","GSI1_SK","listMigrations","params","limit","queryAll","map","item","logMigration","createCheckpoint","deleteCheckpoint","delete","getCheckpoint","record","get"],"sources":["migrations.repository.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox.js\";\nimport type { MigrationItem, MigrationRepository, MigrationRun } from \"~/types.js\";\nimport { inject, makeInjectable } from \"@webiny/ioc\";\nimport { PrimaryDynamoTableSymbol } from \"~/symbols.js\";\nimport { createGlobalEntity } from \"@webiny/db-dynamodb\";\n\ninterface MigrationCheckpoint {\n data: unknown;\n}\n\nexport class MigrationRepositoryImpl implements MigrationRepository {\n private readonly run;\n private readonly migration;\n private readonly checkpoint;\n\n constructor(table: Table<string, string, string>) {\n this.run = createGlobalEntity<MigrationRun>({\n table,\n name: \"MigrationRun\"\n });\n this.migration = createGlobalEntity<MigrationItem>({\n table,\n name: \"Migration\"\n });\n this.checkpoint = createGlobalEntity<MigrationCheckpoint>({\n table,\n name: \"MigrationCheckpoint\"\n });\n }\n\n async getLastRun(): Promise<MigrationRun | null> {\n const result = await this.run.queryOne({\n partitionKey: \"MIGRATION_RUNS\",\n options: {\n index: \"GSI1\",\n gt: \" \",\n reverse: true\n }\n });\n\n return result?.data || null;\n }\n\n async saveRun(run: MigrationRun): Promise<void> {\n await this.run.put({\n PK: `MIGRATION_RUN#${run.id}`,\n SK: \"A\",\n TYPE: \"migration.run\",\n GSI1_PK: \"MIGRATION_RUNS\",\n GSI1_SK: run.id,\n data: run\n });\n }\n\n async listMigrations(params?: { limit: number }): Promise<MigrationItem[]> {\n const { limit } = params || {};\n const result = await this.migration.queryAll({\n partitionKey: \"MIGRATIONS\",\n options: {\n index: \"GSI1\",\n gt: \" \",\n limit,\n // Sort by GSI1_SK in descending order.\n reverse: true\n }\n });\n\n return result.map(item => item.data);\n }\n\n async logMigration(migration: MigrationItem): Promise<void> {\n await this.migration.put({\n PK: `MIGRATION#${migration.id}`,\n SK: \"A\",\n TYPE: \"migration\",\n GSI1_PK: \"MIGRATIONS\",\n GSI1_SK: migration.id,\n data: migration\n });\n }\n\n async createCheckpoint(id: string, data: unknown): Promise<void> {\n await this.checkpoint.put({\n PK: `MIGRATION_CHECKPOINT#${id}`,\n SK: \"A\",\n TYPE: \"migration.checkpoint\",\n GSI1_PK: \"MIGRATION_CHECKPOINTS\",\n GSI1_SK: id,\n data: data as MigrationCheckpoint\n });\n }\n\n async deleteCheckpoint(id: string): Promise<void> {\n await this.checkpoint.delete({\n PK: `MIGRATION_CHECKPOINT#${id}`,\n SK: \"A\"\n });\n }\n\n async getCheckpoint(id: string): Promise<unknown | null> {\n const record = await this.checkpoint.get({\n PK: `MIGRATION_CHECKPOINT#${id}`,\n SK: \"A\"\n });\n\n if (!record) {\n return null;\n }\n return record.data;\n }\n}\n\nmakeInjectable(MigrationRepositoryImpl, [inject(PrimaryDynamoTableSymbol)]);\n"],"mappings":"AAEA,SAASA,MAAM,EAAEC,cAAc,QAAQ,aAAa;AACpD,SAASC,wBAAwB;AACjC,SAASC,kBAAkB,QAAQ,qBAAqB;AAMxD,OAAO,MAAMC,uBAAuB,CAAgC;EAKhEC,WAAWA,CAACC,KAAoC,EAAE;IAC9C,IAAI,CAACC,GAAG,GAAGJ,kBAAkB,CAAe;MACxCG,KAAK;MACLE,IAAI,EAAE;IACV,CAAC,CAAC;IACF,IAAI,CAACC,SAAS,GAAGN,kBAAkB,CAAgB;MAC/CG,KAAK;MACLE,IAAI,EAAE;IACV,CAAC,CAAC;IACF,IAAI,CAACE,UAAU,GAAGP,kBAAkB,CAAsB;MACtDG,KAAK;MACLE,IAAI,EAAE;IACV,CAAC,CAAC;EACN;EAEA,MAAMG,UAAUA,CAAA,EAAiC;IAC7C,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACL,GAAG,CAACM,QAAQ,CAAC;MACnCC,YAAY,EAAE,gBAAgB;MAC9BC,OAAO,EAAE;QACLC,KAAK,EAAE,MAAM;QACbC,EAAE,EAAE,GAAG;QACPC,OAAO,EAAE;MACb;IACJ,CAAC,CAAC;IAEF,OAAON,MAAM,EAAEO,IAAI,IAAI,IAAI;EAC/B;EAEA,MAAMC,OAAOA,CAACb,GAAiB,EAAiB;IAC5C,MAAM,IAAI,CAACA,GAAG,CAACc,GAAG,CAAC;MACfC,EAAE,EAAE,iBAAiBf,GAAG,CAACgB,EAAE,EAAE;MAC7BC,EAAE,EAAE,GAAG;MACPC,IAAI,EAAE,eAAe;MACrBC,OAAO,EAAE,gBAAgB;MACzBC,OAAO,EAAEpB,GAAG,CAACgB,EAAE;MACfJ,IAAI,EAAEZ;IACV,CAAC,CAAC;EACN;EAEA,MAAMqB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GAAG,MAAM,IAAI,CAAC7B,UAAU,CAAC8B,GAAG,CAAC;MACrClB,EAAE,EAAE,wBAAwBC,EAAE,EAAE;MAChCC,EAAE,EAAE;IACR,CAAC,CAAC;IAEF,IAAI,CAACe,MAAM,EAAE;MACT,OAAO,IAAI;IACf;IACA,OAAOA,MAAM,CAACpB,IAAI;EACtB;AACJ;AAEAlB,cAAc,CAACG,uBAAuB,EAAE,CAACJ,MAAM,CAACE,wBAAwB,CAAC,CAAC,CAAC","ignoreList":[]}
|
package/symbols.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const MigrationSymbol = exports.MigrationSymbol = Symbol.for("Migration");
|
|
9
|
-
const MigrationRepositorySymbol = exports.MigrationRepositorySymbol = Symbol.for("MigrationRepository");
|
|
10
|
-
const ElasticsearchClientSymbol = exports.ElasticsearchClientSymbol = Symbol.for("ElasticsearchClient");
|
|
11
|
-
const PrimaryDynamoTableSymbol = exports.PrimaryDynamoTableSymbol = Symbol.for("PrimaryDynamoTable");
|
|
12
|
-
const ElasticsearchDynamoTableSymbol = exports.ElasticsearchDynamoTableSymbol = Symbol.for("ElasticsearchDynamoTable");
|
|
13
|
-
const ExecutionTimeLimiterSymbol = exports.ExecutionTimeLimiterSymbol = Symbol.for("ExecutionTimeLimiter");
|
|
1
|
+
export const LoggerSymbol = Symbol.for("PinoLogger");
|
|
2
|
+
export const MigrationSymbol = Symbol.for("Migration");
|
|
3
|
+
export const MigrationRepositorySymbol = Symbol.for("MigrationRepository");
|
|
4
|
+
export const ElasticsearchClientSymbol = Symbol.for("ElasticsearchClient");
|
|
5
|
+
export const PrimaryDynamoTableSymbol = Symbol.for("PrimaryDynamoTable");
|
|
6
|
+
export const ElasticsearchDynamoTableSymbol = Symbol.for("ElasticsearchDynamoTable");
|
|
7
|
+
export const ExecutionTimeLimiterSymbol = Symbol.for("ExecutionTimeLimiter");
|
|
14
8
|
|
|
15
9
|
//# sourceMappingURL=symbols.js.map
|
package/symbols.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LoggerSymbol","
|
|
1
|
+
{"version":3,"names":["LoggerSymbol","Symbol","for","MigrationSymbol","MigrationRepositorySymbol","ElasticsearchClientSymbol","PrimaryDynamoTableSymbol","ElasticsearchDynamoTableSymbol","ExecutionTimeLimiterSymbol"],"sources":["symbols.ts"],"sourcesContent":["export const LoggerSymbol = Symbol.for(\"PinoLogger\");\nexport const MigrationSymbol = Symbol.for(\"Migration\");\nexport const MigrationRepositorySymbol = Symbol.for(\"MigrationRepository\");\nexport const ElasticsearchClientSymbol = Symbol.for(\"ElasticsearchClient\");\nexport const PrimaryDynamoTableSymbol = Symbol.for(\"PrimaryDynamoTable\");\nexport const ElasticsearchDynamoTableSymbol = Symbol.for(\"ElasticsearchDynamoTable\");\nexport const ExecutionTimeLimiterSymbol = Symbol.for(\"ExecutionTimeLimiter\");\n"],"mappings":"AAAA,OAAO,MAAMA,YAAY,GAAGC,MAAM,CAACC,GAAG,CAAC,YAAY,CAAC;AACpD,OAAO,MAAMC,eAAe,GAAGF,MAAM,CAACC,GAAG,CAAC,WAAW,CAAC;AACtD,OAAO,MAAME,yBAAyB,GAAGH,MAAM,CAACC,GAAG,CAAC,qBAAqB,CAAC;AAC1E,OAAO,MAAMG,yBAAyB,GAAGJ,MAAM,CAACC,GAAG,CAAC,qBAAqB,CAAC;AAC1E,OAAO,MAAMI,wBAAwB,GAAGL,MAAM,CAACC,GAAG,CAAC,oBAAoB,CAAC;AACxE,OAAO,MAAMK,8BAA8B,GAAGN,MAAM,CAACC,GAAG,CAAC,0BAA0B,CAAC;AACpF,OAAO,MAAMM,0BAA0B,GAAGP,MAAM,CAACC,GAAG,CAAC,sBAAsB,CAAC","ignoreList":[]}
|
package/types.js
CHANGED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
-
import { Entity } from "@webiny/db-dynamodb/toolbox";
|
|
3
|
-
export declare const createStandardEntity: ({ table, name }: {
|
|
4
|
-
table: Table<string, string, string>;
|
|
5
|
-
name: string;
|
|
6
|
-
}) => Entity<string, import("dynamodb-toolbox/dist/cjs/classes/Entity").Overlay, import("dynamodb-toolbox/dist/cjs/classes/Entity").Overlay, Table<string, string, string>, boolean, boolean, boolean, string, string, string, boolean, {
|
|
7
|
-
PK: {
|
|
8
|
-
partitionKey: true;
|
|
9
|
-
};
|
|
10
|
-
SK: {
|
|
11
|
-
sortKey: true;
|
|
12
|
-
};
|
|
13
|
-
GSI1_PK: {
|
|
14
|
-
type: "string";
|
|
15
|
-
};
|
|
16
|
-
GSI1_SK: {
|
|
17
|
-
type: "string";
|
|
18
|
-
};
|
|
19
|
-
TYPE: {
|
|
20
|
-
type: "string";
|
|
21
|
-
};
|
|
22
|
-
data: {
|
|
23
|
-
type: "map";
|
|
24
|
-
};
|
|
25
|
-
}, {
|
|
26
|
-
PK: {
|
|
27
|
-
partitionKey: true;
|
|
28
|
-
};
|
|
29
|
-
SK: {
|
|
30
|
-
sortKey: true;
|
|
31
|
-
};
|
|
32
|
-
GSI1_PK: {
|
|
33
|
-
type: "string";
|
|
34
|
-
};
|
|
35
|
-
GSI1_SK: {
|
|
36
|
-
type: "string";
|
|
37
|
-
};
|
|
38
|
-
TYPE: {
|
|
39
|
-
type: "string";
|
|
40
|
-
};
|
|
41
|
-
data: {
|
|
42
|
-
type: "map";
|
|
43
|
-
};
|
|
44
|
-
}, import("dynamodb-toolbox/dist/cjs/classes/Entity").ParsedAttributes<import("ts-toolbelt/out/Any/Key").Key>, any, {
|
|
45
|
-
[x: string]: any;
|
|
46
|
-
[x: number]: any;
|
|
47
|
-
[x: symbol]: any;
|
|
48
|
-
}, {
|
|
49
|
-
[x: string]: any;
|
|
50
|
-
[x: number]: any;
|
|
51
|
-
[x: symbol]: any;
|
|
52
|
-
}>;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createStandardEntity = void 0;
|
|
7
|
-
var _toolbox = require("@webiny/db-dynamodb/toolbox");
|
|
8
|
-
const createStandardEntity = ({
|
|
9
|
-
table,
|
|
10
|
-
name
|
|
11
|
-
}) => {
|
|
12
|
-
return new _toolbox.Entity({
|
|
13
|
-
name,
|
|
14
|
-
table,
|
|
15
|
-
attributes: {
|
|
16
|
-
PK: {
|
|
17
|
-
partitionKey: true
|
|
18
|
-
},
|
|
19
|
-
SK: {
|
|
20
|
-
sortKey: true
|
|
21
|
-
},
|
|
22
|
-
GSI1_PK: {
|
|
23
|
-
type: "string"
|
|
24
|
-
},
|
|
25
|
-
GSI1_SK: {
|
|
26
|
-
type: "string"
|
|
27
|
-
},
|
|
28
|
-
TYPE: {
|
|
29
|
-
type: "string"
|
|
30
|
-
},
|
|
31
|
-
data: {
|
|
32
|
-
type: "map"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
exports.createStandardEntity = createStandardEntity;
|
|
38
|
-
|
|
39
|
-
//# sourceMappingURL=createStandardEntity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createStandardEntity","table","name","Entity","attributes","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","TYPE","data","exports"],"sources":["createStandardEntity.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\n\nexport const createStandardEntity = ({\n table,\n name\n}: {\n table: Table<string, string, string>;\n name: string;\n}) => {\n return new Entity({\n name,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n }\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEO,MAAMC,oBAAoB,GAAGA,CAAC;EACjCC,KAAK;EACLC;AAIJ,CAAC,KAAK;EACF,OAAO,IAAIC,eAAM,CAAC;IACdD,IAAI;IACJD,KAAK;IACLG,UAAU,EAAE;MACRC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACI,OAAA,CAAAd,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|