@enbox/dwn-sdk-js 0.4.16 → 0.4.18

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.
Files changed (175) hide show
  1. package/dist/browser.mjs +1 -1
  2. package/dist/browser.mjs.map +4 -4
  3. package/dist/esm/generated/precompiled-validators.js +978 -840
  4. package/dist/esm/generated/precompiled-validators.js.map +1 -1
  5. package/dist/esm/json-schemas/definitions.json +5 -0
  6. package/dist/esm/src/core/dwn-constant.js +2 -2
  7. package/dist/esm/src/core/dwn-error.js +0 -1
  8. package/dist/esm/src/core/dwn-error.js.map +1 -1
  9. package/dist/esm/src/core/protocol-authorization-validation.js +1 -24
  10. package/dist/esm/src/core/protocol-authorization-validation.js.map +1 -1
  11. package/dist/esm/src/core/protocol-authorization.js +1 -5
  12. package/dist/esm/src/core/protocol-authorization.js.map +1 -1
  13. package/dist/esm/src/core/validation-state-reader.js +2 -3
  14. package/dist/esm/src/core/validation-state-reader.js.map +1 -1
  15. package/dist/esm/src/handlers/records-collection.js +200 -0
  16. package/dist/esm/src/handlers/records-collection.js.map +1 -0
  17. package/dist/esm/src/handlers/records-count.js +26 -195
  18. package/dist/esm/src/handlers/records-count.js.map +1 -1
  19. package/dist/esm/src/handlers/records-query.js +19 -373
  20. package/dist/esm/src/handlers/records-query.js.map +1 -1
  21. package/dist/esm/src/handlers/records-subscribe.js +21 -338
  22. package/dist/esm/src/handlers/records-subscribe.js.map +1 -1
  23. package/dist/esm/src/handlers/records-write.js +8 -26
  24. package/dist/esm/src/handlers/records-write.js.map +1 -1
  25. package/dist/esm/src/index.js +1 -1
  26. package/dist/esm/src/index.js.map +1 -1
  27. package/dist/esm/src/interfaces/protocols-configure.js +4 -9
  28. package/dist/esm/src/interfaces/protocols-configure.js.map +1 -1
  29. package/dist/esm/src/interfaces/records-count.js +1 -1
  30. package/dist/esm/src/interfaces/records-count.js.map +1 -1
  31. package/dist/esm/src/interfaces/records-query.js +1 -1
  32. package/dist/esm/src/interfaces/records-query.js.map +1 -1
  33. package/dist/esm/src/interfaces/records-subscribe.js +3 -1
  34. package/dist/esm/src/interfaces/records-subscribe.js.map +1 -1
  35. package/dist/esm/src/store/index-level.js +210 -21
  36. package/dist/esm/src/store/index-level.js.map +1 -1
  37. package/dist/esm/src/store/message-store-level.js +192 -21
  38. package/dist/esm/src/store/message-store-level.js.map +1 -1
  39. package/dist/esm/src/store/storage-controller.js +1 -3
  40. package/dist/esm/src/store/storage-controller.js.map +1 -1
  41. package/dist/esm/src/types/protocols-types.js +0 -10
  42. package/dist/esm/src/types/protocols-types.js.map +1 -1
  43. package/dist/esm/src/utils/filter.js +35 -1
  44. package/dist/esm/src/utils/filter.js.map +1 -1
  45. package/dist/esm/src/utils/grant-key-coverage.js +4 -6
  46. package/dist/esm/src/utils/grant-key-coverage.js.map +1 -1
  47. package/dist/esm/src/utils/messages.js +4 -14
  48. package/dist/esm/src/utils/messages.js.map +1 -1
  49. package/dist/esm/src/utils/permission-scope.js +3 -9
  50. package/dist/esm/src/utils/permission-scope.js.map +1 -1
  51. package/dist/esm/src/utils/record-limit-occupancy.js +73 -202
  52. package/dist/esm/src/utils/record-limit-occupancy.js.map +1 -1
  53. package/dist/esm/src/utils/records.js +19 -52
  54. package/dist/esm/src/utils/records.js.map +1 -1
  55. package/dist/esm/tests/core/records-grant-authorization.spec.js +13 -0
  56. package/dist/esm/tests/core/records-grant-authorization.spec.js.map +1 -1
  57. package/dist/esm/tests/core/replication-replay-property.spec.js +2 -2
  58. package/dist/esm/tests/core/replication-replay-property.spec.js.map +1 -1
  59. package/dist/esm/tests/core/validation-read-closure.spec.js +1 -1
  60. package/dist/esm/tests/core/validation-read-closure.spec.js.map +1 -1
  61. package/dist/esm/tests/dwn.spec.js +2 -2
  62. package/dist/esm/tests/dwn.spec.js.map +1 -1
  63. package/dist/esm/tests/features/records-delivery.spec.js +2 -5
  64. package/dist/esm/tests/features/records-delivery.spec.js.map +1 -1
  65. package/dist/esm/tests/features/records-nested-query-scope.spec.js +149 -70
  66. package/dist/esm/tests/features/records-nested-query-scope.spec.js.map +1 -1
  67. package/dist/esm/tests/features/records-record-limit.spec.js +380 -95
  68. package/dist/esm/tests/features/records-record-limit.spec.js.map +1 -1
  69. package/dist/esm/tests/fuzz/filter.fuzz.spec.js +19 -4
  70. package/dist/esm/tests/fuzz/filter.fuzz.spec.js.map +1 -1
  71. package/dist/esm/tests/handlers/records-count.spec.js +52 -1
  72. package/dist/esm/tests/handlers/records-count.spec.js.map +1 -1
  73. package/dist/esm/tests/handlers/records-subscribe.spec.js +76 -1
  74. package/dist/esm/tests/handlers/records-subscribe.spec.js.map +1 -1
  75. package/dist/esm/tests/handlers/records-write.spec.js +57 -3
  76. package/dist/esm/tests/handlers/records-write.spec.js.map +1 -1
  77. package/dist/esm/tests/store/index-level.spec.js +208 -1
  78. package/dist/esm/tests/store/index-level.spec.js.map +1 -1
  79. package/dist/esm/tests/store/message-store-cross-context.spec.js +46 -0
  80. package/dist/esm/tests/store/message-store-cross-context.spec.js.map +1 -0
  81. package/dist/esm/tests/store/message-store-level.spec.js +76 -1
  82. package/dist/esm/tests/store/message-store-level.spec.js.map +1 -1
  83. package/dist/esm/tests/store/message-store.spec.js +81 -0
  84. package/dist/esm/tests/store/message-store.spec.js.map +1 -1
  85. package/dist/esm/tests/utils/filters.spec.js +25 -4
  86. package/dist/esm/tests/utils/filters.spec.js.map +1 -1
  87. package/dist/esm/tests/utils/permission-scope.spec.js +4 -0
  88. package/dist/esm/tests/utils/permission-scope.spec.js.map +1 -1
  89. package/dist/esm/tests/utils/records.spec.js +12 -0
  90. package/dist/esm/tests/utils/records.spec.js.map +1 -1
  91. package/dist/esm/tests/validation/json-schemas/records/records-write.spec.js +3 -1
  92. package/dist/esm/tests/validation/json-schemas/records/records-write.spec.js.map +1 -1
  93. package/dist/types/generated/precompiled-validators.d.ts.map +1 -1
  94. package/dist/types/src/core/dwn-constant.d.ts +2 -2
  95. package/dist/types/src/core/dwn-error.d.ts +0 -1
  96. package/dist/types/src/core/dwn-error.d.ts.map +1 -1
  97. package/dist/types/src/core/protocol-authorization-validation.d.ts +0 -10
  98. package/dist/types/src/core/protocol-authorization-validation.d.ts.map +1 -1
  99. package/dist/types/src/core/protocol-authorization.d.ts.map +1 -1
  100. package/dist/types/src/core/validation-state-reader.d.ts.map +1 -1
  101. package/dist/types/src/handlers/records-collection.d.ts +32 -0
  102. package/dist/types/src/handlers/records-collection.d.ts.map +1 -0
  103. package/dist/types/src/handlers/records-count.d.ts +0 -34
  104. package/dist/types/src/handlers/records-count.d.ts.map +1 -1
  105. package/dist/types/src/handlers/records-query.d.ts +0 -61
  106. package/dist/types/src/handlers/records-query.d.ts.map +1 -1
  107. package/dist/types/src/handlers/records-subscribe.d.ts +1 -37
  108. package/dist/types/src/handlers/records-subscribe.d.ts.map +1 -1
  109. package/dist/types/src/handlers/records-write.d.ts +3 -0
  110. package/dist/types/src/handlers/records-write.d.ts.map +1 -1
  111. package/dist/types/src/index.d.ts +3 -3
  112. package/dist/types/src/index.d.ts.map +1 -1
  113. package/dist/types/src/interfaces/protocols-configure.d.ts.map +1 -1
  114. package/dist/types/src/interfaces/records-subscribe.d.ts.map +1 -1
  115. package/dist/types/src/store/index-level.d.ts +61 -0
  116. package/dist/types/src/store/index-level.d.ts.map +1 -1
  117. package/dist/types/src/store/message-store-level.d.ts +24 -6
  118. package/dist/types/src/store/message-store-level.d.ts.map +1 -1
  119. package/dist/types/src/store/storage-controller.d.ts.map +1 -1
  120. package/dist/types/src/types/message-store.d.ts +28 -2
  121. package/dist/types/src/types/message-store.d.ts.map +1 -1
  122. package/dist/types/src/types/protocols-types.d.ts +7 -24
  123. package/dist/types/src/types/protocols-types.d.ts.map +1 -1
  124. package/dist/types/src/types/query-types.d.ts +8 -1
  125. package/dist/types/src/types/query-types.d.ts.map +1 -1
  126. package/dist/types/src/types/records-types.d.ts +3 -2
  127. package/dist/types/src/types/records-types.d.ts.map +1 -1
  128. package/dist/types/src/utils/filter.d.ts +14 -1
  129. package/dist/types/src/utils/filter.d.ts.map +1 -1
  130. package/dist/types/src/utils/grant-key-coverage.d.ts.map +1 -1
  131. package/dist/types/src/utils/messages.d.ts.map +1 -1
  132. package/dist/types/src/utils/permission-scope.d.ts +0 -2
  133. package/dist/types/src/utils/permission-scope.d.ts.map +1 -1
  134. package/dist/types/src/utils/record-limit-occupancy.d.ts +25 -12
  135. package/dist/types/src/utils/record-limit-occupancy.d.ts.map +1 -1
  136. package/dist/types/src/utils/records.d.ts +6 -24
  137. package/dist/types/src/utils/records.d.ts.map +1 -1
  138. package/dist/types/tests/features/records-delivery.spec.d.ts.map +1 -1
  139. package/dist/types/tests/features/records-nested-query-scope.spec.d.ts.map +1 -1
  140. package/dist/types/tests/features/records-record-limit.spec.d.ts.map +1 -1
  141. package/dist/types/tests/handlers/records-count.spec.d.ts.map +1 -1
  142. package/dist/types/tests/handlers/records-subscribe.spec.d.ts.map +1 -1
  143. package/dist/types/tests/handlers/records-write.spec.d.ts.map +1 -1
  144. package/dist/types/tests/store/message-store-cross-context.spec.d.ts +2 -0
  145. package/dist/types/tests/store/message-store-cross-context.spec.d.ts.map +1 -0
  146. package/dist/types/tests/store/message-store.spec.d.ts.map +1 -1
  147. package/package.json +4 -4
  148. package/src/core/dwn-constant.ts +2 -2
  149. package/src/core/dwn-error.ts +0 -2
  150. package/src/core/protocol-authorization-validation.ts +1 -33
  151. package/src/core/protocol-authorization.ts +0 -7
  152. package/src/core/validation-state-reader.ts +2 -3
  153. package/src/handlers/records-collection.ts +269 -0
  154. package/src/handlers/records-count.ts +38 -232
  155. package/src/handlers/records-query.ts +22 -444
  156. package/src/handlers/records-subscribe.ts +26 -397
  157. package/src/handlers/records-write.ts +17 -32
  158. package/src/index.ts +3 -3
  159. package/src/interfaces/protocols-configure.ts +4 -13
  160. package/src/interfaces/records-count.ts +1 -1
  161. package/src/interfaces/records-query.ts +1 -1
  162. package/src/interfaces/records-subscribe.ts +5 -2
  163. package/src/store/index-level.ts +323 -28
  164. package/src/store/message-store-level.ts +251 -25
  165. package/src/store/storage-controller.ts +1 -3
  166. package/src/types/message-store.ts +30 -2
  167. package/src/types/protocols-types.ts +7 -26
  168. package/src/types/query-types.ts +10 -2
  169. package/src/types/records-types.ts +3 -2
  170. package/src/utils/filter.ts +40 -3
  171. package/src/utils/grant-key-coverage.ts +4 -7
  172. package/src/utils/messages.ts +4 -14
  173. package/src/utils/permission-scope.ts +4 -11
  174. package/src/utils/record-limit-occupancy.ts +108 -293
  175. package/src/utils/records.ts +22 -57
