@enbox/api 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +140 -159
  2. package/dist/browser.mjs +23 -13
  3. package/dist/browser.mjs.map +4 -4
  4. package/dist/esm/advanced.js +11 -0
  5. package/dist/esm/advanced.js.map +1 -0
  6. package/dist/esm/define-protocol.js +3 -3
  7. package/dist/esm/dwn-api.js +55 -107
  8. package/dist/esm/dwn-api.js.map +1 -1
  9. package/dist/esm/dwn-reader-api.js +128 -0
  10. package/dist/esm/dwn-reader-api.js.map +1 -0
  11. package/dist/esm/index.js +3 -2
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/live-query.js +5 -4
  14. package/dist/esm/live-query.js.map +1 -1
  15. package/dist/esm/read-only-record.js +255 -0
  16. package/dist/esm/read-only-record.js.map +1 -0
  17. package/dist/esm/record.js +46 -57
  18. package/dist/esm/record.js.map +1 -1
  19. package/dist/esm/typed-web5.js +242 -0
  20. package/dist/esm/typed-web5.js.map +1 -0
  21. package/dist/esm/web5.js +71 -3
  22. package/dist/esm/web5.js.map +1 -1
  23. package/dist/types/advanced.d.ts +12 -0
  24. package/dist/types/advanced.d.ts.map +1 -0
  25. package/dist/types/define-protocol.d.ts +3 -3
  26. package/dist/types/dwn-api.d.ts +12 -89
  27. package/dist/types/dwn-api.d.ts.map +1 -1
  28. package/dist/types/dwn-reader-api.d.ts +138 -0
  29. package/dist/types/dwn-reader-api.d.ts.map +1 -0
  30. package/dist/types/index.d.ts +3 -2
  31. package/dist/types/index.d.ts.map +1 -1
  32. package/dist/types/live-query.d.ts +13 -1
  33. package/dist/types/live-query.d.ts.map +1 -1
  34. package/dist/types/protocol-types.d.ts +2 -2
  35. package/dist/types/read-only-record.d.ts +133 -0
  36. package/dist/types/read-only-record.d.ts.map +1 -0
  37. package/dist/types/record.d.ts +37 -17
  38. package/dist/types/record.d.ts.map +1 -1
  39. package/dist/types/{typed-dwn-api.d.ts → typed-web5.d.ts} +70 -73
  40. package/dist/types/typed-web5.d.ts.map +1 -0
  41. package/dist/types/web5.d.ts +79 -3
  42. package/dist/types/web5.d.ts.map +1 -1
  43. package/package.json +9 -5
  44. package/src/advanced.ts +29 -0
  45. package/src/define-protocol.ts +3 -3
  46. package/src/dwn-api.ts +88 -222
  47. package/src/dwn-reader-api.ts +255 -0
  48. package/src/index.ts +3 -2
  49. package/src/live-query.ts +20 -4
  50. package/src/protocol-types.ts +2 -2
  51. package/src/read-only-record.ts +328 -0
  52. package/src/record.ts +116 -86
  53. package/src/typed-web5.ts +445 -0
  54. package/src/web5.ts +104 -5
  55. package/dist/esm/typed-dwn-api.js +0 -182
  56. package/dist/esm/typed-dwn-api.js.map +0 -1
  57. package/dist/types/typed-dwn-api.d.ts.map +0 -1
  58. package/src/typed-dwn-api.ts +0 -370
