@party-stack/ontology 0.18.0 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/OntologyPullConfig.d.ts +15 -13
- package/lib/OntologyPullConfig.d.ts.map +1 -1
- package/lib/OntologyPullConfig.js +0 -1
- package/lib/_virtual/_rolldown/runtime.js +13 -0
- 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 -6
- 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 -152
- 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 +239 -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 +79 -76
- 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 -45
- 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 -9
- 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 -14
- 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 +13 -10
- package/lib/live/objects/createLiveOntologyObjectCollection.d.ts.map +1 -1
- package/lib/live/objects/createLiveOntologyObjectCollection.js +49 -53
- 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 -32
- 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 +21 -18
- package/lib/utils/values.d.ts.map +1 -1
- package/lib/utils/values.js +0 -1
- package/package.json +22 -25
- 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 -281
- 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 -182
- 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 -181
- 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 -1007
- package/lib/live/outbox/createOntologyOutbox.test.js.map +0 -1
- package/lib/live/outbox/outboxValues.d.ts +0 -7
- package/lib/live/outbox/outboxValues.d.ts.map +0 -1
- package/lib/live/outbox/outboxValues.js +0 -76
- package/lib/live/outbox/outboxValues.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
|
@@ -1,80 +1,64 @@
|
|
|
1
1
|
import { resolveType } from "../../utils/types.js";
|
|
2
|
+
//#region src/live/attachments/attachmentSources.ts
|
|
2
3
|
function isRecord(value) {
|
|
3
|
-
|
|
4
|
+
return typeof value === "object" && value !== null;
|
|
4
5
|
}
|
|
5
6
|
function isAttachment(value) {
|
|
6
|
-
|
|
7
|
+
return isRecord(value) && typeof value.id === "string";
|
|
7
8
|
}
|
|
8
9
|
function decorateAttachmentValue(opts) {
|
|
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
|
-
return;
|
|
46
|
-
case "struct":
|
|
47
|
-
if (isRecord(opts.value)) {
|
|
48
|
-
for (const field of type.value.fields) {
|
|
49
|
-
decorateAttachmentValue({
|
|
50
|
-
...opts,
|
|
51
|
-
type: field.type,
|
|
52
|
-
value: opts.value[field.name],
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return;
|
|
57
|
-
default:
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
10
|
+
if (opts.value === void 0 || opts.value === null) return;
|
|
11
|
+
const type = resolveType(opts.ir, opts.type);
|
|
12
|
+
switch (type.kind) {
|
|
13
|
+
case "attachment":
|
|
14
|
+
if (isAttachment(opts.value)) opts.value.source = opts.source;
|
|
15
|
+
return;
|
|
16
|
+
case "optional":
|
|
17
|
+
decorateAttachmentValue({
|
|
18
|
+
...opts,
|
|
19
|
+
type: type.value.type
|
|
20
|
+
});
|
|
21
|
+
return;
|
|
22
|
+
case "list":
|
|
23
|
+
if (Array.isArray(opts.value)) for (const item of opts.value) decorateAttachmentValue({
|
|
24
|
+
...opts,
|
|
25
|
+
type: type.value.elementType,
|
|
26
|
+
value: item
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
case "map":
|
|
30
|
+
if (isRecord(opts.value)) for (const item of Object.values(opts.value)) decorateAttachmentValue({
|
|
31
|
+
...opts,
|
|
32
|
+
type: type.value.valueType,
|
|
33
|
+
value: item
|
|
34
|
+
});
|
|
35
|
+
return;
|
|
36
|
+
case "struct":
|
|
37
|
+
if (isRecord(opts.value)) for (const field of type.value.fields) decorateAttachmentValue({
|
|
38
|
+
...opts,
|
|
39
|
+
type: field.type,
|
|
40
|
+
value: opts.value[field.name]
|
|
41
|
+
});
|
|
42
|
+
return;
|
|
43
|
+
default: return;
|
|
44
|
+
}
|
|
60
45
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return opts.object;
|
|
46
|
+
function decorateObjectAttachmentSources(opts) {
|
|
47
|
+
const primaryKey = opts.object[opts.objectType.primaryKey];
|
|
48
|
+
if (typeof primaryKey !== "string" && typeof primaryKey !== "number") return opts.object;
|
|
49
|
+
for (const property of opts.objectType.properties) decorateAttachmentValue({
|
|
50
|
+
ir: opts.ir,
|
|
51
|
+
type: property.type,
|
|
52
|
+
value: opts.object[property.name],
|
|
53
|
+
source: {
|
|
54
|
+
objectType: opts.objectType.name,
|
|
55
|
+
primaryKey,
|
|
56
|
+
property: property.name
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return opts.object;
|
|
79
60
|
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { decorateObjectAttachmentSources };
|
|
63
|
+
|
|
80
64
|
//# sourceMappingURL=attachmentSources.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachmentSources.js","
|
|
1
|
+
{"version":3,"file":"attachmentSources.js","names":[],"sources":["../../../src/live/attachments/attachmentSources.ts"],"sourcesContent":["import { resolveType } from \"../../utils/types.js\";\nimport type { ObjectTypeDef, OntologyIR, TypeDef } from \"../../ir/index.js\";\nimport type { attachment } from \"../../utils/values.js\";\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction isAttachment(value: unknown): value is attachment {\n return isRecord(value) && typeof value.id === \"string\";\n}\n\nfunction decorateAttachmentValue(opts: {\n ir: OntologyIR;\n type: TypeDef;\n value: unknown;\n source: NonNullable<attachment[\"source\"]>;\n}) {\n if (opts.value === undefined || opts.value === null) return;\n\n const type = resolveType(opts.ir, opts.type);\n switch (type.kind) {\n case \"attachment\":\n if (isAttachment(opts.value)) {\n opts.value.source = opts.source;\n }\n return;\n case \"optional\":\n decorateAttachmentValue({\n ...opts,\n type: type.value.type,\n });\n return;\n case \"list\":\n if (Array.isArray(opts.value)) {\n for (const item of opts.value) {\n decorateAttachmentValue({\n ...opts,\n type: type.value.elementType,\n value: item,\n });\n }\n }\n return;\n case \"map\":\n if (isRecord(opts.value)) {\n for (const item of Object.values(opts.value)) {\n decorateAttachmentValue({\n ...opts,\n type: type.value.valueType,\n value: item,\n });\n }\n }\n return;\n case \"struct\":\n if (isRecord(opts.value)) {\n for (const field of type.value.fields) {\n decorateAttachmentValue({\n ...opts,\n type: field.type,\n value: opts.value[field.name],\n });\n }\n }\n return;\n default:\n return;\n }\n}\n\nexport function decorateObjectAttachmentSources(opts: {\n ir: OntologyIR;\n objectType: ObjectTypeDef;\n object: Record<string, unknown>;\n}): Record<string, unknown> {\n const primaryKey = opts.object[opts.objectType.primaryKey];\n if (typeof primaryKey !== \"string\" && typeof primaryKey !== \"number\") {\n return opts.object;\n }\n\n for (const property of opts.objectType.properties) {\n decorateAttachmentValue({\n ir: opts.ir,\n type: property.type,\n value: opts.object[property.name],\n source: {\n objectType: opts.objectType.name,\n primaryKey,\n property: property.name,\n },\n });\n }\n\n return opts.object;\n}\n"],"mappings":";;AAIA,SAAS,SAAS,OAAkD;CAChE,OAAO,OAAO,UAAU,YAAY,UAAU;AAClD;AAEA,SAAS,aAAa,OAAqC;CACvD,OAAO,SAAS,KAAK,KAAK,OAAO,MAAM,OAAO;AAClD;AAEA,SAAS,wBAAwB,MAK9B;CACC,IAAI,KAAK,UAAU,KAAA,KAAa,KAAK,UAAU,MAAM;CAErD,MAAM,OAAO,YAAY,KAAK,IAAI,KAAK,IAAI;CAC3C,QAAQ,KAAK,MAAb;EACI,KAAK;GACD,IAAI,aAAa,KAAK,KAAK,GACvB,KAAK,MAAM,SAAS,KAAK;GAE7B;EACJ,KAAK;GACD,wBAAwB;IACpB,GAAG;IACH,MAAM,KAAK,MAAM;GACrB,CAAC;GACD;EACJ,KAAK;GACD,IAAI,MAAM,QAAQ,KAAK,KAAK,GACxB,KAAK,MAAM,QAAQ,KAAK,OACpB,wBAAwB;IACpB,GAAG;IACH,MAAM,KAAK,MAAM;IACjB,OAAO;GACX,CAAC;GAGT;EACJ,KAAK;GACD,IAAI,SAAS,KAAK,KAAK,GACnB,KAAK,MAAM,QAAQ,OAAO,OAAO,KAAK,KAAK,GACvC,wBAAwB;IACpB,GAAG;IACH,MAAM,KAAK,MAAM;IACjB,OAAO;GACX,CAAC;GAGT;EACJ,KAAK;GACD,IAAI,SAAS,KAAK,KAAK,GACnB,KAAK,MAAM,SAAS,KAAK,MAAM,QAC3B,wBAAwB;IACpB,GAAG;IACH,MAAM,MAAM;IACZ,OAAO,KAAK,MAAM,MAAM;GAC5B,CAAC;GAGT;EACJ,SACI;CACR;AACJ;AAEA,SAAgB,gCAAgC,MAIpB;CACxB,MAAM,aAAa,KAAK,OAAO,KAAK,WAAW;CAC/C,IAAI,OAAO,eAAe,YAAY,OAAO,eAAe,UACxD,OAAO,KAAK;CAGhB,KAAK,MAAM,YAAY,KAAK,WAAW,YACnC,wBAAwB;EACpB,IAAI,KAAK;EACT,MAAM,SAAS;EACf,OAAO,KAAK,OAAO,SAAS;EAC5B,QAAQ;GACJ,YAAY,KAAK,WAAW;GAC5B;GACA,UAAU,SAAS;EACvB;CACJ,CAAC;CAGL,OAAO,KAAK;AAChB"}
|
|
@@ -1,62 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { attachment, values_d_exports } from "../../utils/values.js";
|
|
2
|
+
import { OntologyIR } from "../../ir/generated/types.js";
|
|
3
|
+
import "../../ir/index.js";
|
|
4
|
+
import { OntologyAttachmentCreateTarget } from "../../utils/targets.js";
|
|
5
|
+
import { AttachmentMetadata, AttachmentMetadataSelection } from "./types.js";
|
|
6
|
+
import { OntologyAttachmentsAdapter } from "../OntologyBackendAdapter.js";
|
|
7
|
+
import { BlobManager } from "@party-stack/blobs";
|
|
8
|
+
//#region src/live/attachments/createLiveOntologyAttachments.d.ts
|
|
7
9
|
export interface LiveOntologyEagerAttachmentCreation {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
attachment: attachment;
|
|
11
|
+
isMaterialized?: Promise<void>;
|
|
10
12
|
}
|
|
11
13
|
interface LiveOntologyAttachmentCreateOptions {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
/**
|
|
15
|
+
* An opaque ID to use instead of generating one.
|
|
16
|
+
*/
|
|
17
|
+
id?: string;
|
|
18
|
+
target?: OntologyAttachmentCreateTarget;
|
|
19
|
+
eager?: boolean;
|
|
18
20
|
}
|
|
19
21
|
interface AttachmentOntologyDefinition {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
objectTypes: Record<string, Record<string, unknown>>;
|
|
23
|
+
actionTypes: Record<string, {
|
|
24
|
+
parameters: Record<string, unknown>;
|
|
25
|
+
}>;
|
|
24
26
|
}
|
|
25
|
-
type ExtractAttachment<Value> = Value extends
|
|
26
|
-
type AttachmentAtTarget<Ontology extends AttachmentOntologyDefinition, Target> = string extends keyof Ontology["objectTypes"] ?
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
type ExtractAttachment<Value> = Value extends attachment<infer Type> ? attachment<Type> : NonNullable<Value> extends ReadonlyArray<infer Element> ? ExtractAttachment<Element> : never;
|
|
28
|
+
type AttachmentAtTarget<Ontology extends AttachmentOntologyDefinition, Target> = string extends keyof Ontology["objectTypes"] ? attachment : Target extends {
|
|
29
|
+
kind: "objectProperty";
|
|
30
|
+
objectType: infer ObjectType;
|
|
31
|
+
property: infer Property;
|
|
30
32
|
} ? ObjectType extends keyof Ontology["objectTypes"] ? Property extends keyof Ontology["objectTypes"][ObjectType] ? ExtractAttachment<Ontology["objectTypes"][ObjectType][Property]> : never : never : Target extends {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} ? ActionType extends keyof Ontology["actionTypes"] ? Parameter extends keyof Ontology["actionTypes"][ActionType]["parameters"] ? ExtractAttachment<Ontology["actionTypes"][ActionType]["parameters"][Parameter]> : never : never :
|
|
33
|
+
kind: "actionParameter";
|
|
34
|
+
actionType: infer ActionType;
|
|
35
|
+
parameter: infer Parameter;
|
|
36
|
+
} ? ActionType extends keyof Ontology["actionTypes"] ? Parameter extends keyof Ontology["actionTypes"][ActionType]["parameters"] ? ExtractAttachment<Ontology["actionTypes"][ActionType]["parameters"][Parameter]> : never : never : attachment;
|
|
35
37
|
type LiveOntologyAttachmentCreateResult<Ontology extends AttachmentOntologyDefinition, Options extends LiveOntologyAttachmentCreateOptions | undefined> = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
attachment: Options extends {
|
|
39
|
+
target: infer Target;
|
|
40
|
+
} ? AttachmentAtTarget<Ontology, Target> : attachment;
|
|
39
41
|
} & (Options extends {
|
|
40
|
-
|
|
42
|
+
eager: true;
|
|
41
43
|
} ? {
|
|
42
|
-
|
|
44
|
+
isMaterialized?: Promise<void>;
|
|
43
45
|
} : {
|
|
44
|
-
|
|
46
|
+
isMaterialized?: never;
|
|
45
47
|
});
|
|
46
48
|
export interface LiveOntologyAttachments<Ontology extends AttachmentOntologyDefinition = AttachmentOntologyDefinition> {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
create: <const Options extends LiveOntologyAttachmentCreateOptions | undefined = undefined>(blob: Blob | File, opts?: Options) => Promise<LiveOntologyAttachmentCreateResult<Ontology, Options>>;
|
|
50
|
+
metadata: {
|
|
51
|
+
<Type extends string>(attachment: attachment<Type>): Promise<AttachmentMetadata<Type>>;
|
|
52
|
+
<Type extends string, const Selection extends AttachmentMetadataSelection<Type>>(attachment: attachment<Type>, options: {
|
|
53
|
+
select: Selection;
|
|
54
|
+
}): Promise<AttachmentMetadata<Type, Selection[number]>>;
|
|
55
|
+
};
|
|
56
|
+
blob: (attachment: attachment) => Promise<Blob>;
|
|
55
57
|
}
|
|
56
58
|
export declare function createLiveOntologyAttachments<Ontology extends AttachmentOntologyDefinition = AttachmentOntologyDefinition>(opts: {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
ir: OntologyIR;
|
|
60
|
+
attachmentsAdapter: OntologyAttachmentsAdapter;
|
|
61
|
+
blobManager: BlobManager;
|
|
60
62
|
}): LiveOntologyAttachments<Ontology>;
|
|
61
|
-
|
|
63
|
+
//#endregion
|
|
62
64
|
//# sourceMappingURL=createLiveOntologyAttachments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createLiveOntologyAttachments.d.ts","
|
|
1
|
+
{"version":3,"file":"createLiveOntologyAttachments.d.ts","names":["v","v.attachment"],"sources":["../../../src/live/attachments/createLiveOntologyAttachments.ts"],"mappings":";;;;;;;;iBAUiB;EACb,YAAYC;EACZ,iBAAiB;;UAGX;;;;EAIN;EACA,SAAS;EACT;;UAGM;EACN,aAAa,eAAe;EAC5B,aAAa;IAGL,YAAY;;;KAKnB,kBAAkB,SACnB,cAAcA,iBAAmB,QAC3BA,WAAa,QACb,YAAY,eAAe,oBAAoB,WAC7C,kBAAkB;KAGzB,mBACD,iBAAiB,8BACjB,+BACqB,0BACnBA,aACA;EACM;EACA,kBAAkB;EAClB,gBAAgB;IAEpB,yBAAyB,0BACrB,uBAAuB,wBAAwB,cAC3C,kBAAkB,wBAAwB,YAAY,6BAG9D;EACM;EACA,kBAAkB;EAClB,iBAAiB;IAErB,yBAAyB,0BACrB,wBAAwB,wBAAwB,4BAC5C,kBAAkB,wBAAwB,0BAA0B,8BAG5EA;KAEL,mCACD,iBAAiB,8BACjB,gBAAgB;EAEhB,YAAY;IAAkB,cAAc;MACtC,mBAAmB,UAAU,UAC7BA;KACL;EAAkB;;EAAkB,iBAAiB;;EAAoB;;iBAM7D,wBACb,iBAAiB,+BAA+B;EAEhD,eAAe,gBAAgB,6DAC3B,MAAM,OAAO,MACb,OAAO,YACN,QAAQ,mCAAmC,UAAU;EAC1D;KACK,qBAAqB,YAAYA,WAAa,QAAQ,QAAQ,mBAAmB;KACjF,2BAA2B,kBAAkB,4BAA4B,OACtE,YAAYA,WAAa,OACzB;MAAW,QAAQ;QACpB,QAAQ,mBAAmB,MAAM;;EAExC,OAAO,YAAYA,eAAiB,QAAQ;;wBAGhC,8BACZ,iBAAiB,+BAA+B,8BAClD;EACE,IAAI;EACJ,oBAAoB;EACpB,aAAa;IACb,wBAAwB"}
|
|
@@ -1,88 +1,70 @@
|
|
|
1
|
-
import { invariant } from "@bobbyfidz/panic";
|
|
2
|
-
import { ImageMediaTypeOptions } from "../../ir/generated/constants.js";
|
|
3
1
|
import { getTargetValueType } from "../../utils/types.js";
|
|
2
|
+
import { ImageMediaTypeOptions } from "../../ir/generated/constants.js";
|
|
3
|
+
import { invariant } from "@bobbyfidz/panic";
|
|
4
|
+
//#region src/live/attachments/createLiveOntologyAttachments.ts
|
|
4
5
|
function satisfiesRange(value, range) {
|
|
5
|
-
|
|
6
|
+
return (range.min === void 0 || value >= range.min) && (range.max === void 0 || value <= range.max);
|
|
6
7
|
}
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
66
|
-
async function metadata(attachment, options) {
|
|
67
|
-
const selection = options?.select ?? ["size", "type", "name"];
|
|
68
|
-
const resolved = await blobManager.metadata(attachment.id, {
|
|
69
|
-
meta: { attachment },
|
|
70
|
-
select: selection,
|
|
71
|
-
});
|
|
72
|
-
if (selection.includes("dimensions") && resolved.dimensions === null) {
|
|
73
|
-
throw new Error(`Dimensions are unavailable for attachment "${attachment.id}".`);
|
|
74
|
-
}
|
|
75
|
-
const { name, ...metadata } = resolved;
|
|
76
|
-
return {
|
|
77
|
-
...attachment,
|
|
78
|
-
...metadata,
|
|
79
|
-
...(typeof name === "string" ? { name } : {}),
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
create,
|
|
84
|
-
metadata,
|
|
85
|
-
blob,
|
|
86
|
-
};
|
|
8
|
+
function createLiveOntologyAttachments(opts) {
|
|
9
|
+
const { attachmentsAdapter, blobManager } = opts;
|
|
10
|
+
const create = async (blob, createOpts) => {
|
|
11
|
+
const normalizedOpts = createOpts ?? {};
|
|
12
|
+
const targetType = normalizedOpts.target ? getTargetValueType(opts.ir, normalizedOpts.target) : void 0;
|
|
13
|
+
invariant(targetType === void 0 || targetType.kind === "attachment", "Target is not an attachment.");
|
|
14
|
+
const constraint = targetType?.kind === "attachment" ? targetType.value.constraint : void 0;
|
|
15
|
+
invariant(!constraint?.size || satisfiesRange(blob.size, constraint.size), `Attachment size ${blob.size} is outside the allowed range.`);
|
|
16
|
+
const content = constraint?.content;
|
|
17
|
+
if (content?.kind === "image") invariant(content.value.mediaTypes ? content.value.mediaTypes.some((mediaType) => mediaType === blob.type) : ImageMediaTypeOptions.some((option) => option.value === blob.type), `Attachment media type "${blob.type || "(empty)"}" is not allowed by the target.`);
|
|
18
|
+
const id = normalizedOpts.id ?? (targetType?.kind === "attachment" && attachmentsAdapter.generateAttachmentId ? await attachmentsAdapter.generateAttachmentId(blob, { target: targetType.value }) : crypto.randomUUID());
|
|
19
|
+
await blobManager.stage(id, blob);
|
|
20
|
+
const attachment = {
|
|
21
|
+
id,
|
|
22
|
+
type: blob.type
|
|
23
|
+
};
|
|
24
|
+
const materializeAttachment = attachmentsAdapter.materializeAttachment;
|
|
25
|
+
const materializeOptions = { target: targetType?.kind === "attachment" ? targetType.value : void 0 };
|
|
26
|
+
const canMaterialize = materializeAttachment && (attachmentsAdapter.canMaterializeAttachment?.(attachment, materializeOptions) ?? true);
|
|
27
|
+
if (normalizedOpts.eager && canMaterialize) {
|
|
28
|
+
const promise = blobManager.read(id).then((storedBlob) => materializeAttachment(attachment, storedBlob, materializeOptions)).then(async (materialized) => {
|
|
29
|
+
if (materialized) {
|
|
30
|
+
if (materialized.id !== id) await blobManager.bindRemoteId(id, materialized.id);
|
|
31
|
+
Object.assign(attachment, materialized);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
promise.catch(() => void 0);
|
|
35
|
+
return {
|
|
36
|
+
attachment,
|
|
37
|
+
isMaterialized: promise
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return { attachment };
|
|
41
|
+
};
|
|
42
|
+
const blob = (attachment) => blobManager.read(attachment.id, { meta: { attachment } });
|
|
43
|
+
async function metadata(attachment, options) {
|
|
44
|
+
const selection = options?.select ?? [
|
|
45
|
+
"size",
|
|
46
|
+
"type",
|
|
47
|
+
"name"
|
|
48
|
+
];
|
|
49
|
+
const resolved = await blobManager.metadata(attachment.id, {
|
|
50
|
+
meta: { attachment },
|
|
51
|
+
select: selection
|
|
52
|
+
});
|
|
53
|
+
if (selection.includes("dimensions") && resolved.dimensions === null) throw new Error(`Dimensions are unavailable for attachment "${attachment.id}".`);
|
|
54
|
+
const { name, ...metadata } = resolved;
|
|
55
|
+
return {
|
|
56
|
+
...attachment,
|
|
57
|
+
...metadata,
|
|
58
|
+
...typeof name === "string" ? { name } : {}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
create,
|
|
63
|
+
metadata,
|
|
64
|
+
blob
|
|
65
|
+
};
|
|
87
66
|
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { createLiveOntologyAttachments };
|
|
69
|
+
|
|
88
70
|
//# sourceMappingURL=createLiveOntologyAttachments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createLiveOntologyAttachments.js","sourceRoot":"","sources":["../../../src/live/attachments/createLiveOntologyAttachments.ts"],"names":[],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"createLiveOntologyAttachments.js","names":[],"sources":["../../../src/live/attachments/createLiveOntologyAttachments.ts"],"sourcesContent":["import { invariant } from \"@bobbyfidz/panic\";\nimport { ImageMediaTypeOptions } from \"../../ir/generated/constants.js\";\nimport { getTargetValueType } from \"../../utils/types.js\";\nimport * as v from \"../../utils/values.js\";\nimport type { OntologyIR } from \"../../ir/index.js\";\nimport type { OntologyAttachmentCreateTarget } from \"../../utils/targets.js\";\nimport type { OntologyAttachmentsAdapter } from \"../OntologyBackendAdapter.js\";\nimport type { AttachmentMetadata, AttachmentMetadataSelection, PartialAttachmentMetadata } from \"./types.js\";\nimport type { BlobManager } from \"@party-stack/blobs\";\n\nexport interface LiveOntologyEagerAttachmentCreation {\n attachment: v.attachment;\n isMaterialized?: Promise<void>;\n}\n\ninterface LiveOntologyAttachmentCreateOptions {\n /**\n * An opaque ID to use instead of generating one.\n */\n id?: string;\n target?: OntologyAttachmentCreateTarget;\n eager?: boolean;\n}\n\ninterface AttachmentOntologyDefinition {\n objectTypes: Record<string, Record<string, unknown>>;\n actionTypes: Record<\n string,\n {\n parameters: Record<string, unknown>;\n }\n >;\n}\n\ntype ExtractAttachment<Value> =\n Value extends v.attachment<infer Type>\n ? v.attachment<Type>\n : NonNullable<Value> extends ReadonlyArray<infer Element>\n ? ExtractAttachment<Element>\n : never;\n\ntype AttachmentAtTarget<\n Ontology extends AttachmentOntologyDefinition,\n Target,\n> = string extends keyof Ontology[\"objectTypes\"]\n ? v.attachment\n : Target extends {\n kind: \"objectProperty\";\n objectType: infer ObjectType;\n property: infer Property;\n }\n ? ObjectType extends keyof Ontology[\"objectTypes\"]\n ? Property extends keyof Ontology[\"objectTypes\"][ObjectType]\n ? ExtractAttachment<Ontology[\"objectTypes\"][ObjectType][Property]>\n : never\n : never\n : Target extends {\n kind: \"actionParameter\";\n actionType: infer ActionType;\n parameter: infer Parameter;\n }\n ? ActionType extends keyof Ontology[\"actionTypes\"]\n ? Parameter extends keyof Ontology[\"actionTypes\"][ActionType][\"parameters\"]\n ? ExtractAttachment<Ontology[\"actionTypes\"][ActionType][\"parameters\"][Parameter]>\n : never\n : never\n : v.attachment;\n\ntype LiveOntologyAttachmentCreateResult<\n Ontology extends AttachmentOntologyDefinition,\n Options extends LiveOntologyAttachmentCreateOptions | undefined,\n> = {\n attachment: Options extends { target: infer Target }\n ? AttachmentAtTarget<Ontology, Target>\n : v.attachment;\n} & (Options extends { eager: true } ? { isMaterialized?: Promise<void> } : { isMaterialized?: never });\n\nfunction satisfiesRange(value: number, range: { min?: number; max?: number }): boolean {\n return (range.min === undefined || value >= range.min) && (range.max === undefined || value <= range.max);\n}\n\nexport interface LiveOntologyAttachments<\n Ontology extends AttachmentOntologyDefinition = AttachmentOntologyDefinition,\n> {\n create: <const Options extends LiveOntologyAttachmentCreateOptions | undefined = undefined>(\n blob: Blob | File,\n opts?: Options\n ) => Promise<LiveOntologyAttachmentCreateResult<Ontology, Options>>;\n metadata: {\n <Type extends string>(attachment: v.attachment<Type>): Promise<AttachmentMetadata<Type>>;\n <Type extends string, const Selection extends AttachmentMetadataSelection<Type>>(\n attachment: v.attachment<Type>,\n options: { select: Selection }\n ): Promise<AttachmentMetadata<Type, Selection[number]>>;\n };\n blob: (attachment: v.attachment) => Promise<Blob>;\n}\n\nexport function createLiveOntologyAttachments<\n Ontology extends AttachmentOntologyDefinition = AttachmentOntologyDefinition,\n>(opts: {\n ir: OntologyIR;\n attachmentsAdapter: OntologyAttachmentsAdapter;\n blobManager: BlobManager;\n}): LiveOntologyAttachments<Ontology> {\n const { attachmentsAdapter, blobManager } = opts;\n\n const create = async <const Options extends LiveOntologyAttachmentCreateOptions | undefined = undefined>(\n blob: Blob | File,\n createOpts?: Options\n ): Promise<LiveOntologyAttachmentCreateResult<Ontology, Options>> => {\n const normalizedOpts: LiveOntologyAttachmentCreateOptions = createOpts ?? {};\n const targetType = normalizedOpts.target\n ? getTargetValueType(opts.ir, normalizedOpts.target)\n : undefined;\n invariant(\n targetType === undefined || targetType.kind === \"attachment\",\n \"Target is not an attachment.\"\n );\n const constraint = targetType?.kind === \"attachment\" ? targetType.value.constraint : undefined;\n invariant(\n !constraint?.size || satisfiesRange(blob.size, constraint.size),\n `Attachment size ${blob.size} is outside the allowed range.`\n );\n const content = constraint?.content;\n if (content?.kind === \"image\") {\n invariant(\n content.value.mediaTypes\n ? content.value.mediaTypes.some((mediaType) => mediaType === blob.type)\n : ImageMediaTypeOptions.some((option) => option.value === blob.type),\n `Attachment media type \"${blob.type || \"(empty)\"}\" is not allowed by the target.`\n );\n // TODO: Validate image dimensions once runtimes expose a portable media-inspection capability.\n }\n const id =\n normalizedOpts.id ??\n (targetType?.kind === \"attachment\" && attachmentsAdapter.generateAttachmentId\n ? await attachmentsAdapter.generateAttachmentId(blob, {\n target: targetType.value,\n })\n : crypto.randomUUID());\n await blobManager.stage(id, blob);\n const attachment: v.attachment = {\n id,\n type: blob.type,\n };\n const materializeAttachment = attachmentsAdapter.materializeAttachment;\n const materializeOptions = {\n target: targetType?.kind === \"attachment\" ? targetType.value : undefined,\n };\n const canMaterialize =\n materializeAttachment &&\n (attachmentsAdapter.canMaterializeAttachment?.(attachment, materializeOptions) ?? true);\n if (normalizedOpts.eager && canMaterialize) {\n const promise = blobManager\n .read(id)\n .then((storedBlob) => materializeAttachment(attachment, storedBlob, materializeOptions))\n .then(async (materialized) => {\n if (materialized) {\n if (materialized.id !== id) {\n await blobManager.bindRemoteId(id, materialized.id);\n }\n Object.assign(attachment, materialized);\n }\n });\n void promise.catch(() => undefined);\n return {\n attachment,\n isMaterialized: promise,\n } as unknown as LiveOntologyAttachmentCreateResult<Ontology, Options>;\n }\n return {\n attachment,\n } as LiveOntologyAttachmentCreateResult<Ontology, Options>;\n };\n\n const blob = (attachment: v.attachment) =>\n blobManager.read(attachment.id, {\n meta: { attachment },\n });\n\n async function metadata<Type extends string>(\n attachment: v.attachment<Type>\n ): Promise<AttachmentMetadata<Type>>;\n async function metadata<Type extends string, const Selection extends AttachmentMetadataSelection<Type>>(\n attachment: v.attachment<Type>,\n options: { select: Selection }\n ): Promise<AttachmentMetadata<Type, Selection[number]>>;\n async function metadata<Type extends string>(\n attachment: v.attachment<Type>,\n options?: { select: readonly (keyof PartialAttachmentMetadata)[] }\n ): Promise<v.attachment<Type> & PartialAttachmentMetadata<Type>> {\n const selection = options?.select ?? [\"size\", \"type\", \"name\"];\n const resolved = await blobManager.metadata(attachment.id, {\n meta: { attachment },\n select: selection,\n });\n if (selection.includes(\"dimensions\") && resolved.dimensions === null) {\n throw new Error(`Dimensions are unavailable for attachment \"${attachment.id}\".`);\n }\n const { name, ...metadata } = resolved;\n return {\n ...attachment,\n ...metadata,\n ...(typeof name === \"string\" ? { name } : {}),\n } as v.attachment<Type> & PartialAttachmentMetadata<Type>;\n }\n\n return {\n create,\n metadata,\n blob,\n };\n}\n"],"mappings":";;;;AA6EA,SAAS,eAAe,OAAe,OAAgD;CACnF,QAAQ,MAAM,QAAQ,KAAA,KAAa,SAAS,MAAM,SAAS,MAAM,QAAQ,KAAA,KAAa,SAAS,MAAM;AACzG;AAmBA,SAAgB,8BAEd,MAIoC;CAClC,MAAM,EAAE,oBAAoB,gBAAgB;CAE5C,MAAM,SAAS,OACX,MACA,eACiE;EACjE,MAAM,iBAAsD,cAAc,CAAC;EAC3E,MAAM,aAAa,eAAe,SAC5B,mBAAmB,KAAK,IAAI,eAAe,MAAM,IACjD,KAAA;EACN,UACI,eAAe,KAAA,KAAa,WAAW,SAAS,cAChD,8BACJ;EACA,MAAM,aAAa,YAAY,SAAS,eAAe,WAAW,MAAM,aAAa,KAAA;EACrF,UACI,CAAC,YAAY,QAAQ,eAAe,KAAK,MAAM,WAAW,IAAI,GAC9D,mBAAmB,KAAK,KAAK,+BACjC;EACA,MAAM,UAAU,YAAY;EAC5B,IAAI,SAAS,SAAS,SAClB,UACI,QAAQ,MAAM,aACR,QAAQ,MAAM,WAAW,MAAM,cAAc,cAAc,KAAK,IAAI,IACpE,sBAAsB,MAAM,WAAW,OAAO,UAAU,KAAK,IAAI,GACvE,0BAA0B,KAAK,QAAQ,UAAU,gCACrD;EAGJ,MAAM,KACF,eAAe,OACd,YAAY,SAAS,gBAAgB,mBAAmB,uBACnD,MAAM,mBAAmB,qBAAqB,MAAM,EAChD,QAAQ,WAAW,MACvB,CAAC,IACD,OAAO,WAAW;EAC5B,MAAM,YAAY,MAAM,IAAI,IAAI;EAChC,MAAM,aAA2B;GAC7B;GACA,MAAM,KAAK;EACf;EACA,MAAM,wBAAwB,mBAAmB;EACjD,MAAM,qBAAqB,EACvB,QAAQ,YAAY,SAAS,eAAe,WAAW,QAAQ,KAAA,EACnE;EACA,MAAM,iBACF,0BACC,mBAAmB,2BAA2B,YAAY,kBAAkB,KAAK;EACtF,IAAI,eAAe,SAAS,gBAAgB;GACxC,MAAM,UAAU,YACX,KAAK,EAAE,CAAC,CACR,MAAM,eAAe,sBAAsB,YAAY,YAAY,kBAAkB,CAAC,CAAC,CACvF,KAAK,OAAO,iBAAiB;IAC1B,IAAI,cAAc;KACd,IAAI,aAAa,OAAO,IACpB,MAAM,YAAY,aAAa,IAAI,aAAa,EAAE;KAEtD,OAAO,OAAO,YAAY,YAAY;IAC1C;GACJ,CAAC;GACL,QAAa,YAAY,KAAA,CAAS;GAClC,OAAO;IACH;IACA,gBAAgB;GACpB;EACJ;EACA,OAAO,EACH,WACJ;CACJ;CAEA,MAAM,QAAQ,eACV,YAAY,KAAK,WAAW,IAAI,EAC5B,MAAM,EAAE,WAAW,EACvB,CAAC;CASL,eAAe,SACX,YACA,SAC6D;EAC7D,MAAM,YAAY,SAAS,UAAU;GAAC;GAAQ;GAAQ;EAAM;EAC5D,MAAM,WAAW,MAAM,YAAY,SAAS,WAAW,IAAI;GACvD,MAAM,EAAE,WAAW;GACnB,QAAQ;EACZ,CAAC;EACD,IAAI,UAAU,SAAS,YAAY,KAAK,SAAS,eAAe,MAC5D,MAAM,IAAI,MAAM,8CAA8C,WAAW,GAAG,GAAG;EAEnF,MAAM,EAAE,MAAM,GAAG,aAAa;EAC9B,OAAO;GACH,GAAG;GACH,GAAG;GACH,GAAI,OAAO,SAAS,WAAW,EAAE,KAAK,IAAI,CAAC;EAC/C;CACJ;CAEA,OAAO;EACH;EACA;EACA;CACJ;AACJ"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { attachment } from "../../utils/values.js";
|
|
2
|
+
import { ImageMediaType } from "../../ir/generated/types.js";
|
|
3
|
+
import { BlobDimensions } from "@party-stack/blobs";
|
|
4
|
+
//#region src/live/attachments/types.d.ts
|
|
4
5
|
type AttachmentMetadataValues<Type extends string> = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
size: number;
|
|
7
|
+
type: Type;
|
|
8
|
+
name?: string;
|
|
9
|
+
dimensions: BlobDimensions;
|
|
9
10
|
};
|
|
10
|
-
export type AttachmentMetadataField<Type extends string = string> = Exclude<keyof AttachmentMetadataValues<Type>, "dimensions"> | ([Type] extends [
|
|
11
|
+
export type AttachmentMetadataField<Type extends string = string> = Exclude<keyof AttachmentMetadataValues<Type>, "dimensions"> | ([Type] extends [ImageMediaType] ? "dimensions" : never);
|
|
11
12
|
export type AttachmentMetadataSelection<Type extends string = string> = ReadonlyArray<AttachmentMetadataField<Type>>;
|
|
12
13
|
export type PartialAttachmentMetadata<Type extends string = string> = Partial<AttachmentMetadataValues<Type>>;
|
|
13
14
|
export type AttachmentMetadata<Type extends string = string, Selected extends AttachmentMetadataField<Type> = "size" | "type" | "name"> = attachment<Type> & Pick<AttachmentMetadataValues<Type>, Selected>;
|
|
14
|
-
|
|
15
|
+
//#endregion
|
|
15
16
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":["GeneratedImageMediaType"],"sources":["../../../src/live/attachments/types.ts"],"mappings":";;;;KAIK,yBAAyB;EAC1B;EACA,MAAM;EACN;EACA,YAAY;;YAGJ,wBAAwB,gCAC9B,cAAc,yBAAyB,yBACrC,eAAeA;YAEX,4BAA4B,gCAAgC,cACpE,wBAAwB;YAGhB,0BAA0B,gCAAgC,QAAQ,yBAAyB;YAE3F,mBACR,8BACA,iBAAiB,wBAAwB,oCACzC,WAAW,QAAQ,KAAK,yBAAyB,OAAO"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { OntologyAttachmentsAdapter } from "../OntologyBackendAdapter.js";
|
|
2
|
+
//#region src/live/attachments/unsupportedOntologyAttachmentsAdapter.d.ts
|
|
2
3
|
export declare const unsupportedOntologyAttachmentsAdapter: OntologyAttachmentsAdapter;
|
|
4
|
+
//#endregion
|
|
3
5
|
//# sourceMappingURL=unsupportedOntologyAttachmentsAdapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsupportedOntologyAttachmentsAdapter.d.ts","
|
|
1
|
+
{"version":3,"file":"unsupportedOntologyAttachmentsAdapter.d.ts","names":[],"sources":["../../../src/live/attachments/unsupportedOntologyAttachmentsAdapter.ts"],"mappings":";;qBAEa,uCAAuC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/live/attachments/unsupportedOntologyAttachmentsAdapter.ts
|
|
2
|
+
const unsupportedOntologyAttachmentsAdapter = { getAttachmentContent: (attachment) => Promise.reject(/* @__PURE__ */ new Error(`Ontology adapter cannot read attachment content for "${attachment.id}".`)) };
|
|
3
|
+
//#endregion
|
|
4
|
+
export { unsupportedOntologyAttachmentsAdapter };
|
|
5
|
+
|
|
4
6
|
//# sourceMappingURL=unsupportedOntologyAttachmentsAdapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsupportedOntologyAttachmentsAdapter.js","
|
|
1
|
+
{"version":3,"file":"unsupportedOntologyAttachmentsAdapter.js","names":[],"sources":["../../../src/live/attachments/unsupportedOntologyAttachmentsAdapter.ts"],"sourcesContent":["import type { OntologyAttachmentsAdapter } from \"../OntologyBackendAdapter.js\";\n\nexport const unsupportedOntologyAttachmentsAdapter: OntologyAttachmentsAdapter = {\n getAttachmentContent: (attachment) =>\n Promise.reject(new Error(`Ontology adapter cannot read attachment content for \"${attachment.id}\".`)),\n};\n"],"mappings":";AAEA,MAAa,wCAAoE,EAC7E,uBAAuB,eACnB,QAAQ,uBAAO,IAAI,MAAM,wDAAwD,WAAW,GAAG,GAAG,CAAC,EAC3G"}
|
package/lib/live/expression.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Expression, InputReferenceExpression, ObjectTypeDef, OntologyIR } from "../ir/generated/types.js";
|
|
2
|
+
import "../ir/index.js";
|
|
3
|
+
import { OntologyReadTx } from "./mutators/types.js";
|
|
4
|
+
//#region src/live/expression.d.ts
|
|
3
5
|
interface EvaluateExpressionOptions {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
ir: OntologyIR;
|
|
7
|
+
actionTypeName: string;
|
|
8
|
+
expression: Expression;
|
|
9
|
+
resolveParameter: (parameterName: string) => Promise<unknown>;
|
|
10
|
+
context: Record<string, unknown>;
|
|
11
|
+
tx: OntologyReadTx;
|
|
10
12
|
}
|
|
11
13
|
export declare function evaluateExpression(options: EvaluateExpressionOptions): Promise<unknown>;
|
|
12
14
|
export declare function resolveActionParameters(options: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
ir: OntologyIR;
|
|
16
|
+
actionTypeName: string;
|
|
17
|
+
initialParameters: Record<string, unknown>;
|
|
18
|
+
context: Record<string, unknown>;
|
|
19
|
+
tx: OntologyReadTx;
|
|
18
20
|
}): Promise<Record<string, unknown>>;
|
|
19
21
|
export declare function getObjectReferenceObjectType(ir: OntologyIR, actionTypeName: string, reference: InputReferenceExpression): ObjectTypeDef;
|
|
20
|
-
|
|
22
|
+
//#endregion
|
|
21
23
|
//# sourceMappingURL=expression.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.d.ts","
|
|
1
|
+
{"version":3,"file":"expression.d.ts","names":[],"sources":["../../src/live/expression.ts"],"mappings":";;;;UAmBU;EACN,IAAI;EACJ;EACA,YAAY;EACZ,mBAAmB,0BAA0B;EAC7C,SAAS;EACT,IAAI;;wBAuCc,mBAAmB,SAAS,4BAA4B;wBA6MxD,wBAAwB;EAC1C,IAAI;EACJ;EACA,mBAAmB;EACnB,SAAS;EACT,IAAI;IACJ,QAAQ;wBAwCI,6BACZ,IAAI,YACJ,wBACA,WAAW,2BACZ"}
|