@contember/cli 1.1.0-alpha.7 → 1.1.0-beta.1
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/src/commands/deploy/DeployCommand.d.ts.map +1 -1
- package/dist/src/commands/deploy/DeployCommand.js +4 -3
- package/dist/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationAmendCommand.js +2 -2
- package/dist/src/commands/migrations/MigrationAmendCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationDiffCommand.js +2 -2
- package/dist/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
- package/dist/src/commands/project/ProjectGenerateDocumentation.d.ts +13 -0
- package/dist/src/commands/project/ProjectGenerateDocumentation.d.ts.map +1 -0
- package/dist/src/commands/project/ProjectGenerateDocumentation.js +39 -0
- package/dist/src/commands/project/ProjectGenerateDocumentation.js.map +1 -0
- package/dist/src/commands/project/ProjectPrintSchemaCommand.d.ts +1 -1
- package/dist/src/commands/project/ProjectPrintSchemaCommand.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectPrintSchemaCommand.js +15 -7
- package/dist/src/commands/project/ProjectPrintSchemaCommand.js.map +1 -1
- package/dist/src/commands/project/ProjectValidateCommand.js +2 -2
- package/dist/src/commands/project/ProjectValidateCommand.js.map +1 -1
- package/dist/src/commands/project/index.d.ts +1 -0
- package/dist/src/commands/project/index.d.ts.map +1 -1
- package/dist/src/commands/project/index.js +1 -0
- package/dist/src/commands/project/index.js.map +1 -1
- package/dist/src/run.js +1 -0
- package/dist/src/run.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/utils/project/components/EntityInfo.d.ts +11 -0
- package/dist/src/utils/project/components/EntityInfo.d.ts.map +1 -0
- package/dist/src/utils/project/components/EntityInfo.js +54 -0
- package/dist/src/utils/project/components/EntityInfo.js.map +1 -0
- package/dist/src/utils/project/components/EntityLink.d.ts +5 -0
- package/dist/src/utils/project/components/EntityLink.d.ts.map +1 -0
- package/dist/src/utils/project/components/EntityLink.js +8 -0
- package/dist/src/utils/project/components/EntityLink.js.map +1 -0
- package/dist/src/utils/project/components/FieldLink.d.ts +7 -0
- package/dist/src/utils/project/components/FieldLink.d.ts.map +1 -0
- package/dist/src/utils/project/components/FieldLink.js +13 -0
- package/dist/src/utils/project/components/FieldLink.js.map +1 -0
- package/dist/src/utils/project/components/FieldPermissions.d.ts +7 -0
- package/dist/src/utils/project/components/FieldPermissions.d.ts.map +1 -0
- package/dist/src/utils/project/components/FieldPermissions.js +17 -0
- package/dist/src/utils/project/components/FieldPermissions.js.map +1 -0
- package/dist/src/utils/project/components/FieldType.d.ts +6 -0
- package/dist/src/utils/project/components/FieldType.d.ts.map +1 -0
- package/dist/src/utils/project/components/FieldType.js +59 -0
- package/dist/src/utils/project/components/FieldType.js.map +1 -0
- package/dist/src/utils/project/components/OnDelete.d.ts +9 -0
- package/dist/src/utils/project/components/OnDelete.d.ts.map +1 -0
- package/dist/src/utils/project/components/OnDelete.js +70 -0
- package/dist/src/utils/project/components/OnDelete.js.map +1 -0
- package/dist/src/utils/project/components/ProjectInfo.d.ts +7 -0
- package/dist/src/utils/project/components/ProjectInfo.d.ts.map +1 -0
- package/dist/src/utils/project/components/ProjectInfo.js +28 -0
- package/dist/src/utils/project/components/ProjectInfo.js.map +1 -0
- package/dist/src/utils/project/components/SinglePermission.d.ts +7 -0
- package/dist/src/utils/project/components/SinglePermission.d.ts.map +1 -0
- package/dist/src/utils/project/components/SinglePermission.js +15 -0
- package/dist/src/utils/project/components/SinglePermission.js.map +1 -0
- package/dist/src/utils/project/components/utils.d.ts +3 -0
- package/dist/src/utils/project/components/utils.d.ts.map +1 -0
- package/dist/src/utils/project/components/utils.js +8 -0
- package/dist/src/utils/project/components/utils.js.map +1 -0
- package/dist/src/utils/{project.d.ts → project/loadSchema.d.ts} +1 -1
- package/dist/src/utils/project/loadSchema.d.ts.map +1 -0
- package/dist/src/utils/{project.js → project/loadSchema.js} +1 -1
- package/dist/src/utils/project/loadSchema.js.map +1 -0
- package/dist/src/utils/project/projectDescribe.d.ts +3 -0
- package/dist/src/utils/project/projectDescribe.d.ts.map +1 -0
- package/dist/src/utils/project/projectDescribe.js +29 -0
- package/dist/src/utils/project/projectDescribe.js.map +1 -0
- package/dist/src/utils/project/resources/out.css +759 -0
- package/dist/src/utils/schema/collectReferences.d.ts +10 -0
- package/dist/src/utils/schema/collectReferences.d.ts.map +1 -0
- package/dist/src/utils/schema/collectReferences.js +35 -0
- package/dist/src/utils/schema/collectReferences.js.map +1 -0
- package/package.json +17 -11
- package/postcss.config.js +6 -0
- package/src/commands/deploy/DeployCommand.ts +4 -3
- package/src/commands/migrations/MigrationAmendCommand.ts +1 -1
- package/src/commands/migrations/MigrationDiffCommand.ts +1 -1
- package/src/commands/project/ProjectGenerateDocumentation.ts +44 -0
- package/src/commands/project/ProjectPrintSchemaCommand.ts +13 -7
- package/src/commands/project/ProjectValidateCommand.ts +1 -1
- package/src/commands/project/index.ts +1 -0
- package/src/run.ts +2 -0
- package/src/tsconfig.json +5 -1
- package/src/utils/project/components/EntityInfo.tsx +82 -0
- package/src/utils/project/components/EntityLink.tsx +6 -0
- package/src/utils/project/components/FieldLink.tsx +10 -0
- package/src/utils/project/components/FieldPermissions.tsx +14 -0
- package/src/utils/project/components/FieldType.tsx +54 -0
- package/src/utils/project/components/OnDelete.tsx +72 -0
- package/src/utils/project/components/ProjectInfo.tsx +48 -0
- package/src/utils/project/components/SinglePermission.tsx +13 -0
- package/src/utils/project/components/utils.ts +3 -0
- package/src/utils/{project.ts → project/loadSchema.ts} +0 -0
- package/src/utils/project/projectDescribe.tsx +26 -0
- package/src/utils/project/resources/style.css +3 -0
- package/src/utils/schema/collectReferences.ts +40 -0
- package/tailwind.config.js +7 -0
- package/dist/src/utils/project.d.ts.map +0 -1
- package/dist/src/utils/project.js.map +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Model } from '@contember/schema'
|
|
2
|
+
|
|
3
|
+
export type ReferenceMapEntry = {
|
|
4
|
+
owningEntity: Model.Entity
|
|
5
|
+
owningRelation: Model.OneHasOneOwningRelation | Model.ManyHasOneRelation
|
|
6
|
+
targetEntity: Model.Entity
|
|
7
|
+
targetRelation: Model.OneHasOneInverseRelation | Model.OneHasManyRelation | null
|
|
8
|
+
}
|
|
9
|
+
export type ReferencesMap = Record<string, ReferenceMapEntry[]>
|
|
10
|
+
|
|
11
|
+
export const collectReferences = (model: Model.Schema): ReferencesMap => {
|
|
12
|
+
const entityReferences: ReferencesMap = Object.fromEntries(Object.keys(model.entities).map(it => [it, []]))
|
|
13
|
+
for (const entity of Object.values(model.entities)) {
|
|
14
|
+
for (const field of Object.values(entity.fields)) {
|
|
15
|
+
switch (field.type) {
|
|
16
|
+
case 'OneHasOne':
|
|
17
|
+
const targetEntity = model.entities[field.target]
|
|
18
|
+
if (!('ownedBy' in field)) {
|
|
19
|
+
entityReferences[field.target].push({
|
|
20
|
+
owningEntity: entity,
|
|
21
|
+
owningRelation: field,
|
|
22
|
+
targetEntity: targetEntity,
|
|
23
|
+
targetRelation: field.inversedBy ? targetEntity.fields[field.inversedBy] as Model.OneHasOneInverseRelation : null,
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
break
|
|
27
|
+
case 'ManyHasOne':
|
|
28
|
+
const targetEntity2 = model.entities[field.target]
|
|
29
|
+
entityReferences[field.target].push({
|
|
30
|
+
owningEntity: entity,
|
|
31
|
+
owningRelation: field,
|
|
32
|
+
targetEntity: targetEntity2,
|
|
33
|
+
targetRelation: field.inversedBy ? targetEntity2.fields[field.inversedBy] as Model.OneHasManyRelation : null,
|
|
34
|
+
})
|
|
35
|
+
break
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return entityReferences
|
|
40
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/utils/project.ts"],"names":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