@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outboxService.js","
|
|
1
|
+
{"version":3,"file":"outboxService.js","names":[],"sources":["../../../src/live/outbox/outboxService.ts"],"sourcesContent":["import { OntologyOutboxRepository } from \"./repository.js\";\nimport {\n OUTBOX_COORDINATION_SERVICE,\n type OutboxCoordinationService,\n type OutboxResultEvent,\n} from \"./service.js\";\nimport type {\n CoordinationHost,\n CoordinationServiceHandlers,\n CoordinationServiceServer,\n} from \"@party-stack/runtime\";\n\nexport function serveOntologyOutbox(\n host: CoordinationHost,\n repository: OntologyOutboxRepository\n): CoordinationServiceServer<OutboxCoordinationService> {\n let publishResult: (event: OutboxResultEvent) => void = () => undefined;\n const handlers: CoordinationServiceHandlers<OutboxCoordinationService> = {\n enqueue: ({ entry }) => repository.enqueue(entry),\n edit: ({ id, request }) => repository.edit(id, request),\n remove: async ({ id }) => {\n await repository.remove(id);\n publishResult({\n type: \"rejected\",\n id,\n error: {\n name: \"OutboxEntryRemoved\",\n message: \"Outbox entry removed.\",\n },\n });\n },\n retry: ({ id }) => repository.retry(id),\n recover: async ({ failureStrategy, maxRetries }) => {\n const discarded = await repository.recover(failureStrategy, maxRetries);\n for (const entry of discarded) {\n publishResult({\n type: \"rejected\",\n id: entry.id,\n error: {\n name: \"InterruptedExecutionDiscarded\",\n message:\n \"Discarded because execution was interrupted before its result was recorded.\",\n },\n });\n }\n },\n claim: () => repository.claim(),\n nextRetryAt: () => repository.nextRetryAt(),\n complete: async ({ id, executionId, result }) => {\n await repository.complete(id, executionId);\n publishResult({\n type: \"completed\",\n id,\n result,\n });\n },\n fail: async ({ id, executionId, retryable, retryAt, error }) => {\n const entry = await repository.fail(id, executionId, retryable, error, retryAt);\n if (!retryable) {\n publishResult({\n type: \"rejected\",\n id,\n error,\n });\n }\n return entry;\n },\n discardAll: async ({ id, executionId, error }) => {\n const discarded = await repository.discardAll(id, executionId);\n for (const entry of discarded) {\n publishResult({\n type: \"rejected\",\n id: entry.id,\n error:\n entry.id === id\n ? error\n : {\n name: \"OutboxDiscardedAfterNonRetryableError\",\n message: `Discarded because outbox entry \"${id}\" failed permanently: ${error.message}`,\n },\n });\n }\n },\n };\n\n const server = host.serve<OutboxCoordinationService>(OUTBOX_COORDINATION_SERVICE, handlers);\n publishResult = (event) => server.events.publish(\"result\", event);\n return server;\n}\n"],"mappings":";;AAYA,SAAgB,oBACZ,MACA,YACoD;CACpD,IAAI,sBAA0D,KAAA;CAqE9D,MAAM,SAAS,KAAK,MAAiC,6BAA6B;EAnE9E,UAAU,EAAE,YAAY,WAAW,QAAQ,KAAK;EAChD,OAAO,EAAE,IAAI,cAAc,WAAW,KAAK,IAAI,OAAO;EACtD,QAAQ,OAAO,EAAE,SAAS;GACtB,MAAM,WAAW,OAAO,EAAE;GAC1B,cAAc;IACV,MAAM;IACN;IACA,OAAO;KACH,MAAM;KACN,SAAS;IACb;GACJ,CAAC;EACL;EACA,QAAQ,EAAE,SAAS,WAAW,MAAM,EAAE;EACtC,SAAS,OAAO,EAAE,iBAAiB,iBAAiB;GAChD,MAAM,YAAY,MAAM,WAAW,QAAQ,iBAAiB,UAAU;GACtE,KAAK,MAAM,SAAS,WAChB,cAAc;IACV,MAAM;IACN,IAAI,MAAM;IACV,OAAO;KACH,MAAM;KACN,SACI;IACR;GACJ,CAAC;EAET;EACA,aAAa,WAAW,MAAM;EAC9B,mBAAmB,WAAW,YAAY;EAC1C,UAAU,OAAO,EAAE,IAAI,aAAa,aAAa;GAC7C,MAAM,WAAW,SAAS,IAAI,WAAW;GACzC,cAAc;IACV,MAAM;IACN;IACA;GACJ,CAAC;EACL;EACA,MAAM,OAAO,EAAE,IAAI,aAAa,WAAW,SAAS,YAAY;GAC5D,MAAM,QAAQ,MAAM,WAAW,KAAK,IAAI,aAAa,WAAW,OAAO,OAAO;GAC9E,IAAI,CAAC,WACD,cAAc;IACV,MAAM;IACN;IACA;GACJ,CAAC;GAEL,OAAO;EACX;EACA,YAAY,OAAO,EAAE,IAAI,aAAa,YAAY;GAC9C,MAAM,YAAY,MAAM,WAAW,WAAW,IAAI,WAAW;GAC7D,KAAK,MAAM,SAAS,WAChB,cAAc;IACV,MAAM;IACN,IAAI,MAAM;IACV,OACI,MAAM,OAAO,KACP,QACA;KACI,MAAM;KACN,SAAS,mCAAmC,GAAG,wBAAwB,MAAM;IACjF;GACd,CAAC;EAET;CAGqF,CAAC;CAC1F,iBAAiB,UAAU,OAAO,OAAO,QAAQ,UAAU,KAAK;CAChE,OAAO;AACX"}
|
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { OntologyOutboxEntry } from "./types.js";
|
|
2
|
+
//#region src/live/outbox/projectionManager.d.ts
|
|
2
3
|
export interface OutboxProjection {
|
|
3
|
-
|
|
4
|
+
settle(error?: Error): void | Promise<void>;
|
|
4
5
|
}
|
|
5
6
|
export declare class OutboxProjectionManager {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
private readonly project;
|
|
8
|
+
private desired;
|
|
9
|
+
private readonly projections;
|
|
10
|
+
private readonly installedFingerprints;
|
|
11
|
+
private readonly versions;
|
|
12
|
+
private tail;
|
|
13
|
+
private closed;
|
|
14
|
+
private disabledError;
|
|
15
|
+
constructor(project: ((entry: OntologyOutboxEntry) => Promise<OutboxProjection | undefined>) | undefined);
|
|
16
|
+
get error(): Error | undefined;
|
|
17
|
+
restore(entries: readonly OntologyOutboxEntry[]): Promise<void>;
|
|
18
|
+
reconcile(entries: readonly OntologyOutboxEntry[]): Promise<void>;
|
|
19
|
+
ensure(entry: OntologyOutboxEntry): Promise<void>;
|
|
20
|
+
discard(id: string, error?: Error): Promise<void>;
|
|
21
|
+
close(): Promise<void>;
|
|
22
|
+
private schedule;
|
|
23
|
+
private applyDesired;
|
|
24
|
+
private disable;
|
|
25
|
+
private firstDivergence;
|
|
26
|
+
private install;
|
|
27
|
+
private invalidate;
|
|
28
|
+
private settle;
|
|
28
29
|
}
|
|
30
|
+
//#endregion
|
|
29
31
|
//# sourceMappingURL=projectionManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectionManager.d.ts","
|
|
1
|
+
{"version":3,"file":"projectionManager.d.ts","names":[],"sources":["../../../src/live/outbox/projectionManager.ts"],"mappings":";;iBAGiB;EACb,OAAO,QAAQ,eAAe;;qBAsBrB;mBAUY;UATb;mBACS;mBACA;mBACA;UACT;UACA;UACA;EAER,YACqB,WACT,OAAO,wBAAwB,QAAQ;MAI/C,SAAS;EAIb,QAAQ,kBAAkB,wBAAwB;EAIlD,UAAU,kBAAkB,wBAAwB;EAIpD,OAAO,OAAO,sBAAsB;EAUpC,QAAQ,YAAY,QAAQ,QAAQ;EAUpC,SAAS;UASD;UAWM;UAsCA;UAQN;UAkBM;UAsBA;UAOA"}
|
|
@@ -1,153 +1,127 @@
|
|
|
1
1
|
import { requestFingerprint } from "./repository.js";
|
|
2
|
+
//#region src/live/outbox/projectionManager.ts
|
|
2
3
|
function normalizeError(error) {
|
|
3
|
-
|
|
4
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
4
5
|
}
|
|
5
6
|
function desiredProjections(entries) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
.map((entry) => ({
|
|
11
|
-
entry,
|
|
12
|
-
fingerprint: requestFingerprint(entry.request),
|
|
13
|
-
}));
|
|
14
|
-
}
|
|
15
|
-
export class OutboxProjectionManager {
|
|
16
|
-
project;
|
|
17
|
-
desired = [];
|
|
18
|
-
projections = new Map();
|
|
19
|
-
installedFingerprints = new Map();
|
|
20
|
-
versions = new Map();
|
|
21
|
-
tail = Promise.resolve();
|
|
22
|
-
closed = false;
|
|
23
|
-
disabledError;
|
|
24
|
-
constructor(project) {
|
|
25
|
-
this.project = project;
|
|
26
|
-
}
|
|
27
|
-
get error() {
|
|
28
|
-
return this.disabledError;
|
|
29
|
-
}
|
|
30
|
-
restore(entries) {
|
|
31
|
-
return this.schedule(() => this.applyDesired(desiredProjections(entries)));
|
|
32
|
-
}
|
|
33
|
-
reconcile(entries) {
|
|
34
|
-
return this.schedule(() => this.applyDesired(desiredProjections(entries)));
|
|
35
|
-
}
|
|
36
|
-
ensure(entry) {
|
|
37
|
-
return this.schedule(() => {
|
|
38
|
-
const entries = this.desired
|
|
39
|
-
.filter((candidate) => candidate.entry.id !== entry.id)
|
|
40
|
-
.map((candidate) => candidate.entry);
|
|
41
|
-
entries.push(entry);
|
|
42
|
-
return this.applyDesired(desiredProjections(entries));
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
discard(id, error) {
|
|
46
|
-
return this.schedule(() => this.applyDesired(this.desired.filter((candidate) => candidate.entry.id !== id), (removed) => removed.entry.id === id ? error : new Error("Outbox optimistic projection replayed.")));
|
|
47
|
-
}
|
|
48
|
-
close() {
|
|
49
|
-
if (this.closed)
|
|
50
|
-
return Promise.resolve();
|
|
51
|
-
this.closed = true;
|
|
52
|
-
const error = new Error("Outbox disposed.");
|
|
53
|
-
const settlements = this.desired.map((candidate) => this.invalidate(candidate.entry.id, error));
|
|
54
|
-
this.desired = [];
|
|
55
|
-
return Promise.all(settlements).then(() => undefined);
|
|
56
|
-
}
|
|
57
|
-
schedule(work) {
|
|
58
|
-
if (this.closed)
|
|
59
|
-
return Promise.resolve();
|
|
60
|
-
const scheduled = this.tail
|
|
61
|
-
.catch(() => undefined)
|
|
62
|
-
.then(async () => {
|
|
63
|
-
if (!this.closed)
|
|
64
|
-
await work();
|
|
65
|
-
});
|
|
66
|
-
this.tail = scheduled.catch(() => undefined);
|
|
67
|
-
return scheduled;
|
|
68
|
-
}
|
|
69
|
-
async applyDesired(next, removalError = () => new Error("Outbox optimistic projection replaced.")) {
|
|
70
|
-
if (this.disabledError)
|
|
71
|
-
return;
|
|
72
|
-
const divergence = this.firstDivergence(this.desired, next);
|
|
73
|
-
if (divergence === -1) {
|
|
74
|
-
for (const candidate of next) {
|
|
75
|
-
if (this.installedFingerprints.get(candidate.entry.id) !== candidate.fingerprint) {
|
|
76
|
-
try {
|
|
77
|
-
await this.install(candidate);
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
await this.disable(normalizeError(error));
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
for (let index = this.desired.length - 1; index >= divergence; index -= 1) {
|
|
88
|
-
const removed = this.desired[index];
|
|
89
|
-
await this.invalidate(removed.entry.id, removalError(removed));
|
|
90
|
-
}
|
|
91
|
-
this.desired = next;
|
|
92
|
-
for (let index = divergence; index < next.length; index += 1) {
|
|
93
|
-
const candidate = next[index];
|
|
94
|
-
try {
|
|
95
|
-
await this.install(candidate);
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
await this.disable(normalizeError(error));
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
async disable(error) {
|
|
104
|
-
for (let index = this.desired.length - 1; index >= 0; index -= 1) {
|
|
105
|
-
await this.invalidate(this.desired[index].entry.id, error);
|
|
106
|
-
}
|
|
107
|
-
this.desired = [];
|
|
108
|
-
this.disabledError = error;
|
|
109
|
-
}
|
|
110
|
-
firstDivergence(current, next) {
|
|
111
|
-
const length = Math.max(current.length, next.length);
|
|
112
|
-
for (let index = 0; index < length; index += 1) {
|
|
113
|
-
const previous = current[index];
|
|
114
|
-
const candidate = next[index];
|
|
115
|
-
if (previous?.entry.id !== candidate?.entry.id ||
|
|
116
|
-
previous?.fingerprint !== candidate?.fingerprint) {
|
|
117
|
-
return index;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return -1;
|
|
121
|
-
}
|
|
122
|
-
async install(candidate) {
|
|
123
|
-
if (this.installedFingerprints.get(candidate.entry.id) === candidate.fingerprint) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
await this.invalidate(candidate.entry.id, new Error("Outbox optimistic projection replaced."));
|
|
127
|
-
const version = this.versions.get(candidate.entry.id) ?? 0;
|
|
128
|
-
const projection = await this.project?.(candidate.entry);
|
|
129
|
-
if (this.closed || this.versions.get(candidate.entry.id) !== version) {
|
|
130
|
-
await this.settle(projection, new Error(this.closed ? "Outbox disposed." : "Outbox projection became stale."));
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
if (projection) {
|
|
134
|
-
this.projections.set(candidate.entry.id, projection);
|
|
135
|
-
}
|
|
136
|
-
this.installedFingerprints.set(candidate.entry.id, candidate.fingerprint);
|
|
137
|
-
}
|
|
138
|
-
async invalidate(id, error) {
|
|
139
|
-
this.versions.set(id, (this.versions.get(id) ?? 0) + 1);
|
|
140
|
-
await this.settle(this.projections.get(id), error);
|
|
141
|
-
this.projections.delete(id);
|
|
142
|
-
this.installedFingerprints.delete(id);
|
|
143
|
-
}
|
|
144
|
-
async settle(projection, error) {
|
|
145
|
-
try {
|
|
146
|
-
await projection?.settle(error);
|
|
147
|
-
}
|
|
148
|
-
catch {
|
|
149
|
-
// Projection teardown is isolated from outbox state.
|
|
150
|
-
}
|
|
151
|
-
}
|
|
7
|
+
return [...entries].filter((entry) => entry.status !== "failed" || entry.retryable).sort((left, right) => left.sequence - right.sequence).map((entry) => ({
|
|
8
|
+
entry,
|
|
9
|
+
fingerprint: requestFingerprint(entry.request)
|
|
10
|
+
}));
|
|
152
11
|
}
|
|
12
|
+
var OutboxProjectionManager = class {
|
|
13
|
+
project;
|
|
14
|
+
desired = [];
|
|
15
|
+
projections = /* @__PURE__ */ new Map();
|
|
16
|
+
installedFingerprints = /* @__PURE__ */ new Map();
|
|
17
|
+
versions = /* @__PURE__ */ new Map();
|
|
18
|
+
tail = Promise.resolve();
|
|
19
|
+
closed = false;
|
|
20
|
+
disabledError;
|
|
21
|
+
constructor(project) {
|
|
22
|
+
this.project = project;
|
|
23
|
+
}
|
|
24
|
+
get error() {
|
|
25
|
+
return this.disabledError;
|
|
26
|
+
}
|
|
27
|
+
restore(entries) {
|
|
28
|
+
return this.schedule(() => this.applyDesired(desiredProjections(entries)));
|
|
29
|
+
}
|
|
30
|
+
reconcile(entries) {
|
|
31
|
+
return this.schedule(() => this.applyDesired(desiredProjections(entries)));
|
|
32
|
+
}
|
|
33
|
+
ensure(entry) {
|
|
34
|
+
return this.schedule(() => {
|
|
35
|
+
const entries = this.desired.filter((candidate) => candidate.entry.id !== entry.id).map((candidate) => candidate.entry);
|
|
36
|
+
entries.push(entry);
|
|
37
|
+
return this.applyDesired(desiredProjections(entries));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
discard(id, error) {
|
|
41
|
+
return this.schedule(() => this.applyDesired(this.desired.filter((candidate) => candidate.entry.id !== id), (removed) => removed.entry.id === id ? error : /* @__PURE__ */ new Error("Outbox optimistic projection replayed.")));
|
|
42
|
+
}
|
|
43
|
+
close() {
|
|
44
|
+
if (this.closed) return Promise.resolve();
|
|
45
|
+
this.closed = true;
|
|
46
|
+
const error = /* @__PURE__ */ new Error("Outbox disposed.");
|
|
47
|
+
const settlements = this.desired.map((candidate) => this.invalidate(candidate.entry.id, error));
|
|
48
|
+
this.desired = [];
|
|
49
|
+
return Promise.all(settlements).then(() => void 0);
|
|
50
|
+
}
|
|
51
|
+
schedule(work) {
|
|
52
|
+
if (this.closed) return Promise.resolve();
|
|
53
|
+
const scheduled = this.tail.catch(() => void 0).then(async () => {
|
|
54
|
+
if (!this.closed) await work();
|
|
55
|
+
});
|
|
56
|
+
this.tail = scheduled.catch(() => void 0);
|
|
57
|
+
return scheduled;
|
|
58
|
+
}
|
|
59
|
+
async applyDesired(next, removalError = () => /* @__PURE__ */ new Error("Outbox optimistic projection replaced.")) {
|
|
60
|
+
if (this.disabledError) return;
|
|
61
|
+
const divergence = this.firstDivergence(this.desired, next);
|
|
62
|
+
if (divergence === -1) {
|
|
63
|
+
for (const candidate of next) if (this.installedFingerprints.get(candidate.entry.id) !== candidate.fingerprint) try {
|
|
64
|
+
await this.install(candidate);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
await this.disable(normalizeError(error));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
for (let index = this.desired.length - 1; index >= divergence; index -= 1) {
|
|
72
|
+
const removed = this.desired[index];
|
|
73
|
+
await this.invalidate(removed.entry.id, removalError(removed));
|
|
74
|
+
}
|
|
75
|
+
this.desired = next;
|
|
76
|
+
for (let index = divergence; index < next.length; index += 1) {
|
|
77
|
+
const candidate = next[index];
|
|
78
|
+
try {
|
|
79
|
+
await this.install(candidate);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
await this.disable(normalizeError(error));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async disable(error) {
|
|
87
|
+
for (let index = this.desired.length - 1; index >= 0; index -= 1) await this.invalidate(this.desired[index].entry.id, error);
|
|
88
|
+
this.desired = [];
|
|
89
|
+
this.disabledError = error;
|
|
90
|
+
}
|
|
91
|
+
firstDivergence(current, next) {
|
|
92
|
+
const length = Math.max(current.length, next.length);
|
|
93
|
+
for (let index = 0; index < length; index += 1) {
|
|
94
|
+
const previous = current[index];
|
|
95
|
+
const candidate = next[index];
|
|
96
|
+
if (previous?.entry.id !== candidate?.entry.id || previous?.fingerprint !== candidate?.fingerprint) return index;
|
|
97
|
+
}
|
|
98
|
+
return -1;
|
|
99
|
+
}
|
|
100
|
+
async install(candidate) {
|
|
101
|
+
if (this.installedFingerprints.get(candidate.entry.id) === candidate.fingerprint) return;
|
|
102
|
+
await this.invalidate(candidate.entry.id, /* @__PURE__ */ new Error("Outbox optimistic projection replaced."));
|
|
103
|
+
const version = this.versions.get(candidate.entry.id) ?? 0;
|
|
104
|
+
const projection = await this.project?.(candidate.entry);
|
|
105
|
+
if (this.closed || this.versions.get(candidate.entry.id) !== version) {
|
|
106
|
+
await this.settle(projection, /* @__PURE__ */ new Error(this.closed ? "Outbox disposed." : "Outbox projection became stale."));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (projection) this.projections.set(candidate.entry.id, projection);
|
|
110
|
+
this.installedFingerprints.set(candidate.entry.id, candidate.fingerprint);
|
|
111
|
+
}
|
|
112
|
+
async invalidate(id, error) {
|
|
113
|
+
this.versions.set(id, (this.versions.get(id) ?? 0) + 1);
|
|
114
|
+
await this.settle(this.projections.get(id), error);
|
|
115
|
+
this.projections.delete(id);
|
|
116
|
+
this.installedFingerprints.delete(id);
|
|
117
|
+
}
|
|
118
|
+
async settle(projection, error) {
|
|
119
|
+
try {
|
|
120
|
+
await projection?.settle(error);
|
|
121
|
+
} catch {}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
export { OutboxProjectionManager };
|
|
126
|
+
|
|
153
127
|
//# sourceMappingURL=projectionManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectionManager.js","sourceRoot":"","sources":["../../../src/live/outbox/projectionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAYrD,SAAS,cAAc,CAAC,KAAc;IAClC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,M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,MAAM,CACb,UAAU,EACV,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAClF,CAAC;YACF,OAAO;QACX,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACb,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QACzD,CAAC;QACD,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC9E,CAAC;IAEO,KAAK,CAAC,UAAU,CACpB,EAAU,EACV,KAAa;QAEb,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACxD,MAAM,IAAI,CAAC,MAAM,CACb,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,EACxB,KAAK,CACR,CAAC;QACF,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC5B,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IAEO,KAAK,CAAC,MAAM,CAChB,UAAwC,EACxC,KAAa;QAEb,IAAI,CAAC;YACD,MAAM,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;QAAC,MAAM,CAAC;YACL,qDAAqD;QACzD,CAAC;IACL,CAAC;CACJ"}
|
|
1
|
+
{"version":3,"file":"projectionManager.js","names":[],"sources":["../../../src/live/outbox/projectionManager.ts"],"sourcesContent":["import { requestFingerprint } from \"./repository.js\";\nimport type { OntologyOutboxEntry } from \"./types.js\";\n\nexport interface OutboxProjection {\n settle(error?: Error): void | Promise<void>;\n}\n\ninterface DesiredProjection {\n entry: OntologyOutboxEntry;\n fingerprint: string;\n}\n\nfunction normalizeError(error: unknown): Error {\n return error instanceof Error ? error : new Error(String(error));\n}\n\nfunction desiredProjections(entries: readonly OntologyOutboxEntry[]): DesiredProjection[] {\n return [...entries]\n .filter((entry) => entry.status !== \"failed\" || entry.retryable)\n .sort((left, right) => left.sequence - right.sequence)\n .map((entry) => ({\n entry,\n fingerprint: requestFingerprint(entry.request),\n }));\n}\n\nexport class OutboxProjectionManager {\n private desired: DesiredProjection[] = [];\n private readonly projections = new Map<string, OutboxProjection>();\n private readonly installedFingerprints = new Map<string, string>();\n private readonly versions = new Map<string, number>();\n private tail = Promise.resolve();\n private closed = false;\n private disabledError: Error | undefined;\n\n constructor(\n private readonly project:\n | ((entry: OntologyOutboxEntry) => Promise<OutboxProjection | undefined>)\n | undefined\n ) {}\n\n get error(): Error | undefined {\n return this.disabledError;\n }\n\n restore(entries: readonly OntologyOutboxEntry[]): Promise<void> {\n return this.schedule(() => this.applyDesired(desiredProjections(entries)));\n }\n\n reconcile(entries: readonly OntologyOutboxEntry[]): Promise<void> {\n return this.schedule(() => this.applyDesired(desiredProjections(entries)));\n }\n\n ensure(entry: OntologyOutboxEntry): Promise<void> {\n return this.schedule(() => {\n const entries = this.desired\n .filter((candidate) => candidate.entry.id !== entry.id)\n .map((candidate) => candidate.entry);\n entries.push(entry);\n return this.applyDesired(desiredProjections(entries));\n });\n }\n\n discard(id: string, error?: Error): Promise<void> {\n return this.schedule(() =>\n this.applyDesired(\n this.desired.filter((candidate) => candidate.entry.id !== id),\n (removed) =>\n removed.entry.id === id ? error : new Error(\"Outbox optimistic projection replayed.\")\n )\n );\n }\n\n close(): Promise<void> {\n if (this.closed) return Promise.resolve();\n this.closed = true;\n const error = new Error(\"Outbox disposed.\");\n const settlements = this.desired.map((candidate) => this.invalidate(candidate.entry.id, error));\n this.desired = [];\n return Promise.all(settlements).then(() => undefined);\n }\n\n private schedule(work: () => Promise<void>): Promise<void> {\n if (this.closed) return Promise.resolve();\n const scheduled = this.tail\n .catch(() => undefined)\n .then(async () => {\n if (!this.closed) await work();\n });\n this.tail = scheduled.catch(() => undefined);\n return scheduled;\n }\n\n private async applyDesired(\n next: DesiredProjection[],\n removalError: (removed: DesiredProjection) => Error | undefined = () =>\n new Error(\"Outbox optimistic projection replaced.\")\n ): Promise<void> {\n if (this.disabledError) return;\n const divergence = this.firstDivergence(this.desired, next);\n if (divergence === -1) {\n for (const candidate of next) {\n if (this.installedFingerprints.get(candidate.entry.id) !== candidate.fingerprint) {\n try {\n await this.install(candidate);\n } catch (error) {\n await this.disable(normalizeError(error));\n return;\n }\n }\n }\n return;\n }\n\n for (let index = this.desired.length - 1; index >= divergence; index -= 1) {\n const removed = this.desired[index]!;\n await this.invalidate(removed.entry.id, removalError(removed));\n }\n this.desired = next;\n\n for (let index = divergence; index < next.length; index += 1) {\n const candidate = next[index]!;\n try {\n await this.install(candidate);\n } catch (error) {\n await this.disable(normalizeError(error));\n return;\n }\n }\n }\n\n private async disable(error: Error): Promise<void> {\n for (let index = this.desired.length - 1; index >= 0; index -= 1) {\n await this.invalidate(this.desired[index]!.entry.id, error);\n }\n this.desired = [];\n this.disabledError = error;\n }\n\n private firstDivergence(\n current: readonly DesiredProjection[],\n next: readonly DesiredProjection[]\n ): number {\n const length = Math.max(current.length, next.length);\n for (let index = 0; index < length; index += 1) {\n const previous = current[index];\n const candidate = next[index];\n if (\n previous?.entry.id !== candidate?.entry.id ||\n previous?.fingerprint !== candidate?.fingerprint\n ) {\n return index;\n }\n }\n return -1;\n }\n\n private async install(candidate: DesiredProjection): Promise<void> {\n if (this.installedFingerprints.get(candidate.entry.id) === candidate.fingerprint) {\n return;\n }\n\n await this.invalidate(candidate.entry.id, new Error(\"Outbox optimistic projection replaced.\"));\n const version = this.versions.get(candidate.entry.id) ?? 0;\n const projection = await this.project?.(candidate.entry);\n if (this.closed || this.versions.get(candidate.entry.id) !== version) {\n await this.settle(\n projection,\n new Error(this.closed ? \"Outbox disposed.\" : \"Outbox projection became stale.\")\n );\n return;\n }\n\n if (projection) {\n this.projections.set(candidate.entry.id, projection);\n }\n this.installedFingerprints.set(candidate.entry.id, candidate.fingerprint);\n }\n\n private async invalidate(id: string, error?: Error): Promise<void> {\n this.versions.set(id, (this.versions.get(id) ?? 0) + 1);\n await this.settle(this.projections.get(id), error);\n this.projections.delete(id);\n this.installedFingerprints.delete(id);\n }\n\n private async settle(projection: OutboxProjection | undefined, error?: Error): Promise<void> {\n try {\n await projection?.settle(error);\n } catch {\n // Projection teardown is isolated from outbox state.\n }\n }\n}\n"],"mappings":";;AAYA,SAAS,eAAe,OAAuB;CAC3C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;AACnE;AAEA,SAAS,mBAAmB,SAA8D;CACtF,OAAO,CAAC,GAAG,OAAO,CAAC,CACd,QAAQ,UAAU,MAAM,WAAW,YAAY,MAAM,SAAS,CAAC,CAC/D,MAAM,MAAM,UAAU,KAAK,WAAW,MAAM,QAAQ,CAAC,CACrD,KAAK,WAAW;EACb;EACA,aAAa,mBAAmB,MAAM,OAAO;CACjD,EAAE;AACV;AAEA,IAAa,0BAAb,MAAqC;CAUZ;CATrB,UAAuC,CAAC;CACxC,8BAA+B,IAAI,IAA8B;CACjE,wCAAyC,IAAI,IAAoB;CACjE,2BAA4B,IAAI,IAAoB;CACpD,OAAe,QAAQ,QAAQ;CAC/B,SAAiB;CACjB;CAEA,YACI,SAGF;EAHmB,KAAA,UAAA;CAGlB;CAEH,IAAI,QAA2B;EAC3B,OAAO,KAAK;CAChB;CAEA,QAAQ,SAAwD;EAC5D,OAAO,KAAK,eAAe,KAAK,aAAa,mBAAmB,OAAO,CAAC,CAAC;CAC7E;CAEA,UAAU,SAAwD;EAC9D,OAAO,KAAK,eAAe,KAAK,aAAa,mBAAmB,OAAO,CAAC,CAAC;CAC7E;CAEA,OAAO,OAA2C;EAC9C,OAAO,KAAK,eAAe;GACvB,MA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AAK,UAAU,UAAU,KAAK;EACvD,IAAI,KAAK,UAAU,KAAK,SAAS,IAAI,UAAU,MAAM,EAAE,MAAM,SAAS;GAClE,MAAM,KAAK,OACP,4BACA,IAAI,MAAM,KAAK,SAAS,qBAAqB,iCAAiC,CAClF;GACA;EACJ;EAEA,IAAI,YACA,KAAK,YAAY,IAAI,UAAU,MAAM,IAAI,UAAU;EAEvD,KAAK,sBAAsB,IAAI,UAAU,MAAM,IAAI,UAAU,WAAW;CAC5E;CAEA,MAAc,WAAW,IAAY,OAA8B;EAC/D,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,KAAK,CAAC;EACtD,MAAM,KAAK,OAAO,KAAK,YAAY,IAAI,EAAE,GAAG,KAAK;EACjD,KAAK,YAAY,OAAO,EAAE;EAC1B,KAAK,sBAAsB,OAAO,EAAE;CACxC;CAEA,MAAc,OAAO,YAA0C,OAA8B;EACzF,IAAI;GACA,MAAM,YAAY,OAAO,KAAK;EAClC,QAAQ,CAER;CACJ;AACJ"}
|
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { OntologyActionRequest, OntologyOutboxEntry } from "./types.js";
|
|
2
|
+
import { OutboxErrorDetails } from "./service.js";
|
|
3
|
+
import { Collection } from "@tanstack/db";
|
|
4
|
+
//#region src/live/outbox/repository.d.ts
|
|
4
5
|
export declare function requestFingerprint(request: OntologyActionRequest): string;
|
|
5
6
|
export declare class OntologyOutboxRepository {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
readonly collection: Collection<OntologyOutboxEntry, string>;
|
|
8
|
+
constructor(collection: Collection<OntologyOutboxEntry, string>);
|
|
9
|
+
preload(): Promise<void>;
|
|
10
|
+
get(id: string): OntologyOutboxEntry | undefined;
|
|
11
|
+
entries(): Promise<OntologyOutboxEntry[]>;
|
|
12
|
+
enqueue(proposed: OntologyOutboxEntry): Promise<OntologyOutboxEntry>;
|
|
13
|
+
edit(id: string, request: OntologyActionRequest): Promise<OntologyOutboxEntry>;
|
|
14
|
+
remove(id: string): Promise<void>;
|
|
15
|
+
retry(id: string): Promise<void>;
|
|
16
|
+
recover(failureStrategy: "pause" | "discard-all", maxRetries: number): Promise<OntologyOutboxEntry[]>;
|
|
17
|
+
claim(): Promise<OntologyOutboxEntry | undefined>;
|
|
18
|
+
nextRetryAt(): Promise<number | undefined>;
|
|
19
|
+
complete(id: string, executionId: string): Promise<void>;
|
|
20
|
+
fail(id: string, executionId: string, retryable: boolean, error: OutboxErrorDetails, retryAt?: number): Promise<OntologyOutboxEntry>;
|
|
21
|
+
discardAll(id: string, executionId: string): Promise<OntologyOutboxEntry[]>;
|
|
22
|
+
discardFrom(id: string): Promise<OntologyOutboxEntry[]>;
|
|
23
|
+
private head;
|
|
24
|
+
private nextSequence;
|
|
25
|
+
private assertCurrentExecution;
|
|
26
|
+
private update;
|
|
27
|
+
private delete;
|
|
28
|
+
private deleteEntries;
|
|
28
29
|
}
|
|
30
|
+
//#endregion
|
|
29
31
|
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","
|
|
1
|
+
{"version":3,"file":"repository.d.ts","names":[],"sources":["../../../src/live/outbox/repository.ts"],"mappings":";;;;wBAKgB,mBAAmB,SAAS;qBAI/B;WACY,YAAY,WAAW;EAA5C,YAAqB,YAAY,WAAW;EAE5C,WAAW;EAIX,IAAI,aAAa;EAIjB,WAAW,QAAQ;EAsBb,QAAQ,UAAU,sBAAsB,QAAQ;EAchD,KAAK,YAAY,SAAS,wBAAwB,QAAQ;EAmB1D,OAAO,aAAa;EAUpB,MAAM,aAAa;EAmBnB,QACF,0CACA,qBACD,QAAQ;EA2CL,SAAS,QAAQ;EAcjB,eAAe;EAKf,SAAS,YAAY,sBAAsB;EAK3C,KACF,YACA,qBACA,oBACA,OAAO,oBACP,mBACD,QAAQ;EAcL,WAAW,YAAY,sBAAsB,QAAQ;EAKrD,YAAY,aAAa,QAAQ;UAQzB;UAuBA;UAaN;UAWM;UAaA;UAOA"}
|