@seedprotocol/sdk 0.7.9-next.1189.g5e63267 → 0.7.9

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 (581) hide show
  1. package/dist/BaseFileManager-BAlySv8w.js +650 -0
  2. package/dist/BaseFileManager-BAlySv8w.js.map +1 -0
  3. package/dist/{Item-CG5IhPtL.js → Item-Bf4kWKpH.js} +5576 -6649
  4. package/dist/Item-Bf4kWKpH.js.map +1 -0
  5. package/dist/{ModelProperty-DDD47KVm.js → ModelProperty-BlaEgb_U.js} +345 -709
  6. package/dist/ModelProperty-BlaEgb_U.js.map +1 -0
  7. package/dist/Schema-J_1f6p0c.js +1456 -0
  8. package/dist/Schema-J_1f6p0c.js.map +1 -0
  9. package/dist/{SchemaValidationService-CZzKNL04.js → SchemaValidationService-CnmKyzR-.js} +6 -9
  10. package/dist/{SchemaValidationService-CZzKNL04.js.map → SchemaValidationService-CnmKyzR-.js.map} +1 -1
  11. package/dist/{configurePlatform-Dukm2QwO.js → configurePlatform-CiOJ1R3q.js} +3 -12
  12. package/dist/configurePlatform-CiOJ1R3q.js.map +1 -0
  13. package/dist/db/drizzle/0026_add_content_hash_to_schemas.sql +1 -0
  14. package/dist/db/drizzle/0027_link_metadata_property_ids.sql +74 -0
  15. package/dist/db/drizzle/0028_add_definition_to_properties.sql +17 -0
  16. package/dist/db/drizzle/0029_dedupe_chain_uids_add_unique_indexes.sql +120 -0
  17. package/dist/db/drizzle/meta/0026_snapshot.json +1659 -0
  18. package/dist/db/drizzle/meta/0027_snapshot.json +1659 -0
  19. package/dist/db/drizzle/meta/0028_snapshot.json +1666 -0
  20. package/dist/db/drizzle/meta/0029_snapshot.json +1691 -0
  21. package/dist/db/drizzle/meta/_journal.json +29 -1
  22. package/dist/{detachRowsBeforeDelete-Di1enVUF.js → detachRowsBeforeDelete-sEaUwlOU.js} +2 -13
  23. package/dist/{detachRowsBeforeDelete-Di1enVUF.js.map → detachRowsBeforeDelete-sEaUwlOU.js.map} +1 -1
  24. package/dist/dist/{index-rOTW-2QZ.d.ts → BaseFileManager-BAlySv8w.d.ts} +1407 -2700
  25. package/dist/dist/BaseFileManager-BAlySv8w.d.ts.map +1 -0
  26. package/dist/dist/{configurePlatform-Dukm2QwO.d.ts → configurePlatform-CiOJ1R3q.d.ts} +1 -1
  27. package/dist/dist/configurePlatform-CiOJ1R3q.d.ts.map +1 -0
  28. package/dist/dist/{index-DxHpPNfn.d.ts → index-D0V-mjCV.d.ts} +39 -1
  29. package/dist/dist/{index-DxHpPNfn.d.ts.map → index-D0V-mjCV.d.ts.map} +1 -1
  30. package/dist/dist/{index.node-WsEJCOwC.d.ts → index.node-CYPemH-t.d.ts} +157 -5
  31. package/dist/dist/{index.node-WsEJCOwC.d.ts.map → index.node-CYPemH-t.d.ts.map} +1 -1
  32. package/dist/dist/platform.node.d.ts +2 -2
  33. package/dist/eas-wB_fQ8Tc.js +32 -0
  34. package/dist/eas-wB_fQ8Tc.js.map +1 -0
  35. package/dist/errors-DLSoqSHG.js +6550 -0
  36. package/dist/errors-DLSoqSHG.js.map +1 -0
  37. package/dist/getPublishPayload-BnIwpwz1.js +760 -0
  38. package/dist/getPublishPayload-BnIwpwz1.js.map +1 -0
  39. package/dist/getPublishPendingDiff-D6_-A5ns.js +125 -0
  40. package/dist/getPublishPendingDiff-D6_-A5ns.js.map +1 -0
  41. package/dist/getPublishUploads-sS6JfPgz.js +783 -0
  42. package/dist/getPublishUploads-sS6JfPgz.js.map +1 -0
  43. package/dist/{index-DQoyhp2c.js → index-BVBmz_cc.js} +11 -14
  44. package/dist/index-BVBmz_cc.js.map +1 -0
  45. package/dist/index-CYGWPoOx.js +27 -0
  46. package/dist/index-CYGWPoOx.js.map +1 -0
  47. package/dist/{index-DxHpPNfn.js → index-D0V-mjCV.js} +2 -2
  48. package/dist/index-D0V-mjCV.js.map +1 -0
  49. package/dist/index-DmTtj1nk.js +817 -0
  50. package/dist/index-DmTtj1nk.js.map +1 -0
  51. package/dist/{index.browser-QPWBkLJA.js → index.browser-CUmBVYen.js} +397 -356
  52. package/dist/index.browser-CUmBVYen.js.map +1 -0
  53. package/dist/{index.node-WsEJCOwC.js → index.node-CYPemH-t.js} +10 -10
  54. package/dist/index.node-CYPemH-t.js.map +1 -0
  55. package/dist/main.js +23 -1075
  56. package/dist/main.js.map +1 -1
  57. package/dist/modelPropertyRecordSchemas-C7UgA5TH.js +48 -0
  58. package/dist/modelPropertyRecordSchemas-C7UgA5TH.js.map +1 -0
  59. package/dist/node.js +14 -18
  60. package/dist/node.js.map +1 -1
  61. package/dist/platform.browser.js +8 -13
  62. package/dist/platform.browser.js.map +1 -1
  63. package/dist/platform.node.js +6 -16
  64. package/dist/platform.node.js.map +1 -1
  65. package/dist/property-BxUYznH0.js +87 -0
  66. package/dist/property-BxUYznH0.js.map +1 -0
  67. package/dist/publishGraph-EcB40Uii.js +311 -0
  68. package/dist/publishGraph-EcB40Uii.js.map +1 -0
  69. package/dist/readHtmlBodyForStorageSeed-D6KPtWoR.js +110 -0
  70. package/dist/readHtmlBodyForStorageSeed-D6KPtWoR.js.map +1 -0
  71. package/dist/seedSchema/ModelSchema.ts +4 -0
  72. package/dist/seedSchema/ModelSchemaSchema.ts +5 -2
  73. package/dist/seedSchema/PendingWriteSchema.ts +4 -1
  74. package/dist/seedSchema/SchemaSchema.ts +3 -0
  75. package/dist/seedSchema/SeedSchema.ts +8 -2
  76. package/dist/seedSchema/VersionSchema.ts +7 -2
  77. package/dist/seedSchema/attestedUid.ts +10 -0
  78. package/dist/src/Item/Item.d.ts +32 -30
  79. package/dist/src/Item/Item.d.ts.map +1 -1
  80. package/dist/src/Item/loadItem.d.ts +12 -0
  81. package/dist/src/Item/loadItem.d.ts.map +1 -0
  82. package/dist/src/Item/service/itemMachineSingle.d.ts +2 -13
  83. package/dist/src/Item/service/itemMachineSingle.d.ts.map +1 -1
  84. package/dist/src/ItemProperty/ItemProperty.d.ts +77 -46
  85. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  86. package/dist/src/ItemProperty/loadProperty.d.ts +11 -0
  87. package/dist/src/ItemProperty/loadProperty.d.ts.map +1 -0
  88. package/dist/src/ItemProperty/propertyWrite.d.ts +54 -0
  89. package/dist/src/ItemProperty/propertyWrite.d.ts.map +1 -0
  90. package/dist/src/ItemProperty/{service/actors/saveValueToDb/rowContext.d.ts → rowContext.d.ts} +1 -1
  91. package/dist/src/ItemProperty/rowContext.d.ts.map +1 -0
  92. package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts +6 -0
  93. package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
  94. package/dist/src/ItemProperty/service/actors/modelPropertyRecordSchemas.d.ts +5 -15
  95. package/dist/src/ItemProperty/service/actors/modelPropertyRecordSchemas.d.ts.map +1 -1
  96. package/dist/src/ItemProperty/service/propertyMachine.d.ts +4 -50
  97. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  98. package/dist/src/Model/Model.d.ts +26 -56
  99. package/dist/src/Model/Model.d.ts.map +1 -1
  100. package/dist/src/Model/createModelProperties.d.ts +10 -0
  101. package/dist/src/Model/createModelProperties.d.ts.map +1 -0
  102. package/dist/src/Model/loadModel.d.ts +13 -0
  103. package/dist/src/Model/loadModel.d.ts.map +1 -0
  104. package/dist/src/Model/service/actors/validateModel.d.ts.map +1 -1
  105. package/dist/src/Model/service/modelMachine.d.ts +5 -114
  106. package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
  107. package/dist/src/ModelProperty/ModelProperty.d.ts +44 -37
  108. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  109. package/dist/src/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
  110. package/dist/src/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
  111. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +6 -77
  112. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
  113. package/dist/src/Schema/Schema.d.ts +36 -37
  114. package/dist/src/Schema/Schema.d.ts.map +1 -1
  115. package/dist/src/Schema/loadOrCreateSchema.d.ts +21 -0
  116. package/dist/src/Schema/loadOrCreateSchema.d.ts.map +1 -0
  117. package/dist/src/Schema/service/schemaMachine.d.ts +7 -125
  118. package/dist/src/Schema/service/schemaMachine.d.ts.map +1 -1
  119. package/dist/src/browser/db/Db.d.ts.map +1 -1
  120. package/dist/src/browser/db/changeFeed.d.ts +2 -18
  121. package/dist/src/browser/db/changeFeed.d.ts.map +1 -1
  122. package/dist/src/browser/db/drizzleFiles.d.ts +6 -2
  123. package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
  124. package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
  125. package/dist/src/browser/workers/imageResize.d.ts.map +1 -1
  126. package/dist/src/client/ClientManager.d.ts +90 -57
  127. package/dist/src/client/ClientManager.d.ts.map +1 -1
  128. package/dist/src/client/actors/addModelsToDb.d.ts +9 -7
  129. package/dist/src/client/actors/addModelsToDb.d.ts.map +1 -1
  130. package/dist/src/client/actors/dbInit.d.ts +3 -3
  131. package/dist/src/client/actors/dbInit.d.ts.map +1 -1
  132. package/dist/src/client/actors/fileSystemInit.d.ts +3 -3
  133. package/dist/src/client/actors/fileSystemInit.d.ts.map +1 -1
  134. package/dist/src/client/actors/platformClassesInit.d.ts +10 -5
  135. package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
  136. package/dist/src/client/actors/processSchemaFiles.d.ts +18 -3
  137. package/dist/src/client/actors/processSchemaFiles.d.ts.map +1 -1
  138. package/dist/src/client/actors/saveConfig.d.ts +6 -3
  139. package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
  140. package/dist/src/client/clientManagerMachine.d.ts +22 -20
  141. package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
  142. package/dist/src/client/constants.d.ts +1 -9
  143. package/dist/src/client/constants.d.ts.map +1 -1
  144. package/dist/src/client/readiness.d.ts +26 -0
  145. package/dist/src/client/readiness.d.ts.map +1 -0
  146. package/dist/src/db/read/currentPropertyRow.d.ts +61 -0
  147. package/dist/src/db/read/currentPropertyRow.d.ts.map +1 -0
  148. package/dist/src/db/read/findSeedRow.d.ts +20 -0
  149. package/dist/src/db/read/findSeedRow.d.ts.map +1 -0
  150. package/dist/src/db/read/findSeedRowsByUid.d.ts +4 -1
  151. package/dist/src/db/read/findSeedRowsByUid.d.ts.map +1 -1
  152. package/dist/src/db/read/getAttesterForSeed.d.ts +1 -1
  153. package/dist/src/db/read/getAttesterForSeed.d.ts.map +1 -1
  154. package/dist/src/db/read/getItemData.d.ts.map +1 -1
  155. package/dist/src/db/read/getItemProperties.d.ts +5 -0
  156. package/dist/src/db/read/getItemProperties.d.ts.map +1 -1
  157. package/dist/src/db/read/getMetadataAttestationUidsForSeedUid.d.ts.map +1 -1
  158. package/dist/src/db/read/getModelSchemas.d.ts +0 -7
  159. package/dist/src/db/read/getModelSchemas.d.ts.map +1 -1
  160. package/dist/src/db/read/getModelsData.d.ts.map +1 -1
  161. package/dist/src/db/read/getPropertyClear.d.ts +5 -1
  162. package/dist/src/db/read/getPropertyClear.d.ts.map +1 -1
  163. package/dist/src/db/read/getPublishPayload.d.ts +35 -40
  164. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  165. package/dist/src/db/read/getPublishPendingDiff.d.ts +2 -2
  166. package/dist/src/db/read/getPublishPendingDiff.d.ts.map +1 -1
  167. package/dist/src/db/read/getPublishUploads.d.ts +59 -28
  168. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  169. package/dist/src/db/read/getSchemaUidForModel.d.ts.map +1 -1
  170. package/dist/src/db/read/getSeedPublishState.d.ts.map +1 -1
  171. package/dist/src/db/read/getSeedPublisher.d.ts.map +1 -1
  172. package/dist/src/db/read/getVersionsForSeedUid.d.ts.map +1 -1
  173. package/dist/src/db/read/isSeedRevoked.d.ts.map +1 -1
  174. package/dist/src/db/read/localModelSchemaLookups.d.ts +8 -0
  175. package/dist/src/db/read/localModelSchemaLookups.d.ts.map +1 -0
  176. package/dist/src/db/read/metadataProperty.d.ts +104 -0
  177. package/dist/src/db/read/metadataProperty.d.ts.map +1 -0
  178. package/dist/src/db/read/publishGraph.d.ts +148 -0
  179. package/dist/src/db/read/publishGraph.d.ts.map +1 -0
  180. package/dist/src/db/read/resolveModelRecord.d.ts +26 -2
  181. package/dist/src/db/read/resolveModelRecord.d.ts.map +1 -1
  182. package/dist/src/db/read/resolveRelatedSeedRef.d.ts +1 -7
  183. package/dist/src/db/read/resolveRelatedSeedRef.d.ts.map +1 -1
  184. package/dist/src/db/read/subqueries/metadataLatest.d.ts +3 -1
  185. package/dist/src/db/read/subqueries/metadataLatest.d.ts.map +1 -1
  186. package/dist/src/db/read/summarizePublishWork.d.ts +13 -5
  187. package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
  188. package/dist/src/db/write/applyPropertyAttestationUidsFromPublish.d.ts +20 -21
  189. package/dist/src/db/write/applyPropertyAttestationUidsFromPublish.d.ts.map +1 -1
  190. package/dist/src/db/write/createMetadata.d.ts.map +1 -1
  191. package/dist/src/db/write/createNewItem.d.ts.map +1 -1
  192. package/dist/src/db/write/createSeeds.d.ts +5 -1
  193. package/dist/src/db/write/createSeeds.d.ts.map +1 -1
  194. package/dist/src/db/write/definitions.d.ts +127 -0
  195. package/dist/src/db/write/definitions.d.ts.map +1 -0
  196. package/dist/src/db/write/mergeChainRows.d.ts +22 -0
  197. package/dist/src/db/write/mergeChainRows.d.ts.map +1 -0
  198. package/dist/src/db/write/saveDefinition.d.ts +29 -0
  199. package/dist/src/db/write/saveDefinition.d.ts.map +1 -0
  200. package/dist/src/db/write/updateSeedUid.d.ts +4 -2
  201. package/dist/src/db/write/updateSeedUid.d.ts.map +1 -1
  202. package/dist/src/db/write/updateVersionUid.d.ts +12 -4
  203. package/dist/src/db/write/updateVersionUid.d.ts.map +1 -1
  204. package/dist/src/db/write/writeModelUids.d.ts +10 -0
  205. package/dist/src/db/write/writeModelUids.d.ts.map +1 -0
  206. package/dist/src/eas.d.ts +8 -6
  207. package/dist/src/eas.d.ts.map +1 -1
  208. package/dist/src/events/files/download.d.ts.map +1 -1
  209. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  210. package/dist/src/helpers/arweaveContentTags.d.ts +1 -1
  211. package/dist/src/helpers/arweaveContentTags.d.ts.map +1 -1
  212. package/dist/src/helpers/compareMetadataRowsLatestFirst.d.ts +18 -3
  213. package/dist/src/helpers/compareMetadataRowsLatestFirst.d.ts.map +1 -1
  214. package/dist/src/helpers/constants.d.ts +5 -2
  215. package/dist/src/helpers/constants.d.ts.map +1 -1
  216. package/dist/src/helpers/dataUrl.d.ts +10 -0
  217. package/dist/src/helpers/dataUrl.d.ts.map +1 -0
  218. package/dist/src/helpers/db.d.ts +54 -105
  219. package/dist/src/helpers/db.d.ts.map +1 -1
  220. package/dist/src/helpers/ensureImageLocal.d.ts.map +1 -1
  221. package/dist/src/helpers/entity/contextUpdate.d.ts +20 -0
  222. package/dist/src/helpers/entity/contextUpdate.d.ts.map +1 -0
  223. package/dist/src/helpers/entity/draftSaveErrors.d.ts +5 -0
  224. package/dist/src/helpers/entity/draftSaveErrors.d.ts.map +1 -1
  225. package/dist/src/helpers/entity/entityCache.d.ts +65 -3
  226. package/dist/src/helpers/entity/entityCache.d.ts.map +1 -1
  227. package/dist/src/helpers/entity/entityCommon.d.ts +0 -22
  228. package/dist/src/helpers/entity/entityCommon.d.ts.map +1 -1
  229. package/dist/src/helpers/entity/entityLifecycle.d.ts +75 -0
  230. package/dist/src/helpers/entity/entityLifecycle.d.ts.map +1 -0
  231. package/dist/src/helpers/entity/entityLiveQuery.d.ts +1 -23
  232. package/dist/src/helpers/entity/entityLiveQuery.d.ts.map +1 -1
  233. package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts +4 -9
  234. package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts.map +1 -1
  235. package/dist/src/helpers/index.d.ts +2 -24
  236. package/dist/src/helpers/index.d.ts.map +1 -1
  237. package/dist/src/helpers/localImageBlobUrl.d.ts +7 -0
  238. package/dist/src/helpers/localImageBlobUrl.d.ts.map +1 -0
  239. package/dist/src/helpers/mediaRef.d.ts +3 -70
  240. package/dist/src/helpers/mediaRef.d.ts.map +1 -1
  241. package/dist/src/helpers/metadataPropertyNames.d.ts +34 -26
  242. package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
  243. package/dist/src/helpers/mimeTypes.d.ts +2 -1
  244. package/dist/src/helpers/mimeTypes.d.ts.map +1 -1
  245. package/dist/src/helpers/model.d.ts.map +1 -1
  246. package/dist/src/helpers/ownership.d.ts.map +1 -1
  247. package/dist/src/helpers/property.d.ts +21 -26
  248. package/dist/src/helpers/property.d.ts.map +1 -1
  249. package/dist/src/helpers/propertyDefinition.d.ts +59 -0
  250. package/dist/src/helpers/propertyDefinition.d.ts.map +1 -0
  251. package/dist/src/helpers/readHtmlBodyForStorageSeed.d.ts.map +1 -1
  252. package/dist/src/helpers/relationSeedRef.d.ts +0 -7
  253. package/dist/src/helpers/relationSeedRef.d.ts.map +1 -1
  254. package/dist/src/helpers/schema.d.ts +24 -38
  255. package/dist/src/helpers/schema.d.ts.map +1 -1
  256. package/dist/src/helpers/schemaApply.d.ts +135 -0
  257. package/dist/src/helpers/schemaApply.d.ts.map +1 -0
  258. package/dist/src/helpers/tabEvents.d.ts.map +1 -1
  259. package/dist/src/helpers/updateSchema.d.ts +2 -18
  260. package/dist/src/helpers/updateSchema.d.ts.map +1 -1
  261. package/dist/src/imports/index.d.ts +1 -1
  262. package/dist/src/imports/index.d.ts.map +1 -1
  263. package/dist/src/imports/json.d.ts +8 -78
  264. package/dist/src/imports/json.d.ts.map +1 -1
  265. package/dist/src/index.d.ts +13 -13
  266. package/dist/src/index.d.ts.map +1 -1
  267. package/dist/src/interfaces/IItem.d.ts +5 -0
  268. package/dist/src/interfaces/IItem.d.ts.map +1 -1
  269. package/dist/src/interfaces/IItemProperty.d.ts +9 -7
  270. package/dist/src/interfaces/IItemProperty.d.ts.map +1 -1
  271. package/dist/src/node/db/Db.d.ts.map +1 -1
  272. package/dist/src/node/index.d.ts +2 -1
  273. package/dist/src/node/index.d.ts.map +1 -1
  274. package/dist/src/outbox/conflicts.d.ts +2 -0
  275. package/dist/src/outbox/conflicts.d.ts.map +1 -1
  276. package/dist/src/outbox/itemAppliers.d.ts +63 -14
  277. package/dist/src/outbox/itemAppliers.d.ts.map +1 -1
  278. package/dist/src/outbox/outbox.d.ts +14 -3
  279. package/dist/src/outbox/outbox.d.ts.map +1 -1
  280. package/dist/src/outbox/pendingValues.d.ts +3 -1
  281. package/dist/src/outbox/pendingValues.d.ts.map +1 -1
  282. package/dist/src/outbox/storageValueRow.d.ts +7 -0
  283. package/dist/src/outbox/storageValueRow.d.ts.map +1 -0
  284. package/dist/src/platform/configurePlatform.d.ts.map +1 -1
  285. package/dist/src/platform/index.browser.d.ts.map +1 -1
  286. package/dist/src/platform/index.node.d.ts.map +1 -1
  287. package/dist/src/seedSchema/ModelSchema.d.ts +19 -0
  288. package/dist/src/seedSchema/ModelSchema.d.ts.map +1 -1
  289. package/dist/src/seedSchema/ModelSchemaSchema.d.ts.map +1 -1
  290. package/dist/src/seedSchema/PendingWriteSchema.d.ts.map +1 -1
  291. package/dist/src/seedSchema/SchemaSchema.d.ts +19 -0
  292. package/dist/src/seedSchema/SchemaSchema.d.ts.map +1 -1
  293. package/dist/src/seedSchema/SeedSchema.d.ts.map +1 -1
  294. package/dist/src/seedSchema/VersionSchema.d.ts.map +1 -1
  295. package/dist/src/seedSchema/attestedUid.d.ts +9 -0
  296. package/dist/src/seedSchema/attestedUid.d.ts.map +1 -0
  297. package/dist/src/storageValue/content.d.ts +45 -0
  298. package/dist/src/storageValue/content.d.ts.map +1 -0
  299. package/dist/src/storageValue/findFile.d.ts +7 -0
  300. package/dist/src/storageValue/findFile.d.ts.map +1 -0
  301. package/dist/src/storageValue/resolve.d.ts +71 -0
  302. package/dist/src/storageValue/resolve.d.ts.map +1 -0
  303. package/dist/src/storageValue/save.d.ts +24 -0
  304. package/dist/src/storageValue/save.d.ts.map +1 -0
  305. package/dist/src/storageValue/stage.d.ts +22 -0
  306. package/dist/src/storageValue/stage.d.ts.map +1 -0
  307. package/dist/src/types/db.d.ts +0 -14
  308. package/dist/src/types/db.d.ts.map +1 -1
  309. package/dist/src/types/index.d.ts +3 -3
  310. package/dist/src/types/index.d.ts.map +1 -1
  311. package/dist/src/types/machines.d.ts +1 -1
  312. package/dist/src/types/machines.d.ts.map +1 -1
  313. package/dist/src/types/property.d.ts +9 -24
  314. package/dist/src/types/property.d.ts.map +1 -1
  315. package/dist/src/types/publish.d.ts +1 -1
  316. package/dist/src/types/publish.d.ts.map +1 -1
  317. package/dist/{syncDbWithEas-BMHoou6X.js → syncDbWithEas-CA7PvBgu.js} +112 -162
  318. package/dist/syncDbWithEas-CA7PvBgu.js.map +1 -0
  319. package/dist/tabEvents-CaVmngqr.js +3804 -0
  320. package/dist/tabEvents-CaVmngqr.js.map +1 -0
  321. package/dist/{tolerantWebAccess-BHndShch.js → tolerantWebAccess-BJqViq08.js} +10 -15
  322. package/dist/{tolerantWebAccess-BHndShch.js.map → tolerantWebAccess-BJqViq08.js.map} +1 -1
  323. package/dist/{resolveModelForSyncedSeed-fIURvYRV.js → updateSeedRevokedAt-BL9Bg-G7.js} +30 -4
  324. package/dist/updateSeedRevokedAt-BL9Bg-G7.js.map +1 -0
  325. package/package.json +6 -6
  326. package/dist/ClientManager-DqL0q_eu.js +0 -5292
  327. package/dist/ClientManager-DqL0q_eu.js.map +0 -1
  328. package/dist/Item-CG5IhPtL.js.map +0 -1
  329. package/dist/ModelProperty-DDD47KVm.js.map +0 -1
  330. package/dist/Schema-BS8oR7QV.js +0 -4370
  331. package/dist/Schema-BS8oR7QV.js.map +0 -1
  332. package/dist/backfillMetadataPropertyIds-C7P7FL6F.js +0 -72
  333. package/dist/backfillMetadataPropertyIds-C7P7FL6F.js.map +0 -1
  334. package/dist/changeFeed-M8sGbOrW.js +0 -726
  335. package/dist/changeFeed-M8sGbOrW.js.map +0 -1
  336. package/dist/configurePlatform-Dukm2QwO.js.map +0 -1
  337. package/dist/dist/ClientManager-DqL0q_eu.d.ts +0 -952
  338. package/dist/dist/ClientManager-DqL0q_eu.d.ts.map +0 -1
  339. package/dist/dist/Item-CG5IhPtL.d.ts +0 -1115
  340. package/dist/dist/Item-CG5IhPtL.d.ts.map +0 -1
  341. package/dist/dist/ModelProperty-DDD47KVm.d.ts +0 -315
  342. package/dist/dist/ModelProperty-DDD47KVm.d.ts.map +0 -1
  343. package/dist/dist/Schema-BS8oR7QV.d.ts +0 -432
  344. package/dist/dist/Schema-BS8oR7QV.d.ts.map +0 -1
  345. package/dist/dist/SchemaValidationService-CZzKNL04.d.ts +0 -118
  346. package/dist/dist/SchemaValidationService-CZzKNL04.d.ts.map +0 -1
  347. package/dist/dist/backfillMetadataPropertyIds-C7P7FL6F.d.ts +0 -7
  348. package/dist/dist/backfillMetadataPropertyIds-C7P7FL6F.d.ts.map +0 -1
  349. package/dist/dist/changeFeed-M8sGbOrW.d.ts +0 -160
  350. package/dist/dist/changeFeed-M8sGbOrW.d.ts.map +0 -1
  351. package/dist/dist/configurePlatform-Dukm2QwO.d.ts.map +0 -1
  352. package/dist/dist/detachRowsBeforeDelete-Di1enVUF.d.ts +0 -13
  353. package/dist/dist/detachRowsBeforeDelete-Di1enVUF.d.ts.map +0 -1
  354. package/dist/dist/eas-B5VJolSj.d.ts +0 -12
  355. package/dist/dist/eas-B5VJolSj.d.ts.map +0 -1
  356. package/dist/dist/errors-C1qUEZ7A.d.ts +0 -25
  357. package/dist/dist/errors-C1qUEZ7A.d.ts.map +0 -1
  358. package/dist/dist/errors-CS3nDpUU.d.ts +0 -515
  359. package/dist/dist/errors-CS3nDpUU.d.ts.map +0 -1
  360. package/dist/dist/eventBus-7vxTCc3a.d.ts +0 -18
  361. package/dist/dist/eventBus-7vxTCc3a.d.ts.map +0 -1
  362. package/dist/dist/findSeedRowsByUid-CuQmK7An.d.ts +0 -13
  363. package/dist/dist/findSeedRowsByUid-CuQmK7An.d.ts.map +0 -1
  364. package/dist/dist/getItem-Uha3_H0t.d.ts +0 -6
  365. package/dist/dist/getItem-Uha3_H0t.d.ts.map +0 -1
  366. package/dist/dist/getPublishPayload-pbin4lk8.d.ts +0 -65
  367. package/dist/dist/getPublishPayload-pbin4lk8.d.ts.map +0 -1
  368. package/dist/dist/getPublishPendingDiff-ByIaPvCn.d.ts +0 -18
  369. package/dist/dist/getPublishPendingDiff-ByIaPvCn.d.ts.map +0 -1
  370. package/dist/dist/getPublishUploads-BBqiowVc.d.ts +0 -89
  371. package/dist/dist/getPublishUploads-BBqiowVc.d.ts.map +0 -1
  372. package/dist/dist/index-DQoyhp2c.d.ts +0 -6
  373. package/dist/dist/index-DQoyhp2c.d.ts.map +0 -1
  374. package/dist/dist/index-njjjo74v.d.ts +0 -14
  375. package/dist/dist/index-njjjo74v.d.ts.map +0 -1
  376. package/dist/dist/index-rOTW-2QZ.d.ts.map +0 -1
  377. package/dist/dist/index.browser-QPWBkLJA.d.ts +0 -9959
  378. package/dist/dist/index.browser-QPWBkLJA.d.ts.map +0 -1
  379. package/dist/dist/mimeTypes-C9r76DCH.d.ts +0 -30
  380. package/dist/dist/mimeTypes-C9r76DCH.d.ts.map +0 -1
  381. package/dist/dist/model-oHA3YhOd.d.ts +0 -6
  382. package/dist/dist/model-oHA3YhOd.d.ts.map +0 -1
  383. package/dist/dist/modelPropertyRecordSchemas-onFOG2x6.d.ts +0 -7
  384. package/dist/dist/modelPropertyRecordSchemas-onFOG2x6.d.ts.map +0 -1
  385. package/dist/dist/platform.browser.d.ts +0 -3
  386. package/dist/dist/platform.browser.d.ts.map +0 -1
  387. package/dist/dist/property-C85DCD7K.d.ts +0 -37
  388. package/dist/dist/property-C85DCD7K.d.ts.map +0 -1
  389. package/dist/dist/propertyValidationRules-CjUPOFeu.d.ts +0 -13
  390. package/dist/dist/propertyValidationRules-CjUPOFeu.d.ts.map +0 -1
  391. package/dist/dist/publishDraftGraph-DBWAN72w.d.ts +0 -93
  392. package/dist/dist/publishDraftGraph-DBWAN72w.d.ts.map +0 -1
  393. package/dist/dist/resolveModelForSyncedSeed-fIURvYRV.d.ts +0 -21
  394. package/dist/dist/resolveModelForSyncedSeed-fIURvYRV.d.ts.map +0 -1
  395. package/dist/dist/syncDbWithEas-BMHoou6X.d.ts +0 -13
  396. package/dist/dist/syncDbWithEas-BMHoou6X.d.ts.map +0 -1
  397. package/dist/dist/tolerantWebAccess-BHndShch.d.ts +0 -113
  398. package/dist/dist/tolerantWebAccess-BHndShch.d.ts.map +0 -1
  399. package/dist/dist/updateSeedRevokedAt-DpfG6ztE.d.ts +0 -11
  400. package/dist/dist/updateSeedRevokedAt-DpfG6ztE.d.ts.map +0 -1
  401. package/dist/eas-B5VJolSj.js +0 -67
  402. package/dist/eas-B5VJolSj.js.map +0 -1
  403. package/dist/errors-CS3nDpUU.js +0 -4006
  404. package/dist/errors-CS3nDpUU.js.map +0 -1
  405. package/dist/eventBus-7vxTCc3a.js +0 -64
  406. package/dist/eventBus-7vxTCc3a.js.map +0 -1
  407. package/dist/findSeedRowsByUid-CuQmK7An.js +0 -47
  408. package/dist/findSeedRowsByUid-CuQmK7An.js.map +0 -1
  409. package/dist/getItem-Uha3_H0t.js +0 -45
  410. package/dist/getItem-Uha3_H0t.js.map +0 -1
  411. package/dist/getPublishPayload-pbin4lk8.js +0 -1736
  412. package/dist/getPublishPayload-pbin4lk8.js.map +0 -1
  413. package/dist/getPublishPendingDiff-ByIaPvCn.js +0 -118
  414. package/dist/getPublishPendingDiff-ByIaPvCn.js.map +0 -1
  415. package/dist/getPublishUploads-BBqiowVc.js +0 -1080
  416. package/dist/getPublishUploads-BBqiowVc.js.map +0 -1
  417. package/dist/index-DQoyhp2c.js.map +0 -1
  418. package/dist/index-DxHpPNfn.js.map +0 -1
  419. package/dist/index-njjjo74v.js +0 -29
  420. package/dist/index-njjjo74v.js.map +0 -1
  421. package/dist/index-rOTW-2QZ.js +0 -4760
  422. package/dist/index-rOTW-2QZ.js.map +0 -1
  423. package/dist/index.browser-QPWBkLJA.js.map +0 -1
  424. package/dist/index.node-WsEJCOwC.js.map +0 -1
  425. package/dist/mimeTypes-C9r76DCH.js +0 -209
  426. package/dist/mimeTypes-C9r76DCH.js.map +0 -1
  427. package/dist/model-oHA3YhOd.js +0 -29
  428. package/dist/model-oHA3YhOd.js.map +0 -1
  429. package/dist/modelPropertyRecordSchemas-onFOG2x6.js +0 -94
  430. package/dist/modelPropertyRecordSchemas-onFOG2x6.js.map +0 -1
  431. package/dist/property-C85DCD7K.js +0 -289
  432. package/dist/property-C85DCD7K.js.map +0 -1
  433. package/dist/propertyValidationRules-CjUPOFeu.js +0 -73
  434. package/dist/propertyValidationRules-CjUPOFeu.js.map +0 -1
  435. package/dist/publishDraftGraph-DBWAN72w.js +0 -505
  436. package/dist/publishDraftGraph-DBWAN72w.js.map +0 -1
  437. package/dist/resolveModelForSyncedSeed-fIURvYRV.js.map +0 -1
  438. package/dist/src/Item/service/actors/loadOrCreateItem.d.ts +0 -5
  439. package/dist/src/Item/service/actors/loadOrCreateItem.d.ts.map +0 -1
  440. package/dist/src/Item/service/actors/waitForDb.d.ts +0 -4
  441. package/dist/src/Item/service/actors/waitForDb.d.ts.map +0 -1
  442. package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts +0 -5
  443. package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +0 -1
  444. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts +0 -5
  445. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +0 -1
  446. package/dist/src/ItemProperty/service/actors/saveValueToDb/index.d.ts +0 -6
  447. package/dist/src/ItemProperty/service/actors/saveValueToDb/index.d.ts.map +0 -1
  448. package/dist/src/ItemProperty/service/actors/saveValueToDb/rowContext.d.ts.map +0 -1
  449. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.d.ts +0 -24
  450. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.d.ts.map +0 -1
  451. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveHtml.d.ts +0 -5
  452. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveHtml.d.ts.map +0 -1
  453. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts +0 -5
  454. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +0 -1
  455. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts +0 -10
  456. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +0 -1
  457. package/dist/src/ItemProperty/service/actors/saveValueToDb/storageValue.d.ts +0 -22
  458. package/dist/src/ItemProperty/service/actors/saveValueToDb/storageValue.d.ts.map +0 -1
  459. package/dist/src/ItemProperty/service/actors/waitForDb.d.ts +0 -4
  460. package/dist/src/ItemProperty/service/actors/waitForDb.d.ts.map +0 -1
  461. package/dist/src/Model/service/actors/createModelProperties.d.ts +0 -9
  462. package/dist/src/Model/service/actors/createModelProperties.d.ts.map +0 -1
  463. package/dist/src/Model/service/actors/loadOrCreateModel.d.ts +0 -5
  464. package/dist/src/Model/service/actors/loadOrCreateModel.d.ts.map +0 -1
  465. package/dist/src/Schema/service/actors/checkExistingSchema.d.ts +0 -5
  466. package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +0 -1
  467. package/dist/src/Schema/service/actors/createModelInstances.d.ts +0 -11
  468. package/dist/src/Schema/service/actors/createModelInstances.d.ts.map +0 -1
  469. package/dist/src/Schema/service/actors/createPropertyInstances.d.ts +0 -12
  470. package/dist/src/Schema/service/actors/createPropertyInstances.d.ts.map +0 -1
  471. package/dist/src/Schema/service/actors/validateSchema.d.ts +0 -5
  472. package/dist/src/Schema/service/actors/validateSchema.d.ts.map +0 -1
  473. package/dist/src/Schema/service/actors/verifyModelInstancesInCache.d.ts +0 -6
  474. package/dist/src/Schema/service/actors/verifyModelInstancesInCache.d.ts.map +0 -1
  475. package/dist/src/Schema/service/actors/verifyModelsInDb.d.ts +0 -7
  476. package/dist/src/Schema/service/actors/verifyModelsInDb.d.ts.map +0 -1
  477. package/dist/src/Schema/service/actors/verifyPropertiesInDb.d.ts +0 -8
  478. package/dist/src/Schema/service/actors/verifyPropertiesInDb.d.ts.map +0 -1
  479. package/dist/src/Schema/service/actors/verifyPropertyInstancesInCache.d.ts +0 -6
  480. package/dist/src/Schema/service/actors/verifyPropertyInstancesInCache.d.ts.map +0 -1
  481. package/dist/src/Schema/service/actors/verifySchemaInDb.d.ts +0 -7
  482. package/dist/src/Schema/service/actors/verifySchemaInDb.d.ts.map +0 -1
  483. package/dist/src/Schema/service/actors/writeModelsToDb.d.ts +0 -9
  484. package/dist/src/Schema/service/actors/writeModelsToDb.d.ts.map +0 -1
  485. package/dist/src/Schema/service/actors/writePropertiesToDb.d.ts +0 -10
  486. package/dist/src/Schema/service/actors/writePropertiesToDb.d.ts.map +0 -1
  487. package/dist/src/Schema/service/actors/writeSchemaToDb.d.ts +0 -11
  488. package/dist/src/Schema/service/actors/writeSchemaToDb.d.ts.map +0 -1
  489. package/dist/src/browser/helpers/ArweaveClient.d.ts +0 -14
  490. package/dist/src/browser/helpers/ArweaveClient.d.ts.map +0 -1
  491. package/dist/src/browser/helpers/EasClient.d.ts +0 -10
  492. package/dist/src/browser/helpers/EasClient.d.ts.map +0 -1
  493. package/dist/src/browser/helpers/QueryClient.d.ts +0 -9
  494. package/dist/src/browser/helpers/QueryClient.d.ts.map +0 -1
  495. package/dist/src/client/actors/addModelsToStore.d.ts +0 -4
  496. package/dist/src/client/actors/addModelsToStore.d.ts.map +0 -1
  497. package/dist/src/db/backfillMetadataPropertyIds.d.ts +0 -7
  498. package/dist/src/db/backfillMetadataPropertyIds.d.ts.map +0 -1
  499. package/dist/src/db/read/getItem.d.ts +0 -3
  500. package/dist/src/db/read/getItem.d.ts.map +0 -1
  501. package/dist/src/db/read/getPropertyData.d.ts +0 -4
  502. package/dist/src/db/read/getPropertyData.d.ts.map +0 -1
  503. package/dist/src/db/read/getRelatedItemsForPublish.d.ts +0 -10
  504. package/dist/src/db/read/getRelatedItemsForPublish.d.ts.map +0 -1
  505. package/dist/src/db/read/getSeedData.d.ts +0 -12
  506. package/dist/src/db/read/getSeedData.d.ts.map +0 -1
  507. package/dist/src/db/read/itemLoads.d.ts +0 -20
  508. package/dist/src/db/read/itemLoads.d.ts.map +0 -1
  509. package/dist/src/db/read/publishDraftGraph.d.ts +0 -64
  510. package/dist/src/db/read/publishDraftGraph.d.ts.map +0 -1
  511. package/dist/src/db/write/linkModelToSchema.d.ts +0 -12
  512. package/dist/src/db/write/linkModelToSchema.d.ts.map +0 -1
  513. package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts +0 -2
  514. package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts.map +0 -1
  515. package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts +0 -2
  516. package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts.map +0 -1
  517. package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts +0 -2
  518. package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts.map +0 -1
  519. package/dist/src/helpers/ArweaveClient/uploadApiVerification.d.ts +0 -2
  520. package/dist/src/helpers/ArweaveClient/uploadApiVerification.d.ts.map +0 -1
  521. package/dist/src/helpers/EasClient/BaseEasClient.d.ts +0 -2
  522. package/dist/src/helpers/EasClient/BaseEasClient.d.ts.map +0 -1
  523. package/dist/src/helpers/QueryClient/BaseQueryClient.d.ts +0 -2
  524. package/dist/src/helpers/QueryClient/BaseQueryClient.d.ts.map +0 -1
  525. package/dist/src/helpers/easUid.d.ts +0 -2
  526. package/dist/src/helpers/easUid.d.ts.map +0 -1
  527. package/dist/src/helpers/entity/entityDestroy.d.ts +0 -49
  528. package/dist/src/helpers/entity/entityDestroy.d.ts.map +0 -1
  529. package/dist/src/helpers/entity/entityFind.d.ts +0 -52
  530. package/dist/src/helpers/entity/entityFind.d.ts.map +0 -1
  531. package/dist/src/helpers/entity/entityState.d.ts +0 -28
  532. package/dist/src/helpers/entity/entityState.d.ts.map +0 -1
  533. package/dist/src/helpers/entity/entityUnload.d.ts +0 -56
  534. package/dist/src/helpers/entity/entityUnload.d.ts.map +0 -1
  535. package/dist/src/helpers/entity/evictionEpoch.d.ts +0 -43
  536. package/dist/src/helpers/entity/evictionEpoch.d.ts.map +0 -1
  537. package/dist/src/helpers/entity/index.d.ts +0 -12
  538. package/dist/src/helpers/entity/index.d.ts.map +0 -1
  539. package/dist/src/helpers/gateway/gatewayState.d.ts +0 -2
  540. package/dist/src/helpers/gateway/gatewayState.d.ts.map +0 -1
  541. package/dist/src/helpers/gateway/resolveSeedGatewayEndpoints.d.ts +0 -2
  542. package/dist/src/helpers/gateway/resolveSeedGatewayEndpoints.d.ts.map +0 -1
  543. package/dist/src/helpers/gateway/seedGatewayConfig.d.ts +0 -2
  544. package/dist/src/helpers/gateway/seedGatewayConfig.d.ts.map +0 -1
  545. package/dist/src/helpers/getSchemaForItemProperty.d.ts +0 -15
  546. package/dist/src/helpers/getSchemaForItemProperty.d.ts.map +0 -1
  547. package/dist/src/helpers/getSegmentedItemProperties.d.ts +0 -10
  548. package/dist/src/helpers/getSegmentedItemProperties.d.ts.map +0 -1
  549. package/dist/src/helpers/isSqliteUniqueConstraintError.d.ts +0 -7
  550. package/dist/src/helpers/isSqliteUniqueConstraintError.d.ts.map +0 -1
  551. package/dist/src/helpers/propertyValidationRules.d.ts +0 -20
  552. package/dist/src/helpers/propertyValidationRules.d.ts.map +0 -1
  553. package/dist/src/helpers/propertyWriteTickets.d.ts +0 -11
  554. package/dist/src/helpers/propertyWriteTickets.d.ts.map +0 -1
  555. package/dist/src/helpers/reconcilePropertyDraftRows.d.ts +0 -10
  556. package/dist/src/helpers/reconcilePropertyDraftRows.d.ts.map +0 -1
  557. package/dist/src/helpers/waitForEntityIdle.d.ts +0 -21
  558. package/dist/src/helpers/waitForEntityIdle.d.ts.map +0 -1
  559. package/dist/src/interfaces/IQueryClient.d.ts +0 -15
  560. package/dist/src/interfaces/IQueryClient.d.ts.map +0 -1
  561. package/dist/src/node/helpers/ArweaveClient.d.ts +0 -5
  562. package/dist/src/node/helpers/ArweaveClient.d.ts.map +0 -1
  563. package/dist/src/node/helpers/EasClient.d.ts +0 -5
  564. package/dist/src/node/helpers/EasClient.d.ts.map +0 -1
  565. package/dist/src/node/helpers/QueryClient.d.ts +0 -5
  566. package/dist/src/node/helpers/QueryClient.d.ts.map +0 -1
  567. package/dist/src/services/write/actors/validateEntity.d.ts +0 -6
  568. package/dist/src/services/write/actors/validateEntity.d.ts.map +0 -1
  569. package/dist/src/services/write/actors/writeToDatabase.d.ts +0 -14
  570. package/dist/src/services/write/actors/writeToDatabase.d.ts.map +0 -1
  571. package/dist/src/services/write/writeProcessMachine.d.ts +0 -56
  572. package/dist/src/services/write/writeProcessMachine.d.ts.map +0 -1
  573. package/dist/src/stores/eas.d.ts +0 -2
  574. package/dist/src/stores/eas.d.ts.map +0 -1
  575. package/dist/src/types/arweave.d.ts +0 -57
  576. package/dist/src/types/arweave.d.ts.map +0 -1
  577. package/dist/src/types/gateway.d.ts +0 -2
  578. package/dist/src/types/gateway.d.ts.map +0 -1
  579. package/dist/syncDbWithEas-BMHoou6X.js.map +0 -1
  580. package/dist/updateSeedRevokedAt-DpfG6ztE.js +0 -31
  581. package/dist/updateSeedRevokedAt-DpfG6ztE.js.map +0 -1
