@seedprotocol/sdk 0.6.9 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BasePathResolver-B6CKqoKw.js → BasePathResolver-ndE8XTpw.js} +36 -2
- package/dist/BasePathResolver-ndE8XTpw.js.map +1 -0
- package/dist/ClientManager-DLleL_2e.js +4763 -0
- package/dist/ClientManager-DLleL_2e.js.map +1 -0
- package/dist/{ClientManager-ChcmUL47.js → Item-zBFWQDU9.js} +1119 -5893
- package/dist/Item-zBFWQDU9.js.map +1 -0
- package/dist/{ModelProperty-D79uV42p.js → ModelProperty-lth9L37R.js} +289 -101
- package/dist/ModelProperty-lth9L37R.js.map +1 -0
- package/dist/{Schema-a8uO-hIZ.js → Schema-DOhlrQ-N.js} +94 -864
- package/dist/Schema-DOhlrQ-N.js.map +1 -0
- package/dist/{SchemaValidationService-Y49vqast.js → SchemaValidationService-DDKr5piy.js} +26 -18
- package/dist/SchemaValidationService-DDKr5piy.js.map +1 -0
- package/dist/{backfillMetadataPropertyIds-CBsf7LnU.js → backfillMetadataPropertyIds-fG3ujaSh.js} +11 -6
- package/dist/backfillMetadataPropertyIds-fG3ujaSh.js.map +1 -0
- package/dist/cjs/{ModelProperty-D9FGaGuE.js → ModelProperty-BEsIHAjk.js} +260 -81
- package/dist/cjs/ModelProperty-BEsIHAjk.js.map +1 -0
- package/dist/cjs/{Schema-BiJIPLEL.js → Schema-qEp5mH1N.js} +66 -847
- package/dist/cjs/Schema-qEp5mH1N.js.map +1 -0
- package/dist/cjs/{SchemaValidationService-DtYs_CNY.js → SchemaValidationService-CWEnZmOH.js} +18 -11
- package/dist/cjs/SchemaValidationService-CWEnZmOH.js.map +1 -0
- package/dist/cjs/{backfillMetadataPropertyIds-2XaN3b9S.js → backfillMetadataPropertyIds-tw8JGMT0.js} +8 -3
- package/dist/cjs/backfillMetadataPropertyIds-tw8JGMT0.js.map +1 -0
- package/dist/cjs/{eas-CMNppmGE.js → eas-CLiV2Hmn.js} +4 -4
- package/dist/cjs/{eas-CMNppmGE.js.map → eas-CLiV2Hmn.js.map} +1 -1
- package/dist/cjs/{getItem-B6jEINjW.js → getItem-DSRtx_68.js} +2 -2
- package/dist/cjs/{getItem-B6jEINjW.js.map → getItem-DSRtx_68.js.map} +1 -1
- package/dist/cjs/getLatestVersionRow-DVizNNoI.js +59 -0
- package/dist/cjs/getLatestVersionRow-DVizNNoI.js.map +1 -0
- package/dist/cjs/{getPublishPayload-D5DhLGvN.js → getPublishPayload-D5-dYtNq.js} +249 -60
- package/dist/cjs/getPublishPayload-D5-dYtNq.js.map +1 -0
- package/dist/cjs/{getPublishUploads-DMhCCKYF.js → getPublishUploads-B5Lq6q-_.js} +20 -13
- package/dist/cjs/getPublishUploads-B5Lq6q-_.js.map +1 -0
- package/dist/cjs/{getSegmentedItemProperties-CU8rtBAo.js → getSegmentedItemProperties-giHO7R3d.js} +10 -11
- package/dist/cjs/getSegmentedItemProperties-giHO7R3d.js.map +1 -0
- package/dist/cjs/{index-DPp9rdRL.js → index-B3UDbm1C.js} +3 -3
- package/dist/cjs/index-B3UDbm1C.js.map +1 -0
- package/dist/cjs/{index-CSNtEnbF.js → index-C66AfYDG.js} +2510 -1694
- package/dist/cjs/index-C66AfYDG.js.map +1 -0
- package/dist/cjs/{property-DlKiAWt4.js → property-BVJIP7SX.js} +40 -35
- package/dist/cjs/property-BVJIP7SX.js.map +1 -0
- package/dist/cjs/resetAmbiguousLegacyItemData-BaZqUui9.js +116 -0
- package/dist/cjs/resetAmbiguousLegacyItemData-BaZqUui9.js.map +1 -0
- package/dist/cjs/resolveModelForSyncedSeed-CC6dQctx.js +49 -0
- package/dist/cjs/resolveModelForSyncedSeed-CC6dQctx.js.map +1 -0
- package/dist/cjs/syncDbWithEas-Dk96sAG-.js +873 -0
- package/dist/cjs/syncDbWithEas-Dk96sAG-.js.map +1 -0
- package/dist/{configurePlatform-CE0Vew17.js → configurePlatform-BMoPG9vY.js} +4 -4
- package/dist/{configurePlatform-CE0Vew17.js.map → configurePlatform-BMoPG9vY.js.map} +1 -1
- package/dist/db/drizzle/0015_add_model_file_id_to_seeds.sql +11 -0
- package/dist/db/drizzle/0016_add_revoked_at_to_metadata.sql +1 -0
- package/dist/db/drizzle/0017_add_revoked_at_to_versions.sql +1 -0
- package/dist/db/drizzle/0018_add_storage_settings_to_properties.sql +53 -0
- package/dist/db/drizzle/0019_add_derived_from_uid_to_metadata.sql +35 -0
- package/dist/db/drizzle/meta/0011_snapshot.json +1182 -0
- package/dist/db/drizzle/meta/0012_snapshot.json +1244 -0
- package/dist/db/drizzle/meta/0013_snapshot.json +63 -1
- package/dist/db/drizzle/meta/0014_snapshot.json +62 -0
- package/dist/db/drizzle/meta/0015_snapshot.json +1338 -0
- package/dist/db/drizzle/meta/0016_snapshot.json +1345 -0
- package/dist/db/drizzle/meta/0017_snapshot.json +1352 -0
- package/dist/db/drizzle/meta/0018_snapshot.json +1373 -0
- package/dist/db/drizzle/meta/0019_snapshot.json +1380 -0
- package/dist/db/drizzle/meta/_journal.json +35 -0
- package/dist/{db-WbrzEf7c.js → db-BJZN0a0a.js} +546 -106
- package/dist/db-BJZN0a0a.js.map +1 -0
- package/dist/{eas-CfYCu4IX.js → eas-B0hsMLqt.js} +7 -7
- package/dist/eas-B0hsMLqt.js.map +1 -0
- package/dist/errors-CrBxGWah.js +17 -0
- package/dist/errors-CrBxGWah.js.map +1 -0
- package/dist/{getItem-Br-bGNFO.js → getItem-DEh4WfHG.js} +8 -10
- package/dist/{getItem-Br-bGNFO.js.map → getItem-DEh4WfHG.js.map} +1 -1
- package/dist/getLatestVersionRow-Brrl1AnW.js +46 -0
- package/dist/getLatestVersionRow-Brrl1AnW.js.map +1 -0
- package/dist/{getPublishPayload-BIrTVUxb.js → getPublishPayload-H032DHC7.js} +263 -75
- package/dist/getPublishPayload-H032DHC7.js.map +1 -0
- package/dist/{getPublishUploads-C6cDeZdz.js → getPublishUploads-CR66RlGJ.js} +25 -17
- package/dist/{getPublishUploads-C6cDeZdz.js.map → getPublishUploads-CR66RlGJ.js.map} +1 -1
- package/dist/{getSegmentedItemProperties-BmKE71vU.js → getSegmentedItemProperties-C2EJ2G0N.js} +13 -14
- package/dist/getSegmentedItemProperties-C2EJ2G0N.js.map +1 -0
- package/dist/{index-ClSv5pTA.js → index-6bJuv5Tt.js} +12 -11
- package/dist/index-6bJuv5Tt.js.map +1 -0
- package/dist/{index-Djd3667v.js → index-B0LgJblD.js} +2 -2
- package/dist/index-B0LgJblD.js.map +1 -0
- package/dist/{index-HRHkbVQd.js → index-DtfjeuxC.js} +417 -174
- package/dist/index-DtfjeuxC.js.map +1 -0
- package/dist/index.browser-CNrqhvEA.js +4139 -0
- package/dist/index.browser-CNrqhvEA.js.map +1 -0
- package/dist/{index.node-DBtQkEfz.js → index.node-DrHiTuOr.js} +9 -4
- package/dist/index.node-DrHiTuOr.js.map +1 -0
- package/dist/main.cjs +1 -1
- package/dist/main.js +771 -521
- package/dist/main.js.map +1 -1
- package/dist/node.js +19 -15
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +18 -3719
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.node.js +3 -3
- package/dist/{property-CQjuZ4JW.js → property-D2Nnsmm1.js} +53 -48
- package/dist/property-D2Nnsmm1.js.map +1 -0
- package/dist/resetAmbiguousLegacyItemData-BqbHNUYk.js +88 -0
- package/dist/resetAmbiguousLegacyItemData-BqbHNUYk.js.map +1 -0
- package/dist/resolveModelForSyncedSeed-DQK6JfXS.js +46 -0
- package/dist/resolveModelForSyncedSeed-DQK6JfXS.js.map +1 -0
- package/dist/seedSchema/MetadataSchema.ts +9 -0
- package/dist/seedSchema/ModelSchema.ts +5 -0
- package/dist/seedSchema/SeedSchema.ts +3 -0
- package/dist/seedSchema/VersionSchema.ts +5 -0
- package/dist/src/Item/Item.d.ts +10 -0
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/Item/service/actors/loadOrCreateItem.d.ts.map +1 -1
- package/dist/src/Item/service/actors/waitForDb.d.ts.map +1 -1
- package/dist/src/Item/service/itemMachineSingle.d.ts +3 -29
- package/dist/src/Item/service/itemMachineSingle.d.ts.map +1 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts +3 -4
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveHtml.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/propertyMachine.d.ts +4 -9
- package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
- package/dist/src/Model/Model.d.ts +37 -0
- package/dist/src/Model/Model.d.ts.map +1 -1
- package/dist/src/Model/errors.d.ts +10 -0
- package/dist/src/Model/errors.d.ts.map +1 -0
- package/dist/src/Model/service/actors/createModelProperties.d.ts.map +1 -1
- package/dist/src/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
- package/dist/src/Model/service/modelMachine.d.ts +0 -8
- package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts +33 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/src/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +2 -9
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
- package/dist/src/Schema/Schema.d.ts +1 -2
- package/dist/src/Schema/Schema.d.ts.map +1 -1
- package/dist/src/Schema/service/schemaMachine.d.ts +1 -217
- package/dist/src/Schema/service/schemaMachine.d.ts.map +1 -1
- package/dist/src/Schema/service/validation/SchemaValidationService.d.ts.map +1 -1
- package/dist/src/browser/db/Db.d.ts +3 -0
- package/dist/src/browser/db/Db.d.ts.map +1 -1
- package/dist/src/browser/db/drizzleFiles.d.ts +7 -2
- package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
- package/dist/src/browser/db/embeddedMigrations.d.ts +11 -2
- package/dist/src/browser/db/embeddedMigrations.d.ts.map +1 -1
- package/dist/src/browser/db/sqliteBusyRetry.d.ts +14 -0
- package/dist/src/browser/db/sqliteBusyRetry.d.ts.map +1 -0
- package/dist/src/browser/helpers/FileManager.d.ts +1 -0
- package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/browser/helpers/QueryClient.d.ts +1 -0
- package/dist/src/browser/helpers/QueryClient.d.ts.map +1 -1
- package/dist/src/browser/helpers/opfsErrors.d.ts +2 -0
- package/dist/src/browser/helpers/opfsErrors.d.ts.map +1 -0
- package/dist/src/browser/helpers/tolerantWebAccess.d.ts +47 -0
- package/dist/src/browser/helpers/tolerantWebAccess.d.ts.map +1 -0
- package/dist/src/browser/workers/FileDownloader.d.ts.map +1 -1
- package/dist/src/browser/workers/ImageResizer.d.ts.map +1 -1
- package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
- package/dist/src/browser/workers/imageResize.d.ts.map +1 -1
- package/dist/src/client/ClientManager.d.ts.map +1 -1
- package/dist/src/client/actors/addModelsToDb.d.ts +14 -0
- package/dist/src/client/actors/addModelsToDb.d.ts.map +1 -1
- package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
- package/dist/src/client/actors/processSchemaFiles.d.ts.map +1 -1
- package/dist/src/client/actors/saveConfig.d.ts +11 -0
- package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
- package/dist/src/client/constants.d.ts +0 -8
- package/dist/src/client/constants.d.ts.map +1 -1
- package/dist/src/db/backfillMetadataPropertyIds.d.ts.map +1 -1
- package/dist/src/db/configs/{dev.schema.config.d.ts → migrations.config.d.ts} +1 -1
- package/dist/src/db/configs/migrations.config.d.ts.map +1 -0
- package/dist/src/db/read/batchLatestPublishedVersionBySeedLocalIds.d.ts +1 -1
- package/dist/src/db/read/batchLatestPublishedVersionBySeedLocalIds.d.ts.map +1 -1
- package/dist/src/db/read/getItemData.d.ts.map +1 -1
- package/dist/src/db/read/getItemProperties.d.ts.map +1 -1
- package/dist/src/db/read/getItems.d.ts +7 -2
- package/dist/src/db/read/getItems.d.ts.map +1 -1
- package/dist/src/db/read/getLatestPublishedVersionRow.d.ts +2 -1
- package/dist/src/db/read/getLatestPublishedVersionRow.d.ts.map +1 -1
- package/dist/src/db/read/getLatestVersionRow.d.ts +13 -0
- package/dist/src/db/read/getLatestVersionRow.d.ts.map +1 -0
- package/dist/src/db/read/getModelSchemas.d.ts.map +1 -1
- package/dist/src/db/read/getPropertyData.d.ts.map +1 -1
- package/dist/src/db/read/getPublishPayload.d.ts +9 -11
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/read/getPublishPendingDiff.d.ts +2 -1
- package/dist/src/db/read/getPublishPendingDiff.d.ts.map +1 -1
- package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/src/db/read/getSchemaUidForModel.d.ts.map +1 -1
- package/dist/src/db/read/getSeedPublishState.d.ts +8 -2
- package/dist/src/db/read/getSeedPublishState.d.ts.map +1 -1
- package/dist/src/db/read/isSeedRevoked.d.ts +7 -0
- package/dist/src/db/read/isSeedRevoked.d.ts.map +1 -0
- package/dist/src/db/read/publishErrors.d.ts +37 -0
- package/dist/src/db/read/publishErrors.d.ts.map +1 -0
- package/dist/src/db/read/resolveModelForSyncedSeed.d.ts +39 -0
- package/dist/src/db/read/resolveModelForSyncedSeed.d.ts.map +1 -0
- package/dist/src/db/read/resolveModelRecord.d.ts +69 -0
- package/dist/src/db/read/resolveModelRecord.d.ts.map +1 -0
- package/dist/src/db/read/resolveRelatedSeedRef.d.ts +34 -0
- package/dist/src/db/read/resolveRelatedSeedRef.d.ts.map +1 -0
- package/dist/src/db/read/subqueries/liveVersion.d.ts +12 -0
- package/dist/src/db/read/subqueries/liveVersion.d.ts.map +1 -0
- package/dist/src/db/read/subqueries/metadataLatest.d.ts +4 -0
- package/dist/src/db/read/subqueries/metadataLatest.d.ts.map +1 -1
- package/dist/src/db/read/subqueries/versionData.d.ts +7 -2
- package/dist/src/db/read/subqueries/versionData.d.ts.map +1 -1
- package/dist/src/db/read/summarizePublishWork.d.ts +10 -2
- package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
- package/dist/src/db/resetAmbiguousLegacyItemData.d.ts +17 -0
- package/dist/src/db/resetAmbiguousLegacyItemData.d.ts.map +1 -0
- package/dist/src/db/sqlParamBatches.d.ts +27 -0
- package/dist/src/db/sqlParamBatches.d.ts.map +1 -0
- package/dist/src/db/write/addExcludedTransactions.d.ts +7 -0
- package/dist/src/db/write/addExcludedTransactions.d.ts.map +1 -0
- package/dist/src/db/write/applyPropertyAttestationUidsFromPublish.d.ts +6 -0
- package/dist/src/db/write/applyPropertyAttestationUidsFromPublish.d.ts.map +1 -1
- package/dist/src/db/write/createMetadata.d.ts +2 -0
- package/dist/src/db/write/createMetadata.d.ts.map +1 -1
- package/dist/src/db/write/createNewItem.d.ts +3 -1
- package/dist/src/db/write/createNewItem.d.ts.map +1 -1
- package/dist/src/db/write/createSeed.d.ts +2 -1
- package/dist/src/db/write/createSeed.d.ts.map +1 -1
- package/dist/src/db/write/createSeeds.d.ts +1 -1
- package/dist/src/db/write/createSeeds.d.ts.map +1 -1
- package/dist/src/db/write/linkModelToSchema.d.ts +12 -0
- package/dist/src/db/write/linkModelToSchema.d.ts.map +1 -0
- package/dist/src/db/write/updateItemPropertyValue.d.ts.map +1 -1
- package/dist/src/db/write/updateMetadata.d.ts.map +1 -1
- package/dist/src/db/write/updateSeedRevokedAt.d.ts +11 -1
- package/dist/src/db/write/updateSeedRevokedAt.d.ts.map +1 -1
- package/dist/src/db/write/updateSeedUid.d.ts.map +1 -1
- package/dist/src/db/write/updateVersionUid.d.ts +2 -1
- package/dist/src/db/write/updateVersionUid.d.ts.map +1 -1
- package/dist/src/events/files/download.d.ts.map +1 -1
- package/dist/src/events/item/easSyncManager.d.ts +2 -0
- package/dist/src/events/item/easSyncManager.d.ts.map +1 -1
- package/dist/src/events/item/index.d.ts.map +1 -1
- package/dist/src/events/item/syncDbWithEas.d.ts +16 -0
- package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts +1 -0
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/IFileManager.d.ts +5 -0
- package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/errors.d.ts +10 -0
- package/dist/src/helpers/FileManager/errors.d.ts.map +1 -0
- package/dist/src/helpers/compareMetadataRowsLatestFirst.d.ts +21 -3
- package/dist/src/helpers/compareMetadataRowsLatestFirst.d.ts.map +1 -1
- package/dist/src/helpers/constants.d.ts +9 -0
- package/dist/src/helpers/constants.d.ts.map +1 -1
- package/dist/src/helpers/crypto.d.ts +5 -0
- package/dist/src/helpers/crypto.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts +25 -5
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/easPropertyCanonical.d.ts +1 -1
- package/dist/src/helpers/easPropertyCanonical.d.ts.map +1 -1
- package/dist/src/helpers/entity/entityCommon.d.ts +10 -0
- package/dist/src/helpers/entity/entityCommon.d.ts.map +1 -1
- package/dist/src/helpers/entity/entityDestroy.d.ts +1 -1
- package/dist/src/helpers/entity/entityDestroy.d.ts.map +1 -1
- package/dist/src/helpers/entity/entityLiveQuery.d.ts +5 -0
- package/dist/src/helpers/entity/entityLiveQuery.d.ts.map +1 -1
- package/dist/src/helpers/file/fetchAll/actors.d.ts.map +1 -1
- package/dist/src/helpers/getSegmentedItemProperties.d.ts.map +1 -1
- package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts +6 -0
- package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts.map +1 -1
- package/dist/src/helpers/isPublishedMetadataRow.d.ts +10 -0
- package/dist/src/helpers/isPublishedMetadataRow.d.ts.map +1 -0
- package/dist/src/helpers/ownership.d.ts.map +1 -1
- package/dist/src/helpers/property.d.ts +6 -1
- package/dist/src/helpers/property.d.ts.map +1 -1
- package/dist/src/helpers/schema.d.ts +14 -4
- package/dist/src/helpers/schema.d.ts.map +1 -1
- package/dist/src/helpers/tabCoordinator.d.ts +45 -0
- package/dist/src/helpers/tabCoordinator.d.ts.map +1 -0
- package/dist/src/helpers/tabEvents.d.ts +27 -0
- package/dist/src/helpers/tabEvents.d.ts.map +1 -0
- package/dist/src/helpers/tabLocks.d.ts +28 -0
- package/dist/src/helpers/tabLocks.d.ts.map +1 -0
- package/dist/src/helpers/updateSchema.d.ts.map +1 -1
- package/dist/src/imports/json.d.ts.map +1 -1
- package/dist/src/imports/markdown.d.ts.map +1 -1
- package/dist/src/index.d.ts +11 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/node/db/Db.d.ts.map +1 -1
- package/dist/src/node/helpers/FileManager.d.ts +2 -0
- package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/query/createLocalQueryDataSource.d.ts +4 -0
- package/dist/src/query/createLocalQueryDataSource.d.ts.map +1 -1
- package/dist/src/seedSchema/MetadataSchema.d.ts +36 -0
- package/dist/src/seedSchema/MetadataSchema.d.ts.map +1 -1
- package/dist/src/seedSchema/ModelSchema.d.ts +57 -0
- package/dist/src/seedSchema/ModelSchema.d.ts.map +1 -1
- package/dist/src/seedSchema/SeedSchema.d.ts +19 -0
- package/dist/src/seedSchema/SeedSchema.d.ts.map +1 -1
- package/dist/src/seedSchema/VersionSchema.d.ts +17 -0
- package/dist/src/seedSchema/VersionSchema.d.ts.map +1 -1
- package/dist/src/services/write/actors/writeToDatabase.d.ts +5 -0
- package/dist/src/services/write/actors/writeToDatabase.d.ts.map +1 -1
- package/dist/src/services/write/writeProcessMachine.d.ts.map +1 -1
- package/dist/src/stores/eas.d.ts +1 -1
- package/dist/src/stores/eas.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +7 -0
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/item.d.ts +12 -3
- package/dist/src/types/item.d.ts.map +1 -1
- package/dist/src/types/property.d.ts +3 -2
- package/dist/src/types/property.d.ts.map +1 -1
- package/dist/syncDbWithEas-LRKr_NZF.js +855 -0
- package/dist/syncDbWithEas-LRKr_NZF.js.map +1 -0
- package/dist/{index-280bL-n4.js → tabEvents-DYI2GU7i.js} +231 -68
- package/dist/tabEvents-DYI2GU7i.js.map +1 -0
- package/dist/tolerantWebAccess-CzOBz5M6.js +160 -0
- package/dist/tolerantWebAccess-CzOBz5M6.js.map +1 -0
- package/dist/updateSeedRevokedAt-B58ORbY3.js +32 -0
- package/dist/updateSeedRevokedAt-B58ORbY3.js.map +1 -0
- package/package.json +5 -5
- package/dist/BasePathResolver-B6CKqoKw.js.map +0 -1
- package/dist/ClientManager-ChcmUL47.js.map +0 -1
- package/dist/ModelProperty-D79uV42p.js.map +0 -1
- package/dist/Schema-a8uO-hIZ.js.map +0 -1
- package/dist/SchemaValidationService-Y49vqast.js.map +0 -1
- package/dist/backfillMetadataPropertyIds-CBsf7LnU.js.map +0 -1
- package/dist/cjs/ModelProperty-D9FGaGuE.js.map +0 -1
- package/dist/cjs/Schema-BiJIPLEL.js.map +0 -1
- package/dist/cjs/SchemaValidationService-DtYs_CNY.js.map +0 -1
- package/dist/cjs/backfillMetadataPropertyIds-2XaN3b9S.js.map +0 -1
- package/dist/cjs/getPublishPayload-D5DhLGvN.js.map +0 -1
- package/dist/cjs/getPublishUploads-DMhCCKYF.js.map +0 -1
- package/dist/cjs/getSegmentedItemProperties-CU8rtBAo.js.map +0 -1
- package/dist/cjs/index-CSNtEnbF.js.map +0 -1
- package/dist/cjs/index-DPp9rdRL.js.map +0 -1
- package/dist/cjs/property-DlKiAWt4.js.map +0 -1
- package/dist/cjs/syncDbWithEas-C6n34o_Q.js +0 -606
- package/dist/cjs/syncDbWithEas-C6n34o_Q.js.map +0 -1
- package/dist/db-WbrzEf7c.js.map +0 -1
- package/dist/eas-CfYCu4IX.js.map +0 -1
- package/dist/getPublishPayload-BIrTVUxb.js.map +0 -1
- package/dist/getSegmentedItemProperties-BmKE71vU.js.map +0 -1
- package/dist/index-280bL-n4.js.map +0 -1
- package/dist/index-ClSv5pTA.js.map +0 -1
- package/dist/index-Djd3667v.js.map +0 -1
- package/dist/index-HRHkbVQd.js.map +0 -1
- package/dist/index.node-DBtQkEfz.js.map +0 -1
- package/dist/property-CQjuZ4JW.js.map +0 -1
- package/dist/src/Item/service/actors/fetchDataFromEas.d.ts +0 -4
- package/dist/src/Item/service/actors/fetchDataFromEas.d.ts.map +0 -1
- package/dist/src/Item/service/actors/hydrateExistingItem.d.ts +0 -4
- package/dist/src/Item/service/actors/hydrateExistingItem.d.ts.map +0 -1
- package/dist/src/Item/service/actors/hydrateNewItem.d.ts +0 -4
- package/dist/src/Item/service/actors/hydrateNewItem.d.ts.map +0 -1
- package/dist/src/Item/service/actors/initialize.d.ts +0 -4
- package/dist/src/Item/service/actors/initialize.d.ts.map +0 -1
- package/dist/src/Item/service/actors/reload.d.ts +0 -5
- package/dist/src/Item/service/actors/reload.d.ts.map +0 -1
- package/dist/src/Item/service/actors/saveDataToDb.d.ts +0 -4
- package/dist/src/Item/service/actors/saveDataToDb.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/resolveRemoteStorage.d.ts +0 -5
- package/dist/src/ItemProperty/service/actors/resolveRemoteStorage.d.ts.map +0 -1
- package/dist/src/Schema/service/addModelsMachine.d.ts +0 -123
- package/dist/src/Schema/service/addModelsMachine.d.ts.map +0 -1
- package/dist/src/db/configs/dev.schema.config.d.ts.map +0 -1
- package/dist/src/helpers/file/download/actors.d.ts +0 -17
- package/dist/src/helpers/file/download/actors.d.ts.map +0 -1
- package/dist/src/helpers/file/download/index.d.ts +0 -70
- package/dist/src/helpers/file/download/index.d.ts.map +0 -1
- package/dist/src/services/publish/actors/createPublishAttempt.d.ts +0 -4
- package/dist/src/services/publish/actors/createPublishAttempt.d.ts.map +0 -1
- package/dist/src/services/publish/actors/preparePublishRequestData.d.ts +0 -4
- package/dist/src/services/publish/actors/preparePublishRequestData.d.ts.map +0 -1
- package/dist/src/services/publish/actors/upload.d.ts +0 -4
- package/dist/src/services/publish/actors/upload.d.ts.map +0 -1
- package/dist/src/services/publish/actors/validateItemData.d.ts +0 -4
- package/dist/src/services/publish/actors/validateItemData.d.ts.map +0 -1
- package/dist/src/services/publish/publishMachine.d.ts +0 -32
- package/dist/src/services/publish/publishMachine.d.ts.map +0 -1
- package/dist/syncDbWithEas-CuARXfyN.js +0 -598
- package/dist/syncDbWithEas-CuARXfyN.js.map +0 -1
- package/dist/updateSeedRevokedAt-CBcLfHWs.js +0 -22
- package/dist/updateSeedRevokedAt-CBcLfHWs.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var xstate = require('xstate');
|
|
4
|
-
var main_cjs = require('./index-
|
|
4
|
+
var main_cjs = require('./index-C66AfYDG.js');
|
|
5
5
|
var drizzleOrm = require('drizzle-orm');
|
|
6
6
|
var debug = require('debug');
|
|
7
7
|
require('pluralize');
|
|
8
|
-
var SchemaValidationService = require('./SchemaValidationService-
|
|
8
|
+
var SchemaValidationService = require('./SchemaValidationService-CWEnZmOH.js');
|
|
9
9
|
require('immer');
|
|
10
10
|
require('reflect-metadata');
|
|
11
11
|
require('drizzle-orm/sqlite-core');
|
|
@@ -76,7 +76,7 @@ const createModelInstances$2 = async (modelIds) => {
|
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
try {
|
|
79
|
-
const modelMod = await Promise.resolve().then(function () { return require('./index-
|
|
79
|
+
const modelMod = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.Model$1; });
|
|
80
80
|
const { Model } = modelMod;
|
|
81
81
|
// Create instances for all model IDs in parallel
|
|
82
82
|
// Model.createById() will check cache first, then query DB and create if needed
|
|
@@ -189,7 +189,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
189
189
|
// For Seed Protocol, always load from internal file, never create new
|
|
190
190
|
logger$d(`Loading internal Seed Protocol schema from SDK`);
|
|
191
191
|
try {
|
|
192
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
192
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
193
193
|
const schemaFile = internalSchema.default;
|
|
194
194
|
// Check if it exists in database, if not, add it
|
|
195
195
|
const db = main_cjs.BaseDb.getAppDb();
|
|
@@ -682,7 +682,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
682
682
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
683
683
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
684
684
|
try {
|
|
685
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
685
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
686
686
|
const internalSchemaFile = internalSchema.default;
|
|
687
687
|
mergedModels = { ...(internalSchemaFile.models || {}) };
|
|
688
688
|
logger$d(`Populated models for seed-protocol schema from internal file`);
|
|
@@ -909,7 +909,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
909
909
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
910
910
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
911
911
|
try {
|
|
912
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
912
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
913
913
|
const internalSchemaFile = internalSchema.default;
|
|
914
914
|
mergedModels = { ...(internalSchemaFile.models || {}) };
|
|
915
915
|
logger$d(`Populated models for seed-protocol schema from internal file`);
|
|
@@ -998,7 +998,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
998
998
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
999
999
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
1000
1000
|
try {
|
|
1001
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
1001
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
1002
1002
|
const internalSchemaFile = internalSchema.default;
|
|
1003
1003
|
mergedModels = { ...(internalSchemaFile.models || {}) };
|
|
1004
1004
|
logger$d(`Populated models for seed-protocol schema from internal file`);
|
|
@@ -1084,7 +1084,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
1084
1084
|
// If schemaData is missing, try to load from internal schema file for seed-protocol
|
|
1085
1085
|
if (!dbSchema.schemaData && schemaName === 'Seed Protocol') {
|
|
1086
1086
|
try {
|
|
1087
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
1087
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
1088
1088
|
const schemaFile = internalSchema.default;
|
|
1089
1089
|
logger$d(`Found seed-protocol schema in internal file (schemaData missing, using internal schema)`);
|
|
1090
1090
|
// Update database with schemaData for future loads
|
|
@@ -1193,7 +1193,7 @@ const loadOrCreateSchema = xstate.fromCallback(({ sendBack, input: { context } }
|
|
|
1193
1193
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
1194
1194
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
1195
1195
|
try {
|
|
1196
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
1196
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
1197
1197
|
const internalSchemaFile = internalSchema.default;
|
|
1198
1198
|
mergedModels = { ...(internalSchemaFile.models || {}) };
|
|
1199
1199
|
logger$d(`Populated models for seed-protocol schema from internal file`);
|
|
@@ -1464,582 +1464,6 @@ const validateSchema = xstate.fromCallback(({ sendBack, input: { context } }) =>
|
|
|
1464
1464
|
};
|
|
1465
1465
|
});
|
|
1466
1466
|
|
|
1467
|
-
const addModelsMachine = xstate.setup({
|
|
1468
|
-
types: {
|
|
1469
|
-
context: {},
|
|
1470
|
-
input: {},
|
|
1471
|
-
events: {},
|
|
1472
|
-
},
|
|
1473
|
-
actors: {
|
|
1474
|
-
validateModels: xstate.fromCallback(({ sendBack, input }) => {
|
|
1475
|
-
const _validate = async () => {
|
|
1476
|
-
// Check for duplicate model names
|
|
1477
|
-
const newModelNames = Object.keys(input.newModels);
|
|
1478
|
-
const existingModelNames = Object.keys(input.existingModels || {});
|
|
1479
|
-
for (const modelName of newModelNames) {
|
|
1480
|
-
if (existingModelNames.includes(modelName)) {
|
|
1481
|
-
throw new Error(`Model "${modelName}" already exists in schema`);
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
// Check for duplicates within new models
|
|
1485
|
-
const seenNames = new Set();
|
|
1486
|
-
for (const modelName of newModelNames) {
|
|
1487
|
-
if (seenNames.has(modelName)) {
|
|
1488
|
-
throw new Error(`Duplicate model name detected: "${modelName}". Each model must have a unique name.`);
|
|
1489
|
-
}
|
|
1490
|
-
seenNames.add(modelName);
|
|
1491
|
-
}
|
|
1492
|
-
// Basic validation - ensure models have required structure
|
|
1493
|
-
for (const [modelName, modelDef] of Object.entries(input.newModels)) {
|
|
1494
|
-
if (!modelDef || typeof modelDef !== 'object') {
|
|
1495
|
-
throw new Error(`Invalid model definition for "${modelName}": must be an object`);
|
|
1496
|
-
}
|
|
1497
|
-
if (!modelDef.properties || typeof modelDef.properties !== 'object') {
|
|
1498
|
-
throw new Error(`Model "${modelName}" must have a "properties" object`);
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
sendBack({ type: 'done', output: { valid: true } });
|
|
1502
|
-
};
|
|
1503
|
-
_validate().catch((error) => {
|
|
1504
|
-
sendBack({ type: 'error', error: error instanceof Error ? error : new Error(String(error)) });
|
|
1505
|
-
});
|
|
1506
|
-
return () => {
|
|
1507
|
-
// Cleanup
|
|
1508
|
-
};
|
|
1509
|
-
}),
|
|
1510
|
-
createModelInstances: xstate.fromCallback(({ sendBack, input }) => {
|
|
1511
|
-
const _createInstances = async () => {
|
|
1512
|
-
const debug = (await import('debug')).default;
|
|
1513
|
-
const logger = debug('seedSdk:schema:addModels:createInstances');
|
|
1514
|
-
const schemaMod = await Promise.resolve().then(function () { return Schema$1; });
|
|
1515
|
-
const { Schema: SchemaClass, schemaInstanceState } = schemaMod;
|
|
1516
|
-
const schemaName = input.schemaContext.metadata?.name || input.schemaContext.schemaName;
|
|
1517
|
-
const schemaInstance = SchemaClass.create(schemaName, {
|
|
1518
|
-
waitForReady: false,
|
|
1519
|
-
});
|
|
1520
|
-
const modelInstances = new Map();
|
|
1521
|
-
// Get instance state to store model instances
|
|
1522
|
-
const instanceState = schemaInstanceState.get(schemaInstance);
|
|
1523
|
-
if (!instanceState) {
|
|
1524
|
-
throw new Error('Schema instance state not found');
|
|
1525
|
-
}
|
|
1526
|
-
for (const [modelName, modelData] of Object.entries(input.models)) {
|
|
1527
|
-
try {
|
|
1528
|
-
logger(`Creating model instance for "${modelName}"`);
|
|
1529
|
-
// Look up modelFileId from database BEFORE creating the Model instance
|
|
1530
|
-
let modelFileId = undefined;
|
|
1531
|
-
try {
|
|
1532
|
-
const db = main_cjs.BaseDb.getAppDb();
|
|
1533
|
-
if (db) {
|
|
1534
|
-
const dbModels = await db
|
|
1535
|
-
.select()
|
|
1536
|
-
.from(main_cjs.models)
|
|
1537
|
-
.where(drizzleOrm.eq(main_cjs.models.name, modelName))
|
|
1538
|
-
.limit(1);
|
|
1539
|
-
if (dbModels.length > 0 && dbModels[0].schemaFileId) {
|
|
1540
|
-
modelFileId = dbModels[0].schemaFileId;
|
|
1541
|
-
logger(`Found modelFileId "${modelFileId}" for model "${modelName}" from database`);
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
}
|
|
1545
|
-
catch (error) {
|
|
1546
|
-
logger(`Error looking up modelFileId from database: ${error}`);
|
|
1547
|
-
}
|
|
1548
|
-
// If not found in database, generate a new modelFileId for new models
|
|
1549
|
-
if (!modelFileId) {
|
|
1550
|
-
modelFileId = main_cjs.generateId();
|
|
1551
|
-
logger(`Generated new modelFileId "${modelFileId}" for new model "${modelName}"`);
|
|
1552
|
-
}
|
|
1553
|
-
// Create new Model instance with modelFileId
|
|
1554
|
-
// Model.create() will set _modelFileId in the context automatically
|
|
1555
|
-
const modelInstance = main_cjs.Model.create(modelName, schemaName, {
|
|
1556
|
-
modelFileId,
|
|
1557
|
-
waitForReady: false,
|
|
1558
|
-
});
|
|
1559
|
-
const service = modelInstance.getService();
|
|
1560
|
-
logger(`Created Model instance for "${modelName}" with modelFileId "${modelFileId}"`);
|
|
1561
|
-
// Wait for the Model service to finish loading (loadOrCreateModel completes)
|
|
1562
|
-
await new Promise((resolve) => {
|
|
1563
|
-
let resolved = false;
|
|
1564
|
-
let subscription = null;
|
|
1565
|
-
// Check if already idle
|
|
1566
|
-
const snapshot = service.getSnapshot();
|
|
1567
|
-
if (snapshot.value === 'idle') {
|
|
1568
|
-
const currentModelFileId = snapshot.context._modelFileId;
|
|
1569
|
-
if (currentModelFileId === modelFileId) {
|
|
1570
|
-
logger(`ModelFileId "${modelFileId}" correctly set for model "${modelName}"`);
|
|
1571
|
-
}
|
|
1572
|
-
else {
|
|
1573
|
-
logger(`WARNING: ModelFileId not set for model "${modelName}" (expected: "${modelFileId}", got: "${currentModelFileId || 'undefined'}")`);
|
|
1574
|
-
// Try to set it again
|
|
1575
|
-
service.send({
|
|
1576
|
-
type: 'updateContext',
|
|
1577
|
-
_modelFileId: modelFileId,
|
|
1578
|
-
});
|
|
1579
|
-
}
|
|
1580
|
-
resolved = true;
|
|
1581
|
-
resolve();
|
|
1582
|
-
return;
|
|
1583
|
-
}
|
|
1584
|
-
// Wait for service to become idle
|
|
1585
|
-
subscription = service.subscribe((snapshot) => {
|
|
1586
|
-
if (snapshot.value === 'idle') {
|
|
1587
|
-
if (subscription) {
|
|
1588
|
-
subscription.unsubscribe();
|
|
1589
|
-
subscription = null;
|
|
1590
|
-
}
|
|
1591
|
-
const currentModelFileId = snapshot.context._modelFileId;
|
|
1592
|
-
if (currentModelFileId === modelFileId) {
|
|
1593
|
-
logger(`ModelFileId "${modelFileId}" correctly set for model "${modelName}"`);
|
|
1594
|
-
}
|
|
1595
|
-
else {
|
|
1596
|
-
logger(`WARNING: ModelFileId not set for model "${modelName}" (expected: "${modelFileId}", got: "${currentModelFileId || 'undefined'}")`);
|
|
1597
|
-
// Try to set it again - but only once to avoid infinite loop
|
|
1598
|
-
if (!resolved) {
|
|
1599
|
-
service.send({
|
|
1600
|
-
type: 'updateContext',
|
|
1601
|
-
_modelFileId: modelFileId,
|
|
1602
|
-
});
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
if (!resolved) {
|
|
1606
|
-
resolved = true;
|
|
1607
|
-
resolve();
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
else if (snapshot.value === 'error') {
|
|
1611
|
-
if (subscription) {
|
|
1612
|
-
subscription.unsubscribe();
|
|
1613
|
-
subscription = null;
|
|
1614
|
-
}
|
|
1615
|
-
if (!resolved) {
|
|
1616
|
-
resolved = true;
|
|
1617
|
-
resolve();
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1620
|
-
});
|
|
1621
|
-
// Timeout after 2 seconds
|
|
1622
|
-
setTimeout(() => {
|
|
1623
|
-
if (subscription) {
|
|
1624
|
-
subscription.unsubscribe();
|
|
1625
|
-
subscription = null;
|
|
1626
|
-
}
|
|
1627
|
-
if (!resolved) {
|
|
1628
|
-
resolved = true;
|
|
1629
|
-
resolve();
|
|
1630
|
-
}
|
|
1631
|
-
}, 2000);
|
|
1632
|
-
});
|
|
1633
|
-
// Update the model instance with current data
|
|
1634
|
-
modelInstance.getService().send({
|
|
1635
|
-
type: 'updateContext',
|
|
1636
|
-
properties: modelData.properties || {},
|
|
1637
|
-
});
|
|
1638
|
-
// Initialize original values
|
|
1639
|
-
modelInstance.getService().send({
|
|
1640
|
-
type: 'initializeOriginalValues',
|
|
1641
|
-
originalValues: {
|
|
1642
|
-
_originalValues: {
|
|
1643
|
-
properties: modelData.properties ? JSON.parse(JSON.stringify(modelData.properties)) : {},
|
|
1644
|
-
},
|
|
1645
|
-
},
|
|
1646
|
-
isEdited: false,
|
|
1647
|
-
});
|
|
1648
|
-
// Store in instance state
|
|
1649
|
-
if (!instanceState.modelInstances) {
|
|
1650
|
-
instanceState.modelInstances = new Map();
|
|
1651
|
-
}
|
|
1652
|
-
instanceState.modelInstances.set(modelName, modelInstance);
|
|
1653
|
-
modelInstances.set(modelName, modelInstance);
|
|
1654
|
-
logger(`Successfully created model instance for "${modelName}"`);
|
|
1655
|
-
}
|
|
1656
|
-
catch (error) {
|
|
1657
|
-
logger(`Error creating model instance for "${modelName}": ${error}`);
|
|
1658
|
-
throw error;
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
sendBack({
|
|
1662
|
-
type: 'done',
|
|
1663
|
-
output: { modelInstances }
|
|
1664
|
-
});
|
|
1665
|
-
};
|
|
1666
|
-
_createInstances().catch((error) => {
|
|
1667
|
-
sendBack({ type: 'error', error: error instanceof Error ? error : new Error(String(error)) });
|
|
1668
|
-
});
|
|
1669
|
-
return () => {
|
|
1670
|
-
// Cleanup
|
|
1671
|
-
};
|
|
1672
|
-
}),
|
|
1673
|
-
collectModelFileIds: xstate.fromCallback(({ sendBack, input }) => {
|
|
1674
|
-
const _collectIds = async () => {
|
|
1675
|
-
const debug = (await import('debug')).default;
|
|
1676
|
-
const logger = debug('seedSdk:schema:addModels:collectIds');
|
|
1677
|
-
const modelFileIds = new Map();
|
|
1678
|
-
for (const [modelName, modelInstance] of input.modelInstances.entries()) {
|
|
1679
|
-
try {
|
|
1680
|
-
const service = modelInstance.getService();
|
|
1681
|
-
let modelFileId = undefined;
|
|
1682
|
-
// Check current snapshot first
|
|
1683
|
-
const snapshot = service.getSnapshot();
|
|
1684
|
-
if (snapshot.value === 'idle' && snapshot.context._modelFileId) {
|
|
1685
|
-
modelFileId = snapshot.context._modelFileId;
|
|
1686
|
-
}
|
|
1687
|
-
else {
|
|
1688
|
-
// If not ready, wait for it to become idle
|
|
1689
|
-
await new Promise((resolve) => {
|
|
1690
|
-
const subscription = service.subscribe((snapshot) => {
|
|
1691
|
-
if (snapshot.value === 'idle') {
|
|
1692
|
-
subscription.unsubscribe();
|
|
1693
|
-
if (snapshot.context._modelFileId) {
|
|
1694
|
-
modelFileId = snapshot.context._modelFileId;
|
|
1695
|
-
}
|
|
1696
|
-
resolve();
|
|
1697
|
-
}
|
|
1698
|
-
else if (snapshot.value === 'error') {
|
|
1699
|
-
subscription.unsubscribe();
|
|
1700
|
-
resolve();
|
|
1701
|
-
}
|
|
1702
|
-
});
|
|
1703
|
-
// Timeout after 1 second
|
|
1704
|
-
setTimeout(() => {
|
|
1705
|
-
subscription.unsubscribe();
|
|
1706
|
-
resolve();
|
|
1707
|
-
}, 1000);
|
|
1708
|
-
});
|
|
1709
|
-
}
|
|
1710
|
-
if (modelFileId) {
|
|
1711
|
-
modelFileIds.set(modelName, modelFileId);
|
|
1712
|
-
logger(`Collected modelFileId "${modelFileId}" for model "${modelName}"`);
|
|
1713
|
-
}
|
|
1714
|
-
else {
|
|
1715
|
-
logger(`WARNING: modelFileId not found for model "${modelName}" after waiting`);
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
catch (error) {
|
|
1719
|
-
logger(`Error collecting modelFileId for "${modelName}": ${error}`);
|
|
1720
|
-
// Continue with other models even if one fails
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
sendBack({
|
|
1724
|
-
type: 'done',
|
|
1725
|
-
output: { modelFileIds }
|
|
1726
|
-
});
|
|
1727
|
-
};
|
|
1728
|
-
_collectIds().catch((error) => {
|
|
1729
|
-
sendBack({ type: 'error', error: error instanceof Error ? error : new Error(String(error)) });
|
|
1730
|
-
});
|
|
1731
|
-
return () => {
|
|
1732
|
-
// Cleanup
|
|
1733
|
-
};
|
|
1734
|
-
}),
|
|
1735
|
-
persistModelsToDb: xstate.fromCallback(({ sendBack, input }) => {
|
|
1736
|
-
const _persist = async () => {
|
|
1737
|
-
const debug = (await import('debug')).default;
|
|
1738
|
-
const logger = debug('seedSdk:schema:addModels:persist');
|
|
1739
|
-
// Only process in browser environment where store is available
|
|
1740
|
-
if (typeof window === 'undefined') {
|
|
1741
|
-
logger('Not in browser environment, skipping store update');
|
|
1742
|
-
sendBack({
|
|
1743
|
-
type: 'done',
|
|
1744
|
-
output: { addedModels: input.models }
|
|
1745
|
-
});
|
|
1746
|
-
return;
|
|
1747
|
-
}
|
|
1748
|
-
const schemaName = input.schemaContext.metadata?.name || input.schemaContext.schemaName;
|
|
1749
|
-
const schemaFileId = input.schemaContext.id; // id is the schemaFileId (string) in SchemaMachineContext
|
|
1750
|
-
const db = main_cjs.BaseDb.getAppDb();
|
|
1751
|
-
if (!db) {
|
|
1752
|
-
logger('Database not found, skipping model store update');
|
|
1753
|
-
sendBack({
|
|
1754
|
-
type: 'done',
|
|
1755
|
-
output: { addedModels: input.models }
|
|
1756
|
-
});
|
|
1757
|
-
return;
|
|
1758
|
-
}
|
|
1759
|
-
// Find schema record - prefer schemaFileId lookup (more reliable), then fall back to name
|
|
1760
|
-
// Retry up to 3 times with a short delay in case schema is still being saved
|
|
1761
|
-
let schemaRecord;
|
|
1762
|
-
const maxRetries = 3;
|
|
1763
|
-
const retryDelay = 100; // ms
|
|
1764
|
-
for (let attempt = 0; attempt < maxRetries && !schemaRecord; attempt++) {
|
|
1765
|
-
if (attempt > 0) {
|
|
1766
|
-
logger(`Retry ${attempt}/${maxRetries - 1} to find schema, waiting ${retryDelay}ms...`);
|
|
1767
|
-
await new Promise(resolve => setTimeout(resolve, retryDelay));
|
|
1768
|
-
}
|
|
1769
|
-
// PRIMARY: Look up by schemaFileId if available (most reliable, independent of name changes)
|
|
1770
|
-
if (schemaFileId) {
|
|
1771
|
-
logger(`Looking up schema by schemaFileId: ${schemaFileId} (attempt ${attempt + 1})`);
|
|
1772
|
-
const schemasById = await db
|
|
1773
|
-
.select()
|
|
1774
|
-
.from(main_cjs.schemas)
|
|
1775
|
-
.where(drizzleOrm.eq(main_cjs.schemas.schemaFileId, schemaFileId))
|
|
1776
|
-
.limit(1);
|
|
1777
|
-
if (schemasById.length > 0) {
|
|
1778
|
-
schemaRecord = schemasById[0];
|
|
1779
|
-
if (schemaRecord) {
|
|
1780
|
-
logger(`Found schema by schemaFileId: ${schemaFileId} (id: ${schemaRecord.id}, name: ${schemaRecord.name}, isDraft: ${schemaRecord.isDraft})`);
|
|
1781
|
-
}
|
|
1782
|
-
break;
|
|
1783
|
-
}
|
|
1784
|
-
else {
|
|
1785
|
-
logger(`No schema found by schemaFileId: ${schemaFileId}, will try by name`);
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
// FALLBACK: If not found by schemaFileId, try by name (prefer draft records)
|
|
1789
|
-
if (!schemaRecord) {
|
|
1790
|
-
logger(`Looking up schema by name: "${schemaName}" (attempt ${attempt + 1})`);
|
|
1791
|
-
const schemasByName = await db
|
|
1792
|
-
.select()
|
|
1793
|
-
.from(main_cjs.schemas)
|
|
1794
|
-
.where(drizzleOrm.eq(main_cjs.schemas.name, schemaName))
|
|
1795
|
-
.orderBy(drizzleOrm.desc(main_cjs.schemas.isDraft), drizzleOrm.desc(main_cjs.schemas.version))
|
|
1796
|
-
.limit(10); // Get multiple to find drafts
|
|
1797
|
-
if (schemasByName.length > 0) {
|
|
1798
|
-
// Prefer draft records
|
|
1799
|
-
const draftRecord = schemasByName.find((s) => s.isDraft === true);
|
|
1800
|
-
schemaRecord = draftRecord || schemasByName[0];
|
|
1801
|
-
if (schemaRecord) {
|
|
1802
|
-
logger(`Found schema by name "${schemaName}": selected ${draftRecord ? 'draft' : 'first'} record (id: ${schemaRecord.id}, isDraft: ${schemaRecord.isDraft})`);
|
|
1803
|
-
}
|
|
1804
|
-
break;
|
|
1805
|
-
}
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
if (!schemaRecord) {
|
|
1809
|
-
logger(`Schema "${schemaName}" (schemaFileId: ${schemaFileId || 'none'}) not found in database after ${maxRetries} attempts, skipping model store update`);
|
|
1810
|
-
sendBack({
|
|
1811
|
-
type: 'done',
|
|
1812
|
-
output: { addedModels: input.models }
|
|
1813
|
-
});
|
|
1814
|
-
return;
|
|
1815
|
-
}
|
|
1816
|
-
// Convert schema model format to JSON import format for createModelFromJson
|
|
1817
|
-
const modelDefinitions = {};
|
|
1818
|
-
for (const [modelName, modelDef] of Object.entries(input.models)) {
|
|
1819
|
-
// Convert properties from schema format to JSON import format
|
|
1820
|
-
const convertedProperties = {};
|
|
1821
|
-
if (modelDef.properties) {
|
|
1822
|
-
for (const [propName, propDef] of Object.entries(modelDef.properties)) {
|
|
1823
|
-
// Schema format: { dataType, ref, refValueType, storageType, localStorageDir, filenameSuffix }
|
|
1824
|
-
// JSON import format: { type, model, items, storage: { type, path, extension } }
|
|
1825
|
-
const schemaProp = propDef;
|
|
1826
|
-
const jsonProp = {
|
|
1827
|
-
type: schemaProp.dataType || schemaProp.type,
|
|
1828
|
-
};
|
|
1829
|
-
// Handle Relation type
|
|
1830
|
-
if (schemaProp.ref || schemaProp.refModelName) {
|
|
1831
|
-
jsonProp.model = schemaProp.refModelName || schemaProp.ref;
|
|
1832
|
-
}
|
|
1833
|
-
// Handle List type
|
|
1834
|
-
if (main_cjs.isDataType(schemaProp.dataType, main_cjs.ModelPropertyDataTypes.List) && schemaProp.refValueType) {
|
|
1835
|
-
jsonProp.refValueType = schemaProp.refValueType;
|
|
1836
|
-
if (schemaProp.ref || schemaProp.refModelName) {
|
|
1837
|
-
jsonProp.ref = schemaProp.refModelName || schemaProp.ref;
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
// Handle storage configuration
|
|
1841
|
-
if (schemaProp.storageType || schemaProp.localStorageDir || schemaProp.filenameSuffix) {
|
|
1842
|
-
jsonProp.storage = {
|
|
1843
|
-
type: schemaProp.storageType === 'ItemStorage' ? 'ItemStorage' : 'PropertyStorage',
|
|
1844
|
-
path: schemaProp.localStorageDir,
|
|
1845
|
-
extension: schemaProp.filenameSuffix,
|
|
1846
|
-
};
|
|
1847
|
-
}
|
|
1848
|
-
if (schemaProp.required !== undefined) {
|
|
1849
|
-
jsonProp.required = schemaProp.required;
|
|
1850
|
-
}
|
|
1851
|
-
convertedProperties[propName] = jsonProp;
|
|
1852
|
-
}
|
|
1853
|
-
}
|
|
1854
|
-
// Create model definition in JSON import format
|
|
1855
|
-
// Note: description is not passed - JSON files can have it but we ignore it at runtime
|
|
1856
|
-
const jsonModelDef = {
|
|
1857
|
-
properties: convertedProperties,
|
|
1858
|
-
};
|
|
1859
|
-
// Create Model instance
|
|
1860
|
-
const ModelClass = await main_cjs.createModelFromJson(modelName, jsonModelDef, schemaName);
|
|
1861
|
-
modelDefinitions[modelName] = ModelClass;
|
|
1862
|
-
// Model is now accessible via Model static methods, no registration needed
|
|
1863
|
-
logger(`Created model "${modelName}"`);
|
|
1864
|
-
}
|
|
1865
|
-
// Add models to database with modelFileIds
|
|
1866
|
-
if (Object.keys(modelDefinitions).length > 0) {
|
|
1867
|
-
await main_cjs.addModelsToDb(modelDefinitions, schemaRecord, undefined, {
|
|
1868
|
-
schemaFileId: input.schemaContext.id, // id is the schemaFileId (string) in SchemaMachineContext
|
|
1869
|
-
modelFileIds: input.modelFileIds.size > 0 ? input.modelFileIds : undefined,
|
|
1870
|
-
});
|
|
1871
|
-
logger(`Added ${Object.keys(modelDefinitions).length} new models to database`);
|
|
1872
|
-
}
|
|
1873
|
-
sendBack({
|
|
1874
|
-
type: 'done',
|
|
1875
|
-
output: { addedModels: input.models }
|
|
1876
|
-
});
|
|
1877
|
-
};
|
|
1878
|
-
_persist().catch((error) => {
|
|
1879
|
-
sendBack({ type: 'error', error: error instanceof Error ? error : new Error(String(error)) });
|
|
1880
|
-
});
|
|
1881
|
-
return () => {
|
|
1882
|
-
// Cleanup
|
|
1883
|
-
};
|
|
1884
|
-
}),
|
|
1885
|
-
},
|
|
1886
|
-
}).createMachine({
|
|
1887
|
-
id: 'addModels',
|
|
1888
|
-
initial: 'preparing',
|
|
1889
|
-
context: ({ input }) => ({
|
|
1890
|
-
schemaContext: input.schemaContext,
|
|
1891
|
-
models: input.models,
|
|
1892
|
-
existingModels: input.existingModels,
|
|
1893
|
-
progress: {
|
|
1894
|
-
stage: 'preparing',
|
|
1895
|
-
totalModels: Object.keys(input.models).length,
|
|
1896
|
-
completedModels: 0,
|
|
1897
|
-
},
|
|
1898
|
-
}),
|
|
1899
|
-
states: {
|
|
1900
|
-
preparing: {
|
|
1901
|
-
invoke: {
|
|
1902
|
-
src: 'validateModels',
|
|
1903
|
-
input: ({ context }) => ({
|
|
1904
|
-
newModels: context.models,
|
|
1905
|
-
existingModels: context.existingModels,
|
|
1906
|
-
}),
|
|
1907
|
-
onDone: {
|
|
1908
|
-
target: 'creatingInstances',
|
|
1909
|
-
actions: xstate.assign({
|
|
1910
|
-
progress: ({ context }) => ({
|
|
1911
|
-
...context.progress,
|
|
1912
|
-
stage: 'creatingInstances',
|
|
1913
|
-
}),
|
|
1914
|
-
}),
|
|
1915
|
-
},
|
|
1916
|
-
onError: {
|
|
1917
|
-
target: 'error',
|
|
1918
|
-
actions: xstate.assign({
|
|
1919
|
-
errors: ({ context, event }) => [
|
|
1920
|
-
...(context.errors || []),
|
|
1921
|
-
{
|
|
1922
|
-
modelName: 'validation',
|
|
1923
|
-
error: event.error instanceof Error ? event.error : new Error(String(event.error))
|
|
1924
|
-
},
|
|
1925
|
-
],
|
|
1926
|
-
}),
|
|
1927
|
-
},
|
|
1928
|
-
},
|
|
1929
|
-
},
|
|
1930
|
-
creatingInstances: {
|
|
1931
|
-
invoke: {
|
|
1932
|
-
src: 'createModelInstances',
|
|
1933
|
-
input: ({ context }) => ({
|
|
1934
|
-
schemaContext: context.schemaContext,
|
|
1935
|
-
models: context.models,
|
|
1936
|
-
}),
|
|
1937
|
-
onDone: {
|
|
1938
|
-
target: 'collectingIds',
|
|
1939
|
-
actions: xstate.assign({
|
|
1940
|
-
modelInstances: ({ event }) => {
|
|
1941
|
-
// Type assertion needed due to XState v5 type inference limitation
|
|
1942
|
-
const doneEvent = event;
|
|
1943
|
-
return doneEvent.output?.modelInstances;
|
|
1944
|
-
},
|
|
1945
|
-
progress: ({ context }) => ({
|
|
1946
|
-
...context.progress,
|
|
1947
|
-
stage: 'collectingIds',
|
|
1948
|
-
}),
|
|
1949
|
-
}),
|
|
1950
|
-
},
|
|
1951
|
-
onError: {
|
|
1952
|
-
target: 'error',
|
|
1953
|
-
actions: xstate.assign({
|
|
1954
|
-
errors: ({ context, event }) => [
|
|
1955
|
-
...(context.errors || []),
|
|
1956
|
-
{
|
|
1957
|
-
modelName: 'createInstances',
|
|
1958
|
-
error: event.error instanceof Error ? event.error : new Error(String(event.error))
|
|
1959
|
-
},
|
|
1960
|
-
],
|
|
1961
|
-
}),
|
|
1962
|
-
},
|
|
1963
|
-
},
|
|
1964
|
-
},
|
|
1965
|
-
collectingIds: {
|
|
1966
|
-
invoke: {
|
|
1967
|
-
src: 'collectModelFileIds',
|
|
1968
|
-
input: ({ context }) => ({
|
|
1969
|
-
modelInstances: context.modelInstances,
|
|
1970
|
-
}),
|
|
1971
|
-
onDone: {
|
|
1972
|
-
target: 'persisting',
|
|
1973
|
-
actions: xstate.assign({
|
|
1974
|
-
modelFileIds: ({ event }) => {
|
|
1975
|
-
// Type assertion needed due to XState v5 type inference limitation
|
|
1976
|
-
const doneEvent = event;
|
|
1977
|
-
return doneEvent.output?.modelFileIds;
|
|
1978
|
-
},
|
|
1979
|
-
progress: ({ context }) => ({
|
|
1980
|
-
...context.progress,
|
|
1981
|
-
stage: 'persisting',
|
|
1982
|
-
}),
|
|
1983
|
-
}),
|
|
1984
|
-
},
|
|
1985
|
-
onError: {
|
|
1986
|
-
target: 'error',
|
|
1987
|
-
actions: xstate.assign({
|
|
1988
|
-
errors: ({ context, event }) => [
|
|
1989
|
-
...(context.errors || []),
|
|
1990
|
-
{
|
|
1991
|
-
modelName: 'collectIds',
|
|
1992
|
-
error: event.error instanceof Error ? event.error : new Error(String(event.error))
|
|
1993
|
-
},
|
|
1994
|
-
],
|
|
1995
|
-
}),
|
|
1996
|
-
},
|
|
1997
|
-
},
|
|
1998
|
-
},
|
|
1999
|
-
persisting: {
|
|
2000
|
-
invoke: {
|
|
2001
|
-
src: 'persistModelsToDb',
|
|
2002
|
-
input: ({ context }) => ({
|
|
2003
|
-
schemaContext: context.schemaContext,
|
|
2004
|
-
models: context.models,
|
|
2005
|
-
modelFileIds: context.modelFileIds,
|
|
2006
|
-
}),
|
|
2007
|
-
onDone: {
|
|
2008
|
-
target: '#addModels.success',
|
|
2009
|
-
actions: xstate.assign({
|
|
2010
|
-
addedModels: ({ event }) => {
|
|
2011
|
-
// Type assertion needed due to XState v5 type inference limitation
|
|
2012
|
-
// Convert through unknown first to avoid type overlap error
|
|
2013
|
-
const doneEvent = event;
|
|
2014
|
-
return { addedModels: doneEvent.output?.addedModels };
|
|
2015
|
-
},
|
|
2016
|
-
}),
|
|
2017
|
-
},
|
|
2018
|
-
onError: {
|
|
2019
|
-
target: 'error',
|
|
2020
|
-
actions: xstate.assign({
|
|
2021
|
-
errors: ({ context, event }) => [
|
|
2022
|
-
...(context.errors || []),
|
|
2023
|
-
{ modelName: 'persist', error: event.error instanceof Error ? event.error : new Error(String(event.error)) },
|
|
2024
|
-
],
|
|
2025
|
-
}),
|
|
2026
|
-
},
|
|
2027
|
-
},
|
|
2028
|
-
},
|
|
2029
|
-
success: {
|
|
2030
|
-
id: 'success',
|
|
2031
|
-
type: 'final',
|
|
2032
|
-
output: ({ context }) => ({ addedModels: context.addedModels?.addedModels || [] }),
|
|
2033
|
-
},
|
|
2034
|
-
error: {
|
|
2035
|
-
type: 'final',
|
|
2036
|
-
output: ({ context }) => ({
|
|
2037
|
-
errors: context.errors || [],
|
|
2038
|
-
}),
|
|
2039
|
-
},
|
|
2040
|
-
},
|
|
2041
|
-
});
|
|
2042
|
-
|
|
2043
1467
|
const logger$c = debug('seedSdk:schema:actors:checkExistingSchema');
|
|
2044
1468
|
/**
|
|
2045
1469
|
* Query model IDs (schemaFileId) from database for a given schema
|
|
@@ -2094,7 +1518,7 @@ const createModelInstances$1 = async (modelIds) => {
|
|
|
2094
1518
|
return;
|
|
2095
1519
|
}
|
|
2096
1520
|
try {
|
|
2097
|
-
const mod = await Promise.resolve().then(function () { return require('./index-
|
|
1521
|
+
const mod = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.Model$1; });
|
|
2098
1522
|
const Model = mod?.Model ?? mod?.default;
|
|
2099
1523
|
if (!Model) {
|
|
2100
1524
|
logger$c('Model not available from dynamic import');
|
|
@@ -2139,7 +1563,7 @@ const checkExistingSchema = xstate.fromCallback(({ sendBack, input: { context }
|
|
|
2139
1563
|
if (isInternal && schemaName === main_cjs.SEED_PROTOCOL_SCHEMA_NAME) {
|
|
2140
1564
|
// For Seed Protocol, check if it exists in database
|
|
2141
1565
|
try {
|
|
2142
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
1566
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
2143
1567
|
const schemaFile = internalSchema.default;
|
|
2144
1568
|
if (db && schemaFile.id) {
|
|
2145
1569
|
const existing = await db
|
|
@@ -2497,7 +1921,7 @@ const writeSchemaToDb = xstate.fromCallback(({ sendBack, input }) => {
|
|
|
2497
1921
|
if (isInternal && schemaName === main_cjs.SEED_PROTOCOL_SCHEMA_NAME) {
|
|
2498
1922
|
// For Seed Protocol, load from internal file
|
|
2499
1923
|
logger$b(`Loading internal Seed Protocol schema from SDK`);
|
|
2500
|
-
const internalSchema = await Promise.resolve().then(function () { return require('./index-
|
|
1924
|
+
const internalSchema = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.SEEDPROTOCOL_Seed_Protocol_v1; });
|
|
2501
1925
|
finalSchema = internalSchema.default;
|
|
2502
1926
|
const db = main_cjs.BaseDb.getAppDb();
|
|
2503
1927
|
if (db && finalSchema.id) {
|
|
@@ -2965,7 +2389,7 @@ const createModelInstances = xstate.fromCallback(({ sendBack, input }) => {
|
|
|
2965
2389
|
return;
|
|
2966
2390
|
}
|
|
2967
2391
|
try {
|
|
2968
|
-
const modelMod = await Promise.resolve().then(function () { return require('./index-
|
|
2392
|
+
const modelMod = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.Model$1; });
|
|
2969
2393
|
const { Model } = modelMod;
|
|
2970
2394
|
// Create instances for all model IDs in parallel
|
|
2971
2395
|
// Model.createById() will check cache first, then query DB and create if needed
|
|
@@ -3051,7 +2475,7 @@ const verifyModelInstancesInCache = xstate.fromCallback(({ sendBack, input }) =>
|
|
|
3051
2475
|
}
|
|
3052
2476
|
try {
|
|
3053
2477
|
const result = await verifyWithRetry$2(async () => {
|
|
3054
|
-
const modelMod = await Promise.resolve().then(function () { return require('./index-
|
|
2478
|
+
const modelMod = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.Model$1; });
|
|
3055
2479
|
const { Model } = modelMod;
|
|
3056
2480
|
// Check each model ID in the cache
|
|
3057
2481
|
const verifiedInstances = [];
|
|
@@ -3108,7 +2532,7 @@ const writePropertiesToDb = xstate.fromCallback(({ sendBack, input }) => {
|
|
|
3108
2532
|
const _write = async () => {
|
|
3109
2533
|
const { modelIds } = input;
|
|
3110
2534
|
try {
|
|
3111
|
-
const modelSchemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
2535
|
+
const modelSchemaMod = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.ModelSchema; });
|
|
3112
2536
|
const { models: modelsTable, properties: propertiesTable } = modelSchemaMod;
|
|
3113
2537
|
const drizzleMod = await import('drizzle-orm');
|
|
3114
2538
|
const { eq } = drizzleMod;
|
|
@@ -3296,9 +2720,9 @@ const createPropertyInstances = xstate.fromCallback(({ sendBack, input }) => {
|
|
|
3296
2720
|
return;
|
|
3297
2721
|
}
|
|
3298
2722
|
try {
|
|
3299
|
-
const modProp = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
2723
|
+
const modProp = await Promise.resolve().then(function () { return require('./ModelProperty-BEsIHAjk.js'); });
|
|
3300
2724
|
const ModelProperty = modProp?.ModelProperty ?? modProp?.default;
|
|
3301
|
-
const modModel = await Promise.resolve().then(function () { return require('./index-
|
|
2725
|
+
const modModel = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.Model$1; });
|
|
3302
2726
|
const Model = modModel?.Model ?? modModel?.default;
|
|
3303
2727
|
if (!ModelProperty || !Model) {
|
|
3304
2728
|
logger$3('ModelProperty or Model not available from dynamic import');
|
|
@@ -3403,7 +2827,7 @@ const verifyPropertyInstancesInCache = xstate.fromCallback(({ sendBack, input })
|
|
|
3403
2827
|
}
|
|
3404
2828
|
try {
|
|
3405
2829
|
const result = await verifyWithRetry(async () => {
|
|
3406
|
-
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
2830
|
+
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-BEsIHAjk.js'); });
|
|
3407
2831
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
3408
2832
|
if (!ModelProperty) {
|
|
3409
2833
|
throw new Error('ModelProperty not available from dynamic import');
|
|
@@ -3463,7 +2887,6 @@ const schemaMachine = xstate.setup({
|
|
|
3463
2887
|
actors: {
|
|
3464
2888
|
loadOrCreateSchema,
|
|
3465
2889
|
validateSchema,
|
|
3466
|
-
addModelsMachine,
|
|
3467
2890
|
writeProcessMachine: main_cjs.writeProcessMachine,
|
|
3468
2891
|
// Staged loading actors
|
|
3469
2892
|
checkExistingSchema,
|
|
@@ -3482,9 +2905,6 @@ const schemaMachine = xstate.setup({
|
|
|
3482
2905
|
isSchemaValid: ({ context }) => {
|
|
3483
2906
|
return !context._validationErrors || context._validationErrors.length === 0;
|
|
3484
2907
|
},
|
|
3485
|
-
hasValidationErrors: ({ context }) => {
|
|
3486
|
-
return !!context._validationErrors && context._validationErrors.length > 0;
|
|
3487
|
-
},
|
|
3488
2908
|
},
|
|
3489
2909
|
}).createMachine({
|
|
3490
2910
|
id: 'schema',
|
|
@@ -3568,22 +2988,15 @@ const schemaMachine = xstate.setup({
|
|
|
3568
2988
|
}),
|
|
3569
2989
|
},
|
|
3570
2990
|
destroyStarted: {
|
|
3571
|
-
actions: xstate.assign({
|
|
3572
|
-
},
|
|
3573
|
-
destroyDone: {
|
|
3574
|
-
actions: xstate.assign({ _destroyInProgress: false }),
|
|
2991
|
+
actions: xstate.assign({ _destroyError: null }),
|
|
3575
2992
|
},
|
|
3576
2993
|
destroyError: {
|
|
3577
2994
|
actions: xstate.assign(({ event }) => ({
|
|
3578
|
-
_destroyInProgress: false,
|
|
3579
2995
|
_destroyError: event.error instanceof Error
|
|
3580
2996
|
? { message: event.error.message, name: event.error.name }
|
|
3581
2997
|
: { message: String(event.error) },
|
|
3582
2998
|
})),
|
|
3583
2999
|
},
|
|
3584
|
-
clearDestroyError: {
|
|
3585
|
-
actions: xstate.assign({ _destroyError: null }),
|
|
3586
|
-
},
|
|
3587
3000
|
},
|
|
3588
3001
|
states: {
|
|
3589
3002
|
loading: {
|
|
@@ -3972,9 +3385,6 @@ const schemaMachine = xstate.setup({
|
|
|
3972
3385
|
},
|
|
3973
3386
|
}),
|
|
3974
3387
|
on: {
|
|
3975
|
-
addModels: {
|
|
3976
|
-
target: 'addingModels',
|
|
3977
|
-
},
|
|
3978
3388
|
validateSchema: {
|
|
3979
3389
|
target: 'validating',
|
|
3980
3390
|
},
|
|
@@ -3992,122 +3402,27 @@ const schemaMachine = xstate.setup({
|
|
|
3992
3402
|
},
|
|
3993
3403
|
},
|
|
3994
3404
|
},
|
|
3995
|
-
always:
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
},
|
|
3999
|
-
},
|
|
4000
|
-
addingModels: {
|
|
4001
|
-
entry: xstate.assign({
|
|
4002
|
-
// Move first pending item to current if not already set
|
|
4003
|
-
_pendingModelAdditions: ({ context, event }) => {
|
|
4004
|
-
const pending = context._pendingModelAdditions || [];
|
|
4005
|
-
// If event has models, it's a new request - add to queue if we're already processing
|
|
4006
|
-
if (event.models) {
|
|
4007
|
-
return [
|
|
4008
|
-
...pending,
|
|
4009
|
-
{
|
|
4010
|
-
models: event.models,
|
|
4011
|
-
timestamp: Date.now(),
|
|
4012
|
-
},
|
|
4013
|
-
];
|
|
4014
|
-
}
|
|
4015
|
-
return pending;
|
|
4016
|
-
},
|
|
4017
|
-
}),
|
|
4018
|
-
invoke: {
|
|
4019
|
-
src: 'addModelsMachine',
|
|
4020
|
-
input: ({ context }) => {
|
|
4021
|
-
// Get models from first item in pending queue, or from context if queue is empty
|
|
4022
|
-
const pending = context._pendingModelAdditions || [];
|
|
4023
|
-
const models = pending.length > 0 ? pending[0].models : {};
|
|
4024
|
-
return {
|
|
4025
|
-
schemaContext: context,
|
|
4026
|
-
models,
|
|
4027
|
-
existingModels: context.models || {},
|
|
4028
|
-
};
|
|
4029
|
-
},
|
|
4030
|
-
onDone: {
|
|
4031
|
-
actions: [
|
|
4032
|
-
xstate.assign({
|
|
4033
|
-
models: ({ context, event }) => {
|
|
4034
|
-
const addedModels = event.output?.addedModels || {};
|
|
4035
|
-
return {
|
|
4036
|
-
...(context.models || {}),
|
|
4037
|
-
...addedModels,
|
|
4038
|
-
};
|
|
4039
|
-
},
|
|
4040
|
-
_pendingModelAdditions: ({ context }) => {
|
|
4041
|
-
// Remove first item from queue (the one we just processed)
|
|
4042
|
-
const pending = context._pendingModelAdditions || [];
|
|
4043
|
-
return pending.length > 1 ? pending.slice(1) : undefined;
|
|
4044
|
-
},
|
|
4045
|
-
}),
|
|
4046
|
-
// Trigger validation after models are added
|
|
4047
|
-
({ self }) => {
|
|
4048
|
-
self.send({ type: 'validateSchema' });
|
|
4049
|
-
},
|
|
4050
|
-
],
|
|
4051
|
-
},
|
|
4052
|
-
onError: {
|
|
4053
|
-
actions: xstate.assign({
|
|
4054
|
-
_modelAdditionErrors: ({ context, event }) => {
|
|
4055
|
-
const existing = context._modelAdditionErrors || [];
|
|
4056
|
-
return [
|
|
4057
|
-
...existing,
|
|
4058
|
-
{
|
|
4059
|
-
error: event.error instanceof Error ? event.error : new Error(String(event.error)),
|
|
4060
|
-
timestamp: Date.now(),
|
|
4061
|
-
},
|
|
4062
|
-
];
|
|
4063
|
-
},
|
|
4064
|
-
_pendingModelAdditions: ({ context }) => {
|
|
4065
|
-
// Remove first item from queue even on error, so we can process next
|
|
4066
|
-
const pending = context._pendingModelAdditions || [];
|
|
4067
|
-
return pending.length > 1 ? pending.slice(1) : undefined;
|
|
4068
|
-
},
|
|
4069
|
-
}),
|
|
4070
|
-
},
|
|
4071
|
-
},
|
|
4072
|
-
on: {
|
|
4073
|
-
// Queue additional requests while processing
|
|
4074
|
-
addModels: {
|
|
4075
|
-
actions: xstate.assign({
|
|
4076
|
-
_pendingModelAdditions: ({ context, event }) => {
|
|
4077
|
-
const existing = context._pendingModelAdditions || [];
|
|
4078
|
-
return [
|
|
4079
|
-
...existing,
|
|
4080
|
-
{
|
|
4081
|
-
models: event.models,
|
|
4082
|
-
timestamp: Date.now(),
|
|
4083
|
-
},
|
|
4084
|
-
];
|
|
4085
|
-
},
|
|
4086
|
-
}),
|
|
4087
|
-
},
|
|
4088
|
-
},
|
|
4089
|
-
always: [
|
|
4090
|
-
{
|
|
4091
|
-
// If there are pending additions after processing, process next one
|
|
4092
|
-
guard: ({ context }) => {
|
|
4093
|
-
const pending = context._pendingModelAdditions || [];
|
|
4094
|
-
return pending.length > 0;
|
|
4095
|
-
},
|
|
4096
|
-
target: 'addingModels',
|
|
4097
|
-
},
|
|
4098
|
-
{
|
|
4099
|
-
// No more pending, return to idle
|
|
4100
|
-
target: 'idle',
|
|
4101
|
-
},
|
|
4102
|
-
],
|
|
3405
|
+
// No `always: hasValidationErrors -> validating` here: validation is re-run when the context changes
|
|
3406
|
+
// (updateContext) or on request (validateSchema). Re-entering while errors exist would loop
|
|
3407
|
+
// forever on a schema that is still invalid.
|
|
4103
3408
|
},
|
|
4104
3409
|
validating: {
|
|
4105
3410
|
on: {
|
|
3411
|
+
// These state-level handlers take precedence over the root ones, so they must store the result
|
|
3412
|
+
// themselves.
|
|
4106
3413
|
validationSuccess: {
|
|
4107
3414
|
target: 'idle',
|
|
3415
|
+
actions: xstate.assign(({ context }) => ({
|
|
3416
|
+
...context,
|
|
3417
|
+
_validationErrors: [],
|
|
3418
|
+
})),
|
|
4108
3419
|
},
|
|
4109
3420
|
validationError: {
|
|
4110
3421
|
target: 'idle',
|
|
3422
|
+
actions: xstate.assign(({ context, event }) => ({
|
|
3423
|
+
...context,
|
|
3424
|
+
_validationErrors: event.errors,
|
|
3425
|
+
})),
|
|
4111
3426
|
},
|
|
4112
3427
|
},
|
|
4113
3428
|
invoke: {
|
|
@@ -4248,7 +3563,6 @@ class Schema {
|
|
|
4248
3563
|
// Initialize instance state in WeakMap (only non-serializable resources)
|
|
4249
3564
|
schemaInstanceState.set(this, {
|
|
4250
3565
|
liveQuerySubscription: null,
|
|
4251
|
-
modelInstances: new Map(),
|
|
4252
3566
|
});
|
|
4253
3567
|
// Set up liveQuery subscription for cross-instance model updates
|
|
4254
3568
|
// This will be initialized once we have the schemaId
|
|
@@ -4458,118 +3772,10 @@ class Schema {
|
|
|
4458
3772
|
}
|
|
4459
3773
|
}
|
|
4460
3774
|
else if (prop === 'models') {
|
|
4461
|
-
// Models are read-only computed
|
|
4462
|
-
//
|
|
4463
|
-
throw new Error('Cannot set schema.models directly. Models are computed from Model instances
|
|
4464
|
-
|
|
4465
|
-
// Convert array of Model instances or plain objects back to object format
|
|
4466
|
-
let modelsObject: { [key: string]: any }
|
|
4467
|
-
if (Array.isArray(value)) {
|
|
4468
|
-
modelsObject = {}
|
|
4469
|
-
const seenNames = new Set<string>()
|
|
4470
|
-
|
|
4471
|
-
// Check for duplicate model names
|
|
4472
|
-
for (const model of value) {
|
|
4473
|
-
// Handle Model instances
|
|
4474
|
-
if (model instanceof Model) {
|
|
4475
|
-
const modelName = model.modelName!
|
|
4476
|
-
if (seenNames.has(modelName)) {
|
|
4477
|
-
throw new Error(
|
|
4478
|
-
`Duplicate model name detected: "${modelName}". Each model must have a unique name.`
|
|
4479
|
-
)
|
|
4480
|
-
}
|
|
4481
|
-
seenNames.add(modelName)
|
|
4482
|
-
modelsObject[modelName] = {
|
|
4483
|
-
properties: model.properties || {},
|
|
4484
|
-
}
|
|
4485
|
-
} else if (model && typeof model === 'object' && 'name' in model) {
|
|
4486
|
-
// Handle plain objects
|
|
4487
|
-
const modelName = model.name as string
|
|
4488
|
-
if (seenNames.has(modelName)) {
|
|
4489
|
-
throw new Error(
|
|
4490
|
-
`Duplicate model name detected: "${modelName}". Each model must have a unique name.`
|
|
4491
|
-
)
|
|
4492
|
-
}
|
|
4493
|
-
seenNames.add(modelName)
|
|
4494
|
-
const { name, ...modelData } = model
|
|
4495
|
-
modelsObject[name] = modelData
|
|
4496
|
-
}
|
|
4497
|
-
}
|
|
4498
|
-
} else {
|
|
4499
|
-
modelsObject = value || {}
|
|
4500
|
-
// Check for duplicates in object format too
|
|
4501
|
-
const modelNames = Object.keys(modelsObject)
|
|
4502
|
-
const seenNames = new Set<string>()
|
|
4503
|
-
for (const modelName of modelNames) {
|
|
4504
|
-
if (seenNames.has(modelName)) {
|
|
4505
|
-
throw new Error(
|
|
4506
|
-
`Duplicate model name detected: "${modelName}". Each model must have a unique name.`
|
|
4507
|
-
)
|
|
4508
|
-
}
|
|
4509
|
-
seenNames.add(modelName)
|
|
4510
|
-
}
|
|
4511
|
-
}
|
|
4512
|
-
|
|
4513
|
-
const context = newInstance._getSnapshotContext()
|
|
4514
|
-
|
|
4515
|
-
// Check if service is still running before sending events
|
|
4516
|
-
let snapshot = newInstance._service.getSnapshot()
|
|
4517
|
-
const wasServiceStopped = snapshot.status === 'stopped'
|
|
4518
|
-
|
|
4519
|
-
if (wasServiceStopped) {
|
|
4520
|
-
logger(`Service is stopped, will restart before adding models`)
|
|
4521
|
-
newInstance._service.start()
|
|
4522
|
-
snapshot = newInstance._service.getSnapshot()
|
|
4523
|
-
}
|
|
4524
|
-
|
|
4525
|
-
// Check current state after potential restart
|
|
4526
|
-
const currentState = snapshot.value
|
|
4527
|
-
// Check if state is a loading state object (XState v5 nested states)
|
|
4528
|
-
const isServiceLoading = typeof currentState === 'object' && 'loading' in currentState
|
|
4529
|
-
|
|
4530
|
-
// If service is loading, wait for it to finish before adding models
|
|
4531
|
-
if (isServiceLoading || wasServiceStopped) {
|
|
4532
|
-
logger(`Service is ${isServiceLoading ? 'loading' : 'was stopped'}, will add models after loading completes`)
|
|
4533
|
-
|
|
4534
|
-
const loadingSubscription = newInstance._service.subscribe((snapshot) => {
|
|
4535
|
-
if (snapshot.value === 'idle') {
|
|
4536
|
-
loadingSubscription.unsubscribe()
|
|
4537
|
-
logger(`Service finished loading, sending addModels event`)
|
|
4538
|
-
newInstance._service.send({
|
|
4539
|
-
type: 'addModels',
|
|
4540
|
-
models: modelsObject,
|
|
4541
|
-
})
|
|
4542
|
-
} else if (snapshot.value === 'error') {
|
|
4543
|
-
loadingSubscription.unsubscribe()
|
|
4544
|
-
logger(`Service failed to load, cannot add models`)
|
|
4545
|
-
}
|
|
4546
|
-
})
|
|
4547
|
-
} else {
|
|
4548
|
-
// Service is ready, send addModels event immediately
|
|
4549
|
-
// The state machine will handle all the complexity (validation, instance creation, ID collection, persistence)
|
|
4550
|
-
logger(`Service is ready, sending addModels event`)
|
|
4551
|
-
newInstance._service.send({
|
|
4552
|
-
type: 'addModels',
|
|
4553
|
-
models: modelsObject,
|
|
4554
|
-
})
|
|
4555
|
-
}
|
|
4556
|
-
|
|
4557
|
-
// Mark schema as draft when models change
|
|
4558
|
-
newInstance._service.send({
|
|
4559
|
-
type: 'markAsDraft',
|
|
4560
|
-
propertyKey: 'schema:models',
|
|
4561
|
-
})
|
|
4562
|
-
|
|
4563
|
-
// Save draft to database immediately so changes persist
|
|
4564
|
-
newInstance._saveDraftToDb().catch((error) => {
|
|
4565
|
-
logger(`Failed to save draft to database: ${error instanceof Error ? error.message : String(error)}`)
|
|
4566
|
-
})
|
|
4567
|
-
|
|
4568
|
-
// Update client context so useSchema and useSchemas hooks reflect the change
|
|
4569
|
-
newInstance._updateClientContext().catch(() => {
|
|
4570
|
-
// Silently fail if not in browser environment
|
|
4571
|
-
})
|
|
4572
|
-
*/
|
|
3775
|
+
// Models are read-only, computed from Model instances. Array assignment was removed because
|
|
3776
|
+
// the draft save could run before the new Model instances existed, losing them.
|
|
3777
|
+
throw new Error('Cannot set schema.models directly. Models are computed from Model instances; ' +
|
|
3778
|
+
'use Model.create(modelName, schema, { properties }) to add one.');
|
|
4573
3779
|
}
|
|
4574
3780
|
else if (prop === 'createdAt' || prop === 'updatedAt') {
|
|
4575
3781
|
// Update metadata object
|
|
@@ -4620,7 +3826,12 @@ class Schema {
|
|
|
4620
3826
|
return schema;
|
|
4621
3827
|
const readyPromise = main_cjs.waitForEntityIdle(schema, { timeout: readyTimeout }).then(() => schema);
|
|
4622
3828
|
this.pendingSchemaByName.set(schemaName, readyPromise);
|
|
4623
|
-
|
|
3829
|
+
// Clear on both outcomes without a .finally() chain: that derived promise would reject unhandled
|
|
3830
|
+
// whenever readyPromise does, even when the caller handles the rejection.
|
|
3831
|
+
const clearPending = () => {
|
|
3832
|
+
this.pendingSchemaByName.delete(schemaName);
|
|
3833
|
+
};
|
|
3834
|
+
readyPromise.then(clearPending, clearPending);
|
|
4624
3835
|
return readyPromise;
|
|
4625
3836
|
}
|
|
4626
3837
|
/**
|
|
@@ -5181,13 +4392,19 @@ class Schema {
|
|
|
5181
4392
|
_dbVersion: publishedSchema.version,
|
|
5182
4393
|
});
|
|
5183
4394
|
// Clear edited flags on all ModelProperty instances and in database
|
|
5184
|
-
const modelPropertyMod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
4395
|
+
const modelPropertyMod = await Promise.resolve().then(function () { return require('./ModelProperty-BEsIHAjk.js'); });
|
|
5185
4396
|
const { ModelProperty } = modelPropertyMod;
|
|
5186
4397
|
for (const propertyKey of context._editedProperties) {
|
|
5187
4398
|
const [modelName, propertyName] = propertyKey.split(':');
|
|
5188
|
-
const cacheKey = `${modelName}:${propertyName}`;
|
|
5189
4399
|
const ModelPropertyClass = ModelProperty;
|
|
5190
|
-
|
|
4400
|
+
// Model names are only unique per schema: pick this schema's instance, which may be keyed by id.
|
|
4401
|
+
const thisSchemaName = this.schemaName;
|
|
4402
|
+
const cachedInstance = [...ModelPropertyClass.instanceCache.values()].find(({ instance }) => {
|
|
4403
|
+
const ctx = instance.getService().getSnapshot().context;
|
|
4404
|
+
return (ctx.modelName === modelName &&
|
|
4405
|
+
ctx.name === propertyName &&
|
|
4406
|
+
(!ctx._schemaName || ctx._schemaName === thisSchemaName));
|
|
4407
|
+
});
|
|
5191
4408
|
if (cachedInstance) {
|
|
5192
4409
|
const modelProperty = cachedInstance.instance;
|
|
5193
4410
|
modelProperty.getService().getSnapshot().context;
|
|
@@ -5198,12 +4415,10 @@ class Schema {
|
|
|
5198
4415
|
// Clear isEdited flag in database
|
|
5199
4416
|
try {
|
|
5200
4417
|
if (db && modelName && propertyName) {
|
|
5201
|
-
// Find model by name
|
|
5202
|
-
const
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
.where(drizzleOrm.eq(main_cjs.models.name, modelName))
|
|
5206
|
-
.limit(1);
|
|
4418
|
+
// Find this schema's model by name
|
|
4419
|
+
const { resolveModelRecord } = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.resolveModelRecord$1; });
|
|
4420
|
+
const modelRecord = await resolveModelRecord(modelName, { schemaName: thisSchemaName }, db);
|
|
4421
|
+
const modelRecords = modelRecord ? [modelRecord] : [];
|
|
5207
4422
|
if (modelRecords.length > 0) {
|
|
5208
4423
|
// Find property by name and modelId
|
|
5209
4424
|
const propertyRecords = await db
|
|
@@ -5765,6 +4980,16 @@ class Schema {
|
|
|
5765
4980
|
Schema.instanceCacheByName,
|
|
5766
4981
|
],
|
|
5767
4982
|
});
|
|
4983
|
+
// The rows for this schema's models and properties are deleted below; evict their cached
|
|
4984
|
+
// instances too, or a re-import would get them back with dangling _dbIds.
|
|
4985
|
+
if (schemaName) {
|
|
4986
|
+
const evictedModelNames = main_cjs.Model.evictForSchema(schemaName);
|
|
4987
|
+
const { ModelProperty } = await Promise.resolve().then(function () { return require('./ModelProperty-BEsIHAjk.js'); });
|
|
4988
|
+
ModelProperty.evictForModels(evictedModelNames, schemaName);
|
|
4989
|
+
// Evicting stops new writes but not ones already running; let those land before deleting their rows
|
|
4990
|
+
const { waitForInFlightWrites } = await Promise.resolve().then(function () { return require('./index-C66AfYDG.js'); }).then(function (n) { return n.writeToDatabase; });
|
|
4991
|
+
await waitForInFlightWrites();
|
|
4992
|
+
}
|
|
5768
4993
|
await main_cjs.runDestroyLifecycle(this, {
|
|
5769
4994
|
getService: (instance) => instance._service,
|
|
5770
4995
|
doDestroy: async () => {
|
|
@@ -5977,12 +5202,6 @@ Schema.pendingSchemaByName = new Map();
|
|
|
5977
5202
|
// Track which schemas are currently being saved to prevent concurrent saves
|
|
5978
5203
|
Schema.savingSchemas = new Set();
|
|
5979
5204
|
|
|
5980
|
-
var Schema$1 = /*#__PURE__*/Object.freeze({
|
|
5981
|
-
__proto__: null,
|
|
5982
|
-
Schema: Schema,
|
|
5983
|
-
schemaInstanceState: schemaInstanceState
|
|
5984
|
-
});
|
|
5985
|
-
|
|
5986
5205
|
exports.Schema = Schema;
|
|
5987
5206
|
exports.schemaInstanceState = schemaInstanceState;
|
|
5988
|
-
//# sourceMappingURL=Schema-
|
|
5207
|
+
//# sourceMappingURL=Schema-qEp5mH1N.js.map
|