@seedprotocol/sdk 0.4.3 → 0.4.5
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/README.md +38 -348
- package/dist/{ArweaveClient-CleX_4Gw.js → ArweaveClient-CgWK-JgT.js} +8 -8
- package/dist/{ArweaveClient-CleX_4Gw.js.map → ArweaveClient-CgWK-JgT.js.map} +1 -1
- package/dist/{ArweaveClient-BvJ1FhQ5.js → ArweaveClient-WcG8CZAE.js} +8 -8
- package/dist/{ArweaveClient-BvJ1FhQ5.js.map → ArweaveClient-WcG8CZAE.js.map} +1 -1
- package/dist/{Db-DX08SxS9.js → Db-DjFdIdR9.js} +9 -16
- package/dist/{Db-DX08SxS9.js.map → Db-DjFdIdR9.js.map} +1 -1
- package/dist/{Db-BPnO1-_p.js → Db-DjofXdeU.js} +9 -9
- package/dist/{Db-BPnO1-_p.js.map → Db-DjofXdeU.js.map} +1 -1
- package/dist/{EasClient-BwhUcPjY.js → EasClient-Aojewp6P.js} +8 -8
- package/dist/{EasClient-CJSs38Db.js.map → EasClient-Aojewp6P.js.map} +1 -1
- package/dist/{EasClient-CJSs38Db.js → EasClient-BVFXp2O6.js} +8 -8
- package/dist/{EasClient-BwhUcPjY.js.map → EasClient-BVFXp2O6.js.map} +1 -1
- package/dist/{FileManager-B1tdLMsX.js → FileManager-C9zr4AJe.js} +8 -8
- package/dist/{FileManager-B1tdLMsX.js.map → FileManager-C9zr4AJe.js.map} +1 -1
- package/dist/{FileManager-Ct91ZhOE.js → FileManager-CxGJLw5C.js} +8 -8
- package/dist/{FileManager-Ct91ZhOE.js.map → FileManager-CxGJLw5C.js.map} +1 -1
- package/dist/Item/Item.d.ts +28 -7
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/service/actors/runPublish.d.ts +5 -0
- package/dist/Item/service/actors/runPublish.d.ts.map +1 -0
- package/dist/Item/service/itemMachineSingle.d.ts +10 -5
- package/dist/Item/service/itemMachineSingle.d.ts.map +1 -1
- package/dist/ItemProperty/ItemProperty.d.ts +30 -5
- package/dist/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +1 -1
- package/dist/ItemProperty/service/propertyMachine.d.ts +10 -10
- package/dist/ItemProperty/service/propertyMachine.d.ts.map +1 -1
- package/dist/Model/Model.d.ts +27 -20
- package/dist/Model/Model.d.ts.map +1 -1
- package/dist/Model/index.d.ts +1 -1
- package/dist/Model/service/actors/createModelProperties.d.ts.map +1 -1
- package/dist/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
- package/dist/Model/service/actors/validateModel.d.ts.map +1 -1
- package/dist/Model/service/modelMachine.d.ts +18 -3
- package/dist/Model/service/modelMachine.d.ts.map +1 -1
- package/dist/ModelProperty/ModelProperty.d.ts +25 -2
- package/dist/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
- package/dist/ModelProperty/service/actors/saveToSchema.d.ts.map +1 -1
- package/dist/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
- package/dist/ModelProperty/service/modelPropertyMachine.d.ts +17 -3
- package/dist/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
- package/dist/{ModelProperty-Cr3BmgkC.js → ModelProperty-CGdkocQ8.js} +349 -817
- package/dist/ModelProperty-CGdkocQ8.js.map +1 -0
- package/dist/{PathResolver-DJdxE_OK.js → PathResolver-CX6GHoTS.js} +8 -8
- package/dist/{PathResolver-DJdxE_OK.js.map → PathResolver-CX6GHoTS.js.map} +1 -1
- package/dist/{PathResolver-BErmcZqP.js → PathResolver-z_WX47_o.js} +8 -8
- package/dist/{PathResolver-BErmcZqP.js.map → PathResolver-z_WX47_o.js.map} +1 -1
- package/dist/{QueryClient-DIu9c-w6.js → QueryClient-ByKPdRmE.js} +8 -8
- package/dist/{QueryClient-DIu9c-w6.js.map → QueryClient-ByKPdRmE.js.map} +1 -1
- package/dist/{QueryClient-D2mv63gP.js → QueryClient-Cb1iJO-x.js} +8 -8
- package/dist/{QueryClient-D2mv63gP.js.map → QueryClient-Cb1iJO-x.js.map} +1 -1
- package/dist/Schema/Schema.d.ts +24 -3
- package/dist/Schema/Schema.d.ts.map +1 -1
- package/dist/Schema/service/actors/checkExistingSchema.d.ts.map +1 -1
- package/dist/Schema/service/actors/createPropertyInstances.d.ts.map +1 -1
- package/dist/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
- package/dist/Schema/service/actors/verifyPropertyInstancesInCache.d.ts.map +1 -1
- package/dist/Schema/service/actors/writeModelsToDb.d.ts.map +1 -1
- package/dist/Schema/service/actors/writePropertiesToDb.d.ts.map +1 -1
- package/dist/Schema/service/actors/writeSchemaToDb.d.ts.map +1 -1
- package/dist/Schema/service/addModelsMachine.d.ts.map +1 -1
- package/dist/Schema/service/schemaMachine.d.ts +17 -3
- package/dist/Schema/service/schemaMachine.d.ts.map +1 -1
- package/dist/{Schema-DeKabJ0T.js → Schema-D1eqDHyt.js} +995 -186
- package/dist/Schema-D1eqDHyt.js.map +1 -0
- package/dist/{SchemaValidationService-cTlURuDt.js → SchemaValidationService-DyttFaV_.js} +7 -7
- package/dist/{SchemaValidationService-cTlURuDt.js.map → SchemaValidationService-DyttFaV_.js.map} +1 -1
- package/dist/browser/db/Db.d.ts.map +1 -1
- package/dist/browser/react/SeedProvider.d.ts +30 -0
- package/dist/browser/react/SeedProvider.d.ts.map +1 -0
- package/dist/browser/react/index.d.ts +4 -1
- package/dist/browser/react/index.d.ts.map +1 -1
- package/dist/browser/react/item.d.ts +10 -6
- package/dist/browser/react/item.d.ts.map +1 -1
- package/dist/browser/react/itemProperty.d.ts +37 -1
- package/dist/browser/react/itemProperty.d.ts.map +1 -1
- package/dist/browser/react/liveQuery.d.ts.map +1 -1
- package/dist/browser/react/model.d.ts +21 -7
- package/dist/browser/react/model.d.ts.map +1 -1
- package/dist/browser/react/modelProperty.d.ts +23 -0
- package/dist/browser/react/modelProperty.d.ts.map +1 -1
- package/dist/browser/react/queryClient.d.ts +28 -0
- package/dist/browser/react/queryClient.d.ts.map +1 -0
- package/dist/browser/react/schema.d.ts +8 -0
- package/dist/browser/react/schema.d.ts.map +1 -1
- package/dist/browser/react/trash.d.ts +5 -2
- package/dist/browser/react/trash.d.ts.map +1 -1
- package/dist/cjs/{ModelProperty-MkN5Rmx7.js → ModelProperty-BeJvgKMw.js} +377 -477
- package/dist/cjs/ModelProperty-BeJvgKMw.js.map +1 -0
- package/dist/cjs/{Schema-B5cr_JVK.js → Schema-CVs9J6eP.js} +709 -263
- package/dist/cjs/Schema-CVs9J6eP.js.map +1 -0
- package/dist/cjs/{SchemaValidationService-BgIzc3-r.js → SchemaValidationService-CDKcVRFQ.js} +4 -4
- package/dist/cjs/{SchemaValidationService-BgIzc3-r.js.map → SchemaValidationService-CDKcVRFQ.js.map} +1 -1
- package/dist/cjs/{getItem-CVJJPky2.js → getItem-B5RYPvrG.js} +4 -4
- package/dist/cjs/{getItem-CVJJPky2.js.map → getItem-B5RYPvrG.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-DbOc3WA-.js → getPublishPayload-BD1qRob1.js} +26 -11
- package/dist/cjs/getPublishPayload-BD1qRob1.js.map +1 -0
- package/dist/cjs/{getPublishUploads-NzioLz-3.js → getPublishUploads-CnC9aYxs.js} +5 -5
- package/dist/cjs/getPublishUploads-CnC9aYxs.js.map +1 -0
- package/dist/cjs/{getSegmentedItemProperties-BsaklLwI.js → getSegmentedItemProperties-B_njnntx.js} +2 -2
- package/dist/cjs/{getSegmentedItemProperties-BsaklLwI.js.map → getSegmentedItemProperties-B_njnntx.js.map} +1 -1
- package/dist/cjs/{index-BmIVfqGN.js → index-BeKPbbk0.js} +12715 -12384
- package/dist/cjs/index-BeKPbbk0.js.map +1 -0
- package/dist/cjs/{index-C_0angRB.js → index-Dnywap_P.js} +4 -4
- package/dist/cjs/index-Dnywap_P.js.map +1 -0
- package/dist/client/actors/platformClassesInit.d.ts.map +1 -1
- package/dist/client/actors/processSchemaFiles.d.ts.map +1 -1
- package/dist/client/actors/saveAppState.d.ts.map +1 -1
- package/dist/db/read/getItemData.d.ts.map +1 -1
- package/dist/db/read/getItems.d.ts.map +1 -1
- package/dist/db/read/getModelPropertiesData.d.ts +19 -0
- package/dist/db/read/getModelPropertiesData.d.ts.map +1 -0
- package/dist/db/read/getModelsData.d.ts +15 -0
- package/dist/db/read/getModelsData.d.ts.map +1 -0
- package/dist/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/db/read/getPublishUploads.d.ts +1 -7
- package/dist/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/db/read/getSchemaUidForModel.d.ts.map +1 -1
- package/dist/db/write/updateSeedUid.d.ts +7 -0
- package/dist/db/write/updateSeedUid.d.ts.map +1 -0
- package/dist/eas.d.ts.map +1 -1
- package/dist/events/item/index.d.ts.map +1 -1
- package/dist/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/{getItem-CcttmUY_.js → getItem-BB5HBCbK.js} +8 -8
- package/dist/{getItem-CcttmUY_.js.map → getItem-BB5HBCbK.js.map} +1 -1
- package/dist/{getPublishPayload-NFpqbd_H.js → getPublishPayload-uLm0AqN_.js} +29 -14
- package/dist/getPublishPayload-uLm0AqN_.js.map +1 -0
- package/dist/{getPublishUploads-Cpb9vgwE.js → getPublishUploads-Dc-HqhO8.js} +9 -9
- package/dist/getPublishUploads-Dc-HqhO8.js.map +1 -0
- package/dist/{getSegmentedItemProperties-DiyQPMgI.js → getSegmentedItemProperties-BrIqFNfD.js} +2 -2
- package/dist/{getSegmentedItemProperties-DiyQPMgI.js.map → getSegmentedItemProperties-BrIqFNfD.js.map} +1 -1
- package/dist/helpers/db.d.ts +12 -0
- package/dist/helpers/db.d.ts.map +1 -1
- package/dist/helpers/entity/entityDestroy.d.ts +41 -0
- package/dist/helpers/entity/entityDestroy.d.ts.map +1 -0
- package/dist/helpers/entity/index.d.ts +1 -0
- package/dist/helpers/entity/index.d.ts.map +1 -1
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/property/index.d.ts +12 -12
- package/dist/helpers/property/index.d.ts.map +1 -1
- package/dist/helpers/reactiveProxy.d.ts.map +1 -1
- package/dist/helpers/schema.d.ts.map +1 -1
- package/dist/helpers/updateSchema.d.ts +9 -0
- package/dist/helpers/updateSchema.d.ts.map +1 -1
- package/dist/helpers/waitForEntityIdle.d.ts +2 -2
- package/dist/helpers/waitForEntityIdle.d.ts.map +1 -1
- package/dist/imports/json.d.ts.map +1 -1
- package/dist/{index-r45w9hEq.js → index-2FcQHgKp.js} +2 -2
- package/dist/index-2FcQHgKp.js.map +1 -0
- package/dist/{json-I3vJhXo8.js → index-DPll6EAp.js} +12450 -12121
- package/dist/index-DPll6EAp.js.map +1 -0
- package/dist/{index-CRuq6HVi.js → index-LEY0Og1p.js} +9 -9
- package/dist/index-LEY0Og1p.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/interfaces/IItem.d.ts +2 -0
- package/dist/interfaces/IItem.d.ts.map +1 -1
- package/dist/interfaces/IItemProperty.d.ts +1 -0
- package/dist/interfaces/IItemProperty.d.ts.map +1 -1
- package/dist/main.cjs +3 -3
- package/dist/main.js +999 -1033
- package/dist/main.js.map +1 -1
- package/dist/node.js +16 -16
- package/dist/node.js.map +1 -1
- package/dist/{property-Dy09KTxg.js → property-B15X7jLX.js} +7 -5
- package/dist/property-B15X7jLX.js.map +1 -0
- package/dist/{queries-LZYSuhtz.js → queries-BPDSpiEX.js} +2 -2
- package/dist/{queries-LZYSuhtz.js.map → queries-BPDSpiEX.js.map} +1 -1
- package/dist/services/write/actors/validateEntity.d.ts.map +1 -1
- package/dist/services/write/actors/writeToDatabase.d.ts.map +1 -1
- package/dist/services/write/writeProcessMachine.d.ts +1 -1
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/item.d.ts +12 -0
- package/dist/types/item.d.ts.map +1 -1
- package/dist/types/property.d.ts +6 -0
- package/dist/types/property.d.ts.map +1 -1
- package/dist/types/publish.d.ts +9 -0
- package/dist/types/publish.d.ts.map +1 -0
- package/package.json +12 -4
- package/dist/ModelProperty-Cr3BmgkC.js.map +0 -1
- package/dist/Schema-DeKabJ0T.js.map +0 -1
- package/dist/cjs/ModelProperty-MkN5Rmx7.js.map +0 -1
- package/dist/cjs/Schema-B5cr_JVK.js.map +0 -1
- package/dist/cjs/getPublishPayload-DbOc3WA-.js.map +0 -1
- package/dist/cjs/getPublishUploads-NzioLz-3.js.map +0 -1
- package/dist/cjs/index-BmIVfqGN.js.map +0 -1
- package/dist/cjs/index-C_0angRB.js.map +0 -1
- package/dist/events/item/publish.d.ts +0 -7
- package/dist/events/item/publish.d.ts.map +0 -1
- package/dist/getPublishPayload-NFpqbd_H.js.map +0 -1
- package/dist/getPublishUploads-Cpb9vgwE.js.map +0 -1
- package/dist/index-CRuq6HVi.js.map +0 -1
- package/dist/index-r45w9hEq.js.map +0 -1
- package/dist/json-I3vJhXo8.js.map +0 -1
- package/dist/property-Dy09KTxg.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelProperty-BeJvgKMw.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 { convertPropertyToSchemaUpdate, updateModelProperties, getModelNameFromId } from '@/helpers/updateSchema'\n// Dynamic import to break circular dependency: schema/index -> ... -> saveToSchema -> SchemaValidationService -> schema/index\n// import { SchemaValidationService } from '@/Schema/service/validation/SchemaValidationService'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport debug from 'debug'\n\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 { listLatestSchemaFiles } = await import('../../../helpers/schema')\n const latestSchemas = await listLatestSchemaFiles()\n\n for (const schema of latestSchemas) {\n try {\n const { BaseFileManager } = await import('../../../helpers/FileManager/BaseFileManager')\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 { SchemaValidationService } = await import('../../../Schema/service/validation/SchemaValidationService')\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 // Get schema name from model\n const schemaName = await getSchemaNameFromModel(context.modelName)\n if (!schemaName) {\n throw new Error(`Schema not found for model: ${context.modelName}`)\n }\n\n // Convert property context to SchemaPropertyUpdate\n const propertyUpdate = await convertPropertyToSchemaUpdate(\n context,\n context.modelName,\n context.name,\n )\n\n // Update the schema with the property changes\n await updateModelProperties(schemaName, [propertyUpdate])\n\n // Clear isEdited flag in database after saving to schema file\n try {\n const { properties: propertiesTable, models: modelsTable } = await import('../../../seedSchema')\n const { eq, and } = await import('drizzle-orm')\n \n const db = BaseDb.getAppDb()\n if (db && context.modelName && context.name) {\n // Find model by name\n const modelRecords = await db\n .select({ id: modelsTable.id })\n .from(modelsTable)\n .where(eq(modelsTable.name, context.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, context.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 ${context.modelName}:${context.name}`)\n }\n }\n }\n } catch (error) {\n logger(`Error clearing isEdited flag in database: ${error}`)\n }\n\n logger(`Successfully saved property ${context.name} to schema ${schemaName}`)\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 { getPropertyModelNameAndDataType, getModelNameByModelId } = await import('../../../helpers/db')\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 { savePropertyToDb } = await import('../../../helpers/db')\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']\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 { savePropertyToDb } = await import('../../../helpers/db')\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 { Schema } = await import('../../../Schema/Schema')\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 { properties: propertiesTable, models: modelsTable } = await import('../../../seedSchema')\n const { eq, and } = await import('drizzle-orm')\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 { getPropertyModelNameAndDataType, getModelNameByModelId } = await import('../../../helpers/db')\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 console.log('[validateProperty] Starting validation for property:', fullContext.name)\n console.log('[validateProperty] Context:', { \n name: fullContext.name, \n modelName: fullContext.modelName, \n _schemaName: fullContext._schemaName,\n _originalValues: fullContext._originalValues \n })\n // Use dynamic imports to break circular dependencies\n const { SchemaValidationService } = await import('../../../Schema/service/validation/SchemaValidationService')\n const validationService = new SchemaValidationService()\n const { Schema } = await import('../../../Schema/Schema')\n \n // Validate property structure\n console.log('[validateProperty] Validating property structure...')\n const structureResult = validationService.validatePropertyStructure(fullContext)\n console.log('[validateProperty] Structure validation result:', structureResult.isValid)\n \n if (!structureResult.isValid) {\n console.log('[validateProperty] Structure validation failed:', structureResult.errors)\n sendBack({ type: 'validationError', errors: structureResult.errors })\n return\n }\n console.log('[validateProperty] Structure validation passed')\n\n // If we have schema name and model name, validate against schema\n console.log('[validateProperty] Checking schema validation:', { hasSchemaName: !!fullContext._schemaName, hasModelName: !!fullContext.modelName })\n if (fullContext._schemaName && fullContext.modelName) {\n try {\n console.log('[validateProperty] Creating schema instance:', fullContext._schemaName)\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 console.log('[validateProperty] Schema status:', schemaStatus)\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 console.log('[validateProperty] Schema context models:', schemaContext.models ? Object.keys(schemaContext.models).length : 'null')\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 console.log('[validateProperty] Validating against schema:', { \n modelName: fullContext.modelName, \n propertyNameToValidate,\n originalName: fullContext._originalValues?.name,\n currentName: fullContext.name \n })\n const schemaResult = validationService.validateProperty(\n schemaContext,\n fullContext.modelName,\n propertyNameToValidate,\n fullContext\n )\n console.log('[validateProperty] Schema validation result:', { isValid: schemaResult.isValid, errors: schemaResult.errors.length, errorCodes: schemaResult.errors.map(e => e.code) })\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 console.log('[validateProperty] Filtered critical errors:', { \n totalErrors: schemaResult.errors.length, \n criticalErrors: criticalErrors.length,\n errorCodes: schemaResult.errors.map(e => e.code),\n criticalErrorCodes: criticalErrors.map(e => e.code)\n })\n \n if (criticalErrors.length > 0) {\n console.log('[validateProperty] Sending validationError with critical errors')\n sendBack({ type: 'validationError', errors: criticalErrors })\n return\n }\n console.log('[validateProperty] No critical errors, continuing with validation')\n // Continue with validation - rename-related errors are acceptable\n }\n } else {\n console.log('[validateProperty] Schema models not loaded yet, skipping schema validation')\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 console.log('[validateProperty] Error validating property against schema:', error)\n logger('Error validating property against schema:', error)\n // Continue with structure validation only\n }\n } else {\n console.log('[validateProperty] Skipping schema validation (no _schemaName or modelName)')\n }\n\n // All validations passed\n console.log('[validateProperty] All validations passed, sending validationSuccess')\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 return !context._validationErrors || context._validationErrors.length === 0\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 console.log('[modelPropertyMachine] Initializing context with input:', JSON.stringify({\n name: context.name,\n modelName: context.modelName,\n ref: context.ref,\n refModelName: context.refModelName,\n refModelId: context.refModelId,\n dataType: context.dataType,\n }, null, 2))\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 // Debug logging\n if (event.name !== undefined) {\n console.log(`[modelPropertyMachine] updateContext with name change: \"${context.name}\" -> \"${event.name}\"`)\n console.log(`[modelPropertyMachine] onlyInternalFields: ${onlyInternalFields}, has _originalValues: ${!!context._originalValues}`)\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 if (event.name !== undefined) {\n console.log(`[modelPropertyMachine] updateContext guard result: ${shouldTransition} (will ${shouldTransition ? 'transition' : 'not transition'} to validating)`)\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 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 on: {\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 },\n validating: {\n entry: () => {\n console.log('[modelPropertyMachine] Entered validating state')\n },\n on: {\n validationSuccess: {\n target: 'compareAndMarkDraft',\n actions: assign(({ context, event }) => {\n console.log('[modelPropertyMachine] validationSuccess, transitioning to compareAndMarkDraft')\n return {\n ...context,\n _validationErrors: [],\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 invoke: {\n src: 'validateProperty',\n input: ({ context }) => ({ context }),\n },\n },\n compareAndMarkDraft: {\n entry: () => {\n console.log('[modelPropertyMachine] Entered compareAndMarkDraft state')\n },\n on: {\n compareAndMarkDraftSuccess: {\n target: 'idle',\n },\n compareAndMarkDraftError: {\n target: 'idle',\n },\n },\n invoke: {\n src: 'compareAndMarkDraft',\n input: ({ context }: { context: ModelPropertyMachineContext }) => {\n console.log('[modelPropertyMachine] Invoking compareAndMarkDraft with context:', {\n name: context.name,\n _originalValues: context._originalValues,\n modelName: context.modelName,\n id: context.id,\n _propertyFileId: context._propertyFileId\n })\n return { context }\n },\n },\n },\n saveToSchema: {\n always: {\n guard: 'isPropertyValid',\n target: '.saving',\n },\n initial: 'saving',\n on: {\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 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 } 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 * 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 },\n ): ModelProperty\n static create(\n property: Static<typeof TProperty>,\n options?: { waitForReady?: true; readyTimeout?: number },\n ): Promise<ModelProperty>\n static create(\n property: Static<typeof TProperty>,\n options?: CreateWaitOptions,\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\n // Debug: Log what's being passed to create()\n console.log(`[ModelProperty.create] Input property data:`, JSON.stringify({\n name: property.name,\n modelName: property.modelName,\n ref: property.ref,\n refModelName: property.refModelName,\n refModelId: property.refModelId,\n dataType: property.dataType,\n type: (property as any).type, // Check if it's using 'type' instead of 'dataType'\n }, null, 2))\n\n // Handle 'type' field from JSON schema format - convert to 'dataType'\n const propertyWithId = { ...property }\n if ((propertyWithId as any).type && !propertyWithId.dataType) {\n propertyWithId.dataType = (propertyWithId as any).type\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 console.log(`[ModelProperty.create] Returning cached instance for ${cacheKey}, context has ref:`, cachedContext.ref)\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 console.log(`[ModelProperty.create] Updating cached instance with missing fields:`, needsUpdate)\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 // Debug: Log what's being passed to the constructor\n console.log(`[ModelProperty.create] propertyWithId before constructor:`, JSON.stringify({\n name: propertyWithId.name,\n modelName: propertyWithId.modelName,\n ref: propertyWithId.ref,\n refModelName: propertyWithId.refModelName,\n refModelId: propertyWithId.refModelId,\n dataType: propertyWithId.dataType,\n }, null, 2))\n \n const newInstance = new this(propertyWithId)\n \n // Debug: Log what's being passed to the constructor\n console.log(`[ModelProperty.create] Creating instance for ${propertyWithId.modelName}:${propertyWithId.name}`, {\n ref: propertyWithId.ref,\n refModelName: propertyWithId.refModelName,\n refModelId: propertyWithId.refModelId,\n dataType: propertyWithId.dataType\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 if (prop === 'name') {\n const currentContext = instance._getSnapshotContext()\n console.log(`[ModelProperty.sendUpdate] Name change: \"${currentContext.name}\" -> \"${value}\"`)\n console.log(`[ModelProperty.sendUpdate] Current state: ${instance._service.getSnapshot().value}`)\n console.log(`[ModelProperty.sendUpdate] Has _originalValues: ${!!currentContext._originalValues}`)\n }\n instance._service.send({\n type: 'updateContext',\n [prop]: value,\n })\n if (prop === 'name') {\n // Check state after sending\n setTimeout(() => {\n const newState = instance._service.getSnapshot().value\n console.log(`[ModelProperty.sendUpdate] State after name change: ${newState}`)\n }, 10)\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 console.log('db', !!db)\n if (!db) {\n console.log('db not found')\n return undefined\n }\n\n const testRecords = await db\n .select()\n .from(propertiesTable)\n .limit(100)\n\n console.log('testRecords', testRecords)\n\n const propertyRecords = await db\n .select()\n .from(propertiesTable)\n .where(eq(propertiesTable.schemaFileId, propertyFileId))\n .limit(1)\n\n console.log('propertyRecords', propertyRecords)\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 }\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 // 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 const schemaName = context._schemaName\n const modelName = context.modelName\n const propertyName = context.name\n if (!modelName || !propertyName) return\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","convertPropertyToSchemaUpdate","updateModelProperties","BaseDb","setup","writeProcessMachine","assign","modelsTable","eq","propertiesTable","createActor","and","Model","modelPropertiesToObject","schemas","modelSchemas","generateId","waitForEntityIdle","createReactiveProxy","getModelIdByFileId","getModelId","findEntity","BaseFileManager","forceRemoveFromCaches","runDestroyLifecycle","Schema"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAMA,QAAM,GAAG,KAAK,CAAC,2CAA2C,CAAC;AAEjE;;;;AAIG;AACI,eAAe,sBAAsB,CAAC,SAAiB,EAAA;;IAE5D,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,oDAAO,qBAAyB,+CAAC;AACzE,IAAA,MAAM,aAAa,GAAG,MAAM,qBAAqB,EAAE;AAEnD,IAAA,KAAK,MAAM,MAAM,IAAI,aAAa,EAAE;AAClC,QAAA,IAAI;YACF,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,oDAAO,qBAA8C,wDAAC;YACxF,MAAM,OAAO,GAAG,MAAM,eA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