@@ -0,0 +1,133 @@
1
+ /**
2
+ * NOTE: Added reference types here to avoid a `pnpm` bug during build.
3
+ * https://github.com/enboxorg/enbox/pull/507
4
+ */
5
+ import type { AnonymousDwnApi } from '@enbox/agent';
6
+ import type { RecordsWriteMessage, RecordsWriteTags } from '@enbox/dwn-sdk-js';
7
+ /**
8
+ * Construction options for a {@link ReadOnlyRecord}.
9
+ *
10
+ * @beta
11
+ */
12
+ export type ReadOnlyRecordOptions = {
13
+ /** The raw `RecordsWriteMessage` returned from a query or read reply. */
14
+ rawMessage: RecordsWriteMessage;
15
+ /** The initial write message, if the record has been updated. */
16
+ initialWrite?: RecordsWriteMessage;
17
+ /** Encoded data (Base64URL string) if the data was small enough to be inlined in the query reply. */
18
+ encodedData?: string;
19
+ /** A readable data stream, present when the record comes from a `RecordsRead` reply. */
20
+ data?: ReadableStream;
21
+ /** The DID of the remote DWN this record was fetched from. Used for data re-fetch. */
22
+ remoteOrigin: string;
23
+ /** The {@link AnonymousDwnApi} instance used to re-fetch data when needed. */
24
+ anonymousDwn: AnonymousDwnApi;
25
+ };
26
+ /**
27
+ * An immutable, read-only view of a DWN record.
28
+ *
29
+ * `ReadOnlyRecord` is returned by {@link DwnReaderApi} methods and provides
30
+ * access to the record's metadata and data without any mutation capabilities.
31
+ * There are no `update()`, `delete()`, `send()`, `store()`, or `import()`
32
+ * methods — the compiler prevents accidental writes.
33
+ *
34
+ * Data access works identically to the full {@link Record} class:
35
+ * - If the data was inlined (small payloads from query replies), it is
36
+ * available immediately.
37
+ * - If the data was not inlined, `data.stream()` / `data.text()` / etc.
38
+ * automatically perform an anonymous `RecordsRead` to fetch it.
39
+ *
40
+ * @beta
41
+ */
42
+ export declare class ReadOnlyRecord {
43
+ private _anonymousDwn;
44
+ private _remoteOrigin;
45
+ private _author;
46
+ private _creator;
47
+ private _descriptor;
48
+ private _recordId;
49
+ private _contextId?;
50
+ private _initialWrite?;
51
+ private _encodedData?;
52
+ private _readableStream?;
53
+ private _authorization;
54
+ private _attestation?;
55
+ private _encryption?;
56
+ constructor(options: ReadOnlyRecordOptions);
57
+ /** Record's unique identifier. */
58
+ get id(): string;
59
+ /** Record's context ID. */
60
+ get contextId(): string | undefined;
61
+ /** Record's creation date. */
62
+ get dateCreated(): string;
63
+ /** Record's parent ID. */
64
+ get parentId(): string | undefined;
65
+ /** Record's protocol URI. */
66
+ get protocol(): string | undefined;
67
+ /** Record's protocol path. */
68
+ get protocolPath(): string | undefined;
69
+ /** Record's recipient. */
70
+ get recipient(): string | undefined;
71
+ /** Record's schema. */
72
+ get schema(): string | undefined;
73
+ /** Record's data format / MIME type. */
74
+ get dataFormat(): string;
75
+ /** Record's data CID. */
76
+ get dataCid(): string;
77
+ /** Record's data size in bytes. */
78
+ get dataSize(): number;
79
+ /** Record's published date. */
80
+ get datePublished(): string | undefined;
81
+ /** Whether the record is published. */
82
+ get published(): boolean | undefined;
83
+ /** Tags associated with the record. */
84
+ get tags(): RecordsWriteTags | undefined;
85
+ /** DID that is the logical author of the record. */
86
+ get author(): string;
87
+ /** DID that originally created the record. */
88
+ get creator(): string;
89
+ /** Record's message timestamp (time of most recent create/update). */
90
+ get timestamp(): string;
91
+ /** Record's encryption metadata, if encrypted. */
92
+ get encryption(): RecordsWriteMessage['encryption'];
93
+ /** Record's authorization. */
94
+ get authorization(): RecordsWriteMessage['authorization'];
95
+ /** Record's attestation signatures. */
96
+ get attestation(): RecordsWriteMessage['attestation'];
97
+ /** The initial write message, if the record has been updated. */
98
+ get initialWrite(): RecordsWriteMessage | undefined;
99
+ /** The DID of the remote DWN this record was fetched from. */
100
+ get remoteOrigin(): string;
101
+ /**
102
+ * Returns the data of the current record.
103
+ * If the data is not available in-memory, it is fetched from the remote DWN
104
+ * using an anonymous `RecordsRead`.
105
+ *
106
+ * @returns A data accessor with `blob()`, `bytes()`, `json()`, `text()`, and `stream()` methods.
107
+ *
108
+ * @beta
109
+ */
110
+ get data(): {
111
+ blob: () => Promise<Blob>;
112
+ bytes: () => Promise<Uint8Array>;
113
+ json: <T = unknown>() => Promise<T>;
114
+ text: () => Promise<string>;
115
+ stream: () => Promise<ReadableStream>;
116
+ then: (onFulfilled?: (value: ReadableStream) => ReadableStream | PromiseLike<ReadableStream>, onRejected?: (reason: any) => PromiseLike<never>) => Promise<ReadableStream>;
117
+ catch: (onRejected?: (reason: any) => PromiseLike<never>) => Promise<ReadableStream>;
118
+ };
119
+ /**
120
+ * Returns a JSON representation of the record.
121
+ * Called by `JSON.stringify(...)` automatically.
122
+ */
123
+ toJSON(): Record<string, unknown>;
124
+ /**
125
+ * Convenience string representation.
126
+ */
127
+ toString(): string;
128
+ /**
129
+ * Fetches the record's data from the remote DWN using an anonymous `RecordsRead`.
130
+ */
131
+ private readRecordData;
132
+ }
133
+ //# sourceMappingURL=read-only-record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-only-record.d.ts","sourceRoot":"","sources":["../../src/read-only-record.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EA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AC,CAAC,GAAG,OAAO,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;QAC5B,MAAM,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;QACtC,IAAI,EAAE,CACJ,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC,EACrF,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,WAAW,CAAC,KAAK,CAAC,KAC7C,OAAO,CAAC,cAAc,CAAC,CAAC;QAC7B,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,WAAW,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;KACpF,CA6CJ;IAMD;;;OAGG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAwBjC;;OAEG;IACH,QAAQ,IAAI,MAAM;IAmBlB;;OAEG;YACW,cAAc;CAgB7B"}
@@ -27,8 +27,8 @@ export type RecordModel = ImmutableRecordProperties & OptionalRecordProperties &
27
27
  author: string;
