@seedprotocol/sdk 0.4.21 → 0.4.22

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 (174) hide show
  1. package/dist/{ArweaveClient-DxpJnJXU.js → ArweaveClient-B-vm2Xae.js} +3 -3
  2. package/dist/{ArweaveClient-DxpJnJXU.js.map → ArweaveClient-B-vm2Xae.js.map} +1 -1
  3. package/dist/{ArweaveClient-Cz9ZLiEV.js → ArweaveClient-C-eLH0zU.js} +3 -3
  4. package/dist/{ArweaveClient-Cz9ZLiEV.js.map → ArweaveClient-C-eLH0zU.js.map} +1 -1
  5. package/dist/{Db-CXwQVLZv.js → Db-B7whB3oJ.js} +107 -6
  6. package/dist/Db-B7whB3oJ.js.map +1 -0
  7. package/dist/{Db-DkTBncAM.js → Db-nir1xVHg.js} +4 -4
  8. package/dist/{Db-DkTBncAM.js.map → Db-nir1xVHg.js.map} +1 -1
  9. package/dist/{EasClient-DjpbHjU9.js → EasClient-BH_feMaX.js} +2 -2
  10. package/dist/{EasClient-JYkmHxu1.js.map → EasClient-BH_feMaX.js.map} +1 -1
  11. package/dist/{EasClient-JYkmHxu1.js → EasClient-CFguAKBp.js} +2 -2
  12. package/dist/{EasClient-DjpbHjU9.js.map → EasClient-CFguAKBp.js.map} +1 -1
  13. package/dist/{FileManager-CKyoLrBP.js → FileManager-BR3jtuSl.js} +2 -2
  14. package/dist/{FileManager-CKyoLrBP.js.map → FileManager-BR3jtuSl.js.map} +1 -1
  15. package/dist/{FileManager-DHnyb040.js → FileManager-C2uXql_C.js} +18 -2
  16. package/dist/FileManager-C2uXql_C.js.map +1 -0
  17. package/dist/{ModelProperty-DWtv9fQr.js → ModelProperty-CIeLasI4.js} +24 -24
  18. package/dist/{ModelProperty-DWtv9fQr.js.map → ModelProperty-CIeLasI4.js.map} +1 -1
  19. package/dist/{PathResolver-Ce4K9acQ.js → PathResolver-CZoSnHBU.js} +2 -2
  20. package/dist/{PathResolver-Ce4K9acQ.js.map → PathResolver-CZoSnHBU.js.map} +1 -1
  21. package/dist/{PathResolver-pmw--Ea2.js → PathResolver-DnrG1hUX.js} +2 -2
  22. package/dist/{PathResolver-pmw--Ea2.js.map → PathResolver-DnrG1hUX.js.map} +1 -1
  23. package/dist/{QueryClient-OUjfvY3g.js → QueryClient-DJOrJZRR.js} +3 -2
  24. package/dist/QueryClient-DJOrJZRR.js.map +1 -0
  25. package/dist/{QueryClient-unspcsWa.js → QueryClient-PqOg8mcw.js} +7 -3
  26. package/dist/QueryClient-PqOg8mcw.js.map +1 -0
  27. package/dist/{Schema-CqqcEexA.js → Schema-B3YQHTtu.js} +38 -38
  28. package/dist/{Schema-CqqcEexA.js.map → Schema-B3YQHTtu.js.map} +1 -1
  29. package/dist/{SchemaValidationService-Cb-b4kpD.js → SchemaValidationService-C4DIwn8Z.js} +2 -2
  30. package/dist/{SchemaValidationService-Cb-b4kpD.js.map → SchemaValidationService-C4DIwn8Z.js.map} +1 -1
  31. package/dist/{backfillMetadataPropertyIds-CRyRez3h.js → backfillMetadataPropertyIds-CBlRaU_M.js} +2 -2
  32. package/dist/{backfillMetadataPropertyIds-CRyRez3h.js.map → backfillMetadataPropertyIds-CBlRaU_M.js.map} +1 -1
  33. package/dist/cjs/{ModelProperty-sNx_ZQZX.js → ModelProperty-tfM38NL4.js} +17 -17
  34. package/dist/cjs/{ModelProperty-sNx_ZQZX.js.map → ModelProperty-tfM38NL4.js.map} +1 -1
  35. package/dist/cjs/{Schema-B4RRA-0g.js → Schema-44NqLqMV.js} +20 -20
  36. package/dist/cjs/{Schema-B4RRA-0g.js.map → Schema-44NqLqMV.js.map} +1 -1
  37. package/dist/cjs/{SchemaValidationService-DCflhpcI.js → SchemaValidationService-Cq_YBzFN.js} +2 -2
  38. package/dist/cjs/{SchemaValidationService-DCflhpcI.js.map → SchemaValidationService-Cq_YBzFN.js.map} +1 -1
  39. package/dist/cjs/{backfillMetadataPropertyIds-DhAXAuSf.js → backfillMetadataPropertyIds-D1nLJAhB.js} +2 -2
  40. package/dist/cjs/{backfillMetadataPropertyIds-DhAXAuSf.js.map → backfillMetadataPropertyIds-D1nLJAhB.js.map} +1 -1
  41. package/dist/cjs/{getItem-lyM2x5pT.js → getItem-BRoq91YU.js} +2 -2
  42. package/dist/cjs/{getItem-lyM2x5pT.js.map → getItem-BRoq91YU.js.map} +1 -1
  43. package/dist/cjs/{getPublishPayload-DP2fm4q8.js → getPublishPayload-ddl-1x6R.js} +11 -11
  44. package/dist/cjs/{getPublishPayload-DP2fm4q8.js.map → getPublishPayload-ddl-1x6R.js.map} +1 -1
  45. package/dist/cjs/{getPublishUploads-DdVy-5fK.js → getPublishUploads-BljRx4o4.js} +39 -6
  46. package/dist/cjs/getPublishUploads-BljRx4o4.js.map +1 -0
  47. package/dist/cjs/{getSegmentedItemProperties-DtHofn5i.js → getSegmentedItemProperties-iK5kepzl.js} +3 -3
  48. package/dist/cjs/{getSegmentedItemProperties-DtHofn5i.js.map → getSegmentedItemProperties-iK5kepzl.js.map} +1 -1
  49. package/dist/cjs/{index-D1qR8xnb.js → index-C6rrqy3z.js} +1980 -1113
  50. package/dist/cjs/index-C6rrqy3z.js.map +1 -0
  51. package/dist/cjs/{index-DTkoTvcq.js → index-DqSDhOp3.js} +3 -3
  52. package/dist/cjs/index-DqSDhOp3.js.map +1 -0
  53. package/dist/cjs/{ownership-DanM_n8E.js → ownership-CXlKAj4o.js} +2 -2
  54. package/dist/cjs/{ownership-DanM_n8E.js.map → ownership-CXlKAj4o.js.map} +1 -1
  55. package/dist/cjs/{property-BQokoaRe.js → property-2D7P6a2q.js} +4 -4
  56. package/dist/cjs/{property-BQokoaRe.js.map → property-2D7P6a2q.js.map} +1 -1
  57. package/dist/cjs/syncDbWithEas-DcKL-_Pb.js +610 -0
  58. package/dist/cjs/syncDbWithEas-DcKL-_Pb.js.map +1 -0
  59. package/dist/db/drizzle/drizzle/0013_eas_sync_processes.sql +12 -0
  60. package/dist/db/drizzle/drizzle/meta/0013_snapshot.json +1262 -0
  61. package/dist/db/drizzle/drizzle/meta/_journal.json +7 -0
  62. package/dist/{getItem-VI3QqdZH.js → getItem-CV3yTCRt.js} +2 -2
  63. package/dist/{getItem-VI3QqdZH.js.map → getItem-CV3yTCRt.js.map} +1 -1
  64. package/dist/{getPublishPayload-DpYwi-rd.js → getPublishPayload-Ddc_LGPs.js} +14 -14
  65. package/dist/{getPublishPayload-DpYwi-rd.js.map → getPublishPayload-Ddc_LGPs.js.map} +1 -1
  66. package/dist/{getPublishUploads-DS2dQ4Ho.js → getPublishUploads-Cf2J-5FR.js} +39 -6
  67. package/dist/getPublishUploads-Cf2J-5FR.js.map +1 -0
  68. package/dist/{getSegmentedItemProperties-Bz5B4DSA.js → getSegmentedItemProperties-B2mzArFD.js} +3 -3
  69. package/dist/{getSegmentedItemProperties-Bz5B4DSA.js.map → getSegmentedItemProperties-B2mzArFD.js.map} +1 -1
  70. package/dist/{index-Cqf_DxkJ.js → index-3Ekqb4QB.js} +3 -3
  71. package/dist/index-3Ekqb4QB.js.map +1 -0
  72. package/dist/{index-DdzhrbkF.js → index-BRo7D3s1.js} +3 -2
  73. package/dist/index-BRo7D3s1.js.map +1 -0
  74. package/dist/{index-BrD_NNaX.js → index-DUMXLKJr.js} +1991 -1125
  75. package/dist/index-DUMXLKJr.js.map +1 -0
  76. package/dist/main.cjs +1 -1
  77. package/dist/main.js +16 -41
  78. package/dist/main.js.map +1 -1
  79. package/dist/node.js +10 -10
  80. package/dist/{ownership-BK6suksO.js → ownership-TR-mIjJh.js} +2 -2
  81. package/dist/{ownership-BK6suksO.js.map → ownership-TR-mIjJh.js.map} +1 -1
  82. package/dist/{property-C63Ddzap.js → property-BSNWvgei.js} +6 -6
  83. package/dist/{property-C63Ddzap.js.map → property-BSNWvgei.js.map} +1 -1
  84. package/dist/{queries-BGuWjEqt.js → queries-0FZBThGQ.js} +2 -2
  85. package/dist/{queries-BGuWjEqt.js.map → queries-0FZBThGQ.js.map} +1 -1
  86. package/dist/seedSchema/EasSyncProcessSchema.ts +17 -0
  87. package/dist/seedSchema/index.ts +1 -0
  88. package/dist/src/Item/Item.d.ts +18 -0
  89. package/dist/src/Item/Item.d.ts.map +1 -1
  90. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  91. package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
  92. package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +1 -1
  93. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +1 -1
  94. package/dist/src/ItemProperty/service/propertyMachine.d.ts +4 -1
  95. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  96. package/dist/src/Model/service/modelMachine.d.ts +20 -20
  97. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +2 -2
  98. package/dist/src/Schema/service/addModelsMachine.d.ts +1 -1
  99. package/dist/src/Schema/service/schemaMachine.d.ts +55 -55
  100. package/dist/src/browser/db/drizzleFiles.d.ts +3 -2
  101. package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
  102. package/dist/src/browser/helpers/QueryClient.d.ts.map +1 -1
  103. package/dist/src/client/ClientManager.d.ts.map +1 -1
  104. package/dist/src/client/actors/addModelsToDb.d.ts.map +1 -1
  105. package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
  106. package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
  107. package/dist/src/client/constants.d.ts +1 -0
  108. package/dist/src/client/constants.d.ts.map +1 -1
  109. package/dist/src/db/read/getPublishPendingDiff.d.ts.map +1 -1
  110. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  111. package/dist/src/db/write/applyPropertyAttestationUidsFromPublish.d.ts.map +1 -1
  112. package/dist/src/db/write/easSyncProcess.d.ts +12 -0
  113. package/dist/src/db/write/easSyncProcess.d.ts.map +1 -0
  114. package/dist/src/db/write/updateItemPropertyValue.d.ts.map +1 -1
  115. package/dist/src/events/files/download.d.ts +5 -1
  116. package/dist/src/events/files/download.d.ts.map +1 -1
  117. package/dist/src/events/item/easSyncManager.d.ts +71 -0
  118. package/dist/src/events/item/easSyncManager.d.ts.map +1 -0
  119. package/dist/src/events/item/index.d.ts.map +1 -1
  120. package/dist/src/events/item/mergeEasSyncOptions.d.ts +7 -0
  121. package/dist/src/events/item/mergeEasSyncOptions.d.ts.map +1 -0
  122. package/dist/src/events/item/syncDbWithEas.d.ts +0 -3
  123. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  124. package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts +17 -0
  125. package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts.map +1 -1
  126. package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts +6 -0
  127. package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts.map +1 -1
  128. package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts +16 -0
  129. package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts.map +1 -0
  130. package/dist/src/helpers/FileManager/BaseFileManager.d.ts +1 -0
  131. package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
  132. package/dist/src/helpers/compareMetadataRowsLatestFirst.d.ts +16 -0
  133. package/dist/src/helpers/compareMetadataRowsLatestFirst.d.ts.map +1 -0
  134. package/dist/src/helpers/constants.d.ts +20 -5
  135. package/dist/src/helpers/constants.d.ts.map +1 -1
  136. package/dist/src/helpers/environment.d.ts +5 -0
  137. package/dist/src/helpers/environment.d.ts.map +1 -1
  138. package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts.map +1 -1
  139. package/dist/src/helpers/index.d.ts +1 -0
  140. package/dist/src/helpers/index.d.ts.map +1 -1
  141. package/dist/src/helpers/readHtmlBodyForStorageSeed.d.ts +8 -0
  142. package/dist/src/helpers/readHtmlBodyForStorageSeed.d.ts.map +1 -0
  143. package/dist/src/index.d.ts +7 -3
  144. package/dist/src/index.d.ts.map +1 -1
  145. package/dist/src/interfaces/IQueryClient.d.ts +4 -0
  146. package/dist/src/interfaces/IQueryClient.d.ts.map +1 -1
  147. package/dist/src/node/helpers/QueryClient.d.ts.map +1 -1
  148. package/dist/src/seedSchema/EasSyncProcessSchema.d.ts +190 -0
  149. package/dist/src/seedSchema/EasSyncProcessSchema.d.ts.map +1 -0
  150. package/dist/src/seedSchema/index.d.ts +1 -0
  151. package/dist/src/seedSchema/index.d.ts.map +1 -1
  152. package/dist/src/services/write/writeProcessMachine.d.ts +1 -1
  153. package/dist/src/types/fileManager.d.ts +5 -0
  154. package/dist/src/types/fileManager.d.ts.map +1 -1
  155. package/dist/src/types/index.d.ts +3 -2
  156. package/dist/src/types/index.d.ts.map +1 -1
  157. package/dist/src/types/machines.d.ts +1 -1
  158. package/dist/src/types/machines.d.ts.map +1 -1
  159. package/dist/syncDbWithEas-CaytdS8D.js +583 -0
  160. package/dist/syncDbWithEas-CaytdS8D.js.map +1 -0
  161. package/dist/updateSeedRevokedAt-CfUXirik.js +22 -0
  162. package/dist/updateSeedRevokedAt-CfUXirik.js.map +1 -0
  163. package/package.json +1 -1
  164. package/dist/Db-CXwQVLZv.js.map +0 -1
  165. package/dist/FileManager-DHnyb040.js.map +0 -1
  166. package/dist/QueryClient-OUjfvY3g.js.map +0 -1
  167. package/dist/QueryClient-unspcsWa.js.map +0 -1
  168. package/dist/cjs/getPublishUploads-DdVy-5fK.js.map +0 -1
  169. package/dist/cjs/index-D1qR8xnb.js.map +0 -1
  170. package/dist/cjs/index-DTkoTvcq.js.map +0 -1
  171. package/dist/getPublishUploads-DS2dQ4Ho.js.map +0 -1
  172. package/dist/index-BrD_NNaX.js.map +0 -1
  173. package/dist/index-Cqf_DxkJ.js.map +0 -1
  174. package/dist/index-DdzhrbkF.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { y as BaseArweaveClient } from './index-BrD_NNaX.js';
