@seedprotocol/sdk 0.7.9 → 0.7.10-next.1353.g74aeeed

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 (136) hide show
  1. package/README.md +1 -1
  2. package/dist/{BaseFileManager-BAlySv8w.js → BaseFileManager-DLou1TZS.js} +5 -1
  3. package/dist/BaseFileManager-DLou1TZS.js.map +1 -0
  4. package/dist/{Item-Bf4kWKpH.js → Item-oPnmIehk.js} +571 -346
  5. package/dist/Item-oPnmIehk.js.map +1 -0
  6. package/dist/{ModelProperty-BlaEgb_U.js → ModelProperty-D2vJozmW.js} +95 -62
  7. package/dist/ModelProperty-D2vJozmW.js.map +1 -0
  8. package/dist/{Schema-J_1f6p0c.js → Schema-BMXRF4j9.js} +88 -52
  9. package/dist/Schema-BMXRF4j9.js.map +1 -0
  10. package/dist/{SchemaValidationService-CnmKyzR-.js → SchemaValidationService-CieGrj5c.js} +5 -5
  11. package/dist/{SchemaValidationService-CnmKyzR-.js.map → SchemaValidationService-CieGrj5c.js.map} +1 -1
  12. package/dist/{errors-C1qUEZ7A.js → browserSupport-C64rX-2I.js} +38 -2
  13. package/dist/browserSupport-C64rX-2I.js.map +1 -0
  14. package/dist/{configurePlatform-CiOJ1R3q.js → configurePlatform-WkmvqeTO.js} +2 -2
  15. package/dist/{configurePlatform-CiOJ1R3q.js.map → configurePlatform-WkmvqeTO.js.map} +1 -1
  16. package/dist/{detachRowsBeforeDelete-sEaUwlOU.js → detachRowsBeforeDelete-BZr_0iZU.js} +2 -2
  17. package/dist/{detachRowsBeforeDelete-sEaUwlOU.js.map → detachRowsBeforeDelete-BZr_0iZU.js.map} +1 -1
  18. package/dist/dist/{BaseFileManager-BAlySv8w.d.ts → BaseFileManager-DLou1TZS.d.ts} +3 -1
  19. package/dist/dist/BaseFileManager-DLou1TZS.d.ts.map +1 -0
  20. package/dist/dist/{configurePlatform-CiOJ1R3q.d.ts → configurePlatform-WkmvqeTO.d.ts} +1 -1
  21. package/dist/dist/configurePlatform-WkmvqeTO.d.ts.map +1 -0
  22. package/dist/dist/{index-D0V-mjCV.d.ts → index-BjWk0x4-.d.ts} +1 -1
  23. package/dist/dist/{index-D0V-mjCV.d.ts.map → index-BjWk0x4-.d.ts.map} +1 -1
  24. package/dist/dist/{index.node-CYPemH-t.d.ts → index.node-BfiBriEq.d.ts} +7 -1
  25. package/dist/dist/{index.node-CYPemH-t.d.ts.map → index.node-BfiBriEq.d.ts.map} +1 -1
  26. package/dist/dist/platform.node.d.ts +2 -2
  27. package/dist/{eas-wB_fQ8Tc.js → eas-FZPPqxqe.js} +5 -5
  28. package/dist/{eas-wB_fQ8Tc.js.map → eas-FZPPqxqe.js.map} +1 -1
  29. package/dist/{errors-DLSoqSHG.js → errors-CnT0fSMK.js} +185 -97
  30. package/dist/errors-CnT0fSMK.js.map +1 -0
  31. package/dist/{getPublishPayload-BnIwpwz1.js → getPublishPayload-DKuEaq96.js} +8 -8
  32. package/dist/{getPublishPayload-BnIwpwz1.js.map → getPublishPayload-DKuEaq96.js.map} +1 -1
  33. package/dist/{getPublishPendingDiff-D6_-A5ns.js → getPublishPendingDiff-CH5xLMjU.js} +7 -7
  34. package/dist/{getPublishPendingDiff-D6_-A5ns.js.map → getPublishPendingDiff-CH5xLMjU.js.map} +1 -1
  35. package/dist/{getPublishUploads-sS6JfPgz.js → getPublishUploads-DivYpgNw.js} +7 -7
  36. package/dist/{getPublishUploads-sS6JfPgz.js.map → getPublishUploads-DivYpgNw.js.map} +1 -1
  37. package/dist/{index-D0V-mjCV.js → index-BjWk0x4-.js} +2 -2
  38. package/dist/index-BjWk0x4-.js.map +1 -0
  39. package/dist/{index-CYGWPoOx.js → index-CZMWKXLM.js} +7 -7
  40. package/dist/index-CZMWKXLM.js.map +1 -0
  41. package/dist/{index-BVBmz_cc.js → index-DXRhFg1N.js} +7 -7
  42. package/dist/index-DXRhFg1N.js.map +1 -0
  43. package/dist/{index-DmTtj1nk.js → index-Gh42_47r.js} +402 -20
  44. package/dist/index-Gh42_47r.js.map +1 -0
  45. package/dist/{index.browser-CUmBVYen.js → index.browser-DQstVvRV.js} +46 -10
  46. package/dist/index.browser-DQstVvRV.js.map +1 -0
  47. package/dist/{index.node-CYPemH-t.js → index.node-BfiBriEq.js} +31 -4
  48. package/dist/index.node-BfiBriEq.js.map +1 -0
  49. package/dist/main.js +17 -16
  50. package/dist/main.js.map +1 -1
  51. package/dist/{modelPropertyRecordSchemas-C7UgA5TH.js → modelPropertyRecordSchemas-DEe-lYhn.js} +5 -5
  52. package/dist/{modelPropertyRecordSchemas-C7UgA5TH.js.map → modelPropertyRecordSchemas-DEe-lYhn.js.map} +1 -1
  53. package/dist/node.js +8 -8
  54. package/dist/platform.browser.js +6 -6
  55. package/dist/platform.node.js +4 -4
  56. package/dist/{property-BxUYznH0.js → property-iNW1N3vm.js} +8 -8
  57. package/dist/{property-BxUYznH0.js.map → property-iNW1N3vm.js.map} +1 -1
  58. package/dist/{publishGraph-EcB40Uii.js → publishGraph-CRn_N3NT.js} +5 -5
  59. package/dist/{publishGraph-EcB40Uii.js.map → publishGraph-CRn_N3NT.js.map} +1 -1
  60. package/dist/{readHtmlBodyForStorageSeed-D6KPtWoR.js → readHtmlBodyForStorageSeed-B7HgPmq6.js} +10 -10
  61. package/dist/{readHtmlBodyForStorageSeed-D6KPtWoR.js.map → readHtmlBodyForStorageSeed-B7HgPmq6.js.map} +1 -1
  62. package/dist/src/Item/Item.d.ts +26 -5
  63. package/dist/src/Item/Item.d.ts.map +1 -1
  64. package/dist/src/ItemProperty/ItemProperty.d.ts +20 -5
  65. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  66. package/dist/src/ItemProperty/loadProperty.d.ts.map +1 -1
  67. package/dist/src/ItemProperty/propertyWrite.d.ts.map +1 -1
  68. package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
  69. package/dist/src/Model/Model.d.ts +45 -34
  70. package/dist/src/Model/Model.d.ts.map +1 -1
  71. package/dist/src/ModelProperty/ModelProperty.d.ts +31 -13
  72. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  73. package/dist/src/Schema/Schema.d.ts +36 -27
  74. package/dist/src/Schema/Schema.d.ts.map +1 -1
  75. package/dist/src/archive/exportArchive.d.ts +57 -0
  76. package/dist/src/archive/exportArchive.d.ts.map +1 -0
  77. package/dist/src/browser/db/Db.d.ts +5 -0
  78. package/dist/src/browser/db/Db.d.ts.map +1 -1
  79. package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
  80. package/dist/src/browser/helpers/tolerantWebAccess.d.ts +12 -1
  81. package/dist/src/browser/helpers/tolerantWebAccess.d.ts.map +1 -1
  82. package/dist/src/client/ClientManager.d.ts +14 -4
  83. package/dist/src/client/ClientManager.d.ts.map +1 -1
  84. package/dist/src/db/Db/BaseDb.d.ts +2 -0
  85. package/dist/src/db/Db/BaseDb.d.ts.map +1 -1
  86. package/dist/src/helpers/FileManager/errors.d.ts +11 -0
  87. package/dist/src/helpers/FileManager/errors.d.ts.map +1 -1
  88. package/dist/src/helpers/browserSupport.d.ts +23 -0
  89. package/dist/src/helpers/browserSupport.d.ts.map +1 -0
  90. package/dist/src/helpers/cachedPropertyRefresh.d.ts +6 -6
  91. package/dist/src/helpers/cachedPropertyRefresh.d.ts.map +1 -1
  92. package/dist/src/helpers/entity/entityCache.d.ts +45 -3
  93. package/dist/src/helpers/entity/entityCache.d.ts.map +1 -1
  94. package/dist/src/helpers/entity/entityLifecycle.d.ts +21 -3
  95. package/dist/src/helpers/entity/entityLifecycle.d.ts.map +1 -1
  96. package/dist/src/helpers/propertyDefinition.d.ts +2 -0
  97. package/dist/src/helpers/propertyDefinition.d.ts.map +1 -1
  98. package/dist/src/helpers/schemaApply.d.ts.map +1 -1
  99. package/dist/src/helpers/tabCoordinator.d.ts +9 -2
  100. package/dist/src/helpers/tabCoordinator.d.ts.map +1 -1
  101. package/dist/src/index.d.ts +4 -1
  102. package/dist/src/index.d.ts.map +1 -1
  103. package/dist/src/interfaces/IDb.d.ts +6 -0
  104. package/dist/src/interfaces/IDb.d.ts.map +1 -1
  105. package/dist/src/node/db/Db.d.ts +6 -0
  106. package/dist/src/node/db/Db.d.ts.map +1 -1
  107. package/dist/src/outbox/conflicts.d.ts.map +1 -1
  108. package/dist/src/outbox/outbox.d.ts +6 -0
  109. package/dist/src/outbox/outbox.d.ts.map +1 -1
  110. package/dist/src/types/index.d.ts +16 -0
  111. package/dist/src/types/index.d.ts.map +1 -1
  112. package/dist/{syncDbWithEas-CA7PvBgu.js → syncDbWithEas-FuyqoEKk.js} +14 -14
  113. package/dist/{syncDbWithEas-CA7PvBgu.js.map → syncDbWithEas-FuyqoEKk.js.map} +1 -1
  114. package/dist/{tabEvents-CaVmngqr.js → tabEvents-DT5ez6io.js} +38 -12
  115. package/dist/tabEvents-DT5ez6io.js.map +1 -0
  116. package/dist/{tolerantWebAccess-BJqViq08.js → tolerantWebAccess-zEseJ2zT.js} +53 -13
  117. package/dist/tolerantWebAccess-zEseJ2zT.js.map +1 -0
  118. package/dist/{updateSeedRevokedAt-BL9Bg-G7.js → updateSeedRevokedAt-B9JRwr5T.js} +3 -3
  119. package/dist/{updateSeedRevokedAt-BL9Bg-G7.js.map → updateSeedRevokedAt-B9JRwr5T.js.map} +1 -1
  120. package/package.json +10 -12
  121. package/dist/BaseFileManager-BAlySv8w.js.map +0 -1
  122. package/dist/Item-Bf4kWKpH.js.map +0 -1
  123. package/dist/ModelProperty-BlaEgb_U.js.map +0 -1
  124. package/dist/Schema-J_1f6p0c.js.map +0 -1
  125. package/dist/dist/BaseFileManager-BAlySv8w.d.ts.map +0 -1
  126. package/dist/dist/configurePlatform-CiOJ1R3q.d.ts.map +0 -1
  127. package/dist/errors-C1qUEZ7A.js.map +0 -1
  128. package/dist/errors-DLSoqSHG.js.map +0 -1
  129. package/dist/index-BVBmz_cc.js.map +0 -1
  130. package/dist/index-CYGWPoOx.js.map +0 -1
  131. package/dist/index-D0V-mjCV.js.map +0 -1
  132. package/dist/index-DmTtj1nk.js.map +0 -1
  133. package/dist/index.browser-CUmBVYen.js.map +0 -1
  134. package/dist/index.node-CYPemH-t.js.map +0 -1
  135. package/dist/tabEvents-CaVmngqr.js.map +0 -1
  136. package/dist/tolerantWebAccess-BJqViq08.js.map +0 -1
