@enbox/dwn-sdk-js 0.4.0 → 0.4.2
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 +3 -10
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/generated/precompiled-validators.js +799 -885
- 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 +12 -4
- 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 -45
- 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 +34 -89
- 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 +123 -28
- package/dist/esm/src/core/replication-apply.js.map +1 -1
- 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 +165 -132
- 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 +6 -7
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/interfaces/{messages-sync.js → messages-query.js} +21 -15
- package/dist/esm/src/interfaces/messages-query.js.map +1 -0
- package/dist/esm/src/interfaces/protocols-configure.js +12 -9
- 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/protocol-tags.js +262 -0
- package/dist/esm/src/utils/protocol-tags.js.map +1 -0
- 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 +55 -1
- package/dist/esm/tests/core/replication-apply.spec.js.map +1 -1
- 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 +504 -35
- 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 +82 -36
- 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 -2
- package/dist/esm/tests/test-suite.js.map +1 -1
- package/dist/esm/tests/utils/protocol-tags.spec.js +96 -0
- package/dist/esm/tests/utils/protocol-tags.spec.js.map +1 -0
- 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 +12 -4
- 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 -14
- 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 +14 -17
- 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 +36 -0
- package/dist/types/src/core/replication-apply.d.ts.map +1 -1
- 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 +33 -20
- 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 +14 -16
- 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 -37
- 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/protocol-tags.d.ts +15 -0
- package/dist/types/src/utils/protocol-tags.d.ts.map +1 -0
- 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-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/protocol-tags.spec.d.ts +2 -0
- package/dist/types/tests/utils/protocol-tags.spec.d.ts.map +1 -0
- 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 +12 -4
- package/src/core/grant-authorization.ts +11 -20
- package/src/core/message-reply.ts +6 -5
- package/src/core/messages-grant-authorization.ts +37 -70
- package/src/core/protocol-authorization-action.ts +29 -38
- package/src/core/protocol-authorization-validation.ts +47 -121
- 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 +172 -32
- package/src/core/resumable-task-manager.ts +10 -8
- package/src/core/validation-state-reader.ts +350 -0
- package/src/dwn.ts +285 -192
- 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 +14 -17
- package/src/interfaces/messages-query.ts +70 -0
- package/src/interfaces/protocols-configure.ts +20 -10
- 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 -45
- 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/protocol-tags.ts +366 -0
- 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 -278
- package/dist/esm/src/handlers/messages-sync.js.map +0 -1
- 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/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 -1088
- 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/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 -39
- package/dist/types/src/handlers/messages-sync.d.ts.map +0 -1
- package/dist/types/src/interfaces/messages-sync.d.ts +0 -20
- 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/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/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 -403
- package/src/interfaces/messages-sync.ts +0 -69
- 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/types/smt-types.ts +0 -95
- package/src/types/state-index.ts +0 -100
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type { CoreProtocolRegistry } from './core-protocol.js';
|
|
2
|
-
import type { Filter } from '../types/query-types.js';
|
|
3
|
-
import type { MessageStore } from '../types/message-store.js';
|
|
4
1
|
import type { RecordsCount } from '../interfaces/records-count.js';
|
|
5
2
|
import type { RecordsDelete } from '../interfaces/records-delete.js';
|
|
6
3
|
import type { RecordsQuery } from '../interfaces/records-query.js';
|
|
@@ -8,16 +5,14 @@ import type { RecordsRead } from '../interfaces/records-read.js';
|
|
|
8
5
|
import type { RecordsSubscribe } from '../interfaces/records-subscribe.js';
|
|
9
6
|
import type { RecordsWrite } from '../interfaces/records-write.js';
|
|
10
7
|
import type { RecordsWriteMessage } from '../types/records-types.js';
|
|
11
|
-
import type {
|
|
8
|
+
import type { ValidationStateReader } from '../types/validation-state-reader.js';
|
|
9
|
+
import type { ProtocolDefinition, ProtocolRuleSet } from '../types/protocols-types.js';
|
|
12
10
|
|
|
13
11
|
import { getRuleSetAtPath } from '../utils/protocols.js';
|
|
14
|
-
import { SortDirection } from '../types/query-types.js';
|
|
15
12
|
import { DwnError, DwnErrorCode } from './dwn-error.js';
|
|
16
|
-
import { DwnInterfaceName, DwnMethodName } from '../enums/dwn-interface-method.js';
|
|
17
13
|
import { ProtocolAction, ProtocolActor } from '../types/protocols-types.js';
|
|
18
14
|
|
|
19
15
|
import { authorizeAgainstAllowedActions, verifyInvokedRole } from './protocol-authorization-action.js';
|
|
20
|
-
import { constructRecordChain, fetchInitialWrite, getGoverningTimestamp } from './record-chain.js';
|
|
21
16
|
import {
|
|
22
17
|
verifyAsRoleRecordIfNeeded,
|
|
23
18
|
verifyImmutability,
|
|
@@ -29,17 +24,6 @@ import {
|
|
|
29
24
|
verifyTypeWithComposition,
|
|
30
25
|
} from './protocol-authorization-validation.js';
|
|
31
26
|
|
|
32
|
-
/**
|
|
33
|
-
* Function signature for fetching a protocol definition.
|
|
34
|
-
* Used by extracted modules to break the circular dependency on `ProtocolAuthorization`.
|
|
35
|
-
*/
|
|
36
|
-
export type FetchProtocolDefinitionFn = (
|
|
37
|
-
tenant: string,
|
|
38
|
-
protocolUri: string,
|
|
39
|
-
messageStore: MessageStore,
|
|
40
|
-
messageTimestamp?: string,
|
|
41
|
-
) => Promise<ProtocolDefinition>;
|
|
42
|
-
|
|
43
27
|
export class ProtocolAuthorization {
|
|
44
28
|
|
|
45
29
|
/**
|
|
@@ -49,39 +33,26 @@ export class ProtocolAuthorization {
|
|
|
49
33
|
public static async validateReferentialIntegrity(
|
|
50
34
|
tenant: string,
|
|
51
35
|
incomingMessage: RecordsWrite,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// Determine the governing timestamp for protocol definition lookup.
|
|
56
|
-
// For an initial write, this is the message's own timestamp.
|
|
57
|
-
// For an update, this is the initial write's timestamp (the protocol version is locked at creation time).
|
|
58
|
-
const governingTimestamp = await getGoverningTimestamp(
|
|
59
|
-
tenant, incomingMessage, messageStore
|
|
60
|
-
);
|
|
36
|
+
validationStateReader: ValidationStateReader,
|
|
37
|
+
): Promise<ProtocolRuleSet> {
|
|
38
|
+
const protocolDefinitionTimestamp = incomingMessage.message.descriptor.messageTimestamp;
|
|
61
39
|
|
|
62
|
-
// fetch the protocol definition
|
|
63
|
-
const protocolDefinition = await
|
|
40
|
+
// fetch the protocol definition active at the incoming message timestamp
|
|
41
|
+
const protocolDefinition = await validationStateReader.fetchProtocolDefinition(
|
|
64
42
|
tenant,
|
|
65
43
|
incomingMessage.message.descriptor.protocol,
|
|
66
|
-
|
|
67
|
-
governingTimestamp,
|
|
68
|
-
coreProtocols,
|
|
44
|
+
protocolDefinitionTimestamp,
|
|
69
45
|
);
|
|
70
46
|
|
|
71
|
-
// Create a bound fetch function that captures the registry for downstream callbacks.
|
|
72
|
-
const boundFetchDefinition = ProtocolAuthorization.createBoundFetchDefinition(coreProtocols);
|
|
73
|
-
|
|
74
47
|
// verify declared protocol type exists in protocol and that it conforms to type specification.
|
|
75
48
|
// For cross-protocol composition, the type may be defined in a referenced protocol.
|
|
76
49
|
await verifyTypeWithComposition(
|
|
77
|
-
tenant, incomingMessage.message, protocolDefinition,
|
|
78
|
-
boundFetchDefinition, governingTimestamp
|
|
50
|
+
tenant, incomingMessage.message, protocolDefinition, validationStateReader, protocolDefinitionTimestamp
|
|
79
51
|
);
|
|
80
52
|
|
|
81
53
|
// validate `protocolPath`
|
|
82
54
|
await verifyProtocolPathAndContextId(
|
|
83
|
-
tenant, incomingMessage,
|
|
84
|
-
boundFetchDefinition, governingTimestamp,
|
|
55
|
+
tenant, incomingMessage, validationStateReader, protocolDefinitionTimestamp,
|
|
85
56
|
);
|
|
86
57
|
|
|
87
58
|
// get the rule set for the inbound message
|
|
@@ -95,7 +66,7 @@ export class ProtocolAuthorization {
|
|
|
95
66
|
tenant,
|
|
96
67
|
incomingMessage,
|
|
97
68
|
ruleSet,
|
|
98
|
-
|
|
69
|
+
validationStateReader,
|
|
99
70
|
);
|
|
100
71
|
|
|
101
72
|
// Verify size limit
|
|
@@ -111,7 +82,9 @@ export class ProtocolAuthorization {
|
|
|
111
82
|
await verifySquashEligibility(incomingMessage, ruleSet);
|
|
112
83
|
|
|
113
84
|
// Verify record count limit
|
|
114
|
-
await verifyRecordLimit(
|
|
85
|
+
await verifyRecordLimit(incomingMessage, ruleSet);
|
|
86
|
+
|
|
87
|
+
return ruleSet;
|
|
115
88
|
}
|
|
116
89
|
|
|
117
90
|
/**
|
|
@@ -124,24 +97,19 @@ export class ProtocolAuthorization {
|
|
|
124
97
|
public static async validateStoredInitialWrite(
|
|
125
98
|
tenant: string,
|
|
126
99
|
incomingMessage: RecordsWrite,
|
|
127
|
-
|
|
128
|
-
coreProtocols?: CoreProtocolRegistry,
|
|
100
|
+
validationStateReader: ValidationStateReader,
|
|
129
101
|
): Promise<void> {
|
|
130
102
|
await ProtocolAuthorization.verifyStoredInitialWrite(incomingMessage);
|
|
131
103
|
|
|
132
|
-
const
|
|
133
|
-
const protocolDefinition = await
|
|
104
|
+
const protocolDefinitionTimestamp = incomingMessage.message.descriptor.messageTimestamp;
|
|
105
|
+
const protocolDefinition = await validationStateReader.fetchProtocolDefinition(
|
|
134
106
|
tenant,
|
|
135
107
|
incomingMessage.message.descriptor.protocol,
|
|
136
|
-
|
|
137
|
-
governingTimestamp,
|
|
138
|
-
coreProtocols,
|
|
108
|
+
protocolDefinitionTimestamp,
|
|
139
109
|
);
|
|
140
110
|
|
|
141
|
-
const boundFetchDefinition = ProtocolAuthorization.createBoundFetchDefinition(coreProtocols);
|
|
142
|
-
|
|
143
111
|
await verifyTypeWithComposition(
|
|
144
|
-
tenant, incomingMessage.message, protocolDefinition,
|
|
112
|
+
tenant, incomingMessage.message, protocolDefinition, validationStateReader, protocolDefinitionTimestamp
|
|
145
113
|
);
|
|
146
114
|
|
|
147
115
|
const ruleSet = ProtocolAuthorization.getRuleSet(
|
|
@@ -155,9 +123,8 @@ export class ProtocolAuthorization {
|
|
|
155
123
|
await verifySquashEligibility(incomingMessage, ruleSet);
|
|
156
124
|
ProtocolAuthorization.verifyStoredInitialWriteCreateAction(tenant, incomingMessage, ruleSet);
|
|
157
125
|
|
|
158
|
-
// `verifyRecordLimit()` is not replayed here. It
|
|
159
|
-
//
|
|
160
|
-
// Inbound writes continue to enforce record limits at admission time.
|
|
126
|
+
// `verifyRecordLimit()` is intentionally not replayed here. It only checks strategy
|
|
127
|
+
// support for new record candidates; read-time occupancy projection decides visibility.
|
|
161
128
|
}
|
|
162
129
|
|
|
163
130
|
/**
|
|
@@ -167,33 +134,27 @@ export class ProtocolAuthorization {
|
|
|
167
134
|
public static async authorizeWrite(
|
|
168
135
|
tenant: string,
|
|
169
136
|
incomingMessage: RecordsWrite,
|
|
170
|
-
|
|
171
|
-
coreProtocols?: CoreProtocolRegistry,
|
|
137
|
+
validationStateReader: ValidationStateReader,
|
|
172
138
|
): Promise<void> {
|
|
173
|
-
const existingInitialWrite = await fetchInitialWrite(tenant, incomingMessage.message.recordId
|
|
139
|
+
const existingInitialWrite = await validationStateReader.fetchInitialWrite(tenant, incomingMessage.message.recordId);
|
|
174
140
|
|
|
175
141
|
let recordChain;
|
|
176
142
|
if (existingInitialWrite === undefined) {
|
|
177
143
|
// NOTE: we can assume this message is an initial write because an existing initial write does not exist.
|
|
178
144
|
// Additionally, we check further down in the `RecordsWriteHandler` if the incoming message is an initialWrite,
|
|
179
145
|
// so we don't check explicitly here to avoid an unnecessary duplicate check.
|
|
180
|
-
recordChain = await constructRecordChain(tenant, incomingMessage.message.descriptor.parentId
|
|
146
|
+
recordChain = await validationStateReader.constructRecordChain(tenant, incomingMessage.message.descriptor.parentId);
|
|
181
147
|
} else {
|
|
182
|
-
recordChain = await constructRecordChain(tenant, incomingMessage.message.recordId
|
|
148
|
+
recordChain = await validationStateReader.constructRecordChain(tenant, incomingMessage.message.recordId);
|
|
183
149
|
}
|
|
184
150
|
|
|
185
|
-
|
|
186
|
-
const governingTimestamp = await getGoverningTimestamp(
|
|
187
|
-
tenant, incomingMessage, messageStore
|
|
188
|
-
);
|
|
151
|
+
const protocolDefinitionTimestamp = incomingMessage.message.descriptor.messageTimestamp;
|
|
189
152
|
|
|
190
|
-
// fetch the protocol definition
|
|
191
|
-
const protocolDefinition = await
|
|
153
|
+
// fetch the protocol definition active at the incoming message timestamp
|
|
154
|
+
const protocolDefinition = await validationStateReader.fetchProtocolDefinition(
|
|
192
155
|
tenant,
|
|
193
156
|
incomingMessage.message.descriptor.protocol,
|
|
194
|
-
|
|
195
|
-
governingTimestamp,
|
|
196
|
-
coreProtocols,
|
|
157
|
+
protocolDefinitionTimestamp,
|
|
197
158
|
);
|
|
198
159
|
|
|
199
160
|
// get the rule set for the inbound message
|
|
@@ -202,8 +163,6 @@ export class ProtocolAuthorization {
|
|
|
202
163
|
protocolDefinition,
|
|
203
164
|
);
|
|
204
165
|
|
|
205
|
-
const boundFetchDefinition = ProtocolAuthorization.createBoundFetchDefinition(coreProtocols);
|
|
206
|
-
|
|
207
166
|
// If the incoming message has `protocolRole` in the descriptor, validate the invoked role
|
|
208
167
|
await verifyInvokedRole(
|
|
209
168
|
tenant,
|
|
@@ -211,9 +170,8 @@ export class ProtocolAuthorization {
|
|
|
211
170
|
incomingMessage.message.descriptor.protocol,
|
|
212
171
|
incomingMessage.message.contextId,
|
|
213
172
|
protocolDefinition,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
governingTimestamp,
|
|
173
|
+
validationStateReader,
|
|
174
|
+
protocolDefinitionTimestamp,
|
|
217
175
|
);
|
|
218
176
|
|
|
219
177
|
// verify method invoked against the allowed actions in the rule set
|
|
@@ -222,7 +180,7 @@ export class ProtocolAuthorization {
|
|
|
222
180
|
incomingMessage,
|
|
223
181
|
ruleSet,
|
|
224
182
|
recordChain,
|
|
225
|
-
|
|
183
|
+
validationStateReader,
|
|
226
184
|
protocolDefinition,
|
|
227
185
|
);
|
|
228
186
|
}
|
|
@@ -236,29 +194,19 @@ export class ProtocolAuthorization {
|
|
|
236
194
|
tenant: string,
|
|
237
195
|
incomingMessage: RecordsRead,
|
|
238
196
|
newestRecordsWrite: RecordsWrite,
|
|
239
|
-
|
|
240
|
-
coreProtocols?: CoreProtocolRegistry,
|
|
197
|
+
validationStateReader: ValidationStateReader,
|
|
241
198
|
): Promise<void> {
|
|
242
199
|
// fetch record chain
|
|
243
200
|
const recordChain: RecordsWriteMessage[] =
|
|
244
|
-
await constructRecordChain(tenant, newestRecordsWrite.message.recordId
|
|
201
|
+
await validationStateReader.constructRecordChain(tenant, newestRecordsWrite.message.recordId);
|
|
245
202
|
|
|
246
|
-
|
|
247
|
-
// The protocol version is locked at the time the record was first created.
|
|
248
|
-
const initialWrite = await fetchInitialWrite(
|
|
249
|
-
tenant, newestRecordsWrite.message.recordId, messageStore
|
|
250
|
-
);
|
|
251
|
-
const governingTimestamp = initialWrite === undefined
|
|
252
|
-
? newestRecordsWrite.message.descriptor.messageTimestamp
|
|
253
|
-
: initialWrite.descriptor.messageTimestamp;
|
|
203
|
+
const protocolDefinitionTimestamp = incomingMessage.message.descriptor.messageTimestamp;
|
|
254
204
|
|
|
255
|
-
// fetch the protocol definition
|
|
256
|
-
const protocolDefinition = await
|
|
205
|
+
// fetch the protocol definition active at the incoming message timestamp
|
|
206
|
+
const protocolDefinition = await validationStateReader.fetchProtocolDefinition(
|
|
257
207
|
tenant,
|
|
258
208
|
newestRecordsWrite.message.descriptor.protocol,
|
|
259
|
-
|
|
260
|
-
governingTimestamp,
|
|
261
|
-
coreProtocols,
|
|
209
|
+
protocolDefinitionTimestamp,
|
|
262
210
|
);
|
|
263
211
|
|
|
264
212
|
// get the rule set for the inbound message
|
|
@@ -267,8 +215,6 @@ export class ProtocolAuthorization {
|
|
|
267
215
|
protocolDefinition,
|
|
268
216
|
);
|
|
269
217
|
|
|
270
|
-
const boundFetchDefinition = ProtocolAuthorization.createBoundFetchDefinition(coreProtocols);
|
|
271
|
-
|
|
272
218
|
// If the incoming message has `protocolRole` in the descriptor, validate the invoked role
|
|
273
219
|
await verifyInvokedRole(
|
|
274
220
|
tenant,
|
|
@@ -276,9 +222,8 @@ export class ProtocolAuthorization {
|
|
|
276
222
|
newestRecordsWrite.message.descriptor.protocol,
|
|
277
223
|
newestRecordsWrite.message.contextId,
|
|
278
224
|
protocolDefinition,
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
governingTimestamp,
|
|
225
|
+
validationStateReader,
|
|
226
|
+
protocolDefinitionTimestamp,
|
|
282
227
|
);
|
|
283
228
|
|
|
284
229
|
// verify method invoked against the allowed actions in the rule set
|
|
@@ -287,7 +232,7 @@ export class ProtocolAuthorization {
|
|
|
287
232
|
incomingMessage,
|
|
288
233
|
ruleSet,
|
|
289
234
|
recordChain,
|
|
290
|
-
|
|
235
|
+
validationStateReader,
|
|
291
236
|
protocolDefinition,
|
|
292
237
|
);
|
|
293
238
|
}
|
|
@@ -295,18 +240,15 @@ export class ProtocolAuthorization {
|
|
|
295
240
|
public static async authorizeQueryOrSubscribe(
|
|
296
241
|
tenant: string,
|
|
297
242
|
incomingMessage: RecordsCount | RecordsQuery | RecordsSubscribe,
|
|
298
|
-
|
|
299
|
-
coreProtocols?: CoreProtocolRegistry,
|
|
243
|
+
validationStateReader: ValidationStateReader,
|
|
300
244
|
): Promise<void> {
|
|
301
245
|
const { protocol, protocolPath, contextId } = incomingMessage.message.descriptor.filter;
|
|
302
246
|
|
|
303
247
|
// fetch the protocol definition
|
|
304
|
-
const protocolDefinition = await
|
|
248
|
+
const protocolDefinition = await validationStateReader.fetchProtocolDefinition(
|
|
305
249
|
tenant,
|
|
306
250
|
protocol!, // `authorizeQueryOrSubscribe` is only called if `protocol` is present
|
|
307
|
-
|
|
308
|
-
undefined,
|
|
309
|
-
coreProtocols,
|
|
251
|
+
incomingMessage.message.descriptor.messageTimestamp,
|
|
310
252
|
);
|
|
311
253
|
|
|
312
254
|
// get the rule set for the inbound message
|
|
@@ -315,8 +257,6 @@ export class ProtocolAuthorization {
|
|
|
315
257
|
protocolDefinition,
|
|
316
258
|
);
|
|
317
259
|
|
|
318
|
-
const boundFetchDefinition = ProtocolAuthorization.createBoundFetchDefinition(coreProtocols);
|
|
319
|
-
|
|
320
260
|
// If the incoming message has `protocolRole` in the descriptor, validate the invoked role
|
|
321
261
|
await verifyInvokedRole(
|
|
322
262
|
tenant,
|
|
@@ -324,8 +264,7 @@ export class ProtocolAuthorization {
|
|
|
324
264
|
protocol!,
|
|
325
265
|
contextId,
|
|
326
266
|
protocolDefinition,
|
|
327
|
-
|
|
328
|
-
boundFetchDefinition,
|
|
267
|
+
validationStateReader,
|
|
329
268
|
);
|
|
330
269
|
|
|
331
270
|
// verify method invoked against the allowed actions in the rule set
|
|
@@ -334,7 +273,7 @@ export class ProtocolAuthorization {
|
|
|
334
273
|
incomingMessage,
|
|
335
274
|
ruleSet,
|
|
336
275
|
[], // record chain is not relevant to queries or subscriptions
|
|
337
|
-
|
|
276
|
+
validationStateReader,
|
|
338
277
|
protocolDefinition,
|
|
339
278
|
);
|
|
340
279
|
}
|
|
@@ -347,29 +286,20 @@ export class ProtocolAuthorization {
|
|
|
347
286
|
tenant: string,
|
|
348
287
|
incomingMessage: RecordsDelete,
|
|
349
288
|
recordsWrite: RecordsWrite,
|
|
350
|
-
|
|
351
|
-
coreProtocols?: CoreProtocolRegistry,
|
|
289
|
+
validationStateReader: ValidationStateReader,
|
|
352
290
|
): Promise<void> {
|
|
353
291
|
|
|
354
292
|
// fetch record chain
|
|
355
293
|
const recordChain: RecordsWriteMessage[] =
|
|
356
|
-
await constructRecordChain(tenant, incomingMessage.message.descriptor.recordId
|
|
294
|
+
await validationStateReader.constructRecordChain(tenant, incomingMessage.message.descriptor.recordId);
|
|
357
295
|
|
|
358
|
-
|
|
359
|
-
const initialWrite = await fetchInitialWrite(
|
|
360
|
-
tenant, incomingMessage.message.descriptor.recordId, messageStore
|
|
361
|
-
);
|
|
362
|
-
const governingTimestamp = initialWrite === undefined
|
|
363
|
-
? recordsWrite.message.descriptor.messageTimestamp
|
|
364
|
-
: initialWrite.descriptor.messageTimestamp;
|
|
296
|
+
const protocolDefinitionTimestamp = incomingMessage.message.descriptor.messageTimestamp;
|
|
365
297
|
|
|
366
|
-
// fetch the protocol definition
|
|
367
|
-
const protocolDefinition = await
|
|
298
|
+
// fetch the protocol definition active at the incoming message timestamp
|
|
299
|
+
const protocolDefinition = await validationStateReader.fetchProtocolDefinition(
|
|
368
300
|
tenant,
|
|
369
301
|
recordsWrite.message.descriptor.protocol,
|
|
370
|
-
|
|
371
|
-
governingTimestamp,
|
|
372
|
-
coreProtocols,
|
|
302
|
+
protocolDefinitionTimestamp,
|
|
373
303
|
);
|
|
374
304
|
|
|
375
305
|
// get the rule set for the inbound message
|
|
@@ -378,8 +308,6 @@ export class ProtocolAuthorization {
|
|
|
378
308
|
protocolDefinition,
|
|
379
309
|
);
|
|
380
310
|
|
|
381
|
-
const boundFetchDefinition = ProtocolAuthorization.createBoundFetchDefinition(coreProtocols);
|
|
382
|
-
|
|
383
311
|
// If the incoming message has `protocolRole` in the descriptor, validate the invoked role
|
|
384
312
|
await verifyInvokedRole(
|
|
385
313
|
tenant,
|
|
@@ -387,9 +315,8 @@ export class ProtocolAuthorization {
|
|
|
387
315
|
recordsWrite.message.descriptor.protocol,
|
|
388
316
|
recordsWrite.message.contextId,
|
|
389
317
|
protocolDefinition,
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
governingTimestamp,
|
|
318
|
+
validationStateReader,
|
|
319
|
+
protocolDefinitionTimestamp,
|
|
393
320
|
);
|
|
394
321
|
|
|
395
322
|
// verify method invoked against the allowed actions in the rule set
|
|
@@ -398,84 +325,11 @@ export class ProtocolAuthorization {
|
|
|
398
325
|
incomingMessage,
|
|
399
326
|
ruleSet,
|
|
400
327
|
recordChain,
|
|
401
|
-
|
|
328
|
+
validationStateReader,
|
|
402
329
|
protocolDefinition,
|
|
403
330
|
);
|
|
404
331
|
}
|
|
405
332
|
|
|
406
|
-
/**
|
|
407
|
-
* Fetches the protocol definition based on the protocol specified in the given message.
|
|
408
|
-
* When `messageTimestamp` is provided, returns the protocol definition that was active at that
|
|
409
|
-
* point in time — i.e. the ProtocolsConfigure with the greatest `messageTimestamp` that is <= the
|
|
410
|
-
* given timestamp. When not provided, returns the latest (current) protocol definition.
|
|
411
|
-
*
|
|
412
|
-
* When `coreProtocols` is provided, core protocol definitions are returned directly from the
|
|
413
|
-
* registry without a message store query. The extra parameter does not affect the
|
|
414
|
-
* `FetchProtocolDefinitionFn` callback type — callers that pass this function as a callback
|
|
415
|
-
* should bind the registry via a closure (see `createBoundFetchDefinition`).
|
|
416
|
-
*/
|
|
417
|
-
public static async fetchProtocolDefinition(
|
|
418
|
-
tenant: string,
|
|
419
|
-
protocolUri: string,
|
|
420
|
-
messageStore: MessageStore,
|
|
421
|
-
messageTimestamp?: string,
|
|
422
|
-
coreProtocols?: CoreProtocolRegistry,
|
|
423
|
-
): Promise<ProtocolDefinition> {
|
|
424
|
-
// if the protocol is a registered core protocol, return the definition directly without a store query
|
|
425
|
-
if (coreProtocols !== undefined) {
|
|
426
|
-
const coreDefinition = coreProtocols.getDefinition(protocolUri);
|
|
427
|
-
if (coreDefinition !== undefined) {
|
|
428
|
-
return coreDefinition;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
// fetch the corresponding protocol definition
|
|
433
|
-
const query: Filter = {
|
|
434
|
-
interface : DwnInterfaceName.Protocols,
|
|
435
|
-
method : DwnMethodName.Configure,
|
|
436
|
-
protocol : protocolUri,
|
|
437
|
-
};
|
|
438
|
-
|
|
439
|
-
if (messageTimestamp === undefined) {
|
|
440
|
-
// default: return only the latest protocol definition
|
|
441
|
-
query.isLatestBaseState = true;
|
|
442
|
-
} else {
|
|
443
|
-
// temporal lookup: find the protocol definition active at the given timestamp
|
|
444
|
-
query.messageTimestamp = { lte: messageTimestamp };
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
const { messages: protocols } = await messageStore.query(
|
|
448
|
-
tenant,
|
|
449
|
-
[query],
|
|
450
|
-
{ messageTimestamp: SortDirection.Descending },
|
|
451
|
-
{ limit: 1 },
|
|
452
|
-
);
|
|
453
|
-
|
|
454
|
-
if (protocols.length === 0) {
|
|
455
|
-
throw new DwnError(DwnErrorCode.ProtocolAuthorizationProtocolNotFound, `unable to find protocol definition for ${protocolUri}`);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
const protocolMessage = protocols[0] as ProtocolsConfigureMessage;
|
|
459
|
-
return protocolMessage.descriptor.definition;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Creates a `FetchProtocolDefinitionFn` closure that binds the given `CoreProtocolRegistry`.
|
|
464
|
-
* This allows core protocol definitions to be resolved from the registry without changing
|
|
465
|
-
* the `FetchProtocolDefinitionFn` type signature — zero ripple to downstream consumers
|
|
466
|
-
* like `protocol-authorization-action.ts` and `protocol-authorization-validation.ts`.
|
|
467
|
-
*/
|
|
468
|
-
private static createBoundFetchDefinition(coreProtocols?: CoreProtocolRegistry): FetchProtocolDefinitionFn {
|
|
469
|
-
return (
|
|
470
|
-
tenant: string,
|
|
471
|
-
protocolUri: string,
|
|
472
|
-
messageStore: MessageStore,
|
|
473
|
-
messageTimestamp?: string,
|
|
474
|
-
): Promise<ProtocolDefinition> => {
|
|
475
|
-
return ProtocolAuthorization.fetchProtocolDefinition(tenant, protocolUri, messageStore, messageTimestamp, coreProtocols);
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
|
-
|
|
479
333
|
/**
|
|
480
334
|
* Gets the rule set corresponding to the given protocolPath.
|
|
481
335
|
*/
|
|
@@ -562,7 +416,7 @@ export class ProtocolAuthorization {
|
|
|
562
416
|
|
|
563
417
|
throw new DwnError(
|
|
564
418
|
DwnErrorCode.ProtocolAuthorizationStoredInitialWriteActionNotAllowed,
|
|
565
|
-
`stored RecordsWrite by author ${incomingMessage.author} is not allowed by the
|
|
419
|
+
`stored RecordsWrite by author ${incomingMessage.author} is not allowed by the resolved protocol config`
|
|
566
420
|
);
|
|
567
421
|
}
|
|
568
422
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { MessageStore } from '../types/message-store.js';
|
|
2
1
|
import type { PermissionGrant } from '../protocols/permission-grant.js';
|
|
3
2
|
import type { ProtocolPermissionScope } from '../types/permission-types.js';
|
|
3
|
+
import type { ValidationStateReader } from '../types/validation-state-reader.js';
|
|
4
4
|
import type { ProtocolsConfigureMessage, ProtocolsQueryMessage } from '../types/protocols-types.js';
|
|
5
5
|
|
|
6
6
|
import { GrantAuthorization } from './grant-authorization.js';
|
|
@@ -15,10 +15,10 @@ export class ProtocolsGrantAuthorization {
|
|
|
15
15
|
expectedGrantor: string,
|
|
16
16
|
expectedGrantee: string,
|
|
17
17
|
permissionGrant: PermissionGrant,
|
|
18
|
-
|
|
18
|
+
validationStateReader: ValidationStateReader,
|
|
19
19
|
}): Promise<void> {
|
|
20
20
|
const {
|
|
21
|
-
protocolsConfigureMessage, expectedGrantor, expectedGrantee, permissionGrant,
|
|
21
|
+
protocolsConfigureMessage, expectedGrantor, expectedGrantee, permissionGrant, validationStateReader
|
|
22
22
|
} = input;
|
|
23
23
|
|
|
24
24
|
await GrantAuthorization.performBaseValidation({
|
|
@@ -26,7 +26,7 @@ export class ProtocolsGrantAuthorization {
|
|
|
26
26
|
expectedGrantor,
|
|
27
27
|
expectedGrantee,
|
|
28
28
|
permissionGrant,
|
|
29
|
-
|
|
29
|
+
validationStateReader
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
ProtocolsGrantAuthorization.verifyScope(protocolsConfigureMessage, permissionGrant.scope as ProtocolPermissionScope);
|
|
@@ -34,23 +34,23 @@ export class ProtocolsGrantAuthorization {
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Authorizes the scope of a permission grant for a ProtocolsQuery message.
|
|
37
|
-
* @param
|
|
37
|
+
* @param validationStateReader Used to check if the grant has been revoked.
|
|
38
38
|
*/
|
|
39
39
|
public static async authorizeQuery(input: {
|
|
40
40
|
expectedGrantor: string,
|
|
41
41
|
expectedGrantee: string,
|
|
42
42
|
incomingMessage: ProtocolsQueryMessage;
|
|
43
43
|
permissionGrant: PermissionGrant;
|
|
44
|
-
|
|
44
|
+
validationStateReader: ValidationStateReader;
|
|
45
45
|
}): Promise<void> {
|
|
46
|
-
const { expectedGrantee, expectedGrantor, incomingMessage, permissionGrant,
|
|
46
|
+
const { expectedGrantee, expectedGrantor, incomingMessage, permissionGrant, validationStateReader } = input;
|
|
47
47
|
|
|
48
48
|
await GrantAuthorization.performBaseValidation({
|
|
49
49
|
incomingMessage: incomingMessage,
|
|
50
50
|
expectedGrantor,
|
|
51
51
|
expectedGrantee,
|
|
52
52
|
permissionGrant,
|
|
53
|
-
|
|
53
|
+
validationStateReader
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
// If the grant specifies a protocol, the query must specify the same protocol.
|
|
@@ -85,4 +85,4 @@ export class ProtocolsGrantAuthorization {
|
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { GenericMessage } from '../types/message-types.js';
|
|
2
|
+
import type { PermissionGrant } from '../protocols/permission-grant.js';
|
|
3
|
+
import type { ProtocolDefinition } from '../types/protocols-types.js';
|
|
4
|
+
import type { RecordsWrite } from '../interfaces/records-write.js';
|
|
5
|
+
import type { RecordsWriteMessage } from '../types/records-types.js';
|
|
6
|
+
import type { ValidationStateReader } from '../types/validation-state-reader.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* One recorded validation-time state read: the reader method invoked.
|
|
10
|
+
*/
|
|
11
|
+
export type RecordedValidationRead = {
|
|
12
|
+
method: keyof ValidationStateReader;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A `ValidationStateReader` decorator that records every read before delegating to the wrapped
|
|
17
|
+
* reader. Used by the replay-basis closure tests (and harnesses) to assert that admission
|
|
18
|
+
* performs no validation read outside the reader surface, and to keep recorded read-traces as a
|
|
19
|
+
* regression artifact when validation reads change.
|
|
20
|
+
*
|
|
21
|
+
* Inject via `DwnConfig.instrumentValidationStateReader`.
|
|
22
|
+
*/
|
|
23
|
+
export class RecordingValidationStateReader implements ValidationStateReader {
|
|
24
|
+
private readonly recordedReads: RecordedValidationRead[] = [];
|
|
25
|
+
|
|
26
|
+
public constructor(private readonly inner: ValidationStateReader) { }
|
|
27
|
+
|
|
28
|
+
/** All reads recorded since construction or the last `clearRecordedReads()`. */
|
|
29
|
+
public get reads(): RecordedValidationRead[] {
|
|
30
|
+
return [...this.recordedReads];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Clears the recorded reads, e.g. between closure-test scenarios. */
|
|
34
|
+
public clearRecordedReads(): void {
|
|
35
|
+
this.recordedReads.length = 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** @inheritdoc */
|
|
39
|
+
public async fetchInitialRecordsWrite(tenant: string, recordId: string): Promise<RecordsWrite | undefined> {
|
|
40
|
+
this.recordedReads.push({ method: 'fetchInitialRecordsWrite' });
|
|
41
|
+
return this.inner.fetchInitialRecordsWrite(tenant, recordId);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** @inheritdoc */
|
|
45
|
+
public async fetchInitialWrite(tenant: string, recordId: string): Promise<RecordsWriteMessage | undefined> {
|
|
46
|
+
this.recordedReads.push({ method: 'fetchInitialWrite' });
|
|
47
|
+
return this.inner.fetchInitialWrite(tenant, recordId);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** @inheritdoc */
|
|
51
|
+
public async constructRecordChain(tenant: string, descendantRecordId: string | undefined): Promise<RecordsWriteMessage[]> {
|
|
52
|
+
this.recordedReads.push({ method: 'constructRecordChain' });
|
|
53
|
+
return this.inner.constructRecordChain(tenant, descendantRecordId);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** @inheritdoc */
|
|
57
|
+
public async fetchParentRecord(input: {
|
|
58
|
+
tenant: string;
|
|
59
|
+
parentProtocolUri: string;
|
|
60
|
+
parentId: string;
|
|
61
|
+
}): Promise<RecordsWriteMessage | undefined> {
|
|
62
|
+
this.recordedReads.push({ method: 'fetchParentRecord' });
|
|
63
|
+
return this.inner.fetchParentRecord(input);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** @inheritdoc */
|
|
67
|
+
public async hasMatchingRoleRecord(input: {
|
|
68
|
+
tenant: string;
|
|
69
|
+
protocol: string;
|
|
70
|
+
protocolPath: string;
|
|
71
|
+
recipient: string;
|
|
72
|
+
contextIdPrefix?: string;
|
|
73
|
+
}): Promise<boolean> {
|
|
74
|
+
this.recordedReads.push({ method: 'hasMatchingRoleRecord' });
|
|
75
|
+
return this.inner.hasMatchingRoleRecord(input);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** @inheritdoc */
|
|
79
|
+
public async queryLatestRoleRecords(input: {
|
|
80
|
+
tenant: string;
|
|
81
|
+
protocol: string;
|
|
82
|
+
protocolPath: string;
|
|
83
|
+
recipient: string;
|
|
84
|
+
contextIdPrefix?: string;
|
|
85
|
+
}): Promise<RecordsWriteMessage[]> {
|
|
86
|
+
this.recordedReads.push({ method: 'queryLatestRoleRecords' });
|
|
87
|
+
return this.inner.queryLatestRoleRecords(input);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** @inheritdoc */
|
|
91
|
+
public async fetchGrant(tenant: string, permissionGrantId: string): Promise<PermissionGrant> {
|
|
92
|
+
this.recordedReads.push({ method: 'fetchGrant' });
|
|
93
|
+
return this.inner.fetchGrant(tenant, permissionGrantId);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** @inheritdoc */
|
|
97
|
+
public async fetchOldestGrantRevocation(tenant: string, permissionGrantId: string): Promise<GenericMessage | undefined> {
|
|
98
|
+
this.recordedReads.push({ method: 'fetchOldestGrantRevocation' });
|
|
99
|
+
return this.inner.fetchOldestGrantRevocation(tenant, permissionGrantId);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** @inheritdoc */
|
|
103
|
+
public async fetchNewestRecordsWrite(tenant: string, recordId: string): Promise<RecordsWriteMessage> {
|
|
104
|
+
this.recordedReads.push({ method: 'fetchNewestRecordsWrite' });
|
|
105
|
+
return this.inner.fetchNewestRecordsWrite(tenant, recordId);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** @inheritdoc */
|
|
109
|
+
public async fetchProtocolDefinition(tenant: string, protocolUri: string, messageTimestamp?: string): Promise<ProtocolDefinition> {
|
|
110
|
+
this.recordedReads.push({ method: 'fetchProtocolDefinition' });
|
|
111
|
+
return this.inner.fetchProtocolDefinition(tenant, protocolUri, messageTimestamp);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** @inheritdoc */
|
|
115
|
+
public async fetchLatestSquashRecordAtScope(input: {
|
|
116
|
+
tenant: string;
|
|
117
|
+
protocol: string;
|
|
118
|
+
protocolPath: string;
|
|
119
|
+
contextIdPrefix?: string;
|
|
120
|
+
}): Promise<RecordsWriteMessage | undefined> {
|
|
121
|
+
this.recordedReads.push({ method: 'fetchLatestSquashRecordAtScope' });
|
|
122
|
+
return this.inner.fetchLatestSquashRecordAtScope(input);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** @inheritdoc */
|
|
126
|
+
public async hasStoredData(tenant: string, recordId: string, dataCid: string): Promise<boolean> {
|
|
127
|
+
this.recordedReads.push({ method: 'hasStoredData' });
|
|
128
|
+
return this.inner.hasStoredData(tenant, recordId, dataCid);
|
|
129
|
+
}
|
|
130
|
+
}
|