@seedprotocol/sdk 0.3.12 → 0.3.13

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 (237) hide show
  1. package/dist/bin.js +6 -8
  2. package/dist/bin.js.map +1 -1
  3. package/dist/main.js +3 -4
  4. package/dist/main.js.map +1 -1
  5. package/dist/node/db/node.app.db.config.ts +1 -4
  6. package/dist/scripts/bin.d.ts.map +1 -1
  7. package/dist/seedSchema/AppStateSchema.ts +2 -2
  8. package/dist/seedSchema/ConfigSchema.ts +15 -0
  9. package/dist/seedSchema/MetadataSchema.ts +1 -2
  10. package/dist/seedSchema/ModelSchema.ts +3 -3
  11. package/dist/seedSchema/SeedSchema.ts +1 -2
  12. package/dist/seedSchema/VersionSchema.ts +1 -2
  13. package/dist/seedSchema/index.ts +3 -4
  14. package/dist/src/Item/BaseItem.d.ts +1 -1
  15. package/dist/src/Item/BaseItem.d.ts.map +1 -1
  16. package/dist/src/Item/BaseItem.js.map +1 -1
  17. package/dist/src/ItemProperty/BaseItemProperty.d.ts +192 -55
  18. package/dist/src/ItemProperty/BaseItemProperty.d.ts.map +1 -1
  19. package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts +1 -2
  20. package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
  21. package/dist/src/ItemProperty/service/actors/hydrateFromDb.js +3 -4
  22. package/dist/src/ItemProperty/service/actors/hydrateFromDb.js.map +1 -1
  23. package/dist/src/ItemProperty/service/actors/initialize.d.ts +1 -2
  24. package/dist/src/ItemProperty/service/actors/initialize.d.ts.map +1 -1
  25. package/dist/src/ItemProperty/service/actors/resolveRelatedValue.d.ts +1 -2
  26. package/dist/src/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
  27. package/dist/src/ItemProperty/service/actors/resolveRemoteStorage.d.ts +1 -2
  28. package/dist/src/ItemProperty/service/actors/resolveRemoteStorage.d.ts.map +1 -1
  29. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts +2 -2
  30. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
  31. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts +2 -2
  32. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +1 -1
  33. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts +2 -2
  34. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -1
  35. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.js +3 -4
  36. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.js.map +1 -1
  37. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts +2 -2
  38. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +1 -1
  39. package/dist/src/ItemProperty/service/actors/waitForDb.d.ts +2 -2
  40. package/dist/src/ItemProperty/service/actors/waitForDb.d.ts.map +1 -1
  41. package/dist/src/ItemProperty/service/propertyMachine.d.ts +195 -60
  42. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  43. package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
  44. package/dist/src/browser/helpers/ArweaveClient.js +1 -0
  45. package/dist/src/browser/helpers/ArweaveClient.js.map +1 -1
  46. package/dist/src/browser/helpers/EasClient.d.ts.map +1 -1
  47. package/dist/src/browser/react/services.d.ts +1 -1
  48. package/dist/src/browser/react/services.js +3 -4
  49. package/dist/src/browser/react/services.js.map +1 -1
  50. package/dist/src/client/ClientManager.d.ts +14 -14
  51. package/dist/src/client/ClientManager.js +3 -4
  52. package/dist/src/client/ClientManager.js.map +1 -1
  53. package/dist/src/client/actors/initialize.d.ts +1 -1
  54. package/dist/src/client/actors/initialize.d.ts.map +1 -1
  55. package/dist/src/client/actors/initialize.js +15 -54
  56. package/dist/src/client/actors/initialize.js.map +1 -1
  57. package/dist/src/client/actors/saveAppState.js +3 -4
  58. package/dist/src/client/actors/saveAppState.js.map +1 -1
  59. package/dist/src/client/clientManagerMachine.d.ts +7 -7
  60. package/dist/src/client/index.d.ts +1 -1
  61. package/dist/src/client/index.d.ts.map +1 -1
  62. package/dist/src/db/Db/BaseDb.d.ts +1 -2
  63. package/dist/src/db/Db/BaseDb.d.ts.map +1 -1
  64. package/dist/src/db/Db/BaseDb.js +0 -3
  65. package/dist/src/db/Db/BaseDb.js.map +1 -1
  66. package/dist/src/db/read/getExistingItem.js +3 -4
  67. package/dist/src/db/read/getExistingItem.js.map +1 -1
  68. package/dist/src/db/read/getItemData.js +3 -4
  69. package/dist/src/db/read/getItemData.js.map +1 -1
  70. package/dist/src/db/read/getItemProperties.js +3 -4
  71. package/dist/src/db/read/getItemProperties.js.map +1 -1
  72. package/dist/src/db/read/getItemProperty.js +3 -4
  73. package/dist/src/db/read/getItemProperty.js.map +1 -1
  74. package/dist/src/db/read/getItems.js +3 -4
  75. package/dist/src/db/read/getItems.js.map +1 -1
  76. package/dist/src/db/read/getMetadata.js +3 -4
  77. package/dist/src/db/read/getMetadata.js.map +1 -1
  78. package/dist/src/db/read/getModelSchemas.js +3 -4
  79. package/dist/src/db/read/getModelSchemas.js.map +1 -1
  80. package/dist/src/db/read/getModels.js +3 -4
  81. package/dist/src/db/read/getModels.js.map +1 -1
  82. package/dist/src/db/read/getPropertyData.js +3 -4
  83. package/dist/src/db/read/getPropertyData.js.map +1 -1
  84. package/dist/src/db/read/getRelationValueData.js +3 -4
  85. package/dist/src/db/read/getRelationValueData.js.map +1 -1
  86. package/dist/src/db/read/getSeedData.js +3 -4
  87. package/dist/src/db/read/getSeedData.js.map +1 -1
  88. package/dist/src/db/read/getStorageTransactionIdForSeedUid.js +3 -4
  89. package/dist/src/db/read/getStorageTransactionIdForSeedUid.js.map +1 -1
  90. package/dist/src/db/read/getVersionData.js +3 -4
  91. package/dist/src/db/read/getVersionData.js.map +1 -1
  92. package/dist/src/db/read/subqueries/metadataLatest.js +3 -4
  93. package/dist/src/db/read/subqueries/metadataLatest.js.map +1 -1
  94. package/dist/src/db/read/subqueries/versionData.js +3 -4
  95. package/dist/src/db/read/subqueries/versionData.js.map +1 -1
  96. package/dist/src/db/write/createMetadata.js +3 -4
  97. package/dist/src/db/write/createMetadata.js.map +1 -1
  98. package/dist/src/db/write/createSeed.js +3 -4
  99. package/dist/src/db/write/createSeed.js.map +1 -1
  100. package/dist/src/db/write/createSeeds.js +3 -4
  101. package/dist/src/db/write/createSeeds.js.map +1 -1
  102. package/dist/src/db/write/createVersion.js +3 -4
  103. package/dist/src/db/write/createVersion.js.map +1 -1
  104. package/dist/src/db/write/deleteItem.js +3 -4
  105. package/dist/src/db/write/deleteItem.js.map +1 -1
  106. package/dist/src/db/write/saveAppState.js +3 -4
  107. package/dist/src/db/write/saveAppState.js.map +1 -1
  108. package/dist/src/db/write/saveMetadata.js +3 -4
  109. package/dist/src/db/write/saveMetadata.js.map +1 -1
  110. package/dist/src/db/write/updateItemPropertyValue.js +3 -4
  111. package/dist/src/db/write/updateItemPropertyValue.js.map +1 -1
  112. package/dist/src/db/write/updateMetadata.js +3 -4
  113. package/dist/src/db/write/updateMetadata.js.map +1 -1
  114. package/dist/src/events/files/download.js +3 -4
  115. package/dist/src/events/files/download.js.map +1 -1
  116. package/dist/src/events/item/syncDbWithEas.js +3 -4
  117. package/dist/src/events/item/syncDbWithEas.js.map +1 -1
  118. package/dist/src/helpers/FileManager/BaseFileManager.d.ts +1 -4
  119. package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
  120. package/dist/src/helpers/FileManager/BaseFileManager.js +0 -9
  121. package/dist/src/helpers/FileManager/BaseFileManager.js.map +1 -1
  122. package/dist/src/helpers/db.js +3 -4
  123. package/dist/src/helpers/db.js.map +1 -1
  124. package/dist/src/helpers/environment.js +1 -6
  125. package/dist/src/helpers/environment.js.map +1 -1
  126. package/dist/src/helpers/index.d.ts +0 -8
  127. package/dist/src/helpers/index.d.ts.map +1 -1
  128. package/dist/src/helpers/index.js +1 -2
  129. package/dist/src/helpers/index.js.map +1 -1
  130. package/dist/src/interfaces/IItem.d.ts +1 -1
  131. package/dist/src/interfaces/IItem.d.ts.map +1 -1
  132. package/dist/src/node/PathResolver.d.ts +11 -2
  133. package/dist/src/node/PathResolver.d.ts.map +1 -1
  134. package/dist/src/node/PathResolver.js +5 -12
  135. package/dist/src/node/PathResolver.js.map +1 -1
  136. package/dist/src/node/codegen/drizzle.js +2 -36
  137. package/dist/src/node/codegen/drizzle.js.map +1 -1
  138. package/dist/src/node/db/Db.d.ts.map +1 -1
  139. package/dist/src/node/db/node.app.db.config.d.ts.map +1 -1
  140. package/dist/src/node/helpers/ArweaveClient.d.ts.map +1 -1
  141. package/dist/src/node/helpers/ArweaveClient.js +1 -0
  142. package/dist/src/node/helpers/ArweaveClient.js.map +1 -1
  143. package/dist/src/node/helpers/EasClient.d.ts.map +1 -1
  144. package/dist/src/node/helpers/EasClient.js +13 -0
  145. package/dist/src/node/helpers/EasClient.js.map +1 -0
  146. package/dist/src/node/helpers/FileManager.d.ts +0 -4
  147. package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
  148. package/dist/src/seedSchema/AppStateSchema.d.ts +1 -2
  149. package/dist/src/seedSchema/AppStateSchema.d.ts.map +1 -1
  150. package/dist/src/seedSchema/AppStateSchema.js.map +1 -1
  151. package/dist/src/seedSchema/ConfigSchema.d.ts +97 -0
  152. package/dist/src/seedSchema/ConfigSchema.d.ts.map +1 -0
  153. package/dist/src/seedSchema/ConfigSchema.js +18 -0
  154. package/dist/src/seedSchema/ConfigSchema.js.map +1 -0
  155. package/dist/src/seedSchema/MetadataSchema.d.ts +1 -2
  156. package/dist/src/seedSchema/MetadataSchema.d.ts.map +1 -1
  157. package/dist/src/seedSchema/MetadataSchema.js.map +1 -1
  158. package/dist/src/seedSchema/ModelSchema.d.ts +2 -3
  159. package/dist/src/seedSchema/ModelSchema.d.ts.map +1 -1
  160. package/dist/src/seedSchema/ModelSchema.js.map +1 -1
  161. package/dist/src/seedSchema/SeedSchema.d.ts +1 -2
  162. package/dist/src/seedSchema/SeedSchema.d.ts.map +1 -1
  163. package/dist/src/seedSchema/SeedSchema.js.map +1 -1
  164. package/dist/src/seedSchema/VersionSchema.d.ts +1 -2
  165. package/dist/src/seedSchema/VersionSchema.d.ts.map +1 -1
  166. package/dist/src/seedSchema/VersionSchema.js.map +1 -1
  167. package/dist/src/seedSchema/index.d.ts +3 -4
  168. package/dist/src/seedSchema/index.d.ts.map +1 -1
  169. package/dist/src/services/allItems/actors/fetchRelatedItems.js +3 -4
  170. package/dist/src/services/allItems/actors/fetchRelatedItems.js.map +1 -1
  171. package/dist/src/services/allItems/actors/initialize.js +3 -4
  172. package/dist/src/services/allItems/actors/initialize.js.map +1 -1
  173. package/dist/src/services/db/actors/checkStatus.d.ts.map +1 -1
  174. package/dist/src/services/db/actors/checkStatus.js +3 -9
  175. package/dist/src/services/db/actors/checkStatus.js.map +1 -1
  176. package/dist/src/services/db/actors/migrate.d.ts.map +1 -1
  177. package/dist/src/services/db/actors/migrate.js +2 -9
  178. package/dist/src/services/db/actors/migrate.js.map +1 -1
  179. package/dist/src/services/db/actors/waitForFiles.d.ts.map +1 -1
  180. package/dist/src/services/db/actors/waitForFiles.js +1 -3
  181. package/dist/src/services/db/actors/waitForFiles.js.map +1 -1
  182. package/dist/src/services/db/dbMachine.d.ts.map +1 -1
  183. package/dist/src/services/db/dbMachine.js +0 -1
  184. package/dist/src/services/db/dbMachine.js.map +1 -1
  185. package/dist/src/services/global/actors/addModelsToDb.js +3 -4
  186. package/dist/src/services/global/actors/addModelsToDb.js.map +1 -1
  187. package/dist/src/services/global/actors/initialize.d.ts +1 -6
  188. package/dist/src/services/global/actors/initialize.d.ts.map +1 -1
  189. package/dist/src/services/global/actors/initialize.js +4 -6
  190. package/dist/src/services/global/actors/initialize.js.map +1 -1
  191. package/dist/src/services/global/globalMachine.d.ts +611 -80
  192. package/dist/src/services/global/globalMachine.d.ts.map +1 -1
  193. package/dist/src/services/internal/actors/loadAppDb.d.ts.map +1 -1
  194. package/dist/src/services/internal/actors/loadAppDb.js +1 -2
  195. package/dist/src/services/internal/actors/loadAppDb.js.map +1 -1
  196. package/dist/src/services/internal/actors/saveConfig.d.ts.map +1 -1
  197. package/dist/src/services/internal/actors/saveConfig.js +16 -5
  198. package/dist/src/services/internal/actors/saveConfig.js.map +1 -1
  199. package/dist/src/services/internal/actors/validateInput.d.ts +2 -9
  200. package/dist/src/services/internal/actors/validateInput.d.ts.map +1 -1
  201. package/dist/src/services/internal/actors/validateInput.js +1 -4
  202. package/dist/src/services/internal/actors/validateInput.js.map +1 -1
  203. package/dist/src/services/internal/internalMachine.d.ts +3 -33
  204. package/dist/src/services/internal/internalMachine.d.ts.map +1 -1
  205. package/dist/src/services/internal/internalMachine.js +5 -9
  206. package/dist/src/services/internal/internalMachine.js.map +1 -1
  207. package/dist/src/services/publish/actors/preparePublishRequestData.js +3 -4
  208. package/dist/src/services/publish/actors/preparePublishRequestData.js.map +1 -1
  209. package/dist/src/types/fileManager.d.ts +0 -13
  210. package/dist/src/types/fileManager.d.ts.map +1 -1
  211. package/dist/src/types/item.d.ts +8 -9
  212. package/dist/src/types/item.d.ts.map +1 -1
  213. package/dist/src/types/machines.d.ts.map +1 -1
  214. package/package.json +3 -12
  215. package/dist/addModel.js +0 -93
  216. package/dist/addModel.js.map +0 -1
  217. package/dist/protos/seed.proto +0 -97
  218. package/dist/rpcServer.js +0 -399
  219. package/dist/rpcServer.js.map +0 -1
  220. package/dist/scripts/addModel.d.ts +0 -3
  221. package/dist/scripts/addModel.d.ts.map +0 -1
  222. package/dist/scripts/rpcServer.cursor.d.ts +0 -2
  223. package/dist/scripts/rpcServer.cursor.d.ts.map +0 -1
  224. package/dist/scripts/rpcServer.d.ts +0 -9
  225. package/dist/scripts/rpcServer.d.ts.map +0 -1
  226. package/dist/scripts/vite.config.d.ts +0 -3
  227. package/dist/scripts/vite.config.d.ts.map +0 -1
  228. package/dist/src/node/Item/Item.js +0 -11
  229. package/dist/src/node/Item/Item.js.map +0 -1
  230. package/dist/src/node/ItemProperty/ItemProperty.js +0 -10
  231. package/dist/src/node/ItemProperty/ItemProperty.js.map +0 -1
  232. package/dist/src/node/db/Db.js +0 -72
  233. package/dist/src/node/db/Db.js.map +0 -1
  234. package/dist/src/node/helpers/FileManager.js +0 -67
  235. package/dist/src/node/helpers/FileManager.js.map +0 -1
  236. package/dist/src/seedSchema/PropertyUidSchema.js +0 -18
  237. package/dist/src/seedSchema/PropertyUidSchema.js.map +0 -1
