@seedprotocol/sdk 0.4.18 → 0.4.20

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 (123) hide show
  1. package/dist/{ArweaveClient-WfxkMgxb.js → ArweaveClient-C1bakApw.js} +3 -3
  2. package/dist/{ArweaveClient-WfxkMgxb.js.map → ArweaveClient-C1bakApw.js.map} +1 -1
  3. package/dist/{ArweaveClient-CpShI0B0.js → ArweaveClient-Ck4wflb3.js} +3 -3
  4. package/dist/{ArweaveClient-CpShI0B0.js.map → ArweaveClient-Ck4wflb3.js.map} +1 -1
  5. package/dist/{Db-DWvxJG22.js → Db-CCMLWMi-.js} +133 -6
  6. package/dist/Db-CCMLWMi-.js.map +1 -0
  7. package/dist/{Db-29bu0gJx.js → Db-YFg99EDt.js} +4 -4
  8. package/dist/{Db-29bu0gJx.js.map → Db-YFg99EDt.js.map} +1 -1
  9. package/dist/{EasClient-BwBg9Kkd.js → EasClient-BmYeAnq7.js} +2 -2
  10. package/dist/{EasClient-BwBg9Kkd.js.map → EasClient-BmYeAnq7.js.map} +1 -1
  11. package/dist/{EasClient-CtLqK_qz.js → EasClient-Bqzb-xF2.js} +2 -2
  12. package/dist/{EasClient-CtLqK_qz.js.map → EasClient-Bqzb-xF2.js.map} +1 -1
  13. package/dist/{FileManager-DgraLHZS.js → FileManager-Ba1qAT8_.js} +2 -2
  14. package/dist/{FileManager-DgraLHZS.js.map → FileManager-Ba1qAT8_.js.map} +1 -1
  15. package/dist/{FileManager-DSihj6Sj.js → FileManager-rVAH7uNp.js} +2 -2
  16. package/dist/{FileManager-DSihj6Sj.js.map → FileManager-rVAH7uNp.js.map} +1 -1
  17. package/dist/{ModelProperty-Bz3V3LoI.js → ModelProperty-Csj84uQv.js} +24 -24
  18. package/dist/{ModelProperty-Bz3V3LoI.js.map → ModelProperty-Csj84uQv.js.map} +1 -1
  19. package/dist/{PathResolver-DQ5hyu8X.js → PathResolver-B5XBxiLt.js} +2 -2
  20. package/dist/{PathResolver-DQ5hyu8X.js.map → PathResolver-B5XBxiLt.js.map} +1 -1
  21. package/dist/{PathResolver-DOu-0k75.js → PathResolver-CzhXp_OH.js} +2 -2
  22. package/dist/{PathResolver-DOu-0k75.js.map → PathResolver-CzhXp_OH.js.map} +1 -1
  23. package/dist/{QueryClient-DYaqIx7e.js → QueryClient-5NAcOOvw.js} +2 -2
  24. package/dist/{QueryClient-DYaqIx7e.js.map → QueryClient-5NAcOOvw.js.map} +1 -1
  25. package/dist/{QueryClient-CJV1m2rc.js → QueryClient-BqpbpJEP.js} +2 -2
  26. package/dist/{QueryClient-CJV1m2rc.js.map → QueryClient-BqpbpJEP.js.map} +1 -1
  27. package/dist/{Schema-CFMbnImW.js → Schema-QjwZN91G.js} +38 -38
  28. package/dist/{Schema-CFMbnImW.js.map → Schema-QjwZN91G.js.map} +1 -1
  29. package/dist/{SchemaValidationService-D4ZVetLE.js → SchemaValidationService-Cwkeb4fG.js} +2 -2
  30. package/dist/{SchemaValidationService-D4ZVetLE.js.map → SchemaValidationService-Cwkeb4fG.js.map} +1 -1
  31. package/dist/{backfillMetadataPropertyIds-DptGKVzG.js → backfillMetadataPropertyIds-DCYUHZDQ.js} +2 -2
  32. package/dist/{backfillMetadataPropertyIds-DptGKVzG.js.map → backfillMetadataPropertyIds-DCYUHZDQ.js.map} +1 -1
  33. package/dist/cjs/{ModelProperty-TPey_B4m.js → ModelProperty-m4dACdoX.js} +17 -17
  34. package/dist/cjs/{ModelProperty-TPey_B4m.js.map → ModelProperty-m4dACdoX.js.map} +1 -1
  35. package/dist/cjs/{Schema-B-IQEtpX.js → Schema-DlSTkGtE.js} +20 -20
  36. package/dist/cjs/{Schema-B-IQEtpX.js.map → Schema-DlSTkGtE.js.map} +1 -1
  37. package/dist/cjs/{SchemaValidationService-IQ0Gc9HM.js → SchemaValidationService-C06zlv2z.js} +2 -2
  38. package/dist/cjs/{SchemaValidationService-IQ0Gc9HM.js.map → SchemaValidationService-C06zlv2z.js.map} +1 -1
  39. package/dist/cjs/{backfillMetadataPropertyIds-BBPgBc2W.js → backfillMetadataPropertyIds-gyFrK_ny.js} +2 -2
  40. package/dist/cjs/{backfillMetadataPropertyIds-BBPgBc2W.js.map → backfillMetadataPropertyIds-gyFrK_ny.js.map} +1 -1
  41. package/dist/cjs/{getItem-CWf0OO0F.js → getItem-gFz18nL2.js} +2 -2
  42. package/dist/cjs/{getItem-CWf0OO0F.js.map → getItem-gFz18nL2.js.map} +1 -1
  43. package/dist/cjs/{getPublishPayload-muuS1j0F.js → getPublishPayload-DHNfV-GE.js} +18 -10
  44. package/dist/cjs/getPublishPayload-DHNfV-GE.js.map +1 -0
  45. package/dist/cjs/{getPublishUploads-CONYV9QQ.js → getPublishUploads-Dt-3g6eW.js} +18 -13
  46. package/dist/cjs/getPublishUploads-Dt-3g6eW.js.map +1 -0
  47. package/dist/cjs/{getSegmentedItemProperties-Dl3J_uCe.js → getSegmentedItemProperties-D3XpxCt8.js} +3 -3
  48. package/dist/cjs/{getSegmentedItemProperties-Dl3J_uCe.js.map → getSegmentedItemProperties-D3XpxCt8.js.map} +1 -1
  49. package/dist/cjs/{index-D7a8oFJP.js → index-4M2KX6s4.js} +3 -3
  50. package/dist/cjs/index-4M2KX6s4.js.map +1 -0
  51. package/dist/cjs/{index-Bte-I6OD.js → index-CHrEZZ71.js} +163 -40
  52. package/dist/cjs/index-CHrEZZ71.js.map +1 -0
  53. package/dist/cjs/{ownership-Bxv6CUrH.js → ownership-CC_YF-XC.js} +2 -2
  54. package/dist/cjs/{ownership-Bxv6CUrH.js.map → ownership-CC_YF-XC.js.map} +1 -1
  55. package/dist/cjs/{property-xOF5k4ka.js → property-DtCxuPrc.js} +4 -4
  56. package/dist/cjs/{property-xOF5k4ka.js.map → property-DtCxuPrc.js.map} +1 -1
  57. package/dist/db/drizzle/drizzle/0010_add_arweave_l1_finalize_jobs.sql +16 -0
  58. package/dist/db/drizzle/drizzle/meta/0010_snapshot.json +1182 -0
  59. package/dist/db/drizzle/drizzle/meta/_journal.json +7 -0
  60. package/dist/{getItem-Hubs_yxu.js → getItem-CpjN3MFQ.js} +2 -2
  61. package/dist/{getItem-Hubs_yxu.js.map → getItem-CpjN3MFQ.js.map} +1 -1
  62. package/dist/{getPublishPayload-CqUCIlu1.js → getPublishPayload-CMhy9jfz.js} +21 -13
  63. package/dist/getPublishPayload-CMhy9jfz.js.map +1 -0
  64. package/dist/{getPublishUploads-QgfPyhcs.js → getPublishUploads-DTE4SEWk.js} +18 -13
  65. package/dist/getPublishUploads-DTE4SEWk.js.map +1 -0
  66. package/dist/{getSegmentedItemProperties-Dzscmm_m.js → getSegmentedItemProperties-DzPjQtcg.js} +3 -3
  67. package/dist/{getSegmentedItemProperties-Dzscmm_m.js.map → getSegmentedItemProperties-DzPjQtcg.js.map} +1 -1
  68. package/dist/{index-CtzvJMAE.js → index-C1HlP_fU.js} +190 -55
  69. package/dist/index-C1HlP_fU.js.map +1 -0
  70. package/dist/{index-VmIdPfTW.js → index-DvUyNZc9.js} +3 -3
  71. package/dist/index-DvUyNZc9.js.map +1 -0
  72. package/dist/{index-QSl4EYun.js → index-dDmXPEJC.js} +3 -2
  73. package/dist/index-dDmXPEJC.js.map +1 -0
  74. package/dist/main.cjs +1 -1
  75. package/dist/main.js +55 -14
  76. package/dist/main.js.map +1 -1
  77. package/dist/node.js +10 -10
  78. package/dist/{ownership-loPNh3_a.js → ownership-C7GyMbsf.js} +2 -2
  79. package/dist/{ownership-loPNh3_a.js.map → ownership-C7GyMbsf.js.map} +1 -1
  80. package/dist/{property-D8HimAKw.js → property-BNt7Dkmw.js} +6 -6
  81. package/dist/{property-D8HimAKw.js.map → property-BNt7Dkmw.js.map} +1 -1
  82. package/dist/{queries-DPADHnwy.js → queries-D09IIJg_.js} +2 -2
  83. package/dist/{queries-DPADHnwy.js.map → queries-D09IIJg_.js.map} +1 -1
  84. package/dist/seedSchema/ArweaveL1FinalizeSchema.ts +28 -0
  85. package/dist/seedSchema/index.d.ts +3 -0
  86. package/dist/seedSchema/index.ts +1 -0
  87. package/dist/src/Item/Item.d.ts +1 -1
  88. package/dist/src/Item/Item.d.ts.map +1 -1
  89. package/dist/src/browser/db/drizzleFiles.d.ts +3 -2
  90. package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
  91. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  92. package/dist/src/db/read/getPublishUploads.d.ts +7 -3
  93. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  94. package/dist/src/db/write/applyArweaveL1TransactionIdLocal.d.ts +12 -0
  95. package/dist/src/db/write/applyArweaveL1TransactionIdLocal.d.ts.map +1 -0
  96. package/dist/src/eas.d.ts +6 -0
  97. package/dist/src/eas.d.ts.map +1 -1
  98. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  99. package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts +46 -0
  100. package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts.map +1 -0
  101. package/dist/src/helpers/constants.d.ts +2 -0
  102. package/dist/src/helpers/constants.d.ts.map +1 -1
  103. package/dist/src/helpers/index.d.ts +1 -0
  104. package/dist/src/helpers/index.d.ts.map +1 -1
  105. package/dist/src/index.d.ts +7 -5
  106. package/dist/src/index.d.ts.map +1 -1
  107. package/dist/src/interfaces/IItem.d.ts +1 -1
  108. package/dist/src/interfaces/IItem.d.ts.map +1 -1
  109. package/dist/src/seedSchema/ArweaveL1FinalizeSchema.d.ts +233 -0
  110. package/dist/src/seedSchema/ArweaveL1FinalizeSchema.d.ts.map +1 -0
  111. package/dist/src/seedSchema/index.d.ts +1 -0
  112. package/dist/src/seedSchema/index.d.ts.map +1 -1
  113. package/package.json +1 -1
  114. package/dist/Db-DWvxJG22.js.map +0 -1
  115. package/dist/cjs/getPublishPayload-muuS1j0F.js.map +0 -1
  116. package/dist/cjs/getPublishUploads-CONYV9QQ.js.map +0 -1
  117. package/dist/cjs/index-Bte-I6OD.js.map +0 -1
  118. package/dist/cjs/index-D7a8oFJP.js.map +0 -1
  119. package/dist/getPublishPayload-CqUCIlu1.js.map +0 -1
  120. package/dist/getPublishUploads-QgfPyhcs.js.map +0 -1
  121. package/dist/index-CtzvJMAE.js.map +0 -1
  122. package/dist/index-QSl4EYun.js.map +0 -1
  123. package/dist/index-VmIdPfTW.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { w as BaseArweaveClient } from './index-CtzvJMAE.js';
