@enbox/api 0.1.0 → 0.1.1
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 +12 -12
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/dwn-api.js +32 -26
- package/dist/esm/dwn-api.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/live-query.js +153 -0
- package/dist/esm/live-query.js.map +1 -0
- package/dist/esm/typed-dwn-api.js +7 -6
- package/dist/esm/typed-dwn-api.js.map +1 -1
- package/dist/types/dwn-api.d.ts +10 -17
- package/dist/types/dwn-api.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/live-query.d.ts +136 -0
- package/dist/types/live-query.d.ts.map +1 -0
- package/dist/types/typed-dwn-api.d.ts +10 -8
- package/dist/types/typed-dwn-api.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/dwn-api.ts +58 -49
- package/src/index.ts +1 -0
- package/src/live-query.ts +245 -0
- package/src/typed-dwn-api.ts +16 -16
- package/dist/esm/subscription-util.js +0 -35
- package/dist/esm/subscription-util.js.map +0 -1
- package/dist/types/subscription-util.d.ts +0 -19
- package/dist/types/subscription-util.d.ts.map +0 -1
- package/src/subscription-util.ts +0 -44
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
* Every method delegates to the corresponding `dwn.records.*` method,
|
|
8
8
|
* injecting the protocol URI, protocolPath, and schema automatically.
|
|
9
9
|
*/
|
|
10
|
+
import type { DwnApi } from './dwn-api.js';
|
|
11
|
+
import type { LiveQuery } from './live-query.js';
|
|
10
12
|
import type { Protocol } from './protocol.js';
|
|
11
13
|
import type { Record } from './record.js';
|
|
12
14
|
import type { DateSort, ProtocolDefinition, ProtocolType, RecordsFilter } from '@enbox/dwn-sdk-js';
|
|
13
|
-
import type {
|
|
14
|
-
import type { DwnMessageSubscription, DwnPaginationCursor, DwnResponseStatus } from '@enbox/agent';
|
|
15
|
+
import type { DwnPaginationCursor, DwnResponseStatus } from '@enbox/agent';
|
|
15
16
|
import type { ProtocolPaths, SchemaMap, TypedProtocol, TypeNameAtPath } from './protocol-types.js';
|
|
16
17
|
/**
|
|
17
18
|
* Resolves the TypeScript data type for a given protocol path.
|
|
@@ -104,13 +105,11 @@ export type TypedSubscribeRequest = {
|
|
|
104
105
|
/** Subscription filter (protocol, protocolPath, schema are injected). */
|
|
105
106
|
filter?: TypedQueryFilter;
|
|
106
107
|
protocolRole?: string;
|
|
107
|
-
subscriptionHandler: RecordsSubscriptionHandler;
|
|
108
|
-
/** When true, indicates encryption is active. */
|
|
109
|
-
encryption?: boolean;
|
|
110
108
|
};
|
|
111
109
|
/** Response from `TypedDwnApi.subscribe()`. */
|
|
112
110
|
export type TypedSubscribeResponse = DwnResponseStatus & {
|
|
113
|
-
|
|
111
|
+
/** The live query instance, or `undefined` if the request failed. */
|
|
112
|
+
liveQuery?: LiveQuery;
|
|
114
113
|
};
|
|
115
114
|
/**
|
|
116
115
|
* A protocol-scoped wrapper around `DwnApi` that automatically injects
|
|
@@ -182,10 +181,13 @@ export declare class TypedDwnApi<D extends ProtocolDefinition = ProtocolDefiniti
|
|
|
182
181
|
/**
|
|
183
182
|
* Subscribe to records at the given protocol path.
|
|
184
183
|
*
|
|
184
|
+
* Returns a {@link LiveQuery} that atomically provides an initial snapshot
|
|
185
|
+
* and a real-time stream of deduplicated change events.
|
|
186
|
+
*
|
|
185
187
|
* @param path - The protocol path to subscribe to.
|
|
186
|
-
* @param request - Subscribe options including
|
|
188
|
+
* @param request - Subscribe options including optional filter and role.
|
|
187
189
|
*/
|
|
188
|
-
subscribe<Path extends ProtocolPaths<D> & string>(path: Path, request
|
|
190
|
+
subscribe<Path extends ProtocolPaths<D> & string>(path: Path, request?: TypedSubscribeRequest): Promise<TypedSubscribeResponse>;
|
|
189
191
|
}
|
|
190
192
|
export {};
|
|
191
193
|
//# sourceMappingURL=typed-dwn-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed-dwn-api.d.ts","sourceRoot":"","sources":["../../src/typed-dwn-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"typed-dwn-api.d.ts","sourceRoot":"","sources":["../../src/typed-dwn-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAMnG;;;;;GAKG;AACH,KAAK,WAAW,CACd,EAAE,SAAS,kBAAkB,EAC7B,CAAC,SAAS,SAAS,EACnB,IAAI,SAAS,MAAM,IACjB,cAAc,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC;AAE7E;;GAEG;AACH,KAAK,mBAAmB,CACtB,CAAC,SAAS,kBAAkB,EAC5B,IAAI,SAAS,MAAM,IACjB,cAAc,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,CAAC,OAAO,CAAC,GAC7C,CAAC,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,SAAS,YAAY,GACnD,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;;;;OAKG;IACU,KAAK,CAAC,IAAI,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,EACvD,IAAI,EAAG,IAAI,EACX,OAAO,CAAC,EAAG,iBAAiB,GAC3B,OAAO,CAAC,kBAAkB,CAAC;IAsB9B;;;;;OAKG;IACU,IAAI,CAAC,IAAI,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,EACtD,IAAI,EAAG,IAAI,EACX,OAAO,EAAG,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC;IAmB7B;;;;;OAKG;IACU,MAAM,CAAC,IAAI,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,EACxD,KAAK,EAAG,IAAI,EACZ,OAAO,EAAG,kBAAkB,GAC3B,OAAO,CAAC,iBAAiB,CAAC;IAU7B;;;;;;;;OAQG;IACU,SAAS,CAAC,IAAI,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,EAC3D,IAAI,EAAG,IAAI,EACX,OAAO,CAAC,EAAG,qBAAqB,GAC/B,OAAO,CAAC,sBAAsB,CAAC;CAkBnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enbox/api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "SDK for accessing the features and capabilities of Web5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -77,14 +77,14 @@
|
|
|
77
77
|
"bun": ">=1.0.0"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@enbox/agent": "0.1.
|
|
80
|
+
"@enbox/agent": "0.1.5",
|
|
81
81
|
"@enbox/common": "0.0.3",
|
|
82
|
-
"@enbox/dwn-clients": "0.0.
|
|
82
|
+
"@enbox/dwn-clients": "0.0.3"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@enbox/crypto": "0.0.
|
|
86
|
-
"@enbox/dids": "0.0.
|
|
87
|
-
"@enbox/dwn-sdk-js": "0.0.
|
|
85
|
+
"@enbox/crypto": "0.0.4",
|
|
86
|
+
"@enbox/dids": "0.0.4",
|
|
87
|
+
"@enbox/dwn-sdk-js": "0.0.6",
|
|
88
88
|
"@types/node": "20.14.8",
|
|
89
89
|
"@types/sinon": "17.0.3",
|
|
90
90
|
"@typescript-eslint/eslint-plugin": "8.32.1",
|
package/src/dwn-api.ts
CHANGED
|
@@ -8,9 +8,7 @@ import type {
|
|
|
8
8
|
CreateGrantParams,
|
|
9
9
|
CreateRequestParams,
|
|
10
10
|
DwnMessage,
|
|
11
|
-
DwnMessageParams
|
|
12
|
-
,
|
|
13
|
-
DwnMessageSubscription,
|
|
11
|
+
DwnMessageParams,
|
|
14
12
|
DwnPaginationCursor,
|
|
15
13
|
DwnResponse,
|
|
16
14
|
DwnResponseStatus,
|
|
@@ -31,11 +29,11 @@ import type { ProtocolDefinition } from '@enbox/dwn-sdk-js';
|
|
|
31
29
|
import type { SchemaMap, TypedProtocol } from './protocol-types.js';
|
|
32
30
|
|
|
33
31
|
import { dataToBlob } from './utils.js';
|
|
32
|
+
import { LiveQuery } from './live-query.js';
|
|
34
33
|
import { PermissionGrant } from './permission-grant.js';
|
|
35
34
|
import { PermissionRequest } from './permission-request.js';
|
|
36
35
|
import { Protocol } from './protocol.js';
|
|
37
36
|
import { Record } from './record.js';
|
|
38
|
-
import { SubscriptionUtil } from './subscription-util.js';
|
|
39
37
|
import { TypedDwnApi } from './typed-dwn-api.js';
|
|
40
38
|
|
|
41
39
|
/**
|
|
@@ -226,39 +224,28 @@ export type RecordsReadResponse = DwnResponseStatus & {
|
|
|
226
224
|
record: Record;
|
|
227
225
|
};
|
|
228
226
|
|
|
229
|
-
/** Subscription handler for Records */
|
|
230
|
-
export type RecordsSubscriptionHandler = (record: Record) => void;
|
|
231
|
-
|
|
232
227
|
/**
|
|
233
228
|
* Represents a request to subscribe to records from a Decentralized Web Node (DWN).
|
|
234
229
|
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
230
|
+
* Returns a {@link LiveQuery} that atomically provides an initial snapshot of
|
|
231
|
+
* matching records alongside a real-time stream of deduplicated, semantically-
|
|
232
|
+
* typed change events (`create`, `update`, `delete`).
|
|
237
233
|
*/
|
|
238
234
|
export type RecordsSubscribeRequest = {
|
|
239
235
|
/** Optional DID specifying the remote target DWN tenant to subscribe from. */
|
|
240
236
|
from?: string;
|
|
241
237
|
|
|
242
|
-
/** Records must be scoped to a specific protocol */
|
|
238
|
+
/** Records must be scoped to a specific protocol. */
|
|
243
239
|
protocol?: string;
|
|
244
240
|
|
|
245
|
-
/** The parameters for the subscription operation, detailing the criteria for the subscription filter */
|
|
241
|
+
/** The parameters for the subscription operation, detailing the criteria for the subscription filter. */
|
|
246
242
|
message: Omit<DwnMessageParams[DwnInterface.RecordsSubscribe], 'signer'>;
|
|
247
|
-
|
|
248
|
-
/** The handler to process the subscription events */
|
|
249
|
-
subscriptionHandler: RecordsSubscriptionHandler;
|
|
250
|
-
|
|
251
|
-
/** When true, indicates encryption is active (decryption happens on subsequent reads). */
|
|
252
|
-
encryption?: boolean;
|
|
253
243
|
};
|
|
254
244
|
|
|
255
|
-
/** Encapsulates the response from a DWN
|
|
245
|
+
/** Encapsulates the response from a DWN RecordsSubscribeRequest. */
|
|
256
246
|
export type RecordsSubscribeResponse = DwnResponseStatus & {
|
|
257
|
-
/**
|
|
258
|
-
|
|
259
|
-
*
|
|
260
|
-
* */
|
|
261
|
-
subscription?: DwnMessageSubscription;
|
|
247
|
+
/** The live query instance, or `undefined` if the request failed. */
|
|
248
|
+
liveQuery?: LiveQuery;
|
|
262
249
|
};
|
|
263
250
|
|
|
264
251
|
/**
|
|
@@ -689,6 +676,7 @@ export class DwnApi {
|
|
|
689
676
|
|
|
690
677
|
return { status };
|
|
691
678
|
},
|
|
679
|
+
|
|
692
680
|
/**
|
|
693
681
|
* Query a single or multiple records based on the given filter
|
|
694
682
|
*/
|
|
@@ -875,38 +863,46 @@ export class DwnApi {
|
|
|
875
863
|
},
|
|
876
864
|
|
|
877
865
|
/**
|
|
878
|
-
*
|
|
866
|
+
* Subscribe to records matching the given filter.
|
|
879
867
|
*
|
|
880
|
-
*
|
|
881
|
-
*
|
|
868
|
+
* Returns a {@link LiveQuery} that atomically provides an initial snapshot
|
|
869
|
+
* of matching records and a real-time stream of deduplicated, semantically-
|
|
870
|
+
* typed change events (`create`, `update`, `delete`).
|
|
882
871
|
*/
|
|
883
872
|
subscribe: async (request: RecordsSubscribeRequest): Promise<RecordsSubscribeResponse> => {
|
|
873
|
+
// Build a DWN-level subscription handler that wraps raw RecordEvents
|
|
874
|
+
// into Record objects and feeds them into the LiveQuery.
|
|
875
|
+
let liveQuery: LiveQuery | undefined;
|
|
876
|
+
|
|
877
|
+
const remoteOrigin = request.from;
|
|
878
|
+
const protocolRole = request.message.protocolRole;
|
|
879
|
+
|
|
880
|
+
type RecordEvent = {
|
|
881
|
+
message: DwnMessage[DwnInterface.RecordsWrite];
|
|
882
|
+
initialWrite?: DwnMessage[DwnInterface.RecordsWrite];
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
const subscriptionHandler = async (event: RecordEvent): Promise<void> => {
|
|
886
|
+
const { message, initialWrite } = event;
|
|
887
|
+
const record = new Record(this.agent, {
|
|
888
|
+
...message,
|
|
889
|
+
author : getRecordAuthor(message),
|
|
890
|
+
connectedDid : this.connectedDid,
|
|
891
|
+
remoteOrigin,
|
|
892
|
+
initialWrite,
|
|
893
|
+
protocolRole,
|
|
894
|
+
delegateDid : this.delegateDid,
|
|
895
|
+
}, this.permissionsApi);
|
|
896
|
+
|
|
897
|
+
liveQuery?.handleEvent(record);
|
|
898
|
+
};
|
|
899
|
+
|
|
884
900
|
const agentRequest: ProcessDwnRequest<DwnInterface.RecordsSubscribe> = {
|
|
885
|
-
/**
|
|
886
|
-
* The `author` is the DID that will sign the message and must be the DID the Web5 app is
|
|
887
|
-
* connected with and is authorized to access the signing private key of.
|
|
888
|
-
*/
|
|
889
901
|
author : this.connectedDid,
|
|
890
902
|
messageParams : request.message,
|
|
891
903
|
messageType : DwnInterface.RecordsSubscribe,
|
|
892
|
-
/**
|
|
893
|
-
* The `target` is the DID of the DWN tenant under which the subscribe operation will be executed.
|
|
894
|
-
* If `from` is provided, the subscribe operation will be executed on a remote DWN.
|
|
895
|
-
* Otherwise, the local DWN will execute the subscribe operation.
|
|
896
|
-
*/
|
|
897
904
|
target : request.from || this.connectedDid,
|
|
898
|
-
|
|
899
|
-
/**
|
|
900
|
-
* The handler to process the subscription events.
|
|
901
|
-
*/
|
|
902
|
-
subscriptionHandler: SubscriptionUtil.recordSubscriptionHandler({
|
|
903
|
-
agent : this.agent,
|
|
904
|
-
connectedDid : this.connectedDid,
|
|
905
|
-
delegateDid : this.delegateDid,
|
|
906
|
-
permissionsApi : this.permissionsApi,
|
|
907
|
-
protocolRole : request.message.protocolRole,
|
|
908
|
-
request
|
|
909
|
-
})
|
|
905
|
+
subscriptionHandler,
|
|
910
906
|
};
|
|
911
907
|
|
|
912
908
|
if (this.delegateDid) {
|
|
@@ -946,9 +942,22 @@ export class DwnApi {
|
|
|
946
942
|
}
|
|
947
943
|
|
|
948
944
|
const reply = agentResponse.reply;
|
|
949
|
-
const { status, subscription } = reply;
|
|
945
|
+
const { status, subscription, entries = [] } = reply;
|
|
946
|
+
|
|
947
|
+
if (subscription) {
|
|
948
|
+
liveQuery = new LiveQuery({
|
|
949
|
+
agent : this.agent,
|
|
950
|
+
connectedDid : this.connectedDid,
|
|
951
|
+
delegateDid : this.delegateDid,
|
|
952
|
+
protocolRole,
|
|
953
|
+
remoteOrigin,
|
|
954
|
+
permissionsApi : this.permissionsApi,
|
|
955
|
+
initialEntries : entries,
|
|
956
|
+
subscription,
|
|
957
|
+
});
|
|
958
|
+
}
|
|
950
959
|
|
|
951
|
-
return { status,
|
|
960
|
+
return { status, liveQuery };
|
|
952
961
|
},
|
|
953
962
|
|
|
954
963
|
/**
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ export * from './define-protocol.js';
|
|
|
25
25
|
export * from './did-api.js';
|
|
26
26
|
export * from './dwn-api.js';
|
|
27
27
|
export * from './grant-revocation.js';
|
|
28
|
+
export * from './live-query.js';
|
|
28
29
|
export * from './permission-grant.js';
|
|
29
30
|
export * from './permission-request.js';
|
|
30
31
|
export * from './protocol.js';
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import type { RecordsQueryReplyEntry } from '@enbox/dwn-sdk-js';
|
|
2
|
+
import type { DwnMessageSubscription, PermissionsApi, Web5Agent } from '@enbox/agent';
|
|
3
|
+
|
|
4
|
+
import { getRecordAuthor } from '@enbox/agent';
|
|
5
|
+
|
|
6
|
+
import { Record } from './record.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The type of change that occurred to a record.
|
|
10
|
+
*/
|
|
11
|
+
export type RecordChangeType = 'create' | 'update' | 'delete';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Describes a change to a record in a {@link LiveQuery}.
|
|
15
|
+
*/
|
|
16
|
+
export type RecordChange = {
|
|
17
|
+
/** Whether the record was created, updated, or deleted. */
|
|
18
|
+
type: RecordChangeType;
|
|
19
|
+
|
|
20
|
+
/** The record affected by the change. */
|
|
21
|
+
record: Record;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A `CustomEvent` subclass carrying a {@link RecordChange} as its `detail`.
|
|
26
|
+
*
|
|
27
|
+
* Dispatched on the {@link LiveQuery} `EventTarget` for both the specific
|
|
28
|
+
* change-type event (`create`, `update`, `delete`) and the catch-all `change`
|
|
29
|
+
* event.
|
|
30
|
+
*/
|
|
31
|
+
export class RecordChangeEvent extends CustomEvent<RecordChange> {
|
|
32
|
+
constructor(change: RecordChange) {
|
|
33
|
+
super(change.type, { detail: change });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Options for creating a {@link LiveQuery}.
|
|
39
|
+
* @internal — Constructed by `DwnApi.records.subscribe()`, not by end users.
|
|
40
|
+
*/
|
|
41
|
+
export type LiveQueryOptions = {
|
|
42
|
+
/** The agent instance used to construct Record objects. */
|
|
43
|
+
agent: Web5Agent;
|
|
44
|
+
|
|
45
|
+
/** The DID of the connected user. */
|
|
46
|
+
connectedDid: string;
|
|
47
|
+
|
|
48
|
+
/** Optional delegate DID for permission-delegated access. */
|
|
49
|
+
delegateDid?: string;
|
|
50
|
+
|
|
51
|
+
/** Optional protocol role for role-authorized access. */
|
|
52
|
+
protocolRole?: string;
|
|
53
|
+
|
|
54
|
+
/** Optional remote DWN origin if subscribing to a remote DWN. */
|
|
55
|
+
remoteOrigin?: string;
|
|
56
|
+
|
|
57
|
+
/** The permissions API instance for constructing Record objects. */
|
|
58
|
+
permissionsApi?: PermissionsApi;
|
|
59
|
+
|
|
60
|
+
/** The initial snapshot entries from the subscribe reply. */
|
|
61
|
+
initialEntries: RecordsQueryReplyEntry[];
|
|
62
|
+
|
|
63
|
+
/** The underlying DWN subscription handle. */
|
|
64
|
+
subscription: DwnMessageSubscription;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A live query that combines an initial snapshot of matching records with a
|
|
69
|
+
* real-time stream of deduplicated, semantically-typed change events.
|
|
70
|
+
*
|
|
71
|
+
* `LiveQuery` extends `EventTarget` so that standard `addEventListener` /
|
|
72
|
+
* `removeEventListener` work out of the box. For convenience, the typed
|
|
73
|
+
* {@link LiveQuery.on | `.on()`} method provides a cleaner API that returns an
|
|
74
|
+
* unsubscribe function.
|
|
75
|
+
*
|
|
76
|
+
* ### Events
|
|
77
|
+
*
|
|
78
|
+
* | Event name | `detail` type | Description |
|
|
79
|
+
* |---|---|---|
|
|
80
|
+
* | `create` | {@link RecordChange} | A new record was written |
|
|
81
|
+
* | `update` | {@link RecordChange} | An existing record was updated |
|
|
82
|
+
* | `delete` | {@link RecordChange} | A record was deleted |
|
|
83
|
+
* | `change` | {@link RecordChange} | Catch-all for any of the above |
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const { liveQuery } = await dwn.records.subscribe({
|
|
88
|
+
* message: {
|
|
89
|
+
* filter: {
|
|
90
|
+
* protocol : chatProtocol.protocol,
|
|
91
|
+
* protocolPath : 'thread/message',
|
|
92
|
+
* }
|
|
93
|
+
* }
|
|
94
|
+
* });
|
|
95
|
+
*
|
|
96
|
+
* // Initial state
|
|
97
|
+
* for (const record of liveQuery.records) {
|
|
98
|
+
* renderMessage(record);
|
|
99
|
+
* }
|
|
100
|
+
*
|
|
101
|
+
* // Real-time changes
|
|
102
|
+
* liveQuery.on('create', (record) => appendMessage(record));
|
|
103
|
+
* liveQuery.on('update', (record) => refreshMessage(record));
|
|
104
|
+
* liveQuery.on('delete', (record) => removeMessage(record));
|
|
105
|
+
*
|
|
106
|
+
* // Or use the catch-all
|
|
107
|
+
* liveQuery.on('change', ({ type, record }) => {
|
|
108
|
+
* console.log(`${type}: ${record.id}`);
|
|
109
|
+
* });
|
|
110
|
+
*
|
|
111
|
+
* // Cleanup
|
|
112
|
+
* await liveQuery.close();
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export class LiveQuery extends EventTarget {
|
|
116
|
+
/** The initial snapshot of matching records. */
|
|
117
|
+
readonly records: Record[];
|
|
118
|
+
|
|
119
|
+
/** The underlying DWN subscription handle. */
|
|
120
|
+
private _subscription: DwnMessageSubscription;
|
|
121
|
+
|
|
122
|
+
/** Tracks known record states for dedup and change-type classification. */
|
|
123
|
+
private _knownRecords: Map<string, string>;
|
|
124
|
+
|
|
125
|
+
/** Whether the live query has been closed. */
|
|
126
|
+
private _closed = false;
|
|
127
|
+
|
|
128
|
+
constructor(options: LiveQueryOptions) {
|
|
129
|
+
super();
|
|
130
|
+
|
|
131
|
+
const {
|
|
132
|
+
agent,
|
|
133
|
+
connectedDid,
|
|
134
|
+
delegateDid,
|
|
135
|
+
protocolRole,
|
|
136
|
+
remoteOrigin,
|
|
137
|
+
permissionsApi,
|
|
138
|
+
initialEntries,
|
|
139
|
+
subscription,
|
|
140
|
+
} = options;
|
|
141
|
+
|
|
142
|
+
this._subscription = subscription;
|
|
143
|
+
|
|
144
|
+
// Build Record objects from the initial snapshot entries (same logic as records.query()).
|
|
145
|
+
this.records = initialEntries.map((entry) => new Record(agent, {
|
|
146
|
+
author: getRecordAuthor(entry),
|
|
147
|
+
connectedDid,
|
|
148
|
+
remoteOrigin,
|
|
149
|
+
delegateDid,
|
|
150
|
+
protocolRole,
|
|
151
|
+
...entry,
|
|
152
|
+
}, permissionsApi));
|
|
153
|
+
|
|
154
|
+
// Seed the known-records map with recordId -> messageTimestamp for dedup.
|
|
155
|
+
this._knownRecords = new Map();
|
|
156
|
+
for (const record of this.records) {
|
|
157
|
+
this._knownRecords.set(record.id, record.dateModified);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Process an incoming live event from the DWN subscription.
|
|
163
|
+
* Deduplicates against the initial snapshot and classifies the change type.
|
|
164
|
+
*
|
|
165
|
+
* @internal — Called by `DwnApi.records.subscribe()` when wiring up the subscription handler.
|
|
166
|
+
*/
|
|
167
|
+
public handleEvent(record: Record): void {
|
|
168
|
+
if (this._closed) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
let changeType: RecordChangeType;
|
|
173
|
+
|
|
174
|
+
if (record.deleted) {
|
|
175
|
+
changeType = 'delete';
|
|
176
|
+
this._knownRecords.delete(record.id);
|
|
177
|
+
} else {
|
|
178
|
+
const knownTimestamp = this._knownRecords.get(record.id);
|
|
179
|
+
|
|
180
|
+
if (knownTimestamp !== undefined) {
|
|
181
|
+
// We've seen this recordId before (either from snapshot or a prior event).
|
|
182
|
+
if (record.dateModified <= knownTimestamp) {
|
|
183
|
+
// Duplicate or stale event from the overlap window — skip.
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
changeType = 'update';
|
|
187
|
+
} else {
|
|
188
|
+
changeType = 'create';
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Update the known state.
|
|
192
|
+
this._knownRecords.set(record.id, record.dateModified);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const change: RecordChange = { type: changeType, record };
|
|
196
|
+
|
|
197
|
+
// Dispatch the specific event (create/update/delete).
|
|
198
|
+
this.dispatchEvent(new RecordChangeEvent(change));
|
|
199
|
+
|
|
200
|
+
// Dispatch the catch-all change event.
|
|
201
|
+
this.dispatchEvent(new CustomEvent('change', { detail: change }));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Register a typed event handler. Returns an unsubscribe function.
|
|
206
|
+
*
|
|
207
|
+
* @param event - The event type to listen for.
|
|
208
|
+
* @param handler - The handler function.
|
|
209
|
+
* @returns A function that removes the handler when called.
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```ts
|
|
213
|
+
* const off = live.on('create', (record) => console.log(record.id));
|
|
214
|
+
* off(); // stop listening
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
on(event: 'change', handler: (change: RecordChange) => void): () => void;
|
|
218
|
+
on(event: 'create', handler: (record: Record) => void): () => void;
|
|
219
|
+
on(event: 'update', handler: (record: Record) => void): () => void;
|
|
220
|
+
on(event: 'delete', handler: (record: Record) => void): () => void;
|
|
221
|
+
on(event: 'change' | 'create' | 'update' | 'delete', handler: ((change: RecordChange) => void) | ((record: Record) => void)): () => void {
|
|
222
|
+
const wrapper = (e: Event): void => {
|
|
223
|
+
const detail = (e as CustomEvent<RecordChange>).detail;
|
|
224
|
+
if (event === 'change') {
|
|
225
|
+
(handler as (change: RecordChange) => void)(detail);
|
|
226
|
+
} else {
|
|
227
|
+
(handler as (record: Record) => void)(detail.record);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
this.addEventListener(event, wrapper);
|
|
232
|
+
return (): void => { this.removeEventListener(event, wrapper); };
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Close the underlying subscription and stop dispatching events.
|
|
237
|
+
*/
|
|
238
|
+
async close(): Promise<void> {
|
|
239
|
+
if (this._closed) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
this._closed = true;
|
|
243
|
+
await this._subscription.close();
|
|
244
|
+
}
|
|
245
|
+
}
|
package/src/typed-dwn-api.ts
CHANGED
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
* injecting the protocol URI, protocolPath, and schema automatically.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import type { DwnApi } from './dwn-api.js';
|
|
12
|
+
import type { LiveQuery } from './live-query.js';
|
|
11
13
|
import type { Protocol } from './protocol.js';
|
|
12
14
|
import type { Record } from './record.js';
|
|
15
|
+
|
|
13
16
|
import type { DateSort, ProtocolDefinition, ProtocolType, RecordsFilter } from '@enbox/dwn-sdk-js';
|
|
14
|
-
import type {
|
|
15
|
-
import type { DwnMessageSubscription, DwnPaginationCursor, DwnResponseStatus } from '@enbox/agent';
|
|
17
|
+
import type { DwnPaginationCursor, DwnResponseStatus } from '@enbox/agent';
|
|
16
18
|
import type { ProtocolPaths, SchemaMap, TypedProtocol, TypeNameAtPath } from './protocol-types.js';
|
|
17
19
|
|
|
18
20
|
// ---------------------------------------------------------------------------
|
|
@@ -151,15 +153,12 @@ export type TypedSubscribeRequest = {
|
|
|
151
153
|
/** Subscription filter (protocol, protocolPath, schema are injected). */
|
|
152
154
|
filter? : TypedQueryFilter;
|
|
153
155
|
protocolRole? : string;
|
|
154
|
-
subscriptionHandler : RecordsSubscriptionHandler;
|
|
155
|
-
|
|
156
|
-
/** When true, indicates encryption is active. */
|
|
157
|
-
encryption?: boolean;
|
|
158
156
|
};
|
|
159
157
|
|
|
160
158
|
/** Response from `TypedDwnApi.subscribe()`. */
|
|
161
159
|
export type TypedSubscribeResponse = DwnResponseStatus & {
|
|
162
|
-
|
|
160
|
+
/** The live query instance, or `undefined` if the request failed. */
|
|
161
|
+
liveQuery?: LiveQuery;
|
|
163
162
|
};
|
|
164
163
|
|
|
165
164
|
// ---------------------------------------------------------------------------
|
|
@@ -329,29 +328,30 @@ export class TypedDwnApi<
|
|
|
329
328
|
/**
|
|
330
329
|
* Subscribe to records at the given protocol path.
|
|
331
330
|
*
|
|
331
|
+
* Returns a {@link LiveQuery} that atomically provides an initial snapshot
|
|
332
|
+
* and a real-time stream of deduplicated change events.
|
|
333
|
+
*
|
|
332
334
|
* @param path - The protocol path to subscribe to.
|
|
333
|
-
* @param request - Subscribe options including
|
|
335
|
+
* @param request - Subscribe options including optional filter and role.
|
|
334
336
|
*/
|
|
335
337
|
public async subscribe<Path extends ProtocolPaths<D> & string>(
|
|
336
338
|
path : Path,
|
|
337
|
-
request : TypedSubscribeRequest,
|
|
339
|
+
request? : TypedSubscribeRequest,
|
|
338
340
|
): Promise<TypedSubscribeResponse> {
|
|
339
341
|
const typeName = lastSegment(path);
|
|
340
342
|
const typeEntry = this._definition.types[typeName] as ProtocolType | undefined;
|
|
341
343
|
|
|
342
344
|
return this._dwn.records.subscribe({
|
|
343
|
-
from
|
|
344
|
-
protocol
|
|
345
|
-
|
|
346
|
-
subscriptionHandler : request.subscriptionHandler,
|
|
347
|
-
message : {
|
|
345
|
+
from : request?.from,
|
|
346
|
+
protocol : this._definition.protocol,
|
|
347
|
+
message : {
|
|
348
348
|
filter: {
|
|
349
|
-
...request
|
|
349
|
+
...request?.filter,
|
|
350
350
|
protocol : this._definition.protocol,
|
|
351
351
|
protocolPath : path,
|
|
352
352
|
schema : typeEntry?.schema,
|
|
353
353
|
},
|
|
354
|
-
protocolRole: request
|
|
354
|
+
protocolRole: request?.protocolRole,
|
|
355
355
|
},
|
|
356
356
|
});
|
|
357
357
|
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { getRecordAuthor } from '@enbox/agent';
|
|
11
|
-
import { Record } from './record.js';
|
|
12
|
-
/**
|
|
13
|
-
* Utility class for dealing with subscriptions.
|
|
14
|
-
*/
|
|
15
|
-
export class SubscriptionUtil {
|
|
16
|
-
/**
|
|
17
|
-
* Creates a record subscription handler that can be used to process incoming {Record} messages.
|
|
18
|
-
*/
|
|
19
|
-
static recordSubscriptionHandler({ agent, connectedDid, request, delegateDid, protocolRole, permissionsApi }) {
|
|
20
|
-
const { subscriptionHandler, from: remoteOrigin } = request;
|
|
21
|
-
return (event) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const { message, initialWrite } = event;
|
|
23
|
-
const author = getRecordAuthor(message);
|
|
24
|
-
const recordOptions = {
|
|
25
|
-
author,
|
|
26
|
-
connectedDid,
|
|
27
|
-
remoteOrigin,
|
|
28
|
-
initialWrite
|
|
29
|
-
};
|
|
30
|
-
const record = new Record(agent, Object.assign(Object.assign(Object.assign({}, message), recordOptions), { protocolRole, delegateDid: delegateDid }), permissionsApi);
|
|
31
|
-
subscriptionHandler(record);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=subscription-util.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-util.js","sourceRoot":"","sources":["../../src/subscription-util.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAC3B;;OAEG;IACH,MAAM,CAAC,yBAAyB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAOzG;QACC,MAAM,EAAE,mBAAmB,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;QAE5D,OAAO,CAAO,KAAK,EAAE,EAAE;YACrB,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;YACxC,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;YACxC,MAAM,aAAa,GAAG;gBACpB,MAAM;gBACN,YAAY;gBACZ,YAAY;gBACZ,YAAY;aACb,CAAC;YAEF,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,gDAC1B,OAAO,GACP,aAAa,KAChB,YAAY,EACZ,WAAW,EAAE,WAAW,KACvB,cAAc,CAAC,CAAC;YAEnB,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAA,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { DwnRecordSubscriptionHandler, PermissionsApi, Web5Agent } from '@enbox/agent';
|
|
2
|
-
import type { RecordsSubscribeRequest } from './dwn-api.js';
|
|
3
|
-
/**
|
|
4
|
-
* Utility class for dealing with subscriptions.
|
|
5
|
-
*/
|
|
6
|
-
export declare class SubscriptionUtil {
|
|
7
|
-
/**
|
|
8
|
-
* Creates a record subscription handler that can be used to process incoming {Record} messages.
|
|
9
|
-
*/
|
|
10
|
-
static recordSubscriptionHandler({ agent, connectedDid, request, delegateDid, protocolRole, permissionsApi }: {
|
|
11
|
-
agent: Web5Agent;
|
|
12
|
-
connectedDid: string;
|
|
13
|
-
delegateDid?: string;
|
|
14
|
-
protocolRole?: string;
|
|
15
|
-
permissionsApi?: PermissionsApi;
|
|
16
|
-
request: RecordsSubscribeRequest;
|
|
17
|
-
}): DwnRecordSubscriptionHandler;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=subscription-util.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-util.d.ts","sourceRoot":"","sources":["../../src/subscription-util.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG5F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE5D;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,MAAM,CAAC,yBAAyB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,EAAC;QAC3G,KAAK,EAAE,SAAS,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,cAAc,CAAC,EAAE,cAAc,CAAC;QAChC,OAAO,EAAE,uBAAuB,CAAC;KAClC,GAAG,4BAA4B;CAuBjC"}
|