@fangorn-network/sdk 2026.9.22-dev → 2026.10.1-9.0-dev
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 +190 -194
- package/lib/cli/cli.d.ts +0 -0
- package/lib/cli/cli.js +177 -201
- package/lib/cli/index.d.ts +3 -91
- package/lib/cli/index.js +5 -2
- package/lib/config.d.ts +358 -117
- package/lib/config.js +43 -23
- package/lib/contracts/app-registry/abi.d.ts +1033 -277
- package/lib/contracts/app-registry/abi.js +1214 -335
- package/lib/contracts/app-registry/index.d.ts +105 -65
- package/lib/contracts/app-registry/index.js +182 -175
- package/lib/contracts/data-registry/abi.d.ts +166 -187
- package/lib/contracts/data-registry/abi.js +207 -237
- package/lib/contracts/data-registry/index.d.ts +4 -151
- package/lib/contracts/data-registry/index.js +5 -279
- package/lib/contracts/index.d.ts +6 -7
- package/lib/contracts/index.js +6 -8
- package/lib/contracts/logs.d.ts +4 -1
- package/lib/contracts/logs.js +9 -2
- package/lib/contracts/membership-registry/abi.d.ts +1145 -0
- package/lib/contracts/membership-registry/abi.js +1333 -0
- package/lib/contracts/membership-registry/index.d.ts +79 -0
- package/lib/contracts/membership-registry/index.js +104 -0
- package/lib/contracts/types.d.ts +3 -1
- package/lib/contracts/types.js +3 -1
- package/lib/contracts/write.d.ts +34 -2
- package/lib/contracts/write.js +48 -1
- package/lib/crypto/encryption.js +4 -4
- package/lib/engine/car.d.ts +2 -2
- package/lib/engine/car.js +10 -5
- package/lib/engine/index.d.ts +99 -143
- package/lib/engine/index.js +156 -295
- package/lib/engine/records.d.ts +110 -0
- package/lib/engine/records.js +165 -0
- package/lib/engine/test-helpers.d.ts +7 -14
- package/lib/engine/test-helpers.js +7 -18
- package/lib/fangorn.d.ts +129 -156
- package/lib/fangorn.js +250 -250
- package/lib/feed.d.ts +7 -4
- package/lib/feed.js +4 -1
- package/lib/index.d.ts +9 -9
- package/lib/index.js +8 -9
- package/lib/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +77 -0
- package/lib/node_modules/@vitest/expect/dist/index.js +1414 -0
- package/lib/node_modules/@vitest/pretty-format/dist/index.js +858 -0
- package/lib/node_modules/@vitest/runner/dist/chunk-tasks.js +51 -0
- package/lib/node_modules/@vitest/runner/dist/index.js +1199 -0
- package/lib/node_modules/@vitest/runner/dist/utils.js +3 -0
- package/lib/node_modules/@vitest/snapshot/dist/index.js +1075 -0
- package/lib/node_modules/@vitest/spy/dist/index.js +353 -0
- package/lib/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +7 -0
- package/lib/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +81 -0
- package/lib/node_modules/@vitest/utils/dist/diff.js +1345 -0
- package/lib/node_modules/@vitest/utils/dist/display.js +534 -0
- package/lib/node_modules/@vitest/utils/dist/error.js +30 -0
- package/lib/node_modules/@vitest/utils/dist/helpers.js +118 -0
- package/lib/node_modules/@vitest/utils/dist/serialize.js +76 -0
- package/lib/node_modules/@vitest/utils/dist/source-map.js +93 -0
- package/lib/node_modules/@vitest/utils/dist/timers.js +36 -0
- package/lib/node_modules/chai/index.js +2874 -0
- package/lib/node_modules/magic-string/dist/magic-string.es.js +939 -0
- package/lib/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +81 -0
- package/lib/node_modules/tinyrainbow/dist/index.js +85 -0
- package/lib/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +5 -0
- package/lib/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +50 -0
- package/lib/node_modules/vitest/dist/chunks/utils.DvEY5TfP.js +44 -0
- package/lib/node_modules/vitest/dist/chunks/vi.2VT5v0um.js +2578 -0
- package/lib/providers/storage/signed-url.d.ts +16 -6
- package/lib/providers/storage/signed-url.js +20 -8
- package/lib/registry.d.ts +116 -0
- package/lib/registry.js +182 -0
- package/lib/test/mem-registry.d.ts +51 -0
- package/lib/test/mem-registry.js +107 -0
- package/lib/test/sdk-suite.d.ts +13 -0
- package/lib/test/sdk-suite.js +226 -0
- package/lib/test/testbed.d.ts +16411 -61
- package/lib/test/testbed.js +190 -84
- package/lib/types/index.d.ts +13 -11
- package/package.json +89 -73
- package/lib/contracts/data-registry/test.d.ts +0 -1
- package/lib/contracts/data-registry/test.js +0 -1
- package/lib/contracts/settlement-registry/abi.d.ts +0 -466
- package/lib/contracts/settlement-registry/abi.js +0 -535
- package/lib/contracts/settlement-registry/index.d.ts +0 -163
- package/lib/contracts/settlement-registry/index.js +0 -264
- package/lib/contracts/subscription-registry/abi.d.ts +0 -179
- package/lib/contracts/subscription-registry/abi.js +0 -195
- package/lib/contracts/subscription-registry/index.d.ts +0 -59
- package/lib/contracts/subscription-registry/index.js +0 -116
- package/lib/engine/graph.d.ts +0 -70
- package/lib/engine/graph.js +0 -73
package/lib/fangorn.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { AppConfig } from "./config.js";
|
|
2
|
-
import {
|
|
2
|
+
import { PreparedTx } from "./contracts/write.js";
|
|
3
3
|
import { AppRegistryClient } from "./contracts/app-registry/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import { SubscriptionRegistryClient } from "./contracts/subscription-registry/index.js";
|
|
4
|
+
import { MembershipRegistryClient } from "./contracts/membership-registry/index.js";
|
|
6
5
|
import "./contracts/index.js";
|
|
6
|
+
import { Registry } from "./registry.js";
|
|
7
7
|
import { MetadataStorage } from "./providers/storage/types.js";
|
|
8
|
-
import { CommitDiff, FangornEngine,
|
|
8
|
+
import { CommitDiff, FangornEngine, RecordInput, RepoContents, RepoDiff, SchemaRegistry } from "./engine/index.js";
|
|
9
9
|
import { FangornCreateOptions, StorageConfig } from "./types/index.js";
|
|
10
10
|
import { AppFeed } from "./feed.js";
|
|
11
|
+
import * as viem0 from "viem";
|
|
11
12
|
import { Hex, WalletClient } from "viem";
|
|
13
|
+
import { CID } from "multiformats/cid";
|
|
12
14
|
|
|
13
15
|
//#region src/fangorn.d.ts
|
|
14
|
-
interface
|
|
15
|
-
|
|
16
|
+
interface RepoChange extends RepoDiff {
|
|
17
|
+
repo: string;
|
|
16
18
|
owner: Hex;
|
|
17
19
|
commitCid: string;
|
|
18
20
|
oldRoot: Hex;
|
|
@@ -20,13 +22,17 @@ interface NamespaceChange extends NamespaceDiff {
|
|
|
20
22
|
blockNumber: bigint;
|
|
21
23
|
}
|
|
22
24
|
interface SubscribeOptions {
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
+
repo: string;
|
|
26
|
+
/**
|
|
27
|
+
* Under an app, the stream follows what the app presents (its members' updates,
|
|
28
|
+
* less exclusions); with no app, every update the publisher commits.
|
|
29
|
+
*/
|
|
30
|
+
/** Publisher whose repo to watch (defaults to this wallet's address). */
|
|
25
31
|
owner?: Hex;
|
|
26
32
|
/**
|
|
27
33
|
* Replay `StateCommitted` events from this block before going live (the resume
|
|
28
34
|
* cursor). Omit to start live from the current chain tip — seed initial state
|
|
29
|
-
* separately via `
|
|
35
|
+
* separately via `inspectRepo`.
|
|
30
36
|
*/
|
|
31
37
|
fromBlock?: bigint;
|
|
32
38
|
/** Poll interval (ms) for the live watch over an HTTP transport. */
|
|
@@ -55,16 +61,19 @@ interface AgentCard {
|
|
|
55
61
|
declare class Fangorn {
|
|
56
62
|
private readonly ctx;
|
|
57
63
|
private _engine;
|
|
58
|
-
private readonly
|
|
64
|
+
private readonly _schemas;
|
|
59
65
|
private _feed;
|
|
66
|
+
private _apps;
|
|
67
|
+
private _membership;
|
|
60
68
|
/**
|
|
61
|
-
* The
|
|
69
|
+
* The repo cache
|
|
62
70
|
* Insertion order = LRU order
|
|
63
71
|
*/
|
|
64
72
|
private readonly nsCache;
|
|
65
73
|
private constructor();
|
|
66
74
|
get engine(): FangornEngine;
|
|
67
|
-
|
|
75
|
+
/** Per-repo record schemas. Unregistered types are accepted as-is. */
|
|
76
|
+
get schemas(): SchemaRegistry;
|
|
68
77
|
/**
|
|
69
78
|
* Static creation of a new Fangorn client
|
|
70
79
|
*
|
|
@@ -73,29 +82,19 @@ declare class Fangorn {
|
|
|
73
82
|
*/
|
|
74
83
|
static create(options: FangornCreateOptions): Fangorn;
|
|
75
84
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
|
-
reset(namespace: string): Promise<void>;
|
|
81
|
-
/**
|
|
82
|
-
* TODO: this isn't really needed here, it's cosmetic
|
|
83
|
-
* instead, what if we moved this to a new paradigm where...
|
|
84
|
-
*
|
|
85
|
-
* each app registers as an ERC-8004 agent with the validation registry
|
|
86
|
-
* pointing to these rules essentially?
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* Register permissive (no required fields) schemas for every tag/relation a
|
|
90
|
-
* staged graph uses, unless the caller has already registered stricter rules
|
|
91
|
-
* via `this.metagraph` directly — schema ids are free-form tags by default.
|
|
85
|
+
* Empties a repo: one commit of the empty state on top of the head. History
|
|
86
|
+
* stays (a head never goes back to zero), and so do the old records: the new
|
|
87
|
+
* head still names them as history.
|
|
92
88
|
*/
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
reset(repo: string): Promise<{
|
|
90
|
+
txHash: viem0.Hash;
|
|
91
|
+
onChainTip: CID;
|
|
92
|
+
}>;
|
|
93
|
+
/** Stage records into one commit on top of `base`. */
|
|
95
94
|
private createCommit;
|
|
96
95
|
/**
|
|
97
|
-
* Allocates a
|
|
98
|
-
* A no-op (no on-chain tx) if the
|
|
96
|
+
* Allocates a repo in the publisher's root map.
|
|
97
|
+
* A no-op (no on-chain tx) if the repo is already initialized.
|
|
99
98
|
*/
|
|
100
99
|
initRepo(repoName: string): Promise<{
|
|
101
100
|
cid: undefined;
|
|
@@ -109,59 +108,45 @@ declare class Fangorn {
|
|
|
109
108
|
alreadyInitialized: false;
|
|
110
109
|
}>;
|
|
111
110
|
/**
|
|
112
|
-
*
|
|
111
|
+
* Put one record and settle it on-chain in a single shot. `id` defaults to
|
|
112
|
+
* a random one, so repeated calls add records; pass an id to update one.
|
|
113
113
|
*/
|
|
114
|
-
upload(repoName: string, payload: unknown,
|
|
114
|
+
upload(repoName: string, payload: unknown, type: string, id?: string): Promise<{
|
|
115
|
+
id: string;
|
|
115
116
|
payloadCid: string;
|
|
116
117
|
commitCid: string;
|
|
117
118
|
txHash: `0x${string}`;
|
|
118
119
|
}>;
|
|
119
120
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* fast-forward tx.
|
|
121
|
+
* Puts many records (and deletes some, by id) under one repo in a
|
|
122
|
+
* single commit, instead of one tx per record. Built in memory and persisted
|
|
123
|
+
* as ONE CAR upload plus one commit block, then settled in a single
|
|
124
|
+
* fast-forward tx. Relations are records too: give them `src`/`dst` `Ref`s.
|
|
124
125
|
*/
|
|
125
|
-
uploadBatch(repoName: string,
|
|
126
|
-
id: string;
|
|
127
|
-
tag: string;
|
|
128
|
-
payload: unknown;
|
|
129
|
-
}[], edges?: {
|
|
130
|
-
rel: string;
|
|
131
|
-
from: string;
|
|
132
|
-
to: string;
|
|
133
|
-
}[]): Promise<{
|
|
126
|
+
uploadBatch(repoName: string, records: RecordInput[], deletes?: string[]): Promise<{
|
|
134
127
|
commitCid: string;
|
|
135
128
|
txHash: `0x${string}`;
|
|
136
|
-
|
|
129
|
+
recordCids: Record<string, string>;
|
|
137
130
|
}>;
|
|
138
131
|
/**
|
|
139
|
-
* Build a new commit (no on-chain tx) that
|
|
140
|
-
* `
|
|
132
|
+
* Build a new commit (no on-chain tx) that puts/deletes records in
|
|
133
|
+
* `repo` on top of `parent` (a commit CID string, or undefined for a
|
|
141
134
|
* root commit). The commit and its CAR are uploaded to storage, so a later
|
|
142
135
|
* `push` — even in a separate process — can settle it.
|
|
143
136
|
*/
|
|
144
137
|
commit(opts: {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
tag: string;
|
|
149
|
-
payload: unknown;
|
|
150
|
-
}[];
|
|
151
|
-
edges?: {
|
|
152
|
-
rel: string;
|
|
153
|
-
from: string;
|
|
154
|
-
to: string;
|
|
155
|
-
}[];
|
|
138
|
+
repo: string;
|
|
139
|
+
records?: RecordInput[];
|
|
140
|
+
deletes?: string[];
|
|
156
141
|
parent?: string;
|
|
157
142
|
message: string;
|
|
158
|
-
/** Snapshot semantics: the staged
|
|
143
|
+
/** Snapshot semantics: the staged records replace the repo's previous contents. */
|
|
159
144
|
replace?: boolean;
|
|
160
145
|
}): Promise<{
|
|
161
146
|
commitCid: string;
|
|
162
|
-
|
|
147
|
+
parent: string | null;
|
|
163
148
|
root: string;
|
|
164
|
-
|
|
149
|
+
recordCids: Record<string, string>;
|
|
165
150
|
}>;
|
|
166
151
|
/**
|
|
167
152
|
* Build a commit on top of `owner`'s current on-chain head and return it
|
|
@@ -179,83 +164,75 @@ declare class Fangorn {
|
|
|
179
164
|
prepareCommit(opts: {
|
|
180
165
|
/** The publisher whose head advances — NOT this client's service wallet. */
|
|
181
166
|
owner: Hex;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
tag: string;
|
|
186
|
-
payload: unknown;
|
|
187
|
-
}[];
|
|
188
|
-
edges?: {
|
|
189
|
-
rel: string;
|
|
190
|
-
from: string;
|
|
191
|
-
to: string;
|
|
192
|
-
}[];
|
|
167
|
+
repo: string;
|
|
168
|
+
records?: RecordInput[];
|
|
169
|
+
deletes?: string[];
|
|
193
170
|
message: string;
|
|
194
|
-
/** Snapshot semantics: the staged
|
|
171
|
+
/** Snapshot semantics: the staged records replace the repo's contents. */
|
|
195
172
|
replace?: boolean;
|
|
196
173
|
}): Promise<{
|
|
197
174
|
commitCid: string;
|
|
198
175
|
oldRoot: Hex;
|
|
199
176
|
newRoot: Hex;
|
|
200
177
|
staged: {
|
|
201
|
-
|
|
202
|
-
|
|
178
|
+
records: number;
|
|
179
|
+
deletes: number;
|
|
203
180
|
};
|
|
204
181
|
tx: PreparedTx;
|
|
205
|
-
|
|
182
|
+
recordCids: Record<string, string>;
|
|
206
183
|
}>;
|
|
207
184
|
/**
|
|
208
|
-
* Settle a local commit as the on-chain head of `
|
|
209
|
-
*
|
|
210
|
-
*
|
|
185
|
+
* Settle a local commit as the on-chain head of `repo`. Its parent must be
|
|
186
|
+
* the current head (see `FangornEngine.pushCommit`). Each repo has its own
|
|
187
|
+
* timeline, so pushes to different repos never contend.
|
|
211
188
|
*/
|
|
212
|
-
push(
|
|
213
|
-
force?: boolean;
|
|
214
|
-
}): Promise<{
|
|
189
|
+
push(repo: string, commitCid: string): Promise<{
|
|
215
190
|
txHash: string;
|
|
216
191
|
onChainTip: string;
|
|
217
192
|
}>;
|
|
218
|
-
/** The owner's current on-chain tip for a
|
|
219
|
-
onChainTip(owner: Hex,
|
|
193
|
+
/** The owner's current on-chain tip for a repo, or null if they have none. */
|
|
194
|
+
onChainTip(owner: Hex, repo: string): Promise<string | null>;
|
|
220
195
|
/**
|
|
221
|
-
* A publisher's
|
|
196
|
+
* A publisher's repo as this client presents it, cached against its tip:
|
|
197
|
+
* the publisher's latest head, or, under an app, nothing unless the app
|
|
198
|
+
* presents the publisher (provides its storage) and excludes neither it nor
|
|
199
|
+
* the repo.
|
|
222
200
|
*
|
|
223
|
-
* Reading a
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
201
|
+
* Reading a repo walks its whole record tree from the root. The tip is one
|
|
202
|
+
* cheap contract read and only moves on publish, so it doubles as the cache
|
|
203
|
+
* key: no TTL to tune, no invalidation to remember after a settle, and never
|
|
204
|
+
* stale.
|
|
227
205
|
*
|
|
228
|
-
* LRU-bounded so an always-on process can't accumulate every
|
|
206
|
+
* LRU-bounded so an always-on process can't accumulate every repo it
|
|
229
207
|
* ever touched. The durable copy is on-chain — an evicted entry re-walks.
|
|
230
208
|
* ponytail: fixed entry count, not byte-aware; switch to a size budget if a
|
|
231
|
-
* few huge
|
|
209
|
+
* few huge repos blow memory before the count cap bites.
|
|
232
210
|
*/
|
|
233
|
-
|
|
211
|
+
readRepo(owner: Hex, repo: string): Promise<{
|
|
234
212
|
tip: string | null;
|
|
235
|
-
contents:
|
|
213
|
+
contents: RepoContents;
|
|
236
214
|
}>;
|
|
215
|
+
/** The commit this client presents of a repo, or null for none (see `readRepo`). */
|
|
216
|
+
private presentedTip;
|
|
217
|
+
/** Does `app` present `ref`: it presents the publisher, and excludes neither it nor the repo? */
|
|
218
|
+
private presentsRepo;
|
|
237
219
|
/**
|
|
238
|
-
* Every (publisher,
|
|
239
|
-
*
|
|
220
|
+
* Every (publisher, repo) this client's app presents, at its latest head, less
|
|
221
|
+
* what it excludes — the app's directory, from ONE `getLogs` over the update
|
|
222
|
+
* log, kept to the publishers the app presents.
|
|
240
223
|
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
* Namespaces come back as `subspaceId` (the hash), not the name, because the
|
|
247
|
-
* event never carries the name — recovering it costs one content fetch per
|
|
248
|
-
* entry. Pass `namespace` when you know the name you're after (the usual
|
|
249
|
-
* case: an app with one well-known namespace) and the filter is applied
|
|
250
|
-
* on-chain instead.
|
|
224
|
+
* ponytail: reads every publisher's updates and drops non-members, so it costs
|
|
225
|
+
* what the network writes, not what the app holds. Filter on-chain by the
|
|
226
|
+
* app's members (a `publisher` topic list) once that is too slow.
|
|
227
|
+
* Narrow it with `repo` (every publisher's `docs`) or `owner`, filtered on-chain.
|
|
251
228
|
*/
|
|
252
|
-
|
|
253
|
-
|
|
229
|
+
appRepos(opts?: {
|
|
230
|
+
repo?: string;
|
|
254
231
|
owner?: Hex;
|
|
255
232
|
fromBlock?: bigint;
|
|
256
233
|
}): Promise<{
|
|
257
234
|
owner: Hex;
|
|
258
|
-
|
|
235
|
+
repo: string;
|
|
259
236
|
root: Hex;
|
|
260
237
|
blockNumber: bigint;
|
|
261
238
|
}[]>;
|
|
@@ -274,7 +251,7 @@ declare class Fangorn {
|
|
|
274
251
|
card: AgentCard;
|
|
275
252
|
appId: Hex;
|
|
276
253
|
fromBlock: bigint;
|
|
277
|
-
|
|
254
|
+
repos: string[];
|
|
278
255
|
}>;
|
|
279
256
|
/**
|
|
280
257
|
* The app's commit stream as ONE shared, ref-counted subscription (see
|
|
@@ -287,80 +264,76 @@ declare class Fangorn {
|
|
|
287
264
|
/** Walk commit history from `head` (newest first). */
|
|
288
265
|
log(head: string, max?: number): AsyncGenerator<{
|
|
289
266
|
cid: string;
|
|
290
|
-
|
|
291
|
-
|
|
267
|
+
parent: string | null;
|
|
268
|
+
epoch: number;
|
|
292
269
|
message: string;
|
|
293
270
|
root: string;
|
|
294
271
|
}>;
|
|
295
|
-
/** Show a commit and what it changed vs. its
|
|
272
|
+
/** Show a commit and what it changed vs. its parent. */
|
|
296
273
|
show(commitCid: string): Promise<CommitDiff>;
|
|
297
274
|
/**
|
|
298
|
-
* Lists every
|
|
275
|
+
* Lists every record currently committed under a repo, resolved
|
|
299
276
|
* from the publisher's on-chain root — useful for verifying what actually
|
|
300
277
|
* made it into the repository, as opposed to what a given call staged.
|
|
301
278
|
*/
|
|
302
|
-
|
|
279
|
+
inspectRepo(repoName: string): Promise<RepoContents>;
|
|
303
280
|
/**
|
|
304
|
-
* Stream changes to one publisher's
|
|
281
|
+
* Stream changes to one publisher's repo. Optionally replays from
|
|
305
282
|
* `fromBlock` first (resume cursor), then watches live until the `signal`
|
|
306
283
|
* aborts. Each yielded change carries `blockNumber` — persist it to resume
|
|
307
284
|
* exactly where you left off.
|
|
308
285
|
*/
|
|
309
|
-
subscribe(opts: SubscribeOptions): AsyncGenerator<
|
|
286
|
+
subscribe(opts: SubscribeOptions): AsyncGenerator<RepoChange>;
|
|
310
287
|
/**
|
|
311
|
-
* Stream changes across the *whole app* — every
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
288
|
+
* Stream changes across the *whole app* — every repo of every publisher it
|
|
289
|
+
* presents, less its exclusions. Narrow it with `repo` (every publisher's `docs`) or
|
|
290
|
+
* `owner` (one publisher's whole app footprint). With no app, every update by
|
|
291
|
+
* anyone: a firehose.
|
|
315
292
|
*/
|
|
316
|
-
subscribeApp(opts?: Omit<SubscribeOptions, "
|
|
317
|
-
|
|
318
|
-
}): AsyncGenerator<
|
|
293
|
+
subscribeApp(opts?: Omit<SubscribeOptions, "repo"> & {
|
|
294
|
+
repo?: string;
|
|
295
|
+
}): AsyncGenerator<RepoChange>;
|
|
319
296
|
/** Shared catch-up-then-live loop behind `subscribe` and `subscribeApp`. */
|
|
320
297
|
private streamCommits;
|
|
321
298
|
/**
|
|
322
|
-
* Resolve a
|
|
323
|
-
*
|
|
299
|
+
* Resolve a log entry into a repo change, or null if nothing presented
|
|
300
|
+
* changed: the repo slice was untouched, or the app excludes it.
|
|
301
|
+
*
|
|
302
|
+
* The commit itself names its repo, which must be the one the entry was
|
|
303
|
+
* logged under, or the publisher settled a commit for one repo against
|
|
304
|
+
* another's timeline.
|
|
324
305
|
*
|
|
325
|
-
* The
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
306
|
+
* The diff runs from the last head this stream saw for the repo, not from
|
|
307
|
+
* the entry's parent. If an entry was dropped (an RPC that left out a log),
|
|
308
|
+
* the two differ, and diffing from the entry's parent would skip what the
|
|
309
|
+
* dropped entry changed.
|
|
329
310
|
*/
|
|
330
|
-
private
|
|
311
|
+
private toRepoChange;
|
|
331
312
|
getConfig(): AppConfig;
|
|
332
|
-
|
|
313
|
+
/** Heads, membership, exclusions and logs: the registry of WHITEPAPER_1 §3.2. */
|
|
314
|
+
getRegistry(): Registry;
|
|
333
315
|
/**
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* `commit()`, or the commit reverts `NotRegisteredForApp`.
|
|
316
|
+
* App management: claiming an app (its storage subscription), terms,
|
|
317
|
+
* invitations and membership, the agent card, and the protocol admin's powers.
|
|
318
|
+
* The owner accepts a publisher (`acceptPublisher()`); from then its uploads
|
|
319
|
+
* bill the app's subscription, and the app presents its repos.
|
|
339
320
|
*/
|
|
340
321
|
getAppRegistry(): AppRegistryClient;
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
getSubscriptionRegistry(): SubscriptionRegistryClient;
|
|
346
|
-
/**
|
|
347
|
-
* The consumer-side pay-then-read rail. Resources are keyed by owner+uid, so
|
|
348
|
-
* this client is app-agnostic too.
|
|
349
|
-
*/
|
|
350
|
-
getSettlementRegistry(): SettlementRegistryClient;
|
|
351
|
-
/** The app (global namespace) this client publishes and reads under. */
|
|
352
|
-
getAppId(): Hex;
|
|
322
|
+
getMembershipRegistry(): MembershipRegistryClient;
|
|
323
|
+
/** The app this client reads and publishes under, or undefined for none. */
|
|
324
|
+
getAppId(): Hex | undefined;
|
|
325
|
+
private requireApp;
|
|
353
326
|
/**
|
|
354
327
|
* Point this client at a different app — by name (`"my-app"`) or by app id —
|
|
355
|
-
* without rebuilding it.
|
|
356
|
-
*
|
|
328
|
+
* or at none, without rebuilding it. Every read, publish and subscription
|
|
329
|
+
* after this call is in the new context.
|
|
357
330
|
*
|
|
358
|
-
*
|
|
331
|
+
* Repo reads are dropped from the cache (its keys are app-agnostic) and
|
|
359
332
|
* the shared `appFeed` is released: a feed watches one app's commit stream, so
|
|
360
333
|
* the next `appFeed()` opens a fresh subscription. Generators already running
|
|
361
334
|
* from `subscribe`/`subscribeApp` keep their original filter until aborted.
|
|
362
335
|
*/
|
|
363
|
-
setAppId(nameOrId: string): void;
|
|
336
|
+
setAppId(nameOrId: string | undefined): void;
|
|
364
337
|
getStorage(): MetadataStorage;
|
|
365
338
|
/**
|
|
366
339
|
* Swap the storage backend at runtime — e.g. move from access-worker signed
|
|
@@ -372,4 +345,4 @@ declare class Fangorn {
|
|
|
372
345
|
getAddress(): Hex;
|
|
373
346
|
}
|
|
374
347
|
//#endregion
|
|
375
|
-
export { AgentCard, FANGORN_APP_EXTENSION, Fangorn,
|
|
348
|
+
export { AgentCard, FANGORN_APP_EXTENSION, Fangorn, RepoChange, SubscribeOptions };
|