@contember/cli 1.2.0-alpha.3 → 1.2.0-alpha.6
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/commands/deploy/DeployCommand.d.ts +3 -1
- package/dist/src/commands/deploy/DeployCommand.d.ts.map +1 -1
- package/dist/src/commands/deploy/DeployCommand.js +15 -15
- package/dist/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationAmendCommand.d.ts +4 -2
- package/dist/src/commands/migrations/MigrationAmendCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationAmendCommand.js +8 -2
- package/dist/src/commands/migrations/MigrationAmendCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationCreateHelper.d.ts +5 -4
- package/dist/src/commands/migrations/MigrationCreateHelper.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationCreateHelper.js +2 -9
- package/dist/src/commands/migrations/MigrationCreateHelper.js.map +1 -1
- package/dist/src/commands/migrations/MigrationDescribeCommand.d.ts +4 -1
- package/dist/src/commands/migrations/MigrationDescribeCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationDescribeCommand.js +8 -3
- package/dist/src/commands/migrations/MigrationDescribeCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationDiffCommand.d.ts +4 -2
- package/dist/src/commands/migrations/MigrationDiffCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationDiffCommand.js +9 -2
- package/dist/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationExecuteCommand.d.ts +4 -2
- package/dist/src/commands/migrations/MigrationExecuteCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationExecuteCommand.js +8 -5
- package/dist/src/commands/migrations/MigrationExecuteCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationRebaseCommand.d.ts +4 -2
- package/dist/src/commands/migrations/MigrationRebaseCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationRebaseCommand.js +8 -2
- package/dist/src/commands/migrations/MigrationRebaseCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationStatusCommand.d.ts +4 -1
- package/dist/src/commands/migrations/MigrationStatusCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationStatusCommand.js +8 -3
- package/dist/src/commands/migrations/MigrationStatusCommand.js.map +1 -1
- package/dist/src/commands/project/ProjectCreateCommand.d.ts +3 -0
- package/dist/src/commands/project/ProjectCreateCommand.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectCreateCommand.js +5 -1
- package/dist/src/commands/project/ProjectCreateCommand.js.map +1 -1
- package/dist/src/commands/project/ProjectGenerateDocumentation.d.ts +4 -2
- package/dist/src/commands/project/ProjectGenerateDocumentation.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectGenerateDocumentation.js +8 -4
- package/dist/src/commands/project/ProjectGenerateDocumentation.js.map +1 -1
- package/dist/src/commands/project/ProjectPrintSchemaCommand.d.ts +4 -1
- package/dist/src/commands/project/ProjectPrintSchemaCommand.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectPrintSchemaCommand.js +8 -4
- package/dist/src/commands/project/ProjectPrintSchemaCommand.js.map +1 -1
- package/dist/src/commands/project/ProjectValidateCommand.d.ts +4 -2
- package/dist/src/commands/project/ProjectValidateCommand.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectValidateCommand.js +8 -5
- package/dist/src/commands/project/ProjectValidateCommand.js.map +1 -1
- package/dist/src/commands/tenant/CreateApiKeyCommand.d.ts +3 -0
- package/dist/src/commands/tenant/CreateApiKeyCommand.d.ts.map +1 -1
- package/dist/src/commands/tenant/CreateApiKeyCommand.js +5 -2
- package/dist/src/commands/tenant/CreateApiKeyCommand.js.map +1 -1
- package/dist/src/commands/tenant/InviteCommand.d.ts +3 -0
- package/dist/src/commands/tenant/InviteCommand.d.ts.map +1 -1
- package/dist/src/commands/tenant/InviteCommand.js +5 -2
- package/dist/src/commands/tenant/InviteCommand.js.map +1 -1
- package/dist/src/commands/tenant/ResetPasswordCommand.d.ts +3 -0
- package/dist/src/commands/tenant/ResetPasswordCommand.d.ts.map +1 -1
- package/dist/src/commands/tenant/ResetPasswordCommand.js +5 -2
- package/dist/src/commands/tenant/ResetPasswordCommand.js.map +1 -1
- package/dist/src/commands/tenant/SignInCommand.d.ts +3 -0
- package/dist/src/commands/tenant/SignInCommand.d.ts.map +1 -1
- package/dist/src/commands/tenant/SignInCommand.js +5 -2
- package/dist/src/commands/tenant/SignInCommand.js.map +1 -1
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.d.ts +3 -1
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.d.ts.map +1 -1
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.js +5 -1
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.js.map +1 -1
- package/dist/src/run.js +22 -23
- package/dist/src/run.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/src/commands/deploy/DeployCommand.ts +20 -15
- package/src/commands/migrations/MigrationAmendCommand.ts +12 -3
- package/src/commands/migrations/MigrationCreateHelper.ts +2 -7
- package/src/commands/migrations/MigrationDescribeCommand.ts +11 -3
- package/src/commands/migrations/MigrationDiffCommand.ts +14 -4
- package/src/commands/migrations/MigrationExecuteCommand.ts +11 -6
- package/src/commands/migrations/MigrationRebaseCommand.ts +13 -3
- package/src/commands/migrations/MigrationStatusCommand.ts +11 -3
- package/src/commands/project/ProjectCreateCommand.ts +7 -1
- package/src/commands/project/ProjectGenerateDocumentation.ts +12 -7
- package/src/commands/project/ProjectPrintSchemaCommand.ts +11 -4
- package/src/commands/project/ProjectValidateCommand.ts +11 -6
- package/src/commands/tenant/CreateApiKeyCommand.ts +7 -1
- package/src/commands/tenant/InviteCommand.ts +7 -1
- package/src/commands/tenant/ResetPasswordCommand.ts +7 -1
- package/src/commands/tenant/SignInCommand.ts +7 -1
- package/src/commands/workspace/WorkspaceUpdateApiCommand.ts +7 -1
- package/src/run.ts +24 -26
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command, CommandConfiguration, Input } from '@contember/cli-common';
|
|
1
|
+
import { Command, CommandConfiguration, Input, Workspace } from '@contember/cli-common';
|
|
2
2
|
import { ExecuteMigrationOptions } from '../migrations/MigrationExecuteHelper';
|
|
3
3
|
declare type Args = {
|
|
4
4
|
dsn: string;
|
|
@@ -8,6 +8,8 @@ declare type Options = ExecuteMigrationOptions & {
|
|
|
8
8
|
admin?: string;
|
|
9
9
|
};
|
|
10
10
|
export declare class DeployCommand extends Command<Args, Options> {
|
|
11
|
+
private readonly workspace;
|
|
12
|
+
constructor(workspace: Workspace);
|
|
11
13
|
protected configure(configuration: CommandConfiguration<Args, Options>): void;
|
|
12
14
|
protected execute(input: Input<Args, Options>): Promise<void | number>;
|
|
13
15
|
private getNormalizedInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeployCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/deploy/DeployCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"DeployCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/deploy/DeployCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAW,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAChG,OAAO,EAEN,uBAAuB,EAGvB,MAAM,sCAAsC,CAAA;AAY7C,aAAK,IAAI,GAAG;IACX,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,aAAK,OAAO,GAAG,uBAAuB,GAAG;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,qBAAa,aAAc,SAAQ,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvD,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAKtC,SAAS,CAAC,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI;cAU7D,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;IAmG5E,OAAO,CAAC,kBAAkB;CAS1B"}
|
|
@@ -14,32 +14,28 @@ const MigrationsContainer_1 = require("../../MigrationsContainer");
|
|
|
14
14
|
const admin_1 = require("../../utils/admin");
|
|
15
15
|
const url_1 = require("url");
|
|
16
16
|
const prompts_1 = __importDefault(require("prompts"));
|
|
17
|
+
const migrations_1 = require("../../utils/migrations");
|
|
17
18
|
const token_1 = require("../../utils/token");
|
|
18
19
|
class DeployCommand extends cli_common_1.Command {
|
|
20
|
+
constructor(workspace) {
|
|
21
|
+
super();
|
|
22
|
+
this.workspace = workspace;
|
|
23
|
+
}
|
|
19
24
|
configure(configuration) {
|
|
20
25
|
configuration.description('Deploy Contember project');
|
|
21
26
|
configuration.argument('dsn');
|
|
22
|
-
|
|
27
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
28
|
+
configuration.argument('project').optional();
|
|
29
|
+
}
|
|
23
30
|
configuration.option('admin').valueRequired();
|
|
24
31
|
(0, MigrationExecuteHelper_1.configureExecuteMigrationCommand)(configuration);
|
|
25
32
|
}
|
|
26
33
|
async execute(input) {
|
|
27
34
|
const [dsn, projectName] = this.getNormalizedInput(input);
|
|
28
|
-
const
|
|
29
|
-
let project;
|
|
35
|
+
const project = await this.workspace.projects.getProject(projectName, { fuzzy: true });
|
|
30
36
|
let apiUrl = input.getOption('instance');
|
|
31
37
|
let adminEndpoint = input.getOption('admin');
|
|
32
38
|
let apiTokenFromDsn = undefined;
|
|
33
|
-
if (projectName) {
|
|
34
|
-
project = await workspace.projects.getProject(projectName, { fuzzy: true });
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
const projects = await workspace.projects.listProjects();
|
|
38
|
-
if (projects.length !== 1) {
|
|
39
|
-
throw 'Please specify a local name project';
|
|
40
|
-
}
|
|
41
|
-
project = projects[0];
|
|
42
|
-
}
|
|
43
39
|
let remoteProject = input.getOption('remote-project') || project.name;
|
|
44
40
|
if (dsn) {
|
|
45
41
|
const uri = new url_1.URL(dsn);
|
|
@@ -50,8 +46,8 @@ class DeployCommand extends cli_common_1.Command {
|
|
|
50
46
|
apiTokenFromDsn = uri.password;
|
|
51
47
|
adminEndpoint = (uri.protocol === 'contember-unsecure:' ? 'http://' : 'https://') + uri.host;
|
|
52
48
|
}
|
|
53
|
-
const instance = await (0, instance_1.interactiveResolveInstanceEnvironmentFromInput)(workspace, apiUrl !== null && apiUrl !== void 0 ? apiUrl : (adminEndpoint ? adminEndpoint + '/_api' : undefined));
|
|
54
|
-
const apiToken = await (0, tenant_1.interactiveResolveApiToken)({ workspace, instance, apiToken: apiTokenFromDsn });
|
|
49
|
+
const instance = await (0, instance_1.interactiveResolveInstanceEnvironmentFromInput)(this.workspace, apiUrl !== null && apiUrl !== void 0 ? apiUrl : (adminEndpoint ? adminEndpoint + '/_api' : undefined));
|
|
50
|
+
const apiToken = await (0, tenant_1.interactiveResolveApiToken)({ workspace: this.workspace, instance, apiToken: apiTokenFromDsn });
|
|
55
51
|
console.log('');
|
|
56
52
|
console.log('Contember project deployment configuration:');
|
|
57
53
|
console.log(`Local project name: ${project.name}`);
|
|
@@ -70,6 +66,10 @@ class DeployCommand extends cli_common_1.Command {
|
|
|
70
66
|
throw `Missing ${projectAdminDistDir}/index.html. Please build admin before deploying.`;
|
|
71
67
|
}
|
|
72
68
|
const status = await (0, MigrationExecuteHelper_1.resolveMigrationStatus)(systemClient, container.migrationsResolver, false);
|
|
69
|
+
if (status.errorMigrations.length > 0) {
|
|
70
|
+
console.error((0, migrations_1.createMigrationStatusTable)(status.errorMigrations));
|
|
71
|
+
throw `Cannot execute migrations`;
|
|
72
|
+
}
|
|
73
73
|
if (status.migrationsToExecute.length === 0 && !adminEndpoint) {
|
|
74
74
|
console.log('Nothing to do.');
|
|
75
75
|
return 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeployCommand.js","sourceRoot":"","sources":["../../../../src/commands/deploy/DeployCommand.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAgG;AAChG,iFAK6C;AAC7C,uCAAqC;AACrC,+CAA6E;AAC7E,mDAAqF;AACrF,+CAAiD;AACjD,mEAAsE;AACtE,6CAA+D;AAC/D,6BAAyB;AACzB,sDAA6B;
|
|
1
|
+
{"version":3,"file":"DeployCommand.js","sourceRoot":"","sources":["../../../../src/commands/deploy/DeployCommand.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAgG;AAChG,iFAK6C;AAC7C,uCAAqC;AACrC,+CAA6E;AAC7E,mDAAqF;AACrF,+CAAiD;AACjD,mEAAsE;AACtE,6CAA+D;AAC/D,6BAAyB;AACzB,sDAA6B;AAC7B,uDAAmE;AACnE,6CAA6C;AAW7C,MAAa,aAAc,SAAQ,oBAAsB;IACxD,YACkB,SAAoB;QAErC,KAAK,EAAE,CAAA;QAFU,cAAS,GAAT,SAAS,CAAW;IAGtC,CAAC;IAES,SAAS,CAAC,aAAkD;QACrE,aAAa,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAA;QACrD,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,EAAE;YAC1C,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAA;SAC5C;QACD,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,CAAA;QAC7C,IAAA,yDAAgC,EAAC,aAAa,CAAC,CAAA;IAChD,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,KAA2B;QAClD,MAAM,CAAC,GAAG,EA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,CAAC,KAAK,CAAC,CAAA;QACnD,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAA;QACrD,MAAM,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAAW,CAAA;QAChE,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IAC1B,CAAC;CACD;AA7HD,sCA6HC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Command, CommandConfiguration, Input } from '@contember/cli-common';
|
|
1
|
+
import { Command, CommandConfiguration, Input, Workspace } from '@contember/cli-common';
|
|
2
2
|
declare type Args = {
|
|
3
|
-
project
|
|
3
|
+
project?: string;
|
|
4
4
|
migration?: string;
|
|
5
5
|
};
|
|
6
6
|
declare type Options = {
|
|
@@ -8,6 +8,8 @@ declare type Options = {
|
|
|
8
8
|
force: boolean;
|
|
9
9
|
};
|
|
10
10
|
export declare class MigrationAmendCommand extends Command<Args, Options> {
|
|
11
|
+
private readonly workspace;
|
|
12
|
+
constructor(workspace: Workspace);
|
|
11
13
|
protected configure(configuration: CommandConfiguration<Args, Options>): void;
|
|
12
14
|
protected execute(input: Input<Args, Options>): Promise<number>;
|
|
13
15
|
private shouldContinue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationAmendCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationAmendCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"MigrationAmendCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationAmendCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAiBvF,aAAK,IAAI,GAAG;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,aAAK,OAAO,GAAG;IACd,GAAG,CAAC,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,OAAO,CAAA;CACd,CAAA;AAED,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;IAE/D,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAKtC,SAAS,CAAC,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI;cAa7D,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;YA4GvD,cAAc;CAgB5B"}
|
|
@@ -16,9 +16,15 @@ const schema_utils_1 = require("@contember/schema-utils");
|
|
|
16
16
|
const MigrationValidationHelper_1 = require("./MigrationValidationHelper");
|
|
17
17
|
const loadSchema_1 = require("../../utils/project/loadSchema");
|
|
18
18
|
class MigrationAmendCommand extends cli_common_1.Command {
|
|
19
|
+
constructor(workspace) {
|
|
20
|
+
super();
|
|
21
|
+
this.workspace = workspace;
|
|
22
|
+
}
|
|
19
23
|
configure(configuration) {
|
|
20
24
|
configuration.description('Amends latest migration');
|
|
21
|
-
|
|
25
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
26
|
+
configuration.argument('project');
|
|
27
|
+
}
|
|
22
28
|
configuration.argument('migration').optional();
|
|
23
29
|
configuration.option('force').description('Ignore migrations order and missing migrations (dev only)');
|
|
24
30
|
configuration //
|
|
@@ -27,7 +33,7 @@ class MigrationAmendCommand extends cli_common_1.Command {
|
|
|
27
33
|
.description('Do not ask for confirmation.');
|
|
28
34
|
}
|
|
29
35
|
async execute(input) {
|
|
30
|
-
return await (0, MigrationCreateHelper_1.executeCreateMigrationCommand)(input, async ({ schemaVersionBuilder, migrationsResolver, workspace, project, migrationCreator, migrationDescriber, schemaMigrator, }) => {
|
|
36
|
+
return await (0, MigrationCreateHelper_1.executeCreateMigrationCommand)(input, { workspace: this.workspace }, async ({ schemaVersionBuilder, migrationsResolver, workspace, project, migrationCreator, migrationDescriber, schemaMigrator, }) => {
|
|
31
37
|
const migrationName = input.getArgument('migration');
|
|
32
38
|
const amendMigration = migrationName
|
|
33
39
|
? await (0, migrations_1.getMigrationByName)(migrationsResolver, migrationName)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationAmendCommand.js","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationAmendCommand.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationAmendCommand.js","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationAmendCommand.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAuF;AACvF,+CAA0D;AAC1D,oEAAqE;AACrE,mEAAuE;AACvE,uDAK+B;AAC/B,qEAAiE;AACjE,uEAAkE;AAClE,sDAA6B;AAC7B,0DAAqD;AACrD,2EAAgE;AAChE,+DAA2D;AAY3D,MAAa,qBAAsB,SAAQ,oBAAsB;IAChE,YACkB,SAAoB;QAErC,KAAK,EAAE,CAAA;QAFU,cAAS,GAAT,SAAS,CAAW;IAGtC,CAAC;IAES,SAAS,CAAC,aAAkD;QACrE,aAAa,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAA;QACpD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,EAAE;YAC1C,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;SACjC;QACD,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAA;QAC9C,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,2DAA2D,CAAC,CAAA;QACtG,aAAa,CAAC,EAAE;aACd,MAAM,CAAC,KAAK,CAAC;aACb,SAAS,EAAE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OAAO,CAAC,CAAA;aACR;YAAC,OAAO,CAAC,EAAE;gBACX,IAAI,CAAC,YAAY,0CAAsB,EAAE;oBACxC,IAAA,8BAAqB,EAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,CAAA;oBACpD,OAAO,CAAC,CAAA;iBACR;gBACD,MAAM,CAAC,CAAA;aACP;QACF,CAAC,CACD,CAAA;IACF,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,KAAgC;QAC5D,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QAClC,IAAI,GAAG,EAAE;YACR,OAAO,IAAI,CAAA;SACX;QACD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,iBAAO,EAAC;YAChC,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,0BAA0B;YACnC,OAAO,EAAE;gBACR,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;gBAC9B,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;aAC/B;SACD,CAAC,CAAA;QACF,OAAO,MAAM,KAAK,KAAK,CAAA;IACxB,CAAC;CACD;AAhJD,sDAgJC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Input } from '@contember/cli-common';
|
|
2
2
|
import { MigrationCreator, MigrationDescriber, MigrationFilesManager, MigrationsResolver, SchemaMigrator, SchemaVersionBuilder } from '@contember/schema-migrations';
|
|
3
3
|
import { Workspace, Project } from '@contember/cli-common';
|
|
4
4
|
declare type Args = {
|
|
5
|
-
project
|
|
5
|
+
project?: string;
|
|
6
6
|
migrationName: string;
|
|
7
7
|
};
|
|
8
8
|
declare type Options = {};
|
|
9
|
-
export declare const
|
|
10
|
-
|
|
9
|
+
export declare const executeCreateMigrationCommand: (input: Input<Pick<Args, 'project'>, Options>, { workspace }: {
|
|
10
|
+
workspace: Workspace;
|
|
11
|
+
}, createMigrationCallback: (args: {
|
|
11
12
|
workspace: Workspace;
|
|
12
13
|
project: Project;
|
|
13
14
|
migrationCreator: MigrationCreator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationCreateHelper.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationCreateHelper.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MigrationCreateHelper.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationCreateHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAEnE,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAE1D,aAAK,IAAI,GAAG;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,aAAK,OAAO,GAAG,EAAE,CAAA;AAEjB,eAAO,MAAM,6BAA6B,UAClC,MAAM,KAAK,IAAI,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC;eACjB,SAAS;;eAExB,SAAS;aACX,OAAO;sBACE,gBAAgB;wBACd,kBAAkB;wBAClB,kBAAkB;0BAChB,oBAAoB;oBAC1B,cAAc;2BACP,qBAAqB;MACvC,QAAQ,MAAM,CAAC,oBA4BrB,CAAA"}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.executeCreateMigrationCommand =
|
|
3
|
+
exports.executeCreateMigrationCommand = void 0;
|
|
4
4
|
const MigrationsContainer_1 = require("../../MigrationsContainer");
|
|
5
|
-
const
|
|
6
|
-
const configureCreateMigrationCommand = (configuration) => {
|
|
7
|
-
configuration.argument('project');
|
|
8
|
-
configuration.argument('migrationName');
|
|
9
|
-
};
|
|
10
|
-
exports.configureCreateMigrationCommand = configureCreateMigrationCommand;
|
|
11
|
-
const executeCreateMigrationCommand = async (input, createMigrationCallback) => {
|
|
5
|
+
const executeCreateMigrationCommand = async (input, { workspace }, createMigrationCallback) => {
|
|
12
6
|
const projectName = input.getArgument('project');
|
|
13
|
-
const workspace = await cli_common_1.Workspace.get(process.cwd());
|
|
14
7
|
const allProjects = projectName === '.';
|
|
15
8
|
const projects = allProjects
|
|
16
9
|
? await workspace.projects.listProjects()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationCreateHelper.js","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationCreateHelper.ts"],"names":[],"mappings":";;;AACA,mEAAsE;
|
|
1
|
+
{"version":3,"file":"MigrationCreateHelper.js","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationCreateHelper.ts"],"names":[],"mappings":";;;AACA,mEAAsE;AAkB/D,MAAM,6BAA6B,GAAG,KAAK,EACjD,KAA4C,EAC5C,EAAE,SAAS,EAA0B,EACrC,uBASqB,EACpB,EAAE;IACH,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;IAChD,MAAM,WAAW,GAAG,WAAW,KAAK,GAAG,CAAA;IACvC,MAAM,QAAQ,GAAG,WAAW;QAC3B,CAAC,CAAC,MAAM,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE;QACzC,CAAC,CAAC,CAAC,MAAM,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAEtE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC/B,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,CAAC,IAAI,GAAG,CAAC,CAAA;QACzC,MAAM,SAAS,GAAG,IAAI,gDAA0B,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,MAAM,EAAE,CAAA;QAEhF,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC;YAC5C,OAAO;YACP,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;YAC5C,kBAAkB,EAAE,SAAS,CAAC,kBAAkB;YAChD,kBAAkB,EAAE,SAAS,CAAC,kBAAkB;YAChD,oBAAoB,EAAE,SAAS,CAAC,oBAAoB;YACpD,cAAc,EAAE,SAAS,CAAC,cAAc;YACxC,qBAAqB,EAAE,SAAS,CAAC,qBAAqB;YACtD,SAAS;SACT,CAAC,CAAA;QACF,OAAO,CAAC,QAAQ,EAAE,CAAA;QAClB,IAAI,MAAM,GAAG,CAAC,EAAE;YACf,OAAO,MAAM,CAAA;SACb;KACD;IACD,OAAO,CAAC,CAAA;AACT,CAAC,CAAA;AAxCY,QAAA,6BAA6B,iCAwCzC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Command, CommandConfiguration, Input } from '@contember/cli-common';
|
|
2
|
+
import { Workspace } from '@contember/cli-common';
|
|
2
3
|
declare type Args = {
|
|
3
|
-
project
|
|
4
|
+
project?: string;
|
|
4
5
|
migration?: string;
|
|
5
6
|
};
|
|
6
7
|
declare type Options = {
|
|
@@ -8,6 +9,8 @@ declare type Options = {
|
|
|
8
9
|
['no-sql']: boolean;
|
|
9
10
|
};
|
|
10
11
|
export declare class MigrationDescribeCommand extends Command<Args, Options> {
|
|
12
|
+
private readonly workspace;
|
|
13
|
+
constructor(workspace: Workspace);
|
|
11
14
|
protected configure(configuration: CommandConfiguration<Args, Options>): void;
|
|
12
15
|
protected execute(input: Input<Args, Options>): Promise<void>;
|
|
13
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationDescribeCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationDescribeCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"MigrationDescribeCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationDescribeCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAM5E,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,aAAK,IAAI,GAAG;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,aAAK,OAAO,GAAG;IACd,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IACrB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAiCD,qBAAa,wBAAyB,SAAQ,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;IAElE,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAKtC,SAAS,CAAC,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI;cAU7D,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAqBnE"}
|
|
@@ -8,7 +8,6 @@ const cli_common_1 = require("@contember/cli-common");
|
|
|
8
8
|
const MigrationsContainer_1 = require("../../MigrationsContainer");
|
|
9
9
|
const migrations_1 = require("../../utils/migrations");
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
-
const cli_common_2 = require("@contember/cli-common");
|
|
12
11
|
let printMigrationDescription = async function (migrationsDescriber, schema, migration, options) {
|
|
13
12
|
const description = await migrationsDescriber.describeModifications(schema, migration, 'system'); // schema name cannot be determined here
|
|
14
13
|
description.forEach(({ modification, sql, description }) => {
|
|
@@ -36,16 +35,22 @@ let printMigrationDescription = async function (migrationsDescriber, schema, mig
|
|
|
36
35
|
});
|
|
37
36
|
};
|
|
38
37
|
class MigrationDescribeCommand extends cli_common_1.Command {
|
|
38
|
+
constructor(workspace) {
|
|
39
|
+
super();
|
|
40
|
+
this.workspace = workspace;
|
|
41
|
+
}
|
|
39
42
|
configure(configuration) {
|
|
40
43
|
configuration.description('Describes a migration');
|
|
41
|
-
|
|
44
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
45
|
+
configuration.argument('project');
|
|
46
|
+
}
|
|
42
47
|
configuration.argument('migration').optional();
|
|
43
48
|
configuration.option('sql-only').valueNone();
|
|
44
49
|
configuration.option('no-sql').valueNone();
|
|
45
50
|
}
|
|
46
51
|
async execute(input) {
|
|
47
52
|
const projectName = input.getArgument('project');
|
|
48
|
-
const workspace =
|
|
53
|
+
const workspace = this.workspace;
|
|
49
54
|
const project = await workspace.projects.getProject(projectName, { fuzzy: true });
|
|
50
55
|
const migrationsDir = await project.migrationsDir;
|
|
51
56
|
const container = new MigrationsContainer_1.MigrationsContainerFactory(migrationsDir).create();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationDescribeCommand.js","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationDescribeCommand.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA4E;AAC5E,mEAAsE;AACtE,uDAA+E;AAC/E,kDAAyB;
|
|
1
|
+
{"version":3,"file":"MigrationDescribeCommand.js","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationDescribeCommand.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA4E;AAC5E,mEAAsE;AACtE,uDAA+E;AAC/E,kDAAyB;AAezB,IAAI,yBAAyB,GAAG,KAAK,WACpC,mBAAuC,EACvC,MAAc,EACd,SAAoB,EACpB,OAA6C;IAE7C,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA,CAAC,wCAAwC;IACzI,WAAW,C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AC,SAAS,CAAC,kBAAkB,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAA;IACrG,CAAC;CACD;AAtCD,4DAsCC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Command, CommandConfiguration, Input } from '@contember/cli-common';
|
|
1
|
+
import { Command, CommandConfiguration, Input, Workspace } from '@contember/cli-common';
|
|
2
2
|
declare type Args = {
|
|
3
|
-
project
|
|
3
|
+
project?: string;
|
|
4
4
|
migrationName: string;
|
|
5
5
|
};
|
|
6
6
|
declare type Options = {
|
|
@@ -8,6 +8,8 @@ declare type Options = {
|
|
|
8
8
|
yes?: true;
|
|
9
9
|
};
|
|
10
10
|
export declare class MigrationDiffCommand extends Command<Args, Options> {
|
|
11
|
+
private readonly workspace;
|
|
12
|
+
constructor(workspace: Workspace);
|
|
11
13
|
protected configure(configuration: CommandConfiguration<Args, Options>): void;
|
|
12
14
|
protected execute(input: Input<Args, Options>): Promise<number>;
|
|
13
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationDiffCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationDiffCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"MigrationDiffCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationDiffCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAYvF,aAAK,IAAI,GAAG;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,aAAK,OAAO,GAAG;IACd,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,GAAG,CAAC,EAAE,IAAI,CAAA;CACV,CAAA;AAED,qBAAa,oBAAqB,SAAQ,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;IAE9D,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAKtC,SAAS,CAAC,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI;cAa7D,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CA8ErE"}
|
|
@@ -16,9 +16,16 @@ const instance_1 = require("../../utils/instance");
|
|
|
16
16
|
const system_1 = require("../../utils/system");
|
|
17
17
|
const loadSchema_1 = require("../../utils/project/loadSchema");
|
|
18
18
|
class MigrationDiffCommand extends cli_common_1.Command {
|
|
19
|
+
constructor(workspace) {
|
|
20
|
+
super();
|
|
21
|
+
this.workspace = workspace;
|
|
22
|
+
}
|
|
19
23
|
configure(configuration) {
|
|
20
24
|
configuration.description('Creates schema migration diff for given project');
|
|
21
|
-
(
|
|
25
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
26
|
+
configuration.argument('project');
|
|
27
|
+
}
|
|
28
|
+
configuration.argument('migrationName');
|
|
22
29
|
configuration.option('execute').valueNone();
|
|
23
30
|
configuration //
|
|
24
31
|
.option('yes')
|
|
@@ -26,7 +33,7 @@ class MigrationDiffCommand extends cli_common_1.Command {
|
|
|
26
33
|
.description('Do not ask for confirmation.');
|
|
27
34
|
}
|
|
28
35
|
async execute(input) {
|
|
29
|
-
return await (0, MigrationCreateHelper_1.executeCreateMigrationCommand)(input, async ({ schemaVersionBuilder, migrationsResolver, workspace, project, migrationCreator, migrationDescriber, }) => {
|
|
36
|
+
return await (0, MigrationCreateHelper_1.executeCreateMigrationCommand)(input, { workspace: this.workspace }, async ({ schemaVersionBuilder, migrationsResolver, workspace, project, migrationCreator, migrationDescriber, }) => {
|
|
30
37
|
const schema = await (0, loadSchema_1.loadSchema)(project);
|
|
31
38
|
try {
|
|
32
39
|
const migrationName = input.getArgument('migrationName');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationDiffCommand.js","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationDiffCommand.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationDiffCommand.js","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationDiffCommand.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAuF;AACvF,+CAA0D;AAC1D,oEAAqE;AACrE,mEAAuE;AACvE,uDAA8F;AAC9F,qEAAoF;AACpF,sDAA6B;AAC7B,+CAA6E;AAC7E,mDAAqF;AACrF,+CAAiD;AACjD,+DAA2D;AAY3D,MAAa,oBAAqB,SAAQ,oBAAsB;IAC/D,YACkB,SAAoB;QAErC,KAAK,EAAE,CAAA;QAFU,cAAS,GAAT,SAAS,CAAW;IAGtC,CAAC;IAES,SAAS,CAAC,aAAkD;QACrE,aAAa,CAAC,WAAW,CAAC,iDAAiD,CAAC,CAAA;QAC5E,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,EAAE;YAC1C,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;SACjC;QACD,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;QACvC,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,CAAA;QAC3C,aAAa,CAAC,EAAE;aACd,MAAM,CAAC,KAAK,CAAC;aACb,SAAS,EAAE;aACX,WAAW,CAAC,8BAA8B,CAAC,CAAA;IAC9C,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,KAA2B;QAClD,OAAO,MAAM,IAAA,qDAA6B,EACzC,KAAK,EACL,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,EAC7B,KAAK,EAAE,EACN,oBAAoB,EACpB,kBAAkB,EAClB,SAAS,EACT,OAAO,EACP,gBAAgB,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,EAAE,MAAM,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG;wBAClE,oBAAoB;wBACpB,kBAAkB;qBAClB,CAAC,CAAA;iBACF;gBACD,OAAO,CAAC,CAAA;aACR;YAAC,OAAO,CAAC,EAAE;gBACX,IAAI,CAAC,YAAY,0CAAsB,EAAE;oBACxC,IAAA,8BAAqB,EAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,CAAA;oBACpD,OAAO,CAAC,CAAA;iBACR;gBACD,MAAM,CAAC,CAAA;aACP;QACF,CAAC,CACD,CAAA;IACF,CAAC;CACD;AAlGD,oDAkGC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { Command, CommandConfiguration, Input } from '@contember/cli-common';
|
|
1
|
+
import { Command, CommandConfiguration, Input, Workspace } from '@contember/cli-common';
|
|
2
2
|
import { ExecuteMigrationOptions } from './MigrationExecuteHelper';
|
|
3
3
|
declare type Args = {
|
|
4
|
-
project
|
|
4
|
+
project?: string;
|
|
5
5
|
migration?: string;
|
|
6
6
|
};
|
|
7
7
|
declare type Options = ExecuteMigrationOptions & {
|
|
8
8
|
force: boolean;
|
|
9
9
|
};
|
|
10
10
|
export declare class MigrationExecuteCommand extends Command<Args, Options> {
|
|
11
|
+
private readonly workspace;
|
|
12
|
+
constructor(workspace: Workspace);
|
|
11
13
|
protected configure(configuration: CommandConfiguration<Args, Options>): void;
|
|
12
14
|
protected execute(input: Input<Args, Options>): Promise<number>;
|
|
13
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationExecuteCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationExecuteCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"MigrationExecuteCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationExecuteCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAuB,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAE5G,OAAO,EAEN,uBAAuB,EAGvB,MAAM,0BAA0B,CAAA;AAOjC,aAAK,IAAI,GAAG;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,aAAK,OAAO,GAAG,uBAAuB,GAAG;IACxC,KAAK,EAAE,OAAO,CAAA;CACd,CAAA;AAED,qBAAa,uBAAwB,SAAQ,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;IAEjE,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAKtC,SAAS,CAAC,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI;cAU7D,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CA2ErE"}
|
|
@@ -10,20 +10,23 @@ const instance_1 = require("../../utils/instance");
|
|
|
10
10
|
const tenant_1 = require("../../utils/tenant");
|
|
11
11
|
const system_1 = require("../../utils/system");
|
|
12
12
|
class MigrationExecuteCommand extends cli_common_1.Command {
|
|
13
|
+
constructor(workspace) {
|
|
14
|
+
super();
|
|
15
|
+
this.workspace = workspace;
|
|
16
|
+
}
|
|
13
17
|
configure(configuration) {
|
|
14
18
|
configuration.description('Executes migrations on an instance');
|
|
15
|
-
|
|
19
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
20
|
+
configuration.argument('project');
|
|
21
|
+
}
|
|
16
22
|
configuration.argument('migration').optional();
|
|
17
23
|
configuration.option('force').description('Ignore migrations order and missing migrations (dev only)');
|
|
18
24
|
(0, MigrationExecuteHelper_1.configureExecuteMigrationCommand)(configuration);
|
|
19
25
|
}
|
|
20
26
|
async execute(input) {
|
|
21
27
|
const projectName = input.getArgument('project');
|
|
22
|
-
const workspace =
|
|
28
|
+
const workspace = this.workspace;
|
|
23
29
|
const allProjects = projectName === '.';
|
|
24
|
-
if (!allProjects) {
|
|
25
|
-
(0, cli_common_1.validateProjectName)(projectName);
|
|
26
|
-
}
|
|
27
30
|
const remoteProjectOption = input === null || input === void 0 ? void 0 : input.getOption('remote-project');
|
|
28
31
|
if (remoteProjectOption && allProjects) {
|
|
29
32
|
throw 'Option remote-project can be used only for a single project';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationExecuteCommand.js","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationExecuteCommand.ts"],"names":[],"mappings":";;;AAAA,sDAA4G;AAC5G,mEAAsE;AACtE,qEAKiC;AACjC,uDAAkG;AAClG,yDAAqD;AACrD,mDAAqF;AACrF,+CAA6E;AAC7E,+CAAiD;AAWjD,MAAa,uBAAwB,SAAQ,oBAAsB;
|
|
1
|
+
{"version":3,"file":"MigrationExecuteCommand.js","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationExecuteCommand.ts"],"names":[],"mappings":";;;AAAA,sDAA4G;AAC5G,mEAAsE;AACtE,qEAKiC;AACjC,uDAAkG;AAClG,yDAAqD;AACrD,mDAAqF;AACrF,+CAA6E;AAC7E,+CAAiD;AAWjD,MAAa,uBAAwB,SAAQ,oBAAsB;IAClE,YACkB,SAAoB;QAErC,KAAK,EAAE,CAAA;QAFU,cAAS,GAAT,SAAS,CAAW;IAGtC,CAAC;IAES,SAAS,CAAC,aAAkD;QACrE,aAAa,CAAC,WAAW,CAAC,oCAAoC,CAAC,CAAA;QAC/D,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,EAAE;YAC1C,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;SACjC;QACD,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAA;QAC9C,aAAa,CAAC,MAAM,CAA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K,GAAG,CAAA;wBACjG,KAAK,2BAAc,CAAC,aAAa;4BAChC,OAAO,CAAC,SAAS,CAAC,CAAA;wBACnB;4BACC,IAAA,yBAAW,EAAC,SAAS,CAAC,CAAA;qBACvB;iBACD;qBAAM;oBACN,OAAO,MAAM,CAAC,mBAAmB,CAAA;iBACjC;YACF,CAAC,CAAC,EAAE,CAAA;YACJ,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC5B,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;gBACvC,SAAQ;aACR;YAED,MAAM,UAAU,GAAG,MAAM,IAAA,0CAAiB,EAAC;gBAC1C,kBAAkB,EAAE,SAAS,CAAC,kBAAkB;gBAChD,oBAAoB,EAAE,SAAS,CAAC,oBAAoB;gBACpD,MAAM,EAAE,YAAY;gBACpB,UAAU;gBACV,mBAAmB,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC;gBAC5C,KAAK,EAAE,KAAK;aACZ,CAAC,CAAA;YACF,IAAI,KAAJ,IAAI,GAAK,UAAU,EAAA;SACnB;QACD,OAAO,IAAI,CAAA;IACZ,CAAC;CACD;AA5FD,0DA4FC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { Command, CommandConfiguration, Input } from '@contember/cli-common';
|
|
1
|
+
import { Command, CommandConfiguration, Input, Workspace } from '@contember/cli-common';
|
|
2
2
|
declare type Args = {
|
|
3
|
-
project
|
|
3
|
+
project?: string;
|
|
4
4
|
migration: string[];
|
|
5
5
|
};
|
|
6
6
|
declare type Options = {
|
|
7
7
|
yes?: true;
|
|
8
8
|
};
|
|
9
9
|
export declare class MigrationRebaseCommand extends Command<Args, Options> {
|
|
10
|
+
private readonly workspace;
|
|
11
|
+
constructor(workspace: Workspace);
|
|
10
12
|
protected configure(configuration: CommandConfiguration<Args, Options>): void;
|
|
11
13
|
protected execute(input: Input<Args, Options>): Promise<number>;
|
|
12
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationRebaseCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationRebaseCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"MigrationRebaseCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationRebaseCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAQvF,aAAK,IAAI,GAAG;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAED,aAAK,OAAO,GAAG;IACd,GAAG,CAAC,EAAE,IAAI,CAAA;CACV,CAAA;AAED,qBAAa,sBAAuB,SAAQ,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;IAEhE,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAMtC,SAAS,CAAC,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI;cAY7D,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAqDrE"}
|
|
@@ -9,9 +9,15 @@ const SystemApiClientResolver_1 = require("./SystemApiClientResolver");
|
|
|
9
9
|
const schema_utils_1 = require("@contember/schema-utils");
|
|
10
10
|
const MigrationValidationHelper_1 = require("./MigrationValidationHelper");
|
|
11
11
|
class MigrationRebaseCommand extends cli_common_1.Command {
|
|
12
|
+
constructor(workspace) {
|
|
13
|
+
super();
|
|
14
|
+
this.workspace = workspace;
|
|
15
|
+
}
|
|
12
16
|
configure(configuration) {
|
|
13
17
|
configuration.description('Rebase migrations on filesystem and in local instance');
|
|
14
|
-
|
|
18
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
19
|
+
configuration.argument('project');
|
|
20
|
+
}
|
|
15
21
|
configuration.argument('migration').variadic();
|
|
16
22
|
configuration //
|
|
17
23
|
.option('yes')
|
|
@@ -19,7 +25,7 @@ class MigrationRebaseCommand extends cli_common_1.Command {
|
|
|
19
25
|
.description('Do not ask for confirmation.');
|
|
20
26
|
}
|
|
21
27
|
async execute(input) {
|
|
22
|
-
return await (0, MigrationCreateHelper_1.executeCreateMigrationCommand)(input, async ({ schemaVersionBuilder, migrationsResolver, workspace, project, migrationCreator, migrationDescriber, schemaMigrator, migrationFilesManager, }) => {
|
|
28
|
+
return await (0, MigrationCreateHelper_1.executeCreateMigrationCommand)(input, { workspace: this.workspace }, async ({ schemaVersionBuilder, migrationsResolver, workspace, project, migrationCreator, migrationDescriber, schemaMigrator, migrationFilesManager, }) => {
|
|
23
29
|
const migrationNames = input.getArgument('migration');
|
|
24
30
|
const migrations = [];
|
|
25
31
|
for (const migrationName of migrationNames) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationRebaseCommand.js","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationRebaseCommand.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationRebaseCommand.js","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationRebaseCommand.ts"],"names":[],"mappings":";;;AAAA,sDAAuF;AACvF,oEAAqE;AACrE,mEAAuE;AACvE,uDAA2D;AAC3D,uEAAkE;AAClE,0DAAqD;AACrD,2EAAgE;AAWhE,MAAa,sBAAuB,SAAQ,oBAAsB;IACjE,YACkB,SAAoB;QAErC,KAAK,EAAE,CAAA;QAFU,cAAS,GAAT,SAAS,CAAW;IAGtC,CAAC;IAGS,SAAS,CAAC,aAAkD;QACrE,aAAa,CAAC,WAAW,CAAC,uDAAuD,CAAC,CAAA;QAClF,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,mBA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CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CACtC,CAAA;YACD,MAAM,KAAK,GAAG,MAAM,IAAA,8CAAkB,EAAC,uBAAuB,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,CAAC,CAAA;YAC/G,IAAI,CAAC,KAAK,EAAE;gBACX,MAAM,0BAA0B,CAAA;aAChC;YACD,MAAM,MAAM,GAAG,MAAM,IAAA,gDAAsB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAA;YAC/D,IAAI,CAAC,GAAG,CAAC,CAAA;YACT,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;gBACnC,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,0CAAsB,CAAC,YAAY,GAAG,CAAC,CAAC,CAAA;gBAC9E,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,0CAAsB,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAA;gBAC3E,MAAM,YAAY,GAAG;oBACpB,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,OAAO;oBAChB,aAAa,EAAE,SAAS,CAAC,aAAa;oBACtC,aAAa,EAAE,SAAS,CAAC,aAAa;iBACtC,CAAA;gBACD,MAAM,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;gBAC7D,MAAM,qBAAqB,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;aACvE;YACD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;YAEnB,OAAO,CAAC,CAAA;QACT,CAAC,CACD,CAAA;IACF,CAAC;CACD;AAzED,wDAyEC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Command, CommandConfiguration, Input } from '@contember/cli-common';
|
|
2
|
+
import { Workspace } from '@contember/cli-common';
|
|
2
3
|
declare type Args = {
|
|
3
|
-
project
|
|
4
|
+
project?: string;
|
|
4
5
|
};
|
|
5
6
|
declare type Options = {
|
|
6
7
|
instance?: string;
|
|
@@ -10,6 +11,8 @@ declare type Options = {
|
|
|
10
11
|
['restore-missing']?: true;
|
|
11
12
|
};
|
|
12
13
|
export declare class MigrationStatusCommand extends Command<Args, Options> {
|
|
14
|
+
private readonly workspace;
|
|
15
|
+
constructor(workspace: Workspace);
|
|
13
16
|
protected configure(configuration: CommandConfiguration<Args, Options>): void;
|
|
14
17
|
protected execute(input: Input<Args, Options>): Promise<number>;
|
|
15
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationStatusCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationStatusCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"MigrationStatusCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationStatusCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAO5E,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,aAAK,IAAI,GAAG;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,aAAK,OAAO,GAAG;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,CAAC,gBAAgB,CAAC,CAAC,EAAE,MAAM,CAAA;IAC3B,CAAC,iBAAiB,CAAC,CAAC,EAAE,IAAI,CAAA;IAC1B,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAA;IACtB,CAAC,iBAAiB,CAAC,CAAC,EAAE,IAAI,CAAA;CAC1B,CAAA;AAED,qBAAa,sBAAuB,SAAQ,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;IAEhE,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAKtC,SAAS,CAAC,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI;cA2B7D,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAyDrE"}
|
|
@@ -11,11 +11,16 @@ const tenant_1 = require("../../utils/tenant");
|
|
|
11
11
|
const system_1 = require("../../utils/system");
|
|
12
12
|
const migrations_1 = require("../../utils/migrations");
|
|
13
13
|
const chalk_1 = __importDefault(require("chalk"));
|
|
14
|
-
const cli_common_2 = require("@contember/cli-common");
|
|
15
14
|
class MigrationStatusCommand extends cli_common_1.Command {
|
|
15
|
+
constructor(workspace) {
|
|
16
|
+
super();
|
|
17
|
+
this.workspace = workspace;
|
|
18
|
+
}
|
|
16
19
|
configure(configuration) {
|
|
17
20
|
configuration.description('Shows status of executed migrations on an instance & sync status');
|
|
18
|
-
|
|
21
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
22
|
+
configuration.argument('project');
|
|
23
|
+
}
|
|
19
24
|
configuration //
|
|
20
25
|
.option('instance')
|
|
21
26
|
.valueRequired()
|
|
@@ -39,7 +44,7 @@ class MigrationStatusCommand extends cli_common_1.Command {
|
|
|
39
44
|
}
|
|
40
45
|
async execute(input) {
|
|
41
46
|
const projectName = input.getArgument('project');
|
|
42
|
-
const workspace =
|
|
47
|
+
const workspace = this.workspace;
|
|
43
48
|
const project = await workspace.projects.getProject(projectName, { fuzzy: true });
|
|
44
49
|
const migrationsDir = await project.migrationsDir;
|
|
45
50
|
const container = new MigrationsContainer_1.MigrationsContainerFactory(migrationsDir).create();
|