@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
package/dist/models/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import { V as VersionsFile, c as VersionLayout, u as uid, O as Orm, Q as QueueItem, d as IThread, E as EvmPayload,
|
|
3
|
-
export {
|
|
4
|
-
export { L as LevelState, g as getLevel, s as subscribeLevel } from '../level-state-
|
|
5
|
-
import '
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export { CLASSIFICATIONSYSTEM_PROP_IDS, ClassificationSystem, ClassificationSystemExtendedCols, ClassificationSystemInput, ClassificationSystemProvCols, ClassificationSystemSlimCols, ModelClass, ModelTypes, NewClassificationSystemWithId, NewPostWithId, POST_PROP_IDS, Post, PostExtendedCols, PostInput, PostProvCols, PostSlimCols, deserializeClassificationSystemExtended, deserializeClassificationSystemProv, deserializeClassificationSystemSlim, deserializePostExtended, deserializePostProv, deserializePostSlim, serializeClassificationSystemExtended, serializeClassificationSystemProv, serializeClassificationSystemSlim, serializePostExtended, serializePostProv, serializePostSlim } from './models.js';
|
|
2
|
+
import { V as VersionsFile, c as VersionLayout, u as uid, O as Orm, Q as QueueItem, d as IThread, e as LocalOp, A as AnyActionPatch, E as EvmPayload, f as AnyPatch, F as FileRecord, g as BookData, L as Lang } from '../orm-MJTHCG9E.js';
|
|
3
|
+
export { aT as AGE_GRADE_BAND_PROP, a9 as ActionOperation, h as ActionTypes, ak as AddInstanceObj, aq as BaseActionPatch, n as BaseLocalOp, ad as BasePatch, B as BridgeDefinition, K as BridgeLink, J as BridgeRelation, M as BridgeSystemConversions, C as CommonOrmJson, aI as Config, aj as CreateRecordObj, aF as CryptoRandomUidFactory, aW as DELETED_PROP, aR as DESCRIPTION_PROP, D as DeepCollectOptions, am as DeleteBridgeObj, as as DownloadActionObj, k as DownloadState, az as DownloadsByType, ah as EditInstanceFieldNumberObj, ag as EditInstanceFieldStringObj, af as EditPropertyNumberObj, ae as EditPropertyStringObj, ai as EditRelationObj, ao as EnumLayout, aB as FavoritesByTypes, G as GetRecordPayload, b1 as INSTANCE_REMAPS_COLUMN, w as InitPayload, I as InstanceData, m as LANG_AGNOSTIC, a8 as LANG_ID_DECODE, a7 as LANG_ID_ENCODE, aX as LIFECYCLE_STATUS_PROP, aH as LifecycleStatus, y as LoadLanguagePayload, al as MergeProposalObj, Z as ModelDefinition, aS as ORIGINAL_LANG_PROP, aU as PREVIEW_TX_ID_PROP, b0 as PROPERTY_SLOTS_COLUMN, aN as PROVENANCE_AI, aP as PROVENANCE_CONSENSUS, aO as PROVENANCE_MANUAL_LOCAL, aM as PROVENANCE_UNSET, p as PartOp, a1 as PatchAction, a0 as PatchOperation, ay as PopulateStatsStore, ap as PropLayout, a$ as PropertySlots, P as PropertyType, b2 as REPLAY_METADATA_COLUMNS, at as RateActionObj, o as RateOp, au as RatePartActionObj, q as RatePartOp, i as Rating, R as RecordIdentityCluster, $ as Registry, aV as SAFE_PROP, x as SavePatchesPayload, Y as SchemaIndex, T as SchemaInstanceField, N as SchemaProp, _ as SchemaRegistry, U as SchemaRelation, b as SerializedCommonOrmJson, av as ShareActionObj, r as ShareOp, aw as SharePartActionObj, s as SharePartOp, S as SidecarType, a as SidecarUrls, H as StatSummary, aC as Stats, aQ as TITLE_PROP, aD as UidFactory, an as VersionEntry, ar as VisitActionObj, aA as VisitsByType, W as WorkerCommands, j as WorkerEvent, z as WorkerPayload, a6 as evmToPatch, l as fromJsonId, a_ as inflateOrmJson, aa as isActionOperation, v as isEvmPatch, aE as isUserCreated, aG as loadOrInitUidFactory, ab as packActionPatch, a2 as packPatch, a5 as patchToEvm, X as relationColName, a4 as resolveLayout, b3 as scalarProperties, aZ as serializeMapOfMaps, aY as serializeMapOfSets, aJ as setDefaultLanguage, aK as setDefaultProvenance, aL as setLoadAiSidecars, ax as subscribeStats, t as toJsonId, ac as unpackActionPatch, a3 as unpackPatch } from '../orm-MJTHCG9E.js';
|
|
4
|
+
export { C as COIN_LEDGER_POST_TITLE_PREFIX, L as LevelState, P as POINTS_PER_LEVEL, a as POINTS_PER_SILVER_COIN, S as SILVER_COINS_PER_LEVEL, g as getLevel, s as subscribeLevel } from '../level-state-DXqglpAX.js';
|
|
5
|
+
import { T as Tag, B as Book, e as BookInput, D as TagInput, o as PersonInput } from '../Book-CYyj_y_4.js';
|
|
6
|
+
export { a as BOOK_PROP_IDS, c as BookExtendedCols, k as BookInstance, d as BookProvCols, b as BookSlimCols, N as NewBookWithId, x as NewPersonWithId, K as NewTagWithId, P as PERSON_PROP_IDS, w as Person, m as PersonExtendedCols, n as PersonProvCols, l as PersonSlimCols, y as TAG_PROP_IDS, A as TagExtendedCols, C as TagProvCols, z as TagSlimCols, h as deserializeBookExtended, j as deserializeBookProv, f as deserializeBookSlim, t as deserializePersonExtended, v as deserializePersonProv, q as deserializePersonSlim, H as deserializeTagExtended, J as deserializeTagProv, F as deserializeTagSlim, g as serializeBookExtended, i as serializeBookProv, s as serializeBookSlim, r as serializePersonExtended, u as serializePersonProv, p as serializePersonSlim, G as serializeTagExtended, I as serializeTagProv, E as serializeTagSlim } from '../Book-CYyj_y_4.js';
|
|
7
|
+
export { A as AiResultEntry, b as ColumnData, C as ColumnType, I as InstanceFieldSpec, P as ParsedSidecar, a as SIDECAR_FORMAT_VERSION, S as SIDECAR_MAGIC, g as SidecarColumn, d as SidecarHeader, j as SidecarInput, h as SidecarRelationInput, e as colsFromSidecar, c as columnTypeForBits, k as deserializeAiSidecar, f as extractRecordCols, i as instanceSpecFromFields, p as parseSidecar, s as serializeAiSidecar, w as writeSidecar } from '../enriched-index-T0sDG7JR.js';
|
|
8
|
+
export { A as AiResultsMap, o as BOOK_CURATABLE_PRESETS, p as BOOK_FIELD_WEIGHTS, n as BOOK_SEARCH_SCHEMA, B as BookSearchLangState, D as BookSearchService, t as BookSearchSource, z as BookSearchStatus, P as PresetFilter, c as SEARCH_SHARD_FORMAT_VERSION, b as SEARCH_SHARD_MAGIC, g as SearchDocInput, S as SearchFilters, x as SearchHit, y as SearchIndex, w as SearchIndexOptions, d as SearchPresetKind, e as SearchPresetSpec, v as SearchQuery, a as SearchResult, j as SearchShard, i as SearchShardPreset, h as SearchShardRelation, f as SearchShardSchema, F as bookSearch, u as bookSearchDoc, q as bookSearchPresets, C as bookSearchSourceFromRecord, l as buildSearchShard, k as compareBigint, m as deserializeSearchShard, E as expandTopics, r as latestAiValue, s as serializeSearchShard } from '../bookSearchService-YQskauJS.js';
|
|
8
9
|
import '@the_library/standard-adapters/lcc';
|
|
9
10
|
import '@the_library/standard-adapters/ddc';
|
|
10
11
|
import '@the_library/standard-adapters/udc';
|
|
@@ -13,6 +14,8 @@ import '@the_library/standard-adapters/bbk';
|
|
|
13
14
|
import '@the_library/standard-adapters/tlc';
|
|
14
15
|
import '@the_library/standard-adapters/cc';
|
|
15
16
|
import '@the_library/standard-adapters/isbn';
|
|
17
|
+
import '@the_library/standard-adapters/isni';
|
|
18
|
+
import '@the_library/standard-adapters/orcid';
|
|
16
19
|
|
|
17
20
|
/** The compiled layout dictionary shipped with @the_library/db_schemas. */
|
|
18
21
|
declare const versionsFile: VersionsFile;
|
|
@@ -45,13 +48,14 @@ declare class LruCache<K, V> {
|
|
|
45
48
|
limit: number;
|
|
46
49
|
private map;
|
|
47
50
|
private _pinned;
|
|
51
|
+
private pinReasons;
|
|
48
52
|
private _warnedOverflow;
|
|
49
53
|
constructor(limit: number);
|
|
50
54
|
get size(): number;
|
|
51
55
|
get(key: K): V | undefined;
|
|
52
56
|
set(key: K, val: V): void;
|
|
53
|
-
pin(key: K): void;
|
|
54
|
-
unpin(key: K): void;
|
|
57
|
+
pin(key: K, reason?: string): void;
|
|
58
|
+
unpin(key: K, reason?: string): void;
|
|
55
59
|
has(key: K): boolean;
|
|
56
60
|
delete(key: K): void;
|
|
57
61
|
clear(): void;
|
|
@@ -64,7 +68,12 @@ declare const configureDb: (opts: {
|
|
|
64
68
|
}) => void;
|
|
65
69
|
declare const clear: () => void;
|
|
66
70
|
declare const dump: () => Map<number, LruCache<string, any>>;
|
|
67
|
-
declare function
|
|
71
|
+
declare function setDefaultCreatorUsername(username: string | undefined): void;
|
|
72
|
+
/** Current ambient default, so a caller that temporarily overrides it (e.g.
|
|
73
|
+
* hydrateAll()) can restore the previous value afterward instead of
|
|
74
|
+
* clobbering a session-wide default a host app already set. */
|
|
75
|
+
declare function getDefaultCreatorUsername(): string | undefined;
|
|
76
|
+
declare function getRecordKey(wireId: uid, creatorUsername?: string): string;
|
|
68
77
|
declare const hasRecord: (objectType: number, id: uid, creatorUsername?: string) => boolean;
|
|
69
78
|
/** Synchronous read. Throws on LRU miss — use the model's LoadAsync for re-hydration. */
|
|
70
79
|
declare const getRecord: (objectType: number, id: uid, creatorUsername?: string) => any;
|
|
@@ -72,8 +81,32 @@ declare const addRecord: (objectType: number, obj: {
|
|
|
72
81
|
id: uid;
|
|
73
82
|
}, creatorUsername?: string) => void;
|
|
74
83
|
declare const removeRecord: (objectType: number, id: uid, creatorUsername?: string) => void;
|
|
75
|
-
declare const pinRecord: (objectType: number, id: uid, creatorUsername?: string) => void;
|
|
76
|
-
|
|
84
|
+
declare const pinRecord: (objectType: number, id: uid, creatorUsername?: string, reason?: string) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Resolve a batch of ids to records, re-hydrating any that were evicted from
|
|
87
|
+
* the LRU cache instead of treating a `Has() === false` miss as nonexistence
|
|
88
|
+
* (SPEC §2.5 — eviction is not deletion). A `.catch()` on each `LoadAsync`
|
|
89
|
+
* isolates a genuinely-missing/stale id so it can't fail the whole batch; the
|
|
90
|
+
* `Has()` re-check after hydration drops exactly those ids before the
|
|
91
|
+
* synchronous `Load()` (which throws on a still-absent id).
|
|
92
|
+
*
|
|
93
|
+
* Shared by every generated relation-object getter and index-query method —
|
|
94
|
+
* the single place this pattern is implemented.
|
|
95
|
+
*/
|
|
96
|
+
type LoadAsyncCapable<T = any> = {
|
|
97
|
+
Has(id: uid): boolean;
|
|
98
|
+
Load(id: uid): T;
|
|
99
|
+
LoadAsync(id: uid): Promise<T>;
|
|
100
|
+
};
|
|
101
|
+
declare function loadManyAsync<T>(ModelClass: LoadAsyncCapable<T>, ids: uid[]): Promise<T[]>;
|
|
102
|
+
/**
|
|
103
|
+
* Resolve a single id to a record, re-hydrating it if it was evicted from the
|
|
104
|
+
* LRU cache. Returns null when the record cannot be resolved.
|
|
105
|
+
*/
|
|
106
|
+
declare function loadOneAsync<T>(ModelClass: LoadAsyncCapable<T>, id: uid): Promise<T | null>;
|
|
107
|
+
declare function registerModelClass(objectType: number, cls: LoadAsyncCapable): void;
|
|
108
|
+
declare function getModelClass(objectType: number): LoadAsyncCapable | undefined;
|
|
109
|
+
declare const unpinRecord: (objectType: number, id: uid, creatorUsername?: string, reason?: string) => void;
|
|
77
110
|
|
|
78
111
|
declare const inceptionDate: number;
|
|
79
112
|
declare const DateUtils: {
|
|
@@ -110,9 +143,28 @@ declare const proResolver: <A>() => ProResolver<A>;
|
|
|
110
143
|
* with the result of the ultimate single execution.
|
|
111
144
|
*/
|
|
112
145
|
declare function debouncePromise<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>;
|
|
146
|
+
type SyncStatus = 'idle' | 'pending' | 'error';
|
|
113
147
|
declare class Patches {
|
|
114
148
|
username: string;
|
|
115
149
|
protected _patches: Array<QueueItem>;
|
|
150
|
+
private pendingPins;
|
|
151
|
+
private pendingEvents;
|
|
152
|
+
private authorshipListeners;
|
|
153
|
+
private syncStatusListeners;
|
|
154
|
+
private activeSync?;
|
|
155
|
+
private _syncStatus;
|
|
156
|
+
private _retryAttempt;
|
|
157
|
+
private _retryTimer;
|
|
158
|
+
private static readonly MAX_SYNC_RETRIES;
|
|
159
|
+
private static readonly SYNC_RETRY_BASE_MS;
|
|
160
|
+
/** Durable/pending/error state of the last sync() attempt — for UI (e.g. a save indicator). */
|
|
161
|
+
get syncStatus(): SyncStatus;
|
|
162
|
+
private setSyncStatus;
|
|
163
|
+
/** Subscribe to syncStatus transitions. Returns an unsubscribe function. */
|
|
164
|
+
onSyncStatus(listener: (status: SyncStatus) => void): () => void;
|
|
165
|
+
/** Capture optimistic edits while a cache-miss request is in flight. */
|
|
166
|
+
observePending(listener: (op: QueueItem) => void): () => void;
|
|
167
|
+
private releasePins;
|
|
116
168
|
protected thread: IThread;
|
|
117
169
|
static _replaying: boolean;
|
|
118
170
|
get patches(): Array<QueueItem>;
|
|
@@ -124,6 +176,18 @@ declare class Patches {
|
|
|
124
176
|
static setReplay(replay: boolean): void;
|
|
125
177
|
/** Drops all queued (not yet persisted) patches. Test/reset helper. */
|
|
126
178
|
clearQueue(): void;
|
|
179
|
+
private cancelRetry;
|
|
180
|
+
/**
|
|
181
|
+
* Retries a failed sync automatically instead of waiting for the next
|
|
182
|
+
* edit to trigger one — a queue that fails while nothing else is being
|
|
183
|
+
* edited would otherwise sit on unsent data indefinitely. Calls the raw
|
|
184
|
+
* (undebounced) prototype method directly: `this.sync` is the debounced
|
|
185
|
+
* wrapper `initThread` installs, and calling that here would let a
|
|
186
|
+
* steady stream of incoming edits keep pushing the retry itself further
|
|
187
|
+
* out — compounding the exact "can be indefinitely postponed" problem
|
|
188
|
+
* this is fixing, instead of fixing it.
|
|
189
|
+
*/
|
|
190
|
+
private scheduleRetry;
|
|
127
191
|
addPatch(op: QueueItem): void;
|
|
128
192
|
/**
|
|
129
193
|
* Last-Writer-Wins consolidation. Walks the queue from the newest entry
|
|
@@ -139,21 +203,42 @@ declare class Patches {
|
|
|
139
203
|
* Syncs the queued patches to the worker (IndexedDB persistence).
|
|
140
204
|
* Before initThread, patches are retained in the queue (never dropped);
|
|
141
205
|
* initThread flushes them as soon as the worker is available.
|
|
206
|
+
*
|
|
207
|
+
* A failed attempt schedules its own retry (see scheduleRetry) instead of
|
|
208
|
+
* only relying on the next edit to trigger one — a queue that fails while
|
|
209
|
+
* the user makes no further edits would otherwise sit on unsent,
|
|
210
|
+
* non-durable data indefinitely.
|
|
142
211
|
*/
|
|
143
212
|
sync(): Promise<any>;
|
|
213
|
+
private persistQueued;
|
|
214
|
+
static contributionScore(data: Array<QueueItem>): number;
|
|
144
215
|
static calculateLevel(username: string): Promise<number>;
|
|
145
216
|
}
|
|
146
217
|
declare const PatchInstance: Patches;
|
|
218
|
+
/**
|
|
219
|
+
* Translates a local analytics op to its EVM wire form. Returns null for
|
|
220
|
+
* VisitPart — the 4-bit opcode nibble is fully exhausted (see ActionOperation's
|
|
221
|
+
* warning comment in patchCodecs.ts) and VisitPart lost the draw, so it stays
|
|
222
|
+
* local-only, same as every ActionTypes op was before this.
|
|
223
|
+
*/
|
|
224
|
+
declare const localOpToActionPatch: (op: LocalOp) => AnyActionPatch | null;
|
|
225
|
+
/** Reverses localOpToActionPatch, for restored patches landing back in IndexedDB. */
|
|
226
|
+
declare const actionPatchToLocalOp: (patch: AnyActionPatch) => LocalOp;
|
|
147
227
|
/**
|
|
148
228
|
* Restores patches received from the blockchain into IndexedDB.
|
|
149
229
|
* Decoding is layout-driven: the payload's `version` selects the codec
|
|
150
230
|
* layout from versions.json (delta-merged via resolveLayout).
|
|
151
231
|
*/
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
232
|
+
interface PatchSource {
|
|
233
|
+
/** Stable deployment/account stream identity, supplied by the chain reader. */
|
|
234
|
+
streamId: string;
|
|
235
|
+
/** Absolute wire-word position of the first item in this payload. */
|
|
236
|
+
fromIndex: number;
|
|
237
|
+
}
|
|
238
|
+
declare const deserializePatches: (username: string, payload: EvmPayload, source?: PatchSource) => Promise<void>;
|
|
239
|
+
/** Encode a captured source window. Compaction never changes its acknowledgement boundary. */
|
|
240
|
+
declare const serializePatchRows: (rows: Array<QueueItem>) => EvmPayload;
|
|
241
|
+
/** Exclusive saved-through / inclusive captured-through sequence window. */
|
|
157
242
|
declare const serializePatches: (fromIndex: number, toIndex: number) => Promise<EvmPayload>;
|
|
158
243
|
declare const getPatchInstanceByAccount: (account: string) => Patches;
|
|
159
244
|
|
|
@@ -174,9 +259,8 @@ declare const getPatchInstanceByAccount: (account: string) => Patches;
|
|
|
174
259
|
* Local analytics ops carry no object edit and are ignored here (they feed the
|
|
175
260
|
* stats store on boot).
|
|
176
261
|
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
* propagation and future code paths might).
|
|
262
|
+
* Replay uses non-emitting application methods. No global flag is held across
|
|
263
|
+
* asynchronous hydration or IndexedDB work: concurrent setters still persist.
|
|
180
264
|
*
|
|
181
265
|
* Idempotent: re-applying the same ops converges to the same state
|
|
182
266
|
* (`patch()` is a last-writer-wins assignment / Set add-remove).
|
|
@@ -190,7 +274,7 @@ declare const applyRestoredPatches: (ops: Array<AnyPatch>, creatorUsername?: str
|
|
|
190
274
|
|
|
191
275
|
interface TrashStore {
|
|
192
276
|
/** Merge ids across a set of usernames. Empty array (default) = every known username. */
|
|
193
|
-
list(objectType: number, usernames?: string[]):
|
|
277
|
+
list(objectType: number, usernames?: string[]): uid[];
|
|
194
278
|
count(objectType: number, usernames?: string[]): number;
|
|
195
279
|
/** Usernames currently bucketed for this objectType (e.g. to populate a picker). */
|
|
196
280
|
usernames(objectType: number): string[];
|
|
@@ -211,7 +295,64 @@ declare function scanTrash(): void;
|
|
|
211
295
|
declare function _resetForTest(): void;
|
|
212
296
|
declare const trashStore: TrashStore;
|
|
213
297
|
|
|
214
|
-
|
|
298
|
+
interface Trashable {
|
|
299
|
+
deleted: boolean;
|
|
300
|
+
safe: boolean;
|
|
301
|
+
}
|
|
302
|
+
type TreeNode = Tag | Book;
|
|
303
|
+
declare function isIndependentlyTrashed(record: Trashable): boolean;
|
|
304
|
+
/** Inverse of trash.ts's `isTrashed` OR — clears both possible causes. */
|
|
305
|
+
declare function untrashRecord(record: Trashable): void;
|
|
306
|
+
/**
|
|
307
|
+
* Freezes a record's current (inherited) hidden state as its own trash entry.
|
|
308
|
+
* No-op if the record already carries independent flags — pinning something
|
|
309
|
+
* already independently trashed would be redundant.
|
|
310
|
+
*/
|
|
311
|
+
declare function pinAsTrashed(record: Trashable): void;
|
|
312
|
+
declare function childrenOf(node: TreeNode): Promise<TreeNode[]>;
|
|
313
|
+
/**
|
|
314
|
+
* restore=false (default): pin `node` in place — it and everything below it
|
|
315
|
+
* stays exactly as hidden as it was, just via its own flag now instead of
|
|
316
|
+
* inheritance. restore=true: fully open `node` and keep walking down.
|
|
317
|
+
* Either way, a node that's already independently trashed is left alone and
|
|
318
|
+
* recursion stops there.
|
|
319
|
+
*/
|
|
320
|
+
declare function cascadeRestore(node: TreeNode, restore: boolean): Promise<void>;
|
|
321
|
+
/**
|
|
322
|
+
* Given the mandatory restore path (the record being restored + every
|
|
323
|
+
* ancestor/container standing between it and visibility, ordered leaf to
|
|
324
|
+
* root), collects every sibling hanging off that path — at every level, plus
|
|
325
|
+
* the leaf's own children — that a restore would otherwise silently expose.
|
|
326
|
+
* The node one step closer to the leaf is excluded at each level (that's the
|
|
327
|
+
* path itself, not a "sibling").
|
|
328
|
+
*/
|
|
329
|
+
declare function buildCascadeCandidates(path: TreeNode[]): Promise<TreeNode[]>;
|
|
330
|
+
/**
|
|
331
|
+
* Executes a complex restore from the UI selection.
|
|
332
|
+
* @param target The target item to restore.
|
|
333
|
+
* @param ancestors The required ancestors (highest deleted ancestor is last).
|
|
334
|
+
* @param selectedIds The set of string IDs that the user opted to restore.
|
|
335
|
+
* @param rootNode The node being used as the tree root (usually the highest deleted ancestor, or the target itself if destination was changed).
|
|
336
|
+
* @param applyDestinationChange Optional callback to apply reparenting if destination changed.
|
|
337
|
+
*/
|
|
338
|
+
declare function executeComplexRestore(target: Tag | Book, ancestors: Tag[], selectedIds: Set<string>, rootNode: Tag | Book, applyDestinationChange?: () => void): Promise<void>;
|
|
339
|
+
/** Collect ancestors of tag up to Level 1 (tags with no inTags). */
|
|
340
|
+
declare function collectAncestors(tag: Tag, visited?: Set<bigint>): Promise<Tag[]>;
|
|
341
|
+
/**
|
|
342
|
+
* Ancestors of `tag`, stopping at (and excluding) the first ancestor that is
|
|
343
|
+
* not itself independently trashed. This — not the unfiltered
|
|
344
|
+
* `collectAncestors` above — is the correct input for a restore's mandatory
|
|
345
|
+
* path / `buildCascadeCandidates`: an ancestor that was never hiding
|
|
346
|
+
* anything has no "newly exposed" subtree, so walking past it and pinning
|
|
347
|
+
* *its* other children (via `cascadeRestore`) marks unrelated, never-trashed
|
|
348
|
+
* siblings as deleted as a side effect. `collectAncestors` stays as-is for
|
|
349
|
+
* display/breadcrumb callers that genuinely want the full chain to the root.
|
|
350
|
+
*/
|
|
351
|
+
declare function collectTrashedAncestors(tag: Tag, visited?: Set<bigint>): Promise<Tag[]>;
|
|
352
|
+
/** Recursive count of every descendant tag under `tag` (not including itself). */
|
|
353
|
+
declare function countRecursiveSubfolders(tag: Tag, visited?: Set<bigint>): Promise<number>;
|
|
354
|
+
|
|
355
|
+
declare const version = 5;
|
|
215
356
|
declare const dbName = "the_world_library";
|
|
216
357
|
declare const patchStoreName = "patches";
|
|
217
358
|
declare const jsonStoreName = "catalog_json";
|
|
@@ -241,4 +382,289 @@ declare const hasBookData: (fileId: string) => Promise<boolean>;
|
|
|
241
382
|
declare const loadBookData: (fileId: string) => Promise<BookData | undefined>;
|
|
242
383
|
declare const storeBookData: (record: BookData) => Promise<boolean>;
|
|
243
384
|
|
|
244
|
-
|
|
385
|
+
interface LocalRecordEntry {
|
|
386
|
+
wireId: uid;
|
|
387
|
+
creatorUsername: string;
|
|
388
|
+
objectType: number;
|
|
389
|
+
createdAt: number;
|
|
390
|
+
status: 'active' | 'submitted' | 'community_pending' | 'canonical';
|
|
391
|
+
canonicalId?: number;
|
|
392
|
+
}
|
|
393
|
+
declare class LocalRecordTable {
|
|
394
|
+
private db;
|
|
395
|
+
instanceRemaps: IDBInstanceRemapStore;
|
|
396
|
+
constructor();
|
|
397
|
+
/** Called once at app startup, before any createNew() call — mirrors PatchInstance.initThread(). */
|
|
398
|
+
init(db: IDBDatabase): void;
|
|
399
|
+
get idb(): IDBDatabase;
|
|
400
|
+
put(entry: LocalRecordEntry): Promise<void>;
|
|
401
|
+
putIfAbsent(entry: LocalRecordEntry): Promise<void>;
|
|
402
|
+
get(creatorUsername: string, wireId: uid): Promise<LocalRecordEntry | undefined>;
|
|
403
|
+
getByCreator(creatorUsername: string): Promise<LocalRecordEntry[]>;
|
|
404
|
+
setStatus(creatorUsername: string, wireId: uid, status: LocalRecordEntry['status']): Promise<void>;
|
|
405
|
+
setCanonicalId(creatorUsername: string, wireId: uid, canonicalId: number): Promise<void>;
|
|
406
|
+
}
|
|
407
|
+
declare class IDBInstanceRemapStore {
|
|
408
|
+
private table;
|
|
409
|
+
constructor(table: LocalRecordTable);
|
|
410
|
+
get(objectId: uid, langId: number, creatorUsername: string, originalIndex: number): Promise<number | undefined>;
|
|
411
|
+
put(objectId: uid, langId: number, creatorUsername: string, originalIndex: number, realIndex: number): Promise<void>;
|
|
412
|
+
}
|
|
413
|
+
/** Module-level singleton — import and call directly from generated model files. */
|
|
414
|
+
declare const localRecordTable: LocalRecordTable;
|
|
415
|
+
|
|
416
|
+
declare function mergeBookTiers(slimBuf: ArrayBuffer, extBuf: ArrayBuffer, provBuf: ArrayBuffer): BookInput[];
|
|
417
|
+
declare function mergeTagTiers(slimBuf: ArrayBuffer, extBuf: ArrayBuffer, provBuf: ArrayBuffer): TagInput[];
|
|
418
|
+
declare function mergePersonTiers(slimBuf: ArrayBuffer, extBuf: ArrayBuffer, provBuf: ArrayBuffer): PersonInput[];
|
|
419
|
+
|
|
420
|
+
declare class IndexDependencyNode {
|
|
421
|
+
readonly objectType: number;
|
|
422
|
+
readonly indexName: string;
|
|
423
|
+
readonly keyPath: string;
|
|
424
|
+
constructor(objectType: number, indexName: string, keyPath: string);
|
|
425
|
+
}
|
|
426
|
+
declare function classifyValue(classifier: any, value: any): any[];
|
|
427
|
+
declare class ModelIndex {
|
|
428
|
+
readonly objectType: number;
|
|
429
|
+
readonly name: string;
|
|
430
|
+
readonly keys: string[];
|
|
431
|
+
readonly classifier?: any | undefined;
|
|
432
|
+
private langIndex;
|
|
433
|
+
private reverseMap;
|
|
434
|
+
private depNodes;
|
|
435
|
+
constructor(objectType: number, name: string, keys: string[], classifier?: any | undefined);
|
|
436
|
+
private getOrCreateDepNode;
|
|
437
|
+
/** Helper to traverse the index tree to add a UID */
|
|
438
|
+
private addToTree;
|
|
439
|
+
/** Helper to traverse the index tree to remove a UID */
|
|
440
|
+
private removeFromTree;
|
|
441
|
+
/**
|
|
442
|
+
* Trigger reactivity for a mutated key path: the exact-path node plus any
|
|
443
|
+
* existing nodes registered on its prefixes (partial-path queries such as
|
|
444
|
+
* byNotationPrefix, and getAvailableKeys/getAvailableRawValues listeners).
|
|
445
|
+
* Prefix nodes are only triggered when they already exist — a node is only
|
|
446
|
+
* created by a query, so a missing node has no subscribers.
|
|
447
|
+
*/
|
|
448
|
+
private triggerPath;
|
|
449
|
+
/** Ingestion/mutation tracking via raw values (used during sidecar boot) */
|
|
450
|
+
trackRaw(id: uid, lang: Lang, rawValues: any[]): void;
|
|
451
|
+
/** Ingestion/mutation tracking via Orm record instance */
|
|
452
|
+
trackRecord(record: Orm, lang: Lang): void;
|
|
453
|
+
/** Untrack record (used on deletion) */
|
|
454
|
+
untrack(id: uid, lang: Lang): void;
|
|
455
|
+
/** Languages under which this uid currently has an index entry. */
|
|
456
|
+
getTrackedLangs(id: uid): Lang[];
|
|
457
|
+
/** Query UIDs by resolved composite key path */
|
|
458
|
+
getUids(keysPath: any[], lang: Lang): Set<uid>;
|
|
459
|
+
/** Query UIDs by raw string value (runs the classifier if present) */
|
|
460
|
+
getUidsByRawValue(value: any, lang: Lang): Set<uid>;
|
|
461
|
+
/** Get available sub-keys under a partial path prefix */
|
|
462
|
+
getAvailableKeys(prefixPath: any[], lang: Lang): string[];
|
|
463
|
+
/** Get all raw top-level values currently indexed (e.g. including partition prefix if classified) */
|
|
464
|
+
getAvailableRawValues(lang: Lang): string[];
|
|
465
|
+
}
|
|
466
|
+
declare class IndexRegistryClass {
|
|
467
|
+
private indexes;
|
|
468
|
+
registerIndex(objectType: number, index: ModelIndex): void;
|
|
469
|
+
getIndex(objectType: number, name: string): ModelIndex;
|
|
470
|
+
hasIndexForProperty(objectType: number, propId: number): boolean;
|
|
471
|
+
/**
|
|
472
|
+
* Manually (re-)index a fully populated record across its loaded languages.
|
|
473
|
+
* NOT called from db.addRecord — records self-register before their values
|
|
474
|
+
* are merged, so hooking ingestion would index empty keys. Normal feeds are
|
|
475
|
+
* bootstrapSidecars (boot) and updateIndex via Orm.patch (mutations).
|
|
476
|
+
*/
|
|
477
|
+
trackRecord(objectType: number, record: Orm): void;
|
|
478
|
+
/**
|
|
479
|
+
* Intercept individual property patches to update index tree paths.
|
|
480
|
+
*
|
|
481
|
+
* Re-tracks every language the record participates in, not just the
|
|
482
|
+
* patch's language: a lang-agnostic edit (langId 0) changes the resolved
|
|
483
|
+
* value for *every* language via the ORM fallback chain (exact → agnostic
|
|
484
|
+
* → single-value), and queries always read a concrete-language bucket.
|
|
485
|
+
*/
|
|
486
|
+
updateIndex(objectType: number, propId: number, record: Orm): void;
|
|
487
|
+
/** Get available raw string keys loaded in this index for the given language */
|
|
488
|
+
getAvailableRawValues(objectType: number, name: string, lang: Lang): string[];
|
|
489
|
+
/** Bootstrap all registered indexes directly from parsed sidecar columns */
|
|
490
|
+
bootstrapSidecars(sets: any[]): void;
|
|
491
|
+
clear(): void;
|
|
492
|
+
}
|
|
493
|
+
declare const IndexRegistry: IndexRegistryClass;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Recursively calculates the total number of unique books in a topic and all its subtopics.
|
|
497
|
+
* Yields to the event loop periodically to avoid blocking the main thread (Background Worker Aggregation).
|
|
498
|
+
*/
|
|
499
|
+
declare function calculateTopicBookCount(tagId: bigint): Promise<number>;
|
|
500
|
+
|
|
501
|
+
interface NewSubscriptionsClient {
|
|
502
|
+
getNewSubscriptionsSince(targetUserId: number, since: number): Promise<number[]>;
|
|
503
|
+
countNewSubscriptionsSince(targetUserId: number, since: number): Promise<number>;
|
|
504
|
+
}
|
|
505
|
+
interface UsernameResolver {
|
|
506
|
+
userIdToUsername(userId: number): Promise<string>;
|
|
507
|
+
}
|
|
508
|
+
interface RelationshipSubscriptionOptions {
|
|
509
|
+
targetUserId: number;
|
|
510
|
+
indexer: NewSubscriptionsClient;
|
|
511
|
+
usernameResolver: UsernameResolver;
|
|
512
|
+
/** Polling interval in milliseconds when online (default: 30_000). */
|
|
513
|
+
pollIntervalMs?: number;
|
|
514
|
+
/** Optional key for persisting the last-read timestamp in localStorage. */
|
|
515
|
+
cursorKey?: string;
|
|
516
|
+
}
|
|
517
|
+
interface NewSubscription {
|
|
518
|
+
userId: number;
|
|
519
|
+
username: string | null;
|
|
520
|
+
timestamp: number;
|
|
521
|
+
}
|
|
522
|
+
type NewSubscriptionHandler = (subscriptions: NewSubscription[]) => void | Promise<void>;
|
|
523
|
+
/**
|
|
524
|
+
* ORM-native subscription helper for the on-chain relationship indexer.
|
|
525
|
+
*
|
|
526
|
+
* Instead of polling per object or per tag, the targeted user makes a single
|
|
527
|
+
* RPC call: `getNewSubscriptionsSince(timestamp)`. The contract returns the
|
|
528
|
+
* userIds of everyone who interacted with that user's content since the cursor.
|
|
529
|
+
* This class resolves those userIds to usernames, persists the cursor for
|
|
530
|
+
* offline catch-up, and emits one event per batch.
|
|
531
|
+
*/
|
|
532
|
+
declare class RelationshipSubscription {
|
|
533
|
+
private targetUserId;
|
|
534
|
+
private indexer;
|
|
535
|
+
private usernameResolver;
|
|
536
|
+
private pollIntervalMs;
|
|
537
|
+
private cursorKey;
|
|
538
|
+
private handlers;
|
|
539
|
+
private timer;
|
|
540
|
+
private isPolling;
|
|
541
|
+
private inMemorySince;
|
|
542
|
+
private inMemoryDelivered;
|
|
543
|
+
constructor(opts: RelationshipSubscriptionOptions);
|
|
544
|
+
onSubscriptions(handler: NewSubscriptionHandler): () => void;
|
|
545
|
+
start(): void;
|
|
546
|
+
stop(): void;
|
|
547
|
+
getLastSeenTimestamp(): number;
|
|
548
|
+
private readSince;
|
|
549
|
+
private writeSince;
|
|
550
|
+
private deliveredKey;
|
|
551
|
+
private readDelivered;
|
|
552
|
+
private writeDelivered;
|
|
553
|
+
/**
|
|
554
|
+
* Guarded against overlapping polls ON THIS INSTANCE: this does sequential
|
|
555
|
+
* async work (an RPC call, then a per-actor username-resolution loop)
|
|
556
|
+
* before ever touching the handlers. Without the guard, a poll slow enough
|
|
557
|
+
* to still be in flight when the next setInterval tick fires — or a
|
|
558
|
+
* manually triggered poll() racing the timer — would let two polls both
|
|
559
|
+
* read the same cursor before either writes it back. A later,
|
|
560
|
+
* non-overlapping poll() is unaffected: the guard always releases in
|
|
561
|
+
* `finally`, including when the indexer call throws.
|
|
562
|
+
*
|
|
563
|
+
* Two more things this guards against that a same-instance flag alone
|
|
564
|
+
* can't:
|
|
565
|
+
*
|
|
566
|
+
* 1. Cross-instance double-delivery (e.g. two open browser tabs sharing one
|
|
567
|
+
* cursorKey): the cursor is a wall-clock timestamp, not an ordered chain
|
|
568
|
+
* position, so `since` alone can't tell two concurrent pollers "the
|
|
569
|
+
* other one already claimed this batch." `readDelivered()`/
|
|
570
|
+
* `writeDelivered()` add a small de-duplication record (just the most
|
|
571
|
+
* recently delivered actorIds, not an ever-growing history — since
|
|
572
|
+
* `since` only ever advances, a well-behaved indexer stops returning an
|
|
573
|
+
* old actorId once `since` passes its timestamp, so remembering only the
|
|
574
|
+
* latest batch is enough to cover the narrow overlap window this
|
|
575
|
+
* creates) that's re-read fresh AFTER the indexer call resolves — not
|
|
576
|
+
* cached from before it — and written immediately, before the
|
|
577
|
+
* async username-resolution/handler-dispatch step below. That ordering
|
|
578
|
+
* is what lets a second, concurrently-resolving poll() (own instance or
|
|
579
|
+
* another tab sharing the same cursorKey) observe "already claimed" and
|
|
580
|
+
* skip, instead of only finding out after the first poll fully finishes.
|
|
581
|
+
*
|
|
582
|
+
* 2. The cursor is advanced to when THIS request was dispatched, not when
|
|
583
|
+
* it resolved. An interaction that lands on-chain while the RPC is still
|
|
584
|
+
* in flight has a timestamp before "now at completion" but the query
|
|
585
|
+
* that's already in flight can't have asked about it — a
|
|
586
|
+
* completion-time cursor would skip it forever once persisted. A
|
|
587
|
+
* dispatch-time cursor instead makes the next poll's window
|
|
588
|
+
* conservative (it may re-ask about a narrow already-covered slice),
|
|
589
|
+
* which `readDelivered()` exists to de-duplicate.
|
|
590
|
+
*/
|
|
591
|
+
poll(): Promise<void>;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
type ReplayDelivery = AnyPatch & {
|
|
595
|
+
username?: string;
|
|
596
|
+
creatorUsername?: string;
|
|
597
|
+
};
|
|
598
|
+
/**
|
|
599
|
+
* The ONE shared mutation path for applying an ordered batch of patches to a
|
|
600
|
+
* detached (uncached, no reactivity, no lifecycle side effects) `Orm`
|
|
601
|
+
* instance. Both the worker's LRU-eviction rehydration
|
|
602
|
+
* (`worker/libs/reconstructRecord.ts`) and the corpus baker
|
|
603
|
+
* (`@the_library/corpus-builder`'s `apply-patches-plain.ts`) call this
|
|
604
|
+
* instead of maintaining their own copies of patch-application logic — see
|
|
605
|
+
* reviews/2026-09-07/assessment.md's "Architectural direction" section,
|
|
606
|
+
* which specifically named this kind of duplication ("one logical edit
|
|
607
|
+
* currently acquires subtly different meanings in the setter, queue
|
|
608
|
+
* compactor, IDB deduplicator, restore loop, cache reloader, Node baker, and
|
|
609
|
+
* contract transport") as the root cause of several P1 findings, including
|
|
610
|
+
* #5 (the baker not implementing every patch operation) and the
|
|
611
|
+
* instance-collision bug documented in
|
|
612
|
+
* reviews/2026-09-07/implementation-p1-5-through-p1-6.md.
|
|
613
|
+
*
|
|
614
|
+
* This function does NOT reimplement mutation semantics — it delegates every
|
|
615
|
+
* actual state change to `applyPatchWithContext` (patchContext.ts), which is
|
|
616
|
+
* the same function the live subscription-sync/replay path already used.
|
|
617
|
+
* What this function DOES own is the orchestration `applyPatchWithContext`
|
|
618
|
+
* needs but a caller-supplied `Orm` instance can't provide on its own:
|
|
619
|
+
*
|
|
620
|
+
* - `own`/`author`: a detached record has no ambient "which record/which
|
|
621
|
+
* user session is this" context the way a live cached record does, so
|
|
622
|
+
* every patch must be explicitly checked against the target record's
|
|
623
|
+
* identity, and grouped by author, before being applied.
|
|
624
|
+
* - `batchRemainder`: `resolveAddInstanceConflict` (patchContext.ts) needs
|
|
625
|
+
* to see the field edits that follow an `AddInstance` in the SAME
|
|
626
|
+
* author's stream to compare the incoming edition against existing slots
|
|
627
|
+
* — this slices exactly that lookahead per patch, scoped to patches for
|
|
628
|
+
* the same record from the same author (a different author's patches
|
|
629
|
+
* interleaved in the same `input` array must not be mistaken for fields
|
|
630
|
+
* of this AddInstance).
|
|
631
|
+
* - `instanceRemapStore`: `applyPatchWithContext` expects an async
|
|
632
|
+
* key-value interface (matching the live app's IndexedDB-backed store —
|
|
633
|
+
* see patchContext.ts's `InstanceRemapStore`), but a detached `Orm`
|
|
634
|
+
* instance only has `record.instanceRemaps`, a plain array (chosen so it
|
|
635
|
+
* round-trips through `JSON.stringify` for persistence — see orm.ts's
|
|
636
|
+
* `instanceRemaps` field doc). This wraps that array in a `Map` for O(1)
|
|
637
|
+
* lookup during this call, and — critically — writes the accumulated
|
|
638
|
+
* result back onto `record.instanceRemaps` at the end, so whichever
|
|
639
|
+
* caller persists the record afterward (the baker writing
|
|
640
|
+
* `_instanceRemaps` back onto the plain corpus object, or the worker
|
|
641
|
+
* keeping the reconstructed record) carries any NEW remap forward.
|
|
642
|
+
* Without that final write-back, a remap created during this call would
|
|
643
|
+
* exist only for the duration of this function and be lost the moment it
|
|
644
|
+
* returned — silently reopening the exact "remap lost after binary
|
|
645
|
+
* bake/reload" bug the regression suite guards against.
|
|
646
|
+
*/
|
|
647
|
+
declare function applyDetachedPatches(record: Orm, input: ReplayDelivery[]): Promise<void>;
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Word splitter shared by the search-tier builder (corpus-builder, Node) and
|
|
651
|
+
* the query engine (browser) — next/metadata_search.md §5. Index and query can
|
|
652
|
+
* only agree if both sides run this exact function, so it must stay
|
|
653
|
+
* deterministic across runtimes: no Intl.Segmenter (its dictionary
|
|
654
|
+
* segmentation follows the ICU version), no locale-dependent lowercasing.
|
|
655
|
+
* Changing its output changes every published shard — bump
|
|
656
|
+
* SEARCH_SHARD_FORMAT_VERSION when it does.
|
|
657
|
+
*/
|
|
658
|
+
/** Longest word kept; longer runs are cut, not dropped. */
|
|
659
|
+
declare const MAX_TOKEN_LENGTH = 40;
|
|
660
|
+
/** é → e, Ä → a; recomposes Hangul and keeps Indic vowel signs (they aren't accents). */
|
|
661
|
+
declare function normalizeText(text: string): string;
|
|
662
|
+
/** Split `text` into index/query tokens, in order (duplicates kept — callers count tf). */
|
|
663
|
+
declare function tokenize(text: string | null | undefined): string[];
|
|
664
|
+
|
|
665
|
+
/** Opt-in publisher delivery. Worker patch commits read this flag in their own transaction. */
|
|
666
|
+
declare function enablePublisherOutbox(): Promise<void>;
|
|
667
|
+
declare function getPublisherOutbox(): Promise<QueueItem[]>;
|
|
668
|
+
declare function acknowledgePublisherOutbox(ids: string[]): Promise<void>;
|
|
669
|
+
|
|
670
|
+
export { AnyActionPatch, AnyPatch, Book, BookData, BookInput, CURRENT_VERSION, ClearDbData, DSafeCheck, DateUtils, Db, EvmPayload, FileRecord, IDBInstanceRemapStore, IThread, IndexDependencyNode, IndexRegistry, IndexRegistryClass, Lang, type LoadAsyncCapable, LocalOp, type LocalRecordEntry, LocalRecordTable, LruCache, MAX_TOKEN_LENGTH, ModelIndex, type NewSubscription, type NewSubscriptionHandler, type NewSubscriptionsClient, Orm, PatchInstance, type PatchSource, Patches, PersonInput, type ProResolver, QueueItem, type ReactivitySystem, RelationshipSubscription, type RelationshipSubscriptionOptions, type ReplayDelivery, type SyncStatus, Tag, TagInput, type TrashStore, type Trashable, type TreeNode, type UsernameResolver, VersionLayout, VersionsFile, _resetForTest, acknowledgePublisherOutbox, actionPatchToLocalOp, addReactivitySystem, addRecord, applyDetachedPatches, applyRestoredPatches, buildCascadeCandidates, calculateTopicBookCount, cascadeRestore, childrenOf, classifyValue, clear, collectAncestors, collectTrashedAncestors, configureDb, countRecursiveSubfolders, currentLayout, dbName, dbReactivity, debouncePromise, delay, deserializePatches, deviceStateStoreName, dump, enablePublisherOutbox, executeComplexRestore, fileStore, getDefaultCreatorUsername, getModelClass, getPatchInstanceByAccount, getPublisherOutbox, getRecord, getRecordKey, hasBookData, hasFile, hasRecord, inceptionDate, instanceRemapsStoreName, isIndependentlyTrashed, jsonStoreName, keyValStoreName, loadBookData, loadFile, loadManyAsync, loadOneAsync, localOpToActionPatch, localRecordTable, localRecordsStoreName, mergeBookTiers, mergePersonTiers, mergeTagTiers, normalizeText, patchStoreName, pdfDataStoreName, pinAsTrashed, pinRecord, proResolver, registerModelClass, removeRecord, scanTrash, serializePatchRows, serializePatches, setDefaultCreatorUsername, setReactivitySystem, storeBookData, storeFile, tokenize, trashStore, uid, unpinRecord, untrashRecord, version, versionsFile };
|