@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
package/README.md CHANGED
@@ -17,11 +17,13 @@ This document provides exhaustive API reference for all exports from `@the_libra
17
17
  - [Service Worker API](#service-worker-api--the_libraryPublicdownloadersw)
18
18
 
19
19
  2. [Models API](#2-models-api--the_libraryPublicmodels)
20
+ - [Language Semantics](#language-semantics-every-value-is-per-language)
20
21
  - [Core Types & Registry](#core-types--registry)
21
22
  - [Record Cache & Reactivity](#record-cache--reactivity)
22
23
  - [Generated Models](#generated-models)
23
24
  - [Schema Registry](#schema-registry)
24
25
  - [Trash Index](#trash-index)
26
+ - [Stats & Local Analytics](#stats--local-analytics)
25
27
  - [Framework Adapters](#framework-adapters-modelsframeworknames)
26
28
  - [Patch & Session Management](#patch--session-management)
27
29
 
@@ -754,6 +756,42 @@ await unregisterDownloaderSW();
754
756
 
755
757
  The Models API provides the in-memory ORM, record cache, patch/replay engine, and schema registry for Sanctuary's data model. The root subpath exports only the framework-agnostic core; session bootstrap and reactive views are framework-specific and live under `/models/{vue,react,solid,astro}`.
756
758
 
759
+ ### Language Semantics (every value is per-language)
760
+
761
+ **Every property is per-language by default** (`perLang: true` in the V2 schema, with no overrides) — not just `title`/`description` but also numbers, booleans, and notably the universal `safe`/`deleted` flags. Storage is `Map<propId, Map<Lang, value>>`; every patch carries a `langId` and writes exactly one language slot.
762
+
763
+ **Read resolution** (`resolveLangValue`): exact language → lang-agnostic slot (`langId 0`, `Lang` code `""`) → single-value fallback (a prop with exactly one variant resolves for *every* language) → `undefined`.
764
+
765
+ **Write accessors:**
766
+
767
+ ```typescript
768
+ tag.title = 'Philosophy'; // implicit: writes Config.userLang's slot — THE DEFAULT
769
+ tag.setTitle('哲学', 'zho'); // explicit language slot — translations/imports only
770
+ tag.safe = false; // ⚠️ also lang-tagged! writes userLang's slot only
771
+ ```
772
+
773
+ `title`, `description`, and `originalLang` (plus generated model props) have explicit-language accessors (`getTitle(lang)` / `setTitle(value, lang)`). `safe`, `deleted`, `ageGradeBand`, and `previewTxId` currently have **only** the implicit userLang accessors.
774
+
775
+ #### Convention: the default language is the source of truth
776
+
777
+ **Always use the implicit accessors (`rec.description = value`) unless the task is explicitly about a specific language — then, and only then, use `rec.setDescription(value, lang)`.** The same rule applies to every property on every model.
778
+
779
+ Why:
780
+
781
+ 1. **Write/read symmetry** — implicit getters resolve `Config.userLang` first and implicit setters write that same slot, so the author's session always sees its own edit. An explicit write to another language's slot is invisible to the session that made it.
782
+ 2. **Graceful degradation** — a value that exists only under the default language still renders in every language (single-value fallback) until a real translation is added. Premature explicit-lang variants switch that fallback off: once two variants exist, languages without an exact match resolve nothing.
783
+ 3. **Shadowing is permanent** — exact-language slots beat the agnostic slot and are never cleared by writes to other slots. Every unnecessary explicit-lang write creates a variant that must be maintained forever (a stale `fra` description will keep shadowing a corrected default one).
784
+ 4. **The pipeline assumes it** — queue LWW consolidation and the per-corpus publish bake both treat the default-language stream as canonical; multilingual variants are the deliberate exception (translations, multilingual imports), not the ambient state.
785
+
786
+ **Pitfalls to know:**
787
+
788
+ 1. **Flags are per-language.** `book.deleted = true` in an `eng` session does not mark the book deleted for a reader resolving `fra` if an exact `fra` value was hydrated from the `fra` sidecar's `deleteds` column. It only *looks* global while the flag has a single variant (single-value fallback).
789
+ 2. **Exact beats agnostic (shadowing).** A `langId 0` write lands in the agnostic slot and is invisible to any language that already holds an exact value. `patch()` never clears other languages' slots.
790
+ 3. **Global flips need every slot.** To change a flag for all languages, emit `EditPropertyNumber` ops per language (or `langId: 0` when no exact-lang values exist — e.g. freshly user-created records, whose only flag slots are the constructor's agnostic seeds).
791
+ 4. **LWW consolidation is lang-keyed** (`${propertyId}:${langId}` in `Patches.cleanData`), so queued edits in different languages never collapse each other.
792
+
793
+ **Publish-side counterpart:** the corpus bake resolves patch-log edits per corpus language with the same fallback chain — see book-manager's `specifications/lang-aware-patch-baking.md`, including its documented deviation (base values don't count as variants at bake time, so single-language flag edits bake into every corpus).
794
+
757
795
  ### Core Types & Registry
758
796
 
759
797
  #### `Registry` (singleton, exported from `registry.ts`)
@@ -1063,6 +1101,137 @@ Full (re)scan — walks every currently-hydrated record and reconciles trash mem
1063
1101
 
1064
1102
  ---
1065
1103
 
1104
+ ### Stats & Local Analytics
1105
+
1106
+ Per-record engagement tracking (visits, downloads, ratings, shares) for any object type. Stats are **local-only** — they use the same patch/queue/IndexedDB pipeline as everything else in `models_v2`, but are never serialized to the EVM and never leave the device. There is no server-side aggregation; each device's `StatsStore` is a private, ephemeral index rebuilt from that device's own patch history on every boot.
1107
+
1108
+ ```typescript
1109
+ import { Stats, PopulateStatsStore, DownloadsByType, VisitsByType, FavoritesByTypes } from '@the_library/public/models';
1110
+ ```
1111
+
1112
+ **Why this exists / how it fits the patch pipeline:**
1113
+ - `Orm` (the base class every generated model — `Book`, `Tag`, `Person`, ... — extends) **also extends `Stats`**. So `book.visit()`, `book.download()`, `book.rating = Rating.Keep`, `book.ratePart(3, Rating.Keep)`, `book.share(socialMediaId)`, and `book.favoriteParts()` are available directly on every record with no separate lookup step.
1114
+ - Each call builds a `LocalOp` (discriminated by `action: ActionTypes`, not `operation: PatchOperation` like EVM patches — see `isEvmPatch()` in `interfaces.ts`), applies it to the in-memory `StatsStore` immediately, and pushes it through `PatchInstance.addPatch()` so it is queued and persisted to IndexedDB exactly like a property edit — just never included when patches are serialized for chain submission.
1115
+ - On boot, `InitPatchWorker()` (`worker-patch-main.ts`) loads every locally-stored patch for the current user, filters to the non-EVM ones (`!isEvmPatch(p)`), and replays them through `PopulateStatsStore()` to reconstruct `StatsStore` from scratch — the module-level `Map` holds nothing across a page reload until this runs.
1116
+
1117
+ #### `StatsStore` (internal, not exported)
1118
+
1119
+ `Map<objectType, Map<uid, StatSummary>>`. All reads/writes go through the functions and the `Stats` class below — there is no direct export because the map is rebuilt wholesale on every boot via `PopulateStatsStore()`.
1120
+
1121
+ #### `PopulateStatsStore(operations: Array<LocalOp>): void`
1122
+
1123
+ Applies a batch of local analytics ops to `StatsStore`, creating a fresh `StatSummary` (`{ visits: [], downloads: [], rating: Rating.None, socialMediaId: [], parts: {} }`) for any `(objectType, objectId)` pair seen for the first time. Used internally by `Stats`'s instance methods (one-op batches) and by boot-time replay (bulk). Safe to call directly when replaying stored ops (e.g. from a worker) without wanting to also re-emit patches.
1124
+
1125
+ **Parameters:**
1126
+ - `operations: Array<LocalOp>` — ops with `action` one of `ActionTypes.Visit | VisitPart | Download | Rate | RatePart | Share | SharePart`.
1127
+
1128
+ **Returns:** `void`
1129
+
1130
+ ---
1131
+
1132
+ #### `DownloadsByType(objectType: number): Array<uid>`
1133
+
1134
+ Ids of every record of `objectType` that has at least one recorded download.
1135
+
1136
+ #### `VisitsByType(objectType: number): Array<uid>`
1137
+
1138
+ Ids of every record of `objectType` that has at least one recorded visit.
1139
+
1140
+ #### `FavoritesByTypes(objectType: number): Array<{ id: uid, nbVisits: number, rating: Rating }>`
1141
+
1142
+ Ids "worth surfacing" for `objectType` — any record with a visit, a download, or a rating of `Rating.Keep`, `Rating.New`, or `Rating.Shared` — sorted by `nbVisits` descending. Used to power "your library" / favorites views (see `DownloadedBooks.vue`, `VisitedBooks.vue`, `MyBooksIdsTab.vue` in the Vue app).
1143
+
1144
+ ```typescript
1145
+ import { Book, Tag } from '@the_library/public/models/models';
1146
+ import { DownloadsByType, VisitsByType, FavoritesByTypes } from '@the_library/public/models';
1147
+
1148
+ const downloadedBookIds = DownloadsByType(Book.type).map(id => Book.Load(id));
1149
+ const visitedTagIds = VisitsByType(Tag.type);
1150
+ const favoriteBooks = FavoritesByTypes(Book.type); // sorted, most-visited first
1151
+ ```
1152
+
1153
+ ---
1154
+
1155
+ #### `class Stats`
1156
+
1157
+ Base class `Orm` extends — normally accessed through a record instance (`book.visit()`), not instantiated directly.
1158
+
1159
+ ```typescript
1160
+ constructor(objectId: uid, objectType: number)
1161
+ ```
1162
+
1163
+ **Instance methods:**
1164
+
1165
+ - `visit(): void` — Records a visit (timestamp via `DateUtils.now()`, seconds since the package's fixed inception date — not raw Unix epoch).
1166
+ - `download(): void` — Records a download.
1167
+ - `share(socialMediaId: number): void` — Records a share to a given social media channel id.
1168
+ - `ratePart(partId: number, rating: Rating): void` — Sets the rating for a sub-part (e.g. a book chapter) of the record.
1169
+ - `visitPart(partId: number): void` — Records a visit to a sub-part.
1170
+ - `get rating(): Rating` / `set rating(rating: Rating)` — Whole-record rating. The getter lazily creates the `StatSummary` (via internal `check()`) if none exists yet, so reading never throws for a never-touched record.
1171
+ - `favoriteParts(): Array<{ partId: number, nbVisits: number, rating: Rating }>` — This record's sub-parts with any visits, sorted by `nbVisits` descending.
1172
+
1173
+ Every mutating method above follows the same shape: build a typed op → `PopulateStatsStore([op])` (apply locally, synchronous) → `PatchInstance.addPatch(op)` (queue + persist). Reads never touch the patch queue.
1174
+
1175
+ ```typescript
1176
+ import { Book } from '@the_library/public/models/models';
1177
+ import { Rating } from '@the_library/public/models';
1178
+
1179
+ const book = await Book.LoadAsync(id);
1180
+ book.visit(); // whole-record visit
1181
+ book.visitPart(3); // e.g. chapter 3
1182
+ book.rating = Rating.Keep; // whole-record rating
1183
+ book.ratePart(3, Rating.Keep);
1184
+ book.share(socialMediaId);
1185
+ book.favoriteParts(); // [{ partId: 3, nbVisits: 1, rating: Rating.Keep }]
1186
+ ```
1187
+
1188
+ **Real-world pattern** (`router/analytics.ts`): visiting a `Tag` also visits every ancestor tag up the `inTagsIds` chain, and visiting a `Book` also visits every `Tag` it belongs to — so browsing a book implicitly credits the whole topic path it hangs off, not just the leaf record.
1189
+
1190
+ **Type: `StatSummary`**
1191
+ ```typescript
1192
+ type StatSummary = {
1193
+ visits: Array<number>; // timestamps (DateUtils.now() units)
1194
+ downloads: Array<number>;
1195
+ rating: Rating;
1196
+ socialMediaId: Array<number>;
1197
+ parts: {
1198
+ [partId: string]: {
1199
+ rating: Rating;
1200
+ visits: Array<number>;
1201
+ socialMediaId: Array<number>;
1202
+ }
1203
+ };
1204
+ }
1205
+ ```
1206
+
1207
+ **Type: `ActionTypes`** (local-only op discriminator — do not confuse with EVM `PatchOperation`)
1208
+ ```typescript
1209
+ enum ActionTypes {
1210
+ Visit = 0,
1211
+ VisitPart = 1,
1212
+ Download = 2,
1213
+ Rate = 3,
1214
+ RatePart = 4,
1215
+ Share = 5,
1216
+ SharePart = 6,
1217
+ }
1218
+ ```
1219
+
1220
+ **Type: `Rating`**
1221
+ ```typescript
1222
+ enum Rating {
1223
+ None,
1224
+ New,
1225
+ Keep,
1226
+ Trash,
1227
+ Shared,
1228
+ }
1229
+ ```
1230
+
1231
+ **Type: `LocalOp`** (and its variants `BaseLocalOp`, `RateOp`, `PartOp`, `RatePartOp`, `ShareOp`, `SharePartOp`) — the local-analytics half of `QueueItem` (`AnyPatch | LocalOp`). `isEvmPatch(item)` discriminates the two by checking for a defined `operation` field.
1232
+
1233
+ ---
1234
+
1066
1235
  ### Framework Adapters (`/models/{vue,react,solid,astro}`)
1067
1236
 
1068
1237
  #### Vue Composables
@@ -1380,13 +1549,13 @@ Hydrates a wallet account after connection by pulling `hasAccount`, `username`,
1380
1549
  ```typescript
