@seedprotocol/sdk 0.4.4 → 0.4.6

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 (146) hide show
  1. package/README.md +38 -348
  2. package/dist/{ArweaveClient-DkNLWiSZ.js → ArweaveClient-Caio37h1.js} +8 -8
  3. package/dist/ArweaveClient-Caio37h1.js.map +1 -0
  4. package/dist/{ArweaveClient-CczHvccG.js → ArweaveClient-DLKAaS3K.js} +8 -8
  5. package/dist/ArweaveClient-DLKAaS3K.js.map +1 -0
  6. package/dist/{Db-DJvjXVlp.js → Db-C9fppVRl.js} +9 -9
  7. package/dist/Db-C9fppVRl.js.map +1 -0
  8. package/dist/{Db-BzQR2KX9.js → Db-DJAG-5Di.js} +13 -11
  9. package/dist/Db-DJAG-5Di.js.map +1 -0
  10. package/dist/{EasClient-CHQYmjj2.js → EasClient-DQGAIj-b.js} +8 -8
  11. package/dist/EasClient-DQGAIj-b.js.map +1 -0
  12. package/dist/{EasClient-CodrIgW-.js → EasClient-T7Nx9185.js} +8 -8
  13. package/dist/EasClient-T7Nx9185.js.map +1 -0
  14. package/dist/{FileManager-BbvkZJCH.js → FileManager-BohtoKYo.js} +10 -9
  15. package/dist/FileManager-BohtoKYo.js.map +1 -0
  16. package/dist/{FileManager-BIVsDnMu.js → FileManager-d64CkqXy.js} +8 -8
  17. package/dist/FileManager-d64CkqXy.js.map +1 -0
  18. package/dist/Item/Item.d.ts.map +1 -1
  19. package/dist/Item/service/actors/fetchDataFromEas.d.ts.map +1 -1
  20. package/dist/Item/service/actors/loadOrCreateItem.d.ts.map +1 -1
  21. package/dist/Item/service/actors/runPublish.d.ts.map +1 -1
  22. package/dist/ItemProperty/ItemProperty.d.ts.map +1 -1
  23. package/dist/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
  24. package/dist/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
  25. package/dist/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
  26. package/dist/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +1 -1
  27. package/dist/Model/Model.d.ts.map +1 -1
  28. package/dist/Model/service/actors/createModelProperties.d.ts.map +1 -1
  29. package/dist/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
  30. package/dist/Model/service/actors/validateModel.d.ts.map +1 -1
  31. package/dist/ModelProperty/ModelProperty.d.ts.map +1 -1
  32. package/dist/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
  33. package/dist/ModelProperty/service/actors/saveToSchema.d.ts.map +1 -1
  34. package/dist/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
  35. package/dist/{ModelProperty-gjcA83Mq.js → ModelProperty-Cpd9xiIM.js} +67 -768
  36. package/dist/ModelProperty-Cpd9xiIM.js.map +1 -0
  37. package/dist/{PathResolver-kGzba-zC.js → PathResolver-CLZUWoX2.js} +8 -8
  38. package/dist/PathResolver-CLZUWoX2.js.map +1 -0
  39. package/dist/{PathResolver-9zAzPhee.js → PathResolver-D6M0rzKV.js} +8 -8
  40. package/dist/PathResolver-D6M0rzKV.js.map +1 -0
  41. package/dist/{QueryClient-C7ZkTT0z.js → QueryClient-BUoz2Vb0.js} +8 -8
  42. package/dist/QueryClient-BUoz2Vb0.js.map +1 -0
  43. package/dist/{QueryClient-CEtsek7Q.js → QueryClient-COQ_Rs4-.js} +8 -8
  44. package/dist/QueryClient-COQ_Rs4-.js.map +1 -0
  45. package/dist/Schema/Schema.d.ts.map +1 -1
  46. package/dist/Schema/service/actors/createModelInstances.d.ts.map +1 -1
  47. package/dist/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
  48. package/dist/Schema/service/actors/verifyModelInstancesInCache.d.ts.map +1 -1
  49. package/dist/Schema/service/actors/writePropertiesToDb.d.ts.map +1 -1
  50. package/dist/Schema/service/addModelsMachine.d.ts.map +1 -1
  51. package/dist/{Schema-ClTcpgbt.js → Schema-BZKBy5Tx.js} +799 -62
  52. package/dist/Schema-BZKBy5Tx.js.map +1 -0
  53. package/dist/{SchemaValidationService-BfoEiHNr.js → SchemaValidationService-F8No7BHp.js} +7 -7
  54. package/dist/SchemaValidationService-F8No7BHp.js.map +1 -0
  55. package/dist/browser/helpers/FileManager.d.ts.map +1 -1
  56. package/dist/browser/react/itemProperty.d.ts.map +1 -1
  57. package/dist/cjs/{ModelProperty-BRKRREYP.js → ModelProperty-B4pV91tc.js} +78 -438
  58. package/dist/cjs/ModelProperty-B4pV91tc.js.map +1 -0
  59. package/dist/cjs/{Schema-CV9hMg8m.js → Schema-TErl3J36.js} +437 -93
  60. package/dist/cjs/Schema-TErl3J36.js.map +1 -0
  61. package/dist/cjs/{SchemaValidationService-DUtQUerg.js → SchemaValidationService-p5BbJV9T.js} +3 -3
  62. package/dist/cjs/{SchemaValidationService-DUtQUerg.js.map → SchemaValidationService-p5BbJV9T.js.map} +1 -1
  63. package/dist/cjs/{getItem-BThT-UOt.js → getItem-BrnLfC12.js} +3 -3
  64. package/dist/cjs/{getItem-BThT-UOt.js.map → getItem-BrnLfC12.js.map} +1 -1
  65. package/dist/cjs/{getPublishPayload-CKZ7rVbU.js → getPublishPayload-BcjCN_bD.js} +8 -6
  66. package/dist/cjs/getPublishPayload-BcjCN_bD.js.map +1 -0
  67. package/dist/cjs/{getPublishUploads-CuGIvV-Q.js → getPublishUploads-5_oXzwol.js} +4 -4
  68. package/dist/cjs/{getPublishUploads-CuGIvV-Q.js.map → getPublishUploads-5_oXzwol.js.map} +1 -1
  69. package/dist/cjs/{getSegmentedItemProperties-BCJXJlTR.js → getSegmentedItemProperties-WFdizUDv.js} +2 -2
  70. package/dist/cjs/{getSegmentedItemProperties-BCJXJlTR.js.map → getSegmentedItemProperties-WFdizUDv.js.map} +1 -1
  71. package/dist/cjs/{index-CbTBDqTJ.js → index-BrmvhXsG.js} +3 -3
  72. package/dist/cjs/index-BrmvhXsG.js.map +1 -0
  73. package/dist/cjs/{index-C3j3m34a.js → index-CXI4VF1H.js} +12351 -12189
  74. package/dist/cjs/index-CXI4VF1H.js.map +1 -0
  75. package/dist/client/actors/platformClassesInit.d.ts.map +1 -1
  76. package/dist/client/actors/saveAppState.d.ts.map +1 -1
  77. package/dist/db/read/getModelSchemas.d.ts.map +1 -1
  78. package/dist/db/read/getPublishPayload.d.ts.map +1 -1
  79. package/dist/db/write/createNewItem.d.ts.map +1 -1
  80. package/dist/eas.d.ts.map +1 -1
  81. package/dist/events/files/download.d.ts.map +1 -1
  82. package/dist/events/item/syncDbWithEas.d.ts.map +1 -1
  83. package/dist/{getItem-BWPo8wd0.js → getItem-DaQVdeae.js} +8 -8
  84. package/dist/getItem-DaQVdeae.js.map +1 -0
  85. package/dist/{getPublishPayload-Caw2laZM.js → getPublishPayload-CWiLI1yd.js} +12 -10
  86. package/dist/getPublishPayload-CWiLI1yd.js.map +1 -0
  87. package/dist/{getPublishUploads-MlyBuoXh.js → getPublishUploads-DhvcKD_9.js} +9 -9
  88. package/dist/getPublishUploads-DhvcKD_9.js.map +1 -0
  89. package/dist/{getSegmentedItemProperties-COLLdDo4.js → getSegmentedItemProperties-Cp4kcWIF.js} +2 -2
  90. package/dist/getSegmentedItemProperties-Cp4kcWIF.js.map +1 -0
  91. package/dist/helpers/db.d.ts.map +1 -1
  92. package/dist/helpers/property.d.ts.map +1 -1
  93. package/dist/helpers/schema.d.ts.map +1 -1
  94. package/dist/helpers/updateSchema.d.ts.map +1 -1
  95. package/dist/imports/json.d.ts.map +1 -1
  96. package/dist/{index-D2OGsG4v.js → index-DBy53qbb.js} +2 -2
  97. package/dist/index-DBy53qbb.js.map +1 -0
  98. package/dist/{ClientManager-DoHUt8tU.js → index-Dk73a7JE.js} +11781 -11613
  99. package/dist/index-Dk73a7JE.js.map +1 -0
  100. package/dist/{index-B9i_mXXp.js → index-LfXKx_PE.js} +9 -9
  101. package/dist/index-LfXKx_PE.js.map +1 -0
  102. package/dist/main.cjs +2 -2
  103. package/dist/main.js +16 -13
  104. package/dist/main.js.map +1 -1
  105. package/dist/node/db/Db.d.ts.map +1 -1
  106. package/dist/node.js +15 -15
  107. package/dist/node.js.map +1 -1
  108. package/dist/{property-fK7tSUDX.js → property-1o2MvYTm.js} +10 -4
  109. package/dist/property-1o2MvYTm.js.map +1 -0
  110. package/dist/{queries-DGOk16cd.js → queries-DA4G0iEN.js} +2 -2
  111. package/dist/queries-DA4G0iEN.js.map +1 -0
  112. package/dist/services/publish/actors/preparePublishRequestData.d.ts.map +1 -1
  113. package/dist/services/publish/actors/upload.d.ts.map +1 -1
  114. package/dist/services/write/actors/validateEntity.d.ts.map +1 -1
  115. package/dist/services/write/actors/writeToDatabase.d.ts.map +1 -1
  116. package/dist/vite.js.map +1 -1
  117. package/package.json +8 -4
  118. package/dist/ArweaveClient-CczHvccG.js.map +0 -1
  119. package/dist/ArweaveClient-DkNLWiSZ.js.map +0 -1
  120. package/dist/ClientManager-DoHUt8tU.js.map +0 -1
  121. package/dist/Db-BzQR2KX9.js.map +0 -1
  122. package/dist/Db-DJvjXVlp.js.map +0 -1
  123. package/dist/EasClient-CHQYmjj2.js.map +0 -1
  124. package/dist/EasClient-CodrIgW-.js.map +0 -1
  125. package/dist/FileManager-BIVsDnMu.js.map +0 -1
  126. package/dist/FileManager-BbvkZJCH.js.map +0 -1
  127. package/dist/ModelProperty-gjcA83Mq.js.map +0 -1
  128. package/dist/PathResolver-9zAzPhee.js.map +0 -1
  129. package/dist/PathResolver-kGzba-zC.js.map +0 -1
  130. package/dist/QueryClient-C7ZkTT0z.js.map +0 -1
  131. package/dist/QueryClient-CEtsek7Q.js.map +0 -1
  132. package/dist/Schema-ClTcpgbt.js.map +0 -1
  133. package/dist/SchemaValidationService-BfoEiHNr.js.map +0 -1
  134. package/dist/cjs/ModelProperty-BRKRREYP.js.map +0 -1
  135. package/dist/cjs/Schema-CV9hMg8m.js.map +0 -1
  136. package/dist/cjs/getPublishPayload-CKZ7rVbU.js.map +0 -1
  137. package/dist/cjs/index-C3j3m34a.js.map +0 -1
  138. package/dist/cjs/index-CbTBDqTJ.js.map +0 -1
  139. package/dist/getItem-BWPo8wd0.js.map +0 -1
  140. package/dist/getPublishPayload-Caw2laZM.js.map +0 -1
  141. package/dist/getPublishUploads-MlyBuoXh.js.map +0 -1
  142. package/dist/getSegmentedItemProperties-COLLdDo4.js.map +0 -1
  143. package/dist/index-B9i_mXXp.js.map +0 -1
  144. package/dist/index-D2OGsG4v.js.map +0 -1
  145. package/dist/property-fK7tSUDX.js.map +0 -1
  146. package/dist/queries-DGOk16cd.js.map +0 -1