@@ -2,9 +2,9 @@ import { constants, Inode, vfs } from '@zenfs/core';
2
2
  import { join, dirname } from '@zenfs/core/path';
3
3
  import { WebAccess, WebAccessFS } from '@zenfs/dom';
4
4
  import debug from 'debug';
5
- import { i as isSkippableOpfsEntryError } from './index.browser-CUmBVYen.js';
6
- import './tabEvents-CaVmngqr.js';
7
- import './BaseFileManager-BAlySv8w.js';
5
+ import { i as isSkippableOpfsEntryError } from './index.browser-DQstVvRV.js';
6
+ import './tabEvents-DT5ez6io.js';
7
+ import './BaseFileManager-DLou1TZS.js';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'drizzle-orm';
10
10
  import 'xstate';
@@ -18,15 +18,17 @@ import '@noble/hashes/sha256';
18
18
  import '@noble/hashes/sha3';
19
19
  import '@noble/hashes/utils';
20
20
  import 'lodash-es';
21
- import './errors-C1qUEZ7A.js';
21
+ import './browserSupport-C64rX-2I.js';
22
22
  import 'drizzle-orm/sqlite-proxy';
23
- import './index-D0V-mjCV.js';
23
+ import './index-BjWk0x4-.js';
24
24
  import 'sqlocal/drizzle';
25
25
  import './minimumUpgradeVersion-BDhHvHtr.js';
26
26
  import 'rxjs';
27
- import './configurePlatform-CiOJ1R3q.js';
27
+ import './configurePlatform-WkmvqeTO.js';
28
28
 
29
29
  const logger = debug('seedSdk:browser:helpers:tolerantWebAccess');
30
+ /** The touch WebAccessFS inherits from ZenFS's Async mixin, under its own override. */
31
+ const asyncTouch = Object.getPrototypeOf(WebAccessFS.prototype).touch;
30
32
  /**
31
33
  * WebAccessFS mounts by walking all of OPFS and reading every file's size, and one unreadable
32
34
  * entry fails the whole mount. This variant skips such entries instead. A skipped file is still
@@ -37,7 +39,7 @@ const logger = debug('seedSdk:browser:helpers:tolerantWebAccess');
37
39
  * file this mount had indexed at a smaller size: OPFS only shrinks for a truncate made through this
38
40
  * mount, and stat() re-reads a file's size when OPFS changed since this mount last looked.
39
41
  *
40
- * Overrides @zenfs/dom 1.2.9 / @zenfs/core 2.5.6 internals (`_loadHandles`, `_loadMetadata`,
42
+ * Overrides @zenfs/dom 1.2.14 / @zenfs/core 2.7.7 internals (`_loadHandles`, `_loadMetadata`,
41
43
  * `crossCopy`, `stat`, `write`, `touch`, `remove`, `get`, `_handles`, `_sync`, `_isInitialized`,
42
44
  * `index`, and `vfs.Handle#truncate`/`truncateSync`, see `trackTruncates`); both packages are pinned
43
45
  * to exact versions, and tolerantWebAccess.test.ts / opfsOverwrite.test.ts cover the coupling.
@@ -126,12 +128,15 @@ class TolerantWebAccessFS extends WebAccessFS {
126
128
  * the file changed.
127
129
  */
