@contember/migrations-client 1.4.0-alpha.5
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/src/JsLoader.d.ts +10 -0
- package/dist/src/JsLoader.d.ts.map +1 -0
- package/dist/src/JsLoader.js +33 -0
- package/dist/src/JsLoader.js.map +1 -0
- package/dist/src/JsonLoader.d.ts +9 -0
- package/dist/src/JsonLoader.d.ts.map +1 -0
- package/dist/src/JsonLoader.js +37 -0
- package/dist/src/JsonLoader.js.map +1 -0
- package/dist/src/MigrationCreator.d.ts +21 -0
- package/dist/src/MigrationCreator.d.ts.map +1 -0
- package/dist/src/MigrationCreator.js +47 -0
- package/dist/src/MigrationCreator.js.map +1 -0
- package/dist/src/MigrationExecuteHelper.d.ts +13 -0
- package/dist/src/MigrationExecuteHelper.d.ts.map +1 -0
- package/dist/src/MigrationExecuteHelper.js +61 -0
- package/dist/src/MigrationExecuteHelper.js.map +1 -0
- package/dist/src/MigrationFile.d.ts +36 -0
- package/dist/src/MigrationFile.d.ts.map +1 -0
- package/dist/src/MigrationFile.js +6 -0
- package/dist/src/MigrationFile.js.map +1 -0
- package/dist/src/MigrationFileLoader.d.ts +5 -0
- package/dist/src/MigrationFileLoader.d.ts.map +1 -0
- package/dist/src/MigrationFileLoader.js +3 -0
- package/dist/src/MigrationFileLoader.js.map +1 -0
- package/dist/src/MigrationFilesManager.d.ts +18 -0
- package/dist/src/MigrationFilesManager.d.ts.map +1 -0
- package/dist/src/MigrationFilesManager.js +114 -0
- package/dist/src/MigrationFilesManager.js.map +1 -0
- package/dist/src/MigrationParser.d.ts +6 -0
- package/dist/src/MigrationParser.d.ts.map +1 -0
- package/dist/src/MigrationParser.js +33 -0
- package/dist/src/MigrationParser.js.map +1 -0
- package/dist/src/MigrationsResolver.d.ts +14 -0
- package/dist/src/MigrationsResolver.d.ts.map +1 -0
- package/dist/src/MigrationsResolver.js +37 -0
- package/dist/src/MigrationsResolver.js.map +1 -0
- package/dist/src/SchemaVersionBuilder.d.ts +13 -0
- package/dist/src/SchemaVersionBuilder.d.ts.map +1 -0
- package/dist/src/SchemaVersionBuilder.js +26 -0
- package/dist/src/SchemaVersionBuilder.js.map +1 -0
- package/dist/src/SystemClient.d.ts +29 -0
- package/dist/src/SystemClient.d.ts.map +1 -0
- package/dist/src/SystemClient.js +117 -0
- package/dist/src/SystemClient.js.map +1 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +37 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/migrations.d.ts +56 -0
- package/dist/src/migrations.d.ts.map +1 -0
- package/dist/src/migrations.js +87 -0
- package/dist/src/migrations.js.map +1 -0
- package/dist/src/tsconfig.tsbuildinfo +1 -0
- package/dist/src/utils/assertNever.d.ts +2 -0
- package/dist/src/utils/assertNever.d.ts.map +1 -0
- package/dist/src/utils/assertNever.js +8 -0
- package/dist/src/utils/assertNever.js.map +1 -0
- package/dist/src/utils/json.d.ts +7 -0
- package/dist/src/utils/json.d.ts.map +1 -0
- package/dist/src/utils/json.js +3 -0
- package/dist/src/utils/json.js.map +1 -0
- package/package.json +24 -0
- package/src/JsLoader.ts +39 -0
- package/src/JsonLoader.ts +18 -0
- package/src/MigrationCreator.ts +60 -0
- package/src/MigrationExecuteHelper.ts +79 -0
- package/src/MigrationFile.ts +52 -0
- package/src/MigrationFileLoader.ts +5 -0
- package/src/MigrationFilesManager.ts +102 -0
- package/src/MigrationParser.ts +32 -0
- package/src/MigrationsResolver.ts +44 -0
- package/src/SchemaVersionBuilder.ts +33 -0
- package/src/SystemClient.ts +150 -0
- package/src/index.ts +23 -0
- package/src/migrations.ts +157 -0
- package/src/tsconfig.json +13 -0
- package/src/utils/assertNever.ts +3 -0
- package/src/utils/json.ts +4 -0
- package/tsconfig.json +5 -0
- package/tsconfig.settings.json +3 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MigrationFileLoader } from './MigrationFileLoader';
|
|
2
|
+
import { MigrationParser } from './MigrationParser';
|
|
3
|
+
import { MigrationContent, MigrationFile } from './MigrationFile';
|
|
4
|
+
export declare class JsLoader implements MigrationFileLoader {
|
|
5
|
+
private readonly migrationParser;
|
|
6
|
+
private readonly jsExecutor;
|
|
7
|
+
constructor(migrationParser: MigrationParser, jsExecutor: (file: string) => Promise<any>);
|
|
8
|
+
load(file: MigrationFile): Promise<MigrationContent>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=JsLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsLoader.d.ts","sourceRoot":"","sources":["../../src/JsLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAoB,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEnF,qBAAa,QAAS,YAAW,mBAAmB;IAElD,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBADV,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC;IAK/C,IAAI,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC;CA0BjE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsLoader = void 0;
|
|
4
|
+
class JsLoader {
|
|
5
|
+
constructor(migrationParser, jsExecutor) {
|
|
6
|
+
this.migrationParser = migrationParser;
|
|
7
|
+
this.jsExecutor = jsExecutor;
|
|
8
|
+
}
|
|
9
|
+
async load(file) {
|
|
10
|
+
// const code = await buildJs(file.path)
|
|
11
|
+
// const fn = new Function(`var module = {}; ((module) => { ${code} })(module); return module`)
|
|
12
|
+
const exports = await this.jsExecutor(file.path);
|
|
13
|
+
if (!('default' in exports) && !('query' in exports) && !('queries' in exports)) {
|
|
14
|
+
throw `export "default" or "query" is required in ${file.path}`;
|
|
15
|
+
}
|
|
16
|
+
if (typeof exports.default !== 'function') {
|
|
17
|
+
return this.migrationParser.parse(file, exports.default || exports);
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
type: 'factory',
|
|
21
|
+
factory: async () => {
|
|
22
|
+
const result = await exports.default();
|
|
23
|
+
const migration = this.migrationParser.parse(file, result !== null && result !== void 0 ? result : { queries: [] });
|
|
24
|
+
if (migration.type !== 'content') {
|
|
25
|
+
throw new Error();
|
|
26
|
+
}
|
|
27
|
+
return migration;
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.JsLoader = JsLoader;
|
|
33
|
+
//# sourceMappingURL=JsLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsLoader.js","sourceRoot":"","sources":["../../src/JsLoader.ts"],"names":[],"mappings":";;;AAIA,MAAa,QAAQ;IACpB,YACkB,eAAgC,EAChC,UAA0C;QAD1C,oBAAe,GAAf,eAAe,CAAiB;QAChC,eAAU,GAAV,UAAU,CAAgC;IAE5D,CAAC;IAGM,KAAK,CAAC,IAAI,CAAC,IAAmB;QAEpC,wCAAwC;QACxC,+FAA+F;QAE/F,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAChD,IAAI,CAAC,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,IAAI,OAAO,CAAC,EAAE;YAChF,MAAM,8CAA8C,IAAI,CAAC,IAAI,EAAE,CAAA;SAC/D;QACD,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,UAAU,EAAE;YAC1C,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,CAAA;SACnE;QAED,OAAO;YACN,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK,IAA+B,EAAE;gBAC9C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAA;gBACtC,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;gBAC7E,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,EAAE;oBACjC,MAAM,IAAI,KAAK,EAAE,CAAA;iBACjB;gBACD,OAAO,SAAS,CAAA;YACjB,CAAC;SAED,CAAA;IACF,CAAC;CACD;AAlCD,4BAkCC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MigrationFileLoader } from './MigrationFileLoader';
|
|
2
|
+
import { MigrationParser } from './MigrationParser';
|
|
3
|
+
import { MigrationFile } from './MigrationFile';
|
|
4
|
+
export declare class JsonLoader implements MigrationFileLoader {
|
|
5
|
+
private readonly migrationParser;
|
|
6
|
+
constructor(migrationParser: MigrationParser);
|
|
7
|
+
load(file: MigrationFile): Promise<import("./MigrationFile").ResolvedMigrationContent>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=JsonLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonLoader.d.ts","sourceRoot":"","sources":["../../src/JsonLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,qBAAa,UAAW,YAAW,mBAAmB;IAEpD,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,eAAe;IAIrC,IAAI,CAAC,IAAI,EAAE,aAAa;CAMrC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.JsonLoader = void 0;
|
|
27
|
+
const fs = __importStar(require("node:fs/promises"));
|
|
28
|
+
class JsonLoader {
|
|
29
|
+
constructor(migrationParser) {
|
|
30
|
+
this.migrationParser = migrationParser;
|
|
31
|
+
}
|
|
32
|
+
async load(file) {
|
|
33
|
+
return this.migrationParser.parse(file, JSON.parse(await fs.readFile(file.path, { encoding: 'utf8' })));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.JsonLoader = JsonLoader;
|
|
37
|
+
//# sourceMappingURL=JsonLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonLoader.js","sourceRoot":"","sources":["../../src/JsonLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAAsC;AAItC,MAAa,UAAU;IACtB,YACkB,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAElD,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,IAAmB;QACpC,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAChC,IAAI,EACJ,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CAC9D,CAAA;IACF,CAAC;CACD;AAZD,gCAYC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MigrationFilesManager } from './MigrationFilesManager';
|
|
2
|
+
import { Schema } from '@contember/schema';
|
|
3
|
+
import { Migration, SchemaDiffer } from '@contember/schema-migrations';
|
|
4
|
+
export declare class MigrationCreator {
|
|
5
|
+
private readonly migrationFilesManager;
|
|
6
|
+
private readonly schemaDiffer;
|
|
7
|
+
private readonly emptyTemplates;
|
|
8
|
+
constructor(migrationFilesManager: MigrationFilesManager, schemaDiffer: SchemaDiffer, emptyTemplates?: Record<string, string>);
|
|
9
|
+
createEmptyMigrationFile(migrationName: string, format: string): Promise<string>;
|
|
10
|
+
prepareMigration(initialSchema: Schema, newSchema: Schema, migrationName: string, { skipInitialSchemaValidation }?: {
|
|
11
|
+
skipInitialSchemaValidation?: boolean;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
migration: Migration;
|
|
14
|
+
initialSchema: Schema;
|
|
15
|
+
} | null>;
|
|
16
|
+
saveMigration(migration: Migration): Promise<string>;
|
|
17
|
+
removeMigration(name: string): Promise<void>;
|
|
18
|
+
private createMigration;
|
|
19
|
+
static createContent({ modifications, formatVersion }: Migration): string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=MigrationCreator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationCreator.d.ts","sourceRoot":"","sources":["../../src/MigrationCreator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAkB,MAAM,8BAA8B,CAAA;AAGtF,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAFd,qBAAqB,EAAE,qBAAqB,EAC5C,YAAY,EAAE,YAAY,EAC1B,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;IAGvD,wBAAwB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAWhF,gBAAgB,CACrB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,EAAE,2BAAmC,EAAE,GAAE;QAAE,2BAA2B,CAAC,EAAE,OAAO,CAAA;KAAO,GACrF,OAAO,CAAC;QAAE,SAAS,EAAE,SAAS,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAa5D,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAMpD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD,OAAO,CAAC,eAAe;WAKT,aAAa,CAAC,EAAE,aAAa,EAAE,aAAa,EAAE,EAAE,SAAS,GAAG,MAAM;CAGhF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MigrationCreator = void 0;
|
|
4
|
+
const schema_migrations_1 = require("@contember/schema-migrations");
|
|
5
|
+
const engine_common_1 = require("@contember/engine-common");
|
|
6
|
+
class MigrationCreator {
|
|
7
|
+
constructor(migrationFilesManager, schemaDiffer, emptyTemplates = {}) {
|
|
8
|
+
this.migrationFilesManager = migrationFilesManager;
|
|
9
|
+
this.schemaDiffer = schemaDiffer;
|
|
10
|
+
this.emptyTemplates = emptyTemplates;
|
|
11
|
+
}
|
|
12
|
+
async createEmptyMigrationFile(migrationName, format) {
|
|
13
|
+
if (!this.emptyTemplates.hasOwnProperty(format)) {
|
|
14
|
+
throw new Error(`Unknown format ${format}`);
|
|
15
|
+
}
|
|
16
|
+
await this.migrationFilesManager.createDirIfNotExist();
|
|
17
|
+
const [, fullName] = engine_common_1.MigrationVersionHelper.createVersion(migrationName);
|
|
18
|
+
const filename = await this.migrationFilesManager.createFile(this.emptyTemplates[format], fullName, format);
|
|
19
|
+
return filename;
|
|
20
|
+
}
|
|
21
|
+
async prepareMigration(initialSchema, newSchema, migrationName, { skipInitialSchemaValidation = false } = {}) {
|
|
22
|
+
await this.migrationFilesManager.createDirIfNotExist();
|
|
23
|
+
const modifications = this.schemaDiffer.diffSchemas(initialSchema, newSchema, { skipInitialSchemaValidation });
|
|
24
|
+
if (modifications.length === 0) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const migration = this.createMigration(modifications, migrationName);
|
|
28
|
+
return { initialSchema, migration };
|
|
29
|
+
}
|
|
30
|
+
async saveMigration(migration) {
|
|
31
|
+
const jsonDiff = MigrationCreator.createContent(migration);
|
|
32
|
+
const filename = await this.migrationFilesManager.createFile(jsonDiff, migration.name);
|
|
33
|
+
return filename;
|
|
34
|
+
}
|
|
35
|
+
async removeMigration(name) {
|
|
36
|
+
await this.migrationFilesManager.removeFile(name);
|
|
37
|
+
}
|
|
38
|
+
createMigration(modifications, name) {
|
|
39
|
+
const [version, fullName] = engine_common_1.MigrationVersionHelper.createVersion(name);
|
|
40
|
+
return { formatVersion: schema_migrations_1.VERSION_LATEST, modifications, version, name: fullName };
|
|
41
|
+
}
|
|
42
|
+
static createContent({ modifications, formatVersion }) {
|
|
43
|
+
return JSON.stringify({ formatVersion, modifications }, undefined, '\t') + '\n';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.MigrationCreator = MigrationCreator;
|
|
47
|
+
//# sourceMappingURL=MigrationCreator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationCreator.js","sourceRoot":"","sources":["../../src/MigrationCreator.ts"],"names":[],"mappings":";;;AAEA,oEAAsF;AACtF,4DAAiE;AAEjE,MAAa,gBAAgB;IAC5B,YACkB,qBAA4C,EAC5C,YAA0B,EAC1B,iBAAyC,EAAE;QAF3C,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,iBAAY,GAAZ,YAAY,CAAc;QAC1B,mBAAc,GAAd,cAAc,CAA6B;IAC1D,CAAC;IAEJ,KAAK,CAAC,wBAAwB,CAAC,aAAqB,EAAE,MAAc;QACnE,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;YAChD,MAAM,IAAI,KAAK,CAAC,kBAAkB,MAAM,EAAE,CAAC,CAAA;SAC3C;QACD,MAAM,IAAI,CAAC,qBAAqB,CAAC,mBAAmB,EAAE,CAAA;QACtD,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG,sCAAsB,CAAC,aAAa,CAAC,aAAa,CAAC,CAAA;QACxE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;QAE3G,OAAO,QAAQ,CAAA;IAChB,CAAC;IAED,KAAK,CAAC,gBAAgB,CACrB,aAAqB,EACrB,SAAiB,EACjB,aAAqB,EACrB,EAAE,2BAA2B,GAAG,KAAK,KAAgD,EAAE;QAEvF,MAAM,IAAI,CAAC,qBAAqB,CAAC,mBAAmB,EAAE,CAAA;QAEtD,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,aAAa,EAAE,SAAS,EAAE,EAAE,2BAA2B,EAAE,CAAC,CAAA;QAC9G,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,OAAO,IAAI,CAAA;SACX;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE,aAAa,CAAC,CAAA;QAEpE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,CAAA;IACpC,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,SAAoB;QACvC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA;QAC1D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;QACtF,OAAO,QAAQ,CAAA;IAChB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,IAAY;QACjC,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;IAClD,CAAC;IAEO,eAAe,CAAC,aAAuC,EAAE,IAAY;QAC5E,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,sCAAsB,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;QACtE,OAAO,EAAE,aAAa,EAAE,kCAAc,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;IACjF,CAAC;IAEM,MAAM,CAAC,aAAa,CAAC,EAAE,aAAa,EAAE,aAAa,EAAa;QACtE,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,aAAa,EAAE,aAAa,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,IAAI,CAAA;IAChF,CAAC;CACD;AAtDD,4CAsDC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MigrationToExecuteOkStatus } from './migrations';
|
|
2
|
+
import { ContentMigrationFactoryArgs } from './MigrationFile';
|
|
3
|
+
import { SystemClient } from './SystemClient';
|
|
4
|
+
export declare class MigrationExecutor {
|
|
5
|
+
executeMigrations({ client, migrations, contentMigrationFactoryArgs, force, log, }: {
|
|
6
|
+
client: SystemClient;
|
|
7
|
+
migrations: MigrationToExecuteOkStatus[];
|
|
8
|
+
contentMigrationFactoryArgs: ContentMigrationFactoryArgs;
|
|
9
|
+
log: (message: string) => void;
|
|
10
|
+
force?: boolean;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=MigrationExecuteHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationExecuteHelper.d.ts","sourceRoot":"","sources":["../../src/MigrationExecuteHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,2BAA2B,EAA4B,MAAM,iBAAiB,CAAA;AAEvF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG7C,qBAAa,iBAAiB;IAEvB,iBAAiB,CAAC,EACvB,MAAM,EACN,UAAU,EACV,2BAA2B,EAC3B,KAAK,EACL,GAAgB,GAChB,EAAE;QACF,MAAM,EAAE,YAAY,CAAA;QACpB,UAAU,EAAE,0BAA0B,EAAE,CAAA;QACxC,2BAA2B,EAAE,2BAA2B,CAAA;QACxD,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;QAC9B,KAAK,CAAC,EAAE,OAAO,CAAA;KACf,GAAG,OAAO,CAAC,IAAI,CAAC;CA0DjB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MigrationExecutor = void 0;
|
|
4
|
+
const assertNever_1 = require("./utils/assertNever");
|
|
5
|
+
class MigrationExecutor {
|
|
6
|
+
async executeMigrations({ client, migrations, contentMigrationFactoryArgs, force, log = () => null, }) {
|
|
7
|
+
if (migrations.length === 0) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
let migrationsToRun = [];
|
|
11
|
+
const executeMigrations = async () => {
|
|
12
|
+
if (migrationsToRun.length === 0) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
await client.migrate(migrationsToRun.map(it => {
|
|
16
|
+
if (it.type === 'schema') {
|
|
17
|
+
return {
|
|
18
|
+
version: it.version,
|
|
19
|
+
name: it.name,
|
|
20
|
+
type: 'SCHEMA',
|
|
21
|
+
schemaMigration: {
|
|
22
|
+
formatVersion: it.formatVersion,
|
|
23
|
+
modifications: it.modifications,
|
|
24
|
+
skippedErrors: it.skippedErrors,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (it.type === 'content') {
|
|
29
|
+
return {
|
|
30
|
+
version: it.version,
|
|
31
|
+
name: it.name,
|
|
32
|
+
type: 'CONTENT',
|
|
33
|
+
contentMigration: it.queries,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return (0, assertNever_1.assertNever)(it);
|
|
37
|
+
}), force);
|
|
38
|
+
migrationsToRun.forEach(it => {
|
|
39
|
+
log(it.name);
|
|
40
|
+
});
|
|
41
|
+
migrationsToRun = [];
|
|
42
|
+
};
|
|
43
|
+
log('Executing...');
|
|
44
|
+
for (const migration of migrations) {
|
|
45
|
+
const migrationContent = await migration.localMigration.getContent();
|
|
46
|
+
if (migrationContent.type === 'factory') {
|
|
47
|
+
await executeMigrations();
|
|
48
|
+
const result = await migrationContent.factory(contentMigrationFactoryArgs);
|
|
49
|
+
migrationsToRun.push(result);
|
|
50
|
+
await executeMigrations();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
migrationsToRun.push(migrationContent);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
await executeMigrations();
|
|
57
|
+
log('Migration executed');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.MigrationExecutor = MigrationExecutor;
|
|
61
|
+
//# sourceMappingURL=MigrationExecuteHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationExecuteHelper.js","sourceRoot":"","sources":["../../src/MigrationExecuteHelper.ts"],"names":[],"mappings":";;;AAEA,qDAAiD;AAIjD,MAAa,iBAAiB;IAE7B,KAAK,CAAC,iBAAiB,CAAC,EACvB,MAAM,EACN,UAAU,EACV,2BAA2B,EAC3B,KAAK,EACL,GAAG,GAAG,GAAG,EAAE,CAAC,IAAI,GAOhB;QACA,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,OAAM;SACN;QACD,IAAI,eAAe,GAA+B,EAAE,CAAA;QAEpD,MAAM,iBAAiB,GAAG,KAAK,IAAI,EAAE;YACpC,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;gBACjC,OAAM;aACN;YACD,MAAM,MAAM,CAAC,OAAO,CACnB,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;gBACxB,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ,EAAE;oBACzB,OAAO;wBACN,OAAO,EAAE,EAAE,CAAC,OAAO;wBACnB,IAAI,EAAE,EAAE,CAAC,IAAI;wBACb,IAAI,EAAE,QAAQ;wBACd,eAAe,EAAE;4BAChB,aAAa,EAAE,EAAE,CAAC,aAAa;4BAC/B,aAAa,EAAE,EAAE,CAAC,aAAa;4BAC/B,aAAa,EAAE,EAAE,CAAC,aAAa;yBAC/B;qBACD,CAAA;iBACD;gBACD,IAAI,EAAE,CAAC,IAAI,KAAK,SAAS,EAAE;oBAC1B,OAAO;wBACN,OAAO,EAAE,EAAE,CAAC,OAAO;wBACnB,IAAI,EAAE,EAAE,CAAC,IAAI;wBACb,IAAI,EAAE,SAAS;wBACf,gBAAgB,EAAE,EAAE,CAAC,OAAO;qBAC5B,CAAA;iBACD;gBACD,OAAO,IAAA,yBAAW,EAAC,EAAE,CAAC,CAAA;YACvB,CAAC,CAAC,EACF,KAAK,CACL,CAAA;YACD,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;gBAC5B,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;YACb,CAAC,CAAC,CAAA;YACF,eAAe,GAAG,EAAE,CAAA;QACrB,CAAC,CAAA;QAED,GAAG,CAAC,cAAc,CAAC,CAAA;QAEnB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YACnC,MAAM,gBAAgB,GAAG,MAAM,SAAS,CAAC,cAAc,CAAC,UAAU,EAAE,CAAA;YACpE,IAAI,gBAAgB,CAAC,IAAI,KAAK,SAAS,EAAE;gBACxC,MAAM,iBAAiB,EAAE,CAAA;gBACzB,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAA;gBAC1E,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;gBAC5B,MAAM,iBAAiB,EAAE,CAAA;aACzB;iBAAM;gBACN,eAAe,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;aACtC;SACD;QACD,MAAM,iBAAiB,EAAE,CAAA;QACzB,GAAG,CAAC,oBAAoB,CAAC,CAAA;IAC1B,CAAC;CACD;AAxED,8CAwEC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Migration } from '@contember/schema-migrations';
|
|
2
|
+
import { JSONObject } from './utils/json';
|
|
3
|
+
export interface MigrationFile {
|
|
4
|
+
path: string;
|
|
5
|
+
version: string;
|
|
6
|
+
name: string;
|
|
7
|
+
getContent: () => Promise<MigrationContent>;
|
|
8
|
+
}
|
|
9
|
+
export declare const isSchemaMigration: (content: MigrationContent) => content is SchemaMigration;
|
|
10
|
+
export type ResolvedMigrationContent = SchemaMigration | ContentMigration;
|
|
11
|
+
export type MigrationContent = ResolvedMigrationContent | ContentMigrationFactory;
|
|
12
|
+
export type SchemaMigration = {
|
|
13
|
+
type: 'schema';
|
|
14
|
+
} & Migration;
|
|
15
|
+
export type ContentMigration = {
|
|
16
|
+
type: 'content';
|
|
17
|
+
version: string;
|
|
18
|
+
name: string;
|
|
19
|
+
queries: ContentMigrationQuery[];
|
|
20
|
+
};
|
|
21
|
+
export type ContentMigrationFactoryArgs = {
|
|
22
|
+
apiBaseUrl: string;
|
|
23
|
+
projectName: string;
|
|
24
|
+
apiToken: string;
|
|
25
|
+
};
|
|
26
|
+
export type ContentMigrationFactory = {
|
|
27
|
+
type: 'factory';
|
|
28
|
+
factory: (args: ContentMigrationFactoryArgs) => Promise<ContentMigration>;
|
|
29
|
+
};
|
|
30
|
+
export type ContentMigrationQuery = {
|
|
31
|
+
query: string;
|
|
32
|
+
variables?: JSONObject;
|
|
33
|
+
stage?: string;
|
|
34
|
+
checkMutationResult?: boolean;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=MigrationFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationFile.d.ts","sourceRoot":"","sources":["../../src/MigrationFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IAEZ,UAAU,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAA;CAC3C;AAED,eAAO,MAAM,iBAAiB,YAAa,gBAAgB,+BAA4F,CAAA;AAEvJ,MAAM,MAAM,wBAAwB,GACjC,eAAe,GACf,gBAAgB,CAAA;AAEnB,MAAM,MAAM,gBAAgB,GACzB,wBAAwB,GACxB,uBAAuB,CAAA;AAE1B,MAAM,MAAM,eAAe,GACxB;IACD,IAAI,EAAE,QAAQ,CAAA;CACd,GACC,SAAS,CAAA;AAEZ,MAAM,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,qBAAqB,EAAE,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACzC,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,CAAC,IAAI,EAAE,2BAA2B,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAA;CACzE,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSchemaMigration = void 0;
|
|
4
|
+
const isSchemaMigration = (content) => typeof content !== 'function' && 'modifications' in content;
|
|
5
|
+
exports.isSchemaMigration = isSchemaMigration;
|
|
6
|
+
//# sourceMappingURL=MigrationFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationFile.js","sourceRoot":"","sources":["../../src/MigrationFile.ts"],"names":[],"mappings":";;;AAWO,MAAM,iBAAiB,GAAG,CAAC,OAAyB,EAA8B,EAAE,CAAC,OAAO,OAAO,KAAK,UAAU,IAAI,eAAe,IAAI,OAAO,CAAA;AAA1I,QAAA,iBAAiB,qBAAyH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationFileLoader.d.ts","sourceRoot":"","sources":["../../src/MigrationFileLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEjE,MAAM,WAAW,mBAAmB;IACnC,IAAI,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;CACpD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationFileLoader.js","sourceRoot":"","sources":["../../src/MigrationFileLoader.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MigrationFileLoader } from './MigrationFileLoader';
|
|
2
|
+
import { MigrationFile } from './MigrationFile';
|
|
3
|
+
export declare class MigrationFilesManager {
|
|
4
|
+
readonly directory: string;
|
|
5
|
+
private readonly loaders;
|
|
6
|
+
private migrations;
|
|
7
|
+
constructor(directory: string, loaders: Record<string, MigrationFileLoader>);
|
|
8
|
+
createFile(content: string, name: string, extension?: string): Promise<string>;
|
|
9
|
+
removeFile(name: string): Promise<void>;
|
|
10
|
+
moveFile(oldName: string, newName: string): Promise<void>;
|
|
11
|
+
createDirIfNotExist(): Promise<void>;
|
|
12
|
+
readFiles(): Promise<MigrationFile[]>;
|
|
13
|
+
forceReadFiles(): Promise<MigrationFile[]>;
|
|
14
|
+
private tryReadDir;
|
|
15
|
+
private listFiles;
|
|
16
|
+
private formatPath;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=MigrationFilesManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationFilesManager.d.ts","sourceRoot":"","sources":["../../src/MigrationFilesManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAoB,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAIjE,qBAAa,qBAAqB;aAIhB,SAAS,EAAE,MAAM;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJzB,OAAO,CAAC,UAAU,CAAwC;gBAGzC,SAAS,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC;IAGjD,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAO9E,UAAU,CAAC,IAAI,EAAE,MAAM;IAMvB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAKzC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAUpC,SAAS,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAIrC,cAAc,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YAuBzC,UAAU;YAWV,SAAS;IAevB,OAAO,CAAC,UAAU;CAKlB"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.MigrationFilesManager = void 0;
|
|
27
|
+
const engine_common_1 = require("@contember/engine-common");
|
|
28
|
+
const fs = __importStar(require("node:fs/promises"));
|
|
29
|
+
const node_path_1 = require("node:path");
|
|
30
|
+
class MigrationFilesManager {
|
|
31
|
+
constructor(directory, loaders) {
|
|
32
|
+
this.directory = directory;
|
|
33
|
+
this.loaders = loaders;
|
|
34
|
+
this.migrations = null;
|
|
35
|
+
}
|
|
36
|
+
async createFile(content, name, extension = 'json') {
|
|
37
|
+
this.migrations = null;
|
|
38
|
+
const path = this.formatPath(name, extension);
|
|
39
|
+
await fs.writeFile(path, content, { encoding: 'utf8' });
|
|
40
|
+
return await fs.realpath(path);
|
|
41
|
+
}
|
|
42
|
+
async removeFile(name) {
|
|
43
|
+
this.migrations = null;
|
|
44
|
+
const path = this.formatPath(name);
|
|
45
|
+
await fs.unlink(path);
|
|
46
|
+
}
|
|
47
|
+
async moveFile(oldName, newName) {
|
|
48
|
+
this.migrations = null;
|
|
49
|
+
await fs.rename(this.formatPath(oldName), this.formatPath(newName));
|
|
50
|
+
}
|
|
51
|
+
async createDirIfNotExist() {
|
|
52
|
+
try {
|
|
53
|
+
await fs.mkdir(this.directory);
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
if (!(e instanceof Error) || !('code' in e) || e.code !== 'EEXIST') {
|
|
57
|
+
throw e;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async readFiles() {
|
|
62
|
+
var _a;
|
|
63
|
+
return (_a = this.migrations) !== null && _a !== void 0 ? _a : (this.migrations = this.forceReadFiles());
|
|
64
|
+
}
|
|
65
|
+
async forceReadFiles() {
|
|
66
|
+
const files = (await this.listFiles()).map(it => ({
|
|
67
|
+
filename: it,
|
|
68
|
+
version: engine_common_1.MigrationVersionHelper.extractVersion(it),
|
|
69
|
+
}));
|
|
70
|
+
return files.map(({ version, filename }) => {
|
|
71
|
+
const ext = filename.substring(filename.lastIndexOf('.') + 1);
|
|
72
|
+
const path = (0, node_path_1.join)(this.directory, filename);
|
|
73
|
+
let content = null;
|
|
74
|
+
const file = {
|
|
75
|
+
path: path,
|
|
76
|
+
version: version,
|
|
77
|
+
name: engine_common_1.MigrationVersionHelper.extractName(path.substring(path.lastIndexOf('/') + 1)),
|
|
78
|
+
getContent: () => {
|
|
79
|
+
content !== null && content !== void 0 ? content : (content = this.loaders[ext].load(file));
|
|
80
|
+
return content;
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
return file;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
async tryReadDir() {
|
|
87
|
+
try {
|
|
88
|
+
return await fs.readdir(this.directory, { withFileTypes: true });
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
if (e instanceof Error && 'code' in e && e.code === 'ENOENT') {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
throw e;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async listFiles() {
|
|
98
|
+
const files = await this.tryReadDir();
|
|
99
|
+
const extensions = Object.keys(this.loaders).join('|');
|
|
100
|
+
const regex = new RegExp('^\\d{4}-\\d{2}-\\d{2}-\\d{6}-[\\w-]+\\.(' + extensions + ')$');
|
|
101
|
+
const filteredFiles = await Promise.all(files
|
|
102
|
+
.filter(it => it.isFile())
|
|
103
|
+
.map(it => it.name)
|
|
104
|
+
.filter(it => it.match(regex)));
|
|
105
|
+
return filteredFiles.sort();
|
|
106
|
+
}
|
|
107
|
+
formatPath(version, extension = 'json') {
|
|
108
|
+
const filename = `${version}.${extension}`;
|
|
109
|
+
const path = `${this.directory}/${filename}`;
|
|
110
|
+
return path;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.MigrationFilesManager = MigrationFilesManager;
|
|
114
|
+
//# sourceMappingURL=MigrationFilesManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationFilesManager.js","sourceRoot":"","sources":["../../src/MigrationFilesManager.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MigrationFile, ResolvedMigrationContent } from './MigrationFile';
|
|
2
|
+
import { JSONValue } from './utils/json';
|
|
3
|
+
export declare class MigrationParser {
|
|
4
|
+
parse(migrationFile: MigrationFile, content: JSONValue): ResolvedMigrationContent;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=MigrationParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationParser.d.ts","sourceRoot":"","sources":["../../src/MigrationParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,aAAa,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,qBAAa,eAAe;IACpB,KAAK,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,GAAG,wBAAwB;CA0BxF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MigrationParser = void 0;
|
|
4
|
+
const schema_migrations_1 = require("@contember/schema-migrations");
|
|
5
|
+
class MigrationParser {
|
|
6
|
+
parse(migrationFile, content) {
|
|
7
|
+
if (typeof content !== 'object' || content === null) {
|
|
8
|
+
throw new Error('Invalid migration');
|
|
9
|
+
}
|
|
10
|
+
if ('modifications' in content) {
|
|
11
|
+
const validated = content; // todo validate
|
|
12
|
+
return {
|
|
13
|
+
type: 'schema',
|
|
14
|
+
version: migrationFile.version,
|
|
15
|
+
name: migrationFile.name,
|
|
16
|
+
formatVersion: validated.formatVersion || schema_migrations_1.VERSION_INITIAL,
|
|
17
|
+
modifications: validated.modifications,
|
|
18
|
+
...(validated.skippedErrors ? { skippedErrors: validated.skippedErrors } : {}),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
else if ('queries' in content || 'query' in content) {
|
|
22
|
+
return {
|
|
23
|
+
type: 'content',
|
|
24
|
+
version: migrationFile.version,
|
|
25
|
+
name: migrationFile.name,
|
|
26
|
+
queries: ('queries' in content ? content.queries : [content]),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
throw new Error('Invalid migration content');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.MigrationParser = MigrationParser;
|
|
33
|
+
//# sourceMappingURL=MigrationParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationParser.js","sourceRoot":"","sources":["../../src/MigrationParser.ts"],"names":[],"mappings":";;;AAAA,oEAAyE;AAIzE,MAAa,eAAe;IACpB,KAAK,CAAC,aAA4B,EAAE,OAAkB;QAC5D,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE;YACpD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;SACpC;QAED,IAAI,eAAe,IAAI,OAAO,EAAE;YAC/B,MAAM,SAAS,GAAG,OAAoB,CAAA,CAAC,gBAAgB;YAEvD,OAAO;gBACN,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,aAAa,CAAC,OAAO;gBAC9B,IAAI,EAAE,aAAa,CAAC,IAAI;gBACxB,aAAa,EAAE,SAAS,CAAC,aAAa,IAAI,mCAAe;gBACzD,aAAa,EAAE,SAAS,CAAC,aAAa;gBACtC,GAAG,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC9E,CAAA;SACD;aAAM,IAAI,SAAS,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,EAAE;YACtD,OAAO;gBACN,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,aAAa,CAAC,OAAO;gBAC9B,IAAI,EAAE,aAAa,CAAC,IAAI;gBACxB,OAAO,EAAE,CAAC,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAA4B;aACxF,CAAA;SACD;QACD,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;IAC7C,CAAC;CACD;AA3BD,0CA2BC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MigrationFilesManager } from './MigrationFilesManager';
|
|
2
|
+
import { Migration } from '@contember/schema-migrations';
|
|
3
|
+
import { MigrationFile } from './MigrationFile';
|
|
4
|
+
export declare class MigrationsResolver {
|
|
5
|
+
private readonly migrationFilesManager;
|
|
6
|
+
constructor(migrationFilesManager: MigrationFilesManager);
|
|
7
|
+
get directory(): string;
|
|
8
|
+
getMigrationFiles(): Promise<MigrationFile[]>;
|
|
9
|
+
getSchemaMigrations(): Promise<Migration[]>;
|
|
10
|
+
findLatestSchemaMigration(): Promise<Migration | null>;
|
|
11
|
+
findSchemaMigrationByVersion(version: string): Promise<Migration | null>;
|
|
12
|
+
private convertMigrationFileToSchemaMigration;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=MigrationsResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationsResolver.d.ts","sourceRoot":"","sources":["../../src/MigrationsResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAqB,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAGlE,qBAAa,kBAAkB;IAElB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;gBAArB,qBAAqB,EAAE,qBAAqB;IAEzE,IAAW,SAAS,IAAI,MAAM,CAE7B;IAEY,iBAAiB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAI7C,mBAAmB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAQ3C,yBAAyB,IAAI,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAKtD,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;YASvE,qCAAqC;CAInD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MigrationsResolver = void 0;
|
|
4
|
+
const MigrationFile_1 = require("./MigrationFile");
|
|
5
|
+
const engine_common_1 = require("@contember/engine-common");
|
|
6
|
+
class MigrationsResolver {
|
|
7
|
+
constructor(migrationFilesManager) {
|
|
8
|
+
this.migrationFilesManager = migrationFilesManager;
|
|
9
|
+
}
|
|
10
|
+
get directory() {
|
|
11
|
+
return this.migrationFilesManager.directory;
|
|
12
|
+
}
|
|
13
|
+
async getMigrationFiles() {
|
|
14
|
+
return await this.migrationFilesManager.readFiles();
|
|
15
|
+
}
|
|
16
|
+
async getSchemaMigrations() {
|
|
17
|
+
const migrationFiles = await this.getMigrationFiles();
|
|
18
|
+
const migrations = await Promise.all(migrationFiles.map(this.convertMigrationFileToSchemaMigration));
|
|
19
|
+
return migrations.filter((it) => it !== null);
|
|
20
|
+
}
|
|
21
|
+
async findLatestSchemaMigration() {
|
|
22
|
+
const migrations = await this.getSchemaMigrations();
|
|
23
|
+
return migrations.length > 0 ? migrations[migrations.length - 1] : null;
|
|
24
|
+
}
|
|
25
|
+
async findSchemaMigrationByVersion(version) {
|
|
26
|
+
var _a;
|
|
27
|
+
const migrations = await this.getSchemaMigrations();
|
|
28
|
+
return (_a = migrations
|
|
29
|
+
.find(it => engine_common_1.MigrationVersionHelper.extractVersion(it.version) === engine_common_1.MigrationVersionHelper.extractVersion(version))) !== null && _a !== void 0 ? _a : null;
|
|
30
|
+
}
|
|
31
|
+
async convertMigrationFileToSchemaMigration(file) {
|
|
32
|
+
const result = await file.getContent();
|
|
33
|
+
return (0, MigrationFile_1.isSchemaMigration)(result) ? result : null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.MigrationsResolver = MigrationsResolver;
|
|
37
|
+
//# sourceMappingURL=MigrationsResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationsResolver.js","sourceRoot":"","sources":["../../src/MigrationsResolver.ts"],"names":[],"mappings":";;;AAEA,mDAAkE;AAClE,4DAAiE;AAEjE,MAAa,kBAAkB;IAE9B,YAA6B,qBAA4C;QAA5C,0BAAqB,GAArB,qBAAqB,CAAuB;IAAG,CAAC;IAE7E,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAA;IAC5C,CAAC;IAEM,KAAK,CAAC,iBAAiB;QAC7B,OAAO,MAAM,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE,CAAA;IACpD,CAAC;IAEM,KAAK,CAAC,mBAAmB;QAC/B,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAErD,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC,CAAA;QAEpG,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,EAAmB,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,CAAA;IAC/D,CAAC;IAEM,KAAK,CAAC,yBAAyB;QACrC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAA;QACnD,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACxE,CAAC;IAEM,KAAK,CAAC,4BAA4B,CAAC,OAAe;;QACxD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAA;QACnD,OAAO,MAAA,UAAU;aACf,IAAI,CAAC,EAAE,CAAC,EAAE,CACV,sCAAsB,CAAC,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,sCAAsB,CAAC,cAAc,CAAC,OAAO,CAAC,CACpG,mCACE,IAAI,CAAA;IACT,CAAC;IAEO,KAAK,CAAC,qCAAqC,CAAC,IAAmB;QACtE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAA;QACtC,OAAO,IAAA,iCAAiB,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA;IACjD,CAAC;CACD;AAtCD,gDAsCC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Schema } from '@contember/schema';
|
|
2
|
+
import { SchemaMigrator } from '@contember/schema-migrations';
|
|
3
|
+
import { MigrationsResolver } from './MigrationsResolver';
|
|
4
|
+
export declare class SchemaVersionBuilder {
|
|
5
|
+
private readonly migrationsResolver;
|
|
6
|
+
private readonly schemaMigrator;
|
|
7
|
+
constructor(migrationsResolver: MigrationsResolver, schemaMigrator: SchemaMigrator);
|
|
8
|
+
buildSchema(targetVersion?: string): Promise<Schema>;
|
|
9
|
+
buildSchemaUntil(targetVersion: string): Promise<Schema>;
|
|
10
|
+
continue(schema: Schema, previousVersion: string | null, targetVersion: string): Promise<Schema>;
|
|
11
|
+
buildSchemaAdvanced(initialSchema: Schema, condition: (version: string) => boolean): Promise<Schema>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=SchemaVersionBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaVersionBuilder.d.ts","sourceRoot":"","sources":["../../src/SchemaVersionBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,qBAAa,oBAAoB;IAE/B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,cAAc;gBADd,kBAAkB,EAAE,kBAAkB,EACtC,cAAc,EAAE,cAAc;IAG1C,WAAW,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIpD,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzF,mBAAmB,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;CASjH"}
|