1381
1550
  import { syncAccount } from '@the_library/public/web3';
1382
1551
 
1383
- const account = await syncAccount('0xabc...', 1116, 'metamask');
1552
+ const account = await syncAccount('0xabc...', 146, 'metamask');
1384
1553
  console.log(`${account.username} is level ${account.level}`);
1385
1554
  ```
1386
1555
 
1387
1556
  **Parameters:**
1388
1557
  - `address: string` — Wallet address (hex).
1389
- - `chainId: number` — Chain ID (1116, 1114, etc.).
1558
+ - `chainId: number` — Chain ID (146, 14601, etc.).
1390
1559
  - `walletType: WalletType` — `'metamask'` or `'private_key'`.
1391
1560
 
1392
1561
  **Returns:** `Promise<Web3SessionAccount>` — The hydrated account record.
@@ -1427,7 +1596,7 @@ Gets the read-only client for a chain. Blocks until contract addresses/ABIs are
1427
1596
  ```typescript
1428
1597
  import { getReadClient } from '@the_library/public/web3';
1429
1598
 
1430
- const client = getReadClient(1116);
1599
+ const client = getReadClient(146);
1431
1600
  await client.ready; // wait for registry load
1432
1601
 
1433
1602
  const balance = await client.projectManagerStorage.balanceOfAddress('0xabc...');