@@ -8,7 +8,7 @@ import fs from 'fs';
8
8
  import { PathResolver } from '../PathResolver.js';
9
9
  import debug from 'debug';
10
10
 
11
- const logger = debug('seedSdk:codegen:drizzle');
11
+ debug('seedSdk:codegen:drizzle');
12
12
  const TemplateLoader = {
13
13
  getSource: (name) => {
14
14
  const pathResolver = PathResolver.getInstance();
@@ -68,40 +68,6 @@ const createDrizzleSchemaFilesFromConfig = async (configFilePath, outputDirPath)
68
68
  await fs.promises.writeFile(filePath, code).catch((e) => console.error(e));
69
69
  }
70
70
  };
71
- // Helper to determine TypeScript type based on property type
72
- const seedTypeToJsType = (propertyType) => {
73
- switch (propertyType) {
74
- case 'Text':
75
- return 'string';
76
- case 'Number':
77
- return 'number';
78
- case 'Boolean':
79
- return 'boolean';
80
- case 'Date':
81
- return 'string';
82
- case 'List':
83
- return 'string[]';
84
- case 'Relation':
85
- return 'string';
86
- case 'Image':
87
- return 'string';
88
- case 'File':
89
- return 'string';
90
- default:
91
- return 'any';
92
- }
93
- };
94
- const generateModelCode = (values) => {
95
- const { modelName, properties } = values;
96
- const pathResolver = PathResolver.getInstance();
97
- const { templatePath } = pathResolver.getAppPaths();
98
- if (modelName === 'Text' || modelName === 'TestModel') {
99
- logger(`Model name is ${modelName}.`);
100
- }
101
- const njkEnv = new nunjucks.Environment(new nunjucks.FileSystemLoader(templatePath));
102
- njkEnv.addFilter('seedTypeToJsType', seedTypeToJsType);
103
- return njkEnv.render('model.njk', { modelName, properties });
104
- };
105
71
 