28
28
  /** The unique identifier of the record. */
29
29
  recordId?: string;
30
- /** The timestamp indicating when the record was last modified. */
31
- messageTimestamp?: string;
30
+ /** The message timestamp (time of creation, most recent update, or deletion). */
31
+ timestamp?: string;
32
32
  /** The protocol role under which this record is written. */
33
33
  protocolRole?: RecordOptions['protocolRole'];
34
34
  };
@@ -100,8 +100,8 @@ export type RecordUpdateParams = {
100
100
  dataFormat?: string;
101
101
  /** The size of the data in bytes. */
102
102
  dataSize?: DwnMessageDescriptor[DwnInterface.RecordsWrite]['dataSize'];
103
- /** The timestamp indicating when the record was last modified. */
104
- dateModified?: DwnMessageDescriptor[DwnInterface.RecordsWrite]['messageTimestamp'];
103
+ /** The timestamp of the update message. */
104
+ timestamp?: DwnMessageDescriptor[DwnInterface.RecordsWrite]['messageTimestamp'];
105
105
  /** The timestamp indicating when the record was published. */
106
106
  datePublished?: DwnMessageDescriptor[DwnInterface.RecordsWrite]['datePublished'];
107
107
  /** The protocol role under which this record is written. */
@@ -134,11 +134,29 @@ export type RecordDeleteParams = {
134
134
  signAsOwner?: boolean;
135
135
  /** Whether or not to prune any children this record may have. */
136
136
  prune?: DwnMessageDescriptor[DwnInterface.RecordsDelete]['prune'];
137
- /** The timestamp indicating when the record was deleted. */
138
- dateModified?: DwnMessageDescriptor[DwnInterface.RecordsDelete]['messageTimestamp'];
137
+ /** The timestamp of the delete message. */
138
+ timestamp?: DwnMessageDescriptor[DwnInterface.RecordsDelete]['messageTimestamp'];
139
139
  /** The protocol role under which this record will be deleted. */
140
140
  protocolRole?: string;
141
141
  };
142
+ /**
143
+ * The result of a {@link Record.update} operation.
144
+ *
145
+ * @beta
146
+ */
147
+ export type RecordUpdateResult = DwnResponseStatus & {
148
+ /** The updated Record instance reflecting the new state. */
149
+ record: Record;
150
+ };
151
+ /**
152
+ * The result of a {@link Record.delete} operation.
153
+ *
154
+ * @beta
155
+ */
156
+ export type RecordDeleteResult = DwnResponseStatus & {
157
+ /** The deleted Record instance reflecting the deleted state. */
158
+ record: Record;
159
+ };
142
160
  /**
143
161
  * The `Record` class encapsulates a single record's data and metadata, providing a more
144
162
  * developer-friendly interface for working with Decentralized Web Node (DWN) records.
@@ -146,12 +164,9 @@ export type RecordDeleteParams = {
146
164
  * Methods are provided to read, update, and manage the record's lifecycle, including writing to
147
165
  * remote DWNs.
148
166
  *
149
- * Note: The `messageTimestamp` of the most recent RecordsWrite message is
150
- * logically equivalent to the date/time at which a Record was most
151
- * recently modified. Since this Record class implementation is
152
- * intended to simplify the developer experience of working with
153
- * logical records (and not individual DWN messages) the
154
- * `messageTimestamp` is mapped to `dateModified`.
167
+ * Note: The DWN SDK's `messageTimestamp` is exposed as `timestamp` on
168
+ * the Record class. It represents the time of the most recent
169
+ * message (create, update, or delete) for this logical record.
155
170
  *
156
171
  * @beta
157
172
  */
@@ -199,6 +214,10 @@ export declare class Record implements RecordModel {
199
214
  private _recordId;
200
215
  /** Role under which the record is written. */
201
216
  private _protocolRole?;
217
+ /** Cached reconstructed raw message, invalidated when record state changes. */
218
+ private _rawMessageCache?;
219
+ /** Dirty flag indicating the cached raw message needs to be rebuilt. */
220
+ private _rawMessageDirty;
202
221
  /** The `RecordsWriteMessage` descriptor unless the record is in a deleted state */
203
222
  private get _recordsWriteDescriptor();
204
223
  /** The `RecordsWrite` descriptor from the current record or the initial write if the record is in a delete state. */
@@ -235,8 +254,8 @@ export declare class Record implements RecordModel {
235
254
  get author(): string;
236
255
  /** DID that is the original creator of the Record. */
237
256
  get creator(): string;
238
- /** Record's modified date */
239
- get dateModified(): string;
257
+ /** Record's message timestamp (time of creation, most recent update, or deletion). */
258
+ get timestamp(): string;
240
259
  /** Record's encryption */
241
260
  get encryption(): DwnMessage[DwnInterface.RecordsWrite]['encryption'];
242
261
  /** Record's signatures attestation */
@@ -251,6 +270,7 @@ export declare class Record implements RecordModel {
251
270
  get initialWrite(): RecordOptions['initialWrite'];
252
271
  /**
253
272
  * Returns a copy of the raw `RecordsWriteMessage` that was used to create the current `Record` instance.
273
+ * The result is cached and only rebuilt when the record's state changes (via `update()` or `delete()`).
254
274
  */
255
275
  get rawMessage(): DwnMessage[DwnInterface.RecordsWrite] | DwnMessage[DwnInterface.RecordsDelete];
256
276
  constructor(agent: Web5Agent, options: RecordOptions, permissionsApi?: PermissionsApi);
@@ -329,13 +349,13 @@ export declare class Record implements RecordModel {
329
349
  *
330
350
  * @beta
331
351
  */
332
- update({ dateModified, data, encryption, protocolRole, store, ...params }: RecordUpdateParams): Promise<DwnResponseStatus>;
352
+ update({ timestamp, data, encryption, protocolRole, store, ...params }: RecordUpdateParams): Promise<RecordUpdateResult>;
333
353
  /**
334
354
  * Delete the current record on the DWN.
335
355
  * @param params - Parameters to delete the record.
336
- * @returns the status of the delete request
356
+ * @returns the status and a new Record instance reflecting the deleted state
337
357
  */
338
- delete(deleteParams?: RecordDeleteParams): Promise<DwnResponseStatus>;
358
+ delete(deleteParams?: RecordDeleteParams): Promise<RecordDeleteResult>;
339
359
  /**
340
360
  * Process the initial write, if it hasn't already been processed, with the options set for storing and/or signing as the owner.
341
361
  */
@@ -1 +1 @@
1
- {"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,oBAAoB,EAEpB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EAGd,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEL,YAAY,EAKb,MAAM,cAAc,CAAC;AAKtB;;;;KAIK;AACL,MAAM,MAAM,yBAAyB,GACnC,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,cAAc,GAAG,WAAW,GAAG,QAAQ,CAAC,CAAC;AAE3I;;;;EAIE;AACF,MAAM,MAAM,wBAAwB,GAClC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,eAAe,GAAG,aAAa,GAAG,YAAY,GAAG,WAAW,CAAE,GAC1G,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,eAAe,GAAG,WAAW,GAAG,MAAM,CAAC,CAAC;AAExI;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,yBAAyB,GAAG,wBAAwB,GAAG;IAE/E,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IAEf,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,kEAAkE;IAClE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,4DAA4D;IAC5D,YAAY,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CAC9C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,EAAE,GAAG,MAAM,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAsGrI;;;;OAIG;IACG,MAAM,CAAC,YAAY,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAsF5E;;OAEG;YACW,2BAA2B;IAiDzC;;;OAGG;YACW,aAAa;IAkE3B;;;;;;;;;;;;;;;OAeG;YACW,cAAc;IAyD5B;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAQtC;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;CAKlC"}
@@ -1,11 +1,30 @@
1
1
  /**
2
- * A type-safe wrapper around {@link DwnApi} scoped to a single protocol.
2
+ * A protocol-scoped API returned by {@link Web5.using}.
3
3
  *
4
- * `TypedDwnApi` is created via `dwn.using(typedProtocol)` and provides
5
- * autocompletion for protocol paths, typed data payloads, and tag shapes.
4
+ * `TypedWeb5` is the **primary developer interface** for interacting with
5
+ * protocol-backed records. It auto-injects the protocol URI, protocolPath,
6
+ * and schema into every operation, and provides compile-time path
7
+ * autocompletion plus typed data payloads via the schema map.
6
8
  *
7
- * Every method delegates to the corresponding `dwn.records.*` method,
8
- * injecting the protocol URI, protocolPath, and schema automatically.
9
+ * @example
10
+ * ```ts
11
+ * const social = web5.using(SocialProtocol);
12
+ *
13
+ * // Install the protocol
14
+ * await social.configure();
15
+ *
16
+ * // Write — path and data type are checked at compile time
17
+ * const { record } = await social.records.write('thread', {
18
+ * data: { title: 'Hello World', body: '...' },
19
+ * });
20
+ *
21
+ * // Query — protocol and protocolPath are auto-injected
22
+ * const { records } = await social.records.query('thread');
23
+ *
24
+ * // Subscribe — real-time changes via LiveQuery
25
+ * const { liveQuery } = await social.records.subscribe('thread/reply');
26
+ * liveQuery.on('create', (record) => { ... });
27
+ * ```
9
28
  */
10
29
  import type { DwnApi } from './dwn-api.js';
11
30
  import type { LiveQuery } from './live-query.js';
@@ -18,7 +37,7 @@ import type { ProtocolPaths, SchemaMap, TypedProtocol, TypeNameAtPath } from './
18
37
  * Resolves the TypeScript data type for a given protocol path.
19
38
  *
20
39
  * If the schema map contains a mapping for the type name at the given path,
21
- * that type is returned. Otherwise falls back to `unknown`.
40
+ * that type is returned. Otherwise falls back to `unknown`.
22
41
  */
23
42
  type DataForPath<_D extends ProtocolDefinition, M extends SchemaMap, Path extends string> = TypeNameAtPath<Path> extends keyof M ? M[TypeNameAtPath<Path>] : unknown;
24
43
  /**
@@ -31,34 +50,31 @@ type ProtocolTypeForPath<D extends ProtocolDefinition, Path extends string> = Ty
31
50
  type DataFormatForPath<D extends ProtocolDefinition, Path extends string> = ProtocolTypeForPath<D, Path> extends {
32
51
  dataFormats: infer F;
33
52
  } ? F extends readonly string[] ? F[number] : string : string;
34
- /** Options for `TypedDwnApi.write()`. */
53
+ /** Options for {@link TypedWeb5} `records.write()`. */
35
54
  export type TypedWriteRequest<D extends ProtocolDefinition, M extends SchemaMap, Path extends string> = {
36
55
  /** The data payload. Type-checked against the schema map. */
37
56
  data: DataForPath<D, M, Path>;
38
- /** Additional message parameters (protocolPath and protocol are injected). */
39
- message?: {
40
- parentContextId?: string;
41
- published?: boolean;
42
- datePublished?: string;
43
- recipient?: string;
44
- protocolRole?: string;
45
- dataFormat?: DataFormatForPath<D, Path>;
46
- tags?: globalThis.Record<string, string | number | boolean | string[] | number[]>;
47
- };
57
+ parentContextId?: string;
58
+ published?: boolean;
59
+ datePublished?: string;
60
+ recipient?: string;
61
+ protocolRole?: string;
62
+ dataFormat?: DataFormatForPath<D, Path>;
63
+ tags?: globalThis.Record<string, string | number | boolean | string[] | number[]>;
48
64
  /** Whether to persist immediately (defaults to `true`). */
49
65
  store?: boolean;
50
66
  /** Whether to auto-encrypt (follows protocol definition if omitted). */
51
67
  encryption?: boolean;
52
68
  };
53
- /** Response from `TypedDwnApi.write()`. */
69
+ /** Response from {@link TypedWeb5} `records.write()`. */
54
70
  export type TypedWriteResponse = DwnResponseStatus & {
55
- record?: Record;
71
+ record: Record;
56
72
  };
57
- /** Filter options for `TypedDwnApi.query()`. */
73
+ /** Filter options for {@link TypedWeb5} `records.query()`. */
58
74
  export type TypedQueryFilter = Omit<RecordsFilter, 'protocol' | 'protocolPath' | 'schema'> & {
59
75
  tags?: globalThis.Record<string, string | number | boolean | (string | number)[]>;
60
76
  };
61
- /** Options for `TypedDwnApi.query()`. */
77
+ /** Options for {@link TypedWeb5} `records.query()`. */
62
78
  export type TypedQueryRequest = {
63
79
  /** Optional remote DWN DID to query from. */
64
80
  from?: string;
@@ -73,12 +89,12 @@ export type TypedQueryRequest = {
73
89
  /** When true, automatically decrypts encrypted records. */
74
90
  encryption?: boolean;
75
91
  };
76
- /** Response from `TypedDwnApi.query()`. */
92
+ /** Response from {@link TypedWeb5} `records.query()`. */
77
93
  export type TypedQueryResponse = DwnResponseStatus & {
78
- records?: Record[];
94
+ records: Record[];
79
95
  cursor?: DwnPaginationCursor;
80
96
  };
81
- /** Options for `TypedDwnApi.read()`. */
97
+ /** Options for {@link TypedWeb5} `records.read()`. */
82
98
  export type TypedReadRequest = {
83
99
  /** Optional remote DWN DID to read from. */
84
100
  from?: string;
@@ -87,18 +103,18 @@ export type TypedReadRequest = {
87
103
  /** When true, automatically decrypts the record. */
88
104
  encryption?: boolean;
89
105
  };
90
- /** Response from `TypedDwnApi.read()`. */
106
+ /** Response from {@link TypedWeb5} `records.read()`. */
91
107
  export type TypedReadResponse = DwnResponseStatus & {
92
108
  record: Record;
93
109
  };
94
- /** Options for `TypedDwnApi.delete()`. */
110
+ /** Options for {@link TypedWeb5} `records.delete()`. */
95
111
  export type TypedDeleteRequest = {
96
112
  /** Optional remote DWN DID to delete from. */
97
113
  from?: string;
98
114
  /** The `recordId` of the record to delete. */
99
115
  recordId: string;
100
116
  };
101
- /** Options for `TypedDwnApi.subscribe()`. */
117
+ /** Options for {@link TypedWeb5} `records.subscribe()`. */
102
118
  export type TypedSubscribeRequest = {
103
119
  /** Optional remote DWN DID to subscribe to. */
104
120
  from?: string;
@@ -106,33 +122,33 @@ export type TypedSubscribeRequest = {
106
122
  filter?: TypedQueryFilter;
107
123
  protocolRole?: string;
108
124
  };
109
- /** Response from `TypedDwnApi.subscribe()`. */
125
+ /** Response from {@link TypedWeb5} `records.subscribe()`. */
110
126
  export type TypedSubscribeResponse = DwnResponseStatus & {
111
127
  /** The live query instance, or `undefined` if the request failed. */
112
128
  liveQuery?: LiveQuery;
113
129
  };
114
130
  /**
115
- * A protocol-scoped wrapper around `DwnApi` that automatically injects
116
- * the `protocol` URI, `protocolPath`, and `schema` into every DWN operation.
131
+ * A protocol-scoped API that auto-injects `protocol`, `protocolPath`, and
132
+ * `schema` into every DWN operation.
117
133
  *
118
- * Obtain an instance via `dwn.using(typedProtocol)`.
134
+ * Obtain an instance via `web5.using(typedProtocol)`.
119
135
  *
120
136
  * @example
121
137
  * ```ts
122
- * const social = dwn.using(SocialGraphProtocol);
138
+ * const social = web5.using(SocialProtocol);
123
139
  *
124
- * // Write — path and data type are checked at compile time
125
- * const { record } = await social.write('friend', {
140
+ * await social.configure();
141
+ *
142
+ * const { record } = await social.records.write('friend', {
126
143
  * data: { did: 'did:example:alice', alias: 'Alice' },
127
144
  * });
128
145
  *
129
- * // Query protocol and protocolPath are auto-injected
130
- * const { records } = await social.query('friend', {
146
+ * const { records } = await social.records.query('friend', {
131
147
  * filter: { tags: { did: 'did:example:alice' } },
132
148
  * });
133
149
  * ```
134
150
  */
135
- export declare class TypedDwnApi<D extends ProtocolDefinition = ProtocolDefinition, M extends SchemaMap = SchemaMap> {
151
+ export declare class TypedWeb5<D extends ProtocolDefinition = ProtocolDefinition, M extends SchemaMap = SchemaMap> {
136
152
  private _dwn;
137
153
  private _definition;
138
154
  constructor(dwn: DwnApi, protocol: TypedProtocol<D, M>);
@@ -143,6 +159,11 @@ export declare class TypedDwnApi<D extends ProtocolDefinition = ProtocolDefiniti
143
159
  /**
144
160
  * Configures (installs) this protocol on the local DWN.
145
161
  *
162
+ * If the protocol is already installed with an identical definition,
163
+ * this is a no-op and returns the existing protocol. If the definition
164
+ * has changed (e.g. new types, modified structure), the protocol is
165
+ * re-configured with the updated definition.
166
+ *
146
167
  * @param options - Optional overrides like `encryption`.
147
168
  */
148
169
  configure(options?: {
@@ -151,43 +172,19 @@ export declare class TypedDwnApi<D extends ProtocolDefinition = ProtocolDefiniti
151
172
  protocol?: Protocol;
152
173
  }>;
153
174
  /**
154
- * Write a record at the given protocol path.
155
- *
156
- * @param path - The protocol path (e.g. `'friend'`, `'group/member'`).
157
- * @param request - Write options including typed `data`.
158
- */
159
- write<Path extends ProtocolPaths<D> & string>(path: Path, request: TypedWriteRequest<D, M, Path>): Promise<TypedWriteResponse>;
160
- /**
161
- * Query records at the given protocol path.
175
+ * Protocol-scoped record operations.
162
176
  *
163
- * @param path - The protocol path to query.
164
- * @param request - Query options including optional filter, sort, and pagination.
177
+ * Every method auto-injects the protocol URI, protocolPath, and schema
178
+ * from the protocol definition. Path parameters provide compile-time
179
+ * autocompletion via `ProtocolPaths<D>`.
165
180
  */
166
- query<Path extends ProtocolPaths<D> & string>(path: Path, request?: TypedQueryRequest): Promise<TypedQueryResponse>;
167
- /**
168
- * Read a single record at the given protocol path.
169
- *
170
- * @param path - The protocol path to read from.
171
- * @param request - Read options including a filter to identify the record.
172
- */
173
- read<Path extends ProtocolPaths<D> & string>(path: Path, request: TypedReadRequest): Promise<TypedReadResponse>;
174
- /**
175
- * Delete a record at the given protocol path.
176
- *
177
- * @param path - The protocol path (used for permission scoping).
178
- * @param request - Delete options including the `recordId`.
179
- */
180
- delete<Path extends ProtocolPaths<D> & string>(_path: Path, request: TypedDeleteRequest): Promise<DwnResponseStatus>;
181
- /**
182
- * Subscribe to records at the given protocol path.
183
- *
184
- * Returns a {@link LiveQuery} that atomically provides an initial snapshot
185
- * and a real-time stream of deduplicated change events.
186
- *
187
- * @param path - The protocol path to subscribe to.
188
- * @param request - Subscribe options including optional filter and role.
189
- */
190
- subscribe<Path extends ProtocolPaths<D> & string>(path: Path, request?: TypedSubscribeRequest): Promise<TypedSubscribeResponse>;
181
+ get records(): {
182
+ write: <Path extends ProtocolPaths<D> & string>(path: Path, request: TypedWriteRequest<D, M, Path>) => Promise<TypedWriteResponse>;
183
+ query: <Path extends ProtocolPaths<D> & string>(path: Path, request?: TypedQueryRequest) => Promise<TypedQueryResponse>;
184
+ read: <Path extends ProtocolPaths<D> & string>(path: Path, request: TypedReadRequest) => Promise<TypedReadResponse>;
185
+ delete: <Path extends ProtocolPaths<D> & string>(path: Path, request: TypedDeleteRequest) => Promise<DwnResponseStatus>;
186
+ subscribe: <Path extends ProtocolPaths<D> & string>(path: Path, request?: TypedSubscribeRequest) => Promise<TypedSubscribeResponse>;
187
+ };
191
188
  }
192
189
  export {};
193
- //# sourceMappingURL=typed-dwn-api.d.ts.map
190
+ //# sourceMappingURL=typed-web5.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-web5.d.ts","sourceRoot":"","sources":["../../src/typed-web5.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;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,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AE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG;QAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;KAAE,CAAC;IAqBhH;;;;;;OAMG;IACH,IAAW,OAAO,IAAI;QACpB,KAAK,EAAE,CAAC,IAAI,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;QACnI,KAAK,EAAE,CAAC,IAAI,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,iBAAiB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;QACxH,IAAI,EAAE,CAAC,IAAI,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACpH,MAAM,EAAE,CAAC,IAAI,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACxH,SAAS,EAAE,CAAC,IAAI,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;KACnI,CAmIF;CACF"}
@@ -2,9 +2,13 @@
2
2
  * NOTE: Added reference types here to avoid a `pnpm` bug during build.
3
3
  * https://github.com/enboxorg/enbox/pull/507
4
4
  */
5
+ import type { DidMethodResolver } from '@enbox/dids';
6
+ import type { ProtocolDefinition } from '@enbox/dwn-sdk-js';
5
7
  import type { DwnDataEncodedRecordsWriteMessage, DwnProtocolDefinition, HdIdentityVault, Permission, WalletConnectOptions, Web5Agent } from '@enbox/agent';
8
+ import type { SchemaMap, TypedProtocol } from './protocol-types.js';
6
9
  import { DidApi } from './did-api.js';
7
- import { DwnApi } from './dwn-api.js';
10
+ import { DwnReaderApi } from './dwn-reader-api.js';
11
+ import { TypedWeb5 } from './typed-web5.js';
8
12
  import { VcApi } from './vc-api.js';
9
13
  /** Override defaults configured during the technical preview phase. */
10
14
  export type TechPreviewOptions = {
@@ -43,6 +47,26 @@ export type ConnectOptions = Omit<WalletConnectOptions, 'permissionRequests'> &
43
47
  */
44
48
  permissionRequests: ConnectPermissionRequest[];
45
49
  };
50
+ /**
51
+ * Options for creating an anonymous (read-only) Web5 instance via {@link Web5.anonymous}.
52
+ *
53
+ * @beta
54
+ */
55
+ export type Web5AnonymousOptions = {
56
+ /** Override the default DID method resolvers. Defaults to `[DidDht, DidJwk, DidKey, DidWeb]`. */
57
+ didResolvers?: DidMethodResolver[];
58
+ };
59
+ /**
60
+ * The result of calling {@link Web5.anonymous}.
61
+ *
62
+ * Contains only a read-only `dwn` property — no `did`, `vc`, or `agent`.
63
+ *
64
+ * @beta
65
+ */
66
+ export type Web5AnonymousApi = {
67
+ /** A read-only DWN API for querying public data on remote DWNs. */
68
+ dwn: DwnReaderApi;
69
+ };
46
70
  /** Optional overrides that can be provided when calling {@link Web5.connect}. */
47
71
  export type Web5ConnectOptions = {
48
72
  /**
@@ -184,11 +208,63 @@ export declare class Web5 {
184
208
  agent: Web5Agent;
185
209
  /** Exposed instance to the DID APIs, allow users to create and resolve DIDs */
186
210
  did: DidApi;
187
- /** Exposed instance to the DWN APIs, allow users to read/write records */
188
- dwn: DwnApi;
211
+ /** Internal DWN API instance. Use {@link Web5.using} for protocol-scoped access. */
212
+ private _dwn;
189
213
  /** Exposed instance to the VC APIs, allow users to issue, present and verify VCs */
190
214
  vc: VcApi;
191
215
  constructor({ agent, connectedDid, delegateDid }: Web5Params);
216
+ /**
217
+ * Returns a {@link TypedWeb5} instance scoped to the given protocol.
218
+ *
219
+ * This is the **primary developer interface** for interacting with
220
+ * protocol-backed records. It auto-injects the protocol URI, protocolPath,
221
+ * and schema into every operation, and provides compile-time path
222
+ * autocompletion plus typed data payloads via the schema map.
223
+ *
224
+ * @param protocol - A typed protocol created via `defineProtocol()`.
225
+ * @returns A `TypedWeb5` instance bound to the given protocol.
226
+ *
227
+ * @example
228
+ * ```ts
229
+ * const social = web5.using(SocialProtocol);
230
+ *
231
+ * await social.configure();
232
+ *
233
+ * const { record } = await social.records.write('friend', {
234
+ * data: { did: 'did:example:alice', alias: 'Alice' },
235
+ * });
236
+ *
237
+ * const { records } = await social.records.query('friend');
238
+ * ```
239
+ */
240
+ using<D extends ProtocolDefinition, M extends SchemaMap>(protocol: TypedProtocol<D, M>): TypedWeb5<D, M>;
241
+ /**
242
+ * Creates a lightweight, read-only Web5 instance for querying public DWN data.
243
+ *
244
+ * No identity, vault, password, or signing keys are required. The returned
245
+ * API supports querying and reading published records and protocols from any
246
+ * remote DWN, using **unsigned** (anonymous) DWN messages.
247
+ *
248
+ * @param options - Optional configuration overrides.
249
+ * @returns A {@link Web5AnonymousApi} with a read-only `dwn` property.
250
+ *
251
+ * @example
252
+ * ```ts
253
+ * const { dwn } = Web5.anonymous();
254
+ *
255
+ * const { records } = await dwn.records.query({
256
+ * from: 'did:dht:alice...',
257
+ * filter: { protocol: 'https://social.example/posts', protocolPath: 'post' },
258
+ * });
259
+ *
260
+ * for (const record of records) {
261
+ * console.log(record.id, await record.data.text());
262
+ * }
263
+ * ```
264
+ *
265
+ * @beta
266
+ */
267
+ static anonymous(options?: Web5AnonymousOptions): Web5AnonymousApi;
192
268
  /**
193
269
  * Connects to a {@link Web5Agent}. Defaults to creating a local {@link Web5UserAgent} if one
194
270
  * isn't provided.