@the_library/public 1.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.
- package/README.md +2298 -0
- package/assets/branding/data-pond.png +0 -0
- package/assets/branding/dsafe-logo.png +0 -0
- package/assets/branding/founder-photo.jpg +0 -0
- package/assets/branding/icon_transparent.png +0 -0
- package/assets/branding/library-favicon.png +0 -0
- package/assets/branding/pond-enterprise-logo.jpg +0 -0
- package/assets/branding/pond-enterprise-logo.svg +27 -0
- package/dist/branding/index.d.ts +48 -0
- package/dist/branding/index.js +67 -0
- package/dist/branding/index.js.map +1 -0
- package/dist/chunk-2HFOWE5R.js +296 -0
- package/dist/chunk-2HFOWE5R.js.map +1 -0
- package/dist/chunk-3L6LH2XK.js +465 -0
- package/dist/chunk-3L6LH2XK.js.map +1 -0
- package/dist/chunk-4CWVFPBN.js +28 -0
- package/dist/chunk-4CWVFPBN.js.map +1 -0
- package/dist/chunk-AGHPATVL.js +65 -0
- package/dist/chunk-AGHPATVL.js.map +1 -0
- package/dist/chunk-JDUYLUDJ.js +4835 -0
- package/dist/chunk-JDUYLUDJ.js.map +1 -0
- package/dist/chunk-OEZK7IX7.js +77 -0
- package/dist/chunk-OEZK7IX7.js.map +1 -0
- package/dist/chunk-PUYDAUCI.js +2873 -0
- package/dist/chunk-PUYDAUCI.js.map +1 -0
- package/dist/chunk-WHWMTS7D.js +99 -0
- package/dist/chunk-WHWMTS7D.js.map +1 -0
- package/dist/chunk-Y7RS6RTM.js +342 -0
- package/dist/chunk-Y7RS6RTM.js.map +1 -0
- package/dist/chunk-ZEZGI2TP.js +197 -0
- package/dist/chunk-ZEZGI2TP.js.map +1 -0
- package/dist/core-dao-core-logo-VDT2I5IW.svg +33 -0
- package/dist/downloader/dl2-sw.js +199 -0
- package/dist/downloader/dl2-sw.js.map +1 -0
- package/dist/downloader/file-worker-v2.js +258 -0
- package/dist/downloader/file-worker-v2.js.map +1 -0
- package/dist/downloader/index.d.ts +45 -0
- package/dist/downloader/index.js +538 -0
- package/dist/downloader/index.js.map +1 -0
- package/dist/downloader/mu-worker-v2.js +197 -0
- package/dist/downloader/mu-worker-v2.js.map +1 -0
- package/dist/downloader/react.d.ts +19 -0
- package/dist/downloader/react.js +32 -0
- package/dist/downloader/react.js.map +1 -0
- package/dist/downloader/solid.d.ts +21 -0
- package/dist/downloader/solid.js +19 -0
- package/dist/downloader/solid.js.map +1 -0
- package/dist/downloader/sw.d.ts +22 -0
- package/dist/downloader/sw.js +119 -0
- package/dist/downloader/sw.js.map +1 -0
- package/dist/downloader/vue.d.ts +23 -0
- package/dist/downloader/vue.js +19 -0
- package/dist/downloader/vue.js.map +1 -0
- package/dist/level-state-J3pj64Tr.d.ts +15 -0
- package/dist/models/astro.d.ts +47 -0
- package/dist/models/astro.js +44 -0
- package/dist/models/astro.js.map +1 -0
- package/dist/models/index.d.ts +244 -0
- package/dist/models/index.js +340 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/models.d.ts +524 -0
- package/dist/models/models.js +46 -0
- package/dist/models/models.js.map +1 -0
- package/dist/models/models_v2.global.js +1 -0
- package/dist/models/patch-worker.js +543 -0
- package/dist/models/patch-worker.js.map +1 -0
- package/dist/models/react.d.ts +43 -0
- package/dist/models/react.js +73 -0
- package/dist/models/react.js.map +1 -0
- package/dist/models/solid.d.ts +73 -0
- package/dist/models/solid.js +95 -0
- package/dist/models/solid.js.map +1 -0
- package/dist/models/vue.d.ts +51 -0
- package/dist/models/vue.js +98 -0
- package/dist/models/vue.js.map +1 -0
- package/dist/orm-BvkX0aBT.d.ts +507 -0
- package/dist/session-vqOnyxga.d.ts +184 -0
- package/dist/state-BTsp-E4v.d.ts +111 -0
- package/dist/types-Dn0EFMO_.d.ts +293 -0
- package/dist/types-Xb8Ta9tZ.d.ts +155 -0
- package/dist/web3/index.d.ts +820 -0
- package/dist/web3/index.js +1020 -0
- package/dist/web3/index.js.map +1 -0
- package/dist/web3/registry.d.ts +145 -0
- package/dist/web3/registry.js +23 -0
- package/dist/web3/registry.js.map +1 -0
- package/dist/web3/vue.d.ts +174 -0
- package/dist/web3/vue.js +391 -0
- package/dist/web3/vue.js.map +1 -0
- package/package.json +124 -0
|
@@ -0,0 +1,244 @@
|
|
|
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';
|
|
5
|
+
import '@the_library/db_schemas/enums';
|
|
6
|
+
import '@the_library/standard-adapters/isni';
|
|
7
|
+
import '@the_library/standard-adapters/orcid';
|
|
8
|
+
import '@the_library/standard-adapters/lcc';
|
|
9
|
+
import '@the_library/standard-adapters/ddc';
|
|
10
|
+
import '@the_library/standard-adapters/udc';
|
|
11
|
+
import '@the_library/standard-adapters/clc';
|
|
12
|
+
import '@the_library/standard-adapters/bbk';
|
|
13
|
+
import '@the_library/standard-adapters/tlc';
|
|
14
|
+
import '@the_library/standard-adapters/cc';
|
|
15
|
+
import '@the_library/standard-adapters/isbn';
|
|
16
|
+
|
|
17
|
+
/** The compiled layout dictionary shipped with @the_library/db_schemas. */
|
|
18
|
+
declare const versionsFile: VersionsFile;
|
|
19
|
+
/** Schema version this build serializes with (EvmPayload.version). */
|
|
20
|
+
declare const CURRENT_VERSION: number;
|
|
21
|
+
/** Fully-merged layout for CURRENT_VERSION (memoized). */
|
|
22
|
+
declare const currentLayout: () => VersionLayout;
|
|
23
|
+
|
|
24
|
+
interface ReactivitySystem {
|
|
25
|
+
track: (obj: any) => void;
|
|
26
|
+
trigger: (obj: any) => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Registers a reactivity system, returning an unregister function. Use this to
|
|
30
|
+
* **compose** systems (multiple frameworks live at once). Idempotent for the
|
|
31
|
+
* same object.
|
|
32
|
+
*/
|
|
33
|
+
declare function addReactivitySystem(sys: ReactivitySystem): () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Replaces *all* registered systems with `sys` (or clears them with `null`).
|
|
36
|
+
* Single-framework convenience / test reset. For coexisting frameworks use
|
|
37
|
+
* `addReactivitySystem`.
|
|
38
|
+
*/
|
|
39
|
+
declare function setReactivitySystem(sys: ReactivitySystem | null): void;
|
|
40
|
+
declare const dbReactivity: {
|
|
41
|
+
track(obj: any): void;
|
|
42
|
+
trigger(obj: any): void;
|
|
43
|
+
};
|
|
44
|
+
declare class LruCache<K, V> {
|
|
45
|
+
limit: number;
|
|
46
|
+
private map;
|
|
47
|
+
private _pinned;
|
|
48
|
+
private _warnedOverflow;
|
|
49
|
+
constructor(limit: number);
|
|
50
|
+
get size(): number;
|
|
51
|
+
get(key: K): V | undefined;
|
|
52
|
+
set(key: K, val: V): void;
|
|
53
|
+
pin(key: K): void;
|
|
54
|
+
unpin(key: K): void;
|
|
55
|
+
has(key: K): boolean;
|
|
56
|
+
delete(key: K): void;
|
|
57
|
+
clear(): void;
|
|
58
|
+
keys(): IterableIterator<K>;
|
|
59
|
+
values(): IterableIterator<V>;
|
|
60
|
+
}
|
|
61
|
+
/** Set the per-objectType LRU limit (call before loading; 2 000 on mobile). */
|
|
62
|
+
declare const configureDb: (opts: {
|
|
63
|
+
cacheLimit?: number;
|
|
64
|
+
}) => void;
|
|
65
|
+
declare const clear: () => void;
|
|
66
|
+
declare const dump: () => Map<number, LruCache<string, any>>;
|
|
67
|
+
declare function getRecordKey(wireId: number, creatorUsername?: string): string;
|
|
68
|
+
declare const hasRecord: (objectType: number, id: uid, creatorUsername?: string) => boolean;
|
|
69
|
+
/** Synchronous read. Throws on LRU miss — use the model's LoadAsync for re-hydration. */
|
|
70
|
+
declare const getRecord: (objectType: number, id: uid, creatorUsername?: string) => any;
|
|
71
|
+
declare const addRecord: (objectType: number, obj: {
|
|
72
|
+
id: uid;
|
|
73
|
+
}, creatorUsername?: string) => void;
|
|
74
|
+
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;
|
|
77
|
+
|
|
78
|
+
declare const inceptionDate: number;
|
|
79
|
+
declare const DateUtils: {
|
|
80
|
+
now: () => number;
|
|
81
|
+
serialize: (d: number) => ArrayBuffer;
|
|
82
|
+
toNumber: (d: Date) => number;
|
|
83
|
+
fromNumber: (i: number) => Date;
|
|
84
|
+
findNowBucket: () => number;
|
|
85
|
+
findDateBucket: (d: Date) => number;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Checks if an Orm element is considered safe and not deleted.
|
|
90
|
+
*
|
|
91
|
+
* @param element - The Orm element to check.
|
|
92
|
+
* @returns A boolean indicating whether the element is safe and not deleted.
|
|
93
|
+
*/
|
|
94
|
+
declare const DSafeCheck: (element: Orm) => boolean;
|
|
95
|
+
|
|
96
|
+
declare const delay: (ms: number) => Promise<unknown>;
|
|
97
|
+
type ProResolver<A> = {
|
|
98
|
+
pro: Promise<A>;
|
|
99
|
+
resolve: (data: any) => void;
|
|
100
|
+
reject: (data: any) => void;
|
|
101
|
+
start: () => void;
|
|
102
|
+
isStarted: () => boolean;
|
|
103
|
+
};
|
|
104
|
+
declare const proResolver: <A>() => ProResolver<A>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Creates a debounced function that delays invoking the provided function
|
|
108
|
+
* until wait milliseconds have elapsed since the last time this debounced
|
|
109
|
+
* function was invoked. Each invocation returns a promise that resolves
|
|
110
|
+
* with the result of the ultimate single execution.
|
|
111
|
+
*/
|
|
112
|
+
declare function debouncePromise<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>;
|
|
113
|
+
declare class Patches {
|
|
114
|
+
username: string;
|
|
115
|
+
protected _patches: Array<QueueItem>;
|
|
116
|
+
protected thread: IThread;
|
|
117
|
+
static _replaying: boolean;
|
|
118
|
+
get patches(): Array<QueueItem>;
|
|
119
|
+
initThread(thread: IThread, debounceMs?: number): void;
|
|
120
|
+
get threadInstance(): IThread;
|
|
121
|
+
constructor(username: string);
|
|
122
|
+
static onSyncListeners: Array<(patches: QueueItem[]) => void>;
|
|
123
|
+
static onSync(callback: (patches: QueueItem[]) => void): void;
|
|
124
|
+
static setReplay(replay: boolean): void;
|
|
125
|
+
/** Drops all queued (not yet persisted) patches. Test/reset helper. */
|
|
126
|
+
clearQueue(): void;
|
|
127
|
+
addPatch(op: QueueItem): void;
|
|
128
|
+
/**
|
|
129
|
+
* Last-Writer-Wins consolidation. Walks the queue from the newest entry
|
|
130
|
+
* backwards and keeps only the latest edit per logical slot.
|
|
131
|
+
*
|
|
132
|
+
* The sub-key for property edits incorporates the language code
|
|
133
|
+
* (`${propertyId}:${langId ?? 0}`) so a French string edit never erases
|
|
134
|
+
* a previous English edit (SPEC §2.2). Instance field edits additionally
|
|
135
|
+
* key on the instance index.
|
|
136
|
+
*/
|
|
137
|
+
static cleanData(data: Array<QueueItem>): Array<QueueItem>;
|
|
138
|
+
/**
|
|
139
|
+
* Syncs the queued patches to the worker (IndexedDB persistence).
|
|
140
|
+
* Before initThread, patches are retained in the queue (never dropped);
|
|
141
|
+
* initThread flushes them as soon as the worker is available.
|
|
142
|
+
*/
|
|
143
|
+
sync(): Promise<any>;
|
|
144
|
+
static calculateLevel(username: string): Promise<number>;
|
|
145
|
+
}
|
|
146
|
+
declare const PatchInstance: Patches;
|
|
147
|
+
/**
|
|
148
|
+
* Restores patches received from the blockchain into IndexedDB.
|
|
149
|
+
* Decoding is layout-driven: the payload's `version` selects the codec
|
|
150
|
+
* layout from versions.json (delta-merged via resolveLayout).
|
|
151
|
+
*/
|
|
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
|
+
*/
|
|
157
|
+
declare const serializePatches: (fromIndex: number, toIndex: number) => Promise<EvmPayload>;
|
|
158
|
+
declare const getPatchInstanceByAccount: (account: string) => Patches;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Applies a decoded batch of patches to the **in-memory ORM** — the v2
|
|
162
|
+
* replacement for v1's `deserializeOp` + `SyncRestoredPatches`.
|
|
163
|
+
*
|
|
164
|
+
* The two v1 functions collapse in v2:
|
|
165
|
+
* - **decode** is `evmToPatch(payload, versionsFile)` (whole batch, version-driven);
|
|
166
|
+
* - **persist** is `deserializePatches()` (writes to IndexedDB);
|
|
167
|
+
* - this function is the missing **routing + apply** step only.
|
|
168
|
+
*
|
|
169
|
+
* Each EVM edit op is routed to its target record by `(objectType, objectId)`
|
|
170
|
+
* and applied via `record.patch(op)`, which mutates in-memory state, fires
|
|
171
|
+
* reactivity, and propagates inverse relations. Records not currently
|
|
172
|
+
* materialized in the LRU are **skipped** (their ops remain in IndexedDB and
|
|
173
|
+
* are folded in when the record is next hydrated — the Direction-B path).
|
|
174
|
+
* Local analytics ops carry no object edit and are ignored here (they feed the
|
|
175
|
+
* stats store on boot).
|
|
176
|
+
*
|
|
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).
|
|
180
|
+
*
|
|
181
|
+
* Idempotent: re-applying the same ops converges to the same state
|
|
182
|
+
* (`patch()` is a last-writer-wins assignment / Set add-remove).
|
|
183
|
+
*
|
|
184
|
+
* @returns counts of ops applied to live records vs. skipped (not materialized).
|
|
185
|
+
*/
|
|
186
|
+
declare const applyRestoredPatches: (ops: Array<AnyPatch>, creatorUsername?: string) => Promise<{
|
|
187
|
+
applied: number;
|
|
188
|
+
skipped: number;
|
|
189
|
+
}>;
|
|
190
|
+
|
|
191
|
+
interface TrashStore {
|
|
192
|
+
/** Merge ids across a set of usernames. Empty array (default) = every known username. */
|
|
193
|
+
list(objectType: number, usernames?: string[]): number[];
|
|
194
|
+
count(objectType: number, usernames?: string[]): number;
|
|
195
|
+
/** Usernames currently bucketed for this objectType (e.g. to populate a picker). */
|
|
196
|
+
usernames(objectType: number): string[];
|
|
197
|
+
subscribe(objectType: number, listener: () => void): () => void;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Full scan of every currently-hydrated record (dump()), across all object
|
|
201
|
+
* types — no per-type registration needed since `deleted`/`safe` are
|
|
202
|
+
* universal base properties (see dsafe.ts). Call after hydrateAll() (session.ts
|
|
203
|
+
* does this for both the initial boot and each loadLanguage() call).
|
|
204
|
+
*
|
|
205
|
+
* Batches persist()/notify() to once each (not once per record) — a bulk
|
|
206
|
+
* boot-time pass over a large corpus must not fire a synchronous localStorage
|
|
207
|
+
* write and a listener fan-out per changed record.
|
|
208
|
+
*/
|
|
209
|
+
declare function scanTrash(): void;
|
|
210
|
+
/** Test-only: clears in-memory + localStorage state and any pending debounce timer. */
|
|
211
|
+
declare function _resetForTest(): void;
|
|
212
|
+
declare const trashStore: TrashStore;
|
|
213
|
+
|
|
214
|
+
declare const version = 4;
|
|
215
|
+
declare const dbName = "the_world_library";
|
|
216
|
+
declare const patchStoreName = "patches";
|
|
217
|
+
declare const jsonStoreName = "catalog_json";
|
|
218
|
+
declare const keyValStoreName = "key_value";
|
|
219
|
+
declare const pdfDataStoreName = "pdf_data";
|
|
220
|
+
declare const deviceStateStoreName = "deviceState";
|
|
221
|
+
declare const localRecordsStoreName = "localRecords";
|
|
222
|
+
declare const instanceRemapsStoreName = "instanceRemaps";
|
|
223
|
+
declare const Db: () => Promise<IDBDatabase>;
|
|
224
|
+
declare const ClearDbData: () => Promise<unknown>;
|
|
225
|
+
|
|
226
|
+
declare const hasFile: (id: string) => Promise<boolean>;
|
|
227
|
+
declare const loadFile: (id: string) => Promise<FileRecord | undefined>;
|
|
228
|
+
declare const storeFile: (record: FileRecord) => Promise<boolean>;
|
|
229
|
+
/**
|
|
230
|
+
* Developer-friendly namespace bundling the file-storage ops. Replaces v1's
|
|
231
|
+
* `files` import — mechanical swap `files.x` → `fileStore.x`:
|
|
232
|
+
* `fileStore.has(id)` · `fileStore.load(id)` · `fileStore.store(record)`
|
|
233
|
+
*/
|
|
234
|
+
declare const fileStore: {
|
|
235
|
+
has: (id: string) => Promise<boolean>;
|
|
236
|
+
load: (id: string) => Promise<FileRecord | undefined>;
|
|
237
|
+
store: (record: FileRecord) => Promise<boolean>;
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
declare const hasBookData: (fileId: string) => Promise<boolean>;
|
|
241
|
+
declare const loadBookData: (fileId: string) => Promise<BookData | undefined>;
|
|
242
|
+
declare const storeBookData: (record: BookData) => Promise<boolean>;
|
|
243
|
+
|
|
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 };
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getLevel,
|
|
3
|
+
subscribeLevel
|
|
4
|
+
} from "../chunk-4CWVFPBN.js";
|
|
5
|
+
import {
|
|
6
|
+
_resetForTest,
|
|
7
|
+
applyRestoredPatches,
|
|
8
|
+
scanTrash,
|
|
9
|
+
trashStore
|
|
10
|
+
} from "../chunk-Y7RS6RTM.js";
|
|
11
|
+
import {
|
|
12
|
+
ActionTypes,
|
|
13
|
+
BOOK_PROP_IDS,
|
|
14
|
+
Book,
|
|
15
|
+
BookInstance,
|
|
16
|
+
CURRENT_VERSION,
|
|
17
|
+
DateUtils,
|
|
18
|
+
DownloadState,
|
|
19
|
+
DownloadsByType,
|
|
20
|
+
FavoritesByTypes,
|
|
21
|
+
LANG_AGNOSTIC,
|
|
22
|
+
LANG_ID_DECODE,
|
|
23
|
+
LANG_ID_ENCODE,
|
|
24
|
+
LruCache,
|
|
25
|
+
ModelTypes,
|
|
26
|
+
NewBookWithId,
|
|
27
|
+
NewPersonWithId,
|
|
28
|
+
NewTagWithId,
|
|
29
|
+
PERSON_PROP_IDS,
|
|
30
|
+
PatchAction,
|
|
31
|
+
PatchInstance,
|
|
32
|
+
PatchOperation,
|
|
33
|
+
Patches,
|
|
34
|
+
Person,
|
|
35
|
+
PopulateStatsStore,
|
|
36
|
+
Rating,
|
|
37
|
+
Registry,
|
|
38
|
+
SchemaRegistry,
|
|
39
|
+
SidecarType,
|
|
40
|
+
Stats,
|
|
41
|
+
TAG_PROP_IDS,
|
|
42
|
+
Tag,
|
|
43
|
+
VisitsByType,
|
|
44
|
+
WorkerCommands,
|
|
45
|
+
WorkerEvent,
|
|
46
|
+
addReactivitySystem,
|
|
47
|
+
addRecord,
|
|
48
|
+
clear,
|
|
49
|
+
configureDb,
|
|
50
|
+
currentLayout,
|
|
51
|
+
dbReactivity,
|
|
52
|
+
debouncePromise,
|
|
53
|
+
deserializePatches,
|
|
54
|
+
dump,
|
|
55
|
+
evmToPatch,
|
|
56
|
+
getPatchInstanceByAccount,
|
|
57
|
+
getRecord,
|
|
58
|
+
getRecordKey,
|
|
59
|
+
hasRecord,
|
|
60
|
+
inceptionDate,
|
|
61
|
+
isEvmPatch,
|
|
62
|
+
packPatch,
|
|
63
|
+
patchToEvm,
|
|
64
|
+
pinRecord,
|
|
65
|
+
relationColName,
|
|
66
|
+
removeRecord,
|
|
67
|
+
resolveLayout,
|
|
68
|
+
serializeBookExtended,
|
|
69
|
+
serializeBookProv,
|
|
70
|
+
serializeBookSlim,
|
|
71
|
+
serializePatches,
|
|
72
|
+
serializePersonExtended,
|
|
73
|
+
serializePersonProv,
|
|
74
|
+
serializePersonSlim,
|
|
75
|
+
serializeTagExtended,
|
|
76
|
+
serializeTagProv,
|
|
77
|
+
serializeTagSlim,
|
|
78
|
+
setReactivitySystem,
|
|
79
|
+
unpackPatch,
|
|
80
|
+
unpinRecord,
|
|
81
|
+
versionsFile
|
|
82
|
+
} from "../chunk-JDUYLUDJ.js";
|
|
83
|
+
import {
|
|
84
|
+
ClearDbData,
|
|
85
|
+
Db,
|
|
86
|
+
dbName,
|
|
87
|
+
delay,
|
|
88
|
+
deviceStateStoreName,
|
|
89
|
+
instanceRemapsStoreName,
|
|
90
|
+
jsonStoreName,
|
|
91
|
+
keyValStoreName,
|
|
92
|
+
localRecordsStoreName,
|
|
93
|
+
patchStoreName,
|
|
94
|
+
pdfDataStoreName,
|
|
95
|
+
proResolver,
|
|
96
|
+
version
|
|
97
|
+
} from "../chunk-ZEZGI2TP.js";
|
|
98
|
+
|
|
99
|
+
// src/models/dsafe.ts
|
|
100
|
+
var safePropId = 5;
|
|
101
|
+
var deletedPropId = 6;
|
|
102
|
+
var DSafeCheck = (element) => {
|
|
103
|
+
return element.getProp(deletedPropId) === false && element.getProp(safePropId) === true;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/models/indexdb/file_storage.ts
|
|
107
|
+
var storeName = jsonStoreName;
|
|
108
|
+
var hasFile = (id) => {
|
|
109
|
+
const deferred = proResolver();
|
|
110
|
+
Db().then((db) => {
|
|
111
|
+
try {
|
|
112
|
+
const tx = db.transaction(storeName, "readonly");
|
|
113
|
+
const req = tx.objectStore(storeName).count(id);
|
|
114
|
+
req.onsuccess = function(e) {
|
|
115
|
+
const count = e.target.result;
|
|
116
|
+
if (count > 0) {
|
|
117
|
+
deferred.resolve(true);
|
|
118
|
+
} else {
|
|
119
|
+
deferred.resolve(false);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
req.onerror = function(e) {
|
|
123
|
+
console.error("worker: error", e.target);
|
|
124
|
+
deferred.reject(e.target);
|
|
125
|
+
};
|
|
126
|
+
} catch (e) {
|
|
127
|
+
console.error(e);
|
|
128
|
+
debugger;
|
|
129
|
+
}
|
|
130
|
+
}).catch((e) => {
|
|
131
|
+
console.error(`[indexdb error:] hasFile(): ${e.message}`);
|
|
132
|
+
deferred.reject(e);
|
|
133
|
+
});
|
|
134
|
+
return deferred.pro;
|
|
135
|
+
};
|
|
136
|
+
var loadFile = (id) => {
|
|
137
|
+
const deferred = proResolver();
|
|
138
|
+
Db().then((db) => {
|
|
139
|
+
const tx = db.transaction(storeName, "readonly");
|
|
140
|
+
let result = void 0;
|
|
141
|
+
tx.objectStore(storeName).get(id).addEventListener("success", function(event) {
|
|
142
|
+
result = event.target.result;
|
|
143
|
+
deferred.resolve(result);
|
|
144
|
+
});
|
|
145
|
+
tx.onerror = function(event) {
|
|
146
|
+
console.error("worker: error", event.target);
|
|
147
|
+
deferred.reject(event.target);
|
|
148
|
+
};
|
|
149
|
+
}).catch(deferred.reject);
|
|
150
|
+
return deferred.pro;
|
|
151
|
+
};
|
|
152
|
+
var storeFile = async (record) => {
|
|
153
|
+
const deferred = proResolver();
|
|
154
|
+
const db = await Db();
|
|
155
|
+
const has = await hasFile(record.id);
|
|
156
|
+
const tx = db.transaction(storeName, "readwrite");
|
|
157
|
+
if (has) {
|
|
158
|
+
tx.objectStore(storeName).put(record).onsuccess = function() {
|
|
159
|
+
};
|
|
160
|
+
} else {
|
|
161
|
+
tx.objectStore(storeName).add(record).onsuccess = function() {
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
tx.oncomplete = function() {
|
|
165
|
+
deferred.resolve(true);
|
|
166
|
+
};
|
|
167
|
+
tx.onerror = function(event) {
|
|
168
|
+
console.error("worker: error", event.target);
|
|
169
|
+
deferred.reject(event.target);
|
|
170
|
+
};
|
|
171
|
+
return deferred.pro;
|
|
172
|
+
};
|
|
173
|
+
var fileStore = { has: hasFile, load: loadFile, store: storeFile };
|
|
174
|
+
|
|
175
|
+
// src/models/indexdb/book_data.ts
|
|
176
|
+
var hasBookData = (fileId) => {
|
|
177
|
+
const deferred = proResolver();
|
|
178
|
+
Db().then((db) => {
|
|
179
|
+
try {
|
|
180
|
+
const tx = db.transaction(pdfDataStoreName, "readonly");
|
|
181
|
+
const req = tx.objectStore(pdfDataStoreName).openCursor(fileId);
|
|
182
|
+
req.onsuccess = function(e) {
|
|
183
|
+
const cursor = e.target.result;
|
|
184
|
+
if (cursor) {
|
|
185
|
+
deferred.resolve(true);
|
|
186
|
+
} else {
|
|
187
|
+
deferred.resolve(false);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
req.onerror = function(e) {
|
|
191
|
+
console.error("worker: error", e.target);
|
|
192
|
+
deferred.reject(e.target);
|
|
193
|
+
};
|
|
194
|
+
} catch (e) {
|
|
195
|
+
console.error(e);
|
|
196
|
+
debugger;
|
|
197
|
+
}
|
|
198
|
+
}).catch((e) => {
|
|
199
|
+
console.error(`[indexdb error:] hasFile(): ${e.message}`);
|
|
200
|
+
deferred.reject(e);
|
|
201
|
+
});
|
|
202
|
+
return deferred.pro;
|
|
203
|
+
};
|
|
204
|
+
var loadBookData = (fileId) => {
|
|
205
|
+
const deferred = proResolver();
|
|
206
|
+
Db().then((db) => {
|
|
207
|
+
const tx = db.transaction(pdfDataStoreName, "readonly");
|
|
208
|
+
let result = void 0;
|
|
209
|
+
tx.objectStore(pdfDataStoreName).get(fileId).addEventListener("success", function(event) {
|
|
210
|
+
result = event.target.result;
|
|
211
|
+
});
|
|
212
|
+
tx.oncomplete = function() {
|
|
213
|
+
deferred.resolve(result);
|
|
214
|
+
};
|
|
215
|
+
tx.onerror = function(event) {
|
|
216
|
+
deferred.reject(event.target);
|
|
217
|
+
};
|
|
218
|
+
}).catch(deferred.reject);
|
|
219
|
+
return deferred.pro;
|
|
220
|
+
};
|
|
221
|
+
var storeBookData = (record) => {
|
|
222
|
+
const deferred = proResolver();
|
|
223
|
+
Db().then(async (db) => {
|
|
224
|
+
const has = await hasBookData(record.fileId);
|
|
225
|
+
const tx = db.transaction(pdfDataStoreName, "readwrite");
|
|
226
|
+
if (has) {
|
|
227
|
+
tx.objectStore(pdfDataStoreName).put(record);
|
|
228
|
+
} else {
|
|
229
|
+
tx.objectStore(pdfDataStoreName).add(record);
|
|
230
|
+
}
|
|
231
|
+
tx.oncomplete = function() {
|
|
232
|
+
deferred.resolve(true);
|
|
233
|
+
};
|
|
234
|
+
tx.onerror = function(event) {
|
|
235
|
+
console.error("worker: error", event.target);
|
|
236
|
+
deferred.reject(event.target);
|
|
237
|
+
};
|
|
238
|
+
}).catch(deferred.reject);
|
|
239
|
+
return deferred.pro;
|
|
240
|
+
};
|
|
241
|
+
export {
|
|
242
|
+
ActionTypes,
|
|
243
|
+
BOOK_PROP_IDS,
|
|
244
|
+
Book,
|
|
245
|
+
BookInstance,
|
|
246
|
+
CURRENT_VERSION,
|
|
247
|
+
ClearDbData,
|
|
248
|
+
DSafeCheck,
|
|
249
|
+
DateUtils,
|
|
250
|
+
Db,
|
|
251
|
+
DownloadState,
|
|
252
|
+
DownloadsByType,
|
|
253
|
+
FavoritesByTypes,
|
|
254
|
+
LANG_AGNOSTIC,
|
|
255
|
+
LANG_ID_DECODE,
|
|
256
|
+
LANG_ID_ENCODE,
|
|
257
|
+
LruCache,
|
|
258
|
+
ModelTypes,
|
|
259
|
+
NewBookWithId,
|
|
260
|
+
NewPersonWithId,
|
|
261
|
+
NewTagWithId,
|
|
262
|
+
PERSON_PROP_IDS,
|
|
263
|
+
PatchAction,
|
|
264
|
+
PatchInstance,
|
|
265
|
+
PatchOperation,
|
|
266
|
+
Patches,
|
|
267
|
+
Person,
|
|
268
|
+
PopulateStatsStore,
|
|
269
|
+
Rating,
|
|
270
|
+
Registry,
|
|
271
|
+
SchemaRegistry,
|
|
272
|
+
SidecarType,
|
|
273
|
+
Stats,
|
|
274
|
+
TAG_PROP_IDS,
|
|
275
|
+
Tag,
|
|
276
|
+
VisitsByType,
|
|
277
|
+
WorkerCommands,
|
|
278
|
+
WorkerEvent,
|
|
279
|
+
_resetForTest,
|
|
280
|
+
addReactivitySystem,
|
|
281
|
+
addRecord,
|
|
282
|
+
applyRestoredPatches,
|
|
283
|
+
clear,
|
|
284
|
+
configureDb,
|
|
285
|
+
currentLayout,
|
|
286
|
+
dbName,
|
|
287
|
+
dbReactivity,
|
|
288
|
+
debouncePromise,
|
|
289
|
+
delay,
|
|
290
|
+
deserializePatches,
|
|
291
|
+
deviceStateStoreName,
|
|
292
|
+
dump,
|
|
293
|
+
evmToPatch,
|
|
294
|
+
fileStore,
|
|
295
|
+
getLevel,
|
|
296
|
+
getPatchInstanceByAccount,
|
|
297
|
+
getRecord,
|
|
298
|
+
getRecordKey,
|
|
299
|
+
hasBookData,
|
|
300
|
+
hasFile,
|
|
301
|
+
hasRecord,
|
|
302
|
+
inceptionDate,
|
|
303
|
+
instanceRemapsStoreName,
|
|
304
|
+
isEvmPatch,
|
|
305
|
+
jsonStoreName,
|
|
306
|
+
keyValStoreName,
|
|
307
|
+
loadBookData,
|
|
308
|
+
loadFile,
|
|
309
|
+
localRecordsStoreName,
|
|
310
|
+
packPatch,
|
|
311
|
+
patchStoreName,
|
|
312
|
+
patchToEvm,
|
|
313
|
+
pdfDataStoreName,
|
|
314
|
+
pinRecord,
|
|
315
|
+
proResolver,
|
|
316
|
+
relationColName,
|
|
317
|
+
removeRecord,
|
|
318
|
+
resolveLayout,
|
|
319
|
+
scanTrash,
|
|
320
|
+
serializeBookExtended,
|
|
321
|
+
serializeBookProv,
|
|
322
|
+
serializeBookSlim,
|
|
323
|
+
serializePatches,
|
|
324
|
+
serializePersonExtended,
|
|
325
|
+
serializePersonProv,
|
|
326
|
+
serializePersonSlim,
|
|
327
|
+
serializeTagExtended,
|
|
328
|
+
serializeTagProv,
|
|
329
|
+
serializeTagSlim,
|
|
330
|
+
setReactivitySystem,
|
|
331
|
+
storeBookData,
|
|
332
|
+
storeFile,
|
|
333
|
+
subscribeLevel,
|
|
334
|
+
trashStore,
|
|
335
|
+
unpackPatch,
|
|
336
|
+
unpinRecord,
|
|
337
|
+
version,
|
|
338
|
+
versionsFile
|
|
339
|
+
};
|
|
340
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/models/dsafe.ts","../../src/models/indexdb/file_storage.ts","../../src/models/indexdb/book_data.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,IAAM,aAAa;AACnB,IAAM,gBAAgB;AAQf,IAAM,aAAa,CAAC,YAAiB;AACxC,SAAO,QAAQ,QAAQ,aAAa,MAAM,SAAS,QAAQ,QAAQ,UAAU,MAAM;AACvF;;;ACPA,IAAM,YAAW;AAEV,IAAM,UAAU,CAAC,OAAgC;AACpD,QAAM,WAAW,YAAqB;AACtC,KAAG,EAAE,KAAK,QAAM;AACZ,QAAI;AACA,YAAM,KAAK,GAAG,YAAY,WAAW,UAAU;AAC/C,YAAM,MAAM,GAAG,YAAY,SAAS,EAAE,MAAM,EAAE;AAC9C,UAAI,YAAY,SAAU,GAAG;AAEzB,cAAM,QAAQ,EAAE,OAAO;AACvB,YAAI,QAAQ,GAAG;AACX,mBAAS,QAAQ,IAAI;AAAA,QACzB,OAAO;AACH,mBAAS,QAAQ,KAAK;AAAA,QAC1B;AAAA,MACJ;AACA,UAAI,UAAU,SAAU,GAAG;AACvB,gBAAQ,MAAM,iBAAiB,EAAE,MAAM;AACvC,iBAAS,OAAO,EAAE,MAAM;AAAA,MAC5B;AAAA,IACJ,SAAQ,GAAG;AACP,cAAQ,MAAM,CAAC;AACf;AAAA,IACJ;AAAA,EACJ,CAAC,EAAE,MAAM,OAAK;AACV,YAAQ,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