@seedprotocol/sdk 0.4.14 → 0.4.15

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 (363) hide show
  1. package/dist/{ArweaveClient-D6E8xe3J.js → ArweaveClient-DPeCeRMF.js} +21 -18
  2. package/dist/ArweaveClient-DPeCeRMF.js.map +1 -0
  3. package/dist/{ArweaveClient-DElJwN08.js → ArweaveClient-Zz6VwCkj.js} +21 -18
  4. package/dist/ArweaveClient-Zz6VwCkj.js.map +1 -0
  5. package/dist/{Db-De4o7jww.js → Db-Cvoi9q3N.js} +8 -5
  6. package/dist/Db-Cvoi9q3N.js.map +1 -0
  7. package/dist/{Db-DW1Un2jz.js → Db-DsFElL33.js} +356 -52
  8. package/dist/Db-DsFElL33.js.map +1 -0
  9. package/dist/{EasClient-BpGDIkmb.js → EasClient-B2N8bc3C.js} +6 -5
  10. package/dist/{EasClient-DGY_mkrd.js.map → EasClient-B2N8bc3C.js.map} +1 -1
  11. package/dist/{EasClient-DGY_mkrd.js → EasClient-D5Nn1WBF.js} +6 -5
  12. package/dist/{EasClient-BpGDIkmb.js.map → EasClient-D5Nn1WBF.js.map} +1 -1
  13. package/dist/{FileManager-DrHQbmYj.js → FileManager-Bk-JeMoA.js} +48 -11
  14. package/dist/FileManager-Bk-JeMoA.js.map +1 -0
  15. package/dist/{FileManager-Cw8mOIqZ.js → FileManager-Cqy_Lq46.js} +12 -8
  16. package/dist/FileManager-Cqy_Lq46.js.map +1 -0
  17. package/dist/{ModelProperty-D8d25NtC.js → ModelProperty-CkQaEsBu.js} +30 -28
  18. package/dist/ModelProperty-CkQaEsBu.js.map +1 -0
  19. package/dist/{PathResolver-D1k3dZg5.js → PathResolver-C3sdR5LL.js} +6 -5
  20. package/dist/{PathResolver-D1k3dZg5.js.map → PathResolver-C3sdR5LL.js.map} +1 -1
  21. package/dist/{PathResolver-BHj0UZTj.js → PathResolver-DF1QFI1d.js} +6 -5
  22. package/dist/{PathResolver-BHj0UZTj.js.map → PathResolver-DF1QFI1d.js.map} +1 -1
  23. package/dist/{QueryClient-BCVom0BA.js → QueryClient-CnONLIkA.js} +6 -5
  24. package/dist/{QueryClient-BCVom0BA.js.map → QueryClient-CnONLIkA.js.map} +1 -1
  25. package/dist/{QueryClient-D4974vvo.js → QueryClient-Ctgd0tDn.js} +6 -5
  26. package/dist/{QueryClient-D4974vvo.js.map → QueryClient-Ctgd0tDn.js.map} +1 -1
  27. package/dist/{Schema-CLlE7onI.js → Schema-Bnim4hAF.js} +90 -57
  28. package/dist/Schema-Bnim4hAF.js.map +1 -0
  29. package/dist/{SchemaValidationService-CwKY3QlY.js → SchemaValidationService-DXxRk-9Q.js} +138 -38
  30. package/dist/SchemaValidationService-DXxRk-9Q.js.map +1 -0
  31. package/dist/backfillMetadataPropertyIds-dzwzz4dA.js +67 -0
  32. package/dist/backfillMetadataPropertyIds-dzwzz4dA.js.map +1 -0
  33. package/dist/cjs/{ModelProperty-CgQ3zR-u.js → ModelProperty-C80601ai.js} +23 -21
  34. package/dist/cjs/ModelProperty-C80601ai.js.map +1 -0
  35. package/dist/cjs/{Schema-B0D7LgYb.js → Schema-6BQKp7hO.js} +60 -39
  36. package/dist/cjs/Schema-6BQKp7hO.js.map +1 -0
  37. package/dist/cjs/{SchemaValidationService-DUIOUvC_.js → SchemaValidationService-BySF1P0v.js} +138 -38
  38. package/dist/cjs/SchemaValidationService-BySF1P0v.js.map +1 -0
  39. package/dist/cjs/backfillMetadataPropertyIds-D9uzW5bW.js +84 -0
  40. package/dist/cjs/backfillMetadataPropertyIds-D9uzW5bW.js.map +1 -0
  41. package/dist/cjs/{getItem-BP4BYB4Z.js → getItem-Dj49AjWB.js} +5 -4
  42. package/dist/cjs/{getItem-BP4BYB4Z.js.map → getItem-Dj49AjWB.js.map} +1 -1
  43. package/dist/cjs/getPublishPayload-dR9co4rH.js +888 -0
  44. package/dist/cjs/getPublishPayload-dR9co4rH.js.map +1 -0
  45. package/dist/cjs/{getPublishUploads-D4DMfuOm.js → getPublishUploads-g61mgXaA.js} +111 -35
  46. package/dist/cjs/getPublishUploads-g61mgXaA.js.map +1 -0
  47. package/dist/cjs/getSegmentedItemProperties-NFvOHlAi.js +146 -0
  48. package/dist/cjs/getSegmentedItemProperties-NFvOHlAi.js.map +1 -0
  49. package/dist/cjs/{index-CUd7xS2i.js → index-9O_Ji1kY.js} +3332 -1367
  50. package/dist/cjs/index-9O_Ji1kY.js.map +1 -0
  51. package/dist/cjs/{index-BM8CSlnN.js → index-ud9i9fpp.js} +15 -7
  52. package/dist/cjs/index-ud9i9fpp.js.map +1 -0
  53. package/dist/cjs/{ownership-D3npAPnx.js → ownership-CyLRNReQ.js} +24 -7
  54. package/dist/cjs/ownership-CyLRNReQ.js.map +1 -0
  55. package/dist/cjs/property-Hj-RhQVX.js +318 -0
  56. package/dist/cjs/property-Hj-RhQVX.js.map +1 -0
  57. package/dist/db/drizzle/drizzle/0005_bright_lily_hollister.sql +27 -0
  58. package/dist/db/drizzle/drizzle/0006_add_publisher_to_versions_and_metadata.sql +3 -0
  59. package/dist/db/drizzle/drizzle/0007_add_required_to_properties.sql +1 -0
  60. package/dist/db/drizzle/drizzle/0008_add_revoked_at_to_seeds.sql +1 -0
  61. package/dist/db/drizzle/drizzle/0009_happy_namor.sql +14 -0
  62. package/dist/db/drizzle/drizzle/meta/0005_snapshot.json +1031 -0
  63. package/dist/db/drizzle/drizzle/meta/0006_snapshot.json +1045 -0
  64. package/dist/db/drizzle/drizzle/meta/0007_snapshot.json +1052 -0
  65. package/dist/db/drizzle/drizzle/meta/0008_snapshot.json +1059 -0
  66. package/dist/db/drizzle/drizzle/meta/0009_snapshot.json +1080 -0
  67. package/dist/db/drizzle/drizzle/meta/_journal.json +35 -0
  68. package/dist/{getItem-B_IP-uNX.js → getItem-ClK0UZqi.js} +5 -4
  69. package/dist/{getItem-B_IP-uNX.js.map → getItem-ClK0UZqi.js.map} +1 -1
  70. package/dist/getPublishPayload-CdfPTl8l.js +875 -0
  71. package/dist/getPublishPayload-CdfPTl8l.js.map +1 -0
  72. package/dist/{getPublishUploads-DPk5RcAG.js → getPublishUploads-CGBky9q9.js} +109 -15
  73. package/dist/getPublishUploads-CGBky9q9.js.map +1 -0
  74. package/dist/getSegmentedItemProperties-CJWdYH9W.js +144 -0
  75. package/dist/getSegmentedItemProperties-CJWdYH9W.js.map +1 -0
  76. package/dist/{index-DbmqfO-Q.js → index-C74KrwXN.js} +4 -2
  77. package/dist/index-C74KrwXN.js.map +1 -0
  78. package/dist/index-CgmWq1sF.js +19 -0
  79. package/dist/index-CgmWq1sF.js.map +1 -0
  80. package/dist/{index-Dh_gxItx.js → index-uPXtq2cf.js} +3321 -1376
  81. package/dist/index-uPXtq2cf.js.map +1 -0
  82. package/dist/main.cjs +7 -4
  83. package/dist/main.cjs.map +1 -1
  84. package/dist/main.js +138 -2218
  85. package/dist/main.js.map +1 -1
  86. package/dist/node.js +13 -12
  87. package/dist/node.js.map +1 -1
  88. package/dist/{ownership-CEv7BhIh.js → ownership-QK5haR3-.js} +24 -7
  89. package/dist/ownership-QK5haR3-.js.map +1 -0
  90. package/dist/{property-CppuVi-i.js → property-Dt0U3UXJ.js} +26 -6
  91. package/dist/property-Dt0U3UXJ.js.map +1 -0
  92. package/dist/{queries-B1vaglQW.js → queries-BUB-vUBm.js} +2 -2
  93. package/dist/{queries-B1vaglQW.js.map → queries-BUB-vUBm.js.map} +1 -1
  94. package/dist/seedSchema/AppStateSchema.d.ts +82 -0
  95. package/dist/seedSchema/AppStateSchema.d.ts.map +1 -0
  96. package/dist/seedSchema/ConfigSchema.d.ts +101 -0
  97. package/dist/seedSchema/ConfigSchema.d.ts.map +1 -0
  98. package/dist/seedSchema/MetadataSchema.d.ts +422 -0
  99. package/dist/seedSchema/MetadataSchema.d.ts.map +1 -0
  100. package/dist/seedSchema/MetadataSchema.ts +4 -1
  101. package/dist/seedSchema/ModelSchema.d.ts +243 -0
  102. package/dist/seedSchema/ModelSchema.d.ts.map +1 -0
  103. package/dist/seedSchema/ModelSchema.ts +1 -0
  104. package/dist/seedSchema/ModelSchemaSchema.d.ts +61 -0
  105. package/dist/seedSchema/ModelSchemaSchema.d.ts.map +1 -0
  106. package/dist/seedSchema/ModelUidSchema.d.ts +64 -0
  107. package/dist/seedSchema/ModelUidSchema.d.ts.map +1 -0
  108. package/dist/seedSchema/PropertyUidSchema.d.ts +64 -0
  109. package/dist/seedSchema/PropertyUidSchema.d.ts.map +1 -0
  110. package/dist/seedSchema/PropertyUidSchema.ts +2 -2
  111. package/dist/seedSchema/PublishProcessSchema.ts +22 -0
  112. package/dist/seedSchema/SchemaSchema.d.ts +169 -0
  113. package/dist/seedSchema/SchemaSchema.d.ts.map +1 -0
  114. package/dist/seedSchema/SeedSchema.d.ts +192 -0
  115. package/dist/seedSchema/SeedSchema.d.ts.map +1 -0
  116. package/dist/seedSchema/SeedSchema.ts +1 -0
  117. package/dist/seedSchema/UploadProcessSchema.ts +14 -0
  118. package/dist/seedSchema/VersionSchema.d.ts +194 -0
  119. package/dist/seedSchema/VersionSchema.d.ts.map +1 -0
  120. package/dist/seedSchema/VersionSchema.ts +1 -0
  121. package/dist/seedSchema/index.d.ts +11 -0
  122. package/dist/seedSchema/index.d.ts.map +1 -0
  123. package/dist/seedSchema/index.ts +2 -0
  124. package/dist/src/Item/Item.d.ts +5 -1
  125. package/dist/src/Item/Item.d.ts.map +1 -1
  126. package/dist/src/Item/queries.d.ts.map +1 -1
  127. package/dist/src/Item/service/actors/loadOrCreateItem.d.ts.map +1 -1
  128. package/dist/src/Item/service/actors/saveDataToDb.d.ts.map +1 -1
  129. package/dist/src/Item/service/itemMachineSingle.d.ts.map +1 -1
  130. package/dist/src/ItemProperty/ItemProperty.d.ts +4 -0
  131. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  132. package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
  133. package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +1 -1
  134. package/dist/src/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
  135. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
  136. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.d.ts.map +1 -1
  137. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveHtml.d.ts.map +1 -1
  138. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +1 -1
  139. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -1
  140. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  141. package/dist/src/Model/index.d.ts +1 -0
  142. package/dist/src/Model/index.d.ts.map +1 -1
  143. package/dist/src/Model/service/actors/createModelProperties.d.ts.map +1 -1
  144. package/dist/src/Model/service/modelMachine.d.ts +2 -2
  145. package/dist/src/ModelProperty/ModelProperty.d.ts +1 -1
  146. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  147. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +17 -17
  148. package/dist/src/Schema/Schema.d.ts +1 -0
  149. package/dist/src/Schema/Schema.d.ts.map +1 -1
  150. package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
  151. package/dist/src/Schema/service/addModelsMachine.d.ts +14 -14
  152. package/dist/src/Schema/service/addModelsMachine.d.ts.map +1 -1
  153. package/dist/src/Schema/service/schemaMachine.d.ts +87 -87
  154. package/dist/src/Schema/service/validation/SchemaValidationService.d.ts +5 -1
  155. package/dist/src/Schema/service/validation/SchemaValidationService.d.ts.map +1 -1
  156. package/dist/src/Schema/validation.d.ts +2 -0
  157. package/dist/src/Schema/validation.d.ts.map +1 -1
  158. package/dist/src/browser/db/Db.d.ts +3 -1
  159. package/dist/src/browser/db/Db.d.ts.map +1 -1
  160. package/dist/src/browser/db/drizzleFiles.d.ts +7 -2
  161. package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
  162. package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
  163. package/dist/src/browser/helpers/FileManager.d.ts +1 -0
  164. package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
  165. package/dist/src/browser/index.d.ts +0 -1
  166. package/dist/src/browser/index.d.ts.map +1 -1
  167. package/dist/src/browser/workers/ImageResizer.d.ts.map +1 -1
  168. package/dist/src/browser/workers/imageResize.d.ts.map +1 -1
  169. package/dist/src/client/ClientManager.d.ts +11 -0
  170. package/dist/src/client/ClientManager.d.ts.map +1 -1
  171. package/dist/src/client/actors/addModelsToDb.d.ts.map +1 -1
  172. package/dist/src/client/actors/dbInit.d.ts.map +1 -1
  173. package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
  174. package/dist/src/client/actors/processSchemaFiles.d.ts.map +1 -1
  175. package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
  176. package/dist/src/db/Db/BaseDb.d.ts.map +1 -1
  177. package/dist/src/db/backfillMetadataPropertyIds.d.ts +7 -0
  178. package/dist/src/db/backfillMetadataPropertyIds.d.ts.map +1 -0
  179. package/dist/src/db/configs/dev.schema.config.d.ts.map +1 -1
  180. package/dist/src/db/read/getAttesterForSeed.d.ts +13 -0
  181. package/dist/src/db/read/getAttesterForSeed.d.ts.map +1 -0
  182. package/dist/src/db/read/getItemData.d.ts.map +1 -1
  183. package/dist/src/db/read/getItems.d.ts.map +1 -1
  184. package/dist/src/db/read/getMetadataAttestationUidsForSeedUid.d.ts +9 -0
  185. package/dist/src/db/read/getMetadataAttestationUidsForSeedUid.d.ts.map +1 -0
  186. package/dist/src/db/read/getPropertyData.d.ts +1 -1
  187. package/dist/src/db/read/getPropertyData.d.ts.map +1 -1
  188. package/dist/src/db/read/getPublishPayload.d.ts +26 -2
  189. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  190. package/dist/src/db/read/getPublishUploads.d.ts +1 -0
  191. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  192. package/dist/src/db/read/getRelatedItemsForPublish.d.ts.map +1 -1
  193. package/dist/src/db/read/getVersionsForSeedUid.d.ts +4 -0
  194. package/dist/src/db/read/getVersionsForSeedUid.d.ts.map +1 -0
  195. package/dist/src/db/read/subqueries/metadataLatest.d.ts.map +1 -1
  196. package/dist/src/db/write/createMetadata.d.ts +15 -1
  197. package/dist/src/db/write/createMetadata.d.ts.map +1 -1
  198. package/dist/src/db/write/createNewItem.d.ts.map +1 -1
  199. package/dist/src/db/write/createSeed.d.ts.map +1 -1
  200. package/dist/src/db/write/createVersion.d.ts.map +1 -1
  201. package/dist/src/db/write/updateItemPropertyValue.d.ts +2 -0
  202. package/dist/src/db/write/updateItemPropertyValue.d.ts.map +1 -1
  203. package/dist/src/db/write/updateMetadata.d.ts.map +1 -1
  204. package/dist/src/db/write/updateSeedRevokedAt.d.ts +10 -0
  205. package/dist/src/db/write/updateSeedRevokedAt.d.ts.map +1 -0
  206. package/dist/src/db/write/updateSeedUid.d.ts +6 -1
  207. package/dist/src/db/write/updateSeedUid.d.ts.map +1 -1
  208. package/dist/src/db/write/updateVersionUid.d.ts +13 -0
  209. package/dist/src/db/write/updateVersionUid.d.ts.map +1 -0
  210. package/dist/src/eas.d.ts +5 -2
  211. package/dist/src/eas.d.ts.map +1 -1
  212. package/dist/src/events/item/syncDbWithEas.d.ts +10 -0
  213. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  214. package/dist/src/graphql/gql/gql.d.ts +2 -7
  215. package/dist/src/graphql/gql/gql.d.ts.map +1 -1
  216. package/dist/src/graphql/gql/graphql.d.ts +2 -16
  217. package/dist/src/graphql/gql/graphql.d.ts.map +1 -1
  218. package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts +22 -8
  219. package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts.map +1 -1
  220. package/dist/src/helpers/ArweaveClient/index.d.ts.map +1 -1
  221. package/dist/src/helpers/ArweaveClient/uploadApiVerification.d.ts +19 -0
  222. package/dist/src/helpers/ArweaveClient/uploadApiVerification.d.ts.map +1 -0
  223. package/dist/src/helpers/FileManager/BaseFileManager.d.ts +4 -0
  224. package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
  225. package/dist/src/helpers/constants.d.ts.map +1 -1
  226. package/dist/src/helpers/crypto.d.ts +6 -0
  227. package/dist/src/helpers/crypto.d.ts.map +1 -1
  228. package/dist/src/helpers/db.d.ts +25 -0
  229. package/dist/src/helpers/db.d.ts.map +1 -1
  230. package/dist/src/helpers/easRevokedFilter.d.ts +10 -0
  231. package/dist/src/helpers/easRevokedFilter.d.ts.map +1 -0
  232. package/dist/src/helpers/file/queries.d.ts.map +1 -1
  233. package/dist/src/helpers/getSegmentedItemProperties.d.ts +2 -2
  234. package/dist/src/helpers/getSegmentedItemProperties.d.ts.map +1 -1
  235. package/dist/src/helpers/index.d.ts +3 -0
  236. package/dist/src/helpers/index.d.ts.map +1 -1
  237. package/dist/src/helpers/listPropertyValueFromStorage.d.ts +5 -0
  238. package/dist/src/helpers/listPropertyValueFromStorage.d.ts.map +1 -0
  239. package/dist/src/helpers/metadataPropertyNames.d.ts +50 -0
  240. package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -0
  241. package/dist/src/helpers/model.d.ts.map +1 -1
  242. package/dist/src/helpers/ownership.d.ts +2 -0
  243. package/dist/src/helpers/ownership.d.ts.map +1 -1
  244. package/dist/src/helpers/property/index.d.ts +24 -12
  245. package/dist/src/helpers/property/index.d.ts.map +1 -1
  246. package/dist/src/helpers/property.d.ts.map +1 -1
  247. package/dist/src/helpers/publishConfig.d.ts +36 -0
  248. package/dist/src/helpers/publishConfig.d.ts.map +1 -1
  249. package/dist/src/helpers/schema.d.ts.map +1 -1
  250. package/dist/src/helpers/updateSchema.d.ts +2 -5
  251. package/dist/src/helpers/updateSchema.d.ts.map +1 -1
  252. package/dist/src/imports/index.d.ts +1 -1
  253. package/dist/src/imports/index.d.ts.map +1 -1
  254. package/dist/src/imports/json.d.ts +16 -1
  255. package/dist/src/imports/json.d.ts.map +1 -1
  256. package/dist/src/index.d.ts +33 -8
  257. package/dist/src/index.d.ts.map +1 -1
  258. package/dist/src/interfaces/IItem.d.ts +5 -1
  259. package/dist/src/interfaces/IItem.d.ts.map +1 -1
  260. package/dist/src/interfaces/IItemProperty.d.ts +3 -0
  261. package/dist/src/interfaces/IItemProperty.d.ts.map +1 -1
  262. package/dist/src/node/db/Db.d.ts.map +1 -1
  263. package/dist/src/node/helpers/ArweaveClient.d.ts.map +1 -1
  264. package/dist/src/node/helpers/FileManager.d.ts +1 -0
  265. package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
  266. package/dist/src/seedSchema/MetadataSchema.d.ts +36 -0
  267. package/dist/src/seedSchema/MetadataSchema.d.ts.map +1 -1
  268. package/dist/src/seedSchema/ModelSchema.d.ts +17 -0
  269. package/dist/src/seedSchema/ModelSchema.d.ts.map +1 -1
  270. package/dist/src/seedSchema/PublishProcessSchema.d.ts +285 -0
  271. package/dist/src/seedSchema/PublishProcessSchema.d.ts.map +1 -0
  272. package/dist/src/seedSchema/SeedSchema.d.ts +17 -0
  273. package/dist/src/seedSchema/SeedSchema.d.ts.map +1 -1
  274. package/dist/src/seedSchema/UploadProcessSchema.d.ts +135 -0
  275. package/dist/src/seedSchema/UploadProcessSchema.d.ts.map +1 -0
  276. package/dist/src/seedSchema/VersionSchema.d.ts +19 -0
  277. package/dist/src/seedSchema/VersionSchema.d.ts.map +1 -1
  278. package/dist/src/seedSchema/index.d.ts +2 -0
  279. package/dist/src/seedSchema/index.d.ts.map +1 -1
  280. package/dist/src/services/write/writeProcessMachine.d.ts +1 -1
  281. package/dist/src/types/arweave.d.ts +2 -1
  282. package/dist/src/types/arweave.d.ts.map +1 -1
  283. package/dist/src/types/db.d.ts +2 -0
  284. package/dist/src/types/db.d.ts.map +1 -1
  285. package/dist/src/types/import.d.ts +3 -0
  286. package/dist/src/types/import.d.ts.map +1 -1
  287. package/dist/src/types/index.d.ts +9 -0
  288. package/dist/src/types/index.d.ts.map +1 -1
  289. package/dist/src/types/item.d.ts +13 -0
  290. package/dist/src/types/item.d.ts.map +1 -1
  291. package/dist/src/types/machines.d.ts +1 -0
  292. package/dist/src/types/machines.d.ts.map +1 -1
  293. package/dist/src/types/property.d.ts +11 -2
  294. package/dist/src/types/property.d.ts.map +1 -1
  295. package/dist/src/vite/index.d.ts.map +1 -1
  296. package/dist/vite.cjs +2 -127
  297. package/dist/vite.cjs.map +1 -1
  298. package/dist/vite.js +2 -127
  299. package/dist/vite.js.map +1 -1
  300. package/package.json +4 -11
  301. package/dist/ArweaveClient-D6E8xe3J.js.map +0 -1
  302. package/dist/ArweaveClient-DElJwN08.js.map +0 -1
  303. package/dist/Db-DW1Un2jz.js.map +0 -1
  304. package/dist/Db-De4o7jww.js.map +0 -1
  305. package/dist/FileManager-Cw8mOIqZ.js.map +0 -1
  306. package/dist/FileManager-DrHQbmYj.js.map +0 -1
  307. package/dist/ModelProperty-D8d25NtC.js.map +0 -1
  308. package/dist/Schema-CLlE7onI.js.map +0 -1
  309. package/dist/SchemaValidationService-CwKY3QlY.js.map +0 -1
  310. package/dist/cjs/ModelProperty-CgQ3zR-u.js.map +0 -1
  311. package/dist/cjs/Schema-B0D7LgYb.js.map +0 -1
  312. package/dist/cjs/SchemaValidationService-DUIOUvC_.js.map +0 -1
  313. package/dist/cjs/getPublishPayload-B90BFd8m.js +0 -520
  314. package/dist/cjs/getPublishPayload-B90BFd8m.js.map +0 -1
  315. package/dist/cjs/getPublishUploads-D4DMfuOm.js.map +0 -1
  316. package/dist/cjs/getSegmentedItemProperties-KdudlzXm.js +0 -71
  317. package/dist/cjs/getSegmentedItemProperties-KdudlzXm.js.map +0 -1
  318. package/dist/cjs/index-BM8CSlnN.js.map +0 -1
  319. package/dist/cjs/index-CUd7xS2i.js.map +0 -1
  320. package/dist/cjs/ownership-D3npAPnx.js.map +0 -1
  321. package/dist/getPublishPayload-BekDN5Ti.js +0 -503
  322. package/dist/getPublishPayload-BekDN5Ti.js.map +0 -1
  323. package/dist/getPublishUploads-DPk5RcAG.js.map +0 -1
  324. package/dist/getSegmentedItemProperties-DfQNbOpb.js +0 -69
  325. package/dist/getSegmentedItemProperties-DfQNbOpb.js.map +0 -1
  326. package/dist/index-DbmqfO-Q.js.map +0 -1
  327. package/dist/index-Dh_gxItx.js.map +0 -1
  328. package/dist/index-XBnjc_SF.js +0 -18
  329. package/dist/index-XBnjc_SF.js.map +0 -1
  330. package/dist/ownership-CEv7BhIh.js.map +0 -1
  331. package/dist/property-CppuVi-i.js.map +0 -1
  332. package/dist/src/browser/react/OPFSImage.d.ts +0 -7
  333. package/dist/src/browser/react/OPFSImage.d.ts.map +0 -1
  334. package/dist/src/browser/react/SeedImage.d.ts +0 -11
  335. package/dist/src/browser/react/SeedImage.d.ts.map +0 -1
  336. package/dist/src/browser/react/SeedProvider.d.ts +0 -30
  337. package/dist/src/browser/react/SeedProvider.d.ts.map +0 -1
  338. package/dist/src/browser/react/client.d.ts +0 -2
  339. package/dist/src/browser/react/client.d.ts.map +0 -1
  340. package/dist/src/browser/react/db.d.ts +0 -4
  341. package/dist/src/browser/react/db.d.ts.map +0 -1
  342. package/dist/src/browser/react/index.d.ts +0 -14
  343. package/dist/src/browser/react/index.d.ts.map +0 -1
  344. package/dist/src/browser/react/item.d.ts +0 -44
  345. package/dist/src/browser/react/item.d.ts.map +0 -1
  346. package/dist/src/browser/react/itemProperty.d.ts +0 -93
  347. package/dist/src/browser/react/itemProperty.d.ts.map +0 -1
  348. package/dist/src/browser/react/liveQuery.d.ts +0 -29
  349. package/dist/src/browser/react/liveQuery.d.ts.map +0 -1
  350. package/dist/src/browser/react/model.d.ts +0 -48
  351. package/dist/src/browser/react/model.d.ts.map +0 -1
  352. package/dist/src/browser/react/modelProperty.d.ts +0 -82
  353. package/dist/src/browser/react/modelProperty.d.ts.map +0 -1
  354. package/dist/src/browser/react/queryClient.d.ts +0 -28
  355. package/dist/src/browser/react/queryClient.d.ts.map +0 -1
  356. package/dist/src/browser/react/schema.d.ts +0 -45
  357. package/dist/src/browser/react/schema.d.ts.map +0 -1
  358. package/dist/src/browser/react/services.d.ts +0 -24
  359. package/dist/src/browser/react/services.d.ts.map +0 -1
  360. package/dist/src/browser/react/trash.d.ts +0 -9
  361. package/dist/src/browser/react/trash.d.ts.map +0 -1
  362. package/dist/src/browser/react/useImageFiles.d.ts +0 -19
  363. package/dist/src/browser/react/useImageFiles.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { Value } from '@sinclair/typebox/value';
