@seedprotocol/sdk 0.4.31 → 0.5.1

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 (323) hide show
  1. package/dist/BasePathResolver-BDgc7c4T.js +485 -0
  2. package/dist/BasePathResolver-BDgc7c4T.js.map +1 -0
  3. package/dist/{ModelProperty-e_hXSFvf.js → ModelProperty-D-ysg8zA.js} +37 -43
  4. package/dist/ModelProperty-D-ysg8zA.js.map +1 -0
  5. package/dist/{Schema-DonRkUOJ.js → Schema-CyCftnKI.js} +40 -40
  6. package/dist/{Schema-DonRkUOJ.js.map → Schema-CyCftnKI.js.map} +1 -1
  7. package/dist/{SchemaValidationService-DcmfhQae.js → SchemaValidationService-POM6jHbJ.js} +9 -5
  8. package/dist/{SchemaValidationService-DcmfhQae.js.map → SchemaValidationService-POM6jHbJ.js.map} +1 -1
  9. package/dist/{backfillMetadataPropertyIds-CKTfvFgQ.js → backfillMetadataPropertyIds-DzZw57iJ.js} +3 -11
  10. package/dist/{backfillMetadataPropertyIds-CKTfvFgQ.js.map → backfillMetadataPropertyIds-DzZw57iJ.js.map} +1 -1
  11. package/dist/cjs/{ModelProperty-BQYU5hPQ.js → ModelProperty-CmuGJvyi.js} +25 -26
  12. package/dist/cjs/{ModelProperty-BQYU5hPQ.js.map → ModelProperty-CmuGJvyi.js.map} +1 -1
  13. package/dist/cjs/{Schema-BcRHcQ0W.js → Schema-gpFnZMhB.js} +28 -29
  14. package/dist/cjs/{Schema-BcRHcQ0W.js.map → Schema-gpFnZMhB.js.map} +1 -1
  15. package/dist/cjs/{SchemaValidationService-CQNDgyZl.js → SchemaValidationService-E3xTSRai.js} +9 -10
  16. package/dist/cjs/{SchemaValidationService-CQNDgyZl.js.map → SchemaValidationService-E3xTSRai.js.map} +1 -1
  17. package/dist/cjs/{backfillMetadataPropertyIds-Dn4oVmEv.js → backfillMetadataPropertyIds-_bivrvRs.js} +11 -12
  18. package/dist/cjs/{backfillMetadataPropertyIds-Dn4oVmEv.js.map → backfillMetadataPropertyIds-_bivrvRs.js.map} +1 -1
  19. package/dist/cjs/eas-BwDKJmlb.js +112 -0
  20. package/dist/cjs/eas-BwDKJmlb.js.map +1 -0
  21. package/dist/cjs/{getItem-DpnPrzl3.js → getItem-MShQw3sz.js} +11 -12
  22. package/dist/cjs/{getItem-DpnPrzl3.js.map → getItem-MShQw3sz.js.map} +1 -1
  23. package/dist/cjs/{getPublishPayload-CGKMEL3H.js → getPublishPayload-C1nOOXp_.js} +93 -83
  24. package/dist/cjs/getPublishPayload-C1nOOXp_.js.map +1 -0
  25. package/dist/cjs/{getPublishUploads-DeI0f2UN.js → getPublishUploads-BjgxgrKD.js} +17 -18
  26. package/dist/cjs/{getPublishUploads-DeI0f2UN.js.map → getPublishUploads-BjgxgrKD.js.map} +1 -1
  27. package/dist/cjs/{getSegmentedItemProperties-BgS_FhAx.js → getSegmentedItemProperties-Cuw7wcxb.js} +64 -15
  28. package/dist/cjs/getSegmentedItemProperties-Cuw7wcxb.js.map +1 -0
  29. package/dist/cjs/{index-BnAqr2le.js → index-9Z2FOvLD.js} +12 -13
  30. package/dist/cjs/index-9Z2FOvLD.js.map +1 -0
  31. package/dist/cjs/{index-ByozbTn_.js → index-vk2DeF2D.js} +1237 -3235
  32. package/dist/cjs/index-vk2DeF2D.js.map +1 -0
  33. package/dist/cjs/index.browser-BSf8HpnU.js +22 -0
  34. package/dist/cjs/index.browser-BSf8HpnU.js.map +1 -0
  35. package/dist/cjs/{ownership-CsWuaNfH.js → ownership-DhWda0J9.js} +11 -25
  36. package/dist/cjs/{ownership-CsWuaNfH.js.map → ownership-DhWda0J9.js.map} +1 -1
  37. package/dist/cjs/{property-CeR45LMx.js → property-D3Ww2_Qh.js} +13 -14
  38. package/dist/cjs/{property-CeR45LMx.js.map → property-D3Ww2_Qh.js.map} +1 -1
  39. package/dist/cjs/{syncDbWithEas-CA2Lum5V.js → syncDbWithEas-Dht3_7UD.js} +26 -39
  40. package/dist/cjs/syncDbWithEas-Dht3_7UD.js.map +1 -0
  41. package/dist/configurePlatform-R5neRbQ9.js +27 -0
  42. package/dist/configurePlatform-R5neRbQ9.js.map +1 -0
  43. package/dist/constants-B5S5JPDK.js +660 -0
  44. package/dist/constants-B5S5JPDK.js.map +1 -0
  45. package/dist/constants-DMHTYMgJ.js +120 -0
  46. package/dist/constants-DMHTYMgJ.js.map +1 -0
  47. package/dist/db-Cvh84NY7.js +1972 -0
  48. package/dist/db-Cvh84NY7.js.map +1 -0
  49. package/dist/eas-D9b7z2Wn.js +68 -0
  50. package/dist/eas-D9b7z2Wn.js.map +1 -0
  51. package/dist/{getItem-GOXWo_Iy.js → getItem-B81V3m4S.js} +10 -6
  52. package/dist/{getItem-GOXWo_Iy.js.map → getItem-B81V3m4S.js.map} +1 -1
  53. package/dist/{getPublishPayload-D16enahU.js → getPublishPayload-CNYsn8-6.js} +87 -74
  54. package/dist/getPublishPayload-CNYsn8-6.js.map +1 -0
  55. package/dist/{getPublishUploads-wGqH19UY.js → getPublishUploads-D9rPHkB7.js} +14 -10
  56. package/dist/{getPublishUploads-wGqH19UY.js.map → getPublishUploads-D9rPHkB7.js.map} +1 -1
  57. package/dist/{getSegmentedItemProperties-Be3kYWY3.js → getSegmentedItemProperties-Bg3_b-b1.js} +18 -15
  58. package/dist/getSegmentedItemProperties-Bg3_b-b1.js.map +1 -0
  59. package/dist/{index-BcXKZQpX.js → index--F3Wolt5.js} +1171 -5452
  60. package/dist/index--F3Wolt5.js.map +1 -0
  61. package/dist/{index-BFyMxc7e.js → index-QMrBK-L3.js} +2 -2
  62. package/dist/index-QMrBK-L3.js.map +1 -0
  63. package/dist/index-oi4roUVf.js +22 -0
  64. package/dist/index-oi4roUVf.js.map +1 -0
  65. package/dist/index.node-Bow8kHew.js +503 -0
  66. package/dist/index.node-Bow8kHew.js.map +1 -0
  67. package/dist/main.cjs +16 -15
  68. package/dist/main.cjs.map +1 -1
  69. package/dist/main.js +31 -22
  70. package/dist/main.js.map +1 -1
  71. package/dist/node.js +37 -363
  72. package/dist/node.js.map +1 -1
  73. package/dist/{ownership-C17YhE7J.js → ownership-BF_ZUKIp.js} +13 -9
  74. package/dist/{ownership-C17YhE7J.js.map → ownership-BF_ZUKIp.js.map} +1 -1
  75. package/dist/platform.browser.js +3499 -0
  76. package/dist/platform.browser.js.map +1 -0
  77. package/dist/platform.node.js +19 -0
  78. package/dist/platform.node.js.map +1 -0
  79. package/dist/{property-CRAau-Q-.js → property-BdyDfcSc.js} +14 -11
  80. package/dist/property-BdyDfcSc.js.map +1 -0
  81. package/dist/src/Item/Item.d.ts.map +1 -1
  82. package/dist/src/Item/service/actors/fetchDataFromEas.d.ts.map +1 -1
  83. package/dist/src/Model/service/actors/createModelProperties.d.ts.map +1 -1
  84. package/dist/src/Model/service/modelMachine.d.ts +1 -1
  85. package/dist/src/browser/db/Db.d.ts +17 -18
  86. package/dist/src/browser/db/Db.d.ts.map +1 -1
  87. package/dist/src/browser/helpers/ArweaveClient.d.ts +10 -27
  88. package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
  89. package/dist/src/browser/helpers/EasClient.d.ts +6 -4
  90. package/dist/src/browser/helpers/EasClient.d.ts.map +1 -1
  91. package/dist/src/browser/helpers/FileManager.d.ts +27 -26
  92. package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
  93. package/dist/src/browser/helpers/PathResolver.d.ts +6 -5
  94. package/dist/src/browser/helpers/PathResolver.d.ts.map +1 -1
  95. package/dist/src/browser/helpers/QueryClient.d.ts +6 -5
  96. package/dist/src/browser/helpers/QueryClient.d.ts.map +1 -1
  97. package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
  98. package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
  99. package/dist/src/client/actors/processSchemaFiles.d.ts.map +1 -1
  100. package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
  101. package/dist/src/db/Db/BaseDb.d.ts +6 -26
  102. package/dist/src/db/Db/BaseDb.d.ts.map +1 -1
  103. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  104. package/dist/src/db/write/createMetadata.d.ts.map +1 -1
  105. package/dist/src/db/write/updateMetadata.d.ts.map +1 -1
  106. package/dist/src/eas.d.ts +4 -37
  107. package/dist/src/eas.d.ts.map +1 -1
  108. package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts +1 -101
  109. package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts.map +1 -1
  110. package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts +1 -51
  111. package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts.map +1 -1
  112. package/dist/src/helpers/ArweaveClient/index.d.ts +2 -2
  113. package/dist/src/helpers/ArweaveClient/index.d.ts.map +1 -1
  114. package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts +1 -15
  115. package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts.map +1 -1
  116. package/dist/src/helpers/ArweaveClient/uploadApiVerification.d.ts +1 -22
  117. package/dist/src/helpers/ArweaveClient/uploadApiVerification.d.ts.map +1 -1
  118. package/dist/src/helpers/EasClient/BaseEasClient.d.ts +1 -9
  119. package/dist/src/helpers/EasClient/BaseEasClient.d.ts.map +1 -1
  120. package/dist/src/helpers/FileManager/BaseFileManager.d.ts +4 -2
  121. package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
  122. package/dist/src/helpers/FileManager/IFileManager.d.ts +44 -0
  123. package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -0
  124. package/dist/src/helpers/PathResolver/BasePathResolver.d.ts +16 -12
  125. package/dist/src/helpers/PathResolver/BasePathResolver.d.ts.map +1 -1
  126. package/dist/src/helpers/PathResolver/IPathResolver.d.ts +16 -0
  127. package/dist/src/helpers/PathResolver/IPathResolver.d.ts.map +1 -0
  128. package/dist/src/helpers/QueryClient/BaseQueryClient.d.ts +1 -6
  129. package/dist/src/helpers/QueryClient/BaseQueryClient.d.ts.map +1 -1
  130. package/dist/src/helpers/constants.d.ts +4 -22
  131. package/dist/src/helpers/constants.d.ts.map +1 -1
  132. package/dist/src/helpers/db.d.ts.map +1 -1
  133. package/dist/src/helpers/easPropertyCanonical.d.ts +1 -14
  134. package/dist/src/helpers/easPropertyCanonical.d.ts.map +1 -1
  135. package/dist/src/helpers/easRevokedFilter.d.ts +1 -9
  136. package/dist/src/helpers/easRevokedFilter.d.ts.map +1 -1
  137. package/dist/src/helpers/easUid.d.ts +1 -12
  138. package/dist/src/helpers/easUid.d.ts.map +1 -1
  139. package/dist/src/helpers/ethereumUtils.d.ts +5 -0
  140. package/dist/src/helpers/ethereumUtils.d.ts.map +1 -0
  141. package/dist/src/helpers/file/fetchAll/index.d.ts +1 -1
  142. package/dist/src/helpers/file/fetchAll/index.d.ts.map +1 -1
  143. package/dist/src/helpers/gateway/gatewayState.d.ts +2 -0
  144. package/dist/src/helpers/gateway/gatewayState.d.ts.map +1 -0
  145. package/dist/src/helpers/gateway/resolveSeedGatewayEndpoints.d.ts +2 -0
  146. package/dist/src/helpers/gateway/resolveSeedGatewayEndpoints.d.ts.map +1 -0
  147. package/dist/src/helpers/gateway/seedGatewayConfig.d.ts +2 -0
  148. package/dist/src/helpers/gateway/seedGatewayConfig.d.ts.map +1 -0
  149. package/dist/src/helpers/generateId.d.ts +2 -0
  150. package/dist/src/helpers/generateId.d.ts.map +1 -0
  151. package/dist/src/helpers/getSchemaForItemProperty.d.ts +1 -1
  152. package/dist/src/helpers/getSchemaForItemProperty.d.ts.map +1 -1
  153. package/dist/src/helpers/getSegmentedItemProperties.d.ts.map +1 -1
  154. package/dist/src/helpers/index.d.ts +15 -10
  155. package/dist/src/helpers/index.d.ts.map +1 -1
  156. package/dist/src/helpers/isSqliteUniqueConstraintError.d.ts +7 -0
  157. package/dist/src/helpers/isSqliteUniqueConstraintError.d.ts.map +1 -0
  158. package/dist/src/helpers/mediaRef.d.ts.map +1 -1
  159. package/dist/src/helpers/property/index.d.ts.map +1 -1
  160. package/dist/src/index.d.ts +9 -7
  161. package/dist/src/index.d.ts.map +1 -1
  162. package/dist/src/interfaces/IDb.d.ts +11 -0
  163. package/dist/src/interfaces/IDb.d.ts.map +1 -1
  164. package/dist/src/node/db/Db.d.ts +22 -37
  165. package/dist/src/node/db/Db.d.ts.map +1 -1
  166. package/dist/src/node/helpers/ArweaveClient.d.ts +4 -30
  167. package/dist/src/node/helpers/ArweaveClient.d.ts.map +1 -1
  168. package/dist/src/node/helpers/EasClient.d.ts +4 -6
  169. package/dist/src/node/helpers/EasClient.d.ts.map +1 -1
  170. package/dist/src/node/helpers/FileManager.d.ts +26 -25
  171. package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
  172. package/dist/src/node/helpers/PathResolver.d.ts +6 -5
  173. package/dist/src/node/helpers/PathResolver.d.ts.map +1 -1
  174. package/dist/src/node/helpers/QueryClient.d.ts +4 -6
  175. package/dist/src/node/helpers/QueryClient.d.ts.map +1 -1
  176. package/dist/src/node/helpers/scripts.d.ts +5 -7
  177. package/dist/src/node/helpers/scripts.d.ts.map +1 -1
  178. package/dist/src/node/index.d.ts +2 -9
  179. package/dist/src/node/index.d.ts.map +1 -1
  180. package/dist/src/node/webpack/index.d.ts +1 -1
  181. package/dist/src/node/webpack/index.d.ts.map +1 -1
  182. package/dist/src/platform/configurePlatform.d.ts +6 -0
  183. package/dist/src/platform/configurePlatform.d.ts.map +1 -0
  184. package/dist/src/platform/index.browser.d.ts +3 -0
  185. package/dist/src/platform/index.browser.d.ts.map +1 -0
  186. package/dist/src/platform/index.d.ts +9 -0
  187. package/dist/src/platform/index.d.ts.map +1 -0
  188. package/dist/src/platform/index.node.d.ts +3 -0
  189. package/dist/src/platform/index.node.d.ts.map +1 -0
  190. package/dist/src/platform/types.d.ts +14 -0
  191. package/dist/src/platform/types.d.ts.map +1 -0
  192. package/dist/src/stores/eas.d.ts +1 -18
  193. package/dist/src/stores/eas.d.ts.map +1 -1
  194. package/dist/src/testing/platformTestHandle.d.ts +8 -0
  195. package/dist/src/testing/platformTestHandle.d.ts.map +1 -0
  196. package/dist/src/types/gateway.d.ts +2 -0
  197. package/dist/src/types/gateway.d.ts.map +1 -0
  198. package/dist/src/types/index.d.ts +5 -0
  199. package/dist/src/types/index.d.ts.map +1 -1
  200. package/dist/src/types/item.d.ts +1 -1
  201. package/dist/src/types/item.d.ts.map +1 -1
  202. package/dist/src/types/machines.d.ts +10 -0
  203. package/dist/src/types/machines.d.ts.map +1 -1
  204. package/dist/src/types/seedProtocol.d.ts +1 -1
  205. package/dist/src/types/seedProtocol.d.ts.map +1 -1
  206. package/dist/src/vite/index.d.ts +2 -47
  207. package/dist/src/vite/index.d.ts.map +1 -1
  208. package/dist/{syncDbWithEas-CB5aXPtf.js → syncDbWithEas-DMOJHtkP.js} +20 -15
  209. package/dist/syncDbWithEas-DMOJHtkP.js.map +1 -0
  210. package/dist/{updateSeedRevokedAt-BIu5Q4Po.js → updateSeedRevokedAt-Ba0OhDQj.js} +2 -2
  211. package/dist/{updateSeedRevokedAt-BIu5Q4Po.js.map → updateSeedRevokedAt-Ba0OhDQj.js.map} +1 -1
  212. package/dist/vite.cjs +5 -470
  213. package/dist/vite.cjs.map +1 -1
  214. package/dist/vite.js +1 -472
  215. package/dist/vite.js.map +1 -1
  216. package/package.json +42 -37
  217. package/dist/ArweaveClient-CZpZgmR2.js +0 -204
  218. package/dist/ArweaveClient-CZpZgmR2.js.map +0 -1
  219. package/dist/ArweaveClient-Cs7AL9dp.js +0 -204
  220. package/dist/ArweaveClient-Cs7AL9dp.js.map +0 -1
  221. package/dist/Db-CF6R7HIy.js +0 -2098
  222. package/dist/Db-CF6R7HIy.js.map +0 -1
  223. package/dist/Db-CZkONsdT.js +0 -248
  224. package/dist/Db-CZkONsdT.js.map +0 -1
  225. package/dist/EasClient-PXOzSzPG.js +0 -29
  226. package/dist/EasClient-PXOzSzPG.js.map +0 -1
  227. package/dist/EasClient-qfTiM2we.js +0 -29
  228. package/dist/EasClient-qfTiM2we.js.map +0 -1
  229. package/dist/FileManager-5GkHtxF7.js +0 -1256
  230. package/dist/FileManager-5GkHtxF7.js.map +0 -1
  231. package/dist/FileManager-jORQ8Bb6.js +0 -177
  232. package/dist/FileManager-jORQ8Bb6.js.map +0 -1
  233. package/dist/ModelProperty-e_hXSFvf.js.map +0 -1
  234. package/dist/PathResolver-B4_X69Rd.js +0 -204
  235. package/dist/PathResolver-B4_X69Rd.js.map +0 -1
  236. package/dist/PathResolver-Dz0RVGIz.js +0 -78
  237. package/dist/PathResolver-Dz0RVGIz.js.map +0 -1
  238. package/dist/QueryClient-CXHZ239d.js +0 -51
  239. package/dist/QueryClient-CXHZ239d.js.map +0 -1
  240. package/dist/QueryClient-D_UK4YLm.js +0 -35
  241. package/dist/QueryClient-D_UK4YLm.js.map +0 -1
  242. package/dist/arweave-default-shim.js +0 -6
  243. package/dist/cjs/getPublishPayload-CGKMEL3H.js.map +0 -1
  244. package/dist/cjs/getSegmentedItemProperties-BgS_FhAx.js.map +0 -1
  245. package/dist/cjs/index-BnAqr2le.js.map +0 -1
  246. package/dist/cjs/index-ByozbTn_.js.map +0 -1
  247. package/dist/cjs/syncDbWithEas-CA2Lum5V.js.map +0 -1
  248. package/dist/debug-default-shim.js +0 -27
  249. package/dist/getPublishPayload-D16enahU.js.map +0 -1
  250. package/dist/getSegmentedItemProperties-Be3kYWY3.js.map +0 -1
  251. package/dist/index-BFyMxc7e.js.map +0 -1
  252. package/dist/index-BcXKZQpX.js.map +0 -1
  253. package/dist/index-C9p-skT3.js +0 -18
  254. package/dist/index-C9p-skT3.js.map +0 -1
  255. package/dist/property-CRAau-Q-.js.map +0 -1
  256. package/dist/queries-Ct7CcQ3g.js +0 -16
  257. package/dist/queries-Ct7CcQ3g.js.map +0 -1
  258. package/dist/src/Item/queries.d.ts +0 -27
  259. package/dist/src/Item/queries.d.ts.map +0 -1
  260. package/dist/src/graphql/fragments/Attestation.d.ts +0 -2
  261. package/dist/src/graphql/fragments/Attestation.d.ts.map +0 -1
  262. package/dist/src/graphql/fragments/Schema.d.ts +0 -2
  263. package/dist/src/graphql/fragments/Schema.d.ts.map +0 -1
  264. package/dist/src/graphql/fragments/index.d.ts +0 -3
  265. package/dist/src/graphql/fragments/index.d.ts.map +0 -1
  266. package/dist/src/graphql/gql/fragment-masking.d.ts +0 -20
  267. package/dist/src/graphql/gql/fragment-masking.d.ts.map +0 -1
  268. package/dist/src/graphql/gql/gql.d.ts +0 -107
  269. package/dist/src/graphql/gql/gql.d.ts.map +0 -1
  270. package/dist/src/graphql/gql/graphql.d.ts +0 -2969
  271. package/dist/src/graphql/gql/graphql.d.ts.map +0 -1
  272. package/dist/src/graphql/gql/index.d.ts +0 -3
  273. package/dist/src/graphql/gql/index.d.ts.map +0 -1
  274. package/dist/src/helpers/ArweaveClient/queries.d.ts +0 -13
  275. package/dist/src/helpers/ArweaveClient/queries.d.ts.map +0 -1
  276. package/dist/src/helpers/file/queries.d.ts +0 -9
  277. package/dist/src/helpers/file/queries.d.ts.map +0 -1
  278. package/dist/src/helpers/image/queries.d.ts +0 -7
  279. package/dist/src/helpers/image/queries.d.ts.map +0 -1
  280. package/dist/src/node/codegen/drizzle.d.ts +0 -5
  281. package/dist/src/node/codegen/drizzle.d.ts.map +0 -1
  282. package/dist/src/node/codegen/index.d.ts +0 -2
  283. package/dist/src/node/codegen/index.d.ts.map +0 -1
  284. package/dist/src/node/codegen/ts-to-proto.d.ts +0 -9
  285. package/dist/src/node/codegen/ts-to-proto.d.ts.map +0 -1
  286. package/dist/src/node/db/node.app.db.config.d.ts +0 -4
  287. package/dist/src/node/db/node.app.db.config.d.ts.map +0 -1
  288. package/dist/src/node/helpers/index.d.ts +0 -3
  289. package/dist/src/node/helpers/index.d.ts.map +0 -1
  290. package/dist/src/vite/arweave-default-shim.d.ts +0 -4
  291. package/dist/src/vite/arweave-default-shim.d.ts.map +0 -1
  292. package/dist/src/vite/debug-default-shim.d.ts +0 -3
  293. package/dist/src/vite/debug-default-shim.d.ts.map +0 -1
  294. package/dist/src/vite/easFix.d.ts +0 -2
  295. package/dist/src/vite/easFix.d.ts.map +0 -1
  296. package/dist/syncDbWithEas-CB5aXPtf.js.map +0 -1
  297. /package/dist/db/drizzle/{drizzle/0000_married_malice.sql → 0000_married_malice.sql} +0 -0
  298. /package/dist/db/drizzle/{drizzle/0001_sweet_bruce_banner.sql → 0001_sweet_bruce_banner.sql} +0 -0
  299. /package/dist/db/drizzle/{drizzle/0002_bitter_proudstar.sql → 0002_bitter_proudstar.sql} +0 -0
  300. /package/dist/db/drizzle/{drizzle/0003_cultured_senator_kelly.sql → 0003_cultured_senator_kelly.sql} +0 -0
  301. /package/dist/db/drizzle/{drizzle/0004_add_publisher_to_seeds.sql → 0004_add_publisher_to_seeds.sql} +0 -0
  302. /package/dist/db/drizzle/{drizzle/0005_bright_lily_hollister.sql → 0005_bright_lily_hollister.sql} +0 -0
  303. /package/dist/db/drizzle/{drizzle/0006_add_publisher_to_versions_and_metadata.sql → 0006_add_publisher_to_versions_and_metadata.sql} +0 -0
  304. /package/dist/db/drizzle/{drizzle/0007_add_required_to_properties.sql → 0007_add_required_to_properties.sql} +0 -0
  305. /package/dist/db/drizzle/{drizzle/0008_add_revoked_at_to_seeds.sql → 0008_add_revoked_at_to_seeds.sql} +0 -0
  306. /package/dist/db/drizzle/{drizzle/0009_happy_namor.sql → 0009_happy_namor.sql} +0 -0
  307. /package/dist/db/drizzle/{drizzle/0010_add_arweave_l1_finalize_jobs.sql → 0010_add_arweave_l1_finalize_jobs.sql} +0 -0
  308. /package/dist/db/drizzle/{drizzle/0011_normalize_placeholder_uids.sql → 0011_normalize_placeholder_uids.sql} +0 -0
  309. /package/dist/db/drizzle/{drizzle/0012_html_embedded_image_co_publish.sql → 0012_html_embedded_image_co_publish.sql} +0 -0
  310. /package/dist/db/drizzle/{drizzle/0013_eas_sync_processes.sql → 0013_eas_sync_processes.sql} +0 -0
  311. /package/dist/db/drizzle/{drizzle/meta → meta}/0000_snapshot.json +0 -0
  312. /package/dist/db/drizzle/{drizzle/meta → meta}/0001_snapshot.json +0 -0
  313. /package/dist/db/drizzle/{drizzle/meta → meta}/0002_snapshot.json +0 -0
  314. /package/dist/db/drizzle/{drizzle/meta → meta}/0003_snapshot.json +0 -0
  315. /package/dist/db/drizzle/{drizzle/meta → meta}/0004_snapshot.json +0 -0
  316. /package/dist/db/drizzle/{drizzle/meta → meta}/0005_snapshot.json +0 -0
  317. /package/dist/db/drizzle/{drizzle/meta → meta}/0006_snapshot.json +0 -0
  318. /package/dist/db/drizzle/{drizzle/meta → meta}/0007_snapshot.json +0 -0
  319. /package/dist/db/drizzle/{drizzle/meta → meta}/0008_snapshot.json +0 -0
  320. /package/dist/db/drizzle/{drizzle/meta → meta}/0009_snapshot.json +0 -0
  321. /package/dist/db/drizzle/{drizzle/meta → meta}/0010_snapshot.json +0 -0
  322. /package/dist/db/drizzle/{drizzle/meta → meta}/0013_snapshot.json +0 -0
  323. /package/dist/db/drizzle/{drizzle/meta → meta}/_journal.json +0 -0
