@seedprotocol/sdk 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/README.md +38 -348
  2. package/dist/{ArweaveClient-DkNLWiSZ.js → ArweaveClient-Caio37h1.js} +8 -8
  3. package/dist/ArweaveClient-Caio37h1.js.map +1 -0
  4. package/dist/{ArweaveClient-CczHvccG.js → ArweaveClient-DLKAaS3K.js} +8 -8
  5. package/dist/ArweaveClient-DLKAaS3K.js.map +1 -0
  6. package/dist/{Db-DJvjXVlp.js → Db-C9fppVRl.js} +9 -9
  7. package/dist/Db-C9fppVRl.js.map +1 -0
  8. package/dist/{Db-BzQR2KX9.js → Db-DJAG-5Di.js} +13 -11
  9. package/dist/Db-DJAG-5Di.js.map +1 -0
  10. package/dist/{EasClient-CHQYmjj2.js → EasClient-DQGAIj-b.js} +8 -8
  11. package/dist/EasClient-DQGAIj-b.js.map +1 -0
  12. package/dist/{EasClient-CodrIgW-.js → EasClient-T7Nx9185.js} +8 -8
  13. package/dist/EasClient-T7Nx9185.js.map +1 -0
  14. package/dist/{FileManager-BbvkZJCH.js → FileManager-BohtoKYo.js} +10 -9
  15. package/dist/FileManager-BohtoKYo.js.map +1 -0
  16. package/dist/{FileManager-BIVsDnMu.js → FileManager-d64CkqXy.js} +8 -8
  17. package/dist/FileManager-d64CkqXy.js.map +1 -0
  18. package/dist/Item/Item.d.ts.map +1 -1
  19. package/dist/Item/service/actors/fetchDataFromEas.d.ts.map +1 -1
  20. package/dist/Item/service/actors/loadOrCreateItem.d.ts.map +1 -1
  21. package/dist/Item/service/actors/runPublish.d.ts.map +1 -1
  22. package/dist/ItemProperty/ItemProperty.d.ts.map +1 -1
  23. package/dist/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
  24. package/dist/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
  25. package/dist/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
  26. package/dist/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +1 -1
  27. package/dist/Model/Model.d.ts.map +1 -1
  28. package/dist/Model/service/actors/createModelProperties.d.ts.map +1 -1
  29. package/dist/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
  30. package/dist/Model/service/actors/validateModel.d.ts.map +1 -1
  31. package/dist/ModelProperty/ModelProperty.d.ts.map +1 -1
  32. package/dist/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
  33. package/dist/ModelProperty/service/actors/saveToSchema.d.ts.map +1 -1
  34. package/dist/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
  35. package/dist/{ModelProperty-gjcA83Mq.js → ModelProperty-Cpd9xiIM.js} +67 -768
  36. package/dist/ModelProperty-Cpd9xiIM.js.map +1 -0
  37. package/dist/{PathResolver-kGzba-zC.js → PathResolver-CLZUWoX2.js} +8 -8
  38. package/dist/PathResolver-CLZUWoX2.js.map +1 -0
  39. package/dist/{PathResolver-9zAzPhee.js → PathResolver-D6M0rzKV.js} +8 -8
  40. package/dist/PathResolver-D6M0rzKV.js.map +1 -0
  41. package/dist/{QueryClient-C7ZkTT0z.js → QueryClient-BUoz2Vb0.js} +8 -8
  42. package/dist/QueryClient-BUoz2Vb0.js.map +1 -0
  43. package/dist/{QueryClient-CEtsek7Q.js → QueryClient-COQ_Rs4-.js} +8 -8
  44. package/dist/QueryClient-COQ_Rs4-.js.map +1 -0
  45. package/dist/Schema/Schema.d.ts.map +1 -1
  46. package/dist/Schema/service/actors/createModelInstances.d.ts.map +1 -1
  47. package/dist/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
  48. package/dist/Schema/service/actors/verifyModelInstancesInCache.d.ts.map +1 -1
  49. package/dist/Schema/service/actors/writePropertiesToDb.d.ts.map +1 -1
  50. package/dist/Schema/service/addModelsMachine.d.ts.map +1 -1
  51. package/dist/{Schema-ClTcpgbt.js → Schema-BZKBy5Tx.js} +799 -62
  52. package/dist/Schema-BZKBy5Tx.js.map +1 -0
  53. package/dist/{SchemaValidationService-BfoEiHNr.js → SchemaValidationService-F8No7BHp.js} +7 -7
  54. package/dist/SchemaValidationService-F8No7BHp.js.map +1 -0
  55. package/dist/browser/helpers/FileManager.d.ts.map +1 -1
  56. package/dist/browser/react/itemProperty.d.ts.map +1 -1
  57. package/dist/cjs/{ModelProperty-BRKRREYP.js → ModelProperty-B4pV91tc.js} +78 -438
  58. package/dist/cjs/ModelProperty-B4pV91tc.js.map +1 -0
  59. package/dist/cjs/{Schema-CV9hMg8m.js → Schema-TErl3J36.js} +437 -93
  60. package/dist/cjs/Schema-TErl3J36.js.map +1 -0
  61. package/dist/cjs/{SchemaValidationService-DUtQUerg.js → SchemaValidationService-p5BbJV9T.js} +3 -3
  62. package/dist/cjs/{SchemaValidationService-DUtQUerg.js.map → SchemaValidationService-p5BbJV9T.js.map} +1 -1
  63. package/dist/cjs/{getItem-BThT-UOt.js → getItem-BrnLfC12.js} +3 -3
  64. package/dist/cjs/{getItem-BThT-UOt.js.map → getItem-BrnLfC12.js.map} +1 -1
  65. package/dist/cjs/{getPublishPayload-CKZ7rVbU.js → getPublishPayload-BcjCN_bD.js} +8 -6
  66. package/dist/cjs/getPublishPayload-BcjCN_bD.js.map +1 -0
  67. package/dist/cjs/{getPublishUploads-CuGIvV-Q.js → getPublishUploads-5_oXzwol.js} +4 -4
  68. package/dist/cjs/{getPublishUploads-CuGIvV-Q.js.map → getPublishUploads-5_oXzwol.js.map} +1 -1
  69. package/dist/cjs/{getSegmentedItemProperties-BCJXJlTR.js → getSegmentedItemProperties-WFdizUDv.js} +2 -2
  70. package/dist/cjs/{getSegmentedItemProperties-BCJXJlTR.js.map → getSegmentedItemProperties-WFdizUDv.js.map} +1 -1
  71. package/dist/cjs/{index-CbTBDqTJ.js → index-BrmvhXsG.js} +3 -3
  72. package/dist/cjs/index-BrmvhXsG.js.map +1 -0
  73. package/dist/cjs/{index-C3j3m34a.js → index-CXI4VF1H.js} +12351 -12189
  74. package/dist/cjs/index-CXI4VF1H.js.map +1 -0
  75. package/dist/client/actors/platformClassesInit.d.ts.map +1 -1
  76. package/dist/client/actors/saveAppState.d.ts.map +1 -1
  77. package/dist/db/read/getModelSchemas.d.ts.map +1 -1
  78. package/dist/db/read/getPublishPayload.d.ts.map +1 -1
  79. package/dist/db/write/createNewItem.d.ts.map +1 -1
  80. package/dist/eas.d.ts.map +1 -1
  81. package/dist/events/files/download.d.ts.map +1 -1
  82. package/dist/events/item/syncDbWithEas.d.ts.map +1 -1
  83. package/dist/{getItem-BWPo8wd0.js → getItem-DaQVdeae.js} +8 -8
  84. package/dist/getItem-DaQVdeae.js.map +1 -0
  85. package/dist/{getPublishPayload-Caw2laZM.js → getPublishPayload-CWiLI1yd.js} +12 -10
  86. package/dist/getPublishPayload-CWiLI1yd.js.map +1 -0
  87. package/dist/{getPublishUploads-MlyBuoXh.js → getPublishUploads-DhvcKD_9.js} +9 -9
  88. package/dist/getPublishUploads-DhvcKD_9.js.map +1 -0
  89. package/dist/{getSegmentedItemProperties-COLLdDo4.js → getSegmentedItemProperties-Cp4kcWIF.js} +2 -2
  90. package/dist/getSegmentedItemProperties-Cp4kcWIF.js.map +1 -0
  91. package/dist/helpers/db.d.ts.map +1 -1
  92. package/dist/helpers/property.d.ts.map +1 -1
  93. package/dist/helpers/schema.d.ts.map +1 -1
  94. package/dist/helpers/updateSchema.d.ts.map +1 -1
  95. package/dist/imports/json.d.ts.map +1 -1
  96. package/dist/{index-D2OGsG4v.js → index-DBy53qbb.js} +2 -2
  97. package/dist/index-DBy53qbb.js.map +1 -0
  98. package/dist/{ClientManager-DoHUt8tU.js → index-Dk73a7JE.js} +11781 -11613
  99. package/dist/index-Dk73a7JE.js.map +1 -0
  100. package/dist/{index-B9i_mXXp.js → index-LfXKx_PE.js} +9 -9
  101. package/dist/index-LfXKx_PE.js.map +1 -0
  102. package/dist/main.cjs +2 -2
  103. package/dist/main.js +16 -13
  104. package/dist/main.js.map +1 -1
  105. package/dist/node/db/Db.d.ts.map +1 -1
  106. package/dist/node.js +15 -15
  107. package/dist/node.js.map +1 -1
  108. package/dist/{property-fK7tSUDX.js → property-1o2MvYTm.js} +10 -4
  109. package/dist/property-1o2MvYTm.js.map +1 -0
  110. package/dist/{queries-DGOk16cd.js → queries-DA4G0iEN.js} +2 -2
  111. package/dist/queries-DA4G0iEN.js.map +1 -0
  112. package/dist/services/publish/actors/preparePublishRequestData.d.ts.map +1 -1
  113. package/dist/services/publish/actors/upload.d.ts.map +1 -1
  114. package/dist/services/write/actors/validateEntity.d.ts.map +1 -1
  115. package/dist/services/write/actors/writeToDatabase.d.ts.map +1 -1
  116. package/dist/vite.js.map +1 -1
  117. package/package.json +8 -4
  118. package/dist/ArweaveClient-CczHvccG.js.map +0 -1
  119. package/dist/ArweaveClient-DkNLWiSZ.js.map +0 -1
  120. package/dist/ClientManager-DoHUt8tU.js.map +0 -1
  121. package/dist/Db-BzQR2KX9.js.map +0 -1
  122. package/dist/Db-DJvjXVlp.js.map +0 -1
  123. package/dist/EasClient-CHQYmjj2.js.map +0 -1
  124. package/dist/EasClient-CodrIgW-.js.map +0 -1
  125. package/dist/FileManager-BIVsDnMu.js.map +0 -1
  126. package/dist/FileManager-BbvkZJCH.js.map +0 -1
  127. package/dist/ModelProperty-gjcA83Mq.js.map +0 -1
  128. package/dist/PathResolver-9zAzPhee.js.map +0 -1
  129. package/dist/PathResolver-kGzba-zC.js.map +0 -1
  130. package/dist/QueryClient-C7ZkTT0z.js.map +0 -1
  131. package/dist/QueryClient-CEtsek7Q.js.map +0 -1
  132. package/dist/Schema-ClTcpgbt.js.map +0 -1
  133. package/dist/SchemaValidationService-BfoEiHNr.js.map +0 -1
  134. package/dist/cjs/ModelProperty-BRKRREYP.js.map +0 -1
  135. package/dist/cjs/Schema-CV9hMg8m.js.map +0 -1
  136. package/dist/cjs/getPublishPayload-CKZ7rVbU.js.map +0 -1
  137. package/dist/cjs/index-C3j3m34a.js.map +0 -1
  138. package/dist/cjs/index-CbTBDqTJ.js.map +0 -1
  139. package/dist/getItem-BWPo8wd0.js.map +0 -1
  140. package/dist/getPublishPayload-Caw2laZM.js.map +0 -1
  141. package/dist/getPublishUploads-MlyBuoXh.js.map +0 -1
  142. package/dist/getSegmentedItemProperties-COLLdDo4.js.map +0 -1
  143. package/dist/index-B9i_mXXp.js.map +0 -1
  144. package/dist/index-D2OGsG4v.js.map +0 -1
  145. package/dist/property-fK7tSUDX.js.map +0 -1
  146. package/dist/queries-DGOk16cd.js.map +0 -1