1
+ import { w as BaseArweaveClient } from './index-C1HlP_fU.js';
2
2
  import { GraphQLClient } from 'graphql-request';
3
3
  import Arweave from 'arweave';
4
- import { G as GET_TRANSACTION_TAGS } from './queries-DPADHnwy.js';
4
+ import { G as GET_TRANSACTION_TAGS } from './queries-D09IIJg_.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-WfxkMgxb.js.map
205
+ //# sourceMappingURL=ArweaveClient-C1bakApw.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArweaveClient-WfxkMgxb.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,MAA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AO,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-C1bakApw.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,E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AC,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,7 +1,7 @@
1
- import { w as BaseArweaveClient } from './index-CtzvJMAE.js';
1
+ import { w as BaseArweaveClient } from './index-C1HlP_fU.js';
2
2
  import { GraphQLClient } from 'graphql-request';
3
3
  import Arweave from 'arweave';
4
- import { G as GET_TRANSACTION_TAGS } from './queries-DPADHnwy.js';
4
+ import { G as GET_TRANSACTION_TAGS } from './queries-D09IIJg_.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-CpShI0B0.js.map
205
+ //# sourceMappingURL=ArweaveClient-Ck4wflb3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArweaveClient-CpShI0B0.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,IA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AK,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-Ck4wflb3.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;AACT,SAAA,CAAC;IACJ;AAEA,IAAA,OAAO,gBAAiB;AAC1B,CAAC;AAED,MAAM,aAAc,SAAQ,iBAAiB,CAAA;AAC3C;;AAEG;AACH,IAAA,O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c,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,10 +1,10 @@
1
- import { o as BaseDb, u as BaseFileManager } from './index-CtzvJMAE.js';
1
+ import { o as BaseDb, u as BaseFileManager } from './index-C1HlP_fU.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-QSl4EYun.js';
7
+ import { s as schema } from './index-dDmXPEJC.js';
8
8
  import { SQLocalDrizzle } from 'sqlocal/drizzle';