106
- export { createDrizzleSchemaFilesFromConfig, generateDrizzleSchemaCode, generateModelCode };
72
+ export { createDrizzleSchemaFilesFromConfig, generateDrizzleSchemaCode };
107
73
  //# sourceMappingURL=drizzle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"drizzle.js","sources":["../../../../../src/node/codegen/drizzle.ts"],"sourcesContent":["import path from 'path'\nimport pluralize from 'pluralize'\nimport { camelCase, snakeCase } from 'lodash-es'\nimport * as nunjucks from 'nunjucks'\nimport { ILoader } from 'nunjucks'\nimport { ModelClassType } from '@/types'\nimport { SCHEMA_NJK } from '@/helpers/constants'\nimport { getTsImport } from '@/node/helpers'\nimport fs from 'fs'\nimport {PathResolver} from '@/node/PathResolver'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:codegen:drizzle')\n\n\nconst TemplateLoader: ILoader = {\n getSource: (name: string) => {\n const pathResolver = PathResolver.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\nconst env = new nunjucks.Environment(TemplateLoader)\n\nenv.addFilter('camelCase', camelCase)\nenv.addFilter('snakeCase', snakeCase)\nenv.addFilter('pluralize', pluralize)\n\nconst refNamesToExcludeFromRelations = [\n 'Text',\n 'Number',\n 'Boolean',\n 'Date',\n]\n\nexport const generateDrizzleSchemaCode = (\n modelName: string,\n modelClass: ModelClassType,\n): string => {\n const listProperties = Object.entries(modelClass.schema).filter(\n ([key, propertyDef]) => propertyDef?.dataType === 'List' && !refNamesToExcludeFromRelations.includes(propertyDef?.ref!),\n )\n\n const pathResolver = PathResolver.getInstance()\n const { templatePath } = pathResolver.getAppPaths()\n const filePath = path.join(templatePath, SCHEMA_NJK)\n\n const schemaCode = env.render(filePath, {\n modelName,\n modelClass,\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 = PathResolver.getInstance()\n const { dotSeedDir, appSchemaDir } = pathResolver.getAppPaths()\n console.log('createDrizzleSchemaFilesFromConfig', configFilePath, outputDirPath)\n\n const schemaFilePath = configFilePath || path.join(dotSeedDir, 'schema.ts') // Developer created file with model definitions\n console.log('schemaFilePath', schemaFilePath)\n\n const { models, } = await getTsImport<{\n models: Record<string, ModelClassType>\n }>(schemaFilePath)\n\n const writeToDir = outputDirPath || appSchemaDir\n\n for (const [modelName, modelClass] of Object.entries(models)) {\n const code = 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 'Text':\n return 'string';\n case 'Number':\n return 'number';\n case 'Boolean':\n return 'boolean';\n case 'Date':\n return 'string';\n case 'List':\n return 'string[]';\n case 'Relation':\n return 'string';\n case 'Image':\n return 'string';\n case 'File':\n return 'string';\n default:\n return 'any';\n }\n};\n\n\nexport const generateModelCode = (values: Record<string, any>): string => {\n const { modelName, properties } = values;\n const pathResolver = PathResolver.getInstance()\n const { templatePath } = pathResolver.getAppPaths()\n\n if (modelName === 'Text' || modelName === 'TestModel') {\n logger(`Model name is ${modelName}.`)\n }\n\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"],"names":[],"mappings":";;;;;;;;;;AAYA,MAAM,MAAM,GAAG,KAAK,CA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AAM,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AAC9D;;;;"}
