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,54 @@
|
|
|
1
|
+
import { TxRejected } from "../../db/Errors.ts";
|
|
2
|
+
import { Connection } from "../core/conn.ts";
|
|
3
|
+
import { type Datom } from "../core/datom.ts";
|
|
4
|
+
import { type AuthenticatedCaller, type AuthorizedRequestContext } from "./request.ts";
|
|
5
|
+
import { type OperationInvocation, type OperationRuntime } from "./operations-runtime.ts";
|
|
6
|
+
export declare const MAX_CHANGESET_OPERATIONS = 100;
|
|
7
|
+
export declare const MAX_CHANGESET_DATOMS = 10000;
|
|
8
|
+
export declare const MAX_CHANGESET_BYTES = 1000000;
|
|
9
|
+
export type ChangesetStep = {
|
|
10
|
+
readonly invocation: Omit<OperationInvocation, "caller">;
|
|
11
|
+
readonly datoms: readonly Datom[];
|
|
12
|
+
};
|
|
13
|
+
export type StoredChangeset = {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly revision: string;
|
|
16
|
+
readonly reviewers?: readonly string[] | undefined;
|
|
17
|
+
readonly requestKey?: string;
|
|
18
|
+
readonly parentRevision?: string;
|
|
19
|
+
readonly title: string;
|
|
20
|
+
readonly subject: string;
|
|
21
|
+
readonly basis: number;
|
|
22
|
+
readonly nextEntityId: number;
|
|
23
|
+
readonly createdAt: number;
|
|
24
|
+
readonly expiresAt: number;
|
|
25
|
+
readonly steps: readonly ChangesetStep[];
|
|
26
|
+
readonly datoms: readonly Datom[];
|
|
27
|
+
readonly status: "draft" | "committed" | "discarded";
|
|
28
|
+
readonly committedAt?: number;
|
|
29
|
+
readonly committedBy?: string;
|
|
30
|
+
};
|
|
31
|
+
export declare const decodeStoredChangeset: (value: StoredChangeset) => StoredChangeset;
|
|
32
|
+
export declare const changesetConflict: (code: string) => TxRejected;
|
|
33
|
+
export declare const changesetSubject: (caller: AuthenticatedCaller, now: number) => string;
|
|
34
|
+
export declare const collapseChangeset: (base: Connection, steps: readonly ChangesetStep[], now: number) => Promise<readonly Datom[]>;
|
|
35
|
+
export declare const prepareChangeset: (base: Connection, runtime: OperationRuntime, input: {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly title: string;
|
|
38
|
+
readonly operations: readonly OperationInvocation[];
|
|
39
|
+
}, caller: AuthenticatedCaller) => Promise<StoredChangeset>;
|
|
40
|
+
export declare const authorizeChangeset: (base: Connection, runtime: OperationRuntime, stored: StoredChangeset, caller: AuthenticatedCaller) => Promise<Connection>;
|
|
41
|
+
export declare const appendChangeset: (base: Connection, runtime: OperationRuntime, stored: StoredChangeset, operations: readonly OperationInvocation[], caller: AuthenticatedCaller) => Promise<StoredChangeset>;
|
|
42
|
+
export type ChangesetFact = {
|
|
43
|
+
readonly entity: number;
|
|
44
|
+
readonly field: string;
|
|
45
|
+
readonly value: unknown;
|
|
46
|
+
readonly reference: boolean;
|
|
47
|
+
readonly added: boolean;
|
|
48
|
+
};
|
|
49
|
+
export declare const changesetReadContext: (base: Connection, runtime: OperationRuntime, stored: StoredChangeset, caller: AuthenticatedCaller, draft: Connection, live?: Connection) => Promise<{
|
|
50
|
+
readonly before: AuthorizedRequestContext;
|
|
51
|
+
readonly after: AuthorizedRequestContext;
|
|
52
|
+
}>;
|
|
53
|
+
export declare const changesetDiff: (base: Connection, runtime: OperationRuntime, stored: StoredChangeset, caller: AuthenticatedCaller, live?: Connection) => Promise<readonly ChangesetFact[]>;
|
|
54
|
+
//# sourceMappingURL=changesets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changesets.d.ts","sourceRoot":"","sources":["../../../src/internal/authorization/changesets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,UAAU,EAAgB,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG/D,OAAO,EAAqC,KAAK,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC1H,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAC3C,eAAO,MAAM,mBAAmB,UA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a,EAAE,CAclC,CAAC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { proposedReadView } from "./read-filter.js";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { InvalidRequest, TxRejected, Unauthorized } from "../../db/Errors.js";
|
|
4
|
+
import { Connection } from "../core/conn.js";
|
|
5
|
+
import { Index, ValueTag } from "../core/datom.js";
|
|
6
|
+
import { DB_TX_INSTANT, isTxEid, txEid } from "../core/schema.js";
|
|
7
|
+
import { fromJson, stringifyJson } from "../core/json.js";
|
|
8
|
+
import { constructAuthorizedRequestContext } from "./request.js";
|
|
9
|
+
import { authorizeCatalogOperation, deployedOperationVersion, executeCatalogOperation, resolveOperationCatalog, } from "./operations-runtime.js";
|
|
10
|
+
export const MAX_CHANGESET_OPERATIONS = 100;
|
|
11
|
+
export const MAX_CHANGESET_DATOMS = 10_000;
|
|
12
|
+
export const MAX_CHANGESET_BYTES = 1_000_000;
|
|
13
|
+
export const decodeStoredChangeset = (value) => ({
|
|
14
|
+
...value,
|
|
15
|
+
datoms: fromJson(value.datoms),
|
|
16
|
+
steps: value.steps.map((step) => ({
|
|
17
|
+
...step,
|
|
18
|
+
datoms: fromJson(step.datoms),
|
|
19
|
+
invocation: { ...step.invocation, ...(step.invocation.target === undefined ? {} : {
|
|
20
|
+
target: fromJson(step.invocation.target),
|
|
21
|
+
}) },
|
|
22
|
+
})),
|
|
23
|
+
});
|
|
24
|
+
export const changesetConflict = (code) => new TxRejected({ message: code, code });
|
|
25
|
+
export const changesetSubject = (caller, now) => {
|
|
26
|
+
const subject = caller.claims.sub;
|
|
27
|
+
if (typeof subject !== "string" || subject.length === 0 ||
|
|
28
|
+
!Number.isSafeInteger(caller.exp) || caller.exp * 1000 <= now) {
|
|
29
|
+
throw new Unauthorized({});
|
|
30
|
+
}
|
|
31
|
+
return subject;
|
|
32
|
+
};
|
|
33
|
+
const factKey = (d) => stringifyJson([d.e, d.a, d.vt, d.v]);
|
|
34
|
+
export const collapseChangeset = async (base, steps, now) => {
|
|
35
|
+
const last = new Map();
|
|
36
|
+
for (const step of steps) {
|
|
37
|
+
for (const d of step.datoms)
|
|
38
|
+
if (!isTxEid(d.e))
|
|
39
|
+
last.set(factKey(d), d);
|
|
40
|
+
}
|
|
41
|
+
const t = base.t + 1;
|
|
42
|
+
const result = [{ e: txEid(t), a: DB_TX_INSTANT, vt: ValueTag.Inst, v: now, t, op: true }];
|
|
43
|
+
for (const d of last.values()) {
|
|
44
|
+
const prior = await base.db().first(Index.EAVT, { e: d.e, a: d.a, vt: d.vt, v: d.v });
|
|
45
|
+
if ((prior !== undefined) !== d.op)
|
|
46
|
+
result.push({ ...d, t });
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
};
|
|
50
|
+
export const prepareChangeset = async (base, runtime, input, caller) => {
|
|
51
|
+
if (input.operations.length < 1 || input.operations.length > MAX_CHANGESET_OPERATIONS) {
|
|
52
|
+
throw new InvalidRequest({ message: "a changeset needs between 1 and 100 operations" });
|
|
53
|
+
}
|
|
54
|
+
const now = runtime.now();
|
|
55
|
+
const subject = changesetSubject(caller, now);
|
|
56
|
+
const draft = base.fork();
|
|
57
|
+
const steps = [];
|
|
58
|
+
let count = 0;
|
|
59
|
+
for (const invocation of input.operations) {
|
|
60
|
+
const resolved = await Effect.runPromise(resolveOperationCatalog(runtime, invocation));
|
|
61
|
+
const version = deployedOperationVersion(resolved, invocation.owner, invocation.localName);
|
|
62
|
+
if (version === undefined || invocation.operationVersion !== version) {
|
|
63
|
+
throw changesetConflict("operation_changed");
|
|
64
|
+
}
|
|
65
|
+
const executed = await executeCatalogOperation(draft, runtime, { ...invocation, caller });
|
|
66
|
+
executed.assertFresh();
|
|
67
|
+
count += executed.report.txData.length;
|
|
68
|
+
if (count > MAX_CHANGESET_DATOMS)
|
|
69
|
+
throw changesetConflict("changeset_too_large");
|
|
70
|
+
const { caller: _caller, ...transaction } = invocation;
|
|
71
|
+
steps.push({ invocation: transaction, datoms: executed.report.txData });
|
|
72
|
+
}
|
|
73
|
+
const result = {
|
|
74
|
+
id: input.id,
|
|
75
|
+
title: input.title,
|
|
76
|
+
revision: crypto.randomUUID(),
|
|
77
|
+
subject,
|
|
78
|
+
basis: base.t,
|
|
79
|
+
nextEntityId: draft.nextEntityId,
|
|
80
|
+
createdAt: now,
|
|
81
|
+
expiresAt: now + 24 * 60 * 60 * 1000,
|
|
82
|
+
steps,
|
|
83
|
+
datoms: await collapseChangeset(base, steps, now),
|
|
84
|
+
status: "draft",
|
|
85
|
+
};
|
|
86
|
+
if (new TextEncoder().encode(stringifyJson(result)).byteLength > MAX_CHANGESET_BYTES)
|
|
87
|
+
throw changesetConflict("changeset_too_large");
|
|
88
|
+
return result;
|
|
89
|
+
};
|
|
90
|
+
export const authorizeChangeset = async (base, runtime, stored, caller) => {
|
|
91
|
+
const subject = changesetSubject(caller, runtime.now());
|
|
92
|
+
if (subject !== stored.subject && !stored.reviewers?.includes(subject))
|
|
93
|
+
throw new Unauthorized({});
|
|
94
|
+
if (stored.expiresAt <= runtime.now())
|
|
95
|
+
throw changesetConflict("changeset_expired");
|
|
96
|
+
if (base.t !== stored.basis)
|
|
97
|
+
throw changesetConflict("changeset_stale");
|
|
98
|
+
const draft = base.fork();
|
|
99
|
+
for (const step of stored.steps) {
|
|
100
|
+
const invocation = { ...step.invocation, caller };
|
|
101
|
+
const resolved = await Effect.runPromise(resolveOperationCatalog(runtime, invocation));
|
|
102
|
+
if (deployedOperationVersion(resolved, invocation.owner, invocation.localName) !== invocation.operationVersion) {
|
|
103
|
+
throw changesetConflict("operation_changed");
|
|
104
|
+
}
|
|
105
|
+
await authorizeCatalogOperation(draft, runtime, invocation, resolved);
|
|
106
|
+
draft.applyDatoms(step.datoms);
|
|
107
|
+
}
|
|
108
|
+
changesetSubject(caller, runtime.now());
|
|
109
|
+
return draft;
|
|
110
|
+
};
|
|
111
|
+
export const appendChangeset = async (base, runtime, stored, operations, caller) => {
|
|
112
|
+
if (stored.steps.length + operations.length > MAX_CHANGESET_OPERATIONS)
|
|
113
|
+
throw changesetConflict("changeset_too_large");
|
|
114
|
+
const draft = await authorizeChangeset(base, runtime, stored, caller);
|
|
115
|
+
const appended = await prepareChangeset(draft, runtime, { id: stored.id, title: stored.title, operations }, caller);
|
|
116
|
+
const steps = [...stored.steps, ...appended.steps];
|
|
117
|
+
if (steps.reduce((count, step) => count + step.datoms.length, 0) > MAX_CHANGESET_DATOMS)
|
|
118
|
+
throw changesetConflict("changeset_too_large");
|
|
119
|
+
const result = { ...appended, subject: stored.subject, reviewers: stored.reviewers, createdAt: stored.createdAt, expiresAt: stored.expiresAt, basis: stored.basis, steps,
|
|
120
|
+
datoms: await collapseChangeset(base, steps, runtime.now()) };
|
|
121
|
+
if (new TextEncoder().encode(stringifyJson(result)).byteLength > MAX_CHANGESET_BYTES)
|
|
122
|
+
throw changesetConflict("changeset_too_large");
|
|
123
|
+
return result;
|
|
124
|
+
};
|
|
125
|
+
export const changesetReadContext = async (base, runtime, stored, caller, draft, live = base) => {
|
|
126
|
+
const invocation = stored.steps[0].invocation;
|
|
127
|
+
const context = (connection) => Effect.runPromise(constructAuthorizedRequestContext({
|
|
128
|
+
authenticate: Effect.succeed(caller), catalogs: runtime.catalogs.catalogs,
|
|
129
|
+
routeDatabase: invocation.database, catalogKey: invocation.catalogKey, unitHash: invocation.unitHash,
|
|
130
|
+
currentDb: () => Effect.succeed(connection.db()),
|
|
131
|
+
}, caller));
|
|
132
|
+
const historical = await context(base);
|
|
133
|
+
const current = await context(live);
|
|
134
|
+
const before = { ...historical, filteredDb: proposedReadView(historical, historical, current) };
|
|
135
|
+
const after = await context(draft);
|
|
136
|
+
return { before, after: { ...after, filteredDb: proposedReadView(before, after, current) } };
|
|
137
|
+
};
|
|
138
|
+
export const changesetDiff = async (base, runtime, stored, caller, live = base) => {
|
|
139
|
+
const draft = await authorizeChangeset(base, runtime, stored, caller);
|
|
140
|
+
const { before, after } = await changesetReadContext(base, runtime, stored, caller, draft, live);
|
|
141
|
+
const facts = [];
|
|
142
|
+
for (const d of stored.datoms) {
|
|
143
|
+
if (isTxEid(d.e))
|
|
144
|
+
continue;
|
|
145
|
+
const view = d.op ? after.filteredDb : before.filteredDb;
|
|
146
|
+
if (await view.first(Index.EAVT, { e: d.e, a: d.a, vt: d.vt, v: d.v }) === undefined)
|
|
147
|
+
continue;
|
|
148
|
+
const attr = view.attr(d.a);
|
|
149
|
+
if (attr === undefined)
|
|
150
|
+
continue;
|
|
151
|
+
facts.push({ entity: d.e, field: attr.ident, value: d.v, reference: d.vt === ValueTag.Ref, added: d.op });
|
|
152
|
+
}
|
|
153
|
+
changesetSubject(caller, runtime.now());
|
|
154
|
+
return facts;
|
|
155
|
+
};
|
|
156
|
+
//# sourceMappingURL=changesets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changesets.js","sourceRoot":"","sources":["../../../src/internal/authorization/changesets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAc,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,iCAAiC,EAA2D,MAAM,cAAc,CAAC;AAC1H,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,GAGxB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAC5C,MAAM,C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AgB,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACxC,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as Result from "effect/Result";
|
|
2
|
+
import { type CompositionIndex } from "../core/composition.ts";
|
|
3
|
+
import type { CatalogDescriptor } from "./catalog.ts";
|
|
4
|
+
import type { InstalledCatalogUnitV2 } from "./catalog-unit.ts";
|
|
5
|
+
import { type PreparedAuthorizationCatalog } from "./validation/catalog.ts";
|
|
6
|
+
import type { ValidateFailure } from "./validation/common.ts";
|
|
7
|
+
export declare const compositionFromPrepared: (index: PreparedAuthorizationCatalog) => CompositionIndex;
|
|
8
|
+
export declare const compositionFromDescriptor: (descriptor: CatalogDescriptor) => Result.Result<CompositionIndex, ValidateFailure>;
|
|
9
|
+
export declare const compositionFromUnit: (unit: InstalledCatalogUnitV2) => Result.Result<CompositionIndex, ValidateFailure>;
|
|
10
|
+
//# sourceMappingURL=composition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../../../src/internal/authorization/composition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAA+B,KAAK,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACzG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAc9D,eAAO,MAAM,uBAAuB,UAC3B,4BAA4B,KAClC,gBAMC,CAAC;AAEL,eAAO,MAAM,yBAAyB,eACxB,iBAAiB,KAC5B,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,eAAe,CAY9C,CAAC;AAEL,eAAO,MAAM,mBAAmB,SACxB,sBAAsB,KAC3B,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,eAAe,CACT,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as Result from "effect/Result";
|
|
2
|
+
import { makeCompositionIndex, } from "../core/composition.js";
|
|
3
|
+
import { prepareAuthorizationCatalog } from "./validation/catalog.js";
|
|
4
|
+
const identOf = (name) => `:${name}`;
|
|
5
|
+
const traitSetRows = (rows) => {
|
|
6
|
+
const out = [];
|
|
7
|
+
for (const [name, traits] of rows) {
|
|
8
|
+
out.push([identOf(name), [...traits].map(identOf)]);
|
|
9
|
+
}
|
|
10
|
+
return out;
|
|
11
|
+
};
|
|
12
|
+
export const compositionFromPrepared = (index) => makeCompositionIndex({
|
|
13
|
+
entities: [...index.entities.keys()].map(identOf),
|
|
14
|
+
traits: [...index.traits.keys()].map(identOf),
|
|
15
|
+
entityTraits: traitSetRows(index.entityTraits),
|
|
16
|
+
traitTraits: traitSetRows(index.traitTraits),
|
|
17
|
+
});
|
|
18
|
+
export const compositionFromDescriptor = (descriptor) => Result.gen(function* () {
|
|
19
|
+
const prepared = yield* prepareAuthorizationCatalog({
|
|
20
|
+
database: descriptor.database,
|
|
21
|
+
catalog: descriptor.id,
|
|
22
|
+
catalogVersion: descriptor.version,
|
|
23
|
+
schemaFingerprint: descriptor.fingerprint,
|
|
24
|
+
}, descriptor);
|
|
25
|
+
return compositionFromPrepared(prepared);
|
|
26
|
+
});
|
|
27
|
+
export const compositionFromUnit = (unit) => compositionFromDescriptor(unit.catalog);
|
|
28
|
+
//# sourceMappingURL=composition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition.js","sourceRoot":"","sources":["../../../src/internal/authorization/composition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,oBAAoB,GAErB,MAAM,wBAAwB,C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EACD,UAAU,CACX,CAAC;IACF,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,IAA4B,EACsB,EAAE,CACpD,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Result from "effect/Result";
|
|
3
|
+
import { Unauthorized } from "../../db/Errors.ts";
|
|
4
|
+
import type { CatalogDefinitions, DeployedCatalogDefinition, DeployedCatalogDefinitions } from "./definitions.ts";
|
|
5
|
+
import { CatalogMismatch, InvalidIR } from "./failures.ts";
|
|
6
|
+
import type { CatalogUnitHash, CatalogId, DatabaseId } from "./identities.ts";
|
|
7
|
+
import type { DeployedCatalog } from "./deployed.ts";
|
|
8
|
+
declare const ResolvedDatabaseRouteTypeId: unique symbol;
|
|
9
|
+
declare const DatabaseCatalogBindingsTypeId: unique symbol;
|
|
10
|
+
export interface ResolvedDatabaseRoute {
|
|
11
|
+
readonly [ResolvedDatabaseRouteTypeId]: typeof ResolvedDatabaseRouteTypeId;
|
|
12
|
+
readonly database: DatabaseId;
|
|
13
|
+
readonly deployed: DeployedCatalog;
|
|
14
|
+
}
|
|
15
|
+
export type DatabaseRouteDerivation = {
|
|
16
|
+
readonly rootDatabase: DatabaseId;
|
|
17
|
+
};
|
|
18
|
+
declare const DatabaseCatalogBindingConflict_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
19
|
+
readonly _tag: "DatabaseCatalogBindingConflict";
|
|
20
|
+
} & Readonly<A>;
|
|
21
|
+
export declare class DatabaseCatalogBindingConflict extends DatabaseCatalogBindingConflict_base<{
|
|
22
|
+
readonly database: DatabaseId;
|
|
23
|
+
readonly expectedCatalogKey: CatalogId;
|
|
24
|
+
readonly expectedUnitHash: CatalogUnitHash;
|
|
25
|
+
readonly actualCatalogKey: CatalogId;
|
|
26
|
+
readonly actualUnitHash: CatalogUnitHash;
|
|
27
|
+
}> {
|
|
28
|
+
}
|
|
29
|
+
declare const InvalidResolvedDatabaseRoute_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
30
|
+
readonly _tag: "InvalidResolvedDatabaseRoute";
|
|
31
|
+
} & Readonly<A>;
|
|
32
|
+
export declare class InvalidResolvedDatabaseRoute extends InvalidResolvedDatabaseRoute_base<{
|
|
33
|
+
readonly message: string;
|
|
34
|
+
}> {
|
|
35
|
+
}
|
|
36
|
+
export type DatabaseBindingFailure = DatabaseCatalogBindingConflict | InvalidResolvedDatabaseRoute | InvalidIR;
|
|
37
|
+
export interface DatabaseCatalogBindings {
|
|
38
|
+
readonly [DatabaseCatalogBindingsTypeId]: typeof DatabaseCatalogBindingsTypeId;
|
|
39
|
+
readonly root: (database: DatabaseId) => Result.Result<ResolvedDatabaseRoute, CatalogMismatch>;
|
|
40
|
+
}
|
|
41
|
+
export declare const unavailableDatabaseCatalogBindings: (fail: () => never) => DatabaseCatalogBindings;
|
|
42
|
+
export declare const opaqueDatabaseBindingDenial: (_error: DatabaseBindingFailure | CatalogMismatch) => Unauthorized;
|
|
43
|
+
export declare const deployDatabaseCatalogBindings: (definitions: CatalogDefinitions, roots: DeployedCatalogDefinitions) => Result.Result<DatabaseCatalogBindings, CatalogMismatch | InvalidIR>;
|
|
44
|
+
export declare const resolveBoundCatalogDefinition: (bindings: DatabaseCatalogBindings, route: ResolvedDatabaseRoute) => Result.Result<DeployedCatalogDefinition, InvalidResolvedDatabaseRoute>;
|
|
45
|
+
export declare const acquireResolvedDatabase: <A, E, R>(bindings: DatabaseCatalogBindings, route: ResolvedDatabaseRoute, acquire: (database: DatabaseId) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | InvalidResolvedDatabaseRoute, R>;
|
|
46
|
+
export declare const deriveResolvedDatabaseRoute: (bindings: DatabaseCatalogBindings, derivation: DatabaseRouteDerivation) => Effect.Effect<ResolvedDatabaseRoute, CatalogMismatch, never>;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=database-bindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-bindings.d.ts","sourceRoot":"","sources":["../../../src/internal/authorization/database-bindings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,0BAA0B,EAE3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,QAAA,MAAM,2BAA2B,EAAE,OAAO,MAEzC,CAAC;AACF,QAAA,MAAM,6BAA6B,EAAE,OAAO,MAE3C,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,CAAC,2BAA2B,CAAC,EAAE,OAAO,2BAA2B,CAAC;IAC3E,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;CACpC;AAED,MAAM,MAAM,uBAAuB,GAAG;IAAE,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAA;CAAE,CAAC;;;;AAE5E,qBAAa,8BAA+B,SAAQ,oCAElD;IACA,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC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GAAG,4BAA4B,EAAE,CAAC,CAInD,CAAC;AAEL,eAAO,MAAM,2BAA2B,0IAOtC,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as Data from "effect/Data";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Result from "effect/Result";
|
|
4
|
+
import { Unauthorized } from "../../db/Errors.js";
|
|
5
|
+
import { CatalogMismatch, InvalidIR } from "./failures.js";
|
|
6
|
+
const ResolvedDatabaseRouteTypeId = Symbol("ramose/internal/ResolvedDatabaseRoute");
|
|
7
|
+
const DatabaseCatalogBindingsTypeId = Symbol("ramose/internal/DatabaseCatalogBindings");
|
|
8
|
+
export class DatabaseCatalogBindingConflict extends Data.TaggedError("DatabaseCatalogBindingConflict") {
|
|
9
|
+
}
|
|
10
|
+
export class InvalidResolvedDatabaseRoute extends Data.TaggedError("InvalidResolvedDatabaseRoute") {
|
|
11
|
+
}
|
|
12
|
+
export const unavailableDatabaseCatalogBindings = (fail) => Object.freeze({
|
|
13
|
+
[DatabaseCatalogBindingsTypeId]: DatabaseCatalogBindingsTypeId,
|
|
14
|
+
root: fail,
|
|
15
|
+
});
|
|
16
|
+
export const opaqueDatabaseBindingDenial = (_error) => new Unauthorized({});
|
|
17
|
+
const bindingStates = new WeakMap();
|
|
18
|
+
const routeStates = new WeakMap();
|
|
19
|
+
const deployedCatalog = (database, definition) => Object.freeze({
|
|
20
|
+
database,
|
|
21
|
+
catalogKey: definition.catalogKey,
|
|
22
|
+
unitHash: definition.unitHash,
|
|
23
|
+
unit: definition.unit,
|
|
24
|
+
composition: definition.composition,
|
|
25
|
+
});
|
|
26
|
+
const makeRoute = (owner, database, definition) => {
|
|
27
|
+
const route = Object.freeze({
|
|
28
|
+
[ResolvedDatabaseRouteTypeId]: ResolvedDatabaseRouteTypeId,
|
|
29
|
+
database,
|
|
30
|
+
deployed: deployedCatalog(database, definition),
|
|
31
|
+
});
|
|
32
|
+
const bound = Object.freeze({ route, definition });
|
|
33
|
+
routeStates.set(route, { ...bound, owner });
|
|
34
|
+
return bound;
|
|
35
|
+
};
|
|
36
|
+
const stateOf = (bindings) => {
|
|
37
|
+
const state = bindingStates.get(bindings);
|
|
38
|
+
return state === undefined
|
|
39
|
+
? Result.fail(new InvalidResolvedDatabaseRoute({
|
|
40
|
+
message: "database catalog bindings were not created by deployDatabaseCatalogBindings",
|
|
41
|
+
}))
|
|
42
|
+
: Result.succeed(state);
|
|
43
|
+
};
|
|
44
|
+
const boundRoute = (bindings, route) => Result.gen(function* () {
|
|
45
|
+
const state = yield* stateOf(bindings);
|
|
46
|
+
const routed = routeStates.get(route);
|
|
47
|
+
if (routed === undefined ||
|
|
48
|
+
routed.owner !== state.owner ||
|
|
49
|
+
state.byDatabase.get(route.database)?.route !== route ||
|
|
50
|
+
route.deployed.database !== route.database ||
|
|
51
|
+
route.deployed.catalogKey !== routed.definition.catalogKey ||
|
|
52
|
+
route.deployed.unitHash !== routed.definition.unitHash) {
|
|
53
|
+
return yield* Result.fail(new InvalidResolvedDatabaseRoute({
|
|
54
|
+
message: "resolved database route is forged, stale, or belongs to another deployment",
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
return routed;
|
|
58
|
+
});
|
|
59
|
+
export const deployDatabaseCatalogBindings = (definitions, roots) => Result.gen(function* () {
|
|
60
|
+
const owner = Object.freeze({});
|
|
61
|
+
const byDatabase = new Map();
|
|
62
|
+
for (const database of roots.databases()) {
|
|
63
|
+
const root = yield* roots.requireDatabase(database);
|
|
64
|
+
const canonical = yield* definitions.require(root.definition.catalogKey);
|
|
65
|
+
const read = yield* roots.catalogs.requireDatabase(database);
|
|
66
|
+
if (canonical !== root.definition ||
|
|
67
|
+
read.catalogKey !== canonical.catalogKey ||
|
|
68
|
+
read.unitHash !== canonical.unitHash) {
|
|
69
|
+
return yield* Result.fail(new InvalidIR({
|
|
70
|
+
message: `configured database '${database}' does not match its immutable catalog definition`,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
byDatabase.set(database, makeRoute(owner, database, canonical));
|
|
74
|
+
}
|
|
75
|
+
const bindings = Object.freeze({
|
|
76
|
+
[DatabaseCatalogBindingsTypeId]: DatabaseCatalogBindingsTypeId,
|
|
77
|
+
root: (database) => {
|
|
78
|
+
const found = byDatabase.get(database);
|
|
79
|
+
return found === undefined
|
|
80
|
+
? Result.fail(new CatalogMismatch({
|
|
81
|
+
message: "catalog mismatch",
|
|
82
|
+
expectedDatabase: database,
|
|
83
|
+
}))
|
|
84
|
+
: Result.succeed(found.route);
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
bindingStates.set(bindings, { owner, byDatabase });
|
|
88
|
+
return bindings;
|
|
89
|
+
});
|
|
90
|
+
export const resolveBoundCatalogDefinition = (bindings, route) => Result.map(boundRoute(bindings, route), (bound) => Object.freeze({
|
|
91
|
+
database: route.database,
|
|
92
|
+
definition: bound.definition,
|
|
93
|
+
}));
|
|
94
|
+
export const acquireResolvedDatabase = (bindings, route, acquire) => Effect.gen(function* () {
|
|
95
|
+
yield* Effect.fromResult(boundRoute(bindings, route));
|
|
96
|
+
return yield* acquire(route.database);
|
|
97
|
+
});
|
|
98
|
+
export const deriveResolvedDatabaseRoute = Effect.fn("Authorization.deriveResolvedDatabaseRoute")(function* (bindings, derivation) {
|
|
99
|
+
return yield* Effect.fromResult(bindings.root(derivation.rootDatabase));
|
|
100
|
+
});
|
|
101
|
+
//# sourceMappingURL=database-bindings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-bindings.js","sourceRoot":"","sources":["../../../src/internal/authorization/database-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOlD,OAAO,EAAE,eAAe,EAAE,SAA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,CAC5C,CAAC,QAAQ,CAAC,EACT,QAAiC,EACjC,UAAmC;IAEnC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;AAC1E,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { Unauthorized } from "../../db/Errors.ts";
|
|
3
|
+
import type { Db } from "../core/db.ts";
|
|
4
|
+
import type { InstalledCatalogDefinition } from "./definitions.ts";
|
|
5
|
+
import type { DatabaseCatalogBindings, DatabaseRouteDerivation, ResolvedDatabaseRoute } from "./database-bindings.ts";
|
|
6
|
+
import type { CatalogUnitHash, CatalogId, DatabaseId } from "./identities.ts";
|
|
7
|
+
import { type AuthenticatedCaller, type AuthorizedRequestContext, type AuthorizedRequestView } from "./request.ts";
|
|
8
|
+
declare const DatabaseAuthorizationFailed_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
9
|
+
readonly _tag: "DatabaseAuthorizationFailed";
|
|
10
|
+
} & Readonly<A>;
|
|
11
|
+
export declare class DatabaseAuthorizationFailed extends DatabaseAuthorizationFailed_base<{
|
|
12
|
+
readonly database: DatabaseId;
|
|
13
|
+
}> {
|
|
14
|
+
}
|
|
15
|
+
declare const DatabaseUnavailable_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
16
|
+
readonly _tag: "DatabaseUnavailable";
|
|
17
|
+
} & Readonly<A>;
|
|
18
|
+
export declare class DatabaseUnavailable extends DatabaseUnavailable_base<{
|
|
19
|
+
readonly database: DatabaseId;
|
|
20
|
+
readonly cause: unknown;
|
|
21
|
+
}> {
|
|
22
|
+
}
|
|
23
|
+
declare const DatabaseProvisioningFailed_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
24
|
+
readonly _tag: "DatabaseProvisioningFailed";
|
|
25
|
+
} & Readonly<A>;
|
|
26
|
+
export declare class DatabaseProvisioningFailed extends DatabaseProvisioningFailed_base<{
|
|
27
|
+
readonly database: DatabaseId;
|
|
28
|
+
readonly cause: unknown;
|
|
29
|
+
}> {
|
|
30
|
+
}
|
|
31
|
+
export type DatabaseTargetFailure = DatabaseAuthorizationFailed | DatabaseUnavailable | DatabaseProvisioningFailed;
|
|
32
|
+
export declare const opaqueDatabaseTargetDenial: (_error: DatabaseTargetFailure) => Unauthorized;
|
|
33
|
+
export type AuthorizedDatabaseInput<R = never, EDb = unknown, EProvision = unknown> = {
|
|
34
|
+
readonly bindings: DatabaseCatalogBindings;
|
|
35
|
+
readonly root: ResolvedDatabaseRoute;
|
|
36
|
+
readonly currentDb: (database: DatabaseId) => Effect.Effect<Db, EDb, R>;
|
|
37
|
+
readonly provision: (route: ResolvedDatabaseRoute, derivation: DatabaseRouteDerivation) => Effect.Effect<void, EProvision, R>;
|
|
38
|
+
readonly view?: AuthorizedRequestView;
|
|
39
|
+
};
|
|
40
|
+
export type DatabaseLeaseRouteIdentity = {
|
|
41
|
+
readonly database: DatabaseId;
|
|
42
|
+
readonly catalogKey: CatalogId;
|
|
43
|
+
readonly unitHash: CatalogUnitHash;
|
|
44
|
+
};
|
|
45
|
+
export type DatabaseLeaseIdentity = {
|
|
46
|
+
readonly rootDatabase: DatabaseId;
|
|
47
|
+
readonly route: DatabaseLeaseRouteIdentity;
|
|
48
|
+
};
|
|
49
|
+
export type AuthorizedDatabaseTarget = {
|
|
50
|
+
readonly route: ResolvedDatabaseRoute;
|
|
51
|
+
readonly derivation: DatabaseRouteDerivation;
|
|
52
|
+
readonly context: AuthorizedRequestContext;
|
|
53
|
+
};
|
|
54
|
+
export declare const databaseLeaseIdentity: (target: AuthorizedDatabaseTarget) => DatabaseLeaseIdentity;
|
|
55
|
+
export declare const sameDatabaseLeaseIdentity: (left: DatabaseLeaseIdentity, right: DatabaseLeaseIdentity) => boolean;
|
|
56
|
+
export type CatalogProvisioningAttribute = {
|
|
57
|
+
readonly ":db/ident": string;
|
|
58
|
+
readonly ":db/valueType": string;
|
|
59
|
+
readonly ":db/cardinality": string;
|
|
60
|
+
readonly ":db/unique"?: string;
|
|
61
|
+
readonly ":db/index"?: true;
|
|
62
|
+
readonly ":db/isComponent"?: true;
|
|
63
|
+
readonly ":db/optional"?: true;
|
|
64
|
+
readonly ":db/doc"?: string;
|
|
65
|
+
};
|
|
66
|
+
export declare const catalogProvisioningAttributes: (definition: InstalledCatalogDefinition) => readonly CatalogProvisioningAttribute[];
|
|
67
|
+
export declare const resolveAuthorizedDatabaseTarget: <R, EDb, EProvision>(input: AuthorizedDatabaseInput<R, EDb, EProvision>, caller: AuthenticatedCaller) => Effect.Effect<AuthorizedDatabaseTarget, DatabaseTargetFailure, R>;
|
|
68
|
+
export type ExecuteAuthorizedDatabaseInput<R = never, EDb = unknown, EProvision = unknown> = AuthorizedDatabaseInput<R, EDb, EProvision> & {
|
|
69
|
+
readonly authenticate: Effect.Effect<AuthenticatedCaller, Unauthorized, R>;
|
|
70
|
+
readonly interruptAfter?: import("effect/Duration").Input;
|
|
71
|
+
};
|
|
72
|
+
export declare const executeAuthorizedDatabaseTarget: <A, E, R, EDb = unknown, EProvision = unknown>(input: ExecuteAuthorizedDatabaseInput<R, EDb, EProvision>, execute: (target: AuthorizedDatabaseTarget) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | Unauthorized, R>;
|
|
73
|
+
export declare const executeAuthorizedDatabase: <A, E, R, EDb = unknown, EProvision = unknown>(input: ExecuteAuthorizedDatabaseInput<R, EDb, EProvision>, execute: (filteredDb: Db) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | Unauthorized, R>;
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=database-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-target.d.ts","sourceRoot":"","sources":["../../../src/internal/authorization/database-target.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;;;;AAEtB,qBAAa,2BAA4B,SAAQ,iCAE/C;IAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAA;CAAE,CAAC;CAAG;;;;AAEvC,qBAAa,mBAAoB,SAAQ,yBAAwC;IAC/E,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,CAAC;CAAG;;;;AAEL,qBAAa,0BAA2B,SAAQ,gCAE9C;IACA,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,CAAC;CAAG;AAEL,MAAM,MAAM,qBAAqB,GAC7B,2BAA2B,GAC3B,mBAAmB,GACnB,0BAA0B,CAAC;AAE/B,eAAO,MAAM,0BAA0B,WAC7B,qBAAqB,KAC5B,YAAiD,CAAC;AAErD,MAAM,MAAM,uBAAuB,CAAC,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-0,0 +1,65 @@
|
|
|
1
|
+
import * as Data from "effect/Data";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { Unauthorized } from "../../db/Errors.js";
|
|
4
|
+
import { constructAuthorizedResolvedRequestContext, executeWithinAuthorizedLease, } from "./request.js";
|
|
5
|
+
export class DatabaseAuthorizationFailed extends Data.TaggedError("DatabaseAuthorizationFailed") {
|
|
6
|
+
}
|
|
7
|
+
export class DatabaseUnavailable extends Data.TaggedError("DatabaseUnavailable") {
|
|
8
|
+
}
|
|
9
|
+
export class DatabaseProvisioningFailed extends Data.TaggedError("DatabaseProvisioningFailed") {
|
|
10
|
+
}
|
|
11
|
+
export const opaqueDatabaseTargetDenial = (_error) => new Unauthorized({ status: 403 });
|
|
12
|
+
export const databaseLeaseIdentity = (target) => Object.freeze({
|
|
13
|
+
rootDatabase: target.derivation.rootDatabase,
|
|
14
|
+
route: Object.freeze({
|
|
15
|
+
database: target.route.database,
|
|
16
|
+
catalogKey: target.route.deployed.catalogKey,
|
|
17
|
+
unitHash: target.route.deployed.unitHash,
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
export const sameDatabaseLeaseIdentity = (left, right) => left.rootDatabase === right.rootDatabase &&
|
|
21
|
+
left.route.database === right.route.database &&
|
|
22
|
+
left.route.catalogKey === right.route.catalogKey &&
|
|
23
|
+
left.route.unitHash === right.route.unitHash;
|
|
24
|
+
export const catalogProvisioningAttributes = (definition) => Object.freeze(definition.unit.catalog.fields.map((field) => Object.freeze({
|
|
25
|
+
":db/ident": `:${field.id.owner.name}/${field.id.localName}`,
|
|
26
|
+
":db/valueType": `:db.type/${field.valueType}`,
|
|
27
|
+
":db/cardinality": `:db.cardinality/${field.cardinality}`,
|
|
28
|
+
...(field.unique === undefined
|
|
29
|
+
? {}
|
|
30
|
+
: {
|
|
31
|
+
":db/unique": field.unique === "upsert"
|
|
32
|
+
? ":db.unique/identity"
|
|
33
|
+
: ":db.unique/value",
|
|
34
|
+
}),
|
|
35
|
+
...(field.index ? { ":db/index": true } : {}),
|
|
36
|
+
...(field.owned ? { ":db/isComponent": true } : {}),
|
|
37
|
+
...(field.optional && field.cardinality === "one"
|
|
38
|
+
? { ":db/optional": true }
|
|
39
|
+
: {}),
|
|
40
|
+
...(field.doc === undefined ? {} : { ":db/doc": field.doc }),
|
|
41
|
+
})));
|
|
42
|
+
export const resolveAuthorizedDatabaseTarget = Effect.fn("Authorization.resolveAuthorizedDatabaseTarget")(function* (input, caller) {
|
|
43
|
+
const derivation = Object.freeze({ rootDatabase: input.root.database });
|
|
44
|
+
yield* input.provision(input.root, derivation).pipe(Effect.mapError((cause) => new DatabaseProvisioningFailed({
|
|
45
|
+
database: input.root.database,
|
|
46
|
+
cause,
|
|
47
|
+
})));
|
|
48
|
+
const context = yield* constructAuthorizedResolvedRequestContext({
|
|
49
|
+
authenticate: Effect.succeed(caller),
|
|
50
|
+
bindings: input.bindings,
|
|
51
|
+
route: input.root,
|
|
52
|
+
currentDb: input.currentDb,
|
|
53
|
+
...(input.view === undefined ? {} : { view: input.view }),
|
|
54
|
+
}, caller).pipe(Effect.mapError((error) => error instanceof Unauthorized
|
|
55
|
+
? new DatabaseAuthorizationFailed({ database: input.root.database })
|
|
56
|
+
: new DatabaseUnavailable({ database: input.root.database, cause: error })));
|
|
57
|
+
return Object.freeze({ route: input.root, derivation, context });
|
|
58
|
+
});
|
|
59
|
+
export const executeAuthorizedDatabaseTarget = Effect.fn("Authorization.executeAuthorizedDatabaseTarget")(function* (input, execute) {
|
|
60
|
+
return yield* executeWithinAuthorizedLease(input, (caller) => resolveAuthorizedDatabaseTarget(input, caller).pipe(Effect.mapError(opaqueDatabaseTargetDenial), Effect.flatMap(execute)));
|
|
61
|
+
});
|
|
62
|
+
export const executeAuthorizedDatabase = Effect.fn("Authorization.executeAuthorizedDatabase")(function* (input, execute) {
|
|
63
|
+
return yield* executeAuthorizedDatabaseTarget(input, (target) => execute(target.context.filteredDb));
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=database-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-target.js","sourceRoot":"","sources":["../../../src/internal/authorization/database-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AASlD,OAAO,EACL,yCAAyC,EACzC,4BAA4B,GAI7B,MAAM,cAAc,CAAC;AAEtB,MAAM,OAAO,2BAA4B,SAAQ,IAAI,CAAC,WAAW,CAC/D,6BAA6B,CACK;CAAG;AAEvC,MAAM,OAAO,mBAAoB,SAAQ,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAG7E;CAAG;AAEL,MAAM,OAAO,0BAA2B,SAAQ,IAAI,CAAC,WAAW,CAC9D,4BAA4B,CAI5B;CAAG;AAOL,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,MAA6B,EACf,EAAE,CAAC,IAAI,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;AA8BrD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,MAAgC,EACT,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,YAAY,EAAE,MAAM,CAAC,UAAU,CAAC,YAAY;IAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;QAC/B,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU;QAC5C,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ;KACzC,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,IAA2B,EAC3B,KAA4B,EACnB,EAAE,CACX,IAAI,CAAC,YAAY,KAAK,KAAK,CAAC,YAAY;IACxC,IAA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