9
9
  import { Observable, distinctUntilChanged } from 'rxjs';
10
10
  import 'xstate';
@@ -203,6 +203,23 @@ ALTER TABLE \`__new_property_uids\` RENAME TO \`property_uids\`;--> statement-br
203
203
  PRAGMA foreign_keys=ON;--> statement-breakpoint
204
204
  CREATE UNIQUE INDEX \`property_uids_property_id_unique\` ON \`property_uids\` (\`property_id\`);--> statement-breakpoint
205
205
  ALTER TABLE \`metadata\` ADD \`property_id\` integer REFERENCES properties(id);`;
206
+ const migrationSql_0010_add_arweave_l1_finalize_jobs = `CREATE TABLE \`arweave_l1_finalize_jobs\` (
207
+ \`id\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
208
+ \`seed_local_id\` text NOT NULL,
209
+ \`data_item_id\` text NOT NULL,
210
+ \`l1_transaction_id\` text,
211
+ \`bundle_id\` text,
212
+ \`version_local_id\` text,
213
+ \`item_property_name\` text,
214
+ \`phase\` text NOT NULL,
215
+ \`status_json\` text,
216
+ \`error_message\` text,
217
+ \`created_at\` integer NOT NULL,
218
+ \`updated_at\` integer NOT NULL
219
+ );
220
+ --> statement-breakpoint
221
+ CREATE UNIQUE INDEX \`arweave_l1_finalize_jobs_data_item_id_unique\` ON \`arweave_l1_finalize_jobs\` (\`data_item_id\`);
222
+ `;
206
223
  // Journal JSON file
