@contember/cli 2.0.0-alpha.17 → 2.0.0-alpha.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contember/cli",
3
- "version": "2.0.0-alpha.17",
3
+ "version": "2.0.0-alpha.19",
4
4
  "license": "Apache-2.0",
5
5
  "bin": {
6
6
  "contember": "./dist/production/run.js"
@@ -19,18 +19,18 @@
19
19
  "tailwindcss": "^3.4.10"
20
20
  },
21
21
  "dependencies": {
22
- "@contember/cli-common": "2.0.0-alpha.17",
23
- "@contember/config-loader": "2.0.0-alpha.17",
24
- "@contember/database": "2.0.0-alpha.17",
25
- "@contember/dic": "2.0.0-alpha.17",
26
- "@contember/engine-common": "2.0.0-alpha.17",
27
- "@contember/engine-content-api": "2.0.0-alpha.17",
28
- "@contember/graphql-client": "2.0.0-alpha.17",
29
- "@contember/migrations-client": "2.0.0-alpha.17",
30
- "@contember/schema": "2.0.0-alpha.17",
31
- "@contember/schema-migrations": "2.0.0-alpha.17",
32
- "@contember/schema-utils": "2.0.0-alpha.17",
33
- "@contember/typesafe": "2.0.0-alpha.17",
22
+ "@contember/cli-common": "2.0.0-alpha.19",
23
+ "@contember/config-loader": "2.0.0-alpha.19",
24
+ "@contember/database": "2.0.0-alpha.19",
25
+ "@contember/dic": "2.0.0-alpha.19",
26
+ "@contember/engine-common": "2.0.0-alpha.19",
27
+ "@contember/engine-content-api": "2.0.0-alpha.19",
28
+ "@contember/graphql-client": "2.0.0-alpha.19",
29
+ "@contember/migrations-client": "2.0.0-alpha.19",
30
+ "@contember/schema": "2.0.0-alpha.19",
31
+ "@contember/schema-migrations": "2.0.0-alpha.19",
32
+ "@contember/schema-utils": "2.0.0-alpha.19",
33
+ "@contember/typesafe": "2.0.0-alpha.19",
34
34
  "@graphql-tools/schema": "^10.0.6",
35
35
  "chalk": "^5.3.0",
36
36
  "chalk-table": "^1.0.2",
@@ -9,7 +9,7 @@ import {
9
9
  } from '@contember/engine-content-api'
10
10
  import { printSchema } from 'graphql'
11
11
  import { mergeSchemas } from '@graphql-tools/schema'
12
- import { normalizeSchema } from '@contember/schema-utils'
12
+ import { emptySchema, normalizeSchema } from '@contember/schema-utils'
13
13
  import { SchemaLoader } from '../../lib/schema/SchemaLoader'
14
14
  import { SchemaVersionBuilder } from '@contember/migrations-client'
15
15
  import { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'
@@ -22,6 +22,10 @@ type Options = {
22
22
  normalize?: boolean
23
23
  format?: 'graphql' | 'introspection' | 'schema'
24
24
  source?: 'migrations' | 'definition'
25
+ ['omit-acl']?: boolean
26
+ ['omit-validation']?: boolean
27
+ ['omit-actions']?: boolean
28
+ ['omit-settings']?: boolean
25
29
  }
26
30
 
27
31
  export class ProjectPrintSchemaCommand extends Command<Args, Options> {
@@ -38,6 +42,10 @@ export class ProjectPrintSchemaCommand extends Command<Args, Options> {
38
42
  configuration.option('source').valueRequired().description('migrations|definition')
39
43
  configuration.option('role').valueArray()
40
44
  configuration.option('normalize').valueNone()
45
+ configuration.option('omit-acl').valueNone()
46
+ configuration.option('omit-validation').valueNone()
47
+ configuration.option('omit-actions').valueNone()
48
+ configuration.option('omit-settings').valueNone()
41
49
  }
42
50
 
43
51
  protected async execute(input: Input<Args, Options>): Promise<number> {
@@ -48,13 +56,21 @@ export class ProjectPrintSchemaCommand extends Command<Args, Options> {
48
56
  ? await this.schemaVersionBuilder.buildSchema()
49
57
  : await this.schemaLoader.loadSchema()
50
58
 
51
- if (!validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')) {
59
+ const filteredSchema = {
60
+ model: schema.model,
61
+ acl: input.getOption('omit-acl') ? emptySchema.acl : schema.acl,
62
+ validation: input.getOption('omit-validation') ? emptySchema.validation : schema.validation,
63
+ actions: input.getOption('omit-actions') ? emptySchema.actions : schema.actions,
64
+ settings: input.getOption('omit-settings') ? emptySchema.settings : schema.settings,
65
+ }
66
+
67
+ if (!validateSchemaAndPrintErrors(filteredSchema, 'Defined schema is invalid:')) {
52
68
  return 1
53
69
  }
54
70
 
55
71
  const permissionFactory = new PermissionFactory()
56
72
  const inputRoles = input.getOption('role')
57
- const schemaNormalized = input.getOption('normalize') ? normalizeSchema(schema) : schema
73
+ const schemaNormalized = input.getOption('normalize') ? normalizeSchema(filteredSchema) : filteredSchema
58
74
  const permissions = permissionFactory.create(schemaNormalized, inputRoles || ['admin'])
59
75
  const schemaBuilderFactory = new GraphQlSchemaBuilderFactory()
60
76
  const authorizator = new Authorizator(permissions, schemaNormalized.acl.customPrimary ?? false)