package/dist/node.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sources":["../src/imports/markdown.ts","../src/node/webpack/index.ts","../src/node/helpers/index.ts","../src/node/helpers/scripts.ts","../src/node/codegen/drizzle.ts","../src/node/index.ts"],"sourcesContent":["import yaml from 'js-yaml'\nimport { readFileSync } from 'fs'\nimport { Property, ModelPropertyDataTypes } from '@/Schema'\nimport { ModelDefinitions } from '@/types'\nimport { addModelsToDb } from '../helpers/db'\nimport type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3'\nimport { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy'\nimport type { Model } from '@/Model/Model'\n\n/**\n * Configuration structure expected in markdown frontmatter\n */\ntype SeedConfig = {\n seed: {\n model: string\n properties: {\n [propertyName: string]: {\n type: string\n target?: string\n }\n }\n }\n}\n\n/**\n * Parses markdown frontmatter from a file\n * @param filePath Path to the markdown file\n * @returns The parsed frontmatter as an object, or null if no frontmatter found\n */\nexport const parseMarkdownFrontmatter = (\n filePath: string,\n): Record<string, any> | null => {\n const content = readFileSync(filePath, 'utf-8')\n \n // Check for frontmatter delimiters (more flexible regex)\n // Matches --- at start, optional whitespace, content, ---, optional whitespace\n const frontmatterRegex = /^---\\s*\\n([\\s\\S]*?)\\n---(\\s*\\n|$)/\n const match = content.match(frontmatterRegex)\n \n if (!match) {\n return null\n }\n \n const frontmatterYaml = match[1]\n \n try {\n const frontmatter = yaml.load(frontmatterYaml) as Record<string, any>\n return frontmatter\n } catch (error) {\n throw new Error(\n `Failed to parse YAML frontmatter in ${filePath}: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n}\n\n/**\n * Converts a seed config from frontmatter to ModelDefinitions format\n * @param config The seed configuration from frontmatter\n * @returns ModelDefinitions object ready to be saved to database\n */\nexport const processSeedConfig = (config: SeedConfig): ModelDefinitions => {\n if (!config.seed) {\n throw new Error('No seed configuration found in frontmatter')\n }\n \n const { model: modelName, properties: propertiesConfig } = config.seed\n \n if (!modelName) {\n throw new Error('Model name is required in seed configuration')\n }\n \n if (!propertiesConfig || Object.keys(propertiesConfig).length === 0) {\n throw new Error('Properties are required in seed configuration')\n }\n \n // Convert property configs to Property definitions\n const schema: Record<string, any> = {}\n \n for (const [propertyName, propertyConfig] of Object.entries(propertiesConfig)) {\n const { type, target } = propertyConfig\n \n if (!type) {\n throw new Error(`Property type is required for ${propertyName}`)\n }\n \n // Map the type to Property constructor\n switch (type) {\n case ModelPropertyDataTypes.Text:\n schema[propertyName] = Property.Text()\n break\n case ModelPropertyDataTypes.Number:\n schema[propertyName] = Property.Number()\n break\n case ModelPropertyDataTypes.Boolean:\n schema[propertyName] = Property.Boolean()\n break\n case ModelPropertyDataTypes.Date:\n schema[propertyName] = Property.Date()\n break\n case ModelPropertyDataTypes.Image:\n schema[propertyName] = Property.Image()\n break\n case ModelPropertyDataTypes.Json:\n schema[propertyName] = Property.Json()\n break\n case ModelPropertyDataTypes.File:\n schema[propertyName] = Property.File()\n break\n case ModelPropertyDataTypes.Relation:\n if (!target) {\n throw new Error(\n `Target model is required for Relation property ${propertyName}`,\n )\n }\n schema[propertyName] = Property.Relation(target)\n break\n case ModelPropertyDataTypes.List:\n if (!target) {\n throw new Error(\n `Target model is required for List property ${propertyName}`,\n )\n }\n schema[propertyName] = Property.List(target)\n break\n default:\n throw new Error(\n `Unknown property type: ${type} for property ${propertyName}`,\n )\n }\n }\n \n // Create a mock ModelClass structure that matches ModelDefinitions\n // This is a simplified version that works with addModelsToInternalDb\n const modelClass = {\n schema,\n create: async () => {\n throw new Error('Model.create() should not be called directly')\n },\n originalConstructor: class {},\n }\n \n return {\n [modelName]: modelClass as any as Model,\n }\n}\n\n/**\n * Reads a markdown file, parses frontmatter, and saves models/properties to database\n * @param filePath Path to the markdown file\n * @param db Database instance (BetterSQLite3Database or SqliteRemoteDatabase)\n * @returns The created ModelDefinitions\n */\nexport const saveModelsFromMarkdown = async (\n filePath: string,\n db: BetterSQLite3Database<any> | SqliteRemoteDatabase<any>,\n): Promise<ModelDefinitions> => {\n // Parse frontmatter\n const frontmatter = parseMarkdownFrontmatter(filePath)\n \n if (!frontmatter) {\n throw new Error(`No frontmatter found in ${filePath}`)\n }\n \n // Validate and process seed config\n const seedConfig = frontmatter as SeedConfig\n const modelDefinitions = processSeedConfig(seedConfig)\n \n // Save to database\n await addModelsToDb(modelDefinitions, undefined, undefined, undefined)\n \n return modelDefinitions\n}\n","// import path from \"path\";\n// import { fileURLToPath } from \"url\";\n\n// const __filename = fileURLToPath(import.meta.url);\n// const __dirname = path.dirname(__filename);\n\nexport const withSeed = (config: any, webpack: any, isServer: boolean) => {\n // If you need to include directories outside of the project root\n // config.module.rules.push({\n // test: /\\.ts$/,\n // include: [path.resolve(process.cwd(), 'schema.ts')],\n // use: 'ts-loader',\n // })\n\n config.plugins.push(\n // new webpack.DefinePlugin({\n // __dirname: JSON.stringify(__dirname),\n // }),\n new webpack.NormalModuleReplacementPlugin(/node:/, (resource: { request: string }) => {\n resource.request = resource.request.replace(/^node:/, '')\n }),\n )\n\n // config.externals.push({\n // 'fsevents': 'commonjs2 fsevents',\n // })\n\n // console.log('__dirname:', __dirname)\n // console.log('process.cwd():', process.cwd())\n\n // console.log('crypto-browserify exists:', fs.existsSync(path.resolve(process.cwd(), './node_modules/crypto-browserify')))\n // console.log('path-browserify exists:', fs.existsSync(path.resolve(process.cwd(), './node_modules/path-browserify')))\n\n if (!isServer) {\n // config.plugins.push(\n // new webpack.NormalModuleReplacementPlugin(/node:/, (resource: any) => {\n // resource.request = resource.request.replace(/^node:/, '')\n // }),\n // )\n // config.plugins.push(\n // new webpack.NormalModuleReplacementPlugin(\n // /^(node:)?fs$/,\n // (resource: any) => {\n // resource.request = '@zenfs/core';\n // }\n // )\n // )\n\n // config.module.rules.push({\n // test: /\\.js$/,\n // exclude: '/node_modules/@seedprotocol/sdk/node', // Exclude the 'node-files' directory\n // use: {\n // loader: 'babel-loader',\n // options: {\n // presets: ['next/babel'],\n // },\n // },\n // });\n\n\n // config.resolve.alias['fs/promises'] = '@zenfs/core/promises';\n\n config.resolve.alias['fs'] = '@zenfs/core'\n config.resolve.alias['node:fs'] = '@zenfs/core'\n config.resolve.alias['node:path'] = 'path-browserify'\n config.resolve.alias['path'] = 'path-browserify'\n\n // config.resolve.alias['fs'] = path.resolve(\n // process.cwd(),\n // './node_modules/@zenfs/core',\n // )\n // config.resolve.alias['node:fs'] = path.resolve(\n // process.cwd(),\n // './node_modules/@zenfs/core',\n // )\n // config.resolve.alias['@schema'] = path.resolve(process.cwd(), 'schema.ts')\n // // config.resolve.alias['crypto'] = path.resolve(process.cwd(), './node_modules/crypto-browserify')\n // // config.resolve.alias['node:crypto'] = path.resolve(process.cwd(), './node_modules/crypto-browserify')\n // config.resolve.alias['node:path'] = path.resolve(\n // process.cwd(),\n // './node_modules/path-browserify',\n // )\n // config.resolve.alias['path'] = path.resolve(\n // process.cwd(),\n // './node_modules/path-browserify',\n // )\n }\n\n if (isServer) {\n config.externals.push('@sqlite.org/sqlite-wasm')\n config.externals.push('nunjucks')\n config.externals.push('chokidar')\n config.externals.push('arweave')\n }\n\n // config.module.rules.push({\n // test: /seed\\.config\\.mjs$/,\n // use: [\n // {\n // loader: 'babel-loader',\n // options: {\n // plugins: ['@babel/plugin-syntax-dynamic-import'],\n // },\n // },\n // ],\n // })\n\n return config\n}\n","import fs from 'fs'\nimport * as tsImport from 'ts-import'\nimport { LoadMode } from 'ts-import'\nimport path from 'path'\nimport { glob } from 'glob'\nimport { rimraf } from 'rimraf'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:helpers')\n\nexport const getTsImport = async <T>(filePath: string): Promise<T> => {\n // Check if the config file exists\n if (!fs.existsSync(filePath)) {\n logger(`Typescript file not found at ${filePath}`)\n throw new Error(`Typescript file not found at ${filePath}`)\n }\n\n let result\n\n try {\n // Read the file content and transform relative imports to absolute paths\n // This fixes the issue where ts-import compiles to .mjs in cache and relative\n // imports resolve from the cache location instead of the original file location\n let fileContent = fs.readFileSync(filePath, 'utf-8')\n const fileDir = path.dirname(path.resolve(filePath))\n \n // Replace relative imports with absolute paths\n // Match: from '../../../../src/schema' or from '../../../something'\n const relativeImportRegex = /from\\s+['\"](\\.\\.\\/.*?)['\"]/g\n fileContent = fileContent.replace(relativeImportRegex, (match, importPath) => {\n const absolutePath = path.resolve(fileDir, importPath)\n // Convert to file:// URL for ESM compatibility, or use absolute path\n return `from '${absolutePath}'`\n })\n\n // Write to a temporary file and load that instead\n const tempFile = path.join(fileDir, `.temp.${path.basename(filePath)}`)\n fs.writeFileSync(tempFile, fileContent)\n \n try {\n result = await tsImport.load(tempFile, {\n mode: LoadMode.Compile,\n compileOptions: {\n compilerOptions: {\n experimentalDecorators: true,\n emitDecoratorMetadata: true,\n },\n },\n }).catch((e) => {\n logger('Error loading ts file:', e)\n throw e\n })\n } finally {\n // Clean up temp file\n if (fs.existsSync(tempFile)) {\n fs.unlinkSync(tempFile)\n }\n }\n\n } catch ( e ) {\n console.error(e)\n }\n\n\n return result\n}\n\nexport const deleteFilesWithExtension = async (\n dir: string,\n extension: string,\n) => {\n const pattern = path.join(dir, `**/*${extension}`)\n try {\n const files = await glob(pattern)\n for (const file of files) {\n try {\n await rimraf(file)\n logger(`Deleted: ${file}`)\n } catch (err) {\n logger('Error deleting file:', err)\n }\n }\n } catch (err) {\n logger('Error finding files:', err)\n }\n}\n","import { execSync } from 'child_process'\nimport path from 'path'\nimport fs from 'fs'\nimport { fileURLToPath, pathToFileURL } from 'url'\nimport { drizzle } from 'drizzle-orm/libsql'\nimport { generateSQLiteDrizzleJson, generateSQLiteMigration, generateMigration, pushSQLiteSchema } from 'drizzle-kit/api'\nimport * as schema from '@/seedSchema'\nimport { createClient } from '@libsql/client'\n\n// Get the directory of this file to resolve relative paths\n// @ts-ignore - rollup plugin-typescript doesn't recognize import.meta with module: \"preserve\"\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport const commandExists = (command: string): boolean => {\n try {\n execSync(`which ${command}`, { stdio: 'ignore' })\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Finds the seed binary path, trying multiple locations\n * @returns The path to the seed binary, or null if not found\n */\nexport const findSeedBinary = (): string | null => {\n const cwd = process.cwd()\n \n // Try common locations for the seed binary\n const possiblePaths = [\n path.join(cwd, 'node_modules', '.bin', 'seed'),\n path.join(cwd, 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n // Try parent directories (for monorepos or nested projects)\n path.join(cwd, '..', 'node_modules', '.bin', 'seed'),\n path.join(cwd, '..', 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n path.join(cwd, '..', '..', 'node_modules', '.bin', 'seed'),\n path.join(cwd, '..', '..', 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n ]\n \n for (const binPath of possiblePaths) {\n if (fs.existsSync(binPath)) {\n return binPath\n }\n }\n \n return null\n}\n\n/**\n * Checks if we're running in the monorepo by looking for the CLI package directory\n * @returns The path to the monorepo root, or null if not in monorepo\n */\nfunction getMonorepoRoot(): string | null {\n // Start from this file's location and walk up to find packages/cli\n let currentDir = __dirname\n \n // Walk up the directory tree looking for packages/cli\n for (let i = 0; i < 10; i++) { // Limit to 10 levels to avoid infinite loops\n const packagesDir = path.join(currentDir, 'packages')\n const cliDir = path.join(packagesDir, 'cli')\n \n if (fs.existsSync(cliDir) && fs.existsSync(path.join(cliDir, 'package.json'))) {\n // Found packages/cli, return the monorepo root (parent of packages)\n return path.dirname(packagesDir)\n }\n \n const parentDir = path.dirname(currentDir)\n if (parentDir === currentDir) {\n // Reached filesystem root\n break\n }\n currentDir = parentDir\n }\n \n return null\n}\n\n/**\n * Attempts to import the CLI package, preferring local monorepo version over published package\n * @returns The CLI module or null if not found\n */\nasync function importCliPackage(): Promise<any> {\n // First, try to import from local monorepo CLI (for development)\n const monorepoRoot = getMonorepoRoot()\n \n if (monorepoRoot) {\n const localCliDistPath = path.join(monorepoRoot, 'packages', 'cli', 'dist', 'index.js')\n const localCliSrcPath = path.join(monorepoRoot, 'packages', 'cli', 'src', 'index.ts')\n \n // Try built dist first (most reliable)\n if (fs.existsSync(localCliDistPath)) {\n try {\n const localCliDistUrl = pathToFileURL(localCliDistPath).href\n const cliModule = await import(localCliDistUrl)\n if (cliModule && typeof cliModule.init === 'function') {\n return cliModule\n }\n } catch (error: any) {\n // Dist import failed, try source\n }\n }\n \n // Try source (for development with tsx/ts-node)\n if (fs.existsSync(localCliSrcPath)) {\n try {\n const localCliSrcUrl = pathToFileURL(localCliSrcPath).href\n const cliModule = await import(localCliSrcUrl)\n if (cliModule && typeof cliModule.init === 'function') {\n return cliModule\n }\n } catch (error: any) {\n // Source import failed (TypeScript not compiled or not using tsx)\n }\n }\n }\n \n // Fall back to published package (for production/consumers)\n // Note: @seedprotocol/cli is not a dependency of the SDK to avoid circular dependencies\n // This is a dynamic import that may not be available in all environments\n try {\n // @ts-ignore - Dynamic import of optional CLI package\n // Using template literal to prevent Vite from statically analyzing this import\n const cliPackageName = '@seedprotocol/cli'\n const cliModule = await import(cliPackageName)\n if (cliModule && typeof cliModule.init === 'function') {\n return cliModule\n }\n } catch (importError: any) {\n // Published package not available\n return null\n }\n \n return null\n}\n\n/**\n * Runs seed init programmatically, trying multiple methods:\n * 1. Try to dynamically import and call the CLI package's init function (prefers local monorepo version)\n * 2. Try to find and execute the seed binary\n * 3. Fall back to using npx\n * @param schemaFileDir - Optional path to schema file directory\n * @param appFilesDirPath - Optional path to app files directory\n */\nexport const runSeedInit = async (\n schemaFileDir?: string,\n appFilesDirPath?: string\n): Promise<void> => {\n\n const dbDirExists = fs.existsSync(`${appFilesDirPath}/db`)\n if (!dbDirExists) {\n fs.mkdirSync(`${appFilesDirPath}/db`, { recursive: true })\n }\n\n const dbUrl = `file:${appFilesDirPath}/db/seed.db`\n const client = createClient({ url: dbUrl })\n\n const db = drizzle(client, {schema})\n\n const { apply, hasDataLoss, warnings, statementsToExecute } = await pushSQLiteSchema(schema, db);\n \n // You can inspect what will happen before applying\n \n await apply();\n\n\n // // First, try to dynamically import the CLI package's init function\n // // This prefers local monorepo version in development, falls back to published package\n // try {\n // const cliModule = await importCliPackage()\n // if (cliModule && typeof cliModule.init === 'function') {\n // await cliModule.init(schemaFileDir, appFilesDirPath)\n // return\n // }\n // } catch (importError: any) {\n // // CLI package not available, continue to other methods\n // console.log('[seedInit] CLI package not available, trying binary execution')\n // }\n \n // // Try to find and execute the binary\n // const seedBinary = findSeedBinary()\n \n // if (seedBinary) {\n // // Binary found, execute it directly\n // const args = ['init']\n // if (schemaFileDir) {\n // args.push(schemaFileDir)\n // }\n // if (appFilesDirPath) {\n // args.push(appFilesDirPath)\n // }\n \n // try {\n // execSync(`node \"${seedBinary}\" ${args.join(' ')}`, {\n // stdio: 'inherit',\n // cwd: process.cwd(),\n // })\n // return\n // } catch (error: any) {\n // console.warn(`[seedInit] Failed to execute binary at ${seedBinary}: ${error.message}`)\n // // Continue to npx fallback\n // }\n // }\n \n // // Final fallback: use npx\n // const args = ['seed', 'init']\n // if (schemaFileDir) {\n // args.push(schemaFileDir)\n // }\n // if (appFilesDirPath) {\n // args.push(appFilesDirPath)\n // }\n \n // try {\n // execSync(`npx ${args.join(' ')}`, {\n // stdio: 'inherit',\n // cwd: process.cwd(),\n // })\n // } catch (error: any) {\n // throw new Error(\n // `Failed to run seed init command. ` +\n // `Tried: CLI package import, binary execution, and npx. ` +\n // `Please ensure @seedprotocol/cli is installed: ${error.message}`\n // )\n // }\n}\n\n","import path from 'path'\nimport pluralize from 'pluralize'\nimport { camelCase, snakeCase } from 'lodash-es'\nimport { Model } from '@/Model/Model'\nimport { ModelPropertyDataTypes } from '@/Schema'\nimport { modelPropertiesToObject } from '@/helpers/model'\n\n// Define ILoader type locally to avoid importing from nunjucks (prevents bundling issues)\ntype ILoader = {\n getSource(name: string): { path: string; src: string; noCache: boolean }\n}\nimport { SCHEMA_NJK } from '@/helpers/constants'\nimport { getTsImport } from '@/node/helpers'\nimport fs from 'fs'\nimport { BasePathResolver } from '@/helpers/PathResolver/BasePathResolver'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:codegen:drizzle')\n\n// Lazy load nunjucks to avoid bundling issues when only PathResolver is used\nlet nunjucksEnv: any = null\n\nconst getNunjucksEnv = async () => {\n if (!nunjucksEnv) {\n const nunjucks = await import('nunjucks')\n \n const TemplateLoader: ILoader = {\n getSource: (name: string) => {\n const pathResolver = BasePathResolver.getInstance()\n const { templatePath } = pathResolver.getAppPaths()\n let templateFilePath = templatePath\n if (name.includes(templatePath)) {\n templateFilePath = name\n } else {\n templateFilePath = path.join(templatePath, path.basename(name))\n }\n const src = fs.readFileSync(templateFilePath, 'utf-8')\n\n return {\n path: name,\n src,\n noCache: false,\n }\n },\n }\n\n // Configure Nunjucks\n nunjucksEnv = new nunjucks.Environment(TemplateLoader)\n\n nunjucksEnv.addFilter('camelCase', camelCase)\n nunjucksEnv.addFilter('snakeCase', snakeCase)\n nunjucksEnv.addFilter('pluralize', pluralize)\n }\n return nunjucksEnv\n}\n\nconst refNamesToExcludeFromRelations = [\n ModelPropertyDataTypes.Text,\n ModelPropertyDataTypes.Number,\n ModelPropertyDataTypes.Boolean,\n ModelPropertyDataTypes.Date,\n]\n\nexport const generateDrizzleSchemaCode = async (\n modelName: string,\n model: Model,\n): Promise<string> => {\n const properties = model.properties || []\n if (properties.length === 0) {\n throw new Error(`Model ${modelName} has no properties`)\n }\n const schema = modelPropertiesToObject(properties)\n const listProperties = Object.entries(schema).filter(\n ([key, propertyDef]) => propertyDef?.dataType === ModelPropertyDataTypes.List && !refNamesToExcludeFromRelations.includes(propertyDef?.ref!),\n )\n\n const pathResolver = BasePathResolver.getInstance()\n const { templatePath } = pathResolver.getAppPaths()\n const filePath = path.join(templatePath, SCHEMA_NJK)\n\n const env = await getNunjucksEnv()\n const schemaCode = env.render(filePath, {\n modelName,\n modelClass: model, // Keep modelClass name for template compatibility\n listProperties,\n })\n\n return schemaCode\n}\n\nexport const createDrizzleSchemaFilesFromConfig = async (\n configFilePath: string | undefined,\n outputDirPath: string | undefined,\n) => {\n const pathResolver = BasePathResolver.getInstance()\n const { dotSeedDir, appSchemaDir } = pathResolver.getAppPaths()\n\n // Use provided config file path or find the config file in the project root\n const schemaFilePath = configFilePath || pathResolver.findConfigFile() || path.join(dotSeedDir, 'seed.config.ts')\n\n const { models, } = await getTsImport<{\n models: Record<string, Model>\n }>(schemaFilePath)\n\n const writeToDir = outputDirPath || appSchemaDir\n\n for (const [modelName, modelClass] of Object.entries(models)) {\n const code = await generateDrizzleSchemaCode(modelName, modelClass)\n\n if (!fs.existsSync(writeToDir)) {\n fs.mkdirSync(writeToDir)\n }\n\n const filePath = path.join(writeToDir, `${modelName}Schema.ts`)\n\n await fs.promises.writeFile(filePath, code).catch((e) => console.error(e))\n }\n}\n\n // Helper to determine TypeScript type based on property type\n const seedTypeToJsType = (propertyType: string): string => {\n switch (propertyType) {\n case ModelPropertyDataTypes.Text:\n return 'string';\n case ModelPropertyDataTypes.Number:\n return 'number';\n case ModelPropertyDataTypes.Boolean:\n return 'boolean';\n case ModelPropertyDataTypes.Date:\n return 'string';\n case ModelPropertyDataTypes.List:\n return 'string[]';\n case ModelPropertyDataTypes.Relation:\n return 'string';\n case ModelPropertyDataTypes.Image:\n return 'string';\n case ModelPropertyDataTypes.File:\n return 'string';\n default:\n return 'any';\n }\n};\n\n\nexport const generateModelCode = async (values: Record<string, any>): Promise<string> => {\n const { modelName, properties } = values;\n const pathResolver = BasePathResolver.getInstance()\n const { templatePath } = pathResolver.getAppPaths()\n\n if (modelName === ModelPropertyDataTypes.Text || modelName === 'TestModel') {\n logger(`Model name is ${modelName}.`)\n }\n\n const nunjucks = await import('nunjucks')\n const njkEnv = new nunjucks.Environment(new nunjucks.FileSystemLoader(templatePath))\n njkEnv.addFilter('seedTypeToJsType', seedTypeToJsType)\n return njkEnv.render('model.njk', { modelName, properties })\n};\n","import { enableMapSet } from 'immer'\n\n// Core schema exports\nexport {\n Model,\n Property,\n Image,\n List,\n Text,\n Json,\n Relation,\n Boolean,\n Number,\n Date,\n} from '../Schema'\n\n// Core classes\nexport { Item } from '../Item/Item'\nexport { ItemProperty } from '../ItemProperty/ItemProperty'\n\n// Node.js specific exports\nexport { FileManager } from './helpers/FileManager'\nexport { Db } from './db/Db'\n\n// Schema exports\nexport { models, versions, seeds, metadata, appState, config, modelUids } from '../seedSchema'\n\n// Model access - use Model static methods instead\n// Models are accessible via Model.all(), Model.getById(), Model.getByName(), etc.\n\n// Helper exports\nexport { getCorrectId } from '../helpers'\n\n// Import exports\nexport * from '../imports'\n\n// Event bus\nexport { eventEmitter } from '../eventBus'\n\n// Webpack helper\nexport { withSeed } from './webpack'\n\n// Types\n// Note: PublishUpload type is available from '../db/read/getPublishUploads'\n// Type-only exports cause issues with Rollup's parser. Import directly if needed:\n// import type { PublishUpload } from '@seedprotocol/sdk/db/read/getPublishUploads'\n\n// Client\nexport { client } from '../client'\n\n// All types\nexport * from '../types'\n\n// CLI exports\nexport { PathResolver } from './helpers/PathResolver'\nexport { BasePathResolver } from '../helpers/PathResolver/BasePathResolver'\nexport { getTsImport } from './helpers'\nexport { commandExists, runSeedInit, findSeedBinary } from './helpers/scripts'\nexport { INIT_SCRIPT_SUCCESS_MESSAGE, SCHEMA_TS } from '../helpers/constants'\n// Codegen functions exported for CLI usage (Node.js only, so bundling concerns don't apply)\nexport { createDrizzleSchemaFilesFromConfig, generateModelCode } from './codegen/drizzle'\n\n// Side effect imports for CLI\nimport './helpers/EasClient'\nimport './helpers/QueryClient'\nimport './helpers/FileManager'\nimport './helpers/ArweaveClient'\nimport './helpers/PathResolver'\n\nenableMapSet() "],"names":["logger","fs","__filename"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA;;;;AAIG;AACI,MAAM,wBAAwB,GAAG,CACtC,QAAgB,KACc;IAC9B,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;;;IAI/C,MAAM,gBAAgB,GAAG,mCAAmC;IAC5D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAE7C,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,IAAI;IACb;AAEA,IAAA,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC;AAEhC,IAAA,IAAI;QACF,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAwB;AACrE,QAAA,OAAO,WAAW;IACpB;IAAE,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,CAAA,oCAAA,EAAuC,QAAQ,KAAK,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA,CAAE,CAC7G;IACH;AACF;AAEA;;;;AAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,MAAkB,KAAsB;AACxE,IAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;AAChB,QAAA,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC;IAC/D;AAEA,IAAA,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC,IAAI;IAEtE,IAAI,CAAC,SAAS,EAAE;AACd,QAAA,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC;IACjE;AAEA,IAAA,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,IAAI,CAAC,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,GAAG,MAAM;AACxC,IAAA,MAAM,YAAY,GAAG,gBAAgB,CAAC,WAAW,EAAE;IACnD,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC,WAAW,EAAE;IAEnD,IAAI,SAAS,KAAK,sBAAsB,CAAC,IAAI,IAAI,SAAS,KAAK,WAAW,EAAE;AAC1E,QAAA,MAAM,CAAC,CAAA,cAAA,EAAiB,SAAS,CAAA,CAAA,CAAG,CAAC;IACvC;AAEA,IAAA,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAC;AACzC,IAAA,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACpF,IAAA,MAAM,CAAC,SAAS,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;AACtD,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AAC9D;;ACxFA,YAAY,EAAE;;;;"}
1
+ {"version":3,"file":"node.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import pluralize from 'pluralize';
2
- import { o as modelPropertiesToObject, p as BaseDb, q as models, r as properties } from './ClientManager-DoHUt8tU.js';
2
+ import { o as modelPropertiesToObject, p as BaseDb, q as models, r as properties } from './index-Dk73a7JE.js';
3
3
  import { eq, and } from 'drizzle-orm';
4
4
 
5
5
  // Dynamic import to break circular dependency: Model -> ... -> helpers/property -> Model
@@ -38,8 +38,14 @@ import { eq, and } from 'drizzle-orm';
38
38
  */
39
39
  const getPropertySchema = async (modelName, propertyName) => {
40
40
  // Dynamic import to break circular dependency
41
- const { Model } = await import('./ClientManager-DoHUt8tU.js').then(function (n) { return n.aX; });
42
- const { Schema } = await import('./Schema-ClTcpgbt.js');
41
+ const _mod_0 = await import('./index-Dk73a7JE.js');
42
+ const _ns_0 = _mod_0.aW;
43
+ const modelMod = _ns_0;
44
+ const { Model } = modelMod;
45
+ const _mod_1 = await import('./Schema-BZKBy5Tx.js');
46
+ const _ns_1 = _mod_1.b;
47
+ const schemaMod = _ns_1;
48
+ const { Schema } = schemaMod;
43
49
  const model = await Model.getByNameAsync(modelName);
44
50
  console.log('getPropertySchema model', model);
45
51
  if (!model) {
@@ -273,4 +279,4 @@ const getPropertySchema = async (modelName, propertyName) => {
273
279
  };
274
280
 
275
281
  export { getPropertySchema as g };
276
- //# sourceMappingURL=property-fK7tSUDX.js.map
282
+ //# sourceMappingURL=property-1o2MvYTm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property-1o2MvYTm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { _ as graphql } from './ClientManager-DoHUt8tU.js';
1
+ import { _ as graphql } from './index-Dk73a7JE.js';
2
2
 
3
3
  const GET_TRANSACTION_TAGS = graphql(/* GraphQL */ `
4
4
  query GetTransactionTags($transactionId: ID!) {
@@ -13,4 +13,4 @@ const GET_TRANSACTION_TAGS = graphql(/* GraphQL */ `
13
13
  `);
14
14
 
15
15
  export { GET_TRANSACTION_TAGS as G };
16
- //# sourceMappingURL=queries-DGOk16cd.js.map
16
+ //# sourceMappingURL=queries-DA4G0iEN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queries-DA4G0iEN.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"preparePublishRequestData.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/actors/preparePublishRequestData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAQlE,eAAO,MAAM,yBAAyB,yGAwEpC,CAAA"}
1
+ {"version":3,"file":"preparePublishRequestData.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/actors/preparePublishRequestData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAQlE,eAAO,MAAM,yBAAyB,yGAyEpC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/actors/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAkBlE,eAAO,MAAM,MAAM,yGA2EjB,CAAA"}
1
+ {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/actors/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAkBlE,eAAO,MAAM,MAAM,yGA6EjB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"validateEntity.d.ts","sourceRoot":"","sources":["../../../../src/services/write/actors/validateEntity.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,OAAO,GAAG,eAAe,GAAG,QAAQ,CAAA;IAChD,UAAU,EAAE,GAAG,CAAA;CAChB,CAAA;AASD,eAAO,MAAM,cAAc,EA+JrB,GAAG,CAAA"}
1
+ {"version":3,"file":"validateEntity.d.ts","sourceRoot":"","sources":["../../../../src/services/write/actors/validateEntity.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,OAAO,GAAG,eAAe,GAAG,QAAQ,CAAA;IAChD,UAAU,EAAE,GAAG,CAAA;CAChB,CAAA;AASD,eAAO,MAAM,cAAc,EAoKrB,GAAG,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"writeToDatabase.d.ts","sourceRoot":"","sources":["../../../../src/services/write/actors/writeToDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAKlD,KAAK,oBAAoB,GAAG;IAC1B,UAAU,EAAE,OAAO,GAAG,eAAe,GAAG,QAAQ,CAAA;IAChD,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,GAAG,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,eAAe,qFA2H1B,CAAA"}
1
+ {"version":3,"file":"writeToDatabase.d.ts","sourceRoot":"","sources":["../../../../src/services/write/actors/writeToDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AASlD,KAAK,oBAAoB,GAAG;IAC1B,UAAU,EAAE,OAAO,GAAG,eAAe,GAAG,QAAQ,CAAA;IAChD,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,GAAG,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,eAAe,qFAgH1B,CAAA"}
package/dist/vite.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.js","sources":["../src/vite/index.ts"],"sourcesContent":["import type { Plugin, UserConfig } from 'vite'\nimport { nodePolyfills } from 'vite-plugin-node-polyfills'\n\nexport interface SeedVitePluginOptions {\n /**\n * Additional modules to alias to ZenFS equivalents.\n * @default ['fs', 'fs/promises', 'node:fs', 'node:fs/promises']\n */\n fsModules?: string[]\n\n /**\n * Whether to inject automatic ZenFS initialization script into index.html.\n * When true, injects a &lt;script type=\"module\"&gt; that imports from '@zenfs/core'/'@zenfs/dom'.\n * Browsers cannot resolve those bare specifiers, so the script fails at runtime unless you use\n * an import map or load ZenFS another way. Prefer false and initialize ZenFS in your entry:\n * import { configure } from '@zenfs/core'; import { IndexedDB } from '@zenfs/dom';\n * await configure({ mounts: { '/': IndexedDB } });\n * @default false\n */\n autoInit?: boolean\n\n /**\n * Enable debug logging.\n * @default false\n */\n debug?: boolean\n\n /**\n * Whether to automatically include vite-plugin-node-polyfills with sensible defaults.\n * @default true\n */\n includeNodePolyfills?: boolean\n}\n\nconst DEFAULT_FS_MODULES = [\n 'fs',\n 'fs/promises',\n 'node:fs',\n 'node:fs/promises',\n]\n\n/**\n * Minimal Vite plugin to make the SDK work in browser/Electron renderer:\n * - Aliases fs → @zenfs/core (and promises variant)\n * - Aliases path → path-browserify\n * - Ensures CommonJS in SDK dist is transformed by Vite's CommonJS plugin\n * - Optionally injects a simple ZenFS initialization script\n * - Optionally wires up vite-plugin-node-polyfills with safe defaults\n *\n * This plugin assumes the SDK does not bundle Node-only code in the browser entry.\n * For Electron, Node-only work (e.g. drizzle-kit, better-sqlite3) should run in the\n * main process; the renderer should only use browser-safe SDK usage.\n *\n * For the renderer build:\n * - Use the SDK's ESM entry: import from '@seedprotocol/sdk' (resolves to dist/main.js).\n * - When autoInit is false (default), initialize ZenFS in your entry:\n * import { configure } from '@zenfs/core'; import { IndexedDB } from '@zenfs/dom';\n * await configure({ mounts: { '/': IndexedDB } });\n */\nexport function seedVitePlugin(options: SeedVitePluginOptions = {}): Plugin[] {\n const {\n fsModules = DEFAULT_FS_MODULES,\n autoInit = false,\n debug = false,\n includeNodePolyfills = true,\n } = options\n\n const log = (...args: unknown[]) => {\n if (debug) console.log('[seed-vite-plugin]', ...args)\n }\n\n /**\n * Pre-plugin: configure aliases and optimizeDeps.\n */\n const configPlugin: Plugin = {\n name: 'seed-protocol:config',\n enforce: 'pre',\n\n config(userConfig) {\n const alias: Record<string, string> = {\n // Always use browser-friendly path implementation\n // path: 'path-browserify',\n }\n\n for (const mod of fsModules) {\n const isPromises = mod.includes('promises')\n const target = isPromises ? '@zenfs/core/promises' : '@zenfs/core'\n alias[mod] = target\n }\n\n // Merge with any existing aliases\n const existingAlias = userConfig.resolve?.alias\n if (Array.isArray(existingAlias)) {\n for (const [key, value] of Object.entries(alias)) {\n existingAlias.push({ find: key, replacement: value })\n }\n }\n\n const optimizeDeps: UserConfig['optimizeDeps'] = {\n ...(userConfig.optimizeDeps ?? {}),\n exclude: [\n ...(userConfig.optimizeDeps?.exclude ?? []),\n // Do not prebundle the SDK itself or clearly node-only tools\n '@seedprotocol/sdk',\n 'drizzle-kit',\n 'drizzle-orm',\n 'better-sqlite3',\n // sqlocal uses workers and should not be prebundled\n 'sqlocal',\n ],\n include: [\n ...(userConfig.optimizeDeps?.include ?? []),\n // Ensure ZenFS packages are discoverable\n '@zenfs/core',\n '@zenfs/dom',\n ],\n }\n\n return {\n resolve: {\n alias,\n },\n optimizeDeps,\n }\n },\n }\n\n /**\n * Post-plugin: build configuration + optional ZenFS init.\n */\n const mainPlugin: Plugin = {\n name: 'seed-protocol:main',\n enforce: 'post',\n\n config(userConfig) {\n const existingBuild = userConfig.build ?? {}\n const existingCommonjs = existingBuild.commonjsOptions ?? {}\n const existingRollupOptions = existingBuild.rollupOptions ?? {}\n const existingExternal = existingRollupOptions.external ?? []\n\n const include = [\n // Anything the user already had\n ...(Array.isArray(existingCommonjs.include)\n ? existingCommonjs.include\n : existingCommonjs.include\n ? [existingCommonjs.include]\n : []),\n // Always process node_modules and the SDK dist so require() is transformed\n /node_modules/,\n /seed-protocol-sdk[\\\\/]+dist[\\\\/]/,\n ]\n\n // Exclude packages that are already ESM or have special worker handling\n const exclude = [\n ...(Array.isArray(existingCommonjs.exclude)\n ? existingCommonjs.exclude\n : existingCommonjs.exclude\n ? [existingCommonjs.exclude]\n : []),\n // sqlocal is ESM and uses workers - don't transform it\n /node_modules[\\\\/]+sqlocal[\\\\/]/,\n ]\n\n const commonjsOptions = {\n ...existingCommonjs,\n include,\n exclude,\n transformMixedEsModules: true,\n }\n\n // Externalize Node.js-only dev/build tools that should never be bundled\n // These are build-time tools, not runtime dependencies\n const nodeOnlyPackages = [\n 'drizzle-kit',\n 'better-sqlite3', // Native SQLite binding (Node.js only)\n // Database drivers that drizzle-kit dynamically imports (should not be bundled)\n '@electric-sql/pglite',\n 'pg',\n 'postgres',\n '@vercel/postgres',\n '@neondatabase/serverless',\n 'mysql2',\n 'mysql2/promise',\n '@planetscale/database',\n ]\n\n const isNodeOnlyExternal = (id: string) =>\n nodeOnlyPackages.some(\n (pkg) =>\n id === pkg ||\n id.startsWith(`${pkg}/`) ||\n id.includes(`/${pkg}/`) ||\n id.endsWith(`/${pkg}`)\n )\n\n const externalList = (id: string, importer?: string, isResolved?: boolean) => {\n if (isNodeOnlyExternal(id)) return true\n if (typeof existingExternal === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (existingExternal as any)(id, importer, isResolved ?? false)\n }\n if (Array.isArray(existingExternal)) {\n return existingExternal.some((ext) => ext === id || id.startsWith(`${ext}/`))\n }\n return false\n }\n\n const rollupOptions = {\n ...existingRollupOptions,\n external: externalList,\n }\n\n const build = {\n ...existingBuild,\n commonjsOptions,\n rollupOptions,\n }\n\n // Worker options are TOP-LEVEL in Vite config, not under build.\n // Default 'iife' breaks when workers use code-splitting (e.g. sqlocal).\n const existingWorker = userConfig.worker ?? {}\n const worker = {\n ...existingWorker,\n format: existingWorker.format ?? 'es',\n }\n\n return {\n build,\n worker,\n }\n },\n\n transformIndexHtml(html) {\n if (!autoInit) return html\n\n const initScript = `\n<script type=\"module\">\nimport { configure } from '@zenfs/core';\nimport { IndexedDB } from '@zenfs/dom';\n\nif (!window.__seedFsReady) {\n window.__seedFsReady = configure({\n mounts: { '/': IndexedDB },\n }).catch((err) => {\n console.error('[seed-vite-plugin] ZenFS initialization failed', err);\n });\n}\n</script>`\n\n if (html.includes('</head>')) {\n return html.replace('</head>', `${initScript}\\n</head>`)\n }\n\n return html + initScript\n },\n }\n\n const plugins: Plugin[] = [configPlugin, mainPlugin]\n\n if (includeNodePolyfills) {\n log('Including vite-plugin-node-polyfills with default settings')\n plugins.push(\n nodePolyfills({\n // Let fs be handled by @zenfs/core instead of polyfills\n exclude: ['readline',],\n // Common set of browser-friendly polyfills used by many deps\n include: ['path', 'crypto', 'stream', 'util', 'buffer', 'events', 'string_decoder',],\n globals: {\n Buffer: true,\n global: true,\n process: true,\n },\n protocolImports: true,\n }) as unknown as Plugin,\n )\n }\n\n return plugins\n}\n"],"names":[],"mappings":";;AAkCA,MAAM,kBAAkB,GAAG;IACzB,IAAI;IACJ,aAAa;IACb,SAAS;IACT,kBAAkB;CACnB;AAED;;;;;;;;;;;;;;;;;AAiBG;AACG,SAAU,cAAc,CAAC,OAAA,GAAiC,EAAE,EAAA;AAChE,IAAA,MAAM,EACJ,SAAS,GAAG,kBAAkB,EAC9B,QAAQ,GAAG,KAAK,EAChB,KAAK,GAAG,KAAK,EACb,oBAAoB,GAAG,IAAI,GAC5B,GAAG,OAAO;AAEX,IAAA,MAAM,GAAG,GAAG,CAAC,GAAG,IAAe,KAAI;AACjC,QAAA,IAAI,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,GAAG,IAAI,CAAC;AACvD,IAAA,CAAC;AAED;;AAEG;AACH,IAAA,MAAM,YAAY,GAAW;AAC3B,QAAA,IAAI,EAAE,sBAAsB;AAC5B,QAAA,OAAO,EAAE,KAAK;AAEd,QAAA,MAAM,CAAC,UAAU,EAAA;AACf,YAAA,MAAM,KAAK,GAA2B;;;aAGrC;AAED,YAAA,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE;gBAC3B,MAAM,UAAU,GAAG,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAC3C,MAAM,MAAM,GAAG,UAAU,GAAG,sBAAsB,GAAG,aAAa;AAClE,gBAAA,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM;YACrB;;AAGA,YAAA,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,EAAE,KAAK;AAC/C,YAAA,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;AAChC,gBAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AAChD,oBA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A,OAAO,EAAE;AACP,gBAAA,MAAM,EAAE,IAAI;AACZ,gBAAA,MAAM,EAAE,IAAI;AACZ,gBAAA,OAAO,EAAE,IAAI;AACd,aAAA;AACD,YAAA,eAAe,EAAE,IAAI;AACtB,SAAA,CAAsB,CACxB;IACH;AAEA,IAAA,OAAO,OAAO;AAChB;;;;"}
1
+ {"version":3,"file":"vite.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seedprotocol/sdk",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "The SDK for Seed Protocol",
5
5
  "type": "module",
6
6
  "main": "./dist/main.cjs",
@@ -29,8 +29,8 @@
29
29
  "test:watch": "vitest",
30
30
  "compile": "graphql-codegen --config codegen.ts",
31
31
  "watch": "graphql-codegen -w",
32
- "build:dev": "node scripts/build-with-tests.js \"rm -rf dist && NODE_ENV=production rollup -c && node scripts/check-dist-no-alias.js && tsc -p tsconfig.declarations.json\"",
33
- "build:publish": "node scripts/build-with-tests.js \"bun run sync-versions && rm -rf dist && NODE_ENV=production rollup -c && node scripts/check-dist-no-alias.js && tsc -p tsconfig.declarations.json && npm publish --access public\"",
32
+ "build:dev": "node scripts/build-with-tests.js \"rm -rf dist && NODE_ENV=production rollup -c && node scripts/check-dist-no-alias.js && node scripts/check-dist-fragile-dynamic-imports.js --fail && tsc -p tsconfig.declarations.json\"",
33
+ "build:publish": "node scripts/build-with-tests.js \"bun run sync-versions && rm -rf dist && NODE_ENV=production rollup -c && node scripts/check-dist-no-alias.js && node scripts/check-dist-fragile-dynamic-imports.js --fail && tsc -p tsconfig.declarations.json && npm publish --access public\"",
34
34
  "build:cli": "node scripts/build-with-tests.js \"cd packages/cli && bun run build\"",
35
35
  "build:all": "node scripts/build-with-tests.js \"bun run sync-versions && bun run build && bun run build:cli\"",
36
36
  "sync-versions": "node scripts/sync-versions.js",
@@ -41,7 +41,8 @@
41
41
  "cli:init": "tsx packages/cli/src/bin.ts init",
42
42
  "cli:export-sql": "tsx packages/cli/src/bin.ts export-sql",
43
43
  "cli:seed": "tsx packages/cli/src/bin.ts seed",
44
- "drizzle:track": "tsx scripts/track-drizzle-changes.ts"
44
+ "drizzle:track": "tsx scripts/track-drizzle-changes.ts",
45
+ "check:dist:fragile": "node scripts/check-dist-fragile-dynamic-imports.js"
45
46
  },
46
47
  "author": "Keith Axline <keith@journodao.xyz>",
47
48
  "license": "MIT",
@@ -219,6 +220,9 @@
219
220
  },
220
221
  "./package.json": "./package.json"
221
222
  },
223
+ "overrides": {
224
+ "@tanstack/query-core": "5.90.15"
225
+ },
222
226
  "trustedDependencies": [
223
227
  "protobufjs"
224
228
  ],
@@ -1 +0,0 @@
1
- {"version":3,"file":"ArweaveClient-CczHvccG.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\nlet _arweaveInstance: Arweave | null = null;\n\n/**\n * Get or create the Arweave instance for Node.js\n */\nconst getArweaveInstance = (): Arweave => {\n if (_arweaveInstance) {\n return _arweaveInstance;\n }\n\n const host = BaseArweaveClient.getHost();\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: 'https',\n });\n } else {\n _arweaveInstance = Arweave.init({\n host,\n protocol: 'https',\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 const data = await response.json();\n return {\n status: 200,\n confirmed: {\n block_height: data.block_height,\n block_indep_hash: data.block_indep_hash,\n number_of_confirmations: data.number_of_confirmations,\n },\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 host = BaseArweaveClient.getHost();\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 = `https://${host}/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;AAE3C;;AAEG;AACH,MAAM,kBAAkB,GAAG,MAAc;IACvC,IAAI,gBAAgB,EAAE;AACpB,QAAA,OAAO,gBAAgB;IACzB;AAEA,IAAA,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,EAAE;;AAGxC,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;AAC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;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 +0,0 @@
1
- {"version":3,"file":"ArweaveClient-DkNLWiSZ.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\nlet _arweaveInstance: Arweave | null = null;\n\n/**\n * Get or create the Arweave instance for browser\n */\nconst getArweaveInstance = (): Arweave => {\n if (_arweaveInstance) {\n return _arweaveInstance;\n }\n\n const host = BaseArweaveClient.getHost();\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: \"https\",\n });\n } else {\n _arweaveInstance = Arweave.init({\n host,\n protocol: \"https\",\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 const data = await response.json();\n return {\n status: 200,\n confirmed: {\n block_height: data.block_height,\n block_indep_hash: data.block_indep_hash,\n number_of_confirmations: data.number_of_confirmations,\n },\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 host = BaseArweaveClient.getHost();\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 = `https://${host}/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(Ar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