@the_library/public 1.0.0 → 2.0.1
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 +201 -28
- package/assets/branding/pond-enterprise-logo.svg +1 -1
- package/dist/Book-CYyj_y_4.d.ts +621 -0
- package/dist/bookSearchService-YQskauJS.d.ts +300 -0
- package/dist/branding/index.js +1 -66
- package/dist/branding/index.js.map +1 -1
- package/dist/chunk-3XUKOVEF.js +2 -0
- package/dist/chunk-3XUKOVEF.js.map +1 -0
- package/dist/chunk-46FQHZNM.js +2 -0
- package/dist/chunk-46FQHZNM.js.map +1 -0
- package/dist/chunk-7G3BMGV2.js +2 -0
- package/dist/chunk-7G3BMGV2.js.map +1 -0
- package/dist/chunk-D4DXGA2W.js +2 -0
- package/dist/chunk-D4DXGA2W.js.map +1 -0
- package/dist/chunk-EMA2QJTW.js +2 -0
- package/dist/chunk-EMA2QJTW.js.map +1 -0
- package/dist/chunk-FN52YV7L.js +2 -0
- package/dist/chunk-FN52YV7L.js.map +1 -0
- package/dist/chunk-GWQNULP4.js +2 -0
- package/dist/chunk-GWQNULP4.js.map +1 -0
- package/dist/chunk-OELHBR4F.js +2 -0
- package/dist/chunk-OELHBR4F.js.map +1 -0
- package/dist/chunk-PV3X54EU.js +2 -0
- package/dist/chunk-PV3X54EU.js.map +1 -0
- package/dist/chunk-SD3INWZF.js +2 -0
- package/dist/chunk-SD3INWZF.js.map +1 -0
- package/dist/downloader/dl2-sw.js +1 -198
- package/dist/downloader/dl2-sw.js.map +1 -1
- package/dist/downloader/file-worker-v2.js +1 -257
- package/dist/downloader/file-worker-v2.js.map +1 -1
- package/dist/downloader/index.d.ts +30 -2
- package/dist/downloader/index.js +1 -537
- package/dist/downloader/index.js.map +1 -1
- package/dist/downloader/mu-worker-v2.js +1 -196
- package/dist/downloader/mu-worker-v2.js.map +1 -1
- package/dist/downloader/react.d.ts +1 -1
- package/dist/downloader/react.js +1 -31
- package/dist/downloader/react.js.map +1 -1
- package/dist/downloader/solid.d.ts +1 -1
- package/dist/downloader/solid.js +1 -18
- package/dist/downloader/solid.js.map +1 -1
- package/dist/downloader/sw.js +1 -118
- package/dist/downloader/sw.js.map +1 -1
- package/dist/downloader/vue.d.ts +1 -1
- package/dist/downloader/vue.js +1 -18
- package/dist/downloader/vue.js.map +1 -1
- package/dist/enriched-index-T0sDG7JR.d.ts +209 -0
- package/dist/global/public.global.js +68 -0
- package/dist/global/public.manifest.json +484 -0
- package/dist/level-state-DXqglpAX.d.ts +27 -0
- package/dist/models/astro.d.ts +4 -3
- package/dist/models/astro.js +1 -43
- package/dist/models/astro.js.map +1 -1
- package/dist/models/index.d.ts +449 -23
- package/dist/models/index.js +1 -339
- package/dist/models/index.js.map +1 -1
- package/dist/models/models.d.ts +195 -441
- package/dist/models/models.js +1 -45
- package/dist/models/patch-worker.js +1 -542
- package/dist/models/patch-worker.js.map +1 -1
- package/dist/models/react.d.ts +6 -5
- package/dist/models/react.js +1 -72
- package/dist/models/react.js.map +1 -1
- package/dist/models/solid.d.ts +16 -6
- package/dist/models/solid.js +1 -94
- package/dist/models/solid.js.map +1 -1
- package/dist/models/vue.d.ts +89 -7
- package/dist/models/vue.js +1 -97
- package/dist/models/vue.js.map +1 -1
- package/dist/orm-MJTHCG9E.d.ts +1003 -0
- package/dist/{session-vqOnyxga.d.ts → session-JudUKAV7.d.ts} +76 -74
- package/dist/{state-BTsp-E4v.d.ts → state-CkYavOSt.d.ts} +16 -0
- package/dist/{types-Dn0EFMO_.d.ts → types-B-IX3HBn.d.ts} +94 -21
- package/dist/{types-Xb8Ta9tZ.d.ts → types-Blyx2A7F.d.ts} +10 -36
- package/dist/web3/auth.d.ts +89 -0
- package/dist/web3/auth.js +13 -0
- package/dist/web3/auth.js.map +1 -0
- package/dist/web3/index.d.ts +1913 -126
- package/dist/web3/index.js +1 -1019
- package/dist/web3/index.js.map +1 -1
- package/dist/web3/network.d.ts +6 -0
- package/dist/web3/network.js +2 -0
- package/dist/web3/network.js.map +1 -0
- package/dist/web3/registry.d.ts +34 -9
- package/dist/web3/registry.js +1 -22
- package/dist/web3/vue.d.ts +31 -14
- package/dist/web3/vue.js +1 -390
- package/dist/web3/vue.js.map +1 -1
- package/package.json +36 -15
- package/dist/chunk-2HFOWE5R.js +0 -296
- package/dist/chunk-2HFOWE5R.js.map +0 -1
- package/dist/chunk-3L6LH2XK.js +0 -465
- package/dist/chunk-3L6LH2XK.js.map +0 -1
- package/dist/chunk-4CWVFPBN.js +0 -28
- package/dist/chunk-4CWVFPBN.js.map +0 -1
- package/dist/chunk-AGHPATVL.js +0 -65
- package/dist/chunk-AGHPATVL.js.map +0 -1
- package/dist/chunk-JDUYLUDJ.js +0 -4835
- package/dist/chunk-JDUYLUDJ.js.map +0 -1
- package/dist/chunk-OEZK7IX7.js +0 -77
- package/dist/chunk-OEZK7IX7.js.map +0 -1
- package/dist/chunk-PUYDAUCI.js +0 -2873
- package/dist/chunk-PUYDAUCI.js.map +0 -1
- package/dist/chunk-WHWMTS7D.js +0 -99
- package/dist/chunk-WHWMTS7D.js.map +0 -1
- package/dist/chunk-Y7RS6RTM.js +0 -342
- package/dist/chunk-Y7RS6RTM.js.map +0 -1
- package/dist/chunk-ZEZGI2TP.js +0 -197
- package/dist/chunk-ZEZGI2TP.js.map +0 -1
- package/dist/core-dao-core-logo-VDT2I5IW.svg +0 -33
- package/dist/level-state-J3pj64Tr.d.ts +0 -15
- package/dist/models/models_v2.global.js +0 -1
- package/dist/orm-BvkX0aBT.d.ts +0 -507
|
@@ -1,75 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sidecar binary wire format — parser and writer (SPEC §4).
|
|
5
|
-
*
|
|
6
|
-
* Every sidecar file begins with a 10-byte header (all multi-byte integers
|
|
7
|
-
* are big-endian):
|
|
8
|
-
*
|
|
9
|
-
* Offset Size Field
|
|
10
|
-
* 0 4 Magic number: 0x44504D31 ("DPM1")
|
|
11
|
-
* 4 1 Format version (0x02)
|
|
12
|
-
* 5 3 recordCount (uint24, big-endian, max 16,777,215)
|
|
13
|
-
* 8 1 columnCount (uint8)
|
|
14
|
-
* 9 1 sidecarType (0x00 = Slim, 0x01 = Extended, 0x02 = Provenance)
|
|
15
|
-
*
|
|
16
|
-
* Format version 0x01 used a uint16 recordCount (2 bytes, max 65,535) and
|
|
17
|
-
* uint16 relation target UIDs. Version 0x02 expands both to uint24.
|
|
18
|
-
*
|
|
19
|
-
* Columns follow sequentially: columnType (u8), nameLen (u8), name (UTF-8),
|
|
20
|
-
* then the column data block. Extended sidecars carry two structured tail
|
|
21
|
-
* sections after the columns: relations (self-describing) and instances.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/** Column type codes (SPEC §4.1). */
|
|
25
|
-
declare enum ColumnType {
|
|
26
|
-
Uint8 = 1,
|
|
27
|
-
Uint16 = 2,
|
|
28
|
-
NullableString = 3,
|
|
29
|
-
Relation = 4,// structured tail — flat uint32 stream
|
|
30
|
-
InstanceArray = 5,// structured tail — self-describing instance section
|
|
31
|
-
Uint32 = 6,
|
|
32
|
-
Bool = 7
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* One entry of the instance field descriptor embedded in Extended sidecars.
|
|
36
|
-
*
|
|
37
|
-
* The instances tail is SELF-DESCRIBING: the writer embeds
|
|
38
|
-
* `fieldCount + (typeCode, name)*` once per file, and instances are encoded
|
|
39
|
-
* in descriptor order. The parser never consults any model schema, so:
|
|
40
|
-
* - old files keep parsing correctly after instanceFields change,
|
|
41
|
-
* - any model with `multipleInstances: true` works with zero new code,
|
|
42
|
-
* - files written under an older schema simply yield InstanceData objects
|
|
43
|
-
* missing the newer fields.
|
|
44
|
-
*/
|
|
45
|
-
interface InstanceFieldSpec {
|
|
46
|
-
name: string;
|
|
47
|
-
type: ColumnType;
|
|
48
|
-
}
|
|
49
|
-
type ColumnData = Uint8Array | Uint16Array | Uint32Array | Array<string | null>;
|
|
50
|
-
interface SidecarHeader {
|
|
51
|
-
formatVersion: number;
|
|
52
|
-
recordCount: number;
|
|
53
|
-
columnCount: number;
|
|
54
|
-
sidecarType: SidecarType;
|
|
55
|
-
}
|
|
56
|
-
interface ParsedSidecar {
|
|
57
|
-
header: SidecarHeader;
|
|
58
|
-
columns: Map<string, ColumnData>;
|
|
59
|
-
/**
|
|
60
|
-
* Per-record target-UID arrays for every `has`-direction relation, keyed by
|
|
61
|
-
* the schema relation name (Extended sidecars only). Self-describing: the
|
|
62
|
-
* writer embeds the relation names in the file, so the parser needs no
|
|
63
|
-
* schema and new relations parse with zero code change.
|
|
64
|
-
*/
|
|
65
|
-
relations?: Map<string, number[][]>;
|
|
66
|
-
/** Back-compat alias for `relations.get('authors')`. */
|
|
67
|
-
authorIds?: number[][];
|
|
68
|
-
/** Field descriptor the instances were encoded with (Extended only). */
|
|
69
|
-
instanceFields?: InstanceFieldSpec[];
|
|
70
|
-
/** Per-record instance objects, keyed by field name (Extended only). */
|
|
71
|
-
instances?: InstanceData[][];
|
|
72
|
-
}
|
|
1
|
+
import { L as Lang, u as uid, a as SidecarUrls, Q as QueueItem, O as Orm } from './orm-MJTHCG9E.js';
|
|
2
|
+
import { P as ParsedSidecar, A as AiResultEntry } from './enriched-index-T0sDG7JR.js';
|
|
73
3
|
|
|
74
4
|
interface SidecarSet {
|
|
75
5
|
objectType: number;
|
|
@@ -77,8 +7,9 @@ interface SidecarSet {
|
|
|
77
7
|
slim?: ParsedSidecar;
|
|
78
8
|
extended?: ParsedSidecar;
|
|
79
9
|
prov?: ParsedSidecar;
|
|
10
|
+
ai?: Map<bigint, Map<string, Map<string, Set<AiResultEntry>>>>;
|
|
80
11
|
/** uid -> array index, from the `ids` column of the slim tier. */
|
|
81
|
-
idIndex: Map<
|
|
12
|
+
idIndex: Map<uid, number>;
|
|
82
13
|
}
|
|
83
14
|
|
|
84
15
|
interface InitWorkersOptions {
|
|
@@ -127,6 +58,12 @@ interface LocalCorpusIndex {
|
|
|
127
58
|
prov?: {
|
|
128
59
|
file: string;
|
|
129
60
|
}[];
|
|
61
|
+
"ai-for-D-safe"?: {
|
|
62
|
+
file: string;
|
|
63
|
+
}[];
|
|
64
|
+
search?: {
|
|
65
|
+
file: string;
|
|
66
|
+
}[];
|
|
130
67
|
};
|
|
131
68
|
}>;
|
|
132
69
|
}
|
|
@@ -136,6 +73,8 @@ interface RegistryDataBlock {
|
|
|
136
73
|
slim?: string[];
|
|
137
74
|
extended?: string[];
|
|
138
75
|
prov?: string[];
|
|
76
|
+
"ai-for-D-safe"?: string[];
|
|
77
|
+
search?: string[];
|
|
139
78
|
}>>;
|
|
140
79
|
}
|
|
141
80
|
interface BootModelsV2Options {
|
|
@@ -154,10 +93,17 @@ interface BootModelsV2Options {
|
|
|
154
93
|
/** Pre-fetched local manifest (else fetched from `${localMode}/corpus-index.json`). */
|
|
155
94
|
localManifest?: LocalCorpusIndex;
|
|
156
95
|
/** **Registry mode** (used when `localMode` is absent) — resolved registry_v2 data block. */
|
|
96
|
+
/** **Registry mode** (used when `localMode` is absent) — resolved registry_v2 data block. */
|
|
157
97
|
registry?: {
|
|
158
98
|
dataBlock: RegistryDataBlock;
|
|
159
99
|
gateway?: string;
|
|
160
100
|
};
|
|
101
|
+
loadAiSidecars?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Load the Book metadata search index in the background once boot is done
|
|
104
|
+
* (default true). Never blocks or fails boot; see search/bookSearchService.ts.
|
|
105
|
+
*/
|
|
106
|
+
search?: boolean;
|
|
161
107
|
}
|
|
162
108
|
/**
|
|
163
109
|
* Full one-shot boot: resolve sidecar URLs (local folder or registry_v2 →
|
|
@@ -165,6 +111,37 @@ interface BootModelsV2Options {
|
|
|
165
111
|
* Returns the worker's `{ sidecars, patches }`.
|
|
166
112
|
*/
|
|
167
113
|
declare function bootModelsV2(opts: BootModelsV2Options): Promise<Awaited<ReturnType<typeof InitPatchWorker>>>;
|
|
114
|
+
/**
|
|
115
|
+
* Start — or retry after an error — loading the search index for `lang` now,
|
|
116
|
+
* from the same source the session booted from. No-op while it is loading or
|
|
117
|
+
* loaded; resolves immediately before boot (boot starts it itself).
|
|
118
|
+
*/
|
|
119
|
+
declare function loadSearch(lang?: Lang): Promise<void>;
|
|
120
|
+
declare function hasPartition(basePath: string): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Loads and merges an additional local corpus partition — e.g. book-manager's
|
|
123
|
+
* `deleted/` archive, served alongside the normal `public/` partition it
|
|
124
|
+
* booted from — into the already-running session, for whichever languages
|
|
125
|
+
* are already loaded (or an explicit override).
|
|
126
|
+
*
|
|
127
|
+
* Local-mode only, unlike `loadLanguage`: deleted partitions are local-only
|
|
128
|
+
* archives, never published to Arweave/registry (see
|
|
129
|
+
* slim-versioning-and-historic-index.md), so there is no registry-mode
|
|
130
|
+
* equivalent to support here.
|
|
131
|
+
*
|
|
132
|
+
* Safe to merge: `hydrateAll` reuses an already-materialized record instead
|
|
133
|
+
* of overwriting it, and the worker's `LoadLanguage` path (reused here) is
|
|
134
|
+
* additive, so ids already loaded elsewhere are untouched and relation edges
|
|
135
|
+
* union rather than replace (see hydrateAll's doc comment and
|
|
136
|
+
* worker/libs/initialLoad.ts). Idempotent per basePath.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* // book-manager, after the normal bootstrapModelsV2({ localMode: '/corpus_v2' }):
|
|
140
|
+
* await loadPartition('/corpus_v2_deleted');
|
|
141
|
+
*/
|
|
142
|
+
declare function loadPartition(basePath: string, opts?: {
|
|
143
|
+
langs?: Lang[];
|
|
144
|
+
}): Promise<void>;
|
|
168
145
|
type BootResult = Awaited<ReturnType<typeof bootModelsV2>>;
|
|
169
146
|
interface SessionBootstrapOptions extends BootModelsV2Options {
|
|
170
147
|
/** Optional per-URL hook, fired after each Astro `<ClientRouter />` swap. */
|
|
@@ -177,8 +154,33 @@ interface SessionBootstrapOptions extends BootModelsV2Options {
|
|
|
177
154
|
* (per-username QueueItem arrays). Use this instead of letting the result be discarded.
|
|
178
155
|
*/
|
|
179
156
|
onBoot?: (data: BootResult) => void | Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Called once boot has failed on every retry (see BOOT_RETRIES below) —
|
|
159
|
+
* the whole-boot-level backstop behind fetchWithRetry's per-file retries
|
|
160
|
+
* (worker/libs/initialLoad.ts). Before this existed, a boot failure was
|
|
161
|
+
* only ever `console.error`'d and silently swallowed — the app was left
|
|
162
|
+
* in a half-initialized state with no data and no indication anything
|
|
163
|
+
* was wrong (the 2026-08-21 incident: one Arweave TX not yet retrievable
|
|
164
|
+
* from a CDN edge killed the entire boot, silently, for every affected
|
|
165
|
+
* user). Use this to show a "content temporarily unavailable, retry"
|
|
166
|
+
* prompt instead of leaving the app looking broken with no explanation.
|
|
167
|
+
*/
|
|
168
|
+
onBootError?: (err: unknown) => void;
|
|
180
169
|
}
|
|
181
170
|
/** Test/HMR helper — forgets the session so the next bootstrap re-inits. */
|
|
182
171
|
declare const resetModelsV2Session: () => void;
|
|
172
|
+
/**
|
|
173
|
+
* Wipes every locally-queued patch from IndexedDB (all usernames) — the
|
|
174
|
+
* sanctioned, public entry point for a "discard all local edits, go back to
|
|
175
|
+
* whatever the sidecars/server say" reset. `indexdb/patch_storage.ts`'s
|
|
176
|
+
* `clearAllPatches` is deliberately not exported through the package's
|
|
177
|
+
* public barrel (it bypasses the `Patches` queue/sync invariants — see that
|
|
178
|
+
* file's header), which is fine here specifically because the caller is
|
|
179
|
+
* expected to force a full page reload immediately after: there is no
|
|
180
|
+
* in-memory queue state left to go stale, since nothing survives the reload.
|
|
181
|
+
* Does not touch `data/patches.jsonl` on the server — callers combine this
|
|
182
|
+
* with `DELETE /api/patches` (or equivalent) for a full reset.
|
|
183
|
+
*/
|
|
184
|
+
declare const clearLocalPatches: () => Promise<true>;
|
|
183
185
|
|
|
184
|
-
export { type SessionBootstrapOptions as S, resetModelsV2Session as r };
|
|
186
|
+
export { type SessionBootstrapOptions as S, loadPartition as a, clearLocalPatches as c, hasPartition as h, loadSearch as l, resetModelsV2Session as r };
|
|
@@ -14,6 +14,9 @@ interface BookData {
|
|
|
14
14
|
parsed: boolean;
|
|
15
15
|
}
|
|
16
16
|
type WorkerCommand = {
|
|
17
|
+
type: 'FileInit';
|
|
18
|
+
gateways: string[];
|
|
19
|
+
} | {
|
|
17
20
|
type: 'GetFile';
|
|
18
21
|
txId: string;
|
|
19
22
|
mime: 'pdf' | 'preview';
|
|
@@ -25,12 +28,16 @@ type WorkerCommand = {
|
|
|
25
28
|
} | {
|
|
26
29
|
type: 'CancelDownload';
|
|
27
30
|
txId: string;
|
|
31
|
+
} | {
|
|
32
|
+
type: 'PinTxIds';
|
|
33
|
+
txIds: string[];
|
|
28
34
|
};
|
|
29
35
|
type WorkerMessage = {
|
|
30
36
|
type: 'FileRpcResponse';
|
|
31
37
|
ok: boolean;
|
|
32
38
|
key: string;
|
|
33
39
|
error?: string;
|
|
40
|
+
quotaExceeded?: boolean;
|
|
34
41
|
} | {
|
|
35
42
|
type: 'HYDRATE';
|
|
36
43
|
payload: HydratePayload;
|
|
@@ -49,6 +56,7 @@ type WorkerMessage = {
|
|
|
49
56
|
txId: string;
|
|
50
57
|
error: string;
|
|
51
58
|
retryable: boolean;
|
|
59
|
+
quotaExceeded?: boolean;
|
|
52
60
|
} | {
|
|
53
61
|
type: 'StoragePruneStarted';
|
|
54
62
|
targetFreeBytes: number;
|
|
@@ -70,6 +78,14 @@ type WorkerMessage = {
|
|
|
70
78
|
type: 'MuPdfData';
|
|
71
79
|
txId: string;
|
|
72
80
|
bookData: BookData;
|
|
81
|
+
} | {
|
|
82
|
+
type: 'MuPageCountResult';
|
|
83
|
+
txId: string;
|
|
84
|
+
pageCount: number;
|
|
85
|
+
} | {
|
|
86
|
+
type: 'MuPageCountError';
|
|
87
|
+
txId: string;
|
|
88
|
+
error: string;
|
|
73
89
|
};
|
|
74
90
|
interface HydratePayload {
|
|
75
91
|
files: Array<[txId: string, state: FileState$1]>;
|
|
@@ -9,6 +9,9 @@ interface ContractAddresses {
|
|
|
9
9
|
subscriptionManager?: string;
|
|
10
10
|
libraryRegistryStorage?: string;
|
|
11
11
|
publicLibraryStorage?: string;
|
|
12
|
+
dSafeHRStorage?: string;
|
|
13
|
+
relationshipIndexerStorage?: string;
|
|
14
|
+
accountManager?: string;
|
|
12
15
|
}
|
|
13
16
|
interface StripeDonation {
|
|
14
17
|
stripePaymentId: string;
|
|
@@ -37,6 +40,7 @@ interface BouncerStorageReadAPI {
|
|
|
37
40
|
isAuthorized(address: string): Promise<boolean>;
|
|
38
41
|
getLatestRegisteredUser(): Promise<string | null>;
|
|
39
42
|
getTokenName(): Promise<string>;
|
|
43
|
+
userIdByEmailHash(emailHash: string): Promise<number>;
|
|
40
44
|
}
|
|
41
45
|
interface ArchivistStorageReadAPI {
|
|
42
46
|
userLevel(userId: number): Promise<number>;
|
|
@@ -51,6 +55,13 @@ interface ScientistStorageReadAPI {
|
|
|
51
55
|
getStatsRaw(action: number, objectType: number, monthId: number): Promise<[bigint[], number[]]>;
|
|
52
56
|
isAuthorized(address: string): Promise<boolean>;
|
|
53
57
|
}
|
|
58
|
+
/** A vote preset: `bps` (1 = 0.01%) of every new credit is voted for this project edition. */
|
|
59
|
+
interface VotePreset {
|
|
60
|
+
projectId: number;
|
|
61
|
+
/** Readable code, as getLanguageAtIndex returns it (bytes4 conversion is internal). */
|
|
62
|
+
lang: string;
|
|
63
|
+
bps: number;
|
|
64
|
+
}
|
|
54
65
|
interface ProjectManagerStorageReadAPI {
|
|
55
66
|
nbProjects(): Promise<number>;
|
|
56
67
|
getProjectSupportedLanguages(projectId: number): Promise<Array<string>>;
|
|
@@ -60,6 +71,7 @@ interface ProjectManagerStorageReadAPI {
|
|
|
60
71
|
donations: number;
|
|
61
72
|
unspent: number;
|
|
62
73
|
}>;
|
|
74
|
+
/** Latest versions with resolved public URLs. */
|
|
63
75
|
loadProject(projectId: number): Promise<{
|
|
64
76
|
id: number;
|
|
65
77
|
balance: number;
|
|
@@ -74,9 +86,12 @@ interface ProjectManagerStorageReadAPI {
|
|
|
74
86
|
getNbLanguages(projectId: number): Promise<number>;
|
|
75
87
|
getLanguageAtIndex(projectId: number, index: number): Promise<string>;
|
|
76
88
|
getNbVersions(projectId: number, lang: string): Promise<number>;
|
|
89
|
+
/** Editable version: owned-site URIs are canonical paths; external URIs are unchanged. */
|
|
77
90
|
getVersion(projectId: number, lang: string, versionNumber: number): Promise<ProjectVersion>;
|
|
78
91
|
getVotingBalance(projectId: number, lang: string): Promise<bigint>;
|
|
79
92
|
getUserBalances(address: string): Promise<[donated: bigint, allocated: bigint, remaining: bigint]>;
|
|
93
|
+
/** Current vote presets (ProjectManagerStorage 2.1.0+). */
|
|
94
|
+
getVotePresets(): Promise<VotePreset[]>;
|
|
80
95
|
}
|
|
81
96
|
interface FactoryReadAPI {
|
|
82
97
|
nbWritesByUsername(username: string): Promise<number>;
|
|
@@ -90,7 +105,6 @@ interface FactoryReadAPI {
|
|
|
90
105
|
scientistStorage(): Promise<string>;
|
|
91
106
|
backupStorage(): Promise<string>;
|
|
92
107
|
projectManagerStorage(): Promise<string>;
|
|
93
|
-
usedPaymentIntents(paymentIntentId: string): Promise<boolean>;
|
|
94
108
|
}
|
|
95
109
|
interface TransactionOptions {
|
|
96
110
|
feeLimit?: number;
|
|
@@ -98,19 +112,35 @@ interface TransactionOptions {
|
|
|
98
112
|
value?: number;
|
|
99
113
|
onAccepted?: (txId: string) => void;
|
|
100
114
|
}
|
|
115
|
+
interface AccountManagerReadAPI {
|
|
116
|
+
/** Resolved AccountManager address (the one deletion consents are bound to). */
|
|
117
|
+
address(): Promise<string>;
|
|
118
|
+
oracleSigner(): Promise<string>;
|
|
119
|
+
usedDeletionConsents(messageHash: string): Promise<boolean>;
|
|
120
|
+
/** True once a Stripe payment intent was credited on this network (recorded in ProjectManagerStorage, so it covers every AccountManager). */
|
|
121
|
+
isPaymentIntentUsed(paymentIntentId: string): Promise<boolean>;
|
|
122
|
+
}
|
|
123
|
+
interface AccountManagerWriteAPI {
|
|
124
|
+
/** Retires the connected account. Needs the oracle's EmailConsent — see web3/auth/deletionConsent. */
|
|
125
|
+
unregisterWithConsent(expiry: number, signature: string, options?: TransactionOptions): Promise<any>;
|
|
126
|
+
registerStripe(country: string, language: string, paymentIntentId: string, votes: bigint, signature: string, emailHash: string, options?: TransactionOptions): Promise<any>;
|
|
127
|
+
fundStripe(paymentIntentId: string, votes: bigint, signature: string, options?: TransactionOptions): Promise<any>;
|
|
128
|
+
}
|
|
129
|
+
interface BouncerStorageWriteAPI {
|
|
130
|
+
newAccount(account: string, country: string, language: string, referredBy: number, emailHash: string, options?: TransactionOptions): Promise<any>;
|
|
131
|
+
}
|
|
101
132
|
interface FactoryWriteAPI {
|
|
102
|
-
register(country: string, language: string, paymentValue: number, options?: TransactionOptions): Promise<any>;
|
|
103
|
-
unregister(options?: TransactionOptions): Promise<any>;
|
|
104
133
|
save(patches: Array<bigint>, level: number, textIndex: Array<number>, text: Array<string>, options?: TransactionOptions): Promise<any>;
|
|
105
134
|
createProject(lang: string, uri: string, publicationDate: number, name: string, headline: string, arweaveAddressLogo: string, arweaveAddressBanner: string, descriptionMarkdown: string, minimumFundingBeforeStartWork: number, maximumFunding: number, tags: number[], complexity: number, options?: TransactionOptions): Promise<any>;
|
|
106
135
|
addProjectVersion(projectId: number, lang: string, publicationDate: number, uri: string, name: string, headline: string, arweaveAddressLogo: string, arweaveAddressBanner: string, descriptionMarkdown: string, minimumFundingBeforeStartWork: number, maximumFunding: number, tags: number[], status: number, complexity: number, options?: TransactionOptions): Promise<any>;
|
|
107
136
|
deleteProject(projectId: number, lang: string, options?: TransactionOptions): Promise<any>;
|
|
108
|
-
|
|
109
|
-
|
|
137
|
+
/** Replaces the whole vote-preset set in one transaction (Factory owner only). */
|
|
138
|
+
setVotePresets(presets: VotePreset[], options?: TransactionOptions): Promise<any>;
|
|
110
139
|
donateToProject(projectId: number, lang: string, amount: number, options?: TransactionOptions): Promise<any>;
|
|
111
140
|
}
|
|
112
141
|
interface AddressRegistryWriteAPI {
|
|
113
142
|
addData(key: string, value: string, options?: TransactionOptions): Promise<any>;
|
|
143
|
+
addBlobRef(key: string, arweaveTxId: string, sha256Hash: string, options?: TransactionOptions): Promise<any>;
|
|
114
144
|
}
|
|
115
145
|
interface AddressRegistryContractRecord {
|
|
116
146
|
contractAddress: string;
|
|
@@ -128,6 +158,9 @@ interface AddressRegistryReadAPI {
|
|
|
128
158
|
getLatestData(key: string): Promise<string>;
|
|
129
159
|
getAllDataKeys(): Promise<string[]>;
|
|
130
160
|
getLastUpdateInfo(name: string): Promise<AddressRegistryUpdateInfo | null>;
|
|
161
|
+
/** Reverts with "AddressRegistry: blob ref not found" if `key` has no anchor yet. */
|
|
162
|
+
getLatestBlobRef(key: string): Promise<[arweaveTxId: string, sha256Hash: string]>;
|
|
163
|
+
getBlobRefHistory(key: string, offset: number, limit: number): Promise<[arweaveTxId: string, sha256Hash: string][]>;
|
|
131
164
|
admin(): Promise<string>;
|
|
132
165
|
}
|
|
133
166
|
interface CollectionInput {
|
|
@@ -144,6 +177,7 @@ interface CollectionInput {
|
|
|
144
177
|
isPublic: boolean;
|
|
145
178
|
initialBookCount: number;
|
|
146
179
|
dSafeBookCount: number;
|
|
180
|
+
preferredFormat: string;
|
|
147
181
|
}
|
|
148
182
|
interface Collection extends CollectionInput {
|
|
149
183
|
verified: boolean;
|
|
@@ -153,6 +187,7 @@ interface Collection extends CollectionInput {
|
|
|
153
187
|
published: boolean;
|
|
154
188
|
}
|
|
155
189
|
interface LibraryRegistryStorageReadAPI {
|
|
190
|
+
admin(): Promise<string>;
|
|
156
191
|
getUnverifiedCollectionIds(): Promise<string[]>;
|
|
157
192
|
getVerifiedCollectionIds(): Promise<string[]>;
|
|
158
193
|
getCollection(id: string): Promise<Collection>;
|
|
@@ -171,20 +206,6 @@ declare enum LibraryOwnership {
|
|
|
171
206
|
Public = 0,
|
|
172
207
|
Private = 1
|
|
173
208
|
}
|
|
174
|
-
declare enum PreferredFormat {
|
|
175
|
-
MARC21 = 0,
|
|
176
|
-
UNIMARC = 1,
|
|
177
|
-
MARCXML = 2,
|
|
178
|
-
DublinCore = 3,
|
|
179
|
-
MODS = 4,
|
|
180
|
-
BIBFRAME = 5,
|
|
181
|
-
ONIX = 6,
|
|
182
|
-
OPDS = 7,
|
|
183
|
-
InternetArchive = 8,
|
|
184
|
-
HathiTrust = 9,
|
|
185
|
-
EAD = 10,
|
|
186
|
-
Other = 11
|
|
187
|
-
}
|
|
188
209
|
interface PublicLibraryInput {
|
|
189
210
|
name: string;
|
|
190
211
|
physicalAddress: string;
|
|
@@ -192,7 +213,7 @@ interface PublicLibraryInput {
|
|
|
192
213
|
language: string;
|
|
193
214
|
ownership: LibraryOwnership | number;
|
|
194
215
|
website: string;
|
|
195
|
-
preferredFormat:
|
|
216
|
+
preferredFormat: string;
|
|
196
217
|
}
|
|
197
218
|
interface PublicLibrary extends PublicLibraryInput {
|
|
198
219
|
id: number;
|
|
@@ -203,10 +224,13 @@ interface PublicLibraryStorageReadAPI {
|
|
|
203
224
|
libraryExists(id: number): Promise<boolean>;
|
|
204
225
|
getPublicLibrary(id: number): Promise<PublicLibrary>;
|
|
205
226
|
nbLibraries(): Promise<number>;
|
|
227
|
+
formatExists(format: string): Promise<boolean>;
|
|
228
|
+
getAllFormats(): Promise<string[]>;
|
|
206
229
|
}
|
|
207
230
|
interface PublicLibraryStorageWriteAPI {
|
|
208
231
|
addPublicLibrary(input: PublicLibraryInput, options?: TransactionOptions): Promise<any>;
|
|
209
232
|
updatePublicLibrary(id: number, input: PublicLibraryInput, options?: TransactionOptions): Promise<any>;
|
|
233
|
+
addFormat(format: string, options?: TransactionOptions): Promise<any>;
|
|
210
234
|
}
|
|
211
235
|
interface SubscriptionManagerReadAPI {
|
|
212
236
|
getSubscriptions(userId: number): Promise<number[]>;
|
|
@@ -214,6 +238,47 @@ interface SubscriptionManagerReadAPI {
|
|
|
214
238
|
isSubscribed(subscriber: number, target: number): Promise<boolean>;
|
|
215
239
|
scoreOf(userId: number): Promise<bigint>;
|
|
216
240
|
}
|
|
241
|
+
interface DSafeHRStorageReadAPI {
|
|
242
|
+
isStaffOf(libraryId: number, caller: string): Promise<boolean>;
|
|
243
|
+
verifyMember(staff: string): Promise<boolean>;
|
|
244
|
+
getStaffLibraries(staff: string): Promise<number[]>;
|
|
245
|
+
getCurrentRecordCounter(libraryId: number, objectType: number): Promise<number>;
|
|
246
|
+
getLibrarySequence(libraryId: number): Promise<number>;
|
|
247
|
+
getPublishLock(libraryId: number): Promise<[holder: string, acquiredAt: number, active: boolean]>;
|
|
248
|
+
}
|
|
249
|
+
interface RelationshipRecord {
|
|
250
|
+
actorId: number;
|
|
251
|
+
actionId: number;
|
|
252
|
+
objectType: number;
|
|
253
|
+
objectId: bigint;
|
|
254
|
+
tagId: bigint;
|
|
255
|
+
timestamp: number;
|
|
256
|
+
}
|
|
257
|
+
interface RelationshipIndexerReadAPI {
|
|
258
|
+
getByObjectTarget(objectType: number, objectId: bigint, start: number, count: number): Promise<RelationshipRecord[]>;
|
|
259
|
+
getByTagTarget(tagId: bigint, start: number, count: number): Promise<RelationshipRecord[]>;
|
|
260
|
+
getByActor(actorId: number, start: number, count: number): Promise<RelationshipRecord[]>;
|
|
261
|
+
countByObjectTarget(objectType: number, objectId: bigint): Promise<number>;
|
|
262
|
+
countByTagTarget(tagId: bigint): Promise<number>;
|
|
263
|
+
countByActor(actorId: number): Promise<number>;
|
|
264
|
+
/**
|
|
265
|
+
* Returns actor userIds of everyone who interacted with content owned by
|
|
266
|
+
* `targetUserId` after `since`. The frontend can resolve userIds to usernames
|
|
267
|
+
* and offer one-click subscribe.
|
|
268
|
+
*/
|
|
269
|
+
getNewSubscriptionsSince(targetUserId: number, since: number): Promise<number[]>;
|
|
270
|
+
countNewSubscriptionsSince(targetUserId: number, since: number): Promise<number>;
|
|
271
|
+
}
|
|
272
|
+
interface DSafeHRStorageWriteAPI {
|
|
273
|
+
addStaff(libraryId: number, staff: string, options?: TransactionOptions): Promise<any>;
|
|
274
|
+
addStaffBatch(libraryId: number, staffMembers: string[], options?: TransactionOptions): Promise<any>;
|
|
275
|
+
removeStaff(libraryId: number, staff: string, options?: TransactionOptions): Promise<any>;
|
|
276
|
+
removeStaffBatch(libraryId: number, staffMembers: string[], options?: TransactionOptions): Promise<any>;
|
|
277
|
+
acquirePublishLock(libraryId: number, options?: TransactionOptions): Promise<any>;
|
|
278
|
+
releasePublishLock(libraryId: number, options?: TransactionOptions): Promise<any>;
|
|
279
|
+
allocateRecordIds(libraryId: number, objectType: number, count: number, options?: TransactionOptions): Promise<any>;
|
|
280
|
+
bumpLibrarySequence(libraryId: number, options?: TransactionOptions): Promise<any>;
|
|
281
|
+
}
|
|
217
282
|
interface SubscriptionManagerWriteAPI {
|
|
218
283
|
subscribeTo(subscriber: number, target: number, options?: TransactionOptions): Promise<any>;
|
|
219
284
|
unsubscribeFrom(subscriber: number, target: number, options?: TransactionOptions): Promise<any>;
|
|
@@ -226,19 +291,27 @@ interface ReadOnlyDomainAPI {
|
|
|
226
291
|
readonly archivistStorage: ArchivistStorageReadAPI;
|
|
227
292
|
readonly projectManagerStorage: ProjectManagerStorageReadAPI;
|
|
228
293
|
readonly factory: FactoryReadAPI;
|
|
294
|
+
readonly accountManager: AccountManagerReadAPI;
|
|
229
295
|
readonly addressRegistry: AddressRegistryReadAPI;
|
|
230
296
|
readonly subscriptionManager: SubscriptionManagerReadAPI;
|
|
231
297
|
readonly libraryRegistryStorage: LibraryRegistryStorageReadAPI;
|
|
232
298
|
readonly publicLibraryStorage: PublicLibraryStorageReadAPI;
|
|
299
|
+
readonly dSafeHRStorage: DSafeHRStorageReadAPI;
|
|
300
|
+
readonly relationshipIndexerStorage: RelationshipIndexerReadAPI;
|
|
233
301
|
getUsdPrice(): Promise<number>;
|
|
234
302
|
getRegistryStatus(): Promise<any>;
|
|
303
|
+
getNativeBalance(address: string): Promise<bigint>;
|
|
235
304
|
}
|
|
236
305
|
interface WriteOnlyDomainAPI {
|
|
237
306
|
readonly factory: FactoryWriteAPI;
|
|
307
|
+
readonly accountManager: AccountManagerWriteAPI;
|
|
308
|
+
readonly bouncerStorage: BouncerStorageWriteAPI;
|
|
238
309
|
readonly subscriptionManager: SubscriptionManagerWriteAPI;
|
|
239
310
|
readonly addressRegistry: AddressRegistryWriteAPI;
|
|
240
311
|
readonly libraryRegistryStorage: LibraryRegistryStorageWriteAPI;
|
|
241
312
|
readonly publicLibraryStorage: PublicLibraryStorageWriteAPI;
|
|
313
|
+
readonly dSafeHRStorage: DSafeHRStorageWriteAPI;
|
|
314
|
+
sendNative(to: string, amountEth: string): Promise<string>;
|
|
242
315
|
}
|
|
243
316
|
interface ProjectVersion {
|
|
244
317
|
uri: string;
|
|
@@ -290,4 +363,4 @@ interface EvmWalletConnector extends WalletConnector {
|
|
|
290
363
|
getWalletClient(chainId: number): Promise<WalletClient>;
|
|
291
364
|
}
|
|
292
365
|
|
|
293
|
-
export { type AddressRegistryReadAPI as A, type BouncerStorageReadAPI as B, type ConnectResult as C, type EvmWalletConnector as E, type FactoryReadAPI as F, type LibraryRegistryStorageReadAPI as L, type NormalizedError as N, type ProjectVersion as P, type ReadOnlyDomainAPI as R, type ScientistStorageReadAPI as S, type TransactionOptions as T, type WalletType as W, type Project as a, type WalletConnector as b, type ArchivistStorageReadAPI as c, type
|
|
366
|
+
export { type AddressRegistryReadAPI as A, type BouncerStorageReadAPI as B, type ConnectResult as C, type DSafeHRStorageReadAPI as D, type EvmWalletConnector as E, type FactoryReadAPI as F, type RelationshipRecord as G, type ErrorCode as H, type LibraryRegistryStorageReadAPI as L, type NormalizedError as N, type ProjectVersion as P, type ReadOnlyDomainAPI as R, type ScientistStorageReadAPI as S, type TransactionOptions as T, type VotePreset as V, type WalletType as W, type Project as a, type WalletConnector as b, type ArchivistStorageReadAPI as c, type AccountManagerReadAPI as d, type ProjectManagerStorageReadAPI as e, type SubscriptionManagerReadAPI as f, type PublicLibraryStorageReadAPI as g, type RelationshipIndexerReadAPI as h, type WriteOnlyDomainAPI as i, type AccountManagerWriteAPI as j, type BouncerStorageWriteAPI as k, type FactoryWriteAPI as l, type SubscriptionManagerWriteAPI as m, type AddressRegistryWriteAPI as n, type LibraryRegistryStorageWriteAPI as o, type PublicLibraryStorageWriteAPI as p, type DSafeHRStorageWriteAPI as q, type ContractAddresses as r, type StripeDonation as s, type AddressRegistryContractRecord as t, type AddressRegistryUpdateInfo as u, type CollectionInput as v, type Collection as w, LibraryOwnership as x, type PublicLibraryInput as y, type PublicLibrary as z };
|
|
@@ -1,43 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { W as WalletType, P as ProjectVersion, a as Project } from './types-Dn0EFMO_.js';
|
|
3
|
-
|
|
4
|
-
type ChainPrice = {
|
|
5
|
-
stable: true;
|
|
6
|
-
} | {
|
|
7
|
-
stable?: false;
|
|
8
|
-
pythOracle: string;
|
|
9
|
-
usdPriceId: string;
|
|
10
|
-
};
|
|
11
|
-
interface EvmChainConfig {
|
|
12
|
-
chainId: number;
|
|
13
|
-
name: string;
|
|
14
|
-
symbol: string;
|
|
15
|
-
shortName: string;
|
|
16
|
-
decimals: number;
|
|
17
|
-
explorer: string;
|
|
18
|
-
rpc: string;
|
|
19
|
-
website: string;
|
|
20
|
-
main: boolean;
|
|
21
|
-
logo: string;
|
|
22
|
-
price: ChainPrice;
|
|
23
|
-
addresses?: {
|
|
24
|
-
addressRegistry?: string;
|
|
25
|
-
stagingAddressRegistry?: string;
|
|
26
|
-
[contract: string]: string | undefined;
|
|
27
|
-
};
|
|
28
|
-
deployed?: boolean;
|
|
29
|
-
stagingDeployed?: boolean;
|
|
30
|
-
}
|
|
31
|
-
declare const EVM_CHAINS: Record<number, EvmChainConfig>;
|
|
32
|
-
declare const DEFAULT_CHAIN_ID = 1116;
|
|
33
|
-
declare function getChain(chainId: number | string): EvmChainConfig;
|
|
34
|
-
declare function toViemChain(config: EvmChainConfig): Chain;
|
|
1
|
+
import { W as WalletType, P as ProjectVersion, a as Project } from './types-B-IX3HBn.js';
|
|
35
2
|
|
|
36
3
|
interface Web3SessionAccount {
|
|
37
4
|
account: string;
|
|
38
5
|
username: string;
|
|
39
6
|
hasAccount: boolean;
|
|
40
7
|
userId: number;
|
|
8
|
+
/** Highest local patch sequence acknowledged by an upload (not row count). */
|
|
41
9
|
lastPatchIndex: number;
|
|
42
10
|
lastRestorationIndex: number;
|
|
43
11
|
country?: string;
|
|
@@ -82,7 +50,13 @@ interface ProjectLocale {
|
|
|
82
50
|
version: ProjectVersion;
|
|
83
51
|
balance: number;
|
|
84
52
|
}
|
|
85
|
-
declare const projectLocale: (project: Project, userLanguage: string,
|
|
53
|
+
declare const projectLocale: (project: Project, userLanguage: string, _chainId: number) => ProjectLocale;
|
|
54
|
+
/**
|
|
55
|
+
* How long a cached project is served without re-reading the chain. Its voting balance moves
|
|
56
|
+
* with every vote — including the automatic vote-preset share of every new credit — so a
|
|
57
|
+
* cache that never expires shows stale totals; the stale copy stays the offline fallback.
|
|
58
|
+
*/
|
|
59
|
+
declare const PROJECT_CACHE_TTL_MS: number;
|
|
86
60
|
declare const loadProjects: (chainId: number, language: string) => Promise<Array<ProjectLocale | null>>;
|
|
87
61
|
declare const loadProject: (chainId: number, language: string, projectId: number, refresh?: boolean) => Promise<ProjectLocale>;
|
|
88
62
|
|
|
@@ -152,4 +126,4 @@ interface PatchCacheAdapter {
|
|
|
152
126
|
set(key: string, patch: Patch): Promise<void>;
|
|
153
127
|
}
|
|
154
128
|
|
|
155
|
-
export { type
|
|
129
|
+
export { type FetchOptions as F, type ProjectLocale as P, type SyncCursor as S, type Web3SessionAccount as W, type SessionStore as a, type SubscriptionNode as b, type WalkOptions as c, type SubscriptionGraph as d, type Patch as e, type SyncOptions as f, type SyncResult as g, type SessionState as h, PROJECT_CACHE_TTL_MS as i, loadProject as j, type PatchCacheAdapter as k, loadProjects as l, projectLocale as p };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Hex } from 'viem';
|
|
2
|
+
|
|
3
|
+
/** A signature older than this is rejected (limits replay of a captured request). */
|
|
4
|
+
declare const BATCH_AUTHORIZATION_MAX_AGE_MS: number;
|
|
5
|
+
/** Tolerated clock skew for an `issuedAt` slightly in the future. */
|
|
6
|
+
declare const BATCH_AUTHORIZATION_MAX_CLOCK_SKEW_MS: number;
|
|
7
|
+
interface BatchAuthorizationPayload {
|
|
8
|
+
/** Environment the batch is for (`production` / `staging`) — binds the signature to one Lambda. */
|
|
9
|
+
environment: string;
|
|
10
|
+
batchId: string;
|
|
11
|
+
emails: readonly string[];
|
|
12
|
+
forceSendEmail: boolean;
|
|
13
|
+
/** ISO-8601 time of signing. */
|
|
14
|
+
issuedAt: string;
|
|
15
|
+
}
|
|
16
|
+
type BatchAuthorizationFailure = 'invalid_batch_id' | 'invalid_emails' | 'invalid_issued_at' | 'expired' | 'issued_in_future' | 'malformed_signature' | 'signer_mismatch' | 'unauthorized_signer';
|
|
17
|
+
type BatchAuthorizationResult = {
|
|
18
|
+
ok: true;
|
|
19
|
+
signer: `0x${string}`;
|
|
20
|
+
emails: string[];
|
|
21
|
+
} | {
|
|
22
|
+
ok: false;
|
|
23
|
+
reason: BatchAuthorizationFailure;
|
|
24
|
+
};
|
|
25
|
+
/** Lowercased, trimmed, de-duplicated and sorted — the exact set the Lambda processes. */
|
|
26
|
+
declare function normalizeBatchEmails(emails: readonly unknown[]): string[];
|
|
27
|
+
/** keccak256 of the JSON-encoded normalized list (JSON so no two lists can encode alike). */
|
|
28
|
+
declare function hashBatchEmails(emails: readonly string[]): Hex;
|
|
29
|
+
declare function createBatchSigningMessage(payload: BatchAuthorizationPayload): string;
|
|
30
|
+
/** Parses a comma-separated admin list (e.g. the AUTHORIZED_ADMINS secret) into checksummed addresses. */
|
|
31
|
+
declare function parseAuthorizedAdmins(list: string | undefined): `0x${string}`[];
|
|
32
|
+
declare function verifyBatchAuthorization(params: {
|
|
33
|
+
payload: BatchAuthorizationPayload;
|
|
34
|
+
signature: unknown;
|
|
35
|
+
authorizedAdmins: readonly string[];
|
|
36
|
+
/** Optional address the caller claims signed; must match the recovered signer if given. */
|
|
37
|
+
claimedSigner?: unknown;
|
|
38
|
+
now?: number;
|
|
39
|
+
}): Promise<BatchAuthorizationResult>;
|
|
40
|
+
|
|
41
|
+
declare const DELETION_CONSENT_PURPOSE = "EmailConsent";
|
|
42
|
+
/** How long a deletion link stays valid. */
|
|
43
|
+
declare const DELETION_CONSENT_TTL_SECONDS: number;
|
|
44
|
+
interface DeletionConsent {
|
|
45
|
+
/** Account to retire — the only address allowed to redeem the consent. */
|
|
46
|
+
account: `0x${string}`;
|
|
47
|
+
chainId: number;
|
|
48
|
+
/** AccountManager the consent is for (binds it to one deployment). */
|
|
49
|
+
accountManager: `0x${string}`;
|
|
50
|
+
/** Unix seconds after which the contract rejects it. */
|
|
51
|
+
expiry: number;
|
|
52
|
+
}
|
|
53
|
+
interface SignedDeletionConsent extends DeletionConsent {
|
|
54
|
+
signature: Hex;
|
|
55
|
+
}
|
|
56
|
+
declare function deletionConsentMessageHash(consent: DeletionConsent): Hex;
|
|
57
|
+
/** Signs as the oracle. `signMessage` is a viem LocalAccount's (or a wallet client's bound) signMessage. */
|
|
58
|
+
declare function signDeletionConsent(consent: DeletionConsent, signMessage: (args: {
|
|
59
|
+
message: {
|
|
60
|
+
raw: Hex;
|
|
61
|
+
};
|
|
62
|
+
}) => Promise<Hex>): Promise<SignedDeletionConsent>;
|
|
63
|
+
type DeletionConsentFailure = 'malformed' | 'expired' | 'wrong_chain' | 'wrong_account_manager' | 'signer_mismatch';
|
|
64
|
+
type DeletionConsentCheck = {
|
|
65
|
+
ok: true;
|
|
66
|
+
consent: SignedDeletionConsent;
|
|
67
|
+
} | {
|
|
68
|
+
ok: false;
|
|
69
|
+
reason: DeletionConsentFailure;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* The browser-side sanity check before sending the transaction — the contract
|
|
73
|
+
* repeats all of it, so this only exists to fail early with a clear message.
|
|
74
|
+
* `oracleSigner` and `accountManager` must come from the chain/registry, never
|
|
75
|
+
* from the link itself.
|
|
76
|
+
*/
|
|
77
|
+
declare function verifyDeletionConsent(consent: SignedDeletionConsent, expected: {
|
|
78
|
+
chainId: number;
|
|
79
|
+
accountManager: string;
|
|
80
|
+
oracleSigner: string;
|
|
81
|
+
now?: number;
|
|
82
|
+
}): Promise<DeletionConsentCheck>;
|
|
83
|
+
declare function encodeDeletionConsentToken(consent: SignedDeletionConsent): string;
|
|
84
|
+
/** Parses a token's shape only — call verifyDeletionConsent before trusting it. */
|
|
85
|
+
declare function decodeDeletionConsentToken(token: string): SignedDeletionConsent | null;
|
|
86
|
+
/** The confirmation URL (hash routing, like buildRestoreLink). */
|
|
87
|
+
declare function buildConfirmDeleteLink(token: string, frontendUrl: string): string;
|
|
88
|
+
|
|
89
|
+
export { BATCH_AUTHORIZATION_MAX_AGE_MS, BATCH_AUTHORIZATION_MAX_CLOCK_SKEW_MS, type BatchAuthorizationFailure, type BatchAuthorizationPayload, type BatchAuthorizationResult, DELETION_CONSENT_PURPOSE, DELETION_CONSENT_TTL_SECONDS, type DeletionConsent, type DeletionConsentCheck, type DeletionConsentFailure, type SignedDeletionConsent, buildConfirmDeleteLink, createBatchSigningMessage, decodeDeletionConsentToken, deletionConsentMessageHash, encodeDeletionConsentToken, hashBatchEmails, normalizeBatchEmails, parseAuthorizedAdmins, signDeletionConsent, verifyBatchAuthorization, verifyDeletionConsent };
|