@seedprotocol/sdk 0.6.10 → 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,30 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as normalizeDataType, M as ModelPropertyDataTypes, r as resolveModelRecord, m as getItemModelScope } from './db-BJZN0a0a.js';
|
|
2
|
+
import { B as BaseDb, r as seeds, Z as ZERO_BYTES32, v as versions, p as properties, V as VERSION_SCHEMA_UID, m as models, h as htmlEmbeddedImageCoPublish, y as INTERNAL_PROPERTY_NAMES, z as defaultAttestationData, A as INTERNAL_DATA_TYPES } from './BasePathResolver-ndE8XTpw.js';
|
|
2
3
|
import { SchemaEncoder } from '@ethereum-attestation-service/eas-sdk';
|
|
3
|
-
import { r as resolveSeedIdsFromRefString, n as normalizeRelationPropertyValue, i as isPublishedSeedRef, g as getCorrectId, a as isStorageSeedRef, t as toSnakeCase$1 } from './
|
|
4
|
+
import { r as resolveSeedIdsFromRefString, n as normalizeRelationPropertyValue, i as isPublishedSeedRef, g as getCorrectId, a as isStorageSeedRef, t as toSnakeCase$1 } from './tabEvents-DYI2GU7i.js';
|
|
4
5
|
import { toSnakeCase } from 'drizzle-orm/casing';
|
|
5
|
-
import {
|
|
6
|
+
import { i as isVersionRevoked, f as getEasSchemaUidForModel, h as getLatestPublishedVersionRow, p as parseListPropertyValueFromStorage, l as listRelationEasPropertyName } from './Item-zBFWQDU9.js';
|
|
6
7
|
import { isValidEasAttestationUid, getEasSchemaUidForSchemaDefinition } from '@seedprotocol/eas';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import { eq, and, isNotNull, sql } from 'drizzle-orm';
|
|
9
|
+
import { g as getSegmentedItemProperties } from './getSegmentedItemProperties-C2EJ2G0N.js';
|
|
10
|
+
import { getPropertySchema } from './property-D2Nnsmm1.js';
|
|
9
11
|
import { modelPropertiesToObject } from './model-DGMe-TTm.js';
|
|
10
12
|
import { upperFirst, camelCase } from 'lodash-es';
|
|
11
|
-
import { eq, and, sql } from 'drizzle-orm';
|
|
12
13
|
import debug from 'debug';
|
|
13
14
|
import '@noble/hashes/sha3';
|
|
14
15
|
import '@noble/hashes/utils';
|
|
15
16
|
import 'reflect-metadata';
|
|
16
|
-
import './index-
|
|
17
|
-
import { M as ModelPropertyDataTypes, n as normalizeDataType } from './db-WbrzEf7c.js';
|
|
18
|
-
import 'drizzle-orm/sqlite-core';
|
|
19
|
-
import '@seedprotocol/arweave';
|
|
20
|
-
import 'xstate';
|
|
17
|
+
import './index-DtfjeuxC.js';
|
|
21
18
|
import 'pluralize';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* True when the item's seed attestation was revoked (`seeds.revoked_at` set, by unpublish or EAS
|
|
22
|
+
* sync). Such a seed can't take new versions: publishing again creates a new seed attestation
|
|
23
|
+
* (see "Republishing" in docs/ATTESTATION_REVOCATION.md).
|
|
24
|
+
*/
|
|
25
|
+
const isSeedRevoked = async (seedLocalId) => {
|
|
26
|
+
if (!seedLocalId)
|
|
27
|
+
return false;
|
|
28
|
+
const appDb = BaseDb.getAppDb();
|
|
29
|
+
if (!appDb)
|
|
30
|
+
return false;
|
|
31
|
+
const [row] = await appDb
|
|
32
|
+
.select({ revokedAt: seeds.revokedAt })
|
|
33
|
+
.from(seeds)
|
|
34
|
+
.where(eq(seeds.localId, seedLocalId))
|
|
35
|
+
.limit(1);
|
|
36
|
+
return isVersionRevoked(row?.revokedAt);
|
|
37
|
+
};
|
|
28
38
|
|
|
29
39
|
/** UTF-8 string to 0x-prefixed bytes32 hex (right-padded with zeros). */
|
|
30
40
|
function encodeBytes32String(value) {
|
|
@@ -38,11 +48,155 @@ function encodeBytes32String(value) {
|
|
|
38
48
|
return `0x${hex.padEnd(64, '0')}`;
|
|
39
49
|
}
|
|
40
50
|
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
/** Error thrown when publish validation fails. Includes all validation errors for user to fix. */
|
|
52
|
+
class PublishValidationFailedError extends Error {
|
|
53
|
+
constructor(message, validationErrors) {
|
|
54
|
+
super(message);
|
|
55
|
+
this.validationErrors = validationErrors;
|
|
56
|
+
this.name = 'PublishValidationFailedError';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** Validation error code for a relation, list member or image/file ref to an unpublished seed. */
|
|
60
|
+
const RELATED_ITEM_UNPUBLISHED_CODE = 'related_item_unpublished';
|
|
61
|
+
const describeUnpublishedRelatedItem = (r) => `${r.propertyName} -> ${r.modelName} ${r.seedLocalId} (seed ${r.seedUid})`;
|
|
62
|
+
/**
|
|
63
|
+
* Thrown before anything is uploaded or attested when the item references items whose seed was
|
|
64
|
+
* unpublished: the parent would attest a revoked seed uid. Republish those items (which gives
|
|
65
|
+
* them a new seed uid) or remove the references, then publish again.
|
|
66
|
+
* See docs/ATTESTATION_REVOCATION.md ("Republishing").
|
|
67
|
+
*
|
|
68
|
+
* A PublishValidationFailedError, so validateItemForPublish and the publish package's checking
|
|
69
|
+
* step report it as validation errors (code `related_item_unpublished`, one per reference).
|
|
70
|
+
*/
|
|
71
|
+
class RelatedItemUnpublishedError extends PublishValidationFailedError {
|
|
72
|
+
constructor(unpublishedRelatedItems, otherValidationErrors = []) {
|
|
73
|
+
const lines = unpublishedRelatedItems.map(describeUnpublishedRelatedItem);
|
|
74
|
+
const message = `Cannot publish: it references ${lines.length} unpublished item${lines.length === 1 ? '' : 's'} ` +
|
|
75
|
+
`(their seed attestations were revoked). Republish them or remove the references, then publish again:\n` +
|
|
76
|
+
lines.join('\n');
|
|
77
|
+
super(message, [
|
|
78
|
+
...unpublishedRelatedItems.map((r) => ({
|
|
79
|
+
field: r.propertyName,
|
|
80
|
+
message: `${r.propertyName} references unpublished ${r.modelName} ${r.seedLocalId} (seed ${r.seedUid}). ` +
|
|
81
|
+
`Republish it or remove the reference.`,
|
|
82
|
+
code: RELATED_ITEM_UNPUBLISHED_CODE,
|
|
83
|
+
})),
|
|
84
|
+
...otherValidationErrors,
|
|
85
|
+
]);
|
|
86
|
+
this.name = 'RelatedItemUnpublishedError';
|
|
87
|
+
this.unpublishedRelatedItems = unpublishedRelatedItems;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const selectSeed = {
|
|
92
|
+
seedLocalId: seeds.localId,
|
|
93
|
+
seedUid: seeds.uid,
|
|
94
|
+
revokedAt: seeds.revokedAt,
|
|
95
|
+
type: seeds.type,
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* The local seed row a relation/list/image ref points at, by local id or uid. A uid that is no
|
|
99
|
+
* seed's current uid can be the old uid of a seed that was unpublished and published again (a new
|
|
100
|
+
* seed attestation, same local seed): its old version rows still record it, so it resolves to that
|
|
101
|
+
* seed. Null when nothing local matches (e.g. a published uid with no local copy).
|
|
102
|
+
*/
|
|
103
|
+
const findRelatedSeedRow = async ({ seedLocalId, seedUid, }) => {
|
|
104
|
+
const appDb = BaseDb.getAppDb();
|
|
105
|
+
if (!appDb)
|
|
106
|
+
return null;
|
|
107
|
+
if (seedLocalId) {
|
|
108
|
+
const [row] = await appDb.select(selectSeed).from(seeds).where(eq(seeds.localId, seedLocalId)).limit(1);
|
|
109
|
+
if (row?.seedLocalId)
|
|
110
|
+
return row;
|
|
111
|
+
}
|
|
112
|
+
if (!seedUid || seedUid === ZERO_BYTES32)
|
|
113
|
+
return null;
|
|
114
|
+
const [byUid] = await appDb.select(selectSeed).from(seeds).where(eq(seeds.uid, seedUid)).limit(1);
|
|
115
|
+
if (byUid?.seedLocalId)
|
|
116
|
+
return byUid;
|
|
117
|
+
const [version] = await appDb
|
|
118
|
+
.select({ seedLocalId: versions.seedLocalId })
|
|
119
|
+
.from(versions)
|
|
120
|
+
.where(and(eq(versions.seedUid, seedUid), isNotNull(versions.seedLocalId)))
|
|
121
|
+
.limit(1);
|
|
122
|
+
if (!version?.seedLocalId)
|
|
123
|
+
return null;
|
|
124
|
+
const [republished] = await appDb
|
|
125
|
+
.select(selectSeed)
|
|
126
|
+
.from(seeds)
|
|
127
|
+
.where(eq(seeds.localId, version.seedLocalId))
|
|
128
|
+
.limit(1);
|
|
129
|
+
return republished?.seedLocalId ? republished : null;
|
|
130
|
+
};
|
|
131
|
+
/** The seed is attested and its attestation is live. */
|
|
132
|
+
const isLivePublishedSeed = (row) => !!row?.seedUid && row.seedUid !== ZERO_BYTES32 && !isVersionRevoked(row.revokedAt);
|
|
133
|
+
/** The seed was attested and that attestation was revoked (unpublished). */
|
|
134
|
+
const isUnpublishedSeed = (row) => !!row?.seedUid && row.seedUid !== ZERO_BYTES32 && isVersionRevoked(row.revokedAt);
|
|
135
|
+
/** Model a relation/list/image property points at, from its definition. */
|
|
136
|
+
function relatedModelNameFromDef(propertyDef) {
|
|
137
|
+
const def = propertyDef;
|
|
138
|
+
if (!def)
|
|
139
|
+
return undefined;
|
|
140
|
+
const dataType = normalizeDataType(def.dataType);
|
|
141
|
+
if (dataType === ModelPropertyDataTypes.Image)
|
|
142
|
+
return 'Image';
|
|
143
|
+
if (dataType === ModelPropertyDataTypes.File)
|
|
144
|
+
return 'File';
|
|
145
|
+
if (dataType === ModelPropertyDataTypes.Html)
|
|
146
|
+
return 'Html';
|
|
147
|
+
return def.ref ?? def.refModelName;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Name of the item's Html property whose value is the Html seed `htmlSeedLocalId`: the property
|
|
151
|
+
* that refers to the images embedded in that Html (htmlEmbeddedImageCoPublish rows).
|
|
152
|
+
*/
|
|
153
|
+
function htmlPropertyNameForHtmlSeed(item, htmlSeedLocalId) {
|
|
154
|
+
const want = htmlSeedLocalId.trim();
|
|
155
|
+
for (const p of item.properties ?? []) {
|
|
156
|
+
if (normalizeDataType(p.propertyDef?.dataType) !== ModelPropertyDataTypes.Html)
|
|
157
|
+
continue;
|
|
158
|
+
const snap = p.getService().getSnapshot();
|
|
159
|
+
const value = 'context' in snap ? snap.context.propertyValue : undefined;
|
|
160
|
+
if (typeof value === 'string' && value.trim() === want)
|
|
161
|
+
return p.propertyName;
|
|
162
|
+
}
|
|
163
|
+
return 'html';
|
|
164
|
+
}
|
|
165
|
+
|
|
43
166
|
debug('seedSdk:db:getPublishPayload');
|
|
44
167
|
/** Case-insensitive dataType match (schema JSON may use "text" vs "Text"). */
|
|
45
168
|
const matchesDataType = (actual, expected) => normalizeDataType(actual) === expected;
|
|
169
|
+
/**
|
|
170
|
+
* Checks the seed a relation/list/image ref points at. A revoked (unpublished) seed is recorded in
|
|
171
|
+
* `ctx.unpublishedRelatedItems`; a live published one maps the ref to its current uid. Returns
|
|
172
|
+
* true when the caller must not walk into the related item (it is published, live or revoked).
|
|
173
|
+
*/
|
|
174
|
+
function noteRelatedSeed(ctx, ref, row, propertyName, modelName) {
|
|
175
|
+
if (isUnpublishedSeed(row)) {
|
|
176
|
+
ctx.unpublishedRelatedItems ?? (ctx.unpublishedRelatedItems = []);
|
|
177
|
+
if (!ctx.unpublishedRelatedItems.some((r) => r.propertyName === propertyName && r.seedLocalId === row.seedLocalId)) {
|
|
178
|
+
ctx.unpublishedRelatedItems.push({
|
|
179
|
+
propertyName,
|
|
180
|
+
modelName: modelName ?? row.type ?? 'unknown',
|
|
181
|
+
seedLocalId: row.seedLocalId,
|
|
182
|
+
seedUid: row.seedUid,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
if (isLivePublishedSeed(row)) {
|
|
188
|
+
if (ref !== row.seedUid) {
|
|
189
|
+
ctx.relatedRefUids ?? (ctx.relatedRefUids = new Map());
|
|
190
|
+
ctx.relatedRefUids.set(ref, row.seedUid);
|
|
191
|
+
}
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
/** Current uid for a ref noted by noteRelatedSeed, else the ref itself. */
|
|
197
|
+
function currentRelatedRef(ctx, ref) {
|
|
198
|
+
return ctx.relatedRefUids?.get(ref.trim()) ?? ref;
|
|
199
|
+
}
|
|
46
200
|
function addValidationError(ctx, message, field, code = 'publish_validation') {
|
|
47
201
|
// A property can be validated on more than one path (List of Relation: list + basic); report once.
|
|
48
202
|
if (ctx.errors.some((e) => e.message === message && e.field === (field ?? '')))
|
|
@@ -124,7 +278,7 @@ async function resolveVersionUid(seedLocalId, seedUid) {
|
|
|
124
278
|
if (published?.uid)
|
|
125
279
|
return published.uid;
|
|
126
280
|
try {
|
|
127
|
-
const { getItemVersionsFromEas } = await import('./eas-
|
|
281
|
+
const { getItemVersionsFromEas } = await import('./eas-B0hsMLqt.js');
|
|
128
282
|
const attestations = await getItemVersionsFromEas({ seedUids: [seedUid] });
|
|
129
283
|
const latest = attestations?.[0];
|
|
130
284
|
if (latest?.id)
|
|
@@ -184,17 +338,19 @@ const ensurePropertyDefs = async (targetItem) => {
|
|
|
184
338
|
(matchesDataType(p.propertyDef?.dataType, ModelPropertyDataTypes.Relation) &&
|
|
185
339
|
p.propertyDef?.required === undefined)));
|
|
186
340
|
let schema;
|
|
341
|
+
// Model names are only unique per schema: resolve definitions from this item's own model.
|
|
342
|
+
const targetScope = await getItemModelScope(targetItem);
|
|
187
343
|
for (const itemProperty of targetItem.properties) {
|
|
188
344
|
if (!itemProperty.propertyDef && targetItem.modelName) {
|
|
189
|
-
schema = await getPropertySchema(targetItem.modelName, itemProperty.propertyName);
|
|
345
|
+
schema = await getPropertySchema(targetItem.modelName, itemProperty.propertyName, targetScope);
|
|
190
346
|
if (!schema) {
|
|
191
347
|
try {
|
|
192
|
-
const _mod_0 = await import('./index-
|
|
193
|
-
const _ns_0 = _mod_0.
|
|
348
|
+
const _mod_0 = await import('./index-DtfjeuxC.js');
|
|
349
|
+
const _ns_0 = _mod_0.c;
|
|
194
350
|
const { Model } = _ns_0;
|
|
195
351
|
const normalizedModelName = upperFirst(camelCase(targetItem.modelName));
|
|
196
|
-
let model = Model.
|
|
197
|
-
if (!model?.properties?.length) {
|
|
352
|
+
let model = Model.resolve(normalizedModelName, targetScope);
|
|
353
|
+
if (!model?.properties?.length && !targetScope.modelFileId) {
|
|
198
354
|
model = Model.findByModelType(toSnakeCase(targetItem.modelName));
|
|
199
355
|
}
|
|
200
356
|
const modelFound = !!model;
|
|
@@ -215,11 +371,8 @@ const ensurePropertyDefs = async (targetItem) => {
|
|
|
215
371
|
if (db) {
|
|
216
372
|
try {
|
|
217
373
|
const normalizedModelName = upperFirst(camelCase(targetItem.modelName));
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
.from(models)
|
|
221
|
-
.where(eq(models.name, normalizedModelName))
|
|
222
|
-
.limit(1);
|
|
374
|
+
const modelRecord = await resolveModelRecord(normalizedModelName, targetScope, db);
|
|
375
|
+
const modelRecords = modelRecord ? [modelRecord] : [];
|
|
223
376
|
if (modelRecords.length > 0 && modelRecords[0].id) {
|
|
224
377
|
const propertyRecords = await db
|
|
225
378
|
.select()
|
|
@@ -350,13 +503,17 @@ const processBasicProperties = async (itemBasicProperties, itemPublishData, ctx,
|
|
|
350
503
|
.map((s) => s.trim())
|
|
351
504
|
.filter(Boolean);
|
|
352
505
|
}
|
|
506
|
+
// A ref to a published related item attests that item's current uid.
|
|
507
|
+
if (typeof value === 'string' && (isRelation || isFileImageHtml || isJsonStorage)) {
|
|
508
|
+
value = currentRelatedRef(ctx, value);
|
|
509
|
+
}
|
|
353
510
|
if (schemaDef.startsWith('bytes32[]') && !Array.isArray(value)) {
|
|
354
511
|
addValidationError(ctx, `Invalid value for property: ${basicProperty.propertyName}. Expected an array of bytes32, got ${value}.`, basicProperty.propertyName);
|
|
355
512
|
continue;
|
|
356
513
|
}
|
|
357
514
|
// Validate against property validation rules (enum, pattern, minLength, maxLength) before encoding
|
|
358
515
|
if (propertyDef?.validation) {
|
|
359
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
516
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-DDKr5piy.js');
|
|
360
517
|
const validationService = new SchemaValidationService();
|
|
361
518
|
const validationResult = validationService.validatePropertyValue(value, normalizeDataType(propertyDef.dataType), propertyDef.validation, propertyDef.refValueType
|
|
362
519
|
? normalizeDataType(propertyDef.refValueType)
|
|
@@ -387,7 +544,7 @@ const processBasicProperties = async (itemBasicProperties, itemPublishData, ctx,
|
|
|
387
544
|
: '';
|
|
388
545
|
if (!idStr)
|
|
389
546
|
continue;
|
|
390
|
-
const trimmed = idStr.trim();
|
|
547
|
+
const trimmed = currentRelatedRef(ctx, idStr.trim());
|
|
391
548
|
if (!trimmed)
|
|
392
549
|
continue;
|
|
393
550
|
rawIds.push(trimmed);
|
|
@@ -496,8 +653,8 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
496
653
|
matchesDataType(relationOrImageProperty.propertyDef?.refValueType, ModelPropertyDataTypes.Html) ||
|
|
497
654
|
matchesDataType(relationOrImageProperty.propertyDef?.refValueType, ModelPropertyDataTypes.Json)));
|
|
498
655
|
if (isStorageSeed && (context.seedLocalId || context.seedUid)) {
|
|
499
|
-
const _mod_1 = await import('./
|
|
500
|
-
const _ns_1 = _mod_1.
|
|
656
|
+
const _mod_1 = await import('./Item-zBFWQDU9.js');
|
|
657
|
+
const _ns_1 = _mod_1.Y;
|
|
501
658
|
const { getPropertyData: getPropertyDataFromDb } = _ns_1;
|
|
502
659
|
const metaRow = await getPropertyDataFromDb({
|
|
503
660
|
propertyName: relationOrImageProperty.propertyName,
|
|
@@ -520,14 +677,12 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
520
677
|
let isRequired = propertyDef?.required === true;
|
|
521
678
|
// Resolve required from schema/DB when propertyDef lacks it
|
|
522
679
|
if (!isRequired && relationOrImageProperty.modelName) {
|
|
523
|
-
|
|
680
|
+
const propertyScope = await getItemModelScope(relationOrImageProperty);
|
|
681
|
+
let schema = await getPropertySchema(relationOrImageProperty.modelName, relationOrImageProperty.propertyName, propertyScope);
|
|
524
682
|
if (!schema && BaseDb.getAppDb()) {
|
|
525
683
|
const normalizedModelName = upperFirst(camelCase(relationOrImageProperty.modelName));
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
.from(models)
|
|
529
|
-
.where(eq(models.name, normalizedModelName))
|
|
530
|
-
.limit(1);
|
|
684
|
+
const modelRecord = await resolveModelRecord(normalizedModelName, propertyScope);
|
|
685
|
+
const modelRecords = modelRecord ? [modelRecord] : [];
|
|
531
686
|
if (modelRecords.length > 0 && modelRecords[0].id) {
|
|
532
687
|
const propertyRecords = await BaseDb.getAppDb()
|
|
533
688
|
.select()
|
|
@@ -583,13 +738,15 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
583
738
|
}
|
|
584
739
|
return multiPublishPayload;
|
|
585
740
|
}
|
|
741
|
+
// The local seed, also when the ref is the old uid of a seed published again since.
|
|
742
|
+
const relatedSeed = await findRelatedSeedRow({ seedLocalId, seedUid });
|
|
586
743
|
// Use dynamic import to break circular dependency
|
|
587
|
-
const getItemMod = await import('./getItem-
|
|
744
|
+
const getItemMod = await import('./getItem-DEh4WfHG.js');
|
|
588
745
|
const { getItem } = getItemMod;
|
|
589
|
-
const relatedItem = await getItem({
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
746
|
+
const relatedItem = await getItem(relatedSeed ? { seedLocalId: relatedSeed.seedLocalId } : { seedLocalId, seedUid });
|
|
747
|
+
if (noteRelatedSeed(ctx, normalizedRef, relatedSeed, relationOrImageProperty.propertyName, relatedItem?.modelName ?? relatedModelNameFromDef(relationOrImageProperty.propertyDef))) {
|
|
748
|
+
return multiPublishPayload;
|
|
749
|
+
}
|
|
593
750
|
// When related item not found (e.g. different DB, not yet created)
|
|
594
751
|
if (!relatedItem) {
|
|
595
752
|
// An attested uid with no local copy is already published; the parent attests the uid as-is.
|
|
@@ -647,7 +804,12 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
647
804
|
],
|
|
648
805
|
};
|
|
649
806
|
await ensurePropertyDefs(relatedItem);
|
|
650
|
-
const { itemBasicProperties, itemUploadProperties } = await getSegmentedItemProperties(relatedItem);
|
|
807
|
+
const { itemBasicProperties, itemUploadProperties, itemImageProperties: relatedStorageSeedProperties } = await getSegmentedItemProperties(relatedItem);
|
|
808
|
+
// A draft item related to the published one is published with it, including its own
|
|
809
|
+
// Image/File/Html/Json properties and the images embedded in its Html (as for the item itself).
|
|
810
|
+
if (!isStorageSeed) {
|
|
811
|
+
multiPublishPayload = await processRelatedDraftStorageSeeds(relatedItem, relatedStorageSeedProperties, itemBasicProperties, multiPublishPayload, uploadedTransactions, ctx, buildOpts);
|
|
812
|
+
}
|
|
651
813
|
const relatedStorageUpload = resolveStorageTransactionUploadSlot(relatedItem, itemUploadProperties);
|
|
652
814
|
if (relatedStorageUpload) {
|
|
653
815
|
const transactionData = findUploadedTxForSeedLocalId(uploadedTransactions, relatedItem.seedLocalId);
|
|
@@ -667,7 +829,7 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
667
829
|
if (isStorageTransactionPropertyName(p.propertyName) &&
|
|
668
830
|
!p.propertyDef &&
|
|
669
831
|
relatedItem.modelName) {
|
|
670
|
-
const schema = await getPropertySchema(relatedItem.modelName, 'storageTransactionId');
|
|
832
|
+
const schema = await getPropertySchema(relatedItem.modelName, 'storageTransactionId', await getItemModelScope(relatedItem));
|
|
671
833
|
if (schema) {
|
|
672
834
|
p.getService().send({ type: 'updateContext', propertyRecordSchema: schema });
|
|
673
835
|
}
|
|
@@ -680,6 +842,19 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
680
842
|
multiPublishPayload.push(publishPayload);
|
|
681
843
|
return multiPublishPayload;
|
|
682
844
|
};
|
|
845
|
+
/**
|
|
846
|
+
* Storage-seed properties (Image/File/Html/Json) of a draft item related to the published one, and
|
|
847
|
+
* the images embedded in its Html (htmlEmbeddedImageCoPublish rows it owns): payloads for their seeds,
|
|
848
|
+
* and the properties added to `itemBasicProperties` so the related item attests them. Same handling
|
|
849
|
+
* as the published item's own (see getPublishPayload).
|
|
850
|
+
*/
|
|
851
|
+
async function processRelatedDraftStorageSeeds(relatedItem, storageSeedProperties, itemBasicProperties, multiPublishPayload, uploadedTransactions, ctx, buildOpts) {
|
|
852
|
+
for (const storageSeedProperty of storageSeedProperties) {
|
|
853
|
+
multiPublishPayload = await processRelationOrImageProperty(storageSeedProperty, multiPublishPayload, uploadedTransactions, relatedItem.seedLocalId, ctx, buildOpts);
|
|
854
|
+
itemBasicProperties.push(storageSeedProperty);
|
|
855
|
+
}
|
|
856
|
+
return processHtmlEmbeddedCoPublishImagePayloads(relatedItem, multiPublishPayload, uploadedTransactions, relatedItem.seedLocalId, ctx, buildOpts);
|
|
857
|
+
}
|
|
683
858
|
async function resolveHtmlPropertySchemaUidByHtmlSeed(item, htmlSeedLocalId, ctx) {
|
|
684
859
|
const want = htmlSeedLocalId.trim();
|
|
685
860
|
for (const p of item.properties) {
|
|
@@ -711,13 +886,19 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
|
|
|
711
886
|
if (rows.length === 0)
|
|
712
887
|
return multiPublishPayload;
|
|
713
888
|
const forceFullSnapshot = buildOpts?.forceFullSnapshot === true;
|
|
714
|
-
const getItemMod = await import('./getItem-
|
|
889
|
+
const getItemMod = await import('./getItem-DEh4WfHG.js');
|
|
715
890
|
const { getItem } = getItemMod;
|
|
716
891
|
const doneImages = new Set();
|
|
717
892
|
for (const row of rows) {
|
|
718
893
|
if (doneImages.has(row.imageSeedLocalId))
|
|
719
894
|
continue;
|
|
720
895
|
doneImages.add(row.imageSeedLocalId);
|
|
896
|
+
// An embedded image that is already published is not co-published; one whose seed was revoked
|
|
897
|
+
// (unpublished) blocks the publish like an image property pointing at it would.
|
|
898
|
+
const imageSeed = await findRelatedSeedRow({ seedLocalId: row.imageSeedLocalId });
|
|
899
|
+
if (noteRelatedSeed(ctx, row.imageSeedLocalId, imageSeed, htmlPropertyNameForHtmlSeed(item, row.htmlSeedLocalId), 'Image')) {
|
|
900
|
+
continue;
|
|
901
|
+
}
|
|
721
902
|
const htmlSchemaUid = await resolveHtmlPropertySchemaUidByHtmlSeed(item, row.htmlSeedLocalId, ctx);
|
|
722
903
|
if (!htmlSchemaUid)
|
|
723
904
|
continue;
|
|
@@ -772,7 +953,7 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
|
|
|
772
953
|
if (isStorageTransactionPropertyName(p.propertyName) &&
|
|
773
954
|
!p.propertyDef &&
|
|
774
955
|
relatedItem.modelName) {
|
|
775
|
-
const schema = await getPropertySchema(relatedItem.modelName, 'storageTransactionId');
|
|
956
|
+
const schema = await getPropertySchema(relatedItem.modelName, 'storageTransactionId', await getItemModelScope(relatedItem));
|
|
776
957
|
if (schema) {
|
|
777
958
|
p.getService().send({ type: 'updateContext', propertyRecordSchema: schema });
|
|
778
959
|
}
|
|
@@ -830,13 +1011,14 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
|
|
|
830
1011
|
const { localId: seedLocalId, uid: seedUid } = getCorrectId(idStr);
|
|
831
1012
|
if (!seedLocalId && !seedUid)
|
|
832
1013
|
continue;
|
|
1014
|
+
const relatedSeed = await findRelatedSeedRow({ seedLocalId, seedUid });
|
|
833
1015
|
// Use dynamic import to break circular dependency
|
|
834
|
-
const getItemMod = await import('./getItem-
|
|
1016
|
+
const getItemMod = await import('./getItem-DEh4WfHG.js');
|
|
835
1017
|
const { getItem } = getItemMod;
|
|
836
|
-
const relatedItem = await getItem({
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
}
|
|
1018
|
+
const relatedItem = await getItem(relatedSeed ? { seedLocalId: relatedSeed.seedLocalId } : { seedLocalId, seedUid });
|
|
1019
|
+
if (noteRelatedSeed(ctx, idStr.trim(), relatedSeed, listProperty.propertyName, relatedItem?.modelName ?? relatedModelNameFromDef(listProperty.propertyDef))) {
|
|
1020
|
+
continue;
|
|
1021
|
+
}
|
|
840
1022
|
if (!relatedItem) {
|
|
841
1023
|
// An attested uid with no local copy is already published; the list attests the uid as-is.
|
|
842
1024
|
if (!isPublishedSeedRef(idStr)) {
|
|
@@ -1026,18 +1208,15 @@ function findUploadedTxForSeedLocalId(uploadedTransactions, seedLocalId) {
|
|
|
1026
1208
|
return (uploadedTransactions.find((u) => u.seedLocalId === t) ??
|
|
1027
1209
|
uploadedTransactions.find((u) => u.seedLocalId != null && u.seedLocalId.trim() === t));
|
|
1028
1210
|
}
|
|
1029
|
-
/** Error thrown when publish validation fails. Includes all validation errors for user to fix. */
|
|
1030
|
-
class PublishValidationFailedError extends Error {
|
|
1031
|
-
constructor(message, validationErrors) {
|
|
1032
|
-
super(message);
|
|
1033
|
-
this.validationErrors = validationErrors;
|
|
1034
|
-
this.name = 'PublishValidationFailedError';
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
1211
|
const getPublishPayload = async (item, uploadedTransactions, options) => {
|
|
1038
1212
|
const validationCtx = { errors: [] };
|
|
1039
1213
|
const publishMode = options?.publishMode ?? 'patch';
|
|
1040
|
-
|
|
1214
|
+
// A revoked seed can't be published under again: republishing creates a new seed attestation
|
|
1215
|
+
// (new seedUid) and a new version carrying every property (see docs/ATTESTATION_REVOCATION.md).
|
|
1216
|
+
const hasSeedUid = !!item.seedUid && item.seedUid !== ZERO_BYTES32;
|
|
1217
|
+
const republishRevokedSeed = hasSeedUid && (await isSeedRevoked(item.seedLocalId));
|
|
1218
|
+
const rootSeedUid = republishRevokedSeed ? ZERO_BYTES32 : item.seedUid || ZERO_BYTES32;
|
|
1219
|
+
const forceFullSnapshot = publishMode === 'new_version' || republishRevokedSeed;
|
|
1041
1220
|
if (publishMode === 'new_version' && (!item.seedUid || item.seedUid === ZERO_BYTES32)) {
|
|
1042
1221
|
addValidationError(validationCtx, 'Publishing as a new version requires the item to already have a published Seed attestation (seed UID).', 'seedUid', 'publish_new_version_requires_seed');
|
|
1043
1222
|
}
|
|
@@ -1058,15 +1237,15 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
|
|
|
1058
1237
|
}
|
|
1059
1238
|
}
|
|
1060
1239
|
let versionUid = getVersionUid(item);
|
|
1061
|
-
if (versionUid === ZERO_BYTES32 &&
|
|
1062
|
-
versionUid = await resolveVersionUid(item.seedLocalId,
|
|
1240
|
+
if (versionUid === ZERO_BYTES32 && rootSeedUid !== ZERO_BYTES32) {
|
|
1241
|
+
versionUid = await resolveVersionUid(item.seedLocalId, rootSeedUid);
|
|
1063
1242
|
}
|
|
1064
|
-
if (forceFullSnapshot &&
|
|
1243
|
+
if (forceFullSnapshot && hasSeedUid) {
|
|
1065
1244
|
versionUid = ZERO_BYTES32;
|
|
1066
1245
|
}
|
|
1067
1246
|
let itemPublishData = {
|
|
1068
1247
|
localId: item.seedLocalId,
|
|
1069
|
-
seedUid:
|
|
1248
|
+
seedUid: rootSeedUid,
|
|
1070
1249
|
seedIsRevocable: true,
|
|
1071
1250
|
seedSchemaUid: itemSchemaUid,
|
|
1072
1251
|
versionSchemaUid: VERSION_SCHEMA_UID,
|
|
@@ -1088,11 +1267,8 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
|
|
|
1088
1267
|
let isRequired = relProp.propertyDef?.required === true;
|
|
1089
1268
|
if (!isRequired && BaseDb.getAppDb() && item.modelName) {
|
|
1090
1269
|
const normalizedModelName = upperFirst(camelCase(item.modelName));
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1093
|
-
.from(models)
|
|
1094
|
-
.where(eq(models.name, normalizedModelName))
|
|
1095
|
-
.limit(1);
|
|
1270
|
+
const modelRecord = await resolveModelRecord(normalizedModelName, await getItemModelScope(item));
|
|
1271
|
+
const modelRows = modelRecord ? [modelRecord] : [];
|
|
1096
1272
|
if (modelRows.length > 0) {
|
|
1097
1273
|
const propRows = await BaseDb.getAppDb()
|
|
1098
1274
|
.select({ required: properties.required, refModelId: properties.refModelId })
|
|
@@ -1134,7 +1310,7 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
|
|
|
1134
1310
|
}
|
|
1135
1311
|
for (const p of itemBasicProperties) {
|
|
1136
1312
|
if (isStorageTransactionPropertyName(p.propertyName) && !p.propertyDef && item.modelName) {
|
|
1137
|
-
const schema = await getPropertySchema(item.modelName, 'storageTransactionId');
|
|
1313
|
+
const schema = await getPropertySchema(item.modelName, 'storageTransactionId', await getItemModelScope(item));
|
|
1138
1314
|
if (schema) {
|
|
1139
1315
|
p.getService().send({ type: 'updateContext', propertyRecordSchema: schema });
|
|
1140
1316
|
}
|
|
@@ -1160,6 +1336,10 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
|
|
|
1160
1336
|
'Ensure required fields have values and that publishable properties are present.', 'listOfAttestations', 'publish_new_version_empty_snapshot');
|
|
1161
1337
|
}
|
|
1162
1338
|
}
|
|
1339
|
+
// Stop before anything is uploaded or attested: the payload would attest revoked seed uids.
|
|
1340
|
+
if (validationCtx.unpublishedRelatedItems?.length) {
|
|
1341
|
+
throw new RelatedItemUnpublishedError(validationCtx.unpublishedRelatedItems, validationCtx.errors);
|
|
1342
|
+
}
|
|
1163
1343
|
if (validationCtx.errors.length > 0) {
|
|
1164
1344
|
const combinedMessage = validationCtx.errors.map((e) => e.message).join('\n');
|
|
1165
1345
|
throw new PublishValidationFailedError(`Validation failed (${validationCtx.errors.length} error${validationCtx.errors.length === 1 ? '' : 's'}):\n${combinedMessage}`, validationCtx.errors);
|
|
@@ -1440,5 +1620,13 @@ const resolvePublishPayloadValues = async (multiPayload, resolvedUids) => {
|
|
|
1440
1620
|
return result;
|
|
1441
1621
|
};
|
|
1442
1622
|
|
|
1443
|
-
|
|
1444
|
-
|
|
1623
|
+
var getPublishPayload$1 = /*#__PURE__*/Object.freeze({
|
|
1624
|
+
__proto__: null,
|
|
1625
|
+
PublishValidationFailedError: PublishValidationFailedError,
|
|
1626
|
+
getPublishPayload: getPublishPayload,
|
|
1627
|
+
resolvePublishPayloadValues: resolvePublishPayloadValues,
|
|
1628
|
+
validateItemForPublish: validateItemForPublish
|
|
1629
|
+
});
|
|
1630
|
+
|
|
1631
|
+
export { PublishValidationFailedError as P, RELATED_ITEM_UNPUBLISHED_CODE as R, isUnpublishedSeed as a, RelatedItemUnpublishedError as b, resolvePublishPayloadValues as c, findRelatedSeedRow as f, getPublishPayload$1 as g, htmlPropertyNameForHtmlSeed as h, isSeedRevoked as i, relatedModelNameFromDef as r, validateItemForPublish as v };
|
|
1632
|
+
//# sourceMappingURL=getPublishPayload-H032DHC7.js.map
|