@seedprotocol/sdk 0.3.3 → 0.3.5

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 (392) hide show
  1. package/dist/addModel.js +89 -0
  2. package/dist/addModel.js.map +1 -0
  3. package/dist/bin.js +78 -134
  4. package/dist/bin.js.map +1 -1
  5. package/dist/db/configs/browser.app.db.config.ts +1 -0
  6. package/dist/db/configs/node.app.db.config.ts +1 -0
  7. package/dist/main.js +15 -23
  8. package/dist/main.js.map +1 -1
  9. package/dist/node/codegen/templates/model.njk +14 -0
  10. package/dist/scripts/addModel.d.ts +3 -0
  11. package/dist/scripts/addModel.d.ts.map +1 -0
  12. package/dist/scripts/bin.d.ts.map +1 -1
  13. package/dist/src/Item/BaseItem.js +309 -0
  14. package/dist/src/Item/BaseItem.js.map +1 -0
  15. package/dist/src/Item/index.js +4 -0
  16. package/dist/src/Item/index.js.map +1 -0
  17. package/dist/src/Item/queries.js +94 -0
  18. package/dist/src/Item/queries.js.map +1 -0
  19. package/dist/src/Item/service/actors/fetchDataFromEas.js +74 -0
  20. package/dist/src/Item/service/actors/fetchDataFromEas.js.map +1 -0
  21. package/dist/src/Item/service/actors/hydrateExistingItem.js +119 -0
  22. package/dist/src/Item/service/actors/hydrateExistingItem.js.map +1 -0
  23. package/dist/src/Item/service/actors/hydrateNewItem.js +28 -0
  24. package/dist/src/Item/service/actors/hydrateNewItem.js.map +1 -0
  25. package/dist/src/Item/service/actors/initialize.js +39 -0
  26. package/dist/src/Item/service/actors/initialize.js.map +1 -0
  27. package/dist/src/Item/service/actors/reload.js +26 -0
  28. package/dist/src/Item/service/actors/reload.js.map +1 -0
  29. package/dist/src/Item/service/actors/waitForDb.js +22 -0
  30. package/dist/src/Item/service/actors/waitForDb.js.map +1 -0
  31. package/dist/src/Item/service/itemMachineSingle.js +154 -0
  32. package/dist/src/Item/service/itemMachineSingle.js.map +1 -0
  33. package/dist/src/ItemProperty/BaseItemProperty.js +306 -0
  34. package/dist/src/ItemProperty/BaseItemProperty.js.map +1 -0
  35. package/dist/src/ItemProperty/service/actors/hydrateFromDb.js +196 -0
  36. package/dist/src/ItemProperty/service/actors/hydrateFromDb.js.map +1 -0
  37. package/dist/src/ItemProperty/service/actors/initialize.js +60 -0
  38. package/dist/src/ItemProperty/service/actors/initialize.js.map +1 -0
  39. package/dist/src/ItemProperty/service/actors/resolveRelatedValue.js +317 -0
  40. package/dist/src/ItemProperty/service/actors/resolveRelatedValue.js.map +1 -0
  41. package/dist/src/ItemProperty/service/actors/resolveRemoteStorage.js +62 -0
  42. package/dist/src/ItemProperty/service/actors/resolveRemoteStorage.js.map +1 -0
  43. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.js +100 -0
  44. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.js.map +1 -0
  45. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImageSrc.js +178 -0
  46. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImageSrc.js.map +1 -0
  47. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.js +117 -0
  48. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.js.map +1 -0
  49. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.js +81 -0
  50. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.js.map +1 -0
  51. package/dist/src/ItemProperty/service/actors/waitForDb.js +22 -0
  52. package/dist/src/ItemProperty/service/actors/waitForDb.js.map +1 -0
  53. package/dist/src/ItemProperty/service/propertyMachine.js +198 -0
  54. package/dist/src/ItemProperty/service/propertyMachine.js.map +1 -0
  55. package/dist/src/browser/Item/Item.js +11 -0
  56. package/dist/src/browser/Item/Item.js.map +1 -0
  57. package/dist/src/browser/Item/index.js +2 -0
  58. package/dist/src/browser/Item/index.js.map +1 -0
  59. package/dist/src/browser/ItemProperty/ItemProperty.js +11 -0
  60. package/dist/src/browser/ItemProperty/ItemProperty.js.map +1 -0
  61. package/dist/src/browser/db/Db.d.ts +10 -5
  62. package/dist/src/browser/db/Db.d.ts.map +1 -1
  63. package/dist/src/browser/db/Db.js +218 -0
  64. package/dist/src/browser/db/Db.js.map +1 -0
  65. package/dist/src/browser/db/sqlWasmClient.d.ts +0 -12
  66. package/dist/src/browser/db/sqlWasmClient.d.ts.map +1 -1
  67. package/dist/{ArweaveClient-2RMCxfNZ.js → src/browser/helpers/ArweaveClient.js} +3 -3
  68. package/dist/{ArweaveClient-COlwyYTF.js.map → src/browser/helpers/ArweaveClient.js.map} +1 -1
  69. package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
  70. package/dist/src/browser/helpers/FileManager.js +308 -0
  71. package/dist/src/browser/helpers/FileManager.js.map +1 -0
  72. package/dist/src/browser/helpers/QueryClient.d.ts.map +1 -1
  73. package/dist/{QueryClient-W4slRa7O.js → src/browser/helpers/QueryClient.js} +2 -5
  74. package/dist/src/browser/helpers/QueryClient.js.map +1 -0
  75. package/dist/src/browser/index.d.ts +2 -1
  76. package/dist/src/browser/index.d.ts.map +1 -1
  77. package/dist/src/browser/react/db.js +6 -0
  78. package/dist/src/browser/react/db.js.map +1 -0
  79. package/dist/src/browser/react/item.js +260 -0
  80. package/dist/src/browser/react/item.js.map +1 -0
  81. package/dist/src/browser/react/property.js +107 -0
  82. package/dist/src/browser/react/property.js.map +1 -0
  83. package/dist/src/browser/react/services.d.ts.map +1 -1
  84. package/dist/src/browser/react/services.js +299 -0
  85. package/dist/src/browser/react/services.js.map +1 -0
  86. package/dist/src/browser/react/trash.js +25 -0
  87. package/dist/src/browser/react/trash.js.map +1 -0
  88. package/dist/src/browser/workers/FileDownloader.js +49 -0
  89. package/dist/src/browser/workers/FileDownloader.js.map +1 -0
  90. package/dist/src/browser/workers/ImageResizer.js +62 -0
  91. package/dist/src/browser/workers/ImageResizer.js.map +1 -0
  92. package/dist/src/browser/workers/dbWorker.d.ts +1 -0
  93. package/dist/src/browser/workers/dbWorker.d.ts.map +1 -0
  94. package/dist/src/browser/workers/filesDownload.js +241 -0
  95. package/dist/src/browser/workers/filesDownload.js.map +1 -0
  96. package/dist/src/browser/workers/imageResize.js +379 -0
  97. package/dist/src/browser/workers/imageResize.js.map +1 -0
  98. package/dist/src/client/ClientManager.d.ts +18 -2
  99. package/dist/src/client/ClientManager.d.ts.map +1 -1
  100. package/dist/src/client/ClientManager.js +59 -0
  101. package/dist/src/client/ClientManager.js.map +1 -0
  102. package/dist/src/client/actions/setAddresses.js +19 -0
  103. package/dist/src/client/actions/setAddresses.js.map +1 -0
  104. package/dist/src/client/actors/initialize.d.ts.map +1 -1
  105. package/dist/src/client/actors/initialize.js +84 -0
  106. package/dist/src/client/actors/initialize.js.map +1 -0
  107. package/dist/src/client/actors/saveAppState.js +44 -0
  108. package/dist/src/client/actors/saveAppState.js.map +1 -0
  109. package/dist/src/client/clientManagerMachine.js +61 -0
  110. package/dist/src/client/clientManagerMachine.js.map +1 -0
  111. package/dist/src/db/Db/BaseDb.d.ts +1 -2
  112. package/dist/src/db/Db/BaseDb.d.ts.map +1 -1
  113. package/dist/src/db/Db/BaseDb.js +22 -0
  114. package/dist/src/db/Db/BaseDb.js.map +1 -0
  115. package/dist/src/db/configs/browser.app.db.config.d.ts.map +1 -1
  116. package/dist/src/db/configs/node.app.db.config.d.ts.map +1 -1
  117. package/dist/{seed.schema.config-DmTl3a9U.js → src/db/configs/seed.schema.config.js} +3 -24
  118. package/dist/src/db/configs/seed.schema.config.js.map +1 -0
  119. package/dist/src/db/read/getExistingItem.js +29 -0
  120. package/dist/src/db/read/getExistingItem.js.map +1 -0
  121. package/dist/src/db/read/getItem.js +26 -0
  122. package/dist/src/db/read/getItem.js.map +1 -0
  123. package/dist/src/db/read/getItemData.js +84 -0
  124. package/dist/src/db/read/getItemData.js.map +1 -0
  125. package/dist/src/db/read/getItemProperties.js +49 -0
  126. package/dist/src/db/read/getItemProperties.js.map +1 -0
  127. package/dist/src/db/read/getItemProperty.js +30 -0
  128. package/dist/src/db/read/getItemProperty.js.map +1 -0
  129. package/dist/src/db/read/getItems.js +49 -0
  130. package/dist/src/db/read/getItems.js.map +1 -0
  131. package/dist/src/db/read/getMetadata.js +32 -0
  132. package/dist/src/db/read/getMetadata.js.map +1 -0
  133. package/dist/src/db/read/getModelSchemas.js +69 -0
  134. package/dist/src/db/read/getModelSchemas.js.map +1 -0
  135. package/dist/src/db/read/getPropertyData.js +38 -0
  136. package/dist/src/db/read/getPropertyData.js.map +1 -0
  137. package/dist/src/db/read/getPublishPayload.js +213 -0
  138. package/dist/src/db/read/getPublishPayload.js.map +1 -0
  139. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  140. package/dist/src/db/read/getPublishUploads.js +134 -0
  141. package/dist/src/db/read/getPublishUploads.js.map +1 -0
  142. package/dist/src/db/read/getRelationValueData.js +30 -0
  143. package/dist/src/db/read/getRelationValueData.js.map +1 -0
  144. package/dist/src/db/read/getSchemaUidForModel.js +28 -0
  145. package/dist/src/db/read/getSchemaUidForModel.js.map +1 -0
  146. package/dist/src/db/read/getSeedData.js +28 -0
  147. package/dist/src/db/read/getSeedData.js.map +1 -0
  148. package/dist/src/db/read/getStorageTransactionIdForSeedUid.js +30 -0
  149. package/dist/src/db/read/getStorageTransactionIdForSeedUid.js.map +1 -0
  150. package/dist/src/db/read/getVersionData.js +33 -0
  151. package/dist/src/db/read/getVersionData.js.map +1 -0
  152. package/dist/src/db/read/subqueries/metadataLatest.js +35 -0
  153. package/dist/src/db/read/subqueries/metadataLatest.js.map +1 -0
  154. package/dist/src/db/read/subqueries/versionData.js +27 -0
  155. package/dist/src/db/read/subqueries/versionData.js.map +1 -0
  156. package/dist/src/db/write/createMetadata.js +63 -0
  157. package/dist/src/db/write/createMetadata.js.map +1 -0
  158. package/dist/src/db/write/createNewItem.js +38 -0
  159. package/dist/src/db/write/createNewItem.js.map +1 -0
  160. package/dist/src/db/write/createSeed.js +29 -0
  161. package/dist/src/db/write/createSeed.js.map +1 -0
  162. package/dist/src/db/write/createSeeds.js +25 -0
  163. package/dist/src/db/write/createSeeds.js.map +1 -0
  164. package/dist/src/db/write/createVersion.js +25 -0
  165. package/dist/src/db/write/createVersion.js.map +1 -0
  166. package/dist/src/db/write/deleteItem.js +21 -0
  167. package/dist/src/db/write/deleteItem.js.map +1 -0
  168. package/dist/src/db/write/saveAppState.js +26 -0
  169. package/dist/src/db/write/saveAppState.js.map +1 -0
  170. package/dist/src/db/write/saveMetadata.js +22 -0
  171. package/dist/src/db/write/saveMetadata.js.map +1 -0
  172. package/dist/src/db/write/updateItemPropertyValue.js +161 -0
  173. package/dist/src/db/write/updateItemPropertyValue.js.map +1 -0
  174. package/dist/src/db/write/updateMetadata.js +25 -0
  175. package/dist/src/db/write/updateMetadata.js.map +1 -0
  176. package/dist/src/eventBus.js +6 -0
  177. package/dist/src/eventBus.js.map +1 -0
  178. package/dist/src/events/files/download.js +161 -0
  179. package/dist/src/events/files/download.js.map +1 -0
  180. package/dist/src/events/files/index.d.ts.map +1 -1
  181. package/dist/src/events/files/index.js +61 -0
  182. package/dist/src/events/files/index.js.map +1 -0
  183. package/dist/src/events/index.js +28 -0
  184. package/dist/src/events/index.js.map +1 -0
  185. package/dist/src/events/item/index.js +28 -0
  186. package/dist/src/events/item/index.js.map +1 -0
  187. package/dist/src/events/item/publish.js +19 -0
  188. package/dist/src/events/item/publish.js.map +1 -0
  189. package/dist/src/events/item/syncDbWithEas.js +428 -0
  190. package/dist/src/events/item/syncDbWithEas.js.map +1 -0
  191. package/dist/src/events/services/allItems.js +20 -0
  192. package/dist/src/events/services/allItems.js.map +1 -0
  193. package/dist/src/events/services/index.js +9 -0
  194. package/dist/src/events/services/index.js.map +1 -0
  195. package/dist/src/graphql/gql/gql.js +38 -0
  196. package/dist/src/graphql/gql/gql.js.map +1 -0
  197. package/dist/src/graphql/gql/graphql.js +106 -0
  198. package/dist/src/graphql/gql/graphql.js.map +1 -0
  199. package/dist/src/helpers/ArweaveClient/BaseArweaveClient.js +11 -0
  200. package/dist/src/helpers/ArweaveClient/BaseArweaveClient.js.map +1 -0
  201. package/dist/src/helpers/ArweaveClient/index.js +45 -0
  202. package/dist/src/helpers/ArweaveClient/index.js.map +1 -0
  203. package/dist/src/helpers/ArweaveClient/queries.js +16 -0
  204. package/dist/src/helpers/ArweaveClient/queries.js.map +1 -0
  205. package/dist/src/helpers/EasClient/BaseEasClient.js +14 -0
  206. package/dist/src/helpers/EasClient/BaseEasClient.js.map +1 -0
  207. package/dist/src/helpers/FileManager/BaseFileManager.js +55 -0
  208. package/dist/src/helpers/FileManager/BaseFileManager.js.map +1 -0
  209. package/dist/src/helpers/QueryClient/BaseQueryClient.js +11 -0
  210. package/dist/src/helpers/QueryClient/BaseQueryClient.js.map +1 -0
  211. package/dist/src/helpers/constants.d.ts +1 -0
  212. package/dist/src/helpers/constants.d.ts.map +1 -1
  213. package/dist/src/helpers/constants.js +74 -0
  214. package/dist/src/helpers/constants.js.map +1 -0
  215. package/dist/src/helpers/db.js +43 -0
  216. package/dist/src/helpers/db.js.map +1 -0
  217. package/dist/src/helpers/environment.js +24 -0
  218. package/dist/src/helpers/environment.js.map +1 -0
  219. package/dist/src/helpers/getSchemaForItemProperty.js +51 -0
  220. package/dist/src/helpers/getSchemaForItemProperty.js.map +1 -0
  221. package/dist/src/helpers/getSegmentedItemProperties.js +50 -0
  222. package/dist/src/helpers/getSegmentedItemProperties.js.map +1 -0
  223. package/dist/src/helpers/index.js +101 -0
  224. package/dist/src/helpers/index.js.map +1 -0
  225. package/dist/src/helpers/updateMachineContext.js +20 -0
  226. package/dist/src/helpers/updateMachineContext.js.map +1 -0
  227. package/dist/src/index.d.ts +1 -1
  228. package/dist/src/index.d.ts.map +1 -1
  229. package/dist/src/interfaces/IDb.d.ts.map +1 -1
  230. package/dist/src/node/codegen/drizzle.d.ts +4 -1
  231. package/dist/src/node/codegen/drizzle.d.ts.map +1 -1
  232. package/dist/src/node/codegen/drizzle.js +86 -0
  233. package/dist/src/node/codegen/drizzle.js.map +1 -0
  234. package/dist/src/node/constants.d.ts.map +1 -1
  235. package/dist/src/node/constants.js +37 -0
  236. package/dist/src/node/constants.js.map +1 -0
  237. package/dist/src/node/db/Db.d.ts +5 -6
  238. package/dist/src/node/db/Db.d.ts.map +1 -1
  239. package/dist/{ArweaveClient-COlwyYTF.js → src/node/helpers/ArweaveClient.js} +3 -3
  240. package/dist/{ArweaveClient-2RMCxfNZ.js.map → src/node/helpers/ArweaveClient.js.map} +1 -1
  241. package/dist/{EasClient-CFnb5g-r.js → src/node/helpers/EasClient.js} +3 -3
  242. package/dist/{EasClient-CFnb5g-r.js.map → src/node/helpers/EasClient.js.map} +1 -1
  243. package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
  244. package/dist/{QueryClient-ZUsZ1Qxq.js → src/node/helpers/QueryClient.js} +2 -4
  245. package/dist/{QueryClient-ZUsZ1Qxq.js.map → src/node/helpers/QueryClient.js.map} +1 -1
  246. package/dist/src/node/helpers/index.d.ts.map +1 -1
  247. package/dist/src/node/helpers/index.js +39 -0
  248. package/dist/src/node/helpers/index.js.map +1 -0
  249. package/dist/src/node/seed.d.ts +0 -6
  250. package/dist/src/node/seed.d.ts.map +1 -1
  251. package/dist/src/node/webpack/index.d.ts.map +1 -1
  252. package/dist/src/node/webpack/index.js +96 -0
  253. package/dist/src/node/webpack/index.js.map +1 -0
  254. package/dist/src/schema/file/queries.js +48 -0
  255. package/dist/src/schema/file/queries.js.map +1 -0
  256. package/dist/src/schema/index.d.ts.map +1 -1
  257. package/dist/src/schema/model/index.d.ts +8 -8
  258. package/dist/src/schema/model/index.js +44 -0
  259. package/dist/src/schema/model/index.js.map +1 -0
  260. package/dist/src/schema/property/index.d.ts +58 -32
  261. package/dist/src/schema/property/index.d.ts.map +1 -1
  262. package/dist/src/schema/property/index.js +89 -0
  263. package/dist/src/schema/property/index.js.map +1 -0
  264. package/dist/src/seedSchema/AppStateSchema.js +11 -0
  265. package/dist/src/seedSchema/AppStateSchema.js.map +1 -0
  266. package/dist/src/seedSchema/MetadataSchema.js +29 -0
  267. package/dist/src/seedSchema/MetadataSchema.js.map +1 -0
  268. package/dist/src/seedSchema/ModelSchema.js +33 -0
  269. package/dist/src/seedSchema/ModelSchema.js.map +1 -0
  270. package/dist/src/seedSchema/ModelUidSchema.js +18 -0
  271. package/dist/src/seedSchema/ModelUidSchema.js.map +1 -0
  272. package/dist/src/seedSchema/SeedSchema.js +16 -0
  273. package/dist/src/seedSchema/SeedSchema.js.map +1 -0
  274. package/dist/src/seedSchema/VersionSchema.js +17 -0
  275. package/dist/src/seedSchema/VersionSchema.js.map +1 -0
  276. package/dist/src/services/allItems/actors/fetchDbData.js +13 -0
  277. package/dist/src/services/allItems/actors/fetchDbData.js.map +1 -0
  278. package/dist/src/services/allItems/actors/fetchRelatedItems.js +137 -0
  279. package/dist/src/services/allItems/actors/fetchRelatedItems.js.map +1 -0
  280. package/dist/src/services/allItems/actors/fetchSeeds.js +31 -0
  281. package/dist/src/services/allItems/actors/fetchSeeds.js.map +1 -0
  282. package/dist/src/services/allItems/actors/fetchVersions.js +35 -0
  283. package/dist/src/services/allItems/actors/fetchVersions.js.map +1 -0
  284. package/dist/src/services/allItems/actors/initialize.js +144 -0
  285. package/dist/src/services/allItems/actors/initialize.js.map +1 -0
  286. package/dist/src/services/allItems/actors/processItems.js +55 -0
  287. package/dist/src/services/allItems/actors/processItems.js.map +1 -0
  288. package/dist/src/services/allItems/itemMachineAll.js +153 -0
  289. package/dist/src/services/allItems/itemMachineAll.js.map +1 -0
  290. package/dist/src/services/db/actors/checkStatus.d.ts.map +1 -1
  291. package/dist/src/services/db/actors/checkStatus.js +41 -0
  292. package/dist/src/services/db/actors/checkStatus.js.map +1 -0
  293. package/dist/src/services/db/actors/connectToDb.d.ts.map +1 -1
  294. package/dist/src/services/db/actors/connectToDb.js +31 -0
  295. package/dist/src/services/db/actors/connectToDb.js.map +1 -0
  296. package/dist/src/services/db/actors/migrate.js +40 -0
  297. package/dist/src/services/db/actors/migrate.js.map +1 -0
  298. package/dist/src/services/db/actors/validate.d.ts.map +1 -1
  299. package/dist/src/services/db/actors/validate.js +40 -0
  300. package/dist/src/services/db/actors/validate.js.map +1 -0
  301. package/dist/src/services/db/actors/waitForFiles.js +32 -0
  302. package/dist/src/services/db/actors/waitForFiles.js.map +1 -0
  303. package/dist/src/services/db/dbMachine.d.ts.map +1 -1
  304. package/dist/src/services/db/dbMachine.js +156 -0
  305. package/dist/src/services/db/dbMachine.js.map +1 -0
  306. package/dist/src/services/events.js +15 -0
  307. package/dist/src/services/events.js.map +1 -0
  308. package/dist/src/services/global/actors/addModelsToDb.js +115 -0
  309. package/dist/src/services/global/actors/addModelsToDb.js.map +1 -0
  310. package/dist/src/services/global/actors/getSchemaForModel.js +26 -0
  311. package/dist/src/services/global/actors/getSchemaForModel.js.map +1 -0
  312. package/dist/src/services/global/actors/initialize.d.ts.map +1 -1
  313. package/dist/src/services/global/actors/initialize.js +86 -0
  314. package/dist/src/services/global/actors/initialize.js.map +1 -0
  315. package/dist/src/services/global/actors/savePublishService.js +22 -0
  316. package/dist/src/services/global/actors/savePublishService.js.map +1 -0
  317. package/dist/src/services/global/globalMachine.d.ts +90 -90
  318. package/dist/src/services/global/globalMachine.d.ts.map +1 -1
  319. package/dist/src/services/global/globalMachine.js +246 -0
  320. package/dist/src/services/global/globalMachine.js.map +1 -0
  321. package/dist/src/services/internal/actors/configureFs.js +70 -0
  322. package/dist/src/services/internal/actors/configureFs.js.map +1 -0
  323. package/dist/src/services/internal/actors/loadAppDb.d.ts.map +1 -1
  324. package/dist/src/services/internal/actors/loadAppDb.js +22 -0
  325. package/dist/src/services/internal/actors/loadAppDb.js.map +1 -0
  326. package/dist/src/services/internal/actors/prepareDb.d.ts.map +1 -1
  327. package/dist/src/services/internal/actors/saveConfig.js +88 -0
  328. package/dist/src/services/internal/actors/saveConfig.js.map +1 -0
  329. package/dist/src/services/internal/actors/validateInput.js +34 -0
  330. package/dist/src/services/internal/actors/validateInput.js.map +1 -0
  331. package/dist/src/services/internal/actors/waitForFiles.js +33 -0
  332. package/dist/src/services/internal/actors/waitForFiles.js.map +1 -0
  333. package/dist/src/services/internal/constants.js +85 -0
  334. package/dist/src/services/internal/constants.js.map +1 -0
  335. package/dist/src/services/internal/helpers.js +171 -0
  336. package/dist/src/services/internal/helpers.js.map +1 -0
  337. package/dist/src/services/internal/internalMachine.d.ts +0 -10
  338. package/dist/src/services/internal/internalMachine.d.ts.map +1 -1
  339. package/dist/src/services/internal/internalMachine.js +188 -0
  340. package/dist/src/services/internal/internalMachine.js.map +1 -0
  341. package/dist/src/services/publish/actors/createPublishAttempt.js +14 -0
  342. package/dist/src/services/publish/actors/createPublishAttempt.js.map +1 -0
  343. package/dist/src/services/publish/actors/preparePublishRequestData.js +70 -0
  344. package/dist/src/services/publish/actors/preparePublishRequestData.js.map +1 -0
  345. package/dist/src/services/publish/actors/upload.js +55 -0
  346. package/dist/src/services/publish/actors/upload.js.map +1 -0
  347. package/dist/src/services/publish/actors/validateItemData.js +18 -0
  348. package/dist/src/services/publish/actors/validateItemData.js.map +1 -0
  349. package/dist/src/services/publish/publishMachine.js +71 -0
  350. package/dist/src/services/publish/publishMachine.js.map +1 -0
  351. package/dist/src/stores/eas.js +40 -0
  352. package/dist/src/stores/eas.js.map +1 -0
  353. package/dist/src/stores/modelClass.js +16 -0
  354. package/dist/src/stores/modelClass.js.map +1 -0
  355. package/dist/src/types/index.d.ts.map +1 -1
  356. package/package.json +9 -7
  357. package/dist/Db-CRWMiKY9.js +0 -384
  358. package/dist/Db-CRWMiKY9.js.map +0 -1
  359. package/dist/Db-G5dIgZv-.js +0 -81
  360. package/dist/Db-G5dIgZv-.js.map +0 -1
  361. package/dist/EasClient-CO5puCWa.js +0 -10
  362. package/dist/EasClient-CO5puCWa.js.map +0 -1
  363. package/dist/FileManager-BOixZyex.js +0 -50
  364. package/dist/FileManager-BOixZyex.js.map +0 -1
  365. package/dist/FileManager-gKGTTa4s.js +0 -1045
  366. package/dist/FileManager-gKGTTa4s.js.map +0 -1
  367. package/dist/Item-BD2_tuda.js +0 -34
  368. package/dist/Item-BD2_tuda.js.map +0 -1
  369. package/dist/ItemProperty-CjcrzEmg.js +0 -33
  370. package/dist/ItemProperty-CjcrzEmg.js.map +0 -1
  371. package/dist/QueryClient-W4slRa7O.js.map +0 -1
  372. package/dist/constants-C-6Pg8FW.js +0 -235
  373. package/dist/constants-C-6Pg8FW.js.map +0 -1
  374. package/dist/index-BxAVepOO.js +0 -25
  375. package/dist/index-BxAVepOO.js.map +0 -1
  376. package/dist/index-D-O-gmXo.js +0 -7930
  377. package/dist/index-D-O-gmXo.js.map +0 -1
  378. package/dist/seed.schema.config-DmTl3a9U.js.map +0 -1
  379. package/dist/src/browser/db/index.d.ts +0 -2
  380. package/dist/src/browser/db/index.d.ts.map +0 -1
  381. package/dist/src/db/Db/index.d.ts +0 -5
  382. package/dist/src/db/Db/index.d.ts.map +0 -1
  383. package/dist/src/helpers/EasClient/index.d.ts +0 -5
  384. package/dist/src/helpers/EasClient/index.d.ts.map +0 -1
  385. package/dist/src/helpers/FileManager/index.d.ts +0 -5
  386. package/dist/src/helpers/FileManager/index.d.ts.map +0 -1
  387. package/dist/src/helpers/QueryClient/index.d.ts +0 -5
  388. package/dist/src/helpers/QueryClient/index.d.ts.map +0 -1
  389. package/dist/src/node/index.d.ts +0 -2
  390. package/dist/src/node/index.d.ts.map +0 -1
  391. package/dist/src/services/global/index.d.ts +0 -2
  392. package/dist/src/services/global/index.d.ts.map +0 -1