@@ -1,4 +1,12 @@
1
- import type { EqualFilter, Filter, FilterValue, KeyValues, OneOfFilter, RangeCriterion, RangeFilter } from '../types/query-types.js';
1
+ import type { EqualFilter, Filter, FilterValue, KeyValues, OneOfFilter, RangeCriterion, RangeFilter, SubtreeFilter } from '../types/query-types.js';
2
+ /** Returns whether the value is a well-formed hierarchical subtree filter. */
3
+ export declare function isSubtreeFilter(filter: FilterValue): filter is SubtreeFilter;
4
+ /**
5
+ * Rejects subtree filters for indexes without hierarchical path semantics.
6
+ *
7
+ * @throws {TypeError} If a subtree filter targets an index other than `contextId` or `protocolPath`.
8
+ */
9
+ export declare function assertValidSubtreeFilters(filters: Filter[]): void;
2
10
  /**
3
11
  * A Utility class to help match indexes against filters.
4
12
  */
@@ -50,6 +58,11 @@ export declare class FilterUtility {
50
58
  static isOneOfFilter(filter: FilterValue): filter is OneOfFilter;
51
59
  static convertRangeCriterion(inputFilter: RangeCriterion): RangeFilter | undefined;
52
60
  static constructPrefixFilterAsRangeFilter(prefix: string): RangeFilter;
61
+ /**
62
+ * Returns whether a candidate is the selected hierarchical path or one of
63
+ * its proper `/`-delimited descendants.
64
+ */
65
+ static matchesSubtree(subtree: string, candidate: unknown): candidate is string;
53
66
  }
