ramosedb 0.0.1 → 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 +102 -4
|
@@ -0,0 +1,1130 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Result from "effect/Result";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
import { InvalidRequest, OperationRejected, Unauthorized, } from "../../db/Errors.js";
|
|
5
|
+
import { cloneBindingValue } from "../../db/Binding.js";
|
|
6
|
+
import { sha256Hex } from "../core/bytes.js";
|
|
7
|
+
import { isQueryObject, tryLowerQueryObject, } from "../../db/query/query.js";
|
|
8
|
+
import { lowerAttr } from "../../db/attrRef.js";
|
|
9
|
+
import { asLookupRef, lowerEntityArg, lowerWriteValue, tempid, } from "../../db/entityArg.js";
|
|
10
|
+
import { markEngineTypeAssertion } from "../core/tx-provenance.js";
|
|
11
|
+
import { Index } from "../core/datom.js";
|
|
12
|
+
import { toWireDatom } from "../core/log.js";
|
|
13
|
+
import { query } from "../core/query/engine.js";
|
|
14
|
+
import { pull } from "../core/query/pull.js";
|
|
15
|
+
import { RAMOSE_TYPE, RAMOSE_TYPE_IDENT } from "../core/schema.js";
|
|
16
|
+
import { toJson } from "../core/json.js";
|
|
17
|
+
import { requireCatalogKey, requireUnitHash, } from "./deployed.js";
|
|
18
|
+
import { resolveDeployedCatalogDefinition, } from "./definitions.js";
|
|
19
|
+
import { operationGrantAllows } from "./operation-grant.js";
|
|
20
|
+
import { canonicalizeJson } from "./canonical-json.js";
|
|
21
|
+
import { constructAuthorizedRequestContext, } from "./request.js";
|
|
22
|
+
import { compileReadFilter, uniqueCanonicalTypeName, } from "./read-filter.js";
|
|
23
|
+
import { allocatedEids, extractAllocations, sealAllocationMappings, } from "./entity-targets.js";
|
|
24
|
+
const REPLAY_AUTHORIZATION_DIGEST_DOMAIN = "ramose/operation-replay-authorization/v1\0";
|
|
25
|
+
const UTF8 = new TextEncoder();
|
|
26
|
+
const OPERATION_ADMISSION = Symbol("ramose.operation-admission");
|
|
27
|
+
export const resolveOperationCatalog = Effect.fn("Authorization.resolveOperationCatalog")(function* (runtime, invocation) {
|
|
28
|
+
const deployed = resolveDeployedCatalogDefinition(runtime.catalogs, {
|
|
29
|
+
database: invocation.database,
|
|
30
|
+
catalogKey: invocation.catalogKey,
|
|
31
|
+
unitHash: invocation.unitHash,
|
|
32
|
+
});
|
|
33
|
+
if (Result.isFailure(deployed))
|
|
34
|
+
return yield* deny();
|
|
35
|
+
return Object.freeze({ deployed: deployed.success });
|
|
36
|
+
});
|
|
37
|
+
export class OperationRuntimeFault extends Error {
|
|
38
|
+
stage;
|
|
39
|
+
detail;
|
|
40
|
+
constructor(stage, detail) {
|
|
41
|
+
super("operation execution failed");
|
|
42
|
+
this.name = "OperationRuntimeFault";
|
|
43
|
+
this.stage = stage;
|
|
44
|
+
this.detail = detail;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export const opaqueOperationDenial = () => new Unauthorized({ status: 403 });
|
|
48
|
+
const deny = opaqueOperationDenial;
|
|
49
|
+
const operationLabel = (descriptor) => `${descriptor.id.owner.name}/${descriptor.id.localName}`;
|
|
50
|
+
const rejected = (descriptor, message, step, reason) => new OperationRejected({
|
|
51
|
+
message,
|
|
52
|
+
operation: operationLabel(descriptor),
|
|
53
|
+
...(step === undefined ? {} : { step }),
|
|
54
|
+
...(reason === undefined ? {} : { reason }),
|
|
55
|
+
});
|
|
56
|
+
const requireFreshAuthorization = (runtime, expiresAtSeconds, descriptor) => {
|
|
57
|
+
let now;
|
|
58
|
+
try {
|
|
59
|
+
now = runtime.now();
|
|
60
|
+
}
|
|
61
|
+
catch (cause) {
|
|
62
|
+
throw new OperationRuntimeFault("clock", cause);
|
|
63
|
+
}
|
|
64
|
+
if (!Number.isFinite(now)) {
|
|
65
|
+
throw rejected(descriptor, "authoritative operation clock is invalid");
|
|
66
|
+
}
|
|
67
|
+
if (!Number.isSafeInteger(expiresAtSeconds) || expiresAtSeconds * 1_000 <= now) {
|
|
68
|
+
throw deny();
|
|
69
|
+
}
|
|
70
|
+
return now;
|
|
71
|
+
};
|
|
72
|
+
const descriptorKey = (owner, localName) => `${owner.kind}\0${owner.name}\0${localName}`;
|
|
73
|
+
const bindingFor = (definition, owner, localName) => definition.operations.find((binding) => descriptorKey(binding.descriptor.id.owner, binding.descriptor.id.localName) ===
|
|
74
|
+
descriptorKey(owner, localName));
|
|
75
|
+
export const deployedOperationVersion = (resolved, owner, localName) => bindingFor(resolved.deployed.definition, owner, localName)?.descriptor.version;
|
|
76
|
+
export const deployedOperationOutputWireShape = (resolved, owner, localName) => bindingFor(resolved.deployed.definition, owner, localName)?.outputWireShape;
|
|
77
|
+
export const deployedOperationInputWireShape = (resolved, owner, localName) => bindingFor(resolved.deployed.definition, owner, localName)?.inputWireShape;
|
|
78
|
+
const fieldIdent = (field) => `:${field.id.owner.name}/${field.id.localName}`;
|
|
79
|
+
const validateOperationFieldValue = (definition, ident, value) => {
|
|
80
|
+
try {
|
|
81
|
+
definition.validateFieldValue(ident, value);
|
|
82
|
+
}
|
|
83
|
+
catch (cause) {
|
|
84
|
+
if (cause instanceof Schema.SchemaError) {
|
|
85
|
+
throw new InvalidRequest({
|
|
86
|
+
message: `invalid operation value for ${ident}: ${cause.message}`,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
throw new OperationRuntimeFault("field", cause);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const fieldTables = (definition) => {
|
|
93
|
+
const byIdent = new Map();
|
|
94
|
+
for (const field of definition.unit.catalog.fields)
|
|
95
|
+
byIdent.set(fieldIdent(field), field);
|
|
96
|
+
return byIdent;
|
|
97
|
+
};
|
|
98
|
+
const typeName = async (db, eid) => {
|
|
99
|
+
const datoms = await db.datomsArray(Index.EAVT, { e: eid, a: RAMOSE_TYPE });
|
|
100
|
+
return uniqueCanonicalTypeName(datoms);
|
|
101
|
+
};
|
|
102
|
+
const typeCompatible = (definition, owner, concrete) => owner.kind === "entity"
|
|
103
|
+
? concrete === owner.name
|
|
104
|
+
: definition.composition.transitiveTraits(`:${concrete}`).includes(`:${owner.name}`);
|
|
105
|
+
const refCompatible = (definition, target, concrete, selfType) => {
|
|
106
|
+
switch (target._tag) {
|
|
107
|
+
case "entity":
|
|
108
|
+
return concrete === target.entity.name;
|
|
109
|
+
case "trait":
|
|
110
|
+
return definition.composition.transitiveTraits(`:${concrete}`).includes(`:${target.trait.name}`);
|
|
111
|
+
case "self":
|
|
112
|
+
return selfType !== undefined && concrete === selfType;
|
|
113
|
+
case "untargeted":
|
|
114
|
+
return definition.composition.isEntityIdent(`:${concrete}`);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const resolveVisibleTarget = async (context, target) => {
|
|
118
|
+
const eid = typeof target === "number" ? target : await context.filteredDb.entid(target);
|
|
119
|
+
if (eid === undefined || !(await context.filteredDb.exists(eid)))
|
|
120
|
+
return undefined;
|
|
121
|
+
const concrete = await typeName(context.currentDb, eid);
|
|
122
|
+
return concrete === undefined ? undefined : { eid, type: concrete };
|
|
123
|
+
};
|
|
124
|
+
const sameValue = (left, right) => {
|
|
125
|
+
if (Object.is(left, right))
|
|
126
|
+
return true;
|
|
127
|
+
if (left instanceof Date && right instanceof Date)
|
|
128
|
+
return left.getTime() === right.getTime();
|
|
129
|
+
if (left instanceof Uint8Array && right instanceof Uint8Array) {
|
|
130
|
+
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
131
|
+
}
|
|
132
|
+
if (Array.isArray(left) && Array.isArray(right)) {
|
|
133
|
+
return left.length === right.length && left.every((value, index) => sameValue(value, right[index]));
|
|
134
|
+
}
|
|
135
|
+
return false;
|
|
136
|
+
};
|
|
137
|
+
const isPlainRecord = (value) => {
|
|
138
|
+
const prototype = Object.getPrototypeOf(value);
|
|
139
|
+
return prototype === Object.prototype || prototype === null;
|
|
140
|
+
};
|
|
141
|
+
const sameTransportValue = (left, right, seen = new WeakMap()) => {
|
|
142
|
+
if (sameValue(left, right))
|
|
143
|
+
return true;
|
|
144
|
+
if (typeof left !== "object" || left === null ||
|
|
145
|
+
typeof right !== "object" || right === null)
|
|
146
|
+
return false;
|
|
147
|
+
if (!(Array.isArray(left) || isPlainRecord(left)) ||
|
|
148
|
+
!(Array.isArray(right) || isPlainRecord(right)) ||
|
|
149
|
+
Array.isArray(left) !== Array.isArray(right))
|
|
150
|
+
return false;
|
|
151
|
+
const prior = seen.get(left);
|
|
152
|
+
if (prior !== undefined)
|
|
153
|
+
return prior === right;
|
|
154
|
+
seen.set(left, right);
|
|
155
|
+
if (Array.isArray(left) && Array.isArray(right)) {
|
|
156
|
+
return left.length === right.length &&
|
|
157
|
+
left.every((value, index) => sameTransportValue(value, right[index], seen));
|
|
158
|
+
}
|
|
159
|
+
const leftRecord = left;
|
|
160
|
+
const rightRecord = right;
|
|
161
|
+
const leftKeys = Object.keys(leftRecord);
|
|
162
|
+
const rightKeys = Object.keys(rightRecord);
|
|
163
|
+
return leftKeys.length === rightKeys.length &&
|
|
164
|
+
leftKeys.every((key) => Object.hasOwn(rightRecord, key) &&
|
|
165
|
+
sameTransportValue(leftRecord[key], rightRecord[key], seen));
|
|
166
|
+
};
|
|
167
|
+
const snapshotStoredValue = (descriptor, value) => {
|
|
168
|
+
try {
|
|
169
|
+
return cloneBindingValue(value);
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
throw rejected(descriptor, "operation produced an unsupported stored value");
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const attrsOf = (value, descriptor) => {
|
|
176
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
177
|
+
throw rejected(descriptor, "operation write attributes must be an object");
|
|
178
|
+
}
|
|
179
|
+
return value;
|
|
180
|
+
};
|
|
181
|
+
const runtimeEntity = (value) => {
|
|
182
|
+
if (typeof value !== "object" || value === null)
|
|
183
|
+
return undefined;
|
|
184
|
+
const candidate = value;
|
|
185
|
+
return typeof candidate.ns === "string" ? candidate : undefined;
|
|
186
|
+
};
|
|
187
|
+
const deployedFieldFromArgument = (definition, argument, descriptor) => {
|
|
188
|
+
let ident;
|
|
189
|
+
try {
|
|
190
|
+
ident = lowerAttr(argument);
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
throw rejected(descriptor, "operation used an invalid field");
|
|
194
|
+
}
|
|
195
|
+
const field = fieldTables(definition).get(ident);
|
|
196
|
+
if (field === undefined)
|
|
197
|
+
throw rejected(descriptor, "operation used an undeployed field");
|
|
198
|
+
return field;
|
|
199
|
+
};
|
|
200
|
+
const fieldFromArgument = (definition, entityName, argument, descriptor) => {
|
|
201
|
+
const field = deployedFieldFromArgument(definition, argument, descriptor);
|
|
202
|
+
try {
|
|
203
|
+
definition.requireFieldRuntime(entityName, fieldIdent(field));
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
throw rejected(descriptor, "operation field is incompatible with its entity definition");
|
|
207
|
+
}
|
|
208
|
+
return field;
|
|
209
|
+
};
|
|
210
|
+
const isFieldMutable = (definition, entityName, field) => definition.requireFieldRuntime(entityName, fieldIdent(field)).fixed._tag === "mutable";
|
|
211
|
+
const isMany = (entity, key) => entity.fields?.[key]?.cardinality === "many";
|
|
212
|
+
const prepareCreationInput = (entity, values) => {
|
|
213
|
+
const prepared = {};
|
|
214
|
+
const deferredReferenceKeys = new Set();
|
|
215
|
+
for (const [key, value] of Object.entries(values)) {
|
|
216
|
+
if (value !== undefined && entity.fields?.[key]?.valueType === "ref") {
|
|
217
|
+
prepared[key] = entity.fields[key]?.cardinality === "many" && Array.isArray(value)
|
|
218
|
+
? value.map(lowerWriteValue)
|
|
219
|
+
: lowerWriteValue(value);
|
|
220
|
+
deferredReferenceKeys.add(key);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
prepared[key] = value;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
values: prepared,
|
|
228
|
+
deferredReferenceKeys,
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
const uniqueLookup = (entity, attrs) => {
|
|
232
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
233
|
+
if (value === undefined || entity.fields?.[key]?.unique !== "upsert")
|
|
234
|
+
continue;
|
|
235
|
+
const ident = entity.fields[key]?.ident;
|
|
236
|
+
if (typeof ident === "string")
|
|
237
|
+
return [ident, lowerWriteValue(value)];
|
|
238
|
+
}
|
|
239
|
+
return undefined;
|
|
240
|
+
};
|
|
241
|
+
const createCollector = (args) => {
|
|
242
|
+
const { definition, descriptor } = args;
|
|
243
|
+
const tx = [];
|
|
244
|
+
const refs = [];
|
|
245
|
+
const deferredFields = [];
|
|
246
|
+
const subjectChecks = [];
|
|
247
|
+
const deployedDefinitions = new Map(args.binding.entityDefinitions.map((entity) => [entity.ns, entity]));
|
|
248
|
+
const generatedPrefix = "__ramose.operation/";
|
|
249
|
+
let nextTempid = 0;
|
|
250
|
+
const requireDefinition = (value) => {
|
|
251
|
+
const entity = runtimeEntity(value);
|
|
252
|
+
const deployed = entity === undefined ? undefined : deployedDefinitions.get(entity.ns);
|
|
253
|
+
if (deployed === undefined) {
|
|
254
|
+
throw rejected(descriptor, "operation used an undeployed entity definition");
|
|
255
|
+
}
|
|
256
|
+
return deployed;
|
|
257
|
+
};
|
|
258
|
+
const requireOwnerField = (argument) => {
|
|
259
|
+
const concrete = args.target?.type ??
|
|
260
|
+
(descriptor.id.owner.kind === "entity" ? descriptor.id.owner.name : undefined);
|
|
261
|
+
const field = concrete === undefined
|
|
262
|
+
? deployedFieldFromArgument(definition, argument, descriptor)
|
|
263
|
+
: fieldFromArgument(definition, concrete, argument, descriptor);
|
|
264
|
+
const owner = field.id.owner;
|
|
265
|
+
const allowed = owner.kind === "entity"
|
|
266
|
+
? descriptor.id.owner.kind === "entity" && owner.name === descriptor.id.owner.name
|
|
267
|
+
: owner.name === descriptor.id.owner.name ||
|
|
268
|
+
definition.composition.transitiveTraits(`:${descriptor.id.owner.name}`).includes(`:${owner.name}`) ||
|
|
269
|
+
(descriptor.id.owner.kind === "entity" &&
|
|
270
|
+
definition.composition.transitiveTraits(`:${descriptor.id.owner.name}`).includes(`:${owner.name}`));
|
|
271
|
+
if (!allowed)
|
|
272
|
+
throw rejected(descriptor, "operation used a field outside its owner");
|
|
273
|
+
if (concrete !== undefined && !isFieldMutable(definition, concrete, field)) {
|
|
274
|
+
throw rejected(descriptor, "operation cannot mutate an engine-owned fixed field");
|
|
275
|
+
}
|
|
276
|
+
return field;
|
|
277
|
+
};
|
|
278
|
+
const appendWrite = (kind, eid, field, value, hasValue = true, deferConcreteField = false) => {
|
|
279
|
+
const ident = fieldIdent(field);
|
|
280
|
+
const capturedEid = snapshotStoredValue(descriptor, lowerEntityArg(eid));
|
|
281
|
+
const loweredValue = hasValue ? lowerWriteValue(value) : undefined;
|
|
282
|
+
const capturedValue = hasValue
|
|
283
|
+
? snapshotStoredValue(descriptor, loweredValue)
|
|
284
|
+
: undefined;
|
|
285
|
+
if (deferConcreteField) {
|
|
286
|
+
deferredFields.push({ source: capturedEid, field });
|
|
287
|
+
}
|
|
288
|
+
if (hasValue && field.valueType !== "ref") {
|
|
289
|
+
validateOperationFieldValue(definition, ident, loweredValue);
|
|
290
|
+
}
|
|
291
|
+
if (hasValue && field.valueType === "ref") {
|
|
292
|
+
refs.push({
|
|
293
|
+
source: capturedEid,
|
|
294
|
+
field,
|
|
295
|
+
target: capturedValue,
|
|
296
|
+
requireTarget: kind !== "retract",
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
if (kind === "retract") {
|
|
300
|
+
tx.push(hasValue
|
|
301
|
+
? [":db/retract", capturedEid, ident, capturedValue]
|
|
302
|
+
: [":db/retract", capturedEid, ident]);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
tx.push([
|
|
306
|
+
kind === "add" ? ":db/add" : ":db/update",
|
|
307
|
+
capturedEid,
|
|
308
|
+
ident,
|
|
309
|
+
capturedValue,
|
|
310
|
+
]);
|
|
311
|
+
};
|
|
312
|
+
const makeHandle = (eid, resolveField, deferConcreteField = false, expectedOwner) => {
|
|
313
|
+
const capturedEid = snapshotStoredValue(descriptor, lowerEntityArg(eid));
|
|
314
|
+
const rememberSubject = () => {
|
|
315
|
+
if (expectedOwner !== undefined) {
|
|
316
|
+
subjectChecks.push({ source: capturedEid, owner: expectedOwner });
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
return {
|
|
320
|
+
_tag: "TxHandle",
|
|
321
|
+
eid: capturedEid,
|
|
322
|
+
set: (field, value) => {
|
|
323
|
+
appendWrite("add", capturedEid, resolveField(field), value, true, deferConcreteField);
|
|
324
|
+
rememberSubject();
|
|
325
|
+
},
|
|
326
|
+
remove: (field, value) => {
|
|
327
|
+
appendWrite("retract", capturedEid, resolveField(field), value, value !== undefined, deferConcreteField);
|
|
328
|
+
rememberSubject();
|
|
329
|
+
},
|
|
330
|
+
delete: () => {
|
|
331
|
+
rememberSubject();
|
|
332
|
+
tx.push([":db/retractEntity", capturedEid]);
|
|
333
|
+
},
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
const explicitHandle = (entity, eid) => makeHandle(eid, (argument) => {
|
|
337
|
+
const field = fieldFromArgument(definition, entity.ns, argument, descriptor);
|
|
338
|
+
if (!isFieldMutable(definition, entity.ns, field)) {
|
|
339
|
+
throw rejected(descriptor, "operation cannot mutate an engine-owned fixed field");
|
|
340
|
+
}
|
|
341
|
+
return field;
|
|
342
|
+
}, false, { kind: "entity", name: entity.ns });
|
|
343
|
+
const ownerHandle = (eid) => makeHandle(eid, requireOwnerField, descriptor.id.owner.kind === "trait" && args.target === undefined, descriptor.id.owner);
|
|
344
|
+
const addPut = (entity, eid, values, creation) => {
|
|
345
|
+
let resolved;
|
|
346
|
+
if (creation) {
|
|
347
|
+
const prepared = prepareCreationInput(entity, values);
|
|
348
|
+
resolved = definition.resolveCreationValues(entity.ns, prepared.values, { now: args.authoritativeNow }, { deferredReferenceKeys: prepared.deferredReferenceKeys });
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
resolved = values;
|
|
352
|
+
}
|
|
353
|
+
const map = {
|
|
354
|
+
":db/id": snapshotStoredValue(descriptor, lowerEntityArg(eid)),
|
|
355
|
+
};
|
|
356
|
+
if (!creation) {
|
|
357
|
+
subjectChecks.push({
|
|
358
|
+
source: map[":db/id"],
|
|
359
|
+
owner: { kind: "entity", name: entity.ns },
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
map[RAMOSE_TYPE_IDENT] = `:${entity.ns}`;
|
|
363
|
+
markEngineTypeAssertion(map);
|
|
364
|
+
for (const [key, value] of Object.entries(resolved)) {
|
|
365
|
+
if (value === undefined)
|
|
366
|
+
continue;
|
|
367
|
+
const fieldArg = entity.fields?.[key];
|
|
368
|
+
const field = fieldFromArgument(definition, entity.ns, fieldArg, descriptor);
|
|
369
|
+
if (!creation && !isFieldMutable(definition, entity.ns, field)) {
|
|
370
|
+
throw rejected(descriptor, "operation cannot mutate an engine-owned fixed field");
|
|
371
|
+
}
|
|
372
|
+
if (isMany(entity, key) && Array.isArray(value)) {
|
|
373
|
+
for (const item of value)
|
|
374
|
+
appendWrite("add", eid, field, item);
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
const ident = fieldIdent(field);
|
|
378
|
+
const loweredValue = lowerWriteValue(value);
|
|
379
|
+
const capturedValue = snapshotStoredValue(descriptor, loweredValue);
|
|
380
|
+
if (field.valueType === "ref") {
|
|
381
|
+
refs.push({
|
|
382
|
+
source: map[":db/id"],
|
|
383
|
+
field,
|
|
384
|
+
target: capturedValue,
|
|
385
|
+
requireTarget: true,
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
validateOperationFieldValue(definition, ident, loweredValue);
|
|
390
|
+
}
|
|
391
|
+
map[ident] = capturedValue;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
tx.push(map);
|
|
395
|
+
return explicitHandle(entity, eid);
|
|
396
|
+
};
|
|
397
|
+
const put = (definitionArg, a, b) => {
|
|
398
|
+
const entity = requireDefinition(definitionArg);
|
|
399
|
+
const creation = b === undefined || typeof lowerEntityArg(a) === "string";
|
|
400
|
+
const attrs = attrsOf(b === undefined ? a : b, descriptor);
|
|
401
|
+
const eid = b === undefined
|
|
402
|
+
? `${generatedPrefix}${++nextTempid}`
|
|
403
|
+
: lowerEntityArg(a);
|
|
404
|
+
return addPut(entity, eid, attrs, creation);
|
|
405
|
+
};
|
|
406
|
+
const update = (definitionArg, a, b) => {
|
|
407
|
+
const entity = requireDefinition(definitionArg);
|
|
408
|
+
const attrs = attrsOf(b === undefined ? a : b, descriptor);
|
|
409
|
+
const eid = b === undefined ? uniqueLookup(entity, attrs) : lowerEntityArg(a);
|
|
410
|
+
if (eid === undefined) {
|
|
411
|
+
throw rejected(descriptor, 'update map form needs a unique: "upsert" field');
|
|
412
|
+
}
|
|
413
|
+
const capturedEid = snapshotStoredValue(descriptor, lowerEntityArg(eid));
|
|
414
|
+
subjectChecks.push({
|
|
415
|
+
source: capturedEid,
|
|
416
|
+
owner: { kind: "entity", name: entity.ns },
|
|
417
|
+
});
|
|
418
|
+
let wrote = false;
|
|
419
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
420
|
+
if (value === undefined)
|
|
421
|
+
continue;
|
|
422
|
+
const field = fieldFromArgument(definition, entity.ns, entity.fields?.[key], descriptor);
|
|
423
|
+
if (!isFieldMutable(definition, entity.ns, field)) {
|
|
424
|
+
throw rejected(descriptor, "operation cannot mutate an engine-owned fixed field");
|
|
425
|
+
}
|
|
426
|
+
if (isMany(entity, key) && Array.isArray(value)) {
|
|
427
|
+
for (const item of value)
|
|
428
|
+
appendWrite("update", capturedEid, field, item);
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
appendWrite("update", capturedEid, field, value);
|
|
432
|
+
}
|
|
433
|
+
wrote = true;
|
|
434
|
+
}
|
|
435
|
+
if (!wrote)
|
|
436
|
+
tx.push([":db/update", capturedEid]);
|
|
437
|
+
return explicitHandle(entity, capturedEid);
|
|
438
|
+
};
|
|
439
|
+
const principal = Object.freeze({
|
|
440
|
+
eid: args.context.principal.me?.eid ?? null,
|
|
441
|
+
class: args.caller.classes[0] ?? "",
|
|
442
|
+
...(typeof args.caller.claims.sub === "string"
|
|
443
|
+
? { sub: args.caller.claims.sub }
|
|
444
|
+
: {}),
|
|
445
|
+
claims: args.caller.claims,
|
|
446
|
+
});
|
|
447
|
+
const op = {
|
|
448
|
+
principal,
|
|
449
|
+
db: args.database,
|
|
450
|
+
self: args.target === undefined ? undefined : ownerHandle(args.target.eid),
|
|
451
|
+
create: descriptor.id.target === "none" && descriptor.id.owner.kind === "entity"
|
|
452
|
+
? (attrs) => {
|
|
453
|
+
const entity = deployedDefinitions.get(descriptor.id.owner.name);
|
|
454
|
+
if (entity === undefined) {
|
|
455
|
+
throw rejected(descriptor, "operation owner definition is unavailable");
|
|
456
|
+
}
|
|
457
|
+
const eid = `${generatedPrefix}${++nextTempid}`;
|
|
458
|
+
return addPut(entity, eid, attrsOf(attrs, descriptor), true);
|
|
459
|
+
}
|
|
460
|
+
: undefined,
|
|
461
|
+
entity: (...values) => {
|
|
462
|
+
if (values.length === 1)
|
|
463
|
+
return ownerHandle(lowerEntityArg(values[0]));
|
|
464
|
+
if (values.length === 2) {
|
|
465
|
+
const entity = requireDefinition(values[0]);
|
|
466
|
+
return explicitHandle(entity, lowerEntityArg(values[1]));
|
|
467
|
+
}
|
|
468
|
+
throw rejected(descriptor, "operation entity() needs an id or a definition and id");
|
|
469
|
+
},
|
|
470
|
+
tempid: (name) => {
|
|
471
|
+
if (name.startsWith(generatedPrefix)) {
|
|
472
|
+
throw rejected(descriptor, "operation tempid uses a reserved prefix");
|
|
473
|
+
}
|
|
474
|
+
return tempid(name);
|
|
475
|
+
},
|
|
476
|
+
set: (definitionArg, eid, fieldArg, value) => {
|
|
477
|
+
const entity = requireDefinition(definitionArg);
|
|
478
|
+
explicitHandle(entity, lowerEntityArg(eid)).set(fieldArg, value);
|
|
479
|
+
},
|
|
480
|
+
remove: (definitionArg, eid, fieldArg, value) => {
|
|
481
|
+
const entity = requireDefinition(definitionArg);
|
|
482
|
+
explicitHandle(entity, lowerEntityArg(eid)).remove(fieldArg, value);
|
|
483
|
+
},
|
|
484
|
+
delete: (definitionArg, eid) => {
|
|
485
|
+
const entity = requireDefinition(definitionArg);
|
|
486
|
+
explicitHandle(entity, lowerEntityArg(eid)).delete();
|
|
487
|
+
},
|
|
488
|
+
put,
|
|
489
|
+
update,
|
|
490
|
+
query: async (input) => {
|
|
491
|
+
if (!isQueryObject(input)) {
|
|
492
|
+
throw rejected(descriptor, "operation query needs a deployed Query value");
|
|
493
|
+
}
|
|
494
|
+
const lowered = tryLowerQueryObject(input);
|
|
495
|
+
return lowered.finalize(await query(args.context.currentDb, lowered.query));
|
|
496
|
+
},
|
|
497
|
+
pull: async (subject, pattern) => {
|
|
498
|
+
const ref = lowerEntityArg(subject);
|
|
499
|
+
const eid = typeof ref === "number"
|
|
500
|
+
? ref
|
|
501
|
+
: Array.isArray(ref) && asLookupRef(ref) !== undefined
|
|
502
|
+
? await args.context.currentDb.entid(ref)
|
|
503
|
+
: undefined;
|
|
504
|
+
return eid === undefined
|
|
505
|
+
? null
|
|
506
|
+
: pull(args.context.currentDb, eid, pattern);
|
|
507
|
+
},
|
|
508
|
+
};
|
|
509
|
+
return { op, tx, refs, deferredFields, subjectChecks };
|
|
510
|
+
};
|
|
511
|
+
const toOperationOutputJson = (value) => {
|
|
512
|
+
if (value === null || value === undefined)
|
|
513
|
+
return value ?? null;
|
|
514
|
+
if (value instanceof Date || value instanceof Uint8Array)
|
|
515
|
+
return toJson(value);
|
|
516
|
+
if (typeof value === "bigint")
|
|
517
|
+
return Number(value);
|
|
518
|
+
if (Array.isArray(value))
|
|
519
|
+
return value.map(toOperationOutputJson);
|
|
520
|
+
if (value instanceof Set)
|
|
521
|
+
return [...value].map(toOperationOutputJson);
|
|
522
|
+
if (value instanceof Map) {
|
|
523
|
+
const out = Object.create(null);
|
|
524
|
+
for (const [key, item] of value)
|
|
525
|
+
out[String(key)] = toOperationOutputJson(item);
|
|
526
|
+
return out;
|
|
527
|
+
}
|
|
528
|
+
if (typeof value === "object") {
|
|
529
|
+
const out = Object.create(null);
|
|
530
|
+
for (const [key, item] of Object.entries(value)) {
|
|
531
|
+
out[key] = toOperationOutputJson(item);
|
|
532
|
+
}
|
|
533
|
+
return out;
|
|
534
|
+
}
|
|
535
|
+
return value;
|
|
536
|
+
};
|
|
537
|
+
const materializeOutputTransport = (value) => {
|
|
538
|
+
const wire = toOperationOutputJson(value);
|
|
539
|
+
const text = JSON.stringify(wire);
|
|
540
|
+
if (text === undefined) {
|
|
541
|
+
throw new TypeError("operation output is not JSON transportable");
|
|
542
|
+
}
|
|
543
|
+
const materialized = JSON.parse(text);
|
|
544
|
+
if (!sameTransportValue(wire, materialized)) {
|
|
545
|
+
throw new TypeError("operation output changes during JSON transport");
|
|
546
|
+
}
|
|
547
|
+
return materialized;
|
|
548
|
+
};
|
|
549
|
+
const resolveReportLookup = async (report, lookup) => await report.dbAfter.entid(lookup) ?? await report.dbBefore.entid(lookup);
|
|
550
|
+
const resolveOutputHandles = async (shape, value, report) => {
|
|
551
|
+
const resolve = async (input) => {
|
|
552
|
+
const lowered = lowerEntityArg(input);
|
|
553
|
+
if (typeof lowered === "number")
|
|
554
|
+
return lowered;
|
|
555
|
+
if (typeof lowered === "string") {
|
|
556
|
+
const eid = report.tempids[lowered];
|
|
557
|
+
if (eid !== undefined)
|
|
558
|
+
return eid;
|
|
559
|
+
}
|
|
560
|
+
if (Array.isArray(lowered)) {
|
|
561
|
+
const eid = await resolveReportLookup(report, lowered);
|
|
562
|
+
if (eid !== undefined)
|
|
563
|
+
return eid;
|
|
564
|
+
}
|
|
565
|
+
throw new InvalidRequest({ message: "operation output contains an unresolved entity handle" });
|
|
566
|
+
};
|
|
567
|
+
const visit = async (currentShape, current) => {
|
|
568
|
+
if (currentShape._tag === "ref") {
|
|
569
|
+
if (typeof current === "object" && current !== null && !Array.isArray(current) &&
|
|
570
|
+
current._tag !== "TxHandle" &&
|
|
571
|
+
Object.hasOwn(current, "id")) {
|
|
572
|
+
return resolve(current.id);
|
|
573
|
+
}
|
|
574
|
+
return resolve(current);
|
|
575
|
+
}
|
|
576
|
+
if (currentShape._tag === "array" && Array.isArray(current)) {
|
|
577
|
+
return Promise.all(current.map((item) => visit(currentShape.items, item)));
|
|
578
|
+
}
|
|
579
|
+
if (currentShape._tag === "struct" &&
|
|
580
|
+
typeof current === "object" && current !== null && !Array.isArray(current)) {
|
|
581
|
+
const fields = new Map(currentShape.fields.map((field) => [field.key, field.shape]));
|
|
582
|
+
const out = Object.create(Object.getPrototypeOf(current));
|
|
583
|
+
for (const [key, item] of Object.entries(current)) {
|
|
584
|
+
const fieldShape = fields.get(key);
|
|
585
|
+
out[key] = fieldShape === undefined ? item : await visit(fieldShape, item);
|
|
586
|
+
}
|
|
587
|
+
return out;
|
|
588
|
+
}
|
|
589
|
+
return current;
|
|
590
|
+
};
|
|
591
|
+
return visit(shape, value);
|
|
592
|
+
};
|
|
593
|
+
const refPathKey = (path) => JSON.stringify(path);
|
|
594
|
+
const collectAuthoritativeRefSlots = (shape, value, path = [], slots = []) => {
|
|
595
|
+
switch (shape._tag) {
|
|
596
|
+
case "ref":
|
|
597
|
+
if (typeof value === "number")
|
|
598
|
+
slots.push({ path, eid: value, shape });
|
|
599
|
+
return slots;
|
|
600
|
+
case "array":
|
|
601
|
+
if (Array.isArray(value)) {
|
|
602
|
+
value.forEach((item, index) => collectAuthoritativeRefSlots(shape.items, item, [...path, index], slots));
|
|
603
|
+
}
|
|
604
|
+
return slots;
|
|
605
|
+
case "struct":
|
|
606
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
607
|
+
for (const field of shape.fields) {
|
|
608
|
+
if (Object.hasOwn(value, field.key)) {
|
|
609
|
+
collectAuthoritativeRefSlots(field.shape, value[field.key], [...path, field.key], slots);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return slots;
|
|
614
|
+
case "scalar":
|
|
615
|
+
case "opaque":
|
|
616
|
+
return slots;
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
const replayRefExemptions = (fence, shape, value) => {
|
|
620
|
+
const slots = new Map(collectAuthoritativeRefSlots(shape, value).map((slot) => [refPathKey(slot.path), slot]));
|
|
621
|
+
const exemptions = new Map();
|
|
622
|
+
for (const exemption of fence.consumedRefs) {
|
|
623
|
+
const key = refPathKey(exemption.path);
|
|
624
|
+
const slot = slots.get(key);
|
|
625
|
+
if (slot === undefined || slot.eid !== exemption.eid || exemptions.has(key)) {
|
|
626
|
+
throw new OperationRuntimeFault("admission", new Error("durable replay fence does not match operation input refs"));
|
|
627
|
+
}
|
|
628
|
+
exemptions.set(key, exemption);
|
|
629
|
+
}
|
|
630
|
+
return exemptions;
|
|
631
|
+
};
|
|
632
|
+
const validateAuthoritativeRefs = async (definition, shape, value, db, selfType, exemptions, path = []) => {
|
|
633
|
+
switch (shape._tag) {
|
|
634
|
+
case "ref": {
|
|
635
|
+
if (typeof value !== "number") {
|
|
636
|
+
throw new InvalidRequest({ message: "operation ref does not resolve" });
|
|
637
|
+
}
|
|
638
|
+
if (!(await db.exists(value))) {
|
|
639
|
+
const exemption = exemptions?.get(refPathKey(path));
|
|
640
|
+
if (exemption !== undefined && exemption.eid === value &&
|
|
641
|
+
refCompatible(definition, shape.refTarget, exemption.type, selfType))
|
|
642
|
+
return;
|
|
643
|
+
throw new InvalidRequest({ message: "operation ref does not resolve" });
|
|
644
|
+
}
|
|
645
|
+
const concrete = await typeName(db, value);
|
|
646
|
+
if (concrete === undefined || !refCompatible(definition, shape.refTarget, concrete, selfType)) {
|
|
647
|
+
throw new InvalidRequest({ message: "operation ref has an incompatible entity type" });
|
|
648
|
+
}
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
case "array":
|
|
652
|
+
if (Array.isArray(value)) {
|
|
653
|
+
for (let index = 0; index < value.length; index++) {
|
|
654
|
+
await validateAuthoritativeRefs(definition, shape.items, value[index], db, selfType, exemptions, [...path, index]);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
return;
|
|
658
|
+
case "struct":
|
|
659
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
660
|
+
for (const field of shape.fields) {
|
|
661
|
+
if (Object.hasOwn(value, field.key)) {
|
|
662
|
+
await validateAuthoritativeRefs(definition, field.shape, value[field.key], db, selfType, exemptions, [...path, field.key]);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
return;
|
|
667
|
+
case "scalar":
|
|
668
|
+
case "opaque":
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
const observationKey = (observation) => {
|
|
673
|
+
switch (observation._tag) {
|
|
674
|
+
case "type":
|
|
675
|
+
return `type:${observation.eid}`;
|
|
676
|
+
case "field":
|
|
677
|
+
return `field:${observation.eid}:${observation.ident}`;
|
|
678
|
+
case "exists":
|
|
679
|
+
return `exists:${observation.eid}`;
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
const observationReadKey = (observation) => {
|
|
683
|
+
switch (observation._tag) {
|
|
684
|
+
case "type":
|
|
685
|
+
case "exists":
|
|
686
|
+
return Object.freeze({ kind: observation._tag, eid: observation.eid });
|
|
687
|
+
case "field":
|
|
688
|
+
return Object.freeze({
|
|
689
|
+
kind: "field",
|
|
690
|
+
eid: observation.eid,
|
|
691
|
+
ident: observation.ident,
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
const readAuthorizationObservation = async (db, key) => {
|
|
696
|
+
switch (key.kind) {
|
|
697
|
+
case "type": {
|
|
698
|
+
const datoms = await db.datomsArray(Index.EAVT, {
|
|
699
|
+
e: key.eid,
|
|
700
|
+
a: RAMOSE_TYPE,
|
|
701
|
+
});
|
|
702
|
+
return { _tag: "type", eid: key.eid, datoms: datoms.map(toWireDatom) };
|
|
703
|
+
}
|
|
704
|
+
case "exists":
|
|
705
|
+
return { _tag: "exists", eid: key.eid, value: await db.exists(key.eid) };
|
|
706
|
+
case "field": {
|
|
707
|
+
const attribute = db.schema.attr(key.ident);
|
|
708
|
+
const datoms = attribute === undefined
|
|
709
|
+
? []
|
|
710
|
+
: await db.datomsArray(Index.EAVT, { e: key.eid, a: attribute.id });
|
|
711
|
+
return {
|
|
712
|
+
_tag: "field",
|
|
713
|
+
eid: key.eid,
|
|
714
|
+
ident: key.ident,
|
|
715
|
+
attributeId: attribute?.id ?? null,
|
|
716
|
+
datoms: datoms.map(toWireDatom),
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
const hashAuthorizationObservations = async (principal, eid, targetRef, observations) => {
|
|
722
|
+
const material = toJson({
|
|
723
|
+
version: 1,
|
|
724
|
+
resourceEid: eid,
|
|
725
|
+
targetRef,
|
|
726
|
+
principalEid: principal.me?.eid ?? null,
|
|
727
|
+
observations: [...observations]
|
|
728
|
+
.map((observation) => [observationKey(observation), observation])
|
|
729
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
730
|
+
.map(([key, observation]) => ({ key, observation })),
|
|
731
|
+
});
|
|
732
|
+
return sha256Hex(UTF8.encode(`${REPLAY_AUTHORIZATION_DIGEST_DOMAIN}${canonicalizeJson(material)}`));
|
|
733
|
+
};
|
|
734
|
+
const authorizationReadSetDigest = async (principal, db, eid, targetRef, readSet) => hashAuthorizationObservations(principal, eid, targetRef, await Promise.all(readSet.map((key) => readAuthorizationObservation(db, key))));
|
|
735
|
+
const targetAuthorizationState = async (definition, principal, db, eid, targetRef) => {
|
|
736
|
+
const observations = new Map();
|
|
737
|
+
const current = db.withComposition(definition.composition);
|
|
738
|
+
const predicate = compileReadFilter({
|
|
739
|
+
unit: definition.unit,
|
|
740
|
+
principal,
|
|
741
|
+
currentDb: current,
|
|
742
|
+
observe: (observation) => {
|
|
743
|
+
observations.set(observationKey(observation), observation);
|
|
744
|
+
},
|
|
745
|
+
});
|
|
746
|
+
const filtered = current.filter(predicate);
|
|
747
|
+
const visibleEid = typeof targetRef === "number"
|
|
748
|
+
? targetRef
|
|
749
|
+
: await filtered.entid(targetRef);
|
|
750
|
+
const resourceVisible = await filtered.exists(eid);
|
|
751
|
+
const visible = visibleEid === eid && resourceVisible;
|
|
752
|
+
const observed = Object.freeze([...observations.entries()]
|
|
753
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
754
|
+
.map(([, observation]) => observation));
|
|
755
|
+
const digest = await hashAuthorizationObservations(principal, eid, targetRef, observed);
|
|
756
|
+
return Object.freeze({ visible, digest, observations: observed });
|
|
757
|
+
};
|
|
758
|
+
const captureInvocationReplayFence = async (admission, dbAfter) => {
|
|
759
|
+
const originalDb = admission.context.currentDb;
|
|
760
|
+
const typeCache = new Map();
|
|
761
|
+
const originalType = (eid) => {
|
|
762
|
+
const cached = typeCache.get(eid);
|
|
763
|
+
if (cached !== undefined)
|
|
764
|
+
return cached;
|
|
765
|
+
const pending = typeName(originalDb, eid);
|
|
766
|
+
typeCache.set(eid, pending);
|
|
767
|
+
return pending;
|
|
768
|
+
};
|
|
769
|
+
const consumedRefs = [];
|
|
770
|
+
for (const slot of collectAuthoritativeRefSlots(admission.descriptor.input, admission.decoded)) {
|
|
771
|
+
if (await dbAfter.exists(slot.eid))
|
|
772
|
+
continue;
|
|
773
|
+
const concrete = await originalType(slot.eid);
|
|
774
|
+
if (concrete === undefined) {
|
|
775
|
+
throw new OperationRuntimeFault("admission", new Error("admitted operation ref has no pre-commit type"));
|
|
776
|
+
}
|
|
777
|
+
consumedRefs.push(Object.freeze({
|
|
778
|
+
path: Object.freeze([...slot.path]),
|
|
779
|
+
eid: slot.eid,
|
|
780
|
+
type: concrete,
|
|
781
|
+
}));
|
|
782
|
+
}
|
|
783
|
+
let target;
|
|
784
|
+
if (admission.target !== undefined) {
|
|
785
|
+
const invocationTarget = admission[OPERATION_ADMISSION].invocation.target;
|
|
786
|
+
if (invocationTarget === undefined) {
|
|
787
|
+
throw new OperationRuntimeFault("admission", new Error("admitted targeted operation has no invocation target"));
|
|
788
|
+
}
|
|
789
|
+
const referenceEid = typeof invocationTarget === "number"
|
|
790
|
+
? invocationTarget
|
|
791
|
+
: await dbAfter.entid(invocationTarget) ?? null;
|
|
792
|
+
if (!(await dbAfter.exists(admission.target.eid))) {
|
|
793
|
+
const before = await targetAuthorizationState(admission.resolved.deployed.definition, admission.context.principal, originalDb, admission.target.eid, invocationTarget);
|
|
794
|
+
if (!before.visible) {
|
|
795
|
+
throw new OperationRuntimeFault("admission", new Error("admitted target has no pre-commit authorization witness"));
|
|
796
|
+
}
|
|
797
|
+
const authorizationReadSet = Object.freeze(before.observations
|
|
798
|
+
.filter((observation) => observation.eid !== admission.target.eid)
|
|
799
|
+
.map(observationReadKey));
|
|
800
|
+
const authorizationDigest = await authorizationReadSetDigest(admission.context.principal, dbAfter, admission.target.eid, invocationTarget, authorizationReadSet);
|
|
801
|
+
target = Object.freeze({
|
|
802
|
+
...admission.target,
|
|
803
|
+
referenceEid,
|
|
804
|
+
postCommit: Object.freeze({
|
|
805
|
+
kind: "absent",
|
|
806
|
+
authorizationDigest,
|
|
807
|
+
authorizationReadSet,
|
|
808
|
+
}),
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
else {
|
|
812
|
+
const authorization = await targetAuthorizationState(admission.resolved.deployed.definition, admission.context.principal, dbAfter, admission.target.eid, invocationTarget);
|
|
813
|
+
target = Object.freeze({
|
|
814
|
+
...admission.target,
|
|
815
|
+
referenceEid,
|
|
816
|
+
postCommit: authorization.visible
|
|
817
|
+
? Object.freeze({ kind: "visible" })
|
|
818
|
+
: Object.freeze({
|
|
819
|
+
kind: "hidden",
|
|
820
|
+
authorizationDigest: authorization.digest,
|
|
821
|
+
}),
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return Object.freeze({
|
|
826
|
+
version: 1,
|
|
827
|
+
...(target === undefined ? {} : { target }),
|
|
828
|
+
consumedRefs: Object.freeze(consumedRefs),
|
|
829
|
+
});
|
|
830
|
+
};
|
|
831
|
+
const resolveReportEntity = async (report, value) => {
|
|
832
|
+
if (typeof value === "number")
|
|
833
|
+
return value;
|
|
834
|
+
if (typeof value === "string")
|
|
835
|
+
return report.tempids[value];
|
|
836
|
+
if (Array.isArray(value) && asLookupRef(value) !== undefined) {
|
|
837
|
+
return resolveReportLookup(report, value);
|
|
838
|
+
}
|
|
839
|
+
return undefined;
|
|
840
|
+
};
|
|
841
|
+
const validateReferenceWrites = async (definition, refs, report) => {
|
|
842
|
+
for (const ref of refs) {
|
|
843
|
+
const ident = fieldIdent(ref.field);
|
|
844
|
+
const target = await resolveReportEntity(report, ref.target);
|
|
845
|
+
if (target === undefined) {
|
|
846
|
+
throw new InvalidRequest({ message: `operation ref for ${ident} does not resolve` });
|
|
847
|
+
}
|
|
848
|
+
validateOperationFieldValue(definition, ident, target);
|
|
849
|
+
if (!ref.requireTarget)
|
|
850
|
+
continue;
|
|
851
|
+
const source = await resolveReportEntity(report, ref.source);
|
|
852
|
+
if (source === undefined || !(await report.dbAfter.exists(target))) {
|
|
853
|
+
throw new InvalidRequest({ message: `operation ref for ${ident} does not resolve` });
|
|
854
|
+
}
|
|
855
|
+
const sourceType = await typeName(report.dbAfter, source) ??
|
|
856
|
+
await typeName(report.dbBefore, source);
|
|
857
|
+
const targetType = await typeName(report.dbAfter, target);
|
|
858
|
+
if (sourceType === undefined ||
|
|
859
|
+
targetType === undefined ||
|
|
860
|
+
!refCompatible(definition, ref.field.refTarget, targetType, sourceType)) {
|
|
861
|
+
throw new InvalidRequest({ message: `operation ref for ${ident} has an incompatible entity type` });
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
const validateDeferredFieldWrites = async (definition, descriptor, writes, report) => {
|
|
866
|
+
for (const write of writes) {
|
|
867
|
+
const ident = fieldIdent(write.field);
|
|
868
|
+
const source = await resolveReportEntity(report, write.source);
|
|
869
|
+
if (source === undefined) {
|
|
870
|
+
throw new InvalidRequest({ message: `operation field ${ident} has an unresolved entity` });
|
|
871
|
+
}
|
|
872
|
+
const concrete = await typeName(report.dbAfter, source) ??
|
|
873
|
+
await typeName(report.dbBefore, source);
|
|
874
|
+
if (concrete === undefined) {
|
|
875
|
+
throw new InvalidRequest({ message: `operation field ${ident} has no canonical entity type` });
|
|
876
|
+
}
|
|
877
|
+
let runtime;
|
|
878
|
+
try {
|
|
879
|
+
runtime = definition.requireFieldRuntime(concrete, ident);
|
|
880
|
+
}
|
|
881
|
+
catch {
|
|
882
|
+
throw new InvalidRequest({
|
|
883
|
+
message: `operation field ${ident} is incompatible with entity type ${concrete}`,
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
if (runtime.fixed._tag === "fixed") {
|
|
887
|
+
throw rejected(descriptor, "operation cannot mutate an engine-owned fixed field");
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
const validateSubjectChecks = async (definition, descriptor, checks, report) => {
|
|
892
|
+
for (const check of checks) {
|
|
893
|
+
const source = await resolveReportEntity(report, check.source);
|
|
894
|
+
const concrete = source === undefined
|
|
895
|
+
? undefined
|
|
896
|
+
: await typeName(report.dbAfter, source) ??
|
|
897
|
+
await typeName(report.dbBefore, source);
|
|
898
|
+
if (concrete === undefined ||
|
|
899
|
+
!typeCompatible(definition, check.owner, concrete)) {
|
|
900
|
+
throw new InvalidRequest({
|
|
901
|
+
message: `operation subject is incompatible with ${operationLabel(descriptor)}`,
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
const admitOperationGrantOnDb = async (runtime, invocation, currentDb, resolvedCatalog) => {
|
|
907
|
+
const authorizationCaller = invocation.caller;
|
|
908
|
+
const expiresAtSeconds = authorizationCaller.exp;
|
|
909
|
+
const resolved = resolvedCatalog ?? await Effect.runPromise(resolveOperationCatalog(runtime, invocation));
|
|
910
|
+
const deployed = resolved.deployed;
|
|
911
|
+
if (Result.isFailure(requireCatalogKey(invocation.catalogKey, deployed.definition.catalogKey)))
|
|
912
|
+
throw deny();
|
|
913
|
+
if (Result.isFailure(requireUnitHash(invocation.unitHash, deployed.definition.unitHash, deployed.definition.catalogKey)))
|
|
914
|
+
throw deny();
|
|
915
|
+
const binding = bindingFor(deployed.definition, invocation.owner, invocation.localName);
|
|
916
|
+
if (binding === undefined)
|
|
917
|
+
throw deny();
|
|
918
|
+
const descriptor = binding.descriptor;
|
|
919
|
+
const authoritativeNowMs = requireFreshAuthorization(runtime, expiresAtSeconds, descriptor);
|
|
920
|
+
const context = await Effect.runPromise(constructAuthorizedRequestContext({
|
|
921
|
+
authenticate: Effect.succeed(authorizationCaller),
|
|
922
|
+
catalogs: runtime.catalogs.catalogs,
|
|
923
|
+
routeDatabase: invocation.database,
|
|
924
|
+
catalogKey: invocation.catalogKey,
|
|
925
|
+
unitHash: invocation.unitHash,
|
|
926
|
+
currentDb: () => Effect.succeed(currentDb),
|
|
927
|
+
}, authorizationCaller));
|
|
928
|
+
if (!operationGrantAllows(deployed.definition.unit, descriptor, authorizationCaller, context.principal.subject))
|
|
929
|
+
throw deny();
|
|
930
|
+
return Object.freeze({
|
|
931
|
+
resolved,
|
|
932
|
+
deployed,
|
|
933
|
+
binding,
|
|
934
|
+
descriptor,
|
|
935
|
+
context,
|
|
936
|
+
expiresAtSeconds,
|
|
937
|
+
authoritativeNowMs,
|
|
938
|
+
});
|
|
939
|
+
};
|
|
940
|
+
const authorizeCatalogOperationOnDb = async (connection, runtime, invocation, currentDb, resolvedCatalog, replayFence) => {
|
|
941
|
+
const { authoritativeNowMs, binding, context, deployed, descriptor, expiresAtSeconds, resolved, } = await admitOperationGrantOnDb(runtime, invocation, currentDb, resolvedCatalog);
|
|
942
|
+
for (const allocation of invocation.allocations ?? []) {
|
|
943
|
+
if (!(descriptor.allocations ?? []).some((declared) => declared.slot === allocation.slot)) {
|
|
944
|
+
throw new InvalidRequest({
|
|
945
|
+
message: "operation does not declare this allocation slot",
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
let target;
|
|
950
|
+
if (descriptor.id.target === "required") {
|
|
951
|
+
if (invocation.target === undefined)
|
|
952
|
+
throw deny();
|
|
953
|
+
if (replayFence !== undefined) {
|
|
954
|
+
const fenced = replayFence.target;
|
|
955
|
+
if (fenced === undefined) {
|
|
956
|
+
throw new OperationRuntimeFault("admission", new Error("durable replay target fence does not match operation"));
|
|
957
|
+
}
|
|
958
|
+
const currentReferenceEid = typeof invocation.target === "number"
|
|
959
|
+
? invocation.target
|
|
960
|
+
: await context.currentDb.entid(invocation.target) ?? null;
|
|
961
|
+
if ((typeof invocation.target === "number" &&
|
|
962
|
+
invocation.target !== fenced.eid) ||
|
|
963
|
+
(typeof invocation.target !== "number" &&
|
|
964
|
+
currentReferenceEid !== fenced.referenceEid) ||
|
|
965
|
+
!typeCompatible(deployed.definition, descriptor.id.owner, fenced.type))
|
|
966
|
+
throw deny();
|
|
967
|
+
const fencedExists = await context.currentDb.exists(fenced.eid);
|
|
968
|
+
switch (fenced.postCommit.kind) {
|
|
969
|
+
case "visible": {
|
|
970
|
+
target = await resolveVisibleTarget(context, invocation.target);
|
|
971
|
+
if (!fencedExists ||
|
|
972
|
+
target === undefined ||
|
|
973
|
+
target.eid !== fenced.eid)
|
|
974
|
+
throw deny();
|
|
975
|
+
break;
|
|
976
|
+
}
|
|
977
|
+
case "absent":
|
|
978
|
+
if (fencedExists)
|
|
979
|
+
throw deny();
|
|
980
|
+
{
|
|
981
|
+
const currentDigest = await authorizationReadSetDigest(context.principal, context.currentDb, fenced.eid, invocation.target, fenced.postCommit.authorizationReadSet);
|
|
982
|
+
if (currentDigest !== fenced.postCommit.authorizationDigest) {
|
|
983
|
+
throw deny();
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
target = { eid: fenced.eid, type: fenced.type };
|
|
987
|
+
break;
|
|
988
|
+
case "hidden": {
|
|
989
|
+
if (!fencedExists)
|
|
990
|
+
throw deny();
|
|
991
|
+
const authorization = await targetAuthorizationState(deployed.definition, context.principal, context.currentDb, fenced.eid, invocation.target);
|
|
992
|
+
if (authorization.visible ||
|
|
993
|
+
authorization.digest !== fenced.postCommit.authorizationDigest)
|
|
994
|
+
throw deny();
|
|
995
|
+
target = { eid: fenced.eid, type: fenced.type };
|
|
996
|
+
break;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
else {
|
|
1001
|
+
target = await resolveVisibleTarget(context, invocation.target);
|
|
1002
|
+
if (target === undefined)
|
|
1003
|
+
throw deny();
|
|
1004
|
+
}
|
|
1005
|
+
if (target === undefined || !typeCompatible(deployed.definition, descriptor.id.owner, target.type)) {
|
|
1006
|
+
throw deny();
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
else if (invocation.target !== undefined) {
|
|
1010
|
+
throw deny();
|
|
1011
|
+
}
|
|
1012
|
+
else if (replayFence?.target !== undefined) {
|
|
1013
|
+
throw new OperationRuntimeFault("admission", new Error("durable replay target fence does not match operation"));
|
|
1014
|
+
}
|
|
1015
|
+
let decoded;
|
|
1016
|
+
try {
|
|
1017
|
+
decoded = binding.input.decode(invocation.input);
|
|
1018
|
+
}
|
|
1019
|
+
catch (cause) {
|
|
1020
|
+
if (cause instanceof Schema.SchemaError) {
|
|
1021
|
+
throw new InvalidRequest({
|
|
1022
|
+
message: `invalid operation input: ${cause.message}`,
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
throw new OperationRuntimeFault("input", cause);
|
|
1026
|
+
}
|
|
1027
|
+
const exemptions = replayFence === undefined
|
|
1028
|
+
? undefined
|
|
1029
|
+
: replayRefExemptions(replayFence, descriptor.input, decoded);
|
|
1030
|
+
await validateAuthoritativeRefs(deployed.definition, descriptor.input, decoded, context.currentDb, target?.type ?? (descriptor.id.owner.kind === "entity" ? descriptor.id.owner.name : undefined), exemptions);
|
|
1031
|
+
return Object.freeze({
|
|
1032
|
+
[OPERATION_ADMISSION]: { connection, runtime, invocation },
|
|
1033
|
+
resolved,
|
|
1034
|
+
binding,
|
|
1035
|
+
descriptor,
|
|
1036
|
+
context,
|
|
1037
|
+
decoded,
|
|
1038
|
+
expiresAtSeconds,
|
|
1039
|
+
authoritativeNowMs,
|
|
1040
|
+
...(target === undefined ? {} : { target }),
|
|
1041
|
+
});
|
|
1042
|
+
};
|
|
1043
|
+
export const authorizeCatalogOperationGrant = async (connection, runtime, invocation, resolvedCatalog) => {
|
|
1044
|
+
await admitOperationGrantOnDb(runtime, invocation, connection.db(), resolvedCatalog);
|
|
1045
|
+
};
|
|
1046
|
+
export const authorizeCatalogOperation = async (connection, runtime, invocation, resolvedCatalog) => authorizeCatalogOperationOnDb(connection, runtime, invocation, connection.db(), resolvedCatalog);
|
|
1047
|
+
export const authorizeCatalogOperationReplay = async (connection, runtime, invocation, replayFence, resolvedCatalog) => {
|
|
1048
|
+
await authorizeCatalogOperationOnDb(connection, runtime, invocation, connection.db(), resolvedCatalog, replayFence);
|
|
1049
|
+
};
|
|
1050
|
+
const requireSealing = (sealing) => {
|
|
1051
|
+
if (sealing === undefined) {
|
|
1052
|
+
throw new OperationRuntimeFault("allocation", new Error("allocation mappings have no server sealing root"));
|
|
1053
|
+
}
|
|
1054
|
+
return sealing;
|
|
1055
|
+
};
|
|
1056
|
+
const requireEntityIdScope = (invocation) => {
|
|
1057
|
+
if (invocation.entityIdScope === undefined) {
|
|
1058
|
+
throw new OperationRuntimeFault("allocation", new Error("allocation mappings have no sealing scope"));
|
|
1059
|
+
}
|
|
1060
|
+
return invocation.entityIdScope;
|
|
1061
|
+
};
|
|
1062
|
+
export const executeCatalogOperation = async (connection, runtime, invocation, resolvedCatalog, admitted, sealing) => {
|
|
1063
|
+
const admission = admitted ?? await authorizeCatalogOperation(connection, runtime, invocation, resolvedCatalog);
|
|
1064
|
+
const owner = admission[OPERATION_ADMISSION];
|
|
1065
|
+
if (owner.connection !== connection || owner.runtime !== runtime ||
|
|
1066
|
+
owner.invocation !== invocation) {
|
|
1067
|
+
throw new OperationRuntimeFault("admission", new Error("operation admission belongs to a different invocation"));
|
|
1068
|
+
}
|
|
1069
|
+
const { authoritativeNowMs, binding, context, decoded, descriptor, expiresAtSeconds, resolved, target, } = admission;
|
|
1070
|
+
const authorizationCaller = invocation.caller;
|
|
1071
|
+
const deployed = resolved.deployed;
|
|
1072
|
+
const collector = createCollector({
|
|
1073
|
+
definition: deployed.definition,
|
|
1074
|
+
descriptor,
|
|
1075
|
+
context,
|
|
1076
|
+
caller: authorizationCaller,
|
|
1077
|
+
database: invocation.database,
|
|
1078
|
+
authoritativeNow: new Date(authoritativeNowMs),
|
|
1079
|
+
binding,
|
|
1080
|
+
...(target === undefined ? {} : { target }),
|
|
1081
|
+
});
|
|
1082
|
+
let draft;
|
|
1083
|
+
try {
|
|
1084
|
+
draft = await binding.run(collector.op, decoded);
|
|
1085
|
+
}
|
|
1086
|
+
catch (cause) {
|
|
1087
|
+
if (cause instanceof Unauthorized || cause instanceof InvalidRequest ||
|
|
1088
|
+
cause instanceof OperationRejected || cause instanceof OperationRuntimeFault)
|
|
1089
|
+
throw cause;
|
|
1090
|
+
throw new OperationRuntimeFault("body", cause);
|
|
1091
|
+
}
|
|
1092
|
+
const staged = await connection.transactValidated(collector.tx, async (report) => {
|
|
1093
|
+
await validateDeferredFieldWrites(deployed.definition, descriptor, collector.deferredFields, report);
|
|
1094
|
+
await validateSubjectChecks(deployed.definition, descriptor, collector.subjectChecks, report);
|
|
1095
|
+
await validateReferenceWrites(deployed.definition, collector.refs, report);
|
|
1096
|
+
const resolved = await resolveOutputHandles(descriptor.output, draft, report);
|
|
1097
|
+
await validateAuthoritativeRefs(deployed.definition, descriptor.output, resolved, report.dbAfter, target?.type ?? (descriptor.id.owner.kind === "entity" ? descriptor.id.owner.name : undefined));
|
|
1098
|
+
let encoded;
|
|
1099
|
+
try {
|
|
1100
|
+
encoded = binding.output.encode(resolved);
|
|
1101
|
+
encoded = materializeOutputTransport(encoded);
|
|
1102
|
+
}
|
|
1103
|
+
catch (cause) {
|
|
1104
|
+
throw new OperationRuntimeFault("output", cause);
|
|
1105
|
+
}
|
|
1106
|
+
const replayFence = await captureInvocationReplayFence(admission, report.dbAfter);
|
|
1107
|
+
const requested = invocation.allocations ?? [];
|
|
1108
|
+
const extraction = extractAllocations(descriptor.allocations ?? [], descriptor.output, resolved, requested, allocatedEids(report.tempids));
|
|
1109
|
+
if (extraction._tag === "Unallocated") {
|
|
1110
|
+
throw rejected(descriptor, "operation did not allocate a declared client-ref slot", "allocation", extraction.slot);
|
|
1111
|
+
}
|
|
1112
|
+
for (const slot of extraction.slots) {
|
|
1113
|
+
if (!(await report.dbAfter.exists(slot.eid))) {
|
|
1114
|
+
throw rejected(descriptor, "operation did not allocate a declared client-ref slot", "allocation", slot.slot);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
const allocations = extraction.slots.length === 0
|
|
1118
|
+
? []
|
|
1119
|
+
: await sealAllocationMappings(requireSealing(sealing), requireEntityIdScope(invocation), extraction.slots, requested);
|
|
1120
|
+
return { output: encoded, replayFence, allocations };
|
|
1121
|
+
}, authoritativeNowMs, () => requireFreshAuthorization(runtime, expiresAtSeconds, descriptor));
|
|
1122
|
+
return {
|
|
1123
|
+
report: staged.report,
|
|
1124
|
+
output: staged.value.output,
|
|
1125
|
+
replayFence: staged.value.replayFence,
|
|
1126
|
+
allocations: staged.value.allocations,
|
|
1127
|
+
assertFresh: () => requireFreshAuthorization(runtime, expiresAtSeconds, descriptor),
|
|
1128
|
+
};
|
|
1129
|
+
};
|
|
1130
|
+
//# sourceMappingURL=operations-runtime.js.map
|