@contember/cli 2.0.0-alpha.19 → 2.0.0-alpha.21
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 +1 -1
- package/dist/development/src/commands/deploy/DeployCommand.cjs +5 -5
- package/dist/development/src/commands/deploy/DeployCommand.cjs.map +1 -1
- package/dist/development/src/commands/deploy/DeployCommand.js +5 -5
- package/dist/development/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/development/src/commands/transfer/ExportCommand.cjs +2 -0
- package/dist/development/src/commands/transfer/ExportCommand.cjs.map +1 -1
- package/dist/development/src/commands/transfer/ExportCommand.js +2 -0
- package/dist/development/src/commands/transfer/ExportCommand.js.map +1 -1
- package/dist/development/src/commands/transfer/TransferCommand.cjs +2 -0
- package/dist/development/src/commands/transfer/TransferCommand.cjs.map +1 -1
- package/dist/development/src/commands/transfer/TransferCommand.js +2 -0
- package/dist/development/src/commands/transfer/TransferCommand.js.map +1 -1
- package/dist/development/src/lib/admin/AdminClient.cjs +1 -1
- package/dist/development/src/lib/admin/AdminClient.cjs.map +1 -1
- package/dist/development/src/lib/admin/AdminClient.js +1 -1
- package/dist/development/src/lib/admin/AdminClient.js.map +1 -1
- package/dist/development/src/lib/project/RemoteProjectResolver.cjs +6 -2
- package/dist/development/src/lib/project/RemoteProjectResolver.cjs.map +1 -1
- package/dist/development/src/lib/project/RemoteProjectResolver.js +6 -2
- package/dist/development/src/lib/project/RemoteProjectResolver.js.map +1 -1
- package/dist/development/src/lib/project/docs/projectDescribe.cjs +3 -5
- package/dist/development/src/lib/project/docs/projectDescribe.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/projectDescribe.js +3 -4
- package/dist/development/src/lib/project/docs/projectDescribe.js.map +1 -1
- package/dist/development/src/lib/tenant/TenantClient.cjs +1 -1
- package/dist/development/src/lib/tenant/TenantClient.cjs.map +1 -1
- package/dist/development/src/lib/tenant/TenantClient.js +2 -2
- package/dist/development/src/lib/tenant/TenantClient.js.map +1 -1
- package/dist/development/src/lib/transfer/DataTransferClient.cjs +2 -2
- package/dist/development/src/lib/transfer/DataTransferClient.cjs.map +1 -1
- package/dist/development/src/lib/transfer/DataTransferClient.js +2 -2
- package/dist/development/src/lib/transfer/DataTransferClient.js.map +1 -1
- package/dist/production/src/commands/deploy/DeployCommand.cjs +5 -5
- package/dist/production/src/commands/deploy/DeployCommand.cjs.map +1 -1
- package/dist/production/src/commands/deploy/DeployCommand.js +5 -5
- package/dist/production/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/production/src/commands/transfer/ExportCommand.cjs +2 -0
- package/dist/production/src/commands/transfer/ExportCommand.cjs.map +1 -1
- package/dist/production/src/commands/transfer/ExportCommand.js +2 -0
- package/dist/production/src/commands/transfer/ExportCommand.js.map +1 -1
- package/dist/production/src/commands/transfer/TransferCommand.cjs +2 -0
- package/dist/production/src/commands/transfer/TransferCommand.cjs.map +1 -1
- package/dist/production/src/commands/transfer/TransferCommand.js +2 -0
- package/dist/production/src/commands/transfer/TransferCommand.js.map +1 -1
- package/dist/production/src/lib/admin/AdminClient.cjs +1 -1
- package/dist/production/src/lib/admin/AdminClient.cjs.map +1 -1
- package/dist/production/src/lib/admin/AdminClient.js +1 -1
- package/dist/production/src/lib/admin/AdminClient.js.map +1 -1
- package/dist/production/src/lib/project/RemoteProjectResolver.cjs +6 -2
- package/dist/production/src/lib/project/RemoteProjectResolver.cjs.map +1 -1
- package/dist/production/src/lib/project/RemoteProjectResolver.js +6 -2
- package/dist/production/src/lib/project/RemoteProjectResolver.js.map +1 -1
- package/dist/production/src/lib/project/docs/projectDescribe.cjs +2 -4
- package/dist/production/src/lib/project/docs/projectDescribe.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/projectDescribe.js +2 -3
- package/dist/production/src/lib/project/docs/projectDescribe.js.map +1 -1
- package/dist/production/src/lib/tenant/TenantClient.cjs +1 -1
- package/dist/production/src/lib/tenant/TenantClient.cjs.map +1 -1
- package/dist/production/src/lib/tenant/TenantClient.js +2 -2
- package/dist/production/src/lib/tenant/TenantClient.js.map +1 -1
- package/dist/production/src/lib/transfer/DataTransferClient.cjs +2 -2
- package/dist/production/src/lib/transfer/DataTransferClient.cjs.map +1 -1
- package/dist/production/src/lib/transfer/DataTransferClient.js +2 -2
- package/dist/production/src/lib/transfer/DataTransferClient.js.map +1 -1
- package/dist/types/commands/deploy/DeployCommand.d.ts.map +1 -1
- package/dist/types/commands/transfer/ExportCommand.d.ts +1 -0
- package/dist/types/commands/transfer/ExportCommand.d.ts.map +1 -1
- package/dist/types/commands/transfer/TransferCommand.d.ts +1 -0
- package/dist/types/commands/transfer/TransferCommand.d.ts.map +1 -1
- package/dist/types/lib/project/RemoteProjectResolver.d.ts +1 -1
- package/dist/types/lib/project/RemoteProjectResolver.d.ts.map +1 -1
- package/dist/types/lib/project/docs/projectDescribe.d.ts.map +1 -1
- package/dist/types/lib/transfer/DataTransferClient.d.ts +2 -1
- package/dist/types/lib/transfer/DataTransferClient.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -19
- package/src/commands/deploy/DeployCommand.ts +6 -5
- package/src/commands/transfer/ExportCommand.ts +3 -0
- package/src/commands/transfer/TransferCommand.ts +3 -0
- package/src/lib/admin/AdminClient.ts +1 -1
- package/src/lib/project/RemoteProjectResolver.ts +7 -2
- package/src/lib/project/docs/projectDescribe.tsx +2 -3
- package/src/lib/tenant/TenantClient.ts +1 -1
- package/src/lib/transfer/DataTransferClient.ts +3 -2
package/package.json
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/cli",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.21",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"contember": "./dist/production/run.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "tailwindcss -i src/lib/project/docs/resources/style.css -o ./dist/
|
|
9
|
+
"build": "tailwindcss -i src/lib/project/docs/resources/style.css -o ./dist/resources/out.css"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@types/fs-extra": "^11.0.4",
|
|
13
13
|
"@types/js-yaml": "^4.0.9",
|
|
14
|
-
"@types/node": "^20.16.
|
|
14
|
+
"@types/node": "^20.16.11",
|
|
15
15
|
"@types/prompts": "^2.4.9",
|
|
16
16
|
"@types/semver": "^7.5.8",
|
|
17
17
|
"autoprefixer": "^10.4.20",
|
|
18
|
-
"postcss": "^8.4.
|
|
19
|
-
"tailwindcss": "^3.4.
|
|
18
|
+
"postcss": "^8.4.47",
|
|
19
|
+
"tailwindcss": "^3.4.14"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@contember/cli-common": "2.0.0-alpha.
|
|
23
|
-
"@contember/config-loader": "2.0.0-alpha.
|
|
24
|
-
"@contember/database": "2.0.0-alpha.
|
|
25
|
-
"@contember/dic": "2.0.0-alpha.
|
|
26
|
-
"@contember/engine-common": "2.0.0-alpha.
|
|
27
|
-
"@contember/engine-content-api": "2.0.0-alpha.
|
|
28
|
-
"@contember/graphql-client": "2.0.0-alpha.
|
|
29
|
-
"@contember/migrations-client": "2.0.0-alpha.
|
|
30
|
-
"@contember/schema": "2.0.0-alpha.
|
|
31
|
-
"@contember/schema-migrations": "2.0.0-alpha.
|
|
32
|
-
"@contember/schema-utils": "2.0.0-alpha.
|
|
33
|
-
"@contember/typesafe": "2.0.0-alpha.
|
|
34
|
-
"@graphql-tools/schema": "^10.0.
|
|
22
|
+
"@contember/cli-common": "2.0.0-alpha.21",
|
|
23
|
+
"@contember/config-loader": "2.0.0-alpha.21",
|
|
24
|
+
"@contember/database": "2.0.0-alpha.21",
|
|
25
|
+
"@contember/dic": "2.0.0-alpha.21",
|
|
26
|
+
"@contember/engine-common": "2.0.0-alpha.21",
|
|
27
|
+
"@contember/engine-content-api": "2.0.0-alpha.21",
|
|
28
|
+
"@contember/graphql-client": "2.0.0-alpha.21",
|
|
29
|
+
"@contember/migrations-client": "2.0.0-alpha.21",
|
|
30
|
+
"@contember/schema": "2.0.0-alpha.21",
|
|
31
|
+
"@contember/schema-migrations": "2.0.0-alpha.21",
|
|
32
|
+
"@contember/schema-utils": "2.0.0-alpha.21",
|
|
33
|
+
"@contember/typesafe": "2.0.0-alpha.21",
|
|
34
|
+
"@graphql-tools/schema": "^10.0.7",
|
|
35
35
|
"chalk": "^5.3.0",
|
|
36
36
|
"chalk-table": "^1.0.2",
|
|
37
37
|
"esbuild": "^0.21.5",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"lodash-es": "^4.17.21",
|
|
42
42
|
"pg": "^8.12.0",
|
|
43
43
|
"preact": "^10.23.2",
|
|
44
|
-
"preact-render-to-string": "^6.5.
|
|
44
|
+
"preact-render-to-string": "^6.5.11",
|
|
45
45
|
"prompts": "^2.4.2",
|
|
46
46
|
"semver": "^7.6.3",
|
|
47
47
|
"yawn-yaml": "^2.3.0"
|
|
@@ -50,24 +50,25 @@ export class DeployCommand extends Command<Args, Options> {
|
|
|
50
50
|
protected async execute(input: Input<Args, Options>): Promise<void | number> {
|
|
51
51
|
|
|
52
52
|
const dsn = input.getArgument('dsn')
|
|
53
|
-
const
|
|
53
|
+
const adminEndpoint = input.getOption('admin')
|
|
54
|
+
const remoteProject = this.remoteProjectResolver.resolve(dsn, adminEndpoint)
|
|
54
55
|
if (!remoteProject) {
|
|
55
56
|
throw `Project not defined. Please provide DSN or environment variables CONTEMBER_*`
|
|
56
57
|
}
|
|
57
58
|
this.remoteProjectProvider.setRemoteProject(remoteProject)
|
|
58
59
|
|
|
59
|
-
let adminEndpoint = input.getOption('admin')
|
|
60
60
|
const deployMigration = input.getOption('no-migrations') !== true
|
|
61
61
|
const yes = input.getOption('yes') === true
|
|
62
62
|
const projectAdminDistDir = this.workspace.adminDistDir
|
|
63
|
-
|
|
63
|
+
|
|
64
|
+
const deployAdmin = input.getOption('no-admin') !== true && !!remoteProject.adminEndpoint && !!projectAdminDistDir
|
|
64
65
|
|
|
65
66
|
|
|
66
67
|
console.log('')
|
|
67
68
|
console.log('Contember project deployment configuration:')
|
|
68
69
|
console.log(`Target project name: ${remoteProject.name}`)
|
|
69
70
|
console.log(`API URL: ${remoteProject.endpoint}`)
|
|
70
|
-
console.log(`Admin URL: ${adminEndpoint ?? 'none'}`)
|
|
71
|
+
console.log(`Admin URL: ${remoteProject.adminEndpoint ?? 'none'}`)
|
|
71
72
|
console.log(`Deploy token: ${maskToken(remoteProject.token)}`)
|
|
72
73
|
console.log('')
|
|
73
74
|
|
|
@@ -113,7 +114,7 @@ export class DeployCommand extends Command<Args, Options> {
|
|
|
113
114
|
console.log('')
|
|
114
115
|
console.log('Deployment successful')
|
|
115
116
|
console.log(`API URL: ${remoteProject.endpoint}`)
|
|
116
|
-
console.log(`Admin URL: ${adminEndpoint ?? 'none'}`)
|
|
117
|
+
console.log(`Admin URL: ${remoteProject.adminEndpoint ?? 'none'}`)
|
|
117
118
|
|
|
118
119
|
return 0
|
|
119
120
|
}
|
|
@@ -17,6 +17,7 @@ type Options = {
|
|
|
17
17
|
'no-gzip-output'?: boolean
|
|
18
18
|
'no-gzip-transfer'?: boolean
|
|
19
19
|
output?: string
|
|
20
|
+
'exclude-table'?: string[]
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export class ExportCommand extends Command<Args, Options> {
|
|
@@ -35,6 +36,7 @@ export class ExportCommand extends Command<Args, Options> {
|
|
|
35
36
|
configuration.option('no-gzip-transfer').valueNone()
|
|
36
37
|
configuration.option('no-gzip-output').valueNone()
|
|
37
38
|
configuration.option('output').valueRequired()
|
|
39
|
+
configuration.option('exclude-table').valueArray()
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
protected async execute(input: Input<Args, Options>): Promise<void | number> {
|
|
@@ -58,6 +60,7 @@ export class ExportCommand extends Command<Args, Options> {
|
|
|
58
60
|
|
|
59
61
|
const response = await this.dataTransferClient.dataExport({
|
|
60
62
|
project,
|
|
63
|
+
excludeTables: input.getOption('exclude-table') ?? [],
|
|
61
64
|
includeSystem,
|
|
62
65
|
gzip: gzipTransfer,
|
|
63
66
|
})
|
|
@@ -15,6 +15,7 @@ type Options = {
|
|
|
15
15
|
'include-system'?: boolean
|
|
16
16
|
'no-gzip-transfer'?: boolean
|
|
17
17
|
yes: boolean
|
|
18
|
+
'exclude-table'?: string[]
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export class TransferCommand extends Command<Args, Options> {
|
|
@@ -32,6 +33,7 @@ export class TransferCommand extends Command<Args, Options> {
|
|
|
32
33
|
configuration.option('include-system').valueNone()
|
|
33
34
|
configuration.option('no-gzip-transfer').valueNone()
|
|
34
35
|
configuration.option('yes').valueNone()
|
|
36
|
+
configuration.option('exclude-table').valueArray()
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
protected async execute(input: Input<Args, Options>): Promise<void | number> {
|
|
@@ -68,6 +70,7 @@ export class TransferCommand extends Command<Args, Options> {
|
|
|
68
70
|
const exportResponse = (await this.dataTransferClient.dataExport({
|
|
69
71
|
project: sourceProject,
|
|
70
72
|
includeSystem,
|
|
73
|
+
excludeTables: input.getOption('exclude-table') ?? [],
|
|
71
74
|
gzip: gzipTransfer,
|
|
72
75
|
}))
|
|
73
76
|
const ungzipedResponse = gzipTransfer ? exportResponse.pipe(createGunzip()) : exportResponse
|
|
@@ -14,7 +14,7 @@ export class AdminClient {
|
|
|
14
14
|
if (!response.ok) {
|
|
15
15
|
const project = this.remoteProjectProvider.get()
|
|
16
16
|
const maskedToken = maskToken(project.token)
|
|
17
|
-
throw `Failed to deploy admin, POST request to ${project.
|
|
17
|
+
throw `Failed to deploy admin, POST request to ${project.adminEndpoint}/_deploy with token ${maskedToken} returned status ${response.status} ${response.statusText}\n${await response.text()}`
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -8,7 +8,7 @@ export class RemoteProjectResolver {
|
|
|
8
8
|
) {
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
resolve(identifier?: string): RemoteProject | undefined {
|
|
11
|
+
resolve(identifier?: string, adminEndpoint?: string): RemoteProject | undefined {
|
|
12
12
|
let endpoint: string | undefined
|
|
13
13
|
let token: string | undefined
|
|
14
14
|
let project: string | undefined
|
|
@@ -25,6 +25,11 @@ export class RemoteProjectResolver {
|
|
|
25
25
|
return undefined
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
if (!adminEndpoint && (endpoint.endsWith('.contember.cloud') || !endpoint.includes('://api-'))) {
|
|
29
|
+
adminEndpoint = endpoint
|
|
30
|
+
endpoint += '/_api'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return new RemoteProject(project, endpoint, token, adminEndpoint)
|
|
29
34
|
}
|
|
30
35
|
}
|
|
@@ -3,13 +3,12 @@ import { h } from 'preact'
|
|
|
3
3
|
import render from 'preact-render-to-string'
|
|
4
4
|
import { ProjectInfo } from './components/ProjectInfo'
|
|
5
5
|
import { readFile } from 'node:fs/promises'
|
|
6
|
-
import {
|
|
7
|
-
import { fileURLToPath } from 'node:url'
|
|
6
|
+
import { packageRoot } from '../../../consts'
|
|
8
7
|
|
|
9
8
|
export const renderProjectInfoHtml = async (schema: Schema, projectName: string) => {
|
|
10
9
|
const html = render(<ProjectInfo schema={schema} projectName={projectName} />)
|
|
11
10
|
|
|
12
|
-
const css = await readFile(
|
|
11
|
+
const css = await readFile(packageRoot + '/dist/resources/out.css')
|
|
13
12
|
return `<!DOCTYPE html>
|
|
14
13
|
<html lang="en">
|
|
15
14
|
<head>
|
|
@@ -15,7 +15,7 @@ export class TenantClient {
|
|
|
15
15
|
constructor(private readonly apiClient: GraphQlClient) {}
|
|
16
16
|
|
|
17
17
|
public static create(url: string, apiToken: string): TenantClient {
|
|
18
|
-
const graphqlClient = new GraphQlClient(createTenantApiUrl(url), apiToken)
|
|
18
|
+
const graphqlClient = new GraphQlClient({ url: createTenantApiUrl(url), apiToken })
|
|
19
19
|
return new TenantClient(graphqlClient)
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -60,8 +60,9 @@ export class DataTransferClient {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
dataExport = async ({ project: { name: project, token, endpoint: baseUrl }, gzip, includeSystem }: {
|
|
63
|
+
dataExport = async ({ project: { name: project, token, endpoint: baseUrl }, gzip, includeSystem, excludeTables }: {
|
|
64
64
|
project: RemoteProject
|
|
65
|
+
excludeTables?: string[]
|
|
65
66
|
includeSystem: boolean
|
|
66
67
|
gzip: boolean
|
|
67
68
|
}) => {
|
|
@@ -73,7 +74,7 @@ export class DataTransferClient {
|
|
|
73
74
|
'Content-type': 'application/json',
|
|
74
75
|
},
|
|
75
76
|
body: JSON.stringify({
|
|
76
|
-
projects: [{ slug: project, system: includeSystem }],
|
|
77
|
+
projects: [{ slug: project, system: includeSystem, excludeTables }],
|
|
77
78
|
}),
|
|
78
79
|
})
|
|
79
80
|
}
|