@@ -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-C3j3m34a.js');
5
+ var main_cjs = require('./index-CXI4VF1H.js');
6
6
  require('pluralize');
7
7
  require('drizzle-orm');
8
8
  var typebox = require('@sinclair/typebox');
@@ -17,6 +17,7 @@ require('rxjs');
17
17
  require('lodash-es');
18
18
  require('drizzle-orm/casing');
19
19
  require('eventemitter3');
20
+ require('arweave');
20
21
  require('fs/promises');
21
22
  require('fs');
22
23
  require('path');
@@ -24,7 +25,6 @@ require('@libsql/client');
24
25
  require('drizzle-orm/libsql');
25
26
  require('drizzle-kit/api');
26
27
  require('js-yaml');
27
- require('arweave');
28
28
  require('ts-import');
29
29
  require('glob');
30
30
  require('rimraf');
@@ -576,4 +576,4 @@ class SchemaValidationService {
576
576
  }
577
577
 
578
578
  exports.SchemaValidationService = SchemaValidationService;
579
- //# sourceMappingURL=SchemaValidationService-DUtQUerg.js.map
579
+ //# sourceMappingURL=SchemaValidationService-p5BbJV9T.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaValidationService-DUtQUerg.js","sources":["../../src/Schema/service/validation/SchemaValidationService.ts"],"sourcesContent":["import { Value } from '@sinclair/typebox/value'\nimport { TProperty } from '@/Schema'\nimport { ModelPropertyDataTypes, TPropertyDataType } from '@/helpers/property'\nimport { ValidationResult, ValidationError, ValidationRules } 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 const isValid = Value.Check(TProperty, property)\n \n const errors: ValidationError[] = []\n \n if (!isValid) {\n const typeBoxErrors = [...Value.Errors(TProperty, property)]\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 // Validate that Relation and List properties have a ref defined\n if (property.dataType === ModelPropertyDataTypes.Relation || property.dataType === ModelPropertyDataTypes.List) {\n const hasRef = property.ref && property.ref.trim() !== ''\n const hasRefModelName = property.refModelName && property.refModelName.trim() !== ''\n const hasRefModelId = property.refModelId !== undefined && property.refModelId !== null\n \n if (!hasRef && !hasRefModelName && !hasRefModelId) {\n errors.push({\n field: 'ref',\n message: `Property with dataType \"${property.dataType}\" requires either a \"ref\", \"refModelName\", or \"refModelId\" field to be defined`,\n code: 'missing_ref',\n severity: 'error' as const,\n })\n }\n \n // For Relation type, prefer having refModelId when ref/refModelName is provided\n // This is a warning, not an error, as refModelId can be resolved asynchronously\n if (property.dataType === ModelPropertyDataTypes.Relation && (hasRef || hasRefModelName) && !hasRefModelId) {\n // This is acceptable - refModelId will be resolved asynchronously\n // We don't add an error here, just log for debugging\n logger(`Property \"${property.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 */\n validatePropertyValue(\n value: any,\n dataType: ModelPropertyDataTypes,\n validationRules?: ValidationRules\n ): ValidationResult {\n const errors: ValidationError[] = []\n const warnings: ValidationError[] = []\n\n try {\n // Build base TypeBox schema from dataType\n let schema: TSchema = this.getBaseSchemaForDataType(dataType)\n\n // Apply validation rules\n if (validationRules) {\n schema = this.applyValidationRules(schema, dataType, validationRules)\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 errors.push(...typeBoxErrors.map(err => {\n const fieldPath = err.path || 'value'\n const enhancedMessage = this.enhanceErrorMessage(err, schema, fieldPath)\n \n return {\n field: fieldPath,\n message: enhancedMessage,\n code: String(err.type || 'value_validation_error'),\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 and List properties have a ref/model defined\n if (propertyDefinition.type === 'Relation' || propertyDefinition.type === 'List') {\n if (!propertyDefinition.model || propertyDefinition.model.trim() === '') {\n errors.push({\n field: 'property.model',\n message: `Property with type \"${propertyDefinition.type}\" 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 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","Value","TProperty","value","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,EAAE,SAAS,CAAC;AACjE,YAAA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A,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE;AACjC,oBAAA,MAAM,GAAGA,YAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;gBAClF;qBAAO;AACL,oBAAA,MAAM,GAAGA,YAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;gBACtD;YACF;QACF;;QAGA,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACpE,MAAM,GAAGA,YAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAIA,YAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;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;;;;"}
1
+ {"version":3,"file":"SchemaValidationService-p5BbJV9T.js","sources":["../../src/Schema/service/validation/SchemaValidationService.ts"],"sourcesContent":["import { Value } from '@sinclair/typebox/value'\nimport { TProperty } from '@/Schema'\nimport { ModelPropertyDataTypes, TPropertyDataType } from '@/helpers/property'\nimport { ValidationResult, ValidationError, ValidationRules } 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 const isValid = Value.Check(TProperty, property)\n \n const errors: ValidationError[] = []\n \n if (!isValid) {\n const typeBoxErrors = [...Value.Errors(TProperty, property)]\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 // Validate that Relation and List properties have a ref defined\n if (property.dataType === ModelPropertyDataTypes.Relation || property.dataType === ModelPropertyDataTypes.List) {\n const hasRef = property.ref && property.ref.trim() !== ''\n const hasRefModelName = property.refModelName && property.refModelName.trim() !== ''\n const hasRefModelId = property.refModelId !== undefined && property.refModelId !== null\n \n if (!hasRef && !hasRefModelName && !hasRefModelId) {\n errors.push({\n field: 'ref',\n message: `Property with dataType \"${property.dataType}\" requires either a \"ref\", \"refModelName\", or \"refModelId\" field to be defined`,\n code: 'missing_ref',\n severity: 'error' as const,\n })\n }\n \n // For Relation type, prefer having refModelId when ref/refModelName is provided\n // This is a warning, not an error, as refModelId can be resolved asynchronously\n if (property.dataType === ModelPropertyDataTypes.Relation && (hasRef || hasRefModelName) && !hasRefModelId) {\n // This is acceptable - refModelId will be resolved asynchronously\n // We don't add an error here, just log for debugging\n logger(`Property \"${property.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 */\n validatePropertyValue(\n value: any,\n dataType: ModelPropertyDataTypes,\n validationRules?: ValidationRules\n ): ValidationResult {\n const errors: ValidationError[] = []\n const warnings: ValidationError[] = []\n\n try {\n // Build base TypeBox schema from dataType\n let schema: TSchema = this.getBaseSchemaForDataType(dataType)\n\n // Apply validation rules\n if (validationRules) {\n schema = this.applyValidationRules(schema, dataType, validationRules)\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 errors.push(...typeBoxErrors.map(err => {\n const fieldPath = err.path || 'value'\n const enhancedMessage = this.enhanceErrorMessage(err, schema, fieldPath)\n \n return {\n field: fieldPath,\n message: enhancedMessage,\n code: String(err.type || 'value_validation_error'),\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 and List properties have a ref/model defined\n if (propertyDefinition.type === 'Relation' || propertyDefinition.type === 'List') {\n if (!propertyDefinition.model || propertyDefinition.model.trim() === '') {\n errors.push({\n field: 'property.model',\n message: `Property with type \"${propertyDefinition.type}\" 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 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","Value","TProperty","value","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,EAAE,SAAS,CAAC;AACjE,YAAA,IAAI,aAAa,KAAK,SAAS,EAAE;AAC/B,gBAAA,OAAO,aAAa,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAA,YAAA,EAAe,IAAI,CAAC,SAAS,CAAC,K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SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;gBAClF;qBAAO;AACL,oBAAA,MAAM,GAAGA,YAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;gBACtD;YACF;QACF;;QAGA,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACpE,MAAM,GAAGA,YAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAIA,YAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;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;;;;"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var main_cjs = require('./index-C3j3m34a.js');
3
+ var main_cjs = require('./index-CXI4VF1H.js');
4
4
  var lodashEs = require('lodash-es');
5
5
  require('immer');
6
6
  require('reflect-metadata');
@@ -15,6 +15,7 @@ require('ethers');
15
15
  require('rxjs');
16
16
  require('drizzle-orm/casing');
17
17
  require('eventemitter3');
18
+ require('arweave');
18
19
  require('@sinclair/typebox');
19
20
  require('fs/promises');
20
21
  require('fs');
@@ -23,7 +24,6 @@ require('@libsql/client');
23
24
  require('drizzle-orm/libsql');
24
25
  require('drizzle-kit/api');
25
26
  require('js-yaml');
26
- require('arweave');
27
27
  require('ts-import');
28
28
  require('glob');
29
29
  require('rimraf');
@@ -52,4 +52,4 @@ const getItem = async ({ modelName, seedLocalId, seedUid }) => {
52
52
  };
53
53
 
54
54
  exports.getItem = getItem;
55
- //# sourceMappingURL=getItem-BThT-UOt.js.map
55
+ //# sourceMappingURL=getItem-BrnLfC12.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getItem-BThT-UOt.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 return Item.create(itemInitObj)\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;AAEA,IAAA,OAAOC,aAAI,CAAC,MAAM,CAAC,WAAW,CAAC;AACjC;;;;"}
1
+ {"version":3,"file":"getItem-BrnLfC12.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 return Item.create(itemInitObj)\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;AAEA,IAAA,OAAOC,aAAI,CAAC,MAAM,CAAC,WAAW,CAAC;AACjC;;;;"}
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var main_cjs = require('./index-C3j3m34a.js');
3
+ var main_cjs = require('./index-CXI4VF1H.js');
4
4
  var pluralize = require('pluralize');
5
- var getSegmentedItemProperties = require('./getSegmentedItemProperties-BCJXJlTR.js');
5
+ var getSegmentedItemProperties = require('./getSegmentedItemProperties-WFdizUDv.js');
6
6
  var debug = require('debug');
7
7
  var ethers = require('ethers');
8
8
  require('reflect-metadata');
@@ -16,6 +16,7 @@ require('rxjs');
16
16
  require('lodash-es');
17
17
  require('drizzle-orm/casing');
18
18
  require('eventemitter3');
19
+ require('arweave');
19
20
  require('@sinclair/typebox');
20
21
  require('fs/promises');
21
22
  require('fs');
@@ -24,7 +25,6 @@ require('@libsql/client');
24
25
  require('drizzle-orm/libsql');
25
26
  require('drizzle-kit/api');
26
27
  require('js-yaml');
27
- require('arweave');
28
28
  require('ts-import');
29
29
  require('glob');
30
30
  require('rimraf');
@@ -150,7 +150,8 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
150
150
  }
151
151
  const { localId: seedLocalId, uid: seedUid } = main_cjs.getCorrectId(value);
152
152
  // Use dynamic import to break circular dependency
153
- const { getItem } = await Promise.resolve().then(function () { return require('./getItem-BThT-UOt.js'); });
153
+ const getItemMod = await Promise.resolve().then(function () { return require('./getItem-BrnLfC12.js'); });
154
+ const { getItem } = getItemMod;
154
155
  const relatedItem = await getItem({
155
156
  seedLocalId,
156
157
  seedUid,
@@ -237,7 +238,8 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
237
238
  for (const seedId of value) {
238
239
  const { localId: seedLocalId, uid: seedUid } = main_cjs.getCorrectId(seedId);
239
240
  // Use dynamic import to break circular dependency
240
- const { getItem } = await Promise.resolve().then(function () { return require('./getItem-BThT-UOt.js'); });
241
+ const getItemMod = await Promise.resolve().then(function () { return require('./getItem-BrnLfC12.js'); });
242
+ const { getItem } = getItemMod;
241
243
  const relatedItem = await getItem({
242
244
  seedLocalId,
243
245
  seedUid,
@@ -335,4 +337,4 @@ const getPublishPayload = async (item, uploadedTransactions) => {
335
337
  };
336
338
 
337
339
  exports.getPublishPayload = getPublishPayload;
338
- //# sourceMappingURL=getPublishPayload-CKZ7rVbU.js.map
340
+ //# sourceMappingURL=getPublishPayload-BcjCN_bD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPublishPayload-BcjCN_bD.js","sources":["../../src/db/read/getPublishPayload.ts"],"sourcesContent":["// Dynamic import to break circular dependency with getItem -> BaseItem\n// import { getItem } from '@/db/read/getItem'\nimport {\n defaultAttestationData,\n INTERNAL_DATA_TYPES,\n VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA,\n ZERO_BYTES32,\n} from '@/helpers/constants'\nimport {\n AttestationRequest,\n AttestationRequestData,\n} from '@ethereum-attestation-service/eas-sdk'\n\nimport { getSchemaForItemProperty } from '@/helpers/getSchemaForItemProperty'\nimport { toSnakeCase } from '@/helpers'\nimport pluralize from 'pluralize'\nimport { getSchemaUidForModel } from '@/db/read/getSchemaUidForModel'\nimport { getSchemaUidForSchemaDefinition } from '@/stores/eas'\nimport { getCorrectId } from '@/helpers'\nimport { getSegmentedItemProperties } from '@/helpers/getSegmentedItemProperties'\nimport { IItemProperty } from '@/interfaces'\nimport { IItem } from '@/interfaces'\nimport { Item } from '@/Item/Item'\nimport debug from 'debug'\nimport {ethers} from 'ethers'\nimport { ModelPropertyDataTypes } from '@/Schema'\nconst logger = debug('seedSdk:db:getPublishPayload')\n\nconst getVersionUid = (item: IItem<any>): string => {\n const latestVersion = item.latestVersionUid\n if (latestVersion && typeof latestVersion === 'object' && latestVersion.uid) {\n return latestVersion.uid\n }\n if (latestVersion && typeof latestVersion === 'string') {\n return latestVersion\n }\n return ZERO_BYTES32\n}\n\nconst getPropertyData = async (itemProperty: IItemProperty<any>) => {\n const easDataType =\n INTERNAL_DATA_TYPES[itemProperty.propertyDef!.dataType].eas\n\n let schemaUid: string | undefined = itemProperty.schemaUid\n\n const propertyNameForSchema = toSnakeCase(itemProperty.propertyName)\n\n const schemaDef = `${easDataType} ${propertyNameForSchema}`\n\n if (!schemaUid) {\n schemaUid = await getSchemaUidForSchemaDefinition({ schemaText: schemaDef })\n if (!schemaUid) {\n const schema = await getSchemaForItemProperty({\n propertyName: 'version',\n easDataType: 'bytes32',\n })\n if (schema) {\n schemaUid = schema.id\n }\n }\n }\n\n return {\n schemaUid,\n easDataType,\n schemaDef,\n propertyNameForSchema,\n }\n}\n\n// Lazy import SchemaEncoder to avoid module resolution issues with ts-import\nlet SchemaEncoderClass: typeof import('@ethereum-attestation-service/eas-sdk').SchemaEncoder | null = null\nconst getSchemaEncoder = async () => {\n if (!SchemaEncoderClass) {\n const easSdk = await import('@ethereum-attestation-service/eas-sdk')\n SchemaEncoderClass = easSdk.SchemaEncoder\n }\n return SchemaEncoderClass\n}\n\nconst processBasicProperties = async (\n itemBasicProperties: IItemProperty<any>[],\n itemPublishData: PublishPayload,\n): Promise<PublishPayload> => {\n for (const basicProperty of itemBasicProperties) {\n const snapshot = basicProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n let value = (context as any).propertyValue\n\n if (!value || basicProperty.uid) {\n continue\n }\n\n const { schemaUid, easDataType, schemaDef } =\n await getPropertyData(basicProperty)\n\n const propertyNameForSchema = toSnakeCase(basicProperty.propertyName)\n\n if (schemaDef.startsWith('bytes32[]') && !Array.isArray(value)) {\n throw new Error(`Invalid value for property: ${basicProperty.propertyName}. Expected an array of bytes32, got ${value}.`)\n }\n\n if (schemaDef.startsWith('bytes32[]')) {\n const newValues = []\n for (const seedId of value) {\n if (seedId.length !== 66 && !seedId.startsWith('0x')) {\n newValues.push(ethers.encodeBytes32String(seedId))\n continue\n }\n newValues.push(seedId)\n }\n value = newValues\n }\n\n // uint256 (Date) must be numeric/BigInt; normalize ISO strings to Unix seconds\n if (easDataType === 'uint256' && (typeof value === 'string' || value instanceof Date)) {\n const ms = value instanceof Date ? value.getTime() : new Date(value).getTime()\n value = BigInt(Math.floor(ms / 1000))\n }\n\n let data = [\n {\n name: propertyNameForSchema,\n type: easDataType,\n value,\n },\n ]\n\n const SchemaEncoder = await getSchemaEncoder()\n const dataEncoder = new SchemaEncoder(schemaDef)\n\n const encodedData = dataEncoder.encodeData(data)\n\n itemPublishData.listOfAttestations.push({\n schema: schemaUid!,\n data: {\n ...defaultAttestationData,\n data: encodedData,\n } as AttestationRequestData,\n })\n }\n\n return itemPublishData\n}\n\n\nconst processRelationOrImageProperty = async (\n relationOrImageProperty: IItemProperty<any>,\n multiPublishPayload: MultiPublishPayload,\n uploadedTransactions: UploadedTransaction[],\n originalSeedLocalId: string,\n): Promise<MultiPublishPayload> => {\n let relationOrImageSchemaUid = relationOrImageProperty.schemaUid\n if (!relationOrImageSchemaUid && relationOrImageProperty.propertyDef) {\n const propertyData = await getPropertyData(relationOrImageProperty)\n relationOrImageSchemaUid = propertyData.schemaUid\n }\n if (!relationOrImageSchemaUid) {\n throw new Error(\n `Schema uid not found for relation or image property: ${relationOrImageProperty.propertyName}`,\n )\n }\n\n const snapshot = relationOrImageProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n return multiPublishPayload\n }\n const value = (context as any).propertyValue\n if (!value || relationOrImageProperty.uid) {\n return multiPublishPayload\n }\n\n const { localId: seedLocalId, uid: seedUid } = getCorrectId(value)\n\n // Use dynamic import to break circular dependency\n const getItemMod = await import('../../db/read/getItem')\n const { getItem } = getItemMod\n const relatedItem = await getItem({\n seedLocalId,\n seedUid,\n })\n\n if (!relatedItem) {\n throw new Error(\n `No related item found for relation or image property: ${relationOrImageProperty.propertyName}`,\n )\n }\n\n const versionUid = getVersionUid(relatedItem)\n\n let modelName: string | undefined\n\n if (relationOrImageProperty.propertyDef?.dataType === ModelPropertyDataTypes.Image) {\n modelName = 'Image'\n }\n\n if (relationOrImageProperty.propertyDef?.dataType === ModelPropertyDataTypes.Relation) {\n modelName = relationOrImageProperty.propertyDef!.ref as string\n }\n\n if (!modelName) {\n throw new Error(`Model name not found for relation or image property: ${relationOrImageProperty.propertyName}`)\n }\n\n const seedSchemaUid = await getSchemaUidForModel(modelName)\n \n if (!seedSchemaUid) {\n throw new Error(`Schema UID not found for model: ${modelName}`)\n }\n\n let publishPayload: PublishPayload = {\n localId: relationOrImageProperty.localId,\n seedIsRevocable: true,\n versionSchemaUid: VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA,\n seedUid: seedUid || ZERO_BYTES32,\n seedSchemaUid,\n versionUid,\n listOfAttestations: [],\n propertiesToUpdate: [\n {\n publishLocalId: originalSeedLocalId,\n propertySchemaUid: relationOrImageSchemaUid,\n },\n ],\n }\n\n const { itemBasicProperties, itemUploadProperties } =\n getSegmentedItemProperties(relatedItem)\n\n if (itemUploadProperties.length === 1) {\n const uploadProperty = itemUploadProperties[0]\n const itemProperty = uploadProperty.itemProperty\n const transactionData = uploadedTransactions.find(\n (transaction) => transaction.seedLocalId === relatedItem.seedLocalId,\n )\n if (transactionData) {\n itemProperty.value = transactionData.txId\n await itemProperty.save()\n itemBasicProperties.push(itemProperty)\n }\n }\n\n publishPayload = await processBasicProperties(\n itemBasicProperties,\n publishPayload,\n )\n\n multiPublishPayload.push(publishPayload)\n\n return multiPublishPayload\n}\n\nconst processListProperty = async (\n listProperty: IItemProperty<any>,\n multiPublishPayload: MultiPublishPayload,\n originalSeedLocalId: string,\n): Promise<MultiPublishPayload> => {\n let listPropertySchemaUid = listProperty.schemaUid\n if (!listPropertySchemaUid && listProperty.propertyDef) {\n const propertyData = await getPropertyData(listProperty)\n listPropertySchemaUid = propertyData.schemaUid\n }\n if (!listPropertySchemaUid) {\n throw new Error(\n `Schema uid not found for list property: ${listProperty.propertyName}`,\n )\n }\n\n const snapshot = listProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n return multiPublishPayload\n }\n let value = (context as any).propertyValue\n if (!value || listProperty.uid) {\n return multiPublishPayload\n }\n\n const singularPropertyName = pluralize.singular(listProperty.propertyName)\n const propertyNameForSchema = `${singularPropertyName}${listProperty.propertyDef!.ref}Ids`\n if (typeof value === 'string' && value.length === 66) {\n value = [value]\n }\n if (typeof value === 'string' && value.length > 66) {\n try {\n value = JSON.parse(value)\n } catch (error) {\n value = value.split(',')\n }\n }\n\n for (const seedId of value) {\n const { localId: seedLocalId, uid: seedUid } = getCorrectId(seedId)\n\n // Use dynamic import to break circular dependency\n const getItemMod = await import('../../db/read/getItem')\n const { getItem } = getItemMod\n const relatedItem = await getItem({\n seedLocalId,\n seedUid,\n })\n\n if (!relatedItem) {\n console.error(\n `No related item found for list property: ${listProperty.propertyName}`,\n )\n continue\n }\n\n if (relatedItem.seedUid) {\n return multiPublishPayload\n }\n\n const versionUid = getVersionUid(relatedItem)\n\n let modelName: string | undefined\n\n if (listProperty.propertyDef?.ref) {\n modelName = listProperty.propertyDef!.ref as string\n }\n\n if (listProperty.propertyDef?.dataType === ModelPropertyDataTypes.Image) {\n modelName = 'Image'\n }\n\n if (!modelName) {\n throw new Error(`Model name not found for list property: ${listProperty.propertyName}`)\n }\n\n const seedSchemaUid = await getSchemaUidForModel(modelName)\n \n if (!seedSchemaUid) {\n throw new Error(`Schema UID not found for model: ${modelName}`)\n }\n\n let publishPayload: PublishPayload = {\n localId: relatedItem.seedLocalId,\n seedIsRevocable: true,\n versionSchemaUid: VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA,\n seedUid: seedUid || ZERO_BYTES32,\n seedSchemaUid,\n versionUid,\n listOfAttestations: [],\n propertiesToUpdate: [\n {\n publishLocalId: originalSeedLocalId,\n propertySchemaUid: listPropertySchemaUid,\n },\n ],\n }\n\n const { itemBasicProperties } = getSegmentedItemProperties(relatedItem)\n\n publishPayload = await processBasicProperties(\n itemBasicProperties,\n publishPayload,\n )\n\n multiPublishPayload.push(publishPayload)\n }\n\n return multiPublishPayload\n}\n\ntype PublishPayload = {\n localId: string\n seedIsRevocable: boolean\n seedSchemaUid: string\n seedUid: string\n versionSchemaUid: string\n versionUid: string\n listOfAttestations: AttestationRequest[]\n propertiesToUpdate: any[]\n}\n\ntype MultiPublishPayload = PublishPayload[]\n\ntype UploadedTransaction = {\n txId: string\n itemPropertyLocalId?: string\n seedLocalId?: string\n versionLocalId?: string\n itemPropertyName?: string\n}\n\nexport const getPublishPayload = async (\n item: Item<any>,\n uploadedTransactions: UploadedTransaction[],\n): Promise<MultiPublishPayload> => {\n\n let multiPublishPayload: MultiPublishPayload = []\n\n // Each PublishPayload is generated from a Seed that needs publishing\n\n // First we need to determine all Seeds to publish\n\n // That means the Seed of the Item, plus any Seeds pointed to by Relations\n\n // Check if the item has a schema UID\n let itemSchemaUid = item.schemaUid\n if (!itemSchemaUid) {\n const schemaUid = await getSchemaUidForModel(item.modelName)\n if (!schemaUid) {\n throw new Error(`Schema UID not found for model: ${item.modelName}`)\n }\n itemSchemaUid = schemaUid\n }\n\n let itemPublishData: PublishPayload = {\n localId: item.seedLocalId,\n seedUid: item.seedUid || ZERO_BYTES32,\n seedIsRevocable: true,\n seedSchemaUid: itemSchemaUid,\n versionSchemaUid: VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA,\n versionUid: getVersionUid(item),\n listOfAttestations: [],\n propertiesToUpdate: [],\n }\n\n const {\n itemBasicProperties,\n itemListProperties,\n itemUploadProperties,\n itemImageProperties,\n itemRelationProperties,\n } = getSegmentedItemProperties(item)\n\n const relationAndImageProperties = [...itemRelationProperties, ...itemImageProperties]\n\n if (itemUploadProperties.length === 1) {\n const uploadProperty = itemUploadProperties[0]\n const itemProperty = uploadProperty.itemProperty\n const transactionData = uploadedTransactions.find(\n (transaction) => transaction.seedLocalId === item.seedLocalId,\n )\n if (transactionData) {\n itemProperty.value = transactionData.txId\n await itemProperty.save()\n itemBasicProperties.push(itemProperty)\n }\n }\n\n for (const relationProperty of relationAndImageProperties) {\n multiPublishPayload = await processRelationOrImageProperty(\n relationProperty,\n multiPublishPayload,\n uploadedTransactions,\n item.seedLocalId,\n )\n itemBasicProperties.push(relationProperty)\n }\n\n for (const listProperty of itemListProperties) {\n multiPublishPayload = await processListProperty(\n listProperty,\n multiPublishPayload,\n item.seedLocalId,\n )\n itemBasicProperties.push(listProperty)\n }\n \n itemPublishData = await processBasicProperties(\n itemBasicProperties,\n itemPublishData,\n )\n\n multiPublishPayload.push(itemPublishData)\n\n\n \n\n return multiPublishPayload\n}\n"],"names":["ZERO_BYTES32","INTERNAL_DATA_TYPES","toSnakeCase","getSchemaUidForSchemaDefinition","getSchemaForItemProperty","ethers","defaultAttestationData","getCorrectId","ModelPropertyDataTypes","getSchemaUidForModel","VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA","getSegmentedItemProperties"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAyBe,KAAK,CAAC,8BAA8B;AAEnD,MAAM,aAAa,GAAG,CAAC,IAAgB,KAAY;AACjD,IAAA,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB;IAC3C,IAAI,aAAa,IAAI,OAAO,aAAa,KAAK,QAAQ,IAAI,aAAa,CAAC,GAAG,EAAE;QAC3E,OAAO,aAAa,CAAC,GAAG;IAC1B;AACA,IAAA,IAAI,aAAa,IAAI,OAAO,aAAa,KAAK,QA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BAAmB,EACnB,eAAe,CAChB;AAED,IAAA,mBAAmB,CAAC,IAAI,CAAC,eAAe,CAAC;AAKzC,IAAA,OAAO,mBAAmB;AAC5B;;;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var main_cjs = require('./index-C3j3m34a.js');
4
- var getSegmentedItemProperties = require('./getSegmentedItemProperties-BCJXJlTR.js');
3
+ var main_cjs = require('./index-CXI4VF1H.js');
4
+ var getSegmentedItemProperties = require('./getSegmentedItemProperties-WFdizUDv.js');
5
5
  var debug = require('debug');
6
6
  var sha3 = require('js-sha3');
7
7
  require('immer');
@@ -17,6 +17,7 @@ require('rxjs');
17
17
  require('lodash-es');
18
18
  require('drizzle-orm/casing');
19
19
  require('eventemitter3');
20
+ require('arweave');
20
21
  require('@sinclair/typebox');
21
22
  require('fs/promises');
22
23
  require('fs');
@@ -25,7 +26,6 @@ require('@libsql/client');
25
26
  require('drizzle-orm/libsql');
26
27
  require('drizzle-kit/api');
27
28
  require('js-yaml');
28
- require('arweave');
29
29
  require('ts-import');
30
30
  require('glob');
31
31
  require('rimraf');
@@ -226,4 +226,4 @@ const getPublishUploads = async (item, uploads = [], relatedItemProperty) => {
226
226
 
227
227
  exports.getPublishUploads = getPublishUploads;
228
228
  exports.prepareArweaveTransaction = prepareArweaveTransaction;
229
- //# sourceMappingURL=getPublishUploads-CuGIvV-Q.js.map
229
+ //# sourceMappingURL=getPublishUploads-5_oXzwol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPublishUploads-CuGIvV-Q.js","sources":["../../src/helpers/crypto.ts","../../src/db/read/getPublishUploads.ts"],"sourcesContent":["import * as sha3 from 'js-sha3'\n\nconst { sha3_256, } = sha3\n\n\nexport const getContentHash = async (\n data: sha3.Message\n): Promise<string> => {\n return sha3_256(data)\n}","import { BaseFileManager, getCorrectId } from '@/helpers'\nimport { BaseArweaveClient } from '@/helpers/ArweaveClient/BaseArweaveClient'\nimport { getSegmentedItemProperties } from '@/helpers/getSegmentedItemProperties'\nimport debug from 'debug'\nimport { IItem, IItemProperty } from '@/interfaces'\nimport { getContentHash } from '@/helpers/crypto'\nimport { Item } from '@/Item/Item'\nimport type { ArweaveTransaction } from '@/types/arweave'\nimport { PublishUpload } from '@/types/publish'\n\nconst logger = debug('seedSdk:item:getPublishUploads')\n\nexport const prepareArweaveTransaction = async (\n data: string | Uint8Array,\n contentHash: string | undefined,\n): Promise<ArweaveTransaction> => {\n const tags = contentHash\n ? [{ name: 'Content-SHA-256', value: contentHash }]\n : undefined\n\n if (contentHash) {\n logger('contentHash', contentHash)\n logger('adding content hash tag')\n }\n\n const tx = await BaseArweaveClient.createTransaction(data, { tags })\n\n return tx\n}\n\n\nconst getImageUploads = async (itemImageProperties: IItemProperty<any>[]) => {\n const uploads: PublishUpload[] = []\n\n for (const itemImageProperty of itemImageProperties) {\n const snapshot = itemImageProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const refResolvedValue = (context as any).refResolvedValue\n if (!refResolvedValue) {\n continue\n }\n\n const filePath = `/files/images/${refResolvedValue}`\n\n if (!filePath) {\n continue\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n continue\n }\n\n const fileContents = await BaseFileManager.readFileAsString(filePath)\n\n const contentHash = await getContentHash(fileContents)\n\n const transaction = await prepareArweaveTransaction(fileContents, contentHash)\n\n uploads.push({\n itemPropertyName: itemImageProperty.propertyName,\n itemPropertyLocalId: itemImageProperty.localId,\n seedLocalId: itemImageProperty.seedLocalId!,\n versionLocalId: itemImageProperty.versionLocalId!,\n transactionToSign: transaction,\n })\n }\n\n return uploads\n}\n\n\nexport type UploadProperty = {\n itemProperty: IItemProperty<any>\n childProperties: IItemProperty<any>[]\n}\ntype ChildUploadData = {\n propertyName: string\n localStoragePath: string\n}\nconst processUploadProperty = async (\n uploadProperty: UploadProperty,\n uploads: PublishUpload[],\n relatedItemProperty?: IItemProperty<any>,\n): Promise<PublishUpload[]> => {\n const itemProperty = uploadProperty.itemProperty\n\n const childUploads: ChildUploadData[] = []\n\n for (const childProperty of uploadProperty.childProperties) {\n const filePath = childProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n continue\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n continue\n }\n\n childUploads.push({\n propertyName: childProperty.propertyName,\n localStoragePath: filePath,\n })\n }\n\n let fileContents\n let transaction: ArweaveTransaction\n\n if (!childUploads || childUploads.length === 0) {\n if (relatedItemProperty && relatedItemProperty.localStoragePath) {\n const filePath = relatedItemProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n return uploads\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n return uploads\n\n }\n\n try {\n fileContents = await BaseFileManager.readFileAsString(filePath)\n } catch (e) {\n const fs = await BaseFileManager.getFs()\n fileContents = fs.readFileSync(filePath)\n }\n }\n if (!fileContents) {\n return uploads\n }\n }\n\n if (childUploads.length > 0) {\n const separator = '===FILE_SEPARATOR==='\n // let compositeFileContents = `${itemProperty.propertyName}${separator}${mainFileContents}`\n let compositeFileContents = ''\n\n for (const childUpload of childUploads) {\n let childUploadContents\n\n const fs = await BaseFileManager.getFs()\n\n try {\n childUploadContents = await fs.promises.readFile(\n childUpload.localStoragePath,\n )\n } catch (e) {\n childUploadContents = fs.readFileSync(childUpload.localStoragePath)\n }\n\n compositeFileContents += `${separator}${childUpload.propertyName}${separator}${childUploadContents}`\n }\n\n if (typeof document !== 'undefined') {\n fileContents = new TextEncoder().encode(compositeFileContents)\n } else {\n fileContents = Buffer.from(compositeFileContents)\n }\n }\n\n if (!fileContents) {\n throw new Error(`No file contents found for ${itemProperty.propertyName}`)\n }\n\n const uint8Array = new Uint8Array(\n fileContents.buffer,\n fileContents.byteOffset,\n fileContents.byteLength,\n )\n\n const contentHash = await getContentHash(uint8Array)\n\n transaction = await prepareArweaveTransaction(fileContents, contentHash)\n\n let itemPropertyLocalId = relatedItemProperty\n ? relatedItemProperty.localId\n : itemProperty.localId\n let itemPropertyName = relatedItemProperty\n ? relatedItemProperty.propertyName\n : itemProperty.propertyName\n\n uploads.push({\n itemPropertyName,\n itemPropertyLocalId,\n seedLocalId: itemProperty.seedLocalId!,\n versionLocalId: itemProperty.versionLocalId!,\n transactionToSign: transaction,\n })\n\n return uploads\n}\n\nexport const getPublishUploads = async (\n item: IItem<any>,\n uploads: PublishUpload[] = [],\n relatedItemProperty?: IItemProperty<any>,\n) => {\n // if (item.modelName === 'Post') {\n // if (!item.authors) {\n // item.authors = [\n // 'Sr0bIx9Fwj',\n // '0xc2879650e9503a303ceb46f966e55baab480b267dc20cede23ef503622eee6d7',\n // ]\n // }\n // }\n\n const { itemUploadProperties, itemRelationProperties, itemImageProperties } =\n getSegmentedItemProperties(item)\n\n for (const uploadProperty of itemUploadProperties) {\n uploads = await processUploadProperty(\n uploadProperty,\n uploads,\n relatedItemProperty,\n )\n }\n\n const imageUploads = await getImageUploads(itemImageProperties)\n uploads.push(...imageUploads)\n\n for (const relationProperty of itemRelationProperties) {\n const snapshot = relationProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const propertyValue = (context as any).propertyValue\n\n if (!propertyValue || relationProperty.uid) {\n continue\n }\n\n const { localId: seedLocalId, uid: seedUid } = getCorrectId(propertyValue)\n\n const relatedItem = await Item.find({\n seedLocalId,\n seedUid,\n })\n\n if (!relatedItem) {\n throw new Error(\n `No relatedItem found for ${relationProperty.propertyName}`,\n )\n }\n\n uploads = await getPublishUploads(relatedItem, uploads, relationProperty)\n }\n\n return uploads\n}\n"],"names":["sha3","BaseArweaveClient","BaseFileManager","getSegmentedItemProperties","getCorrectId","Item"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,EAAE,QAAQ,GAAG,GAAGA,eAAI;AAGnB,MAAM,cAAc,GAAG,OAC5B,IAAkB,KACC;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,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,mBAAmB,CAAC;AAC/D,IAAA,OAAO,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC;AAE7B,IAAA,KAAK,MAAM,gBAAgB,IAAI,sBAAsB,EAAE;QACrD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,UAAU,EAAE,CAAC,WAAW,EAAE;AAC5D,QAAA,MAAM,OAAO,GAAG,SAAS,IAAI,QAAQ,GAAG,QAAQ,CAAC,OAAO,GAAG,IAAI;QAC/D,IAAI,CAAC,OAAO,EAAE;YACZ;QACF;AACA,QAAA,MAAM,aAAa,GAAI,OAAe,CAAC,aAAa;AAEpD,QAAA,IAAI,CAAC,aAAa,IAAI,gBAAgB,CAAC,GAAG,EAAE;YAC1C;QACF;AAEA,QAAA,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,EAAE,GAAGC,qBAAY,CAAC,aAAa,CAAC;AAE1E,QAAA,MAAM,WAAW,GAAG,MAAMC,aAAI,CAAC,IAAI,CAAC;YAClC,WAAW;YACX,OAAO;AACR,SAAA,CAAC;QAEF,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CACb,CAAA,yBAAA,EAA4B,gBAAgB,CAAC,YAAY,CAAA,CAAE,CAC5D;QACH;QAEA,OAAO,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,OAAO,EAAE,gBAAgB,CAAC;IAC3E;AAEA,IAAA,OAAO,OAAO;AAChB;;;;;"}
1
+ {"version":3,"file":"getPublishUploads-5_oXzwol.js","sources":["../../src/helpers/crypto.ts","../../src/db/read/getPublishUploads.ts"],"sourcesContent":["import * as sha3 from 'js-sha3'\n\nconst { sha3_256, } = sha3\n\n\nexport const getContentHash = async (\n data: sha3.Message\n): Promise<string> => {\n return sha3_256(data)\n}","import { BaseFileManager, getCorrectId } from '@/helpers'\nimport { BaseArweaveClient } from '@/helpers/ArweaveClient/BaseArweaveClient'\nimport { getSegmentedItemProperties } from '@/helpers/getSegmentedItemProperties'\nimport debug from 'debug'\nimport { IItem, IItemProperty } from '@/interfaces'\nimport { getContentHash } from '@/helpers/crypto'\nimport { Item } from '@/Item/Item'\nimport type { ArweaveTransaction } from '@/types/arweave'\nimport { PublishUpload } from '@/types/publish'\n\nconst logger = debug('seedSdk:item:getPublishUploads')\n\nexport const prepareArweaveTransaction = async (\n data: string | Uint8Array,\n contentHash: string | undefined,\n): Promise<ArweaveTransaction> => {\n const tags = contentHash\n ? [{ name: 'Content-SHA-256', value: contentHash }]\n : undefined\n\n if (contentHash) {\n logger('contentHash', contentHash)\n logger('adding content hash tag')\n }\n\n const tx = await BaseArweaveClient.createTransaction(data, { tags })\n\n return tx\n}\n\n\nconst getImageUploads = async (itemImageProperties: IItemProperty<any>[]) => {\n const uploads: PublishUpload[] = []\n\n for (const itemImageProperty of itemImageProperties) {\n const snapshot = itemImageProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const refResolvedValue = (context as any).refResolvedValue\n if (!refResolvedValue) {\n continue\n }\n\n const filePath = `/files/images/${refResolvedValue}`\n\n if (!filePath) {\n continue\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n continue\n }\n\n const fileContents = await BaseFileManager.readFileAsString(filePath)\n\n const contentHash = await getContentHash(fileContents)\n\n const transaction = await prepareArweaveTransaction(fileContents, contentHash)\n\n uploads.push({\n itemPropertyName: itemImageProperty.propertyName,\n itemPropertyLocalId: itemImageProperty.localId,\n seedLocalId: itemImageProperty.seedLocalId!,\n versionLocalId: itemImageProperty.versionLocalId!,\n transactionToSign: transaction,\n })\n }\n\n return uploads\n}\n\n\nexport type UploadProperty = {\n itemProperty: IItemProperty<any>\n childProperties: IItemProperty<any>[]\n}\ntype ChildUploadData = {\n propertyName: string\n localStoragePath: string\n}\nconst processUploadProperty = async (\n uploadProperty: UploadProperty,\n uploads: PublishUpload[],\n relatedItemProperty?: IItemProperty<any>,\n): Promise<PublishUpload[]> => {\n const itemProperty = uploadProperty.itemProperty\n\n const childUploads: ChildUploadData[] = []\n\n for (const childProperty of uploadProperty.childProperties) {\n const filePath = childProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n continue\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n continue\n }\n\n childUploads.push({\n propertyName: childProperty.propertyName,\n localStoragePath: filePath,\n })\n }\n\n let fileContents\n let transaction: ArweaveTransaction\n\n if (!childUploads || childUploads.length === 0) {\n if (relatedItemProperty && relatedItemProperty.localStoragePath) {\n const filePath = relatedItemProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n return uploads\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n return uploads\n\n }\n\n try {\n fileContents = await BaseFileManager.readFileAsString(filePath)\n } catch (e) {\n const fs = await BaseFileManager.getFs()\n fileContents = fs.readFileSync(filePath)\n }\n }\n if (!fileContents) {\n return uploads\n }\n }\n\n if (childUploads.length > 0) {\n const separator = '===FILE_SEPARATOR==='\n // let compositeFileContents = `${itemProperty.propertyName}${separator}${mainFileContents}`\n let compositeFileContents = ''\n\n for (const childUpload of childUploads) {\n let childUploadContents\n\n const fs = await BaseFileManager.getFs()\n\n try {\n childUploadContents = await fs.promises.readFile(\n childUpload.localStoragePath,\n )\n } catch (e) {\n childUploadContents = fs.readFileSync(childUpload.localStoragePath)\n }\n\n compositeFileContents += `${separator}${childUpload.propertyName}${separator}${childUploadContents}`\n }\n\n if (typeof document !== 'undefined') {\n fileContents = new TextEncoder().encode(compositeFileContents)\n } else {\n fileContents = Buffer.from(compositeFileContents)\n }\n }\n\n if (!fileContents) {\n throw new Error(`No file contents found for ${itemProperty.propertyName}`)\n }\n\n const uint8Array = new Uint8Array(\n fileContents.buffer,\n fileContents.byteOffset,\n fileContents.byteLength,\n )\n\n const contentHash = await getContentHash(uint8Array)\n\n transaction = await prepareArweaveTransaction(fileContents, contentHash)\n\n let itemPropertyLocalId = relatedItemProperty\n ? relatedItemProperty.localId\n : itemProperty.localId\n let itemPropertyName = relatedItemProperty\n ? relatedItemProperty.propertyName\n : itemProperty.propertyName\n\n uploads.push({\n itemPropertyName,\n itemPropertyLocalId,\n seedLocalId: itemProperty.seedLocalId!,\n versionLocalId: itemProperty.versionLocalId!,\n transactionToSign: transaction,\n })\n\n return uploads\n}\n\nexport const getPublishUploads = async (\n item: IItem<any>,\n uploads: PublishUpload[] = [],\n relatedItemProperty?: IItemProperty<any>,\n) => {\n // if (item.modelName === 'Post') {\n // if (!item.authors) {\n // item.authors = [\n // 'Sr0bIx9Fwj',\n // '0xc2879650e9503a303ceb46f966e55baab480b267dc20cede23ef503622eee6d7',\n // ]\n // }\n // }\n\n const { itemUploadProperties, itemRelationProperties, itemImageProperties } =\n getSegmentedItemProperties(item)\n\n for (const uploadProperty of itemUploadProperties) {\n uploads = await processUploadProperty(\n uploadProperty,\n uploads,\n relatedItemProperty,\n )\n }\n\n const imageUploads = await getImageUploads(itemImageProperties)\n uploads.push(...imageUploads)\n\n for (const relationProperty of itemRelationProperties) {\n const snapshot = relationProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const propertyValue = (context as any).propertyValue\n\n if (!propertyValue || relationProperty.uid) {\n continue\n }\n\n const { localId: seedLocalId, uid: seedUid } = getCorrectId(propertyValue)\n\n const relatedItem = await Item.find({\n seedLocalId,\n seedUid,\n })\n\n if (!relatedItem) {\n throw new Error(\n `No relatedItem found for ${relationProperty.propertyName}`,\n )\n }\n\n uploads = await getPublishUploads(relatedItem, uploads, relationProperty)\n }\n\n return uploads\n}\n"],"names":["sha3","BaseArweaveClient","BaseFileManager","getSegmentedItemProperties","getCorrectId","Item"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,EAAE,QAAQ,GAAG,GAAGA,eAAI;AAGnB,MAAM,cAAc,GAAG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ACpB;IACH;AAEA,IAAA,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,mBAAmB,CAAC;AAC/D,IAAA,OAAO,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC;AAE7B,IAAA,KAAK,MAAM,gBAAgB,IAAI,sBAAsB,EAAE;QACrD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,UAAU,EAAE,CAAC,WAAW,EAAE;AAC5D,QAAA,MAAM,OAAO,GAAG,SAAS,IAAI,QAAQ,GAAG,QAAQ,CAAC,OAAO,GAAG,IAAI;QAC/D,IAAI,CAAC,OAAO,EAAE;YACZ;QACF;AACA,QAAA,MAAM,aAAa,GAAI,OAAe,CAAC,aAAa;AAEpD,QAAA,IAAI,CAAC,aAAa,IAAI,gBAAgB,CAAC,GAAG,EAAE;YAC1C;QACF;AAEA,QAAA,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,EAAE,GAAGC,qBAAY,CAAC,aAAa,CAAC;AAE1E,QAAA,MAAM,WAAW,GAAG,MAAMC,aAAI,CAAC,IAAI,CAAC;YAClC,WAAW;YACX,OAAO;AACR,SAAA,CAAC;QAEF,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CACb,CAAA,yBAAA,EAA4B,gBAAgB,CAAC,YAAY,CAAA,CAAE,CAC5D;QACH;QAEA,OAAO,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,OAAO,EAAE,gBAAgB,CAAC;IAC3E;AAEA,IAAA,OAAO,OAAO;AAChB;;;;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('reflect-metadata');
4
- var main_cjs = require('./index-C3j3m34a.js');
4
+ var main_cjs = require('./index-CXI4VF1H.js');
5
5
  require('pluralize');
6
6
  require('drizzle-orm');
7
7
 
@@ -58,4 +58,4 @@ const getSegmentedItemProperties = (item) => {
58
58
  };
59
59
 
60
60
  exports.getSegmentedItemProperties = getSegmentedItemProperties;
61
- //# sourceMappingURL=getSegmentedItemProperties-BCJXJlTR.js.map
61
+ //# sourceMappingURL=getSegmentedItemProperties-WFdizUDv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getSegmentedItemProperties-BCJXJlTR.js","sources":["../../src/helpers/getSegmentedItemProperties.ts"],"sourcesContent":["import { UploadProperty } from '@/db/read/getPublishUploads'\nimport { IItem } from '@/interfaces'\nimport { ModelPropertyDataTypes } from '@/Schema'\n\nexport const getSegmentedItemProperties = (item: IItem<any>) => {\n const itemBasicProperties = []\n const itemRelationProperties = []\n const itemListProperties = []\n const itemUploadProperties: UploadProperty[] = []\n const itemImageProperties = []\n const itemStorageProperties = []\n let itemStorageTransactionProperty: UploadProperty | undefined\n\n for (const itemProperty of item.properties) {\n if (!itemProperty.propertyDef) {\n continue\n }\n\n const isItemStorage =\n itemProperty.propertyDef.storageType &&\n itemProperty.propertyDef.storageType === 'ItemStorage'\n\n\n const isStorageTransaction =\n itemProperty.propertyName === 'storageTransactionId'\n\n if (itemProperty.propertyDef.dataType === ModelPropertyDataTypes.Image) {\n itemImageProperties.push(itemProperty)\n continue\n }\n\n if (itemProperty.propertyDef.dataType === ModelPropertyDataTypes.Relation) {\n itemRelationProperties.push(itemProperty)\n continue\n }\n\n if (itemProperty.propertyDef.dataType === ModelPropertyDataTypes.List) {\n itemListProperties.push(itemProperty)\n continue\n }\n\n if (isItemStorage) {\n itemStorageProperties.push(itemProperty)\n continue\n }\n\n if (isStorageTransaction) {\n itemStorageTransactionProperty = { itemProperty, childProperties: [] }\n continue\n }\n\n itemBasicProperties.push(itemProperty)\n }\n\n if (itemStorageTransactionProperty && itemStorageProperties.length > 0) {\n itemStorageTransactionProperty.childProperties = itemStorageProperties\n }\n\n if (itemStorageTransactionProperty) {\n itemUploadProperties.push(itemStorageTransactionProperty)\n }\n\n return {\n itemBasicProperties,\n itemRelationProperties,\n itemListProperties,\n itemUploadProperties,\n itemImageProperties,\n }\n}\n"],"names":["ModelPropertyDataTypes"],"mappings":";;;;;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IACxC;IAEA,IAAI,8BAA8B,IAAI,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE;AACtE,QAAA,8BAA8B,CAAC,eAAe,GAAG,qBAAqB;IACxE;IAEA,IAAI,8BAA8B,EAAE;AAClC,QAAA,oBAAoB,CAAC,IAAI,CAAC,8BAA8B,CAAC;IAC3D;IAEA,OAAO;QACL,mBAAmB;QACnB,sBAAsB;QACtB,kBAAkB;QAClB,oBAAoB;QACpB,mBAAmB;KACpB;AACH;;;;"}
1
+ {"version":3,"file":"getSegmentedItemProperties-WFdizUDv.js","sources":["../../src/helpers/getSegmentedItemProperties.ts"],"sourcesContent":["import { UploadProperty } from '@/db/read/getPublishUploads'\nimport { IItem } from '@/interfaces'\nimport { ModelPropertyDataTypes } from '@/Schema'\n\nexport const getSegmentedItemProperties = (item: IItem<any>) => {\n const itemBasicProperties = []\n const itemRelationProperties = []\n const itemListProperties = []\n const itemUploadProperties: UploadProperty[] = []\n const itemImageProperties = []\n const itemStorageProperties = []\n let itemStorageTransactionProperty: UploadProperty | undefined\n\n for (const itemProperty of item.properties) {\n if (!itemProperty.propertyDef) {\n continue\n }\n\n const isItemStorage =\n itemProperty.propertyDef.storageType &&\n itemProperty.propertyDef.storageType === 'ItemStorage'\n\n\n const isStorageTransaction =\n itemProperty.propertyName === 'storageTransactionId'\n\n if (itemProperty.propertyDef.dataType === ModelPropertyDataTypes.Image) {\n itemImageProperties.push(itemProperty)\n continue\n }\n\n if (itemProperty.propertyDef.dataType === ModelPropertyDataTypes.Relation) {\n itemRelationProperties.push(itemProperty)\n continue\n }\n\n if (itemProperty.propertyDef.dataType === ModelPropertyDataTypes.List) {\n itemListProperties.push(itemProperty)\n continue\n }\n\n if (isItemStorage) {\n itemStorageProperties.push(itemProperty)\n continue\n }\n\n if (isStorageTransaction) {\n itemStorageTransactionProperty = { itemProperty, childProperties: [] }\n continue\n }\n\n itemBasicProperties.push(itemProperty)\n }\n\n if (itemStorageTransactionProperty && itemStorageProperties.length > 0) {\n itemStorageTransactionProperty.childProperties = itemStorageProperties\n }\n\n if (itemStorageTransactionProperty) {\n itemUploadProperties.push(itemStorageTransactionProperty)\n }\n\n return {\n itemBasicProperties,\n itemRelationProperties,\n itemListProperties,\n itemUploadProperties,\n itemImageProperties,\n }\n}\n"],"names":["ModelPropertyDataTypes"],"mappings":";;;;;;;AAIO,MAAM,0BAA0B,GAAG,CAAC,IAAgB,KAAI;IAC7D,MAAM,mBAAmB,GAAG,EAAE;IAC9B,MAAM,sBAAsB,GAAG,EAAE;IACjC,MAAM,kBAAkB,GAAG,EAAE;IAC7B,MAAM,oBAAoB,GAAqB,EAAE;IACjD,MAAM,mBAAmB,GAAG,EAAE;IAC9B,MAAM,qBAAqB,GAAG,EAAE;AAChC,IAAA,IAAI,8BAA0D;AAE9D,IAAA,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,UAAU,EAAE;AAC1C,QAAA,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE;YAC7B;QACF;AAEA,QAAA,MAAM,aAAa,GACjB,YAAY,CAAC,WAAW,CAAC,WAAW;AACpC,YAAA,YAAY,CAAC,WAAW,CAAC,WAAW,KAAK,aAAa;AAGxD,QAAA,MAAM,oBAAoB,GACxB,YAAY,CAAC,YAAY,KAAK,sBAAsB;QAEtD,IAAI,YAAY,CAAC,WAAW,CAAC,QAAQ,KAAKA,+BAAsB,CAAC,KAAK,EAAE;AACtE,YAAA,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;YACtC;QACF;QAEA,IAAI,YAAY,CAAC,WAAW,CAAC,QAAQ,KAAKA,+BAAsB,CAAC,QAAQ,EAAE;AACzE,YAAA,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC;YACzC;QACF;QAEA,IAAI,YAAY,CAAC,WAAW,CAAC,QAAQ,KAAKA,+BAAsB,CAAC,IAAI,EAAE;AACrE,YAAA,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC;YACrC;QACF;QAEA,IAAI,aAAa,EAAE;AACjB,YAAA,qBAAqB,CAAC,IAAI,CAAC,YAAY,CAAC;YACxC;QACF;QAEA,IAAI,oBAAoB,EAAE;YACxB,8BAA8B,GAAG,EAAE,YAAY,EAAE,eAAe,EAAE,EAAE,EAAE;YACtE;QACF;AAEA,QAAA,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;IACxC;IAEA,IAAI,8BAA8B,IAAI,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE;AACtE,QAAA,8BAA8B,CAAC,eAAe,GAAG,qBAAqB;IACxE;IAEA,IAAI,8BAA8B,EAAE;AAClC,QAAA,oBAAoB,CAAC,IAAI,CAAC,8BAA8B,CAAC;IAC3D;IAEA,OAAO;QACL,mBAAmB;QACnB,sBAAsB;QACtB,kBAAkB;QAClB,oBAAoB;QACpB,mBAAmB;KACpB;AACH;;;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('reflect-metadata');
4
- var main_cjs = require('./index-C3j3m34a.js');
4
+ var main_cjs = require('./index-CXI4VF1H.js');
5
5
  require('pluralize');
6
6
  require('drizzle-orm');
7
7
  require('immer');
@@ -15,6 +15,7 @@ require('rxjs');
15
15
  require('lodash-es');
16
16
  require('drizzle-orm/casing');
17
17
  require('eventemitter3');
18
+ require('arweave');
18
19
  require('@sinclair/typebox');
19
20
  require('fs/promises');
20
21
  require('fs');
@@ -23,7 +24,6 @@ require('@libsql/client');
23
24
  require('drizzle-orm/libsql');
24
25
  require('drizzle-kit/api');
25
26
  require('js-yaml');
26
- require('arweave');
27
27
  require('ts-import');
28
28
  require('glob');
29
29
  require('rimraf');
@@ -54,4 +54,4 @@ exports.TPropertyDataType = main_cjs.TPropertyDataType;
54
54
  exports.TStorageType = main_cjs.TStorageType;
55
55
  exports.TValidationRules = main_cjs.TValidationRules;
56
56
  exports.Text = main_cjs.Text;
57
- //# sourceMappingURL=index-CbTBDqTJ.js.map
57
+ //# sourceMappingURL=index-BrmvhXsG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BrmvhXsG.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}