207
224
  const journalJson = `{
208
225
  "version": "7",
@@ -277,6 +294,13 @@ const journalJson = `{
277
294
  "when": 1773924021107,
278
295
  "tag": "0009_happy_namor",
279
296
  "breakpoints": true
297
+ },
298
+ {
299
+ "idx": 10,
300
+ "version": "6",
301
+ "when": 1774000000000,
302
+ "tag": "0010_add_arweave_l1_finalize_jobs",
303
+ "breakpoints": true
280
304
  }
281
305
  ]
282
306
  }`;
@@ -285,8 +309,8 @@ const journalJson = `{
285
309
  const snapshotJson = `{
286
310
  "version": "6",
287
311
  "dialect": "sqlite",
288
- "id": "ff040f54-6cfc-4d32-a572-2f08870c5b85",
289
- "prevId": "c8d9e0f1-a2b3-4c8d-9e0f-123456789012",
312
+ "id": "ff2318d5-236f-4157-82ae-10ccb44c0e0c",
313
+ "prevId": "ff040f54-6cfc-4d32-a572-2f08870c5b85",
290
314
  "tables": {
291
315
  "appState": {
292
316
  "name": "appState",
@@ -1349,6 +1373,108 @@ const snapshotJson = `{
1349
1373
  "compositePrimaryKeys": {},
1350
1374
  "uniqueConstraints": {},
1351
1375
  "checkConstraints": {}
1376
+ },
1377
+ "arweave_l1_finalize_jobs": {
1378
+ "name": "arweave_l1_finalize_jobs",
1379
+ "columns": {
1380
+ "id": {
1381
+ "name": "id",
1382
+ "type": "integer",
1383
+ "primaryKey": true,
1384
+ "notNull": true,
1385
+ "autoincrement": true
1386
+ },
1387
+ "seed_local_id": {
1388
+ "name": "seed_local_id",
1389
+ "type": "text",
1390
+ "primaryKey": false,
1391
+ "notNull": true,
1392
+ "autoincrement": false
1393
+ },
1394
+ "data_item_id": {
1395
+ "name": "data_item_id",
1396
+ "type": "text",
1397
+ "primaryKey": false,
1398
+ "notNull": true,
1399
+ "autoincrement": false
1400
+ },
1401
+ "l1_transaction_id": {
1402
+ "name": "l1_transaction_id",
1403
+ "type": "text",
1404
+ "primaryKey": false,
1405
+ "notNull": false,
1406
+ "autoincrement": false
1407
+ },
1408
+ "bundle_id": {
1409
+ "name": "bundle_id",
1410
+ "type": "text",
1411
+ "primaryKey": false,
1412
+ "notNull": false,
1413
+ "autoincrement": false
1414
+ },
1415
+ "version_local_id": {
1416
+ "name": "version_local_id",
1417
+ "type": "text",
1418
+ "primaryKey": false,
1419
+ "notNull": false,
1420
+ "autoincrement": false
1421
+ },
1422
+ "item_property_name": {
1423
+ "name": "item_property_name",
1424
+ "type": "text",
1425
+ "primaryKey": false,
1426
+ "notNull": false,
1427
+ "autoincrement": false
1428
+ },
1429
+ "phase": {
1430
+ "name": "phase",
1431
+ "type": "text",
1432
+ "primaryKey": false,
1433
+ "notNull": true,
1434
+ "autoincrement": false
1435
+ },
1436
+ "status_json": {
1437
+ "name": "status_json",
1438
+ "type": "text",
1439
+ "primaryKey": false,
1440
+ "notNull": false,
1441
+ "autoincrement": false
1442
+ },
1443
+ "error_message": {
1444
+ "name": "error_message",
1445
+ "type": "text",
1446
+ "primaryKey": false,
1447
+ "notNull": false,
1448
+ "autoincrement": false
1449
+ },
1450
+ "created_at": {
1451
+ "name": "created_at",
1452
+ "type": "integer",
1453
+ "primaryKey": false,
1454
+ "notNull": true,
1455
+ "autoincrement": false
1456
+ },
1457
+ "updated_at": {
1458
+ "name": "updated_at",
1459
+ "type": "integer",
1460
+ "primaryKey": false,
1461
+ "notNull": true,
1462
+ "autoincrement": false
1463
+ }
1464
+ },
1465
+ "indexes": {
1466
+ "arweave_l1_finalize_jobs_data_item_id_unique": {
1467
+ "name": "arweave_l1_finalize_jobs_data_item_id_unique",
1468
+ "columns": [
1469
+ "data_item_id"
1470
+ ],
1471
+ "isUnique": true
1472
+ }
1473
+ },
1474
+ "foreignKeys": {},
1475
+ "compositePrimaryKeys": {},
1476
+ "uniqueConstraints": {},
1477
+ "checkConstraints": {}
1352
1478
  }
1353
1479
  },
