@contember/cli 0.12.0-beta.1 → 1.0.0-alpha.2
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/Dockerfile +3 -1
- package/dist/src/commands/deploy/DeployCommand.js +7 -7
- package/dist/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationAmendCommand.js +10 -10
- package/dist/src/commands/migrations/MigrationAmendCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationDescribeCommand.js +2 -2
- package/dist/src/commands/migrations/MigrationDescribeCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationDiffCommand.js +9 -9
- package/dist/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationExecuteCommand.js +9 -9
- package/dist/src/commands/migrations/MigrationExecuteCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationExecuteHelper.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationExecuteHelper.js +6 -10
- package/dist/src/commands/migrations/MigrationExecuteHelper.js.map +1 -1
- package/dist/src/commands/migrations/MigrationRebaseCommand.js +4 -4
- package/dist/src/commands/migrations/MigrationRebaseCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationStatusCommand.js +6 -6
- package/dist/src/commands/migrations/MigrationStatusCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationValidationHelper.js +1 -1
- package/dist/src/commands/migrations/MigrationValidationHelper.js.map +1 -1
- package/dist/src/commands/migrations/SystemApiClientResolver.js +2 -2
- package/dist/src/commands/migrations/SystemApiClientResolver.js.map +1 -1
- package/dist/src/commands/migrations/index.d.ts +0 -1
- package/dist/src/commands/migrations/index.d.ts.map +1 -1
- package/dist/src/commands/migrations/index.js +0 -1
- package/dist/src/commands/migrations/index.js.map +1 -1
- package/dist/src/commands/misc/VersionCommand.js +1 -1
- package/dist/src/commands/misc/VersionCommand.js.map +1 -1
- package/dist/src/commands/project/ProjectCreateCommand.js +1 -1
- package/dist/src/commands/project/ProjectCreateCommand.js.map +1 -1
- package/dist/src/commands/project/ProjectPrintSchemaCommand.js +4 -4
- package/dist/src/commands/project/ProjectPrintSchemaCommand.js.map +1 -1
- package/dist/src/commands/project/ProjectValidateCommand.js +4 -4
- package/dist/src/commands/project/ProjectValidateCommand.js.map +1 -1
- package/dist/src/commands/tenant/CreateApiKeyCommand.js +3 -3
- package/dist/src/commands/tenant/CreateApiKeyCommand.js.map +1 -1
- package/dist/src/commands/tenant/InviteCommand.js +3 -3
- package/dist/src/commands/tenant/InviteCommand.js.map +1 -1
- package/dist/src/commands/tenant/ResetPasswordCommand.js +3 -3
- package/dist/src/commands/tenant/ResetPasswordCommand.js.map +1 -1
- package/dist/src/commands/tenant/SignInCommand.js +3 -3
- package/dist/src/commands/tenant/SignInCommand.js.map +1 -1
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.js +3 -3
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.js.map +1 -1
- package/dist/src/run.js +2 -3
- package/dist/src/run.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/utils/admin.d.ts.map +1 -1
- package/dist/src/utils/admin.js +5 -5
- package/dist/src/utils/admin.js.map +1 -1
- package/dist/src/utils/commands.js +1 -1
- package/dist/src/utils/commands.js.map +1 -1
- package/dist/src/utils/dockerCompose.js +4 -4
- package/dist/src/utils/dockerCompose.js.map +1 -1
- package/dist/src/utils/instance/interactiveUtils.js +2 -2
- package/dist/src/utils/instance/interactiveUtils.js.map +1 -1
- package/dist/src/utils/migrations.js +6 -6
- package/dist/src/utils/migrations.js.map +1 -1
- package/dist/src/utils/npm.js +6 -6
- package/dist/src/utils/npm.js.map +1 -1
- package/dist/src/utils/schema.js +1 -1
- package/dist/src/utils/schema.js.map +1 -1
- package/dist/src/utils/system/index.d.ts +1 -1
- package/dist/src/utils/system/index.d.ts.map +1 -1
- package/dist/src/utils/system/index.js +5 -2
- package/dist/src/utils/system/index.js.map +1 -1
- package/dist/src/utils/tenant.js +21 -21
- package/dist/src/utils/tenant.js.map +1 -1
- package/dist/src/utils/workspace.js +3 -3
- package/dist/src/utils/workspace.js.map +1 -1
- package/dist/src/utils/yaml.js +3 -3
- package/dist/src/utils/yaml.js.map +1 -1
- package/package.json +10 -10
- package/src/commands/migrations/MigrationExecuteHelper.ts +3 -7
- package/src/commands/migrations/index.ts +0 -1
- package/src/run.ts +0 -2
- package/src/utils/admin.ts +2 -1
- package/src/utils/system/index.ts +5 -2
- package/dist/src/commands/migrations/MigrationCreateCommand.d.ts +0 -15
- package/dist/src/commands/migrations/MigrationCreateCommand.d.ts.map +0 -1
- package/dist/src/commands/migrations/MigrationCreateCommand.js +0 -21
- package/dist/src/commands/migrations/MigrationCreateCommand.js.map +0 -1
- package/src/commands/migrations/MigrationCreateCommand.ts +0 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"contember": "./dist/src/run.js"
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"@types/fs-extra": "^9.0.3"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@contember/cli-common": "^0.
|
|
18
|
-
"@contember/config-loader": "^0.
|
|
19
|
-
"@contember/database-migrations": "^0.
|
|
20
|
-
"@contember/dic": "^0.
|
|
21
|
-
"@contember/engine-content-api": "^0.
|
|
22
|
-
"@contember/schema": "^0.
|
|
23
|
-
"@contember/schema-definition": "^0.
|
|
24
|
-
"@contember/schema-migrations": "^0.
|
|
25
|
-
"@contember/schema-utils": "^0.
|
|
17
|
+
"@contember/cli-common": "^1.0.0-alpha.2",
|
|
18
|
+
"@contember/config-loader": "^1.0.0-alpha.2",
|
|
19
|
+
"@contember/database-migrations": "^1.0.0-alpha.2",
|
|
20
|
+
"@contember/dic": "^1.0.0-alpha.2",
|
|
21
|
+
"@contember/engine-content-api": "^1.0.0-alpha.2",
|
|
22
|
+
"@contember/schema": "^1.0.0-alpha.2",
|
|
23
|
+
"@contember/schema-definition": "^1.0.0-alpha.2",
|
|
24
|
+
"@contember/schema-migrations": "^1.0.0-alpha.2",
|
|
25
|
+
"@contember/schema-utils": "^1.0.0-alpha.2",
|
|
26
26
|
"@graphql-tools/merge": "^6.2.14",
|
|
27
27
|
"chalk": "^4.1.0",
|
|
28
28
|
"chalk-table": "^1.0.2",
|
|
@@ -82,14 +82,10 @@ export const executeMigrations = async ({
|
|
|
82
82
|
} while (true)
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
await client.migrate(
|
|
86
86
|
migrations.map(it => it.localMigration),
|
|
87
87
|
force,
|
|
88
88
|
)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return 0
|
|
92
|
-
}
|
|
93
|
-
console.error(result.errors)
|
|
94
|
-
return 1
|
|
89
|
+
console.log('Migration executed')
|
|
90
|
+
return 0
|
|
95
91
|
}
|
package/src/run.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
DeployCommand,
|
|
7
7
|
InviteCommand,
|
|
8
8
|
MigrationAmendCommand,
|
|
9
|
-
MigrationCreateCommand,
|
|
10
9
|
MigrationDescribeCommand,
|
|
11
10
|
MigrationDiffCommand,
|
|
12
11
|
MigrationExecuteCommand,
|
|
@@ -35,7 +34,6 @@ import {
|
|
|
35
34
|
['migrations:diff']: diffCommandFactory,
|
|
36
35
|
['migrations:amend']: () => new MigrationAmendCommand(),
|
|
37
36
|
['migrations:describe']: migrationsDescribeFactory,
|
|
38
|
-
['migrations:create']: () => new MigrationCreateCommand(),
|
|
39
37
|
['migrations:execute']: () => new MigrationExecuteCommand(),
|
|
40
38
|
['migrations:rebase']: () => new MigrationRebaseCommand(),
|
|
41
39
|
['migrations:status']: () => new MigrationStatusCommand(),
|
package/src/utils/admin.ts
CHANGED
|
@@ -10,8 +10,9 @@ export class AdminClient {
|
|
|
10
10
|
|
|
11
11
|
public async deploy(project: string, files: AdminFiles): Promise<void> {
|
|
12
12
|
const response = await this.execute('_deploy', 'POST', { project, files })
|
|
13
|
+
|
|
13
14
|
if (!response.ok) {
|
|
14
|
-
throw
|
|
15
|
+
throw `Failed to deploy admin, POST request to ${this.url}/_deploy returned status ${response.status} ${response.statusText}`
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -40,7 +40,7 @@ export class SystemClient {
|
|
|
40
40
|
return new SystemClient(graphqlClient)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
public async migrate(migrations: Migration[], force = false): Promise<
|
|
43
|
+
public async migrate(migrations: Migration[], force = false): Promise<void> {
|
|
44
44
|
const query = `
|
|
45
45
|
mutation($migrations: [Migration!]!) {
|
|
46
46
|
migrate: ${force ? 'forceMigrate' : 'migrate'}(migrations: $migrations) {
|
|
@@ -53,13 +53,16 @@ mutation($migrations: [Migration!]!) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
`
|
|
56
|
-
|
|
56
|
+
const result = (
|
|
57
57
|
await this.apiClient.request<{
|
|
58
58
|
migrate: { ok: boolean; errors: { code: MigrateErrorCode; migration: string; message: string }[] }
|
|
59
59
|
}>(query, {
|
|
60
60
|
migrations,
|
|
61
61
|
})
|
|
62
62
|
).migrate
|
|
63
|
+
if (!result.ok) {
|
|
64
|
+
throw result.errors
|
|
65
|
+
}
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
public async migrationDelete(version: string): Promise<void> {
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Command, CommandConfiguration, Input } from '@contember/cli-common';
|
|
2
|
-
declare type Args = {
|
|
3
|
-
project: string;
|
|
4
|
-
migrationName: string;
|
|
5
|
-
};
|
|
6
|
-
declare type Options = {
|
|
7
|
-
['migrations-dir']?: string;
|
|
8
|
-
['project-dir']?: string;
|
|
9
|
-
};
|
|
10
|
-
export declare class MigrationCreateCommand extends Command<Args, Options> {
|
|
11
|
-
protected configure(configuration: CommandConfiguration<Args, Options>): void;
|
|
12
|
-
protected execute(input: Input<Args, Options>): Promise<number>;
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=MigrationCreateCommand.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationCreateCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationCreateCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAG5E,aAAK,IAAI,GAAG;IACX,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,aAAK,OAAO,GAAG;IACd,CAAC,gBAAgB,CAAC,CAAC,EAAE,MAAM,CAAA;IAC3B,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,qBAAa,sBAAuB,SAAQ,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;IACjE,SAAS,CAAC,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI;cAK7D,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAQrE"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MigrationCreateCommand = void 0;
|
|
4
|
-
const cli_common_1 = require("@contember/cli-common");
|
|
5
|
-
const MigrationCreateHelper_1 = require("./MigrationCreateHelper");
|
|
6
|
-
class MigrationCreateCommand extends cli_common_1.Command {
|
|
7
|
-
configure(configuration) {
|
|
8
|
-
configuration.description('Creates empty schema migration for given project');
|
|
9
|
-
MigrationCreateHelper_1.configureCreateMigrationCommand(configuration);
|
|
10
|
-
}
|
|
11
|
-
async execute(input) {
|
|
12
|
-
return await MigrationCreateHelper_1.executeCreateMigrationCommand(input, async ({ migrationCreator }) => {
|
|
13
|
-
const migrationName = input.getArgument('migrationName');
|
|
14
|
-
const result = await migrationCreator.createEmpty(migrationName);
|
|
15
|
-
console.log(`${result} created`);
|
|
16
|
-
return 0;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.MigrationCreateCommand = MigrationCreateCommand;
|
|
21
|
-
//# sourceMappingURL=MigrationCreateCommand.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationCreateCommand.js","sourceRoot":"","sources":["../../../../src/commands/migrations/MigrationCreateCommand.ts"],"names":[],"mappings":";;;AAAA,sDAA4E;AAC5E,mEAAwG;AAYxG,MAAa,sBAAuB,SAAQ,oBAAsB;IACvD,SAAS,CAAC,aAAkD;QACrE,aAAa,CAAC,WAAW,CAAC,kDAAkD,CAAC,CAAA;QAC7E,uDAA+B,CAAC,aAAa,CAAC,CAAA;IAC/C,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,KAA2B;QAClD,OAAO,MAAM,qDAA6B,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE;YAChF,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,CAAA;YACxD,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,WAAW,CAAC,aAAa,CAAC,CAAA;YAChE,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,UAAU,CAAC,CAAA;YAChC,OAAO,CAAC,CAAA;QACT,CAAC,CAAC,CAAA;IACH,CAAC;CACD;AAdD,wDAcC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Command, CommandConfiguration, Input } from '@contember/cli-common'
|
|
2
|
-
import { configureCreateMigrationCommand, executeCreateMigrationCommand } from './MigrationCreateHelper'
|
|
3
|
-
|
|
4
|
-
type Args = {
|
|
5
|
-
project: string
|
|
6
|
-
migrationName: string
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
type Options = {
|
|
10
|
-
['migrations-dir']?: string
|
|
11
|
-
['project-dir']?: string
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class MigrationCreateCommand extends Command<Args, Options> {
|
|
15
|
-
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
16
|
-
configuration.description('Creates empty schema migration for given project')
|
|
17
|
-
configureCreateMigrationCommand(configuration)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
protected async execute(input: Input<Args, Options>): Promise<number> {
|
|
21
|
-
return await executeCreateMigrationCommand(input, async ({ migrationCreator }) => {
|
|
22
|
-
const migrationName = input.getArgument('migrationName')
|
|
23
|
-
const result = await migrationCreator.createEmpty(migrationName)
|
|
24
|
-
console.log(`${result} created`)
|
|
25
|
-
return 0
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
}
|