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,91 @@
|
|
|
1
|
+
import * as Data from "effect/Data";
|
|
2
|
+
import { REPLICA_STORAGE_VERSION } from "./protocol.js";
|
|
3
|
+
import { replicaPartitionDatabasePrefix } from "./replica-lifecycle.js";
|
|
4
|
+
export const replicaSweepKey = (partition) => [`ramose-replica-sweep-v${REPLICA_STORAGE_VERSION}`, partition].join(":");
|
|
5
|
+
export const replicaSweepPrefix = (partitionPrefix) => [`ramose-replica-sweep-v${REPLICA_STORAGE_VERSION}`, partitionPrefix].join(":");
|
|
6
|
+
export class ReplicaReachability {
|
|
7
|
+
known = new Set();
|
|
8
|
+
frontier = [];
|
|
9
|
+
failed = false;
|
|
10
|
+
constructor(roots) {
|
|
11
|
+
for (const root of roots)
|
|
12
|
+
this.add(root);
|
|
13
|
+
}
|
|
14
|
+
add(hash) {
|
|
15
|
+
if (this.known.has(hash))
|
|
16
|
+
return;
|
|
17
|
+
this.known.add(hash);
|
|
18
|
+
this.frontier.push(hash);
|
|
19
|
+
}
|
|
20
|
+
next(limit) {
|
|
21
|
+
return this.frontier.splice(0, Math.max(0, limit));
|
|
22
|
+
}
|
|
23
|
+
expand(children) {
|
|
24
|
+
for (const child of children)
|
|
25
|
+
this.add(child);
|
|
26
|
+
}
|
|
27
|
+
fail() {
|
|
28
|
+
this.failed = true;
|
|
29
|
+
}
|
|
30
|
+
get pending() {
|
|
31
|
+
return this.frontier.length > 0;
|
|
32
|
+
}
|
|
33
|
+
get complete() {
|
|
34
|
+
return !this.failed && this.frontier.length === 0;
|
|
35
|
+
}
|
|
36
|
+
get reachable() {
|
|
37
|
+
return this.known;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export const unreachableNodeHashes = (stored, live) => {
|
|
41
|
+
const swept = [];
|
|
42
|
+
const seen = new Set();
|
|
43
|
+
for (const hash of stored) {
|
|
44
|
+
if (live.has(hash) || seen.has(hash))
|
|
45
|
+
continue;
|
|
46
|
+
seen.add(hash);
|
|
47
|
+
swept.push(hash);
|
|
48
|
+
}
|
|
49
|
+
return Object.freeze(swept);
|
|
50
|
+
};
|
|
51
|
+
export const supersededPartitions = (stored, referenced) => {
|
|
52
|
+
const confirmed = new Set();
|
|
53
|
+
for (const partition of referenced) {
|
|
54
|
+
const database = replicaPartitionDatabasePrefix(partition);
|
|
55
|
+
if (database !== undefined)
|
|
56
|
+
confirmed.add(database);
|
|
57
|
+
}
|
|
58
|
+
const superseded = new Set();
|
|
59
|
+
for (const partition of stored) {
|
|
60
|
+
if (referenced.has(partition))
|
|
61
|
+
continue;
|
|
62
|
+
const database = replicaPartitionDatabasePrefix(partition);
|
|
63
|
+
if (database !== undefined && confirmed.has(database))
|
|
64
|
+
superseded.add(partition);
|
|
65
|
+
}
|
|
66
|
+
return superseded;
|
|
67
|
+
};
|
|
68
|
+
export const stagingIsSweepable = (staging, committedRevision) => staging !== undefined && staging.baseRevision !== committedRevision;
|
|
69
|
+
const QUOTA_CODES = new Set([
|
|
70
|
+
22,
|
|
71
|
+
1014,
|
|
72
|
+
]);
|
|
73
|
+
const QUOTA_NAMES = new Set([
|
|
74
|
+
"QuotaExceededError",
|
|
75
|
+
"NS_ERROR_DOM_QUOTA_REACHED",
|
|
76
|
+
"QUOTA_EXCEEDED_ERR",
|
|
77
|
+
]);
|
|
78
|
+
export const classifyReplicaStorageFailure = (error) => {
|
|
79
|
+
if (typeof error !== "object" || error === null)
|
|
80
|
+
return "unrelated";
|
|
81
|
+
const named = error;
|
|
82
|
+
if (typeof named.name === "string" && QUOTA_NAMES.has(named.name))
|
|
83
|
+
return "quota";
|
|
84
|
+
if (typeof named.code === "number" && QUOTA_CODES.has(named.code))
|
|
85
|
+
return "quota";
|
|
86
|
+
return "unrelated";
|
|
87
|
+
};
|
|
88
|
+
export const replicaQuotaRecovery = (attempt, failure) => failure !== "quota" ? "propagate" : attempt >= 2 ? "exhausted" : "reclaim";
|
|
89
|
+
export class ReplicaQuotaExhaustedError extends Data.TaggedError("ReplicaQuotaExhaustedError") {
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=replica-gc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replica-gc.js","sourceRoot":"","sources":["../../../src/internal/replication/replica-gc.ts"],"names":[],"mappings":"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AAC,WAAW,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;AAE7E,MAAM,OAAO,0BAA2B,SAAQ,IAAI,CAAC,WAAW,CAC9D,4BAA4B,CAI5B;CAAG"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as Result from "effect/Result";
|
|
2
|
+
import type { ReadCompatibilityHash } from "../authorization/identities.ts";
|
|
3
|
+
import { type Datom, type IndexId } from "../core/datom.ts";
|
|
4
|
+
import type { Roots } from "../core/db.ts";
|
|
5
|
+
import { type NodeRef, type TreeNode } from "../core/tree.ts";
|
|
6
|
+
import { REPLICA_STORAGE_VERSION, type LogicalDatom, type ReplicationIdentity } from "./protocol.ts";
|
|
7
|
+
import { type ReplicaAttributeSpec } from "./replica-schema.ts";
|
|
8
|
+
export type ReplicaManifest = {
|
|
9
|
+
readonly partition: string;
|
|
10
|
+
readonly storageVersion: typeof REPLICA_STORAGE_VERSION;
|
|
11
|
+
readonly identity: ReplicationIdentity;
|
|
12
|
+
readonly readCompatibilityHash: ReadCompatibilityHash;
|
|
13
|
+
readonly revision: string;
|
|
14
|
+
readonly ordinal: number;
|
|
15
|
+
readonly datoms: readonly LogicalDatom[];
|
|
16
|
+
readonly attributes: readonly ReplicaAttributeSpec[];
|
|
17
|
+
readonly entityIds: readonly (readonly [string, number])[];
|
|
18
|
+
readonly entityHandles: readonly (readonly [string, string])[];
|
|
19
|
+
readonly attributeIds: readonly (readonly [string, number])[];
|
|
20
|
+
readonly roots: Roots;
|
|
21
|
+
readonly nextLocalId: number;
|
|
22
|
+
readonly installId?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
export type ReplicaCorruptionReason = "manifest-undecodable" | "manifest-invariant" | "node-missing" | "node-hash" | "node-undecodable" | "node-kind" | "node-invariant";
|
|
25
|
+
export type ReplicaIncompatibilityReason = "read-compatibility" | "schema-metadata";
|
|
26
|
+
export type ReplicaUnusableReason = ReplicaCorruptionReason | ReplicaIncompatibilityReason;
|
|
27
|
+
export type ReplicaRecoveryAction = "replacement-required" | "update-required";
|
|
28
|
+
export declare const replicaRecoveryAction: (reason: ReplicaUnusableReason) => ReplicaRecoveryAction;
|
|
29
|
+
export type ReplicaIntegrityFailure = {
|
|
30
|
+
readonly reason: ReplicaCorruptionReason;
|
|
31
|
+
readonly detail: string;
|
|
32
|
+
readonly index?: IndexId;
|
|
33
|
+
readonly hash?: string;
|
|
34
|
+
};
|
|
35
|
+
declare const ReplicaCorruptError_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 & {
|
|
36
|
+
readonly _tag: "ReplicaCorruptError";
|
|
37
|
+
} & Readonly<A>;
|
|
38
|
+
export declare class ReplicaCorruptError extends ReplicaCorruptError_base<{
|
|
39
|
+
readonly partition: string;
|
|
40
|
+
readonly reason: ReplicaUnusableReason;
|
|
41
|
+
readonly detail: string;
|
|
42
|
+
}> {
|
|
43
|
+
}
|
|
44
|
+
declare const ReplicaSupersededError_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 & {
|
|
45
|
+
readonly _tag: "ReplicaSupersededError";
|
|
46
|
+
} & Readonly<A>;
|
|
47
|
+
export declare class ReplicaSupersededError extends ReplicaSupersededError_base<{
|
|
48
|
+
readonly partition: string;
|
|
49
|
+
readonly revision: string;
|
|
50
|
+
readonly ordinal: number;
|
|
51
|
+
}> {
|
|
52
|
+
}
|
|
53
|
+
export type ReplicaRestoreOutcome<A> = {
|
|
54
|
+
readonly _tag: "restored";
|
|
55
|
+
readonly replica: A;
|
|
56
|
+
} | {
|
|
57
|
+
readonly _tag: "absent";
|
|
58
|
+
} | {
|
|
59
|
+
readonly _tag: "contended";
|
|
60
|
+
readonly partition: string;
|
|
61
|
+
readonly attempts: number;
|
|
62
|
+
} | {
|
|
63
|
+
readonly _tag: "replacement-required";
|
|
64
|
+
readonly partition: string;
|
|
65
|
+
readonly reason: ReplicaUnusableReason;
|
|
66
|
+
readonly detail: string;
|
|
67
|
+
} | {
|
|
68
|
+
readonly _tag: "update-required";
|
|
69
|
+
readonly partition: string;
|
|
70
|
+
readonly reason: ReplicaUnusableReason;
|
|
71
|
+
readonly detail: string;
|
|
72
|
+
};
|
|
73
|
+
export declare const replicaRestored: <A>(replica: A) => ReplicaRestoreOutcome<A>;
|
|
74
|
+
export declare const replicaAbsent: <A>() => ReplicaRestoreOutcome<A>;
|
|
75
|
+
export declare const replicaContended: <A>(partition: string, attempts: number) => ReplicaRestoreOutcome<A>;
|
|
76
|
+
export declare const replicaUnusable: <A>(partition: string, reason: ReplicaUnusableReason, detail: string) => ReplicaRestoreOutcome<A>;
|
|
77
|
+
export declare const restoredReplica: <A>(outcome: ReplicaRestoreOutcome<A>) => A | undefined;
|
|
78
|
+
export declare const replicaRefused: <A>(outcome: ReplicaRestoreOutcome<A>) => outcome is Extract<ReplicaRestoreOutcome<A>, {
|
|
79
|
+
readonly _tag: "replacement-required" | "update-required";
|
|
80
|
+
}>;
|
|
81
|
+
export declare const validateReplicaNodeRef: (ref: unknown, where: string, index?: IndexId) => ReplicaIntegrityFailure | undefined;
|
|
82
|
+
export declare const validateReplicaRoots: (roots: unknown) => ReplicaIntegrityFailure | undefined;
|
|
83
|
+
export declare const replicaManifestIdentity: (record: unknown) => ReplicationIdentity | undefined;
|
|
84
|
+
export declare const replicaManifestFingerprint: (record: unknown) => string;
|
|
85
|
+
export type ReplicaManifestExpectation = {
|
|
86
|
+
readonly partition: string;
|
|
87
|
+
readonly readCompatibilityHash: ReadCompatibilityHash;
|
|
88
|
+
};
|
|
89
|
+
export declare const validateReplicaManifest: (record: unknown, expected: ReplicaManifestExpectation) => Result.Result<ReplicaManifest, ReplicaIntegrityFailure>;
|
|
90
|
+
export type ReplicaIndexDigest = {
|
|
91
|
+
datoms: number;
|
|
92
|
+
sum: number;
|
|
93
|
+
xor: number;
|
|
94
|
+
basis: number;
|
|
95
|
+
};
|
|
96
|
+
export declare const emptyReplicaIndexDigest: () => ReplicaIndexDigest;
|
|
97
|
+
export declare const digestReplicaDatoms: (digest: ReplicaIndexDigest, datoms: readonly Datom[]) => void;
|
|
98
|
+
export declare const sameReplicaIndexContents: (left: ReplicaIndexDigest, right: ReplicaIndexDigest) => boolean;
|
|
99
|
+
export type ReplicaIndexDigests = Record<IndexId, ReplicaIndexDigest>;
|
|
100
|
+
export declare const expectedReplicaContents: (manifest: ReplicaManifest) => Result.Result<ReplicaIndexDigests, ReplicaIntegrityFailure>;
|
|
101
|
+
export declare const validateReplicaContents: (roots: Roots, walked: ReplicaIndexDigests, expected: ReplicaIndexDigests) => ReplicaIntegrityFailure | undefined;
|
|
102
|
+
export declare const validateReplicaNode: (index: IndexId, ref: NodeRef, decoded: {
|
|
103
|
+
readonly index: IndexId;
|
|
104
|
+
readonly node: TreeNode;
|
|
105
|
+
}, expectedKey?: Datom) => ReplicaIntegrityFailure | undefined;
|
|
106
|
+
export {};
|
|
107
|
+
//# sourceMappingURL=replica-integrity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replica-integrity.d.ts","sourceRoot":"","sources":["../../../src/internal/replication/replica-integrity.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAe,KAAK,KAAK,EAAE,KAAK,OAAO,EAAa,MAAM,kBAAkB,CAAC;AACpF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAY,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAEL,uBAAuB,EACvB,KAAK,YAAY,EAEjB,KAAK,mBA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
|
+
import { COMPARATORS, IndexName } from "../core/datom.js";
|
|
5
|
+
import { FIRST_USER_EID, Schema } from "../core/schema.js";
|
|
6
|
+
import { NodeKind } from "../core/tree.js";
|
|
7
|
+
import { isReplicationOrdinal, REPLICA_STORAGE_VERSION, } from "./protocol.js";
|
|
8
|
+
import { replicaBootstrapDatoms, replicaFactDatom, replicaSchema, } from "./replica-schema.js";
|
|
9
|
+
export const replicaRecoveryAction = (reason) => reason === "read-compatibility" || reason === "schema-metadata"
|
|
10
|
+
? "update-required"
|
|
11
|
+
: "replacement-required";
|
|
12
|
+
const failure = (reason, detail, located) => Object.freeze({
|
|
13
|
+
reason,
|
|
14
|
+
detail,
|
|
15
|
+
...(located?.index === undefined ? {} : { index: located.index }),
|
|
16
|
+
...(located?.hash === undefined ? {} : { hash: located.hash }),
|
|
17
|
+
});
|
|
18
|
+
export class ReplicaCorruptError extends Data.TaggedError("ReplicaCorruptError") {
|
|
19
|
+
}
|
|
20
|
+
export class ReplicaSupersededError extends Data.TaggedError("ReplicaSupersededError") {
|
|
21
|
+
}
|
|
22
|
+
export const replicaRestored = (replica) => Object.freeze({ _tag: "restored", replica });
|
|
23
|
+
export const replicaAbsent = () => Object.freeze({ _tag: "absent" });
|
|
24
|
+
export const replicaContended = (partition, attempts) => Object.freeze({ _tag: "contended", partition, attempts });
|
|
25
|
+
export const replicaUnusable = (partition, reason, detail) => Object.freeze({
|
|
26
|
+
_tag: replicaRecoveryAction(reason),
|
|
27
|
+
partition,
|
|
28
|
+
reason,
|
|
29
|
+
detail,
|
|
30
|
+
});
|
|
31
|
+
export const restoredReplica = (outcome) => outcome._tag === "restored" ? outcome.replica : undefined;
|
|
32
|
+
export const replicaRefused = (outcome) => outcome._tag === "replacement-required" || outcome._tag === "update-required";
|
|
33
|
+
const HEX_64 = /^[0-9a-f]{64}$/;
|
|
34
|
+
const isCount = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
35
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
36
|
+
export const validateReplicaNodeRef = (ref, where, index) => {
|
|
37
|
+
if (!isRecord(ref))
|
|
38
|
+
return failure("manifest-undecodable", `${where} is not a node reference`, { index });
|
|
39
|
+
if (typeof ref.hash !== "string" || !HEX_64.test(ref.hash)) {
|
|
40
|
+
return failure("manifest-undecodable", `${where} has no content address`, { index });
|
|
41
|
+
}
|
|
42
|
+
if (ref.kind !== NodeKind.Leaf && ref.kind !== NodeKind.Dir) {
|
|
43
|
+
return failure("node-kind", `${where} declares an unknown node kind`, {
|
|
44
|
+
index,
|
|
45
|
+
hash: ref.hash,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (!isCount(ref.count)) {
|
|
49
|
+
return failure("node-invariant", `${where} has no subtree count`, {
|
|
50
|
+
index,
|
|
51
|
+
hash: ref.hash,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
};
|
|
56
|
+
export const validateReplicaRoots = (roots) => {
|
|
57
|
+
if (!isRecord(roots))
|
|
58
|
+
return failure("manifest-undecodable", "manifest has no roots");
|
|
59
|
+
if (!isCount(roots.t))
|
|
60
|
+
return failure("manifest-undecodable", "roots carry no basis");
|
|
61
|
+
for (const [name, index] of [["eavt", 0], ["aevt", 1], ["avet", 2], ["vaet", 3]]) {
|
|
62
|
+
const invalid = validateReplicaNodeRef(roots[name], `root ${name}`, index);
|
|
63
|
+
if (invalid !== undefined)
|
|
64
|
+
return invalid;
|
|
65
|
+
}
|
|
66
|
+
const counts = roots;
|
|
67
|
+
if (counts.eavt.count !== counts.aevt.count) {
|
|
68
|
+
return failure("manifest-invariant", "eavt and aevt index different datom counts");
|
|
69
|
+
}
|
|
70
|
+
for (const name of ["avet", "vaet"]) {
|
|
71
|
+
if (counts[name].count > counts.eavt.count) {
|
|
72
|
+
return failure("manifest-invariant", `${name} indexes more datoms than eavt`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
};
|
|
77
|
+
const isReplicationIdentityShape = (value) => isRecord(value) && value.version === 1 &&
|
|
78
|
+
["server", "principal", "database", "catalog", "readView", "readCompatibilityHash",
|
|
79
|
+
"authenticator"].every((field) => typeof value[field] === "string");
|
|
80
|
+
export const replicaManifestIdentity = (record) => isRecord(record) && isReplicationIdentityShape(record.identity)
|
|
81
|
+
? record.identity
|
|
82
|
+
: undefined;
|
|
83
|
+
export const replicaManifestFingerprint = (record) => {
|
|
84
|
+
const manifest = isRecord(record) ? record : {};
|
|
85
|
+
const roots = isRecord(manifest.roots) ? manifest.roots : {};
|
|
86
|
+
const size = (value) => Array.isArray(value) ? value.length : -1;
|
|
87
|
+
return JSON.stringify([
|
|
88
|
+
typeof manifest.revision === "string" ? manifest.revision : null,
|
|
89
|
+
...["eavt", "aevt", "avet", "vaet"].map((name) => {
|
|
90
|
+
const ref = roots[name];
|
|
91
|
+
return isRecord(ref) && typeof ref.hash === "string" ? ref.hash : null;
|
|
92
|
+
}),
|
|
93
|
+
typeof manifest.installId === "string" ? manifest.installId : null,
|
|
94
|
+
typeof roots.t === "number" ? roots.t : null,
|
|
95
|
+
typeof manifest.nextLocalId === "number" ? manifest.nextLocalId : null,
|
|
96
|
+
size(manifest.datoms),
|
|
97
|
+
size(manifest.attributes),
|
|
98
|
+
size(manifest.entityIds),
|
|
99
|
+
size(manifest.attributeIds),
|
|
100
|
+
]);
|
|
101
|
+
};
|
|
102
|
+
const isLogicalValue = (value) => {
|
|
103
|
+
if (!isRecord(value))
|
|
104
|
+
return false;
|
|
105
|
+
switch (value.type) {
|
|
106
|
+
case "long":
|
|
107
|
+
case "instant":
|
|
108
|
+
return typeof value.value === "number" && Number.isSafeInteger(value.value);
|
|
109
|
+
case "double":
|
|
110
|
+
return (typeof value.value === "number" && Number.isFinite(value.value)) ||
|
|
111
|
+
value.value === "positive-infinity" || value.value === "negative-infinity";
|
|
112
|
+
case "boolean":
|
|
113
|
+
return typeof value.value === "boolean";
|
|
114
|
+
case "string":
|
|
115
|
+
case "ref":
|
|
116
|
+
case "uuid":
|
|
117
|
+
return typeof value.value === "string";
|
|
118
|
+
case "bytes":
|
|
119
|
+
return typeof value.value === "string" && isCanonicalBase64(value.value);
|
|
120
|
+
default:
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const isCanonicalBase64 = (value) => {
|
|
125
|
+
try {
|
|
126
|
+
return btoa(atob(value)) === value;
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const localIds = (entries, what) => {
|
|
133
|
+
if (!Array.isArray(entries)) {
|
|
134
|
+
return Result.fail(failure("manifest-undecodable", `manifest has no ${what} map`));
|
|
135
|
+
}
|
|
136
|
+
const map = new Map();
|
|
137
|
+
const used = new Set();
|
|
138
|
+
for (const entry of entries) {
|
|
139
|
+
if (!Array.isArray(entry) || entry.length !== 2) {
|
|
140
|
+
return Result.fail(failure("manifest-undecodable", `malformed ${what} entry`));
|
|
141
|
+
}
|
|
142
|
+
const [name, id] = entry;
|
|
143
|
+
if (typeof name !== "string" || !isCount(id)) {
|
|
144
|
+
return Result.fail(failure("manifest-undecodable", `malformed ${what} entry`));
|
|
145
|
+
}
|
|
146
|
+
if (id < FIRST_USER_EID) {
|
|
147
|
+
return Result.fail(failure("manifest-invariant", `${what} ${name} is a reserved local id`));
|
|
148
|
+
}
|
|
149
|
+
if (map.has(name)) {
|
|
150
|
+
return Result.fail(failure("manifest-invariant", `duplicate ${what} ${name}`));
|
|
151
|
+
}
|
|
152
|
+
if (used.has(id)) {
|
|
153
|
+
return Result.fail(failure("manifest-invariant", `${what} ${name} reuses a local id`));
|
|
154
|
+
}
|
|
155
|
+
map.set(name, id);
|
|
156
|
+
used.add(id);
|
|
157
|
+
}
|
|
158
|
+
return Result.succeed(map);
|
|
159
|
+
};
|
|
160
|
+
const sealedHandles = (entries) => {
|
|
161
|
+
if (!Array.isArray(entries)) {
|
|
162
|
+
return Result.fail(failure("manifest-undecodable", "manifest has no entity handle map"));
|
|
163
|
+
}
|
|
164
|
+
const map = new Map();
|
|
165
|
+
const used = new Set();
|
|
166
|
+
for (const entry of entries) {
|
|
167
|
+
if (!Array.isArray(entry) || entry.length !== 2) {
|
|
168
|
+
return Result.fail(failure("manifest-undecodable", "malformed entity handle entry"));
|
|
169
|
+
}
|
|
170
|
+
const [identity, handle] = entry;
|
|
171
|
+
if (typeof identity !== "string" || typeof handle !== "string") {
|
|
172
|
+
return Result.fail(failure("manifest-undecodable", "malformed entity handle entry"));
|
|
173
|
+
}
|
|
174
|
+
if (!ENTITY_ID_PATTERN.test(handle)) {
|
|
175
|
+
return Result.fail(failure("manifest-undecodable", `entity handle for ${identity} is not a sealed handle`));
|
|
176
|
+
}
|
|
177
|
+
if (map.has(identity)) {
|
|
178
|
+
return Result.fail(failure("manifest-invariant", `duplicate entity handle ${identity}`));
|
|
179
|
+
}
|
|
180
|
+
if (used.has(handle)) {
|
|
181
|
+
return Result.fail(failure("manifest-invariant", `entity handle ${identity} reuses another entity's handle`));
|
|
182
|
+
}
|
|
183
|
+
map.set(identity, handle);
|
|
184
|
+
used.add(handle);
|
|
185
|
+
}
|
|
186
|
+
return Result.succeed(map);
|
|
187
|
+
};
|
|
188
|
+
export const validateReplicaManifest = (record, expected) => Result.gen(function* () {
|
|
189
|
+
if (!isRecord(record)) {
|
|
190
|
+
return yield* Result.fail(failure("manifest-undecodable", "manifest is not a record"));
|
|
191
|
+
}
|
|
192
|
+
if (record.storageVersion !== REPLICA_STORAGE_VERSION) {
|
|
193
|
+
return yield* Result.fail(failure("manifest-invariant", "manifest is not this storage version"));
|
|
194
|
+
}
|
|
195
|
+
if (record.partition !== expected.partition) {
|
|
196
|
+
return yield* Result.fail(failure("manifest-invariant", "manifest is stored under another partition"));
|
|
197
|
+
}
|
|
198
|
+
const identity = record.identity;
|
|
199
|
+
if (!isReplicationIdentityShape(identity) || typeof record.revision !== "string") {
|
|
200
|
+
return yield* Result.fail(failure("manifest-undecodable", "manifest has no complete identity or revision"));
|
|
201
|
+
}
|
|
202
|
+
if (!isReplicationOrdinal(record.ordinal)) {
|
|
203
|
+
return yield* Result.fail(failure("manifest-undecodable", "manifest has no visible-change ordinal"));
|
|
204
|
+
}
|
|
205
|
+
if (record.readCompatibilityHash !== identity.readCompatibilityHash ||
|
|
206
|
+
record.readCompatibilityHash !== expected.readCompatibilityHash) {
|
|
207
|
+
return yield* Result.fail(failure("manifest-invariant", "manifest does not confirm this read compatibility"));
|
|
208
|
+
}
|
|
209
|
+
if (!Array.isArray(record.datoms) || !Array.isArray(record.attributes)) {
|
|
210
|
+
return yield* Result.fail(failure("manifest-undecodable", "manifest has no datoms or attributes"));
|
|
211
|
+
}
|
|
212
|
+
const rootsInvalid = validateReplicaRoots(record.roots);
|
|
213
|
+
if (rootsInvalid !== undefined)
|
|
214
|
+
return yield* Result.fail(rootsInvalid);
|
|
215
|
+
if (!isCount(record.nextLocalId) || record.nextLocalId < FIRST_USER_EID) {
|
|
216
|
+
return yield* Result.fail(failure("manifest-invariant", "manifest has no local id allocator"));
|
|
217
|
+
}
|
|
218
|
+
const entities = yield* localIds(record.entityIds, "entity id");
|
|
219
|
+
const handles = yield* sealedHandles(record.entityHandles);
|
|
220
|
+
const attributeIds = yield* localIds(record.attributeIds, "attribute id");
|
|
221
|
+
const allocated = new Set();
|
|
222
|
+
for (const [what, ids] of [["entity", entities], ["attribute", attributeIds]]) {
|
|
223
|
+
for (const [name, id] of ids) {
|
|
224
|
+
if (id >= record.nextLocalId) {
|
|
225
|
+
return yield* Result.fail(failure("manifest-invariant", `${what} ${name} was never allocated`));
|
|
226
|
+
}
|
|
227
|
+
if (allocated.has(id)) {
|
|
228
|
+
return yield* Result.fail(failure("manifest-invariant", `${what} ${name} reuses a local id`));
|
|
229
|
+
}
|
|
230
|
+
allocated.add(id);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const bootstrap = Schema.bootstrap();
|
|
234
|
+
for (const spec of record.attributes) {
|
|
235
|
+
if (!isRecord(spec) || typeof spec.ident !== "string" ||
|
|
236
|
+
typeof spec.valueType !== "number" ||
|
|
237
|
+
(spec.cardinality !== "one" && spec.cardinality !== "many") ||
|
|
238
|
+
typeof spec.index !== "boolean" || typeof spec.isComponent !== "boolean" ||
|
|
239
|
+
typeof spec.optional !== "boolean" ||
|
|
240
|
+
(spec.unique !== undefined && spec.unique !== "identity" && spec.unique !== "value")) {
|
|
241
|
+
return yield* Result.fail(failure("manifest-undecodable", "malformed replica attribute"));
|
|
242
|
+
}
|
|
243
|
+
if (bootstrap.attr(spec.ident) === undefined && !attributeIds.has(spec.ident)) {
|
|
244
|
+
return yield* Result.fail(failure("manifest-invariant", `attribute ${spec.ident} has no local id`));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
for (const datom of record.datoms) {
|
|
248
|
+
if (!isRecord(datom) || typeof datom.entity !== "string" ||
|
|
249
|
+
typeof datom.field !== "string" || datom.op !== "add" ||
|
|
250
|
+
!isLogicalValue(datom.value)) {
|
|
251
|
+
return yield* Result.fail(failure("manifest-undecodable", "malformed logical datom"));
|
|
252
|
+
}
|
|
253
|
+
if (!entities.has(datom.entity)) {
|
|
254
|
+
return yield* Result.fail(failure("manifest-invariant", `fact entity ${datom.entity} has no local id`));
|
|
255
|
+
}
|
|
256
|
+
if (!handles.has(datom.entity)) {
|
|
257
|
+
return yield* Result.fail(failure("manifest-invariant", `fact entity ${datom.entity} has no sealed handle`));
|
|
258
|
+
}
|
|
259
|
+
if (bootstrap.attr(datom.field) === undefined && !attributeIds.has(datom.field)) {
|
|
260
|
+
return yield* Result.fail(failure("manifest-invariant", `fact field ${datom.field} has no local id`));
|
|
261
|
+
}
|
|
262
|
+
if (datom.value.type === "ref") {
|
|
263
|
+
const target = datom.value.value;
|
|
264
|
+
if (!entities.has(target)) {
|
|
265
|
+
return yield* Result.fail(failure("manifest-invariant", "logical reference has no local entity"));
|
|
266
|
+
}
|
|
267
|
+
if (!handles.has(target)) {
|
|
268
|
+
return yield* Result.fail(failure("manifest-invariant", "logical reference has no sealed handle"));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return record;
|
|
273
|
+
});
|
|
274
|
+
export const emptyReplicaIndexDigest = () => ({ datoms: 0, sum: 0, xor: 0, basis: 0 });
|
|
275
|
+
const FNV_PRIME = 0x01000193;
|
|
276
|
+
const FNV_OFFSET = 0x811c9dc5;
|
|
277
|
+
const mix = (hash, word) => Math.imul(hash ^ (word >>> 0), FNV_PRIME) >>> 0;
|
|
278
|
+
const scratch = new DataView(new ArrayBuffer(8));
|
|
279
|
+
const mixNumber = (hash, value) => {
|
|
280
|
+
scratch.setFloat64(0, value);
|
|
281
|
+
return mix(mix(hash, scratch.getUint32(0)), scratch.getUint32(4));
|
|
282
|
+
};
|
|
283
|
+
const mixString = (hash, value) => {
|
|
284
|
+
let mixed = mix(hash, value.length);
|
|
285
|
+
for (let i = 0; i < value.length; i++)
|
|
286
|
+
mixed = mix(mixed, value.charCodeAt(i));
|
|
287
|
+
return mixed;
|
|
288
|
+
};
|
|
289
|
+
const datomHash = (datom) => {
|
|
290
|
+
let hash = mix(mix(mix(mix(FNV_OFFSET, datom.e), datom.a), datom.t), datom.vt);
|
|
291
|
+
hash = mix(hash, datom.op ? 1 : 0);
|
|
292
|
+
const value = datom.v;
|
|
293
|
+
if (typeof value === "number")
|
|
294
|
+
return mixNumber(hash, value);
|
|
295
|
+
if (typeof value === "string")
|
|
296
|
+
return mixString(hash, value);
|
|
297
|
+
if (typeof value === "boolean")
|
|
298
|
+
return mix(hash, value ? 1 : 0);
|
|
299
|
+
let mixed = mix(hash, value.length);
|
|
300
|
+
for (let i = 0; i < value.length; i++)
|
|
301
|
+
mixed = mix(mixed, value[i]);
|
|
302
|
+
return mixed;
|
|
303
|
+
};
|
|
304
|
+
export const digestReplicaDatoms = (digest, datoms) => {
|
|
305
|
+
for (const datom of datoms) {
|
|
306
|
+
const hash = datomHash(datom);
|
|
307
|
+
digest.datoms++;
|
|
308
|
+
digest.sum = (digest.sum + hash) >>> 0;
|
|
309
|
+
digest.xor = (digest.xor ^ hash) >>> 0;
|
|
310
|
+
if (datom.t > digest.basis)
|
|
311
|
+
digest.basis = datom.t;
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
export const sameReplicaIndexContents = (left, right) => left.datoms === right.datoms && left.sum === right.sum && left.xor === right.xor &&
|
|
315
|
+
left.basis === right.basis;
|
|
316
|
+
const emptyDigests = () => ({
|
|
317
|
+
0: emptyReplicaIndexDigest(),
|
|
318
|
+
1: emptyReplicaIndexDigest(),
|
|
319
|
+
2: emptyReplicaIndexDigest(),
|
|
320
|
+
3: emptyReplicaIndexDigest(),
|
|
321
|
+
});
|
|
322
|
+
export const expectedReplicaContents = (manifest) => {
|
|
323
|
+
const entities = new Map(manifest.entityIds);
|
|
324
|
+
const built = replicaSchema(manifest.attributes, new Map(manifest.attributeIds));
|
|
325
|
+
if (built === undefined) {
|
|
326
|
+
return Result.fail(failure("manifest-invariant", "a stored attribute has no local id"));
|
|
327
|
+
}
|
|
328
|
+
const digests = emptyDigests();
|
|
329
|
+
const fold = (datom) => {
|
|
330
|
+
digestReplicaDatoms(digests[0], [datom]);
|
|
331
|
+
digestReplicaDatoms(digests[1], [datom]);
|
|
332
|
+
if (built.schema.isAvet(datom.a))
|
|
333
|
+
digestReplicaDatoms(digests[2], [datom]);
|
|
334
|
+
if (built.schema.isVaet(datom.a))
|
|
335
|
+
digestReplicaDatoms(digests[3], [datom]);
|
|
336
|
+
};
|
|
337
|
+
try {
|
|
338
|
+
for (const datom of replicaBootstrapDatoms())
|
|
339
|
+
fold(datom);
|
|
340
|
+
for (const datom of built.datoms)
|
|
341
|
+
fold(datom);
|
|
342
|
+
for (const logical of manifest.datoms) {
|
|
343
|
+
const fact = replicaFactDatom(logical, built.schema, entities);
|
|
344
|
+
if (typeof fact === "string") {
|
|
345
|
+
return Result.fail(failure("manifest-invariant", `stored fact on ${logical.field} cannot be materialized`));
|
|
346
|
+
}
|
|
347
|
+
fold(fact);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
catch {
|
|
351
|
+
return Result.fail(failure("manifest-undecodable", "a stored fact cannot be materialized"));
|
|
352
|
+
}
|
|
353
|
+
return Result.succeed(digests);
|
|
354
|
+
};
|
|
355
|
+
export const validateReplicaContents = (roots, walked, expected) => {
|
|
356
|
+
for (const index of [0, 1, 2, 3]) {
|
|
357
|
+
if (!sameReplicaIndexContents(walked[index], expected[index])) {
|
|
358
|
+
return failure("manifest-invariant", `${IndexName[index]} does not hold the datoms this manifest describes`, { index });
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (roots.t !== expected[0].basis) {
|
|
362
|
+
return failure("manifest-invariant", "the manifest basis is not the indexed basis");
|
|
363
|
+
}
|
|
364
|
+
return undefined;
|
|
365
|
+
};
|
|
366
|
+
const nodeCount = (node) => {
|
|
367
|
+
if (node.kind === NodeKind.Leaf)
|
|
368
|
+
return node.datoms.length;
|
|
369
|
+
let total = 0;
|
|
370
|
+
for (const ref of node.refs)
|
|
371
|
+
total += ref.count;
|
|
372
|
+
return total;
|
|
373
|
+
};
|
|
374
|
+
export const validateReplicaNode = (index, ref, decoded, expectedKey) => {
|
|
375
|
+
const located = { index, hash: ref.hash };
|
|
376
|
+
if (decoded.index !== index) {
|
|
377
|
+
return failure("node-kind", `node belongs to index ${decoded.index}, not ${IndexName[index]}`, located);
|
|
378
|
+
}
|
|
379
|
+
const node = decoded.node;
|
|
380
|
+
if (node.kind !== ref.kind)
|
|
381
|
+
return failure("node-kind", "node kind is not the referenced kind", located);
|
|
382
|
+
if (nodeCount(node) !== ref.count) {
|
|
383
|
+
return failure("node-invariant", "node does not hold the referenced datom count", located);
|
|
384
|
+
}
|
|
385
|
+
const comparator = COMPARATORS[index];
|
|
386
|
+
const smallest = node.kind === NodeKind.Leaf ? node.datoms[0] : node.keys[0];
|
|
387
|
+
if (expectedKey !== undefined) {
|
|
388
|
+
if (smallest === undefined) {
|
|
389
|
+
return failure("node-invariant", "a linked subtree holds no datoms", located);
|
|
390
|
+
}
|
|
391
|
+
if (comparator(expectedKey, smallest) !== 0) {
|
|
392
|
+
return failure("node-invariant", "directory separator is not the first datom of its subtree", located);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
if (node.kind === NodeKind.Leaf) {
|
|
396
|
+
for (let i = 1; i < node.datoms.length; i++) {
|
|
397
|
+
if (comparator(node.datoms[i - 1], node.datoms[i]) >= 0) {
|
|
398
|
+
return failure("node-invariant", "leaf datoms are not in index order", located);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return undefined;
|
|
402
|
+
}
|
|
403
|
+
if (node.refs.length !== node.keys.length) {
|
|
404
|
+
return failure("node-invariant", "directory keys and children disagree", located);
|
|
405
|
+
}
|
|
406
|
+
if (node.refs.length === 0)
|
|
407
|
+
return failure("node-invariant", "directory has no children", located);
|
|
408
|
+
for (let i = 0; i < node.refs.length; i++) {
|
|
409
|
+
const invalid = validateReplicaNodeRef(node.refs[i], `child ${i}`, index);
|
|
410
|
+
if (invalid !== undefined)
|
|
411
|
+
return invalid;
|
|
412
|
+
if (i > 0 && comparator(node.keys[i - 1], node.keys[i]) >= 0) {
|
|
413
|
+
return failure("node-invariant", "directory keys are not in index order", located);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return undefined;
|
|
417
|
+
};
|
|
418
|
+
//# sourceMappingURL=replica-integrity.js.map
|