@@ -1,2098 +0,0 @@
1
- import { p as BaseDb, v as BaseFileManager } from './index-BcXKZQpX.js';
2
- import debug from 'debug';
3
- import { sql } from 'drizzle-orm';
4
- import { readMigrationFiles } from 'drizzle-orm/migrator';
5
- import { drizzle } from 'drizzle-orm/sqlite-proxy';
6
- import { migrate } from 'drizzle-orm/sqlite-proxy/migrator';
7
- import { s as schema } from './index-BFyMxc7e.js';
8
- import { SQLocalDrizzle } from 'sqlocal/drizzle';
9
- import { Observable, distinctUntilChanged } from 'rxjs';
10
- import 'xstate';
11
- import 'drizzle-orm/sqlite-core';
12
- import 'nanoid';
13
- import 'nanoid-dictionary';
14
- import 'ethers';
15
- import 'pluralize';
16
- import '@sinclair/typebox';
17
- import 'drizzle-orm/casing';
18
- import 'lodash-es';
19
- import 'arweave';
20
- import 'js-sha3';
21
-
22
- // This file embeds the drizzle migration files as strings for browser runtime
23
- // These files are copied from packages/sdk/src/db/drizzle at build time
24
- // Individual migration SQL files
25
- const migrationSql_0000_married_malice = `CREATE TABLE \`appState\` (
26
- \`key\` text,
27
- \`value\` text,
28
- \`created_at\` integer,
29
- \`updated_at\` integer
30
- );
31
- --> statement-breakpoint
32
- CREATE UNIQUE INDEX \`appState_key_unique\` ON \`appState\` (\`key\`);--> statement-breakpoint
33
- CREATE TABLE \`config\` (
34
- \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
35
- \`key\` text NOT NULL,
36
- \`text\` text,
37
- \`json\` text,
38
- \`blob\` blob
39
- );
40
- --> statement-breakpoint
41
- CREATE TABLE \`metadata\` (
42
- \`local_id\` text,
43
- \`uid\` text,
44
- \`property_name\` text,
45
- \`property_value\` text,
46
- \`schema_uid\` text,
47
- \`model_type\` text,
48
- \`seed_local_id\` text,
49
- \`seed_uid\` text,
50
- \`version_local_id\` text,
51
- \`version_uid\` text,
52
- \`eas_data_type\` text,
53
- \`ref_value_type\` text,
54
- \`ref_schema_uid\` text,
55
- \`ref_seed_type\` text,
56
- \`ref_resolved_value\` text,
57
- \`ref_resolved_display_value\` text,
58
- \`local_storage_dir\` text,
59
- \`attestation_raw\` text,
60
- \`attestation_created_at\` integer,
61
- \`content_hash\` text,
62
- \`created_at\` integer,
63
- \`updated_at\` integer
64
- );
65
- --> statement-breakpoint
66
- CREATE UNIQUE INDEX \`metadata_local_id_unique\` ON \`metadata\` (\`local_id\`);--> statement-breakpoint
67
- CREATE TABLE \`models\` (
68
- \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
69
- \`name\` text NOT NULL,
70
- \`schema_file_id\` text
71
- );
72
- --> statement-breakpoint
73
- CREATE TABLE \`properties\` (
74
- \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
75
- \`name\` text NOT NULL,
76
- \`data_type\` text NOT NULL,
77
- \`model_id\` integer NOT NULL,
78
- \`ref_model_id\` integer,
79
- \`ref_value_type\` text,
80
- \`schema_file_id\` text,
81
- FOREIGN KEY (\`model_id\`) REFERENCES \`models\`(\`id\`) ON UPDATE no action ON DELETE no action,
82
- FOREIGN KEY (\`ref_model_id\`) REFERENCES \`models\`(\`id\`) ON UPDATE no action ON DELETE no action
83
- );
84
- --> statement-breakpoint
85
- CREATE UNIQUE INDEX \`unique_name_model_id\` ON \`properties\` (\`name\`,\`model_id\`);--> statement-breakpoint
86
- CREATE TABLE \`model_schemas\` (
87
- \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
88
- \`model_id\` integer,
89
- \`schema_id\` integer,
90
- FOREIGN KEY (\`model_id\`) REFERENCES \`models\`(\`id\`) ON UPDATE no action ON DELETE no action,
91
- FOREIGN KEY (\`schema_id\`) REFERENCES \`schemas\`(\`id\`) ON UPDATE no action ON DELETE no action
92
- );
93
- --> statement-breakpoint
94
- CREATE TABLE \`model_uids\` (
95
- \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
96
- \`uid\` text NOT NULL,
97
- \`model_id\` integer NOT NULL,
98
- FOREIGN KEY (\`model_id\`) REFERENCES \`models\`(\`id\`) ON UPDATE no action ON DELETE no action
99
- );
100
- --> statement-breakpoint
101
- CREATE UNIQUE INDEX \`model_uids_model_id_unique\` ON \`model_uids\` (\`model_id\`);--> statement-breakpoint
102
- CREATE TABLE \`property_uids\` (
103
- \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
104
- \`uid\` text NOT NULL,
105
- \`property_id\` integer NOT NULL,
106
- FOREIGN KEY (\`property_id\`) REFERENCES \`models\`(\`id\`) ON UPDATE no action ON DELETE no action
107
- );
108
- --> statement-breakpoint
109
- CREATE UNIQUE INDEX \`property_uids_property_id_unique\` ON \`property_uids\` (\`property_id\`);--> statement-breakpoint
110
- CREATE TABLE \`schemas\` (
111
- \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
112
- \`name\` text NOT NULL,
113
- \`version\` integer NOT NULL,
114
- \`schema_file_id\` text,
115
- \`created_at\` integer,
116
- \`updated_at\` integer
117
- );
118
- --> statement-breakpoint
119
- CREATE TABLE \`seeds\` (
120
- \`local_id\` text,
121
- \`uid\` text,
122
- \`schema_uid\` text,
123
- \`type\` text,
124
- \`attestation_raw\` text,
125
- \`attestation_created_at\` integer,
126
- \`created_at\` integer,
127
- \`updated_at\` integer,
128
- \`_marked_for_deletion\` integer
129
- );
130
- --> statement-breakpoint
131
- CREATE UNIQUE INDEX \`seeds_local_id_unique\` ON \`seeds\` (\`local_id\`);--> statement-breakpoint
132
- CREATE TABLE \`versions\` (
133
- \`local_id\` text,
134
- \`uid\` text,
135
- \`seed_local_id\` text,
136
- \`seed_uid\` text,
137
- \`seed_type\` text,
138
- \`note\` text,
139
- \`created_at\` integer,
140
- \`updated_at\` integer,
141
- \`attestation_created_at\` integer,
142
- \`attestation_raw\` text
143
- );
144
- --> statement-breakpoint
145
- CREATE UNIQUE INDEX \`versions_local_id_unique\` ON \`versions\` (\`local_id\`);`;
146
- const migrationSql_0001_sweet_bruce_banner = `ALTER TABLE \`schemas\` ADD \`schema_data\` text;--> statement-breakpoint
147
- ALTER TABLE \`schemas\` ADD \`is_draft\` integer;`;
148
- const migrationSql_0002_bitter_proudstar = `CREATE UNIQUE INDEX \`unique_schema_file_id\` ON \`models\` (\`schema_file_id\`);--> statement-breakpoint
149
- CREATE UNIQUE INDEX \`unique_property_schema_file_id\` ON \`properties\` (\`schema_file_id\`);--> statement-breakpoint
150
- CREATE UNIQUE INDEX \`unique_schema_schema_file_id\` ON \`schemas\` (\`schema_file_id\`);`;
151
- const migrationSql_0003_cultured_senator_kelly = `ALTER TABLE \`models\` ADD \`is_edited\` integer;--> statement-breakpoint
152
- ALTER TABLE \`properties\` ADD \`is_edited\` integer;--> statement-breakpoint
153
- ALTER TABLE \`schemas\` ADD \`is_edited\` integer;`;
154
- const migrationSql_0004_add_publisher_to_seeds = `ALTER TABLE \`seeds\` ADD \`publisher\` text;`;
155
- const migrationSql_0005_bright_lily_hollister = `CREATE TABLE \`publish_processes\` (
156
- \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
157
- \`seed_local_id\` text NOT NULL,
158
- \`model_name\` text NOT NULL,
159
- \`schema_id\` text,
160
- \`status\` text NOT NULL,
161
- \`started_at\` integer NOT NULL,
162
- \`completed_at\` integer,
163
- \`error_message\` text,
164
- \`error_step\` text,
165
- \`error_details\` text,
166
- \`persisted_snapshot\` text NOT NULL,
167
- \`seed_id\` text,
168
- \`existing_seed_uid\` text,
169
- \`created_at\` integer,
170
- \`updated_at\` integer
171
- );
172
- --> statement-breakpoint
173
- CREATE TABLE \`upload_processes\` (
174
- \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
175
- \`reimbursement_confirmed\` integer NOT NULL,
176
- \`reimbursement_transaction_id\` text,
177
- \`transaction_keys\` text,
178
- \`persisted_snapshot\` text NOT NULL,
179
- \`created_at\` integer,
180
- \`updated_at\` integer
181
- );
182
- `;
183
- const migrationSql_0006_add_publisher_to_versions_and_metadata = `ALTER TABLE \`versions\` ADD \`publisher\` text;
184
- --> statement-breakpoint
185
- ALTER TABLE \`metadata\` ADD \`publisher\` text;
186
- `;
187
- const migrationSql_0007_add_required_to_properties = `ALTER TABLE \`properties\` ADD \`required\` integer DEFAULT 0;
188
- `;
189
- const migrationSql_0008_add_revoked_at_to_seeds = `ALTER TABLE \`seeds\` ADD \`revoked_at\` integer;
190
- `;
191
- const migrationSql_0009_happy_namor = `PRAGMA foreign_keys=OFF;--> statement-breakpoint
192
- CREATE TABLE \`__new_property_uids\` (
193
- \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
194
- \`uid\` text NOT NULL,
195
- \`property_id\` integer NOT NULL,
196
- FOREIGN KEY (\`property_id\`) REFERENCES \`properties\`(\`id\`) ON UPDATE no action ON DELETE no action
197
- );
198
- --> statement-breakpoint
199
- INSERT INTO \`__new_property_uids\`("id", "uid", "property_id") SELECT "id", "uid", "property_id" FROM \`property_uids\`;--> statement-breakpoint
200
- DROP TABLE \`property_uids\`;--> statement-breakpoint
201
- ALTER TABLE \`__new_property_uids\` RENAME TO \`property_uids\`;--> statement-breakpoint
202
- PRAGMA foreign_keys=ON;--> statement-breakpoint
203
- CREATE UNIQUE INDEX \`property_uids_property_id_unique\` ON \`property_uids\` (\`property_id\`);--> statement-breakpoint
204
- ALTER TABLE \`metadata\` ADD \`property_id\` integer REFERENCES properties(id);`;
205
- const migrationSql_0010_add_arweave_l1_finalize_jobs = `CREATE TABLE \`arweave_l1_finalize_jobs\` (
206
- \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
207
- \`seed_local_id\` text NOT NULL,
208
- \`data_item_id\` text NOT NULL,
209
- \`l1_transaction_id\` text,
210
- \`bundle_id\` text,
211
- \`version_local_id\` text,
212
- \`item_property_name\` text,
213
- \`phase\` text NOT NULL,
214
- \`status_json\` text,
215
- \`error_message\` text,
216
- \`created_at\` integer NOT NULL,
217
- \`updated_at\` integer NOT NULL
218
- );
219
- --> statement-breakpoint
220
- CREATE UNIQUE INDEX \`arweave_l1_finalize_jobs_data_item_id_unique\` ON \`arweave_l1_finalize_jobs\` (\`data_item_id\`);
221
- `;
222
- const migrationSql_0011_normalize_placeholder_uids = `UPDATE \`versions\` SET \`uid\` = NULL WHERE \`uid\` = 'NULL';
223
- --> statement-breakpoint
224
- UPDATE \`versions\` SET \`seed_uid\` = NULL WHERE \`seed_uid\` = 'NULL';
225
- --> statement-breakpoint
226
- UPDATE \`metadata\` SET \`uid\` = NULL WHERE \`uid\` = 'NULL';
227
- --> statement-breakpoint
228
- UPDATE \`metadata\` SET \`version_uid\` = NULL WHERE \`version_uid\` = 'NULL';
229
- --> statement-breakpoint
230
- UPDATE \`seeds\` SET \`uid\` = NULL WHERE \`uid\` = 'NULL';
231
- `;
232
- const migrationSql_0012_html_embedded_image_co_publish = `CREATE TABLE \`html_embedded_image_co_publish\` (
233
- \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
234
- \`parent_seed_local_id\` text NOT NULL,
235
- \`html_seed_local_id\` text NOT NULL,
236
- \`image_seed_local_id\` text NOT NULL,
237
- \`stable_key\` text NOT NULL,
238
- \`created_at\` integer NOT NULL
239
- );
240
- --> statement-breakpoint
241
- CREATE UNIQUE INDEX \`html_embed_co_pub_parent_html_stable\` ON \`html_embedded_image_co_publish\` (\`parent_seed_local_id\`,\`html_seed_local_id\`,\`stable_key\`);
242
- `;
243
- const migrationSql_0013_eas_sync_processes = `CREATE TABLE \`eas_sync_processes\` (
244
- \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
245
- \`status\` text NOT NULL,
246
- \`started_at\` integer NOT NULL,
247
- \`completed_at\` integer,
248
- \`request_payload\` text NOT NULL,
249
- \`error_message\` text,
250
- \`error_details\` text,
251
- \`persisted_snapshot\` text NOT NULL,
252
- \`created_at\` integer,
253
- \`updated_at\` integer
254
- );
255
- `;
256
- // Journal JSON file
257
- const journalJson = `{
258
- "version": "7",
259
- "dialect": "sqlite",
260
- "entries": [
261
- {
262
- "idx": 0,
263
- "version": "6",
264
- "when": 1765976502903,
265
- "tag": "0000_married_malice",
266
- "breakpoints": true
267
- },
268
- {
269
- "idx": 1,
270
- "version": "6",
271
- "when": 1766010851770,
272
- "tag": "0001_sweet_bruce_banner",
273
- "breakpoints": true
274
- },
275
- {
276
- "idx": 2,
277
- "version": "6",
278
- "when": 1767621120087,
279
- "tag": "0002_bitter_proudstar",
280
- "breakpoints": true
281
- },
282
- {
283
- "idx": 3,
284
- "version": "6",
285
- "when": 1768415440282,
286
- "tag": "0003_cultured_senator_kelly",
287
- "breakpoints": true
288
- },
289
- {
290
- "idx": 4,
291
- "version": "6",
292
- "when": 1768500000000,
293
- "tag": "0004_add_publisher_to_seeds",
294
- "breakpoints": true
295
- },
296
- {
297
- "idx": 5,
298
- "version": "6",
299
- "when": 1772489937031,
300
- "tag": "0005_bright_lily_hollister",
301
- "breakpoints": true
302
- },
303
- {
304
- "idx": 6,
305
- "version": "6",
306
- "when": 1772600000000,
307
- "tag": "0006_add_publisher_to_versions_and_metadata",
308
- "breakpoints": true
309
- },
310
- {
311
- "idx": 7,
312
- "version": "6",
313
- "when": 1772700000000,
314
- "tag": "0007_add_required_to_properties",
315
- "breakpoints": true
316
- },
317
- {
318
- "idx": 8,
319
- "version": "6",
320
- "when": 1772800000000,
321
- "tag": "0008_add_revoked_at_to_seeds",
322
- "breakpoints": true
323
- },
324
- {
325
- "idx": 9,
326
- "version": "6",
327
- "when": 1773924021107,
328
- "tag": "0009_happy_namor",
329
- "breakpoints": true
330
- },
331
- {
332
- "idx": 10,
333
- "version": "6",
334
- "when": 1774000000000,
335
- "tag": "0010_add_arweave_l1_finalize_jobs",
336
- "breakpoints": true
337
- },
338
- {
339
- "idx": 11,
340
- "version": "6",
341
- "when": 1774100000000,
342
- "tag": "0011_normalize_placeholder_uids",
343
- "breakpoints": true
344
- },
345
- {
346
- "idx": 12,
347
- "version": "6",
348
- "when": 1774200000000,
349
- "tag": "0012_html_embedded_image_co_publish",
350
- "breakpoints": true
351
- },
352
- {
353
- "idx": 13,
354
- "version": "6",
355
- "when": 1774300000000,
356
- "tag": "0013_eas_sync_processes",
357
- "breakpoints": true
358
- }
359
- ]
360
- }`;
361
- // Snapshot JSON file - this is large, so we'll import it dynamically if needed
362
- // For now, we'll read it from the actual file if ?raw works, otherwise we'll need to embed it
363
- const snapshotJson = `{
364
- "version": "6",
365
- "dialect": "sqlite",
366
- "id": "a9e8f7d6-c5b4-4321-a0b9-c8d7e6f5a4b3",
367
- "prevId": "ff2318d5-236f-4157-82ae-10ccb44c0e0c",
368
- "tables": {
369
- "appState": {
370
- "name": "appState",
371
- "columns": {
372
- "key": {
373
- "name": "key",
374
- "type": "text",
375
- "primaryKey": false,
376
- "notNull": false,
377
- "autoincrement": false
378
- },
379
- "value": {
380
- "name": "value",
381
- "type": "text",
382
- "primaryKey": false,
383
- "notNull": false,
384
- "autoincrement": false
385
- },
386
- "created_at": {
387
- "name": "created_at",
388
- "type": "integer",
389
- "primaryKey": false,
390
- "notNull": false,
391
- "autoincrement": false
392
- },
393
- "updated_at": {
394
- "name": "updated_at",
395
- "type": "integer",
396
- "primaryKey": false,
397
- "notNull": false,
398
- "autoincrement": false
399
- }
400
- },
401
- "indexes": {
402
- "appState_key_unique": {
403
- "name": "appState_key_unique",
404
- "columns": [
405
- "key"
406
- ],
407
- "isUnique": true
408
- }
409
- },
410
- "foreignKeys": {},
411
- "compositePrimaryKeys": {},
412
- "uniqueConstraints": {},
413
- "checkConstraints": {}
414
- },
415
- "config": {
416
- "name": "config",
417
- "columns": {
418
- "id": {
419
- "name": "id",
420
- "type": "integer",
421
- "primaryKey": true,
422
- "notNull": true,
423
- "autoincrement": true
424
- },
425
- "key": {
426
- "name": "key",
427
- "type": "text",
428
- "primaryKey": false,
429
- "notNull": true,
430
- "autoincrement": false
431
- },
432
- "text": {
433
- "name": "text",
434
- "type": "text",
435
- "primaryKey": false,
436
- "notNull": false,
437
- "autoincrement": false
438
- },
439
- "json": {
440
- "name": "json",
441
- "type": "text",
442
- "primaryKey": false,
443
- "notNull": false,
444
- "autoincrement": false
445
- },
446
- "blob": {
447
- "name": "blob",
448
- "type": "blob",
449
- "primaryKey": false,
450
- "notNull": false,
451
- "autoincrement": false
452
- }
453
- },
454
- "indexes": {},
455
- "foreignKeys": {},
456
- "compositePrimaryKeys": {},
457
- "uniqueConstraints": {},
458
- "checkConstraints": {}
459
- },
460
- "metadata": {
461
- "name": "metadata",
462
- "columns": {
463
- "local_id": {
464
- "name": "local_id",
465
- "type": "text",
466
- "primaryKey": false,
467
- "notNull": false,
468
- "autoincrement": false
469
- },
470
- "uid": {
471
- "name": "uid",
472
- "type": "text",
473
- "primaryKey": false,
474
- "notNull": false,
475
- "autoincrement": false
476
- },
477
- "property_id": {
478
- "name": "property_id",
479
- "type": "integer",
480
- "primaryKey": false,
481
- "notNull": false,
482
- "autoincrement": false
483
- },
484
- "property_name": {
485
- "name": "property_name",
486
- "type": "text",
487
- "primaryKey": false,
488
- "notNull": false,
489
- "autoincrement": false
490
- },
491
- "property_value": {
492
- "name": "property_value",
493
- "type": "text",
494
- "primaryKey": false,
495
- "notNull": false,
496
- "autoincrement": false
497
- },
498
- "schema_uid": {
499
- "name": "schema_uid",
500
- "type": "text",
501
- "primaryKey": false,
502
- "notNull": false,
503
- "autoincrement": false
504
- },
505
- "model_type": {
506
- "name": "model_type",
507
- "type": "text",
508
- "primaryKey": false,
509
- "notNull": false,
510
- "autoincrement": false
511
- },
512
- "seed_local_id": {
513
- "name": "seed_local_id",
514
- "type": "text",
515
- "primaryKey": false,
516
- "notNull": false,
517
- "autoincrement": false
518
- },
519
- "seed_uid": {
520
- "name": "seed_uid",
521
- "type": "text",
522
- "primaryKey": false,
523
- "notNull": false,
524
- "autoincrement": false
525
- },
526
- "version_local_id": {
527
- "name": "version_local_id",
528
- "type": "text",
529
- "primaryKey": false,
530
- "notNull": false,
531
- "autoincrement": false
532
- },
533
- "version_uid": {
534
- "name": "version_uid",
535
- "type": "text",
536
- "primaryKey": false,
537
- "notNull": false,
538
- "autoincrement": false
539
- },
540
- "eas_data_type": {
541
- "name": "eas_data_type",
542
- "type": "text",
543
- "primaryKey": false,
544
- "notNull": false,
545
- "autoincrement": false
546
- },
547
- "ref_value_type": {
548
- "name": "ref_value_type",
549
- "type": "text",
550
- "primaryKey": false,
551
- "notNull": false,
552
- "autoincrement": false
553
- },
554
- "ref_schema_uid": {
555
- "name": "ref_schema_uid",
556
- "type": "text",
557
- "primaryKey": false,
558
- "notNull": false,
559
- "autoincrement": false
560
- },
561
- "ref_seed_type": {
562
- "name": "ref_seed_type",
563
- "type": "text",
564
- "primaryKey": false,
565
- "notNull": false,
566
- "autoincrement": false
567
- },
568
- "ref_resolved_value": {
569
- "name": "ref_resolved_value",
570
- "type": "text",
571
- "primaryKey": false,
572
- "notNull": false,
573
- "autoincrement": false
574
- },
575
- "ref_resolved_display_value": {
576
- "name": "ref_resolved_display_value",
577
- "type": "text",
578
- "primaryKey": false,
579
- "notNull": false,
580
- "autoincrement": false
581
- },
582
- "local_storage_dir": {
583
- "name": "local_storage_dir",
584
- "type": "text",
585
- "primaryKey": false,
586
- "notNull": false,
587
- "autoincrement": false
588
- },
589
- "attestation_raw": {
590
- "name": "attestation_raw",
591
- "type": "text",
592
- "primaryKey": false,
593
- "notNull": false,
594
- "autoincrement": false
595
- },
596
- "attestation_created_at": {
597
- "name": "attestation_created_at",
598
- "type": "integer",
599
- "primaryKey": false,
600
- "notNull": false,
601
- "autoincrement": false
602
- },
603
- "content_hash": {
604
- "name": "content_hash",
605
- "type": "text",
606
- "primaryKey": false,
607
- "notNull": false,
608
- "autoincrement": false
609
- },
610
- "created_at": {
611
- "name": "created_at",
612
- "type": "integer",
613
- "primaryKey": false,
614
- "notNull": false,
615
- "autoincrement": false
616
- },
617
- "updated_at": {
618
- "name": "updated_at",
619
- "type": "integer",
620
- "primaryKey": false,
621
- "notNull": false,
622
- "autoincrement": false
623
- },
624
- "publisher": {
625
- "name": "publisher",
626
- "type": "text",
627
- "primaryKey": false,
628
- "notNull": false,
629
- "autoincrement": false
630
- }
631
- },
632
- "indexes": {
633
- "metadata_local_id_unique": {
634
- "name": "metadata_local_id_unique",
635
- "columns": [
636
- "local_id"
637
- ],
638
- "isUnique": true
639
- }
640
- },
641
- "foreignKeys": {
642
- "metadata_property_id_properties_id_fk": {
643
- "name": "metadata_property_id_properties_id_fk",
644
- "tableFrom": "metadata",
645
- "tableTo": "properties",
646
- "columnsFrom": [
647
- "property_id"
648
- ],
649
- "columnsTo": [
650
- "id"
651
- ],
652
- "onDelete": "no action",
653
- "onUpdate": "no action"
654
- }
655
- },
656
- "compositePrimaryKeys": {},
657
- "uniqueConstraints": {},
658
- "checkConstraints": {}
659
- },
660
- "models": {
661
- "name": "models",
662
- "columns": {
663
- "id": {
664
- "name": "id",
665
- "type": "integer",
666
- "primaryKey": true,
667
- "notNull": true,
668
- "autoincrement": true
669
- },
670
- "name": {
671
- "name": "name",
672
- "type": "text",
673
- "primaryKey": false,
674
- "notNull": true,
675
- "autoincrement": false
676
- },
677
- "schema_file_id": {
678
- "name": "schema_file_id",
679
- "type": "text",
680
- "primaryKey": false,
681
- "notNull": false,
682
- "autoincrement": false
683
- },
684
- "is_edited": {
685
- "name": "is_edited",
686
- "type": "integer",
687
- "primaryKey": false,
688
- "notNull": false,
689
- "autoincrement": false
690
- }
691
- },
692
- "indexes": {
693
- "unique_schema_file_id": {
694
- "name": "unique_schema_file_id",
695
- "columns": [
696
- "schema_file_id"
697
- ],
698
- "isUnique": true
699
- }
700
- },
701
- "foreignKeys": {},
702
- "compositePrimaryKeys": {},
703
- "uniqueConstraints": {},
704
- "checkConstraints": {}
705
- },
706
- "properties": {
707
- "name": "properties",
708
- "columns": {
709
- "id": {
710
- "name": "id",
711
- "type": "integer",
712
- "primaryKey": true,
713
- "notNull": true,
714
- "autoincrement": true
715
- },
716
- "name": {
717
- "name": "name",
718
- "type": "text",
719
- "primaryKey": false,
720
- "notNull": true,
721
- "autoincrement": false
722
- },
723
- "data_type": {
724
- "name": "data_type",
725
- "type": "text",
726
- "primaryKey": false,
727
- "notNull": true,
728
- "autoincrement": false
729
- },
730
- "model_id": {
731
- "name": "model_id",
732
- "type": "integer",
733
- "primaryKey": false,
734
- "notNull": true,
735
- "autoincrement": false
736
- },
737
- "ref_model_id": {
738
- "name": "ref_model_id",
739
- "type": "integer",
740
- "primaryKey": false,
741
- "notNull": false,
742
- "autoincrement": false
743
- },
744
- "ref_value_type": {
745
- "name": "ref_value_type",
746
- "type": "text",
747
- "primaryKey": false,
748
- "notNull": false,
749
- "autoincrement": false
750
- },
751
- "schema_file_id": {
752
- "name": "schema_file_id",
753
- "type": "text",
754
- "primaryKey": false,
755
- "notNull": false,
756
- "autoincrement": false
757
- },
758
- "is_edited": {
759
- "name": "is_edited",
760
- "type": "integer",
761
- "primaryKey": false,
762
- "notNull": false,
763
- "autoincrement": false
764
- },
765
- "required": {
766
- "name": "required",
767
- "type": "integer",
768
- "primaryKey": false,
769
- "notNull": false,
770
- "autoincrement": false
771
- }
772
- },
773
- "indexes": {
774
- "unique_name_model_id": {
775
- "name": "unique_name_model_id",
776
- "columns": [
777
- "name",
778
- "model_id"
779
- ],
780
- "isUnique": true
781
- },
782
- "unique_property_schema_file_id": {
783
- "name": "unique_property_schema_file_id",
784
- "columns": [
785
- "schema_file_id"
786
- ],
787
- "isUnique": true
788
- }
789
- },
790
- "foreignKeys": {
791
- "properties_model_id_models_id_fk": {
792
- "name": "properties_model_id_models_id_fk",
793
- "tableFrom": "properties",
794
- "tableTo": "models",
795
- "columnsFrom": [
796
- "model_id"
797
- ],
798
- "columnsTo": [
799
- "id"
800
- ],
801
- "onDelete": "no action",
802
- "onUpdate": "no action"
803
- },
804
- "properties_ref_model_id_models_id_fk": {
805
- "name": "properties_ref_model_id_models_id_fk",
806
- "tableFrom": "properties",
807
- "tableTo": "models",
808
- "columnsFrom": [
809
- "ref_model_id"
810
- ],
811
- "columnsTo": [
812
- "id"
813
- ],
814
- "onDelete": "no action",
815
- "onUpdate": "no action"
816
- }
817
- },
818
- "compositePrimaryKeys": {},
819
- "uniqueConstraints": {},
820
- "checkConstraints": {}
821
- },
822
- "model_schemas": {
823
- "name": "model_schemas",
824
- "columns": {
825
- "id": {
826
- "name": "id",
827
- "type": "integer",
828
- "primaryKey": true,
829
- "notNull": true,
830
- "autoincrement": true
831
- },
832
- "model_id": {
833
- "name": "model_id",
834
- "type": "integer",
835
- "primaryKey": false,
836
- "notNull": false,
837
- "autoincrement": false
838
- },
839
- "schema_id": {
840
- "name": "schema_id",
841
- "type": "integer",
842
- "primaryKey": false,
843
- "notNull": false,
844
- "autoincrement": false
845
- }
846
- },
847
- "indexes": {},
848
- "foreignKeys": {
849
- "model_schemas_model_id_models_id_fk": {
850
- "name": "model_schemas_model_id_models_id_fk",
851
- "tableFrom": "model_schemas",
852
- "tableTo": "models",
853
- "columnsFrom": [
854
- "model_id"
855
- ],
856
- "columnsTo": [
857
- "id"
858
- ],
859
- "onDelete": "no action",
860
- "onUpdate": "no action"
861
- },
862
- "model_schemas_schema_id_schemas_id_fk": {
863
- "name": "model_schemas_schema_id_schemas_id_fk",
864
- "tableFrom": "model_schemas",
865
- "tableTo": "schemas",
866
- "columnsFrom": [
867
- "schema_id"
868
- ],
869
- "columnsTo": [
870
- "id"
871
- ],
872
- "onDelete": "no action",
873
- "onUpdate": "no action"
874
- }
875
- },
876
- "compositePrimaryKeys": {},
877
- "uniqueConstraints": {},
878
- "checkConstraints": {}
879
- },
880
- "model_uids": {
881
- "name": "model_uids",
882
- "columns": {
883
- "id": {
884
- "name": "id",
885
- "type": "integer",
886
- "primaryKey": true,
887
- "notNull": true,
888
- "autoincrement": true
889
- },
890
- "uid": {
891
- "name": "uid",
892
- "type": "text",
893
- "primaryKey": false,
894
- "notNull": true,
895
- "autoincrement": false
896
- },
897
- "model_id": {
898
- "name": "model_id",
899
- "type": "integer",
900
- "primaryKey": false,
901
- "notNull": true,
902
- "autoincrement": false
903
- }
904
- },
905
- "indexes": {
906
- "model_uids_model_id_unique": {
907
- "name": "model_uids_model_id_unique",
908
- "columns": [
909
- "model_id"
910
- ],
911
- "isUnique": true
912
- }
913
- },
914
- "foreignKeys": {
915
- "model_uids_model_id_models_id_fk": {
916
- "name": "model_uids_model_id_models_id_fk",
917
- "tableFrom": "model_uids",
918
- "tableTo": "models",
919
- "columnsFrom": [
920
- "model_id"
921
- ],
922
- "columnsTo": [
923
- "id"
924
- ],
925
- "onDelete": "no action",
926
- "onUpdate": "no action"
927
- }
928
- },
929
- "compositePrimaryKeys": {},
930
- "uniqueConstraints": {},
931
- "checkConstraints": {}
932
- },
933
- "property_uids": {
934
- "name": "property_uids",
935
- "columns": {
936
- "id": {
937
- "name": "id",
938
- "type": "integer",
939
- "primaryKey": true,
940
- "notNull": true,
941
- "autoincrement": true
942
- },
943
- "uid": {
944
- "name": "uid",
945
- "type": "text",
946
- "primaryKey": false,
947
- "notNull": true,
948
- "autoincrement": false
949
- },
950
- "property_id": {
951
- "name": "property_id",
952
- "type": "integer",
953
- "primaryKey": false,
954
- "notNull": true,
955
- "autoincrement": false
956
- }
957
- },
958
- "indexes": {
959
- "property_uids_property_id_unique": {
960
- "name": "property_uids_property_id_unique",
961
- "columns": [
962
- "property_id"
963
- ],
964
- "isUnique": true
965
- }
966
- },
967
- "foreignKeys": {
968
- "property_uids_property_id_properties_id_fk": {
969
- "name": "property_uids_property_id_properties_id_fk",
970
- "tableFrom": "property_uids",
971
- "tableTo": "properties",
972
- "columnsFrom": [
973
- "property_id"
974
- ],
975
- "columnsTo": [
976
- "id"
977
- ],
978
- "onDelete": "no action",
979
- "onUpdate": "no action"
980
- }
981
- },
982
- "compositePrimaryKeys": {},
983
- "uniqueConstraints": {},
984
- "checkConstraints": {}
985
- },
986
- "publish_processes": {
987
- "name": "publish_processes",
988
- "columns": {
989
- "id": {
990
- "name": "id",
991
- "type": "integer",
992
- "primaryKey": true,
993
- "notNull": true,
994
- "autoincrement": true
995
- },
996
- "seed_local_id": {
997
- "name": "seed_local_id",
998
- "type": "text",
999
- "primaryKey": false,
1000
- "notNull": true,
1001
- "autoincrement": false
1002
- },
1003
- "model_name": {
1004
- "name": "model_name",
1005
- "type": "text",
1006
- "primaryKey": false,
1007
- "notNull": true,
1008
- "autoincrement": false
1009
- },
1010
- "schema_id": {
1011
- "name": "schema_id",
1012
- "type": "text",
1013
- "primaryKey": false,
1014
- "notNull": false,
1015
- "autoincrement": false
1016
- },
1017
- "status": {
1018
- "name": "status",
1019
- "type": "text",
1020
- "primaryKey": false,
1021
- "notNull": true,
1022
- "autoincrement": false
1023
- },
1024
- "started_at": {
1025
- "name": "started_at",
1026
- "type": "integer",
1027
- "primaryKey": false,
1028
- "notNull": true,
1029
- "autoincrement": false
1030
- },
1031
- "completed_at": {
1032
- "name": "completed_at",
1033
- "type": "integer",
1034
- "primaryKey": false,
1035
- "notNull": false,
1036
- "autoincrement": false
1037
- },
1038
- "error_message": {
1039
- "name": "error_message",
1040
- "type": "text",
1041
- "primaryKey": false,
1042
- "notNull": false,
1043
- "autoincrement": false
1044
- },
1045
- "error_step": {
1046
- "name": "error_step",
1047
- "type": "text",
1048
- "primaryKey": false,
1049
- "notNull": false,
1050
- "autoincrement": false
1051
- },
1052
- "error_details": {
1053
- "name": "error_details",
1054
- "type": "text",
1055
- "primaryKey": false,
1056
- "notNull": false,
1057
- "autoincrement": false
1058
- },
1059
- "persisted_snapshot": {
1060
- "name": "persisted_snapshot",
1061
- "type": "text",
1062
- "primaryKey": false,
1063
- "notNull": true,
1064
- "autoincrement": false
1065
- },
1066
- "seed_id": {
1067
- "name": "seed_id",
1068
- "type": "text",
1069
- "primaryKey": false,
1070
- "notNull": false,
1071
- "autoincrement": false
1072
- },
1073
- "existing_seed_uid": {
1074
- "name": "existing_seed_uid",
1075
- "type": "text",
1076
- "primaryKey": false,
1077
- "notNull": false,
1078
- "autoincrement": false
1079
- },
1080
- "created_at": {
1081
- "name": "created_at",
1082
- "type": "integer",
1083
- "primaryKey": false,
1084
- "notNull": false,
1085
- "autoincrement": false
1086
- },
1087
- "updated_at": {
1088
- "name": "updated_at",
1089
- "type": "integer",
1090
- "primaryKey": false,
1091
- "notNull": false,
1092
- "autoincrement": false
1093
- }
1094
- },
1095
- "indexes": {},
1096
- "foreignKeys": {},
1097
- "compositePrimaryKeys": {},
1098
- "uniqueConstraints": {},
1099
- "checkConstraints": {}
1100
- },
1101
- "schemas": {
1102
- "name": "schemas",
1103
- "columns": {
1104
- "id": {
1105
- "name": "id",
1106
- "type": "integer",
1107
- "primaryKey": true,
1108
- "notNull": true,
1109
- "autoincrement": true
1110
- },
1111
- "name": {
1112
- "name": "name",
1113
- "type": "text",
1114
- "primaryKey": false,
1115
- "notNull": true,
1116
- "autoincrement": false
1117
- },
1118
- "version": {
1119
- "name": "version",
1120
- "type": "integer",
1121
- "primaryKey": false,
1122
- "notNull": true,
1123
- "autoincrement": false
1124
- },
1125
- "schema_file_id": {
1126
- "name": "schema_file_id",
1127
- "type": "text",
1128
- "primaryKey": false,
1129
- "notNull": false,
1130
- "autoincrement": false
1131
- },
1132
- "schema_data": {
1133
- "name": "schema_data",
1134
- "type": "text",
1135
- "primaryKey": false,
1136
- "notNull": false,
1137
- "autoincrement": false
1138
- },
1139
- "is_draft": {
1140
- "name": "is_draft",
1141
- "type": "integer",
1142
- "primaryKey": false,
1143
- "notNull": false,
1144
- "autoincrement": false
1145
- },
1146
- "is_edited": {
1147
- "name": "is_edited",
1148
- "type": "integer",
1149
- "primaryKey": false,
1150
- "notNull": false,
1151
- "autoincrement": false
1152
- },
1153
- "created_at": {
1154
- "name": "created_at",
1155
- "type": "integer",
1156
- "primaryKey": false,
1157
- "notNull": false,
1158
- "autoincrement": false
1159
- },
1160
- "updated_at": {
1161
- "name": "updated_at",
1162
- "type": "integer",
1163
- "primaryKey": false,
1164
- "notNull": false,
1165
- "autoincrement": false
1166
- }
1167
- },
1168
- "indexes": {
1169
- "unique_schema_schema_file_id": {
1170
- "name": "unique_schema_schema_file_id",
1171
- "columns": [
1172
- "schema_file_id"
1173
- ],
1174
- "isUnique": true
1175
- }
1176
- },
1177
- "foreignKeys": {},
1178
- "compositePrimaryKeys": {},
1179
- "uniqueConstraints": {},
1180
- "checkConstraints": {}
1181
- },
1182
- "seeds": {
1183
- "name": "seeds",
1184
- "columns": {
1185
- "local_id": {
1186
- "name": "local_id",
1187
- "type": "text",
1188
- "primaryKey": false,
1189
- "notNull": false,
1190
- "autoincrement": false
1191
- },
1192
- "uid": {
1193
- "name": "uid",
1194
- "type": "text",
1195
- "primaryKey": false,
1196
- "notNull": false,
1197
- "autoincrement": false
1198
- },
1199
- "schema_uid": {
1200
- "name": "schema_uid",
1201
- "type": "text",
1202
- "primaryKey": false,
1203
- "notNull": false,
1204
- "autoincrement": false
1205
- },
1206
- "type": {
1207
- "name": "type",
1208
- "type": "text",
1209
- "primaryKey": false,
1210
- "notNull": false,
1211
- "autoincrement": false
1212
- },
1213
- "publisher": {
1214
- "name": "publisher",
1215
- "type": "text",
1216
- "primaryKey": false,
1217
- "notNull": false,
1218
- "autoincrement": false
1219
- },
1220
- "attestation_raw": {
1221
- "name": "attestation_raw",
1222
- "type": "text",
1223
- "primaryKey": false,
1224
- "notNull": false,
1225
- "autoincrement": false
1226
- },
1227
- "attestation_created_at": {
1228
- "name": "attestation_created_at",
1229
- "type": "integer",
1230
- "primaryKey": false,
1231
- "notNull": false,
1232
- "autoincrement": false
1233
- },
1234
- "created_at": {
1235
- "name": "created_at",
1236
- "type": "integer",
1237
- "primaryKey": false,
1238
- "notNull": false,
1239
- "autoincrement": false
1240
- },
1241
- "updated_at": {
1242
- "name": "updated_at",
1243
- "type": "integer",
1244
- "primaryKey": false,
1245
- "notNull": false,
1246
- "autoincrement": false
1247
- },
1248
- "_marked_for_deletion": {
1249
- "name": "_marked_for_deletion",
1250
- "type": "integer",
1251
- "primaryKey": false,
1252
- "notNull": false,
1253
- "autoincrement": false
1254
- },
1255
- "revoked_at": {
1256
- "name": "revoked_at",
1257
- "type": "integer",
1258
- "primaryKey": false,
1259
- "notNull": false,
1260
- "autoincrement": false
1261
- }
1262
- },
1263
- "indexes": {
1264
- "seeds_local_id_unique": {
1265
- "name": "seeds_local_id_unique",
1266
- "columns": [
1267
- "local_id"
1268
- ],
1269
- "isUnique": true
1270
- }
1271
- },
1272
- "foreignKeys": {},
1273
- "compositePrimaryKeys": {},
1274
- "uniqueConstraints": {},
1275
- "checkConstraints": {}
1276
- },
1277
- "upload_processes": {
1278
- "name": "upload_processes",
1279
- "columns": {
1280
- "id": {
1281
- "name": "id",
1282
- "type": "integer",
1283
- "primaryKey": true,
1284
- "notNull": true,
1285
- "autoincrement": true
1286
- },
1287
- "reimbursement_confirmed": {
1288
- "name": "reimbursement_confirmed",
1289
- "type": "integer",
1290
- "primaryKey": false,
1291
- "notNull": true,
1292
- "autoincrement": false
1293
- },
1294
- "reimbursement_transaction_id": {
1295
- "name": "reimbursement_transaction_id",
1296
- "type": "text",
1297
- "primaryKey": false,
1298
- "notNull": false,
1299
- "autoincrement": false
1300
- },
1301
- "transaction_keys": {
1302
- "name": "transaction_keys",
1303
- "type": "text",
1304
- "primaryKey": false,
1305
- "notNull": false,
1306
- "autoincrement": false
1307
- },
1308
- "persisted_snapshot": {
1309
- "name": "persisted_snapshot",
1310
- "type": "text",
1311
- "primaryKey": false,
1312
- "notNull": true,
1313
- "autoincrement": false
1314
- },
1315
- "created_at": {
1316
- "name": "created_at",
1317
- "type": "integer",
1318
- "primaryKey": false,
1319
- "notNull": false,
1320
- "autoincrement": false
1321
- },
1322
- "updated_at": {
1323
- "name": "updated_at",
1324
- "type": "integer",
1325
- "primaryKey": false,
1326
- "notNull": false,
1327
- "autoincrement": false
1328
- }
1329
- },
1330
- "indexes": {},
1331
- "foreignKeys": {},
1332
- "compositePrimaryKeys": {},
1333
- "uniqueConstraints": {},
1334
- "checkConstraints": {}
1335
- },
1336
- "versions": {
1337
- "name": "versions",
1338
- "columns": {
1339
- "local_id": {
1340
- "name": "local_id",
1341
- "type": "text",
1342
- "primaryKey": false,
1343
- "notNull": false,
1344
- "autoincrement": false
1345
- },
1346
- "uid": {
1347
- "name": "uid",
1348
- "type": "text",
1349
- "primaryKey": false,
1350
- "notNull": false,
1351
- "autoincrement": false
1352
- },
1353
- "seed_local_id": {
1354
- "name": "seed_local_id",
1355
- "type": "text",
1356
- "primaryKey": false,
1357
- "notNull": false,
1358
- "autoincrement": false
1359
- },
1360
- "seed_uid": {
1361
- "name": "seed_uid",
1362
- "type": "text",
1363
- "primaryKey": false,
1364
- "notNull": false,
1365
- "autoincrement": false
1366
- },
1367
- "seed_type": {
1368
- "name": "seed_type",
1369
- "type": "text",
1370
- "primaryKey": false,
1371
- "notNull": false,
1372
- "autoincrement": false
1373
- },
1374
- "note": {
1375
- "name": "note",
1376
- "type": "text",
1377
- "primaryKey": false,
1378
- "notNull": false,
1379
- "autoincrement": false
1380
- },
1381
- "created_at": {
1382
- "name": "created_at",
1383
- "type": "integer",
1384
- "primaryKey": false,
1385
- "notNull": false,
1386
- "autoincrement": false
1387
- },
1388
- "updated_at": {
1389
- "name": "updated_at",
1390
- "type": "integer",
1391
- "primaryKey": false,
1392
- "notNull": false,
1393
- "autoincrement": false
1394
- },
1395
- "attestation_created_at": {
1396
- "name": "attestation_created_at",
1397
- "type": "integer",
1398
- "primaryKey": false,
1399
- "notNull": false,
1400
- "autoincrement": false
1401
- },
1402
- "attestation_raw": {
1403
- "name": "attestation_raw",
1404
- "type": "text",
1405
- "primaryKey": false,
1406
- "notNull": false,
1407
- "autoincrement": false
1408
- },
1409
- "publisher": {
1410
- "name": "publisher",
1411
- "type": "text",
1412
- "primaryKey": false,
1413
- "notNull": false,
1414
- "autoincrement": false
1415
- }
1416
- },
1417
- "indexes": {
1418
- "versions_local_id_unique": {
1419
- "name": "versions_local_id_unique",
1420
- "columns": [
1421
- "local_id"
1422
- ],
1423
- "isUnique": true
1424
- }
1425
- },
1426
- "foreignKeys": {},
1427
- "compositePrimaryKeys": {},
1428
- "uniqueConstraints": {},
1429
- "checkConstraints": {}
1430
- },
1431
- "arweave_l1_finalize_jobs": {
1432
- "name": "arweave_l1_finalize_jobs",
1433
- "columns": {
1434
- "id": {
1435
- "name": "id",
1436
- "type": "integer",
1437
- "primaryKey": true,
1438
- "notNull": true,
1439
- "autoincrement": true
1440
- },
1441
- "seed_local_id": {
1442
- "name": "seed_local_id",
1443
- "type": "text",
1444
- "primaryKey": false,
1445
- "notNull": true,
1446
- "autoincrement": false
1447
- },
1448
- "data_item_id": {
1449
- "name": "data_item_id",
1450
- "type": "text",
1451
- "primaryKey": false,
1452
- "notNull": true,
1453
- "autoincrement": false
1454
- },
1455
- "l1_transaction_id": {
1456
- "name": "l1_transaction_id",
1457
- "type": "text",
1458
- "primaryKey": false,
1459
- "notNull": false,
1460
- "autoincrement": false
1461
- },
1462
- "bundle_id": {
1463
- "name": "bundle_id",
1464
- "type": "text",
1465
- "primaryKey": false,
1466
- "notNull": false,
1467
- "autoincrement": false
1468
- },
1469
- "version_local_id": {
1470
- "name": "version_local_id",
1471
- "type": "text",
1472
- "primaryKey": false,
1473
- "notNull": false,
1474
- "autoincrement": false
1475
- },
1476
- "item_property_name": {
1477
- "name": "item_property_name",
1478
- "type": "text",
1479
- "primaryKey": false,
1480
- "notNull": false,
1481
- "autoincrement": false
1482
- },
1483
- "phase": {
1484
- "name": "phase",
1485
- "type": "text",
1486
- "primaryKey": false,
1487
- "notNull": true,
1488
- "autoincrement": false
1489
- },
1490
- "status_json": {
1491
- "name": "status_json",
1492
- "type": "text",
1493
- "primaryKey": false,
1494
- "notNull": false,
1495
- "autoincrement": false
1496
- },
1497
- "error_message": {
1498
- "name": "error_message",
1499
- "type": "text",
1500
- "primaryKey": false,
1501
- "notNull": false,
1502
- "autoincrement": false
1503
- },
1504
- "created_at": {
1505
- "name": "created_at",
1506
- "type": "integer",
1507
- "primaryKey": false,
1508
- "notNull": true,
1509
- "autoincrement": false
1510
- },
1511
- "updated_at": {
1512
- "name": "updated_at",
1513
- "type": "integer",
1514
- "primaryKey": false,
1515
- "notNull": true,
1516
- "autoincrement": false
1517
- }
1518
- },
1519
- "indexes": {
1520
- "arweave_l1_finalize_jobs_data_item_id_unique": {
1521
- "name": "arweave_l1_finalize_jobs_data_item_id_unique",
1522
- "columns": [
1523
- "data_item_id"
1524
- ],
1525
- "isUnique": true
1526
- }
1527
- },
1528
- "foreignKeys": {},
1529
- "compositePrimaryKeys": {},
1530
- "uniqueConstraints": {},
1531
- "checkConstraints": {}
1532
- },
1533
- "eas_sync_processes": {
1534
- "name": "eas_sync_processes",
1535
- "columns": {
1536
- "id": {
1537
- "name": "id",
1538
- "type": "integer",
1539
- "primaryKey": true,
1540
- "notNull": true,
1541
- "autoincrement": true
1542
- },
1543
- "status": {
1544
- "name": "status",
1545
- "type": "text",
1546
- "primaryKey": false,
1547
- "notNull": true,
1548
- "autoincrement": false
1549
- },
1550
- "started_at": {
1551
- "name": "started_at",
1552
- "type": "integer",
1553
- "primaryKey": false,
1554
- "notNull": true,
1555
- "autoincrement": false
1556
- },
1557
- "completed_at": {
1558
- "name": "completed_at",
1559
- "type": "integer",
1560
- "primaryKey": false,
1561
- "notNull": false,
1562
- "autoincrement": false
1563
- },
1564
- "request_payload": {
1565
- "name": "request_payload",
1566
- "type": "text",
1567
- "primaryKey": false,
1568
- "notNull": true,
1569
- "autoincrement": false
1570
- },
1571
- "error_message": {
1572
- "name": "error_message",
1573
- "type": "text",
1574
- "primaryKey": false,
1575
- "notNull": false,
1576
- "autoincrement": false
1577
- },
1578
- "error_details": {
1579
- "name": "error_details",
1580
- "type": "text",
1581
- "primaryKey": false,
1582
- "notNull": false,
1583
- "autoincrement": false
1584
- },
1585
- "persisted_snapshot": {
1586
- "name": "persisted_snapshot",
1587
- "type": "text",
1588
- "primaryKey": false,
1589
- "notNull": true,
1590
- "autoincrement": false
1591
- },
1592
- "created_at": {
1593
- "name": "created_at",
1594
- "type": "integer",
1595
- "primaryKey": false,
1596
- "notNull": false,
1597
- "autoincrement": false
1598
- },
1599
- "updated_at": {
1600
- "name": "updated_at",
1601
- "type": "integer",
1602
- "primaryKey": false,
1603
- "notNull": false,
1604
- "autoincrement": false
1605
- }
1606
- },
1607
- "indexes": {},
1608
- "foreignKeys": {},
1609
- "compositePrimaryKeys": {},
1610
- "uniqueConstraints": {},
1611
- "checkConstraints": {}
1612
- }
1613
- },
1614
- "views": {},
1615
- "enums": {},
1616
- "_meta": {
1617
- "schemas": {},
1618
- "tables": {},
1619
- "columns": {}
1620
- },
1621
- "internal": {
1622
- "indexes": {}
1623
- }
1624
- }`;
1625
-
1626
- var drizzleFiles = /*#__PURE__*/Object.freeze({
1627
- __proto__: null,
1628
- journalJson: journalJson,
1629
- migrationSql_0000_married_malice: migrationSql_0000_married_malice,
1630
- migrationSql_0001_sweet_bruce_banner: migrationSql_0001_sweet_bruce_banner,
1631
- migrationSql_0002_bitter_proudstar: migrationSql_0002_bitter_proudstar,
1632
- migrationSql_0003_cultured_senator_kelly: migrationSql_0003_cultured_senator_kelly,
1633
- migrationSql_0004_add_publisher_to_seeds: migrationSql_0004_add_publisher_to_seeds,
1634
- migrationSql_0005_bright_lily_hollister: migrationSql_0005_bright_lily_hollister,
1635
- migrationSql_0006_add_publisher_to_versions_and_metadata: migrationSql_0006_add_publisher_to_versions_and_metadata,
1636
- migrationSql_0007_add_required_to_properties: migrationSql_0007_add_required_to_properties,
1637
- migrationSql_0008_add_revoked_at_to_seeds: migrationSql_0008_add_revoked_at_to_seeds,
1638
- migrationSql_0009_happy_namor: migrationSql_0009_happy_namor,
1639
- migrationSql_0010_add_arweave_l1_finalize_jobs: migrationSql_0010_add_arweave_l1_finalize_jobs,
1640
- migrationSql_0011_normalize_placeholder_uids: migrationSql_0011_normalize_placeholder_uids,
1641
- migrationSql_0012_html_embedded_image_co_publish: migrationSql_0012_html_embedded_image_co_publish,
1642
- migrationSql_0013_eas_sync_processes: migrationSql_0013_eas_sync_processes,
1643
- snapshotJson: snapshotJson
1644
- });
1645
-
1646
- const logger = debug('seedSdk:browser:db:Db');
1647
- class Db extends BaseDb {
1648
- constructor() {
1649
- super();
1650
- }
1651
- static getAppDb() {
1652
- return this.appDb;
1653
- }
1654
- static isAppDbReady() {
1655
- return !!this.appDb;
1656
- }
1657
- static async prepareDb(filesDir) {
1658
- logger('[Db.prepareDb] preparing database');
1659
- this.filesDir = filesDir;
1660
- try {
1661
- // Copy drizzle migration files from src/db/drizzle to filesDir/db
1662
- await this.copyDrizzleFiles(filesDir);
1663
- // Ensure meta directory exists
1664
- const metaDirPath = `${filesDir}/db/meta`;
1665
- await BaseFileManager.createDirIfNotExists(metaDirPath);
1666
- // Ensure _journal.json file exists in meta directory
1667
- const journalFilePath = `${metaDirPath}/_journal.json`;
1668
- const journalExists = await BaseFileManager.pathExists(journalFilePath);
1669
- if (!journalExists) {
1670
- await BaseFileManager.saveFile(journalFilePath, JSON.stringify({
1671
- version: 1,
1672
- dialect: 'sqlite',
1673
- entries: [],
1674
- }, null, 2));
1675
- }
1676
- // Wait for journal file to be fully written before proceeding with migration
1677
- // This is critical in browser/OPFS where writes may not be immediately readable
1678
- logger('[Db.prepareDb] waiting for journal file to be fully written...');
1679
- await BaseFileManager.waitForFileWithContent(journalFilePath, 100, 5000);
1680
- logger('[Db.prepareDb] journal file is ready');
1681
- // Initialize SQLocalDrizzle with reactive: true to enable reactive queries
1682
- const sqlocalDrizzle = new SQLocalDrizzle({
1683
- databasePath: `${this.filesDir}/db/seed.db`,
1684
- reactive: true // Enable reactive queries
1685
- });
1686
- const { driver, batchDriver } = sqlocalDrizzle;
1687
- // Store SQLocalDrizzle instance for reactive queries
1688
- this.sqlocalInstance = sqlocalDrizzle;
1689
- // Create db instance but do NOT set this.appDb yet. restoreFromDb (and other
1690
- // callers of getAppDb()) must not see the db until migrations have completed,
1691
- // otherwise they may query tables (e.g. publish_processes) that don't exist yet.
1692
- const db = drizzle(driver, batchDriver, {
1693
- schema,
1694
- });
1695
- logger('[Db.prepareDb] database prepared');
1696
- await this.runMigrations(db);
1697
- this.appDb = db;
1698
- const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-CKTfvFgQ.js');
1699
- await backfillMetadataPropertyIds();
1700
- return this.appDb;
1701
- }
1702
- catch (error) {
1703
- logger('[Db.prepareDb] error', JSON.stringify(error));
1704
- throw error;
1705
- }
1706
- }
1707
- // static async prepareDb(filesDir: string) {
1708
- // console.log('prepareDb', filesDir)
1709
- // if (Db.sqliteWasmClient) {
1710
- // return this.dbId
1711
- // }
1712
- // this.filesDir = filesDir
1713
- // this.pathToDb = `${filesDir}/db/${DB_NAME_APP}.db`
1714
- // if (typeof document === 'undefined') {
1715
- // return
1716
- // }
1717
- // let promiser
1718
- // try {
1719
- // let sqlite3Worker1Promiser
1720
- // const sqliteWasm = await import('@sqlite.org/sqlite-wasm')
1721
- // if (sqliteWasm && sqliteWasm.sqlite3Worker1Promiser) {
1722
- // sqlite3Worker1Promiser = sqliteWasm.sqlite3Worker1Promiser
1723
- // }
1724
- // if (!sqlite3Worker1Promiser && window.sqlite3Worker1Promiser) {
1725
- // sqlite3Worker1Promiser = window.sqlite3Worker1Promiser
1726
- // }
1727
- // if (!sqlite3Worker1Promiser) {
1728
- // throw new Error('Failed to load sqlite3Worker1Promiser')
1729
- // }
1730
- // promiser = await new Promise<(event: string, config: Record<string, unknown>) => Promise<any>>((resolve) => {
1731
- // const _promiser = sqlite3Worker1Promiser({
1732
- // onready: () => {
1733
- // resolve(_promiser);
1734
- // },
1735
- // });
1736
- // }).catch((error) => {
1737
- // console.error('Error from sqlite proxy server: ', JSON.stringify(error))
1738
- // });
1739
- // } catch ( e ) {
1740
- // console.error('Error from sqlite proxy server: ', JSON.stringify(e))
1741
- // }
1742
- // if (!promiser) {
1743
- // throw new Error('Failed to create promiser')
1744
- // }
1745
- // this.sqliteWasmClient = promiser
1746
- // const responseGet = await this.sqliteWasmClient('config-get', {});
1747
- // logger('[Db.prepareDb] Running SQLite3 version', responseGet.result.version.libVersion);
1748
- // const responseOpen = await this.sqliteWasmClient('open', {
1749
- // filename: `file:${filesDir}/db/${DB_NAME_APP}.db?vfs=opfs`,
1750
- // });
1751
- // const { dbId } = responseOpen;
1752
- // logger(
1753
- // '[Db.prepareDb] OPFS is available, created persisted database at',
1754
- // responseOpen.result.filename.replace(/^file:(.*?)\?vfs=opfs/, '$1'),
1755
- // );
1756
- // logger('[Db.prepareDb] dbId', dbId)
1757
- // this.dbId = dbId
1758
- // await this.migrate()
1759
- // }
1760
- static async connectToDb(filesDir) {
1761
- return this.dbId;
1762
- }
1763
- static async copyDrizzleFiles(filesDir) {
1764
- logger('[Db.copyDrizzleFiles] copying drizzle migration files');
1765
- try {
1766
- // Ensure db directory exists
1767
- const dbDirPath = `${filesDir}/db`;
1768
- await BaseFileManager.createDirIfNotExists(dbDirPath);
1769
- // Ensure meta directory exists
1770
- const metaDirPath = `${dbDirPath}/meta`;
1771
- await BaseFileManager.createDirIfNotExists(metaDirPath);
1772
- // Parse journal JSON to get all migration entries
1773
- const journal = JSON.parse(journalJson);
1774
- const entries = journal.entries || [];
1775
- if (entries.length === 0) {
1776
- logger('[Db.copyDrizzleFiles] no migration entries found in journal');
1777
- return;
1778
- }
1779
- // Copy each migration SQL file (always overwrite to ensure they're up-to-date)
1780
- // Each migration is exported as a separate variable (e.g., migrationSql_0000_married_malice)
1781
- for (let i = 0; i < entries.length; i++) {
1782
- const entry = entries[i];
1783
- const tag = entry.tag; // e.g., "0000_married_malice"
1784
- const migrationFileName = `${tag}.sql`;
1785
- const migrationPath = `${dbDirPath}/${migrationFileName}`;
1786
- // Get the SQL for this migration from the exported variable
1787
- const migrationVarName = `migrationSql_${tag}`;
1788
- const migrationContent = drizzleFiles[migrationVarName];
1789
- if (!migrationContent) {
1790
- logger(`[Db.copyDrizzleFiles] ERROR: No migration content found for ${migrationFileName} (variable: ${migrationVarName})`);
1791
- throw new Error(`No migration content found for ${migrationFileName}. Expected variable: ${migrationVarName}`);
1792
- }
1793
- await BaseFileManager.saveFile(migrationPath, migrationContent.trim());
1794
- logger(`[Db.copyDrizzleFiles] copied/updated migration SQL file: ${migrationFileName}`);
1795
- }
1796
- // Copy journal JSON file (always overwrite to ensure it's up-to-date with all migrations)
1797
- const journalPath = `${metaDirPath}/_journal.json`;
1798
- await BaseFileManager.saveFile(journalPath, journalJson);
1799
- logger('[Db.copyDrizzleFiles] copied/updated journal JSON file');
1800
- // Copy snapshot JSON file (use the latest snapshot based on the highest idx in journal)
1801
- // Snapshot files are named like: 0000_snapshot.json, 0001_snapshot.json, etc.
1802
- // The tag format is like "0000_married_malice", so we extract the numeric prefix
1803
- const latestEntry = entries[entries.length - 1];
1804
- const tagPrefixMatch = latestEntry.tag.match(/^(\d+_)/);
1805
- const tagPrefix = tagPrefixMatch ? tagPrefixMatch[1] : '0000_';
1806
- const snapshotFileName = `${tagPrefix}snapshot.json`;
1807
- const snapshotPath = `${metaDirPath}/${snapshotFileName}`;
1808
- // Always overwrite snapshot to ensure it's up-to-date
1809
- await BaseFileManager.saveFile(snapshotPath, snapshotJson);
1810
- logger(`[Db.copyDrizzleFiles] copied/updated snapshot JSON file: ${snapshotFileName}`);
1811
- logger('[Db.copyDrizzleFiles] drizzle files copied successfully');
1812
- }
1813
- catch (error) {
1814
- logger('[Db.copyDrizzleFiles] error copying drizzle files', error);
1815
- // Don't throw - the files might already exist or migration might work without them
1816
- // The migration will fail later if the files are truly needed
1817
- }
1818
- }
1819
- /** Internal migration runner. Used by prepareDb before appDb is set. */
1820
- static async runMigrations(db, pathToDbDir) {
1821
- const migrationsFolder = pathToDbDir ?? `${this.filesDir}/db`;
1822
- try {
1823
- logger('[Db.runMigrations] calling readMigrationFiles');
1824
- const migrations = readMigrationFiles({
1825
- migrationsFolder,
1826
- });
1827
- logger('[Db.runMigrations] migrations', migrations);
1828
- await migrate(db, async (queriesToRun) => {
1829
- logger('queriesToRun', queriesToRun);
1830
- for (const query of queriesToRun) {
1831
- logger('query', query);
1832
- await db.run(sql.raw(query));
1833
- }
1834
- }, {
1835
- migrationsFolder,
1836
- });
1837
- logger('[Db.runMigrations] migrations completed');
1838
- }
1839
- catch (error) {
1840
- logger('[Db.runMigrations] error', JSON.stringify(error));
1841
- throw error;
1842
- }
1843
- }
1844
- static async migrate(pathToDbDir, _dbName, _dbId) {
1845
- const targetDb = this.appDb;
1846
- if (!targetDb) {
1847
- throw new Error('Database not prepared');
1848
- }
1849
- await this.runMigrations(targetDb, pathToDbDir);
1850
- }
1851
- // static async migrate(): Promise<void> {
1852
- // const schemaGlobString = `${BROWSER_FS_TOP_DIR}/schema/*`
1853
- // const pathToDbDir = `${this.filesDir}/db`
1854
- // const dbName = DB_NAME_APP
1855
- // logger('[Db.migrate] running migrations')
1856
- // const drizzleDb = drizzle(
1857
- // async (sql, params,) => {
1858
- // try {
1859
- // logger(
1860
- // `executing sql`,
1861
- // sql,
1862
- // )
1863
- // const finalResult = await this.exec(sql, params)
1864
- // // logger(`finalResult with method: ${method}`, finalResult)
1865
- // // Drizzle always waits for {rows: string[][]} or {rows: string[]} for the return value.
1866
- // // When the method is get, you should return a value as {rows: string[]}.
1867
- // // Otherwise, you should return {rows: string[][]}.
1868
- // return { rows: finalResult }
1869
- // } catch (e: any) {
1870
- // console.error('Error from sqlite proxy server: ', JSON.stringify(e))
1871
- // return { rows: [] }
1872
- // }
1873
- // },
1874
- // {
1875
- // schema,
1876
- // // logger: true,
1877
- // },
1878
- // )
1879
- // try {
1880
- // const zenfs = await BaseFileManager.getFs()
1881
- // logger('[Db.migrate] calling readMigrationFiles')
1882
- // const migrations = readMigrationFiles({
1883
- // migrationsFolder: pathToDbDir,
1884
- // })
1885
- // logger('[Db.migrate] migrations', migrations)
1886
- // if (migrations.length > 0) {
1887
- // const incomingMigrationHashes = migrations.map(
1888
- // (migration) => migration.hash,
1889
- // )
1890
- // let existingMigrationHashes
1891
- // let rows = []
1892
- // try {
1893
- // const queryMigrationsTable = await drizzleDb.run(
1894
- // sql.raw(
1895
- // `SELECT name
1896
- // FROM sqlite_master
1897
- // WHERE type='table'
1898
- // AND name='__drizzle_migrations';`,
1899
- // ),
1900
- // )
1901
- // logger('queryMigrationsTable', queryMigrationsTable)
1902
- // if (queryMigrationsTable && queryMigrationsTable.rows && queryMigrationsTable.rows.length > 0) {
1903
- // const query = await drizzleDb.run(
1904
- // sql.raw(
1905
- // `SELECT hash, created_at
1906
- // FROM main.__drizzle_migrations;`,
1907
- // ),
1908
- // )
1909
- // rows = query.rows
1910
- // }
1911
- // } catch (e) {
1912
- // rows = []
1913
- // }
1914
- // if (rows && rows.length > 0) {
1915
- // existingMigrationHashes = rows.map((row) => row[0])
1916
- // }
1917
- // if (existingMigrationHashes) {
1918
- // let shouldRebuildDb = false
1919
- // for (const existingHash of existingMigrationHashes) {
1920
- // if (!incomingMigrationHashes.includes(existingHash)) {
1921
- // shouldRebuildDb = true
1922
- // break
1923
- // }
1924
- // }
1925
- // if (shouldRebuildDb) {
1926
- // await zenfs.promises.unlink(`${pathToDbDir}/${dbName}.db`)
1927
- // }
1928
- // }
1929
- // }
1930
- // logger('[Db.migrate] running migrations')
1931
- // await drizzleMigrate(
1932
- // drizzleDb,
1933
- // async (queriesToRun) => {
1934
- // // logger('queriesToRun', queriesToRun)
1935
- // for (const query of queriesToRun) {
1936
- // // logger('query', query)
1937
- // await drizzleDb.run(sql.raw(query))
1938
- // }
1939
- // },
1940
- // {
1941
- // migrationsFolder: pathToDbDir,
1942
- // },
1943
- // )
1944
- // } catch (error) {
1945
- // logger('[Db.migrate] error', JSON.stringify(error))
1946
- // // await BaseFileManager.waitForFile(`${pathToDbDir}/meta/_journal.json`)
1947
- // // const journalExists = await BaseFileManager.pathExists(
1948
- // // `${pathToDbDir}/meta/_journal.json`,
1949
- // // )
1950
- // // if (journalExists) {
1951
- // // await this.migrate(pathToDbDir, dbName,)
1952
- // // }
1953
- // // if (!journalExists) {
1954
- // // throw new Error('Failed to migrate database')
1955
- // // }
1956
- // }
1957
- // this.appDb = drizzleDb
1958
- // // Old code for migrating the database
1959
- // // const createTempTableQuery = await appDb.run(
1960
- // // sql.raw(
1961
- // // `CREATE TEMP TABLE IF NOT EXISTS temp_last_inserted_id (id INTEGER, table TEXT);`,
1962
- // // ),
1963
- // // )
1964
- // //
1965
- // // logger(
1966
- // // '[db/actors] [migrate] createTempTableQuery',
1967
- // // createTempTableQuery,
1968
- // // )
1969
- // // const triggersQuery = await appDb.run(
1970
- // // sql.raw(
1971
- // // `SELECT name
1972
- // // FROM main.sqlite_master
1973
- // // WHERE type = 'trigger';`,
1974
- // // ),
1975
- // // )
1976
- // //
1977
- // // logger('[db/actors] [migrate] triggersQuery', triggersQuery)
1978
- // //
1979
- // // const triggers = triggersQuery.rows.map((row) => row[0])
1980
- // //
1981
- // // const tablesQuery = await appDb.run(
1982
- // // sql.raw(
1983
- // // `SELECT name
1984
- // // FROM main.sqlite_master
1985
- // // WHERE type = 'table';`,
1986
- // // ),
1987
- // // )
1988
- // //
1989
- // // logger('[db/actors] [migrate] tablesQuery', tablesQuery)
1990
- // //
1991
- // // const tableNames = tablesQuery.rows.map((row) => row[0])
1992
- // // logger('[db/actors] [migrate] tableNames', tableNames)
1993
- // // for (const tableName of tableNames) {
1994
- // // const triggerName = `after_insert_${tableName}`
1995
- // // if (triggers.includes(triggerName)) {
1996
- // // continue
1997
- // // }
1998
- // // const createTriggerQuery = await appDb.run(
1999
- // // sql.raw(
2000
- // // `CREATE TRIGGER after_insert_${tableName}
2001
- // // AFTER INSERT ON ${tableName}
2002
- // // BEGIN
2003
- // // DELETE FROM temp_last_inserted_id;
2004
- // // INSERT INTO temp_last_inserted_id (id) VALUES (new.id);
2005
- // // END;`,
2006
- // // ),
2007
- // // )
2008
- // //
2009
- // // logger(
2010
- // // '[db/actors] [migrate] createTriggerQuery',
2011
- // // createTriggerQuery,
2012
- // // )
2013
- // // }
2014
- // }
2015
- // static async exec(sql: string, params: any[]) {
2016
- // const rowsToReturnRaw: SqliteWasmResult[] = []
2017
- // const rowsValues: string[][] = []
2018
- // // For a single exec command, the callback potentially gets called several times -- once for each row.
2019
- // // So we need to collect all rows into a final array to return (execResult).
2020
- // const rowsToReturn = await new Promise((resolve, reject) => {
2021
- // this.sqliteWasmClient('exec', {
2022
- // dbId:this.dbId,
2023
- // sql,
2024
- // bind: params,
2025
- // callback: (result) => {
2026
- // // Checks if this is the final callback of the query
2027
- // if (!result || !result.row || !result.rowNumber) {
2028
- // const returnResult = []
2029
- // for (const currRow of rowsToReturnRaw) {
2030
- // returnResult.push(currRow.row)
2031
- // }
2032
- // resolve(returnResult)
2033
- // } else {
2034
- // // If not the final response, add this row to the return array
2035
- // rowsToReturnRaw.push(result)
2036
- // }
2037
- // },
2038
- // }).catch(async (error) => {
2039
- // reject(error)
2040
- // })
2041
- // })
2042
- // return rowsToReturn || []
2043
- // }
2044
- /**
2045
- * Execute a reactive query that emits new results whenever the underlying data changes.
2046
- *
2047
- * Supports two usage patterns:
2048
- * 1. SQL tag function: liveQuery((sql) => sql`SELECT * FROM models`)
2049
- * 2. Drizzle query builder: liveQuery(db.select().from(models))
2050
- *
2051
- * @param query - SQL query function or Drizzle query builder
2052
- * @returns Observable that emits arrays of query results
2053
- *
2054
- * @example
2055
- * ```typescript
2056
- * // Using SQL tag function
2057
- * const models$ = Db.liveQuery<ModelRow>(
2058
- * (sql) => sql`SELECT * FROM models WHERE schema_file_id = ${schemaId}`
2059
- * )
2060
- *
2061
- * // Using Drizzle query builder
2062
- * const models$ = Db.liveQuery<ModelRow>(
2063
- * appDb.select().from(models).where(eq(models.schemaFileId, schemaId))
2064
- * )
2065
- *
2066
- * models$.subscribe(models => {
2067
- * console.log('Models updated:', models)
2068
- * })
2069
- * ```
2070
- */
2071
- static liveQuery(query) {
2072
- if (!this.sqlocalInstance) {
2073
- throw new Error('Database not initialized. Call prepareDb first.');
2074
- }
2075
- if (!this.sqlocalInstance.reactiveQuery) {
2076
- throw new Error('Reactive queries not enabled. Initialize SQLocalDrizzle with reactive: true.');
2077
- }
2078
- const baseObservable = new Observable((subscriber) => {
2079
- const reactiveQueryResult = this.sqlocalInstance.reactiveQuery(query);
2080
- const subscription = reactiveQueryResult.subscribe((data) => {
2081
- subscriber.next(data);
2082
- }, (err) => {
2083
- console.error('[BaseDb.liveQuery] SQLocal reactiveQuery error:', err);
2084
- subscriber.error(err);
2085
- });
2086
- return () => {
2087
- subscription.unsubscribe();
2088
- };
2089
- });
2090
- // Compare stable JSON snapshots via keySelector. SQLocal may reuse one array reference
2091
- // and mutate rows in place; comparing (prev, curr) on the same reference makes
2092
- // JSON.stringify(prev) === JSON.stringify(curr) after mutation and suppresses emissions.
2093
- return baseObservable.pipe(distinctUntilChanged((a, b) => a === b, (x) => JSON.stringify(x)));
2094
- }
2095
- }
2096
-
2097
- export { Db };
2098
- //# sourceMappingURL=Db-CF6R7HIy.js.map