@seedprotocol/sdk 0.4.1 → 0.4.3
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/ArweaveClient-BvJ1FhQ5.js +202 -0
- package/dist/ArweaveClient-BvJ1FhQ5.js.map +1 -0
- package/dist/ArweaveClient-CleX_4Gw.js +202 -0
- package/dist/ArweaveClient-CleX_4Gw.js.map +1 -0
- package/dist/Db-BPnO1-_p.js +343 -0
- package/dist/Db-BPnO1-_p.js.map +1 -0
- package/dist/Db-DX08SxS9.js +1521 -0
- package/dist/Db-DX08SxS9.js.map +1 -0
- package/dist/EasClient-BwhUcPjY.js +29 -0
- package/dist/EasClient-BwhUcPjY.js.map +1 -0
- package/dist/EasClient-CJSs38Db.js +29 -0
- package/dist/EasClient-CJSs38Db.js.map +1 -0
- package/dist/FileManager-B1tdLMsX.js +1152 -0
- package/dist/FileManager-B1tdLMsX.js.map +1 -0
- package/dist/FileManager-Ct91ZhOE.js +165 -0
- package/dist/FileManager-Ct91ZhOE.js.map +1 -0
- package/dist/Item/Item.d.ts +113 -0
- package/dist/Item/Item.d.ts.map +1 -0
- package/dist/Item/queries.d.ts.map +1 -0
- package/dist/Item/service/actors/fetchDataFromEas.d.ts +4 -0
- package/dist/Item/service/actors/fetchDataFromEas.d.ts.map +1 -0
- package/dist/Item/service/actors/hydrateExistingItem.d.ts.map +1 -0
- package/dist/Item/service/actors/hydrateNewItem.d.ts.map +1 -0
- package/dist/Item/service/actors/initialize.d.ts.map +1 -0
- package/dist/Item/service/actors/loadOrCreateItem.d.ts.map +1 -0
- package/dist/Item/service/actors/reload.d.ts.map +1 -0
- package/dist/Item/service/actors/saveDataToDb.d.ts +4 -0
- package/dist/Item/service/actors/saveDataToDb.d.ts.map +1 -0
- package/dist/Item/service/actors/waitForDb.d.ts.map +1 -0
- package/dist/Item/service/itemMachineSingle.d.ts +48 -0
- package/dist/Item/service/itemMachineSingle.d.ts.map +1 -0
- package/dist/ItemProperty/ItemProperty.d.ts +93 -0
- package/dist/ItemProperty/ItemProperty.d.ts.map +1 -0
- package/dist/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -0
- package/dist/ItemProperty/service/actors/initialize.d.ts.map +1 -0
- package/dist/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +1 -0
- package/dist/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -0
- package/dist/ItemProperty/service/actors/resolveRemoteStorage.d.ts.map +1 -0
- package/dist/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -0
- package/dist/ItemProperty/service/actors/saveValueToDb/index.d.ts.map +1 -0
- package/dist/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +1 -0
- package/dist/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -0
- package/dist/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +1 -0
- package/dist/ItemProperty/service/actors/waitForDb.d.ts.map +1 -0
- package/dist/ItemProperty/service/propertyMachine.d.ts +68 -0
- package/dist/ItemProperty/service/propertyMachine.d.ts.map +1 -0
- package/dist/Model/Model.d.ts +218 -0
- package/dist/Model/Model.d.ts.map +1 -0
- package/dist/Model/index.d.ts +26 -0
- package/dist/Model/index.d.ts.map +1 -0
- package/dist/Model/service/actors/createModelProperties.d.ts.map +1 -0
- package/dist/Model/service/actors/loadOrCreateModel.d.ts.map +1 -0
- package/dist/Model/service/actors/validateModel.d.ts.map +1 -0
- package/dist/Model/service/modelMachine.d.ts +207 -0
- package/dist/Model/service/modelMachine.d.ts.map +1 -0
- package/dist/ModelProperty/ModelProperty.d.ts +123 -0
- package/dist/ModelProperty/ModelProperty.d.ts.map +1 -0
- package/dist/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -0
- package/dist/ModelProperty/service/actors/saveToSchema.d.ts.map +1 -0
- package/dist/ModelProperty/service/actors/validateProperty.d.ts.map +1 -0
- package/dist/ModelProperty/service/modelPropertyMachine.d.ts +183 -0
- package/dist/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -0
- package/dist/ModelProperty-Cr3BmgkC.js +2218 -0
- package/dist/ModelProperty-Cr3BmgkC.js.map +1 -0
- package/dist/PathResolver-BErmcZqP.js +191 -0
- package/dist/PathResolver-BErmcZqP.js.map +1 -0
- package/dist/PathResolver-DJdxE_OK.js +78 -0
- package/dist/PathResolver-DJdxE_OK.js.map +1 -0
- package/dist/QueryClient-D2mv63gP.js +34 -0
- package/dist/QueryClient-D2mv63gP.js.map +1 -0
- package/dist/QueryClient-DIu9c-w6.js +47 -0
- package/dist/QueryClient-DIu9c-w6.js.map +1 -0
- package/dist/Schema/Schema.d.ts +165 -0
- package/dist/Schema/Schema.d.ts.map +1 -0
- package/dist/Schema/errors.d.ts.map +1 -0
- package/dist/Schema/index.d.ts.map +1 -0
- package/dist/Schema/service/actors/checkExistingSchema.d.ts.map +1 -0
- package/dist/Schema/service/actors/createModelInstances.d.ts.map +1 -0
- package/dist/Schema/service/actors/createPropertyInstances.d.ts.map +1 -0
- package/dist/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -0
- package/dist/Schema/service/actors/validateSchema.d.ts.map +1 -0
- package/dist/Schema/service/actors/verifyModelInstancesInCache.d.ts.map +1 -0
- package/dist/Schema/service/actors/verifyModelsInDb.d.ts.map +1 -0
- package/dist/Schema/service/actors/verifyPropertiesInDb.d.ts.map +1 -0
- package/dist/Schema/service/actors/verifyPropertyInstancesInCache.d.ts.map +1 -0
- package/dist/Schema/service/actors/verifySchemaInDb.d.ts.map +1 -0
- package/dist/Schema/service/actors/writeModelsToDb.d.ts.map +1 -0
- package/dist/Schema/service/actors/writePropertiesToDb.d.ts.map +1 -0
- package/dist/Schema/service/actors/writeSchemaToDb.d.ts.map +1 -0
- package/dist/Schema/service/addModelsMachine.d.ts +123 -0
- package/dist/Schema/service/addModelsMachine.d.ts.map +1 -0
- package/dist/Schema/service/schemaMachine.d.ts +512 -0
- package/dist/Schema/service/schemaMachine.d.ts.map +1 -0
- package/dist/Schema/service/validation/SchemaValidationService.d.ts.map +1 -0
- package/dist/Schema/validation.d.ts.map +1 -0
- package/dist/Schema-DeKabJ0T.js +5745 -0
- package/dist/Schema-DeKabJ0T.js.map +1 -0
- package/dist/SchemaValidationService-cTlURuDt.js +563 -0
- package/dist/SchemaValidationService-cTlURuDt.js.map +1 -0
- package/dist/browser/db/Db.d.ts.map +1 -0
- package/dist/browser/db/drizzleFiles.d.ts.map +1 -0
- package/dist/browser/db/sqlWasmClient.d.ts.map +1 -0
- package/dist/browser/helpers/ArweaveClient.d.ts +31 -0
- package/dist/browser/helpers/ArweaveClient.d.ts.map +1 -0
- package/dist/browser/helpers/EasClient.d.ts.map +1 -0
- package/dist/browser/helpers/FileManager.d.ts.map +1 -0
- package/dist/browser/helpers/PathResolver.d.ts.map +1 -0
- package/dist/browser/helpers/QueryClient.d.ts.map +1 -0
- package/dist/browser/helpers/index.d.ts +4 -0
- package/dist/browser/helpers/index.d.ts.map +1 -0
- package/dist/browser/index.d.ts +4 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/react/OPFSImage.d.ts.map +1 -0
- package/dist/browser/react/SeedImage.d.ts.map +1 -0
- package/dist/browser/react/client.d.ts.map +1 -0
- package/dist/browser/react/db.d.ts.map +1 -0
- package/dist/browser/react/index.d.ts.map +1 -0
- package/dist/browser/react/item.d.ts +38 -0
- package/dist/browser/react/item.d.ts.map +1 -0
- package/dist/browser/react/itemProperty.d.ts.map +1 -0
- package/dist/browser/react/liveQuery.d.ts.map +1 -0
- package/dist/browser/react/model.d.ts.map +1 -0
- package/dist/browser/react/modelProperty.d.ts.map +1 -0
- package/dist/browser/react/schema.d.ts.map +1 -0
- package/dist/browser/react/services.d.ts.map +1 -0
- package/dist/browser/react/trash.d.ts +6 -0
- package/dist/browser/react/trash.d.ts.map +1 -0
- package/dist/browser/seed.d.ts +21 -0
- package/dist/browser/seed.d.ts.map +1 -0
- package/dist/browser/workers/FileDownloader.d.ts.map +1 -0
- package/dist/browser/workers/ImageResizer.d.ts.map +1 -0
- package/dist/browser/workers/content-hash.d.ts.map +1 -0
- package/dist/browser/workers/dbWorker.d.ts.map +1 -0
- package/dist/browser/workers/filesDownload.d.ts.map +1 -0
- package/dist/browser/workers/imageResize.d.ts.map +1 -0
- package/dist/cjs/ModelProperty-MkN5Rmx7.js +1866 -0
- package/dist/cjs/ModelProperty-MkN5Rmx7.js.map +1 -0
- package/dist/cjs/Schema-B5cr_JVK.js +5762 -0
- package/dist/cjs/Schema-B5cr_JVK.js.map +1 -0
- package/dist/cjs/SchemaValidationService-BgIzc3-r.js +579 -0
- package/dist/cjs/SchemaValidationService-BgIzc3-r.js.map +1 -0
- package/dist/cjs/getItem-CVJJPky2.js +55 -0
- package/dist/cjs/getItem-CVJJPky2.js.map +1 -0
- package/dist/cjs/getPublishPayload-DbOc3WA-.js +323 -0
- package/dist/cjs/getPublishPayload-DbOc3WA-.js.map +1 -0
- package/dist/cjs/getPublishUploads-NzioLz-3.js +229 -0
- package/dist/cjs/getPublishUploads-NzioLz-3.js.map +1 -0
- package/dist/cjs/getSegmentedItemProperties-BsaklLwI.js +61 -0
- package/dist/cjs/getSegmentedItemProperties-BsaklLwI.js.map +1 -0
- package/dist/cjs/index-BmIVfqGN.js +16231 -0
- package/dist/cjs/index-BmIVfqGN.js.map +1 -0
- package/dist/cjs/index-C_0angRB.js +57 -0
- package/dist/cjs/index-C_0angRB.js.map +1 -0
- package/dist/client/BaseClientManager.d.ts.map +1 -0
- package/dist/client/ClientManager.d.ts.map +1 -0
- package/dist/client/actions/setAddresses.d.ts.map +1 -0
- package/dist/client/actors/addModelsToDb.d.ts.map +1 -0
- package/dist/client/actors/addModelsToStore.d.ts.map +1 -0
- package/dist/client/actors/dbInit.d.ts.map +1 -0
- package/dist/client/actors/fileSystemInit.d.ts.map +1 -0
- package/dist/client/actors/platformClassesInit.d.ts.map +1 -0
- package/dist/client/actors/processSchemaFiles.d.ts.map +1 -0
- package/dist/client/actors/saveAppState.d.ts.map +1 -0
- package/dist/client/actors/saveConfig.d.ts.map +1 -0
- package/dist/client/clientManagerMachine.d.ts.map +1 -0
- package/dist/client/constants.d.ts +89 -0
- package/dist/client/constants.d.ts.map +1 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/db/Db/BaseDb.d.ts +42 -0
- package/dist/db/Db/BaseDb.d.ts.map +1 -0
- package/dist/db/configs/dev.schema.config.d.ts.map +1 -0
- package/dist/db/read/getExistingItem.d.ts +12 -0
- package/dist/db/read/getExistingItem.d.ts.map +1 -0
- package/dist/db/read/getItem.d.ts.map +1 -0
- package/dist/db/read/getItemData.d.ts.map +1 -0
- package/dist/db/read/getItemProperties.d.ts.map +1 -0
- package/dist/db/read/getItemProperty.d.ts.map +1 -0
- package/dist/db/read/getItems.d.ts.map +1 -0
- package/dist/db/read/getMetadata.d.ts.map +1 -0
- package/dist/db/read/getModelSchemas.d.ts.map +1 -0
- package/dist/db/read/getModels.d.ts.map +1 -0
- package/dist/db/read/getPropertyData.d.ts.map +1 -0
- package/dist/db/read/getPublishPayload.d.ts.map +1 -0
- package/dist/db/read/getPublishUploads.d.ts +16 -0
- package/dist/db/read/getPublishUploads.d.ts.map +1 -0
- package/dist/db/read/getRelationValueData.d.ts.map +1 -0
- package/dist/db/read/getSchemaUidForModel.d.ts.map +1 -0
- package/dist/db/read/getSeedData.d.ts.map +1 -0
- package/dist/db/read/getStorageTransactionIdForSeedUid.d.ts.map +1 -0
- package/dist/db/read/getVersionData.d.ts.map +1 -0
- package/dist/db/read/getVersionsForVersionUids.d.ts.map +1 -0
- package/dist/db/read/subqueries/metadataLatest.d.ts.map +1 -0
- package/dist/db/read/subqueries/versionData.d.ts.map +1 -0
- package/dist/db/write/createMetadata.d.ts.map +1 -0
- package/dist/db/write/createNewItem.d.ts.map +1 -0
- package/dist/db/write/createSeed.d.ts.map +1 -0
- package/dist/db/write/createSeeds.d.ts.map +1 -0
- package/dist/db/write/createVersion.d.ts.map +1 -0
- package/dist/db/write/deleteItem.d.ts.map +1 -0
- package/dist/db/write/recoverDeletedItem.d.ts.map +1 -0
- package/dist/db/write/saveAppState.d.ts.map +1 -0
- package/dist/db/write/saveMetadata.d.ts.map +1 -0
- package/dist/db/write/updateItemPropertyValue.d.ts +13 -0
- package/dist/db/write/updateItemPropertyValue.d.ts.map +1 -0
- package/dist/db/write/updateMetadata.d.ts.map +1 -0
- package/dist/eas.d.ts.map +1 -0
- package/dist/eslint-rules/align-imports.d.ts.map +1 -0
- package/dist/eventBus.d.ts.map +1 -0
- package/dist/events/files/download.d.ts +9 -0
- package/dist/events/files/download.d.ts.map +1 -0
- package/dist/events/files/index.d.ts.map +1 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/item/index.d.ts +2 -0
- package/dist/events/item/index.d.ts.map +1 -0
- package/dist/events/item/publish.d.ts.map +1 -0
- package/dist/events/item/syncDbWithEas.d.ts.map +1 -0
- package/dist/events/services/allItems.d.ts.map +1 -0
- package/dist/events/services/index.d.ts.map +1 -0
- package/dist/feed.d.ts.map +1 -0
- package/dist/getItem-CcttmUY_.js +38 -0
- package/dist/getItem-CcttmUY_.js.map +1 -0
- package/dist/getPublishPayload-NFpqbd_H.js +307 -0
- package/dist/getPublishPayload-NFpqbd_H.js.map +1 -0
- package/dist/getPublishUploads-Cpb9vgwE.js +193 -0
- package/dist/getPublishUploads-Cpb9vgwE.js.map +1 -0
- package/dist/getSegmentedItemProperties-DiyQPMgI.js +59 -0
- package/dist/getSegmentedItemProperties-DiyQPMgI.js.map +1 -0
- package/dist/graphql/fragments/Attestation.d.ts.map +1 -0
- package/dist/graphql/fragments/Schema.d.ts.map +1 -0
- package/dist/graphql/fragments/index.d.ts.map +1 -0
- package/dist/graphql/gql/fragment-masking.d.ts.map +1 -0
- package/dist/graphql/gql/gql.d.ts.map +1 -0
- package/dist/graphql/gql/graphql.d.ts.map +1 -0
- package/dist/graphql/gql/index.d.ts.map +1 -0
- package/dist/helpers/ArweaveClient/BaseArweaveClient.d.ts +71 -0
- package/dist/helpers/ArweaveClient/BaseArweaveClient.d.ts.map +1 -0
- package/dist/helpers/ArweaveClient/index.d.ts +30 -0
- package/dist/helpers/ArweaveClient/index.d.ts.map +1 -0
- package/dist/helpers/ArweaveClient/queries.d.ts +13 -0
- package/dist/helpers/ArweaveClient/queries.d.ts.map +1 -0
- package/dist/helpers/EasClient/BaseEasClient.d.ts +10 -0
- package/dist/helpers/EasClient/BaseEasClient.d.ts.map +1 -0
- package/dist/helpers/FileManager/BaseFileManager.d.ts.map +1 -0
- package/dist/helpers/PathResolver/BasePathResolver.d.ts.map +1 -0
- package/dist/helpers/QueryClient/BaseQueryClient.d.ts.map +1 -0
- package/dist/helpers/constants.d.ts +67 -0
- package/dist/helpers/constants.d.ts.map +1 -0
- package/dist/helpers/crypto.d.ts.map +1 -0
- package/dist/helpers/db.d.ts.map +1 -0
- package/dist/helpers/entity/entityCache.d.ts +49 -0
- package/dist/helpers/entity/entityCache.d.ts.map +1 -0
- package/dist/helpers/entity/entityCommon.d.ts +23 -0
- package/dist/helpers/entity/entityCommon.d.ts.map +1 -0
- package/dist/helpers/entity/entityFind.d.ts +52 -0
- package/dist/helpers/entity/entityFind.d.ts.map +1 -0
- package/dist/helpers/entity/entityLiveQuery.d.ts +68 -0
- package/dist/helpers/entity/entityLiveQuery.d.ts.map +1 -0
- package/dist/helpers/entity/entityUnload.d.ts +50 -0
- package/dist/helpers/entity/entityUnload.d.ts.map +1 -0
- package/dist/helpers/entity/index.d.ts +10 -0
- package/dist/helpers/entity/index.d.ts.map +1 -0
- package/dist/helpers/environment.d.ts.map +1 -0
- package/dist/helpers/file/download/actors.d.ts +17 -0
- package/dist/helpers/file/download/actors.d.ts.map +1 -0
- package/dist/helpers/file/download/index.d.ts +70 -0
- package/dist/helpers/file/download/index.d.ts.map +1 -0
- package/dist/helpers/file/fetchAll/actors.d.ts +16 -0
- package/dist/helpers/file/fetchAll/actors.d.ts.map +1 -0
- package/dist/helpers/file/fetchAll/index.d.ts +58 -0
- package/dist/helpers/file/fetchAll/index.d.ts.map +1 -0
- package/dist/helpers/file/queries.d.ts.map +1 -0
- package/dist/helpers/files.d.ts.map +1 -0
- package/dist/helpers/getSchemaForItemProperty.d.ts.map +1 -0
- package/dist/helpers/getSegmentedItemProperties.d.ts +10 -0
- package/dist/helpers/getSegmentedItemProperties.d.ts.map +1 -0
- package/dist/helpers/image/queries.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +28 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/model.d.ts.map +1 -0
- package/dist/helpers/property/index.d.ts.map +1 -0
- package/dist/helpers/property.d.ts.map +1 -0
- package/dist/helpers/reactiveProxy.d.ts.map +1 -0
- package/dist/helpers/schema.d.ts.map +1 -0
- package/dist/helpers/updateMachineContext.d.ts.map +1 -0
- package/dist/helpers/updateSchema.d.ts.map +1 -0
- package/dist/helpers/waitForEntityIdle.d.ts +16 -0
- package/dist/helpers/waitForEntityIdle.d.ts.map +1 -0
- package/dist/imports/index.d.ts +4 -0
- package/dist/imports/index.d.ts.map +1 -0
- package/dist/imports/json.d.ts.map +1 -0
- package/dist/imports/markdown.d.ts.map +1 -0
- package/dist/index-CRuq6HVi.js +18 -0
- package/dist/index-CRuq6HVi.js.map +1 -0
- package/dist/index-r45w9hEq.js +23 -0
- package/dist/index-r45w9hEq.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/interfaces/IDb.d.ts.map +1 -0
- package/dist/interfaces/IEasClient.d.ts.map +1 -0
- package/dist/interfaces/IItem.d.ts.map +1 -0
- package/dist/interfaces/IItemProperty.d.ts +35 -0
- package/dist/interfaces/IItemProperty.d.ts.map +1 -0
- package/dist/interfaces/IQueryClient.d.ts.map +1 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/json-I3vJhXo8.js +14851 -0
- package/dist/json-I3vJhXo8.js.map +1 -0
- package/dist/main.cjs +75 -78
- package/dist/main.cjs.map +1 -1
- package/dist/main.js +2715 -32
- package/dist/main.js.map +1 -1
- package/dist/node/codegen/drizzle.d.ts.map +1 -0
- package/dist/node/codegen/index.d.ts.map +1 -0
- package/dist/node/codegen/ts-to-proto.d.ts.map +1 -0
- package/dist/node/constants.d.ts.map +1 -0
- package/dist/node/db/Db.d.ts.map +1 -0
- package/dist/node/db/index.d.ts.map +1 -0
- package/dist/node/db/node.app.db.config.d.ts.map +1 -0
- package/dist/node/helpers/ArweaveClient.d.ts +31 -0
- package/dist/node/helpers/ArweaveClient.d.ts.map +1 -0
- package/dist/node/helpers/EasClient.d.ts.map +1 -0
- package/dist/node/helpers/FileManager.d.ts.map +1 -0
- package/dist/node/helpers/PathResolver.d.ts.map +1 -0
- package/dist/node/helpers/QueryClient.d.ts.map +1 -0
- package/dist/node/helpers/index.d.ts.map +1 -0
- package/dist/node/helpers/scripts.d.ts.map +1 -0
- package/dist/node/index.d.ts +24 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/seed.d.ts.map +1 -0
- package/dist/node/webpack/fs-proxy.d.ts.map +1 -0
- package/dist/node/webpack/index.d.ts.map +1 -0
- package/dist/node.js +524 -34
- package/dist/node.js.map +1 -1
- package/dist/property-Dy09KTxg.js +274 -0
- package/dist/property-Dy09KTxg.js.map +1 -0
- package/dist/queries-LZYSuhtz.js +16 -0
- package/dist/queries-LZYSuhtz.js.map +1 -0
- package/dist/seedSchema/AppStateSchema.d.ts.map +1 -0
- package/dist/seedSchema/ConfigSchema.d.ts.map +1 -0
- package/dist/seedSchema/MetadataSchema.d.ts.map +1 -0
- package/dist/seedSchema/ModelSchema.d.ts.map +1 -0
- package/dist/seedSchema/ModelSchemaSchema.d.ts.map +1 -0
- package/dist/seedSchema/ModelSchemaSchema.ts +2 -2
- package/dist/seedSchema/ModelUidSchema.d.ts.map +1 -0
- package/dist/seedSchema/ModelUidSchema.ts +2 -2
- package/dist/seedSchema/PropertyUidSchema.d.ts.map +1 -0
- package/dist/seedSchema/PropertyUidSchema.ts +1 -1
- package/dist/seedSchema/SchemaSchema.d.ts.map +1 -0
- package/dist/seedSchema/SeedSchema.d.ts.map +1 -0
- package/dist/seedSchema/VersionSchema.d.ts.map +1 -0
- package/dist/seedSchema/index.d.ts +11 -0
- package/dist/seedSchema/index.d.ts.map +1 -0
- package/dist/seedSchema/index.ts +10 -10
- package/dist/services/events.d.ts.map +1 -0
- package/dist/services/publish/actors/createPublishAttempt.d.ts.map +1 -0
- package/dist/services/publish/actors/preparePublishRequestData.d.ts.map +1 -0
- package/dist/services/publish/actors/upload.d.ts.map +1 -0
- package/dist/services/publish/actors/validateItemData.d.ts.map +1 -0
- package/dist/services/publish/publishMachine.d.ts.map +1 -0
- package/dist/services/write/actors/validateEntity.d.ts +6 -0
- package/dist/services/write/actors/validateEntity.d.ts.map +1 -0
- package/dist/services/write/actors/writeToDatabase.d.ts.map +1 -0
- package/dist/services/write/writeProcessMachine.d.ts +83 -0
- package/dist/services/write/writeProcessMachine.d.ts.map +1 -0
- package/dist/stores/eas.d.ts.map +1 -0
- package/dist/types/arweave.d.ts +56 -0
- package/dist/types/arweave.d.ts.map +1 -0
- package/dist/types/browser.d.ts.map +1 -0
- package/dist/types/db.d.ts.map +1 -0
- package/dist/types/fileManager.d.ts.map +1 -0
- package/dist/types/helpers.d.ts.map +1 -0
- package/dist/types/import.d.ts.map +1 -0
- package/dist/types/index.d.ts +45 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/item.d.ts +72 -0
- package/dist/types/item.d.ts.map +1 -0
- package/dist/types/machines.d.ts.map +1 -0
- package/dist/types/model.d.ts.map +1 -0
- package/dist/types/property.d.ts.map +1 -0
- package/dist/types/seedProtocol.d.ts.map +1 -0
- package/dist/types/services.d.ts.map +1 -0
- package/dist/vite/easFix.d.ts +2 -0
- package/dist/vite/easFix.d.ts.map +1 -0
- package/dist/vite/index.d.ts +48 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite.cjs +217 -0
- package/dist/vite.cjs.map +1 -0
- package/dist/vite.js +215 -0
- package/dist/vite.js.map +1 -0
- package/package.json +22 -9
- package/dist/Item/Item.js +0 -954
- package/dist/Item/Item.js.map +0 -1
- package/dist/Item/queries.js +0 -66
- package/dist/Item/queries.js.map +0 -1
- package/dist/Item/service/actors/fetchDataFromEas.js +0 -94
- package/dist/Item/service/actors/fetchDataFromEas.js.map +0 -1
- package/dist/Item/service/actors/hydrateExistingItem.js +0 -124
- package/dist/Item/service/actors/hydrateExistingItem.js.map +0 -1
- package/dist/Item/service/actors/hydrateNewItem.js +0 -28
- package/dist/Item/service/actors/hydrateNewItem.js.map +0 -1
- package/dist/Item/service/actors/initialize.js +0 -50
- package/dist/Item/service/actors/initialize.js.map +0 -1
- package/dist/Item/service/actors/loadOrCreateItem.js +0 -210
- package/dist/Item/service/actors/loadOrCreateItem.js.map +0 -1
- package/dist/Item/service/actors/reload.js +0 -26
- package/dist/Item/service/actors/reload.js.map +0 -1
- package/dist/Item/service/actors/waitForDb.js +0 -22
- package/dist/Item/service/actors/waitForDb.js.map +0 -1
- package/dist/Item/service/itemMachineSingle.js +0 -211
- package/dist/Item/service/itemMachineSingle.js.map +0 -1
- package/dist/ItemProperty/ItemProperty.js +0 -613
- package/dist/ItemProperty/ItemProperty.js.map +0 -1
- package/dist/ItemProperty/service/actors/hydrateFromDb.js +0 -207
- package/dist/ItemProperty/service/actors/hydrateFromDb.js.map +0 -1
- package/dist/ItemProperty/service/actors/initialize.js +0 -74
- package/dist/ItemProperty/service/actors/initialize.js.map +0 -1
- package/dist/ItemProperty/service/actors/loadOrCreateProperty.js +0 -125
- package/dist/ItemProperty/service/actors/loadOrCreateProperty.js.map +0 -1
- package/dist/ItemProperty/service/actors/resolveRelatedValue.js +0 -321
- package/dist/ItemProperty/service/actors/resolveRelatedValue.js.map +0 -1
- package/dist/ItemProperty/service/actors/resolveRemoteStorage.js +0 -62
- package/dist/ItemProperty/service/actors/resolveRemoteStorage.js.map +0 -1
- package/dist/ItemProperty/service/actors/saveValueToDb/analyzeInput.js +0 -111
- package/dist/ItemProperty/service/actors/saveValueToDb/analyzeInput.js.map +0 -1
- package/dist/ItemProperty/service/actors/saveValueToDb/saveImage.js +0 -178
- package/dist/ItemProperty/service/actors/saveValueToDb/saveImage.js.map +0 -1
- package/dist/ItemProperty/service/actors/saveValueToDb/saveItemStorage.js +0 -121
- package/dist/ItemProperty/service/actors/saveValueToDb/saveItemStorage.js.map +0 -1
- package/dist/ItemProperty/service/actors/saveValueToDb/saveRelation.js +0 -85
- package/dist/ItemProperty/service/actors/saveValueToDb/saveRelation.js.map +0 -1
- package/dist/ItemProperty/service/actors/waitForDb.js +0 -22
- package/dist/ItemProperty/service/actors/waitForDb.js.map +0 -1
- package/dist/ItemProperty/service/propertyMachine.js +0 -233
- package/dist/ItemProperty/service/propertyMachine.js.map +0 -1
- package/dist/Model/Model.js +0 -1831
- package/dist/Model/Model.js.map +0 -1
- package/dist/Model/index.js +0 -8
- package/dist/Model/index.js.map +0 -1
- package/dist/Model/service/actors/createModelProperties.js +0 -102
- package/dist/Model/service/actors/createModelProperties.js.map +0 -1
- package/dist/Model/service/actors/loadOrCreateModel.js +0 -397
- package/dist/Model/service/actors/loadOrCreateModel.js.map +0 -1
- package/dist/Model/service/actors/validateModel.js +0 -123
- package/dist/Model/service/actors/validateModel.js.map +0 -1
- package/dist/Model/service/modelMachine.js +0 -385
- package/dist/Model/service/modelMachine.js.map +0 -1
- package/dist/ModelProperty/ModelProperty.js +0 -841
- package/dist/ModelProperty/ModelProperty.js.map +0 -1
- package/dist/ModelProperty/service/actors/compareAndMarkDraft.js +0 -119
- package/dist/ModelProperty/service/actors/compareAndMarkDraft.js.map +0 -1
- package/dist/ModelProperty/service/actors/saveToSchema.js +0 -108
- package/dist/ModelProperty/service/actors/saveToSchema.js.map +0 -1
- package/dist/ModelProperty/service/actors/validateProperty.js +0 -129
- package/dist/ModelProperty/service/actors/validateProperty.js.map +0 -1
- package/dist/ModelProperty/service/modelPropertyMachine.js +0 -275
- package/dist/ModelProperty/service/modelPropertyMachine.js.map +0 -1
- package/dist/Schema/Schema.js +0 -1732
- package/dist/Schema/Schema.js.map +0 -1
- package/dist/Schema/errors.js +0 -14
- package/dist/Schema/errors.js.map +0 -1
- package/dist/Schema/index.js +0 -7
- package/dist/Schema/index.js.map +0 -1
- package/dist/Schema/service/actors/checkExistingSchema.js +0 -454
- package/dist/Schema/service/actors/checkExistingSchema.js.map +0 -1
- package/dist/Schema/service/actors/createModelInstances.js +0 -71
- package/dist/Schema/service/actors/createModelInstances.js.map +0 -1
- package/dist/Schema/service/actors/createPropertyInstances.js +0 -86
- package/dist/Schema/service/actors/createPropertyInstances.js.map +0 -1
- package/dist/Schema/service/actors/loadOrCreateSchema.js +0 -1336
- package/dist/Schema/service/actors/loadOrCreateSchema.js.map +0 -1
- package/dist/Schema/service/actors/validateSchema.js +0 -65
- package/dist/Schema/service/actors/validateSchema.js.map +0 -1
- package/dist/Schema/service/actors/verifyModelInstancesInCache.js +0 -88
- package/dist/Schema/service/actors/verifyModelInstancesInCache.js.map +0 -1
- package/dist/Schema/service/actors/verifyModelsInDb.js +0 -107
- package/dist/Schema/service/actors/verifyModelsInDb.js.map +0 -1
- package/dist/Schema/service/actors/verifyPropertiesInDb.js +0 -131
- package/dist/Schema/service/actors/verifyPropertiesInDb.js.map +0 -1
- package/dist/Schema/service/actors/verifyPropertyInstancesInCache.js +0 -88
- package/dist/Schema/service/actors/verifyPropertyInstancesInCache.js.map +0 -1
- package/dist/Schema/service/actors/verifySchemaInDb.js +0 -85
- package/dist/Schema/service/actors/verifySchemaInDb.js.map +0 -1
- package/dist/Schema/service/actors/writeModelsToDb.js +0 -185
- package/dist/Schema/service/actors/writeModelsToDb.js.map +0 -1
- package/dist/Schema/service/actors/writePropertiesToDb.js +0 -69
- package/dist/Schema/service/actors/writePropertiesToDb.js.map +0 -1
- package/dist/Schema/service/actors/writeSchemaToDb.js +0 -137
- package/dist/Schema/service/actors/writeSchemaToDb.js.map +0 -1
- package/dist/Schema/service/addModelsMachine.js +0 -545
- package/dist/Schema/service/addModelsMachine.js.map +0 -1
- package/dist/Schema/service/schemaMachine.js +0 -667
- package/dist/Schema/service/schemaMachine.js.map +0 -1
- package/dist/Schema/service/validation/SchemaValidationService.js +0 -565
- package/dist/Schema/service/validation/SchemaValidationService.js.map +0 -1
- package/dist/Schema/validation.js +0 -15
- package/dist/Schema/validation.js.map +0 -1
- package/dist/browser/db/Db.js +0 -484
- package/dist/browser/db/Db.js.map +0 -1
- package/dist/browser/db/drizzleFiles.js +0 -1022
- package/dist/browser/db/drizzleFiles.js.map +0 -1
- package/dist/browser/helpers/ArweaveClient.js +0 -13
- package/dist/browser/helpers/ArweaveClient.js.map +0 -1
- package/dist/browser/helpers/EasClient.js +0 -16
- package/dist/browser/helpers/EasClient.js.map +0 -1
- package/dist/browser/helpers/FileManager.js +0 -415
- package/dist/browser/helpers/FileManager.js.map +0 -1
- package/dist/browser/helpers/PathResolver.js +0 -64
- package/dist/browser/helpers/PathResolver.js.map +0 -1
- package/dist/browser/helpers/QueryClient.js +0 -33
- package/dist/browser/helpers/QueryClient.js.map +0 -1
- package/dist/browser/react/client.js +0 -16
- package/dist/browser/react/client.js.map +0 -1
- package/dist/browser/react/db.js +0 -7
- package/dist/browser/react/db.js.map +0 -1
- package/dist/browser/react/item.js +0 -192
- package/dist/browser/react/item.js.map +0 -1
- package/dist/browser/react/itemProperty.js +0 -545
- package/dist/browser/react/itemProperty.js.map +0 -1
- package/dist/browser/react/liveQuery.js +0 -95
- package/dist/browser/react/liveQuery.js.map +0 -1
- package/dist/browser/react/model.js +0 -276
- package/dist/browser/react/model.js.map +0 -1
- package/dist/browser/react/modelProperty.js +0 -412
- package/dist/browser/react/modelProperty.js.map +0 -1
- package/dist/browser/react/schema.js +0 -387
- package/dist/browser/react/schema.js.map +0 -1
- package/dist/browser/react/services.js +0 -47
- package/dist/browser/react/services.js.map +0 -1
- package/dist/browser/react/trash.js +0 -25
- package/dist/browser/react/trash.js.map +0 -1
- package/dist/browser/workers/FileDownloader.js +0 -52
- package/dist/browser/workers/FileDownloader.js.map +0 -1
- package/dist/browser/workers/ImageResizer.js +0 -63
- package/dist/browser/workers/ImageResizer.js.map +0 -1
- package/dist/browser/workers/filesDownload.js +0 -245
- package/dist/browser/workers/filesDownload.js.map +0 -1
- package/dist/browser/workers/imageResize.js +0 -382
- package/dist/browser/workers/imageResize.js.map +0 -1
- package/dist/client/ClientManager.js +0 -177
- package/dist/client/ClientManager.js.map +0 -1
- package/dist/client/actors/addModelsToDb.js +0 -150
- package/dist/client/actors/addModelsToDb.js.map +0 -1
- package/dist/client/actors/addModelsToStore.js +0 -28
- package/dist/client/actors/addModelsToStore.js.map +0 -1
- package/dist/client/actors/dbInit.js +0 -38
- package/dist/client/actors/dbInit.js.map +0 -1
- package/dist/client/actors/fileSystemInit.js +0 -43
- package/dist/client/actors/fileSystemInit.js.map +0 -1
- package/dist/client/actors/platformClassesInit.js +0 -175
- package/dist/client/actors/platformClassesInit.js.map +0 -1
- package/dist/client/actors/processSchemaFiles.js +0 -169
- package/dist/client/actors/processSchemaFiles.js.map +0 -1
- package/dist/client/actors/saveAppState.js +0 -80
- package/dist/client/actors/saveAppState.js.map +0 -1
- package/dist/client/actors/saveConfig.js +0 -110
- package/dist/client/actors/saveConfig.js.map +0 -1
- package/dist/client/clientManagerMachine.js +0 -191
- package/dist/client/clientManagerMachine.js.map +0 -1
- package/dist/client/constants.js +0 -80
- package/dist/client/constants.js.map +0 -1
- package/dist/db/Db/BaseDb.js +0 -55
- package/dist/db/Db/BaseDb.js.map +0 -1
- package/dist/db/read/getExistingItem.js +0 -33
- package/dist/db/read/getExistingItem.js.map +0 -1
- package/dist/db/read/getItem.js +0 -26
- package/dist/db/read/getItem.js.map +0 -1
- package/dist/db/read/getItemData.js +0 -88
- package/dist/db/read/getItemData.js.map +0 -1
- package/dist/db/read/getItemProperties.js +0 -53
- package/dist/db/read/getItemProperties.js.map +0 -1
- package/dist/db/read/getItemProperty.js +0 -34
- package/dist/db/read/getItemProperty.js.map +0 -1
- package/dist/db/read/getItems.js +0 -53
- package/dist/db/read/getItems.js.map +0 -1
- package/dist/db/read/getMetadata.js +0 -36
- package/dist/db/read/getMetadata.js.map +0 -1
- package/dist/db/read/getModelSchemas.js +0 -63
- package/dist/db/read/getModelSchemas.js.map +0 -1
- package/dist/db/read/getPropertyData.js +0 -42
- package/dist/db/read/getPropertyData.js.map +0 -1
- package/dist/db/read/getPublishPayload.js +0 -294
- package/dist/db/read/getPublishPayload.js.map +0 -1
- package/dist/db/read/getPublishUploads.js +0 -166
- package/dist/db/read/getPublishUploads.js.map +0 -1
- package/dist/db/read/getRelationValueData.js +0 -34
- package/dist/db/read/getRelationValueData.js.map +0 -1
- package/dist/db/read/getSchemaUidForModel.js +0 -28
- package/dist/db/read/getSchemaUidForModel.js.map +0 -1
- package/dist/db/read/getSeedData.js +0 -32
- package/dist/db/read/getSeedData.js.map +0 -1
- package/dist/db/read/getStorageTransactionIdForSeedUid.js +0 -34
- package/dist/db/read/getStorageTransactionIdForSeedUid.js.map +0 -1
- package/dist/db/read/getVersionData.js +0 -37
- package/dist/db/read/getVersionData.js.map +0 -1
- package/dist/db/read/subqueries/metadataLatest.js +0 -39
- package/dist/db/read/subqueries/metadataLatest.js.map +0 -1
- package/dist/db/read/subqueries/versionData.js +0 -31
- package/dist/db/read/subqueries/versionData.js.map +0 -1
- package/dist/db/write/createMetadata.js +0 -94
- package/dist/db/write/createMetadata.js.map +0 -1
- package/dist/db/write/createNewItem.js +0 -43
- package/dist/db/write/createNewItem.js.map +0 -1
- package/dist/db/write/createSeed.js +0 -32
- package/dist/db/write/createSeed.js.map +0 -1
- package/dist/db/write/createSeeds.js +0 -29
- package/dist/db/write/createSeeds.js.map +0 -1
- package/dist/db/write/createVersion.js +0 -29
- package/dist/db/write/createVersion.js.map +0 -1
- package/dist/db/write/deleteItem.js +0 -25
- package/dist/db/write/deleteItem.js.map +0 -1
- package/dist/db/write/saveAppState.js +0 -30
- package/dist/db/write/saveAppState.js.map +0 -1
- package/dist/db/write/saveMetadata.js +0 -26
- package/dist/db/write/saveMetadata.js.map +0 -1
- package/dist/db/write/updateItemPropertyValue.js +0 -165
- package/dist/db/write/updateItemPropertyValue.js.map +0 -1
- package/dist/db/write/updateMetadata.js +0 -38
- package/dist/db/write/updateMetadata.js.map +0 -1
- package/dist/eas.js +0 -176
- package/dist/eas.js.map +0 -1
- package/dist/eventBus.js +0 -6
- package/dist/eventBus.js.map +0 -1
- package/dist/events/files/download.js +0 -191
- package/dist/events/files/download.js.map +0 -1
- package/dist/events/files/index.js +0 -23
- package/dist/events/files/index.js.map +0 -1
- package/dist/events/index.js +0 -28
- package/dist/events/index.js.map +0 -1
- package/dist/events/item/index.js +0 -28
- package/dist/events/item/index.js.map +0 -1
- package/dist/events/item/publish.js +0 -50
- package/dist/events/item/publish.js.map +0 -1
- package/dist/events/item/syncDbWithEas.js +0 -453
- package/dist/events/item/syncDbWithEas.js.map +0 -1
- package/dist/events/services/allItems.js +0 -10
- package/dist/events/services/allItems.js.map +0 -1
- package/dist/events/services/index.js +0 -9
- package/dist/events/services/index.js.map +0 -1
- package/dist/feed.js +0 -534
- package/dist/feed.js.map +0 -1
- package/dist/graphql/gql/gql.js +0 -27
- package/dist/graphql/gql/gql.js.map +0 -1
- package/dist/graphql/gql/graphql.js +0 -129
- package/dist/graphql/gql/graphql.js.map +0 -1
- package/dist/helpers/ArweaveClient/BaseArweaveClient.js +0 -11
- package/dist/helpers/ArweaveClient/BaseArweaveClient.js.map +0 -1
- package/dist/helpers/ArweaveClient/index.js +0 -61
- package/dist/helpers/ArweaveClient/index.js.map +0 -1
- package/dist/helpers/ArweaveClient/queries.js +0 -16
- package/dist/helpers/ArweaveClient/queries.js.map +0 -1
- package/dist/helpers/EasClient/BaseEasClient.js +0 -20
- package/dist/helpers/EasClient/BaseEasClient.js.map +0 -1
- package/dist/helpers/FileManager/BaseFileManager.js +0 -119
- package/dist/helpers/FileManager/BaseFileManager.js.map +0 -1
- package/dist/helpers/PathResolver/BasePathResolver.js +0 -20
- package/dist/helpers/PathResolver/BasePathResolver.js.map +0 -1
- package/dist/helpers/QueryClient/BaseQueryClient.js +0 -11
- package/dist/helpers/QueryClient/BaseQueryClient.js.map +0 -1
- package/dist/helpers/constants.js +0 -107
- package/dist/helpers/constants.js.map +0 -1
- package/dist/helpers/crypto.js +0 -9
- package/dist/helpers/crypto.js.map +0 -1
- package/dist/helpers/db.js +0 -1335
- package/dist/helpers/db.js.map +0 -1
- package/dist/helpers/environment.js +0 -14
- package/dist/helpers/environment.js.map +0 -1
- package/dist/helpers/file/queries.js +0 -15
- package/dist/helpers/file/queries.js.map +0 -1
- package/dist/helpers/getSchemaForItemProperty.js +0 -65
- package/dist/helpers/getSchemaForItemProperty.js.map +0 -1
- package/dist/helpers/getSegmentedItemProperties.js +0 -71
- package/dist/helpers/getSegmentedItemProperties.js.map +0 -1
- package/dist/helpers/index.js +0 -101
- package/dist/helpers/index.js.map +0 -1
- package/dist/helpers/model.js +0 -24
- package/dist/helpers/model.js.map +0 -1
- package/dist/helpers/property/index.js +0 -110
- package/dist/helpers/property/index.js.map +0 -1
- package/dist/helpers/property.js +0 -286
- package/dist/helpers/property.js.map +0 -1
- package/dist/helpers/reactiveProxy.js +0 -87
- package/dist/helpers/reactiveProxy.js.map +0 -1
- package/dist/helpers/schema.js +0 -473
- package/dist/helpers/schema.js.map +0 -1
- package/dist/helpers/updateMachineContext.js +0 -20
- package/dist/helpers/updateMachineContext.js.map +0 -1
- package/dist/helpers/updateSchema.js +0 -721
- package/dist/helpers/updateSchema.js.map +0 -1
- package/dist/imports/json.js +0 -1129
- package/dist/imports/json.js.map +0 -1
- package/dist/imports/markdown.js +0 -141
- package/dist/imports/markdown.js.map +0 -1
- package/dist/node/codegen/drizzle.js +0 -136
- package/dist/node/codegen/drizzle.js.map +0 -1
- package/dist/node/codegen/templates/header.njk +0 -10
- package/dist/node/codegen/templates/index.njk +0 -27
- package/dist/node/codegen/templates/model.njk +0 -18
- package/dist/node/codegen/templates/relations.njk +0 -13
- package/dist/node/codegen/templates/schema.njk +0 -11
- package/dist/node/codegen/templates/table.njk +0 -43
- package/dist/node/db/Db.js +0 -332
- package/dist/node/db/Db.js.map +0 -1
- package/dist/node/helpers/ArweaveClient.js +0 -13
- package/dist/node/helpers/ArweaveClient.js.map +0 -1
- package/dist/node/helpers/EasClient.js +0 -16
- package/dist/node/helpers/EasClient.js.map +0 -1
- package/dist/node/helpers/FileManager.js +0 -151
- package/dist/node/helpers/FileManager.js.map +0 -1
- package/dist/node/helpers/PathResolver.js +0 -182
- package/dist/node/helpers/PathResolver.js.map +0 -1
- package/dist/node/helpers/QueryClient.js +0 -20
- package/dist/node/helpers/QueryClient.js.map +0 -1
- package/dist/node/helpers/index.js +0 -62
- package/dist/node/helpers/index.js.map +0 -1
- package/dist/node/helpers/scripts.js +0 -121
- package/dist/node/helpers/scripts.js.map +0 -1
- package/dist/node/webpack/index.js +0 -96
- package/dist/node/webpack/index.js.map +0 -1
- package/dist/node_modules/.bun/events@3.3.0/node_modules/events/events.d.ts +0 -31
- package/dist/node_modules/.bun/events@3.3.0/node_modules/events/events.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.d.mts +0 -90
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.d.mts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/index.d.ts +0 -28
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/index.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/common.d.ts +0 -7
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/common.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/dumper.d.ts +0 -2
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/dumper.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/exception.d.ts +0 -12
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/exception.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/loader.d.ts +0 -3
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/loader.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/schema/core.d.ts +0 -3
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/schema/core.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/schema/default.d.ts +0 -3
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/schema/default.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/schema/failsafe.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/schema/failsafe.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/schema/json.d.ts +0 -3
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/schema/json.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/schema.d.ts +0 -7
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/schema.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/snippet.d.ts +0 -3
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/snippet.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/binary.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/binary.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/bool.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/bool.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/float.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/float.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/int.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/int.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/map.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/map.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/merge.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/merge.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/null.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/null.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/omap.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/omap.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/pairs.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/pairs.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/seq.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/seq.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/set.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/set.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/str.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/str.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/timestamp.d.ts +0 -4
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type/timestamp.d.ts.map +0 -1
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type.d.ts +0 -18
- package/dist/node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/lib/type.d.ts.map +0 -1
- package/dist/node_modules/.bun/process@0.11.10/node_modules/process/index.d.ts +0 -3
- package/dist/node_modules/.bun/process@0.11.10/node_modules/process/index.d.ts.map +0 -1
- package/dist/node_modules/.bun/punycode@1.4.1/node_modules/punycode/punycode.d.ts +0 -1
- package/dist/node_modules/.bun/punycode@1.4.1/node_modules/punycode/punycode.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/add-abort-signal.d.ts +0 -3
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/add-abort-signal.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/buffer_list.d.ts +0 -19
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/buffer_list.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/compose.d.ts +0 -3
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/compose.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/destroy.d.ts +0 -6
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/destroy.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/duplex.d.ts +0 -12
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/duplex.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/duplexify.d.ts +0 -3
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/duplexify.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/end-of-stream.d.ts +0 -7
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/end-of-stream.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/from.d.ts +0 -3
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/from.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/legacy.d.ts +0 -7
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/legacy.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/operators.d.ts +0 -31
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/operators.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/passthrough.d.ts +0 -7
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/passthrough.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/pipeline.d.ts +0 -3
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/pipeline.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/readable.d.ts +0 -55
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/readable.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/state.d.ts +0 -4
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/state.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/transform.d.ts +0 -12
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/transform.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/utils.d.ts +0 -33
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/utils.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/writable.d.ts +0 -59
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/streams/writable.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/validators.d.ts +0 -199
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/internal/validators.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/ours/errors.d.ts +0 -8
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/ours/errors.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/ours/index.d.ts +0 -2
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/ours/index.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/ours/primordials.d.ts +0 -51
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/ours/primordials.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/ours/util/inspect.d.ts +0 -3
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/ours/util/inspect.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/ours/util.d.ts +0 -22
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/ours/util.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/stream/promises.d.ts +0 -4
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/stream/promises.d.ts.map +0 -1
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/stream.d.ts +0 -3
- package/dist/node_modules/.bun/readable-stream@4.7.0/node_modules/readable-stream/lib/stream.d.ts.map +0 -1
- package/dist/node_modules/.bun/string_decoder@1.3.0/node_modules/string_decoder/lib/string_decoder.d.ts +0 -33
- package/dist/node_modules/.bun/string_decoder@1.3.0/node_modules/string_decoder/lib/string_decoder.d.ts.map +0 -1
- package/dist/node_modules/.bun/url@0.11.4/node_modules/url/url.d.ts +0 -26
- package/dist/node_modules/.bun/url@0.11.4/node_modules/url/url.d.ts.map +0 -1
- package/dist/scripts/build-with-tests.d.ts +0 -3
- package/dist/scripts/build-with-tests.d.ts.map +0 -1
- package/dist/scripts/rpcServer.cursor.d.ts +0 -2
- package/dist/scripts/rpcServer.cursor.d.ts.map +0 -1
- package/dist/scripts/rpcServer.d.ts +0 -3
- package/dist/scripts/rpcServer.d.ts.map +0 -1
- package/dist/scripts/sync-versions.d.ts +0 -7
- package/dist/scripts/sync-versions.d.ts.map +0 -1
- package/dist/scripts/track-drizzle-changes.d.ts +0 -13
- package/dist/scripts/track-drizzle-changes.d.ts.map +0 -1
- package/dist/scripts/vite.config.d.ts +0 -3
- package/dist/scripts/vite.config.d.ts.map +0 -1
- package/dist/seedSchema/AppStateSchema.js +0 -11
- package/dist/seedSchema/AppStateSchema.js.map +0 -1
- package/dist/seedSchema/ConfigSchema.js +0 -12
- package/dist/seedSchema/ConfigSchema.js.map +0 -1
- package/dist/seedSchema/MetadataSchema.js +0 -29
- package/dist/seedSchema/MetadataSchema.js.map +0 -1
- package/dist/seedSchema/ModelSchema.js +0 -40
- package/dist/seedSchema/ModelSchema.js.map +0 -1
- package/dist/seedSchema/ModelSchemaSchema.js +0 -12
- package/dist/seedSchema/ModelSchemaSchema.js.map +0 -1
- package/dist/seedSchema/ModelUidSchema.js +0 -18
- package/dist/seedSchema/ModelUidSchema.js.map +0 -1
- package/dist/seedSchema/PropertyUidSchema.js +0 -18
- package/dist/seedSchema/PropertyUidSchema.js.map +0 -1
- package/dist/seedSchema/SEEDPROTOCOL_Seed_Protocol_v1.json.js +0 -94
- package/dist/seedSchema/SEEDPROTOCOL_Seed_Protocol_v1.json.js.map +0 -1
- package/dist/seedSchema/SchemaSchema.js +0 -20
- package/dist/seedSchema/SchemaSchema.js.map +0 -1
- package/dist/seedSchema/SeedSchema.js +0 -16
- package/dist/seedSchema/SeedSchema.js.map +0 -1
- package/dist/seedSchema/VersionSchema.js +0 -17
- package/dist/seedSchema/VersionSchema.js.map +0 -1
- package/dist/seedSchema/index.js +0 -11
- package/dist/seedSchema/index.js.map +0 -1
- package/dist/services/events.js +0 -16
- package/dist/services/events.js.map +0 -1
- package/dist/services/publish/actors/createPublishAttempt.js +0 -14
- package/dist/services/publish/actors/createPublishAttempt.js.map +0 -1
- package/dist/services/publish/actors/preparePublishRequestData.js +0 -76
- package/dist/services/publish/actors/preparePublishRequestData.js.map +0 -1
- package/dist/services/publish/actors/upload.js +0 -61
- package/dist/services/publish/actors/upload.js.map +0 -1
- package/dist/services/publish/actors/validateItemData.js +0 -18
- package/dist/services/publish/actors/validateItemData.js.map +0 -1
- package/dist/services/publish/publishMachine.js +0 -71
- package/dist/services/publish/publishMachine.js.map +0 -1
- package/dist/services/write/actors/validateEntity.js +0 -145
- package/dist/services/write/actors/validateEntity.js.map +0 -1
- package/dist/services/write/actors/writeToDatabase.js +0 -91
- package/dist/services/write/actors/writeToDatabase.js.map +0 -1
- package/dist/services/write/writeProcessMachine.js +0 -233
- package/dist/services/write/writeProcessMachine.js.map +0 -1
- package/dist/src/Item/Item.d.ts +0 -94
- package/dist/src/Item/Item.d.ts.map +0 -1
- package/dist/src/Item/queries.d.ts.map +0 -1
- package/dist/src/Item/service/actors/fetchDataFromEas.d.ts +0 -2
- package/dist/src/Item/service/actors/fetchDataFromEas.d.ts.map +0 -1
- package/dist/src/Item/service/actors/hydrateExistingItem.d.ts.map +0 -1
- package/dist/src/Item/service/actors/hydrateNewItem.d.ts.map +0 -1
- package/dist/src/Item/service/actors/initialize.d.ts.map +0 -1
- package/dist/src/Item/service/actors/loadOrCreateItem.d.ts.map +0 -1
- package/dist/src/Item/service/actors/reload.d.ts.map +0 -1
- package/dist/src/Item/service/actors/saveDataToDb.d.ts +0 -3
- package/dist/src/Item/service/actors/saveDataToDb.d.ts.map +0 -1
- package/dist/src/Item/service/actors/waitForDb.d.ts.map +0 -1
- package/dist/src/Item/service/itemMachineSingle.d.ts +0 -2
- package/dist/src/Item/service/itemMachineSingle.d.ts.map +0 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts +0 -67
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/initialize.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/resolveRemoteStorage.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/index.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/waitForDb.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/propertyMachine.d.ts +0 -48
- package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +0 -1
- package/dist/src/Model/Model.d.ts +0 -199
- package/dist/src/Model/Model.d.ts.map +0 -1
- package/dist/src/Model/index.d.ts +0 -26
- package/dist/src/Model/index.d.ts.map +0 -1
- package/dist/src/Model/service/actors/createModelProperties.d.ts.map +0 -1
- package/dist/src/Model/service/actors/loadOrCreateModel.d.ts.map +0 -1
- package/dist/src/Model/service/actors/validateModel.d.ts.map +0 -1
- package/dist/src/Model/service/modelMachine.d.ts +0 -206
- package/dist/src/Model/service/modelMachine.d.ts.map +0 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts +0 -112
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +0 -1
- package/dist/src/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +0 -1
- package/dist/src/ModelProperty/service/actors/saveToSchema.d.ts.map +0 -1
- package/dist/src/ModelProperty/service/actors/validateProperty.d.ts.map +0 -1
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +0 -183
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts.map +0 -1
- package/dist/src/Schema/Schema.d.ts +0 -143
- package/dist/src/Schema/Schema.d.ts.map +0 -1
- package/dist/src/Schema/errors.d.ts.map +0 -1
- package/dist/src/Schema/index.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/createModelInstances.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/createPropertyInstances.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/validateSchema.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/verifyModelInstancesInCache.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/verifyModelsInDb.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/verifyPropertiesInDb.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/verifyPropertyInstancesInCache.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/verifySchemaInDb.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/writeModelsToDb.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/writePropertiesToDb.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/writeSchemaToDb.d.ts.map +0 -1
- package/dist/src/Schema/service/addModelsMachine.d.ts +0 -111
- package/dist/src/Schema/service/addModelsMachine.d.ts.map +0 -1
- package/dist/src/Schema/service/schemaMachine.d.ts +0 -494
- package/dist/src/Schema/service/schemaMachine.d.ts.map +0 -1
- package/dist/src/Schema/service/validation/SchemaValidationService.d.ts.map +0 -1
- package/dist/src/Schema/validation.d.ts.map +0 -1
- package/dist/src/browser/db/Db.d.ts.map +0 -1
- package/dist/src/browser/db/drizzleFiles.d.ts.map +0 -1
- package/dist/src/browser/db/sqlWasmClient.d.ts.map +0 -1
- package/dist/src/browser/helpers/ArweaveClient.d.ts +0 -7
- package/dist/src/browser/helpers/ArweaveClient.d.ts.map +0 -1
- package/dist/src/browser/helpers/EasClient.d.ts.map +0 -1
- package/dist/src/browser/helpers/FileManager.d.ts.map +0 -1
- package/dist/src/browser/helpers/PathResolver.d.ts.map +0 -1
- package/dist/src/browser/helpers/QueryClient.d.ts.map +0 -1
- package/dist/src/browser/helpers/index.d.ts +0 -2
- package/dist/src/browser/helpers/index.d.ts.map +0 -1
- package/dist/src/browser/index.d.ts +0 -6
- package/dist/src/browser/index.d.ts.map +0 -1
- package/dist/src/browser/react/OPFSImage.d.ts.map +0 -1
- package/dist/src/browser/react/SeedImage.d.ts.map +0 -1
- package/dist/src/browser/react/client.d.ts.map +0 -1
- package/dist/src/browser/react/db.d.ts.map +0 -1
- package/dist/src/browser/react/index.d.ts.map +0 -1
- package/dist/src/browser/react/item.d.ts +0 -41
- package/dist/src/browser/react/item.d.ts.map +0 -1
- package/dist/src/browser/react/itemProperty.d.ts.map +0 -1
- package/dist/src/browser/react/liveQuery.d.ts.map +0 -1
- package/dist/src/browser/react/model.d.ts.map +0 -1
- package/dist/src/browser/react/modelProperty.d.ts.map +0 -1
- package/dist/src/browser/react/schema.d.ts.map +0 -1
- package/dist/src/browser/react/services.d.ts.map +0 -1
- package/dist/src/browser/react/trash.d.ts +0 -6
- package/dist/src/browser/react/trash.d.ts.map +0 -1
- package/dist/src/browser/seed.d.ts +0 -10
- package/dist/src/browser/seed.d.ts.map +0 -1
- package/dist/src/browser/workers/FileDownloader.d.ts.map +0 -1
- package/dist/src/browser/workers/ImageResizer.d.ts.map +0 -1
- package/dist/src/browser/workers/content-hash.d.ts.map +0 -1
- package/dist/src/browser/workers/dbWorker.d.ts.map +0 -1
- package/dist/src/browser/workers/filesDownload.d.ts.map +0 -1
- package/dist/src/browser/workers/imageResize.d.ts.map +0 -1
- package/dist/src/client/BaseClientManager.d.ts.map +0 -1
- package/dist/src/client/ClientManager.d.ts.map +0 -1
- package/dist/src/client/actions/setAddresses.d.ts.map +0 -1
- package/dist/src/client/actors/addModelsToDb.d.ts.map +0 -1
- package/dist/src/client/actors/addModelsToStore.d.ts.map +0 -1
- package/dist/src/client/actors/dbInit.d.ts.map +0 -1
- package/dist/src/client/actors/fileSystemInit.d.ts.map +0 -1
- package/dist/src/client/actors/platformClassesInit.d.ts.map +0 -1
- package/dist/src/client/actors/processSchemaFiles.d.ts.map +0 -1
- package/dist/src/client/actors/saveAppState.d.ts.map +0 -1
- package/dist/src/client/actors/saveConfig.d.ts.map +0 -1
- package/dist/src/client/clientManagerMachine.d.ts.map +0 -1
- package/dist/src/client/constants.d.ts +0 -79
- package/dist/src/client/constants.d.ts.map +0 -1
- package/dist/src/client/index.d.ts.map +0 -1
- package/dist/src/db/Db/BaseDb.d.ts +0 -43
- package/dist/src/db/Db/BaseDb.d.ts.map +0 -1
- package/dist/src/db/configs/dev.schema.config.d.ts.map +0 -1
- package/dist/src/db/read/getExistingItem.d.ts +0 -12
- package/dist/src/db/read/getExistingItem.d.ts.map +0 -1
- package/dist/src/db/read/getItem.d.ts.map +0 -1
- package/dist/src/db/read/getItemData.d.ts.map +0 -1
- package/dist/src/db/read/getItemProperties.d.ts.map +0 -1
- package/dist/src/db/read/getItemProperty.d.ts.map +0 -1
- package/dist/src/db/read/getItems.d.ts.map +0 -1
- package/dist/src/db/read/getMetadata.d.ts.map +0 -1
- package/dist/src/db/read/getModelSchemas.d.ts.map +0 -1
- package/dist/src/db/read/getModels.d.ts.map +0 -1
- package/dist/src/db/read/getPropertyData.d.ts.map +0 -1
- package/dist/src/db/read/getPublishPayload.d.ts.map +0 -1
- package/dist/src/db/read/getPublishUploads.d.ts +0 -16
- package/dist/src/db/read/getPublishUploads.d.ts.map +0 -1
- package/dist/src/db/read/getRelationValueData.d.ts.map +0 -1
- package/dist/src/db/read/getSchemaUidForModel.d.ts.map +0 -1
- package/dist/src/db/read/getSeedData.d.ts.map +0 -1
- package/dist/src/db/read/getStorageTransactionIdForSeedUid.d.ts.map +0 -1
- package/dist/src/db/read/getVersionData.d.ts.map +0 -1
- package/dist/src/db/read/getVersionsForVersionUids.d.ts.map +0 -1
- package/dist/src/db/read/subqueries/metadataLatest.d.ts.map +0 -1
- package/dist/src/db/read/subqueries/versionData.d.ts.map +0 -1
- package/dist/src/db/write/createMetadata.d.ts.map +0 -1
- package/dist/src/db/write/createNewItem.d.ts.map +0 -1
- package/dist/src/db/write/createSeed.d.ts.map +0 -1
- package/dist/src/db/write/createSeeds.d.ts.map +0 -1
- package/dist/src/db/write/createVersion.d.ts.map +0 -1
- package/dist/src/db/write/deleteItem.d.ts.map +0 -1
- package/dist/src/db/write/recoverDeletedItem.d.ts.map +0 -1
- package/dist/src/db/write/saveAppState.d.ts.map +0 -1
- package/dist/src/db/write/saveMetadata.d.ts.map +0 -1
- package/dist/src/db/write/updateItemPropertyValue.d.ts +0 -9
- package/dist/src/db/write/updateItemPropertyValue.d.ts.map +0 -1
- package/dist/src/db/write/updateMetadata.d.ts.map +0 -1
- package/dist/src/eas.d.ts.map +0 -1
- package/dist/src/eslint-rules/align-imports.d.ts.map +0 -1
- package/dist/src/eventBus.d.ts.map +0 -1
- package/dist/src/events/files/download.d.ts +0 -6
- package/dist/src/events/files/download.d.ts.map +0 -1
- package/dist/src/events/files/index.d.ts.map +0 -1
- package/dist/src/events/index.d.ts.map +0 -1
- package/dist/src/events/item/create.d.ts +0 -2
- package/dist/src/events/item/create.d.ts.map +0 -1
- package/dist/src/events/item/index.d.ts +0 -3
- package/dist/src/events/item/index.d.ts.map +0 -1
- package/dist/src/events/item/publish.d.ts.map +0 -1
- package/dist/src/events/item/request.d.ts +0 -2
- package/dist/src/events/item/request.d.ts.map +0 -1
- package/dist/src/events/item/requestAll.d.ts +0 -9
- package/dist/src/events/item/requestAll.d.ts.map +0 -1
- package/dist/src/events/item/syncDbWithEas.d.ts.map +0 -1
- package/dist/src/events/services/allItems.d.ts.map +0 -1
- package/dist/src/events/services/index.d.ts.map +0 -1
- package/dist/src/feed.d.ts.map +0 -1
- package/dist/src/graphql/fragments/Attestation.d.ts.map +0 -1
- package/dist/src/graphql/fragments/Schema.d.ts.map +0 -1
- package/dist/src/graphql/fragments/index.d.ts.map +0 -1
- package/dist/src/graphql/gql/fragment-masking.d.ts.map +0 -1
- package/dist/src/graphql/gql/gql.d.ts.map +0 -1
- package/dist/src/graphql/gql/graphql.d.ts.map +0 -1
- package/dist/src/graphql/gql/index.d.ts.map +0 -1
- package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts +0 -7
- package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts.map +0 -1
- package/dist/src/helpers/ArweaveClient/index.d.ts +0 -9
- package/dist/src/helpers/ArweaveClient/index.d.ts.map +0 -1
- package/dist/src/helpers/ArweaveClient/queries.d.ts +0 -6
- package/dist/src/helpers/ArweaveClient/queries.d.ts.map +0 -1
- package/dist/src/helpers/EasClient/BaseEasClient.d.ts +0 -10
- package/dist/src/helpers/EasClient/BaseEasClient.d.ts.map +0 -1
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +0 -1
- package/dist/src/helpers/PathResolver/BasePathResolver.d.ts.map +0 -1
- package/dist/src/helpers/QueryClient/BaseQueryClient.d.ts.map +0 -1
- package/dist/src/helpers/constants.d.ts +0 -58
- package/dist/src/helpers/constants.d.ts.map +0 -1
- package/dist/src/helpers/crypto.d.ts.map +0 -1
- package/dist/src/helpers/db.d.ts.map +0 -1
- package/dist/src/helpers/environment.d.ts.map +0 -1
- package/dist/src/helpers/file/download/actors.d.ts +0 -3
- package/dist/src/helpers/file/download/actors.d.ts.map +0 -1
- package/dist/src/helpers/file/download/index.d.ts +0 -2
- package/dist/src/helpers/file/download/index.d.ts.map +0 -1
- package/dist/src/helpers/file/fetchAll/actors.d.ts +0 -3
- package/dist/src/helpers/file/fetchAll/actors.d.ts.map +0 -1
- package/dist/src/helpers/file/fetchAll/index.d.ts +0 -2
- package/dist/src/helpers/file/fetchAll/index.d.ts.map +0 -1
- package/dist/src/helpers/file/queries.d.ts.map +0 -1
- package/dist/src/helpers/files.d.ts.map +0 -1
- package/dist/src/helpers/getSchemaForItemProperty.d.ts.map +0 -1
- package/dist/src/helpers/getSegmentedItemProperties.d.ts +0 -10
- package/dist/src/helpers/getSegmentedItemProperties.d.ts.map +0 -1
- package/dist/src/helpers/image/queries.d.ts.map +0 -1
- package/dist/src/helpers/index.d.ts +0 -27
- package/dist/src/helpers/index.d.ts.map +0 -1
- package/dist/src/helpers/model.d.ts.map +0 -1
- package/dist/src/helpers/property/index.d.ts.map +0 -1
- package/dist/src/helpers/property.d.ts.map +0 -1
- package/dist/src/helpers/reactiveProxy.d.ts.map +0 -1
- package/dist/src/helpers/schema.d.ts.map +0 -1
- package/dist/src/helpers/updateMachineContext.d.ts.map +0 -1
- package/dist/src/helpers/updateSchema.d.ts.map +0 -1
- package/dist/src/imports/index.d.ts +0 -3
- package/dist/src/imports/index.d.ts.map +0 -1
- package/dist/src/imports/json.d.ts.map +0 -1
- package/dist/src/imports/markdown.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -25
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/interfaces/IDb.d.ts.map +0 -1
- package/dist/src/interfaces/IEasClient.d.ts.map +0 -1
- package/dist/src/interfaces/IItem.d.ts.map +0 -1
- package/dist/src/interfaces/IItemProperty.d.ts +0 -32
- package/dist/src/interfaces/IItemProperty.d.ts.map +0 -1
- package/dist/src/interfaces/IQueryClient.d.ts.map +0 -1
- package/dist/src/interfaces/index.d.ts.map +0 -1
- package/dist/src/node/codegen/drizzle.d.ts.map +0 -1
- package/dist/src/node/codegen/index.d.ts.map +0 -1
- package/dist/src/node/codegen/ts-to-proto.d.ts.map +0 -1
- package/dist/src/node/constants.d.ts.map +0 -1
- package/dist/src/node/db/Db.d.ts.map +0 -1
- package/dist/src/node/db/index.d.ts.map +0 -1
- package/dist/src/node/db/node.app.db.config.d.ts.map +0 -1
- package/dist/src/node/helpers/ArweaveClient.d.ts +0 -7
- package/dist/src/node/helpers/ArweaveClient.d.ts.map +0 -1
- package/dist/src/node/helpers/EasClient.d.ts.map +0 -1
- package/dist/src/node/helpers/FileManager.d.ts.map +0 -1
- package/dist/src/node/helpers/PathResolver.d.ts.map +0 -1
- package/dist/src/node/helpers/QueryClient.d.ts.map +0 -1
- package/dist/src/node/helpers/index.d.ts.map +0 -1
- package/dist/src/node/helpers/scripts.d.ts.map +0 -1
- package/dist/src/node/index.d.ts +0 -25
- package/dist/src/node/index.d.ts.map +0 -1
- package/dist/src/node/seed.d.ts.map +0 -1
- package/dist/src/node/webpack/fs-proxy.d.ts.map +0 -1
- package/dist/src/node/webpack/index.d.ts.map +0 -1
- package/dist/src/seedSchema/AppStateSchema.d.ts.map +0 -1
- package/dist/src/seedSchema/ConfigSchema.d.ts.map +0 -1
- package/dist/src/seedSchema/MetadataSchema.d.ts.map +0 -1
- package/dist/src/seedSchema/ModelSchema.d.ts.map +0 -1
- package/dist/src/seedSchema/ModelSchemaSchema.d.ts.map +0 -1
- package/dist/src/seedSchema/ModelUidSchema.d.ts.map +0 -1
- package/dist/src/seedSchema/PropertyUidSchema.d.ts.map +0 -1
- package/dist/src/seedSchema/SchemaSchema.d.ts.map +0 -1
- package/dist/src/seedSchema/SeedSchema.d.ts.map +0 -1
- package/dist/src/seedSchema/VersionSchema.d.ts.map +0 -1
- package/dist/src/seedSchema/index.d.ts +0 -11
- package/dist/src/seedSchema/index.d.ts.map +0 -1
- package/dist/src/services/events.d.ts.map +0 -1
- package/dist/src/services/publish/actors/createPublishAttempt.d.ts.map +0 -1
- package/dist/src/services/publish/actors/preparePublishRequestData.d.ts.map +0 -1
- package/dist/src/services/publish/actors/upload.d.ts.map +0 -1
- package/dist/src/services/publish/actors/validateItemData.d.ts.map +0 -1
- package/dist/src/services/publish/publishMachine.d.ts.map +0 -1
- package/dist/src/services/write/actors/validateEntity.d.ts +0 -12
- package/dist/src/services/write/actors/validateEntity.d.ts.map +0 -1
- package/dist/src/services/write/actors/writeToDatabase.d.ts.map +0 -1
- package/dist/src/services/write/writeProcessMachine.d.ts +0 -84
- package/dist/src/services/write/writeProcessMachine.d.ts.map +0 -1
- package/dist/src/stores/eas.d.ts.map +0 -1
- package/dist/src/types/browser.d.ts.map +0 -1
- package/dist/src/types/db.d.ts.map +0 -1
- package/dist/src/types/fileManager.d.ts.map +0 -1
- package/dist/src/types/helpers.d.ts.map +0 -1
- package/dist/src/types/import.d.ts.map +0 -1
- package/dist/src/types/index.d.ts +0 -43
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/types/item.d.ts +0 -68
- package/dist/src/types/item.d.ts.map +0 -1
- package/dist/src/types/machines.d.ts.map +0 -1
- package/dist/src/types/model.d.ts.map +0 -1
- package/dist/src/types/property.d.ts.map +0 -1
- package/dist/src/types/seedProtocol.d.ts.map +0 -1
- package/dist/src/types/services.d.ts.map +0 -1
- package/dist/src/vite/index.d.ts +0 -47
- package/dist/src/vite/index.d.ts.map +0 -1
- package/dist/stores/eas.js +0 -23
- package/dist/stores/eas.js.map +0 -1
- package/dist/vite/index.js +0 -554
- package/dist/vite/index.js.map +0 -1
- /package/dist/{src/Item → Item}/queries.d.ts +0 -0
- /package/dist/{src/Item → Item}/service/actors/hydrateExistingItem.d.ts +0 -0
- /package/dist/{src/Item → Item}/service/actors/hydrateNewItem.d.ts +0 -0
- /package/dist/{src/Item → Item}/service/actors/initialize.d.ts +0 -0
- /package/dist/{src/Item → Item}/service/actors/loadOrCreateItem.d.ts +0 -0
- /package/dist/{src/Item → Item}/service/actors/reload.d.ts +0 -0
- /package/dist/{src/Item → Item}/service/actors/waitForDb.d.ts +0 -0
- /package/dist/{src/ItemProperty → ItemProperty}/service/actors/hydrateFromDb.d.ts +0 -0
- /package/dist/{src/ItemProperty → ItemProperty}/service/actors/initialize.d.ts +0 -0
- /package/dist/{src/ItemProperty → ItemProperty}/service/actors/loadOrCreateProperty.d.ts +0 -0
- /package/dist/{src/ItemProperty → ItemProperty}/service/actors/resolveRelatedValue.d.ts +0 -0
- /package/dist/{src/ItemProperty → ItemProperty}/service/actors/resolveRemoteStorage.d.ts +0 -0
- /package/dist/{src/ItemProperty → ItemProperty}/service/actors/saveValueToDb/analyzeInput.d.ts +0 -0
- /package/dist/{src/ItemProperty → ItemProperty}/service/actors/saveValueToDb/index.d.ts +0 -0
- /package/dist/{src/ItemProperty → ItemProperty}/service/actors/saveValueToDb/saveImage.d.ts +0 -0
- /package/dist/{src/ItemProperty → ItemProperty}/service/actors/saveValueToDb/saveItemStorage.d.ts +0 -0
- /package/dist/{src/ItemProperty → ItemProperty}/service/actors/saveValueToDb/saveRelation.d.ts +0 -0
- /package/dist/{src/ItemProperty → ItemProperty}/service/actors/waitForDb.d.ts +0 -0
- /package/dist/{src/Model → Model}/service/actors/createModelProperties.d.ts +0 -0
- /package/dist/{src/Model → Model}/service/actors/loadOrCreateModel.d.ts +0 -0
- /package/dist/{src/Model → Model}/service/actors/validateModel.d.ts +0 -0
- /package/dist/{src/ModelProperty → ModelProperty}/service/actors/compareAndMarkDraft.d.ts +0 -0
- /package/dist/{src/ModelProperty → ModelProperty}/service/actors/saveToSchema.d.ts +0 -0
- /package/dist/{src/ModelProperty → ModelProperty}/service/actors/validateProperty.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/errors.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/index.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/actors/checkExistingSchema.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/actors/createModelInstances.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/actors/createPropertyInstances.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/actors/loadOrCreateSchema.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/actors/validateSchema.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/actors/verifyModelInstancesInCache.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/actors/verifyModelsInDb.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/actors/verifyPropertiesInDb.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/actors/verifyPropertyInstancesInCache.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/actors/verifySchemaInDb.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/actors/writeModelsToDb.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/actors/writePropertiesToDb.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/actors/writeSchemaToDb.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/service/validation/SchemaValidationService.d.ts +0 -0
- /package/dist/{src/Schema → Schema}/validation.d.ts +0 -0
- /package/dist/{src/browser → browser}/db/Db.d.ts +0 -0
- /package/dist/{src/browser → browser}/db/drizzleFiles.d.ts +0 -0
- /package/dist/{src/browser → browser}/db/sqlWasmClient.d.ts +0 -0
- /package/dist/{src/browser → browser}/helpers/EasClient.d.ts +0 -0
- /package/dist/{src/browser → browser}/helpers/FileManager.d.ts +0 -0
- /package/dist/{src/browser → browser}/helpers/PathResolver.d.ts +0 -0
- /package/dist/{src/browser → browser}/helpers/QueryClient.d.ts +0 -0
- /package/dist/{src/browser → browser}/react/OPFSImage.d.ts +0 -0
- /package/dist/{src/browser → browser}/react/SeedImage.d.ts +0 -0
- /package/dist/{src/browser → browser}/react/client.d.ts +0 -0
- /package/dist/{src/browser → browser}/react/db.d.ts +0 -0
- /package/dist/{src/browser → browser}/react/index.d.ts +0 -0
- /package/dist/{src/browser → browser}/react/itemProperty.d.ts +0 -0
- /package/dist/{src/browser → browser}/react/liveQuery.d.ts +0 -0
- /package/dist/{src/browser → browser}/react/model.d.ts +0 -0
- /package/dist/{src/browser → browser}/react/modelProperty.d.ts +0 -0
- /package/dist/{src/browser → browser}/react/schema.d.ts +0 -0
- /package/dist/{src/browser → browser}/react/services.d.ts +0 -0
- /package/dist/{src/browser → browser}/workers/FileDownloader.d.ts +0 -0
- /package/dist/{src/browser → browser}/workers/ImageResizer.d.ts +0 -0
- /package/dist/{src/browser → browser}/workers/content-hash.d.ts +0 -0
- /package/dist/{src/browser → browser}/workers/dbWorker.d.ts +0 -0
- /package/dist/{src/browser → browser}/workers/filesDownload.d.ts +0 -0
- /package/dist/{src/browser → browser}/workers/imageResize.d.ts +0 -0
- /package/dist/{src/client → client}/BaseClientManager.d.ts +0 -0
- /package/dist/{src/client → client}/ClientManager.d.ts +0 -0
- /package/dist/{src/client → client}/actions/setAddresses.d.ts +0 -0
- /package/dist/{src/client → client}/actors/addModelsToDb.d.ts +0 -0
- /package/dist/{src/client → client}/actors/addModelsToStore.d.ts +0 -0
- /package/dist/{src/client → client}/actors/dbInit.d.ts +0 -0
- /package/dist/{src/client → client}/actors/fileSystemInit.d.ts +0 -0
- /package/dist/{src/client → client}/actors/platformClassesInit.d.ts +0 -0
- /package/dist/{src/client → client}/actors/processSchemaFiles.d.ts +0 -0
- /package/dist/{src/client → client}/actors/saveAppState.d.ts +0 -0
- /package/dist/{src/client → client}/actors/saveConfig.d.ts +0 -0
- /package/dist/{src/client → client}/clientManagerMachine.d.ts +0 -0
- /package/dist/{src/client → client}/index.d.ts +0 -0
- /package/dist/{src/db → db}/configs/dev.schema.config.d.ts +0 -0
- /package/dist/{src/db → db}/read/getItem.d.ts +0 -0
- /package/dist/{src/db → db}/read/getItemData.d.ts +0 -0
- /package/dist/{src/db → db}/read/getItemProperties.d.ts +0 -0
- /package/dist/{src/db → db}/read/getItemProperty.d.ts +0 -0
- /package/dist/{src/db → db}/read/getItems.d.ts +0 -0
- /package/dist/{src/db → db}/read/getMetadata.d.ts +0 -0
- /package/dist/{src/db → db}/read/getModelSchemas.d.ts +0 -0
- /package/dist/{src/db → db}/read/getModels.d.ts +0 -0
- /package/dist/{src/db → db}/read/getPropertyData.d.ts +0 -0
- /package/dist/{src/db → db}/read/getPublishPayload.d.ts +0 -0
- /package/dist/{src/db → db}/read/getRelationValueData.d.ts +0 -0
- /package/dist/{src/db → db}/read/getSchemaUidForModel.d.ts +0 -0
- /package/dist/{src/db → db}/read/getSeedData.d.ts +0 -0
- /package/dist/{src/db → db}/read/getStorageTransactionIdForSeedUid.d.ts +0 -0
- /package/dist/{src/db → db}/read/getVersionData.d.ts +0 -0
- /package/dist/{src/db → db}/read/getVersionsForVersionUids.d.ts +0 -0
- /package/dist/{src/db → db}/read/subqueries/metadataLatest.d.ts +0 -0
- /package/dist/{src/db → db}/read/subqueries/versionData.d.ts +0 -0
- /package/dist/{src/db → db}/write/createMetadata.d.ts +0 -0
- /package/dist/{src/db → db}/write/createNewItem.d.ts +0 -0
- /package/dist/{src/db → db}/write/createSeed.d.ts +0 -0
- /package/dist/{src/db → db}/write/createSeeds.d.ts +0 -0
- /package/dist/{src/db → db}/write/createVersion.d.ts +0 -0
- /package/dist/{src/db → db}/write/deleteItem.d.ts +0 -0
- /package/dist/{src/db → db}/write/recoverDeletedItem.d.ts +0 -0
- /package/dist/{src/db → db}/write/saveAppState.d.ts +0 -0
- /package/dist/{src/db → db}/write/saveMetadata.d.ts +0 -0
- /package/dist/{src/db → db}/write/updateMetadata.d.ts +0 -0
- /package/dist/{src/eas.d.ts → eas.d.ts} +0 -0
- /package/dist/{src/eslint-rules → eslint-rules}/align-imports.d.ts +0 -0
- /package/dist/{src/eventBus.d.ts → eventBus.d.ts} +0 -0
- /package/dist/{src/events → events}/files/index.d.ts +0 -0
- /package/dist/{src/events → events}/index.d.ts +0 -0
- /package/dist/{src/events → events}/item/publish.d.ts +0 -0
- /package/dist/{src/events → events}/item/syncDbWithEas.d.ts +0 -0
- /package/dist/{src/events → events}/services/allItems.d.ts +0 -0
- /package/dist/{src/events → events}/services/index.d.ts +0 -0
- /package/dist/{src/feed.d.ts → feed.d.ts} +0 -0
- /package/dist/{src/graphql → graphql}/fragments/Attestation.d.ts +0 -0
- /package/dist/{src/graphql → graphql}/fragments/Schema.d.ts +0 -0
- /package/dist/{src/graphql → graphql}/fragments/index.d.ts +0 -0
- /package/dist/{src/graphql → graphql}/gql/fragment-masking.d.ts +0 -0
- /package/dist/{src/graphql → graphql}/gql/gql.d.ts +0 -0
- /package/dist/{src/graphql → graphql}/gql/graphql.d.ts +0 -0
- /package/dist/{src/graphql → graphql}/gql/index.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/FileManager/BaseFileManager.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/PathResolver/BasePathResolver.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/QueryClient/BaseQueryClient.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/crypto.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/db.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/environment.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/file/queries.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/files.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/getSchemaForItemProperty.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/image/queries.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/model.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/property/index.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/property.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/reactiveProxy.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/schema.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/updateMachineContext.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/updateSchema.d.ts +0 -0
- /package/dist/{src/imports → imports}/json.d.ts +0 -0
- /package/dist/{src/imports → imports}/markdown.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/IDb.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/IEasClient.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/IItem.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/IQueryClient.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/index.d.ts +0 -0
- /package/dist/{src/node → node}/codegen/drizzle.d.ts +0 -0
- /package/dist/{src/node → node}/codegen/index.d.ts +0 -0
- /package/dist/{src/node → node}/codegen/ts-to-proto.d.ts +0 -0
- /package/dist/{src/node → node}/constants.d.ts +0 -0
- /package/dist/{src/node → node}/db/Db.d.ts +0 -0
- /package/dist/{src/node → node}/db/index.d.ts +0 -0
- /package/dist/{src/node → node}/db/node.app.db.config.d.ts +0 -0
- /package/dist/{src/node → node}/helpers/EasClient.d.ts +0 -0
- /package/dist/{src/node → node}/helpers/FileManager.d.ts +0 -0
- /package/dist/{src/node → node}/helpers/PathResolver.d.ts +0 -0
- /package/dist/{src/node → node}/helpers/QueryClient.d.ts +0 -0
- /package/dist/{src/node → node}/helpers/index.d.ts +0 -0
- /package/dist/{src/node → node}/helpers/scripts.d.ts +0 -0
- /package/dist/{src/node → node}/seed.d.ts +0 -0
- /package/dist/{src/node → node}/webpack/fs-proxy.d.ts +0 -0
- /package/dist/{src/node → node}/webpack/index.d.ts +0 -0
- /package/dist/{src/seedSchema → seedSchema}/AppStateSchema.d.ts +0 -0
- /package/dist/{src/seedSchema → seedSchema}/ConfigSchema.d.ts +0 -0
- /package/dist/{src/seedSchema → seedSchema}/MetadataSchema.d.ts +0 -0
- /package/dist/{src/seedSchema → seedSchema}/ModelSchema.d.ts +0 -0
- /package/dist/{src/seedSchema → seedSchema}/ModelSchemaSchema.d.ts +0 -0
- /package/dist/{src/seedSchema → seedSchema}/ModelUidSchema.d.ts +0 -0
- /package/dist/{src/seedSchema → seedSchema}/PropertyUidSchema.d.ts +0 -0
- /package/dist/{src/seedSchema → seedSchema}/SchemaSchema.d.ts +0 -0
- /package/dist/{src/seedSchema → seedSchema}/SeedSchema.d.ts +0 -0
- /package/dist/{src/seedSchema → seedSchema}/VersionSchema.d.ts +0 -0
- /package/dist/{src/services → services}/events.d.ts +0 -0
- /package/dist/{src/services → services}/publish/actors/createPublishAttempt.d.ts +0 -0
- /package/dist/{src/services → services}/publish/actors/preparePublishRequestData.d.ts +0 -0
- /package/dist/{src/services → services}/publish/actors/upload.d.ts +0 -0
- /package/dist/{src/services → services}/publish/actors/validateItemData.d.ts +0 -0
- /package/dist/{src/services → services}/publish/publishMachine.d.ts +0 -0
- /package/dist/{src/services → services}/write/actors/writeToDatabase.d.ts +0 -0
- /package/dist/{src/stores → stores}/eas.d.ts +0 -0
- /package/dist/{src/types → types}/browser.d.ts +0 -0
- /package/dist/{src/types → types}/db.d.ts +0 -0
- /package/dist/{src/types → types}/fileManager.d.ts +0 -0
- /package/dist/{src/types → types}/helpers.d.ts +0 -0
- /package/dist/{src/types → types}/import.d.ts +0 -0
- /package/dist/{src/types → types}/machines.d.ts +0 -0
- /package/dist/{src/types → types}/model.d.ts +0 -0
- /package/dist/{src/types → types}/property.d.ts +0 -0
- /package/dist/{src/types → types}/seedProtocol.d.ts +0 -0
- /package/dist/{src/types → types}/services.d.ts +0 -0
|
@@ -0,0 +1,1866 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var xstate = require('xstate');
|
|
4
|
+
var main_cjs = require('./index-BmIVfqGN.js');
|
|
5
|
+
require('pluralize');
|
|
6
|
+
var drizzleOrm = require('drizzle-orm');
|
|
7
|
+
var debug = require('debug');
|
|
8
|
+
|
|
9
|
+
const logger$4 = debug('seedSdk:helpers:updateSchema');
|
|
10
|
+
/**
|
|
11
|
+
* Get the file path for a schema file
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Sanitize a schema name to be filesystem-safe
|
|
15
|
+
* Replaces all special characters (except alphanumeric, hyphens, underscores) with underscores
|
|
16
|
+
* Converts spaces to underscores
|
|
17
|
+
* Removes leading/trailing underscores
|
|
18
|
+
*
|
|
19
|
+
* @param name - Schema name to sanitize
|
|
20
|
+
* @returns Sanitized name safe for use in filenames
|
|
21
|
+
*/
|
|
22
|
+
const sanitizeSchemaName = (name) => {
|
|
23
|
+
return name
|
|
24
|
+
.replace(/[^a-zA-Z0-9\s_-]/g, '_') // Replace special chars (except spaces, hyphens, underscores) with underscore
|
|
25
|
+
.replace(/\s+/g, '_') // Convert spaces to underscores
|
|
26
|
+
.replace(/^_+|_+$/g, '') // Remove leading/trailing underscores
|
|
27
|
+
.replace(/_+/g, '_'); // Collapse multiple underscores to single
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Get the full file path for a schema
|
|
31
|
+
* Format: {schemaFileId}_{schemaName}_v{version}.json
|
|
32
|
+
*
|
|
33
|
+
* The ID-first format ensures all files for a schema group together when sorted alphabetically.
|
|
34
|
+
*
|
|
35
|
+
* @param name - Schema name
|
|
36
|
+
* @param version - Schema version
|
|
37
|
+
* @param schemaFileId - Schema file ID (required)
|
|
38
|
+
*/
|
|
39
|
+
const getSchemaFilePath = (name, version, schemaFileId) => {
|
|
40
|
+
const path = main_cjs.BaseFileManager.getPathModule();
|
|
41
|
+
const workingDir = main_cjs.BaseFileManager.getWorkingDir();
|
|
42
|
+
const sanitizedName = sanitizeSchemaName(name);
|
|
43
|
+
const filename = schemaFileId
|
|
44
|
+
? `${schemaFileId}_${sanitizedName}_v${version}.json`
|
|
45
|
+
: `${sanitizedName}_v${version}.json`;
|
|
46
|
+
return path.join(workingDir, filename);
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Get schemaFileId from database for a schema
|
|
50
|
+
* @param schemaName - Schema name
|
|
51
|
+
* @returns Schema file ID
|
|
52
|
+
* @throws Error if schema not found or missing schemaFileId
|
|
53
|
+
*/
|
|
54
|
+
async function getSchemaFileId(schemaName) {
|
|
55
|
+
const { BaseDb } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.BaseDb$1; });
|
|
56
|
+
const db = BaseDb.getAppDb();
|
|
57
|
+
const { schemas } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.SchemaSchema; });
|
|
58
|
+
const { eq, desc } = await import('drizzle-orm');
|
|
59
|
+
const dbSchema = await db
|
|
60
|
+
.select()
|
|
61
|
+
.from(schemas)
|
|
62
|
+
.where(eq(schemas.name, schemaName))
|
|
63
|
+
.orderBy(desc(schemas.version))
|
|
64
|
+
.limit(1);
|
|
65
|
+
if (dbSchema.length === 0 || !dbSchema[0].schemaFileId) {
|
|
66
|
+
throw new Error(`Schema ${schemaName} not found in database or missing schemaFileId`);
|
|
67
|
+
}
|
|
68
|
+
return dbSchema[0].schemaFileId;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get model name from modelId
|
|
72
|
+
* @param modelId - The model ID to look up
|
|
73
|
+
* @returns The model name, or undefined if not found
|
|
74
|
+
*/
|
|
75
|
+
async function getModelNameFromId(modelId) {
|
|
76
|
+
if (!modelId) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
const db = main_cjs.BaseDb.getAppDb();
|
|
80
|
+
if (!db) {
|
|
81
|
+
throw new Error('Database not found');
|
|
82
|
+
}
|
|
83
|
+
const modelRecords = await db
|
|
84
|
+
.select()
|
|
85
|
+
.from(main_cjs.models)
|
|
86
|
+
.where(drizzleOrm.eq(main_cjs.models.id, modelId))
|
|
87
|
+
.limit(1);
|
|
88
|
+
if (modelRecords.length === 0) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
return modelRecords[0].name;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Convert a TProperty/ModelPropertyMachineContext to SchemaPropertyUpdate format
|
|
95
|
+
* This function converts the internal property representation to the schema file format
|
|
96
|
+
* @param property - The TProperty instance to convert
|
|
97
|
+
* @param modelName - The name of the model this property belongs to
|
|
98
|
+
* @param propertyName - The name of the property
|
|
99
|
+
* @returns A SchemaPropertyUpdate object ready to be passed to updateModelProperties
|
|
100
|
+
*/
|
|
101
|
+
async function convertPropertyToSchemaUpdate(property, modelName, propertyName) {
|
|
102
|
+
const updates = {};
|
|
103
|
+
// Convert dataType to type
|
|
104
|
+
if (property.dataType) {
|
|
105
|
+
updates.type = property.dataType;
|
|
106
|
+
}
|
|
107
|
+
// Handle Relation type
|
|
108
|
+
if (property.dataType === main_cjs.ModelPropertyDataTypes.Relation) {
|
|
109
|
+
if (property.ref) {
|
|
110
|
+
updates.model = property.ref;
|
|
111
|
+
}
|
|
112
|
+
else if (property.refModelId) {
|
|
113
|
+
// If ref is not set but refModelId is, get the model name from the database
|
|
114
|
+
const refModelName = await getModelNameFromId(property.refModelId);
|
|
115
|
+
if (refModelName) {
|
|
116
|
+
updates.model = refModelName;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Handle List type
|
|
121
|
+
if (property.dataType === main_cjs.ModelPropertyDataTypes.List) {
|
|
122
|
+
if (property.refValueType) {
|
|
123
|
+
updates.items = {
|
|
124
|
+
type: property.refValueType,
|
|
125
|
+
};
|
|
126
|
+
if (property.ref) {
|
|
127
|
+
updates.items.model = property.ref;
|
|
128
|
+
}
|
|
129
|
+
else if (property.refModelId) {
|
|
130
|
+
// If ref is not set but refModelId is, get the model name from the database
|
|
131
|
+
const refModelName = await getModelNameFromId(property.refModelId);
|
|
132
|
+
if (refModelName) {
|
|
133
|
+
updates.items.model = refModelName;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Handle storage configuration (for Text properties with storage)
|
|
139
|
+
if (property.storageType || property.localStorageDir || property.filenameSuffix) {
|
|
140
|
+
const storageType = property.storageType || 'ItemStorage'; // Default to ItemStorage if not specified
|
|
141
|
+
updates.storage = {
|
|
142
|
+
type: storageType,
|
|
143
|
+
};
|
|
144
|
+
if (property.localStorageDir) {
|
|
145
|
+
updates.storage.path = property.localStorageDir;
|
|
146
|
+
}
|
|
147
|
+
if (property.filenameSuffix) {
|
|
148
|
+
updates.storage.extension = property.filenameSuffix;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
modelName,
|
|
153
|
+
propertyName,
|
|
154
|
+
updates,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Update model properties in a schema and create a new version
|
|
159
|
+
* @param schemaName - The name of the schema to update
|
|
160
|
+
* @param propertyUpdates - Array of property updates to apply
|
|
161
|
+
* @param modelUpdates - Optional array of model renames
|
|
162
|
+
* @returns The file path of the new schema version
|
|
163
|
+
* @throws Error if schema not found or updates are invalid
|
|
164
|
+
*/
|
|
165
|
+
async function updateModelProperties(schemaName, propertyUpdates, modelUpdates) {
|
|
166
|
+
// Get the latest version of the schema
|
|
167
|
+
const latestVersion = await main_cjs.getLatestSchemaVersion(schemaName);
|
|
168
|
+
if (latestVersion === 0) {
|
|
169
|
+
throw new Error(`Schema ${schemaName} not found`);
|
|
170
|
+
}
|
|
171
|
+
// Get schemaFileId from database
|
|
172
|
+
const schemaFileId = await getSchemaFileId(schemaName);
|
|
173
|
+
// Load the latest schema file
|
|
174
|
+
const latestFilePath = getSchemaFilePath(schemaName, latestVersion, schemaFileId);
|
|
175
|
+
const content = await main_cjs.BaseFileManager.readFileAsString(latestFilePath);
|
|
176
|
+
const schemaFile = JSON.parse(content);
|
|
177
|
+
if (!schemaFile.$schema) {
|
|
178
|
+
throw new Error(`Schema file ${latestFilePath} is not a complete schema file`);
|
|
179
|
+
}
|
|
180
|
+
// Create a copy of the schema for the new version
|
|
181
|
+
// Preserve schema ID and all model/property IDs
|
|
182
|
+
const newVersion = latestVersion + 1;
|
|
183
|
+
const updatedSchema = {
|
|
184
|
+
...schemaFile,
|
|
185
|
+
version: newVersion,
|
|
186
|
+
// Preserve schema ID from previous version
|
|
187
|
+
id: schemaFile.id,
|
|
188
|
+
metadata: {
|
|
189
|
+
...schemaFile.metadata,
|
|
190
|
+
updatedAt: new Date().toISOString(),
|
|
191
|
+
},
|
|
192
|
+
// Deep copy models to preserve IDs
|
|
193
|
+
models: Object.fromEntries(Object.entries(schemaFile.models).map(([modelName, model]) => [
|
|
194
|
+
modelName,
|
|
195
|
+
{
|
|
196
|
+
...model,
|
|
197
|
+
// Preserve model ID
|
|
198
|
+
id: model.id,
|
|
199
|
+
// Deep copy properties to preserve IDs
|
|
200
|
+
properties: Object.fromEntries(Object.entries(model.properties).map(([propName, prop]) => [
|
|
201
|
+
propName,
|
|
202
|
+
{
|
|
203
|
+
...prop,
|
|
204
|
+
// Preserve property ID
|
|
205
|
+
id: prop.id,
|
|
206
|
+
},
|
|
207
|
+
])),
|
|
208
|
+
},
|
|
209
|
+
])),
|
|
210
|
+
migrations: [
|
|
211
|
+
...schemaFile.migrations,
|
|
212
|
+
{
|
|
213
|
+
version: newVersion,
|
|
214
|
+
timestamp: new Date().toISOString(),
|
|
215
|
+
description: `Updated model properties: ${propertyUpdates.map(u => `${u.modelName}.${u.propertyName}`).join(', ')}`,
|
|
216
|
+
changes: propertyUpdates.map(update => ({
|
|
217
|
+
type: 'property_update',
|
|
218
|
+
modelName: update.modelName,
|
|
219
|
+
propertyName: update.propertyName,
|
|
220
|
+
updates: update.updates,
|
|
221
|
+
})),
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
};
|
|
225
|
+
// Apply property updates
|
|
226
|
+
for (const update of propertyUpdates) {
|
|
227
|
+
const model = updatedSchema.models[update.modelName];
|
|
228
|
+
if (!model) {
|
|
229
|
+
throw new Error(`Model ${update.modelName} not found in schema ${schemaName}`);
|
|
230
|
+
}
|
|
231
|
+
if (!model.properties[update.propertyName]) {
|
|
232
|
+
throw new Error(`Property ${update.propertyName} not found in model ${update.modelName} of schema ${schemaName}`);
|
|
233
|
+
}
|
|
234
|
+
// Update the property with new values
|
|
235
|
+
const property = model.properties[update.propertyName];
|
|
236
|
+
Object.assign(property, update.updates);
|
|
237
|
+
}
|
|
238
|
+
// Write the new schema version to file using ID-based naming (preferred)
|
|
239
|
+
const newFilePath = getSchemaFilePath(schemaName, newVersion, updatedSchema.id ?? undefined);
|
|
240
|
+
const newContent = JSON.stringify(updatedSchema, null, 2);
|
|
241
|
+
await main_cjs.BaseFileManager.saveFile(newFilePath, newContent);
|
|
242
|
+
// Wait for the file to be available with content (important for browser/OPFS where writes may not be immediately readable)
|
|
243
|
+
await main_cjs.BaseFileManager.waitForFileWithContent(newFilePath);
|
|
244
|
+
logger$4(`Created new schema version ${newVersion} for ${schemaName} at ${newFilePath}`);
|
|
245
|
+
// Load the new schema file to process models and add them to the database
|
|
246
|
+
// Extract model renames from migrations to pass to database update
|
|
247
|
+
const modelRenames = new Map();
|
|
248
|
+
const latestMigration = updatedSchema.migrations[updatedSchema.migrations.length - 1];
|
|
249
|
+
for (const change of latestMigration.changes) {
|
|
250
|
+
if (change.type === 'model_rename') {
|
|
251
|
+
modelRenames.set(change.oldName, change.newName);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
// Load schema with model renames handled
|
|
255
|
+
await loadSchemaWithRenames(newFilePath, modelRenames);
|
|
256
|
+
return newFilePath;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Load a schema file and handle model renames in the database
|
|
260
|
+
* This is a helper function that processes model renames before loading
|
|
261
|
+
*/
|
|
262
|
+
async function loadSchemaWithRenames(schemaFilePath, modelRenames) {
|
|
263
|
+
const content = await main_cjs.BaseFileManager.readFileAsString(schemaFilePath);
|
|
264
|
+
const schemaFile = JSON.parse(content);
|
|
265
|
+
if (!schemaFile.$schema) {
|
|
266
|
+
throw new Error(`File ${schemaFilePath} is not a complete schema file (missing $schema field).`);
|
|
267
|
+
}
|
|
268
|
+
const schemaName = schemaFile.metadata?.name;
|
|
269
|
+
const version = schemaFile.version;
|
|
270
|
+
if (!schemaName) {
|
|
271
|
+
throw new Error('Schema name is required in metadata.name');
|
|
272
|
+
}
|
|
273
|
+
// Convert to JsonImportSchema format for processing
|
|
274
|
+
// Remove id fields for JsonImportSchema format (they're not part of the import format)
|
|
275
|
+
const importData = {
|
|
276
|
+
name: schemaName,
|
|
277
|
+
models: Object.fromEntries(Object.entries(schemaFile.models).map(([modelName, model]) => [
|
|
278
|
+
modelName,
|
|
279
|
+
{
|
|
280
|
+
description: model.description,
|
|
281
|
+
properties: Object.fromEntries(Object.entries(model.properties).map(([propName, prop]) => [
|
|
282
|
+
propName,
|
|
283
|
+
{
|
|
284
|
+
type: prop.type || 'string', // Ensure type is present
|
|
285
|
+
...prop,
|
|
286
|
+
// Remove id field for import format (not part of JsonImportSchema)
|
|
287
|
+
},
|
|
288
|
+
])),
|
|
289
|
+
indexes: model.indexes,
|
|
290
|
+
},
|
|
291
|
+
])),
|
|
292
|
+
};
|
|
293
|
+
// Use dynamic import to break circular dependency
|
|
294
|
+
const { createModelsFromJson } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.json; });
|
|
295
|
+
// Generate schema ID if missing
|
|
296
|
+
if (!schemaFile.id) {
|
|
297
|
+
const { generateId } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.index; });
|
|
298
|
+
schemaFile.id = generateId();
|
|
299
|
+
logger$4('Generated schema ID for schema:', schemaFile.id);
|
|
300
|
+
}
|
|
301
|
+
// Extract schemaFileIds from JSON file and generate missing ones BEFORE creating models
|
|
302
|
+
// This ensures Model instances are created with correct IDs
|
|
303
|
+
const modelFileIds = new Map();
|
|
304
|
+
const propertyFileIds = new Map();
|
|
305
|
+
const { generateId } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.index; });
|
|
306
|
+
for (const [modelName, model] of Object.entries(schemaFile.models)) {
|
|
307
|
+
// Generate model ID if missing
|
|
308
|
+
if (!model.id) {
|
|
309
|
+
model.id = generateId();
|
|
310
|
+
logger$4(`Generated model ID for ${modelName}:`, model.id);
|
|
311
|
+
}
|
|
312
|
+
modelFileIds.set(modelName, model.id);
|
|
313
|
+
const propIds = new Map();
|
|
314
|
+
for (const [propName, prop] of Object.entries(model.properties)) {
|
|
315
|
+
// Generate property ID if missing
|
|
316
|
+
if (!prop.id) {
|
|
317
|
+
prop.id = generateId();
|
|
318
|
+
logger$4(`Generated property ID for ${modelName}.${propName}:`, prop.id);
|
|
319
|
+
}
|
|
320
|
+
propIds.set(propName, prop.id);
|
|
321
|
+
}
|
|
322
|
+
if (propIds.size > 0) {
|
|
323
|
+
propertyFileIds.set(modelName, propIds);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
// Convert JSON models to Model classes, passing modelFileIds and propertyFileIds so Model instances use correct IDs
|
|
327
|
+
const modelDefinitions = await createModelsFromJson(importData, modelFileIds, propertyFileIds);
|
|
328
|
+
// Convert schema file metadata to schema input for database
|
|
329
|
+
const schemaInput = {
|
|
330
|
+
name: schemaName,
|
|
331
|
+
version,
|
|
332
|
+
schemaFileId: schemaFile.id || null,
|
|
333
|
+
schemaData: null,
|
|
334
|
+
isDraft: false,
|
|
335
|
+
isEdited: false,
|
|
336
|
+
createdAt: new Date(schemaFile.metadata.createdAt).getTime(),
|
|
337
|
+
updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
|
|
338
|
+
};
|
|
339
|
+
// Use dynamic import to break circular dependency
|
|
340
|
+
const { addSchemaToDb, addModelsToDb } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.db; });
|
|
341
|
+
// Add schema to database with schemaFileId
|
|
342
|
+
const schemaRecord = await addSchemaToDb(schemaInput, schemaFile.id);
|
|
343
|
+
// Add models to database with model renames handled and schemaFileIds
|
|
344
|
+
await addModelsToDb(modelDefinitions, schemaRecord, modelRenames, {
|
|
345
|
+
schemaFileId: schemaFile.id,
|
|
346
|
+
modelFileIds,
|
|
347
|
+
propertyFileIds,
|
|
348
|
+
});
|
|
349
|
+
// Models are now Model instances, no registration needed
|
|
350
|
+
// They should be created via Model.create() and are accessible via Model static methods
|
|
351
|
+
for (const [modelName] of Object.entries(modelDefinitions)) {
|
|
352
|
+
logger$4('loadSchemaWithRenames - model available:', modelName);
|
|
353
|
+
}
|
|
354
|
+
return schemaFilePath;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const logger$3 = debug('seedSdk:modelProperty:actors:saveToSchema');
|
|
358
|
+
/**
|
|
359
|
+
* Get schema name from model
|
|
360
|
+
* This function finds which schema contains the given model
|
|
361
|
+
* Exported so it can be reused by ModelProperty for setting schema name
|
|
362
|
+
*/
|
|
363
|
+
async function getSchemaNameFromModel(modelName) {
|
|
364
|
+
// Get the latest schema files and find which one contains this model
|
|
365
|
+
const { listLatestSchemaFiles } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.schema$1; });
|
|
366
|
+
const latestSchemas = await listLatestSchemaFiles();
|
|
367
|
+
for (const schema of latestSchemas) {
|
|
368
|
+
try {
|
|
369
|
+
const { BaseFileManager } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.BaseFileManager$1; });
|
|
370
|
+
const content = await BaseFileManager.readFileAsString(schema.filePath);
|
|
371
|
+
const schemaFile = JSON.parse(content);
|
|
372
|
+
if (schemaFile.models && schemaFile.models[modelName]) {
|
|
373
|
+
return schema.name;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
catch (error) {
|
|
377
|
+
logger$3('Error reading schema file:', error);
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return undefined;
|
|
382
|
+
}
|
|
383
|
+
const saveToSchema = xstate.fromCallback(({ sendBack, input: { context } }) => {
|
|
384
|
+
const _saveToSchema = async () => {
|
|
385
|
+
// Use dynamic import to break circular dependency
|
|
386
|
+
const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-BgIzc3-r.js'); });
|
|
387
|
+
const validationService = new SchemaValidationService();
|
|
388
|
+
// Validate property structure before saving
|
|
389
|
+
const validationResult = validationService.validatePropertyStructure(context);
|
|
390
|
+
if (!validationResult.isValid) {
|
|
391
|
+
throw new Error(`Property validation failed: ${validationResult.errors.map(e => e.message).join(', ')}`);
|
|
392
|
+
}
|
|
393
|
+
// Validate required fields
|
|
394
|
+
if (!context.name) {
|
|
395
|
+
throw new Error('Property name is required');
|
|
396
|
+
}
|
|
397
|
+
if (!context.dataType) {
|
|
398
|
+
throw new Error('Data type is required');
|
|
399
|
+
}
|
|
400
|
+
if (!context.modelName) {
|
|
401
|
+
throw new Error(`Model not found for modelId: ${context.modelId}`);
|
|
402
|
+
}
|
|
403
|
+
// Get schema name from model
|
|
404
|
+
const schemaName = await getSchemaNameFromModel(context.modelName);
|
|
405
|
+
if (!schemaName) {
|
|
406
|
+
throw new Error(`Schema not found for model: ${context.modelName}`);
|
|
407
|
+
}
|
|
408
|
+
// Convert property context to SchemaPropertyUpdate
|
|
409
|
+
const propertyUpdate = await convertPropertyToSchemaUpdate(context, context.modelName, context.name);
|
|
410
|
+
// Update the schema with the property changes
|
|
411
|
+
await updateModelProperties(schemaName, [propertyUpdate]);
|
|
412
|
+
// Clear isEdited flag in database after saving to schema file
|
|
413
|
+
try {
|
|
414
|
+
const { BaseDb } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.BaseDb$1; });
|
|
415
|
+
const { properties: propertiesTable, models: modelsTable } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.schema; });
|
|
416
|
+
const { eq, and } = await import('drizzle-orm');
|
|
417
|
+
const db = BaseDb.getAppDb();
|
|
418
|
+
if (db && context.modelName && context.name) {
|
|
419
|
+
// Find model by name
|
|
420
|
+
const modelRecords = await db
|
|
421
|
+
.select({ id: modelsTable.id })
|
|
422
|
+
.from(modelsTable)
|
|
423
|
+
.where(eq(modelsTable.name, context.modelName))
|
|
424
|
+
.limit(1);
|
|
425
|
+
if (modelRecords.length > 0) {
|
|
426
|
+
// Find property by name and modelId
|
|
427
|
+
const propertyRecords = await db
|
|
428
|
+
.select({ id: propertiesTable.id })
|
|
429
|
+
.from(propertiesTable)
|
|
430
|
+
.where(and(eq(propertiesTable.name, context.name), eq(propertiesTable.modelId, modelRecords[0].id)))
|
|
431
|
+
.limit(1);
|
|
432
|
+
if (propertyRecords.length > 0) {
|
|
433
|
+
// Clear isEdited flag in database
|
|
434
|
+
await db
|
|
435
|
+
.update(propertiesTable)
|
|
436
|
+
.set({ isEdited: false })
|
|
437
|
+
.where(eq(propertiesTable.id, propertyRecords[0].id));
|
|
438
|
+
logger$3(`Cleared isEdited flag in database for property ${context.modelName}:${context.name}`);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
logger$3(`Error clearing isEdited flag in database: ${error}`);
|
|
445
|
+
}
|
|
446
|
+
logger$3(`Successfully saved property ${context.name} to schema ${schemaName}`);
|
|
447
|
+
};
|
|
448
|
+
_saveToSchema().then(() => {
|
|
449
|
+
sendBack({ type: 'saveToSchemaSuccess' });
|
|
450
|
+
}).catch((error) => {
|
|
451
|
+
logger$3('Error saving to schema:', error);
|
|
452
|
+
sendBack({ type: 'saveToSchemaError', error });
|
|
453
|
+
});
|
|
454
|
+
return () => {
|
|
455
|
+
// Cleanup function (optional)
|
|
456
|
+
};
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
var saveToSchema$1 = /*#__PURE__*/Object.freeze({
|
|
460
|
+
__proto__: null,
|
|
461
|
+
getSchemaNameFromModel: getSchemaNameFromModel,
|
|
462
|
+
saveToSchema: saveToSchema
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
const logger$2 = debug('seedSdk:modelProperty:actors:compareAndMarkDraft');
|
|
466
|
+
const compareAndMarkDraft = xstate.fromCallback(({ sendBack, input: { context } }) => {
|
|
467
|
+
const _compareAndMarkDraft = async () => {
|
|
468
|
+
// If _originalValues is not set, we still need to save to database if the property exists
|
|
469
|
+
// This handles the case where the name is changed before _originalValues is initialized
|
|
470
|
+
if (!context._originalValues) {
|
|
471
|
+
logger$2('No original values to compare against');
|
|
472
|
+
logger$2(`[compareAndMarkDraft] Context: modelName=${context.modelName}, name=${context.name}, id=${context.id}, _propertyFileId=${context._propertyFileId}`);
|
|
473
|
+
// If we have a name and modelName, try to save to database anyway
|
|
474
|
+
// This ensures name changes are persisted even if _originalValues isn't initialized yet
|
|
475
|
+
// We need either schemaFileId (id or _propertyFileId) to find the property in the database
|
|
476
|
+
const schemaFileId = context._propertyFileId || (typeof context.id === 'string' ? context.id : undefined);
|
|
477
|
+
if (context.modelName && context.name && schemaFileId) {
|
|
478
|
+
logger$2(`[compareAndMarkDraft] _originalValues not set, but saving to database anyway for property ${context.modelName}:${context.name} (schemaFileId: ${schemaFileId})`);
|
|
479
|
+
try {
|
|
480
|
+
const { savePropertyToDb } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.db; });
|
|
481
|
+
// Ensure _propertyFileId is set for savePropertyToDb to find the property
|
|
482
|
+
const contextWithFileId = {
|
|
483
|
+
...context,
|
|
484
|
+
_propertyFileId: schemaFileId,
|
|
485
|
+
};
|
|
486
|
+
await savePropertyToDb(contextWithFileId);
|
|
487
|
+
logger$2(`[compareAndMarkDraft] Successfully saved property ${context.modelName}:${context.name} to database (no _originalValues)`);
|
|
488
|
+
}
|
|
489
|
+
catch (error) {
|
|
490
|
+
logger$2(`[compareAndMarkDraft] Error saving property to database (no _originalValues): ${error}`);
|
|
491
|
+
// Don't throw - this is a best-effort save, but log the error for debugging
|
|
492
|
+
console.error(`[compareAndMarkDraft] Failed to save property ${context.modelName}:${context.name}:`, error);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
logger$2(`[compareAndMarkDraft] Cannot save property ${context.modelName}:${context.name} - missing required fields (schemaFileId: ${schemaFileId})`);
|
|
497
|
+
}
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
logger$2(`[compareAndMarkDraft] Comparing: context.name=${context.name}, _originalValues.name=${context._originalValues?.name}`);
|
|
501
|
+
// Compare current values with original
|
|
502
|
+
// Only compare property fields, not internal fields
|
|
503
|
+
const propertyFields = ['name', 'dataType', 'ref', 'refModelName', 'refModelId', 'refValueType', 'storageType', 'localStorageDir', 'filenameSuffix', 'modelName', 'modelId'];
|
|
504
|
+
const hasChanges = propertyFields.some(key => {
|
|
505
|
+
const currentValue = context[key];
|
|
506
|
+
const originalValue = context._originalValues?.[key];
|
|
507
|
+
// Handle name changes specifically
|
|
508
|
+
if (key === 'name') {
|
|
509
|
+
const nameChanged = currentValue !== originalValue;
|
|
510
|
+
if (nameChanged) {
|
|
511
|
+
logger$2(`[compareAndMarkDraft] Name change detected: "${originalValue}" -> "${currentValue}"`);
|
|
512
|
+
}
|
|
513
|
+
return nameChanged;
|
|
514
|
+
}
|
|
515
|
+
// Handle ref fields - compare by name
|
|
516
|
+
if (key === 'ref' || key === 'refModelName') {
|
|
517
|
+
const currentRef = context.refModelName || context.ref;
|
|
518
|
+
const originalRef = context._originalValues?.refModelName || context._originalValues?.ref;
|
|
519
|
+
// Both undefined/null means no ref, so they're the same
|
|
520
|
+
if (!currentRef && !originalRef)
|
|
521
|
+
return false;
|
|
522
|
+
return currentRef !== originalRef;
|
|
523
|
+
}
|
|
524
|
+
// For other fields, compare values (handling undefined/null)
|
|
525
|
+
if (currentValue === undefined && originalValue === undefined)
|
|
526
|
+
return false;
|
|
527
|
+
if (currentValue === null && originalValue === null)
|
|
528
|
+
return false;
|
|
529
|
+
if (currentValue === undefined && originalValue === null)
|
|
530
|
+
return false;
|
|
531
|
+
if (currentValue === null && originalValue === undefined)
|
|
532
|
+
return false;
|
|
533
|
+
return currentValue !== originalValue;
|
|
534
|
+
});
|
|
535
|
+
if (hasChanges) {
|
|
536
|
+
logger$2(`Property ${context.modelName}:${context.name} has changes, marking as edited`);
|
|
537
|
+
logger$2(`[compareAndMarkDraft] Context when saving: id=${context.id}, _propertyFileId=${context._propertyFileId}, name=${context.name}, _originalValues.name=${context._originalValues?.name}`);
|
|
538
|
+
// Use dynamic import to break circular dependency
|
|
539
|
+
const { savePropertyToDb } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.db; });
|
|
540
|
+
// Save to database (but not JSON file) - always save to DB when there are changes
|
|
541
|
+
try {
|
|
542
|
+
await savePropertyToDb(context);
|
|
543
|
+
logger$2(`[compareAndMarkDraft] Successfully saved property ${context.modelName}:${context.name} to database`);
|
|
544
|
+
}
|
|
545
|
+
catch (error) {
|
|
546
|
+
logger$2(`[compareAndMarkDraft] Error saving property to database: ${error}`);
|
|
547
|
+
throw error;
|
|
548
|
+
}
|
|
549
|
+
// Mark schema as draft if schema name is available
|
|
550
|
+
if (context._schemaName) {
|
|
551
|
+
// Get the Schema instance and mark it as draft
|
|
552
|
+
const { Schema } = await Promise.resolve().then(function () { return require('./Schema-B5cr_JVK.js'); });
|
|
553
|
+
const schema = Schema.create(context._schemaName);
|
|
554
|
+
// Send event to Schema machine to mark as draft
|
|
555
|
+
schema.getService().send({
|
|
556
|
+
type: 'markAsDraft',
|
|
557
|
+
propertyKey: `${context.modelName}:${context.name}`,
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
562
|
+
// No changes - clear edited flag in database and context
|
|
563
|
+
logger$2(`Property ${context.modelName}:${context.name} has no changes`);
|
|
564
|
+
// Clear isEdited flag in database
|
|
565
|
+
try {
|
|
566
|
+
const { BaseDb } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.BaseDb$1; });
|
|
567
|
+
const { properties: propertiesTable, models: modelsTable } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.schema; });
|
|
568
|
+
const { eq, and } = await import('drizzle-orm');
|
|
569
|
+
const db = BaseDb.getAppDb();
|
|
570
|
+
if (db && context.modelName && context.name) {
|
|
571
|
+
// Find model by name
|
|
572
|
+
const modelRecords = await db
|
|
573
|
+
.select({ id: modelsTable.id })
|
|
574
|
+
.from(modelsTable)
|
|
575
|
+
.where(eq(modelsTable.name, context.modelName))
|
|
576
|
+
.limit(1);
|
|
577
|
+
if (modelRecords.length > 0) {
|
|
578
|
+
// Find property by name and modelId
|
|
579
|
+
const propertyRecords = await db
|
|
580
|
+
.select({ id: propertiesTable.id })
|
|
581
|
+
.from(propertiesTable)
|
|
582
|
+
.where(and(eq(propertiesTable.name, context.name), eq(propertiesTable.modelId, modelRecords[0].id)))
|
|
583
|
+
.limit(1);
|
|
584
|
+
if (propertyRecords.length > 0) {
|
|
585
|
+
// Clear isEdited flag in database
|
|
586
|
+
await db
|
|
587
|
+
.update(propertiesTable)
|
|
588
|
+
.set({ isEdited: false })
|
|
589
|
+
.where(eq(propertiesTable.id, propertyRecords[0].id));
|
|
590
|
+
logger$2(`Cleared isEdited flag in database for property ${context.modelName}:${context.name}`);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
catch (error) {
|
|
596
|
+
logger$2(`Error clearing isEdited flag in database: ${error}`);
|
|
597
|
+
}
|
|
598
|
+
sendBack({
|
|
599
|
+
type: 'clearEdited',
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
_compareAndMarkDraft().then(() => {
|
|
604
|
+
sendBack({ type: 'compareAndMarkDraftSuccess' });
|
|
605
|
+
}).catch((error) => {
|
|
606
|
+
logger$2('Error comparing and marking draft:', error);
|
|
607
|
+
sendBack({ type: 'compareAndMarkDraftError', error });
|
|
608
|
+
});
|
|
609
|
+
return () => {
|
|
610
|
+
// Cleanup function (optional)
|
|
611
|
+
};
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
const logger$1 = debug('seedSdk:modelProperty:actors:validateProperty');
|
|
615
|
+
const validateProperty = xstate.fromCallback(({ sendBack, input: { context } }) => {
|
|
616
|
+
const _validateProperty = async () => {
|
|
617
|
+
console.log('[validateProperty] Starting validation for property:', context.name);
|
|
618
|
+
console.log('[validateProperty] Context:', {
|
|
619
|
+
name: context.name,
|
|
620
|
+
modelName: context.modelName,
|
|
621
|
+
_schemaName: context._schemaName,
|
|
622
|
+
_originalValues: context._originalValues
|
|
623
|
+
});
|
|
624
|
+
// Use dynamic imports to break circular dependencies
|
|
625
|
+
const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-BgIzc3-r.js'); });
|
|
626
|
+
const validationService = new SchemaValidationService();
|
|
627
|
+
const { Schema } = await Promise.resolve().then(function () { return require('./Schema-B5cr_JVK.js'); });
|
|
628
|
+
// Validate property structure
|
|
629
|
+
console.log('[validateProperty] Validating property structure...');
|
|
630
|
+
const structureResult = validationService.validatePropertyStructure(context);
|
|
631
|
+
console.log('[validateProperty] Structure validation result:', structureResult.isValid);
|
|
632
|
+
if (!structureResult.isValid) {
|
|
633
|
+
console.log('[validateProperty] Structure validation failed:', structureResult.errors);
|
|
634
|
+
sendBack({ type: 'validationError', errors: structureResult.errors });
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
console.log('[validateProperty] Structure validation passed');
|
|
638
|
+
// If we have schema name and model name, validate against schema
|
|
639
|
+
console.log('[validateProperty] Checking schema validation:', { hasSchemaName: !!context._schemaName, hasModelName: !!context.modelName });
|
|
640
|
+
if (context._schemaName && context.modelName) {
|
|
641
|
+
try {
|
|
642
|
+
console.log('[validateProperty] Creating schema instance:', context._schemaName);
|
|
643
|
+
const schema = Schema.create(context._schemaName);
|
|
644
|
+
const schemaSnapshot = schema.getService().getSnapshot();
|
|
645
|
+
const schemaStatus = schemaSnapshot.value;
|
|
646
|
+
console.log('[validateProperty] Schema status:', schemaStatus);
|
|
647
|
+
// Only validate against schema if it's loaded (in idle state)
|
|
648
|
+
// If still loading, skip schema validation and only do structure validation
|
|
649
|
+
if (schemaStatus === 'idle') {
|
|
650
|
+
const schemaContext = schemaSnapshot.context;
|
|
651
|
+
console.log('[validateProperty] Schema context models:', schemaContext.models ? Object.keys(schemaContext.models).length : 'null');
|
|
652
|
+
// Check if models are actually loaded
|
|
653
|
+
if (schemaContext.models && Object.keys(schemaContext.models).length > 0) {
|
|
654
|
+
// If property name has changed, validate against the original name (from schema file)
|
|
655
|
+
// This handles the case where a property is renamed - the schema file still has the old name
|
|
656
|
+
const propertyNameToValidate = context._originalValues?.name && context._originalValues.name !== context.name
|
|
657
|
+
? context._originalValues.name
|
|
658
|
+
: context.name || '';
|
|
659
|
+
console.log('[validateProperty] Validating against schema:', {
|
|
660
|
+
modelName: context.modelName,
|
|
661
|
+
propertyNameToValidate,
|
|
662
|
+
originalName: context._originalValues?.name,
|
|
663
|
+
currentName: context.name
|
|
664
|
+
});
|
|
665
|
+
const schemaResult = validationService.validateProperty(schemaContext, context.modelName, propertyNameToValidate, context);
|
|
666
|
+
console.log('[validateProperty] Schema validation result:', { isValid: schemaResult.isValid, errors: schemaResult.errors.length, errorCodes: schemaResult.errors.map(e => e.code) });
|
|
667
|
+
if (!schemaResult.isValid) {
|
|
668
|
+
// If property was renamed, some validation errors are expected (like property_not_found, missing_type)
|
|
669
|
+
// Only fail if it's a critical error that's not related to the rename
|
|
670
|
+
const isRenamed = context._originalValues?.name && context._originalValues.name !== context.name;
|
|
671
|
+
const criticalErrors = schemaResult.errors.filter(err => {
|
|
672
|
+
// Allow property_not_found and missing_type errors when property is renamed
|
|
673
|
+
if (isRenamed && (err.code === 'property_not_found' || err.code === 'missing_type')) {
|
|
674
|
+
return false; // Not critical
|
|
675
|
+
}
|
|
676
|
+
// For non-renamed properties, only allow property_not_found if we're validating with the same name
|
|
677
|
+
if (err.code === 'property_not_found' && propertyNameToValidate === context.name) {
|
|
678
|
+
return false; // Not critical
|
|
679
|
+
}
|
|
680
|
+
return true; // Critical error
|
|
681
|
+
});
|
|
682
|
+
console.log('[validateProperty] Filtered critical errors:', {
|
|
683
|
+
totalErrors: schemaResult.errors.length,
|
|
684
|
+
criticalErrors: criticalErrors.length,
|
|
685
|
+
errorCodes: schemaResult.errors.map(e => e.code),
|
|
686
|
+
criticalErrorCodes: criticalErrors.map(e => e.code)
|
|
687
|
+
});
|
|
688
|
+
if (criticalErrors.length > 0) {
|
|
689
|
+
console.log('[validateProperty] Sending validationError with critical errors');
|
|
690
|
+
sendBack({ type: 'validationError', errors: criticalErrors });
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
console.log('[validateProperty] No critical errors, continuing with validation');
|
|
694
|
+
// Continue with validation - rename-related errors are acceptable
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
console.log('[validateProperty] Schema models not loaded yet, skipping schema validation');
|
|
699
|
+
logger$1('Schema models not loaded yet, skipping schema validation');
|
|
700
|
+
// Continue with structure validation only
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
else {
|
|
704
|
+
logger$1(`Schema is in ${schemaStatus} state, skipping schema validation`);
|
|
705
|
+
// Continue with structure validation only
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
catch (error) {
|
|
709
|
+
console.log('[validateProperty] Error validating property against schema:', error);
|
|
710
|
+
logger$1('Error validating property against schema:', error);
|
|
711
|
+
// Continue with structure validation only
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
else {
|
|
715
|
+
console.log('[validateProperty] Skipping schema validation (no _schemaName or modelName)');
|
|
716
|
+
}
|
|
717
|
+
// All validations passed
|
|
718
|
+
console.log('[validateProperty] All validations passed, sending validationSuccess');
|
|
719
|
+
sendBack({ type: 'validationSuccess', errors: [] });
|
|
720
|
+
};
|
|
721
|
+
_validateProperty().catch((error) => {
|
|
722
|
+
logger$1('Error in validateProperty:', error);
|
|
723
|
+
sendBack({
|
|
724
|
+
type: 'validationError',
|
|
725
|
+
errors: [{
|
|
726
|
+
field: 'property',
|
|
727
|
+
message: error instanceof Error ? error.message : 'Unknown validation error',
|
|
728
|
+
code: 'validation_exception',
|
|
729
|
+
severity: 'error',
|
|
730
|
+
}],
|
|
731
|
+
});
|
|
732
|
+
});
|
|
733
|
+
return () => {
|
|
734
|
+
// Cleanup function (optional)
|
|
735
|
+
};
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
const modelPropertyMachine = xstate.setup({
|
|
739
|
+
types: {
|
|
740
|
+
context: {},
|
|
741
|
+
input: {},
|
|
742
|
+
events: {},
|
|
743
|
+
},
|
|
744
|
+
actors: {
|
|
745
|
+
saveToSchema,
|
|
746
|
+
compareAndMarkDraft,
|
|
747
|
+
validateProperty,
|
|
748
|
+
writeProcessMachine: main_cjs.writeProcessMachine,
|
|
749
|
+
},
|
|
750
|
+
guards: {
|
|
751
|
+
isPropertyValid: ({ context }) => {
|
|
752
|
+
return !context._validationErrors || context._validationErrors.length === 0;
|
|
753
|
+
},
|
|
754
|
+
hasValidationErrors: ({ context }) => {
|
|
755
|
+
return !!context._validationErrors && context._validationErrors.length > 0;
|
|
756
|
+
},
|
|
757
|
+
},
|
|
758
|
+
actions: {
|
|
759
|
+
assignValidationErrors: xstate.assign(({ context, event }) => {
|
|
760
|
+
if (event.type === 'validationError') {
|
|
761
|
+
return {
|
|
762
|
+
...context,
|
|
763
|
+
_validationErrors: event.errors,
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
return context;
|
|
767
|
+
}),
|
|
768
|
+
},
|
|
769
|
+
}).createMachine({
|
|
770
|
+
id: 'modelProperty',
|
|
771
|
+
initial: 'idle',
|
|
772
|
+
context: ({ input }) => {
|
|
773
|
+
const context = input;
|
|
774
|
+
console.log('[modelPropertyMachine] Initializing context with input:', JSON.stringify({
|
|
775
|
+
name: context.name,
|
|
776
|
+
modelName: context.modelName,
|
|
777
|
+
ref: context.ref,
|
|
778
|
+
refModelName: context.refModelName,
|
|
779
|
+
refModelId: context.refModelId,
|
|
780
|
+
dataType: context.dataType,
|
|
781
|
+
}, null, 2));
|
|
782
|
+
return context;
|
|
783
|
+
},
|
|
784
|
+
on: {
|
|
785
|
+
updateContext: {
|
|
786
|
+
actions: xstate.assign(({ context, event }) => {
|
|
787
|
+
const newContext = Object.assign({}, context);
|
|
788
|
+
// Check if this is only updating internal fields
|
|
789
|
+
const onlyInternalFields = Object.keys(event).every((key) => {
|
|
790
|
+
return key === 'type' || key.startsWith('_');
|
|
791
|
+
});
|
|
792
|
+
// Debug logging
|
|
793
|
+
if (event.name !== undefined) {
|
|
794
|
+
console.log(`[modelPropertyMachine] updateContext with name change: "${context.name}" -> "${event.name}"`);
|
|
795
|
+
console.log(`[modelPropertyMachine] onlyInternalFields: ${onlyInternalFields}, has _originalValues: ${!!context._originalValues}`);
|
|
796
|
+
}
|
|
797
|
+
// Update the context with new values
|
|
798
|
+
for (let i = 0; i < Object.keys(event).length; i++) {
|
|
799
|
+
const key = Object.keys(event)[i];
|
|
800
|
+
if (key === 'type') {
|
|
801
|
+
continue;
|
|
802
|
+
}
|
|
803
|
+
let value = event[key];
|
|
804
|
+
// Convert null to undefined for optional fields (TypeBox validation expects undefined, not null)
|
|
805
|
+
// This is especially important for refValueType, refModelId, etc.
|
|
806
|
+
if (value === null && (key === 'refValueType' || key === 'refModelId' || key === 'ref' || key === 'refModelName')) {
|
|
807
|
+
value = undefined;
|
|
808
|
+
}
|
|
809
|
+
newContext[key] = value;
|
|
810
|
+
}
|
|
811
|
+
// Compare with original values and set _isEdited flag (only for non-internal updates)
|
|
812
|
+
if (!onlyInternalFields && context._originalValues) {
|
|
813
|
+
const hasChanges = Object.keys(event).some((key) => {
|
|
814
|
+
if (key === 'type' || key.startsWith('_'))
|
|
815
|
+
return false;
|
|
816
|
+
return newContext[key] !== context._originalValues?.[key];
|
|
817
|
+
});
|
|
818
|
+
newContext._isEdited = hasChanges;
|
|
819
|
+
}
|
|
820
|
+
// Clear validation errors on context update (will be re-validated if needed)
|
|
821
|
+
newContext._validationErrors = undefined;
|
|
822
|
+
// Convert null to undefined for optional fields (TypeBox validation expects undefined, not null)
|
|
823
|
+
// This is especially important for refValueType, refModelId, etc.
|
|
824
|
+
const optionalFields = ['refValueType', 'refModelId', 'ref', 'refModelName'];
|
|
825
|
+
for (const field of optionalFields) {
|
|
826
|
+
if (newContext[field] === null) {
|
|
827
|
+
newContext[field] = undefined;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
return newContext;
|
|
831
|
+
}),
|
|
832
|
+
// Only trigger validation and compareAndMarkDraft if we're updating non-internal fields
|
|
833
|
+
guard: ({ event }) => {
|
|
834
|
+
const shouldTransition = !Object.keys(event).every((key) => {
|
|
835
|
+
return key === 'type' || key.startsWith('_');
|
|
836
|
+
});
|
|
837
|
+
if (event.name !== undefined) {
|
|
838
|
+
console.log(`[modelPropertyMachine] updateContext guard result: ${shouldTransition} (will ${shouldTransition ? 'transition' : 'not transition'} to validating)`);
|
|
839
|
+
}
|
|
840
|
+
return shouldTransition;
|
|
841
|
+
},
|
|
842
|
+
target: '.validating',
|
|
843
|
+
},
|
|
844
|
+
validateProperty: {
|
|
845
|
+
target: '.validating',
|
|
846
|
+
},
|
|
847
|
+
validationSuccess: {
|
|
848
|
+
actions: xstate.assign(({ context, event }) => ({
|
|
849
|
+
...context,
|
|
850
|
+
_validationErrors: [],
|
|
851
|
+
})),
|
|
852
|
+
},
|
|
853
|
+
validationError: {
|
|
854
|
+
actions: 'assignValidationErrors',
|
|
855
|
+
// Note: State-specific transitions are handled in child states
|
|
856
|
+
// This root handler ensures errors are always assigned to context
|
|
857
|
+
},
|
|
858
|
+
initializeOriginalValues: {
|
|
859
|
+
actions: xstate.assign(({ context, event }) => ({
|
|
860
|
+
...context,
|
|
861
|
+
_originalValues: event.originalValues,
|
|
862
|
+
_schemaName: event.schemaName,
|
|
863
|
+
_isEdited: event.isEdited ?? false,
|
|
864
|
+
_validationErrors: undefined,
|
|
865
|
+
})),
|
|
866
|
+
},
|
|
867
|
+
clearEdited: {
|
|
868
|
+
actions: xstate.assign(({ context }) => ({
|
|
869
|
+
...context,
|
|
870
|
+
_isEdited: false,
|
|
871
|
+
_originalValues: { ...context },
|
|
872
|
+
})),
|
|
873
|
+
},
|
|
874
|
+
setSchemaName: {
|
|
875
|
+
actions: xstate.assign(({ context, event }) => ({
|
|
876
|
+
...context,
|
|
877
|
+
_schemaName: event.schemaName,
|
|
878
|
+
})),
|
|
879
|
+
},
|
|
880
|
+
},
|
|
881
|
+
states: {
|
|
882
|
+
idle: {
|
|
883
|
+
entry: xstate.assign({
|
|
884
|
+
writeProcess: ({ spawn, context }) => {
|
|
885
|
+
// Spawn writeProcess if we have id (schemaFileId)
|
|
886
|
+
// New properties will have id generated
|
|
887
|
+
const entityId = context.id;
|
|
888
|
+
if (!context.writeProcess && entityId) {
|
|
889
|
+
return spawn(main_cjs.writeProcessMachine, {
|
|
890
|
+
input: {
|
|
891
|
+
entityType: 'modelProperty',
|
|
892
|
+
entityId: String(entityId),
|
|
893
|
+
entityData: context,
|
|
894
|
+
},
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
return context.writeProcess;
|
|
898
|
+
},
|
|
899
|
+
}),
|
|
900
|
+
on: {
|
|
901
|
+
validateProperty: {
|
|
902
|
+
target: 'validating',
|
|
903
|
+
},
|
|
904
|
+
requestWrite: {
|
|
905
|
+
actions: ({ context, event }) => {
|
|
906
|
+
if (context.writeProcess) {
|
|
907
|
+
context.writeProcess.send({
|
|
908
|
+
type: 'startWrite',
|
|
909
|
+
data: event.data,
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
},
|
|
913
|
+
},
|
|
914
|
+
},
|
|
915
|
+
},
|
|
916
|
+
validating: {
|
|
917
|
+
entry: () => {
|
|
918
|
+
console.log('[modelPropertyMachine] Entered validating state');
|
|
919
|
+
},
|
|
920
|
+
on: {
|
|
921
|
+
validationSuccess: {
|
|
922
|
+
target: 'compareAndMarkDraft',
|
|
923
|
+
actions: xstate.assign(({ context, event }) => {
|
|
924
|
+
console.log('[modelPropertyMachine] validationSuccess, transitioning to compareAndMarkDraft');
|
|
925
|
+
return {
|
|
926
|
+
...context,
|
|
927
|
+
_validationErrors: [],
|
|
928
|
+
};
|
|
929
|
+
}),
|
|
930
|
+
},
|
|
931
|
+
// validationError: Uses root handler for assignment, but needs state-specific transition
|
|
932
|
+
validationError: {
|
|
933
|
+
target: 'idle',
|
|
934
|
+
actions: 'assignValidationErrors',
|
|
935
|
+
},
|
|
936
|
+
},
|
|
937
|
+
invoke: {
|
|
938
|
+
src: 'validateProperty',
|
|
939
|
+
input: ({ context }) => ({ context }),
|
|
940
|
+
},
|
|
941
|
+
},
|
|
942
|
+
compareAndMarkDraft: {
|
|
943
|
+
entry: () => {
|
|
944
|
+
console.log('[modelPropertyMachine] Entered compareAndMarkDraft state');
|
|
945
|
+
},
|
|
946
|
+
on: {
|
|
947
|
+
compareAndMarkDraftSuccess: {
|
|
948
|
+
target: 'idle',
|
|
949
|
+
},
|
|
950
|
+
compareAndMarkDraftError: {
|
|
951
|
+
target: 'idle',
|
|
952
|
+
},
|
|
953
|
+
},
|
|
954
|
+
invoke: {
|
|
955
|
+
src: 'compareAndMarkDraft',
|
|
956
|
+
input: ({ context }) => {
|
|
957
|
+
console.log('[modelPropertyMachine] Invoking compareAndMarkDraft with context:', {
|
|
958
|
+
name: context.name,
|
|
959
|
+
_originalValues: context._originalValues,
|
|
960
|
+
modelName: context.modelName,
|
|
961
|
+
id: context.id,
|
|
962
|
+
_propertyFileId: context._propertyFileId
|
|
963
|
+
});
|
|
964
|
+
return { context };
|
|
965
|
+
},
|
|
966
|
+
},
|
|
967
|
+
},
|
|
968
|
+
saveToSchema: {
|
|
969
|
+
always: {
|
|
970
|
+
guard: 'isPropertyValid',
|
|
971
|
+
target: '.saving',
|
|
972
|
+
},
|
|
973
|
+
initial: 'saving',
|
|
974
|
+
on: {
|
|
975
|
+
// validationError: Uses root handler for assignment, but needs state-specific transition
|
|
976
|
+
validationError: {
|
|
977
|
+
target: 'idle',
|
|
978
|
+
actions: 'assignValidationErrors',
|
|
979
|
+
},
|
|
980
|
+
},
|
|
981
|
+
invoke: {
|
|
982
|
+
src: 'validateProperty',
|
|
983
|
+
input: ({ context }) => ({ context }),
|
|
984
|
+
},
|
|
985
|
+
states: {
|
|
986
|
+
saving: {
|
|
987
|
+
on: {
|
|
988
|
+
saveToSchemaSuccess: {
|
|
989
|
+
target: '#modelProperty.idle',
|
|
990
|
+
},
|
|
991
|
+
saveToSchemaError: {
|
|
992
|
+
target: '#modelProperty.idle',
|
|
993
|
+
},
|
|
994
|
+
},
|
|
995
|
+
invoke: {
|
|
996
|
+
src: 'saveToSchema',
|
|
997
|
+
input: ({ context }) => ({ context }),
|
|
998
|
+
},
|
|
999
|
+
},
|
|
1000
|
+
},
|
|
1001
|
+
},
|
|
1002
|
+
},
|
|
1003
|
+
});
|
|
1004
|
+
|
|
1005
|
+
const logger = debug('seedSdk:modelProperty:ModelProperty');
|
|
1006
|
+
// Define the property keys from TProperty
|
|
1007
|
+
const TPropertyKeys = [
|
|
1008
|
+
'id',
|
|
1009
|
+
'name',
|
|
1010
|
+
'dataType',
|
|
1011
|
+
'ref',
|
|
1012
|
+
'modelId',
|
|
1013
|
+
'refModelId',
|
|
1014
|
+
'refValueType',
|
|
1015
|
+
'storageType',
|
|
1016
|
+
'localStorageDir',
|
|
1017
|
+
'filenameSuffix',
|
|
1018
|
+
'modelName',
|
|
1019
|
+
'refModelName',
|
|
1020
|
+
];
|
|
1021
|
+
class ModelProperty {
|
|
1022
|
+
constructor(property) {
|
|
1023
|
+
// id is now the schemaFileId (string), _dbId is the database integer ID
|
|
1024
|
+
// Preserve _propertyFileId if it exists in the property object (from getPropertySchema)
|
|
1025
|
+
// Convert null to undefined for optional fields (TypeBox validation expects undefined, not null)
|
|
1026
|
+
const serviceInput = {
|
|
1027
|
+
...property,
|
|
1028
|
+
_propertyFileId: property._propertyFileId || property.id,
|
|
1029
|
+
refValueType: property.refValueType ?? undefined,
|
|
1030
|
+
refModelId: property.refModelId ?? undefined,
|
|
1031
|
+
ref: property.ref ?? undefined,
|
|
1032
|
+
refModelName: property.refModelName ?? undefined,
|
|
1033
|
+
};
|
|
1034
|
+
this._service = xstate.createActor(modelPropertyMachine, {
|
|
1035
|
+
input: serviceInput,
|
|
1036
|
+
});
|
|
1037
|
+
this._service.start();
|
|
1038
|
+
// Initialize original values from the input property
|
|
1039
|
+
this._initializeOriginalValues(property);
|
|
1040
|
+
// Note: Property getters/setters are now handled by the Proxy in create()
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Initialize original values and schema name for tracking changes
|
|
1044
|
+
* This is called asynchronously after construction
|
|
1045
|
+
* If the property was loaded from the database and differs from the schema file,
|
|
1046
|
+
* it will be marked as edited.
|
|
1047
|
+
*/
|
|
1048
|
+
_initializeOriginalValues(property) {
|
|
1049
|
+
// Resolve refModelId if ref/refModelName is provided but refModelId is missing
|
|
1050
|
+
const refModelName = property.refModelName || property.ref;
|
|
1051
|
+
if (refModelName && !property.refModelId) {
|
|
1052
|
+
// Resolve refModelId asynchronously and update context
|
|
1053
|
+
this._resolveRefModelId(refModelName).then((refModelId) => {
|
|
1054
|
+
if (refModelId) {
|
|
1055
|
+
// Update the context with the resolved refModelId
|
|
1056
|
+
this._service.send({
|
|
1057
|
+
type: 'updateContext',
|
|
1058
|
+
refModelId,
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
}).catch(() => {
|
|
1062
|
+
// Ignore errors - model might not exist yet
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
// Get schema file values to use as "original" values
|
|
1066
|
+
// This allows us to detect if the property was edited (DB value differs from schema file)
|
|
1067
|
+
this._getSchemaFileValues(property).then((schemaFileValues) => {
|
|
1068
|
+
// Use schema file values as original (not the current property values)
|
|
1069
|
+
// This way, if current values differ from schema file, _isEdited will be true
|
|
1070
|
+
const originalValues = schemaFileValues || {};
|
|
1071
|
+
// Compare current property values with schema file values to determine if edited
|
|
1072
|
+
// Only compare schema-relevant fields, not database-specific fields like id, modelId
|
|
1073
|
+
let isEdited = false;
|
|
1074
|
+
if (schemaFileValues) {
|
|
1075
|
+
// Fields that are schema-relevant and should be compared
|
|
1076
|
+
const schemaRelevantFields = [
|
|
1077
|
+
'dataType',
|
|
1078
|
+
'ref',
|
|
1079
|
+
'refModelName',
|
|
1080
|
+
'refValueType',
|
|
1081
|
+
'storageType',
|
|
1082
|
+
'localStorageDir',
|
|
1083
|
+
'filenameSuffix',
|
|
1084
|
+
];
|
|
1085
|
+
// Check if any schema-relevant field differs between current property and schema file
|
|
1086
|
+
isEdited = schemaRelevantFields.some((key) => {
|
|
1087
|
+
const currentValue = property[key];
|
|
1088
|
+
const originalValue = schemaFileValues[key];
|
|
1089
|
+
// Handle ref fields - compare by name
|
|
1090
|
+
if (key === 'ref' || key === 'refModelName') {
|
|
1091
|
+
const currentRef = property.refModelName || property.ref;
|
|
1092
|
+
const originalRef = schemaFileValues.refModelName || schemaFileValues.ref;
|
|
1093
|
+
// Both undefined/null means no ref, so they're the same
|
|
1094
|
+
if (!currentRef && !originalRef)
|
|
1095
|
+
return false;
|
|
1096
|
+
return currentRef !== originalRef;
|
|
1097
|
+
}
|
|
1098
|
+
// For other fields, compare values (handling undefined/null)
|
|
1099
|
+
if (currentValue === undefined && originalValue === undefined)
|
|
1100
|
+
return false;
|
|
1101
|
+
if (currentValue === null && originalValue === null)
|
|
1102
|
+
return false;
|
|
1103
|
+
if (currentValue === undefined && originalValue === null)
|
|
1104
|
+
return false;
|
|
1105
|
+
if (currentValue === null && originalValue === undefined)
|
|
1106
|
+
return false;
|
|
1107
|
+
return currentValue !== originalValue;
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
else {
|
|
1111
|
+
// No schema file values found - this is a runtime-created property
|
|
1112
|
+
// Use current property as original, but mark as edited since it hasn't been exported to file
|
|
1113
|
+
TPropertyKeys.forEach((key) => {
|
|
1114
|
+
if (property[key] !== undefined) {
|
|
1115
|
+
originalValues[key] = property[key];
|
|
1116
|
+
}
|
|
1117
|
+
});
|
|
1118
|
+
// For runtime-created properties, set isEdited = true initially
|
|
1119
|
+
isEdited = true;
|
|
1120
|
+
}
|
|
1121
|
+
// Initialize with original values, including isEdited flag
|
|
1122
|
+
// Load isEdited from database if property exists in DB (async, fire-and-forget)
|
|
1123
|
+
this._loadIsEditedFromDb(property, isEdited).then((isEditedFromDb) => {
|
|
1124
|
+
this._service.send({
|
|
1125
|
+
type: 'initializeOriginalValues',
|
|
1126
|
+
originalValues,
|
|
1127
|
+
schemaName: undefined, // Will be set later if needed
|
|
1128
|
+
isEdited: isEditedFromDb,
|
|
1129
|
+
});
|
|
1130
|
+
}).catch(() => {
|
|
1131
|
+
// If we can't load from DB, use computed isEdited value
|
|
1132
|
+
this._service.send({
|
|
1133
|
+
type: 'initializeOriginalValues',
|
|
1134
|
+
originalValues,
|
|
1135
|
+
schemaName: undefined, // Will be set later if needed
|
|
1136
|
+
isEdited,
|
|
1137
|
+
});
|
|
1138
|
+
});
|
|
1139
|
+
}).catch(() => {
|
|
1140
|
+
// If we can't get schema file values, use current property as original
|
|
1141
|
+
const originalValues = {};
|
|
1142
|
+
TPropertyKeys.forEach((key) => {
|
|
1143
|
+
if (property[key] !== undefined) {
|
|
1144
|
+
originalValues[key] = property[key];
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
this._service.send({
|
|
1148
|
+
type: 'initializeOriginalValues',
|
|
1149
|
+
originalValues,
|
|
1150
|
+
schemaName: undefined,
|
|
1151
|
+
});
|
|
1152
|
+
});
|
|
1153
|
+
// Get schema name from model asynchronously (fire-and-forget)
|
|
1154
|
+
if (property.modelName) {
|
|
1155
|
+
this._setSchemaName(property.modelName).catch(() => {
|
|
1156
|
+
// If we can't get schema name, that's okay - it will be set later if needed
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Load isEdited flag from database if property exists in DB
|
|
1162
|
+
* @param property - The property data
|
|
1163
|
+
* @param fallbackIsEdited - Fallback value if property doesn't exist in DB
|
|
1164
|
+
* @returns The isEdited flag from database or fallback value
|
|
1165
|
+
*/
|
|
1166
|
+
async _loadIsEditedFromDb(property, fallbackIsEdited) {
|
|
1167
|
+
if (!property.modelName || !property.name) {
|
|
1168
|
+
return fallbackIsEdited;
|
|
1169
|
+
}
|
|
1170
|
+
try {
|
|
1171
|
+
const { BaseDb } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.BaseDb$1; });
|
|
1172
|
+
const { properties: propertiesTable, models: modelsTable } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.schema; });
|
|
1173
|
+
const { eq, and } = await import('drizzle-orm');
|
|
1174
|
+
const db = BaseDb.getAppDb();
|
|
1175
|
+
if (!db) {
|
|
1176
|
+
return fallbackIsEdited;
|
|
1177
|
+
}
|
|
1178
|
+
// Find model by name
|
|
1179
|
+
const modelRecords = await db
|
|
1180
|
+
.select({ id: modelsTable.id })
|
|
1181
|
+
.from(modelsTable)
|
|
1182
|
+
.where(eq(modelsTable.name, property.modelName))
|
|
1183
|
+
.limit(1);
|
|
1184
|
+
if (modelRecords.length === 0) {
|
|
1185
|
+
return fallbackIsEdited;
|
|
1186
|
+
}
|
|
1187
|
+
// Find property by name and modelId
|
|
1188
|
+
const propertyRecords = await db
|
|
1189
|
+
.select({ isEdited: propertiesTable.isEdited })
|
|
1190
|
+
.from(propertiesTable)
|
|
1191
|
+
.where(and(eq(propertiesTable.name, property.name), eq(propertiesTable.modelId, modelRecords[0].id)))
|
|
1192
|
+
.limit(1);
|
|
1193
|
+
if (propertyRecords.length > 0) {
|
|
1194
|
+
return propertyRecords[0].isEdited ?? false;
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
catch (error) {
|
|
1198
|
+
// Ignore errors - use fallback value
|
|
1199
|
+
}
|
|
1200
|
+
return fallbackIsEdited;
|
|
1201
|
+
}
|
|
1202
|
+
/**
|
|
1203
|
+
* Resolve refModelId from refModelName by querying the database
|
|
1204
|
+
* @param refModelName - The name of the referenced model
|
|
1205
|
+
* @returns The database ID of the referenced model, or undefined if not found
|
|
1206
|
+
*/
|
|
1207
|
+
async _resolveRefModelId(refModelName) {
|
|
1208
|
+
if (!refModelName) {
|
|
1209
|
+
return undefined;
|
|
1210
|
+
}
|
|
1211
|
+
try {
|
|
1212
|
+
const { BaseDb } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.BaseDb$1; });
|
|
1213
|
+
const seedSchema = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.schema; });
|
|
1214
|
+
const modelsTable = seedSchema.models;
|
|
1215
|
+
const { eq } = await import('drizzle-orm');
|
|
1216
|
+
const db = BaseDb.getAppDb();
|
|
1217
|
+
if (!db) {
|
|
1218
|
+
return undefined;
|
|
1219
|
+
}
|
|
1220
|
+
const refModelRecords = await db
|
|
1221
|
+
.select()
|
|
1222
|
+
.from(modelsTable)
|
|
1223
|
+
.where(eq(modelsTable.name, refModelName))
|
|
1224
|
+
.limit(1);
|
|
1225
|
+
if (refModelRecords.length > 0 && refModelRecords[0].id) {
|
|
1226
|
+
return refModelRecords[0].id;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
catch (error) {
|
|
1230
|
+
// Ignore errors - model might not exist yet or database not available
|
|
1231
|
+
logger(`Error resolving refModelId for model "${refModelName}":`, error);
|
|
1232
|
+
}
|
|
1233
|
+
return undefined;
|
|
1234
|
+
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Get schema file values for this property to use as "original" values
|
|
1237
|
+
* This allows comparison with database values to detect edits
|
|
1238
|
+
*/
|
|
1239
|
+
async _getSchemaFileValues(property) {
|
|
1240
|
+
if (!property.modelName || !property.name) {
|
|
1241
|
+
return undefined;
|
|
1242
|
+
}
|
|
1243
|
+
try {
|
|
1244
|
+
const { Model } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.Model$1; });
|
|
1245
|
+
const { modelPropertiesToObject } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.model; });
|
|
1246
|
+
const model = await Model.getByNameAsync(property.modelName);
|
|
1247
|
+
if (!model || !model.properties || model.properties.length === 0) {
|
|
1248
|
+
return undefined;
|
|
1249
|
+
}
|
|
1250
|
+
const schema = modelPropertiesToObject(model.properties);
|
|
1251
|
+
// Get the schema file value for this property
|
|
1252
|
+
const schemaFileValue = schema[property.name];
|
|
1253
|
+
if (!schemaFileValue) {
|
|
1254
|
+
return undefined;
|
|
1255
|
+
}
|
|
1256
|
+
// Return schema file values as original values
|
|
1257
|
+
const originalValues = {
|
|
1258
|
+
name: property.name,
|
|
1259
|
+
modelName: property.modelName,
|
|
1260
|
+
dataType: schemaFileValue.dataType,
|
|
1261
|
+
storageType: schemaFileValue.storageType,
|
|
1262
|
+
localStorageDir: schemaFileValue.localStorageDir,
|
|
1263
|
+
filenameSuffix: schemaFileValue.filenameSuffix,
|
|
1264
|
+
};
|
|
1265
|
+
// Handle ref fields
|
|
1266
|
+
if (schemaFileValue.ref) {
|
|
1267
|
+
originalValues.ref = schemaFileValue.ref;
|
|
1268
|
+
originalValues.refModelName = schemaFileValue.ref;
|
|
1269
|
+
// Try to get refModelId from database
|
|
1270
|
+
const refModelId = await this._resolveRefModelId(schemaFileValue.ref);
|
|
1271
|
+
if (refModelId) {
|
|
1272
|
+
originalValues.refModelId = refModelId;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
if (schemaFileValue.refValueType) {
|
|
1276
|
+
originalValues.refValueType = schemaFileValue.refValueType;
|
|
1277
|
+
}
|
|
1278
|
+
return originalValues;
|
|
1279
|
+
}
|
|
1280
|
+
catch (error) {
|
|
1281
|
+
return undefined;
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* Set the schema name for this property by looking it up from the model
|
|
1286
|
+
* Tries database first (more reliable), then falls back to schema files
|
|
1287
|
+
*/
|
|
1288
|
+
async _setSchemaName(modelName) {
|
|
1289
|
+
try {
|
|
1290
|
+
let schemaName;
|
|
1291
|
+
// Try to get schema name from database first (more reliable)
|
|
1292
|
+
if (this.modelId) {
|
|
1293
|
+
try {
|
|
1294
|
+
const { BaseDb } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.BaseDb$1; });
|
|
1295
|
+
const seedSchema = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.schema; });
|
|
1296
|
+
const modelsTable = seedSchema.models;
|
|
1297
|
+
const modelSchemas = seedSchema.modelSchemas;
|
|
1298
|
+
const schemas = seedSchema.schemas;
|
|
1299
|
+
const { eq } = await import('drizzle-orm');
|
|
1300
|
+
const db = BaseDb.getAppDb();
|
|
1301
|
+
if (db) {
|
|
1302
|
+
const modelSchemaRecords = await db
|
|
1303
|
+
.select({
|
|
1304
|
+
schemaName: schemas.name,
|
|
1305
|
+
})
|
|
1306
|
+
.from(modelSchemas)
|
|
1307
|
+
.innerJoin(schemas, eq(modelSchemas.schemaId, schemas.id))
|
|
1308
|
+
.innerJoin(modelsTable, eq(modelSchemas.modelId, modelsTable.id))
|
|
1309
|
+
.where(eq(modelsTable.id, this.modelId))
|
|
1310
|
+
.limit(1);
|
|
1311
|
+
if (modelSchemaRecords.length > 0) {
|
|
1312
|
+
schemaName = modelSchemaRecords[0].schemaName;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
catch (error) {
|
|
1317
|
+
// Database lookup failed, continue to file-based lookup
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
// Fall back to schema file lookup if database didn't work
|
|
1321
|
+
if (!schemaName) {
|
|
1322
|
+
const { getSchemaNameFromModel } = await Promise.resolve().then(function () { return saveToSchema$1; });
|
|
1323
|
+
schemaName = await getSchemaNameFromModel(modelName);
|
|
1324
|
+
}
|
|
1325
|
+
if (schemaName) {
|
|
1326
|
+
// Update the context with the schema name using dedicated event
|
|
1327
|
+
this._service.send({
|
|
1328
|
+
type: 'setSchemaName',
|
|
1329
|
+
schemaName,
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
catch (error) {
|
|
1334
|
+
// If we can't get schema name, that's okay - it will be set later if needed
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Manually set the schema name for this property
|
|
1339
|
+
* Useful when you know the schema name from context (e.g., when working with Schema instances)
|
|
1340
|
+
*/
|
|
1341
|
+
setSchemaName(schemaName) {
|
|
1342
|
+
this._service.send({
|
|
1343
|
+
type: 'setSchemaName',
|
|
1344
|
+
schemaName,
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
static create(property) {
|
|
1348
|
+
if (!property) {
|
|
1349
|
+
throw new Error('Property is required');
|
|
1350
|
+
}
|
|
1351
|
+
// Debug: Log what's being passed to create()
|
|
1352
|
+
console.log(`[ModelProperty.create] Input property data:`, JSON.stringify({
|
|
1353
|
+
name: property.name,
|
|
1354
|
+
modelName: property.modelName,
|
|
1355
|
+
ref: property.ref,
|
|
1356
|
+
refModelName: property.refModelName,
|
|
1357
|
+
refModelId: property.refModelId,
|
|
1358
|
+
dataType: property.dataType,
|
|
1359
|
+
type: property.type, // Check if it's using 'type' instead of 'dataType'
|
|
1360
|
+
}, null, 2));
|
|
1361
|
+
// Handle 'type' field from JSON schema format - convert to 'dataType'
|
|
1362
|
+
const propertyWithId = { ...property };
|
|
1363
|
+
if (propertyWithId.type && !propertyWithId.dataType) {
|
|
1364
|
+
propertyWithId.dataType = propertyWithId.type;
|
|
1365
|
+
}
|
|
1366
|
+
// Ensure id (schemaFileId) is set correctly
|
|
1367
|
+
// Priority: _propertyFileId > id (if string) > generate new
|
|
1368
|
+
// If id is a number (old format), use _propertyFileId instead
|
|
1369
|
+
if (typeof propertyWithId.id === 'number') {
|
|
1370
|
+
// id is a database integer ID, not schemaFileId - use _propertyFileId if available
|
|
1371
|
+
if (propertyWithId._propertyFileId) {
|
|
1372
|
+
propertyWithId.id = propertyWithId._propertyFileId;
|
|
1373
|
+
}
|
|
1374
|
+
else {
|
|
1375
|
+
// Fallback: generate new schemaFileId (shouldn't happen, but safety)
|
|
1376
|
+
propertyWithId.id = main_cjs.generateId();
|
|
1377
|
+
logger(`ModelProperty.create: id was a number, generated new schemaFileId "${propertyWithId.id}" for property "${property.name}"`);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
else if (!propertyWithId.id && propertyWithId._propertyFileId) {
|
|
1381
|
+
// id is not set but _propertyFileId is available - use it
|
|
1382
|
+
propertyWithId.id = propertyWithId._propertyFileId;
|
|
1383
|
+
}
|
|
1384
|
+
else if (!propertyWithId.id) {
|
|
1385
|
+
// Generate id (schemaFileId) if not provided (for new properties)
|
|
1386
|
+
// This ensures new properties can trigger write process
|
|
1387
|
+
propertyWithId.id = main_cjs.generateId();
|
|
1388
|
+
logger(`ModelProperty.create: Generated new id (schemaFileId) "${propertyWithId.id}" for property "${property.name}"`);
|
|
1389
|
+
}
|
|
1390
|
+
// Create cache key from modelName and name, or use id
|
|
1391
|
+
const cacheKey = propertyWithId.modelName && propertyWithId.name
|
|
1392
|
+
? `${propertyWithId.modelName}:${propertyWithId.name}`
|
|
1393
|
+
: propertyWithId.id
|
|
1394
|
+
? `id:${propertyWithId.id}`
|
|
1395
|
+
: propertyWithId.name || 'unnamed';
|
|
1396
|
+
// Check if instance exists in cache
|
|
1397
|
+
if (this.instanceCache.has(cacheKey)) {
|
|
1398
|
+
const { instance, refCount } = this.instanceCache.get(cacheKey);
|
|
1399
|
+
const cachedContext = instance._getSnapshotContext();
|
|
1400
|
+
console.log(`[ModelProperty.create] Returning cached instance for ${cacheKey}, context has ref:`, cachedContext.ref);
|
|
1401
|
+
// Update cached instance if new property data has fields that the cached instance doesn't have
|
|
1402
|
+
// This handles cases where the property was created without ref initially, but now we have ref from schema
|
|
1403
|
+
const needsUpdate = {};
|
|
1404
|
+
if (propertyWithId.ref && !cachedContext.ref) {
|
|
1405
|
+
needsUpdate.ref = propertyWithId.ref;
|
|
1406
|
+
}
|
|
1407
|
+
if (propertyWithId.refModelName && !cachedContext.refModelName) {
|
|
1408
|
+
needsUpdate.refModelName = propertyWithId.refModelName;
|
|
1409
|
+
}
|
|
1410
|
+
if (propertyWithId.refModelId && !cachedContext.refModelId) {
|
|
1411
|
+
needsUpdate.refModelId = propertyWithId.refModelId;
|
|
1412
|
+
}
|
|
1413
|
+
if (Object.keys(needsUpdate).length > 0) {
|
|
1414
|
+
console.log(`[ModelProperty.create] Updating cached instance with missing fields:`, needsUpdate);
|
|
1415
|
+
instance._service.send({
|
|
1416
|
+
type: 'updateContext',
|
|
1417
|
+
...needsUpdate,
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
this.instanceCache.set(cacheKey, {
|
|
1421
|
+
instance,
|
|
1422
|
+
refCount: refCount + 1,
|
|
1423
|
+
});
|
|
1424
|
+
return instance;
|
|
1425
|
+
}
|
|
1426
|
+
// Debug: Log what's being passed to the constructor
|
|
1427
|
+
console.log(`[ModelProperty.create] propertyWithId before constructor:`, JSON.stringify({
|
|
1428
|
+
name: propertyWithId.name,
|
|
1429
|
+
modelName: propertyWithId.modelName,
|
|
1430
|
+
ref: propertyWithId.ref,
|
|
1431
|
+
refModelName: propertyWithId.refModelName,
|
|
1432
|
+
refModelId: propertyWithId.refModelId,
|
|
1433
|
+
dataType: propertyWithId.dataType,
|
|
1434
|
+
}, null, 2));
|
|
1435
|
+
const newInstance = new this(propertyWithId);
|
|
1436
|
+
// Debug: Log what's being passed to the constructor
|
|
1437
|
+
console.log(`[ModelProperty.create] Creating instance for ${propertyWithId.modelName}:${propertyWithId.name}`, {
|
|
1438
|
+
ref: propertyWithId.ref,
|
|
1439
|
+
refModelName: propertyWithId.refModelName,
|
|
1440
|
+
refModelId: propertyWithId.refModelId,
|
|
1441
|
+
dataType: propertyWithId.dataType
|
|
1442
|
+
});
|
|
1443
|
+
// Wrap instance in Proxy for reactive property access
|
|
1444
|
+
const proxiedInstance = main_cjs.createReactiveProxy({
|
|
1445
|
+
instance: newInstance,
|
|
1446
|
+
service: newInstance._service,
|
|
1447
|
+
trackedProperties: TPropertyKeys,
|
|
1448
|
+
getContext: (instance) => {
|
|
1449
|
+
const context = instance._getSnapshotContext();
|
|
1450
|
+
return context;
|
|
1451
|
+
},
|
|
1452
|
+
sendUpdate: (instance, prop, value) => {
|
|
1453
|
+
if (prop === 'name') {
|
|
1454
|
+
const currentContext = instance._getSnapshotContext();
|
|
1455
|
+
console.log(`[ModelProperty.sendUpdate] Name change: "${currentContext.name}" -> "${value}"`);
|
|
1456
|
+
console.log(`[ModelProperty.sendUpdate] Current state: ${instance._service.getSnapshot().value}`);
|
|
1457
|
+
console.log(`[ModelProperty.sendUpdate] Has _originalValues: ${!!currentContext._originalValues}`);
|
|
1458
|
+
}
|
|
1459
|
+
instance._service.send({
|
|
1460
|
+
type: 'updateContext',
|
|
1461
|
+
[prop]: value,
|
|
1462
|
+
});
|
|
1463
|
+
if (prop === 'name') {
|
|
1464
|
+
// Check state after sending
|
|
1465
|
+
setTimeout(() => {
|
|
1466
|
+
const newState = instance._service.getSnapshot().value;
|
|
1467
|
+
console.log(`[ModelProperty.sendUpdate] State after name change: ${newState}`);
|
|
1468
|
+
}, 10);
|
|
1469
|
+
}
|
|
1470
|
+
},
|
|
1471
|
+
});
|
|
1472
|
+
this.instanceCache.set(cacheKey, {
|
|
1473
|
+
instance: proxiedInstance,
|
|
1474
|
+
refCount: 1,
|
|
1475
|
+
});
|
|
1476
|
+
// Trigger write process if property has modelId (or modelName) and id (schemaFileId)
|
|
1477
|
+
// Wait for service to be ready (idle state) and have writeProcess spawned
|
|
1478
|
+
const propertyFileId = propertyWithId.id; // id is now the schemaFileId (string)
|
|
1479
|
+
const hasModelId = propertyWithId.modelId || propertyWithId.modelName;
|
|
1480
|
+
if (hasModelId && propertyFileId) {
|
|
1481
|
+
// Wait for writeProcess to be spawned (it's spawned in idle state entry action)
|
|
1482
|
+
// Retry a few times if writeProcess isn't available yet
|
|
1483
|
+
let retries = 0;
|
|
1484
|
+
const maxRetries = 10;
|
|
1485
|
+
const checkAndSend = async () => {
|
|
1486
|
+
const service = proxiedInstance.getService();
|
|
1487
|
+
const snapshot = service.getSnapshot();
|
|
1488
|
+
if (snapshot.value === 'idle' && snapshot.context.writeProcess) {
|
|
1489
|
+
const writeProcess = snapshot.context.writeProcess;
|
|
1490
|
+
// Resolve dbModelId - convert from string (modelFileId) to number (database ID) if needed
|
|
1491
|
+
let resolvedModelId = undefined;
|
|
1492
|
+
if (propertyWithId.modelId) {
|
|
1493
|
+
if (typeof propertyWithId.modelId === 'number') {
|
|
1494
|
+
resolvedModelId = propertyWithId.modelId;
|
|
1495
|
+
}
|
|
1496
|
+
else if (typeof propertyWithId.modelId === 'string') {
|
|
1497
|
+
// modelId is a string (modelFileId), need to convert to database ID
|
|
1498
|
+
try {
|
|
1499
|
+
const { getModelIdByFileId } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.db; });
|
|
1500
|
+
resolvedModelId = await getModelIdByFileId(propertyWithId.modelId);
|
|
1501
|
+
logger(`Converted modelFileId "${propertyWithId.modelId}" to database modelId: ${resolvedModelId}`);
|
|
1502
|
+
}
|
|
1503
|
+
catch (error) {
|
|
1504
|
+
logger(`Failed to convert modelFileId "${propertyWithId.modelId}" to database ID: ${error}`);
|
|
1505
|
+
console.error(`[ModelProperty.create] Failed to convert modelFileId: ${error}`);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
// If we still don't have a modelId, try to resolve it from modelName
|
|
1510
|
+
if (!resolvedModelId && propertyWithId.modelName) {
|
|
1511
|
+
try {
|
|
1512
|
+
const { getModelId } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.db; });
|
|
1513
|
+
// Get schemaName from context if available
|
|
1514
|
+
const schemaName = snapshot.context._schemaName;
|
|
1515
|
+
resolvedModelId = await getModelId(propertyWithId.modelName, schemaName);
|
|
1516
|
+
logger(`Resolved modelId for model "${propertyWithId.modelName}": ${resolvedModelId}`);
|
|
1517
|
+
}
|
|
1518
|
+
catch (error) {
|
|
1519
|
+
logger(`Failed to resolve modelId for model "${propertyWithId.modelName}": ${error}`);
|
|
1520
|
+
console.error(`[ModelProperty.create] Failed to resolve modelId: ${error}`);
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
if (!resolvedModelId) {
|
|
1524
|
+
logger(`ERROR: Cannot write property "${property.name}" - no modelId available`);
|
|
1525
|
+
console.error(`[ModelProperty.create] ERROR: Cannot write property "${property.name}" - no modelId available. modelId: ${propertyWithId.modelId}, modelName: ${propertyWithId.modelName}`);
|
|
1526
|
+
// Don't clear pending write here - it might resolve later
|
|
1527
|
+
return;
|
|
1528
|
+
}
|
|
1529
|
+
// Track pending write now that we have the resolved modelId
|
|
1530
|
+
this.trackPendingWrite(propertyFileId, resolvedModelId);
|
|
1531
|
+
logger(`Triggering write process for property "${property.name}" (modelId: ${resolvedModelId}, propertyFileId: ${propertyFileId})`);
|
|
1532
|
+
// Check current write state
|
|
1533
|
+
const currentWriteState = writeProcess.getSnapshot();
|
|
1534
|
+
if (currentWriteState.value === 'success') {
|
|
1535
|
+
// Write already succeeded, clear pending write immediately
|
|
1536
|
+
this.clearPendingWrite(propertyFileId, 'success');
|
|
1537
|
+
}
|
|
1538
|
+
else {
|
|
1539
|
+
// Set up subscription to catch future state changes
|
|
1540
|
+
const writeSubscription = writeProcess.subscribe((writeSnapshot) => {
|
|
1541
|
+
if (writeSnapshot.value === 'success') {
|
|
1542
|
+
writeSubscription.unsubscribe();
|
|
1543
|
+
logger(`[writeProcess subscription] Write succeeded for property "${property.name}" (propertyFileId: ${propertyFileId})`);
|
|
1544
|
+
// Clear pending write on success
|
|
1545
|
+
this.clearPendingWrite(propertyFileId, 'success');
|
|
1546
|
+
}
|
|
1547
|
+
else if (writeSnapshot.value === 'error') {
|
|
1548
|
+
writeSubscription.unsubscribe();
|
|
1549
|
+
const errorContext = writeSnapshot.context;
|
|
1550
|
+
logger(`Write process failed for property "${property.name}" (propertyFileId: ${propertyFileId}): ${errorContext.error?.message || 'Unknown error'}`);
|
|
1551
|
+
logger(`Write process error details:`, errorContext.error);
|
|
1552
|
+
// Mark pending write as error
|
|
1553
|
+
this.clearPendingWrite(propertyFileId, 'error');
|
|
1554
|
+
}
|
|
1555
|
+
});
|
|
1556
|
+
}
|
|
1557
|
+
const propertyData = {
|
|
1558
|
+
modelId: resolvedModelId,
|
|
1559
|
+
name: property.name,
|
|
1560
|
+
dataType: property.dataType,
|
|
1561
|
+
refModelId: property.refModelId,
|
|
1562
|
+
refValueType: property.refValueType,
|
|
1563
|
+
storageType: property.storageType,
|
|
1564
|
+
localStorageDir: property.localStorageDir,
|
|
1565
|
+
filenameSuffix: property.filenameSuffix,
|
|
1566
|
+
};
|
|
1567
|
+
service.send({
|
|
1568
|
+
type: 'requestWrite',
|
|
1569
|
+
data: propertyData,
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
|
+
else if (retries < maxRetries) {
|
|
1573
|
+
retries++;
|
|
1574
|
+
setTimeout(checkAndSend, 50); // Retry after 50ms
|
|
1575
|
+
}
|
|
1576
|
+
else {
|
|
1577
|
+
logger(`ERROR: writeProcess not available after ${maxRetries} retries for property "${property.name}" (propertyFileId: ${propertyFileId})`);
|
|
1578
|
+
console.error(`[ModelProperty.create] ERROR: writeProcess not available after ${maxRetries} retries for property "${property.name}" (propertyFileId: ${propertyFileId})`);
|
|
1579
|
+
// Mark as error if we couldn't even start the write process
|
|
1580
|
+
this.clearPendingWrite(propertyFileId, 'error');
|
|
1581
|
+
}
|
|
1582
|
+
};
|
|
1583
|
+
// Start checking after a short delay to allow state machine to initialize
|
|
1584
|
+
setTimeout(checkAndSend, 0);
|
|
1585
|
+
}
|
|
1586
|
+
return proxiedInstance;
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* Get ModelProperty instance by propertyFileId from static cache
|
|
1590
|
+
*/
|
|
1591
|
+
static getById(propertyFileId) {
|
|
1592
|
+
if (!propertyFileId)
|
|
1593
|
+
return undefined;
|
|
1594
|
+
// Search through cache to find by propertyFileId
|
|
1595
|
+
// Cache key might be "modelName:propertyName" or "id:propertyId"
|
|
1596
|
+
for (const [cacheKey, { instance }] of this.instanceCache.entries()) {
|
|
1597
|
+
const context = instance._getSnapshotContext();
|
|
1598
|
+
// id is now the schemaFileId (string)
|
|
1599
|
+
if (context.id === propertyFileId) {
|
|
1600
|
+
return instance;
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
return undefined;
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* Create or get ModelProperty instance by propertyFileId
|
|
1607
|
+
* Queries the database to find the property if not cached
|
|
1608
|
+
*/
|
|
1609
|
+
static async createById(propertyFileId) {
|
|
1610
|
+
if (!propertyFileId) {
|
|
1611
|
+
return undefined;
|
|
1612
|
+
}
|
|
1613
|
+
// First, check if we have an instance cached
|
|
1614
|
+
const cachedInstance = this.getById(propertyFileId);
|
|
1615
|
+
if (cachedInstance) {
|
|
1616
|
+
return cachedInstance;
|
|
1617
|
+
}
|
|
1618
|
+
// Query database to get property data from ID
|
|
1619
|
+
const { BaseDb } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.BaseDb$1; });
|
|
1620
|
+
const { properties: propertiesTable, models: modelsTable } = await Promise.resolve().then(function () { return require('./index-BmIVfqGN.js'); }).then(function (n) { return n.schema; });
|
|
1621
|
+
const { eq } = await import('drizzle-orm');
|
|
1622
|
+
const db = BaseDb.getAppDb();
|
|
1623
|
+
console.log('db', !!db);
|
|
1624
|
+
if (!db) {
|
|
1625
|
+
console.log('db not found');
|
|
1626
|
+
return undefined;
|
|
1627
|
+
}
|
|
1628
|
+
const testRecords = await db
|
|
1629
|
+
.select()
|
|
1630
|
+
.from(propertiesTable)
|
|
1631
|
+
.limit(100);
|
|
1632
|
+
console.log('testRecords', testRecords);
|
|
1633
|
+
const propertyRecords = await db
|
|
1634
|
+
.select()
|
|
1635
|
+
.from(propertiesTable)
|
|
1636
|
+
.where(eq(propertiesTable.schemaFileId, propertyFileId))
|
|
1637
|
+
.limit(1);
|
|
1638
|
+
console.log('propertyRecords', propertyRecords);
|
|
1639
|
+
if (propertyRecords.length === 0) {
|
|
1640
|
+
return undefined;
|
|
1641
|
+
}
|
|
1642
|
+
const propertyRecord = propertyRecords[0];
|
|
1643
|
+
// Get model name
|
|
1644
|
+
const modelRecords = await db
|
|
1645
|
+
.select({ name: modelsTable.name })
|
|
1646
|
+
.from(modelsTable)
|
|
1647
|
+
.where(eq(modelsTable.id, propertyRecord.modelId))
|
|
1648
|
+
.limit(1);
|
|
1649
|
+
if (modelRecords.length === 0) {
|
|
1650
|
+
return undefined;
|
|
1651
|
+
}
|
|
1652
|
+
const modelName = modelRecords[0].name;
|
|
1653
|
+
// Build property data
|
|
1654
|
+
// id is now the schemaFileId (string), _dbId is the database integer ID
|
|
1655
|
+
const propertyData = {
|
|
1656
|
+
id: propertyFileId, // schemaFileId (string) - public ID
|
|
1657
|
+
_dbId: propertyRecord.id ?? undefined, // Database integer ID - internal only
|
|
1658
|
+
name: propertyRecord.name,
|
|
1659
|
+
dataType: propertyRecord.dataType,
|
|
1660
|
+
modelId: propertyRecord.modelId,
|
|
1661
|
+
modelName,
|
|
1662
|
+
refModelId: propertyRecord.refModelId || undefined,
|
|
1663
|
+
refValueType: propertyRecord.refValueType ? propertyRecord.refValueType : undefined,
|
|
1664
|
+
};
|
|
1665
|
+
// Load isEdited from database
|
|
1666
|
+
const isEditedFromDb = propertyRecord.isEdited ?? false;
|
|
1667
|
+
// Get ref model name if applicable
|
|
1668
|
+
if (propertyRecord.refModelId) {
|
|
1669
|
+
const refModelRecords = await db
|
|
1670
|
+
.select({ name: modelsTable.name })
|
|
1671
|
+
.from(modelsTable)
|
|
1672
|
+
.where(eq(modelsTable.id, propertyRecord.refModelId))
|
|
1673
|
+
.limit(1);
|
|
1674
|
+
if (refModelRecords.length > 0) {
|
|
1675
|
+
propertyData.refModelName = refModelRecords[0].name;
|
|
1676
|
+
propertyData.ref = refModelRecords[0].name;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
// Create ModelProperty instance
|
|
1680
|
+
const instance = this.create(propertyData);
|
|
1681
|
+
// Set isEdited from database after creation
|
|
1682
|
+
if (isEditedFromDb) {
|
|
1683
|
+
instance._service.send({
|
|
1684
|
+
type: 'updateContext',
|
|
1685
|
+
_isEdited: true,
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
return instance;
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Find ModelProperty instance by propertyFileId
|
|
1692
|
+
* Waits for the property to be fully loaded (idle state) by default
|
|
1693
|
+
* @param options - Find options including propertyFileId and wait configuration
|
|
1694
|
+
* @returns ModelProperty instance if found, undefined otherwise
|
|
1695
|
+
*/
|
|
1696
|
+
static async find({ propertyFileId, waitForReady = true, readyTimeout = 5000, }) {
|
|
1697
|
+
if (!propertyFileId) {
|
|
1698
|
+
return undefined;
|
|
1699
|
+
}
|
|
1700
|
+
return await main_cjs.findEntity({
|
|
1701
|
+
getById: (id) => ModelProperty.getById(id),
|
|
1702
|
+
createById: (id) => ModelProperty.createById(id),
|
|
1703
|
+
}, { id: propertyFileId }, {
|
|
1704
|
+
waitForReady,
|
|
1705
|
+
readyTimeout,
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* Track a pending write for a property
|
|
1710
|
+
*/
|
|
1711
|
+
static trackPendingWrite(propertyFileId, modelId) {
|
|
1712
|
+
this.pendingWrites.set(propertyFileId, {
|
|
1713
|
+
propertyFileId,
|
|
1714
|
+
modelId,
|
|
1715
|
+
status: 'pending',
|
|
1716
|
+
timestamp: Date.now(),
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* Clear or update pending write status
|
|
1721
|
+
*/
|
|
1722
|
+
static clearPendingWrite(propertyFileId, status = 'success') {
|
|
1723
|
+
const write = this.pendingWrites.get(propertyFileId);
|
|
1724
|
+
if (write) {
|
|
1725
|
+
if (status === 'success') {
|
|
1726
|
+
// Remove successful writes from pendingWrites
|
|
1727
|
+
this.pendingWrites.delete(propertyFileId);
|
|
1728
|
+
logger(`Cleared pending write for property "${propertyFileId}" (status: success)`);
|
|
1729
|
+
}
|
|
1730
|
+
else {
|
|
1731
|
+
// Update status to error but keep in map (for debugging/retry purposes)
|
|
1732
|
+
write.status = 'error';
|
|
1733
|
+
this.pendingWrites.set(propertyFileId, write);
|
|
1734
|
+
logger(`Marked pending write as error for property "${propertyFileId}"`);
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Get all pending property IDs for a model
|
|
1740
|
+
*/
|
|
1741
|
+
static getPendingPropertyIds(modelId) {
|
|
1742
|
+
return Array.from(this.pendingWrites.entries())
|
|
1743
|
+
.filter(([_, write]) => write.modelId === modelId && write.status !== 'error')
|
|
1744
|
+
.map(([propertyFileId]) => propertyFileId);
|
|
1745
|
+
}
|
|
1746
|
+
getService() {
|
|
1747
|
+
return this._service;
|
|
1748
|
+
}
|
|
1749
|
+
_getSnapshot() {
|
|
1750
|
+
return this._service.getSnapshot();
|
|
1751
|
+
}
|
|
1752
|
+
_getSnapshotContext() {
|
|
1753
|
+
return this._getSnapshot().context;
|
|
1754
|
+
}
|
|
1755
|
+
get path() {
|
|
1756
|
+
const workingDir = main_cjs.BaseFileManager.getWorkingDir();
|
|
1757
|
+
if (!this.localStorageDir || !this.name || !this.filenameSuffix) {
|
|
1758
|
+
return undefined;
|
|
1759
|
+
}
|
|
1760
|
+
return `${workingDir}/${this.localStorageDir}/${this.name}${this.filenameSuffix || ''}`;
|
|
1761
|
+
}
|
|
1762
|
+
get status() {
|
|
1763
|
+
return this._getSnapshot().value;
|
|
1764
|
+
}
|
|
1765
|
+
get isEdited() {
|
|
1766
|
+
const context = this._getSnapshotContext();
|
|
1767
|
+
// First check in-memory state
|
|
1768
|
+
if (context._isEdited !== undefined) {
|
|
1769
|
+
return context._isEdited;
|
|
1770
|
+
}
|
|
1771
|
+
// Fall back to reading from database if we have _dbId
|
|
1772
|
+
if (context._dbId) {
|
|
1773
|
+
// Load from database asynchronously (fire-and-forget for now)
|
|
1774
|
+
// For synchronous getter, we'll need to cache it or make it async
|
|
1775
|
+
// For now, return false if not in context
|
|
1776
|
+
return false;
|
|
1777
|
+
}
|
|
1778
|
+
return false;
|
|
1779
|
+
}
|
|
1780
|
+
get validationErrors() {
|
|
1781
|
+
return this._getSnapshotContext()._validationErrors || [];
|
|
1782
|
+
}
|
|
1783
|
+
get isValid() {
|
|
1784
|
+
const errors = this.validationErrors;
|
|
1785
|
+
return errors.length === 0;
|
|
1786
|
+
}
|
|
1787
|
+
/**
|
|
1788
|
+
* Validate the property
|
|
1789
|
+
* @returns Validation result
|
|
1790
|
+
*/
|
|
1791
|
+
async validate() {
|
|
1792
|
+
return new Promise((resolve) => {
|
|
1793
|
+
let resolved = false;
|
|
1794
|
+
const subscription = this._service.subscribe((snapshot) => {
|
|
1795
|
+
const state = snapshot.value;
|
|
1796
|
+
// Wait for validation to complete (idle state after validating)
|
|
1797
|
+
if (state === 'idle' && !resolved) {
|
|
1798
|
+
resolved = true;
|
|
1799
|
+
subscription.unsubscribe();
|
|
1800
|
+
const errors = snapshot.context._validationErrors || [];
|
|
1801
|
+
resolve({
|
|
1802
|
+
isValid: errors.length === 0,
|
|
1803
|
+
errors,
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
});
|
|
1807
|
+
this._service.send({ type: 'validateProperty' });
|
|
1808
|
+
// Timeout fallback
|
|
1809
|
+
setTimeout(() => {
|
|
1810
|
+
if (!resolved) {
|
|
1811
|
+
resolved = true;
|
|
1812
|
+
subscription.unsubscribe();
|
|
1813
|
+
const errors = this._getSnapshotContext()._validationErrors || [];
|
|
1814
|
+
resolve({
|
|
1815
|
+
isValid: errors.length === 0,
|
|
1816
|
+
errors,
|
|
1817
|
+
});
|
|
1818
|
+
}
|
|
1819
|
+
}, 5000);
|
|
1820
|
+
});
|
|
1821
|
+
}
|
|
1822
|
+
save() {
|
|
1823
|
+
// Validation will happen automatically in the machine before saving
|
|
1824
|
+
this._service.send({
|
|
1825
|
+
type: 'saveToSchema',
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
/**
|
|
1829
|
+
* Reload property from database
|
|
1830
|
+
* This refreshes the actor context with the latest data from the database
|
|
1831
|
+
* Note: ModelProperty doesn't have a dedicated load actor, so this will
|
|
1832
|
+
* re-initialize from the current property data
|
|
1833
|
+
*/
|
|
1834
|
+
async reload() {
|
|
1835
|
+
// ModelProperty doesn't have a separate load mechanism
|
|
1836
|
+
// It's loaded as part of the Model/Schema
|
|
1837
|
+
// This method is provided for API consistency
|
|
1838
|
+
// To actually reload, you'd need to reload the parent Model or Schema
|
|
1839
|
+
logger('ModelProperty.reload() called - ModelProperty is loaded as part of Model/Schema. Reload the parent Model or Schema instead.');
|
|
1840
|
+
// No-op for now, but could be enhanced to reload from DB if needed
|
|
1841
|
+
}
|
|
1842
|
+
unload() {
|
|
1843
|
+
// ModelProperty doesn't have liveQuery subscriptions or complex cache management
|
|
1844
|
+
// Just stop the service
|
|
1845
|
+
try {
|
|
1846
|
+
this._service.stop();
|
|
1847
|
+
}
|
|
1848
|
+
catch (error) {
|
|
1849
|
+
// Service might already be stopped
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
ModelProperty.instanceCache = new Map();
|
|
1854
|
+
// Pending writes tracking
|
|
1855
|
+
ModelProperty.pendingWrites = new Map();
|
|
1856
|
+
|
|
1857
|
+
var ModelProperty$1 = /*#__PURE__*/Object.freeze({
|
|
1858
|
+
__proto__: null,
|
|
1859
|
+
ModelProperty: ModelProperty
|
|
1860
|
+
});
|
|
1861
|
+
|
|
1862
|
+
exports.ModelProperty = ModelProperty;
|
|
1863
|
+
exports.ModelProperty$1 = ModelProperty$1;
|
|
1864
|
+
exports.convertPropertyToSchemaUpdate = convertPropertyToSchemaUpdate;
|
|
1865
|
+
exports.updateModelProperties = updateModelProperties;
|
|
1866
|
+
//# sourceMappingURL=ModelProperty-MkN5Rmx7.js.map
|