@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.
- package/README.md +140 -159
- package/dist/browser.mjs +23 -13
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/advanced.js +11 -0
- package/dist/esm/advanced.js.map +1 -0
- package/dist/esm/define-protocol.js +3 -3
- package/dist/esm/dwn-api.js +55 -107
- package/dist/esm/dwn-api.js.map +1 -1
- package/dist/esm/dwn-reader-api.js +128 -0
- package/dist/esm/dwn-reader-api.js.map +1 -0
- package/dist/esm/index.js +3 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/live-query.js +5 -4
- package/dist/esm/live-query.js.map +1 -1
- package/dist/esm/read-only-record.js +255 -0
- package/dist/esm/read-only-record.js.map +1 -0
- package/dist/esm/record.js +46 -57
- package/dist/esm/record.js.map +1 -1
- package/dist/esm/typed-web5.js +242 -0
- package/dist/esm/typed-web5.js.map +1 -0
- package/dist/esm/web5.js +71 -3
- package/dist/esm/web5.js.map +1 -1
- package/dist/types/advanced.d.ts +12 -0
- package/dist/types/advanced.d.ts.map +1 -0
- package/dist/types/define-protocol.d.ts +3 -3
- package/dist/types/dwn-api.d.ts +12 -89
- package/dist/types/dwn-api.d.ts.map +1 -1
- package/dist/types/dwn-reader-api.d.ts +138 -0
- package/dist/types/dwn-reader-api.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/live-query.d.ts +13 -1
- package/dist/types/live-query.d.ts.map +1 -1
- package/dist/types/protocol-types.d.ts +2 -2
- package/dist/types/read-only-record.d.ts +133 -0
- package/dist/types/read-only-record.d.ts.map +1 -0
- package/dist/types/record.d.ts +37 -17
- package/dist/types/record.d.ts.map +1 -1
- package/dist/types/{typed-dwn-api.d.ts → typed-web5.d.ts} +70 -73
- package/dist/types/typed-web5.d.ts.map +1 -0
- package/dist/types/web5.d.ts +79 -3
- package/dist/types/web5.d.ts.map +1 -1
- package/package.json +9 -5
- package/src/advanced.ts +29 -0
- package/src/define-protocol.ts +3 -3
- package/src/dwn-api.ts +88 -222
- package/src/dwn-reader-api.ts +255 -0
- package/src/index.ts +3 -2
- package/src/live-query.ts +20 -4
- package/src/protocol-types.ts +2 -2
- package/src/read-only-record.ts +328 -0
- package/src/record.ts +116 -86
- package/src/typed-web5.ts +445 -0
- package/src/web5.ts +104 -5
- package/dist/esm/typed-dwn-api.js +0 -182
- package/dist/esm/typed-dwn-api.js.map +0 -1
- package/dist/types/typed-dwn-api.d.ts.map +0 -1
- package/src/typed-dwn-api.ts +0 -370
package/dist/esm/web5.js
CHANGED
|
@@ -23,11 +23,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
}
|
|
24
24
|
return t;
|
|
25
25
|
};
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
26
|
+
import { AnonymousDwnApi, WalletConnect, Web5UserAgent } from '@enbox/agent';
|
|
27
|
+
import { DidDht, DidJwk, DidKey, DidResolverCacheMemory, DidWeb, UniversalResolver } from '@enbox/dids';
|
|
28
|
+
import { DwnRegistrar, Web5RpcClient } from '@enbox/dwn-clients';
|
|
28
29
|
import { DidApi } from './did-api.js';
|
|
29
30
|
import { DwnApi } from './dwn-api.js';
|
|
31
|
+
import { DwnReaderApi } from './dwn-reader-api.js';
|
|
30
32
|
import { PermissionGrant } from './permission-grant.js';
|
|
33
|
+
import { TypedWeb5 } from './typed-web5.js';
|
|
31
34
|
import { VcApi } from './vc-api.js';
|
|
32
35
|
/**
|
|
33
36
|
* The main Web5 API interface. It manages the creation of a DID if needed, the connection to the
|
|
@@ -37,9 +40,74 @@ export class Web5 {
|
|
|
37
40
|
constructor({ agent, connectedDid, delegateDid }) {
|
|
38
41
|
this.agent = agent;
|
|
39
42
|
this.did = new DidApi({ agent, connectedDid });
|
|
40
|
-
this.
|
|
43
|
+
this._dwn = new DwnApi({ agent, connectedDid, delegateDid });
|
|
41
44
|
this.vc = new VcApi({ agent, connectedDid });
|
|
42
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Returns a {@link TypedWeb5} instance scoped to the given protocol.
|
|
48
|
+
*
|
|
49
|
+
* This is the **primary developer interface** for interacting with
|
|
50
|
+
* protocol-backed records. It auto-injects the protocol URI, protocolPath,
|
|
51
|
+
* and schema into every operation, and provides compile-time path
|
|
52
|
+
* autocompletion plus typed data payloads via the schema map.
|
|
53
|
+
*
|
|
54
|
+
* @param protocol - A typed protocol created via `defineProtocol()`.
|
|
55
|
+
* @returns A `TypedWeb5` instance bound to the given protocol.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* const social = web5.using(SocialProtocol);
|
|
60
|
+
*
|
|
61
|
+
* await social.configure();
|
|
62
|
+
*
|
|
63
|
+
* const { record } = await social.records.write('friend', {
|
|
64
|
+
* data: { did: 'did:example:alice', alias: 'Alice' },
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
* const { records } = await social.records.query('friend');
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
using(protocol) {
|
|
71
|
+
return new TypedWeb5(this._dwn, protocol);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Creates a lightweight, read-only Web5 instance for querying public DWN data.
|
|
75
|
+
*
|
|
76
|
+
* No identity, vault, password, or signing keys are required. The returned
|
|
77
|
+
* API supports querying and reading published records and protocols from any
|
|
78
|
+
* remote DWN, using **unsigned** (anonymous) DWN messages.
|
|
79
|
+
*
|
|
80
|
+
* @param options - Optional configuration overrides.
|
|
81
|
+
* @returns A {@link Web5AnonymousApi} with a read-only `dwn` property.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* const { dwn } = Web5.anonymous();
|
|
86
|
+
*
|
|
87
|
+
* const { records } = await dwn.records.query({
|
|
88
|
+
* from: 'did:dht:alice...',
|
|
89
|
+
* filter: { protocol: 'https://social.example/posts', protocolPath: 'post' },
|
|
90
|
+
* });
|
|
91
|
+
*
|
|
92
|
+
* for (const record of records) {
|
|
93
|
+
* console.log(record.id, await record.data.text());
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @beta
|
|
98
|
+
*/
|
|
99
|
+
static anonymous(options) {
|
|
100
|
+
var _a;
|
|
101
|
+
const didResolver = new UniversalResolver({
|
|
102
|
+
didResolvers: (_a = options === null || options === void 0 ? void 0 : options.didResolvers) !== null && _a !== void 0 ? _a : [DidDht, DidJwk, DidKey, DidWeb],
|
|
103
|
+
cache: new DidResolverCacheMemory(),
|
|
104
|
+
});
|
|
105
|
+
const rpcClient = new Web5RpcClient();
|
|
106
|
+
const anonymousDwn = new AnonymousDwnApi({ didResolver, rpcClient });
|
|
107
|
+
return {
|
|
108
|
+
dwn: new DwnReaderApi(anonymousDwn),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
43
111
|
/**
|
|
44
112
|
* Connects to a {@link Web5Agent}. Defaults to creating a local {@link Web5UserAgent} if one
|
|
45
113
|
* isn't provided.
|
package/dist/esm/web5.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web5.js","sourceRoot":"","sources":["../../src/web5.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,2CAA2C;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"web5.js","sourceRoot":"","sources":["../../src/web5.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,2CAA2C;;;;;;;;;;;;;;;;;;;;;AAkB3C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;A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AAK,CAAC,IAAI,CAAC,CAAC;gBAC3C,IAAI,MAAM,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBACxB,MAAM,IAAI,KAAK,CAAC,mDAAmD,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;gBACtF,CAAC;gBAED,MAAM,QAAQ,GAAI,KAAK,CAAC,KAAgE,CAAC,QAAQ,CAAC;gBAClG,IAAI,QAAQ,EAAE,CAAC;oBACb,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBACnC,CAAC;YACH,CAAC;YAED,2HAA2H;YAC3H,sHAAsH;YACtH,OAAO,CAAC,GAAG,kBAAkB,CAAC,CAAC;QACjC,CAAC;KAAA;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advanced API surface for power users who need direct access to
|
|
3
|
+
* the underlying {@link DwnApi}.
|
|
4
|
+
*
|
|
5
|
+
* Most applications should use `web5.using(protocol)` instead.
|
|
6
|
+
* Import from `@enbox/api/advanced` to access these exports.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
export { DwnApi } from './dwn-api.js';
|
|
11
|
+
export type { FetchGrantsRequest, FetchRequestsRequest, ProtocolsConfigureRequest, ProtocolsConfigureResponse, ProtocolsQueryRequest, ProtocolsQueryResponse, RecordsDeleteRequest, RecordsQueryRequest, RecordsQueryResponse, RecordsReadRequest, RecordsReadResponse, RecordsSubscribeRequest, RecordsSubscribeResponse, RecordsWriteRequest, RecordsWriteResponse, } from './dwn-api.js';
|
|
12
|
+
//# sourceMappingURL=advanced.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../../src/advanced.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,cAAc,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Factory function for creating typed protocol definitions.
|
|
3
3
|
*
|
|
4
4
|
* `defineProtocol()` wraps a standard {@link ProtocolDefinition} with
|
|
5
|
-
* compile-time type metadata so that {@link
|
|
5
|
+
* compile-time type metadata so that {@link TypedWeb5} can provide
|
|
6
6
|
* path autocompletion, data-shape inference, and tag type safety.
|
|
7
7
|
*/
|
|
8
8
|
import type { ProtocolDefinition } from '@enbox/dwn-sdk-js';
|
|
@@ -14,7 +14,7 @@ import type { SchemaMap, TypedProtocol } from './protocol-types.js';
|
|
|
14
14
|
*
|
|
15
15
|
* The `definition` argument is returned as-is (no cloning). The schema map
|
|
16
16
|
* is a phantom type parameter — it exists only at compile time to thread
|
|
17
|
-
* type information through to `
|
|
17
|
+
* type information through to `TypedWeb5`.
|
|
18
18
|
*
|
|
19
19
|
* @param definition - A standard `ProtocolDefinition` object.
|
|
20
20
|
* @param _schemaMap - A phantom value (e.g. `{} as MySchemaMap`) that carries
|
|
@@ -29,7 +29,7 @@ import type { SchemaMap, TypedProtocol } from './protocol-types.js';
|
|
|
29
29
|
* });
|
|
30
30
|
*
|
|
31
31
|
* // socialGraph.definition is the raw ProtocolDefinition
|
|
32
|
-
* //
|
|
32
|
+
* // TypedWeb5 infers paths like 'friend' | 'friend/message' and
|
|
33
33
|
* // data types from the schema map.
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
package/dist/types/dwn-api.d.ts
CHANGED
|
@@ -4,14 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CreateGrantParams, CreateRequestParams, DwnMessageParams, DwnPaginationCursor, DwnResponseStatus, FetchPermissionRequestParams, FetchPermissionsParams, Web5Agent } from '@enbox/agent';
|
|
6
6
|
import { DwnInterface } from '@enbox/agent';
|
|
7
|
-
import type { ProtocolDefinition } from '@enbox/dwn-sdk-js';
|
|
8
|
-
import type { SchemaMap, TypedProtocol } from './protocol-types.js';
|
|
9
7
|
import { LiveQuery } from './live-query.js';
|
|
10
8
|
import { PermissionGrant } from './permission-grant.js';
|
|
11
9
|
import { PermissionRequest } from './permission-request.js';
|
|
12
10
|
import { Protocol } from './protocol.js';
|
|
13
11
|
import { Record } from './record.js';
|
|
14
|
-
import { TypedDwnApi } from './typed-dwn-api.js';
|
|
15
12
|
/**
|
|
16
13
|
* Represents the request payload for fetching permission requests from a Decentralized Web Node (DWN).
|
|
17
14
|
*
|
|
@@ -38,9 +35,7 @@ export type FetchGrantsRequest = Omit<FetchPermissionsParams, 'author' | 'target
|
|
|
38
35
|
*
|
|
39
36
|
* This request type is used to specify the configuration options for the protocol.
|
|
40
37
|
*/
|
|
41
|
-
export type ProtocolsConfigureRequest = {
|
|
42
|
-
/** Configuration options for the protocol. */
|
|
43
|
-
message: Omit<DwnMessageParams[DwnInterface.ProtocolsConfigure], 'signer'>;
|
|
38
|
+
export type ProtocolsConfigureRequest = Omit<DwnMessageParams[DwnInterface.ProtocolsConfigure], 'signer'> & {
|
|
44
39
|
/** When true, derives and injects $encryption public keys into the protocol definition. */
|
|
45
40
|
encryption?: boolean;
|
|
46
41
|
};
|
|
@@ -64,11 +59,9 @@ export type ProtocolsConfigureResponse = DwnResponseStatus & {
|
|
|
64
59
|
* target the local DWN. If the `from` property is provided, the query will target the specified
|
|
65
60
|
* remote DWN.
|
|
66
61
|
*/
|
|
67
|
-
export type ProtocolsQueryRequest = {
|
|
62
|
+
export type ProtocolsQueryRequest = Omit<DwnMessageParams[DwnInterface.ProtocolsQuery], 'signer'> & {
|
|
68
63
|
/** Optional DID specifying the remote target DWN tenant to be queried. */
|
|
69
64
|
from?: string;
|
|
70
|
-
/** Query filters and options that influence the results returned. */
|
|
71
|
-
message: Omit<DwnMessageParams[DwnInterface.ProtocolsQuery], 'signer'>;
|
|
72
65
|
};
|
|
73
66
|
/**
|
|
74
67
|
* Wraps the response from a protocols query, including the operation status and the list of
|
|
@@ -78,37 +71,6 @@ export type ProtocolsQueryResponse = DwnResponseStatus & {
|
|
|
78
71
|
/** Array of protocols matching the query. */
|
|
79
72
|
protocols: Protocol[];
|
|
80
73
|
};
|
|
81
|
-
/**
|
|
82
|
-
* Type alias for {@link RecordsWriteRequest}
|
|
83
|
-
*/
|
|
84
|
-
export type RecordsCreateRequest = RecordsWriteRequest;
|
|
85
|
-
/**
|
|
86
|
-
* Type alias for {@link RecordsWriteResponse}
|
|
87
|
-
*/
|
|
88
|
-
export type RecordsCreateResponse = RecordsWriteResponse;
|
|
89
|
-
/**
|
|
90
|
-
* Represents a request to create a new record based on an existing one.
|
|
91
|
-
*
|
|
92
|
-
* This request type allows specifying the new data for the record, along with any additional
|
|
93
|
-
* message parameters required for the write operation.
|
|
94
|
-
*/
|
|
95
|
-
export type RecordsCreateFromRequest = {
|
|
96
|
-
/** The DID of the entity authoring the record. */
|
|
97
|
-
author: string;
|
|
98
|
-
/** The new data for the record. */
|
|
99
|
-
data: unknown;
|
|
100
|
-
/** Optional additional parameters for the record write operation */
|
|
101
|
-
message?: Omit<DwnMessageParams[DwnInterface.RecordsWrite], 'signer'>;
|
|
102
|
-
/** The existing record instance that is being used as a basis for the new record. */
|
|
103
|
-
record: Record;
|
|
104
|
-
/**
|
|
105
|
-
* Controls whether the new record should be auto-encrypted.
|
|
106
|
-
*
|
|
107
|
-
* If omitted, auto-detected from the source record: if the source record was
|
|
108
|
-
* encrypted, the new record is automatically encrypted with a fresh DEK.
|
|
109
|
-
*/
|
|
110
|
-
encryption?: boolean;
|
|
111
|
-
};
|
|
112
74
|
/**
|
|
113
75
|
* Defines a request to delete a record from the Decentralized Web Node (DWN).
|
|
114
76
|
*
|
|
@@ -116,13 +78,11 @@ export type RecordsCreateFromRequest = {
|
|
|
116
78
|
* message parameters for the delete operation. If the `from` property is not provided, the record
|
|
117
79
|
* will be deleted from the local DWN.
|
|
118
80
|
*/
|
|
119
|
-
export type RecordsDeleteRequest = {
|
|
81
|
+
export type RecordsDeleteRequest = Omit<DwnMessageParams[DwnInterface.RecordsDelete], 'signer'> & {
|
|
120
82
|
/** Optional DID specifying the remote target DWN tenant the record will be deleted from. */
|
|
121
83
|
from?: string;
|
|
122
|
-
/**
|
|
84
|
+
/** Protocol URI for permission grant resolution. */
|
|
123
85
|
protocol?: string;
|
|
124
|
-
/** The parameters for the delete operation. */
|
|
125
|
-
message: Omit<DwnMessageParams[DwnInterface.RecordsDelete], 'signer'>;
|
|
126
86
|
};
|
|
127
87
|
/**
|
|
128
88
|
* Encapsulates a request to query records from a Decentralized Web Node (DWN).
|
|
@@ -131,13 +91,9 @@ export type RecordsDeleteRequest = {
|
|
|
131
91
|
* parameters, and optionally the target DWN to query from. If the `from` property is not provided,
|
|
132
92
|
* the query will target the local DWN.
|
|
133
93
|
*/
|
|
134
|
-
export type RecordsQueryRequest = {
|
|
94
|
+
export type RecordsQueryRequest = Omit<DwnMessageParams[DwnInterface.RecordsQuery], 'signer'> & {
|
|
135
95
|
/** Optional DID specifying the remote target DWN tenant to query from and return results. */
|
|
136
96
|
from?: string;
|
|
137
|
-
/** Records must be scoped to a specific protocol */
|
|
138
|
-
protocol?: string;
|
|
139
|
-
/** The parameters for the query operation, detailing the criteria for selecting records. */
|
|
140
|
-
message: Omit<DwnMessageParams[DwnInterface.RecordsQuery], 'signer'>;
|
|
141
97
|
/** When true, automatically decrypts encrypted records in the query results. */
|
|
142
98
|
encryption?: boolean;
|
|
143
99
|
};
|
|
@@ -147,7 +103,7 @@ export type RecordsQueryRequest = {
|
|
|
147
103
|
*/
|
|
148
104
|
export type RecordsQueryResponse = DwnResponseStatus & {
|
|
149
105
|
/** Array of records matching the query. */
|
|
150
|
-
records
|
|
106
|
+
records: Record[];
|
|
151
107
|
/** If there are additional results, the messageCid of the last record will be returned as a pagination cursor. */
|
|
152
108
|
cursor?: DwnPaginationCursor;
|
|
153
109
|
};
|
|
@@ -158,13 +114,11 @@ export type RecordsQueryResponse = DwnResponseStatus & {
|
|
|
158
114
|
* additional parameters for the read operation. It's useful for fetching the details of a single
|
|
159
115
|
* record by its identifier or other criteria.
|
|
160
116
|
*/
|
|
161
|
-
export type RecordsReadRequest = {
|
|
117
|
+
export type RecordsReadRequest = Omit<DwnMessageParams[DwnInterface.RecordsRead], 'signer'> & {
|
|
162
118
|
/** Optional DID specifying the remote target DWN tenant the record will be read from. */
|
|
163
119
|
from?: string;
|
|
164
|
-
/**
|
|
120
|
+
/** Protocol URI for permission grant resolution. */
|
|
165
121
|
protocol?: string;
|
|
166
|
-
/** The parameters for the read operation, detailing the criteria for selecting the record. */
|
|
167
|
-
message: Omit<DwnMessageParams[DwnInterface.RecordsRead], 'signer'>;
|
|
168
122
|
/** When true, automatically decrypts the encrypted record data. */
|
|
169
123
|
encryption?: boolean;
|
|
170
124
|
};
|
|
@@ -183,13 +137,9 @@ export type RecordsReadResponse = DwnResponseStatus & {
|
|
|
183
137
|
* matching records alongside a real-time stream of deduplicated, semantically-
|
|
184
138
|
* typed change events (`create`, `update`, `delete`).
|
|
185
139
|
*/
|
|
186
|
-
export type RecordsSubscribeRequest = {
|
|
140
|
+
export type RecordsSubscribeRequest = Omit<DwnMessageParams[DwnInterface.RecordsSubscribe], 'signer'> & {
|
|
187
141
|
/** Optional DID specifying the remote target DWN tenant to subscribe from. */
|
|
188
142
|
from?: string;
|
|
189
|
-
/** Records must be scoped to a specific protocol. */
|
|
190
|
-
protocol?: string;
|
|
191
|
-
/** The parameters for the subscription operation, detailing the criteria for the subscription filter. */
|
|
192
|
-
message: Omit<DwnMessageParams[DwnInterface.RecordsSubscribe], 'signer'>;
|
|
193
143
|
};
|
|
194
144
|
/** Encapsulates the response from a DWN RecordsSubscribeRequest. */
|
|
195
145
|
export type RecordsSubscribeResponse = DwnResponseStatus & {
|
|
@@ -202,16 +152,10 @@ export type RecordsSubscribeResponse = DwnResponseStatus & {
|
|
|
202
152
|
* This request type allows specifying the data for the new or updated record, along with any
|
|
203
153
|
* additional message parameters required for the write operation, and an optional flag to indicate
|
|
204
154
|
* whether the record should be immediately stored.
|
|
205
|
-
*
|
|
206
|
-
* @param data -
|
|
207
|
-
* @param message - , excluding the signer.
|
|
208
|
-
* @param store -
|
|
209
155
|
*/
|
|
210
|
-
export type RecordsWriteRequest = {
|
|
156
|
+
export type RecordsWriteRequest = Omit<Partial<DwnMessageParams[DwnInterface.RecordsWrite]>, 'signer' | 'data'> & {
|
|
211
157
|
/** The data payload for the record, which can be of any type. */
|
|
212
158
|
data: unknown;
|
|
213
|
-
/** Optional additional parameters for the record write operation. */
|
|
214
|
-
message?: Omit<Partial<DwnMessageParams[DwnInterface.RecordsWrite]>, 'signer'>;
|
|
215
159
|
/**
|
|
216
160
|
* Optional flag indicating whether the record should be immediately stored. If true, the record
|
|
217
161
|
* is persisted in the DWN as part of the write operation. If false, the record is created,
|
|
@@ -238,7 +182,7 @@ export type RecordsWriteResponse = DwnResponseStatus & {
|
|
|
238
182
|
* The `Record` instance representing the record that was successfully written to the
|
|
239
183
|
* DWN as a result of the write operation.
|
|
240
184
|
*/
|
|
241
|
-
record
|
|
185
|
+
record: Record;
|
|
242
186
|
};
|
|
243
187
|
/**
|
|
244
188
|
* Interface to interact with DWN Records and Protocols
|
|
@@ -260,25 +204,6 @@ export declare class DwnApi {
|
|
|
260
204
|
connectedDid: string;
|
|
261
205
|
delegateDid?: string;
|
|
262
206
|
});
|
|
263
|
-
/**
|
|
264
|
-
* Returns a {@link TypedDwnApi} scoped to the given typed protocol.
|
|
265
|
-
*
|
|
266
|
-
* The returned API provides path autocompletion, typed data payloads,
|
|
267
|
-
* and automatically injects the protocol URI and protocolPath into every
|
|
268
|
-
* DWN operation.
|
|
269
|
-
*
|
|
270
|
-
* @param protocol - A typed protocol created via `defineProtocol()`.
|
|
271
|
-
* @returns A `TypedDwnApi` instance bound to the given protocol.
|
|
272
|
-
*
|
|
273
|
-
* @example
|
|
274
|
-
* ```ts
|
|
275
|
-
* const social = dwn.using(SocialGraphProtocol);
|
|
276
|
-
* const { record } = await social.write('friend', {
|
|
277
|
-
* data: { did: 'did:example:alice' },
|
|
278
|
-
* });
|
|
279
|
-
* ```
|
|
280
|
-
*/
|
|
281
|
-
using<D extends ProtocolDefinition, M extends SchemaMap>(protocol: TypedProtocol<D, M>): TypedDwnApi<D, M>;
|
|
282
207
|
/**
|
|
283
208
|
* API to interact with Grants
|
|
284
209
|
*
|
|
@@ -304,11 +229,9 @@ export declare class DwnApi {
|
|
|
304
229
|
query: (request: ProtocolsQueryRequest) => Promise<ProtocolsQueryResponse>;
|
|
305
230
|
};
|
|
306
231
|
/**
|
|
307
|
-
* API to interact with DWN records (e.g., `dwn.records.
|
|
232
|
+
* API to interact with DWN records (e.g., `dwn.records.write()`).
|
|
308
233
|
*/
|
|
309
234
|
get records(): {
|
|
310
|
-
create: (request: RecordsCreateRequest) => Promise<RecordsCreateResponse>;
|
|
311
|
-
createFrom: (request: RecordsCreateFromRequest) => Promise<RecordsWriteResponse>;
|
|
312
235
|
delete: (request: RecordsDeleteRequest) => Promise<DwnResponseStatus>;
|
|
313
236
|
query: (request: RecordsQueryRequest) => Promise<RecordsQueryResponse>;
|
|
314
237
|
read: (request: RecordsReadRequest) => Promise<RecordsReadResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dwn-api.d.ts","sourceRoot":"","sources":["../../src/dwn-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EAEnB,gBAAgB,EAChB,mBAAmB,EAEnB,iBAAiB,EACjB,4BAA4B,EAC5B,sBAAsB,EAEtB,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"dwn-api.d.ts","sourceRoot":"","sources":["../../src/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
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, DwnPaginationCursor, DwnResponseStatus } from '@enbox/agent';
|
|
6
|
+
import type { DateSort, Pagination, ProtocolDefinition, ProtocolsQueryFilter, RecordsFilter } from '@enbox/dwn-sdk-js';
|
|
7
|
+
import { ReadOnlyRecord } from './read-only-record.js';
|
|
8
|
+
/**
|
|
9
|
+
* Request to query public records from a remote DWN.
|
|
10
|
+
*
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
export type ReaderRecordsQueryRequest = {
|
|
14
|
+
/** The DID of the remote DWN to query (required — reader is remote-only). */
|
|
15
|
+
from: string;
|
|
16
|
+
/** Filter criteria for the query. */
|
|
17
|
+
filter: RecordsFilter;
|
|
18
|
+
/** Sort order for results. */
|
|
19
|
+
dateSort?: DateSort;
|
|
20
|
+
/** Pagination options. */
|
|
21
|
+
pagination?: Pagination;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Response from a reader records query.
|
|
25
|
+
*
|
|
26
|
+
* @beta
|
|
27
|
+
*/
|
|
28
|
+
export type ReaderRecordsQueryResponse = DwnResponseStatus & {
|
|
29
|
+
/** Array of read-only records matching the query. */
|
|
30
|
+
records: ReadOnlyRecord[];
|
|
31
|
+
/** Pagination cursor for fetching the next page. */
|
|
32
|
+
cursor?: DwnPaginationCursor;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Request to read a specific public record from a remote DWN.
|
|
36
|
+
*
|
|
37
|
+
* @beta
|
|
38
|
+
*/
|
|
39
|
+
export type ReaderRecordsReadRequest = {
|
|
40
|
+
/** The DID of the remote DWN to read from (required — reader is remote-only). */
|
|
41
|
+
from: string;
|
|
42
|
+
/** Filter to identify the record (typically `{ recordId: '...' }`). */
|
|
43
|
+
filter: RecordsFilter;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Response from a reader records read.
|
|
47
|
+
*
|
|
48
|
+
* @beta
|
|
49
|
+
*/
|
|
50
|
+
export type ReaderRecordsReadResponse = DwnResponseStatus & {
|
|
51
|
+
/** The read-only record, if found. */
|
|
52
|
+
record?: ReadOnlyRecord;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Request to count public records on a remote DWN.
|
|
56
|
+
*
|
|
57
|
+
* @beta
|
|
58
|
+
*/
|
|
59
|
+
export type ReaderRecordsCountRequest = {
|
|
60
|
+
/** The DID of the remote DWN to count records in (required). */
|
|
61
|
+
from: string;
|
|
62
|
+
/** Filter criteria for counting. */
|
|
63
|
+
filter: RecordsFilter;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Response from a reader records count.
|
|
67
|
+
*
|
|
68
|
+
* @beta
|
|
69
|
+
*/
|
|
70
|
+
export type ReaderRecordsCountResponse = DwnResponseStatus & {
|
|
71
|
+
/** The number of matching public records. */
|
|
72
|
+
count?: number;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Request to query published protocols from a remote DWN.
|
|
76
|
+
*
|
|
77
|
+
* @beta
|
|
78
|
+
*/
|
|
79
|
+
export type ReaderProtocolsQueryRequest = {
|
|
80
|
+
/** The DID of the remote DWN to query protocols from (required). */
|
|
81
|
+
from: string;
|
|
82
|
+
/** Optional filter for the protocol query. */
|
|
83
|
+
filter?: ProtocolsQueryFilter;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Response from a reader protocols query.
|
|
87
|
+
*
|
|
88
|
+
* @beta
|
|
89
|
+
*/
|
|
90
|
+
export type ReaderProtocolsQueryResponse = DwnResponseStatus & {
|
|
91
|
+
/** Array of published protocol definitions. */
|
|
92
|
+
protocols: ProtocolDefinition[];
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* A read-only API for querying public data on remote DWNs without any identity or signing keys.
|
|
96
|
+
*
|
|
97
|
+
* This class mirrors the shape of {@link DwnApi}'s `records` and `protocols`
|
|
98
|
+
* namespaces, but restricts to read-path operations and requires a `from` DID
|
|
99
|
+
* on every call (remote-only). All messages are unsigned, so only published
|
|
100
|
+
* records and protocols are accessible.
|
|
101
|
+
*
|
|
102
|
+
* Obtain an instance via {@link Web5.anonymous | `Web5.anonymous()`}.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* const { dwn } = Web5.anonymous();
|
|
107
|
+
*
|
|
108
|
+
* const { records } = await dwn.records.query({
|
|
109
|
+
* from: 'did:dht:alice...',
|
|
110
|
+
* filter: { protocol: 'https://social.example/posts', protocolPath: 'post' },
|
|
111
|
+
* });
|
|
112
|
+
*
|
|
113
|
+
* for (const record of records) {
|
|
114
|
+
* console.log(record.id, await record.data.text());
|
|
115
|
+
* }
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* @beta
|
|
119
|
+
*/
|
|
120
|
+
export declare class DwnReaderApi {
|
|
121
|
+
private _anonymousDwn;
|
|
122
|
+
constructor(anonymousDwn: AnonymousDwnApi);
|
|
123
|
+
/**
|
|
124
|
+
* API to interact with public DWN records (query, read, count).
|
|
125
|
+
*/
|
|
126
|
+
get records(): {
|
|
127
|
+
query: (request: ReaderRecordsQueryRequest) => Promise<ReaderRecordsQueryResponse>;
|
|
128
|
+
read: (request: ReaderRecordsReadRequest) => Promise<ReaderRecordsReadResponse>;
|
|
129
|
+
count: (request: ReaderRecordsCountRequest) => Promise<ReaderRecordsCountResponse>;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* API to query published protocol definitions from remote DWNs.
|
|
133
|
+
*/
|
|
134
|
+
get protocols(): {
|
|
135
|
+
query: (request: ReaderProtocolsQueryRequest) => Promise<ReaderProtocolsQueryResponse>;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=dwn-reader-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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GAAG;IAC3D,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAMF;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,GAAG;IAC7D,+CAA+C;IAC/C,SAAS,EAAE,kBAAkB,EAAE,CAAC;CACjC,CAAC;AAMF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,aAAa,CAAkB;gBAE3B,YAAY,EAAE,eAAe;IAIzC;;OAEG;IACH,IAAI,OAAO,IAAI;QACb,KAAK,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAC;QACnF,IAAI,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAC;QAChF,KAAK,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAC;KAClF,CAiEF;IAED;;OAEG;IACH,IAAI,SAAS,IAAI;QACf,KAAK,EAAE,CAAC,OAAO,EAAE,2BAA2B,KAAK,OAAO,CAAC,4BAA4B,CAAC,CAAC;KACtF,CAkBF;CACF"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -22,15 +22,16 @@
|
|
|
22
22
|
*/
|
|
23
23
|
export * from './define-protocol.js';
|
|
24
24
|
export * from './did-api.js';
|
|
25
|
-
export * from './dwn-api.js';
|
|
25
|
+
export * from './dwn-reader-api.js';
|
|
26
26
|
export * from './grant-revocation.js';
|
|
27
27
|
export * from './live-query.js';
|
|
28
28
|
export * from './permission-grant.js';
|
|
29
29
|
export * from './permission-request.js';
|
|
30
30
|
export * from './protocol.js';
|
|
31
31
|
export * from './protocol-types.js';
|
|
32
|
+
export * from './read-only-record.js';
|
|
32
33
|
export * from './record.js';
|
|
33
|
-
export * from './typed-
|
|
34
|
+
export * from './typed-web5.js';
|
|
34
35
|
export * from './vc-api.js';
|
|
35
36
|
export * from './web5.js';
|
|
36
37
|
import * as utils from './utils.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAE1B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RecordsQueryReplyEntry } from '@enbox/dwn-sdk-js';
|
|
2
1
|
import type { DwnMessageSubscription, PermissionsApi, Web5Agent } from '@enbox/agent';
|
|
2
|
+
import type { PaginationCursor, RecordsQueryReplyEntry } from '@enbox/dwn-sdk-js';
|
|
3
3
|
import { Record } from './record.js';
|
|
4
4
|
/**
|
|
5
5
|
* The type of change that occurred to a record.
|
|
@@ -43,6 +43,8 @@ export type LiveQueryOptions = {
|
|
|
43
43
|
permissionsApi?: PermissionsApi;
|
|
44
44
|
/** The initial snapshot entries from the subscribe reply. */
|
|
45
45
|
initialEntries: RecordsQueryReplyEntry[];
|
|
46
|
+
/** Pagination cursor for fetching the next page of initial results. */
|
|
47
|
+
cursor?: PaginationCursor;
|
|
46
48
|
/** The underlying DWN subscription handle. */
|
|
47
49
|
subscription: DwnMessageSubscription;
|
|
48
50
|
};
|
|
@@ -97,6 +99,16 @@ export type LiveQueryOptions = {
|
|
|
97
99
|
export declare class LiveQuery extends EventTarget {
|
|
98
100
|
/** The initial snapshot of matching records. */
|
|
99
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;
|
|
100
112
|
/** The underlying DWN subscription handle. */
|
|
101
113
|
private _subscription;
|
|
102
114
|
/** Tracks known record states for dedup and change-type classification. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-query.d.ts","sourceRoot":"","sources":["../../src/live-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,
|
|
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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AAE,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 `
|
|
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 `
|
|
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). */
|