@ariestools/aries-dapp-core 0.1.7 → 0.1.8
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 +253 -32
- package/dist/bin/dappServer.mjs +614 -100
- 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 +8 -4
- package/dist/node/bin/dappServer.d.ts.map +1 -1
- 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 +114 -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/package.json +12 -5
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown when a conditional put fails (object already exists under
|
|
3
|
+
* `ifNotExists`, or ETag mismatch under `ifMatch`).
|
|
4
|
+
*/
|
|
5
|
+
export declare class ConditionalWriteError extends Error {
|
|
6
|
+
readonly key: string;
|
|
7
|
+
readonly name = "ConditionalWriteError";
|
|
8
|
+
constructor(key: string, message?: string);
|
|
9
|
+
}
|
|
10
|
+
export declare function isConditionalWriteError(error: unknown): error is ConditionalWriteError;
|
|
11
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/providers/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,SAAkB,IAAI,2BAA0B;gBAEpC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAI1C;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAKtF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashBytes.d.ts","sourceRoot":"","sources":["../../../src/providers/hashBytes.ts"],"names":[],"mappings":"AAEA,mDAAmD;AACnD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAI3D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Join a role prefix with a relative object key into a physical S3 key.
|
|
3
|
+
* Empty prefix yields the relative key unchanged; empty relative yields the
|
|
4
|
+
* prefix without a trailing slash.
|
|
5
|
+
*/
|
|
6
|
+
export declare function joinKey(prefix: string, relativeKey: string): string;
|
|
7
|
+
/** Strip a role prefix from a physical key, returning the relative key. */
|
|
8
|
+
export declare function stripPrefix(prefix: string, physicalKey: string): string;
|
|
9
|
+
/** Normalize an optional public base URL (no trailing slash). */
|
|
10
|
+
export declare function normalizePublicBaseUrl(url: string | undefined): string | undefined;
|
|
11
|
+
//# sourceMappingURL=joinKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joinKey.d.ts","sourceRoot":"","sources":["../../../src/providers/joinKey.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAMnE;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAOvE;AAED,iEAAiE;AACjE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGlF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DappBucketStore } from './capabilities.ts';
|
|
2
|
+
import type { DappStoreRole } from './types.ts';
|
|
3
|
+
export interface MemoryBucketStoreOptions {
|
|
4
|
+
bucket?: string;
|
|
5
|
+
prefix?: string;
|
|
6
|
+
publicBaseUrl?: string;
|
|
7
|
+
role: DappStoreRole;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* In-memory {@link DappBucketStore} with real conditional put semantics for
|
|
11
|
+
* deterministic fence/race tests (s3rver conditionals are unreliable).
|
|
12
|
+
*/
|
|
13
|
+
export declare function createMemoryBucketStore(options: MemoryBucketStoreOptions): DappBucketStore;
|
|
14
|
+
//# sourceMappingURL=memoryBucketStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoryBucketStore.d.ts","sourceRoot":"","sources":["../../../src/providers/memoryBucketStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,KAAK,EACV,aAAa,EAOd,MAAM,YAAY,CAAA;AAWnB,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,aAAa,CAAA;CACpB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,GAAG,eAAe,CA2I1F"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { S3Client, S3ClientConfig as AwsS3ClientConfig } from '@aws-sdk/client-s3';
|
|
2
|
+
/** Logical store roles in a dapp backend. */
|
|
3
|
+
export declare const DAPP_STORE_ROLES: readonly ["data", "state", "index"];
|
|
4
|
+
export type DappStoreRole = typeof DAPP_STORE_ROLES[number];
|
|
5
|
+
/**
|
|
6
|
+
* Physical binding for one logical role. A role maps to an arbitrary bucket
|
|
7
|
+
* name and optional key prefix so projects can use either three independent
|
|
8
|
+
* buckets or one shared bucket with three prefixes.
|
|
9
|
+
*/
|
|
10
|
+
export interface DappStoreBinding {
|
|
11
|
+
/** Physical S3/R2 bucket name. */
|
|
12
|
+
bucket: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional key prefix inside the bucket (no leading slash). Trailing slashes
|
|
15
|
+
* are normalized. Example: `my-dapp/state`.
|
|
16
|
+
*/
|
|
17
|
+
prefix?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional public CDN / anonymous-read base URL for this role
|
|
20
|
+
* (e.g. `https://cdn.example.com/state`). Distinct from the private S3 API
|
|
21
|
+
* endpoint used for writes.
|
|
22
|
+
*/
|
|
23
|
+
publicBaseUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Object metadata returned by stat/get and accepted on put. */
|
|
26
|
+
export interface ObjectMeta {
|
|
27
|
+
cacheControl?: string;
|
|
28
|
+
contentEncoding?: string;
|
|
29
|
+
contentLength?: number;
|
|
30
|
+
contentType?: string;
|
|
31
|
+
etag?: string;
|
|
32
|
+
lastModified?: Date;
|
|
33
|
+
/** User metadata (S3 `x-amz-meta-*`); keys are lower-cased by providers. */
|
|
34
|
+
metadata?: Record<string, string>;
|
|
35
|
+
}
|
|
36
|
+
export interface PutObjectOptions {
|
|
37
|
+
cacheControl?: string;
|
|
38
|
+
contentEncoding?: string;
|
|
39
|
+
contentType?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Only write when the object's current ETag matches. Supported when the
|
|
42
|
+
* provider honors conditional PutObject; otherwise the write is unconditional.
|
|
43
|
+
*/
|
|
44
|
+
ifMatch?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Only create when the key does not exist (`If-None-Match: *`). Supported
|
|
47
|
+
* when the provider honors conditional PutObject.
|
|
48
|
+
*/
|
|
49
|
+
ifNotExists?: boolean;
|
|
50
|
+
metadata?: Record<string, string>;
|
|
51
|
+
}
|
|
52
|
+
export interface PutObjectResult {
|
|
53
|
+
etag?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface GetObjectResult {
|
|
56
|
+
body: Uint8Array;
|
|
57
|
+
meta: ObjectMeta;
|
|
58
|
+
}
|
|
59
|
+
export interface ListPageOptions {
|
|
60
|
+
continuationToken?: string;
|
|
61
|
+
maxKeys?: number;
|
|
62
|
+
/** Relative prefix under the role binding (not the full physical key). */
|
|
63
|
+
prefix?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface ListPage {
|
|
66
|
+
continuationToken?: string;
|
|
67
|
+
isTruncated: boolean;
|
|
68
|
+
/** Relative keys (binding prefix stripped). */
|
|
69
|
+
keys: string[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Shared S3 client configuration for production stores. Prefer injecting a
|
|
73
|
+
* single {@link S3Client} (or a credential provider) rather than letting
|
|
74
|
+
* dapp-core own secrets. Credentials must never be logged or embedded in
|
|
75
|
+
* published configuration.
|
|
76
|
+
*/
|
|
77
|
+
export interface S3ClientConfig {
|
|
78
|
+
/**
|
|
79
|
+
* Pre-built client shared across all role stores. When set, endpoint/region/
|
|
80
|
+
* credentials/forcePathStyle are ignored for client construction.
|
|
81
|
+
*/
|
|
82
|
+
client?: S3Client;
|
|
83
|
+
credentials?: AwsS3ClientConfig['credentials'];
|
|
84
|
+
/** Private S3-compatible API origin, e.g. `https://<account>.r2.cloudflarestorage.com`. */
|
|
85
|
+
endpoint?: string;
|
|
86
|
+
forcePathStyle?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* When true (default if the client was constructed here), locator/store
|
|
89
|
+
* `destroy()` releases the client. Injected clients default to false.
|
|
90
|
+
*/
|
|
91
|
+
ownClient?: boolean;
|
|
92
|
+
region?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface DappStoreBindings {
|
|
95
|
+
data: DappStoreBinding;
|
|
96
|
+
index: DappStoreBinding;
|
|
97
|
+
state: DappStoreBinding;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEvF,6CAA6C;AAC7C,eAAO,MAAM,gBAAgB,qCAAsC,CAAA;AACnE,MAAM,MAAM,aAAa,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAA;AAE3D;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,gEAAgE;AAChE,MAAM,WAAW,UAAU;IACzB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,MA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MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,gBAAgB,CAAA;IACtB,KAAK,EAAE,gBAAgB,CAAA;IACvB,KAAK,EAAE,gBAAgB,CAAA;CACxB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HeadManifest } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Canonical UTF-8 JSON bytes for head signing/verification. Excludes
|
|
4
|
+
* `signature` and uses a fixed field order so Node and browser agree.
|
|
5
|
+
*/
|
|
6
|
+
export declare function canonicalHeadBytes(head: HeadManifest): Uint8Array;
|
|
7
|
+
//# sourceMappingURL=canonicalHead.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonicalHead.d.ts","sourceRoot":"","sources":["../../../src/publication/canonicalHead.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU,CA8BjE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DappObjectWriter } from '../providers/capabilities.ts';
|
|
2
|
+
import type { PublicationConflict, PublicationSafety } from './safety.ts';
|
|
3
|
+
import type { HeadManifest } from './types.ts';
|
|
4
|
+
export declare function commitHead(state: DappObjectWriter, head: HeadManifest, safety: PublicationSafety, fenced: boolean, expectedHeadEtag: string | undefined): Promise<{
|
|
5
|
+
etag?: string;
|
|
6
|
+
} | {
|
|
7
|
+
conflict: PublicationConflict;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=commitHead.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commitHead.d.ts","sourceRoot":"","sources":["../../../src/publication/commitHead.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAGpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,wBAAsB,UAAU,CAC9B,KAAK,EAAE,gBAAgB,EACvB,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,OAAO,EACf,gBAAgB,EAAE,MAAM,GAAG,SAAS,GACnC,OAAO,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,mBAAmB,CAAA;CAAE,CAAC,CA0BhE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Well-known relative keys published by the coherent generation protocol. */
|
|
2
|
+
export declare const HEAD_KEY = "head.json";
|
|
3
|
+
export declare const STATUS_KEY = "status.json";
|
|
4
|
+
export declare const PINS_KEY = "pins.json";
|
|
5
|
+
export declare const GENERATIONS_PREFIX = "generations";
|
|
6
|
+
/** Content-addressed object bodies (incremental layout). */
|
|
7
|
+
export declare const CAS_PREFIX = "cas/sha256";
|
|
8
|
+
/** Sharded logical map roots (incremental layout). */
|
|
9
|
+
export declare const MAP_ROOTS_PREFIX = "map/roots";
|
|
10
|
+
/** Sharded logical map shards (incremental layout). */
|
|
11
|
+
export declare const MAP_SHARDS_PREFIX = "map/shards";
|
|
12
|
+
/** Small generation receipts for incremental layout. */
|
|
13
|
+
export declare const RECEIPTS_PREFIX = "receipts";
|
|
14
|
+
/** CDN caching: immutable generation objects and manifests. */
|
|
15
|
+
export declare const CACHE_CONTROL_IMMUTABLE = "public, max-age=31536000, immutable";
|
|
16
|
+
/** CDN caching: mutable head and status objects that must revalidate. */
|
|
17
|
+
export declare const CACHE_CONTROL_REVALIDATE = "public, max-age=0, must-revalidate";
|
|
18
|
+
export declare const GENERATION_MANIFEST_SCHEMA: "network.aries.dapp.generation.manifest";
|
|
19
|
+
export declare const HEAD_MANIFEST_SCHEMA: "network.aries.dapp.head";
|
|
20
|
+
export declare const INDEXER_STATUS_SCHEMA: "network.aries.dapp.indexer.status";
|
|
21
|
+
export declare const PINS_SCHEMA: "network.aries.dapp.pins";
|
|
22
|
+
export declare const MAP_ROOT_SCHEMA: "network.aries.dapp.map.root";
|
|
23
|
+
export declare const MAP_SHARD_SCHEMA: "network.aries.dapp.map.shard";
|
|
24
|
+
export declare const RECEIPT_SCHEMA: "network.aries.dapp.generation.receipt";
|
|
25
|
+
/** Default shard width: first 2 hex chars of sha256(logicalKey) → 256 shards. */
|
|
26
|
+
export declare const DEFAULT_SHARD_HEX_CHARS = 2;
|
|
27
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/publication/constants.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,eAAO,MAAM,QAAQ,cAAc,CAAA;AACnC,eAAO,MAAM,UAAU,gBAAgB,CAAA;AACvC,eAAO,MAAM,QAAQ,cAAc,CAAA;AACnC,eAAO,MAAM,kBAAkB,gBAAgB,CAAA;AAC/C,4DAA4D;AAC5D,eAAO,MAAM,UAAU,eAAe,CAAA;AACtC,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,cAAc,CAAA;AAC3C,uDAAuD;AACvD,eAAO,MAAM,iBAAiB,eAAe,CAAA;AAC7C,wDAAwD;AACxD,eAAO,MAAM,eAAe,aAAa,CAAA;AAEzC,+DAA+D;AAC/D,eAAO,MAAM,uBAAuB,wCAAwC,CAAA;AAC5E,yEAAyE;AACzE,eAAO,MAAM,wBAAwB,uCAAuC,CAAA;AAE5E,eAAO,MAAM,0BAA0B,EAAG,wCAAiD,CAAA;AAC3F,eAAO,MAAM,oBAAoB,EAAG,yBAAkC,CAAA;AACtE,eAAO,MAAM,qBAAqB,EAAG,mCAA4C,CAAA;AACjF,eAAO,MAAM,WAAW,EAAG,yBAAkC,CAAA;AAC7D,eAAO,MAAM,eAAe,EAAG,6BAAsC,CAAA;AACrE,eAAO,MAAM,gBAAgB,EAAG,8BAAuC,CAAA;AACvE,eAAO,MAAM,cAAc,EAAG,uCAAgD,CAAA;AAE9E,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,IAAI,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { DappObjectWriter } from '../providers/capabilities.ts';
|
|
2
|
+
export type RetentionPolicy = {
|
|
3
|
+
mode: 'forever';
|
|
4
|
+
} | {
|
|
5
|
+
cdnGraceMs: number;
|
|
6
|
+
mode: 'bounded';
|
|
7
|
+
/** Minimum number of recent full/incremental generations to keep beyond active. */
|
|
8
|
+
retainGenerations: number;
|
|
9
|
+
};
|
|
10
|
+
export interface GcKeyRef {
|
|
11
|
+
key: string;
|
|
12
|
+
reason?: string;
|
|
13
|
+
role: 'state' | 'index';
|
|
14
|
+
}
|
|
15
|
+
export interface GcPlan {
|
|
16
|
+
deleteKeys: GcKeyRef[];
|
|
17
|
+
policy: RetentionPolicy;
|
|
18
|
+
retainKeys: GcKeyRef[];
|
|
19
|
+
}
|
|
20
|
+
export interface GcRunResult {
|
|
21
|
+
deleted: GcKeyRef[];
|
|
22
|
+
dryRun: boolean;
|
|
23
|
+
skipped: GcKeyRef[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Plan garbage collection of derived state/index objects. Never touches the
|
|
27
|
+
* data role. Protects active head, pins, and an optional in-flight generation.
|
|
28
|
+
*/
|
|
29
|
+
export declare function planGarbageCollection(options: {
|
|
30
|
+
inFlightGeneration?: string;
|
|
31
|
+
index?: DappObjectWriter;
|
|
32
|
+
policy: RetentionPolicy;
|
|
33
|
+
state: DappObjectWriter;
|
|
34
|
+
}): Promise<GcPlan>;
|
|
35
|
+
/** Execute a GC plan. `dryRun: true` (default) only reports; false deletes. */
|
|
36
|
+
export declare function runGarbageCollection(plan: GcPlan, stores: {
|
|
37
|
+
index?: DappObjectWriter;
|
|
38
|
+
state: DappObjectWriter;
|
|
39
|
+
}, opts?: {
|
|
40
|
+
dryRun?: boolean;
|
|
41
|
+
}): Promise<GcRunResult>;
|
|
42
|
+
//# sourceMappingURL=gc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gc.d.ts","sourceRoot":"","sources":["../../../src/publication/gc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAcpE,MAAM,MAAM,eAAe,GACrB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IACA,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,SAAS,CAAA;IACf,mFAAmF;IACnF,iBAAiB,EAAE,MAAM,CAAA;CAC1B,CAAA;AAEL,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,OAAO,GAAG,OAAO,CAAA;CACxB;AAED,MAAM,WAAW,MAAM;IACrB,UAAU,EAAE,QAAQ,EAAE,CAAA;IACtB,MAAM,EAAE,eAAe,CAAA;IACvB,UAAU,EAAE,QAAQ,EAAE,CAAA;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,QAAQ,EAAE,CAAA;IACnB,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,QAAQ,EAAE,CAAA;CACpB;AAsFD;;;GAGG;AAEH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IACnD,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACxB,MAAM,EAAE,eAAe,CAAA;IACvB,KAAK,EAAE,gBAAgB,CAAA;CACxB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoGlB;AAED,+EAA+E;AAC/E,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE;IACN,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACxB,KAAK,EAAE,gBAAgB,CAAA;CACxB,EACD,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1B,OAAO,CAAC,WAAW,CAAC,CAyBtB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { DappObjectWriter } from '../providers/capabilities.ts';
|
|
2
|
+
import { MAP_ROOT_SCHEMA, MAP_SHARD_SCHEMA, RECEIPT_SCHEMA } from './constants.ts';
|
|
3
|
+
import type { PublicationSafety, PublicationTrust } from './safety.ts';
|
|
4
|
+
import type { HeadManifest, PublishObjectInput } from './types.ts';
|
|
5
|
+
export interface MapRoot {
|
|
6
|
+
schema: typeof MAP_ROOT_SCHEMA;
|
|
7
|
+
/** shardId → shard content hash */
|
|
8
|
+
shards: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
export interface MapShard {
|
|
11
|
+
entries: Record<string, {
|
|
12
|
+
contentType?: string;
|
|
13
|
+
hash: string;
|
|
14
|
+
size: number;
|
|
15
|
+
}>;
|
|
16
|
+
schema: typeof MAP_SHARD_SCHEMA;
|
|
17
|
+
}
|
|
18
|
+
export interface GenerationReceipt {
|
|
19
|
+
changedCount: number;
|
|
20
|
+
generation: string;
|
|
21
|
+
previousGeneration?: string;
|
|
22
|
+
publishedAt: string;
|
|
23
|
+
reducer: {
|
|
24
|
+
name: string;
|
|
25
|
+
version?: string;
|
|
26
|
+
};
|
|
27
|
+
rootHash: string;
|
|
28
|
+
rootKey: string;
|
|
29
|
+
schema: typeof RECEIPT_SCHEMA;
|
|
30
|
+
source?: {
|
|
31
|
+
completedPosition?: string;
|
|
32
|
+
cursor?: string;
|
|
33
|
+
floor?: string;
|
|
34
|
+
observedHead?: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface PublishIncrementalInput {
|
|
38
|
+
assertSafety?: boolean;
|
|
39
|
+
deletedKeys?: readonly string[];
|
|
40
|
+
expectedHeadEtag?: string;
|
|
41
|
+
generation?: string;
|
|
42
|
+
index: DappObjectWriter;
|
|
43
|
+
/** Logical key changes for the index role (primary high-cardinality surface). */
|
|
44
|
+
indexChanges?: readonly PublishObjectInput[];
|
|
45
|
+
previousGeneration?: string;
|
|
46
|
+
reducer: {
|
|
47
|
+
name: string;
|
|
48
|
+
version?: string;
|
|
49
|
+
};
|
|
50
|
+
revision?: number;
|
|
51
|
+
safety: PublicationSafety;
|
|
52
|
+
shardHexChars?: number;
|
|
53
|
+
signal?: AbortSignal;
|
|
54
|
+
source?: GenerationReceipt['source'];
|
|
55
|
+
state: DappObjectWriter;
|
|
56
|
+
/** Optional small state-role changes (still CAS + sharded). */
|
|
57
|
+
stateChanges?: readonly PublishObjectInput[];
|
|
58
|
+
trust?: PublicationTrust;
|
|
59
|
+
}
|
|
60
|
+
export type PublishIncrementalResult = {
|
|
61
|
+
generation: string;
|
|
62
|
+
head: HeadManifest;
|
|
63
|
+
headEtag?: string;
|
|
64
|
+
ok: true;
|
|
65
|
+
receipt: GenerationReceipt;
|
|
66
|
+
root: MapRoot;
|
|
67
|
+
rootHash: string;
|
|
68
|
+
writes: number;
|
|
69
|
+
} | {
|
|
70
|
+
conflict: {
|
|
71
|
+
kind: string;
|
|
72
|
+
message: string;
|
|
73
|
+
};
|
|
74
|
+
ok: false;
|
|
75
|
+
};
|
|
76
|
+
export { shardIdForKey } from './shard.ts';
|
|
77
|
+
/**
|
|
78
|
+
* Incremental high-cardinality publication: write only changed objects to CAS,
|
|
79
|
+
* update touched shards + root, then fenced head-last commit. Unchanged logical
|
|
80
|
+
* keys keep stable `cas/sha256/<hash>` URLs.
|
|
81
|
+
*/
|
|
82
|
+
export declare function publishIncremental(input: PublishIncrementalInput): Promise<PublishIncrementalResult>;
|
|
83
|
+
//# sourceMappingURL=incremental.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incremental.d.ts","sourceRoot":"","sources":["../../../src/publication/incremental.ts"],"names":[],"mappings":"AAE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AK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,wBAAwB,CAAC,CA8KnC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DappObjectWriter } from '../providers/capabilities.ts';
|
|
2
|
+
import type { GenerationManifest, HeadManifest, PublishGenerationInput, PublishGenerationResult } from './types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Publish state and index as one coherent immutable generation, then atomically
|
|
5
|
+
* expose that generation by writing the validated head last under the selected
|
|
6
|
+
* fencing mode.
|
|
7
|
+
*/
|
|
8
|
+
export declare function publishGeneration(input: PublishGenerationInput): Promise<PublishGenerationResult>;
|
|
9
|
+
/**
|
|
10
|
+
* Load and validate the current head, then the generation manifest (full layout)
|
|
11
|
+
* or map root (incremental-cas). Verifies the pointed-to object hash.
|
|
12
|
+
*/
|
|
13
|
+
export declare function readPublishedHead(state: DappObjectWriter): Promise<{
|
|
14
|
+
head: HeadManifest;
|
|
15
|
+
headEtag?: string;
|
|
16
|
+
manifest?: GenerationManifest;
|
|
17
|
+
} | undefined>;
|
|
18
|
+
//# sourceMappingURL=publishGeneration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publishGeneration.d.ts","sourceRoot":"","sources":["../../../src/publication/publishGeneration.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAYpE,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,YAAY,CAAA;AAuGnB;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,uBAAuB,CAAC,CAmDlC;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC;IACT,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;CAC9B,GAAG,SAAS,CAAC,CAyCb"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DappObjectWriter } from '../providers/capabilities.ts';
|
|
2
|
+
import type { PutObjectOptions, PutObjectResult } from '../providers/types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Create-only put for immutable generation objects. If the key already exists
|
|
5
|
+
* with identical bytes, treats the write as an idempotent success. If bytes
|
|
6
|
+
* differ, throws without overwriting published content.
|
|
7
|
+
*/
|
|
8
|
+
export declare function putCreateOnly(store: DappObjectWriter, key: string, body: string | Uint8Array, options?: Omit<PutObjectOptions, 'ifNotExists' | 'ifMatch'>): Promise<PutObjectResult & {
|
|
9
|
+
hash: string;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=putCreateOnly.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"putCreateOnly.d.ts","sourceRoot":"","sources":["../../../src/publication/putCreateOnly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAGpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAc9E;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,gBAAgB,EACvB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GAAG,UAAU,EACzB,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,aAAa,GAAG,SAAS,CAAC,GAC1D,OAAO,CAAC,eAAe,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CA4B7C"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { DappObjectWriter } from '../providers/capabilities.ts';
|
|
2
|
+
import { HEAD_KEY, PINS_KEY, PINS_SCHEMA } from './constants.ts';
|
|
3
|
+
import type { PublicationSafety } from './safety.ts';
|
|
4
|
+
import type { HeadManifest } from './types.ts';
|
|
5
|
+
export interface ReleasePin {
|
|
6
|
+
generation: string;
|
|
7
|
+
pinnedAt: string;
|
|
8
|
+
reason?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PinsDocument {
|
|
11
|
+
pins: ReleasePin[];
|
|
12
|
+
schema: typeof PINS_SCHEMA;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ReleaseSummary {
|
|
16
|
+
generation: string;
|
|
17
|
+
kind: 'full' | 'incremental' | 'unknown';
|
|
18
|
+
manifestKey?: string;
|
|
19
|
+
receiptKey?: string;
|
|
20
|
+
}
|
|
21
|
+
/** List committed full generations and incremental receipts under the state role. */
|
|
22
|
+
export declare function listReleases(state: DappObjectWriter): Promise<ReleaseSummary[]>;
|
|
23
|
+
/** Pin a generation so retention/GC will not delete it. */
|
|
24
|
+
export declare function pinRelease(state: DappObjectWriter, generation: string, opts?: {
|
|
25
|
+
reason?: string;
|
|
26
|
+
}): Promise<PinsDocument>;
|
|
27
|
+
/** Remove a pin. Does not change head. */
|
|
28
|
+
export declare function unpinRelease(state: DappObjectWriter, generation: string): Promise<PinsDocument>;
|
|
29
|
+
export declare function listPins(state: DappObjectWriter): Promise<readonly ReleasePin[]>;
|
|
30
|
+
export interface RollbackHeadInput {
|
|
31
|
+
expectedHeadEtag?: string;
|
|
32
|
+
/** When true, skip capability checks for unfenced/dev stores. */
|
|
33
|
+
safety: PublicationSafety;
|
|
34
|
+
targetGeneration: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Conditionally set head to a prior complete generation without rewriting
|
|
38
|
+
* immutable generation objects. Head remains publication authority.
|
|
39
|
+
*/
|
|
40
|
+
export declare function rollbackHead(state: DappObjectWriter, input: RollbackHeadInput): Promise<{
|
|
41
|
+
head: HeadManifest;
|
|
42
|
+
headEtag?: string;
|
|
43
|
+
ok: true;
|
|
44
|
+
} | {
|
|
45
|
+
message: string;
|
|
46
|
+
ok: false;
|
|
47
|
+
}>;
|
|
48
|
+
export { HEAD_KEY, PINS_KEY };
|
|
49
|
+
//# sourceMappingURL=releases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"releases.d.ts","sourceRoot":"","sources":["../../../src/publication/releases.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAIpE,OAAO,EAGL,QAAQ,EAER,QAAQ,EACR,WAAW,EAEZ,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,EAAE,CAAA;IAClB,MAAM,EAAE,OAAO,WAAW,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAA;IACxC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AA2CD,qFAAqF;AACrF,wBAAsB,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAwBrF;AAED,2DAA2D;AAC3D,wBAAsB,UAAU,CAC9B,KAAK,EAAE,gBAAgB,EACvB,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACzB,OAAO,CAAC,YAAY,CAAC,CAiBvB;AAED,0CAA0C;AAC1C,wBAAsB,YAAY,CAChC,KAAK,EAAE,gBAAgB,EACvB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,YAAY,CAAC,CASvB;AAED,wBAAsB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAEtF;AAED,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,iEAAiE;IACjE,MAAM,EAAE,iBAAiB,CAAA;IACzB,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC,CAoE/F;AAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { DappObjectWriter } from '../providers/capabilities.ts';
|
|
2
|
+
/**
|
|
3
|
+
* How publication fences concurrent writers.
|
|
4
|
+
*
|
|
5
|
+
* - `conditional-head` — production CAS via If-Match / If-None-Match on head
|
|
6
|
+
* - `lease` — injected fencing token for providers without reliable head CAS
|
|
7
|
+
* - `unfenced` — **development only** (local s3rver); never use in production
|
|
8
|
+
*/
|
|
9
|
+
export type PublicationSafety = {
|
|
10
|
+
mode: 'conditional-head';
|
|
11
|
+
} | {
|
|
12
|
+
lease: PublicationLease;
|
|
13
|
+
mode: 'lease';
|
|
14
|
+
} | {
|
|
15
|
+
mode: 'unfenced';
|
|
16
|
+
};
|
|
17
|
+
export interface PublicationLease {
|
|
18
|
+
acquire(opts: {
|
|
19
|
+
key: string;
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
ttlMs: number;
|
|
22
|
+
}): Promise<LeaseHandle>;
|
|
23
|
+
}
|
|
24
|
+
export interface LeaseHandle {
|
|
25
|
+
readonly token: string;
|
|
26
|
+
release(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export type PublicationConflictKind = 'head-cas' | 'lease' | 'immutable-collision' | 'aborted';
|
|
29
|
+
export interface PublicationConflict {
|
|
30
|
+
key?: string;
|
|
31
|
+
kind: PublicationConflictKind;
|
|
32
|
+
message: string;
|
|
33
|
+
}
|
|
34
|
+
export type PublicationTrust = {
|
|
35
|
+
mode: 'trusted-origin';
|
|
36
|
+
} | {
|
|
37
|
+
mode: 'signed';
|
|
38
|
+
sign: (canonicalBytes: Uint8Array) => Promise<string> | string;
|
|
39
|
+
};
|
|
40
|
+
export interface PublicationCapabilities {
|
|
41
|
+
conditionalCreate: boolean;
|
|
42
|
+
conditionalUpdate: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Probe whether the store honors create-only and if-match updates. Production
|
|
46
|
+
* publication should fail closed when the selected safety mode needs a
|
|
47
|
+
* capability the provider lacks.
|
|
48
|
+
*/
|
|
49
|
+
export declare function probePublicationCapabilities(store: DappObjectWriter): Promise<PublicationCapabilities>;
|
|
50
|
+
/**
|
|
51
|
+
* Assert the selected safety mode is supported. Throws when production would
|
|
52
|
+
* otherwise silently degrade to unconditional puts.
|
|
53
|
+
*/
|
|
54
|
+
export declare function assertPublicationSafety(store: DappObjectWriter, safety: PublicationSafety, capabilities?: PublicationCapabilities): Promise<PublicationCapabilities>;
|
|
55
|
+
//# sourceMappingURL=safety.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../../src/publication/safety.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAGpE;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GACvB;IAAE,IAAI,EAAE,kBAAkB,CAAA;C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CAiBlC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shard routing id for a logical key. FNV-1a 32-bit, hex-padded — used only to
|
|
3
|
+
* partition the logical map (not for content integrity). Must match between
|
|
4
|
+
* writer and browser consumer (no crypto required).
|
|
5
|
+
*/
|
|
6
|
+
export declare function shardIdForKey(logicalKey: string, hexChars?: number): string;
|
|
7
|
+
//# sourceMappingURL=shard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shard.d.ts","sourceRoot":"","sources":["../../../src/publication/shard.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,SAA0B,GAAG,MAAM,CAO5F"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DappBucketStore } from '../providers/DappBucketStore.ts';
|
|
2
|
+
import type { IndexerStatus } from './types.ts';
|
|
3
|
+
export interface WriteIndexerStatusInput {
|
|
4
|
+
consecutiveFailures: number;
|
|
5
|
+
cursor?: string;
|
|
6
|
+
floor?: string;
|
|
7
|
+
generation?: string;
|
|
8
|
+
generationRoot?: string;
|
|
9
|
+
/** Override the status object key (default `status.json`). */
|
|
10
|
+
key?: string;
|
|
11
|
+
lastCompletedPosition?: string;
|
|
12
|
+
lastError?: string;
|
|
13
|
+
lastErrorAt?: string;
|
|
14
|
+
lastSuccessAt?: string;
|
|
15
|
+
observedSourceHead?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Read the durable indexer status object from a state (or status) store.
|
|
19
|
+
* Returns undefined when no status has been published yet.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readIndexerStatus(store: DappBucketStore, key?: string): Promise<IndexerStatus | undefined>;
|
|
22
|
+
/**
|
|
23
|
+
* Publish a machine-readable status object with revalidate CDN caching.
|
|
24
|
+
* Status never carries credentials or private application material.
|
|
25
|
+
*/
|
|
26
|
+
export declare function writeIndexerStatus(store: DappBucketStore, input: WriteIndexerStatusInput): Promise<IndexerStatus>;
|
|
27
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/publication/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAItE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,MAAM,WAAW,uBAAuB;IACtC,mBAAmB,EAAE,MAAM,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAMD;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,eAAe,EACtB,GAAG,GAAE,MAAmB,GACvB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAYpC;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,eAAe,EACtB,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,aAAa,CAAC,CAuBxB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DappReduceProgress } from '../reducer/DappReducer.ts';
|
|
2
|
+
import type { WriteIndexerStatusInput } from './status.ts';
|
|
3
|
+
import type { IndexerStatus } from './types.ts';
|
|
4
|
+
/** Carry forward durable progress fields from a prior status object. */
|
|
5
|
+
export declare function priorProgressFields(prior: IndexerStatus | undefined): Pick<WriteIndexerStatusInput, 'cursor' | 'floor' | 'generation' | 'generationRoot' | 'lastCompletedPosition' | 'observedSourceHead' | 'lastSuccessAt'>;
|
|
6
|
+
/** Build success status fields from reduce progress, falling back to prior. */
|
|
7
|
+
export declare function successStatusFields(progress: DappReduceProgress | undefined, prior: IndexerStatus | undefined, now: string): WriteIndexerStatusInput;
|
|
8
|
+
/** Build failure status fields while preserving prior checkpoint progress. */
|
|
9
|
+
export declare function failureStatusFields(prior: IndexerStatus | undefined, consecutiveFailures: number, error: Error, now: string): WriteIndexerStatusInput;
|
|
10
|
+
//# sourceMappingURL=statusPatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statusPatch.d.ts","sourceRoot":"","sources":["../../../src/publication/statusPatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAuB/C,wEAAwE;AACxE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,GAAG,SAAS,GAC/B,IAAI,CACL,uBAAuB,EACvB,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,oBAAoB,GAAG,eAAe,CACxH,CAMA;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,EACxC,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,GAAG,EAAE,MAAM,GACV,uBAAuB,CAezB;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,mBAAmB,EAAE,MAAM,EAC3B,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,MAAM,GACV,uBAAuB,CAOzB"}
|