@seedprotocol/sdk 0.6.6 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BasePathResolver-BGxb4Qod.js → BasePathResolver-B6CKqoKw.js} +137 -4
- package/dist/BasePathResolver-B6CKqoKw.js.map +1 -0
- package/dist/{index-CJNKYI37.js → ClientManager-ChcmUL47.js} +1928 -5543
- package/dist/ClientManager-ChcmUL47.js.map +1 -0
- package/dist/{ModelProperty-Bvg9cJcd.js → ModelProperty-D79uV42p.js} +42 -36
- package/dist/ModelProperty-D79uV42p.js.map +1 -0
- package/dist/{Schema-BNJBY80k.js → Schema-a8uO-hIZ.js} +48 -47
- package/dist/Schema-a8uO-hIZ.js.map +1 -0
- package/dist/{SchemaValidationService-aqXkwXTr.js → SchemaValidationService-Y49vqast.js} +16 -12
- package/dist/SchemaValidationService-Y49vqast.js.map +1 -0
- package/dist/{backfillMetadataPropertyIds-DYkvoOMz.js → backfillMetadataPropertyIds-CBsf7LnU.js} +6 -3
- package/dist/{backfillMetadataPropertyIds-DYkvoOMz.js.map → backfillMetadataPropertyIds-CBsf7LnU.js.map} +1 -1
- package/dist/cjs/{ModelProperty-alntkSnH.js → ModelProperty-D9FGaGuE.js} +25 -20
- package/dist/cjs/ModelProperty-D9FGaGuE.js.map +1 -0
- package/dist/cjs/{Schema-ByFv6fcb.js → Schema-BiJIPLEL.js} +29 -27
- package/dist/cjs/Schema-BiJIPLEL.js.map +1 -0
- package/dist/cjs/{SchemaValidationService-D55MWsxv.js → SchemaValidationService-DtYs_CNY.js} +9 -6
- package/dist/cjs/SchemaValidationService-DtYs_CNY.js.map +1 -0
- package/dist/cjs/{backfillMetadataPropertyIds-DrrL5RqD.js → backfillMetadataPropertyIds-2XaN3b9S.js} +7 -5
- package/dist/cjs/{backfillMetadataPropertyIds-DrrL5RqD.js.map → backfillMetadataPropertyIds-2XaN3b9S.js.map} +1 -1
- package/dist/cjs/{eas-D2E3_i_c.js → eas-CMNppmGE.js} +32 -6
- package/dist/cjs/eas-CMNppmGE.js.map +1 -0
- package/dist/cjs/{getItem-B2zLVB_l.js → getItem-B6jEINjW.js} +6 -4
- package/dist/cjs/{getItem-B2zLVB_l.js.map → getItem-B6jEINjW.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-Bv94k4ak.js → getPublishPayload-D5DhLGvN.js} +66 -60
- package/dist/cjs/getPublishPayload-D5DhLGvN.js.map +1 -0
- package/dist/cjs/{getPublishUploads-CSbHUxYk.js → getPublishUploads-DMhCCKYF.js} +21 -13
- package/dist/cjs/getPublishUploads-DMhCCKYF.js.map +1 -0
- package/dist/cjs/{getSegmentedItemProperties-CMhXKQHz.js → getSegmentedItemProperties-CU8rtBAo.js} +3 -51
- package/dist/cjs/getSegmentedItemProperties-CU8rtBAo.js.map +1 -0
- package/dist/cjs/{index-D-9WglxG.js → index-CSNtEnbF.js} +5986 -5389
- package/dist/cjs/index-CSNtEnbF.js.map +1 -0
- package/dist/cjs/{index-pSLjO-ch.js → index-DPp9rdRL.js} +10 -6
- package/dist/cjs/index-DPp9rdRL.js.map +1 -0
- package/dist/cjs/{property-gUK2PijH.js → property-DlKiAWt4.js} +11 -7
- package/dist/cjs/{property-gUK2PijH.js.map → property-DlKiAWt4.js.map} +1 -1
- package/dist/cjs/{syncDbWithEas-CYtl7VTD.js → syncDbWithEas-C6n34o_Q.js} +14 -8
- package/dist/cjs/syncDbWithEas-C6n34o_Q.js.map +1 -0
- package/dist/{configurePlatform-bGvKBBQy.js → configurePlatform-CE0Vew17.js} +6 -3
- package/dist/{configurePlatform-bGvKBBQy.js.map → configurePlatform-CE0Vew17.js.map} +1 -1
- package/dist/db/drizzle/0014_add_error_code_to_publish_processes.sql +1 -0
- package/dist/db/drizzle/meta/0014_snapshot.json +1269 -0
- package/dist/db/drizzle/meta/_journal.json +7 -0
- package/dist/{db-YiH_kIpE.js → db-WbrzEf7c.js} +266 -53
- package/dist/db-WbrzEf7c.js.map +1 -0
- package/dist/{eas-1nUCcmeh.js → eas-CfYCu4IX.js} +9 -6
- package/dist/eas-CfYCu4IX.js.map +1 -0
- package/dist/generateId-BopUwD8F.js +9 -0
- package/dist/generateId-BopUwD8F.js.map +1 -0
- package/dist/{getItem-Bb8bTYzY.js → getItem-Br-bGNFO.js} +12 -10
- package/dist/{getItem-Bb8bTYzY.js.map → getItem-Br-bGNFO.js.map} +1 -1
- package/dist/{getPublishPayload-BHw8mPSb.js → getPublishPayload-BIrTVUxb.js} +72 -65
- package/dist/getPublishPayload-BIrTVUxb.js.map +1 -0
- package/dist/{getPublishUploads-BYhckxFl.js → getPublishUploads-C6cDeZdz.js} +22 -13
- package/dist/getPublishUploads-C6cDeZdz.js.map +1 -0
- package/dist/{getSegmentedItemProperties-B73nMPBv.js → getSegmentedItemProperties-BmKE71vU.js} +5 -5
- package/dist/{getSegmentedItemProperties-B73nMPBv.js.map → getSegmentedItemProperties-BmKE71vU.js.map} +1 -1
- package/dist/index-280bL-n4.js +1122 -0
- package/dist/index-280bL-n4.js.map +1 -0
- package/dist/{index-DzgMt8ba.js → index-ClSv5pTA.js} +17 -14
- package/dist/index-ClSv5pTA.js.map +1 -0
- package/dist/{index-C_5xwOPQ.js → index-Djd3667v.js} +2 -2
- package/dist/index-Djd3667v.js.map +1 -0
- package/dist/index-HRHkbVQd.js +3492 -0
- package/dist/index-HRHkbVQd.js.map +1 -0
- package/dist/{index.node-ZLiBj9Cu.js → index.node-DBtQkEfz.js} +8 -7
- package/dist/index.node-DBtQkEfz.js.map +1 -0
- package/dist/main.cjs +10 -4
- package/dist/main.cjs.map +1 -1
- package/dist/main.js +43 -43
- package/dist/main.js.map +1 -1
- package/dist/model-DGMe-TTm.js +25 -0
- package/dist/model-DGMe-TTm.js.map +1 -0
- package/dist/node.js +21 -17
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +162 -63
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.node.js +5 -5
- package/dist/{property-Dcb50seV.js → property-CQjuZ4JW.js} +20 -17
- package/dist/property-CQjuZ4JW.js.map +1 -0
- package/dist/seedSchema/PublishProcessSchema.ts +1 -0
- package/dist/src/Item/Item.d.ts +6 -0
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/Item/service/actors/loadOrCreateItem.d.ts.map +1 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts +10 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
- package/dist/src/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/writeModelsToDb.d.ts.map +1 -1
- package/dist/src/Schema/service/addModelsMachine.d.ts.map +1 -1
- package/dist/src/Schema/service/validation/SchemaValidationService.d.ts.map +1 -1
- package/dist/src/browser/db/Db.d.ts.map +1 -1
- package/dist/src/browser/db/drizzleFiles.d.ts +3 -2
- package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
- package/dist/src/browser/db/embeddedMigrations.d.ts +17 -0
- package/dist/src/browser/db/embeddedMigrations.d.ts.map +1 -0
- package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
- package/dist/src/browser/helpers/EasClient.d.ts +2 -1
- package/dist/src/browser/helpers/EasClient.d.ts.map +1 -1
- package/dist/src/browser/helpers/FileManager.d.ts +1 -1
- package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/browser/workers/FileDownloader.d.ts +1 -1
- package/dist/src/browser/workers/FileDownloader.d.ts.map +1 -1
- package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
- package/dist/src/client/ClientManager.d.ts +18 -3
- package/dist/src/client/ClientManager.d.ts.map +1 -1
- package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
- package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
- package/dist/src/client/clientManagerMachine.d.ts +6 -1
- package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
- package/dist/src/client/constants.d.ts +4 -0
- package/dist/src/client/constants.d.ts.map +1 -1
- package/dist/src/client/nodeEndpointDefaults.d.ts +8 -0
- package/dist/src/client/nodeEndpointDefaults.d.ts.map +1 -0
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/src/db/read/getRelatedItemsForPublish.d.ts.map +1 -1
- package/dist/src/db/write/createMetadata.d.ts.map +1 -1
- package/dist/src/eas.d.ts +2 -2
- package/dist/src/eas.d.ts.map +1 -1
- package/dist/src/events/files/download.d.ts.map +1 -1
- package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/src/helpers/ArweaveClient/index.d.ts.map +1 -1
- package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts +1 -1
- package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts +2 -2
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/IFileManager.d.ts +4 -0
- package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
- package/dist/src/helpers/constants.d.ts +9 -2
- package/dist/src/helpers/constants.d.ts.map +1 -1
- package/dist/src/helpers/crypto.d.ts +3 -2
- package/dist/src/helpers/crypto.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts +6 -0
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/ensureImageLocal.d.ts +24 -0
- package/dist/src/helpers/ensureImageLocal.d.ts.map +1 -0
- package/dist/src/helpers/ethereumUtils.d.ts.map +1 -1
- package/dist/src/helpers/gateway/gatewayState.d.ts +1 -1
- package/dist/src/helpers/gateway/gatewayState.d.ts.map +1 -1
- package/dist/src/helpers/index.d.ts +10 -2
- package/dist/src/helpers/index.d.ts.map +1 -1
- package/dist/src/helpers/localDbChain.d.ts +22 -0
- package/dist/src/helpers/localDbChain.d.ts.map +1 -0
- package/dist/src/helpers/metadataPropertyNames.d.ts +9 -0
- package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
- package/dist/src/helpers/property/index.d.ts +12 -0
- package/dist/src/helpers/property/index.d.ts.map +1 -1
- package/dist/src/helpers/readHtmlBodyForStorageSeed.d.ts.map +1 -1
- package/dist/src/helpers/relationSeedRef.d.ts +8 -0
- package/dist/src/helpers/relationSeedRef.d.ts.map +1 -1
- package/dist/src/imports/json.d.ts.map +1 -1
- package/dist/src/index.d.ts +11 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/node/easLodashHook.d.ts +2 -0
- package/dist/src/node/easLodashHook.d.ts.map +1 -0
- package/dist/src/node/easLodashRegister.d.ts +2 -0
- package/dist/src/node/easLodashRegister.d.ts.map +1 -0
- package/dist/src/node/helpers/FileManager.d.ts +2 -1
- package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/node/index.d.ts +2 -1
- package/dist/src/node/index.d.ts.map +1 -1
- package/dist/src/seedSchema/PublishProcessSchema.d.ts +19 -0
- package/dist/src/seedSchema/PublishProcessSchema.d.ts.map +1 -1
- package/dist/src/types/fileManager.d.ts +4 -0
- package/dist/src/types/fileManager.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +15 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/{syncDbWithEas-B0RUeDuj.js → syncDbWithEas-CuARXfyN.js} +24 -18
- package/dist/syncDbWithEas-CuARXfyN.js.map +1 -0
- package/dist/{updateSeedRevokedAt-D5ZbBehZ.js → updateSeedRevokedAt-CBcLfHWs.js} +2 -2
- package/dist/{updateSeedRevokedAt-D5ZbBehZ.js.map → updateSeedRevokedAt-CBcLfHWs.js.map} +1 -1
- package/package.json +12 -8
- package/src/node/easLodashHook.js +22 -0
- package/src/node/easLodashRegister.js +13 -0
- package/dist/BasePathResolver-BGxb4Qod.js.map +0 -1
- package/dist/ModelProperty-Bvg9cJcd.js.map +0 -1
- package/dist/Schema-BNJBY80k.js.map +0 -1
- package/dist/SchemaValidationService-aqXkwXTr.js.map +0 -1
- package/dist/cjs/ModelProperty-alntkSnH.js.map +0 -1
- package/dist/cjs/Schema-ByFv6fcb.js.map +0 -1
- package/dist/cjs/SchemaValidationService-D55MWsxv.js.map +0 -1
- package/dist/cjs/eas-D2E3_i_c.js.map +0 -1
- package/dist/cjs/getPublishPayload-Bv94k4ak.js.map +0 -1
- package/dist/cjs/getPublishUploads-CSbHUxYk.js.map +0 -1
- package/dist/cjs/getSegmentedItemProperties-CMhXKQHz.js.map +0 -1
- package/dist/cjs/index-D-9WglxG.js.map +0 -1
- package/dist/cjs/index-pSLjO-ch.js.map +0 -1
- package/dist/cjs/syncDbWithEas-CYtl7VTD.js.map +0 -1
- package/dist/constants-Bre6dTJR.js +0 -122
- package/dist/constants-Bre6dTJR.js.map +0 -1
- package/dist/constants-CTs2RUrM.js +0 -657
- package/dist/constants-CTs2RUrM.js.map +0 -1
- package/dist/db-YiH_kIpE.js.map +0 -1
- package/dist/eas-1nUCcmeh.js.map +0 -1
- package/dist/getPublishPayload-BHw8mPSb.js.map +0 -1
- package/dist/getPublishUploads-BYhckxFl.js.map +0 -1
- package/dist/index-CJNKYI37.js.map +0 -1
- package/dist/index-C_5xwOPQ.js.map +0 -1
- package/dist/index-DzgMt8ba.js.map +0 -1
- package/dist/index.node-ZLiBj9Cu.js.map +0 -1
- package/dist/property-Dcb50seV.js.map +0 -1
- package/dist/seedSchema/AppStateSchema.d.ts +0 -82
- package/dist/seedSchema/AppStateSchema.d.ts.map +0 -1
- package/dist/seedSchema/ConfigSchema.d.ts +0 -101
- package/dist/seedSchema/ConfigSchema.d.ts.map +0 -1
- package/dist/seedSchema/MetadataSchema.d.ts +0 -422
- package/dist/seedSchema/MetadataSchema.d.ts.map +0 -1
- package/dist/seedSchema/ModelSchema.d.ts +0 -243
- package/dist/seedSchema/ModelSchema.d.ts.map +0 -1
- package/dist/seedSchema/ModelSchemaSchema.d.ts +0 -61
- package/dist/seedSchema/ModelSchemaSchema.d.ts.map +0 -1
- package/dist/seedSchema/ModelUidSchema.d.ts +0 -64
- package/dist/seedSchema/ModelUidSchema.d.ts.map +0 -1
- package/dist/seedSchema/PropertyUidSchema.d.ts +0 -64
- package/dist/seedSchema/PropertyUidSchema.d.ts.map +0 -1
- package/dist/seedSchema/SchemaSchema.d.ts +0 -169
- package/dist/seedSchema/SchemaSchema.d.ts.map +0 -1
- package/dist/seedSchema/SeedSchema.d.ts +0 -192
- package/dist/seedSchema/SeedSchema.d.ts.map +0 -1
- package/dist/seedSchema/VersionSchema.d.ts +0 -194
- package/dist/seedSchema/VersionSchema.d.ts.map +0 -1
- package/dist/seedSchema/index.d.ts +0 -14
- package/dist/seedSchema/index.d.ts.map +0 -1
- package/dist/syncDbWithEas-B0RUeDuj.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelProperty-D9FGaGuE.js","sources":["../../../src/ModelProperty/service/actors/saveToSchema.ts","../../../src/ModelProperty/service/actors/compareAndMarkDraft.ts","../../../src/ModelProperty/service/actors/validateProperty.ts","../../../src/ModelProperty/service/modelPropertyMachine.ts","../../../src/db/read/getModelPropertiesData.ts","../../../src/ModelProperty/ModelProperty.ts"],"sourcesContent":["import { EventObject, fromCallback } from 'xstate'\nimport { FromCallbackInput } from '@/types'\nimport { ModelPropertyMachineContext } from '../modelPropertyMachine'\nimport debug from 'debug'\nconst logger = debug('seedSdk:modelProperty:actors:saveToSchema')\n\n/**\n * Get schema name from model\n * This function finds which schema contains the given model\n * Exported so it can be reused by ModelProperty for setting schema name\n */\nexport async function getSchemaNameFromModel(modelName: string): Promise<string | undefined> {\n // Get the latest schema files and find which one contains this model\n const schemaHelpersMod = await import('../../../helpers/schema')\n const { listLatestSchemaFiles } = schemaHelpersMod\n const latestSchemas = await listLatestSchemaFiles()\n\n for (const schema of latestSchemas) {\n try {\n const fileManagerMod = await import('../../../helpers/FileManager/BaseFileManager')\n const { BaseFileManager } = fileManagerMod\n const content = await BaseFileManager.readFileAsString(schema.filePath)\n const schemaFile = JSON.parse(content) as any\n\n if (schemaFile.models && schemaFile.models[modelName]) {\n return schema.name\n }\n } catch (error) {\n logger('Error reading schema file:', error)\n continue\n }\n }\n\n return undefined\n}\n\nexport const saveToSchema = fromCallback<\n EventObject,\n FromCallbackInput<ModelPropertyMachineContext>\n>(({ sendBack, input: { context } }) => {\n const _saveToSchema = async (): Promise<void> => {\n // Use dynamic import to break circular dependency\n const validationServiceMod = await import('../../../Schema/service/validation/SchemaValidationService')\n const { SchemaValidationService } = validationServiceMod\n const validationService = new SchemaValidationService()\n \n // Validate property structure before saving\n const validationResult = validationService.validatePropertyStructure(context)\n if (!validationResult.isValid) {\n throw new Error(`Property validation failed: ${validationResult.errors.map(e => e.message).join(', ')}`)\n }\n\n // Validate required fields\n if (!context.name) {\n throw new Error('Property name is required')\n }\n\n if (!context.dataType) {\n throw new Error('Data type is required')\n }\n\n if (!context.modelName) {\n throw new Error(`Model not found for modelId: ${context.modelId}`)\n }\n\n // Persist to database only - schema file is updated only when user calls Schema.saveNewVersion()\n const dbMod = await import('../../../helpers/db')\n const { savePropertyToDb } = dbMod\n await savePropertyToDb(context)\n\n // Mark schema as draft so user knows to save\n const schemaName = context._schemaName ?? (await getSchemaNameFromModel(context.modelName))\n if (schemaName) {\n const schemaMod = await import('../../../Schema/Schema')\n const { Schema } = schemaMod\n const schema = Schema.create(schemaName, { waitForReady: false }) as import('@/Schema/Schema').Schema\n schema.getService().send({\n type: 'markAsDraft',\n propertyKey: `${context.modelName}:${context.name}`,\n })\n }\n\n logger(`Successfully saved property ${context.modelName}:${context.name} to database`)\n }\n\n _saveToSchema().then(() => {\n sendBack({ type: 'saveToSchemaSuccess' })\n }).catch((error) => {\n logger('Error saving to schema:', error)\n sendBack({ type: 'saveToSchemaError', error })\n })\n\n return () => {\n // Cleanup function (optional)\n }\n})\n","import { EventObject, fromCallback } from 'xstate'\nimport { FromCallbackInput } from '@/types'\nimport { ModelPropertyMachineContext } from '../modelPropertyMachine'\n// Dynamic import to break circular dependency: helpers/db -> ModelProperty -> compareAndMarkDraft -> helpers/db\n// import { savePropertyToDb } from '@/helpers/db'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:modelProperty:actors:compareAndMarkDraft')\n\nexport const compareAndMarkDraft = fromCallback<\n EventObject,\n FromCallbackInput<ModelPropertyMachineContext>\n>(({ sendBack, input: { context } }) => {\n const _compareAndMarkDraft = async (): Promise<void> => {\n // Fill modelName/dataType from _originalValues when missing, then from DB by schemaFileId\n let fullContext = {\n ...context,\n modelName: context.modelName ?? (context._originalValues as any)?.modelName,\n dataType: context.dataType ?? (context._originalValues as any)?.dataType,\n }\n const schemaFileIdForResolve = fullContext._propertyFileId || (typeof fullContext.id === 'string' ? fullContext.id : undefined)\n if (schemaFileIdForResolve && (fullContext.modelName === undefined || fullContext.dataType === undefined)) {\n try {\n const dbMod = await import('../../../helpers/db')\n const { getPropertyModelNameAndDataType, getModelNameByModelId } = dbMod\n let fromDb: { modelName: string; dataType: string } | undefined\n for (let attempt = 0; attempt < 6; attempt++) {\n fromDb = await getPropertyModelNameAndDataType(schemaFileIdForResolve)\n if (fromDb) break\n if (attempt < 5) await new Promise((r) => setTimeout(r, 40))\n }\n if (fromDb) {\n fullContext = {\n ...fullContext,\n modelName: fullContext.modelName ?? fromDb.modelName,\n dataType: fullContext.dataType ?? fromDb.dataType,\n }\n }\n if (fullContext.modelName === undefined && schemaFileIdForResolve) {\n const mod = await import('../../../ModelProperty/ModelProperty')\n const ModelProperty = mod?.ModelProperty ?? (mod as { default?: unknown })?.default\n const pendingModelId = ModelProperty?.getPendingModelId?.(schemaFileIdForResolve)\n if (pendingModelId != null) {\n const modelName = await getModelNameByModelId(pendingModelId)\n if (modelName) {\n fullContext = { ...fullContext, modelName }\n }\n }\n }\n } catch {\n // ignore\n }\n }\n const schemaFileId = fullContext._propertyFileId || (typeof fullContext.id === 'string' ? fullContext.id : undefined)\n // If _originalValues is not set, we still need to save to database if the property exists\n // This handles the case where the name is changed before _originalValues is initialized\n if (!fullContext._originalValues) {\n logger('No original values to compare against')\n logger(`[compareAndMarkDraft] Context: modelName=${fullContext.modelName}, name=${fullContext.name}, id=${fullContext.id}, _propertyFileId=${fullContext._propertyFileId}`)\n\n // If we have a name and modelName, try to save to database anyway\n // This ensures name changes are persisted even if _originalValues isn't initialized yet\n // We need either schemaFileId (id or _propertyFileId) to find the property in the database\n if (fullContext.modelName && fullContext.name && schemaFileId) {\n logger(`[compareAndMarkDraft] _originalValues not set, but saving to database anyway for property ${context.modelName}:${context.name} (schemaFileId: ${schemaFileId})`)\n try {\n const dbMod = await import('../../../helpers/db')\n const { savePropertyToDb } = dbMod\n // Ensure _propertyFileId is set for savePropertyToDb to find the property\n const contextWithFileId = {\n ...fullContext,\n _propertyFileId: schemaFileId,\n }\n await savePropertyToDb(contextWithFileId)\n logger(`[compareAndMarkDraft] Successfully saved property ${fullContext.modelName}:${fullContext.name} to database (no _originalValues)`)\n } catch (error) {\n logger(`[compareAndMarkDraft] Error saving property to database (no _originalValues): ${error}`)\n // Don't throw - this is a best-effort save, but log the error for debugging\n console.error(`[compareAndMarkDraft] Failed to save property ${fullContext.modelName}:${fullContext.name}:`, error)\n }\n } else {\n logger(`[compareAndMarkDraft] Cannot save property ${fullContext.modelName}:${fullContext.name} - missing required fields (schemaFileId: ${schemaFileId})`)\n }\n return\n }\n\n logger(`[compareAndMarkDraft] Comparing: context.name=${fullContext.name}, _originalValues.name=${fullContext._originalValues?.name}`)\n\n // Compare current values with original\n // Only compare property fields, not internal fields\n const propertyFields = ['name', 'dataType', 'ref', 'refModelName', 'refModelId', 'refValueType', 'storageType', 'localStorageDir', 'filenameSuffix', 'modelName', 'modelId', 'required']\n const hasChanges = propertyFields.some(key => {\n const currentValue = (fullContext as any)[key]\n const originalValue = (fullContext._originalValues as any)?.[key]\n \n // Handle name changes specifically\n if (key === 'name') {\n const nameChanged = currentValue !== originalValue\n if (nameChanged) {\n logger(`[compareAndMarkDraft] Name change detected: \"${originalValue}\" -> \"${currentValue}\"`)\n }\n return nameChanged\n }\n \n // Handle ref fields - compare by name\n if (key === 'ref' || key === 'refModelName') {\n const currentRef = fullContext.refModelName || fullContext.ref\n const originalRef = fullContext._originalValues?.refModelName || fullContext._originalValues?.ref\n // Both undefined/null means no ref, so they're the same\n if (!currentRef && !originalRef) return false\n return currentRef !== originalRef\n }\n \n // For other fields, compare values (handling undefined/null)\n if (currentValue === undefined && originalValue === undefined) return false\n if (currentValue === null && originalValue === null) return false\n if (currentValue === undefined && originalValue === null) return false\n if (currentValue === null && originalValue === undefined) return false\n \n return currentValue !== originalValue\n })\n\n if (hasChanges) {\n logger(`Property ${fullContext.modelName}:${fullContext.name} has changes, marking as edited`)\n logger(`[compareAndMarkDraft] Context when saving: id=${fullContext.id}, _propertyFileId=${fullContext._propertyFileId}, name=${fullContext.name}, _originalValues.name=${fullContext._originalValues?.name}`)\n\n // Use dynamic import to break circular dependency\n const dbMod = await import('../../../helpers/db')\n const { savePropertyToDb } = dbMod\n // Save to database (but not JSON file) - always save to DB when there are changes\n try {\n await savePropertyToDb(fullContext)\n logger(`[compareAndMarkDraft] Successfully saved property ${fullContext.modelName}:${fullContext.name} to database`)\n } catch (error) {\n logger(`[compareAndMarkDraft] Error saving property to database: ${error}`)\n throw error\n }\n\n // Mark schema as draft if schema name is available\n if (fullContext._schemaName) {\n // Get the Schema instance and mark it as draft\n const schemaMod = await import('../../../Schema/Schema')\n const { Schema } = schemaMod\n const schema = Schema.create(fullContext._schemaName, {\n waitForReady: false,\n }) as import('@/Schema/Schema').Schema\n\n // Send event to Schema machine to mark as draft\n schema.getService().send({\n type: 'markAsDraft',\n propertyKey: `${fullContext.modelName}:${fullContext.name}`,\n })\n }\n } else {\n // No changes - clear edited flag in database and context\n logger(`Property ${fullContext.modelName}:${fullContext.name} has no changes`)\n \n // Clear isEdited flag in database\n try {\n const seedSchemaMod = await import('../../../seedSchema')\n const { properties: propertiesTable, models: modelsTable } = seedSchemaMod\n const drizzleMod = await import('drizzle-orm')\n const { eq, and } = drizzleMod\n \n const db = BaseDb.getAppDb()\n if (db && fullContext.modelName && fullContext.name) {\n // Find model by name\n const modelRecords = await db\n .select({ id: modelsTable.id })\n .from(modelsTable)\n .where(eq(modelsTable.name, fullContext.modelName))\n .limit(1)\n \n if (modelRecords.length > 0) {\n // Find property by name and modelId\n const propertyRecords = await db\n .select({ id: propertiesTable.id })\n .from(propertiesTable)\n .where(\n and(\n eq(propertiesTable.name, fullContext.name),\n eq(propertiesTable.modelId, modelRecords[0].id)\n )\n )\n .limit(1)\n \n if (propertyRecords.length > 0) {\n // Clear isEdited flag in database\n await db\n .update(propertiesTable)\n .set({ isEdited: false })\n .where(eq(propertiesTable.id, propertyRecords[0].id!))\n logger(`Cleared isEdited flag in database for property ${fullContext.modelName}:${fullContext.name}`)\n }\n }\n }\n } catch (error) {\n logger(`Error clearing isEdited flag in database: ${error}`)\n }\n \n sendBack({\n type: 'clearEdited',\n })\n }\n }\n\n _compareAndMarkDraft().then(() => {\n sendBack({ type: 'compareAndMarkDraftSuccess' })\n }).catch((error) => {\n logger('Error comparing and marking draft:', error)\n sendBack({ type: 'compareAndMarkDraftError', error })\n })\n\n return () => {\n // Cleanup function (optional)\n }\n})\n","import { EventObject, fromCallback } from 'xstate'\nimport { FromCallbackInput } from '@/types'\nimport { ModelPropertyMachineContext } from '../modelPropertyMachine'\n// Dynamic imports to break circular dependencies:\n// - schema/index -> ... -> validateProperty -> SchemaValidationService -> schema/index\n// - schema/Schema -> ... -> validateProperty -> Schema -> schema/Schema\n// import { SchemaValidationService } from '@/Schema/service/validation/SchemaValidationService'\n// import { Schema } from '@/Schema/Schema'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:modelProperty:actors:validateProperty')\n\nexport const validateProperty = fromCallback<\n EventObject,\n FromCallbackInput<ModelPropertyMachineContext>\n>(({ sendBack, input: { context } }) => {\n const _validateProperty = async (): Promise<void> => {\n // Use full context for validation: fill modelName/dataType from _originalValues when missing, then\n // from DB by schemaFileId (context.id) so just-created renames don't fail structure validation.\n let fullContext = {\n ...context,\n modelName: context.modelName ?? (context._originalValues as any)?.modelName,\n dataType: context.dataType ?? (context._originalValues as any)?.dataType,\n }\n const schemaFileId = typeof context.id === 'string' ? context.id : undefined\n if (schemaFileId && (fullContext.modelName === undefined || fullContext.dataType === undefined)) {\n // Brief wait so trackPendingWrite from ModelProperty.create() has time to run (it's in setTimeout(0))\n await new Promise((r) => setTimeout(r, 60))\n try {\n const dbMod = await import('../../../helpers/db')\n const { getPropertyModelNameAndDataType, getModelNameByModelId } = dbMod\n // Try pending write first (property row may not exist yet)\n if (fullContext.modelName === undefined && schemaFileId) {\n const mod = await import('../../../ModelProperty/ModelProperty')\n const ModelProperty = mod?.ModelProperty ?? (mod as { default?: unknown })?.default\n const pendingModelId = ModelProperty?.getPendingModelId?.(schemaFileId)\n if (pendingModelId != null) {\n const modelName = await getModelNameByModelId(pendingModelId)\n if (modelName) {\n fullContext = { ...fullContext, modelName }\n }\n }\n }\n // Then DB property lookup with retry (catches row after initial write)\n let fromDb: { modelName: string; dataType: string } | undefined\n for (let attempt = 0; attempt < 6; attempt++) {\n fromDb = await getPropertyModelNameAndDataType(schemaFileId)\n if (fromDb) break\n if (attempt < 5) await new Promise((r) => setTimeout(r, 40))\n }\n if (fromDb) {\n fullContext = {\n ...fullContext,\n modelName: fullContext.modelName ?? fromDb.modelName,\n dataType: fullContext.dataType ?? fromDb.dataType,\n }\n }\n // If still no modelName, try pending write again (may have been set during retries)\n if (fullContext.modelName === undefined && schemaFileId) {\n const mod = await import('../../../ModelProperty/ModelProperty')\n const ModelProperty = mod?.ModelProperty ?? (mod as { default?: unknown })?.default\n const pendingModelId = ModelProperty?.getPendingModelId?.(schemaFileId)\n if (pendingModelId != null) {\n const modelName = await getModelNameByModelId(pendingModelId)\n if (modelName) {\n fullContext = { ...fullContext, modelName }\n }\n }\n }\n } catch {\n // ignore\n }\n }\n // Last resort for structure validation: TProperty requires dataType; allow name+id to pass if we have schemaFileId\n if (fullContext.dataType === undefined && (fullContext.modelName !== undefined || schemaFileId)) {\n fullContext = { ...fullContext, dataType: (fullContext.dataType ?? (context._originalValues as any)?.dataType) || 'Text' }\n }\n // Use dynamic imports to break circular dependencies\n const validationServiceMod = await import('../../../Schema/service/validation/SchemaValidationService')\n const { SchemaValidationService } = validationServiceMod\n const validationService = new SchemaValidationService()\n const schemaMod = await import('../../../Schema/Schema')\n const { Schema } = schemaMod\n \n // Validate property structure\n const structureResult = validationService.validatePropertyStructure(fullContext)\n \n if (!structureResult.isValid) {\n sendBack({ type: 'validationError', errors: structureResult.errors })\n return\n }\n\n // If we have schema name and model name, validate against schema\n if (fullContext._schemaName && fullContext.modelName) {\n try {\n const schema = Schema.create(fullContext._schemaName, {\n waitForReady: false,\n }) as import('@/Schema/Schema').Schema\n const schemaSnapshot = schema.getService().getSnapshot()\n const schemaStatus = schemaSnapshot.value\n \n // Only validate against schema if it's loaded (in idle state)\n // If still loading, skip schema validation and only do structure validation\n if (schemaStatus === 'idle') {\n const schemaContext = schemaSnapshot.context\n \n // Check if models are actually loaded\n if (schemaContext.models && Object.keys(schemaContext.models).length > 0) {\n // If property name has changed, validate against the original name (from schema file)\n // This handles the case where a property is renamed - the schema file still has the old name\n const propertyNameToValidate = fullContext._originalValues?.name && fullContext._originalValues.name !== fullContext.name\n ? fullContext._originalValues.name\n : fullContext.name || ''\n \n const schemaResult = validationService.validateProperty(\n schemaContext,\n fullContext.modelName,\n propertyNameToValidate,\n fullContext\n )\n \n if (!schemaResult.isValid) {\n // If property was renamed, some validation errors are expected (like property_not_found, missing_type)\n // Only fail if it's a critical error that's not related to the rename\n const isRenamed = fullContext._originalValues?.name && fullContext._originalValues.name !== fullContext.name\n const criticalErrors = schemaResult.errors.filter(err => {\n // Allow property_not_found and missing_type errors when property is renamed\n if (isRenamed && (err.code === 'property_not_found' || err.code === 'missing_type')) {\n return false // Not critical\n }\n // For non-renamed properties, only allow property_not_found if we're validating with the same name\n if (err.code === 'property_not_found' && propertyNameToValidate === fullContext.name) {\n return false // Not critical\n }\n return true // Critical error\n })\n \n if (criticalErrors.length > 0) {\n sendBack({ type: 'validationError', errors: criticalErrors })\n return\n }\n // Continue with validation - rename-related errors are acceptable\n }\n } else {\n logger('Schema models not loaded yet, skipping schema validation')\n // Continue with structure validation only\n }\n } else {\n logger(`Schema is in ${schemaStatus} state, skipping schema validation`)\n // Continue with structure validation only\n }\n } catch (error) {\n logger('Error validating property against schema:', error)\n // Continue with structure validation only\n }\n }\n\n // All validations passed\n sendBack({ type: 'validationSuccess', errors: [] })\n }\n\n _validateProperty().catch((error) => {\n logger('Error in validateProperty:', error)\n sendBack({\n type: 'validationError',\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 return () => {\n // Cleanup function (optional)\n }\n})\n\n","import { assign, setup, ActorRefFrom } from 'xstate'\nimport { Static } from '@sinclair/typebox'\nimport { TProperty } from '@/Schema'\nimport { saveToSchema } from './actors/saveToSchema'\nimport { compareAndMarkDraft } from './actors/compareAndMarkDraft'\nimport { validateProperty } from './actors/validateProperty'\nimport { ValidationError } from '@/Schema/validation'\nimport { writeProcessMachine } from '@/services/write/writeProcessMachine'\n\nexport type ModelPropertyMachineContext = Static<typeof TProperty> & {\n // Store original values from the JSON schema file\n _originalValues?: Partial<Static<typeof TProperty>>\n // Track if this property has been edited\n _isEdited?: boolean\n // Reference to the Schema instance this property belongs to\n _schemaName?: string\n // Validation errors\n _validationErrors?: ValidationError[]\n writeProcess?: ActorRefFrom<typeof writeProcessMachine> | null\n // Property file ID (schemaFileId from JSON schema file) - used for lookups\n _propertyFileId?: string\n // Note: id field (from TProperty) is now the schemaFileId (string)\n // _dbId (from TProperty) stores the database integer ID\n // Destroy lifecycle (for destroy hooks)\n _destroyInProgress?: boolean\n _destroyError?: { message: string; name?: string } | null\n}\n\nexport const modelPropertyMachine = setup({\n types: {\n context: {} as ModelPropertyMachineContext,\n input: {} as ModelPropertyMachineContext,\n events: {} as\n | { type: 'updateContext'; [key: string]: any }\n | { type: 'initializeOriginalValues'; originalValues: Partial<Static<typeof TProperty>>; schemaName?: string; isEdited?: boolean }\n | { type: 'clearEdited' }\n | { type: 'setSchemaName'; schemaName: string }\n | { type: 'saveToSchema' }\n | { type: 'saveToSchemaSuccess' }\n | { type: 'saveToSchemaError'; error: Error }\n | { type: 'compareAndMarkDraftSuccess' }\n | { type: 'compareAndMarkDraftError' }\n | { type: 'validateProperty' }\n | { type: 'validationSuccess'; errors: ValidationError[] }\n | { type: 'validationError'; errors: ValidationError[] }\n | { type: 'requestWrite'; data: any }\n | { type: 'destroyStarted' }\n | { type: 'destroyDone' }\n | { type: 'destroyError'; error: unknown }\n | { type: 'clearDestroyError' },\n },\n actors: {\n saveToSchema,\n compareAndMarkDraft,\n validateProperty,\n writeProcessMachine,\n },\n guards: {\n isPropertyValid: ({ context }) => {\n const valid = !context._validationErrors || context._validationErrors.length === 0\n return valid\n },\n hasValidationErrors: ({ context }) => {\n return !!context._validationErrors && context._validationErrors.length > 0\n },\n },\n actions: {\n assignValidationErrors: assign(({ context, event }) => {\n if (event.type === 'validationError') {\n return {\n ...context,\n _validationErrors: event.errors,\n }\n }\n return context\n }),\n },\n}).createMachine({\n id: 'modelProperty',\n initial: 'idle',\n context: ({ input }) => {\n const context = input as ModelPropertyMachineContext\n return context\n },\n on: {\n updateContext: {\n actions: assign(({ context, event }) => {\n const newContext = Object.assign({}, context) as any\n\n // Check if this is only updating internal fields\n const onlyInternalFields = Object.keys(event).every((key: string) => {\n return key === 'type' || key.startsWith('_')\n })\n \n // Update the context with new values\n for (let i = 0; i < Object.keys(event).length; i++) {\n const key = Object.keys(event)[i] as string\n if (key === 'type') {\n continue\n }\n let value = (event as any)[key]\n // Convert null to undefined for optional fields (TypeBox validation expects undefined, not null)\n // This is especially important for refValueType, refModelId, etc.\n if (value === null && (key === 'refValueType' || key === 'refModelId' || key === 'ref' || key === 'refModelName')) {\n value = undefined\n }\n newContext[key] = value\n }\n\n // Preserve modelName and dataType from context or _originalValues so validation and savePropertyToDb\n // never run with missing required/needed fields (e.g. when a just-created property is renamed before\n // the full context is available from the creator).\n if (newContext.modelName === undefined && (context._originalValues as any)?.modelName !== undefined) {\n newContext.modelName = (context._originalValues as any).modelName\n }\n if (newContext.dataType === undefined && (context._originalValues as any)?.dataType !== undefined) {\n newContext.dataType = (context._originalValues as any).dataType\n }\n\n // Compare with original values and set _isEdited flag (only for non-internal updates)\n if (!onlyInternalFields && context._originalValues) {\n const hasChanges = Object.keys(event).some((key: string) => {\n if (key === 'type' || key.startsWith('_')) return false\n return newContext[key] !== (context._originalValues as any)?.[key]\n })\n newContext._isEdited = hasChanges\n }\n\n // Clear validation errors on context update (will be re-validated if needed)\n newContext._validationErrors = undefined\n\n // Convert null to undefined for optional fields (TypeBox validation expects undefined, not null)\n // This is especially important for refValueType, refModelId, etc.\n const optionalFields = ['refValueType', 'refModelId', 'ref', 'refModelName']\n for (const field of optionalFields) {\n if (newContext[field] === null) {\n newContext[field] = undefined\n }\n }\n\n return newContext\n }),\n // Only trigger validation and compareAndMarkDraft if we're updating non-internal fields\n guard: ({ event }: { event: any }) => {\n const shouldTransition = !Object.keys(event).every((key: string) => {\n return key === 'type' || key.startsWith('_')\n })\n return shouldTransition\n },\n target: '.validating',\n },\n validateProperty: {\n target: '.validating',\n },\n validationSuccess: {\n actions: assign(({ context, event }) => ({\n ...context,\n _validationErrors: [],\n })),\n },\n validationError: {\n actions: 'assignValidationErrors',\n // Note: State-specific transitions are handled in child states\n // This root handler ensures errors are always assigned to context\n },\n initializeOriginalValues: {\n actions: assign(({ context, event }) => ({\n ...context,\n _originalValues: event.originalValues,\n _schemaName: event.schemaName,\n _isEdited: event.isEdited ?? false,\n _validationErrors: undefined,\n })),\n },\n clearEdited: {\n actions: assign(({ context }) => ({\n ...context,\n _isEdited: false,\n _originalValues: { ...context } as Partial<Static<typeof TProperty>>,\n })),\n },\n setSchemaName: {\n actions: assign(({ context, event }) => ({\n ...context,\n _schemaName: event.schemaName,\n })),\n },\n destroyStarted: {\n actions: assign({ _destroyInProgress: true, _destroyError: null }),\n },\n destroyDone: {\n actions: assign({ _destroyInProgress: false }),\n },\n destroyError: {\n actions: assign(({ event }) => ({\n _destroyInProgress: false,\n _destroyError:\n event.error instanceof Error\n ? { message: event.error.message, name: event.error.name }\n : { message: String(event.error) },\n })),\n },\n clearDestroyError: {\n actions: assign({ _destroyError: null }),\n },\n },\n states: {\n idle: {\n on: {\n saveToSchema: { target: 'saveToSchema' },\n validateProperty: {\n target: 'validating',\n },\n requestWrite: {\n actions: ({ context, event }) => {\n if (context.writeProcess) {\n context.writeProcess.send({\n type: 'startWrite',\n data: event.data,\n })\n }\n },\n },\n },\n entry: assign({\n writeProcess: ({ spawn, context }) => {\n // Spawn writeProcess if we have id (schemaFileId)\n // New properties will have id generated\n const entityId = context.id\n if (!context.writeProcess && entityId) {\n return spawn(writeProcessMachine, {\n input: {\n entityType: 'modelProperty',\n entityId: String(entityId),\n entityData: context,\n },\n })\n }\n return context.writeProcess\n },\n }),\n },\n validating: {\n on: {\n saveToSchema: { target: 'saveToSchema' },\n validationSuccess: {\n target: 'compareAndMarkDraft',\n actions: assign(({ context }) => ({\n ...context,\n _validationErrors: [],\n })),\n },\n // validationError: Uses root handler for assignment, but needs state-specific transition\n validationError: {\n target: 'idle',\n actions: 'assignValidationErrors',\n },\n },\n invoke: {\n src: 'validateProperty',\n input: ({ context }) => ({ context }),\n },\n },\n compareAndMarkDraft: {\n on: {\n saveToSchema: { target: 'saveToSchema' },\n compareAndMarkDraftSuccess: {\n target: 'idle',\n },\n compareAndMarkDraftError: {\n target: 'idle',\n },\n },\n invoke: {\n src: 'compareAndMarkDraft',\n input: ({ context }) => ({ context }),\n },\n },\n saveToSchema: {\n always: {\n guard: 'isPropertyValid',\n target: '.saving',\n },\n initial: 'saving',\n on: {\n // Apply updateContext but do not re-invoke saveToSchema actor (avoids infinite loop).\n // Context is updated; in-flight save completes with original context.\n updateContext: [\n {\n guard: ({ context, event }) => {\n const onlyInternal = Object.keys(event).every((k: string) => k === 'type' || k.startsWith('_'))\n return !onlyInternal && event.name !== undefined && event.name !== context.name\n },\n actions: assign(({ context, event }) => {\n const newContext = Object.assign({}, context) as any\n const onlyInternalFields = Object.keys(event).every((key: string) => key === 'type' || key.startsWith('_'))\n for (const key of Object.keys(event) as string[]) {\n if (key === 'type') continue\n let value = (event as any)[key]\n if (value === null && ['refValueType', 'refModelId', 'ref', 'refModelName'].includes(key)) value = undefined\n newContext[key] = value\n }\n if (newContext.modelName === undefined && (context._originalValues as any)?.modelName !== undefined) {\n newContext.modelName = (context._originalValues as any).modelName\n }\n if (newContext.dataType === undefined && (context._originalValues as any)?.dataType !== undefined) {\n newContext.dataType = (context._originalValues as any).dataType\n }\n if (!onlyInternalFields && context._originalValues) {\n const hasChanges = Object.keys(event).some((key: string) => {\n if (key === 'type' || key.startsWith('_')) return false\n return newContext[key] !== (context._originalValues as any)?.[key]\n })\n newContext._isEdited = hasChanges\n }\n newContext._validationErrors = undefined\n return newContext\n }),\n },\n {\n actions: assign(({ context, event }) => {\n const newContext = Object.assign({}, context) as any\n const onlyInternalFields = Object.keys(event).every((key: string) => key === 'type' || key.startsWith('_'))\n for (const key of Object.keys(event) as string[]) {\n if (key === 'type') continue\n let value = (event as any)[key]\n if (value === null && ['refValueType', 'refModelId', 'ref', 'refModelName'].includes(key)) value = undefined\n newContext[key] = value\n }\n if (newContext.modelName === undefined && (context._originalValues as any)?.modelName !== undefined) {\n newContext.modelName = (context._originalValues as any).modelName\n }\n if (newContext.dataType === undefined && (context._originalValues as any)?.dataType !== undefined) {\n newContext.dataType = (context._originalValues as any).dataType\n }\n if (!onlyInternalFields && context._originalValues) {\n const hasChanges = Object.keys(event).some((key: string) => {\n if (key === 'type' || key.startsWith('_')) return false\n return newContext[key] !== (context._originalValues as any)?.[key]\n })\n newContext._isEdited = hasChanges\n }\n newContext._validationErrors = undefined\n return newContext\n }),\n },\n ],\n // validationError: Uses root handler for assignment, but needs state-specific transition\n validationError: {\n target: 'idle',\n actions: 'assignValidationErrors',\n },\n },\n states: {\n saving: {\n on: {\n saveToSchemaSuccess: {\n target: '#modelProperty.idle',\n },\n saveToSchemaError: {\n target: '#modelProperty.idle',\n },\n },\n invoke: {\n src: 'saveToSchema',\n input: ({ context }) => ({ context }),\n },\n },\n },\n },\n },\n})\n","import { models as modelsTable, properties as propertiesTable } from '@/seedSchema/ModelSchema'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { eq } from 'drizzle-orm'\n\nexport type ModelPropertyDataRow = {\n id: number\n name: string\n dataType: string\n modelId: number\n refModelId: number | null\n refValueType: string | null\n schemaFileId: string | null\n isEdited: number | null\n}\n\ntype GetModelPropertiesData = (\n modelFileId: string,\n) => Promise<ModelPropertyDataRow[]>\n\n/**\n * Returns property rows for a model identified by modelFileId (model's schemaFileId).\n * Resolves modelFileId -> modelId via models table, then selects all properties where modelId = ?.\n * Each row includes schemaFileId for use with ModelProperty.createById(schemaFileId).\n */\nexport const getModelPropertiesData: GetModelPropertiesData = async (\n modelFileId: string,\n): Promise<ModelPropertyDataRow[]> => {\n const appDb = BaseDb.getAppDb()\n if (!appDb || !modelFileId) {\n return []\n }\n\n const modelRows = await appDb\n .select({ id: modelsTable.id })\n .from(modelsTable)\n .where(eq(modelsTable.schemaFileId, modelFileId))\n .limit(1)\n\n if (modelRows.length === 0) {\n return []\n }\n\n const modelId = modelRows[0].id\n\n const rows = await appDb\n .select()\n .from(propertiesTable)\n .where(eq(propertiesTable.modelId, modelId))\n\n return rows as ModelPropertyDataRow[]\n}\n","import { ActorRefFrom, createActor, SnapshotFrom } from 'xstate'\nimport { Static } from '@sinclair/typebox'\nimport { ModelPropertyDataTypes, TProperty, normalizeDataType } from '@/Schema'\nimport { modelPropertyMachine, ModelPropertyMachineContext } from './service/modelPropertyMachine'\nimport { StorageType } from '@/types'\nimport type { CreateWaitOptions } from '@/types'\nimport { BaseFileManager, generateId } from '@/helpers'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { getModelPropertiesData } from '@/db/read/getModelPropertiesData'\nimport { getModelId, getModelIdByFileId } from '@/helpers/db'\nimport { modelPropertiesToObject } from '@/helpers/model'\nimport { Model } from '@/Model/Model'\nimport { Schema } from '@/Schema/Schema'\nimport { properties as propertiesTable, models as modelsTable } from '@/seedSchema/ModelSchema'\nimport { schemas } from '@/seedSchema/SchemaSchema'\nimport { getSchemaNameFromModel } from './service/actors/saveToSchema'\nimport { modelSchemas } from '@/seedSchema/ModelSchemaSchema'\nimport { and, eq } from 'drizzle-orm'\nimport { createReactiveProxy } from '@/helpers/reactiveProxy'\nimport { waitForEntityIdle } from '@/helpers/waitForEntityIdle'\nimport { findEntity } from '@/helpers/entity/entityFind'\nimport { unloadEntity } from '@/helpers/entity/entityUnload'\nimport { forceRemoveFromCaches, runDestroyLifecycle } from '@/helpers/entity/entityDestroy'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:modelProperty:ModelProperty')\n\ntype ModelPropertyService = ActorRefFrom<typeof modelPropertyMachine>\ntype ModelPropertySnapshot = SnapshotFrom<typeof modelPropertyMachine>\n\n// Define the property keys from TProperty\nconst TPropertyKeys = [\n 'id',\n 'name',\n 'dataType',\n 'ref',\n 'modelId',\n 'refModelId',\n 'refValueType',\n 'storageType',\n 'localStorageDir',\n 'filenameSuffix',\n 'modelName',\n 'refModelName',\n] as const\n\nexport class ModelProperty {\n protected static instanceCache: Map<\n string,\n { instance: ModelProperty; refCount: number }\n > = new Map()\n \n // Pending writes tracking\n private static pendingWrites = new Map<string, {\n propertyFileId: string\n modelId: number\n status: 'pending' | 'writing' | 'success' | 'error'\n timestamp: number\n }>()\n \n protected readonly _service: ModelPropertyService\n\n name?: string\n dataType?: ModelPropertyDataTypes\n ref?: string\n modelId?: number\n modelName?: string\n refModelId?: number\n refModelName?: string\n refValueType?: ModelPropertyDataTypes\n storageType?: StorageType\n localStorageDir?: string\n filenameSuffix?: string\n\n constructor(property: Static<typeof TProperty>) {\n // id is now the schemaFileId (string), _dbId is the database integer ID\n // Preserve _propertyFileId if it exists in the property object (from getPropertySchema)\n // Convert null to undefined for optional fields (TypeBox validation expects undefined, not null)\n const serviceInput: ModelPropertyMachineContext = {\n ...property,\n _propertyFileId: (property as any)._propertyFileId || property.id,\n refValueType: property.refValueType ?? undefined,\n refModelId: property.refModelId ?? undefined,\n ref: property.ref ?? undefined,\n refModelName: property.refModelName ?? undefined,\n }\n\n this._service = createActor(modelPropertyMachine, {\n input: serviceInput,\n })\n\n this._service.start()\n\n // Initialize original values from the input property\n this._initializeOriginalValues(property)\n\n // Note: Property getters/setters are now handled by the Proxy in create()\n }\n\n /**\n * Initialize original values and schema name for tracking changes\n * This is called asynchronously after construction\n * If the property was loaded from the database and differs from the schema file,\n * it will be marked as edited.\n */\n private _initializeOriginalValues(property: Static<typeof TProperty>): void {\n // Resolve refModelId if ref/refModelName is provided but refModelId is missing\n const refModelName = property.refModelName || property.ref\n if (refModelName && !property.refModelId) {\n // Resolve refModelId asynchronously and update context\n this._resolveRefModelId(refModelName).then((refModelId) => {\n if (refModelId) {\n // Update the context with the resolved refModelId\n this._service.send({\n type: 'updateContext',\n refModelId,\n })\n }\n }).catch(() => {\n // Ignore errors - model might not exist yet\n })\n }\n\n // Get schema file values to use as \"original\" values\n // This allows us to detect if the property was edited (DB value differs from schema file)\n this._getSchemaFileValues(property).then((schemaFileValues) => {\n // Use schema file values as original (not the current property values)\n // This way, if current values differ from schema file, _isEdited will be true\n const originalValues: Partial<Static<typeof TProperty>> = schemaFileValues || {}\n \n // Compare current property values with schema file values to determine if edited\n // Only compare schema-relevant fields, not database-specific fields like id, modelId\n let isEdited = false\n if (schemaFileValues) {\n // Fields that are schema-relevant and should be compared\n const schemaRelevantFields: (keyof Static<typeof TProperty>)[] = [\n 'dataType',\n 'ref',\n 'refModelName',\n 'refValueType',\n 'storageType',\n 'localStorageDir',\n 'filenameSuffix',\n ]\n \n // Check if any schema-relevant field differs between current property and schema file\n isEdited = schemaRelevantFields.some((key) => {\n const currentValue = (property as any)[key]\n const originalValue = (schemaFileValues as any)[key]\n \n // Handle ref fields - compare by name\n if (key === 'ref' || key === 'refModelName') {\n const currentRef = property.refModelName || property.ref\n const originalRef = schemaFileValues.refModelName || schemaFileValues.ref\n // Both undefined/null means no ref, so they're the same\n if (!currentRef && !originalRef) return false\n return currentRef !== originalRef\n }\n \n // For other fields, compare values (handling undefined/null)\n if (currentValue === undefined && originalValue === undefined) return false\n if (currentValue === null && originalValue === null) return false\n if (currentValue === undefined && originalValue === null) return false\n if (currentValue === null && originalValue === undefined) return false\n \n return currentValue !== originalValue\n })\n } else {\n // No schema file values found - this is a runtime-created property\n // Use current property as original, but mark as edited since it hasn't been exported to file\n TPropertyKeys.forEach((key) => {\n if (property[key] !== undefined) {\n (originalValues as any)[key] = property[key]\n }\n })\n // For runtime-created properties, set isEdited = true initially\n isEdited = true\n }\n\n // Initialize with original values, including isEdited flag\n // Load isEdited from database if property exists in DB (async, fire-and-forget)\n this._loadIsEditedFromDb(property, isEdited).then((isEditedFromDb: boolean) => {\n this._service.send({\n type: 'initializeOriginalValues',\n originalValues,\n schemaName: undefined, // Will be set later if needed\n isEdited: isEditedFromDb,\n })\n }).catch(() => {\n // If we can't load from DB, use computed isEdited value\n this._service.send({\n type: 'initializeOriginalValues',\n originalValues,\n schemaName: undefined, // Will be set later if needed\n isEdited,\n })\n })\n }).catch(() => {\n // If we can't get schema file values, use current property as original\n const originalValues: Partial<Static<typeof TProperty>> = {}\n TPropertyKeys.forEach((key) => {\n if (property[key] !== undefined) {\n (originalValues as any)[key] = property[key]\n }\n })\n\n this._service.send({\n type: 'initializeOriginalValues',\n originalValues,\n schemaName: undefined,\n })\n })\n\n // Get schema name from model asynchronously (fire-and-forget)\n if (property.modelName) {\n this._setSchemaName(property.modelName).catch(() => {\n // If we can't get schema name, that's okay - it will be set later if needed\n })\n }\n }\n\n /**\n * Load isEdited flag from database if property exists in DB\n * @param property - The property data\n * @param fallbackIsEdited - Fallback value if property doesn't exist in DB\n * @returns The isEdited flag from database or fallback value\n */\n private async _loadIsEditedFromDb(\n property: Static<typeof TProperty>,\n fallbackIsEdited: boolean,\n ): Promise<boolean> {\n if (!property.modelName || !property.name) {\n return fallbackIsEdited\n }\n\n try {\n const db = BaseDb.getAppDb()\n if (!db) {\n return fallbackIsEdited\n }\n\n // Find model by name\n const modelRecords = await db\n .select({ id: modelsTable.id })\n .from(modelsTable)\n .where(eq(modelsTable.name, property.modelName))\n .limit(1)\n \n if (modelRecords.length === 0) {\n return fallbackIsEdited\n }\n\n // Find property by name and modelId\n const propertyRecords = await db\n .select({ isEdited: propertiesTable.isEdited })\n .from(propertiesTable)\n .where(\n and(\n eq(propertiesTable.name, property.name),\n eq(propertiesTable.modelId, modelRecords[0].id)\n )\n )\n .limit(1)\n \n if (propertyRecords.length > 0) {\n return propertyRecords[0].isEdited ?? false\n }\n } catch (error) {\n // Ignore errors - use fallback value\n }\n\n return fallbackIsEdited\n }\n\n /**\n * Resolve refModelId from refModelName by querying the database\n * @param refModelName - The name of the referenced model\n * @returns The database ID of the referenced model, or undefined if not found\n */\n private async _resolveRefModelId(refModelName: string): Promise<number | undefined> {\n if (!refModelName) {\n return undefined\n }\n\n try {\n const db = BaseDb.getAppDb()\n if (!db) {\n return undefined\n }\n\n const refModelRecords = await db\n .select()\n .from(modelsTable)\n .where(eq(modelsTable.name, refModelName))\n .limit(1)\n \n if (refModelRecords.length > 0 && refModelRecords[0].id) {\n return refModelRecords[0].id\n }\n } catch (error) {\n // Ignore errors - model might not exist yet or database not available\n logger(`Error resolving refModelId for model \"${refModelName}\":`, error)\n }\n\n return undefined\n }\n\n /**\n * Get schema file values for this property to use as \"original\" values\n * This allows comparison with database values to detect edits\n */\n private async _getSchemaFileValues(\n property: Static<typeof TProperty>,\n ): Promise<Partial<Static<typeof TProperty>> | undefined> {\n if (!property.modelName || !property.name) {\n return undefined\n }\n\n try {\n const model = await Model.getByNameAsync(property.modelName)\n \n if (!model || !model.properties || model.properties.length === 0) {\n return undefined\n }\n\n const schema = modelPropertiesToObject(model.properties)\n // Get the schema file value for this property\n const schemaFileValue = schema[property.name]\n if (!schemaFileValue) {\n return undefined\n }\n\n // Return schema file values as original values\n const originalValues: Partial<Static<typeof TProperty>> = {\n name: property.name,\n modelName: property.modelName,\n dataType: schemaFileValue.dataType,\n storageType: schemaFileValue.storageType,\n localStorageDir: schemaFileValue.localStorageDir,\n filenameSuffix: schemaFileValue.filenameSuffix,\n }\n\n // Handle ref fields\n if (schemaFileValue.ref) {\n originalValues.ref = schemaFileValue.ref\n originalValues.refModelName = schemaFileValue.ref\n // Try to get refModelId from database\n const refModelId = await this._resolveRefModelId(schemaFileValue.ref)\n if (refModelId) {\n originalValues.refModelId = refModelId\n }\n }\n\n if (schemaFileValue.refValueType) {\n originalValues.refValueType = schemaFileValue.refValueType\n }\n\n return originalValues\n } catch (error) {\n return undefined\n }\n }\n\n /**\n * Set the schema name for this property by looking it up from the model\n * Tries database first (more reliable), then falls back to schema files\n */\n private async _setSchemaName(modelName: string): Promise<void> {\n try {\n let schemaName: string | undefined\n\n // Try to get schema name from database first (more reliable)\n if (this.modelId) {\n try {\n const db = BaseDb.getAppDb()\n if (db) {\n const modelSchemaRecords = await db\n .select({\n schemaName: schemas.name,\n })\n .from(modelSchemas)\n .innerJoin(schemas, eq(modelSchemas.schemaId, schemas.id))\n .innerJoin(modelsTable, eq(modelSchemas.modelId, modelsTable.id))\n .where(eq(modelsTable.id, this.modelId))\n .limit(1)\n\n if (modelSchemaRecords.length > 0) {\n schemaName = modelSchemaRecords[0].schemaName\n }\n }\n } catch (error) {\n // Database lookup failed, continue to file-based lookup\n }\n }\n\n // Fall back to schema file lookup if database didn't work\n if (!schemaName) {\n schemaName = await getSchemaNameFromModel(modelName)\n }\n\n if (schemaName) {\n // Update the context with the schema name using dedicated event\n this._service.send({\n type: 'setSchemaName',\n schemaName,\n })\n }\n } catch (error) {\n // If we can't get schema name, that's okay - it will be set later if needed\n }\n }\n\n /**\n * Resolve schema name from DB when _schemaName is missing (e.g. destroy ran before _setSchemaName finished).\n * Uses context.id (schemaFileId) and context.modelId to query properties → model_schemas → schemas.\n */\n private async _resolveSchemaNameForDestroy(\n db: NonNullable<ReturnType<typeof BaseDb.getAppDb>>,\n context: ModelPropertyMachineContext,\n ): Promise<string | undefined> {\n try {\n let modelId = context.modelId\n const schemaFileId = context.id ?? context._propertyFileId\n\n // If we don't have modelId, get it from the property row by schemaFileId\n if (modelId == null && schemaFileId) {\n const propRows = await db\n .select({ modelId: propertiesTable.modelId })\n .from(propertiesTable)\n .where(eq(propertiesTable.schemaFileId, schemaFileId))\n .limit(1)\n if (propRows.length > 0 && propRows[0].modelId != null) {\n modelId = propRows[0].modelId\n }\n }\n\n if (modelId == null) return undefined\n\n // Resolve modelFileId (string) to database ID (number) if needed - modelSchemas.modelId expects number\n const modelIdNum: number =\n typeof modelId === 'string' ? await getModelIdByFileId(modelId) : modelId\n\n const modelSchemaRecords = await db\n .select({ schemaName: schemas.name })\n .from(modelSchemas)\n .innerJoin(schemas, eq(modelSchemas.schemaId, schemas.id))\n .where(eq(modelSchemas.modelId, modelIdNum))\n .limit(1)\n\n return modelSchemaRecords.length > 0 ? modelSchemaRecords[0].schemaName ?? undefined : undefined\n } catch {\n return undefined\n }\n }\n\n /**\n * Manually set the schema name for this property\n * Useful when you know the schema name from context (e.g., when working with Schema instances)\n */\n setSchemaName(schemaName: string): void {\n this._service.send({\n type: 'setSchemaName',\n schemaName,\n })\n }\n\n static create(\n property: Static<typeof TProperty>,\n options?: { waitForReady?: false; schemaName?: string },\n ): ModelProperty\n static create(\n property: Static<typeof TProperty>,\n options?: { waitForReady?: true; readyTimeout?: number; schemaName?: string },\n ): Promise<ModelProperty>\n static create(\n property: Static<typeof TProperty>,\n options?: CreateWaitOptions & { schemaName?: string },\n ): ModelProperty | Promise<ModelProperty> {\n if (!property) {\n throw new Error('Property is required')\n }\n\n const waitForReady = options?.waitForReady !== false\n const readyTimeout = options?.readyTimeout ?? 5000\n const schemaName = options?.schemaName\n\n // Handle 'type' field from JSON schema format - convert to 'dataType'\n // Normalize to PascalCase so lowercase values from JSON (e.g. 'text') work\n const propertyWithId = { ...property }\n const rawType = propertyWithId.dataType ?? (propertyWithId as any).type\n if (rawType) {\n propertyWithId.dataType = normalizeDataType(rawType) as ModelPropertyDataTypes\n }\n if (typeof propertyWithId.refValueType === 'string') {\n propertyWithId.refValueType = normalizeDataType(propertyWithId.refValueType) as ModelPropertyDataTypes\n }\n\n // Ensure id (schemaFileId) is set correctly\n // Priority: _propertyFileId > id (if string) > generate new\n // If id is a number (old format), use _propertyFileId instead\n if (typeof propertyWithId.id === 'number') {\n // id is a database integer ID, not schemaFileId - use _propertyFileId if available\n if ((propertyWithId as any)._propertyFileId) {\n propertyWithId.id = (propertyWithId as any)._propertyFileId\n } else {\n // Fallback: generate new schemaFileId (shouldn't happen, but safety)\n propertyWithId.id = generateId()\n logger(`ModelProperty.create: id was a number, generated new schemaFileId \"${propertyWithId.id}\" for property \"${property.name}\"`)\n }\n } else if (!propertyWithId.id && (propertyWithId as any)._propertyFileId) {\n // id is not set but _propertyFileId is available - use it\n propertyWithId.id = (propertyWithId as any)._propertyFileId\n } else if (!propertyWithId.id) {\n // Generate id (schemaFileId) if not provided (for new properties)\n // This ensures new properties can trigger write process\n propertyWithId.id = generateId()\n logger(`ModelProperty.create: Generated new id (schemaFileId) \"${propertyWithId.id}\" for property \"${property.name}\"`)\n }\n\n // Create cache key from modelName and name, or use id\n const cacheKey = propertyWithId.modelName && propertyWithId.name\n ? `${propertyWithId.modelName}:${propertyWithId.name}`\n : propertyWithId.id\n ? `id:${propertyWithId.id}`\n : propertyWithId.name || 'unnamed'\n\n // Check if instance exists in cache\n if (this.instanceCache.has(cacheKey)) {\n const { instance, refCount } = this.instanceCache.get(cacheKey)!\n const cachedContext = instance._getSnapshotContext()\n \n // Update cached instance if new property data has fields that the cached instance doesn't have\n // This handles cases where the property was created without ref initially, but now we have ref from schema\n const needsUpdate: any = {}\n if (propertyWithId.ref && !cachedContext.ref) {\n needsUpdate.ref = propertyWithId.ref\n }\n if (propertyWithId.refModelName && !cachedContext.refModelName) {\n needsUpdate.refModelName = propertyWithId.refModelName\n }\n if (propertyWithId.refModelId && !cachedContext.refModelId) {\n needsUpdate.refModelId = propertyWithId.refModelId\n }\n \n if (Object.keys(needsUpdate).length > 0) {\n instance._service.send({\n type: 'updateContext',\n ...needsUpdate,\n })\n }\n \n this.instanceCache.set(cacheKey, {\n instance,\n refCount: refCount + 1,\n })\n if (!waitForReady) return instance\n return waitForEntityIdle(instance, { timeout: readyTimeout }).then(\n () => instance,\n )\n }\n\n const newInstance = new this(propertyWithId)\n \n // Set schema name before async operations so getModelId can resolve the correct model\n if (schemaName) {\n newInstance._service.send({\n type: 'setSchemaName',\n schemaName,\n })\n }\n \n // Wrap instance in Proxy for reactive property access\n const proxiedInstance = createReactiveProxy<ModelProperty>({\n instance: newInstance,\n service: newInstance._service,\n trackedProperties: TPropertyKeys,\n getContext: (instance) => {\n const context = instance._getSnapshotContext()\n return context\n },\n sendUpdate: (instance, prop: string, value: any) => {\n const currentContext = instance._getSnapshotContext()\n if ((currentContext as Record<string, unknown>)[prop] === value) return // No-op, avoid triggering machine\n instance._service.send({\n type: 'updateContext',\n [prop]: value,\n })\n },\n })\n \n this.instanceCache.set(cacheKey, {\n instance: proxiedInstance,\n refCount: 1,\n })\n \n // Trigger write process if property has modelId (or modelName) and id (schemaFileId)\n // Wait for service to be ready (idle state) and have writeProcess spawned\n const propertyFileId = propertyWithId.id // id is now the schemaFileId (string)\n const hasModelId = propertyWithId.modelId || propertyWithId.modelName\n \n if (hasModelId && propertyFileId) {\n // Wait for writeProcess to be spawned (it's spawned in idle state entry action)\n // Retry a few times if writeProcess isn't available yet\n let retries = 0\n const maxRetries = 10\n const checkAndSend = async () => {\n const service = proxiedInstance.getService()\n const snapshot = service.getSnapshot()\n \n if (snapshot.value === 'idle' && snapshot.context.writeProcess) {\n const writeProcess = snapshot.context.writeProcess\n \n // Resolve dbModelId - convert from string (modelFileId) to number (database ID) if needed\n let resolvedModelId: number | undefined = undefined\n \n if (propertyWithId.modelId) {\n if (typeof propertyWithId.modelId === 'number') {\n resolvedModelId = propertyWithId.modelId\n } else if (typeof propertyWithId.modelId === 'string') {\n // modelId is a string (modelFileId), need to convert to database ID\n try {\n resolvedModelId = await getModelIdByFileId(propertyWithId.modelId)\n logger(`Converted modelFileId \"${propertyWithId.modelId}\" to database modelId: ${resolvedModelId}`)\n } catch (error) {\n logger(`Failed to convert modelFileId \"${propertyWithId.modelId}\" to database ID: ${error}`)\n console.error(`[ModelProperty.create] Failed to convert modelFileId: ${error}`)\n }\n }\n }\n \n // If we still don't have a modelId, try to resolve it from modelName\n if (!resolvedModelId && propertyWithId.modelName) {\n try {\n // Get schemaName from context if available\n const schemaName = snapshot.context._schemaName\n resolvedModelId = await getModelId(propertyWithId.modelName, schemaName)\n logger(`Resolved modelId for model \"${propertyWithId.modelName}\": ${resolvedModelId}`)\n } catch (error) {\n logger(`Failed to resolve modelId for model \"${propertyWithId.modelName}\": ${error}`)\n console.error(`[ModelProperty.create] Failed to resolve modelId: ${error}`)\n }\n }\n \n if (!resolvedModelId) {\n logger(`ERROR: Cannot write property \"${property.name}\" - no modelId available`)\n console.error(`[ModelProperty.create] ERROR: Cannot write property \"${property.name}\" - no modelId available. modelId: ${propertyWithId.modelId}, modelName: ${propertyWithId.modelName}`)\n // Don't clear pending write here - it might resolve later\n return\n }\n \n // Track pending write now that we have the resolved modelId\n this.trackPendingWrite(propertyFileId, resolvedModelId)\n \n logger(`Triggering write process for property \"${property.name}\" (modelId: ${resolvedModelId}, propertyFileId: ${propertyFileId})`)\n \n // Check current write state\n const currentWriteState = writeProcess.getSnapshot()\n \n if (currentWriteState.value === 'success') {\n // Write already succeeded, clear pending write immediately\n this.clearPendingWrite(propertyFileId, 'success')\n } else {\n // Set up subscription to catch future state changes\n const writeSubscription = writeProcess.subscribe((writeSnapshot) => {\n if (writeSnapshot.value === 'success') {\n writeSubscription.unsubscribe()\n logger(`[writeProcess subscription] Write succeeded for property \"${property.name}\" (propertyFileId: ${propertyFileId})`)\n // Clear pending write on success\n this.clearPendingWrite(propertyFileId, 'success')\n } else if (writeSnapshot.value === 'error') {\n writeSubscription.unsubscribe()\n const errorContext = writeSnapshot.context\n logger(`Write process failed for property \"${property.name}\" (propertyFileId: ${propertyFileId}): ${errorContext.error?.message || 'Unknown error'}`)\n logger(`Write process error details:`, errorContext.error)\n // Mark pending write as error\n this.clearPendingWrite(propertyFileId, 'error')\n }\n })\n }\n \n const propertyData = {\n modelId: resolvedModelId,\n name: property.name!,\n dataType: property.dataType!,\n refModelId: property.refModelId,\n refValueType: property.refValueType,\n storageType: property.storageType,\n localStorageDir: property.localStorageDir,\n filenameSuffix: property.filenameSuffix,\n }\n \n service.send({\n type: 'requestWrite',\n data: propertyData,\n })\n } else if (retries < maxRetries) {\n retries++\n setTimeout(checkAndSend, 50) // Retry after 50ms\n } else {\n logger(`ERROR: writeProcess not available after ${maxRetries} retries for property \"${property.name}\" (propertyFileId: ${propertyFileId})`)\n console.error(`[ModelProperty.create] ERROR: writeProcess not available after ${maxRetries} retries for property \"${property.name}\" (propertyFileId: ${propertyFileId})`)\n // Mark as error if we couldn't even start the write process\n this.clearPendingWrite(propertyFileId, 'error')\n }\n }\n \n // Start checking after a short delay to allow state machine to initialize\n setTimeout(checkAndSend, 0)\n }\n \n if (!waitForReady) return proxiedInstance\n return waitForEntityIdle(proxiedInstance, { timeout: readyTimeout }).then(\n () => proxiedInstance,\n )\n }\n\n /**\n * Get ModelProperty instance by propertyFileId from static cache\n */\n static getById(propertyFileId: string): ModelProperty | undefined {\n if (!propertyFileId) return undefined\n \n // Search through cache to find by propertyFileId\n // Cache key might be \"modelName:propertyName\" or \"id:propertyId\"\n for (const [cacheKey, { instance }] of this.instanceCache.entries()) {\n const context = instance._getSnapshotContext()\n // id is now the schemaFileId (string)\n if (context.id === propertyFileId) {\n return instance\n }\n }\n \n return undefined\n }\n\n /**\n * Create or get ModelProperty instance by propertyFileId\n * Queries the database to find the property if not cached\n */\n static async createById(propertyFileId: string): Promise<ModelProperty | undefined> {\n if (!propertyFileId) {\n return undefined\n }\n\n // First, check if we have an instance cached\n const cachedInstance = this.getById(propertyFileId)\n if (cachedInstance) {\n return cachedInstance\n }\n\n // Query database to get property data from ID\n const db = BaseDb.getAppDb()\n if (!db) {\n return undefined\n }\n\n const testRecords = await db\n .select()\n .from(propertiesTable)\n .limit(100)\n\n const propertyRecords = await db\n .select()\n .from(propertiesTable)\n .where(eq(propertiesTable.schemaFileId, propertyFileId))\n .limit(1)\n\n if (propertyRecords.length === 0) {\n return undefined\n }\n\n const propertyRecord = propertyRecords[0]\n\n // Get model name\n const modelRecords = await db\n .select({ name: modelsTable.name })\n .from(modelsTable)\n .where(eq(modelsTable.id, propertyRecord.modelId))\n .limit(1)\n\n if (modelRecords.length === 0) {\n return undefined\n }\n\n const modelName = modelRecords[0].name\n\n // Build property data\n // id is now the schemaFileId (string), _dbId is the database integer ID\n const propertyData: Static<typeof TProperty> = {\n id: propertyFileId, // schemaFileId (string) - public ID\n _dbId: propertyRecord.id ?? undefined, // Database integer ID - internal only\n name: propertyRecord.name,\n dataType: propertyRecord.dataType as ModelPropertyDataTypes,\n modelId: propertyRecord.modelId,\n modelName,\n refModelId: propertyRecord.refModelId || undefined,\n refValueType: propertyRecord.refValueType ? (propertyRecord.refValueType as ModelPropertyDataTypes) : undefined,\n required: propertyRecord.required ?? false,\n }\n \n // Load isEdited from database\n const isEditedFromDb = propertyRecord.isEdited ?? false\n\n // Get ref model name if applicable\n if (propertyRecord.refModelId) {\n const refModelRecords = await db\n .select({ name: modelsTable.name })\n .from(modelsTable)\n .where(eq(modelsTable.id, propertyRecord.refModelId))\n .limit(1)\n\n if (refModelRecords.length > 0) {\n propertyData.refModelName = refModelRecords[0].name\n propertyData.ref = refModelRecords[0].name\n }\n }\n\n // Create ModelProperty instance (sync for createById so we can send updateContext)\n const instance = this.create(propertyData, { waitForReady: false })\n \n // Set isEdited from database after creation\n if (isEditedFromDb) {\n instance._service.send({\n type: 'updateContext',\n _isEdited: true,\n })\n }\n \n return instance\n }\n\n /**\n * Find ModelProperty instance by propertyFileId\n * Waits for the property to be fully loaded (idle state) by default\n * @param options - Find options including propertyFileId and wait configuration\n * @returns ModelProperty instance if found, undefined otherwise\n */\n static async find({\n propertyFileId,\n waitForReady = true,\n readyTimeout = 5000,\n }: {\n propertyFileId: string\n waitForReady?: boolean\n readyTimeout?: number\n }): Promise<ModelProperty | undefined> {\n if (!propertyFileId) {\n return undefined\n }\n\n return await findEntity<ModelProperty>(\n {\n getById: (id) => ModelProperty.getById(id),\n createById: (id) => ModelProperty.createById(id),\n },\n { id: propertyFileId },\n {\n waitForReady,\n readyTimeout,\n }\n )\n }\n\n /**\n * Get all ModelProperty instances for a model.\n * Loads property rows from DB for the given modelFileId, creates instances via createById, optionally waits for idle.\n */\n static async all(\n modelFileId: string,\n options?: { waitForReady?: boolean; readyTimeout?: number },\n ): Promise<ModelProperty[]> {\n const { waitForReady = false, readyTimeout = 5000 } = options ?? {}\n if (!modelFileId) {\n return []\n }\n\n const rows = await getModelPropertiesData(modelFileId)\n const instances: ModelProperty[] = []\n\n for (const row of rows) {\n if (row.schemaFileId) {\n const instance = await this.createById(row.schemaFileId)\n if (instance) {\n instances.push(instance)\n }\n }\n }\n\n if (waitForReady && instances.length > 0) {\n await Promise.all(\n instances.map((p) =>\n waitForEntityIdle(p as Parameters<typeof waitForEntityIdle>[0], {\n timeout: readyTimeout,\n }),\n ),\n )\n }\n\n return instances\n }\n\n /**\n * Track a pending write for a property\n */\n static trackPendingWrite(propertyFileId: string, modelId: number): void {\n this.pendingWrites.set(propertyFileId, {\n propertyFileId,\n modelId,\n status: 'pending',\n timestamp: Date.now(),\n })\n }\n\n /**\n * Clear or update pending write status\n */\n static clearPendingWrite(propertyFileId: string, status: 'success' | 'error' = 'success'): void {\n const write = this.pendingWrites.get(propertyFileId)\n if (write) {\n if (status === 'success') {\n // Remove successful writes from pendingWrites\n this.pendingWrites.delete(propertyFileId)\n logger(`Cleared pending write for property \"${propertyFileId}\" (status: success)`)\n } else {\n // Update status to error but keep in map (for debugging/retry purposes)\n write.status = 'error'\n this.pendingWrites.set(propertyFileId, write)\n logger(`Marked pending write as error for property \"${propertyFileId}\"`)\n }\n }\n }\n\n /**\n * Get all pending property IDs for a model\n */\n static getPendingPropertyIds(modelId: number): string[] {\n return Array.from(this.pendingWrites.entries())\n .filter(([_, write]) => write.modelId === modelId && write.status !== 'error')\n .map(([propertyFileId]) => propertyFileId)\n }\n\n /**\n * Get modelId for a property that has a pending write (row may not be in DB yet).\n * Used to resolve modelName when validating a just-created property rename.\n */\n static getPendingModelId(propertyFileId: string): number | undefined {\n return this.pendingWrites.get(propertyFileId)?.modelId\n }\n\n getService(): ModelPropertyService {\n return this._service\n }\n\n private _getSnapshot(): ModelPropertySnapshot {\n return this._service.getSnapshot() as ModelPropertySnapshot\n }\n\n public _getSnapshotContext(): ModelPropertyMachineContext {\n return this._getSnapshot().context\n }\n\n get path() {\n const workingDir = BaseFileManager.getWorkingDir()\n if (!this.localStorageDir || !this.name || !this.filenameSuffix) {\n return undefined\n }\n return `${workingDir}/${this.localStorageDir}/${this.name}${this.filenameSuffix || ''}`\n }\n\n get status() {\n return this._getSnapshot().value\n }\n\n get isEdited() {\n const context = this._getSnapshotContext()\n // First check in-memory state\n if (context._isEdited !== undefined) {\n return context._isEdited\n }\n // Fall back to reading from database if we have _dbId\n if (context._dbId) {\n // Load from database asynchronously (fire-and-forget for now)\n // For synchronous getter, we'll need to cache it or make it async\n // For now, return false if not in context\n return false\n }\n return false\n }\n\n get validationErrors() {\n return this._getSnapshotContext()._validationErrors || []\n }\n\n get isValid() {\n const errors = this.validationErrors\n return errors.length === 0\n }\n\n /**\n * Validate the property\n * @returns Validation result\n */\n async validate(): Promise<{ isValid: boolean; errors: any[] }> {\n return new Promise((resolve) => {\n let resolved = false\n const subscription = this._service.subscribe((snapshot) => {\n const state = snapshot.value\n // Wait for validation to complete (idle state after validating)\n if (state === 'idle' && !resolved) {\n resolved = true\n subscription.unsubscribe()\n const errors = snapshot.context._validationErrors || []\n resolve({\n isValid: errors.length === 0,\n errors,\n })\n }\n })\n\n this._service.send({ type: 'validateProperty' })\n \n // Timeout fallback\n setTimeout(() => {\n if (!resolved) {\n resolved = true\n subscription.unsubscribe()\n const errors = this._getSnapshotContext()._validationErrors || []\n resolve({\n isValid: errors.length === 0,\n errors,\n })\n }\n }, 5000)\n })\n }\n\n save(): void {\n const snapshot = this._service.getSnapshot()\n const isAlreadySaving =\n typeof snapshot.value === 'object' && snapshot.value !== null && 'saveToSchema' in snapshot.value\n if (isAlreadySaving) {\n return\n }\n const context = snapshot.context\n if (!context._isEdited) return // No changes to persist\n // Validation will happen automatically in the machine before saving\n this._service.send({\n type: 'saveToSchema',\n })\n }\n\n /**\n * Reload property from database\n * This refreshes the actor context with the latest data from the database\n * Note: ModelProperty doesn't have a dedicated load actor, so this will\n * re-initialize from the current property data\n */\n async reload(): Promise<void> {\n // ModelProperty doesn't have a separate load mechanism\n // It's loaded as part of the Model/Schema\n // This method is provided for API consistency\n // To actually reload, you'd need to reload the parent Model or Schema\n logger('ModelProperty.reload() called - ModelProperty is loaded as part of Model/Schema. Reload the parent Model or Schema instead.')\n // No-op for now, but could be enhanced to reload from DB if needed\n }\n\n unload(): void {\n // ModelProperty doesn't have liveQuery subscriptions or complex cache management\n // Just stop the service\n try {\n this._service.stop()\n } catch (error) {\n // Service might already be stopped\n }\n }\n\n /**\n * Destroy the model property: remove from caches, delete from database, update Schema context, stop service.\n */\n async destroy(): Promise<void> {\n const context = this._getSnapshotContext()\n const cacheKey =\n context.modelName && context.name\n ? `${context.modelName}:${context.name}`\n : (context.id ?? '')\n if (!cacheKey) return\n\n forceRemoveFromCaches(this, {\n getCacheKeys: () => [cacheKey],\n caches: [ModelProperty.instanceCache as Map<string, unknown>],\n })\n\n await runDestroyLifecycle(this, {\n getService: (instance) =>\n instance._service as { send: (ev: unknown) => void; stop: () => void },\n doDestroy: async () => {\n const db = BaseDb.getAppDb()\n let schemaName = context._schemaName\n const modelName = context.modelName\n const propertyName = context.name\n if (!modelName || !propertyName) return\n\n // Resolve schema name from DB when _schemaName is missing (e.g. destroy ran before _setSchemaName finished)\n if (!schemaName && db) {\n schemaName = await this._resolveSchemaNameForDestroy(db, context)\n }\n\n if (db && schemaName) {\n const propertyRecords = await db\n .select({ propertyId: propertiesTable.id })\n .from(propertiesTable)\n .innerJoin(modelsTable, eq(propertiesTable.modelId, modelsTable.id))\n .innerJoin(modelSchemas, eq(modelsTable.id, modelSchemas.modelId))\n .innerJoin(schemas, eq(modelSchemas.schemaId, schemas.id))\n .where(\n and(\n eq(schemas.name, schemaName),\n eq(modelsTable.name, modelName),\n eq(propertiesTable.name, propertyName),\n ),\n )\n .limit(1)\n if (propertyRecords.length > 0 && propertyRecords[0].propertyId != null) {\n await db\n .delete(propertiesTable)\n .where(eq(propertiesTable.id, propertyRecords[0].propertyId))\n }\n }\n\n if (schemaName) {\n const schema = Schema.create(schemaName, { waitForReady: false }) as import('@/Schema/Schema').Schema\n const snapshot = schema.getService().getSnapshot()\n const schemaContext = snapshot.context\n if (schemaContext.models?.[modelName]?.properties?.[propertyName]) {\n const updatedModels = { ...schemaContext.models }\n const updatedProperties = { ...updatedModels[modelName].properties }\n delete updatedProperties[propertyName]\n updatedModels[modelName] = { ...updatedModels[modelName], properties: updatedProperties }\n schema.getService().send({ type: 'updateContext', models: updatedModels })\n schema.getService().send({ type: 'markAsDraft', propertyKey: `property:${modelName}:${propertyName}` })\n }\n }\n },\n })\n }\n}\n"],"names":["logger","fromCallback","BaseDb","setup","writeProcessMachine","assign","modelsTable","eq","propertiesTable","createActor","and","Model","modelPropertiesToObject","schemas","modelSchemas","getModelIdByFileId","normalizeDataType","generateId","waitForEntityIdle","createReactiveProxy","getModelId","findEntity","BaseFileManager","forceRemoveFromCaches","runDestroyLifecycle","Schema"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAMA,QAAM,GAAG,KAAK,CAAC,2CAA2C,CAAC;AAEjE;;;;AAIG;AACI,eAAe,sBAAsB,CAAC,SAAiB,EAAA;;AAE5D,IAAA,MAAM,gBAAgB,GAAG,MAAM,oDAAO,qBAAyB,+CAAC;AAChE,IAAA,MAAM,EAAE,qBAAqB,EAAE,GAAG,gBAAgB;AAClD,IAAA,MAAM,aAAa,GAAG,MAAM,qBAAqB,EAAE;AAEnD,IAAA,KAAK,MAAM,MAAM,IAAI,aAAa,EAAE;AAClC,QAAA,IAAI;AACF,YAAA,MAAM,cAAc,GAAG,MAAM,oDAAO,qBAA8C,wDAAC;AACnF,YAAA,MAAM,EAAE,eAAe,EAAE,GAAG,cAAc;YAC1C,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC;YACvE,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAQ;YAE7C,IAAI,UAAU,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;gBACrD,OAAO,MAAM,CAAC,IAAI;YACpB;QACF;QAAE,OAAO,KAAK,EAAE;AACd,YAAAA,QAAM,CAAC,4BA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AS,CAAA,CAAA,EAAI,YAAY,CAAA,CAAE,EAAE,CAAC;oBACzG;gBACF;YACF,CAAC;AACF,SAAA,CAAC;IACJ;;AAzkCiB,aAAA,CAAA,aAAa,GAG1B,IAAI,GAAG,EAAE;AAEb;AACe,aAAA,CAAA,aAAa,GAAG,IAAI,GAAG,EAKlC;;;;;;;"}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var xstate = require('xstate');
|
|
4
|
-
var main_cjs = require('./index-
|
|
4
|
+
var main_cjs = require('./index-CSNtEnbF.js');
|
|
5
5
|
var drizzleOrm = require('drizzle-orm');
|
|
6
6
|
var debug = require('debug');
|
|
7
|
-
var SchemaValidationService = require('./SchemaValidationService-D55MWsxv.js');
|
|
8
7
|
require('pluralize');
|
|
8
|
+
var SchemaValidationService = require('./SchemaValidationService-DtYs_CNY.js');
|
|
9
9
|
require('immer');
|
|
10
10
|
require('reflect-metadata');
|
|
11
11
|
require('drizzle-orm/sqlite-core');
|
|
12
12
|
require('@seedprotocol/arweave');
|
|
13
13
|
require('@seedprotocol/eas');
|
|
14
14
|
require('@sinclair/typebox');
|
|
15
|
+
require('drizzle-orm/casing');
|
|
16
|
+
require('lodash-es');
|
|
15
17
|
require('nanoid');
|
|
16
18
|
require('nanoid-dictionary');
|
|
17
19
|
require('@seedprotocol/query');
|
|
18
|
-
require('drizzle-orm/casing');
|
|
19
|
-
require('lodash-es');
|
|
20
20
|
require('rxjs');
|
|
21
|
-
require('
|
|
21
|
+
require('@noble/hashes/sha3');
|
|
22
|
+
require('@noble/hashes/utils');
|
|
22
23
|
require('fs/promises');
|
|
23
24
|
require('fs');
|
|
24
25
|
require('path');
|
|
26
|
+
require('url');
|
|
25
27
|
require('node:url');
|
|
26
28
|
require('@libsql/client');
|
|
27
29
|
require('drizzle-orm/libsql');
|
|
@@ -74,7 +76,7 @@ const createModelInstances$2 = async (modelIds) => {
|
|
|
74
76
|
return;
|
|
75
77
|
}
|
|
76
78
|
try {
|
|
77
|
-
const modelMod = await Promise.resolve().then(function () { return require('./index-
|
|
79
|
+
const modelMod = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.Model$1; });
|
|
78
80
|
const { Model } = modelMod;
|
|
79
81
|
// Create instances for all model IDs in parallel
|
|
80
82
|
// Model.createById() will check cache first, then query DB and create if needed
|
|
@@ -187,7 +189,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
187
189
|
// For Seed Protocol, always load from internal file, never create new
|
|
188
190
|
logger$d(`Loading internal Seed Protocol schema from SDK`);
|
|
189
191
|
try {
|
|
190
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
192
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
191
193
|
const schemaFile = internalSchema.default;
|
|
192
194
|
// Check if it exists in database, if not, add it
|
|
193
195
|
const db = main_cjs.BaseDb.getAppDb();
|
|
@@ -235,7 +237,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
235
237
|
}
|
|
236
238
|
// Handle List type (case-insensitive refValueType)
|
|
237
239
|
const listRefValueType = main_cjs.getRefValueType(schemaProp);
|
|
238
|
-
if (schemaProp.dataType
|
|
240
|
+
if (main_cjs.isDataType(schemaProp.dataType, main_cjs.ModelPropertyDataTypes.List) && listRefValueType) {
|
|
239
241
|
jsonProp.refValueType = listRefValueType;
|
|
240
242
|
if (schemaProp.ref || schemaProp.refModelName) {
|
|
241
243
|
jsonProp.ref = schemaProp.refModelName || schemaProp.ref;
|
|
@@ -377,7 +379,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
377
379
|
jsonProp.model = schemaProp.refModelName || schemaProp.ref;
|
|
378
380
|
}
|
|
379
381
|
// Handle List type (support both refValueType and legacy items, case-insensitive)
|
|
380
|
-
if (schemaProp.dataType
|
|
382
|
+
if (main_cjs.isDataType(schemaProp.dataType, main_cjs.ModelPropertyDataTypes.List) || main_cjs.isDataType(schemaProp.type, main_cjs.ModelPropertyDataTypes.List)) {
|
|
381
383
|
const refValueType = main_cjs.getRefValueType(schemaProp);
|
|
382
384
|
if (refValueType) {
|
|
383
385
|
jsonProp.refValueType = refValueType;
|
|
@@ -680,7 +682,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
680
682
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
681
683
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
682
684
|
try {
|
|
683
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
685
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
684
686
|
const internalSchemaFile = internalSchema.default;
|
|
685
687
|
mergedModels = { ...(internalSchemaFile.models || {}) };
|
|
686
688
|
logger$d(`Populated models for seed-protocol schema from internal file`);
|
|
@@ -907,7 +909,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
907
909
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
908
910
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
909
911
|
try {
|
|
910
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
912
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
911
913
|
const internalSchemaFile = internalSchema.default;
|
|
912
914
|
mergedModels = { ...(internalSchemaFile.models || {}) };
|
|
913
915
|
logger$d(`Populated models for seed-protocol schema from internal file`);
|
|
@@ -996,7 +998,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
996
998
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
997
999
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
998
1000
|
try {
|
|
999
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
1001
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
1000
1002
|
const internalSchemaFile = internalSchema.default;
|
|
1001
1003
|
mergedModels = { ...(internalSchemaFile.models || {}) };
|
|
1002
1004
|
logger$d(`Populated models for seed-protocol schema from internal file`);
|
|
@@ -1082,7 +1084,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
1082
1084
|
// If schemaData is missing, try to load from internal schema file for seed-protocol
|
|
1083
1085
|
if (!dbSchema.schemaData && schemaName === 'Seed Protocol') {
|
|
1084
1086
|
try {
|
|
1085
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
1087
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
1086
1088
|
const schemaFile = internalSchema.default;
|
|
1087
1089
|
logger$d(`Found seed-protocol schema in internal file (schemaData missing, using internal schema)`);
|
|
1088
1090
|
// Update database with schemaData for future loads
|
|
@@ -1191,7 +1193,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
1191
1193
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
1192
1194
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
1193
1195
|
try {
|
|
1194
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
1196
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
1195
1197
|
const internalSchemaFile = internalSchema.default;
|
|
1196
1198
|
mergedModels = { ...(internalSchemaFile.models || {}) };
|
|
1197
1199
|
logger$d(`Populated models for seed-protocol schema from internal file`);
|
|
@@ -1829,7 +1831,7 @@ const addModelsMachine = xstate.setup({
|
|
|
1829
1831
|
jsonProp.model = schemaProp.refModelName || schemaProp.ref;
|
|
1830
1832
|
}
|
|
1831
1833
|
// Handle List type
|
|
1832
|
-
if (schemaProp.dataType
|
|
1834
|
+
if (main_cjs.isDataType(schemaProp.dataType, main_cjs.ModelPropertyDataTypes.List) && schemaProp.refValueType) {
|
|
1833
1835
|
jsonProp.refValueType = schemaProp.refValueType;
|
|
1834
1836
|
if (schemaProp.ref || schemaProp.refModelName) {
|
|
1835
1837
|
jsonProp.ref = schemaProp.refModelName || schemaProp.ref;
|
|
@@ -2092,7 +2094,7 @@ const createModelInstances$1 = async (modelIds) => {
|
|
|
2092
2094
|
return;
|
|
2093
2095
|
}
|
|
2094
2096
|
try {
|
|
2095
|
-
const mod = await Promise.resolve().then(function () { return require('./index-
|
|
2097
|
+
const mod = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.Model$1; });
|
|
2096
2098
|
const Model = mod?.Model ?? mod?.default;
|
|
2097
2099
|
if (!Model) {
|
|
2098
2100
|
logger$c('Model not available from dynamic import');
|
|
@@ -2137,7 +2139,7 @@ const checkExistingSchema = xstate.fromCallback(({ sendBack, input: { context }
|
|
|
2137
2139
|
if (isInternal && schemaName === main_cjs.SEED_PROTOCOL_SCHEMA_NAME) {
|
|
2138
2140
|
// For Seed Protocol, check if it exists in database
|
|
2139
2141
|
try {
|
|
2140
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
2142
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
2141
2143
|
const schemaFile = internalSchema.default;
|
|
2142
2144
|
if (db && schemaFile.id) {
|
|
2143
2145
|
const existing = await db
|
|
@@ -2495,7 +2497,7 @@ const writeSchemaToDb = xstate.fromCallback(({ sendBack, input }) => {
|
|
|
2495
2497
|
if (isInternal && schemaName === main_cjs.SEED_PROTOCOL_SCHEMA_NAME) {
|
|
2496
2498
|
// For Seed Protocol, load from internal file
|
|
2497
2499
|
logger$b(`Loading internal Seed Protocol schema from SDK`);
|
|
2498
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
2500
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
2499
2501
|
finalSchema = internalSchema.default;
|
|
2500
2502
|
const db = main_cjs.BaseDb.getAppDb();
|
|
2501
2503
|
if (db && finalSchema.id) {
|
|
@@ -2761,7 +2763,7 @@ const writeModelsToDb = xstate.fromCallback(({ sendBack, input }) => {
|
|
|
2761
2763
|
jsonProp.model = schemaProp.refModelName || schemaProp.ref;
|
|
2762
2764
|
}
|
|
2763
2765
|
// Handle List type
|
|
2764
|
-
if (schemaProp.dataType
|
|
2766
|
+
if (main_cjs.isDataType(schemaProp.dataType, main_cjs.ModelPropertyDataTypes.List) && schemaProp.refValueType) {
|
|
2765
2767
|
jsonProp.refValueType = schemaProp.refValueType;
|
|
2766
2768
|
if (schemaProp.ref || schemaProp.refModelName) {
|
|
2767
2769
|
jsonProp.ref = schemaProp.refModelName || schemaProp.ref;
|
|
@@ -2963,7 +2965,7 @@ const createModelInstances = xstate.fromCallback(({ sendBack, input }) => {
|
|
|
2963
2965
|
return;
|
|
2964
2966
|
}
|
|
2965
2967
|
try {
|
|
2966
|
-
const modelMod = await Promise.resolve().then(function () { return require('./index-
|
|
2968
|
+
const modelMod = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.Model$1; });
|
|
2967
2969
|
const { Model } = modelMod;
|
|
2968
2970
|
// Create instances for all model IDs in parallel
|
|
2969
2971
|
// Model.createById() will check cache first, then query DB and create if needed
|
|
@@ -3049,7 +3051,7 @@ const verifyModelInstancesInCache = xstate.fromCallback(({ sendBack, input }) =>
|
|
|
3049
3051
|
}
|
|
3050
3052
|
try {
|
|
3051
3053
|
const result = await verifyWithRetry$2(async () => {
|
|
3052
|
-
const modelMod = await Promise.resolve().then(function () { return require('./index-
|
|
3054
|
+
const modelMod = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.Model$1; });
|
|
3053
3055
|
const { Model } = modelMod;
|
|
3054
3056
|
// Check each model ID in the cache
|
|
3055
3057
|
const verifiedInstances = [];
|
|
@@ -3106,7 +3108,7 @@ const writePropertiesToDb = xstate.fromCallback(({ sendBack, input }) => {
|
|
|
3106
3108
|
const _write = async () => {
|
|
3107
3109
|
const { modelIds } = input;
|
|
3108
3110
|
try {
|
|
3109
|
-
const modelSchemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
3111
|
+
const modelSchemaMod = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.ModelSchema; });
|
|
3110
3112
|
const { models: modelsTable, properties: propertiesTable } = modelSchemaMod;
|
|
3111
3113
|
const drizzleMod = await import('drizzle-orm');
|
|
3112
3114
|
const { eq } = drizzleMod;
|
|
@@ -3294,9 +3296,9 @@ const createPropertyInstances = xstate.fromCallback(({ sendBack, input }) => {
|
|
|
3294
3296
|
return;
|
|
3295
3297
|
}
|
|
3296
3298
|
try {
|
|
3297
|
-
const modProp = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
3299
|
+
const modProp = await Promise.resolve().then(function () { return require('./ModelProperty-D9FGaGuE.js'); });
|
|
3298
3300
|
const ModelProperty = modProp?.ModelProperty ?? modProp?.default;
|
|
3299
|
-
const modModel = await Promise.resolve().then(function () { return require('./index-
|
|
3301
|
+
const modModel = await Promise.resolve().then(function () { return require('./index-CSNtEnbF.js'); }).then(function (n) { return n.Model$1; });
|
|
3300
3302
|
const Model = modModel?.Model ?? modModel?.default;
|
|
3301
3303
|
if (!ModelProperty || !Model) {
|
|
3302
3304
|
logger$3('ModelProperty or Model not available from dynamic import');
|
|
@@ -3401,7 +3403,7 @@ const verifyPropertyInstancesInCache = xstate.fromCallback(({ sendBack, input })
|
|
|
3401
3403
|
}
|
|
3402
3404
|
try {
|
|
3403
3405
|
const result = await verifyWithRetry(async () => {
|
|
3404
|
-
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
3406
|
+
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-D9FGaGuE.js'); });
|
|
3405
3407
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
3406
3408
|
if (!ModelProperty) {
|
|
3407
3409
|
throw new Error('ModelProperty not available from dynamic import');
|
|
@@ -5179,7 +5181,7 @@ class Schema {
|
|
|
5179
5181
|
_dbVersion: publishedSchema.version,
|
|
5180
5182
|
});
|
|
5181
5183
|
// Clear edited flags on all ModelProperty instances and in database
|
|
5182
|
-
const modelPropertyMod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
5184
|
+
const modelPropertyMod = await Promise.resolve().then(function () { return require('./ModelProperty-D9FGaGuE.js'); });
|
|
5183
5185
|
const { ModelProperty } = modelPropertyMod;
|
|
5184
5186
|
for (const propertyKey of context._editedProperties) {
|
|
5185
5187
|
const [modelName, propertyName] = propertyKey.split(':');
|
|
@@ -5983,4 +5985,4 @@ var Schema$1 = /*#__PURE__*/Object.freeze({
|
|
|
5983
5985
|
|
|
5984
5986
|
exports.Schema = Schema;
|
|
5985
5987
|
exports.schemaInstanceState = schemaInstanceState;
|
|
5986
|
-
//# sourceMappingURL=Schema-
|
|
5988
|
+
//# sourceMappingURL=Schema-BiJIPLEL.js.map
|