@seedprotocol/sdk 0.7.8 → 0.7.9-next.1177.ga3e08ed
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/README.md +1 -1
- package/dist/{ClientManager-B1r_8P5Z.js → ClientManager-GZfXErDX.js} +187 -1451
- package/dist/ClientManager-GZfXErDX.js.map +1 -0
- package/dist/{Item-CjTEShfk.js → Item-0oDoTPhi.js} +175 -238
- package/dist/Item-0oDoTPhi.js.map +1 -0
- package/dist/{ModelProperty-C3749Wjq.js → ModelProperty-i5flwzQG.js} +41 -40
- package/dist/ModelProperty-i5flwzQG.js.map +1 -0
- package/dist/{Schema-CX9CTtho.js → Schema-PFZwG9Nl.js} +88 -1623
- package/dist/Schema-PFZwG9Nl.js.map +1 -0
- package/dist/{SchemaValidationService-T5mqnY8q.js → SchemaValidationService-DnGKel4V.js} +7 -6
- package/dist/{SchemaValidationService-T5mqnY8q.js.map → SchemaValidationService-DnGKel4V.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-DWWkh-Ex.js → backfillMetadataPropertyIds-BbxgavEQ.js} +4 -4
- package/dist/{backfillMetadataPropertyIds-DWWkh-Ex.js.map → backfillMetadataPropertyIds-BbxgavEQ.js.map} +1 -1
- package/dist/{changeFeed-DcsZ7deG.js → changeFeed-DKdVlUmt.js} +8 -7
- package/dist/changeFeed-DKdVlUmt.js.map +1 -0
- package/dist/configurePlatform-CrMafpMW.js +29 -0
- package/dist/configurePlatform-CrMafpMW.js.map +1 -0
- package/dist/db/drizzle/0024_merge_republished_ghost_seeds.sql +29 -0
- package/dist/db/drizzle/meta/0024_snapshot.json +1645 -0
- package/dist/db/drizzle/meta/_journal.json +7 -0
- package/dist/{detachRowsBeforeDelete-Bo_pky-R.js → detachRowsBeforeDelete-DXFYSHRR.js} +2 -3
- package/dist/{detachRowsBeforeDelete-Bo_pky-R.js.map → detachRowsBeforeDelete-DXFYSHRR.js.map} +1 -1
- package/dist/dist/{ClientManager-B1r_8P5Z.d.ts → ClientManager-GZfXErDX.d.ts} +323 -406
- package/dist/dist/ClientManager-GZfXErDX.d.ts.map +1 -0
- package/dist/dist/{Item-CjTEShfk.d.ts → Item-0oDoTPhi.d.ts} +85 -91
- package/dist/dist/Item-0oDoTPhi.d.ts.map +1 -0
- package/dist/dist/{ModelProperty-C3749Wjq.d.ts → ModelProperty-i5flwzQG.d.ts} +1 -1
- package/dist/dist/{ModelProperty-C3749Wjq.d.ts.map → ModelProperty-i5flwzQG.d.ts.map} +1 -1
- package/dist/dist/{Schema-CX9CTtho.d.ts → Schema-PFZwG9Nl.d.ts} +7 -183
- package/dist/dist/Schema-PFZwG9Nl.d.ts.map +1 -0
- package/dist/dist/{SchemaValidationService-T5mqnY8q.d.ts → SchemaValidationService-DnGKel4V.d.ts} +1 -1
- package/dist/dist/{SchemaValidationService-T5mqnY8q.d.ts.map → SchemaValidationService-DnGKel4V.d.ts.map} +1 -1
- package/dist/dist/{backfillMetadataPropertyIds-DWWkh-Ex.d.ts → backfillMetadataPropertyIds-BbxgavEQ.d.ts} +1 -1
- package/dist/dist/backfillMetadataPropertyIds-BbxgavEQ.d.ts.map +1 -0
- package/dist/dist/{changeFeed-DcsZ7deG.d.ts → changeFeed-DKdVlUmt.d.ts} +17 -20
- package/dist/dist/changeFeed-DKdVlUmt.d.ts.map +1 -0
- package/dist/dist/configurePlatform-CrMafpMW.d.ts +5 -0
- package/dist/dist/configurePlatform-CrMafpMW.d.ts.map +1 -0
- package/dist/dist/{detachRowsBeforeDelete-Bo_pky-R.d.ts → detachRowsBeforeDelete-DXFYSHRR.d.ts} +1 -1
- package/dist/dist/detachRowsBeforeDelete-DXFYSHRR.d.ts.map +1 -0
- package/dist/dist/{eas--9vtNkma.d.ts → eas-dyepi5jz.d.ts} +1 -1
- package/dist/dist/eas-dyepi5jz.d.ts.map +1 -0
- package/dist/dist/{errors-Do7v6RKu.d.ts → errors-C1qUEZ7A.d.ts} +5 -2
- package/dist/dist/errors-C1qUEZ7A.d.ts.map +1 -0
- package/dist/dist/{errors-rIWK7gwJ.d.ts → errors-D1zHAqjr.d.ts} +1 -1
- package/dist/dist/{errors-rIWK7gwJ.d.ts.map → errors-D1zHAqjr.d.ts.map} +1 -1
- package/dist/dist/eventBus-7vxTCc3a.d.ts +18 -0
- package/dist/dist/eventBus-7vxTCc3a.d.ts.map +1 -0
- package/dist/dist/findSeedRowsByUid-CT3sOXXw.d.ts +13 -0
- package/dist/dist/findSeedRowsByUid-CT3sOXXw.d.ts.map +1 -0
- package/dist/dist/{getItem-5j22EWWE.d.ts → getItem-Bhjecbia.d.ts} +1 -1
- package/dist/dist/getItem-Bhjecbia.d.ts.map +1 -0
- package/dist/dist/{getPublishPayload-BGl2SaGK.d.ts → getPublishPayload-DH4rMqXG.d.ts} +1 -1
- package/dist/dist/getPublishPayload-DH4rMqXG.d.ts.map +1 -0
- package/dist/dist/{getPublishUploads-DVsDx6Xf.d.ts → getPublishUploads-BzUIDA2G.d.ts} +5 -5
- package/dist/dist/getPublishUploads-BzUIDA2G.d.ts.map +1 -0
- package/dist/dist/index-CkYb3wcU.d.ts +14 -0
- package/dist/dist/index-CkYb3wcU.d.ts.map +1 -0
- package/dist/dist/{index-Dp4uyZYx.d.ts → index-DJmWkVIK.d.ts} +5 -5
- package/dist/dist/index-DJmWkVIK.d.ts.map +1 -0
- package/dist/dist/{index-C0SetTd1.d.ts → index-Dx_GTdyQ.d.ts} +1457 -1513
- package/dist/dist/index-Dx_GTdyQ.d.ts.map +1 -0
- package/dist/dist/{index-CZQrNqvq.d.ts → index-PbnKw2es.d.ts} +1 -1
- package/dist/dist/{index-CZQrNqvq.d.ts.map → index-PbnKw2es.d.ts.map} +1 -1
- package/dist/dist/{index.browser-Ll71Y_Dl.d.ts → index.browser-i9uPJice.d.ts} +13 -40
- package/dist/dist/{index.browser-Ll71Y_Dl.d.ts.map → index.browser-i9uPJice.d.ts.map} +1 -1
- package/dist/dist/{index.node-CgltN0cC.d.ts → index.node-CzMwMr_d.d.ts} +2 -45
- package/dist/dist/{index.node-CgltN0cC.d.ts.map → index.node-CzMwMr_d.d.ts.map} +1 -1
- package/dist/dist/minimumUpgradeVersion-BDhHvHtr.d.ts +9 -0
- package/dist/dist/minimumUpgradeVersion-BDhHvHtr.d.ts.map +1 -0
- package/dist/dist/{modelPropertyRecordSchemas-C_lYTzMr.d.ts → modelPropertyRecordSchemas-C5lW9aA-.d.ts} +1 -1
- package/dist/dist/modelPropertyRecordSchemas-C5lW9aA-.d.ts.map +1 -0
- package/dist/dist/platform.browser.d.ts +2 -2
- package/dist/dist/platform.node.d.ts +2 -2
- package/dist/dist/{property-pcDxNEpy.d.ts → property-BwYtg5Q_.d.ts} +3 -3
- package/dist/dist/property-BwYtg5Q_.d.ts.map +1 -0
- package/dist/dist/{propertyValidationRules-BEjN0f3-.d.ts → propertyValidationRules-CyHdpcPP.d.ts} +1 -1
- package/dist/dist/propertyValidationRules-CyHdpcPP.d.ts.map +1 -0
- package/dist/dist/{publishDraftGraph-I5yKe1Xz.d.ts → publishDraftGraph-C5F6b7GK.d.ts} +23 -6
- package/dist/dist/publishDraftGraph-C5F6b7GK.d.ts.map +1 -0
- package/dist/dist/{resolveModelForSyncedSeed-C5KXn6ex.d.ts → resolveModelForSyncedSeed-4gO9Hfn2.d.ts} +1 -1
- package/dist/dist/resolveModelForSyncedSeed-4gO9Hfn2.d.ts.map +1 -0
- package/dist/dist/syncDbWithEas-DUu_wjUG.d.ts +13 -0
- package/dist/dist/syncDbWithEas-DUu_wjUG.d.ts.map +1 -0
- package/dist/dist/{tolerantWebAccess-CIpS7RLk.d.ts → tolerantWebAccess-DecKDGen.d.ts} +1 -1
- package/dist/dist/{tolerantWebAccess-CIpS7RLk.d.ts.map → tolerantWebAccess-DecKDGen.d.ts.map} +1 -1
- package/dist/dist/{updateSeedRevokedAt-CR4zwn-6.d.ts → updateSeedRevokedAt-CP606vKs.d.ts} +1 -1
- package/dist/dist/updateSeedRevokedAt-CP606vKs.d.ts.map +1 -0
- package/dist/{eas--9vtNkma.js → eas-dyepi5jz.js} +3 -4
- package/dist/eas-dyepi5jz.js.map +1 -0
- package/dist/{errors-Do7v6RKu.js → errors-C1qUEZ7A.js} +12 -6
- package/dist/errors-C1qUEZ7A.js.map +1 -0
- package/dist/{errors-rIWK7gwJ.js → errors-D1zHAqjr.js} +46 -98
- package/dist/errors-D1zHAqjr.js.map +1 -0
- package/dist/eventBus-7vxTCc3a.js +64 -0
- package/dist/eventBus-7vxTCc3a.js.map +1 -0
- package/dist/findSeedRowsByUid-CT3sOXXw.js +47 -0
- package/dist/findSeedRowsByUid-CT3sOXXw.js.map +1 -0
- package/dist/{getItem-5j22EWWE.js → getItem-Bhjecbia.js} +5 -5
- package/dist/{getItem-5j22EWWE.js.map → getItem-Bhjecbia.js.map} +1 -1
- package/dist/{getPublishPayload-BGl2SaGK.js → getPublishPayload-DH4rMqXG.js} +27 -27
- package/dist/getPublishPayload-DH4rMqXG.js.map +1 -0
- package/dist/{getPublishUploads-DVsDx6Xf.js → getPublishUploads-BzUIDA2G.js} +64 -95
- package/dist/getPublishUploads-BzUIDA2G.js.map +1 -0
- package/dist/{index-CJK3F_MK.js → index-CkYb3wcU.js} +9 -8
- package/dist/index-CkYb3wcU.js.map +1 -0
- package/dist/{index-Dp4uyZYx.js → index-DJmWkVIK.js} +9 -8
- package/dist/index-DJmWkVIK.js.map +1 -0
- package/dist/{index-C0SetTd1.js → index-Dx_GTdyQ.js} +27 -463
- package/dist/index-Dx_GTdyQ.js.map +1 -0
- package/dist/{index-CZQrNqvq.js → index-PbnKw2es.js} +2 -2
- package/dist/index-PbnKw2es.js.map +1 -0
- package/dist/{index.browser-Ll71Y_Dl.js → index.browser-i9uPJice.js} +239 -179
- package/dist/index.browser-i9uPJice.js.map +1 -0
- package/dist/{index.node-CgltN0cC.js → index.node-CzMwMr_d.js} +51 -216
- package/dist/index.node-CzMwMr_d.js.map +1 -0
- package/dist/main.js +165 -241
- package/dist/main.js.map +1 -1
- package/dist/minimumUpgradeVersion-BDhHvHtr.js +81 -0
- package/dist/minimumUpgradeVersion-BDhHvHtr.js.map +1 -0
- package/dist/{modelPropertyRecordSchemas-C_lYTzMr.js → modelPropertyRecordSchemas-C5lW9aA-.js} +5 -5
- package/dist/{modelPropertyRecordSchemas-C_lYTzMr.js.map → modelPropertyRecordSchemas-C5lW9aA-.js.map} +1 -1
- package/dist/node.js +14 -221
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +8 -7
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.node.js +7 -7
- package/dist/{property-pcDxNEpy.js → property-BwYtg5Q_.js} +8 -9
- package/dist/property-BwYtg5Q_.js.map +1 -0
- package/dist/{propertyValidationRules-BEjN0f3-.js → propertyValidationRules-CyHdpcPP.js} +10 -10
- package/dist/{propertyValidationRules-BEjN0f3-.js.map → propertyValidationRules-CyHdpcPP.js.map} +1 -1
- package/dist/{publishDraftGraph-I5yKe1Xz.js → publishDraftGraph-C5F6b7GK.js} +104 -35
- package/dist/publishDraftGraph-C5F6b7GK.js.map +1 -0
- package/dist/{resolveModelForSyncedSeed-C5KXn6ex.js → resolveModelForSyncedSeed-4gO9Hfn2.js} +3 -2
- package/dist/{resolveModelForSyncedSeed-C5KXn6ex.js.map → resolveModelForSyncedSeed-4gO9Hfn2.js.map} +1 -1
- package/dist/seedSchema/PendingWriteSchema.ts +3 -2
- package/dist/src/Item/Item.d.ts +1 -0
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/Item/service/actors/runPublish.d.ts.map +1 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts +2 -2
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/propertyMachine.d.ts +1 -1
- package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
- package/dist/src/Model/Model.d.ts.map +1 -1
- package/dist/src/Model/service/modelMachine.d.ts +0 -20
- package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +0 -20
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
- package/dist/src/Schema/service/schemaMachine.d.ts +1 -107
- package/dist/src/Schema/service/schemaMachine.d.ts.map +1 -1
- package/dist/src/Schema/validation.d.ts +0 -1
- package/dist/src/Schema/validation.d.ts.map +1 -1
- package/dist/src/browser/db/Db.d.ts +8 -3
- package/dist/src/browser/db/Db.d.ts.map +1 -1
- package/dist/src/browser/db/createSqlocalDrizzle.d.ts +20 -2
- package/dist/src/browser/db/createSqlocalDrizzle.d.ts.map +1 -1
- package/dist/src/browser/db/drizzleFiles.d.ts +3 -2
- package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
- package/dist/src/browser/workers/FileDownloader.d.ts +1 -1
- package/dist/src/browser/workers/FileDownloader.d.ts.map +1 -1
- package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
- package/dist/src/client/actors/fileSystemInit.d.ts.map +1 -1
- package/dist/src/client/actors/platformClassesInit.d.ts +1 -1
- package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
- package/dist/src/client/actors/processSchemaFiles.d.ts.map +1 -1
- package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
- package/dist/src/client/constants.d.ts +0 -51
- package/dist/src/client/constants.d.ts.map +1 -1
- package/dist/src/db/minimumUpgradeVersion.d.ts +33 -0
- package/dist/src/db/minimumUpgradeVersion.d.ts.map +1 -0
- package/dist/src/db/read/batchLatestPublishedVersionBySeedLocalIds.d.ts +2 -1
- package/dist/src/db/read/batchLatestPublishedVersionBySeedLocalIds.d.ts.map +1 -1
- package/dist/src/db/read/findSeedRowsByUid.d.ts +13 -0
- package/dist/src/db/read/findSeedRowsByUid.d.ts.map +1 -0
- package/dist/src/db/read/getItemData.d.ts.map +1 -1
- package/dist/src/db/read/getLatestPublishedVersionRow.d.ts +2 -1
- package/dist/src/db/read/getLatestPublishedVersionRow.d.ts.map +1 -1
- package/dist/src/db/read/getLatestVersionRow.d.ts +1 -1
- package/dist/src/db/read/getLatestVersionRow.d.ts.map +1 -1
- package/dist/src/db/read/getPublishPayload.d.ts +4 -0
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/read/getPublishUploads.d.ts +1 -3
- package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/src/db/read/getRelatedItemsForPublish.d.ts +2 -0
- package/dist/src/db/read/getRelatedItemsForPublish.d.ts.map +1 -1
- package/dist/src/db/read/itemLoads.d.ts +20 -0
- package/dist/src/db/read/itemLoads.d.ts.map +1 -0
- package/dist/src/db/read/publishDraftGraph.d.ts +7 -0
- package/dist/src/db/read/publishDraftGraph.d.ts.map +1 -1
- package/dist/src/db/read/resolveRelatedSeedRef.d.ts +4 -4
- package/dist/src/db/read/resolveRelatedSeedRef.d.ts.map +1 -1
- package/dist/src/db/read/subqueries/latestVersion.d.ts +14 -0
- package/dist/src/db/read/subqueries/latestVersion.d.ts.map +1 -0
- package/dist/src/db/read/subqueries/versionData.d.ts +2 -2
- package/dist/src/db/read/subqueries/versionData.d.ts.map +1 -1
- package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
- package/dist/src/db/write/applyPropertyAttestationUidsFromPublish.d.ts +6 -0
- package/dist/src/db/write/applyPropertyAttestationUidsFromPublish.d.ts.map +1 -1
- package/dist/src/db/write/easSyncProcess.d.ts +1 -1
- package/dist/src/db/write/easSyncProcess.d.ts.map +1 -1
- package/dist/src/db/write/updateVersionUid.d.ts +2 -2
- package/dist/src/db/write/updateVersionUid.d.ts.map +1 -1
- package/dist/src/events/files/download.d.ts +1 -10
- package/dist/src/events/files/download.d.ts.map +1 -1
- package/dist/src/events/item/easSyncManager.d.ts +0 -1
- package/dist/src/events/item/easSyncManager.d.ts.map +1 -1
- package/dist/src/events/item/index.d.ts.map +1 -1
- package/dist/src/events/item/syncDbWithEas.d.ts +0 -10
- package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts +1 -1
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/IFileManager.d.ts +7 -0
- package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/errors.d.ts +4 -1
- package/dist/src/helpers/FileManager/errors.d.ts.map +1 -1
- package/dist/src/helpers/arweaveContentTags.d.ts +1 -2
- package/dist/src/helpers/arweaveContentTags.d.ts.map +1 -1
- package/dist/src/helpers/constants.d.ts +3 -12
- package/dist/src/helpers/constants.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts +3 -28
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/ethereumUtils.d.ts +0 -2
- package/dist/src/helpers/ethereumUtils.d.ts.map +1 -1
- package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts +2 -1
- package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts.map +1 -1
- package/dist/src/helpers/index.d.ts +0 -7
- package/dist/src/helpers/index.d.ts.map +1 -1
- package/dist/src/helpers/itemStorageFile.d.ts +2 -2
- package/dist/src/helpers/reconcilePropertyDraftRows.d.ts +2 -1
- package/dist/src/helpers/reconcilePropertyDraftRows.d.ts.map +1 -1
- package/dist/src/helpers/schema.d.ts +0 -73
- package/dist/src/helpers/schema.d.ts.map +1 -1
- package/dist/src/helpers/updateSchema.d.ts +0 -46
- package/dist/src/helpers/updateSchema.d.ts.map +1 -1
- package/dist/src/imports/index.d.ts +0 -1
- package/dist/src/imports/index.d.ts.map +1 -1
- package/dist/src/imports/json.d.ts +2 -1
- package/dist/src/imports/json.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/node/db/Db.d.ts.map +1 -1
- package/dist/src/node/helpers/dotSeedDir.d.ts +7 -0
- package/dist/src/node/helpers/dotSeedDir.d.ts.map +1 -0
- package/dist/src/node/index.d.ts +0 -5
- package/dist/src/node/index.d.ts.map +1 -1
- package/dist/src/outbox/index.d.ts +1 -1
- package/dist/src/outbox/index.d.ts.map +1 -1
- package/dist/src/outbox/itemAppliers.d.ts.map +1 -1
- package/dist/src/outbox/outbox.d.ts +3 -19
- package/dist/src/outbox/outbox.d.ts.map +1 -1
- 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/platform/types.d.ts +0 -2
- package/dist/src/platform/types.d.ts.map +1 -1
- package/dist/src/query/createLocalQueryDataSource.d.ts.map +1 -1
- package/dist/src/seedSchema/PendingWriteSchema.d.ts.map +1 -1
- package/dist/src/services/write/actors/validateEntity.d.ts +1 -1
- package/dist/src/services/write/actors/validateEntity.d.ts.map +1 -1
- package/dist/src/services/write/actors/writeToDatabase.d.ts.map +1 -1
- package/dist/src/services/write/writeProcessMachine.d.ts +1 -23
- package/dist/src/services/write/writeProcessMachine.d.ts.map +1 -1
- package/dist/src/stores/eas.d.ts +0 -1
- package/dist/src/stores/eas.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +1 -18
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/machines.d.ts +1 -32
- package/dist/src/types/machines.d.ts.map +1 -1
- package/dist/{syncDbWithEas-b4fESZ7C.js → syncDbWithEas-DUu_wjUG.js} +37 -105
- package/dist/syncDbWithEas-DUu_wjUG.js.map +1 -0
- package/dist/{tolerantWebAccess-CIpS7RLk.js → tolerantWebAccess-DecKDGen.js} +9 -8
- package/dist/{tolerantWebAccess-CIpS7RLk.js.map → tolerantWebAccess-DecKDGen.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-CR4zwn-6.js → updateSeedRevokedAt-CP606vKs.js} +3 -3
- package/dist/{updateSeedRevokedAt-CR4zwn-6.js.map → updateSeedRevokedAt-CP606vKs.js.map} +1 -1
- package/package.json +6 -8
- package/dist/ClientManager-B1r_8P5Z.js.map +0 -1
- package/dist/Item-CjTEShfk.js.map +0 -1
- package/dist/ModelProperty-C3749Wjq.js.map +0 -1
- package/dist/Schema-CX9CTtho.js.map +0 -1
- package/dist/changeFeed-DcsZ7deG.js.map +0 -1
- package/dist/configurePlatform-AWild9o4.js +0 -81
- package/dist/configurePlatform-AWild9o4.js.map +0 -1
- package/dist/dist/ClientManager-B1r_8P5Z.d.ts.map +0 -1
- package/dist/dist/Item-CjTEShfk.d.ts.map +0 -1
- package/dist/dist/Schema-CX9CTtho.d.ts.map +0 -1
- package/dist/dist/backfillMetadataPropertyIds-DWWkh-Ex.d.ts.map +0 -1
- package/dist/dist/changeFeed-DcsZ7deG.d.ts.map +0 -1
- package/dist/dist/configurePlatform-AWild9o4.d.ts +0 -30
- package/dist/dist/configurePlatform-AWild9o4.d.ts.map +0 -1
- package/dist/dist/detachRowsBeforeDelete-Bo_pky-R.d.ts.map +0 -1
- package/dist/dist/eas--9vtNkma.d.ts.map +0 -1
- package/dist/dist/errors-Do7v6RKu.d.ts.map +0 -1
- package/dist/dist/getItem-5j22EWWE.d.ts.map +0 -1
- package/dist/dist/getPublishPayload-BGl2SaGK.d.ts.map +0 -1
- package/dist/dist/getPublishUploads-DVsDx6Xf.d.ts.map +0 -1
- package/dist/dist/index-C0SetTd1.d.ts.map +0 -1
- package/dist/dist/index-CJK3F_MK.d.ts +0 -14
- package/dist/dist/index-CJK3F_MK.d.ts.map +0 -1
- package/dist/dist/index-Dp4uyZYx.d.ts.map +0 -1
- package/dist/dist/modelPropertyRecordSchemas-C_lYTzMr.d.ts.map +0 -1
- package/dist/dist/property-pcDxNEpy.d.ts.map +0 -1
- package/dist/dist/propertyValidationRules-BEjN0f3-.d.ts.map +0 -1
- package/dist/dist/publishDraftGraph-I5yKe1Xz.d.ts.map +0 -1
- package/dist/dist/resetAmbiguousLegacyItemData-0Tin9-JK.d.ts +0 -17
- package/dist/dist/resetAmbiguousLegacyItemData-0Tin9-JK.d.ts.map +0 -1
- package/dist/dist/resolveModelForSyncedSeed-C5KXn6ex.d.ts.map +0 -1
- package/dist/dist/syncDbWithEas-b4fESZ7C.d.ts +0 -22
- package/dist/dist/syncDbWithEas-b4fESZ7C.d.ts.map +0 -1
- package/dist/dist/updateSeedRevokedAt-CR4zwn-6.d.ts.map +0 -1
- package/dist/eas--9vtNkma.js.map +0 -1
- package/dist/errors-Do7v6RKu.js.map +0 -1
- package/dist/errors-rIWK7gwJ.js.map +0 -1
- package/dist/getPublishPayload-BGl2SaGK.js.map +0 -1
- package/dist/getPublishUploads-DVsDx6Xf.js.map +0 -1
- package/dist/index-C0SetTd1.js.map +0 -1
- package/dist/index-CJK3F_MK.js.map +0 -1
- package/dist/index-CZQrNqvq.js.map +0 -1
- package/dist/index-Dp4uyZYx.js.map +0 -1
- package/dist/index.browser-Ll71Y_Dl.js.map +0 -1
- package/dist/index.node-CgltN0cC.js.map +0 -1
- package/dist/property-pcDxNEpy.js.map +0 -1
- package/dist/publishDraftGraph-I5yKe1Xz.js.map +0 -1
- package/dist/resetAmbiguousLegacyItemData-0Tin9-JK.js +0 -98
- package/dist/resetAmbiguousLegacyItemData-0Tin9-JK.js.map +0 -1
- package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts +0 -5
- package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +0 -1
- package/dist/src/browser/db/sqlWasmClient.d.ts +0 -1
- package/dist/src/browser/db/sqlWasmClient.d.ts.map +0 -1
- package/dist/src/browser/helpers/PathResolver.d.ts +0 -41
- package/dist/src/browser/helpers/PathResolver.d.ts.map +0 -1
- package/dist/src/browser/index.d.ts +0 -3
- package/dist/src/browser/index.d.ts.map +0 -1
- package/dist/src/browser/seed.d.ts +0 -21
- package/dist/src/browser/seed.d.ts.map +0 -1
- package/dist/src/browser/workers/content-hash.d.ts +0 -2
- package/dist/src/browser/workers/content-hash.d.ts.map +0 -1
- package/dist/src/browser/workers/dbWorker.d.ts +0 -1
- package/dist/src/browser/workers/dbWorker.d.ts.map +0 -1
- package/dist/src/client/BaseClientManager.d.ts +0 -7
- package/dist/src/client/BaseClientManager.d.ts.map +0 -1
- package/dist/src/client/actions/setAddresses.d.ts +0 -2
- package/dist/src/client/actions/setAddresses.d.ts.map +0 -1
- package/dist/src/db/alignRowPublishers.d.ts +0 -25
- package/dist/src/db/alignRowPublishers.d.ts.map +0 -1
- package/dist/src/db/clearStoredDisplayUrls.d.ts +0 -18
- package/dist/src/db/clearStoredDisplayUrls.d.ts.map +0 -1
- package/dist/src/db/migrateLegacyItemStorageRows.d.ts +0 -57
- package/dist/src/db/migrateLegacyItemStorageRows.d.ts.map +0 -1
- package/dist/src/db/read/getExistingItem.d.ts +0 -12
- package/dist/src/db/read/getExistingItem.d.ts.map +0 -1
- package/dist/src/db/read/getModels.d.ts +0 -5
- package/dist/src/db/read/getModels.d.ts.map +0 -1
- package/dist/src/db/read/getVersionsForVersionUids.d.ts +0 -10
- package/dist/src/db/read/getVersionsForVersionUids.d.ts.map +0 -1
- package/dist/src/db/removeForeignAttestationRows.d.ts +0 -27
- package/dist/src/db/removeForeignAttestationRows.d.ts.map +0 -1
- package/dist/src/db/resetAmbiguousLegacyItemData.d.ts +0 -17
- package/dist/src/db/resetAmbiguousLegacyItemData.d.ts.map +0 -1
- package/dist/src/db/write/applyArweaveL1TransactionIdLocal.d.ts +0 -14
- package/dist/src/db/write/applyArweaveL1TransactionIdLocal.d.ts.map +0 -1
- package/dist/src/db/write/convertVerbatimItemStorageRow.d.ts +0 -44
- package/dist/src/db/write/convertVerbatimItemStorageRow.d.ts.map +0 -1
- package/dist/src/db/write/restoreDataItemIdsOverwrittenByL1.d.ts +0 -18
- package/dist/src/db/write/restoreDataItemIdsOverwrittenByL1.d.ts.map +0 -1
- package/dist/src/db/write/saveAppState.d.ts +0 -2
- package/dist/src/db/write/saveAppState.d.ts.map +0 -1
- package/dist/src/eslint-rules/align-imports.d.ts +0 -12
- package/dist/src/eslint-rules/align-imports.d.ts.map +0 -1
- package/dist/src/events/files/index.d.ts +0 -4
- package/dist/src/events/files/index.d.ts.map +0 -1
- package/dist/src/events/index.d.ts +0 -13
- package/dist/src/events/index.d.ts.map +0 -1
- package/dist/src/events/services/allItems.d.ts +0 -6
- package/dist/src/events/services/allItems.d.ts.map +0 -1
- package/dist/src/events/services/index.d.ts +0 -3
- package/dist/src/events/services/index.d.ts.map +0 -1
- package/dist/src/helpers/ArweaveClient/index.d.ts +0 -30
- package/dist/src/helpers/ArweaveClient/index.d.ts.map +0 -1
- package/dist/src/helpers/PathResolver/BasePathResolver.d.ts +0 -26
- package/dist/src/helpers/PathResolver/BasePathResolver.d.ts.map +0 -1
- package/dist/src/helpers/PathResolver/IPathResolver.d.ts +0 -16
- package/dist/src/helpers/PathResolver/IPathResolver.d.ts.map +0 -1
- package/dist/src/helpers/easRevokedFilter.d.ts +0 -2
- package/dist/src/helpers/easRevokedFilter.d.ts.map +0 -1
- package/dist/src/helpers/file/fetchAll/actors.d.ts +0 -16
- package/dist/src/helpers/file/fetchAll/actors.d.ts.map +0 -1
- package/dist/src/helpers/file/fetchAll/index.d.ts +0 -58
- package/dist/src/helpers/file/fetchAll/index.d.ts.map +0 -1
- package/dist/src/helpers/files.d.ts +0 -10
- package/dist/src/helpers/files.d.ts.map +0 -1
- package/dist/src/helpers/updateMachineContext.d.ts +0 -7
- package/dist/src/helpers/updateMachineContext.d.ts.map +0 -1
- package/dist/src/imports/markdown.d.ts +0 -40
- package/dist/src/imports/markdown.d.ts.map +0 -1
- package/dist/src/node/constants.d.ts +0 -2
- package/dist/src/node/constants.d.ts.map +0 -1
- package/dist/src/node/db/index.d.ts +0 -5
- package/dist/src/node/db/index.d.ts.map +0 -1
- package/dist/src/node/helpers/PathResolver.d.ts +0 -44
- package/dist/src/node/helpers/PathResolver.d.ts.map +0 -1
- package/dist/src/node/helpers/scripts.d.ts +0 -14
- package/dist/src/node/helpers/scripts.d.ts.map +0 -1
- package/dist/src/node/seed.d.ts +0 -1
- package/dist/src/node/seed.d.ts.map +0 -1
- package/dist/src/node/webpack/fs-proxy.d.ts +0 -4
- package/dist/src/node/webpack/fs-proxy.d.ts.map +0 -1
- package/dist/src/node/webpack/index.d.ts +0 -7
- package/dist/src/node/webpack/index.d.ts.map +0 -1
- package/dist/src/services/events.d.ts +0 -2
- package/dist/src/services/events.d.ts.map +0 -1
- package/dist/src/testing/platformTestHandle.d.ts +0 -8
- package/dist/src/testing/platformTestHandle.d.ts.map +0 -1
- package/dist/src/types/browser.d.ts +0 -24
- package/dist/src/types/browser.d.ts.map +0 -1
- package/dist/src/types/seedProtocol.d.ts +0 -16
- package/dist/src/types/seedProtocol.d.ts.map +0 -1
- package/dist/src/types/services.d.ts +0 -1
- package/dist/src/types/services.d.ts.map +0 -1
- package/dist/syncDbWithEas-b4fESZ7C.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import debug from 'debug';
|
|
2
2
|
import { isEasAttestationExplorerUrl, BaseArweaveClient, ensureReadGatewaySelected, getArweaveReadBaseUrls, getTransactionTagsByIds } from '@seedprotocol/arweave';
|
|
3
|
-
import { easName, DEFAULT_NAME_MATCH_LEVEL, compareNameMatchTiers, isNameMatchLevel, localNamesInBestMatchTier, BaseQueryClient, BaseEasClient, GET_FILES_METADATA } from '@seedprotocol/eas';
|
|
3
|
+
import { VERSION_SCHEMA_UID, easName, DEFAULT_NAME_MATCH_LEVEL, compareNameMatchTiers, isNameMatchLevel, localNamesInBestMatchTier, BaseQueryClient, BaseEasClient, GET_FILES_METADATA } from '@seedprotocol/eas';
|
|
4
4
|
import { waitFor } from 'xstate';
|
|
5
5
|
import pluralize from 'pluralize';
|
|
6
6
|
import { Type } from '@sinclair/typebox';
|
|
@@ -8,7 +8,6 @@ import { sqliteTable, integer, text, unique, int, index, blob, uniqueIndex } fro
|
|
|
8
8
|
import { relations, and, eq, inArray, desc, isNull, isNotNull, or } from 'drizzle-orm';
|
|
9
9
|
import { customAlphabet } from 'nanoid';
|
|
10
10
|
import { alphanumeric } from 'nanoid-dictionary';
|
|
11
|
-
import '@seedprotocol/query';
|
|
12
11
|
import { sha256 } from '@noble/hashes/sha256';
|
|
13
12
|
import { sha3_256 } from '@noble/hashes/sha3';
|
|
14
13
|
import { bytesToHex } from '@noble/hashes/utils';
|
|
@@ -243,7 +242,7 @@ class BaseFileManager {
|
|
|
243
242
|
static downloadAllFiles(params) {
|
|
244
243
|
return BaseFileManager.requireImpl().downloadAllFiles(params);
|
|
245
244
|
}
|
|
246
|
-
static downloadFileByTransactionId({ transactionId, arweaveHost, arweaveBaseUrls, excludedTransactions, expectedContentHash, compositeChildPaths, }) {
|
|
245
|
+
static downloadFileByTransactionId({ transactionId, arweaveHost, arweaveBaseUrls, excludedTransactions, expectedContentHash, compositeChildPaths, skipExisting, }) {
|
|
247
246
|
return BaseFileManager.requireImpl().downloadAllFiles({
|
|
248
247
|
transactionIds: [transactionId],
|
|
249
248
|
arweaveHost,
|
|
@@ -251,6 +250,7 @@ class BaseFileManager {
|
|
|
251
250
|
excludedTransactions,
|
|
252
251
|
expectedContentHashes: expectedContentHash ? { [transactionId]: expectedContentHash } : undefined,
|
|
253
252
|
compositeChildPaths: compositeChildPaths ? { [transactionId]: compositeChildPaths } : undefined,
|
|
253
|
+
skipExisting,
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
256
|
static resizeImage({ filePath, width, height }) {
|
|
@@ -527,19 +527,10 @@ const Property = {
|
|
|
527
527
|
/** `Html` opts are not representable in `TPropertyConstructor`; keep runtime shape via double assert. */
|
|
528
528
|
};
|
|
529
529
|
|
|
530
|
-
// Top-level re-export (not mid-file import + export): Rollup with
|
|
531
|
-
// external `@seedprotocol/arweave` otherwise emits a side-effect-only import
|
|
532
|
-
// and an unbound Object.freeze namespace when this module is dynamically imported.
|
|
533
530
|
// Define zero constants ourselves since they're not exported from eas-sdk in newer versions
|
|
534
531
|
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
535
532
|
const ZERO_BYTES = '0x';
|
|
536
533
|
const ZERO_BYTES32 = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
537
|
-
// Primary config file name for Seed Protocol SDK
|
|
538
|
-
const SEED_CONFIG_FILE = 'seed.config.ts';
|
|
539
|
-
// Fallback config file names (in order of preference)
|
|
540
|
-
const SEED_CONFIG_FALLBACKS = ['seed.schema.ts', 'schema.ts'];
|
|
541
|
-
// Legacy constant for backward compatibility
|
|
542
|
-
const SCHEMA_TS = SEED_CONFIG_FILE;
|
|
543
534
|
const INTERNAL_DATA_TYPES = {
|
|
544
535
|
Text: {
|
|
545
536
|
eas: 'string',
|
|
@@ -611,13 +602,6 @@ const INTERNAL_PROPERTY_NAMES = [
|
|
|
611
602
|
// SDK-internal: Unix timestamp when attestations were revoked; never a schema field
|
|
612
603
|
'revokedAt',
|
|
613
604
|
];
|
|
614
|
-
/** Schema definition of the Version attestation (zero resolver, revocable). */
|
|
615
|
-
const VERSION_SCHEMA_DEF = 'bytes32 version';
|
|
616
|
-
/**
|
|
617
|
-
* UID of {@link VERSION_SCHEMA_DEF}. Schema UIDs hash the definition, resolver and revocable flag,
|
|
618
|
-
* so this is the same on every chain; the schema must still be registered on each one.
|
|
619
|
-
*/
|
|
620
|
-
const VERSION_SCHEMA_UID = '0x13c0fd59d69dbce40501a41f8b37768d26dd2e2bb0cad64615334d84f7b9bdf6';
|
|
621
605
|
/** @deprecated The UID is chain-independent. Use {@link VERSION_SCHEMA_UID}. */
|
|
622
606
|
const VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA = VERSION_SCHEMA_UID;
|
|
623
607
|
const defaultAttestationData = {
|
|
@@ -637,7 +621,6 @@ var ImageSize;
|
|
|
637
621
|
ImageSize[ImageSize["EXTRA_LARGE"] = 1920] = "EXTRA_LARGE";
|
|
638
622
|
})(ImageSize || (ImageSize = {}));
|
|
639
623
|
const CLIENT_NOT_INITIALIZED = 'ClientManager is not initialized. Please call init() first.';
|
|
640
|
-
const INIT_SCRIPT_SUCCESS_MESSAGE = '[Seed Protocol] Finished running init script';
|
|
641
624
|
var SeedModels;
|
|
642
625
|
(function (SeedModels) {
|
|
643
626
|
SeedModels["Seed"] = "Seed";
|
|
@@ -1175,7 +1158,7 @@ const pendingWrites = sqliteTable('pending_writes', {
|
|
|
1175
1158
|
id: int('id').primaryKey({ autoIncrement: true }),
|
|
1176
1159
|
/** Unique per op; the drainer and `save()` refer to an op by it. */
|
|
1177
1160
|
opId: text('op_id').notNull(),
|
|
1178
|
-
/**
|
|
1161
|
+
/** Unused: nothing appends grouped ops. Kept until a migration drops it. */
|
|
1179
1162
|
groupId: text('group_id'),
|
|
1180
1163
|
seedLocalId: text('seed_local_id').notNull(),
|
|
1181
1164
|
/** Null for ops on the seed itself (`create`, `delete`). */
|
|
@@ -1184,10 +1167,11 @@ const pendingWrites = sqliteTable('pending_writes', {
|
|
|
1184
1167
|
kind: text('kind').notNull(),
|
|
1185
1168
|
/** JSON-encoded value. */
|
|
1186
1169
|
value: text('value'),
|
|
1187
|
-
/**
|
|
1170
|
+
/** Unused: a storage op's staged path is in its JSON value. Kept until a migration drops it. */
|
|
1188
1171
|
valueRef: text('value_ref'),
|
|
1189
1172
|
/** The stored metadata row the edit was made against, to detect a synced row written since. */
|
|
1190
1173
|
baseRowId: text('base_row_id'),
|
|
1174
|
+
/** Unused: the base uid is read through base_row_id. Kept until a migration drops it. */
|
|
1191
1175
|
baseUid: text('base_uid'),
|
|
1192
1176
|
createdAt: int('created_at').notNull(),
|
|
1193
1177
|
/** The tab that appended the op. */
|
|
@@ -1483,68 +1467,6 @@ function normalizeFeedItemFields(item, manifest) {
|
|
|
1483
1467
|
return out;
|
|
1484
1468
|
}
|
|
1485
1469
|
|
|
1486
|
-
class SeedEventEmitter {
|
|
1487
|
-
constructor() {
|
|
1488
|
-
this.listeners = new Map();
|
|
1489
|
-
}
|
|
1490
|
-
on(event, listener) {
|
|
1491
|
-
const set = this.listeners.get(event) ?? new Set();
|
|
1492
|
-
set.add(listener);
|
|
1493
|
-
this.listeners.set(event, set);
|
|
1494
|
-
return this;
|
|
1495
|
-
}
|
|
1496
|
-
addListener(event, listener) {
|
|
1497
|
-
return this.on(event, listener);
|
|
1498
|
-
}
|
|
1499
|
-
once(event, listener) {
|
|
1500
|
-
const wrapped = (...args) => {
|
|
1501
|
-
this.off(event, wrapped);
|
|
1502
|
-
listener(...args);
|
|
1503
|
-
};
|
|
1504
|
-
return this.on(event, wrapped);
|
|
1505
|
-
}
|
|
1506
|
-
off(event, listener) {
|
|
1507
|
-
const set = this.listeners.get(event);
|
|
1508
|
-
if (!set)
|
|
1509
|
-
return this;
|
|
1510
|
-
set.delete(listener);
|
|
1511
|
-
if (set.size === 0)
|
|
1512
|
-
this.listeners.delete(event);
|
|
1513
|
-
return this;
|
|
1514
|
-
}
|
|
1515
|
-
removeListener(event, listener) {
|
|
1516
|
-
return this.off(event, listener);
|
|
1517
|
-
}
|
|
1518
|
-
removeAllListeners(event) {
|
|
1519
|
-
if (typeof event === 'undefined') {
|
|
1520
|
-
this.listeners.clear();
|
|
1521
|
-
return this;
|
|
1522
|
-
}
|
|
1523
|
-
this.listeners.delete(event);
|
|
1524
|
-
return this;
|
|
1525
|
-
}
|
|
1526
|
-
/**
|
|
1527
|
-
* Calls every listener. A listener that throws is logged and skipped: the others still
|
|
1528
|
-
* run, and the error never reaches the SDK code that emitted the event (which may be
|
|
1529
|
-
* midway through a save).
|
|
1530
|
-
*/
|
|
1531
|
-
emit(event, ...args) {
|
|
1532
|
-
const set = this.listeners.get(event);
|
|
1533
|
-
if (!set || set.size === 0)
|
|
1534
|
-
return false;
|
|
1535
|
-
for (const listener of [...set]) {
|
|
1536
|
-
try {
|
|
1537
|
-
listener(...args);
|
|
1538
|
-
}
|
|
1539
|
-
catch (error) {
|
|
1540
|
-
console.error(`[seed] listener for "${String(event)}" threw:`, error);
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
return true;
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
const eventEmitter = new SeedEventEmitter();
|
|
1547
|
-
|
|
1548
1470
|
let refresher;
|
|
1549
1471
|
function setCachedPropertyRefresher(fn) {
|
|
1550
1472
|
refresher = fn;
|
|
@@ -2283,42 +2205,6 @@ async function moveMetadataToRenamedProperty(db, { propertyId, modelType, oldNam
|
|
|
2283
2205
|
logger$3(`[moveMetadataToRenamedProperty] moved ${moved} metadata rows ${oldName} -> ${newName}`);
|
|
2284
2206
|
return moved;
|
|
2285
2207
|
}
|
|
2286
|
-
const getObjectForRow = (row) => {
|
|
2287
|
-
const obj = {};
|
|
2288
|
-
row.columnNames.forEach((colName, index) => {
|
|
2289
|
-
const value = row.row[index];
|
|
2290
|
-
if (typeof value !== 'string') {
|
|
2291
|
-
obj[colName] = row.row[index];
|
|
2292
|
-
return;
|
|
2293
|
-
}
|
|
2294
|
-
// Try to parse the value as JSON
|
|
2295
|
-
try {
|
|
2296
|
-
obj[colName] = JSON.parse(value);
|
|
2297
|
-
}
|
|
2298
|
-
catch {
|
|
2299
|
-
// If it fails, just set the value as a string
|
|
2300
|
-
obj[colName] = value;
|
|
2301
|
-
}
|
|
2302
|
-
});
|
|
2303
|
-
return obj;
|
|
2304
|
-
};
|
|
2305
|
-
const getSqlResultObject = (queryResult) => {
|
|
2306
|
-
if (!queryResult || !queryResult.rows || queryResult.rows.length === 0) {
|
|
2307
|
-
return;
|
|
2308
|
-
}
|
|
2309
|
-
let obj;
|
|
2310
|
-
if (queryResult.rows.length === 1) {
|
|
2311
|
-
obj = getObjectForRow(queryResult.rows[0]);
|
|
2312
|
-
}
|
|
2313
|
-
if (queryResult.rows.length > 1) {
|
|
2314
|
-
obj = queryResult.rows.reduce((acc, row) => {
|
|
2315
|
-
const rowObj = getObjectForRow(row);
|
|
2316
|
-
acc.push(rowObj);
|
|
2317
|
-
return acc;
|
|
2318
|
-
}, []);
|
|
2319
|
-
}
|
|
2320
|
-
return obj;
|
|
2321
|
-
};
|
|
2322
2208
|
/**
|
|
2323
2209
|
* True when the models row is linked (model_schemas) to any schema other than schemaId.
|
|
2324
2210
|
*/
|
|
@@ -2341,7 +2227,7 @@ const isModelLinkedToAnySchema = async (db, modelId) => {
|
|
|
2341
2227
|
* Find or create a models row by schemaFileId (preferred) or name.
|
|
2342
2228
|
* Reuses an existing same-name row (especially schemaFileId=null stubs created via
|
|
2343
2229
|
* ref resolution) instead of inserting a second row — models.name is not unique,
|
|
2344
|
-
* and duplicate names break
|
|
2230
|
+
* and duplicate names break name lookups (e.g. Resource.tags → Tag).
|
|
2345
2231
|
*
|
|
2346
2232
|
* When modelFileId is given, a same-name row that already carries a *different*
|
|
2347
2233
|
* non-null schemaFileId is only adopted if no other schema is linked to it via
|
|
@@ -2491,7 +2377,7 @@ const findOrCreateModelRecord = async (db, modelName, modelFileId, schemaId) =>
|
|
|
2491
2377
|
/**
|
|
2492
2378
|
* Find or create the models row a Relation property on ownerModelId points to. Model names are only
|
|
2493
2379
|
* unique per schema, so the ref is looked up in the owner's schema(s) first; a global name lookup
|
|
2494
|
-
*
|
|
2380
|
+
* by name threw "Multiple records found" once two schemas defined the ref model.
|
|
2495
2381
|
*/
|
|
2496
2382
|
const findOrCreateRefModelRecord = async (db, refModelName, ownerModelId) => {
|
|
2497
2383
|
try {
|
|
@@ -2511,62 +2397,6 @@ const findOrCreateRefModelRecord = async (db, refModelName, ownerModelId) => {
|
|
|
2511
2397
|
.limit(1);
|
|
2512
2398
|
return findOrCreateModelRecord(db, refModelName, undefined, ownerLink?.schemaId ?? undefined);
|
|
2513
2399
|
};
|
|
2514
|
-
const createOrUpdate = async (db, table, values) => {
|
|
2515
|
-
const valueFilters = [];
|
|
2516
|
-
const propertiesToExcludeFromDb = ['ref'];
|
|
2517
|
-
const safeValues = Object.keys(values).reduce((acc, key) => {
|
|
2518
|
-
if (!propertiesToExcludeFromDb.includes(key)) {
|
|
2519
|
-
acc[key] = values[key];
|
|
2520
|
-
}
|
|
2521
|
-
return acc;
|
|
2522
|
-
}, {});
|
|
2523
|
-
for (const [key, value] of Object.entries(safeValues)) {
|
|
2524
|
-
let finalValue = value;
|
|
2525
|
-
if (key === 'TObject') {
|
|
2526
|
-
continue;
|
|
2527
|
-
}
|
|
2528
|
-
if (typeof value === 'object') {
|
|
2529
|
-
finalValue = JSON.stringify(value);
|
|
2530
|
-
}
|
|
2531
|
-
const column = table[key];
|
|
2532
|
-
if (!column) {
|
|
2533
|
-
throw new Error(`Column not found for ${key}`);
|
|
2534
|
-
}
|
|
2535
|
-
if (typeof finalValue === 'undefined') {
|
|
2536
|
-
finalValue = null;
|
|
2537
|
-
}
|
|
2538
|
-
if (finalValue === null) {
|
|
2539
|
-
valueFilters.push(isNull(table[key]));
|
|
2540
|
-
continue;
|
|
2541
|
-
}
|
|
2542
|
-
valueFilters.push(eq(table[key], finalValue));
|
|
2543
|
-
}
|
|
2544
|
-
// console.log('valueFilters:', valueFilters)
|
|
2545
|
-
// for ( const filter of valueFilters ) {
|
|
2546
|
-
// console.log('filter:', Object.keys(filter))
|
|
2547
|
-
// }
|
|
2548
|
-
// Build a query to find the record based on properties
|
|
2549
|
-
const existingRecords = await db
|
|
2550
|
-
.select()
|
|
2551
|
-
.from(table)
|
|
2552
|
-
.where(and(...valueFilters));
|
|
2553
|
-
if (existingRecords.length > 1) {
|
|
2554
|
-
throw new Error('Multiple records found');
|
|
2555
|
-
}
|
|
2556
|
-
if (existingRecords.length > 0) {
|
|
2557
|
-
// If record exists, update it
|
|
2558
|
-
await db
|
|
2559
|
-
.update(table)
|
|
2560
|
-
.set(safeValues)
|
|
2561
|
-
.where(and(...valueFilters));
|
|
2562
|
-
return existingRecords[0];
|
|
2563
|
-
}
|
|
2564
|
-
else {
|
|
2565
|
-
// If no record exists, create a new one
|
|
2566
|
-
const newRecord = await db.insert(table).values(safeValues).returning();
|
|
2567
|
-
return newRecord[0];
|
|
2568
|
-
}
|
|
2569
|
-
};
|
|
2570
2400
|
/**
|
|
2571
2401
|
* Searches the database for an existing schema by schemaFileId (preferred) or name and creates it if it doesn't exist
|
|
2572
2402
|
* @param schema - The schema to add to the database
|
|
@@ -2942,102 +2772,6 @@ const renameModelInDb = async (oldName, newName, schemaNameOrId) => {
|
|
|
2942
2772
|
.where(eq(models.id, modelToRename.id));
|
|
2943
2773
|
return { ...modelToRename, name: newName };
|
|
2944
2774
|
};
|
|
2945
|
-
/**
|
|
2946
|
-
* Check if a property has been locally edited (has unsaved changes)
|
|
2947
|
-
* This checks both the in-memory cache (for current session) and the database
|
|
2948
|
-
* (for persistence across reloads) by comparing database values with schema file values.
|
|
2949
|
-
* @param modelName - The name of the model
|
|
2950
|
-
* @param propertyName - The name of the property
|
|
2951
|
-
* @param schemaFileValue - Optional schema file value to compare against database
|
|
2952
|
-
* @returns true if the property is marked as edited, false otherwise
|
|
2953
|
-
*/
|
|
2954
|
-
async function checkIfPropertyIsEdited(modelName, propertyName, schemaFileValue,
|
|
2955
|
-
/** The property's models row (model names are only unique per schema). */
|
|
2956
|
-
modelId) {
|
|
2957
|
-
try {
|
|
2958
|
-
// When schemaFileValue is provided (schema sync path), do database check FIRST.
|
|
2959
|
-
// This avoids the ModelProperty dynamic import which can hang due to circular
|
|
2960
|
-
// dependency (ModelProperty -> helpers/db) when called from addModelsToDb during init.
|
|
2961
|
-
if (schemaFileValue) {
|
|
2962
|
-
const db = BaseDb.getAppDb();
|
|
2963
|
-
if (db) {
|
|
2964
|
-
// Find the model
|
|
2965
|
-
const resolvedModel = await resolveModelRecord(modelName, { modelId }, db);
|
|
2966
|
-
const modelRecords = resolvedModel ? [resolvedModel] : [];
|
|
2967
|
-
if (modelRecords.length > 0) {
|
|
2968
|
-
const modelRecord = modelRecords[0];
|
|
2969
|
-
// Find the property in the database
|
|
2970
|
-
const propertyRecords = await db
|
|
2971
|
-
.select()
|
|
2972
|
-
.from(properties)
|
|
2973
|
-
.where(and(eq(properties.name, propertyName), eq(properties.modelId, modelRecord.id)))
|
|
2974
|
-
.limit(1);
|
|
2975
|
-
if (propertyRecords.length > 0) {
|
|
2976
|
-
const dbProperty = propertyRecords[0];
|
|
2977
|
-
// Compare database value with schema file value
|
|
2978
|
-
// If they differ, the property has been edited
|
|
2979
|
-
if (dbProperty.dataType !== schemaFileValue.dataType) {
|
|
2980
|
-
logger$3(`Property ${modelName}:${propertyName} has been edited (dataType differs: DB=${dbProperty.dataType}, Schema=${schemaFileValue.dataType})`);
|
|
2981
|
-
return true;
|
|
2982
|
-
}
|
|
2983
|
-
// Check refModelId if it's a relation
|
|
2984
|
-
if (schemaFileValue.ref) {
|
|
2985
|
-
const refModelRecord = await resolveRefModelRecord(schemaFileValue.ref, { modelId: modelRecord.id }, db);
|
|
2986
|
-
if (refModelRecord) {
|
|
2987
|
-
const expectedRefModelId = refModelRecord.id;
|
|
2988
|
-
if (dbProperty.refModelId !== expectedRefModelId) {
|
|
2989
|
-
logger$3(`Property ${modelName}:${propertyName} has been edited (refModelId differs)`);
|
|
2990
|
-
return true;
|
|
2991
|
-
}
|
|
2992
|
-
}
|
|
2993
|
-
}
|
|
2994
|
-
else if (dbProperty.refModelId !== null) {
|
|
2995
|
-
// Schema file has no ref, but DB has one
|
|
2996
|
-
logger$3(`Property ${modelName}:${propertyName} has been edited (refModelId differs)`);
|
|
2997
|
-
return true;
|
|
2998
|
-
}
|
|
2999
|
-
// Check refValueType
|
|
3000
|
-
if (dbProperty.refValueType !== (schemaFileValue.refValueType || null)) {
|
|
3001
|
-
logger$3(`Property ${modelName}:${propertyName} has been edited (refValueType differs)`);
|
|
3002
|
-
return true;
|
|
3003
|
-
}
|
|
3004
|
-
// Check required (for Relation/Image properties)
|
|
3005
|
-
if (schemaFileValue.required !== undefined) {
|
|
3006
|
-
const schemaRequired = !!schemaFileValue.required;
|
|
3007
|
-
const dbRequired = dbProperty.required === true;
|
|
3008
|
-
if (dbRequired !== schemaRequired) {
|
|
3009
|
-
logger$3(`Property ${modelName}:${propertyName} has been edited (required differs: DB=${dbRequired}, Schema=${schemaRequired})`);
|
|
3010
|
-
return true;
|
|
3011
|
-
}
|
|
3012
|
-
}
|
|
3013
|
-
// Storage settings. Rows written before they were stored (all null) aren't edits: the
|
|
3014
|
-
// schema file's values fill them in on this load.
|
|
3015
|
-
const dbStorage = {
|
|
3016
|
-
storageType: dbProperty.storageType ?? null,
|
|
3017
|
-
localStorageDir: dbProperty.localStorageDir ?? null,
|
|
3018
|
-
filenameSuffix: dbProperty.filenameSuffix ?? null,
|
|
3019
|
-
};
|
|
3020
|
-
if (hasStorageSettings(dbStorage)) {
|
|
3021
|
-
const fileStorage = propertyStorageColumns(schemaFileValue);
|
|
3022
|
-
if (dbStorage.storageType !== fileStorage.storageType ||
|
|
3023
|
-
dbStorage.localStorageDir !== fileStorage.localStorageDir ||
|
|
3024
|
-
dbStorage.filenameSuffix !== fileStorage.filenameSuffix) {
|
|
3025
|
-
logger$3(`Property ${modelName}:${propertyName} has been edited (storage settings differ)`);
|
|
3026
|
-
return true;
|
|
3027
|
-
}
|
|
3028
|
-
}
|
|
3029
|
-
}
|
|
3030
|
-
}
|
|
3031
|
-
}
|
|
3032
|
-
}
|
|
3033
|
-
return false;
|
|
3034
|
-
}
|
|
3035
|
-
catch (error) {
|
|
3036
|
-
// If we can't check, assume it's not edited to be safe
|
|
3037
|
-
logger$3('Error checking if property is edited:', error);
|
|
3038
|
-
return false;
|
|
3039
|
-
}
|
|
3040
|
-
}
|
|
3041
2775
|
/**
|
|
3042
2776
|
* Adds models and their properties to the database.
|
|
3043
2777
|
* Optionally connects models to a schema via join records.
|
|
@@ -3209,19 +2943,8 @@ const addModelsToDb = async (models$1, schema, modelRenames, schemaFileData) =>
|
|
|
3209
2943
|
if (existingProperty) {
|
|
3210
2944
|
// Mark this DB property as matched
|
|
3211
2945
|
matchedDbPropertyIds.add(existingProperty.id);
|
|
3212
|
-
//
|
|
3213
|
-
|
|
3214
|
-
// Use DB isEdited column as a fast check: if already marked edited, preserve.
|
|
3215
|
-
const skipEditCheck = !!schemaFileData;
|
|
3216
|
-
const isPropertyEdited = skipEditCheck
|
|
3217
|
-
? existingProperty.isEdited === true
|
|
3218
|
-
: await checkIfPropertyIsEdited(modelName, existingProperty.name, {
|
|
3219
|
-
dataType: propertyValues.dataType,
|
|
3220
|
-
ref: propertyValues.ref,
|
|
3221
|
-
refValueType: propertyValues.refValueType,
|
|
3222
|
-
required: propertyValues.required,
|
|
3223
|
-
...propertyStorageColumns(propertyValues),
|
|
3224
|
-
}, modelRecord.id);
|
|
2946
|
+
// A property edited locally keeps its row.
|
|
2947
|
+
const isPropertyEdited = existingProperty.isEdited === true;
|
|
3225
2948
|
if (isPropertyEdited) {
|
|
3226
2949
|
// Property has been locally edited - skip update to preserve local changes
|
|
3227
2950
|
logger$3(`Skipping update for property ${modelName}:${existingProperty.name} -> ${propertyName} - it has been locally edited and will be preserved`);
|
|
@@ -3765,21 +3488,6 @@ async function getAddressConfigFromDb() {
|
|
|
3765
3488
|
const addressArrayString = appStatesRecords[0].value;
|
|
3766
3489
|
return parseAddressConfig(addressArrayString);
|
|
3767
3490
|
}
|
|
3768
|
-
const getAddressesFromDb = async () => {
|
|
3769
|
-
const config = await getAddressConfigFromDb();
|
|
3770
|
-
if (!config || config.owned.length === 0) {
|
|
3771
|
-
throw new Error('No addresses found');
|
|
3772
|
-
}
|
|
3773
|
-
return config.owned;
|
|
3774
|
-
};
|
|
3775
|
-
/**
|
|
3776
|
-
* Like getAddressesFromDb but returns [] instead of throwing when no addresses are configured.
|
|
3777
|
-
* Returns owned addresses. Use getAllAddressesFromDb for sync (owned + watched).
|
|
3778
|
-
*/
|
|
3779
|
-
const getAddressesFromDbOptional = async () => {
|
|
3780
|
-
const config = await getAddressConfigFromDb();
|
|
3781
|
-
return config?.owned ?? [];
|
|
3782
|
-
};
|
|
3783
3491
|
/**
|
|
3784
3492
|
* Write model to database and create model_schemas join entry
|
|
3785
3493
|
* @param modelFileId - The model file ID (schema_file_id)
|
|
@@ -3963,9 +3671,10 @@ async function writeModelToDb(modelFileId, data) {
|
|
|
3963
3671
|
* Write property to database
|
|
3964
3672
|
* @param propertyFileId - The property file ID (schema_file_id)
|
|
3965
3673
|
* @param data - Property data including modelId, name, dataType, and other property fields
|
|
3966
|
-
* @param isEdited - Optional flag indicating if property has been edited locally
|
|
3674
|
+
* @param isEdited - Optional flag indicating if property has been edited locally. Left unset, an update
|
|
3675
|
+
* keeps the row's flag (a load or creation write must not clear an unsaved edit) and an insert stores false.
|
|
3967
3676
|
*/
|
|
3968
|
-
async function writePropertyToDb(propertyFileId, data, isEdited
|
|
3677
|
+
async function writePropertyToDb(propertyFileId, data, isEdited) {
|
|
3969
3678
|
const db = BaseDb.getAppDb();
|
|
3970
3679
|
if (!db)
|
|
3971
3680
|
throw new Error('Database not available');
|
|
@@ -3989,7 +3698,7 @@ async function writePropertyToDb(propertyFileId, data, isEdited = false) {
|
|
|
3989
3698
|
modelId: data.modelId,
|
|
3990
3699
|
dataType: normalizeDataType(data.dataType),
|
|
3991
3700
|
schemaFileId: propertyFileId,
|
|
3992
|
-
isEdited
|
|
3701
|
+
...(isEdited !== undefined && { isEdited }),
|
|
3993
3702
|
};
|
|
3994
3703
|
// Handle ref property - create ref model if needed
|
|
3995
3704
|
// Check refModelName first, then ref (for backwards compatibility with schema files)
|
|
@@ -4055,7 +3764,7 @@ async function writePropertyToDb(propertyFileId, data, isEdited = false) {
|
|
|
4055
3764
|
// insert is logged by sqlite-wasm even when caught.
|
|
4056
3765
|
const inserted = await db
|
|
4057
3766
|
.insert(properties)
|
|
4058
|
-
.values({ required: false, ...propertyData })
|
|
3767
|
+
.values({ required: false, isEdited: false, ...propertyData })
|
|
4059
3768
|
.onConflictDoNothing()
|
|
4060
3769
|
.returning({ id: properties.id });
|
|
4061
3770
|
if (inserted.length > 0) {
|
|
@@ -4079,68 +3788,6 @@ async function writePropertyToDb(propertyFileId, data, isEdited = false) {
|
|
|
4079
3788
|
}
|
|
4080
3789
|
}
|
|
4081
3790
|
}
|
|
4082
|
-
/**
|
|
4083
|
-
* Get schema database ID from schema name or schemaFileId
|
|
4084
|
-
* @param schemaNameOrFileId - Schema name (string) or schemaFileId (string)
|
|
4085
|
-
* @returns Schema database ID
|
|
4086
|
-
* @throws Error if schema not found
|
|
4087
|
-
*/
|
|
4088
|
-
async function getSchemaId(schemaNameOrFileId) {
|
|
4089
|
-
const db = BaseDb.getAppDb();
|
|
4090
|
-
if (!db) {
|
|
4091
|
-
throw new Error('Database not available');
|
|
4092
|
-
}
|
|
4093
|
-
const schemaSchemaMod = await Promise.resolve().then(function () { return SchemaSchema; });
|
|
4094
|
-
const { schemas: schemasTable } = schemaSchemaMod;
|
|
4095
|
-
const drizzleMod = await import('drizzle-orm');
|
|
4096
|
-
const { eq, desc } = drizzleMod;
|
|
4097
|
-
// Try to find by schemaFileId first (more reliable)
|
|
4098
|
-
let records = await db
|
|
4099
|
-
.select()
|
|
4100
|
-
.from(schemasTable)
|
|
4101
|
-
.where(eq(schemasTable.schemaFileId, schemaNameOrFileId))
|
|
4102
|
-
.orderBy(desc(schemasTable.version))
|
|
4103
|
-
.limit(1);
|
|
4104
|
-
// If not found by schemaFileId, try by name
|
|
4105
|
-
if (records.length === 0) {
|
|
4106
|
-
records = await db
|
|
4107
|
-
.select()
|
|
4108
|
-
.from(schemasTable)
|
|
4109
|
-
.where(eq(schemasTable.name, schemaNameOrFileId))
|
|
4110
|
-
.orderBy(desc(schemasTable.version))
|
|
4111
|
-
.limit(1);
|
|
4112
|
-
}
|
|
4113
|
-
if (records.length === 0) {
|
|
4114
|
-
throw new Error(`Schema "${schemaNameOrFileId}" not found in database`);
|
|
4115
|
-
}
|
|
4116
|
-
return records[0].id;
|
|
4117
|
-
}
|
|
4118
|
-
/**
|
|
4119
|
-
* Get schema database ID from schemaFileId
|
|
4120
|
-
* @param schemaFileId - The schema file ID
|
|
4121
|
-
* @returns Schema database ID
|
|
4122
|
-
* @throws Error if schema not found
|
|
4123
|
-
*/
|
|
4124
|
-
async function getSchemaIdByFileId(schemaFileId) {
|
|
4125
|
-
const db = BaseDb.getAppDb();
|
|
4126
|
-
if (!db) {
|
|
4127
|
-
throw new Error('Database not available');
|
|
4128
|
-
}
|
|
4129
|
-
const schemaSchemaMod = await Promise.resolve().then(function () { return SchemaSchema; });
|
|
4130
|
-
const { schemas: schemasTable } = schemaSchemaMod;
|
|
4131
|
-
const drizzleMod = await import('drizzle-orm');
|
|
4132
|
-
const { eq, desc } = drizzleMod;
|
|
4133
|
-
const records = await db
|
|
4134
|
-
.select()
|
|
4135
|
-
.from(schemasTable)
|
|
4136
|
-
.where(eq(schemasTable.schemaFileId, schemaFileId))
|
|
4137
|
-
.orderBy(desc(schemasTable.version))
|
|
4138
|
-
.limit(1);
|
|
4139
|
-
if (records.length === 0) {
|
|
4140
|
-
throw new Error(`Schema with file ID "${schemaFileId}" not found in database`);
|
|
4141
|
-
}
|
|
4142
|
-
return records[0].id;
|
|
4143
|
-
}
|
|
4144
3791
|
/**
|
|
4145
3792
|
* Get model database ID from model name or modelFileId
|
|
4146
3793
|
* @param modelNameOrFileId - Model name (string) or modelFileId (string)
|
|
@@ -4233,23 +3880,16 @@ var db = /*#__PURE__*/Object.freeze({
|
|
|
4233
3880
|
__proto__: null,
|
|
4234
3881
|
addModelsToDb: addModelsToDb,
|
|
4235
3882
|
addSchemaToDb: addSchemaToDb,
|
|
4236
|
-
createOrUpdate: createOrUpdate,
|
|
4237
3883
|
getAddressesForItemsFilter: getAddressesForItemsFilter,
|
|
4238
|
-
getAddressesFromDb: getAddressesFromDb,
|
|
4239
|
-
getAddressesFromDbOptional: getAddressesFromDbOptional,
|
|
4240
3884
|
getAllAddressesFromDb: getAllAddressesFromDb,
|
|
4241
3885
|
getItemStoragePropertiesForModel: getItemStoragePropertiesForModel,
|
|
4242
3886
|
getModelId: getModelId,
|
|
4243
3887
|
getModelIdByFileId: getModelIdByFileId,
|
|
4244
3888
|
getModelNameByModelId: getModelNameByModelId,
|
|
4245
|
-
getObjectForRow: getObjectForRow,
|
|
4246
3889
|
getOwnedAddressesFromDb: getOwnedAddressesFromDb,
|
|
4247
3890
|
getPropertyIdForModelAndName: getPropertyIdForModelAndName,
|
|
4248
3891
|
getPropertyIdForSchemaFileId: getPropertyIdForSchemaFileId,
|
|
4249
3892
|
getPropertyModelNameAndDataType: getPropertyModelNameAndDataType,
|
|
4250
|
-
getSchemaId: getSchemaId,
|
|
4251
|
-
getSchemaIdByFileId: getSchemaIdByFileId,
|
|
4252
|
-
getSqlResultObject: getSqlResultObject,
|
|
4253
3893
|
getWatchedAddressesFromDb: getWatchedAddressesFromDb,
|
|
4254
3894
|
loadModelsFromDbForSchema: loadModelsFromDbForSchema,
|
|
4255
3895
|
mergeDbModelsIntoSchemaModels: mergeDbModelsIntoSchemaModels,
|
|
@@ -4262,42 +3902,6 @@ var db = /*#__PURE__*/Object.freeze({
|
|
|
4262
3902
|
writePropertyToDb: writePropertyToDb
|
|
4263
3903
|
});
|
|
4264
3904
|
|
|
4265
|
-
const getMetadata = async (props) => {
|
|
4266
|
-
const appDb = BaseDb.getAppDb();
|
|
4267
|
-
let storageTransactionId;
|
|
4268
|
-
if (props) {
|
|
4269
|
-
storageTransactionId = props.storageTransactionId;
|
|
4270
|
-
}
|
|
4271
|
-
const whereClauses = [];
|
|
4272
|
-
if (storageTransactionId) {
|
|
4273
|
-
whereClauses.push(eq(metadata.propertyName, 'storageTransactionId'));
|
|
4274
|
-
whereClauses.push(eq(metadata.propertyValue, storageTransactionId));
|
|
4275
|
-
}
|
|
4276
|
-
const metadataRows = await appDb
|
|
4277
|
-
.select()
|
|
4278
|
-
.from(metadata)
|
|
4279
|
-
.where(and(...whereClauses));
|
|
4280
|
-
if (!metadataRows || metadataRows.length === 0) {
|
|
4281
|
-
return;
|
|
4282
|
-
}
|
|
4283
|
-
return metadataRows[0];
|
|
4284
|
-
};
|
|
4285
|
-
|
|
4286
|
-
const saveMetadata = async (metadataRecord, metadataValues) => {
|
|
4287
|
-
if (!metadataRecord.localId) {
|
|
4288
|
-
return;
|
|
4289
|
-
}
|
|
4290
|
-
const appDb = BaseDb.getAppDb();
|
|
4291
|
-
await appDb
|
|
4292
|
-
.update(metadata)
|
|
4293
|
-
.set({
|
|
4294
|
-
...metadataValues,
|
|
4295
|
-
// Stamped here: a value carried in metadataValues would otherwise win over $onUpdate.
|
|
4296
|
-
updatedAt: Date.now(),
|
|
4297
|
-
})
|
|
4298
|
-
.where(eq(metadata.localId, metadataRecord.localId));
|
|
4299
|
-
};
|
|
4300
|
-
|
|
4301
3905
|
const isNode = () => {
|
|
4302
3906
|
return (typeof process !== 'undefined' &&
|
|
4303
3907
|
process.versions != null &&
|
|
@@ -4350,8 +3954,7 @@ const isTestOrSeedDev = () => process.env.NODE_ENV === 'test' || (typeof process
|
|
|
4350
3954
|
* Tag every Seed upload carries with the hex digest of its data. Producers: the SDK's
|
|
4351
3955
|
* `getPublishUploadData` / `getPublishUploads` (and through them both the L1 transaction path and
|
|
4352
3956
|
* the bundler / DataItem path in `@seedprotocol/publish`). Consumer: the files download
|
|
4353
|
-
* (`events/files/download.ts` and the download worker), which verifies downloaded bytes against it
|
|
4354
|
-
* and copies a verified value into `metadata.content_hash`.
|
|
3957
|
+
* (`events/files/download.ts` and the download worker), which verifies downloaded bytes against it.
|
|
4355
3958
|
*/
|
|
4356
3959
|
const CONTENT_SHA256_TAG = 'Content-SHA-256';
|
|
4357
3960
|
const CONTENT_TYPE_TAG = 'Content-Type';
|
|
@@ -4470,18 +4073,11 @@ const AUTO_BULK_DOWNLOAD_THROTTLE_MS = 10000;
|
|
|
4470
4073
|
const GET_FILES_METADATA_STALE_MS = 120000;
|
|
4471
4074
|
let bulkDownloadInFlight = null;
|
|
4472
4075
|
const lazyDownloadInFlightByTransactionId = new Map();
|
|
4473
|
-
// syncDbFiles helper - internal service removed, functionality moved here
|
|
4474
|
-
const syncDbFiles = async (_endpoints) => {
|
|
4475
|
-
// TODO: Implement syncDbFiles functionality if needed
|
|
4476
|
-
// This was previously in @/services/internal/helpers
|
|
4477
|
-
logger$2('[download] syncDbFiles called but not yet implemented');
|
|
4478
|
-
return Promise.resolve();
|
|
4479
|
-
};
|
|
4480
4076
|
const getAppDbReady = async () => {
|
|
4481
4077
|
if (!BaseDb.isAppDbReady()) {
|
|
4482
4078
|
// Wait for ClientManager to be ready (DB_INIT state or later)
|
|
4483
|
-
const _mod_0 = await import('./ClientManager-
|
|
4484
|
-
const _ns_0 = _mod_0
|
|
4079
|
+
const _mod_0 = await import('./ClientManager-GZfXErDX.js');
|
|
4080
|
+
const _ns_0 = _mod_0.W;
|
|
4485
4081
|
const clientManagerMod = _ns_0;
|
|
4486
4082
|
const { getClient } = clientManagerMod;
|
|
4487
4083
|
const clientManager = getClient();
|
|
@@ -4651,23 +4247,6 @@ const getExpectedContentHashes = async (transactionIds) => {
|
|
|
4651
4247
|
}
|
|
4652
4248
|
return out;
|
|
4653
4249
|
};
|
|
4654
|
-
/** Store the (now verified) Content-SHA-256 of each downloaded transaction on its metadata row. */
|
|
4655
|
-
const recordVerifiedContentHashes = async (transactionIds, expectedContentHashes) => {
|
|
4656
|
-
for (const transactionId of transactionIds) {
|
|
4657
|
-
const contentHash = expectedContentHashes[transactionId];
|
|
4658
|
-
if (!contentHash)
|
|
4659
|
-
continue;
|
|
4660
|
-
try {
|
|
4661
|
-
const metadataRecord = await getMetadata({ storageTransactionId: transactionId });
|
|
4662
|
-
if (metadataRecord) {
|
|
4663
|
-
await saveMetadata(metadataRecord, { contentHash });
|
|
4664
|
-
}
|
|
4665
|
-
}
|
|
4666
|
-
catch (error) {
|
|
4667
|
-
logger$2(error);
|
|
4668
|
-
}
|
|
4669
|
-
}
|
|
4670
|
-
};
|
|
4671
4250
|
const downloadTransactionIds = async (rawTransactionIds, options) => {
|
|
4672
4251
|
if (!supportsOpfsFileDownloads()) {
|
|
4673
4252
|
return false;
|
|
@@ -4704,6 +4283,7 @@ const downloadTransactionIds = async (rawTransactionIds, options) => {
|
|
|
4704
4283
|
excludedTransactions,
|
|
4705
4284
|
expectedContentHash: expectedContentHashes[transactionId],
|
|
4706
4285
|
compositeChildPaths: compositeChildPaths[transactionId],
|
|
4286
|
+
skipExisting: options?.skipExisting,
|
|
4707
4287
|
});
|
|
4708
4288
|
}
|
|
4709
4289
|
else {
|
|
@@ -4714,6 +4294,7 @@ const downloadTransactionIds = async (rawTransactionIds, options) => {
|
|
|
4714
4294
|
excludedTransactions,
|
|
4715
4295
|
expectedContentHashes,
|
|
4716
4296
|
compositeChildPaths,
|
|
4297
|
+
skipExisting: options?.skipExisting,
|
|
4717
4298
|
});
|
|
4718
4299
|
}
|
|
4719
4300
|
if (result) {
|
|
@@ -4721,13 +4302,6 @@ const downloadTransactionIds = async (rawTransactionIds, options) => {
|
|
|
4721
4302
|
// Not saved by the worker; left for a later run (a gateway may serve the right bytes then).
|
|
4722
4303
|
logger$2(`[download] ${transactionId}: downloaded bytes do not match Content-SHA-256; skipped`);
|
|
4723
4304
|
}
|
|
4724
|
-
await recordVerifiedContentHashes(result.verifiedTransactionIds, expectedContentHashes);
|
|
4725
|
-
}
|
|
4726
|
-
if (options?.resizeAllImages !== false) {
|
|
4727
|
-
await BaseFileManager.resizeAllImages({
|
|
4728
|
-
width: 480,
|
|
4729
|
-
height: 480,
|
|
4730
|
-
});
|
|
4731
4305
|
}
|
|
4732
4306
|
return true;
|
|
4733
4307
|
};
|
|
@@ -4737,7 +4311,7 @@ const runBulkDownloadWithDedupe = async (transactionIds) => {
|
|
|
4737
4311
|
}
|
|
4738
4312
|
bulkDownloadInFlight = (async () => {
|
|
4739
4313
|
try {
|
|
4740
|
-
await downloadTransactionIds(transactionIds, {
|
|
4314
|
+
await downloadTransactionIds(transactionIds, { skipExisting: true });
|
|
4741
4315
|
}
|
|
4742
4316
|
finally {
|
|
4743
4317
|
bulkDownloadInFlight = null;
|
|
@@ -4745,21 +4319,10 @@ const runBulkDownloadWithDedupe = async (transactionIds) => {
|
|
|
4745
4319
|
})();
|
|
4746
4320
|
return bulkDownloadInFlight;
|
|
4747
4321
|
};
|
|
4748
|
-
const
|
|
4749
|
-
if (!supportsOpfsFileDownloads()) {
|
|
4750
|
-
return;
|
|
4751
|
-
}
|
|
4752
|
-
await syncDbFiles();
|
|
4753
|
-
eventEmitter.emit('fs.downloadAll.success', { eventId });
|
|
4754
|
-
eventEmitter.emit('fs.downloadAllBinary.request', { endpoints });
|
|
4755
|
-
};
|
|
4756
|
-
const downloadAllFilesBinaryRequestHandler = async (addressesHintOrPayload) => {
|
|
4322
|
+
const downloadAllFilesBinaryRequestHandler = async (addressesHint) => {
|
|
4757
4323
|
if (!supportsOpfsFileDownloads()) {
|
|
4758
4324
|
return;
|
|
4759
4325
|
}
|
|
4760
|
-
const addressesHint = Array.isArray(addressesHintOrPayload)
|
|
4761
|
-
? addressesHintOrPayload
|
|
4762
|
-
: undefined;
|
|
4763
4326
|
let fromDb = [];
|
|
4764
4327
|
if (BaseDb.isAppDbReady()) {
|
|
4765
4328
|
fromDb = await getAllAddressesFromDb();
|
|
@@ -4829,7 +4392,9 @@ const downloadTransactionIdWithDedupe = async (transactionId) => {
|
|
|
4829
4392
|
}
|
|
4830
4393
|
const inFlight = (async () => {
|
|
4831
4394
|
try {
|
|
4832
|
-
|
|
4395
|
+
// No skipExisting: the caller found no local file, so a file on disk it could not see is
|
|
4396
|
+
// written again and announced.
|
|
4397
|
+
const ok = await downloadTransactionIds([normalizedTxId]);
|
|
4833
4398
|
return ok;
|
|
4834
4399
|
}
|
|
4835
4400
|
finally {
|
|
@@ -4854,7 +4419,6 @@ const scheduleBulkFilesDownloadFromEasSync = (addressesHint) => {
|
|
|
4854
4419
|
var download = /*#__PURE__*/Object.freeze({
|
|
4855
4420
|
__proto__: null,
|
|
4856
4421
|
downloadAllFilesBinaryRequestHandler: downloadAllFilesBinaryRequestHandler,
|
|
4857
|
-
downloadAllFilesRequestHandler: downloadAllFilesRequestHandler,
|
|
4858
4422
|
downloadTransactionIdWithDedupe: downloadTransactionIdWithDedupe,
|
|
4859
4423
|
scheduleBulkFilesDownloadFromEasSync: scheduleBulkFilesDownloadFromEasSync
|
|
4860
4424
|
});
|
|
@@ -5177,5 +4741,5 @@ const getArweaveUrlForTransaction = (storageTransactionId) => {
|
|
|
5177
4741
|
return BaseArweaveClient.getRawUrl(storageTransactionId);
|
|
5178
4742
|
};
|
|
5179
4743
|
|
|
5180
|
-
export {
|
|
5181
|
-
//# sourceMappingURL=index-
|
|
4744
|
+
export { isNode as $, AmbiguousModelError as A, modelsRelations as B, pendingWrites as C, DEFAULT_TEXT_MAX_LENGTH as D, properties as E, propertiesRelations as F, propertyUidRelations as G, propertyUids as H, publishProcesses as I, schemas as J, uploadProcesses as K, BaseDb as L, ModelPropertyDataTypes as M, resolveStorageNameToSchemaName as N, nameMatchLevels as O, Property as P, BaseFileManager as Q, resolveModelRecord as R, getPropertyIdForModelAndName as S, THtmlEmbeddedDataUriPolicy as T, resolveItemModelFileId as U, INTERNAL_STORAGE_MODEL_FILE_IDS as V, getStorageDirForDataType as W, getContentSha256 as X, buildArweaveContentTags as Y, getItemStorageSubdir as Z, getItemStorageLocalFileName as _, TProperty as a, convertTxIdToImage as a$, ZERO_BYTES32 as a0, getItemModelScope as a1, INTERNAL_PROPERTY_NAMES as a2, isStorageSeedRef as a3, defaultAttestationData as a4, INTERNAL_DATA_TYPES as a5, listRelationEasPropertyName as a6, easPropertyNameForPublish as a7, normalizePublisher as a8, getAllAddressesFromDb as a9, normalizeAddressConfig as aA, normalizeAddressList as aB, normalizeArweaveTxIdForEnsure as aC, normalizeFeedItemFields as aD, resolveMediaRef as aE, isInternalSchema as aF, writeModelToDb as aG, writePropertyToDb as aH, renameModelInDb as aI, currentNameMatchLevels as aJ, withSqliteBusyRetry as aK, loadModelsFromDbForSchema as aL, mergeDbModelsIntoSchemaModels as aM, addSchemaToDb as aN, addModelsToDb as aO, clearNameMatchLevels as aP, isTestOrSeedDev as aQ, warnOnInvalidNameMatch as aR, INTERNAL_SCHEMA_IDS as aS, linkModelToSchema as aT, getMetadataPropertyNamesForQuery as aU, getWatchedAddressesFromDb as aV, getOwnedAddressesFromDb as aW, CLIENT_NOT_INITIALIZED as aX, toSchemaPropertyName as aY, easSchemaDefinitionForProperty as aZ, getStorageTransactionIdForSeedUid as a_, loadNameMatchLevels as aa, scheduleBulkFilesDownloadFromEasSync as ab, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as ac, generateId as ad, normalizeHexAddress as ae, toMetadataPropertyName as af, getItemStoragePropertiesForModel as ag, getModelIdByFileId as ah, getModelId as ai, setCachedPropertyRefresher as aj, isSqliteBusyError as ak, SQLITE_BUSY_RETRY_DELAYS_MS as al, isBrowser as am, CONTENT_SHA256_TAG as an, CONTENT_TYPE_TAG as ao, ImageSize as ap, SEED_PROTOCOL_SCHEMA_NAME as aq, SeedModels as ar, VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA as as, classifyMediaRef as at, closestImageSize as au, contentSha256TagMatches as av, ensureImageLocal as aw, getAddressesForItemsFilter as ax, getArweaveUrlForTransaction as ay, getFeedItemStringField as az, TPropertyConstructor as b, getPropertyIdForSchemaFileId as b0, downloadTransactionIdWithDedupe as b1, resolveMetadataRecord as b2, getDataTypeFromString as b3, getMimeType as b4, listRelationStoragePropertyName as b5, PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP as b6, toItemPropertyKey as b7, getAlternatePropertyNameForInstanceLookup as b8, BaseDb$1 as b9, ModelSchema as ba, BaseFileManager$1 as bb, SchemaSchema as bc, ModelSchemaSchema as bd, resolveModelRecord$1 as be, db as bf, download as bg, generateId$1 as bh, TPropertyDataType as c, TPropertyDefs as d, TStorageType as e, TValidationRules as f, normalizePropertyRecordSchema as g, appState as h, isDataType as i, config as j, getCorrectId as k, isPublishedSeedRef as l, metadata as m, normalizeDataType as n, modelUids as o, models as p, normalizeRelationPropertyValue as q, resolveSeedIdsFromRefString as r, seeds as s, arweaveL1FinalizeJobs as t, easSyncProcesses as u, versions as v, entityChanges as w, htmlEmbeddedImageCoPublish as x, modelRelations as y, modelSchemas as z };
|
|
4745
|
+
//# sourceMappingURL=index-Dx_GTdyQ.js.map
|