@contember/cli 2.1.0-alpha.15 → 2.1.0-alpha.16
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/development/src/commands/actions/ActionsGetEventCommand.cjs +31 -0
- package/dist/development/src/commands/actions/ActionsGetEventCommand.cjs.map +1 -0
- package/dist/development/src/commands/actions/ActionsGetEventCommand.js +31 -0
- package/dist/development/src/commands/actions/ActionsGetEventCommand.js.map +1 -0
- package/dist/development/src/commands/actions/ActionsListFailedEventsCommand.cjs +60 -0
- package/dist/development/src/commands/actions/ActionsListFailedEventsCommand.cjs.map +1 -0
- package/dist/development/src/commands/actions/ActionsListFailedEventsCommand.js +60 -0
- package/dist/development/src/commands/actions/ActionsListFailedEventsCommand.js.map +1 -0
- package/dist/development/src/commands/actions/ActionsListVariablesCommand.cjs +29 -0
- package/dist/development/src/commands/actions/ActionsListVariablesCommand.cjs.map +1 -0
- package/dist/development/src/commands/actions/ActionsListVariablesCommand.js +29 -0
- package/dist/development/src/commands/actions/ActionsListVariablesCommand.js.map +1 -0
- package/dist/development/src/commands/actions/ActionsRetryEventCommand.cjs +32 -0
- package/dist/development/src/commands/actions/ActionsRetryEventCommand.cjs.map +1 -0
- package/dist/development/src/commands/actions/ActionsRetryEventCommand.js +32 -0
- package/dist/development/src/commands/actions/ActionsRetryEventCommand.js.map +1 -0
- package/dist/development/src/commands/actions/ActionsSetVariablesCommand.cjs +40 -0
- package/dist/development/src/commands/actions/ActionsSetVariablesCommand.cjs.map +1 -0
- package/dist/development/src/commands/actions/ActionsSetVariablesCommand.js +40 -0
- package/dist/development/src/commands/actions/ActionsSetVariablesCommand.js.map +1 -0
- package/dist/development/src/commands/actions/ActionsStopEventCommand.cjs +32 -0
- package/dist/development/src/commands/actions/ActionsStopEventCommand.cjs.map +1 -0
- package/dist/development/src/commands/actions/ActionsStopEventCommand.js +32 -0
- package/dist/development/src/commands/actions/ActionsStopEventCommand.js.map +1 -0
- package/dist/development/src/commands/migrations/MigrationStatusCommand.cjs +1 -1
- package/dist/development/src/commands/migrations/MigrationStatusCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationStatusCommand.js +1 -1
- package/dist/development/src/commands/migrations/MigrationStatusCommand.js.map +1 -1
- package/dist/development/src/commands/transfer/ExportCommand.cjs +7 -2
- package/dist/development/src/commands/transfer/ExportCommand.cjs.map +1 -1
- package/dist/development/src/commands/transfer/ExportCommand.js +8 -3
- package/dist/development/src/commands/transfer/ExportCommand.js.map +1 -1
- package/dist/development/src/commands/transfer/ImportCommand.cjs +7 -4
- package/dist/development/src/commands/transfer/ImportCommand.cjs.map +1 -1
- package/dist/development/src/commands/transfer/ImportCommand.js +5 -2
- package/dist/development/src/commands/transfer/ImportCommand.js.map +1 -1
- package/dist/development/src/commands/transfer/TransferCommand.cjs +4 -5
- package/dist/development/src/commands/transfer/TransferCommand.cjs.map +1 -1
- package/dist/development/src/commands/transfer/TransferCommand.js +4 -5
- package/dist/development/src/commands/transfer/TransferCommand.js.map +1 -1
- package/dist/development/src/dic.cjs +14 -2
- package/dist/development/src/dic.cjs.map +1 -1
- package/dist/development/src/dic.js +14 -2
- package/dist/development/src/dic.js.map +1 -1
- package/dist/development/src/lib/VersionChecker.cjs +7 -9
- package/dist/development/src/lib/VersionChecker.cjs.map +1 -1
- package/dist/development/src/lib/VersionChecker.js +7 -9
- package/dist/development/src/lib/VersionChecker.js.map +1 -1
- package/dist/development/src/lib/actions/ActionsClient.cjs +91 -0
- package/dist/development/src/lib/actions/ActionsClient.cjs.map +1 -0
- package/dist/development/src/lib/actions/ActionsClient.js +91 -0
- package/dist/development/src/lib/actions/ActionsClient.js.map +1 -0
- package/dist/development/src/lib/migrations/MigrationPrinter.cjs +7 -2
- package/dist/development/src/lib/migrations/MigrationPrinter.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationPrinter.js +7 -2
- package/dist/development/src/lib/migrations/MigrationPrinter.js.map +1 -1
- package/dist/development/src/lib/migrations/MigrationsStatusFacade.cjs +3 -3
- package/dist/development/src/lib/migrations/MigrationsStatusFacade.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationsStatusFacade.js +3 -3
- package/dist/development/src/lib/migrations/MigrationsStatusFacade.js.map +1 -1
- package/dist/development/src/lib/stream.cjs +0 -7
- package/dist/development/src/lib/stream.cjs.map +1 -1
- package/dist/development/src/lib/stream.js +1 -8
- package/dist/development/src/lib/stream.js.map +1 -1
- package/dist/development/src/lib/transfer/DataTransferClient.cjs +23 -34
- package/dist/development/src/lib/transfer/DataTransferClient.cjs.map +1 -1
- package/dist/development/src/lib/transfer/DataTransferClient.js +25 -36
- package/dist/development/src/lib/transfer/DataTransferClient.js.map +1 -1
- package/dist/production/src/commands/actions/ActionsGetEventCommand.cjs +31 -0
- package/dist/production/src/commands/actions/ActionsGetEventCommand.cjs.map +1 -0
- package/dist/production/src/commands/actions/ActionsGetEventCommand.js +31 -0
- package/dist/production/src/commands/actions/ActionsGetEventCommand.js.map +1 -0
- package/dist/production/src/commands/actions/ActionsListFailedEventsCommand.cjs +60 -0
- package/dist/production/src/commands/actions/ActionsListFailedEventsCommand.cjs.map +1 -0
- package/dist/production/src/commands/actions/ActionsListFailedEventsCommand.js +60 -0
- package/dist/production/src/commands/actions/ActionsListFailedEventsCommand.js.map +1 -0
- package/dist/production/src/commands/actions/ActionsListVariablesCommand.cjs +29 -0
- package/dist/production/src/commands/actions/ActionsListVariablesCommand.cjs.map +1 -0
- package/dist/production/src/commands/actions/ActionsListVariablesCommand.js +29 -0
- package/dist/production/src/commands/actions/ActionsListVariablesCommand.js.map +1 -0
- package/dist/production/src/commands/actions/ActionsRetryEventCommand.cjs +32 -0
- package/dist/production/src/commands/actions/ActionsRetryEventCommand.cjs.map +1 -0
- package/dist/production/src/commands/actions/ActionsRetryEventCommand.js +32 -0
- package/dist/production/src/commands/actions/ActionsRetryEventCommand.js.map +1 -0
- package/dist/production/src/commands/actions/ActionsSetVariablesCommand.cjs +40 -0
- package/dist/production/src/commands/actions/ActionsSetVariablesCommand.cjs.map +1 -0
- package/dist/production/src/commands/actions/ActionsSetVariablesCommand.js +40 -0
- package/dist/production/src/commands/actions/ActionsSetVariablesCommand.js.map +1 -0
- package/dist/production/src/commands/actions/ActionsStopEventCommand.cjs +32 -0
- package/dist/production/src/commands/actions/ActionsStopEventCommand.cjs.map +1 -0
- package/dist/production/src/commands/actions/ActionsStopEventCommand.js +32 -0
- package/dist/production/src/commands/actions/ActionsStopEventCommand.js.map +1 -0
- package/dist/production/src/commands/migrations/MigrationStatusCommand.cjs +1 -1
- package/dist/production/src/commands/migrations/MigrationStatusCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationStatusCommand.js +1 -1
- package/dist/production/src/commands/migrations/MigrationStatusCommand.js.map +1 -1
- package/dist/production/src/commands/transfer/ExportCommand.cjs +7 -2
- package/dist/production/src/commands/transfer/ExportCommand.cjs.map +1 -1
- package/dist/production/src/commands/transfer/ExportCommand.js +8 -3
- package/dist/production/src/commands/transfer/ExportCommand.js.map +1 -1
- package/dist/production/src/commands/transfer/ImportCommand.cjs +7 -4
- package/dist/production/src/commands/transfer/ImportCommand.cjs.map +1 -1
- package/dist/production/src/commands/transfer/ImportCommand.js +5 -2
- package/dist/production/src/commands/transfer/ImportCommand.js.map +1 -1
- package/dist/production/src/commands/transfer/TransferCommand.cjs +4 -5
- package/dist/production/src/commands/transfer/TransferCommand.cjs.map +1 -1
- package/dist/production/src/commands/transfer/TransferCommand.js +4 -5
- package/dist/production/src/commands/transfer/TransferCommand.js.map +1 -1
- package/dist/production/src/dic.cjs +14 -2
- package/dist/production/src/dic.cjs.map +1 -1
- package/dist/production/src/dic.js +14 -2
- package/dist/production/src/dic.js.map +1 -1
- package/dist/production/src/lib/VersionChecker.cjs +7 -9
- package/dist/production/src/lib/VersionChecker.cjs.map +1 -1
- package/dist/production/src/lib/VersionChecker.js +7 -9
- package/dist/production/src/lib/VersionChecker.js.map +1 -1
- package/dist/production/src/lib/actions/ActionsClient.cjs +91 -0
- package/dist/production/src/lib/actions/ActionsClient.cjs.map +1 -0
- package/dist/production/src/lib/actions/ActionsClient.js +91 -0
- package/dist/production/src/lib/actions/ActionsClient.js.map +1 -0
- package/dist/production/src/lib/migrations/MigrationPrinter.cjs +7 -2
- package/dist/production/src/lib/migrations/MigrationPrinter.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationPrinter.js +7 -2
- package/dist/production/src/lib/migrations/MigrationPrinter.js.map +1 -1
- package/dist/production/src/lib/migrations/MigrationsStatusFacade.cjs +3 -3
- package/dist/production/src/lib/migrations/MigrationsStatusFacade.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationsStatusFacade.js +3 -3
- package/dist/production/src/lib/migrations/MigrationsStatusFacade.js.map +1 -1
- package/dist/production/src/lib/stream.cjs +0 -7
- package/dist/production/src/lib/stream.cjs.map +1 -1
- package/dist/production/src/lib/stream.js +1 -8
- package/dist/production/src/lib/stream.js.map +1 -1
- package/dist/production/src/lib/transfer/DataTransferClient.cjs +23 -34
- package/dist/production/src/lib/transfer/DataTransferClient.cjs.map +1 -1
- package/dist/production/src/lib/transfer/DataTransferClient.js +25 -36
- package/dist/production/src/lib/transfer/DataTransferClient.js.map +1 -1
- package/dist/types/commands/actions/ActionsGetEventCommand.d.ts +16 -0
- package/dist/types/commands/actions/ActionsGetEventCommand.d.ts.map +1 -0
- package/dist/types/commands/actions/ActionsListFailedEventsCommand.d.ts +15 -0
- package/dist/types/commands/actions/ActionsListFailedEventsCommand.d.ts.map +1 -0
- package/dist/types/commands/actions/ActionsListVariablesCommand.d.ts +14 -0
- package/dist/types/commands/actions/ActionsListVariablesCommand.d.ts.map +1 -0
- package/dist/types/commands/actions/ActionsRetryEventCommand.d.ts +16 -0
- package/dist/types/commands/actions/ActionsRetryEventCommand.d.ts.map +1 -0
- package/dist/types/commands/actions/ActionsSetVariablesCommand.d.ts +19 -0
- package/dist/types/commands/actions/ActionsSetVariablesCommand.d.ts.map +1 -0
- package/dist/types/commands/actions/ActionsStopEventCommand.d.ts +16 -0
- package/dist/types/commands/actions/ActionsStopEventCommand.d.ts.map +1 -0
- package/dist/types/commands/transfer/ExportCommand.d.ts.map +1 -1
- package/dist/types/commands/transfer/ImportCommand.d.ts.map +1 -1
- package/dist/types/commands/transfer/TransferCommand.d.ts.map +1 -1
- package/dist/types/dic.d.ts +18 -0
- package/dist/types/dic.d.ts.map +1 -1
- package/dist/types/lib/VersionChecker.d.ts.map +1 -1
- package/dist/types/lib/actions/ActionsClient.d.ts +33 -0
- package/dist/types/lib/actions/ActionsClient.d.ts.map +1 -0
- package/dist/types/lib/migrations/MigrationPrinter.d.ts +1 -1
- package/dist/types/lib/migrations/MigrationPrinter.d.ts.map +1 -1
- package/dist/types/lib/migrations/MigrationsStatusFacade.d.ts +3 -1
- package/dist/types/lib/migrations/MigrationsStatusFacade.d.ts.map +1 -1
- package/dist/types/lib/transfer/DataTransferClient.d.ts +2 -4
- package/dist/types/lib/transfer/DataTransferClient.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/commands/actions/ActionsGetEventCommand.ts +42 -0
- package/src/commands/actions/ActionsListFailedEventsCommand.ts +70 -0
- package/src/commands/actions/ActionsListVariablesCommand.ts +37 -0
- package/src/commands/actions/ActionsRetryEventCommand.ts +42 -0
- package/src/commands/actions/ActionsSetVariablesCommand.ts +56 -0
- package/src/commands/actions/ActionsStopEventCommand.ts +42 -0
- package/src/commands/migrations/MigrationStatusCommand.ts +1 -1
- package/src/commands/transfer/ExportCommand.ts +9 -4
- package/src/commands/transfer/ImportCommand.ts +6 -1
- package/src/commands/transfer/TransferCommand.ts +4 -3
- package/src/dic.ts +27 -2
- package/src/lib/VersionChecker.ts +13 -9
- package/src/lib/actions/ActionsClient.ts +112 -0
- package/src/lib/migrations/MigrationPrinter.ts +7 -2
- package/src/lib/migrations/MigrationsStatusFacade.ts +4 -3
- package/src/lib/transfer/DataTransferClient.ts +24 -43
- package/dist/development/src/lib/migrations/migrations.cjs +0 -43
- package/dist/development/src/lib/migrations/migrations.cjs.map +0 -1
- package/dist/development/src/lib/migrations/migrations.js +0 -43
- package/dist/development/src/lib/migrations/migrations.js.map +0 -1
- package/dist/production/src/lib/migrations/migrations.cjs +0 -43
- package/dist/production/src/lib/migrations/migrations.cjs.map +0 -1
- package/dist/production/src/lib/migrations/migrations.js +0 -43
- package/dist/production/src/lib/migrations/migrations.js.map +0 -1
- package/dist/types/lib/migrations/migrations.d.ts +0 -3
- package/dist/types/lib/migrations/migrations.d.ts.map +0 -1
- package/src/lib/migrations/migrations.ts +0 -45
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VersionChecker.js","sources":["../../../../../packages/cli/src/lib/VersionChecker.ts"],"sourcesContent":["import { join, relative } from 'node:path'\nimport * as semver from 'semver'\nimport { PackageWorkspaceResolver } from '@contember/cli-common'\nimport { DockerComposeManager } from './fs/DockerComposeManager'\nimport { contemberDockerImages } from '../consts'\n\nexport class VersionChecker {\n\tconstructor(\n\t\tprivate readonly version: string,\n\t\tprivate readonly dir: string,\n\t\tprivate readonly packageWorkspaceResolver: PackageWorkspaceResolver,\n\t\tprivate readonly dockerComposeManager: DockerComposeManager,\n\t) {\n\t}\n\n\tcheckVersions = async () => {\n\t\tconst cliVersion = this.version\n\t\tconst packageWorkspace = await this.packageWorkspaceResolver.resolve()\n\n\t\tconst errors: string[] = []\n\n\t\tfor (const packageName of ['@contember/schema', '@contember/schema-definition']) {\n\t\t\tconst installedPackages = await packageWorkspace.findInstalledDependencies(packageName)\n\t\t\tfor (const pckg of installedPackages) {\n\t\t\t\tconst jsonPath = relative(this.dir, join(pckg.defined.pckg.dir, 'package.json'))\n\n\t\t\t\tif (!pckg.installed) {\n\t\t\t\t\terrors.push(`Package ${packageName} defined in ${jsonPath} is not installed.`)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (pckg.defined.version !== 'workspace:*' && !semver.satisfies(pckg.installed.version, pckg.defined.version)) {\n\t\t\t\t\terrors.push(`Package ${packageName}@${pckg.installed.version} does not match constraint ${pckg.defined.version} defined in ${jsonPath}.`)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (cliVersion !== pckg.installed.version) {\n\t\t\t\t\terrors.push(`Package ${packageName}@${pckg.installed.version} does not match version of CLI ${cliVersion}.`)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst dockerCompose = await this.dockerComposeManager.tryReadMainDockerComposeConfig()\n\n\t\tif (!dockerCompose) {\n\t\t\terrors.push('docker-compose.yaml not found.')\n\t\t} else {\n\t\t\tfor (const [name, def] of Object.entries(dockerCompose.services ?? {})) {\n\t\t\t\tif (!def.image) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst [image,
|
|
1
|
+
{"version":3,"file":"VersionChecker.js","sources":["../../../../../packages/cli/src/lib/VersionChecker.ts"],"sourcesContent":["import { join, relative } from 'node:path'\nimport * as semver from 'semver'\nimport { PackageWorkspaceResolver } from '@contember/cli-common'\nimport { DockerComposeManager } from './fs/DockerComposeManager'\nimport { contemberDockerImages } from '../consts'\n\nexport class VersionChecker {\n\tconstructor(\n\t\tprivate readonly version: string,\n\t\tprivate readonly dir: string,\n\t\tprivate readonly packageWorkspaceResolver: PackageWorkspaceResolver,\n\t\tprivate readonly dockerComposeManager: DockerComposeManager,\n\t) {\n\t}\n\n\tcheckVersions = async () => {\n\t\tconst cliVersion = this.version\n\t\tconst packageWorkspace = await this.packageWorkspaceResolver.resolve()\n\n\t\tconst errors: string[] = []\n\n\t\tfor (const packageName of ['@contember/schema', '@contember/schema-definition']) {\n\t\t\tconst installedPackages = await packageWorkspace.findInstalledDependencies(packageName)\n\t\t\tfor (const pckg of installedPackages) {\n\t\t\t\tconst jsonPath = relative(this.dir, join(pckg.defined.pckg.dir, 'package.json'))\n\n\t\t\t\tif (!pckg.installed) {\n\t\t\t\t\terrors.push(`Package ${packageName} defined in ${jsonPath} is not installed.`)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (pckg.defined.version !== 'workspace:*' && !semver.satisfies(pckg.installed.version, pckg.defined.version)) {\n\t\t\t\t\terrors.push(`Package ${packageName}@${pckg.installed.version} does not match constraint ${pckg.defined.version} defined in ${jsonPath}.`)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (cliVersion !== pckg.installed.version) {\n\t\t\t\t\terrors.push(`Package ${packageName}@${pckg.installed.version} does not match version of CLI ${cliVersion}.`)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst dockerCompose = await this.dockerComposeManager.tryReadMainDockerComposeConfig()\n\n\t\tif (!dockerCompose) {\n\t\t\terrors.push('docker-compose.yaml not found.')\n\t\t} else {\n\t\t\tfor (const [name, def] of Object.entries(dockerCompose.services ?? {})) {\n\t\t\t\tif (!def.image) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst [image, tag] = def.image.split(':')\n\t\t\t\tif (!tag || !contemberDockerImages.includes(image)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (extractVersion(tag) !== cliVersion) {\n\t\t\t\t\terrors.push(`Docker service ${name} with image ${image}:${tag} does not match version of CLI ${cliVersion}.`)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (errors.length) {\n\t\t\tthrow `${errors.map(it => `${it}`).join('\\n')}\n\nPlease make sure all dependencies are up to date.\\nIf you are really certain about the compatibility, you can disable this version check by running the CLI with the CONTEMBER_SKIP_VERSION_CHECK=1 environment variable`\n\t\t}\n\t}\n\n}\n\n\nconst extractVersion = (tag: string) => {\n\t// e.g.\n\t// 2.1.0-alpha.15-foo-bar => 2.1.0-alpha.15\n\t// 2.1.0-debian => 2.1.0\n\treturn tag.match(/^\\d+\\.\\d+\\.\\d+(-\\w+\\.\\d+)?/)?.[0] ?? tag\n}\n"],"names":[],"mappings":";;;;;;AAMO,MAAM,eAAe;A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AACxC,cAAI,CAAC,OAAO,CAAC,sBAAsB,SAAS,KAAK,GAAG;AACnD;AAAA,UAAA;AAGG,cAAA,eAAe,GAAG,MAAM,YAAY;AAChC,mBAAA,KAAK,kBAAkB,IAAI,eAAe,KAAK,IAAI,GAAG,kCAAkC,UAAU,GAAG;AAAA,UAAA;AAAA,QAC7G;AAAA,MACD;AAGD,UAAI,OAAO,QAAQ;AACZ,cAAA,GAAG,OAAO,IAAI,CAAM,OAAA,GAAG,EAAE,EAAE,EAAE,KAAK,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA,MAAA;AAAA,IAG9C,CACD;AAAA,EAAA;AAED;AAGA,MAAM,iBAAiB,CAAC,QAAgB;AAIvC,SAAO,IAAI,MAAM,4BAA4B,IAAI,CAAC,KAAK;AACxD;"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const graphqlClient = require("@contember/graphql-client");
|
|
4
|
+
const createActionsApiUrl = (url, project) => {
|
|
5
|
+
if (url.endsWith("/")) {
|
|
6
|
+
url = url.substring(0, url.length - 1);
|
|
7
|
+
}
|
|
8
|
+
return url + "/actions/" + project;
|
|
9
|
+
};
|
|
10
|
+
class ActionsClient {
|
|
11
|
+
constructor(apiClient) {
|
|
12
|
+
this.apiClient = apiClient;
|
|
13
|
+
}
|
|
14
|
+
static create(url, project, apiToken) {
|
|
15
|
+
const graphqlClient$1 = new graphqlClient.GraphQlClient({ url: createActionsApiUrl(url, project), apiToken });
|
|
16
|
+
return new ActionsClient(graphqlClient$1);
|
|
17
|
+
}
|
|
18
|
+
async listVariables() {
|
|
19
|
+
const query = `query {
|
|
20
|
+
variables {
|
|
21
|
+
name
|
|
22
|
+
value
|
|
23
|
+
}
|
|
24
|
+
}`;
|
|
25
|
+
const result = await this.apiClient.execute(query);
|
|
26
|
+
return result.variables;
|
|
27
|
+
}
|
|
28
|
+
async setVariables(variables, mode) {
|
|
29
|
+
const query = `mutation($variables: [VariableInput!]!, $mode: SetVariablesMode) {
|
|
30
|
+
setVariables(args: { variables: $variables, mode: $mode }) {
|
|
31
|
+
ok
|
|
32
|
+
}
|
|
33
|
+
}`;
|
|
34
|
+
const result = await this.apiClient.execute(query, { variables: { mode, variables } });
|
|
35
|
+
return result.setVariables.ok;
|
|
36
|
+
}
|
|
37
|
+
async listFailedEvents({ offset, limit } = {}) {
|
|
38
|
+
const query = `query($offset: Int, $limit: Int) {
|
|
39
|
+
failedEvents(args: { offset: $offset, limit: $limit }) {
|
|
40
|
+
id
|
|
41
|
+
createdAt
|
|
42
|
+
lastStateChange
|
|
43
|
+
visibleAt
|
|
44
|
+
numRetries
|
|
45
|
+
state
|
|
46
|
+
target
|
|
47
|
+
payload
|
|
48
|
+
log
|
|
49
|
+
}
|
|
50
|
+
}`;
|
|
51
|
+
const result = await this.apiClient.execute(query, { variables: { offset, limit } });
|
|
52
|
+
return result.failedEvents;
|
|
53
|
+
}
|
|
54
|
+
async retryEvent(id) {
|
|
55
|
+
const query = `mutation($id: UUID!) {
|
|
56
|
+
retryEvent(id: $id) {
|
|
57
|
+
ok
|
|
58
|
+
}
|
|
59
|
+
}`;
|
|
60
|
+
const result = await this.apiClient.execute(query, { variables: { id } });
|
|
61
|
+
return result.retryEvent.ok;
|
|
62
|
+
}
|
|
63
|
+
async stopEvent(id) {
|
|
64
|
+
const query = `mutation($id: UUID!) {
|
|
65
|
+
stopEvent(id: $id) {
|
|
66
|
+
ok
|
|
67
|
+
}
|
|
68
|
+
}`;
|
|
69
|
+
const result = await this.apiClient.execute(query, { variables: { id } });
|
|
70
|
+
return result.stopEvent.ok;
|
|
71
|
+
}
|
|
72
|
+
async getEvent(id) {
|
|
73
|
+
const query = `query($id: UUID!) {
|
|
74
|
+
event(id: $id) {
|
|
75
|
+
id
|
|
76
|
+
createdAt
|
|
77
|
+
lastStateChange
|
|
78
|
+
visibleAt
|
|
79
|
+
numRetries
|
|
80
|
+
state
|
|
81
|
+
target
|
|
82
|
+
payload
|
|
83
|
+
log
|
|
84
|
+
}
|
|
85
|
+
}`;
|
|
86
|
+
const result = await this.apiClient.execute(query, { variables: { id } });
|
|
87
|
+
return result.event;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.ActionsClient = ActionsClient;
|
|
91
|
+
//# sourceMappingURL=ActionsClient.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionsClient.cjs","sources":["../../../../../../packages/cli/src/lib/actions/ActionsClient.ts"],"sourcesContent":["import { GraphQlClient } from '@contember/graphql-client'\n\nconst createActionsApiUrl = (url: string, project: string) => {\n\tif (url.endsWith('/')) {\n\t\turl = url.substring(0, url.length - 1)\n\t}\n\n\treturn url + '/actions/' + project\n}\nexport class ActionsClient {\n\tconstructor(private readonly apiClient: GraphQlClient) {\n\t}\n\n\tpublic static create(url: string, project: string, apiToken: string): ActionsClient {\n\t\tconst graphqlClient = new GraphQlClient({ url: createActionsApiUrl(url, project), apiToken })\n\t\treturn new ActionsClient(graphqlClient)\n\t}\n\n\tpublic async listVariables(): Promise<{ name: string; value: string }[]> {\n\t\tconst query = `query {\n variables {\n \tname\n \tvalue\n }\n}`\n\t\tconst result = await this.apiClient.execute<{\n\t\t\tvariables: Array<{ name: string; value: string }>\n\t\t}>(query)\n\t\treturn result.variables\n\t}\n\n\tpublic async setVariables(variables: { name: string; value: string }[], mode: 'MERGE' | 'SET' | 'APPEND_ONLY_MISSING'): Promise<boolean> {\n\t\tconst query = `mutation($variables: [VariableInput!]!, $mode: SetVariablesMode) {\n setVariables(args: { variables: $variables, mode: $mode }) {\n\tok\n }\n }`\n\t\tconst result = await this.apiClient.execute<{ setVariables: { ok: boolean } }>(query, { variables: { mode, variables } })\n\t\treturn result.setVariables.ok\n\t}\n\n\tpublic async listFailedEvents({ offset, limit }: { offset?: number; limit?: number } = {}): Promise<Event[]> {\n\t\tconst query = `query($offset: Int, $limit: Int) {\n failedEvents(args: { offset: $offset, limit: $limit }) {\n \tid\n \tcreatedAt\n \tlastStateChange\n \tvisibleAt\n \tnumRetries\n \tstate\n \ttarget\n \tpayload\n \tlog\n }\n}`\n\t\tconst result = await this.apiClient.execute<{\n\t\t\tfailedEvents: Event[]\n\t\t}>(query, { variables: { offset, limit } })\n\t\treturn result.failedEvents\n\t}\n\n\tpublic async retryEvent(id: string): Promise<boolean> {\n\t\tconst query = `mutation($id: UUID!) {\n retryEvent(id: $id) {\n \tok\n }\n}`\n\t\tconst result = await this.apiClient.execute<{ retryEvent: { ok: boolean } }>(query, { variables: { id } })\n\t\treturn result.retryEvent.ok\n\t}\n\n\tpublic async stopEvent(id: string): Promise<boolean> {\n\t\tconst query = `mutation($id: UUID!) {\n stopEvent(id: $id) {\n \tok\n }\n}`\n\t\tconst result = await this.apiClient.execute<{ stopEvent: { ok: boolean } }>(query, { variables: { id } })\n\t\treturn result.stopEvent.ok\n\t}\n\n\n\tpublic async getEvent(id: string): Promise<Event | null> {\n\t\tconst query = `query($id: UUID!) {\n event(id: $id) {\n \tid\n \tcreatedAt\n \tlastStateChange\n \tvisibleAt\n \tnumRetries\n \tstate\n \ttarget\n \tpayload\n \tlog\n }\n}`\n\t\tconst result = await this.apiClient.execute<{ event: Event | null }>(query, { variables: { id } })\n\t\treturn result.event\n\t}\n}\n\nexport type Event = {\n\tid: string\n\tcreatedAt: string\n\tlastStateChange: string\n\tvisibleAt: string | null\n\tnumRetries: number\n\tstate: 'retrying' | 'failed'\n\ttarget: string\n\tpayload: any\n\tlog: any\n}\n"],"names":["graphqlClient","GraphQlClient"],"mappings":";;;AAEA,MAAM,sBAAsB,CAAC,KAAa,YAAoB;AACzD,MAAA,IAAI,SAAS,GAAG,GAAG;AACtB,UAAM,IAAI,UAAU,GAAG,IAAI,SAAS,CAAC;AAAA,EAAA;AAGtC,SAAO,MAAM,cAAc;AAC5B;AACO,MAAM,cAAc;AAAA,EAC1B,YAA6B,WAA0B;AAA1B,SAAA,YAA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MAAa,SAAS,IAAmC;AACxD,UAAM,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaR,UAAA,SAAS,MAAM,KAAK,UAAU,QAAiC,OAAO,EAAE,WAAW,EAAE,GAAG,GAAG;AACjG,WAAO,OAAO;AAAA,EAAA;AAEhB;;"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { GraphQlClient } from "@contember/graphql-client";
|
|
2
|
+
const createActionsApiUrl = (url, project) => {
|
|
3
|
+
if (url.endsWith("/")) {
|
|
4
|
+
url = url.substring(0, url.length - 1);
|
|
5
|
+
}
|
|
6
|
+
return url + "/actions/" + project;
|
|
7
|
+
};
|
|
8
|
+
class ActionsClient {
|
|
9
|
+
constructor(apiClient) {
|
|
10
|
+
this.apiClient = apiClient;
|
|
11
|
+
}
|
|
12
|
+
static create(url, project, apiToken) {
|
|
13
|
+
const graphqlClient = new GraphQlClient({ url: createActionsApiUrl(url, project), apiToken });
|
|
14
|
+
return new ActionsClient(graphqlClient);
|
|
15
|
+
}
|
|
16
|
+
async listVariables() {
|
|
17
|
+
const query = `query {
|
|
18
|
+
variables {
|
|
19
|
+
name
|
|
20
|
+
value
|
|
21
|
+
}
|
|
22
|
+
}`;
|
|
23
|
+
const result = await this.apiClient.execute(query);
|
|
24
|
+
return result.variables;
|
|
25
|
+
}
|
|
26
|
+
async setVariables(variables, mode) {
|
|
27
|
+
const query = `mutation($variables: [VariableInput!]!, $mode: SetVariablesMode) {
|
|
28
|
+
setVariables(args: { variables: $variables, mode: $mode }) {
|
|
29
|
+
ok
|
|
30
|
+
}
|
|
31
|
+
}`;
|
|
32
|
+
const result = await this.apiClient.execute(query, { variables: { mode, variables } });
|
|
33
|
+
return result.setVariables.ok;
|
|
34
|
+
}
|
|
35
|
+
async listFailedEvents({ offset, limit } = {}) {
|
|
36
|
+
const query = `query($offset: Int, $limit: Int) {
|
|
37
|
+
failedEvents(args: { offset: $offset, limit: $limit }) {
|
|
38
|
+
id
|
|
39
|
+
createdAt
|
|
40
|
+
lastStateChange
|
|
41
|
+
visibleAt
|
|
42
|
+
numRetries
|
|
43
|
+
state
|
|
44
|
+
target
|
|
45
|
+
payload
|
|
46
|
+
log
|
|
47
|
+
}
|
|
48
|
+
}`;
|
|
49
|
+
const result = await this.apiClient.execute(query, { variables: { offset, limit } });
|
|
50
|
+
return result.failedEvents;
|
|
51
|
+
}
|
|
52
|
+
async retryEvent(id) {
|
|
53
|
+
const query = `mutation($id: UUID!) {
|
|
54
|
+
retryEvent(id: $id) {
|
|
55
|
+
ok
|
|
56
|
+
}
|
|
57
|
+
}`;
|
|
58
|
+
const result = await this.apiClient.execute(query, { variables: { id } });
|
|
59
|
+
return result.retryEvent.ok;
|
|
60
|
+
}
|
|
61
|
+
async stopEvent(id) {
|
|
62
|
+
const query = `mutation($id: UUID!) {
|
|
63
|
+
stopEvent(id: $id) {
|
|
64
|
+
ok
|
|
65
|
+
}
|
|
66
|
+
}`;
|
|
67
|
+
const result = await this.apiClient.execute(query, { variables: { id } });
|
|
68
|
+
return result.stopEvent.ok;
|
|
69
|
+
}
|
|
70
|
+
async getEvent(id) {
|
|
71
|
+
const query = `query($id: UUID!) {
|
|
72
|
+
event(id: $id) {
|
|
73
|
+
id
|
|
74
|
+
createdAt
|
|
75
|
+
lastStateChange
|
|
76
|
+
visibleAt
|
|
77
|
+
numRetries
|
|
78
|
+
state
|
|
79
|
+
target
|
|
80
|
+
payload
|
|
81
|
+
log
|
|
82
|
+
}
|
|
83
|
+
}`;
|
|
84
|
+
const result = await this.apiClient.execute(query, { variables: { id } });
|
|
85
|
+
return result.event;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
ActionsClient
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=ActionsClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionsClient.js","sources":["../../../../../../packages/cli/src/lib/actions/ActionsClient.ts"],"sourcesContent":["import { GraphQlClient } from '@contember/graphql-client'\n\nconst createActionsApiUrl = (url: string, project: string) => {\n\tif (url.endsWith('/')) {\n\t\turl = url.substring(0, url.length - 1)\n\t}\n\n\treturn url + '/actions/' + project\n}\nexport class ActionsClient {\n\tconstructor(private readonly apiClient: GraphQlClient) {\n\t}\n\n\tpublic static create(url: string, project: string, apiToken: string): ActionsClient {\n\t\tconst graphqlClient = new GraphQlClient({ url: createActionsApiUrl(url, project), apiToken })\n\t\treturn new ActionsClient(graphqlClient)\n\t}\n\n\tpublic async listVariables(): Promise<{ name: string; value: string }[]> {\n\t\tconst query = `query {\n variables {\n \tname\n \tvalue\n }\n}`\n\t\tconst result = await this.apiClient.execute<{\n\t\t\tvariables: Array<{ name: string; value: string }>\n\t\t}>(query)\n\t\treturn result.variables\n\t}\n\n\tpublic async setVariables(variables: { name: string; value: string }[], mode: 'MERGE' | 'SET' | 'APPEND_ONLY_MISSING'): Promise<boolean> {\n\t\tconst query = `mutation($variables: [VariableInput!]!, $mode: SetVariablesMode) {\n setVariables(args: { variables: $variables, mode: $mode }) {\n\tok\n }\n }`\n\t\tconst result = await this.apiClient.execute<{ setVariables: { ok: boolean } }>(query, { variables: { mode, variables } })\n\t\treturn result.setVariables.ok\n\t}\n\n\tpublic async listFailedEvents({ offset, limit }: { offset?: number; limit?: number } = {}): Promise<Event[]> {\n\t\tconst query = `query($offset: Int, $limit: Int) {\n failedEvents(args: { offset: $offset, limit: $limit }) {\n \tid\n \tcreatedAt\n \tlastStateChange\n \tvisibleAt\n \tnumRetries\n \tstate\n \ttarget\n \tpayload\n \tlog\n }\n}`\n\t\tconst result = await this.apiClient.execute<{\n\t\t\tfailedEvents: Event[]\n\t\t}>(query, { variables: { offset, limit } })\n\t\treturn result.failedEvents\n\t}\n\n\tpublic async retryEvent(id: string): Promise<boolean> {\n\t\tconst query = `mutation($id: UUID!) {\n retryEvent(id: $id) {\n \tok\n }\n}`\n\t\tconst result = await this.apiClient.execute<{ retryEvent: { ok: boolean } }>(query, { variables: { id } })\n\t\treturn result.retryEvent.ok\n\t}\n\n\tpublic async stopEvent(id: string): Promise<boolean> {\n\t\tconst query = `mutation($id: UUID!) {\n stopEvent(id: $id) {\n \tok\n }\n}`\n\t\tconst result = await this.apiClient.execute<{ stopEvent: { ok: boolean } }>(query, { variables: { id } })\n\t\treturn result.stopEvent.ok\n\t}\n\n\n\tpublic async getEvent(id: string): Promise<Event | null> {\n\t\tconst query = `query($id: UUID!) {\n event(id: $id) {\n \tid\n \tcreatedAt\n \tlastStateChange\n \tvisibleAt\n \tnumRetries\n \tstate\n \ttarget\n \tpayload\n \tlog\n }\n}`\n\t\tconst result = await this.apiClient.execute<{ event: Event | null }>(query, { variables: { id } })\n\t\treturn result.event\n\t}\n}\n\nexport type Event = {\n\tid: string\n\tcreatedAt: string\n\tlastStateChange: string\n\tvisibleAt: string | null\n\tnumRetries: number\n\tstate: 'retrying' | 'failed'\n\ttarget: string\n\tpayload: any\n\tlog: any\n}\n"],"names":[],"mappings":";AAEA,MAAM,sBAAsB,CAAC,KAAa,YAAoB;AACzD,MAAA,IAAI,SAAS,GAAG,GAAG;AACtB,UAAM,IAAI,UAAU,GAAG,IAAI,SAAS,CAAC;AAAA,EAAA;AAGtC,SAAO,MAAM,cAAc;AAC5B;AACO,MAAM,cAAc;AAAA,EAC1B,YAA6B,WAA0B;AAA1B,SAAA,YAAA;AAAA,EAAA;AAAA,EAG7B,OAAc,OAAO,KAAa,SAAiB,UAAiC;AAC7E,UAAA,gBAAgB,IAAI,cAAc,EAAE,KAAK,oBAAoB,KAAK,OAAO,GAAG,UAAU;AACrF,WAAA,IAAI,cAAc,aAAa;AAAA,EAAA;AAAA,EAGvC,MAAa,gBAA4D;AACxE,UAAM,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAMd,UAAM,SAAS,MAAM,KAAK,UAAU,QAEjC,KAAK;AACR,WAAO,OAAO;AAAA,EAAA;AAAA,EAGf,MAAa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
return chalkTable(
|
|
45
45
|
{
|
|
46
46
|
columns: ["status", "migration", "info"]
|
|
47
47
|
},
|
|
@@ -69,12 +69,17 @@ class MigrationPrinter {
|
|
|
69
69
|
};
|
|
70
70
|
case migrationsClient.MigrationState.TO_EXECUTE_ERROR:
|
|
71
71
|
return { status: chalk.bgRedBright.white("ERROR"), migration: it.name, info: it.errorMessage };
|
|
72
|
+
case migrationsClient.MigrationState.SKIP_EMPTY:
|
|
73
|
+
return {
|
|
74
|
+
status: chalk.bgYellow.white("Skip"),
|
|
75
|
+
migration: it.name,
|
|
76
|
+
info: `Skipped because empty`
|
|
77
|
+
};
|
|
72
78
|
default:
|
|
73
79
|
assertNever.assertNever();
|
|
74
80
|
}
|
|
75
81
|
})
|
|
76
82
|
);
|
|
77
|
-
console.log(table);
|
|
78
83
|
});
|
|
79
84
|
}
|
|
80
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationPrinter.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationPrinter.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"../../../types/chalk-table/index.d.ts\" />\n\nimport { Schema } from '@contember/schema'\nimport chalk from 'chalk'\nimport { AnyMigrationStatus, Migration, MigrationDescriber, MigrationState } from '@contember/migrations-client'\nimport { emptyDatabaseMetadata } from '@contember/database'\nimport chalkTable from 'chalk-table'\nimport { assertNever } from '../assertNever'\n\nexport class MigrationPrinter {\n\tconstructor(\n\t\tprivate readonly migrationsDescriber: MigrationDescriber,\n\t) {\n\t}\n\n\tprintMigrationDescription = (\n\t\tschema: Schema,\n\t\tmigration: Migration,\n\t\toptions: { sqlOnly?: boolean; noSql?: boolean },\n\t) => {\n\t\tconst description = this.migrationsDescriber.describeModifications(schema, migration)\n\t\tdescription.forEach(({ modification, getSql, description }) => {\n\t\t\tconst sql = getSql({\n\t\t\t\tsystemSchema: 'system',\n\t\t\t\tdatabaseMetadata: emptyDatabaseMetadata,\n\t\t\t\tinvalidateDatabaseMetadata: () => null,\n\t\t\t})\n\t\t\tif (options.sqlOnly) {\n\t\t\t\tif (sql.trim()) {\n\t\t\t\t\tconsole.log(sql)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst color = description.isDestructive ? chalk.red : chalk.blue\n\t\t\t\tconsole.group(color(`${description.message} [${modification.modification}]`))\n\t\t\t\tif (description.failureWarning) {\n\t\t\t\t\tconsole.log(chalk.bgWhite(chalk.redBright(description.failureWarning)))\n\t\t\t\t}\n\n\t\t\t\tif (!options.noSql) {\n\t\t\t\t\tif (sql.trim()) {\n\t\t\t\t\t\tconsole.log(sql)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log('No sql to execute')\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.groupEnd()\n\t\t\t}\n\t\t})\n\t}\n\n\tprintStatusTable = (migrations: AnyMigrationStatus[]) => {\n\t\
|
|
1
|
+
{"version":3,"file":"MigrationPrinter.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationPrinter.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"../../../types/chalk-table/index.d.ts\" />\n\nimport { Schema } from '@contember/schema'\nimport chalk from 'chalk'\nimport { AnyMigrationStatus, Migration, MigrationDescriber, MigrationState } from '@contember/migrations-client'\nimport { emptyDatabaseMetadata } from '@contember/database'\nimport chalkTable from 'chalk-table'\nimport { assertNever } from '../assertNever'\n\nexport class MigrationPrinter {\n\tconstructor(\n\t\tprivate readonly migrationsDescriber: MigrationDescriber,\n\t) {\n\t}\n\n\tprintMigrationDescription = (\n\t\tschema: Schema,\n\t\tmigration: Migration,\n\t\toptions: { sqlOnly?: boolean; noSql?: boolean },\n\t) => {\n\t\tconst description = this.migrationsDescriber.describeModifications(schema, migration)\n\t\tdescription.forEach(({ modification, getSql, description }) => {\n\t\t\tconst sql = getSql({\n\t\t\t\tsystemSchema: 'system',\n\t\t\t\tdatabaseMetadata: emptyDatabaseMetadata,\n\t\t\t\tinvalidateDatabaseMetadata: () => null,\n\t\t\t})\n\t\t\tif (options.sqlOnly) {\n\t\t\t\tif (sql.trim()) {\n\t\t\t\t\tconsole.log(sql)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst color = description.isDestructive ? chalk.red : chalk.blue\n\t\t\t\tconsole.group(color(`${description.message} [${modification.modification}]`))\n\t\t\t\tif (description.failureWarning) {\n\t\t\t\t\tconsole.log(chalk.bgWhite(chalk.redBright(description.failureWarning)))\n\t\t\t\t}\n\n\t\t\t\tif (!options.noSql) {\n\t\t\t\t\tif (sql.trim()) {\n\t\t\t\t\t\tconsole.log(sql)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log('No sql to execute')\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.groupEnd()\n\t\t\t}\n\t\t})\n\t}\n\n\tprintStatusTable = (migrations: AnyMigrationStatus[]) => {\n\t\treturn chalkTable(\n\t\t\t{\n\t\t\t\tcolumns: ['status', 'migration', 'info'],\n\t\t\t},\n\t\t\tmigrations.map(it => {\n\t\t\t\tswitch (it.state) {\n\t\t\t\t\tcase MigrationState.EXECUTED_ERROR:\n\t\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\t\tcase MigrationState.EXECUTED_OK:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgGreen.blackBright('Executed'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: `Executed at ${it.executedMigration.executedAt.toISOString()}`,\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.EXECUTED_MISSING:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgRedBright.white('ERROR'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: it.errorMessage,\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.TO_EXECUTE_OK:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgBlueBright.white('Not executed'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: 'Will be executed during next deploy',\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.TO_EXECUTE_ERROR:\n\t\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\t\tcase MigrationState.SKIP_EMPTY:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgYellow.white('Skip'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: `Skipped because empty`,\n\t\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(it)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\t}\n\n}\n"],"names":["description","emptyDatabaseMetadata","MigrationState","assertNever"],"mappings":";;;;;;;;;;AAUO,MAAM,iBAAiB;AAAA,EAC7B,YACkB,qBAChB;AADgB,SAAA,sBAAA;AAIU,kBAAA,MAAA,6BAAA,CAC3B,QACA,WACA,YACI;AACJ,YAAM,cAAc,KAAK,oBAAoB,sBAAsB,QAAQ,SAAS;AACpF,kBAAY,QAAQ,CAAC,EAAE,cAAc,QAAQ,aAAAA,mBAAkB;AAC9D,cAAM,MAAM,OAAO;AAAA,UAClB,cAAc;AAAA,UACd,kBAAkBC,SAAA;AAAA,UAClB,4BAA4B,MAAM;AAAA,QAAA,CAClC;AACD,YAAI,QAAQ,SAAS;AAChB,cAAA,IAAI,QAAQ;AACf,oBAAQ,IAAI,GAAG;AAAA,UAAA;AAAA,QAChB,OACM;AACN,gBAAM,QAAQD,aAAY,gBAAgB,MAAM,MAAM,MAAM;AACpD,kBAAA,MAAM,MAAM,GAAGA,aAAY,OAAO,KAAK,aAAa,YAAY,GAAG,CAAC;AAC5E,cAAIA,aAAY,gBAAgB;A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Z,qBAAA;AAAA,gBACN,QAAQ,MAAM,SAAS,MAAM,MAAM;AAAA,gBACnC,WAAW,GAAG;AAAA,gBACd,MAAM;AAAA,cACP;AAAA,YACD;AACCC,0BAAAA,YAAc;AAAA,UAAA;AAAA,QAEhB,CAAA;AAAA,MACF;AAAA,IAAA,CACD;AAAA,EAAA;AAED;;"}
|
|
@@ -39,7 +39,7 @@ class MigrationPrinter {
|
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
41
|
__publicField(this, "printStatusTable", (migrations) => {
|
|
42
|
-
|
|
42
|
+
return chalkTable(
|
|
43
43
|
{
|
|
44
44
|
columns: ["status", "migration", "info"]
|
|
45
45
|
},
|
|
@@ -67,12 +67,17 @@ class MigrationPrinter {
|
|
|
67
67
|
};
|
|
68
68
|
case MigrationState.TO_EXECUTE_ERROR:
|
|
69
69
|
return { status: chalk.bgRedBright.white("ERROR"), migration: it.name, info: it.errorMessage };
|
|
70
|
+
case MigrationState.SKIP_EMPTY:
|
|
71
|
+
return {
|
|
72
|
+
status: chalk.bgYellow.white("Skip"),
|
|
73
|
+
migration: it.name,
|
|
74
|
+
info: `Skipped because empty`
|
|
75
|
+
};
|
|
70
76
|
default:
|
|
71
77
|
assertNever();
|
|
72
78
|
}
|
|
73
79
|
})
|
|
74
80
|
);
|
|
75
|
-
console.log(table);
|
|
76
81
|
});
|
|
77
82
|
}
|
|
78
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationPrinter.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationPrinter.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"../../../types/chalk-table/index.d.ts\" />\n\nimport { Schema } from '@contember/schema'\nimport chalk from 'chalk'\nimport { AnyMigrationStatus, Migration, MigrationDescriber, MigrationState } from '@contember/migrations-client'\nimport { emptyDatabaseMetadata } from '@contember/database'\nimport chalkTable from 'chalk-table'\nimport { assertNever } from '../assertNever'\n\nexport class MigrationPrinter {\n\tconstructor(\n\t\tprivate readonly migrationsDescriber: MigrationDescriber,\n\t) {\n\t}\n\n\tprintMigrationDescription = (\n\t\tschema: Schema,\n\t\tmigration: Migration,\n\t\toptions: { sqlOnly?: boolean; noSql?: boolean },\n\t) => {\n\t\tconst description = this.migrationsDescriber.describeModifications(schema, migration)\n\t\tdescription.forEach(({ modification, getSql, description }) => {\n\t\t\tconst sql = getSql({\n\t\t\t\tsystemSchema: 'system',\n\t\t\t\tdatabaseMetadata: emptyDatabaseMetadata,\n\t\t\t\tinvalidateDatabaseMetadata: () => null,\n\t\t\t})\n\t\t\tif (options.sqlOnly) {\n\t\t\t\tif (sql.trim()) {\n\t\t\t\t\tconsole.log(sql)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst color = description.isDestructive ? chalk.red : chalk.blue\n\t\t\t\tconsole.group(color(`${description.message} [${modification.modification}]`))\n\t\t\t\tif (description.failureWarning) {\n\t\t\t\t\tconsole.log(chalk.bgWhite(chalk.redBright(description.failureWarning)))\n\t\t\t\t}\n\n\t\t\t\tif (!options.noSql) {\n\t\t\t\t\tif (sql.trim()) {\n\t\t\t\t\t\tconsole.log(sql)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log('No sql to execute')\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.groupEnd()\n\t\t\t}\n\t\t})\n\t}\n\n\tprintStatusTable = (migrations: AnyMigrationStatus[]) => {\n\t\
|
|
1
|
+
{"version":3,"file":"MigrationPrinter.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationPrinter.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"../../../types/chalk-table/index.d.ts\" />\n\nimport { Schema } from '@contember/schema'\nimport chalk from 'chalk'\nimport { AnyMigrationStatus, Migration, MigrationDescriber, MigrationState } from '@contember/migrations-client'\nimport { emptyDatabaseMetadata } from '@contember/database'\nimport chalkTable from 'chalk-table'\nimport { assertNever } from '../assertNever'\n\nexport class MigrationPrinter {\n\tconstructor(\n\t\tprivate readonly migrationsDescriber: MigrationDescriber,\n\t) {\n\t}\n\n\tprintMigrationDescription = (\n\t\tschema: Schema,\n\t\tmigration: Migration,\n\t\toptions: { sqlOnly?: boolean; noSql?: boolean },\n\t) => {\n\t\tconst description = this.migrationsDescriber.describeModifications(schema, migration)\n\t\tdescription.forEach(({ modification, getSql, description }) => {\n\t\t\tconst sql = getSql({\n\t\t\t\tsystemSchema: 'system',\n\t\t\t\tdatabaseMetadata: emptyDatabaseMetadata,\n\t\t\t\tinvalidateDatabaseMetadata: () => null,\n\t\t\t})\n\t\t\tif (options.sqlOnly) {\n\t\t\t\tif (sql.trim()) {\n\t\t\t\t\tconsole.log(sql)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst color = description.isDestructive ? chalk.red : chalk.blue\n\t\t\t\tconsole.group(color(`${description.message} [${modification.modification}]`))\n\t\t\t\tif (description.failureWarning) {\n\t\t\t\t\tconsole.log(chalk.bgWhite(chalk.redBright(description.failureWarning)))\n\t\t\t\t}\n\n\t\t\t\tif (!options.noSql) {\n\t\t\t\t\tif (sql.trim()) {\n\t\t\t\t\t\tconsole.log(sql)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log('No sql to execute')\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.groupEnd()\n\t\t\t}\n\t\t})\n\t}\n\n\tprintStatusTable = (migrations: AnyMigrationStatus[]) => {\n\t\treturn chalkTable(\n\t\t\t{\n\t\t\t\tcolumns: ['status', 'migration', 'info'],\n\t\t\t},\n\t\t\tmigrations.map(it => {\n\t\t\t\tswitch (it.state) {\n\t\t\t\t\tcase MigrationState.EXECUTED_ERROR:\n\t\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\t\tcase MigrationState.EXECUTED_OK:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgGreen.blackBright('Executed'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: `Executed at ${it.executedMigration.executedAt.toISOString()}`,\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.EXECUTED_MISSING:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgRedBright.white('ERROR'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: it.errorMessage,\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.TO_EXECUTE_OK:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgBlueBright.white('Not executed'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: 'Will be executed during next deploy',\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.TO_EXECUTE_ERROR:\n\t\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\t\tcase MigrationState.SKIP_EMPTY:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgYellow.white('Skip'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: `Skipped because empty`,\n\t\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(it)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\t}\n\n}\n"],"names":["description"],"mappings":";;;;;;;;AAUO,MAAM,iBAAiB;AAAA,EAC7B,YACkB,qBAChB;AADgB,SAAA,sBAAA;AAIU,kBAAA,MAAA,6BAAA,CAC3B,QACA,WACA,YACI;AACJ,YAAM,cAAc,KAAK,oBAAoB,sBAAsB,QAAQ,SAAS;AACpF,kBAAY,QAAQ,CAAC,EAAE,cAAc,QAAQ,aAAAA,mBAAkB;AAC9D,cAAM,MAAM,OAAO;AAAA,UAClB,cAAc;AAAA,UACd,kBAAkB;AAAA,UAClB,4BAA4B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BACN,QAAQ,MAAM,aAAa,MAAM,cAAc;AAAA,gBAC/C,WAAW,GAAG;AAAA,gBACd,MAAM;AAAA,cACP;AAAA,YACD,KAAK,eAAe;AACnB,qBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,YAC9F,KAAK,eAAe;AACZ,qBAAA;AAAA,gBACN,QAAQ,MAAM,SAAS,MAAM,MAAM;AAAA,gBACnC,WAAW,GAAG;AAAA,gBACd,MAAM;AAAA,cACP;AAAA,YACD;AACC,0BAAc;AAAA,UAAA;AAAA,QAEhB,CAAA;AAAA,MACF;AAAA,IAAA,CACD;AAAA,EAAA;AAED;"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const migrations = require("./migrations.cjs");
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
5
|
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
7
6
|
class MigrationsStatusFacade {
|
|
8
|
-
constructor(systemClientProvider, migrationsResolver, migrationsStatusResolver) {
|
|
7
|
+
constructor(systemClientProvider, migrationsResolver, migrationsStatusResolver, migrationPrinter) {
|
|
9
8
|
this.systemClientProvider = systemClientProvider;
|
|
10
9
|
this.migrationsResolver = migrationsResolver;
|
|
11
10
|
this.migrationsStatusResolver = migrationsStatusResolver;
|
|
11
|
+
this.migrationPrinter = migrationPrinter;
|
|
12
12
|
__publicField(this, "resolveMigrationsStatus", async ({ force, allowError }) => {
|
|
13
13
|
const executedMigrations = await this.systemClientProvider.get().listExecutedMigrations();
|
|
14
14
|
const localMigrations = await this.migrationsResolver.getMigrationFiles();
|
|
15
15
|
const status = await this.migrationsStatusResolver.getMigrationsStatus(executedMigrations, localMigrations, force);
|
|
16
16
|
if (status.errorMigrations.length > 0 && !allowError) {
|
|
17
|
-
console.error(
|
|
17
|
+
console.error(this.migrationPrinter.printStatusTable(status.errorMigrations));
|
|
18
18
|
if (!force) {
|
|
19
19
|
throw `Cannot execute migrations`;
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationsStatusFacade.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsStatusFacade.ts"],"sourcesContent":["import { MigrationsResolver, MigrationsStatusResolver
|
|
1
|
+
{"version":3,"file":"MigrationsStatusFacade.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsStatusFacade.ts"],"sourcesContent":["import { MigrationsResolver, MigrationsStatusResolver } from '@contember/migrations-client'\nimport { SystemClientProvider } from '../SystemClientProvider'\nimport { MigrationPrinter } from './MigrationPrinter'\n\nexport class MigrationsStatusFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationsStatusResolver: MigrationsStatusResolver,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t}\n\n\n\tpublic resolveMigrationsStatus = async ({ force, allowError }: { force?: boolean; allowError?: boolean }) => {\n\t\tconst executedMigrations = await this.systemClientProvider.get().listExecutedMigrations()\n\t\tconst localMigrations = await this.migrationsResolver.getMigrationFiles()\n\t\tconst status = await this.migrationsStatusResolver.getMigrationsStatus(executedMigrations, localMigrations, force)\n\t\tif (status.errorMigrations.length > 0 && !allowError) {\n\t\t\tconsole.error(this.migrationPrinter.printStatusTable(status.errorMigrations))\n\t\t\tif (!force) {\n\t\t\t\tthrow `Cannot execute migrations`\n\t\t\t}\n\t\t}\n\n\t\treturn status\n\t}\n}\n"],"names":[],"mappings":";;;;;AAIO,MAAM,uBAAuB;AAAA,EACnC,YACkB,sBACA,oBACA,0BACA,kBAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,qBAAA;AACA,SAAA,2BAAA;AACA,SAAA,mBAAA;AAKlB,kBAAA,MAAO,2BAA0B,OAAO,EAAE,OAAO,iBAA4D;AAC5G,YAAM,qBAAqB,MAAM,KAAK,qBAAqB,IAAA,EAAM,uBAAuB;AACxF,YAAM,kBAAkB,MAAM,KAAK,mBAAmB,kBAAkB;AACxE,YAAM,SAAS,MAAM,KAAK,yBAAyB,oBAAoB,oBAAoB,iBAAiB,KAAK;AACjH,UAAI,OAAO,gBAAgB,SAAS,KAAK,CAAC,YAAY;AACrD,gBAAQ,MAAM,KAAK,iBAAiB,iBAAiB,OAAO,eAAe,CAAC;AAC5E,YAAI,CAAC,OAAO;AACL,gBAAA;AAAA,QAAA;AAAA,MACP;AAGM,aAAA;AAAA,IAAA,CACR;AAAA,EAAA;AACD;;"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { createMigrationStatusTable } from "./migrations.js";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
5
4
|
class MigrationsStatusFacade {
|
|
6
|
-
constructor(systemClientProvider, migrationsResolver, migrationsStatusResolver) {
|
|
5
|
+
constructor(systemClientProvider, migrationsResolver, migrationsStatusResolver, migrationPrinter) {
|
|
7
6
|
this.systemClientProvider = systemClientProvider;
|
|
8
7
|
this.migrationsResolver = migrationsResolver;
|
|
9
8
|
this.migrationsStatusResolver = migrationsStatusResolver;
|
|
9
|
+
this.migrationPrinter = migrationPrinter;
|
|
10
10
|
__publicField(this, "resolveMigrationsStatus", async ({ force, allowError }) => {
|
|
11
11
|
const executedMigrations = await this.systemClientProvider.get().listExecutedMigrations();
|
|
12
12
|
const localMigrations = await this.migrationsResolver.getMigrationFiles();
|
|
13
13
|
const status = await this.migrationsStatusResolver.getMigrationsStatus(executedMigrations, localMigrations, force);
|
|
14
14
|
if (status.errorMigrations.length > 0 && !allowError) {
|
|
15
|
-
console.error(
|
|
15
|
+
console.error(this.migrationPrinter.printStatusTable(status.errorMigrations));
|
|
16
16
|
if (!force) {
|
|
17
17
|
throw `Cannot execute migrations`;
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationsStatusFacade.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsStatusFacade.ts"],"sourcesContent":["import { MigrationsResolver, MigrationsStatusResolver
|
|
1
|
+
{"version":3,"file":"MigrationsStatusFacade.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsStatusFacade.ts"],"sourcesContent":["import { MigrationsResolver, MigrationsStatusResolver } from '@contember/migrations-client'\nimport { SystemClientProvider } from '../SystemClientProvider'\nimport { MigrationPrinter } from './MigrationPrinter'\n\nexport class MigrationsStatusFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationsStatusResolver: MigrationsStatusResolver,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t}\n\n\n\tpublic resolveMigrationsStatus = async ({ force, allowError }: { force?: boolean; allowError?: boolean }) => {\n\t\tconst executedMigrations = await this.systemClientProvider.get().listExecutedMigrations()\n\t\tconst localMigrations = await this.migrationsResolver.getMigrationFiles()\n\t\tconst status = await this.migrationsStatusResolver.getMigrationsStatus(executedMigrations, localMigrations, force)\n\t\tif (status.errorMigrations.length > 0 && !allowError) {\n\t\t\tconsole.error(this.migrationPrinter.printStatusTable(status.errorMigrations))\n\t\t\tif (!force) {\n\t\t\t\tthrow `Cannot execute migrations`\n\t\t\t}\n\t\t}\n\n\t\treturn status\n\t}\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,uBAAuB;AAAA,EACnC,YACkB,sBACA,oBACA,0BACA,kBAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,qBAAA;AACA,SAAA,2BAAA;AACA,SAAA,mBAAA;AAKlB,kBAAA,MAAO,2BAA0B,OAAO,EAAE,OAAO,iBAA4D;AAC5G,YAAM,qBAAqB,MAAM,KAAK,qBAAqB,IAAA,EAAM,uBAAuB;AACxF,YAAM,kBAAkB,MAAM,KAAK,mBAAmB,kBAAkB;AACxE,YAAM,SAAS,MAAM,KAAK,yBAAyB,oBAAoB,oBAAoB,iBAAiB,KAAK;AACjH,UAAI,OAAO,gBAAgB,SAAS,KAAK,CAAC,YAAY;AACrD,gBAAQ,MAAM,KAAK,iBAAiB,iBAAiB,OAAO,eAAe,CAAC;AAC5E,YAAI,CAAC,OAAO;AACL,gBAAA;AAAA,QAAA;AAAA,MACP;AAGM,aAAA;AAAA,IAAA,CACR;AAAA,EAAA;AACD;"}
|
|
@@ -32,12 +32,5 @@ class LineTransform extends node_stream.Transform {
|
|
|
32
32
|
__publicField(this, "chunks", []);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
const readStream = async (stream) => new Promise((resolve, reject) => {
|
|
36
|
-
const chunks = [];
|
|
37
|
-
stream.on("error", (err) => reject(err));
|
|
38
|
-
stream.on("data", (chunk) => chunks.push(chunk));
|
|
39
|
-
stream.on("end", () => resolve(node_buffer.Buffer.concat(chunks)));
|
|
40
|
-
});
|
|
41
35
|
exports.LineTransform = LineTransform;
|
|
42
|
-
exports.readStream = readStream;
|
|
43
36
|
//# sourceMappingURL=stream.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.cjs","sources":["../../../../../packages/cli/src/lib/stream.ts"],"sourcesContent":["import { Stream, Transform } from 'node:stream'\nimport { Buffer } from 'node:buffer'\n\n\nexport class LineTransform extends Transform {\n\tprivate chunks: Buffer[] = []\n\n\tconstructor(transform: (line: string) => string) {\n\t\tsuper({\n\t\t\ttransform: (chunk, encoding, done) => {\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst eolIndex = chunk.indexOf('\\n')\n\n\t\t\t\t\tif (eolIndex < 0) {\n\t\t\t\t\t\tthis.chunks.push(chunk)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.chunks.push(chunk.slice(0, eolIndex))\n\t\t\t\t\tchunk = chunk.slice(eolIndex + 1)\n\t\t\t\t\tthis.push(transform(Buffer.concat(this.chunks).toString('utf8')) + '\\n', 'utf8')\n\t\t\t\t\tthis.chunks = []\n\t\t\t\t}\n\n\t\t\t\treturn done()\n\t\t\t},\n\n\t\t\tflush: done => {\n\t\t\t\tif (this.chunks.length) {\n\t\t\t\t\tthis.push(transform(Buffer.concat(this.chunks).toString('utf8')), 'utf8')\n\t\t\t\t\treturn done()\n\t\t\t\t}\n\t\t\t},\n\t\t})\n\t}\n}\n\n\nexport const readStream = async (stream: Stream) => new Promise<Buffer>((resolve, reject) => {\n\tconst chunks: Buffer[] = []\n\tstream.on('error', err => reject(err))\n\tstream.on('data', chunk => chunks.push(chunk))\n\tstream.on('end', () => resolve(Buffer.concat(chunks)))\n})\n"],"names":["Transform","Buffer"],"mappings":";;;;;;;AAIO,MAAM,sBAAsBA,YAAAA,UAAU;AAAA,EAG5C,YAAY,WAAqC;AAC1C,UAAA;AAAA,MACL,WAAW,CAAC,OAAO,UAAU,SAAS;AACrC,eAAO,MAAM;AACN,gBAAA,WAAW,MAAM,QAAQ,IAAI;AAEnC,cAAI,WAAW,GAAG;AACZ,iBAAA,OAAO,KAAK,KAAK;AACtB;AAAA,UAAA;AAGD,eAAK,OAAO,KAAK,MAAM,MAAM,GAAG,QAAQ,CAAC;AACjC,kBAAA,MAAM,MAAM,WAAW,CAAC;AAChC,eAAK,KAAK,UAAUC,YAAO,OAAA,OAAO,KAAK,MAAM,EAAE,SAAS,MAAM,CAAC,IAAI,MAAM,MAAM;AAC/E,eAAK,SAAS,CAAC;AAAA,QAAA;AAGhB,eAAO,KAAK;AAAA,MACb;AAAA,MAEA,OAAO,CAAQ,SAAA;AACV,YAAA,KAAK,OAAO,QAAQ;AAClB,eAAA,KAAK,UAAUA,YAAAA,OAAO,OAAO,KAAK,MAAM,EAAE,SAAS,MAAM,CAAC,GAAG,MAAM;AACxE,iBAAO,KAAK;AAAA,QAAA;AAAA,MACb;AAAA,IACD,CACA;AA5BF,kBAAA,MAAQ,UAAmB,EAAC;AAAA,EAAA;AA8B7B
|
|
1
|
+
{"version":3,"file":"stream.cjs","sources":["../../../../../packages/cli/src/lib/stream.ts"],"sourcesContent":["import { Stream, Transform } from 'node:stream'\nimport { Buffer } from 'node:buffer'\n\n\nexport class LineTransform extends Transform {\n\tprivate chunks: Buffer[] = []\n\n\tconstructor(transform: (line: string) => string) {\n\t\tsuper({\n\t\t\ttransform: (chunk, encoding, done) => {\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst eolIndex = chunk.indexOf('\\n')\n\n\t\t\t\t\tif (eolIndex < 0) {\n\t\t\t\t\t\tthis.chunks.push(chunk)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.chunks.push(chunk.slice(0, eolIndex))\n\t\t\t\t\tchunk = chunk.slice(eolIndex + 1)\n\t\t\t\t\tthis.push(transform(Buffer.concat(this.chunks).toString('utf8')) + '\\n', 'utf8')\n\t\t\t\t\tthis.chunks = []\n\t\t\t\t}\n\n\t\t\t\treturn done()\n\t\t\t},\n\n\t\t\tflush: done => {\n\t\t\t\tif (this.chunks.length) {\n\t\t\t\t\tthis.push(transform(Buffer.concat(this.chunks).toString('utf8')), 'utf8')\n\t\t\t\t\treturn done()\n\t\t\t\t}\n\t\t\t},\n\t\t})\n\t}\n}\n\n\nexport const readStream = async (stream: Stream) => new Promise<Buffer>((resolve, reject) => {\n\tconst chunks: Buffer[] = []\n\tstream.on('error', err => reject(err))\n\tstream.on('data', chunk => chunks.push(chunk))\n\tstream.on('end', () => resolve(Buffer.concat(chunks)))\n})\n"],"names":["Transform","Buffer"],"mappings":";;;;;;;AAIO,MAAM,sBAAsBA,YAAAA,UAAU;AAAA,EAG5C,YAAY,WAAqC;AAC1C,UAAA;AAAA,MACL,WAAW,CAAC,OAAO,UAAU,SAAS;AACrC,eAAO,MAAM;AACN,gBAAA,WAAW,MAAM,QAAQ,IAAI;AAEnC,cAAI,WAAW,GAAG;AACZ,iBAAA,OAAO,KAAK,KAAK;AACtB;AAAA,UAAA;AAGD,eAAK,OAAO,KAAK,MAAM,MAAM,GAAG,QAAQ,CAAC;AACjC,kBAAA,MAAM,MAAM,WAAW,CAAC;AAChC,eAAK,KAAK,UAAUC,YAAO,OAAA,OAAO,KAAK,MAAM,EAAE,SAAS,MAAM,CAAC,IAAI,MAAM,MAAM;AAC/E,eAAK,SAAS,CAAC;AAAA,QAAA;AAGhB,eAAO,KAAK;AAAA,MACb;AAAA,MAEA,OAAO,CAAQ,SAAA;AACV,YAAA,KAAK,OAAO,QAAQ;AAClB,eAAA,KAAK,UAAUA,YAAAA,OAAO,OAAO,KAAK,MAAM,EAAE,SAAS,MAAM,CAAC,GAAG,MAAM;AACxE,iBAAO,KAAK;AAAA,QAAA;AAAA,MACb;AAAA,IACD,CACA;AA5BF,kBAAA,MAAQ,UAAmB,EAAC;AAAA,EAAA;AA8B7B;;"}
|
|
@@ -30,14 +30,7 @@ class LineTransform extends Transform {
|
|
|
30
30
|
__publicField(this, "chunks", []);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
const readStream = async (stream) => new Promise((resolve, reject) => {
|
|
34
|
-
const chunks = [];
|
|
35
|
-
stream.on("error", (err) => reject(err));
|
|
36
|
-
stream.on("data", (chunk) => chunks.push(chunk));
|
|
37
|
-
stream.on("end", () => resolve(Buffer.concat(chunks)));
|
|
38
|
-
});
|
|
39
33
|
export {
|
|
40
|
-
LineTransform
|
|
41
|
-
readStream
|
|
34
|
+
LineTransform
|
|
42
35
|
};
|
|
43
36
|
//# sourceMappingURL=stream.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sources":["../../../../../packages/cli/src/lib/stream.ts"],"sourcesContent":["import { Stream, Transform } from 'node:stream'\nimport { Buffer } from 'node:buffer'\n\n\nexport class LineTransform extends Transform {\n\tprivate chunks: Buffer[] = []\n\n\tconstructor(transform: (line: string) => string) {\n\t\tsuper({\n\t\t\ttransform: (chunk, encoding, done) => {\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst eolIndex = chunk.indexOf('\\n')\n\n\t\t\t\t\tif (eolIndex < 0) {\n\t\t\t\t\t\tthis.chunks.push(chunk)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.chunks.push(chunk.slice(0, eolIndex))\n\t\t\t\t\tchunk = chunk.slice(eolIndex + 1)\n\t\t\t\t\tthis.push(transform(Buffer.concat(this.chunks).toString('utf8')) + '\\n', 'utf8')\n\t\t\t\t\tthis.chunks = []\n\t\t\t\t}\n\n\t\t\t\treturn done()\n\t\t\t},\n\n\t\t\tflush: done => {\n\t\t\t\tif (this.chunks.length) {\n\t\t\t\t\tthis.push(transform(Buffer.concat(this.chunks).toString('utf8')), 'utf8')\n\t\t\t\t\treturn done()\n\t\t\t\t}\n\t\t\t},\n\t\t})\n\t}\n}\n\n\nexport const readStream = async (stream: Stream) => new Promise<Buffer>((resolve, reject) => {\n\tconst chunks: Buffer[] = []\n\tstream.on('error', err => reject(err))\n\tstream.on('data', chunk => chunks.push(chunk))\n\tstream.on('end', () => resolve(Buffer.concat(chunks)))\n})\n"],"names":["Buffer"],"mappings":";;;;;AAIO,MAAM,sBAAsB,UAAU;AAAA,EAG5C,YAAY,WAAqC;AAC1C,UAAA;AAAA,MACL,WAAW,CAAC,OAAO,UAAU,SAAS;AACrC,eAAO,MAAM;AACN,gBAAA,WAAW,MAAM,QAAQ,IAAI;AAEnC,cAAI,WAAW,GAAG;AACZ,iBAAA,OAAO,KAAK,KAAK;AACtB;AAAA,UAAA;AAGD,eAAK,OAAO,KAAK,MAAM,MAAM,GAAG,QAAQ,CAAC;AACjC,kBAAA,MAAM,MAAM,WAAW,CAAC;AAChC,eAAK,KAAK,UAAUA,OAAO,OAAO,KAAK,MAAM,EAAE,SAAS,MAAM,CAAC,IAAI,MAAM,MAAM;AAC/E,eAAK,SAAS,CAAC;AAAA,QAAA;AAGhB,eAAO,KAAK;AAAA,MACb;AAAA,MAEA,OAAO,CAAQ,SAAA;AACV,YAAA,KAAK,OAAO,QAAQ;AAClB,eAAA,KAAK,UAAUA,OAAO,OAAO,KAAK,MAAM,EAAE,SAAS,MAAM,CAAC,GAAG,MAAM;AACxE,iBAAO,KAAK;AAAA,QAAA;AAAA,MACb;AAAA,IACD,CACA;AA5BF,kBAAA,MAAQ,UAAmB,EAAC;AAAA,EAAA;AA8B7B;
|
|
1
|
+
{"version":3,"file":"stream.js","sources":["../../../../../packages/cli/src/lib/stream.ts"],"sourcesContent":["import { Stream, Transform } from 'node:stream'\nimport { Buffer } from 'node:buffer'\n\n\nexport class LineTransform extends Transform {\n\tprivate chunks: Buffer[] = []\n\n\tconstructor(transform: (line: string) => string) {\n\t\tsuper({\n\t\t\ttransform: (chunk, encoding, done) => {\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst eolIndex = chunk.indexOf('\\n')\n\n\t\t\t\t\tif (eolIndex < 0) {\n\t\t\t\t\t\tthis.chunks.push(chunk)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.chunks.push(chunk.slice(0, eolIndex))\n\t\t\t\t\tchunk = chunk.slice(eolIndex + 1)\n\t\t\t\t\tthis.push(transform(Buffer.concat(this.chunks).toString('utf8')) + '\\n', 'utf8')\n\t\t\t\t\tthis.chunks = []\n\t\t\t\t}\n\n\t\t\t\treturn done()\n\t\t\t},\n\n\t\t\tflush: done => {\n\t\t\t\tif (this.chunks.length) {\n\t\t\t\t\tthis.push(transform(Buffer.concat(this.chunks).toString('utf8')), 'utf8')\n\t\t\t\t\treturn done()\n\t\t\t\t}\n\t\t\t},\n\t\t})\n\t}\n}\n\n\nexport const readStream = async (stream: Stream) => new Promise<Buffer>((resolve, reject) => {\n\tconst chunks: Buffer[] = []\n\tstream.on('error', err => reject(err))\n\tstream.on('data', chunk => chunks.push(chunk))\n\tstream.on('end', () => resolve(Buffer.concat(chunks)))\n})\n"],"names":["Buffer"],"mappings":";;;;;AAIO,MAAM,sBAAsB,UAAU;AAAA,EAG5C,YAAY,WAAqC;AAC1C,UAAA;AAAA,MACL,WAAW,CAAC,OAAO,UAAU,SAAS;AACrC,eAAO,MAAM;AACN,gBAAA,WAAW,MAAM,QAAQ,IAAI;AAEnC,cAAI,WAAW,GAAG;AACZ,iBAAA,OAAO,KAAK,KAAK;AACtB;AAAA,UAAA;AAGD,eAAK,OAAO,KAAK,MAAM,MAAM,GAAG,QAAQ,CAAC;AACjC,kBAAA,MAAM,MAAM,WAAW,CAAC;AAChC,eAAK,KAAK,UAAUA,OAAO,OAAO,KAAK,MAAM,EAAE,SAAS,MAAM,CAAC,IAAI,MAAM,MAAM;AAC/E,eAAK,SAAS,CAAC;AAAA,QAAA;AAGhB,eAAO,KAAK;AAAA,MACb;AAAA,MAEA,OAAO,CAAQ,SAAA;AACV,YAAA,KAAK,OAAO,QAAQ;AAClB,eAAA,KAAK,UAAUA,OAAO,OAAO,KAAK,MAAM,EAAE,SAAS,MAAM,CAAC,GAAG,MAAM;AACxE,iBAAO,KAAK;AAAA,QAAA;AAAA,MACb;AAAA,IACD,CACA;AA5BF,kBAAA,MAAQ,UAAmB,EAAC;AAAA,EAAA;AA8B7B;"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const http = require("node:http");
|
|
4
|
-
const https = require("node:https");
|
|
5
3
|
const stream = require("../stream.cjs");
|
|
6
4
|
const node_stream = require("node:stream");
|
|
7
5
|
const node_zlib = require("node:zlib");
|
|
@@ -43,53 +41,44 @@ class DataTransferClient {
|
|
|
43
41
|
}
|
|
44
42
|
return line;
|
|
45
43
|
}));
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
inputStream.on("error", (err) => {
|
|
45
|
+
throw new Error(`Input stream error: ${err}`);
|
|
46
|
+
});
|
|
47
|
+
const bodyStream = node_stream.Readable.toWeb(gzip ? inputStream.pipe(node_zlib.createGzip()) : inputStream);
|
|
48
|
+
const response = await fetch(`${project.endpoint}/import`, {
|
|
49
49
|
headers: {
|
|
50
|
+
"Authorization": `Bearer ${project.token}`,
|
|
50
51
|
"Content-type": "application/x-ndjson",
|
|
51
52
|
...gzip ? { "Content-Encoding": "gzip" } : {}
|
|
52
53
|
},
|
|
53
|
-
|
|
54
|
+
method: "POST",
|
|
55
|
+
body: bodyStream
|
|
54
56
|
});
|
|
57
|
+
if (!response.ok) {
|
|
58
|
+
const responseBody = await response.text();
|
|
59
|
+
throw new Error(`Invalid response: ${response.statusText}
|
|
60
|
+
${responseBody}`);
|
|
61
|
+
}
|
|
62
|
+
return response;
|
|
55
63
|
});
|
|
56
64
|
__publicField(this, "dataExport", async ({ project: { name: project, token, endpoint: baseUrl }, gzip, includeSystem, excludeTables }) => {
|
|
57
|
-
|
|
58
|
-
url: `${baseUrl}/export`,
|
|
59
|
-
token,
|
|
65
|
+
const response = await fetch(`${baseUrl}/export`, {
|
|
60
66
|
headers: {
|
|
67
|
+
"Authorization": `Bearer ${token}`,
|
|
61
68
|
"Accept-Encoding": gzip ? "gzip" : "identity",
|
|
62
69
|
"Content-type": "application/json"
|
|
63
70
|
},
|
|
71
|
+
method: "POST",
|
|
64
72
|
body: JSON.stringify({
|
|
65
73
|
projects: [{ slug: project, system: includeSystem, excludeTables }]
|
|
66
74
|
})
|
|
67
75
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Authorization: `Bearer ${token}`,
|
|
75
|
-
...headers
|
|
76
|
-
}
|
|
77
|
-
}, async (res) => {
|
|
78
|
-
if (res.statusCode !== 200) {
|
|
79
|
-
const responseBody = (await stream.readStream(res)).toString();
|
|
80
|
-
reject(new Error(`Invalid response: ${res.statusMessage}
|
|
81
|
-
${responseBody}`));
|
|
82
|
-
} else {
|
|
83
|
-
resolve(res);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
if (body instanceof node_stream.Stream) {
|
|
87
|
-
body.pipe(req);
|
|
88
|
-
} else {
|
|
89
|
-
req.write(body);
|
|
90
|
-
req.end();
|
|
91
|
-
}
|
|
92
|
-
});
|
|
76
|
+
if (!response.ok) {
|
|
77
|
+
const responseBody = await response.text();
|
|
78
|
+
throw new Error(`Invalid response: ${response.statusText}
|
|
79
|
+
${responseBody}`);
|
|
80
|
+
}
|
|
81
|
+
return response;
|
|
93
82
|
});
|
|
94
83
|
}
|
|
95
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTransferClient.cjs","sources":["../../../../../../packages/cli/src/lib/transfer/DataTransferClient.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"DataTransferClient.cjs","sources":["../../../../../../packages/cli/src/lib/transfer/DataTransferClient.ts"],"sourcesContent":["import { LineTransform } from '../stream'\nimport { Readable } from 'node:stream'\nimport { createGzip } from 'node:zlib'\nimport { RemoteProject } from '../project/RemoteProject'\n\nexport class DataTransferClient {\n\n\tdataImport = async ({ printProgress, stream, project, gzip }: {\n\t\tstream: Readable\n\t\tproject: RemoteProject\n\t\tprintProgress: (message: string) => void\n\t\tgzip: boolean\n\t}) => {\n\t\tlet table = ''\n\t\tlet rowCount = 0\n\t\tlet rowTotal = 0\n\t\tlet transferred = 0\n\t\tlet start = Date.now()\n\t\tconst inputStream = stream.pipe(new LineTransform(line => {\n\t\t\ttransferred += line.length + 1\n\t\t\tif (line === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst data = JSON.parse(line)\n\t\t\tswitch (data[0]) {\n\t\t\t\tcase 'importSystemSchemaBegin':\n\t\t\t\t\treturn JSON.stringify([data[0], { ...data[1], project: project.name }])\n\t\t\t\tcase 'importContentSchemaBegin':\n\t\t\t\t\treturn JSON.stringify([data[0], { ...data[1], project: project.name }])\n\t\t\t\tcase 'insertBegin':\n\t\t\t\t\ttable = data[1].table\n\t\t\t\t\trowCount = 0\n\t\t\t\t\tbreak\n\t\t\t\tcase 'insertRow':\n\t\t\t\t\trowCount++\n\t\t\t\t\trowTotal++\n\t\t\t\t\tbreak\n\t\t\t\tcase 'insertEnd':\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t\tif ((rowCount % 1000) === 0 || data[0] !== 'insertRow') {\n\t\t\t\tconst mbs = Math.floor(transferred / 1024 / 1024).toString()\n\t\t\t\tconst durationS = Math.floor((Date.now() - start) / 1000)\n\t\t\t\tprintProgress(`transferred ${mbs} MiB; inserted ${rowCount} ${table} rows, ${rowTotal} total; ${durationS} seconds`)\n\t\t\t}\n\t\t\treturn line\n\t\t}))\n\t\tinputStream.on('error', err => {\n\t\t\tthrow new Error(`Input stream error: ${err}`)\n\t\t})\n\n\t\tconst bodyStream = Readable.toWeb((gzip ? inputStream.pipe(createGzip()) : inputStream)) as unknown as BodyInit\n\n\t\tconst response = await fetch(`${project.endpoint}/import`, {\n\t\t\theaders: {\n\t\t\t\t'Authorization': `Bearer ${project.token}`,\n\t\t\t\t'Content-type': 'application/x-ndjson',\n\t\t\t\t...(gzip ? { 'Content-Encoding': 'gzip' } : {}),\n\t\t\t},\n\t\t\tmethod: 'POST',\n\t\t\tbody: bodyStream,\n\t\t})\n\t\tif (!response.ok) {\n\t\t\tconst responseBody = await response.text()\n\t\t\tthrow new Error(`Invalid response: ${response.statusText}\\n${responseBody}`)\n\t\t}\n\t\treturn response\n\t}\n\n\n\tdataExport = async ({ project: { name: project, token, endpoint: baseUrl }, gzip, includeSystem, excludeTables }: {\n\t\tproject: RemoteProject\n\t\texcludeTables?: string[]\n\t\tincludeSystem: boolean\n\t\tgzip: boolean\n\t}) => {\n\t\tconst response = await fetch(`${baseUrl}/export`, {\n\t\t\theaders: {\n\t\t\t\t'Authorization': `Bearer ${token}`,\n\t\t\t\t'Accept-Encoding': gzip ? 'gzip' : 'identity',\n\t\t\t\t'Content-type': 'application/json',\n\t\t\t},\n\t\t\tmethod: 'POST',\n\t\t\tbody: JSON.stringify({\n\t\t\t\tprojects: [{ slug: project, system: includeSystem, excludeTables }],\n\t\t\t}),\n\t\t})\n\t\tif (!response.ok) {\n\t\t\tconst responseBody = await response.text()\n\t\t\tthrow new Error(`Invalid response: ${response.statusText}\\n${responseBody}`)\n\t\t}\n\t\treturn response\n\t}\n}\n"],"names":["stream","LineTransform","Readable","createGzip"],"mappings":";;;;;;;;AAKO,MAAM,mBAAmB;AAAA,EAAzB,cAAA;AAEN,kBAAA,MAAA,cAAa,OAAO,EAAE,eAAA,QAAeA,UAAQ,SAAS,WAKhD;AACL,UAAI,QAAQ;AACZ,UAAI,WAAW;AACf,UAAI,WAAW;AACf,UAAI,cAAc;AACd,UAAA,QAAQ,KAAK,IAAI;AACrB,YAAM,cAAcA,SAAO,KAAK,IAAIC,qBAAc,CAAQ,SAAA;AACzD,uBAAe,KAAK,SAAS;AAC7B,YAAI,SAAS,IAAI;AACT,iBAAA;AAAA,QAAA;AAEF,cAAA,OAAO,KAAK,MAAM,IAAI;AACpB,gBAAA,KAAK,CAAC,GAAG;AAAA,UAChB,KAAK;AACJ,mBAAO,KAAK,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,GAAG,SAAS,QAAQ,KAAM,CAAA,CAAC;AAAA,UACvE,KAAK;AACJ,mBAAO,KAAK,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,GAAG,SAAS,QAAQ,KAAM,CAAA,CAAC;AAAA,UACvE,KAAK;AACI,oBAAA,KAAK,CAAC,EAAE;AACL,uBAAA;AACX;AAAA,UACD,KAAK;AACJ;AACA;AACA;AAAA,QAEA;AAEF,YAAK,WAAW,QAAU,KAAK,KAAK,CAAC,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