1
+ import { y as BaseArweaveClient } from './index-DUMXLKJr.js';
2
2
  import { GraphQLClient } from 'graphql-request';
3
3
  import Arweave from 'arweave';
4
- import { G as GET_TRANSACTION_TAGS } from './queries-BGuWjEqt.js';
4
+ import { G as GET_TRANSACTION_TAGS } from './queries-0FZBThGQ.js';
5
5
  import debug from 'debug';
6
6
  import 'xstate';
7
7
  import 'drizzle-orm/sqlite-core';
@@ -202,4 +202,4 @@ class ArweaveClient extends BaseArweaveClient {
202
202
  BaseArweaveClient.setPlatformClass(ArweaveClient);
203
203
 
204
204
  export { ArweaveClient };
205
- //# sourceMappingURL=ArweaveClient-DxpJnJXU.js.map
205
+ //# sourceMappingURL=ArweaveClient-B-vm2Xae.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArweaveClient-DxpJnJXU.js","sources":["../../src/node/helpers/ArweaveClient.ts"],"sourcesContent":["import { BaseArweaveClient } from '@/helpers/ArweaveClient/BaseArweaveClient';\nimport { GraphQLClient } from 'graphql-request';\nimport Arweave from 'arweave';\nimport type {\n TransactionStatus,\n TransactionTag,\n GetDataOptions,\n DownloadFilesParams,\n DownloadResult,\n CreateTransactionOptions,\n} from '@/types/arweave';\nimport { GET_TRANSACTION_TAGS } from '@/helpers/ArweaveClient/queries';\nimport debug from 'debug';\n\nconst logger = debug('seedSdk:node:ArweaveClient');\n\n// Cached Arweave instance (keyed by gateway so setHost / protocol changes apply)\nlet _arweaveInstance: Arweave | null = null;\nlet _arweaveGatewayKey: string | null = null;\n\n/**\n * Get or create the Arweave instance for Node.js\n */\nconst getArweaveInstance = (): Arweave => {\n const gatewayKey = `${BaseArweaveClient.getProtocol()}://${BaseArweaveClient.getHost()}`;\n if (_arweaveInstance && _arweaveGatewayKey === gatewayKey) {\n return _arweaveInstance;\n }\n\n _arweaveGatewayKey = gatewayKey;\n\n const host = BaseArweaveClient.getHost();\n const protocol = BaseArweaveClient.getProtocol();\n\n // Handle both ES modules and CommonJS exports from arweave package\n if ('default' in Arweave && typeof (Arweave as any).default?.init === 'function') {\n _arweaveInstance = (Arweave as any).default.init({\n host,\n protocol,\n });\n } else {\n _arweaveInstance = Arweave.init({\n host,\n protocol,\n });\n }\n\n return _arweaveInstance!;\n};\n\nclass ArweaveClient extends BaseArweaveClient {\n /**\n * Get the GraphQL client for Arweave queries\n */\n static getArweaveClient(): GraphQLClient {\n return new GraphQLClient(BaseArweaveClient.getEndpoint());\n }\n\n /**\n * Get the status of a transaction\n */\n static async getTransactionStatus(transactionId: string): Promise<TransactionStatus> {\n const url = BaseArweaveClient.getStatusUrl(transactionId);\n\n try {\n const response = await fetch(url);\n\n if (response.status === 404) {\n return {\n status: 404,\n confirmed: null,\n };\n }\n\n if (!response.ok) {\n return {\n status: response.status,\n confirmed: null,\n };\n }\n\n if (response.body) {\n await response.body.cancel();\n }\n\n return {\n status: 200,\n confirmed: null,\n };\n } catch (error) {\n logger('Error fetching transaction status:', error);\n return {\n status: 500,\n confirmed: null,\n };\n }\n }\n\n /**\n * Get transaction data\n */\n static async getTransactionData(\n transactionId: string,\n options?: GetDataOptions\n ): Promise<Uint8Array | string> {\n const arweave = getArweaveInstance();\n\n try {\n const data = await arweave.transactions.getData(transactionId, {\n decode: options?.decode ?? true,\n string: options?.string ?? false,\n });\n\n if (options?.string && typeof data === 'string') {\n return data;\n }\n\n // Ensure we return Uint8Array\n if (data instanceof Uint8Array) {\n return data;\n }\n\n // Handle string data when not requesting string\n if (typeof data === 'string') {\n return new TextEncoder().encode(data);\n }\n\n return data as Uint8Array;\n } catch (error) {\n logger('Error fetching transaction data:', error);\n throw error;\n }\n }\n\n /**\n * Get transaction tags via GraphQL\n */\n static async getTransactionTags(transactionId: string): Promise<TransactionTag[]> {\n const client = this.getArweaveClient();\n \n try {\n const result = await client.request(GET_TRANSACTION_TAGS, { transactionId });\n \n if (!result.tags?.tags) {\n return [];\n }\n\n return result.tags.tags.map((tag: { name: string; value: string }) => ({\n name: tag.name,\n value: tag.value,\n }));\n } catch (error) {\n logger('Error fetching transaction tags:', error);\n return [];\n }\n }\n\n /**\n * Create a new unsigned transaction\n */\n static async createTransaction(\n data: string | Uint8Array,\n options?: CreateTransactionOptions\n ): Promise<any> {\n const arweave = getArweaveInstance();\n\n const tx = await arweave.createTransaction({\n data,\n });\n\n // Add tags if provided\n if (options?.tags) {\n for (const tag of options.tags) {\n tx.addTag(tag.name, tag.value);\n }\n }\n\n return tx;\n }\n\n /**\n * Download multiple files from Arweave\n */\n static async downloadFiles(params: DownloadFilesParams): Promise<DownloadResult[]> {\n const { transactionIds, excludedTransactions } = params;\n const results: DownloadResult[] = [];\n const baseUrl = BaseArweaveClient.getBaseUrl();\n\n for (const transactionId of transactionIds) {\n // Skip excluded transactions\n if (excludedTransactions?.has(transactionId)) {\n continue;\n }\n\n try {\n const url = `${baseUrl}/raw/${transactionId}`;\n const response = await fetch(url);\n\n if (!response.ok) {\n results.push({\n transactionId,\n success: false,\n error: `HTTP ${response.status}: ${response.statusText}`,\n });\n continue;\n }\n\n const arrayBuffer = await response.arrayBuffer();\n const data = new Uint8Array(arrayBuffer);\n\n // Detect content type\n const contentType = response.headers.get('content-type') || undefined;\n\n results.push({\n transactionId,\n success: true,\n contentType,\n data,\n });\n } catch (error) {\n logger(`Error downloading transaction ${transactionId}:`, error);\n results.push({\n transactionId,\n success: false,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n return results;\n }\n}\n\nBaseArweaveClient.setPlatformClass(ArweaveClient);\n\nexport { ArweaveClient };"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAcA,MAAM,MAAM,GAAG,KAAK,CAAC,4BAA4B,CAAC;AAElD;AACA,IAAI,gBAAgB,GAAmB,IAAI;AAC3C,IAAI,kBAAkB,GAAkB,IAAI;AAE5C;;AAEG;AACH,MAAM,kBAAkB,GAAG,MAAc;AACvC,IAAA,MAAM,UAAU,GAAG,CAAA,EAAG,iBAAiB,CAAC,WAAW,EAAE,CAAA,GAAA,EAAM,iBAAiB,CAAC,OAAO,EAAE,EAAE;AACxF,IAAA,IAAI,gBAAgB,IAAI,kBAAkB,KAAK,UAAU,EAAE;AACzD,QAAA,OA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,MAAM,GAAG,GAAG,CAAA,EAAG,OAAO,CAAA,KAAA,EAAQ,aAAa,EAAE;AAC7C,gBAAA,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC;AAEjC,gBAAA,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;oBAChB,OAAO,CAAC,IAAI,CAAC;wBACX,aAAa;AACb,wBAAA,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,QAAQ,QAAQ,CAAC,MAAM,CAAA,EAAA,EAAK,QAAQ,CAAC,UAAU,CAAA,CAAE;AACzD,qBAAA,CAAC;oBACF;gBACF;AAEA,gBAAA,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE;AAChD,gBAAA,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC;;AAGxC,gBAAA,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,SAAS;gBAErE,OAAO,CAAC,IAAI,CAAC;oBACX,aAAa;AACb,oBAAA,OAAO,EAAE,IAAI;oBACb,WAAW;oBACX,IAAI;AACL,iBAAA,CAAC;YACJ;YAAE,OAAO,KAAK,EAAE;AACd,gBAAA,MAAM,CAAC,CAAA,8BAAA,EAAiC,aAAa,GAAG,EAAE,KAAK,CAAC;gBAChE,OAAO,CAAC,IAAI,CAAC;oBACX,aAAa;AACb,oBAAA,OAAO,EAAE,KAAK;AACd,oBAAA,KAAK,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;AAC9D,iBAAA,CAAC;YACJ;QACF;AAEA,QAAA,OAAO,OAAO;IAChB;AACD;AAED,iBAAiB,CAAC,gBAAgB,CAAC,aAAa,CAAC;;;;"}
1
+ {"version":3,"file":"ArweaveClient-B-vm2Xae.js","sources":["../../src/node/helpers/ArweaveClient.ts"],"sourcesContent":["import { BaseArweaveClient } from '@/helpers/ArweaveClient/BaseArweaveClient';\nimport { GraphQLClient } from 'graphql-request';\nimport Arweave from 'arweave';\nimport type {\n TransactionStatus,\n TransactionTag,\n GetDataOptions,\n DownloadFilesParams,\n DownloadResult,\n CreateTransactionOptions,\n} from '@/types/arweave';\nimport { GET_TRANSACTION_TAGS } from '@/helpers/ArweaveClient/queries';\nimport debug from 'debug';\n\nconst logger = debug('seedSdk:node:ArweaveClient');\n\n// Cached Arweave instance (keyed by gateway so setHost / protocol changes apply)\nlet _arweaveInstance: Arweave | null = null;\nlet _arweaveGatewayKey: string | null = null;\n\n/**\n * Get or create the Arweave instance for Node.js\n */\nconst getArweaveInstance = (): Arweave => {\n const gatewayKey = `${BaseArweaveClient.getProtocol()}://${BaseArweaveClient.getHost()}`;\n if (_arweaveInstance && _arweaveGatewayKey === gatewayKey) {\n return _arweaveInstance;\n }\n\n _arweaveGatewayKey = gatewayKey;\n\n const host = BaseArweaveClient.getHost();\n const protocol = BaseArweaveClient.getProtocol();\n\n // Handle both ES modules and CommonJS exports from arweave package\n if ('default' in Arweave && typeof (Arweave as any).default?.init === 'function') {\n _arweaveInstance = (Arweave as any).default.init({\n host,\n protocol,\n });\n } else {\n _arweaveInstance = Arweave.init({\n host,\n protocol,\n });\n }\n\n return _arweaveInstance!;\n};\n\nclass ArweaveClient extends BaseArweaveClient {\n /**\n * Get the GraphQL client for Arweave queries\n */\n static getArweaveClient(): GraphQLClient {\n return new GraphQLClient(BaseArweaveClient.getEndpoint());\n }\n\n /**\n * Get the status of a transaction\n */\n static async getTransactionStatus(transactionId: string): Promise<TransactionStatus> {\n const url = BaseArweaveClient.getStatusUrl(transactionId);\n\n try {\n const response = await fetch(url);\n\n if (response.status === 404) {\n return {\n status: 404,\n confirmed: null,\n };\n }\n\n if (!response.ok) {\n return {\n status: response.status,\n confirmed: null,\n };\n }\n\n if (response.body) {\n await response.body.cancel();\n }\n\n return {\n status: 200,\n confirmed: null,\n };\n } catch (error) {\n logger('Error fetching transaction status:', error);\n return {\n status: 500,\n confirmed: null,\n };\n }\n }\n\n /**\n * Get transaction data\n */\n static async getTransactionData(\n transactionId: string,\n options?: GetDataOptions\n ): Promise<Uint8Array | string> {\n const arweave = getArweaveInstance();\n\n try {\n const data = await arweave.transactions.getData(transactionId, {\n decode: options?.decode ?? true,\n string: options?.string ?? false,\n });\n\n if (options?.string && typeof data === 'string') {\n return data;\n }\n\n // Ensure we return Uint8Array\n if (data instanceof Uint8Array) {\n return data;\n }\n\n // Handle string data when not requesting string\n if (typeof data === 'string') {\n return new TextEncoder().encode(data);\n }\n\n return data as Uint8Array;\n } catch (error) {\n logger('Error fetching transaction data:', error);\n throw error;\n }\n }\n\n /**\n * Get transaction tags via GraphQL\n */\n static async getTransactionTags(transactionId: string): Promise<TransactionTag[]> {\n const client = this.getArweaveClient();\n \n try {\n const result = await client.request(GET_TRANSACTION_TAGS, { transactionId });\n \n if (!result.tags?.tags) {\n return [];\n }\n\n return result.tags.tags.map((tag: { name: string; value: string }) => ({\n name: tag.name,\n value: tag.value,\n }));\n } catch (error) {\n logger('Error fetching transaction tags:', error);\n return [];\n }\n }\n\n /**\n * Create a new unsigned transaction\n */\n static async createTransaction(\n data: string | Uint8Array,\n options?: CreateTransactionOptions\n ): Promise<any> {\n const arweave = getArweaveInstance();\n\n const tx = await arweave.createTransaction({\n data,\n });\n\n // Add tags if provided\n if (options?.tags) {\n for (const tag of options.tags) {\n tx.addTag(tag.name, tag.value);\n }\n }\n\n return tx;\n }\n\n /**\n * Download multiple files from Arweave\n */\n static async downloadFiles(params: DownloadFilesParams): Promise<DownloadResult[]> {\n const { transactionIds, excludedTransactions } = params;\n const results: DownloadResult[] = [];\n const baseUrl = BaseArweaveClient.getBaseUrl();\n\n for (const transactionId of transactionIds) {\n // Skip excluded transactions\n if (excludedTransactions?.has(transactionId)) {\n continue;\n }\n\n try {\n const url = `${baseUrl}/raw/${transactionId}`;\n const response = await fetch(url);\n\n if (!response.ok) {\n results.push({\n transactionId,\n success: false,\n error: `HTTP ${response.status}: ${response.statusText}`,\n });\n continue;\n }\n\n const arrayBuffer = await response.arrayBuffer();\n const data = new Uint8Array(arrayBuffer);\n\n // Detect content type\n const contentType = response.headers.get('content-type') || undefined;\n\n results.push({\n transactionId,\n success: true,\n contentType,\n data,\n });\n } catch (error) {\n logger(`Error downloading transaction ${transactionId}:`, error);\n results.push({\n transactionId,\n success: false,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n return results;\n }\n}\n\nBaseArweaveClient.setPlatformClass(ArweaveClient);\n\nexport { ArweaveClient };"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAcA,MAAM,MAAM,GAAG,KAAK,CAAC,4BAA4B,CAAC;AAElD;AACA,IAAI,gBAAgB,GAAmB,IAAI;AAC3C,IAAI,kBAAkB,GAAkB,IAAI;AAE5C;;AAEG;AACH,MAAM,kBAAkB,GAAG,MAAc;AACvC,IAAA,MAAM,UAAU,GAAG,CAAA,EAAG,iBAAiB,CAAC,WAAW,EAAE,CAAA,GAAA,EAAM,iBAAiB,CAAC,OAAO,EAAE,EAAE;AACxF,IAAA,IAAI,gBAAgB,IAAI,kBAAkB,KAAK,UAAU,EAAE;AACzD,QAAA,OAAO,gBAAgB;IACzB;IAEA,kBAAkB,GAAG,UAAU;AAE/B,IAAA,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,EAAE;AACxC,IAAA,MAAM,QAAQ,GAAG,iBAAiB,CAAC,WAAW,EAAE;;AAGhD,IAAA,IAAI,SAAS,IAAI,OAAO,IAAI,OAAQ,OAAe,CAAC,OAAO,EAAE,IAAI,KAAK,UAAU,EAAE;AAChF,QAAA,gBAAgB,GAAI,OAAe,CAAC,OAAO,CAAC,IAAI,CAAC;YAC/C,IAAI;YACJ,QAAQ;AACT,SAAA,CAAC;IACJ;SAAO;AACL,QAAA,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;YAC9B,IAAI;YACJ,QAAQ;AACT,SAAA,CAAC;IACJ;AAEA,IAAA,OAAO,gBAAiB;AA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;;AAGxC,gBAAA,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,SAAS;gBAErE,OAAO,CAAC,IAAI,CAAC;oBACX,aAAa;AACb,oBAAA,OAAO,EAAE,IAAI;oBACb,WAAW;oBACX,IAAI;AACL,iBAAA,CAAC;YACJ;YAAE,OAAO,KAAK,EAAE;AACd,gBAAA,MAAM,CAAC,CAAA,8BAAA,EAAiC,aAAa,GAAG,EAAE,KAAK,CAAC;gBAChE,OAAO,CAAC,IAAI,CAAC;oBACX,aAAa;AACb,oBAAA,OAAO,EAAE,KAAK;AACd,oBAAA,KAAK,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;AAC9D,iBAAA,CAAC;YACJ;QACF;AAEA,QAAA,OAAO,OAAO;IAChB;AACD;AAED,iBAAiB,CAAC,gBAAgB,CAAC,aAAa,CAAC;;;;"}
@@ -1,7 +1,7 @@
1
- import { y as BaseArweaveClient } from './index-BrD_NNaX.js';
1
+ import { y as BaseArweaveClient } from './index-DUMXLKJr.js';
2
2
  import { GraphQLClient } from 'graphql-request';
3
3
  import Arweave from 'arweave';
4
- import { G as GET_TRANSACTION_TAGS } from './queries-BGuWjEqt.js';
4
+ import { G as GET_TRANSACTION_TAGS } from './queries-0FZBThGQ.js';
5
5
  import debug from 'debug';
6
6
  import 'xstate';
7
7
  import 'drizzle-orm/sqlite-core';
@@ -202,4 +202,4 @@ class ArweaveClient extends BaseArweaveClient {
202
202
  BaseArweaveClient.setPlatformClass(ArweaveClient);
203
203
 
204
204
  export { ArweaveClient };
205
- //# sourceMappingURL=ArweaveClient-Cz9ZLiEV.js.map
205
+ //# sourceMappingURL=ArweaveClient-C-eLH0zU.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArweaveClient-Cz9ZLiEV.js","sources":["../../src/browser/helpers/ArweaveClient.ts"],"sourcesContent":["import { BaseArweaveClient } from \"@/helpers/ArweaveClient/BaseArweaveClient\";\nimport { GraphQLClient } from \"graphql-request\";\nimport Arweave from \"arweave\";\nimport type {\n TransactionStatus,\n TransactionTag,\n GetDataOptions,\n DownloadFilesParams,\n DownloadResult,\n CreateTransactionOptions,\n} from \"@/types/arweave\";\nimport { GET_TRANSACTION_TAGS } from \"@/helpers/ArweaveClient/queries\";\nimport debug from \"debug\";\n\nconst logger = debug(\"seedSdk:browser:ArweaveClient\");\n\n// Cached Arweave instance (keyed by gateway so setHost / protocol changes apply)\nlet _arweaveInstance: Arweave | null = null;\nlet _arweaveGatewayKey: string | null = null;\n\n/**\n * Get or create the Arweave instance for browser\n */\nconst getArweaveInstance = (): Arweave => {\n const gatewayKey = `${BaseArweaveClient.getProtocol()}://${BaseArweaveClient.getHost()}`;\n if (_arweaveInstance && _arweaveGatewayKey === gatewayKey) {\n return _arweaveInstance;\n }\n\n _arweaveGatewayKey = gatewayKey;\n\n const host = BaseArweaveClient.getHost();\n const protocol = BaseArweaveClient.getProtocol();\n\n // Handle both ES modules and CommonJS exports from arweave package\n if (\"default\" in Arweave && typeof (Arweave as any).default?.init === \"function\") {\n _arweaveInstance = (Arweave as any).default.init({\n host,\n protocol,\n });\n } else {\n _arweaveInstance = Arweave.init({\n host,\n protocol,\n });\n }\n\n return _arweaveInstance!;\n};\n\nclass ArweaveClient extends BaseArweaveClient {\n /**\n * Get the GraphQL client for Arweave queries\n */\n static getArweaveClient(): GraphQLClient {\n return new GraphQLClient(BaseArweaveClient.getEndpoint());\n }\n\n /**\n * Get the status of a transaction\n */\n static async getTransactionStatus(transactionId: string): Promise<TransactionStatus> {\n const url = BaseArweaveClient.getStatusUrl(transactionId);\n\n try {\n const response = await fetch(url);\n\n if (response.status === 404) {\n return {\n status: 404,\n confirmed: null,\n };\n }\n\n if (!response.ok) {\n return {\n status: response.status,\n confirmed: null,\n };\n }\n\n if (response.body) {\n await response.body.cancel();\n }\n\n return {\n status: 200,\n confirmed: null,\n };\n } catch (error) {\n logger(\"Error fetching transaction status:\", error);\n return {\n status: 500,\n confirmed: null,\n };\n }\n }\n\n /**\n * Get transaction data\n */\n static async getTransactionData(\n transactionId: string,\n options?: GetDataOptions\n ): Promise<Uint8Array | string> {\n const arweave = getArweaveInstance();\n\n try {\n const data = await arweave.transactions.getData(transactionId, {\n decode: options?.decode ?? true,\n string: options?.string ?? false,\n });\n\n if (options?.string && typeof data === \"string\") {\n return data;\n }\n\n // Ensure we return Uint8Array\n if (data instanceof Uint8Array) {\n return data;\n }\n\n // Handle string data when not requesting string\n if (typeof data === \"string\") {\n return new TextEncoder().encode(data);\n }\n\n return data as Uint8Array;\n } catch (error) {\n logger(\"Error fetching transaction data:\", error);\n throw error;\n }\n }\n\n /**\n * Get transaction tags via GraphQL\n */\n static async getTransactionTags(transactionId: string): Promise<TransactionTag[]> {\n const client = this.getArweaveClient();\n \n try {\n const result = await client.request(GET_TRANSACTION_TAGS, { transactionId });\n \n if (!result.tags?.tags) {\n return [];\n }\n\n return result.tags.tags.map((tag: { name: string; value: string }) => ({\n name: tag.name,\n value: tag.value,\n }));\n } catch (error) {\n logger(\"Error fetching transaction tags:\", error);\n return [];\n }\n }\n\n /**\n * Create a new unsigned transaction\n */\n static async createTransaction(\n data: string | Uint8Array,\n options?: CreateTransactionOptions\n ): Promise<any> {\n const arweave = getArweaveInstance();\n\n const tx = await arweave.createTransaction({\n data,\n });\n\n // Add tags if provided\n if (options?.tags) {\n for (const tag of options.tags) {\n tx.addTag(tag.name, tag.value);\n }\n }\n\n return tx;\n }\n\n /**\n * Download multiple files from Arweave\n */\n static async downloadFiles(params: DownloadFilesParams): Promise<DownloadResult[]> {\n const { transactionIds, excludedTransactions } = params;\n const results: DownloadResult[] = [];\n const baseUrl = BaseArweaveClient.getBaseUrl();\n\n for (const transactionId of transactionIds) {\n // Skip excluded transactions\n if (excludedTransactions?.has(transactionId)) {\n continue;\n }\n\n try {\n const url = `${baseUrl}/raw/${transactionId}`;\n const response = await fetch(url);\n\n if (!response.ok) {\n results.push({\n transactionId,\n success: false,\n error: `HTTP ${response.status}: ${response.statusText}`,\n });\n continue;\n }\n\n const arrayBuffer = await response.arrayBuffer();\n const data = new Uint8Array(arrayBuffer);\n\n // Detect content type\n const contentType = response.headers.get(\"content-type\") || undefined;\n\n results.push({\n transactionId,\n success: true,\n contentType,\n data,\n });\n } catch (error) {\n logger(`Error downloading transaction ${transactionId}:`, error);\n results.push({\n transactionId,\n success: false,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n return results;\n }\n}\n\nBaseArweaveClient.setPlatformClass(ArweaveClient);\n\nexport { ArweaveClient };"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAcA,MAAM,MAAM,GAAG,KAAK,CAAC,+BAA+B,CAAC;AAErD;AACA,IAAI,gBAAgB,GAAmB,IAAI;AAC3C,IAAI,kBAAkB,GAAkB,IAAI;AAE5C;;AAEG;AACH,MAAM,kBAAkB,GAAG,MAAc;AACvC,IAAA,MAAM,UAAU,GAAG,CAAA,EAAG,iBAAiB,CAAC,WAAW,EAAE,CAAA,GAAA,EAAM,iBAAiB,CAAC,OAAO,EAAE,EAAE;AACxF,IAAA,IAAI,gBAAgB,IAAI,kBAAkB,KAAK,UAAU,EAAE;AACzD,QAAA,OAAO,gBAAgB;IACzB;IAEA,kBAAkB,GAAG,UAAU;AAE/B,IAAA,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,EAAE;AACxC,IAAA,MAAM,QAAQ,GAAG,iBAAiB,CAAC,WAAW,EAAE;;AAGhD,IAAA,IAAI,SAAS,IAAI,OAAO,IAAI,OAAQ,OAAe,CAAC,OAAO,EAAE,IAAI,KAAK,UAAU,EAAE;AAChF,QAAA,gBAAgB,GAAI,OAAe,CAAC,OAAO,CAAC,IAAI,CAAC;YAC/C,IAAI;YACJ,QAAQ;AACT,SAAA,CAAC;IACJ;SAAO;AACL,QAAA,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;YAC9B,IAAI;YACJ,QAAQ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gBAAA,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC;;AAGxC,gBAAA,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,SAAS;gBAErE,OAAO,CAAC,IAAI,CAAC;oBACX,aAAa;AACb,oBAAA,OAAO,EAAE,IAAI;oBACb,WAAW;oBACX,IAAI;AACL,iBAAA,CAAC;YACJ;YAAE,OAAO,KAAK,EAAE;AACd,gBAAA,MAAM,CAAC,CAAA,8BAAA,EAAiC,aAAa,GAAG,EAAE,KAAK,CAAC;gBAChE,OAAO,CAAC,IAAI,CAAC;oBACX,aAAa;AACb,oBAAA,OAAO,EAAE,KAAK;AACd,oBAAA,KAAK,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;AAC9D,iBAAA,CAAC;YACJ;QACF;AAEA,QAAA,OAAO,OAAO;IAChB;AACD;AAED,iBAAiB,CAAC,gBAAgB,CAAC,aAAa,CAAC;;;;"}
1
+ {"version":3,"file":"ArweaveClient-C-eLH0zU.js","sources":["../../src/browser/helpers/ArweaveClient.ts"],"sourcesContent":["import { BaseArweaveClient } from \"@/helpers/ArweaveClient/BaseArweaveClient\";\nimport { GraphQLClient } from \"graphql-request\";\nimport Arweave from \"arweave\";\nimport type {\n TransactionStatus,\n TransactionTag,\n GetDataOptions,\n DownloadFilesParams,\n DownloadResult,\n CreateTransactionOptions,\n} from \"@/types/arweave\";\nimport { GET_TRANSACTION_TAGS } from \"@/helpers/ArweaveClient/queries\";\nimport debug from \"debug\";\n\nconst logger = debug(\"seedSdk:browser:ArweaveClient\");\n\n// Cached Arweave instance (keyed by gateway so setHost / protocol changes apply)\nlet _arweaveInstance: Arweave | null = null;\nlet _arweaveGatewayKey: string | null = null;\n\n/**\n * Get or create the Arweave instance for browser\n */\nconst getArweaveInstance = (): Arweave => {\n const gatewayKey = `${BaseArweaveClient.getProtocol()}://${BaseArweaveClient.getHost()}`;\n if (_arweaveInstance && _arweaveGatewayKey === gatewayKey) {\n return _arweaveInstance;\n }\n\n _arweaveGatewayKey = gatewayKey;\n\n const host = BaseArweaveClient.getHost();\n const protocol = BaseArweaveClient.getProtocol();\n\n // Handle both ES modules and CommonJS exports from arweave package\n if (\"default\" in Arweave && typeof (Arweave as any).default?.init === \"function\") {\n _arweaveInstance = (Arweave as any).default.init({\n host,\n protocol,\n });\n } else {\n _arweaveInstance = Arweave.init({\n host,\n protocol,\n });\n }\n\n return _arweaveInstance!;\n};\n\nclass ArweaveClient extends BaseArweaveClient {\n /**\n * Get the GraphQL client for Arweave queries\n */\n static getArweaveClient(): GraphQLClient {\n return new GraphQLClient(BaseArweaveClient.getEndpoint());\n }\n\n /**\n * Get the status of a transaction\n */\n static async getTransactionStatus(transactionId: string): Promise<TransactionStatus> {\n const url = BaseArweaveClient.getStatusUrl(transactionId);\n\n try {\n const response = await fetch(url);\n\n if (response.status === 404) {\n return {\n status: 404,\n confirmed: null,\n };\n }\n\n if (!response.ok) {\n return {\n status: response.status,\n confirmed: null,\n };\n }\n\n if (response.body) {\n await response.body.cancel();\n }\n\n return {\n status: 200,\n confirmed: null,\n };\n } catch (error) {\n logger(\"Error fetching transaction status:\", error);\n return {\n status: 500,\n confirmed: null,\n };\n }\n }\n\n /**\n * Get transaction data\n */\n static async getTransactionData(\n transactionId: string,\n options?: GetDataOptions\n ): Promise<Uint8Array | string> {\n const arweave = getArweaveInstance();\n\n try {\n const data = await arweave.transactions.getData(transactionId, {\n decode: options?.decode ?? true,\n string: options?.string ?? false,\n });\n\n if (options?.string && typeof data === \"string\") {\n return data;\n }\n\n // Ensure we return Uint8Array\n if (data instanceof Uint8Array) {\n return data;\n }\n\n // Handle string data when not requesting string\n if (typeof data === \"string\") {\n return new TextEncoder().encode(data);\n }\n\n return data as Uint8Array;\n } catch (error) {\n logger(\"Error fetching transaction data:\", error);\n throw error;\n }\n }\n\n /**\n * Get transaction tags via GraphQL\n */\n static async getTransactionTags(transactionId: string): Promise<TransactionTag[]> {\n const client = this.getArweaveClient();\n \n try {\n const result = await client.request(GET_TRANSACTION_TAGS, { transactionId });\n \n if (!result.tags?.tags) {\n return [];\n }\n\n return result.tags.tags.map((tag: { name: string; value: string }) => ({\n name: tag.name,\n value: tag.value,\n }));\n } catch (error) {\n logger(\"Error fetching transaction tags:\", error);\n return [];\n }\n }\n\n /**\n * Create a new unsigned transaction\n */\n static async createTransaction(\n data: string | Uint8Array,\n options?: CreateTransactionOptions\n ): Promise<any> {\n const arweave = getArweaveInstance();\n\n const tx = await arweave.createTransaction({\n data,\n });\n\n // Add tags if provided\n if (options?.tags) {\n for (const tag of options.tags) {\n tx.addTag(tag.name, tag.value);\n }\n }\n\n return tx;\n }\n\n /**\n * Download multiple files from Arweave\n */\n static async downloadFiles(params: DownloadFilesParams): Promise<DownloadResult[]> {\n const { transactionIds, excludedTransactions } = params;\n const results: DownloadResult[] = [];\n const baseUrl = BaseArweaveClient.getBaseUrl();\n\n for (const transactionId of transactionIds) {\n // Skip excluded transactions\n if (excludedTransactions?.has(transactionId)) {\n continue;\n }\n\n try {\n const url = `${baseUrl}/raw/${transactionId}`;\n const response = await fetch(url);\n\n if (!response.ok) {\n results.push({\n transactionId,\n success: false,\n error: `HTTP ${response.status}: ${response.statusText}`,\n });\n continue;\n }\n\n const arrayBuffer = await response.arrayBuffer();\n const data = new Uint8Array(arrayBuffer);\n\n // Detect content type\n const contentType = response.headers.get(\"content-type\") || undefined;\n\n results.push({\n transactionId,\n success: true,\n contentType,\n data,\n });\n } catch (error) {\n logger(`Error downloading transaction ${transactionId}:`, error);\n results.push({\n transactionId,\n success: false,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n return results;\n }\n}\n\nBaseArweaveClient.setPlatformClass(ArweaveClient);\n\nexport { ArweaveClient };"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAcA,MAAM,MAAM,GAAG,KAAK,CAAC,+BAA+B,CAAC;A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AK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;AAC9D,iBAAA,CAAC;YACJ;QACF;AAEA,QAAA,OAAO,OAAO;IAChB;AACD;AAED,iBAAiB,CAAC,gBAAgB,CAAC,aAAa,CAAC;;;;"}
@@ -1,10 +1,10 @@
1
- import { p as BaseDb, v as BaseFileManager } from './index-BrD_NNaX.js';
1
+ import { p as BaseDb, v as BaseFileManager } from './index-DUMXLKJr.js';
2
2
  import debug from 'debug';
3
3
  import { sql } from 'drizzle-orm';
4
4
  import { readMigrationFiles } from 'drizzle-orm/migrator';
5
5
  import { drizzle } from 'drizzle-orm/sqlite-proxy';
6
6
  import { migrate } from 'drizzle-orm/sqlite-proxy/migrator';
7
- import { s as schema } from './index-DdzhrbkF.js';
7
+ import { s as schema } from './index-BRo7D3s1.js';
8
8
  import { SQLocalDrizzle } from 'sqlocal/drizzle';
9
9
  import { Observable, distinctUntilChanged } from 'rxjs';
10
10
  import 'xstate';
@@ -241,6 +241,19 @@ const migrationSql_0012_html_embedded_image_co_publish = `CREATE TABLE \`html_em
241
241
  --> statement-breakpoint
242
242
  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\`);
243
243
  `;
244
+ const migrationSql_0013_eas_sync_processes = `CREATE TABLE \`eas_sync_processes\` (
245
+ \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
246
+ \`status\` text NOT NULL,
247
+ \`started_at\` integer NOT NULL,
248
+ \`completed_at\` integer,
249
+ \`request_payload\` text NOT NULL,
250
+ \`error_message\` text,
251
+ \`error_details\` text,
252
+ \`persisted_snapshot\` text NOT NULL,
253
+ \`created_at\` integer,
254
+ \`updated_at\` integer
255
+ );
256
+ `;
244
257
  // Journal JSON file
245
258
  const journalJson = `{
246
259
  "version": "7",
@@ -336,6 +349,13 @@ const journalJson = `{
336
349
  "when": 1774200000000,
337
350
  "tag": "0012_html_embedded_image_co_publish",
338
351
  "breakpoints": true
352
+ },
353
+ {
354
+ "idx": 13,
355
+ "version": "6",
356
+ "when": 1774300000000,
357
+ "tag": "0013_eas_sync_processes",
358
+ "breakpoints": true
339
359
  }
340
360
  ]
341
361
  }`;
@@ -344,8 +364,8 @@ const journalJson = `{
344
364
  const snapshotJson = `{
345
365
  "version": "6",
346
366
  "dialect": "sqlite",
347
- "id": "ff2318d5-236f-4157-82ae-10ccb44c0e0c",
348
- "prevId": "ff040f54-6cfc-4d32-a572-2f08870c5b85",
367
+ "id": "a9e8f7d6-c5b4-4321-a0b9-c8d7e6f5a4b3",
368
+ "prevId": "ff2318d5-236f-4157-82ae-10ccb44c0e0c",
349
369
  "tables": {
350
370
  "appState": {
351
371
  "name": "appState",
@@ -1510,6 +1530,86 @@ const snapshotJson = `{
1510
1530
  "compositePrimaryKeys": {},
1511
1531
  "uniqueConstraints": {},
1512
1532
  "checkConstraints": {}
1533
+ },
1534
+ "eas_sync_processes": {
1535
+ "name": "eas_sync_processes",
1536
+ "columns": {
1537
+ "id": {
1538
+ "name": "id",
1539
+ "type": "integer",
1540
+ "primaryKey": true,
1541
+ "notNull": true,
1542
+ "autoincrement": true
1543
+ },
1544
+ "status": {
1545
+ "name": "status",
1546
+ "type": "text",
1547
+ "primaryKey": false,
1548
+ "notNull": true,
1549
+ "autoincrement": false
1550
+ },
1551
+ "started_at": {
1552
+ "name": "started_at",
1553
+ "type": "integer",
1554
+ "primaryKey": false,
1555
+ "notNull": true,
1556
+ "autoincrement": false
1557
+ },
1558
+ "completed_at": {
1559
+ "name": "completed_at",
1560
+ "type": "integer",
1561
+ "primaryKey": false,
1562
+ "notNull": false,
1563
+ "autoincrement": false
1564
+ },
1565
+ "request_payload": {
1566
+ "name": "request_payload",
1567
+ "type": "text",
1568
+ "primaryKey": false,
1569
+ "notNull": true,
1570
+ "autoincrement": false
1571
+ },
1572
+ "error_message": {
1573
+ "name": "error_message",
1574
+ "type": "text",
1575
+ "primaryKey": false,
1576
+ "notNull": false,
1577
+ "autoincrement": false
1578
+ },
1579
+ "error_details": {
1580
+ "name": "error_details",
1581
+ "type": "text",
1582
+ "primaryKey": false,
1583
+ "notNull": false,
1584
+ "autoincrement": false
1585
+ },
1586
+ "persisted_snapshot": {
1587
+ "name": "persisted_snapshot",
1588
+ "type": "text",
1589
+ "primaryKey": false,
1590
+ "notNull": true,
1591
+ "autoincrement": false
1592
+ },
1593
+ "created_at": {
1594
+ "name": "created_at",
1595
+ "type": "integer",
1596
+ "primaryKey": false,
1597
+ "notNull": false,
1598
+ "autoincrement": false
1599
+ },
1600
+ "updated_at": {
1601
+ "name": "updated_at",
1602
+ "type": "integer",
1603
+ "primaryKey": false,
1604
+ "notNull": false,
1605
+ "autoincrement": false
1606
+ }
1607
+ },
1608
+ "indexes": {},
1609
+ "foreignKeys": {},
1610
+ "compositePrimaryKeys": {},
1611
+ "uniqueConstraints": {},
1612
+ "checkConstraints": {}
1513
1613
  }
1514
1614
  },
1515
1615
  "views": {},
@@ -1540,6 +1640,7 @@ var drizzleFiles = /*#__PURE__*/Object.freeze({
1540
1640
  migrationSql_0010_add_arweave_l1_finalize_jobs: migrationSql_0010_add_arweave_l1_finalize_jobs,
1541
1641
  migrationSql_0011_normalize_placeholder_uids: migrationSql_0011_normalize_placeholder_uids,
1542
1642
  migrationSql_0012_html_embedded_image_co_publish: migrationSql_0012_html_embedded_image_co_publish,
1643
+ migrationSql_0013_eas_sync_processes: migrationSql_0013_eas_sync_processes,
1543
1644
  snapshotJson: snapshotJson
1544
1645
  });
1545
1646
 
@@ -1595,7 +1696,7 @@ class Db extends BaseDb {
1595
1696
  logger('[Db.prepareDb] database prepared');
1596
1697
  await this.runMigrations(db);
1597
1698
  this.appDb = db;
1598
- const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-CRyRez3h.js');
1699
+ const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-CBlRaU_M.js');
1599
1700
  await backfillMetadataPropertyIds();
1600
1701
  return this.appDb;
1601
1702
  }
@@ -1995,4 +2096,4 @@ class Db extends BaseDb {
1995
2096
  }
1996
2097
 
1997
2098
  export { Db };
1998
- //# sourceMappingURL=Db-CXwQVLZv.js.map
2099
+ //# sourceMappingURL=Db-B7whB3oJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Db-B7whB3oJ.js","sources":["../../src/browser/db/drizzleFiles.ts","../../src/browser/db/Db.ts"],"sourcesContent":["// This file embeds the drizzle migration files as strings for browser runtime\n// These files are copied from packages/sdk/src/db/drizzle at build time\n\n// Individual migration SQL files\nexport const migrationSql_0000_married_malice = `CREATE TABLE \\`appState\\` (\n\t\\`key\\` text,\n\t\\`value\\` text,\n\t\\`created_at\\` integer,\n\t\\`updated_at\\` integer\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`appState_key_unique\\` ON \\`appState\\` (\\`key\\`);--> statement-breakpoint\nCREATE TABLE \\`config\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`key\\` text NOT NULL,\n\t\\`text\\` text,\n\t\\`json\\` text,\n\t\\`blob\\` blob\n);\n--> statement-breakpoint\nCREATE TABLE \\`metadata\\` (\n\t\\`local_id\\` text,\n\t\\`uid\\` text,\n\t\\`property_name\\` text,\n\t\\`property_value\\` text,\n\t\\`schema_uid\\` text,\n\t\\`model_type\\` text,\n\t\\`seed_local_id\\` text,\n\t\\`seed_uid\\` text,\n\t\\`version_local_id\\` text,\n\t\\`version_uid\\` text,\n\t\\`eas_data_type\\` text,\n\t\\`ref_value_type\\` text,\n\t\\`ref_schema_uid\\` text,\n\t\\`ref_seed_type\\` text,\n\t\\`ref_resolved_value\\` text,\n\t\\`ref_resolved_display_value\\` text,\n\t\\`local_storage_dir\\` text,\n\t\\`attestation_raw\\` text,\n\t\\`attestation_created_at\\` integer,\n\t\\`content_hash\\` text,\n\t\\`created_at\\` integer,\n\t\\`updated_at\\` integer\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`metadata_local_id_unique\\` ON \\`metadata\\` (\\`local_id\\`);--> statement-breakpoint\nCREATE TABLE \\`models\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`name\\` text NOT NULL,\n\t\\`schema_file_id\\` text\n);\n--> statement-breakpoint\nCREATE TABLE \\`properties\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`name\\` text NOT NULL,\n\t\\`data_type\\` text NOT NULL,\n\t\\`model_id\\` integer NOT NULL,\n\t\\`ref_model_id\\` integer,\n\t\\`ref_value_type\\` text,\n\t\\`schema_file_id\\` text,\n\tFOREIGN KEY (\\`model_id\\`) REFERENCES \\`models\\`(\\`id\\`) ON UPDATE no action ON DELETE no action,\n\tFOREIGN KEY (\\`ref_model_id\\`) REFERENCES \\`models\\`(\\`id\\`) ON UPDATE no action ON DELETE no action\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`unique_name_model_id\\` ON \\`properties\\` (\\`name\\`,\\`model_id\\`);--> statement-breakpoint\nCREATE TABLE \\`model_schemas\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`model_id\\` integer,\n\t\\`schema_id\\` integer,\n\tFOREIGN KEY (\\`model_id\\`) REFERENCES \\`models\\`(\\`id\\`) ON UPDATE no action ON DELETE no action,\n\tFOREIGN KEY (\\`schema_id\\`) REFERENCES \\`schemas\\`(\\`id\\`) ON UPDATE no action ON DELETE no action\n);\n--> statement-breakpoint\nCREATE TABLE \\`model_uids\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`uid\\` text NOT NULL,\n\t\\`model_id\\` integer NOT NULL,\n\tFOREIGN KEY (\\`model_id\\`) REFERENCES \\`models\\`(\\`id\\`) ON UPDATE no action ON DELETE no action\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`model_uids_model_id_unique\\` ON \\`model_uids\\` (\\`model_id\\`);--> statement-breakpoint\nCREATE TABLE \\`property_uids\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`uid\\` text NOT NULL,\n\t\\`property_id\\` integer NOT NULL,\n\tFOREIGN KEY (\\`property_id\\`) REFERENCES \\`models\\`(\\`id\\`) ON UPDATE no action ON DELETE no action\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`property_uids_property_id_unique\\` ON \\`property_uids\\` (\\`property_id\\`);--> statement-breakpoint\nCREATE TABLE \\`schemas\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`name\\` text NOT NULL,\n\t\\`version\\` integer NOT NULL,\n\t\\`schema_file_id\\` text,\n\t\\`created_at\\` integer,\n\t\\`updated_at\\` integer\n);\n--> statement-breakpoint\nCREATE TABLE \\`seeds\\` (\n\t\\`local_id\\` text,\n\t\\`uid\\` text,\n\t\\`schema_uid\\` text,\n\t\\`type\\` text,\n\t\\`attestation_raw\\` text,\n\t\\`attestation_created_at\\` integer,\n\t\\`created_at\\` integer,\n\t\\`updated_at\\` integer,\n\t\\`_marked_for_deletion\\` integer\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`seeds_local_id_unique\\` ON \\`seeds\\` (\\`local_id\\`);--> statement-breakpoint\nCREATE TABLE \\`versions\\` (\n\t\\`local_id\\` text,\n\t\\`uid\\` text,\n\t\\`seed_local_id\\` text,\n\t\\`seed_uid\\` text,\n\t\\`seed_type\\` text,\n\t\\`note\\` text,\n\t\\`created_at\\` integer,\n\t\\`updated_at\\` integer,\n\t\\`attestation_created_at\\` integer,\n\t\\`attestation_raw\\` text\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`versions_local_id_unique\\` ON \\`versions\\` (\\`local_id\\`);`\n\nexport const migrationSql_0001_sweet_bruce_banner = `ALTER TABLE \\`schemas\\` ADD \\`schema_data\\` text;--> statement-breakpoint\nALTER TABLE \\`schemas\\` ADD \\`is_draft\\` integer;`\n\nexport const migrationSql_0002_bitter_proudstar = `CREATE UNIQUE INDEX \\`unique_schema_file_id\\` ON \\`models\\` (\\`schema_file_id\\`);--> statement-breakpoint\nCREATE UNIQUE INDEX \\`unique_property_schema_file_id\\` ON \\`properties\\` (\\`schema_file_id\\`);--> statement-breakpoint\nCREATE UNIQUE INDEX \\`unique_schema_schema_file_id\\` ON \\`schemas\\` (\\`schema_file_id\\`);`\n\nexport const migrationSql_0003_cultured_senator_kelly = `ALTER TABLE \\`models\\` ADD \\`is_edited\\` integer;--> statement-breakpoint\nALTER TABLE \\`properties\\` ADD \\`is_edited\\` integer;--> statement-breakpoint\nALTER TABLE \\`schemas\\` ADD \\`is_edited\\` integer;`\n\nexport const migrationSql_0004_add_publisher_to_seeds = `ALTER TABLE \\`seeds\\` ADD \\`publisher\\` text;`\n\nexport const migrationSql_0005_bright_lily_hollister = `CREATE TABLE \\`publish_processes\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`seed_local_id\\` text NOT NULL,\n\t\\`model_name\\` text NOT NULL,\n\t\\`schema_id\\` text,\n\t\\`status\\` text NOT NULL,\n\t\\`started_at\\` integer NOT NULL,\n\t\\`completed_at\\` integer,\n\t\\`error_message\\` text,\n\t\\`error_step\\` text,\n\t\\`error_details\\` text,\n\t\\`persisted_snapshot\\` text NOT NULL,\n\t\\`seed_id\\` text,\n\t\\`existing_seed_uid\\` text,\n\t\\`created_at\\` integer,\n\t\\`updated_at\\` integer\n);\n--> statement-breakpoint\nCREATE TABLE \\`upload_processes\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`reimbursement_confirmed\\` integer NOT NULL,\n\t\\`reimbursement_transaction_id\\` text,\n\t\\`transaction_keys\\` text,\n\t\\`persisted_snapshot\\` text NOT NULL,\n\t\\`created_at\\` integer,\n\t\\`updated_at\\` integer\n);\n`\n\nexport const migrationSql_0006_add_publisher_to_versions_and_metadata = `ALTER TABLE \\`versions\\` ADD \\`publisher\\` text;\n--> statement-breakpoint\nALTER TABLE \\`metadata\\` ADD \\`publisher\\` text;\n`\n\nexport const migrationSql_0007_add_required_to_properties = `ALTER TABLE \\`properties\\` ADD \\`required\\` integer DEFAULT 0;\n`\n\nexport const migrationSql_0008_add_revoked_at_to_seeds = `ALTER TABLE \\`seeds\\` ADD \\`revoked_at\\` integer;\n`\n\nexport const migrationSql_0009_happy_namor = `PRAGMA foreign_keys=OFF;--> statement-breakpoint\nCREATE TABLE \\`__new_property_uids\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`uid\\` text NOT NULL,\n\t\\`property_id\\` integer NOT NULL,\n\tFOREIGN KEY (\\`property_id\\`) REFERENCES \\`properties\\`(\\`id\\`) ON UPDATE no action ON DELETE no action\n);\n--> statement-breakpoint\nINSERT INTO \\`__new_property_uids\\`(\"id\", \"uid\", \"property_id\") SELECT \"id\", \"uid\", \"property_id\" FROM \\`property_uids\\`;--> statement-breakpoint\nDROP TABLE \\`property_uids\\`;--> statement-breakpoint\nALTER TABLE \\`__new_property_uids\\` RENAME TO \\`property_uids\\`;--> statement-breakpoint\nPRAGMA foreign_keys=ON;--> statement-breakpoint\nCREATE UNIQUE INDEX \\`property_uids_property_id_unique\\` ON \\`property_uids\\` (\\`property_id\\`);--> statement-breakpoint\nALTER TABLE \\`metadata\\` ADD \\`property_id\\` integer REFERENCES properties(id);`\n\nexport const migrationSql_0010_add_arweave_l1_finalize_jobs = `CREATE TABLE \\`arweave_l1_finalize_jobs\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`seed_local_id\\` text NOT NULL,\n\t\\`data_item_id\\` text NOT NULL,\n\t\\`l1_transaction_id\\` text,\n\t\\`bundle_id\\` text,\n\t\\`version_local_id\\` text,\n\t\\`item_property_name\\` text,\n\t\\`phase\\` text NOT NULL,\n\t\\`status_json\\` text,\n\t\\`error_message\\` text,\n\t\\`created_at\\` integer NOT NULL,\n\t\\`updated_at\\` integer NOT NULL\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`arweave_l1_finalize_jobs_data_item_id_unique\\` ON \\`arweave_l1_finalize_jobs\\` (\\`data_item_id\\`);\n`\n\nexport const migrationSql_0011_normalize_placeholder_uids = `UPDATE \\`versions\\` SET \\`uid\\` = NULL WHERE \\`uid\\` = 'NULL';\n--> statement-breakpoint\nUPDATE \\`versions\\` SET \\`seed_uid\\` = NULL WHERE \\`seed_uid\\` = 'NULL';\n--> statement-breakpoint\nUPDATE \\`metadata\\` SET \\`uid\\` = NULL WHERE \\`uid\\` = 'NULL';\n--> statement-breakpoint\nUPDATE \\`metadata\\` SET \\`version_uid\\` = NULL WHERE \\`version_uid\\` = 'NULL';\n--> statement-breakpoint\nUPDATE \\`seeds\\` SET \\`uid\\` = NULL WHERE \\`uid\\` = 'NULL';\n`\n\nexport const migrationSql_0012_html_embedded_image_co_publish = `CREATE TABLE \\`html_embedded_image_co_publish\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`parent_seed_local_id\\` text NOT NULL,\n\t\\`html_seed_local_id\\` text NOT NULL,\n\t\\`image_seed_local_id\\` text NOT NULL,\n\t\\`stable_key\\` text NOT NULL,\n\t\\`created_at\\` integer NOT NULL\n);\n--> statement-breakpoint\nCREATE 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\\`);\n`\n\nexport const migrationSql_0013_eas_sync_processes = `CREATE TABLE \\`eas_sync_processes\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`status\\` text NOT NULL,\n\t\\`started_at\\` integer NOT NULL,\n\t\\`completed_at\\` integer,\n\t\\`request_payload\\` text NOT NULL,\n\t\\`error_message\\` text,\n\t\\`error_details\\` text,\n\t\\`persisted_snapshot\\` text NOT NULL,\n\t\\`created_at\\` integer,\n\t\\`updated_at\\` integer\n);\n`\n\n// Journal JSON file\nexport const journalJson = `{\n \"version\": \"7\",\n \"dialect\": \"sqlite\",\n \"entries\": [\n {\n \"idx\": 0,\n \"version\": \"6\",\n \"when\": 1765976502903,\n \"tag\": \"0000_married_malice\",\n \"breakpoints\": true\n },\n {\n \"idx\": 1,\n \"version\": \"6\",\n \"when\": 1766010851770,\n \"tag\": \"0001_sweet_bruce_banner\",\n \"breakpoints\": true\n },\n {\n \"idx\": 2,\n \"version\": \"6\",\n \"when\": 1767621120087,\n \"tag\": \"0002_bitter_proudstar\",\n \"breakpoints\": true\n },\n {\n \"idx\": 3,\n \"version\": \"6\",\n \"when\": 1768415440282,\n \"tag\": \"0003_cultured_senator_kelly\",\n \"breakpoints\": true\n },\n {\n \"idx\": 4,\n \"version\": \"6\",\n \"when\": 1768500000000,\n \"tag\": \"0004_add_publisher_to_seeds\",\n \"breakpoints\": true\n },\n {\n \"idx\": 5,\n \"version\": \"6\",\n \"when\": 1772489937031,\n \"tag\": \"0005_bright_lily_hollister\",\n \"breakpoints\": true\n },\n {\n \"idx\": 6,\n \"version\": \"6\",\n \"when\": 1772600000000,\n \"tag\": \"0006_add_publisher_to_versions_and_metadata\",\n \"breakpoints\": true\n },\n {\n \"idx\": 7,\n \"version\": \"6\",\n \"when\": 1772700000000,\n \"tag\": \"0007_add_required_to_properties\",\n \"breakpoints\": true\n },\n {\n \"idx\": 8,\n \"version\": \"6\",\n \"when\": 1772800000000,\n \"tag\": \"0008_add_revoked_at_to_seeds\",\n \"breakpoints\": true\n },\n {\n \"idx\": 9,\n \"version\": \"6\",\n \"when\": 1773924021107,\n \"tag\": \"0009_happy_namor\",\n \"breakpoints\": true\n },\n {\n \"idx\": 10,\n \"version\": \"6\",\n \"when\": 1774000000000,\n \"tag\": \"0010_add_arweave_l1_finalize_jobs\",\n \"breakpoints\": true\n },\n {\n \"idx\": 11,\n \"version\": \"6\",\n \"when\": 1774100000000,\n \"tag\": \"0011_normalize_placeholder_uids\",\n \"breakpoints\": true\n },\n {\n \"idx\": 12,\n \"version\": \"6\",\n \"when\": 1774200000000,\n \"tag\": \"0012_html_embedded_image_co_publish\",\n \"breakpoints\": true\n },\n {\n \"idx\": 13,\n \"version\": \"6\",\n \"when\": 1774300000000,\n \"tag\": \"0013_eas_sync_processes\",\n \"breakpoints\": true\n }\n ]\n}`\n\n// Snapshot JSON file - this is large, so we'll import it dynamically if needed\n// For now, we'll read it from the actual file if ?raw works, otherwise we'll need to embed it\nexport const snapshotJson = `{\n \"version\": \"6\",\n \"dialect\": \"sqlite\",\n \"id\": \"a9e8f7d6-c5b4-4321-a0b9-c8d7e6f5a4b3\",\n \"prevId\": \"ff2318d5-236f-4157-82ae-10ccb44c0e0c\",\n \"tables\": {\n \"appState\": {\n \"name\": \"appState\",\n \"columns\": {\n \"key\": {\n \"name\": \"key\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"value\": {\n \"name\": \"value\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"appState_key_unique\": {\n \"name\": \"appState_key_unique\",\n \"columns\": [\n \"key\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"config\": {\n \"name\": \"config\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"key\": {\n \"name\": \"key\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"text\": {\n \"name\": \"text\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"json\": {\n \"name\": \"json\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"blob\": {\n \"name\": \"blob\",\n \"type\": \"blob\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {},\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"metadata\": {\n \"name\": \"metadata\",\n \"columns\": {\n \"local_id\": {\n \"name\": \"local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"uid\": {\n \"name\": \"uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"property_id\": {\n \"name\": \"property_id\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"property_name\": {\n \"name\": \"property_name\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"property_value\": {\n \"name\": \"property_value\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"schema_uid\": {\n \"name\": \"schema_uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"model_type\": {\n \"name\": \"model_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"seed_local_id\": {\n \"name\": \"seed_local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"seed_uid\": {\n \"name\": \"seed_uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"version_local_id\": {\n \"name\": \"version_local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"version_uid\": {\n \"name\": \"version_uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"eas_data_type\": {\n \"name\": \"eas_data_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"ref_value_type\": {\n \"name\": \"ref_value_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"ref_schema_uid\": {\n \"name\": \"ref_schema_uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"ref_seed_type\": {\n \"name\": \"ref_seed_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"ref_resolved_value\": {\n \"name\": \"ref_resolved_value\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"ref_resolved_display_value\": {\n \"name\": \"ref_resolved_display_value\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"local_storage_dir\": {\n \"name\": \"local_storage_dir\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"attestation_raw\": {\n \"name\": \"attestation_raw\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"attestation_created_at\": {\n \"name\": \"attestation_created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"content_hash\": {\n \"name\": \"content_hash\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"publisher\": {\n \"name\": \"publisher\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"metadata_local_id_unique\": {\n \"name\": \"metadata_local_id_unique\",\n \"columns\": [\n \"local_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {\n \"metadata_property_id_properties_id_fk\": {\n \"name\": \"metadata_property_id_properties_id_fk\",\n \"tableFrom\": \"metadata\",\n \"tableTo\": \"properties\",\n \"columnsFrom\": [\n \"property_id\"\n ],\n \"columnsTo\": [\n \"id\"\n ],\n \"onDelete\": \"no action\",\n \"onUpdate\": \"no action\"\n }\n },\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"models\": {\n \"name\": \"models\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"name\": {\n \"name\": \"name\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"schema_file_id\": {\n \"name\": \"schema_file_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"is_edited\": {\n \"name\": \"is_edited\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"unique_schema_file_id\": {\n \"name\": \"unique_schema_file_id\",\n \"columns\": [\n \"schema_file_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"properties\": {\n \"name\": \"properties\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"name\": {\n \"name\": \"name\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"data_type\": {\n \"name\": \"data_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"model_id\": {\n \"name\": \"model_id\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"ref_model_id\": {\n \"name\": \"ref_model_id\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"ref_value_type\": {\n \"name\": \"ref_value_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"schema_file_id\": {\n \"name\": \"schema_file_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"is_edited\": {\n \"name\": \"is_edited\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"required\": {\n \"name\": \"required\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"unique_name_model_id\": {\n \"name\": \"unique_name_model_id\",\n \"columns\": [\n \"name\",\n \"model_id\"\n ],\n \"isUnique\": true\n },\n \"unique_property_schema_file_id\": {\n \"name\": \"unique_property_schema_file_id\",\n \"columns\": [\n \"schema_file_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {\n \"properties_model_id_models_id_fk\": {\n \"name\": \"properties_model_id_models_id_fk\",\n \"tableFrom\": \"properties\",\n \"tableTo\": \"models\",\n \"columnsFrom\": [\n \"model_id\"\n ],\n \"columnsTo\": [\n \"id\"\n ],\n \"onDelete\": \"no action\",\n \"onUpdate\": \"no action\"\n },\n \"properties_ref_model_id_models_id_fk\": {\n \"name\": \"properties_ref_model_id_models_id_fk\",\n \"tableFrom\": \"properties\",\n \"tableTo\": \"models\",\n \"columnsFrom\": [\n \"ref_model_id\"\n ],\n \"columnsTo\": [\n \"id\"\n ],\n \"onDelete\": \"no action\",\n \"onUpdate\": \"no action\"\n }\n },\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"model_schemas\": {\n \"name\": \"model_schemas\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"model_id\": {\n \"name\": \"model_id\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"schema_id\": {\n \"name\": \"schema_id\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {},\n \"foreignKeys\": {\n \"model_schemas_model_id_models_id_fk\": {\n \"name\": \"model_schemas_model_id_models_id_fk\",\n \"tableFrom\": \"model_schemas\",\n \"tableTo\": \"models\",\n \"columnsFrom\": [\n \"model_id\"\n ],\n \"columnsTo\": [\n \"id\"\n ],\n \"onDelete\": \"no action\",\n \"onUpdate\": \"no action\"\n },\n \"model_schemas_schema_id_schemas_id_fk\": {\n \"name\": \"model_schemas_schema_id_schemas_id_fk\",\n \"tableFrom\": \"model_schemas\",\n \"tableTo\": \"schemas\",\n \"columnsFrom\": [\n \"schema_id\"\n ],\n \"columnsTo\": [\n \"id\"\n ],\n \"onDelete\": \"no action\",\n \"onUpdate\": \"no action\"\n }\n },\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"model_uids\": {\n \"name\": \"model_uids\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"uid\": {\n \"name\": \"uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"model_id\": {\n \"name\": \"model_id\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"model_uids_model_id_unique\": {\n \"name\": \"model_uids_model_id_unique\",\n \"columns\": [\n \"model_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {\n \"model_uids_model_id_models_id_fk\": {\n \"name\": \"model_uids_model_id_models_id_fk\",\n \"tableFrom\": \"model_uids\",\n \"tableTo\": \"models\",\n \"columnsFrom\": [\n \"model_id\"\n ],\n \"columnsTo\": [\n \"id\"\n ],\n \"onDelete\": \"no action\",\n \"onUpdate\": \"no action\"\n }\n },\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"property_uids\": {\n \"name\": \"property_uids\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"uid\": {\n \"name\": \"uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"property_id\": {\n \"name\": \"property_id\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"property_uids_property_id_unique\": {\n \"name\": \"property_uids_property_id_unique\",\n \"columns\": [\n \"property_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {\n \"property_uids_property_id_properties_id_fk\": {\n \"name\": \"property_uids_property_id_properties_id_fk\",\n \"tableFrom\": \"property_uids\",\n \"tableTo\": \"properties\",\n \"columnsFrom\": [\n \"property_id\"\n ],\n \"columnsTo\": [\n \"id\"\n ],\n \"onDelete\": \"no action\",\n \"onUpdate\": \"no action\"\n }\n },\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"publish_processes\": {\n \"name\": \"publish_processes\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"seed_local_id\": {\n \"name\": \"seed_local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"model_name\": {\n \"name\": \"model_name\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"schema_id\": {\n \"name\": \"schema_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"status\": {\n \"name\": \"status\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"started_at\": {\n \"name\": \"started_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"completed_at\": {\n \"name\": \"completed_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"error_message\": {\n \"name\": \"error_message\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"error_step\": {\n \"name\": \"error_step\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"error_details\": {\n \"name\": \"error_details\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"persisted_snapshot\": {\n \"name\": \"persisted_snapshot\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"seed_id\": {\n \"name\": \"seed_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"existing_seed_uid\": {\n \"name\": \"existing_seed_uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {},\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"schemas\": {\n \"name\": \"schemas\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"name\": {\n \"name\": \"name\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"version\": {\n \"name\": \"version\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"schema_file_id\": {\n \"name\": \"schema_file_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"schema_data\": {\n \"name\": \"schema_data\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"is_draft\": {\n \"name\": \"is_draft\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"is_edited\": {\n \"name\": \"is_edited\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"unique_schema_schema_file_id\": {\n \"name\": \"unique_schema_schema_file_id\",\n \"columns\": [\n \"schema_file_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"seeds\": {\n \"name\": \"seeds\",\n \"columns\": {\n \"local_id\": {\n \"name\": \"local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"uid\": {\n \"name\": \"uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"schema_uid\": {\n \"name\": \"schema_uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"type\": {\n \"name\": \"type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"publisher\": {\n \"name\": \"publisher\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"attestation_raw\": {\n \"name\": \"attestation_raw\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"attestation_created_at\": {\n \"name\": \"attestation_created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"_marked_for_deletion\": {\n \"name\": \"_marked_for_deletion\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"revoked_at\": {\n \"name\": \"revoked_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"seeds_local_id_unique\": {\n \"name\": \"seeds_local_id_unique\",\n \"columns\": [\n \"local_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"upload_processes\": {\n \"name\": \"upload_processes\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"reimbursement_confirmed\": {\n \"name\": \"reimbursement_confirmed\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"reimbursement_transaction_id\": {\n \"name\": \"reimbursement_transaction_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"transaction_keys\": {\n \"name\": \"transaction_keys\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"persisted_snapshot\": {\n \"name\": \"persisted_snapshot\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {},\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"versions\": {\n \"name\": \"versions\",\n \"columns\": {\n \"local_id\": {\n \"name\": \"local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"uid\": {\n \"name\": \"uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"seed_local_id\": {\n \"name\": \"seed_local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"seed_uid\": {\n \"name\": \"seed_uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"seed_type\": {\n \"name\": \"seed_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"note\": {\n \"name\": \"note\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"attestation_created_at\": {\n \"name\": \"attestation_created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"attestation_raw\": {\n \"name\": \"attestation_raw\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"publisher\": {\n \"name\": \"publisher\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"versions_local_id_unique\": {\n \"name\": \"versions_local_id_unique\",\n \"columns\": [\n \"local_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"arweave_l1_finalize_jobs\": {\n \"name\": \"arweave_l1_finalize_jobs\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"seed_local_id\": {\n \"name\": \"seed_local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"data_item_id\": {\n \"name\": \"data_item_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"l1_transaction_id\": {\n \"name\": \"l1_transaction_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"bundle_id\": {\n \"name\": \"bundle_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"version_local_id\": {\n \"name\": \"version_local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"item_property_name\": {\n \"name\": \"item_property_name\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"phase\": {\n \"name\": \"phase\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"status_json\": {\n \"name\": \"status_json\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"error_message\": {\n \"name\": \"error_message\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"arweave_l1_finalize_jobs_data_item_id_unique\": {\n \"name\": \"arweave_l1_finalize_jobs_data_item_id_unique\",\n \"columns\": [\n \"data_item_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"eas_sync_processes\": {\n \"name\": \"eas_sync_processes\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"status\": {\n \"name\": \"status\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"started_at\": {\n \"name\": \"started_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"completed_at\": {\n \"name\": \"completed_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"request_payload\": {\n \"name\": \"request_payload\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"error_message\": {\n \"name\": \"error_message\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"error_details\": {\n \"name\": \"error_details\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"persisted_snapshot\": {\n \"name\": \"persisted_snapshot\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {},\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n }\n },\n \"views\": {},\n \"enums\": {},\n \"_meta\": {\n \"schemas\": {},\n \"tables\": {},\n \"columns\": {}\n },\n \"internal\": {\n \"indexes\": {}\n }\n}`\n","import { BaseDb } from \"@/db/Db/BaseDb\";\nimport { IDb } from \"@/interfaces/IDb\";\nimport debug from \"debug\";\nimport { sql } from \"drizzle-orm\";\nimport { readMigrationFiles } from \"drizzle-orm/migrator\";\nimport { drizzle, SqliteRemoteDatabase } from \"drizzle-orm/sqlite-proxy\";\nimport { migrate as drizzleMigrate } from \"drizzle-orm/sqlite-proxy/migrator\";\nimport { BROWSER_FS_TOP_DIR } from \"@/client/constants\";\nimport { BaseFileManager } from \"@/helpers\";\nimport * as schema from '@/seedSchema'\n// @ts-ignore - sqlocal/drizzle types may not be available during build\nimport { SQLocalDrizzle } from 'sqlocal/drizzle'\nimport {} from 'sqlocal'\nimport * as drizzleFiles from './drizzleFiles'\nimport { journalJson, snapshotJson } from './drizzleFiles'\nimport { Observable, distinctUntilChanged } from 'rxjs'\n\nconst logger = debug('seedSdk:browser:db:Db')\n\n\nclass Db extends BaseDb implements IDb {\n\n static sqliteWasmClient: any\n static filesDir: string | undefined\n static pathToDb: string | undefined\n static dbId: string | undefined\n static appDb: SqliteRemoteDatabase<Record<string, unknown>> | undefined\n static sqlocalInstance: SQLocalDrizzle | undefined\n\n constructor() {\n super()\n }\n\n static getAppDb() {\n return this.appDb\n }\n\n static isAppDbReady() {\n return !!this.appDb\n }\n\n static async prepareDb(filesDir: string) {\n\n logger('[Db.prepareDb] preparing database')\n\n this.filesDir = filesDir\n\n try {\n // Copy drizzle migration files from src/db/drizzle to filesDir/db\n await this.copyDrizzleFiles(filesDir)\n\n // Ensure meta directory exists\n const metaDirPath = `${filesDir}/db/meta`\n await BaseFileManager.createDirIfNotExists(metaDirPath)\n\n // Ensure _journal.json file exists in meta directory\n const journalFilePath = `${metaDirPath}/_journal.json`\n const journalExists = await BaseFileManager.pathExists(journalFilePath)\n if (!journalExists) {\n await BaseFileManager.saveFile(journalFilePath, JSON.stringify({\n version: 1,\n dialect: 'sqlite',\n entries: [],\n }, null, 2))\n }\n\n // Wait for journal file to be fully written before proceeding with migration\n // This is critical in browser/OPFS where writes may not be immediately readable\n logger('[Db.prepareDb] waiting for journal file to be fully written...')\n await BaseFileManager.waitForFileWithContent(journalFilePath, 100, 5000)\n logger('[Db.prepareDb] journal file is ready')\n\n // Initialize SQLocalDrizzle with reactive: true to enable reactive queries\n const sqlocalDrizzle = new SQLocalDrizzle({\n databasePath: `${this.filesDir}/db/seed.db`,\n reactive: true // Enable reactive queries\n })\n \n const { driver, batchDriver } = sqlocalDrizzle\n \n // Store SQLocalDrizzle instance for reactive queries\n this.sqlocalInstance = sqlocalDrizzle\n\n // Create db instance but do NOT set this.appDb yet. restoreFromDb (and other\n // callers of getAppDb()) must not see the db until migrations have completed,\n // otherwise they may query tables (e.g. publish_processes) that don't exist yet.\n const db = drizzle(\n driver,\n batchDriver,\n {\n schema,\n }\n )\n\n logger('[Db.prepareDb] database prepared')\n\n await this.runMigrations(db)\n\n this.appDb = db\n\n const { backfillMetadataPropertyIds } = await import('@/db/backfillMetadataPropertyIds')\n await backfillMetadataPropertyIds()\n\n return this.appDb\n } catch (error) {\n logger('[Db.prepareDb] error', JSON.stringify(error))\n throw error\n }\n }\n\n // static async prepareDb(filesDir: string) {\n // console.log('prepareDb', filesDir)\n // if (Db.sqliteWasmClient) {\n // return this.dbId\n // }\n\n // this.filesDir = filesDir\n // this.pathToDb = `${filesDir}/db/${DB_NAME_APP}.db`\n\n // if (typeof document === 'undefined') {\n // return\n // }\n\n // let promiser\n\n // try {\n\n // let sqlite3Worker1Promiser\n\n // const sqliteWasm = await import('@sqlite.org/sqlite-wasm')\n\n // if (sqliteWasm && sqliteWasm.sqlite3Worker1Promiser) {\n // sqlite3Worker1Promiser = sqliteWasm.sqlite3Worker1Promiser\n // }\n\n // if (!sqlite3Worker1Promiser && window.sqlite3Worker1Promiser) {\n // sqlite3Worker1Promiser = window.sqlite3Worker1Promiser\n // }\n\n // if (!sqlite3Worker1Promiser) {\n // throw new Error('Failed to load sqlite3Worker1Promiser')\n // }\n\n // promiser = await new Promise<(event: string, config: Record<string, unknown>) => Promise<any>>((resolve) => {\n // const _promiser = sqlite3Worker1Promiser({\n // onready: () => {\n // resolve(_promiser);\n // },\n // });\n // }).catch((error) => {\n // console.error('Error from sqlite proxy server: ', JSON.stringify(error))\n // });\n\n // } catch ( e ) {\n // console.error('Error from sqlite proxy server: ', JSON.stringify(e))\n // }\n\n\n // if (!promiser) {\n // throw new Error('Failed to create promiser')\n // }\n\n // this.sqliteWasmClient = promiser\n\n // const responseGet = await this.sqliteWasmClient('config-get', {});\n\n // logger('[Db.prepareDb] Running SQLite3 version', responseGet.result.version.libVersion);\n\n // const responseOpen = await this.sqliteWasmClient('open', {\n // filename: `file:${filesDir}/db/${DB_NAME_APP}.db?vfs=opfs`,\n // });\n // const { dbId } = responseOpen;\n // logger(\n // '[Db.prepareDb] OPFS is available, created persisted database at',\n // responseOpen.result.filename.replace(/^file:(.*?)\\?vfs=opfs/, '$1'),\n // );\n\n // logger('[Db.prepareDb] dbId', dbId)\n \n // this.dbId = dbId\n \n // await this.migrate()\n // }\n\n static async connectToDb(filesDir: string,): Promise<string | undefined> {\n\n\n\n return this.dbId\n }\n\n static async copyDrizzleFiles(filesDir: string): Promise<void> {\n logger('[Db.copyDrizzleFiles] copying drizzle migration files')\n\n try {\n // Ensure db directory exists\n const dbDirPath = `${filesDir}/db`\n await BaseFileManager.createDirIfNotExists(dbDirPath)\n\n // Ensure meta directory exists\n const metaDirPath = `${dbDirPath}/meta`\n await BaseFileManager.createDirIfNotExists(metaDirPath)\n\n // Parse journal JSON to get all migration entries\n const journal = JSON.parse(journalJson)\n const entries = journal.entries || []\n\n if (entries.length === 0) {\n logger('[Db.copyDrizzleFiles] no migration entries found in journal')\n return\n }\n\n // Copy each migration SQL file (always overwrite to ensure they're up-to-date)\n // Each migration is exported as a separate variable (e.g., migrationSql_0000_married_malice)\n for (let i = 0; i < entries.length; i++) {\n const entry = entries[i]\n const tag = entry.tag // e.g., \"0000_married_malice\"\n const migrationFileName = `${tag}.sql`\n const migrationPath = `${dbDirPath}/${migrationFileName}`\n \n // Get the SQL for this migration from the exported variable\n const migrationVarName = `migrationSql_${tag}` as keyof typeof drizzleFiles\n const migrationContent = drizzleFiles[migrationVarName] as string | undefined\n \n if (!migrationContent) {\n logger(`[Db.copyDrizzleFiles] ERROR: No migration content found for ${migrationFileName} (variable: ${migrationVarName})`)\n throw new Error(`No migration content found for ${migrationFileName}. Expected variable: ${migrationVarName}`)\n }\n \n await BaseFileManager.saveFile(migrationPath, migrationContent.trim())\n logger(`[Db.copyDrizzleFiles] copied/updated migration SQL file: ${migrationFileName}`)\n }\n\n // Copy journal JSON file (always overwrite to ensure it's up-to-date with all migrations)\n const journalPath = `${metaDirPath}/_journal.json`\n await BaseFileManager.saveFile(journalPath, journalJson)\n logger('[Db.copyDrizzleFiles] copied/updated journal JSON file')\n\n // Copy snapshot JSON file (use the latest snapshot based on the highest idx in journal)\n // Snapshot files are named like: 0000_snapshot.json, 0001_snapshot.json, etc.\n // The tag format is like \"0000_married_malice\", so we extract the numeric prefix\n const latestEntry = entries[entries.length - 1]\n const tagPrefixMatch = latestEntry.tag.match(/^(\\d+_)/)\n const tagPrefix = tagPrefixMatch ? tagPrefixMatch[1] : '0000_'\n const snapshotFileName = `${tagPrefix}snapshot.json`\n const snapshotPath = `${metaDirPath}/${snapshotFileName}`\n // Always overwrite snapshot to ensure it's up-to-date\n await BaseFileManager.saveFile(snapshotPath, snapshotJson)\n logger(`[Db.copyDrizzleFiles] copied/updated snapshot JSON file: ${snapshotFileName}`)\n\n logger('[Db.copyDrizzleFiles] drizzle files copied successfully')\n } catch (error) {\n logger('[Db.copyDrizzleFiles] error copying drizzle files', error)\n // Don't throw - the files might already exist or migration might work without them\n // The migration will fail later if the files are truly needed\n }\n }\n\n /** Internal migration runner. Used by prepareDb before appDb is set. */\n private static async runMigrations(\n db: SqliteRemoteDatabase<Record<string, unknown>>,\n pathToDbDir?: string\n ): Promise<void> {\n const migrationsFolder = pathToDbDir ?? `${this.filesDir}/db`\n\n try {\n logger('[Db.runMigrations] calling readMigrationFiles')\n const migrations = readMigrationFiles({\n migrationsFolder,\n })\n logger('[Db.runMigrations] migrations', migrations)\n\n await drizzleMigrate(\n db,\n async (queriesToRun) => {\n logger('queriesToRun', queriesToRun)\n for (const query of queriesToRun) {\n logger('query', query)\n await db.run(sql.raw(query))\n }\n },\n {\n migrationsFolder,\n },\n )\n logger('[Db.runMigrations] migrations completed')\n } catch (error) {\n logger('[Db.runMigrations] error', JSON.stringify(error))\n throw error\n }\n }\n\n static async migrate(pathToDbDir: string, _dbName: string, _dbId: string): Promise<void> {\n const targetDb = this.appDb\n if (!targetDb) {\n throw new Error('Database not prepared')\n }\n await this.runMigrations(targetDb, pathToDbDir)\n }\n\n // static async migrate(): Promise<void> {\n\n // const schemaGlobString = `${BROWSER_FS_TOP_DIR}/schema/*`\n // const pathToDbDir = `${this.filesDir}/db`\n // const dbName = DB_NAME_APP\n\n // logger('[Db.migrate] running migrations')\n\n // const drizzleDb = drizzle(\n // async (sql, params,) => {\n // try {\n // logger(\n // `executing sql`,\n // sql,\n // )\n\n // const finalResult = await this.exec(sql, params)\n\n // // logger(`finalResult with method: ${method}`, finalResult)\n // // Drizzle always waits for {rows: string[][]} or {rows: string[]} for the return value.\n\n // // When the method is get, you should return a value as {rows: string[]}.\n // // Otherwise, you should return {rows: string[][]}.\n\n // return { rows: finalResult }\n // } catch (e: any) {\n // console.error('Error from sqlite proxy server: ', JSON.stringify(e))\n // return { rows: [] }\n // }\n // },\n // {\n // schema,\n // // logger: true,\n // },\n // )\n\n // try {\n // const zenfs = await BaseFileManager.getFs()\n\n // logger('[Db.migrate] calling readMigrationFiles')\n\n // const migrations = readMigrationFiles({\n // migrationsFolder: pathToDbDir,\n // })\n\n // logger('[Db.migrate] migrations', migrations)\n\n // if (migrations.length > 0) {\n // const incomingMigrationHashes = migrations.map(\n // (migration) => migration.hash,\n // )\n\n // let existingMigrationHashes\n // let rows = []\n\n // try {\n\n // const queryMigrationsTable = await drizzleDb.run(\n // sql.raw(\n // `SELECT name \n // FROM sqlite_master \n // WHERE type='table' \n // AND name='__drizzle_migrations';`,\n // ),\n // )\n\n // logger('queryMigrationsTable', queryMigrationsTable)\n\n // if (queryMigrationsTable && queryMigrationsTable.rows && queryMigrationsTable.rows.length > 0) {\n // const query = await drizzleDb.run(\n // sql.raw(\n // `SELECT hash, created_at\n // FROM main.__drizzle_migrations;`,\n // ),\n // )\n \n // rows = query.rows\n // }\n\n // } catch (e) {\n // rows = []\n // }\n\n // if (rows && rows.length > 0) {\n // existingMigrationHashes = rows.map((row) => row[0])\n // }\n\n // if (existingMigrationHashes) {\n // let shouldRebuildDb = false\n // for (const existingHash of existingMigrationHashes) {\n // if (!incomingMigrationHashes.includes(existingHash)) {\n // shouldRebuildDb = true\n // break\n // }\n // }\n // if (shouldRebuildDb) {\n // await zenfs.promises.unlink(`${pathToDbDir}/${dbName}.db`)\n // }\n // }\n // }\n\n // logger('[Db.migrate] running migrations')\n\n // await drizzleMigrate(\n // drizzleDb,\n // async (queriesToRun) => {\n // // logger('queriesToRun', queriesToRun)\n // for (const query of queriesToRun) {\n // // logger('query', query)\n // await drizzleDb.run(sql.raw(query))\n // }\n // },\n // {\n // migrationsFolder: pathToDbDir,\n // },\n // )\n // } catch (error) {\n // logger('[Db.migrate] error', JSON.stringify(error))\n // // await BaseFileManager.waitForFile(`${pathToDbDir}/meta/_journal.json`)\n\n // // const journalExists = await BaseFileManager.pathExists(\n // // `${pathToDbDir}/meta/_journal.json`,\n // // )\n\n // // if (journalExists) {\n // // await this.migrate(pathToDbDir, dbName,)\n // // }\n\n // // if (!journalExists) {\n // // throw new Error('Failed to migrate database')\n // // }\n\n\n // }\n\n // this.appDb = drizzleDb\n\n // // Old code for migrating the database\n // // const createTempTableQuery = await appDb.run(\n // // sql.raw(\n // // `CREATE TEMP TABLE IF NOT EXISTS temp_last_inserted_id (id INTEGER, table TEXT);`,\n // // ),\n // // )\n // //\n // // logger(\n // // '[db/actors] [migrate] createTempTableQuery',\n // // createTempTableQuery,\n // // )\n\n // // const triggersQuery = await appDb.run(\n // // sql.raw(\n // // `SELECT name\n // // FROM main.sqlite_master\n // // WHERE type = 'trigger';`,\n // // ),\n // // )\n // //\n // // logger('[db/actors] [migrate] triggersQuery', triggersQuery)\n // //\n // // const triggers = triggersQuery.rows.map((row) => row[0])\n // //\n // // const tablesQuery = await appDb.run(\n // // sql.raw(\n // // `SELECT name\n // // FROM main.sqlite_master\n // // WHERE type = 'table';`,\n // // ),\n // // )\n // //\n // // logger('[db/actors] [migrate] tablesQuery', tablesQuery)\n // //\n // // const tableNames = tablesQuery.rows.map((row) => row[0])\n // // logger('[db/actors] [migrate] tableNames', tableNames)\n // // for (const tableName of tableNames) {\n // // const triggerName = `after_insert_${tableName}`\n // // if (triggers.includes(triggerName)) {\n // // continue\n // // }\n // // const createTriggerQuery = await appDb.run(\n // // sql.raw(\n // // `CREATE TRIGGER after_insert_${tableName}\n // // AFTER INSERT ON ${tableName}\n // // BEGIN\n // // DELETE FROM temp_last_inserted_id;\n // // INSERT INTO temp_last_inserted_id (id) VALUES (new.id);\n // // END;`,\n // // ),\n // // )\n // //\n // // logger(\n // // '[db/actors] [migrate] createTriggerQuery',\n // // createTriggerQuery,\n // // )\n // // }\n // }\n\n // static async exec(sql: string, params: any[]) {\n // const rowsToReturnRaw: SqliteWasmResult[] = []\n // const rowsValues: string[][] = []\n \n // // For a single exec command, the callback potentially gets called several times -- once for each row.\n // // So we need to collect all rows into a final array to return (execResult).\n // const rowsToReturn = await new Promise((resolve, reject) => {\n\n\n // this.sqliteWasmClient('exec', {\n // dbId:this.dbId,\n // sql,\n // bind: params,\n // callback: (result) => {\n // // Checks if this is the final callback of the query\n // if (!result || !result.row || !result.rowNumber) {\n // const returnResult = []\n // for (const currRow of rowsToReturnRaw) {\n // returnResult.push(currRow.row)\n // }\n // resolve(returnResult)\n // } else {\n // // If not the final response, add this row to the return array\n // rowsToReturnRaw.push(result)\n // }\n // },\n // }).catch(async (error) => {\n // reject(error)\n // })\n // })\n \n // return rowsToReturn || []\n // }\n\n /**\n * Execute a reactive query that emits new results whenever the underlying data changes.\n * \n * Supports two usage patterns:\n * 1. SQL tag function: liveQuery((sql) => sql`SELECT * FROM models`)\n * 2. Drizzle query builder: liveQuery(db.select().from(models))\n * \n * @param query - SQL query function or Drizzle query builder\n * @returns Observable that emits arrays of query results\n * \n * @example\n * ```typescript\n * // Using SQL tag function\n * const models$ = Db.liveQuery<ModelRow>(\n * (sql) => sql`SELECT * FROM models WHERE schema_file_id = ${schemaId}`\n * )\n * \n * // Using Drizzle query builder\n * const models$ = Db.liveQuery<ModelRow>(\n * appDb.select().from(models).where(eq(models.schemaFileId, schemaId))\n * )\n * \n * models$.subscribe(models => {\n * console.log('Models updated:', models)\n * })\n * ```\n */\n static liveQuery<T>(\n query: ((sql: any) => any) | any\n ): Observable<T[]> {\n if (!this.sqlocalInstance) {\n throw new Error('Database not initialized. Call prepareDb first.')\n }\n \n if (!this.sqlocalInstance.reactiveQuery) {\n throw new Error('Reactive queries not enabled. Initialize SQLocalDrizzle with reactive: true.')\n }\n\n const baseObservable = new Observable<T[]>((subscriber) => {\n const reactiveQueryResult = this.sqlocalInstance!.reactiveQuery(query)\n\n const subscription = reactiveQueryResult.subscribe(\n (data: Record<string, any>[]) => {\n subscriber.next(data as T[])\n },\n (err: Error) => {\n console.error('[BaseDb.liveQuery] SQLocal reactiveQuery error:', err)\n subscriber.error(err)\n }\n )\n\n return () => {\n subscription.unsubscribe()\n }\n })\n\n // Compare stable JSON snapshots via keySelector. SQLocal may reuse one array reference\n // and mutate rows in place; comparing (prev, curr) on the same reference makes\n // JSON.stringify(prev) === JSON.stringify(curr) after mutation and suppresses emissions.\n return baseObservable.pipe(\n distinctUntilChanged(\n (a, b) => a === b,\n (x: T[]) => JSON.stringify(x)\n )\n )\n }\n}\n\nexport { Db }\n"],"names":["drizzleMigrate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAEA;AACO,M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AAC,IAA2B,KAAI;AAC9B,gBAAA,UAAU,CAAC,IAAI,CAAC,IAAW,CAAC;AAC9B,YAAA,CAAC,EACD,CAAC,GAAU,KAAI;AACb,gBAAA,OAAO,CAAC,KAAK,CAAC,iDAAiD,EAAE,GAAG,CAAC;AACrE,gBAAA,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC;AACvB,YAAA,CAAC,CACF;AAED,YAAA,OAAO,MAAK;gBACV,YAAY,CAAC,WAAW,EAAE;AAC5B,YAAA,CAAC;AACH,QAAA,CAAC,CAAC;;;;AAKF,QAAA,OAAO,cAAc,CAAC,IAAI,CACxB,oBAAoB,CAClB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EACjB,CAAC,CAAM,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAC9B,CACF;IACH;AACD;;;;"}
@@ -1,7 +1,7 @@
1
- import { p as BaseDb, a1 as appState } from './index-BrD_NNaX.js';
1
+ import { p as BaseDb, a1 as appState } from './index-DUMXLKJr.js';
2
2
  import path from 'path';
3
3
  import debug from 'debug';
4
- import { s as schema } from './index-DdzhrbkF.js';
4
+ import { s as schema } from './index-BRo7D3s1.js';
5
5
  import fs__default from 'fs';
6
6
  import { createClient } from '@libsql/client';
7
7
  import { drizzle } from 'drizzle-orm/libsql';
@@ -74,7 +74,7 @@ class Db extends BaseDb {
74
74
  // You can inspect what will happen before applying
75
75
  await apply();
76
76
  this.db = db;
77
- const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-CRyRez3h.js');
77
+ const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-CBlRaU_M.js');
78
78
  await backfillMetadataPropertyIds();
79
79
  return this.db;
80
80
  }
@@ -246,4 +246,4 @@ class Db extends BaseDb {
246
246
  BaseDb.setPlatformClass(Db);
247
247
 
248
248
  export { Db };
249
- //# sourceMappingURL=Db-DkTBncAM.js.map
249
+ //# sourceMappingURL=Db-nir1xVHg.js.map