@@ -1436,7 +1605,7 @@ const nbAccounts = await client.bouncerStorage.nbAccounts();
1436
1605
  ```
1437
1606
 
1438
1607
  **Parameters:**
1439
- - `chainId: number` — EVM chain ID (1116, 1114, 84532, etc.).
1608
+ - `chainId: number` — EVM chain ID (146, 14601, 84532, etc.).
1440
1609
  - `environment?: 'production' | 'staging'` — Defaults to `'production'`. Use `'staging'` to read staging-deployed contract addresses.
1441
1610
 
1442
1611
  **Returns:** `ReadOnlyDomainAPI` — Typed interface to all contract reads.
@@ -1620,7 +1789,7 @@ If a transaction throws and the run-lock needs to be cleared manually, call `res
1620
1789
  ```typescript
1621
1790
  import { getChain, EVM_CHAINS, DEFAULT_CHAIN_ID } from '@the_library/public/web3';
1622
1791
 
1623
- const chain = getChain(1116);
1792
+ const chain = getChain(146);
1624
1793
  // chain.name, chain.symbol, chain.shortName, chain.logo, chain.explorer,
1625
1794
  // chain.rpc, chain.main (true for mainnet), chain.deployed, chain.stagingDeployed
1626
1795
 
@@ -1630,10 +1799,10 @@ const deployedChains = Object.values(EVM_CHAINS).filter(c => c.deployed);
1630
1799
  **Type: `EvmChainConfig`**
1631
1800
  ```typescript
