@seedprotocol/sdk 0.6.10 → 0.7.1
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-DRT09oVv.js} +36 -2
- package/dist/BasePathResolver-DRT09oVv.js.map +1 -0
- package/dist/ClientManager-DngaZdw6.js +4763 -0
- package/dist/ClientManager-DngaZdw6.js.map +1 -0
- package/dist/{ClientManager-ChcmUL47.js → Item-ZUAmf943.js} +1175 -5903
- package/dist/Item-ZUAmf943.js.map +1 -0
- package/dist/{ModelProperty-D79uV42p.js → ModelProperty-6llK4MTH.js} +326 -109
- package/dist/ModelProperty-6llK4MTH.js.map +1 -0
- package/dist/{Schema-a8uO-hIZ.js → Schema-D-Ud-XYw.js} +164 -885
- package/dist/Schema-D-Ud-XYw.js.map +1 -0
- package/dist/{SchemaValidationService-Y49vqast.js → SchemaValidationService-IoS7JquP.js} +26 -18
- package/dist/SchemaValidationService-IoS7JquP.js.map +1 -0
- package/dist/{backfillMetadataPropertyIds-CBsf7LnU.js → backfillMetadataPropertyIds-BlVeE7w7.js} +11 -6
- package/dist/backfillMetadataPropertyIds-BlVeE7w7.js.map +1 -0
- package/dist/cjs/{ModelProperty-D9FGaGuE.js → ModelProperty-Dv7AQfmQ.js} +297 -89
- package/dist/cjs/ModelProperty-Dv7AQfmQ.js.map +1 -0
- package/dist/cjs/{Schema-BiJIPLEL.js → Schema-BHVp1g-M.js} +136 -868
- package/dist/cjs/Schema-BHVp1g-M.js.map +1 -0
- package/dist/cjs/{SchemaValidationService-DtYs_CNY.js → SchemaValidationService-BSU9knjf.js} +18 -11
- package/dist/cjs/SchemaValidationService-BSU9knjf.js.map +1 -0
- package/dist/cjs/{backfillMetadataPropertyIds-2XaN3b9S.js → backfillMetadataPropertyIds-WIovQ_d8.js} +8 -3
- package/dist/cjs/backfillMetadataPropertyIds-WIovQ_d8.js.map +1 -0
- package/dist/cjs/{eas-CMNppmGE.js → eas-CUYXdr2t.js} +4 -4
- package/dist/cjs/{eas-CMNppmGE.js.map → eas-CUYXdr2t.js.map} +1 -1
- package/dist/cjs/{getItem-B6jEINjW.js → getItem-z1tHu0hu.js} +2 -2
- package/dist/cjs/{getItem-B6jEINjW.js.map → getItem-z1tHu0hu.js.map} +1 -1
- package/dist/cjs/getLatestVersionRow-CcaabxIW.js +59 -0
- package/dist/cjs/getLatestVersionRow-CcaabxIW.js.map +1 -0
- package/dist/cjs/{getPublishPayload-D5DhLGvN.js → getPublishPayload-CEP_e-Kv.js} +283 -138
- package/dist/cjs/getPublishPayload-CEP_e-Kv.js.map +1 -0
- package/dist/cjs/{getPublishUploads-DMhCCKYF.js → getPublishUploads-Ctn5k1k6.js} +65 -19
- package/dist/cjs/getPublishUploads-Ctn5k1k6.js.map +1 -0
- package/dist/cjs/{index-CSNtEnbF.js → index-Cvvt0-5B.js} +2698 -1725
- package/dist/cjs/index-Cvvt0-5B.js.map +1 -0
- package/dist/cjs/{index-DPp9rdRL.js → index-DfGhF1dc.js} +3 -3
- package/dist/cjs/index-DfGhF1dc.js.map +1 -0
- package/dist/cjs/{property-DlKiAWt4.js → property-DbEPQ1m9.js} +40 -35
- package/dist/cjs/property-DbEPQ1m9.js.map +1 -0
- package/dist/cjs/publishDraftGraph-C38gf302.js +403 -0
- package/dist/cjs/publishDraftGraph-C38gf302.js.map +1 -0
- package/dist/cjs/resetAmbiguousLegacyItemData-CfMhRHwK.js +116 -0
- package/dist/cjs/resetAmbiguousLegacyItemData-CfMhRHwK.js.map +1 -0
- package/dist/cjs/resolveModelForSyncedSeed-CNYaLOir.js +49 -0
- package/dist/cjs/resolveModelForSyncedSeed-CNYaLOir.js.map +1 -0
- package/dist/cjs/syncDbWithEas-d1iOdTTI.js +886 -0
- package/dist/cjs/syncDbWithEas-d1iOdTTI.js.map +1 -0
- package/dist/{configurePlatform-CE0Vew17.js → configurePlatform-CZpjyuCo.js} +4 -4
- package/dist/{configurePlatform-CE0Vew17.js.map → configurePlatform-CZpjyuCo.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-Lw0KVZmc.js} +546 -106
- package/dist/db-Lw0KVZmc.js.map +1 -0
- package/dist/{eas-CfYCu4IX.js → eas-CQ-Smzk2.js} +7 -7
- package/dist/eas-CQ-Smzk2.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-CSfSok9f.js} +8 -10
- package/dist/{getItem-Br-bGNFO.js.map → getItem-CSfSok9f.js.map} +1 -1
- package/dist/getLatestVersionRow-72Atl9vB.js +46 -0
- package/dist/getLatestVersionRow-72Atl9vB.js.map +1 -0
- package/dist/{getPublishPayload-BIrTVUxb.js → getPublishPayload-76_KfB5Y.js} +297 -154
- package/dist/getPublishPayload-76_KfB5Y.js.map +1 -0
- package/dist/{getPublishUploads-C6cDeZdz.js → getPublishUploads-CqgMBD8f.js} +68 -21
- package/dist/getPublishUploads-CqgMBD8f.js.map +1 -0
- package/dist/{index-Djd3667v.js → index-5b3JsS55.js} +2 -2
- package/dist/index-5b3JsS55.js.map +1 -0
- package/dist/{index-ClSv5pTA.js → index-BpgD305l.js} +12 -11
- package/dist/index-BpgD305l.js.map +1 -0
- package/dist/{index-HRHkbVQd.js → index-Y-yYyRBf.js} +530 -196
- package/dist/index-Y-yYyRBf.js.map +1 -0
- package/dist/index.browser-DaTzn79x.js +4139 -0
- package/dist/index.browser-DaTzn79x.js.map +1 -0
- package/dist/{index.node-DBtQkEfz.js → index.node-NYKqFOoe.js} +9 -4
- package/dist/index.node-NYKqFOoe.js.map +1 -0
- package/dist/main.cjs +1 -1
- package/dist/main.js +886 -560
- 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-ByaiSyUK.js} +53 -48
- package/dist/property-ByaiSyUK.js.map +1 -0
- package/dist/publishDraftGraph-BRm6Pq3Q.js +405 -0
- package/dist/publishDraftGraph-BRm6Pq3Q.js.map +1 -0
- package/dist/resetAmbiguousLegacyItemData-B4dX6ZA1.js +88 -0
- package/dist/resetAmbiguousLegacyItemData-B4dX6ZA1.js.map +1 -0
- package/dist/resolveModelForSyncedSeed-B0tco3zG.js +46 -0
- package/dist/resolveModelForSyncedSeed-B0tco3zG.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 +21 -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 +13 -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 +52 -2
- 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/actors/validateModel.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 +42 -2
- 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/actors/saveToSchema.d.ts.map +1 -1
- package/dist/src/ModelProperty/service/actors/validateProperty.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 +8 -2
- package/dist/src/Schema/Schema.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/createModelInstances.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/loadOrCreateSchema.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 +18 -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 +5 -0
- 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/publishDraftGraph.d.ts +57 -0
- package/dist/src/db/read/publishDraftGraph.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/entity/evictionEpoch.d.ts +18 -0
- package/dist/src/helpers/entity/evictionEpoch.d.ts.map +1 -0
- 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 +31 -3
- 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 +13 -3
- 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/validateEntity.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 +19 -11
- 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-BPap9Sru.js +855 -0
- package/dist/syncDbWithEas-BPap9Sru.js.map +1 -0
- package/dist/{index-280bL-n4.js → tabEvents-C6NXS6Jl.js} +231 -68
- package/dist/tabEvents-C6NXS6Jl.js.map +1 -0
- package/dist/tolerantWebAccess-NBQ1NB4i.js +160 -0
- package/dist/tolerantWebAccess-NBQ1NB4i.js.map +1 -0
- package/dist/updateSeedRevokedAt-CYwgVNlM.js +32 -0
- package/dist/updateSeedRevokedAt-CYwgVNlM.js.map +1 -0
- package/package.json +8 -10
- 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 +0 -148
- 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/getPublishUploads-C6cDeZdz.js.map +0 -1
- package/dist/getSegmentedItemProperties-BmKE71vU.js +0 -148
- 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/browser/helpers/index.d.ts +0 -4
- package/dist/src/browser/helpers/index.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,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as resolveModelRecord, q as getItemModelScope, M as ModelPropertyDataTypes, n as normalizeDataType } from './db-Lw0KVZmc.js';
|
|
2
|
+
import { Z as ZERO_BYTES32, B as BaseDb, p as properties, V as VERSION_SCHEMA_UID, j as models, h as htmlEmbeddedImageCoPublish, I as INTERNAL_PROPERTY_NAMES, w as defaultAttestationData, x as INTERNAL_DATA_TYPES } from './BasePathResolver-DRT09oVv.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-C6NXS6Jl.js';
|
|
4
5
|
import { toSnakeCase } from 'drizzle-orm/casing';
|
|
5
|
-
import {
|
|
6
|
+
import { a as getEasSchemaUidForModel, b as getLatestPublishedVersionRow, p as parseListPropertyValueFromStorage, l as listRelationEasPropertyName } from './Item-ZUAmf943.js';
|
|
6
7
|
import { isValidEasAttestationUid, getEasSchemaUidForSchemaDefinition } from '@seedprotocol/eas';
|
|
7
|
-
import {
|
|
8
|
-
import { getPropertySchema } from './property-
|
|
8
|
+
import { i as isSeedRevoked, a as getSegmentedItemProperties, f as findRelatedSeedRow, r as relatedModelNameFromDef, h as htmlPropertyNameForHtmlSeed, b as isUnpublishedSeed, c as isLivePublishedSeed, d as draftWalkProperties } from './publishDraftGraph-BRm6Pq3Q.js';
|
|
9
|
+
import { getPropertySchema } from './property-ByaiSyUK.js';
|
|
9
10
|
import { modelPropertiesToObject } from './model-DGMe-TTm.js';
|
|
10
11
|
import { upperFirst, camelCase } from 'lodash-es';
|
|
11
|
-
import {
|
|
12
|
+
import { and, eq, 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';
|
|
21
|
-
import 'pluralize';
|
|
22
|
-
import 'nanoid';
|
|
23
|
-
import 'nanoid-dictionary';
|
|
24
|
-
import '@seedprotocol/query';
|
|
25
|
-
import './generateId-BopUwD8F.js';
|
|
26
|
-
import 'rxjs';
|
|
27
|
-
import '@sinclair/typebox';
|
|
17
|
+
import './index-Y-yYyRBf.js';
|
|
28
18
|
|
|
29
19
|
/** UTF-8 string to 0x-prefixed bytes32 hex (right-padded with zeros). */
|
|
30
20
|
function encodeBytes32String(value) {
|
|
@@ -38,11 +28,88 @@ function encodeBytes32String(value) {
|
|
|
38
28
|
return `0x${hex.padEnd(64, '0')}`;
|
|
39
29
|
}
|
|
40
30
|
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
/** Error thrown when publish validation fails. Includes all validation errors for user to fix. */
|
|
32
|
+
class PublishValidationFailedError extends Error {
|
|
33
|
+
constructor(message, validationErrors) {
|
|
34
|
+
super(message);
|
|
35
|
+
this.validationErrors = validationErrors;
|
|
36
|
+
this.name = 'PublishValidationFailedError';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** Validation error code for a relation, list member or image/file ref to an unpublished seed. */
|
|
40
|
+
const RELATED_ITEM_UNPUBLISHED_CODE = 'related_item_unpublished';
|
|
41
|
+
const describeUnpublishedRelatedItem = (r) => `${r.propertyName} -> ${r.modelName} ${r.seedLocalId} (seed ${r.seedUid})`;
|
|
42
|
+
/**
|
|
43
|
+
* Thrown before anything is uploaded or attested when the item references items whose seed was
|
|
44
|
+
* unpublished: the parent would attest a revoked seed uid. Republish those items (which gives
|
|
45
|
+
* them a new seed uid) or remove the references, then publish again.
|
|
46
|
+
* See docs/ATTESTATION_REVOCATION.md ("Republishing").
|
|
47
|
+
*
|
|
48
|
+
* A PublishValidationFailedError, so validateItemForPublish and the publish package's checking
|
|
49
|
+
* step report it as validation errors (code `related_item_unpublished`, one per reference).
|
|
50
|
+
*/
|
|
51
|
+
class RelatedItemUnpublishedError extends PublishValidationFailedError {
|
|
52
|
+
constructor(unpublishedRelatedItems, otherValidationErrors = []) {
|
|
53
|
+
const lines = unpublishedRelatedItems.map(describeUnpublishedRelatedItem);
|
|
54
|
+
const message = `Cannot publish: it references ${lines.length} unpublished item${lines.length === 1 ? '' : 's'} ` +
|
|
55
|
+
`(their seed attestations were revoked). Republish them or remove the references, then publish again:\n` +
|
|
56
|
+
lines.join('\n');
|
|
57
|
+
super(message, [
|
|
58
|
+
...unpublishedRelatedItems.map((r) => ({
|
|
59
|
+
field: r.propertyName,
|
|
60
|
+
message: `${r.propertyName} references unpublished ${r.modelName} ${r.seedLocalId} (seed ${r.seedUid}). ` +
|
|
61
|
+
`Republish it or remove the reference.`,
|
|
62
|
+
code: RELATED_ITEM_UNPUBLISHED_CODE,
|
|
63
|
+
})),
|
|
64
|
+
...otherValidationErrors,
|
|
65
|
+
]);
|
|
66
|
+
this.name = 'RelatedItemUnpublishedError';
|
|
67
|
+
this.unpublishedRelatedItems = unpublishedRelatedItems;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
43
71
|
debug('seedSdk:db:getPublishPayload');
|
|
44
72
|
/** Case-insensitive dataType match (schema JSON may use "text" vs "Text"). */
|
|
45
73
|
const matchesDataType = (actual, expected) => normalizeDataType(actual) === expected;
|
|
74
|
+
/** True (and the property is deferred) when `targetSeedLocalId` is an item still in progress. */
|
|
75
|
+
function deferIfBackEdge(ctx, property, targetSeedLocalIds) {
|
|
76
|
+
if (!targetSeedLocalIds.some((id) => !!id && ctx.newSeedsInProgress?.has(id)))
|
|
77
|
+
return false;
|
|
78
|
+
ctx.deferredProperties ?? (ctx.deferredProperties = new Set());
|
|
79
|
+
ctx.deferredProperties.add(property);
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Checks the seed a relation/list/image ref points at. A revoked (unpublished) seed is recorded in
|
|
84
|
+
* `ctx.unpublishedRelatedItems`; a live published one maps the ref to its current uid. Returns
|
|
85
|
+
* true when the caller must not walk into the related item (it is published, live or revoked).
|
|
86
|
+
*/
|
|
87
|
+
function noteRelatedSeed(ctx, ref, row, propertyName, modelName) {
|
|
88
|
+
if (isUnpublishedSeed(row)) {
|
|
89
|
+
ctx.unpublishedRelatedItems ?? (ctx.unpublishedRelatedItems = []);
|
|
90
|
+
if (!ctx.unpublishedRelatedItems.some((r) => r.propertyName === propertyName && r.seedLocalId === row.seedLocalId)) {
|
|
91
|
+
ctx.unpublishedRelatedItems.push({
|
|
92
|
+
propertyName,
|
|
93
|
+
modelName: modelName ?? row.type ?? 'unknown',
|
|
94
|
+
seedLocalId: row.seedLocalId,
|
|
95
|
+
seedUid: row.seedUid,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
if (isLivePublishedSeed(row)) {
|
|
101
|
+
if (ref !== row.seedUid) {
|
|
102
|
+
ctx.relatedRefUids ?? (ctx.relatedRefUids = new Map());
|
|
103
|
+
ctx.relatedRefUids.set(ref, row.seedUid);
|
|
104
|
+
}
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
/** Current uid for a ref noted by noteRelatedSeed, else the ref itself. */
|
|
110
|
+
function currentRelatedRef(ctx, ref) {
|
|
111
|
+
return ctx.relatedRefUids?.get(ref.trim()) ?? ref;
|
|
112
|
+
}
|
|
46
113
|
function addValidationError(ctx, message, field, code = 'publish_validation') {
|
|
47
114
|
// A property can be validated on more than one path (List of Relation: list + basic); report once.
|
|
48
115
|
if (ctx.errors.some((e) => e.message === message && e.field === (field ?? '')))
|
|
@@ -124,7 +191,7 @@ async function resolveVersionUid(seedLocalId, seedUid) {
|
|
|
124
191
|
if (published?.uid)
|
|
125
192
|
return published.uid;
|
|
126
193
|
try {
|
|
127
|
-
const { getItemVersionsFromEas } = await import('./eas-
|
|
194
|
+
const { getItemVersionsFromEas } = await import('./eas-CQ-Smzk2.js');
|
|
128
195
|
const attestations = await getItemVersionsFromEas({ seedUids: [seedUid] });
|
|
129
196
|
const latest = attestations?.[0];
|
|
130
197
|
if (latest?.id)
|
|
@@ -184,17 +251,19 @@ const ensurePropertyDefs = async (targetItem) => {
|
|
|
184
251
|
(matchesDataType(p.propertyDef?.dataType, ModelPropertyDataTypes.Relation) &&
|
|
185
252
|
p.propertyDef?.required === undefined)));
|
|
186
253
|
let schema;
|
|
254
|
+
// Model names are only unique per schema: resolve definitions from this item's own model.
|
|
255
|
+
const targetScope = await getItemModelScope(targetItem);
|
|
187
256
|
for (const itemProperty of targetItem.properties) {
|
|
188
257
|
if (!itemProperty.propertyDef && targetItem.modelName) {
|
|
189
|
-
schema = await getPropertySchema(targetItem.modelName, itemProperty.propertyName);
|
|
258
|
+
schema = await getPropertySchema(targetItem.modelName, itemProperty.propertyName, targetScope);
|
|
190
259
|
if (!schema) {
|
|
191
260
|
try {
|
|
192
|
-
const _mod_0 = await import('./index-
|
|
193
|
-
const _ns_0 = _mod_0.
|
|
261
|
+
const _mod_0 = await import('./index-Y-yYyRBf.js');
|
|
262
|
+
const _ns_0 = _mod_0.f;
|
|
194
263
|
const { Model } = _ns_0;
|
|
195
264
|
const normalizedModelName = upperFirst(camelCase(targetItem.modelName));
|
|
196
|
-
let model = Model.
|
|
197
|
-
if (!model?.properties?.length) {
|
|
265
|
+
let model = Model.resolve(normalizedModelName, targetScope);
|
|
266
|
+
if (!model?.properties?.length && !targetScope.modelFileId) {
|
|
198
267
|
model = Model.findByModelType(toSnakeCase(targetItem.modelName));
|
|
199
268
|
}
|
|
200
269
|
const modelFound = !!model;
|
|
@@ -215,11 +284,8 @@ const ensurePropertyDefs = async (targetItem) => {
|
|
|
215
284
|
if (db) {
|
|
216
285
|
try {
|
|
217
286
|
const normalizedModelName = upperFirst(camelCase(targetItem.modelName));
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
.from(models)
|
|
221
|
-
.where(eq(models.name, normalizedModelName))
|
|
222
|
-
.limit(1);
|
|
287
|
+
const modelRecord = await resolveModelRecord(normalizedModelName, targetScope, db);
|
|
288
|
+
const modelRecords = modelRecord ? [modelRecord] : [];
|
|
223
289
|
if (modelRecords.length > 0 && modelRecords[0].id) {
|
|
224
290
|
const propertyRecords = await db
|
|
225
291
|
.select()
|
|
@@ -270,6 +336,9 @@ const processBasicProperties = async (itemBasicProperties, itemPublishData, ctx,
|
|
|
270
336
|
if (INTERNAL_PROPERTY_NAMES.includes(basicProperty.propertyName)) {
|
|
271
337
|
continue;
|
|
272
338
|
}
|
|
339
|
+
if (ctx.deferredProperties?.has(basicProperty)) {
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
273
342
|
const snapshot = basicProperty.getService().getSnapshot();
|
|
274
343
|
const context = 'context' in snapshot ? snapshot.context : null;
|
|
275
344
|
const propertyDef = basicProperty.propertyDef ?? (context ? context.propertyRecordSchema : undefined);
|
|
@@ -350,13 +419,17 @@ const processBasicProperties = async (itemBasicProperties, itemPublishData, ctx,
|
|
|
350
419
|
.map((s) => s.trim())
|
|
351
420
|
.filter(Boolean);
|
|
352
421
|
}
|
|
422
|
+
// A ref to a published related item attests that item's current uid.
|
|
423
|
+
if (typeof value === 'string' && (isRelation || isFileImageHtml || isJsonStorage)) {
|
|
424
|
+
value = currentRelatedRef(ctx, value);
|
|
425
|
+
}
|
|
353
426
|
if (schemaDef.startsWith('bytes32[]') && !Array.isArray(value)) {
|
|
354
427
|
addValidationError(ctx, `Invalid value for property: ${basicProperty.propertyName}. Expected an array of bytes32, got ${value}.`, basicProperty.propertyName);
|
|
355
428
|
continue;
|
|
356
429
|
}
|
|
357
430
|
// Validate against property validation rules (enum, pattern, minLength, maxLength) before encoding
|
|
358
431
|
if (propertyDef?.validation) {
|
|
359
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
432
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-IoS7JquP.js');
|
|
360
433
|
const validationService = new SchemaValidationService();
|
|
361
434
|
const validationResult = validationService.validatePropertyValue(value, normalizeDataType(propertyDef.dataType), propertyDef.validation, propertyDef.refValueType
|
|
362
435
|
? normalizeDataType(propertyDef.refValueType)
|
|
@@ -387,7 +460,7 @@ const processBasicProperties = async (itemBasicProperties, itemPublishData, ctx,
|
|
|
387
460
|
: '';
|
|
388
461
|
if (!idStr)
|
|
389
462
|
continue;
|
|
390
|
-
const trimmed = idStr.trim();
|
|
463
|
+
const trimmed = currentRelatedRef(ctx, idStr.trim());
|
|
391
464
|
if (!trimmed)
|
|
392
465
|
continue;
|
|
393
466
|
rawIds.push(trimmed);
|
|
@@ -496,8 +569,8 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
496
569
|
matchesDataType(relationOrImageProperty.propertyDef?.refValueType, ModelPropertyDataTypes.Html) ||
|
|
497
570
|
matchesDataType(relationOrImageProperty.propertyDef?.refValueType, ModelPropertyDataTypes.Json)));
|
|
498
571
|
if (isStorageSeed && (context.seedLocalId || context.seedUid)) {
|
|
499
|
-
const _mod_1 = await import('./
|
|
500
|
-
const _ns_1 = _mod_1.
|
|
572
|
+
const _mod_1 = await import('./Item-ZUAmf943.js');
|
|
573
|
+
const _ns_1 = _mod_1.Y;
|
|
501
574
|
const { getPropertyData: getPropertyDataFromDb } = _ns_1;
|
|
502
575
|
const metaRow = await getPropertyDataFromDb({
|
|
503
576
|
propertyName: relationOrImageProperty.propertyName,
|
|
@@ -520,14 +593,12 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
520
593
|
let isRequired = propertyDef?.required === true;
|
|
521
594
|
// Resolve required from schema/DB when propertyDef lacks it
|
|
522
595
|
if (!isRequired && relationOrImageProperty.modelName) {
|
|
523
|
-
|
|
596
|
+
const propertyScope = await getItemModelScope(relationOrImageProperty);
|
|
597
|
+
let schema = await getPropertySchema(relationOrImageProperty.modelName, relationOrImageProperty.propertyName, propertyScope);
|
|
524
598
|
if (!schema && BaseDb.getAppDb()) {
|
|
525
599
|
const normalizedModelName = upperFirst(camelCase(relationOrImageProperty.modelName));
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
.from(models)
|
|
529
|
-
.where(eq(models.name, normalizedModelName))
|
|
530
|
-
.limit(1);
|
|
600
|
+
const modelRecord = await resolveModelRecord(normalizedModelName, propertyScope);
|
|
601
|
+
const modelRecords = modelRecord ? [modelRecord] : [];
|
|
531
602
|
if (modelRecords.length > 0 && modelRecords[0].id) {
|
|
532
603
|
const propertyRecords = await BaseDb.getAppDb()
|
|
533
604
|
.select()
|
|
@@ -583,13 +654,18 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
583
654
|
}
|
|
584
655
|
return multiPublishPayload;
|
|
585
656
|
}
|
|
657
|
+
// The local seed, also when the ref is the old uid of a seed published again since.
|
|
658
|
+
const relatedSeed = await findRelatedSeedRow({ seedLocalId, seedUid });
|
|
659
|
+
if (!isStorageSeed && deferIfBackEdge(ctx, relationOrImageProperty, [relatedSeed?.seedLocalId ?? seedLocalId])) {
|
|
660
|
+
return multiPublishPayload;
|
|
661
|
+
}
|
|
586
662
|
// Use dynamic import to break circular dependency
|
|
587
|
-
const getItemMod = await import('./getItem-
|
|
663
|
+
const getItemMod = await import('./getItem-CSfSok9f.js');
|
|
588
664
|
const { getItem } = getItemMod;
|
|
589
|
-
const relatedItem = await getItem({
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
665
|
+
const relatedItem = await getItem(relatedSeed ? { seedLocalId: relatedSeed.seedLocalId } : { seedLocalId, seedUid });
|
|
666
|
+
if (noteRelatedSeed(ctx, normalizedRef, relatedSeed, relationOrImageProperty.propertyName, relatedItem?.modelName ?? relatedModelNameFromDef(relationOrImageProperty.propertyDef))) {
|
|
667
|
+
return multiPublishPayload;
|
|
668
|
+
}
|
|
593
669
|
// When related item not found (e.g. different DB, not yet created)
|
|
594
670
|
if (!relatedItem) {
|
|
595
671
|
// An attested uid with no local copy is already published; the parent attests the uid as-is.
|
|
@@ -604,7 +680,6 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
604
680
|
if (relatedItem.seedUid && relatedItem.seedUid !== ZERO_BYTES32) {
|
|
605
681
|
return multiPublishPayload;
|
|
606
682
|
}
|
|
607
|
-
const versionUid = getVersionUid(relatedItem);
|
|
608
683
|
let modelName;
|
|
609
684
|
if (matchesDataType(relationOrImageProperty.propertyDef?.dataType, ModelPropertyDataTypes.Image)) {
|
|
610
685
|
modelName = 'Image';
|
|
@@ -623,63 +698,119 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
|
|
|
623
698
|
addValidationError(ctx, `Model name not found for relation or image property: ${relationOrImageProperty.propertyName}`, relationOrImageProperty.propertyName);
|
|
624
699
|
return multiPublishPayload;
|
|
625
700
|
}
|
|
701
|
+
return processRelatedDraftItem({
|
|
702
|
+
relatedItem,
|
|
703
|
+
modelName,
|
|
704
|
+
// A storage seed (Image/File/Html/Json item) attests its own basic properties; a related model
|
|
705
|
+
// item is published with its full property set and the draft items it reaches in turn.
|
|
706
|
+
fullDraft: !isStorageSeed,
|
|
707
|
+
link: { publishLocalId: originalSeedLocalId, propertySchemaUid: relationOrImageSchemaUid },
|
|
708
|
+
reportPropertyName: relationOrImageProperty.propertyName,
|
|
709
|
+
multiPublishPayload,
|
|
710
|
+
uploadedTransactions,
|
|
711
|
+
ctx,
|
|
712
|
+
buildOpts,
|
|
713
|
+
});
|
|
714
|
+
};
|
|
715
|
+
/**
|
|
716
|
+
* The payload of a draft item (no seed uid) a published item refers to, published with it. Its
|
|
717
|
+
* request fills the referring property (`link`) through propertiesToUpdate. With `fullDraft`, the
|
|
718
|
+
* item's whole property set is attested: its storage seeds and Html-embedded images, and its own
|
|
719
|
+
* relation and list properties, whose draft targets are published with it in turn (depth first,
|
|
720
|
+
* see publishDraftGraph.ts). A draft already in the batch only gains the link.
|
|
721
|
+
*/
|
|
722
|
+
async function processRelatedDraftItem({ relatedItem, modelName, fullDraft, link, reportPropertyName, multiPublishPayload, uploadedTransactions, ctx, buildOpts, }) {
|
|
723
|
+
const forceFullSnapshot = buildOpts?.forceFullSnapshot === true;
|
|
626
724
|
const seedSchemaUid = await getEasSchemaUidForModel(modelName);
|
|
627
725
|
if (!seedSchemaUid) {
|
|
628
|
-
addValidationError(ctx, `Schema UID not found for model: ${modelName}`,
|
|
726
|
+
addValidationError(ctx, `Schema UID not found for model: ${modelName}`, reportPropertyName);
|
|
629
727
|
return multiPublishPayload;
|
|
630
728
|
}
|
|
631
|
-
if (
|
|
729
|
+
if (multiPublishPayload.some((p) => p.localId === relatedItem.seedLocalId)) {
|
|
730
|
+
if (link) {
|
|
731
|
+
mergeChildPublishPayloadIfDuplicateInBatch(multiPublishPayload, relatedItem.seedLocalId, link.publishLocalId, link.propertySchemaUid);
|
|
732
|
+
}
|
|
632
733
|
return multiPublishPayload;
|
|
633
734
|
}
|
|
634
735
|
let publishPayload = {
|
|
635
736
|
localId: relatedItem.seedLocalId,
|
|
636
737
|
seedIsRevocable: true,
|
|
637
738
|
versionSchemaUid: VERSION_SCHEMA_UID,
|
|
638
|
-
seedUid:
|
|
739
|
+
seedUid: ZERO_BYTES32,
|
|
639
740
|
seedSchemaUid,
|
|
640
|
-
versionUid,
|
|
741
|
+
versionUid: getVersionUid(relatedItem),
|
|
641
742
|
listOfAttestations: [],
|
|
642
|
-
propertiesToUpdate: [
|
|
643
|
-
{
|
|
644
|
-
publishLocalId: originalSeedLocalId,
|
|
645
|
-
propertySchemaUid: relationOrImageSchemaUid,
|
|
646
|
-
},
|
|
647
|
-
],
|
|
743
|
+
propertiesToUpdate: link ? [{ ...link }] : [],
|
|
648
744
|
};
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
//
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
745
|
+
ctx.newSeedsInProgress ?? (ctx.newSeedsInProgress = new Set());
|
|
746
|
+
ctx.newSeedsInProgress.add(relatedItem.seedLocalId);
|
|
747
|
+
try {
|
|
748
|
+
await ensurePropertyDefs(relatedItem);
|
|
749
|
+
const segmented = await getSegmentedItemProperties(relatedItem);
|
|
750
|
+
const { itemBasicProperties, itemUploadProperties, itemImageProperties: relatedStorageSeedProperties } = segmented;
|
|
751
|
+
if (fullDraft) {
|
|
752
|
+
// Its own Image/File/Html/Json properties and the images embedded in its Html (as for the item itself).
|
|
753
|
+
multiPublishPayload = await processRelatedDraftStorageSeeds(relatedItem, relatedStorageSeedProperties, itemBasicProperties, multiPublishPayload, uploadedTransactions, ctx, buildOpts);
|
|
754
|
+
// Its relations and lists: their draft targets are published too (same walk as publishDraftGraph).
|
|
755
|
+
const { relationProperties, listProperties } = draftWalkProperties(segmented);
|
|
756
|
+
for (const relationProperty of relationProperties) {
|
|
757
|
+
multiPublishPayload = await processRelationOrImageProperty(relationProperty, multiPublishPayload, uploadedTransactions, relatedItem.seedLocalId, ctx, buildOpts);
|
|
758
|
+
itemBasicProperties.push(relationProperty);
|
|
759
|
+
}
|
|
760
|
+
for (const listProperty of listProperties) {
|
|
761
|
+
multiPublishPayload = await processListProperty(listProperty, multiPublishPayload, uploadedTransactions, relatedItem.seedLocalId, ctx, buildOpts);
|
|
762
|
+
itemBasicProperties.push(listProperty);
|
|
763
|
+
}
|
|
664
764
|
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
765
|
+
const relatedStorageUpload = resolveStorageTransactionUploadSlot(relatedItem, itemUploadProperties);
|
|
766
|
+
if (relatedStorageUpload) {
|
|
767
|
+
const transactionData = findUploadedTxForSeedLocalId(uploadedTransactions, relatedItem.seedLocalId);
|
|
768
|
+
if (transactionData) {
|
|
769
|
+
const itemProperty = relatedStorageUpload.itemProperty;
|
|
770
|
+
// Publish encoding reads context.propertyValue; do not await ItemProperty.save() here — it
|
|
771
|
+
// uses xstate waitFor(10s) for idle and can time out while the machine is busy or still loading.
|
|
772
|
+
itemProperty.getService().send({
|
|
773
|
+
type: 'updateContext',
|
|
774
|
+
propertyValue: transactionData.txId,
|
|
775
|
+
renderValue: transactionData.txId,
|
|
776
|
+
});
|
|
777
|
+
replaceStorageTransactionInBasicProperties(itemBasicProperties, itemProperty);
|
|
673
778
|
}
|
|
674
779
|
}
|
|
780
|
+
for (const p of itemBasicProperties) {
|
|
781
|
+
if (isStorageTransactionPropertyName(p.propertyName) &&
|
|
782
|
+
!p.propertyDef &&
|
|
783
|
+
relatedItem.modelName) {
|
|
784
|
+
const schema = await getPropertySchema(relatedItem.modelName, 'storageTransactionId', await getItemModelScope(relatedItem));
|
|
785
|
+
if (schema) {
|
|
786
|
+
p.getService().send({ type: 'updateContext', propertyRecordSchema: schema });
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
dedupeOneStorageTransactionPropertyInList(itemBasicProperties);
|
|
791
|
+
publishPayload = await processBasicProperties(itemBasicProperties, publishPayload, ctx, {
|
|
792
|
+
forceFullSnapshot,
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
finally {
|
|
796
|
+
ctx.newSeedsInProgress.delete(relatedItem.seedLocalId);
|
|
675
797
|
}
|
|
676
|
-
dedupeOneStorageTransactionPropertyInList(itemBasicProperties);
|
|
677
|
-
publishPayload = await processBasicProperties(itemBasicProperties, publishPayload, ctx, {
|
|
678
|
-
forceFullSnapshot,
|
|
679
|
-
});
|
|
680
798
|
multiPublishPayload.push(publishPayload);
|
|
681
799
|
return multiPublishPayload;
|
|
682
|
-
}
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Storage-seed properties (Image/File/Html/Json) of a draft item related to the published one, and
|
|
803
|
+
* the images embedded in its Html (htmlEmbeddedImageCoPublish rows it owns): payloads for their seeds,
|
|
804
|
+
* and the properties added to `itemBasicProperties` so the related item attests them. Same handling
|
|
805
|
+
* as the published item's own (see getPublishPayload).
|
|
806
|
+
*/
|
|
807
|
+
async function processRelatedDraftStorageSeeds(relatedItem, storageSeedProperties, itemBasicProperties, multiPublishPayload, uploadedTransactions, ctx, buildOpts) {
|
|
808
|
+
for (const storageSeedProperty of storageSeedProperties) {
|
|
809
|
+
multiPublishPayload = await processRelationOrImageProperty(storageSeedProperty, multiPublishPayload, uploadedTransactions, relatedItem.seedLocalId, ctx, buildOpts);
|
|
810
|
+
itemBasicProperties.push(storageSeedProperty);
|
|
811
|
+
}
|
|
812
|
+
return processHtmlEmbeddedCoPublishImagePayloads(relatedItem, multiPublishPayload, uploadedTransactions, ctx, buildOpts);
|
|
813
|
+
}
|
|
683
814
|
async function resolveHtmlPropertySchemaUidByHtmlSeed(item, htmlSeedLocalId, ctx) {
|
|
684
815
|
const want = htmlSeedLocalId.trim();
|
|
685
816
|
for (const p of item.properties) {
|
|
@@ -700,7 +831,7 @@ async function resolveHtmlPropertySchemaUidByHtmlSeed(item, htmlSeedLocalId, ctx
|
|
|
700
831
|
addValidationError(ctx, `Could not find Html property for embedded image rewrite (html seed ${want}).`, 'html', 'html_embed_schema');
|
|
701
832
|
return undefined;
|
|
702
833
|
}
|
|
703
|
-
async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPayload, uploadedTransactions,
|
|
834
|
+
async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPayload, uploadedTransactions, ctx, buildOpts) {
|
|
704
835
|
const appDb = BaseDb.getAppDb();
|
|
705
836
|
if (!appDb)
|
|
706
837
|
return multiPublishPayload;
|
|
@@ -711,13 +842,20 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
|
|
|
711
842
|
if (rows.length === 0)
|
|
712
843
|
return multiPublishPayload;
|
|
713
844
|
const forceFullSnapshot = buildOpts?.forceFullSnapshot === true;
|
|
714
|
-
const getItemMod = await import('./getItem-
|
|
845
|
+
const getItemMod = await import('./getItem-CSfSok9f.js');
|
|
715
846
|
const { getItem } = getItemMod;
|
|
716
847
|
const doneImages = new Set();
|
|
717
848
|
for (const row of rows) {
|
|
718
849
|
if (doneImages.has(row.imageSeedLocalId))
|
|
719
850
|
continue;
|
|
720
851
|
doneImages.add(row.imageSeedLocalId);
|
|
852
|
+
// An embedded image that is already published is not co-published; one whose seed was revoked
|
|
853
|
+
// (unpublished) blocks the publish like an image property pointing at it would.
|
|
854
|
+
const imageSeed = await findRelatedSeedRow({ seedLocalId: row.imageSeedLocalId });
|
|
855
|
+
if (noteRelatedSeed(ctx, row.imageSeedLocalId, imageSeed, htmlPropertyNameForHtmlSeed(item, row.htmlSeedLocalId), 'Image')) {
|
|
856
|
+
continue;
|
|
857
|
+
}
|
|
858
|
+
// The row's Html seed must still be the value of one of the item's Html properties.
|
|
721
859
|
const htmlSchemaUid = await resolveHtmlPropertySchemaUidByHtmlSeed(item, row.htmlSeedLocalId, ctx);
|
|
722
860
|
if (!htmlSchemaUid)
|
|
723
861
|
continue;
|
|
@@ -734,10 +872,16 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
|
|
|
734
872
|
addValidationError(ctx, `Schema UID not found for model: Image`, 'html');
|
|
735
873
|
continue;
|
|
736
874
|
}
|
|
737
|
-
|
|
875
|
+
// Already in the batch (e.g. also the value of an Image property): its payload is there.
|
|
876
|
+
if (multiPublishPayload.some((p) => p.localId === relatedItem.seedLocalId)) {
|
|
738
877
|
continue;
|
|
739
878
|
}
|
|
740
879
|
const versionUid = getVersionUid(relatedItem);
|
|
880
|
+
// No propertiesToUpdate: the Html refers to the image by its Arweave URL (the data URI is
|
|
881
|
+
// rewritten to it before the Html is uploaded), not by seed uid. The Html property holds the Html
|
|
882
|
+
// storage seed's uid, which the Html seed's own request writes into it; the contract writes each
|
|
883
|
+
// updater's seed uid into the same data[0] (SeedPublishLib.setSeedReference), so an image
|
|
884
|
+
// targeting the Html property too would overwrite that reference with the image's seed uid.
|
|
741
885
|
let publishPayload = {
|
|
742
886
|
localId: relatedItem.seedLocalId,
|
|
743
887
|
seedIsRevocable: true,
|
|
@@ -746,12 +890,7 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
|
|
|
746
890
|
seedSchemaUid,
|
|
747
891
|
versionUid,
|
|
748
892
|
listOfAttestations: [],
|
|
749
|
-
propertiesToUpdate: [
|
|
750
|
-
{
|
|
751
|
-
publishLocalId: originalSeedLocalId,
|
|
752
|
-
propertySchemaUid: htmlSchemaUid,
|
|
753
|
-
},
|
|
754
|
-
],
|
|
893
|
+
propertiesToUpdate: [],
|
|
755
894
|
};
|
|
756
895
|
await ensurePropertyDefs(relatedItem);
|
|
757
896
|
const { itemBasicProperties, itemUploadProperties } = await getSegmentedItemProperties(relatedItem);
|
|
@@ -772,7 +911,7 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
|
|
|
772
911
|
if (isStorageTransactionPropertyName(p.propertyName) &&
|
|
773
912
|
!p.propertyDef &&
|
|
774
913
|
relatedItem.modelName) {
|
|
775
|
-
const schema = await getPropertySchema(relatedItem.modelName, 'storageTransactionId');
|
|
914
|
+
const schema = await getPropertySchema(relatedItem.modelName, 'storageTransactionId', await getItemModelScope(relatedItem));
|
|
776
915
|
if (schema) {
|
|
777
916
|
p.getService().send({ type: 'updateContext', propertyRecordSchema: schema });
|
|
778
917
|
}
|
|
@@ -786,7 +925,7 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
|
|
|
786
925
|
}
|
|
787
926
|
return multiPublishPayload;
|
|
788
927
|
}
|
|
789
|
-
const processListProperty = async (listProperty, multiPublishPayload, originalSeedLocalId, ctx, buildOpts) => {
|
|
928
|
+
const processListProperty = async (listProperty, multiPublishPayload, uploadedTransactions, originalSeedLocalId, ctx, buildOpts) => {
|
|
790
929
|
const forceFullSnapshot = buildOpts?.forceFullSnapshot === true;
|
|
791
930
|
// processListProperty only handles list-of-relations; list-of-primitives go to itemBasicProperties
|
|
792
931
|
if (!listProperty.propertyDef?.ref) {
|
|
@@ -819,6 +958,7 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
|
|
|
819
958
|
: value != null
|
|
820
959
|
? [value]
|
|
821
960
|
: [];
|
|
961
|
+
const members = [];
|
|
822
962
|
for (const seedId of iterableValue) {
|
|
823
963
|
const idStr = typeof seedId === 'string'
|
|
824
964
|
? seedId
|
|
@@ -830,13 +970,25 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
|
|
|
830
970
|
const { localId: seedLocalId, uid: seedUid } = getCorrectId(idStr);
|
|
831
971
|
if (!seedLocalId && !seedUid)
|
|
832
972
|
continue;
|
|
973
|
+
members.push({ idStr, seedLocalId, seedUid });
|
|
974
|
+
}
|
|
975
|
+
// A member that is an item still in progress (a cycle back to it) can't be attested in this
|
|
976
|
+
// publish, so the list is deferred; its other draft members are still published, unlinked.
|
|
977
|
+
const memberSeeds = await Promise.all(members.map((m) => findRelatedSeedRow({ seedLocalId: m.seedLocalId, seedUid: m.seedUid })));
|
|
978
|
+
const deferred = deferIfBackEdge(ctx, listProperty, members.map((m, i) => memberSeeds[i]?.seedLocalId ?? m.seedLocalId));
|
|
979
|
+
for (let i = 0; i < members.length; i++) {
|
|
980
|
+
const { idStr, seedLocalId, seedUid } = members[i];
|
|
981
|
+
const relatedSeed = memberSeeds[i] ?? null;
|
|
982
|
+
const memberLocalId = relatedSeed?.seedLocalId ?? seedLocalId;
|
|
983
|
+
if (memberLocalId && ctx.newSeedsInProgress?.has(memberLocalId))
|
|
984
|
+
continue;
|
|
833
985
|
// Use dynamic import to break circular dependency
|
|
834
|
-
const getItemMod = await import('./getItem-
|
|
986
|
+
const getItemMod = await import('./getItem-CSfSok9f.js');
|
|
835
987
|
const { getItem } = getItemMod;
|
|
836
|
-
const relatedItem = await getItem({
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
}
|
|
988
|
+
const relatedItem = await getItem(relatedSeed ? { seedLocalId: relatedSeed.seedLocalId } : { seedLocalId, seedUid });
|
|
989
|
+
if (noteRelatedSeed(ctx, idStr.trim(), relatedSeed, listProperty.propertyName, relatedItem?.modelName ?? relatedModelNameFromDef(listProperty.propertyDef))) {
|
|
990
|
+
continue;
|
|
991
|
+
}
|
|
840
992
|
if (!relatedItem) {
|
|
841
993
|
// An attested uid with no local copy is already published; the list attests the uid as-is.
|
|
842
994
|
if (!isPublishedSeedRef(idStr)) {
|
|
@@ -847,7 +999,6 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
|
|
|
847
999
|
if (relatedItem.seedUid && relatedItem.seedUid !== ZERO_BYTES32) {
|
|
848
1000
|
continue;
|
|
849
1001
|
}
|
|
850
|
-
const versionUid = getVersionUid(relatedItem);
|
|
851
1002
|
let modelName;
|
|
852
1003
|
if (listProperty.propertyDef?.ref || listProperty.propertyDef.refModelName) {
|
|
853
1004
|
const def = listProperty.propertyDef;
|
|
@@ -866,36 +1017,17 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
|
|
|
866
1017
|
addValidationError(ctx, `Model name not found for list property: ${listProperty.propertyName}`, listProperty.propertyName);
|
|
867
1018
|
continue;
|
|
868
1019
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
seedIsRevocable: true,
|
|
880
|
-
versionSchemaUid: VERSION_SCHEMA_UID,
|
|
881
|
-
seedUid: seedUid || ZERO_BYTES32,
|
|
882
|
-
seedSchemaUid,
|
|
883
|
-
versionUid,
|
|
884
|
-
listOfAttestations: [],
|
|
885
|
-
propertiesToUpdate: [
|
|
886
|
-
{
|
|
887
|
-
publishLocalId: originalSeedLocalId,
|
|
888
|
-
propertySchemaUid: listPropertySchemaUid,
|
|
889
|
-
},
|
|
890
|
-
],
|
|
891
|
-
};
|
|
892
|
-
await ensurePropertyDefs(relatedItem);
|
|
893
|
-
const { itemBasicProperties } = await getSegmentedItemProperties(relatedItem);
|
|
894
|
-
dedupeOneStorageTransactionPropertyInList(itemBasicProperties);
|
|
895
|
-
publishPayload = await processBasicProperties(itemBasicProperties, publishPayload, ctx, {
|
|
896
|
-
forceFullSnapshot,
|
|
1020
|
+
multiPublishPayload = await processRelatedDraftItem({
|
|
1021
|
+
relatedItem,
|
|
1022
|
+
modelName,
|
|
1023
|
+
fullDraft: true,
|
|
1024
|
+
link: deferred ? null : { publishLocalId: originalSeedLocalId, propertySchemaUid: listPropertySchemaUid },
|
|
1025
|
+
reportPropertyName: listProperty.propertyName,
|
|
1026
|
+
multiPublishPayload,
|
|
1027
|
+
uploadedTransactions,
|
|
1028
|
+
ctx,
|
|
1029
|
+
buildOpts,
|
|
897
1030
|
});
|
|
898
|
-
multiPublishPayload.push(publishPayload);
|
|
899
1031
|
}
|
|
900
1032
|
return multiPublishPayload;
|
|
901
1033
|
};
|
|
@@ -1026,22 +1158,24 @@ function findUploadedTxForSeedLocalId(uploadedTransactions, seedLocalId) {
|
|
|
1026
1158
|
return (uploadedTransactions.find((u) => u.seedLocalId === t) ??
|
|
1027
1159
|
uploadedTransactions.find((u) => u.seedLocalId != null && u.seedLocalId.trim() === t));
|
|
1028
1160
|
}
|
|
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
1161
|
const getPublishPayload = async (item, uploadedTransactions, options) => {
|
|
1038
1162
|
const validationCtx = { errors: [] };
|
|
1039
1163
|
const publishMode = options?.publishMode ?? 'patch';
|
|
1040
|
-
|
|
1164
|
+
// A revoked seed can't be published under again: republishing creates a new seed attestation
|
|
1165
|
+
// (new seedUid) and a new version carrying every property (see docs/ATTESTATION_REVOCATION.md).
|
|
1166
|
+
const hasSeedUid = !!item.seedUid && item.seedUid !== ZERO_BYTES32;
|
|
1167
|
+
const republishRevokedSeed = hasSeedUid && (await isSeedRevoked(item.seedLocalId));
|
|
1168
|
+
const rootSeedUid = republishRevokedSeed ? ZERO_BYTES32 : item.seedUid || ZERO_BYTES32;
|
|
1169
|
+
const forceFullSnapshot = publishMode === 'new_version' || republishRevokedSeed;
|
|
1041
1170
|
if (publishMode === 'new_version' && (!item.seedUid || item.seedUid === ZERO_BYTES32)) {
|
|
1042
1171
|
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
1172
|
}
|
|
1044
1173
|
let multiPublishPayload = [];
|
|
1174
|
+
// The root gets a new seed (draft, or revoked seed published again): related drafts referring
|
|
1175
|
+
// back to it can't attest its uid in this publish (see publishDraftGraph.ts).
|
|
1176
|
+
if (rootSeedUid === ZERO_BYTES32) {
|
|
1177
|
+
validationCtx.newSeedsInProgress = new Set([item.seedLocalId]);
|
|
1178
|
+
}
|
|
1045
1179
|
// Each PublishPayload is generated from a Seed that needs publishing
|
|
1046
1180
|
// First we need to determine all Seeds to publish
|
|
1047
1181
|
// That means the Seed of the Item, plus any Seeds pointed to by Relations
|
|
@@ -1058,15 +1192,15 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
|
|
|
1058
1192
|
}
|
|
1059
1193
|
}
|
|
1060
1194
|
let versionUid = getVersionUid(item);
|
|
1061
|
-
if (versionUid === ZERO_BYTES32 &&
|
|
1062
|
-
versionUid = await resolveVersionUid(item.seedLocalId,
|
|
1195
|
+
if (versionUid === ZERO_BYTES32 && rootSeedUid !== ZERO_BYTES32) {
|
|
1196
|
+
versionUid = await resolveVersionUid(item.seedLocalId, rootSeedUid);
|
|
1063
1197
|
}
|
|
1064
|
-
if (forceFullSnapshot &&
|
|
1198
|
+
if (forceFullSnapshot && hasSeedUid) {
|
|
1065
1199
|
versionUid = ZERO_BYTES32;
|
|
1066
1200
|
}
|
|
1067
1201
|
let itemPublishData = {
|
|
1068
1202
|
localId: item.seedLocalId,
|
|
1069
|
-
seedUid:
|
|
1203
|
+
seedUid: rootSeedUid,
|
|
1070
1204
|
seedIsRevocable: true,
|
|
1071
1205
|
seedSchemaUid: itemSchemaUid,
|
|
1072
1206
|
versionSchemaUid: VERSION_SCHEMA_UID,
|
|
@@ -1088,11 +1222,8 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
|
|
|
1088
1222
|
let isRequired = relProp.propertyDef?.required === true;
|
|
1089
1223
|
if (!isRequired && BaseDb.getAppDb() && item.modelName) {
|
|
1090
1224
|
const normalizedModelName = upperFirst(camelCase(item.modelName));
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1093
|
-
.from(models)
|
|
1094
|
-
.where(eq(models.name, normalizedModelName))
|
|
1095
|
-
.limit(1);
|
|
1225
|
+
const modelRecord = await resolveModelRecord(normalizedModelName, await getItemModelScope(item));
|
|
1226
|
+
const modelRows = modelRecord ? [modelRecord] : [];
|
|
1096
1227
|
if (modelRows.length > 0) {
|
|
1097
1228
|
const propRows = await BaseDb.getAppDb()
|
|
1098
1229
|
.select({ required: properties.required, refModelId: properties.refModelId })
|
|
@@ -1127,14 +1258,14 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
|
|
|
1127
1258
|
multiPublishPayload = await processRelationOrImageProperty(relationProperty, multiPublishPayload, uploadedTransactions, item.seedLocalId, validationCtx, { forceFullSnapshot });
|
|
1128
1259
|
itemBasicProperties.push(relationProperty);
|
|
1129
1260
|
}
|
|
1130
|
-
multiPublishPayload = await processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPayload, uploadedTransactions,
|
|
1261
|
+
multiPublishPayload = await processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPayload, uploadedTransactions, validationCtx, { forceFullSnapshot });
|
|
1131
1262
|
for (const listProperty of itemListProperties) {
|
|
1132
|
-
multiPublishPayload = await processListProperty(listProperty, multiPublishPayload, item.seedLocalId, validationCtx, { forceFullSnapshot });
|
|
1263
|
+
multiPublishPayload = await processListProperty(listProperty, multiPublishPayload, uploadedTransactions, item.seedLocalId, validationCtx, { forceFullSnapshot });
|
|
1133
1264
|
itemBasicProperties.push(listProperty);
|
|
1134
1265
|
}
|
|
1135
1266
|
for (const p of itemBasicProperties) {
|
|
1136
1267
|
if (isStorageTransactionPropertyName(p.propertyName) && !p.propertyDef && item.modelName) {
|
|
1137
|
-
const schema = await getPropertySchema(item.modelName, 'storageTransactionId');
|
|
1268
|
+
const schema = await getPropertySchema(item.modelName, 'storageTransactionId', await getItemModelScope(item));
|
|
1138
1269
|
if (schema) {
|
|
1139
1270
|
p.getService().send({ type: 'updateContext', propertyRecordSchema: schema });
|
|
1140
1271
|
}
|
|
@@ -1160,6 +1291,10 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
|
|
|
1160
1291
|
'Ensure required fields have values and that publishable properties are present.', 'listOfAttestations', 'publish_new_version_empty_snapshot');
|
|
1161
1292
|
}
|
|
1162
1293
|
}
|
|
1294
|
+
// Stop before anything is uploaded or attested: the payload would attest revoked seed uids.
|
|
1295
|
+
if (validationCtx.unpublishedRelatedItems?.length) {
|
|
1296
|
+
throw new RelatedItemUnpublishedError(validationCtx.unpublishedRelatedItems, validationCtx.errors);
|
|
1297
|
+
}
|
|
1163
1298
|
if (validationCtx.errors.length > 0) {
|
|
1164
1299
|
const combinedMessage = validationCtx.errors.map((e) => e.message).join('\n');
|
|
1165
1300
|
throw new PublishValidationFailedError(`Validation failed (${validationCtx.errors.length} error${validationCtx.errors.length === 1 ? '' : 's'}):\n${combinedMessage}`, validationCtx.errors);
|
|
@@ -1440,5 +1575,13 @@ const resolvePublishPayloadValues = async (multiPayload, resolvedUids) => {
|
|
|
1440
1575
|
return result;
|
|
1441
1576
|
};
|
|
1442
1577
|
|
|
1443
|
-
|
|
1444
|
-
|
|
1578
|
+
var getPublishPayload$1 = /*#__PURE__*/Object.freeze({
|
|
1579
|
+
__proto__: null,
|
|
1580
|
+
PublishValidationFailedError: PublishValidationFailedError,
|
|
1581
|
+
getPublishPayload: getPublishPayload,
|
|
1582
|
+
resolvePublishPayloadValues: resolvePublishPayloadValues,
|
|
1583
|
+
validateItemForPublish: validateItemForPublish
|
|
1584
|
+
});
|
|
1585
|
+
|
|
1586
|
+
export { PublishValidationFailedError as P, RELATED_ITEM_UNPUBLISHED_CODE as R, RelatedItemUnpublishedError as a, getPublishPayload$1 as g, resolvePublishPayloadValues as r, validateItemForPublish as v };
|
|
1587
|
+
//# sourceMappingURL=getPublishPayload-76_KfB5Y.js.map
|