@party-stack/ontology 0.19.0 → 0.20.0
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/lib/OntologyPullConfig.d.ts +15 -13
- package/lib/OntologyPullConfig.d.ts.map +1 -1
- package/lib/OntologyPullConfig.js +0 -1
- package/lib/cli/format.d.ts +4 -0
- package/lib/cli/format.d.ts.map +1 -0
- package/lib/cli/format.js +19 -0
- package/lib/cli/format.js.map +1 -0
- package/lib/cli/generate.d.ts +6 -5
- package/lib/cli/generate.d.ts.map +1 -1
- package/lib/cli/generate.js +86 -110
- package/lib/cli/generate.js.map +1 -1
- package/lib/cli/index.d.ts +1 -3
- package/lib/cli/index.js +42 -59
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/pull.d.ts +3 -1
- package/lib/cli/pull.d.ts.map +1 -1
- package/lib/cli/pull.js +42 -60
- package/lib/cli/pull.js.map +1 -1
- package/lib/examples/blog.d.ts +347 -345
- package/lib/examples/blog.d.ts.map +1 -1
- package/lib/examples/blog.js +350 -337
- package/lib/examples/blog.js.map +1 -1
- package/lib/examples/blog.live-queries.d.ts +8 -3
- package/lib/examples/blog.live-queries.d.ts.map +1 -1
- package/lib/examples/blog.live-queries.js +28 -44
- package/lib/examples/blog.live-queries.js.map +1 -1
- package/lib/examples/generated/constants.d.ts +1 -2
- package/lib/examples/generated/constants.js +0 -2
- package/lib/examples/generated/live.d.ts +5 -3
- package/lib/examples/generated/live.d.ts.map +1 -1
- package/lib/examples/generated/live.js +12 -8
- package/lib/examples/generated/live.js.map +1 -1
- package/lib/examples/generated/types.d.ts +52 -50
- package/lib/examples/generated/types.d.ts.map +1 -1
- package/lib/examples/generated/types.js +0 -2
- package/lib/generate/builders.d.ts +8 -5
- package/lib/generate/builders.d.ts.map +1 -1
- package/lib/generate/builders.js +53 -55
- package/lib/generate/builders.js.map +1 -1
- package/lib/generate/constants.d.ts +3 -1
- package/lib/generate/constants.d.ts.map +1 -1
- package/lib/generate/constants.js +23 -26
- package/lib/generate/constants.js.map +1 -1
- package/lib/generate/index.d.ts +6 -6
- package/lib/generate/index.js +6 -6
- package/lib/generate/live.d.ts +8 -6
- package/lib/generate/live.d.ts.map +1 -1
- package/lib/generate/live.js +43 -42
- package/lib/generate/live.js.map +1 -1
- package/lib/generate/ontology.d.ts +4 -2
- package/lib/generate/ontology.d.ts.map +1 -1
- package/lib/generate/ontology.js +453 -354
- package/lib/generate/ontology.js.map +1 -1
- package/lib/generate/types.d.ts +7 -5
- package/lib/generate/types.d.ts.map +1 -1
- package/lib/generate/types.js +190 -262
- package/lib/generate/types.js.map +1 -1
- package/lib/generate/utils/buildJsDocs.d.ts +7 -4
- package/lib/generate/utils/buildJsDocs.d.ts.map +1 -1
- package/lib/generate/utils/buildJsDocs.js +14 -10
- package/lib/generate/utils/buildJsDocs.js.map +1 -1
- package/lib/index.d.ts +30 -13
- package/lib/index.js +18 -10
- package/lib/infer.d.ts +129 -151
- package/lib/infer.d.ts.map +1 -1
- package/lib/infer.js +10 -6
- package/lib/infer.js.map +1 -1
- package/lib/installation/createMetaOntologyConfiguration.d.ts +6 -3
- package/lib/installation/createMetaOntologyConfiguration.d.ts.map +1 -1
- package/lib/installation/createMetaOntologyConfiguration.js +13 -11
- package/lib/installation/createMetaOntologyConfiguration.js.map +1 -1
- package/lib/installation/createOntologyBackendInstallation.d.ts +3 -1
- package/lib/installation/createOntologyBackendInstallation.d.ts.map +1 -1
- package/lib/installation/createOntologyBackendInstallation.js +205 -268
- package/lib/installation/createOntologyBackendInstallation.js.map +1 -1
- package/lib/installation/index.d.ts +4 -4
- package/lib/installation/index.js +3 -3
- package/lib/installation/types.d.ts +83 -80
- package/lib/installation/types.d.ts.map +1 -1
- package/lib/installation/types.js +0 -1
- package/lib/ir/generated/builders.d.ts +294 -382
- package/lib/ir/generated/builders.d.ts.map +1 -1
- package/lib/ir/generated/builders.js +180 -119
- package/lib/ir/generated/builders.js.map +1 -1
- package/lib/ir/generated/constants.d.ts +137 -135
- package/lib/ir/generated/constants.d.ts.map +1 -1
- package/lib/ir/generated/constants.js +162 -129
- package/lib/ir/generated/constants.js.map +1 -1
- package/lib/ir/generated/types.d.ts +236 -234
- package/lib/ir/generated/types.d.ts.map +1 -1
- package/lib/ir/generated/types.js +0 -2
- package/lib/ir/index.d.ts +4 -4
- package/lib/ir/index.js +3 -4
- package/lib/ir/schema.d.ts +2174 -2172
- package/lib/ir/schema.d.ts.map +1 -1
- package/lib/ir/schema.js +1184 -1343
- package/lib/ir/schema.js.map +1 -1
- package/lib/ir/validate.d.ts +5 -3
- package/lib/ir/validate.d.ts.map +1 -1
- package/lib/ir/validate.js +589 -707
- package/lib/ir/validate.js.map +1 -1
- package/lib/json/index.d.ts +10 -8
- package/lib/json/index.d.ts.map +1 -1
- package/lib/json/index.js +101 -135
- package/lib/json/index.js.map +1 -1
- package/lib/lenses.d.ts +7 -4
- package/lib/lenses.d.ts.map +1 -1
- package/lib/lenses.js +96 -132
- package/lib/lenses.js.map +1 -1
- package/lib/live/LiveOntology.d.ts +55 -60
- package/lib/live/LiveOntology.d.ts.map +1 -1
- package/lib/live/LiveOntology.js +98 -124
- package/lib/live/LiveOntology.js.map +1 -1
- package/lib/live/OntologyBackendAdapter.d.ts +84 -77
- package/lib/live/OntologyBackendAdapter.d.ts.map +1 -1
- package/lib/live/OntologyBackendAdapter.js +0 -1
- package/lib/live/actions/createLiveOntologyAction.d.ts +27 -24
- package/lib/live/actions/createLiveOntologyAction.d.ts.map +1 -1
- package/lib/live/actions/createLiveOntologyAction.js +24 -21
- package/lib/live/actions/createLiveOntologyAction.js.map +1 -1
- package/lib/live/actions/createLiveOntologyActions.d.ts +23 -20
- package/lib/live/actions/createLiveOntologyActions.d.ts.map +1 -1
- package/lib/live/actions/createLiveOntologyActions.js +131 -161
- package/lib/live/actions/createLiveOntologyActions.js.map +1 -1
- package/lib/live/actions/prepareActionParameters.d.ts +14 -11
- package/lib/live/actions/prepareActionParameters.d.ts.map +1 -1
- package/lib/live/actions/prepareActionParameters.js +190 -228
- package/lib/live/actions/prepareActionParameters.js.map +1 -1
- package/lib/live/attachments/attachmentSources.d.ts +7 -4
- package/lib/live/attachments/attachmentSources.d.ts.map +1 -1
- package/lib/live/attachments/attachmentSources.js +55 -71
- package/lib/live/attachments/attachmentSources.js.map +1 -1
- package/lib/live/attachments/createLiveOntologyAttachments.d.ts +47 -44
- package/lib/live/attachments/createLiveOntologyAttachments.d.ts.map +1 -1
- package/lib/live/attachments/createLiveOntologyAttachments.js +65 -83
- package/lib/live/attachments/createLiveOntologyAttachments.js.map +1 -1
- package/lib/live/attachments/types.d.ts +10 -8
- package/lib/live/attachments/types.d.ts.map +1 -1
- package/lib/live/attachments/types.js +0 -1
- package/lib/live/attachments/unsupportedOntologyAttachmentsAdapter.d.ts +3 -1
- package/lib/live/attachments/unsupportedOntologyAttachmentsAdapter.d.ts.map +1 -1
- package/lib/live/attachments/unsupportedOntologyAttachmentsAdapter.js +5 -3
- package/lib/live/attachments/unsupportedOntologyAttachmentsAdapter.js.map +1 -1
- package/lib/live/expression.d.ts +16 -13
- package/lib/live/expression.d.ts.map +1 -1
- package/lib/live/expression.js +142 -223
- package/lib/live/expression.js.map +1 -1
- package/lib/live/index.d.ts +12 -9
- package/lib/live/index.js +6 -8
- package/lib/live/mutators/OntologyEdits.d.ts +12 -9
- package/lib/live/mutators/OntologyEdits.d.ts.map +1 -1
- package/lib/live/mutators/OntologyEdits.js +57 -74
- package/lib/live/mutators/OntologyEdits.js.map +1 -1
- package/lib/live/mutators/createMutatorTx.d.ts +7 -5
- package/lib/live/mutators/createMutatorTx.d.ts.map +1 -1
- package/lib/live/mutators/createMutatorTx.js +53 -69
- package/lib/live/mutators/createMutatorTx.js.map +1 -1
- package/lib/live/mutators/runOptimisticAction.d.ts +16 -13
- package/lib/live/mutators/runOptimisticAction.d.ts.map +1 -1
- package/lib/live/mutators/runOptimisticAction.js +26 -26
- package/lib/live/mutators/runOptimisticAction.js.map +1 -1
- package/lib/live/mutators/types.d.ts +18 -16
- package/lib/live/mutators/types.d.ts.map +1 -1
- package/lib/live/mutators/types.js +0 -1
- package/lib/live/objects/OntologyObject.d.ts +2 -0
- package/lib/live/objects/OntologyObject.d.ts.map +1 -1
- package/lib/live/objects/OntologyObject.js +0 -1
- package/lib/live/objects/createLiveOntologyObjectCollection.d.ts +14 -11
- package/lib/live/objects/createLiveOntologyObjectCollection.d.ts.map +1 -1
- package/lib/live/objects/createLiveOntologyObjectCollection.js +62 -49
- package/lib/live/objects/createLiveOntologyObjectCollection.js.map +1 -1
- package/lib/live/objects/ontologyObjectCollectionId.d.ts +2 -0
- package/lib/live/objects/ontologyObjectCollectionId.d.ts.map +1 -1
- package/lib/live/objects/ontologyObjectCollectionId.js +6 -2
- package/lib/live/objects/ontologyObjectCollectionId.js.map +1 -1
- package/lib/live/outbox/createOntologyOutbox.d.ts +16 -14
- package/lib/live/outbox/createOntologyOutbox.d.ts.map +1 -1
- package/lib/live/outbox/createOntologyOutbox.js +275 -326
- package/lib/live/outbox/createOntologyOutbox.js.map +1 -1
- package/lib/live/outbox/leaderExecutor.d.ts +15 -13
- package/lib/live/outbox/leaderExecutor.d.ts.map +1 -1
- package/lib/live/outbox/leaderExecutor.js +114 -153
- package/lib/live/outbox/leaderExecutor.js.map +1 -1
- package/lib/live/outbox/outboxService.d.ts +4 -2
- package/lib/live/outbox/outboxService.d.ts.map +1 -1
- package/lib/live/outbox/outboxService.js +66 -71
- package/lib/live/outbox/outboxService.js.map +1 -1
- package/lib/live/outbox/projectionManager.d.ts +26 -24
- package/lib/live/outbox/projectionManager.d.ts.map +1 -1
- package/lib/live/outbox/projectionManager.js +121 -147
- package/lib/live/outbox/projectionManager.js.map +1 -1
- package/lib/live/outbox/repository.d.ts +27 -25
- package/lib/live/outbox/repository.d.ts.map +1 -1
- package/lib/live/outbox/repository.js +192 -241
- package/lib/live/outbox/repository.js.map +1 -1
- package/lib/live/outbox/service.d.ts +52 -50
- package/lib/live/outbox/service.d.ts.map +1 -1
- package/lib/live/outbox/service.js +5 -1
- package/lib/live/outbox/service.js.map +1 -1
- package/lib/live/outbox/types.d.ts +35 -33
- package/lib/live/outbox/types.d.ts.map +1 -1
- package/lib/live/outbox/types.js +10 -6
- package/lib/live/outbox/types.js.map +1 -1
- package/lib/live/waitForCollectionReady.d.ts +3 -1
- package/lib/live/waitForCollectionReady.d.ts.map +1 -1
- package/lib/live/waitForCollectionReady.js +44 -65
- package/lib/live/waitForCollectionReady.js.map +1 -1
- package/lib/meta/createLocalMetaOntologyBackendAdapter.d.ts +5 -2
- package/lib/meta/createLocalMetaOntologyBackendAdapter.d.ts.map +1 -1
- package/lib/meta/createLocalMetaOntologyBackendAdapter.js +37 -39
- package/lib/meta/createLocalMetaOntologyBackendAdapter.js.map +1 -1
- package/lib/meta/generated/constants.d.ts +137 -135
- package/lib/meta/generated/constants.d.ts.map +1 -1
- package/lib/meta/generated/constants.js +162 -129
- package/lib/meta/generated/constants.js.map +1 -1
- package/lib/meta/generated/live.d.ts +5 -2
- package/lib/meta/generated/live.d.ts.map +1 -1
- package/lib/meta/generated/live.js +12 -8
- package/lib/meta/generated/live.js.map +1 -1
- package/lib/meta/generated/types.d.ts +233 -231
- package/lib/meta/generated/types.d.ts.map +1 -1
- package/lib/meta/generated/types.js +0 -2
- package/lib/meta/ontology.d.ts +23 -21
- package/lib/meta/ontology.d.ts.map +1 -1
- package/lib/meta/ontology.js +100 -104
- package/lib/meta/ontology.js.map +1 -1
- package/lib/meta/pull.d.ts +8 -6
- package/lib/meta/pull.d.ts.map +1 -1
- package/lib/meta/pull.js +39 -52
- package/lib/meta/pull.js.map +1 -1
- package/lib/utils/index.d.ts +8 -8
- package/lib/utils/index.js +5 -6
- package/lib/utils/links.d.ts +34 -31
- package/lib/utils/links.d.ts.map +1 -1
- package/lib/utils/links.js +10 -17
- package/lib/utils/links.js.map +1 -1
- package/lib/utils/paths.d.ts +2 -0
- package/lib/utils/paths.d.ts.map +1 -1
- package/lib/utils/paths.js +32 -44
- package/lib/utils/paths.js.map +1 -1
- package/lib/utils/provide.d.ts +2 -0
- package/lib/utils/provide.d.ts.map +1 -1
- package/lib/utils/provide.js +7 -9
- package/lib/utils/provide.js.map +1 -1
- package/lib/utils/targets.d.ts +20 -18
- package/lib/utils/targets.d.ts.map +1 -1
- package/lib/utils/targets.js +0 -1
- package/lib/utils/typeNames.d.ts +10 -8
- package/lib/utils/typeNames.d.ts.map +1 -1
- package/lib/utils/typeNames.js +0 -1
- package/lib/utils/types.d.ts +6 -4
- package/lib/utils/types.d.ts.map +1 -1
- package/lib/utils/types.js +38 -38
- package/lib/utils/types.js.map +1 -1
- package/lib/utils/uncertain.d.ts +5 -3
- package/lib/utils/uncertain.d.ts.map +1 -1
- package/lib/utils/uncertain.js +11 -9
- package/lib/utils/uncertain.js.map +1 -1
- package/lib/utils/validation.d.ts +4 -2
- package/lib/utils/validation.d.ts.map +1 -1
- package/lib/utils/validation.js +0 -1
- package/lib/utils/values.d.ts +18 -18
- package/lib/utils/values.d.ts.map +1 -1
- package/lib/utils/values.js +0 -1
- package/package.json +22 -26
- package/lib/OntologyPullConfig.js.map +0 -1
- package/lib/cli/index.d.ts.map +0 -1
- package/lib/cli/index.test.d.ts +0 -2
- package/lib/cli/index.test.d.ts.map +0 -1
- package/lib/cli/index.test.js +0 -34
- package/lib/cli/index.test.js.map +0 -1
- package/lib/cli/pull.test.d.ts +0 -2
- package/lib/cli/pull.test.d.ts.map +0 -1
- package/lib/cli/pull.test.js +0 -125
- package/lib/cli/pull.test.js.map +0 -1
- package/lib/examples/generated/constants.d.ts.map +0 -1
- package/lib/examples/generated/constants.js.map +0 -1
- package/lib/examples/generated/types.js.map +0 -1
- package/lib/generate/builders.test.d.ts +0 -2
- package/lib/generate/builders.test.d.ts.map +0 -1
- package/lib/generate/builders.test.js +0 -49
- package/lib/generate/builders.test.js.map +0 -1
- package/lib/generate/index.d.ts.map +0 -1
- package/lib/generate/index.js.map +0 -1
- package/lib/generate/live.test.d.ts +0 -2
- package/lib/generate/live.test.d.ts.map +0 -1
- package/lib/generate/live.test.js +0 -22
- package/lib/generate/live.test.js.map +0 -1
- package/lib/generate/ontology.test.d.ts +0 -2
- package/lib/generate/ontology.test.d.ts.map +0 -1
- package/lib/generate/ontology.test.js +0 -157
- package/lib/generate/ontology.test.js.map +0 -1
- package/lib/generate/types.test.d.ts +0 -2
- package/lib/generate/types.test.d.ts.map +0 -1
- package/lib/generate/types.test.js +0 -304
- package/lib/generate/types.test.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/infer.test.d.ts +0 -2
- package/lib/infer.test.d.ts.map +0 -1
- package/lib/infer.test.js +0 -125
- package/lib/infer.test.js.map +0 -1
- package/lib/installation/createMetaOntologyConfiguration.test.d.ts +0 -2
- package/lib/installation/createMetaOntologyConfiguration.test.d.ts.map +0 -1
- package/lib/installation/createMetaOntologyConfiguration.test.js +0 -20
- package/lib/installation/createMetaOntologyConfiguration.test.js.map +0 -1
- package/lib/installation/createOntologyBackendInstallation.test.d.ts +0 -2
- package/lib/installation/createOntologyBackendInstallation.test.d.ts.map +0 -1
- package/lib/installation/createOntologyBackendInstallation.test.js +0 -320
- package/lib/installation/createOntologyBackendInstallation.test.js.map +0 -1
- package/lib/installation/index.d.ts.map +0 -1
- package/lib/installation/index.js.map +0 -1
- package/lib/installation/types.js.map +0 -1
- package/lib/ir/generated/types.js.map +0 -1
- package/lib/ir/index.d.ts.map +0 -1
- package/lib/ir/index.js.map +0 -1
- package/lib/ir/validate.test.d.ts +0 -2
- package/lib/ir/validate.test.d.ts.map +0 -1
- package/lib/ir/validate.test.js +0 -1061
- package/lib/ir/validate.test.js.map +0 -1
- package/lib/json/index.test.d.ts +0 -2
- package/lib/json/index.test.d.ts.map +0 -1
- package/lib/json/index.test.js +0 -142
- package/lib/json/index.test.js.map +0 -1
- package/lib/lenses.test.d.ts +0 -2
- package/lib/lenses.test.d.ts.map +0 -1
- package/lib/lenses.test.js +0 -80
- package/lib/lenses.test.js.map +0 -1
- package/lib/live/LiveOntology.test.d.ts +0 -2
- package/lib/live/LiveOntology.test.d.ts.map +0 -1
- package/lib/live/LiveOntology.test.js +0 -507
- package/lib/live/LiveOntology.test.js.map +0 -1
- package/lib/live/OntologyBackendAdapter.js.map +0 -1
- package/lib/live/actions/createLiveOntologyAction.test.d.ts +0 -2
- package/lib/live/actions/createLiveOntologyAction.test.d.ts.map +0 -1
- package/lib/live/actions/createLiveOntologyAction.test.js +0 -232
- package/lib/live/actions/createLiveOntologyAction.test.js.map +0 -1
- package/lib/live/actions/prepareActionParameters.test.d.ts +0 -2
- package/lib/live/actions/prepareActionParameters.test.d.ts.map +0 -1
- package/lib/live/actions/prepareActionParameters.test.js +0 -165
- package/lib/live/actions/prepareActionParameters.test.js.map +0 -1
- package/lib/live/attachments/attachmentMetadata.test.d.ts +0 -2
- package/lib/live/attachments/attachmentMetadata.test.d.ts.map +0 -1
- package/lib/live/attachments/attachmentMetadata.test.js +0 -73
- package/lib/live/attachments/attachmentMetadata.test.js.map +0 -1
- package/lib/live/attachments/createLiveOntologyAttachments.test.d.ts +0 -2
- package/lib/live/attachments/createLiveOntologyAttachments.test.d.ts.map +0 -1
- package/lib/live/attachments/createLiveOntologyAttachments.test.js +0 -363
- package/lib/live/attachments/createLiveOntologyAttachments.test.js.map +0 -1
- package/lib/live/attachments/types.js.map +0 -1
- package/lib/live/expression.test.d.ts +0 -2
- package/lib/live/expression.test.d.ts.map +0 -1
- package/lib/live/expression.test.js +0 -311
- package/lib/live/expression.test.js.map +0 -1
- package/lib/live/index.d.ts.map +0 -1
- package/lib/live/index.js.map +0 -1
- package/lib/live/mutators/OntologyEdits.test.d.ts +0 -2
- package/lib/live/mutators/OntologyEdits.test.d.ts.map +0 -1
- package/lib/live/mutators/OntologyEdits.test.js +0 -85
- package/lib/live/mutators/OntologyEdits.test.js.map +0 -1
- package/lib/live/mutators/createMutatorTx.test.d.ts +0 -2
- package/lib/live/mutators/createMutatorTx.test.d.ts.map +0 -1
- package/lib/live/mutators/createMutatorTx.test.js +0 -180
- package/lib/live/mutators/createMutatorTx.test.js.map +0 -1
- package/lib/live/mutators/types.js.map +0 -1
- package/lib/live/objects/OntologyObject.js.map +0 -1
- package/lib/live/objects/createLiveOntologyObjectCollection.test.d.ts +0 -2
- package/lib/live/objects/createLiveOntologyObjectCollection.test.d.ts.map +0 -1
- package/lib/live/objects/createLiveOntologyObjectCollection.test.js +0 -310
- package/lib/live/objects/createLiveOntologyObjectCollection.test.js.map +0 -1
- package/lib/live/outbox/createOntologyOutbox.test.d.ts +0 -2
- package/lib/live/outbox/createOntologyOutbox.test.d.ts.map +0 -1
- package/lib/live/outbox/createOntologyOutbox.test.js +0 -1030
- package/lib/live/outbox/createOntologyOutbox.test.js.map +0 -1
- package/lib/meta/generated/types.js.map +0 -1
- package/lib/meta/ontology.test.d.ts +0 -2
- package/lib/meta/ontology.test.d.ts.map +0 -1
- package/lib/meta/ontology.test.js +0 -84
- package/lib/meta/ontology.test.js.map +0 -1
- package/lib/utils/index.d.ts.map +0 -1
- package/lib/utils/index.js.map +0 -1
- package/lib/utils/links.test.d.ts +0 -2
- package/lib/utils/links.test.d.ts.map +0 -1
- package/lib/utils/links.test.js +0 -109
- package/lib/utils/links.test.js.map +0 -1
- package/lib/utils/paths.test.d.ts +0 -2
- package/lib/utils/paths.test.d.ts.map +0 -1
- package/lib/utils/paths.test.js +0 -33
- package/lib/utils/paths.test.js.map +0 -1
- package/lib/utils/targets.js.map +0 -1
- package/lib/utils/typeNames.js.map +0 -1
- package/lib/utils/types.test.d.ts +0 -2
- package/lib/utils/types.test.d.ts.map +0 -1
- package/lib/utils/types.test.js +0 -157
- package/lib/utils/types.test.js.map +0 -1
- package/lib/utils/uncertain.test.d.ts +0 -2
- package/lib/utils/uncertain.test.d.ts.map +0 -1
- package/lib/utils/uncertain.test.js +0 -14
- package/lib/utils/uncertain.test.js.map +0 -1
- package/lib/utils/validation.js.map +0 -1
- package/lib/utils/values.js.map +0 -1
package/lib/generate/ontology.js
CHANGED
|
@@ -1,402 +1,501 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { CodeBlockWriter, Project } from "ts-morph";
|
|
3
|
+
//#region src/generate/ontology.ts
|
|
3
4
|
function withWriter(fn) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const writer = new CodeBlockWriter();
|
|
6
|
+
fn(writer);
|
|
7
|
+
return writer.toString();
|
|
7
8
|
}
|
|
8
9
|
function isIdentifier(value) {
|
|
9
|
-
|
|
10
|
+
return /^[$A-Z_a-z][$\w]*$/.test(value);
|
|
10
11
|
}
|
|
11
12
|
function writePropertyName(writer, name) {
|
|
12
|
-
|
|
13
|
+
writer.write(isIdentifier(name) ? name : JSON.stringify(name));
|
|
13
14
|
}
|
|
14
15
|
function writeArray(writer, values) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
if (values.length === 0) {
|
|
17
|
+
writer.write("[]");
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
writer.write("[");
|
|
21
|
+
writer.newLine();
|
|
22
|
+
writer.indent(() => {
|
|
23
|
+
for (const value of values) {
|
|
24
|
+
writer.write(value);
|
|
25
|
+
writer.write(",");
|
|
26
|
+
writer.newLine();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
writer.write("]");
|
|
29
30
|
}
|
|
30
31
|
function writeObject(writer, entries) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
const definedEntries = entries.filter((entry) => entry.value !== void 0);
|
|
33
|
+
if (definedEntries.length === 0) {
|
|
34
|
+
writer.write("{}");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
writer.write("{");
|
|
38
|
+
writer.newLine();
|
|
39
|
+
writer.indent(() => {
|
|
40
|
+
for (const entry of definedEntries) {
|
|
41
|
+
writePropertyName(writer, entry.name);
|
|
42
|
+
writer.write(": ");
|
|
43
|
+
writer.write(entry.value);
|
|
44
|
+
writer.write(",");
|
|
45
|
+
writer.newLine();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
writer.write("}");
|
|
48
49
|
}
|
|
49
50
|
function renderObject(entries) {
|
|
50
|
-
|
|
51
|
+
return withWriter((writer) => writeObject(writer, entries));
|
|
51
52
|
}
|
|
52
53
|
function renderPlainValue(value, ctx) {
|
|
53
|
-
|
|
54
|
+
return withWriter((writer) => writePlainValue(writer, value, ctx));
|
|
54
55
|
}
|
|
55
56
|
function writePlainValue(writer, value, ctx) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
57
|
+
if (value === null) {
|
|
58
|
+
writer.write("null");
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (value === void 0) {
|
|
62
|
+
writer.write("undefined");
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
66
|
+
writer.write(JSON.stringify(value));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (value instanceof Temporal.Instant) {
|
|
70
|
+
ctx?.markTemporalUsed();
|
|
71
|
+
writer.write(`Temporal.Instant.from(${JSON.stringify(value.toString())})`);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (value instanceof Temporal.PlainDate) {
|
|
75
|
+
ctx?.markTemporalUsed();
|
|
76
|
+
writer.write(`Temporal.PlainDate.from(${JSON.stringify(value.toString())})`);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (Array.isArray(value)) {
|
|
80
|
+
writeArray(writer, value.map((entry) => renderPlainValue(entry, ctx)));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
writeObject(writer, Object.entries(value).map(([name, entryValue]) => ({
|
|
84
|
+
name,
|
|
85
|
+
value: entryValue === void 0 ? void 0 : renderPlainValue(entryValue, ctx)
|
|
86
|
+
})));
|
|
86
87
|
}
|
|
87
88
|
function renderDeprecation(value) {
|
|
88
|
-
|
|
89
|
+
return value === void 0 ? void 0 : renderPlainValue(value);
|
|
89
90
|
}
|
|
90
91
|
function renderStringConstraint(constraint) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return `o.StringConstraint.regex(${renderPlainValue(constraint.value)})`;
|
|
96
|
-
}
|
|
92
|
+
switch (constraint.kind) {
|
|
93
|
+
case "enum": return `o.StringConstraint.enum(${renderPlainValue(constraint.value)})`;
|
|
94
|
+
case "regex": return `o.StringConstraint.regex(${renderPlainValue(constraint.value)})`;
|
|
95
|
+
}
|
|
97
96
|
}
|
|
98
97
|
function renderType(type) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
{
|
|
150
|
-
name: "variants",
|
|
151
|
-
value: withWriter((writer) => writeArray(writer, type.value.variants.map((variant) => renderVariant(variant)))),
|
|
152
|
-
},
|
|
153
|
-
])})`;
|
|
154
|
-
case "optional":
|
|
155
|
-
return `o.optional(${renderObject([{ name: "type", value: renderType(type.value.type) }])})`;
|
|
156
|
-
case "result":
|
|
157
|
-
return `o.result(${renderObject([
|
|
158
|
-
{ name: "okType", value: renderType(type.value.okType) },
|
|
159
|
-
{ name: "errType", value: renderType(type.value.errType) },
|
|
160
|
-
])})`;
|
|
161
|
-
case "ref":
|
|
162
|
-
return `o.ref(${renderPlainValue(type.value)})`;
|
|
163
|
-
}
|
|
98
|
+
switch (type.kind) {
|
|
99
|
+
case "string": return `o.string(${renderObject([{
|
|
100
|
+
name: "constraint",
|
|
101
|
+
value: type.value.constraint ? renderStringConstraint(type.value.constraint) : void 0
|
|
102
|
+
}, {
|
|
103
|
+
name: "suggestions",
|
|
104
|
+
value: type.value.suggestions ? renderPlainValue(type.value.suggestions) : void 0
|
|
105
|
+
}])})`;
|
|
106
|
+
case "boolean": return `o.boolean(${renderPlainValue(type.value)})`;
|
|
107
|
+
case "integer": return `o.integer(${renderPlainValue(type.value)})`;
|
|
108
|
+
case "float": return `o.float(${renderPlainValue(type.value)})`;
|
|
109
|
+
case "double": return `o.double(${renderPlainValue(type.value)})`;
|
|
110
|
+
case "date": return `o.date(${renderPlainValue(type.value)})`;
|
|
111
|
+
case "timestamp": return `o.timestamp(${renderPlainValue(type.value)})`;
|
|
112
|
+
case "geopoint": return `o.geopoint(${renderPlainValue(type.value)})`;
|
|
113
|
+
case "attachment": return `o.attachment(${renderPlainValue(type.value)})`;
|
|
114
|
+
case "objectReference": return `o.objectReference(${renderPlainValue(type.value)})`;
|
|
115
|
+
case "unknown": return `o.unknown(${renderPlainValue(type.value)})`;
|
|
116
|
+
case "list": return `o.list(${renderObject([{
|
|
117
|
+
name: "elementType",
|
|
118
|
+
value: renderType(type.value.elementType)
|
|
119
|
+
}])})`;
|
|
120
|
+
case "map": return `o.map(${renderObject([{
|
|
121
|
+
name: "keyType",
|
|
122
|
+
value: renderType(type.value.keyType)
|
|
123
|
+
}, {
|
|
124
|
+
name: "valueType",
|
|
125
|
+
value: renderType(type.value.valueType)
|
|
126
|
+
}])})`;
|
|
127
|
+
case "struct": return `o.struct(${renderObject([{
|
|
128
|
+
name: "fields",
|
|
129
|
+
value: withWriter((writer) => writeArray(writer, type.value.fields.map((field) => renderField(field))))
|
|
130
|
+
}])})`;
|
|
131
|
+
case "union": return `o.union(${renderObject([{
|
|
132
|
+
name: "variants",
|
|
133
|
+
value: withWriter((writer) => writeArray(writer, type.value.variants.map((variant) => renderVariant(variant))))
|
|
134
|
+
}])})`;
|
|
135
|
+
case "optional": return `o.optional(${renderObject([{
|
|
136
|
+
name: "type",
|
|
137
|
+
value: renderType(type.value.type)
|
|
138
|
+
}])})`;
|
|
139
|
+
case "result": return `o.result(${renderObject([{
|
|
140
|
+
name: "okType",
|
|
141
|
+
value: renderType(type.value.okType)
|
|
142
|
+
}, {
|
|
143
|
+
name: "errType",
|
|
144
|
+
value: renderType(type.value.errType)
|
|
145
|
+
}])})`;
|
|
146
|
+
case "ref": return `o.ref(${renderPlainValue(type.value)})`;
|
|
147
|
+
}
|
|
164
148
|
}
|
|
165
149
|
function renderField(field) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
150
|
+
return renderObject([
|
|
151
|
+
{
|
|
152
|
+
name: "name",
|
|
153
|
+
value: renderPlainValue(field.name)
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: "displayName",
|
|
157
|
+
value: renderPlainValue(field.displayName)
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "type",
|
|
161
|
+
value: renderType(field.type)
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: "description",
|
|
165
|
+
value: field.description ? renderPlainValue(field.description) : void 0
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "deprecated",
|
|
169
|
+
value: renderDeprecation(field.deprecated)
|
|
170
|
+
}
|
|
171
|
+
]);
|
|
173
172
|
}
|
|
174
173
|
function renderVariant(variant) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
174
|
+
return renderObject([{
|
|
175
|
+
name: "name",
|
|
176
|
+
value: renderPlainValue(variant.name)
|
|
177
|
+
}, {
|
|
178
|
+
name: "type",
|
|
179
|
+
value: renderType(variant.type)
|
|
180
|
+
}]);
|
|
179
181
|
}
|
|
180
182
|
function renderNamedType(type) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
return renderObject([
|
|
184
|
+
{
|
|
185
|
+
name: "name",
|
|
186
|
+
value: renderPlainValue(type.name)
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: "description",
|
|
190
|
+
value: type.description ? renderPlainValue(type.description) : void 0
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: "deprecated",
|
|
194
|
+
value: renderDeprecation(type.deprecated)
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: "type",
|
|
198
|
+
value: renderType(type.type)
|
|
199
|
+
}
|
|
200
|
+
]);
|
|
187
201
|
}
|
|
188
202
|
function renderProperty(property) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
203
|
+
return renderObject([
|
|
204
|
+
{
|
|
205
|
+
name: "name",
|
|
206
|
+
value: renderPlainValue(property.name)
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: "displayName",
|
|
210
|
+
value: renderPlainValue(property.displayName)
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: "type",
|
|
214
|
+
value: renderType(property.type)
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "description",
|
|
218
|
+
value: property.description ? renderPlainValue(property.description) : void 0
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: "deprecated",
|
|
222
|
+
value: renderDeprecation(property.deprecated)
|
|
223
|
+
}
|
|
224
|
+
]);
|
|
199
225
|
}
|
|
200
226
|
function renderObjectType(objectType) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
227
|
+
return renderObject([
|
|
228
|
+
{
|
|
229
|
+
name: "name",
|
|
230
|
+
value: renderPlainValue(objectType.name)
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
name: "displayName",
|
|
234
|
+
value: renderPlainValue(objectType.displayName)
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: "pluralDisplayName",
|
|
238
|
+
value: renderPlainValue(objectType.pluralDisplayName)
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: "primaryKey",
|
|
242
|
+
value: renderPlainValue(objectType.primaryKey)
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: "title",
|
|
246
|
+
value: objectType.title ? renderPlainValue(objectType.title) : void 0
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: "icon",
|
|
250
|
+
value: objectType.icon ? renderPlainValue(objectType.icon) : void 0
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: "color",
|
|
254
|
+
value: objectType.color ? renderPlainValue(objectType.color) : void 0
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: "properties",
|
|
258
|
+
value: withWriter((writer) => writeArray(writer, objectType.properties.map((property) => renderProperty(property))))
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: "description",
|
|
262
|
+
value: objectType.description ? renderPlainValue(objectType.description) : void 0
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: "deprecated",
|
|
266
|
+
value: renderDeprecation(objectType.deprecated)
|
|
267
|
+
}
|
|
268
|
+
]);
|
|
228
269
|
}
|
|
229
270
|
function renderLinkTypeSide(side) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
271
|
+
return renderObject([
|
|
272
|
+
{
|
|
273
|
+
name: "objectType",
|
|
274
|
+
value: renderPlainValue(side.objectType)
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: "name",
|
|
278
|
+
value: renderPlainValue(side.name)
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
name: "displayName",
|
|
282
|
+
value: renderPlainValue(side.displayName)
|
|
283
|
+
}
|
|
284
|
+
]);
|
|
235
285
|
}
|
|
236
286
|
function renderLinkType(linkType) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
287
|
+
return renderObject([
|
|
288
|
+
{
|
|
289
|
+
name: "id",
|
|
290
|
+
value: renderPlainValue(linkType.id)
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
name: "source",
|
|
294
|
+
value: renderLinkTypeSide(linkType.source)
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
name: "target",
|
|
298
|
+
value: renderLinkTypeSide(linkType.target)
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: "foreignKey",
|
|
302
|
+
value: renderPlainValue(linkType.foreignKey)
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: "cardinality",
|
|
306
|
+
value: renderPlainValue(linkType.cardinality)
|
|
307
|
+
}
|
|
308
|
+
]);
|
|
244
309
|
}
|
|
245
310
|
function renderExpression(expression, ctx) {
|
|
246
|
-
|
|
311
|
+
return `o.Expression.${expression.kind}(${renderPlainValue(expression.value, ctx)})`;
|
|
247
312
|
}
|
|
248
313
|
function renderActionPropertyAssignment(assignment, ctx) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
314
|
+
return renderObject([{
|
|
315
|
+
name: "property",
|
|
316
|
+
value: renderPlainValue(assignment.property)
|
|
317
|
+
}, {
|
|
318
|
+
name: "value",
|
|
319
|
+
value: renderExpression(assignment.value, ctx)
|
|
320
|
+
}]);
|
|
253
321
|
}
|
|
254
322
|
function renderActionType(actionType, ctx) {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
323
|
+
return renderObject([
|
|
324
|
+
{
|
|
325
|
+
name: "meta",
|
|
326
|
+
value: actionType.meta ? renderPlainValue(actionType.meta) : void 0
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
name: "name",
|
|
330
|
+
value: renderPlainValue(actionType.name)
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
name: "displayName",
|
|
334
|
+
value: renderPlainValue(actionType.displayName)
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
name: "icon",
|
|
338
|
+
value: actionType.icon ? renderPlainValue(actionType.icon) : void 0
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: "color",
|
|
342
|
+
value: actionType.color ? renderPlainValue(actionType.color) : void 0
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
name: "parameters",
|
|
346
|
+
value: withWriter((writer) => writeArray(writer, actionType.parameters.map((parameter) => renderObject([
|
|
347
|
+
{
|
|
348
|
+
name: "name",
|
|
349
|
+
value: renderPlainValue(parameter.name)
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
name: "displayName",
|
|
353
|
+
value: renderPlainValue(parameter.displayName)
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: "type",
|
|
357
|
+
value: renderType(parameter.type)
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
name: "description",
|
|
361
|
+
value: parameter.description ? renderPlainValue(parameter.description) : void 0
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
name: "deprecated",
|
|
365
|
+
value: renderDeprecation(parameter.deprecated)
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
name: "defaultValue",
|
|
369
|
+
value: parameter.defaultValue ? renderExpression(parameter.defaultValue, ctx) : void 0
|
|
370
|
+
}
|
|
371
|
+
]))))
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
name: "logic",
|
|
375
|
+
value: withWriter((writer) => writeArray(writer, actionType.logic.map((step) => `o.ActionLogicStep.${step.kind}(${renderObject([
|
|
376
|
+
{
|
|
377
|
+
name: "objectType",
|
|
378
|
+
value: "objectType" in step.value ? renderPlainValue(step.value.objectType) : void 0
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
name: "object",
|
|
382
|
+
value: "object" in step.value ? renderPlainValue(step.value.object) : void 0
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
name: "values",
|
|
386
|
+
value: "values" in step.value ? withWriter((arrayWriter) => writeArray(arrayWriter, ("values" in step.value ? step.value.values : []).map((value) => renderActionPropertyAssignment(value, ctx)))) : void 0
|
|
387
|
+
}
|
|
388
|
+
])})`)))
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
name: "description",
|
|
392
|
+
value: actionType.description ? renderPlainValue(actionType.description) : void 0
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
name: "deprecated",
|
|
396
|
+
value: renderDeprecation(actionType.deprecated)
|
|
397
|
+
}
|
|
398
|
+
]);
|
|
314
399
|
}
|
|
315
400
|
function renderQueryFunctionType(queryFunctionType) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
401
|
+
return renderObject([
|
|
402
|
+
{
|
|
403
|
+
name: "name",
|
|
404
|
+
value: renderPlainValue(queryFunctionType.name)
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
name: "displayName",
|
|
408
|
+
value: renderPlainValue(queryFunctionType.displayName)
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
name: "parameters",
|
|
412
|
+
value: withWriter((writer) => writeArray(writer, queryFunctionType.parameters.map((parameter) => renderObject([
|
|
413
|
+
{
|
|
414
|
+
name: "name",
|
|
415
|
+
value: renderPlainValue(parameter.name)
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
name: "displayName",
|
|
419
|
+
value: renderPlainValue(parameter.displayName)
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
name: "type",
|
|
423
|
+
value: renderType(parameter.type)
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
name: "description",
|
|
427
|
+
value: parameter.description ? renderPlainValue(parameter.description) : void 0
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: "deprecated",
|
|
431
|
+
value: renderDeprecation(parameter.deprecated)
|
|
432
|
+
}
|
|
433
|
+
]))))
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
name: "returnType",
|
|
437
|
+
value: renderType(queryFunctionType.returnType)
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
name: "description",
|
|
441
|
+
value: queryFunctionType.description ? renderPlainValue(queryFunctionType.description) : void 0
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
name: "deprecated",
|
|
445
|
+
value: renderDeprecation(queryFunctionType.deprecated)
|
|
446
|
+
}
|
|
447
|
+
]);
|
|
343
448
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
value: renderType(ir.contextType),
|
|
393
|
-
},
|
|
394
|
-
]
|
|
395
|
-
: []),
|
|
396
|
-
]);
|
|
397
|
-
writer.write(");");
|
|
398
|
-
writer.newLine();
|
|
399
|
-
});
|
|
400
|
-
return sourceFile.getFullText().trim();
|
|
449
|
+
function generateOntology(ir, opts = {}) {
|
|
450
|
+
const ontologyImportPath = opts.ontologyImportPath ?? "@party-stack/ontology";
|
|
451
|
+
const sourceFile = new Project({ useInMemoryFileSystem: true }).createSourceFile("ontology.ts", "");
|
|
452
|
+
let usesTemporalTypes = false;
|
|
453
|
+
const ctx = { markTemporalUsed() {
|
|
454
|
+
usesTemporalTypes = true;
|
|
455
|
+
} };
|
|
456
|
+
const renderedActionTypes = ir.actionTypes.map((actionType) => renderActionType(actionType, ctx));
|
|
457
|
+
sourceFile.addImportDeclaration({
|
|
458
|
+
moduleSpecifier: ontologyImportPath,
|
|
459
|
+
namedImports: ["defineOntology", "o"]
|
|
460
|
+
});
|
|
461
|
+
if (usesTemporalTypes) sourceFile.addImportDeclaration({
|
|
462
|
+
moduleSpecifier: "temporal-polyfill",
|
|
463
|
+
namedImports: ["Temporal"]
|
|
464
|
+
});
|
|
465
|
+
sourceFile.addStatements((writer) => {
|
|
466
|
+
writer.write("export default defineOntology(");
|
|
467
|
+
writeObject(writer, [
|
|
468
|
+
{
|
|
469
|
+
name: "types",
|
|
470
|
+
value: withWriter((arrayWriter) => writeArray(arrayWriter, ir.types.map((type) => renderNamedType(type))))
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
name: "objectTypes",
|
|
474
|
+
value: withWriter((arrayWriter) => writeArray(arrayWriter, ir.objectTypes.map((objectType) => renderObjectType(objectType))))
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
name: "linkTypes",
|
|
478
|
+
value: withWriter((arrayWriter) => writeArray(arrayWriter, ir.linkTypes.map((linkType) => renderLinkType(linkType))))
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
name: "actionTypes",
|
|
482
|
+
value: withWriter((arrayWriter) => writeArray(arrayWriter, renderedActionTypes))
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
name: "queryFunctionTypes",
|
|
486
|
+
value: withWriter((arrayWriter) => writeArray(arrayWriter, ir.queryFunctionTypes.map((queryFunctionType) => renderQueryFunctionType(queryFunctionType))))
|
|
487
|
+
},
|
|
488
|
+
...ir.contextType ? [{
|
|
489
|
+
name: "contextType",
|
|
490
|
+
value: renderType(ir.contextType)
|
|
491
|
+
}] : []
|
|
492
|
+
]);
|
|
493
|
+
writer.write(");");
|
|
494
|
+
writer.newLine();
|
|
495
|
+
});
|
|
496
|
+
return sourceFile.getFullText().trim();
|
|
401
497
|
}
|
|
498
|
+
//#endregion
|
|
499
|
+
export { generateOntology };
|
|
500
|
+
|
|
402
501
|
//# sourceMappingURL=ontology.js.map
|