@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
package/dist/main.js
CHANGED
|
@@ -1,1117 +1,35 @@
|
|
|
1
|
-
export { C as ConflictError,
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
import { U as latestVersionOrder, K as isVersionRevoked, C as compareMetadataRowsLatestFirst, F as parseListPropertyValueFromStorage, V as isPublishedMetadataRow, E as getLatestPublishedVersionRow } from './Item-0oDoTPhi.js';
|
|
9
|
-
export { W as ClientManagerState, I as Item, q as ItemProperty, t as ItemPropertySaveValidationError, M as METADATA_LATEST_FIRST_ORDER_SQL, X as MachineIds, u as OwnershipError, Y as PUBLISH_NOT_CONFIGURED_MESSAGE, v as assertItemOwned, Z as createNewItem, J as getGetAdditionalSyncAddresses, _ as getGetPublisherForNewSeeds, $ as getMetadataLatest, a0 as getPublishExecutor, a1 as getRevokeExecutor, a2 as getUploadExecutor, a3 as getVersionData, x as isItemOwned, a4 as isLocalUnsealedDraft, a5 as isSeedRowOwned, a6 as localUnsealedDraftSql, a7 as ownedPublisherSql, a8 as ownedSeedsSql, a9 as pickLatestMetadataRowPerProperty, aa as placeholderUidSql, ab as propertyMachine, ac as publisherInAddressListSql, ad as publisherIsInOwnedSet, ae as setAdditionalSyncAddresses, af as setGetPublisherForNewSeeds, ag as setPublishExecutor, ah as setRevokeExecutor, ai as setUploadExecutor, B as waitForEntityIdle } from './Item-0oDoTPhi.js';
|
|
10
|
-
import { eq, and, inArray, or, isNotNull, ne } from 'drizzle-orm';
|
|
11
|
-
import { isPlaceholderUid, isValidEasAttestationUid, normalizeBytes32Hex, easName, BaseQueryClient, BaseEasClient, GET_SCHEMAS } from '@seedprotocol/eas';
|
|
12
|
-
export { EAS_CHAIN_DEPLOYMENTS, BaseEasClient as EasClient, VERSION_SCHEMA_DEF, VERSION_SCHEMA_UID, easName, getCanonicalItemPropertiesFromEas, getEasChainDeployment, getEasEndpoint, getEasReadChainId, getEasSchemaUidBySchemaName, getItemPropertiesFromEas, getItemVersionsFromEas, getSeedsBySchemaName, getSeedsFromSchemaUids, isPlaceholderUid, isValidEasAttestationUid, matchEasName, normalizeBytes32Hex, pickLatestPropertyAttestationsByRefAndSchema, setSchemaUidForModel, setSchemaUidForSchemaDefinition, withExcludeRevokedFilter } from '@seedprotocol/eas';
|
|
13
|
-
export { S as Schema, r as renameModelProperty, s as schemaMachine, u as updateModelProperties } from './Schema-PFZwG9Nl.js';
|
|
1
|
+
export { C as ConflictError, G as EAS_CHAIN_ID_APP_STATE_KEY, H as INIT_CONFIG_CONFLICT_MESSAGE, J as ItemCreateError, I as ItemCreateValidationError, M as Model, U as UnknownModelError, B as assertLocalDbChain, K as claimUnpublishedDrafts, g as client, L as createLocalQueryDataSource, N as easSyncActor, O as getClient, P as getPublishedSeedRecord, Q as getSchemaNameFromId, i as importJsonSchema, V as isSeedQueryLocalSourceRegistered, W as listSchemas, q as loadAllSchemasFromDb, X as mergeEasSyncRequestIntents, r as readJsonImportFile, Y as registerSeedQueryLocalSource, Z as requestEasSyncFromAddressChange, _ as requestEasSyncFromModelsInit, $ as sendEasSyncClientRequest, a0 as setRetriesWhenOnlineEnabled, a1 as startEasSyncActor, h as syncSchemaFromSource, j as transformImportToSchemaFile, a2 as unregisterSeedQueryLocalSource } from './errors-DLSoqSHG.js';
|
|
2
|
+
export { a8 as ADDRESSES_PERSISTED_EVENT, A as AmbiguousModelError, a9 as CONTENT_SHA256_TAG, aa as CONTENT_TYPE_TAG, ab as ClientManagerState, Q as EAS_SEED_DATA_SYNCED_TO_DB_EVENT, ac as FILES_CHANGED_EVENT, v as INTERNAL_DATA_TYPES, ad as ImageSize, ae as LOCAL_COPIES_REMOVED_EVENT, af as MachineIds, M as ModelPropertyDataTypes, S as SEED_PROTOCOL_SCHEMA_NAME, ag as SeedModels, ah as TabLockTimeoutError, ai as VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA, X as buildArweaveContentTags, aj as closestImageSize, ak as contentSha256TagMatches, al as ensureImageLocal, h as eventEmitter, m as generateId, am as getAddressesForItemsFilter, W as getContentSha256, an as isChangeFeedRunning, s as isClientReady, ao as isClientReadySnapshot, i as isDataType, ap as isLeaderTab, aq as normalizeAddressConfig, ar as normalizeAddressList, as as normalizeArweaveTxIdForEnsure, n as normalizeDataType, J as normalizeHexAddress, x as normalizePublisher, at as parseAddressesPersistedPayload, au as watchEntityChanges, av as watchEntityRows, aw as whenDbReady, ax as whenLeaderTab } from './tabEvents-CaVmngqr.js';
|
|
3
|
+
export { getPropertySchema } from './property-BxUYznH0.js';
|
|
4
|
+
export { B as BaseDb, w as BaseFileManager, w as FileManager, a as appState, e as arweaveL1FinalizeJobs, f as easSyncProcesses, h as htmlEmbeddedImageCoPublish, m as metadata, j as modelSchemas, b as modelUids, d as models, l as properties, q as propertyUids, r as publishProcesses, t as schemas, s as seeds, u as uploadProcesses, v as versions } from './BaseFileManager-BAlySv8w.js';
|
|
5
|
+
export { C as ClearNotSupportedError, I as Item, v as ItemProperty, x as ItemPropertySaveValidationError, ag as METADATA_LATEST_FIRST_ORDER_SQL, y as OwnershipError, as as PUBLISH_NOT_CONFIGURED_MESSAGE, z as assertItemOwned, H as compareMetadataRowsLatestFirst, at as createNewItem, a9 as easPropertyNameForPublish, au as getArweaveUrlForTransaction, A as getCorrectId, a6 as getGetAdditionalSyncAddresses, av as getGetPublisherForNewSeeds, aw as getMetadataLatest, ax as getPublishExecutor, ay as getRevokeExecutor, az as getUploadExecutor, aA as getVersionData, B as isItemOwned, aB as isLocalUnsealedDraft, D as isPublishedSeedRef, aC as isSeedRowOwned, a8 as listRelationEasPropertyName, aD as localUnsealedDraftSql, aE as ownedPublisherSql, aF as ownedSeedsSql, aG as pickLatestMetadataRowPerProperty, aH as placeholderUidSql, aI as propertyMachine, aJ as publisherInAddressListSql, aK as publisherIsInOwnedSet, aL as setAdditionalSyncAddresses, aM as setGetPublisherForNewSeeds, aN as setPublishExecutor, aO as setRevokeExecutor, aP as setUploadExecutor } from './Item-Bf4kWKpH.js';
|
|
6
|
+
export { a as applyPropertyAttestationUidsFromPublish, e as estimateDataUriByteLength, g as getAttesterForSeed, b as getMetadataAttestationUidsForSeedUid, c as getSeedPublishState, d as getUnpublishedRelatedItems, f as getVersionsForSeedUid, m as markPropertyAttestationsRetracted, r as renameModelProperty, h as resolveMediaRef, s as summarizePublishWork, u as updateModelProperties, i as updateVersionUid } from './index-DmTtj1nk.js';
|
|
7
|
+
export { S as Schema, s as schemaMachine } from './Schema-J_1f6p0c.js';
|
|
14
8
|
export { D as DatabaseNotPersistentError, F as FileSystemLockedError } from './errors-C1qUEZ7A.js';
|
|
15
|
-
export { M as MODEL_AMBIGUOUS_EVENT } from './
|
|
16
|
-
export { ModelProperty } from './ModelProperty-
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
|
|
21
|
-
export { P as PublishValidationFailedError, R as RELATED_ITEM_UNPUBLISHED_CODE, a as RelatedItemUnpublishedError, r as resolvePublishPayloadValues, v as validateItemForPublish } from './getPublishPayload-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export { H as HTML_EMBEDDED_MAX_IMAGES_PER_DOC, a as HTML_EMBEDDED_MAX_IMAGE_BYTES, b as HTML_EMBEDDED_MAX_TOTAL_BYTES, c as HtmlEmbeddedDataUriLimitError, d as HtmlSeedPropertyRefError, S as SEED_PROPERTY_REF_PREFIX, e as clearHtmlEmbeddedImageCoPublishRows, h as extractDataUriImagesFromHtml, i as findSeedPropertyRefsInHtml, j as getPublishUploadData, k as itemHasPublishUploadCandidates, p as prepareHtmlEmbeddedImagesForPublish, r as replaceDataUrisInParsedHtml, l as replaceSeedPropertyRefsInHtml, m as resolveEffectiveHtmlEmbeddedDataUriPolicy, n as rewriteHtmlEmbeddedImagesOnDisk } from './getPublishUploads-BzUIDA2G.js';
|
|
9
|
+
export { M as MODEL_AMBIGUOUS_EVENT, u as updateSeedRevokedAt } from './updateSeedRevokedAt-BL9Bg-G7.js';
|
|
10
|
+
export { ModelProperty } from './ModelProperty-BlaEgb_U.js';
|
|
11
|
+
export { EAS_CHAIN_DEPLOYMENTS, BaseEasClient as EasClient, VERSION_SCHEMA_DEF, VERSION_SCHEMA_UID, easName, getCanonicalItemPropertiesFromEas, getEasChainDeployment, getEasEndpoint, getEasReadChainId, getEasSchemaUidForExactDefinition, getItemPropertiesFromEas, getItemVersionsFromEas, getSeedsBySchemaName, getSeedsFromSchemaUids, isPlaceholderUid, isValidEasAttestationUid, matchEasName, normalizeBytes32Hex, pickLatestPropertyAttestationsByRefAndSchema, setSchemaUidForModel, setSchemaUidForSchemaDefinition, withExcludeRevokedFilter } from '@seedprotocol/eas';
|
|
12
|
+
export { getModelSchemasFromEas } from './eas-wB_fQ8Tc.js';
|
|
13
|
+
export { BaseArweaveClient, DEFAULT_ARWEAVE_GATEWAYS, DEFAULT_ARWEAVE_GRAPHQL_URL, DEFAULT_ARWEAVE_HOST, DEFAULT_GATEWAY_SIDECAR_HOST, DEFAULT_GATEWAY_SIDECAR_PORT, DEFAULT_SEED_FEED_HYPER_KEY, DEFAULT_SEED_GATEWAY_HYPER_KEY, SEED_RSS_IMAGE_RELATION_FIELD_KEYS, classifyMediaRef, ensureReadGatewaySelected, fetchArweaveRawFromBaseUrl, fetchArweaveRawTextAcrossGateways, getArweaveReadBaseUrls, getArweaveUploadStatus, getDefaultArweaveReadGatewayHostsOrdered, getFeedItemStringField, getLastHealthyReadGatewayHost, getPreferredArweaveReadBaseUrls, getReadGatewayHostsForConfig, getResolvedArweaveReadBaseUrls, getResolvedSeedGatewayEndpoints, getUploadApiArweaveDataUrl, getUploadApiArweaveStatusUrl, getUploadPipelineTransactionStatus, hasArweaveContentReadTransform, invalidateReadGatewayCache, invalidateSidecarProbeCache, isArweaveL1AnchoringComplete, isEasAttestationExplorerUrl, isGatewayHostCircuitOpen, isKnownArweaveGatewayHostname, isReadGatewayKnownHealthy, mergePrimaryHostWithDefaults, normalizeFeedItemFields, normalizeGatewayHostKey, normalizeRelationPropertyValue, normalizeUploadApiBaseUrl, queryArweaveGatewayTransaction, queryArweaveGatewayTransactionWithFallback, readArweaveContentResponse, recordGatewayHostFailure, recordGatewayHostSuccess, resetArweaveReadGatewayForTests, resolveSeedGatewayEndpoints, resolveSeedIdsFromRefString, resolveSeedRssImageRelationFromItem, resolveSeedRssImageRelationRef, seedGatewayConfigFromClientContext, seedGatewayConfigFromSeedConfig, setArweaveContentReadTransform, setPreferredArweaveReadBaseUrls, setResolvedSeedGatewayEndpoints, transformArweaveContent } from '@seedprotocol/arweave';
|
|
14
|
+
export { getPublishPendingDiff } from './getPublishPendingDiff-D6_-A5ns.js';
|
|
15
|
+
export { P as PublishValidationFailedError, R as RELATED_ITEM_UNPUBLISHED_CODE, a as RelatedItemUnpublishedError, b as getPendingRetractions, r as resolvePublishPayloadValues, v as validateItemForPublish } from './getPublishPayload-BnIwpwz1.js';
|
|
16
|
+
export { g as getPublishGraph } from './publishGraph-EcB40Uii.js';
|
|
17
|
+
export { H as HTML_EMBEDDED_MAX_IMAGES_PER_DOC, a as HTML_EMBEDDED_MAX_IMAGE_BYTES, b as HTML_EMBEDDED_MAX_TOTAL_BYTES, c as HtmlEmbeddedDataUriLimitError, d as HtmlSeedPropertyRefError, S as SEED_PROPERTY_REF_PREFIX, e as clearHtmlEmbeddedImageCoPublishRows, f as extractDataUriImagesFromHtml, h as findSeedPropertyRefsInHtml, i as getPublishUploadData, j as itemHasPublishUploadCandidates, p as prepareHtmlEmbeddedImagesForPublish, r as replaceDataUrisInParsedHtml, k as replaceSeedPropertyRefsInHtml, l as resolveEffectiveHtmlEmbeddedDataUriPolicy, m as rewriteHtmlEmbeddedImagesOnDisk } from './getPublishUploads-sS6JfPgz.js';
|
|
25
18
|
import 'xstate';
|
|
26
19
|
import 'debug';
|
|
27
|
-
import '
|
|
20
|
+
import 'pluralize';
|
|
21
|
+
import 'drizzle-orm';
|
|
28
22
|
import '@sinclair/typebox';
|
|
23
|
+
import 'lodash-es';
|
|
24
|
+
import '@noble/hashes/sha3';
|
|
25
|
+
import '@noble/hashes/utils';
|
|
26
|
+
import '@seedprotocol/query';
|
|
29
27
|
import 'drizzle-orm/sqlite-core';
|
|
30
28
|
import 'nanoid';
|
|
31
29
|
import 'nanoid-dictionary';
|
|
32
30
|
import '@noble/hashes/sha256';
|
|
33
|
-
import '@noble/hashes/sha3';
|
|
34
|
-
import '@noble/hashes/utils';
|
|
35
|
-
import 'lodash-es';
|
|
36
|
-
import '@seedprotocol/query';
|
|
37
31
|
import 'rxjs';
|
|
38
|
-
import './SchemaValidationService-
|
|
32
|
+
import './SchemaValidationService-CnmKyzR-.js';
|
|
39
33
|
import '@sinclair/typebox/value';
|
|
40
|
-
import './findSeedRowsByUid-CT3sOXXw.js';
|
|
41
34
|
import 'parse5';
|
|
42
|
-
import './mimeTypes-C9r76DCH.js';
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Updates the version record with the attestation UID after a Version attestation is created.
|
|
46
|
-
* Targets the first version without a uid yet in head-version order (the one being published).
|
|
47
|
-
* A uid one of the seed's version rows already has is ignored.
|
|
48
|
-
* Publisher is immutable once set: we never overwrite an existing publisher.
|
|
49
|
-
*/
|
|
50
|
-
const updateVersionUid = async ({ seedLocalId, versionUid, publisher, attestationCreatedAt, }) => {
|
|
51
|
-
if (!seedLocalId || !versionUid) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const appDb = BaseDb.getAppDb();
|
|
55
|
-
if (!appDb)
|
|
56
|
-
return;
|
|
57
|
-
const rows = await appDb
|
|
58
|
-
.select({ localId: versions.localId, uid: versions.uid, publisher: versions.publisher })
|
|
59
|
-
.from(versions)
|
|
60
|
-
.where(eq(versions.seedLocalId, seedLocalId))
|
|
61
|
-
.orderBy(latestVersionOrder());
|
|
62
|
-
// Already recorded: nothing to stamp. A patch publish attaches to an existing version, and the
|
|
63
|
-
// modular executor's SeedPublished event still reports that version's uid; stamping it onto a
|
|
64
|
-
// local draft version would give two rows the same version uid.
|
|
65
|
-
const wanted = versionUid.toLowerCase();
|
|
66
|
-
if (rows.some((r) => r.uid?.toLowerCase() === wanted))
|
|
67
|
-
return;
|
|
68
|
-
const toUpdate = rows.find((r) => r.localId && isPlaceholderUid(r.uid));
|
|
69
|
-
const normalizedPublisher = normalizePublisher(publisher);
|
|
70
|
-
if (!toUpdate?.localId) {
|
|
71
|
-
// No local draft version took this attestation (e.g. a republish after unpublish, where every
|
|
72
|
-
// version row is a revoked attestation): record the new version so it is the latest one.
|
|
73
|
-
const [seed] = await appDb
|
|
74
|
-
.select({ type: seeds.type })
|
|
75
|
-
.from(seeds)
|
|
76
|
-
.where(eq(seeds.localId, seedLocalId))
|
|
77
|
-
.limit(1);
|
|
78
|
-
if (!seed)
|
|
79
|
-
return;
|
|
80
|
-
await appDb.insert(versions).values({
|
|
81
|
-
localId: generateId(),
|
|
82
|
-
seedLocalId,
|
|
83
|
-
seedType: seed.type,
|
|
84
|
-
uid: versionUid,
|
|
85
|
-
...(normalizedPublisher && { publisher: normalizedPublisher }),
|
|
86
|
-
...(attestationCreatedAt != null && { attestationCreatedAt }),
|
|
87
|
-
});
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
let shouldSetPublisher = normalizedPublisher != null;
|
|
91
|
-
if (shouldSetPublisher && toUpdate.publisher != null && toUpdate.publisher !== '') {
|
|
92
|
-
shouldSetPublisher = false;
|
|
93
|
-
}
|
|
94
|
-
await appDb
|
|
95
|
-
.update(versions)
|
|
96
|
-
.set({
|
|
97
|
-
uid: versionUid,
|
|
98
|
-
...(shouldSetPublisher && { publisher: normalizedPublisher }),
|
|
99
|
-
...(attestationCreatedAt != null && { attestationCreatedAt }),
|
|
100
|
-
})
|
|
101
|
-
.where(eq(versions.localId, toUpdate.localId));
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* After property attestations succeed, write EAS UIDs onto the latest placeholder metadata row
|
|
106
|
-
* so getPublishPendingDiff stays aligned with on-chain state.
|
|
107
|
-
* When pair.propertyName is set, match that property even if the row has no schemaUid;
|
|
108
|
-
* if the row has a schemaUid it must still match. Pair-only schema match remains for unnamed pairs.
|
|
109
|
-
*
|
|
110
|
-
* A full-snapshot publish (`new_version`, or a republish after unpublish) also attests properties
|
|
111
|
-
* whose rows are already attested (on an older version, or the revoked seed's). With no placeholder
|
|
112
|
-
* to take the uid, the attestation is recorded as a new row for the published version: a copy of
|
|
113
|
-
* the property's latest row with the new uid, so readers show the published version without a
|
|
114
|
-
* sync. Rows keep or get the published version's local id when `versionUid` has a version row.
|
|
115
|
-
*
|
|
116
|
-
* Relations and lists of relations are recorded as attested, the way an EAS sync of the
|
|
117
|
-
* attestation stores them:
|
|
118
|
-
* - a List of Relation row lives under its storage name (`authors` → `authorIdentityIds`) while a
|
|
119
|
-
* publish names the attestation by schema key; either name matches.
|
|
120
|
-
* - a value naming seeds by local id gets the seed uids the attestation encodes: the uid (Relation),
|
|
121
|
-
* a JSON array of uids in slot order (List). Each uid comes from `resolvedSeedUids` (seeds this
|
|
122
|
-
* publish created, not recorded on their seed rows yet), else the seed's recorded live uid.
|
|
123
|
-
*/
|
|
124
|
-
async function applyPropertyAttestationUidsFromPublish(params) {
|
|
125
|
-
const { seedLocalId, attestationCreatedAtMs, pairs, versionUid, resolvedSeedUids } = params;
|
|
126
|
-
const appDb = BaseDb.getAppDb();
|
|
127
|
-
if (!appDb || !seedLocalId || pairs.length === 0)
|
|
128
|
-
return;
|
|
129
|
-
const rows = await appDb.select().from(metadata).where(eq(metadata.seedLocalId, seedLocalId));
|
|
130
|
-
if (rows.length === 0)
|
|
131
|
-
return;
|
|
132
|
-
const working = rows.map((r) => ({ ...r }));
|
|
133
|
-
const validVersion = versionUid != null && versionUid !== '' && isValidEasAttestationUid(versionUid)
|
|
134
|
-
? versionUid
|
|
135
|
-
: undefined;
|
|
136
|
-
let versionLocalId;
|
|
137
|
-
let liveSeedUid = null;
|
|
138
|
-
if (validVersion) {
|
|
139
|
-
const [versionRow] = await appDb
|
|
140
|
-
.select({ localId: versions.localId, seedUid: versions.seedUid })
|
|
141
|
-
.from(versions)
|
|
142
|
-
.where(and(eq(versions.seedLocalId, seedLocalId), eq(versions.uid, validVersion)))
|
|
143
|
-
.limit(1);
|
|
144
|
-
versionLocalId = versionRow?.localId ?? undefined;
|
|
145
|
-
const [seedRow] = await appDb
|
|
146
|
-
.select({ uid: seeds.uid, revokedAt: seeds.revokedAt })
|
|
147
|
-
.from(seeds)
|
|
148
|
-
.where(eq(seeds.localId, seedLocalId))
|
|
149
|
-
.limit(1);
|
|
150
|
-
// A republish records its new seed uid after this; updateSeedUid fills it in then.
|
|
151
|
-
liveSeedUid =
|
|
152
|
-
versionRow?.seedUid ??
|
|
153
|
-
(isValidEasAttestationUid(seedRow?.uid) && !isVersionRevoked(seedRow?.revokedAt)
|
|
154
|
-
? seedRow.uid
|
|
155
|
-
: null);
|
|
156
|
-
}
|
|
157
|
-
const refDefs = await loadRefPropertyDefs(appDb, seedLocalId, rows);
|
|
158
|
-
const attestedRefValue = async (row, def) => {
|
|
159
|
-
const d = def ?? (row.propertyName ? refDefs.get(row.propertyName) : undefined);
|
|
160
|
-
if (!d || row.propertyValue == null)
|
|
161
|
-
return undefined;
|
|
162
|
-
return toAttestedRefValue(appDb, row.propertyValue, d.kind, resolvedSeedUids ?? {});
|
|
163
|
-
};
|
|
164
|
-
for (const pair of pairs) {
|
|
165
|
-
const att = pair.attestationUid?.trim();
|
|
166
|
-
if (!isValidEasAttestationUid(att))
|
|
167
|
-
continue;
|
|
168
|
-
const wantSchema = normalizeBytes32Hex(pair.schemaUid);
|
|
169
|
-
if (!wantSchema)
|
|
170
|
-
continue;
|
|
171
|
-
const pairName = pair.propertyName != null && pair.propertyName !== '' ? pair.propertyName : undefined;
|
|
172
|
-
const pairDef = pairName ? refDefs.get(pairName) : undefined;
|
|
173
|
-
const pairNames = new Set(pairName ? [pairName, ...(pairDef ? [pairDef.schemaKey, pairDef.storageName] : [])] : []);
|
|
174
|
-
const attestedRow = pair.metadataLocalId
|
|
175
|
-
? working.find((r) => r.localId === pair.metadataLocalId)
|
|
176
|
-
: undefined;
|
|
177
|
-
const candidates = attestedRow
|
|
178
|
-
? [attestedRow]
|
|
179
|
-
: working
|
|
180
|
-
.filter((r) => {
|
|
181
|
-
// Rows sync derived for ItemStorage properties aren't placeholders for an attestation.
|
|
182
|
-
if (r.derivedFromUid != null)
|
|
183
|
-
return false;
|
|
184
|
-
if (pairName) {
|
|
185
|
-
if (!r.propertyName || !pairNames.has(r.propertyName))
|
|
186
|
-
return false;
|
|
187
|
-
if (r.schemaUid) {
|
|
188
|
-
return normalizeBytes32Hex(r.schemaUid) === wantSchema;
|
|
189
|
-
}
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
192
|
-
if (!r.schemaUid)
|
|
193
|
-
return false;
|
|
194
|
-
return normalizeBytes32Hex(r.schemaUid) === wantSchema;
|
|
195
|
-
})
|
|
196
|
-
.sort(compareMetadataRowsLatestFirst);
|
|
197
|
-
const target = candidates.find((r) => isPlaceholderUid(r.uid));
|
|
198
|
-
if (!target?.localId) {
|
|
199
|
-
// Full snapshot: the property's rows are all attested. Record this attestation as a new row
|
|
200
|
-
// for the published version (unless it is already recorded, e.g. a replayed receipt).
|
|
201
|
-
const source = candidates[0];
|
|
202
|
-
if (!source || !validVersion)
|
|
203
|
-
continue;
|
|
204
|
-
if (working.some((r) => r.uid?.toLowerCase() === att.toLowerCase()))
|
|
205
|
-
continue;
|
|
206
|
-
const now = Date.now();
|
|
207
|
-
const attestedValue = await attestedRefValue(source, pairDef);
|
|
208
|
-
const row = {
|
|
209
|
-
...source,
|
|
210
|
-
...(attestedValue !== undefined && { propertyValue: attestedValue }),
|
|
211
|
-
localId: generateId(),
|
|
212
|
-
uid: att,
|
|
213
|
-
schemaUid: normalizeBytes32Hex(source.schemaUid) ? source.schemaUid : wantSchema,
|
|
214
|
-
seedUid: liveSeedUid,
|
|
215
|
-
versionUid: validVersion,
|
|
216
|
-
versionLocalId: versionLocalId ?? source.versionLocalId,
|
|
217
|
-
attestationCreatedAt: attestationCreatedAtMs ?? now,
|
|
218
|
-
attestationRaw: null,
|
|
219
|
-
revokedAt: null,
|
|
220
|
-
derivedFromUid: null,
|
|
221
|
-
// Stamped here: the spread copies the source row's times.
|
|
222
|
-
createdAt: now,
|
|
223
|
-
updatedAt: now,
|
|
224
|
-
};
|
|
225
|
-
await appDb.insert(metadata).values(row);
|
|
226
|
-
working.push(row);
|
|
227
|
-
continue;
|
|
228
|
-
}
|
|
229
|
-
const writeSchemaUid = !normalizeBytes32Hex(target.schemaUid);
|
|
230
|
-
const attestedValue = await attestedRefValue(target, pairDef);
|
|
231
|
-
await appDb
|
|
232
|
-
.update(metadata)
|
|
233
|
-
.set({
|
|
234
|
-
uid: att,
|
|
235
|
-
...(attestedValue !== undefined && { propertyValue: attestedValue }),
|
|
236
|
-
...(writeSchemaUid && { schemaUid: wantSchema }),
|
|
237
|
-
...(attestationCreatedAtMs != null && { attestationCreatedAt: attestationCreatedAtMs }),
|
|
238
|
-
...(validVersion && { versionUid: validVersion }),
|
|
239
|
-
...(versionLocalId && { versionLocalId }),
|
|
240
|
-
})
|
|
241
|
-
.where(eq(metadata.localId, target.localId));
|
|
242
|
-
const i = working.findIndex((r) => r.localId === target.localId);
|
|
243
|
-
if (i >= 0) {
|
|
244
|
-
working[i] = {
|
|
245
|
-
...working[i],
|
|
246
|
-
uid: att,
|
|
247
|
-
...(attestedValue !== undefined && { propertyValue: attestedValue }),
|
|
248
|
-
...(writeSchemaUid && { schemaUid: wantSchema }),
|
|
249
|
-
attestationCreatedAt: attestationCreatedAtMs ?? working[i].attestationCreatedAt,
|
|
250
|
-
...(validVersion && { versionUid: validVersion }),
|
|
251
|
-
...(versionLocalId && { versionLocalId }),
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* The seed's Relation and List-of-Relation properties, keyed by schema key and (lists) by storage
|
|
258
|
-
* name. The model comes from the seed's model_file_id, else a metadata row's property_id; an
|
|
259
|
-
* unknown model gives no definitions (rows then match by the pair's name alone, values unchanged).
|
|
260
|
-
*/
|
|
261
|
-
async function loadRefPropertyDefs(appDb, seedLocalId, rows) {
|
|
262
|
-
const out = new Map();
|
|
263
|
-
try {
|
|
264
|
-
let modelId;
|
|
265
|
-
const [seedRow] = await appDb
|
|
266
|
-
.select({ modelFileId: seeds.modelFileId })
|
|
267
|
-
.from(seeds)
|
|
268
|
-
.where(eq(seeds.localId, seedLocalId))
|
|
269
|
-
.limit(1);
|
|
270
|
-
if (seedRow?.modelFileId) {
|
|
271
|
-
const [m] = await appDb
|
|
272
|
-
.select({ id: models.id })
|
|
273
|
-
.from(models)
|
|
274
|
-
.where(eq(models.schemaFileId, seedRow.modelFileId))
|
|
275
|
-
.limit(1);
|
|
276
|
-
modelId = m?.id;
|
|
277
|
-
}
|
|
278
|
-
const propertyId = rows.find((r) => r.propertyId != null)?.propertyId;
|
|
279
|
-
if (modelId == null && propertyId != null) {
|
|
280
|
-
const [p] = await appDb
|
|
281
|
-
.select({ modelId: properties.modelId })
|
|
282
|
-
.from(properties)
|
|
283
|
-
.where(eq(properties.id, propertyId))
|
|
284
|
-
.limit(1);
|
|
285
|
-
modelId = p?.modelId ?? undefined;
|
|
286
|
-
}
|
|
287
|
-
if (modelId == null)
|
|
288
|
-
return out;
|
|
289
|
-
const props = await appDb
|
|
290
|
-
.select({
|
|
291
|
-
name: properties.name,
|
|
292
|
-
dataType: properties.dataType,
|
|
293
|
-
refModelId: properties.refModelId,
|
|
294
|
-
refValueType: properties.refValueType,
|
|
295
|
-
})
|
|
296
|
-
.from(properties)
|
|
297
|
-
.where(eq(properties.modelId, modelId));
|
|
298
|
-
const refIds = [...new Set(props.map((p) => p.refModelId).filter((id) => id != null))];
|
|
299
|
-
const refNames = new Map();
|
|
300
|
-
if (refIds.length) {
|
|
301
|
-
const refs = await appDb
|
|
302
|
-
.select({ id: models.id, name: models.name })
|
|
303
|
-
.from(models)
|
|
304
|
-
.where(inArray(models.id, refIds));
|
|
305
|
-
for (const r of refs)
|
|
306
|
-
refNames.set(r.id, r.name);
|
|
307
|
-
}
|
|
308
|
-
for (const p of props) {
|
|
309
|
-
const dataType = normalizeDataType(p.dataType);
|
|
310
|
-
if (dataType === 'Relation') {
|
|
311
|
-
out.set(p.name, { kind: 'relation', schemaKey: p.name, storageName: p.name });
|
|
312
|
-
continue;
|
|
313
|
-
}
|
|
314
|
-
if (dataType !== 'List' || normalizeDataType(p.refValueType ?? undefined) !== 'Relation')
|
|
315
|
-
continue;
|
|
316
|
-
const ref = p.refModelId != null ? refNames.get(p.refModelId) : undefined;
|
|
317
|
-
const storageName = ref ? listRelationEasPropertyName(p.name, { dataType: 'List', ref }) : undefined;
|
|
318
|
-
if (!storageName)
|
|
319
|
-
continue;
|
|
320
|
-
const def = { kind: 'list', schemaKey: p.name, storageName };
|
|
321
|
-
out.set(p.name, def);
|
|
322
|
-
out.set(storageName, def);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
catch {
|
|
326
|
-
// Unknown model: match by the pair's name alone.
|
|
327
|
-
}
|
|
328
|
-
return out;
|
|
329
|
-
}
|
|
330
|
-
const isUid = (v) => /^0x[0-9a-fA-F]{64}$/.test(v);
|
|
331
|
-
/**
|
|
332
|
-
* `raw` (a Relation value, or a List value as stored) with every seed named by local id replaced by
|
|
333
|
-
* its uid: from `resolvedSeedUids`, else the seed's recorded live uid. Undefined when nothing
|
|
334
|
-
* changes, or when a seed has no uid (then the value is not what was attested; left as it is).
|
|
335
|
-
*/
|
|
336
|
-
async function toAttestedRefValue(appDb, raw, kind, resolvedSeedUids) {
|
|
337
|
-
const refs = kind === 'list' ? parseListPropertyValueFromStorage(raw) : [raw.trim()];
|
|
338
|
-
if (refs.length === 0 || refs.some((r) => !r))
|
|
339
|
-
return undefined;
|
|
340
|
-
const unknown = [...new Set(refs.filter((r) => !isUid(r) && !resolvedSeedUids[r]))];
|
|
341
|
-
const recorded = new Map();
|
|
342
|
-
if (unknown.length) {
|
|
343
|
-
const seedRows = await appDb
|
|
344
|
-
.select({ localId: seeds.localId, uid: seeds.uid, revokedAt: seeds.revokedAt })
|
|
345
|
-
.from(seeds)
|
|
346
|
-
.where(inArray(seeds.localId, unknown));
|
|
347
|
-
for (const s of seedRows) {
|
|
348
|
-
if (s.localId && isValidEasAttestationUid(s.uid) && !isVersionRevoked(s.revokedAt)) {
|
|
349
|
-
recorded.set(s.localId, s.uid);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
const out = [];
|
|
354
|
-
for (const ref of refs) {
|
|
355
|
-
const uid = isUid(ref) ? ref : (resolvedSeedUids[ref] ?? recorded.get(ref));
|
|
356
|
-
if (!uid)
|
|
357
|
-
return undefined;
|
|
358
|
-
out.push(uid);
|
|
359
|
-
}
|
|
360
|
-
const value = kind === 'list' ? JSON.stringify(out) : out[0];
|
|
361
|
-
return value === raw ? undefined : value;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
const getEasSchemaForItemProperty = async ({ schemaUid, propertyName, easDataType, }) => {
|
|
365
|
-
try {
|
|
366
|
-
const propertyNameSnakeCase = easName(propertyName);
|
|
367
|
-
const isMissingSchemaUid = !schemaUid || schemaUid === 'null' || schemaUid === 'undefined';
|
|
368
|
-
const queryClient = BaseQueryClient.getQueryClient();
|
|
369
|
-
const easClient = BaseEasClient.getEasClient();
|
|
370
|
-
// If clients are not available, return undefined (schema not found)
|
|
371
|
-
if (!queryClient || !easClient) {
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
let queryParams = {
|
|
375
|
-
where: {
|
|
376
|
-
id: {
|
|
377
|
-
equals: schemaUid,
|
|
378
|
-
},
|
|
379
|
-
},
|
|
380
|
-
};
|
|
381
|
-
if (easDataType) {
|
|
382
|
-
queryParams = {
|
|
383
|
-
where: {
|
|
384
|
-
schema: {
|
|
385
|
-
equals: `${easDataType} ${propertyNameSnakeCase}`,
|
|
386
|
-
},
|
|
387
|
-
},
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
if (!easDataType && isMissingSchemaUid) {
|
|
391
|
-
queryParams = {
|
|
392
|
-
where: {
|
|
393
|
-
schemaNames: {
|
|
394
|
-
some: {
|
|
395
|
-
name: {
|
|
396
|
-
equals: propertyNameSnakeCase,
|
|
397
|
-
},
|
|
398
|
-
},
|
|
399
|
-
},
|
|
400
|
-
},
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
const foundPropertySchema = await queryClient.fetchQuery({
|
|
404
|
-
queryKey: [`getEasSchemaForItemProperty`, queryParams],
|
|
405
|
-
queryFn: async () => easClient.request(GET_SCHEMAS, queryParams),
|
|
406
|
-
networkMode: 'offlineFirst',
|
|
407
|
-
});
|
|
408
|
-
if (foundPropertySchema && foundPropertySchema.schemas.length > 0) {
|
|
409
|
-
return foundPropertySchema.schemas[0];
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
catch (error) {
|
|
413
|
-
// If schema fetch fails, return undefined (schema not found)
|
|
414
|
-
// This is expected when metadata exists without a published EASSchema
|
|
415
|
-
if (process.env.NODE_ENV === 'development') {
|
|
416
|
-
console.warn(`Failed to fetch schema for property ${propertyName}:`, error);
|
|
417
|
-
}
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
|
|
422
|
-
const getVersionsForSeedUid = async (seedUid) => {
|
|
423
|
-
if (!seedUid)
|
|
424
|
-
return [];
|
|
425
|
-
const appDb = BaseDb.getAppDb();
|
|
426
|
-
const rows = (await appDb
|
|
427
|
-
.select({ uid: versions.uid, seedUid: versions.seedUid })
|
|
428
|
-
.from(versions)
|
|
429
|
-
.where(eq(versions.seedUid, seedUid)));
|
|
430
|
-
return rows
|
|
431
|
-
.filter((r) => r.uid && r.uid !== '0x' + '0'.repeat(64))
|
|
432
|
-
.map((r) => ({ uid: r.uid }));
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
function resolveSeedIds$1(arg) {
|
|
436
|
-
if (arg && typeof arg === 'object' && 'seedLocalId' in arg) {
|
|
437
|
-
const item = arg;
|
|
438
|
-
return {
|
|
439
|
-
seedLocalId: item.seedLocalId,
|
|
440
|
-
seedUid: item.seedUid,
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
return arg;
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Per property: the **latest** metadata row (by `attestationCreatedAt` / `createdAt`) lacks a valid
|
|
447
|
-
* EAS attestation `uid` — local edit or missing post-publish UID backfill. Rows sync derived for
|
|
448
|
-
* ItemStorage properties (`derivedFromUid` set) count as published. **Not** equivalent to
|
|
449
|
-
* draft vs onchain for the whole seed; use `getSeedPublishState` for that.
|
|
450
|
-
*/
|
|
451
|
-
async function getPublishPendingDiff(arg) {
|
|
452
|
-
const { seedLocalId, seedUid } = resolveSeedIds$1(arg);
|
|
453
|
-
const appDb = BaseDb.getAppDb();
|
|
454
|
-
const empty = {
|
|
455
|
-
pendingProperties: [],
|
|
456
|
-
lastPublishedVersionUid: null,
|
|
457
|
-
lastVersionPublishedAt: null,
|
|
458
|
-
};
|
|
459
|
-
if (!appDb || (!seedLocalId && !seedUid)) {
|
|
460
|
-
return empty;
|
|
461
|
-
}
|
|
462
|
-
const whereClause = seedLocalId && seedUid
|
|
463
|
-
? or(eq(metadata.seedLocalId, seedLocalId), eq(metadata.seedUid, seedUid))
|
|
464
|
-
: seedLocalId
|
|
465
|
-
? eq(metadata.seedLocalId, seedLocalId)
|
|
466
|
-
: eq(metadata.seedUid, seedUid);
|
|
467
|
-
const rows = (await appDb.select().from(metadata).where(whereClause));
|
|
468
|
-
const byProp = new Map();
|
|
469
|
-
for (const row of rows) {
|
|
470
|
-
const name = row.propertyName ?? '';
|
|
471
|
-
if (!name)
|
|
472
|
-
continue;
|
|
473
|
-
const list = byProp.get(name) ?? [];
|
|
474
|
-
list.push(row);
|
|
475
|
-
byProp.set(name, list);
|
|
476
|
-
}
|
|
477
|
-
for (const list of byProp.values()) {
|
|
478
|
-
list.sort(compareMetadataRowsLatestFirst);
|
|
479
|
-
}
|
|
480
|
-
const pendingProperties = [];
|
|
481
|
-
for (const [propertyName, list] of byProp) {
|
|
482
|
-
const latest = list[0];
|
|
483
|
-
if (!latest)
|
|
484
|
-
continue;
|
|
485
|
-
if (!isPublishedMetadataRow(latest)) {
|
|
486
|
-
const prevWithUid = list.find(isPublishedMetadataRow);
|
|
487
|
-
pendingProperties.push({
|
|
488
|
-
propertyName,
|
|
489
|
-
currentValue: latest.propertyValue ?? null,
|
|
490
|
-
previousPublishedValue: prevWithUid?.propertyValue ?? null,
|
|
491
|
-
pending: true,
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
pendingProperties.sort((a, b) => a.propertyName.localeCompare(b.propertyName));
|
|
496
|
-
let lastPublishedVersionUid = null;
|
|
497
|
-
let lastVersionPublishedAt = null;
|
|
498
|
-
if (seedLocalId) {
|
|
499
|
-
const published = await getLatestPublishedVersionRow(seedLocalId);
|
|
500
|
-
if (published) {
|
|
501
|
-
lastPublishedVersionUid = published.uid;
|
|
502
|
-
if (published.attestationCreatedAt != null) {
|
|
503
|
-
lastVersionPublishedAt = published.attestationCreatedAt;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
return {
|
|
508
|
-
pendingProperties,
|
|
509
|
-
lastPublishedVersionUid,
|
|
510
|
-
lastVersionPublishedAt,
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
function resolveSeedIds(arg) {
|
|
515
|
-
if (arg && typeof arg === 'object' && 'seedLocalId' in arg) {
|
|
516
|
-
const item = arg;
|
|
517
|
-
return {
|
|
518
|
-
seedLocalId: item.seedLocalId,
|
|
519
|
-
seedUid: item.seedUid,
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
|
-
return arg;
|
|
523
|
-
}
|
|
524
|
-
function maxMs(a, b) {
|
|
525
|
-
const x = a ?? null;
|
|
526
|
-
const y = b ?? null;
|
|
527
|
-
if (x == null)
|
|
528
|
-
return y;
|
|
529
|
-
if (y == null)
|
|
530
|
-
return x;
|
|
531
|
-
return Math.max(x, y);
|
|
532
|
-
}
|
|
533
|
-
/**
|
|
534
|
-
* Whether the seed has **any** on-chain anchor in local SQLite: valid EAS UID on the seed row,
|
|
535
|
-
* on the newest **published** version row (`getLatestPublishedVersionRow`, which skips revoked
|
|
536
|
-
* versions), or on **any** metadata row.
|
|
537
|
-
* Not the same as “no unpublished edits”; see `getPublishPendingDiff` for per-property head rows.
|
|
538
|
-
*/
|
|
539
|
-
async function getSeedPublishState(arg) {
|
|
540
|
-
const { seedLocalId, seedUid } = resolveSeedIds(arg);
|
|
541
|
-
const appDb = BaseDb.getAppDb();
|
|
542
|
-
const empty = {
|
|
543
|
-
status: 'draft',
|
|
544
|
-
seedAttestationUid: null,
|
|
545
|
-
versionAttestationUid: null,
|
|
546
|
-
explorerUid: null,
|
|
547
|
-
lastAttestedAtMs: null,
|
|
548
|
-
revokedAt: null,
|
|
549
|
-
};
|
|
550
|
-
if (!appDb || (!seedLocalId && !seedUid)) {
|
|
551
|
-
return empty;
|
|
552
|
-
}
|
|
553
|
-
const seedWhere = seedLocalId && seedUid
|
|
554
|
-
? or(eq(seeds.localId, seedLocalId), eq(seeds.uid, seedUid))
|
|
555
|
-
: seedLocalId
|
|
556
|
-
? eq(seeds.localId, seedLocalId)
|
|
557
|
-
: eq(seeds.uid, seedUid);
|
|
558
|
-
const seedRows = await appDb.select().from(seeds).where(seedWhere).limit(1);
|
|
559
|
-
const seedRow = seedRows[0];
|
|
560
|
-
const seedAttestationUid = seedRow?.uid && isValidEasAttestationUid(seedRow.uid) ? seedRow.uid : null;
|
|
561
|
-
let lastAttestedAtMs = seedRow?.attestationCreatedAt ?? null;
|
|
562
|
-
const resolvedSeedLocalId = seedRow?.localId ?? seedLocalId;
|
|
563
|
-
let versionAttestationUid = null;
|
|
564
|
-
if (resolvedSeedLocalId) {
|
|
565
|
-
const v = await getLatestPublishedVersionRow(resolvedSeedLocalId);
|
|
566
|
-
if (v?.uid) {
|
|
567
|
-
versionAttestationUid = v.uid;
|
|
568
|
-
lastAttestedAtMs = maxMs(lastAttestedAtMs, v.attestationCreatedAt ?? undefined);
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
const metaWhere = seedLocalId && seedUid
|
|
572
|
-
? or(eq(metadata.seedLocalId, seedLocalId), eq(metadata.seedUid, seedUid))
|
|
573
|
-
: seedLocalId
|
|
574
|
-
? eq(metadata.seedLocalId, seedLocalId)
|
|
575
|
-
: eq(metadata.seedUid, seedUid);
|
|
576
|
-
const metaRows = await appDb.select().from(metadata).where(metaWhere);
|
|
577
|
-
let metadataExplorerUid = null;
|
|
578
|
-
for (const row of metaRows) {
|
|
579
|
-
if (!isValidEasAttestationUid(row.uid))
|
|
580
|
-
continue;
|
|
581
|
-
if (!metadataExplorerUid)
|
|
582
|
-
metadataExplorerUid = row.uid;
|
|
583
|
-
const t = row.attestationCreatedAt ?? row.createdAt;
|
|
584
|
-
lastAttestedAtMs = maxMs(lastAttestedAtMs, t ?? undefined);
|
|
585
|
-
}
|
|
586
|
-
const hasOnchain = !!(seedAttestationUid || versionAttestationUid || metadataExplorerUid);
|
|
587
|
-
const explorerUid = seedAttestationUid ?? versionAttestationUid ?? metadataExplorerUid;
|
|
588
|
-
return {
|
|
589
|
-
status: hasOnchain ? 'onchain' : 'draft',
|
|
590
|
-
seedAttestationUid,
|
|
591
|
-
versionAttestationUid,
|
|
592
|
-
explorerUid,
|
|
593
|
-
lastAttestedAtMs,
|
|
594
|
-
revokedAt: seedRow?.revokedAt ? seedRow.revokedAt : null,
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* Returns attestation UIDs (metadata.uid) for all metadata records belonging to a seed.
|
|
600
|
-
* Used when revoking attestations - metadata attestations must be revoked.
|
|
601
|
-
*/
|
|
602
|
-
const getMetadataAttestationUidsForSeedUid = async (seedUid) => {
|
|
603
|
-
if (!seedUid)
|
|
604
|
-
return [];
|
|
605
|
-
const appDb = BaseDb.getAppDb();
|
|
606
|
-
const rows = await appDb
|
|
607
|
-
.select({ uid: metadata.uid, schemaUid: metadata.schemaUid })
|
|
608
|
-
.from(metadata)
|
|
609
|
-
.where(and(eq(metadata.seedUid, seedUid), isNotNull(metadata.uid), ne(metadata.uid, ''), ne(metadata.uid, 'NULL'), ne(metadata.uid, '0x' + '0'.repeat(64))));
|
|
610
|
-
return rows
|
|
611
|
-
.filter((r) => r.uid != null && r.schemaUid != null)
|
|
612
|
-
.map((r) => ({ uid: r.uid, schemaUid: r.schemaUid }));
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
function getAttesterFromRow(row) {
|
|
616
|
-
if (row.publisher)
|
|
617
|
-
return row.publisher;
|
|
618
|
-
if (row.attestationRaw) {
|
|
619
|
-
try {
|
|
620
|
-
const parsed = JSON.parse(row.attestationRaw);
|
|
621
|
-
return parsed.attester ?? null;
|
|
622
|
-
}
|
|
623
|
-
catch {
|
|
624
|
-
return null;
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
return null;
|
|
628
|
-
}
|
|
629
|
-
/**
|
|
630
|
-
* Returns the attester address for a seed (from seeds.publisher or attestationRaw.attester).
|
|
631
|
-
* Used when revoking attestations to determine which account must perform the revoke.
|
|
632
|
-
*
|
|
633
|
-
* @param seedLocalId - Optional seed local ID
|
|
634
|
-
* @param seedUid - Optional seed UID (attestation ID)
|
|
635
|
-
* @returns The attester address, or null if not found or no attester
|
|
636
|
-
*/
|
|
637
|
-
async function getAttesterForSeed(params) {
|
|
638
|
-
const { seedLocalId, seedUid } = params;
|
|
639
|
-
const appDb = BaseDb.getAppDb();
|
|
640
|
-
if (!appDb)
|
|
641
|
-
return null;
|
|
642
|
-
const conditions = [];
|
|
643
|
-
if (seedLocalId)
|
|
644
|
-
conditions.push(eq(seeds.localId, seedLocalId));
|
|
645
|
-
if (seedUid)
|
|
646
|
-
conditions.push(eq(seeds.uid, seedUid));
|
|
647
|
-
if (conditions.length === 0)
|
|
648
|
-
return null;
|
|
649
|
-
const seedRows = await appDb
|
|
650
|
-
.select({
|
|
651
|
-
publisher: seeds.publisher,
|
|
652
|
-
attestationRaw: seeds.attestationRaw,
|
|
653
|
-
})
|
|
654
|
-
.from(seeds)
|
|
655
|
-
.where(conditions.length === 1 ? conditions[0] : or(...conditions))
|
|
656
|
-
.limit(1);
|
|
657
|
-
if (!seedRows || seedRows.length === 0)
|
|
658
|
-
return null;
|
|
659
|
-
return getAttesterFromRow(seedRows[0]);
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
/**
|
|
663
|
-
* Collects all items that will be in the publish payload (main item + related items from
|
|
664
|
-
* relations and lists). Used by ensureEasSchemas to register schemas for nested items.
|
|
665
|
-
* Skips items that already have seedUid (already published).
|
|
666
|
-
*
|
|
667
|
-
* Each returned item carries one cache hold the caller releases with `unload()`.
|
|
668
|
-
*/
|
|
669
|
-
async function getRelatedItemsForPublish(item, visited = new Set()) {
|
|
670
|
-
const loads = new ItemLoads();
|
|
671
|
-
let result = [];
|
|
672
|
-
try {
|
|
673
|
-
result = await collectRelatedItemsForPublish(item, visited, loads);
|
|
674
|
-
}
|
|
675
|
-
finally {
|
|
676
|
-
loads.release(result);
|
|
677
|
-
}
|
|
678
|
-
return result;
|
|
679
|
-
}
|
|
680
|
-
async function collectRelatedItemsForPublish(item, visited, loads) {
|
|
681
|
-
const seedLocalId = item.seedLocalId;
|
|
682
|
-
if (!seedLocalId || visited.has(seedLocalId)) {
|
|
683
|
-
return [];
|
|
684
|
-
}
|
|
685
|
-
visited.add(seedLocalId);
|
|
686
|
-
const result = [];
|
|
687
|
-
const { itemRelationProperties, itemImageProperties, itemListProperties } = await getSegmentedItemProperties(item);
|
|
688
|
-
const processRelationOrImage = async (prop) => {
|
|
689
|
-
const snapshot = prop.getService().getSnapshot();
|
|
690
|
-
const context = snapshot.context ?? null;
|
|
691
|
-
if (!context)
|
|
692
|
-
return;
|
|
693
|
-
let value = context.propertyValue;
|
|
694
|
-
// File/Image/Html/Json: fallback to metadata when propertyValue is empty (e.g. schema-loaded before metadata)
|
|
695
|
-
const isStorageSeedType = (t) => isDataType(t, ModelPropertyDataTypes.File) ||
|
|
696
|
-
isDataType(t, ModelPropertyDataTypes.Image) ||
|
|
697
|
-
isDataType(t, ModelPropertyDataTypes.Html) ||
|
|
698
|
-
isDataType(t, ModelPropertyDataTypes.Json);
|
|
699
|
-
const isStorageSeed = isStorageSeedType(prop.propertyDef?.dataType) ||
|
|
700
|
-
(isDataType(prop.propertyDef?.dataType, ModelPropertyDataTypes.Relation) &&
|
|
701
|
-
isStorageSeedType(prop.propertyDef?.refValueType));
|
|
702
|
-
if (!value && prop.propertyName && isStorageSeed) {
|
|
703
|
-
const ctx = context;
|
|
704
|
-
if (ctx.seedLocalId || ctx.seedUid) {
|
|
705
|
-
const _mod_0 = await import('./Item-0oDoTPhi.js');
|
|
706
|
-
const _ns_0 = _mod_0.at;
|
|
707
|
-
const { getPropertyData } = _ns_0;
|
|
708
|
-
const meta = await getPropertyData({
|
|
709
|
-
propertyName: prop.propertyName,
|
|
710
|
-
seedLocalId: ctx.seedLocalId,
|
|
711
|
-
seedUid: ctx.seedUid,
|
|
712
|
-
});
|
|
713
|
-
value = meta?.propertyValue;
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
const normalized = normalizeRelationPropertyValue(value);
|
|
717
|
-
if (!normalized)
|
|
718
|
-
return;
|
|
719
|
-
const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(normalized);
|
|
720
|
-
if (!seedLocalId && !seedUid)
|
|
721
|
-
return;
|
|
722
|
-
const relatedItem = await loads.getItem({ seedLocalId, seedUid });
|
|
723
|
-
if (!relatedItem || relatedItem.seedUid)
|
|
724
|
-
return;
|
|
725
|
-
const nested = await collectRelatedItemsForPublish(relatedItem, visited, loads);
|
|
726
|
-
result.push(...nested, relatedItem);
|
|
727
|
-
};
|
|
728
|
-
for (const prop of [...itemRelationProperties, ...itemImageProperties]) {
|
|
729
|
-
await processRelationOrImage(prop);
|
|
730
|
-
}
|
|
731
|
-
for (const listProperty of itemListProperties) {
|
|
732
|
-
const listRef = listProperty.propertyDef?.ref ||
|
|
733
|
-
listProperty.propertyDef?.refModelName;
|
|
734
|
-
if (!listRef)
|
|
735
|
-
continue;
|
|
736
|
-
const snapshot = listProperty.getService().getSnapshot();
|
|
737
|
-
const context = snapshot.context ?? null;
|
|
738
|
-
if (!context)
|
|
739
|
-
continue;
|
|
740
|
-
let value = context.propertyValue;
|
|
741
|
-
if (!value || listProperty.uid)
|
|
742
|
-
continue;
|
|
743
|
-
if (typeof value === 'string') {
|
|
744
|
-
value = parseListPropertyValueFromStorage(value);
|
|
745
|
-
}
|
|
746
|
-
const arr = Array.isArray(value) ? value : [];
|
|
747
|
-
for (const seedId of arr) {
|
|
748
|
-
const normalized = normalizeRelationPropertyValue(seedId);
|
|
749
|
-
if (!normalized)
|
|
750
|
-
continue;
|
|
751
|
-
const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(normalized);
|
|
752
|
-
if (!seedLocalId && !seedUid)
|
|
753
|
-
continue;
|
|
754
|
-
const relatedItem = await loads.getItem({ seedLocalId, seedUid });
|
|
755
|
-
if (!relatedItem || relatedItem.seedUid)
|
|
756
|
-
continue;
|
|
757
|
-
const nested = await collectRelatedItemsForPublish(relatedItem, visited, loads);
|
|
758
|
-
result.push(...nested, relatedItem);
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
return result;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
/**
|
|
765
|
-
* Counts seeds, property attestations, and Arweave upload bytes for a publish
|
|
766
|
-
* without building transactions or requiring a valid payload.
|
|
767
|
-
*/
|
|
768
|
-
const DATA_URI = /^data:[^;]+;base64,([\s\S]*)$/i;
|
|
769
|
-
const matchesDataType = (actual, expected) => normalizeDataType(actual) === expected;
|
|
770
|
-
function isZeroUid(uid) {
|
|
771
|
-
return !uid || uid === ZERO_BYTES32;
|
|
772
|
-
}
|
|
773
|
-
function isStorageTransactionPropertyName(name) {
|
|
774
|
-
return name === 'storageTransactionId' || name === 'storage_transaction_id';
|
|
775
|
-
}
|
|
776
|
-
/** Decoded byte length of a data-URI, or null if the string is not a base64 data URI. */
|
|
777
|
-
function estimateDataUriByteLength(dataUri) {
|
|
778
|
-
const m = DATA_URI.exec((dataUri ?? '').trim());
|
|
779
|
-
if (!m)
|
|
780
|
-
return null;
|
|
781
|
-
const b64 = m[1].replace(/\s/g, '');
|
|
782
|
-
if (!b64)
|
|
783
|
-
return 0;
|
|
784
|
-
const padding = b64.endsWith('==') ? 2 : b64.endsWith('=') ? 1 : 0;
|
|
785
|
-
return Math.max(0, Math.floor((b64.length * 3) / 4) - padding);
|
|
786
|
-
}
|
|
787
|
-
function propertyContext(prop) {
|
|
788
|
-
const snapshot = prop.getService().getSnapshot();
|
|
789
|
-
return snapshot && 'context' in snapshot
|
|
790
|
-
? (snapshot.context ?? null)
|
|
791
|
-
: null;
|
|
792
|
-
}
|
|
793
|
-
function getPublishValue(prop, context) {
|
|
794
|
-
const propertyDef = prop.propertyDef ?? context.propertyRecordSchema;
|
|
795
|
-
const isFileImageHtml = matchesDataType(propertyDef?.dataType, ModelPropertyDataTypes.File) ||
|
|
796
|
-
matchesDataType(propertyDef?.dataType, ModelPropertyDataTypes.Image) ||
|
|
797
|
-
matchesDataType(propertyDef?.dataType, ModelPropertyDataTypes.Html);
|
|
798
|
-
const isJsonStorage = matchesDataType(propertyDef?.dataType, ModelPropertyDataTypes.Json) ||
|
|
799
|
-
matchesDataType(propertyDef?.refValueType, ModelPropertyDataTypes.Json);
|
|
800
|
-
const isRelation = matchesDataType(propertyDef?.dataType, ModelPropertyDataTypes.Relation);
|
|
801
|
-
const isStorageTransactionIdProp = isStorageTransactionPropertyName(prop.propertyName);
|
|
802
|
-
const preferPropertyValue = isFileImageHtml || isRelation || isJsonStorage || isStorageTransactionIdProp;
|
|
803
|
-
let value = preferPropertyValue
|
|
804
|
-
? context.propertyValue
|
|
805
|
-
: (prop.value ?? context.propertyValue);
|
|
806
|
-
if (isRelation || isFileImageHtml || isJsonStorage) {
|
|
807
|
-
const pv = context.propertyValue;
|
|
808
|
-
if (typeof value === 'object' || value == null) {
|
|
809
|
-
if (typeof pv === 'string' && pv.trim())
|
|
810
|
-
value = pv.trim();
|
|
811
|
-
else if (pv && typeof pv === 'object' && typeof pv.seedLocalId === 'string') {
|
|
812
|
-
value = pv.seedLocalId;
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
return value;
|
|
817
|
-
}
|
|
818
|
-
function shouldAttestProperty(prop, forceFullSnapshot) {
|
|
819
|
-
if (INTERNAL_PROPERTY_NAMES.includes(prop.propertyName))
|
|
820
|
-
return false;
|
|
821
|
-
const context = propertyContext(prop);
|
|
822
|
-
if (!context)
|
|
823
|
-
return false;
|
|
824
|
-
const value = getPublishValue(prop, context);
|
|
825
|
-
if (value == null || value === '')
|
|
826
|
-
return false;
|
|
827
|
-
if (prop.uid && !forceFullSnapshot) {
|
|
828
|
-
const allowStorageTx = isStorageTransactionPropertyName(prop.propertyName) &&
|
|
829
|
-
typeof value === 'string' &&
|
|
830
|
-
value.trim() !== '';
|
|
831
|
-
if (!allowStorageTx)
|
|
832
|
-
return false;
|
|
833
|
-
}
|
|
834
|
-
return true;
|
|
835
|
-
}
|
|
836
|
-
async function addUpload(acc, seen, key, bytes) {
|
|
837
|
-
if (bytes <= 0 || seen.has(key))
|
|
838
|
-
return;
|
|
839
|
-
seen.add(key);
|
|
840
|
-
acc.uploadCount += 1;
|
|
841
|
-
acc.uploadBytes += bytes;
|
|
842
|
-
acc.uploadSizes.push(bytes);
|
|
843
|
-
}
|
|
844
|
-
async function addUploadFromPath(acc, seen, filePath, key) {
|
|
845
|
-
if (!filePath || filePath.endsWith('undefined'))
|
|
846
|
-
return;
|
|
847
|
-
const size = await BaseFileManager.getFileSize(filePath);
|
|
848
|
-
if (size == null || size <= 0)
|
|
849
|
-
return;
|
|
850
|
-
await addUpload(acc, seen, key, size);
|
|
851
|
-
}
|
|
852
|
-
async function collectUploadBytes(item, itemUploadProperties, itemImageProperties, relatedItemProperty, acc, seen) {
|
|
853
|
-
for (const uploadProperty of itemUploadProperties) {
|
|
854
|
-
let childBytes = 0;
|
|
855
|
-
let childCount = 0;
|
|
856
|
-
for (const childProperty of uploadProperty.childProperties) {
|
|
857
|
-
const filePath = childProperty.localStoragePath;
|
|
858
|
-
if (!filePath || filePath.endsWith('undefined'))
|
|
859
|
-
continue;
|
|
860
|
-
const size = await BaseFileManager.getFileSize(filePath);
|
|
861
|
-
if (size == null || size <= 0)
|
|
862
|
-
continue;
|
|
863
|
-
childBytes += size;
|
|
864
|
-
childCount += 1;
|
|
865
|
-
}
|
|
866
|
-
if (childCount > 0) {
|
|
867
|
-
await addUpload(acc, seen, `upload:${item.seedLocalId}:${uploadProperty.itemProperty.localId}`, childBytes);
|
|
868
|
-
continue;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
for (const itemProperty of itemImageProperties) {
|
|
872
|
-
const context = propertyContext(itemProperty);
|
|
873
|
-
if (!context)
|
|
874
|
-
continue;
|
|
875
|
-
const refResolvedValue = (typeof context.refResolvedValue === 'string' && context.refResolvedValue) ||
|
|
876
|
-
itemProperty.refResolvedValue;
|
|
877
|
-
if (typeof refResolvedValue !== 'string' || !refResolvedValue)
|
|
878
|
-
continue;
|
|
879
|
-
const propertyValue = context.propertyValue;
|
|
880
|
-
const { seedLocalId } = resolveSeedIdsFromRefString(normalizeRelationPropertyValue(propertyValue) ?? '');
|
|
881
|
-
const dataType = itemProperty.propertyDef?.refValueType ??
|
|
882
|
-
itemProperty.propertyDef?.dataType ??
|
|
883
|
-
'Image';
|
|
884
|
-
const fromGetter = itemProperty.localStoragePath;
|
|
885
|
-
const filePath = typeof fromGetter === 'string' && fromGetter
|
|
886
|
-
? fromGetter
|
|
887
|
-
: `${getStorageDirForDataType(String(dataType))}/${refResolvedValue}`;
|
|
888
|
-
await addUploadFromPath(acc, seen, filePath, seedLocalId ? `seed:${seedLocalId}` : `path:${filePath}`);
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
async function loadRelatedItem(value, loads) {
|
|
892
|
-
const normalized = normalizeRelationPropertyValue(value);
|
|
893
|
-
if (!normalized)
|
|
894
|
-
return undefined;
|
|
895
|
-
const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(normalized);
|
|
896
|
-
if (!seedLocalId && !seedUid)
|
|
897
|
-
return undefined;
|
|
898
|
-
try {
|
|
899
|
-
return await loads.getItem({ seedLocalId, seedUid });
|
|
900
|
-
}
|
|
901
|
-
catch {
|
|
902
|
-
return undefined;
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
async function relatedIfUnpublished(prop, loads) {
|
|
906
|
-
const context = propertyContext(prop);
|
|
907
|
-
if (!context)
|
|
908
|
-
return undefined;
|
|
909
|
-
const related = await loadRelatedItem(context.propertyValue, loads);
|
|
910
|
-
if (!related || !isZeroUid(related.seedUid))
|
|
911
|
-
return undefined;
|
|
912
|
-
return related;
|
|
913
|
-
}
|
|
914
|
-
/** Seed refs held by a relation/image property (one) or a list property (each member). */
|
|
915
|
-
function seedRefsOf(prop, isList) {
|
|
916
|
-
const context = propertyContext(prop);
|
|
917
|
-
if (!context)
|
|
918
|
-
return [];
|
|
919
|
-
let value = context.propertyValue;
|
|
920
|
-
if (isList) {
|
|
921
|
-
if (typeof value === 'string')
|
|
922
|
-
value = parseListPropertyValueFromStorage(value);
|
|
923
|
-
return (Array.isArray(value) ? value : [])
|
|
924
|
-
.map((v) => normalizeRelationPropertyValue(v))
|
|
925
|
-
.filter((v) => !!v);
|
|
926
|
-
}
|
|
927
|
-
const ref = normalizeRelationPropertyValue(value);
|
|
928
|
-
return ref ? [ref] : [];
|
|
929
|
-
}
|
|
930
|
-
/** Like getPublishPayload: attested refs to revoked seeds block the publish. */
|
|
931
|
-
async function collectUnpublishedRelatedItems(props, isList, forceFullSnapshot, out, loads, backReferences) {
|
|
932
|
-
for (const prop of props) {
|
|
933
|
-
if (!shouldAttestProperty(prop, forceFullSnapshot))
|
|
934
|
-
continue;
|
|
935
|
-
for (const ref of seedRefsOf(prop, isList)) {
|
|
936
|
-
const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(ref);
|
|
937
|
-
if (!seedLocalId && !seedUid)
|
|
938
|
-
continue;
|
|
939
|
-
const row = await findRelatedSeedRow({ seedLocalId, seedUid });
|
|
940
|
-
// A back reference to a seed this publish creates (e.g. a revoked root published again) is
|
|
941
|
-
// left for a later publish, not attested (publishDraftGraph.ts)
|
|
942
|
-
if (row && backReferences?.get(prop)?.has(row.seedLocalId))
|
|
943
|
-
continue;
|
|
944
|
-
if (!isUnpublishedSeed(row))
|
|
945
|
-
continue;
|
|
946
|
-
if (out.some((r) => r.propertyName === prop.propertyName && r.seedLocalId === row.seedLocalId)) {
|
|
947
|
-
continue;
|
|
948
|
-
}
|
|
949
|
-
const related = await loadRelatedItem(row.seedLocalId, loads);
|
|
950
|
-
out.push({
|
|
951
|
-
propertyName: prop.propertyName,
|
|
952
|
-
modelName: related?.modelName ?? relatedModelNameFromDef(prop.propertyDef) ?? row.type ?? 'unknown',
|
|
953
|
-
seedLocalId: row.seedLocalId,
|
|
954
|
-
seedUid: row.seedUid,
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
/**
|
|
960
|
-
* Images embedded in Html properties (co-published) whose seed was revoked: getPublishPayload rejects
|
|
961
|
-
* them like image properties pointing at revoked seeds. Like getPublishPayload, checks the published
|
|
962
|
-
* item's co-publish rows and those of the draft items published with it.
|
|
963
|
-
*/
|
|
964
|
-
async function collectUnpublishedEmbeddedImages(item, out, loads) {
|
|
965
|
-
const appDb = BaseDb.getAppDb();
|
|
966
|
-
if (!appDb || !item.seedLocalId)
|
|
967
|
-
return;
|
|
968
|
-
for (const owner of [item, ...(await getRelatedDraftsCoPublishedWith(item, loads))]) {
|
|
969
|
-
const rows = await appDb
|
|
970
|
-
.select()
|
|
971
|
-
.from(htmlEmbeddedImageCoPublish)
|
|
972
|
-
.where(eq(htmlEmbeddedImageCoPublish.parentSeedLocalId, owner.seedLocalId));
|
|
973
|
-
for (const row of rows) {
|
|
974
|
-
const seed = await findRelatedSeedRow({ seedLocalId: row.imageSeedLocalId });
|
|
975
|
-
if (!isUnpublishedSeed(seed))
|
|
976
|
-
continue;
|
|
977
|
-
const propertyName = htmlPropertyNameForHtmlSeed(owner, row.htmlSeedLocalId);
|
|
978
|
-
if (out.some((r) => r.propertyName === propertyName && r.seedLocalId === seed.seedLocalId))
|
|
979
|
-
continue;
|
|
980
|
-
out.push({ propertyName, modelName: 'Image', seedLocalId: seed.seedLocalId, seedUid: seed.seedUid });
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
async function appendCoPublishImages(item, acc, seen, visited, forceFullSnapshot, publishMode, graph, loads) {
|
|
985
|
-
const appDb = BaseDb.getAppDb();
|
|
986
|
-
if (!appDb)
|
|
987
|
-
return;
|
|
988
|
-
const rows = await appDb
|
|
989
|
-
.select()
|
|
990
|
-
.from(htmlEmbeddedImageCoPublish)
|
|
991
|
-
.where(eq(htmlEmbeddedImageCoPublish.parentSeedLocalId, item.seedLocalId));
|
|
992
|
-
for (const row of rows) {
|
|
993
|
-
const imageItem = await loads.find({
|
|
994
|
-
seedLocalId: row.imageSeedLocalId,
|
|
995
|
-
modelName: 'Image',
|
|
996
|
-
});
|
|
997
|
-
// Like getPublishPayload: an embedded image that already has a seed (published, or unpublished
|
|
998
|
-
// and reported by collectUnpublishedEmbeddedImages) is not co-published.
|
|
999
|
-
if (!imageItem || !isZeroUid(imageItem.seedUid))
|
|
1000
|
-
continue;
|
|
1001
|
-
const filePath = await findEmbeddedImageFilePath(imageItem.seedLocalId);
|
|
1002
|
-
if (filePath)
|
|
1003
|
-
await addUploadFromPath(acc, seen, filePath, `seed:${imageItem.seedLocalId}`);
|
|
1004
|
-
await summarizeItem(imageItem, publishMode, forceFullSnapshot, acc, seen, visited, graph, loads);
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
async function summarizeItem(item, publishMode, forceFullSnapshot, acc, seenUploads, visited, graph, loads) {
|
|
1008
|
-
const seedLocalId = item.seedLocalId;
|
|
1009
|
-
if (!seedLocalId || visited.has(seedLocalId))
|
|
1010
|
-
return;
|
|
1011
|
-
visited.add(seedLocalId);
|
|
1012
|
-
acc.seedCount += 1;
|
|
1013
|
-
if (isZeroUid(item.seedUid))
|
|
1014
|
-
acc.newSeedCount += 1;
|
|
1015
|
-
if (isZeroUid(item.seedUid) || forceFullSnapshot)
|
|
1016
|
-
acc.newVersionCount += 1;
|
|
1017
|
-
const { itemBasicProperties, itemRelationProperties, itemListProperties, itemUploadProperties, itemImageProperties, } = await getSegmentedItemProperties(item);
|
|
1018
|
-
await collectUploadBytes(item, itemUploadProperties, itemImageProperties, undefined, acc, seenUploads);
|
|
1019
|
-
await collectUnpublishedRelatedItems([...itemRelationProperties, ...itemImageProperties], false, forceFullSnapshot, acc.unpublishedRelatedItems, loads, graph.backReferences);
|
|
1020
|
-
await collectUnpublishedRelatedItems(itemListProperties, true, forceFullSnapshot, acc.unpublishedRelatedItems, loads, graph.backReferences);
|
|
1021
|
-
// Draft Image/File/Html/Json items its storage relations point at. Draft model items its relations
|
|
1022
|
-
// and lists reach are summarized by summarizePublishWork from the publish's draft graph.
|
|
1023
|
-
const storageProperties = new Set(itemImageProperties);
|
|
1024
|
-
for (const rel of itemRelationProperties) {
|
|
1025
|
-
if (!storageProperties.has(rel))
|
|
1026
|
-
continue;
|
|
1027
|
-
const related = await relatedIfUnpublished(rel, loads);
|
|
1028
|
-
if (related) {
|
|
1029
|
-
await summarizeItem(related, publishMode, forceFullSnapshot, acc, seenUploads, visited, graph, loads);
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
await appendCoPublishImages(item, acc, seenUploads, visited, forceFullSnapshot, publishMode, graph, loads);
|
|
1033
|
-
const attestable = [
|
|
1034
|
-
...itemBasicProperties,
|
|
1035
|
-
...itemRelationProperties,
|
|
1036
|
-
...itemListProperties,
|
|
1037
|
-
...itemImageProperties,
|
|
1038
|
-
...itemUploadProperties.map((u) => u.itemProperty),
|
|
1039
|
-
];
|
|
1040
|
-
const seenProps = new Set();
|
|
1041
|
-
for (const prop of attestable) {
|
|
1042
|
-
const key = prop.localId || `${prop.propertyName}:${prop.seedLocalId}`;
|
|
1043
|
-
if (seenProps.has(key))
|
|
1044
|
-
continue;
|
|
1045
|
-
seenProps.add(key);
|
|
1046
|
-
// A ref back to an item this publish creates is left for a later publish (publishDraftGraph.ts).
|
|
1047
|
-
if (graph.deferredProperties.has(prop))
|
|
1048
|
-
continue;
|
|
1049
|
-
if (shouldAttestProperty(prop, forceFullSnapshot))
|
|
1050
|
-
acc.attestationCount += 1;
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
/**
|
|
1054
|
-
* Local measurement of what a publish would do: seed/version/attestation counts
|
|
1055
|
-
* and Arweave upload byte totals. Does not hit the network or create transactions.
|
|
1056
|
-
*/
|
|
1057
|
-
const publishForcesFullSnapshot = async (item, publishMode) => {
|
|
1058
|
-
// Like getPublishPayload: an item whose seed was revoked republishes as a new seed with a full
|
|
1059
|
-
// snapshot.
|
|
1060
|
-
const republishRevokedSeed = !isZeroUid(item.seedUid) && (await isSeedRevoked(item.seedLocalId));
|
|
1061
|
-
return { republishRevokedSeed, forceFullSnapshot: publishMode === 'new_version' || republishRevokedSeed };
|
|
1062
|
-
};
|
|
1063
|
-
async function collectUnpublishedRelatedItemsOf(item, forceFullSnapshot, out, backReferences, loads) {
|
|
1064
|
-
const { itemRelationProperties, itemListProperties, itemImageProperties } = await getSegmentedItemProperties(item);
|
|
1065
|
-
await collectUnpublishedRelatedItems([...itemRelationProperties, ...itemImageProperties], false, forceFullSnapshot, out, loads, backReferences);
|
|
1066
|
-
await collectUnpublishedRelatedItems(itemListProperties, true, forceFullSnapshot, out, loads, backReferences);
|
|
1067
|
-
}
|
|
1068
|
-
/**
|
|
1069
|
-
* References a publish of `item` would attest to items whose seed was unpublished (revoked), the
|
|
1070
|
-
* same ones getPublishPayload rejects with RelatedItemUnpublishedError. Local reads only: the
|
|
1071
|
-
* publish package checks this before registering schemas or uploading anything.
|
|
1072
|
-
*/
|
|
1073
|
-
const getUnpublishedRelatedItems = async (item, options) => {
|
|
1074
|
-
const { forceFullSnapshot } = await publishForcesFullSnapshot(item, options?.publishMode ?? 'patch');
|
|
1075
|
-
const out = [];
|
|
1076
|
-
await withItemLoads(undefined, async (loads) => {
|
|
1077
|
-
// The item and every draft its publish carries along (publishDraftGraph.ts).
|
|
1078
|
-
const { drafts, backReferences } = await getPublishDraftGraph(item, { forceFullSnapshot, loads });
|
|
1079
|
-
for (const owner of [item, ...drafts.map((d) => d.item)]) {
|
|
1080
|
-
await collectUnpublishedRelatedItemsOf(owner, forceFullSnapshot, out, backReferences, loads);
|
|
1081
|
-
}
|
|
1082
|
-
await collectUnpublishedEmbeddedImages(item, out, loads);
|
|
1083
|
-
});
|
|
1084
|
-
return out;
|
|
1085
|
-
};
|
|
1086
|
-
const summarizePublishWork = async (item, options) => {
|
|
1087
|
-
const publishMode = options?.publishMode ?? 'patch';
|
|
1088
|
-
const { republishRevokedSeed, forceFullSnapshot } = await publishForcesFullSnapshot(item, publishMode);
|
|
1089
|
-
const acc = {
|
|
1090
|
-
publishMode,
|
|
1091
|
-
seedCount: 0,
|
|
1092
|
-
newSeedCount: 0,
|
|
1093
|
-
newVersionCount: 0,
|
|
1094
|
-
attestationCount: 0,
|
|
1095
|
-
uploadCount: 0,
|
|
1096
|
-
uploadBytes: 0,
|
|
1097
|
-
uploadSizes: [],
|
|
1098
|
-
unpublishedRelatedItems: [],
|
|
1099
|
-
};
|
|
1100
|
-
await withItemLoads(undefined, async (loads) => {
|
|
1101
|
-
const graph = await getPublishDraftGraph(item, { forceFullSnapshot, loads });
|
|
1102
|
-
const { drafts } = graph;
|
|
1103
|
-
const seenUploads = new Set();
|
|
1104
|
-
const visited = new Set();
|
|
1105
|
-
for (const owner of [item, ...drafts.map((d) => d.item)]) {
|
|
1106
|
-
await summarizeItem(owner, publishMode, forceFullSnapshot, acc, seenUploads, visited, graph, loads);
|
|
1107
|
-
}
|
|
1108
|
-
await collectUnpublishedEmbeddedImages(item, acc.unpublishedRelatedItems, loads);
|
|
1109
|
-
});
|
|
1110
|
-
// summarizeItem counts the root as an existing seed (it has a seedUid).
|
|
1111
|
-
if (republishRevokedSeed)
|
|
1112
|
-
acc.newSeedCount += 1;
|
|
1113
|
-
return acc;
|
|
1114
|
-
};
|
|
1115
|
-
|
|
1116
|
-
export { BaseDb, BaseFileManager, BaseFileManager as FileManager, ModelPropertyDataTypes, applyPropertyAttestationUidsFromPublish, compareMetadataRowsLatestFirst, estimateDataUriByteLength, generateId, getAttesterForSeed, getEasSchemaForItemProperty, getMetadataAttestationUidsForSeedUid, getPublishDraftGraph, getPublishPendingDiff, getRelatedItemsForPublish, getSeedPublishState, getSegmentedItemProperties, getUnpublishedRelatedItems, getVersionsForSeedUid, htmlEmbeddedImageCoPublish, isDataType, listRelationEasPropertyName, metadata, models, normalizeDataType, normalizePublisher, normalizeRelationPropertyValue, properties, resolveSeedIdsFromRefString, seeds, shouldAttestProperty, summarizePublishWork, updateVersionUid, versions };
|
|
1117
35
|
//# sourceMappingURL=main.js.map
|