@enbox/dwn-sdk-js 0.4.10 → 0.4.11
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 +1 -1
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/src/handlers/records-query.js +9 -11
- package/dist/esm/src/handlers/records-query.js.map +1 -1
- package/dist/esm/src/handlers/records-read.js +15 -6
- package/dist/esm/src/handlers/records-read.js.map +1 -1
- package/dist/esm/src/handlers/records-subscribe.js +8 -11
- package/dist/esm/src/handlers/records-subscribe.js.map +1 -1
- package/dist/esm/src/handlers/records-write.js +6 -12
- package/dist/esm/src/handlers/records-write.js.map +1 -1
- package/dist/esm/src/interfaces/records-write-query.js +3 -0
- package/dist/esm/src/interfaces/records-write-query.js.map +1 -1
- package/dist/esm/src/store/message-store-level.js +104 -3
- package/dist/esm/src/store/message-store-level.js.map +1 -1
- package/dist/esm/src/store/storage-controller.js +44 -33
- package/dist/esm/src/store/storage-controller.js.map +1 -1
- package/dist/esm/src/utils/initial-write-attachment.js +48 -0
- package/dist/esm/src/utils/initial-write-attachment.js.map +1 -0
- package/dist/esm/tests/handlers/records-query.spec.js +82 -0
- package/dist/esm/tests/handlers/records-query.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-read.spec.js +25 -0
- package/dist/esm/tests/handlers/records-read.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-subscribe.spec.js +60 -1
- package/dist/esm/tests/handlers/records-subscribe.spec.js.map +1 -1
- package/dist/esm/tests/store/message-store.spec.js +105 -0
- package/dist/esm/tests/store/message-store.spec.js.map +1 -1
- package/dist/types/src/handlers/records-query.d.ts.map +1 -1
- package/dist/types/src/handlers/records-read.d.ts.map +1 -1
- package/dist/types/src/handlers/records-subscribe.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/interfaces/records-write-query.d.ts.map +1 -1
- package/dist/types/src/store/message-store-level.d.ts +9 -1
- package/dist/types/src/store/message-store-level.d.ts.map +1 -1
- package/dist/types/src/store/storage-controller.d.ts +18 -8
- package/dist/types/src/store/storage-controller.d.ts.map +1 -1
- package/dist/types/src/types/message-store.d.ts +36 -0
- package/dist/types/src/types/message-store.d.ts.map +1 -1
- package/dist/types/src/utils/initial-write-attachment.d.ts +17 -0
- package/dist/types/src/utils/initial-write-attachment.d.ts.map +1 -0
- 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/store/message-store.spec.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/handlers/records-query.ts +21 -22
- package/src/handlers/records-read.ts +22 -9
- package/src/handlers/records-subscribe.ts +9 -15
- package/src/handlers/records-write.ts +15 -15
- package/src/index.ts +1 -1
- package/src/interfaces/records-write-query.ts +3 -0
- package/src/store/message-store-level.ts +160 -5
- package/src/store/storage-controller.ts +57 -43
- package/src/types/message-store.ts +37 -0
- package/src/utils/initial-write-attachment.ts +64 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records-query.d.ts","sourceRoot":"","sources":["../../../../src/handlers/records-query.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAA0B,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"records-query.d.ts","sourceRoot":"","sources":["../../../../src/handlers/records-query.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAA0B,MAAM,2BAA2B,CAAC;AAyBhH,qBAAa,mBAAoB,YAAW,aAAa;IAE3C,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,mBAAmB;IAEzC,MAAM,CAAC,EAClB,MAAM,EACN,OAAO,GACR,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,mBAAmB,CAAA;KAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAsD9E;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;IAmBvB;;OAEG;YACW,mBAAmB;YAwBnB,2BAA2B;IAwBzC;;;;;;;;;;;;;;;;;;OAkBG;YACW,sBAAsB;IA4CpC;;OAEG;YACW,qBAAqB;YAkBrB,uCAAuC;IA+FrD,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAY1C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,2CAA2C;IAa1D;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,+CAA+C;IAW9D;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,sDAAsD;IAWrE;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,0CAA0C;IAazD;;OAEG;mBACkB,qBAAqB;YAuC5B,gCAAgC;CAc/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records-read.d.ts","sourceRoot":"","sources":["../../../../src/handlers/records-read.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAgD,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"records-read.d.ts","sourceRoot":"","sources":["../../../../src/handlers/records-read.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAgD,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAkBpI,qBAAa,kBAAmB,YAAW,aAAa;IAE1C,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,mBAAmB;IAEzC,MAAM,CAAC,EAClB,MAAM,EACN,OAAO,GACR,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,kBAAkB,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;YAoHhE,qBAAqB;IA0CnC;;OAEG;mBACkB,oBAAoB;CAkD1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records-subscribe.d.ts","sourceRoot":"","sources":["../../../../src/handlers/records-subscribe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyD,oBAAoB,EAAuB,MAAM,2BAA2B,CAAC;AAElJ,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAA0B,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"records-subscribe.d.ts","sourceRoot":"","sources":["../../../../src/handlers/records-subscribe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyD,oBAAoB,EAAuB,MAAM,2BAA2B,CAAC;AAElJ,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAA0B,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAWxH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAWtE,qBAAa,uBAAwB,YAAW,aAAa;IAE/C,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,mBAAmB;IAEzC,MAAM,CAAC,EAClB,MAAM,EACN,OAAO,EACP,mBAAmB,GACpB,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,uBAAuB,CAAC;QACjC,mBAAmB,EAAE,oBAAoB,CAAC;KAC3C,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAiIlC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAmB9B,OAAO,CAAC,MAAM,CAAC,+BAA+B;IA2H9C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;IASrC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IA0DxC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAcxC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAUrC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAyDxC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAWxC;;OAEG;WACiB,yBAAyB,CAC3C,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,IAAI,CAAC;YAmCF,+BAA+B;YAe/B,uCAAuC;CAwFtD"}
|
|
@@ -54,7 +54,7 @@ export type { MessagesReadOptions } from './interfaces/messages-read.js';
|
|
|
54
54
|
export { MessagesQuery } from './interfaces/messages-query.js';
|
|
55
55
|
export type { MessagesQueryOptions } from './interfaces/messages-query.js';
|
|
56
56
|
export type { UnionMessageReply } from './core/message-reply.js';
|
|
57
|
-
export type { MessageStore, MessageStoreOptions, MessageStorePutResult } from './types/message-store.js';
|
|
57
|
+
export type { MessageStore, MessageStoreLatestStateTransition, MessageStoreOptions, MessageStorePutResult } from './types/message-store.js';
|
|
58
58
|
export { Replication } from './utils/replication.js';
|
|
59
59
|
export type { MessageInterface } from './types/message-interface.js';
|
|
60
60
|
export { PermissionGrant } from './protocols/permission-grant.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,mBA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Y,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CASnC;AAED;;;GAGG;AACH,wBAAsB,+BAA+B,CACnD,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"records-write-query.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/records-write-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAkBlG;;GAEG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAS9F;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CACjD,oBAAoB,EAAE,mBAAmB,EAAE,UAAU,EAAE,mBAAmB,GACzE,OAAO,CAyBT;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,EAAE,CAI3E;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC,CAe9B;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CASnC;AAED;;;GAGG;AACH,wBAAsB,+BAA+B,CACnD,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAY1C"}
|
|
@@ -2,7 +2,7 @@ import type { CompoundIndexDefinition } from './index-level.js';
|
|
|
2
2
|
import type { EventLogReadOptions, EventLogReadResult, ProgressToken, ReplicationFeedReader, WakePublisher } from '../types/subscriptions.js';
|
|
3
3
|
import type { Filter, KeyValues, PaginationCursor, QueryOptions } from '../types/query-types.js';
|
|
4
4
|
import type { GenericMessage, MessageSort, Pagination } from '../types/message-types.js';
|
|
5
|
-
import type { MessageStore, MessageStoreOptions, MessageStorePutResult } from '../types/message-store.js';
|
|
5
|
+
import type { MessageStore, MessageStoreLatestStateTransition, MessageStoreOptions, MessageStorePutResult } from '../types/message-store.js';
|
|
6
6
|
import { createLevelDatabase } from './level-wrapper.js';
|
|
7
7
|
/**
|
|
8
8
|
* A {@link MessageStore} and {@link ReplicationFeedReader} implementation that works in both the
|
|
@@ -62,6 +62,7 @@ export declare class MessageStoreLevel implements MessageStore, ReplicationFeedR
|
|
|
62
62
|
*/
|
|
63
63
|
static buildQueryOptions(messageSort?: MessageSort, pagination?: Pagination): QueryOptions;
|
|
64
64
|
put(tenant: string, message: GenericMessage, indexes: KeyValues, options?: MessageStoreOptions): Promise<MessageStorePutResult>;
|
|
65
|
+
commitLatestState(tenant: string, transition: MessageStoreLatestStateTransition, options?: MessageStoreOptions): Promise<MessageStorePutResult>;
|
|
65
66
|
updateIndexes(tenant: string, messageCid: string, indexes: KeyValues, options?: MessageStoreOptions): Promise<void>;
|
|
66
67
|
updateMessageAndIndexes(tenant: string, messageCid: string, message: GenericMessage, indexes: KeyValues, options?: MessageStoreOptions): Promise<void>;
|
|
67
68
|
delete(tenant: string, cidString: string, options?: MessageStoreOptions): Promise<void>;
|
|
@@ -106,6 +107,13 @@ export declare class MessageStoreLevel implements MessageStore, ReplicationFeedR
|
|
|
106
107
|
* fingerprint domains. XOR is self-inverse, so the same operations serve insert and delete.
|
|
107
108
|
*/
|
|
108
109
|
private createFingerprintFoldOperations;
|
|
110
|
+
/**
|
|
111
|
+
* Creates the batch operations that fold multiple messages' contributions into their fingerprint
|
|
112
|
+
* domains. Contributions targeting the same domain are XOR-combined before the single
|
|
113
|
+
* read-fold-write per domain — concatenating per-message fold operations into one batch would
|
|
114
|
+
* let the last write to a shared domain silently discard the earlier folds.
|
|
115
|
+
*/
|
|
116
|
+
private createFingerprintFoldOperationsForMessages;
|
|
109
117
|
/**
|
|
110
118
|
* Encodes a fingerprint domain name as a Level key. The uniform prefix keeps the global
|
|
111
119
|
* domain (the empty string) a valid key.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-store-level.d.ts","sourceRoot":"","sources":["../../../../src/store/message-store-level.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,EAEV,mBAAmB,EACnB,kBAAkB,EAGlB,aAAa,EACb,qBAAqB,EACrB,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEzF,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"message-store-level.d.ts","sourceRoot":"","sources":["../../../../src/store/message-store-level.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,EAEV,mBAAmB,EACnB,kBAAkB,EAGlB,aAAa,EACb,qBAAqB,EACrB,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OA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kBAAkB,CAAC;YAuE/E,qBAAqB;IA2B7B,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,aAAa,CAAC;QAAC,MAAM,EAAE,aAAa,CAAA;KAAE,GAAG,SAAS,CAAC;IAyBhG,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBpE;;;;OAIG;YACW,mBAAmB;IAiBjC;;OAEG;YACW,OAAO;YAKP,0BAA0B;IAkBxC,OAAO,CAAC,MAAM,CAAC,sBAAsB;YASvB,iBAAiB;IAiB/B;;;OAGG;YACW,cAAc;YAwBd,sBAAsB;YAgCtB,uBAAuB;IAerC;;OAEG;YACW,sBAAsB;IAsBpC;;;OAGG;YACW,+BAA+B;IAS7C;;;;;OAKG;YACW,0CAA0C;IA2BxD;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;YAIf,UAAU;IAYxB;;OAEG;IACH,OAAO,CAAC,WAAW;CAOpB;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,mBAAmB,CAAC;IACjD,eAAe,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAC5C,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { DataStore } from '../types/data-store.js';
|
|
2
2
|
import type { GenericMessage } from '../types/message-types.js';
|
|
3
|
-
import type { MessageStore } from '../types/message-store.js';
|
|
4
3
|
import type { ProgressToken } from '../types/subscriptions.js';
|
|
4
|
+
import type { KeyValues } from '../types/query-types.js';
|
|
5
|
+
import type { MessageStore, MessageStorePutResult } from '../types/message-store.js';
|
|
5
6
|
import type { RecordsDeleteMessage, RecordsWriteMessage } from '../types/records-types.js';
|
|
6
7
|
export type ResumableRecordsDeleteData = {
|
|
7
8
|
tenant: string;
|
|
@@ -64,14 +65,23 @@ export declare class StorageController {
|
|
|
64
65
|
*/
|
|
65
66
|
static purgeRecordMessages(tenant: string, recordMessages: GenericMessage[], messageStore: MessageStore, dataStore: DataStore): Promise<void>;
|
|
66
67
|
/**
|
|
67
|
-
*
|
|
68
|
-
* the initial write and the caller-supplied writes
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
68
|
+
* Stores the new latest message and displaces every other message in `existingMessages` as ONE
|
|
69
|
+
* atomic message-store commit: the initial write and the caller-supplied writes are retained as
|
|
70
|
+
* non-latest state for future replay and tombstone visibility reconstruction, and the remaining
|
|
71
|
+
* displaced messages are deleted. Readers can never observe an intermediate state where both the
|
|
72
|
+
* new message and a displaced message carry latest-state indexes.
|
|
73
|
+
*
|
|
74
|
+
* Displacement is deliberately NOT a timestamp comparison: a RecordsDelete displaces even a
|
|
75
|
+
* newer RecordsWrite (delete-wins convergence), and on resumable-task replay the new message
|
|
76
|
+
* itself is back in `existingMessages` and must survive — so membership is decided by CID.
|
|
77
|
+
*
|
|
78
|
+
* Displaced messages' unreferenced data is deleted from the data store only AFTER the commit:
|
|
79
|
+
* a crash in between leaves at most an orphaned data blob, never a live row whose data is gone.
|
|
73
80
|
*/
|
|
74
|
-
static
|
|
81
|
+
static commitLatestStateTransition(tenant: string, existingMessages: GenericMessage[], newMessage: {
|
|
82
|
+
message: GenericMessage;
|
|
83
|
+
indexes: KeyValues;
|
|
84
|
+
}, additionalRetainedRecordsWrites: RecordsWriteMessage[], messageStore: MessageStore, dataStore: DataStore): Promise<MessageStorePutResult>;
|
|
75
85
|
private static stripInlineData;
|
|
76
86
|
}
|
|
77
87
|
//# sourceMappingURL=storage-controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-controller.d.ts","sourceRoot":"","sources":["../../../../src/store/storage-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EA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,IAAI,CAAC;IA6DjG;;;OAGG;mBACkB,2BAA2B;IA2BhD;;;;;;;;;;;;;;;;OAgBG;WACiB,sBAAsB,CACxC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,IAAI,CAAC;IAkChB;;;OAGG;WACiB,mBAAmB,CACrC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,cAAc,EAAE,EAChC,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,IAAI,CAAC;IAkBhB;;;;;;;;;;;;;OAaG;WACiB,2BAA2B,CAC7C,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,cAAc,EAAE,EAClC,UAAU,EAAE;QAAE,OAAO,EAAE,cAAc,CAAC;QAAC,OAAO,EAAE,SAAS,CAAA;KAAE,EAC3D,+BAA+B,EAAE,mBAAmB,EAAE,EACtD,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,qBAAqB,CAAC;IA8CjC,OAAO,CAAC,MAAM,CAAC,eAAe;CAK/B"}
|
|
@@ -20,6 +20,32 @@ export type MessageStorePutResult = {
|
|
|
20
20
|
*/
|
|
21
21
|
position?: ProgressToken;
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* A latest-state transition applied by {@link MessageStore.commitLatestState}: the insert of a new
|
|
25
|
+
* message together with the displacement of the messages it supersedes.
|
|
26
|
+
*/
|
|
27
|
+
export type MessageStoreLatestStateTransition = {
|
|
28
|
+
/**
|
|
29
|
+
* The new message to insert, with its insert-time indexes.
|
|
30
|
+
*/
|
|
31
|
+
put: {
|
|
32
|
+
message: GenericMessage;
|
|
33
|
+
indexes: KeyValues;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Displaced writes retained as non-latest state: same-CID in-place replacements
|
|
37
|
+
* (same row, same log sequence) applied with the insert.
|
|
38
|
+
*/
|
|
39
|
+
retains?: {
|
|
40
|
+
messageCid: string;
|
|
41
|
+
message: GenericMessage;
|
|
42
|
+
indexes: KeyValues;
|
|
43
|
+
}[];
|
|
44
|
+
/**
|
|
45
|
+
* Message CIDs of displaced messages that are not retained, deleted with the insert.
|
|
46
|
+
*/
|
|
47
|
+
deletes?: string[];
|
|
48
|
+
};
|
|
23
49
|
export interface MessageStore {
|
|
24
50
|
/**
|
|
25
51
|
* opens a connection to the underlying store
|
|
@@ -34,6 +60,16 @@ export interface MessageStore {
|
|
|
34
60
|
* @param indexes indexes (key-value pairs) to be included as part of this put operation
|
|
35
61
|
*/
|
|
36
62
|
put(tenant: string, message: GenericMessage, indexes: KeyValues, options?: MessageStoreOptions): Promise<MessageStorePutResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Atomically inserts a new message and displaces the messages it supersedes: retained writes are
|
|
65
|
+
* replaced in place with their demoted state, and the remaining displaced rows are deleted, all
|
|
66
|
+
* in one commit. Readers can never observe an intermediate state where both the new message and
|
|
67
|
+
* a displaced message carry latest-state indexes.
|
|
68
|
+
*
|
|
69
|
+
* When the new message already exists, returns `duplicate` and still applies the retains and
|
|
70
|
+
* deletes, so replaying a transition heals one that was only partially planned before a crash.
|
|
71
|
+
*/
|
|
72
|
+
commitLatestState(tenant: string, transition: MessageStoreLatestStateTransition, options?: MessageStoreOptions): Promise<MessageStorePutResult>;
|
|
37
73
|
/**
|
|
38
74
|
* Fetches a single message by `cid` from the underlying store.
|
|
39
75
|
* Returns `undefined` no message was found.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-store.d.ts","sourceRoot":"","sources":["../../../../src/types/message-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,E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,EACzB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnB;;;OAGG;IACH,aAAa,CACX,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,SAAS,EAClB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;OAIG;IACH,uBAAuB,CACrB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,SAAS,EAClB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElF;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MessageStore } from '../types/message-store.js';
|
|
2
|
+
import type { RecordsQueryReplyEntry } from '../types/records-types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Attaches each returned update's retained initial write, resolved for the whole result page in
|
|
5
|
+
* one batched lookup by the stable identity `entryId === recordId` — unlike the mutable
|
|
6
|
+
* latest-state index, that identity holds at every point of the record's lifecycle.
|
|
7
|
+
*
|
|
8
|
+
* An update whose initial write is genuinely missing (store corruption) is omitted with a
|
|
9
|
+
* warning rather than failing the whole reply.
|
|
10
|
+
*/
|
|
11
|
+
export declare function attachInitialWrites(input: {
|
|
12
|
+
messageStore: MessageStore;
|
|
13
|
+
tenant: string;
|
|
14
|
+
recordsWrites: RecordsQueryReplyEntry[];
|
|
15
|
+
operationName: 'RecordsQuery' | 'RecordsSubscribe';
|
|
16
|
+
}): Promise<RecordsQueryReplyEntry[]>;
|
|
17
|
+
//# sourceMappingURL=initial-write-attachment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initial-write-attachment.d.ts","sourceRoot":"","sources":["../../../../src/utils/initial-write-attachment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAMxE;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE;IAC/C,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,sBAAsB,EAAE,CAAC;IACxC,aAAa,EAAE,cAAc,GAAG,kBAAkB,CAAC;CACpD,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC,CA2CpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records-query.spec.d.ts","sourceRoot":"","sources":["../../../../tests/handlers/records-query.spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"records-query.spec.d.ts","sourceRoot":"","sources":["../../../../tests/handlers/records-query.spec.ts"],"names":[],"mappings":"AA2CA,wBAAgB,uBAAuB,IAAI,IAAI,CAmvI9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records-read.spec.d.ts","sourceRoot":"","sources":["../../../../tests/handlers/records-read.spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"records-read.spec.d.ts","sourceRoot":"","sources":["../../../../tests/handlers/records-read.spec.ts"],"names":[],"mappings":"AAqCA,wBAAgB,sBAAsB,IAAI,IAAI,CAkpE7C"}
|
|
@@ -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,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-store.spec.d.ts","sourceRoot":"","sources":["../../../../tests/store/message-store.spec.ts"],"names":[],"mappings":"
|
|
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"}
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import type { GenericMessage, MessageSort } from '../types/message-types.js';
|
|
|
3
3
|
import type { HandlerDependencies, MethodHandler } from '../types/method-handler.js';
|
|
4
4
|
import type { RecordsQueryMessage, RecordsQueryReply, RecordsQueryReplyEntry } from '../types/records-types.js';
|
|
5
5
|
|
|
6
|
+
import { attachInitialWrites } from '../utils/initial-write-attachment.js';
|
|
6
7
|
import { authenticate } from '../core/auth.js';
|
|
7
8
|
import { DateSort } from '../types/records-types.js';
|
|
8
9
|
import { EncryptionControl } from '../core/encryption-control.js';
|
|
@@ -13,10 +14,18 @@ import { queryRecordsWithRecordLimitOccupancy } from '../utils/record-limit-occu
|
|
|
13
14
|
import { Records } from '../utils/records.js';
|
|
14
15
|
import { RecordsGrantAuthorization } from '../core/records-grant-authorization.js';
|
|
15
16
|
import { RecordsQuery } from '../interfaces/records-query.js';
|
|
16
|
-
import { RecordsWrite } from '../interfaces/records-write.js';
|
|
17
17
|
import { SortDirection } from '../types/query-types.js';
|
|
18
18
|
import { DwnInterfaceName, DwnMethodName } from '../enums/dwn-interface-method.js';
|
|
19
19
|
|
|
20
|
+
type RecordsQueryProjectionInput = {
|
|
21
|
+
tenant: string;
|
|
22
|
+
recordsQuery: RecordsQuery;
|
|
23
|
+
requester: string | undefined;
|
|
24
|
+
filters: Filter[];
|
|
25
|
+
messageSort: MessageSort;
|
|
26
|
+
pagination?: { cursor?: PaginationCursor; limit?: number };
|
|
27
|
+
};
|
|
28
|
+
|
|
20
29
|
export class RecordsQueryHandler implements MethodHandler {
|
|
21
30
|
|
|
22
31
|
constructor(private readonly deps: HandlerDependencies) { }
|
|
@@ -63,22 +72,17 @@ export class RecordsQueryHandler implements MethodHandler {
|
|
|
63
72
|
}
|
|
64
73
|
}
|
|
65
74
|
|
|
66
|
-
// attach initial write
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const initialWrite = initialWriteQueryResult.messages[0] as RecordsQueryReplyEntry;
|
|
74
|
-
delete initialWrite.encodedData; // defensive measure but technically optional because we do this when an update RecordsWrite takes place
|
|
75
|
-
recordsWrite.initialWrite = initialWrite;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
75
|
+
// attach the retained initial write to every entry that is not itself an initial write
|
|
76
|
+
const completeRecordsWrites = await attachInitialWrites({
|
|
77
|
+
messageStore : this.deps.messageStore,
|
|
78
|
+
tenant,
|
|
79
|
+
recordsWrites,
|
|
80
|
+
operationName : 'RecordsQuery',
|
|
81
|
+
});
|
|
78
82
|
|
|
79
83
|
return {
|
|
80
84
|
status : { code: 200, detail: 'OK' },
|
|
81
|
-
entries :
|
|
85
|
+
entries : completeRecordsWrites,
|
|
82
86
|
cursor
|
|
83
87
|
};
|
|
84
88
|
}
|
|
@@ -244,14 +248,9 @@ export class RecordsQueryHandler implements MethodHandler {
|
|
|
244
248
|
});
|
|
245
249
|
}
|
|
246
250
|
|
|
247
|
-
private async queryRecordsWithVisibleControlFiltering(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
requester: string | undefined;
|
|
251
|
-
filters: Filter[];
|
|
252
|
-
messageSort: MessageSort;
|
|
253
|
-
pagination?: { cursor?: PaginationCursor; limit?: number };
|
|
254
|
-
}): Promise<{ messages: RecordsQueryReplyEntry[], cursor?: PaginationCursor }> {
|
|
251
|
+
private async queryRecordsWithVisibleControlFiltering(
|
|
252
|
+
input: RecordsQueryProjectionInput
|
|
253
|
+
): Promise<{ messages: RecordsQueryReplyEntry[], cursor?: PaginationCursor }> {
|
|
255
254
|
const {
|
|
256
255
|
tenant, recordsQuery, requester, filters, messageSort, pagination
|
|
257
256
|
} = input;
|
|
@@ -9,6 +9,7 @@ import { EncryptionControl } from '../core/encryption-control.js';
|
|
|
9
9
|
import { isRecordLimitOccupant } from '../utils/record-limit-occupancy.js';
|
|
10
10
|
import { Message } from '../core/message.js';
|
|
11
11
|
import { messageReplyFromError } from '../core/message-reply.js';
|
|
12
|
+
import { Messages } from '../utils/messages.js';
|
|
12
13
|
import { ProtocolAuthorization } from '../core/protocol-authorization.js';
|
|
13
14
|
import { Records } from '../utils/records.js';
|
|
14
15
|
import { RecordsGrantAuthorization } from '../core/records-grant-authorization.js';
|
|
@@ -114,15 +115,27 @@ export class RecordsReadHandler implements MethodHandler {
|
|
|
114
115
|
}
|
|
115
116
|
};
|
|
116
117
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
try {
|
|
119
|
+
// Attach the initial write by its stable entry ID. Looking it up through
|
|
120
|
+
// `isLatestBaseState:false` races with the update that demotes it.
|
|
121
|
+
if (!await RecordsWrite.isInitialWrite(matchedRecordsWrite)) {
|
|
122
|
+
const storedInitialWrite = await RecordsWrite.fetchInitialRecordsWriteMessage(
|
|
123
|
+
this.deps.messageStore,
|
|
124
|
+
tenant,
|
|
125
|
+
matchedRecordsWrite.recordId,
|
|
126
|
+
);
|
|
127
|
+
if (storedInitialWrite === undefined) {
|
|
128
|
+
throw new DwnError(
|
|
129
|
+
DwnErrorCode.RecordsWriteGetInitialWriteNotFound,
|
|
130
|
+
`initial write not found for record ${matchedRecordsWrite.recordId}`,
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const { message: initialWrite } = Messages.detachEncodedData(storedInitialWrite);
|
|
135
|
+
recordsReadReply.entry!.initialWrite = initialWrite as RecordsQueryReplyEntry;
|
|
136
|
+
}
|
|
137
|
+
} catch (error) {
|
|
138
|
+
return messageReplyFromError(error, 500);
|
|
126
139
|
}
|
|
127
140
|
|
|
128
141
|
return recordsReadReply;
|
|
@@ -4,6 +4,7 @@ import type { Filter, PaginationCursor } from '../types/query-types.js';
|
|
|
4
4
|
import type { HandlerDependencies, MethodHandler } from '../types/method-handler.js';
|
|
5
5
|
import type { RecordsQueryReplyEntry, RecordsSubscribeMessage, RecordsSubscribeReply } from '../types/records-types.js';
|
|
6
6
|
|
|
7
|
+
import { attachInitialWrites } from '../utils/initial-write-attachment.js';
|
|
7
8
|
import { authenticate } from '../core/auth.js';
|
|
8
9
|
import { DateSort } from '../types/records-types.js';
|
|
9
10
|
import { EncryptionControl } from '../core/encryption-control.js';
|
|
@@ -13,7 +14,6 @@ import { ProtocolAuthorization } from '../core/protocol-authorization.js';
|
|
|
13
14
|
import { Records } from '../utils/records.js';
|
|
14
15
|
import { RecordsGrantAuthorization } from '../core/records-grant-authorization.js';
|
|
15
16
|
import { RecordsSubscribe } from '../interfaces/records-subscribe.js';
|
|
16
|
-
import { RecordsWrite } from '../interfaces/records-write.js';
|
|
17
17
|
import { SortDirection } from '../types/query-types.js';
|
|
18
18
|
import { DwnError, DwnErrorCode } from '../core/dwn-error.js';
|
|
19
19
|
import { DwnInterfaceName, DwnMethodName } from '../enums/dwn-interface-method.js';
|
|
@@ -141,21 +141,15 @@ export class RecordsSubscribeHandler implements MethodHandler {
|
|
|
141
141
|
messageSort,
|
|
142
142
|
pagination,
|
|
143
143
|
);
|
|
144
|
-
entries = queryResult.messages;
|
|
145
|
-
paginationCursor = queryResult.cursor;
|
|
146
144
|
|
|
147
|
-
// attach
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
delete initialWrite.encodedData;
|
|
156
|
-
entry.initialWrite = initialWrite;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
145
|
+
// attach the retained initial write to every entry that is not itself an initial write
|
|
146
|
+
entries = await attachInitialWrites({
|
|
147
|
+
messageStore : this.deps.messageStore,
|
|
148
|
+
tenant,
|
|
149
|
+
recordsWrites : queryResult.messages,
|
|
150
|
+
operationName : 'RecordsSubscribe',
|
|
151
|
+
});
|
|
152
|
+
paginationCursor = queryResult.cursor;
|
|
159
153
|
} catch (error) {
|
|
160
154
|
// if the query fails, close the subscription and return the error
|
|
161
155
|
await subscription.close();
|
|
@@ -100,16 +100,10 @@ export class RecordsWriteHandler implements MethodHandler {
|
|
|
100
100
|
|
|
101
101
|
const newestExistingMessage = await Message.getNewestMessage(existingMessages);
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (newestExistingMessage === undefined || await Message.isNewer(message, newestExistingMessage)) {
|
|
106
|
-
incomingMessageIsNewest = true;
|
|
107
|
-
newestMessage = message;
|
|
108
|
-
} else { // existing message is the same age or newer than the incoming message
|
|
109
|
-
newestMessage = newestExistingMessage;
|
|
110
|
-
}
|
|
111
|
-
|
|
103
|
+
const incomingMessageIsNewest =
|
|
104
|
+
newestExistingMessage === undefined || await Message.isNewer(message, newestExistingMessage);
|
|
112
105
|
if (!incomingMessageIsNewest) {
|
|
106
|
+
// existing message is the same age or newer than the incoming message
|
|
113
107
|
return {
|
|
114
108
|
status: { code: 409, detail: 'Conflict' }
|
|
115
109
|
};
|
|
@@ -170,7 +164,18 @@ export class RecordsWriteHandler implements MethodHandler {
|
|
|
170
164
|
}
|
|
171
165
|
|
|
172
166
|
const indexes = await recordsWrite.constructIndexes(isLatestBaseState);
|
|
173
|
-
|
|
167
|
+
|
|
168
|
+
// store the new message and displace every other message for this record in one atomic
|
|
169
|
+
// commit, retaining only the initial write as non-latest state — readers can never observe
|
|
170
|
+
// two latest-state rows for the record
|
|
171
|
+
const putResult = await StorageController.commitLatestStateTransition(
|
|
172
|
+
tenant,
|
|
173
|
+
existingMessages,
|
|
174
|
+
{ message: messageWithOptionalEncodedData, indexes },
|
|
175
|
+
[],
|
|
176
|
+
this.deps.messageStore,
|
|
177
|
+
this.deps.dataStore!,
|
|
178
|
+
);
|
|
174
179
|
position = putResult.position;
|
|
175
180
|
} catch (error) {
|
|
176
181
|
if (error instanceof DwnError) {
|
|
@@ -200,11 +205,6 @@ export class RecordsWriteHandler implements MethodHandler {
|
|
|
200
205
|
position,
|
|
201
206
|
};
|
|
202
207
|
|
|
203
|
-
// displace every other message for this record, retaining only the initial write as non-latest state
|
|
204
|
-
await StorageController.deleteDisplacedMessagesAndRetainWrites(
|
|
205
|
-
tenant, existingMessages, newestMessage, this.deps.messageStore, this.deps.dataStore!, []
|
|
206
|
-
);
|
|
207
|
-
|
|
208
208
|
// Squash processing: if the incoming write is a squash, delete all older sibling records
|
|
209
209
|
// at the same protocol path and parent context. Uses the resumable task system for crash safety.
|
|
210
210
|
if (message.descriptor.squash === true) {
|
package/src/index.ts
CHANGED
|
@@ -79,7 +79,7 @@ export type { MessagesReadOptions } from './interfaces/messages-read.js';
|
|
|
79
79
|
export { MessagesQuery } from './interfaces/messages-query.js';
|
|
80
80
|
export type { MessagesQueryOptions } from './interfaces/messages-query.js';
|
|
81
81
|
export type { UnionMessageReply } from './core/message-reply.js';
|
|
82
|
-
export type { MessageStore, MessageStoreOptions, MessageStorePutResult } from './types/message-store.js';
|
|
82
|
+
export type { MessageStore, MessageStoreLatestStateTransition, MessageStoreOptions, MessageStorePutResult } from './types/message-store.js';
|
|
83
83
|
export { Replication } from './utils/replication.js';
|
|
84
84
|
export type { MessageInterface } from './types/message-interface.js';
|
|
85
85
|
export { PermissionGrant } from './protocols/permission-grant.js';
|
|
@@ -128,6 +128,9 @@ export async function fetchInitialRecordsWriteMessage(
|
|
|
128
128
|
tenant: string,
|
|
129
129
|
recordId: string
|
|
130
130
|
): Promise<RecordsWriteMessage | undefined> {
|
|
131
|
+
// `entryId === recordId` identifies the initial write. Do not also filter on
|
|
132
|
+
// `isLatestBaseState:false`: that mutable index is updated after a newer
|
|
133
|
+
// write is inserted, so it can still be `true` during the update transition.
|
|
131
134
|
const query = { entryId: recordId };
|
|
132
135
|
const { messages } = await messageStore.query(tenant, [query]);
|
|
133
136
|
|