@enbox/api 0.1.0 → 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 (63) 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 +84 -130
  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 +4 -2
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/live-query.js +154 -0
  14. package/dist/esm/live-query.js.map +1 -0
  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 +20 -104
  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 +4 -2
  31. package/dist/types/index.d.ts.map +1 -1
  32. package/dist/types/live-query.d.ts +148 -0
  33. package/dist/types/live-query.d.ts.map +1 -0
  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} +75 -76
  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 +10 -6
  44. package/src/advanced.ts +29 -0
  45. package/src/define-protocol.ts +3 -3
  46. package/src/dwn-api.ts +141 -266
  47. package/src/dwn-reader-api.ts +255 -0
  48. package/src/index.ts +4 -2
  49. package/src/live-query.ts +261 -0
  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/subscription-util.js +0 -35
  56. package/dist/esm/subscription-util.js.map +0 -1
  57. package/dist/esm/typed-dwn-api.js +0 -181
  58. package/dist/esm/typed-dwn-api.js.map +0 -1
  59. package/dist/types/subscription-util.d.ts +0 -19
  60. package/dist/types/subscription-util.d.ts.map +0 -1
  61. package/dist/types/typed-dwn-api.d.ts.map +0 -1
  62. package/src/subscription-util.ts +0 -44
  63. package/src/typed-dwn-api.ts +0 -370
