@seedprotocol/sdk 0.3.10 → 0.3.12

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 (232) hide show
  1. package/dist/addModel.js +0 -0
  2. package/dist/bin.js +8 -6
  3. package/dist/bin.js.map +1 -1
  4. package/dist/main.js +4 -3
  5. package/dist/main.js.map +1 -1
  6. package/dist/node/db/node.app.db.config.ts +4 -1
  7. package/dist/protos/seed.proto +97 -0
  8. package/dist/rpcServer.js +399 -0
  9. package/dist/rpcServer.js.map +1 -0
  10. package/dist/scripts/bin.d.ts.map +1 -1
  11. package/dist/scripts/rpcServer.cursor.d.ts +2 -0
  12. package/dist/scripts/rpcServer.cursor.d.ts.map +1 -0
  13. package/dist/scripts/rpcServer.d.ts +9 -0
  14. package/dist/scripts/rpcServer.d.ts.map +1 -0
  15. package/dist/scripts/vite.config.d.ts +3 -0
  16. package/dist/scripts/vite.config.d.ts.map +1 -0
  17. package/dist/seedSchema/AppStateSchema.ts +2 -2
  18. package/dist/seedSchema/MetadataSchema.ts +2 -1
  19. package/dist/seedSchema/ModelSchema.ts +3 -3
  20. package/dist/seedSchema/SeedSchema.ts +2 -1
  21. package/dist/seedSchema/VersionSchema.ts +2 -1
  22. package/dist/seedSchema/index.ts +4 -3
  23. package/dist/src/Item/BaseItem.d.ts +1 -1
  24. package/dist/src/Item/BaseItem.d.ts.map +1 -1
  25. package/dist/src/Item/BaseItem.js.map +1 -1
  26. package/dist/src/ItemProperty/BaseItemProperty.d.ts +55 -192
  27. package/dist/src/ItemProperty/BaseItemProperty.d.ts.map +1 -1
  28. package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts +2 -1
  29. package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
  30. package/dist/src/ItemProperty/service/actors/hydrateFromDb.js +4 -3
  31. package/dist/src/ItemProperty/service/actors/hydrateFromDb.js.map +1 -1
  32. package/dist/src/ItemProperty/service/actors/initialize.d.ts +2 -1
  33. package/dist/src/ItemProperty/service/actors/initialize.d.ts.map +1 -1
  34. package/dist/src/ItemProperty/service/actors/resolveRelatedValue.d.ts +2 -1
  35. package/dist/src/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
  36. package/dist/src/ItemProperty/service/actors/resolveRemoteStorage.d.ts +2 -1
  37. package/dist/src/ItemProperty/service/actors/resolveRemoteStorage.d.ts.map +1 -1
  38. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts +2 -2
  39. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
  40. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts +2 -2
  41. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +1 -1
  42. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts +2 -2
  43. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -1
  44. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.js +4 -3
  45. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.js.map +1 -1
  46. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts +2 -2
  47. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +1 -1
  48. package/dist/src/ItemProperty/service/actors/waitForDb.d.ts +2 -2
  49. package/dist/src/ItemProperty/service/actors/waitForDb.d.ts.map +1 -1
  50. package/dist/src/ItemProperty/service/propertyMachine.d.ts +60 -195
  51. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  52. package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
  53. package/dist/src/browser/helpers/ArweaveClient.js +0 -1
  54. package/dist/src/browser/helpers/ArweaveClient.js.map +1 -1
  55. package/dist/src/browser/helpers/EasClient.d.ts.map +1 -1
  56. package/dist/src/browser/react/services.d.ts +1 -1
  57. package/dist/src/browser/react/services.js +4 -3
  58. package/dist/src/browser/react/services.js.map +1 -1
  59. package/dist/src/client/ClientManager.d.ts +14 -14
  60. package/dist/src/client/ClientManager.js +4 -3
  61. package/dist/src/client/ClientManager.js.map +1 -1
  62. package/dist/src/client/actors/initialize.d.ts +1 -1
  63. package/dist/src/client/actors/initialize.d.ts.map +1 -1
  64. package/dist/src/client/actors/initialize.js +54 -15
  65. package/dist/src/client/actors/initialize.js.map +1 -1
  66. package/dist/src/client/actors/saveAppState.js +4 -3
  67. package/dist/src/client/actors/saveAppState.js.map +1 -1
  68. package/dist/src/client/clientManagerMachine.d.ts +7 -7
  69. package/dist/src/client/index.d.ts +1 -1
  70. package/dist/src/client/index.d.ts.map +1 -1
  71. package/dist/src/db/Db/BaseDb.d.ts +2 -1
  72. package/dist/src/db/Db/BaseDb.d.ts.map +1 -1
  73. package/dist/src/db/Db/BaseDb.js +3 -0
  74. package/dist/src/db/Db/BaseDb.js.map +1 -1
  75. package/dist/src/db/read/getExistingItem.js +4 -3
  76. package/dist/src/db/read/getExistingItem.js.map +1 -1
  77. package/dist/src/db/read/getItemData.js +4 -3
  78. package/dist/src/db/read/getItemData.js.map +1 -1
  79. package/dist/src/db/read/getItemProperties.js +4 -3
  80. package/dist/src/db/read/getItemProperties.js.map +1 -1
  81. package/dist/src/db/read/getItemProperty.js +4 -3
  82. package/dist/src/db/read/getItemProperty.js.map +1 -1
  83. package/dist/src/db/read/getItems.js +4 -3
  84. package/dist/src/db/read/getItems.js.map +1 -1
  85. package/dist/src/db/read/getMetadata.js +4 -3
  86. package/dist/src/db/read/getMetadata.js.map +1 -1
  87. package/dist/src/db/read/getModelSchemas.js +4 -3
  88. package/dist/src/db/read/getModelSchemas.js.map +1 -1
  89. package/dist/src/db/read/getModels.js +4 -3
  90. package/dist/src/db/read/getModels.js.map +1 -1
  91. package/dist/src/db/read/getPropertyData.js +4 -3
  92. package/dist/src/db/read/getPropertyData.js.map +1 -1
  93. package/dist/src/db/read/getRelationValueData.js +4 -3
  94. package/dist/src/db/read/getRelationValueData.js.map +1 -1
  95. package/dist/src/db/read/getSeedData.js +4 -3
  96. package/dist/src/db/read/getSeedData.js.map +1 -1
  97. package/dist/src/db/read/getStorageTransactionIdForSeedUid.js +4 -3
  98. package/dist/src/db/read/getStorageTransactionIdForSeedUid.js.map +1 -1
  99. package/dist/src/db/read/getVersionData.js +4 -3
  100. package/dist/src/db/read/getVersionData.js.map +1 -1
  101. package/dist/src/db/read/subqueries/metadataLatest.js +4 -3
  102. package/dist/src/db/read/subqueries/metadataLatest.js.map +1 -1
  103. package/dist/src/db/read/subqueries/versionData.js +4 -3
  104. package/dist/src/db/read/subqueries/versionData.js.map +1 -1
  105. package/dist/src/db/write/createMetadata.js +4 -3
  106. package/dist/src/db/write/createMetadata.js.map +1 -1
  107. package/dist/src/db/write/createSeed.js +4 -3
  108. package/dist/src/db/write/createSeed.js.map +1 -1
  109. package/dist/src/db/write/createSeeds.js +4 -3
  110. package/dist/src/db/write/createSeeds.js.map +1 -1
  111. package/dist/src/db/write/createVersion.js +4 -3
  112. package/dist/src/db/write/createVersion.js.map +1 -1
  113. package/dist/src/db/write/deleteItem.js +4 -3
  114. package/dist/src/db/write/deleteItem.js.map +1 -1
  115. package/dist/src/db/write/saveAppState.js +4 -3
  116. package/dist/src/db/write/saveAppState.js.map +1 -1
  117. package/dist/src/db/write/saveMetadata.js +4 -3
  118. package/dist/src/db/write/saveMetadata.js.map +1 -1
  119. package/dist/src/db/write/updateItemPropertyValue.js +4 -3
  120. package/dist/src/db/write/updateItemPropertyValue.js.map +1 -1
  121. package/dist/src/db/write/updateMetadata.js +4 -3
  122. package/dist/src/db/write/updateMetadata.js.map +1 -1
  123. package/dist/src/events/files/download.js +4 -3
  124. package/dist/src/events/files/download.js.map +1 -1
  125. package/dist/src/events/item/syncDbWithEas.js +4 -3
  126. package/dist/src/events/item/syncDbWithEas.js.map +1 -1
  127. package/dist/src/helpers/FileManager/BaseFileManager.d.ts +4 -1
  128. package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
  129. package/dist/src/helpers/FileManager/BaseFileManager.js +9 -0
  130. package/dist/src/helpers/FileManager/BaseFileManager.js.map +1 -1
  131. package/dist/src/helpers/db.js +4 -3
  132. package/dist/src/helpers/db.js.map +1 -1
  133. package/dist/src/helpers/environment.js +6 -1
  134. package/dist/src/helpers/environment.js.map +1 -1
  135. package/dist/src/helpers/index.d.ts +8 -0
  136. package/dist/src/helpers/index.d.ts.map +1 -1
  137. package/dist/src/helpers/index.js +2 -1
  138. package/dist/src/helpers/index.js.map +1 -1
  139. package/dist/src/interfaces/IItem.d.ts +1 -1
  140. package/dist/src/interfaces/IItem.d.ts.map +1 -1
  141. package/dist/src/node/Item/Item.js +11 -0
  142. package/dist/src/node/Item/Item.js.map +1 -0
  143. package/dist/src/node/ItemProperty/ItemProperty.js +10 -0
  144. package/dist/src/node/ItemProperty/ItemProperty.js.map +1 -0
  145. package/dist/src/node/PathResolver.d.ts +2 -11
  146. package/dist/src/node/PathResolver.d.ts.map +1 -1
  147. package/dist/src/node/PathResolver.js +12 -5
  148. package/dist/src/node/PathResolver.js.map +1 -1
  149. package/dist/src/node/db/Db.d.ts.map +1 -1
  150. package/dist/src/node/db/Db.js +72 -0
  151. package/dist/src/node/db/Db.js.map +1 -0
  152. package/dist/src/node/db/node.app.db.config.d.ts.map +1 -1
  153. package/dist/src/node/helpers/ArweaveClient.d.ts.map +1 -1
  154. package/dist/src/node/helpers/ArweaveClient.js +0 -1
  155. package/dist/src/node/helpers/ArweaveClient.js.map +1 -1
  156. package/dist/src/node/helpers/EasClient.d.ts.map +1 -1
  157. package/dist/src/node/helpers/FileManager.d.ts +4 -0
  158. package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
  159. package/dist/src/node/helpers/FileManager.js +67 -0
  160. package/dist/src/node/helpers/FileManager.js.map +1 -0
  161. package/dist/src/seedSchema/AppStateSchema.d.ts +2 -1
  162. package/dist/src/seedSchema/AppStateSchema.d.ts.map +1 -1
  163. package/dist/src/seedSchema/AppStateSchema.js.map +1 -1
  164. package/dist/src/seedSchema/MetadataSchema.d.ts +2 -1
  165. package/dist/src/seedSchema/MetadataSchema.d.ts.map +1 -1
  166. package/dist/src/seedSchema/MetadataSchema.js.map +1 -1
  167. package/dist/src/seedSchema/ModelSchema.d.ts +3 -2
  168. package/dist/src/seedSchema/ModelSchema.d.ts.map +1 -1
  169. package/dist/src/seedSchema/ModelSchema.js.map +1 -1
  170. package/dist/src/seedSchema/PropertyUidSchema.js +18 -0
  171. package/dist/src/seedSchema/PropertyUidSchema.js.map +1 -0
  172. package/dist/src/seedSchema/SeedSchema.d.ts +2 -1
  173. package/dist/src/seedSchema/SeedSchema.d.ts.map +1 -1
  174. package/dist/src/seedSchema/SeedSchema.js.map +1 -1
  175. package/dist/src/seedSchema/VersionSchema.d.ts +2 -1
  176. package/dist/src/seedSchema/VersionSchema.d.ts.map +1 -1
  177. package/dist/src/seedSchema/VersionSchema.js.map +1 -1
  178. package/dist/src/seedSchema/index.d.ts +4 -3
  179. package/dist/src/seedSchema/index.d.ts.map +1 -1
  180. package/dist/src/services/allItems/actors/fetchRelatedItems.js +4 -3
  181. package/dist/src/services/allItems/actors/fetchRelatedItems.js.map +1 -1
  182. package/dist/src/services/allItems/actors/initialize.js +4 -3
  183. package/dist/src/services/allItems/actors/initialize.js.map +1 -1
  184. package/dist/src/services/db/actors/checkStatus.d.ts.map +1 -1
  185. package/dist/src/services/db/actors/checkStatus.js +9 -3
  186. package/dist/src/services/db/actors/checkStatus.js.map +1 -1
  187. package/dist/src/services/db/actors/migrate.d.ts.map +1 -1
  188. package/dist/src/services/db/actors/migrate.js +9 -2
  189. package/dist/src/services/db/actors/migrate.js.map +1 -1
  190. package/dist/src/services/db/actors/waitForFiles.d.ts.map +1 -1
  191. package/dist/src/services/db/actors/waitForFiles.js +3 -1
  192. package/dist/src/services/db/actors/waitForFiles.js.map +1 -1
  193. package/dist/src/services/db/dbMachine.d.ts.map +1 -1
  194. package/dist/src/services/db/dbMachine.js +1 -0
  195. package/dist/src/services/db/dbMachine.js.map +1 -1
  196. package/dist/src/services/global/actors/addModelsToDb.js +4 -3
  197. package/dist/src/services/global/actors/addModelsToDb.js.map +1 -1
  198. package/dist/src/services/global/actors/initialize.d.ts +6 -1
  199. package/dist/src/services/global/actors/initialize.d.ts.map +1 -1
  200. package/dist/src/services/global/actors/initialize.js +6 -4
  201. package/dist/src/services/global/actors/initialize.js.map +1 -1
  202. package/dist/src/services/global/globalMachine.d.ts +80 -611
  203. package/dist/src/services/global/globalMachine.d.ts.map +1 -1
  204. package/dist/src/services/internal/actors/loadAppDb.d.ts.map +1 -1
  205. package/dist/src/services/internal/actors/loadAppDb.js +2 -1
  206. package/dist/src/services/internal/actors/loadAppDb.js.map +1 -1
  207. package/dist/src/services/internal/actors/saveConfig.d.ts.map +1 -1
  208. package/dist/src/services/internal/actors/saveConfig.js +5 -16
  209. package/dist/src/services/internal/actors/saveConfig.js.map +1 -1
  210. package/dist/src/services/internal/actors/validateInput.d.ts +9 -2
  211. package/dist/src/services/internal/actors/validateInput.d.ts.map +1 -1
  212. package/dist/src/services/internal/actors/validateInput.js +4 -1
  213. package/dist/src/services/internal/actors/validateInput.js.map +1 -1
  214. package/dist/src/services/internal/internalMachine.d.ts +33 -3
  215. package/dist/src/services/internal/internalMachine.d.ts.map +1 -1
  216. package/dist/src/services/internal/internalMachine.js +9 -5
  217. package/dist/src/services/internal/internalMachine.js.map +1 -1
  218. package/dist/src/services/publish/actors/preparePublishRequestData.js +4 -3
  219. package/dist/src/services/publish/actors/preparePublishRequestData.js.map +1 -1
  220. package/dist/src/types/fileManager.d.ts +13 -0
  221. package/dist/src/types/fileManager.d.ts.map +1 -1
  222. package/dist/src/types/item.d.ts +9 -8
  223. package/dist/src/types/item.d.ts.map +1 -1
  224. package/dist/src/types/machines.d.ts.map +1 -1
  225. package/package.json +9 -4
  226. package/dist/seedSchema/ConfigSchema.ts +0 -15
  227. package/dist/src/node/helpers/EasClient.js +0 -13
  228. package/dist/src/node/helpers/EasClient.js.map +0 -1
  229. package/dist/src/seedSchema/ConfigSchema.d.ts +0 -97
  230. package/dist/src/seedSchema/ConfigSchema.d.ts.map +0 -1
  231. package/dist/src/seedSchema/ConfigSchema.js +0 -18
  232. package/dist/src/seedSchema/ConfigSchema.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/helpers/index.ts"],"sourcesContent":["import { customAlphabet } from 'nanoid'\nimport { Message, sha3_256, } from 'js-sha3'\nimport * as nanoIdDictionary from 'nanoid-dictionary'\nimport debug from 'debug'\nimport { GetCorrectId } from '@/types/helpers'\nimport { GetCorrectIdReturn } from '@/types/helpers'\nimport { BaseFileManager } from './FileManager/BaseFileManager'\nexport * from './ArweaveClient/BaseArweaveClient'\nexport * from './EasClient/BaseEasClient'\nexport * from './QueryClient/BaseQueryClient'\nexport * from './FileManager/BaseFileManager'\nconst logger = debug('seedSdk:shared:helpers')\n\n\nconst { alphanumeric } = nanoIdDictionary\n\nexport const generateId = (): string => {\n return customAlphabet(alphanumeric, 10)()\n}\n\nexport const toSnakeCase = (str: string) => {\n return str.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase()\n}\n\nexport const identifyString = (str: string) => {\n try {\n JSON.parse(str)\n return 'json'\n } catch (e) {\n // Not JSON\n }\n\n if (!str) {\n return\n }\n\n if (str.trim().startsWith('<') && str.trim().endsWith('>')) {\n return 'html'\n }\n\n // Simple markdown checks (very naive)\n if (/^#{1,6}\\s|^-{3,}|\\*{3,}|^-{1,2}\\s|\\*\\s/.test(str)) {\n return 'markdown'\n }\n\n if (/^data:image\\/[a-zA-Z]+;base64,[A-Za-z0-9+/]+={0,2}$/.test(str)) {\n return 'base64'\n }\n\n // Default to plain text if unsure\n return 'text'\n}\n\nexport const getMimeType = (base64: string) => {\n if (!base64) {\n return null\n }\n const result = base64.match(/^data:([a-zA-Z0-9]+\\/[a-zA-Z0-9-.+]+).*,/)\n\n if (result && result.length > 1) {\n return result[1]\n } else {\n return null // MIME type could not be determined\n }\n}\n\nexport const getCorrectId: GetCorrectId = (localIdOrUid: string) => {\n const id: GetCorrectIdReturn = {\n localId: undefined,\n uid: undefined,\n }\n if (!localIdOrUid) {\n return id\n }\n if (localIdOrUid.length === 10) {\n id.localId = localIdOrUid\n }\n if (localIdOrUid.startsWith('0x') && localIdOrUid.length === 66) {\n id.uid = localIdOrUid\n }\n return id\n}\n\nexport const getDataTypeFromString = (\n data: string,\n): 'imageBase64' | 'base64' | 'url' | null => {\n const nonImageBase64Regex =\n /^(?!data:image\\/(?:jpeg|png|gif|bmp|webp);base64,)[A-Za-z0-9+/=]+$/\n\n if (nonImageBase64Regex.test(data)) {\n return 'base64'\n }\n\n // Regular expression for base64 (simple version, checking for base64 format)\n const imageBase64Regex = /^data:image\\/[a-zA-Z]+;base64,[A-Za-z0-9+/]+={0,2}$/\n\n if (imageBase64Regex.test(data)) {\n return 'imageBase64'\n }\n\n // Regular expression for URL (simple version, checking for common URL format)\n const urlRegex =\n /^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$/\n\n if (urlRegex.test(data)) {\n return 'url'\n }\n\n return null\n}\n\nexport const convertTxIdToImage = async (\n txId: string,\n): Promise<string | undefined> => {\n const imageFilePath = `/files/images/${txId}`\n const fileExists = await BaseFileManager.pathExists(imageFilePath)\n if (!fileExists) {\n logger(`[ItemView] [updateImage] ${imageFilePath} does not exist`)\n return\n }\n const buffer = await BaseFileManager.readFileAsBuffer(imageFilePath)\n\n const uint = new Uint8Array(buffer)\n\n const imageBlob = new Blob([uint])\n\n return URL.createObjectURL(imageBlob)\n}\n\nexport const getExecutionTime = async (task, args) => {\n const start = Date.now()\n await task(...args)\n return Date.now() - start\n}\n\nexport const capitalizeFirstLetter = (string: string) =>\n string.charAt(0).toUpperCase() + string.slice(1)\n\nexport const parseEasRelationPropertyName = (easPropertyName: string) => {\n // Split the input string on the first underscore\n const [singularProperty, modelName, idSegment] = easPropertyName.split('_')\n\n // If there are any other parts, assume it is a list (e.g., has 'ids' or other suffix)\n const isList = idSegment === 'ids'\n\n // Create the final property name by pluralizing the singular part\n const propertyName = singularProperty.endsWith('s')\n ? singularProperty\n : singularProperty + 's'\n\n return {\n propertyName, // Plural form of the property name\n modelName, // Model name extracted from the second part\n isList, // True if the property is a list (e.g., 'ids' is present)\n }\n}\n\nexport const getContentHash = async (\n data: Message\n): Promise<string> => {\n return sha3_256(data)\n}\n\n// export const getContentHash = async (\n// base64: string | null | undefined,\n// uint: Uint8Array | undefined,\n// ): Promise<string> => {\n// let data\n\n// if (base64 && !uint) {\n// const encoder = new TextEncoder()\n// data = encoder.encode(base64)\n// }\n\n// if (uint) {\n// data = uint\n// }\n\n// // Hash the data with SHA-256\n// const hashBuffer = await crypto.subtle.digest('SHA-256', data as Uint8Array)\n\n// // Convert the ArrayBuffer to a hex string\n// const hashArray = Array.from(new Uint8Array(hashBuffer))\n// return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('')\n// }\n\nexport const isBinary = (arrayBuffer: ArrayBuffer): boolean => {\n const view = new Uint8Array(arrayBuffer);\n\n let nonTextCount = 0;\n const threshold = 0.2; // Adjust as needed (e.g., 20% non-text implies binary)\n\n for (let i = 0; i < view.length; i++) {\n const byte = view[i];\n\n // ASCII printable characters (32-126) and common whitespace (9, 10, 13)\n if (\n (byte >= 32 && byte <= 126) || // Printable ASCII\n byte === 9 || byte === 10 || byte === 13 // Tab, LF, CR\n ) {\n continue;\n }\n\n nonTextCount++;\n if (nonTextCount / view.length > threshold) {\n return true; // More than threshold are non-text bytes\n }\n }\n\n return false; // Fewer than threshold are non-text bytes\n}\n"],"names":[],"mappings":";;;;;;;;AAWA,MAAM,MAAM,GAAG,KAAK,CAAC,wBAAwB,CAAC;AAG9C,MAAM,EAAE,YAAY,EAAE,GAAG,gBAAgB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"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/helpers/index.ts"],"sourcesContent":["import { customAlphabet } from 'nanoid'\nimport * as sha3 from 'js-sha3'\nimport { Message } from 'js-sha3'\nimport * as nanoIdDictionary from 'nanoid-dictionary'\nimport debug from 'debug'\nimport { GetCorrectId } from '@/types/helpers'\nimport { GetCorrectIdReturn } from '@/types/helpers'\nimport { BaseFileManager } from './FileManager/BaseFileManager'\nexport * from './ArweaveClient/BaseArweaveClient'\nexport * from './EasClient/BaseEasClient'\nexport * from './QueryClient/BaseQueryClient'\nexport * from './FileManager/BaseFileManager'\nconst logger = debug('seedSdk:shared:helpers')\n\nconst { sha3_256, } = sha3\n\nconst { alphanumeric } = nanoIdDictionary\n\nexport const generateId = (): string => {\n return customAlphabet(alphanumeric, 10)()\n}\n\nexport const toSnakeCase = (str: string) => {\n return str.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase()\n}\n\n/**\n * Utility function to get __filename and __dirname from import.meta.url\n * without using the url or path modules\n */\nexport const getFileInfo = (importMetaUrl: string) => {\n // Extract the full path from import.meta.url\n // Remove the 'file://' protocol prefix\n const fullPath = importMetaUrl.replace(/^file:\\/\\//, '');\n \n // For Windows paths that might start with a drive letter\n const normalizedPath = fullPath.startsWith('/') && /^\\/[A-Za-z]:/.test(fullPath) \n ? fullPath.slice(1) // Remove leading slash for Windows drive paths\n : fullPath;\n \n // Find the last slash to separate directory from filename\n const lastSlashIndex = normalizedPath.lastIndexOf('/');\n \n // Extract __dirname and __filename\n const __dirname = lastSlashIndex !== -1 \n ? normalizedPath.slice(0, lastSlashIndex) \n : '.';\n const __filename = lastSlashIndex !== -1 \n ? normalizedPath.slice(lastSlashIndex + 1) \n : normalizedPath;\n \n return { __dirname, __filename };\n}\n\nexport const identifyString = (str: string) => {\n try {\n JSON.parse(str)\n return 'json'\n } catch (e) {\n // Not JSON\n }\n\n if (!str) {\n return\n }\n\n if (str.trim().startsWith('<') && str.trim().endsWith('>')) {\n return 'html'\n }\n\n // Simple markdown checks (very naive)\n if (/^#{1,6}\\s|^-{3,}|\\*{3,}|^-{1,2}\\s|\\*\\s/.test(str)) {\n return 'markdown'\n }\n\n if (/^data:image\\/[a-zA-Z]+;base64,[A-Za-z0-9+/]+={0,2}$/.test(str)) {\n return 'base64'\n }\n\n // Default to plain text if unsure\n return 'text'\n}\n\nexport const getMimeType = (base64: string) => {\n if (!base64) {\n return null\n }\n const result = base64.match(/^data:([a-zA-Z0-9]+\\/[a-zA-Z0-9-.+]+).*,/)\n\n if (result && result.length > 1) {\n return result[1]\n } else {\n return null // MIME type could not be determined\n }\n}\n\nexport const getCorrectId: GetCorrectId = (localIdOrUid: string) => {\n const id: GetCorrectIdReturn = {\n localId: undefined,\n uid: undefined,\n }\n if (!localIdOrUid) {\n return id\n }\n if (localIdOrUid.length === 10) {\n id.localId = localIdOrUid\n }\n if (localIdOrUid.startsWith('0x') && localIdOrUid.length === 66) {\n id.uid = localIdOrUid\n }\n return id\n}\n\nexport const getDataTypeFromString = (\n data: string,\n): 'imageBase64' | 'base64' | 'url' | null => {\n const nonImageBase64Regex =\n /^(?!data:image\\/(?:jpeg|png|gif|bmp|webp);base64,)[A-Za-z0-9+/=]+$/\n\n if (nonImageBase64Regex.test(data)) {\n return 'base64'\n }\n\n // Regular expression for base64 (simple version, checking for base64 format)\n const imageBase64Regex = /^data:image\\/[a-zA-Z]+;base64,[A-Za-z0-9+/]+={0,2}$/\n\n if (imageBase64Regex.test(data)) {\n return 'imageBase64'\n }\n\n // Regular expression for URL (simple version, checking for common URL format)\n const urlRegex =\n /^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$/\n\n if (urlRegex.test(data)) {\n return 'url'\n }\n\n return null\n}\n\nexport const convertTxIdToImage = async (\n txId: string,\n): Promise<string | undefined> => {\n const imageFilePath = `/files/images/${txId}`\n const fileExists = await BaseFileManager.pathExists(imageFilePath)\n if (!fileExists) {\n logger(`[ItemView] [updateImage] ${imageFilePath} does not exist`)\n return\n }\n const buffer = await BaseFileManager.readFileAsBuffer(imageFilePath)\n\n const uint = new Uint8Array(buffer)\n\n const imageBlob = new Blob([uint])\n\n return URL.createObjectURL(imageBlob)\n}\n\nexport const getExecutionTime = async (task, args) => {\n const start = Date.now()\n await task(...args)\n return Date.now() - start\n}\n\nexport const capitalizeFirstLetter = (string: string) =>\n string.charAt(0).toUpperCase() + string.slice(1)\n\nexport const parseEasRelationPropertyName = (easPropertyName: string) => {\n // Split the input string on the first underscore\n const [singularProperty, modelName, idSegment] = easPropertyName.split('_')\n\n // If there are any other parts, assume it is a list (e.g., has 'ids' or other suffix)\n const isList = idSegment === 'ids'\n\n // Create the final property name by pluralizing the singular part\n const propertyName = singularProperty.endsWith('s')\n ? singularProperty\n : singularProperty + 's'\n\n return {\n propertyName, // Plural form of the property name\n modelName, // Model name extracted from the second part\n isList, // True if the property is a list (e.g., 'ids' is present)\n }\n}\n\nexport const getContentHash = async (\n data: Message\n): Promise<string> => {\n return sha3_256(data)\n}\n\n// export const getContentHash = async (\n// base64: string | null | undefined,\n// uint: Uint8Array | undefined,\n// ): Promise<string> => {\n// let data\n\n// if (base64 && !uint) {\n// const encoder = new TextEncoder()\n// data = encoder.encode(base64)\n// }\n\n// if (uint) {\n// data = uint\n// }\n\n// // Hash the data with SHA-256\n// const hashBuffer = await crypto.subtle.digest('SHA-256', data as Uint8Array)\n\n// // Convert the ArrayBuffer to a hex string\n// const hashArray = Array.from(new Uint8Array(hashBuffer))\n// return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('')\n// }\n\nexport const isBinary = (arrayBuffer: ArrayBuffer): boolean => {\n const view = new Uint8Array(arrayBuffer);\n\n let nonTextCount = 0;\n const threshold = 0.2; // Adjust as needed (e.g., 20% non-text implies binary)\n\n for (let i = 0; i < view.length; i++) {\n const byte = view[i];\n\n // ASCII printable characters (32-126) and common whitespace (9, 10, 13)\n if (\n (byte >= 32 && byte <= 126) || // Printable ASCII\n byte === 9 || byte === 10 || byte === 13 // Tab, LF, CR\n ) {\n continue;\n }\n\n nonTextCount++;\n if (nonTextCount / view.length > threshold) {\n return true; // More than threshold are non-text bytes\n }\n }\n\n return false; // Fewer than threshold are non-text bytes\n}\n"],"names":[],"mappings":";;;;;;;;AAYA,MAAM,MAAM,GAAG,KAAK,CAAC,wBAAwB,CAAC;AAE9C,MAAM,EAAE,QAAQ,GAAG,GAAG,IAAI;AAE1B,MAAM,EAAE,YAAY,EAAE,GAAG,gBAAgB;AAElC,MAAM,UAAU,GAAG,MAAa;AACrC,IAAA,OAAO,cAAc,CAAC,YAAY,EAAE,EAAE,CAAC,EAAE;AAC3C;AAEa,MAAA,WAAW,GAAG,CAAC,GAAW,KAAI;IACzC,OAAO,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE;AAC9D;AA2Da,MAAA,WAAW,GAAG,CAAC,MAAc,KAAI;IAC5C,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,OAAO,IAAI;;IAEb,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC;IAEvE,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;AAC/B,QAAA,OAAO,MAAM,CAAC,CAAC,CAAC;;SACX;QACL,OAAO,IAAI,CAAA;;AAEf;AAEa,MAAA,YAAY,GAAiB,CAAC,YAAoB,KAAI;AACjE,IAAA,MAAM,EAAE,GAAuB;AAC7B,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,GAAG,EAAE,SAAS;KACf;IACD,IAAI,CAAC,YAAY,EAAE;AACjB,QAAA,OAAO,EAAE;;AAEX,IAAA,IAAI,YAAY,CAAC,MAAM,KAAK,EAAE,EAAE;AAC9B,QAAA,EAAE,CAAC,OAAO,GAAG,YAAY;;AAE3B,IAAA,IAAI,YAAY,CAA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AAS,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC;;AAG3E,IAAA,MAAM,MAAM,GAAG,SAAS,KAAK,KAAK;;AAGlC,IAAA,MAAM,YAAY,GAAG,gBAAgB,CAAC,QAAQ,CAAC,GAAG;AAChD,UAAE;AACF,UAAE,gBAAgB,GAAG,GAAG;IAE1B,OAAO;AACL,QAAA,YAAY;AACZ,QAAA,SAAS;AACT,QAAA,MAAM;KACP;AACH;MAEa,cAAc,GAAG,OAC5B,IAAa,KACM;AACnB,IAAA,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { ActorRefFrom, Subscription } from 'xstate';
2
2
  import { ModelSchema, ModelValues, PropertyData } from '@/types';
3
- import { VersionsType } from '@/seedSchema/VersionSchema';
3
+ import { VersionsType } from '@/seedSchema';
4
4
  import { IItemProperty } from './IItemProperty';
5
5
  export interface IItem<T extends ModelValues<ModelSchema>> {
6
6
  subscribe(callback: (itemProps: any) => void): Subscription;
@@ -1 +1 @@
1
- {"version":3,"file":"IItem.d.ts","sourceRoot":"","sources":["../../../src/interfaces/IItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,WAAW,CAAC,WAAW,CAAC;IAEvD,SAAS,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,GAAG,KAAK,IAAI,GAAG,YAAY,CAAA;IAC3D,UAAU,IAAI,YAAY,CAAC,GAAG,CAAC,CAAA;IAC/B,mBAAmB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAAA;IAC9C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;IAC/B,mBAAmB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAAA;IAC9C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACxB,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA;IACjC,iBAAiB,CAAC,oBAAoB,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;IAC5D,MAAM,IAAI,IAAI,CAAA;IAEd,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,YAAY,CAAA;IACvC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAA;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,CAAA;IACvD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAA;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAA;CACxC"}
@@ -0,0 +1,11 @@
1
+ import { BaseItem } from '../../Item/BaseItem.js';
2
+
3
+ class Item extends BaseItem {
4
+ constructor(initialValues) {
5
+ super(initialValues);
6
+ }
7
+ }
8
+ BaseItem.setPlatformClass(Item);
9
+
10
+ export { Item };
11
+ //# sourceMappingURL=Item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Item.js","sources":["../../../../../src/node/Item/Item.ts"],"sourcesContent":["import { IItem } from '@/interfaces';\nimport { BaseItem } from '@/Item/BaseItem';\nimport { ModelSchema, ModelValues, NewItemProps } from '@/types';\n\nexport class Item<T extends ModelValues<ModelSchema>> extends BaseItem<T> implements IItem<T> {\n constructor(initialValues: NewItemProps<T>) {\n super(initialValues);\n }\n\n}\n\nBaseItem.setPlatformClass(Item)"],"names":[],"mappings":";;AAIM,MAAO,IAAyC,SAAQ,QAAW,CAAA;AACvE,IAAA,WAAA,CAAY,aAA8B,EAAA;QACxC,KAAK,CAAC,aAAa,CAAC;;AAGvB;AAED,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC;;;;"}
@@ -0,0 +1,10 @@
1
+ import { BaseItemProperty } from '../../ItemProperty/BaseItemProperty.js';
2
+
3
+ class ItemProperty extends BaseItemProperty {
4
+ constructor(initialValues) {
5
+ super(initialValues);
6
+ }
7
+ }
8
+
9
+ export { ItemProperty };
10
+ //# sourceMappingURL=ItemProperty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ItemProperty.js","sources":["../../../../../src/node/ItemProperty/ItemProperty.ts"],"sourcesContent":["import { IItemProperty } from '@/interfaces'\nimport { BaseItemProperty } from '@/ItemProperty/BaseItemProperty'\nimport { CreatePropertyInstanceProps, ModelSchema, ModelValues, } from '@/types'\n\nexport class ItemProperty<PropertyType> extends BaseItemProperty<PropertyType> implements IItemProperty<PropertyType> {\n constructor(initialValues: Partial<CreatePropertyInstanceProps>) {\n super(initialValues)\n }\n}"],"names":[],"mappings":";;AAIM,MAAO,YAA2B,SAAQ,gBAA8B,CAAA;AAC5E,IAAA,WAAA,CAAY,aAAmD,EAAA;QAC7D,KAAK,CAAC,aAAa,CAAC;;AAEvB;;;;"}
@@ -12,6 +12,7 @@ export declare class PathResolver {
12
12
  * Gets the root directory containing node_modules
13
13
  */
14
14
  getRootWithNodeModules(): string;
15
+ getProjectDir(): string;
15
16
  /**
16
17
  * Gets the SDK root directory
17
18
  */
@@ -24,16 +25,6 @@ export declare class PathResolver {
24
25
  /**
25
26
  * Gets paths for app-specific directories
26
27
  */
27
- getAppPaths(schemaFileDir?: string | undefined): {
28
- sdkRootDir: string;
29
- dotSeedDir: string;
30
- nodeModulesDir: string;
31
- appSchemaDir: string;
32
- appDbDir: string;
33
- appMetaDir: string;
34
- drizzleDbConfigPath: string;
35
- drizzleKitPath: string;
36
- templatePath: string;
37
- };
28
+ getAppPaths(schemaFileDir?: string | undefined): GetAppPathsReturn;
38
29
  }
39
30
  //# sourceMappingURL=PathResolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PathResolver.d.ts","sourceRoot":"","sources":["../../../src/node/PathResolver.ts"],"names":[],"mappings":"AAIA,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IACrC,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,YAAY;IAOlC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,gBAAgB;IAcxB;;OAEG;IACH,sBAAsB,IAAI,MAAM;IAYhC;;OAEG;IACH,aAAa,IAAI,MAAM;IAmCvB,iBAAiB,IAAI,MAAM;IAa3B;;OAEG;IACH,aAAa,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM;IAO7C;;OAEG;IACH,WAAW,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS;;;;;;;;;;;CA4B/C"}
1
+ {"version":3,"file":"PathResolver.d.ts","sourceRoot":"","sources":["../../../src/node/PathResolver.ts"],"names":[],"mappings":"AAOA,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IACrC,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,YAAY;IAOlC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,gBAAgB;IAcxB;;OAEG;IACH,sBAAsB,IAAI,MAAM;IAYhC,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,aAAa,IAAI,MAAM;IAmCvB,iBAAiB,IAAI,MAAM;IAa3B;;OAEG;IACH,aAAa,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM;IAO7C;;OAEG;IACH,WAAW,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,iBAAiB;CA8BnE"}
@@ -1,7 +1,9 @@
1
1
  import path from 'path';
2
2
  import fs from 'fs';
3
3
  import { NODE_APP_DB_CONFIG } from './constants.js';
4
+ import debug from 'debug';
4
5
 
6
+ const logger = debug('seedSdk:node:helpers:PathResolver');
5
7
  class PathResolver {
6
8
  constructor() { }
7
9
  static getInstance() {
@@ -65,6 +67,9 @@ class PathResolver {
65
67
  }
66
68
  return processCwd;
67
69
  }
70
+ getProjectDir() {
71
+ return process.cwd();
72
+ }
68
73
  /**
69
74
  * Gets the SDK root directory
70
75
  */
@@ -79,13 +84,13 @@ class PathResolver {
79
84
  // For linked packages, find the package directory
80
85
  const pkgJson = JSON.parse(fs.readFileSync(path.join(processCwd, 'package.json'), 'utf8'));
81
86
  const sdkPath = pkgJson.dependencies?.['@seedprotocol/sdk'] || pkgJson.devDependencies?.['@seedprotocol/sdk'];
82
- console.log(sdkPath);
87
+ logger('sdkPath', sdkPath);
83
88
  if (sdkPath === 'link:@seedprotocol/sdk') {
84
89
  return path.join(processCwd, 'node_modules', '@seedprotocol', 'sdk', 'src');
85
90
  }
86
91
  return path.resolve(processCwd, sdkPath.replace(/^(link:|portal:)/, ''));
87
92
  }
88
- console.log('getSdkRootDir', rootWithNodeModules, env);
93
+ logger('getSdkRootDir', rootWithNodeModules, env);
89
94
  switch (env) {
90
95
  case 'sdk-dev':
91
96
  // This should be {localDir}/seed-protocol-sdk/src
@@ -126,9 +131,9 @@ class PathResolver {
126
131
  let drizzleKitPath = path.join(nodeModulesDir, 'drizzle-kit', 'bin.cjs');
127
132
  if (env === 'linked-sdk') {
128
133
  const sdkRootDir = this.getSdkRootDir();
129
- console.log(`sdkRootDir: ${sdkRootDir}`);
134
+ logger(`sdkRootDir: ${sdkRootDir}`);
130
135
  const sdkPackageDir = path.dirname(sdkRootDir);
131
- console.log(`sdkPackageDir: ${sdkPackageDir}`);
136
+ logger(`sdkPackageDir: ${sdkPackageDir}`);
132
137
  const sdkNodeModulesDir = path.join(sdkPackageDir, 'node_modules');
133
138
  drizzleKitPath = path.join(sdkNodeModulesDir, 'drizzle-kit', 'bin.cjs');
134
139
  }
@@ -141,7 +146,9 @@ class PathResolver {
141
146
  appMetaDir: path.join(dotSeedDir, 'db', 'meta'),
142
147
  drizzleDbConfigPath: path.join(this.getSdkRootDir(), 'node', 'db', NODE_APP_DB_CONFIG),
143
148
  drizzleKitPath,
144
- templatePath: path.join(this.getSdkRootDir(), 'node', 'codegen', 'templates')
149
+ templatePath: path.join(this.getSdkRootDir(), 'node', 'codegen', 'templates'),
150
+ rootWithNodeModules: this.getRootWithNodeModules(),
151
+ projectDir: this.getProjectDir(),
145
152
  };
146
153
  }
147
154
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PathResolver.js","sources":["../../../../src/node/PathResolver.ts"],"sourcesContent":["import path from 'path'\nimport fs from 'fs'\nimport { NODE_APP_DB_CONFIG } from './constants'\n\nexport class PathResolver {\n private static instance: PathResolver\n private constructor() {}\n\n static getInstance(): PathResolver {\n if (!PathResolver.instance) {\n PathResolver.instance = new PathResolver()\n }\n return PathResolver.instance\n }\n\n /**\n * Detects the current environment based on filesystem structure and package.json\n */\n private detectEnvironment(): 'sdk-dev' | 'linked-sdk' | 'test' | 'production' {\n // Check if we're in the SDK repo itself\n if (process.env.NODE_ENV !== 'test' && this.isInSdkRepo()) {\n return 'sdk-dev'\n }\n\n // Check if we're running tests\n if (process.env.NODE_ENV === 'test') {\n return 'test'\n }\n\n // Check if we're using a linked version of the SDK\n if (this.isUsingLinkedSdk()) {\n return 'linked-sdk'\n }\n\n // Default to production environment\n return 'production'\n }\n\n private isInSdkRepo(): boolean {\n try {\n // Check if we're in the SDK repo by looking for specific SDK files/directories\n const currentDir = process.cwd()\n return fs.existsSync(path.join(currentDir, 'src', 'node')) &&\n fs.existsSync(path.join(currentDir, 'package.json')) &&\n JSON.parse(fs.readFileSync(path.join(currentDir, 'package.json'), 'utf8')).name === '@seedprotocol/sdk'\n } catch {\n return false\n }\n }\n\n private isUsingLinkedSdk(): boolean {\n try {\n const pkgPath = path.join(process.cwd(), 'package.json')\n if (!fs.existsSync(pkgPath)) return false\n \n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))\n const sdkDep = pkg.dependencies?.['@seedprotocol/sdk']\n \n return sdkDep && (sdkDep.startsWith('link:') || sdkDep.startsWith('portal:'))\n } catch {\n return false\n }\n }\n\n /**\n * Gets the root directory containing node_modules\n */\n getRootWithNodeModules(): string {\n const processCwd = process.cwd()\n\n const calledFromMocks = processCwd.includes('__mocks__')\n\n if (calledFromMocks) {\n return path.join(processCwd, '..', '..', '..', '..',)\n }\n\n return processCwd\n }\n\n /**\n * Gets the SDK root directory\n */\n getSdkRootDir(): string {\n const env = this.detectEnvironment()\n const rootWithNodeModules = this.getRootWithNodeModules()\n const processCwd = process.cwd()\n\n if (process.cwd().includes('__mocks__')) {\n return path.join(rootWithNodeModules, 'src')\n }\n\n if (env === 'linked-sdk') {\n // For linked packages, find the package directory\n const pkgJson = JSON.parse(fs.readFileSync(path.join(processCwd, 'package.json'), 'utf8'))\n const sdkPath = pkgJson.dependencies?.['@seedprotocol/sdk'] || pkgJson.devDependencies?.['@seedprotocol/sdk']\n console.log(sdkPath)\n if (sdkPath === 'link:@seedprotocol/sdk') {\n return path.join(processCwd, 'node_modules', '@seedprotocol', 'sdk', 'src')\n }\n return path.resolve(processCwd, sdkPath.replace(/^(link:|portal:)/, ''))\n }\n\n console.log('getSdkRootDir', rootWithNodeModules, env)\n\n switch (env) {\n case 'sdk-dev':\n // This should be {localDir}/seed-protocol-sdk/src\n return path.join(rootWithNodeModules, 'src')\n case 'test':\n // This should be {localDir}/seed-protocol-sdk/src\n return path.join(rootWithNodeModules, 'src')\n default:\n // This should be {projectDir}/node_modules/@seedprotocol/sdk\n return path.join(rootWithNodeModules, 'node_modules', '@seedprotocol', 'sdk',)\n }\n }\n\n getNodeModulesDir(): string {\n const env = this.detectEnvironment()\n const rootWithNodeModules = this.getRootWithNodeModules()\n\n let nodeModulesDir = path.join(rootWithNodeModules, 'node_modules')\n\n if (env !== 'linked-sdk' && env !== 'sdk-dev' && nodeModulesDir.includes('__tests__')) {\n nodeModulesDir = path.join(process.cwd(), '..', '..', '..', '..', 'node_modules',)\n }\n\n return nodeModulesDir\n }\n\n /**\n * Gets the .seed directory path\n */\n getDotSeedDir(schemaFileDir?: string): string {\n if (!schemaFileDir && process.env.SEED_SDK_TEST_PROJECT_TYPE && !process.cwd().includes('__mocks__')) {\n return path.join(process.cwd(), '__tests__', '__mocks__', process.env.SEED_SDK_TEST_PROJECT_TYPE, 'project', '.seed')\n }\n return path.join(schemaFileDir || process.cwd(), '.seed')\n }\n\n /**\n * Gets paths for app-specific directories\n */\n getAppPaths(schemaFileDir?: string | undefined) {\n const env = this.detectEnvironment()\n const dotSeedDir = this.getDotSeedDir(schemaFileDir)\n const nodeModulesDir = this.getNodeModulesDir()\n\n let drizzleKitPath = path.join(nodeModulesDir, 'drizzle-kit', 'bin.cjs')\n\n if (env === 'linked-sdk') {\n const sdkRootDir = this.getSdkRootDir()\n console.log(`sdkRootDir: ${sdkRootDir}`)\n const sdkPackageDir = path.dirname(sdkRootDir)\n console.log(`sdkPackageDir: ${sdkPackageDir}`)\n const sdkNodeModulesDir = path.join(sdkPackageDir, 'node_modules')\n drizzleKitPath = path.join(sdkNodeModulesDir, 'drizzle-kit', 'bin.cjs')\n }\n\n return {\n sdkRootDir: this.getSdkRootDir(),\n dotSeedDir,\n nodeModulesDir,\n appSchemaDir: path.join(dotSeedDir, 'schema'),\n appDbDir: path.join(dotSeedDir, 'db'),\n appMetaDir: path.join(dotSeedDir, 'db', 'meta'),\n drizzleDbConfigPath: path.join(this.getSdkRootDir(), 'node', 'db', NODE_APP_DB_CONFIG),\n drizzleKitPath,\n templatePath: path.join(this.getSdkRootDir(), 'node', 'codegen', 'templates')\n }\n }\n} \n"],"names":[],"mappings":";;;;MAIa,YAAY,CAAA;AAEvB,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UAAU,EAAE,IAAI,CAAC,aAAa,EAAE;YAChC,UAAU;YACV,cAAc;YACd,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC;YAC7C,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC;YACrC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC;AAC/C,YAAA,mBAAmB,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,CAAC;YACtF,cAAc;AACd,YAAA,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW;SAC7E;;AAEJ;;;;"}
1
+ {"version":3,"file":"PathResolver.js","sources":["../../../../src/node/PathResolver.ts"],"sourcesContent":["import path from 'path'\nimport fs from 'fs'\nimport { NODE_APP_DB_CONFIG } from './constants'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:node:helpers:PathResolver')\n\nexport class PathResolver {\n private static instance: PathResolver\n private constructor() {}\n\n static getInstance(): PathResolver {\n if (!PathResolver.instance) {\n PathResolver.instance = new PathResolver()\n }\n return PathResolver.instance\n }\n\n /**\n * Detects the current environment based on filesystem structure and package.json\n */\n private detectEnvironment(): 'sdk-dev' | 'linked-sdk' | 'test' | 'production' {\n // Check if we're in the SDK repo itself\n if (process.env.NODE_ENV !== 'test' && this.isInSdkRepo()) {\n return 'sdk-dev'\n }\n\n // Check if we're running tests\n if (process.env.NODE_ENV === 'test') {\n return 'test'\n }\n\n // Check if we're using a linked version of the SDK\n if (this.isUsingLinkedSdk()) {\n return 'linked-sdk'\n }\n\n // Default to production environment\n return 'production'\n }\n\n private isInSdkRepo(): boolean {\n try {\n // Check if we're in the SDK repo by looking for specific SDK files/directories\n const currentDir = process.cwd()\n return fs.existsSync(path.join(currentDir, 'src', 'node')) &&\n fs.existsSync(path.join(currentDir, 'package.json')) &&\n JSON.parse(fs.readFileSync(path.join(currentDir, 'package.json'), 'utf8')).name === '@seedprotocol/sdk'\n } catch {\n return false\n }\n }\n\n private isUsingLinkedSdk(): boolean {\n try {\n const pkgPath = path.join(process.cwd(), 'package.json')\n if (!fs.existsSync(pkgPath)) return false\n \n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))\n const sdkDep = pkg.dependencies?.['@seedprotocol/sdk']\n \n return sdkDep && (sdkDep.startsWith('link:') || sdkDep.startsWith('portal:'))\n } catch {\n return false\n }\n }\n\n /**\n * Gets the root directory containing node_modules\n */\n getRootWithNodeModules(): string {\n const processCwd = process.cwd()\n\n const calledFromMocks = processCwd.includes('__mocks__')\n\n if (calledFromMocks) {\n return path.join(processCwd, '..', '..', '..', '..',)\n }\n\n return processCwd\n }\n\n getProjectDir(): string {\n return process.cwd()\n }\n\n /**\n * Gets the SDK root directory\n */\n getSdkRootDir(): string {\n const env = this.detectEnvironment()\n const rootWithNodeModules = this.getRootWithNodeModules()\n const processCwd = process.cwd()\n\n if (process.cwd().includes('__mocks__')) {\n return path.join(rootWithNodeModules, 'src')\n }\n\n if (env === 'linked-sdk') {\n // For linked packages, find the package directory\n const pkgJson = JSON.parse(fs.readFileSync(path.join(processCwd, 'package.json'), 'utf8'))\n const sdkPath = pkgJson.dependencies?.['@seedprotocol/sdk'] || pkgJson.devDependencies?.['@seedprotocol/sdk']\n logger('sdkPath', sdkPath)\n if (sdkPath === 'link:@seedprotocol/sdk') {\n return path.join(processCwd, 'node_modules', '@seedprotocol', 'sdk', 'src')\n }\n return path.resolve(processCwd, sdkPath.replace(/^(link:|portal:)/, ''))\n }\n\n logger('getSdkRootDir', rootWithNodeModules, env)\n\n switch (env) {\n case 'sdk-dev':\n // This should be {localDir}/seed-protocol-sdk/src\n return path.join(rootWithNodeModules, 'src')\n case 'test':\n // This should be {localDir}/seed-protocol-sdk/src\n return path.join(rootWithNodeModules, 'src')\n default:\n // This should be {projectDir}/node_modules/@seedprotocol/sdk\n return path.join(rootWithNodeModules, 'node_modules', '@seedprotocol', 'sdk',)\n }\n }\n\n getNodeModulesDir(): string {\n const env = this.detectEnvironment()\n const rootWithNodeModules = this.getRootWithNodeModules()\n\n let nodeModulesDir = path.join(rootWithNodeModules, 'node_modules')\n\n if (env !== 'linked-sdk' && env !== 'sdk-dev' && nodeModulesDir.includes('__tests__')) {\n nodeModulesDir = path.join(process.cwd(), '..', '..', '..', '..', 'node_modules',)\n }\n\n return nodeModulesDir\n }\n\n /**\n * Gets the .seed directory path\n */\n getDotSeedDir(schemaFileDir?: string): string {\n if (!schemaFileDir && process.env.SEED_SDK_TEST_PROJECT_TYPE && !process.cwd().includes('__mocks__')) {\n return path.join(process.cwd(), '__tests__', '__mocks__', process.env.SEED_SDK_TEST_PROJECT_TYPE, 'project', '.seed')\n }\n return path.join(schemaFileDir || process.cwd(), '.seed')\n }\n\n /**\n * Gets paths for app-specific directories\n */\n getAppPaths(schemaFileDir?: string | undefined): GetAppPathsReturn {\n const env = this.detectEnvironment()\n const dotSeedDir = this.getDotSeedDir(schemaFileDir)\n const nodeModulesDir = this.getNodeModulesDir()\n\n let drizzleKitPath = path.join(nodeModulesDir, 'drizzle-kit', 'bin.cjs')\n\n if (env === 'linked-sdk') {\n const sdkRootDir = this.getSdkRootDir()\n logger(`sdkRootDir: ${sdkRootDir}`)\n const sdkPackageDir = path.dirname(sdkRootDir)\n logger(`sdkPackageDir: ${sdkPackageDir}`)\n const sdkNodeModulesDir = path.join(sdkPackageDir, 'node_modules')\n drizzleKitPath = path.join(sdkNodeModulesDir, 'drizzle-kit', 'bin.cjs')\n }\n\n return {\n sdkRootDir: this.getSdkRootDir(),\n dotSeedDir,\n nodeModulesDir,\n appSchemaDir: path.join(dotSeedDir, 'schema'),\n appDbDir: path.join(dotSeedDir, 'db'),\n appMetaDir: path.join(dotSeedDir, 'db', 'meta'),\n drizzleDbConfigPath: path.join(this.getSdkRootDir(), 'node', 'db', NODE_APP_DB_CONFIG),\n drizzleKitPath,\n templatePath: path.join(this.getSdkRootDir(), 'node', 'codegen', 'templates'),\n rootWithNodeModules: this.getRootWithNodeModules(),\n projectDir: this.getProjectDir(),\n }\n }\n} \n"],"names":[],"mappings":";;;;;AAKA,MAAM,MAAM,GAAG,KAAK,CAAC,mCAAmC,CAAC;MAE5C,YAAY,CAAA;AAEvB,IAAA,WAAA,GAAA;AAEA,IAAA,OAAO,WAAW,GAAA;AAChB,QAAA,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;AAC1B,YAAA,YAAY,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE;;QAE5C,OAAO,YAAY,CAAC,QAAQ;;AAG9B;;AAEG;IACK,iBAAiB,GAAA;;AAEvB,QAAA,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;AACzD,YAAA,OAAO,SAAS;;;QAIlB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;AACnC,YAAA,OAAO,MAAM;;;AAIf,QAAA,IAAI,IAAI,CAAC,gBAAgB,EAAE,EAAE;AAC3B,YAAA,OAAO,YAAY;;;AAIrB,QAAA,OAAO,YAAY;;IAGb,WAAW,GAAA;AACjB,QAAA,IAAI;;AAEF,YAAA,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE;AAChC,YAAA,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;gBACnD,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;gBACpD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAA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,CAAA;;IAMd,MAAM,CAAC,QAAQ;IAIf,MAAM,CAAC,YAAY;WAIN,SAAS,CAAC,QAAQ,EAAE,MAAM;WAiB1B,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;WAO7C,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAQvE;AAID,OAAO,EAAE,EAAE,EAAE,CAAA"}
1
+ {"version":3,"file":"Db.d.ts","sourceRoot":"","sources":["../../../../src/node/db/Db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAc,gBAAgB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAiB,cAAc,CAAC;AA0B9C,cAAM,EAAG,SAAQ,MAAO,YAAW,GAAG;IACpC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAA;;IAMd,MAAM,CAAC,QAAQ;IAIf,MAAM,CAAC,YAAY;WAIN,SAAS,CAAC,QAAQ,EAAE,MAAM;WAsB1B,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;WAa7C,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAQvE;AAID,OAAO,EAAE,EAAE,EAAE,CAAA"}
@@ -0,0 +1,72 @@
1
+ import { BaseDb } from '../../db/Db/BaseDb.js';
2
+ import path from 'path';
3
+ import debug from 'debug';
4
+ import { appState } from '../../seedSchema/AppStateSchema.js';
5
+ import '../../seedSchema/MetadataSchema.js';
6
+ import '../../seedSchema/ModelSchema.js';
7
+ import '../../seedSchema/ModelUidSchema.js';
8
+ import '../../seedSchema/PropertyUidSchema.js';
9
+ import '../../seedSchema/SeedSchema.js';
10
+ import '../../seedSchema/VersionSchema.js';
11
+
12
+ const logger = debug('seedSdk:node:db:Db');
13
+ const getConfig = async (dotSeedDir) => {
14
+ const { defineConfig } = await import('drizzle-kit');
15
+ let schemaDir = path.join(process.cwd(), 'schema');
16
+ const nodeDbConfig = defineConfig({
17
+ schema: schemaDir,
18
+ dialect: 'sqlite',
19
+ out: `${dotSeedDir}/db`,
20
+ dbCredentials: {
21
+ url: `${dotSeedDir}/db/app_db.sqlite3`,
22
+ }
23
+ });
24
+ return nodeDbConfig;
25
+ };
26
+ class Db extends BaseDb {
27
+ constructor() {
28
+ super();
29
+ }
30
+ static getAppDb() {
31
+ return this.db;
32
+ }
33
+ static isAppDbReady() {
34
+ return true;
35
+ }
36
+ static async prepareDb(filesDir) {
37
+ const nodeDbConfig = await getConfig(filesDir);
38
+ const BetterSqlite3Default = await import('drizzle-orm/better-sqlite3').catch((e) => {
39
+ console.error('BetterSqlite3 import error', e);
40
+ throw e;
41
+ });
42
+ const drizzle = BetterSqlite3Default.drizzle;
43
+ this.db = drizzle({
44
+ ...nodeDbConfig,
45
+ logger: true,
46
+ });
47
+ if (!this.db) {
48
+ throw new Error('Db not found');
49
+ }
50
+ return this.db;
51
+ }
52
+ static async connectToDb(pathToDir, dbName) {
53
+ const db = this.getAppDb();
54
+ if (!db) {
55
+ await this.prepareDb(pathToDir);
56
+ }
57
+ return {
58
+ id: this.db ? this.db.constructor.name : ''
59
+ };
60
+ }
61
+ static async migrate(pathToDbDir, dbName, dbId) {
62
+ const { migrate } = await import('drizzle-orm/better-sqlite3/migrator');
63
+ migrate(this.db, { migrationsFolder: pathToDbDir });
64
+ const queryResult = await this.db.select().from(appState);
65
+ logger('queryResult', queryResult);
66
+ return this.db;
67
+ }
68
+ }
69
+ BaseDb.setPlatformClass(Db);
70
+
71
+ export { Db };
72
+ //# sourceMappingURL=Db.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Db.js","sources":["../../../../../src/node/db/Db.ts"],"sourcesContent":["import { BaseDb } from \"@/db/Db/BaseDb\";\nimport { IDb } from \"@/interfaces\";\nimport path from \"path\";\nimport { DrizzleConfig, } from \"drizzle-orm\";\nimport debug from 'debug'\nimport { appState } from '@/seedSchema'\n\nconst logger = debug('seedSdk:node:db:Db')\n\nconst getConfig = async (dotSeedDir: string) => {\n\n const { defineConfig } = await import('drizzle-kit')\n\n let schemaDir = path.join(process.cwd(), 'schema')\n\n const nodeDbConfig = defineConfig({\n schema: schemaDir,\n dialect: 'sqlite',\n out: `${dotSeedDir}/db`,\n dbCredentials: {\n url: `${dotSeedDir}/db/app_db.sqlite3`,\n }\n }) as DrizzleConfig & { dbCredentials: { url: string } }\n\n return nodeDbConfig\n}\n\nclass Db extends BaseDb implements IDb {\n static db: any\n\n constructor() {\n super()\n }\n\n static getAppDb() {\n return this.db\n }\n\n static isAppDbReady() {\n return true\n }\n\n static async prepareDb(filesDir: string) {\n const nodeDbConfig = await getConfig(filesDir)\n\n const BetterSqlite3Default = await import('drizzle-orm/better-sqlite3').catch((e) => {\n console.error('BetterSqlite3 import error', e)\n throw e\n })\n\n const drizzle = BetterSqlite3Default.drizzle\n\n this.db = drizzle({\n ...nodeDbConfig,\n logger: true,\n })\n\n if (!this.db) {\n throw new Error('Db not found')\n }\n\n return this.db\n }\n\n static async connectToDb(pathToDir: string, dbName: string) {\n\n const db = this.getAppDb()\n\n if ( !db ) {\n await this.prepareDb(pathToDir)\n }\n\n return {\n id: this.db ? this.db.constructor.name : ''\n }\n }\n\n static async migrate(pathToDbDir: string, dbName: string, dbId: string) {\n const {migrate} = await import('drizzle-orm/better-sqlite3/migrator')\n migrate(this.db, { migrationsFolder: pathToDbDir })\n const queryResult = await this.db.select().from(appState)\n logger('queryResult', queryResult)\n\n return this.db\n }\n}\n\nBaseDb.setPlatformClass(Db)\n\nexport { Db }\n"],"names":[],"mappings":";;;;;;;;;;;AAOA,MAAM,MAAM,GAAG,KAAK,CAAC,oBAAoB,CAAC;AAE1C,MAAM,SAAS,GAAG,OAAO,UAAkB,KAAI;IAE7C,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,OAAO,aAAa,CAAC;AAEpD,IAAA,IAAI,SAAS,GAAG,IAAI,CA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,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE;QAE1B,IAAK,CAAC,EAAE,EAAG;AACT,YAAA,MAAM,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;;QAGjC,OAAO;AACL,YAAA,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,GAAG;SAC1C;;IAGH,aAAa,OAAO,CAAC,WAAmB,EAAE,MAAc,EAAE,IAAY,EAAA;QACpE,MAAM,EAAC,OAAO,EAAC,GAAG,MAAM,OAAO,qCAAqC,CAAC;QACrE,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC;AACnD,QAAA,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;AACzD,QAAA,MAAM,CAAC,aAAa,EAAE,WAAW,CAAC;QAElC,OAAO,IAAI,CAAC,EAAE;;AAEjB;AAED,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"node.app.db.config.d.ts","sourceRoot":"","sources":["../../../../src/node/db/node.app.db.config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;wBAmBrC,aAAa;AAPnB,wBAOmB"}
1
+ {"version":3,"file":"node.app.db.config.d.ts","sourceRoot":"","sources":["../../../../src/node/db/node.app.db.config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;wBAsBrC,aAAa;AAPnB,wBAOmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ArweaveClient.d.ts","sourceRoot":"","sources":["../../../../src/node/helpers/ArweaveClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,cAAM,aAAc,SAAQ,iBAAiB;IAC3C,MAAM,CAAC,gBAAgB,IAAI,aAAa;CAGzC;AAID,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"ArweaveClient.d.ts","sourceRoot":"","sources":["../../../../src/node/helpers/ArweaveClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAE7E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,cAAM,aAAc,SAAQ,iBAAiB;IAC3C,MAAM,CAAC,gBAAgB,IAAI,aAAa;CAGzC;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
@@ -7,7 +7,6 @@ class ArweaveClient extends BaseArweaveClient {
7
7
  return new GraphQLClient(ARWEAVE_ENDPOINT);
8
8
  }
9
9
  }
10
- BaseArweaveClient.setPlatformClass(ArweaveClient);
11
10
 
12
11
  export { ArweaveClient };
13
12
  //# sourceMappingURL=ArweaveClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArweaveClient.js","sources":["../../../../../src/node/helpers/ArweaveClient.ts"],"sourcesContent":["import { BaseArweaveClient } from '@/helpers/ArweaveClient/BaseArweaveClient';\nimport { ARWEAVE_ENDPOINT } from '@/services/internal/constants';\nimport { GraphQLClient } from 'graphql-request';\n\nclass ArweaveClient extends BaseArweaveClient {\n static getArweaveClient(): GraphQLClient {\n return new GraphQLClient(ARWEAVE_ENDPOINT);\n }\n}\n\nBaseArweaveClient.setPlatformClass(ArweaveClient);\n\nexport { ArweaveClient }; "],"names":[],"mappings":";;;;AAIA,MAAM,aAAc,SAAQ,iBAAiB,CAAA;AAC3C,IAAA,OAAO,gBAAgB,GAAA;AACrB,QAAA,OAAO,IAAI,aAAa,CAAC,gBAAgB,CAAC;;AAE7C;AAED,iBAAiB,CAAC,gBAAgB,CAAC,aAAa,CAAC;;;;"}
1
+ {"version":3,"file":"ArweaveClient.js","sources":["../../../../../src/node/helpers/ArweaveClient.ts"],"sourcesContent":["import { BaseArweaveClient } from '@/helpers/ArweaveClient/BaseArweaveClient'\nimport { ARWEAVE_ENDPOINT } from '@/services/internal/constants'\nimport { GraphQLClient } from 'graphql-request'\n\nclass ArweaveClient extends BaseArweaveClient {\n static getArweaveClient(): GraphQLClient {\n return new GraphQLClient(ARWEAVE_ENDPOINT);\n }\n}\n\nexport { ArweaveClient }"],"names":[],"mappings":";;;;AAIA,MAAM,aAAc,SAAQ,iBAAiB,CAAA;AAC3C,IAAA,OAAO,gBAAgB,GAAA;AACrB,QAAA,OAAO,IAAI,aAAa,CAAC,gBAAgB,CAAC;;AAE7C;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EasClient.d.ts","sourceRoot":"","sources":["../../../../src/node/helpers/EasClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,cAAM,SAAU,SAAQ,aAAa;IACnC,MAAM,CAAC,YAAY;CAGpB;AAID,OAAO,EAAE,SAAS,EAAE,CAAA"}
1
+ {"version":3,"file":"EasClient.d.ts","sourceRoot":"","sources":["../../../../src/node/helpers/EasClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,cAAM,SAAU,SAAQ,aAAa;IACnC,MAAM,CAAC,YAAY;CAGpB;AAED,OAAO,EAAE,SAAS,EAAE,CAAA"}
@@ -2,15 +2,19 @@ import { BaseFileManager } from '@/helpers/FileManager/BaseFileManager';
2
2
  declare class FileManager extends BaseFileManager {
3
3
  static getContentUrlFromPath(path: string): Promise<string | undefined>;
4
4
  static initializeFileSystem(): Promise<void>;
5
+ static getFs(): Promise<any>;
5
6
  static downloadAllFiles(): Promise<void>;
6
7
  static resizeImage(): Promise<void>;
7
8
  static resizeAllImages(): Promise<void>;
8
9
  static pathExists(filePath: string): Promise<boolean>;
10
+ static pathExistsSync(filePath: string): boolean;
9
11
  static createDirIfNotExists(filePath: string): Promise<void>;
10
12
  static readFileAsBuffer(filePath: string): Promise<Buffer>;
11
13
  static readFile(filePath: string): Promise<File>;
12
14
  static getParentDirPath(filePath: string): string;
13
15
  static getFilenameFromPath(filePath: string): string;
16
+ static getAppPaths(): GetAppPathsReturn;
17
+ static joinPaths(...paths: string[]): string;
14
18
  }
15
19
  export { FileManager };
16
20
  //# sourceMappingURL=FileManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileManager.d.ts","sourceRoot":"","sources":["../../../../src/node/helpers/FileManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AAGvE,cAAM,WAAY,SAAQ,eAAe;WAE1B,qBAAqB,CAAE,IAAI,EAAE,MAAM,GAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;WAMlE,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;WAIrC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;WAMjC,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;WAM5B,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;WAMhC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;WAM9C,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAMrD,gBAAgB,CAAE,QAAQ,EAAE,MAAM,GAAI,OAAO,CAAC,MAAM,CAAC;WAIrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAIjD,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAIrD;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"FileManager.d.ts","sourceRoot":"","sources":["../../../../src/node/helpers/FileManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AASvE,cAAM,WAAY,SAAQ,eAAe;WAE1B,qBAAqB,CAAE,IAAI,EAAE,MAAM,GAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;WAMlE,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;WAIrC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC;WAIrB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;WAMjC,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;WAM5B,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;WAMhC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAI,OAAO,CAAC,OAAO,CAAC;IAI5D,MAAM,CAAC,cAAc,CAAE,QAAQ,EAAE,MAAM,GAAI,OAAO;WAIrC,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAIrD,gBAAgB,CAAE,QAAQ,EAAE,MAAM,GAAI,OAAO,CAAC,MAAM,CAAC;WAIrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAIjD,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAIpD,MAAM,CAAC,WAAW,IAAI,iBAAiB;IAKvC,MAAM,CAAC,SAAS,CAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAI,MAAM;CAI/C;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -0,0 +1,67 @@
1
+ import * as fsAsync from 'fs/promises';
2
+ import { BaseFileManager } from '../../helpers/FileManager/BaseFileManager.js';
3
+ import path from 'path';
4
+ import fs from 'fs';
5
+ import debug from 'debug';
6
+ import { PathResolver } from '../PathResolver.js';
7
+
8
+ debug('seedSdk:node:helpers:FileManager');
9
+ class FileManager extends BaseFileManager {
10
+ static async getContentUrlFromPath(path) {
11
+ return new Promise((resolve, reject) => {
12
+ reject(new Error('Not implemented'));
13
+ });
14
+ }
15
+ static async initializeFileSystem() {
16
+ return; // No need to initialize file system in node
17
+ }
18
+ static async getFs() {
19
+ return fs;
20
+ }
21
+ static async downloadAllFiles() {
22
+ return new Promise((resolve, reject) => {
23
+ reject(new Error('Not implemented'));
24
+ });
25
+ }
26
+ static async resizeImage() {
27
+ return new Promise((resolve, reject) => {
28
+ reject(new Error('Not implemented'));
29
+ });
30
+ }
31
+ static async resizeAllImages() {
32
+ return new Promise((resolve, reject) => {
33
+ reject(new Error('Not implemented'));
34
+ });
35
+ }
36
+ static async pathExists(filePath) {
37
+ return await fsAsync.access(filePath).then(() => true).catch(() => false);
38
+ }
39
+ static pathExistsSync(filePath) {
40
+ return fs.existsSync(filePath);
41
+ }
42
+ static async createDirIfNotExists(filePath) {
43
+ await fsAsync.mkdir(filePath, { recursive: true });
44
+ }
45
+ static async readFileAsBuffer(filePath) {
46
+ return await fsAsync.readFile(filePath);
47
+ }
48
+ static async readFile(filePath) {
49
+ return new File([await fsAsync.readFile(filePath)], filePath);
50
+ }
51
+ static getParentDirPath(filePath) {
52
+ return path.dirname(filePath);
53
+ }
54
+ static getFilenameFromPath(filePath) {
55
+ return path.basename(filePath);
56
+ }
57
+ static getAppPaths() {
58
+ const pathResolver = PathResolver.getInstance();
59
+ return pathResolver.getAppPaths();
60
+ }
61
+ static joinPaths(...paths) {
62
+ return path.join(...paths);
63
+ }
64
+ }
65
+
66
+ export { FileManager };
67
+ //# sourceMappingURL=FileManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileManager.js","sources":["../../../../../src/node/helpers/FileManager.ts"],"sourcesContent":["import * as fsAsync from 'fs/promises'\nimport { BaseFileManager } from '@/helpers/FileManager/BaseFileManager'\nimport path from 'path'\nimport fs from 'fs'\nimport debug from 'debug'\nimport { getFileInfo } from '@/helpers'\nimport { PathResolver } from '@/node/PathResolver'\n\nconst logger = debug('seedSdk:node:helpers:FileManager')\n\nclass FileManager extends BaseFileManager {\n\n static async getContentUrlFromPath( path: string ): Promise<string | undefined> {\n return new Promise(( resolve, reject ) => {\n reject(new Error('Not implemented'))\n })\n }\n\n static async initializeFileSystem(): Promise<void> {\n return // No need to initialize file system in node\n }\n\n static async getFs(): Promise<any> {\n return fs\n }\n\n static async downloadAllFiles(): Promise<void> {\n return new Promise(( resolve, reject ) => {\n reject(new Error('Not implemented'))\n })\n }\n\n static async resizeImage(): Promise<void> {\n return new Promise(( resolve, reject ) => {\n reject(new Error('Not implemented'))\n })\n }\n\n static async resizeAllImages(): Promise<void> {\n return new Promise(( resolve, reject ) => {\n reject(new Error('Not implemented'))\n })\n }\n\n static async pathExists(filePath: string,): Promise<boolean> {\n return await fsAsync.access(filePath).then(() => true).catch(() => false)\n }\n\n static pathExistsSync( filePath: string,): boolean {\n return fs.existsSync(filePath)\n }\n\n static async createDirIfNotExists(filePath: string): Promise<void> {\n await fsAsync.mkdir(filePath, { recursive: true })\n }\n\n static async readFileAsBuffer( filePath: string ): Promise<Buffer> {\n return await fsAsync.readFile(filePath)\n }\n\n static async readFile(filePath: string): Promise<File> {\n return new File([await fsAsync.readFile(filePath)], filePath)\n }\n\n static getParentDirPath(filePath: string): string {\n return path.dirname(filePath)\n }\n\n static getFilenameFromPath(filePath: string): string {\n return path.basename(filePath)\n }\n\n static getAppPaths(): GetAppPathsReturn {\n const pathResolver = PathResolver.getInstance()\n return pathResolver.getAppPaths()\n }\n\n static joinPaths( ...paths: string[] ): string {\n return path.join(...paths)\n }\n\n}\n\nexport { FileManager }\n\n"],"names":[],"mappings":";;;;;;;AAQe,KAAK,CAAC,kCAAkC;AAEvD,MAAM,WAAY,SAAQ,eAAe,CAAA;AAEvC,IAAA,aAA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C7C,QAAA,OAAO,MAAM,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;;AAGzC,IAAA,aAAa,QAAQ,CAAC,QAAgB,EAAA;AACpC,QAAA,OAAO,IAAI,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC;;IAG/D,OAAO,gBAAgB,CAAC,QAAgB,EAAA;AACtC,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;;IAG/B,OAAO,mBAAmB,CAAC,QAAgB,EAAA;AACzC,QAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;;AAGhC,IAAA,OAAO,WAAW,GAAA;AAChB,QAAA,MAAM,YAAY,GAAG,YAAY,CAAC,WAAW,EAAE;AAC/C,QAAA,OAAO,YAAY,CAAC,WAAW,EAAE;;AAGnC,IAAA,OAAO,SAAS,CAAE,GAAG,KAAe,EAAA;AAClC,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;;AAG7B;;;;"}
@@ -1,3 +1,4 @@
1
+ import { InferSelectModel } from 'drizzle-orm';
1
2
  export declare const appState: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
2
3
  name: "appState";
3
4
  schema: undefined;
@@ -77,5 +78,5 @@ export declare const appState: import("drizzle-orm/sqlite-core").SQLiteTableWith
77
78
  };
78
79
  dialect: "sqlite";
79
80
  }>;
80
- export type appStateType = appState.$inferSelect;
81
+ export type appStateType = InferSelectModel<typeof appState>;
81
82
  //# sourceMappingURL=AppStateSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppStateSchema.d.ts","sourceRoot":"","sources":["../../../src/seedSchema/AppStateSchema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnB,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAA"}
1
+ {"version":3,"file":"AppStateSchema.d.ts","sourceRoot":"","sources":["../../../src/seedSchema/AppStateSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnB,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,QAAQ,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppStateSchema.js","sources":["../../../../src/seedSchema/AppStateSchema.ts"],"sourcesContent":["import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\n\nexport const appState = sqliteTable('appState', {\n key: text('key').unique(),\n value: text('value'),\n createdAt: int('created_at'),\n updatedAt: int('updated_at'),\n})\n\nexport type appStateType = appState.$inferSelect\n"],"names":[],"mappings":";;AAEa,MAAA,QAAQ,GAAG,WAAW,CAAC,UAAU,EAAE;AAC9C,IAAA,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;AACzB,IAAA,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC;AACpB,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC5B,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC7B,CAAA;;;;"}
1
+ {"version":3,"file":"AppStateSchema.js","sources":["../../../../src/seedSchema/AppStateSchema.ts"],"sourcesContent":["import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\nimport { InferSelectModel } from 'drizzle-orm'\nexport const appState = sqliteTable('appState', {\n key: text('key').unique(),\n value: text('value'),\n createdAt: int('created_at'),\n updatedAt: int('updated_at'),\n})\n\nexport type appStateType = InferSelectModel<typeof appState>\n"],"names":[],"mappings":";;AAEa,MAAA,QAAQ,GAAG,WAAW,CAAC,UAAU,EAAE;AAC9C,IAAA,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;AACzB,IAAA,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC;AACpB,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC5B,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC7B,CAAA;;;;"}
@@ -1,3 +1,4 @@
1
+ import { InferSelectModel } from 'drizzle-orm';
1
2
  export declare const metadata: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
2
3
  name: "metadata";
3
4
  schema: undefined;
@@ -417,5 +418,5 @@ export declare const metadata: import("drizzle-orm/sqlite-core").SQLiteTableWith
417
418
  };
418
419
  dialect: "sqlite";
419
420
  }>;
420
- export type MetadataType = metadata.$inferSelect;
421
+ export type MetadataType = InferSelectModel<typeof metadata>;
421
422
  //# sourceMappingURL=MetadataSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MetadataSchema.d.ts","sourceRoot":"","sources":["../../../src/seedSchema/MetadataSchema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBnB,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAA"}
1
+ {"version":3,"file":"MetadataSchema.d.ts","sourceRoot":"","sources":["../../../src/seedSchema/MetadataSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBnB,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,QAAQ,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"MetadataSchema.js","sources":["../../../../src/seedSchema/MetadataSchema.ts"],"sourcesContent":["import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\n\nexport const metadata = sqliteTable('metadata', {\n localId: text('local_id').unique(),\n uid: text('uid'),\n propertyName: text('property_name'),\n propertyValue: text('property_value'),\n schemaUid: text('schema_uid'),\n modelType: text('model_type'),\n seedLocalId: text('seed_local_id'),\n seedUid: text('seed_uid'),\n versionLocalId: text('version_local_id'),\n versionUid: text('version_uid'),\n easDataType: text('eas_data_type'),\n refValueType: text('ref_value_type'),\n refModelUid: text('ref_schema_uid'),\n refSeedType: text('ref_seed_type'),\n refResolvedValue: text('ref_resolved_value'),\n refResolvedDisplayValue: text('ref_resolved_display_value'),\n localStorageDir: text('local_storage_dir'),\n attestationRaw: text('attestation_raw'),\n attestationCreatedAt: int('attestation_created_at'),\n contentHash: text('content_hash'),\n createdAt: int('created_at'),\n updatedAt: int('updated_at'),\n})\n\nexport type MetadataType = metadata.$inferSelect\n"],"names":[],"mappings":";;AAEa,MAAA,QAAQ,GAAG,WAAW,CAAC,UAAU,EAAE;AAC9C,IAAA,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;AAClC,IAAA,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC;AAChB,IAAA,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC;AACnC,IAAA,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC;AACrC,IAAA,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;AAC7B,IAAA,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;AAC7B,IAAA,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC;AAClC,IAAA,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;AACzB,IAAA,cAAc,EAAE,IAAI,CAAC,kBAAkB,CAAC;AACxC,IAAA,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC;AAC/B,IAAA,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC;AAClC,IAAA,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC;AACpC,IAAA,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC;AACnC,IAAA,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC;AAClC,IAAA,gBAAgB,EAAE,IAAI,CAAC,oBAAoB,CAAC;AAC5C,IAAA,uBAAuB,EAAE,IAAI,CAAC,4BAA4B,CAAC;AAC3D,IAAA,eAAe,EAAE,IAAI,CAAC,mBAAmB,CAAC;AAC1C,IAAA,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC;AACvC,IAAA,oBAAoB,EAAE,GAAG,CAAC,wBAAwB,CAAC;AACnD,IAAA,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC;AACjC,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC5B,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC7B,CAAA;;;;"}
1
+ {"version":3,"file":"MetadataSchema.js","sources":["../../../../src/seedSchema/MetadataSchema.ts"],"sourcesContent":["import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\nimport { InferSelectModel } from 'drizzle-orm'\n\nexport const metadata = sqliteTable('metadata', {\n localId: text('local_id').unique(),\n uid: text('uid'),\n propertyName: text('property_name'),\n propertyValue: text('property_value'),\n schemaUid: text('schema_uid'),\n modelType: text('model_type'),\n seedLocalId: text('seed_local_id'),\n seedUid: text('seed_uid'),\n versionLocalId: text('version_local_id'),\n versionUid: text('version_uid'),\n easDataType: text('eas_data_type'),\n refValueType: text('ref_value_type'),\n refModelUid: text('ref_schema_uid'),\n refSeedType: text('ref_seed_type'),\n refResolvedValue: text('ref_resolved_value'),\n refResolvedDisplayValue: text('ref_resolved_display_value'),\n localStorageDir: text('local_storage_dir'),\n attestationRaw: text('attestation_raw'),\n attestationCreatedAt: int('attestation_created_at'),\n contentHash: text('content_hash'),\n createdAt: int('created_at'),\n updatedAt: int('updated_at'),\n})\n\nexport type MetadataType = InferSelectModel<typeof metadata>\n"],"names":[],"mappings":";;AAGa,MAAA,QAAQ,GAAG,WAAW,CAAC,UAAU,EAAE;AAC9C,IAAA,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;AAClC,IAAA,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC;AAChB,IAAA,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC;AACnC,IAAA,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC;AACrC,IAAA,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;AAC7B,IAAA,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;AAC7B,IAAA,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC;AAClC,IAAA,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;AACzB,IAAA,cAAc,EAAE,IAAI,CAAC,kBAAkB,CAAC;AACxC,IAAA,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC;AAC/B,IAAA,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC;AAClC,IAAA,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC;AACpC,IAAA,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC;AACnC,IAAA,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC;AAClC,IAAA,gBAAgB,EAAE,IAAI,CAAC,oBAAoB,CAAC;AAC5C,IAAA,uBAAuB,EAAE,IAAI,CAAC,4BAA4B,CAAC;AAC3D,IAAA,eAAe,EAAE,IAAI,CAAC,mBAAmB,CAAC;AAC1C,IAAA,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC;AACvC,IAAA,oBAAoB,EAAE,GAAG,CAAC,wBAAwB,CAAC;AACnD,IAAA,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC;AACjC,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC5B,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC7B,CAAA;;;;"}
@@ -1,3 +1,4 @@
1
+ import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
1
2
  export declare const models: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
2
3
  name: "models";
3
4
  schema: undefined;
@@ -203,6 +204,6 @@ export declare const propertiesRelations: import("drizzle-orm").Relations<"prope
203
204
  model: import("drizzle-orm").One<"models", false>;
204
205
  refModel: import("drizzle-orm").One<"models", false>;
205
206
  }>;
206
- export type NewPropertyRecord = typeof properties.$inferInsert;
207
- export type PropertyType = typeof properties.$inferSelect;
207
+ export type NewPropertyRecord = InferInsertModel<typeof properties>;
208
+ export type PropertyType = InferSelectModel<typeof properties>;
208
209
  //# sourceMappingURL=ModelSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModelSchema.d.ts","sourceRoot":"","sources":["../../../src/seedSchema/ModelSchema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjB,CAAA;AAEF,eAAO,MAAM,eAAe;;EAEzB,CAAA;AAEH,MAAM,MAAM,cAAc,GAAG,OAAO,MAAM,CAAC,YAAY,CAAA;AACvD,MAAM,MAAM,eAAe,GAAG,OAAO,MAAM,CAAC,YAAY,CAAA;AAExD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBtB,CAAA;AAED,eAAO,MAAM,mBAAmB;;;EAG7B,CAAA;AAEH,MAAM,MAAM,iBAAiB,GAAG,OAAO,UAAU,CAAC,YAAY,CAAA;AAC9D,MAAM,MAAM,YAAY,GAAG,OAAO,UAAU,CAAC,YAAY,CAAA"}
1
+ {"version":3,"file":"ModelSchema.d.ts","sourceRoot":"","sources":["../../../src/seedSchema/ModelSchema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAChE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjB,CAAA;AAEF,eAAO,MAAM,eAAe;;EAEzB,CAAA;AAEH,MAAM,MAAM,cAAc,GAAG,OAAO,MAAM,CAAC,YAAY,CAAA;AACvD,MAAM,MAAM,eAAe,GAAG,OAAO,MAAM,CAAC,YAAY,CAAA;AAExD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBtB,CAAA;AAED,eAAO,MAAM,mBAAmB;;;EAG7B,CAAA;AAEH,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,UAAU,CAAC,CAAA;AACnE,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,UAAU,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ModelSchema.js","sources":["../../../../src/seedSchema/ModelSchema.ts"],"sourcesContent":["import { int, sqliteTable, text, unique } from 'drizzle-orm/sqlite-core'\nimport { relations } from 'drizzle-orm'\n\nexport const models = sqliteTable('models', {\n id: int('id').primaryKey({ autoIncrement: true }),\n name: text('name').notNull(),\n})\n\nexport const modelsRelations = relations(models, ({ many }) => ({\n properties: many(properties),\n}))\n\nexport type NewModelRecord = typeof models.$inferInsert\nexport type ModelRecordType = typeof models.$inferSelect\n\nexport const properties = sqliteTable(\n 'properties',\n {\n id: int('id').primaryKey({ autoIncrement: true }),\n name: text('name').notNull(),\n dataType: text('data_type').notNull(),\n readEndpoint: text('read_endpoint'),\n updateEndpoint: text('update_endpoint'),\n modelId: int('model_id')\n .notNull()\n .references(() => models.id),\n refModelId: int('ref_model_id').references(() => models.id),\n refValueType: text('ref_value_type'),\n },\n (table) => {\n return {\n uniqueNameModelId: unique('unique_name_model_id').on(\n table.name,\n table.modelId,\n ),\n }\n },\n)\n\nexport const propertiesRelations = relations(properties, ({ one }) => ({\n model: one(models),\n refModel: one(models),\n}))\n\nexport type NewPropertyRecord = typeof properties.$inferInsert\nexport type PropertyType = typeof properties.$inferSelect\n"],"names":[],"mappings":";;;AAGa,MAAA,MAAM,GAAG,WAAW,CAAC,QAAQ,EAAE;AAC1C,IAAA,EAAE,EAAE,GAA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E,GAAG,CAAC,MAAM,CAAC;AACtB,CAAA,CAAC;;;;"}
1
+ {"version":3,"file":"ModelSchema.js","sources":["../../../../src/seedSchema/ModelSchema.ts"],"sourcesContent":["import { int, sqliteTable, text, unique } from 'drizzle-orm/sqlite-core'\nimport { relations } from 'drizzle-orm'\nimport { InferInsertModel, InferSelectModel } from 'drizzle-orm'\nexport const models = sqliteTable('models', {\n id: int('id').primaryKey({ autoIncrement: true }),\n name: text('name').notNull(),\n})\n\nexport const modelsRelations = relations(models, ({ many }) => ({\n properties: many(properties),\n}))\n\nexport type NewModelRecord = typeof models.$inferInsert\nexport type ModelRecordType = typeof models.$inferSelect\n\nexport const properties = sqliteTable(\n 'properties',\n {\n id: int('id').primaryKey({ autoIncrement: true }),\n name: text('name').notNull(),\n dataType: text('data_type').notNull(),\n readEndpoint: text('read_endpoint'),\n updateEndpoint: text('update_endpoint'),\n modelId: int('model_id')\n .notNull()\n .references(() => models.id),\n refModelId: int('ref_model_id').references(() => models.id),\n refValueType: text('ref_value_type'),\n },\n (table) => {\n return {\n uniqueNameModelId: unique('unique_name_model_id').on(\n table.name,\n table.modelId,\n ),\n }\n },\n)\n\nexport const propertiesRelations = relations(properties, ({ one }) => ({\n model: one(models),\n refModel: one(models),\n}))\n\nexport type NewPropertyRecord = InferInsertModel<typeof properties>\nexport type PropertyType = InferSelectModel<typeof properties>\n"],"names":[],"mappings":";;;AAGa,MAAA,MAAM,GAAG,WAAW,CAAC,QAAQ,EAAE;AAC1C,IAAA,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AACjD,IAAA,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;AAC7B,CAAA;AAE8B,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM;AAC9D,IAAA,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC;AAC7B,CAAA,CAAC;AAKW,MAAA,UAAU,GAAG,WAAW,CACnC,YAAY,EACZ;AACE,IAAA,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AACjD,IAAA,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;AAC5B,IAAA,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE;AACrC,IAAA,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC;AACnC,IAAA,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC;AACvC,IAAA,OAAO,EAAE,GAAG,CAAC,UAAU;AACpB,SAAA,OAAO;AACP,SAAA,UAAU,CAAC,MAAM,MAAM,CAAC,EAAE,CAAC;AAC9B,IAAA,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC,UAAU,CAAC,MAAM,MAAM,CAAC,EAAE,CAAC;AAC3D,IAAA,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC;CACrC,EACD,CAAC,KAAK,KAAI;IACR,OAAO;AACL,QAAA,iBAAiB,EAAE,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAClD,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,OAAO,CACd;KACF;AACH,CAAC;AAGgC,SAAS,CAAC,UAAU,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM;AACrE,IAAA,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC;AAClB,IAAA,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC;AACtB,CAAA,CAAC;;;;"}
@@ -0,0 +1,18 @@
1
+ import { sqliteTable, int, text } from 'drizzle-orm/sqlite-core';
2
+ import { relations } from 'drizzle-orm';
3
+ import { models, properties } from './ModelSchema.js';
4
+
5
+ const propertyUids = sqliteTable('property_uids', {
6
+ id: int('id').primaryKey({ autoIncrement: true }),
7
+ uid: text('uid').notNull(),
8
+ propertyId: int('property_id')
9
+ .notNull()
10
+ .unique()
11
+ .references(() => models.id),
12
+ });
13
+ relations(propertyUids, ({ one }) => ({
14
+ property: one(properties),
15
+ }));
16
+
17
+ export { propertyUids };
18
+ //# sourceMappingURL=PropertyUidSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyUidSchema.js","sources":["../../../../src/seedSchema/PropertyUidSchema.ts"],"sourcesContent":["import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\nimport { relations } from 'drizzle-orm'\nimport { models, properties } from './ModelSchema'\n\nexport const propertyUids = sqliteTable('property_uids', {\n id: int('id').primaryKey({ autoIncrement: true }),\n uid: text('uid').notNull(),\n propertyId: int('property_id')\n .notNull()\n .unique()\n .references(() => models.id),\n})\n\nexport const propertyUidRelations = relations(propertyUids, ({ one }) => ({\n property: one(properties),\n}))\n"],"names":[],"mappings":";;;;AAIa,MAAA,YAAY,GAAG,WAAW,CAAC,eAAe,EAAE;AACvD,IAAA,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AACjD,IAAA,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE;AAC1B,IAAA,UAAU,EAAE,GAAG,CAAC,aAAa;AAC1B,SAAA,OAAO;AACP,SAAA,MAAM;AACN,SAAA,UAAU,CAAC,MAAM,MAAM,CAAC,EAAE,CAAC;AAC/B,CAAA;AAEmC,SAAS,CAAC,YAAY,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM;AACxE,IAAA,QAAQ,EAAE,GAAG,CAAC,UAAU,CAAC;AAC1B,CAAA,CAAC;;;;"}