@enbox/dwn-sdk-js 0.3.9 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/browser.mjs +11 -11
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/generated/precompiled-validators.js +783 -1206
- package/dist/esm/generated/precompiled-validators.js.map +1 -1
- package/dist/esm/src/core/dwn-constant.js +5 -0
- package/dist/esm/src/core/dwn-constant.js.map +1 -1
- package/dist/esm/src/core/dwn-error.js +13 -7
- package/dist/esm/src/core/dwn-error.js.map +1 -1
- package/dist/esm/src/core/grant-authorization.js +9 -18
- package/dist/esm/src/core/grant-authorization.js.map +1 -1
- package/dist/esm/src/core/message-reply.js.map +1 -1
- package/dist/esm/src/core/messages-grant-authorization.js +28 -61
- package/dist/esm/src/core/messages-grant-authorization.js.map +1 -1
- package/dist/esm/src/core/protocol-authorization-action.js +25 -27
- package/dist/esm/src/core/protocol-authorization-action.js.map +1 -1
- package/dist/esm/src/core/protocol-authorization-validation.js +31 -69
- package/dist/esm/src/core/protocol-authorization-validation.js.map +1 -1
- package/dist/esm/src/core/protocol-authorization.js +44 -118
- package/dist/esm/src/core/protocol-authorization.js.map +1 -1
- package/dist/esm/src/core/protocols-grant-authorization.js +5 -5
- package/dist/esm/src/core/protocols-grant-authorization.js.map +1 -1
- package/dist/esm/src/core/recording-validation-state-reader.js +84 -0
- package/dist/esm/src/core/recording-validation-state-reader.js.map +1 -0
- package/dist/esm/src/core/records-grant-authorization.js +11 -11
- package/dist/esm/src/core/records-grant-authorization.js.map +1 -1
- package/dist/esm/src/core/replication-apply.js +295 -0
- package/dist/esm/src/core/replication-apply.js.map +1 -0
- package/dist/esm/src/core/resumable-task-manager.js +5 -4
- package/dist/esm/src/core/resumable-task-manager.js.map +1 -1
- package/dist/esm/src/core/validation-state-reader.js +237 -0
- package/dist/esm/src/core/validation-state-reader.js.map +1 -0
- package/dist/esm/src/dwn.js +261 -16
- package/dist/esm/src/dwn.js.map +1 -1
- package/dist/esm/src/enums/dwn-interface-method.js +0 -1
- package/dist/esm/src/enums/dwn-interface-method.js.map +1 -1
- package/dist/esm/src/event-stream/durable-event-log.js +365 -0
- package/dist/esm/src/event-stream/durable-event-log.js.map +1 -0
- package/dist/esm/src/event-stream/event-emitter-wake-publisher.js +25 -0
- package/dist/esm/src/event-stream/event-emitter-wake-publisher.js.map +1 -0
- package/dist/esm/src/handlers/messages-query.js +159 -0
- package/dist/esm/src/handlers/messages-query.js.map +1 -0
- package/dist/esm/src/handlers/messages-read.js +5 -5
- package/dist/esm/src/handlers/messages-read.js.map +1 -1
- package/dist/esm/src/handlers/messages-subscribe.js +8 -8
- package/dist/esm/src/handlers/messages-subscribe.js.map +1 -1
- package/dist/esm/src/handlers/protocols-configure.js +30 -49
- package/dist/esm/src/handlers/protocols-configure.js.map +1 -1
- package/dist/esm/src/handlers/protocols-query.js +1 -1
- package/dist/esm/src/handlers/protocols-query.js.map +1 -1
- package/dist/esm/src/handlers/records-count.js +20 -11
- package/dist/esm/src/handlers/records-count.js.map +1 -1
- package/dist/esm/src/handlers/records-delete.js +20 -16
- package/dist/esm/src/handlers/records-delete.js.map +1 -1
- package/dist/esm/src/handlers/records-query.js +35 -11
- package/dist/esm/src/handlers/records-query.js.map +1 -1
- package/dist/esm/src/handlers/records-read.js +52 -42
- package/dist/esm/src/handlers/records-read.js.map +1 -1
- package/dist/esm/src/handlers/records-subscribe.js +107 -11
- package/dist/esm/src/handlers/records-subscribe.js.map +1 -1
- package/dist/esm/src/handlers/records-write.js +62 -116
- package/dist/esm/src/handlers/records-write.js.map +1 -1
- package/dist/esm/src/index.js +7 -8
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/interfaces/messages-query.js +49 -0
- package/dist/esm/src/interfaces/messages-query.js.map +1 -0
- package/dist/esm/src/interfaces/protocols-configure.js +7 -3
- package/dist/esm/src/interfaces/protocols-configure.js.map +1 -1
- package/dist/esm/src/interfaces/protocols-query.js +3 -4
- package/dist/esm/src/interfaces/protocols-query.js.map +1 -1
- package/dist/esm/src/interfaces/records-count.js +4 -3
- package/dist/esm/src/interfaces/records-count.js.map +1 -1
- package/dist/esm/src/interfaces/records-delete.js +21 -4
- package/dist/esm/src/interfaces/records-delete.js.map +1 -1
- package/dist/esm/src/interfaces/records-query.js +4 -3
- package/dist/esm/src/interfaces/records-query.js.map +1 -1
- package/dist/esm/src/interfaces/records-read.js +3 -3
- package/dist/esm/src/interfaces/records-read.js.map +1 -1
- package/dist/esm/src/interfaces/records-subscribe.js +4 -3
- package/dist/esm/src/interfaces/records-subscribe.js.map +1 -1
- package/dist/esm/src/interfaces/records-write.js +27 -13
- package/dist/esm/src/interfaces/records-write.js.map +1 -1
- package/dist/esm/src/protocols/permissions.js +27 -34
- package/dist/esm/src/protocols/permissions.js.map +1 -1
- package/dist/esm/src/store/index-level.js +24 -9
- package/dist/esm/src/store/index-level.js.map +1 -1
- package/dist/esm/src/store/level-wrapper.js +7 -0
- package/dist/esm/src/store/level-wrapper.js.map +1 -1
- package/dist/esm/src/store/message-store-level.js +536 -42
- package/dist/esm/src/store/message-store-level.js.map +1 -1
- package/dist/esm/src/store/storage-controller.js +58 -49
- package/dist/esm/src/store/storage-controller.js.map +1 -1
- package/dist/esm/src/types/message-types.js.map +1 -1
- package/dist/esm/src/types/validation-state-reader.js +2 -0
- package/dist/esm/src/types/validation-state-reader.js.map +1 -0
- package/dist/esm/src/utils/messages.js +17 -0
- package/dist/esm/src/utils/messages.js.map +1 -1
- package/dist/esm/src/utils/record-limit-occupancy.js +244 -0
- package/dist/esm/src/utils/record-limit-occupancy.js.map +1 -0
- package/dist/esm/src/utils/records.js +50 -14
- package/dist/esm/src/utils/records.js.map +1 -1
- package/dist/esm/src/utils/replication.js +85 -0
- package/dist/esm/src/utils/replication.js.map +1 -0
- package/dist/esm/tests/core/grant-authorization.spec.js +4 -4
- package/dist/esm/tests/core/grant-authorization.spec.js.map +1 -1
- package/dist/esm/tests/core/process-message-parity.spec.js +222 -0
- package/dist/esm/tests/core/process-message-parity.spec.js.map +1 -0
- package/dist/esm/tests/core/protocol-authorization.spec.js +5 -2
- package/dist/esm/tests/core/protocol-authorization.spec.js.map +1 -1
- package/dist/esm/tests/core/records-grant-authorization.spec.js +5 -5
- package/dist/esm/tests/core/records-grant-authorization.spec.js.map +1 -1
- package/dist/esm/tests/core/replication-apply.spec.js +274 -0
- package/dist/esm/tests/core/replication-apply.spec.js.map +1 -0
- package/dist/esm/tests/core/replication-replay-property.spec.js +350 -0
- package/dist/esm/tests/core/replication-replay-property.spec.js.map +1 -0
- package/dist/esm/tests/core/validation-read-closure.spec.js +469 -0
- package/dist/esm/tests/core/validation-read-closure.spec.js.map +1 -0
- package/dist/esm/tests/core/validation-state-reader.spec.js +716 -0
- package/dist/esm/tests/core/validation-state-reader.spec.js.map +1 -0
- package/dist/esm/tests/durable-event-log.spec.js +373 -0
- package/dist/esm/tests/durable-event-log.spec.js.map +1 -0
- package/dist/esm/tests/dwn.spec.js +620 -14
- package/dist/esm/tests/dwn.spec.js.map +1 -1
- package/dist/esm/tests/features/author-delegated-grant.spec.js +9 -6
- package/dist/esm/tests/features/author-delegated-grant.spec.js.map +1 -1
- package/dist/esm/tests/features/owner-delegated-grant.spec.js +1 -4
- package/dist/esm/tests/features/owner-delegated-grant.spec.js.map +1 -1
- package/dist/esm/tests/features/owner-signature.spec.js +1 -4
- package/dist/esm/tests/features/owner-signature.spec.js.map +1 -1
- package/dist/esm/tests/features/permissions.spec.js +165 -4
- package/dist/esm/tests/features/permissions.spec.js.map +1 -1
- package/dist/esm/tests/features/protocol-composition.spec.js +8 -11
- package/dist/esm/tests/features/protocol-composition.spec.js.map +1 -1
- package/dist/esm/tests/features/protocol-create-action.spec.js +1 -4
- package/dist/esm/tests/features/protocol-create-action.spec.js.map +1 -1
- package/dist/esm/tests/features/protocol-delete-action.spec.js +3 -5
- package/dist/esm/tests/features/protocol-delete-action.spec.js.map +1 -1
- package/dist/esm/tests/features/protocol-update-action.spec.js +3 -6
- package/dist/esm/tests/features/protocol-update-action.spec.js.map +1 -1
- package/dist/esm/tests/features/records-delivery.spec.js +1 -4
- package/dist/esm/tests/features/records-delivery.spec.js.map +1 -1
- package/dist/esm/tests/features/records-immutable.spec.js +1 -4
- package/dist/esm/tests/features/records-immutable.spec.js.map +1 -1
- package/dist/esm/tests/features/records-nested-query-scope.spec.js +281 -0
- package/dist/esm/tests/features/records-nested-query-scope.spec.js.map +1 -0
- package/dist/esm/tests/features/records-prune-cross-protocol.spec.js +3 -7
- package/dist/esm/tests/features/records-prune-cross-protocol.spec.js.map +1 -1
- package/dist/esm/tests/features/records-prune.spec.js +11 -22
- package/dist/esm/tests/features/records-prune.spec.js.map +1 -1
- package/dist/esm/tests/features/records-record-limit.spec.js +441 -231
- package/dist/esm/tests/features/records-record-limit.spec.js.map +1 -1
- package/dist/esm/tests/features/records-squash.spec.js +6 -4
- package/dist/esm/tests/features/records-squash.spec.js.map +1 -1
- package/dist/esm/tests/features/records-tags.spec.js +1 -4
- package/dist/esm/tests/features/records-tags.spec.js.map +1 -1
- package/dist/esm/tests/features/resumable-tasks.spec.js +3 -5
- package/dist/esm/tests/features/resumable-tasks.spec.js.map +1 -1
- package/dist/esm/tests/fuzz/message-store.fuzz.spec.js +1 -2
- package/dist/esm/tests/fuzz/message-store.fuzz.spec.js.map +1 -1
- package/dist/esm/tests/fuzz/process-message.fuzz.spec.js +2 -4
- package/dist/esm/tests/fuzz/process-message.fuzz.spec.js.map +1 -1
- package/dist/esm/tests/fuzz/schema-validation.fuzz.spec.js +1 -1
- package/dist/esm/tests/fuzz/schema-validation.fuzz.spec.js.map +1 -1
- package/dist/esm/tests/handlers/messages-query.spec.js +246 -0
- package/dist/esm/tests/handlers/messages-query.spec.js.map +1 -0
- package/dist/esm/tests/handlers/messages-read.spec.js +2 -5
- package/dist/esm/tests/handlers/messages-read.spec.js.map +1 -1
- package/dist/esm/tests/handlers/messages-subscribe.spec.js +3 -14
- package/dist/esm/tests/handlers/messages-subscribe.spec.js.map +1 -1
- package/dist/esm/tests/handlers/protocols-configure.spec.js +27 -26
- package/dist/esm/tests/handlers/protocols-configure.spec.js.map +1 -1
- package/dist/esm/tests/handlers/protocols-query.spec.js +1 -4
- package/dist/esm/tests/handlers/protocols-query.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-count.spec.js +1 -4
- package/dist/esm/tests/handlers/records-count.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-delete.spec.js +312 -30
- package/dist/esm/tests/handlers/records-delete.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-query.spec.js +32 -9
- package/dist/esm/tests/handlers/records-query.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-read.spec.js +4 -4
- package/dist/esm/tests/handlers/records-read.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-subscribe.spec.js +33 -14
- package/dist/esm/tests/handlers/records-subscribe.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-write.spec.js +84 -38
- package/dist/esm/tests/handlers/records-write.spec.js.map +1 -1
- package/dist/esm/tests/interfaces/records-delete.spec.js +69 -2
- package/dist/esm/tests/interfaces/records-delete.spec.js.map +1 -1
- package/dist/esm/tests/interfaces/records-write.spec.js +4 -3
- package/dist/esm/tests/interfaces/records-write.spec.js.map +1 -1
- package/dist/esm/tests/protocols/permissions.spec.js +55 -6
- package/dist/esm/tests/protocols/permissions.spec.js.map +1 -1
- package/dist/esm/tests/scenarios/aggregator.spec.js +1 -4
- package/dist/esm/tests/scenarios/aggregator.spec.js.map +1 -1
- package/dist/esm/tests/scenarios/deleted-record.spec.js +1 -4
- package/dist/esm/tests/scenarios/deleted-record.spec.js.map +1 -1
- package/dist/esm/tests/scenarios/end-to-end-tests.spec.js +1 -4
- package/dist/esm/tests/scenarios/end-to-end-tests.spec.js.map +1 -1
- package/dist/esm/tests/scenarios/nested-roles.spec.js +1 -4
- package/dist/esm/tests/scenarios/nested-roles.spec.js.map +1 -1
- package/dist/esm/tests/scenarios/subscriptions.spec.js +1 -4
- package/dist/esm/tests/scenarios/subscriptions.spec.js.map +1 -1
- package/dist/esm/tests/store/message-store-level.spec.js +361 -5
- package/dist/esm/tests/store/message-store-level.spec.js.map +1 -1
- package/dist/esm/tests/store/message-store.spec.js +60 -0
- package/dist/esm/tests/store/message-store.spec.js.map +1 -1
- package/dist/esm/tests/test-event-stream.js +7 -3
- package/dist/esm/tests/test-event-stream.js.map +1 -1
- package/dist/esm/tests/test-stores.js +19 -9
- package/dist/esm/tests/test-stores.js.map +1 -1
- package/dist/esm/tests/test-suite.js +4 -4
- package/dist/esm/tests/test-suite.js.map +1 -1
- package/dist/esm/tests/utils/test-data-generator.js +25 -0
- package/dist/esm/tests/utils/test-data-generator.js.map +1 -1
- package/dist/esm/tests/utils/test-stub-generator.js.map +1 -1
- package/dist/esm/tests/utils/test-validation-state-reader.js +16 -0
- package/dist/esm/tests/utils/test-validation-state-reader.js.map +1 -0
- package/dist/types/generated/precompiled-validators.d.ts +6 -6
- package/dist/types/generated/precompiled-validators.d.ts.map +1 -1
- package/dist/types/src/core/core-protocol.d.ts +3 -3
- package/dist/types/src/core/core-protocol.d.ts.map +1 -1
- package/dist/types/src/core/dwn-constant.d.ts +5 -0
- package/dist/types/src/core/dwn-constant.d.ts.map +1 -1
- package/dist/types/src/core/dwn-error.d.ts +13 -7
- package/dist/types/src/core/dwn-error.d.ts.map +1 -1
- package/dist/types/src/core/grant-authorization.d.ts +5 -5
- package/dist/types/src/core/grant-authorization.d.ts.map +1 -1
- package/dist/types/src/core/message-reply.d.ts +5 -4
- package/dist/types/src/core/message-reply.d.ts.map +1 -1
- package/dist/types/src/core/messages-grant-authorization.d.ts +12 -15
- package/dist/types/src/core/messages-grant-authorization.d.ts.map +1 -1
- package/dist/types/src/core/protocol-authorization-action.d.ts +4 -5
- package/dist/types/src/core/protocol-authorization-action.d.ts.map +1 -1
- package/dist/types/src/core/protocol-authorization-validation.d.ts +13 -16
- package/dist/types/src/core/protocol-authorization-validation.d.ts.map +1 -1
- package/dist/types/src/core/protocol-authorization.d.ts +8 -33
- package/dist/types/src/core/protocol-authorization.d.ts.map +1 -1
- package/dist/types/src/core/protocols-grant-authorization.d.ts +4 -4
- package/dist/types/src/core/protocols-grant-authorization.d.ts.map +1 -1
- package/dist/types/src/core/recording-validation-state-reader.d.ts +75 -0
- package/dist/types/src/core/recording-validation-state-reader.d.ts.map +1 -0
- package/dist/types/src/core/records-grant-authorization.d.ts +8 -8
- package/dist/types/src/core/records-grant-authorization.d.ts.map +1 -1
- package/dist/types/src/core/replication-apply.d.ts +129 -0
- package/dist/types/src/core/replication-apply.d.ts.map +1 -0
- package/dist/types/src/core/resumable-task-manager.d.ts +1 -1
- package/dist/types/src/core/resumable-task-manager.d.ts.map +1 -1
- package/dist/types/src/core/validation-state-reader.d.ts +79 -0
- package/dist/types/src/core/validation-state-reader.d.ts.map +1 -0
- package/dist/types/src/dwn.d.ts +47 -13
- package/dist/types/src/dwn.d.ts.map +1 -1
- package/dist/types/src/enums/dwn-interface-method.d.ts +0 -1
- package/dist/types/src/enums/dwn-interface-method.d.ts.map +1 -1
- package/dist/types/src/event-stream/durable-event-log.d.ts +69 -0
- package/dist/types/src/event-stream/durable-event-log.d.ts.map +1 -0
- package/dist/types/src/event-stream/event-emitter-wake-publisher.d.ts +13 -0
- package/dist/types/src/event-stream/event-emitter-wake-publisher.d.ts.map +1 -0
- package/dist/types/src/handlers/messages-query.d.ts +20 -0
- package/dist/types/src/handlers/messages-query.d.ts.map +1 -0
- package/dist/types/src/handlers/messages-read.d.ts +1 -1
- package/dist/types/src/handlers/messages-read.d.ts.map +1 -1
- package/dist/types/src/handlers/messages-subscribe.d.ts.map +1 -1
- package/dist/types/src/handlers/protocols-configure.d.ts +0 -5
- package/dist/types/src/handlers/protocols-configure.d.ts.map +1 -1
- package/dist/types/src/handlers/records-count.d.ts +2 -1
- package/dist/types/src/handlers/records-count.d.ts.map +1 -1
- package/dist/types/src/handlers/records-delete.d.ts +2 -2
- package/dist/types/src/handlers/records-delete.d.ts.map +1 -1
- package/dist/types/src/handlers/records-query.d.ts +1 -1
- package/dist/types/src/handlers/records-query.d.ts.map +1 -1
- package/dist/types/src/handlers/records-read.d.ts +2 -1
- package/dist/types/src/handlers/records-read.d.ts.map +1 -1
- package/dist/types/src/handlers/records-subscribe.d.ts +4 -5
- package/dist/types/src/handlers/records-subscribe.d.ts.map +1 -1
- package/dist/types/src/handlers/records-write.d.ts +3 -11
- package/dist/types/src/handlers/records-write.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +16 -18
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/interfaces/messages-query.d.ts +23 -0
- package/dist/types/src/interfaces/messages-query.d.ts.map +1 -0
- package/dist/types/src/interfaces/protocols-configure.d.ts +3 -3
- package/dist/types/src/interfaces/protocols-configure.d.ts.map +1 -1
- package/dist/types/src/interfaces/protocols-query.d.ts +2 -2
- package/dist/types/src/interfaces/protocols-query.d.ts.map +1 -1
- package/dist/types/src/interfaces/records-count.d.ts +3 -3
- package/dist/types/src/interfaces/records-count.d.ts.map +1 -1
- package/dist/types/src/interfaces/records-delete.d.ts +11 -3
- package/dist/types/src/interfaces/records-delete.d.ts.map +1 -1
- package/dist/types/src/interfaces/records-query.d.ts +3 -3
- package/dist/types/src/interfaces/records-query.d.ts.map +1 -1
- package/dist/types/src/interfaces/records-read.d.ts +3 -3
- package/dist/types/src/interfaces/records-read.d.ts.map +1 -1
- package/dist/types/src/interfaces/records-subscribe.d.ts +3 -3
- package/dist/types/src/interfaces/records-subscribe.d.ts.map +1 -1
- package/dist/types/src/interfaces/records-write.d.ts +15 -7
- package/dist/types/src/interfaces/records-write.d.ts.map +1 -1
- package/dist/types/src/protocols/permissions.d.ts +9 -12
- package/dist/types/src/protocols/permissions.d.ts.map +1 -1
- package/dist/types/src/store/index-level.d.ts +10 -1
- package/dist/types/src/store/index-level.d.ts.map +1 -1
- package/dist/types/src/store/level-wrapper.d.ts +5 -0
- package/dist/types/src/store/level-wrapper.d.ts.map +1 -1
- package/dist/types/src/store/message-store-level.d.ts +94 -14
- package/dist/types/src/store/message-store-level.d.ts.map +1 -1
- package/dist/types/src/store/storage-controller.d.ts +17 -14
- package/dist/types/src/store/storage-controller.d.ts.map +1 -1
- package/dist/types/src/types/message-store.d.ts +29 -1
- package/dist/types/src/types/message-store.d.ts.map +1 -1
- package/dist/types/src/types/message-types.d.ts +2 -0
- package/dist/types/src/types/message-types.d.ts.map +1 -1
- package/dist/types/src/types/messages-types.d.ts +21 -55
- package/dist/types/src/types/messages-types.d.ts.map +1 -1
- package/dist/types/src/types/method-handler.d.ts +2 -2
- package/dist/types/src/types/method-handler.d.ts.map +1 -1
- package/dist/types/src/types/permission-types.d.ts +1 -1
- package/dist/types/src/types/subscriptions.d.ts +50 -39
- package/dist/types/src/types/subscriptions.d.ts.map +1 -1
- package/dist/types/src/types/validation-state-reader.d.ts +116 -0
- package/dist/types/src/types/validation-state-reader.d.ts.map +1 -0
- package/dist/types/src/utils/messages.d.ts +10 -0
- package/dist/types/src/utils/messages.d.ts.map +1 -1
- package/dist/types/src/utils/record-limit-occupancy.d.ts +40 -0
- package/dist/types/src/utils/record-limit-occupancy.d.ts.map +1 -0
- package/dist/types/src/utils/records.d.ts +25 -3
- package/dist/types/src/utils/records.d.ts.map +1 -1
- package/dist/types/src/utils/replication.d.ts +22 -0
- package/dist/types/src/utils/replication.d.ts.map +1 -0
- package/dist/types/tests/core/process-message-parity.spec.d.ts +2 -0
- package/dist/types/tests/core/process-message-parity.spec.d.ts.map +1 -0
- package/dist/types/tests/core/replication-apply.spec.d.ts +2 -0
- package/dist/types/tests/core/replication-apply.spec.d.ts.map +1 -0
- package/dist/types/tests/core/replication-replay-property.spec.d.ts +2 -0
- package/dist/types/tests/core/replication-replay-property.spec.d.ts.map +1 -0
- package/dist/types/tests/core/validation-read-closure.spec.d.ts +2 -0
- package/dist/types/tests/core/validation-read-closure.spec.d.ts.map +1 -0
- package/dist/types/tests/core/validation-state-reader.spec.d.ts +2 -0
- package/dist/types/tests/core/validation-state-reader.spec.d.ts.map +1 -0
- package/dist/types/tests/durable-event-log.spec.d.ts +2 -0
- package/dist/types/tests/durable-event-log.spec.d.ts.map +1 -0
- package/dist/types/tests/dwn.spec.d.ts.map +1 -1
- package/dist/types/tests/features/author-delegated-grant.spec.d.ts.map +1 -1
- package/dist/types/tests/features/owner-delegated-grant.spec.d.ts.map +1 -1
- package/dist/types/tests/features/owner-signature.spec.d.ts.map +1 -1
- package/dist/types/tests/features/permissions.spec.d.ts.map +1 -1
- package/dist/types/tests/features/protocol-composition.spec.d.ts.map +1 -1
- package/dist/types/tests/features/protocol-create-action.spec.d.ts.map +1 -1
- package/dist/types/tests/features/protocol-delete-action.spec.d.ts.map +1 -1
- package/dist/types/tests/features/protocol-update-action.spec.d.ts.map +1 -1
- package/dist/types/tests/features/records-delivery.spec.d.ts.map +1 -1
- package/dist/types/tests/features/records-immutable.spec.d.ts.map +1 -1
- package/dist/types/tests/features/records-nested-query-scope.spec.d.ts +2 -0
- package/dist/types/tests/features/records-nested-query-scope.spec.d.ts.map +1 -0
- package/dist/types/tests/features/records-prune-cross-protocol.spec.d.ts.map +1 -1
- package/dist/types/tests/features/records-prune.spec.d.ts.map +1 -1
- package/dist/types/tests/features/records-record-limit.spec.d.ts.map +1 -1
- package/dist/types/tests/features/records-squash.spec.d.ts.map +1 -1
- package/dist/types/tests/features/records-tags.spec.d.ts.map +1 -1
- package/dist/types/tests/features/resumable-tasks.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/messages-query.spec.d.ts +2 -0
- package/dist/types/tests/handlers/messages-query.spec.d.ts.map +1 -0
- package/dist/types/tests/handlers/messages-read.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/messages-subscribe.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/protocols-configure.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/protocols-query.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/records-count.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/records-delete.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/records-query.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/records-read.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/records-subscribe.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/records-write.spec.d.ts.map +1 -1
- package/dist/types/tests/scenarios/deleted-record.spec.d.ts.map +1 -1
- package/dist/types/tests/scenarios/end-to-end-tests.spec.d.ts.map +1 -1
- package/dist/types/tests/scenarios/nested-roles.spec.d.ts.map +1 -1
- package/dist/types/tests/scenarios/subscriptions.spec.d.ts.map +1 -1
- package/dist/types/tests/store/message-store.spec.d.ts.map +1 -1
- package/dist/types/tests/test-event-stream.d.ts +1 -1
- package/dist/types/tests/test-event-stream.d.ts.map +1 -1
- package/dist/types/tests/test-stores.d.ts +5 -4
- package/dist/types/tests/test-stores.d.ts.map +1 -1
- package/dist/types/tests/test-suite.d.ts +1 -2
- package/dist/types/tests/test-suite.d.ts.map +1 -1
- package/dist/types/tests/utils/test-data-generator.d.ts +20 -1
- package/dist/types/tests/utils/test-data-generator.d.ts.map +1 -1
- package/dist/types/tests/utils/test-validation-state-reader.d.ts +15 -0
- package/dist/types/tests/utils/test-validation-state-reader.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/core/core-protocol.ts +3 -3
- package/src/core/dwn-constant.ts +7 -1
- package/src/core/dwn-error.ts +13 -7
- package/src/core/grant-authorization.ts +11 -20
- package/src/core/message-reply.ts +6 -5
- package/src/core/messages-grant-authorization.ts +37 -100
- package/src/core/protocol-authorization-action.ts +29 -38
- package/src/core/protocol-authorization-validation.ts +41 -98
- package/src/core/protocol-authorization.ts +56 -202
- package/src/core/protocols-grant-authorization.ts +9 -9
- package/src/core/recording-validation-state-reader.ts +130 -0
- package/src/core/records-grant-authorization.ts +16 -16
- package/src/core/replication-apply.ts +412 -0
- package/src/core/resumable-task-manager.ts +10 -8
- package/src/core/validation-state-reader.ts +350 -0
- package/src/dwn.ts +417 -30
- package/src/enums/dwn-interface-method.ts +0 -1
- package/src/event-stream/durable-event-log.ts +509 -0
- package/src/event-stream/event-emitter-wake-publisher.ts +34 -0
- package/src/handlers/messages-query.ts +203 -0
- package/src/handlers/messages-read.ts +9 -10
- package/src/handlers/messages-subscribe.ts +12 -13
- package/src/handlers/protocols-configure.ts +37 -58
- package/src/handlers/protocols-query.ts +1 -1
- package/src/handlers/records-count.ts +24 -17
- package/src/handlers/records-delete.ts +29 -27
- package/src/handlers/records-query.ts +38 -17
- package/src/handlers/records-read.ts +63 -50
- package/src/handlers/records-subscribe.ts +132 -19
- package/src/handlers/records-write.ts +77 -168
- package/src/index.ts +16 -20
- package/src/interfaces/messages-query.ts +70 -0
- package/src/interfaces/protocols-configure.ts +12 -4
- package/src/interfaces/protocols-query.ts +4 -5
- package/src/interfaces/records-count.ts +9 -4
- package/src/interfaces/records-delete.ts +25 -5
- package/src/interfaces/records-query.ts +9 -4
- package/src/interfaces/records-read.ts +4 -4
- package/src/interfaces/records-subscribe.ts +9 -4
- package/src/interfaces/records-write.ts +41 -13
- package/src/protocols/permissions.ts +32 -52
- package/src/store/index-level.ts +30 -9
- package/src/store/level-wrapper.ts +9 -1
- package/src/store/message-store-level.ts +757 -47
- package/src/store/storage-controller.ts +74 -63
- package/src/types/message-store.ts +45 -2
- package/src/types/message-types.ts +3 -1
- package/src/types/messages-types.ts +26 -65
- package/src/types/method-handler.ts +3 -3
- package/src/types/permission-types.ts +1 -1
- package/src/types/subscriptions.ts +53 -42
- package/src/types/validation-state-reader.ts +127 -0
- package/src/utils/messages.ts +25 -1
- package/src/utils/record-limit-occupancy.ts +377 -0
- package/src/utils/records.ts +69 -13
- package/src/utils/replication.ts +122 -0
- package/dist/esm/src/core/record-chain.js +0 -64
- package/dist/esm/src/core/record-chain.js.map +0 -1
- package/dist/esm/src/event-stream/event-emitter-event-log.js +0 -334
- package/dist/esm/src/event-stream/event-emitter-event-log.js.map +0 -1
- package/dist/esm/src/handlers/messages-sync.js +0 -581
- package/dist/esm/src/handlers/messages-sync.js.map +0 -1
- package/dist/esm/src/interfaces/messages-sync.js +0 -54
- package/dist/esm/src/interfaces/messages-sync.js.map +0 -1
- package/dist/esm/src/smt/smt-store-level.js +0 -103
- package/dist/esm/src/smt/smt-store-level.js.map +0 -1
- package/dist/esm/src/smt/smt-store-memory.js +0 -41
- package/dist/esm/src/smt/smt-store-memory.js.map +0 -1
- package/dist/esm/src/smt/smt-utils.js +0 -129
- package/dist/esm/src/smt/smt-utils.js.map +0 -1
- package/dist/esm/src/smt/sparse-merkle-tree.js +0 -577
- package/dist/esm/src/smt/sparse-merkle-tree.js.map +0 -1
- package/dist/esm/src/state-index/state-index-level.js +0 -191
- package/dist/esm/src/state-index/state-index-level.js.map +0 -1
- package/dist/esm/src/sync/records-projection.js +0 -228
- package/dist/esm/src/sync/records-projection.js.map +0 -1
- package/dist/esm/src/types/smt-types.js +0 -5
- package/dist/esm/src/types/smt-types.js.map +0 -1
- package/dist/esm/src/types/state-index.js +0 -2
- package/dist/esm/src/types/state-index.js.map +0 -1
- package/dist/esm/tests/event-emitter-event-log.spec.js +0 -499
- package/dist/esm/tests/event-emitter-event-log.spec.js.map +0 -1
- package/dist/esm/tests/handlers/messages-sync.spec.js +0 -1771
- package/dist/esm/tests/handlers/messages-sync.spec.js.map +0 -1
- package/dist/esm/tests/smt/smt-store-level.spec.js +0 -132
- package/dist/esm/tests/smt/smt-store-level.spec.js.map +0 -1
- package/dist/esm/tests/smt/sparse-merkle-tree.spec.js +0 -732
- package/dist/esm/tests/smt/sparse-merkle-tree.spec.js.map +0 -1
- package/dist/esm/tests/state-index/state-index-level.spec.js +0 -245
- package/dist/esm/tests/state-index/state-index-level.spec.js.map +0 -1
- package/dist/esm/tests/sync/records-projection.spec.js +0 -245
- package/dist/esm/tests/sync/records-projection.spec.js.map +0 -1
- package/dist/types/src/core/record-chain.d.ts +0 -24
- package/dist/types/src/core/record-chain.d.ts.map +0 -1
- package/dist/types/src/event-stream/event-emitter-event-log.d.ts +0 -80
- package/dist/types/src/event-stream/event-emitter-event-log.d.ts.map +0 -1
- package/dist/types/src/handlers/messages-sync.d.ts +0 -83
- package/dist/types/src/handlers/messages-sync.d.ts.map +0 -1
- package/dist/types/src/interfaces/messages-sync.d.ts +0 -23
- package/dist/types/src/interfaces/messages-sync.d.ts.map +0 -1
- package/dist/types/src/smt/smt-store-level.d.ts +0 -32
- package/dist/types/src/smt/smt-store-level.d.ts.map +0 -1
- package/dist/types/src/smt/smt-store-memory.d.ts +0 -22
- package/dist/types/src/smt/smt-store-memory.d.ts.map +0 -1
- package/dist/types/src/smt/smt-utils.d.ts +0 -58
- package/dist/types/src/smt/smt-utils.d.ts.map +0 -1
- package/dist/types/src/smt/sparse-merkle-tree.d.ts +0 -124
- package/dist/types/src/smt/sparse-merkle-tree.d.ts.map +0 -1
- package/dist/types/src/state-index/state-index-level.d.ts +0 -83
- package/dist/types/src/state-index/state-index-level.d.ts.map +0 -1
- package/dist/types/src/sync/records-projection.d.ts +0 -98
- package/dist/types/src/sync/records-projection.d.ts.map +0 -1
- package/dist/types/src/types/smt-types.d.ts +0 -81
- package/dist/types/src/types/smt-types.d.ts.map +0 -1
- package/dist/types/src/types/state-index.d.ts +0 -90
- package/dist/types/src/types/state-index.d.ts.map +0 -1
- package/dist/types/tests/event-emitter-event-log.spec.d.ts +0 -2
- package/dist/types/tests/event-emitter-event-log.spec.d.ts.map +0 -1
- package/dist/types/tests/handlers/messages-sync.spec.d.ts +0 -2
- package/dist/types/tests/handlers/messages-sync.spec.d.ts.map +0 -1
- package/dist/types/tests/smt/smt-store-level.spec.d.ts +0 -2
- package/dist/types/tests/smt/smt-store-level.spec.d.ts.map +0 -1
- package/dist/types/tests/smt/sparse-merkle-tree.spec.d.ts +0 -2
- package/dist/types/tests/smt/sparse-merkle-tree.spec.d.ts.map +0 -1
- package/dist/types/tests/state-index/state-index-level.spec.d.ts +0 -2
- package/dist/types/tests/state-index/state-index-level.spec.d.ts.map +0 -1
- package/dist/types/tests/sync/records-projection.spec.d.ts +0 -2
- package/dist/types/tests/sync/records-projection.spec.d.ts.map +0 -1
- package/src/core/record-chain.ts +0 -99
- package/src/event-stream/event-emitter-event-log.ts +0 -430
- package/src/handlers/messages-sync.ts +0 -896
- package/src/interfaces/messages-sync.ts +0 -86
- package/src/smt/smt-store-level.ts +0 -143
- package/src/smt/smt-store-memory.ts +0 -53
- package/src/smt/smt-utils.ts +0 -149
- package/src/smt/sparse-merkle-tree.ts +0 -698
- package/src/state-index/state-index-level.ts +0 -239
- package/src/sync/records-projection.ts +0 -328
- package/src/types/smt-types.ts +0 -95
- package/src/types/state-index.ts +0 -100
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LevelDB-backed implementation of the StateIndex interface.
|
|
3
|
-
*
|
|
4
|
-
* Manages per-tenant Sparse Merkle Trees (global + per-protocol sub-trees).
|
|
5
|
-
*
|
|
6
|
-
* All data lives within a single LevelDB instance, partitioned by sublevels:
|
|
7
|
-
* {tenant}/global/ -> SMT nodes + root for the tenant's global tree
|
|
8
|
-
* {tenant}/proto/{proto}/ -> SMT nodes + root for a protocol-scoped tree
|
|
9
|
-
* {tenant}/meta/{cid} -> JSON(indexes) for reverse lookup during deletion
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import type { Hash } from '../types/smt-types.js';
|
|
13
|
-
import type { KeyValues } from '../types/query-types.js';
|
|
14
|
-
import type { StateIndex } from '../types/state-index.js';
|
|
15
|
-
|
|
16
|
-
import { initDefaultHashes } from '../smt/smt-utils.js';
|
|
17
|
-
import { SMTStoreLevel } from '../smt/smt-store-level.js';
|
|
18
|
-
import { SparseMerkleTree } from '../smt/sparse-merkle-tree.js';
|
|
19
|
-
import { createLevelDatabase, LevelWrapper } from '../store/level-wrapper.js';
|
|
20
|
-
|
|
21
|
-
export type StateIndexLevelConfig = {
|
|
22
|
-
/**
|
|
23
|
-
* Must be a directory path (relative or absolute) where LevelDB will store its files,
|
|
24
|
-
* or in browsers, the name of the IDBDatabase to be opened.
|
|
25
|
-
*/
|
|
26
|
-
location? : string;
|
|
27
|
-
createLevelDatabase? : typeof createLevelDatabase;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export class StateIndexLevel implements StateIndex {
|
|
31
|
-
private readonly config: StateIndexLevelConfig;
|
|
32
|
-
private db!: LevelWrapper<string>;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Cache of per-tenant global SMTs. Lazily populated on first access.
|
|
36
|
-
* Stores promises to avoid race conditions when multiple concurrent operations
|
|
37
|
-
* trigger lazy initialization of the same tenant's SMT.
|
|
38
|
-
*/
|
|
39
|
-
private readonly globalTrees: Map<string, Promise<SparseMerkleTree>> = new Map();
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Cache of per-tenant, per-protocol SMTs. Key format: `{tenant}\x00{protocol}`
|
|
43
|
-
* Stores promises to avoid race conditions (same reason as globalTrees).
|
|
44
|
-
*/
|
|
45
|
-
private readonly protocolTrees: Map<string, Promise<SparseMerkleTree>> = new Map();
|
|
46
|
-
|
|
47
|
-
constructor(config?: StateIndexLevelConfig) {
|
|
48
|
-
this.config = {
|
|
49
|
-
location : 'STATEINDEX',
|
|
50
|
-
createLevelDatabase : createLevelDatabase,
|
|
51
|
-
...config,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async open(): Promise<void> {
|
|
56
|
-
this.db = new LevelWrapper<string>({
|
|
57
|
-
location : this.config.location!,
|
|
58
|
-
createLevelDatabase : this.config.createLevelDatabase,
|
|
59
|
-
keyEncoding : 'utf8',
|
|
60
|
-
});
|
|
61
|
-
await this.db.open();
|
|
62
|
-
|
|
63
|
-
// Ensure default hashes are initialized
|
|
64
|
-
await initDefaultHashes();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async close(): Promise<void> {
|
|
68
|
-
this.globalTrees.clear();
|
|
69
|
-
this.protocolTrees.clear();
|
|
70
|
-
|
|
71
|
-
await this.db.close();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
async clear(): Promise<void> {
|
|
75
|
-
this.globalTrees.clear();
|
|
76
|
-
this.protocolTrees.clear();
|
|
77
|
-
|
|
78
|
-
await this.db.clear();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
async insert(tenant: string, messageCid: string, indexes: KeyValues): Promise<void> {
|
|
82
|
-
// Insert into the global tree
|
|
83
|
-
const globalSmt = await this.getGlobalTree(tenant);
|
|
84
|
-
await globalSmt.insert(messageCid);
|
|
85
|
-
|
|
86
|
-
// Insert into the protocol-scoped tree if the message has a protocol (e.g. RecordsWrite).
|
|
87
|
-
// Non-record messages like ProtocolsConfigure do not have a protocol.
|
|
88
|
-
const protocol = indexes.protocol as string | undefined;
|
|
89
|
-
if (protocol !== undefined) {
|
|
90
|
-
const protoSmt = await this.getProtocolTree(tenant, protocol);
|
|
91
|
-
await protoSmt.insert(messageCid);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Store the reverse lookup so we know the protocol during deletion
|
|
95
|
-
await this.storeIndexes(tenant, messageCid, indexes);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
async delete(tenant: string, messageCids: string[]): Promise<void> {
|
|
99
|
-
const globalSmt = await this.getGlobalTree(tenant);
|
|
100
|
-
|
|
101
|
-
for (const messageCid of messageCids) {
|
|
102
|
-
// Look up stored indexes to find the protocol
|
|
103
|
-
const indexes = await this.getStoredIndexes(tenant, messageCid);
|
|
104
|
-
|
|
105
|
-
// Delete from global tree
|
|
106
|
-
await globalSmt.delete(messageCid);
|
|
107
|
-
|
|
108
|
-
// Delete from protocol tree if the message had a protocol
|
|
109
|
-
if (indexes !== undefined) {
|
|
110
|
-
const protocol = indexes.protocol as string | undefined;
|
|
111
|
-
if (protocol !== undefined) {
|
|
112
|
-
const protoSmt = await this.getProtocolTree(tenant, protocol);
|
|
113
|
-
await protoSmt.delete(messageCid);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Remove the reverse lookup
|
|
118
|
-
await this.deleteStoredIndexes(tenant, messageCid);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
async getRoot(tenant: string): Promise<Hash> {
|
|
123
|
-
const smt = await this.getGlobalTree(tenant);
|
|
124
|
-
return smt.getRoot();
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
async getProtocolRoot(tenant: string, protocol: string): Promise<Hash> {
|
|
128
|
-
const smt = await this.getProtocolTree(tenant, protocol);
|
|
129
|
-
return smt.getRoot();
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
async getSubtreeHash(tenant: string, prefix: boolean[]): Promise<Hash> {
|
|
133
|
-
const smt = await this.getGlobalTree(tenant);
|
|
134
|
-
return smt.getSubtreeHash(prefix);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
async getProtocolSubtreeHash(tenant: string, protocol: string, prefix: boolean[]): Promise<Hash> {
|
|
138
|
-
const smt = await this.getProtocolTree(tenant, protocol);
|
|
139
|
-
return smt.getSubtreeHash(prefix);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
async getLeaves(tenant: string, prefix: boolean[]): Promise<string[]> {
|
|
143
|
-
const smt = await this.getGlobalTree(tenant);
|
|
144
|
-
return smt.getLeaves(prefix);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async getProtocolLeaves(tenant: string, protocol: string, prefix: boolean[]): Promise<string[]> {
|
|
148
|
-
const smt = await this.getProtocolTree(tenant, protocol);
|
|
149
|
-
return smt.getLeaves(prefix);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// ─── Private helpers ────────────────────────────────────────────────────
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Get or create the global SMT for a tenant.
|
|
156
|
-
* Uses a promise-based cache to prevent concurrent callers from racing to
|
|
157
|
-
* initialize the same tenant's SMT twice.
|
|
158
|
-
*/
|
|
159
|
-
private getGlobalTree(tenant: string): Promise<SparseMerkleTree> {
|
|
160
|
-
let smtPromise = this.globalTrees.get(tenant);
|
|
161
|
-
if (smtPromise !== undefined) {
|
|
162
|
-
return smtPromise;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
smtPromise = this.createTree(this.db, [tenant, 'global']);
|
|
166
|
-
this.globalTrees.set(tenant, smtPromise);
|
|
167
|
-
return smtPromise;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Get or create a protocol-scoped SMT for a tenant.
|
|
172
|
-
* Uses a promise-based cache to prevent concurrent callers from racing to
|
|
173
|
-
* initialize the same tenant's SMT twice.
|
|
174
|
-
*/
|
|
175
|
-
private getProtocolTree(tenant: string, protocol: string): Promise<SparseMerkleTree> {
|
|
176
|
-
const cacheKey = `${tenant}\x00${protocol}`;
|
|
177
|
-
let smtPromise = this.protocolTrees.get(cacheKey);
|
|
178
|
-
if (smtPromise !== undefined) {
|
|
179
|
-
return smtPromise;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
smtPromise = this.createTree(this.db, [tenant, 'proto', protocol]);
|
|
183
|
-
this.protocolTrees.set(cacheKey, smtPromise);
|
|
184
|
-
return smtPromise;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Create and initialize a new SparseMerkleTree backed by a sublevel chain
|
|
189
|
-
* within the single LevelDB instance.
|
|
190
|
-
*/
|
|
191
|
-
private async createTree(db: LevelWrapper<string>, sublevels: string[]): Promise<SparseMerkleTree> {
|
|
192
|
-
let partition = db;
|
|
193
|
-
for (const name of sublevels) {
|
|
194
|
-
partition = await partition.partition(name);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
const store = new SMTStoreLevel(partition);
|
|
198
|
-
const smt = new SparseMerkleTree(store);
|
|
199
|
-
await smt.initialize();
|
|
200
|
-
return smt;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Store the indexes for a messageCid so we can look up the protocol during deletion.
|
|
205
|
-
*/
|
|
206
|
-
private async storeIndexes(tenant: string, messageCid: string, indexes: KeyValues): Promise<void> {
|
|
207
|
-
const metaPartition = await this.getMetaPartition(tenant);
|
|
208
|
-
// Store the protocol index needed for deletion
|
|
209
|
-
const minimalIndexes: KeyValues = { protocol: indexes.protocol };
|
|
210
|
-
await metaPartition.put(messageCid, JSON.stringify(minimalIndexes));
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Get the stored indexes for a messageCid.
|
|
215
|
-
*/
|
|
216
|
-
private async getStoredIndexes(tenant: string, messageCid: string): Promise<KeyValues | undefined> {
|
|
217
|
-
const metaPartition = await this.getMetaPartition(tenant);
|
|
218
|
-
const value = await metaPartition.get(messageCid);
|
|
219
|
-
if (value === undefined) {
|
|
220
|
-
return undefined;
|
|
221
|
-
}
|
|
222
|
-
return JSON.parse(value) as KeyValues;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Delete the stored indexes for a messageCid.
|
|
227
|
-
*/
|
|
228
|
-
private async deleteStoredIndexes(tenant: string, messageCid: string): Promise<void> {
|
|
229
|
-
const metaPartition = await this.getMetaPartition(tenant);
|
|
230
|
-
await metaPartition.delete(messageCid);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Get the metadata partition for a tenant.
|
|
235
|
-
*/
|
|
236
|
-
private async getMetaPartition(tenant: string): Promise<LevelWrapper<string>> {
|
|
237
|
-
return (await this.db.partition(tenant)).partition('meta');
|
|
238
|
-
}
|
|
239
|
-
}
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
import type { Filter } from '../types/query-types.js';
|
|
2
|
-
import type { Hash } from '../types/smt-types.js';
|
|
3
|
-
import type { MessageStore, MessageStoreOptions } from '../types/message-store.js';
|
|
4
|
-
|
|
5
|
-
import { DwnInterfaceName } from '../enums/dwn-interface-method.js';
|
|
6
|
-
import { FilterUtility } from '../utils/filter.js';
|
|
7
|
-
import { hashToHex } from '../smt/smt-utils.js';
|
|
8
|
-
import { isRecordsPrimaryProjectionExcludedProtocol } from '../core/constants.js';
|
|
9
|
-
import { lexicographicalCompare } from '../utils/string.js';
|
|
10
|
-
import { Message } from '../core/message.js';
|
|
11
|
-
import { SMTStoreMemory } from '../smt/smt-store-memory.js';
|
|
12
|
-
import { SparseMerkleTree } from '../smt/sparse-merkle-tree.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Projection-root algorithm for record-primary scoped subsets.
|
|
16
|
-
*
|
|
17
|
-
* This version builds an on-demand SMT over latest Records primary message CIDs
|
|
18
|
-
* selected by protocol plus optional exact protocolPath or context subtree.
|
|
19
|
-
* Dependency records, protocol configs, and record data payloads are not part
|
|
20
|
-
* of this root.
|
|
21
|
-
*/
|
|
22
|
-
export const RECORDS_PROJECTION_ROOT_VERSION = 'records-primary-scope-root-v1';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* A Records primary projection scope.
|
|
26
|
-
*
|
|
27
|
-
* `protocolPath` is an exact type-path match. `contextId` is a boundary-aware
|
|
28
|
-
* subtree match: the candidate context must equal the scoped context or start
|
|
29
|
-
* with `${contextId}/`. `protocolPath` and `contextId` are mutually exclusive.
|
|
30
|
-
*/
|
|
31
|
-
export type RecordsProjectionScope = {
|
|
32
|
-
protocol: string;
|
|
33
|
-
protocolPath?: string;
|
|
34
|
-
contextId?: string;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type RecordsProjectionInput = {
|
|
38
|
-
tenant: string;
|
|
39
|
-
messageStore: MessageStore;
|
|
40
|
-
scopes: readonly [RecordsProjectionScope, ...RecordsProjectionScope[]];
|
|
41
|
-
options?: MessageStoreOptions;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export type RecordsProjectionTreeInput = RecordsProjectionInput & {
|
|
45
|
-
prefix: boolean[];
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type RecordsProjectionSnapshot = {
|
|
49
|
-
getRoot(): Promise<Hash>;
|
|
50
|
-
getRootHex(): Promise<string>;
|
|
51
|
-
getSubtreeHash(prefix: boolean[]): Promise<Hash>;
|
|
52
|
-
getLeaves(prefix: boolean[]): Promise<string[]>;
|
|
53
|
-
close(): Promise<void>;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export type NormalizedRecordsProjectionScope = {
|
|
57
|
-
protocol: string;
|
|
58
|
-
} | {
|
|
59
|
-
protocol: string;
|
|
60
|
-
protocolPath: string;
|
|
61
|
-
} | {
|
|
62
|
-
protocol: string;
|
|
63
|
-
contextId: string;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Computes deterministic on-demand roots for Records projections.
|
|
68
|
-
*
|
|
69
|
-
* The snapshot API performs one store enumeration and serves tree operations
|
|
70
|
-
* from that in-memory view. A future store-level snapshot/high-watermark can be
|
|
71
|
-
* threaded through the `options` input without changing the projection shape.
|
|
72
|
-
*/
|
|
73
|
-
export class RecordsProjection {
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Returns the sorted latest Records primary message CIDs covered by a scope union.
|
|
77
|
-
*/
|
|
78
|
-
public static async getPrimaryMessageCids({
|
|
79
|
-
tenant,
|
|
80
|
-
messageStore,
|
|
81
|
-
scopes,
|
|
82
|
-
options,
|
|
83
|
-
}: RecordsProjectionInput): Promise<string[]> {
|
|
84
|
-
const filters = RecordsProjection.normalizeScopes(scopes)
|
|
85
|
-
.filter(scope => !isRecordsPrimaryProjectionExcludedProtocol(scope.protocol))
|
|
86
|
-
.flatMap(scope => RecordsProjection.constructFilters(scope));
|
|
87
|
-
if (filters.length === 0) {
|
|
88
|
-
return [];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const { messages } = await messageStore.query(tenant, filters, undefined, undefined, options);
|
|
92
|
-
const messageCids = await Promise.all(messages.map(message => Message.getCid(message)));
|
|
93
|
-
|
|
94
|
-
return [...new Set(messageCids)].sort(lexicographicalCompare); // NOSONAR — projection IDs require locale-independent bytewise ordering.
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Returns the projection root hash.
|
|
99
|
-
*/
|
|
100
|
-
public static async getRoot(input: RecordsProjectionInput): Promise<Hash> {
|
|
101
|
-
return RecordsProjection.withTree(input, tree => tree.getRoot());
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Returns the projection root hash encoded as lowercase hex.
|
|
106
|
-
*/
|
|
107
|
-
public static async getRootHex(input: RecordsProjectionInput): Promise<string> {
|
|
108
|
-
return hashToHex(await RecordsProjection.getRoot(input));
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Returns the subtree hash for a bit prefix within this projection.
|
|
113
|
-
*/
|
|
114
|
-
public static async getSubtreeHash(input: RecordsProjectionTreeInput): Promise<Hash> {
|
|
115
|
-
return RecordsProjection.withTree(input, tree => tree.getSubtreeHash(input.prefix));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Returns the message CIDs under a bit prefix within this projection.
|
|
120
|
-
*/
|
|
121
|
-
public static async getLeaves(input: RecordsProjectionTreeInput): Promise<string[]> {
|
|
122
|
-
return RecordsProjection.withTree(input, tree => tree.getLeaves(input.prefix));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Builds an in-memory projection tree from one primary-CID enumeration.
|
|
127
|
-
*/
|
|
128
|
-
public static async createSnapshot(input: RecordsProjectionInput): Promise<RecordsProjectionSnapshot> {
|
|
129
|
-
const tree = await RecordsProjection.createTree(input);
|
|
130
|
-
return {
|
|
131
|
-
close : () => tree.close(),
|
|
132
|
-
getLeaves : (prefix: boolean[]) => tree.getLeaves(prefix),
|
|
133
|
-
getRoot : () => tree.getRoot(),
|
|
134
|
-
getRootHex : async () => hashToHex(await tree.getRoot()),
|
|
135
|
-
getSubtreeHash : (prefix: boolean[]) => tree.getSubtreeHash(prefix),
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Normalizes a scope union into sorted, duplicate-free, subsumption-reduced entries.
|
|
141
|
-
*/
|
|
142
|
-
public static normalizeScopes(
|
|
143
|
-
scopes: readonly [RecordsProjectionScope, ...RecordsProjectionScope[]],
|
|
144
|
-
): [NormalizedRecordsProjectionScope, ...NormalizedRecordsProjectionScope[]] {
|
|
145
|
-
if (scopes.length === 0) {
|
|
146
|
-
throw new Error('RecordsProjection: scopes must contain at least one scope.');
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const normalized = scopes.map(scope => RecordsProjection.normalizeScope(scope));
|
|
150
|
-
const deduped = new Map<string, NormalizedRecordsProjectionScope>();
|
|
151
|
-
for (const scope of normalized) {
|
|
152
|
-
deduped.set(RecordsProjection.scopeKey(scope), scope);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const uniqueScopes = [...deduped.values()];
|
|
156
|
-
const protocolWide = new Set(
|
|
157
|
-
uniqueScopes
|
|
158
|
-
.filter(scope => RecordsProjection.isProtocolWideScope(scope))
|
|
159
|
-
.map(scope => scope.protocol)
|
|
160
|
-
);
|
|
161
|
-
|
|
162
|
-
const reduced = uniqueScopes.filter(scope => {
|
|
163
|
-
if (protocolWide.has(scope.protocol)) {
|
|
164
|
-
return RecordsProjection.isProtocolWideScope(scope);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (RecordsProjection.isContextScope(scope)) {
|
|
168
|
-
return !uniqueScopes.some(candidate =>
|
|
169
|
-
candidate !== scope &&
|
|
170
|
-
RecordsProjection.isContextScope(candidate) &&
|
|
171
|
-
candidate.protocol === scope.protocol &&
|
|
172
|
-
RecordsProjection.contextIdSubsumes(candidate.contextId, scope.contextId)
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return true;
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
const result = reduced.sort(RecordsProjection.compareScopes);
|
|
180
|
-
return result as [NormalizedRecordsProjectionScope, ...NormalizedRecordsProjectionScope[]];
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
private static async withTree<T>(
|
|
184
|
-
input: RecordsProjectionInput,
|
|
185
|
-
fn: (tree: SparseMerkleTree) => Promise<T>,
|
|
186
|
-
): Promise<T> {
|
|
187
|
-
const tree = await RecordsProjection.createTree(input);
|
|
188
|
-
|
|
189
|
-
try {
|
|
190
|
-
return await fn(tree);
|
|
191
|
-
} finally {
|
|
192
|
-
await tree.close();
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
private static async createTree(input: RecordsProjectionInput): Promise<SparseMerkleTree> {
|
|
197
|
-
const tree = new SparseMerkleTree(new SMTStoreMemory());
|
|
198
|
-
await tree.initialize();
|
|
199
|
-
|
|
200
|
-
try {
|
|
201
|
-
const messageCids = await RecordsProjection.getPrimaryMessageCids(input);
|
|
202
|
-
for (const messageCid of messageCids) {
|
|
203
|
-
await tree.insert(messageCid);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return tree;
|
|
207
|
-
} catch (error) {
|
|
208
|
-
await tree.close();
|
|
209
|
-
throw error;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
private static normalizeScope(scope: RecordsProjectionScope): NormalizedRecordsProjectionScope {
|
|
214
|
-
const protocol = RecordsProjection.requireNonEmptyString(scope.protocol, 'protocol');
|
|
215
|
-
|
|
216
|
-
if (scope.protocolPath !== undefined && scope.contextId !== undefined) {
|
|
217
|
-
throw new Error('RecordsProjection: protocolPath and contextId scopes are mutually exclusive.');
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (scope.protocolPath !== undefined) {
|
|
221
|
-
return {
|
|
222
|
-
protocol,
|
|
223
|
-
protocolPath: RecordsProjection.requireNonEmptyString(scope.protocolPath, 'protocolPath'),
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (scope.contextId !== undefined) {
|
|
228
|
-
return {
|
|
229
|
-
protocol,
|
|
230
|
-
contextId: RecordsProjection.requireNonEmptyString(scope.contextId, 'contextId'),
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return { protocol };
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
private static constructFilters(scope: NormalizedRecordsProjectionScope): Filter[] {
|
|
238
|
-
const baseFilter: Filter = {
|
|
239
|
-
interface : DwnInterfaceName.Records,
|
|
240
|
-
isLatestBaseState : true,
|
|
241
|
-
protocol : scope.protocol,
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
if ('protocolPath' in scope) {
|
|
245
|
-
return [{ ...baseFilter, protocolPath: scope.protocolPath }];
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
if ('contextId' in scope) {
|
|
249
|
-
const childContextPrefix = `${scope.contextId}/`;
|
|
250
|
-
return [
|
|
251
|
-
{ ...baseFilter, contextId: scope.contextId },
|
|
252
|
-
{
|
|
253
|
-
...baseFilter,
|
|
254
|
-
contextId: FilterUtility.constructPrefixFilterAsRangeFilter(childContextPrefix),
|
|
255
|
-
},
|
|
256
|
-
];
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return [baseFilter];
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
private static requireNonEmptyString(value: string, field: string): string {
|
|
263
|
-
if (typeof value !== 'string' || value.length === 0) {
|
|
264
|
-
throw new Error(`RecordsProjection: ${field} must be a non-empty string.`);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return value;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
private static scopeKey(scope: NormalizedRecordsProjectionScope): string {
|
|
271
|
-
if ('protocolPath' in scope) {
|
|
272
|
-
return `${scope.protocol}\u001fprotocolPath\u001f${scope.protocolPath}`;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
if ('contextId' in scope) {
|
|
276
|
-
return `${scope.protocol}\u001fcontextId\u001f${scope.contextId}`;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
return `${scope.protocol}\u001fprotocol`;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
private static isProtocolWideScope(
|
|
283
|
-
scope: NormalizedRecordsProjectionScope,
|
|
284
|
-
): scope is { protocol: string } {
|
|
285
|
-
return !('protocolPath' in scope) && !('contextId' in scope);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
private static isContextScope(
|
|
289
|
-
scope: NormalizedRecordsProjectionScope,
|
|
290
|
-
): scope is { protocol: string; contextId: string } {
|
|
291
|
-
return 'contextId' in scope;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
private static contextIdSubsumes(parentContextId: string, childContextId: string): boolean {
|
|
295
|
-
return childContextId === parentContextId ||
|
|
296
|
-
childContextId.startsWith(`${parentContextId}/`);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
private static compareScopes(
|
|
300
|
-
a: NormalizedRecordsProjectionScope,
|
|
301
|
-
b: NormalizedRecordsProjectionScope,
|
|
302
|
-
): number {
|
|
303
|
-
const protocolCompare = lexicographicalCompare(a.protocol, b.protocol);
|
|
304
|
-
if (protocolCompare !== 0) {
|
|
305
|
-
return protocolCompare;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
const aRank = RecordsProjection.scopeRank(a);
|
|
309
|
-
const bRank = RecordsProjection.scopeRank(b);
|
|
310
|
-
if (aRank !== bRank) {
|
|
311
|
-
return aRank - bRank;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
return lexicographicalCompare(RecordsProjection.scopeValue(a), RecordsProjection.scopeValue(b));
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
private static scopeRank(scope: NormalizedRecordsProjectionScope): number {
|
|
318
|
-
if ('protocolPath' in scope) { return 1; }
|
|
319
|
-
if ('contextId' in scope) { return 2; }
|
|
320
|
-
return 0;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
private static scopeValue(scope: NormalizedRecordsProjectionScope): string {
|
|
324
|
-
if ('protocolPath' in scope) { return scope.protocolPath; }
|
|
325
|
-
if ('contextId' in scope) { return scope.contextId; }
|
|
326
|
-
return '';
|
|
327
|
-
}
|
|
328
|
-
}
|
package/src/types/smt-types.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types for the Sparse Merkle Tree implementation.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A 32-byte hash (SHA-256 output).
|
|
7
|
-
*/
|
|
8
|
-
export type Hash = Uint8Array;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Represents the path through the tree as a sequence of bits derived from the key hash.
|
|
12
|
-
* Each bit determines whether to go left (0) or right (1) at each depth level.
|
|
13
|
-
*/
|
|
14
|
-
export type BitPath = boolean[];
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* A node in the Sparse Merkle Tree.
|
|
18
|
-
*
|
|
19
|
-
* - `internal`: has left and right child hashes but no leaf data
|
|
20
|
-
* - `leaf`: has a key hash and value (the messageCid) but no children
|
|
21
|
-
* - empty subtrees are represented implicitly via precomputed default hashes
|
|
22
|
-
*/
|
|
23
|
-
export type SMTNode =
|
|
24
|
-
| SMTInternalNode
|
|
25
|
-
| SMTLeafNode;
|
|
26
|
-
|
|
27
|
-
export type SMTInternalNode = {
|
|
28
|
-
type : 'internal';
|
|
29
|
-
leftHash : Hash;
|
|
30
|
-
rightHash : Hash;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type SMTLeafNode = {
|
|
34
|
-
type : 'leaf';
|
|
35
|
-
keyHash : Hash;
|
|
36
|
-
valueCid : string;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* An inclusion or non-inclusion proof for a key in the SMT.
|
|
41
|
-
*
|
|
42
|
-
* - `siblings`: the sibling hashes along the path from leaf to root
|
|
43
|
-
* - `leafNode`: the leaf node at the path (undefined if non-inclusion proof for an empty slot)
|
|
44
|
-
* - `depth`: the depth at which the proof terminates
|
|
45
|
-
*/
|
|
46
|
-
export type SMTProof = {
|
|
47
|
-
siblings : Hash[];
|
|
48
|
-
leafNode : SMTLeafNode | undefined;
|
|
49
|
-
depth : number;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Result of diffing two SMT roots.
|
|
54
|
-
*/
|
|
55
|
-
export type SMTDiffResult = {
|
|
56
|
-
/** messageCids present in the local tree but not the remote tree */
|
|
57
|
-
onlyLocal : string[];
|
|
58
|
-
/** messageCids present in the remote tree but not the local tree */
|
|
59
|
-
onlyRemote : string[];
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Interface for persisting SMT nodes. Implementations can use LevelDB, SQL, or in-memory maps.
|
|
64
|
-
* Nodes are keyed by their hash. The root hash is stored separately.
|
|
65
|
-
*/
|
|
66
|
-
export interface SMTNodeStore {
|
|
67
|
-
open(): Promise<void>;
|
|
68
|
-
close(): Promise<void>;
|
|
69
|
-
clear(): Promise<void>;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Get a node by its hash. Returns undefined if not found.
|
|
73
|
-
*/
|
|
74
|
-
getNode(hash: Hash): Promise<SMTNode | undefined>;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Store a node, keyed by its hash.
|
|
78
|
-
*/
|
|
79
|
-
putNode(hash: Hash, node: SMTNode): Promise<void>;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Delete a node by its hash.
|
|
83
|
-
*/
|
|
84
|
-
deleteNode(hash: Hash): Promise<void>;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Get the current root hash. Returns undefined if no root has been set.
|
|
88
|
-
*/
|
|
89
|
-
getRoot(): Promise<Hash | undefined>;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Set the root hash.
|
|
93
|
-
*/
|
|
94
|
-
setRoot(hash: Hash): Promise<void>;
|
|
95
|
-
}
|