@@ -0,0 +1,428 @@
1
+ import { throttle, camelCase, startCase } from 'lodash-es';
2
+ import { seeds } from '../../seedSchema/SeedSchema.js';
3
+ import { versions } from '../../seedSchema/VersionSchema.js';
4
+ import { metadata } from '../../seedSchema/MetadataSchema.js';
5
+ import '../../seedSchema/AppStateSchema.js';
6
+ import '../../seedSchema/ModelSchema.js';
7
+ import { modelUids } from '../../seedSchema/ModelUidSchema.js';
8
+ import { inArray, sql, and, eq } from 'drizzle-orm';
9
+ import { generateId, parseEasRelationPropertyName } from '../../helpers/index.js';
10
+ import { GET_VERSIONS, GET_PROPERTIES, GET_SEEDS } from '../../Item/queries.js';
11
+ import { getAddressesFromDb, escapeSqliteString } from '../../helpers/db.js';
12
+ import { eventEmitter } from '../../eventBus.js';
13
+ import { getModelNames, getModels } from '../../stores/modelClass.js';
14
+ import { BaseDb } from '../../db/Db/BaseDb.js';
15
+ import { getModelSchemas } from '../../db/read/getModelSchemas.js';
16
+ import { createSeeds } from '../../db/write/createSeeds.js';
17
+ import { setSchemaUidForSchemaDefinition } from '../../stores/eas.js';
18
+ import { BaseEasClient } from '../../helpers/EasClient/BaseEasClient.js';
19
+ import { BaseQueryClient } from '../../helpers/QueryClient/BaseQueryClient.js';
20
+
21
+ const relationValuesToExclude = [
22
+ '0x0000000000000000000000000000000000000000000000000000000000000020',
23
+ ];
24
+ const getSeedsFromSchemaUids = async ({ schemaUids, addresses }) => {
25
+ const AND = [
26
+ {
27
+ OR: [],
28
+ },
29
+ ];
30
+ for (const schemaUid of schemaUids) {
31
+ AND[0].OR.push({
32
+ decodedDataJson: {
33
+ contains: schemaUid,
34
+ },
35
+ });
36
+ }
37
+ const queryClient = BaseQueryClient.getQueryClient();
38
+ const easClient = BaseEasClient.getEasClient();
39
+ const { itemSeeds } = await queryClient.fetchQuery({
40
+ queryKey: [`getSeedsForAllModels`],
41
+ queryFn: async () => easClient.request(GET_SEEDS, {
42
+ where: {
43
+ attester: {
44
+ in: addresses,
45
+ },
46
+ schemaId: {
47
+ in: schemaUids,
48
+ },
49
+ AND,
50
+ },
51
+ }),
52
+ });
53
+ return itemSeeds;
54
+ };
55
+ const seedUidToLocalId = new Map();
56
+ const seedUidToModelType = new Map();
57
+ const relatedSeedUids = new Set();
58
+ const versionUidToLocalId = new Map();
59
+ const versionUidToSeedUid = new Map();
60
+ const propertyUidToLocalId = new Map();
61
+ const saveEasSeedsToDb = async ({ itemSeeds }) => {
62
+ const appDb = BaseDb.getAppDb();
63
+ const seedUids = itemSeeds.map((seed) => seed.id);
64
+ const existingSeedRecordsRows = await appDb
65
+ .select()
66
+ .from(seeds)
67
+ .where(inArray(seeds.uid, seedUids));
68
+ const existingSeedUids = new Set();
69
+ if (existingSeedRecordsRows && existingSeedRecordsRows.length > 0) {
70
+ for (const row of existingSeedRecordsRows) {
71
+ existingSeedUids.add(row.uid);
72
+ seedUidToLocalId.set(row.uid, row.localId);
73
+ seedUidToModelType.set(row.uid, row.type);
74
+ }
75
+ }
76
+ const newSeeds = itemSeeds.filter((seed) => !existingSeedUids.has(seed.id));
77
+ if (newSeeds.length === 0) {
78
+ return { seedUidToLocalId, seedUids };
79
+ }
80
+ const newSeedsData = [];
81
+ for (let i = 0; i < newSeeds.length; i++) {
82
+ const seed = newSeeds[i];
83
+ seedUidToModelType.set(seed.id, seed.schema.schemaNames[0].name);
84
+ const seedLocalId = generateId();
85
+ seedUidToLocalId.set(seed.id, seedLocalId);
86
+ const attestationRaw = escapeSqliteString(JSON.stringify(seed));
87
+ newSeedsData.push({
88
+ localId: seedLocalId,
89
+ uid: seed.id,
90
+ schemaUid: seed.schemaId,
91
+ type: seed.schema.schemaNames[0].name,
92
+ createdAt: Date.now(),
93
+ attestationCreatedAt: seed.timeCreated * 1000,
94
+ attestationRaw,
95
+ });
96
+ seedUidToLocalId.set(seed.id, seedLocalId);
97
+ }
98
+ const newSeedUids = await createSeeds(newSeedsData);
99
+ return { seedUids: newSeedUids };
100
+ };
101
+ const saveEasVersionsToDb = async ({ itemVersions }) => {
102
+ const versionUids = itemVersions.map((version) => version.id);
103
+ const appDb = BaseDb.getAppDb();
104
+ const existingVersionRecordsRows = await appDb
105
+ .select()
106
+ .from(versions)
107
+ .where(inArray(versions.uid, versionUids));
108
+ const existingVersionUids = new Set();
109
+ if (existingVersionRecordsRows && existingVersionRecordsRows.length > 0) {
110
+ for (const row of existingVersionRecordsRows) {
111
+ existingVersionUids.add(row.uid);
112
+ versionUidToLocalId.set(row.uid, row.localId);
113
+ versionUidToSeedUid.set(row.uid, row.seedUid);
114
+ }
115
+ }
116
+ const newVersions = itemVersions.filter((version) => !existingVersionUids.has(version.id));
117
+ if (newVersions.length === 0) {
118
+ return { versionUidToLocalId, versionUids };
119
+ }
120
+ let insertVersionsQuery = `INSERT INTO versions (local_id, uid, seed_uid, seed_local_id, seed_type, created_at,
121
+ attestation_created_at,
122
+ attestation_raw)
123
+ VALUES `;
124
+ for (let i = 0; i < newVersions.length; i++) {
125
+ const version = newVersions[i];
126
+ versionUidToSeedUid.set(version.id, version.refUID);
127
+ const versionLocalId = generateId();
128
+ versionUidToLocalId.set(version.id, versionLocalId);
129
+ const seedUid = versionUidToSeedUid.get(version.id);
130
+ const seedLocalId = seedUidToLocalId.get(seedUid);
131
+ const seedType = seedUidToModelType.get(seedUid);
132
+ const attestationRaw = escapeSqliteString(JSON.stringify(version));
133
+ const valuesString = `('${versionLocalId}', '${version.id}', '${seedUid}', '${seedLocalId}', '${seedType}', ${Date.now()}, ${version.timeCreated * 1000}, '${attestationRaw}')`;
134
+ if (i < newVersions.length - 1) {
135
+ insertVersionsQuery += valuesString + ', ';
136
+ }
137
+ if (i === newVersions.length - 1) {
138
+ insertVersionsQuery += valuesString + ';';
139
+ }
140
+ versionUidToLocalId.set(version.id, versionLocalId);
141
+ }
142
+ await appDb.run(sql.raw(insertVersionsQuery));
143
+ return { versionUids };
144
+ };
145
+ const createMetadataRecordsForStorageTransactionId = async (storageTransactionIdProperty, modelSchema) => {
146
+ const attestationData = JSON.parse(storageTransactionIdProperty.decodedDataJson)[0].value;
147
+ camelCase(attestationData.name);
148
+ const propertyValue = attestationData.value;
149
+ const itemStorageProperties = new Map();
150
+ for (const [_propertyName, propertyDef] of Object.entries(modelSchema)) {
151
+ if (propertyDef?.storageType && propertyDef.storageType === 'ItemStorage') {
152
+ itemStorageProperties.set(_propertyName, propertyDef);
153
+ }
154
+ }
155
+ if (itemStorageProperties.size === 0) {
156
+ return;
157
+ }
158
+ const appDb = BaseDb.getAppDb();
159
+ for (const [_propertyName, propertyDef] of itemStorageProperties.entries()) {
160
+ const existingMetadataRecordRows = await appDb
161
+ .select()
162
+ .from(metadata)
163
+ .where(and(eq(metadata.propertyName, _propertyName), eq(metadata.propertyValue, propertyValue), eq(metadata.versionUid, storageTransactionIdProperty.refUID)));
164
+ if (existingMetadataRecordRows && existingMetadataRecordRows.length > 0) {
165
+ continue;
166
+ }
167
+ const seedUid = versionUidToSeedUid.get(storageTransactionIdProperty.refUID);
168
+ const seedLocalId = seedUidToLocalId.get(seedUid);
169
+ const versionUid = storageTransactionIdProperty.refUID;
170
+ const versionLocalId = versionUidToLocalId.get(versionUid);
171
+ const propertyLocalId = generateId();
172
+ await appDb.insert(metadata).values({
173
+ localId: propertyLocalId,
174
+ propertyName: _propertyName,
175
+ propertyValue,
176
+ localStorageDir: propertyDef.localStorageDir,
177
+ seedLocalId,
178
+ seedUid,
179
+ versionLocalId,
180
+ versionUid,
181
+ refValueType: 'file',
182
+ refResolvedValue: `${propertyValue}${propertyDef.filenameSuffix}`,
183
+ modelType: seedUidToModelType.get(seedUid),
184
+ createdAt: Date.now(),
185
+ updatedAt: Date.now(),
186
+ });
187
+ }
188
+ };
189
+ let isSavingToDb = false;
190
+ const saveEasPropertiesToDb = async ({ itemProperties, itemSeeds, }) => {
191
+ if (isSavingToDb) {
192
+ return;
193
+ }
194
+ isSavingToDb = true;
195
+ const propertyUids = itemProperties.map((property) => property.id);
196
+ const models = getModels();
197
+ const appDb = BaseDb.getAppDb();
198
+ const existingMetadataRecordsRows = await appDb
199
+ .select()
200
+ .from(metadata)
201
+ .where(inArray(metadata.uid, propertyUids));
202
+ const existingPropertyRecordsUids = new Set();
203
+ if (existingMetadataRecordsRows && existingMetadataRecordsRows.length > 0) {
204
+ for (const row of existingMetadataRecordsRows) {
205
+ existingPropertyRecordsUids.add(row.uid);
206
+ propertyUidToLocalId.set(row.uid, row.localId);
207
+ }
208
+ }
209
+ const newProperties = itemProperties.filter((property) => !existingPropertyRecordsUids.has(property.id));
210
+ if (newProperties.length === 0) {
211
+ return { propertyUidToLocalId, propertyUids };
212
+ }
213
+ let insertPropertiesQuery = `INSERT INTO metadata (local_id, uid, schema_uid, property_name, property_value,
214
+ eas_data_type, version_uid, version_local_id, seed_uid,
215
+ seed_local_id, model_type, ref_value_type, ref_seed_type,
216
+ ref_schema_uid,
217
+ created_at, attestation_created_at, attestation_raw,
218
+ local_storage_dir, ref_resolved_value)
219
+ VALUES `;
220
+ for (let i = 0; i < newProperties.length; i++) {
221
+ const property = newProperties[i];
222
+ const propertyLocalId = generateId();
223
+ const metadata = JSON.parse(property.decodedDataJson)[0].value;
224
+ let propertyNameSnake = metadata.name;
225
+ if (!propertyNameSnake) {
226
+ console.warn('[item/events] [syncDbWithEas] no propertyName found for property: ', property);
227
+ continue;
228
+ }
229
+ let isRelation = false;
230
+ let refValueType;
231
+ let refSeedType;
232
+ let refSchemaUid;
233
+ let isList = false;
234
+ const schemaUid = property.schemaId;
235
+ setSchemaUidForSchemaDefinition({
236
+ text: propertyNameSnake,
237
+ schemaUid,
238
+ });
239
+ if ((propertyNameSnake.endsWith('_id') ||
240
+ propertyNameSnake.endsWith('_ids')) &&
241
+ propertyNameSnake !== 'storage_transaction_id' &&
242
+ propertyNameSnake !== 'storage_provider_transaction_id') {
243
+ isRelation = true;
244
+ if (Array.isArray(metadata.value)) {
245
+ isList = true;
246
+ refValueType = 'list';
247
+ const result = parseEasRelationPropertyName(propertyNameSnake);
248
+ if (result) {
249
+ propertyNameSnake = result.propertyName;
250
+ refSeedType = result.modelName;
251
+ }
252
+ metadata.value.forEach((value) => {
253
+ relatedSeedUids.add(value);
254
+ });
255
+ }
256
+ if (!isList) {
257
+ if (relationValuesToExclude.includes(metadata.value)) {
258
+ continue;
259
+ }
260
+ relatedSeedUids.add(metadata.value);
261
+ }
262
+ }
263
+ let propertyValue = metadata.value;
264
+ if (typeof propertyValue !== 'string') {
265
+ propertyValue = JSON.stringify(propertyValue);
266
+ }
267
+ if (isRelation && !isList) {
268
+ const relatedSeed = itemSeeds.find((seed) => seed.id === metadata.value);
269
+ if (relatedSeed && relatedSeed.schema && relatedSeed.schema.schemaNames) {
270
+ refSeedType = relatedSeed.schema.schemaNames[0].name;
271
+ refSchemaUid = relatedSeed.schemaId;
272
+ }
273
+ }
274
+ if (isRelation && isList) {
275
+ const relatedSeeds = itemSeeds.filter((seed) => metadata.value.includes(seed.id));
276
+ if (relatedSeeds && relatedSeeds.length > 0) {
277
+ refSeedType = relatedSeeds[0].schema.schemaNames[0].name;
278
+ refSchemaUid = relatedSeeds[0].schemaId;
279
+ }
280
+ }
281
+ const propertyName = camelCase(propertyNameSnake);
282
+ propertyValue = escapeSqliteString(propertyValue);
283
+ const easDataType = metadata.type;
284
+ const versionUid = property.refUID;
285
+ const versionLocalId = versionUidToLocalId.get(versionUid);
286
+ const attestationCreatedAt = property.timeCreated * 1000;
287
+ const attestationRaw = escapeSqliteString(JSON.stringify(property));
288
+ const seedUid = versionUidToSeedUid.get(versionUid);
289
+ const seedLocalId = seedUidToLocalId.get(seedUid);
290
+ const modelType = seedUidToModelType.get(seedUid);
291
+ const modelName = startCase(modelType);
292
+ const ModelClass = models[modelName];
293
+ const modelSchema = ModelClass.schema;
294
+ if (propertyNameSnake === 'storage_transaction_id') {
295
+ await createMetadataRecordsForStorageTransactionId(property, modelSchema);
296
+ }
297
+ const valuesString = `('${propertyLocalId}', '${property.id}',
298
+ '${property.schemaId}', '${propertyName}',
299
+ '${propertyValue}', '${easDataType}', '${versionUid}',
300
+ '${versionLocalId}', '${seedUid}', '${seedLocalId}',
301
+ '${modelType}', ${refValueType ? `'${refValueType}'` : 'NULL'},
302
+ ${refSeedType ? `'${refSeedType}'` : 'NULL'},
303
+ ${refSchemaUid ? `'${refSchemaUid}'` : 'NULL'},
304
+ ${Date.now()}, ${attestationCreatedAt}, '${attestationRaw}',
305
+ ${'NULL'},
306
+ ${'NULL'})`;
307
+ if (i < newProperties.length - 1) {
308
+ insertPropertiesQuery += valuesString + ', ';
309
+ }
310
+ if (i === newProperties.length - 1) {
311
+ insertPropertiesQuery += valuesString + ';';
312
+ }
313
+ propertyUidToLocalId.set(property.id, propertyLocalId);
314
+ }
315
+ if (insertPropertiesQuery.endsWith('VALUES ')) {
316
+ return { propertyUids };
317
+ }
318
+ if (insertPropertiesQuery.endsWith(', ')) {
319
+ insertPropertiesQuery = insertPropertiesQuery.slice(0, -2) + ';';
320
+ }
321
+ await appDb.run(sql.raw(insertPropertiesQuery));
322
+ isSavingToDb = false;
323
+ return { propertyUids };
324
+ };
325
+ const getRelatedSeedsAndVersions = async () => {
326
+ BaseQueryClient.getQueryClient();
327
+ const easClient = BaseEasClient.getEasClient();
328
+ const { itemSeeds } = await easClient.request(GET_SEEDS, {
329
+ where: {
330
+ id: {
331
+ in: Array.from(relatedSeedUids),
332
+ },
333
+ },
334
+ });
335
+ await saveEasSeedsToDb({ itemSeeds });
336
+ const { itemVersions } = await easClient.request(GET_VERSIONS, {
337
+ where: {
338
+ refUID: {
339
+ in: Array.from(relatedSeedUids),
340
+ },
341
+ },
342
+ });
343
+ await saveEasVersionsToDb({ itemVersions });
344
+ const relatedVersionUids = itemVersions.map((v) => v.id);
345
+ const { itemProperties } = await easClient.request(GET_PROPERTIES, {
346
+ where: {
347
+ refUID: {
348
+ in: relatedVersionUids,
349
+ },
350
+ },
351
+ });
352
+ await saveEasPropertiesToDb({
353
+ itemProperties,
354
+ itemSeeds,
355
+ });
356
+ };
357
+ const syncDbWithEasHandler = throttle(async (_) => {
358
+ const appDb = BaseDb.getAppDb();
359
+ const { modelSchemas, schemaStringToModelRecord } = await getModelSchemas();
360
+ if (!modelSchemas ||
361
+ !modelSchemas.schemas ||
362
+ modelSchemas.schemas.length === 0) {
363
+ throw new Error(`No schemas found for models`);
364
+ }
365
+ const schemaUids = [];
366
+ for (const modelSchema of modelSchemas.schemas) {
367
+ const foundModel = schemaStringToModelRecord.get(modelSchema.schema);
368
+ if (!foundModel) {
369
+ throw new Error(`Model not found for schema ${modelSchema.schema}`);
370
+ }
371
+ schemaUids.push(modelSchema.id);
372
+ await appDb
373
+ .insert(modelUids)
374
+ .values({
375
+ modelId: foundModel.id,
376
+ uid: modelSchema.id,
377
+ })
378
+ .onConflictDoNothing();
379
+ }
380
+ const addresses = await getAddressesFromDb();
381
+ const itemSeeds = await getSeedsFromSchemaUids({
382
+ schemaUids: schemaUids,
383
+ addresses,
384
+ });
385
+ // const seedDbRecords = new Map<string, Record<string, unknown>>()
386
+ const { seedUids } = await saveEasSeedsToDb({
387
+ itemSeeds,
388
+ });
389
+ const queryClient = BaseQueryClient.getQueryClient();
390
+ const easClient = BaseEasClient.getEasClient();
391
+ const { itemVersions } = await queryClient.fetchQuery({
392
+ queryKey: [`getVersionsForAllModels`],
393
+ queryFn: async () => easClient.request(GET_VERSIONS, {
394
+ where: {
395
+ refUID: {
396
+ in: seedUids,
397
+ },
398
+ },
399
+ }),
400
+ });
401
+ const { versionUids } = await saveEasVersionsToDb({
402
+ itemVersions,
403
+ });
404
+ const { itemProperties } = await queryClient.fetchQuery({
405
+ queryKey: [`getPropertiesForAllModels`],
406
+ queryFn: async () => easClient.request(GET_PROPERTIES, {
407
+ where: {
408
+ refUID: {
409
+ in: versionUids,
410
+ },
411
+ },
412
+ }),
413
+ });
414
+ const { propertyUids } = saveEasPropertiesToDb({
415
+ itemProperties,
416
+ itemSeeds,
417
+ });
418
+ await getRelatedSeedsAndVersions();
419
+ for (const modelName of getModelNames()) {
420
+ eventEmitter.emit('item.requestAll', { modelName });
421
+ }
422
+ }, 30000, {
423
+ leading: true,
424
+ trailing: false,
425
+ });
426
+
427
+ export { syncDbWithEasHandler };
428
+ //# sourceMappingURL=syncDbWithEas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncDbWithEas.js","sources":["../../../../../src/events/item/syncDbWithEas.ts"],"sourcesContent":["import { camelCase, DebouncedFunc, startCase, throttle } from 'lodash-es'\nimport { Attestation, SchemaWhereInput } from '@/graphql/gql/graphql'\nimport {\n metadata,\n MetadataType,\n modelUids,\n properties,\n seeds,\n SeedType,\n versions,\n} from '@/seedSchema'\nimport { and, eq, inArray, sql } from 'drizzle-orm'\nimport {\n generateId,\n parseEasRelationPropertyName,\n toSnakeCase,\n} from '@/helpers'\nimport {\n GET_PROPERTIES,\n GET_SCHEMAS,\n GET_SEEDS,\n GET_VERSIONS,\n} from '@/Item/queries'\nimport { INTERNAL_DATA_TYPES } from '@/helpers/constants'\nimport { escapeSqliteString, getAddressesFromDb } from '@/helpers/db'\nimport { eventEmitter } from '@/eventBus'\nimport { getModelNames, getModels } from '@/stores/modelClass'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { getModelSchemas } from '@/db/read/getModelSchemas'\nimport { ModelSchema, PropertyType } from '@/types'\nimport { createSeeds } from '@/db/write/createSeeds'\nimport { setSchemaUidForSchemaDefinition } from '@/stores/eas'\nimport { BaseEasClient } from '@/helpers/EasClient/BaseEasClient'\nimport { BaseQueryClient } from '@/helpers/QueryClient/BaseQueryClient'\n\n\n\n\nconst relationValuesToExclude = [\n '0x0000000000000000000000000000000000000000000000000000000000000020',\n]\n\n\nconst getSeedsFromSchemaUids = async ({ schemaUids, addresses }) => {\n const AND = [\n {\n OR: [] as Record<string, unknown>[],\n },\n ]\n\n for (const schemaUid of schemaUids) {\n AND[0].OR.push({\n decodedDataJson: {\n contains: schemaUid,\n },\n })\n }\n\n const queryClient = BaseQueryClient.getQueryClient()\n const easClient = BaseEasClient.getEasClient()\n\n const { itemSeeds } = await queryClient.fetchQuery({\n queryKey: [`getSeedsForAllModels`],\n queryFn: async () =>\n easClient.request(GET_SEEDS, {\n where: {\n attester: {\n in: addresses,\n },\n schemaId: {\n in: schemaUids,\n },\n AND,\n },\n }),\n })\n\n return itemSeeds\n}\n\nconst seedUidToLocalId = new Map<string, string>()\nconst seedUidToModelType = new Map<string, string>()\nconst relatedSeedUids = new Set<string>()\n\nconst versionUidToLocalId = new Map<string, string>()\nconst versionUidToSeedUid = new Map<string, string>()\n\nconst propertyUidToLocalId = new Map<string, string>()\n\ntype SaveEasSeedsToDbProps = {\n itemSeeds: Attestation[]\n}\n\ntype SaveEasSeedsToDbReturn = {\n seedUids: string[]\n}\n\ntype SaveEasSeedsToDb = (\n props: SaveEasSeedsToDbProps,\n) => Promise<SaveEasSeedsToDbReturn>\n\nconst saveEasSeedsToDb: SaveEasSeedsToDb = async ({ itemSeeds }) => {\n const appDb = BaseDb.getAppDb()\n\n const seedUids = itemSeeds.map((seed) => seed.id)\n\n const existingSeedRecordsRows: SeedType[] = await appDb\n .select()\n .from(seeds)\n .where(inArray(seeds.uid, seedUids))\n\n const existingSeedUids = new Set<string>()\n\n if (existingSeedRecordsRows && existingSeedRecordsRows.length > 0) {\n for (const row of existingSeedRecordsRows) {\n existingSeedUids.add(row.uid)\n seedUidToLocalId.set(row.uid, row.localId)\n seedUidToModelType.set(row.uid, row.type)\n }\n }\n\n const newSeeds = itemSeeds.filter((seed) => !existingSeedUids.has(seed.id))\n\n if (newSeeds.length === 0) {\n return { seedUidToLocalId, seedUids }\n }\n\n const newSeedsData: Partial<SeedType>[] = []\n\n for (let i = 0; i < newSeeds.length; i++) {\n const seed = newSeeds[i]\n seedUidToModelType.set(seed.id, seed.schema.schemaNames[0].name)\n const seedLocalId = generateId()\n seedUidToLocalId.set(seed.id, seedLocalId)\n\n const attestationRaw = escapeSqliteString(JSON.stringify(seed))\n\n newSeedsData.push({\n localId: seedLocalId,\n uid: seed.id,\n schemaUid: seed.schemaId,\n type: seed.schema.schemaNames[0].name,\n createdAt: Date.now(),\n attestationCreatedAt: seed.timeCreated * 1000,\n attestationRaw,\n })\n\n seedUidToLocalId.set(seed.id, seedLocalId)\n }\n\n const newSeedUids = await createSeeds(newSeedsData)\n\n return { seedUids: newSeedUids }\n}\n\ntype SaveEasVersionsToDbParams = {\n itemVersions: Attestation[]\n}\n\ntype SaveEasVersionsToDb = (\n props: SaveEasVersionsToDbParams,\n) => Promise<Record<string, unknown>>\n\nconst saveEasVersionsToDb: SaveEasVersionsToDb = async ({ itemVersions }) => {\n const versionUids = itemVersions.map((version) => version.id)\n\n const appDb = BaseDb.getAppDb()\n\n const existingVersionRecordsRows: MetadataType[] = await appDb\n .select()\n .from(versions)\n .where(inArray(versions.uid, versionUids))\n\n const existingVersionUids = new Set<string>()\n\n if (existingVersionRecordsRows && existingVersionRecordsRows.length > 0) {\n for (const row of existingVersionRecordsRows) {\n existingVersionUids.add(row.uid)\n versionUidToLocalId.set(row.uid, row.localId)\n versionUidToSeedUid.set(row.uid, row.seedUid)\n }\n }\n\n const newVersions = itemVersions.filter(\n (version) => !existingVersionUids.has(version.id),\n )\n\n if (newVersions.length === 0) {\n return { versionUidToLocalId, versionUids }\n }\n\n let insertVersionsQuery = `INSERT INTO versions (local_id, uid, seed_uid, seed_local_id, seed_type, created_at,\n attestation_created_at,\n attestation_raw)\n VALUES `\n\n for (let i = 0; i < newVersions.length; i++) {\n const version = newVersions[i]\n versionUidToSeedUid.set(version.id, version.refUID)\n const versionLocalId = generateId()\n versionUidToLocalId.set(version.id, versionLocalId)\n\n const seedUid = versionUidToSeedUid.get(version.id)\n const seedLocalId = seedUidToLocalId.get(seedUid!)\n const seedType = seedUidToModelType.get(seedUid!)\n const attestationRaw = escapeSqliteString(JSON.stringify(version))\n\n const valuesString = `('${versionLocalId}', '${version.id}', '${seedUid}', '${seedLocalId}', '${seedType}', ${Date.now()}, ${version.timeCreated * 1000}, '${attestationRaw}')`\n\n if (i < newVersions.length - 1) {\n insertVersionsQuery += valuesString + ', '\n }\n\n if (i === newVersions.length - 1) {\n insertVersionsQuery += valuesString + ';'\n }\n\n versionUidToLocalId.set(version.id, versionLocalId)\n }\n\n await appDb.run(sql.raw(insertVersionsQuery))\n\n return { versionUids }\n}\n\nconst createMetadataRecordsForStorageTransactionId = async (\n storageTransactionIdProperty: Attestation,\n modelSchema: ModelSchema,\n) => {\n const attestationData = JSON.parse(\n storageTransactionIdProperty.decodedDataJson,\n )[0].value\n const propertyName = camelCase(attestationData.name)\n const propertyValue = attestationData.value\n\n const itemStorageProperties = new Map<string, PropertyType>()\n\n for (const [_propertyName, propertyDef] of Object.entries(modelSchema)) {\n if (propertyDef?.storageType && propertyDef.storageType === 'ItemStorage') {\n itemStorageProperties.set(_propertyName, propertyDef)\n }\n }\n\n if (itemStorageProperties.size === 0) {\n return\n }\n\n const appDb = BaseDb.getAppDb()\n\n for (const [_propertyName, propertyDef] of itemStorageProperties.entries()) {\n const existingMetadataRecordRows = await appDb\n .select()\n .from(metadata)\n .where(\n and(\n eq(metadata.propertyName, _propertyName),\n eq(metadata.propertyValue, propertyValue),\n eq(metadata.versionUid, storageTransactionIdProperty.refUID),\n ),\n )\n\n if (existingMetadataRecordRows && existingMetadataRecordRows.length > 0) {\n continue\n }\n\n const seedUid = versionUidToSeedUid.get(\n storageTransactionIdProperty.refUID,\n ) as string\n const seedLocalId = seedUidToLocalId.get(seedUid)\n const versionUid = storageTransactionIdProperty.refUID\n const versionLocalId = versionUidToLocalId.get(versionUid)\n\n const propertyLocalId = generateId()\n await appDb.insert(metadata).values({\n localId: propertyLocalId,\n propertyName: _propertyName,\n propertyValue,\n localStorageDir: propertyDef.localStorageDir,\n seedLocalId,\n seedUid,\n versionLocalId,\n versionUid,\n refValueType: 'file',\n refResolvedValue: `${propertyValue}${propertyDef.filenameSuffix}`,\n modelType: seedUidToModelType.get(seedUid),\n createdAt: Date.now(),\n updatedAt: Date.now(),\n })\n }\n}\n\ntype SaveEasPropertiesToDbParams = {\n itemProperties: Attestation[]\n itemSeeds: Attestation[]\n}\n\ntype SaveEasPropertiesToDb = (\n props: SaveEasPropertiesToDbParams,\n) => Promise<Record<string, unknown>>\n\nlet isSavingToDb = false\n\nconst saveEasPropertiesToDb: SaveEasPropertiesToDb = async ({\n itemProperties,\n itemSeeds,\n}) => {\n if (isSavingToDb) {\n return\n }\n isSavingToDb = true\n\n const propertyUids = itemProperties.map((property) => property.id)\n\n const models = getModels()\n\n const appDb = BaseDb.getAppDb()\n\n const existingMetadataRecordsRows: MetadataType[] = await appDb\n .select()\n .from(metadata)\n .where(inArray(metadata.uid, propertyUids))\n\n const existingPropertyRecordsUids = new Set<string>()\n\n if (existingMetadataRecordsRows && existingMetadataRecordsRows.length > 0) {\n for (const row of existingMetadataRecordsRows) {\n existingPropertyRecordsUids.add(row.uid)\n propertyUidToLocalId.set(row.uid, row.localId)\n }\n }\n\n const newProperties = itemProperties.filter(\n (property) => !existingPropertyRecordsUids.has(property.id),\n )\n\n if (newProperties.length === 0) {\n return { propertyUidToLocalId, propertyUids }\n }\n\n let insertPropertiesQuery = `INSERT INTO metadata (local_id, uid, schema_uid, property_name, property_value,\n eas_data_type, version_uid, version_local_id, seed_uid,\n seed_local_id, model_type, ref_value_type, ref_seed_type,\n ref_schema_uid,\n created_at, attestation_created_at, attestation_raw,\n local_storage_dir, ref_resolved_value)\n VALUES `\n\n for (let i = 0; i < newProperties.length; i++) {\n const property = newProperties[i]\n const propertyLocalId = generateId()\n const metadata = JSON.parse(property.decodedDataJson)[0].value\n\n let propertyNameSnake = metadata.name\n\n if (!propertyNameSnake) {\n console.warn(\n '[item/events] [syncDbWithEas] no propertyName found for property: ',\n property,\n )\n continue\n }\n\n let isRelation = false\n let refValueType\n let refSeedType\n let refSchemaUid\n let refResolvedValue\n let isList = false\n const schemaUid = property.schemaId\n\n setSchemaUidForSchemaDefinition({\n text: propertyNameSnake,\n schemaUid,\n })\n\n if (\n (propertyNameSnake.endsWith('_id') ||\n propertyNameSnake.endsWith('_ids')) &&\n propertyNameSnake !== 'storage_transaction_id' &&\n propertyNameSnake !== 'storage_provider_transaction_id'\n ) {\n isRelation = true\n\n if (Array.isArray(metadata.value)) {\n isList = true\n refValueType = 'list'\n\n const result = parseEasRelationPropertyName(propertyNameSnake)\n\n if (result) {\n propertyNameSnake = result.propertyName\n refSeedType = result.modelName\n }\n\n metadata.value.forEach((value) => {\n relatedSeedUids.add(value)\n })\n }\n\n if (!isList) {\n if (relationValuesToExclude.includes(metadata.value)) {\n continue\n }\n relatedSeedUids.add(metadata.value)\n }\n }\n\n let propertyValue = metadata.value\n\n if (typeof propertyValue !== 'string') {\n propertyValue = JSON.stringify(propertyValue)\n }\n\n if (isRelation && !isList) {\n const relatedSeed = itemSeeds.find(\n (seed: Attestation) => seed.id === metadata.value,\n )\n if (relatedSeed && relatedSeed.schema && relatedSeed.schema.schemaNames) {\n refSeedType = relatedSeed.schema.schemaNames[0].name\n refSchemaUid = relatedSeed.schemaId\n }\n }\n\n if (isRelation && isList) {\n const relatedSeeds = itemSeeds.filter((seed: Attestation) =>\n metadata.value.includes(seed.id),\n )\n if (relatedSeeds && relatedSeeds.length > 0) {\n refSeedType = relatedSeeds[0].schema.schemaNames[0].name\n refSchemaUid = relatedSeeds[0].schemaId\n }\n }\n\n const propertyName = camelCase(propertyNameSnake)\n propertyValue = escapeSqliteString(propertyValue)\n const easDataType = metadata.type\n const versionUid = property.refUID\n const versionLocalId = versionUidToLocalId.get(versionUid)\n const attestationCreatedAt = property.timeCreated * 1000\n const attestationRaw = escapeSqliteString(JSON.stringify(property))\n const seedUid = versionUidToSeedUid.get(versionUid)\n const seedLocalId = seedUidToLocalId.get(seedUid!)\n const modelType = seedUidToModelType.get(seedUid!)\n\n let localStorageDir\n const modelName = startCase(modelType)\n const ModelClass = models[modelName]\n const modelSchema = ModelClass.schema\n\n if (propertyNameSnake === 'storage_transaction_id') {\n await createMetadataRecordsForStorageTransactionId(property, modelSchema)\n }\n\n const valuesString = `('${propertyLocalId}', '${property.id}', \n '${property.schemaId}', '${propertyName}', \n '${propertyValue}', '${easDataType}', '${versionUid}', \n '${versionLocalId}', '${seedUid}', '${seedLocalId}', \n '${modelType}', ${refValueType ? `'${refValueType}'` : 'NULL'}, \n ${refSeedType ? `'${refSeedType}'` : 'NULL'},\n ${refSchemaUid ? `'${refSchemaUid}'` : 'NULL'},\n ${Date.now()}, ${attestationCreatedAt}, '${attestationRaw}',\n ${localStorageDir ? `'${localStorageDir}'` : 'NULL'},\n ${refResolvedValue ? `'${refResolvedValue}'` : 'NULL'})`\n\n if (i < newProperties.length - 1) {\n insertPropertiesQuery += valuesString + ', '\n }\n\n if (i === newProperties.length - 1) {\n insertPropertiesQuery += valuesString + ';'\n }\n\n propertyUidToLocalId.set(property.id, propertyLocalId)\n }\n\n if (insertPropertiesQuery.endsWith('VALUES ')) {\n return { propertyUids }\n }\n\n if (insertPropertiesQuery.endsWith(', ')) {\n insertPropertiesQuery = insertPropertiesQuery.slice(0, -2) + ';'\n }\n\n await appDb.run(sql.raw(insertPropertiesQuery))\n\n isSavingToDb = false\n\n return { propertyUids }\n}\n\nconst getRelatedSeedsAndVersions = async () => {\n const queryClient = BaseQueryClient.getQueryClient()\n const easClient = BaseEasClient.getEasClient()\n\n const { itemSeeds } = await easClient.request(GET_SEEDS, {\n where: {\n id: {\n in: Array.from(relatedSeedUids),\n },\n },\n })\n\n await saveEasSeedsToDb({ itemSeeds })\n\n const { itemVersions } = await easClient.request(GET_VERSIONS, {\n where: {\n refUID: {\n in: Array.from(relatedSeedUids),\n },\n },\n })\n\n await saveEasVersionsToDb({ itemVersions })\n\n const relatedVersionUids = itemVersions.map((v) => v.id)\n\n const { itemProperties } = await easClient.request(GET_PROPERTIES, {\n where: {\n refUID: {\n in: relatedVersionUids,\n },\n },\n })\n\n await saveEasPropertiesToDb({\n itemProperties,\n itemSeeds,\n })\n}\n\nconst syncDbWithEasHandler: DebouncedFunc<any> = throttle(\n async (_) => {\n const appDb = BaseDb.getAppDb()\n\n const { modelSchemas, schemaStringToModelRecord } = await getModelSchemas()\n\n if (\n !modelSchemas ||\n !modelSchemas.schemas ||\n modelSchemas.schemas.length === 0\n ) {\n throw new Error(`No schemas found for models`)\n }\n\n const schemaUids: string[] = []\n\n for (const modelSchema of modelSchemas.schemas) {\n const foundModel = schemaStringToModelRecord.get(modelSchema.schema)\n\n if (!foundModel) {\n throw new Error(`Model not found for schema ${modelSchema.schema}`)\n }\n\n schemaUids.push(modelSchema.id)\n\n await appDb\n .insert(modelUids)\n .values({\n modelId: foundModel.id,\n uid: modelSchema.id,\n })\n .onConflictDoNothing()\n\n }\n\n const addresses = await getAddressesFromDb()\n\n const itemSeeds = await getSeedsFromSchemaUids({\n schemaUids: schemaUids,\n addresses,\n })\n\n // const seedDbRecords = new Map<string, Record<string, unknown>>()\n\n const { seedUids } = await saveEasSeedsToDb({\n itemSeeds,\n })\n\n const queryClient = BaseQueryClient.getQueryClient()\n const easClient = BaseEasClient.getEasClient()\n\n const { itemVersions } = await queryClient.fetchQuery({\n queryKey: [`getVersionsForAllModels`],\n queryFn: async () =>\n easClient.request(GET_VERSIONS, {\n where: {\n refUID: {\n in: seedUids,\n },\n },\n }),\n })\n\n const { versionUids } = await saveEasVersionsToDb({\n itemVersions,\n })\n\n const { itemProperties } = await queryClient.fetchQuery({\n queryKey: [`getPropertiesForAllModels`],\n queryFn: async () =>\n easClient.request(GET_PROPERTIES, {\n where: {\n refUID: {\n in: versionUids,\n },\n },\n }),\n })\n\n const { propertyUids } = saveEasPropertiesToDb({\n itemProperties,\n itemSeeds,\n })\n\n await getRelatedSeedsAndVersions()\n\n for (const modelName of getModelNames()) {\n eventEmitter.emit('item.requestAll', { modelName })\n }\n },\n 30000,\n {\n leading: true,\n trailing: false,\n },\n)\n\nexport { syncDbWithEasHandler }\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,uBAAuB,GAAG;IAC9B,oEAAoE;CACrE;AAGD,MAAM,sBAAsB,GAAG,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,KAAI;AACjE,IAAA,MAAM,GAAG,GAAG;AACV,QAAA;AACE,YAAA,EAAE,EAAE,EAA+B;AACpC,SAAA;KACF;AAED,IAAA,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;AAClC,QAAA,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC;AACb,YAAA,eAAe,EAAE;AACf,gBAAA,QAAQ,EAAE,SAAS;A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AM,EAAE;AACN,oBAAA,EAAE,EAAE,WAAW;AAChB,iBAAA;AACF,aAAA;SACF,CAAC;AACL,KAAA,CAAC;AAEF,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,qBAAqB,CAAC;QAC7C,cAAc;QACd,SAAS;AACV,KAAA,CAAC;IAEF,MAAM,0BAA0B,EAAE;AAElC,IAAA,KAAK,MAAM,SAAS,IAAI,aAAa,EAAE,EAAE;QACvC,YAAY,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,SAAS,EAAE,CAAC;;AAEvD,CAAC,EACD,KAAK,EACL;AACE,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,QAAQ,EAAE,KAAK;AAChB,CAAA;;;;"}
@@ -0,0 +1,20 @@
1
+ import { getGlobalService } from '../../services/global/globalMachine.js';
2
+ import { saveAppState } from '../../db/write/saveAppState.js';
3
+
4
+ const saveServiceHandler = async (event) => {
5
+ const globalService = getGlobalService();
6
+ if (!globalService || !globalService.getSnapshot().context) {
7
+ return;
8
+ }
9
+ const { modelName } = event;
10
+ const nameOfService = `${modelName}Service`;
11
+ const service = globalService.getSnapshot().context[nameOfService];
12
+ if (!service) {
13
+ console.log(`[saveServiceHandler] service not found: ${nameOfService}`);
14
+ return;
15
+ }
16
+ await saveAppState(`snapshot__${modelName}`, JSON.stringify(service.getPersistedSnapshot()));
17
+ };
18
+
19
+ export { saveServiceHandler };
20
+ //# sourceMappingURL=allItems.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allItems.js","sources":["../../../../../src/events/services/allItems.ts"],"sourcesContent":["import { getGlobalService } from '@/services/global/globalMachine'\n\nimport { saveAppState } from '@/db/write/saveAppState'\n\ntype SaveServiceEvent = {\n modelName: string\n}\n\nexport const saveServiceHandler = async (event: SaveServiceEvent) => {\n const globalService = getGlobalService()\n\n if (!globalService || !globalService.getSnapshot().context) {\n return\n }\n\n const { modelName } = event\n\n const nameOfService: string = `${modelName}Service`\n\n const service = globalService.getSnapshot().context[nameOfService]\n\n if (!service) {\n console.log(`[saveServiceHandler] service not found: ${nameOfService}`)\n return\n }\n\n await saveAppState(\n `snapshot__${modelName}`,\n JSON.stringify(service.getPersistedSnapshot()),\n )\n}\n"],"names":[],"mappings":";;;MAQa,kBAAkB,GAAG,OAAO,KAAuB,KAAI;AAClE,IAAA,MAAM,aAAa,GAAG,gBAAgB,EAAE;IAExC,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE;QAC1D;;AAGF,IAAA,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK;AAE3B,IAAA,MAAM,aAAa,GAAW,CAAG,EAAA,SAAS,SAAS;IAEnD,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC;IAElE,IAAI,CAAC,OAAO,EAAE;AACZ,QAAA,OAAO,CAAC,GAAG,CAAC,2CAA2C,aAAa,CAAA,CAAE,CAAC;QACvE;;AAGF,IAAA,MAAM,YAAY,CAChB,CAAA,UAAA,EAAa,SAAS,CAAA,CAAE,EACxB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAC/C;AACH;;;;"}
@@ -0,0 +1,9 @@
1
+ import { eventEmitter } from '../../eventBus.js';
2
+ import { saveServiceHandler } from './allItems.js';
3
+
4
+ const setupServiceHandlers = () => {
5
+ eventEmitter.addListener('service.save', saveServiceHandler);
6
+ };
7
+
8
+ export { setupServiceHandlers };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/events/services/index.ts"],"sourcesContent":["import { eventEmitter } from '@/eventBus'\nimport { saveServiceHandler } from './allItems'\n\nlet areReady = false\n\nexport const setupServiceHandlers = () => {\n eventEmitter.addListener('service.save', saveServiceHandler)\n areReady = true\n}\n\nexport const getAreServiceHandlersReady = () => {\n return areReady\n}\n"],"names":[],"mappings":";;;AAKO,MAAM,oBAAoB,GAAG,MAAK;AACvC,IAAA,YAAY,CAAC,WAAW,CAAC,cAAc,EAAE,kBAAkB,CAAC;AAE9D;;;;"}
@@ -0,0 +1,38 @@
1
+ import { GetSchemaUidsDocument, GetImageVersionsDocument, GetImageSeedsDocument, GetArweaveTransactionsDocument, GetFilesMetadataDocument, GetAllPropertiesForAllVersionsDocument, GetPropertiesDocument, GetVersionsDocument, GetStorageTransactionIdDocument, GetSeedIdsDocument, GetSeedsDocument, GetSchemaByNameDocument, GetSchemasDocument, GetTransactionTagsDocument, SchemaFieldsFragmentDoc, AttestationFieldsFragmentDoc } from './graphql.js';
2
+
3
+ /* eslint-disable */
4
+ /**
5
+ * Map of all GraphQL operations in the project.
6
+ *
7
+ * This map has several performance disadvantages:
8
+ * 1. It is not tree-shakeable, so it will include all operations in the project.
9
+ * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
10
+ * 3. It does not support dead code elimination, so it will add unused operations.
11
+ *
12
+ * Therefore it is highly recommended to use the babel or swc plugin for production.
13
+ * Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
14
+ */
15
+ const documents = {
16
+ "\n fragment attestationFields on Attestation {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n schemaId\n txid\n timeCreated\n time\n isOffchain\n }\n": AttestationFieldsFragmentDoc,
17
+ "\n fragment schemaFields on Schema {\n id\n resolver\n revocable\n schema\n index\n schemaNames {\n name\n }\n time\n txid\n creator\n }\n": SchemaFieldsFragmentDoc,
18
+ "\n query GetTransactionTags($transactionId: ID!) {\n tags: transaction(id: $transactionId) {\n id\n tags {\n name\n value\n }\n }\n }\n": GetTransactionTagsDocument,
19
+ "\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n": GetSchemasDocument,
20
+ "\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n": GetSchemaByNameDocument,
21
+ "\n query GetSeeds($where: AttestationWhereInput!) {\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n schemaId\n timeCreated\n isOffchain\n }\n }\n": GetSeedsDocument,
22
+ "\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n": GetSeedIdsDocument,
23
+ "\n query GetStorageTransactionId($where: AttestationWhereInput!) {\n storageTransactionId: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n id\n decodedDataJson\n }\n }\n": GetStorageTransactionIdDocument,
24
+ "\n query GetVersions($where: AttestationWhereInput!) {\n itemVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n": GetVersionsDocument,
25
+ "\n query GetProperties($where: AttestationWhereInput!) {\n itemProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n": GetPropertiesDocument,
26
+ "\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\n allProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n": GetAllPropertiesForAllVersionsDocument,
27
+ "\n query GetFilesMetadata($where: AttestationWhereInput!) {\n filesMetadata: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n": GetFilesMetadataDocument,
28
+ "\n query GetArweaveTransactions(\n $owners: [String!]\n $first: Int\n $after: String\n ) {\n transactions(owners: $owners, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n anchor\n signature\n block {\n id\n height\n }\n data {\n size\n type\n }\n tags {\n name\n value\n }\n }\n }\n pageInfo {\n hasNextPage\n }\n }\n }\n": GetArweaveTransactionsDocument,
29
+ "\n query GetImageSeeds($where: AttestationWhereInput!) {\n imageSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n schemaId\n txid\n timeCreated\n time\n isOffchain\n }\n }\n": GetImageSeedsDocument,
30
+ "\n query GetImageVersions($where: AttestationWhereInput!) {\n imageVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n": GetImageVersionsDocument,
31
+ "\n query GetSchemaUids($where: SchemaWhereInput!) {\n schemaUids: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n": GetSchemaUidsDocument,
32
+ };
33
+ function graphql(source) {
34
+ return documents[source] ?? {};
35
+ }
36
+
37
+ export { graphql };
38
+ //# sourceMappingURL=gql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gql.js","sources":["../../../../../src/graphql/gql/gql.ts"],"sourcesContent":["/* eslint-disable */\nimport * as types from './graphql';\nimport { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n * Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size\n */\nconst documents = {\n \"\\n fragment attestationFields on Attestation {\\n id\\n decodedDataJson\\n attester\\n schema {\\n schemaNames {\\n name\\n }\\n }\\n refUID\\n revoked\\n schemaId\\n txid\\n timeCreated\\n time\\n isOffchain\\n }\\n\": types.AttestationFieldsFragmentDoc,\n \"\\n fragment schemaFields on Schema {\\n id\\n resolver\\n revocable\\n schema\\n index\\n schemaNames {\\n name\\n }\\n time\\n txid\\n creator\\n }\\n\": types.SchemaFieldsFragmentDoc,\n \"\\n query GetTransactionTags($transactionId: ID!) {\\n tags: transaction(id: $transactionId) {\\n id\\n tags {\\n name\\n value\\n }\\n }\\n }\\n\": types.GetTransactionTagsDocument,\n \"\\n query GetSchemas($where: SchemaWhereInput!) {\\n schemas: schemata(where: $where) {\\n id\\n schema\\n schemaNames {\\n name\\n }\\n }\\n }\\n\": types.GetSchemasDocument,\n \"\\n query GetSchemaByName($where: SchemaWhereInput!) {\\n schemas: schemata(where: $where) {\\n id\\n schema\\n schemaNames {\\n name\\n }\\n }\\n }\\n\": types.GetSchemaByNameDocument,\n \"\\n query GetSeeds($where: AttestationWhereInput!) {\\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\\n id\\n decodedDataJson\\n attester\\n schema {\\n schemaNames {\\n name\\n }\\n }\\n refUID\\n revoked\\n schemaId\\n timeCreated\\n isOffchain\\n }\\n }\\n\": types.GetSeedsDocument,\n \"\\n query GetSeedIds($where: AttestationWhereInput!) {\\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\\n id\\n }\\n }\\n\": types.GetSeedIdsDocument,\n \"\\n query GetStorageTransactionId($where: AttestationWhereInput!) {\\n storageTransactionId: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n id\\n decodedDataJson\\n }\\n }\\n\": types.GetStorageTransactionIdDocument,\n \"\\n query GetVersions($where: AttestationWhereInput!) {\\n itemVersions: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\": types.GetVersionsDocument,\n \"\\n query GetProperties($where: AttestationWhereInput!) {\\n itemProperties: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\": types.GetPropertiesDocument,\n \"\\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\\n allProperties: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\": types.GetAllPropertiesForAllVersionsDocument,\n \"\\n query GetFilesMetadata($where: AttestationWhereInput!) {\\n filesMetadata: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\": types.GetFilesMetadataDocument,\n \"\\n query GetArweaveTransactions(\\n $owners: [String!]\\n $first: Int\\n $after: String\\n ) {\\n transactions(owners: $owners, first: $first, after: $after) {\\n edges {\\n cursor\\n node {\\n id\\n anchor\\n signature\\n block {\\n id\\n height\\n }\\n data {\\n size\\n type\\n }\\n tags {\\n name\\n value\\n }\\n }\\n }\\n pageInfo {\\n hasNextPage\\n }\\n }\\n }\\n\": types.GetArweaveTransactionsDocument,\n \"\\n query GetImageSeeds($where: AttestationWhereInput!) {\\n imageSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\\n id\\n decodedDataJson\\n attester\\n schema {\\n schemaNames {\\n name\\n }\\n }\\n refUID\\n revoked\\n schemaId\\n txid\\n timeCreated\\n time\\n isOffchain\\n }\\n }\\n\": types.GetImageSeedsDocument,\n \"\\n query GetImageVersions($where: AttestationWhereInput!) {\\n imageVersions: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\": types.GetImageVersionsDocument,\n \"\\n query GetSchemaUids($where: SchemaWhereInput!) {\\n schemaUids: schemata(where: $where) {\\n id\\n schema\\n schemaNames {\\n name\\n }\\n }\\n }\\n\": types.GetSchemaUidsDocument,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n fragment attestationFields on Attestation {\\n id\\n decodedDataJson\\n attester\\n schema {\\n schemaNames {\\n name\\n }\\n }\\n refUID\\n revoked\\n schemaId\\n txid\\n timeCreated\\n time\\n isOffchain\\n }\\n\"): (typeof documents)[\"\\n fragment attestationFields on Attestation {\\n id\\n decodedDataJson\\n attester\\n schema {\\n schemaNames {\\n name\\n }\\n }\\n refUID\\n revoked\\n schemaId\\n txid\\n timeCreated\\n time\\n isOffchain\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n fragment schemaFields on Schema {\\n id\\n resolver\\n revocable\\n schema\\n index\\n schemaNames {\\n name\\n }\\n time\\n txid\\n creator\\n }\\n\"): (typeof documents)[\"\\n fragment schemaFields on Schema {\\n id\\n resolver\\n revocable\\n schema\\n index\\n schemaNames {\\n name\\n }\\n time\\n txid\\n creator\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetTransactionTags($transactionId: ID!) {\\n tags: transaction(id: $transactionId) {\\n id\\n tags {\\n name\\n value\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetTransactionTags($transactionId: ID!) {\\n tags: transaction(id: $transactionId) {\\n id\\n tags {\\n name\\n value\\n }\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetSchemas($where: SchemaWhereInput!) {\\n schemas: schemata(where: $where) {\\n id\\n schema\\n schemaNames {\\n name\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetSchemas($where: SchemaWhereInput!) {\\n schemas: schemata(where: $where) {\\n id\\n schema\\n schemaNames {\\n name\\n }\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetSchemaByName($where: SchemaWhereInput!) {\\n schemas: schemata(where: $where) {\\n id\\n schema\\n schemaNames {\\n name\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetSchemaByName($where: SchemaWhereInput!) {\\n schemas: schemata(where: $where) {\\n id\\n schema\\n schemaNames {\\n name\\n }\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetSeeds($where: AttestationWhereInput!) {\\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\\n id\\n decodedDataJson\\n attester\\n schema {\\n schemaNames {\\n name\\n }\\n }\\n refUID\\n revoked\\n schemaId\\n timeCreated\\n isOffchain\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetSeeds($where: AttestationWhereInput!) {\\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\\n id\\n decodedDataJson\\n attester\\n schema {\\n schemaNames {\\n name\\n }\\n }\\n refUID\\n revoked\\n schemaId\\n timeCreated\\n isOffchain\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetSeedIds($where: AttestationWhereInput!) {\\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\\n id\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetSeedIds($where: AttestationWhereInput!) {\\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\\n id\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetStorageTransactionId($where: AttestationWhereInput!) {\\n storageTransactionId: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n id\\n decodedDataJson\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetStorageTransactionId($where: AttestationWhereInput!) {\\n storageTransactionId: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n id\\n decodedDataJson\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetVersions($where: AttestationWhereInput!) {\\n itemVersions: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetVersions($where: AttestationWhereInput!) {\\n itemVersions: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetProperties($where: AttestationWhereInput!) {\\n itemProperties: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetProperties($where: AttestationWhereInput!) {\\n itemProperties: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\\n allProperties: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\\n allProperties: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetFilesMetadata($where: AttestationWhereInput!) {\\n filesMetadata: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetFilesMetadata($where: AttestationWhereInput!) {\\n filesMetadata: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetArweaveTransactions(\\n $owners: [String!]\\n $first: Int\\n $after: String\\n ) {\\n transactions(owners: $owners, first: $first, after: $after) {\\n edges {\\n cursor\\n node {\\n id\\n anchor\\n signature\\n block {\\n id\\n height\\n }\\n data {\\n size\\n type\\n }\\n tags {\\n name\\n value\\n }\\n }\\n }\\n pageInfo {\\n hasNextPage\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetArweaveTransactions(\\n $owners: [String!]\\n $first: Int\\n $after: String\\n ) {\\n transactions(owners: $owners, first: $first, after: $after) {\\n edges {\\n cursor\\n node {\\n id\\n anchor\\n signature\\n block {\\n id\\n height\\n }\\n data {\\n size\\n type\\n }\\n tags {\\n name\\n value\\n }\\n }\\n }\\n pageInfo {\\n hasNextPage\\n }\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetImageSeeds($where: AttestationWhereInput!) {\\n imageSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\\n id\\n decodedDataJson\\n attester\\n schema {\\n schemaNames {\\n name\\n }\\n }\\n refUID\\n revoked\\n schemaId\\n txid\\n timeCreated\\n time\\n isOffchain\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetImageSeeds($where: AttestationWhereInput!) {\\n imageSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\\n id\\n decodedDataJson\\n attester\\n schema {\\n schemaNames {\\n name\\n }\\n }\\n refUID\\n revoked\\n schemaId\\n txid\\n timeCreated\\n time\\n isOffchain\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetImageVersions($where: AttestationWhereInput!) {\\n imageVersions: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetImageVersions($where: AttestationWhereInput!) {\\n imageVersions: attestations(\\n where: $where\\n orderBy: [{ timeCreated: desc }]\\n ) {\\n ...attestationFields\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetSchemaUids($where: SchemaWhereInput!) {\\n schemaUids: schemata(where: $where) {\\n id\\n schema\\n schemaNames {\\n name\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetSchemaUids($where: SchemaWhereInput!) {\\n schemaUids: schemata(where: $where) {\\n id\\n schema\\n schemaNames {\\n name\\n }\\n }\\n }\\n\"];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;"],"names":["types.AttestationFieldsFragmentDoc","types.SchemaFieldsFragmentDoc","types.GetTransactionTagsDocument","types.GetSchemasDocument","types.GetSchemaByNameDocument","types.GetSeedsDocument","types.GetSeedIdsDocument","types.GetStorageTransactionIdDocument","types.GetVersionsDocument","types.GetPropertiesDocument","types.GetAllPropertiesForAllVersionsDocument","types.GetFilesMetadataDocument","types.GetArweaveTransactionsDocument","types.GetImageSeedsDocument","types.GetImageVersionsDocument","types.GetSchemaUidsDocument"],"mappings":";;AAAA;AAIA;;;;;;;;;;AAUG;AACH,MAAM,SAAS,GAAG;IACd,gQAAgQ,EAAEA,4BAAkC;IACpS,iLAAiL,EAAEC,uBAA6B;IAChN,8KAA8K,EAAEC,0BAAgC;IAChN,6KAA6K,EAAEC,kBAAwB;IACvM,kLAAkL,EAAEC,uBAA6B;IACjN,kWAAkW,EAAEC,gBAAsB;IAC1X,kKAAkK,EAAEC,kBAAwB;IAC5L,mOAAmO,EAAEC,+BAAqC;IAC1Q,0MAA0M,EAAEC,mBAAyB;IACrO,8MAA8M,EAAEC,qBAA2B;IAC3O,8NAA8N,EAAEC,sCAA4C;IAC5Q,gNAAgN,EAAEC,wBAA8B;IAChP,2iBAA2iB,EAAEC,8BAAoC;IACjlB,gYAAgY,EAAEC,qBAA2B;IAC7Z,gNAAgN,EAAEC,wBAA8B;IAChP,mLAAmL,EAAEC,qBAA2B;CACnN;AAiFK,SAAU,OAAO,CAAC,MAAc,EAAA;AACpC,IAAA,OAAQ,SAAiB,CAAC,MAAM,CAAC,IAAI,EAAE;AACzC;;;;"}