@seedprotocol/sdk 0.7.9-next.1177.ga3e08ed → 0.7.9-next.1306.g4ff6582
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/BaseFileManager-BAlySv8w.js +650 -0
- package/dist/BaseFileManager-BAlySv8w.js.map +1 -0
- package/dist/{Item-0oDoTPhi.js → Item-Bf4kWKpH.js} +5647 -6573
- package/dist/Item-Bf4kWKpH.js.map +1 -0
- package/dist/{ModelProperty-i5flwzQG.js → ModelProperty-BlaEgb_U.js} +345 -709
- package/dist/ModelProperty-BlaEgb_U.js.map +1 -0
- package/dist/Schema-J_1f6p0c.js +1456 -0
- package/dist/Schema-J_1f6p0c.js.map +1 -0
- package/dist/{SchemaValidationService-DnGKel4V.js → SchemaValidationService-CnmKyzR-.js} +6 -9
- package/dist/{SchemaValidationService-DnGKel4V.js.map → SchemaValidationService-CnmKyzR-.js.map} +1 -1
- package/dist/{configurePlatform-CrMafpMW.js → configurePlatform-CiOJ1R3q.js} +3 -12
- package/dist/configurePlatform-CiOJ1R3q.js.map +1 -0
- package/dist/db/drizzle/0025_add_metadata_retract.sql +1 -0
- package/dist/db/drizzle/0026_add_content_hash_to_schemas.sql +1 -0
- package/dist/db/drizzle/0027_link_metadata_property_ids.sql +74 -0
- package/dist/db/drizzle/0028_add_definition_to_properties.sql +17 -0
- package/dist/db/drizzle/0029_dedupe_chain_uids_add_unique_indexes.sql +120 -0
- package/dist/db/drizzle/meta/0025_snapshot.json +1652 -0
- package/dist/db/drizzle/meta/0026_snapshot.json +1659 -0
- package/dist/db/drizzle/meta/0027_snapshot.json +1659 -0
- package/dist/db/drizzle/meta/0028_snapshot.json +1666 -0
- package/dist/db/drizzle/meta/0029_snapshot.json +1691 -0
- package/dist/db/drizzle/meta/_journal.json +36 -1
- package/dist/{detachRowsBeforeDelete-DXFYSHRR.js → detachRowsBeforeDelete-sEaUwlOU.js} +2 -13
- package/dist/{detachRowsBeforeDelete-DXFYSHRR.js.map → detachRowsBeforeDelete-sEaUwlOU.js.map} +1 -1
- package/dist/dist/{index-Dx_GTdyQ.d.ts → BaseFileManager-BAlySv8w.d.ts} +1424 -2696
- package/dist/dist/BaseFileManager-BAlySv8w.d.ts.map +1 -0
- package/dist/dist/{configurePlatform-CrMafpMW.d.ts → configurePlatform-CiOJ1R3q.d.ts} +1 -1
- package/dist/dist/configurePlatform-CiOJ1R3q.d.ts.map +1 -0
- package/dist/dist/{index-PbnKw2es.d.ts → index-D0V-mjCV.d.ts} +56 -1
- package/dist/dist/{index-PbnKw2es.d.ts.map → index-D0V-mjCV.d.ts.map} +1 -1
- package/dist/dist/{index.node-CzMwMr_d.d.ts → index.node-CYPemH-t.d.ts} +225 -5
- package/dist/dist/{index.node-CzMwMr_d.d.ts.map → index.node-CYPemH-t.d.ts.map} +1 -1
- package/dist/dist/platform.node.d.ts +2 -2
- package/dist/eas-wB_fQ8Tc.js +32 -0
- package/dist/eas-wB_fQ8Tc.js.map +1 -0
- package/dist/errors-DLSoqSHG.js +6550 -0
- package/dist/errors-DLSoqSHG.js.map +1 -0
- package/dist/getPublishPayload-BnIwpwz1.js +760 -0
- package/dist/getPublishPayload-BnIwpwz1.js.map +1 -0
- package/dist/getPublishPendingDiff-D6_-A5ns.js +125 -0
- package/dist/getPublishPendingDiff-D6_-A5ns.js.map +1 -0
- package/dist/getPublishUploads-sS6JfPgz.js +783 -0
- package/dist/getPublishUploads-sS6JfPgz.js.map +1 -0
- package/dist/{index-DJmWkVIK.js → index-BVBmz_cc.js} +11 -14
- package/dist/index-BVBmz_cc.js.map +1 -0
- package/dist/index-CYGWPoOx.js +27 -0
- package/dist/index-CYGWPoOx.js.map +1 -0
- package/dist/{index-PbnKw2es.js → index-D0V-mjCV.js} +2 -2
- package/dist/index-D0V-mjCV.js.map +1 -0
- package/dist/index-DmTtj1nk.js +817 -0
- package/dist/index-DmTtj1nk.js.map +1 -0
- package/dist/{index.browser-i9uPJice.js → index.browser-CUmBVYen.js} +436 -379
- package/dist/index.browser-CUmBVYen.js.map +1 -0
- package/dist/{index.node-CzMwMr_d.js → index.node-CYPemH-t.js} +10 -10
- package/dist/index.node-CYPemH-t.js.map +1 -0
- package/dist/main.js +23 -1105
- package/dist/main.js.map +1 -1
- package/dist/modelPropertyRecordSchemas-C7UgA5TH.js +48 -0
- package/dist/modelPropertyRecordSchemas-C7UgA5TH.js.map +1 -0
- package/dist/node.js +14 -18
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +8 -13
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.node.js +6 -16
- package/dist/platform.node.js.map +1 -1
- package/dist/property-BxUYznH0.js +87 -0
- package/dist/property-BxUYznH0.js.map +1 -0
- package/dist/publishGraph-EcB40Uii.js +311 -0
- package/dist/publishGraph-EcB40Uii.js.map +1 -0
- package/dist/readHtmlBodyForStorageSeed-D6KPtWoR.js +110 -0
- package/dist/readHtmlBodyForStorageSeed-D6KPtWoR.js.map +1 -0
- package/dist/seedSchema/MetadataSchema.ts +3 -0
- package/dist/seedSchema/ModelSchema.ts +4 -0
- package/dist/seedSchema/ModelSchemaSchema.ts +5 -2
- package/dist/seedSchema/PendingWriteSchema.ts +4 -1
- package/dist/seedSchema/SchemaSchema.ts +3 -0
- package/dist/seedSchema/SeedSchema.ts +8 -2
- package/dist/seedSchema/VersionSchema.ts +7 -2
- package/dist/seedSchema/attestedUid.ts +10 -0
- package/dist/src/Item/Item.d.ts +32 -30
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/Item/loadItem.d.ts +12 -0
- package/dist/src/Item/loadItem.d.ts.map +1 -0
- package/dist/src/Item/service/itemMachineSingle.d.ts +2 -13
- package/dist/src/Item/service/itemMachineSingle.d.ts.map +1 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts +98 -41
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/loadProperty.d.ts +11 -0
- package/dist/src/ItemProperty/loadProperty.d.ts.map +1 -0
- package/dist/src/ItemProperty/propertyWrite.d.ts +54 -0
- package/dist/src/ItemProperty/propertyWrite.d.ts.map +1 -0
- package/dist/src/ItemProperty/{service/actors/saveValueToDb/rowContext.d.ts → rowContext.d.ts} +1 -1
- package/dist/src/ItemProperty/rowContext.d.ts.map +1 -0
- package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts +6 -0
- package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/modelPropertyRecordSchemas.d.ts +5 -15
- package/dist/src/ItemProperty/service/actors/modelPropertyRecordSchemas.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/propertyMachine.d.ts +3 -46
- package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
- package/dist/src/Model/Model.d.ts +26 -56
- package/dist/src/Model/Model.d.ts.map +1 -1
- package/dist/src/Model/createModelProperties.d.ts +10 -0
- package/dist/src/Model/createModelProperties.d.ts.map +1 -0
- package/dist/src/Model/loadModel.d.ts +13 -0
- package/dist/src/Model/loadModel.d.ts.map +1 -0
- package/dist/src/Model/service/actors/validateModel.d.ts.map +1 -1
- package/dist/src/Model/service/modelMachine.d.ts +5 -114
- package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts +44 -37
- 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/validateProperty.d.ts.map +1 -1
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +6 -77
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
- package/dist/src/Schema/Schema.d.ts +36 -37
- package/dist/src/Schema/Schema.d.ts.map +1 -1
- package/dist/src/Schema/loadOrCreateSchema.d.ts +21 -0
- package/dist/src/Schema/loadOrCreateSchema.d.ts.map +1 -0
- package/dist/src/Schema/service/schemaMachine.d.ts +7 -125
- package/dist/src/Schema/service/schemaMachine.d.ts.map +1 -1
- package/dist/src/browser/db/Db.d.ts.map +1 -1
- package/dist/src/browser/db/changeFeed.d.ts +2 -18
- package/dist/src/browser/db/changeFeed.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/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 +90 -57
- package/dist/src/client/ClientManager.d.ts.map +1 -1
- package/dist/src/client/actors/addModelsToDb.d.ts +9 -7
- package/dist/src/client/actors/addModelsToDb.d.ts.map +1 -1
- package/dist/src/client/actors/dbInit.d.ts +3 -3
- package/dist/src/client/actors/dbInit.d.ts.map +1 -1
- package/dist/src/client/actors/fileSystemInit.d.ts +3 -3
- package/dist/src/client/actors/fileSystemInit.d.ts.map +1 -1
- package/dist/src/client/actors/platformClassesInit.d.ts +10 -5
- package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
- package/dist/src/client/actors/processSchemaFiles.d.ts +18 -3
- package/dist/src/client/actors/processSchemaFiles.d.ts.map +1 -1
- package/dist/src/client/actors/saveConfig.d.ts +6 -3
- package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
- package/dist/src/client/clientManagerMachine.d.ts +22 -20
- package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
- package/dist/src/client/constants.d.ts +1 -9
- package/dist/src/client/constants.d.ts.map +1 -1
- package/dist/src/client/readiness.d.ts +26 -0
- package/dist/src/client/readiness.d.ts.map +1 -0
- package/dist/src/db/read/currentPropertyRow.d.ts +61 -0
- package/dist/src/db/read/currentPropertyRow.d.ts.map +1 -0
- package/dist/src/db/read/findSeedRow.d.ts +20 -0
- package/dist/src/db/read/findSeedRow.d.ts.map +1 -0
- package/dist/src/db/read/findSeedRowsByUid.d.ts +4 -1
- package/dist/src/db/read/findSeedRowsByUid.d.ts.map +1 -1
- package/dist/src/db/read/getAttesterForSeed.d.ts +1 -1
- package/dist/src/db/read/getAttesterForSeed.d.ts.map +1 -1
- package/dist/src/db/read/getItemData.d.ts.map +1 -1
- package/dist/src/db/read/getItemProperties.d.ts +5 -0
- package/dist/src/db/read/getItemProperties.d.ts.map +1 -1
- package/dist/src/db/read/getMetadataAttestationUidsForSeedUid.d.ts.map +1 -1
- package/dist/src/db/read/getModelSchemas.d.ts +0 -7
- package/dist/src/db/read/getModelSchemas.d.ts.map +1 -1
- package/dist/src/db/read/getModelsData.d.ts.map +1 -1
- package/dist/src/db/read/getPropertyClear.d.ts +49 -0
- package/dist/src/db/read/getPropertyClear.d.ts.map +1 -0
- package/dist/src/db/read/getPublishPayload.d.ts +35 -40
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/read/getPublishPendingDiff.d.ts +7 -2
- package/dist/src/db/read/getPublishPendingDiff.d.ts.map +1 -1
- package/dist/src/db/read/getPublishUploads.d.ts +59 -28
- 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.map +1 -1
- package/dist/src/db/read/getSeedPublisher.d.ts.map +1 -1
- package/dist/src/db/read/getVersionsForSeedUid.d.ts.map +1 -1
- package/dist/src/db/read/isSeedRevoked.d.ts.map +1 -1
- package/dist/src/db/read/localModelSchemaLookups.d.ts +8 -0
- package/dist/src/db/read/localModelSchemaLookups.d.ts.map +1 -0
- package/dist/src/db/read/metadataProperty.d.ts +104 -0
- package/dist/src/db/read/metadataProperty.d.ts.map +1 -0
- package/dist/src/db/read/publishGraph.d.ts +148 -0
- package/dist/src/db/read/publishGraph.d.ts.map +1 -0
- package/dist/src/db/read/resolveModelRecord.d.ts +26 -2
- package/dist/src/db/read/resolveModelRecord.d.ts.map +1 -1
- package/dist/src/db/read/resolveRelatedSeedRef.d.ts +1 -7
- package/dist/src/db/read/resolveRelatedSeedRef.d.ts.map +1 -1
- package/dist/src/db/read/subqueries/metadataLatest.d.ts +3 -1
- package/dist/src/db/read/subqueries/metadataLatest.d.ts.map +1 -1
- package/dist/src/db/read/summarizePublishWork.d.ts +18 -5
- package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
- package/dist/src/db/write/applyPropertyAttestationUidsFromPublish.d.ts +20 -21
- package/dist/src/db/write/applyPropertyAttestationUidsFromPublish.d.ts.map +1 -1
- package/dist/src/db/write/createMetadata.d.ts.map +1 -1
- package/dist/src/db/write/createNewItem.d.ts.map +1 -1
- package/dist/src/db/write/createSeeds.d.ts +5 -1
- package/dist/src/db/write/createSeeds.d.ts.map +1 -1
- package/dist/src/db/write/definitions.d.ts +127 -0
- package/dist/src/db/write/definitions.d.ts.map +1 -0
- package/dist/src/db/write/markPropertyAttestationsRetracted.d.ts +11 -0
- package/dist/src/db/write/markPropertyAttestationsRetracted.d.ts.map +1 -0
- package/dist/src/db/write/mergeChainRows.d.ts +22 -0
- package/dist/src/db/write/mergeChainRows.d.ts.map +1 -0
- package/dist/src/db/write/saveDefinition.d.ts +29 -0
- package/dist/src/db/write/saveDefinition.d.ts.map +1 -0
- package/dist/src/db/write/updateItemPropertyValue.d.ts +2 -0
- package/dist/src/db/write/updateItemPropertyValue.d.ts.map +1 -1
- package/dist/src/db/write/updateSeedUid.d.ts +4 -2
- package/dist/src/db/write/updateSeedUid.d.ts.map +1 -1
- package/dist/src/db/write/updateVersionUid.d.ts +12 -4
- package/dist/src/db/write/updateVersionUid.d.ts.map +1 -1
- package/dist/src/db/write/writeModelUids.d.ts +10 -0
- package/dist/src/db/write/writeModelUids.d.ts.map +1 -0
- package/dist/src/eas.d.ts +8 -6
- package/dist/src/eas.d.ts.map +1 -1
- package/dist/src/events/files/download.d.ts.map +1 -1
- package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/src/helpers/arweaveContentTags.d.ts +1 -1
- package/dist/src/helpers/arweaveContentTags.d.ts.map +1 -1
- package/dist/src/helpers/compareMetadataRowsLatestFirst.d.ts +27 -12
- package/dist/src/helpers/compareMetadataRowsLatestFirst.d.ts.map +1 -1
- package/dist/src/helpers/constants.d.ts +5 -2
- package/dist/src/helpers/constants.d.ts.map +1 -1
- package/dist/src/helpers/dataUrl.d.ts +10 -0
- package/dist/src/helpers/dataUrl.d.ts.map +1 -0
- package/dist/src/helpers/db.d.ts +54 -105
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/ensureImageLocal.d.ts.map +1 -1
- package/dist/src/helpers/entity/contextUpdate.d.ts +20 -0
- package/dist/src/helpers/entity/contextUpdate.d.ts.map +1 -0
- package/dist/src/helpers/entity/draftSaveErrors.d.ts +5 -0
- package/dist/src/helpers/entity/draftSaveErrors.d.ts.map +1 -1
- package/dist/src/helpers/entity/entityCache.d.ts +65 -3
- package/dist/src/helpers/entity/entityCache.d.ts.map +1 -1
- package/dist/src/helpers/entity/entityCommon.d.ts +0 -22
- package/dist/src/helpers/entity/entityCommon.d.ts.map +1 -1
- package/dist/src/helpers/entity/entityLifecycle.d.ts +75 -0
- package/dist/src/helpers/entity/entityLifecycle.d.ts.map +1 -0
- package/dist/src/helpers/entity/entityLiveQuery.d.ts +1 -23
- package/dist/src/helpers/entity/entityLiveQuery.d.ts.map +1 -1
- package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts +4 -9
- package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts.map +1 -1
- package/dist/src/helpers/index.d.ts +2 -24
- package/dist/src/helpers/index.d.ts.map +1 -1
- package/dist/src/helpers/localImageBlobUrl.d.ts +7 -0
- package/dist/src/helpers/localImageBlobUrl.d.ts.map +1 -0
- package/dist/src/helpers/mediaRef.d.ts +3 -70
- package/dist/src/helpers/mediaRef.d.ts.map +1 -1
- package/dist/src/helpers/metadataPropertyNames.d.ts +34 -21
- package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
- package/dist/src/helpers/mimeTypes.d.ts +2 -1
- package/dist/src/helpers/mimeTypes.d.ts.map +1 -1
- package/dist/src/helpers/model.d.ts.map +1 -1
- package/dist/src/helpers/ownership.d.ts.map +1 -1
- package/dist/src/helpers/property.d.ts +21 -26
- package/dist/src/helpers/property.d.ts.map +1 -1
- package/dist/src/helpers/propertyDefinition.d.ts +59 -0
- package/dist/src/helpers/propertyDefinition.d.ts.map +1 -0
- package/dist/src/helpers/readHtmlBodyForStorageSeed.d.ts.map +1 -1
- package/dist/src/helpers/relationSeedRef.d.ts +0 -7
- package/dist/src/helpers/relationSeedRef.d.ts.map +1 -1
- package/dist/src/helpers/schema.d.ts +24 -38
- package/dist/src/helpers/schema.d.ts.map +1 -1
- package/dist/src/helpers/schemaApply.d.ts +135 -0
- package/dist/src/helpers/schemaApply.d.ts.map +1 -0
- package/dist/src/helpers/tabEvents.d.ts.map +1 -1
- package/dist/src/helpers/updateSchema.d.ts +2 -18
- package/dist/src/helpers/updateSchema.d.ts.map +1 -1
- package/dist/src/imports/index.d.ts +1 -1
- package/dist/src/imports/index.d.ts.map +1 -1
- package/dist/src/imports/json.d.ts +8 -78
- package/dist/src/imports/json.d.ts.map +1 -1
- package/dist/src/index.d.ts +16 -14
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/interfaces/IItem.d.ts +5 -0
- package/dist/src/interfaces/IItem.d.ts.map +1 -1
- package/dist/src/interfaces/IItemProperty.d.ts +13 -7
- package/dist/src/interfaces/IItemProperty.d.ts.map +1 -1
- package/dist/src/node/db/Db.d.ts.map +1 -1
- package/dist/src/node/index.d.ts +3 -2
- package/dist/src/node/index.d.ts.map +1 -1
- package/dist/src/outbox/conflicts.d.ts +2 -0
- package/dist/src/outbox/conflicts.d.ts.map +1 -1
- package/dist/src/outbox/itemAppliers.d.ts +70 -14
- package/dist/src/outbox/itemAppliers.d.ts.map +1 -1
- package/dist/src/outbox/outbox.d.ts +14 -3
- package/dist/src/outbox/outbox.d.ts.map +1 -1
- package/dist/src/outbox/pendingValues.d.ts +3 -1
- package/dist/src/outbox/pendingValues.d.ts.map +1 -1
- package/dist/src/outbox/storageValueRow.d.ts +7 -0
- package/dist/src/outbox/storageValueRow.d.ts.map +1 -0
- package/dist/src/platform/configurePlatform.d.ts.map +1 -1
- package/dist/src/platform/index.browser.d.ts.map +1 -1
- package/dist/src/platform/index.node.d.ts.map +1 -1
- package/dist/src/seedSchema/MetadataSchema.d.ts +17 -0
- package/dist/src/seedSchema/MetadataSchema.d.ts.map +1 -1
- package/dist/src/seedSchema/ModelSchema.d.ts +19 -0
- package/dist/src/seedSchema/ModelSchema.d.ts.map +1 -1
- package/dist/src/seedSchema/ModelSchemaSchema.d.ts.map +1 -1
- package/dist/src/seedSchema/PendingWriteSchema.d.ts.map +1 -1
- package/dist/src/seedSchema/SchemaSchema.d.ts +19 -0
- package/dist/src/seedSchema/SchemaSchema.d.ts.map +1 -1
- package/dist/src/seedSchema/SeedSchema.d.ts.map +1 -1
- package/dist/src/seedSchema/VersionSchema.d.ts.map +1 -1
- package/dist/src/seedSchema/attestedUid.d.ts +9 -0
- package/dist/src/seedSchema/attestedUid.d.ts.map +1 -0
- package/dist/src/storageValue/content.d.ts +45 -0
- package/dist/src/storageValue/content.d.ts.map +1 -0
- package/dist/src/storageValue/findFile.d.ts +7 -0
- package/dist/src/storageValue/findFile.d.ts.map +1 -0
- package/dist/src/storageValue/resolve.d.ts +71 -0
- package/dist/src/storageValue/resolve.d.ts.map +1 -0
- package/dist/src/storageValue/save.d.ts +24 -0
- package/dist/src/storageValue/save.d.ts.map +1 -0
- package/dist/src/storageValue/stage.d.ts +22 -0
- package/dist/src/storageValue/stage.d.ts.map +1 -0
- package/dist/src/types/db.d.ts +0 -14
- package/dist/src/types/db.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +3 -3
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/machines.d.ts +1 -1
- package/dist/src/types/machines.d.ts.map +1 -1
- package/dist/src/types/property.d.ts +9 -16
- package/dist/src/types/property.d.ts.map +1 -1
- package/dist/src/types/publish.d.ts +1 -1
- package/dist/src/types/publish.d.ts.map +1 -1
- package/dist/{syncDbWithEas-DUu_wjUG.js → syncDbWithEas-CA7PvBgu.js} +142 -168
- package/dist/syncDbWithEas-CA7PvBgu.js.map +1 -0
- package/dist/tabEvents-CaVmngqr.js +3804 -0
- package/dist/tabEvents-CaVmngqr.js.map +1 -0
- package/dist/{tolerantWebAccess-DecKDGen.js → tolerantWebAccess-BJqViq08.js} +10 -15
- package/dist/{tolerantWebAccess-DecKDGen.js.map → tolerantWebAccess-BJqViq08.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-4gO9Hfn2.js → updateSeedRevokedAt-BL9Bg-G7.js} +30 -4
- package/dist/updateSeedRevokedAt-BL9Bg-G7.js.map +1 -0
- package/package.json +6 -6
- package/dist/ClientManager-GZfXErDX.js +0 -5279
- package/dist/ClientManager-GZfXErDX.js.map +0 -1
- package/dist/Item-0oDoTPhi.js.map +0 -1
- package/dist/ModelProperty-i5flwzQG.js.map +0 -1
- package/dist/Schema-PFZwG9Nl.js +0 -4370
- package/dist/Schema-PFZwG9Nl.js.map +0 -1
- package/dist/backfillMetadataPropertyIds-BbxgavEQ.js +0 -72
- package/dist/backfillMetadataPropertyIds-BbxgavEQ.js.map +0 -1
- package/dist/changeFeed-DKdVlUmt.js +0 -726
- package/dist/changeFeed-DKdVlUmt.js.map +0 -1
- package/dist/configurePlatform-CrMafpMW.js.map +0 -1
- package/dist/dist/ClientManager-GZfXErDX.d.ts +0 -952
- package/dist/dist/ClientManager-GZfXErDX.d.ts.map +0 -1
- package/dist/dist/Item-0oDoTPhi.d.ts +0 -1076
- package/dist/dist/Item-0oDoTPhi.d.ts.map +0 -1
- package/dist/dist/ModelProperty-i5flwzQG.d.ts +0 -315
- package/dist/dist/ModelProperty-i5flwzQG.d.ts.map +0 -1
- package/dist/dist/Schema-PFZwG9Nl.d.ts +0 -432
- package/dist/dist/Schema-PFZwG9Nl.d.ts.map +0 -1
- package/dist/dist/SchemaValidationService-DnGKel4V.d.ts +0 -118
- package/dist/dist/SchemaValidationService-DnGKel4V.d.ts.map +0 -1
- package/dist/dist/backfillMetadataPropertyIds-BbxgavEQ.d.ts +0 -7
- package/dist/dist/backfillMetadataPropertyIds-BbxgavEQ.d.ts.map +0 -1
- package/dist/dist/changeFeed-DKdVlUmt.d.ts +0 -160
- package/dist/dist/changeFeed-DKdVlUmt.d.ts.map +0 -1
- package/dist/dist/configurePlatform-CrMafpMW.d.ts.map +0 -1
- package/dist/dist/detachRowsBeforeDelete-DXFYSHRR.d.ts +0 -13
- package/dist/dist/detachRowsBeforeDelete-DXFYSHRR.d.ts.map +0 -1
- package/dist/dist/eas-dyepi5jz.d.ts +0 -12
- package/dist/dist/eas-dyepi5jz.d.ts.map +0 -1
- package/dist/dist/errors-C1qUEZ7A.d.ts +0 -25
- package/dist/dist/errors-C1qUEZ7A.d.ts.map +0 -1
- package/dist/dist/errors-D1zHAqjr.d.ts +0 -515
- package/dist/dist/errors-D1zHAqjr.d.ts.map +0 -1
- package/dist/dist/eventBus-7vxTCc3a.d.ts +0 -18
- package/dist/dist/eventBus-7vxTCc3a.d.ts.map +0 -1
- package/dist/dist/findSeedRowsByUid-CT3sOXXw.d.ts +0 -13
- package/dist/dist/findSeedRowsByUid-CT3sOXXw.d.ts.map +0 -1
- package/dist/dist/getItem-Bhjecbia.d.ts +0 -6
- package/dist/dist/getItem-Bhjecbia.d.ts.map +0 -1
- package/dist/dist/getPublishPayload-DH4rMqXG.d.ts +0 -47
- package/dist/dist/getPublishPayload-DH4rMqXG.d.ts.map +0 -1
- package/dist/dist/getPublishUploads-BzUIDA2G.d.ts +0 -89
- package/dist/dist/getPublishUploads-BzUIDA2G.d.ts.map +0 -1
- package/dist/dist/index-CkYb3wcU.d.ts +0 -14
- package/dist/dist/index-CkYb3wcU.d.ts.map +0 -1
- package/dist/dist/index-DJmWkVIK.d.ts +0 -6
- package/dist/dist/index-DJmWkVIK.d.ts.map +0 -1
- package/dist/dist/index-Dx_GTdyQ.d.ts.map +0 -1
- package/dist/dist/index.browser-i9uPJice.d.ts +0 -9908
- package/dist/dist/index.browser-i9uPJice.d.ts.map +0 -1
- package/dist/dist/mimeTypes-C9r76DCH.d.ts +0 -30
- package/dist/dist/mimeTypes-C9r76DCH.d.ts.map +0 -1
- package/dist/dist/model-oHA3YhOd.d.ts +0 -6
- package/dist/dist/model-oHA3YhOd.d.ts.map +0 -1
- package/dist/dist/modelPropertyRecordSchemas-C5lW9aA-.d.ts +0 -7
- package/dist/dist/modelPropertyRecordSchemas-C5lW9aA-.d.ts.map +0 -1
- package/dist/dist/platform.browser.d.ts +0 -3
- package/dist/dist/platform.browser.d.ts.map +0 -1
- package/dist/dist/property-BwYtg5Q_.d.ts +0 -37
- package/dist/dist/property-BwYtg5Q_.d.ts.map +0 -1
- package/dist/dist/propertyValidationRules-CyHdpcPP.d.ts +0 -13
- package/dist/dist/propertyValidationRules-CyHdpcPP.d.ts.map +0 -1
- package/dist/dist/publishDraftGraph-C5F6b7GK.d.ts +0 -93
- package/dist/dist/publishDraftGraph-C5F6b7GK.d.ts.map +0 -1
- package/dist/dist/resolveModelForSyncedSeed-4gO9Hfn2.d.ts +0 -21
- package/dist/dist/resolveModelForSyncedSeed-4gO9Hfn2.d.ts.map +0 -1
- package/dist/dist/syncDbWithEas-DUu_wjUG.d.ts +0 -13
- package/dist/dist/syncDbWithEas-DUu_wjUG.d.ts.map +0 -1
- package/dist/dist/tolerantWebAccess-DecKDGen.d.ts +0 -113
- package/dist/dist/tolerantWebAccess-DecKDGen.d.ts.map +0 -1
- package/dist/dist/updateSeedRevokedAt-CP606vKs.d.ts +0 -11
- package/dist/dist/updateSeedRevokedAt-CP606vKs.d.ts.map +0 -1
- package/dist/eas-dyepi5jz.js +0 -67
- package/dist/eas-dyepi5jz.js.map +0 -1
- package/dist/errors-D1zHAqjr.js +0 -4006
- package/dist/errors-D1zHAqjr.js.map +0 -1
- package/dist/eventBus-7vxTCc3a.js +0 -64
- package/dist/eventBus-7vxTCc3a.js.map +0 -1
- package/dist/findSeedRowsByUid-CT3sOXXw.js +0 -47
- package/dist/findSeedRowsByUid-CT3sOXXw.js.map +0 -1
- package/dist/getItem-Bhjecbia.js +0 -45
- package/dist/getItem-Bhjecbia.js.map +0 -1
- package/dist/getPublishPayload-DH4rMqXG.js +0 -1634
- package/dist/getPublishPayload-DH4rMqXG.js.map +0 -1
- package/dist/getPublishUploads-BzUIDA2G.js +0 -1080
- package/dist/getPublishUploads-BzUIDA2G.js.map +0 -1
- package/dist/index-CkYb3wcU.js +0 -29
- package/dist/index-CkYb3wcU.js.map +0 -1
- package/dist/index-DJmWkVIK.js.map +0 -1
- package/dist/index-Dx_GTdyQ.js +0 -4745
- package/dist/index-Dx_GTdyQ.js.map +0 -1
- package/dist/index-PbnKw2es.js.map +0 -1
- package/dist/index.browser-i9uPJice.js.map +0 -1
- package/dist/index.node-CzMwMr_d.js.map +0 -1
- package/dist/mimeTypes-C9r76DCH.js +0 -209
- package/dist/mimeTypes-C9r76DCH.js.map +0 -1
- package/dist/model-oHA3YhOd.js +0 -29
- package/dist/model-oHA3YhOd.js.map +0 -1
- package/dist/modelPropertyRecordSchemas-C5lW9aA-.js +0 -94
- package/dist/modelPropertyRecordSchemas-C5lW9aA-.js.map +0 -1
- package/dist/property-BwYtg5Q_.js +0 -289
- package/dist/property-BwYtg5Q_.js.map +0 -1
- package/dist/propertyValidationRules-CyHdpcPP.js +0 -73
- package/dist/propertyValidationRules-CyHdpcPP.js.map +0 -1
- package/dist/publishDraftGraph-C5F6b7GK.js +0 -505
- package/dist/publishDraftGraph-C5F6b7GK.js.map +0 -1
- package/dist/resolveModelForSyncedSeed-4gO9Hfn2.js.map +0 -1
- package/dist/src/Item/service/actors/loadOrCreateItem.d.ts +0 -5
- package/dist/src/Item/service/actors/loadOrCreateItem.d.ts.map +0 -1
- package/dist/src/Item/service/actors/waitForDb.d.ts +0 -4
- package/dist/src/Item/service/actors/waitForDb.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts +0 -5
- package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts +0 -5
- package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/index.d.ts +0 -6
- package/dist/src/ItemProperty/service/actors/saveValueToDb/index.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/rowContext.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.d.ts +0 -24
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveHtml.d.ts +0 -5
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveHtml.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts +0 -5
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts +0 -10
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/storageValue.d.ts +0 -22
- package/dist/src/ItemProperty/service/actors/saveValueToDb/storageValue.d.ts.map +0 -1
- package/dist/src/ItemProperty/service/actors/waitForDb.d.ts +0 -4
- package/dist/src/ItemProperty/service/actors/waitForDb.d.ts.map +0 -1
- package/dist/src/Model/service/actors/createModelProperties.d.ts +0 -9
- package/dist/src/Model/service/actors/createModelProperties.d.ts.map +0 -1
- package/dist/src/Model/service/actors/loadOrCreateModel.d.ts +0 -5
- package/dist/src/Model/service/actors/loadOrCreateModel.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/checkExistingSchema.d.ts +0 -5
- package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/createModelInstances.d.ts +0 -11
- package/dist/src/Schema/service/actors/createModelInstances.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/createPropertyInstances.d.ts +0 -12
- package/dist/src/Schema/service/actors/createPropertyInstances.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/validateSchema.d.ts +0 -5
- package/dist/src/Schema/service/actors/validateSchema.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/verifyModelInstancesInCache.d.ts +0 -6
- package/dist/src/Schema/service/actors/verifyModelInstancesInCache.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/verifyModelsInDb.d.ts +0 -7
- package/dist/src/Schema/service/actors/verifyModelsInDb.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/verifyPropertiesInDb.d.ts +0 -8
- package/dist/src/Schema/service/actors/verifyPropertiesInDb.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/verifyPropertyInstancesInCache.d.ts +0 -6
- package/dist/src/Schema/service/actors/verifyPropertyInstancesInCache.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/verifySchemaInDb.d.ts +0 -7
- package/dist/src/Schema/service/actors/verifySchemaInDb.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/writeModelsToDb.d.ts +0 -9
- package/dist/src/Schema/service/actors/writeModelsToDb.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/writePropertiesToDb.d.ts +0 -10
- package/dist/src/Schema/service/actors/writePropertiesToDb.d.ts.map +0 -1
- package/dist/src/Schema/service/actors/writeSchemaToDb.d.ts +0 -11
- package/dist/src/Schema/service/actors/writeSchemaToDb.d.ts.map +0 -1
- package/dist/src/browser/helpers/ArweaveClient.d.ts +0 -14
- package/dist/src/browser/helpers/ArweaveClient.d.ts.map +0 -1
- package/dist/src/browser/helpers/EasClient.d.ts +0 -10
- package/dist/src/browser/helpers/EasClient.d.ts.map +0 -1
- package/dist/src/browser/helpers/QueryClient.d.ts +0 -9
- package/dist/src/browser/helpers/QueryClient.d.ts.map +0 -1
- package/dist/src/client/actors/addModelsToStore.d.ts +0 -4
- package/dist/src/client/actors/addModelsToStore.d.ts.map +0 -1
- package/dist/src/db/backfillMetadataPropertyIds.d.ts +0 -7
- package/dist/src/db/backfillMetadataPropertyIds.d.ts.map +0 -1
- package/dist/src/db/read/getItem.d.ts +0 -3
- package/dist/src/db/read/getItem.d.ts.map +0 -1
- package/dist/src/db/read/getPropertyData.d.ts +0 -4
- package/dist/src/db/read/getPropertyData.d.ts.map +0 -1
- package/dist/src/db/read/getRelatedItemsForPublish.d.ts +0 -10
- package/dist/src/db/read/getRelatedItemsForPublish.d.ts.map +0 -1
- package/dist/src/db/read/getSeedData.d.ts +0 -12
- package/dist/src/db/read/getSeedData.d.ts.map +0 -1
- package/dist/src/db/read/itemLoads.d.ts +0 -20
- package/dist/src/db/read/itemLoads.d.ts.map +0 -1
- package/dist/src/db/read/publishDraftGraph.d.ts +0 -64
- package/dist/src/db/read/publishDraftGraph.d.ts.map +0 -1
- package/dist/src/db/write/linkModelToSchema.d.ts +0 -12
- package/dist/src/db/write/linkModelToSchema.d.ts.map +0 -1
- package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts +0 -2
- package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts.map +0 -1
- package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts +0 -2
- package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts.map +0 -1
- package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts +0 -2
- package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts.map +0 -1
- package/dist/src/helpers/ArweaveClient/uploadApiVerification.d.ts +0 -2
- package/dist/src/helpers/ArweaveClient/uploadApiVerification.d.ts.map +0 -1
- package/dist/src/helpers/EasClient/BaseEasClient.d.ts +0 -2
- package/dist/src/helpers/EasClient/BaseEasClient.d.ts.map +0 -1
- package/dist/src/helpers/QueryClient/BaseQueryClient.d.ts +0 -2
- package/dist/src/helpers/QueryClient/BaseQueryClient.d.ts.map +0 -1
- package/dist/src/helpers/easUid.d.ts +0 -2
- package/dist/src/helpers/easUid.d.ts.map +0 -1
- package/dist/src/helpers/entity/entityDestroy.d.ts +0 -49
- package/dist/src/helpers/entity/entityDestroy.d.ts.map +0 -1
- package/dist/src/helpers/entity/entityFind.d.ts +0 -52
- package/dist/src/helpers/entity/entityFind.d.ts.map +0 -1
- package/dist/src/helpers/entity/entityState.d.ts +0 -28
- package/dist/src/helpers/entity/entityState.d.ts.map +0 -1
- package/dist/src/helpers/entity/entityUnload.d.ts +0 -56
- package/dist/src/helpers/entity/entityUnload.d.ts.map +0 -1
- package/dist/src/helpers/entity/evictionEpoch.d.ts +0 -43
- package/dist/src/helpers/entity/evictionEpoch.d.ts.map +0 -1
- package/dist/src/helpers/entity/index.d.ts +0 -12
- package/dist/src/helpers/entity/index.d.ts.map +0 -1
- package/dist/src/helpers/gateway/gatewayState.d.ts +0 -2
- package/dist/src/helpers/gateway/gatewayState.d.ts.map +0 -1
- package/dist/src/helpers/gateway/resolveSeedGatewayEndpoints.d.ts +0 -2
- package/dist/src/helpers/gateway/resolveSeedGatewayEndpoints.d.ts.map +0 -1
- package/dist/src/helpers/gateway/seedGatewayConfig.d.ts +0 -2
- package/dist/src/helpers/gateway/seedGatewayConfig.d.ts.map +0 -1
- package/dist/src/helpers/getSchemaForItemProperty.d.ts +0 -15
- package/dist/src/helpers/getSchemaForItemProperty.d.ts.map +0 -1
- package/dist/src/helpers/getSegmentedItemProperties.d.ts +0 -10
- package/dist/src/helpers/getSegmentedItemProperties.d.ts.map +0 -1
- package/dist/src/helpers/isSqliteUniqueConstraintError.d.ts +0 -7
- package/dist/src/helpers/isSqliteUniqueConstraintError.d.ts.map +0 -1
- package/dist/src/helpers/propertyValidationRules.d.ts +0 -20
- package/dist/src/helpers/propertyValidationRules.d.ts.map +0 -1
- package/dist/src/helpers/propertyWriteTickets.d.ts +0 -11
- package/dist/src/helpers/propertyWriteTickets.d.ts.map +0 -1
- package/dist/src/helpers/reconcilePropertyDraftRows.d.ts +0 -10
- package/dist/src/helpers/reconcilePropertyDraftRows.d.ts.map +0 -1
- package/dist/src/helpers/waitForEntityIdle.d.ts +0 -21
- package/dist/src/helpers/waitForEntityIdle.d.ts.map +0 -1
- package/dist/src/interfaces/IQueryClient.d.ts +0 -15
- package/dist/src/interfaces/IQueryClient.d.ts.map +0 -1
- package/dist/src/node/helpers/ArweaveClient.d.ts +0 -5
- package/dist/src/node/helpers/ArweaveClient.d.ts.map +0 -1
- package/dist/src/node/helpers/EasClient.d.ts +0 -5
- package/dist/src/node/helpers/EasClient.d.ts.map +0 -1
- package/dist/src/node/helpers/QueryClient.d.ts +0 -5
- package/dist/src/node/helpers/QueryClient.d.ts.map +0 -1
- package/dist/src/services/write/actors/validateEntity.d.ts +0 -6
- package/dist/src/services/write/actors/validateEntity.d.ts.map +0 -1
- package/dist/src/services/write/actors/writeToDatabase.d.ts +0 -14
- package/dist/src/services/write/actors/writeToDatabase.d.ts.map +0 -1
- package/dist/src/services/write/writeProcessMachine.d.ts +0 -56
- package/dist/src/services/write/writeProcessMachine.d.ts.map +0 -1
- package/dist/src/stores/eas.d.ts +0 -2
- package/dist/src/stores/eas.d.ts.map +0 -1
- package/dist/src/types/arweave.d.ts +0 -57
- package/dist/src/types/arweave.d.ts.map +0 -1
- package/dist/src/types/gateway.d.ts +0 -2
- package/dist/src/types/gateway.d.ts.map +0 -1
- package/dist/syncDbWithEas-DUu_wjUG.js.map +0 -1
- package/dist/updateSeedRevokedAt-CP606vKs.js +0 -31
- package/dist/updateSeedRevokedAt-CP606vKs.js.map +0 -1
|
@@ -0,0 +1,760 @@
|
|
|
1
|
+
import { isValidEasAttestationUid, VERSION_SCHEMA_UID, decodeEasNumber, getSchemaUidForSchemaDefinitionFromCache, easName, getEasSchemaUidForSchemaDefinition } from '@seedprotocol/eas';
|
|
2
|
+
import { $ as isNode, Z as ZERO_BYTES32, a0 as INTERNAL_PROPERTY_NAMES, M as ModelPropertyDataTypes, n as normalizeDataType, a1 as defaultAttestationData, v as INTERNAL_DATA_TYPES } from './tabEvents-CaVmngqr.js';
|
|
3
|
+
import { ae as matchMetadataProperty, af as metadataRowsOfProperty, ag as METADATA_LATEST_FIRST_ORDER_SQL, K as isPublishedMetadataRow, ah as getEasSchemaUidForModel, ai as isStorageSeedRef, a8 as listRelationEasPropertyName, a9 as easPropertyNameForPublish, aa as metadataStorageName } from './Item-Bf4kWKpH.js';
|
|
4
|
+
import { or, eq, and, sql } from 'drizzle-orm';
|
|
5
|
+
import { B as BaseDb, m as metadata } from './BaseFileManager-BAlySv8w.js';
|
|
6
|
+
import './errors-DLSoqSHG.js';
|
|
7
|
+
import 'pluralize';
|
|
8
|
+
import { g as getPublishGraph, h as htmlPropertyForHtmlSeed } from './publishGraph-EcB40Uii.js';
|
|
9
|
+
|
|
10
|
+
const isEmptyValue = (value) => value == null || value === '';
|
|
11
|
+
/**
|
|
12
|
+
* What publishing a property with an empty value does (ADR 0021). Undefined when there is nothing
|
|
13
|
+
* to publish: the newest row holds a value, or the property has no live attestation (never
|
|
14
|
+
* published, or already retracted). The property's rows are those linked by property_id, and rows
|
|
15
|
+
* with none stored under one of its names.
|
|
16
|
+
*/
|
|
17
|
+
async function getPropertyClear(params) {
|
|
18
|
+
const { seedLocalId, seedUid, propertyName, propertyId, modelName, dataType, refValueType } = params;
|
|
19
|
+
if (!seedLocalId && !seedUid)
|
|
20
|
+
return undefined;
|
|
21
|
+
const appDb = BaseDb.getAppDb();
|
|
22
|
+
if (!appDb)
|
|
23
|
+
return undefined;
|
|
24
|
+
// The property's rows by property_id (decision D4), rows with none by name
|
|
25
|
+
const property = await matchMetadataProperty({ propertyId, propertyName, modelName, seedLocalId, seedUid, dataType, refValueType }, appDb);
|
|
26
|
+
const seedWhere = seedLocalId && seedUid
|
|
27
|
+
? or(eq(metadata.seedLocalId, seedLocalId), eq(metadata.seedUid, seedUid))
|
|
28
|
+
: seedLocalId
|
|
29
|
+
? eq(metadata.seedLocalId, seedLocalId)
|
|
30
|
+
: eq(metadata.seedUid, seedUid);
|
|
31
|
+
const rows = (await appDb
|
|
32
|
+
.select()
|
|
33
|
+
.from(metadata)
|
|
34
|
+
.where(and(metadataRowsOfProperty(property), seedWhere))
|
|
35
|
+
.orderBy(sql.raw(METADATA_LATEST_FIRST_ORDER_SQL)));
|
|
36
|
+
const newest = rows[0];
|
|
37
|
+
if (!newest || !isEmptyValue(newest.propertyValue))
|
|
38
|
+
return undefined;
|
|
39
|
+
const live = rows.filter((row) => isValidEasAttestationUid(row.uid) && row.revokedAt == null);
|
|
40
|
+
if (live.length === 0)
|
|
41
|
+
return undefined;
|
|
42
|
+
// `live` is newest first
|
|
43
|
+
const onVersion = live.filter((row) => row.versionUid === live[0].versionUid);
|
|
44
|
+
const values = new Set(onVersion.map((row) => row.propertyValue));
|
|
45
|
+
const retractScope = live.filter((row) => onVersion.includes(row) || values.has(row.propertyValue));
|
|
46
|
+
return { retract: !!newest.retract && !isPublishedMetadataRow(newest), live, retractScope };
|
|
47
|
+
}
|
|
48
|
+
/** The empty value of an EAS type, or undefined for `bool` and `uint256`, which have none (ADR 0021). */
|
|
49
|
+
function emptyEasValue(easDataType) {
|
|
50
|
+
if (easDataType === 'string')
|
|
51
|
+
return '';
|
|
52
|
+
if (easDataType === 'bytes32')
|
|
53
|
+
return `0x${'0'.repeat(64)}`;
|
|
54
|
+
if (easDataType === 'bytes32[]')
|
|
55
|
+
return [];
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The seed's retracted properties that still have attestations to revoke (ADR 0021), with the
|
|
60
|
+
* attestations publish revokes for each.
|
|
61
|
+
*/
|
|
62
|
+
async function getPendingRetractions(params) {
|
|
63
|
+
const { seedLocalId, seedUid } = params;
|
|
64
|
+
if (!seedLocalId && !seedUid)
|
|
65
|
+
return [];
|
|
66
|
+
const { getPublishPendingDiff } = await import('./getPublishPendingDiff-D6_-A5ns.js');
|
|
67
|
+
const { pendingProperties } = await getPublishPendingDiff({
|
|
68
|
+
seedLocalId: seedLocalId ?? undefined,
|
|
69
|
+
seedUid: seedUid ?? undefined,
|
|
70
|
+
});
|
|
71
|
+
const retractions = [];
|
|
72
|
+
for (const { propertyName, change } of pendingProperties) {
|
|
73
|
+
if (change !== 'retracted')
|
|
74
|
+
continue;
|
|
75
|
+
const clear = await getPropertyClear({ seedLocalId, seedUid, propertyName });
|
|
76
|
+
if (!clear?.retract)
|
|
77
|
+
continue;
|
|
78
|
+
const attestations = clear.retractScope
|
|
79
|
+
.filter((row) => row.uid && row.schemaUid)
|
|
80
|
+
.map((row) => ({ uid: row.uid, schemaUid: row.schemaUid }));
|
|
81
|
+
if (attestations.length > 0)
|
|
82
|
+
retractions.push({ propertyName, attestations });
|
|
83
|
+
}
|
|
84
|
+
return retractions;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let easSdkPromise;
|
|
88
|
+
/**
|
|
89
|
+
* Load eas-sdk on first use instead of at SDK import time.
|
|
90
|
+
*
|
|
91
|
+
* On Node this loads eas-sdk's CommonJS build. Its ESM build (2.9.1+) does
|
|
92
|
+
* `import { isEqual } from 'lodash'`, which Node rejects because lodash is
|
|
93
|
+
* CommonJS, so a static import made `import '@seedprotocol/sdk'` fail unless the
|
|
94
|
+
* app ran with `--import @seedprotocol/sdk/node-eas-lodash`.
|
|
95
|
+
*
|
|
96
|
+
* `process.getBuiltinModule` (Node 20.16+, 22.3+) keeps `node:module` out of the
|
|
97
|
+
* import graph, so browser bundlers never see it. Bundlers resolve the
|
|
98
|
+
* `import()` branch, and handle lodash there themselves.
|
|
99
|
+
*/
|
|
100
|
+
function loadEasSdk() {
|
|
101
|
+
if (!easSdkPromise) {
|
|
102
|
+
easSdkPromise = (async () => {
|
|
103
|
+
if (isNode() && typeof document === 'undefined' && typeof process.getBuiltinModule === 'function') {
|
|
104
|
+
try {
|
|
105
|
+
const { createRequire } = process.getBuiltinModule('node:module');
|
|
106
|
+
return createRequire(import.meta.url)('@ethereum-attestation-service/eas-sdk');
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
// e.g. import.meta.url is not a file: URL (bundled renderer). Fall through.
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return import('@ethereum-attestation-service/eas-sdk');
|
|
113
|
+
})();
|
|
114
|
+
easSdkPromise.catch(() => {
|
|
115
|
+
easSdkPromise = undefined;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return easSdkPromise;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** UTF-8 string to 0x-prefixed bytes32 hex (right-padded with zeros). */
|
|
122
|
+
function encodeBytes32String(value) {
|
|
123
|
+
const bytes = new TextEncoder().encode(value);
|
|
124
|
+
if (bytes.length > 32) {
|
|
125
|
+
throw new Error(`encodeBytes32String: value exceeds 32 bytes (${bytes.length})`);
|
|
126
|
+
}
|
|
127
|
+
const hex = Array.from(bytes)
|
|
128
|
+
.map((b) => b.toString(16).padStart(2, '0'))
|
|
129
|
+
.join('');
|
|
130
|
+
return `0x${hex.padEnd(64, '0')}`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Error thrown when publish validation fails. Includes all validation errors for user to fix. */
|
|
134
|
+
class PublishValidationFailedError extends Error {
|
|
135
|
+
constructor(message, validationErrors) {
|
|
136
|
+
super(message);
|
|
137
|
+
this.validationErrors = validationErrors;
|
|
138
|
+
this.name = 'PublishValidationFailedError';
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/** Validation error code for a relation, list member or image/file ref to an unpublished seed. */
|
|
142
|
+
const RELATED_ITEM_UNPUBLISHED_CODE = 'related_item_unpublished';
|
|
143
|
+
const describeUnpublishedRelatedItem = (r) => `${r.propertyName} -> ${r.modelName} ${r.seedLocalId} (seed ${r.seedUid})`;
|
|
144
|
+
/**
|
|
145
|
+
* Thrown before anything is uploaded or attested when the item references items whose seed was
|
|
146
|
+
* unpublished: the parent would attest a revoked seed uid. Republish those items (which gives
|
|
147
|
+
* them a new seed uid) or remove the references, then publish again.
|
|
148
|
+
* See docs/ATTESTATION_REVOCATION.md ("Republishing").
|
|
149
|
+
*
|
|
150
|
+
* A PublishValidationFailedError, so validateItemForPublish and the publish package's checking
|
|
151
|
+
* step report it as validation errors (code `related_item_unpublished`, one per reference).
|
|
152
|
+
*/
|
|
153
|
+
class RelatedItemUnpublishedError extends PublishValidationFailedError {
|
|
154
|
+
constructor(unpublishedRelatedItems, otherValidationErrors = []) {
|
|
155
|
+
const lines = unpublishedRelatedItems.map(describeUnpublishedRelatedItem);
|
|
156
|
+
const message = `Cannot publish: it references ${lines.length} unpublished item${lines.length === 1 ? '' : 's'} ` +
|
|
157
|
+
`(their seed attestations were revoked). Republish them or remove the references, then publish again:\n` +
|
|
158
|
+
lines.join('\n');
|
|
159
|
+
super(message, [
|
|
160
|
+
...unpublishedRelatedItems.map((r) => ({
|
|
161
|
+
field: r.propertyName,
|
|
162
|
+
message: `${r.propertyName} references unpublished ${r.modelName} ${r.seedLocalId} (seed ${r.seedUid}). ` +
|
|
163
|
+
`Republish it or remove the reference.`,
|
|
164
|
+
code: RELATED_ITEM_UNPUBLISHED_CODE,
|
|
165
|
+
})),
|
|
166
|
+
...otherValidationErrors,
|
|
167
|
+
]);
|
|
168
|
+
this.name = 'RelatedItemUnpublishedError';
|
|
169
|
+
this.unpublishedRelatedItems = unpublishedRelatedItems;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const matchesDataType = (actual, expected) => normalizeDataType(actual) === expected;
|
|
174
|
+
/**
|
|
175
|
+
* An EAS uid (0x + 64 hex), as opposed to a local id. A "0x" prefix alone doesn't tell them apart:
|
|
176
|
+
* local ids are random alphanumerics, and about 1 in 3,844 starts with "0x".
|
|
177
|
+
*/
|
|
178
|
+
function isUidRef(ref) {
|
|
179
|
+
return ref.length === 66 && ref.startsWith('0x');
|
|
180
|
+
}
|
|
181
|
+
function addValidationError(ctx, message, field, code = 'publish_validation') {
|
|
182
|
+
if (ctx.errors.some((e) => e.message === message && e.field === (field ?? '')))
|
|
183
|
+
return;
|
|
184
|
+
ctx.errors.push({ field: field ?? '', message, code });
|
|
185
|
+
}
|
|
186
|
+
/** Current uid for a ref to a live published seed, else the ref itself. */
|
|
187
|
+
const currentRelatedRef = (ctx, ref) => ctx.graph.relatedRefUids.get(ref.trim()) ?? ref;
|
|
188
|
+
const uploadedTxFor = (ctx, seedLocalId) => ctx.uploadedTransactions.find((u) => u.seedLocalId?.trim() === seedLocalId);
|
|
189
|
+
/** The EAS schema a property attests under. Reports an error and returns null when there is none. */
|
|
190
|
+
const getPropertyData = async (property, ctx) => {
|
|
191
|
+
const { key, definition } = property;
|
|
192
|
+
const rawDataType = definition.dataType;
|
|
193
|
+
const dataType = rawDataType ? normalizeDataType(String(rawDataType)) : undefined;
|
|
194
|
+
const easDataType = dataType ? INTERNAL_DATA_TYPES[dataType]?.eas : undefined;
|
|
195
|
+
if (!easDataType) {
|
|
196
|
+
addValidationError(ctx, `Unknown or unsupported property data type "${rawDataType ?? 'undefined'}" for property: ${key}. Supported types: ${Object.keys(INTERNAL_DATA_TYPES).join(', ')}.`, key);
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
// ADR 0008: list relations publish under their storage name (authors → author_identity_ids),
|
|
200
|
+
// single relations under their schema key (author), never the local authorId.
|
|
201
|
+
const listRelationName = listRelationEasPropertyName(key, definition);
|
|
202
|
+
const propertyNameForSchema = easPropertyNameForPublish(key, definition);
|
|
203
|
+
const schemaDef = `${easDataType} ${propertyNameForSchema}`;
|
|
204
|
+
// The UID ensureEasSchemasForItem resolved for this exact definition comes first. A row's
|
|
205
|
+
// schemaUid was looked up under the property's own name, which matches any type: Optimism
|
|
206
|
+
// Sepolia has `bytes32 storage_transaction_id` beside `string storage_transaction_id`, and
|
|
207
|
+
// attesting a string under the bytes32 one reads back as 0x…20. Trust the row's only when
|
|
208
|
+
// that name is the one published (not for a list relation, or a single relation stored as authorId).
|
|
209
|
+
const storageName = metadataStorageName(key, definition);
|
|
210
|
+
let schemaUid = getSchemaUidForSchemaDefinitionFromCache(schemaDef) ??
|
|
211
|
+
(!listRelationName && easName(storageName) === propertyNameForSchema ? property.row?.schemaUid ?? undefined : undefined);
|
|
212
|
+
if (!schemaUid) {
|
|
213
|
+
schemaUid = await getEasSchemaUidForSchemaDefinition({ schemaText: schemaDef });
|
|
214
|
+
}
|
|
215
|
+
if (!schemaUid) {
|
|
216
|
+
addValidationError(ctx, `EAS schema not found for "${schemaDef}" (property: ${key}). Register it before publishing (ensureEasSchemasForItem).`, key, 'publish_schema_not_found');
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
return { schemaUid, easDataType, schemaDef, propertyNameForSchema };
|
|
220
|
+
};
|
|
221
|
+
/** The label a required-value error uses for a relation or storage-seed property. */
|
|
222
|
+
function refTypeLabel(definition) {
|
|
223
|
+
for (const [type, label] of [
|
|
224
|
+
[ModelPropertyDataTypes.File, 'file'],
|
|
225
|
+
[ModelPropertyDataTypes.Image, 'image'],
|
|
226
|
+
[ModelPropertyDataTypes.Html, 'html'],
|
|
227
|
+
[ModelPropertyDataTypes.Json, 'json'],
|
|
228
|
+
]) {
|
|
229
|
+
if (matchesDataType(definition.dataType, type) || matchesDataType(definition.refValueType, type))
|
|
230
|
+
return label;
|
|
231
|
+
}
|
|
232
|
+
return 'relation';
|
|
233
|
+
}
|
|
234
|
+
/** Required relation and storage-seed properties need a value pointing at an item. */
|
|
235
|
+
function checkRequiredRef(node, property, ctx) {
|
|
236
|
+
const { key, definition } = property;
|
|
237
|
+
if (definition.required !== true)
|
|
238
|
+
return;
|
|
239
|
+
const value = property.row?.propertyValue;
|
|
240
|
+
const refLabel = definition.ref ?? definition.refModelName ?? 'related';
|
|
241
|
+
if (value == null || value.trim() === '') {
|
|
242
|
+
addValidationError(ctx, `Required ${refTypeLabel(definition)} ${key} has no value. A value pointing to a valid ${refLabel} item is required to publish.`, key);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
for (const broken of ctx.graph.brokenRefs) {
|
|
246
|
+
if (broken.seedLocalId !== node.seedLocalId || broken.propertyKey !== key || broken.list)
|
|
247
|
+
continue;
|
|
248
|
+
addValidationError(ctx, broken.reason === 'invalid'
|
|
249
|
+
? `Required relation ${key} has invalid value: ${JSON.stringify(value)}. ` +
|
|
250
|
+
`Value must be a valid seed reference (localId or uid) pointing to a ${refLabel} item.`
|
|
251
|
+
: `No related item found for required relation: ${key}. Value: ${JSON.stringify(value)} (seedLocalId/seedUid). ` +
|
|
252
|
+
`The related item may be missing, in a different database, or the reference may be broken.`, key);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/** A Boolean row value as stored ("true"/"false", "1"/"0"). */
|
|
256
|
+
const booleanFromRow = (value) => value === 'true' || value === '1' ? true : value === 'false' || value === '0' ? false : value;
|
|
257
|
+
/**
|
|
258
|
+
* The attestation of one property of `node`, or undefined when the publish leaves it out (no
|
|
259
|
+
* value, already attested in patch mode, deferred, invalid: the last reports an error).
|
|
260
|
+
*/
|
|
261
|
+
async function attestProperty(node, property, versionUid, ctx) {
|
|
262
|
+
const { key, definition, row } = property;
|
|
263
|
+
const forceFullSnapshot = ctx.graph.forceFullSnapshot;
|
|
264
|
+
if (INTERNAL_PROPERTY_NAMES.includes(key) || property.deferred)
|
|
265
|
+
return undefined;
|
|
266
|
+
const isFileImageHtml = matchesDataType(definition.dataType, ModelPropertyDataTypes.File) ||
|
|
267
|
+
matchesDataType(definition.dataType, ModelPropertyDataTypes.Image) ||
|
|
268
|
+
matchesDataType(definition.dataType, ModelPropertyDataTypes.Html);
|
|
269
|
+
const isRef = property.kind === 'relation' || property.kind === 'storageSeed';
|
|
270
|
+
const isStorageTransaction = property.kind === 'storageTransaction';
|
|
271
|
+
// The storage transaction slot attests this publish's upload of the node's file(s).
|
|
272
|
+
const uploaded = isStorageTransaction ? uploadedTxFor(ctx, node.seedLocalId) : undefined;
|
|
273
|
+
if (isStorageTransaction && !uploaded)
|
|
274
|
+
return undefined;
|
|
275
|
+
let value = uploaded ? uploaded.txId : row?.propertyValue;
|
|
276
|
+
// 0 and false are values (ADR 0010). An empty value publishes only as a removal of a value
|
|
277
|
+
// attested before (ADR 0021); a retraction attests nothing (publish revokes instead).
|
|
278
|
+
let isRemoval = false;
|
|
279
|
+
if (value == null || value === '') {
|
|
280
|
+
if (property.uid && !forceFullSnapshot)
|
|
281
|
+
return undefined;
|
|
282
|
+
const clear = await getPropertyClear({
|
|
283
|
+
seedLocalId: node.seedLocalId,
|
|
284
|
+
seedUid: node.seedUid,
|
|
285
|
+
propertyId: definition._dbId,
|
|
286
|
+
modelName: node.modelName,
|
|
287
|
+
propertyName: key,
|
|
288
|
+
dataType: definition.dataType,
|
|
289
|
+
refValueType: definition.refValueType,
|
|
290
|
+
});
|
|
291
|
+
if (!clear || clear.retract)
|
|
292
|
+
return undefined;
|
|
293
|
+
isRemoval = true;
|
|
294
|
+
}
|
|
295
|
+
// Patch mode skips properties that already have an EAS uid, except a storage transaction this
|
|
296
|
+
// publish uploaded.
|
|
297
|
+
if (!isRemoval && property.uid && !forceFullSnapshot && !uploaded)
|
|
298
|
+
return undefined;
|
|
299
|
+
// File/Image/Html values must be a storage seed id by now. Raw content means the property's
|
|
300
|
+
// save pipeline never ran or failed (e.g. createNewItem with raw html), so it was never uploaded.
|
|
301
|
+
if (!isRemoval && isFileImageHtml && typeof value === 'string' && !isStorageSeedRef(value.trim())) {
|
|
302
|
+
addValidationError(ctx, `Invalid value for property: ${key}. Expected a storage seed id ` +
|
|
303
|
+
`(${normalizeDataType(definition.dataType)} content must be saved through the property before publishing), ` +
|
|
304
|
+
`got ${value.length > 40 ? `${value.slice(0, 40)}…` : value}.`, key, 'publish_storage_value_not_saved');
|
|
305
|
+
return undefined;
|
|
306
|
+
}
|
|
307
|
+
const propertyData = await getPropertyData(property, ctx);
|
|
308
|
+
if (!propertyData)
|
|
309
|
+
return undefined;
|
|
310
|
+
const { schemaUid, easDataType, schemaDef, propertyNameForSchema } = propertyData;
|
|
311
|
+
const isList = schemaDef.startsWith('bytes32[]');
|
|
312
|
+
let rawListIdsForResolve;
|
|
313
|
+
if (isRemoval) {
|
|
314
|
+
const empty = emptyEasValue(easDataType);
|
|
315
|
+
if (empty === undefined) {
|
|
316
|
+
addValidationError(ctx, `${key} can't be published empty: ${definition.dataType ?? easDataType} properties have no empty value. Clear it with clear({ retract: true }).`, key, 'publish_clear_unsupported');
|
|
317
|
+
return undefined;
|
|
318
|
+
}
|
|
319
|
+
value = empty;
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
if (typeof value === 'string' && isRef)
|
|
323
|
+
value = currentRelatedRef(ctx, value.trim());
|
|
324
|
+
if (isList && typeof value === 'string') {
|
|
325
|
+
const text = value.trim();
|
|
326
|
+
if (text.startsWith('[')) {
|
|
327
|
+
try {
|
|
328
|
+
value = JSON.parse(text);
|
|
329
|
+
}
|
|
330
|
+
catch {
|
|
331
|
+
// reported below
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
else if (text.includes(',')) {
|
|
335
|
+
// Legacy comma-separated ids (pre-JSON List storage)
|
|
336
|
+
value = text.split(',').map((s) => s.trim()).filter(Boolean);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
if (isList && !Array.isArray(value)) {
|
|
340
|
+
addValidationError(ctx, `Invalid value for property: ${key}. Expected an array of bytes32, got ${value}.`, key);
|
|
341
|
+
return undefined;
|
|
342
|
+
}
|
|
343
|
+
if (easDataType === 'bool' && typeof value === 'string')
|
|
344
|
+
value = booleanFromRow(value.trim());
|
|
345
|
+
// Validate against property validation rules (enum, pattern, minLength, maxLength) before encoding
|
|
346
|
+
if (definition.validation) {
|
|
347
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-CnmKyzR-.js');
|
|
348
|
+
const result = new SchemaValidationService().validatePropertyValue(value, normalizeDataType(definition.dataType), definition.validation, definition.refValueType ? normalizeDataType(definition.refValueType) : undefined);
|
|
349
|
+
if (!result.isValid && result.errors.length > 0) {
|
|
350
|
+
const firstError = result.errors[0];
|
|
351
|
+
addValidationError(ctx, firstError.message, key, firstError.code ?? 'publish_validation');
|
|
352
|
+
return undefined;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
if (isList) {
|
|
356
|
+
const encoded = [];
|
|
357
|
+
const rawIds = [];
|
|
358
|
+
for (const member of value) {
|
|
359
|
+
const id = typeof member === 'string' ? member.trim() : '';
|
|
360
|
+
if (!id)
|
|
361
|
+
continue;
|
|
362
|
+
const ref = currentRelatedRef(ctx, id);
|
|
363
|
+
rawIds.push(ref);
|
|
364
|
+
encoded.push(isUidRef(ref) ? ref : encodeBytes32String(ref));
|
|
365
|
+
}
|
|
366
|
+
value = encoded;
|
|
367
|
+
if (rawIds.some((id) => !isUidRef(id)))
|
|
368
|
+
rawListIdsForResolve = rawIds;
|
|
369
|
+
}
|
|
370
|
+
// uint256 (Date) must be numeric/BigInt; normalize ISO strings to Unix seconds
|
|
371
|
+
if (easDataType === 'uint256' && (typeof value === 'string' || value instanceof Date)) {
|
|
372
|
+
const ms = value instanceof Date ? value.getTime() : /^\d+$/.test(value) ? Number(value) : new Date(value).getTime();
|
|
373
|
+
value = BigInt(Math.floor(ms / 1000));
|
|
374
|
+
}
|
|
375
|
+
// ADR 0010: Number attests as its decimal string, in the form readers decode it to.
|
|
376
|
+
if (matchesDataType(definition.dataType, ModelPropertyDataTypes.Number)) {
|
|
377
|
+
const decimal = decodeEasNumber(value);
|
|
378
|
+
if (decimal === undefined) {
|
|
379
|
+
addValidationError(ctx, `Invalid value for property: ${key}. Expected a finite number, got ${JSON.stringify(value)}.`, key, 'publish_invalid_number');
|
|
380
|
+
return undefined;
|
|
381
|
+
}
|
|
382
|
+
value = decimal;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
let encodedData;
|
|
386
|
+
try {
|
|
387
|
+
const { SchemaEncoder } = await loadEasSdk();
|
|
388
|
+
encodedData = new SchemaEncoder(schemaDef).encodeData([
|
|
389
|
+
{ name: propertyNameForSchema, type: easDataType, value: value },
|
|
390
|
+
]);
|
|
391
|
+
}
|
|
392
|
+
catch (encodeErr) {
|
|
393
|
+
addValidationError(ctx, `Failed to encode property ${key}: ${encodeErr instanceof Error ? encodeErr.message : String(encodeErr)}`, key);
|
|
394
|
+
return undefined;
|
|
395
|
+
}
|
|
396
|
+
const attestation = {
|
|
397
|
+
schema: schemaUid,
|
|
398
|
+
data: [
|
|
399
|
+
{
|
|
400
|
+
...defaultAttestationData,
|
|
401
|
+
// The storage transaction references the Version attestation (contract may use when supported)
|
|
402
|
+
refUID: isStorageTransaction ? versionUid : defaultAttestationData.refUID,
|
|
403
|
+
data: encodedData,
|
|
404
|
+
},
|
|
405
|
+
],
|
|
406
|
+
_propertyName: key,
|
|
407
|
+
...(row?.localId ? { _metadataLocalId: row.localId } : {}),
|
|
408
|
+
...(uploaded && uploaded.txId !== row?.propertyValue ? { _attestedValue: uploaded.txId } : {}),
|
|
409
|
+
};
|
|
410
|
+
// Refs to seeds of this publish by local id: resolution hints for resolvePublishPayloadValues
|
|
411
|
+
if (typeof value === 'string' &&
|
|
412
|
+
!isUidRef(value) &&
|
|
413
|
+
/^[a-zA-Z0-9_-]{10,21}$/.test(value.trim()) &&
|
|
414
|
+
(easDataType === 'bytes32' || easDataType === 'string')) {
|
|
415
|
+
attestation._propertyNameForSchema = propertyNameForSchema;
|
|
416
|
+
attestation._schemaDef = schemaDef;
|
|
417
|
+
attestation._unresolvedValue = value.trim();
|
|
418
|
+
attestation._easDataType = easDataType;
|
|
419
|
+
}
|
|
420
|
+
if (rawListIdsForResolve?.length) {
|
|
421
|
+
attestation._propertyNameForSchema = propertyNameForSchema;
|
|
422
|
+
attestation._schemaDef = schemaDef;
|
|
423
|
+
attestation._easDataType = 'bytes32[]';
|
|
424
|
+
attestation._rawListIdsForResolve = rawListIdsForResolve;
|
|
425
|
+
}
|
|
426
|
+
return attestation;
|
|
427
|
+
}
|
|
428
|
+
/** The order a node's properties attest in: basic values, its upload, refs, lists. */
|
|
429
|
+
const ATTEST_ORDER = ['basic', 'storageTransaction', 'relation', 'storageSeed', 'list'];
|
|
430
|
+
/** One node's request: its seed, version and property attestations, and the parent properties its seed uid fills. */
|
|
431
|
+
async function buildRequest(node, ctx) {
|
|
432
|
+
const { graph } = ctx;
|
|
433
|
+
const isRoot = node.kind === 'root';
|
|
434
|
+
// A storage seed or an embedded image attests its own basic properties only.
|
|
435
|
+
const full = isRoot || node.kind === 'draft';
|
|
436
|
+
const reportField = node.links[0]?.propertyKey;
|
|
437
|
+
let seedSchemaUid = isRoot ? node.seedSchemaUid : undefined;
|
|
438
|
+
seedSchemaUid ?? (seedSchemaUid = (await getEasSchemaUidForModel(node.modelName)) ?? undefined);
|
|
439
|
+
if (!seedSchemaUid)
|
|
440
|
+
addValidationError(ctx, `Schema UID not found for model: ${node.modelName}`, isRoot ? undefined : reportField);
|
|
441
|
+
let versionUid = node.version.uid ?? (node.newSeed ? undefined : node.version.publishedUid) ?? ZERO_BYTES32;
|
|
442
|
+
if (isRoot && graph.forceFullSnapshot && node.seedUid)
|
|
443
|
+
versionUid = ZERO_BYTES32;
|
|
444
|
+
const versionLocalId = versionUid === ZERO_BYTES32 && !node.version.uid ? node.version.localId : undefined;
|
|
445
|
+
const request = {
|
|
446
|
+
localId: node.seedLocalId,
|
|
447
|
+
...(versionLocalId ? { versionLocalId } : {}),
|
|
448
|
+
seedIsRevocable: true,
|
|
449
|
+
seedSchemaUid: seedSchemaUid ?? ZERO_BYTES32,
|
|
450
|
+
seedUid: node.newSeed || !node.seedUid ? ZERO_BYTES32 : node.seedUid,
|
|
451
|
+
versionSchemaUid: VERSION_SCHEMA_UID,
|
|
452
|
+
versionUid,
|
|
453
|
+
listOfAttestations: [],
|
|
454
|
+
propertiesToUpdate: [],
|
|
455
|
+
};
|
|
456
|
+
for (const kind of ATTEST_ORDER) {
|
|
457
|
+
for (const property of node.properties) {
|
|
458
|
+
if (property.kind !== kind)
|
|
459
|
+
continue;
|
|
460
|
+
if (!full && kind !== 'basic' && kind !== 'storageTransaction')
|
|
461
|
+
continue;
|
|
462
|
+
if (full && (kind === 'relation' || kind === 'storageSeed'))
|
|
463
|
+
checkRequiredRef(node, property, ctx);
|
|
464
|
+
const attestation = await attestProperty(node, property, versionUid, ctx);
|
|
465
|
+
if (attestation)
|
|
466
|
+
request.listOfAttestations.push(attestation);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
// Each property this seed's uid fills: the contract writes the uid into that attestation.
|
|
470
|
+
for (const { seedLocalId, propertyKey } of node.links) {
|
|
471
|
+
const owner = graph.nodes.find((n) => n.seedLocalId === seedLocalId);
|
|
472
|
+
const property = owner?.properties.find((p) => p.key === propertyKey);
|
|
473
|
+
if (!property)
|
|
474
|
+
continue;
|
|
475
|
+
const propertySchemaUid = (await getPropertyData(property, ctx))?.schemaUid;
|
|
476
|
+
if (!propertySchemaUid)
|
|
477
|
+
continue;
|
|
478
|
+
if (!request.propertiesToUpdate.some((u) => u.publishLocalId === seedLocalId && u.propertySchemaUid.toLowerCase() === propertySchemaUid.toLowerCase())) {
|
|
479
|
+
request.propertiesToUpdate.push({ publishLocalId: seedLocalId, propertySchemaUid });
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return request;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Embedded image rows must still name an Html value of their owner, with a schema to attest under.
|
|
486
|
+
* No propertiesToUpdate: the Html refers to the image by its Arweave URL (the data URI is
|
|
487
|
+
* rewritten to it before the Html is uploaded), not by seed uid.
|
|
488
|
+
*/
|
|
489
|
+
async function checkEmbeddedImages(ctx) {
|
|
490
|
+
const { graph } = ctx;
|
|
491
|
+
for (const owner of graph.nodes) {
|
|
492
|
+
for (const row of owner.embeddedImages) {
|
|
493
|
+
const imageNode = graph.nodes.find((n) => n.seedLocalId === row.imageSeedLocalId && n.kind === 'embeddedImage');
|
|
494
|
+
const missing = graph.missingEmbeddedImages.some((m) => m.imageSeedLocalId === row.imageSeedLocalId);
|
|
495
|
+
if (!imageNode && !missing)
|
|
496
|
+
continue;
|
|
497
|
+
const html = htmlPropertyForHtmlSeed(owner, row.htmlSeedLocalId);
|
|
498
|
+
if (!html) {
|
|
499
|
+
addValidationError(ctx, `Could not find Html property for embedded image rewrite (html seed ${row.htmlSeedLocalId.trim()}).`, 'html', 'html_embed_schema');
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
if (!(await getPropertyData(html, ctx)))
|
|
503
|
+
continue;
|
|
504
|
+
if (missing) {
|
|
505
|
+
addValidationError(ctx, `Embedded Image item not found for seed ${row.imageSeedLocalId}.`, 'html', 'html_embed_image_missing');
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
const getPublishPayload = async (item, uploadedTransactions, options) => {
|
|
511
|
+
const publishMode = options?.publishMode ?? 'patch';
|
|
512
|
+
const graph = await getPublishGraph(item, { publishMode });
|
|
513
|
+
const ctx = { graph, errors: [], uploadedTransactions };
|
|
514
|
+
if (publishMode === 'new_version' && !graph.root.seedUid) {
|
|
515
|
+
addValidationError(ctx, 'Publishing as a new version requires the item to already have a published Seed attestation (seed UID).', 'seedUid', 'publish_new_version_requires_seed');
|
|
516
|
+
}
|
|
517
|
+
let multiPublishPayload = [];
|
|
518
|
+
for (const node of graph.nodes)
|
|
519
|
+
multiPublishPayload.push(await buildRequest(node, ctx));
|
|
520
|
+
await checkEmbeddedImages(ctx);
|
|
521
|
+
// A request whose seed fills another request's property (propertiesToUpdate) publishes first, and a
|
|
522
|
+
// request encoding another's local id publishes after it.
|
|
523
|
+
multiPublishPayload = orderPayloadByDependencies(multiPublishPayload);
|
|
524
|
+
if (publishMode === 'new_version') {
|
|
525
|
+
const rootPayload = multiPublishPayload.find((p) => p.localId === graph.root.seedLocalId);
|
|
526
|
+
if (!rootPayload?.listOfAttestations.length) {
|
|
527
|
+
addValidationError(ctx, 'Publishing as a new version requires at least one property attestation for the item. ' +
|
|
528
|
+
'Ensure required fields have values and that publishable properties are present.', 'listOfAttestations', 'publish_new_version_empty_snapshot');
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
// Stop before anything is uploaded or attested: the payload would attest revoked seed uids.
|
|
532
|
+
if (graph.unpublishedRelatedItems.length) {
|
|
533
|
+
throw new RelatedItemUnpublishedError(graph.unpublishedRelatedItems, ctx.errors);
|
|
534
|
+
}
|
|
535
|
+
if (ctx.errors.length > 0) {
|
|
536
|
+
const combinedMessage = ctx.errors.map((e) => e.message).join('\n');
|
|
537
|
+
throw new PublishValidationFailedError(`Validation failed (${ctx.errors.length} error${ctx.errors.length === 1 ? '' : 's'}):\n${combinedMessage}`, ctx.errors);
|
|
538
|
+
}
|
|
539
|
+
return multiPublishPayload;
|
|
540
|
+
};
|
|
541
|
+
/**
|
|
542
|
+
* Validates an item for publishing without performing Arweave or EAS work.
|
|
543
|
+
* Use in the checking step to fail fast before creating transactions.
|
|
544
|
+
* Pass empty array for uploadedTransactions when validating before Arweave upload.
|
|
545
|
+
*/
|
|
546
|
+
const validateItemForPublish = async (item, uploadedTransactions = [], options) => {
|
|
547
|
+
try {
|
|
548
|
+
await getPublishPayload(item, uploadedTransactions, options);
|
|
549
|
+
return { isValid: true, errors: [] };
|
|
550
|
+
}
|
|
551
|
+
catch (err) {
|
|
552
|
+
if (err instanceof PublishValidationFailedError) {
|
|
553
|
+
return { isValid: false, errors: err.validationErrors };
|
|
554
|
+
}
|
|
555
|
+
throw err;
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
/**
|
|
559
|
+
* LocalIds in this batch referenced by attestations (bytes32 / bytes32[]) that must publish before this request.
|
|
560
|
+
*/
|
|
561
|
+
function collectAttestationLocalRefIds(req, allLocalIds) {
|
|
562
|
+
const refs = [];
|
|
563
|
+
for (const att of req.listOfAttestations) {
|
|
564
|
+
if (att._unresolvedValue && allLocalIds.has(att._unresolvedValue))
|
|
565
|
+
refs.push(att._unresolvedValue);
|
|
566
|
+
for (const id of att._rawListIdsForResolve ?? []) {
|
|
567
|
+
const t = id != null ? String(id).trim() : '';
|
|
568
|
+
if (t && allLocalIds.has(t))
|
|
569
|
+
refs.push(t);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return refs;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Topological sort (Kahn): edge `from → to` means `from` must publish before `to`.
|
|
576
|
+
* - propertiesToUpdate: updater before updatee (contract injection).
|
|
577
|
+
* - _unresolvedValue / _rawListIdsForResolve: referenced seed before request that encodes the ref.
|
|
578
|
+
* Ties keep the input order (the graph's finish order).
|
|
579
|
+
*/
|
|
580
|
+
function orderPayloadByDependencies(payload) {
|
|
581
|
+
if (payload.length <= 1)
|
|
582
|
+
return payload;
|
|
583
|
+
const byLocalId = new Map();
|
|
584
|
+
const indexOrder = new Map();
|
|
585
|
+
payload.forEach((p, i) => {
|
|
586
|
+
byLocalId.set(p.localId, p);
|
|
587
|
+
indexOrder.set(p.localId, i);
|
|
588
|
+
});
|
|
589
|
+
const allIds = new Set(byLocalId.keys());
|
|
590
|
+
const indegree = new Map([...allIds].map((id) => [id, 0]));
|
|
591
|
+
const adj = new Map();
|
|
592
|
+
const addEdge = (from, to) => {
|
|
593
|
+
if (from === to || !allIds.has(from) || !allIds.has(to))
|
|
594
|
+
return;
|
|
595
|
+
if (!adj.has(from))
|
|
596
|
+
adj.set(from, new Set());
|
|
597
|
+
const set = adj.get(from);
|
|
598
|
+
if (set.has(to))
|
|
599
|
+
return;
|
|
600
|
+
set.add(to);
|
|
601
|
+
indegree.set(to, (indegree.get(to) ?? 0) + 1);
|
|
602
|
+
};
|
|
603
|
+
for (const p of payload) {
|
|
604
|
+
for (const u of p.propertiesToUpdate)
|
|
605
|
+
addEdge(p.localId, u.publishLocalId);
|
|
606
|
+
for (const refId of collectAttestationLocalRefIds(p, allIds))
|
|
607
|
+
addEdge(refId, p.localId);
|
|
608
|
+
}
|
|
609
|
+
const byInputOrder = (a, b) => (indexOrder.get(a) ?? 0) - (indexOrder.get(b) ?? 0);
|
|
610
|
+
const queue = [...allIds].filter((id) => (indegree.get(id) ?? 0) === 0).sort(byInputOrder);
|
|
611
|
+
const result = [];
|
|
612
|
+
while (queue.length > 0) {
|
|
613
|
+
const id = queue.shift();
|
|
614
|
+
result.push(byLocalId.get(id));
|
|
615
|
+
for (const to of adj.get(id) ?? []) {
|
|
616
|
+
const next = (indegree.get(to) ?? 0) - 1;
|
|
617
|
+
indegree.set(to, next);
|
|
618
|
+
if (next === 0) {
|
|
619
|
+
queue.push(to);
|
|
620
|
+
queue.sort(byInputOrder);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
if (result.length !== payload.length) {
|
|
625
|
+
const seen = new Set(result.map((r) => r.localId));
|
|
626
|
+
for (const p of payload)
|
|
627
|
+
if (!seen.has(p.localId))
|
|
628
|
+
result.push(p);
|
|
629
|
+
}
|
|
630
|
+
return result;
|
|
631
|
+
}
|
|
632
|
+
/** Normalize attestation UID to 32-byte hex for SchemaEncoder bytes32 fields. */
|
|
633
|
+
function padUidForBytes32Schema(uid) {
|
|
634
|
+
const t = uid.trim();
|
|
635
|
+
if (!t.startsWith('0x'))
|
|
636
|
+
return uid;
|
|
637
|
+
const hex = t.slice(2).replace(/[^0-9a-fA-F]/g, '');
|
|
638
|
+
if (hex.length === 0)
|
|
639
|
+
return uid;
|
|
640
|
+
return ('0x' + hex.padStart(64, '0').slice(-64)).toLowerCase();
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Resolves relation/image property values (seedLocalId) to attestation uids after dependent seeds are published.
|
|
644
|
+
* Call after each payload is published, passing the returned attestation uid for that seed's localId.
|
|
645
|
+
* Returns an updated multiPayload with re-encoded attestations where resolution was applied.
|
|
646
|
+
*/
|
|
647
|
+
const resolvePublishPayloadValues = async (multiPayload, resolvedUids) => {
|
|
648
|
+
if (Object.keys(resolvedUids).length === 0) {
|
|
649
|
+
return multiPayload;
|
|
650
|
+
}
|
|
651
|
+
const { SchemaEncoder } = await loadEasSdk();
|
|
652
|
+
const result = [];
|
|
653
|
+
for (const payload of multiPayload) {
|
|
654
|
+
const updatedAttestations = [];
|
|
655
|
+
for (const attestation of payload.listOfAttestations) {
|
|
656
|
+
const entry = attestation;
|
|
657
|
+
const rawList = entry._rawListIdsForResolve;
|
|
658
|
+
if (rawList &&
|
|
659
|
+
rawList.length > 0 &&
|
|
660
|
+
entry._schemaDef &&
|
|
661
|
+
(entry._propertyNameForSchema || entry._propertyName)) {
|
|
662
|
+
const fieldName = entry._propertyNameForSchema ?? easName(entry._propertyName);
|
|
663
|
+
const resolvedValues = [];
|
|
664
|
+
let allSlotsResolved = true;
|
|
665
|
+
for (const id of rawList) {
|
|
666
|
+
const trimmed = id.trim();
|
|
667
|
+
if (isUidRef(trimmed)) {
|
|
668
|
+
resolvedValues.push(padUidForBytes32Schema(trimmed));
|
|
669
|
+
continue;
|
|
670
|
+
}
|
|
671
|
+
const r = resolvedUids[trimmed];
|
|
672
|
+
if (r) {
|
|
673
|
+
resolvedValues.push(padUidForBytes32Schema(r));
|
|
674
|
+
continue;
|
|
675
|
+
}
|
|
676
|
+
allSlotsResolved = false;
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
679
|
+
// Do not encode or clear hints until every slot has a real uid — otherwise sequential
|
|
680
|
+
// publish burns encodeBytes32String(localId) into data and drops _rawListIdsForResolve.
|
|
681
|
+
if (!allSlotsResolved) {
|
|
682
|
+
updatedAttestations.push({
|
|
683
|
+
...entry,
|
|
684
|
+
data: Array.isArray(entry.data) ? entry.data : [entry.data],
|
|
685
|
+
});
|
|
686
|
+
continue;
|
|
687
|
+
}
|
|
688
|
+
const dataEncoder = new SchemaEncoder(entry._schemaDef);
|
|
689
|
+
const encodedData = dataEncoder.encodeData([
|
|
690
|
+
{
|
|
691
|
+
name: fieldName,
|
|
692
|
+
type: 'bytes32[]',
|
|
693
|
+
value: resolvedValues,
|
|
694
|
+
},
|
|
695
|
+
]);
|
|
696
|
+
const baseData = Array.isArray(entry.data) ? entry.data[0] : entry.data;
|
|
697
|
+
updatedAttestations.push({
|
|
698
|
+
...entry,
|
|
699
|
+
data: [
|
|
700
|
+
{
|
|
701
|
+
...baseData,
|
|
702
|
+
data: encodedData,
|
|
703
|
+
},
|
|
704
|
+
],
|
|
705
|
+
_rawListIdsForResolve: undefined,
|
|
706
|
+
_easDataType: undefined,
|
|
707
|
+
});
|
|
708
|
+
continue;
|
|
709
|
+
}
|
|
710
|
+
const resolvedUid = entry._unresolvedValue && resolvedUids[entry._unresolvedValue];
|
|
711
|
+
const easType = entry._easDataType || 'bytes32';
|
|
712
|
+
if (resolvedUid && entry._schemaDef && (entry._propertyNameForSchema || entry._propertyName)) {
|
|
713
|
+
const fieldName = entry._propertyNameForSchema ?? easName(entry._propertyName);
|
|
714
|
+
const valueForEncode = easType === 'bytes32' ? padUidForBytes32Schema(resolvedUid) : resolvedUid;
|
|
715
|
+
const dataEncoder = new SchemaEncoder(entry._schemaDef);
|
|
716
|
+
const encodedData = dataEncoder.encodeData([
|
|
717
|
+
{
|
|
718
|
+
name: fieldName,
|
|
719
|
+
type: easType,
|
|
720
|
+
value: valueForEncode,
|
|
721
|
+
},
|
|
722
|
+
]);
|
|
723
|
+
const baseData = Array.isArray(entry.data) ? entry.data[0] : entry.data;
|
|
724
|
+
updatedAttestations.push({
|
|
725
|
+
...entry,
|
|
726
|
+
data: [
|
|
727
|
+
{
|
|
728
|
+
...baseData,
|
|
729
|
+
data: encodedData,
|
|
730
|
+
},
|
|
731
|
+
],
|
|
732
|
+
_unresolvedValue: undefined,
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
else {
|
|
736
|
+
const normalizedEntry = {
|
|
737
|
+
...entry,
|
|
738
|
+
data: Array.isArray(entry.data) ? entry.data : [entry.data],
|
|
739
|
+
};
|
|
740
|
+
updatedAttestations.push(normalizedEntry);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
result.push({
|
|
744
|
+
...payload,
|
|
745
|
+
listOfAttestations: updatedAttestations,
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
return result;
|
|
749
|
+
};
|
|
750
|
+
|
|
751
|
+
var getPublishPayload$1 = /*#__PURE__*/Object.freeze({
|
|
752
|
+
__proto__: null,
|
|
753
|
+
PublishValidationFailedError: PublishValidationFailedError,
|
|
754
|
+
getPublishPayload: getPublishPayload,
|
|
755
|
+
resolvePublishPayloadValues: resolvePublishPayloadValues,
|
|
756
|
+
validateItemForPublish: validateItemForPublish
|
|
757
|
+
});
|
|
758
|
+
|
|
759
|
+
export { PublishValidationFailedError as P, RELATED_ITEM_UNPUBLISHED_CODE as R, RelatedItemUnpublishedError as a, getPendingRetractions as b, getPublishPayload$1 as c, getPropertyClear as g, resolvePublishPayloadValues as r, validateItemForPublish as v };
|
|
760
|
+
//# sourceMappingURL=getPublishPayload-BnIwpwz1.js.map
|