@@ -0,0 +1,650 @@
1
+ import debug from 'debug';
2
+ import { sqliteTable, text, integer, unique, int, index, uniqueIndex, blob } from 'drizzle-orm/sqlite-core';
3
+ import { relations, sql } from 'drizzle-orm';
4
+
5
+ const logger = debug('seedSdk:browser:db:sqliteBusyRetry');
6
+ /** Waits between attempts; about 1 s in total. */
7
+ const SQLITE_BUSY_RETRY_DELAYS_MS = [25, 75, 150, 300, 450];
8
+ /**
9
+ * Another connection (usually another tab) holds the database lock. SQLite reports this as
10
+ * SQLITE_BUSY ("database is locked") or SQLITE_LOCKED ("database table is locked").
11
+ */
12
+ function isSqliteBusyError(error) {
13
+ // Drizzle wraps a driver's error ("Failed query: ...") and keeps it as `cause`
14
+ for (let current = error, depth = 0; current != null && depth < 5; depth++) {
15
+ const message = current instanceof Error ? current.message : String(current);
16
+ if (/SQLITE_BUSY|SQLITE_LOCKED|database (table )?is locked/i.test(message))
17
+ return true;
18
+ current = current.cause;
19
+ }
20
+ return false;
21
+ }
22
+ /**
23
+ * Retries a statement another tab's lock rejected. Safe for the SDK's writes because each is a
24
+ * single autocommit statement: one that failed with SQLITE_BUSY didn't apply. Don't use this for
25
+ * statements inside a transaction, where a retry would replay part of it.
26
+ */
27
+ function withSqliteBusyRetry(driver, delaysMs = SQLITE_BUSY_RETRY_DELAYS_MS) {
28
+ return async (...args) => {
29
+ for (let attempt = 0;; attempt++) {
30
+ try {
31
+ return await driver(...args);
32
+ }
33
+ catch (error) {
34
+ if (!isSqliteBusyError(error) || attempt >= delaysMs.length)
35
+ throw error;
36
+ logger(`database busy (attempt ${attempt + 1}); retrying`);
37
+ await new Promise((resolve) => setTimeout(resolve, delaysMs[attempt]));
38
+ }
39
+ }
40
+ };
41
+ }
42
+
43
+ class BaseDb {
44
+ static configure(impl) {
45
+ if (!impl) {
46
+ throw new Error('Cannot configure Db with undefined or null. Ensure the platform-specific Db is properly created.');
47
+ }
48
+ BaseDb._impl = impl;
49
+ }
50
+ static requireImpl() {
51
+ if (!BaseDb._impl) {
52
+ throw new Error('Db not configured. Call BaseDb.configure() during platform init.');
53
+ }
54
+ return BaseDb._impl;
55
+ }
56
+ static getAppDb() {
57
+ return BaseDb.requireImpl().getAppDb();
58
+ }
59
+ static prepareDb(filesDir, config) {
60
+ return BaseDb.requireImpl().prepareDb(filesDir, config);
61
+ }
62
+ static isAppDbReady() {
63
+ if (!BaseDb._impl) {
64
+ return false;
65
+ }
66
+ return BaseDb._impl.isAppDbReady();
67
+ }
68
+ static connectToDb(pathToDir) {
69
+ return BaseDb.requireImpl().connectToDb(pathToDir);
70
+ }
71
+ static async migrate(pathToDbDir, dbName, dbId) {
72
+ return BaseDb.requireImpl().migrate(pathToDbDir, dbName, dbId);
73
+ }
74
+ /**
75
+ * Execute a reactive query that emits new results whenever the underlying data changes.
76
+ *
77
+ * Supports two usage patterns:
78
+ * 1. SQL tag function (browser only): liveQuery((sql) => sql`SELECT * FROM models`)
79
+ * 2. Drizzle query builder: liveQuery(db.select().from(models))
80
+ *
81
+ * On Node only the query builder works (a tag function throws), and it is re-run every second;
82
+ * the observable emits when the result changes.
83
+ */
84
+ static liveQuery(query) {
85
+ return BaseDb.requireImpl().liveQuery(query);
86
+ }
87
+ /**
88
+ * Runs `fn` in one transaction: every query it runs on `tx` (a Drizzle database, used like
89
+ * `getAppDb()`) commits together, or none does when `fn` throws. Queries on `getAppDb()` inside
90
+ * `fn` are not part of the transaction, and in the browser they wait for it to end, so don't
91
+ * call `getAppDb()` or `BaseDb.transaction` from `fn`.
92
+ *
93
+ * When another connection (another tab) holds the database lock, the whole transaction is
94
+ * retried, so `fn` must have no side effects outside `tx`.
95
+ */
96
+ static async transaction(fn) {
97
+ const impl = BaseDb.requireImpl();
98
+ for (let attempt = 0;; attempt++) {
99
+ try {
100
+ return await impl.transaction(fn);
101
+ }
102
+ catch (error) {
103
+ if (!isSqliteBusyError(error) || attempt >= SQLITE_BUSY_RETRY_DELAYS_MS.length)
104
+ throw error;
105
+ await new Promise((resolve) => setTimeout(resolve, SQLITE_BUSY_RETRY_DELAYS_MS[attempt]));
106
+ }
107
+ }
108
+ }
109
+ }
110
+ BaseDb._impl = null;
111
+
112
+ const models = sqliteTable('models', {
113
+ id: integer('id').primaryKey({ autoIncrement: true }),
114
+ name: text('name').notNull(),
115
+ schemaFileId: text('schema_file_id'), // ID from JSON file for change tracking - must be unique
116
+ isEdited: integer('is_edited', { mode: 'boolean' }), // true if model has been edited locally, false if matches schema file
117
+ }, (table) => {
118
+ return {
119
+ uniqueSchemaFileId: unique('unique_schema_file_id').on(table.schemaFileId),
120
+ };
121
+ });
122
+ const modelsRelations = relations(models, ({ many }) => ({
123
+ properties: many(properties),
124
+ }));
125
+ const properties = sqliteTable('properties', {
126
+ id: integer('id').primaryKey({ autoIncrement: true }),
127
+ name: text('name').notNull(),
128
+ dataType: text('data_type').notNull(),
129
+ modelId: integer('model_id')
130
+ .notNull()
131
+ .references(() => models.id),
132
+ refModelId: integer('ref_model_id').references(() => models.id),
133
+ refValueType: text('ref_value_type'),
134
+ schemaFileId: text('schema_file_id'), // ID from JSON file for change tracking
135
+ isEdited: integer('is_edited', { mode: 'boolean' }), // true if property has been edited locally, false if matches schema file
136
+ required: integer('required', { mode: 'boolean' }), // true if relation/image property is required (publish fails when related item not found)
137
+ // Storage settings from the schema file's `storage: { type, path, extension }`, in the internal
138
+ // shape ModelProperty uses. Null when the property has no storage config.
139
+ storageType: text('storage_type'), // 'ItemStorage' | 'PropertyStorage'
140
+ localStorageDir: text('local_storage_dir'), // storage.path, e.g. '/html'
141
+ filenameSuffix: text('filename_suffix'), // storage.extension, e.g. '.html'
142
+ // The whole definition as JSON: the schema file's property object, or a code-defined one
143
+ // (validation, htmlEmbeddedDataUriPolicy, description and any other field). The columns above
144
+ // win for the fields they hold. Read through helpers/propertyDefinition.
145
+ definition: text('definition'),
146
+ }, (table) => {
147
+ return {
148
+ uniqueNameModelId: unique('unique_name_model_id').on(table.name, table.modelId),
149
+ uniqueSchemaFileId: unique('unique_property_schema_file_id').on(table.schemaFileId),
150
+ };
151
+ });
152
+ const propertiesRelations = relations(properties, ({ one }) => ({
153
+ model: one(models),
154
+ refModel: one(models),
155
+ }));
156
+
157
+ /**
158
+ * True for a stored attestation uid, false for the placeholders a draft row holds (NULL, '',
159
+ * 'NULL', ZERO_BYTES32; see `isPlaceholderUid` in @seedprotocol/eas). The predicate of the partial
160
+ * unique indexes on `seeds.uid` and `versions.uid`.
161
+ */
162
+ const attestedUidSql = (column) => sql `${column} IS NOT NULL AND trim(${column}) NOT IN ('', 'NULL') AND lower(trim(${column})) != '0x0000000000000000000000000000000000000000000000000000000000000000'`;
163
+
164
+ const seeds = sqliteTable('seeds', {
165
+ localId: text('local_id').unique(),
166
+ uid: text('uid'),
167
+ schemaUid: text('schema_uid'),
168
+ type: text('type'),
169
+ // schemaFileId of the models row this item belongs to (= Model.id). Disambiguates items whose
170
+ // model name exists in more than one schema; null for legacy rows that couldn't be backfilled.
171
+ modelFileId: text('model_file_id'),
172
+ publisher: text('publisher'),
173
+ attestationRaw: text('attestation_raw'),
174
+ attestationCreatedAt: int('attestation_created_at'),
175
+ // Set on insert when the writer leaves it out. No $onUpdate: readers rank rows by
176
+ // COALESCE(attestation_created_at, created_at), and some writers move it on purpose.
177
+ createdAt: int('created_at').$defaultFn(() => Date.now()),
178
+ // Set on every insert and update unless the writer passes a value.
179
+ updatedAt: int('updated_at')
180
+ .$defaultFn(() => Date.now())
181
+ .$onUpdate(() => Date.now()),
182
+ _markedForDeletion: int('_marked_for_deletion'),
183
+ revokedAt: int('revoked_at'),
184
+ }, (table) => [
185
+ index('seeds_uid_idx').on(table.uid),
186
+ index('seeds_type_idx').on(table.type),
187
+ // One row per attested seed uid (migration 0029). Drafts hold a placeholder uid and are left out.
188
+ uniqueIndex('seeds_attested_uid_unique').on(table.uid).where(attestedUidSql(table.uid)),
189
+ ]);
190
+
191
+ const versions = sqliteTable('versions', {
192
+ localId: text('local_id').unique(),
193
+ uid: text('uid'),
194
+ seedLocalId: text('seed_local_id'),
195
+ seedUid: text('seed_uid'),
196
+ seedType: text('seed_type'),
197
+ note: text('note'),
198
+ // Set on insert when the writer leaves it out. No $onUpdate: readers rank rows by
199
+ // COALESCE(attestation_created_at, created_at), and some writers move it on purpose.
200
+ createdAt: int('created_at').$defaultFn(() => Date.now()),
201
+ // Set on every insert and update unless the writer passes a value.
202
+ updatedAt: int('updated_at')
203
+ .$defaultFn(() => Date.now())
204
+ .$onUpdate(() => Date.now()),
205
+ attestationCreatedAt: int('attestation_created_at'),
206
+ attestationRaw: text('attestation_raw'),
207
+ publisher: text('publisher'),
208
+ /**
209
+ * When the version attestation was revoked, in Unix seconds (EAS `revocationTime`, or the local
210
+ * unpublish time until sync confirms it). Null while live or unpublished.
211
+ */
212
+ revokedAt: int('revoked_at'),
213
+ }, (table) => [
214
+ index('versions_seed_local_id_idx').on(table.seedLocalId),
215
+ // One row per attested version uid (migration 0029). Drafts hold a placeholder uid and are left out.
216
+ uniqueIndex('versions_attested_uid_unique').on(table.uid).where(attestedUidSql(table.uid)),
217
+ ]);
218
+
219
+ const metadata = sqliteTable('metadata', {
220
+ localId: text('local_id').unique(),
221
+ uid: text('uid'),
222
+ propertyId: integer('property_id').references(() => properties.id),
223
+ propertyName: text('property_name'),
224
+ propertyValue: text('property_value'),
225
+ schemaUid: text('schema_uid'),
226
+ modelType: text('model_type'),
227
+ seedLocalId: text('seed_local_id'),
228
+ seedUid: text('seed_uid'),
229
+ versionLocalId: text('version_local_id'),
230
+ versionUid: text('version_uid'),
231
+ easDataType: text('eas_data_type'),
232
+ refValueType: text('ref_value_type'),
233
+ refModelUid: text('ref_schema_uid'),
234
+ refSeedType: text('ref_seed_type'),
235
+ refResolvedValue: text('ref_resolved_value'),
236
+ refResolvedDisplayValue: text('ref_resolved_display_value'),
237
+ localStorageDir: text('local_storage_dir'),
238
+ attestationRaw: text('attestation_raw'),
239
+ attestationCreatedAt: int('attestation_created_at'),
240
+ contentHash: text('content_hash'),
241
+ // Set on insert when the writer leaves it out. No $onUpdate: readers rank rows by
242
+ // COALESCE(attestation_created_at, created_at), and some writers move it on purpose.
243
+ createdAt: int('created_at').$defaultFn(() => Date.now()),
244
+ // Set on every insert and update unless the writer passes a value.
245
+ updatedAt: int('updated_at')
246
+ .$defaultFn(() => Date.now())
247
+ .$onUpdate(() => Date.now()),
248
+ publisher: text('publisher'),
249
+ // Unix seconds when this row's attestation was revoked on EAS; null while it's live (or for a
250
+ // local, unpublished row). EAS sync keeps only the canonical attestation per (version, property
251
+ // schema): the newest live one, or the newest revoked one when all are revoked. So a non-null
252
+ // value marks a property kept only for its last value, not one that is present on the version.
253
+ revokedAt: int('revoked_at'),
254
+ // For a row EAS sync derived for an ItemStorage property from a `storage_transaction_id`
255
+ // attestation (uid null, ref_value_type 'file', value = the transaction id): that attestation's
256
+ // uid. Null for every other row. Marks the row as published content, not a local draft.
257
+ derivedFromUid: text('derived_from_uid'),
258
+ // On a cleared local row (null value): publish revokes the property's attestations instead of
259
+ // attesting the empty value (ADR 0021). Null on every other row.
260
+ retract: int('retract', { mode: 'boolean' }),
261
+ }, (table) => [
262
+ index('metadata_seed_local_id_property_name_idx').on(table.seedLocalId, table.propertyName),
263
+ index('metadata_seed_uid_idx').on(table.seedUid),
264
+ ]);
265
+
266
+ const appState = sqliteTable('appState', {
267
+ key: text('key').unique(),
268
+ value: text('value'),
269
+ createdAt: int('created_at'),
270
+ updatedAt: int('updated_at'),
271
+ });
272
+
273
+ const modelUids = sqliteTable('model_uids', {
274
+ id: int('id').primaryKey({ autoIncrement: true }),
275
+ uid: text('uid').notNull(),
276
+ modelId: int('model_id')
277
+ .notNull()
278
+ .unique()
279
+ .references(() => models.id),
280
+ });
281
+ const modelRelations = relations(modelUids, ({ one }) => ({
282
+ model: one(models),
283
+ }));
284
+
285
+ const propertyUids = sqliteTable('property_uids', {
286
+ id: int('id').primaryKey({ autoIncrement: true }),
287
+ uid: text('uid').notNull(),
288
+ propertyId: int('property_id')
289
+ .notNull()
290
+ .unique()
291
+ .references(() => properties.id),
292
+ });
293
+ const propertyUidRelations = relations(propertyUids, ({ one }) => ({
294
+ property: one(properties),
295
+ }));
296
+
297
+ const config = sqliteTable('config', {
298
+ id: integer('id').primaryKey({ autoIncrement: true }),
299
+ key: text('key').notNull(),
300
+ text: text('text'),
301
+ json: text('json'),
302
+ blob: blob('blob'),
303
+ });
304
+
305
+ const schemas = sqliteTable('schemas', {
306
+ id: integer('id').primaryKey({ autoIncrement: true }),
307
+ name: text('name').notNull(),
308
+ version: integer('version').notNull(),
309
+ schemaFileId: text('schema_file_id'), // ID from JSON file for change tracking - must be unique
310
+ schemaData: text('schema_data'), // Full JSON schema content (SchemaFileFormat as JSON string)
311
+ isDraft: integer('is_draft', { mode: 'boolean' }), // true if schema is in draft/editing state, false if published to file
312
+ isEdited: integer('is_edited', { mode: 'boolean' }), // true if schema has been edited locally, false if matches schema file
313
+ // Hash of the schema file applySchemaFile last wrote to the rows (with schema_file_id and
314
+ // version): a file with the same three is not applied again.
315
+ contentHash: text('content_hash'),
316
+ createdAt: int('created_at'),
317
+ updatedAt: int('updated_at'),
318
+ }, (table) => {
319
+ return {
320
+ uniqueSchemaFileId: unique('unique_schema_schema_file_id').on(table.schemaFileId),
321
+ };
322
+ });
323
+
324
+ var SchemaSchema = /*#__PURE__*/Object.freeze({
325
+ __proto__: null,
326
+ schemas: schemas
327
+ });
328
+
329
+ const modelSchemas = sqliteTable('model_schemas', {
330
+ id: integer('id').primaryKey({ autoIncrement: true }),
331
+ modelId: integer('model_id').references(() => models.id),
332
+ schemaId: integer('schema_id').references(() => schemas.id),
333
+ }, (table) => [
334
+ // One link per model and schema (migration 0029)
335
+ unique('model_schemas_model_id_schema_id_unique').on(table.modelId, table.schemaId),
336
+ ]);
337
+
338
+ var ModelSchemaSchema = /*#__PURE__*/Object.freeze({
339
+ __proto__: null,
340
+ modelSchemas: modelSchemas
341
+ });
342
+
343
+ const publishProcesses = sqliteTable('publish_processes', {
344
+ id: int('id').primaryKey({ autoIncrement: true }),
345
+ seedLocalId: text('seed_local_id').notNull(),
346
+ modelName: text('model_name').notNull(),
347
+ schemaId: text('schema_id'),
348
+ status: text('status').notNull(), // 'in_progress' | 'completed' | 'failed' | 'interrupted'
349
+ startedAt: int('started_at').notNull(),
350
+ completedAt: int('completed_at'),
351
+ errorMessage: text('error_message'),
352
+ errorStep: text('error_step'),
353
+ errorDetails: text('error_details'),
354
+ errorCode: text('error_code'), // e.g. ManagedAccountPublishError.code
355
+ persistedSnapshot: text('persisted_snapshot').notNull(),
356
+ seedId: text('seed_id'),
357
+ existingSeedUid: text('existing_seed_uid'),
358
+ createdAt: int('created_at'),
359
+ updatedAt: int('updated_at'),
360
+ });
361
+
362
+ const uploadProcesses = sqliteTable('upload_processes', {
363
+ id: int('id').primaryKey({ autoIncrement: true }),
364
+ reimbursementConfirmed: int('reimbursement_confirmed').notNull(), // 0 or 1 for boolean
365
+ reimbursementTransactionId: text('reimbursement_transaction_id'),
366
+ transactionKeys: text('transaction_keys'),
367
+ persistedSnapshot: text('persisted_snapshot').notNull(), // JSON string
368
+ createdAt: int('created_at'),
369
+ updatedAt: int('updated_at'),
370
+ });
371
+
372
+ /** Background job: resolve L1 tx id and wait for L1 confirmation after bundler publish. */
373
+ const arweaveL1FinalizeJobs = sqliteTable('arweave_l1_finalize_jobs', {
374
+ id: int('id').primaryKey({ autoIncrement: true }),
375
+ seedLocalId: text('seed_local_id').notNull(),
376
+ dataItemId: text('data_item_id').notNull(),
377
+ /** L1 bundle / anchor transaction id from gateway GraphQL `bundledIn.id`. */
378
+ l1TransactionId: text('l1_transaction_id'),
379
+ bundleId: text('bundle_id'),
380
+ versionLocalId: text('version_local_id'),
381
+ itemPropertyName: text('item_property_name'),
382
+ /** `pending_l1` | `confirmed` | `failed` */
383
+ phase: text('phase').notNull(),
384
+ statusJson: text('status_json'),
385
+ errorMessage: text('error_message'),
386
+ createdAt: int('created_at').notNull(),
387
+ updatedAt: int('updated_at').notNull(),
388
+ }, (table) => ({
389
+ dataItemIdUnique: uniqueIndex('arweave_l1_finalize_jobs_data_item_id_unique').on(table.dataItemId),
390
+ }));
391
+
392
+ const easSyncProcesses = sqliteTable('eas_sync_processes', {
393
+ id: int('id').primaryKey({ autoIncrement: true }),
394
+ status: text('status').notNull(), // 'in_progress' | 'completed' | 'failed'
395
+ startedAt: int('started_at').notNull(),
396
+ completedAt: int('completed_at'),
397
+ requestPayload: text('request_payload').notNull(),
398
+ errorMessage: text('error_message'),
399
+ errorDetails: text('error_details'),
400
+ persistedSnapshot: text('persisted_snapshot').notNull(),
401
+ createdAt: int('created_at'),
402
+ updatedAt: int('updated_at'),
403
+ });
404
+
405
+ /**
406
+ * Links Image seeds materialized from Html `data:image/*` URIs to the parent Item seed for co-publish.
407
+ * Rows are removed after a successful publish (see clearHtmlEmbeddedImageCoPublishRows).
408
+ */
409
+ const htmlEmbeddedImageCoPublish = sqliteTable('html_embedded_image_co_publish', {
410
+ id: int('id').primaryKey({ autoIncrement: true }),
411
+ parentSeedLocalId: text('parent_seed_local_id').notNull(),
412
+ htmlSeedLocalId: text('html_seed_local_id').notNull(),
413
+ imageSeedLocalId: text('image_seed_local_id').notNull(),
414
+ /** Stable dedup key (e.g. sha256 of data URI or normalized URI string). */
415
+ stableKey: text('stable_key').notNull(),
416
+ createdAt: int('created_at').notNull(),
417
+ }, (t) => [
418
+ uniqueIndex('html_embed_co_pub_parent_html_stable').on(t.parentSeedLocalId, t.htmlSeedLocalId, t.stableKey),
419
+ ]);
420
+
421
+ /**
422
+ * The item write outbox (ADR 0019): one row per edit to an item, appended when the value is
423
+ * assigned and applied to `seeds`, `versions` and `metadata` by the leader tab's drainer.
424
+ */
425
+ const pendingWrites = sqliteTable('pending_writes', {
426
+ id: int('id').primaryKey({ autoIncrement: true }),
427
+ /** Unique per op; the drainer and `save()` refer to an op by it. */
428
+ opId: text('op_id').notNull(),
429
+ /** Unused: nothing appends grouped ops. Kept until a migration drops it. */
430
+ groupId: text('group_id'),
431
+ seedLocalId: text('seed_local_id').notNull(),
432
+ /** Null for ops on the seed itself (`create`, `delete`). */
433
+ propertyName: text('property_name'),
434
+ /** `create` | `set` | `delete` | `storage` */
435
+ kind: text('kind').notNull(),
436
+ /** JSON-encoded value. */
437
+ value: text('value'),
438
+ /**
439
+ * A storage op's staged file: the assigned bytes, written by the tab that appended the op (an
440
+ * ItemStorage op's staged path is in its JSON value too).
441
+ */
442
+ valueRef: text('value_ref'),
443
+ /** The stored metadata row the edit was made against, to detect a synced row written since. */
444
+ baseRowId: text('base_row_id'),
445
+ /** Unused: the base uid is read through base_row_id. Kept until a migration drops it. */
446
+ baseUid: text('base_uid'),
447
+ createdAt: int('created_at').notNull(),
448
+ /** The tab that appended the op. */
449
+ tabId: text('tab_id'),
450
+ /** `pending` | `applied` | `superseded` | `failed`. An op is claimed and applied in one transaction. */
451
+ status: text('status').notNull(),
452
+ error: text('error'),
453
+ /** The name of the error that failed the op (`OwnershipError`, say), so a waiter can tell why. */
454
+ errorName: text('error_name'),
455
+ attempts: int('attempts').notNull().default(0),
456
+ appliedAt: int('applied_at'),
457
+ /** JSON the applier recorded when the op applied (for a `set`: the metadata row written). */
458
+ result: text('result'),
459
+ /** JSON: the synced value this op was applied over, when there was one (ADR 0019). */
460
+ conflict: text('conflict'),
461
+ conflictResolvedAt: int('conflict_resolved_at'),
462
+ }, (table) => ({
463
+ opIdUnique: uniqueIndex('pending_writes_op_id_unique').on(table.opId),
464
+ /** The drainer's order: per property, oldest first, among one status. */
465
+ drainOrder: index('pending_writes_drain_order').on(table.status, table.seedLocalId, table.propertyName, table.createdAt),
466
+ }));
467
+
468
+ /**
469
+ * The entity change log (ADR 0020): one row per row written to `seeds`, `versions` or `metadata`,
470
+ * inserted by triggers (migration 0023), so it commits or rolls back with the write. The browser's
471
+ * change feed reads it to tell loaded Items and ItemProperties which seeds changed. Nothing else
472
+ * writes it; the leader tab prunes rows older than 10 minutes.
473
+ */
474
+ const entityChanges = sqliteTable('entity_changes', {
475
+ seq: int('seq').primaryKey({ autoIncrement: true }),
476
+ /** `seeds` | `versions` | `metadata` */
477
+ tbl: text('tbl').notNull(),
478
+ seedLocalId: text('seed_local_id'),
479
+ seedUid: text('seed_uid'),
480
+ /** Set for `metadata` rows only. */
481
+ propertyName: text('property_name'),
482
+ /** Unix ms when the trigger ran. */
483
+ at: int('at').notNull(),
484
+ }, (table) => ({
485
+ at: index('entity_changes_at').on(table.at),
486
+ }));
487
+
488
+ class BaseFileManager {
489
+ static configure(impl) {
490
+ if (!impl) {
491
+ throw new Error('Cannot configure FileManager with undefined or null. Ensure the platform-specific FileManager is properly created.');
492
+ }
493
+ BaseFileManager._impl = impl;
494
+ }
495
+ static requireImpl() {
496
+ if (!BaseFileManager._impl) {
497
+ throw new Error('FileManager not configured. Call BaseFileManager.configure() during platform init.');
498
+ }
499
+ return BaseFileManager._impl;
500
+ }
501
+ /**
502
+ * Clears FS init flags so a later call can retry. Used after a failed init
503
+ * and by tests. Does not unmount or delete any files.
504
+ */
505
+ static resetInitializationState() {
506
+ this.fileSystemInitialized = false;
507
+ this.initializing = false;
508
+ this.initializePromise = null;
509
+ this.workingDir = undefined;
510
+ }
511
+ static initializeFileSystem(workingDir) {
512
+ if (this.fileSystemInitialized) {
513
+ return Promise.resolve();
514
+ }
515
+ if (this.initializePromise) {
516
+ return this.initializePromise;
517
+ }
518
+ this.initializing = true;
519
+ const pending = this.runInitializeFileSystem(workingDir).finally(() => {
520
+ this.initializing = false;
521
+ if (this.initializePromise === pending) {
522
+ this.initializePromise = null;
523
+ }
524
+ });
525
+ this.initializePromise = pending;
526
+ return pending;
527
+ }
528
+ static async runInitializeFileSystem(workingDir) {
529
+ await BaseFileManager.requireImpl().initializeFileSystem(workingDir);
530
+ this.fileSystemInitialized = true;
531
+ this.workingDir = workingDir;
532
+ }
533
+ static getWorkingDir() {
534
+ if (!this.workingDir) {
535
+ throw new Error('Working directory is not set');
536
+ }
537
+ return this.workingDir;
538
+ }
539
+ /**
540
+ * Build a path under the configured files root (e.g. /app-files).
541
+ * Use this instead of hardcoding /files/ for images, html, json, etc.
542
+ * @param subpaths - path segments to join (e.g. 'images', fileName)
543
+ * @returns full path like /app-files/images/egg.jpg
544
+ */
545
+ static getFilesPath(...subpaths) {
546
+ const root = this.getWorkingDir().replace(/\/$/, '');
547
+ const parts = [root, ...subpaths].filter(Boolean);
548
+ return parts.join('/').replace(/\/+/g, '/');
549
+ }
550
+ static getContentUrlFromPath(path) {
551
+ return BaseFileManager.requireImpl().getContentUrlFromPath(path);
552
+ }
553
+ static downloadAllFiles(params) {
554
+ return BaseFileManager.requireImpl().downloadAllFiles(params);
555
+ }
556
+ static downloadFileByTransactionId({ transactionId, arweaveHost, arweaveBaseUrls, excludedTransactions, expectedContentHash, compositeChildPaths, skipExisting, }) {
557
+ return BaseFileManager.requireImpl().downloadAllFiles({
558
+ transactionIds: [transactionId],
559
+ arweaveHost,
560
+ arweaveBaseUrls,
561
+ excludedTransactions,
562
+ expectedContentHashes: expectedContentHash ? { [transactionId]: expectedContentHash } : undefined,
563
+ compositeChildPaths: compositeChildPaths ? { [transactionId]: compositeChildPaths } : undefined,
564
+ skipExisting,
565
+ });
566
+ }
567
+ static resizeImage({ filePath, width, height }) {
568
+ return BaseFileManager.requireImpl().resizeImage({ filePath, width, height });
569
+ }
570
+ static resizeAllImages({ width, height }) {
571
+ return BaseFileManager.requireImpl().resizeAllImages({ width, height });
572
+ }
573
+ static pathExists(filePath) {
574
+ return BaseFileManager.requireImpl().pathExists(filePath);
575
+ }
576
+ static invalidateCachedPaths(filePaths) {
577
+ return BaseFileManager.requireImpl().invalidateCachedPaths(filePaths);
578
+ }
579
+ /** File size in bytes, or null if the path does not exist / cannot be stated. */
580
+ static getFileSize(filePath) {
581
+ return BaseFileManager.requireImpl().getFileSize(filePath);
582
+ }
583
+ /**
584
+ * Returns a list of filenames in the given directory (e.g. 'images', 'files').
585
+ */
586
+ static listFiles(dir) {
587
+ return BaseFileManager.requireImpl().listFiles(dir);
588
+ }
589
+ /**
590
+ * Returns a list of image filenames in the images folder (originals only, excludes size subdirs).
591
+ * Use this to get all stored images without traversing 480/760/1024/1440/1920 subdirectories.
592
+ */
593
+ static listImageFiles() {
594
+ return this.listFiles('images');
595
+ }
596
+ static createDirIfNotExists(filePath) {
597
+ return BaseFileManager.requireImpl().createDirIfNotExists(filePath);
598
+ }
599
+ static async waitForFile(filePath) {
600
+ return BaseFileManager.requireImpl().waitForFile(filePath);
601
+ }
602
+ static async waitForFileWithContent(filePath, interval, timeout) {
603
+ return BaseFileManager.requireImpl().waitForFileWithContent(filePath, interval, timeout);
604
+ }
605
+ static async saveFile(filePath, content) {
606
+ return BaseFileManager.requireImpl().saveFile(filePath, content);
607
+ }
608
+ static saveFileSync(filePath, content) {
609
+ return BaseFileManager.requireImpl().saveFileSync(filePath, content);
610
+ }
611
+ static async readFile(filePath) {
612
+ return BaseFileManager.requireImpl().readFile(filePath);
613
+ }
614
+ static readFileSync(filePath) {
615
+ return BaseFileManager.requireImpl().readFileSync(filePath);
616
+ }
617
+ static async readFileAsBuffer(filePath) {
618
+ return BaseFileManager.requireImpl().readFileAsBuffer(filePath);
619
+ }
620
+ static async readFileAsString(filePath) {
621
+ return BaseFileManager.requireImpl().readFileAsString(filePath);
622
+ }
623
+ static async getFs() {
624
+ return BaseFileManager.requireImpl().getFs();
625
+ }
626
+ static getFsSync() {
627
+ return BaseFileManager.requireImpl().getFsSync();
628
+ }
629
+ static getPathModule() {
630
+ return BaseFileManager.requireImpl().getPathModule();
631
+ }
632
+ static getParentDirPath(filePath) {
633
+ return BaseFileManager.requireImpl().getParentDirPath(filePath);
634
+ }
635
+ static getFilenameFromPath(filePath) {
636
+ return BaseFileManager.requireImpl().getFilenameFromPath(filePath);
637
+ }
638
+ }
639
+ BaseFileManager.fileSystemInitialized = false;
640
+ BaseFileManager.initializing = false;
641
+ BaseFileManager._impl = null;
642
+ BaseFileManager.initializePromise = null;
643
+
644
+ var BaseFileManager$1 = /*#__PURE__*/Object.freeze({
645
+ __proto__: null,
646
+ BaseFileManager: BaseFileManager
647
+ });
648
+
649
+ export { BaseFileManager$1 as A, BaseDb as B, ModelSchemaSchema as M, SQLITE_BUSY_RETRY_DELAYS_MS as S, appState as a, modelUids as b, config as c, models as d, arweaveL1FinalizeJobs as e, easSyncProcesses as f, entityChanges as g, htmlEmbeddedImageCoPublish as h, modelRelations as i, modelSchemas as j, modelsRelations as k, properties as l, metadata as m, propertiesRelations as n, propertyUidRelations as o, pendingWrites as p, propertyUids as q, publishProcesses as r, seeds as s, schemas as t, uploadProcesses as u, versions as v, BaseFileManager as w, isSqliteBusyError as x, withSqliteBusyRetry as y, SchemaSchema as z };
650
+ //# sourceMappingURL=BaseFileManager-BAlySv8w.js.map