1632
1801
  interface EvmChainConfig {
1633
- name: string; // 'CORE' | 'tCORE2' | 'Base Sepolia'
1634
- shortName: string; // 'core' | 'tcore2' | ...
1802
+ name: string; // 'Sonic' | 'Sonic Blaze' | 'Base Sepolia'
1803
+ shortName: string; // 'TREE' | 'WATER' | ... (mainnet/testnet shorthand codenames, not the chain name)
1635
1804
  chainId: number;
1636
- symbol: string; // 'CORE' | 'CORETST' | ...
1805
+ symbol: string; // 'S' | ...
1637
1806
  logo: string; // URL to chain logo
1638
1807
  explorer: string; // Block explorer URL
1639
1808
  rpc: string[]; // RPC endpoints
@@ -1650,13 +1819,13 @@ interface EvmChainConfig {
1650
1819
  ```typescript
1651
1820
  import { useChain } from '@the_library/public/web3/vue';
1652
1821
 
1653
- const { chain, client, usdPrice, refreshPrice, isMainnet, chainRouteQuery } = useChain(1116);
1822
+ const { chain, client, usdPrice, refreshPrice, isMainnet, chainRouteQuery } = useChain(146);
1654
1823
  // chain: EvmChainConfig
1655
1824
  // client: ReadOnlyDomainAPI (ready to use)
1656
1825
  // usdPrice: Ref<number> — live USD price polling
1657
1826
  // refreshPrice: () => Promise<void>
1658
1827
  // isMainnet: boolean
1659
- // chainRouteQuery: { chainId: '1116' } — useful for router links
1828
+ // chainRouteQuery: { chainId: '146' } — useful for router links
1660
1829
  ```
1661
1830
 
1662
1831
  ---
@@ -1671,7 +1840,7 @@ Dynamic contract address and ABI resolution from the on-chain `AddressRegistry`.
1671
1840
  import { addressLoader, setRegistryBaseUrl } from '@the_library/public/web3';
1672
1841
 
1673
1842
  // Set custom registry host (before anything else runs)
1674
- setRegistryBaseUrl('https://registry.world.bibliotech.com');
1843
+ setRegistryBaseUrl('https://registry.worldbibliotech.com');
1675
1844
 
1676
1845
  // Subscribe to per-contract load progress
1677
1846
  const unsubscribe = addressLoader.subscribe((chainId, status) => {
@@ -1697,7 +1866,7 @@ const abi = addressLoader.getAbi(chainId, 'Factory');
1697
1866
 
1698
1867
  #### `setRegistryBaseUrl(url: string): void`
1699
1868
 
1700
- Override the default registry host URL (normally `https://registry.world.bibliotech.com`). Call before any clients are instantiated.
1869
+ Override the default registry host URL (normally `https://registry.worldbibliotech.com`). Call before any clients are instantiated.
1701
1870
 
1702
1871
  ---
1703
1872
 
@@ -1712,7 +1881,7 @@ Gets a chain-scoped subscription client.
1712
1881
  ```typescript
1713
1882
  import { getSubscriptionClient } from '@the_library/public/web3';
1714
1883
 
1715
- const subs = getSubscriptionClient(1116);
1884
+ const subs = getSubscriptionClient(146);
1716
1885
 
1717
1886
  // First sync: full BFS walk + patch fetch
1718
1887
  const { patches, cursor, truncated } = await subs.sync(rootUserId);
@@ -1943,8 +2112,8 @@ if (!meta.isInstalled() && meta.isInstallable()) {
1943
2112
  ```typescript
1944
2113
  import { storePrivateKey, hasPrivateKey, hasAnyPrivateKey } from '@the_library/public/web3';
1945
2114
 
1946
- storePrivateKey(1116, '0x1234...'); // raw hex, no '0x' prefix required
1947
- if (hasPrivateKey(1116)) {
2115
+ storePrivateKey(146, '0x1234...'); // raw hex, no '0x' prefix required
2116
+ if (hasPrivateKey(146)) {
1948
2117
  // PrivateKeyConnector can connect to this chain
1949
2118
  }
1950
2119
 
@@ -1968,11 +2137,11 @@ Loads a single project by ID with language fallback. Cached automatically.
1968
2137
  ```typescript
1969
2138
  import { loadProject } from '@the_library/public/web3';
1970
2139
 
1971
- const project = await loadProject(1116, 'eng', 5);
2140
+ const project = await loadProject(146, 'eng', 5);
1972
2141
  console.log(`${project.version.name} — ${project.balance} tokens`);
1973
2142
 
1974
2143
  // Force re-fetch from chain, bypassing cache
1975
- const fresh = await loadProject(1116, 'eng', 5, true);
2144
+ const fresh = await loadProject(146, 'eng', 5, true);
1976
2145
  ```
1977
2146
 
1978
2147
  **Parameters:**
@@ -1994,7 +2163,7 @@ Loads all projects for a chain/language. Returns cached projects if chain is unr
1994
2163
  ```typescript
1995
2164
  import { loadProjects } from '@the_library/public/web3';
1996
2165
 
1997
- const projects = await loadProjects(1116, 'eng');
2166
+ const projects = await loadProjects(146, 'eng');
1998
2167
  const validProjects = projects.filter(p => p !== null);
1999
2168
  ```
2000
2169
 
@@ -2014,7 +2183,7 @@ Helper to convert raw `Project` data to `ProjectLocale` with language selection
2014
2183
  import { projectLocale } from '@the_library/public/web3';
2015
2184
 
2016
2185
  const raw = await client.projectManagerStorage.loadProject(5);
2017
- const locale = projectLocale(raw, 'eng', 1116);
2186
+ const locale = projectLocale(raw, 'eng', 146);
2018
2187
  ```
2019
2188
 
2020
2189
  **Parameters:**
@@ -2031,7 +2200,7 @@ const locale = projectLocale(raw, 'eng', 1116);
2031
2200
  ```typescript
2032
2201
  import { useLoadProjects } from '@the_library/public/web3/vue';
2033
2202
 
2034
- const chainId = ref(1116);
2203
+ const chainId = ref(146);
2035
2204
  const language = ref('eng');
2036
2205
 
2037
2206
  const { projects, isLoading, error, reload } = useLoadProjects(chainId, language);
@@ -2051,8 +2220,8 @@ const { projects, isLoading, error, reload } = useLoadProjects(chainId, language
2051
2220
  import { EVM_CHAINS } from '@the_library/public/web3';
2052
2221
 
2053
2222
  // EVM_CHAINS = {
2054
- // 1116: { name: 'CORE', ... },
2055
- // 1114: { name: 'tCORE2', ... },
2223
+ // 146: { name: 'Sonic', ... },
2224
+ // 14601: { name: 'Sonic Blaze', ... },
2056
2225
  // 84532: { name: 'Base Sepolia', ... },
2057
2226
  // }
2058
2227
  ```
@@ -2061,7 +2230,7 @@ import { EVM_CHAINS } from '@the_library/public/web3';
2061
2230
 
2062
2231
  #### `DEFAULT_CHAIN_ID` (constant)
2063
2232
 
2064
- The default chain for new users (usually production mainnet, e.g., `1116`).
2233
+ The default chain for new users (usually production mainnet, e.g., `146`).
2065
2234
 
2066
2235
  ---
2067
2236
 
@@ -2072,7 +2241,7 @@ Gets full metadata for a chain. Throws if `chainId` is not registered.
2072
2241
  ```typescript
2073
2242
  import { getChain } from '@the_library/public/web3';
2074
2243
 
2075
- const chain = getChain(1116);
2244
+ const chain = getChain(146);
2076
2245
  console.log(`${chain.name} (${chain.symbol})`);
2077
2246
  ```
2078
2247
 
@@ -2090,7 +2259,7 @@ import { bootstrapWebSDK, BootstrapResultKey } from '@the_library/public/web3/vu
2090
2259
  const result = await bootstrapWebSDK({
2091
2260
  withTest: true,
2092
2261
  environment: 'production',
2093
- chainFilter: [1116, 1114], // optional: limit to these chains
2262
+ chainFilter: [146, 14601], // optional: limit to these chains
2094
2263
  });
2095
2264
 
2096
2265
  await result.ready; // wait for account discovery
@@ -2154,13 +2323,13 @@ const {
2154
2323
  ```typescript
2155
2324
  import { useChain } from '@the_library/public/web3/vue';
2156
2325
 
2157
- const { chain, client, usdPrice, refreshPrice, isMainnet, chainRouteQuery } = useChain(1116);
2326
+ const { chain, client, usdPrice, refreshPrice, isMainnet, chainRouteQuery } = useChain(146);
2158
2327
  // chain: Ref<EvmChainConfig>
2159
2328
  // client: Ref<ReadOnlyDomainAPI>
2160
2329
  // usdPrice: Ref<number>
2161
2330
  // refreshPrice: () => Promise<void>
2162
2331
  // isMainnet: boolean
2163
- // chainRouteQuery: { chainId: '1116' }
2332
+ // chainRouteQuery: { chainId: '146' }
2164
2333
  ```
2165
2334
 
2166
2335
  ---
@@ -2171,7 +2340,7 @@ const { chain, client, usdPrice, refreshPrice, isMainnet, chainRouteQuery } = us
2171
2340
  import { useLoadProjects } from '@the_library/public/web3/vue';
2172
2341
 
2173
2342
  const { projects, isLoading, error, reload } = useLoadProjects(
2174
- ref(1116),
2343
+ ref(146),
2175
2344
  ref('eng')
2176
2345
  );
2177
2346
  ```
@@ -2276,6 +2445,10 @@ interface SocialMediaUrls {
2276
2445
  - `LevelData` — user's reading level and corpus progress
2277
2446
  - `BootData` — result of `bootstrapModelsV2()`
2278
2447
  - `TrashStore` — global trash index API (`list`/`count`/`usernames`/`subscribe`)
2448
+ - `StatSummary` — per-record visits/downloads/rating/shares/parts
2449
+ - `ActionTypes` — local analytics op discriminator (`Visit`, `Download`, `Rate`, ...)
2450
+ - `Rating` — `None` / `New` / `Keep` / `Trash` / `Shared`
2451
+ - `LocalOp` (`BaseLocalOp`, `RateOp`, `PartOp`, `RatePartOp`, `ShareOp`, `SharePartOp`) — local analytics op variants
2279
2452
 
2280
2453
  ### Web3 Types
2281
2454
  - `Web3SessionAccount` — wallet state in session store
@@ -4,7 +4,7 @@
4
4
  - * Non-Profit Public Library — The World Library
5
5
  - *
6
6
  - * Licensed under the D-Open Code Sovereign Licence v1.0
7
- - * https://registry.world.bibliotech.com/licence
7
+ - * https://registry.worldbibliotech.com/licence
8
8
  - *
9
9
  - * Technical Guardian ("The Shield"): Pond Enterprise Pty Ltd. (ACN 694 747 987)
10
10
  - * All liability claims directed to Pond Enterprise Pty Ltd.