@webiny/data-migration 0.0.0-unstable.496cf268ac → 0.0.0-unstable.61c048f412

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.
Files changed (80) hide show
  1. package/MigrationRunner.d.ts +8 -4
  2. package/MigrationRunner.js +109 -51
  3. package/MigrationRunner.js.map +1 -1
  4. package/README.md +9 -4
  5. package/cli/CliMigrationRunReporter.d.ts +13 -0
  6. package/cli/CliMigrationRunReporter.js +50 -0
  7. package/cli/CliMigrationRunReporter.js.map +1 -0
  8. package/cli/InteractiveCliStatusReporter.d.ts +11 -0
  9. package/cli/InteractiveCliStatusReporter.js +66 -0
  10. package/cli/InteractiveCliStatusReporter.js.map +1 -0
  11. package/cli/LogReporter.d.ts +10 -0
  12. package/cli/LogReporter.js +36 -0
  13. package/cli/LogReporter.js.map +1 -0
  14. package/cli/LogStream.d.ts +10 -0
  15. package/cli/LogStream.js +51 -0
  16. package/cli/LogStream.js.map +1 -0
  17. package/cli/MigrationRunReporter.d.ts +4 -0
  18. package/cli/MigrationRunReporter.js +3 -0
  19. package/cli/MigrationRunReporter.js.map +1 -0
  20. package/cli/MigrationRunner.d.ts +45 -0
  21. package/cli/MigrationRunner.js +128 -0
  22. package/cli/MigrationRunner.js.map +1 -0
  23. package/cli/MigrationStatusReporter.d.ts +4 -0
  24. package/cli/MigrationStatusReporter.js +3 -0
  25. package/cli/MigrationStatusReporter.js.map +1 -0
  26. package/cli/NonInteractiveCliStatusReporter.d.ts +9 -0
  27. package/cli/NonInteractiveCliStatusReporter.js +35 -0
  28. package/cli/NonInteractiveCliStatusReporter.js.map +1 -0
  29. package/cli/VoidStatusReporter.d.ts +4 -0
  30. package/cli/VoidStatusReporter.js +7 -0
  31. package/cli/VoidStatusReporter.js.map +1 -0
  32. package/cli/getDuration.js +3 -8
  33. package/cli/getDuration.js.map +1 -1
  34. package/cli/index.d.ts +10 -3
  35. package/cli/index.js +11 -37
  36. package/cli/index.js.map +1 -1
  37. package/createPinoLogger.d.ts +4 -7
  38. package/createPinoLogger.js +11 -16
  39. package/createPinoLogger.js.map +1 -1
  40. package/createTable.d.ts +4 -4
  41. package/createTable.js +8 -11
  42. package/createTable.js.map +1 -1
  43. package/handlers/createDdbEsProjectMigration.d.ts +7 -7
  44. package/handlers/createDdbEsProjectMigration.js +41 -43
  45. package/handlers/createDdbEsProjectMigration.js.map +1 -1
  46. package/handlers/createDdbProjectMigration.d.ts +5 -5
  47. package/handlers/createDdbProjectMigration.js +37 -39
  48. package/handlers/createDdbProjectMigration.js.map +1 -1
  49. package/handlers/createPatternMatcher.d.ts +1 -1
  50. package/handlers/createPatternMatcher.js +5 -11
  51. package/handlers/createPatternMatcher.js.map +1 -1
  52. package/handlers/devVersionErrorResponse.js +3 -8
  53. package/handlers/devVersionErrorResponse.js.map +1 -1
  54. package/index.d.ts +6 -7
  55. package/index.js +7 -70
  56. package/index.js.map +1 -1
  57. package/package.json +20 -37
  58. package/repository/migrations.repository.d.ts +3 -3
  59. package/repository/migrations.repository.js +18 -31
  60. package/repository/migrations.repository.js.map +1 -1
  61. package/symbols.js +8 -19
  62. package/symbols.js.map +1 -1
  63. package/types.d.ts +9 -6
  64. package/types.js +2 -11
  65. package/types.js.map +1 -1
  66. package/cli/getMigrationStatus.d.ts +0 -9
  67. package/cli/getMigrationStatus.js +0 -23
  68. package/cli/getMigrationStatus.js.map +0 -1
  69. package/cli/printReport.d.ts +0 -9
  70. package/cli/printReport.js +0 -57
  71. package/cli/printReport.js.map +0 -1
  72. package/cli/runMigration.d.ts +0 -13
  73. package/cli/runMigration.js +0 -85
  74. package/cli/runMigration.js.map +0 -1
  75. package/createId.d.ts +0 -1
  76. package/createId.js +0 -14
  77. package/createId.js.map +0 -1
  78. package/repository/createStandardEntity.d.ts +0 -5
  79. package/repository/createStandardEntity.js +0 -37
  80. package/repository/createStandardEntity.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["createTable","name","documentClient","Table","partitionKey","sortKey","DocumentClient","indexes","GSI1"],"sources":["createTable.ts"],"sourcesContent":["import { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Table } from \"dynamodb-toolbox\";\n\nexport interface CreateTableParams {\n name: string;\n documentClient: DocumentClient;\n}\n\nexport const createTable = ({ name, documentClient }: CreateTableParams) => {\n return new Table({\n name,\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n indexes: {\n GSI1: {\n partitionKey: \"GSI1_PK\",\n sortKey: \"GSI1_SK\"\n }\n // GSI2: {\n // partitionKey: \"GSI2_PK\",\n // sortKey: \"GSI2_SK\"\n // }\n }\n });\n};\n"],"mappings":";;;;;;AACA;AAOO,MAAMA,WAAW,GAAG,CAAC;EAAEC,IAAI;EAAEC;AAAkC,CAAC,KAAK;EACxE,OAAO,IAAIC,sBAAK,CAAC;IACbF,IAAI;IACJG,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAEJ,cAAc;IAC9BK,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb;MACA;MACA;MACA;MACA;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
