@ariestools/aries-dapp-core 0.1.7 → 0.1.9
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 +326 -32
- package/dist/bin/dappServer.mjs +685 -104
- package/dist/node/DappActor.d.ts +28 -7
- package/dist/node/DappActor.d.ts.map +1 -1
- package/dist/node/actor/AbstractActor.d.ts +13 -8
- package/dist/node/actor/AbstractActor.d.ts.map +1 -1
- package/dist/node/actor/types.d.ts +7 -0
- package/dist/node/actor/types.d.ts.map +1 -1
- package/dist/node/bin/dappServer.d.ts +11 -4
- package/dist/node/bin/dappServer.d.ts.map +1 -1
- package/dist/node/bin/loadReducer.d.ts +17 -0
- package/dist/node/bin/loadReducer.d.ts.map +1 -0
- package/dist/node/boot/bootDappActors.d.ts +12 -1
- package/dist/node/boot/bootDappActors.d.ts.map +1 -1
- package/dist/node/consumer/api.d.ts +56 -0
- package/dist/node/consumer/api.d.ts.map +1 -0
- package/dist/node/consumer/hash.d.ts +6 -0
- package/dist/node/consumer/hash.d.ts.map +1 -0
- package/dist/node/consumer/parse.d.ts +18 -0
- package/dist/node/consumer/parse.d.ts.map +1 -0
- package/dist/node/consumer.d.ts +9 -0
- package/dist/node/consumer.d.ts.map +1 -0
- package/dist/node/consumer.mjs +330 -0
- package/dist/node/consumer.mjs.map +7 -0
- package/dist/node/examples/productionComposition.d.ts +118 -0
- package/dist/node/examples/productionComposition.d.ts.map +1 -0
- package/dist/node/index.d.ts +25 -3
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.mjs +1730 -68
- package/dist/node/index.mjs.map +4 -4
- package/dist/node/locator/createDappLocator.d.ts +32 -5
- package/dist/node/locator/createDappLocator.d.ts.map +1 -1
- package/dist/node/providers/DappBucketStore.d.ts +26 -21
- package/dist/node/providers/DappBucketStore.d.ts.map +1 -1
- package/dist/node/providers/capabilities.d.ts +49 -0
- package/dist/node/providers/capabilities.d.ts.map +1 -0
- package/dist/node/providers/errors.d.ts +11 -0
- package/dist/node/providers/errors.d.ts.map +1 -0
- package/dist/node/providers/hashBytes.d.ts +3 -0
- package/dist/node/providers/hashBytes.d.ts.map +1 -0
- package/dist/node/providers/joinKey.d.ts +11 -0
- package/dist/node/providers/joinKey.d.ts.map +1 -0
- package/dist/node/providers/memoryBucketStore.d.ts +14 -0
- package/dist/node/providers/memoryBucketStore.d.ts.map +1 -0
- package/dist/node/providers/types.d.ts +99 -0
- package/dist/node/providers/types.d.ts.map +1 -0
- package/dist/node/publication/canonicalHead.d.ts +7 -0
- package/dist/node/publication/canonicalHead.d.ts.map +1 -0
- package/dist/node/publication/commitHead.d.ts +9 -0
- package/dist/node/publication/commitHead.d.ts.map +1 -0
- package/dist/node/publication/constants.d.ts +27 -0
- package/dist/node/publication/constants.d.ts.map +1 -0
- package/dist/node/publication/gc.d.ts +42 -0
- package/dist/node/publication/gc.d.ts.map +1 -0
- package/dist/node/publication/incremental.d.ts +83 -0
- package/dist/node/publication/incremental.d.ts.map +1 -0
- package/dist/node/publication/publishGeneration.d.ts +18 -0
- package/dist/node/publication/publishGeneration.d.ts.map +1 -0
- package/dist/node/publication/putCreateOnly.d.ts +11 -0
- package/dist/node/publication/putCreateOnly.d.ts.map +1 -0
- package/dist/node/publication/releases.d.ts +49 -0
- package/dist/node/publication/releases.d.ts.map +1 -0
- package/dist/node/publication/safety.d.ts +55 -0
- package/dist/node/publication/safety.d.ts.map +1 -0
- package/dist/node/publication/shard.d.ts +7 -0
- package/dist/node/publication/shard.d.ts.map +1 -0
- package/dist/node/publication/status.d.ts +27 -0
- package/dist/node/publication/status.d.ts.map +1 -0
- package/dist/node/publication/statusPatch.d.ts +10 -0
- package/dist/node/publication/statusPatch.d.ts.map +1 -0
- package/dist/node/publication/types.d.ts +138 -0
- package/dist/node/publication/types.d.ts.map +1 -0
- package/dist/node/publication/writeGenerationObjects.d.ts +5 -0
- package/dist/node/publication/writeGenerationObjects.d.ts.map +1 -0
- package/dist/node/reducer/DappReducer.d.ts +37 -14
- package/dist/node/reducer/DappReducer.d.ts.map +1 -1
- package/examples/countFactsReducer.mjs +96 -0
- package/package.json +16 -8
package/dist/node/DappActor.d.ts
CHANGED
|
@@ -1,26 +1,47 @@
|
|
|
1
1
|
import { AbstractActor } from './actor/AbstractActor.ts';
|
|
2
2
|
import type { ActorParams } from './actor/types.ts';
|
|
3
|
-
import type {
|
|
3
|
+
import type { DappObjectReader, DappObjectWriter } from './providers/capabilities.ts';
|
|
4
4
|
import type { DappReducer } from './reducer/DappReducer.ts';
|
|
5
5
|
export interface DappActorParams extends ActorParams {
|
|
6
6
|
/** Delay before the first reduce pass. Defaults to 2000ms. */
|
|
7
7
|
firstRunDelayMs?: number;
|
|
8
|
+
/**
|
|
9
|
+
* When set, after this many consecutive reduce failures the actor stops so a
|
|
10
|
+
* supervisor can restart the process.
|
|
11
|
+
*/
|
|
12
|
+
maxConsecutiveFailures?: number;
|
|
13
|
+
/**
|
|
14
|
+
* When true (default), publish durable indexer status to the state store
|
|
15
|
+
* after each reduce pass (success or failure).
|
|
16
|
+
*/
|
|
17
|
+
publishStatus?: boolean;
|
|
8
18
|
reduceIntervalMs?: number;
|
|
9
19
|
reducer: DappReducer;
|
|
10
20
|
}
|
|
11
21
|
/**
|
|
12
22
|
* The stock dapp actor: resolves the three bucket stores from the shared
|
|
13
23
|
* locator, then drives its reducer on an interval to keep `state` and `index`
|
|
14
|
-
* derived from
|
|
15
|
-
* one locator; this is the default single-reducer instance
|
|
24
|
+
* derived from authoritative input. Multiple actors (each with its own
|
|
25
|
+
* reducer) can share one locator; this is the default single-reducer instance
|
|
26
|
+
* the local daemon boots.
|
|
16
27
|
*/
|
|
17
28
|
export declare class DappActor extends AbstractActor<DappActorParams> {
|
|
18
29
|
static readonly dependencies: readonly ["DappDataStore", "DappStateStore", "DappIndexStore"];
|
|
19
|
-
protected _data:
|
|
20
|
-
protected _index:
|
|
21
|
-
protected _state:
|
|
30
|
+
protected _data: DappObjectReader;
|
|
31
|
+
protected _index: DappObjectWriter;
|
|
32
|
+
protected _state: DappObjectWriter;
|
|
33
|
+
private _consecutiveFailures;
|
|
34
|
+
private readonly _firstPass;
|
|
35
|
+
private _firstPassSettled;
|
|
36
|
+
/** Consecutive reduce failures since the last success. */
|
|
37
|
+
get consecutiveFailures(): number;
|
|
22
38
|
createHandler(): Promise<void>;
|
|
23
|
-
|
|
39
|
+
readyHandler(): Promise<void>;
|
|
40
|
+
startHandler(): Promise<void>;
|
|
41
|
+
stopHandler(): Promise<void>;
|
|
42
|
+
private publishStatusFromProgress;
|
|
24
43
|
private runReducePass;
|
|
44
|
+
private safePublishStatus;
|
|
45
|
+
private settleFirstPass;
|
|
25
46
|
}
|
|
26
47
|
//# sourceMappingURL=DappActor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DappActor.d.ts","sourceRoot":"","sources":["../../src/DappActor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"DappActor.d.ts","sourceRoot":"","sources":["../../src/DappActor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AASrF,OAAO,KAAK,EAAsB,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAE/E,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,OAAO,EAAE,WAAW,CAAA;CACrB;AAmCD;;;;;;GAMG;AACH,qBACa,SAAU,SAAQ,aAAa,CAAC,eAAe,CAAC;IAC3D,MAAM,CAAC,QAAQ,CAAC,YAAY,iEAIlB;IAEV,SAAS,CAAC,KAAK,EAAG,gBAAgB,CAAA;IAClC,SAAS,CAAC,MAAM,EAAG,gBAAgB,CAAA;IACnC,SAAS,CAAC,MAAM,EAAG,gBAAgB,CAAA;IAEnC,OAAO,CAAC,oBAAoB,CAAI;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAyB;IACpD,OAAO,CAAC,iBAAiB,CAAQ;IAEjC,0DAA0D;IAC1D,IAAI,mBAAmB,IAAI,MAAM,CAEhC;IAEc,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAS9B,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAa7B,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;YAK7B,yBAAyB;YAkBzB,aAAa;YAsCb,iBAAiB;IAW/B,OAAO,CAAC,eAAe;CAMxB"}
|
|
@@ -17,6 +17,7 @@ import type { ActorParams, DappContext, DappProviderLocator, ReadyState } from '
|
|
|
17
17
|
export declare abstract class AbstractActor<TParams extends ActorParams = ActorParams> extends AbstractCreatable<TParams> {
|
|
18
18
|
protected readonly _intervals: Map<string, NodeJS.Timeout>;
|
|
19
19
|
protected readonly _timeouts: Map<string, NodeJS.Timeout>;
|
|
20
|
+
private _abortController;
|
|
20
21
|
private _idLogger?;
|
|
21
22
|
private readonly _inFlight;
|
|
22
23
|
private readonly _readyDeferred;
|
|
@@ -27,22 +28,26 @@ export declare abstract class AbstractActor<TParams extends ActorParams = ActorP
|
|
|
27
28
|
get readyState(): ReadyState;
|
|
28
29
|
protected get context(): DappContext;
|
|
29
30
|
protected get locator(): DappProviderLocator;
|
|
31
|
+
/** Abort signal cancelled when the actor stops (or is replaced on restart). */
|
|
32
|
+
protected get signal(): AbortSignal;
|
|
30
33
|
static paramsHandler<T extends CreatableInstance>(params?: Partial<T['params']>): Promise<T['params']>;
|
|
34
|
+
/** Override to prove the actor can do useful work. Default: no-op. */
|
|
35
|
+
readyHandler(): Promise<void>;
|
|
31
36
|
/**
|
|
32
|
-
* Register a recurring task. The
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
37
|
+
* Register a recurring task. The first invocation fires after `dueTimeMs`
|
|
38
|
+
* (the documented first-run delay); subsequent invocations fire every
|
|
39
|
+
* `periodMs` while the actor is `started`. A run is skipped if the previous
|
|
40
|
+
* one is still in flight, so a slow pass can never stack on top of itself.
|
|
41
|
+
* Must be called from `startHandler` (guards on `starting` status).
|
|
36
42
|
*/
|
|
37
43
|
registerTimer(timerName: string, callback: () => Promise<void>, dueTimeMs: number, periodMs: number): void;
|
|
38
44
|
/**
|
|
39
|
-
* Run the warm-pass once.
|
|
40
|
-
*
|
|
45
|
+
* Run the warm-pass once. The standard boot path invokes this after
|
|
46
|
+
* `start()` so readiness either resolves or rejects.
|
|
41
47
|
*/
|
|
42
48
|
runReadyHandler(): Promise<void>;
|
|
49
|
+
startHandler(): Promise<void>;
|
|
43
50
|
stopHandler(): Promise<void>;
|
|
44
51
|
whenReady(): Promise<void>;
|
|
45
|
-
/** Override to prove the actor can do useful work. Default: no-op. */
|
|
46
|
-
protected readyHandler(): Promise<void>;
|
|
47
52
|
}
|
|
48
53
|
//# sourceMappingURL=AbstractActor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractActor.d.ts","sourceRoot":"","sources":["../../../src/actor/AbstractActor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EACL,iBAAiB,EAClB,MAAM,iBAAiB,CAAA;AAExB,OAAO,KAAK,EACV,WAAW,EAAE,WAAW,EA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sEAAsE;IAChE,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC;;;;;;OAMG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAuC1G;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAevB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ7B,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBrC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAGjC"}
|
|
@@ -18,6 +18,8 @@ export interface DappContext {
|
|
|
18
18
|
*/
|
|
19
19
|
export interface DappProviderLocator {
|
|
20
20
|
readonly context: DappContext;
|
|
21
|
+
/** Release owned resources (e.g. an S3 client constructed by the locator). */
|
|
22
|
+
destroy(): void;
|
|
21
23
|
getInstance<T>(moniker: DappMoniker): Promise<T>;
|
|
22
24
|
has(moniker: DappMoniker): boolean;
|
|
23
25
|
register(moniker: DappMoniker, instance: unknown): void;
|
|
@@ -26,5 +28,10 @@ export interface DappProviderLocator {
|
|
|
26
28
|
/** Base params every dapp actor takes: the shared, process-wide locator. */
|
|
27
29
|
export interface ActorParams extends CreatableParams {
|
|
28
30
|
locator: DappProviderLocator;
|
|
31
|
+
/**
|
|
32
|
+
* Max time to wait for in-flight timer work on stop after aborting the
|
|
33
|
+
* signal. When omitted, stop waits until in-flight work settles.
|
|
34
|
+
*/
|
|
35
|
+
shutdownTimeoutMs?: number;
|
|
29
36
|
}
|
|
30
37
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/actor/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAE9D,6EAA6E;AA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AC,CAAA;IAChD,GAAG,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAA;IAClC,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAA;IACvD,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAA;CAChE;AAED,4EAA4E;AAC5E,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD,OAAO,EAAE,mBAAmB,CAAA;IAC5B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Composed dapp daemon: boots the
|
|
4
|
-
* `@ariestools/aries-dapp-serve`) and, in
|
|
5
|
-
* process-wide locator plus
|
|
6
|
-
*
|
|
3
|
+
* **Local development only.** Composed dapp daemon: boots the embedded
|
|
4
|
+
* S3-compatible storage server (from `@ariestools/aries-dapp-serve`) and, in
|
|
5
|
+
* the same process, a shared process-wide locator plus DappActor(s).
|
|
6
|
+
* Spawned by `aries dapp up`.
|
|
7
|
+
*
|
|
8
|
+
* Optional `DAPP_REDUCER` loads a project-owned ESM reducer (`.mjs` path or
|
|
9
|
+
* package export). Without it, `noopReducer` runs so the spine still works.
|
|
10
|
+
*
|
|
11
|
+
* Production indexers should **not** use this binary. Compose `dapp-core` from
|
|
12
|
+
* a project-owned entrypoint with real R2/S3 bindings and a real reducer —
|
|
13
|
+
* see the package README and `examples/`.
|
|
7
14
|
*/
|
|
8
15
|
export {};
|
|
9
16
|
//# sourceMappingURL=dappServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dappServer.d.ts","sourceRoot":"","sources":["../../../src/bin/dappServer.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"dappServer.d.ts","sourceRoot":"","sources":["../../../src/bin/dappServer.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DappReducer } from '../reducer/DappReducer.ts';
|
|
2
|
+
export interface LoadReducerOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Named export to prefer when the module has no default export.
|
|
5
|
+
* Defaults to trying `reducer`, then `default`.
|
|
6
|
+
*/
|
|
7
|
+
exportName?: string;
|
|
8
|
+
/** Absolute or relative path to a `.mjs` file, or a resolvable package export. */
|
|
9
|
+
spec: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Dynamically load a project-owned reducer for the local dapp daemon.
|
|
13
|
+
* Supports filesystem `.mjs`/`.js` paths and package export strings.
|
|
14
|
+
* TypeScript sources are not supported — build to ESM first.
|
|
15
|
+
*/
|
|
16
|
+
export declare function loadReducer(options: LoadReducerOptions): Promise<DappReducer>;
|
|
17
|
+
//# sourceMappingURL=loadReducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadReducer.d.ts","sourceRoot":"","sources":["../../../src/bin/loadReducer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAI5D,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kFAAkF;IAClF,IAAI,EAAE,MAAM,CAAA;CACb;AA6DD;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAOnF"}
|
|
@@ -2,13 +2,24 @@ import type { DappProviderLocator } from '../actor/types.ts';
|
|
|
2
2
|
import { DappActor } from '../DappActor.ts';
|
|
3
3
|
import type { DappReducer } from '../reducer/DappReducer.ts';
|
|
4
4
|
export interface DappActorSpec {
|
|
5
|
+
firstRunDelayMs?: number;
|
|
6
|
+
maxConsecutiveFailures?: number;
|
|
5
7
|
name: string;
|
|
8
|
+
publishStatus?: boolean;
|
|
6
9
|
reduceIntervalMs?: number;
|
|
7
10
|
reducer: DappReducer;
|
|
11
|
+
/**
|
|
12
|
+
* When true (default), run readiness after start so boot completes only when
|
|
13
|
+
* the first reduce pass succeeds (or fails under the failure policy).
|
|
14
|
+
*/
|
|
15
|
+
runReady?: boolean;
|
|
16
|
+
shutdownTimeoutMs?: number;
|
|
8
17
|
}
|
|
9
18
|
/**
|
|
10
19
|
* Creates and starts one {@link DappActor} per spec, all sharing the single
|
|
11
|
-
* process-wide locator.
|
|
20
|
+
* process-wide locator. On partial failure, actors already started are stopped
|
|
21
|
+
* before the error is rethrown. Returns them so the caller can stop them on
|
|
22
|
+
* shutdown.
|
|
12
23
|
*/
|
|
13
24
|
export declare function bootDappActors(locator: DappProviderLocator, specs: readonly DappActorSpec[]): Promise<DappActor[]>;
|
|
14
25
|
//# sourceMappingURL=bootDappActors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootDappActors.d.ts","sourceRoot":"","sources":["../../../src/boot/bootDappActors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,OAAO,EAAE,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"bootDappActors.d.ts","sourceRoot":"","sources":["../../../src/boot/bootDappActors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,OAAO,EAAE,WAAW,CAAA;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,mBAAmB,EAC5B,KAAK,EAAE,SAAS,aAAa,EAAE,GAC9B,OAAO,CAAC,SAAS,EAAE,CAAC,CAiCtB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { GenerationManifest, HeadManifest, IndexerStatus } from '../publication/types.ts';
|
|
2
|
+
import { hashBytesAsync } from './hash.ts';
|
|
3
|
+
import { parseGenerationManifest, parseHead, parseIndexerStatus, parseMapRoot, parseMapShard } from './parse.ts';
|
|
4
|
+
export type FetchLike = (input: string, init?: {
|
|
5
|
+
method?: string;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
ok: boolean;
|
|
8
|
+
status: number;
|
|
9
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
10
|
+
json(): Promise<unknown>;
|
|
11
|
+
text(): Promise<string>;
|
|
12
|
+
}>;
|
|
13
|
+
export interface PublicBases {
|
|
14
|
+
index?: string;
|
|
15
|
+
state: string;
|
|
16
|
+
}
|
|
17
|
+
export interface VerifyPublishedViewResult {
|
|
18
|
+
head: HeadManifest;
|
|
19
|
+
layout: 'full' | 'incremental-cas';
|
|
20
|
+
manifest?: GenerationManifest;
|
|
21
|
+
rootShards?: Record<string, string>;
|
|
22
|
+
source?: GenerationManifest['source'];
|
|
23
|
+
status?: IndexerStatus;
|
|
24
|
+
}
|
|
25
|
+
export interface ResolveObjectResult {
|
|
26
|
+
body: Uint8Array;
|
|
27
|
+
contentType?: string;
|
|
28
|
+
hash: string;
|
|
29
|
+
logicalKey: string;
|
|
30
|
+
publicUrl: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function shardIdForKey(logicalKey: string, hexChars?: number): string;
|
|
33
|
+
export { hashBytesAsync, parseGenerationManifest, parseHead, parseIndexerStatus, parseMapRoot, parseMapShard, };
|
|
34
|
+
/**
|
|
35
|
+
* Fetch head (+ optional status), verify manifest/root integrity, optional
|
|
36
|
+
* signature check. Does not download the full object set.
|
|
37
|
+
*/
|
|
38
|
+
export declare function verifyPublishedView(options: {
|
|
39
|
+
bases: PublicBases;
|
|
40
|
+
fetch: FetchLike;
|
|
41
|
+
includeStatus?: boolean;
|
|
42
|
+
verifySignature?: (canonical: Uint8Array, signature: string) => boolean | Promise<boolean>;
|
|
43
|
+
}): Promise<VerifyPublishedViewResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Resolve and verify a single logical object under the current head without
|
|
46
|
+
* downloading a full-generation object list (incremental: root+shard+cas).
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveObject(options: {
|
|
49
|
+
bases: PublicBases;
|
|
50
|
+
fetch: FetchLike;
|
|
51
|
+
head?: HeadManifest;
|
|
52
|
+
logicalKey: string;
|
|
53
|
+
role?: 'state' | 'index';
|
|
54
|
+
shardHexChars?: number;
|
|
55
|
+
}): Promise<ResolveObjectResult>;
|
|
56
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/consumer/api.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAChD,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ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AE,WAAW,CAAA;IAClB,KAAK,EAAE,SAAS,CAAA;IAChB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC3F,GAAG,OAAO,CAAC,yBAAyB,CAAC,CA2CrC;AA6CD;;;GAGG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAC3C,KAAK,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,SAAS,CAAA;IAChB,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAqC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../src/consumer/hash.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAO/E"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MAP_ROOT_SCHEMA, MAP_SHARD_SCHEMA } from '../publication/constants.ts';
|
|
2
|
+
import type { GenerationManifest, HeadManifest, IndexerStatus } from '../publication/types.ts';
|
|
3
|
+
export declare function parseHead(json: unknown): HeadManifest;
|
|
4
|
+
export declare function parseGenerationManifest(json: unknown): GenerationManifest;
|
|
5
|
+
export declare function parseIndexerStatus(json: unknown): IndexerStatus;
|
|
6
|
+
export declare function parseMapRoot(json: unknown): {
|
|
7
|
+
schema: typeof MAP_ROOT_SCHEMA;
|
|
8
|
+
shards: Record<string, string>;
|
|
9
|
+
};
|
|
10
|
+
export declare function parseMapShard(json: unknown): {
|
|
11
|
+
entries: Record<string, {
|
|
12
|
+
contentType?: string;
|
|
13
|
+
hash: string;
|
|
14
|
+
size: number;
|
|
15
|
+
}>;
|
|
16
|
+
schema: typeof MAP_SHARD_SCHEMA;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/consumer/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,eAAe,EACf,gBAAgB,EACjB,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EACV,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAChD,MAAM,yBAAyB,CAAA;AAiBhC,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAsBrD;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,GAAG,kBAAkB,CASzE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,aAAa,CAM/D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG;IAC3C,MAAM,EAAE,OAAO,eAAe,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B,CAYA;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG;IAC5C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC7E,MAAM,EAAE,OAAO,gBAAgB,CAAA;CAChC,CASA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-neutral public surface for verifying and resolving published dapp
|
|
3
|
+
* views. Must not import Node built-ins or the AWS SDK.
|
|
4
|
+
*/
|
|
5
|
+
export type { FetchLike, PublicBases, ResolveObjectResult, VerifyPublishedViewResult, } from './consumer/api.ts';
|
|
6
|
+
export { hashBytesAsync, parseGenerationManifest, parseHead, parseIndexerStatus, parseMapRoot, parseMapShard, resolveObject, shardIdForKey, verifyPublishedView, } from './consumer/api.ts';
|
|
7
|
+
export { canonicalHeadBytes } from './publication/canonicalHead.ts';
|
|
8
|
+
export { CACHE_CONTROL_IMMUTABLE, CACHE_CONTROL_REVALIDATE, CAS_PREFIX, DEFAULT_SHARD_HEX_CHARS, GENERATION_MANIFEST_SCHEMA, GENERATIONS_PREFIX, HEAD_KEY, HEAD_MANIFEST_SCHEMA, INDEXER_STATUS_SCHEMA, MAP_ROOT_SCHEMA, MAP_ROOTS_PREFIX, MAP_SHARD_SCHEMA, MAP_SHARDS_PREFIX, PINS_KEY, PINS_SCHEMA, RECEIPT_SCHEMA, RECEIPTS_PREFIX, STATUS_KEY, } from './publication/constants.ts';
|
|
9
|
+
//# sourceMappingURL=consumer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumer.d.ts","sourceRoot":"","sources":["../../src/consumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,YAAY,EACV,SAAS,EAAE,WAAW,EAAE,mBAAmB,EAAE,yBAAyB,GACvE,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,cAAc,EAAE,uBAAuB,EAAE,SAAS,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EACnG,aAAa,EAAE,aAAa,EAAE,mBAAmB,GAClD,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,UAAU,EACV,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,QAAQ,EACR,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,eAAe,EACf,UAAU,GACX,MAAM,4BAA4B,CAAA"}
|