1
+ {"version":3,"file":"drizzle.js","sources":["../../../../../src/node/codegen/drizzle.ts"],"sourcesContent":["import path from 'path'\nimport pluralize from 'pluralize'\nimport { camelCase, snakeCase } from 'lodash-es'\nimport * as nunjucks from 'nunjucks'\nimport { ILoader } from 'nunjucks'\nimport { ModelClassType } from '@/types'\nimport { SCHEMA_NJK } from '@/helpers/constants'\nimport { getTsImport } from '@/node/helpers'\nimport fs from 'fs'\nimport {PathResolver} from '@/node/PathResolver'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:codegen:drizzle')\n\n\nconst TemplateLoader: ILoader = {\n getSource: (name: string) => {\n const pathResolver = PathResolver.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\nconst env = new nunjucks.Environment(TemplateLoader)\n\nenv.addFilter('camelCase', camelCase)\nenv.addFilter('snakeCase', snakeCase)\nenv.addFilter('pluralize', pluralize)\n\nconst refNamesToExcludeFromRelations = [\n 'Text',\n 'Number',\n 'Boolean',\n 'Date',\n]\n\nexport const generateDrizzleSchemaCode = (\n modelName: string,\n modelClass: ModelClassType,\n): string => {\n const listProperties = Object.entries(modelClass.schema).filter(\n ([key, propertyDef]) => propertyDef?.dataType === 'List' && !refNamesToExcludeFromRelations.includes(propertyDef?.ref!),\n )\n\n const pathResolver = PathResolver.getInstance()\n const { templatePath } = pathResolver.getAppPaths()\n const filePath = path.join(templatePath, SCHEMA_NJK)\n\n const schemaCode = env.render(filePath, {\n modelName,\n modelClass,\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 = PathResolver.getInstance()\n const { dotSeedDir, appSchemaDir } = pathResolver.getAppPaths()\n console.log('createDrizzleSchemaFilesFromConfig', configFilePath, outputDirPath)\n\n const schemaFilePath = configFilePath || path.join(dotSeedDir, 'schema.ts') // Developer created file with model definitions\n console.log('schemaFilePath', schemaFilePath)\n\n const { models, } = await getTsImport<{\n models: Record<string, ModelClassType>\n }>(schemaFilePath)\n\n const writeToDir = outputDirPath || appSchemaDir\n\n for (const [modelName, modelClass] of Object.entries(models)) {\n const code = 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 'Text':\n return 'string';\n case 'Number':\n return 'number';\n case 'Boolean':\n return 'boolean';\n case 'Date':\n return 'string';\n case 'List':\n return 'string[]';\n case 'Relation':\n return 'string';\n case 'Image':\n return 'string';\n case 'File':\n return 'string';\n default:\n return 'any';\n }\n};\n\n\nexport const generateModelCode = (values: Record<string, any>): string => {\n const { modelName, properties } = values;\n const pathResolver = PathResolver.getInstance()\n const { templatePath } = pathResolver.getAppPaths()\n\n if (modelName === 'Text' || modelName === 'TestModel') {\n logger(`Model name is ${modelName}.`)\n }\n\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"],"names":[],"mappings":";;;;;;;;;;AAYe,KAAK,CAAC,yBAAyB;AAG9C,MAAM,cAAc,GAAY;AAC9B,IAAA,SAAS,EAAE,CAAC,IAAY,KAAI;AAC1B,QAAA,MAAM,YAAY,GAAG,YAAY,CAAC,WAAW,EAAE;QAC/C,MAAM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AAE9E;;;;"}
@@ -1 +1 @@
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"}
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;AA8B9C,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;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 +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;wBAsBrC,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;wBAmBrC,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,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"}
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"}
@@ -7,6 +7,7 @@ class ArweaveClient extends BaseArweaveClient {
7
7
  return new GraphQLClient(ARWEAVE_ENDPOINT);
8
8
  }
9
9
  }
10
+ BaseArweaveClient.setPlatformClass(ArweaveClient);
10
11
 
11
12
  export { ArweaveClient };
12
13
  //# 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\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
+ {"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 +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;AAED,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;AAID,OAAO,EAAE,SAAS,EAAE,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { BaseEasClient } from '../../helpers/EasClient/BaseEasClient.js';
2
+ import { EAS_ENDPOINT } from '../../services/internal/constants.js';
3
+ import { GraphQLClient } from 'graphql-request';
4
+
5
+ class EasClient extends BaseEasClient {
6
+ static getEasClient() {
7
+ return new GraphQLClient(EAS_ENDPOINT);
8
+ }
9
+ }
10
+ BaseEasClient.setPlatformClass(EasClient);
11
+
12
+ export { EasClient };
13
+ //# sourceMappingURL=EasClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EasClient.js","sources":["../../../../../src/node/helpers/EasClient.ts"],"sourcesContent":["import { BaseEasClient } from \"@/helpers/EasClient/BaseEasClient\"\nimport { EAS_ENDPOINT } from \"@/services/internal/constants\"\nimport { GraphQLClient } from \"graphql-request\"\n\nclass EasClient extends BaseEasClient {\n static getEasClient() {\n return new GraphQLClient(EAS_ENDPOINT)\n }\n}\n\nBaseEasClient.setPlatformClass(EasClient)\n\nexport { EasClient }"],"names":[],"mappings":";;;;AAIA,MAAM,SAAU,SAAQ,aAAa,CAAA;AACnC,IAAA,OAAO,YAAY,GAAA;AACjB,QAAA,OAAO,IAAI,aAAa,CAAC,YAAY,CAAC;;AAEzC;AAED,aAAa,CAAC,gBAAgB,CAAC,SAAS,CAAC;;;;"}
@@ -2,19 +2,15 @@ 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>;
6
5
  static downloadAllFiles(): Promise<void>;
7
6
  static resizeImage(): Promise<void>;
8
7
  static resizeAllImages(): Promise<void>;
9
8
  static pathExists(filePath: string): Promise<boolean>;
10
- static pathExistsSync(filePath: string): boolean;
11
9
  static createDirIfNotExists(filePath: string): Promise<void>;
12
10
  static readFileAsBuffer(filePath: string): Promise<Buffer>;
13
11
  static readFile(filePath: string): Promise<File>;
14
12
  static getParentDirPath(filePath: string): string;
15
13
  static getFilenameFromPath(filePath: string): string;
16
- static getAppPaths(): GetAppPathsReturn;
17
- static joinPaths(...paths: string[]): string;
18
14
  }
19
15
  export { FileManager };
20
16
  //# 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;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"}
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,4 +1,3 @@
1
- import { InferSelectModel } from 'drizzle-orm';
2
1
  export declare const appState: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
3
2
  name: "appState";
4
3
  schema: undefined;
@@ -78,5 +77,5 @@ export declare const appState: import("drizzle-orm/sqlite-core").SQLiteTableWith
78
77
  };
79
78
  dialect: "sqlite";
80
79
  }>;
81
- export type appStateType = InferSelectModel<typeof appState>;
80
+ export type appStateType = appState.$inferSelect;
82
81
  //# sourceMappingURL=AppStateSchema.d.ts.map