128
130
  async stat(path) {
131
+ const indexed = this.index.has(path);
129
132
  const inode = (await super.stat(path));
130
- if ((inode.mode & constants.S_IFMT) != constants.S_IFREG)
131
- return inode;
132
133
  // While mounting, sizes were just read and crossCopy stats every file.
133
134
  if (!this._isInitialized)
134
135
  return inode;
136
+ if (!indexed)
137
+ await this._cacheIndexed(path, inode);
138
+ if ((inode.mode & constants.S_IFMT) != constants.S_IFREG)
139
+ return inode;
135
140
  // This mount truncated the file and OPFS doesn't have it yet: the inode's size is the truth.
136
141
  if (this._truncates.has(path))
137
142
  return inode;
@@ -155,6 +160,34 @@ class TolerantWebAccessFS extends WebAccessFS {
155
160
  await this._recache(path, inode, file);
156
161
  return inode;
157
162
  }
163
+ /**
164
+ * Adds an entry WebAccessFS.stat() just indexed from OPFS (made by another context after this
165
+ * mount loaded: a tab, SQLocal's worker creating `db/`) to the in-memory copy behind the sync API.
166
+ * ZenFS mirrors every write and create into that copy and fails the call when the entry or its
167
+ * directory is missing there.
168
+ */
169
+ async _cacheIndexed(path, inode) {
170
+ try {
171
+ this._sync.statSync(path);
172
+ return;
173
+ }
174
+ catch {
175
+ // Not cached yet.
176
+ }
177
+ await this._cacheParents(path);
178
+ try {
179
+ if ((inode.mode & constants.S_IFMT) == constants.S_IFDIR) {
180
+ this._sync.mkdirSync(path, inode);
181
+ this._sync.touchSync(path, inode);
182
+ }
183
+ else {
184
+ await this.crossCopy(path);
185
+ }
186
+ }
187
+ catch (error) {
188
+ logger(`could not cache ${path}: ${error.name}`);
189
+ }
190
+ }
158
191
  /** Replaces the sync API's in-memory copy of `path` with `file`, if it holds one. */
159
192
  async _recache(path, inode, file) {
160
193
  try {
@@ -252,7 +285,9 @@ class TolerantWebAccessFS extends WebAccessFS {
252
285
  */
253
286
  async touch(path, metadata) {
254
287
  const pending = this._truncates.get(path);
255
- await super.touch(path, metadata);
288
+ // Skips WebAccessFS.touch, which cuts the OPFS file to any size it's given (a stale one too),
289
+ // for the Async mixin's index and in-memory update that it ends with.
290
+ await asyncTouch.call(this, path, metadata);
256
291
  const inode = this.index.get(path);
257
292
  if (!inode || (inode.mode & constants.S_IFMT) != constants.S_IFREG)
258
293
  return;
@@ -329,13 +364,15 @@ class TolerantWebAccessFS extends WebAccessFS {
329
364
  this._handles.set('/', this.root);
330
365
  await this._loadHandles('/', this.root);
331
366
  for (const [path, handle] of [...this._handles]) {
367
+ // Each inode gets its own numbers, as WebAccessFS._loadMetadata gives them.
368
+ const ino = this.index._alloc();
332
369
  if (handle.kind == 'directory') {
333
- this.index.set(path, new Inode({ mode: 0o777 | constants.S_IFDIR, size: 0 }));
370
+ this.index.set(path, new Inode({ mode: 0o777 | constants.S_IFDIR, size: 0, ino, data: ino + 1 }));
334
371
  continue;
335
372
  }
336
373
  try {
337
374
  const { lastModified, size } = await handle.getFile();
338
- this.index.set(path, new Inode({ mode: 0o644 | constants.S_IFREG, size, mtimeMs: lastModified }));
375
+ this.index.set(path, new Inode({ mode: 0o644 | constants.S_IFREG, size, mtimeMs: lastModified, ino, data: ino + 1 }));
339
376
  this._seen.set(path, { size, lastModified });
340
377
  }
341
378
  catch (error) {
@@ -432,6 +469,9 @@ class TolerantWebAccessFS extends WebAccessFS {
432
469
  for (const dir of missing) {
433
470
  try {
434
471
  const stats = await this.stat(dir);
472
+ // stat() caches a directory it indexes just now.
473
+ if (this._sync.existsSync(dir))
474
+ continue;
435
475
  this._sync.mkdirSync(dir, stats);
436
476
  this._sync.touchSync(dir, stats);
437
477
  }
@@ -543,4 +583,4 @@ const TolerantWebAccess = {
543
583
  };
544
584
 
545
585
  export { TolerantWebAccess, TolerantWebAccessFS };
546
- //# sourceMappingURL=tolerantWebAccess-BJqViq08.js.map
586
+ //# sourceMappingURL=tolerantWebAccess-zEseJ2zT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tolerantWebAccess-zEseJ2zT.js","sources":["../../src/browser/helpers/tolerantWebAccess.ts"],"sourcesContent":["import { constants, Inode, vfs } from '@zenfs/core'\nimport type { CreationOptions, InodeLike } from '@zenfs/core'\nimport { dirname, join } from '@zenfs/core/path'\nimport { WebAccess, WebAccessFS } from '@zenfs/dom'\nimport type { WebAccessOptions } from '@zenfs/dom'\nimport debug from 'debug'\nimport { isSkippableOpfsEntryError } from './opfsErrors'\n\nconst logger = debug('seedSdk:browser:helpers:tolerantWebAccess')\n\n/** The touch WebAccessFS inherits from ZenFS's Async mixin, under its own override. */\nconst asyncTouch: WebAccessFS['touch'] = Object.getPrototypeOf(WebAccessFS.prototype).touch\n\n/** A truncate made through this mount that OPFS doesn't have yet. Compared by identity. */\ntype PendingTruncate = { readonly length: number }\n\n/** An OPFS file as this mount last saw it. */\ntype OpfsVersion = { size: number; lastModified: number }\n\n/**\n * WebAccessFS mounts by walking all of OPFS and reading every file's size, and one unreadable\n * entry fails the whole mount. This variant skips such entries instead. A skipped file is still\n * listed by readdir, and WebAccessFS.stat() indexes it lazily on first use, once it is readable.\n *\n * It also makes overwrites with shorter content shrink the file (see `write` and `touch`), without\n * cutting off bytes another context (a tab, a worker writing through a SyncAccessHandle) added to a\n * file this mount had indexed at a smaller size: OPFS only shrinks for a truncate made through this\n * mount, and stat() re-reads a file's size when OPFS changed since this mount last looked.\n *\n * Overrides @zenfs/dom 1.2.14 / @zenfs/core 2.7.7 internals (`_loadHandles`, `_loadMetadata`,\n * `crossCopy`, `stat`, `write`, `touch`, `remove`, `get`, `_handles`, `_sync`, `_isInitialized`,\n * `index`, and `vfs.Handle#truncate`/`truncateSync`, see `trackTruncates`); both packages are pinned\n * to exact versions, and tolerantWebAccess.test.ts / opfsOverwrite.test.ts cover the coupling.\n */\nexport class TolerantWebAccessFS extends WebAccessFS {\n /**\n * Truncates made through this mount that OPFS doesn't have yet, by path. ZenFS truncates by\n * lowering the inode's size and syncing it later, so only these may shrink the OPFS file: an\n * inode that is merely smaller than the file is a stale view of a file someone else grew.\n */\n private readonly _truncates = new Map<string, PendingTruncate>()\n\n /** Each OPFS file as this mount last saw it, to notice writes made elsewhere. */\n private readonly _seen = new Map<string, OpfsVersion>()\n\n /**\n * Called with each file path whose OPFS contents this mount changed (a write, a truncate, a\n * removal; a rename is both), once the change is in OPFS. BrowserFileManager uses it to tell other\n * tabs. Not called for what invalidate(), stat() or crossCopy() put in the in-memory copy: those\n * only read OPFS.\n */\n onOpfsChange?: (path: string) => void\n\n constructor(root: FileSystemDirectoryHandle, disableHandleCache?: boolean) {\n super(root, disableHandleCache)\n // Reads would otherwise mark the file dirty (atime) and end in touch() for every read. Without\n // atime, touch() only follows writes, truncates, chmod and utimes.\n this.attributes.set('no_atime')\n }\n\n /**\n * Called by vfs.Handle#truncate(Sync) for files on this mount (see `trackTruncates`). Returns an\n * undo for a truncate the handle then rejects.\n */\n _noteTruncate(path: string, length: number): () => void {\n const previous = this._truncates.get(path)\n // Truncated twice before a write: the bytes past the shorter length are gone either way.\n this._truncates.set(path, { length: Math.min(length, previous?.length ?? length) })\n return () => {\n if (previous) this._truncates.set(path, previous)\n else this._truncates.delete(path)\n }\n }\n\n /**\n * The sync API's in-memory copy (a StoreFS) truncates by setting the size alone and keeps the old\n * bytes, which a later write past that size then exposes in place of zeros. Cut them off there\n * too. Called by vfs.Handle#truncate(Sync) once the truncate went through.\n */\n _truncateCache(path: string, length: number): void {\n try {\n const cached = this._sync.statSync(path)\n if ((cached.mode & constants.S_IFMT) != constants.S_IFREG) return\n // Even when the size already matches: a sync handle's truncate() has synced it by now.\n const data = new Uint8Array(length) // Past the old size (truncate to extend): zeros.\n const kept = Math.min(length, cached.size)\n if (kept) this._sync.readSync(path, data.subarray(0, kept), 0, kept)\n this._sync.unlinkSync(path)\n this._sync.createFileSync(path, cached as unknown as CreationOptions)\n if (length) this._sync.writeSync(path, data, 0)\n cached.size = length\n this._sync.touchSync(path, cached)\n } catch (error) {\n logger(`could not truncate the cached copy of ${path}: ${(error as Error).name}`)\n }\n }\n\n private _takeTruncate(path: string, pending: PendingTruncate | undefined): void {\n // A truncate recorded while this write or sync was under way is left for the next one.\n if (pending && this._truncates.get(path) === pending) this._truncates.delete(path)\n }\n\n private _changed(path: string): void {\n try {\n this.onOpfsChange?.(path)\n } catch (error) {\n logger(`change listener failed for ${path}`, error)\n }\n }\n\n private _remember(path: string, file: File): void {\n this._seen.set(path, { size: file.size, lastModified: file.lastModified })\n }\n\n /** Another context changed the file: the next stat() refreshes the sync API's in-memory copy. */\n private _markChangedElsewhere(path: string): void {\n this._seen.set(path, { size: -1, lastModified: -1 })\n }\n\n /**\n * The index holds each file's size from when this mount last looked, and another context may\n * have written the file since. Re-read it from OPFS, so opening a file (an append goes to its\n * size) and reading it see the true file, and refresh the in-memory copy behind the sync API when\n * the file changed. Costs one getFile() per stat of a regular file; contents are only read when\n * the file changed.\n */\n async stat(path: string): Promise<Inode> {\n const indexed = this.index.has(path)\n const inode = (await super.stat(path)) as Inode\n // While mounting, sizes were just read and crossCopy stats every file.\n if (!(this as unknown as AsyncState)._isInitialized) return inode\n if (!indexed) await this._cacheIndexed(path, inode)\n if ((inode.mode & constants.S_IFMT) != constants.S_IFREG) return inode\n // This mount truncated the file and OPFS doesn't have it yet: the inode's size is the truth.\n if (this._truncates.has(path)) return inode\n\n let file: File\n try {\n file = await ((await this.get('file', path)) as FileSystemFileHandle).getFile()\n } catch {\n return inode // Gone or busy: keep what the index knows.\n }\n const seen = this._seen.get(path)\n if (seen && seen.size == file.size && seen.lastModified == file.lastModified) return inode\n this._remember(path, file)\n // First look at a file this mount just indexed (WebAccessFS.stat, invalidate): nothing to fix.\n if (!seen && inode.size == file.size) return inode\n logger(`${path} changed outside this mount (${inode.size} -> ${file.size} bytes)`)\n inode.update({ size: file.size, mtimeMs: file.lastModified })\n this.index.set(path, inode)\n await this._recache(path, inode, file)\n return inode\n }\n\n /**\n * Adds an entry WebAccessFS.stat() just indexed from OPFS (made by another context after this\n * mount loaded: a tab, SQLocal's worker creating `db/`) to the in-memory copy behind the sync API.\n * ZenFS mirrors every write and create into that copy and fails the call when the entry or its\n * directory is missing there.\n */\n private async _cacheIndexed(path: string, inode: Inode): Promise<void> {\n try {\n this._sync.statSync(path)\n return\n } catch {\n // Not cached yet.\n }\n await this._cacheParents(path)\n try {\n if ((inode.mode & constants.S_IFMT) == constants.S_IFDIR) {\n this._sync.mkdirSync(path, inode as unknown as CreationOptions)\n this._sync.touchSync(path, inode)\n } else {\n await this.crossCopy(path)\n }\n } catch (error) {\n logger(`could not cache ${path}: ${(error as Error).name}`)\n }\n }\n\n /** Replaces the sync API's in-memory copy of `path` with `file`, if it holds one. */\n private async _recache(path: string, inode: Inode, file: File): Promise<void> {\n try {\n this._sync.statSync(path)\n } catch {\n return // Not cached: async reads go to OPFS, and invalidate() handles the rest.\n }\n try {\n const data = new Uint8Array(await file.arrayBuffer())\n try {\n this._sync.unlinkSync(path)\n } catch {\n // Already gone.\n }\n this._sync.createFileSync(path, inode as unknown as CreationOptions)\n this._sync.writeSync(path, data, 0)\n this._sync.touchSync(path, inode)\n } catch (error) {\n logger(`not caching ${path}: ${(error as Error).name}`)\n try {\n this._sync.unlinkSync(path)\n } catch {\n // Nothing was copied.\n }\n }\n }\n\n /**\n * WebAccessFS.write opens the file with `keepExistingData` and never truncates, so a whole-file\n * overwrite with shorter content (open 'w', then a write at 0) kept the old tail on disk. Here a\n * truncate this mount made since the file was last written (open 'w', ftruncate) is applied in\n * the same writable as the data: the file is cut to that length first (a write past it leaves\n * zeros in the gap, as POSIX does). Without one, the data goes over the file OPFS has, whatever\n * size this mount last saw: appends and writes at an offset never cut off bytes another context\n * wrote.\n */\n async write(path: string, buffer: Uint8Array, offset: number): Promise<void> {\n const pending = this._truncates.get(path)\n const inode = this.index.get(path)\n let handle: FileSystemFileHandle | undefined\n if (inode && (inode.mode & constants.S_IFMT) == constants.S_IFREG) {\n try {\n handle = (await this.get('file', path)) as FileSystemFileHandle\n } catch {\n // Not in OPFS yet: WebAccessFS.write creates it, and a new file has no old tail.\n }\n }\n if (!inode || !handle) {\n await super.write(path, buffer, offset)\n this._takeTruncate(path, pending)\n if (inode) this._seen.set(path, { size: inode.size, lastModified: inode.mtimeMs })\n // WebAccessFS.write also creates directories; only files are worth telling other tabs about.\n if (inode && (inode.mode & constants.S_IFMT) == constants.S_IFREG) this._changed(path)\n return\n }\n\n const data = copyIfShared(buffer)\n const end = offset + data.byteLength\n // Truncated to no more than this write covers: start from an empty file instead of a copy.\n const wholeFile = pending !== undefined && offset == 0 && pending.length <= data.byteLength\n const writable = await handle.createWritable({ keepExistingData: !wholeFile })\n try {\n if (pending && !wholeFile) await writable.truncate(pending.length)\n await writable.write({ type: 'write', position: offset, data })\n await writable.close()\n } catch (error) {\n await writable.abort().catch(() => {})\n throw error\n }\n this._takeTruncate(path, pending)\n\n const file = await handle.getFile()\n const seen = this._seen.get(path)\n inode.update({ size: file.size, mtimeMs: file.lastModified })\n this.index.set(path, inode)\n this._remember(path, file)\n // Larger than this mount's writes explain: another context grew it. The sync API's copy is\n // refreshed by the next stat(), not here, where queued sync writes may not have landed yet.\n const expected = pending ? Math.max(pending.length, end) : Math.max(seen?.size ?? 0, end)\n if (seen && seen.size >= 0 && file.size != expected) this._markChangedElsewhere(path)\n this._changed(path)\n }\n\n /**\n * ZenFS truncates by setting the inode's size and syncing it with touch() (FileHandle.truncate\n * with no write after it). Make OPFS follow when this mount truncated the file. Any other touch\n * (chmod, utimes, the size after writes) leaves the OPFS file alone: a smaller size there is a\n * stale view, and the index takes the file's real size back.\n */\n async touch(path: string, metadata: InodeLike): Promise<void> {\n const pending = this._truncates.get(path)\n // Skips WebAccessFS.touch, which cuts the OPFS file to any size it's given (a stale one too),\n // for the Async mixin's index and in-memory update that it ends with.\n await asyncTouch.call(this, path, metadata)\n const inode = this.index.get(path)\n if (!inode || (inode.mode & constants.S_IFMT) != constants.S_IFREG) return\n let handle: FileSystemFileHandle\n try {\n handle = (await this.get('file', path)) as FileSystemFileHandle\n } catch {\n return // Not in OPFS (yet): nothing to shrink, and a queued write creates it.\n }\n\n if (pending) {\n const size = typeof metadata.size == 'number' ? metadata.size : pending.length\n const writable = await handle.createWritable({ keepExistingData: true })\n try {\n await writable.truncate(Math.min(pending.length, size))\n // Truncated, then extended: the new bytes are zeros.\n if (size > pending.length) await writable.truncate(size)\n await writable.close()\n } catch (error) {\n await writable.abort().catch(() => {})\n throw error\n }\n this._takeTruncate(path, pending)\n const file = await handle.getFile()\n inode.update({ size: file.size, mtimeMs: file.lastModified })\n this._remember(path, file)\n this._changed(path)\n return\n }\n\n const file = await handle.getFile()\n if (inode.size == file.size) return\n const seen = this._seen.get(path)\n inode.update({ size: file.size })\n if (!seen || seen.size != file.size || seen.lastModified != file.lastModified) {\n this._markChangedElsewhere(path)\n }\n }\n\n async remove(path: string): Promise<void> {\n for (const map of [this._truncates, this._seen]) {\n for (const p of [...map.keys()]) if (p == path || p.startsWith(path + '/')) map.delete(p)\n }\n await super.remove(path)\n this._changed(path)\n }\n\n async _loadHandles(path: string, handle: FileSystemDirectoryHandle): Promise<void> {\n try {\n for await (const [key, child] of (handle as any).entries() as AsyncIterable<[string, FileSystemHandle]>) {\n const p = join(path, key)\n this._handles.set(p, child)\n if (child.kind == 'directory') await this._loadHandles(p, child as FileSystemDirectoryHandle)\n }\n } catch (error) {\n // An unreadable root means nothing was walked; let initializeFileSystem retry the mount.\n if (!isSkippableOpfsEntryError(error) || path == '/') throw error\n // The directory went away (or became unreadable) mid-walk: forget it and anything under it.\n logger(`skipping directory ${path}: ${(error as DOMException).name}`)\n for (const p of [...this._handles.keys()]) {\n if (p == path || p.startsWith(path + '/')) this._handles.delete(p)\n }\n }\n }\n\n async _loadMetadata(metadataPath?: string): Promise<void> {\n if (metadataPath) return super._loadMetadata(metadataPath)\n\n this._handles.set('/', this.root)\n await this._loadHandles('/', this.root)\n\n for (const [path, handle] of [...this._handles]) {\n // Each inode gets its own numbers, as WebAccessFS._loadMetadata gives them.\n const ino = this.index._alloc()\n if (handle.kind == 'directory') {\n this.index.set(path, new Inode({ mode: 0o777 | constants.S_IFDIR, size: 0, ino, data: ino + 1 }))\n continue\n }\n try {\n const { lastModified, size } = await (handle as FileSystemFileHandle).getFile()\n this.index.set(path, new Inode({ mode: 0o644 | constants.S_IFREG, size, mtimeMs: lastModified, ino, data: ino + 1 }))\n this._seen.set(path, { size, lastModified })\n } catch (error) {\n if (!isSkippableOpfsEntryError(error)) throw error\n logger(`skipping file ${path}: ${(error as DOMException).name}`)\n // A removed file's handle would keep resolving to nothing; a locked one is still valid.\n if ((error as DOMException).name == 'NotFoundError') this._handles.delete(path)\n }\n }\n }\n\n /**\n * Forgets what the mount cached for `path` (size, handle, contents) and reads it again from OPFS.\n * For files written outside this ZenFS instance: by another tab, or by a worker writing to OPFS\n * directly. Only reads OPFS (never writes it, so never calls onOpfsChange).\n *\n * An entry that's gone (removed elsewhere) is forgotten along with anything cached under it, and\n * costs one failed lookup. A file in directories this mount hasn't cached yet (created elsewhere\n * after it mounted) gets them added to the in-memory copy, so the sync API finds it.\n */\n async invalidate(path: string): Promise<void> {\n if (path == '/') return\n this.index.delete(path)\n this._handles.delete(path)\n this._seen.delete(path)\n this._truncates.delete(path)\n let inode: Inode\n try {\n inode = await this.stat(path) // Re-indexes from OPFS (WebAccessFS.stat).\n } catch {\n this._forgetCached(path) // Gone (or unreadable for now: the next stat() looks again).\n return\n }\n try {\n this._sync.unlinkSync(path)\n } catch {\n // Not cached, or a directory: crossCopy refreshes what's under it.\n }\n if ((inode.mode & constants.S_IFMT) == constants.S_IFREG) await this._cacheParents(path)\n await this.crossCopy(path)\n }\n\n /** Drops `path` and everything under it from the index, handles and in-memory copy. */\n private _forgetCached(path: string): void {\n for (const map of [this._handles, this._seen, this._truncates] as Map<string, unknown>[]) {\n for (const p of [...map.keys()]) if (p == path || p.startsWith(path + '/')) map.delete(p)\n }\n for (const [p] of [...this.index.entries()]) {\n if (p == path || p.startsWith(path + '/')) this.index.delete(p)\n }\n const drop = (p: string): void => {\n let stats: { mode: number }\n try {\n stats = this._sync.statSync(p)\n } catch {\n return // Not cached.\n }\n try {\n if ((stats.mode & constants.S_IFMT) == constants.S_IFDIR) {\n for (const name of this._sync.readdirSync(p)) drop(join(p, name))\n this._sync.rmdirSync(p)\n } else {\n this._sync.unlinkSync(p)\n }\n } catch (error) {\n logger(`could not drop the cached copy of ${p}: ${(error as Error).name}`)\n }\n }\n drop(path)\n }\n\n /** Adds the directories above `path` that the in-memory copy lacks, so crossCopy can fill it. */\n private async _cacheParents(path: string): Promise<void> {\n const missing: string[] = []\n for (let dir = dirname(path); dir != '/'; dir = dirname(dir)) {\n try {\n this._sync.statSync(dir)\n break\n } catch {\n missing.unshift(dir)\n }\n }\n for (const dir of missing) {\n try {\n const stats = await this.stat(dir)\n // stat() caches a directory it indexes just now.\n if (this._sync.existsSync(dir)) continue\n this._sync.mkdirSync(dir, stats as unknown as CreationOptions)\n this._sync.touchSync(dir, stats)\n } catch (error) {\n logger(`could not cache directory ${dir}: ${(error as Error).name}`)\n return // crossCopy then skips the file (async reads still find it).\n }\n }\n }\n\n /**\n * The Async mixin's ready() then copies every file's contents into an in-memory cache, a second\n * walk that reads the same busy entries. Skip those too; the root still fails the mount.\n */\n async crossCopy(path: string): Promise<void> {\n const crossCopy = (WebAccessFS.prototype as unknown as AsyncCrossCopy).crossCopy\n if (path == '/') return crossCopy.call(this, path)\n try {\n await crossCopy.call(this, path)\n } catch (error) {\n if (!isSkippableOpfsEntryError(error) && !isErrnoChangedEntry(error)) throw error\n logger(`not caching ${path}: ${(error as Error).name}`)\n // Drop a half-copied entry so the cache doesn't serve an empty file in its place.\n try {\n this._sync.unlinkSync(path)\n } catch {\n try {\n this._sync.rmdirSync(path)\n } catch {\n // Nothing was copied.\n }\n }\n }\n }\n}\n\n/** OPFS writes take a plain ArrayBuffer view (WebAccessFS.write copies the same way). */\nfunction copyIfShared(buffer: Uint8Array): Uint8Array<ArrayBuffer> {\n const backing = buffer.buffer as ArrayBufferLike & { resizable?: boolean; growable?: boolean }\n if (backing instanceof ArrayBuffer && !backing.resizable) return buffer as Uint8Array<ArrayBuffer>\n return new Uint8Array(buffer)\n}\n\ntype AsyncCrossCopy = { crossCopy(this: TolerantWebAccessFS, path: string): Promise<void> }\n\n/** Set by the Async mixin once ready() has copied OPFS into the in-memory cache. */\ntype AsyncState = { _isInitialized: boolean }\n\nconst TRACKED = Symbol.for('seedSdk.tolerantWebAccess.trackTruncates')\n\n/**\n * ZenFS file handles truncate by lowering their inode's size, and only tell the file system the new\n * size later (touch), the same way they report a size that's merely stale. So handles on a\n * TolerantWebAccessFS report each truncate when it's made (open with 'w', ftruncate, truncate).\n * Patches the shared vfs.Handle prototype once; handles on other file systems are unaffected.\n */\nfunction trackTruncates(): void {\n const proto = vfs.Handle.prototype as typeof vfs.Handle.prototype & { [TRACKED]?: true }\n if (proto[TRACKED]) return\n proto[TRACKED] = true\n const fsOf = (handle: vfs.Handle) => (handle.fs instanceof TolerantWebAccessFS ? handle.fs : undefined)\n\n const truncate = proto.truncate\n proto.truncate = async function (this: vfs.Handle, length: number) {\n const fs = fsOf(this)\n // Noted first: on a sync handle, truncate() syncs (touch) before it returns.\n const undo = fs?._noteTruncate(this.internalPath, length)\n try {\n await truncate.call(this, length)\n } catch (error) {\n undo?.()\n throw error\n }\n fs?._truncateCache(this.internalPath, length)\n }\n const truncateSync = proto.truncateSync\n proto.truncateSync = function (this: vfs.Handle, length: number) {\n const fs = fsOf(this)\n const undo = fs?._noteTruncate(this.internalPath, length)\n try {\n truncateSync.call(this, length)\n } catch (error) {\n undo?.()\n throw error\n }\n fs?._truncateCache(this.internalPath, length)\n }\n}\ntrackTruncates()\n\n/**\n * ZenFS converts most DOMExceptions to errno errors: an entry removed mid-walk becomes ENOENT, and\n * a file whose size changed since _loadMetadata (SQLite writing in another tab) fails read() with\n * an EIO size mismatch.\n */\nfunction isErrnoChangedEntry(error: unknown): boolean {\n const { code, message } = (error ?? {}) as { code?: unknown; message?: unknown }\n if (code === 'ENOENT') return true\n return code === 'EIO' && typeof message === 'string' && message.includes('mismatch in file data size')\n}\n\n/** Drop-in for `WebAccess` in `configureSingle({ backend, handle })`. */\nexport const TolerantWebAccess = {\n ...WebAccess,\n name: 'TolerantWebAccess',\n async create(options: WebAccessOptions): Promise<WebAccessFS> {\n const fs = new TolerantWebAccessFS(options.handle, options.disableHandleCache)\n await fs._loadMetadata(options.metadata)\n return fs\n },\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,MAAM,GAAG,KAAK,CAAC,2CAA2C,CAAC;AAEjE;AACA,MAAM,UAAU,GAAyB,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,KAAK;AAQ3F;;;;;;;;;;;;;;AAcG;AACG,MAAO,mBAAoB,SAAQ,WAAW,CAAA;IAmBlD,WAAA,CAAY,IAA+B,EAAE,kBAA4B,EAAA;AACvE,QAAA,KAAK,CAAC,IAAI,EAAE,kBAAkB,CAAC;AAnBjC;;;;AAIG;AACc,QAAA,IAAA,CAAA,UAAU,GAAG,IAAI,GAAG,EAA2B;;AAG/C,QAAA,IAAA,CAAA,KAAK,GAAG,IAAI,GAAG,EAAuB;;;A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mB,CAAC,KAAc,EAAA;IACzC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,KAAK,IAAI,EAAE,CAA0C;IAChF,IAAI,IAAI,KAAK,QAAQ;AAAE,QAAA,OAAO,IAAI;AAClC,IAAA,OAAO,IAAI,KAAK,KAAK,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAC;AACxG;AAEA;AACO,MAAM,iBAAiB,GAAG;AAC/B,IAAA,GAAG,SAAS;AACZ,IAAA,IAAI,EAAE,mBAAmB;IACzB,MAAM,MAAM,CAAC,OAAyB,EAAA;AACpC,QAAA,MAAM,EAAE,GAAG,IAAI,mBAAmB,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC;QAC9E,MAAM,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC;AACxC,QAAA,OAAO,EAAE;IACX,CAAC;;;"}
@@ -1,6 +1,6 @@
1
1
  import debug from 'debug';
2
- import { A as AmbiguousModelError, h as eventEmitter, w as writeInBatches } from './tabEvents-CaVmngqr.js';
3
- import { B as BaseDb, s as seeds, m as metadata, v as versions } from './BaseFileManager-BAlySv8w.js';
2
+ import { A as AmbiguousModelError, h as eventEmitter, w as writeInBatches } from './tabEvents-DT5ez6io.js';
3
+ import { B as BaseDb, s as seeds, m as metadata, v as versions } from './BaseFileManager-DLou1TZS.js';
4
4
  import { eq, and, or, inArray, isNull } from 'drizzle-orm';
5
5
 
6
6
  const logger = debug('seedSdk:db:read:resolveModelForSyncedSeed');
@@ -70,4 +70,4 @@ const updateSeedRevokedAt = async ({ seedLocalId, revokedAt, metadataUids, versi
70
70
  };
71
71
 
72
72
  export { MODEL_AMBIGUOUS_EVENT as M, resolveModelForSyncedSeed as r, skipSeedOnAmbiguousModel as s, updateSeedRevokedAt as u };
73
- //# sourceMappingURL=updateSeedRevokedAt-BL9Bg-G7.js.map
73
+ //# sourceMappingURL=updateSeedRevokedAt-B9JRwr5T.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateSeedRevokedAt-BL9Bg-G7.js","sources":["../../src/db/read/resolveModelForSyncedSeed.ts","../../src/db/write/updateSeedRevokedAt.ts"],"sourcesContent":["import debug from 'debug'\nimport { eventEmitter } from '@/eventBus'\nimport { AmbiguousModelError } from '@/Model/errors'\n\nconst logger = debug('seedSdk:db:read:resolveModelForSyncedSeed')\n\n/** Emitted when background work skips a seed whose model name exists in several schemas. */\nexport const MODEL_AMBIGUOUS_EVENT = 'model:ambiguous' as const\n\nexport type ModelAmbiguousEventPayload = {\n modelName: string\n schemaNames: string[]\n seedLocalId?: string\n seedUid?: string\n /** What was being done when the seed was skipped (e.g. 'easSync.metadata'). */\n context: string\n}\n\nexport type SyncedSeedInfo = {\n seedUid?: string | null\n seedLocalId?: string | null\n /** seeds.type as synced from EAS (the EAS schema name, i.e. snake_case model name). */\n modelType?: string | null\n /** EAS schema UID of the seed attestation. */\n schemaUid?: string | null\n}\n\n/**\n * Seam for matching an EAS-synced seed to a local model (its schemaFileId).\n *\n * EAS identifies a seed's model only by name (`bytes32 <model_name>`), so when several local schemas\n * define a model with that name the seed alone can't say which one it is. The original plan was to\n * match by the seed's properties and metadata; docs/adr/0006-schema-scoped-seeds.md replaced it.\n *\n * TODO(eas-synced-seed-model-resolution): not implemented yet. Returns undefined, so callers fall\n * back to the name, which throws AmbiguousModelError when the name is ambiguous.\n */\nexport const resolveModelForSyncedSeed = async (_seed: SyncedSeedInfo): Promise<string | undefined> => {\n return undefined\n}\n\n/**\n * Run background work for one seed; if it hits an ambiguous model name, log, emit\n * MODEL_AMBIGUOUS_EVENT and return undefined (skip) instead of failing the whole job. Loading the\n * item directly still throws, so the problem surfaces where the app touches it.\n */\nexport const skipSeedOnAmbiguousModel = async <T>(\n seed: { seedLocalId?: string | null; seedUid?: string | null },\n context: string,\n work: () => Promise<T>,\n): Promise<T | undefined> => {\n try {\n return await work()\n } catch (error) {\n if (!(error instanceof AmbiguousModelError)) throw error\n logger(`Skipping seed ${seed.seedLocalId ?? seed.seedUid} in ${context}: ${error.message}`)\n const payload: ModelAmbiguousEventPayload = {\n modelName: error.modelName,\n schemaNames: error.schemaNames,\n seedLocalId: seed.seedLocalId ?? undefined,\n seedUid: seed.seedUid ?? undefined,\n context,\n }\n eventEmitter.emit(MODEL_AMBIGUOUS_EVENT, payload)\n return undefined\n }\n}\n","import { BaseDb } from '@/db/Db/BaseDb'\nimport { metadata, seeds, versions } from '@/seedSchema'\nimport { and, eq, inArray, isNull, or } from 'drizzle-orm'\nimport { writeInBatches } from '@/db/sqlParamBatches'\n\ntype UpdateSeedRevokedAtProps = {\n seedLocalId: string\n /** Unix seconds. */\n revokedAt: number\n /**\n * Property attestation UIDs revoked along with the seed. Their metadata rows get the same\n * `revoked_at` (unless they already have one), so they read as revoked before the next sync.\n * Rows sync derived from them (ItemStorage rows whose `derived_from_uid` is one of these) are\n * stamped the same way.\n */\n metadataUids?: string[]\n /** Version attestation UIDs revoked along with the seed; their rows are stamped the same way. */\n versionUids?: string[]\n}\n\n/**\n * Sets revokedAt timestamp on a seed record after attestations have been revoked on EAS.\n */\nexport const updateSeedRevokedAt = async ({\n seedLocalId,\n revokedAt,\n metadataUids,\n versionUids,\n}: UpdateSeedRevokedAtProps): Promise<void> => {\n if (!seedLocalId) {\n return\n }\n\n const appDb = BaseDb.getAppDb()\n\n await appDb\n .update(seeds)\n .set({\n revokedAt,\n })\n .where(eq(seeds.localId, seedLocalId))\n\n // An item can have many property attestations; each list binds once per uid (twice for metadata).\n await writeInBatches(metadataUids ?? [], (chunk) =>\n appDb\n .update(metadata)\n .set({ revokedAt })\n .where(\n and(\n or(inArray(metadata.uid, chunk), inArray(metadata.derivedFromUid, chunk)),\n isNull(metadata.revokedAt),\n ),\n ),\n )\n\n await writeInBatches(versionUids ?? [], (chunk) =>\n appDb\n .update(versions)\n .set({ revokedAt })\n .where(and(inArray(versions.uid, chunk), isNull(versions.revokedAt))),\n )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,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;;IAGxC,MAAM,cAAc,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC,KAAK,KAC7C;SACG,MAAM,CAAC,QAAQ;AACf,SAAA,GAAG,CAAC,EAAE,SAAS,EAAE;AACjB,SAAA,KAAK,CACJ,GAAG,CACD,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC,EACzE,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAC3B,CACF,CACJ;IAED,MAAM,cAAc,CAAC,WAAW,IAAI,EAAE,EAAE,CAAC,KAAK,KAC5C;SACG,MAAM,CAAC,QAAQ;AACf,SAAA,GAAG,CAAC,EAAE,SAAS,EAAE;SACjB,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CACxE;AACH;;"}
1
+ {"version":3,"file":"updateSeedRevokedAt-B9JRwr5T.js","sources":["../../src/db/read/resolveModelForSyncedSeed.ts","../../src/db/write/updateSeedRevokedAt.ts"],"sourcesContent":["import debug from 'debug'\nimport { eventEmitter } from '@/eventBus'\nimport { AmbiguousModelError } from '@/Model/errors'\n\nconst logger = debug('seedSdk:db:read:resolveModelForSyncedSeed')\n\n/** Emitted when background work skips a seed whose model name exists in several schemas. */\nexport const MODEL_AMBIGUOUS_EVENT = 'model:ambiguous' as const\n\nexport type ModelAmbiguousEventPayload = {\n modelName: string\n schemaNames: string[]\n seedLocalId?: string\n seedUid?: string\n /** What was being done when the seed was skipped (e.g. 'easSync.metadata'). */\n context: string\n}\n\nexport type SyncedSeedInfo = {\n seedUid?: string | null\n seedLocalId?: string | null\n /** seeds.type as synced from EAS (the EAS schema name, i.e. snake_case model name). */\n modelType?: string | null\n /** EAS schema UID of the seed attestation. */\n schemaUid?: string | null\n}\n\n/**\n * Seam for matching an EAS-synced seed to a local model (its schemaFileId).\n *\n * EAS identifies a seed's model only by name (`bytes32 <model_name>`), so when several local schemas\n * define a model with that name the seed alone can't say which one it is. The original plan was to\n * match by the seed's properties and metadata; docs/adr/0006-schema-scoped-seeds.md replaced it.\n *\n * TODO(eas-synced-seed-model-resolution): not implemented yet. Returns undefined, so callers fall\n * back to the name, which throws AmbiguousModelError when the name is ambiguous.\n */\nexport const resolveModelForSyncedSeed = async (_seed: SyncedSeedInfo): Promise<string | undefined> => {\n return undefined\n}\n\n/**\n * Run background work for one seed; if it hits an ambiguous model name, log, emit\n * MODEL_AMBIGUOUS_EVENT and return undefined (skip) instead of failing the whole job. Loading the\n * item directly still throws, so the problem surfaces where the app touches it.\n */\nexport const skipSeedOnAmbiguousModel = async <T>(\n seed: { seedLocalId?: string | null; seedUid?: string | null },\n context: string,\n work: () => Promise<T>,\n): Promise<T | undefined> => {\n try {\n return await work()\n } catch (error) {\n if (!(error instanceof AmbiguousModelError)) throw error\n logger(`Skipping seed ${seed.seedLocalId ?? seed.seedUid} in ${context}: ${error.message}`)\n const payload: ModelAmbiguousEventPayload = {\n modelName: error.modelName,\n schemaNames: error.schemaNames,\n seedLocalId: seed.seedLocalId ?? undefined,\n seedUid: seed.seedUid ?? undefined,\n context,\n }\n eventEmitter.emit(MODEL_AMBIGUOUS_EVENT, payload)\n return undefined\n }\n}\n","import { BaseDb } from '@/db/Db/BaseDb'\nimport { metadata, seeds, versions } from '@/seedSchema'\nimport { and, eq, inArray, isNull, or } from 'drizzle-orm'\nimport { writeInBatches } from '@/db/sqlParamBatches'\n\ntype UpdateSeedRevokedAtProps = {\n seedLocalId: string\n /** Unix seconds. */\n revokedAt: number\n /**\n * Property attestation UIDs revoked along with the seed. Their metadata rows get the same\n * `revoked_at` (unless they already have one), so they read as revoked before the next sync.\n * Rows sync derived from them (ItemStorage rows whose `derived_from_uid` is one of these) are\n * stamped the same way.\n */\n metadataUids?: string[]\n /** Version attestation UIDs revoked along with the seed; their rows are stamped the same way. */\n versionUids?: string[]\n}\n\n/**\n * Sets revokedAt timestamp on a seed record after attestations have been revoked on EAS.\n */\nexport const updateSeedRevokedAt = async ({\n seedLocalId,\n revokedAt,\n metadataUids,\n versionUids,\n}: UpdateSeedRevokedAtProps): Promise<void> => {\n if (!seedLocalId) {\n return\n }\n\n const appDb = BaseDb.getAppDb()\n\n await appDb\n .update(seeds)\n .set({\n revokedAt,\n })\n .where(eq(seeds.localId, seedLocalId))\n\n // An item can have many property attestations; each list binds once per uid (twice for metadata).\n await writeInBatches(metadataUids ?? [], (chunk) =>\n appDb\n .update(metadata)\n .set({ revokedAt })\n .where(\n and(\n or(inArray(metadata.uid, chunk), inArray(metadata.derivedFromUid, chunk)),\n isNull(metadata.revokedAt),\n ),\n ),\n )\n\n await writeInBatches(versionUids ?? [], (chunk) =>\n appDb\n .update(versions)\n .set({ revokedAt })\n .where(and(inArray(versions.uid, chunk), isNull(versions.revokedAt))),\n )\n}\n"],"names":[],"mappings":";;;;;AAIA,MAAM,MAAM,GAAG,KAAK,CAAC,2CAA2C,CAAC;AAEjE;AACO,MAAM,qBAAqB,GAAG;AAoBrC;;;;;;;;;AASG;MACU,yBAAyB,GAAG,OAAO,KAAqB,KAAiC;AACpG,IAAA,OAAO,SAAS;AAClB;AAEA;;;;AAIG;AACI,MAAM,wBAAwB,GAAG,OACtC,IAA8D,EAC9D,OAAe,EACf,IAAsB,KACI;AAC1B,IAAA,IAAI;QACF,OAAO,MAAM,IAAI,EAAE;IACrB;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,IAAI,EAAE,KAAK,YAAY,mBAAmB,CAAC;AAAE,YAAA,MAAM,KAAK;AACxD,QAAA,MAAM,CAAC,CAAA,cAAA,EAAiB,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,OAAO,CAAA,IAAA,EAAO,OAAO,CAAA,EAAA,EAAK,KAAK,CAAC,OAA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,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CACxE;AACH;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seedprotocol/sdk",
3
- "version": "0.7.9",
3
+ "version": "0.7.10-next.1353.g74aeeed",
4
4
  "description": "Official TypeScript SDK for Seed Protocol — local-first ORM with SQLite/OPFS, syncing via Ethereum Attestation Service (EAS) and Arweave.",
5
5
  "keywords": [
6
6
  "seed-protocol",
@@ -53,7 +53,7 @@
53
53
  "url": "https://github.com/JournoLabs/seed-protocol-sdk/issues"
54
54
  },
55
55
  "peerDependencies": {
56
- "@seedprotocol/vite": "0.7.9"
56
+ "@seedprotocol/vite": "0.7.10-next.1353.g74aeeed"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "@seedprotocol/vite": {
@@ -64,13 +64,14 @@
64
64
  "@ethereum-attestation-service/eas-sdk": "^2.9.0",
65
65
  "@libsql/client": "^0.15.15",
66
66
  "@noble/hashes": "^1.8.0",
67
- "@seedprotocol/arweave": "0.7.9",
68
- "@seedprotocol/eas": "0.7.9",
69
- "@seedprotocol/query": "0.7.9",
67
+ "@seedprotocol/archive": "0.7.10-next.1353.g74aeeed",
68
+ "@seedprotocol/arweave": "0.7.10-next.1353.g74aeeed",
69
+ "@seedprotocol/eas": "0.7.10-next.1353.g74aeeed",
70
+ "@seedprotocol/query": "0.7.10-next.1353.g74aeeed",
70
71
  "@sinclair/typebox": "^0.34.45",
71
72
  "@tanstack/query-core": "^5.104.1",
72
- "@zenfs/core": "2.5.6",
73
- "@zenfs/dom": "1.2.9",
73
+ "@zenfs/core": "2.7.7",
74
+ "@zenfs/dom": "1.2.14",
74
75
  "arweave": "^1.15.5",
75
76
  "debug": "^4.4.1",
76
77
  "drizzle-orm": "^0.44.3",
@@ -156,19 +157,16 @@
156
157
  "@rollup/plugin-commonjs": "^29.0.0",
157
158
  "@rollup/plugin-json": "^6.1.0",
158
159
  "@rollup/plugin-typescript": "^12.1.2",
159
- "@seedprotocol/vite": "0.7.9",
160
+ "@seedprotocol/vite": "0.7.10-next.1353.g74aeeed",
160
161
  "better-sqlite3": "^12.5.0",
161
162
  "eventemitter3": "^5.0.1",
162
- "kerium": "1.3.4",
163
163
  "magic-string": "^0.30.21",
164
- "memium": "0.3.10",
165
164
  "path-browserify": "^1.0.1",
166
165
  "readable-stream": "4.5.2",
167
166
  "rollup": "^4.53.0",
168
167
  "rollup-plugin-copy": "^3.5.0",
169
168
  "rollup-plugin-tsconfig-paths": "^1.5.2",
170
- "typescript": "~5.9.3",
171
- "utilium": "2.5.0"
169
+ "typescript": "~5.9.3"
172
170
  },
173
171
  "_bundleHint": {
174
172
  "note": "If bundling this package, mark the following as external: fsevents, better-sqlite3, and other native Node.js modules."
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseFileManager-BAlySv8w.js","sources":["../../src/browser/db/sqliteBusyRetry.ts","../../src/db/Db/BaseDb.ts","../../src/seedSchema/ModelSchema.ts","../../src/seedSchema/attestedUid.ts","../../src/seedSchema/SeedSchema.ts","../../src/seedSchema/VersionSchema.ts","../../src/seedSchema/MetadataSchema.ts","../../src/seedSchema/AppStateSchema.ts","../../src/seedSchema/ModelUidSchema.ts","../../src/seedSchema/PropertyUidSchema.ts","../../src/seedSchema/ConfigSchema.ts","../../src/seedSchema/SchemaSchema.ts","../../src/seedSchema/ModelSchemaSchema.ts","../../src/seedSchema/PublishProcessSchema.ts","../../src/seedSchema/UploadProcessSchema.ts","../../src/seedSchema/ArweaveL1FinalizeSchema.ts","../../src/seedSchema/EasSyncProcessSchema.ts","../../src/seedSchema/HtmlEmbeddedImageCoPublishSchema.ts","../../src/seedSchema/PendingWriteSchema.ts","../../src/seedSchema/EntityChangeSchema.ts","../../src/helpers/FileManager/BaseFileManager.ts"],"sourcesContent":["import debug from 'debug'\n\nconst logger = debug('seedSdk:browser:db:sqliteBusyRetry')\n\n/** Waits between attempts; about 1 s in total. */\nexport const SQLITE_BUSY_RETRY_DELAYS_MS = [25, 75, 150, 300, 450]\n\n/**\n * Another connection (usually another tab) holds the database lock. SQLite reports this as\n * SQLITE_BUSY (\"database is locked\") or SQLITE_LOCKED (\"database table is locked\").\n */\nexport function isSqliteBusyError(error: unknown): boolean {\n // Drizzle wraps a driver's error (\"Failed query: ...\") and keeps it as `cause`\n for (let current: unknown = error, depth = 0; current != null && depth < 5; depth++) {\n const message = current instanceof Error ? current.message : String(current)\n if (/SQLITE_BUSY|SQLITE_LOCKED|database (table )?is locked/i.test(message)) return true\n current = (current as { cause?: unknown }).cause\n }\n return false\n}\n\n/**\n * Retries a statement another tab's lock rejected. Safe for the SDK's writes because each is a\n * single autocommit statement: one that failed with SQLITE_BUSY didn't apply. Don't use this for\n * statements inside a transaction, where a retry would replay part of it.\n */\nexport function withSqliteBusyRetry<Args extends unknown[], R>(\n driver: (...args: Args) => Promise<R>,\n delaysMs: number[] = SQLITE_BUSY_RETRY_DELAYS_MS,\n): (...args: Args) => Promise<R> {\n return async (...args: Args) => {\n for (let attempt = 0; ; attempt++) {\n try {\n return await driver(...args)\n } catch (error) {\n if (!isSqliteBusyError(error) || attempt >= delaysMs.length) throw error\n logger(`database busy (attempt ${attempt + 1}); retrying`)\n await new Promise((resolve) => setTimeout(resolve, delaysMs[attempt]))\n }\n }\n }\n}\n","import type { IDb } from '@/interfaces/IDb'\nimport { Observable } from 'rxjs'\nimport { isSqliteBusyError, SQLITE_BUSY_RETRY_DELAYS_MS } from '@/browser/db/sqliteBusyRetry'\n\nexport abstract class BaseDb {\n static filesDir: string | undefined\n private static _impl: IDb | null = null\n\n static configure(impl: IDb): void {\n if (!impl) {\n throw new Error(\n 'Cannot configure Db with undefined or null. Ensure the platform-specific Db is properly created.',\n )\n }\n BaseDb._impl = impl\n }\n\n private static requireImpl(): IDb {\n if (!BaseDb._impl) {\n throw new Error(\n 'Db not configured. Call BaseDb.configure() during platform init.',\n )\n }\n return BaseDb._impl\n }\n\n static getAppDb(): any {\n return BaseDb.requireImpl().getAppDb()\n }\n\n static prepareDb(filesDir: string, config?: any): Promise<any> {\n return BaseDb.requireImpl().prepareDb(filesDir, config)\n }\n\n static isAppDbReady(): boolean {\n if (!BaseDb._impl) {\n return false\n }\n return BaseDb._impl.isAppDbReady()\n }\n\n static connectToDb(pathToDir: string): Promise<unknown> {\n return BaseDb.requireImpl().connectToDb(pathToDir)\n }\n\n static async migrate(pathToDbDir: string, dbName: string, dbId: string): Promise<void> {\n return BaseDb.requireImpl().migrate(pathToDbDir, dbName, dbId)\n }\n\n /**\n * Execute a reactive query that emits new results whenever the underlying data changes.\n *\n * Supports two usage patterns:\n * 1. SQL tag function (browser only): liveQuery((sql) => sql`SELECT * FROM models`)\n * 2. Drizzle query builder: liveQuery(db.select().from(models))\n *\n * On Node only the query builder works (a tag function throws), and it is re-run every second;\n * the observable emits when the result changes.\n */\n static liveQuery<T>(query: ((sql: any) => any) | any): Observable<T[]> {\n return BaseDb.requireImpl().liveQuery<T>(query)\n }\n\n /**\n * Runs `fn` in one transaction: every query it runs on `tx` (a Drizzle database, used like\n * `getAppDb()`) commits together, or none does when `fn` throws. Queries on `getAppDb()` inside\n * `fn` are not part of the transaction, and in the browser they wait for it to end, so don't\n * call `getAppDb()` or `BaseDb.transaction` from `fn`.\n *\n * When another connection (another tab) holds the database lock, the whole transaction is\n * retried, so `fn` must have no side effects outside `tx`.\n */\n static async transaction<T>(fn: (tx: any) => Promise<T>): Promise<T> {\n const impl = BaseDb.requireImpl()\n for (let attempt = 0; ; attempt++) {\n try {\n return await impl.transaction(fn)\n } catch (error) {\n if (!isSqliteBusyError(error) || attempt >= SQLITE_BUSY_RETRY_DELAYS_MS.length) throw error\n await new Promise((resolve) => setTimeout(resolve, SQLITE_BUSY_RETRY_DELAYS_MS[attempt]))\n }\n }\n }\n}\n","import { integer, sqliteTable, text, unique } from 'drizzle-orm/sqlite-core'\nimport { relations } from 'drizzle-orm'\nimport { InferInsertModel, InferSelectModel } from 'drizzle-orm'\n\n\nexport const models = sqliteTable(\n 'models',\n {\n id: integer('id').primaryKey({ autoIncrement: true }),\n name: text('name').notNull(),\n schemaFileId: text('schema_file_id'), // ID from JSON file for change tracking - must be unique\n isEdited: integer('is_edited', { mode: 'boolean' }), // true if model has been edited locally, false if matches schema file\n },\n (table) => {\n return {\n uniqueSchemaFileId: unique('unique_schema_file_id').on(table.schemaFileId),\n }\n }\n)\n\nexport const modelsRelations = relations(models, ({ many }) => ({\n properties: many(properties),\n}))\n\nexport type NewModelRecord = typeof models.$inferInsert\nexport type ModelRecordType = typeof models.$inferSelect\n\nexport const properties = sqliteTable(\n 'properties',\n {\n id: integer('id').primaryKey({ autoIncrement: true }),\n name: text('name').notNull(),\n dataType: text('data_type').notNull(),\n modelId: integer('model_id')\n .notNull()\n .references(() => models.id),\n refModelId: integer('ref_model_id').references(() => models.id),\n refValueType: text('ref_value_type'),\n schemaFileId: text('schema_file_id'), // ID from JSON file for change tracking\n isEdited: integer('is_edited', { mode: 'boolean' }), // true if property has been edited locally, false if matches schema file\n required: integer('required', { mode: 'boolean' }), // true if relation/image property is required (publish fails when related item not found)\n // Storage settings from the schema file's `storage: { type, path, extension }`, in the internal\n // shape ModelProperty uses. Null when the property has no storage config.\n storageType: text('storage_type'), // 'ItemStorage' | 'PropertyStorage'\n localStorageDir: text('local_storage_dir'), // storage.path, e.g. '/html'\n filenameSuffix: text('filename_suffix'), // storage.extension, e.g. '.html'\n // The whole definition as JSON: the schema file's property object, or a code-defined one\n // (validation, htmlEmbeddedDataUriPolicy, description and any other field). The columns above\n // win for the fields they hold. Read through helpers/propertyDefinition.\n definition: text('definition'),\n },\n (table) => {\n return {\n uniqueNameModelId: unique('unique_name_model_id').on(\n table.name,\n table.modelId,\n ),\n uniqueSchemaFileId: unique('unique_property_schema_file_id').on(table.schemaFileId),\n }\n },\n)\n\nexport const propertiesRelations = relations(properties, ({ one }) => ({\n model: one(models),\n refModel: one(models),\n}))\n\nexport type NewPropertyRecord = InferInsertModel<typeof properties>\nexport type PropertyType = InferSelectModel<typeof properties>\n","import { sql, type SQL } from 'drizzle-orm'\nimport type { SQLiteColumn } from 'drizzle-orm/sqlite-core'\n\n/**\n * True for a stored attestation uid, false for the placeholders a draft row holds (NULL, '',\n * 'NULL', ZERO_BYTES32; see `isPlaceholderUid` in @seedprotocol/eas). The predicate of the partial\n * unique indexes on `seeds.uid` and `versions.uid`.\n */\nexport const attestedUidSql = (column: SQLiteColumn): SQL =>\n sql`${column} IS NOT NULL AND trim(${column}) NOT IN ('', 'NULL') AND lower(trim(${column})) != '0x0000000000000000000000000000000000000000000000000000000000000000'`\n","import { InferSelectModel } from 'drizzle-orm'\nimport { index, int, sqliteTable, text, uniqueIndex } from 'drizzle-orm/sqlite-core'\nimport { attestedUidSql } from './attestedUid'\n\nexport const seeds = sqliteTable(\n 'seeds',\n {\n localId: text('local_id').unique(),\n uid: text('uid'),\n schemaUid: text('schema_uid'),\n type: text('type'),\n // schemaFileId of the models row this item belongs to (= Model.id). Disambiguates items whose\n // model name exists in more than one schema; null for legacy rows that couldn't be backfilled.\n modelFileId: text('model_file_id'),\n publisher: text('publisher'),\n attestationRaw: text('attestation_raw'),\n attestationCreatedAt: int('attestation_created_at'),\n // Set on insert when the writer leaves it out. No $onUpdate: readers rank rows by\n // COALESCE(attestation_created_at, created_at), and some writers move it on purpose.\n createdAt: int('created_at').$defaultFn(() => Date.now()),\n // Set on every insert and update unless the writer passes a value.\n updatedAt: int('updated_at')\n .$defaultFn(() => Date.now())\n .$onUpdate(() => Date.now()),\n _markedForDeletion: int('_marked_for_deletion'),\n revokedAt: int('revoked_at'),\n },\n (table) => [\n index('seeds_uid_idx').on(table.uid),\n index('seeds_type_idx').on(table.type),\n // One row per attested seed uid (migration 0029). Drafts hold a placeholder uid and are left out.\n uniqueIndex('seeds_attested_uid_unique').on(table.uid).where(attestedUidSql(table.uid)),\n ],\n // {\n // triggers: [\n // sql<string>`CREATE TRIGGER IF NOT EXISTS seeds_created_at_trigger\n // BEFORE INSERT\n // ON seeds\n // FOR EACH ROW\n // BEGIN\n // SELECT strftime('%s', 'now') * 1000 INTO NEW.created_at;\n // END;`,\n // ],\n // },\n)\n\nexport type SeedType = InferSelectModel<typeof seeds>\n","import { index, int, sqliteTable, text, uniqueIndex } from 'drizzle-orm/sqlite-core'\nimport { attestedUidSql } from './attestedUid'\nimport { InferSelectModel } from 'drizzle-orm'\n\nexport const versions = sqliteTable('versions', {\n localId: text('local_id').unique(),\n uid: text('uid'),\n seedLocalId: text('seed_local_id'),\n seedUid: text('seed_uid'),\n seedType: text('seed_type'),\n note: text('note'),\n // Set on insert when the writer leaves it out. No $onUpdate: readers rank rows by\n // COALESCE(attestation_created_at, created_at), and some writers move it on purpose.\n createdAt: int('created_at').$defaultFn(() => Date.now()),\n // Set on every insert and update unless the writer passes a value.\n updatedAt: int('updated_at')\n .$defaultFn(() => Date.now())\n .$onUpdate(() => Date.now()),\n attestationCreatedAt: int('attestation_created_at'),\n attestationRaw: text('attestation_raw'),\n publisher: text('publisher'),\n /**\n * When the version attestation was revoked, in Unix seconds (EAS `revocationTime`, or the local\n * unpublish time until sync confirms it). Null while live or unpublished.\n */\n revokedAt: int('revoked_at'),\n}, (table) => [\n index('versions_seed_local_id_idx').on(table.seedLocalId),\n // One row per attested version uid (migration 0029). Drafts hold a placeholder uid and are left out.\n uniqueIndex('versions_attested_uid_unique').on(table.uid).where(attestedUidSql(table.uid)),\n])\n\nexport type VersionsType = InferSelectModel<typeof versions>\n","import { index, int, integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'\nimport { InferSelectModel } from 'drizzle-orm'\nimport { properties } from './ModelSchema'\n\nexport const metadata = sqliteTable('metadata', {\n localId: text('local_id').unique(),\n uid: text('uid'),\n propertyId: integer('property_id').references(() => properties.id),\n propertyName: text('property_name'),\n propertyValue: text('property_value'),\n schemaUid: text('schema_uid'),\n modelType: text('model_type'),\n seedLocalId: text('seed_local_id'),\n seedUid: text('seed_uid'),\n versionLocalId: text('version_local_id'),\n versionUid: text('version_uid'),\n easDataType: text('eas_data_type'),\n refValueType: text('ref_value_type'),\n refModelUid: text('ref_schema_uid'),\n refSeedType: text('ref_seed_type'),\n refResolvedValue: text('ref_resolved_value'),\n refResolvedDisplayValue: text('ref_resolved_display_value'),\n localStorageDir: text('local_storage_dir'),\n attestationRaw: text('attestation_raw'),\n attestationCreatedAt: int('attestation_created_at'),\n contentHash: text('content_hash'),\n // Set on insert when the writer leaves it out. No $onUpdate: readers rank rows by\n // COALESCE(attestation_created_at, created_at), and some writers move it on purpose.\n createdAt: int('created_at').$defaultFn(() => Date.now()),\n // Set on every insert and update unless the writer passes a value.\n updatedAt: int('updated_at')\n .$defaultFn(() => Date.now())\n .$onUpdate(() => Date.now()),\n publisher: text('publisher'),\n // Unix seconds when this row's attestation was revoked on EAS; null while it's live (or for a\n // local, unpublished row). EAS sync keeps only the canonical attestation per (version, property\n // schema): the newest live one, or the newest revoked one when all are revoked. So a non-null\n // value marks a property kept only for its last value, not one that is present on the version.\n revokedAt: int('revoked_at'),\n // For a row EAS sync derived for an ItemStorage property from a `storage_transaction_id`\n // attestation (uid null, ref_value_type 'file', value = the transaction id): that attestation's\n // uid. Null for every other row. Marks the row as published content, not a local draft.\n derivedFromUid: text('derived_from_uid'),\n // On a cleared local row (null value): publish revokes the property's attestations instead of\n // attesting the empty value (ADR 0021). Null on every other row.\n retract: int('retract', { mode: 'boolean' }),\n}, (table) => [\n index('metadata_seed_local_id_property_name_idx').on(table.seedLocalId, table.propertyName),\n index('metadata_seed_uid_idx').on(table.seedUid),\n])\n\nexport type MetadataType = InferSelectModel<typeof metadata>\n","import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\nimport { InferSelectModel } from 'drizzle-orm'\nexport const appState = sqliteTable('appState', {\n key: text('key').unique(),\n value: text('value'),\n createdAt: int('created_at'),\n updatedAt: int('updated_at'),\n})\n\nexport type appStateType = InferSelectModel<typeof appState>\n","import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\nimport { relations } from 'drizzle-orm'\nimport { models } from './ModelSchema'\n\nexport const modelUids = sqliteTable('model_uids', {\n id: int('id').primaryKey({ autoIncrement: true }),\n uid: text('uid').notNull(),\n modelId: int('model_id')\n .notNull()\n .unique()\n .references(() => models.id),\n})\n\nexport const modelRelations = relations(modelUids, ({ one }) => ({\n model: one(models),\n}))\n","import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\nimport { relations } from 'drizzle-orm'\nimport { properties } from './ModelSchema'\n\nexport const propertyUids = sqliteTable('property_uids', {\n id: int('id').primaryKey({ autoIncrement: true }),\n uid: text('uid').notNull(),\n propertyId: int('property_id')\n .notNull()\n .unique()\n .references(() => properties.id),\n})\n\nexport const propertyUidRelations = relations(propertyUids, ({ one }) => ({\n property: one(properties),\n}))\n","import { integer, sqliteTable, text, blob, } from 'drizzle-orm/sqlite-core'\nimport { InferSelectModel } from 'drizzle-orm'\n\nexport const config = sqliteTable(\n 'config',\n {\n id: integer('id').primaryKey({ autoIncrement: true }),\n key: text('key').notNull(),\n text: text('text'),\n json: text('json'),\n blob: blob('blob'),\n }\n)\n\nexport type configType = InferSelectModel<typeof config>","import { InferSelectModel, } from 'drizzle-orm'\nimport { int, sqliteTable, text, integer, unique } from 'drizzle-orm/sqlite-core'\n\n\nexport const schemas = sqliteTable(\n 'schemas',\n {\n id: integer('id').primaryKey({ autoIncrement: true }),\n name: text('name').notNull(),\n version: integer('version').notNull(),\n schemaFileId: text('schema_file_id'), // ID from JSON file for change tracking - must be unique\n schemaData: text('schema_data'), // Full JSON schema content (SchemaFileFormat as JSON string)\n isDraft: integer('is_draft', { mode: 'boolean' }), // true if schema is in draft/editing state, false if published to file\n isEdited: integer('is_edited', { mode: 'boolean' }), // true if schema has been edited locally, false if matches schema file\n // Hash of the schema file applySchemaFile last wrote to the rows (with schema_file_id and\n // version): a file with the same three is not applied again.\n contentHash: text('content_hash'),\n createdAt: int('created_at'),\n updatedAt: int('updated_at'),\n },\n (table) => {\n return {\n uniqueSchemaFileId: unique('unique_schema_schema_file_id').on(table.schemaFileId),\n }\n }\n)\n\nexport type SchemaType = InferSelectModel<typeof schemas>","import { integer, sqliteTable, unique } from 'drizzle-orm/sqlite-core';\nimport { InferSelectModel } from 'drizzle-orm';\nimport { schemas } from './SchemaSchema';\nimport { models } from './ModelSchema';\n\nexport const modelSchemas = sqliteTable('model_schemas', {\n id: integer('id').primaryKey({ autoIncrement: true }),\n modelId: integer('model_id').references(() => models.id),\n schemaId: integer('schema_id').references(() => schemas.id),\n}, (table) => [\n // One link per model and schema (migration 0029)\n unique('model_schemas_model_id_schema_id_unique').on(table.modelId, table.schemaId),\n])\n\nexport type ModelSchemaType = InferSelectModel<typeof modelSchemas>","import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\nimport { InferSelectModel } from 'drizzle-orm'\n\nexport const publishProcesses = sqliteTable('publish_processes', {\n id: int('id').primaryKey({ autoIncrement: true }),\n seedLocalId: text('seed_local_id').notNull(),\n modelName: text('model_name').notNull(),\n schemaId: text('schema_id'),\n status: text('status').notNull(), // 'in_progress' | 'completed' | 'failed' | 'interrupted'\n startedAt: int('started_at').notNull(),\n completedAt: int('completed_at'),\n errorMessage: text('error_message'),\n errorStep: text('error_step'),\n errorDetails: text('error_details'),\n errorCode: text('error_code'), // e.g. ManagedAccountPublishError.code\n persistedSnapshot: text('persisted_snapshot').notNull(),\n seedId: text('seed_id'),\n existingSeedUid: text('existing_seed_uid'),\n createdAt: int('created_at'),\n updatedAt: int('updated_at'),\n})\n\nexport type PublishProcessType = InferSelectModel<typeof publishProcesses>\n","import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\nimport { InferSelectModel } from 'drizzle-orm'\n\nexport const uploadProcesses = sqliteTable('upload_processes', {\n id: int('id').primaryKey({ autoIncrement: true }),\n reimbursementConfirmed: int('reimbursement_confirmed').notNull(), // 0 or 1 for boolean\n reimbursementTransactionId: text('reimbursement_transaction_id'),\n transactionKeys: text('transaction_keys'),\n persistedSnapshot: text('persisted_snapshot').notNull(), // JSON string\n createdAt: int('created_at'),\n updatedAt: int('updated_at'),\n})\n\nexport type UploadProcessType = InferSelectModel<typeof uploadProcesses>\n","import { int, sqliteTable, text, uniqueIndex } from 'drizzle-orm/sqlite-core'\nimport { InferSelectModel } from 'drizzle-orm'\n\n/** Background job: resolve L1 tx id and wait for L1 confirmation after bundler publish. */\nexport const arweaveL1FinalizeJobs = sqliteTable(\n 'arweave_l1_finalize_jobs',\n {\n id: int('id').primaryKey({ autoIncrement: true }),\n seedLocalId: text('seed_local_id').notNull(),\n dataItemId: text('data_item_id').notNull(),\n /** L1 bundle / anchor transaction id from gateway GraphQL `bundledIn.id`. */\n l1TransactionId: text('l1_transaction_id'),\n bundleId: text('bundle_id'),\n versionLocalId: text('version_local_id'),\n itemPropertyName: text('item_property_name'),\n /** `pending_l1` | `confirmed` | `failed` */\n phase: text('phase').notNull(),\n statusJson: text('status_json'),\n errorMessage: text('error_message'),\n createdAt: int('created_at').notNull(),\n updatedAt: int('updated_at').notNull(),\n },\n (table) => ({\n dataItemIdUnique: uniqueIndex('arweave_l1_finalize_jobs_data_item_id_unique').on(table.dataItemId),\n }),\n)\n\nexport type ArweaveL1FinalizeJobType = InferSelectModel<typeof arweaveL1FinalizeJobs>\n","import { InferSelectModel } from 'drizzle-orm'\nimport { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\n\nexport const easSyncProcesses = sqliteTable('eas_sync_processes', {\n id: int('id').primaryKey({ autoIncrement: true }),\n status: text('status').notNull(), // 'in_progress' | 'completed' | 'failed'\n startedAt: int('started_at').notNull(),\n completedAt: int('completed_at'),\n requestPayload: text('request_payload').notNull(),\n errorMessage: text('error_message'),\n errorDetails: text('error_details'),\n persistedSnapshot: text('persisted_snapshot').notNull(),\n createdAt: int('created_at'),\n updatedAt: int('updated_at'),\n})\n\nexport type EasSyncProcessType = InferSelectModel<typeof easSyncProcesses>\n","import { int, sqliteTable, text, uniqueIndex } from 'drizzle-orm/sqlite-core'\n\n/**\n * Links Image seeds materialized from Html `data:image/*` URIs to the parent Item seed for co-publish.\n * Rows are removed after a successful publish (see clearHtmlEmbeddedImageCoPublishRows).\n */\nexport const htmlEmbeddedImageCoPublish = sqliteTable(\n 'html_embedded_image_co_publish',\n {\n id: int('id').primaryKey({ autoIncrement: true }),\n parentSeedLocalId: text('parent_seed_local_id').notNull(),\n htmlSeedLocalId: text('html_seed_local_id').notNull(),\n imageSeedLocalId: text('image_seed_local_id').notNull(),\n /** Stable dedup key (e.g. sha256 of data URI or normalized URI string). */\n stableKey: text('stable_key').notNull(),\n createdAt: int('created_at').notNull(),\n },\n (t) => [\n uniqueIndex('html_embed_co_pub_parent_html_stable').on(\n t.parentSeedLocalId,\n t.htmlSeedLocalId,\n t.stableKey,\n ),\n ],\n)\n","import { index, int, sqliteTable, text, uniqueIndex } from 'drizzle-orm/sqlite-core'\nimport { InferInsertModel, InferSelectModel } from 'drizzle-orm'\n\n/**\n * The item write outbox (ADR 0019): one row per edit to an item, appended when the value is\n * assigned and applied to `seeds`, `versions` and `metadata` by the leader tab's drainer.\n */\nexport const pendingWrites = sqliteTable(\n 'pending_writes',\n {\n id: int('id').primaryKey({ autoIncrement: true }),\n /** Unique per op; the drainer and `save()` refer to an op by it. */\n opId: text('op_id').notNull(),\n /** Unused: nothing appends grouped ops. Kept until a migration drops it. */\n groupId: text('group_id'),\n seedLocalId: text('seed_local_id').notNull(),\n /** Null for ops on the seed itself (`create`, `delete`). */\n propertyName: text('property_name'),\n /** `create` | `set` | `delete` | `storage` */\n kind: text('kind').notNull(),\n /** JSON-encoded value. */\n value: text('value'),\n /**\n * A storage op's staged file: the assigned bytes, written by the tab that appended the op (an\n * ItemStorage op's staged path is in its JSON value too).\n */\n valueRef: text('value_ref'),\n /** The stored metadata row the edit was made against, to detect a synced row written since. */\n baseRowId: text('base_row_id'),\n /** Unused: the base uid is read through base_row_id. Kept until a migration drops it. */\n baseUid: text('base_uid'),\n createdAt: int('created_at').notNull(),\n /** The tab that appended the op. */\n tabId: text('tab_id'),\n /** `pending` | `applied` | `superseded` | `failed`. An op is claimed and applied in one transaction. */\n status: text('status').notNull(),\n error: text('error'),\n /** The name of the error that failed the op (`OwnershipError`, say), so a waiter can tell why. */\n errorName: text('error_name'),\n attempts: int('attempts').notNull().default(0),\n appliedAt: int('applied_at'),\n /** JSON the applier recorded when the op applied (for a `set`: the metadata row written). */\n result: text('result'),\n /** JSON: the synced value this op was applied over, when there was one (ADR 0019). */\n conflict: text('conflict'),\n conflictResolvedAt: int('conflict_resolved_at'),\n },\n (table) => ({\n opIdUnique: uniqueIndex('pending_writes_op_id_unique').on(table.opId),\n /** The drainer's order: per property, oldest first, among one status. */\n drainOrder: index('pending_writes_drain_order').on(\n table.status,\n table.seedLocalId,\n table.propertyName,\n table.createdAt,\n ),\n }),\n)\n\nexport type PendingWriteType = InferSelectModel<typeof pendingWrites>\nexport type NewPendingWrite = InferInsertModel<typeof pendingWrites>\n","import { index, int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\nimport { InferSelectModel } from 'drizzle-orm'\n\n/**\n * The entity change log (ADR 0020): one row per row written to `seeds`, `versions` or `metadata`,\n * inserted by triggers (migration 0023), so it commits or rolls back with the write. The browser's\n * change feed reads it to tell loaded Items and ItemProperties which seeds changed. Nothing else\n * writes it; the leader tab prunes rows older than 10 minutes.\n */\nexport const entityChanges = sqliteTable(\n 'entity_changes',\n {\n seq: int('seq').primaryKey({ autoIncrement: true }),\n /** `seeds` | `versions` | `metadata` */\n tbl: text('tbl').notNull(),\n seedLocalId: text('seed_local_id'),\n seedUid: text('seed_uid'),\n /** Set for `metadata` rows only. */\n propertyName: text('property_name'),\n /** Unix ms when the trigger ran. */\n at: int('at').notNull(),\n },\n (table) => ({\n at: index('entity_changes_at').on(table.at),\n }),\n)\n\nexport type EntityChangeType = InferSelectModel<typeof entityChanges>\n","import type {\n DownloadAllFilesParams,\n DownloadAllFilesResult,\n DownloadSingleFileParams,\n IFileManager,\n ResizeAllImagesParams,\n ResizeImageParams,\n} from './IFileManager'\n\nexport abstract class BaseFileManager {\n private static fileSystemInitialized = false\n private static initializing = false\n private static workingDir: string | undefined\n private static _impl: IFileManager | null = null\n private static initializePromise: Promise<void> | null = null\n\n static configure(impl: IFileManager): void {\n if (!impl) {\n throw new Error(\n 'Cannot configure FileManager with undefined or null. Ensure the platform-specific FileManager is properly created.',\n )\n }\n BaseFileManager._impl = impl\n }\n\n private static requireImpl(): IFileManager {\n if (!BaseFileManager._impl) {\n throw new Error(\n 'FileManager not configured. Call BaseFileManager.configure() during platform init.',\n )\n }\n return BaseFileManager._impl\n }\n\n /**\n * Clears FS init flags so a later call can retry. Used after a failed init\n * and by tests. Does not unmount or delete any files.\n */\n static resetInitializationState(): void {\n this.fileSystemInitialized = false\n this.initializing = false\n this.initializePromise = null\n this.workingDir = undefined\n }\n\n static initializeFileSystem(workingDir?: string): Promise<void> {\n if (this.fileSystemInitialized) {\n return Promise.resolve()\n }\n if (this.initializePromise) {\n return this.initializePromise\n }\n\n this.initializing = true\n const pending = this.runInitializeFileSystem(workingDir).finally(() => {\n this.initializing = false\n if (this.initializePromise === pending) {\n this.initializePromise = null\n }\n })\n this.initializePromise = pending\n return pending\n }\n\n private static async runInitializeFileSystem(workingDir?: string): Promise<void> {\n await BaseFileManager.requireImpl().initializeFileSystem(workingDir)\n this.fileSystemInitialized = true\n this.workingDir = workingDir\n }\n\n static getWorkingDir(): string {\n if (!this.workingDir) {\n throw new Error('Working directory is not set')\n }\n return this.workingDir\n }\n\n /**\n * Build a path under the configured files root (e.g. /app-files).\n * Use this instead of hardcoding /files/ for images, html, json, etc.\n * @param subpaths - path segments to join (e.g. 'images', fileName)\n * @returns full path like /app-files/images/egg.jpg\n */\n static getFilesPath(...subpaths: string[]): string {\n const root = this.getWorkingDir().replace(/\\/$/, '')\n const parts = [root, ...subpaths].filter(Boolean)\n return parts.join('/').replace(/\\/+/g, '/')\n }\n\n static getContentUrlFromPath(path: string): Promise<string | undefined> {\n return BaseFileManager.requireImpl().getContentUrlFromPath(path)\n }\n\n static downloadAllFiles(params: DownloadAllFilesParams): Promise<DownloadAllFilesResult | void> {\n return BaseFileManager.requireImpl().downloadAllFiles(params)\n }\n\n static downloadFileByTransactionId({\n transactionId,\n arweaveHost,\n arweaveBaseUrls,\n excludedTransactions,\n expectedContentHash,\n compositeChildPaths,\n skipExisting,\n }: DownloadSingleFileParams): Promise<DownloadAllFilesResult | void> {\n return BaseFileManager.requireImpl().downloadAllFiles({\n transactionIds: [transactionId],\n arweaveHost,\n arweaveBaseUrls,\n excludedTransactions,\n expectedContentHashes: expectedContentHash ? { [transactionId]: expectedContentHash } : undefined,\n compositeChildPaths: compositeChildPaths ? { [transactionId]: compositeChildPaths } : undefined,\n skipExisting,\n })\n }\n\n static resizeImage({ filePath, width, height }: ResizeImageParams): Promise<void> {\n return BaseFileManager.requireImpl().resizeImage({ filePath, width, height })\n }\n\n static resizeAllImages({ width, height }: ResizeAllImagesParams): Promise<void> {\n return BaseFileManager.requireImpl().resizeAllImages({ width, height })\n }\n\n static pathExists(filePath: string): Promise<boolean> {\n return BaseFileManager.requireImpl().pathExists(filePath)\n }\n\n static invalidateCachedPaths(filePaths: string[]): Promise<void> {\n return BaseFileManager.requireImpl().invalidateCachedPaths(filePaths)\n }\n\n /** File size in bytes, or null if the path does not exist / cannot be stated. */\n static getFileSize(filePath: string): Promise<number | null> {\n return BaseFileManager.requireImpl().getFileSize(filePath)\n }\n\n /**\n * Returns a list of filenames in the given directory (e.g. 'images', 'files').\n */\n static listFiles(dir: string): Promise<string[]> {\n return BaseFileManager.requireImpl().listFiles(dir)\n }\n\n /**\n * Returns a list of image filenames in the images folder (originals only, excludes size subdirs).\n * Use this to get all stored images without traversing 480/760/1024/1440/1920 subdirectories.\n */\n static listImageFiles(): Promise<string[]> {\n return this.listFiles('images')\n }\n\n static createDirIfNotExists(filePath: string): Promise<void> {\n return BaseFileManager.requireImpl().createDirIfNotExists(filePath)\n }\n\n static async waitForFile(filePath: string): Promise<boolean> {\n return BaseFileManager.requireImpl().waitForFile(filePath)\n }\n\n static async waitForFileWithContent(\n filePath: string,\n interval?: number,\n timeout?: number,\n ): Promise<boolean> {\n return BaseFileManager.requireImpl().waitForFileWithContent(filePath, interval, timeout)\n }\n\n static async saveFile(filePath: string, content: string | Blob | ArrayBuffer): Promise<void> {\n return BaseFileManager.requireImpl().saveFile(filePath, content)\n }\n\n static saveFileSync(filePath: string, content: string | Blob | ArrayBuffer): void {\n return BaseFileManager.requireImpl().saveFileSync(filePath, content)\n }\n\n static async readFile(filePath: string): Promise<File> {\n return BaseFileManager.requireImpl().readFile(filePath)\n }\n\n static readFileSync(filePath: string): File {\n return BaseFileManager.requireImpl().readFileSync(filePath)\n }\n\n static async readFileAsBuffer(filePath: string): Promise<Buffer | Blob> {\n return BaseFileManager.requireImpl().readFileAsBuffer(filePath)\n }\n\n static async readFileAsString(filePath: string): Promise<string> {\n return BaseFileManager.requireImpl().readFileAsString(filePath)\n }\n\n static async getFs(): Promise<any> {\n return BaseFileManager.requireImpl().getFs()\n }\n\n static getFsSync(): any {\n return BaseFileManager.requireImpl().getFsSync()\n }\n\n static getPathModule(): any {\n return BaseFileManager.requireImpl().getPathModule()\n }\n\n static getParentDirPath(filePath: string): string {\n return BaseFileManager.requireImpl().getParentDirPath(filePath)\n }\n\n static getFilenameFromPath(filePath: string): string {\n return BaseFileManager.requireImpl().getFilenameFromPath(filePath)\n }\n}\n"],"names":[],"mappings":";;;;AAEA,MAAM,MAAM,GAAG,KAAK,CAAC,oCAAoC,CAAC;AAE1D;AACO,MAAM,2BAA2B,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;AAEjE;;;AAGG;AACG,SAAU,iBAAiB,CAAC,KAAc,EAAA;;IAE9C,KAAK,IAAI,OAAO,GAAY,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,OAAO,IAAI,IAAI,IAAI,KAAK,GAAG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