@contember/schema-utils 1.4.0-beta.2 → 1.4.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/src/definition-generator/AclDefinitionCodeGenerator.js +4 -4
  2. package/dist/src/definition-generator/AclDefinitionCodeGenerator.js.map +1 -1
  3. package/dist/src/definition-generator/DefinitionCodeGenerator.js +6 -6
  4. package/dist/src/definition-generator/DefinitionCodeGenerator.js.map +1 -1
  5. package/dist/src/tsconfig.tsbuildinfo +1 -1
  6. package/dist/tests/cases/unit/schemas/acl.d.ts +7 -8
  7. package/dist/tests/cases/unit/schemas/acl.d.ts.map +1 -1
  8. package/dist/tests/cases/unit/schemas/acl.js +11 -11
  9. package/dist/tests/cases/unit/schemas/acl.js.map +1 -1
  10. package/dist/tests/cases/unit/schemas/basic.d.ts +1 -2
  11. package/dist/tests/cases/unit/schemas/basic.d.ts.map +1 -1
  12. package/dist/tests/cases/unit/schemas/basic.js +1 -1
  13. package/dist/tests/cases/unit/schemas/basic.js.map +1 -1
  14. package/dist/tests/cases/unit/schemas/enum.d.ts +3 -4
  15. package/dist/tests/cases/unit/schemas/enum.d.ts.map +1 -1
  16. package/dist/tests/cases/unit/schemas/enum.js +3 -3
  17. package/dist/tests/cases/unit/schemas/enum.js.map +1 -1
  18. package/dist/tests/cases/unit/schemas/relations.d.ts +7 -8
  19. package/dist/tests/cases/unit/schemas/relations.d.ts.map +1 -1
  20. package/dist/tests/cases/unit/schemas/relations.js +7 -7
  21. package/dist/tests/cases/unit/schemas/relations.js.map +1 -1
  22. package/dist/tests/cases/unit/schemas/unique.d.ts +1 -2
  23. package/dist/tests/cases/unit/schemas/unique.d.ts.map +1 -1
  24. package/dist/tests/cases/unit/schemas/unique.js +2 -2
  25. package/dist/tests/cases/unit/schemas/unique.js.map +1 -1
  26. package/dist/tests/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +4 -4
  28. package/src/definition-generator/AclDefinitionCodeGenerator.ts +4 -4
  29. package/src/definition-generator/DefinitionCodeGenerator.ts +6 -6
  30. package/tests/cases/unit/__snapshots__/laxSchemaConverter.test.ts.snap +1 -1
  31. package/tests/cases/unit/schemas/acl.ts +12 -12
  32. package/tests/cases/unit/schemas/basic.ts +2 -2
  33. package/tests/cases/unit/schemas/enum.ts +4 -4
  34. package/tests/cases/unit/schemas/relations.ts +8 -8
  35. package/tests/cases/unit/schemas/unique.ts +3 -3
@@ -1,34 +1,34 @@
1
- import { SchemaDefinition as def, AclDefinition as acl } from '@contember/schema-definition'
1
+ import { c } from '@contember/schema-definition'
2
2
 
3
- export const readerRole = acl.createRole('reader', { stages: '*' })
3
+ export const readerRole = c.createRole('reader', { stages: '*' })
4
4
 
5
- export const editorRole = acl.createRole('editor', { stages: '*' })
5
+ export const editorRole = c.createRole('editor', { stages: '*' })
6
6
 
7
- export const categoryEditorVariable = acl.createEntityVariable('category', 'Category', editorRole)
7
+ export const categoryEditorVariable = c.createEntityVariable('category', 'Category', editorRole)
8
8
 
9
9
 
10
- @acl.allow(readerRole, {
10
+ @c.Allow(readerRole, {
11
11
  read: true,
12
12
  })
13
- @acl.allow(editorRole, {
13
+ @c.Allow(editorRole, {
14
14
  when: { category: { id: categoryEditorVariable } },
15
15
  read: true,
16
16
  create: ['title', 'category'],
17
17
  update: ['title', 'category'],
18
18
  })
19
19
  export class Article {
20
- title = def.stringColumn()
21
- deletedAt = def.dateTimeColumn()
22
- category = def.manyHasOne(Category)
20
+ title = c.stringColumn()
21
+ deletedAt = c.dateTimeColumn()
22
+ category = c.manyHasOne(Category)
23
23
  }
24
24
 
25
25
 
26
- @acl.allow(readerRole, {
26
+ @c.Allow(readerRole, {
27
27
  read: true,
28
28
  })
29
- @acl.allow(editorRole, {
29
+ @c.Allow(editorRole, {
30
30
  read: true,
31
31
  })
32
32
  export class Category {
33
- name = def.stringColumn()
33
+ name = c.stringColumn()
34
34
  }
@@ -1,5 +1,5 @@
1
- import { SchemaDefinition as def, AclDefinition as acl } from '@contember/schema-definition'
1
+ import { c } from '@contember/schema-definition'
2
2
 
3
3
  export class Article {
4
- title = def.stringColumn()
4
+ title = c.stringColumn()
5
5
  }
@@ -1,8 +1,8 @@
1
- import { SchemaDefinition as def, AclDefinition as acl } from '@contember/schema-definition'
1
+ import { c } from '@contember/schema-definition'
2
2
 
3
- export const articleState = def.createEnum('draft', 'published')
3
+ export const articleState = c.createEnum('draft', 'published')
4
4
 
5
5
  export class Article {
6
- title = def.stringColumn()
7
- state = def.enumColumn(articleState).notNull().default('draft')
6
+ title = c.stringColumn()
7
+ state = c.enumColumn(articleState).notNull().default('draft')
8
8
  }
@@ -1,17 +1,17 @@
1
- import { SchemaDefinition as def, AclDefinition as acl } from '@contember/schema-definition'
1
+ import { c } from '@contember/schema-definition'
2
2
 
3
3
  export class Article {
4
- title = def.stringColumn()
5
- category = def.manyHasOne(Category, 'articles')
6
- tags = def.manyHasMany(Tag, 'articles')
4
+ title = c.stringColumn()
5
+ category = c.manyHasOne(Category, 'articles')
6
+ tags = c.manyHasMany(Tag, 'articles')
7
7
  }
8
8
 
9
9
  export class Category {
10
- name = def.stringColumn()
11
- articles = def.oneHasMany(Article, 'category')
10
+ name = c.stringColumn()
11
+ articles = c.oneHasMany(Article, 'category')
12
12
  }
13
13
 
14
14
  export class Tag {
15
- name = def.stringColumn()
16
- tags = def.manyHasManyInverse(Article, 'tags')
15
+ name = c.stringColumn()
16
+ tags = c.manyHasManyInverse(Article, 'tags')
17
17
  }
@@ -1,6 +1,6 @@
1
- import { SchemaDefinition as def, AclDefinition as acl } from '@contember/schema-definition'
1
+ import { c } from '@contember/schema-definition'
2
2
 
3
- @def.Unique('title')
3
+ @c.Unique('title')
4
4
  export class Article {
5
- title = def.stringColumn()
5
+ title = c.stringColumn()
6
6
  }