@seedprotocol/sdk 0.7.9-next.1189.g5e63267 → 0.7.9
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-CG5IhPtL.js → Item-Bf4kWKpH.js} +5576 -6649
- package/dist/Item-Bf4kWKpH.js.map +1 -0
- package/dist/{ModelProperty-DDD47KVm.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-CZzKNL04.js → SchemaValidationService-CnmKyzR-.js} +6 -9
- package/dist/{SchemaValidationService-CZzKNL04.js.map → SchemaValidationService-CnmKyzR-.js.map} +1 -1
- package/dist/{configurePlatform-Dukm2QwO.js → configurePlatform-CiOJ1R3q.js} +3 -12
- package/dist/configurePlatform-CiOJ1R3q.js.map +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/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 +29 -1
- package/dist/{detachRowsBeforeDelete-Di1enVUF.js → detachRowsBeforeDelete-sEaUwlOU.js} +2 -13
- package/dist/{detachRowsBeforeDelete-Di1enVUF.js.map → detachRowsBeforeDelete-sEaUwlOU.js.map} +1 -1
- package/dist/dist/{index-rOTW-2QZ.d.ts → BaseFileManager-BAlySv8w.d.ts} +1407 -2700
- package/dist/dist/BaseFileManager-BAlySv8w.d.ts.map +1 -0
- package/dist/dist/{configurePlatform-Dukm2QwO.d.ts → configurePlatform-CiOJ1R3q.d.ts} +1 -1
- package/dist/dist/configurePlatform-CiOJ1R3q.d.ts.map +1 -0
- package/dist/dist/{index-DxHpPNfn.d.ts → index-D0V-mjCV.d.ts} +39 -1
- package/dist/dist/{index-DxHpPNfn.d.ts.map → index-D0V-mjCV.d.ts.map} +1 -1
- package/dist/dist/{index.node-WsEJCOwC.d.ts → index.node-CYPemH-t.d.ts} +157 -5
- package/dist/dist/{index.node-WsEJCOwC.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-DQoyhp2c.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-DxHpPNfn.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-QPWBkLJA.js → index.browser-CUmBVYen.js} +397 -356
- package/dist/index.browser-CUmBVYen.js.map +1 -0
- package/dist/{index.node-WsEJCOwC.js → index.node-CYPemH-t.js} +10 -10
- package/dist/index.node-CYPemH-t.js.map +1 -0
- package/dist/main.js +23 -1075
- 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/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 +77 -46
- 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 +4 -50
- 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 +6 -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 +5 -1
- package/dist/src/db/read/getPropertyClear.d.ts.map +1 -1
- 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 +2 -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 +13 -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/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/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 +18 -3
- 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 -26
- 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 +13 -13
- 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 +9 -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 +2 -1
- 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 +63 -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/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 -24
- 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-BMHoou6X.js → syncDbWithEas-CA7PvBgu.js} +112 -162
- 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-BHndShch.js → tolerantWebAccess-BJqViq08.js} +10 -15
- package/dist/{tolerantWebAccess-BHndShch.js.map → tolerantWebAccess-BJqViq08.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-fIURvYRV.js → updateSeedRevokedAt-BL9Bg-G7.js} +30 -4
- package/dist/updateSeedRevokedAt-BL9Bg-G7.js.map +1 -0
- package/package.json +6 -6
- package/dist/ClientManager-DqL0q_eu.js +0 -5292
- package/dist/ClientManager-DqL0q_eu.js.map +0 -1
- package/dist/Item-CG5IhPtL.js.map +0 -1
- package/dist/ModelProperty-DDD47KVm.js.map +0 -1
- package/dist/Schema-BS8oR7QV.js +0 -4370
- package/dist/Schema-BS8oR7QV.js.map +0 -1
- package/dist/backfillMetadataPropertyIds-C7P7FL6F.js +0 -72
- package/dist/backfillMetadataPropertyIds-C7P7FL6F.js.map +0 -1
- package/dist/changeFeed-M8sGbOrW.js +0 -726
- package/dist/changeFeed-M8sGbOrW.js.map +0 -1
- package/dist/configurePlatform-Dukm2QwO.js.map +0 -1
- package/dist/dist/ClientManager-DqL0q_eu.d.ts +0 -952
- package/dist/dist/ClientManager-DqL0q_eu.d.ts.map +0 -1
- package/dist/dist/Item-CG5IhPtL.d.ts +0 -1115
- package/dist/dist/Item-CG5IhPtL.d.ts.map +0 -1
- package/dist/dist/ModelProperty-DDD47KVm.d.ts +0 -315
- package/dist/dist/ModelProperty-DDD47KVm.d.ts.map +0 -1
- package/dist/dist/Schema-BS8oR7QV.d.ts +0 -432
- package/dist/dist/Schema-BS8oR7QV.d.ts.map +0 -1
- package/dist/dist/SchemaValidationService-CZzKNL04.d.ts +0 -118
- package/dist/dist/SchemaValidationService-CZzKNL04.d.ts.map +0 -1
- package/dist/dist/backfillMetadataPropertyIds-C7P7FL6F.d.ts +0 -7
- package/dist/dist/backfillMetadataPropertyIds-C7P7FL6F.d.ts.map +0 -1
- package/dist/dist/changeFeed-M8sGbOrW.d.ts +0 -160
- package/dist/dist/changeFeed-M8sGbOrW.d.ts.map +0 -1
- package/dist/dist/configurePlatform-Dukm2QwO.d.ts.map +0 -1
- package/dist/dist/detachRowsBeforeDelete-Di1enVUF.d.ts +0 -13
- package/dist/dist/detachRowsBeforeDelete-Di1enVUF.d.ts.map +0 -1
- package/dist/dist/eas-B5VJolSj.d.ts +0 -12
- package/dist/dist/eas-B5VJolSj.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-CS3nDpUU.d.ts +0 -515
- package/dist/dist/errors-CS3nDpUU.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-CuQmK7An.d.ts +0 -13
- package/dist/dist/findSeedRowsByUid-CuQmK7An.d.ts.map +0 -1
- package/dist/dist/getItem-Uha3_H0t.d.ts +0 -6
- package/dist/dist/getItem-Uha3_H0t.d.ts.map +0 -1
- package/dist/dist/getPublishPayload-pbin4lk8.d.ts +0 -65
- package/dist/dist/getPublishPayload-pbin4lk8.d.ts.map +0 -1
- package/dist/dist/getPublishPendingDiff-ByIaPvCn.d.ts +0 -18
- package/dist/dist/getPublishPendingDiff-ByIaPvCn.d.ts.map +0 -1
- package/dist/dist/getPublishUploads-BBqiowVc.d.ts +0 -89
- package/dist/dist/getPublishUploads-BBqiowVc.d.ts.map +0 -1
- package/dist/dist/index-DQoyhp2c.d.ts +0 -6
- package/dist/dist/index-DQoyhp2c.d.ts.map +0 -1
- package/dist/dist/index-njjjo74v.d.ts +0 -14
- package/dist/dist/index-njjjo74v.d.ts.map +0 -1
- package/dist/dist/index-rOTW-2QZ.d.ts.map +0 -1
- package/dist/dist/index.browser-QPWBkLJA.d.ts +0 -9959
- package/dist/dist/index.browser-QPWBkLJA.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-onFOG2x6.d.ts +0 -7
- package/dist/dist/modelPropertyRecordSchemas-onFOG2x6.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-C85DCD7K.d.ts +0 -37
- package/dist/dist/property-C85DCD7K.d.ts.map +0 -1
- package/dist/dist/propertyValidationRules-CjUPOFeu.d.ts +0 -13
- package/dist/dist/propertyValidationRules-CjUPOFeu.d.ts.map +0 -1
- package/dist/dist/publishDraftGraph-DBWAN72w.d.ts +0 -93
- package/dist/dist/publishDraftGraph-DBWAN72w.d.ts.map +0 -1
- package/dist/dist/resolveModelForSyncedSeed-fIURvYRV.d.ts +0 -21
- package/dist/dist/resolveModelForSyncedSeed-fIURvYRV.d.ts.map +0 -1
- package/dist/dist/syncDbWithEas-BMHoou6X.d.ts +0 -13
- package/dist/dist/syncDbWithEas-BMHoou6X.d.ts.map +0 -1
- package/dist/dist/tolerantWebAccess-BHndShch.d.ts +0 -113
- package/dist/dist/tolerantWebAccess-BHndShch.d.ts.map +0 -1
- package/dist/dist/updateSeedRevokedAt-DpfG6ztE.d.ts +0 -11
- package/dist/dist/updateSeedRevokedAt-DpfG6ztE.d.ts.map +0 -1
- package/dist/eas-B5VJolSj.js +0 -67
- package/dist/eas-B5VJolSj.js.map +0 -1
- package/dist/errors-CS3nDpUU.js +0 -4006
- package/dist/errors-CS3nDpUU.js.map +0 -1
- package/dist/eventBus-7vxTCc3a.js +0 -64
- package/dist/eventBus-7vxTCc3a.js.map +0 -1
- package/dist/findSeedRowsByUid-CuQmK7An.js +0 -47
- package/dist/findSeedRowsByUid-CuQmK7An.js.map +0 -1
- package/dist/getItem-Uha3_H0t.js +0 -45
- package/dist/getItem-Uha3_H0t.js.map +0 -1
- package/dist/getPublishPayload-pbin4lk8.js +0 -1736
- package/dist/getPublishPayload-pbin4lk8.js.map +0 -1
- package/dist/getPublishPendingDiff-ByIaPvCn.js +0 -118
- package/dist/getPublishPendingDiff-ByIaPvCn.js.map +0 -1
- package/dist/getPublishUploads-BBqiowVc.js +0 -1080
- package/dist/getPublishUploads-BBqiowVc.js.map +0 -1
- package/dist/index-DQoyhp2c.js.map +0 -1
- package/dist/index-DxHpPNfn.js.map +0 -1
- package/dist/index-njjjo74v.js +0 -29
- package/dist/index-njjjo74v.js.map +0 -1
- package/dist/index-rOTW-2QZ.js +0 -4760
- package/dist/index-rOTW-2QZ.js.map +0 -1
- package/dist/index.browser-QPWBkLJA.js.map +0 -1
- package/dist/index.node-WsEJCOwC.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-onFOG2x6.js +0 -94
- package/dist/modelPropertyRecordSchemas-onFOG2x6.js.map +0 -1
- package/dist/property-C85DCD7K.js +0 -289
- package/dist/property-C85DCD7K.js.map +0 -1
- package/dist/propertyValidationRules-CjUPOFeu.js +0 -73
- package/dist/propertyValidationRules-CjUPOFeu.js.map +0 -1
- package/dist/publishDraftGraph-DBWAN72w.js +0 -505
- package/dist/publishDraftGraph-DBWAN72w.js.map +0 -1
- package/dist/resolveModelForSyncedSeed-fIURvYRV.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-BMHoou6X.js.map +0 -1
- package/dist/updateSeedRevokedAt-DpfG6ztE.js +0 -31
- package/dist/updateSeedRevokedAt-DpfG6ztE.js.map +0 -1
|
@@ -0,0 +1,817 @@
|
|
|
1
|
+
import { w as writeNextSchemaVersion, o as applySchemaFile } from './errors-DLSoqSHG.js';
|
|
2
|
+
import { a7 as convertTxIdToImage, x as normalizePublisher, m as generateId, n as normalizeDataType, j as findSeedRow, w as writeInBatches, a0 as INTERNAL_PROPERTY_NAMES, i as isDataType, M as ModelPropertyDataTypes, r as resolveModelRecord } from './tabEvents-CaVmngqr.js';
|
|
3
|
+
import './property-BxUYznH0.js';
|
|
4
|
+
import { B as BaseDb, v as versions, s as seeds, m as metadata, d as models, l as properties, w as BaseFileManager } from './BaseFileManager-BAlySv8w.js';
|
|
5
|
+
import { am as getStorageTransactionIdForSeedUid, an as latestVersionOrder, ao as otherVersionRowsWithUid, ap as mergeVersionRowInto, M as isVersionRevoked, aq as findMetadataPropertyByName, N as readModelMetadataProperties, S as parseListPropertyValueFromStorage, L as getLatestPublishedVersionRow, ar as resolvePublisherFromSeedRow } from './Item-Bf4kWKpH.js';
|
|
6
|
+
import { eq, and, inArray, or, isNull } from 'drizzle-orm';
|
|
7
|
+
import { classifyMediaRef, BaseArweaveClient } from '@seedprotocol/arweave';
|
|
8
|
+
import 'pluralize';
|
|
9
|
+
import { isPlaceholderUid, isValidEasAttestationUid, normalizeBytes32Hex } from '@seedprotocol/eas';
|
|
10
|
+
import './Schema-J_1f6p0c.js';
|
|
11
|
+
import './errors-C1qUEZ7A.js';
|
|
12
|
+
import './updateSeedRevokedAt-BL9Bg-G7.js';
|
|
13
|
+
import './ModelProperty-BlaEgb_U.js';
|
|
14
|
+
import './eas-wB_fQ8Tc.js';
|
|
15
|
+
import './getPublishPendingDiff-D6_-A5ns.js';
|
|
16
|
+
import { g as getPropertyClear } from './getPublishPayload-BnIwpwz1.js';
|
|
17
|
+
import { g as getPublishGraph } from './publishGraph-EcB40Uii.js';
|
|
18
|
+
import { g as getPublishUploadSources } from './getPublishUploads-sS6JfPgz.js';
|
|
19
|
+
import debug from 'debug';
|
|
20
|
+
|
|
21
|
+
/** Classification and feed-field helpers live in `@seedprotocol/arweave`; resolving needs the local DB and files. */
|
|
22
|
+
async function resolveTxId(txId) {
|
|
23
|
+
const local = await convertTxIdToImage(txId);
|
|
24
|
+
if (local) {
|
|
25
|
+
return { status: 'ready', href: local, source: 'localBlob' };
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
status: 'ready',
|
|
29
|
+
href: BaseArweaveClient.getRawUrl(txId),
|
|
30
|
+
source: 'gateway',
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolve a classified media reference to a display URL (https/blob/data), using local files when present.
|
|
35
|
+
* A `localBlob` result's href is a new blob: URL per call: the caller revokes it
|
|
36
|
+
* (`URL.revokeObjectURL`) when it stops displaying it, as `useResolvedMediaRef` does.
|
|
37
|
+
*/
|
|
38
|
+
async function resolveMediaRef(raw, options) {
|
|
39
|
+
const classification = classifyMediaRef(raw, options);
|
|
40
|
+
switch (classification.kind) {
|
|
41
|
+
case 'empty':
|
|
42
|
+
return { status: 'empty' };
|
|
43
|
+
case 'url':
|
|
44
|
+
return {
|
|
45
|
+
status: 'ready',
|
|
46
|
+
href: classification.href,
|
|
47
|
+
source: 'direct',
|
|
48
|
+
};
|
|
49
|
+
case 'nonMediaUrl':
|
|
50
|
+
return {
|
|
51
|
+
status: 'unresolved',
|
|
52
|
+
reason: 'non_media_url',
|
|
53
|
+
classification,
|
|
54
|
+
};
|
|
55
|
+
case 'seedLocalId':
|
|
56
|
+
return {
|
|
57
|
+
status: 'unresolved',
|
|
58
|
+
reason: 'seed_local_id_not_portable',
|
|
59
|
+
classification,
|
|
60
|
+
};
|
|
61
|
+
case 'unknown':
|
|
62
|
+
return {
|
|
63
|
+
status: 'unresolved',
|
|
64
|
+
reason: 'unknown_ref',
|
|
65
|
+
classification,
|
|
66
|
+
};
|
|
67
|
+
case 'arweaveTxId':
|
|
68
|
+
return resolveTxId(classification.txId);
|
|
69
|
+
case 'seedUid': {
|
|
70
|
+
const appDb = BaseDb.getAppDb();
|
|
71
|
+
if (!appDb) {
|
|
72
|
+
return {
|
|
73
|
+
status: 'unresolved',
|
|
74
|
+
reason: 'seed_uid_requires_app_db',
|
|
75
|
+
classification,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const storageTransactionId = await getStorageTransactionIdForSeedUid(classification.uid);
|
|
79
|
+
if (!storageTransactionId) {
|
|
80
|
+
return {
|
|
81
|
+
status: 'unresolved',
|
|
82
|
+
reason: 'seed_uid_no_storage_transaction',
|
|
83
|
+
classification,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return resolveTxId(storageTransactionId);
|
|
87
|
+
}
|
|
88
|
+
default:
|
|
89
|
+
return {
|
|
90
|
+
status: 'unresolved',
|
|
91
|
+
reason: 'unknown_ref',
|
|
92
|
+
classification,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Updates the version record with the attestation UID after a Version attestation is created, in
|
|
99
|
+
* one transaction. Targets `versionLocalId` when given, else the first version without a uid yet
|
|
100
|
+
* in head-version order (the one being published). A uid one of the seed's version rows already
|
|
101
|
+
* has is ignored. A version row
|
|
102
|
+
* another writer inserted for the same uid (a sync that ran during the publish) is merged into the
|
|
103
|
+
* target first, since versions.uid is unique.
|
|
104
|
+
* Publisher is immutable once set: we never overwrite an existing publisher.
|
|
105
|
+
*/
|
|
106
|
+
const updateVersionUid = async ({ seedLocalId, versionUid, versionLocalId, publisher, attestationCreatedAt, }) => {
|
|
107
|
+
if (!seedLocalId || !versionUid) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (!BaseDb.getAppDb())
|
|
111
|
+
return;
|
|
112
|
+
const normalizedPublisher = normalizePublisher(publisher);
|
|
113
|
+
await BaseDb.transaction(async (tx) => {
|
|
114
|
+
const rows = await tx
|
|
115
|
+
.select({ localId: versions.localId, uid: versions.uid, publisher: versions.publisher })
|
|
116
|
+
.from(versions)
|
|
117
|
+
.where(eq(versions.seedLocalId, seedLocalId))
|
|
118
|
+
.orderBy(latestVersionOrder());
|
|
119
|
+
// Already recorded: nothing to stamp. A patch publish attaches to an existing version, and the
|
|
120
|
+
// modular executor's SeedPublished event still reports that version's uid; stamping it onto a
|
|
121
|
+
// local draft version would give two rows the same version uid.
|
|
122
|
+
const wanted = versionUid.toLowerCase();
|
|
123
|
+
if (rows.some((r) => r.uid?.toLowerCase() === wanted))
|
|
124
|
+
return;
|
|
125
|
+
const toUpdate = rows.find((r) => r.localId && isPlaceholderUid(r.uid) && (!versionLocalId || r.localId === versionLocalId));
|
|
126
|
+
if (!toUpdate?.localId) {
|
|
127
|
+
// No local draft version took this attestation (e.g. a republish after unpublish, where every
|
|
128
|
+
// version row is a revoked attestation): record the new version so it is the latest one. A row
|
|
129
|
+
// another writer already stored for this uid stays (DO NOTHING).
|
|
130
|
+
const [seed] = await tx
|
|
131
|
+
.select({ type: seeds.type })
|
|
132
|
+
.from(seeds)
|
|
133
|
+
.where(eq(seeds.localId, seedLocalId))
|
|
134
|
+
.limit(1);
|
|
135
|
+
if (!seed)
|
|
136
|
+
return;
|
|
137
|
+
await tx
|
|
138
|
+
.insert(versions)
|
|
139
|
+
.values({
|
|
140
|
+
localId: generateId(),
|
|
141
|
+
seedLocalId,
|
|
142
|
+
seedType: seed.type,
|
|
143
|
+
uid: versionUid,
|
|
144
|
+
...(normalizedPublisher && { publisher: normalizedPublisher }),
|
|
145
|
+
...(attestationCreatedAt != null && { attestationCreatedAt }),
|
|
146
|
+
})
|
|
147
|
+
.onConflictDoNothing();
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
for (const duplicate of await otherVersionRowsWithUid(tx, versionUid, toUpdate.localId)) {
|
|
151
|
+
await mergeVersionRowInto(tx, duplicate, toUpdate.localId);
|
|
152
|
+
}
|
|
153
|
+
const shouldSetPublisher = normalizedPublisher != null && (toUpdate.publisher == null || toUpdate.publisher === '');
|
|
154
|
+
await tx
|
|
155
|
+
.update(versions)
|
|
156
|
+
.set({
|
|
157
|
+
uid: versionUid,
|
|
158
|
+
...(shouldSetPublisher && { publisher: normalizedPublisher }),
|
|
159
|
+
...(attestationCreatedAt != null && { attestationCreatedAt }),
|
|
160
|
+
})
|
|
161
|
+
.where(eq(versions.localId, toUpdate.localId));
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* After property attestations succeed, records each one on the metadata row whose value it
|
|
167
|
+
* attested (`metadataLocalId`, which the payload read), so getPublishPendingDiff and later
|
|
168
|
+
* publishes stay aligned with on-chain state. No row is searched for by name: a newer row holds a
|
|
169
|
+
* value the chain doesn't have (audit 1.1, G18-4).
|
|
170
|
+
*
|
|
171
|
+
* - A placeholder row (no uid yet) takes the uid, the version, and the schema uid when it has none.
|
|
172
|
+
* - An attested row (a full-snapshot publish: `new_version`, or a republish after unpublish,
|
|
173
|
+
* attests properties attested before) stays as it is, and the attestation is recorded as a new
|
|
174
|
+
* row for the published version: a copy with the new uid, so readers show the published version
|
|
175
|
+
* without a sync.
|
|
176
|
+
* - A pair with no row (a property with no row yet, e.g. a storage transaction slot) gets a new
|
|
177
|
+
* row when it names its property and carries its value.
|
|
178
|
+
* Rows keep or get the published version's local id when `versionUid` has a version row.
|
|
179
|
+
*
|
|
180
|
+
* Relations and lists of relations are recorded as attested, the way an EAS sync of the
|
|
181
|
+
* attestation stores them: a value naming seeds by local id gets the seed uids the attestation
|
|
182
|
+
* encodes, the uid (Relation) or a JSON array of uids in slot order (List). Each uid comes from
|
|
183
|
+
* `resolvedSeedUids` (seeds this publish created, not recorded on their seed rows yet), else the
|
|
184
|
+
* seed's recorded live uid.
|
|
185
|
+
*/
|
|
186
|
+
async function applyPropertyAttestationUidsFromPublish(params) {
|
|
187
|
+
const { seedLocalId, attestationCreatedAtMs, pairs, versionUid, resolvedSeedUids } = params;
|
|
188
|
+
const appDb = BaseDb.getAppDb();
|
|
189
|
+
if (!appDb || !seedLocalId || pairs.length === 0)
|
|
190
|
+
return;
|
|
191
|
+
const rows = await appDb.select().from(metadata).where(eq(metadata.seedLocalId, seedLocalId));
|
|
192
|
+
const working = rows.map((r) => ({ ...r }));
|
|
193
|
+
const validVersion = versionUid != null && versionUid !== '' && isValidEasAttestationUid(versionUid)
|
|
194
|
+
? versionUid
|
|
195
|
+
: undefined;
|
|
196
|
+
let versionLocalId;
|
|
197
|
+
let liveSeedUid = null;
|
|
198
|
+
if (validVersion) {
|
|
199
|
+
const [versionRow] = await appDb
|
|
200
|
+
.select({ localId: versions.localId, seedUid: versions.seedUid })
|
|
201
|
+
.from(versions)
|
|
202
|
+
.where(and(eq(versions.seedLocalId, seedLocalId), eq(versions.uid, validVersion)))
|
|
203
|
+
.limit(1);
|
|
204
|
+
versionLocalId = versionRow?.localId ?? undefined;
|
|
205
|
+
const [seedRow] = await appDb
|
|
206
|
+
.select({ uid: seeds.uid, revokedAt: seeds.revokedAt })
|
|
207
|
+
.from(seeds)
|
|
208
|
+
.where(eq(seeds.localId, seedLocalId))
|
|
209
|
+
.limit(1);
|
|
210
|
+
// A republish records its new seed uid after this; updateSeedUid fills it in then.
|
|
211
|
+
liveSeedUid =
|
|
212
|
+
versionRow?.seedUid ??
|
|
213
|
+
(isValidEasAttestationUid(seedRow?.uid) && !isVersionRevoked(seedRow?.revokedAt)
|
|
214
|
+
? seedRow.uid
|
|
215
|
+
: null);
|
|
216
|
+
}
|
|
217
|
+
const props = await loadSeedProperties(appDb, seedLocalId, rows);
|
|
218
|
+
const propertyOfRow = (row) => (row.propertyId != null ? props.find((p) => p.id === row.propertyId) : undefined) ??
|
|
219
|
+
(row.propertyName ? findMetadataPropertyByName(props, row.propertyName) : undefined);
|
|
220
|
+
const attestedRefValue = async (row, property) => {
|
|
221
|
+
const kind = refKind(property);
|
|
222
|
+
if (!kind || row.propertyValue == null)
|
|
223
|
+
return undefined;
|
|
224
|
+
return toAttestedRefValue(appDb, row.propertyValue, kind, resolvedSeedUids ?? {});
|
|
225
|
+
};
|
|
226
|
+
for (const pair of pairs) {
|
|
227
|
+
const att = pair.attestationUid?.trim();
|
|
228
|
+
if (!isValidEasAttestationUid(att))
|
|
229
|
+
continue;
|
|
230
|
+
const wantSchema = normalizeBytes32Hex(pair.schemaUid);
|
|
231
|
+
if (!wantSchema)
|
|
232
|
+
continue;
|
|
233
|
+
// Already recorded (a replayed receipt)
|
|
234
|
+
if (working.some((r) => r.uid?.toLowerCase() === att.toLowerCase()))
|
|
235
|
+
continue;
|
|
236
|
+
const target = pair.metadataLocalId ? working.find((r) => r.localId === pair.metadataLocalId) : undefined;
|
|
237
|
+
const property = target ? propertyOfRow(target) : pair.propertyName ? findMetadataPropertyByName(props, pair.propertyName) : undefined;
|
|
238
|
+
const value = pair.value ?? target?.propertyValue ?? null;
|
|
239
|
+
const attestedValue = await attestedRefValue({ propertyValue: value }, property);
|
|
240
|
+
const recordedValue = attestedValue ?? value;
|
|
241
|
+
if (target?.localId && isPlaceholderUid(target.uid)) {
|
|
242
|
+
const update = {
|
|
243
|
+
uid: att,
|
|
244
|
+
...(recordedValue !== target.propertyValue && { propertyValue: recordedValue }),
|
|
245
|
+
...(!normalizeBytes32Hex(target.schemaUid) && { schemaUid: wantSchema }),
|
|
246
|
+
...(attestationCreatedAtMs != null && { attestationCreatedAt: attestationCreatedAtMs }),
|
|
247
|
+
...(validVersion && { versionUid: validVersion }),
|
|
248
|
+
...(versionLocalId && { versionLocalId }),
|
|
249
|
+
};
|
|
250
|
+
await appDb.update(metadata).set(update).where(eq(metadata.localId, target.localId));
|
|
251
|
+
Object.assign(target, update);
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
// An attested row (full snapshot), or none: record the attestation as a new row for the
|
|
255
|
+
// published version.
|
|
256
|
+
if (!validVersion)
|
|
257
|
+
continue;
|
|
258
|
+
if (!target && (!pair.propertyName || pair.value == null))
|
|
259
|
+
continue;
|
|
260
|
+
const now = Date.now();
|
|
261
|
+
const row = {
|
|
262
|
+
...(target ?? {
|
|
263
|
+
propertyName: property?.storageName ?? pair.propertyName,
|
|
264
|
+
seedLocalId,
|
|
265
|
+
modelType: null,
|
|
266
|
+
easDataType: null,
|
|
267
|
+
refValueType: null,
|
|
268
|
+
refModelUid: null,
|
|
269
|
+
refSeedType: null,
|
|
270
|
+
refResolvedValue: null,
|
|
271
|
+
refResolvedDisplayValue: null,
|
|
272
|
+
localStorageDir: null,
|
|
273
|
+
contentHash: null,
|
|
274
|
+
publisher: null,
|
|
275
|
+
retract: null,
|
|
276
|
+
}),
|
|
277
|
+
propertyValue: recordedValue,
|
|
278
|
+
localId: generateId(),
|
|
279
|
+
propertyId: target?.propertyId ?? property?.id ?? null,
|
|
280
|
+
uid: att,
|
|
281
|
+
schemaUid: normalizeBytes32Hex(target?.schemaUid) ? target.schemaUid : wantSchema,
|
|
282
|
+
seedUid: liveSeedUid,
|
|
283
|
+
versionUid: validVersion,
|
|
284
|
+
versionLocalId: versionLocalId ?? target?.versionLocalId ?? null,
|
|
285
|
+
attestationCreatedAt: attestationCreatedAtMs ?? now,
|
|
286
|
+
attestationRaw: null,
|
|
287
|
+
revokedAt: null,
|
|
288
|
+
derivedFromUid: null,
|
|
289
|
+
// Stamped here: the spread copies the source row's times.
|
|
290
|
+
createdAt: now,
|
|
291
|
+
updatedAt: now,
|
|
292
|
+
};
|
|
293
|
+
await appDb.insert(metadata).values(row);
|
|
294
|
+
working.push(row);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/** How a property's value names seeds: one seed (Relation) or a JSON list of them (List of Relation). */
|
|
298
|
+
function refKind(property) {
|
|
299
|
+
if (!property)
|
|
300
|
+
return undefined;
|
|
301
|
+
const dataType = normalizeDataType(property.dataType);
|
|
302
|
+
if (dataType === 'Relation')
|
|
303
|
+
return 'relation';
|
|
304
|
+
if (dataType === 'List' && normalizeDataType(property.refValueType ?? undefined) === 'Relation' && property.ref) {
|
|
305
|
+
return 'list';
|
|
306
|
+
}
|
|
307
|
+
return undefined;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* The seed's model's properties. The model comes from the seed's model_file_id, else a metadata
|
|
311
|
+
* row's property_id; an unknown model gives none (rows then match by the pair's name alone,
|
|
312
|
+
* values unchanged).
|
|
313
|
+
*/
|
|
314
|
+
async function loadSeedProperties(appDb, seedLocalId, rows) {
|
|
315
|
+
try {
|
|
316
|
+
let modelId;
|
|
317
|
+
const [seedRow] = await appDb
|
|
318
|
+
.select({ modelFileId: seeds.modelFileId })
|
|
319
|
+
.from(seeds)
|
|
320
|
+
.where(eq(seeds.localId, seedLocalId))
|
|
321
|
+
.limit(1);
|
|
322
|
+
if (seedRow?.modelFileId) {
|
|
323
|
+
const [m] = await appDb
|
|
324
|
+
.select({ id: models.id })
|
|
325
|
+
.from(models)
|
|
326
|
+
.where(eq(models.schemaFileId, seedRow.modelFileId))
|
|
327
|
+
.limit(1);
|
|
328
|
+
modelId = m?.id;
|
|
329
|
+
}
|
|
330
|
+
const propertyId = rows.find((r) => r.propertyId != null)?.propertyId;
|
|
331
|
+
if (modelId == null && propertyId != null) {
|
|
332
|
+
const [p] = await appDb
|
|
333
|
+
.select({ modelId: properties.modelId })
|
|
334
|
+
.from(properties)
|
|
335
|
+
.where(eq(properties.id, propertyId))
|
|
336
|
+
.limit(1);
|
|
337
|
+
modelId = p?.modelId ?? undefined;
|
|
338
|
+
}
|
|
339
|
+
if (modelId == null)
|
|
340
|
+
return [];
|
|
341
|
+
return await readModelMetadataProperties(appDb, modelId);
|
|
342
|
+
}
|
|
343
|
+
catch {
|
|
344
|
+
// Unknown model: match by the pair's name alone.
|
|
345
|
+
return [];
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
const isUid = (v) => /^0x[0-9a-fA-F]{64}$/.test(v);
|
|
349
|
+
/**
|
|
350
|
+
* `raw` (a Relation value, or a List value as stored) with every seed named by local id replaced by
|
|
351
|
+
* its uid: from `resolvedSeedUids`, else the seed's recorded live uid. Undefined when nothing
|
|
352
|
+
* changes, or when a seed has no uid (then the value is not what was attested; left as it is).
|
|
353
|
+
*/
|
|
354
|
+
async function toAttestedRefValue(appDb, raw, kind, resolvedSeedUids) {
|
|
355
|
+
const refs = kind === 'list' ? parseListPropertyValueFromStorage(raw) : [raw.trim()];
|
|
356
|
+
if (refs.length === 0 || refs.some((r) => !r))
|
|
357
|
+
return undefined;
|
|
358
|
+
const unknown = [...new Set(refs.filter((r) => !isUid(r) && !resolvedSeedUids[r]))];
|
|
359
|
+
const recorded = new Map();
|
|
360
|
+
if (unknown.length) {
|
|
361
|
+
const seedRows = await appDb
|
|
362
|
+
.select({ localId: seeds.localId, uid: seeds.uid, revokedAt: seeds.revokedAt })
|
|
363
|
+
.from(seeds)
|
|
364
|
+
.where(inArray(seeds.localId, unknown));
|
|
365
|
+
for (const s of seedRows) {
|
|
366
|
+
if (s.localId && isValidEasAttestationUid(s.uid) && !isVersionRevoked(s.revokedAt)) {
|
|
367
|
+
recorded.set(s.localId, s.uid);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
const out = [];
|
|
372
|
+
for (const ref of refs) {
|
|
373
|
+
const uid = isUid(ref) ? ref : (resolvedSeedUids[ref] ?? recorded.get(ref));
|
|
374
|
+
if (!uid)
|
|
375
|
+
return undefined;
|
|
376
|
+
out.push(uid);
|
|
377
|
+
}
|
|
378
|
+
const value = kind === 'list' ? JSON.stringify(out) : out[0];
|
|
379
|
+
return value === raw ? undefined : value;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const getVersionsForSeedUid = async (seedUid) => {
|
|
383
|
+
if (!seedUid)
|
|
384
|
+
return [];
|
|
385
|
+
const appDb = BaseDb.getAppDb();
|
|
386
|
+
const rows = (await appDb
|
|
387
|
+
.select({ uid: versions.uid, seedUid: versions.seedUid })
|
|
388
|
+
.from(versions)
|
|
389
|
+
.where(eq(versions.seedUid, seedUid)));
|
|
390
|
+
return rows
|
|
391
|
+
.filter((r) => !isPlaceholderUid(r.uid))
|
|
392
|
+
.map((r) => ({ uid: r.uid }));
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
function resolveSeedIds(arg) {
|
|
396
|
+
if (arg && typeof arg === 'object' && 'seedLocalId' in arg) {
|
|
397
|
+
const item = arg;
|
|
398
|
+
return {
|
|
399
|
+
seedLocalId: item.seedLocalId,
|
|
400
|
+
seedUid: item.seedUid,
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
return arg;
|
|
404
|
+
}
|
|
405
|
+
function maxMs(a, b) {
|
|
406
|
+
const x = a ?? null;
|
|
407
|
+
const y = b ?? null;
|
|
408
|
+
if (x == null)
|
|
409
|
+
return y;
|
|
410
|
+
if (y == null)
|
|
411
|
+
return x;
|
|
412
|
+
return Math.max(x, y);
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Whether the seed has **any** on-chain anchor in local SQLite: valid EAS UID on the seed row,
|
|
416
|
+
* on the newest **published** version row (`getLatestPublishedVersionRow`, which skips revoked
|
|
417
|
+
* versions), or on **any** metadata row.
|
|
418
|
+
* Not the same as “no unpublished edits”; see `getPublishPendingDiff` for per-property head rows.
|
|
419
|
+
*/
|
|
420
|
+
async function getSeedPublishState(arg) {
|
|
421
|
+
const { seedLocalId, seedUid } = resolveSeedIds(arg);
|
|
422
|
+
const appDb = BaseDb.getAppDb();
|
|
423
|
+
const empty = {
|
|
424
|
+
status: 'draft',
|
|
425
|
+
seedAttestationUid: null,
|
|
426
|
+
versionAttestationUid: null,
|
|
427
|
+
explorerUid: null,
|
|
428
|
+
lastAttestedAtMs: null,
|
|
429
|
+
revokedAt: null,
|
|
430
|
+
};
|
|
431
|
+
if (!appDb || (!seedLocalId && !seedUid)) {
|
|
432
|
+
return empty;
|
|
433
|
+
}
|
|
434
|
+
const seedRow = await findSeedRow({ localId: seedLocalId, uid: seedUid }, appDb);
|
|
435
|
+
const seedAttestationUid = seedRow?.uid && isValidEasAttestationUid(seedRow.uid) ? seedRow.uid : null;
|
|
436
|
+
let lastAttestedAtMs = seedRow?.attestationCreatedAt ?? null;
|
|
437
|
+
const resolvedSeedLocalId = seedRow?.localId ?? seedLocalId;
|
|
438
|
+
let versionAttestationUid = null;
|
|
439
|
+
if (resolvedSeedLocalId) {
|
|
440
|
+
const v = await getLatestPublishedVersionRow(resolvedSeedLocalId);
|
|
441
|
+
if (v?.uid) {
|
|
442
|
+
versionAttestationUid = v.uid;
|
|
443
|
+
lastAttestedAtMs = maxMs(lastAttestedAtMs, v.attestationCreatedAt ?? undefined);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
const metaWhere = seedLocalId && seedUid
|
|
447
|
+
? or(eq(metadata.seedLocalId, seedLocalId), eq(metadata.seedUid, seedUid))
|
|
448
|
+
: seedLocalId
|
|
449
|
+
? eq(metadata.seedLocalId, seedLocalId)
|
|
450
|
+
: eq(metadata.seedUid, seedUid);
|
|
451
|
+
const metaRows = await appDb.select().from(metadata).where(metaWhere);
|
|
452
|
+
let metadataExplorerUid = null;
|
|
453
|
+
for (const row of metaRows) {
|
|
454
|
+
if (!isValidEasAttestationUid(row.uid))
|
|
455
|
+
continue;
|
|
456
|
+
if (!metadataExplorerUid)
|
|
457
|
+
metadataExplorerUid = row.uid;
|
|
458
|
+
const t = row.attestationCreatedAt ?? row.createdAt;
|
|
459
|
+
lastAttestedAtMs = maxMs(lastAttestedAtMs, t ?? undefined);
|
|
460
|
+
}
|
|
461
|
+
const hasOnchain = !!(seedAttestationUid || versionAttestationUid || metadataExplorerUid);
|
|
462
|
+
const explorerUid = seedAttestationUid ?? versionAttestationUid ?? metadataExplorerUid;
|
|
463
|
+
return {
|
|
464
|
+
status: hasOnchain ? 'onchain' : 'draft',
|
|
465
|
+
seedAttestationUid,
|
|
466
|
+
versionAttestationUid,
|
|
467
|
+
explorerUid,
|
|
468
|
+
lastAttestedAtMs,
|
|
469
|
+
revokedAt: seedRow?.revokedAt ? seedRow.revokedAt : null,
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Returns attestation UIDs (metadata.uid) for all metadata records belonging to a seed.
|
|
475
|
+
* Used when revoking attestations - metadata attestations must be revoked.
|
|
476
|
+
*/
|
|
477
|
+
const getMetadataAttestationUidsForSeedUid = async (seedUid) => {
|
|
478
|
+
if (!seedUid)
|
|
479
|
+
return [];
|
|
480
|
+
const appDb = BaseDb.getAppDb();
|
|
481
|
+
const rows = await appDb
|
|
482
|
+
.select({ uid: metadata.uid, schemaUid: metadata.schemaUid })
|
|
483
|
+
.from(metadata)
|
|
484
|
+
.where(eq(metadata.seedUid, seedUid));
|
|
485
|
+
return rows
|
|
486
|
+
.filter((r) => !isPlaceholderUid(r.uid) && r.schemaUid != null)
|
|
487
|
+
.map((r) => ({ uid: r.uid, schemaUid: r.schemaUid }));
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Returns the attester address for a seed (from seeds.publisher or attestationRaw.attester).
|
|
492
|
+
* Used when revoking attestations to determine which account must perform the revoke.
|
|
493
|
+
*
|
|
494
|
+
* @param seedLocalId - Optional seed local ID
|
|
495
|
+
* @param seedUid - Optional seed UID (attestation ID); resolved as {@link findSeedRow} resolves it
|
|
496
|
+
* @returns The attester address, or null if not found or no attester
|
|
497
|
+
*/
|
|
498
|
+
async function getAttesterForSeed(params) {
|
|
499
|
+
const row = await findSeedRow({ localId: params.seedLocalId, uid: params.seedUid });
|
|
500
|
+
return row ? resolvePublisherFromSeedRow(row) : null;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Records property attestations publish revoked for a retraction (ADR 0021): their rows get
|
|
505
|
+
* `revoked_at` and lose their value, as EAS sync stores a property revoked while its seed is live.
|
|
506
|
+
* The cleared row that asked for the retraction stays the property's newest row.
|
|
507
|
+
*/
|
|
508
|
+
const markPropertyAttestationsRetracted = async ({ uids, revokedAt, }) => {
|
|
509
|
+
const appDb = BaseDb.getAppDb();
|
|
510
|
+
if (!appDb || uids.length === 0)
|
|
511
|
+
return;
|
|
512
|
+
await writeInBatches(uids, (chunk) => appDb
|
|
513
|
+
.update(metadata)
|
|
514
|
+
.set({
|
|
515
|
+
revokedAt,
|
|
516
|
+
propertyValue: null,
|
|
517
|
+
refSeedType: null,
|
|
518
|
+
refResolvedValue: null,
|
|
519
|
+
refResolvedDisplayValue: null,
|
|
520
|
+
})
|
|
521
|
+
.where(and(inArray(metadata.uid, chunk), isNull(metadata.revokedAt))));
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Counts seeds, property attestations, and Arweave upload bytes for a publish
|
|
526
|
+
* without building transactions or requiring a valid payload.
|
|
527
|
+
*/
|
|
528
|
+
const DATA_URI = /^data:[^;]+;base64,([\s\S]*)$/i;
|
|
529
|
+
/** Decoded byte length of a data-URI, or null if the string is not a base64 data URI. */
|
|
530
|
+
function estimateDataUriByteLength(dataUri) {
|
|
531
|
+
const m = DATA_URI.exec((dataUri ?? '').trim());
|
|
532
|
+
if (!m)
|
|
533
|
+
return null;
|
|
534
|
+
const b64 = m[1].replace(/\s/g, '');
|
|
535
|
+
if (!b64)
|
|
536
|
+
return 0;
|
|
537
|
+
const padding = b64.endsWith('==') ? 2 : b64.endsWith('=') ? 1 : 0;
|
|
538
|
+
return Math.max(0, Math.floor((b64.length * 3) / 4) - padding);
|
|
539
|
+
}
|
|
540
|
+
/** Bytes an upload carries (a composite's children summed, as before framing). */
|
|
541
|
+
async function sourceBytes(source) {
|
|
542
|
+
let total = 0;
|
|
543
|
+
for (const filePath of source.children ? source.children.map((c) => c.filePath) : [source.filePath]) {
|
|
544
|
+
total += (await BaseFileManager.getFileSize(filePath)) ?? 0;
|
|
545
|
+
}
|
|
546
|
+
return total;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* What one property adds to the publish, by the payload's rules: one attestation, the
|
|
550
|
+
* revocations of a retraction, or nothing.
|
|
551
|
+
*/
|
|
552
|
+
async function propertyWork(node, property, forceFullSnapshot, uploaded) {
|
|
553
|
+
const none = { attestations: 0, revocations: 0 };
|
|
554
|
+
const full = node.kind === 'root' || node.kind === 'draft';
|
|
555
|
+
if (INTERNAL_PROPERTY_NAMES.includes(property.key) || property.deferred)
|
|
556
|
+
return none;
|
|
557
|
+
if (property.kind === 'itemStorage')
|
|
558
|
+
return none;
|
|
559
|
+
// The storage transaction slot attests this publish's upload of the node's file(s).
|
|
560
|
+
if (property.kind === 'storageTransaction')
|
|
561
|
+
return uploaded ? { attestations: 1, revocations: 0 } : none;
|
|
562
|
+
if (!full && property.kind !== 'basic')
|
|
563
|
+
return none;
|
|
564
|
+
const value = property.row?.propertyValue;
|
|
565
|
+
if (value != null && value !== '')
|
|
566
|
+
return property.uid && !forceFullSnapshot ? none : { attestations: 1, revocations: 0 };
|
|
567
|
+
// An empty value attests a removal, or revokes for a retraction (ADR 0021)
|
|
568
|
+
if (property.uid && !forceFullSnapshot)
|
|
569
|
+
return none;
|
|
570
|
+
const clear = await getPropertyClear({
|
|
571
|
+
seedLocalId: node.seedLocalId,
|
|
572
|
+
seedUid: node.seedUid,
|
|
573
|
+
propertyId: property.definition._dbId,
|
|
574
|
+
modelName: node.modelName,
|
|
575
|
+
propertyName: property.key,
|
|
576
|
+
dataType: property.definition.dataType,
|
|
577
|
+
refValueType: property.definition.refValueType,
|
|
578
|
+
});
|
|
579
|
+
if (!clear)
|
|
580
|
+
return none;
|
|
581
|
+
return clear.retract ? { attestations: 0, revocations: clear.retractScope.length } : { attestations: 1, revocations: 0 };
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* References a publish of `item` would attest to items whose seed was unpublished (revoked), the
|
|
585
|
+
* same ones getPublishPayload rejects with RelatedItemUnpublishedError. Local reads only: the
|
|
586
|
+
* publish package checks this before registering schemas or uploading anything.
|
|
587
|
+
*/
|
|
588
|
+
const getUnpublishedRelatedItems = async (item, options) => (await getPublishGraph(item, { publishMode: options?.publishMode })).unpublishedRelatedItems;
|
|
589
|
+
/**
|
|
590
|
+
* Local measurement of what a publish would do: seed/version/attestation counts
|
|
591
|
+
* and Arweave upload byte totals. Does not hit the network or create transactions.
|
|
592
|
+
*/
|
|
593
|
+
const summarizePublishWork = async (item, options) => {
|
|
594
|
+
const publishMode = options?.publishMode ?? 'patch';
|
|
595
|
+
const graph = await getPublishGraph(item, { publishMode });
|
|
596
|
+
const sources = await getPublishUploadSources(graph);
|
|
597
|
+
const acc = {
|
|
598
|
+
publishMode,
|
|
599
|
+
seedCount: graph.nodes.length,
|
|
600
|
+
newSeedCount: 0,
|
|
601
|
+
newVersionCount: 0,
|
|
602
|
+
attestationCount: 0,
|
|
603
|
+
revocationCount: 0,
|
|
604
|
+
uploadCount: 0,
|
|
605
|
+
uploadBytes: 0,
|
|
606
|
+
uploadSizes: [],
|
|
607
|
+
unpublishedRelatedItems: graph.unpublishedRelatedItems,
|
|
608
|
+
};
|
|
609
|
+
for (const source of sources) {
|
|
610
|
+
const bytes = await sourceBytes(source);
|
|
611
|
+
if (bytes <= 0)
|
|
612
|
+
continue;
|
|
613
|
+
acc.uploadCount += 1;
|
|
614
|
+
acc.uploadBytes += bytes;
|
|
615
|
+
acc.uploadSizes.push(bytes);
|
|
616
|
+
}
|
|
617
|
+
for (const node of graph.nodes) {
|
|
618
|
+
if (node.newSeed)
|
|
619
|
+
acc.newSeedCount += 1;
|
|
620
|
+
if (node.newSeed || graph.forceFullSnapshot)
|
|
621
|
+
acc.newVersionCount += 1;
|
|
622
|
+
const uploaded = sources.some((s) => s.seedLocalId === node.seedLocalId);
|
|
623
|
+
for (const property of node.properties) {
|
|
624
|
+
const work = await propertyWork(node, property, graph.forceFullSnapshot, uploaded);
|
|
625
|
+
acc.attestationCount += work.attestations;
|
|
626
|
+
acc.revocationCount += work.revocations;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
return acc;
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
const logger = debug('seedSdk:helpers:updateSchema');
|
|
633
|
+
// Schema reloads renameModelProperty deferred and that haven't finished yet
|
|
634
|
+
const deferredSchemaReloads = new Set();
|
|
635
|
+
/**
|
|
636
|
+
* Convert a TProperty/ModelPropertyMachineContext to SchemaPropertyUpdate format
|
|
637
|
+
* This function converts the internal property representation to the schema file format
|
|
638
|
+
* @param property - The TProperty instance to convert
|
|
639
|
+
* @param modelName - The name of the model this property belongs to
|
|
640
|
+
* @param propertyName - The name of the property
|
|
641
|
+
* @returns A SchemaPropertyUpdate object ready to be passed to updateModelProperties
|
|
642
|
+
*/
|
|
643
|
+
async function convertPropertyToSchemaUpdate(property, modelName, propertyName) {
|
|
644
|
+
const updates = {};
|
|
645
|
+
// Convert dataType to type
|
|
646
|
+
if (property.dataType) {
|
|
647
|
+
updates.type = property.dataType;
|
|
648
|
+
}
|
|
649
|
+
// Handle Relation type
|
|
650
|
+
if (isDataType(property.dataType, ModelPropertyDataTypes.Relation)) {
|
|
651
|
+
if (property.ref) {
|
|
652
|
+
updates.model = property.ref;
|
|
653
|
+
}
|
|
654
|
+
else if (property.refModelId) {
|
|
655
|
+
// If ref is not set but refModelId is, get the model name from the database
|
|
656
|
+
const refModelName = (await resolveModelRecord(undefined, { modelId: property.refModelId }))?.name;
|
|
657
|
+
if (refModelName) {
|
|
658
|
+
updates.model = refModelName;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
// Handle List type
|
|
663
|
+
if (isDataType(property.dataType, ModelPropertyDataTypes.List)) {
|
|
664
|
+
if (property.refValueType) {
|
|
665
|
+
updates.refValueType = property.refValueType;
|
|
666
|
+
if (property.ref) {
|
|
667
|
+
updates.ref = property.ref;
|
|
668
|
+
}
|
|
669
|
+
else if (property.refModelId) {
|
|
670
|
+
// If ref is not set but refModelId is, get the model name from the database
|
|
671
|
+
const refModelName = (await resolveModelRecord(undefined, { modelId: property.refModelId }))?.name;
|
|
672
|
+
if (refModelName) {
|
|
673
|
+
updates.ref = refModelName;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
// Handle required (validation constraint)
|
|
679
|
+
if (property.required !== undefined) {
|
|
680
|
+
updates.required = property.required;
|
|
681
|
+
}
|
|
682
|
+
// Handle storage configuration (for Text properties with storage)
|
|
683
|
+
if (property.storageType || property.localStorageDir || property.filenameSuffix) {
|
|
684
|
+
const storageType = property.storageType || 'ItemStorage'; // Default to ItemStorage if not specified
|
|
685
|
+
updates.storage = {
|
|
686
|
+
type: storageType,
|
|
687
|
+
};
|
|
688
|
+
if (property.localStorageDir) {
|
|
689
|
+
updates.storage.path = property.localStorageDir;
|
|
690
|
+
}
|
|
691
|
+
if (property.filenameSuffix) {
|
|
692
|
+
updates.storage.extension = property.filenameSuffix;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
return {
|
|
696
|
+
modelName,
|
|
697
|
+
propertyName,
|
|
698
|
+
updates,
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Update model properties in a schema and create a new version
|
|
703
|
+
* @param schemaName - The name of the schema to update
|
|
704
|
+
* @param propertyUpdates - Array of property updates to apply
|
|
705
|
+
* @param modelUpdates - Optional array of model renames
|
|
706
|
+
* @returns The file path of the new schema version
|
|
707
|
+
* @throws Error if schema not found or updates are invalid
|
|
708
|
+
*/
|
|
709
|
+
async function updateModelProperties(schemaName, propertyUpdates, modelUpdates) {
|
|
710
|
+
const modelRenames = new Map();
|
|
711
|
+
const changes = propertyUpdates.map((update) => ({
|
|
712
|
+
type: 'property_update',
|
|
713
|
+
modelName: update.modelName,
|
|
714
|
+
propertyName: update.propertyName,
|
|
715
|
+
updates: update.updates,
|
|
716
|
+
}));
|
|
717
|
+
const { filePath } = await writeNextSchemaVersion(schemaName, (schema) => {
|
|
718
|
+
for (const { oldName, newName } of modelUpdates ?? []) {
|
|
719
|
+
if (!schema.models[oldName])
|
|
720
|
+
continue;
|
|
721
|
+
schema.models[newName] = schema.models[oldName];
|
|
722
|
+
delete schema.models[oldName];
|
|
723
|
+
// References to the model follow the rename
|
|
724
|
+
for (const model of Object.values(schema.models)) {
|
|
725
|
+
for (const property of Object.values(model.properties)) {
|
|
726
|
+
if (property.model === oldName)
|
|
727
|
+
property.model = newName;
|
|
728
|
+
if (property.ref === oldName)
|
|
729
|
+
property.ref = newName;
|
|
730
|
+
if (property.refModelName === oldName)
|
|
731
|
+
property.refModelName = newName;
|
|
732
|
+
if (property.items?.model === oldName)
|
|
733
|
+
property.items.model = newName;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
modelRenames.set(oldName, newName);
|
|
737
|
+
changes.push({ type: 'model_rename', oldName, newName });
|
|
738
|
+
}
|
|
739
|
+
for (const update of propertyUpdates) {
|
|
740
|
+
const model = schema.models[update.modelName];
|
|
741
|
+
if (!model) {
|
|
742
|
+
throw new Error(`Model ${update.modelName} not found in schema ${schemaName}`);
|
|
743
|
+
}
|
|
744
|
+
const property = model.properties[update.propertyName];
|
|
745
|
+
if (!property) {
|
|
746
|
+
throw new Error(`Property ${update.propertyName} not found in model ${update.modelName} of schema ${schemaName}`);
|
|
747
|
+
}
|
|
748
|
+
const { type, ...updates } = update.updates;
|
|
749
|
+
// One key per field: a property written with `dataType` takes the new type there
|
|
750
|
+
if (type !== undefined)
|
|
751
|
+
property[property.dataType !== undefined ? 'dataType' : 'type'] = type;
|
|
752
|
+
Object.assign(property, updates);
|
|
753
|
+
}
|
|
754
|
+
return schema;
|
|
755
|
+
}, {
|
|
756
|
+
description: `Updated model properties: ${propertyUpdates.map((u) => `${u.modelName}.${u.propertyName}`).join(', ')}`,
|
|
757
|
+
changes,
|
|
758
|
+
modelRenames,
|
|
759
|
+
});
|
|
760
|
+
return filePath;
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Rename a property in a model, keeping its id: writes the next schema version, moves the
|
|
764
|
+
* property's metadata rows to the new name, then applies the version to the rows.
|
|
765
|
+
* @param schemaName - The name of the schema
|
|
766
|
+
* @param modelName - The name of the model
|
|
767
|
+
* @param oldPropertyName - The current property name
|
|
768
|
+
* @param newPropertyName - The new property name
|
|
769
|
+
* @returns The file path of the new schema version
|
|
770
|
+
*/
|
|
771
|
+
async function renameModelProperty(schemaName, modelName, oldPropertyName, newPropertyName) {
|
|
772
|
+
const { schemaFile, filePath } = await writeNextSchemaVersion(schemaName, (schema) => {
|
|
773
|
+
const model = schema.models[modelName];
|
|
774
|
+
if (!model) {
|
|
775
|
+
throw new Error(`Model ${modelName} not found in schema ${schemaName}`);
|
|
776
|
+
}
|
|
777
|
+
if (!model.properties[oldPropertyName]) {
|
|
778
|
+
throw new Error(`Property ${oldPropertyName} not found in model ${modelName} of schema ${schemaName}`);
|
|
779
|
+
}
|
|
780
|
+
if (model.properties[newPropertyName]) {
|
|
781
|
+
throw new Error(`Property ${newPropertyName} already exists in model ${modelName} of schema ${schemaName}`);
|
|
782
|
+
}
|
|
783
|
+
// Same position, new key
|
|
784
|
+
model.properties = Object.fromEntries(Object.entries(model.properties).map(([name, prop]) => [name === oldPropertyName ? newPropertyName : name, prop]));
|
|
785
|
+
return schema;
|
|
786
|
+
}, {
|
|
787
|
+
description: `Renamed property ${modelName}.${oldPropertyName} to ${newPropertyName}`,
|
|
788
|
+
changes: [{ type: 'property_rename', modelName, oldPropertyName, newPropertyName }],
|
|
789
|
+
apply: false,
|
|
790
|
+
});
|
|
791
|
+
logger(`Renamed property ${oldPropertyName} to ${newPropertyName} in schema ${schemaName} v${schemaFile.version}`);
|
|
792
|
+
// Item values follow the property by property_id (decision D4); only pending edits name it
|
|
793
|
+
const _mod_0 = await import('./tabEvents-CaVmngqr.js');
|
|
794
|
+
const _ns_0 = _mod_0.bh;
|
|
795
|
+
const { renamePendingWritesForProperty } = _ns_0;
|
|
796
|
+
await renamePendingWritesForProperty(modelName, oldPropertyName, newPropertyName);
|
|
797
|
+
// Applied after a delay: applying posts to BroadcastChannel and causes React invalidates, and
|
|
798
|
+
// running that inside the caller's save flow froze it (updateContext/refetch loops).
|
|
799
|
+
const reload = new Promise((resolve) => setTimeout(resolve, 100))
|
|
800
|
+
.then(() => applySchemaFile(schemaFile, { store: false }))
|
|
801
|
+
.then(() => { }, (err) => {
|
|
802
|
+
logger('Deferred schema apply after rename failed:', err);
|
|
803
|
+
})
|
|
804
|
+
.finally(() => deferredSchemaReloads.delete(reload));
|
|
805
|
+
deferredSchemaReloads.add(reload);
|
|
806
|
+
return filePath;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
var updateSchema = /*#__PURE__*/Object.freeze({
|
|
810
|
+
__proto__: null,
|
|
811
|
+
convertPropertyToSchemaUpdate: convertPropertyToSchemaUpdate,
|
|
812
|
+
renameModelProperty: renameModelProperty,
|
|
813
|
+
updateModelProperties: updateModelProperties
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
export { applyPropertyAttestationUidsFromPublish as a, getMetadataAttestationUidsForSeedUid as b, getSeedPublishState as c, getUnpublishedRelatedItems as d, estimateDataUriByteLength as e, getVersionsForSeedUid as f, getAttesterForSeed as g, resolveMediaRef as h, updateVersionUid as i, updateSchema as j, markPropertyAttestationsRetracted as m, renameModelProperty as r, summarizePublishWork as s, updateModelProperties as u };
|
|
817
|
+
//# sourceMappingURL=index-DmTtj1nk.js.map
|