54
67
  export declare class FilterSelector {
55
68
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../src/utils/filter.ts"],"names":[],"mappings":"AAAA,OAAO,KA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AM,EAAE;IAoBvG;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,4BAA4B;IAgB3C;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,sCAAsC;IAqBrD;;;;;;OAMG;WACW,wBAAwB,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS;IAqCvF;;;OAGG;WACW,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG;QAAE,OAAO,EAAE,cAAc,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE;IAY3G;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAyB5B,OAAO,CAAC,MAAM,CAAC,cAAc;CAG9B"}
@@ -24,7 +24,5 @@ export declare class PermissionScopeMatcher {
24
24
  * Determines whether a candidate target is within a grant scope.
25
25
  */
26
26
  static matches(scope: ProtocolScope, target: ProtocolScope): boolean;
27
- private static matchesContextId;
28
- private static matchesSubtree;
29
27
  }
30
28
  //# sourceMappingURL=permission-scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"permission-scope.d.ts","sourceRoot":"","sources":["../../../../src/utils/permission-scope.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;AACH,qBAAa,sBAAsB;IACjC;;OAEG;WACW,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO;IAwB3E,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAI/B,OAAO,CAAC,MAAM,CAAC,cAAc;CAI9B"}
1
+ {"version":3,"file":"permission-scope.d.ts","sourceRoot":"","sources":["../../../../src/utils/permission-scope.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;AACH,qBAAa,sBAAsB;IACjC;;OAEG;WACW,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO;CAuB5E"}
@@ -1,16 +1,19 @@
1
- import type { MessageStore } from '../types/message-store.js';
2
- import type { RecordsWriteMessage } from '../types/records-types.js';
3
1
  import type { ValidationStateReader } from '../types/validation-state-reader.js';
4
2
  import type { Filter, PaginationCursor } from '../types/query-types.js';
5
3
  import type { MessageSort, Pagination } from '../types/message-types.js';
6
- type RecordLimitOccupancyDependencies = {
7
- messageStore: MessageStore;
4
+ import type { MessageStore, RecordLimitOccupancy } from '../types/message-store.js';
5
+ import type { RecordsFilter, RecordsWriteMessage } from '../types/records-types.js';
6
+ type RecordLimitPolicyDependencies = {
8
7
  validationStateReader: ValidationStateReader;
9
8
  };
10
- type RecordLimitOccupancyQueryInput = RecordLimitOccupancyDependencies & {
9
+ type RecordLimitOccupancyDependencies = RecordLimitPolicyDependencies & {
10
+ messageStore: MessageStore;
11
+ };
12
+ type RecordLimitOccupancyQueryInput = {
13
+ messageStore: MessageStore;
11
14
  tenant: string;
12
15
  filters: Filter[];
13
- messageTimestamp: string;
16
+ recordLimit?: RecordLimitOccupancy;
14
17
  messageSort?: MessageSort;
15
18
  pagination?: Pagination;
16
19
  };
@@ -21,27 +24,37 @@ type OccupancyProjectionInput<T extends RecordsWriteMessage> = {
21
24
  compareRecords(left: T, right: T): number;
22
25
  };
23
26
  /**
24
- * Queries records with bounded `$recordLimit` occupancy projection when every limited filter targets one concrete scope.
25
- *
26
- * Broad filters keep the store's native query path. Projecting those without a store-level grouping primitive would require
27
- * scanning the full matching set, which is worse than leaving them unprojected until a bounded broad-query strategy exists.
27
+ * Queries the caller-visible portion of the deterministic `$recordLimit`
28
+ * occupant population for one concrete protocol path.
28
29
  */
29
30
  export declare function queryRecordsWithRecordLimitOccupancy(input: RecordLimitOccupancyQueryInput): Promise<{
30
31
  messages: RecordsWriteMessage[];
31
32
  cursor?: PaginationCursor;
32
33
  }>;
33
34
  /**
34
- * Counts records with bounded `$recordLimit` occupancy projection when every limited filter targets one concrete scope.
35
+ * Counts the same deterministic `$recordLimit` occupant population returned
36
+ * by {@link queryRecordsWithRecordLimitOccupancy}.
35
37
  */
36
38
  export declare function countRecordsWithRecordLimitOccupancy(input: Omit<RecordLimitOccupancyQueryInput, 'pagination'>): Promise<number>;
37
39
  /**
38
- * Returns true when the latest RecordsWrite is visible under the `$recordLimit` projection.
40
+ * Returns true when the latest RecordsWrite is part of its path's current
41
+ * `$recordLimit` occupant population.
39
42
  */
40
43
  export declare function isRecordLimitOccupant(input: RecordLimitOccupancyDependencies & {
41
44
  tenant: string;
42
45
  message: RecordsWriteMessage;
43
46
  messageTimestamp: string;
44
47
  }): Promise<boolean>;
48
+ /** Resolves one incoming Records filter to its store-level occupancy policy. */
49
+ export declare function resolveRecordLimitOccupancy(input: RecordLimitPolicyDependencies & {
50
+ tenant: string;
51
+ recordsFilter: RecordsFilter;
52
+ messageTimestamp: string;
53
+ }): Promise<RecordLimitOccupancy | undefined>;
54
+ /**
55
+ * Selects a bounded occupant set for an in-memory projection whose grouping
56
+ * and ranking policy is supplied by the caller.
57
+ */
45
58
  export declare function selectOccupantRecordIds<T extends RecordsWriteMessage>(input: OccupancyProjectionInput<T>): Set<string>;
46
59
  export {};
47
60
  //# sourceMappingURL=record-limit-occupancy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"record-limit-occupancy.d.ts","sourceRoot":"","sources":["../../../../src/utils/record-limit-occupancy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA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AC;IAC/B,cAAc,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC;CAC3C,CAAC;AAEF;;;GAGG;AACH,wBAAsB,oCAAoC,CACxD,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC;IAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAC,CAUzE;AAED;;;GAGG;AACH,wBAAsB,oCAAoC,CACxD,KAAK,EAAE,IAAI,CAAC,8BAA8B,EAAE,YAAY,CAAC,GACxD,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,gCAAgC,GAAG;IACpF,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,mBAAmB,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,OAAO,CAAC,CA2BnB;AAED,gFAAgF;AAChF,wBAAsB,2BAA2B,CAAC,KAAK,EAAE,6BAA6B,GAAG;IACvF,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAuC5C;AA+CD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,mBAAmB,EAAE,KAAK,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAmBtH"}
@@ -65,10 +65,13 @@ export declare class Records {
65
65
  */
66
66
  static normalizeFilter(filter: RecordsFilter): RecordsFilter;
67
67
  /**
68
- * Nested protocol-path queries must pin one parent context. Otherwise the same
69
- * protocol type is read across every parent instance.
68
+ * Nested protocol-path collection requests must select one or more direct
69
+ * parents, the target path itself, or one of its ancestor contexts. A
70
+ * bounded path-wide subscription may omit that scope because its initial
71
+ * page is explicitly capped; record-limited results still project each
72
+ * direct-parent population independently.
70
73
  */
71
- static validateNestedProtocolPathQueryScope(filter: RecordsFilter, errorCode: DwnErrorCode, operationName: string): void;
74
+ static validateNestedProtocolPathScope(filter: RecordsFilter, errorCode: DwnErrorCode, operationName: string, allowBoundedPathWideSelection?: boolean): void;
72
75
  static isStartsWithFilter(filter: RecordsWriteTagsFilter): filter is StartsWithFilter;
73
76
  /**
74
77
  * This will create individual keys for each of the tags that look like `tag.tag_property`
@@ -87,7 +90,6 @@ export declare class Records {
87
90
  * @returns {Filter} a generic Filter able to be used with MessageStore.
88
91
  */
89
92
  static convertFilter(filter: RecordsFilter, dateSort?: DateSort): Filter;
90
- static buildUnpublishedControlRecordsFilter(filter: RecordsFilter, dateSort?: DateSort): Filter;
91
93
  static buildControlRecordsFilters(filters: Filter[]): Filter[];
92
94
  /**
93
95
  * Validates the referential integrity of both author-delegated grant and owner-delegated grant.
@@ -115,10 +117,6 @@ export declare class Records {
115
117
  * @returns a `MessageSort` for `MessageStore` sorting.
116
118
  */
117
119
  static convertDateSort(dateSort?: DateSort): MessageSort;
118
- /**
119
- * Determines if signature payload contains a protocolRole and should be authorized as such.
120
- */
121
- static shouldProtocolAuthorize(signaturePayload: GenericSignaturePayload): boolean;
122
120
  /**
123
121
  * Checks if the filter supports returning published records.
124
122
  */
@@ -139,21 +137,5 @@ export declare class Records {
139
137
  * replay, and replay must never admit a delete that admission would now reject.
140
138
  */
141
139
  static isDeleteBeatenByExistingTombstone(deleteToBePerformed: RecordsDeleteMessage, newestExistingMessage: GenericMessage): Promise<boolean>;
142
- /**
143
- * Checks whether or not the incoming records query filter should build an unpublished recipient MessageStore filter.
144
- *
145
- * @param filter The incoming RecordsFilter to evaluate against.
146
- * @param recipient The recipient to check against the filter, typically the query/subscribe message author.
147
- * @returns {boolean} True if the filter contains the recipient, or if the recipient filter is undefined/empty.
148
- */
149
- static shouldBuildUnpublishedRecipientFilter(filter: RecordsFilter, recipient: string): boolean;
150
- /**
151
- * Checks whether or not the incoming records query filter should build an unpublished author MessageStore filter.
152
- *
153
- * @param filter The incoming RecordsFilter to evaluate against.
154
- * @param author The author to check against the filter, typically the query/subscribe message author.
155
- * @returns {boolean} True if the filter contains the author, or if the author filter is undefined/empty.
156
- */
157
- static shouldBuildUnpublishedAuthorFilter(filter: RecordsFilter, author: string): boolean;
158
140
  }
159
141
  //# sourceMappingURL=records.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../../../src/utils/records.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACtG,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAInQ,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AASrD,OAAO,EAAY,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAc,+BAA+B,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EAAS,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGzD;;GAEG;AACH,qBAAa,OAAO;IAElB;;OAEG;WACW,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,IAAI,mBAAmB;IAQrF;;OAEG;WACiB,qBAAqB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;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C5D,OAAO,EAAE,mBAAmB,GAAG,kBAAkB,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,oBAAoB,GAAG,uBAAuB,EAC9I,sBAAsB,EAAE,uBAAuB,GAAG,SAAS,EAC3D,qBAAqB,CAAC,EAAE,uBAAuB,GAAG,SAAS,GAC1D,OAAO,CAAC,IAAI,CAAC;IAOhB;;;OAGG;mBACkB,gDAAgD;IAiDrE;;;OAGG;mBACkB,+CAA+C;IAiDpE;;;;;;OAMG;WACW,eAAe,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW;IAmB/D;;OAEG;WACW,8BAA8B,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAK5E;;OAEG;WACW,gCAAgC,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAQ9E;;;;;;;;;;OAUG;WACiB,iCAAiC,CACnD,mBAAmB,EAAE,oBAAoB,EACzC,qBAAqB,EAAE,cAAc,GACpC,OAAO,CAAC,OAAO,CAAC;CAepB"}
@@ -1 +1 @@
1
- {"version":3,"file":"records-delivery.spec.d.ts","sourceRoot":"","sources":["../../../../tests/features/records-delivery.spec.ts"],"names":[],"mappings":"AAiBA,wBAAgB,mBAAmB,IAAI,IAAI,CAgQ1C"}
1
+ {"version":3,"file":"records-delivery.spec.d.ts","sourceRoot":"","sources":["../../../../tests/features/records-delivery.spec.ts"],"names":[],"mappings":"AAiBA,wBAAgB,mBAAmB,IAAI,IAAI,CA6P1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"records-nested-query-scope.spec.d.ts","sourceRoot":"","sources":["../../../../tests/features/records-nested-query-scope.spec.ts"],"names":[],"mappings":"AAkBA,wBAAgB,2BAA2B,IAAI,IAAI,CA4TlD"}
1
+ {"version":3,"file":"records-nested-query-scope.spec.d.ts","sourceRoot":"","sources":["../../../../tests/features/records-nested-query-scope.spec.ts"],"names":[],"mappings":"AAmBA,wBAAgB,2BAA2B,IAAI,IAAI,CAwalD"}
@@ -1 +1 @@
1
- {"version":3,"file":"records-record-limit.spec.d.ts","sourceRoot":"","sources":["../../../../tests/features/records-record-limit.spec.ts"],"names":[],"mappings":"AA4BA,wBAAgB,sBAAsB,IAAI,IAAI,CAs3B7C"}
1
+ {"version":3,"file":"records-record-limit.spec.d.ts","sourceRoot":"","sources":["../../../../tests/features/records-record-limit.spec.ts"],"names":[],"mappings":"AA4BA,wBAAgB,sBAAsB,IAAI,IAAI,CAoqC7C"}
@@ -1 +1 @@
1
- {"version":3,"file":"records-count.spec.d.ts","sourceRoot":"","sources":["../../../../tests/handlers/records-count.spec.ts"],"names":[],"mappings":"AAyBA,wBAAgB,uBAAuB,IAAI,IAAI,CA2zB9C"}
1
+ {"version":3,"file":"records-count.spec.d.ts","sourceRoot":"","sources":["../../../../tests/handlers/records-count.spec.ts"],"names":[],"mappings":"AA0BA,wBAAgB,uBAAuB,IAAI,IAAI,CAy3B9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"records-subscribe.spec.d.ts","sourceRoot":"","sources":["../../../../tests/handlers/records-subscribe.spec.ts"],"names":[],"mappings":"AAkCA,wBAAgB,2BAA2B,IAAI,IAAI,CAupDlD"}
1
+ {"version":3,"file":"records-subscribe.spec.d.ts","sourceRoot":"","sources":["../../../../tests/handlers/records-subscribe.spec.ts"],"names":[],"mappings":"AAkCA,wBAAgB,2BAA2B,IAAI,IAAI,CAwvDlD"}
@@ -1 +1 @@
1
- {"version":3,"file":"records-write.spec.d.ts","sourceRoot":"","sources":["../../../../tests/handlers/records-write.spec.ts"],"names":[],"mappings":"AA+DA,wBAAgB,uBAAuB,IAAI,IAAI,CAg1M9C"}
1
+ {"version":3,"file":"records-write.spec.d.ts","sourceRoot":"","sources":["../../../../tests/handlers/records-write.spec.ts"],"names":[],"mappings":"AA+DA,wBAAgB,uBAAuB,IAAI,IAAI,CAi5M9C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=message-store-cross-context.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-store-cross-context.spec.d.ts","sourceRoot":"","sources":["../../../../tests/store/message-store-cross-context.spec.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"message-store.spec.d.ts","sourceRoot":"","sources":["../../../../tests/store/message-store.spec.ts"],"names":[],"mappings":"AAiBA,wBAAgB,gBAAgB,IAAI,IAAI,CAozBvC"}
1
+ {"version":3,"file":"message-store.spec.d.ts","sourceRoot":"","sources":["../../../../tests/store/message-store.spec.ts"],"names":[],"mappings":"AAiBA,wBAAgB,gBAAgB,IAAI,IAAI,CAs5BvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enbox/dwn-sdk-js",
3
- "version": "0.4.16",
3
+ "version": "0.4.18",
4
4
  "description": "A reference implementation of https://identity.foundation/decentralized-web-node/spec/",
5
5
  "repository": {
6
6
  "type": "git",
@@ -72,9 +72,9 @@
72
72
  },
73
73
  "react-native": "./dist/esm/src/index.js",
74
74
  "dependencies": {
75
- "@enbox/common": "0.1.4",
76
- "@enbox/crypto": "0.1.7",
77
- "@enbox/dids": "0.1.7",
75
+ "@enbox/common": "0.1.5",
76
+ "@enbox/crypto": "0.1.8",
77
+ "@enbox/dids": "0.1.8",
78
78
  "@ipld/dag-cbor": "10.0.1",
79
79
  "@noble/curves": "2.2.0",
80
80
  "ajv": "8.18.0",
@@ -8,8 +8,8 @@ export class DwnConstant {
8
8
  public static readonly maxDataSizeAllowedToBeEncoded = 30_000;
9
9
 
10
10
  /**
11
- * Maximum supported `$recordLimit.max`. Read-time occupancy projection may load
12
- * up to this many occupants per scope before applying the caller's filter/page.
11
+ * Maximum supported `$recordLimit.max`. Level-backed occupancy projection retains
12
+ * at most this many rank keys while finding a parent group's cutoff.
13
13
  */
14
14
  public static readonly maxRecordLimit = 1000;
15
15
  }
@@ -157,7 +157,6 @@ export enum DwnErrorCode {
157
157
  ProtocolAuthorizationMatchingRoleRecordNotFound = 'ProtocolAuthorizationMatchingRoleRecordNotFound',
158
158
  ProtocolAuthorizationMaxSizeInvalid = 'ProtocolAuthorizationMaxSizeInvalid',
159
159
  ProtocolAuthorizationMinSizeInvalid = 'ProtocolAuthorizationMinSizeInvalid',
160
- ProtocolAuthorizationRecordLimitStrategyNotImplemented = 'ProtocolAuthorizationRecordLimitStrategyNotImplemented',
161
160
  ProtocolAuthorizationSquashNotEnabled = 'ProtocolAuthorizationSquashNotEnabled',
162
161
  ProtocolAuthorizationSquashNotInitialWrite = 'ProtocolAuthorizationSquashNotInitialWrite',
163
162
  ProtocolAuthorizationSquashBackstop = 'ProtocolAuthorizationSquashBackstop',
@@ -236,7 +235,6 @@ export enum DwnErrorCode {
236
235
  RecordsOwnerDelegatedGrantCidMismatch = 'RecordsOwnerDelegatedGrantCidMismatch',
237
236
  RecordsOwnerDelegatedGrantGrantedToAndOwnerSignatureMismatch = 'RecordsOwnerDelegatedGrantGrantedToAndOwnerSignatureMismatch',
238
237
  RecordsOwnerDelegatedGrantNotADelegatedGrant = 'RecordsOwnerDelegatedGrantNotADelegatedGrant',
239
-
240
238
  RecordsQueryFilterMissingRequiredProperties = 'RecordsQueryFilterMissingRequiredProperties',
241
239
  RecordsQueryNestedProtocolPathContextIdInvalid = 'RecordsQueryNestedProtocolPathContextIdInvalid',
242
240
 
@@ -5,13 +5,13 @@ import type { ValidationStateReader } from '../types/validation-state-reader.js'
5
5
  import type { ProtocolActionRule, ProtocolDefinition, ProtocolRuleSet, ProtocolType, ProtocolTypes } from '../types/protocols-types.js';
6
6
 
7
7
  import { KeyDerivationScheme } from '../utils/hd-key.js';
8
+ import { ProtocolAction } from '../types/protocols-types.js';
8
9
  import { Records } from '../utils/records.js';
9
10
  import { validateProtocolTags } from '../utils/protocol-tags.js';
10
11
  import { DwnError, DwnErrorCode } from './dwn-error.js';
11
12
  import { Encryption, ROLE_AUDIENCE_DERIVATION_SCHEME } from '../utils/encryption.js';
12
13
  import { ENCRYPTION_PROTOCOL_GRANT_KEY_PATH, ENCRYPTION_PROTOCOL_URI } from './constants.js';
13
14
  import { getRoleAudienceContextId, getRuleSetAtPath, getTypeName, parseCrossProtocolRef } from '../utils/protocols.js';
14
- import { ProtocolAction, ProtocolRecordLimitStrategy } from '../types/protocols-types.js';
15
15
 
16
16
  type ResolvedRoleAudience = {
17
17
  contextId: string;
@@ -526,38 +526,6 @@ export async function verifyAsRoleRecordIfNeeded(
526
526
  }
527
527
  }
528
528
 
529
- /**
530
- * Verifies that the `$recordLimit` strategy is supported for a new record creation.
531
- *
532
- * This check only applies to initial writes (new records). Updates to existing records do not
533
- * affect record-limit occupancy. The supported `reject` strategy admits every candidate and
534
- * projects the visible occupant set at read time, so validation stays independent of arrival order.
535
- *
536
- * @throws {DwnError} with `ProtocolAuthorizationRecordLimitStrategyNotImplemented` if strategy is not implemented.
537
- */
538
- export async function verifyRecordLimit(
539
- incomingMessage: RecordsWrite,
540
- ruleSet: ProtocolRuleSet,
541
- ): Promise<void> {
542
- if (ruleSet.$recordLimit === undefined) {
543
- return;
544
- }
545
-
546
- // Only initial writes can introduce a new record-limit candidate.
547
- const isInitialWrite = await incomingMessage.isInitialWrite();
548
- if (!isInitialWrite) {
549
- return;
550
- }
551
-
552
- const { strategy } = ruleSet.$recordLimit;
553
- if (strategy !== ProtocolRecordLimitStrategy.Reject) {
554
- throw new DwnError(
555
- DwnErrorCode.ProtocolAuthorizationRecordLimitStrategyNotImplemented,
556
- `record limit strategy '${strategy}' is not yet implemented.`
557
- );
558
- }
559
- }
560
-
561
529
  /**
562
530
  * Verifies that a `RecordsWrite` with `squash: true` is eligible:
563
531
  * 1. The protocol rule set at the record's `protocolPath` must have `$squash: true`.
@@ -19,7 +19,6 @@ import {
19
19
  verifyAsRoleRecordIfNeeded,
20
20
  verifyImmutability,
21
21
  verifyProtocolPathAndContextId,
22
- verifyRecordLimit,
23
22
  verifySizeLimit,
24
23
  verifySquashEligibility,
25
24
  verifyTagsIfNeeded,
@@ -88,9 +87,6 @@ export class ProtocolAuthorization {
88
87
  // Verify squash eligibility — ensure squash writes are at $squash: true paths and are initial writes
89
88
  await verifySquashEligibility(incomingMessage, ruleSet);
90
89
 
91
- // Verify record count limit
92
- await verifyRecordLimit(incomingMessage, ruleSet);
93
-
94
90
  return ruleSet;
95
91
  }
96
92
 
@@ -142,9 +138,6 @@ export class ProtocolAuthorization {
142
138
  verifyTagsIfNeeded(incomingMessage, ruleSet);
143
139
  await verifySquashEligibility(incomingMessage, ruleSet);
144
140
  ProtocolAuthorization.verifyStoredInitialWriteCreateAction(tenant, incomingMessage, ruleSet);
145
-
146
- // `verifyRecordLimit()` is intentionally not replayed here. It only checks strategy
147
- // support for new record candidates; read-time occupancy projection decides visibility.
148
141
  }
149
142
 
150
143
  /**
@@ -8,7 +8,6 @@ import type { DataEncodedRecordsWriteMessage, RecordsWriteMessage } from '../typ
8
8
  import type { ProtocolDefinition, ProtocolsConfigureMessage } from '../types/protocols-types.js';
9
9
 
10
10
  import { ENCRYPTION_CONTROL_AUDIENCE_PATH } from './constants.js';
11
- import { FilterUtility } from '../utils/filter.js';
12
11
  import { PermissionGrant } from '../protocols/permission-grant.js';
13
12
  import { PermissionsProtocol } from '../protocols/permissions.js';
14
13
  import { RecordsWrite } from '../interfaces/records-write.js';
@@ -313,7 +312,7 @@ export class StoreValidationStateReader implements ValidationStateReader {
313
312
  };
314
313
 
315
314
  if (input.contextIdPrefix !== undefined) {
316
- filter.contextId = FilterUtility.constructPrefixFilterAsRangeFilter(input.contextIdPrefix);
315
+ filter.contextId = { subtree: input.contextIdPrefix };
317
316
  }
318
317
 
319
318
  const { messages } = await this.messageStore.query(
@@ -370,7 +369,7 @@ export class StoreValidationStateReader implements ValidationStateReader {
370
369
  }
371
370
 
372
371
  if (input.contextIdPrefix !== undefined) {
373
- filter.contextId = FilterUtility.constructPrefixFilterAsRangeFilter(input.contextIdPrefix);
372
+ filter.contextId = { subtree: input.contextIdPrefix };
374
373
  }
375
374
 
376
375
  return filter;