2
2
  import 'reflect-metadata';
3
- import { a as ModelPropertyDataTypes, T as TPropertyDataType, c as TProperty } from './index-Dh_gxItx.js';
3
+ import { b as ModelPropertyDataTypes, c as TPropertyDataType, n as normalizeDataType, e as TProperty, k as DEFAULT_TEXT_MAX_LENGTH } from './index-uPXtq2cf.js';
4
4
  import 'pluralize';
5
5
  import 'drizzle-orm';
6
6
  import { Type } from '@sinclair/typebox';
@@ -10,11 +10,12 @@ import 'drizzle-orm/sqlite-core';
10
10
  import 'nanoid';
11
11
  import 'nanoid-dictionary';
12
12
  import 'ethers';
13
- import 'rxjs';
14
- import 'lodash-es';
15
13
  import 'drizzle-orm/casing';
14
+ import 'lodash-es';
15
+ import 'rxjs';
16
16
  import 'eventemitter3';
17
17
  import 'arweave';
18
+ import 'js-sha3';
18
19
 
19
20
  const logger = debug('seedSdk:schema:validation');
20
21
  /**
@@ -166,10 +167,18 @@ class SchemaValidationService {
166
167
  */
167
168
  validatePropertyStructure(property) {
168
169
  try {
169
- const isValid = Value.Check(TProperty, property);
170
+ // Normalize dataType and refValueType for case-insensitive schema support (e.g. "relation" -> "Relation")
171
+ const normalized = { ...property };
172
+ if (typeof normalized.dataType === 'string') {
173
+ normalized.dataType = normalizeDataType(normalized.dataType);
174
+ }
175
+ if (typeof normalized.refValueType === 'string') {
176
+ normalized.refValueType = normalizeDataType(normalized.refValueType);
177
+ }
178
+ const isValid = Value.Check(TProperty, normalized);
170
179
  const errors = [];
171
180
  if (!isValid) {
172
- const typeBoxErrors = [...Value.Errors(TProperty, property)];
181
+ const typeBoxErrors = [...Value.Errors(TProperty, normalized)];
173
182
  errors.push(...typeBoxErrors.map(err => {
174
183
  const fieldPath = err.path || 'unknown';
175
184
  const fieldSchema = this.getSchemaForField(TProperty, fieldPath);
@@ -194,17 +203,17 @@ class SchemaValidationService {
194
203
  ModelPropertyDataTypes.Html,
195
204
  ModelPropertyDataTypes.Relation,
196
205
  ];
197
- if (nonListTypes.includes(property.dataType)) {
198
- const hasRefValueType = property.refValueType != null && String(property.refValueType).trim() !== '';
206
+ if (nonListTypes.includes(normalized.dataType)) {
207
+ const hasRefValueType = normalized.refValueType != null && String(normalized.refValueType).trim() !== '';
199
208
  if (hasRefValueType) {
200
209
  // Relation may keep refValueType only for Image (relation to Image entity)
201
- if (property.dataType === ModelPropertyDataTypes.Relation && property.refValueType === ModelPropertyDataTypes.Image) {
210
+ if (normalized.dataType === ModelPropertyDataTypes.Relation && normalized.refValueType === ModelPropertyDataTypes.Image) {
202
211
  // Allowed: Relation to Image
203
212
  }
204
213
  else {
205
214
  errors.push({
206
215
  field: 'refValueType',
207
- message: `refValueType is only valid for List properties. Use dataType 'List' with refValueType '${property.refValueType}' for lists of ${property.refValueType}.`,
216
+ message: `refValueType is only valid for List properties. Use dataType 'List' with refValueType '${normalized.refValueType}' for lists of ${normalized.refValueType}.`,
208
217
  code: 'invalid_ref_value_type',
209
218
  severity: 'error',
210
219
  });
@@ -212,8 +221,8 @@ class SchemaValidationService {
212
221
  }
213
222
  }
214
223
  // List: refValueType is required
215
- if (property.dataType === ModelPropertyDataTypes.List) {
216
- const hasRefValueType = property.refValueType != null && String(property.refValueType).trim() !== '';
224
+ if (normalized.dataType === ModelPropertyDataTypes.List) {
225
+ const hasRefValueType = normalized.refValueType != null && String(normalized.refValueType).trim() !== '';
217
226
  if (!hasRefValueType) {
218
227
  errors.push({
219
228
  field: 'refValueType',
@@ -223,10 +232,10 @@ class SchemaValidationService {
223
232
  });
224
233
  }
225
234
  // List of relations: ref is required
226
- if (hasRefValueType && property.refValueType === ModelPropertyDataTypes.Relation) {
227
- const hasRef = property.ref && property.ref.trim() !== '';
228
- const hasRefModelName = property.refModelName && property.refModelName.trim() !== '';
229
- const hasRefModelId = property.refModelId !== undefined && property.refModelId !== null;
235
+ if (hasRefValueType && normalized.refValueType === ModelPropertyDataTypes.Relation) {
236
+ const hasRef = normalized.ref && normalized.ref.trim() !== '';
237
+ const hasRefModelName = normalized.refModelName && normalized.refModelName.trim() !== '';
238
+ const hasRefModelId = normalized.refModelId !== undefined && normalized.refModelId !== null;
230
239
  if (!hasRef && !hasRefModelName && !hasRefModelId) {
231
240
  errors.push({
232
241
  field: 'ref',
@@ -238,10 +247,10 @@ class SchemaValidationService {
238
247
  }
239
248
  }
240
249
  // Relation (single): ref is required
241
- if (property.dataType === ModelPropertyDataTypes.Relation) {
242
- const hasRef = property.ref && property.ref.trim() !== '';
243
- const hasRefModelName = property.refModelName && property.refModelName.trim() !== '';
244
- const hasRefModelId = property.refModelId !== undefined && property.refModelId !== null;
250
+ if (normalized.dataType === ModelPropertyDataTypes.Relation) {
251
+ const hasRef = normalized.ref && normalized.ref.trim() !== '';
252
+ const hasRefModelName = normalized.refModelName && normalized.refModelName.trim() !== '';
253
+ const hasRefModelId = normalized.refModelId !== undefined && normalized.refModelId !== null;
245
254
  if (!hasRef && !hasRefModelName && !hasRefModelId) {
246
255
  errors.push({
247
256
  field: 'ref',
@@ -251,7 +260,7 @@ class SchemaValidationService {
251
260
  });
252
261
  }
253
262
  if ((hasRef || hasRefModelName) && !hasRefModelId) {
254
- logger(`Property "${property.name}" has ref/refModelName but no refModelId - will be resolved asynchronously`);
263
+ logger(`Property "${normalized.name}" has ref/refModelName but no refModelId - will be resolved asynchronously`);
255
264
  }
256
265
  }
257
266
  return {
@@ -274,8 +283,12 @@ class SchemaValidationService {
274
283
  }
275
284
  /**
276
285
  * Validate a property value against its validation rules
286
+ * @param value - The value to validate
287
+ * @param dataType - The property's data type
288
+ * @param validationRules - Optional validation rules (enum, pattern, minLength, maxLength)
289
+ * @param refValueType - For List properties: the element type (Text, Number, etc.). When set, each array element is validated against this type + validationRules.
277
290
  */
278
- validatePropertyValue(value, dataType, validationRules) {
291
+ validatePropertyValue(value, dataType, validationRules, refValueType) {
279
292
  const errors = [];
280
293
  const warnings = [];
281
294
  try {
@@ -288,23 +301,109 @@ class SchemaValidationService {
288
301
  severity: 'error',
289
302
  });
290
303
  }
304
+ // File/Image: accept File objects from OS picker (TypeBox schema only allows string|null)
305
+ if ((dataType === ModelPropertyDataTypes.File || dataType === ModelPropertyDataTypes.Image) &&
306
+ typeof File !== 'undefined' &&
307
+ value instanceof File) {
308
+ if (validationRules) {
309
+ const customErrors = this.validateCustomRules(value, validationRules);
310
+ errors.push(...customErrors);
311
+ }
312
+ return {
313
+ isValid: errors.length === 0,
314
+ errors,
315
+ warnings: warnings.length > 0 ? warnings : undefined,
316
+ };
317
+ }
318
+ // List with refValueType: validate each element against element schema + validation rules
319
+ if (dataType === ModelPropertyDataTypes.List && refValueType && Array.isArray(value)) {
320
+ const elementDataType = normalizeDataType(String(refValueType));
321
+ // Apply default maxLength for Text elements in List. Html elements hold arbitrary-length content.
322
+ const elementEffectiveRules = validationRules ? { ...validationRules } : {};
323
+ if (elementDataType === ModelPropertyDataTypes.Text && elementEffectiveRules.maxLength === undefined) {
324
+ elementEffectiveRules.maxLength = DEFAULT_TEXT_MAX_LENGTH;
325
+ }
326
+ for (let i = 0; i < value.length; i++) {
327
+ const elementResult = this.validatePropertyValue(value[i], elementDataType, elementEffectiveRules);
328
+ if (!elementResult.isValid && elementResult.errors.length > 0) {
329
+ for (const err of elementResult.errors) {
330
+ errors.push({
331
+ field: `value[${i}]`,
332
+ message: `Element at index ${i}: ${err.message}`,
333
+ code: validationRules?.enum && Array.isArray(validationRules.enum) && validationRules.enum.length > 0 ? 'enum_violation' : err.code,
334
+ severity: err.severity,
335
+ });
336
+ }
337
+ }
338
+ }
339
+ if (validationRules) {
340
+ const customErrors = this.validateCustomRules(value, validationRules);
341
+ errors.push(...customErrors);
342
+ }
343
+ return {
344
+ isValid: errors.length === 0,
345
+ errors,
346
+ warnings: warnings.length > 0 ? warnings : undefined,
347
+ };
348
+ }
349
+ // List without refValueType or non-array: validate as scalar/array
350
+ if (dataType === ModelPropertyDataTypes.List && !Array.isArray(value) && value != null) {
351
+ errors.push({
352
+ field: 'value',
353
+ message: 'List properties require an array value.',
354
+ code: 'array_required',
355
+ severity: 'error',
356
+ });
357
+ return { isValid: false, errors };
358
+ }
291
359
  // Build base TypeBox schema from dataType
292
360
  let schema = this.getBaseSchemaForDataType(dataType);
361
+ // Apply default maxLength for Text when not explicitly set. Html holds arbitrary-length content (e.g. article body) and must not default to 255.
362
+ const effectiveRules = validationRules ? { ...validationRules } : {};
363
+ if (dataType === ModelPropertyDataTypes.Text && effectiveRules.maxLength === undefined) {
364
+ effectiveRules.maxLength = DEFAULT_TEXT_MAX_LENGTH;
365
+ }
293
366
  // Apply validation rules
294
- if (validationRules) {
295
- schema = this.applyValidationRules(schema, dataType, validationRules);
367
+ const hasEnumRules = !!(validationRules?.enum && Array.isArray(validationRules.enum) && validationRules.enum.length > 0);
368
+ if (Object.keys(effectiveRules).length > 0) {
369
+ schema = this.applyValidationRules(schema, dataType, effectiveRules);
296
370
  }
297
371
  // Validate using TypeBox
298
372
  const isValid = Value.Check(schema, value);
299
373
  if (!isValid) {
300
374
  const typeBoxErrors = [...Value.Errors(schema, value)];
375
+ const effectiveMaxLength = effectiveRules.maxLength;
376
+ const isDefaultTextLimit = dataType === ModelPropertyDataTypes.Text &&
377
+ effectiveMaxLength === DEFAULT_TEXT_MAX_LENGTH &&
378
+ validationRules?.maxLength === undefined;
301
379
  errors.push(...typeBoxErrors.map(err => {
302
380
  const fieldPath = err.path || 'value';
303
- const enhancedMessage = this.enhanceErrorMessage(err, schema, fieldPath);
381
+ const originalMessage = (err.message || '').toLowerCase();
382
+ // TypeBox maxLength errors have message like "Expected string length less or equal to X"
383
+ const isMaxLengthError = originalMessage.includes('length') && (originalMessage.includes('less') || originalMessage.includes('equal') || originalMessage.includes('max'));
384
+ let enhancedMessage;
385
+ if (isMaxLengthError && effectiveMaxLength !== undefined) {
386
+ const typeLabel = dataType === ModelPropertyDataTypes.Html ? 'Html' : 'Text';
387
+ if (isDefaultTextLimit) {
388
+ enhancedMessage = `Text properties have a default limit of 255 characters. For longer content, use a File property instead, which can hold arbitrary amounts of text or data.`;
389
+ }
390
+ else {
391
+ enhancedMessage = `${typeLabel} must be ${effectiveMaxLength} characters or less. For longer content, use a File property instead, which can hold arbitrary amounts of text or data.`;
392
+ }
393
+ }
394
+ else {
395
+ enhancedMessage = this.enhanceErrorMessage(err, schema, fieldPath);
396
+ }
397
+ // Use max_length_exceeded when failure is due to maxLength; enum_violation when enum rules; else generic
398
+ const code = isMaxLengthError
399
+ ? 'max_length_exceeded'
400
+ : hasEnumRules
401
+ ? 'enum_violation'
402
+ : String(err.type || 'value_validation_error');
304
403
  return {
305
404
  field: fieldPath,
306
405
  message: enhancedMessage,
307
- code: String(err.type || 'value_validation_error'),
406
+ code,
308
407
  severity: 'error',
309
408
  };
310
409
  }));
@@ -402,30 +501,31 @@ class SchemaValidationService {
402
501
  });
403
502
  }
404
503
  }
405
- // Validate List: requires items with type; model required only when items.type === 'Relation'
406
- if (propertyDefinition.type === 'List') {
407
- const items = propertyDefinition.items;
408
- if (!items || !items.type) {
504
+ // Validate List: requires refValueType; ref (model) required only when refValueType === 'Relation' (case-insensitive)
505
+ if (propertyDefinition.type === 'List' || propertyDefinition.dataType === 'List') {
506
+ const rawRefValueType = propertyDefinition.refValueType ?? propertyDefinition.items?.type ?? propertyDefinition.refvaluetype;
507
+ const refValueType = rawRefValueType ? normalizeDataType(String(rawRefValueType)) : undefined;
508
+ if (!refValueType || String(refValueType).trim() === '') {
409
509
  errors.push({
410
- field: 'property.items',
411
- message: 'List properties require "items" with "type" (e.g. items: { type: "Text" } or items: { type: "Relation", model: "Tag" })',
412
- code: 'missing_items',
510
+ field: 'property.refValueType',
511
+ message: 'List properties require "refValueType" (e.g. refValueType: "Text" or refValueType: "Relation" with ref: "Tag")',
512
+ code: 'missing_ref_value_type',
413
513
  severity: 'error',
414
514
  });
415
515
  }
416
- else if (items.type === 'Relation' || items.type === 'RelationProperty') {
417
- const model = items.model || propertyDefinition.model;
516
+ else if (refValueType === 'Relation' || refValueType === 'RelationProperty') {
517
+ const model = propertyDefinition.ref ?? propertyDefinition.model ?? propertyDefinition.items?.model;
418
518
  if (!model || String(model).trim() === '') {
419
519
  errors.push({
420
- field: 'property.items.model',
421
- message: 'List of relations requires "items.model" to specify the related model',
520
+ field: 'property.ref',
521
+ message: 'List of relations requires "ref" to specify the related model',
422
522
  code: 'missing_ref',
423
523
  severity: 'error',
424
524
  });
425
525
  }
426
526
  else if (schema.models && !schema.models[model]) {
427
527
  errors.push({
428
- field: 'property.items.model',
528
+ field: 'property.ref',
429
529
  message: `Referenced model "${model}" not found in schema`,
430
530
  code: 'invalid_reference',
431
531
  severity: 'error',
@@ -651,4 +751,4 @@ class SchemaValidationService {
651
751
  }
652
752
 
653
753
  export { SchemaValidationService };
654
- //# sourceMappingURL=SchemaValidationService-CwKY3QlY.js.map
754
+ //# sourceMappingURL=SchemaValidationService-DXxRk-9Q.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaValidationService-DXxRk-9Q.js","sources":["../../src/Schema/service/validation/SchemaValidationService.ts"],"sourcesContent":["import { Value } from '@sinclair/typebox/value'\nimport { TProperty } from '@/Schema'\nimport { ModelPropertyDataTypes, TPropertyDataType, normalizeDataType } from '@/helpers/property'\nimport { ValidationResult, ValidationError, ValidationRules, DEFAULT_TEXT_MAX_LENGTH } from '@/Schema/validation'\nimport { SchemaMachineContext } from '../schemaMachine'\nimport { ModelPropertyMachineContext } from '@/ModelProperty/service/modelPropertyMachine'\nimport { ModelMachineContext } from '@/Model/service/modelMachine'\nimport { Type, TSchema, TUnion, TLiteral } from '@sinclair/typebox'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:schema:validation')\n\n/**\n * Service for validating schemas, models, and properties using TypeBox\n */\nexport class SchemaValidationService {\n /**\n * Enhance TypeBox error message with expected values for union/literal types\n */\n private enhanceErrorMessage(\n error: any,\n schema: TSchema,\n fieldPath: string\n ): string {\n const originalMessage = error.message || 'Validation failed'\n \n // Handle Union type errors (like TPropertyDataType)\n if (error.type === 'Union' || originalMessage.includes('union')) {\n const expectedValues = this.extractExpectedValues(schema, fieldPath)\n if (expectedValues.length > 0) {\n return `Expected one of: ${expectedValues.join(', ')}. Received: ${JSON.stringify(error.value)}`\n }\n }\n \n // Handle Literal type errors\n if (error.type === 'Literal') {\n const expectedValue = this.extractLiteralValue(schema, fieldPath)\n if (expectedValue !== undefined) {\n return `Expected: ${JSON.stringify(expectedValue)}. Received: ${JSON.stringify(error.value)}`\n }\n }\n \n // Return enhanced message with value info if available\n if (error.value !== undefined) {\n return `${originalMessage}. Received: ${JSON.stringify(error.value)}`\n }\n \n return originalMessage\n }\n\n /**\n * Extract expected values from a schema for a given field path\n */\n private extractExpectedValues(schema: TSchema | null, fieldPath: string): string[] {\n try {\n // Handle TProperty schema - check if this is the dataType field\n if (fieldPath === '/dataType' || fieldPath.endsWith('/dataType')) {\n // Return all ModelPropertyDataTypes enum values\n return Object.values(ModelPropertyDataTypes) as string[]\n }\n \n // Handle TStorageType\n if (fieldPath === '/storageType' || fieldPath.endsWith('/storageType')) {\n return ['ItemStorage', 'PropertyStorage']\n }\n \n // If we have a schema, try to extract from it\n if (!schema) {\n return []\n }\n \n // Try to extract from TypeBox Union type using the schema directly\n const schemaObj = schema as any\n const kind = schemaObj[Symbol.for('TypeBox.Kind')]\n \n if (kind === 'Union') {\n const union = schemaObj as TUnion<any>\n const anyOf = union.anyOf || []\n const values: string[] = []\n \n for (const item of anyOf) {\n const itemKind = item?.[Symbol.for('TypeBox.Kind')]\n if (itemKind === 'Literal') {\n const literal = item as TLiteral<any>\n if (literal.const !== undefined) {\n values.push(String(literal.const))\n }\n }\n }\n \n if (values.length > 0) {\n return values\n }\n }\n \n // Fallback: try to extract from JSON schema format\n if (typeof schema === 'object' && 'anyOf' in schema) {\n const union = schema as any\n if (Array.isArray(union.anyOf)) {\n return union.anyOf\n .map((item: any) => {\n if (item.const !== undefined) return String(item.const)\n if (item.enum && Array.isArray(item.enum)) return item.enum.map(String)\n return null\n })\n .filter((val: any) => val !== null)\n .flat()\n .map(String)\n }\n }\n } catch (error) {\n logger('Error extracting expected values:', error)\n }\n \n return []\n }\n\n /**\n * Extract literal value from a schema\n */\n private extractLiteralValue(schema: TSchema, fieldPath: string): any {\n try {\n if (schema && typeof schema === 'object') {\n const schemaObj = schema as any\n if (schemaObj[Symbol.for('TypeBox.Kind')] === 'Literal') {\n return (schemaObj as TLiteral<any>).const\n }\n if (schemaObj.const !== undefined) {\n return schemaObj.const\n }\n }\n } catch (error) {\n logger('Error extracting literal value:', error)\n }\n \n return undefined\n }\n\n /**\n * Get the schema for a specific field path\n */\n private getSchemaForField(schema: TSchema, fieldPath: string): TSchema | null {\n try {\n if (!schema || typeof schema !== 'object') return null\n \n // Remove leading slash\n const path = fieldPath.replace(/^\\//, '')\n if (!path) return schema\n \n const schemaObj = schema as any\n const kind = schemaObj[Symbol.for('TypeBox.Kind')]\n \n // For TProperty (Object type), check properties\n if (kind === 'Object') {\n const properties = schemaObj.properties\n if (properties && properties[path]) {\n return properties[path]\n }\n }\n \n // Special handling for known fields - return the actual schema\n if (path === 'dataType') {\n return TPropertyDataType as TSchema\n }\n \n // Fallback: check if schema has the property\n if (path in schemaObj) {\n return schemaObj[path]\n }\n } catch (error) {\n logger('Error getting schema for field:', error)\n }\n \n return null\n }\n\n /**\n * Validate a property structure against TProperty schema\n */\n validatePropertyStructure(\n property: ModelPropertyMachineContext\n ): ValidationResult {\n try {\n // Normalize dataType and refValueType for case-insensitive schema support (e.g. \"relation\" -> \"Relation\")\n const normalized = { ...property }\n if (typeof normalized.dataType === 'string') {\n normalized.dataType = normalizeDataType(normalized.dataType) as any\n }\n if (typeof normalized.refValueType === 'string') {\n normalized.refValueType = normalizeDataType(normalized.refValueType) as any\n }\n const isValid = Value.Check(TProperty, normalized)\n \n const errors: ValidationError[] = []\n \n if (!isValid) {\n const typeBoxErrors = [...Value.Errors(TProperty, normalized)]\n errors.push(...typeBoxErrors.map(err => {\n const fieldPath = err.path || 'unknown'\n const fieldSchema = this.getSchemaForField(TProperty, fieldPath)\n const enhancedMessage = this.enhanceErrorMessage(err, fieldSchema || TProperty, fieldPath)\n \n return {\n field: fieldPath,\n message: enhancedMessage,\n code: String(err.type || 'validation_error'),\n severity: 'error' as const,\n }\n }))\n }\n \n // Non-List types: refValueType is only valid for Relation+Image (related entity type). Reject otherwise.\n const nonListTypes = [\n ModelPropertyDataTypes.Text,\n ModelPropertyDataTypes.Number,\n ModelPropertyDataTypes.Boolean,\n ModelPropertyDataTypes.Date,\n ModelPropertyDataTypes.Json,\n ModelPropertyDataTypes.Image,\n ModelPropertyDataTypes.File,\n ModelPropertyDataTypes.Html,\n ModelPropertyDataTypes.Relation,\n ]\n if (nonListTypes.includes(normalized.dataType as ModelPropertyDataTypes)) {\n const hasRefValueType = normalized.refValueType != null && String(normalized.refValueType).trim() !== ''\n if (hasRefValueType) {\n // Relation may keep refValueType only for Image (relation to Image entity)\n if (normalized.dataType === ModelPropertyDataTypes.Relation && normalized.refValueType === ModelPropertyDataTypes.Image) {\n // Allowed: Relation to Image\n } else {\n errors.push({\n field: 'refValueType',\n message: `refValueType is only valid for List properties. Use dataType 'List' with refValueType '${normalized.refValueType}' for lists of ${normalized.refValueType}.`,\n code: 'invalid_ref_value_type',\n severity: 'error' as const,\n })\n }\n }\n }\n\n // List: refValueType is required\n if (normalized.dataType === ModelPropertyDataTypes.List) {\n const hasRefValueType = normalized.refValueType != null && String(normalized.refValueType).trim() !== ''\n if (!hasRefValueType) {\n errors.push({\n field: 'refValueType',\n message: `List properties require refValueType (e.g. 'Text', 'Number', 'Relation') to specify the element type.`,\n code: 'missing_ref_value_type',\n severity: 'error' as const,\n })\n }\n // List of relations: ref is required\n if (hasRefValueType && normalized.refValueType === ModelPropertyDataTypes.Relation) {\n const hasRef = normalized.ref && normalized.ref.trim() !== ''\n const hasRefModelName = normalized.refModelName && normalized.refModelName.trim() !== ''\n const hasRefModelId = normalized.refModelId !== undefined && normalized.refModelId !== null\n if (!hasRef && !hasRefModelName && !hasRefModelId) {\n errors.push({\n field: 'ref',\n message: `List properties with refValueType 'Relation' require either a \"ref\", \"refModelName\", or \"refModelId\" field to be defined`,\n code: 'missing_ref',\n severity: 'error' as const,\n })\n }\n }\n }\n\n // Relation (single): ref is required\n if (normalized.dataType === ModelPropertyDataTypes.Relation) {\n const hasRef = normalized.ref && normalized.ref.trim() !== ''\n const hasRefModelName = normalized.refModelName && normalized.refModelName.trim() !== ''\n const hasRefModelId = normalized.refModelId !== undefined && normalized.refModelId !== null\n if (!hasRef && !hasRefModelName && !hasRefModelId) {\n errors.push({\n field: 'ref',\n message: `Property with dataType \"Relation\" requires either a \"ref\", \"refModelName\", or \"refModelId\" field to be defined`,\n code: 'missing_ref',\n severity: 'error' as const,\n })\n }\n if ((hasRef || hasRefModelName) && !hasRefModelId) {\n logger(`Property \"${normalized.name}\" has ref/refModelName but no refModelId - will be resolved asynchronously`)\n }\n }\n \n return {\n isValid: errors.length === 0,\n errors,\n }\n } catch (error) {\n logger('Error validating property structure:', error)\n return {\n isValid: false,\n errors: [{\n field: 'property',\n message: error instanceof Error ? error.message : 'Unknown validation error',\n code: 'validation_exception',\n severity: 'error' as const,\n }],\n }\n }\n }\n\n /**\n * Validate a property value against its validation rules\n * @param value - The value to validate\n * @param dataType - The property's data type\n * @param validationRules - Optional validation rules (enum, pattern, minLength, maxLength)\n * @param refValueType - For List properties: the element type (Text, Number, etc.). When set, each array element is validated against this type + validationRules.\n */\n validatePropertyValue(\n value: any,\n dataType: ModelPropertyDataTypes,\n validationRules?: ValidationRules,\n refValueType?: ModelPropertyDataTypes | string\n ): ValidationResult {\n const errors: ValidationError[] = []\n const warnings: ValidationError[] = []\n\n try {\n // Array values are only allowed for List properties\n if (dataType !== ModelPropertyDataTypes.List && Array.isArray(value)) {\n errors.push({\n field: 'value',\n message: 'Array values are only allowed for List properties. Use dataType \"List\" with refValueType to store multiple values.',\n code: 'array_not_allowed',\n severity: 'error' as const,\n })\n }\n\n // File/Image: accept File objects from OS picker (TypeBox schema only allows string|null)\n if (\n (dataType === ModelPropertyDataTypes.File || dataType === ModelPropertyDataTypes.Image) &&\n typeof File !== 'undefined' &&\n value instanceof File\n ) {\n if (validationRules) {\n const customErrors = this.validateCustomRules(value, validationRules)\n errors.push(...customErrors)\n }\n return {\n isValid: errors.length === 0,\n errors,\n warnings: warnings.length > 0 ? warnings : undefined,\n }\n }\n\n // List with refValueType: validate each element against element schema + validation rules\n if (dataType === ModelPropertyDataTypes.List && refValueType && Array.isArray(value)) {\n const elementDataType = normalizeDataType(String(refValueType)) as ModelPropertyDataTypes\n // Apply default maxLength for Text elements in List. Html elements hold arbitrary-length content.\n const elementEffectiveRules = validationRules ? { ...validationRules } : {}\n if (elementDataType === ModelPropertyDataTypes.Text && elementEffectiveRules.maxLength === undefined) {\n elementEffectiveRules.maxLength = DEFAULT_TEXT_MAX_LENGTH\n }\n for (let i = 0; i < value.length; i++) {\n const elementResult = this.validatePropertyValue(\n value[i],\n elementDataType,\n elementEffectiveRules\n )\n if (!elementResult.isValid && elementResult.errors.length > 0) {\n for (const err of elementResult.errors) {\n errors.push({\n field: `value[${i}]`,\n message: `Element at index ${i}: ${err.message}`,\n code: validationRules?.enum && Array.isArray(validationRules.enum) && validationRules.enum.length > 0 ? 'enum_violation' : err.code,\n severity: err.severity,\n })\n }\n }\n }\n if (validationRules) {\n const customErrors = this.validateCustomRules(value, validationRules)\n errors.push(...customErrors)\n }\n return {\n isValid: errors.length === 0,\n errors,\n warnings: warnings.length > 0 ? warnings : undefined,\n }\n }\n\n // List without refValueType or non-array: validate as scalar/array\n if (dataType === ModelPropertyDataTypes.List && !Array.isArray(value) && value != null) {\n errors.push({\n field: 'value',\n message: 'List properties require an array value.',\n code: 'array_required',\n severity: 'error' as const,\n })\n return { isValid: false, errors }\n }\n\n // Build base TypeBox schema from dataType\n let schema: TSchema = this.getBaseSchemaForDataType(dataType)\n\n // Apply default maxLength for Text when not explicitly set. Html holds arbitrary-length content (e.g. article body) and must not default to 255.\n const effectiveRules = validationRules ? { ...validationRules } : {}\n if (dataType === ModelPropertyDataTypes.Text && effectiveRules.maxLength === undefined) {\n effectiveRules.maxLength = DEFAULT_TEXT_MAX_LENGTH\n }\n\n // Apply validation rules\n const hasEnumRules = !!(validationRules?.enum && Array.isArray(validationRules.enum) && validationRules.enum.length > 0)\n if (Object.keys(effectiveRules).length > 0) {\n schema = this.applyValidationRules(schema, dataType, effectiveRules)\n }\n\n // Validate using TypeBox\n const isValid = Value.Check(schema, value)\n \n if (!isValid) {\n const typeBoxErrors = [...Value.Errors(schema, value)]\n const effectiveMaxLength = effectiveRules.maxLength\n const isDefaultTextLimit =\n dataType === ModelPropertyDataTypes.Text &&\n effectiveMaxLength === DEFAULT_TEXT_MAX_LENGTH &&\n validationRules?.maxLength === undefined\n errors.push(...typeBoxErrors.map(err => {\n const fieldPath = err.path || 'value'\n const originalMessage = (err.message || '').toLowerCase()\n // TypeBox maxLength errors have message like \"Expected string length less or equal to X\"\n const isMaxLengthError = originalMessage.includes('length') && (originalMessage.includes('less') || originalMessage.includes('equal') || originalMessage.includes('max'))\n let enhancedMessage: string\n if (isMaxLengthError && effectiveMaxLength !== undefined) {\n const typeLabel = dataType === ModelPropertyDataTypes.Html ? 'Html' : 'Text'\n if (isDefaultTextLimit) {\n enhancedMessage = `Text properties have a default limit of 255 characters. For longer content, use a File property instead, which can hold arbitrary amounts of text or data.`\n } else {\n enhancedMessage = `${typeLabel} must be ${effectiveMaxLength} characters or less. For longer content, use a File property instead, which can hold arbitrary amounts of text or data.`\n }\n } else {\n enhancedMessage = this.enhanceErrorMessage(err, schema, fieldPath)\n }\n // Use max_length_exceeded when failure is due to maxLength; enum_violation when enum rules; else generic\n const code = isMaxLengthError\n ? 'max_length_exceeded'\n : hasEnumRules\n ? 'enum_violation'\n : String(err.type || 'value_validation_error')\n\n return {\n field: fieldPath,\n message: enhancedMessage,\n code,\n severity: 'error' as const,\n }\n }))\n }\n\n // Additional custom validations\n if (validationRules) {\n const customErrors = this.validateCustomRules(value, validationRules)\n errors.push(...customErrors)\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n warnings: warnings.length > 0 ? warnings : undefined,\n }\n } catch (error) {\n logger('Error validating property value:', error)\n return {\n isValid: false,\n errors: [{\n field: 'value',\n message: error instanceof Error ? error.message : 'Unknown validation error',\n code: 'validation_exception',\n severity: 'error' as const,\n }],\n }\n }\n }\n\n /**\n * Validate a specific property within a schema\n */\n validateProperty(\n schema: SchemaMachineContext,\n modelName: string,\n propertyName: string,\n propertyData?: ModelPropertyMachineContext\n ): ValidationResult {\n const errors: ValidationError[] = []\n\n // Check if model exists\n if (!schema.models || !schema.models[modelName]) {\n errors.push({\n field: 'model',\n message: `Model \"${modelName}\" not found in schema`,\n code: 'model_not_found',\n severity: 'error' as const,\n })\n return { isValid: false, errors }\n }\n\n const model = schema.models[modelName]\n\n // Check if property exists in model\n // If the property name has changed (renamed), check if the original name exists\n let propertyDefinition = model.properties?.[propertyName]\n let actualPropertyName = propertyName\n \n if (!propertyDefinition && propertyData?._originalValues?.name) {\n const originalName = propertyData._originalValues.name\n // If the current name differs from the original, check if original exists\n if (originalName !== propertyName && model.properties?.[originalName]) {\n propertyDefinition = model.properties[originalName]\n actualPropertyName = originalName\n // Property is being renamed, which is allowed - continue validation\n }\n }\n \n if (!propertyDefinition) {\n errors.push({\n field: 'property',\n message: `Property \"${propertyName}\" not found in model \"${modelName}\"`,\n code: 'property_not_found',\n severity: 'error' as const,\n })\n return { isValid: false, errors }\n }\n\n // If propertyData is provided, validate its structure\n if (propertyData) {\n const structureResult = this.validatePropertyStructure(propertyData)\n errors.push(...structureResult.errors)\n }\n\n // Validate property definition structure\n if (!propertyDefinition.type) {\n errors.push({\n field: 'property.type',\n message: 'Property type is required',\n code: 'missing_type',\n severity: 'error' as const,\n })\n }\n\n // Validate Relation: requires model\n if (propertyDefinition.type === 'Relation') {\n if (!propertyDefinition.model || propertyDefinition.model.trim() === '') {\n errors.push({\n field: 'property.model',\n message: `Property with type \"Relation\" requires a \"model\" field to be defined`,\n code: 'missing_ref',\n severity: 'error' as const,\n })\n } else if (!schema.models[propertyDefinition.model]) {\n errors.push({\n field: 'property.model',\n message: `Referenced model \"${propertyDefinition.model}\" not found in schema`,\n code: 'invalid_reference',\n severity: 'error' as const,\n })\n }\n }\n\n // Validate List: requires refValueType; ref (model) required only when refValueType === 'Relation' (case-insensitive)\n if (propertyDefinition.type === 'List' || (propertyDefinition as any).dataType === 'List') {\n const rawRefValueType = (propertyDefinition as any).refValueType ?? (propertyDefinition as any).items?.type ?? (propertyDefinition as any).refvaluetype\n const refValueType = rawRefValueType ? normalizeDataType(String(rawRefValueType)) : undefined\n if (!refValueType || String(refValueType).trim() === '') {\n errors.push({\n field: 'property.refValueType',\n message: 'List properties require \"refValueType\" (e.g. refValueType: \"Text\" or refValueType: \"Relation\" with ref: \"Tag\")',\n code: 'missing_ref_value_type',\n severity: 'error' as const,\n })\n } else if (refValueType === 'Relation' || refValueType === 'RelationProperty') {\n const model = (propertyDefinition as any).ref ?? (propertyDefinition as any).model ?? (propertyDefinition as any).items?.model\n if (!model || String(model).trim() === '') {\n errors.push({\n field: 'property.ref',\n message: 'List of relations requires \"ref\" to specify the related model',\n code: 'missing_ref',\n severity: 'error' as const,\n })\n } else if (schema.models && !schema.models[model]) {\n errors.push({\n field: 'property.ref',\n message: `Referenced model \"${model}\" not found in schema`,\n code: 'invalid_reference',\n severity: 'error' as const,\n })\n }\n }\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n }\n }\n\n /**\n * Validate model structure (basic structure checks)\n */\n validateModelStructure(\n model: ModelMachineContext & { properties?: { [key: string]: any } }\n ): ValidationResult {\n const errors: ValidationError[] = []\n\n // Validate model name\n if (!model.modelName || model.modelName.trim() === '') {\n errors.push({\n field: 'modelName',\n message: 'Model name is required',\n code: 'missing_model_name',\n severity: 'error' as const,\n })\n }\n\n // Validate schema name\n if (!model.schemaName || model.schemaName.trim() === '') {\n errors.push({\n field: 'schemaName',\n message: 'Schema name is required',\n code: 'missing_schema_name',\n severity: 'error' as const,\n })\n }\n\n // Validate properties is an object\n if (model.properties && typeof model.properties !== 'object') {\n errors.push({\n field: 'properties',\n message: 'Properties must be an object',\n code: 'invalid_properties',\n severity: 'error' as const,\n })\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n }\n }\n\n /**\n * Validate a model against a schema WITHOUT requiring it to be in the schema's context\n * This allows validation before registration, preventing update loops\n */\n validateModelAgainstSchema(\n schema: SchemaMachineContext,\n modelName: string,\n modelData: ModelMachineContext & { properties?: { [key: string]: any } }\n ): ValidationResult {\n const errors: ValidationError[] = []\n\n // Create a temporary schema context that includes this model for validation purposes\n // This allows validateProperty to work without actually adding the model to the real schema\n const tempSchemaContext: SchemaMachineContext = {\n ...schema,\n models: {\n ...schema.models,\n [modelName]: {\n properties: modelData.properties || {},\n },\n },\n }\n\n // Use validateModel which now works because the model is in the temp context\n return this.validateModel(tempSchemaContext, modelName, modelData)\n }\n\n /**\n * Validate a model within a schema (requires model to already be in schema context)\n */\n validateModel(\n schema: SchemaMachineContext,\n modelName: string,\n modelData?: ModelMachineContext\n ): ValidationResult {\n const errors: ValidationError[] = []\n\n if (!schema.models || !schema.models[modelName]) {\n errors.push({\n field: 'model',\n message: `Model \"${modelName}\" not found in schema`,\n code: 'model_not_found',\n severity: 'error' as const,\n })\n return { isValid: false, errors }\n }\n\n const model = schema.models[modelName]\n\n // Validate all properties in the model\n if (model.properties) {\n for (const [propertyName, propertyDef] of Object.entries(model.properties)) {\n const propertyResult = this.validateProperty(schema, modelName, propertyName)\n if (!propertyResult.isValid) {\n errors.push(...propertyResult.errors.map(err => ({\n ...err,\n field: `${modelName}.${propertyName}.${err.field}`,\n })))\n }\n }\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n }\n }\n\n /**\n * Validate entire schema\n */\n validateSchema(schema: SchemaMachineContext): ValidationResult {\n const errors: ValidationError[] = []\n\n // Validate schema name\n if (!schema.schemaName || schema.schemaName.trim() === '') {\n errors.push({\n field: 'schemaName',\n message: 'Schema name is required',\n code: 'missing_schema_name',\n severity: 'error' as const,\n })\n }\n\n // Validate metadata\n if (!schema.metadata) {\n errors.push({\n field: 'metadata',\n message: 'Schema metadata is required',\n code: 'missing_metadata',\n severity: 'error' as const,\n })\n } else {\n if (!schema.metadata.name || schema.metadata.name.trim() === '') {\n errors.push({\n field: 'metadata.name',\n message: 'Schema metadata name is required',\n code: 'missing_metadata_name',\n severity: 'error' as const,\n })\n }\n }\n\n // Validate models if they exist\n if (schema.models && Object.keys(schema.models).length > 0) {\n // Validate each model\n for (const modelName of Object.keys(schema.models)) {\n const modelResult = this.validateModel(schema, modelName)\n if (!modelResult.isValid) {\n errors.push(...modelResult.errors)\n }\n }\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n }\n }\n\n /**\n * Get base TypeBox schema for a data type\n */\n private getBaseSchemaForDataType(dataType: ModelPropertyDataTypes): TSchema {\n switch (dataType) {\n case ModelPropertyDataTypes.Text:\n case ModelPropertyDataTypes.Html:\n return Type.String()\n case ModelPropertyDataTypes.Number:\n return Type.Number()\n case ModelPropertyDataTypes.Boolean:\n return Type.Boolean()\n case ModelPropertyDataTypes.Date:\n return Type.String({ format: 'date-time' })\n case ModelPropertyDataTypes.Json:\n return Type.Any()\n case ModelPropertyDataTypes.List:\n return Type.Array(Type.Any())\n case ModelPropertyDataTypes.Relation:\n case ModelPropertyDataTypes.Image:\n case ModelPropertyDataTypes.File:\n return Type.Union([Type.String(), Type.Null()])\n default:\n return Type.Any()\n }\n }\n\n /**\n * Apply validation rules to a TypeBox schema\n */\n private applyValidationRules(\n schema: TSchema,\n dataType: ModelPropertyDataTypes,\n rules: ValidationRules\n ): TSchema {\n let result = schema\n\n // Apply pattern (regex) for strings\n if (rules.pattern && (dataType === ModelPropertyDataTypes.Text || dataType === ModelPropertyDataTypes.Html)) {\n try {\n const regex = new RegExp(rules.pattern)\n result = Type.RegExp(regex)\n } catch (error) {\n logger('Invalid regex pattern:', rules.pattern, error)\n }\n }\n\n // Apply minLength/maxLength for strings\n if (dataType === ModelPropertyDataTypes.Text || dataType === ModelPropertyDataTypes.Html) {\n const stringSchema = Type.String()\n if (rules.minLength !== undefined) {\n result = Type.String({ minLength: rules.minLength })\n }\n if (rules.maxLength !== undefined) {\n if (rules.minLength !== undefined) {\n result = Type.String({ minLength: rules.minLength, maxLength: rules.maxLength })\n } else {\n result = Type.String({ maxLength: rules.maxLength })\n }\n }\n }\n\n // Apply enum\n if (rules.enum && Array.isArray(rules.enum) && rules.enum.length > 0) {\n result = Type.Union(rules.enum.map(val => Type.Literal(val)))\n }\n\n return result\n }\n\n /**\n * Validate custom validation rules\n */\n private validateCustomRules(\n value: any,\n rules: ValidationRules\n ): ValidationError[] {\n const errors: ValidationError[] = []\n\n // Custom validator reference (would need to be implemented based on your needs)\n if (rules.custom) {\n // TODO: Implement custom validator lookup and execution\n logger('Custom validator not yet implemented:', rules.custom)\n }\n\n return errors\n }\n}\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,MAAM,MAAM,GAAG,KAAK,CAAC,2BAA2B,CAAC;AAEjD;;AAEG;MACU,uBAAuB,CAAA;AAClC;;AAEG;AACK,IAAA,mBAAmB,CACzB,KAAU,EACV,MAAe,EACf,SAAiB,EAAA;AAEjB,QAAA,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,IAAI,mBAAmB;;AAG5D,QAAA,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,E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QAC/D;AAEA,QAAA,OAAO,MAAM;IACf;AAEA;;AAEG;IACK,mBAAmB,CACzB,KAAU,EACV,KAAsB,EAAA;QAEtB,MAAM,MAAM,GAAsB,EAAE;;AAGpC,QAAA,IAAI,KAAK,CAAC,MAAM,EAAE;;AAEhB,YAAA,MAAM,CAAC,uCAAuC,EAAE,KAAK,CAAC,MAAM,CAAC;QAC/D;AAEA,QAAA,OAAO,MAAM;IACf;AACD;;;;"}
@@ -0,0 +1,67 @@
1
+ import { and, isNull, sql, eq } from 'drizzle-orm';
2
+ import { o as BaseDb, a3 as metadata, af as getPropertyIdForModelAndName } from './index-uPXtq2cf.js';
3
+ import debug from 'debug';
4
+ import 'xstate';
5
+ import 'drizzle-orm/sqlite-core';
6
+ import 'nanoid';
7
+ import 'nanoid-dictionary';
8
+ import 'ethers';
9
+ import 'pluralize';
10
+ import '@sinclair/typebox';
11
+ import 'drizzle-orm/casing';
12
+ import 'lodash-es';
13
+ import 'rxjs';
14
+ import 'eventemitter3';
15
+ import 'arweave';
16
+ import 'js-sha3';
17
+
18
+ const logger = debug('seedSdk:db:backfillMetadataPropertyIds');
19
+ /**
20
+ * Backfill metadata.property_id for rows that have model_type and property_name
21
+ * but property_id is null. Run after migrations. Idempotent - only updates NULL rows.
22
+ * Call after appDb is set (e.g. at end of prepareDb).
23
+ */
24
+ async function backfillMetadataPropertyIds() {
25
+ const db = BaseDb.getAppDb();
26
+ if (!db) {
27
+ logger('No app db available, skipping backfill');
28
+ return 0;
29
+ }
30
+ try {
31
+ const rowsToBackfill = await db
32
+ .select({
33
+ localId: metadata.localId,
34
+ modelType: metadata.modelType,
35
+ propertyName: metadata.propertyName,
36
+ })
37
+ .from(metadata)
38
+ .where(and(isNull(metadata.propertyId), sql `${metadata.modelType} IS NOT NULL`, sql `${metadata.propertyName} IS NOT NULL`));
39
+ if (rowsToBackfill.length === 0) {
40
+ return 0;
41
+ }
42
+ let updated = 0;
43
+ for (const row of rowsToBackfill) {
44
+ if (!row.modelType || !row.propertyName || !row.localId)
45
+ continue;
46
+ const propertyId = await getPropertyIdForModelAndName(row.modelType, row.propertyName);
47
+ if (propertyId == null)
48
+ continue;
49
+ await db
50
+ .update(metadata)
51
+ .set({ propertyId })
52
+ .where(eq(metadata.localId, row.localId));
53
+ updated++;
54
+ }
55
+ if (updated > 0) {
56
+ logger(`Backfilled property_id for ${updated}/${rowsToBackfill.length} metadata rows`);
57
+ }
58
+ return updated;
59
+ }
60
+ catch (error) {
61
+ logger('Backfill error:', error);
62
+ throw error;
63
+ }
64
+ }
65
+
66
+ export { backfillMetadataPropertyIds };
67
+ //# sourceMappingURL=backfillMetadataPropertyIds-dzwzz4dA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backfillMetadataPropertyIds-dzwzz4dA.js","sources":["../../src/db/backfillMetadataPropertyIds.ts"],"sourcesContent":["import { and, eq, isNull, sql } from 'drizzle-orm'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { metadata } from '@/seedSchema'\nimport { getPropertyIdForModelAndName } from '@/helpers/db'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:db:backfillMetadataPropertyIds')\n\n/**\n * Backfill metadata.property_id for rows that have model_type and property_name\n * but property_id is null. Run after migrations. Idempotent - only updates NULL rows.\n * Call after appDb is set (e.g. at end of prepareDb).\n */\nexport async function backfillMetadataPropertyIds(): Promise<number> {\n const db = BaseDb.getAppDb()\n if (!db) {\n logger('No app db available, skipping backfill')\n return 0\n }\n\n try {\n const rowsToBackfill = await db\n .select({\n localId: metadata.localId,\n modelType: metadata.modelType,\n propertyName: metadata.propertyName,\n })\n .from(metadata)\n .where(\n and(\n isNull(metadata.propertyId),\n sql`${metadata.modelType} IS NOT NULL`,\n sql`${metadata.propertyName} IS NOT NULL`,\n ),\n )\n\n if (rowsToBackfill.length === 0) {\n return 0\n }\n\n let updated = 0\n for (const row of rowsToBackfill) {\n if (!row.modelType || !row.propertyName || !row.localId) continue\n\n const propertyId = await getPropertyIdForModelAndName(\n row.modelType,\n row.propertyName,\n )\n if (propertyId == null) continue\n\n await db\n .update(metadata)\n .set({ propertyId })\n .where(eq(metadata.localId, row.localId))\n\n updated++\n }\n\n if (updated > 0) {\n logger(`Backfilled property_id for ${updated}/${rowsToBackfill.length} metadata rows`)\n }\n return updated\n } catch (error) {\n logger('Backfill error:', error)\n throw error\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAMA,MAAM,MAAM,GAAG,KAAK,CAAC,wCAAwC,CAAC;AAE9D;;;;AAIG;AACI,eAAe,2BAA2B,GAAA;AAC/C,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE;IAC5B,IAAI,CAAC,EAAE,EAAE;QACP,MAAM,CAAC,wCAAwC,CAAC;AAChD,QAAA,OAAO,CAAC;IACV;AAEA,IAAA,IAAI;QACF,MAAM,cAAc,GAAG,MAAM;AAC1B,aAAA,MAAM,CAAC;YACN,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,YAAY,EAAE,QAAQ,CAAC,YAAY;SACpC;aACA,IAAI,CAAC,QAAQ;aACb,KAAK,CACJ,GAAG,CACD,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAC3B,GAAG,CAAA,CAAA,EAAG,QAAQ,CAAC,SAAS,CAAA,YAAA,CAAc,EACtC,GAAG,CAAA,CAAA,EAAG,QAAQ,CAAC,YAAY,CAAA,YAAA,CAAc,CAC1C,CACF;AAEH,QAAA,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;AAC/B,YAAA,OAAO,CAAC;QACV;QAEA,IAAI,OAAO,GAAG,CAAC;AACf,QAAA,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE;AAChC,YAAA,IAAI,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,GAAG,CAAC,OAAO;gBAAE;AAEzD,YAAA,MAAM,UAAU,GAAG,MAAM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