ramosedb 0.0.0-stage → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +17 -0
- package/README.md +57 -2
- package/dist/Auth.d.ts +55 -0
- package/dist/Auth.d.ts.map +1 -0
- package/dist/Auth.js +50 -0
- package/dist/Auth.js.map +1 -0
- package/dist/Database.d.ts +40 -0
- package/dist/Database.d.ts.map +1 -0
- package/dist/Database.js +62 -0
- package/dist/Database.js.map +1 -0
- package/dist/Providers.d.ts +8 -0
- package/dist/Providers.d.ts.map +1 -0
- package/dist/Providers.js +9 -0
- package/dist/Providers.js.map +1 -0
- package/dist/RamoseEnv.d.ts +37 -0
- package/dist/RamoseEnv.d.ts.map +1 -0
- package/dist/RamoseEnv.js +2 -0
- package/dist/RamoseEnv.js.map +1 -0
- package/dist/Server.d.ts +100 -0
- package/dist/Server.d.ts.map +1 -0
- package/dist/Server.js +263 -0
- package/dist/Server.js.map +1 -0
- package/dist/ServerRuntime.d.ts +10 -0
- package/dist/ServerRuntime.d.ts.map +1 -0
- package/dist/ServerRuntime.js +11 -0
- package/dist/ServerRuntime.js.map +1 -0
- package/dist/better-auth/client.d.ts +19 -0
- package/dist/better-auth/client.d.ts.map +1 -0
- package/dist/better-auth/client.js +110 -0
- package/dist/better-auth/client.js.map +1 -0
- package/dist/better-auth/index.d.ts +140 -0
- package/dist/better-auth/index.d.ts.map +1 -0
- package/dist/better-auth/index.js +168 -0
- package/dist/better-auth/index.js.map +1 -0
- package/dist/client/activation.d.ts +2 -0
- package/dist/client/activation.d.ts.map +1 -0
- package/dist/client/activation.js +33 -0
- package/dist/client/activation.js.map +1 -0
- package/dist/client/catalog.d.ts +15 -0
- package/dist/client/catalog.d.ts.map +1 -0
- package/dist/client/catalog.js +48 -0
- package/dist/client/catalog.js.map +1 -0
- package/dist/client/changesets.d.ts +85 -0
- package/dist/client/changesets.d.ts.map +1 -0
- package/dist/client/changesets.js +160 -0
- package/dist/client/changesets.js.map +1 -0
- package/dist/client/client.d.ts +45 -0
- package/dist/client/client.d.ts.map +1 -0
- package/dist/client/client.js +425 -0
- package/dist/client/client.js.map +1 -0
- package/dist/client/database.d.ts +163 -0
- package/dist/client/database.d.ts.map +1 -0
- package/dist/client/database.js +795 -0
- package/dist/client/database.js.map +1 -0
- package/dist/client/entity.d.ts +63 -0
- package/dist/client/entity.d.ts.map +1 -0
- package/dist/client/entity.js +141 -0
- package/dist/client/entity.js.map +1 -0
- package/dist/client/errors.d.ts +67 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +39 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/index.d.ts +13 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +6 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/mutation-schema.d.ts +92 -0
- package/dist/client/mutation-schema.d.ts.map +1 -0
- package/dist/client/mutation-schema.js +2 -0
- package/dist/client/mutation-schema.js.map +1 -0
- package/dist/client/mutation.d.ts +25 -0
- package/dist/client/mutation.d.ts.map +1 -0
- package/dist/client/mutation.js +75 -0
- package/dist/client/mutation.js.map +1 -0
- package/dist/client/operations.d.ts +39 -0
- package/dist/client/operations.d.ts.map +1 -0
- package/dist/client/operations.js +183 -0
- package/dist/client/operations.js.map +1 -0
- package/dist/client/query.d.ts +53 -0
- package/dist/client/query.d.ts.map +1 -0
- package/dist/client/query.js +85 -0
- package/dist/client/query.js.map +1 -0
- package/dist/client/receipt.d.ts +53 -0
- package/dist/client/receipt.d.ts.map +1 -0
- package/dist/client/receipt.js +79 -0
- package/dist/client/receipt.js.map +1 -0
- package/dist/client/submission.d.ts +44 -0
- package/dist/client/submission.d.ts.map +1 -0
- package/dist/client/submission.js +165 -0
- package/dist/client/submission.js.map +1 -0
- package/dist/client/subscription.d.ts +18 -0
- package/dist/client/subscription.d.ts.map +1 -0
- package/dist/client/subscription.js +75 -0
- package/dist/client/subscription.js.map +1 -0
- package/dist/client/sync.d.ts +32 -0
- package/dist/client/sync.d.ts.map +1 -0
- package/dist/client/sync.js +34 -0
- package/dist/client/sync.js.map +1 -0
- package/dist/client/view.d.ts +37 -0
- package/dist/client/view.d.ts.map +1 -0
- package/dist/client/view.js +112 -0
- package/dist/client/view.js.map +1 -0
- package/dist/db/Binding.d.ts +79 -0
- package/dist/db/Binding.d.ts.map +1 -0
- package/dist/db/Binding.js +138 -0
- package/dist/db/Binding.js.map +1 -0
- package/dist/db/Composer.d.ts +7 -0
- package/dist/db/Composer.d.ts.map +1 -0
- package/dist/db/Composer.js +6 -0
- package/dist/db/Composer.js.map +1 -0
- package/dist/db/DatabaseName.d.ts +7 -0
- package/dist/db/DatabaseName.d.ts.map +1 -0
- package/dist/db/DatabaseName.js +9 -0
- package/dist/db/DatabaseName.js.map +1 -0
- package/dist/db/Eid.d.ts +19 -0
- package/dist/db/Eid.d.ts.map +1 -0
- package/dist/db/Eid.js +2 -0
- package/dist/db/Eid.js.map +1 -0
- package/dist/db/Entity.d.ts +133 -0
- package/dist/db/Entity.d.ts.map +1 -0
- package/dist/db/Entity.js +104 -0
- package/dist/db/Entity.js.map +1 -0
- package/dist/db/Errors.d.ts +138 -0
- package/dist/db/Errors.d.ts.map +1 -0
- package/dist/db/Errors.js +171 -0
- package/dist/db/Errors.js.map +1 -0
- package/dist/db/Field.d.ts +170 -0
- package/dist/db/Field.d.ts.map +1 -0
- package/dist/db/Field.js +187 -0
- package/dist/db/Field.js.map +1 -0
- package/dist/db/IdentName.d.ts +94 -0
- package/dist/db/IdentName.d.ts.map +1 -0
- package/dist/db/IdentName.js +34 -0
- package/dist/db/IdentName.js.map +1 -0
- package/dist/db/Operation.d.ts +441 -0
- package/dist/db/Operation.d.ts.map +1 -0
- package/dist/db/Operation.js +237 -0
- package/dist/db/Operation.js.map +1 -0
- package/dist/db/Projection.d.ts +97 -0
- package/dist/db/Projection.d.ts.map +1 -0
- package/dist/db/Projection.js +183 -0
- package/dist/db/Projection.js.map +1 -0
- package/dist/db/Pull.d.ts +361 -0
- package/dist/db/Pull.d.ts.map +1 -0
- package/dist/db/Pull.js +547 -0
- package/dist/db/Pull.js.map +1 -0
- package/dist/db/Schema.d.ts +37 -0
- package/dist/db/Schema.d.ts.map +1 -0
- package/dist/db/Schema.js +94 -0
- package/dist/db/Schema.js.map +1 -0
- package/dist/db/Trait.d.ts +129 -0
- package/dist/db/Trait.d.ts.map +1 -0
- package/dist/db/Trait.js +65 -0
- package/dist/db/Trait.js.map +1 -0
- package/dist/db/Tx.d.ts +128 -0
- package/dist/db/Tx.d.ts.map +1 -0
- package/dist/db/Tx.js +248 -0
- package/dist/db/Tx.js.map +1 -0
- package/dist/db/allocations.d.ts +44 -0
- package/dist/db/allocations.d.ts.map +1 -0
- package/dist/db/allocations.js +70 -0
- package/dist/db/allocations.js.map +1 -0
- package/dist/db/attrRef.d.ts +5 -0
- package/dist/db/attrRef.d.ts.map +1 -0
- package/dist/db/attrRef.js +6 -0
- package/dist/db/attrRef.js.map +1 -0
- package/dist/db/compose.d.ts +26 -0
- package/dist/db/compose.d.ts.map +1 -0
- package/dist/db/compose.js +105 -0
- package/dist/db/compose.js.map +1 -0
- package/dist/db/composition.d.ts +4 -0
- package/dist/db/composition.d.ts.map +1 -0
- package/dist/db/composition.js +24 -0
- package/dist/db/composition.js.map +1 -0
- package/dist/db/creation.d.ts +102 -0
- package/dist/db/creation.d.ts.map +1 -0
- package/dist/db/creation.js +448 -0
- package/dist/db/creation.js.map +1 -0
- package/dist/db/deployedSchema.d.ts +12 -0
- package/dist/db/deployedSchema.d.ts.map +1 -0
- package/dist/db/deployedSchema.js +80 -0
- package/dist/db/deployedSchema.js.map +1 -0
- package/dist/db/documentation.d.ts +4 -0
- package/dist/db/documentation.d.ts.map +1 -0
- package/dist/db/documentation.js +4 -0
- package/dist/db/documentation.js.map +1 -0
- package/dist/db/ensure.d.ts +16 -0
- package/dist/db/ensure.d.ts.map +1 -0
- package/dist/db/ensure.js +48 -0
- package/dist/db/ensure.js.map +1 -0
- package/dist/db/entityArg.d.ts +15 -0
- package/dist/db/entityArg.d.ts.map +1 -0
- package/dist/db/entityArg.js +71 -0
- package/dist/db/entityArg.js.map +1 -0
- package/dist/db/equal.d.ts +4 -0
- package/dist/db/equal.d.ts.map +1 -0
- package/dist/db/equal.js +2 -0
- package/dist/db/equal.js.map +1 -0
- package/dist/db/idents.d.ts +90 -0
- package/dist/db/idents.d.ts.map +1 -0
- package/dist/db/idents.js +2 -0
- package/dist/db/idents.js.map +1 -0
- package/dist/db/index.d.ts +27 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +20 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/internal.d.ts +27 -0
- package/dist/db/internal.d.ts.map +1 -0
- package/dist/db/internal.js +27 -0
- package/dist/db/internal.js.map +1 -0
- package/dist/db/query/cursor.d.ts +13 -0
- package/dist/db/query/cursor.d.ts.map +1 -0
- package/dist/db/query/cursor.js +150 -0
- package/dist/db/query/cursor.js.map +1 -0
- package/dist/db/query/elemFilter.d.ts +7 -0
- package/dist/db/query/elemFilter.d.ts.map +1 -0
- package/dist/db/query/elemFilter.js +280 -0
- package/dist/db/query/elemFilter.js.map +1 -0
- package/dist/db/query/fluent.d.ts +92 -0
- package/dist/db/query/fluent.d.ts.map +1 -0
- package/dist/db/query/fluent.js +125 -0
- package/dist/db/query/fluent.js.map +1 -0
- package/dist/db/query/focus.d.ts +42 -0
- package/dist/db/query/focus.d.ts.map +1 -0
- package/dist/db/query/focus.js +2 -0
- package/dist/db/query/focus.js.map +1 -0
- package/dist/db/query/index.d.ts +7 -0
- package/dist/db/query/index.d.ts.map +1 -0
- package/dist/db/query/index.js +6 -0
- package/dist/db/query/index.js.map +1 -0
- package/dist/db/query/kernel.d.ts +215 -0
- package/dist/db/query/kernel.d.ts.map +1 -0
- package/dist/db/query/kernel.js +284 -0
- package/dist/db/query/kernel.js.map +1 -0
- package/dist/db/query/lib.d.ts +168 -0
- package/dist/db/query/lib.d.ts.map +1 -0
- package/dist/db/query/lib.js +175 -0
- package/dist/db/query/lib.js.map +1 -0
- package/dist/db/query/query.d.ts +209 -0
- package/dist/db/query/query.d.ts.map +1 -0
- package/dist/db/query/query.js +1536 -0
- package/dist/db/query/query.js.map +1 -0
- package/dist/db/query/stdlib/failures.d.ts +91 -0
- package/dist/db/query/stdlib/failures.d.ts.map +1 -0
- package/dist/db/query/stdlib/failures.js +57 -0
- package/dist/db/query/stdlib/failures.js.map +1 -0
- package/dist/db/query/stdlib/implementations.d.ts +5 -0
- package/dist/db/query/stdlib/implementations.d.ts.map +1 -0
- package/dist/db/query/stdlib/implementations.js +208 -0
- package/dist/db/query/stdlib/implementations.js.map +1 -0
- package/dist/db/query/stdlib/index.d.ts +6 -0
- package/dist/db/query/stdlib/index.d.ts.map +1 -0
- package/dist/db/query/stdlib/index.js +6 -0
- package/dist/db/query/stdlib/index.js.map +1 -0
- package/dist/db/query/stdlib/manifest.d.ts +3 -0
- package/dist/db/query/stdlib/manifest.d.ts.map +1 -0
- package/dist/db/query/stdlib/manifest.js +1067 -0
- package/dist/db/query/stdlib/manifest.js.map +1 -0
- package/dist/db/query/stdlib/registry.d.ts +22 -0
- package/dist/db/query/stdlib/registry.d.ts.map +1 -0
- package/dist/db/query/stdlib/registry.js +144 -0
- package/dist/db/query/stdlib/registry.js.map +1 -0
- package/dist/db/query/stdlib/types.d.ts +50 -0
- package/dist/db/query/stdlib/types.d.ts.map +1 -0
- package/dist/db/query/stdlib/types.js +17 -0
- package/dist/db/query/stdlib/types.js.map +1 -0
- package/dist/db/query/stdlib/values.d.ts +17 -0
- package/dist/db/query/stdlib/values.d.ts.map +1 -0
- package/dist/db/query/stdlib/values.js +200 -0
- package/dist/db/query/stdlib/values.js.map +1 -0
- package/dist/db/query/surface.d.ts +15 -0
- package/dist/db/query/surface.d.ts.map +1 -0
- package/dist/db/query/surface.js +14 -0
- package/dist/db/query/surface.js.map +1 -0
- package/dist/db/reachability.d.ts +40 -0
- package/dist/db/reachability.d.ts.map +1 -0
- package/dist/db/reachability.js +118 -0
- package/dist/db/reachability.js.map +1 -0
- package/dist/db/refs.d.ts +46 -0
- package/dist/db/refs.d.ts.map +1 -0
- package/dist/db/refs.js +69 -0
- package/dist/db/refs.js.map +1 -0
- package/dist/db/shapes.d.ts +227 -0
- package/dist/db/shapes.d.ts.map +1 -0
- package/dist/db/shapes.js +246 -0
- package/dist/db/shapes.js.map +1 -0
- package/dist/db/valueTypes.d.ts +92 -0
- package/dist/db/valueTypes.d.ts.map +1 -0
- package/dist/db/valueTypes.js +105 -0
- package/dist/db/valueTypes.js.map +1 -0
- package/dist/errorHttp.d.ts +27 -0
- package/dist/errorHttp.d.ts.map +1 -0
- package/dist/errorHttp.js +95 -0
- package/dist/errorHttp.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/authorization/authoring/compile.d.ts +132 -0
- package/dist/internal/authorization/authoring/compile.d.ts.map +1 -0
- package/dist/internal/authorization/authoring/compile.js +634 -0
- package/dist/internal/authorization/authoring/compile.js.map +1 -0
- package/dist/internal/authorization/authoring/expr.d.ts +25 -0
- package/dist/internal/authorization/authoring/expr.d.ts.map +1 -0
- package/dist/internal/authorization/authoring/expr.js +56 -0
- package/dist/internal/authorization/authoring/expr.js.map +1 -0
- package/dist/internal/authorization/authoring/index.d.ts +10 -0
- package/dist/internal/authorization/authoring/index.d.ts.map +1 -0
- package/dist/internal/authorization/authoring/index.js +8 -0
- package/dist/internal/authorization/authoring/index.js.map +1 -0
- package/dist/internal/authorization/authoring/invoke.d.ts +8 -0
- package/dist/internal/authorization/authoring/invoke.d.ts.map +1 -0
- package/dist/internal/authorization/authoring/invoke.js +7 -0
- package/dist/internal/authorization/authoring/invoke.js.map +1 -0
- package/dist/internal/authorization/authoring/operations.d.ts +81 -0
- package/dist/internal/authorization/authoring/operations.d.ts.map +1 -0
- package/dist/internal/authorization/authoring/operations.js +591 -0
- package/dist/internal/authorization/authoring/operations.js.map +1 -0
- package/dist/internal/authorization/authoring/path.d.ts +20 -0
- package/dist/internal/authorization/authoring/path.d.ts.map +1 -0
- package/dist/internal/authorization/authoring/path.js +109 -0
- package/dist/internal/authorization/authoring/path.js.map +1 -0
- package/dist/internal/authorization/authoring/policy.d.ts +120 -0
- package/dist/internal/authorization/authoring/policy.d.ts.map +1 -0
- package/dist/internal/authorization/authoring/policy.js +218 -0
- package/dist/internal/authorization/authoring/policy.js.map +1 -0
- package/dist/internal/authorization/authoring/read.d.ts +13 -0
- package/dist/internal/authorization/authoring/read.d.ts.map +1 -0
- package/dist/internal/authorization/authoring/read.js +27 -0
- package/dist/internal/authorization/authoring/read.js.map +1 -0
- package/dist/internal/authorization/authoring/types.d.ts +127 -0
- package/dist/internal/authorization/authoring/types.d.ts.map +1 -0
- package/dist/internal/authorization/authoring/types.js +43 -0
- package/dist/internal/authorization/authoring/types.js.map +1 -0
- package/dist/internal/authorization/bind.d.ts +687 -0
- package/dist/internal/authorization/bind.d.ts.map +1 -0
- package/dist/internal/authorization/bind.js +485 -0
- package/dist/internal/authorization/bind.js.map +1 -0
- package/dist/internal/authorization/bounds.d.ts +13 -0
- package/dist/internal/authorization/bounds.d.ts.map +1 -0
- package/dist/internal/authorization/bounds.js +9 -0
- package/dist/internal/authorization/bounds.js.map +1 -0
- package/dist/internal/authorization/canonical-json.d.ts +6 -0
- package/dist/internal/authorization/canonical-json.d.ts.map +1 -0
- package/dist/internal/authorization/canonical-json.js +65 -0
- package/dist/internal/authorization/canonical-json.js.map +1 -0
- package/dist/internal/authorization/catalog-unit.d.ts +1033 -0
- package/dist/internal/authorization/catalog-unit.d.ts.map +1 -0
- package/dist/internal/authorization/catalog-unit.js +303 -0
- package/dist/internal/authorization/catalog-unit.js.map +1 -0
- package/dist/internal/authorization/catalog.d.ts +472 -0
- package/dist/internal/authorization/catalog.d.ts.map +1 -0
- package/dist/internal/authorization/catalog.js +134 -0
- package/dist/internal/authorization/catalog.js.map +1 -0
- package/dist/internal/authorization/changesets.d.ts +54 -0
- package/dist/internal/authorization/changesets.d.ts.map +1 -0
- package/dist/internal/authorization/changesets.js +156 -0
- package/dist/internal/authorization/changesets.js.map +1 -0
- package/dist/internal/authorization/composition.d.ts +10 -0
- package/dist/internal/authorization/composition.d.ts.map +1 -0
- package/dist/internal/authorization/composition.js +28 -0
- package/dist/internal/authorization/composition.js.map +1 -0
- package/dist/internal/authorization/database-bindings.d.ts +48 -0
- package/dist/internal/authorization/database-bindings.d.ts.map +1 -0
- package/dist/internal/authorization/database-bindings.js +101 -0
- package/dist/internal/authorization/database-bindings.js.map +1 -0
- package/dist/internal/authorization/database-target.d.ts +75 -0
- package/dist/internal/authorization/database-target.d.ts.map +1 -0
- package/dist/internal/authorization/database-target.js +65 -0
- package/dist/internal/authorization/database-target.js.map +1 -0
- package/dist/internal/authorization/decode.d.ts +1704 -0
- package/dist/internal/authorization/decode.d.ts.map +1 -0
- package/dist/internal/authorization/decode.js +294 -0
- package/dist/internal/authorization/decode.js.map +1 -0
- package/dist/internal/authorization/definitions.d.ts +66 -0
- package/dist/internal/authorization/definitions.d.ts.map +1 -0
- package/dist/internal/authorization/definitions.js +335 -0
- package/dist/internal/authorization/definitions.js.map +1 -0
- package/dist/internal/authorization/deployed.d.ts +43 -0
- package/dist/internal/authorization/deployed.d.ts.map +1 -0
- package/dist/internal/authorization/deployed.js +184 -0
- package/dist/internal/authorization/deployed.js.map +1 -0
- package/dist/internal/authorization/entity-targets.d.ts +68 -0
- package/dist/internal/authorization/entity-targets.d.ts.map +1 -0
- package/dist/internal/authorization/entity-targets.js +244 -0
- package/dist/internal/authorization/entity-targets.js.map +1 -0
- package/dist/internal/authorization/expr.d.ts +259 -0
- package/dist/internal/authorization/expr.d.ts.map +1 -0
- package/dist/internal/authorization/expr.js +55 -0
- package/dist/internal/authorization/expr.js.map +1 -0
- package/dist/internal/authorization/failures.d.ts +78 -0
- package/dist/internal/authorization/failures.d.ts.map +1 -0
- package/dist/internal/authorization/failures.js +22 -0
- package/dist/internal/authorization/failures.js.map +1 -0
- package/dist/internal/authorization/identities.d.ts +207 -0
- package/dist/internal/authorization/identities.d.ts.map +1 -0
- package/dist/internal/authorization/identities.js +71 -0
- package/dist/internal/authorization/identities.js.map +1 -0
- package/dist/internal/authorization/index.d.ts +33 -0
- package/dist/internal/authorization/index.d.ts.map +1 -0
- package/dist/internal/authorization/index.js +33 -0
- package/dist/internal/authorization/index.js.map +1 -0
- package/dist/internal/authorization/install/normalize.d.ts +196 -0
- package/dist/internal/authorization/install/normalize.d.ts.map +1 -0
- package/dist/internal/authorization/install/normalize.js +168 -0
- package/dist/internal/authorization/install/normalize.js.map +1 -0
- package/dist/internal/authorization/install/plan.d.ts +8 -0
- package/dist/internal/authorization/install/plan.d.ts.map +1 -0
- package/dist/internal/authorization/install/plan.js +177 -0
- package/dist/internal/authorization/install/plan.js.map +1 -0
- package/dist/internal/authorization/install.d.ts +404 -0
- package/dist/internal/authorization/install.d.ts.map +1 -0
- package/dist/internal/authorization/install.js +103 -0
- package/dist/internal/authorization/install.js.map +1 -0
- package/dist/internal/authorization/invocation-codec.d.ts +10 -0
- package/dist/internal/authorization/invocation-codec.d.ts.map +1 -0
- package/dist/internal/authorization/invocation-codec.js +36 -0
- package/dist/internal/authorization/invocation-codec.js.map +1 -0
- package/dist/internal/authorization/invocation-receipts.d.ts +192 -0
- package/dist/internal/authorization/invocation-receipts.d.ts.map +1 -0
- package/dist/internal/authorization/invocation-receipts.js +546 -0
- package/dist/internal/authorization/invocation-receipts.js.map +1 -0
- package/dist/internal/authorization/ir.d.ts +1465 -0
- package/dist/internal/authorization/ir.d.ts.map +1 -0
- package/dist/internal/authorization/ir.js +131 -0
- package/dist/internal/authorization/ir.js.map +1 -0
- package/dist/internal/authorization/json.d.ts +8 -0
- package/dist/internal/authorization/json.d.ts.map +1 -0
- package/dist/internal/authorization/json.js +13 -0
- package/dist/internal/authorization/json.js.map +1 -0
- package/dist/internal/authorization/live.d.ts +38 -0
- package/dist/internal/authorization/live.d.ts.map +1 -0
- package/dist/internal/authorization/live.js +227 -0
- package/dist/internal/authorization/live.js.map +1 -0
- package/dist/internal/authorization/operation-grant.d.ts +16 -0
- package/dist/internal/authorization/operation-grant.d.ts.map +1 -0
- package/dist/internal/authorization/operation-grant.js +79 -0
- package/dist/internal/authorization/operation-grant.js.map +1 -0
- package/dist/internal/authorization/operation-version.d.ts +28 -0
- package/dist/internal/authorization/operation-version.d.ts.map +1 -0
- package/dist/internal/authorization/operation-version.js +206 -0
- package/dist/internal/authorization/operation-version.js.map +1 -0
- package/dist/internal/authorization/operations-runtime.d.ts +78 -0
- package/dist/internal/authorization/operations-runtime.d.ts.map +1 -0
- package/dist/internal/authorization/operations-runtime.js +1130 -0
- package/dist/internal/authorization/operations-runtime.js.map +1 -0
- package/dist/internal/authorization/principal.d.ts +95 -0
- package/dist/internal/authorization/principal.d.ts.map +1 -0
- package/dist/internal/authorization/principal.js +53 -0
- package/dist/internal/authorization/principal.js.map +1 -0
- package/dist/internal/authorization/query-view.d.ts +7 -0
- package/dist/internal/authorization/query-view.d.ts.map +1 -0
- package/dist/internal/authorization/query-view.js +17 -0
- package/dist/internal/authorization/query-view.js.map +1 -0
- package/dist/internal/authorization/read-compatibility.d.ts +185 -0
- package/dist/internal/authorization/read-compatibility.d.ts.map +1 -0
- package/dist/internal/authorization/read-compatibility.js +176 -0
- package/dist/internal/authorization/read-compatibility.js.map +1 -0
- package/dist/internal/authorization/read-filter.d.ts +48 -0
- package/dist/internal/authorization/read-filter.d.ts.map +1 -0
- package/dist/internal/authorization/read-filter.js +496 -0
- package/dist/internal/authorization/read-filter.js.map +1 -0
- package/dist/internal/authorization/read-tables.d.ts +9 -0
- package/dist/internal/authorization/read-tables.d.ts.map +1 -0
- package/dist/internal/authorization/read-tables.js +120 -0
- package/dist/internal/authorization/read-tables.js.map +1 -0
- package/dist/internal/authorization/reads.d.ts +36 -0
- package/dist/internal/authorization/reads.d.ts.map +1 -0
- package/dist/internal/authorization/reads.js +35 -0
- package/dist/internal/authorization/reads.js.map +1 -0
- package/dist/internal/authorization/request.d.ts +64 -0
- package/dist/internal/authorization/request.d.ts.map +1 -0
- package/dist/internal/authorization/request.js +210 -0
- package/dist/internal/authorization/request.js.map +1 -0
- package/dist/internal/authorization/truth.d.ts +51 -0
- package/dist/internal/authorization/truth.d.ts.map +1 -0
- package/dist/internal/authorization/truth.js +23 -0
- package/dist/internal/authorization/truth.js.map +1 -0
- package/dist/internal/authorization/validate.d.ts +3 -0
- package/dist/internal/authorization/validate.d.ts.map +1 -0
- package/dist/internal/authorization/validate.js +3 -0
- package/dist/internal/authorization/validate.js.map +1 -0
- package/dist/internal/authorization/validation/catalog.d.ts +32 -0
- package/dist/internal/authorization/validation/catalog.d.ts.map +1 -0
- package/dist/internal/authorization/validation/catalog.js +417 -0
- package/dist/internal/authorization/validation/catalog.js.map +1 -0
- package/dist/internal/authorization/validation/common.d.ts +20 -0
- package/dist/internal/authorization/validation/common.d.ts.map +1 -0
- package/dist/internal/authorization/validation/common.js +36 -0
- package/dist/internal/authorization/validation/common.js.map +1 -0
- package/dist/internal/authorization/validation/decisions.d.ts +7 -0
- package/dist/internal/authorization/validation/decisions.d.ts.map +1 -0
- package/dist/internal/authorization/validation/decisions.js +107 -0
- package/dist/internal/authorization/validation/decisions.js.map +1 -0
- package/dist/internal/authorization/validation/descriptors.d.ts +8 -0
- package/dist/internal/authorization/validation/descriptors.d.ts.map +1 -0
- package/dist/internal/authorization/validation/descriptors.js +24 -0
- package/dist/internal/authorization/validation/descriptors.js.map +1 -0
- package/dist/internal/authorization/validation/expression.d.ts +11 -0
- package/dist/internal/authorization/validation/expression.d.ts.map +1 -0
- package/dist/internal/authorization/validation/expression.js +114 -0
- package/dist/internal/authorization/validation/expression.js.map +1 -0
- package/dist/internal/authorization/validation/traversal.d.ts +19 -0
- package/dist/internal/authorization/validation/traversal.d.ts.map +1 -0
- package/dist/internal/authorization/validation/traversal.js +141 -0
- package/dist/internal/authorization/validation/traversal.js.map +1 -0
- package/dist/internal/authorization/validation/types.d.ts +55 -0
- package/dist/internal/authorization/validation/types.d.ts.map +1 -0
- package/dist/internal/authorization/validation/types.js +184 -0
- package/dist/internal/authorization/validation/types.js.map +1 -0
- package/dist/internal/authorization/validation/validate.d.ts +421 -0
- package/dist/internal/authorization/validation/validate.d.ts.map +1 -0
- package/dist/internal/authorization/validation/validate.js +95 -0
- package/dist/internal/authorization/validation/validate.js.map +1 -0
- package/dist/internal/authorization/version.d.ts +11 -0
- package/dist/internal/authorization/version.d.ts.map +1 -0
- package/dist/internal/authorization/version.js +10 -0
- package/dist/internal/authorization/version.js.map +1 -0
- package/dist/internal/changesets/protocol.d.ts +185 -0
- package/dist/internal/changesets/protocol.d.ts.map +1 -0
- package/dist/internal/changesets/protocol.js +39 -0
- package/dist/internal/changesets/protocol.js.map +1 -0
- package/dist/internal/changesets/service.d.ts +69 -0
- package/dist/internal/changesets/service.d.ts.map +1 -0
- package/dist/internal/changesets/service.js +298 -0
- package/dist/internal/changesets/service.js.map +1 -0
- package/dist/internal/core/bytes.d.ts +41 -0
- package/dist/internal/core/bytes.d.ts.map +1 -0
- package/dist/internal/core/bytes.js +215 -0
- package/dist/internal/core/bytes.js.map +1 -0
- package/dist/internal/core/composition.d.ts +20 -0
- package/dist/internal/core/composition.d.ts.map +1 -0
- package/dist/internal/core/composition.js +52 -0
- package/dist/internal/core/composition.js.map +1 -0
- package/dist/internal/core/conn.d.ts +64 -0
- package/dist/internal/core/conn.d.ts.map +1 -0
- package/dist/internal/core/conn.js +240 -0
- package/dist/internal/core/conn.js.map +1 -0
- package/dist/internal/core/datom.d.ts +73 -0
- package/dist/internal/core/datom.d.ts.map +1 -0
- package/dist/internal/core/datom.js +477 -0
- package/dist/internal/core/datom.js.map +1 -0
- package/dist/internal/core/db.d.ts +65 -0
- package/dist/internal/core/db.d.ts.map +1 -0
- package/dist/internal/core/db.js +261 -0
- package/dist/internal/core/db.js.map +1 -0
- package/dist/internal/core/index.d.ts +21 -0
- package/dist/internal/core/index.d.ts.map +1 -0
- package/dist/internal/core/index.js +21 -0
- package/dist/internal/core/index.js.map +1 -0
- package/dist/internal/core/json.d.ts +5 -0
- package/dist/internal/core/json.d.ts.map +1 -0
- package/dist/internal/core/json.js +56 -0
- package/dist/internal/core/json.js.map +1 -0
- package/dist/internal/core/log.d.ts +68 -0
- package/dist/internal/core/log.d.ts.map +1 -0
- package/dist/internal/core/log.js +76 -0
- package/dist/internal/core/log.js.map +1 -0
- package/dist/internal/core/novelty.d.ts +38 -0
- package/dist/internal/core/novelty.d.ts.map +1 -0
- package/dist/internal/core/novelty.js +300 -0
- package/dist/internal/core/novelty.js.map +1 -0
- package/dist/internal/core/query/ast.d.ts +174 -0
- package/dist/internal/core/query/ast.d.ts.map +1 -0
- package/dist/internal/core/query/ast.js +37 -0
- package/dist/internal/core/query/ast.js.map +1 -0
- package/dist/internal/core/query/builtins.d.ts +19 -0
- package/dist/internal/core/query/builtins.d.ts.map +1 -0
- package/dist/internal/core/query/builtins.js +242 -0
- package/dist/internal/core/query/builtins.js.map +1 -0
- package/dist/internal/core/query/edn.d.ts +19 -0
- package/dist/internal/core/query/edn.d.ts.map +1 -0
- package/dist/internal/core/query/edn.js +248 -0
- package/dist/internal/core/query/edn.js.map +1 -0
- package/dist/internal/core/query/engine.d.ts +56 -0
- package/dist/internal/core/query/engine.d.ts.map +1 -0
- package/dist/internal/core/query/engine.js +0 -0
- package/dist/internal/core/query/engine.js.map +1 -0
- package/dist/internal/core/query/parse.d.ts +8 -0
- package/dist/internal/core/query/parse.d.ts.map +1 -0
- package/dist/internal/core/query/parse.js +606 -0
- package/dist/internal/core/query/parse.js.map +1 -0
- package/dist/internal/core/query/pull.d.ts +7 -0
- package/dist/internal/core/query/pull.d.ts.map +1 -0
- package/dist/internal/core/query/pull.js +304 -0
- package/dist/internal/core/query/pull.js.map +1 -0
- package/dist/internal/core/query/value.d.ts +10 -0
- package/dist/internal/core/query/value.d.ts.map +1 -0
- package/dist/internal/core/query/value.js +21 -0
- package/dist/internal/core/query/value.js.map +1 -0
- package/dist/internal/core/revision.d.ts +19 -0
- package/dist/internal/core/revision.d.ts.map +1 -0
- package/dist/internal/core/revision.js +13 -0
- package/dist/internal/core/revision.js.map +1 -0
- package/dist/internal/core/schema.d.ts +63 -0
- package/dist/internal/core/schema.d.ts.map +1 -0
- package/dist/internal/core/schema.js +228 -0
- package/dist/internal/core/schema.js.map +1 -0
- package/dist/internal/core/segment.d.ts +16 -0
- package/dist/internal/core/segment.d.ts.map +1 -0
- package/dist/internal/core/segment.js +149 -0
- package/dist/internal/core/segment.js.map +1 -0
- package/dist/internal/core/store.d.ts +35 -0
- package/dist/internal/core/store.d.ts.map +1 -0
- package/dist/internal/core/store.js +88 -0
- package/dist/internal/core/store.js.map +1 -0
- package/dist/internal/core/telemetry.d.ts +53 -0
- package/dist/internal/core/telemetry.d.ts.map +1 -0
- package/dist/internal/core/telemetry.js +103 -0
- package/dist/internal/core/telemetry.js.map +1 -0
- package/dist/internal/core/tree.d.ts +60 -0
- package/dist/internal/core/tree.d.ts.map +1 -0
- package/dist/internal/core/tree.js +625 -0
- package/dist/internal/core/tree.js.map +1 -0
- package/dist/internal/core/tx-provenance.d.ts +7 -0
- package/dist/internal/core/tx-provenance.d.ts.map +1 -0
- package/dist/internal/core/tx-provenance.js +16 -0
- package/dist/internal/core/tx-provenance.js.map +1 -0
- package/dist/internal/core/tx.d.ts +51 -0
- package/dist/internal/core/tx.d.ts.map +1 -0
- package/dist/internal/core/tx.js +1029 -0
- package/dist/internal/core/tx.js.map +1 -0
- package/dist/internal/replica/basis.d.ts +15 -0
- package/dist/internal/replica/basis.d.ts.map +1 -0
- package/dist/internal/replica/basis.js +32 -0
- package/dist/internal/replica/basis.js.map +1 -0
- package/dist/internal/replica/errors.d.ts +32 -0
- package/dist/internal/replica/errors.d.ts.map +1 -0
- package/dist/internal/replica/errors.js +30 -0
- package/dist/internal/replica/errors.js.map +1 -0
- package/dist/internal/replica/index.d.ts +4 -0
- package/dist/internal/replica/index.d.ts.map +1 -0
- package/dist/internal/replica/index.js +4 -0
- package/dist/internal/replica/index.js.map +1 -0
- package/dist/internal/replica/replica-do-testing.d.ts +11 -0
- package/dist/internal/replica/replica-do-testing.d.ts.map +1 -0
- package/dist/internal/replica/replica-do-testing.js +340 -0
- package/dist/internal/replica/replica-do-testing.js.map +1 -0
- package/dist/internal/replica/replica-do.d.ts +87 -0
- package/dist/internal/replica/replica-do.d.ts.map +1 -0
- package/dist/internal/replica/replica-do.js +735 -0
- package/dist/internal/replica/replica-do.js.map +1 -0
- package/dist/internal/replica/revision-retention.d.ts +29 -0
- package/dist/internal/replica/revision-retention.d.ts.map +1 -0
- package/dist/internal/replica/revision-retention.js +39 -0
- package/dist/internal/replica/revision-retention.js.map +1 -0
- package/dist/internal/replication/activation-fence.d.ts +40 -0
- package/dist/internal/replication/activation-fence.d.ts.map +1 -0
- package/dist/internal/replication/activation-fence.js +85 -0
- package/dist/internal/replication/activation-fence.js.map +1 -0
- package/dist/internal/replication/digest.d.ts +2 -0
- package/dist/internal/replication/digest.d.ts.map +1 -0
- package/dist/internal/replication/digest.js +12 -0
- package/dist/internal/replication/digest.js.map +1 -0
- package/dist/internal/replication/entity-id.d.ts +23 -0
- package/dist/internal/replication/entity-id.d.ts.map +1 -0
- package/dist/internal/replication/entity-id.js +161 -0
- package/dist/internal/replication/entity-id.js.map +1 -0
- package/dist/internal/replication/idb.d.ts +9 -0
- package/dist/internal/replication/idb.d.ts.map +1 -0
- package/dist/internal/replication/idb.js +46 -0
- package/dist/internal/replication/idb.js.map +1 -0
- package/dist/internal/replication/identity-root.d.ts +11 -0
- package/dist/internal/replication/identity-root.d.ts.map +1 -0
- package/dist/internal/replication/identity-root.js +48 -0
- package/dist/internal/replication/identity-root.js.map +1 -0
- package/dist/internal/replication/identity.d.ts +40 -0
- package/dist/internal/replication/identity.d.ts.map +1 -0
- package/dist/internal/replication/identity.js +95 -0
- package/dist/internal/replication/identity.js.map +1 -0
- package/dist/internal/replication/index.d.ts +13 -0
- package/dist/internal/replication/index.d.ts.map +1 -0
- package/dist/internal/replication/index.js +13 -0
- package/dist/internal/replication/index.js.map +1 -0
- package/dist/internal/replication/indexeddb.d.ts +171 -0
- package/dist/internal/replication/indexeddb.d.ts.map +1 -0
- package/dist/internal/replication/indexeddb.js +1809 -0
- package/dist/internal/replication/indexeddb.js.map +1 -0
- package/dist/internal/replication/leadership.d.ts +36 -0
- package/dist/internal/replication/leadership.d.ts.map +1 -0
- package/dist/internal/replication/leadership.js +108 -0
- package/dist/internal/replication/leadership.js.map +1 -0
- package/dist/internal/replication/logical.d.ts +40 -0
- package/dist/internal/replication/logical.d.ts.map +1 -0
- package/dist/internal/replication/logical.js +375 -0
- package/dist/internal/replication/logical.js.map +1 -0
- package/dist/internal/replication/notices.d.ts +32 -0
- package/dist/internal/replication/notices.d.ts.map +1 -0
- package/dist/internal/replication/notices.js +92 -0
- package/dist/internal/replication/notices.js.map +1 -0
- package/dist/internal/replication/outbox-storage.d.ts +98 -0
- package/dist/internal/replication/outbox-storage.d.ts.map +1 -0
- package/dist/internal/replication/outbox-storage.js +826 -0
- package/dist/internal/replication/outbox-storage.js.map +1 -0
- package/dist/internal/replication/outbox.d.ts +200 -0
- package/dist/internal/replication/outbox.d.ts.map +1 -0
- package/dist/internal/replication/outbox.js +744 -0
- package/dist/internal/replication/outbox.js.map +1 -0
- package/dist/internal/replication/overlay-layers.d.ts +14 -0
- package/dist/internal/replication/overlay-layers.d.ts.map +1 -0
- package/dist/internal/replication/overlay-layers.js +2 -0
- package/dist/internal/replication/overlay-layers.js.map +1 -0
- package/dist/internal/replication/overlay-records.d.ts +61 -0
- package/dist/internal/replication/overlay-records.d.ts.map +1 -0
- package/dist/internal/replication/overlay-records.js +328 -0
- package/dist/internal/replication/overlay-records.js.map +1 -0
- package/dist/internal/replication/overlay.d.ts +20 -0
- package/dist/internal/replication/overlay.d.ts.map +1 -0
- package/dist/internal/replication/overlay.js +159 -0
- package/dist/internal/replication/overlay.js.map +1 -0
- package/dist/internal/replication/projection-binding.d.ts +39 -0
- package/dist/internal/replication/projection-binding.d.ts.map +1 -0
- package/dist/internal/replication/projection-binding.js +76 -0
- package/dist/internal/replication/projection-binding.js.map +1 -0
- package/dist/internal/replication/protocol.d.ts +633 -0
- package/dist/internal/replication/protocol.d.ts.map +1 -0
- package/dist/internal/replication/protocol.js +263 -0
- package/dist/internal/replication/protocol.js.map +1 -0
- package/dist/internal/replication/reconciliation.d.ts +64 -0
- package/dist/internal/replication/reconciliation.d.ts.map +1 -0
- package/dist/internal/replication/reconciliation.js +184 -0
- package/dist/internal/replication/reconciliation.js.map +1 -0
- package/dist/internal/replication/replica-gc.d.ts +42 -0
- package/dist/internal/replication/replica-gc.d.ts.map +1 -0
- package/dist/internal/replication/replica-gc.js +91 -0
- package/dist/internal/replication/replica-gc.js.map +1 -0
- package/dist/internal/replication/replica-integrity.d.ts +107 -0
- package/dist/internal/replication/replica-integrity.d.ts.map +1 -0
- package/dist/internal/replication/replica-integrity.js +418 -0
- package/dist/internal/replication/replica-integrity.js.map +1 -0
- package/dist/internal/replication/replica-lifecycle.d.ts +72 -0
- package/dist/internal/replication/replica-lifecycle.d.ts.map +1 -0
- package/dist/internal/replication/replica-lifecycle.js +126 -0
- package/dist/internal/replication/replica-lifecycle.js.map +1 -0
- package/dist/internal/replication/replica-schema.d.ts +27 -0
- package/dist/internal/replication/replica-schema.d.ts.map +1 -0
- package/dist/internal/replication/replica-schema.js +130 -0
- package/dist/internal/replication/replica-schema.js.map +1 -0
- package/dist/internal/replication/route-slot.d.ts +9 -0
- package/dist/internal/replication/route-slot.d.ts.map +1 -0
- package/dist/internal/replication/route-slot.js +8 -0
- package/dist/internal/replication/route-slot.js.map +1 -0
- package/dist/internal/replication/server-identity.d.ts +54 -0
- package/dist/internal/replication/server-identity.d.ts.map +1 -0
- package/dist/internal/replication/server-identity.js +68 -0
- package/dist/internal/replication/server-identity.js.map +1 -0
- package/dist/internal/replication/session.d.ts +91 -0
- package/dist/internal/replication/session.d.ts.map +1 -0
- package/dist/internal/replication/session.js +673 -0
- package/dist/internal/replication/session.js.map +1 -0
- package/dist/internal/replication/state.d.ts +34 -0
- package/dist/internal/replication/state.d.ts.map +1 -0
- package/dist/internal/replication/state.js +344 -0
- package/dist/internal/replication/state.js.map +1 -0
- package/dist/internal/replication/submission.d.ts +115 -0
- package/dist/internal/replication/submission.d.ts.map +1 -0
- package/dist/internal/replication/submission.js +266 -0
- package/dist/internal/replication/submission.js.map +1 -0
- package/dist/internal/replication/transport.d.ts +34 -0
- package/dist/internal/replication/transport.d.ts.map +1 -0
- package/dist/internal/replication/transport.js +215 -0
- package/dist/internal/replication/transport.js.map +1 -0
- package/dist/internal/runtime-boundaries.d.ts +8 -0
- package/dist/internal/runtime-boundaries.d.ts.map +1 -0
- package/dist/internal/runtime-boundaries.js +7 -0
- package/dist/internal/runtime-boundaries.js.map +1 -0
- package/dist/internal/storage/index.d.ts +111 -0
- package/dist/internal/storage/index.d.ts.map +1 -0
- package/dist/internal/storage/index.js +288 -0
- package/dist/internal/storage/index.js.map +1 -0
- package/dist/internal/storage/memory.d.ts +31 -0
- package/dist/internal/storage/memory.d.ts.map +1 -0
- package/dist/internal/storage/memory.js +46 -0
- package/dist/internal/storage/memory.js.map +1 -0
- package/dist/internal/storage/revisions.d.ts +24 -0
- package/dist/internal/storage/revisions.d.ts.map +1 -0
- package/dist/internal/storage/revisions.js +74 -0
- package/dist/internal/storage/revisions.js.map +1 -0
- package/dist/internal/test-hooks.d.ts +47 -0
- package/dist/internal/test-hooks.d.ts.map +1 -0
- package/dist/internal/test-hooks.js +256 -0
- package/dist/internal/test-hooks.js.map +1 -0
- package/dist/internal/transactor/env.d.ts +3 -0
- package/dist/internal/transactor/env.d.ts.map +1 -0
- package/dist/internal/transactor/env.js +5 -0
- package/dist/internal/transactor/env.js.map +1 -0
- package/dist/internal/transactor/errors.d.ts +47 -0
- package/dist/internal/transactor/errors.d.ts.map +1 -0
- package/dist/internal/transactor/errors.js +66 -0
- package/dist/internal/transactor/errors.js.map +1 -0
- package/dist/internal/transactor/host.d.ts +37 -0
- package/dist/internal/transactor/host.d.ts.map +1 -0
- package/dist/internal/transactor/host.js +11 -0
- package/dist/internal/transactor/host.js.map +1 -0
- package/dist/internal/transactor/index.d.ts +8 -0
- package/dist/internal/transactor/index.d.ts.map +1 -0
- package/dist/internal/transactor/index.js +8 -0
- package/dist/internal/transactor/index.js.map +1 -0
- package/dist/internal/transactor/indexer.d.ts +53 -0
- package/dist/internal/transactor/indexer.d.ts.map +1 -0
- package/dist/internal/transactor/indexer.js +125 -0
- package/dist/internal/transactor/indexer.js.map +1 -0
- package/dist/internal/transactor/internal.d.ts +8 -0
- package/dist/internal/transactor/internal.d.ts.map +1 -0
- package/dist/internal/transactor/internal.js +28 -0
- package/dist/internal/transactor/internal.js.map +1 -0
- package/dist/internal/transactor/observability.d.ts +44 -0
- package/dist/internal/transactor/observability.d.ts.map +1 -0
- package/dist/internal/transactor/observability.js +39 -0
- package/dist/internal/transactor/observability.js.map +1 -0
- package/dist/internal/transactor/transactor-do.d.ts +35 -0
- package/dist/internal/transactor/transactor-do.d.ts.map +1 -0
- package/dist/internal/transactor/transactor-do.js +198 -0
- package/dist/internal/transactor/transactor-do.js.map +1 -0
- package/dist/internal/transactor/transactor.d.ts +209 -0
- package/dist/internal/transactor/transactor.d.ts.map +1 -0
- package/dist/internal/transactor/transactor.js +1166 -0
- package/dist/internal/transactor/transactor.js.map +1 -0
- package/dist/mcp/contract.d.ts +49 -0
- package/dist/mcp/contract.d.ts.map +1 -0
- package/dist/mcp/contract.js +199 -0
- package/dist/mcp/contract.js.map +1 -0
- package/dist/mcp/kernel.d.ts +56 -0
- package/dist/mcp/kernel.d.ts.map +1 -0
- package/dist/mcp/kernel.js +344 -0
- package/dist/mcp/kernel.js.map +1 -0
- package/dist/mcp/server.d.ts +8 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +182 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/peer.d.ts +175 -0
- package/dist/peer.d.ts.map +1 -0
- package/dist/peer.js +200 -0
- package/dist/peer.js.map +1 -0
- package/dist/react/hooks.d.ts +157 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +130 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +2 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/query-state.d.ts +60 -0
- package/dist/react/query-state.d.ts.map +1 -0
- package/dist/react/query-state.js +48 -0
- package/dist/react/query-state.js.map +1 -0
- package/dist/react/receipt-state.d.ts +27 -0
- package/dist/react/receipt-state.d.ts.map +1 -0
- package/dist/react/receipt-state.js +2 -0
- package/dist/react/receipt-state.js.map +1 -0
- package/dist/react/store.d.ts +30 -0
- package/dist/react/store.d.ts.map +1 -0
- package/dist/react/store.js +118 -0
- package/dist/react/store.js.map +1 -0
- package/dist/react/suspense.d.ts +6 -0
- package/dist/react/suspense.d.ts.map +1 -0
- package/dist/react/suspense.js +111 -0
- package/dist/react/suspense.js.map +1 -0
- package/dist/worker/admit.d.ts +9 -0
- package/dist/worker/admit.d.ts.map +1 -0
- package/dist/worker/admit.js +43 -0
- package/dist/worker/admit.js.map +1 -0
- package/dist/worker/analytics.d.ts +39 -0
- package/dist/worker/analytics.d.ts.map +1 -0
- package/dist/worker/analytics.js +54 -0
- package/dist/worker/analytics.js.map +1 -0
- package/dist/worker/auth.d.ts +26 -0
- package/dist/worker/auth.d.ts.map +1 -0
- package/dist/worker/auth.js +2 -0
- package/dist/worker/auth.js.map +1 -0
- package/dist/worker/authorized-live.d.ts +15 -0
- package/dist/worker/authorized-live.d.ts.map +1 -0
- package/dist/worker/authorized-live.js +30 -0
- package/dist/worker/authorized-live.js.map +1 -0
- package/dist/worker/authorized-operation.d.ts +30 -0
- package/dist/worker/authorized-operation.d.ts.map +1 -0
- package/dist/worker/authorized-operation.js +304 -0
- package/dist/worker/authorized-operation.js.map +1 -0
- package/dist/worker/authorized-read.d.ts +32 -0
- package/dist/worker/authorized-read.d.ts.map +1 -0
- package/dist/worker/authorized-read.js +194 -0
- package/dist/worker/authorized-read.js.map +1 -0
- package/dist/worker/authorized-replication.d.ts +21 -0
- package/dist/worker/authorized-replication.d.ts.map +1 -0
- package/dist/worker/authorized-replication.js +593 -0
- package/dist/worker/authorized-replication.js.map +1 -0
- package/dist/worker/changesets.d.ts +9 -0
- package/dist/worker/changesets.d.ts.map +1 -0
- package/dist/worker/changesets.js +105 -0
- package/dist/worker/changesets.js.map +1 -0
- package/dist/worker/demo.d.ts +2 -0
- package/dist/worker/demo.d.ts.map +1 -0
- package/dist/worker/demo.js +85 -0
- package/dist/worker/demo.js.map +1 -0
- package/dist/worker/errors.d.ts +53 -0
- package/dist/worker/errors.d.ts.map +1 -0
- package/dist/worker/errors.js +107 -0
- package/dist/worker/errors.js.map +1 -0
- package/dist/worker/handle.d.ts +21 -0
- package/dist/worker/handle.d.ts.map +1 -0
- package/dist/worker/handle.js +386 -0
- package/dist/worker/handle.js.map +1 -0
- package/dist/worker/index.d.ts +27 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +24 -0
- package/dist/worker/index.js.map +1 -0
- package/dist/worker/jwt.d.ts +23 -0
- package/dist/worker/jwt.d.ts.map +1 -0
- package/dist/worker/jwt.js +288 -0
- package/dist/worker/jwt.js.map +1 -0
- package/dist/worker/mcp.d.ts +17 -0
- package/dist/worker/mcp.d.ts.map +1 -0
- package/dist/worker/mcp.js +151 -0
- package/dist/worker/mcp.js.map +1 -0
- package/dist/worker/operation-catalogs.d.ts +38 -0
- package/dist/worker/operation-catalogs.d.ts.map +1 -0
- package/dist/worker/operation-catalogs.js +114 -0
- package/dist/worker/operation-catalogs.js.map +1 -0
- package/dist/worker/peer.d.ts +70 -0
- package/dist/worker/peer.d.ts.map +1 -0
- package/dist/worker/peer.js +330 -0
- package/dist/worker/peer.js.map +1 -0
- package/dist/worker/public-observation.d.ts +15 -0
- package/dist/worker/public-observation.d.ts.map +1 -0
- package/dist/worker/public-observation.js +111 -0
- package/dist/worker/public-observation.js.map +1 -0
- package/dist/worker/server-identity.d.ts +2 -0
- package/dist/worker/server-identity.d.ts.map +1 -0
- package/dist/worker/server-identity.js +2 -0
- package/dist/worker/server-identity.js.map +1 -0
- package/dist/worker/session-sync.d.ts +27 -0
- package/dist/worker/session-sync.d.ts.map +1 -0
- package/dist/worker/session-sync.js +4 -0
- package/dist/worker/session-sync.js.map +1 -0
- package/dist/worker/session.d.ts +144 -0
- package/dist/worker/session.d.ts.map +1 -0
- package/dist/worker/session.js +408 -0
- package/dist/worker/session.js.map +1 -0
- package/dist/worker/storage-test-admin.d.ts +3 -0
- package/dist/worker/storage-test-admin.d.ts.map +1 -0
- package/dist/worker/storage-test-admin.js +277 -0
- package/dist/worker/storage-test-admin.js.map +1 -0
- package/dist/worker/test-admin.d.ts +11 -0
- package/dist/worker/test-admin.d.ts.map +1 -0
- package/dist/worker/test-admin.js +432 -0
- package/dist/worker/test-admin.js.map +1 -0
- package/dist/worker/testing.d.ts +14 -0
- package/dist/worker/testing.d.ts.map +1 -0
- package/dist/worker/testing.js +71 -0
- package/dist/worker/testing.js.map +1 -0
- package/dist/workerEntry.d.ts +2 -0
- package/dist/workerEntry.d.ts.map +1 -0
- package/dist/workerEntry.js +10 -0
- package/dist/workerEntry.js.map +1 -0
- package/dist/writes.d.ts +8 -0
- package/dist/writes.d.ts.map +1 -0
- package/dist/writes.js +11 -0
- package/dist/writes.js.map +1 -0
- package/package.json +104 -4
|
@@ -0,0 +1,826 @@
|
|
|
1
|
+
import * as Data from "effect/Data";
|
|
2
|
+
import { isClientRef, isEntityId } from "../../db/refs.js";
|
|
3
|
+
import { canonicalizeJson } from "../authorization/canonical-json.js";
|
|
4
|
+
import { abortTransaction, abortWithSignal, commitTransaction, compoundPrefixRange, prefixRange, requestResult, transactionDone, } from "./idb.js";
|
|
5
|
+
import { buildOptimisticLayer, decodeOptimisticLayer, MUTATION_LAYERS, withLayerState, } from "./overlay-records.js";
|
|
6
|
+
import { replicaNotice, } from "./notices.js";
|
|
7
|
+
import { REPLICA_COMMITTED_HEADS_STORE, REPLICA_GENERATIONS_STORE, ReplicaFencedError, ReplicaScopeUnconfirmedError, replicaDatabasePartitionPrefix, replicaScopeKey, } from "./replica-lifecycle.js";
|
|
8
|
+
import { buildClientRef, buildClientRefMapping, buildOutboxRecord, buildQueueCursor, buildReceipt, ClientRefConflict, decodeClientRef, decodeClientRefMapping, decodeOutboxRecord, decodeReceipt, decodeQueueCursor, fencedByActivation, mappingKey, mutationPartitionKey, mutationScopePrefix, outboxDependencies, OutboxInvocationConflict, OutboxRecordInvalid, planOutbox, sameOutboxIntent, sealingEpochOf, unobservedReceiptOf, } from "./outbox.js";
|
|
9
|
+
export const MUTATION_OUTBOX = "mutation-outbox-v1";
|
|
10
|
+
export const MUTATION_QUEUES = "mutation-queues-v1";
|
|
11
|
+
export const MUTATION_RECEIPTS = "mutation-receipts-v1";
|
|
12
|
+
export const MUTATION_CLIENT_REFS = "mutation-client-refs-v1";
|
|
13
|
+
export const MUTATION_MAPPINGS = "mutation-client-ref-mappings-v1";
|
|
14
|
+
export { MUTATION_LAYERS } from "./overlay-records.js";
|
|
15
|
+
const MUTATION_KEYED_FAMILIES = [MUTATION_QUEUES];
|
|
16
|
+
const MUTATION_PREFIXED_FAMILIES = [
|
|
17
|
+
MUTATION_OUTBOX,
|
|
18
|
+
MUTATION_RECEIPTS,
|
|
19
|
+
MUTATION_CLIENT_REFS,
|
|
20
|
+
MUTATION_MAPPINGS,
|
|
21
|
+
MUTATION_LAYERS,
|
|
22
|
+
];
|
|
23
|
+
export const MUTATION_STORE_FAMILIES = [
|
|
24
|
+
...MUTATION_KEYED_FAMILIES,
|
|
25
|
+
...MUTATION_PREFIXED_FAMILIES,
|
|
26
|
+
];
|
|
27
|
+
const BY_INVOCATION = "by-invocation";
|
|
28
|
+
const BY_CLIENT_REF = "by-client-ref";
|
|
29
|
+
const ENQUEUE_STORES = [
|
|
30
|
+
MUTATION_OUTBOX,
|
|
31
|
+
MUTATION_QUEUES,
|
|
32
|
+
MUTATION_RECEIPTS,
|
|
33
|
+
MUTATION_CLIENT_REFS,
|
|
34
|
+
MUTATION_LAYERS,
|
|
35
|
+
REPLICA_GENERATIONS_STORE,
|
|
36
|
+
];
|
|
37
|
+
export const createMutationStores = (database, upgrade, resetLegacy) => {
|
|
38
|
+
const ensure = (name, keyPath, indexes = []) => {
|
|
39
|
+
const existed = database.objectStoreNames.contains(name);
|
|
40
|
+
const store = existed
|
|
41
|
+
? upgrade.objectStore(name)
|
|
42
|
+
: database.createObjectStore(name, { keyPath });
|
|
43
|
+
if (existed && resetLegacy)
|
|
44
|
+
store.clear();
|
|
45
|
+
for (const [index, path] of indexes) {
|
|
46
|
+
if (store.indexNames.contains(index)) {
|
|
47
|
+
const current = store.index(index);
|
|
48
|
+
if (current.keyPath === path && current.unique)
|
|
49
|
+
continue;
|
|
50
|
+
store.deleteIndex(index);
|
|
51
|
+
}
|
|
52
|
+
store.createIndex(index, path, { unique: true });
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
ensure(MUTATION_QUEUES, "partition");
|
|
56
|
+
ensure(MUTATION_OUTBOX, ["partition", "sequence"], [[BY_INVOCATION, "invocation"]]);
|
|
57
|
+
ensure(MUTATION_RECEIPTS, ["partition", "invocation"], [
|
|
58
|
+
[BY_INVOCATION, "invocation"],
|
|
59
|
+
]);
|
|
60
|
+
ensure(MUTATION_CLIENT_REFS, ["partition", "clientRef"], [
|
|
61
|
+
[BY_CLIENT_REF, "clientRef"],
|
|
62
|
+
]);
|
|
63
|
+
ensure(MUTATION_MAPPINGS, ["partition", "clientRef"], [[BY_CLIENT_REF, "clientRef"]]);
|
|
64
|
+
ensure(MUTATION_LAYERS, ["partition", "sequence"], [[BY_INVOCATION, "invocation"]]);
|
|
65
|
+
};
|
|
66
|
+
export const clearMutationScope = async (transaction, scope) => {
|
|
67
|
+
const prefix = mutationScopePrefix(scope);
|
|
68
|
+
const [queued, clientRefs, layers] = await Promise.all([
|
|
69
|
+
requestResult(transaction.objectStore(MUTATION_OUTBOX).count(compoundPrefixRange(prefix))),
|
|
70
|
+
requestResult(transaction.objectStore(MUTATION_CLIENT_REFS).count(compoundPrefixRange(prefix))),
|
|
71
|
+
requestResult(transaction.objectStore(MUTATION_LAYERS).count(compoundPrefixRange(prefix))),
|
|
72
|
+
]);
|
|
73
|
+
for (const family of MUTATION_KEYED_FAMILIES) {
|
|
74
|
+
transaction.objectStore(family).delete(prefixRange(prefix));
|
|
75
|
+
}
|
|
76
|
+
for (const family of MUTATION_PREFIXED_FAMILIES) {
|
|
77
|
+
transaction.objectStore(family).delete(compoundPrefixRange(prefix));
|
|
78
|
+
}
|
|
79
|
+
return Object.freeze({ queued, clientRefs, layers });
|
|
80
|
+
};
|
|
81
|
+
const confirmCommittedHead = async (transaction, receiver) => {
|
|
82
|
+
const heads = await requestResult(transaction.objectStore(REPLICA_COMMITTED_HEADS_STORE).getAll(prefixRange(replicaDatabasePartitionPrefix(receiver))));
|
|
83
|
+
for (const head of heads) {
|
|
84
|
+
const revision = head?.revision;
|
|
85
|
+
if (typeof revision === "string" && revision.length > 0)
|
|
86
|
+
return revision;
|
|
87
|
+
}
|
|
88
|
+
throw new OutboxRecordInvalid({
|
|
89
|
+
reason: "no committed replica of this receiver database confirms the fenced outcome",
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
const epochsOf = (mapped) => new Map([...mapped].map(([key, record]) => [key, record.sealing]));
|
|
93
|
+
const sameJsonValue = (left, right) => {
|
|
94
|
+
if (left === right)
|
|
95
|
+
return true;
|
|
96
|
+
if (Array.isArray(left)) {
|
|
97
|
+
return Array.isArray(right) && left.length === right.length &&
|
|
98
|
+
left.every((item, index) => sameJsonValue(item, right[index]));
|
|
99
|
+
}
|
|
100
|
+
if (typeof left !== "object" || left === null || typeof right !== "object" ||
|
|
101
|
+
right === null || Array.isArray(right))
|
|
102
|
+
return false;
|
|
103
|
+
const fields = left;
|
|
104
|
+
const others = right;
|
|
105
|
+
const keys = Object.keys(fields);
|
|
106
|
+
if (keys.length !== Object.keys(others).length)
|
|
107
|
+
return false;
|
|
108
|
+
return keys.every((key) => Object.hasOwn(others, key) && sameJsonValue(fields[key], others[key]));
|
|
109
|
+
};
|
|
110
|
+
const sameReceiptOutput = (left, right) => {
|
|
111
|
+
if (left === null || right === null)
|
|
112
|
+
return left === right;
|
|
113
|
+
try {
|
|
114
|
+
return canonicalizeJson(left) === canonicalizeJson(right);
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return sameJsonValue(left, right);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const sameMappings = (left, right) => {
|
|
121
|
+
if (left.length !== right.length)
|
|
122
|
+
return false;
|
|
123
|
+
const seen = new Map(left.map((mapping) => [mapping.clientRef, mapping.entityId]));
|
|
124
|
+
return right.every((mapping) => seen.get(mapping.clientRef) === mapping.entityId);
|
|
125
|
+
};
|
|
126
|
+
export class ClientRefMappingRefused extends Data.TaggedError("ClientRefMappingRefused") {
|
|
127
|
+
}
|
|
128
|
+
export class IndexedDbOutbox {
|
|
129
|
+
database;
|
|
130
|
+
boundaries;
|
|
131
|
+
assertScopeLive;
|
|
132
|
+
leader;
|
|
133
|
+
announce;
|
|
134
|
+
constructor(database, boundaries, assertScopeLive, leader = undefined, announce = () => undefined) {
|
|
135
|
+
this.database = database;
|
|
136
|
+
this.boundaries = boundaries;
|
|
137
|
+
this.assertScopeLive = assertScopeLive;
|
|
138
|
+
this.leader = leader;
|
|
139
|
+
this.announce = announce;
|
|
140
|
+
}
|
|
141
|
+
announceReceiver(kind, receiver) {
|
|
142
|
+
this.announce(replicaNotice(kind, receiver, receiver));
|
|
143
|
+
}
|
|
144
|
+
async enqueue(draft, options) {
|
|
145
|
+
const receiver = Object.freeze({
|
|
146
|
+
server: draft.receiver.server,
|
|
147
|
+
principal: draft.receiver.principal,
|
|
148
|
+
database: draft.receiver.database,
|
|
149
|
+
});
|
|
150
|
+
const snapshot = { ...draft, receiver };
|
|
151
|
+
if (receiver.server !== options.scope.server ||
|
|
152
|
+
receiver.principal !== options.scope.principal) {
|
|
153
|
+
throw new OutboxRecordInvalid({
|
|
154
|
+
reason: "the receiver database is outside the supplied confirmed scope",
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
const scopeKey = replicaScopeKey(options.scope);
|
|
158
|
+
const partition = mutationPartitionKey(receiver);
|
|
159
|
+
const observed = await this.preflightScope(options.scope);
|
|
160
|
+
const transaction = this.database.transaction([...ENQUEUE_STORES], "readwrite");
|
|
161
|
+
const removeAbort = abortWithSignal(transaction, options.signal);
|
|
162
|
+
try {
|
|
163
|
+
const record = await this.stageEnqueue(transaction, snapshot, options, scopeKey, partition, observed);
|
|
164
|
+
this.announceReceiver("layer", receiver);
|
|
165
|
+
return record;
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
await abortTransaction(transaction);
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
removeAbort();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
async preflightScope(scope) {
|
|
176
|
+
this.assertScopeLive(scope);
|
|
177
|
+
const scopeKey = replicaScopeKey(scope);
|
|
178
|
+
const transaction = this.database.transaction(REPLICA_GENERATIONS_STORE, "readonly");
|
|
179
|
+
const record = await requestResult(transaction.objectStore(REPLICA_GENERATIONS_STORE).get(scopeKey));
|
|
180
|
+
await transactionDone(transaction);
|
|
181
|
+
if (record === undefined) {
|
|
182
|
+
throw new ReplicaScopeUnconfirmedError({ scope: scopeKey });
|
|
183
|
+
}
|
|
184
|
+
return record.generation;
|
|
185
|
+
}
|
|
186
|
+
async fenceScope(transaction, scopeKey, observed, lease) {
|
|
187
|
+
const current = await requestResult(transaction.objectStore(REPLICA_GENERATIONS_STORE).get(scopeKey));
|
|
188
|
+
if (current === undefined || current.generation !== observed) {
|
|
189
|
+
throw new ReplicaFencedError({
|
|
190
|
+
key: scopeKey,
|
|
191
|
+
expected: observed,
|
|
192
|
+
observed: current?.generation ?? 0,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
lease?.observe(scopeKey, current.generation);
|
|
196
|
+
}
|
|
197
|
+
async fenceLeadership(transaction) {
|
|
198
|
+
const fence = this.leader?.();
|
|
199
|
+
if (fence === undefined)
|
|
200
|
+
return;
|
|
201
|
+
const held = await requestResult(transaction.objectStore(REPLICA_GENERATIONS_STORE).get(fence.key));
|
|
202
|
+
const generation = held?.generation ?? 0;
|
|
203
|
+
if (generation === fence.epoch)
|
|
204
|
+
return;
|
|
205
|
+
throw new ReplicaFencedError({
|
|
206
|
+
key: fence.key,
|
|
207
|
+
expected: fence.epoch,
|
|
208
|
+
observed: generation,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
async stageEnqueue(transaction, draft, options, scopeKey, partition, observed) {
|
|
212
|
+
const outbox = transaction.objectStore(MUTATION_OUTBOX);
|
|
213
|
+
const [, cursor, existing] = await Promise.all([
|
|
214
|
+
this.fenceScope(transaction, scopeKey, observed, options.lease),
|
|
215
|
+
requestResult(transaction.objectStore(MUTATION_QUEUES).get(partition)),
|
|
216
|
+
requestResult(outbox.index(BY_INVOCATION).get(draft.invocation)),
|
|
217
|
+
]);
|
|
218
|
+
if (existing !== undefined) {
|
|
219
|
+
const queued = decodeOutboxRecord(existing);
|
|
220
|
+
if (queued !== undefined && queued.partition !== partition) {
|
|
221
|
+
throw new OutboxInvocationConflict({ invocation: draft.invocation, partition });
|
|
222
|
+
}
|
|
223
|
+
if (queued === undefined) {
|
|
224
|
+
throw new OutboxInvocationConflict({ invocation: draft.invocation, partition });
|
|
225
|
+
}
|
|
226
|
+
if (!sameOutboxIntent(queued, buildOutboxRecord(draft, scopeKey, queued.sequence))) {
|
|
227
|
+
throw new OutboxInvocationConflict({ invocation: draft.invocation, partition });
|
|
228
|
+
}
|
|
229
|
+
await transactionDone(transaction);
|
|
230
|
+
return queued;
|
|
231
|
+
}
|
|
232
|
+
const settled = await requestResult(transaction.objectStore(MUTATION_RECEIPTS).index(BY_INVOCATION)
|
|
233
|
+
.get(draft.invocation));
|
|
234
|
+
if (settled !== undefined) {
|
|
235
|
+
throw new OutboxInvocationConflict({ invocation: draft.invocation, partition });
|
|
236
|
+
}
|
|
237
|
+
const current = cursor === undefined ? undefined : decodeQueueCursor(cursor);
|
|
238
|
+
if (cursor !== undefined && current === undefined) {
|
|
239
|
+
throw new OutboxRecordInvalid({
|
|
240
|
+
reason: "the durable queue cursor of this receiver is unreadable",
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
const sequence = current?.nextSequence ?? 1;
|
|
244
|
+
const record = buildOutboxRecord(draft, scopeKey, sequence);
|
|
245
|
+
outbox.add(record);
|
|
246
|
+
transaction.objectStore(MUTATION_QUEUES).put(buildQueueCursor({
|
|
247
|
+
partition,
|
|
248
|
+
scope: scopeKey,
|
|
249
|
+
receiver: record.receiver,
|
|
250
|
+
nextSequence: sequence + 1,
|
|
251
|
+
sealing: record.sealing ?? current?.sealing ?? null,
|
|
252
|
+
activation: current?.activation ?? 0,
|
|
253
|
+
updatedAt: record.enqueuedAt,
|
|
254
|
+
}));
|
|
255
|
+
transaction.objectStore(MUTATION_RECEIPTS).add(buildReceipt({
|
|
256
|
+
partition,
|
|
257
|
+
invocation: record.invocation,
|
|
258
|
+
scope: scopeKey,
|
|
259
|
+
state: "queued",
|
|
260
|
+
observation: null,
|
|
261
|
+
activation: 0,
|
|
262
|
+
output: null,
|
|
263
|
+
mappings: [],
|
|
264
|
+
failure: null,
|
|
265
|
+
updatedAt: record.enqueuedAt,
|
|
266
|
+
}));
|
|
267
|
+
const refs = transaction.objectStore(MUTATION_CLIENT_REFS);
|
|
268
|
+
const claims = await Promise.all(record.allocations.map((allocation) => requestResult(refs.index(BY_CLIENT_REF).get(allocation.clientRef))));
|
|
269
|
+
for (const [index, claim] of claims.entries()) {
|
|
270
|
+
if (claim === undefined)
|
|
271
|
+
continue;
|
|
272
|
+
throw new ClientRefConflict({
|
|
273
|
+
clientRef: record.allocations[index].clientRef,
|
|
274
|
+
partition: claim.partition,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
const dependencies = outboxDependencies(record).filter((ref) => !record.allocations.some((allocation) => allocation.clientRef === ref));
|
|
278
|
+
const owners = await Promise.all(dependencies.map((ref) => requestResult(refs.index(BY_CLIENT_REF).get(ref))));
|
|
279
|
+
for (const [index, owner] of owners.entries()) {
|
|
280
|
+
const ref = dependencies[index];
|
|
281
|
+
if (owner === undefined) {
|
|
282
|
+
throw new OutboxRecordInvalid({
|
|
283
|
+
reason: "a queued reference names a client ref this device never allocated",
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
if (owner.partition !== partition) {
|
|
287
|
+
throw new ClientRefConflict({ clientRef: ref, partition: owner.partition });
|
|
288
|
+
}
|
|
289
|
+
const settled = await requestResult(transaction.objectStore(MUTATION_RECEIPTS).get([partition, owner.invocation]));
|
|
290
|
+
if (decodeReceipt(settled)?.state === "rejected") {
|
|
291
|
+
throw new OutboxRecordInvalid({
|
|
292
|
+
reason: "a queued reference names a client ref whose invocation was rejected",
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
for (const allocation of record.allocations) {
|
|
297
|
+
refs.add(buildClientRef({
|
|
298
|
+
partition,
|
|
299
|
+
clientRef: allocation.clientRef,
|
|
300
|
+
invocation: record.invocation,
|
|
301
|
+
slot: allocation.slot,
|
|
302
|
+
createdAt: record.enqueuedAt,
|
|
303
|
+
}));
|
|
304
|
+
}
|
|
305
|
+
if (options.projection !== undefined) {
|
|
306
|
+
transaction.objectStore(MUTATION_LAYERS).add(buildOptimisticLayer({
|
|
307
|
+
record,
|
|
308
|
+
projection: options.projection,
|
|
309
|
+
createdAt: record.enqueuedAt,
|
|
310
|
+
}));
|
|
311
|
+
}
|
|
312
|
+
await this.boundaries.checkpoint("outbox.enqueue");
|
|
313
|
+
this.assertScopeLive(options.scope);
|
|
314
|
+
await commitTransaction(transaction);
|
|
315
|
+
return record;
|
|
316
|
+
}
|
|
317
|
+
async restore(scope) {
|
|
318
|
+
this.assertScopeLive(scope);
|
|
319
|
+
const transaction = this.database.transaction(MUTATION_OUTBOX, "readonly");
|
|
320
|
+
const restored = await this.readOutbox(transaction, scope);
|
|
321
|
+
await transactionDone(transaction);
|
|
322
|
+
return restored;
|
|
323
|
+
}
|
|
324
|
+
async readOutbox(transaction, scope) {
|
|
325
|
+
const range = compoundPrefixRange(mutationScopePrefix(scope));
|
|
326
|
+
const store = transaction.objectStore(MUTATION_OUTBOX);
|
|
327
|
+
const [stored, keys] = await Promise.all([
|
|
328
|
+
requestResult(store.getAll(range)),
|
|
329
|
+
requestResult(store.getAllKeys(range)),
|
|
330
|
+
]);
|
|
331
|
+
const records = [];
|
|
332
|
+
const unreadable = [];
|
|
333
|
+
for (const [index, value] of stored.entries()) {
|
|
334
|
+
const record = decodeOutboxRecord(value);
|
|
335
|
+
if (record !== undefined) {
|
|
336
|
+
records.push(record);
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
const key = keys[index];
|
|
340
|
+
if (Array.isArray(key) && typeof key[0] === "string" &&
|
|
341
|
+
typeof key[1] === "number") {
|
|
342
|
+
unreadable.push(Object.freeze({ partition: key[0], sequence: key[1] }));
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return Object.freeze({
|
|
346
|
+
records: Object.freeze(records),
|
|
347
|
+
unreadable: Object.freeze(unreadable),
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
async mappedRefs(scope) {
|
|
351
|
+
this.assertScopeLive(scope);
|
|
352
|
+
const transaction = this.database.transaction(MUTATION_MAPPINGS, "readonly");
|
|
353
|
+
const mapped = await this.readMappings(transaction, scope);
|
|
354
|
+
await transactionDone(transaction);
|
|
355
|
+
return epochsOf(mapped);
|
|
356
|
+
}
|
|
357
|
+
async readMappings(transaction, scope) {
|
|
358
|
+
const stored = await requestResult(transaction.objectStore(MUTATION_MAPPINGS).getAll(compoundPrefixRange(mutationScopePrefix(scope))));
|
|
359
|
+
const mapped = new Map();
|
|
360
|
+
for (const value of stored) {
|
|
361
|
+
const record = decodeClientRefMapping(value);
|
|
362
|
+
if (record === undefined)
|
|
363
|
+
continue;
|
|
364
|
+
mapped.set(mappingKey(record.partition, record.clientRef), record);
|
|
365
|
+
}
|
|
366
|
+
return mapped;
|
|
367
|
+
}
|
|
368
|
+
async plan(scope, keyId) {
|
|
369
|
+
return (await this.submissionPlan(scope, keyId)).plans;
|
|
370
|
+
}
|
|
371
|
+
async submissionPlan(scope, keyId) {
|
|
372
|
+
this.assertScopeLive(scope);
|
|
373
|
+
const transaction = this.database.transaction([MUTATION_OUTBOX, MUTATION_MAPPINGS], "readonly");
|
|
374
|
+
const [restored, mapped] = await Promise.all([
|
|
375
|
+
this.readOutbox(transaction, scope),
|
|
376
|
+
this.readMappings(transaction, scope),
|
|
377
|
+
]);
|
|
378
|
+
await transactionDone(transaction);
|
|
379
|
+
const context = { mapped: epochsOf(mapped), keyId };
|
|
380
|
+
return Object.freeze({
|
|
381
|
+
plans: planOutbox(restored.records, restored.unreadable, context),
|
|
382
|
+
handles: new Map([...mapped].map(([key, record]) => [key, record.entityId])),
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
async mappedHandles(receiver) {
|
|
386
|
+
this.assertScopeLive(receiver);
|
|
387
|
+
const transaction = this.database.transaction(MUTATION_MAPPINGS, "readonly");
|
|
388
|
+
const stored = await requestResult(transaction.objectStore(MUTATION_MAPPINGS).getAll(compoundPrefixRange(mutationPartitionKey(receiver))));
|
|
389
|
+
await transactionDone(transaction);
|
|
390
|
+
const handles = new Map();
|
|
391
|
+
for (const value of stored) {
|
|
392
|
+
const record = decodeClientRefMapping(value);
|
|
393
|
+
if (record !== undefined)
|
|
394
|
+
handles.set(record.clientRef, record.entityId);
|
|
395
|
+
}
|
|
396
|
+
return handles;
|
|
397
|
+
}
|
|
398
|
+
async receipt(receiver, invocation) {
|
|
399
|
+
this.assertScopeLive(receiver);
|
|
400
|
+
const transaction = this.database.transaction(MUTATION_RECEIPTS, "readonly");
|
|
401
|
+
const stored = await requestResult(transaction.objectStore(MUTATION_RECEIPTS).get([
|
|
402
|
+
mutationPartitionKey(receiver),
|
|
403
|
+
invocation,
|
|
404
|
+
]));
|
|
405
|
+
await transactionDone(transaction);
|
|
406
|
+
return stored === undefined ? undefined : decodeReceipt(stored);
|
|
407
|
+
}
|
|
408
|
+
async clientRefs(receiver) {
|
|
409
|
+
this.assertScopeLive(receiver);
|
|
410
|
+
const transaction = this.database.transaction(MUTATION_CLIENT_REFS, "readonly");
|
|
411
|
+
const stored = await requestResult(transaction.objectStore(MUTATION_CLIENT_REFS).getAll(compoundPrefixRange(mutationPartitionKey(receiver))));
|
|
412
|
+
await transactionDone(transaction);
|
|
413
|
+
return Object.freeze(stored.map(decodeClientRef).filter((record) => record !== undefined));
|
|
414
|
+
}
|
|
415
|
+
async recordMappings(receiver, invocation, mappings, mappedAt = Date.now()) {
|
|
416
|
+
const scopeKey = replicaScopeKey(receiver);
|
|
417
|
+
const partition = mutationPartitionKey(receiver);
|
|
418
|
+
const observed = await this.preflightScope(receiver);
|
|
419
|
+
const transaction = this.database.transaction([MUTATION_MAPPINGS, MUTATION_CLIENT_REFS, REPLICA_GENERATIONS_STORE], "readwrite");
|
|
420
|
+
try {
|
|
421
|
+
await this.fenceScope(transaction, scopeKey, observed, undefined);
|
|
422
|
+
await this.stageMappings(transaction, partition, invocation, mappings, mappedAt);
|
|
423
|
+
}
|
|
424
|
+
catch (error) {
|
|
425
|
+
await abortTransaction(transaction);
|
|
426
|
+
throw error;
|
|
427
|
+
}
|
|
428
|
+
await commitTransaction(transaction);
|
|
429
|
+
this.announceReceiver("layer", receiver);
|
|
430
|
+
}
|
|
431
|
+
async acknowledge(record, acknowledgement, acknowledgedAt = Date.now()) {
|
|
432
|
+
const scopeKey = replicaScopeKey(record.receiver);
|
|
433
|
+
if (scopeKey !== record.scope) {
|
|
434
|
+
throw new OutboxRecordInvalid({
|
|
435
|
+
reason: "the acknowledged record's receiver is outside its own scope",
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
const observed = await this.preflightScope(record.receiver);
|
|
439
|
+
const transaction = this.database.transaction([
|
|
440
|
+
MUTATION_OUTBOX,
|
|
441
|
+
MUTATION_QUEUES,
|
|
442
|
+
MUTATION_RECEIPTS,
|
|
443
|
+
MUTATION_MAPPINGS,
|
|
444
|
+
MUTATION_CLIENT_REFS,
|
|
445
|
+
MUTATION_LAYERS,
|
|
446
|
+
REPLICA_GENERATIONS_STORE,
|
|
447
|
+
], "readwrite");
|
|
448
|
+
try {
|
|
449
|
+
await this.fenceScope(transaction, scopeKey, observed, undefined);
|
|
450
|
+
await this.fenceLeadership(transaction);
|
|
451
|
+
const receipt = await this.stageAcknowledgement(transaction, record, acknowledgement, acknowledgedAt);
|
|
452
|
+
await this.boundaries.checkpoint("outbox.acknowledge");
|
|
453
|
+
this.assertScopeLive(record.receiver);
|
|
454
|
+
await commitTransaction(transaction);
|
|
455
|
+
this.announceReceiver("receipt", record.receiver);
|
|
456
|
+
this.announceReceiver("layer", record.receiver);
|
|
457
|
+
return receipt;
|
|
458
|
+
}
|
|
459
|
+
catch (error) {
|
|
460
|
+
await abortTransaction(transaction);
|
|
461
|
+
throw error;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
async stageAcknowledgement(transaction, record, acknowledgement, acknowledgedAt) {
|
|
465
|
+
const receipts = transaction.objectStore(MUTATION_RECEIPTS);
|
|
466
|
+
const key = [record.partition, record.invocation];
|
|
467
|
+
const [stored, cursor] = await Promise.all([
|
|
468
|
+
requestResult(receipts.get(key)),
|
|
469
|
+
requestResult(transaction.objectStore(MUTATION_QUEUES).get(record.partition)),
|
|
470
|
+
]);
|
|
471
|
+
const decodedCursor = cursor === undefined ? undefined : decodeQueueCursor(cursor);
|
|
472
|
+
if (cursor !== undefined && decodedCursor === undefined) {
|
|
473
|
+
throw new OutboxRecordInvalid({
|
|
474
|
+
reason: "the durable queue cursor of this receiver is unreadable",
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
const activation = decodedCursor?.activation ?? 0;
|
|
478
|
+
const current = stored === undefined ? undefined : decodeReceipt(stored);
|
|
479
|
+
if (stored !== undefined && current === undefined) {
|
|
480
|
+
throw new OutboxRecordInvalid({
|
|
481
|
+
reason: "the durable receipt of this invocation is unreadable",
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
if (current === undefined) {
|
|
485
|
+
throw new OutboxRecordInvalid({
|
|
486
|
+
reason: "no durable receipt exists for this invocation",
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
const next = acknowledgement._tag === "Committed"
|
|
490
|
+
? buildReceipt({
|
|
491
|
+
partition: record.partition,
|
|
492
|
+
invocation: record.invocation,
|
|
493
|
+
scope: current.scope,
|
|
494
|
+
state: "committed",
|
|
495
|
+
observation: "unobserved",
|
|
496
|
+
activation,
|
|
497
|
+
output: acknowledgement.output,
|
|
498
|
+
mappings: acknowledgement.mappings,
|
|
499
|
+
failure: null,
|
|
500
|
+
updatedAt: acknowledgedAt,
|
|
501
|
+
})
|
|
502
|
+
: buildReceipt({
|
|
503
|
+
partition: record.partition,
|
|
504
|
+
invocation: record.invocation,
|
|
505
|
+
scope: current.scope,
|
|
506
|
+
state: "rejected",
|
|
507
|
+
observation: null,
|
|
508
|
+
activation: 0,
|
|
509
|
+
output: null,
|
|
510
|
+
mappings: [],
|
|
511
|
+
failure: { code: acknowledgement.code },
|
|
512
|
+
updatedAt: acknowledgedAt,
|
|
513
|
+
});
|
|
514
|
+
if (current.state !== "queued") {
|
|
515
|
+
if (current.state !== next.state || current.failure?.code !== next.failure?.code ||
|
|
516
|
+
!sameMappings(current.mappings, next.mappings) ||
|
|
517
|
+
!sameReceiptOutput(current.output, next.output)) {
|
|
518
|
+
throw new OutboxInvocationConflict({
|
|
519
|
+
invocation: record.invocation,
|
|
520
|
+
partition: record.partition,
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
transaction.objectStore(MUTATION_OUTBOX).delete([
|
|
524
|
+
record.partition,
|
|
525
|
+
record.sequence,
|
|
526
|
+
]);
|
|
527
|
+
await this.stageLayerOutcome(transaction, record, current.state, current.activation);
|
|
528
|
+
return current;
|
|
529
|
+
}
|
|
530
|
+
if (acknowledgement._tag === "Committed") {
|
|
531
|
+
const mapped = new Set(acknowledgement.mappings.map((mapping) => mapping.clientRef));
|
|
532
|
+
for (const allocation of record.allocations) {
|
|
533
|
+
if (!mapped.has(allocation.clientRef)) {
|
|
534
|
+
throw new ClientRefMappingRefused({
|
|
535
|
+
partition: record.partition,
|
|
536
|
+
clientRef: allocation.clientRef,
|
|
537
|
+
reason: "slot-unmapped",
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
await this.stageMappings(transaction, record.partition, record.invocation, acknowledgement.mappings, acknowledgedAt);
|
|
542
|
+
}
|
|
543
|
+
receipts.put(next);
|
|
544
|
+
transaction.objectStore(MUTATION_OUTBOX).delete([
|
|
545
|
+
record.partition,
|
|
546
|
+
record.sequence,
|
|
547
|
+
]);
|
|
548
|
+
await this.stageLayerOutcome(transaction, record, next.state, next.activation);
|
|
549
|
+
if (acknowledgement._tag === "Rejected") {
|
|
550
|
+
await this.cascadeRejection(transaction, record, acknowledgedAt);
|
|
551
|
+
}
|
|
552
|
+
return next;
|
|
553
|
+
}
|
|
554
|
+
async stageLayerOutcome(transaction, record, state, activation) {
|
|
555
|
+
const layers = transaction.objectStore(MUTATION_LAYERS);
|
|
556
|
+
const key = [record.partition, record.sequence];
|
|
557
|
+
if (state === "rejected") {
|
|
558
|
+
layers.delete(key);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
const stored = await requestResult(layers.get(key));
|
|
562
|
+
if (stored === undefined)
|
|
563
|
+
return;
|
|
564
|
+
const layer = decodeOptimisticLayer(stored);
|
|
565
|
+
if (layer === undefined)
|
|
566
|
+
return;
|
|
567
|
+
if (layer.state === "committed-unobserved" && layer.activation === activation)
|
|
568
|
+
return;
|
|
569
|
+
layers.put(withLayerState(layer, "committed-unobserved", activation));
|
|
570
|
+
}
|
|
571
|
+
async cascadeRejection(transaction, rejected, acknowledgedAt) {
|
|
572
|
+
const unresolvable = new Set(rejected.allocations.map((allocation) => allocation.clientRef));
|
|
573
|
+
if (unresolvable.size === 0)
|
|
574
|
+
return;
|
|
575
|
+
const outbox = transaction.objectStore(MUTATION_OUTBOX);
|
|
576
|
+
const receipts = transaction.objectStore(MUTATION_RECEIPTS);
|
|
577
|
+
const stored = await requestResult(outbox.getAll(compoundPrefixRange(rejected.partition)));
|
|
578
|
+
const pending = stored
|
|
579
|
+
.map(decodeOutboxRecord)
|
|
580
|
+
.filter((candidate) => candidate !== undefined && candidate.invocation !== rejected.invocation);
|
|
581
|
+
for (;;) {
|
|
582
|
+
const next = pending.find((candidate) => outboxDependencies(candidate).some((ref) => unresolvable.has(ref)));
|
|
583
|
+
if (next === undefined)
|
|
584
|
+
return;
|
|
585
|
+
pending.splice(pending.indexOf(next), 1);
|
|
586
|
+
for (const allocation of next.allocations) {
|
|
587
|
+
unresolvable.add(allocation.clientRef);
|
|
588
|
+
}
|
|
589
|
+
receipts.put(buildReceipt({
|
|
590
|
+
partition: next.partition,
|
|
591
|
+
invocation: next.invocation,
|
|
592
|
+
scope: next.scope,
|
|
593
|
+
state: "rejected",
|
|
594
|
+
observation: null,
|
|
595
|
+
activation: 0,
|
|
596
|
+
output: null,
|
|
597
|
+
mappings: [],
|
|
598
|
+
failure: { code: "dependency_rejected" },
|
|
599
|
+
updatedAt: acknowledgedAt,
|
|
600
|
+
}));
|
|
601
|
+
outbox.delete([next.partition, next.sequence]);
|
|
602
|
+
transaction.objectStore(MUTATION_LAYERS).delete([next.partition, next.sequence]);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
async observationState(receiver) {
|
|
606
|
+
this.assertScopeLive(receiver);
|
|
607
|
+
const partition = mutationPartitionKey(receiver);
|
|
608
|
+
const transaction = this.database.transaction([MUTATION_QUEUES, MUTATION_RECEIPTS], "readonly");
|
|
609
|
+
const [cursor, stored] = await Promise.all([
|
|
610
|
+
requestResult(transaction.objectStore(MUTATION_QUEUES).get(partition)),
|
|
611
|
+
requestResult(transaction.objectStore(MUTATION_RECEIPTS).getAll(compoundPrefixRange(partition))),
|
|
612
|
+
]);
|
|
613
|
+
await transactionDone(transaction);
|
|
614
|
+
const unobserved = [];
|
|
615
|
+
for (const value of stored) {
|
|
616
|
+
const receipt = decodeReceipt(value);
|
|
617
|
+
if (receipt === undefined)
|
|
618
|
+
continue;
|
|
619
|
+
const pending = unobservedReceiptOf(receipt);
|
|
620
|
+
if (pending !== undefined)
|
|
621
|
+
unobserved.push(pending);
|
|
622
|
+
}
|
|
623
|
+
unobserved.sort((left, right) => left.activation - right.activation ||
|
|
624
|
+
(left.invocation < right.invocation ? -1 : left.invocation > right.invocation ? 1 : 0));
|
|
625
|
+
const decoded = cursor === undefined ? undefined : decodeQueueCursor(cursor);
|
|
626
|
+
if (cursor !== undefined && decoded === undefined) {
|
|
627
|
+
throw new OutboxRecordInvalid({
|
|
628
|
+
reason: "the durable queue cursor of this receiver is unreadable",
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
return Object.freeze({
|
|
632
|
+
partition,
|
|
633
|
+
receiver,
|
|
634
|
+
activation: decoded?.activation ?? 0,
|
|
635
|
+
unobserved: Object.freeze(unobserved),
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
async beginActivation(receiver) {
|
|
639
|
+
const scopeKey = replicaScopeKey(receiver);
|
|
640
|
+
const partition = mutationPartitionKey(receiver);
|
|
641
|
+
const observed = await this.preflightScope(receiver);
|
|
642
|
+
const transaction = this.database.transaction([MUTATION_QUEUES, REPLICA_GENERATIONS_STORE], "readwrite");
|
|
643
|
+
try {
|
|
644
|
+
await this.fenceScope(transaction, scopeKey, observed, undefined);
|
|
645
|
+
const queues = transaction.objectStore(MUTATION_QUEUES);
|
|
646
|
+
const stored = await requestResult(queues.get(partition));
|
|
647
|
+
const cursor = stored === undefined ? undefined : decodeQueueCursor(stored);
|
|
648
|
+
if (stored !== undefined && cursor === undefined) {
|
|
649
|
+
throw new OutboxRecordInvalid({
|
|
650
|
+
reason: "the durable queue cursor of this receiver is unreadable",
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
const activation = (cursor?.activation ?? 0) + 1;
|
|
654
|
+
queues.put(buildQueueCursor({
|
|
655
|
+
partition,
|
|
656
|
+
scope: scopeKey,
|
|
657
|
+
receiver: cursor?.receiver ?? receiver,
|
|
658
|
+
nextSequence: cursor?.nextSequence ?? 1,
|
|
659
|
+
sealing: cursor?.sealing ?? null,
|
|
660
|
+
activation,
|
|
661
|
+
updatedAt: Date.now(),
|
|
662
|
+
}));
|
|
663
|
+
await this.boundaries.checkpoint("outbox.activation");
|
|
664
|
+
this.assertScopeLive(receiver);
|
|
665
|
+
await commitTransaction(transaction);
|
|
666
|
+
this.announceReceiver("fence", receiver);
|
|
667
|
+
return activation;
|
|
668
|
+
}
|
|
669
|
+
catch (error) {
|
|
670
|
+
await abortTransaction(transaction);
|
|
671
|
+
throw error;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
async fenceActivation(receiver, activation, observedAt = Date.now()) {
|
|
675
|
+
if (!Number.isSafeInteger(activation) || activation < 1) {
|
|
676
|
+
throw new OutboxRecordInvalid({
|
|
677
|
+
reason: "an activation fence needs the durable activation it was begun with",
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
const scopeKey = replicaScopeKey(receiver);
|
|
681
|
+
const partition = mutationPartitionKey(receiver);
|
|
682
|
+
const observed = await this.preflightScope(receiver);
|
|
683
|
+
const transaction = this.database.transaction([
|
|
684
|
+
MUTATION_RECEIPTS,
|
|
685
|
+
MUTATION_LAYERS,
|
|
686
|
+
REPLICA_COMMITTED_HEADS_STORE,
|
|
687
|
+
REPLICA_GENERATIONS_STORE,
|
|
688
|
+
], "readwrite");
|
|
689
|
+
try {
|
|
690
|
+
await this.fenceScope(transaction, scopeKey, observed, undefined);
|
|
691
|
+
const confirmed = await confirmCommittedHead(transaction, receiver);
|
|
692
|
+
const receipts = transaction.objectStore(MUTATION_RECEIPTS);
|
|
693
|
+
const layerStore = transaction.objectStore(MUTATION_LAYERS);
|
|
694
|
+
const [stored, layerRows] = await Promise.all([
|
|
695
|
+
requestResult(receipts.getAll(compoundPrefixRange(partition))),
|
|
696
|
+
requestResult(layerStore.getAll(compoundPrefixRange(partition))),
|
|
697
|
+
]);
|
|
698
|
+
const fenced = new Set();
|
|
699
|
+
for (const value of stored) {
|
|
700
|
+
const receipt = decodeReceipt(value);
|
|
701
|
+
if (receipt === undefined || !fencedByActivation(receipt, activation)) {
|
|
702
|
+
continue;
|
|
703
|
+
}
|
|
704
|
+
receipts.put(buildReceipt({
|
|
705
|
+
...receipt,
|
|
706
|
+
observation: "observed",
|
|
707
|
+
updatedAt: observedAt,
|
|
708
|
+
}));
|
|
709
|
+
fenced.add(receipt.invocation);
|
|
710
|
+
}
|
|
711
|
+
let unreadable = 0;
|
|
712
|
+
const remaining = [];
|
|
713
|
+
for (const value of layerRows) {
|
|
714
|
+
const layer = decodeOptimisticLayer(value);
|
|
715
|
+
if (layer === undefined) {
|
|
716
|
+
unreadable += 1;
|
|
717
|
+
continue;
|
|
718
|
+
}
|
|
719
|
+
if (fenced.has(layer.invocation)) {
|
|
720
|
+
layerStore.delete([layer.partition, layer.sequence]);
|
|
721
|
+
continue;
|
|
722
|
+
}
|
|
723
|
+
remaining.push(layer);
|
|
724
|
+
}
|
|
725
|
+
remaining.sort((left, right) => left.sequence - right.sequence);
|
|
726
|
+
await this.boundaries.checkpoint("outbox.fence");
|
|
727
|
+
this.assertScopeLive(receiver);
|
|
728
|
+
await commitTransaction(transaction);
|
|
729
|
+
this.announceReceiver("fence", receiver);
|
|
730
|
+
this.announceReceiver("receipt", receiver);
|
|
731
|
+
return Object.freeze({
|
|
732
|
+
receiver,
|
|
733
|
+
activation,
|
|
734
|
+
fenced: Object.freeze([...fenced]),
|
|
735
|
+
confirmed,
|
|
736
|
+
layers: Object.freeze(remaining),
|
|
737
|
+
unreadable,
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
catch (error) {
|
|
741
|
+
await abortTransaction(transaction);
|
|
742
|
+
throw error;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
async optimisticLayers(receiver) {
|
|
746
|
+
this.assertScopeLive(receiver);
|
|
747
|
+
const transaction = this.database.transaction(MUTATION_LAYERS, "readonly");
|
|
748
|
+
const stored = await requestResult(transaction.objectStore(MUTATION_LAYERS).getAll(compoundPrefixRange(mutationPartitionKey(receiver))));
|
|
749
|
+
await transactionDone(transaction);
|
|
750
|
+
const rows = [];
|
|
751
|
+
let unreadable = 0;
|
|
752
|
+
for (const value of stored) {
|
|
753
|
+
const layer = decodeOptimisticLayer(value);
|
|
754
|
+
if (layer === undefined)
|
|
755
|
+
unreadable += 1;
|
|
756
|
+
else
|
|
757
|
+
rows.push(layer);
|
|
758
|
+
}
|
|
759
|
+
rows.sort((left, right) => left.sequence - right.sequence);
|
|
760
|
+
return Object.freeze({ layers: Object.freeze(rows), unreadable });
|
|
761
|
+
}
|
|
762
|
+
async stageMappings(transaction, partition, invocation, mappings, mappedAt) {
|
|
763
|
+
const store = transaction.objectStore(MUTATION_MAPPINGS);
|
|
764
|
+
const refs = transaction.objectStore(MUTATION_CLIENT_REFS);
|
|
765
|
+
const claims = mappings.map((mapping) => ({
|
|
766
|
+
clientRef: mapping.clientRef,
|
|
767
|
+
entityId: mapping.entityId,
|
|
768
|
+
}));
|
|
769
|
+
for (const claim of claims) {
|
|
770
|
+
const { clientRef: ref, entityId } = claim;
|
|
771
|
+
if (!isClientRef(ref) || !isEntityId(entityId)) {
|
|
772
|
+
throw new ClientRefMappingRefused({
|
|
773
|
+
partition,
|
|
774
|
+
clientRef: String(ref),
|
|
775
|
+
reason: "not-a-ref-pair",
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
const sealing = sealingEpochOf(entityId);
|
|
779
|
+
if (sealing === undefined) {
|
|
780
|
+
throw new ClientRefMappingRefused({
|
|
781
|
+
partition,
|
|
782
|
+
clientRef: ref,
|
|
783
|
+
reason: "unreadable-handle",
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
const key = [partition, ref];
|
|
787
|
+
const [allocation, stored] = await Promise.all([
|
|
788
|
+
requestResult(refs.get(key)),
|
|
789
|
+
requestResult(store.get(key)),
|
|
790
|
+
]);
|
|
791
|
+
if (allocation === undefined || allocation.invocation !== invocation) {
|
|
792
|
+
throw new ClientRefMappingRefused({
|
|
793
|
+
partition,
|
|
794
|
+
clientRef: ref,
|
|
795
|
+
reason: "not-allocated-here",
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
const current = stored === undefined
|
|
799
|
+
? undefined
|
|
800
|
+
: decodeClientRefMapping(stored);
|
|
801
|
+
if (current !== undefined) {
|
|
802
|
+
if (current.invocation !== invocation || current.entityId !== entityId) {
|
|
803
|
+
throw new ClientRefMappingRefused({
|
|
804
|
+
partition,
|
|
805
|
+
clientRef: ref,
|
|
806
|
+
reason: "already-mapped",
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
continue;
|
|
810
|
+
}
|
|
811
|
+
const repaired = buildClientRefMapping({
|
|
812
|
+
partition,
|
|
813
|
+
clientRef: ref,
|
|
814
|
+
entityId,
|
|
815
|
+
sealing,
|
|
816
|
+
invocation,
|
|
817
|
+
mappedAt,
|
|
818
|
+
});
|
|
819
|
+
if (stored === undefined)
|
|
820
|
+
store.add(repaired);
|
|
821
|
+
else
|
|
822
|
+
store.put(repaired);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
//# sourceMappingURL=outbox-storage.js.map
|