@@ -0,0 +1,148 @@
1
+ import type { DwnMessageSubscription, PermissionsApi, Web5Agent } from '@enbox/agent';
2
+ import type { PaginationCursor, RecordsQueryReplyEntry } from '@enbox/dwn-sdk-js';
3
+ import { Record } from './record.js';
4
+ /**
5
+ * The type of change that occurred to a record.
6
+ */
7
+ export type RecordChangeType = 'create' | 'update' | 'delete';
8
+ /**
9
+ * Describes a change to a record in a {@link LiveQuery}.
10
+ */
11
+ export type RecordChange = {
12
+ /** Whether the record was created, updated, or deleted. */
13
+ type: RecordChangeType;
14
+ /** The record affected by the change. */
15
+ record: Record;
16
+ };
17
+ /**
18
+ * A `CustomEvent` subclass carrying a {@link RecordChange} as its `detail`.
19
+ *
20
+ * Dispatched on the {@link LiveQuery} `EventTarget` for both the specific
21
+ * change-type event (`create`, `update`, `delete`) and the catch-all `change`
22
+ * event.
23
+ */
24
+ export declare class RecordChangeEvent extends CustomEvent<RecordChange> {
25
+ constructor(change: RecordChange);
26
+ }
27
+ /**
28
+ * Options for creating a {@link LiveQuery}.
29
+ * @internal — Constructed by `DwnApi.records.subscribe()`, not by end users.
30
+ */
31
+ export type LiveQueryOptions = {
32
+ /** The agent instance used to construct Record objects. */
33
+ agent: Web5Agent;
34
+ /** The DID of the connected user. */
35
+ connectedDid: string;
36
+ /** Optional delegate DID for permission-delegated access. */
37
+ delegateDid?: string;
38
+ /** Optional protocol role for role-authorized access. */
39
+ protocolRole?: string;
40
+ /** Optional remote DWN origin if subscribing to a remote DWN. */
41
+ remoteOrigin?: string;
42
+ /** The permissions API instance for constructing Record objects. */
43
+ permissionsApi?: PermissionsApi;
44
+ /** The initial snapshot entries from the subscribe reply. */
45
+ initialEntries: RecordsQueryReplyEntry[];
46
+ /** Pagination cursor for fetching the next page of initial results. */
47
+ cursor?: PaginationCursor;
48
+ /** The underlying DWN subscription handle. */
49
+ subscription: DwnMessageSubscription;
50
+ };
51
+ /**
52
+ * A live query that combines an initial snapshot of matching records with a
53
+ * real-time stream of deduplicated, semantically-typed change events.
54
+ *
55
+ * `LiveQuery` extends `EventTarget` so that standard `addEventListener` /
56
+ * `removeEventListener` work out of the box. For convenience, the typed
57
+ * {@link LiveQuery.on | `.on()`} method provides a cleaner API that returns an
58
+ * unsubscribe function.
59
+ *
60
+ * ### Events
61
+ *
62
+ * | Event name | `detail` type | Description |
63
+ * |---|---|---|
64
+ * | `create` | {@link RecordChange} | A new record was written |
65
+ * | `update` | {@link RecordChange} | An existing record was updated |
66
+ * | `delete` | {@link RecordChange} | A record was deleted |
67
+ * | `change` | {@link RecordChange} | Catch-all for any of the above |
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const { liveQuery } = await dwn.records.subscribe({
72
+ * message: {
73
+ * filter: {
74
+ * protocol : chatProtocol.protocol,
75
+ * protocolPath : 'thread/message',
76
+ * }
77
+ * }
78
+ * });
79
+ *
80
+ * // Initial state
81
+ * for (const record of liveQuery.records) {
82
+ * renderMessage(record);
83
+ * }
84
+ *
85
+ * // Real-time changes
86
+ * liveQuery.on('create', (record) => appendMessage(record));
87
+ * liveQuery.on('update', (record) => refreshMessage(record));
88
+ * liveQuery.on('delete', (record) => removeMessage(record));
89
+ *
90
+ * // Or use the catch-all
91
+ * liveQuery.on('change', ({ type, record }) => {
92
+ * console.log(`${type}: ${record.id}`);
93
+ * });
94
+ *
95
+ * // Cleanup
96
+ * await liveQuery.close();
97
+ * ```
98
+ */
99
+ export declare class LiveQuery extends EventTarget {
100
+ /** The initial snapshot of matching records. */
101
+ readonly records: Record[];
102
+ /**
103
+ * Pagination cursor for fetching the next page of initial results.
104
+ *
105
+ * When the initial snapshot was limited (via `pagination.limit`), this
106
+ * cursor can be passed in a subsequent `records.subscribe()` call to
107
+ * continue from where the previous snapshot left off.
108
+ *
109
+ * `undefined` when there are no more results.
110
+ */
111
+ readonly cursor?: PaginationCursor;
112
+ /** The underlying DWN subscription handle. */
113
+ private _subscription;
114
+ /** Tracks known record states for dedup and change-type classification. */
115
+ private _knownRecords;
116
+ /** Whether the live query has been closed. */
117
+ private _closed;
118
+ constructor(options: LiveQueryOptions);
119
+ /**
120
+ * Process an incoming live event from the DWN subscription.
121
+ * Deduplicates against the initial snapshot and classifies the change type.
122
+ *
123
+ * @internal — Called by `DwnApi.records.subscribe()` when wiring up the subscription handler.
124
+ */
125
+ handleEvent(record: Record): void;
126
+ /**
127
+ * Register a typed event handler. Returns an unsubscribe function.
128
+ *
129
+ * @param event - The event type to listen for.
130
+ * @param handler - The handler function.
131
+ * @returns A function that removes the handler when called.
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * const off = live.on('create', (record) => console.log(record.id));
136
+ * off(); // stop listening
137
+ * ```
138
+ */
139
+ on(event: 'change', handler: (change: RecordChange) => void): () => void;
140
+ on(event: 'create', handler: (record: Record) => void): () => void;
141
+ on(event: 'update', handler: (record: Record) => void): () => void;
142
+ on(event: 'delete', handler: (record: Record) => void): () => void;
143
+ /**
144
+ * Close the underlying subscription and stop dispatching events.
145
+ */
146
+ close(): Promise<void>;
147
+ }
148
+ //# sourceMappingURL=live-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live-query.d.ts","sourceRoot":"","sources":["../../src/live-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAIlF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,2DAA2D;IAC3D,IAAI,EAAE,gBAAgB,CAAC;IAEvB,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;GAMG;AACH,qBAAa,iBAAkB,SAAQ,WAAW,CAAC,YAAY,CAAC;gBAClD,MAAM,EAAE,YAAY;CAGjC;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,2DAA2D;IAC3D,KAAK,EAAE,SAAS,CAAC;IAEjB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;IAErB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,oEAAoE;IACpE,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC,6DAA6D;IAC7D,cAAc,EAAE,sBAAsB,EAAE,CAAC;IAEzC,uEAAuE;IACvE,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAE1B,8CAA8C;IAC9C,YAAY,EAAE,sBAAsB,CAAC;CACtC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACxC,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAE3B;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAEnC,8CAA8C;IAC9C,OAAO,CAAC,aAAa,CAAyB;IAE9C,2EAA2E;IAC3E,OAAO,CAAC,aAAa,CAAsB;IAE3C,8CAA8C;IAC9C,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,gBAAgB;IAmCrC;;;;;OAKG;IACI,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAqCxC;;;;;;;;;;;;OAYG;IACH,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAAG,MAAM,IAAI;IACxE,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAClE,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAClE,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAelE;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAO7B"}
@@ -64,7 +64,7 @@ export type TagKeys<Tags extends ProtocolTagsDefinition> = Exclude<Extract<keyof
64
64
  /**
65
65
  * A mapping from protocol type names to their TypeScript data shapes.
66
66
  *
67
- * Used as a type parameter to `defineProtocol()` and `TypedDwnApi` so that
67
+ * Used as a type parameter to `defineProtocol()` and `TypedWeb5` so that
68
68
  * the protocol definition JSON stays JSON-compatible while TypeScript types
69
69
  * are tracked separately.
70
70
  *
@@ -80,7 +80,7 @@ export type SchemaMap = Record<string, unknown>;
80
80
  /**
81
81
  * The return type of `defineProtocol()`. Bundles the raw protocol definition
82
82
  * with its inferred path strings and schema type map for downstream use
83
- * by `TypedDwnApi`.
83
+ * by `TypedWeb5`.
84
84
  */
85
85
  export type TypedProtocol<D extends ProtocolDefinition = ProtocolDefinition, M extends SchemaMap = SchemaMap> = {
86
86
  /** The raw DWN protocol definition (JSON-compatible). */
@@ -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,EAA0B,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAKvG;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,yEAAyE;IACzE,UAAU,EAAE,mBAAmB,CAAC;IAChC,iEAAiE;IACjE,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACn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AE,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,"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