1354
1480
  "views": {},
@@ -1376,6 +1502,7 @@ var drizzleFiles = /*#__PURE__*/Object.freeze({
1376
1502
  migrationSql_0007_add_required_to_properties: migrationSql_0007_add_required_to_properties,
1377
1503
  migrationSql_0008_add_revoked_at_to_seeds: migrationSql_0008_add_revoked_at_to_seeds,
1378
1504
  migrationSql_0009_happy_namor: migrationSql_0009_happy_namor,
1505
+ migrationSql_0010_add_arweave_l1_finalize_jobs: migrationSql_0010_add_arweave_l1_finalize_jobs,
1379
1506
  snapshotJson: snapshotJson
1380
1507
  });
1381
1508
 
@@ -1431,7 +1558,7 @@ class Db extends BaseDb {
1431
1558
  logger('[Db.prepareDb] database prepared');
1432
1559
  await this.runMigrations(db);
1433
1560
  this.appDb = db;
1434
- const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-DptGKVzG.js');
1561
+ const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-DCYUHZDQ.js');
1435
1562
  await backfillMetadataPropertyIds();
1436
1563
  return this.appDb;
1437
1564
  }
@@ -1831,4 +1958,4 @@ class Db extends BaseDb {
1831
1958
  }
1832
1959
 
1833
1960
  export { Db };
1834
- //# sourceMappingURL=Db-DWvxJG22.js.map
1961
+ //# sourceMappingURL=Db-CCMLWMi-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Db-CCMLWMi-.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\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}`\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\": \"ff2318d5-236f-4157-82ae-10ccb44c0e0c\",\n \"prevId\": \"ff040f54-6cfc-4d32-a572-2f08870c5b85\",\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 },\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,MAAM,gCAAgC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFAwHiC;AAE1E,MAAM,oCAAoC,GAAG,CAAA;kDACF;AAE3C,MAAM,kCAAkC,GAAG,CAAA;;0FAEwC;AAEnF,MAAM,wCAAwC,GAAG,CAAA;;mDAEL;AAE5C,MAAM,wCAAwC,GAAG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as BaseDb, Y as appState } from './index-C1HlP_fU.js';
2
2
  import path from 'path';
3
3
  import debug from 'debug';
4
- import { s as schema } from './index-QSl4EYun.js';
4
+ import { s as schema } from './index-dDmXPEJC.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-DptGKVzG.js');
77
+ const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-DCYUHZDQ.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-29bu0gJx.js.map
249
+ //# sourceMappingURL=Db-YFg99EDt.js.map