@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
|
@@ -1,22 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ay as withDbTabLock, az as MIME_TO_EXTENSION, aA as sniffMimeType, ak as contentSha256TagMatches, aB as notifyFilesWrittenOutsideCache, aC as createSessionObjectUrl, aD as withSeedDbLock, aE as countDbStatements, aF as startChangeFeed, aG as countLiveQueryRuns } from './tabEvents-CaVmngqr.js';
|
|
2
|
+
import { B as BaseDb, a as appState, w as BaseFileManager, y as withSqliteBusyRetry } from './BaseFileManager-BAlySv8w.js';
|
|
3
3
|
import { eq, sql } from 'drizzle-orm';
|
|
4
|
-
import { M as MIME_TO_EXTENSION } from './mimeTypes-C9r76DCH.js';
|
|
5
4
|
import debug from 'debug';
|
|
6
5
|
import { F as FileSystemLockedError, D as DatabaseNotPersistentError } from './errors-C1qUEZ7A.js';
|
|
7
6
|
import { drizzle } from 'drizzle-orm/sqlite-proxy';
|
|
8
7
|
import { sha256 } from '@noble/hashes/sha256';
|
|
9
8
|
import { bytesToHex, utf8ToBytes } from '@noble/hashes/utils';
|
|
10
|
-
import {
|
|
9
|
+
import { DefaultArweaveClient } from '@seedprotocol/arweave';
|
|
10
|
+
import 'pluralize';
|
|
11
|
+
import { DefaultQueryClient, DefaultEasClient } from '@seedprotocol/eas';
|
|
12
|
+
import { s as schema } from './index-D0V-mjCV.js';
|
|
11
13
|
import { SQLocalDrizzle } from 'sqlocal/drizzle';
|
|
12
14
|
import { r as recreateIfOlderThanMinimumUpgradeVersion } from './minimumUpgradeVersion-BDhHvHtr.js';
|
|
13
15
|
import { throwError, Observable, distinctUntilChanged, finalize, share, ReplaySubject } from 'rxjs';
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
import './configurePlatform-CiOJ1R3q.js';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* String classification for stored values. Each function is self-contained (no imports, no
|
|
20
|
+
* module-level references) because the download worker gets them as source text: see
|
|
21
|
+
* `browser/workers/filesDownload.ts`.
|
|
22
|
+
*/
|
|
23
|
+
/** MIME type of a `data:` URL, or null. */
|
|
24
|
+
const getMimeType = (base64) => {
|
|
25
|
+
if (!base64) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const result = base64.match(/^data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,/);
|
|
29
|
+
if (result && result.length > 1) {
|
|
30
|
+
return result[1];
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return null; // MIME type could not be determined
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
/** What a stored string looks like: bare base64, a base64 image data URL, or a URL. */
|
|
37
|
+
const getDataTypeFromString = (data) => {
|
|
38
|
+
const nonImageBase64Regex = /^(?!data:image\/(?:jpeg|png|gif|bmp|webp);base64,)[A-Za-z0-9+/=]+$/;
|
|
39
|
+
if (nonImageBase64Regex.test(data)) {
|
|
40
|
+
return 'base64';
|
|
41
|
+
}
|
|
42
|
+
// Regular expression for base64 (simple version, checking for base64 format)
|
|
43
|
+
const imageBase64Regex = /^data:image\/[a-zA-Z]+;base64,[A-Za-z0-9+/]+={0,2}$/;
|
|
44
|
+
if (imageBase64Regex.test(data)) {
|
|
45
|
+
return 'imageBase64';
|
|
46
|
+
}
|
|
47
|
+
// Blob URLs are fetchable but session-scoped; recognize them as url type
|
|
48
|
+
if (data.startsWith('blob:')) {
|
|
49
|
+
return 'url';
|
|
50
|
+
}
|
|
51
|
+
// Regular expression for URL (simple version, checking for common URL format)
|
|
52
|
+
const urlRegex = /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/;
|
|
53
|
+
if (urlRegex.test(data)) {
|
|
54
|
+
return 'url';
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
};
|
|
20
58
|
|
|
21
59
|
const KEY = 'excludedTransactions';
|
|
22
60
|
/**
|
|
@@ -53,6 +91,9 @@ async function addExcludedTransactions(transactionIds) {
|
|
|
53
91
|
}
|
|
54
92
|
|
|
55
93
|
var filesDownload = `const SEED_MIME_TO_EXTENSION = ${JSON.stringify(MIME_TO_EXTENSION)};
|
|
94
|
+
const seedSniffMimeType = ${sniffMimeType.toString()};
|
|
95
|
+
const seedGetMimeType = ${getMimeType.toString()};
|
|
96
|
+
const seedGetDataTypeFromString = ${getDataTypeFromString.toString()};
|
|
56
97
|
(
|
|
57
98
|
${function () {
|
|
58
99
|
const identifyString = (str) => {
|
|
@@ -79,35 +120,6 @@ var filesDownload = `const SEED_MIME_TO_EXTENSION = ${JSON.stringify(MIME_TO_EXT
|
|
|
79
120
|
// Default to plain text if unsure
|
|
80
121
|
return 'text';
|
|
81
122
|
};
|
|
82
|
-
const getMimeType = (base64) => {
|
|
83
|
-
if (!base64) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
const result = base64.match(/^data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,/);
|
|
87
|
-
if (result && result.length > 1) {
|
|
88
|
-
return result[1];
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
return null; // MIME type could not be determined
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const getDataTypeFromString = (data) => {
|
|
95
|
-
const nonImageBase64Regex = /^(?!data:image\/(?:jpeg|png|gif|bmp|webp);base64,)[A-Za-z0-9+/=]+$/;
|
|
96
|
-
if (nonImageBase64Regex.test(data)) {
|
|
97
|
-
return 'base64';
|
|
98
|
-
}
|
|
99
|
-
// Regular expression for base64 (simple version, checking for base64 format)
|
|
100
|
-
const imageBase64Regex = /^data:image\/[a-zA-Z]+;base64,[A-Za-z0-9+/]+={0,2}$/;
|
|
101
|
-
if (imageBase64Regex.test(data)) {
|
|
102
|
-
return 'imageBase64';
|
|
103
|
-
}
|
|
104
|
-
// Regular expression for URL (simple version, checking for common URL format)
|
|
105
|
-
const urlRegex = /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/;
|
|
106
|
-
if (urlRegex.test(data)) {
|
|
107
|
-
return 'url';
|
|
108
|
-
}
|
|
109
|
-
return null;
|
|
110
|
-
};
|
|
111
123
|
const isBinary = (arrayBuffer) => {
|
|
112
124
|
const view = new Uint8Array(arrayBuffer);
|
|
113
125
|
let nonTextCount = 0;
|
|
@@ -284,30 +296,7 @@ var filesDownload = `const SEED_MIME_TO_EXTENSION = ${JSON.stringify(MIME_TO_EXT
|
|
|
284
296
|
*/
|
|
285
297
|
const transformDownloadedContent = async (bytes, _context) => bytes;
|
|
286
298
|
/** True when the bytes start with the signature of an image format the SDK stores in `images/`. */
|
|
287
|
-
const hasImageSignature = (bytes) =>
|
|
288
|
-
const at = (offset, ...sig) => sig.every((b, i) => bytes[offset + i] === b);
|
|
289
|
-
const ascii = (offset, s) => at(offset, ...Array.from(s).map((c) => c.charCodeAt(0)));
|
|
290
|
-
if (at(0, 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a))
|
|
291
|
-
return true; // PNG
|
|
292
|
-
if (at(0, 0xff, 0xd8, 0xff))
|
|
293
|
-
return true; // JPEG
|
|
294
|
-
if (ascii(0, 'GIF87a') || ascii(0, 'GIF89a'))
|
|
295
|
-
return true;
|
|
296
|
-
if (ascii(0, 'RIFF') && ascii(8, 'WEBP'))
|
|
297
|
-
return true;
|
|
298
|
-
if (ascii(0, 'BM'))
|
|
299
|
-
return true; // BMP
|
|
300
|
-
if (at(0, 0x00, 0x00, 0x01, 0x00))
|
|
301
|
-
return true; // ICO
|
|
302
|
-
if (at(0, 0x49, 0x49, 0x2a, 0x00) || at(0, 0x4d, 0x4d, 0x00, 0x2a))
|
|
303
|
-
return true; // TIFF
|
|
304
|
-
if (ascii(4, 'ftyp')) {
|
|
305
|
-
// ISO-BMFF images (AVIF / HEIC); ftyp is also MP4, so check the brand
|
|
306
|
-
const brand = String.fromCharCode(...Array.from(bytes.slice(8, 12)));
|
|
307
|
-
return ['avif', 'avis', 'heic', 'heix', 'heif', 'mif1', 'msf1'].includes(brand);
|
|
308
|
-
}
|
|
309
|
-
return false;
|
|
310
|
-
};
|
|
299
|
+
const hasImageSignature = (bytes) => (seedSniffMimeType(bytes) || '').startsWith('image/');
|
|
311
300
|
/**
|
|
312
301
|
* Content-Types that say nothing about the content: these are sniffed instead. `text/plain` is
|
|
313
302
|
* here because some gateways send it for anything textual.
|
|
@@ -585,7 +574,7 @@ var filesDownload = `const SEED_MIME_TO_EXTENSION = ${JSON.stringify(MIME_TO_EXT
|
|
|
585
574
|
if (textType !== 'json' &&
|
|
586
575
|
textType !== 'base64' &&
|
|
587
576
|
textType !== 'html') {
|
|
588
|
-
const possibleImageType =
|
|
577
|
+
const possibleImageType = seedGetDataTypeFromString(dataString);
|
|
589
578
|
if (!possibleImageType) {
|
|
590
579
|
// Plain text / markdown / anything else textual.
|
|
591
580
|
await saveToFiles(bytes);
|
|
@@ -620,7 +609,7 @@ var filesDownload = `const SEED_MIME_TO_EXTENSION = ${JSON.stringify(MIME_TO_EXT
|
|
|
620
609
|
}
|
|
621
610
|
let fileName = transactionId;
|
|
622
611
|
if (textType === 'base64') {
|
|
623
|
-
const mimeType =
|
|
612
|
+
const mimeType = seedGetMimeType(dataString);
|
|
624
613
|
const isDataUri = dataString.startsWith('data:');
|
|
625
614
|
// Remove the Base64 header if it exists (e.g., "data:image/png;base64,")
|
|
626
615
|
const binaryData = decodeBase64(dataString.split(',').pop() || '');
|
|
@@ -675,7 +664,7 @@ var filesDownload = `const SEED_MIME_TO_EXTENSION = ${JSON.stringify(MIME_TO_EXT
|
|
|
675
664
|
}.toString()}
|
|
676
665
|
)()`;
|
|
677
666
|
|
|
678
|
-
const logger$
|
|
667
|
+
const logger$4 = debug('seedSdk:browser:workers:FileDownloader');
|
|
679
668
|
/**
|
|
680
669
|
* Longest the worker may go without posting anything before the download is failed. The worker
|
|
681
670
|
* posts after every transaction and each gateway request times out after 60s, so this only fires
|
|
@@ -746,7 +735,7 @@ class FileDownloader {
|
|
|
746
735
|
return;
|
|
747
736
|
settled = true;
|
|
748
737
|
cleanup();
|
|
749
|
-
logger$
|
|
738
|
+
logger$4('file download failed', error);
|
|
750
739
|
// Files the worker already wrote are on disk: refresh caches for them anyway.
|
|
751
740
|
if (savedPaths.length) {
|
|
752
741
|
void notifyFilesWrittenOutsideCache(savedPaths).catch(() => { });
|
|
@@ -777,7 +766,7 @@ class FileDownloader {
|
|
|
777
766
|
worker.onmessage = (e) => {
|
|
778
767
|
armWatchdog();
|
|
779
768
|
const data = e.data ?? {};
|
|
780
|
-
logger$
|
|
769
|
+
logger$4('filesDownload main thread onmessage', data);
|
|
781
770
|
if (data.message === 'excludeTransaction') {
|
|
782
771
|
localExcludedTransactions.add(data.transactionId);
|
|
783
772
|
}
|
|
@@ -791,14 +780,14 @@ class FileDownloader {
|
|
|
791
780
|
ok = contentSha256TagMatches(new Uint8Array(data.bytes), String(data.expected ?? ''));
|
|
792
781
|
}
|
|
793
782
|
catch (error) {
|
|
794
|
-
logger$
|
|
783
|
+
logger$4('content verification failed', error);
|
|
795
784
|
}
|
|
796
785
|
worker.postMessage({ message: 'verifyContentResult', requestId: data.requestId, ok });
|
|
797
786
|
return;
|
|
798
787
|
}
|
|
799
788
|
if (data.message === 'compositeChildUnrouted') {
|
|
800
789
|
// No local ItemStorage property for this child (e.g. its item is not synced yet).
|
|
801
|
-
logger$
|
|
790
|
+
logger$4(`composite ${data.transactionId}: no local path for child "${data.name}"; not saved`);
|
|
802
791
|
}
|
|
803
792
|
if (data.message === 'contentVerified') {
|
|
804
793
|
verified.add(data.transactionId);
|
|
@@ -838,7 +827,7 @@ class FileDownloader {
|
|
|
838
827
|
expectedContentHashes,
|
|
839
828
|
compositeChildPaths,
|
|
840
829
|
skipExisting,
|
|
841
|
-
debug: logger$
|
|
830
|
+
debug: logger$4.enabled,
|
|
842
831
|
filesRoot: BaseFileManager.getWorkingDir(),
|
|
843
832
|
});
|
|
844
833
|
}
|
|
@@ -851,7 +840,8 @@ class FileDownloader {
|
|
|
851
840
|
}
|
|
852
841
|
}
|
|
853
842
|
|
|
854
|
-
var imageResize = `(
|
|
843
|
+
var imageResize = `const seedSniffMimeType = ${sniffMimeType.toString()};
|
|
844
|
+
(
|
|
855
845
|
${function () {
|
|
856
846
|
const getFileHandle = async (path, rootHandle = null) => {
|
|
857
847
|
// Split the path into segments
|
|
@@ -905,25 +895,10 @@ var imageResize = `(
|
|
|
905
895
|
/** Infer MIME from magic bytes. OPFS File may have empty type, causing createImageBitmap to fail. */
|
|
906
896
|
async function getBlobWithInferredMime(file) {
|
|
907
897
|
const buf = await file.arrayBuffer();
|
|
908
|
-
const bytes = new Uint8Array(buf);
|
|
909
898
|
let mime = file.type;
|
|
910
899
|
if (!mime || mime === '') {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
else if (bytes[0] === 0x89 && bytes[1] === 0x50 && bytes[2] === 0x4e && bytes[3] === 0x47)
|
|
914
|
-
mime = 'image/png';
|
|
915
|
-
else if (bytes[0] === 0x52 && bytes[1] === 0x49 && bytes[2] === 0x46 && bytes[3] === 0x46 && bytes[8] === 0x57 && bytes[9] === 0x45 && bytes[10] === 0x42 && bytes[11] === 0x50)
|
|
916
|
-
mime = 'image/webp';
|
|
917
|
-
else if (bytes[0] === 0x47 && bytes[1] === 0x49 && bytes[2] === 0x46)
|
|
918
|
-
mime = 'image/gif';
|
|
919
|
-
else if (bytes[0] === 0x42 && bytes[1] === 0x4d)
|
|
920
|
-
mime = 'image/bmp';
|
|
921
|
-
else if (bytes[4] === 0x66 && bytes[5] === 0x74 && bytes[6] === 0x79 && bytes[7] === 0x70 && bytes[8] === 0x61 && bytes[9] === 0x76 && bytes[10] === 0x69 && bytes[11] === 0x66)
|
|
922
|
-
mime = 'image/avif';
|
|
923
|
-
else if (bytes[4] === 0x66 && bytes[5] === 0x74 && bytes[6] === 0x79 && bytes[7] === 0x70 && bytes[8] === 0x68 && bytes[9] === 0x65 && bytes[10] === 0x69 && bytes[11] === 0x63)
|
|
924
|
-
mime = 'image/heic';
|
|
925
|
-
else
|
|
926
|
-
mime = 'image/jpeg';
|
|
900
|
+
const sniffed = seedSniffMimeType(new Uint8Array(buf));
|
|
901
|
+
mime = sniffed && sniffed.startsWith('image/') ? sniffed : 'image/jpeg';
|
|
927
902
|
}
|
|
928
903
|
return new Blob([buf], { type: mime });
|
|
929
904
|
}
|
|
@@ -1239,7 +1214,7 @@ var imageResize = `(
|
|
|
1239
1214
|
}.toString()}
|
|
1240
1215
|
)()`;
|
|
1241
1216
|
|
|
1242
|
-
const logger$
|
|
1217
|
+
const logger$3 = debug('seedSdk:browser:workers:ImageResizer');
|
|
1243
1218
|
class ImageResizer {
|
|
1244
1219
|
constructor() {
|
|
1245
1220
|
this.workersArchive = new Map();
|
|
@@ -1250,18 +1225,18 @@ class ImageResizer {
|
|
|
1250
1225
|
if (this.workersArchive.has(filePath)) {
|
|
1251
1226
|
const savedWorker = this.workersArchive.get(filePath);
|
|
1252
1227
|
savedWorker?.terminate();
|
|
1253
|
-
logger$
|
|
1228
|
+
logger$3('[ImageResizer.resize] Terminated worker for filePath due to incoming request', filePath);
|
|
1254
1229
|
this.workersArchive.delete(filePath);
|
|
1255
1230
|
}
|
|
1256
1231
|
const worker = new Worker(this.workerBlobUrl);
|
|
1257
1232
|
this.workersArchive.set(filePath, worker);
|
|
1258
1233
|
return new Promise((resolve, reject) => {
|
|
1259
1234
|
worker.onmessage = (e) => {
|
|
1260
|
-
logger$
|
|
1235
|
+
logger$3('[ImageResizer.resize] main thread onmessage', e.data);
|
|
1261
1236
|
if (e.data.done) {
|
|
1262
1237
|
const savedWorker = this.workersArchive.get(filePath);
|
|
1263
1238
|
savedWorker?.terminate();
|
|
1264
|
-
logger$
|
|
1239
|
+
logger$3('[ImageResizer.resize] Terminated worker for filePath due to done', filePath);
|
|
1265
1240
|
this.workersArchive.delete(filePath);
|
|
1266
1241
|
// The worker wrote the variant to OPFS directly; refresh caches here and in other tabs.
|
|
1267
1242
|
notifyFilesWrittenOutsideCache([e.data.filePath]).then(() => resolve(e.data), () => resolve(e.data));
|
|
@@ -1277,7 +1252,7 @@ class ImageResizer {
|
|
|
1277
1252
|
filePath,
|
|
1278
1253
|
width,
|
|
1279
1254
|
height,
|
|
1280
|
-
debug: logger$
|
|
1255
|
+
debug: logger$3.enabled,
|
|
1281
1256
|
});
|
|
1282
1257
|
});
|
|
1283
1258
|
}
|
|
@@ -1315,7 +1290,7 @@ function isSkippableOpfsEntryError(error) {
|
|
|
1315
1290
|
return error instanceof DOMException && SKIPPABLE_ENTRY_ERRORS.has(error.name);
|
|
1316
1291
|
}
|
|
1317
1292
|
|
|
1318
|
-
const logger$
|
|
1293
|
+
const logger$2 = debug('seedSdk:browser:helpers:FileManager');
|
|
1319
1294
|
/**
|
|
1320
1295
|
* Browser-safe path helpers for SDK virtual file paths.
|
|
1321
1296
|
* We intentionally avoid Node/CJS path polyfills here to keep browser bundles ESM-safe.
|
|
@@ -1465,9 +1440,9 @@ class BrowserFileManager {
|
|
|
1465
1440
|
}
|
|
1466
1441
|
async initializeFileSystem(_workingDir) {
|
|
1467
1442
|
const zenfs = await this.getFs();
|
|
1468
|
-
const { TolerantWebAccess, TolerantWebAccessFS } = await import('./tolerantWebAccess-
|
|
1469
|
-
const _mod_0 = await import('./
|
|
1470
|
-
const _ns_0 = _mod_0.
|
|
1443
|
+
const { TolerantWebAccess, TolerantWebAccessFS } = await import('./tolerantWebAccess-BJqViq08.js');
|
|
1444
|
+
const _mod_0 = await import('./tabEvents-CaVmngqr.js');
|
|
1445
|
+
const _ns_0 = _mod_0.bm;
|
|
1471
1446
|
const { queueFilesChangedNotice } = _ns_0;
|
|
1472
1447
|
const { configureSingle } = zenfs;
|
|
1473
1448
|
const configureRoot = async () => {
|
|
@@ -1498,7 +1473,7 @@ class BrowserFileManager {
|
|
|
1498
1473
|
if (attempt === MOUNT_RETRY_DELAYS_MS.length) {
|
|
1499
1474
|
throw new FileSystemLockedError(error);
|
|
1500
1475
|
}
|
|
1501
|
-
logger$
|
|
1476
|
+
logger$2(`OPFS mount attempt ${attempt + 1} failed (${error?.name}); retrying`);
|
|
1502
1477
|
await sleep(MOUNT_RETRY_DELAYS_MS[attempt]);
|
|
1503
1478
|
}
|
|
1504
1479
|
}
|
|
@@ -1535,7 +1510,7 @@ class BrowserFileManager {
|
|
|
1535
1510
|
}
|
|
1536
1511
|
async invalidateNow(filePaths) {
|
|
1537
1512
|
const { mounts } = await this.getFs();
|
|
1538
|
-
const { TolerantWebAccessFS } = await import('./tolerantWebAccess-
|
|
1513
|
+
const { TolerantWebAccessFS } = await import('./tolerantWebAccess-BJqViq08.js');
|
|
1539
1514
|
const mounted = mounts.get('/');
|
|
1540
1515
|
if (!(mounted instanceof TolerantWebAccessFS))
|
|
1541
1516
|
return;
|
|
@@ -1545,7 +1520,7 @@ class BrowserFileManager {
|
|
|
1545
1520
|
await mounted.invalidate(absolute);
|
|
1546
1521
|
}
|
|
1547
1522
|
catch (error) {
|
|
1548
|
-
logger$
|
|
1523
|
+
logger$2(`could not refresh cached ${absolute}`, error);
|
|
1549
1524
|
}
|
|
1550
1525
|
}
|
|
1551
1526
|
}
|
|
@@ -1582,7 +1557,7 @@ class BrowserFileManager {
|
|
|
1582
1557
|
}
|
|
1583
1558
|
catch {
|
|
1584
1559
|
// This is a no-op. We tried to create a directory that already exists.
|
|
1585
|
-
logger$
|
|
1560
|
+
logger$2('Attempted to create a directory that already exists');
|
|
1586
1561
|
}
|
|
1587
1562
|
}
|
|
1588
1563
|
}
|
|
@@ -1604,7 +1579,7 @@ class BrowserFileManager {
|
|
|
1604
1579
|
const startTime = Date.now();
|
|
1605
1580
|
let isBusy = false;
|
|
1606
1581
|
const cancelableInterval = new CancelableInterval(async (stop) => {
|
|
1607
|
-
logger$
|
|
1582
|
+
logger$2('waitForFile', filePath);
|
|
1608
1583
|
if (isBusy) {
|
|
1609
1584
|
return;
|
|
1610
1585
|
}
|
|
@@ -1697,7 +1672,7 @@ class BrowserFileManager {
|
|
|
1697
1672
|
const startTime = Date.now();
|
|
1698
1673
|
let isBusy = false;
|
|
1699
1674
|
const cancelableInterval = new CancelableInterval(async (stop) => {
|
|
1700
|
-
logger$
|
|
1675
|
+
logger$2('waitForFileWithContent', filePath);
|
|
1701
1676
|
if (isBusy) {
|
|
1702
1677
|
return;
|
|
1703
1678
|
}
|
|
@@ -1909,7 +1884,7 @@ class CancelableInterval {
|
|
|
1909
1884
|
}
|
|
1910
1885
|
catch (error) {
|
|
1911
1886
|
if (error instanceof DOMException && error.name === 'AbortError') {
|
|
1912
|
-
logger$
|
|
1887
|
+
logger$2('Previous task was canceled.');
|
|
1913
1888
|
}
|
|
1914
1889
|
else {
|
|
1915
1890
|
console.error('Task error:', error);
|
|
@@ -2387,6 +2362,221 @@ DELETE FROM \`seeds\` WHERE \`local_id\` IN (
|
|
|
2387
2362
|
);
|
|
2388
2363
|
`;
|
|
2389
2364
|
const migrationSql_0025_add_metadata_retract = `ALTER TABLE \`metadata\` ADD \`retract\` integer;`;
|
|
2365
|
+
const migrationSql_0026_add_content_hash_to_schemas = `ALTER TABLE \`schemas\` ADD \`content_hash\` text;`;
|
|
2366
|
+
const migrationSql_0027_link_metadata_property_ids = `-- Links metadata rows written without property_id to their property (decision D4: readers match
|
|
2367
|
+
-- rows by property_id). Only rows whose seed records its model (seeds.model_file_id) are linked,
|
|
2368
|
+
-- and only to one of that model's properties. Rows that match no property, or several, keep NULL
|
|
2369
|
+
-- and are read by name.
|
|
2370
|
+
--
|
|
2371
|
+
-- First the rows whose stored name is a property's key (unique per model).
|
|
2372
|
+
UPDATE \`metadata\` SET \`property_id\` = (
|
|
2373
|
+
SELECT \`p\`.\`id\` FROM \`seeds\` \`s\`
|
|
2374
|
+
JOIN \`models\` \`m\` ON \`m\`.\`schema_file_id\` = \`s\`.\`model_file_id\`
|
|
2375
|
+
JOIN \`properties\` \`p\` ON \`p\`.\`model_id\` = \`m\`.\`id\`
|
|
2376
|
+
WHERE \`s\`.\`local_id\` = \`metadata\`.\`seed_local_id\` AND \`p\`.\`name\` = \`metadata\`.\`property_name\`
|
|
2377
|
+
)
|
|
2378
|
+
WHERE \`property_id\` IS NULL AND EXISTS (
|
|
2379
|
+
SELECT 1 FROM \`seeds\` \`s\`
|
|
2380
|
+
JOIN \`models\` \`m\` ON \`m\`.\`schema_file_id\` = \`s\`.\`model_file_id\`
|
|
2381
|
+
JOIN \`properties\` \`p\` ON \`p\`.\`model_id\` = \`m\`.\`id\`
|
|
2382
|
+
WHERE \`s\`.\`local_id\` = \`metadata\`.\`seed_local_id\` AND \`p\`.\`name\` = \`metadata\`.\`property_name\`
|
|
2383
|
+
);
|
|
2384
|
+
--> statement-breakpoint
|
|
2385
|
+
-- Then the other stored forms, when exactly one property matches: \`<key>Id\` for an Image, File,
|
|
2386
|
+
-- Html or Relation, and a List of Relation's \`<singular key><Ref>Ids\` (singular as \`key\` minus a
|
|
2387
|
+
-- trailing \`s\` or \`es\`, or \`ies\` → \`y\`; other plurals stay NULL).
|
|
2388
|
+
UPDATE \`metadata\` SET \`property_id\` = (
|
|
2389
|
+
SELECT \`p\`.\`id\` FROM \`seeds\` \`s\`
|
|
2390
|
+
JOIN \`models\` \`m\` ON \`m\`.\`schema_file_id\` = \`s\`.\`model_file_id\`
|
|
2391
|
+
JOIN \`properties\` \`p\` ON \`p\`.\`model_id\` = \`m\`.\`id\`
|
|
2392
|
+
LEFT JOIN \`models\` \`r\` ON \`r\`.\`id\` = \`p\`.\`ref_model_id\`
|
|
2393
|
+
WHERE \`s\`.\`local_id\` = \`metadata\`.\`seed_local_id\` AND (
|
|
2394
|
+
(
|
|
2395
|
+
(\`p\`.\`data_type\` IN ('Image', 'File', 'Html', 'Relation') OR \`p\`.\`ref_value_type\` IN ('Image', 'File', 'Html', 'Relation'))
|
|
2396
|
+
AND \`p\`.\`name\` || 'Id' = \`metadata\`.\`property_name\`
|
|
2397
|
+
) OR (
|
|
2398
|
+
\`p\`.\`data_type\` = 'List' AND \`r\`.\`name\` IS NOT NULL
|
|
2399
|
+
AND length(\`metadata\`.\`property_name\`) > length(\`r\`.\`name\`) + 3
|
|
2400
|
+
AND substr(\`metadata\`.\`property_name\`, -(length(\`r\`.\`name\`) + 3)) = \`r\`.\`name\` || 'Ids'
|
|
2401
|
+
AND (
|
|
2402
|
+
\`p\`.\`name\` IN (
|
|
2403
|
+
substr(\`metadata\`.\`property_name\`, 1, length(\`metadata\`.\`property_name\`) - length(\`r\`.\`name\`) - 3),
|
|
2404
|
+
substr(\`metadata\`.\`property_name\`, 1, length(\`metadata\`.\`property_name\`) - length(\`r\`.\`name\`) - 3) || 's',
|
|
2405
|
+
substr(\`metadata\`.\`property_name\`, 1, length(\`metadata\`.\`property_name\`) - length(\`r\`.\`name\`) - 3) || 'es'
|
|
2406
|
+
) OR (
|
|
2407
|
+
substr(\`metadata\`.\`property_name\`, length(\`metadata\`.\`property_name\`) - length(\`r\`.\`name\`) - 3, 1) = 'y'
|
|
2408
|
+
AND \`p\`.\`name\` = substr(\`metadata\`.\`property_name\`, 1, length(\`metadata\`.\`property_name\`) - length(\`r\`.\`name\`) - 4) || 'ies'
|
|
2409
|
+
)
|
|
2410
|
+
)
|
|
2411
|
+
)
|
|
2412
|
+
)
|
|
2413
|
+
)
|
|
2414
|
+
WHERE \`property_id\` IS NULL AND (
|
|
2415
|
+
SELECT COUNT(*) FROM \`seeds\` \`s\`
|
|
2416
|
+
JOIN \`models\` \`m\` ON \`m\`.\`schema_file_id\` = \`s\`.\`model_file_id\`
|
|
2417
|
+
JOIN \`properties\` \`p\` ON \`p\`.\`model_id\` = \`m\`.\`id\`
|
|
2418
|
+
LEFT JOIN \`models\` \`r\` ON \`r\`.\`id\` = \`p\`.\`ref_model_id\`
|
|
2419
|
+
WHERE \`s\`.\`local_id\` = \`metadata\`.\`seed_local_id\` AND (
|
|
2420
|
+
(
|
|
2421
|
+
(\`p\`.\`data_type\` IN ('Image', 'File', 'Html', 'Relation') OR \`p\`.\`ref_value_type\` IN ('Image', 'File', 'Html', 'Relation'))
|
|
2422
|
+
AND \`p\`.\`name\` || 'Id' = \`metadata\`.\`property_name\`
|
|
2423
|
+
) OR (
|
|
2424
|
+
\`p\`.\`data_type\` = 'List' AND \`r\`.\`name\` IS NOT NULL
|
|
2425
|
+
AND length(\`metadata\`.\`property_name\`) > length(\`r\`.\`name\`) + 3
|
|
2426
|
+
AND substr(\`metadata\`.\`property_name\`, -(length(\`r\`.\`name\`) + 3)) = \`r\`.\`name\` || 'Ids'
|
|
2427
|
+
AND (
|
|
2428
|
+
\`p\`.\`name\` IN (
|
|
2429
|
+
substr(\`metadata\`.\`property_name\`, 1, length(\`metadata\`.\`property_name\`) - length(\`r\`.\`name\`) - 3),
|
|
2430
|
+
substr(\`metadata\`.\`property_name\`, 1, length(\`metadata\`.\`property_name\`) - length(\`r\`.\`name\`) - 3) || 's',
|
|
2431
|
+
substr(\`metadata\`.\`property_name\`, 1, length(\`metadata\`.\`property_name\`) - length(\`r\`.\`name\`) - 3) || 'es'
|
|
2432
|
+
) OR (
|
|
2433
|
+
substr(\`metadata\`.\`property_name\`, length(\`metadata\`.\`property_name\`) - length(\`r\`.\`name\`) - 3, 1) = 'y'
|
|
2434
|
+
AND \`p\`.\`name\` = substr(\`metadata\`.\`property_name\`, 1, length(\`metadata\`.\`property_name\`) - length(\`r\`.\`name\`) - 4) || 'ies'
|
|
2435
|
+
)
|
|
2436
|
+
)
|
|
2437
|
+
)
|
|
2438
|
+
)
|
|
2439
|
+
) = 1;
|
|
2440
|
+
`;
|
|
2441
|
+
const migrationSql_0028_add_definition_to_properties = `ALTER TABLE \`properties\` ADD \`definition\` text;
|
|
2442
|
+
--> statement-breakpoint
|
|
2443
|
+
-- Backfill from the stored schema files: a property row takes the property object whose \`id\` is
|
|
2444
|
+
-- its schema_file_id, from the newest schema version that has one. Rows no stored file names by id
|
|
2445
|
+
-- keep NULL and read their definition from the columns alone.
|
|
2446
|
+
UPDATE \`properties\` SET \`definition\` = (
|
|
2447
|
+
SELECT \`p\`.\`value\`
|
|
2448
|
+
FROM \`schemas\` \`s\`,
|
|
2449
|
+
json_each(CASE WHEN json_valid(\`s\`.\`schema_data\`) THEN \`s\`.\`schema_data\` ELSE '{}' END, '$.models') \`m\`,
|
|
2450
|
+
json_each(\`m\`.\`value\`, '$.properties') \`p\`
|
|
2451
|
+
WHERE \`m\`.\`type\` = 'object'
|
|
2452
|
+
AND json_type(\`m\`.\`value\`, '$.properties') = 'object'
|
|
2453
|
+
AND \`p\`.\`type\` = 'object'
|
|
2454
|
+
AND json_extract(\`p\`.\`value\`, '$.id') = \`properties\`.\`schema_file_id\`
|
|
2455
|
+
ORDER BY \`s\`.\`version\` DESC, \`s\`.\`id\` DESC
|
|
2456
|
+
LIMIT 1
|
|
2457
|
+
) WHERE \`definition\` IS NULL AND \`schema_file_id\` IS NOT NULL;
|
|
2458
|
+
`;
|
|
2459
|
+
const migrationSql_0029_dedupe_chain_uids_add_unique_indexes = `-- Unique keys the writers already assume (SDK audit T9): one model_schemas link per model and
|
|
2460
|
+
-- schema, and one seeds / versions row per attested uid (placeholder uids are left out, see
|
|
2461
|
+
-- seedSchema/attestedUid.ts). Duplicates are merged first. The survivor is the row with local
|
|
2462
|
+
-- children (versions for a seed, metadata for a version), then the oldest; the duplicate's
|
|
2463
|
+
-- references move to it, columns it lacks are copied from the duplicate, and the duplicate is
|
|
2464
|
+
-- deleted.
|
|
2465
|
+
CREATE TABLE \`__t9_seed_merge\` (\`dup_rowid\` integer PRIMARY KEY, \`dup\` text, \`keep\` text);
|
|
2466
|
+
--> statement-breakpoint
|
|
2467
|
+
INSERT INTO \`__t9_seed_merge\` (\`dup_rowid\`, \`dup\`, \`keep\`)
|
|
2468
|
+
SELECT \`rid\`, \`local_id\`, \`keep\` FROM (
|
|
2469
|
+
SELECT \`s\`.\`rowid\` AS \`rid\`, \`s\`.\`local_id\`,
|
|
2470
|
+
first_value(\`s\`.\`local_id\`) OVER \`w\` AS \`keep\`,
|
|
2471
|
+
row_number() OVER \`w\` AS \`rank\`
|
|
2472
|
+
FROM \`seeds\` \`s\`
|
|
2473
|
+
WHERE \`s\`.\`uid\` IS NOT NULL AND trim(\`s\`.\`uid\`) NOT IN ('', 'NULL') AND lower(trim(\`s\`.\`uid\`)) != '0x0000000000000000000000000000000000000000000000000000000000000000'
|
|
2474
|
+
WINDOW \`w\` AS (
|
|
2475
|
+
PARTITION BY \`s\`.\`uid\`
|
|
2476
|
+
ORDER BY (\`s\`.\`local_id\` IS NULL),
|
|
2477
|
+
EXISTS (SELECT 1 FROM \`versions\` \`v\` WHERE \`v\`.\`seed_local_id\` = \`s\`.\`local_id\`) DESC,
|
|
2478
|
+
COALESCE(\`s\`.\`created_at\`, 9223372036854775807), \`s\`.\`rowid\`
|
|
2479
|
+
)
|
|
2480
|
+
)
|
|
2481
|
+
WHERE \`rank\` > 1;
|
|
2482
|
+
--> statement-breakpoint
|
|
2483
|
+
UPDATE \`seeds\` SET
|
|
2484
|
+
\`schema_uid\` = COALESCE(\`schema_uid\`, (SELECT \`d\`.\`schema_uid\` FROM \`__t9_seed_merge\` \`m\` JOIN \`seeds\` \`d\` ON \`d\`.\`rowid\` = \`m\`.\`dup_rowid\` WHERE \`m\`.\`keep\` = \`seeds\`.\`local_id\` AND \`d\`.\`schema_uid\` IS NOT NULL LIMIT 1)),
|
|
2485
|
+
\`type\` = COALESCE(\`type\`, (SELECT \`d\`.\`type\` FROM \`__t9_seed_merge\` \`m\` JOIN \`seeds\` \`d\` ON \`d\`.\`rowid\` = \`m\`.\`dup_rowid\` WHERE \`m\`.\`keep\` = \`seeds\`.\`local_id\` AND \`d\`.\`type\` IS NOT NULL LIMIT 1)),
|
|
2486
|
+
\`model_file_id\` = COALESCE(\`model_file_id\`, (SELECT \`d\`.\`model_file_id\` FROM \`__t9_seed_merge\` \`m\` JOIN \`seeds\` \`d\` ON \`d\`.\`rowid\` = \`m\`.\`dup_rowid\` WHERE \`m\`.\`keep\` = \`seeds\`.\`local_id\` AND \`d\`.\`model_file_id\` IS NOT NULL LIMIT 1)),
|
|
2487
|
+
\`publisher\` = COALESCE(\`publisher\`, (SELECT \`d\`.\`publisher\` FROM \`__t9_seed_merge\` \`m\` JOIN \`seeds\` \`d\` ON \`d\`.\`rowid\` = \`m\`.\`dup_rowid\` WHERE \`m\`.\`keep\` = \`seeds\`.\`local_id\` AND \`d\`.\`publisher\` IS NOT NULL LIMIT 1)),
|
|
2488
|
+
\`attestation_raw\` = COALESCE(\`attestation_raw\`, (SELECT \`d\`.\`attestation_raw\` FROM \`__t9_seed_merge\` \`m\` JOIN \`seeds\` \`d\` ON \`d\`.\`rowid\` = \`m\`.\`dup_rowid\` WHERE \`m\`.\`keep\` = \`seeds\`.\`local_id\` AND \`d\`.\`attestation_raw\` IS NOT NULL LIMIT 1)),
|
|
2489
|
+
\`attestation_created_at\` = COALESCE(\`attestation_created_at\`, (SELECT \`d\`.\`attestation_created_at\` FROM \`__t9_seed_merge\` \`m\` JOIN \`seeds\` \`d\` ON \`d\`.\`rowid\` = \`m\`.\`dup_rowid\` WHERE \`m\`.\`keep\` = \`seeds\`.\`local_id\` AND \`d\`.\`attestation_created_at\` IS NOT NULL LIMIT 1))
|
|
2490
|
+
WHERE \`local_id\` IN (SELECT \`keep\` FROM \`__t9_seed_merge\`);
|
|
2491
|
+
--> statement-breakpoint
|
|
2492
|
+
-- A property row the survivor already has (same attestation uid) is not moved.
|
|
2493
|
+
DELETE FROM \`metadata\`
|
|
2494
|
+
WHERE \`seed_local_id\` IN (SELECT \`dup\` FROM \`__t9_seed_merge\` WHERE \`keep\` IS NOT NULL)
|
|
2495
|
+
AND \`metadata\`.\`uid\` IS NOT NULL AND trim(\`metadata\`.\`uid\`) NOT IN ('', 'NULL') AND lower(trim(\`metadata\`.\`uid\`)) != '0x0000000000000000000000000000000000000000000000000000000000000000'
|
|
2496
|
+
AND EXISTS (
|
|
2497
|
+
SELECT 1 FROM \`metadata\` \`k\` JOIN \`__t9_seed_merge\` \`m\` ON \`k\`.\`seed_local_id\` = \`m\`.\`keep\`
|
|
2498
|
+
WHERE \`m\`.\`dup\` = \`metadata\`.\`seed_local_id\` AND \`k\`.\`uid\` = \`metadata\`.\`uid\`
|
|
2499
|
+
);
|
|
2500
|
+
--> statement-breakpoint
|
|
2501
|
+
UPDATE \`metadata\` SET \`seed_local_id\` = (SELECT \`keep\` FROM \`__t9_seed_merge\` WHERE \`dup\` = \`metadata\`.\`seed_local_id\`)
|
|
2502
|
+
WHERE \`seed_local_id\` IN (SELECT \`dup\` FROM \`__t9_seed_merge\` WHERE \`keep\` IS NOT NULL);
|
|
2503
|
+
--> statement-breakpoint
|
|
2504
|
+
UPDATE \`versions\` SET \`seed_local_id\` = (SELECT \`keep\` FROM \`__t9_seed_merge\` WHERE \`dup\` = \`versions\`.\`seed_local_id\`)
|
|
2505
|
+
WHERE \`seed_local_id\` IN (SELECT \`dup\` FROM \`__t9_seed_merge\` WHERE \`keep\` IS NOT NULL);
|
|
2506
|
+
--> statement-breakpoint
|
|
2507
|
+
UPDATE \`pending_writes\` SET \`seed_local_id\` = (SELECT \`keep\` FROM \`__t9_seed_merge\` WHERE \`dup\` = \`pending_writes\`.\`seed_local_id\`)
|
|
2508
|
+
WHERE \`seed_local_id\` IN (SELECT \`dup\` FROM \`__t9_seed_merge\` WHERE \`keep\` IS NOT NULL);
|
|
2509
|
+
--> statement-breakpoint
|
|
2510
|
+
UPDATE \`publish_processes\` SET \`seed_local_id\` = (SELECT \`keep\` FROM \`__t9_seed_merge\` WHERE \`dup\` = \`publish_processes\`.\`seed_local_id\`)
|
|
2511
|
+
WHERE \`seed_local_id\` IN (SELECT \`dup\` FROM \`__t9_seed_merge\` WHERE \`keep\` IS NOT NULL);
|
|
2512
|
+
--> statement-breakpoint
|
|
2513
|
+
UPDATE \`arweave_l1_finalize_jobs\` SET \`seed_local_id\` = (SELECT \`keep\` FROM \`__t9_seed_merge\` WHERE \`dup\` = \`arweave_l1_finalize_jobs\`.\`seed_local_id\`)
|
|
2514
|
+
WHERE \`seed_local_id\` IN (SELECT \`dup\` FROM \`__t9_seed_merge\` WHERE \`keep\` IS NOT NULL);
|
|
2515
|
+
--> statement-breakpoint
|
|
2516
|
+
UPDATE \`html_embedded_image_co_publish\` SET \`image_seed_local_id\` = (SELECT \`keep\` FROM \`__t9_seed_merge\` WHERE \`dup\` = \`html_embedded_image_co_publish\`.\`image_seed_local_id\`)
|
|
2517
|
+
WHERE \`image_seed_local_id\` IN (SELECT \`dup\` FROM \`__t9_seed_merge\` WHERE \`keep\` IS NOT NULL);
|
|
2518
|
+
--> statement-breakpoint
|
|
2519
|
+
UPDATE OR IGNORE \`html_embedded_image_co_publish\` SET \`parent_seed_local_id\` = (SELECT \`keep\` FROM \`__t9_seed_merge\` WHERE \`dup\` = \`html_embedded_image_co_publish\`.\`parent_seed_local_id\`)
|
|
2520
|
+
WHERE \`parent_seed_local_id\` IN (SELECT \`dup\` FROM \`__t9_seed_merge\` WHERE \`keep\` IS NOT NULL);
|
|
2521
|
+
--> statement-breakpoint
|
|
2522
|
+
DELETE FROM \`html_embedded_image_co_publish\` WHERE \`parent_seed_local_id\` IN (SELECT \`dup\` FROM \`__t9_seed_merge\` WHERE \`keep\` IS NOT NULL);
|
|
2523
|
+
--> statement-breakpoint
|
|
2524
|
+
UPDATE OR IGNORE \`html_embedded_image_co_publish\` SET \`html_seed_local_id\` = (SELECT \`keep\` FROM \`__t9_seed_merge\` WHERE \`dup\` = \`html_embedded_image_co_publish\`.\`html_seed_local_id\`)
|
|
2525
|
+
WHERE \`html_seed_local_id\` IN (SELECT \`dup\` FROM \`__t9_seed_merge\` WHERE \`keep\` IS NOT NULL);
|
|
2526
|
+
--> statement-breakpoint
|
|
2527
|
+
DELETE FROM \`html_embedded_image_co_publish\` WHERE \`html_seed_local_id\` IN (SELECT \`dup\` FROM \`__t9_seed_merge\` WHERE \`keep\` IS NOT NULL);
|
|
2528
|
+
--> statement-breakpoint
|
|
2529
|
+
DELETE FROM \`seeds\` WHERE \`rowid\` IN (SELECT \`dup_rowid\` FROM \`__t9_seed_merge\`);
|
|
2530
|
+
--> statement-breakpoint
|
|
2531
|
+
DROP TABLE \`__t9_seed_merge\`;
|
|
2532
|
+
--> statement-breakpoint
|
|
2533
|
+
CREATE TABLE \`__t9_version_merge\` (\`dup_rowid\` integer PRIMARY KEY, \`dup\` text, \`keep\` text);
|
|
2534
|
+
--> statement-breakpoint
|
|
2535
|
+
INSERT INTO \`__t9_version_merge\` (\`dup_rowid\`, \`dup\`, \`keep\`)
|
|
2536
|
+
SELECT \`rid\`, \`local_id\`, \`keep\` FROM (
|
|
2537
|
+
SELECT \`v\`.\`rowid\` AS \`rid\`, \`v\`.\`local_id\`,
|
|
2538
|
+
first_value(\`v\`.\`local_id\`) OVER \`w\` AS \`keep\`,
|
|
2539
|
+
row_number() OVER \`w\` AS \`rank\`
|
|
2540
|
+
FROM \`versions\` \`v\`
|
|
2541
|
+
WHERE \`v\`.\`uid\` IS NOT NULL AND trim(\`v\`.\`uid\`) NOT IN ('', 'NULL') AND lower(trim(\`v\`.\`uid\`)) != '0x0000000000000000000000000000000000000000000000000000000000000000'
|
|
2542
|
+
WINDOW \`w\` AS (
|
|
2543
|
+
PARTITION BY \`v\`.\`uid\`
|
|
2544
|
+
ORDER BY (\`v\`.\`local_id\` IS NULL),
|
|
2545
|
+
EXISTS (SELECT 1 FROM \`metadata\` \`md\` WHERE \`md\`.\`version_local_id\` = \`v\`.\`local_id\`) DESC,
|
|
2546
|
+
COALESCE(\`v\`.\`created_at\`, 9223372036854775807), \`v\`.\`rowid\`
|
|
2547
|
+
)
|
|
2548
|
+
)
|
|
2549
|
+
WHERE \`rank\` > 1;
|
|
2550
|
+
--> statement-breakpoint
|
|
2551
|
+
UPDATE \`versions\` SET
|
|
2552
|
+
\`seed_uid\` = COALESCE(\`seed_uid\`, (SELECT \`d\`.\`seed_uid\` FROM \`__t9_version_merge\` \`m\` JOIN \`versions\` \`d\` ON \`d\`.\`rowid\` = \`m\`.\`dup_rowid\` WHERE \`m\`.\`keep\` = \`versions\`.\`local_id\` AND \`d\`.\`seed_uid\` IS NOT NULL LIMIT 1)),
|
|
2553
|
+
\`seed_type\` = COALESCE(\`seed_type\`, (SELECT \`d\`.\`seed_type\` FROM \`__t9_version_merge\` \`m\` JOIN \`versions\` \`d\` ON \`d\`.\`rowid\` = \`m\`.\`dup_rowid\` WHERE \`m\`.\`keep\` = \`versions\`.\`local_id\` AND \`d\`.\`seed_type\` IS NOT NULL LIMIT 1)),
|
|
2554
|
+
\`attestation_raw\` = COALESCE(\`attestation_raw\`, (SELECT \`d\`.\`attestation_raw\` FROM \`__t9_version_merge\` \`m\` JOIN \`versions\` \`d\` ON \`d\`.\`rowid\` = \`m\`.\`dup_rowid\` WHERE \`m\`.\`keep\` = \`versions\`.\`local_id\` AND \`d\`.\`attestation_raw\` IS NOT NULL LIMIT 1)),
|
|
2555
|
+
\`attestation_created_at\` = COALESCE(\`attestation_created_at\`, (SELECT \`d\`.\`attestation_created_at\` FROM \`__t9_version_merge\` \`m\` JOIN \`versions\` \`d\` ON \`d\`.\`rowid\` = \`m\`.\`dup_rowid\` WHERE \`m\`.\`keep\` = \`versions\`.\`local_id\` AND \`d\`.\`attestation_created_at\` IS NOT NULL LIMIT 1)),
|
|
2556
|
+
\`publisher\` = COALESCE(\`publisher\`, (SELECT \`d\`.\`publisher\` FROM \`__t9_version_merge\` \`m\` JOIN \`versions\` \`d\` ON \`d\`.\`rowid\` = \`m\`.\`dup_rowid\` WHERE \`m\`.\`keep\` = \`versions\`.\`local_id\` AND \`d\`.\`publisher\` IS NOT NULL LIMIT 1)),
|
|
2557
|
+
\`revoked_at\` = COALESCE(\`revoked_at\`, (SELECT \`d\`.\`revoked_at\` FROM \`__t9_version_merge\` \`m\` JOIN \`versions\` \`d\` ON \`d\`.\`rowid\` = \`m\`.\`dup_rowid\` WHERE \`m\`.\`keep\` = \`versions\`.\`local_id\` AND \`d\`.\`revoked_at\` IS NOT NULL LIMIT 1))
|
|
2558
|
+
WHERE \`local_id\` IN (SELECT \`keep\` FROM \`__t9_version_merge\`);
|
|
2559
|
+
--> statement-breakpoint
|
|
2560
|
+
UPDATE \`metadata\` SET \`version_local_id\` = (SELECT \`keep\` FROM \`__t9_version_merge\` WHERE \`dup\` = \`metadata\`.\`version_local_id\`)
|
|
2561
|
+
WHERE \`version_local_id\` IN (SELECT \`dup\` FROM \`__t9_version_merge\` WHERE \`keep\` IS NOT NULL);
|
|
2562
|
+
--> statement-breakpoint
|
|
2563
|
+
UPDATE \`arweave_l1_finalize_jobs\` SET \`version_local_id\` = (SELECT \`keep\` FROM \`__t9_version_merge\` WHERE \`dup\` = \`arweave_l1_finalize_jobs\`.\`version_local_id\`)
|
|
2564
|
+
WHERE \`version_local_id\` IN (SELECT \`dup\` FROM \`__t9_version_merge\` WHERE \`keep\` IS NOT NULL);
|
|
2565
|
+
--> statement-breakpoint
|
|
2566
|
+
DELETE FROM \`versions\` WHERE \`rowid\` IN (SELECT \`dup_rowid\` FROM \`__t9_version_merge\`);
|
|
2567
|
+
--> statement-breakpoint
|
|
2568
|
+
DROP TABLE \`__t9_version_merge\`;
|
|
2569
|
+
--> statement-breakpoint
|
|
2570
|
+
DELETE FROM \`model_schemas\`
|
|
2571
|
+
WHERE \`model_id\` IS NOT NULL AND \`schema_id\` IS NOT NULL
|
|
2572
|
+
AND \`id\` NOT IN (SELECT MIN(\`id\`) FROM \`model_schemas\` GROUP BY \`model_id\`, \`schema_id\`);
|
|
2573
|
+
--> statement-breakpoint
|
|
2574
|
+
CREATE UNIQUE INDEX \`model_schemas_model_id_schema_id_unique\` ON \`model_schemas\` (\`model_id\`,\`schema_id\`);
|
|
2575
|
+
--> statement-breakpoint
|
|
2576
|
+
CREATE UNIQUE INDEX \`seeds_attested_uid_unique\` ON \`seeds\` (\`uid\`) WHERE "seeds"."uid" IS NOT NULL AND trim("seeds"."uid") NOT IN ('', 'NULL') AND lower(trim("seeds"."uid")) != '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
2577
|
+
--> statement-breakpoint
|
|
2578
|
+
CREATE UNIQUE INDEX \`versions_attested_uid_unique\` ON \`versions\` (\`uid\`) WHERE "versions"."uid" IS NOT NULL AND trim("versions"."uid") NOT IN ('', 'NULL') AND lower(trim("versions"."uid")) != '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
2579
|
+
`;
|
|
2390
2580
|
// Journal JSON file
|
|
2391
2581
|
const journalJson = `{
|
|
2392
2582
|
"version": "7",
|
|
@@ -2573,16 +2763,45 @@ const journalJson = `{
|
|
|
2573
2763
|
"when": 1792585560172,
|
|
2574
2764
|
"tag": "0025_add_metadata_retract",
|
|
2575
2765
|
"breakpoints": true
|
|
2766
|
+
},
|
|
2767
|
+
{
|
|
2768
|
+
"idx": 26,
|
|
2769
|
+
"version": "6",
|
|
2770
|
+
"when": 1792587787468,
|
|
2771
|
+
"tag": "0026_add_content_hash_to_schemas",
|
|
2772
|
+
"breakpoints": true
|
|
2773
|
+
},
|
|
2774
|
+
{
|
|
2775
|
+
"idx": 27,
|
|
2776
|
+
"version": "6",
|
|
2777
|
+
"when": 1792587787964,
|
|
2778
|
+
"tag": "0027_link_metadata_property_ids",
|
|
2779
|
+
"breakpoints": true
|
|
2780
|
+
},
|
|
2781
|
+
{
|
|
2782
|
+
"idx": 28,
|
|
2783
|
+
"version": "6",
|
|
2784
|
+
"when": 1792596417502,
|
|
2785
|
+
"tag": "0028_add_definition_to_properties",
|
|
2786
|
+
"breakpoints": true
|
|
2787
|
+
},
|
|
2788
|
+
{
|
|
2789
|
+
"idx": 29,
|
|
2790
|
+
"version": "6",
|
|
2791
|
+
"when": 1792596480144,
|
|
2792
|
+
"tag": "0029_dedupe_chain_uids_add_unique_indexes",
|
|
2793
|
+
"breakpoints": true
|
|
2576
2794
|
}
|
|
2577
2795
|
]
|
|
2578
|
-
}
|
|
2796
|
+
}
|
|
2797
|
+
`;
|
|
2579
2798
|
// Snapshot JSON file - this is large, so we'll import it dynamically if needed
|
|
2580
2799
|
// For now, we'll read it from the actual file if ?raw works, otherwise we'll need to embed it
|
|
2581
2800
|
const snapshotJson = `{
|
|
2582
2801
|
"version": "6",
|
|
2583
2802
|
"dialect": "sqlite",
|
|
2584
|
-
"id": "
|
|
2585
|
-
"prevId": "
|
|
2803
|
+
"id": "0937d0b1-f4ea-4ae1-885b-7173e7b786b9",
|
|
2804
|
+
"prevId": "083c3909-4feb-4b61-bf23-fa806a60b826",
|
|
2586
2805
|
"tables": {
|
|
2587
2806
|
"appState": {
|
|
2588
2807
|
"name": "appState",
|
|
@@ -3347,6 +3566,13 @@ const snapshotJson = `{
|
|
|
3347
3566
|
"primaryKey": false,
|
|
3348
3567
|
"notNull": false,
|
|
3349
3568
|
"autoincrement": false
|
|
3569
|
+
},
|
|
3570
|
+
"definition": {
|
|
3571
|
+
"name": "definition",
|
|
3572
|
+
"type": "text",
|
|
3573
|
+
"primaryKey": false,
|
|
3574
|
+
"notNull": false,
|
|
3575
|
+
"autoincrement": false
|
|
3350
3576
|
}
|
|
3351
3577
|
},
|
|
3352
3578
|
"indexes": {
|
|
@@ -3423,7 +3649,16 @@ const snapshotJson = `{
|
|
|
3423
3649
|
"autoincrement": false
|
|
3424
3650
|
}
|
|
3425
3651
|
},
|
|
3426
|
-
"indexes": {
|
|
3652
|
+
"indexes": {
|
|
3653
|
+
"model_schemas_model_id_schema_id_unique": {
|
|
3654
|
+
"name": "model_schemas_model_id_schema_id_unique",
|
|
3655
|
+
"columns": [
|
|
3656
|
+
"model_id",
|
|
3657
|
+
"schema_id"
|
|
3658
|
+
],
|
|
3659
|
+
"isUnique": true
|
|
3660
|
+
}
|
|
3661
|
+
},
|
|
3427
3662
|
"foreignKeys": {
|
|
3428
3663
|
"model_schemas_model_id_models_id_fk": {
|
|
3429
3664
|
"name": "model_schemas_model_id_models_id_fk",
|
|
@@ -3905,6 +4140,13 @@ const snapshotJson = `{
|
|
|
3905
4140
|
"notNull": false,
|
|
3906
4141
|
"autoincrement": false
|
|
3907
4142
|
},
|
|
4143
|
+
"content_hash": {
|
|
4144
|
+
"name": "content_hash",
|
|
4145
|
+
"type": "text",
|
|
4146
|
+
"primaryKey": false,
|
|
4147
|
+
"notNull": false,
|
|
4148
|
+
"autoincrement": false
|
|
4149
|
+
},
|
|
3908
4150
|
"created_at": {
|
|
3909
4151
|
"name": "created_at",
|
|
3910
4152
|
"type": "integer",
|
|
@@ -4043,6 +4285,14 @@ const snapshotJson = `{
|
|
|
4043
4285
|
"type"
|
|
4044
4286
|
],
|
|
4045
4287
|
"isUnique": false
|
|
4288
|
+
},
|
|
4289
|
+
"seeds_attested_uid_unique": {
|
|
4290
|
+
"name": "seeds_attested_uid_unique",
|
|
4291
|
+
"columns": [
|
|
4292
|
+
"uid"
|
|
4293
|
+
],
|
|
4294
|
+
"isUnique": true,
|
|
4295
|
+
"where": "\\"seeds\\".\\"uid\\" IS NOT NULL AND trim(\\"seeds\\".\\"uid\\") NOT IN ('', 'NULL') AND lower(trim(\\"seeds\\".\\"uid\\")) != '0x0000000000000000000000000000000000000000000000000000000000000000'"
|
|
4046
4296
|
}
|
|
4047
4297
|
},
|
|
4048
4298
|
"foreignKeys": {},
|
|
@@ -4211,6 +4461,14 @@ const snapshotJson = `{
|
|
|
4211
4461
|
"seed_local_id"
|
|
4212
4462
|
],
|
|
4213
4463
|
"isUnique": false
|
|
4464
|
+
},
|
|
4465
|
+
"versions_attested_uid_unique": {
|
|
4466
|
+
"name": "versions_attested_uid_unique",
|
|
4467
|
+
"columns": [
|
|
4468
|
+
"uid"
|
|
4469
|
+
],
|
|
4470
|
+
"isUnique": true,
|
|
4471
|
+
"where": "\\"versions\\".\\"uid\\" IS NOT NULL AND trim(\\"versions\\".\\"uid\\") NOT IN ('', 'NULL') AND lower(trim(\\"versions\\".\\"uid\\")) != '0x0000000000000000000000000000000000000000000000000000000000000000'"
|
|
4214
4472
|
}
|
|
4215
4473
|
},
|
|
4216
4474
|
"foreignKeys": {},
|
|
@@ -4260,6 +4518,10 @@ var drizzleFiles = /*#__PURE__*/Object.freeze({
|
|
|
4260
4518
|
migrationSql_0023_add_entity_changes: migrationSql_0023_add_entity_changes,
|
|
4261
4519
|
migrationSql_0024_merge_republished_ghost_seeds: migrationSql_0024_merge_republished_ghost_seeds,
|
|
4262
4520
|
migrationSql_0025_add_metadata_retract: migrationSql_0025_add_metadata_retract,
|
|
4521
|
+
migrationSql_0026_add_content_hash_to_schemas: migrationSql_0026_add_content_hash_to_schemas,
|
|
4522
|
+
migrationSql_0027_link_metadata_property_ids: migrationSql_0027_link_metadata_property_ids,
|
|
4523
|
+
migrationSql_0028_add_definition_to_properties: migrationSql_0028_add_definition_to_properties,
|
|
4524
|
+
migrationSql_0029_dedupe_chain_uids_add_unique_indexes: migrationSql_0029_dedupe_chain_uids_add_unique_indexes,
|
|
4263
4525
|
snapshotJson: snapshotJson
|
|
4264
4526
|
});
|
|
4265
4527
|
|
|
@@ -4320,7 +4582,7 @@ async function applyEmbeddedMigrations(db, migrations, migrationsTable = '__driz
|
|
|
4320
4582
|
}
|
|
4321
4583
|
}
|
|
4322
4584
|
|
|
4323
|
-
const logger$
|
|
4585
|
+
const logger$1 = debug('seedSdk:browser:db:createSqlocalDrizzle');
|
|
4324
4586
|
/** First sqlocal work can include sqlite-wasm fetch; keep this long to avoid false positives. */
|
|
4325
4587
|
const SQLOCAL_FIRST_QUERY_TIMEOUT_MS = 90000;
|
|
4326
4588
|
const HTTP_MODULE_WORKER_URL = /^https?:/i;
|
|
@@ -4441,7 +4703,7 @@ function installModuleWorkerBlobWrap(onWorkerFailed) {
|
|
|
4441
4703
|
const error = new Error(filename
|
|
4442
4704
|
? `sqlocal worker failed to start (${event.type}): ${message} [${filename}]`
|
|
4443
4705
|
: `sqlocal worker failed to start (${event.type}): ${message}`);
|
|
4444
|
-
logger$
|
|
4706
|
+
logger$1('[createSqlocalDrizzle] worker failed', error.message);
|
|
4445
4707
|
onWorkerFailed(error);
|
|
4446
4708
|
};
|
|
4447
4709
|
worker.addEventListener('error', fail);
|
|
@@ -4456,7 +4718,7 @@ function installModuleWorkerBlobWrap(onWorkerFailed) {
|
|
|
4456
4718
|
};
|
|
4457
4719
|
}
|
|
4458
4720
|
|
|
4459
|
-
const logger
|
|
4721
|
+
const logger = debug('seedSdk:browser:db:Db');
|
|
4460
4722
|
class BrowserDb {
|
|
4461
4723
|
constructor() {
|
|
4462
4724
|
/** Live queries by SQL + params while they have subscribers; see liveQuery. */
|
|
@@ -4469,7 +4731,7 @@ class BrowserDb {
|
|
|
4469
4731
|
return !!this.appDb;
|
|
4470
4732
|
}
|
|
4471
4733
|
async prepareDb(filesDir) {
|
|
4472
|
-
logger
|
|
4734
|
+
logger('[Db.prepareDb] preparing database');
|
|
4473
4735
|
this.filesDir = filesDir;
|
|
4474
4736
|
// Another tab may be preparing the same database: run file copies, migrations and the
|
|
4475
4737
|
// one-time data fixes one tab at a time. See docs/MULTI_TAB.md.
|
|
@@ -4500,7 +4762,7 @@ class BrowserDb {
|
|
|
4500
4762
|
if (waitMs === undefined) {
|
|
4501
4763
|
throw new DatabaseNotPersistentError(`SQLocal opened a "${storageType}" database instead of OPFS`, globalThis.crossOriginIsolated === true ? 'vfs' : 'headers');
|
|
4502
4764
|
}
|
|
4503
|
-
logger
|
|
4765
|
+
logger(`[Db.prepareDb] SQLocal opened a "${storageType}" database; retrying in ${waitMs} ms`);
|
|
4504
4766
|
await new Promise((resolve) => setTimeout(resolve, waitMs));
|
|
4505
4767
|
}
|
|
4506
4768
|
}
|
|
@@ -4521,11 +4783,6 @@ class BrowserDb {
|
|
|
4521
4783
|
entries: [],
|
|
4522
4784
|
}, null, 2));
|
|
4523
4785
|
}
|
|
4524
|
-
// Wait for journal file to be fully written before proceeding with migration
|
|
4525
|
-
// This is critical in browser/OPFS where writes may not be immediately readable
|
|
4526
|
-
logger$1('[Db.prepareDb] waiting for journal file to be fully written...');
|
|
4527
|
-
await BaseFileManager.waitForFileWithContent(journalFilePath, 100, 5000);
|
|
4528
|
-
logger$1('[Db.prepareDb] journal file is ready');
|
|
4529
4786
|
// SQLite's OPFS VFS needs SharedArrayBuffer and Atomics. Without them SQLocal quietly
|
|
4530
4787
|
// opens an in-memory database, so fail before starting the worker.
|
|
4531
4788
|
if (typeof SharedArrayBuffer === 'undefined' || typeof Atomics === 'undefined') {
|
|
@@ -4546,24 +4803,19 @@ class BrowserDb {
|
|
|
4546
4803
|
const db = drizzle(driver, batchDriver, {
|
|
4547
4804
|
schema,
|
|
4548
4805
|
});
|
|
4549
|
-
logger
|
|
4806
|
+
logger('[Db.prepareDb] database prepared');
|
|
4550
4807
|
await raceSqlocalStartup((async () => {
|
|
4551
4808
|
await recreateIfOlderThanMinimumUpgradeVersion(db);
|
|
4552
4809
|
await this.runMigrations(db);
|
|
4553
4810
|
this.appDb = db;
|
|
4554
|
-
const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-C7P7FL6F.js');
|
|
4555
|
-
await backfillMetadataPropertyIds();
|
|
4556
4811
|
// Loaded Items and ItemProperties hear about row changes through it (ADR 0020). Started
|
|
4557
|
-
// after the
|
|
4558
|
-
await startChangeFeed(db, {
|
|
4559
|
-
liveQuery: (query) => this.liveQuery(query),
|
|
4560
|
-
sql: ((...args) => sqlocalDrizzle.sql(...args)),
|
|
4561
|
-
});
|
|
4812
|
+
// after the migrations above, so their log rows aren't dispatched.
|
|
4813
|
+
await startChangeFeed(db, { liveQuery: (query) => this.liveQuery(query) });
|
|
4562
4814
|
})(), workerFailed);
|
|
4563
4815
|
return this.appDb;
|
|
4564
4816
|
}
|
|
4565
4817
|
catch (error) {
|
|
4566
|
-
logger
|
|
4818
|
+
logger('[Db.prepareDb] error', JSON.stringify(error));
|
|
4567
4819
|
throw error;
|
|
4568
4820
|
}
|
|
4569
4821
|
}
|
|
@@ -4571,7 +4823,7 @@ class BrowserDb {
|
|
|
4571
4823
|
return undefined;
|
|
4572
4824
|
}
|
|
4573
4825
|
async copyDrizzleFiles(filesDir) {
|
|
4574
|
-
logger
|
|
4826
|
+
logger('[Db.copyDrizzleFiles] copying drizzle migration files');
|
|
4575
4827
|
try {
|
|
4576
4828
|
// Ensure db directory exists
|
|
4577
4829
|
const dbDirPath = `${filesDir}/db`;
|
|
@@ -4583,7 +4835,7 @@ class BrowserDb {
|
|
|
4583
4835
|
const journal = JSON.parse(journalJson);
|
|
4584
4836
|
const entries = journal.entries || [];
|
|
4585
4837
|
if (entries.length === 0) {
|
|
4586
|
-
logger
|
|
4838
|
+
logger('[Db.copyDrizzleFiles] no migration entries found in journal');
|
|
4587
4839
|
return;
|
|
4588
4840
|
}
|
|
4589
4841
|
// Copy each migration SQL file (always overwrite to ensure they're up-to-date)
|
|
@@ -4597,16 +4849,16 @@ class BrowserDb {
|
|
|
4597
4849
|
const migrationVarName = `migrationSql_${tag}`;
|
|
4598
4850
|
const migrationContent = drizzleFiles[migrationVarName];
|
|
4599
4851
|
if (!migrationContent) {
|
|
4600
|
-
logger
|
|
4852
|
+
logger(`[Db.copyDrizzleFiles] ERROR: No migration content found for ${migrationFileName} (variable: ${migrationVarName})`);
|
|
4601
4853
|
throw new Error(`No migration content found for ${migrationFileName}. Expected variable: ${migrationVarName}`);
|
|
4602
4854
|
}
|
|
4603
4855
|
await BaseFileManager.saveFile(migrationPath, migrationContent.trim());
|
|
4604
|
-
logger
|
|
4856
|
+
logger(`[Db.copyDrizzleFiles] copied/updated migration SQL file: ${migrationFileName}`);
|
|
4605
4857
|
}
|
|
4606
4858
|
// Copy journal JSON file (always overwrite to ensure it's up-to-date with all migrations)
|
|
4607
4859
|
const journalPath = `${metaDirPath}/_journal.json`;
|
|
4608
4860
|
await BaseFileManager.saveFile(journalPath, journalJson);
|
|
4609
|
-
logger
|
|
4861
|
+
logger('[Db.copyDrizzleFiles] copied/updated journal JSON file');
|
|
4610
4862
|
// Copy snapshot JSON file (use the latest snapshot based on the highest idx in journal)
|
|
4611
4863
|
// Snapshot files are named like: 0000_snapshot.json, 0001_snapshot.json, etc.
|
|
4612
4864
|
// The tag format is like "0000_married_malice", so we extract the numeric prefix
|
|
@@ -4617,11 +4869,11 @@ class BrowserDb {
|
|
|
4617
4869
|
const snapshotPath = `${metaDirPath}/${snapshotFileName}`;
|
|
4618
4870
|
// Always overwrite snapshot to ensure it's up-to-date
|
|
4619
4871
|
await BaseFileManager.saveFile(snapshotPath, snapshotJson);
|
|
4620
|
-
logger
|
|
4621
|
-
logger
|
|
4872
|
+
logger(`[Db.copyDrizzleFiles] copied/updated snapshot JSON file: ${snapshotFileName}`);
|
|
4873
|
+
logger('[Db.copyDrizzleFiles] drizzle files copied successfully');
|
|
4622
4874
|
}
|
|
4623
4875
|
catch (error) {
|
|
4624
|
-
logger
|
|
4876
|
+
logger('[Db.copyDrizzleFiles] error copying drizzle files', error);
|
|
4625
4877
|
// Don't throw - the files might already exist or migration might work without them
|
|
4626
4878
|
// The migration will fail later if the files are truly needed
|
|
4627
4879
|
}
|
|
@@ -4630,12 +4882,12 @@ class BrowserDb {
|
|
|
4630
4882
|
async runMigrations(db, _pathToDbDir) {
|
|
4631
4883
|
try {
|
|
4632
4884
|
const migrations = getEmbeddedMigrations();
|
|
4633
|
-
logger
|
|
4885
|
+
logger('[Db.runMigrations] embedded migrations', migrations.length);
|
|
4634
4886
|
await applyEmbeddedMigrations(db, migrations, undefined, (queries, migration) => this.runMigrationQueries(db, queries, canRunInTransaction(migration)));
|
|
4635
|
-
logger
|
|
4887
|
+
logger('[Db.runMigrations] migrations completed');
|
|
4636
4888
|
}
|
|
4637
4889
|
catch (error) {
|
|
4638
|
-
logger
|
|
4890
|
+
logger('[Db.runMigrations] error', JSON.stringify(error));
|
|
4639
4891
|
throw error;
|
|
4640
4892
|
}
|
|
4641
4893
|
}
|
|
@@ -4742,12 +4994,12 @@ class BrowserDb {
|
|
|
4742
4994
|
countRun();
|
|
4743
4995
|
subscriber.next(data);
|
|
4744
4996
|
}, (err) => {
|
|
4745
|
-
logger
|
|
4997
|
+
logger('[BaseDb.liveQuery] SQLocal reactiveQuery error:', err);
|
|
4746
4998
|
subscriber.error(err);
|
|
4747
4999
|
});
|
|
4748
5000
|
}
|
|
4749
5001
|
catch (error) {
|
|
4750
|
-
logger
|
|
5002
|
+
logger('[BaseDb.liveQuery] SQLocal reactiveQuery setup failed:', error);
|
|
4751
5003
|
subscriber.error(error);
|
|
4752
5004
|
return;
|
|
4753
5005
|
}
|
|
@@ -4796,224 +5048,13 @@ function liveQueryKey(statement) {
|
|
|
4796
5048
|
}
|
|
4797
5049
|
}
|
|
4798
5050
|
|
|
4799
|
-
const logger = debug("seedSdk:browser:ArweaveClient");
|
|
4800
|
-
// Cached Arweave instance (keyed by gateway so setHost / protocol changes apply)
|
|
4801
|
-
let _arweaveInstance = null;
|
|
4802
|
-
let _arweaveGatewayKey = null;
|
|
4803
|
-
/**
|
|
4804
|
-
* Get or create the Arweave instance for browser
|
|
4805
|
-
*/
|
|
4806
|
-
const getArweaveInstance = () => {
|
|
4807
|
-
const gatewayKey = `${BaseArweaveClient.getProtocol()}://${BaseArweaveClient.getHost()}`;
|
|
4808
|
-
if (_arweaveInstance && _arweaveGatewayKey === gatewayKey) {
|
|
4809
|
-
return _arweaveInstance;
|
|
4810
|
-
}
|
|
4811
|
-
_arweaveGatewayKey = gatewayKey;
|
|
4812
|
-
const apiConfig = BaseArweaveClient.getArweaveJsApiConfig();
|
|
4813
|
-
// Handle both ES modules and CommonJS exports from arweave package
|
|
4814
|
-
if ("default" in Arweave && typeof Arweave.default?.init === "function") {
|
|
4815
|
-
_arweaveInstance = Arweave.default.init(apiConfig);
|
|
4816
|
-
}
|
|
4817
|
-
else {
|
|
4818
|
-
_arweaveInstance = Arweave.init(apiConfig);
|
|
4819
|
-
}
|
|
4820
|
-
return _arweaveInstance;
|
|
4821
|
-
};
|
|
4822
|
-
class BrowserArweaveClient {
|
|
4823
|
-
getArweaveClient() {
|
|
4824
|
-
return new GraphQLClient(BaseArweaveClient.getEndpoint());
|
|
4825
|
-
}
|
|
4826
|
-
async getTransactionStatus(transactionId) {
|
|
4827
|
-
return fetchTransactionStatusAcrossGateways(transactionId);
|
|
4828
|
-
}
|
|
4829
|
-
async getTransactionData(transactionId, options) {
|
|
4830
|
-
// Preferred gateways (usually the one the item was uploaded through) serve it before L1 does.
|
|
4831
|
-
// `/raw` is already decoded, so skip them when the caller asked for undecoded data.
|
|
4832
|
-
const preferred = options?.decode === false ? [] : getPreferredArweaveReadBaseUrls();
|
|
4833
|
-
for (const base of preferred) {
|
|
4834
|
-
const response = await fetchArweaveRawFromBaseUrl(base, transactionId);
|
|
4835
|
-
if (!response)
|
|
4836
|
-
continue;
|
|
4837
|
-
try {
|
|
4838
|
-
if (options?.string) {
|
|
4839
|
-
return await response.text();
|
|
4840
|
-
}
|
|
4841
|
-
return new Uint8Array(await response.arrayBuffer());
|
|
4842
|
-
}
|
|
4843
|
-
catch (error) {
|
|
4844
|
-
logger("Error reading preferred gateway response:", error);
|
|
4845
|
-
}
|
|
4846
|
-
}
|
|
4847
|
-
// Path-prefixed proxies (app-server Hyper proxy) are not supported by arweave.init host;
|
|
4848
|
-
// fetch via getRawUrl so /api/seed-gateway/... works.
|
|
4849
|
-
if (BaseArweaveClient.getGatewayPath()) {
|
|
4850
|
-
const response = await fetch(BaseArweaveClient.getRawUrl(transactionId));
|
|
4851
|
-
if (!response.ok) {
|
|
4852
|
-
throw new Error(`Failed to fetch transaction data: HTTP ${response.status}`);
|
|
4853
|
-
}
|
|
4854
|
-
if (options?.string) {
|
|
4855
|
-
return response.text();
|
|
4856
|
-
}
|
|
4857
|
-
return new Uint8Array(await response.arrayBuffer());
|
|
4858
|
-
}
|
|
4859
|
-
const arweave = getArweaveInstance();
|
|
4860
|
-
try {
|
|
4861
|
-
const data = await arweave.transactions.getData(transactionId, {
|
|
4862
|
-
decode: options?.decode ?? true,
|
|
4863
|
-
string: options?.string ?? false,
|
|
4864
|
-
});
|
|
4865
|
-
if (options?.string && typeof data === "string") {
|
|
4866
|
-
return data;
|
|
4867
|
-
}
|
|
4868
|
-
// Ensure we return Uint8Array
|
|
4869
|
-
if (data instanceof Uint8Array) {
|
|
4870
|
-
return data;
|
|
4871
|
-
}
|
|
4872
|
-
// Handle string data when not requesting string
|
|
4873
|
-
if (typeof data === "string") {
|
|
4874
|
-
return new TextEncoder().encode(data);
|
|
4875
|
-
}
|
|
4876
|
-
return data;
|
|
4877
|
-
}
|
|
4878
|
-
catch (error) {
|
|
4879
|
-
logger("Error fetching transaction data:", error);
|
|
4880
|
-
throw error;
|
|
4881
|
-
}
|
|
4882
|
-
}
|
|
4883
|
-
async getTransactionTags(transactionId) {
|
|
4884
|
-
const client = this.getArweaveClient();
|
|
4885
|
-
try {
|
|
4886
|
-
const result = await client.request(GET_TRANSACTION_TAGS, { transactionId });
|
|
4887
|
-
if (!result.tags?.tags) {
|
|
4888
|
-
return [];
|
|
4889
|
-
}
|
|
4890
|
-
return result.tags.tags.map((tag) => ({
|
|
4891
|
-
name: tag.name,
|
|
4892
|
-
value: tag.value,
|
|
4893
|
-
}));
|
|
4894
|
-
}
|
|
4895
|
-
catch (error) {
|
|
4896
|
-
logger("Error fetching transaction tags:", error);
|
|
4897
|
-
return [];
|
|
4898
|
-
}
|
|
4899
|
-
}
|
|
4900
|
-
async createTransaction(data, options) {
|
|
4901
|
-
const arweave = getArweaveInstance();
|
|
4902
|
-
const tx = await arweave.createTransaction({
|
|
4903
|
-
data,
|
|
4904
|
-
});
|
|
4905
|
-
// Add tags if provided
|
|
4906
|
-
if (options?.tags) {
|
|
4907
|
-
for (const tag of options.tags) {
|
|
4908
|
-
tx.addTag(tag.name, tag.value);
|
|
4909
|
-
}
|
|
4910
|
-
}
|
|
4911
|
-
return tx;
|
|
4912
|
-
}
|
|
4913
|
-
async downloadFiles(params) {
|
|
4914
|
-
const { transactionIds, excludedTransactions } = params;
|
|
4915
|
-
const results = [];
|
|
4916
|
-
const baseUrl = BaseArweaveClient.getBaseUrl();
|
|
4917
|
-
for (const transactionId of transactionIds) {
|
|
4918
|
-
// Skip excluded transactions
|
|
4919
|
-
if (excludedTransactions?.has(transactionId)) {
|
|
4920
|
-
continue;
|
|
4921
|
-
}
|
|
4922
|
-
try {
|
|
4923
|
-
const url = `${baseUrl}/raw/${transactionId}`;
|
|
4924
|
-
const response = await fetch(url);
|
|
4925
|
-
if (!response.ok) {
|
|
4926
|
-
results.push({
|
|
4927
|
-
transactionId,
|
|
4928
|
-
success: false,
|
|
4929
|
-
error: `HTTP ${response.status}: ${response.statusText}`,
|
|
4930
|
-
});
|
|
4931
|
-
continue;
|
|
4932
|
-
}
|
|
4933
|
-
const arrayBuffer = await response.arrayBuffer();
|
|
4934
|
-
const data = new Uint8Array(arrayBuffer);
|
|
4935
|
-
// Detect content type
|
|
4936
|
-
const contentType = response.headers.get("content-type") || undefined;
|
|
4937
|
-
results.push({
|
|
4938
|
-
transactionId,
|
|
4939
|
-
success: true,
|
|
4940
|
-
contentType,
|
|
4941
|
-
data,
|
|
4942
|
-
});
|
|
4943
|
-
}
|
|
4944
|
-
catch (error) {
|
|
4945
|
-
logger(`Error downloading transaction ${transactionId}:`, error);
|
|
4946
|
-
results.push({
|
|
4947
|
-
transactionId,
|
|
4948
|
-
success: false,
|
|
4949
|
-
error: error instanceof Error ? error.message : String(error),
|
|
4950
|
-
});
|
|
4951
|
-
}
|
|
4952
|
-
}
|
|
4953
|
-
return results;
|
|
4954
|
-
}
|
|
4955
|
-
}
|
|
4956
|
-
BaseArweaveClient.configure(new BrowserArweaveClient());
|
|
4957
|
-
|
|
4958
|
-
class BrowserEasClient {
|
|
4959
|
-
/** Reads the endpoint per call so SDK / publish chain config applied after import takes effect. */
|
|
4960
|
-
getEasClient() {
|
|
4961
|
-
const url = getEasEndpoint();
|
|
4962
|
-
if (this.easClient?.url !== url) {
|
|
4963
|
-
this.easClient = { url, client: createEasGraphQLClient(url) };
|
|
4964
|
-
}
|
|
4965
|
-
return this.easClient.client;
|
|
4966
|
-
}
|
|
4967
|
-
}
|
|
4968
|
-
BaseEasClient.configure(new BrowserEasClient());
|
|
4969
|
-
|
|
4970
|
-
/**
|
|
4971
|
-
* Cached results are only reused within a query's staleTime (0 unless the caller sets one), so
|
|
4972
|
-
* they don't need to outlive that by much. Nothing persists this cache.
|
|
4973
|
-
*/
|
|
4974
|
-
const QUERY_GC_TIME_MS = 1000 * 60 * 5;
|
|
4975
|
-
class BrowserQueryClient {
|
|
4976
|
-
getQueryClient() {
|
|
4977
|
-
if (this.queryClient)
|
|
4978
|
-
return this.queryClient;
|
|
4979
|
-
const reactQueryClient = new QueryClient({
|
|
4980
|
-
defaultOptions: {
|
|
4981
|
-
queries: {
|
|
4982
|
-
networkMode: 'offlineFirst',
|
|
4983
|
-
gcTime: QUERY_GC_TIME_MS,
|
|
4984
|
-
},
|
|
4985
|
-
},
|
|
4986
|
-
});
|
|
4987
|
-
const queryClient = {
|
|
4988
|
-
fetchQuery: async (options) => {
|
|
4989
|
-
const { queryKey, queryFn, networkMode, staleTime } = options;
|
|
4990
|
-
return reactQueryClient.query({
|
|
4991
|
-
queryKey,
|
|
4992
|
-
queryFn,
|
|
4993
|
-
networkMode: networkMode,
|
|
4994
|
-
staleTime,
|
|
4995
|
-
});
|
|
4996
|
-
},
|
|
4997
|
-
getQueryData: (queryKey) => {
|
|
4998
|
-
return reactQueryClient.getQueryData(queryKey);
|
|
4999
|
-
},
|
|
5000
|
-
removeQueries: async (filters) => {
|
|
5001
|
-
await reactQueryClient.removeQueries(filters);
|
|
5002
|
-
},
|
|
5003
|
-
};
|
|
5004
|
-
this.queryClient = queryClient;
|
|
5005
|
-
return queryClient;
|
|
5006
|
-
}
|
|
5007
|
-
}
|
|
5008
|
-
BaseQueryClient.configure(new BrowserQueryClient());
|
|
5009
|
-
|
|
5010
5051
|
function createPlatformServices() {
|
|
5011
5052
|
return {
|
|
5012
5053
|
fileManager: new BrowserFileManager(),
|
|
5013
5054
|
db: new BrowserDb(),
|
|
5014
|
-
arweaveClient: new
|
|
5015
|
-
easClient: new
|
|
5016
|
-
queryClient: new
|
|
5055
|
+
arweaveClient: new DefaultArweaveClient(),
|
|
5056
|
+
easClient: new DefaultEasClient(),
|
|
5057
|
+
queryClient: new DefaultQueryClient(),
|
|
5017
5058
|
};
|
|
5018
5059
|
}
|
|
5019
5060
|
/**
|
|
@@ -5025,4 +5066,4 @@ function resolveFilesDir(filesDir) {
|
|
|
5025
5066
|
}
|
|
5026
5067
|
|
|
5027
5068
|
export { createPlatformServices as c, isSkippableOpfsEntryError as i, resolveFilesDir as r };
|
|
5028
|
-
//# sourceMappingURL=index.browser-
|
|
5069
|
+
//# sourceMappingURL=index.browser-CUmBVYen.js.map
|