@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
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import { getRuleSetAtPath } from '../utils/protocols.js';
|
|
2
|
-
import { PermissionsProtocol } from '../protocols/permissions.js';
|
|
3
2
|
import { SortDirection } from '../types/query-types.js';
|
|
4
3
|
import { DwnError, DwnErrorCode } from './dwn-error.js';
|
|
5
4
|
import { DwnInterfaceName, DwnMethodName } from '../enums/dwn-interface-method.js';
|
|
6
|
-
import { authorizeAgainstAllowedActions,
|
|
5
|
+
import { authorizeAgainstAllowedActions, verifyInvokedRole } from './protocol-authorization-action.js';
|
|
7
6
|
import { constructRecordChain, fetchInitialWrite, getGoverningTimestamp } from './record-chain.js';
|
|
8
|
-
import { verifyAsRoleRecordIfNeeded, verifyProtocolPathAndContextId, verifySizeLimit, verifyTagsIfNeeded, verifyTypeWithComposition, } from './protocol-authorization-validation.js';
|
|
7
|
+
import { verifyAsRoleRecordIfNeeded, verifyImmutability, verifyProtocolPathAndContextId, verifyRecordLimit, verifySizeLimit, verifySquashEligibility, verifyTagsIfNeeded, verifyTypeWithComposition, } from './protocol-authorization-validation.js';
|
|
9
8
|
export class ProtocolAuthorization {
|
|
10
9
|
/**
|
|
11
10
|
* Performs validation on the structure of RecordsWrite messages that use a protocol.
|
|
12
11
|
* @throws {Error} if validation fails.
|
|
13
12
|
*/
|
|
14
|
-
static async validateReferentialIntegrity(tenant, incomingMessage, messageStore) {
|
|
13
|
+
static async validateReferentialIntegrity(tenant, incomingMessage, messageStore, coreProtocols) {
|
|
15
14
|
// Determine the governing timestamp for protocol definition lookup.
|
|
16
15
|
// For an initial write, this is the message's own timestamp.
|
|
17
16
|
// For an update, this is the initial write's timestamp (the protocol version is locked at creation time).
|
|
18
17
|
const governingTimestamp = await getGoverningTimestamp(tenant, incomingMessage, messageStore);
|
|
19
18
|
// fetch the protocol definition that was active at the governing timestamp
|
|
20
|
-
const protocolDefinition = await ProtocolAuthorization.fetchProtocolDefinition(tenant, incomingMessage.message.descriptor.protocol, messageStore, governingTimestamp);
|
|
19
|
+
const protocolDefinition = await ProtocolAuthorization.fetchProtocolDefinition(tenant, incomingMessage.message.descriptor.protocol, messageStore, governingTimestamp, coreProtocols);
|
|
20
|
+
// Create a bound fetch function that captures the registry for downstream callbacks.
|
|
21
|
+
const boundFetchDefinition = ProtocolAuthorization.createBoundFetchDefinition(coreProtocols);
|
|
21
22
|
// verify declared protocol type exists in protocol and that it conforms to type specification.
|
|
22
23
|
// For cross-protocol composition, the type may be defined in a referenced protocol.
|
|
23
|
-
await verifyTypeWithComposition(tenant, incomingMessage.message, protocolDefinition, messageStore,
|
|
24
|
+
await verifyTypeWithComposition(tenant, incomingMessage.message, protocolDefinition, messageStore, boundFetchDefinition, governingTimestamp);
|
|
24
25
|
// validate `protocolPath`
|
|
25
|
-
await verifyProtocolPathAndContextId(tenant, incomingMessage, messageStore,
|
|
26
|
+
await verifyProtocolPathAndContextId(tenant, incomingMessage, messageStore, boundFetchDefinition, governingTimestamp);
|
|
26
27
|
// get the rule set for the inbound message
|
|
27
28
|
const ruleSet = ProtocolAuthorization.getRuleSet(incomingMessage.message.descriptor.protocolPath, protocolDefinition);
|
|
28
29
|
// Validate as a role record if the incoming message is writing a role record
|
|
@@ -31,12 +32,18 @@ export class ProtocolAuthorization {
|
|
|
31
32
|
verifySizeLimit(incomingMessage, ruleSet);
|
|
32
33
|
// Verify protocol tags
|
|
33
34
|
verifyTagsIfNeeded(incomingMessage, ruleSet);
|
|
35
|
+
// Verify immutability — reject updates to write-once records
|
|
36
|
+
await verifyImmutability(incomingMessage, ruleSet);
|
|
37
|
+
// Verify squash eligibility — ensure squash writes are at $squash: true paths and are initial writes
|
|
38
|
+
await verifySquashEligibility(incomingMessage, ruleSet);
|
|
39
|
+
// Verify record count limit
|
|
40
|
+
await verifyRecordLimit(tenant, incomingMessage, ruleSet, messageStore);
|
|
34
41
|
}
|
|
35
42
|
/**
|
|
36
43
|
* Performs protocol-based authorization against the incoming RecordsWrite message.
|
|
37
44
|
* @throws {Error} if authorization fails.
|
|
38
45
|
*/
|
|
39
|
-
static async authorizeWrite(tenant, incomingMessage, messageStore) {
|
|
46
|
+
static async authorizeWrite(tenant, incomingMessage, messageStore, coreProtocols) {
|
|
40
47
|
const existingInitialWrite = await fetchInitialWrite(tenant, incomingMessage.message.recordId, messageStore);
|
|
41
48
|
let recordChain;
|
|
42
49
|
if (existingInitialWrite === undefined) {
|
|
@@ -51,11 +58,12 @@ export class ProtocolAuthorization {
|
|
|
51
58
|
// Determine the governing timestamp for protocol definition lookup.
|
|
52
59
|
const governingTimestamp = await getGoverningTimestamp(tenant, incomingMessage, messageStore);
|
|
53
60
|
// fetch the protocol definition that was active at the governing timestamp
|
|
54
|
-
const protocolDefinition = await ProtocolAuthorization.fetchProtocolDefinition(tenant, incomingMessage.message.descriptor.protocol, messageStore, governingTimestamp);
|
|
61
|
+
const protocolDefinition = await ProtocolAuthorization.fetchProtocolDefinition(tenant, incomingMessage.message.descriptor.protocol, messageStore, governingTimestamp, coreProtocols);
|
|
55
62
|
// get the rule set for the inbound message
|
|
56
63
|
const ruleSet = ProtocolAuthorization.getRuleSet(incomingMessage.message.descriptor.protocolPath, protocolDefinition);
|
|
64
|
+
const boundFetchDefinition = ProtocolAuthorization.createBoundFetchDefinition(coreProtocols);
|
|
57
65
|
// If the incoming message has `protocolRole` in the descriptor, validate the invoked role
|
|
58
|
-
await verifyInvokedRole(tenant, incomingMessage, incomingMessage.message.descriptor.protocol, incomingMessage.message.contextId, protocolDefinition, messageStore,
|
|
66
|
+
await verifyInvokedRole(tenant, incomingMessage, incomingMessage.message.descriptor.protocol, incomingMessage.message.contextId, protocolDefinition, messageStore, boundFetchDefinition, governingTimestamp);
|
|
59
67
|
// verify method invoked against the allowed actions in the rule set
|
|
60
68
|
await authorizeAgainstAllowedActions(tenant, incomingMessage, ruleSet, recordChain, messageStore, protocolDefinition);
|
|
61
69
|
}
|
|
@@ -64,7 +72,7 @@ export class ProtocolAuthorization {
|
|
|
64
72
|
* @param newestRecordsWrite The latest RecordsWrite associated with the recordId being read.
|
|
65
73
|
* @throws {Error} if authorization fails.
|
|
66
74
|
*/
|
|
67
|
-
static async authorizeRead(tenant, incomingMessage, newestRecordsWrite, messageStore) {
|
|
75
|
+
static async authorizeRead(tenant, incomingMessage, newestRecordsWrite, messageStore, coreProtocols) {
|
|
68
76
|
// fetch record chain
|
|
69
77
|
const recordChain = await constructRecordChain(tenant, newestRecordsWrite.message.recordId, messageStore);
|
|
70
78
|
// Use the initial write's timestamp to determine the governing protocol definition.
|
|
@@ -74,24 +82,26 @@ export class ProtocolAuthorization {
|
|
|
74
82
|
? initialWrite.descriptor.messageTimestamp
|
|
75
83
|
: newestRecordsWrite.message.descriptor.messageTimestamp;
|
|
76
84
|
// fetch the protocol definition that was active when the record was created
|
|
77
|
-
const protocolDefinition = await ProtocolAuthorization.fetchProtocolDefinition(tenant, newestRecordsWrite.message.descriptor.protocol, messageStore, governingTimestamp);
|
|
85
|
+
const protocolDefinition = await ProtocolAuthorization.fetchProtocolDefinition(tenant, newestRecordsWrite.message.descriptor.protocol, messageStore, governingTimestamp, coreProtocols);
|
|
78
86
|
// get the rule set for the inbound message
|
|
79
87
|
const ruleSet = ProtocolAuthorization.getRuleSet(newestRecordsWrite.message.descriptor.protocolPath, protocolDefinition);
|
|
88
|
+
const boundFetchDefinition = ProtocolAuthorization.createBoundFetchDefinition(coreProtocols);
|
|
80
89
|
// If the incoming message has `protocolRole` in the descriptor, validate the invoked role
|
|
81
|
-
await verifyInvokedRole(tenant, incomingMessage, newestRecordsWrite.message.descriptor.protocol, newestRecordsWrite.message.contextId, protocolDefinition, messageStore,
|
|
90
|
+
await verifyInvokedRole(tenant, incomingMessage, newestRecordsWrite.message.descriptor.protocol, newestRecordsWrite.message.contextId, protocolDefinition, messageStore, boundFetchDefinition, governingTimestamp);
|
|
82
91
|
// verify method invoked against the allowed actions in the rule set
|
|
83
92
|
await authorizeAgainstAllowedActions(tenant, incomingMessage, ruleSet, recordChain, messageStore, protocolDefinition);
|
|
84
93
|
}
|
|
85
|
-
static async authorizeQueryOrSubscribe(tenant, incomingMessage, messageStore) {
|
|
94
|
+
static async authorizeQueryOrSubscribe(tenant, incomingMessage, messageStore, coreProtocols) {
|
|
86
95
|
const { protocol, protocolPath, contextId } = incomingMessage.message.descriptor.filter;
|
|
87
96
|
// fetch the protocol definition
|
|
88
97
|
const protocolDefinition = await ProtocolAuthorization.fetchProtocolDefinition(tenant, protocol, // `authorizeQueryOrSubscribe` is only called if `protocol` is present
|
|
89
|
-
messageStore);
|
|
98
|
+
messageStore, undefined, coreProtocols);
|
|
90
99
|
// get the rule set for the inbound message
|
|
91
100
|
const ruleSet = ProtocolAuthorization.getRuleSet(protocolPath, // presence of `protocolPath` is verified in `parse()`
|
|
92
101
|
protocolDefinition);
|
|
102
|
+
const boundFetchDefinition = ProtocolAuthorization.createBoundFetchDefinition(coreProtocols);
|
|
93
103
|
// If the incoming message has `protocolRole` in the descriptor, validate the invoked role
|
|
94
|
-
await verifyInvokedRole(tenant, incomingMessage, protocol, contextId, protocolDefinition, messageStore,
|
|
104
|
+
await verifyInvokedRole(tenant, incomingMessage, protocol, contextId, protocolDefinition, messageStore, boundFetchDefinition);
|
|
95
105
|
// verify method invoked against the allowed actions in the rule set
|
|
96
106
|
await authorizeAgainstAllowedActions(tenant, incomingMessage, ruleSet, [], // record chain is not relevant to queries or subscriptions
|
|
97
107
|
messageStore, protocolDefinition);
|
|
@@ -100,7 +110,7 @@ export class ProtocolAuthorization {
|
|
|
100
110
|
* Performs protocol-based authorization against the incoming `RecordsDelete` message.
|
|
101
111
|
* @param recordsWrite A `RecordsWrite` of the record being deleted.
|
|
102
112
|
*/
|
|
103
|
-
static async authorizeDelete(tenant, incomingMessage, recordsWrite, messageStore) {
|
|
113
|
+
static async authorizeDelete(tenant, incomingMessage, recordsWrite, messageStore, coreProtocols) {
|
|
104
114
|
// fetch record chain
|
|
105
115
|
const recordChain = await constructRecordChain(tenant, incomingMessage.message.descriptor.recordId, messageStore);
|
|
106
116
|
// Use the initial write's timestamp to determine the governing protocol definition.
|
|
@@ -109,11 +119,12 @@ export class ProtocolAuthorization {
|
|
|
109
119
|
? initialWrite.descriptor.messageTimestamp
|
|
110
120
|
: recordsWrite.message.descriptor.messageTimestamp;
|
|
111
121
|
// fetch the protocol definition that was active when the record was created
|
|
112
|
-
const protocolDefinition = await ProtocolAuthorization.fetchProtocolDefinition(tenant, recordsWrite.message.descriptor.protocol, messageStore, governingTimestamp);
|
|
122
|
+
const protocolDefinition = await ProtocolAuthorization.fetchProtocolDefinition(tenant, recordsWrite.message.descriptor.protocol, messageStore, governingTimestamp, coreProtocols);
|
|
113
123
|
// get the rule set for the inbound message
|
|
114
124
|
const ruleSet = ProtocolAuthorization.getRuleSet(recordsWrite.message.descriptor.protocolPath, protocolDefinition);
|
|
125
|
+
const boundFetchDefinition = ProtocolAuthorization.createBoundFetchDefinition(coreProtocols);
|
|
115
126
|
// If the incoming message has `protocolRole` in the descriptor, validate the invoked role
|
|
116
|
-
await verifyInvokedRole(tenant, incomingMessage, recordsWrite.message.descriptor.protocol, recordsWrite.message.contextId, protocolDefinition, messageStore,
|
|
127
|
+
await verifyInvokedRole(tenant, incomingMessage, recordsWrite.message.descriptor.protocol, recordsWrite.message.contextId, protocolDefinition, messageStore, boundFetchDefinition, governingTimestamp);
|
|
117
128
|
// verify method invoked against the allowed actions in the rule set
|
|
118
129
|
await authorizeAgainstAllowedActions(tenant, incomingMessage, ruleSet, recordChain, messageStore, protocolDefinition);
|
|
119
130
|
}
|
|
@@ -122,11 +133,19 @@ export class ProtocolAuthorization {
|
|
|
122
133
|
* When `messageTimestamp` is provided, returns the protocol definition that was active at that
|
|
123
134
|
* point in time — i.e. the ProtocolsConfigure with the greatest `messageTimestamp` that is <= the
|
|
124
135
|
* given timestamp. When not provided, returns the latest (current) protocol definition.
|
|
136
|
+
*
|
|
137
|
+
* When `coreProtocols` is provided, core protocol definitions are returned directly from the
|
|
138
|
+
* registry without a message store query. The extra parameter does not affect the
|
|
139
|
+
* `FetchProtocolDefinitionFn` callback type — callers that pass this function as a callback
|
|
140
|
+
* should bind the registry via a closure (see `createBoundFetchDefinition`).
|
|
125
141
|
*/
|
|
126
|
-
static async fetchProtocolDefinition(tenant, protocolUri, messageStore, messageTimestamp) {
|
|
127
|
-
// if
|
|
128
|
-
if (
|
|
129
|
-
|
|
142
|
+
static async fetchProtocolDefinition(tenant, protocolUri, messageStore, messageTimestamp, coreProtocols) {
|
|
143
|
+
// if the protocol is a registered core protocol, return the definition directly without a store query
|
|
144
|
+
if (coreProtocols !== undefined) {
|
|
145
|
+
const coreDefinition = coreProtocols.getDefinition(protocolUri);
|
|
146
|
+
if (coreDefinition !== undefined) {
|
|
147
|
+
return coreDefinition;
|
|
148
|
+
}
|
|
130
149
|
}
|
|
131
150
|
// fetch the corresponding protocol definition
|
|
132
151
|
const query = {
|
|
@@ -149,6 +168,17 @@ export class ProtocolAuthorization {
|
|
|
149
168
|
const protocolMessage = protocols[0];
|
|
150
169
|
return protocolMessage.descriptor.definition;
|
|
151
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Creates a `FetchProtocolDefinitionFn` closure that binds the given `CoreProtocolRegistry`.
|
|
173
|
+
* This allows core protocol definitions to be resolved from the registry without changing
|
|
174
|
+
* the `FetchProtocolDefinitionFn` type signature — zero ripple to downstream consumers
|
|
175
|
+
* like `protocol-authorization-action.ts` and `protocol-authorization-validation.ts`.
|
|
176
|
+
*/
|
|
177
|
+
static createBoundFetchDefinition(coreProtocols) {
|
|
178
|
+
return (tenant, protocolUri, messageStore, messageTimestamp) => {
|
|
179
|
+
return ProtocolAuthorization.fetchProtocolDefinition(tenant, protocolUri, messageStore, messageTimestamp, coreProtocols);
|
|
180
|
+
};
|
|
181
|
+
}
|
|
152
182
|
/**
|
|
153
183
|
* Gets the rule set corresponding to the given protocolPath.
|
|
154
184
|
*/
|
|
@@ -159,12 +189,5 @@ export class ProtocolAuthorization {
|
|
|
159
189
|
}
|
|
160
190
|
return ruleSet;
|
|
161
191
|
}
|
|
162
|
-
/**
|
|
163
|
-
* Returns all the ProtocolActions that would authorize the incoming message.
|
|
164
|
-
* Delegates to the standalone function in `protocol-authorization-action.ts`.
|
|
165
|
-
*/
|
|
166
|
-
static async getActionsSeekingARuleMatch(tenant, incomingMessage, messageStore) {
|
|
167
|
-
return getActionsSeekingARuleMatch(tenant, incomingMessage, messageStore);
|
|
168
|
-
}
|
|
169
192
|
}
|
|
170
193
|
//# sourceMappingURL=protocol-authorization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-authorization.js","sourceRoot":"","sources":["../../../../src/core/protocol-authorization.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"protocol-authorization.js","sourceRoot":"","sources":["../../../../src/core/protocol-authorization.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEnF,OAAO,EAAE,8BAA8B,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvG,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,8BAA8B,EAC9B,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,wCAAwC,CAAC;AAahD,MAAM,OAAO,qBAAqB;IAEhC;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAC9C,MAAc,EACd,eAA6B,EAC7B,YAA0B,EAC1B,aAAoC;QAEpC,oEAAoE;QACpE,6DAA6D;QAC7D,0GAA0G;QAC1G,MAAM,kBAAkB,GAAG,MAAM,qBAAqB,CACpD,MAAM,EAAE,eAAe,EAAE,YAAY,CACtC,CAAC;QAEF,2EAA2E;QAC3E,MAAM,kBAAkB,GAAG,MAAM,qBAAqB,CAAC,uBAAuB,CAC5E,MAAM,EACN,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,QAAS,EAC5C,YAAY,EACZ,kBAAkB,EAClB,aAAa,CACd,CAAC;QAEF,qFAAqF;QACrF,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,0BAA0B,CAAC,aAAa,CAAC,CAAC;QAE7F,+FAA+F;QAC/F,oFAAoF;QACpF,MAAM,yBAAyB,CAC7B,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EAAE,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CAEF"}
|
|
@@ -47,13 +47,12 @@ export class RecordsGrantAuthorization {
|
|
|
47
47
|
permissionGrant,
|
|
48
48
|
messageStore
|
|
49
49
|
});
|
|
50
|
-
//
|
|
50
|
+
// The grant's protocol must match the query/subscribe filter's protocol.
|
|
51
51
|
// NOTE: validated the invoked permission is for Records in GrantAuthorization.performBaseValidation()
|
|
52
52
|
const permissionScope = permissionGrant.scope;
|
|
53
|
-
const protocolInGrant = permissionScope.protocol;
|
|
54
53
|
const protocolInMessage = incomingMessage.descriptor.filter.protocol;
|
|
55
|
-
if (
|
|
56
|
-
throw new DwnError(DwnErrorCode.RecordsGrantAuthorizationQueryOrSubscribeProtocolScopeMismatch, `Grant protocol scope ${
|
|
54
|
+
if (protocolInMessage !== permissionScope.protocol) {
|
|
55
|
+
throw new DwnError(DwnErrorCode.RecordsGrantAuthorizationQueryOrSubscribeProtocolScopeMismatch, `Grant protocol scope ${permissionScope.protocol} does not match protocol in message ${protocolInMessage}`);
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
58
|
/**
|
|
@@ -69,13 +68,12 @@ export class RecordsGrantAuthorization {
|
|
|
69
68
|
permissionGrant,
|
|
70
69
|
messageStore
|
|
71
70
|
});
|
|
72
|
-
//
|
|
71
|
+
// The grant's protocol must match the protocol of the record being deleted.
|
|
73
72
|
// NOTE: validated the invoked permission is for Records in GrantAuthorization.performBaseValidation()
|
|
74
73
|
const permissionScope = permissionGrant.scope;
|
|
75
|
-
const protocolInGrant = permissionScope.protocol;
|
|
76
74
|
const protocolOfRecordToDelete = recordsWriteToDelete.descriptor.protocol;
|
|
77
|
-
if (
|
|
78
|
-
throw new DwnError(DwnErrorCode.RecordsGrantAuthorizationDeleteProtocolScopeMismatch, `Grant protocol scope ${
|
|
75
|
+
if (protocolOfRecordToDelete !== permissionScope.protocol) {
|
|
76
|
+
throw new DwnError(DwnErrorCode.RecordsGrantAuthorizationDeleteProtocolScopeMismatch, `Grant protocol scope ${permissionScope.protocol} does not match protocol in record to delete ${protocolOfRecordToDelete}`);
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records-grant-authorization.js","sourceRoot":"","sources":["../../../../src/core/records-grant-authorization.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,OAAO,yBAAyB;IACpC;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,KAMlC;QACC,MAAM,EACJ,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EACrF,GAAG,KAAK,CAAC;QAEV,MAAM,kBAAkB,CAAC,qBAAqB,CAAC;YAC7C,eAAe,EAAE,mBAAmB;YACpC,eAAe;YACf,eAAe;YACf,eAAe;YACf,YAAY;SACb,CAAC,CAAC;QAEH,sGAAsG;QACtG,yBAAyB,CAAC,WAAW,CAAC,mBAAmB,EAAE,eAAe,CAAC,KAA+B,CAAC,CAAC;QAE5G,yBAAyB,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;IAC9F,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAOjC;QACC,MAAM,EACJ,kBAAkB,EAAE,2BAA2B,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EACjH,GAAG,KAAK,CAAC;QAEV,MAAM,kBAAkB,CAAC,qBAAqB,CAAC;YAC7C,eAAe,EAAE,kBAAkB;YACnC,eAAe;YACf,eAAe;YACf,eAAe;YACf,YAAY;SACb,CAAC,CAAC;QAEH,sGAAsG;QACtG,yBAAyB,CAAC,WAAW,CAAC,2BAA2B,EAAE,eAAe,CAAC,KAA+B,CAAC,CAAC;IACtH,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,KAM7C;QACC,MAAM,EACJ,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EACjF,GAAG,KAAK,CAAC;QAEV,MAAM,kBAAkB,CAAC,qBAAqB,CAAC;YAC7C,eAAe;YACf,eAAe;YACf,eAAe;YACf,eAAe;YACf,YAAY;SACb,CAAC,CAAC;QAEH,
|
|
1
|
+
{"version":3,"file":"records-grant-authorization.js","sourceRoot":"","sources":["../../../../src/core/records-grant-authorization.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,OAAO,yBAAyB;IACpC;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,KAMlC;QACC,MAAM,EACJ,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EACrF,GAAG,KAAK,CAAC;QAEV,MAAM,kBAAkB,CAAC,qBAAqB,CAAC;YAC7C,eAAe,EAAE,mBAAmB;YACpC,eAAe;YACf,eAAe;YACf,eAAe;YACf,YAAY;SACb,CAAC,CAAC;QAEH,sGAAsG;QACtG,yBAAyB,CAAC,WAAW,CAAC,mBAAmB,EAAE,eAAe,CAAC,KAA+B,CAAC,CAAC;QAE5G,yBAAyB,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;IAC9F,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAOjC;QACC,MAAM,EACJ,kBAAkB,E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QAEpH,iFAAiF;QACjF,IAAI,UAAU,EAAE,WAAW,KAAK,8BAA8B,CAAC,QAAQ,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;YACrH,MAAM,IAAI,QAAQ,CAChB,YAAY,CAAC,qDAAqD,EAClE,mDAAmD,CACpD,CAAC;QACJ,CAAC;QAED,8FAA8F;QAC9F,IAAI,UAAU,EAAE,WAAW,KAAK,8BAA8B,CAAC,UAAU,IAAI,mBAAmB,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;YACtH,MAAM,IAAI,QAAQ,CAChB,YAAY,CAAC,uDAAuD,EACpE,yDAAyD,CAC1D,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export var ResumableTaskName;
|
|
2
2
|
(function (ResumableTaskName) {
|
|
3
3
|
ResumableTaskName["RecordsDelete"] = "RecordsDelete";
|
|
4
|
+
ResumableTaskName["RecordsSquash"] = "RecordsSquash";
|
|
4
5
|
})(ResumableTaskName || (ResumableTaskName = {}));
|
|
5
6
|
export class ResumableTaskManager {
|
|
6
7
|
resumableTaskStore;
|
|
@@ -17,6 +18,7 @@ export class ResumableTaskManager {
|
|
|
17
18
|
// NOTE: The arrow function is IMPORTANT here, else the `this` context will be lost within the invoked method.
|
|
18
19
|
// e.g. code within performRecordsDelete() won't know `this` refers to the `storageController` instance.
|
|
19
20
|
[ResumableTaskName.RecordsDelete]: async (task) => await storageController.performRecordsDelete(task),
|
|
21
|
+
[ResumableTaskName.RecordsSquash]: async (task) => await storageController.performRecordsSquash(task),
|
|
20
22
|
};
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resumable-task-manager.js","sourceRoot":"","sources":["../../../../src/core/resumable-task-manager.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"resumable-task-manager.js","sourceRoot":"","sources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YAAY,CAAC;YACtC,YAAY,GAAG,EAAE,CAAC;YAElB,KAAK,MAAM,WAAW,IAAI,gBAAgB,EAAE,CAAC;gBAC3C,IAAI,CAAC;oBACH,MAAM,IAAI,CAAC,gCAAgC,CAAC,WAAW,CAAC,CAAC;gBAC3D,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;oBAC5D,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;oBAC9C,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBACjC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC"}
|
package/dist/esm/src/dwn.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { AllowAllTenantGate } from './core/tenant-gate.js';
|
|
2
|
+
import { CoreProtocolRegistry } from './core/core-protocol.js';
|
|
2
3
|
import { Message } from './core/message.js';
|
|
3
4
|
import { messageReplyFromError } from './core/message-reply.js';
|
|
4
5
|
import { MessagesReadHandler } from './handlers/messages-read.js';
|
|
5
6
|
import { MessagesSubscribeHandler } from './handlers/messages-subscribe.js';
|
|
6
7
|
import { MessagesSyncHandler } from './handlers/messages-sync.js';
|
|
8
|
+
import { PermissionsProtocol } from './protocols/permissions.js';
|
|
7
9
|
import { ProtocolsConfigureHandler } from './handlers/protocols-configure.js';
|
|
8
10
|
import { ProtocolsQueryHandler } from './handlers/protocols-query.js';
|
|
9
11
|
import { RecordsCountHandler } from './handlers/records-count.js';
|
|
@@ -24,37 +26,51 @@ export class Dwn {
|
|
|
24
26
|
resumableTaskStore;
|
|
25
27
|
stateIndex;
|
|
26
28
|
tenantGate;
|
|
27
|
-
|
|
29
|
+
eventLog;
|
|
28
30
|
storageController;
|
|
29
31
|
resumableTaskManager;
|
|
32
|
+
_coreProtocols;
|
|
30
33
|
constructor(config) {
|
|
31
34
|
this.didResolver = config.didResolver;
|
|
32
35
|
this.tenantGate = config.tenantGate;
|
|
33
|
-
this.eventStream = config.eventStream;
|
|
34
36
|
this.messageStore = config.messageStore;
|
|
35
37
|
this.dataStore = config.dataStore;
|
|
36
38
|
this.resumableTaskStore = config.resumableTaskStore;
|
|
37
39
|
this.stateIndex = config.stateIndex;
|
|
38
|
-
this.
|
|
40
|
+
this.eventLog = config.eventLog;
|
|
39
41
|
this.storageController = new StorageController({
|
|
40
42
|
messageStore: this.messageStore,
|
|
41
43
|
dataStore: this.dataStore,
|
|
42
44
|
stateIndex: this.stateIndex,
|
|
43
|
-
|
|
45
|
+
eventLog: this.eventLog
|
|
44
46
|
});
|
|
45
47
|
this.resumableTaskManager = new ResumableTaskManager(config.resumableTaskStore, this.storageController);
|
|
48
|
+
// Initialize the core protocol registry with built-in system protocols.
|
|
49
|
+
this._coreProtocols = new CoreProtocolRegistry();
|
|
50
|
+
this._coreProtocols.register(new PermissionsProtocol());
|
|
51
|
+
// Build the shared dependency bag once; every handler receives the same object
|
|
52
|
+
// and accesses only the dependencies it needs.
|
|
53
|
+
const deps = {
|
|
54
|
+
didResolver: this.didResolver,
|
|
55
|
+
messageStore: this.messageStore,
|
|
56
|
+
dataStore: this.dataStore,
|
|
57
|
+
stateIndex: this.stateIndex,
|
|
58
|
+
resumableTaskManager: this.resumableTaskManager,
|
|
59
|
+
coreProtocols: this._coreProtocols,
|
|
60
|
+
eventLog: this.eventLog,
|
|
61
|
+
};
|
|
46
62
|
this.methodHandlers = {
|
|
47
|
-
[DwnInterfaceName.Messages + DwnMethodName.Read]: new MessagesReadHandler(
|
|
48
|
-
[DwnInterfaceName.Messages + DwnMethodName.Subscribe]: new MessagesSubscribeHandler(
|
|
49
|
-
[DwnInterfaceName.Messages + DwnMethodName.Sync]: new MessagesSyncHandler(
|
|
50
|
-
[DwnInterfaceName.Protocols + DwnMethodName.Configure]: new ProtocolsConfigureHandler(
|
|
51
|
-
[DwnInterfaceName.Protocols + DwnMethodName.Query]: new ProtocolsQueryHandler(
|
|
52
|
-
[DwnInterfaceName.Records + DwnMethodName.Count]: new RecordsCountHandler(
|
|
53
|
-
[DwnInterfaceName.Records + DwnMethodName.Delete]: new RecordsDeleteHandler(
|
|
54
|
-
[DwnInterfaceName.Records + DwnMethodName.Query]: new RecordsQueryHandler(
|
|
55
|
-
[DwnInterfaceName.Records + DwnMethodName.Read]: new RecordsReadHandler(
|
|
56
|
-
[DwnInterfaceName.Records + DwnMethodName.Subscribe]: new RecordsSubscribeHandler(
|
|
57
|
-
[DwnInterfaceName.Records + DwnMethodName.Write]: new RecordsWriteHandler(
|
|
63
|
+
[DwnInterfaceName.Messages + DwnMethodName.Read]: new MessagesReadHandler(deps),
|
|
64
|
+
[DwnInterfaceName.Messages + DwnMethodName.Subscribe]: new MessagesSubscribeHandler(deps),
|
|
65
|
+
[DwnInterfaceName.Messages + DwnMethodName.Sync]: new MessagesSyncHandler(deps),
|
|
66
|
+
[DwnInterfaceName.Protocols + DwnMethodName.Configure]: new ProtocolsConfigureHandler(deps),
|
|
67
|
+
[DwnInterfaceName.Protocols + DwnMethodName.Query]: new ProtocolsQueryHandler(deps),
|
|
68
|
+
[DwnInterfaceName.Records + DwnMethodName.Count]: new RecordsCountHandler(deps),
|
|
69
|
+
[DwnInterfaceName.Records + DwnMethodName.Delete]: new RecordsDeleteHandler(deps),
|
|
70
|
+
[DwnInterfaceName.Records + DwnMethodName.Query]: new RecordsQueryHandler(deps),
|
|
71
|
+
[DwnInterfaceName.Records + DwnMethodName.Read]: new RecordsReadHandler(deps),
|
|
72
|
+
[DwnInterfaceName.Records + DwnMethodName.Subscribe]: new RecordsSubscribeHandler(deps),
|
|
73
|
+
[DwnInterfaceName.Records + DwnMethodName.Write]: new RecordsWriteHandler(deps),
|
|
58
74
|
};
|
|
59
75
|
}
|
|
60
76
|
/**
|
|
@@ -78,16 +94,24 @@ export class Dwn {
|
|
|
78
94
|
await this.dataStore.open();
|
|
79
95
|
await this.resumableTaskStore.open();
|
|
80
96
|
await this.stateIndex.open();
|
|
81
|
-
await this.
|
|
97
|
+
await this.eventLog?.open();
|
|
82
98
|
await this.resumableTaskManager.resumeTasksAndWaitForCompletion();
|
|
83
99
|
}
|
|
84
100
|
async close() {
|
|
85
|
-
await this.
|
|
101
|
+
await this.eventLog?.close();
|
|
86
102
|
await this.messageStore.close();
|
|
87
103
|
await this.dataStore.close();
|
|
88
104
|
await this.resumableTaskStore.close();
|
|
89
105
|
await this.stateIndex.close();
|
|
90
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* The registry of core protocols (hardcoded, immutable, always-installed).
|
|
109
|
+
* Used by handlers and utilities that need to check whether a protocol URI
|
|
110
|
+
* belongs to a core protocol or to dispatch lifecycle hooks.
|
|
111
|
+
*/
|
|
112
|
+
get coreProtocols() {
|
|
113
|
+
return this._coreProtocols;
|
|
114
|
+
}
|
|
91
115
|
/**
|
|
92
116
|
* Returns the internal storage components for advanced operations that
|
|
93
117
|
* cannot be expressed through the standard `processMessage()` pipeline
|
|
@@ -99,7 +123,7 @@ export class Dwn {
|
|
|
99
123
|
return {
|
|
100
124
|
messageStore: this.messageStore,
|
|
101
125
|
stateIndex: this.stateIndex,
|
|
102
|
-
|
|
126
|
+
eventLog: this.eventLog,
|
|
103
127
|
};
|
|
104
128
|
}
|
|
105
129
|
async processMessage(tenant, rawMessage, options = {}) {
|
package/dist/esm/src/dwn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dwn.js","sourceRoot":"","sources":["../../../src/dwn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dwn.js","sourceRoot":"","sources":["../../../src/dwn.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAA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