@the_library/public 1.0.0 → 2.0.0

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