@@ -1 +1 @@
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
+ {"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 +1 @@
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
+ {"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;;;;"}
@@ -0,0 +1,97 @@
1
+ export declare const config: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
2
+ name: "config";
3
+ schema: undefined;
4
+ columns: {
5
+ id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
6
+ name: "id";
7
+ tableName: "config";
8
+ dataType: "number";
9
+ columnType: "SQLiteInteger";
10
+ data: number;
11
+ driverParam: number;
12
+ notNull: true;
13
+ hasDefault: true;
14
+ isPrimaryKey: true;
15
+ isAutoincrement: false;
16
+ hasRuntimeDefault: false;
17
+ enumValues: undefined;
18
+ baseColumn: never;
19
+ identity: undefined;
20
+ generated: undefined;
21
+ }, {}, {}>;
22
+ key: import("drizzle-orm/sqlite-core").SQLiteColumn<{
23
+ name: "key";
24
+ tableName: "config";
25
+ dataType: "string";
26
+ columnType: "SQLiteText";
27
+ data: string;
28
+ driverParam: string;
29
+ notNull: true;
30
+ hasDefault: false;
31
+ isPrimaryKey: false;
32
+ isAutoincrement: false;
33
+ hasRuntimeDefault: false;
34
+ enumValues: [string, ...string[]];
35
+ baseColumn: never;
36
+ identity: undefined;
37
+ generated: undefined;
38
+ }, {}, {
39
+ length: number | undefined;
40
+ }>;
41
+ text: import("drizzle-orm/sqlite-core").SQLiteColumn<{
42
+ name: "text";
43
+ tableName: "config";
44
+ dataType: "string";
45
+ columnType: "SQLiteText";
46
+ data: string;
47
+ driverParam: string;
48
+ notNull: false;
49
+ hasDefault: false;
50
+ isPrimaryKey: false;
51
+ isAutoincrement: false;
52
+ hasRuntimeDefault: false;
53
+ enumValues: [string, ...string[]];
54
+ baseColumn: never;
55
+ identity: undefined;
56
+ generated: undefined;
57
+ }, {}, {
58
+ length: number | undefined;
59
+ }>;
60
+ json: import("drizzle-orm/sqlite-core").SQLiteColumn<{
61
+ name: "json";
62
+ tableName: "config";
63
+ dataType: "json";
64
+ columnType: "SQLiteTextJson";
65
+ data: unknown;
66
+ driverParam: string;
67
+ notNull: false;
68
+ hasDefault: false;
69
+ isPrimaryKey: false;
70
+ isAutoincrement: false;
71
+ hasRuntimeDefault: false;
72
+ enumValues: undefined;
73
+ baseColumn: never;
74
+ identity: undefined;
75
+ generated: undefined;
76
+ }, {}, {}>;
77
+ blob: import("drizzle-orm/sqlite-core").SQLiteColumn<{
78
+ name: "blob";
79
+ tableName: "config";
80
+ dataType: "buffer";
81
+ columnType: "SQLiteBlobBuffer";
82
+ data: Buffer<ArrayBufferLike>;
83
+ driverParam: Buffer<ArrayBufferLike>;
84
+ notNull: false;
85
+ hasDefault: false;
86
+ isPrimaryKey: false;
87
+ isAutoincrement: false;
88
+ hasRuntimeDefault: false;
89
+ enumValues: undefined;
90
+ baseColumn: never;
91
+ identity: undefined;
92
+ generated: undefined;
93
+ }, {}, {}>;
94
+ };
95
+ dialect: "sqlite";
96
+ }>;
97
+ //# sourceMappingURL=ConfigSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigSchema.d.ts","sourceRoot":"","sources":["../../../src/seedSchema/ConfigSchema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWjB,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { sqliteTable, blob, text, int, check } from 'drizzle-orm/sqlite-core';
2
+ import { sql } from 'drizzle-orm';
3
+
4
+ const config = sqliteTable('config', {
5
+ id: int('id').primaryKey({ autoIncrement: true }),
6
+ key: text('key').notNull(),
7
+ text: text('text'),
8
+ json: text('json', { mode: 'json' }),
9
+ blob: blob('blob', { mode: 'buffer' }),
10
+ }, () => {
11
+ return {
12
+ // Add a custom check constraint
13
+ atLeastOneNotNull: check('hasValue', sql `key IS NOT NULL OR text IS NOT NULL OR json IS NOT NULL OR blob IS NOT NULL`),
14
+ };
15
+ });
16
+
17
+ export { config };
18
+ //# sourceMappingURL=ConfigSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigSchema.js","sources":["../../../../src/seedSchema/ConfigSchema.ts"],"sourcesContent":["import { blob, int, sqliteTable, text, check, } from 'drizzle-orm/sqlite-core'\nimport { sql } from 'drizzle-orm'\n\nexport const config = sqliteTable('config', {\n id: int('id').primaryKey({ autoIncrement: true }),\n key: text('key').notNull(),\n text: text('text'),\n json: text('json', {mode: 'json'}),\n blob: blob('blob', {mode: 'buffer'}),\n}, () => {\n return {\n // Add a custom check constraint\n atLeastOneNotNull: check('hasValue', sql`key IS NOT NULL OR text IS NOT NULL OR json IS NOT NULL OR blob IS NOT NULL`),\n }\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,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE;AAC1B,IAAA,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;IAClC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,CAAC;AACrC,CAAA,EAAE,MAAK;IACN,OAAO;;QAEL,iBAAiB,EAAE,KAAK,CAAC,UAAU,EAAE,GAAG,CAAA,6EAA6E,CAAC;KACvH;AACH,CAAC;;;;"}
@@ -1,4 +1,3 @@
1
- import { InferSelectModel } from 'drizzle-orm';
2
1
  export declare const metadata: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
3
2
  name: "metadata";
4
3
  schema: undefined;
@@ -418,5 +417,5 @@ export declare const metadata: import("drizzle-orm/sqlite-core").SQLiteTableWith
418
417
  };
419
418
  dialect: "sqlite";
420
419
  }>;
421
- export type MetadataType = InferSelectModel<typeof metadata>;
420
+ export type MetadataType = metadata.$inferSelect;
422
421
  //# sourceMappingURL=MetadataSchema.d.ts.map
@@ -1 +1 @@
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
+ {"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 +1 @@
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
+ {"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,4 +1,3 @@
1
- import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
2
1
  export declare const models: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
3
2
  name: "models";
4
3
  schema: undefined;
@@ -204,6 +203,6 @@ export declare const propertiesRelations: import("drizzle-orm").Relations<"prope
204
203
  model: import("drizzle-orm").One<"models", false>;
205
204
  refModel: import("drizzle-orm").One<"models", false>;
206
205
  }>;
207
- export type NewPropertyRecord = InferInsertModel<typeof properties>;
208
- export type PropertyType = InferSelectModel<typeof properties>;
206
+ export type NewPropertyRecord = typeof properties.$inferInsert;
207
+ export type PropertyType = typeof properties.$inferSelect;
209
208
  //# sourceMappingURL=ModelSchema.d.ts.map
@@ -1 +1 @@
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
+ {"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 +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'\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;;;;"}
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,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AACjD,IAAA,IAAI,EAAE,IAAI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1
  export declare const seeds: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
3
2
  name: "seeds";
4
3
  schema: undefined;
@@ -169,5 +168,5 @@ export declare const seeds: import("drizzle-orm/sqlite-core").SQLiteTableWithCol
169
168
  };
170
169
  dialect: "sqlite";
171
170
  }>;
172
- export type SeedType = InferSelectModel<typeof seeds>;
171
+ export type SeedType = seeds.$inferSelect;
173
172
  //# sourceMappingURL=SeedSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SeedSchema.d.ts","sourceRoot":"","sources":["../../../src/seedSchema/SeedSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAG9C,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBjB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,gBAAgB,CAAC,OAAO,KAAK,CAAC,CAAA"}
1
+ {"version":3,"file":"SeedSchema.d.ts","sourceRoot":"","sources":["../../../src/seedSchema/SeedSchema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBjB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SeedSchema.js","sources":["../../../../src/seedSchema/SeedSchema.ts"],"sourcesContent":["import { InferSelectModel } from 'drizzle-orm'\nimport { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\n\nexport const seeds = sqliteTable(\n 'seeds',\n {\n localId: text('local_id').unique(),\n uid: text('uid'),\n schemaUid: text('schema_uid'),\n type: text('type'),\n attestationRaw: text('attestation_raw'),\n attestationCreatedAt: int('attestation_created_at'),\n createdAt: int('created_at'),\n updatedAt: int('updated_at'),\n _markedForDeletion: int('_marked_for_deletion'),\n },\n // {\n // triggers: [\n // sql<string>`CREATE TRIGGER IF NOT EXISTS seeds_created_at_trigger\n // BEFORE INSERT\n // ON seeds\n // FOR EACH ROW\n // BEGIN\n // SELECT strftime('%s', 'now') * 1000 INTO NEW.created_at;\n // END;`,\n // ],\n // },\n)\n\nexport type SeedType = InferSelectModel<typeof seeds>\n"],"names":[],"mappings":";;AAGa,MAAA,KAAK,GAAG,WAAW,CAC9B,OAAO,EACP;AACE,IAAA,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;AAClC,IAAA,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC;AAChB,IAAA,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;AAC7B,IAAA,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;AAClB,IAAA,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC;AACvC,IAAA,oBAAoB,EAAE,GAAG,CAAC,wBAAwB,CAAC;AACnD,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC5B,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC5B,IAAA,kBAAkB,EAAE,GAAG,CAAC,sBAAsB,CAAC;AAChD,CAAA;;;;"}
1
+ {"version":3,"file":"SeedSchema.js","sources":["../../../../src/seedSchema/SeedSchema.ts"],"sourcesContent":["import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\n\nexport const seeds = sqliteTable(\n 'seeds',\n {\n localId: text('local_id').unique(),\n uid: text('uid'),\n schemaUid: text('schema_uid'),\n type: text('type'),\n attestationRaw: text('attestation_raw'),\n attestationCreatedAt: int('attestation_created_at'),\n createdAt: int('created_at'),\n updatedAt: int('updated_at'),\n _markedForDeletion: int('_marked_for_deletion'),\n },\n // {\n // triggers: [\n // sql<string>`CREATE TRIGGER IF NOT EXISTS seeds_created_at_trigger\n // BEFORE INSERT\n // ON seeds\n // FOR EACH ROW\n // BEGIN\n // SELECT strftime('%s', 'now') * 1000 INTO NEW.created_at;\n // END;`,\n // ],\n // },\n)\n\nexport type SeedType = seeds.$inferSelect\n"],"names":[],"mappings":";;AAEa,MAAA,KAAK,GAAG,WAAW,CAC9B,OAAO,EACP;AACE,IAAA,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;AAClC,IAAA,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC;AAChB,IAAA,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;AAC7B,IAAA,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;AAClB,IAAA,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC;AACvC,IAAA,oBAAoB,EAAE,GAAG,CAAC,wBAAwB,CAAC;AACnD,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC5B,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC5B,IAAA,kBAAkB,EAAE,GAAG,CAAC,sBAAsB,CAAC;AAChD,CAAA;;;;"}
@@ -1,4 +1,3 @@
1
- import { InferSelectModel } from 'drizzle-orm';
2
1
  export declare const versions: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
3
2
  name: "versions";
4
3
  schema: undefined;
@@ -190,5 +189,5 @@ export declare const versions: import("drizzle-orm/sqlite-core").SQLiteTableWith
190
189
  };
