@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/examples/blog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blog.js","sourceRoot":"","sources":["../../src/examples/blog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,6BAA6B,CAAC;AAGhD,eAAe;IACX,KAAK,EAAE;QACH;YACI,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;gBACX,MAAM,EAAE;oBACJ,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;oBAC5D;wBACI,IAAI,EAAE,OAAO;wBACb,WAAW,EAAE,QAAQ;wBACrB,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;qBAC3C;oBACD,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;oBACzD,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;oBAC3D,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;iBAC1D;aACJ,CAAC;SACL;KACJ;IAED,WAAW,EAAE;QACT;YACI,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,QAAQ;YACrB,iBAAiB,EAAE,SAAS;YAC5B,WAAW,EAAE,gBAAgB;YAC7B,UAAU,EAAE,UAAU;YACtB,UAAU,EAAE;gBACR;oBACI,IAAI,EAAE,UAAU;oBA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,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;iBAC5C;aACJ;YACD,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,eAAe,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;SACjF;KACJ;CACiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"blog.js","names":[],"sources":["../../src/examples/blog.ts"],"sourcesContent":["/**\n * Example: Blog ontology with Authors, Posts, and Comments.\n *\n * Demonstrates:\n * - Object types with primary keys and typed properties\n * - Value types (reusable structured types)\n * - Link types with cardinality\n * - Attachment properties (e.g. author avatar)\n * - String enum constraints (e.g. post status)\n * - Optional properties and timestamps\n */\n\nimport { o } from \"../ir/generated/builders.js\";\nimport type { OntologyIR } from \"../ir/generated/types.js\";\n\nexport default {\n types: [\n {\n name: \"Address\",\n description: \"A mailing address.\",\n type: o.struct({\n fields: [\n { name: \"line1\", displayName: \"Line 1\", type: o.string({}) },\n {\n name: \"line2\",\n displayName: \"Line 2\",\n type: o.optional({ type: o.string({}) }),\n },\n { name: \"city\", displayName: \"City\", type: o.string({}) },\n { name: \"state\", displayName: \"State\", type: o.string({}) },\n { name: \"zip\", displayName: \"ZIP\", type: o.string({}) },\n ],\n }),\n },\n ],\n\n objectTypes: [\n {\n name: \"Author\",\n displayName: \"Author\",\n pluralDisplayName: \"Authors\",\n description: \"A blog author.\",\n primaryKey: \"authorId\",\n properties: [\n {\n name: \"authorId\",\n displayName: \"Author ID\",\n type: o.string({}),\n },\n {\n name: \"name\",\n displayName: \"Name\",\n type: o.string({}),\n },\n {\n name: \"email\",\n displayName: \"Email\",\n type: o.string({}),\n },\n {\n name: \"bio\",\n displayName: \"Bio\",\n type: o.optional({ type: o.string({}) }),\n },\n {\n name: \"avatar\",\n displayName: \"Avatar\",\n description: \"The author's profile picture.\",\n type: o.optional({ type: o.attachment({}) }),\n },\n {\n name: \"address\",\n displayName: \"Address\",\n type: o.optional({ type: o.ref({ name: \"Address\" }) }),\n },\n {\n name: \"createdAt\",\n displayName: \"Created At\",\n type: o.timestamp({}),\n },\n ],\n },\n {\n name: \"Post\",\n displayName: \"Blog Post\",\n pluralDisplayName: \"Posts\",\n description: \"A blog post.\",\n primaryKey: \"postId\",\n properties: [\n {\n name: \"postId\",\n displayName: \"Post ID\",\n type: o.string({}),\n },\n {\n name: \"title\",\n displayName: \"Title\",\n type: o.string({}),\n },\n {\n name: \"body\",\n displayName: \"Body\",\n type: o.string({}),\n },\n {\n name: \"authorId\",\n displayName: \"Author ID\",\n type: o.string({}),\n },\n {\n name: \"status\",\n displayName: \"Status\",\n type: o.string({\n constraint: o.StringConstraint.enum({\n options: [\n { value: \"draft\", label: \"Draft\" },\n { value: \"published\", label: \"Published\" },\n { value: \"archived\", label: \"Archived\" },\n ],\n }),\n }),\n },\n {\n name: \"coverImage\",\n displayName: \"Cover Image\",\n type: o.optional({ type: o.attachment({}) }),\n },\n {\n name: \"tags\",\n displayName: \"Tags\",\n type: o.list({ elementType: o.string({}) }),\n },\n {\n name: \"createdAt\",\n displayName: \"Created At\",\n type: o.timestamp({}),\n },\n {\n name: \"publishedAt\",\n displayName: \"Published At\",\n type: o.optional({ type: o.timestamp({}) }),\n },\n ],\n },\n {\n name: \"Comment\",\n displayName: \"Comment\",\n pluralDisplayName: \"Comments\",\n description: \"A comment on a blog post.\",\n primaryKey: \"commentId\",\n properties: [\n {\n name: \"commentId\",\n displayName: \"Comment ID\",\n type: o.string({}),\n },\n {\n name: \"body\",\n displayName: \"Body\",\n type: o.string({}),\n },\n {\n name: \"postId\",\n displayName: \"Post ID\",\n type: o.string({}),\n },\n {\n name: \"authorId\",\n displayName: \"Author ID\",\n type: o.string({}),\n },\n {\n name: \"createdAt\",\n displayName: \"Created At\",\n type: o.timestamp({}),\n },\n ],\n },\n ],\n\n linkTypes: [\n {\n id: \"Post:author\",\n source: {\n objectType: \"Post\",\n name: \"posts\",\n displayName: \"Posts\",\n },\n target: {\n objectType: \"Author\",\n name: \"author\",\n displayName: \"Author\",\n },\n foreignKey: \"authorId\",\n cardinality: \"many\",\n },\n {\n id: \"Comment:post\",\n source: {\n objectType: \"Comment\",\n name: \"comments\",\n displayName: \"Comments\",\n },\n target: {\n objectType: \"Post\",\n name: \"post\",\n displayName: \"Post\",\n },\n foreignKey: \"postId\",\n cardinality: \"many\",\n },\n {\n id: \"Comment:author\",\n source: {\n objectType: \"Comment\",\n name: \"comment\",\n displayName: \"Comment\",\n },\n target: {\n objectType: \"Author\",\n name: \"author\",\n displayName: \"Author\",\n },\n foreignKey: \"authorId\",\n cardinality: \"one\",\n },\n ],\n actionTypes: [\n {\n name: \"createPost\",\n displayName: \"Create Post\",\n description: \"Create a new blog post.\",\n parameters: [\n {\n name: \"postId\",\n displayName: \"Post ID\",\n type: o.string({}),\n defaultValue: o.Expression.uuid({}),\n },\n {\n name: \"author\",\n displayName: \"Author\",\n type: o.objectReference({ objectType: \"Author\" }),\n },\n {\n name: \"title\",\n displayName: \"Title\",\n type: o.string({}),\n },\n {\n name: \"body\",\n displayName: \"Body\",\n type: o.string({}),\n },\n {\n name: \"status\",\n displayName: \"Status\",\n type: o.string({\n constraint: o.StringConstraint.enum({\n options: [\n { value: \"draft\", label: \"Draft\" },\n { value: \"published\", label: \"Published\" },\n { value: \"archived\", label: \"Archived\" },\n ],\n }),\n }),\n },\n {\n name: \"tags\",\n displayName: \"Tags\",\n type: o.list({ elementType: o.string({}) }),\n },\n {\n name: \"createdAt\",\n displayName: \"Created At\",\n type: o.timestamp({}),\n defaultValue: o.Expression.now({}),\n },\n ],\n logic: [\n o.ActionLogicStep.createObject({\n objectType: \"Post\",\n values: [\n {\n property: [\"postId\"],\n value: o.Expression.inputReference({ name: \"postId\" }),\n },\n {\n property: [\"title\"],\n value: o.Expression.inputReference({ name: \"title\" }),\n },\n {\n property: [\"body\"],\n value: o.Expression.inputReference({ name: \"body\" }),\n },\n {\n property: [\"authorId\"],\n value: o.Expression.getAt({\n source: o.Expression.objectLookup({\n reference: o.Expression.inputReference({\n name: \"author\",\n }),\n }),\n path: [\"authorId\"],\n }),\n },\n {\n property: [\"status\"],\n value: o.Expression.inputReference({ name: \"status\" }),\n },\n {\n property: [\"tags\"],\n value: o.Expression.inputReference({ name: \"tags\" }),\n },\n {\n property: [\"createdAt\"],\n value: o.Expression.inputReference({ name: \"createdAt\" }),\n },\n ],\n }),\n ],\n },\n ],\n queryFunctionTypes: [\n {\n name: \"searchPosts\",\n displayName: \"Search Posts\",\n description: \"Search blog posts by query text.\",\n parameters: [\n {\n name: \"query\",\n displayName: \"Query\",\n type: o.string({}),\n },\n {\n name: \"limit\",\n displayName: \"Limit\",\n type: o.optional({ type: o.integer({}) }),\n },\n ],\n returnType: o.list({ elementType: o.objectReference({ objectType: \"Post\" }) }),\n },\n ],\n} satisfies OntologyIR;\n"],"mappings":";;;;;;;;;;;;;AAeA,IAAA,eAAe;CACX,OAAO,CACH;EACI,MAAM;EACN,aAAa;EACb,MAAM,EAAE,OAAO,EACX,QAAQ;GACJ;IAAE,MAAM;IAAS,aAAa;IAAU,MAAM,EAAE,OAAO,CAAC,CAAC;GAAE;GAC3D;IACI,MAAM;IACN,aAAa;IACb,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;GAC3C;GACA;IAAE,MAAM;IAAQ,aAAa;IAAQ,MAAM,EAAE,OAAO,CAAC,CAAC;GAAE;GACxD;IAAE,MAAM;IAAS,aAAa;IAAS,MAAM,EAAE,OAAO,CAAC,CAAC;GAAE;GAC1D;IAAE,MAAM;IAAO,aAAa;IAAO,MAAM,EAAE,OAAO,CAAC,CAAC;GAAE;EAC1D,EACJ,CAAC;CACL,CACJ;CAEA,aAAa;EACT;GACI,MAAM;GACN,aAAa;GACb,mBAAmB;GACnB,aAAa;GACb,YAAY;GACZ,YAAY;IACR;KACI,MAAM;KACN,aAAa;KACb,MA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AQ,EAAE,WAAW,aAAa,EAC9B,WAAW,EAAE,WAAW,eAAe,EACnC,MAAM,SACV,CAAC,EACL,CAAC;MACD,MAAM,CAAC,UAAU;KACrB,CAAC;IACL;IACA;KACI,UAAU,CAAC,QAAQ;KACnB,OAAO,EAAE,WAAW,eAAe,EAAE,MAAM,SAAS,CAAC;IACzD;IACA;KACI,UAAU,CAAC,MAAM;KACjB,OAAO,EAAE,WAAW,eAAe,EAAE,MAAM,OAAO,CAAC;IACvD;IACA;KACI,UAAU,CAAC,WAAW;KACtB,OAAO,EAAE,WAAW,eAAe,EAAE,MAAM,YAAY,CAAC;IAC5D;GACJ;EACJ,CAAC,CACL;CACJ,CACJ;CACA,oBAAoB,CAChB;EACI,MAAM;EACN,aAAa;EACb,aAAa;EACb,YAAY,CACR;GACI,MAAM;GACN,aAAa;GACb,MAAM,EAAE,OAAO,CAAC,CAAC;EACrB,GACA;GACI,MAAM;GACN,aAAa;GACb,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC;EAC5C,CACJ;EACA,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,OAAO,CAAC,EAAE,CAAC;CACjF,CACJ;AACJ"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { OntologyCollection } from "../live/objects/createLiveOntologyObjectCollection.js";
|
|
2
|
+
import { Author, Comment, Post } from "./generated/types.js";
|
|
3
|
+
import "../index.js";
|
|
4
|
+
//#region src/examples/blog.live-queries.d.ts
|
|
5
|
+
export declare const postCollection: OntologyCollection<Post>;
|
|
6
|
+
export declare const authorCollection: OntologyCollection<Author>;
|
|
7
|
+
export declare const commentCollection: OntologyCollection<Comment>;
|
|
8
|
+
//#endregion
|
|
4
9
|
//# sourceMappingURL=blog.live-queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blog.live-queries.d.ts","
|
|
1
|
+
{"version":3,"file":"blog.live-queries.d.ts","names":["_$__generated_types_js0.Post","_$___index_js0.OntologyCollection","_$__generated_types_js0.Author","_$__generated_types_js0.Comment"],"sources":["../../src/examples/blog.live-queries.ts"],"mappings":";;;;qBAqDa,gBAAcC,mBAAdD;qBACA,kBAAgBC,mBAAhBC;qBACA,mBAAiBD,mBAAjBE"}
|
|
@@ -1,46 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Example live query functions using generated ontology object sources.
|
|
3
|
-
*/
|
|
4
|
-
import { Query, concat, createCollection, eq, liveQueryCollectionOptions } from "@tanstack/db";
|
|
5
1
|
import { createBlogLiveOntology } from "./generated/live.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
commentId: Comment.commentId,
|
|
35
|
-
body: Comment.body,
|
|
36
|
-
postTitle: Post?.title,
|
|
37
|
-
authorDisplay: concat(Author?.name, " <", Author?.email, ">"),
|
|
38
|
-
})),
|
|
39
|
-
}));
|
|
40
|
-
export const postCollection = Post;
|
|
41
|
-
export const authorCollection = Author;
|
|
42
|
-
export const commentCollection = Comment;
|
|
43
|
-
void postList;
|
|
44
|
-
void postListWithAuthor;
|
|
45
|
-
void commentFeed;
|
|
2
|
+
import { Query, concat, createCollection, eq, liveQueryCollectionOptions } from "@tanstack/db";
|
|
3
|
+
//#region src/examples/blog.live-queries.ts
|
|
4
|
+
/**
|
|
5
|
+
* Example live query functions using generated ontology object sources.
|
|
6
|
+
*/
|
|
7
|
+
const { Post, Author, Comment } = (await createBlogLiveOntology({ backend: () => backendAdapter })).objects;
|
|
8
|
+
createCollection(liveQueryCollectionOptions({ query: new Query().from({ Post }).select(({ Post }) => ({
|
|
9
|
+
postId: Post.postId,
|
|
10
|
+
title: Post.title,
|
|
11
|
+
status: Post.status
|
|
12
|
+
})) }));
|
|
13
|
+
createCollection(liveQueryCollectionOptions({ query: new Query().from({ Post }).leftJoin({ Author }, ({ Post, Author }) => eq(Post.authorId, Author.authorId)).select(({ Post, Author }) => ({
|
|
14
|
+
postId: Post.postId,
|
|
15
|
+
title: Post.title,
|
|
16
|
+
authorName: Author?.name
|
|
17
|
+
})) }));
|
|
18
|
+
createCollection(liveQueryCollectionOptions({ query: new Query().from({ Comment }).leftJoin({ Post }, ({ Comment, Post }) => eq(Comment.postId, Post.postId)).leftJoin({ Author }, ({ Comment, Author }) => eq(Comment.authorId, Author.authorId)).where(({ Post }) => eq(Post?.status, "published")).select(({ Comment, Post, Author }) => ({
|
|
19
|
+
commentId: Comment.commentId,
|
|
20
|
+
body: Comment.body,
|
|
21
|
+
postTitle: Post?.title,
|
|
22
|
+
authorDisplay: concat(Author?.name, " <", Author?.email, ">")
|
|
23
|
+
})) }));
|
|
24
|
+
const postCollection = Post;
|
|
25
|
+
const authorCollection = Author;
|
|
26
|
+
const commentCollection = Comment;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { authorCollection, commentCollection, postCollection };
|
|
29
|
+
|
|
46
30
|
//# sourceMappingURL=blog.live-queries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blog.live-queries.js","
|
|
1
|
+
{"version":3,"file":"blog.live-queries.js","names":[],"sources":["../../src/examples/blog.live-queries.ts"],"sourcesContent":["/**\n * Example live query functions using generated ontology object sources.\n */\nimport { Query, concat, createCollection, eq, liveQueryCollectionOptions } from \"@tanstack/db\";\nimport { createBlogLiveOntology } from \"./generated/live.js\";\nimport type { OntologyBackendAdapter } from \"../live/OntologyBackendAdapter.js\";\n\ndeclare const backendAdapter: OntologyBackendAdapter;\n\nconst blog = await createBlogLiveOntology({\n backend: () => backendAdapter,\n});\nconst { Post, Author, Comment } = blog.objects;\n\nconst postList = createCollection(\n liveQueryCollectionOptions({\n query: new Query().from({ Post }).select(({ Post }) => ({\n postId: Post.postId,\n title: Post.title,\n status: Post.status,\n })),\n })\n);\n\nconst postListWithAuthor = createCollection(\n liveQueryCollectionOptions({\n query: new Query()\n .from({ Post })\n .leftJoin({ Author }, ({ Post, Author }) => eq(Post.authorId, Author.authorId))\n .select(({ Post, Author }) => ({\n postId: Post.postId,\n title: Post.title,\n authorName: Author?.name,\n })),\n })\n);\n\nconst commentFeed = createCollection(\n liveQueryCollectionOptions({\n query: new Query()\n .from({ Comment })\n .leftJoin({ Post }, ({ Comment, Post }) => eq(Comment.postId, Post.postId))\n .leftJoin({ Author }, ({ Comment, Author }) => eq(Comment.authorId, Author.authorId))\n .where(({ Post }) => eq(Post?.status, \"published\"))\n .select(({ Comment, Post, Author }) => ({\n commentId: Comment.commentId,\n body: Comment.body,\n postTitle: Post?.title,\n authorDisplay: concat(Author?.name, \" <\", Author?.email, \">\"),\n })),\n })\n);\n\nexport const postCollection = Post;\nexport const authorCollection = Author;\nexport const commentCollection = Comment;\n\nvoid postList;\nvoid postListWithAuthor;\nvoid commentFeed;\n"],"mappings":";;;;;;AAYA,MAAM,EAAE,MAAM,QAAQ,aAAY,MAHf,uBAAuB,EACtC,eAAe,eACnB,CAAC,EAAA,CACsC;AAEtB,iBACb,2BAA2B,EACvB,OAAO,IAAI,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,YAAY;CACpD,QAAQ,KAAK;CACb,OAAO,KAAK;CACZ,QAAQ,KAAK;AACjB,EAAE,EACN,CAAC,CACL;AAE2B,iBACvB,2BAA2B,EACvB,OAAO,IAAI,MAAM,CAAC,CACb,KAAK,EAAE,KAAK,CAAC,CAAC,CACd,SAAS,EAAE,OAAO,IAAI,EAAE,MAAM,aAAa,GAAG,KAAK,UAAU,OAAO,QAAQ,CAAC,CAAC,CAC9E,QAAQ,EAAE,MAAM,cAAc;CAC3B,QAAQ,KAAK;CACb,OAAO,KAAK;CACZ,YAAY,QAAQ;AACxB,EAAE,EACV,CAAC,CACL;AAEoB,iBAChB,2BAA2B,EACvB,OAAO,IAAI,MAAM,CAAC,CACb,KAAK,EAAE,QAAQ,CAAC,CAAC,CACjB,SAAS,EAAE,KAAK,IAAI,EAAE,SAAS,WAAW,GAAG,QAAQ,QAAQ,KAAK,MAAM,CAAC,CAAC,CAC1E,SAAS,EAAE,OAAO,IAAI,EAAE,SAAS,aAAa,GAAG,QAAQ,UAAU,OAAO,QAAQ,CAAC,CAAC,CACpF,OAAO,EAAE,WAAW,GAAG,MAAM,QAAQ,WAAW,CAAC,CAAC,CAClD,QAAQ,EAAE,SAAS,MAAM,cAAc;CACpC,WAAW,QAAQ;CACnB,MAAM,QAAQ;CACd,WAAW,MAAM;CACjB,eAAe,OAAO,QAAQ,MAAM,MAAM,QAAQ,OAAO,GAAG;AAChE,EAAE,EACV,CAAC,CACL;AAEA,MAAa,iBAAiB;AAC9B,MAAa,mBAAmB;AAChC,MAAa,oBAAoB"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export {}
|
|
2
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
1
|
+
export {}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { CreateLiveOntologyOpts, LiveOntology } from "../../live/LiveOntology.js";
|
|
2
|
+
import { BlogOntology } from "./types.js";
|
|
3
|
+
import "../../index.js";
|
|
4
|
+
//#region src/examples/generated/live.d.ts
|
|
4
5
|
export declare function createBlogLiveOntology<Context extends Record<string, unknown> = Record<string, unknown>>(opts: Omit<CreateLiveOntologyOpts<Context>, "ir">): Promise<LiveOntology<BlogOntology>>;
|
|
6
|
+
//#endregion
|
|
5
7
|
//# sourceMappingURL=live.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live.d.ts","
|
|
1
|
+
{"version":3,"file":"live.d.ts","names":[],"sources":["../../../src/examples/generated/live.ts"],"mappings":";;;;wBAOsB,uBAClB,gBAAgB,0BAA0B,yBAC5C,MAAM,KAAK,uBAAuB,kBAAkB,QAAQ,aAAa"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { createLiveOntology } from "../../live/LiveOntology.js";
|
|
2
|
+
import "../../index.js";
|
|
3
|
+
import blog_default from "../blog.js";
|
|
4
|
+
//#region src/examples/generated/live.ts
|
|
5
|
+
async function createBlogLiveOntology(opts) {
|
|
6
|
+
return createLiveOntology({
|
|
7
|
+
...opts,
|
|
8
|
+
ir: blog_default
|
|
9
|
+
});
|
|
9
10
|
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { createBlogLiveOntology };
|
|
13
|
+
|
|
10
14
|
//# sourceMappingURL=live.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live.js","
|
|
1
|
+
{"version":3,"file":"live.js","names":["ontology"],"sources":["../../../src/examples/generated/live.ts"],"sourcesContent":["// Auto-generated file - do not edit manually\n\nimport { createLiveOntology, type LiveOntology } from \"../../index.js\";\nimport ontology from \"../blog.js\";\nimport type { CreateLiveOntologyOpts } from \"../../index.js\";\nimport type { BlogOntology } from \"./types.js\";\n\nexport async function createBlogLiveOntology<\n Context extends Record<string, unknown> = Record<string, unknown>,\n>(opts: Omit<CreateLiveOntologyOpts<Context>, \"ir\">): Promise<LiveOntology<BlogOntology>> {\n return createLiveOntology<BlogOntology, Context>({\n ...opts,\n ir: ontology,\n });\n}\n"],"mappings":";;;;AAOA,eAAsB,uBAEpB,MAAwF;CACtF,OAAO,mBAA0C;EAC7C,GAAG;EACH,IAAIA;CACR,CAAC;AACL"}
|
|
@@ -1,74 +1,76 @@
|
|
|
1
1
|
import * as v from "@party-stack/ontology/values";
|
|
2
|
+
//#region src/examples/generated/types.d.ts
|
|
2
3
|
/** A mailing address. */
|
|
3
4
|
export type Address = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
line1: string;
|
|
6
|
+
line2?: string;
|
|
7
|
+
city: string;
|
|
8
|
+
state: string;
|
|
9
|
+
zip: string;
|
|
9
10
|
};
|
|
10
11
|
/** A blog author. */
|
|
11
12
|
export type Author = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
authorId: string;
|
|
14
|
+
name: string;
|
|
15
|
+
email: string;
|
|
16
|
+
bio?: string;
|
|
17
|
+
/** The author's profile picture. */
|
|
18
|
+
avatar?: v.attachment;
|
|
19
|
+
address?: Address;
|
|
20
|
+
createdAt: v.timestamp;
|
|
20
21
|
};
|
|
21
22
|
/** A blog post. */
|
|
22
23
|
export type Post = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
postId: string;
|
|
25
|
+
title: string;
|
|
26
|
+
body: string;
|
|
27
|
+
authorId: string;
|
|
28
|
+
status: "draft" | "published" | "archived";
|
|
29
|
+
coverImage?: v.attachment;
|
|
30
|
+
tags: Array<string>;
|
|
31
|
+
createdAt: v.timestamp;
|
|
32
|
+
publishedAt?: v.timestamp;
|
|
32
33
|
};
|
|
33
34
|
/** A comment on a blog post. */
|
|
34
35
|
export type Comment = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
commentId: string;
|
|
37
|
+
body: string;
|
|
38
|
+
postId: string;
|
|
39
|
+
authorId: string;
|
|
40
|
+
createdAt: v.timestamp;
|
|
40
41
|
};
|
|
41
42
|
export type CreatePostParameters = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
postId?: string;
|
|
44
|
+
author: string;
|
|
45
|
+
title: string;
|
|
46
|
+
body: string;
|
|
47
|
+
status: "draft" | "published" | "archived";
|
|
48
|
+
tags: Array<string>;
|
|
49
|
+
createdAt?: v.timestamp;
|
|
49
50
|
};
|
|
50
51
|
export type SearchPostsParameters = {
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
query: string;
|
|
53
|
+
limit?: v.integer | undefined;
|
|
53
54
|
};
|
|
54
55
|
/** Search blog posts by query text. */
|
|
55
56
|
export type SearchPostsReturn = Array<string>;
|
|
56
57
|
export type BlogOntology = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
objectTypes: {
|
|
59
|
+
Author: Author;
|
|
60
|
+
Post: Post;
|
|
61
|
+
Comment: Comment;
|
|
62
|
+
};
|
|
63
|
+
actionTypes: {
|
|
64
|
+
createPost: {
|
|
65
|
+
parameters: CreatePostParameters;
|
|
61
66
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
queryFunctionTypes: {
|
|
68
|
-
searchPosts: {
|
|
69
|
-
parameters: SearchPostsParameters;
|
|
70
|
-
returnType: SearchPostsReturn;
|
|
71
|
-
};
|
|
67
|
+
};
|
|
68
|
+
queryFunctionTypes: {
|
|
69
|
+
searchPosts: {
|
|
70
|
+
parameters: SearchPostsParameters;
|
|
71
|
+
returnType: SearchPostsReturn;
|
|
72
72
|
};
|
|
73
|
+
};
|
|
73
74
|
};
|
|
75
|
+
//#endregion
|
|
74
76
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/examples/generated/types.ts"],"mappings":";;;YAKY;EACR;EACA;EACA;EACA;EACA;;;YAIQ;EACR;EACA;EACA;EACA;;EAEA,SAAS,EAAE;EACX,UAAU;EACV,WAAW,EAAE;;;YAIL;EACR;EACA;EACA;EACA;EACA;EACA,aAAa,EAAE;EACf,MAAM;EACN,WAAW,EAAE;EACb,cAAc,EAAE;;;YAIR;EACR;EACA;EACA;EACA;EACA,WAAW,EAAE;;YAGL;EACR;EACA;EACA;EACA;EACA;EACA,MAAM;EACN,YAAY,EAAE;;YAEN;EACR;EACA,QAAQ,EAAE;;;YAGF,oBAAoB;YACpB;EACR;IACI,QAAQ;IACR,MAAM;IACN,SAAS;;EAEb;IACI;MACI,YAAY;;;EAGpB;IACI;MACI,YAAY;MACZ,YAAY"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { OntologyIR } from "../ir/generated/types.js";
|
|
2
|
+
import "../ir/index.js";
|
|
3
|
+
//#region src/generate/builders.d.ts
|
|
2
4
|
export interface GenerateBuildersOpts {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/** The name of the main export (e.g., "o" for `o.string()`). */
|
|
6
|
+
exportName: string;
|
|
7
|
+
/** If set, promotes this union type's variants to the top level of the export. */
|
|
8
|
+
promoted?: string;
|
|
7
9
|
}
|
|
8
10
|
export declare function generateBuilders(schema: Pick<OntologyIR, "types">, opts: GenerateBuildersOpts): string;
|
|
11
|
+
//#endregion
|
|
9
12
|
//# sourceMappingURL=builders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.d.ts","
|
|
1
|
+
{"version":3,"file":"builders.d.ts","names":[],"sources":["../../src/generate/builders.ts"],"mappings":";;;iBAIiB;;EAEb;;EAEA;;wBAaY,iBAAiB,QAAQ,KAAK,sBAAsB,MAAM"}
|
package/lib/generate/builders.js
CHANGED
|
@@ -1,60 +1,58 @@
|
|
|
1
|
-
import { Project, VariableDeclarationKind } from "ts-morph";
|
|
2
1
|
import { buildJsDocs } from "./utils/buildJsDocs.js";
|
|
2
|
+
import { Project, VariableDeclarationKind } from "ts-morph";
|
|
3
|
+
//#region src/generate/builders.ts
|
|
3
4
|
function unionTypeToBuilders(name, unionType) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
return unionType.variants.map((variant) => ({
|
|
6
|
+
name: variant.name,
|
|
7
|
+
builder: `<const Value extends Extract<t.${name}, { kind: "${variant.name}" }>["value"]>(value: Value) => ({ kind: "${variant.name}" as const, value })`
|
|
8
|
+
}));
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
const statements = sourceFile.getVariableStatements();
|
|
55
|
-
for (const statement of statements.slice(0, -1)) {
|
|
56
|
-
statement.appendWhitespace("\n");
|
|
57
|
-
}
|
|
58
|
-
return sourceFile.getFullText().trim();
|
|
10
|
+
function generateBuilders(schema, opts) {
|
|
11
|
+
const sourceFile = new Project({ useInMemoryFileSystem: true }).createSourceFile("builders.ts", "");
|
|
12
|
+
const unionTypes = schema.types.filter((type) => type.type.kind === "union");
|
|
13
|
+
if (unionTypes.length === 0) return "";
|
|
14
|
+
sourceFile.addImportDeclaration({
|
|
15
|
+
moduleSpecifier: "./types.js",
|
|
16
|
+
namespaceImport: "t"
|
|
17
|
+
});
|
|
18
|
+
const promotedType = unionTypes.find((type) => type.name === opts.promoted);
|
|
19
|
+
const promotedBuilders = promotedType ? unionTypeToBuilders(opts.promoted, promotedType.type.value) : [];
|
|
20
|
+
const nestedTypes = unionTypes.filter((type) => type.name !== opts.promoted);
|
|
21
|
+
for (const builder of promotedBuilders) sourceFile.addVariableStatement({
|
|
22
|
+
isExported: true,
|
|
23
|
+
declarationKind: VariableDeclarationKind.Const,
|
|
24
|
+
declarations: [{
|
|
25
|
+
name: builder.name,
|
|
26
|
+
initializer: builder.builder
|
|
27
|
+
}],
|
|
28
|
+
docs: buildJsDocs({ deprecated: promotedType?.deprecated })
|
|
29
|
+
});
|
|
30
|
+
for (const nestedType of nestedTypes) {
|
|
31
|
+
const builders = unionTypeToBuilders(nestedType.name, nestedType.type.value);
|
|
32
|
+
sourceFile.addVariableStatement({
|
|
33
|
+
isExported: true,
|
|
34
|
+
declarationKind: VariableDeclarationKind.Const,
|
|
35
|
+
declarations: [{
|
|
36
|
+
name: nestedType.name,
|
|
37
|
+
initializer: `{ ${builders.map((builder) => `${builder.name}: ${builder.builder}`).join(", ")} }`
|
|
38
|
+
}],
|
|
39
|
+
docs: buildJsDocs({ deprecated: nestedType.deprecated })
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const exportNames = [...promotedBuilders.map((builder) => builder.name), ...nestedTypes.map((type) => type.name)];
|
|
43
|
+
sourceFile.addVariableStatement({
|
|
44
|
+
isExported: true,
|
|
45
|
+
declarationKind: VariableDeclarationKind.Const,
|
|
46
|
+
declarations: [{
|
|
47
|
+
name: opts.exportName,
|
|
48
|
+
initializer: `{ ${exportNames.join(", ")} }`
|
|
49
|
+
}]
|
|
50
|
+
});
|
|
51
|
+
const statements = sourceFile.getVariableStatements();
|
|
52
|
+
for (const statement of statements.slice(0, -1)) statement.appendWhitespace("\n");
|
|
53
|
+
return sourceFile.getFullText().trim();
|
|
59
54
|
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { generateBuilders };
|
|
57
|
+
|
|
60
58
|
//# sourceMappingURL=builders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.js","
|
|
1
|
+
{"version":3,"file":"builders.js","names":[],"sources":["../../src/generate/builders.ts"],"sourcesContent":["import { Project, VariableDeclarationKind } from \"ts-morph\";\nimport { buildJsDocs } from \"./utils/buildJsDocs.js\";\nimport type { NamedTypeDef, OntologyIR, UnionTypeDef } from \"../ir/index.js\";\n\nexport interface GenerateBuildersOpts {\n /** The name of the main export (e.g., \"o\" for `o.string()`). */\n exportName: string;\n /** If set, promotes this union type's variants to the top level of the export. */\n promoted?: string;\n}\n\nfunction unionTypeToBuilders(\n name: string,\n unionType: UnionTypeDef\n): Array<{ name: string; builder: string }> {\n return unionType.variants.map((variant) => ({\n name: variant.name,\n builder: `<const Value extends Extract<t.${name}, { kind: \"${variant.name}\" }>[\"value\"]>(value: Value) => ({ kind: \"${variant.name}\" as const, value })`,\n }));\n}\n\nexport function generateBuilders(schema: Pick<OntologyIR, \"types\">, opts: GenerateBuildersOpts): string {\n const project = new Project({ useInMemoryFileSystem: true });\n const sourceFile = project.createSourceFile(\"builders.ts\", \"\");\n\n const unionTypes = schema.types.filter((type) => type.type.kind === \"union\") as Array<\n NamedTypeDef & {\n type: { kind: \"union\"; value: UnionTypeDef };\n }\n >;\n\n if (unionTypes.length === 0) {\n return \"\";\n }\n\n sourceFile.addImportDeclaration({\n moduleSpecifier: \"./types.js\",\n namespaceImport: \"t\",\n });\n\n const promotedType = unionTypes.find((type) => type.name === opts.promoted);\n const promotedBuilders = promotedType ? unionTypeToBuilders(opts.promoted!, promotedType.type.value) : [];\n\n const nestedTypes = unionTypes.filter((type) => type.name !== opts.promoted);\n\n for (const builder of promotedBuilders) {\n sourceFile.addVariableStatement({\n isExported: true,\n declarationKind: VariableDeclarationKind.Const,\n declarations: [{ name: builder.name, initializer: builder.builder }],\n docs: buildJsDocs({ deprecated: promotedType?.deprecated }),\n });\n }\n\n for (const nestedType of nestedTypes) {\n const builders = unionTypeToBuilders(nestedType.name, nestedType.type.value);\n sourceFile.addVariableStatement({\n isExported: true,\n declarationKind: VariableDeclarationKind.Const,\n declarations: [\n {\n name: nestedType.name,\n initializer: `{ ${builders.map((builder) => `${builder.name}: ${builder.builder}`).join(\", \")} }`,\n },\n ],\n docs: buildJsDocs({ deprecated: nestedType.deprecated }),\n });\n }\n\n const exportNames = [\n ...promotedBuilders.map((builder) => builder.name),\n ...nestedTypes.map((type) => type.name),\n ];\n sourceFile.addVariableStatement({\n isExported: true,\n declarationKind: VariableDeclarationKind.Const,\n declarations: [{ name: opts.exportName, initializer: `{ ${exportNames.join(\", \")} }` }],\n });\n\n const statements = sourceFile.getVariableStatements();\n for (const statement of statements.slice(0, -1)) {\n statement.appendWhitespace(\"\\n\");\n }\n\n return sourceFile.getFullText().trim();\n}\n"],"mappings":";;;AAWA,SAAS,oBACL,MACA,WACwC;CACxC,OAAO,UAAU,SAAS,KAAK,aAAa;EACxC,MAAM,QAAQ;EACd,SAAS,kCAAkC,KAAK,aAAa,QAAQ,KAAK,4CAA4C,QAAQ,KAAK;CACvI,EAAE;AACN;AAEA,SAAgB,iBAAiB,QAAmC,MAAoC;CAEpG,MAAM,aAAa,IADC,QAAQ,EAAE,uBAAuB,KAAK,CACjC,CAAC,CAAC,iBAAiB,eAAe,EAAE;CAE7D,MAAM,aAAa,OAAO,MAAM,QAAQ,SAAS,KAAK,KAAK,SAAS,OAAO;CAM3E,IAAI,WAAW,WAAW,GACtB,OAAO;CAGX,WAAW,qBAAqB;EAC5B,iBAAiB;EACjB,iBAAiB;CACrB,CAAC;CAED,MAAM,eAAe,WAAW,MAAM,SAAS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IR } from "../ir/generated/types.js";
|
|
2
|
+
//#region src/generate/constants.d.ts
|
|
2
3
|
export declare function generateConstants(schema: Pick<OntologyIR, "types">): string;
|
|
4
|
+
//#endregion
|
|
3
5
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","
|
|
1
|
+
{"version":3,"file":"constants.d.ts","names":[],"sources":["../../src/generate/constants.ts"],"mappings":";;wBAmBgB,kBAAkB,QAAQ,KAAK"}
|