1
+ {"version":3,"names":["Table","createTable","name","documentClient","partitionKey","sortKey","DocumentClient","indexes","GSI1","autoExecute","autoParse"],"sources":["createTable.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox.js\";\n\nexport interface CreateTableParams {\n name: string;\n documentClient: DynamoDBDocument;\n}\n\nexport const createTable = ({ name, documentClient }: CreateTableParams) => {\n return new Table({\n name,\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n indexes: {\n GSI1: {\n partitionKey: \"GSI1_PK\",\n sortKey: \"GSI1_SK\"\n }\n // GSI2: {\n // partitionKey: \"GSI2_PK\",\n // sortKey: \"GSI2_SK\"\n // }\n },\n autoExecute: true,\n autoParse: true\n });\n};\n"],"mappings":"AACA,SAASA,KAAK,QAAQ,gCAAgC;AAOtD,OAAO,MAAMC,WAAW,GAAGA,CAAC;EAAEC,IAAI;EAAEC;AAAkC,CAAC,KAAK;EACxE,OAAO,IAAIH,KAAK,CAAC;IACbE,IAAI;IACJE,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAEH,cAAc;IAC9BI,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb;MACA;MACA;MACA;MACA;IACJ,CAAC;IACDI,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,12 +1,12 @@
1
- import { Client as ElasticsearchClient } from "@elastic/elasticsearch";
2
- import { Table } from "dynamodb-toolbox";
3
- import { Constructor } from "@webiny/ioc";
4
- import { DataMigration, ExecutionTimeLimiter, MigrationEventHandlerResponse, MigrationEventPayload, MigrationRepository } from "../types";
5
- import { IsMigrationApplicable } from "../MigrationRunner";
1
+ import type { Client as ElasticsearchClient } from "@elastic/elasticsearch";
2
+ import type { Table } from "@webiny/db-dynamodb/toolbox.js";
3
+ import type { Constructor } from "@webiny/ioc";
4
+ import type { DataMigration, ExecutionTimeLimiter, MigrationEventHandlerResponse, MigrationEventPayload, MigrationRepository } from "../types.js";
5
+ import type { IsMigrationApplicable } from "../MigrationRunner.js";
6
6
  interface CreateDdbEsDataMigrationConfig {
7
7
  elasticsearchClient: ElasticsearchClient;
8
- primaryTable: Table;
9
- dynamoToEsTable: Table;
8
+ primaryTable: Table<string, string, string>;
9
+ dynamoToEsTable: Table<string, string, string>;
10
10
  migrations: Constructor<DataMigration>[];
11
11
  isMigrationApplicable?: IsMigrationApplicable;
12
12
  repository?: MigrationRepository;
@@ -1,67 +1,64 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createDdbEsProjectMigration = void 0;
8
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
- var _handlerAws = require("@webiny/handler-aws");
10
- var _ioc = require("@webiny/ioc");
11
- var _symbols = require("../symbols");
12
- var _MigrationRunner = require("../MigrationRunner");
13
- var _migrations = require("../repository/migrations.repository");
14
- var _devVersionErrorResponse = require("./devVersionErrorResponse");
15
- var _createPatternMatcher = require("./createPatternMatcher");
16
- const _excluded = ["migrations", "elasticsearchClient", "primaryTable", "dynamoToEsTable", "isMigrationApplicable", "repository"];
17
- const createDdbEsProjectMigration = _ref => {
18
- let {
19
- migrations,
20
- elasticsearchClient,
21
- primaryTable,
22
- dynamoToEsTable,
23
- isMigrationApplicable = undefined,
24
- repository = undefined
25
- } = _ref,
26
- config = (0, _objectWithoutProperties2.default)(_ref, _excluded);
27
- return (0, _handlerAws.createRawEventHandler)(async ({
1
+ import { createRawEventHandler } from "@webiny/handler-aws";
2
+ import { createContainer } from "@webiny/ioc";
3
+ import { ElasticsearchClientSymbol, ElasticsearchDynamoTableSymbol, ExecutionTimeLimiterSymbol, MigrationRepositorySymbol, MigrationSymbol, PrimaryDynamoTableSymbol } from "../symbols.js";
4
+ import { MigrationRunner } from "../MigrationRunner.js";
5
+ import { MigrationRepositoryImpl } from "../repository/migrations.repository.js";
6
+ import { devVersionErrorResponse } from "./devVersionErrorResponse.js";
7
+ import { createPatternMatcher } from "./createPatternMatcher.js";
8
+ import { coerce as semverCoerce } from "semver";
9
+ export const createDdbEsProjectMigration = ({
10
+ migrations,
11
+ elasticsearchClient,
12
+ primaryTable,
13
+ dynamoToEsTable,
14
+ isMigrationApplicable = undefined,
15
+ repository = undefined,
16
+ ...config
17
+ }) => {
18
+ return createRawEventHandler(async ({
28
19
  payload,
29
20
  lambdaContext
30
21
  }) => {
31
- const projectVersion = String((payload === null || payload === void 0 ? void 0 : payload.version) || process.env.WEBINY_VERSION);
32
- if (projectVersion === "0.0.0") {
33
- return (0, _devVersionErrorResponse.devVersionErrorResponse)();
22
+ const projectVersion = String(payload?.version || process.env.WEBINY_VERSION);
23
+ const forceExecute = payload.force === true;
24
+ const version = semverCoerce(projectVersion);
25
+ if (version?.version === "0.0.0") {
26
+ return devVersionErrorResponse();
34
27
  }
35
28
 
36
29
  // COMPOSITION ROOT
37
- const container = (0, _ioc.createContainer)();
38
- container.bind(_symbols.PrimaryDynamoTableSymbol).toConstantValue(primaryTable);
39
- container.bind(_symbols.ElasticsearchDynamoTableSymbol).toConstantValue(dynamoToEsTable);
40
- container.bind(_symbols.ElasticsearchClientSymbol).toConstantValue(elasticsearchClient);
41
- const timeLimiter = config.timeLimiter || (lambdaContext === null || lambdaContext === void 0 ? void 0 : lambdaContext.getRemainingTimeInMillis) || (() => 0);
42
- container.bind(_symbols.ExecutionTimeLimiterSymbol).toConstantValue(timeLimiter);
30
+ const container = createContainer();
31
+ container.bind(PrimaryDynamoTableSymbol).toConstantValue(primaryTable);
32
+ container.bind(ElasticsearchDynamoTableSymbol).toConstantValue(dynamoToEsTable);
33
+ container.bind(ElasticsearchClientSymbol).toConstantValue(elasticsearchClient);
34
+ const timeLimiter = config.timeLimiter || lambdaContext?.getRemainingTimeInMillis || (() => 0);
35
+ container.bind(ExecutionTimeLimiterSymbol).toConstantValue(timeLimiter);
43
36
  if (repository) {
44
37
  // Repository implementation provided by the user.
45
- container.bind(_symbols.MigrationRepositorySymbol).toConstantValue(repository);
38
+ container.bind(MigrationRepositorySymbol).toConstantValue(repository);
46
39
  } else {
47
40
  // Default repository implementation.
48
- container.bind(_symbols.MigrationRepositorySymbol).to(_migrations.MigrationRepositoryImpl);
41
+ container.bind(MigrationRepositorySymbol).to(MigrationRepositoryImpl);
49
42
  }
50
43
 
51
44
  // Bind the provided migrations.
52
- migrations.forEach(migration => container.bind(_symbols.MigrationSymbol).to(migration));
45
+ migrations.forEach(migration => container.bind(MigrationSymbol).to(migration));
53
46
 
54
47
  // If handler was invoked with a `pattern`, filter migrations that match the pattern only.
55
48
  let patternMatcher;
56
49
  if (payload.pattern) {
57
- patternMatcher = (0, _createPatternMatcher.createPatternMatcher)(payload.pattern);
50
+ patternMatcher = createPatternMatcher(payload.pattern);
58
51
  }
59
52
 
60
53
  // Inject dependencies and execute.
61
54
  try {
62
- const runner = await container.resolve(_MigrationRunner.MigrationRunner);
55
+ const runner = await container.resolve(MigrationRunner);
56
+ runner.setContext({
57
+ logGroupName: process.env.AWS_LAMBDA_LOG_GROUP_NAME,
58
+ logStreamName: process.env.AWS_LAMBDA_LOG_STREAM_NAME
59
+ });
63
60
  if (payload.command === "execute") {
64
- await runner.execute(projectVersion, patternMatcher || isMigrationApplicable);
61
+ await runner.execute(projectVersion, patternMatcher || isMigrationApplicable, forceExecute);
65
62
  return;
66
63
  }
67
64
  return {
@@ -76,4 +73,5 @@ const createDdbEsProjectMigration = _ref => {
76
73
  }
77
74
  });
78
75
  };
79
- exports.createDdbEsProjectMigration = createDdbEsProjectMigration;
76
+
77
+ //# sourceMappingURL=createDdbEsProjectMigration.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createDdbEsProjectMigration","migrations","elasticsearchClient","primaryTable","dynamoToEsTable","isMigrationApplicable","undefined","repository","config","createRawEventHandler","payload","lambdaContext","projectVersion","String","version","process","env","WEBINY_VERSION","devVersionErrorResponse","container","createContainer","bind","PrimaryDynamoTableSymbol","toConstantValue","ElasticsearchDynamoTableSymbol","ElasticsearchClientSymbol","timeLimiter","getRemainingTimeInMillis","ExecutionTimeLimiterSymbol","MigrationRepositorySymbol","to","MigrationRepositoryImpl","forEach","migration","MigrationSymbol","patternMatcher","pattern","createPatternMatcher","runner","resolve","MigrationRunner","command","execute","data","getStatus","err","error","message"],"sources":["createDdbEsProjectMigration.ts"],"sourcesContent":["import { Client as ElasticsearchClient } from \"@elastic/elasticsearch\";\nimport { Table } from \"dynamodb-toolbox\";\nimport { createRawEventHandler } from \"@webiny/handler-aws\";\nimport { createContainer, Constructor } from \"@webiny/ioc\";\nimport {\n DataMigration,\n ExecutionTimeLimiter,\n MigrationEventHandlerResponse,\n MigrationEventPayload,\n MigrationRepository\n} from \"~/types\";\nimport {\n ElasticsearchClientSymbol,\n MigrationRepositorySymbol,\n PrimaryDynamoTableSymbol,\n ElasticsearchDynamoTableSymbol,\n MigrationSymbol,\n ExecutionTimeLimiterSymbol\n} from \"~/symbols\";\nimport { IsMigrationApplicable, MigrationRunner } from \"~/MigrationRunner\";\nimport { MigrationRepositoryImpl } from \"~/repository/migrations.repository\";\nimport { devVersionErrorResponse } from \"~/handlers/devVersionErrorResponse\";\nimport { createPatternMatcher } from \"~/handlers/createPatternMatcher\";\n\ninterface CreateDdbEsDataMigrationConfig {\n elasticsearchClient: ElasticsearchClient;\n primaryTable: Table;\n dynamoToEsTable: Table;\n migrations: Constructor<DataMigration>[];\n isMigrationApplicable?: IsMigrationApplicable;\n repository?: MigrationRepository;\n timeLimiter?: ExecutionTimeLimiter;\n}\n\nexport const createDdbEsProjectMigration = ({\n migrations,\n elasticsearchClient,\n primaryTable,\n dynamoToEsTable,\n isMigrationApplicable = undefined,\n repository = undefined,\n ...config\n}: CreateDdbEsDataMigrationConfig) => {\n return createRawEventHandler<MigrationEventPayload, any, MigrationEventHandlerResponse>(\n async ({ payload, lambdaContext }) => {\n const projectVersion = String(payload?.version || process.env.WEBINY_VERSION);\n\n if (projectVersion === \"0.0.0\") {\n return devVersionErrorResponse();\n }\n\n // COMPOSITION ROOT\n const container = createContainer();\n container.bind(PrimaryDynamoTableSymbol).toConstantValue(primaryTable);\n container.bind(ElasticsearchDynamoTableSymbol).toConstantValue(dynamoToEsTable);\n container.bind(ElasticsearchClientSymbol).toConstantValue(elasticsearchClient);\n\n const timeLimiter: ExecutionTimeLimiter =\n config.timeLimiter || lambdaContext?.getRemainingTimeInMillis || (() => 0);\n container.bind(ExecutionTimeLimiterSymbol).toConstantValue(timeLimiter);\n\n if (repository) {\n // Repository implementation provided by the user.\n container.bind(MigrationRepositorySymbol).toConstantValue(repository);\n } else {\n // Default repository implementation.\n container.bind(MigrationRepositorySymbol).to(MigrationRepositoryImpl);\n }\n\n // Bind the provided migrations.\n migrations.forEach(migration => container.bind(MigrationSymbol).to(migration));\n\n // If handler was invoked with a `pattern`, filter migrations that match the pattern only.\n let patternMatcher;\n if (payload.pattern) {\n patternMatcher = createPatternMatcher(payload.pattern);\n }\n\n // Inject dependencies and execute.\n try {\n const runner = await container.resolve(MigrationRunner);\n\n if (payload.command === \"execute\") {\n await runner.execute(projectVersion, patternMatcher || isMigrationApplicable);\n return;\n }\n\n return { data: await runner.getStatus() };\n } catch (err) {\n return { error: { message: err.message } };\n }\n }\n );\n};\n"],"mappings":";;;;;;;;AAEA;AACA;AAQA;AAQA;AACA;AACA;AACA;AAAuE;AAYhE,MAAMA,2BAA2B,GAAG,QAQL;EAAA,IARM;MACxCC,UAAU;MACVC,mBAAmB;MACnBC,YAAY;MACZC,eAAe;MACfC,qBAAqB,GAAGC,SAAS;MACjCC,UAAU,GAAGD;IAEe,CAAC;IAD1BE,MAAM;EAET,OAAO,IAAAC,iCAAqB,EACxB,OAAO;IAAEC,OAAO;IAAEC;EAAc,CAAC,KAAK;IAClC,MAAMC,cAAc,GAAGC,MAAM,CAAC,CAAAH,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,OAAO,KAAIC,OAAO,CAACC,GAAG,CAACC,cAAc,CAAC;IAE7E,IAAIL,cAAc,KAAK,OAAO,EAAE;MAC5B,OAAO,IAAAM,gDAAuB,GAAE;IACpC;;IAEA;IACA,MAAMC,SAAS,GAAG,IAAAC,oBAAe,GAAE;IACnCD,SAAS,CAACE,IAAI,CAACC,iCAAwB,CAAC,CAACC,eAAe,CAACpB,YAAY,CAAC;IACtEgB,SAAS,CAACE,IAAI,CAACG,uCAA8B,CAAC,CAACD,eAAe,CAACnB,eAAe,CAAC;IAC/Ee,SAAS,CAACE,IAAI,CAACI,kCAAyB,CAAC,CAACF,eAAe,CAACrB,mBAAmB,CAAC;IAE9E,MAAMwB,WAAiC,GACnClB,MAAM,CAACkB,WAAW,KAAIf,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEgB,wBAAwB,MAAK,MAAM,CAAC,CAAC;IAC9ER,SAAS,CAACE,IAAI,CAACO,mCAA0B,CAAC,CAACL,eAAe,CAACG,WAAW,CAAC;IAEvE,IAAInB,UAAU,EAAE;MACZ;MACAY,SAAS,CAACE,IAAI,CAACQ,kCAAyB,CAAC,CAACN,eAAe,CAAChB,UAAU,CAAC;IACzE,CAAC,MAAM;MACH;MACAY,SAAS,CAACE,IAAI,CAACQ,kCAAyB,CAAC,CAACC,EAAE,CAACC,mCAAuB,CAAC;IACzE;;IAEA;IACA9B,UAAU,CAAC+B,OAAO,CAACC,SAAS,IAAId,SAAS,CAACE,IAAI,CAACa,wBAAe,CAAC,CAACJ,EAAE,CAACG,SAAS,CAAC,CAAC;;IAE9E;IACA,IAAIE,cAAc;IAClB,IAAIzB,OAAO,CAAC0B,OAAO,EAAE;MACjBD,cAAc,GAAG,IAAAE,0CAAoB,EAAC3B,OAAO,CAAC0B,OAAO,CAAC;IAC1D;;IAEA;IACA,IAAI;MACA,MAAME,MAAM,GAAG,MAAMnB,SAAS,CAACoB,OAAO,CAACC,gCAAe,CAAC;MAEvD,IAAI9B,OAAO,CAAC+B,OAAO,KAAK,SAAS,EAAE;QAC/B,MAAMH,MAAM,CAACI,OAAO,CAAC9B,cAAc,EAAEuB,cAAc,IAAI9B,qBAAqB,CAAC;QAC7E;MACJ;MAEA,OAAO;QAAEsC,IAAI,EAAE,MAAML,MAAM,CAACM,SAAS;MAAG,CAAC;IAC7C,CAAC,CAAC,OAAOC,GAAG,EAAE;MACV,OAAO;QAAEC,KAAK,EAAE;UAAEC,OAAO,EAAEF,GAAG,CAACE;QAAQ;MAAE,CAAC;IAC9C;EACJ,CAAC,CACJ;AACL,CAAC;AAAC"}
1
+ {"version":3,"names":["createRawEventHandler","createContainer","ElasticsearchClientSymbol","ElasticsearchDynamoTableSymbol","ExecutionTimeLimiterSymbol","MigrationRepositorySymbol","MigrationSymbol","PrimaryDynamoTableSymbol","MigrationRunner","MigrationRepositoryImpl","devVersionErrorResponse","createPatternMatcher","coerce","semverCoerce","createDdbEsProjectMigration","migrations","elasticsearchClient","primaryTable","dynamoToEsTable","isMigrationApplicable","undefined","repository","config","payload","lambdaContext","projectVersion","String","version","process","env","WEBINY_VERSION","forceExecute","force","container","bind","toConstantValue","timeLimiter","getRemainingTimeInMillis","to","forEach","migration","patternMatcher","pattern","runner","resolve","setContext","logGroupName","AWS_LAMBDA_LOG_GROUP_NAME","logStreamName","AWS_LAMBDA_LOG_STREAM_NAME","command","execute","data","getStatus","err","error","message"],"sources":["createDdbEsProjectMigration.ts"],"sourcesContent":["import type { Client as ElasticsearchClient } from \"@elastic/elasticsearch\";\nimport type { Table } from \"@webiny/db-dynamodb/toolbox.js\";\nimport { createRawEventHandler } from \"@webiny/handler-aws\";\nimport type { Constructor } from \"@webiny/ioc\";\nimport { createContainer } from \"@webiny/ioc\";\nimport type {\n DataMigration,\n ExecutionTimeLimiter,\n MigrationEventHandlerResponse,\n MigrationEventPayload,\n MigrationRepository\n} from \"~/types.js\";\nimport {\n ElasticsearchClientSymbol,\n ElasticsearchDynamoTableSymbol,\n ExecutionTimeLimiterSymbol,\n MigrationRepositorySymbol,\n MigrationSymbol,\n PrimaryDynamoTableSymbol\n} from \"~/symbols.js\";\nimport type { IsMigrationApplicable } from \"~/MigrationRunner.js\";\nimport { MigrationRunner } from \"~/MigrationRunner.js\";\nimport { MigrationRepositoryImpl } from \"~/repository/migrations.repository.js\";\nimport { devVersionErrorResponse } from \"~/handlers/devVersionErrorResponse.js\";\nimport { createPatternMatcher } from \"~/handlers/createPatternMatcher.js\";\nimport { coerce as semverCoerce } from \"semver\";\n\ninterface CreateDdbEsDataMigrationConfig {\n elasticsearchClient: ElasticsearchClient;\n primaryTable: Table<string, string, string>;\n dynamoToEsTable: Table<string, string, string>;\n migrations: Constructor<DataMigration>[];\n isMigrationApplicable?: IsMigrationApplicable;\n repository?: MigrationRepository;\n timeLimiter?: ExecutionTimeLimiter;\n}\n\nexport const createDdbEsProjectMigration = ({\n migrations,\n elasticsearchClient,\n primaryTable,\n dynamoToEsTable,\n isMigrationApplicable = undefined,\n repository = undefined,\n ...config\n}: CreateDdbEsDataMigrationConfig) => {\n return createRawEventHandler<MigrationEventPayload, any, MigrationEventHandlerResponse>(\n async ({ payload, lambdaContext }) => {\n const projectVersion = String(payload?.version || process.env.WEBINY_VERSION);\n const forceExecute = payload.force === true;\n\n const version = semverCoerce(projectVersion);\n if (version?.version === \"0.0.0\") {\n return devVersionErrorResponse();\n }\n\n // COMPOSITION ROOT\n const container = createContainer();\n container.bind(PrimaryDynamoTableSymbol).toConstantValue(primaryTable);\n container.bind(ElasticsearchDynamoTableSymbol).toConstantValue(dynamoToEsTable);\n container.bind(ElasticsearchClientSymbol).toConstantValue(elasticsearchClient);\n\n const timeLimiter: ExecutionTimeLimiter =\n config.timeLimiter || lambdaContext?.getRemainingTimeInMillis || (() => 0);\n container.bind(ExecutionTimeLimiterSymbol).toConstantValue(timeLimiter);\n\n if (repository) {\n // Repository implementation provided by the user.\n container.bind(MigrationRepositorySymbol).toConstantValue(repository);\n } else {\n // Default repository implementation.\n container.bind(MigrationRepositorySymbol).to(MigrationRepositoryImpl);\n }\n\n // Bind the provided migrations.\n migrations.forEach(migration => container.bind(MigrationSymbol).to(migration));\n\n // If handler was invoked with a `pattern`, filter migrations that match the pattern only.\n let patternMatcher;\n if (payload.pattern) {\n patternMatcher = createPatternMatcher(payload.pattern);\n }\n\n // Inject dependencies and execute.\n try {\n const runner = await container.resolve(MigrationRunner);\n runner.setContext({\n logGroupName: process.env.AWS_LAMBDA_LOG_GROUP_NAME,\n logStreamName: process.env.AWS_LAMBDA_LOG_STREAM_NAME\n });\n\n if (payload.command === \"execute\") {\n await runner.execute(\n projectVersion,\n patternMatcher || isMigrationApplicable,\n forceExecute\n );\n return;\n }\n\n return { data: await runner.getStatus() };\n } catch (err) {\n return { error: { message: err.message } };\n }\n }\n );\n};\n"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ,qBAAqB;AAE3D,SAASC,eAAe,QAAQ,aAAa;AAQ7C,SACIC,yBAAyB,EACzBC,8BAA8B,EAC9BC,0BAA0B,EAC1BC,yBAAyB,EACzBC,eAAe,EACfC,wBAAwB;AAG5B,SAASC,eAAe;AACxB,SAASC,uBAAuB;AAChC,SAASC,uBAAuB;AAChC,SAASC,oBAAoB;AAC7B,SAASC,MAAM,IAAIC,YAAY,QAAQ,QAAQ;AAY/C,OAAO,MAAMC,2BAA2B,GAAGA,CAAC;EACxCC,UAAU;EACVC,mBAAmB;EACnBC,YAAY;EACZC,eAAe;EACfC,qBAAqB,GAAGC,SAAS;EACjCC,UAAU,GAAGD,SAAS;EACtB,GAAGE;AACyB,CAAC,KAAK;EAClC,OAAOtB,qBAAqB,CACxB,OAAO;IAAEuB,OAAO;IAAEC;EAAc,CAAC,KAAK;IAClC,MAAMC,cAAc,GAAGC,MAAM,CAACH,OAAO,EAAEI,OAAO,IAAIC,OAAO,CAACC,GAAG,CAACC,cAAc,CAAC;IAC7E,MAAMC,YAAY,GAAGR,OAAO,CAACS,KAAK,KAAK,IAAI;IAE3C,MAAML,OAAO,GAAGd,YAAY,CAACY,cAAc,CAAC;IAC5C,IAAIE,OAAO,EAAEA,OAAO,KAAK,OAAO,EAAE;MAC9B,OAAOjB,uBAAuB,CAAC,CAAC;IACpC;;IAEA;IACA,MAAMuB,SAAS,GAAGhC,eAAe,CAAC,CAAC;IACnCgC,SAAS,CAACC,IAAI,CAAC3B,wBAAwB,CAAC,CAAC4B,eAAe,CAAClB,YAAY,CAAC;IACtEgB,SAAS,CAACC,IAAI,CAAC/B,8BAA8B,CAAC,CAACgC,eAAe,CAACjB,eAAe,CAAC;IAC/Ee,SAAS,CAACC,IAAI,CAAChC,yBAAyB,CAAC,CAACiC,eAAe,CAACnB,mBAAmB,CAAC;IAE9E,MAAMoB,WAAiC,GACnCd,MAAM,CAACc,WAAW,IAAIZ,aAAa,EAAEa,wBAAwB,KAAK,MAAM,CAAC,CAAC;IAC9EJ,SAAS,CAACC,IAAI,CAAC9B,0BAA0B,CAAC,CAAC+B,eAAe,CAACC,WAAW,CAAC;IAEvE,IAAIf,UAAU,EAAE;MACZ;MACAY,SAAS,CAACC,IAAI,CAAC7B,yBAAyB,CAAC,CAAC8B,eAAe,CAACd,UAAU,CAAC;IACzE,CAAC,MAAM;MACH;MACAY,SAAS,CAACC,IAAI,CAAC7B,yBAAyB,CAAC,CAACiC,EAAE,CAAC7B,uBAAuB,CAAC;IACzE;;IAEA;IACAM,UAAU,CAACwB,OAAO,CAACC,SAAS,IAAIP,SAAS,CAACC,IAAI,CAAC5B,eAAe,CAAC,CAACgC,EAAE,CAACE,SAAS,CAAC,CAAC;;IAE9E;IACA,IAAIC,cAAc;IAClB,IAAIlB,OAAO,CAACmB,OAAO,EAAE;MACjBD,cAAc,GAAG9B,oBAAoB,CAACY,OAAO,CAACmB,OAAO,CAAC;IAC1D;;IAEA;IACA,IAAI;MACA,MAAMC,MAAM,GAAG,MAAMV,SAAS,CAACW,OAAO,CAACpC,eAAe,CAAC;MACvDmC,MAAM,CAACE,UAAU,CAAC;QACdC,YAAY,EAAElB,OAAO,CAACC,GAAG,CAACkB,yBAAyB;QACnDC,aAAa,EAAEpB,OAAO,CAACC,GAAG,CAACoB;MAC/B,CAAC,CAAC;MAEF,IAAI1B,OAAO,CAAC2B,OAAO,KAAK,SAAS,EAAE;QAC/B,MAAMP,MAAM,CAACQ,OAAO,CAChB1B,cAAc,EACdgB,cAAc,IAAItB,qBAAqB,EACvCY,YACJ,CAAC;QACD;MACJ;MAEA,OAAO;QAAEqB,IAAI,EAAE,MAAMT,MAAM,CAACU,SAAS,CAAC;MAAE,CAAC;IAC7C,CAAC,CAAC,OAAOC,GAAG,EAAE;MACV,OAAO;QAAEC,KAAK,EAAE;UAAEC,OAAO,EAAEF,GAAG,CAACE;QAAQ;MAAE,CAAC;IAC9C;EACJ,CACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,10 +1,10 @@
1
- import { Table } from "dynamodb-toolbox";
2
- import { Constructor } from "@webiny/ioc";
3
- import { IsMigrationApplicable } from "../MigrationRunner";
4
- import { DataMigration, ExecutionTimeLimiter, MigrationEventHandlerResponse, MigrationEventPayload, MigrationRepository } from "../types";
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox.js";
2
+ import type { Constructor } from "@webiny/ioc";
3
+ import type { IsMigrationApplicable } from "../MigrationRunner.js";
4
+ import type { DataMigration, ExecutionTimeLimiter, MigrationEventHandlerResponse, MigrationEventPayload, MigrationRepository } from "../types.js";
5
5
  interface CreateDdbDataMigrationConfig {
6
6
  migrations: Constructor<DataMigration>[];
7
- primaryTable: Table;
7
+ primaryTable: Table<string, string, string>;
8
8
  repository?: MigrationRepository;
9
9
  isMigrationApplicable?: IsMigrationApplicable;
10
10
  timeLimiter?: ExecutionTimeLimiter;
@@ -1,63 +1,60 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createDdbProjectMigration = void 0;
8
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
- var _handlerAws = require("@webiny/handler-aws");
10
- var _ioc = require("@webiny/ioc");
11
- var _MigrationRunner = require("../MigrationRunner");
12
- var _symbols = require("../symbols");
13
- var _migrations = require("../repository/migrations.repository");
14
- var _devVersionErrorResponse = require("./devVersionErrorResponse");
15
- var _createPatternMatcher = require("./createPatternMatcher");
16
- const _excluded = ["migrations", "primaryTable", "isMigrationApplicable", "repository"];
17
- const createDdbProjectMigration = _ref => {
18
- let {
19
- migrations,
20
- primaryTable,
21
- isMigrationApplicable = undefined,
22
- repository = undefined
23
- } = _ref,
24
- config = (0, _objectWithoutProperties2.default)(_ref, _excluded);
25
- return (0, _handlerAws.createRawEventHandler)(async ({
1
+ import { createRawEventHandler } from "@webiny/handler-aws";
2
+ import { createContainer } from "@webiny/ioc";
3
+ import { MigrationRunner } from "../MigrationRunner.js";
4
+ import { ExecutionTimeLimiterSymbol, MigrationRepositorySymbol, MigrationSymbol, PrimaryDynamoTableSymbol } from "../symbols.js";
5
+ import { MigrationRepositoryImpl } from "../repository/migrations.repository.js";
6
+ import { devVersionErrorResponse } from "./devVersionErrorResponse.js";
7
+ import { createPatternMatcher } from "./createPatternMatcher.js";
8
+ import { coerce as semverCoerce } from "semver";
9
+ export const createDdbProjectMigration = ({
10
+ migrations,
11
+ primaryTable,
12
+ isMigrationApplicable = undefined,
13
+ repository = undefined,
14
+ ...config
15
+ }) => {
16
+ return createRawEventHandler(async ({
26
17
  payload,
27
18
  lambdaContext
28
19
  }) => {
29
- const projectVersion = String((payload === null || payload === void 0 ? void 0 : payload.version) || process.env.WEBINY_VERSION);
30
- if (projectVersion === "0.0.0") {
31
- return (0, _devVersionErrorResponse.devVersionErrorResponse)();
20
+ const projectVersion = String(payload?.version || process.env.WEBINY_VERSION);
21
+ const forceExecute = payload.force === true;
22
+ const version = semverCoerce(projectVersion);
23
+ if (version?.version === "0.0.0") {
24
+ return devVersionErrorResponse();
32
25
  }
33
26
 
34
27
  // COMPOSITION ROOT
35
- const container = (0, _ioc.createContainer)();
36
- container.bind(_symbols.PrimaryDynamoTableSymbol).toConstantValue(primaryTable);
37
- const timeLimiter = config.timeLimiter || (lambdaContext === null || lambdaContext === void 0 ? void 0 : lambdaContext.getRemainingTimeInMillis) || (() => 0);
38
- container.bind(_symbols.ExecutionTimeLimiterSymbol).toConstantValue(timeLimiter);
28
+ const container = createContainer();
29
+ container.bind(PrimaryDynamoTableSymbol).toConstantValue(primaryTable);
30
+ const timeLimiter = config.timeLimiter || lambdaContext?.getRemainingTimeInMillis || (() => 0);
31
+ container.bind(ExecutionTimeLimiterSymbol).toConstantValue(timeLimiter);
39
32
  if (repository) {
40
33
  // Repository implementation provided by the user.
41
- container.bind(_symbols.MigrationRepositorySymbol).toConstantValue(repository);
34
+ container.bind(MigrationRepositorySymbol).toConstantValue(repository);
42
35
  } else {
43
36
  // Default repository implementation.
44
- container.bind(_symbols.MigrationRepositorySymbol).to(_migrations.MigrationRepositoryImpl);
37
+ container.bind(MigrationRepositorySymbol).to(MigrationRepositoryImpl);
45
38
  }
46
39
 
47
40
  // Bind the provided migrations.
48
- migrations.forEach(migration => container.bind(_symbols.MigrationSymbol).to(migration));
41
+ migrations.forEach(migration => container.bind(MigrationSymbol).to(migration));
49
42
 
50
43
  // If handler was invoked with a `pattern`, filter migrations that match the pattern only.
51
44
  let patternMatcher;
52
45
  if (payload.pattern) {
53
- patternMatcher = (0, _createPatternMatcher.createPatternMatcher)(payload.pattern);
46
+ patternMatcher = createPatternMatcher(payload.pattern);
54
47
  }
55
48
 
56
49
  // Inject dependencies and execute.
57
50
  try {
58
- const runner = await container.resolve(_MigrationRunner.MigrationRunner);
51
+ const runner = await container.resolve(MigrationRunner);
52
+ runner.setContext({
53
+ logGroupName: process.env.AWS_LAMBDA_LOG_GROUP_NAME,
54
+ logStreamName: process.env.AWS_LAMBDA_LOG_STREAM_NAME
55
+ });
59
56
  if (payload.command === "execute") {
60
- await runner.execute(projectVersion, patternMatcher || isMigrationApplicable);
57
+ await runner.execute(projectVersion, patternMatcher || isMigrationApplicable, forceExecute);
61
58
  return;
62
59
  }
63
60
  return {
@@ -72,4 +69,5 @@ const createDdbProjectMigration = _ref => {
72
69
  }
73
70
  });
74
71
  };
75
- exports.createDdbProjectMigration = createDdbProjectMigration;
72
+
73
+ //# sourceMappingURL=createDdbProjectMigration.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createDdbProjectMigration","migrations","primaryTable","isMigrationApplicable","undefined","repository","config","createRawEventHandler","payload","lambdaContext","projectVersion","String","version","process","env","WEBINY_VERSION","devVersionErrorResponse","container","createContainer","bind","PrimaryDynamoTableSymbol","toConstantValue","timeLimiter","getRemainingTimeInMillis","ExecutionTimeLimiterSymbol","MigrationRepositorySymbol","to","MigrationRepositoryImpl","forEach","migration","MigrationSymbol","patternMatcher","pattern","createPatternMatcher","runner","resolve","MigrationRunner","command","execute","data","getStatus","err","error","message"],"sources":["createDdbProjectMigration.ts"],"sourcesContent":["import { Table } from \"dynamodb-toolbox\";\nimport { createRawEventHandler } from \"@webiny/handler-aws\";\nimport { Constructor, createContainer } from \"@webiny/ioc\";\nimport { IsMigrationApplicable, MigrationRunner } from \"~/MigrationRunner\";\nimport {\n MigrationRepositorySymbol,\n MigrationSymbol,\n PrimaryDynamoTableSymbol,\n ExecutionTimeLimiterSymbol\n} from \"~/symbols\";\nimport { MigrationRepositoryImpl } from \"~/repository/migrations.repository\";\nimport { devVersionErrorResponse } from \"./devVersionErrorResponse\";\nimport { createPatternMatcher } from \"./createPatternMatcher\";\nimport {\n DataMigration,\n ExecutionTimeLimiter,\n MigrationEventHandlerResponse,\n MigrationEventPayload,\n MigrationRepository\n} from \"~/types\";\n\ninterface CreateDdbDataMigrationConfig {\n migrations: Constructor<DataMigration>[];\n primaryTable: Table;\n repository?: MigrationRepository;\n isMigrationApplicable?: IsMigrationApplicable;\n timeLimiter?: ExecutionTimeLimiter;\n}\n\nexport const createDdbProjectMigration = ({\n migrations,\n primaryTable,\n isMigrationApplicable = undefined,\n repository = undefined,\n ...config\n}: CreateDdbDataMigrationConfig) => {\n return createRawEventHandler<MigrationEventPayload, any, MigrationEventHandlerResponse>(\n async ({ payload, lambdaContext }) => {\n const projectVersion = String(payload?.version || process.env.WEBINY_VERSION);\n\n if (projectVersion === \"0.0.0\") {\n return devVersionErrorResponse();\n }\n\n // COMPOSITION ROOT\n const container = createContainer();\n container.bind(PrimaryDynamoTableSymbol).toConstantValue(primaryTable);\n\n const timeLimiter: ExecutionTimeLimiter =\n config.timeLimiter || lambdaContext?.getRemainingTimeInMillis || (() => 0);\n container.bind(ExecutionTimeLimiterSymbol).toConstantValue(timeLimiter);\n\n if (repository) {\n // Repository implementation provided by the user.\n container.bind(MigrationRepositorySymbol).toConstantValue(repository);\n } else {\n // Default repository implementation.\n container.bind(MigrationRepositorySymbol).to(MigrationRepositoryImpl);\n }\n\n // Bind the provided migrations.\n migrations.forEach(migration => container.bind(MigrationSymbol).to(migration));\n\n // If handler was invoked with a `pattern`, filter migrations that match the pattern only.\n let patternMatcher;\n if (payload.pattern) {\n patternMatcher = createPatternMatcher(payload.pattern);\n }\n\n // Inject dependencies and execute.\n try {\n const runner = await container.resolve(MigrationRunner);\n\n if (payload.command === \"execute\") {\n await runner.execute(projectVersion, patternMatcher || isMigrationApplicable);\n return;\n }\n\n return { data: await runner.getStatus() };\n } catch (err) {\n return { error: { message: err.message } };\n }\n }\n );\n};\n"],"mappings":";;;;;;;;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AAA8D;AAiBvD,MAAMA,yBAAyB,GAAG,QAML;EAAA,IANM;MACtCC,UAAU;MACVC,YAAY;MACZC,qBAAqB,GAAGC,SAAS;MACjCC,UAAU,GAAGD;IAEa,CAAC;IADxBE,MAAM;EAET,OAAO,IAAAC,iCAAqB,EACxB,OAAO;IAAEC,OAAO;IAAEC;EAAc,CAAC,KAAK;IAClC,MAAMC,cAAc,GAAGC,MAAM,CAAC,CAAAH,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,OAAO,KAAIC,OAAO,CAACC,GAAG,CAACC,cAAc,CAAC;IAE7E,IAAIL,cAAc,KAAK,OAAO,EAAE;MAC5B,OAAO,IAAAM,gDAAuB,GAAE;IACpC;;IAEA;IACA,MAAMC,SAAS,GAAG,IAAAC,oBAAe,GAAE;IACnCD,SAAS,CAACE,IAAI,CAACC,iCAAwB,CAAC,CAACC,eAAe,CAACnB,YAAY,CAAC;IAEtE,MAAMoB,WAAiC,GACnChB,MAAM,CAACgB,WAAW,KAAIb,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEc,wBAAwB,MAAK,MAAM,CAAC,CAAC;IAC9EN,SAAS,CAACE,IAAI,CAACK,mCAA0B,CAAC,CAACH,eAAe,CAACC,WAAW,CAAC;IAEvE,IAAIjB,UAAU,EAAE;MACZ;MACAY,SAAS,CAACE,IAAI,CAACM,kCAAyB,CAAC,CAACJ,eAAe,CAAChB,UAAU,CAAC;IACzE,CAAC,MAAM;MACH;MACAY,SAAS,CAACE,IAAI,CAACM,kCAAyB,CAAC,CAACC,EAAE,CAACC,mCAAuB,CAAC;IACzE;;IAEA;IACA1B,UAAU,CAAC2B,OAAO,CAACC,SAAS,IAAIZ,SAAS,CAACE,IAAI,CAACW,wBAAe,CAAC,CAACJ,EAAE,CAACG,SAAS,CAAC,CAAC;;IAE9E;IACA,IAAIE,cAAc;IAClB,IAAIvB,OAAO,CAACwB,OAAO,EAAE;MACjBD,cAAc,GAAG,IAAAE,0CAAoB,EAACzB,OAAO,CAACwB,OAAO,CAAC;IAC1D;;IAEA;IACA,IAAI;MACA,MAAME,MAAM,GAAG,MAAMjB,SAAS,CAACkB,OAAO,CAACC,gCAAe,CAAC;MAEvD,IAAI5B,OAAO,CAAC6B,OAAO,KAAK,SAAS,EAAE;QAC/B,MAAMH,MAAM,CAACI,OAAO,CAAC5B,cAAc,EAAEqB,cAAc,IAAI5B,qBAAqB,CAAC;QAC7E;MACJ;MAEA,OAAO;QAAEoC,IAAI,EAAE,MAAML,MAAM,CAACM,SAAS;MAAG,CAAC;IAC7C,CAAC,CAAC,OAAOC,GAAG,EAAE;MACV,OAAO;QAAEC,KAAK,EAAE;UAAEC,OAAO,EAAEF,GAAG,CAACE;QAAQ;MAAE,CAAC;IAC9C;EACJ,CAAC,CACJ;AACL,CAAC;AAAC"}
1
+ {"version":3,"names":["createRawEventHandler","createContainer","MigrationRunner","ExecutionTimeLimiterSymbol","MigrationRepositorySymbol","MigrationSymbol","PrimaryDynamoTableSymbol","MigrationRepositoryImpl","devVersionErrorResponse","createPatternMatcher","coerce","semverCoerce","createDdbProjectMigration","migrations","primaryTable","isMigrationApplicable","undefined","repository","config","payload","lambdaContext","projectVersion","String","version","process","env","WEBINY_VERSION","forceExecute","force","container","bind","toConstantValue","timeLimiter","getRemainingTimeInMillis","to","forEach","migration","patternMatcher","pattern","runner","resolve","setContext","logGroupName","AWS_LAMBDA_LOG_GROUP_NAME","logStreamName","AWS_LAMBDA_LOG_STREAM_NAME","command","execute","data","getStatus","err","error","message"],"sources":["createDdbProjectMigration.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox.js\";\nimport { createRawEventHandler } from \"@webiny/handler-aws\";\nimport type { Constructor } from \"@webiny/ioc\";\nimport { createContainer } from \"@webiny/ioc\";\nimport type { IsMigrationApplicable } from \"~/MigrationRunner.js\";\nimport { MigrationRunner } from \"~/MigrationRunner.js\";\nimport {\n ExecutionTimeLimiterSymbol,\n MigrationRepositorySymbol,\n MigrationSymbol,\n PrimaryDynamoTableSymbol\n} from \"~/symbols.js\";\nimport { MigrationRepositoryImpl } from \"~/repository/migrations.repository.js\";\nimport { devVersionErrorResponse } from \"./devVersionErrorResponse.js\";\nimport { createPatternMatcher } from \"./createPatternMatcher.js\";\nimport type {\n DataMigration,\n ExecutionTimeLimiter,\n MigrationEventHandlerResponse,\n MigrationEventPayload,\n MigrationRepository\n} from \"~/types.js\";\nimport { coerce as semverCoerce } from \"semver\";\n\ninterface CreateDdbDataMigrationConfig {\n migrations: Constructor<DataMigration>[];\n primaryTable: Table<string, string, string>;\n repository?: MigrationRepository;\n isMigrationApplicable?: IsMigrationApplicable;\n timeLimiter?: ExecutionTimeLimiter;\n}\n\nexport const createDdbProjectMigration = ({\n migrations,\n primaryTable,\n isMigrationApplicable = undefined,\n repository = undefined,\n ...config\n}: CreateDdbDataMigrationConfig) => {\n return createRawEventHandler<MigrationEventPayload, any, MigrationEventHandlerResponse>(\n async ({ payload, lambdaContext }) => {\n const projectVersion = String(payload?.version || process.env.WEBINY_VERSION);\n const forceExecute = payload.force === true;\n\n const version = semverCoerce(projectVersion);\n if (version?.version === \"0.0.0\") {\n return devVersionErrorResponse();\n }\n\n // COMPOSITION ROOT\n const container = createContainer();\n container.bind(PrimaryDynamoTableSymbol).toConstantValue(primaryTable);\n\n const timeLimiter: ExecutionTimeLimiter =\n config.timeLimiter || lambdaContext?.getRemainingTimeInMillis || (() => 0);\n container.bind(ExecutionTimeLimiterSymbol).toConstantValue(timeLimiter);\n\n if (repository) {\n // Repository implementation provided by the user.\n container.bind(MigrationRepositorySymbol).toConstantValue(repository);\n } else {\n // Default repository implementation.\n container.bind(MigrationRepositorySymbol).to(MigrationRepositoryImpl);\n }\n\n // Bind the provided migrations.\n migrations.forEach(migration => container.bind(MigrationSymbol).to(migration));\n\n // If handler was invoked with a `pattern`, filter migrations that match the pattern only.\n let patternMatcher;\n if (payload.pattern) {\n patternMatcher = createPatternMatcher(payload.pattern);\n }\n\n // Inject dependencies and execute.\n try {\n const runner = await container.resolve(MigrationRunner);\n runner.setContext({\n logGroupName: process.env.AWS_LAMBDA_LOG_GROUP_NAME,\n logStreamName: process.env.AWS_LAMBDA_LOG_STREAM_NAME\n });\n\n if (payload.command === \"execute\") {\n await runner.execute(\n projectVersion,\n patternMatcher || isMigrationApplicable,\n forceExecute\n );\n return;\n }\n\n return {\n data: await runner.getStatus()\n };\n } catch (err) {\n return { error: { message: err.message } };\n }\n }\n );\n};\n"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,qBAAqB;AAE3D,SAASC,eAAe,QAAQ,aAAa;AAE7C,SAASC,eAAe;AACxB,SACIC,0BAA0B,EAC1BC,yBAAyB,EACzBC,eAAe,EACfC,wBAAwB;AAE5B,SAASC,uBAAuB;AAChC,SAASC,uBAAuB;AAChC,SAASC,oBAAoB;AAQ7B,SAASC,MAAM,IAAIC,YAAY,QAAQ,QAAQ;AAU/C,OAAO,MAAMC,yBAAyB,GAAGA,CAAC;EACtCC,UAAU;EACVC,YAAY;EACZC,qBAAqB,GAAGC,SAAS;EACjCC,UAAU,GAAGD,SAAS;EACtB,GAAGE;AACuB,CAAC,KAAK;EAChC,OAAOlB,qBAAqB,CACxB,OAAO;IAAEmB,OAAO;IAAEC;EAAc,CAAC,KAAK;IAClC,MAAMC,cAAc,GAAGC,MAAM,CAACH,OAAO,EAAEI,OAAO,IAAIC,OAAO,CAACC,GAAG,CAACC,cAAc,CAAC;IAC7E,MAAMC,YAAY,GAAGR,OAAO,CAACS,KAAK,KAAK,IAAI;IAE3C,MAAML,OAAO,GAAGZ,YAAY,CAACU,cAAc,CAAC;IAC5C,IAAIE,OAAO,EAAEA,OAAO,KAAK,OAAO,EAAE;MAC9B,OAAOf,uBAAuB,CAAC,CAAC;IACpC;;IAEA;IACA,MAAMqB,SAAS,GAAG5B,eAAe,CAAC,CAAC;IACnC4B,SAAS,CAACC,IAAI,CAACxB,wBAAwB,CAAC,CAACyB,eAAe,CAACjB,YAAY,CAAC;IAEtE,MAAMkB,WAAiC,GACnCd,MAAM,CAACc,WAAW,IAAIZ,aAAa,EAAEa,wBAAwB,KAAK,MAAM,CAAC,CAAC;IAC9EJ,SAAS,CAACC,IAAI,CAAC3B,0BAA0B,CAAC,CAAC4B,eAAe,CAACC,WAAW,CAAC;IAEvE,IAAIf,UAAU,EAAE;MACZ;MACAY,SAAS,CAACC,IAAI,CAAC1B,yBAAyB,CAAC,CAAC2B,eAAe,CAACd,UAAU,CAAC;IACzE,CAAC,MAAM;MACH;MACAY,SAAS,CAACC,IAAI,CAAC1B,yBAAyB,CAAC,CAAC8B,EAAE,CAAC3B,uBAAuB,CAAC;IACzE;;IAEA;IACAM,UAAU,CAACsB,OAAO,CAACC,SAAS,IAAIP,SAAS,CAACC,IAAI,CAACzB,eAAe,CAAC,CAAC6B,EAAE,CAACE,SAAS,CAAC,CAAC;;IAE9E;IACA,IAAIC,cAAc;IAClB,IAAIlB,OAAO,CAACmB,OAAO,EAAE;MACjBD,cAAc,GAAG5B,oBAAoB,CAACU,OAAO,CAACmB,OAAO,CAAC;IAC1D;;IAEA;IACA,IAAI;MACA,MAAMC,MAAM,GAAG,MAAMV,SAAS,CAACW,OAAO,CAACtC,eAAe,CAAC;MACvDqC,MAAM,CAACE,UAAU,CAAC;QACdC,YAAY,EAAElB,OAAO,CAACC,GAAG,CAACkB,yBAAyB;QACnDC,aAAa,EAAEpB,OAAO,CAACC,GAAG,CAACoB;MAC/B,CAAC,CAAC;MAEF,IAAI1B,OAAO,CAAC2B,OAAO,KAAK,SAAS,EAAE;QAC/B,MAAMP,MAAM,CAACQ,OAAO,CAChB1B,cAAc,EACdgB,cAAc,IAAItB,qBAAqB,EACvCY,YACJ,CAAC;QACD;MACJ;MAEA,OAAO;QACHqB,IAAI,EAAE,MAAMT,MAAM,CAACU,SAAS,CAAC;MACjC,CAAC;IACL,CAAC,CAAC,OAAOC,GAAG,EAAE;MACV,OAAO;QAAEC,KAAK,EAAE;UAAEC,OAAO,EAAEF,GAAG,CAACE;QAAQ;MAAE,CAAC;IAC9C;EACJ,CACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { IsMigrationApplicable } from "../MigrationRunner";
1
+ import type { IsMigrationApplicable } from "../MigrationRunner.js";
2
2
  export declare const createPatternMatcher: (pattern: string) => IsMigrationApplicable;
@@ -1,17 +1,11 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createPatternMatcher = void 0;
8
- var _minimatch = _interopRequireDefault(require("minimatch"));
9
- const createPatternMatcher = pattern => {
1
+ import minimatch from "minimatch";
2
+ export const createPatternMatcher = pattern => {
10
3
  return migration => {
11
4
  if (pattern.includes("*")) {
12
- return (0, _minimatch.default)(migration.getId(), pattern);
5
+ return minimatch(migration.getId(), pattern);
13
6
  }
14
7
  return migration.getId() === pattern;
15
8
  };
16
9
  };
17
- exports.createPatternMatcher = createPatternMatcher;
10
+
11
+ //# sourceMappingURL=createPatternMatcher.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createPatternMatcher","pattern","migration","includes","minimatch","getId"],"sources":["createPatternMatcher.ts"],"sourcesContent":["import minimatch from \"minimatch\";\nimport { IsMigrationApplicable } from \"~/MigrationRunner\";\n\nexport const createPatternMatcher = (pattern: string): IsMigrationApplicable => {\n return migration => {\n if (pattern.includes(\"*\")) {\n return minimatch(migration.getId(), pattern);\n }\n return migration.getId() === pattern;\n };\n};\n"],"mappings":";;;;;;;AAAA;AAGO,MAAMA,oBAAoB,GAAIC,OAAe,IAA4B;EAC5E,OAAOC,SAAS,IAAI;IAChB,IAAID,OAAO,CAACE,QAAQ,CAAC,GAAG,CAAC,EAAE;MACvB,OAAO,IAAAC,kBAAS,EAACF,SAAS,CAACG,KAAK,EAAE,EAAEJ,OAAO,CAAC;IAChD;IACA,OAAOC,SAAS,CAACG,KAAK,EAAE,KAAKJ,OAAO;EACxC,CAAC;AACL,CAAC;AAAC"}
1
+ {"version":3,"names":["minimatch","createPatternMatcher","pattern","migration","includes","getId"],"sources":["createPatternMatcher.ts"],"sourcesContent":["import minimatch from \"minimatch\";\nimport type { IsMigrationApplicable } from \"~/MigrationRunner.js\";\n\nexport const createPatternMatcher = (pattern: string): IsMigrationApplicable => {\n return migration => {\n if (pattern.includes(\"*\")) {\n return minimatch(migration.getId(), pattern);\n }\n return migration.getId() === pattern;\n };\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,WAAW;AAGjC,OAAO,MAAMC,oBAAoB,GAAIC,OAAe,IAA4B;EAC5E,OAAOC,SAAS,IAAI;IAChB,IAAID,OAAO,CAACE,QAAQ,CAAC,GAAG,CAAC,EAAE;MACvB,OAAOJ,SAAS,CAACG,SAAS,CAACE,KAAK,CAAC,CAAC,EAAEH,OAAO,CAAC;IAChD;IACA,OAAOC,SAAS,CAACE,KAAK,CAAC,CAAC,KAAKH,OAAO;EACxC,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,14 +1,9 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.devVersionErrorResponse = void 0;
7
- const devVersionErrorResponse = () => {
1
+ export const devVersionErrorResponse = () => {
8
2
  return {
9
3
  error: {
10
4
  message: [`This project is using a development version 0.0.0!`, `Migrations cannot be executed using version 0.0.0, as that makes them all eligible for execution.`, `To trigger a particular set of migrations, set a WEBINY_VERSION variable in the .env file.`].join(" ")
11
5
  }
12
6
  };
13
7
  };
14
- exports.devVersionErrorResponse = devVersionErrorResponse;
8
+
9
+ //# sourceMappingURL=devVersionErrorResponse.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["devVersionErrorResponse","error","message","join"],"sources":["devVersionErrorResponse.ts"],"sourcesContent":["export const devVersionErrorResponse = () => {\n return {\n error: {\n message: [\n `This project is using a development version 0.0.0!`,\n `Migrations cannot be executed using version 0.0.0, as that makes them all eligible for execution.`,\n `To trigger a particular set of migrations, set a WEBINY_VERSION variable in the .env file.`\n ].join(\" \")\n }\n };\n};\n"],"mappings":";;;;;;AAAO,MAAMA,uBAAuB,GAAG,MAAM;EACzC,OAAO;IACHC,KAAK,EAAE;MACHC,OAAO,EAAE,CACJ,oDAAmD,EACnD,mGAAkG,EAClG,4FAA2F,CAC/F,CAACC,IAAI,CAAC,GAAG;IACd;EACJ,CAAC;AACL,CAAC;AAAC"}
1
+ {"version":3,"names":["devVersionErrorResponse","error","message","join"],"sources":["devVersionErrorResponse.ts"],"sourcesContent":["export const devVersionErrorResponse = () => {\n return {\n error: {\n message: [\n `This project is using a development version 0.0.0!`,\n `Migrations cannot be executed using version 0.0.0, as that makes them all eligible for execution.`,\n `To trigger a particular set of migrations, set a WEBINY_VERSION variable in the .env file.`\n ].join(\" \")\n }\n };\n};\n"],"mappings":"AAAA,OAAO,MAAMA,uBAAuB,GAAGA,CAAA,KAAM;EACzC,OAAO;IACHC,KAAK,EAAE;MACHC,OAAO,EAAE,CACL,oDAAoD,EACpD,mGAAmG,EACnG,4FAA4F,CAC/F,CAACC,IAAI,CAAC,GAAG;IACd;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
package/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- export * from "./handlers/createDdbProjectMigration";
2
- export * from "./handlers/createDdbEsProjectMigration";
3
- export * from "./symbols";
4
- export * from "./types";
5
- export * from "./createTable";
6
- export * from "./createPinoLogger";
7
- export * from "./createPinoLogger";
1
+ export * from "./handlers/createDdbProjectMigration.js";
2
+ export * from "./handlers/createDdbEsProjectMigration.js";
3
+ export * from "./types.js";
4
+ export * from "./createTable.js";
5
+ export * from "./createPinoLogger.js";
6
+ export * from "./createPinoLogger.js";
package/index.js CHANGED
@@ -1,71 +1,8 @@
1
- "use strict";
1
+ export * from "./handlers/createDdbProjectMigration.js";
2
+ export * from "./handlers/createDdbEsProjectMigration.js";
3
+ export * from "./types.js";
4
+ export * from "./createTable.js";
5
+ export * from "./createPinoLogger.js";
6
+ export * from "./createPinoLogger.js";
2
7
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _createDdbProjectMigration = require("./handlers/createDdbProjectMigration");
7
- Object.keys(_createDdbProjectMigration).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _createDdbProjectMigration[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _createDdbProjectMigration[key];
14
- }
15
- });
16
- });
17
- var _createDdbEsProjectMigration = require("./handlers/createDdbEsProjectMigration");
18
- Object.keys(_createDdbEsProjectMigration).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _createDdbEsProjectMigration[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _createDdbEsProjectMigration[key];
25
- }
26
- });
27
- });
28
- var _symbols = require("./symbols");
29
- Object.keys(_symbols).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _symbols[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _symbols[key];
36
- }
37
- });
38
- });
39
- var _types = require("./types");
40
- Object.keys(_types).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _types[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function () {
46
- return _types[key];
47
- }
48
- });
49
- });
50
- var _createTable = require("./createTable");
51
- Object.keys(_createTable).forEach(function (key) {
52
- if (key === "default" || key === "__esModule") return;
53
- if (key in exports && exports[key] === _createTable[key]) return;
54
- Object.defineProperty(exports, key, {
55
- enumerable: true,
56
- get: function () {
57
- return _createTable[key];
58
- }
59
- });
60
- });
61
- var _createPinoLogger = require("./createPinoLogger");
62
- Object.keys(_createPinoLogger).forEach(function (key) {
63
- if (key === "default" || key === "__esModule") return;
64
- if (key in exports && exports[key] === _createPinoLogger[key]) return;
65
- Object.defineProperty(exports, key, {
66
- enumerable: true,
67
- get: function () {
68
- return _createPinoLogger[key];
69
- }
70
- });
71
- });
8
+ //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./handlers/createDdbProjectMigration\";\nexport * from \"./handlers/createDdbEsProjectMigration\";\nexport * from \"./symbols\";\nexport * from \"./types\";\nexport * from \"./createTable\";\nexport * from \"./createPinoLogger\";\nexport * from \"./createPinoLogger\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AACA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./handlers/createDdbProjectMigration.js\";\nexport * from \"./handlers/createDdbEsProjectMigration.js\";\nexport * from \"./types.js\";\nexport * from \"./createTable.js\";\nexport * from \"./createPinoLogger.js\";\nexport * from \"./createPinoLogger.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@webiny/data-migration",
3
- "version": "0.0.0-unstable.496cf268ac",
3
+ "version": "0.0.0-unstable.61c048f412",
4
4
  "main": "index.js",
5
- "types": "types.ts",
5
+ "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -11,50 +11,33 @@
11
11
  "description": "Tools to author and execute data migrations.",
12
12
  "author": "Webiny Ltd.",
13
13
  "dependencies": {
14
- "@babel/runtime": "7.20.13",
15
14
  "@elastic/elasticsearch": "7.12.0",
16
- "@types/pino": "7.0.5",
17
- "@webiny/db-dynamodb": "0.0.0-unstable.496cf268ac",
18
- "@webiny/handler-aws": "0.0.0-unstable.496cf268ac",
19
- "@webiny/ioc": "0.0.0-unstable.496cf268ac",
20
- "@webiny/utils": "0.0.0-unstable.496cf268ac",
15
+ "@webiny/aws-sdk": "0.0.0-unstable.61c048f412",
16
+ "@webiny/db-dynamodb": "0.0.0-unstable.61c048f412",
17
+ "@webiny/handler-aws": "0.0.0-unstable.61c048f412",
18
+ "@webiny/ioc": "0.0.0-unstable.61c048f412",
19
+ "@webiny/logger": "0.0.0-unstable.61c048f412",
20
+ "@webiny/project": "0.0.0-unstable.61c048f412",
21
+ "@webiny/utils": "0.0.0-unstable.61c048f412",
21
22
  "center-align": "1.0.1",
22
23
  "chalk": "4.1.2",
23
- "dynamodb-toolbox": "0.3.5",
24
- "mdbid": "1.0.0",
25
24
  "minimatch": "5.1.6",
26
- "pino": "8.11.0",
27
- "pino-pretty": "9.4.0",
28
- "semver": "6.3.0"
25
+ "pino-pretty": "9.4.1",
26
+ "semver": "7.7.4"
29
27
  },
30
28
  "devDependencies": {
31
- "@babel/cli": "^7.19.3",
32
- "@babel/core": "^7.19.3",
33
- "@babel/preset-env": "^7.19.4",
34
- "@types/center-align": "^1.0.0",
35
- "@types/semver": "^7.3.4",
36
- "@webiny/cli": "^0.0.0-unstable.496cf268ac",
37
- "@webiny/project-utils": "^0.0.0-unstable.496cf268ac",
38
- "jest": "^28.1.0",
39
- "jest-dynalite": "^3.2.0",
40
- "jest-mock-console": "^1.0.0",
41
- "rimraf": "^3.0.2",
42
- "typescript": "4.7.4"
29
+ "@types/center-align": "1.0.2",
30
+ "@types/semver": "7.7.1",
31
+ "@webiny/build-tools": "0.0.0-unstable.61c048f412",
32
+ "@webiny/project-utils": "0.0.0-unstable.61c048f412",
33
+ "jest-dynalite": "3.6.1",
34
+ "rimraf": "6.1.2",
35
+ "typescript": "5.9.3",
36
+ "vitest": "3.2.4"
43
37
  },
44
38
  "publishConfig": {
45
39
  "access": "public",
46
40
  "directory": "dist"
47
41
  },
48
- "scripts": {
49
- "build": "yarn webiny run build",
50
- "watch": "yarn webiny run watch"
51
- },
52
- "adio": {
53
- "ignore": {
54
- "dependencies": [
55
- "@types/pino"
56
- ]
57
- }
58
- },
59
- "gitHead": "496cf268acd5b092c860b62d75c7d765c9472043"
42
+ "gitHead": "61c048f412d6b4aa70c1d105aab21e3fa69730f3"
60
43
  }
@@ -1,10 +1,10 @@
1
- import { Table } from "dynamodb-toolbox";
2
- import { MigrationItem, MigrationRepository, MigrationRun } from "../types";
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox.js";
2
+ import type { MigrationItem, MigrationRepository, MigrationRun } from "../types.js";
3
3
  export declare class MigrationRepositoryImpl implements MigrationRepository {
4
4
  private readonly run;
5
5
  private readonly migration;
6
6
  private readonly checkpoint;
7
- constructor(table: Table);
7
+ constructor(table: Table<string, string, string>);
8
8
  getLastRun(): Promise<MigrationRun | null>;
9
9
  saveRun(run: MigrationRun): Promise<void>;
10
10
  listMigrations(params?: {