191
190
  dialect: "sqlite";
192
191
  }>;
193
- export type VersionsType = InferSelectModel<typeof versions>;
192
+ export type VersionsType = versions.$inferSelect;
194
193
  //# sourceMappingURL=VersionSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VersionSchema.d.ts","sourceRoot":"","sources":["../../../src/seedSchema/VersionSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWnB,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,QAAQ,CAAC,CAAA"}
1
+ {"version":3,"file":"VersionSchema.d.ts","sourceRoot":"","sources":["../../../src/seedSchema/VersionSchema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWnB,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"VersionSchema.js","sources":["../../../../src/seedSchema/VersionSchema.ts"],"sourcesContent":["import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\nimport { InferSelectModel } from 'drizzle-orm'\n\nexport const versions = sqliteTable('versions', {\n localId: text('local_id').unique(),\n uid: text('uid'),\n seedLocalId: text('seed_local_id'),\n seedUid: text('seed_uid'),\n seedType: text('seed_type'),\n note: text('note'),\n createdAt: int('created_at'),\n updatedAt: int('updated_at'),\n attestationCreatedAt: int('attestation_created_at'),\n attestationRaw: text('attestation_raw'),\n})\n\nexport type VersionsType = InferSelectModel<typeof versions>\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,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC;AAClC,IAAA,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;AACzB,IAAA,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC;AAC3B,IAAA,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;AAClB,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC5B,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC5B,IAAA,oBAAoB,EAAE,GAAG,CAAC,wBAAwB,CAAC;AACnD,IAAA,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC;AACxC,CAAA;;;;"}
1
+ {"version":3,"file":"VersionSchema.js","sources":["../../../../src/seedSchema/VersionSchema.ts"],"sourcesContent":["import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'\n\nexport const versions = sqliteTable('versions', {\n localId: text('local_id').unique(),\n uid: text('uid'),\n seedLocalId: text('seed_local_id'),\n seedUid: text('seed_uid'),\n seedType: text('seed_type'),\n note: text('note'),\n createdAt: int('created_at'),\n updatedAt: int('updated_at'),\n attestationCreatedAt: int('attestation_created_at'),\n attestationRaw: text('attestation_raw'),\n})\n\nexport type VersionsType = versions.$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,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC;AAClC,IAAA,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;AACzB,IAAA,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC;AAC3B,IAAA,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;AAClB,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC5B,IAAA,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC;AAC5B,IAAA,oBAAoB,EAAE,GAAG,CAAC,wBAAwB,CAAC;AACnD,IAAA,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC;AACxC,CAAA;;;;"}
@@ -1,8 +1,7 @@
1
- export * from './AppStateSchema';
1
+ export * from './SeedSchema';
2
+ export * from './VersionSchema';
2
3
  export * from './MetadataSchema';
4
+ export * from './AppStateSchema';
3
5
  export * from './ModelSchema';
4
6
  export * from './ModelUidSchema';
5
- export * from './PropertyUidSchema';
6
- export * from './SeedSchema';
7
- export * from './VersionSchema';
8
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/seedSchema/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/seedSchema/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA"}
@@ -1,12 +1,11 @@
1
1
  import { fromCallback } from 'xstate';
2
2
  import { GET_SEED_IDS, GET_VERSIONS, GET_ALL_PROPERTIES_FOR_ALL_VERSIONS } from '../../../Item/queries.js';
3
- import '../../../seedSchema/AppStateSchema.js';
3
+ import '../../../seedSchema/SeedSchema.js';
4
+ import '../../../seedSchema/VersionSchema.js';
4
5
  import '../../../seedSchema/MetadataSchema.js';
6
+ import '../../../seedSchema/AppStateSchema.js';
5
7
  import { models } from '../../../seedSchema/ModelSchema.js';
6
8
  import { modelUids } from '../../../seedSchema/ModelUidSchema.js';
7
- import '../../../seedSchema/PropertyUidSchema.js';
8
- import '../../../seedSchema/SeedSchema.js';
9
- import '../../../seedSchema/VersionSchema.js';
10
9
  import { getAddressesFromDb } from '../../../helpers/db.js';
11
10
  import { eq } from 'drizzle-orm';
12
11
  import { BaseDb } from '../../../db/Db/BaseDb.js';
@@ -1 +1 @@
1
- {"version":3,"file":"fetchRelatedItems.js","sources":["../../../../../../src/services/allItems/actors/fetchRelatedItems.ts"],"sourcesContent":["import { EventObject, fromCallback } from 'xstate'\nimport {\n GET_ALL_PROPERTIES_FOR_ALL_VERSIONS,\n GET_SEED_IDS,\n GET_VERSIONS,\n} from '@/Item/queries'\nimport {\n models as modelsTable,\n modelUids,\n PropertyType,\n} from '@/seedSchema'\nimport { Attestation } from '@/graphql/gql/graphql'\nimport {\n AllItemsMachineContext,\n FromCallbackInput,\n ModelClassType,\n} from '@/types'\nimport { getAddressesFromDb } from '@/helpers/db'\nimport { eq } from 'drizzle-orm'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { BaseEasClient } from '@/helpers/EasClient/BaseEasClient'\nimport { BaseQueryClient } from '@/helpers/QueryClient/BaseQueryClient'\n\n\nexport const fetchRelatedItems = fromCallback<\n EventObject,\n FromCallbackInput<AllItemsMachineContext>\n>(({ sendBack, input: { context } }) => {\n const { ModelClass, modelName } = context\n\n const appDb = BaseDb.getAppDb()\n\n const relatedProperties = new Map<string, PropertyType>()\n const relatedVersionsBySeedUid = new Map<string, Attestation[]>()\n const schemaUidsByModelName = new Map<string, string>()\n const mostRecentVersionsBySeedUid = new Map<string, Attestation>()\n const mostRecentPropertiesBySeedUid = new Map<string, Attestation[]>()\n const seedUidsByMostRecentVersionUid = new Map<string, string>()\n\n const _fetchRelatedItems = async () => {\n // Get related properties\n for (const [propertyName, propertyDef] of Object.entries(\n (ModelClass as ModelClassType).schema,\n )) {\n if (propertyDef && propertyDef.ref && propertyDef.refModelId) {\n relatedProperties.set(propertyName, propertyDef)\n }\n }\n\n const addresses = await getAddressesFromDb(appDb)\n\n // Get the models they point to from sdkConfigDb\n for (const [propertyName, propertyDef] of relatedProperties.entries()) {\n const relatedModelQuery = await appDb\n .select({\n id: modelsTable.id,\n name: modelsTable.name,\n uid: modelUids.uid,\n })\n .from(modelsTable)\n .leftJoin(modelUids, eq(modelsTable.id, modelUids.modelId))\n .where(eq(modelsTable.id, propertyDef.refModelId))\n .limit(1)\n\n if (relatedModelQuery && relatedModelQuery.length > 0) {\n const relatedModel = relatedModelQuery[0]\n const relatedModelUid = relatedModel.uid\n // Exclude the current model's schemaUid since we already have its versions\n if (relatedModelUid && relatedModelUid !== ModelClass.schemaUid) {\n schemaUidsByModelName.set(relatedModel.name, relatedModelUid)\n }\n }\n }\n\n const queryKey = [`getRelatedSeedIds${modelName}`]\n\n const queryClient = BaseQueryClient.getQueryClient()\n const easClient = BaseEasClient.getEasClient()\n\n const { itemSeedIds: relatedSeedIdAttestations } =\n await queryClient.fetchQuery({\n queryKey,\n queryFn: async () =>\n easClient.request(GET_SEED_IDS, {\n where: {\n schema: {\n is: {\n id: {\n in: Array.from(schemaUidsByModelName.values()),\n },\n },\n },\n attester: {\n in: addresses,\n },\n },\n }),\n })\n\n const relatedSeedIds = relatedSeedIdAttestations.map((seed) => seed.id)\n\n const { itemVersions: relatedVersions } = await queryClient.fetchQuery({\n queryKey: [`getRelatedVersions${modelName}`],\n queryFn: async () =>\n easClient.request(GET_VERSIONS, {\n where: {\n refUID: {\n in: relatedSeedIds,\n },\n attester: {\n in: addresses,\n },\n },\n }),\n })\n\n // Index versions by seedUid\n for (const version of relatedVersions) {\n const existingVersionsForSeedUid =\n relatedVersionsBySeedUid.get(version.refUID) || []\n existingVersionsForSeedUid.push(version)\n relatedVersionsBySeedUid.set(version.refUID, existingVersionsForSeedUid)\n }\n\n // Sort the indexed versions by timeCreated and index the most recent\n for (const [\n seedUid,\n versionsForSeed,\n ] of relatedVersionsBySeedUid.entries()) {\n const versionsForSeedSorted = versionsForSeed.sort(\n (a: Attestation, b: Attestation) => {\n return a.timeCreated - b.timeCreated\n },\n )\n relatedVersionsBySeedUid.set(seedUid, versionsForSeedSorted)\n mostRecentVersionsBySeedUid.set(seedUid, versionsForSeedSorted[0])\n seedUidsByMostRecentVersionUid.set(versionsForSeedSorted[0].id, seedUid)\n }\n\n // Extract the ids of the most recent versions\n const mostRecentVersionIds = Array.from(\n mostRecentVersionsBySeedUid.values(),\n ).map((version) => version.id)\n\n const { allProperties } = await queryClient.fetchQuery({\n queryKey: [`getAllProperties${modelName}`],\n queryFn: async () =>\n easClient.request(GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, {\n where: {\n refUID: {\n in: mostRecentVersionIds,\n },\n attester: {\n in: addresses,\n },\n },\n }),\n })\n\n for (const propertyAttestation of allProperties) {\n const seedUidForProperty = seedUidsByMostRecentVersionUid.get(\n propertyAttestation.refUID,\n )\n const existingPropertiesForSeedUid =\n mostRecentPropertiesBySeedUid.get(seedUidForProperty!) || []\n existingPropertiesForSeedUid.push(propertyAttestation)\n mostRecentPropertiesBySeedUid.set(\n seedUidForProperty!,\n existingPropertiesForSeedUid,\n )\n }\n }\n\n _fetchRelatedItems().then(() => {\n sendBack({\n type: 'fetchRelatedItemsSuccess',\n mostRecentPropertiesBySeedUid,\n relatedVersionsBySeedUid,\n relatedProperties,\n schemaUidsByModelName,\n })\n return\n })\n})\n"],"names":["modelsTable"],"mappings":";;;;;;;;;;;;;;;AAwBa,MAAA,iBAAiB,GAAG,YAAY,CAG3C,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,KAAI;AACrC,I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AAM,WAAW,CAAC,UAAU,CAAC;AACrD,YAAA,QAAQ,EAAE,CAAC,CAAmB,gBAAA,EAAA,SAAS,EAAE,CAAC;YAC1C,OAAO,EAAE,YACP,SAAS,CAAC,OAAO,CAAC,mCAAmC,EAAE;AACrD,gBAAA,KAAK,EAAE;AACL,oBAAA,MAAM,EAAE;AACN,wBAAA,EAAE,EAAE,oBAAoB;AACzB,qBAAA;AACD,oBAAA,QAAQ,EAAE;AACR,wBAAA,EAAE,EAAE,SAAS;AACd,qBAAA;AACF,iBAAA;aACF,CAAC;AACL,SAAA,CAAC;AAEF,QAAA,KAAK,MAAM,mBAAmB,IAAI,aAAa,EAAE;YAC/C,MAAM,kBAAkB,GAAG,8BAA8B,CAAC,GAAG,CAC3D,mBAAmB,CAAC,MAAM,CAC3B;YACD,MAAM,4BAA4B,GAChC,6BAA6B,CAAC,GAAG,CAAC,kBAAmB,CAAC,IAAI,EAAE;AAC9D,YAAA,4BAA4B,CAAC,IAAI,CAAC,mBAAmB,CAAC;AACtD,YAAA,6BAA6B,CAAC,GAAG,CAC/B,kBAAmB,EACnB,4BAA4B,CAC7B;;AAEL,KAAC;AAED,IAAA,kBAAkB,EAAE,CAAC,IAAI,CAAC,MAAK;AAC7B,QAAA,QAAQ,CAAC;AACP,YAAA,IAAI,EAAE,0BAA0B;YAChC,6BAA6B;YAC7B,wBAAwB;YACxB,iBAAiB;YACjB,qBAAqB;AACtB,SAAA,CAAC;QACF;AACF,KAAC,CAAC;AACJ,CAAC;;;;"}
1
+ {"version":3,"file":"fetchRelatedItems.js","sources":["../../../../../../src/services/allItems/actors/fetchRelatedItems.ts"],"sourcesContent":["import { EventObject, fromCallback } from 'xstate'\nimport {\n GET_ALL_PROPERTIES_FOR_ALL_VERSIONS,\n GET_SEED_IDS,\n GET_VERSIONS,\n} from '@/Item/queries'\nimport {\n models as modelsTable,\n modelUids,\n PropertyType,\n} from '@/seedSchema'\nimport { Attestation } from '@/graphql/gql/graphql'\nimport {\n AllItemsMachineContext,\n FromCallbackInput,\n ModelClassType,\n} from '@/types'\nimport { getAddressesFromDb } from '@/helpers/db'\nimport { eq } from 'drizzle-orm'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { BaseEasClient } from '@/helpers/EasClient/BaseEasClient'\nimport { BaseQueryClient } from '@/helpers/QueryClient/BaseQueryClient'\n\n\nexport const fetchRelatedItems = fromCallback<\n EventObject,\n FromCallbackInput<AllItemsMachineContext>\n>(({ sendBack, input: { context } }) => {\n const { ModelClass, modelName } = context\n\n const appDb = BaseDb.getAppDb()\n\n const relatedProperties = new Map<string, PropertyType>()\n const relatedVersionsBySeedUid = new Map<string, Attestation[]>()\n const schemaUidsByModelName = new Map<string, string>()\n const mostRecentVersionsBySeedUid = new Map<string, Attestation>()\n const mostRecentPropertiesBySeedUid = new Map<string, Attestation[]>()\n const seedUidsByMostRecentVersionUid = new Map<string, string>()\n\n const _fetchRelatedItems = async () => {\n // Get related properties\n for (const [propertyName, propertyDef] of Object.entries(\n (ModelClass as ModelClassType).schema,\n )) {\n if (propertyDef && propertyDef.ref && propertyDef.refModelId) {\n relatedProperties.set(propertyName, propertyDef)\n }\n }\n\n const addresses = await getAddressesFromDb(appDb)\n\n // Get the models they point to from sdkConfigDb\n for (const [propertyName, propertyDef] of relatedProperties.entries()) {\n const relatedModelQuery = await appDb\n .select({\n id: modelsTable.id,\n name: modelsTable.name,\n uid: modelUids.uid,\n })\n .from(modelsTable)\n .leftJoin(modelUids, eq(modelsTable.id, modelUids.modelId))\n .where(eq(modelsTable.id, propertyDef.refModelId))\n .limit(1)\n\n if (relatedModelQuery && relatedModelQuery.length > 0) {\n const relatedModel = relatedModelQuery[0]\n const relatedModelUid = relatedModel.uid\n // Exclude the current model's schemaUid since we already have its versions\n if (relatedModelUid && relatedModelUid !== ModelClass.schemaUid) {\n schemaUidsByModelName.set(relatedModel.name, relatedModelUid)\n }\n }\n }\n\n const queryKey = [`getRelatedSeedIds${modelName}`]\n\n const queryClient = BaseQueryClient.getQueryClient()\n const easClient = BaseEasClient.getEasClient()\n\n const { itemSeedIds: relatedSeedIdAttestations } =\n await queryClient.fetchQuery({\n queryKey,\n queryFn: async () =>\n easClient.request(GET_SEED_IDS, {\n where: {\n schema: {\n is: {\n id: {\n in: Array.from(schemaUidsByModelName.values()),\n },\n },\n },\n attester: {\n in: addresses,\n },\n },\n }),\n })\n\n const relatedSeedIds = relatedSeedIdAttestations.map((seed) => seed.id)\n\n const { itemVersions: relatedVersions } = await queryClient.fetchQuery({\n queryKey: [`getRelatedVersions${modelName}`],\n queryFn: async () =>\n easClient.request(GET_VERSIONS, {\n where: {\n refUID: {\n in: relatedSeedIds,\n },\n attester: {\n in: addresses,\n },\n },\n }),\n })\n\n // Index versions by seedUid\n for (const version of relatedVersions) {\n const existingVersionsForSeedUid =\n relatedVersionsBySeedUid.get(version.refUID) || []\n existingVersionsForSeedUid.push(version)\n relatedVersionsBySeedUid.set(version.refUID, existingVersionsForSeedUid)\n }\n\n // Sort the indexed versions by timeCreated and index the most recent\n for (const [\n seedUid,\n versionsForSeed,\n ] of relatedVersionsBySeedUid.entries()) {\n const versionsForSeedSorted = versionsForSeed.sort(\n (a: Attestation, b: Attestation) => {\n return a.timeCreated - b.timeCreated\n },\n )\n relatedVersionsBySeedUid.set(seedUid, versionsForSeedSorted)\n mostRecentVersionsBySeedUid.set(seedUid, versionsForSeedSorted[0])\n seedUidsByMostRecentVersionUid.set(versionsForSeedSorted[0].id, seedUid)\n }\n\n // Extract the ids of the most recent versions\n const mostRecentVersionIds = Array.from(\n mostRecentVersionsBySeedUid.values(),\n ).map((version) => version.id)\n\n const { allProperties } = await queryClient.fetchQuery({\n queryKey: [`getAllProperties${modelName}`],\n queryFn: async () =>\n easClient.request(GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, {\n where: {\n refUID: {\n in: mostRecentVersionIds,\n },\n attester: {\n in: addresses,\n },\n },\n }),\n })\n\n for (const propertyAttestation of allProperties) {\n const seedUidForProperty = seedUidsByMostRecentVersionUid.get(\n propertyAttestation.refUID,\n )\n const existingPropertiesForSeedUid =\n mostRecentPropertiesBySeedUid.get(seedUidForProperty!) || []\n existingPropertiesForSeedUid.push(propertyAttestation)\n mostRecentPropertiesBySeedUid.set(\n seedUidForProperty!,\n existingPropertiesForSeedUid,\n )\n }\n }\n\n _fetchRelatedItems().then(() => {\n sendBack({\n type: 'fetchRelatedItemsSuccess',\n mostRecentPropertiesBySeedUid,\n relatedVersionsBySeedUid,\n relatedProperties,\n schemaUidsByModelName,\n })\n return\n })\n})\n"],"names":["modelsTable"],"mappings":";;;;;;;;;;;;;;AAwBa,MAAA,iBAAiB,GAAG,YAAY,CAG3C,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,KAAI;AACrC,IAAA,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,OAAO;AAEzC,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE;AAE/B,IAAA,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAwB;AACzD,IAAA,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAAyB;AACjE,IAAA,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAkB;AACvD,IAAA,MAAM,2BAA2B,GAAG,IAAI,GAAG,EAAuB;AAClE,IAAA,MAAM,6BAA6B,GAAG,IAAI,GAAG,EAAyB;AACtE,IAAA,MAAM,8BAA8B,GAAG,IAAI,GAAG,EAAkB;AAEhE,IAAA,MAAM,kBAAkB,GAAG,YAAW;;AAEpC,QAAA,KAAK,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CACrD,UAA6B,CAAC,MAAM,CACtC,EAAE;YACD,IAAI,WAAW,IAAI,WAAW,CAAC,GAAG,IAAI,WAAW,CAAC,UAAU,EAAE;AAC5D,gBAAA,iBAAiB,CAAC,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC;;;AAIpD,QAAA,MAAM,SAAS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C,IAAI,CAAC,MAAK;AAC7B,QAAA,QAAQ,CAAC;AACP,YAAA,IAAI,EAAE,0BAA0B;YAChC,6BAA6B;YAC7B,wBAAwB;YACxB,iBAAiB;YACjB,qBAAqB;AACtB,SAAA,CAAC;QACF;AACF,KAAC,CAAC;AACJ,CAAC;;;;"}
@@ -4,13 +4,12 @@ import pluralize from 'pluralize';
4
4
  import { BaseEasClient } from '../../../helpers/EasClient/BaseEasClient.js';
5
5
  import { BaseQueryClient } from '../../../helpers/QueryClient/BaseQueryClient.js';
6
6
  import { toSnakeCase } from '../../../helpers/index.js';
7
- import '../../../seedSchema/AppStateSchema.js';
7
+ import '../../../seedSchema/SeedSchema.js';
8
+ import '../../../seedSchema/VersionSchema.js';
8
9
  import '../../../seedSchema/MetadataSchema.js';
10
+ import '../../../seedSchema/AppStateSchema.js';
9
11
  import { models } from '../../../seedSchema/ModelSchema.js';
10
12
  import { modelUids } from '../../../seedSchema/ModelUidSchema.js';
11
- import '../../../seedSchema/PropertyUidSchema.js';
12
- import '../../../seedSchema/SeedSchema.js';
13
- import '../../../seedSchema/VersionSchema.js';
14
13
  import { eq } from 'drizzle-orm';
15
14
  import { getAddressesFromDb } from '../../../helpers/db.js';
16
15
  import { eventEmitter } from '../../../eventBus.js';