@seedprotocol/sdk 0.6.7 → 0.6.8

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 (201) hide show
  1. package/dist/{BasePathResolver-qV0apdVY.js → BasePathResolver-B6CKqoKw.js} +16 -5
  2. package/dist/BasePathResolver-B6CKqoKw.js.map +1 -0
  3. package/dist/{ClientManager-Y5EWQuJj.js → ClientManager-ChcmUL47.js} +619 -264
  4. package/dist/ClientManager-ChcmUL47.js.map +1 -0
  5. package/dist/{ModelProperty-DuB5nk6A.js → ModelProperty-D79uV42p.js} +33 -30
  6. package/dist/ModelProperty-D79uV42p.js.map +1 -0
  7. package/dist/{Schema-BYM-GNdE.js → Schema-a8uO-hIZ.js} +43 -43
  8. package/dist/Schema-a8uO-hIZ.js.map +1 -0
  9. package/dist/{SchemaValidationService-Dr6nmwPm.js → SchemaValidationService-Y49vqast.js} +13 -12
  10. package/dist/SchemaValidationService-Y49vqast.js.map +1 -0
  11. package/dist/{backfillMetadataPropertyIds-BzbAB-C5.js → backfillMetadataPropertyIds-CBsf7LnU.js} +5 -3
  12. package/dist/{backfillMetadataPropertyIds-BzbAB-C5.js.map → backfillMetadataPropertyIds-CBsf7LnU.js.map} +1 -1
  13. package/dist/cjs/{ModelProperty-CDTOx5zi.js → ModelProperty-D9FGaGuE.js} +21 -17
  14. package/dist/cjs/ModelProperty-D9FGaGuE.js.map +1 -0
  15. package/dist/cjs/{Schema-XXcwj3hV.js → Schema-BiJIPLEL.js} +25 -24
  16. package/dist/cjs/Schema-BiJIPLEL.js.map +1 -0
  17. package/dist/cjs/{SchemaValidationService-Z7OhtGn5.js → SchemaValidationService-DtYs_CNY.js} +5 -3
  18. package/dist/cjs/SchemaValidationService-DtYs_CNY.js.map +1 -0
  19. package/dist/cjs/{backfillMetadataPropertyIds-Bt4fzfIV.js → backfillMetadataPropertyIds-2XaN3b9S.js} +3 -2
  20. package/dist/cjs/{backfillMetadataPropertyIds-Bt4fzfIV.js.map → backfillMetadataPropertyIds-2XaN3b9S.js.map} +1 -1
  21. package/dist/cjs/{eas-DdI-4vwl.js → eas-CMNppmGE.js} +4 -3
  22. package/dist/cjs/{eas-DdI-4vwl.js.map → eas-CMNppmGE.js.map} +1 -1
  23. package/dist/cjs/{getItem-B_2GeTQf.js → getItem-B6jEINjW.js} +3 -2
  24. package/dist/cjs/{getItem-B_2GeTQf.js.map → getItem-B6jEINjW.js.map} +1 -1
  25. package/dist/cjs/{getPublishPayload-Jmgi1RUj.js → getPublishPayload-D5DhLGvN.js} +64 -59
  26. package/dist/cjs/getPublishPayload-D5DhLGvN.js.map +1 -0
  27. package/dist/cjs/{getPublishUploads-DNULcrN5.js → getPublishUploads-DMhCCKYF.js} +17 -10
  28. package/dist/cjs/getPublishUploads-DMhCCKYF.js.map +1 -0
  29. package/dist/cjs/{getSegmentedItemProperties-DK82kjri.js → getSegmentedItemProperties-CU8rtBAo.js} +3 -51
  30. package/dist/cjs/getSegmentedItemProperties-CU8rtBAo.js.map +1 -0
  31. package/dist/cjs/{index-DM1WR83P.js → index-CSNtEnbF.js} +879 -467
  32. package/dist/cjs/index-CSNtEnbF.js.map +1 -0
  33. package/dist/cjs/{index-tpO1Nj4v.js → index-DPp9rdRL.js} +6 -3
  34. package/dist/cjs/index-DPp9rdRL.js.map +1 -0
  35. package/dist/cjs/{property-DmvgA8FD.js → property-DlKiAWt4.js} +7 -4
  36. package/dist/cjs/{property-DmvgA8FD.js.map → property-DlKiAWt4.js.map} +1 -1
  37. package/dist/cjs/{syncDbWithEas-3hOoPdu1.js → syncDbWithEas-C6n34o_Q.js} +11 -6
  38. package/dist/cjs/syncDbWithEas-C6n34o_Q.js.map +1 -0
  39. package/dist/{configurePlatform-CCYQruij.js → configurePlatform-CE0Vew17.js} +5 -5
  40. package/dist/{configurePlatform-CCYQruij.js.map → configurePlatform-CE0Vew17.js.map} +1 -1
  41. package/dist/db/drizzle/0014_add_error_code_to_publish_processes.sql +1 -0
  42. package/dist/db/drizzle/meta/0014_snapshot.json +1269 -0
  43. package/dist/db/drizzle/meta/_journal.json +7 -0
  44. package/dist/{db-CceyWksv.js → db-WbrzEf7c.js} +254 -35
  45. package/dist/db-WbrzEf7c.js.map +1 -0
  46. package/dist/{eas-CH8iFIST.js → eas-CfYCu4IX.js} +6 -6
  47. package/dist/{eas-CH8iFIST.js.map → eas-CfYCu4IX.js.map} +1 -1
  48. package/dist/{getItem-C7Mtfz6O.js → getItem-Br-bGNFO.js} +6 -6
  49. package/dist/{getItem-C7Mtfz6O.js.map → getItem-Br-bGNFO.js.map} +1 -1
  50. package/dist/{getPublishPayload-2gnnDdMh.js → getPublishPayload-BIrTVUxb.js} +66 -62
  51. package/dist/getPublishPayload-BIrTVUxb.js.map +1 -0
  52. package/dist/{getPublishUploads-AKISt3JA.js → getPublishUploads-C6cDeZdz.js} +19 -13
  53. package/dist/getPublishUploads-C6cDeZdz.js.map +1 -0
  54. package/dist/{getSegmentedItemProperties-eIjvhCP_.js → getSegmentedItemProperties-BmKE71vU.js} +5 -5
  55. package/dist/{getSegmentedItemProperties-eIjvhCP_.js.map → getSegmentedItemProperties-BmKE71vU.js.map} +1 -1
  56. package/dist/{constants-DSqHBPNe.js → index-280bL-n4.js} +32 -257
  57. package/dist/index-280bL-n4.js.map +1 -0
  58. package/dist/{index-CHi212ST.js → index-ClSv5pTA.js} +13 -13
  59. package/dist/index-ClSv5pTA.js.map +1 -0
  60. package/dist/{index-CsmiM0RI.js → index-Djd3667v.js} +2 -2
  61. package/dist/index-Djd3667v.js.map +1 -0
  62. package/dist/{index-BFpbtEsg.js → index-HRHkbVQd.js} +24 -24
  63. package/dist/{index-BFpbtEsg.js.map → index-HRHkbVQd.js.map} +1 -1
  64. package/dist/{index.node-CbWB4MDz.js → index.node-DBtQkEfz.js} +8 -6
  65. package/dist/index.node-DBtQkEfz.js.map +1 -0
  66. package/dist/main.cjs +6 -1
  67. package/dist/main.cjs.map +1 -1
  68. package/dist/main.js +36 -38
  69. package/dist/main.js.map +1 -1
  70. package/dist/node.js +15 -14
  71. package/dist/node.js.map +1 -1
  72. package/dist/platform.browser.js +108 -46
  73. package/dist/platform.browser.js.map +1 -1
  74. package/dist/platform.node.js +4 -3
  75. package/dist/platform.node.js.map +1 -1
  76. package/dist/{property-CWKcZ5YZ.js → property-CQjuZ4JW.js} +14 -13
  77. package/dist/property-CQjuZ4JW.js.map +1 -0
  78. package/dist/seedSchema/PublishProcessSchema.ts +1 -0
  79. package/dist/src/Item/Item.d.ts +6 -0
  80. package/dist/src/Item/Item.d.ts.map +1 -1
  81. package/dist/src/Item/service/actors/loadOrCreateItem.d.ts.map +1 -1
  82. package/dist/src/ItemProperty/ItemProperty.d.ts +10 -1
  83. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  84. package/dist/src/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
  85. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +1 -1
  86. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  87. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  88. package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
  89. package/dist/src/Schema/service/actors/writeModelsToDb.d.ts.map +1 -1
  90. package/dist/src/Schema/service/addModelsMachine.d.ts.map +1 -1
  91. package/dist/src/Schema/service/validation/SchemaValidationService.d.ts.map +1 -1
  92. package/dist/src/browser/db/drizzleFiles.d.ts +3 -2
  93. package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
  94. package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
  95. package/dist/src/browser/helpers/EasClient.d.ts +2 -1
  96. package/dist/src/browser/helpers/EasClient.d.ts.map +1 -1
  97. package/dist/src/browser/helpers/FileManager.d.ts +1 -1
  98. package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
  99. package/dist/src/browser/workers/FileDownloader.d.ts +1 -1
  100. package/dist/src/browser/workers/FileDownloader.d.ts.map +1 -1
  101. package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
  102. package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
  103. package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
  104. package/dist/src/client/constants.d.ts +4 -0
  105. package/dist/src/client/constants.d.ts.map +1 -1
  106. package/dist/src/client/nodeEndpointDefaults.d.ts +8 -0
  107. package/dist/src/client/nodeEndpointDefaults.d.ts.map +1 -0
  108. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  109. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  110. package/dist/src/db/read/getRelatedItemsForPublish.d.ts.map +1 -1
  111. package/dist/src/db/write/createMetadata.d.ts.map +1 -1
  112. package/dist/src/events/files/download.d.ts.map +1 -1
  113. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  114. package/dist/src/helpers/ArweaveClient/index.d.ts.map +1 -1
  115. package/dist/src/helpers/FileManager/BaseFileManager.d.ts +2 -2
  116. package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
  117. package/dist/src/helpers/FileManager/IFileManager.d.ts +4 -0
  118. package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
  119. package/dist/src/helpers/constants.d.ts +8 -0
  120. package/dist/src/helpers/constants.d.ts.map +1 -1
  121. package/dist/src/helpers/db.d.ts +6 -0
  122. package/dist/src/helpers/db.d.ts.map +1 -1
  123. package/dist/src/helpers/gateway/gatewayState.d.ts +1 -1
  124. package/dist/src/helpers/gateway/gatewayState.d.ts.map +1 -1
  125. package/dist/src/helpers/localDbChain.d.ts +22 -0
  126. package/dist/src/helpers/localDbChain.d.ts.map +1 -0
  127. package/dist/src/helpers/metadataPropertyNames.d.ts +9 -0
  128. package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
  129. package/dist/src/helpers/property/index.d.ts +12 -0
  130. package/dist/src/helpers/property/index.d.ts.map +1 -1
  131. package/dist/src/helpers/readHtmlBodyForStorageSeed.d.ts.map +1 -1
  132. package/dist/src/helpers/relationSeedRef.d.ts +8 -0
  133. package/dist/src/helpers/relationSeedRef.d.ts.map +1 -1
  134. package/dist/src/index.d.ts +9 -5
  135. package/dist/src/index.d.ts.map +1 -1
  136. package/dist/src/node/easLodashHook.d.ts +2 -0
  137. package/dist/src/node/easLodashHook.d.ts.map +1 -0
  138. package/dist/src/node/easLodashRegister.d.ts +2 -0
  139. package/dist/src/node/easLodashRegister.d.ts.map +1 -0
  140. package/dist/src/node/helpers/FileManager.d.ts +2 -1
  141. package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
  142. package/dist/src/node/index.d.ts +2 -1
  143. package/dist/src/node/index.d.ts.map +1 -1
  144. package/dist/src/seedSchema/PublishProcessSchema.d.ts +19 -0
  145. package/dist/src/seedSchema/PublishProcessSchema.d.ts.map +1 -1
  146. package/dist/src/types/fileManager.d.ts +4 -0
  147. package/dist/src/types/fileManager.d.ts.map +1 -1
  148. package/dist/src/types/index.d.ts +15 -1
  149. package/dist/src/types/index.d.ts.map +1 -1
  150. package/dist/{syncDbWithEas-5kZneTEL.js → syncDbWithEas-CuARXfyN.js} +16 -12
  151. package/dist/syncDbWithEas-CuARXfyN.js.map +1 -0
  152. package/dist/{updateSeedRevokedAt-CgfOBtqJ.js → updateSeedRevokedAt-CBcLfHWs.js} +2 -2
  153. package/dist/{updateSeedRevokedAt-CgfOBtqJ.js.map → updateSeedRevokedAt-CBcLfHWs.js.map} +1 -1
  154. package/package.json +11 -7
  155. package/src/node/easLodashHook.js +22 -0
  156. package/src/node/easLodashRegister.js +13 -0
  157. package/dist/BasePathResolver-qV0apdVY.js.map +0 -1
  158. package/dist/ClientManager-Y5EWQuJj.js.map +0 -1
  159. package/dist/ModelProperty-DuB5nk6A.js.map +0 -1
  160. package/dist/Schema-BYM-GNdE.js.map +0 -1
  161. package/dist/SchemaValidationService-Dr6nmwPm.js.map +0 -1
  162. package/dist/cjs/ModelProperty-CDTOx5zi.js.map +0 -1
  163. package/dist/cjs/Schema-XXcwj3hV.js.map +0 -1
  164. package/dist/cjs/SchemaValidationService-Z7OhtGn5.js.map +0 -1
  165. package/dist/cjs/getPublishPayload-Jmgi1RUj.js.map +0 -1
  166. package/dist/cjs/getPublishUploads-DNULcrN5.js.map +0 -1
  167. package/dist/cjs/getSegmentedItemProperties-DK82kjri.js.map +0 -1
  168. package/dist/cjs/index-DM1WR83P.js.map +0 -1
  169. package/dist/cjs/index-tpO1Nj4v.js.map +0 -1
  170. package/dist/cjs/syncDbWithEas-3hOoPdu1.js.map +0 -1
  171. package/dist/constants-DSqHBPNe.js.map +0 -1
  172. package/dist/db-CceyWksv.js.map +0 -1
  173. package/dist/getPublishPayload-2gnnDdMh.js.map +0 -1
  174. package/dist/getPublishUploads-AKISt3JA.js.map +0 -1
  175. package/dist/index-CHi212ST.js.map +0 -1
  176. package/dist/index-CsmiM0RI.js.map +0 -1
  177. package/dist/index.node-CbWB4MDz.js.map +0 -1
  178. package/dist/property-CWKcZ5YZ.js.map +0 -1
  179. package/dist/seedSchema/AppStateSchema.d.ts +0 -82
  180. package/dist/seedSchema/AppStateSchema.d.ts.map +0 -1
  181. package/dist/seedSchema/ConfigSchema.d.ts +0 -101
  182. package/dist/seedSchema/ConfigSchema.d.ts.map +0 -1
  183. package/dist/seedSchema/MetadataSchema.d.ts +0 -422
  184. package/dist/seedSchema/MetadataSchema.d.ts.map +0 -1
  185. package/dist/seedSchema/ModelSchema.d.ts +0 -243
  186. package/dist/seedSchema/ModelSchema.d.ts.map +0 -1
  187. package/dist/seedSchema/ModelSchemaSchema.d.ts +0 -61
  188. package/dist/seedSchema/ModelSchemaSchema.d.ts.map +0 -1
  189. package/dist/seedSchema/ModelUidSchema.d.ts +0 -64
  190. package/dist/seedSchema/ModelUidSchema.d.ts.map +0 -1
  191. package/dist/seedSchema/PropertyUidSchema.d.ts +0 -64
  192. package/dist/seedSchema/PropertyUidSchema.d.ts.map +0 -1
  193. package/dist/seedSchema/SchemaSchema.d.ts +0 -169
  194. package/dist/seedSchema/SchemaSchema.d.ts.map +0 -1
  195. package/dist/seedSchema/SeedSchema.d.ts +0 -192
  196. package/dist/seedSchema/SeedSchema.d.ts.map +0 -1
  197. package/dist/seedSchema/VersionSchema.d.ts +0 -194
  198. package/dist/seedSchema/VersionSchema.d.ts.map +0 -1
  199. package/dist/seedSchema/index.d.ts +0 -14
  200. package/dist/seedSchema/index.d.ts.map +0 -1
  201. package/dist/syncDbWithEas-5kZneTEL.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  var value = require('@sinclair/typebox/value');
