@enbox/dwn-sdk-js 0.0.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.mjs +8 -8
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/generated/precompiled-validators.js +817 -911
- package/dist/esm/generated/precompiled-validators.js.map +1 -1
- package/dist/esm/src/core/constants.js +11 -0
- package/dist/esm/src/core/constants.js.map +1 -0
- package/dist/esm/src/core/core-protocol.js +44 -0
- package/dist/esm/src/core/core-protocol.js.map +1 -0
- package/dist/esm/src/core/dwn-error.js +12 -12
- package/dist/esm/src/core/dwn-error.js.map +1 -1
- package/dist/esm/src/core/grant-authorization.js +16 -3
- package/dist/esm/src/core/grant-authorization.js.map +1 -1
- package/dist/esm/src/core/protocol-authorization-action.js +5 -0
- package/dist/esm/src/core/protocol-authorization-action.js.map +1 -1
- package/dist/esm/src/core/protocol-authorization-validation.js +91 -0
- package/dist/esm/src/core/protocol-authorization-validation.js.map +1 -1
- package/dist/esm/src/core/protocol-authorization.js +53 -30
- package/dist/esm/src/core/protocol-authorization.js.map +1 -1
- package/dist/esm/src/core/records-grant-authorization.js +6 -8
- package/dist/esm/src/core/records-grant-authorization.js.map +1 -1
- package/dist/esm/src/core/resumable-task-manager.js +2 -0
- package/dist/esm/src/core/resumable-task-manager.js.map +1 -1
- package/dist/esm/src/dwn.js +42 -18
- package/dist/esm/src/dwn.js.map +1 -1
- package/dist/esm/src/event-stream/event-emitter-event-log.js +204 -0
- package/dist/esm/src/event-stream/event-emitter-event-log.js.map +1 -0
- package/dist/esm/src/handlers/messages-read.js +7 -11
- package/dist/esm/src/handlers/messages-read.js.map +1 -1
- package/dist/esm/src/handlers/messages-subscribe.js +22 -24
- package/dist/esm/src/handlers/messages-subscribe.js.map +1 -1
- package/dist/esm/src/handlers/messages-sync.js +11 -15
- package/dist/esm/src/handlers/messages-sync.js.map +1 -1
- package/dist/esm/src/handlers/protocols-configure.js +37 -27
- package/dist/esm/src/handlers/protocols-configure.js.map +1 -1
- package/dist/esm/src/handlers/protocols-query.js +7 -11
- package/dist/esm/src/handlers/protocols-query.js.map +1 -1
- package/dist/esm/src/handlers/records-count.js +10 -12
- package/dist/esm/src/handlers/records-count.js.map +1 -1
- package/dist/esm/src/handlers/records-delete.js +10 -18
- package/dist/esm/src/handlers/records-delete.js.map +1 -1
- package/dist/esm/src/handlers/records-query.js +11 -15
- package/dist/esm/src/handlers/records-query.js.map +1 -1
- package/dist/esm/src/handlers/records-read.js +31 -26
- package/dist/esm/src/handlers/records-read.js.map +1 -1
- package/dist/esm/src/handlers/records-subscribe.js +39 -26
- package/dist/esm/src/handlers/records-subscribe.js.map +1 -1
- package/dist/esm/src/handlers/records-write.js +128 -105
- package/dist/esm/src/handlers/records-write.js.map +1 -1
- package/dist/esm/src/index.js +5 -2
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/interfaces/messages-subscribe.js +1 -0
- package/dist/esm/src/interfaces/messages-subscribe.js.map +1 -1
- package/dist/esm/src/interfaces/protocols-configure.js +33 -3
- package/dist/esm/src/interfaces/protocols-configure.js.map +1 -1
- package/dist/esm/src/interfaces/records-count.js +1 -1
- package/dist/esm/src/interfaces/records-count.js.map +1 -1
- package/dist/esm/src/interfaces/records-delete.js +1 -1
- package/dist/esm/src/interfaces/records-delete.js.map +1 -1
- package/dist/esm/src/interfaces/records-query.js +1 -1
- package/dist/esm/src/interfaces/records-query.js.map +1 -1
- package/dist/esm/src/interfaces/records-read.js +1 -1
- package/dist/esm/src/interfaces/records-read.js.map +1 -1
- package/dist/esm/src/interfaces/records-subscribe.js +2 -1
- package/dist/esm/src/interfaces/records-subscribe.js.map +1 -1
- package/dist/esm/src/interfaces/records-write-signing.js +1 -12
- package/dist/esm/src/interfaces/records-write-signing.js.map +1 -1
- package/dist/esm/src/interfaces/records-write.js +25 -41
- package/dist/esm/src/interfaces/records-write.js.map +1 -1
- package/dist/esm/src/protocols/permission-grant.js +1 -1
- package/dist/esm/src/protocols/permission-grant.js.map +1 -1
- package/dist/esm/src/protocols/permission-request.js +1 -1
- package/dist/esm/src/protocols/permission-request.js.map +1 -1
- package/dist/esm/src/protocols/permissions.js +113 -5
- package/dist/esm/src/protocols/permissions.js.map +1 -1
- package/dist/esm/src/state-index/state-index-level.js +5 -7
- package/dist/esm/src/state-index/state-index-level.js.map +1 -1
- package/dist/esm/src/store/data-store-level.js +110 -33
- package/dist/esm/src/store/data-store-level.js.map +1 -1
- package/dist/esm/src/store/index-level.js +42 -32
- package/dist/esm/src/store/index-level.js.map +1 -1
- package/dist/esm/src/store/storage-controller.js +70 -6
- package/dist/esm/src/store/storage-controller.js.map +1 -1
- package/dist/esm/src/types/permission-types.js.map +1 -1
- package/dist/esm/src/types/protocols-types.js +11 -0
- package/dist/esm/src/types/protocols-types.js.map +1 -1
- package/dist/esm/src/types/records-types.js.map +1 -1
- package/dist/esm/src/utils/hd-key.js +0 -8
- package/dist/esm/src/utils/hd-key.js.map +1 -1
- package/dist/esm/src/utils/messages.js +16 -34
- package/dist/esm/src/utils/messages.js.map +1 -1
- package/dist/esm/src/utils/records.js +5 -43
- package/dist/esm/src/utils/records.js.map +1 -1
- package/dist/esm/tests/core/protocol-authorization.spec.js +2 -1
- package/dist/esm/tests/core/protocol-authorization.spec.js.map +1 -1
- package/dist/esm/tests/dwn.spec.js +32 -43
- package/dist/esm/tests/dwn.spec.js.map +1 -1
- package/dist/esm/tests/event-emitter-event-log.spec.js +305 -0
- package/dist/esm/tests/event-emitter-event-log.spec.js.map +1 -0
- package/dist/esm/tests/features/author-delegated-grant.spec.js +14 -7
- package/dist/esm/tests/features/author-delegated-grant.spec.js.map +1 -1
- package/dist/esm/tests/features/owner-delegated-grant.spec.js +9 -5
- package/dist/esm/tests/features/owner-delegated-grant.spec.js.map +1 -1
- package/dist/esm/tests/features/owner-signature.spec.js +14 -7
- package/dist/esm/tests/features/owner-signature.spec.js.map +1 -1
- package/dist/esm/tests/features/permissions.spec.js +12 -12
- package/dist/esm/tests/features/permissions.spec.js.map +1 -1
- package/dist/esm/tests/features/protocol-composition.spec.js +636 -5
- package/dist/esm/tests/features/protocol-composition.spec.js.map +1 -1
- package/dist/esm/tests/features/protocol-create-action.spec.js +4 -4
- package/dist/esm/tests/features/protocol-create-action.spec.js.map +1 -1
- package/dist/esm/tests/features/protocol-delete-action.spec.js +7 -7
- package/dist/esm/tests/features/protocol-delete-action.spec.js.map +1 -1
- package/dist/esm/tests/features/protocol-update-action.spec.js +4 -4
- package/dist/esm/tests/features/protocol-update-action.spec.js.map +1 -1
- package/dist/esm/tests/features/records-delivery.spec.js +236 -0
- package/dist/esm/tests/features/records-delivery.spec.js.map +1 -0
- package/dist/esm/tests/features/records-immutable.spec.js +315 -0
- package/dist/esm/tests/features/records-immutable.spec.js.map +1 -0
- package/dist/esm/tests/features/records-prune.spec.js +4 -4
- package/dist/esm/tests/features/records-prune.spec.js.map +1 -1
- package/dist/esm/tests/features/records-record-limit.spec.js +542 -0
- package/dist/esm/tests/features/records-record-limit.spec.js.map +1 -0
- package/dist/esm/tests/features/records-squash.spec.js +1055 -0
- package/dist/esm/tests/features/records-squash.spec.js.map +1 -0
- package/dist/esm/tests/features/records-tags.spec.js +16 -4
- package/dist/esm/tests/features/records-tags.spec.js.map +1 -1
- package/dist/esm/tests/features/resumable-tasks.spec.js +7 -8
- package/dist/esm/tests/features/resumable-tasks.spec.js.map +1 -1
- package/dist/esm/tests/handlers/messages-read.spec.js +11 -5
- package/dist/esm/tests/handlers/messages-read.spec.js.map +1 -1
- package/dist/esm/tests/handlers/messages-subscribe.spec.js +169 -22
- package/dist/esm/tests/handlers/messages-subscribe.spec.js.map +1 -1
- package/dist/esm/tests/handlers/messages-sync.spec.js +103 -21
- package/dist/esm/tests/handlers/messages-sync.spec.js.map +1 -1
- package/dist/esm/tests/handlers/protocols-configure.spec.js +5 -5
- package/dist/esm/tests/handlers/protocols-configure.spec.js.map +1 -1
- package/dist/esm/tests/handlers/protocols-query.spec.js +5 -5
- package/dist/esm/tests/handlers/protocols-query.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-count.spec.js +9 -4
- package/dist/esm/tests/handlers/records-count.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-delete.spec.js +24 -25
- package/dist/esm/tests/handlers/records-delete.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-query.spec.js +68 -9
- package/dist/esm/tests/handlers/records-query.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-read.spec.js +24 -138
- package/dist/esm/tests/handlers/records-read.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-subscribe.spec.js +175 -35
- package/dist/esm/tests/handlers/records-subscribe.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-write.spec.js +176 -72
- package/dist/esm/tests/handlers/records-write.spec.js.map +1 -1
- package/dist/esm/tests/interfaces/records-write.spec.js +52 -68
- package/dist/esm/tests/interfaces/records-write.spec.js.map +1 -1
- package/dist/esm/tests/protocols/permission-grant.spec.js +6 -6
- package/dist/esm/tests/protocols/permission-grant.spec.js.map +1 -1
- package/dist/esm/tests/protocols/permission-request.spec.js +4 -4
- package/dist/esm/tests/protocols/permission-request.spec.js.map +1 -1
- package/dist/esm/tests/protocols/permissions.spec.js +4 -4
- package/dist/esm/tests/protocols/permissions.spec.js.map +1 -1
- package/dist/esm/tests/scenarios/aggregator.spec.js +4 -4
- package/dist/esm/tests/scenarios/aggregator.spec.js.map +1 -1
- package/dist/esm/tests/scenarios/deleted-record.spec.js +350 -5
- package/dist/esm/tests/scenarios/deleted-record.spec.js.map +1 -1
- package/dist/esm/tests/scenarios/end-to-end-tests.spec.js +4 -4
- package/dist/esm/tests/scenarios/end-to-end-tests.spec.js.map +1 -1
- package/dist/esm/tests/scenarios/nested-roles.spec.js +4 -4
- package/dist/esm/tests/scenarios/nested-roles.spec.js.map +1 -1
- package/dist/esm/tests/scenarios/subscriptions.spec.js +93 -40
- package/dist/esm/tests/scenarios/subscriptions.spec.js.map +1 -1
- package/dist/esm/tests/store/data-store-level.spec.js +102 -41
- package/dist/esm/tests/store/data-store-level.spec.js.map +1 -1
- package/dist/esm/tests/test-event-stream.js +12 -13
- package/dist/esm/tests/test-event-stream.js.map +1 -1
- package/dist/esm/tests/test-suite.js +10 -4
- package/dist/esm/tests/test-suite.js.map +1 -1
- package/dist/esm/tests/utils/messages.spec.js +12 -5
- package/dist/esm/tests/utils/messages.spec.js.map +1 -1
- package/dist/esm/tests/utils/records.spec.js +8 -12
- package/dist/esm/tests/utils/records.spec.js.map +1 -1
- package/dist/esm/tests/utils/test-data-generator.js +36 -2
- package/dist/esm/tests/utils/test-data-generator.js.map +1 -1
- package/dist/esm/tests/validation/json-schemas/records/records-write.spec.js +37 -8
- package/dist/esm/tests/validation/json-schemas/records/records-write.spec.js.map +1 -1
- package/dist/types/generated/precompiled-validators.d.ts +49 -40
- package/dist/types/generated/precompiled-validators.d.ts.map +1 -1
- package/dist/types/src/core/constants.d.ts +11 -0
- package/dist/types/src/core/constants.d.ts.map +1 -0
- package/dist/types/src/core/core-protocol.d.ts +89 -0
- package/dist/types/src/core/core-protocol.d.ts.map +1 -0
- package/dist/types/src/core/dwn-error.d.ts +12 -12
- package/dist/types/src/core/dwn-error.d.ts.map +1 -1
- package/dist/types/src/core/grant-authorization.d.ts +6 -2
- package/dist/types/src/core/grant-authorization.d.ts.map +1 -1
- package/dist/types/src/core/protocol-authorization-action.d.ts.map +1 -1
- package/dist/types/src/core/protocol-authorization-validation.d.ts +30 -0
- package/dist/types/src/core/protocol-authorization-validation.d.ts.map +1 -1
- package/dist/types/src/core/protocol-authorization.d.ts +19 -11
- package/dist/types/src/core/protocol-authorization.d.ts.map +1 -1
- package/dist/types/src/core/records-grant-authorization.d.ts.map +1 -1
- package/dist/types/src/core/resumable-task-manager.d.ts +2 -1
- package/dist/types/src/core/resumable-task-manager.d.ts.map +1 -1
- package/dist/types/src/dwn.d.ts +19 -7
- package/dist/types/src/dwn.d.ts.map +1 -1
- package/dist/types/src/event-stream/event-emitter-event-log.d.ts +50 -0
- package/dist/types/src/event-stream/event-emitter-event-log.d.ts.map +1 -0
- package/dist/types/src/handlers/messages-read.d.ts +3 -8
- package/dist/types/src/handlers/messages-read.d.ts.map +1 -1
- package/dist/types/src/handlers/messages-subscribe.d.ts +6 -10
- package/dist/types/src/handlers/messages-subscribe.d.ts.map +1 -1
- package/dist/types/src/handlers/messages-sync.d.ts +3 -8
- package/dist/types/src/handlers/messages-sync.d.ts.map +1 -1
- package/dist/types/src/handlers/protocols-configure.d.ts +3 -10
- package/dist/types/src/handlers/protocols-configure.d.ts.map +1 -1
- package/dist/types/src/handlers/protocols-query.d.ts +3 -8
- package/dist/types/src/handlers/protocols-query.d.ts.map +1 -1
- package/dist/types/src/handlers/records-count.d.ts +3 -6
- package/dist/types/src/handlers/records-count.d.ts.map +1 -1
- package/dist/types/src/handlers/records-delete.d.ts +3 -8
- package/dist/types/src/handlers/records-delete.d.ts.map +1 -1
- package/dist/types/src/handlers/records-query.d.ts +3 -8
- package/dist/types/src/handlers/records-query.d.ts.map +1 -1
- package/dist/types/src/handlers/records-read.d.ts +3 -8
- package/dist/types/src/handlers/records-read.d.ts.map +1 -1
- package/dist/types/src/handlers/records-subscribe.d.ts +8 -10
- package/dist/types/src/handlers/records-subscribe.d.ts.map +1 -1
- package/dist/types/src/handlers/records-write.d.ts +12 -25
- package/dist/types/src/handlers/records-write.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +8 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/interfaces/messages-subscribe.d.ts +5 -0
- package/dist/types/src/interfaces/messages-subscribe.d.ts.map +1 -1
- package/dist/types/src/interfaces/protocols-configure.d.ts.map +1 -1
- package/dist/types/src/interfaces/records-subscribe.d.ts +5 -0
- package/dist/types/src/interfaces/records-subscribe.d.ts.map +1 -1
- package/dist/types/src/interfaces/records-write-signing.d.ts +3 -4
- package/dist/types/src/interfaces/records-write-signing.d.ts.map +1 -1
- package/dist/types/src/interfaces/records-write.d.ts +11 -11
- package/dist/types/src/interfaces/records-write.d.ts.map +1 -1
- package/dist/types/src/protocols/permission-grant.d.ts +1 -1
- package/dist/types/src/protocols/permission-grant.d.ts.map +1 -1
- package/dist/types/src/protocols/permission-request.d.ts +1 -1
- package/dist/types/src/protocols/permission-request.d.ts.map +1 -1
- package/dist/types/src/protocols/permissions.d.ts +40 -3
- package/dist/types/src/protocols/permissions.d.ts.map +1 -1
- package/dist/types/src/state-index/state-index-level.d.ts.map +1 -1
- package/dist/types/src/store/data-store-level.d.ts +20 -4
- package/dist/types/src/store/data-store-level.d.ts.map +1 -1
- package/dist/types/src/store/index-level.d.ts +4 -0
- package/dist/types/src/store/index-level.d.ts.map +1 -1
- package/dist/types/src/store/storage-controller.d.ts +20 -6
- package/dist/types/src/store/storage-controller.d.ts.map +1 -1
- package/dist/types/src/types/message-types.d.ts +3 -3
- package/dist/types/src/types/message-types.d.ts.map +1 -1
- package/dist/types/src/types/messages-types.d.ts +12 -3
- package/dist/types/src/types/messages-types.d.ts.map +1 -1
- package/dist/types/src/types/method-handler.d.ts +24 -3
- package/dist/types/src/types/method-handler.d.ts.map +1 -1
- package/dist/types/src/types/permission-types.d.ts +7 -0
- package/dist/types/src/types/permission-types.d.ts.map +1 -1
- package/dist/types/src/types/protocols-types.d.ts +69 -2
- package/dist/types/src/types/protocols-types.d.ts.map +1 -1
- package/dist/types/src/types/records-types.d.ts +23 -6
- package/dist/types/src/types/records-types.d.ts.map +1 -1
- package/dist/types/src/types/subscriptions.d.ts +151 -13
- package/dist/types/src/types/subscriptions.d.ts.map +1 -1
- package/dist/types/src/utils/hd-key.d.ts +1 -9
- package/dist/types/src/utils/hd-key.d.ts.map +1 -1
- package/dist/types/src/utils/messages.d.ts +7 -5
- package/dist/types/src/utils/messages.d.ts.map +1 -1
- package/dist/types/src/utils/records.d.ts +1 -11
- package/dist/types/src/utils/records.d.ts.map +1 -1
- package/dist/types/tests/dwn.spec.d.ts.map +1 -1
- package/dist/types/tests/event-emitter-event-log.spec.d.ts +2 -0
- package/dist/types/tests/event-emitter-event-log.spec.d.ts.map +1 -0
- 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/protocol-composition.spec.d.ts.map +1 -1
- package/dist/types/tests/features/records-delivery.spec.d.ts +2 -0
- package/dist/types/tests/features/records-delivery.spec.d.ts.map +1 -0
- package/dist/types/tests/features/records-immutable.spec.d.ts +2 -0
- package/dist/types/tests/features/records-immutable.spec.d.ts.map +1 -0
- package/dist/types/tests/features/records-record-limit.spec.d.ts +2 -0
- package/dist/types/tests/features/records-record-limit.spec.d.ts.map +1 -0
- package/dist/types/tests/features/records-squash.spec.d.ts +2 -0
- package/dist/types/tests/features/records-squash.spec.d.ts.map +1 -0
- 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-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/messages-sync.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/subscriptions.spec.d.ts.map +1 -1
- package/dist/types/tests/test-event-stream.d.ts +11 -12
- package/dist/types/tests/test-event-stream.d.ts.map +1 -1
- package/dist/types/tests/test-suite.d.ts +2 -2
- package/dist/types/tests/test-suite.d.ts.map +1 -1
- package/dist/types/tests/utils/test-data-generator.d.ts +19 -0
- package/dist/types/tests/utils/test-data-generator.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/core/constants.ts +11 -0
- package/src/core/core-protocol.ts +129 -0
- package/src/core/dwn-error.ts +18 -12
- package/src/core/grant-authorization.ts +20 -3
- package/src/core/protocol-authorization-action.ts +5 -0
- package/src/core/protocol-authorization-validation.ts +133 -0
- package/src/core/protocol-authorization.ts +71 -23
- package/src/core/records-grant-authorization.ts +6 -8
- package/src/core/resumable-task-manager.ts +3 -1
- package/src/dwn.ts +58 -73
- package/src/event-stream/event-emitter-event-log.ts +283 -0
- package/src/handlers/messages-read.ts +8 -9
- package/src/handlers/messages-subscribe.ts +24 -28
- package/src/handlers/messages-sync.ts +10 -16
- package/src/handlers/protocols-configure.ts +47 -32
- package/src/handlers/protocols-query.ts +6 -9
- package/src/handlers/records-count.ts +11 -10
- package/src/handlers/records-delete.ts +12 -21
- package/src/handlers/records-query.ts +12 -12
- package/src/handlers/records-read.ts +34 -22
- package/src/handlers/records-subscribe.ts +47 -26
- package/src/handlers/records-write.ts +152 -119
- package/src/index.ts +9 -5
- package/src/interfaces/messages-subscribe.ts +7 -1
- package/src/interfaces/protocols-configure.ts +51 -3
- package/src/interfaces/records-count.ts +1 -1
- package/src/interfaces/records-delete.ts +1 -1
- package/src/interfaces/records-query.ts +1 -1
- package/src/interfaces/records-read.ts +1 -1
- package/src/interfaces/records-subscribe.ts +8 -1
- package/src/interfaces/records-write-signing.ts +2 -22
- package/src/interfaces/records-write.ts +35 -48
- package/src/protocols/permission-grant.ts +1 -1
- package/src/protocols/permission-request.ts +1 -1
- package/src/protocols/permissions.ts +148 -6
- package/src/state-index/state-index-level.ts +5 -7
- package/src/store/data-store-level.ts +124 -34
- package/src/store/index-level.ts +44 -35
- package/src/store/storage-controller.ts +89 -12
- package/src/types/message-types.ts +3 -3
- package/src/types/messages-types.ts +12 -3
- package/src/types/method-handler.ts +26 -4
- package/src/types/mitt.d.ts +28 -0
- package/src/types/permission-types.ts +7 -0
- package/src/types/protocols-types.ts +78 -1
- package/src/types/records-types.ts +24 -6
- package/src/types/subscriptions.ts +178 -14
- package/src/utils/hd-key.ts +0 -9
- package/src/utils/messages.ts +17 -37
- package/src/utils/records.ts +7 -58
- package/dist/esm/src/event-stream/event-emitter-stream.js +0 -46
- package/dist/esm/src/event-stream/event-emitter-stream.js.map +0 -1
- package/dist/esm/tests/event-stream/event-emitter-stream.spec.js +0 -68
- package/dist/esm/tests/event-stream/event-emitter-stream.spec.js.map +0 -1
- package/dist/esm/tests/event-stream/event-stream.spec.js +0 -114
- package/dist/esm/tests/event-stream/event-stream.spec.js.map +0 -1
- package/dist/types/src/event-stream/event-emitter-stream.d.ts +0 -23
- package/dist/types/src/event-stream/event-emitter-stream.d.ts.map +0 -1
- package/dist/types/tests/event-stream/event-emitter-stream.spec.d.ts +0 -2
- package/dist/types/tests/event-stream/event-emitter-stream.spec.d.ts.map +0 -1
- package/dist/types/tests/event-stream/event-stream.spec.d.ts +0 -2
- package/dist/types/tests/event-stream/event-stream.spec.d.ts.map +0 -1
- package/src/event-stream/event-emitter-stream.ts +0 -69
|
@@ -7,6 +7,11 @@ export type MessagesSubscribeOptions = {
|
|
|
7
7
|
messageTimestamp?: string;
|
|
8
8
|
filters?: MessagesFilter[];
|
|
9
9
|
permissionGrantId?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Opaque EventLog cursor string to resume from. When provided, catch-up events are
|
|
12
|
+
* replayed from the EventLog and an EOSE marker is delivered before live events.
|
|
13
|
+
*/
|
|
14
|
+
cursor?: string;
|
|
10
15
|
};
|
|
11
16
|
export declare class MessagesSubscribe extends AbstractMessage<MessagesSubscribeMessage> {
|
|
12
17
|
static parse(message: MessagesSubscribeMessage): Promise<MessagesSubscribe>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages-subscribe.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/messages-subscribe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAA+B,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAExG,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAQ9D,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,aAAa,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"messages-subscribe.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/messages-subscribe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAA+B,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAExG,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAQ9D,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,aAAa,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,eAAe,CAAC,wBAAwB,CAAC;WAC1D,KAAK,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAcxF;;;;OAIG;WACiB,MAAM,CACxB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,iBAAiB,CAAC;CAwB9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocols-configure.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/protocols-configure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EACU,kBAAkB,EACtC,yBAAyB,EAC1B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAY9D,MAAM,MAAM,yBAAyB,GAAG;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,kBAAkB,CAAC;IAC/B,MAAM,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,cAAc,CAAC,EAAE,8BAA8B,CAAC;IAChD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,qBAAa,kBAAmB,SAAQ,eAAe,CAAC,yBAAyB,CAAC;WAC5D,KAAK,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,kBAAkB,CAAC;WAStE,MAAM,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAwB3F;;;OAGG;IACU,uBAAuB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAW/E;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAuBzC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IA+B3B,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAoBhC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,4BAA4B;IAiC3C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,0BAA0B;
|
|
1
|
+
{"version":3,"file":"protocols-configure.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/protocols-configure.ts"],"names":[],"mappings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C"}
|
|
@@ -10,6 +10,11 @@ export type RecordsSubscribeOptions = {
|
|
|
10
10
|
pagination?: Pagination;
|
|
11
11
|
signer?: MessageSigner;
|
|
12
12
|
protocolRole?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Opaque EventLog cursor string to resume from. When provided, catch-up events are
|
|
15
|
+
* replayed from the EventLog and an EOSE marker is delivered before live events.
|
|
16
|
+
*/
|
|
17
|
+
cursor?: string;
|
|
13
18
|
/**
|
|
14
19
|
* The delegated grant to sign on behalf of the logical author, which is the grantor (`grantedBy`) of the delegated grant.
|
|
15
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records-subscribe.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/records-subscribe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,8BAA8B,EAAE,QAAQ,EAAE,aAAa,EAA8B,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAE9J,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAW9D,MAAM,MAAM,uBAAuB,GAAG;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,cAAc,CAAC,EAAE,8BAA8B,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,eAAe,CAAC,uBAAuB,CAAC;WAExD,KAAK,CAAC,OAAO,EAAE,uBAAuB,GAAG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GeneralJws } from '../types/jws-types.js';
|
|
2
2
|
import type { MessageSigner } from '../types/signer.js';
|
|
3
3
|
import type { EncryptionInput, JweEncryption } from '../utils/encryption.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { RecordsWriteMessage } from '../types/records-types.js';
|
|
5
5
|
/**
|
|
6
6
|
* Creates the JWE `encryption` property if encryption input is given. Else `undefined` is returned.
|
|
7
7
|
* Uses ECDH-ES+A256KW key agreement with X25519 and AEAD content encryption (A256GCM or XC20P).
|
|
8
|
-
* @param descriptor Descriptor of the `RecordsWrite` message which contains the information needed by key path derivation schemes.
|
|
9
8
|
* @param encryptionInput The encryption input containing CEK, IV, authentication tag, and recipient key encryption inputs.
|
|
10
9
|
*/
|
|
11
|
-
export declare function createEncryptionProperty(
|
|
10
|
+
export declare function createEncryptionProperty(encryptionInput: EncryptionInput | undefined): Promise<JweEncryption | undefined>;
|
|
12
11
|
/**
|
|
13
12
|
* Creates the `attestation` property of a RecordsWrite message if given signature inputs; returns `undefined` otherwise.
|
|
14
13
|
*/
|
|
@@ -18,7 +17,7 @@ export declare function createAttestation(descriptorCid: string, signers?: Messa
|
|
|
18
17
|
*/
|
|
19
18
|
export declare function createSignerSignature(input: {
|
|
20
19
|
recordId: string;
|
|
21
|
-
contextId: string
|
|
20
|
+
contextId: string;
|
|
22
21
|
descriptorCid: string;
|
|
23
22
|
attestation: GeneralJws | undefined;
|
|
24
23
|
encryption: JweEncryption | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records-write-signing.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/records-write-signing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAkC,
|
|
1
|
+
{"version":3,"file":"records-write-signing.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/records-write-signing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAkC,mBAAmB,EAAgC,MAAM,2BAA2B,CAAC;AAUnI;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,eAAe,EAAE,eAAe,GAAG,SAAS,GAC3C,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CASpC;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAUzH;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,UAAU,GAAG,SAAS,CAAC;IACpC,UAAU,EAAE,aAAa,GAAG,SAAS,CAAC;IACtC,MAAM,EAAE,aAAa,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GAAG,OAAO,CAAC,UAAU,CAAC,CAwBtB;AAED;;;GAGG;AACH,wBAAsB,4BAA4B,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiC9F"}
|
|
@@ -9,15 +9,15 @@ import type { EncryptionInput, JweEncryption } from '../utils/encryption.js';
|
|
|
9
9
|
import type { GenericMessage, GenericSignaturePayload } from '../types/message-types.js';
|
|
10
10
|
export type RecordsWriteOptions = {
|
|
11
11
|
recipient?: string;
|
|
12
|
-
protocol
|
|
13
|
-
protocolPath
|
|
12
|
+
protocol: string;
|
|
13
|
+
protocolPath: string;
|
|
14
14
|
protocolRole?: string;
|
|
15
15
|
schema?: string;
|
|
16
16
|
tags?: RecordsWriteTags;
|
|
17
17
|
recordId?: string;
|
|
18
18
|
/**
|
|
19
19
|
* Must be given if this message is for a non-root protocol record.
|
|
20
|
-
* If not given, it
|
|
20
|
+
* If not given, it means this write is for a root protocol record.
|
|
21
21
|
*/
|
|
22
22
|
parentContextId?: string;
|
|
23
23
|
data?: Uint8Array;
|
|
@@ -39,6 +39,12 @@ export type RecordsWriteOptions = {
|
|
|
39
39
|
attestationSigners?: MessageSigner[];
|
|
40
40
|
encryptionInput?: EncryptionInput;
|
|
41
41
|
permissionGrantId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* When `true`, this record is a squash (snapshot) write that atomically creates a snapshot
|
|
44
|
+
* and deletes all older sibling records at the same protocol path within the same parent context.
|
|
45
|
+
* Only valid at protocol paths with `$squash: true`. Must be an initial write (new record).
|
|
46
|
+
*/
|
|
47
|
+
squash?: true;
|
|
42
48
|
/**
|
|
43
49
|
* The author's ProtocolPath-derived public key for key delivery.
|
|
44
50
|
* When set, this is attached to the authorization model so the DWN owner
|
|
@@ -138,7 +144,7 @@ export declare class RecordsWrite implements MessageInterface<RecordsWriteMessag
|
|
|
138
144
|
* @param options.dateCreated If `undefined`, it will be auto-filled with current time.
|
|
139
145
|
* @param options.messageTimestamp If `undefined`, it will be auto-filled with current time.
|
|
140
146
|
* @param options.parentContextId Must be given if this message is for a non-root protocol record.
|
|
141
|
-
* If not given, it
|
|
147
|
+
* If not given, it means this write is for a root protocol record.
|
|
142
148
|
*/
|
|
143
149
|
static create(options: RecordsWriteOptions): Promise<RecordsWrite>;
|
|
144
150
|
private static getRecordIdFromContextId;
|
|
@@ -204,10 +210,6 @@ export declare class RecordsWrite implements MessageInterface<RecordsWriteMessag
|
|
|
204
210
|
* There is opportunity to integrate better with `validateSchema(...)`
|
|
205
211
|
*/
|
|
206
212
|
private validateIntegrity;
|
|
207
|
-
/**
|
|
208
|
-
* Delegate to the standalone `validateAttestationIntegrity` function for backward compatibility.
|
|
209
|
-
*/
|
|
210
|
-
private static validateAttestationIntegrity;
|
|
211
213
|
/**
|
|
212
214
|
* Computes the deterministic Entry ID of this message.
|
|
213
215
|
*/
|
|
@@ -235,14 +237,12 @@ export declare class RecordsWrite implements MessageInterface<RecordsWriteMessag
|
|
|
235
237
|
* Checks if the given message is the initial entry of a record.
|
|
236
238
|
*/
|
|
237
239
|
static isInitialWrite(message: GenericMessage): Promise<boolean>;
|
|
238
|
-
/** Delegate to `createEncryptionProperty` in `records-write-signing.ts`. */
|
|
239
|
-
private static createEncryptionProperty;
|
|
240
240
|
/** Delegate to `createAttestation` in `records-write-signing.ts`. */
|
|
241
241
|
static createAttestation(descriptorCid: string, signers?: MessageSigner[]): Promise<GeneralJws | undefined>;
|
|
242
242
|
/** Delegate to `createSignerSignature` in `records-write-signing.ts`. */
|
|
243
243
|
static createSignerSignature(input: {
|
|
244
244
|
recordId: string;
|
|
245
|
-
contextId: string
|
|
245
|
+
contextId: string;
|
|
246
246
|
descriptorCid: string;
|
|
247
247
|
attestation: GeneralJws | undefined;
|
|
248
248
|
encryption: JweEncryption | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records-write.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/records-write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2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ACtD,wBAAwB,CAC1C,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAC3D,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAIpC,iFAAiF;WAC7D,+BAA+B,CACjD,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAC3D,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;CAG5C"}
|
|
@@ -51,7 +51,7 @@ export declare class PermissionGrant {
|
|
|
51
51
|
* and that the decoded data contains `scope` and `dateExpires`.
|
|
52
52
|
* @throws {DwnError} if any required field is missing.
|
|
53
53
|
*/
|
|
54
|
-
static parse(message: DataEncodedRecordsWriteMessage):
|
|
54
|
+
static parse(message: DataEncodedRecordsWriteMessage): PermissionGrant;
|
|
55
55
|
/**
|
|
56
56
|
* Validates that the message has the required structural fields for a permission grant.
|
|
57
57
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission-grant.d.ts","sourceRoot":"","sources":["../../../../src/protocols/permission-grant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAuB,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAO/G;;GAEG;AACH,qBAAa,eAAe;IAE1B;;OAEG;IACH,SAAgB,EAAE,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,SAAgB,OAAO,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,SAAgB,OAAO,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAC;IAEpC;;OAEG;IACH,SAAgB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErC;;OAEG;IACH,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnC;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAC;IAEpC;;OAEG;IACH,SAAgB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpC;;OAEG;IACH,SAAgB,KAAK,EAAE,eAAe,CAAC;IAEvC;;OAEG;IACH,SAAgB,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAElD;;;;;;OAMG;
|
|
1
|
+
{"version":3,"file":"permission-grant.d.ts","sourceRoot":"","sources":["../../../../src/protocols/permission-grant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAuB,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAO/G;;GAEG;AACH,qBAAa,eAAe;IAE1B;;OAEG;IACH,SAAgB,EAAE,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,SAAgB,OAAO,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,SAAgB,OAAO,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAC;IAEpC;;OAEG;IACH,SAAgB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErC;;OAEG;IACH,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnC;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAC;IAEpC;;OAEG;IACH,SAAgB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpC;;OAEG;IACH,SAAgB,KAAK,EAAE,eAAe,CAAC;IAEvC;;OAEG;IACH,SAAgB,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAElD;;;;;;OAMG;WACW,KAAK,CAAC,OAAO,EAAE,8BAA8B,GAAG,eAAe;IAM7E;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAuC9B,OAAO;CAiBR"}
|
|
@@ -36,7 +36,7 @@ export declare class PermissionRequest {
|
|
|
36
36
|
* and that the decoded data contains `scope`.
|
|
37
37
|
* @throws {DwnError} if any required field is missing.
|
|
38
38
|
*/
|
|
39
|
-
static parse(message: DataEncodedRecordsWriteMessage):
|
|
39
|
+
static parse(message: DataEncodedRecordsWriteMessage): PermissionRequest;
|
|
40
40
|
/**
|
|
41
41
|
* Validates that the message has the required structural fields for a permission request.
|
|
42
42
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission-request.d.ts","sourceRoot":"","sources":["../../../../src/protocols/permission-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAyB,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAOjH;;GAEG;AACH,qBAAa,iBAAiB;IAE5B;;OAEG;IACH,SAAgB,EAAE,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,SAAgB,SAAS,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,SAAgB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErC;;;OAGG;IACH,SAAgB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpC;;OAEG;IACH,SAAgB,KAAK,EAAE,eAAe,CAAC;IAEvC;;OAEG;IACH,SAAgB,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAElD;;;;;;OAMG;
|
|
1
|
+
{"version":3,"file":"permission-request.d.ts","sourceRoot":"","sources":["../../../../src/protocols/permission-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAyB,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAOjH;;GAEG;AACH,qBAAa,iBAAiB;IAE5B;;OAEG;IACH,SAAgB,EAAE,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,SAAgB,SAAS,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,SAAgB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErC;;;OAGG;IACH,SAAgB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpC;;OAEG;IACH,SAAgB,KAAK,EAAE,eAAe,CAAC;IAEvC;;OAEG;IACH,SAAgB,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAElD;;;;;;OAMG;WACW,KAAK,CAAC,OAAO,EAAE,8BAA8B,GAAG,iBAAiB;IAM/E;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAyB9B,OAAO;CAaR"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { Filter } from '../types/query-types.js';
|
|
2
|
+
import type { MessagesFilter } from '../types/messages-types.js';
|
|
1
3
|
import type { MessageSigner } from '../types/signer.js';
|
|
2
4
|
import type { MessageStore } from '../types/message-store.js';
|
|
3
5
|
import type { ProtocolDefinition } from '../types/protocols-types.js';
|
|
6
|
+
import type { CoreProtocol, CoreProtocolStores } from '../core/core-protocol.js';
|
|
4
7
|
import type { DataEncodedRecordsWriteMessage, RecordsWriteMessage } from '../types/records-types.js';
|
|
5
8
|
import type { PermissionConditions, PermissionGrantData, PermissionRequestData, PermissionRevocationData, PermissionScope } from '../types/permission-types.js';
|
|
6
9
|
import { PermissionGrant } from './permission-grant.js';
|
|
7
|
-
import { RecordsWrite } from '
|
|
10
|
+
import { RecordsWrite } from '../interfaces/records-write.js';
|
|
8
11
|
/**
|
|
9
12
|
* Options for creating a permission request.
|
|
10
13
|
*/
|
|
@@ -56,12 +59,16 @@ export type PermissionRevocationCreateOptions = {
|
|
|
56
59
|
};
|
|
57
60
|
/**
|
|
58
61
|
* This is a first-class DWN protocol for managing permission grants of a given DWN.
|
|
62
|
+
*
|
|
63
|
+
* It implements the `CoreProtocol` interface so that its lifecycle hooks
|
|
64
|
+
* (validation, pre-processing, post-processing) are dispatched generically
|
|
65
|
+
* by the `CoreProtocolRegistry` rather than being hardcoded in handlers.
|
|
59
66
|
*/
|
|
60
|
-
export declare class PermissionsProtocol {
|
|
67
|
+
export declare class PermissionsProtocol implements CoreProtocol {
|
|
61
68
|
/**
|
|
62
69
|
* The URI of the DWN Permissions protocol.
|
|
63
70
|
*/
|
|
64
|
-
static readonly uri = "https://
|
|
71
|
+
static readonly uri = "https://identity.foundation/dwn/permissions";
|
|
65
72
|
/**
|
|
66
73
|
* The protocol path of the `request` record.
|
|
67
74
|
*/
|
|
@@ -78,6 +85,36 @@ export declare class PermissionsProtocol {
|
|
|
78
85
|
* The definition of the Permissions protocol.
|
|
79
86
|
*/
|
|
80
87
|
static readonly definition: ProtocolDefinition;
|
|
88
|
+
/** @inheritdoc */
|
|
89
|
+
get uri(): string;
|
|
90
|
+
/** @inheritdoc */
|
|
91
|
+
get definition(): ProtocolDefinition;
|
|
92
|
+
/** @inheritdoc */
|
|
93
|
+
validateRecord(message: RecordsWriteMessage, dataBytes: Uint8Array): void;
|
|
94
|
+
/**
|
|
95
|
+
* Pre-processing hook for permission revocation records.
|
|
96
|
+
* Validates that the revocation's `tags.protocol` matches the grant's scoped protocol.
|
|
97
|
+
*/
|
|
98
|
+
preProcessWrite(tenant: string, message: RecordsWriteMessage, messageStore: MessageStore): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Post-processing hook for permission revocation records.
|
|
101
|
+
* When a grant is revoked, all messages authorized by that grant and created
|
|
102
|
+
* after the revocation timestamp are deleted from all stores.
|
|
103
|
+
*
|
|
104
|
+
* Deletion order is deliberate to avoid orphaned data in case of crash:
|
|
105
|
+
* 1. data store (large blobs first)
|
|
106
|
+
* 2. state index (SMT entries)
|
|
107
|
+
* 3. message store
|
|
108
|
+
*/
|
|
109
|
+
postProcessWrite(tenant: string, recordsWrite: RecordsWrite, stores: CoreProtocolStores): Promise<void>;
|
|
110
|
+
/** @inheritdoc */
|
|
111
|
+
mapErrorToStatusCode(errorCode: string): number | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Constructs an additional filter for protocol-scoped message queries so that
|
|
114
|
+
* permission records (grants, requests, revocations) tagged with the target
|
|
115
|
+
* protocol appear alongside that protocol's own records in sync/subscribe/read results.
|
|
116
|
+
*/
|
|
117
|
+
constructAdditionalMessageFilter(filter: MessagesFilter): Filter | undefined;
|
|
81
118
|
static parseRequest(base64UrlEncodedRequest: string): PermissionRequestData;
|
|
82
119
|
/**
|
|
83
120
|
* Convenience method to create a permission request.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../../src/protocols/permissions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../../src/protocols/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,KAAK,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrG,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,eAAe,EAA0B,MAAM,8BAA8B,CAAC;AAMxL,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAO9D;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C;;OAEG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IAEvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAIvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,eAAe,CAAC;IACvB,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MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB5D,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhE,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhE,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1F,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAK/D,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAO/F;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAWrB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAYvB;;;OAGG;YACW,UAAU;IAYxB;;OAEG;YACW,YAAY;IAO1B;;OAEG;YACW,gBAAgB;IAS9B;;OAEG;YACW,mBAAmB;IAKjC;;OAEG;YACW,gBAAgB;CAG/B"}
|
|
@@ -5,8 +5,13 @@ import { createLevelDatabase } from './level-wrapper.js';
|
|
|
5
5
|
* A simple implementation of {@link DataStore} that works in both the browser and server-side.
|
|
6
6
|
* Leverages LevelDB under the hood.
|
|
7
7
|
*
|
|
8
|
-
* It has the following structure (`+` represents an additional sublevel
|
|
9
|
-
* '
|
|
8
|
+
* It has the following sublevel structure (`+` represents an additional sublevel):
|
|
9
|
+
* 'refs' + <tenant> + <recordId> : key <dataCid> → JSON { dataSize }
|
|
10
|
+
* 'blocks' + <dataCid> : key <blockCid> → block data (shared)
|
|
11
|
+
* 'refcounts' : key <dataCid> → JSON { count, dataSize }
|
|
12
|
+
*
|
|
13
|
+
* Identical data (same dataCid) is stored only once in the blocks sublevel.
|
|
14
|
+
* Multiple (tenant, recordId) pairs can reference the same blocks.
|
|
10
15
|
*/
|
|
11
16
|
export declare class DataStoreLevel implements DataStore {
|
|
12
17
|
config: DataStoreLevelConfig;
|
|
@@ -22,9 +27,20 @@ export declare class DataStoreLevel implements DataStore {
|
|
|
22
27
|
*/
|
|
23
28
|
clear(): Promise<void>;
|
|
24
29
|
/**
|
|
25
|
-
* Gets the
|
|
30
|
+
* Gets the refs sublevel for the given tenant and recordId.
|
|
31
|
+
* Caller uses `dataCid` as the key within the returned partition.
|
|
32
|
+
*/
|
|
33
|
+
private getRefsPartition;
|
|
34
|
+
/**
|
|
35
|
+
* Gets the shared blocks sublevel for the given dataCid.
|
|
36
|
+
* Used as a Blockstore for ipfs-unixfs-importer/exporter.
|
|
37
|
+
*/
|
|
38
|
+
private getBlocksPartition;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the refcounts sublevel.
|
|
41
|
+
* Key: `dataCid` → JSON `{ count, dataSize }`.
|
|
26
42
|
*/
|
|
27
|
-
private
|
|
43
|
+
private getRefcountsPartition;
|
|
28
44
|
}
|
|
29
45
|
export type DataStoreLevelConfig = {
|
|
30
46
|
blockstoreLocation?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-store-level.d.ts","sourceRoot":"","sources":["../../../../src/store/data-store-level.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-store-level.d.ts","sourceRoot":"","sources":["../../../../src/store/data-store-level.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAQzD;;;;;;;;;;;GAWG;AACH,qBAAa,cAAe,YAAW,SAAS;IAC9C,MAAM,EAAE,oBAAoB,CAAC;IAE7B,UAAU,EAAE,eAAe,CAAC;gBAEhB,MAAM,GAAE,oBAAyB;IAahC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkDpH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAmC/F,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCrF;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC;;;OAGG;YACW,gBAAgB;IAM9B;;;OAGG;YACW,kBAAkB;IAKhC;;;OAGG;YACW,qBAAqB;CAIpC;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,mBAAmB,CAAC;CAClD,CAAC"}
|
|
@@ -143,6 +143,10 @@ export declare class IndexLevel {
|
|
|
143
143
|
queryWithInMemoryPaging(tenant: string, filters: Filter[], queryOptions: QueryOptions, options?: IndexLevelOptions): Promise<IndexedItem[]>;
|
|
144
144
|
/**
|
|
145
145
|
* Execute a filtered query against a single filter and return all results.
|
|
146
|
+
*
|
|
147
|
+
* Sub-queries (exact match, range, OneOf) are executed sequentially to avoid opening
|
|
148
|
+
* multiple concurrent IndexedDB cursors. Firefox's IDB implementation intermittently
|
|
149
|
+
* drops results when cursors overlap — see https://github.com/enboxorg/enbox/issues/264
|
|
146
150
|
*/
|
|
147
151
|
private executeSingleFilterQuery;
|
|
148
152
|
private getAllItems;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-level.d.ts","sourceRoot":"","sources":["../../../../src/store/index-level.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAe,MAAM,yBAAyB,CAAC;AAa3H,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,mBAAmB,CAAC;IACjD,eAAe,CAAC,EAAE,uBAAuB,EAAE,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS,CAAA;CAAE,CAAC;AAErE;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAIF,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB,EAAE,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,CAAC,gBAAgB,CAA4B;gBAExC,MAAM,EAAE,gBAAgB;IAe9B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,I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|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { DataStore } from '../types/data-store.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { EventLog } from '../types/subscriptions.js';
|
|
3
3
|
import type { GenericMessage } from '../types/message-types.js';
|
|
4
4
|
import type { MessageStore } from '../types/message-store.js';
|
|
5
5
|
import type { StateIndex } from '../types/state-index.js';
|
|
6
|
-
import type { RecordsDeleteMessage } from '../types/records-types.js';
|
|
6
|
+
import type { RecordsDeleteMessage, RecordsWriteMessage } from '../types/records-types.js';
|
|
7
7
|
export type ResumableRecordsDeleteData = {
|
|
8
8
|
tenant: string;
|
|
9
9
|
message: RecordsDeleteMessage;
|
|
10
10
|
};
|
|
11
|
+
export type ResumableRecordsSquashData = {
|
|
12
|
+
tenant: string;
|
|
13
|
+
message: RecordsWriteMessage;
|
|
14
|
+
};
|
|
11
15
|
/**
|
|
12
16
|
* A class that provides an abstraction for the usage of MessageStore, DataStore, and StateIndex.
|
|
13
17
|
*/
|
|
@@ -15,14 +19,24 @@ export declare class StorageController {
|
|
|
15
19
|
private messageStore;
|
|
16
20
|
private dataStore;
|
|
17
21
|
private stateIndex;
|
|
18
|
-
private
|
|
19
|
-
constructor({ messageStore, dataStore, stateIndex,
|
|
22
|
+
private eventLog?;
|
|
23
|
+
constructor({ messageStore, dataStore, stateIndex, eventLog }: {
|
|
20
24
|
messageStore: MessageStore;
|
|
21
25
|
dataStore: DataStore;
|
|
22
26
|
stateIndex: StateIndex;
|
|
23
|
-
|
|
27
|
+
eventLog?: EventLog;
|
|
24
28
|
});
|
|
25
29
|
performRecordsDelete({ tenant, message }: ResumableRecordsDeleteData): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Performs the squash processing for a `RecordsWrite` with `squash: true`.
|
|
32
|
+
* Deletes all sibling records at the same protocol path and parent context whose
|
|
33
|
+
* `messageTimestamp` is strictly older than the squash record's `messageTimestamp`.
|
|
34
|
+
* Unlike normal `RecordsDelete` tombstones, squash targets are fully purged — no initial writes
|
|
35
|
+
* are retained.
|
|
36
|
+
*
|
|
37
|
+
* This method is idempotent — it can be safely re-run on resume after a crash.
|
|
38
|
+
*/
|
|
39
|
+
performRecordsSquash({ tenant, message }: ResumableRecordsSquashData): Promise<void>;
|
|
26
40
|
/**
|
|
27
41
|
* Deletes the data referenced by the given message if needed.
|
|
28
42
|
* @param message The message to check if the data it references should be deleted.
|
|
@@ -36,7 +50,7 @@ export declare class StorageController {
|
|
|
36
50
|
* Purges (permanent hard-delete) all messages of the SAME `recordId` given and their associated data and events.
|
|
37
51
|
* Assumes that the given `recordMessages` are all of the same `recordId`.
|
|
38
52
|
*/
|
|
39
|
-
|
|
53
|
+
static purgeRecordMessages(tenant: string, recordMessages: GenericMessage[], messageStore: MessageStore, dataStore: DataStore, stateIndex: StateIndex): Promise<void>;
|
|
40
54
|
/**
|
|
41
55
|
* Deletes all messages in `existingMessages` that are older than the `newestMessage` in the given tenant,
|
|
42
56
|
* but keep the initial write write for future processing by ensuring its `isLatestBaseState` index is "false".
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-controller.d.ts","sourceRoot":"","sources":["../../../../src/store/storage-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"storage-controller.d.ts","sourceRoot":"","sources":["../../../../src/store/storage-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,oBAAoB,E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AAC;IAqBhB;;;OAGG;WACiB,yCAAyC,CAC3D,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,cAAc,EAAE,EAClC,aAAa,EAAE,cAAc,EAC7B,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC;CAqCjB"}
|
|
@@ -57,12 +57,12 @@ export type DelegatedGrantRecordsWriteMessage = {
|
|
|
57
57
|
signature: GeneralJws;
|
|
58
58
|
};
|
|
59
59
|
recordId: string;
|
|
60
|
-
contextId
|
|
60
|
+
contextId: string;
|
|
61
61
|
descriptor: {
|
|
62
62
|
interface: DwnInterfaceName.Records;
|
|
63
63
|
method: DwnMethodName.Write;
|
|
64
|
-
protocol
|
|
65
|
-
protocolPath
|
|
64
|
+
protocol: string;
|
|
65
|
+
protocolPath: string;
|
|
66
66
|
recipient?: string;
|
|
67
67
|
schema?: string;
|
|
68
68
|
parentId?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-types.d.ts","sourceRoot":"","sources":["../../../../src/types/message-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,CAAC,EAAE,kBAAkB,CAAC;IAEnC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,SAAS,EAAE,UAAU,CAAC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C1B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,gBAAgB,CAAC,EAAE,aAAa,CAAC;CAClC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MessageEvent } from './subscriptions.js';
|
|
2
1
|
import type { RangeCriterion } from './query-types.js';
|
|
2
|
+
import type { SubscriptionListener } from './subscriptions.js';
|
|
3
3
|
import type { AuthorizationModel, GenericMessage, GenericMessageReply, MessageSubscription } from './message-types.js';
|
|
4
4
|
import type { DwnInterfaceName, DwnMethodName } from '../enums/dwn-interface-method.js';
|
|
5
5
|
/**
|
|
@@ -49,9 +49,12 @@ export type MessagesSyncReply = GenericMessageReply & {
|
|
|
49
49
|
hash?: string;
|
|
50
50
|
entries?: string[];
|
|
51
51
|
};
|
|
52
|
-
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated Use {@link SubscriptionListener} directly. Retained as an alias for migration.
|
|
54
|
+
*/
|
|
55
|
+
export type MessageSubscriptionHandler = SubscriptionListener;
|
|
53
56
|
export type MessagesSubscribeMessageOptions = {
|
|
54
|
-
subscriptionHandler:
|
|
57
|
+
subscriptionHandler: SubscriptionListener;
|
|
55
58
|
};
|
|
56
59
|
export type MessagesSubscribeMessage = {
|
|
57
60
|
authorization: AuthorizationModel;
|
|
@@ -66,5 +69,11 @@ export type MessagesSubscribeDescriptor = {
|
|
|
66
69
|
messageTimestamp: string;
|
|
67
70
|
filters: MessagesFilter[];
|
|
68
71
|
permissionGrantId?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Opaque EventLog cursor string to resume from. When provided, the handler replays
|
|
74
|
+
* events from the EventLog starting after this cursor instead of returning no
|
|
75
|
+
* initial snapshot. An EOSE marker is sent after catch-up.
|
|
76
|
+
*/
|
|
77
|
+
cursor?: string;
|
|
69
78
|
};
|
|
70
79
|
//# sourceMappingURL=messages-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages-types.d.ts","sourceRoot":"","sources":["../../../../src/types/messages-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"messages-types.d.ts","sourceRoot":"","sources":["../../../../src/types/messages-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACvH,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAExF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,cAAc,CAAC;CACn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G,MAAM,CAAC;IACf,OAAO,CAAC,EAAG,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAE9D,MAAM,MAAM,+BAA+B,GAAG;IAC5C,mBAAmB,EAAE,oBAAoB,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,kBAAkB,CAAC;IAClC,UAAU,EAAE,2BAA2B,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GAAG;IACzD,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,SAAS,EAAE,gBAAgB,CAAC,QAAQ,CAAC;IACrC,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { CoreProtocolRegistry } from '../core/core-protocol.js';
|
|
2
|
+
import type { DataStore } from './data-store.js';
|
|
3
|
+
import type { DidResolver } from '@enbox/dids';
|
|
4
|
+
import type { MessageStore } from './message-store.js';
|
|
5
|
+
import type { ResumableTaskManager } from '../core/resumable-task-manager.js';
|
|
6
|
+
import type { StateIndex } from './state-index.js';
|
|
7
|
+
import type { EventLog, SubscriptionListener } from './subscriptions.js';
|
|
3
8
|
import type { GenericMessage, GenericMessageReply } from './message-types.js';
|
|
4
9
|
/**
|
|
5
10
|
* Interface that defines a message handler of a specific method.
|
|
@@ -12,7 +17,23 @@ export interface MethodHandler {
|
|
|
12
17
|
tenant: string;
|
|
13
18
|
message: GenericMessage;
|
|
14
19
|
dataStream?: ReadableStream<Uint8Array>;
|
|
15
|
-
subscriptionHandler?:
|
|
20
|
+
subscriptionHandler?: SubscriptionListener;
|
|
16
21
|
}): Promise<GenericMessageReply>;
|
|
17
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Shared dependency bag for all DWN method handlers.
|
|
25
|
+
*
|
|
26
|
+
* Every handler receives the same object; each handler accesses only the
|
|
27
|
+
* dependencies it needs. Adding a new dependency here is a single-line
|
|
28
|
+
* change — no handler constructor signatures need updating.
|
|
29
|
+
*/
|
|
30
|
+
export type HandlerDependencies = {
|
|
31
|
+
didResolver: DidResolver;
|
|
32
|
+
messageStore: MessageStore;
|
|
33
|
+
dataStore?: DataStore;
|
|
34
|
+
stateIndex?: StateIndex;
|
|
35
|
+
resumableTaskManager?: ResumableTaskManager;
|
|
36
|
+
coreProtocols?: CoreProtocolRegistry;
|
|
37
|
+
eventLog?: EventLog;
|
|
38
|
+
};
|
|
18
39
|
//# sourceMappingURL=method-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method-handler.d.ts","sourceRoot":"","sources":["../../../../src/types/method-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"method-handler.d.ts","sourceRoot":"","sources":["../../../../src/types/method-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,cAAc,CAAC;QACxB,UAAU,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;QACvC,mBAAmB,CAAC,EAAE,oBAAoB,CAAC;KAC5C,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAClC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC"}
|
|
@@ -61,6 +61,13 @@ export type ProtocolPermissionScope = {
|
|
|
61
61
|
method: DwnMethodName.Configure | DwnMethodName.Query;
|
|
62
62
|
protocol?: string;
|
|
63
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* Permission scope for the Messages interface.
|
|
66
|
+
*
|
|
67
|
+
* A `Read` scope is a unified scope that authorizes `MessagesRead`, `MessagesSubscribe`, and `MessagesSync` operations.
|
|
68
|
+
* The `Subscribe` and `Sync` method values are retained for backward compatibility with existing grants but are
|
|
69
|
+
* functionally equivalent to `Read` — new grants SHOULD use `Read` exclusively.
|
|
70
|
+
*/
|
|
64
71
|
export type MessagesPermissionScope = {
|
|
65
72
|
interface: DwnInterfaceName.Messages;
|
|
66
73
|
method: DwnMethodName.Read | DwnMethodName.Subscribe | DwnMethodName.Sync;
|