4
4
  require('reflect-metadata');
5
- var main_cjs = require('./index-DM1WR83P.js');
5
+ var main_cjs = require('./index-CSNtEnbF.js');
6
6
  require('pluralize');
7
7
  require('drizzle-orm');
8
8
  var typebox = require('@sinclair/typebox');
@@ -23,6 +23,7 @@ require('@noble/hashes/utils');
23
23
  require('fs/promises');
24
24
  require('fs');
25
25
  require('path');
26
+ require('url');
26
27
  require('node:url');
27
28
  require('@libsql/client');
28
29
  require('drizzle-orm/libsql');
@@ -304,6 +305,7 @@ class SchemaValidationService {
304
305
  * @param refValueType - For List properties: the element type (Text, Number, etc.). When set, each array element is validated against this type + validationRules.
305
306
  */
306
307
  validatePropertyValue(value$1, dataType, validationRules, refValueType) {
308
+ dataType = main_cjs.normalizeDataType(dataType);
307
309
  const errors = [];
308
310
  const warnings = [];
309
311
  try {
@@ -517,7 +519,7 @@ class SchemaValidationService {
517
519
  }
518
520
  }
519
521
  // Validate List: requires refValueType; ref (model) required only when refValueType === 'Relation' (case-insensitive)
520
- if (propertyDefinition.type === 'List' || propertyDefinition.dataType === 'List') {
522
+ if (main_cjs.isDataType(propertyDefinition.type, main_cjs.ModelPropertyDataTypes.List) || main_cjs.isDataType(propertyDefinition.dataType, main_cjs.ModelPropertyDataTypes.List)) {
521
523
  const rawRefValueType = propertyDefinition.refValueType ?? propertyDefinition.items?.type ?? propertyDefinition.refvaluetype;
522
524
  const refValueType = rawRefValueType ? main_cjs.normalizeDataType(String(rawRefValueType)) : undefined;
523
525
  if (!refValueType || String(refValueType).trim() === '') {
@@ -766,4 +768,4 @@ class SchemaValidationService {
766
768
  }
767
769
 
768
770
  exports.SchemaValidationService = SchemaValidationService;
769
- //# sourceMappingURL=SchemaValidationService-Z7OhtGn5.js.map
771
+ //# sourceMappingURL=SchemaValidationService-DtYs_CNY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaValidationService-DtYs_CNY.js","sources":["../../../src/Schema/service/validation/SchemaValidationService.ts"],"sourcesContent":["import { Value } from '@sinclair/typebox/value'\nimport { TProperty } from '@/Schema'\nimport { ModelPropertyDataTypes, TPropertyDataType, isDataType, 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 dataType = normalizeDataType(dataType) as ModelPropertyDataTypes\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 (isDataType(propertyDefinition.type, ModelPropertyDataTypes.List) || isDataType((propertyDefinition as any).dataType, ModelPropertyDataTypes.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":["ModelPropertyDataTypes","TPropertyDataType","normalizeDataType","Value","TProperty","value","DEFAULT_TEXT_MAX_LENGTH","isDataType","Type"],"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,EAAE;YAC/D,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,SAAS,CAAC;AACpE,YAAA,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;AAC7B,gBAAA,OAAO,oBAAoB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,YAAA,EAAe,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAClG;QACF;;AAGA,QAAA,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE;YAC5B,MAAM,aAAa,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,E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;AAEhB,YAAA,MAAM,CAAC,uCAAuC,EAAE,KAAK,CAAC,MAAM,CAAC;QAC/D;AAEA,QAAA,OAAO,MAAM;IACf;AACD;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var drizzleOrm = require('drizzle-orm');
4
- var main_cjs = require('./index-DM1WR83P.js');
4
+ var main_cjs = require('./index-CSNtEnbF.js');
5
5
  var debug = require('debug');
6
6
  require('immer');
7
7
  require('reflect-metadata');
@@ -22,6 +22,7 @@ require('@noble/hashes/utils');
22
22
  require('fs/promises');
23
23
  require('fs');
24
24
  require('path');
25
+ require('url');
25
26
  require('node:url');
26
27
  require('@libsql/client');
27
28
  require('drizzle-orm/libsql');
@@ -80,4 +81,4 @@ async function backfillMetadataPropertyIds() {
80
81
  }
81
82
 
82
83
  exports.backfillMetadataPropertyIds = backfillMetadataPropertyIds;
83
- //# sourceMappingURL=backfillMetadataPropertyIds-Bt4fzfIV.js.map
84
+ //# sourceMappingURL=backfillMetadataPropertyIds-2XaN3b9S.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"backfillMetadataPropertyIds-Bt4fzfIV.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":["BaseDb","metadata","and","isNull","sql","getPropertyIdForModelAndName","eq"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,MAAM,GAAG,KAAK,CAAC,wCAAwC,CAAC;AAE9D;;;;AAIG;AACI,eAAe,2BAA2B,GAAA;AAC/C,IAAA,MAAM,EAAE,GAAGA,eAAM,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,EAAEC,iBAAQ,CAAC,OAAO;YACzB,SAAS,EAAEA,iBAAQ,CAAC,SAAS;YAC7B,YAAY,EAAEA,iBAAQ,CAAC,YAAY;SACpC;aACA,IAAI,CAACA,iBAAQ;aACb,KAAK,CACJC,cAAG,CACDC,iBAAM,CAACF,iBAAQ,CAAC,UAAU,CAAC,EAC3BG,cAAG,CAAA,CAAA,EAAGH,iBAAQ,CAAC,SAAS,CAAA,YAAA,CAAc,EACtCG,cAAG,CAAA,CAAA,EAAGH,iBAAQ,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,MAAMI,qCAA4B,CACnD,GAAG,CAAC,SAAS,EACb,GAAG,CAAC,YAAY,CACjB;YACD,IAAI,UAAU,IAAI,IAAI;gBAAE;AAExB,YAAA,MAAM;iBACH,MAAM,CAACJ,iBAAQ;AACf,iBAAA,GAAG,CAAC,EAAE,UAAU,EAAE;AAClB,iBAAA,KAAK,CAACK,aAAE,CAACL,iBAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;AAE3C,YAAA,OAAO,EAAE;QACX;AAEA,QAAA,IAAI,OAAO,GAAG,CAAC,EAAE;YACf,MAAM,CAAC,8BAA8B,OAAO,CAAA,CAAA,EAAI,cAAc,CAAC,MAAM,CAAA,cAAA,CAAgB,CAAC;QACxF;AACA,QAAA,OAAO,OAAO;IAChB;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,MAAM,CAAC,iBAAiB,EAAE,KAAK,CAAC;AAChC,QAAA,MAAM,KAAK;IACb;AACF;;"}
1
+ {"version":3,"file":"backfillMetadataPropertyIds-2XaN3b9S.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":["BaseDb","metadata","and","isNull","sql","getPropertyIdForModelAndName","eq"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,MAAM,GAAG,KAAK,CAAC,wCAAwC,CAAC;AAE9D;;;;AAIG;AACI,eAAe,2BAA2B,GAAA;AAC/C,IAAA,MAAM,EAAE,GAAGA,eAAM,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,EAAEC,iBAAQ,CAAC,OAAO;YACzB,SAAS,EAAEA,iBAAQ,CAAC,SAAS;YAC7B,YAAY,EAAEA,iBAAQ,CAAC,YAAY;SACpC;aACA,IAAI,CA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');
4
+ var main_cjs = require('./index-CSNtEnbF.js');
5
5
  require('immer');
6
6
  require('reflect-metadata');
7
7
  require('xstate');
@@ -22,6 +22,7 @@ require('@noble/hashes/utils');
22
22
  require('fs/promises');
23
23
  require('fs');
24
24
  require('path');
25
+ require('url');
25
26
  require('node:url');
26
27
  require('@libsql/client');
27
28
  require('drizzle-orm/libsql');
@@ -35,7 +36,7 @@ require('@seedprotocol/eas/node');
35
36
  const getModelSchemasFromEas = async () => {
36
37
  const queryClient = eas.BaseQueryClient.getQueryClient();
37
38
  const easClient = eas.BaseEasClient.getEasClient();
38
- const modelMod = await Promise.resolve().then(function () { return require('./index-DM1WR83P.js'); }).then(function (n) { return n.Model$1; });
39
+ const modelMod = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.Model$1; });
39
40
  const { Model } = modelMod;
40
41
  const allModels = await Model.all();
41
42
  const modelNames = allModels.map((m) => m.modelName).filter((name) => !!name);
@@ -134,4 +135,4 @@ Object.defineProperty(exports, "verifyPublishedByBatch", {
134
135
  get: function () { return eas.verifyPublishedByBatch; }
135
136
  });
136
137
  exports.getModelSchemasFromEas = getModelSchemasFromEas;
137
- //# sourceMappingURL=eas-DdI-4vwl.js.map
138
+ //# sourceMappingURL=eas-CMNppmGE.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eas-DdI-4vwl.js","sources":["../../../src/eas.ts"],"sourcesContent":["export {\n getItemVersionsFromEas,\n getItemPropertiesFromEas,\n getCanonicalItemPropertiesFromEas,\n getEasSchemaUidBySchemaName,\n getSeedsFromSchemaUids,\n getSeedsBySchemaName,\n getSeedUidsBySchemaName,\n getPublishedByFromEas,\n decodePublishedByData,\n hashPublishedByBatch,\n verifyPublishedByBatch,\n PUBLISHED_BY_SCHEMA_DEF,\n PUBLISHED_BY_SCHEMA_NAME,\n} from '@seedprotocol/eas'\nexport type {\n Attestation,\n EASSchema,\n PublishedByDecoded,\n GetPublishedByFromEasParams,\n} from '@seedprotocol/eas'\n\nimport { toSnakeCase } from '@/helpers'\nimport { withExcludeRevokedFilter } from '@seedprotocol/eas'\nimport { BaseEasClient } from '@seedprotocol/eas'\nimport { BaseQueryClient } from '@seedprotocol/eas'\nimport { GET_SCHEMAS } from '@seedprotocol/eas'\nimport type { EASSchema } from '@seedprotocol/eas'\n\ntype GetModelSchemasFromEas = () => Promise<EASSchema[]>\n\n/** Stays in SDK: depends on local Model registry. */\nexport const getModelSchemasFromEas: GetModelSchemasFromEas = async () => {\n const queryClient = BaseQueryClient.getQueryClient()\n const easClient = BaseEasClient.getEasClient()\n\n const modelMod = await import('./Model/Model')\n const { Model } = modelMod\n const allModels = await Model.all()\n const modelNames = allModels.map((m) => m.modelName).filter((name): name is string => !!name)\n\n if (modelNames.length === 0) {\n return []\n }\n\n const OR: Record<string, unknown>[] = []\n const hasImageModel = modelNames.includes('Image')\n\n for (const modelName of modelNames) {\n const snake = toSnakeCase(modelName)\n OR.push({\n schema: {\n equals: `bytes32 ${snake}`,\n },\n })\n const altSchema = `bytes32 ${modelName}`\n if (altSchema !== `bytes32 ${snake}`) {\n OR.push({\n schema: {\n equals: altSchema,\n },\n })\n }\n }\n\n if (hasImageModel) {\n OR.push({\n schema: {\n equals: `bytes32 image`,\n },\n })\n }\n\n const modelSchemas = await queryClient.fetchQuery({\n queryKey: [`getSchemasAllModels`],\n queryFn: async () =>\n easClient.request(GET_SCHEMAS, {\n where: {\n OR,\n },\n }),\n })\n\n if (!modelSchemas?.schemas?.length) {\n return []\n }\n\n return modelSchemas.schemas as EASSchema[]\n}\n"],"names":["BaseQueryClient","BaseEasClient","toSnakeCase","GET_SCHEMAS"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA;AACO,MAAM,sBAAsB,GAA2B,YAAW;AACvE,IAAA,MAAM,WAAW,GAAGA,mBAAe,CAAC,cAAc,EAAE;AACpD,IAAA,MAAM,SAAS,GAAGC,iBAAa,CAAC,YAAY,EAAE;AAE9C,IAAA,MAAM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A,CAAqB,CAAC;QACjC,OAAO,EAAE,YACP,SAAS,CAAC,OAAO,CAACC,eAAW,EAAE;AAC7B,YAAA,KAAK,EAAE;gBACL,EAAE;AACH,aAAA;SACF,CAAC;AACL,KAAA,CAAC;AAEF,IAAA,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE;AAClC,QAAA,OAAO,EAAE;IACX;IAEA,OAAO,YAAY,CAAC,OAAsB;AAC5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"eas-CMNppmGE.js","sources":["../../../src/eas.ts"],"sourcesContent":["export {\n getItemVersionsFromEas,\n getItemPropertiesFromEas,\n getCanonicalItemPropertiesFromEas,\n getEasSchemaUidBySchemaName,\n getSeedsFromSchemaUids,\n getSeedsBySchemaName,\n getSeedUidsBySchemaName,\n getPublishedByFromEas,\n decodePublishedByData,\n hashPublishedByBatch,\n verifyPublishedByBatch,\n PUBLISHED_BY_SCHEMA_DEF,\n PUBLISHED_BY_SCHEMA_NAME,\n} from '@seedprotocol/eas'\nexport type {\n Attestation,\n EASSchema,\n PublishedByDecoded,\n GetPublishedByFromEasParams,\n} from '@seedprotocol/eas'\n\nimport { toSnakeCase } from '@/helpers'\nimport { withExcludeRevokedFilter } from '@seedprotocol/eas'\nimport { BaseEasClient } from '@seedprotocol/eas'\nimport { BaseQueryClient } from '@seedprotocol/eas'\nimport { GET_SCHEMAS } from '@seedprotocol/eas'\nimport type { EASSchema } from '@seedprotocol/eas'\n\ntype GetModelSchemasFromEas = () => Promise<EASSchema[]>\n\n/** Stays in SDK: depends on local Model registry. */\nexport const getModelSchemasFromEas: GetModelSchemasFromEas = async () => {\n const queryClient = BaseQueryClient.getQueryClient()\n const easClient = BaseEasClient.getEasClient()\n\n const modelMod = await import('./Model/Model')\n const { Model } = modelMod\n const allModels = await Model.all()\n const modelNames = allModels.map((m) => m.modelName).filter((name): name is string => !!name)\n\n if (modelNames.length === 0) {\n return []\n }\n\n const OR: Record<string, unknown>[] = []\n const hasImageModel = modelNames.includes('Image')\n\n for (const modelName of modelNames) {\n const snake = toSnakeCase(modelName)\n OR.push({\n schema: {\n equals: `bytes32 ${snake}`,\n },\n })\n const altSchema = `bytes32 ${modelName}`\n if (altSchema !== `bytes32 ${snake}`) {\n OR.push({\n schema: {\n equals: altSchema,\n },\n })\n }\n }\n\n if (hasImageModel) {\n OR.push({\n schema: {\n equals: `bytes32 image`,\n },\n })\n }\n\n const modelSchemas = await queryClient.fetchQuery({\n queryKey: [`getSchemasAllModels`],\n queryFn: async () =>\n easClient.request(GET_SCHEMAS, {\n where: {\n OR,\n },\n }),\n })\n\n if (!modelSchemas?.schemas?.length) {\n return []\n }\n\n return modelSchemas.schemas as EASSchema[]\n}\n"],"names":["BaseQueryClient","BaseEasClient","toSnakeCase","GET_SCHEMAS"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA;AACO,MAAM,sBAAsB,GAA2B,YAAW;AACvE,IAAA,MAAM,WAAW,GAAGA,mBAAe,CAAC,cAAc,EAAE;AACpD,IAAA,MAAM,SAAS,GAAGC,iBAAa,CAAC,YAAY,EAAE;AAE9C,IAAA,MAAM,QAAQ,GAAG,MAAM,oDAAO,qBAAe,8CAAC;AAC9C,IAAA,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ;AAC1B,IAAA,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;IACnC,MAAM,UAAU,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,KAAqB,CAAC,CAAC,IAAI,CAAC;AAE7F,IAAA,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;AAC3B,QAAA,OAAO,EAAE;IACX;IAEA,MAAM,EAAE,GAA8B,EAAE;IACxC,MAAM,aAAa,GAAG,UAAU,CAAC,QAAQ,CAA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ash-es');
5
5
  require('immer');
6
6
  require('reflect-metadata');
@@ -22,6 +22,7 @@ require('@noble/hashes/utils');
22
22
  require('fs/promises');
23
23
  require('fs');
24
24
  require('path');
25
+ require('url');
25
26
  require('node:url');
26
27
  require('@libsql/client');
27
28
  require('drizzle-orm/libsql');
@@ -54,4 +55,4 @@ const getItem = async ({ modelName, seedLocalId, seedUid }) => {
54
55
  };
55
56
 
56
57
  exports.getItem = getItem;
57
- //# sourceMappingURL=getItem-B_2GeTQf.js.map
58
+ //# sourceMappingURL=getItem-B6jEINjW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getItem-B_2GeTQf.js","sources":["../../../src/db/read/getItem.ts"],"sourcesContent":["import { getItemData } from './getItemData'\nimport { GetItem } from '@/types'\nimport { Item } from '@/Item/Item'\nimport { startCase } from 'lodash-es'\n\nexport const getItem: GetItem = async ({ modelName, seedLocalId, seedUid }) => {\n const itemInitObj = await getItemData({\n modelName,\n seedLocalId,\n seedUid,\n })\n\n if (!itemInitObj) {\n console.error(\n `[db/queries] [getItem] no itemInitObj modelName: ${modelName} seedLocalId: ${seedLocalId} seedUid: ${seedUid}`,\n )\n return\n }\n\n if (!itemInitObj.seedLocalId) {\n console.error(\n `[db/queries] [getItem] no itemInitObj.seedLocalId modelName: ${modelName} seedLocalId: ${seedLocalId} seedUid: ${seedUid}`,\n )\n return\n }\n\n if (!itemInitObj.modelName && itemInitObj.type) {\n itemInitObj.modelName = startCase(itemInitObj.type)\n }\n\n // DB + loadOrCreateItem + concurrent property saves (e.g. during publish) can exceed the default 5s idle wait.\n const getItemReadyTimeoutMs = 120_000\n return Item.create(itemInitObj, { readyTimeout: getItemReadyTimeoutMs })\n}\n"],"names":["getItemData","startCase","Item"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,OAAO,GAAY,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,KAAI;AAC5E,IAAA,MAAM,WAAW,GAAG,MAAMA,oBAAW,CAAC;QACpC,SAAS;QACT,WAAW;QACX,OAAO;AACR,KAAA,CAAC;IAEF,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,CAAC,KAAK,CACX,CAAA,iDAAA,EAAoD,SAAS,CAAA,cAAA,EAAiB,WAAW,CAAA,UAAA,EAAa,OAAO,CAAA,CAAE,CAChH;QACD;IACF;AAEA,IAAA,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE;QAC5B,OAAO,CAAC,KAAK,CACX,CAAA,6DAAA,EAAgE,SAAS,CAAA,cAAA,EAAiB,WAAW,CAAA,UAAA,EAAa,OAAO,CAAA,CAAE,CAC5H;QACD;IACF;IAEA,IAAI,CAAC,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,IAAI,EAAE;QAC9C,WAAW,CAAC,SAAS,GAAGC,kBAAS,CAAC,WAAW,CAAC,IAAI,CAAC;IACrD;;IAGA,MAAM,qBAAqB,GAAG,MAAO;AACrC,IAAA,OAAOC,aAAI,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAC1E;;"}
1
+ {"version":3,"file":"getItem-B6jEINjW.js","sources":["../../../src/db/read/getItem.ts"],"sourcesContent":["import { getItemData } from './getItemData'\nimport { GetItem } from '@/types'\nimport { Item } from '@/Item/Item'\nimport { startCase } from 'lodash-es'\n\nexport const getItem: GetItem = async ({ modelName, seedLocalId, seedUid }) => {\n const itemInitObj = await getItemData({\n modelName,\n seedLocalId,\n seedUid,\n })\n\n if (!itemInitObj) {\n console.error(\n `[db/queries] [getItem] no itemInitObj modelName: ${modelName} seedLocalId: ${seedLocalId} seedUid: ${seedUid}`,\n )\n return\n }\n\n if (!itemInitObj.seedLocalId) {\n console.error(\n `[db/queries] [getItem] no itemInitObj.seedLocalId modelName: ${modelName} seedLocalId: ${seedLocalId} seedUid: ${seedUid}`,\n )\n return\n }\n\n if (!itemInitObj.modelName && itemInitObj.type) {\n itemInitObj.modelName = startCase(itemInitObj.type)\n }\n\n // DB + loadOrCreateItem + concurrent property saves (e.g. during publish) can exceed the default 5s idle wait.\n const getItemReadyTimeoutMs = 120_000\n return Item.create(itemInitObj, { readyTimeout: getItemReadyTimeoutMs })\n}\n"],"names":["getItemData","startCase","Item"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,OAAO,GAAY,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,KAAI;AAC5E,IAAA,MAAM,WAAW,GAAG,MAAMA,oBAAW,CAAC;QACpC,SAAS;QACT,WAAW;QACX,OAAO;AACR,KAAA,CAAC;IAEF,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,CAAC,KAAK,CACX,CAAA,iDAAA,EAAoD,SAAS,CAAA,cAAA,EAAiB,WAAW,CAAA,UAAA,EAAa,OAAO,CAAA,CAAE,CAChH;QACD;IACF;AAEA,IAAA,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE;QAC5B,OAAO,CAAC,KAAK,CACX,CAAA,6DAAA,EAAgE,SAAS,CAAA,cAAA,EAAiB,WAAW,CAAA,UAAA,EAAa,OAAO,CAAA,CAAE,CAC5H;QACD;IACF;IAEA,IAAI,CAAC,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,IAAI,EAAE;QAC9C,WAAW,CAAC,SAAS,GAAGC,kBAAS,CAAC,WAAW,CAAC,IAAI,CAAC;IACrD;;IAGA,MAAM,qBAAqB,GAAG,MAAO;AACrC,IAAA,OAAOC,aAAI,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAC1E;;"}
@@ -1,12 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var main_cjs = require('./index-DM1WR83P.js');
3
+ var main_cjs = require('./index-CSNtEnbF.js');
4
4
  var easSdk = require('@ethereum-attestation-service/eas-sdk');
5
5
  var casing = require('drizzle-orm/casing');
6
- var pluralize = require('pluralize');
7
6
  var eas = require('@seedprotocol/eas');
8
- var getSegmentedItemProperties = require('./getSegmentedItemProperties-DK82kjri.js');
9
- var property = require('./property-DmvgA8FD.js');
7
+ var getSegmentedItemProperties = require('./getSegmentedItemProperties-CU8rtBAo.js');
8
+ var property = require('./property-DlKiAWt4.js');
10
9
  var lodashEs = require('lodash-es');
11
10
  var drizzleOrm = require('drizzle-orm');
12
11
  var debug = require('debug');
@@ -17,6 +16,7 @@ require('immer');
17
16
  require('xstate');
18
17
  require('drizzle-orm/sqlite-core');
19
18
  require('@seedprotocol/arweave');
19
+ require('pluralize');
20
20
  require('@sinclair/typebox');
21
21
  require('nanoid');
22
22
  require('nanoid-dictionary');
@@ -25,6 +25,7 @@ require('rxjs');
25
25
  require('fs/promises');
26
26
  require('fs');
27
27
  require('path');
28
+ require('url');
28
29
  require('node:url');
29
30
  require('@libsql/client');
30
31
  require('drizzle-orm/libsql');
@@ -52,8 +53,17 @@ debug('seedSdk:db:getPublishPayload');
52
53
  /** Case-insensitive dataType match (schema JSON may use "text" vs "Text"). */
53
54
  const matchesDataType = (actual, expected) => main_cjs.normalizeDataType(actual) === expected;
54
55
  function addValidationError(ctx, message, field, code = 'publish_validation') {
56
+ // A property can be validated on more than one path (List of Relation: list + basic); report once.
57
+ if (ctx.errors.some((e) => e.message === message && e.field === (field ?? '')))
58
+ return;
55
59
  ctx.errors.push({ field: field ?? '', message, code });
56
60
  }
61
+ /** File/Image/Html value is raw content instead of a storage seed id, so it was never saved/uploaded. */
62
+ function addStorageValueNotSavedError(ctx, propertyName, dataType, value) {
63
+ addValidationError(ctx, `Invalid value for property: ${propertyName}. Expected a storage seed id ` +
64
+ `(${main_cjs.normalizeDataType(dataType)} content must be saved through the property before publishing), ` +
65
+ `got ${value.length > 40 ? `${value.slice(0, 40)}…` : value}.`, propertyName, 'publish_storage_value_not_saved');
66
+ }
57
67
  function isStorageTransactionPropertyName(name) {
58
68
  return name === 'storageTransactionId' || name === 'storage_transaction_id';
59
69
  }
@@ -123,7 +133,7 @@ async function resolveVersionUid(seedLocalId, seedUid) {
123
133
  if (published?.uid)
124
134
  return published.uid;
125
135
  try {
126
- const { getItemVersionsFromEas } = await Promise.resolve().then(function () { return require('./eas-DdI-4vwl.js'); });
136
+ const { getItemVersionsFromEas } = await Promise.resolve().then(function () { return require('./eas-CMNppmGE.js'); });
127
137
  const attestations = await getItemVersionsFromEas({ seedUids: [seedUid] });
128
138
  const latest = attestations?.[0];
129
139
  if (latest?.id)
@@ -147,35 +157,25 @@ const getPropertyData = async (itemProperty, ctx) => {
147
157
  }
148
158
  return null;
149
159
  }
150
- let schemaUid = itemProperty.schemaUid;
151
160
  const ip = itemProperty;
152
- const propertyDefForName = itemProperty.propertyDef;
153
- let nameForEas = ip.storagePropertyName && ip.storagePropertyName.length > 0
154
- ? ip.storagePropertyName
155
- : itemProperty.propertyName;
156
- // Align List-of-relation EAS field name with processListProperty (authorIdentityIds for authors → Identity)
157
- if (matchesDataType(propertyDefForName?.dataType, main_cjs.ModelPropertyDataTypes.List) &&
158
- (propertyDefForName?.ref || propertyDefForName?.refModelName) &&
159
- !(ip.storagePropertyName && ip.storagePropertyName.length > 0)) {
160
- const ref = propertyDefForName?.ref ?? propertyDefForName?.refModelName;
161
- if (ref) {
162
- const singular = pluralize.singular(itemProperty.propertyName);
163
- nameForEas = `${singular}${ref}Ids`;
164
- }
165
- }
161
+ // List of Relation: the EAS name always comes from the property definition (authors → authorIdentityIds),
162
+ // never from whatever name the ItemProperty was constructed with or a cached schemaUid.
163
+ const listRelationName = main_cjs.listRelationEasPropertyName(itemProperty.propertyName, itemProperty.propertyDef);
164
+ const nameForEas = listRelationName ??
165
+ (ip.storagePropertyName && ip.storagePropertyName.length > 0
166
+ ? ip.storagePropertyName
167
+ : itemProperty.propertyName);
166
168
  const propertyNameForSchema = main_cjs.toSnakeCase(nameForEas);
167
169
  const schemaDef = `${easDataType} ${propertyNameForSchema}`;
170
+ let schemaUid = listRelationName ? undefined : itemProperty.schemaUid;
168
171
  if (!schemaUid) {
169
172
  schemaUid = await eas.getEasSchemaUidForSchemaDefinition({ schemaText: schemaDef });
170
- if (!schemaUid) {
171
- const schema = await main_cjs.getEasSchemaForItemProperty({
172
- propertyName: 'version',
173
- easDataType: 'bytes32',
174
- });
175
- if (schema) {
176
- schemaUid = schema.id;
177
- }
173
+ }
174
+ if (!schemaUid) {
175
+ if (ctx) {
176
+ addValidationError(ctx, `EAS schema not found for "${schemaDef}" (property: ${itemProperty.propertyName}). Register it before publishing (ensureEasSchemasForItem).`, itemProperty.propertyName, 'publish_schema_not_found');
178
177
  }
178
+ return null;
179
179
  }
180
180
  return {
181
181
  schemaUid,
@@ -198,7 +198,7 @@ const ensurePropertyDefs = async (targetItem) => {
198
198
  schema = await property.getPropertySchema(targetItem.modelName, itemProperty.propertyName);
199
199
  if (!schema) {
200
200
  try {
201
- const { Model } = await Promise.resolve().then(function () { return require('./index-DM1WR83P.js'); }).then(function (n) { return n.Model$1; });
201
+ const { Model } = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.Model$1; });
202
202
  const normalizedModelName = lodashEs.upperFirst(lodashEs.camelCase(targetItem.modelName));
203
203
  let model = Model.getByName(normalizedModelName);
204
204
  if (!model?.properties?.length) {
@@ -324,6 +324,14 @@ const processBasicProperties = async (itemBasicProperties, itemPublishData, ctx,
324
324
  continue;
325
325
  }
326
326
  }
327
+ // File/Image/Html values must be a storage seed id by now. Raw content means the property's
328
+ // save pipeline never ran or failed (e.g. createNewItem with raw html), so it was never uploaded.
329
+ // Relation/image properties are appended to the basic list after processRelationOrImageProperty,
330
+ // so this one check covers both paths.
331
+ if (isFileImageHtml && typeof value === 'string' && !main_cjs.isStorageSeedRef(value)) {
332
+ addStorageValueNotSavedError(ctx, basicProperty.propertyName, propertyDef?.dataType, value);
333
+ continue;
334
+ }
327
335
  const propertyData = await getPropertyData(basicProperty, ctx);
328
336
  if (!propertyData)
329
337
  continue;
@@ -355,7 +363,7 @@ const processBasicProperties = async (itemBasicProperties, itemPublishData, ctx,
355
363
  }
356
364
  // Validate against property validation rules (enum, pattern, minLength, maxLength) before encoding
357
365
  if (propertyDef?.validation) {
358
- const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-Z7OhtGn5.js'); });
366
+ const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-DtYs_CNY.js'); });
359
367
  const validationService = new SchemaValidationService();
360
368
  const validationResult = validationService.validatePropertyValue(value, main_cjs.normalizeDataType(propertyDef.dataType), propertyDef.validation, propertyDef.refValueType
361
369
  ? main_cjs.normalizeDataType(propertyDef.refValueType)
@@ -495,7 +503,7 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
495
503
  matchesDataType(relationOrImageProperty.propertyDef?.refValueType, main_cjs.ModelPropertyDataTypes.Html) ||
496
504
  matchesDataType(relationOrImageProperty.propertyDef?.refValueType, main_cjs.ModelPropertyDataTypes.Json)));
497
505
  if (isStorageSeed && (context.seedLocalId || context.seedUid)) {
498
- const { getPropertyData: getPropertyDataFromDb } = await Promise.resolve().then(function () { return require('./index-DM1WR83P.js'); }).then(function (n) { return n.getPropertyData; });
506
+ const { getPropertyData: getPropertyDataFromDb } = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.getPropertyData; });
499
507
  const metaRow = await getPropertyDataFromDb({
500
508
  propertyName: relationOrImageProperty.propertyName,
501
509
  seedLocalId: context.seedLocalId,
@@ -503,8 +511,8 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
503
511
  });
504
512
  const fromMeta = metaRow?.propertyValue;
505
513
  if (typeof fromMeta === 'string' && fromMeta.trim() !== '') {
506
- const idsCtx = getSegmentedItemProperties.resolveSeedIdsFromRefString(getSegmentedItemProperties.normalizeRelationPropertyValue(value) ?? '');
507
- const idsDb = getSegmentedItemProperties.resolveSeedIdsFromRefString(getSegmentedItemProperties.normalizeRelationPropertyValue(fromMeta) ?? '');
514
+ const idsCtx = main_cjs.resolveSeedIdsFromRefString(main_cjs.normalizeRelationPropertyValue(value) ?? '');
515
+ const idsDb = main_cjs.resolveSeedIdsFromRefString(main_cjs.normalizeRelationPropertyValue(fromMeta) ?? '');
508
516
  if (!value) {
509
517
  value = fromMeta;
510
518
  }
@@ -570,8 +578,8 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
570
578
  if (relationOrImageProperty.uid && !forceFullSnapshot) {
571
579
  return multiPublishPayload;
572
580
  }
573
- const normalizedRef = getSegmentedItemProperties.normalizeRelationPropertyValue(value);
574
- const { seedLocalId, seedUid } = getSegmentedItemProperties.resolveSeedIdsFromRefString(normalizedRef ?? '');
581
+ const normalizedRef = main_cjs.normalizeRelationPropertyValue(value);
582
+ const { seedLocalId, seedUid } = main_cjs.resolveSeedIdsFromRefString(normalizedRef ?? '');
575
583
  // Value is not a valid seed reference (local id or 0x uid)
576
584
  if (!seedLocalId && !seedUid) {
577
585
  if (isRequired) {
@@ -581,7 +589,7 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
581
589
  return multiPublishPayload;
582
590
  }
583
591
  // Use dynamic import to break circular dependency
584
- const getItemMod = await Promise.resolve().then(function () { return require('./getItem-B_2GeTQf.js'); });
592
+ const getItemMod = await Promise.resolve().then(function () { return require('./getItem-B6jEINjW.js'); });
585
593
  const { getItem } = getItemMod;
586
594
  const relatedItem = await getItem({
587
595
  seedLocalId,
@@ -589,7 +597,8 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
589
597
  });
590
598
  // When related item not found (e.g. different DB, not yet created)
591
599
  if (!relatedItem) {
592
- if (isRequired) {
600
+ // An attested uid with no local copy is already published; the parent attests the uid as-is.
601
+ if (isRequired && !main_cjs.isPublishedSeedRef(normalizedRef)) {
593
602
  addValidationError(ctx, `No related item found for required relation: ${relationOrImageProperty.propertyName}. ` +
594
603
  `Value: ${JSON.stringify(value)} (seedLocalId/seedUid). ` +
595
604
  `The related item may be missing, in a different database, or the reference may be broken.`, relationOrImageProperty.propertyName);
@@ -630,7 +639,7 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
630
639
  let publishPayload = {
631
640
  localId: relatedItem.seedLocalId,
632
641
  seedIsRevocable: true,
633
- versionSchemaUid: main_cjs.VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA,
642
+ versionSchemaUid: main_cjs.VERSION_SCHEMA_UID,
634
643
  seedUid: seedUid || main_cjs.ZERO_BYTES32,
635
644
  seedSchemaUid,
636
645
  versionUid,
@@ -707,7 +716,7 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
707
716
  if (rows.length === 0)
708
717
  return multiPublishPayload;
709
718
  const forceFullSnapshot = buildOpts?.forceFullSnapshot === true;
710
- const getItemMod = await Promise.resolve().then(function () { return require('./getItem-B_2GeTQf.js'); });
719
+ const getItemMod = await Promise.resolve().then(function () { return require('./getItem-B6jEINjW.js'); });
711
720
  const { getItem } = getItemMod;
712
721
  const doneImages = new Set();
713
722
  for (const row of rows) {
@@ -737,7 +746,7 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
737
746
  let publishPayload = {
738
747
  localId: relatedItem.seedLocalId,
739
748
  seedIsRevocable: true,
740
- versionSchemaUid: main_cjs.VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA,
749
+ versionSchemaUid: main_cjs.VERSION_SCHEMA_UID,
741
750
  seedUid: relatedItem.seedUid || main_cjs.ZERO_BYTES32,
742
751
  seedSchemaUid,
743
752
  versionUid,
@@ -789,17 +798,6 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
789
798
  addValidationError(ctx, `processListProperty requires ref (list of relations). List property "${listProperty.propertyName}" has no ref. List-of-primitives should be in itemBasicProperties.`, listProperty.propertyName);
790
799
  return multiPublishPayload;
791
800
  }
792
- let listPropertySchemaUid = listProperty.schemaUid;
793
- if (!listPropertySchemaUid && listProperty.propertyDef) {
794
- const propertyData = await getPropertyData(listProperty, ctx);
795
- if (!propertyData)
796
- return multiPublishPayload;
797
- listPropertySchemaUid = propertyData.schemaUid;
798
- }
799
- if (!listPropertySchemaUid) {
800
- addValidationError(ctx, `Schema uid not found for list property: ${listProperty.propertyName}`, listProperty.propertyName);
801
- return multiPublishPayload;
802
- }
803
801
  const snapshot = listProperty.getService().getSnapshot();
804
802
  const context = 'context' in snapshot ? snapshot.context : null;
805
803
  if (!context) {
@@ -812,8 +810,12 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
812
810
  if (listProperty.uid && !forceFullSnapshot) {
813
811
  return multiPublishPayload;
814
812
  }
815
- const singularPropertyName = pluralize.singular(listProperty.propertyName);
816
- `${singularPropertyName}${listProperty.propertyDef.ref}Ids`;
813
+ // Always resolve from the property definition; a cached schemaUid may point at a schema
814
+ // registered under the schema key (bytes32[] authors) instead of authorIdentityIds.
815
+ const propertyData = await getPropertyData(listProperty, ctx);
816
+ if (!propertyData)
817
+ return multiPublishPayload;
818
+ const listPropertySchemaUid = propertyData.schemaUid;
817
819
  if (typeof value === 'string') {
818
820
  value = main_cjs.parseListPropertyValueFromStorage(value);
819
821
  }
@@ -834,14 +836,17 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
834
836
  if (!seedLocalId && !seedUid)
835
837
  continue;
836
838
  // Use dynamic import to break circular dependency
837
- const getItemMod = await Promise.resolve().then(function () { return require('./getItem-B_2GeTQf.js'); });
839
+ const getItemMod = await Promise.resolve().then(function () { return require('./getItem-B6jEINjW.js'); });
838
840
  const { getItem } = getItemMod;
839
841
  const relatedItem = await getItem({
840
842
  seedLocalId,
841
843
  seedUid,
842
844
  });
843
845
  if (!relatedItem) {
844
- console.error(`No related item found for list property: ${listProperty.propertyName}`);
846
+ // An attested uid with no local copy is already published; the list attests the uid as-is.
847
+ if (!main_cjs.isPublishedSeedRef(idStr)) {
848
+ console.error(`No related item found for list property: ${listProperty.propertyName}`);
849
+ }
845
850
  continue;
846
851
  }
847
852
  if (relatedItem.seedUid && relatedItem.seedUid !== main_cjs.ZERO_BYTES32) {
@@ -877,7 +882,7 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
877
882
  let publishPayload = {
878
883
  localId: relatedItem.seedLocalId,
879
884
  seedIsRevocable: true,
880
- versionSchemaUid: main_cjs.VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA,
885
+ versionSchemaUid: main_cjs.VERSION_SCHEMA_UID,
881
886
  seedUid: seedUid || main_cjs.ZERO_BYTES32,
882
887
  seedSchemaUid,
883
888
  versionUid,
@@ -1069,7 +1074,7 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
1069
1074
  seedUid: item.seedUid || main_cjs.ZERO_BYTES32,
1070
1075
  seedIsRevocable: true,
1071
1076
  seedSchemaUid: itemSchemaUid,
1072
- versionSchemaUid: main_cjs.VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA,
1077
+ versionSchemaUid: main_cjs.VERSION_SCHEMA_UID,
1073
1078
  versionUid,
1074
1079
  listOfAttestations: [],
1075
1080
  propertiesToUpdate: [],
@@ -1097,7 +1102,7 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
1097
1102
  const propRows = await main_cjs.BaseDb.getAppDb()
1098
1103
  .select({ required: main_cjs.properties.required, refModelId: main_cjs.properties.refModelId })
1099
1104
  .from(main_cjs.properties)
1100
- .where(drizzleOrm.and(drizzleOrm.eq(main_cjs.properties.modelId, modelRows[0].id), drizzleOrm.eq(main_cjs.properties.name, relProp.propertyName), drizzleOrm.eq(main_cjs.properties.dataType, 'Relation')))
1105
+ .where(drizzleOrm.and(drizzleOrm.eq(main_cjs.properties.modelId, modelRows[0].id), drizzleOrm.eq(main_cjs.properties.name, relProp.propertyName), drizzleOrm.sql `lower(${main_cjs.properties.dataType}) = 'relation'`))
1101
1106
  .limit(1);
1102
1107
  if (propRows.length > 0 && (propRows[0].required === true || propRows[0].required === 1)) {
1103
1108
  isRequired = true;
@@ -1444,4 +1449,4 @@ exports.PublishValidationFailedError = PublishValidationFailedError;
1444
1449
  exports.getPublishPayload = getPublishPayload;
1445
1450
  exports.resolvePublishPayloadValues = resolvePublishPayloadValues;
1446
1451
  exports.validateItemForPublish = validateItemForPublish;
1447
- //# sourceMappingURL=getPublishPayload-Jmgi1RUj.js.map
1452
+ //# sourceMappingURL=getPublishPayload-D5DhLGvN.js.map