@seedprotocol/sdk 0.7.9-next.1110.g7eb9e57 → 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,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { u as timingNow, v as timingSince, x as timingLogger, y as TAB_ID, o as onTabMessage, c as whenLeaderTab, a as isLeaderTab, k as postTabMessage, f as createSessionObjectUrl, t as timingMarks, z as timed, r as notifyFileSaved, B as revokeSessionObjectUrl, b as watchEntityRows, C as queryEntityRows, D as isSessionObjectUrl, E as timedDb } from './changeFeed-DKdVlUmt.js';
|
|
2
2
|
import { waitFor, fromCallback, setup, assign, stateIn, createActor, isMachineSnapshot } from 'xstate';
|
|
3
|
-
import {
|
|
4
|
-
import { or, isNull, eq, max, count, and, getTableColumns,
|
|
3
|
+
import { L as BaseDb, v as versions, m as metadata, s as seeds, N as resolveStorageNameToSchemaName, aY as toSchemaPropertyName, i as isDataType, ad as generateId, C as pendingWrites, ak as isSqliteBusyError, J as schemas, p as models, z as modelSchemas, aW as getOwnedAddressesFromDb, a0 as ZERO_BYTES32, aB as normalizeAddressList, ae as normalizeHexAddress, ax as getAddressesForItemsFilter, a2 as INTERNAL_PROPERTY_NAMES, aZ as easSchemaDefinitionForProperty, Q as BaseFileManager, a_ as getStorageTransactionIdForSeedUid, a$ as convertTxIdToImage, a8 as normalizePublisher, a6 as listRelationEasPropertyName, n as normalizeDataType, U as resolveItemModelFileId, b0 as getPropertyIdForSchemaFileId, S as getPropertyIdForModelAndName, aU as getMetadataPropertyNamesForQuery, aw as ensureImageLocal, ap as ImageSize, b1 as downloadTransactionIdWithDedupe, b2 as resolveMetadataRecord, M as ModelPropertyDataTypes, o as modelUids, af as toMetadataPropertyName, b3 as getDataTypeFromString, b4 as getMimeType, V as INTERNAL_STORAGE_MODEL_FILE_IDS, g as normalizePropertyRecordSchema, b5 as listRelationStoragePropertyName, b6 as PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP, k as getCorrectId, Z as getItemStorageSubdir, _ as getItemStorageLocalFileName, b7 as toItemPropertyKey, b8 as getAlternatePropertyNameForInstanceLookup, E as properties, a3 as isStorageSeedRef } from './index-Dx_GTdyQ.js';
|
|
4
|
+
import { or, isNull, eq, sql, max, count, and, getTableColumns, asc, inArray, lt, isNotNull, desc, gt } from 'drizzle-orm';
|
|
5
5
|
import pluralize from 'pluralize';
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
import { BehaviorSubject } from 'rxjs';
|
|
8
8
|
import { startCase, upperFirst, camelCase, orderBy } from 'lodash-es';
|
|
9
9
|
import { isValidEasAttestationUid, easName, isPlaceholderUid, getEasSchemaUidForSchemaDefinition, getEasSchemaUidForExactDefinition, getSchemaUidForModelFromCache, setSchemaUidForModel, cachedSchemaLookup, BaseQueryClient, BaseEasClient, GET_SCHEMAS } from '@seedprotocol/eas';
|
|
10
10
|
import { fetchArweaveRawTextAcrossGateways } from '@seedprotocol/arweave';
|
|
11
|
+
import { e as eventEmitter } from './eventBus-7vxTCc3a.js';
|
|
11
12
|
import { modelPropertiesToObject } from './model-oHA3YhOd.js';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -290,11 +291,6 @@ function createReactiveProxy(config) {
|
|
|
290
291
|
return proxy;
|
|
291
292
|
}
|
|
292
293
|
|
|
293
|
-
const ENV = (typeof process !== 'undefined' && process.env)
|
|
294
|
-
? process.env
|
|
295
|
-
: (typeof window !== 'undefined' && window.env)
|
|
296
|
-
? window.env
|
|
297
|
-
: {};
|
|
298
294
|
var MachineIds;
|
|
299
295
|
(function (MachineIds) {
|
|
300
296
|
MachineIds["CLIENT_MANAGER"] = "@seedSdk/clientManager";
|
|
@@ -307,7 +303,6 @@ var MachineIds;
|
|
|
307
303
|
MachineIds["MODEL"] = "@seedSdk/model";
|
|
308
304
|
MachineIds["FILE_SYSTEM"] = "@seedSdk/fileSystem";
|
|
309
305
|
})(MachineIds || (MachineIds = {}));
|
|
310
|
-
const { INTERNAL, GLOBAL } = MachineIds;
|
|
311
306
|
var ClientManagerState;
|
|
312
307
|
(function (ClientManagerState) {
|
|
313
308
|
ClientManagerState["UNINITIALIZED"] = "uninitialized";
|
|
@@ -335,40 +330,6 @@ var ClientManagerEvents;
|
|
|
335
330
|
ClientManagerEvents["ADD_MODELS_TO_DB_SUCCESS"] = "addModelsToDbSuccess";
|
|
336
331
|
ClientManagerEvents["PROCESS_SCHEMA_FILES_SUCCESS"] = "processSchemaFilesSuccess";
|
|
337
332
|
})(ClientManagerEvents || (ClientManagerEvents = {}));
|
|
338
|
-
var GlobalState;
|
|
339
|
-
(function (GlobalState) {
|
|
340
|
-
GlobalState["UNINITIALIZED"] = "uninitialized";
|
|
341
|
-
GlobalState["INITIALIZING"] = "initializing";
|
|
342
|
-
GlobalState["INITIALIZED"] = "initialized";
|
|
343
|
-
GlobalState["PUBLISHING_ITEM"] = "publishingItem";
|
|
344
|
-
GlobalState["ADDING_MODELS_TO_DB"] = "addingModelsToDb";
|
|
345
|
-
})(GlobalState || (GlobalState = {}));
|
|
346
|
-
const { INITIALIZING, PUBLISHING_ITEM, ADDING_MODELS_TO_DB, } = GlobalState;
|
|
347
|
-
var InternalState;
|
|
348
|
-
(function (InternalState) {
|
|
349
|
-
InternalState["IDLE"] = "idle";
|
|
350
|
-
InternalState["INITIALIZING"] = "initializing";
|
|
351
|
-
InternalState["VALIDATING_INPUT"] = "validatingInput";
|
|
352
|
-
InternalState["CONFIGURING_FS"] = "configuringFs";
|
|
353
|
-
InternalState["LOADING_SEED_DB"] = "loadingSeedDb";
|
|
354
|
-
InternalState["SAVING_CONFIG"] = "savingConfig";
|
|
355
|
-
InternalState["LOADING_APP_DB"] = "loadingAppDb";
|
|
356
|
-
InternalState["LOADING_SDK_DB"] = "loadingSdkDb";
|
|
357
|
-
})(InternalState || (InternalState = {}));
|
|
358
|
-
const { VALIDATING_INPUT, CONFIGURING_FS, LOADING_SEED_DB, LOADING_APP_DB } = InternalState;
|
|
359
|
-
/**
|
|
360
|
-
* @deprecated Evaluated once at import and ignores `SeedConfig.eas` / publish chain config.
|
|
361
|
-
* Use `getEasEndpoint()` from `@seedprotocol/eas`.
|
|
362
|
-
*/
|
|
363
|
-
ENV.NEXT_PUBLIC_EAS_ENDPOINT ||
|
|
364
|
-
ENV.EAS_ENDPOINT ||
|
|
365
|
-
'https://optimism-sepolia.easscan.org/graphql';
|
|
366
|
-
/**
|
|
367
|
-
* @deprecated Use BaseArweaveClient.getHost() instead.
|
|
368
|
-
* This constant is kept for backward compatibility but will be removed in a future version.
|
|
369
|
-
* Migration: import { BaseArweaveClient } from '@/helpers' and use BaseArweaveClient.getHost()
|
|
370
|
-
*/
|
|
371
|
-
ENV.NEXT_PUBLIC_ARWEAVE_HOST || 'ar.seedprotocol.io';
|
|
372
333
|
|
|
373
334
|
const waitForDb$1 = fromCallback(({ sendBack }) => {
|
|
374
335
|
// Usually ready already: polling first cost every new Item 100ms.
|
|
@@ -398,8 +359,21 @@ const isVersionRevoked = (revokedAt) => revokedAt != null && revokedAt !== 0;
|
|
|
398
359
|
const versionNotRevoked = () => or(isNull(versions.revokedAt), eq(versions.revokedAt, 0));
|
|
399
360
|
|
|
400
361
|
/**
|
|
401
|
-
*
|
|
402
|
-
*
|
|
362
|
+
* The order that picks a seed's head version: newest first by attestation time, or by local
|
|
363
|
+
* creation time for a version that has no attestation yet (ADR 0006: latest = highest
|
|
364
|
+
* `timeCreated`), then `local_id DESC` so versions that tie still give one answer. Sync inserts a
|
|
365
|
+
* batch of versions with one `created_at`, so ordering by `created_at` alone leaves them tied.
|
|
366
|
+
*
|
|
367
|
+
* Every reader that picks a head version, attested or not, orders by this. Unqualified column
|
|
368
|
+
* names: use it in queries that read `versions` alone.
|
|
369
|
+
*/
|
|
370
|
+
const LATEST_VERSION_ORDER_SQL = 'COALESCE(attestation_created_at, created_at) DESC, local_id DESC';
|
|
371
|
+
/** {@link LATEST_VERSION_ORDER_SQL} for a Drizzle `orderBy`. */
|
|
372
|
+
const latestVersionOrder = () => sql.raw(LATEST_VERSION_ORDER_SQL);
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Per-seed version aggregates plus the latest version row: the first live version by
|
|
376
|
+
* `LATEST_VERSION_ORDER_SQL`.
|
|
403
377
|
*
|
|
404
378
|
* Revoked versions (`revoked_at` set) are never the latest version and don't count toward
|
|
405
379
|
* `lastVersionPublishedAt`. `versionsCount` and `lastLocalUpdateAt` still cover every version row,
|
|
@@ -423,36 +397,35 @@ const getVersionData$1 = () => {
|
|
|
423
397
|
.select({
|
|
424
398
|
seedLocalId: versions.seedLocalId,
|
|
425
399
|
lastVersionPublishedAt: max(versions.attestationCreatedAt).as('lastVersionPublishedAt'),
|
|
426
|
-
maxCreatedAt: max(versions.createdAt).as('maxCreatedAt'),
|
|
427
400
|
})
|
|
428
401
|
.from(versions)
|
|
429
402
|
.where(versionNotRevoked())
|
|
430
403
|
.groupBy(versions.seedLocalId));
|
|
431
|
-
const
|
|
432
|
-
.with(liveVersionStats)
|
|
404
|
+
const rankedLiveVersions = appDb.$with('ranked_live_versions').as(appDb
|
|
433
405
|
.select({
|
|
434
406
|
seedLocalId: versions.seedLocalId,
|
|
435
|
-
latestVersionLocalId:
|
|
407
|
+
latestVersionLocalId: sql `${versions.localId}`.as('latestVersionLocalId'),
|
|
408
|
+
rowNum: sql
|
|
409
|
+
.raw(`ROW_NUMBER() OVER (PARTITION BY seed_local_id ORDER BY ${LATEST_VERSION_ORDER_SQL})`)
|
|
410
|
+
.as('rowNum'),
|
|
436
411
|
})
|
|
437
412
|
.from(versions)
|
|
438
|
-
.
|
|
439
|
-
.where(versionNotRevoked())
|
|
440
|
-
.groupBy(versions.seedLocalId));
|
|
413
|
+
.where(versionNotRevoked()));
|
|
441
414
|
return appDb.$with('versionData').as(appDb
|
|
442
|
-
.with(versionStats, liveVersionStats,
|
|
415
|
+
.with(versionStats, liveVersionStats, rankedLiveVersions)
|
|
443
416
|
.select({
|
|
444
417
|
seedLocalId: versionStats.seedLocalId,
|
|
445
418
|
seedUid: versions.seedUid,
|
|
446
419
|
latestVersionUid: versions.uid,
|
|
447
|
-
latestVersionLocalId:
|
|
420
|
+
latestVersionLocalId: rankedLiveVersions.latestVersionLocalId,
|
|
448
421
|
versionsCount: versionStats.versionsCount,
|
|
449
422
|
lastVersionPublishedAt: liveVersionStats.lastVersionPublishedAt,
|
|
450
423
|
lastLocalUpdateAt: versionStats.lastLocalUpdateAt,
|
|
451
424
|
})
|
|
452
425
|
.from(versionStats)
|
|
453
426
|
.leftJoin(liveVersionStats, eq(versionStats.seedLocalId, liveVersionStats.seedLocalId))
|
|
454
|
-
.leftJoin(
|
|
455
|
-
.leftJoin(versions, and(eq(versions.seedLocalId,
|
|
427
|
+
.leftJoin(rankedLiveVersions, and(eq(versionStats.seedLocalId, rankedLiveVersions.seedLocalId), eq(rankedLiveVersions.rowNum, 1)))
|
|
428
|
+
.leftJoin(versions, and(eq(versions.seedLocalId, rankedLiveVersions.seedLocalId), eq(versions.localId, rankedLiveVersions.latestVersionLocalId))));
|
|
456
429
|
};
|
|
457
430
|
|
|
458
431
|
var versionData = /*#__PURE__*/Object.freeze({
|
|
@@ -621,7 +594,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
621
594
|
const itemPropertyMod = await Promise.resolve().then(function () { return ItemProperty$1; });
|
|
622
595
|
const { ItemProperty } = itemPropertyMod;
|
|
623
596
|
const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
|
|
624
|
-
const _mod_0 = await import('./errors-
|
|
597
|
+
const _mod_0 = await import('./errors-D1zHAqjr.js');
|
|
625
598
|
const _ns_0 = _mod_0.i;
|
|
626
599
|
const { Model } = _ns_0;
|
|
627
600
|
// Resolve Model and build property schemas (use getByNameAsync for models not yet in cache)
|
|
@@ -639,8 +612,8 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
639
612
|
const schemaNameToTry = schemaName ?? model?.schemaName;
|
|
640
613
|
if (schemaNameToTry) {
|
|
641
614
|
try {
|
|
642
|
-
const _mod_1 = await import('./Schema-
|
|
643
|
-
const _ns_1 = _mod_1.
|
|
615
|
+
const _mod_1 = await import('./Schema-PFZwG9Nl.js');
|
|
616
|
+
const _ns_1 = _mod_1.a;
|
|
644
617
|
const { Schema } = _ns_1;
|
|
645
618
|
const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false, hold: false });
|
|
646
619
|
const schemaContext = schemaInstance.getService().getSnapshot().context;
|
|
@@ -655,8 +628,8 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
655
628
|
}
|
|
656
629
|
if (Object.keys(propertySchemas).length === 0) {
|
|
657
630
|
try {
|
|
658
|
-
const _mod_2 = await import('./ClientManager-
|
|
659
|
-
const _ns_2 = _mod_2.
|
|
631
|
+
const _mod_2 = await import('./ClientManager-GZfXErDX.js');
|
|
632
|
+
const _ns_2 = _mod_2.S;
|
|
660
633
|
const { loadAllSchemasFromDb } = _ns_2;
|
|
661
634
|
const allSchemas = await loadAllSchemasFromDb();
|
|
662
635
|
for (const { schema: schemaFile } of allSchemas) {
|
|
@@ -676,11 +649,11 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
676
649
|
}
|
|
677
650
|
if (Object.keys(propertySchemas).length === 0) {
|
|
678
651
|
try {
|
|
679
|
-
const _mod_3 = await import('./ClientManager-
|
|
680
|
-
const _ns_3 = _mod_3.
|
|
652
|
+
const _mod_3 = await import('./ClientManager-GZfXErDX.js');
|
|
653
|
+
const _ns_3 = _mod_3.S;
|
|
681
654
|
const { listCompleteSchemaFiles } = _ns_3;
|
|
682
|
-
const _mod_4 = await import('./index-
|
|
683
|
-
const _ns_4 = _mod_4.
|
|
655
|
+
const _mod_4 = await import('./index-Dx_GTdyQ.js');
|
|
656
|
+
const _ns_4 = _mod_4.bb;
|
|
684
657
|
const { BaseFileManager } = _ns_4;
|
|
685
658
|
const schemaFiles = await listCompleteSchemaFiles();
|
|
686
659
|
for (const { filePath } of schemaFiles) {
|
|
@@ -700,7 +673,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
700
673
|
}
|
|
701
674
|
}
|
|
702
675
|
if (Object.keys(propertySchemas).length === 0) {
|
|
703
|
-
const schemaMod = await import('./index-
|
|
676
|
+
const schemaMod = await import('./index-DJmWkVIK.js');
|
|
704
677
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
705
678
|
const KNOWN_MODEL_FALLBACKS = {
|
|
706
679
|
Post: {
|
|
@@ -717,7 +690,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
717
690
|
}
|
|
718
691
|
}
|
|
719
692
|
// Fallbacks above may return schema-file shape ({ type, model, items }); normalize to dataType/ref/refValueType.
|
|
720
|
-
const { normalizePropertyRecordSchema } = await import('./property-
|
|
693
|
+
const { normalizePropertyRecordSchema } = await import('./property-BwYtg5Q_.js');
|
|
721
694
|
propertySchemas = Object.fromEntries(Object.entries(propertySchemas).map(([name, def]) => [name, normalizePropertyRecordSchema(def)]));
|
|
722
695
|
// Collapse rows that map to the same instance key (e.g. authorIdentityIds + authors -> authors).
|
|
723
696
|
// ItemProperty.create cache does not sync propertyValue on hit; processing order would otherwise
|
|
@@ -750,7 +723,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
750
723
|
// Infer propertyRecordSchema from metadata when schema is missing (enables persistence)
|
|
751
724
|
let propSchema = propertySchemas[propertyName];
|
|
752
725
|
if (!propSchema && isRefTypeFromMeta) {
|
|
753
|
-
const schemaMod = await import('./index-
|
|
726
|
+
const schemaMod = await import('./index-DJmWkVIK.js');
|
|
754
727
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
755
728
|
propSchema = {
|
|
756
729
|
dataType: refSeedType === 'html' ? ModelPropertyDataTypes.Html
|
|
@@ -1031,13 +1004,20 @@ const runPublish = fromCallback(({ sendBack, input: { context, item: itemFromEve
|
|
|
1031
1004
|
}
|
|
1032
1005
|
try {
|
|
1033
1006
|
// item.publish() sends its own instance; look it up only if startPublish came without one.
|
|
1034
|
-
const
|
|
1035
|
-
|
|
1007
|
+
const loaded = itemFromEvent
|
|
1008
|
+
? undefined
|
|
1009
|
+
: (await (await Promise.resolve().then(function () { return Item$1; })).Item.find({ seedLocalId }));
|
|
1010
|
+
const item = itemFromEvent ?? loaded;
|
|
1036
1011
|
if (!item) {
|
|
1037
1012
|
sendBack({ type: 'publishError', error: new Error(`Item not found: ${seedLocalId}`) });
|
|
1038
1013
|
return;
|
|
1039
1014
|
}
|
|
1040
|
-
|
|
1015
|
+
try {
|
|
1016
|
+
await executor(item, options);
|
|
1017
|
+
}
|
|
1018
|
+
finally {
|
|
1019
|
+
loaded?.unload();
|
|
1020
|
+
}
|
|
1041
1021
|
sendBack({ type: 'publishSuccess' });
|
|
1042
1022
|
}
|
|
1043
1023
|
catch (error) {
|
|
@@ -1253,28 +1233,20 @@ const isPublishedMetadataRow = (row) => isValidEasAttestationUid(row.uid) || row
|
|
|
1253
1233
|
*
|
|
1254
1234
|
* Ops apply in append order (the row id) per item property. A property's run of consecutive
|
|
1255
1235
|
* value ops (`set`, `storage`) is coalesced: only the newest is applied and the older ones are
|
|
1256
|
-
* marked superseded in the same transaction.
|
|
1236
|
+
* marked superseded in the same transaction.
|
|
1257
1237
|
*
|
|
1258
1238
|
* This module knows nothing about items: appliers are registered per op kind
|
|
1259
1239
|
* (registerOutboxApplier).
|
|
1260
1240
|
*/
|
|
1261
1241
|
const logger$9 = debug('seedSdk:outbox');
|
|
1262
|
-
/** A failure worth retrying (a file the browser had locked, say). Other errors fail the op at once. */
|
|
1263
|
-
class OutboxOpRetryableError extends Error {
|
|
1264
|
-
constructor(message, options) {
|
|
1265
|
-
super(message, options);
|
|
1266
|
-
this.name = 'OutboxOpRetryableError';
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
1242
|
/** File-system errors that pass (another tab or the OS holding the file). */
|
|
1270
1243
|
const RETRYABLE_ERROR_NAMES = new Set(['NoModificationAllowedError', 'NotReadableError', 'InvalidStateError']);
|
|
1271
1244
|
/**
|
|
1272
1245
|
* Whether an op that failed with `error` may apply later: the database was busy (BaseDb.transaction
|
|
1273
|
-
* has already retried for about a second)
|
|
1274
|
-
*
|
|
1246
|
+
* has already retried for about a second) or a file was busy. Anything else (a broken rule, a
|
|
1247
|
+
* missing row, a bug) would fail the same way again.
|
|
1275
1248
|
*/
|
|
1276
|
-
const isRetryable = (error) => error
|
|
1277
|
-
isSqliteBusyError(error) ||
|
|
1249
|
+
const isRetryable = (error) => isSqliteBusyError(error) ||
|
|
1278
1250
|
(error instanceof Error && RETRYABLE_ERROR_NAMES.has(error.name));
|
|
1279
1251
|
/**
|
|
1280
1252
|
* An op that can't apply yet for a reason that will pass without counting as a failure: an applier's
|
|
@@ -1335,43 +1307,28 @@ function registerOutboxApplier(kind, applier) {
|
|
|
1335
1307
|
let appendGeneration = 0;
|
|
1336
1308
|
/** How many appends this tab has started; see getPendingSetValue. */
|
|
1337
1309
|
const outboxAppendGeneration = () => appendGeneration;
|
|
1338
|
-
/**
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
*/
|
|
1342
|
-
async function appendOutboxOps(inputs) {
|
|
1343
|
-
if (inputs.length === 0)
|
|
1344
|
-
return [];
|
|
1345
|
-
const groupId = inputs.length > 1 ? generateId() : null;
|
|
1346
|
-
const now = Date.now();
|
|
1347
|
-
const rows = inputs.map((input) => ({
|
|
1310
|
+
/** Appends one op and tells the leader to drain. Returns the op id. */
|
|
1311
|
+
async function appendOutboxOp(input) {
|
|
1312
|
+
const row = {
|
|
1348
1313
|
opId: generateId(),
|
|
1349
|
-
groupId: input.groupId ?? groupId,
|
|
1350
1314
|
seedLocalId: input.seedLocalId,
|
|
1351
1315
|
propertyName: input.propertyName ?? null,
|
|
1352
1316
|
kind: input.kind,
|
|
1353
1317
|
value: input.value === undefined ? null : JSON.stringify(input.value),
|
|
1354
|
-
valueRef: input.valueRef ?? null,
|
|
1355
1318
|
baseRowId: input.baseRowId ?? null,
|
|
1356
|
-
|
|
1357
|
-
createdAt: now,
|
|
1319
|
+
createdAt: Date.now(),
|
|
1358
1320
|
tabId: TAB_ID,
|
|
1359
1321
|
status: 'pending',
|
|
1360
1322
|
attempts: 0,
|
|
1361
|
-
}
|
|
1323
|
+
};
|
|
1362
1324
|
appendGeneration += 1;
|
|
1363
|
-
await BaseDb.getAppDb().insert(pendingWrites).values(
|
|
1325
|
+
await BaseDb.getAppDb().insert(pendingWrites).values(row);
|
|
1364
1326
|
startOutbox();
|
|
1365
1327
|
if (isLeaderTab())
|
|
1366
1328
|
scheduleDrain();
|
|
1367
1329
|
else
|
|
1368
1330
|
postTabMessage({ type: 'outbox-nudge' });
|
|
1369
|
-
return
|
|
1370
|
-
}
|
|
1371
|
-
/** Appends one op; see appendOutboxOps. */
|
|
1372
|
-
async function appendOutboxOp(input) {
|
|
1373
|
-
const [opId] = await appendOutboxOps([input]);
|
|
1374
|
-
return opId;
|
|
1331
|
+
return row.opId;
|
|
1375
1332
|
}
|
|
1376
1333
|
/**
|
|
1377
1334
|
* Appends one op and waits until it settles: its applier's result once applied, or `superseded`
|
|
@@ -1494,8 +1451,7 @@ const isDue = (op) => (notBefore.get(op.opId) ?? 0) <= Date.now();
|
|
|
1494
1451
|
* The units to apply now, oldest first. A property's ops apply in order, so its queue waits
|
|
1495
1452
|
* behind its oldest pending op, including one waiting for a retry. An op on the seed itself (no
|
|
1496
1453
|
* property: create, delete) is ordered against all of its seed's ops: it waits for every earlier
|
|
1497
|
-
* one, and every later one waits for it.
|
|
1498
|
-
* of its property or seed.
|
|
1454
|
+
* one, and every later one waits for it.
|
|
1499
1455
|
*/
|
|
1500
1456
|
function planUnits(pending) {
|
|
1501
1457
|
const queues = new Map();
|
|
@@ -1504,33 +1460,15 @@ function planUnits(pending) {
|
|
|
1504
1460
|
queue.push(op);
|
|
1505
1461
|
queues.set(keyOf(op), queue);
|
|
1506
1462
|
}
|
|
1507
|
-
|
|
1508
|
-
const queue = queues.get(keyOf(op));
|
|
1509
|
-
if (queue.slice(0, queue.indexOf(op)).some((earlier) => earlier.groupId !== op.groupId))
|
|
1510
|
-
return true;
|
|
1511
|
-
return blockedBySeed(op);
|
|
1512
|
-
};
|
|
1513
|
-
// Seed-level ordering: an earlier op of the seed this op must wait for (outside its group)
|
|
1463
|
+
// Seed-level ordering: an earlier op of the seed this op must wait for
|
|
1514
1464
|
const blockedBySeed = (op) => pending.some((earlier) => earlier.id < op.id &&
|
|
1515
1465
|
earlier.seedLocalId === op.seedLocalId &&
|
|
1516
|
-
(earlier.groupId == null || earlier.groupId !== op.groupId) &&
|
|
1517
1466
|
(earlier.propertyName == null || op.propertyName == null));
|
|
1518
1467
|
const units = [];
|
|
1519
|
-
const plannedGroups = new Set();
|
|
1520
1468
|
for (const queue of queues.values()) {
|
|
1521
1469
|
const head = queue[0];
|
|
1522
1470
|
if (!isDue(head))
|
|
1523
1471
|
continue;
|
|
1524
|
-
if (head.groupId) {
|
|
1525
|
-
if (plannedGroups.has(head.groupId))
|
|
1526
|
-
continue;
|
|
1527
|
-
const members = pending.filter((op) => op.groupId === head.groupId);
|
|
1528
|
-
if (members.some((member) => !isDue(member) || blockedByOthers(member)))
|
|
1529
|
-
continue;
|
|
1530
|
-
plannedGroups.add(head.groupId);
|
|
1531
|
-
units.push({ unit: { groupId: head.groupId }, order: members[0].id });
|
|
1532
|
-
continue;
|
|
1533
|
-
}
|
|
1534
1472
|
if (blockedBySeed(head))
|
|
1535
1473
|
continue;
|
|
1536
1474
|
let end = 0;
|
|
@@ -1538,7 +1476,6 @@ function planUnits(pending) {
|
|
|
1538
1476
|
// Not across a later seed-level op: the run stops before it
|
|
1539
1477
|
while (end + 1 < queue.length &&
|
|
1540
1478
|
VALUE_KINDS.has(queue[end + 1].kind) &&
|
|
1541
|
-
!queue[end + 1].groupId &&
|
|
1542
1479
|
!blockedBySeed(queue[end + 1])) {
|
|
1543
1480
|
end++;
|
|
1544
1481
|
}
|
|
@@ -1551,16 +1488,8 @@ function planUnits(pending) {
|
|
|
1551
1488
|
class ClaimLostError extends Error {
|
|
1552
1489
|
}
|
|
1553
1490
|
async function applyUnit(unit) {
|
|
1554
|
-
const ops =
|
|
1555
|
-
|
|
1556
|
-
.select()
|
|
1557
|
-
.from(pendingWrites)
|
|
1558
|
-
.where(and(eq(pendingWrites.groupId, unit.groupId), eq(pendingWrites.status, 'pending')))
|
|
1559
|
-
.orderBy(asc(pendingWrites.id))
|
|
1560
|
-
: [unit.op];
|
|
1561
|
-
if (ops.length === 0)
|
|
1562
|
-
return;
|
|
1563
|
-
const superseded = 'groupId' in unit ? [] : unit.superseded;
|
|
1491
|
+
const ops = [unit.op];
|
|
1492
|
+
const superseded = unit.superseded;
|
|
1564
1493
|
const ids = ops.map((op) => op.opId);
|
|
1565
1494
|
const supersededIds = superseded.map((op) => op.opId);
|
|
1566
1495
|
try {
|
|
@@ -1995,7 +1924,8 @@ var getSeedData$1 = /*#__PURE__*/Object.freeze({
|
|
|
1995
1924
|
});
|
|
1996
1925
|
|
|
1997
1926
|
/**
|
|
1998
|
-
* Latest version row for the seed (by
|
|
1927
|
+
* Latest version row for the seed (by `LATEST_VERSION_ORDER_SQL`) whose uid is a real EAS
|
|
1928
|
+
* attestation id.
|
|
1999
1929
|
* Skips legacy 'NULL' / ZERO_BYTES32 placeholders, non-bytes32 strings, and revoked versions
|
|
2000
1930
|
* (`revoked_at` set): after a full unpublish the seed has no published version.
|
|
2001
1931
|
*/
|
|
@@ -2011,7 +1941,7 @@ async function getLatestPublishedVersionRow(seedLocalId) {
|
|
|
2011
1941
|
})
|
|
2012
1942
|
.from(versions)
|
|
2013
1943
|
.where(and(eq(versions.seedLocalId, seedLocalId), versionNotRevoked()))
|
|
2014
|
-
.orderBy(
|
|
1944
|
+
.orderBy(latestVersionOrder());
|
|
2015
1945
|
for (const vr of vRows) {
|
|
2016
1946
|
if (vr.uid && isValidEasAttestationUid(vr.uid)) {
|
|
2017
1947
|
return {
|
|
@@ -2118,19 +2048,13 @@ const getItemData = async ({ modelName, seedLocalId, seedUid, }) => {
|
|
|
2118
2048
|
revokedAt: versions.revokedAt,
|
|
2119
2049
|
})
|
|
2120
2050
|
.from(versions)
|
|
2121
|
-
.where(eq(versions.seedLocalId, resolvedSeedLocalId))
|
|
2051
|
+
.where(eq(versions.seedLocalId, resolvedSeedLocalId))
|
|
2052
|
+
.orderBy(latestVersionOrder());
|
|
2122
2053
|
if (allVersions.length > 0) {
|
|
2123
2054
|
// Revoked versions are never the latest one and don't count as published (same as the
|
|
2124
2055
|
// getVersionData subquery); versionsCount / lastLocalUpdateAt still cover every row.
|
|
2125
2056
|
const liveVersions = allVersions.filter((v) => !isVersionRevoked(v.revokedAt));
|
|
2126
|
-
const
|
|
2127
|
-
const ca = a.createdAt ?? 0;
|
|
2128
|
-
const cb = b.createdAt ?? 0;
|
|
2129
|
-
if (cb !== ca)
|
|
2130
|
-
return cb - ca;
|
|
2131
|
-
return String(b.localId ?? '').localeCompare(String(a.localId ?? ''));
|
|
2132
|
-
});
|
|
2133
|
-
const latest = sorted[0];
|
|
2057
|
+
const latest = liveVersions[0];
|
|
2134
2058
|
let lastPub = null;
|
|
2135
2059
|
for (const v of liveVersions) {
|
|
2136
2060
|
const t = v.attestationCreatedAt;
|
|
@@ -2231,7 +2155,8 @@ const writeInBatches = async (values, write, size = IN_LIST_BATCH) => {
|
|
|
2231
2155
|
|
|
2232
2156
|
/**
|
|
2233
2157
|
* One round-trip for list views: for each seed, the same row as {@link getLatestPublishedVersionRow}
|
|
2234
|
-
* (
|
|
2158
|
+
* (first by `LATEST_VERSION_ORDER_SQL` whose `uid` is a valid EAS attestation id and that isn't
|
|
2159
|
+
* revoked).
|
|
2235
2160
|
*/
|
|
2236
2161
|
async function batchLatestPublishedVersionBySeedLocalIds(seedLocalIds) {
|
|
2237
2162
|
const out = new Map();
|
|
@@ -2245,11 +2170,11 @@ async function batchLatestPublishedVersionBySeedLocalIds(seedLocalIds) {
|
|
|
2245
2170
|
seedLocalId: versions.seedLocalId,
|
|
2246
2171
|
localId: versions.localId,
|
|
2247
2172
|
uid: versions.uid,
|
|
2248
|
-
createdAt: versions.createdAt,
|
|
2249
2173
|
revokedAt: versions.revokedAt,
|
|
2250
2174
|
})
|
|
2251
2175
|
.from(versions)
|
|
2252
|
-
.where(inArray(versions.seedLocalId, chunk))
|
|
2176
|
+
.where(inArray(versions.seedLocalId, chunk))
|
|
2177
|
+
.orderBy(latestVersionOrder()));
|
|
2253
2178
|
const bySeed = new Map();
|
|
2254
2179
|
for (const r of rows) {
|
|
2255
2180
|
const sid = r.seedLocalId;
|
|
@@ -2259,15 +2184,9 @@ async function batchLatestPublishedVersionBySeedLocalIds(seedLocalIds) {
|
|
|
2259
2184
|
list.push(r);
|
|
2260
2185
|
bySeed.set(sid, list);
|
|
2261
2186
|
}
|
|
2187
|
+
// A seed's rows all come from one chunk, so each list keeps the SQL order.
|
|
2262
2188
|
for (const [sid, list] of bySeed) {
|
|
2263
|
-
const
|
|
2264
|
-
const ca = a.createdAt ?? 0;
|
|
2265
|
-
const cb = b.createdAt ?? 0;
|
|
2266
|
-
if (cb !== ca)
|
|
2267
|
-
return cb - ca;
|
|
2268
|
-
return String(b.localId ?? '').localeCompare(String(a.localId ?? ''));
|
|
2269
|
-
});
|
|
2270
|
-
const hit = sorted.find((r) => r.uid && isValidEasAttestationUid(r.uid) && !isVersionRevoked(r.revokedAt));
|
|
2189
|
+
const hit = list.find((r) => r.uid && isValidEasAttestationUid(r.uid) && !isVersionRevoked(r.revokedAt));
|
|
2271
2190
|
if (hit?.uid) {
|
|
2272
2191
|
out.set(sid, { uid: hit.uid, localId: hit.localId ?? null });
|
|
2273
2192
|
}
|
|
@@ -2467,8 +2386,8 @@ const getItemsData = async ({ modelName, modelFileId, schemaName, deleted, inclu
|
|
|
2467
2386
|
conditions.push(eq(seeds.type, easName(modelName)));
|
|
2468
2387
|
}
|
|
2469
2388
|
if (!modelFileId && schemaName && modelName) {
|
|
2470
|
-
const _mod_5 = await import('./index-
|
|
2471
|
-
const _ns_5 = _mod_5.
|
|
2389
|
+
const _mod_5 = await import('./index-Dx_GTdyQ.js');
|
|
2390
|
+
const _ns_5 = _mod_5.be;
|
|
2472
2391
|
const { resolveModelRecord } = _ns_5;
|
|
2473
2392
|
modelFileId = (await resolveModelRecord(modelName, { schemaName }))?.schemaFileId ?? undefined;
|
|
2474
2393
|
if (!modelFileId)
|
|
@@ -2534,7 +2453,7 @@ const getItemsData = async ({ modelName, modelFileId, schemaName, deleted, inclu
|
|
|
2534
2453
|
};
|
|
2535
2454
|
|
|
2536
2455
|
/**
|
|
2537
|
-
* The seed's head version row:
|
|
2456
|
+
* The seed's head version row: first by `LATEST_VERSION_ORDER_SQL`, attested or not, skipping
|
|
2538
2457
|
* revoked versions. Null when the seed has no version or every version is revoked (a fully
|
|
2539
2458
|
* unpublished item). Same choice as `latestVersionLocalId` in the `getVersionData` subquery.
|
|
2540
2459
|
*/
|
|
@@ -2551,7 +2470,7 @@ async function getLatestVersionRow(seedLocalId) {
|
|
|
2551
2470
|
})
|
|
2552
2471
|
.from(versions)
|
|
2553
2472
|
.where(and(eq(versions.seedLocalId, seedLocalId), versionNotRevoked()))
|
|
2554
|
-
.orderBy(
|
|
2473
|
+
.orderBy(latestVersionOrder())
|
|
2555
2474
|
.limit(1);
|
|
2556
2475
|
return rows[0] ?? null;
|
|
2557
2476
|
}
|
|
@@ -2695,7 +2614,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2695
2614
|
const { isRelation, propertyValue, propertyName, propertyRecordSchema, populatedFromDb, } = context;
|
|
2696
2615
|
const _resolveRelatedValue = async () => {
|
|
2697
2616
|
// Use dynamic import to break circular dependency
|
|
2698
|
-
const schemaMod = await import('./index-
|
|
2617
|
+
const schemaMod = await import('./index-DJmWkVIK.js');
|
|
2699
2618
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
2700
2619
|
if (!propertyValue || !isRelation || populatedFromDb) {
|
|
2701
2620
|
return;
|
|
@@ -3109,7 +3028,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
|
|
|
3109
3028
|
propertyRecordSchema?.validation &&
|
|
3110
3029
|
metadataValues.propertyValue != null &&
|
|
3111
3030
|
metadataValues.propertyValue !== '') {
|
|
3112
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
3031
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-DnGKel4V.js');
|
|
3113
3032
|
const validationService = new SchemaValidationService();
|
|
3114
3033
|
const validationResult = validationService.validatePropertyValue(metadataValues.propertyValue, normalizeDataType(propertyRecordSchema.dataType), propertyRecordSchema.validation, propertyRecordSchema.refValueType
|
|
3115
3034
|
? normalizeDataType(String(propertyRecordSchema.refValueType))
|
|
@@ -3317,8 +3236,8 @@ async function readHtmlBodyFromChildStorageArweave(seedLocalId) {
|
|
|
3317
3236
|
/* offline / bad tx id */
|
|
3318
3237
|
}
|
|
3319
3238
|
try {
|
|
3320
|
-
const _mod_6 = await import('./index-
|
|
3321
|
-
const _ns_6 = _mod_6.
|
|
3239
|
+
const _mod_6 = await import('./index-Dx_GTdyQ.js');
|
|
3240
|
+
const _ns_6 = _mod_6.bg;
|
|
3322
3241
|
const { downloadTransactionIdWithDedupe } = _ns_6;
|
|
3323
3242
|
await downloadTransactionIdWithDedupe(txId);
|
|
3324
3243
|
const retryFp = BaseFileManager.getFilesPath('html', `${seedLocalId}.html`);
|
|
@@ -3378,7 +3297,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3378
3297
|
// to use dynamically imported ModelPropertyDataTypes
|
|
3379
3298
|
const _hydrateFromDb = async () => {
|
|
3380
3299
|
// Use dynamic import to break circular dependency
|
|
3381
|
-
const schemaMod = await import('./index-
|
|
3300
|
+
const schemaMod = await import('./index-DJmWkVIK.js');
|
|
3382
3301
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
3383
3302
|
const appDb = BaseDb.getAppDb();
|
|
3384
3303
|
const whereClauses = [];
|
|
@@ -3426,8 +3345,8 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3426
3345
|
}
|
|
3427
3346
|
const stored = rows?.[0] ?? { seedLocalId, seedUid, propertyName };
|
|
3428
3347
|
const firstRow = pending ? applyPendingRow({ ...stored }, pending) : { ...stored };
|
|
3429
|
-
const _mod_7 = await import('./ClientManager-
|
|
3430
|
-
const _ns_7 = _mod_7.
|
|
3348
|
+
const _mod_7 = await import('./ClientManager-GZfXErDX.js');
|
|
3349
|
+
const _ns_7 = _mod_7.U;
|
|
3431
3350
|
const { getPropertyConflict } = _ns_7;
|
|
3432
3351
|
const conflict = await getPropertyConflict(firstRow.seedLocalId ?? seedLocalId, propertyName);
|
|
3433
3352
|
const { localId, uid, propertyValue: propertyValueFromDb, seedLocalId: seedLocalIdFromDb, seedUid: seedUidFromDb, schemaUid: schemaUidFromDb, versionLocalId: versionLocalIdFromDb, versionUid: versionUidFromDb, refValueType, } = firstRow;
|
|
@@ -3685,12 +3604,12 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
3685
3604
|
const modelNameForNew = context.modelName;
|
|
3686
3605
|
if (modelNameForNew) {
|
|
3687
3606
|
try {
|
|
3688
|
-
const _mod_8 = await import('./errors-
|
|
3607
|
+
const _mod_8 = await import('./errors-D1zHAqjr.js');
|
|
3689
3608
|
const _ns_8 = _mod_8.i;
|
|
3690
3609
|
const { Model } = _ns_8;
|
|
3691
3610
|
const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
|
|
3692
|
-
const _mod_9 = await import('./index-
|
|
3693
|
-
const _ns_9 = _mod_9.
|
|
3611
|
+
const _mod_9 = await import('./index-Dx_GTdyQ.js');
|
|
3612
|
+
const _ns_9 = _mod_9.be;
|
|
3694
3613
|
const { resolveItemModelFileId } = _ns_9;
|
|
3695
3614
|
const normalizedModelName = upperFirst(camelCase(modelNameForNew));
|
|
3696
3615
|
const itemModelFileId = await resolveItemModelFileId({
|
|
@@ -3751,8 +3670,8 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
3751
3670
|
// It ends up in the context below, and later lookups by name (Model.getByName) can't match it.
|
|
3752
3671
|
const modelName = context.modelName || (metadataRecord.modelType ? upperFirst(camelCase(metadataRecord.modelType)) : undefined);
|
|
3753
3672
|
// Model names are only unique per schema: pin lookups to the item's own model row.
|
|
3754
|
-
const _mod_10 = await import('./index-
|
|
3755
|
-
const _ns_10 = _mod_10.
|
|
3673
|
+
const _mod_10 = await import('./index-Dx_GTdyQ.js');
|
|
3674
|
+
const _ns_10 = _mod_10.be;
|
|
3756
3675
|
const { resolveItemModelFileId } = _ns_10;
|
|
3757
3676
|
const modelFileId = await resolveItemModelFileId({
|
|
3758
3677
|
modelFileId: context.modelFileId,
|
|
@@ -3766,7 +3685,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
3766
3685
|
// Normalize snake_case to PascalCase: "test_post" -> "TestPost" (startCase gives "Test Post" which fails)
|
|
3767
3686
|
const normalizedModelName = upperFirst(camelCase(modelName));
|
|
3768
3687
|
// One read for the whole model, shared by the item's other properties loading now
|
|
3769
|
-
const { loadModelPropertyRecordSchemas } = await import('./modelPropertyRecordSchemas-
|
|
3688
|
+
const { loadModelPropertyRecordSchemas } = await import('./modelPropertyRecordSchemas-C5lW9aA-.js');
|
|
3770
3689
|
const schemas = await loadModelPropertyRecordSchemas(normalizedModelName, modelFileId, db);
|
|
3771
3690
|
propertyRecordSchema = schemas.get(propertyName);
|
|
3772
3691
|
timing.mark('model schema');
|
|
@@ -3779,7 +3698,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
3779
3698
|
// Fix 1: Fallback to in-memory Model when DB doesn't have model/properties yet (e.g. runtime-created model)
|
|
3780
3699
|
if (!propertyRecordSchema && modelName) {
|
|
3781
3700
|
try {
|
|
3782
|
-
const _mod_11 = await import('./errors-
|
|
3701
|
+
const _mod_11 = await import('./errors-D1zHAqjr.js');
|
|
3783
3702
|
const _ns_11 = _mod_11.i;
|
|
3784
3703
|
const { Model } = _ns_11;
|
|
3785
3704
|
const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
|
|
@@ -4239,7 +4158,7 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
|
4239
4158
|
const result = await updateItemPropertyValue({ ...props, seedLocalId, propertyName: propertyNameRaw });
|
|
4240
4159
|
return { skipped: false, result, conflict: null };
|
|
4241
4160
|
}
|
|
4242
|
-
const { appendOutboxOp, getOutboxOps, outboxOpResult, startItemOutbox, throwItemWriteError, waitForOutboxOp } = await import('./index-
|
|
4161
|
+
const { appendOutboxOp, getOutboxOps, outboxOpResult, startItemOutbox, throwItemWriteError, waitForOutboxOp } = await import('./index-CkYb3wcU.js');
|
|
4243
4162
|
startItemOutbox();
|
|
4244
4163
|
// Checked right before appending (no await in between): ops apply in append order
|
|
4245
4164
|
if (writeTicket && !writeTicket.isLatest())
|
|
@@ -4270,9 +4189,9 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
|
4270
4189
|
return false;
|
|
4271
4190
|
}
|
|
4272
4191
|
// Use dynamic import to break circular dependency
|
|
4273
|
-
const schemaMod = await import('./index-
|
|
4192
|
+
const schemaMod = await import('./index-DJmWkVIK.js');
|
|
4274
4193
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
4275
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
4194
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-DnGKel4V.js');
|
|
4276
4195
|
const propertyName = propertyNameRaw;
|
|
4277
4196
|
if (!propertyName) {
|
|
4278
4197
|
throw new Error('propertyName is required');
|
|
@@ -4531,7 +4450,7 @@ async function writeStorageValue(item, value, ticket) {
|
|
|
4531
4450
|
if (!seedLocalId) {
|
|
4532
4451
|
throw new Error(`No local seed for the item to save ${item.propertyName} to`);
|
|
4533
4452
|
}
|
|
4534
|
-
const { appendOutboxOp, getOutboxOps, outboxOpResult, startItemOutbox, throwItemWriteError, waitForOutboxOp } = await import('./index-
|
|
4453
|
+
const { appendOutboxOp, getOutboxOps, outboxOpResult, startItemOutbox, throwItemWriteError, waitForOutboxOp } = await import('./index-CkYb3wcU.js');
|
|
4535
4454
|
startItemOutbox();
|
|
4536
4455
|
// Checked right before appending (no await in between): ops apply in append order
|
|
4537
4456
|
if (ticket && !ticket.isLatest()) {
|
|
@@ -5218,9 +5137,6 @@ const propertyMachine = setup({
|
|
|
5218
5137
|
// stateIn return type does not satisfy setup() inference; runtime guard is correct for root state `idle`.
|
|
5219
5138
|
propertyMachineIsIdle: stateIn('idle'),
|
|
5220
5139
|
},
|
|
5221
|
-
// actions: {
|
|
5222
|
-
// updateContext: updateMachineContext,
|
|
5223
|
-
// },
|
|
5224
5140
|
actors: {
|
|
5225
5141
|
waitForDb,
|
|
5226
5142
|
loadOrCreateProperty,
|
|
@@ -5523,11 +5439,11 @@ const getPropertyData = async ({ propertyName, seedLocalId, seedUid, modelName,
|
|
|
5523
5439
|
let names = [...getMetadataPropertyNamesForQuery(propertyName)];
|
|
5524
5440
|
if (modelName) {
|
|
5525
5441
|
try {
|
|
5526
|
-
const _mod_12 = await import('./errors-
|
|
5442
|
+
const _mod_12 = await import('./errors-D1zHAqjr.js');
|
|
5527
5443
|
const _ns_12 = _mod_12.i;
|
|
5528
5444
|
const { Model } = _ns_12;
|
|
5529
|
-
const _mod_13 = await import('./index-
|
|
5530
|
-
const _ns_13 = _mod_13.
|
|
5445
|
+
const _mod_13 = await import('./index-Dx_GTdyQ.js');
|
|
5446
|
+
const _ns_13 = _mod_13.be;
|
|
5531
5447
|
const { resolveItemModelFileId } = _ns_13;
|
|
5532
5448
|
// Model names are only unique per schema: use the seed's own model when it is recorded.
|
|
5533
5449
|
const modelFileId = await resolveItemModelFileId({ seedLocalId, seedUid });
|
|
@@ -5763,8 +5679,8 @@ const HTML_PROP_SEED_UID_RE = /^0x[a-fA-F0-9]{64}$/;
|
|
|
5763
5679
|
*/
|
|
5764
5680
|
const resolvePropertyRecordSchemaFromSchemaData = async (modelName, propertyName, modelType, schemaName) => {
|
|
5765
5681
|
try {
|
|
5766
|
-
const _mod_14 = await import('./ClientManager-
|
|
5767
|
-
const _ns_14 = _mod_14.
|
|
5682
|
+
const _mod_14 = await import('./ClientManager-GZfXErDX.js');
|
|
5683
|
+
const _ns_14 = _mod_14.S;
|
|
5768
5684
|
const { loadAllSchemasFromDb } = _ns_14;
|
|
5769
5685
|
const allSchemas = await loadAllSchemasFromDb();
|
|
5770
5686
|
const modelNameAlt = modelType ? upperFirst(camelCase(modelType)) : '';
|
|
@@ -5817,12 +5733,12 @@ hints = {}) => {
|
|
|
5817
5733
|
return undefined;
|
|
5818
5734
|
}
|
|
5819
5735
|
try {
|
|
5820
|
-
const _mod_15 = await import('./errors-
|
|
5736
|
+
const _mod_15 = await import('./errors-D1zHAqjr.js');
|
|
5821
5737
|
const _ns_15 = _mod_15.i;
|
|
5822
5738
|
const { Model } = _ns_15;
|
|
5823
5739
|
const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
|
|
5824
|
-
const _mod_16 = await import('./index-
|
|
5825
|
-
const _ns_16 = _mod_16.
|
|
5740
|
+
const _mod_16 = await import('./index-Dx_GTdyQ.js');
|
|
5741
|
+
const _ns_16 = _mod_16.be;
|
|
5826
5742
|
const { resolveItemModelFileId } = _ns_16;
|
|
5827
5743
|
const modelFileId = await resolveItemModelFileId(hints);
|
|
5828
5744
|
let model = modelFileId
|
|
@@ -6019,7 +5935,7 @@ class ItemProperty {
|
|
|
6019
5935
|
return;
|
|
6020
5936
|
}
|
|
6021
5937
|
// Use dynamic import to break circular dependency
|
|
6022
|
-
const schemaMod = await import('./index-
|
|
5938
|
+
const schemaMod = await import('./index-DJmWkVIK.js');
|
|
6023
5939
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
6024
5940
|
const { context } = snapshot;
|
|
6025
5941
|
const { propertyRecordSchema } = context;
|
|
@@ -6384,11 +6300,17 @@ class ItemProperty {
|
|
|
6384
6300
|
hasPendingPropertyWrite(propertyWriteKey(context.seedLocalId ?? context.seedUid, context.propertyName))) {
|
|
6385
6301
|
return;
|
|
6386
6302
|
}
|
|
6303
|
+
// An ItemStorage row that points at its file holds no content: keep the value shown until
|
|
6304
|
+
// the pass this update starts reads the file. Taking renderValue from the row showed null
|
|
6305
|
+
// in between, e.g. when publish moved a legacy verbatim row's content to its file.
|
|
6306
|
+
const contentInFile = context.propertyRecordSchema?.storageType === 'ItemStorage' &&
|
|
6307
|
+
metaRow.propertyValue == null &&
|
|
6308
|
+
!!metaRow.refResolvedValue;
|
|
6387
6309
|
// Update context with metadata changes
|
|
6388
6310
|
this._service.send({
|
|
6389
6311
|
type: 'updateContext',
|
|
6390
6312
|
propertyValue: metaRow.propertyValue,
|
|
6391
|
-
renderValue: metaRow.propertyValue,
|
|
6313
|
+
...(contentInFile ? {} : { renderValue: metaRow.propertyValue }),
|
|
6392
6314
|
localId: metaRow.localId || undefined,
|
|
6393
6315
|
uid: metaRow.uid || undefined,
|
|
6394
6316
|
versionLocalId: metaRow.versionLocalId || undefined,
|
|
@@ -6465,8 +6387,8 @@ class ItemProperty {
|
|
|
6465
6387
|
const ctx = this._service.getSnapshot().context;
|
|
6466
6388
|
let modelFileId;
|
|
6467
6389
|
try {
|
|
6468
|
-
const _mod_17 = await import('./index-
|
|
6469
|
-
const _ns_17 = _mod_17.
|
|
6390
|
+
const _mod_17 = await import('./index-Dx_GTdyQ.js');
|
|
6391
|
+
const _ns_17 = _mod_17.be;
|
|
6470
6392
|
const { resolveItemModelFileId } = _ns_17;
|
|
6471
6393
|
modelFileId = await resolveItemModelFileId({
|
|
6472
6394
|
modelFileId: ctx.modelFileId,
|
|
@@ -6816,8 +6738,8 @@ class ItemProperty {
|
|
|
6816
6738
|
const propertiesData = await getItemProperties({ seedLocalId, seedUid });
|
|
6817
6739
|
const instances = [];
|
|
6818
6740
|
const seenNormalized = new Set();
|
|
6819
|
-
const _mod_18 = await import('./index-
|
|
6820
|
-
const _ns_18 = _mod_18.
|
|
6741
|
+
const _mod_18 = await import('./index-Dx_GTdyQ.js');
|
|
6742
|
+
const _ns_18 = _mod_18.be;
|
|
6821
6743
|
const { resolveItemModelFileId } = _ns_18;
|
|
6822
6744
|
const itemModelFileId = await resolveItemModelFileId({ seedLocalId, seedUid });
|
|
6823
6745
|
for (const data of propertiesData) {
|
|
@@ -6834,7 +6756,7 @@ class ItemProperty {
|
|
|
6834
6756
|
}
|
|
6835
6757
|
else if (baseName) {
|
|
6836
6758
|
try {
|
|
6837
|
-
const _mod_19 = await import('./errors-
|
|
6759
|
+
const _mod_19 = await import('./errors-D1zHAqjr.js');
|
|
6838
6760
|
const _ns_19 = _mod_19.i;
|
|
6839
6761
|
const { Model } = _ns_19;
|
|
6840
6762
|
const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
|
|
@@ -6851,7 +6773,7 @@ class ItemProperty {
|
|
|
6851
6773
|
}
|
|
6852
6774
|
if (modelName && propertyName) {
|
|
6853
6775
|
try {
|
|
6854
|
-
const _mod_20 = await import('./errors-
|
|
6776
|
+
const _mod_20 = await import('./errors-D1zHAqjr.js');
|
|
6855
6777
|
const _ns_20 = _mod_20.i;
|
|
6856
6778
|
const { Model } = _ns_20;
|
|
6857
6779
|
const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
|
|
@@ -7054,7 +6976,7 @@ class ItemProperty {
|
|
|
7054
6976
|
const { seedLocalId, propertyName } = this._getSnapshotContext();
|
|
7055
6977
|
if (!seedLocalId || !propertyName)
|
|
7056
6978
|
return;
|
|
7057
|
-
const { appendOutboxOpAndWait, markPropertyConflictsResolved, startItemOutbox, throwItemWriteError } = await import('./index-
|
|
6979
|
+
const { appendOutboxOpAndWait, markPropertyConflictsResolved, startItemOutbox, throwItemWriteError } = await import('./index-CkYb3wcU.js');
|
|
7058
6980
|
if (choice === 'remote') {
|
|
7059
6981
|
startItemOutbox();
|
|
7060
6982
|
await appendOutboxOpAndWait({
|
|
@@ -7301,7 +7223,7 @@ class ItemProperty {
|
|
|
7301
7223
|
if (db && seedLocalId) {
|
|
7302
7224
|
// Through the outbox (ADR 0019): after the property's pending edits, which would
|
|
7303
7225
|
// otherwise write its rows back
|
|
7304
|
-
const { appendOutboxOpAndWait, startItemOutbox, throwItemWriteError } = await import('./index-
|
|
7226
|
+
const { appendOutboxOpAndWait, startItemOutbox, throwItemWriteError } = await import('./index-CkYb3wcU.js');
|
|
7305
7227
|
startItemOutbox();
|
|
7306
7228
|
await appendOutboxOpAndWait({
|
|
7307
7229
|
seedLocalId,
|
|
@@ -7311,7 +7233,7 @@ class ItemProperty {
|
|
|
7311
7233
|
}).catch(throwItemWriteError);
|
|
7312
7234
|
}
|
|
7313
7235
|
else if (db) {
|
|
7314
|
-
const _mod_21 = await import('./index-
|
|
7236
|
+
const _mod_21 = await import('./index-PbnKw2es.js');
|
|
7315
7237
|
const _ns_21 = _mod_21.s;
|
|
7316
7238
|
const seedSchemaMod = _ns_21;
|
|
7317
7239
|
const { metadata } = seedSchemaMod;
|
|
@@ -7361,7 +7283,7 @@ const createNewItem = async ({ modelName, modelFileId, ...propertyData }) => {
|
|
|
7361
7283
|
}
|
|
7362
7284
|
const seedType = easName(modelName);
|
|
7363
7285
|
// Dynamic import to break circular dependency
|
|
7364
|
-
const _mod_22 = await import('./errors-
|
|
7286
|
+
const _mod_22 = await import('./errors-D1zHAqjr.js');
|
|
7365
7287
|
const _ns_22 = _mod_22.i;
|
|
7366
7288
|
const modelMod = _ns_22;
|
|
7367
7289
|
const { Model } = modelMod;
|
|
@@ -7417,7 +7339,7 @@ const createNewItem = async ({ modelName, modelFileId, ...propertyData }) => {
|
|
|
7417
7339
|
}
|
|
7418
7340
|
rows.push({ propertyName, propertyValue, propertyRecordSchema, schemaUid: schemaUids.get(propertyName) });
|
|
7419
7341
|
}
|
|
7420
|
-
const { appendOutboxOpAndWait, startItemOutbox } = await import('./index-
|
|
7342
|
+
const { appendOutboxOpAndWait, startItemOutbox } = await import('./index-CkYb3wcU.js');
|
|
7421
7343
|
startItemOutbox();
|
|
7422
7344
|
const fields = await timed(`${label} seed fields`, () => resolveNewSeedFields(seedType));
|
|
7423
7345
|
const applied = await timed(`${label} outbox apply`, () => appendOutboxOpAndWait({
|
|
@@ -7436,8 +7358,8 @@ const createNewItem = async ({ modelName, modelFileId, ...propertyData }) => {
|
|
|
7436
7358
|
}
|
|
7437
7359
|
catch (error) {
|
|
7438
7360
|
// Staged values of a create that never got appended (once appended, the op's discard does it)
|
|
7439
|
-
const _mod_23 = await import('./ClientManager-
|
|
7440
|
-
const _ns_23 = _mod_23.
|
|
7361
|
+
const _mod_23 = await import('./ClientManager-GZfXErDX.js');
|
|
7362
|
+
const _ns_23 = _mod_23.V;
|
|
7441
7363
|
const { deleteFiles } = _ns_23;
|
|
7442
7364
|
await deleteFiles(stagedPaths);
|
|
7443
7365
|
throw error;
|
|
@@ -7566,7 +7488,7 @@ const getModel = () => {
|
|
|
7566
7488
|
// the fragile `import(...).then(n => n.X)` chunk-namespace pattern.
|
|
7567
7489
|
if (!modelImportPromise) {
|
|
7568
7490
|
modelImportPromise = (async () => {
|
|
7569
|
-
const _mod_24 = await import('./errors-
|
|
7491
|
+
const _mod_24 = await import('./errors-D1zHAqjr.js');
|
|
7570
7492
|
const _ns_24 = _mod_24.i;
|
|
7571
7493
|
const mod = _ns_24;
|
|
7572
7494
|
ModelClass = mod.Model;
|
|
@@ -7705,8 +7627,8 @@ class Item {
|
|
|
7705
7627
|
* sync wrote while they were pending (ADR 0019). Each property's is also on `property.conflict`.
|
|
7706
7628
|
*/
|
|
7707
7629
|
this.conflicts = async () => {
|
|
7708
|
-
const _mod_25 = await import('./ClientManager-
|
|
7709
|
-
const _ns_25 = _mod_25.
|
|
7630
|
+
const _mod_25 = await import('./ClientManager-GZfXErDX.js');
|
|
7631
|
+
const _ns_25 = _mod_25.U;
|
|
7710
7632
|
const { getItemConflicts } = _ns_25;
|
|
7711
7633
|
return getItemConflicts(this.seedLocalId);
|
|
7712
7634
|
};
|
|
@@ -7800,14 +7722,14 @@ class Item {
|
|
|
7800
7722
|
};
|
|
7801
7723
|
this.getPublishUploads = async (options) => {
|
|
7802
7724
|
// Use dynamic import to break circular dependency
|
|
7803
|
-
const _mod_26 = await import('./getPublishUploads-
|
|
7725
|
+
const _mod_26 = await import('./getPublishUploads-BzUIDA2G.js');
|
|
7804
7726
|
const _ns_26 = _mod_26.o;
|
|
7805
7727
|
const getPublishUploadsMod = _ns_26;
|
|
7806
7728
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
7807
7729
|
return await getPublishUploads(this, [], undefined, options);
|
|
7808
7730
|
};
|
|
7809
7731
|
this.getPublishPayload = async (uploadedTransactions, options) => {
|
|
7810
|
-
const _mod_27 = await import('./getPublishPayload-
|
|
7732
|
+
const _mod_27 = await import('./getPublishPayload-DH4rMqXG.js');
|
|
7811
7733
|
const _ns_27 = _mod_27.g;
|
|
7812
7734
|
const getPublishPayloadMod = _ns_27;
|
|
7813
7735
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
@@ -8351,8 +8273,8 @@ class Item {
|
|
|
8351
8273
|
const db = BaseDb.getAppDb();
|
|
8352
8274
|
if (db && props.modelName) {
|
|
8353
8275
|
// Model names are only unique per schema: resolve the exact models row from the most specific scope.
|
|
8354
|
-
const _mod_28 = await import('./index-
|
|
8355
|
-
const _ns_28 = _mod_28.
|
|
8276
|
+
const _mod_28 = await import('./index-Dx_GTdyQ.js');
|
|
8277
|
+
const _ns_28 = _mod_28.be;
|
|
8356
8278
|
const { resolveModelRecord } = _ns_28;
|
|
8357
8279
|
const modelRecord = await resolveModelRecord(props.modelName, {
|
|
8358
8280
|
modelFileId: props.modelFileId ?? modelInstance?.id,
|
|
@@ -8360,7 +8282,7 @@ class Item {
|
|
|
8360
8282
|
});
|
|
8361
8283
|
const modelRecords = modelRecord ? [modelRecord] : [];
|
|
8362
8284
|
if (!modelRecord) {
|
|
8363
|
-
const _mod_29 = await import('./errors-
|
|
8285
|
+
const _mod_29 = await import('./errors-D1zHAqjr.js');
|
|
8364
8286
|
const _ns_29 = _mod_29.j;
|
|
8365
8287
|
const { UnknownModelError } = _ns_29;
|
|
8366
8288
|
throw new UnknownModelError(props.modelName, schemaName ?? modelInstance?.schemaName);
|
|
@@ -8371,11 +8293,11 @@ class Item {
|
|
|
8371
8293
|
// Scope the constructor's Model lookup to this model's schema (as getItemData does on reload),
|
|
8372
8294
|
// so a same-named model cached from another schema can't supply the property set.
|
|
8373
8295
|
if (modelRecord && !props.schemaName) {
|
|
8374
|
-
const _mod_30 = await import('./index-
|
|
8375
|
-
const _ns_30 = _mod_30.
|
|
8296
|
+
const _mod_30 = await import('./index-Dx_GTdyQ.js');
|
|
8297
|
+
const _ns_30 = _mod_30.bd;
|
|
8376
8298
|
const { modelSchemas } = _ns_30;
|
|
8377
|
-
const _mod_31 = await import('./index-
|
|
8378
|
-
const _ns_31 = _mod_31.
|
|
8299
|
+
const _mod_31 = await import('./index-Dx_GTdyQ.js');
|
|
8300
|
+
const _ns_31 = _mod_31.bc;
|
|
8379
8301
|
const { schemas: schemasTable } = _ns_31;
|
|
8380
8302
|
const schemaRows = await db
|
|
8381
8303
|
.select({ schemaName: schemasTable.name })
|
|
@@ -8478,7 +8400,7 @@ class Item {
|
|
|
8478
8400
|
/* best-effort cache cleanup */
|
|
8479
8401
|
}
|
|
8480
8402
|
try {
|
|
8481
|
-
const { appendOutboxOpAndWait, deleteFiles, startItemOutbox } = await import('./index-
|
|
8403
|
+
const { appendOutboxOpAndWait, deleteFiles, startItemOutbox } = await import('./index-CkYb3wcU.js');
|
|
8482
8404
|
startItemOutbox();
|
|
8483
8405
|
const applied = await appendOutboxOpAndWait({
|
|
8484
8406
|
seedLocalId,
|
|
@@ -8501,7 +8423,7 @@ class Item {
|
|
|
8501
8423
|
for (const [propertyName, value] of pipelineValues) {
|
|
8502
8424
|
const property = await this.waitForPropertyInstance(item, propertyName, timeout);
|
|
8503
8425
|
if (!property) {
|
|
8504
|
-
const _mod_32 = await import('./errors-
|
|
8426
|
+
const _mod_32 = await import('./errors-D1zHAqjr.js');
|
|
8505
8427
|
const _ns_32 = _mod_32.j;
|
|
8506
8428
|
const { ItemCreateError } = _ns_32;
|
|
8507
8429
|
throw new ItemCreateError(`Item.create: property ${item.modelName}.${propertyName} did not load for item ${item.seedLocalId}; value was not saved`, { code: 'property_not_loaded', modelName: item.modelName, property: propertyName, seedLocalId: item.seedLocalId });
|
|
@@ -8513,14 +8435,14 @@ class Item {
|
|
|
8513
8435
|
}
|
|
8514
8436
|
catch (error) {
|
|
8515
8437
|
if (error instanceof ItemPropertySaveValidationError) {
|
|
8516
|
-
const _mod_33 = await import('./errors-
|
|
8438
|
+
const _mod_33 = await import('./errors-D1zHAqjr.js');
|
|
8517
8439
|
const _ns_33 = _mod_33.j;
|
|
8518
8440
|
const { ItemCreateValidationError } = _ns_33;
|
|
8519
8441
|
const created = new ItemCreateValidationError(item.modelName, error.validationErrors.map((e) => ({ property: propertyName, code: e.code, message: e.message })));
|
|
8520
8442
|
created.cause = error;
|
|
8521
8443
|
throw created;
|
|
8522
8444
|
}
|
|
8523
|
-
const _mod_34 = await import('./errors-
|
|
8445
|
+
const _mod_34 = await import('./errors-D1zHAqjr.js');
|
|
8524
8446
|
const _ns_34 = _mod_34.j;
|
|
8525
8447
|
const { ItemCreateError } = _ns_34;
|
|
8526
8448
|
throw new ItemCreateError(`Item.create: failed to save ${item.modelName}.${propertyName} for item ${item.seedLocalId}: ` +
|
|
@@ -8688,7 +8610,7 @@ class Item {
|
|
|
8688
8610
|
if (!appDb || Item.instanceCache.size === 0) {
|
|
8689
8611
|
return;
|
|
8690
8612
|
}
|
|
8691
|
-
const _mod_35 = await import('./index-
|
|
8613
|
+
const _mod_35 = await import('./index-PbnKw2es.js');
|
|
8692
8614
|
const _ns_35 = _mod_35.s;
|
|
8693
8615
|
const { metadata } = _ns_35;
|
|
8694
8616
|
const { eq, and } = await import('drizzle-orm');
|
|
@@ -8822,11 +8744,11 @@ class Item {
|
|
|
8822
8744
|
}
|
|
8823
8745
|
/** Throws ItemCreateValidationError for unknown keys and values that break their property's rules. */
|
|
8824
8746
|
static async assertValidCreateValues(props, propertyNames, dataTypeByPropertyName, skipKeys) {
|
|
8825
|
-
const _mod_36 = await import('./errors-
|
|
8747
|
+
const _mod_36 = await import('./errors-D1zHAqjr.js');
|
|
8826
8748
|
const _ns_36 = _mod_36.j;
|
|
8827
8749
|
const { ItemCreateValidationError } = _ns_36;
|
|
8828
|
-
const { getPropertySchema } = await import('./property-
|
|
8829
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
8750
|
+
const { getPropertySchema } = await import('./property-BwYtg5Q_.js');
|
|
8751
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-DnGKel4V.js');
|
|
8830
8752
|
const validationService = new SchemaValidationService();
|
|
8831
8753
|
const modelName = props.modelName;
|
|
8832
8754
|
const known = new Set(propertyNames);
|
|
@@ -8863,7 +8785,7 @@ class Item {
|
|
|
8863
8785
|
// Not JSON: validated as given, and rejected as a non-array
|
|
8864
8786
|
}
|
|
8865
8787
|
}
|
|
8866
|
-
const { resolvePropertyValidationRules } = await import('./propertyValidationRules-
|
|
8788
|
+
const { resolvePropertyValidationRules } = await import('./propertyValidationRules-CyHdpcPP.js');
|
|
8867
8789
|
const rules = propertySchema?.validation ??
|
|
8868
8790
|
(await resolvePropertyValidationRules(modelName, key, {
|
|
8869
8791
|
modelFileId: props.modelFileId,
|
|
@@ -9175,7 +9097,7 @@ class Item {
|
|
|
9175
9097
|
itemActor.send(event);
|
|
9176
9098
|
};
|
|
9177
9099
|
try {
|
|
9178
|
-
const _mod_37 = await import('./index-
|
|
9100
|
+
const _mod_37 = await import('./index-PbnKw2es.js');
|
|
9179
9101
|
const _ns_37 = _mod_37.s;
|
|
9180
9102
|
const seedSchemaMod = _ns_37;
|
|
9181
9103
|
const { seeds, metadata } = seedSchemaMod;
|
|
@@ -9272,16 +9194,20 @@ class Item {
|
|
|
9272
9194
|
// Only watch for changes in the browser (the change feed is browser-only)
|
|
9273
9195
|
if (isBrowser) {
|
|
9274
9196
|
const seedsQuery = (sql) => sql `
|
|
9275
|
-
SELECT local_id as localId, uid, schema_uid as schemaUid, revoked_at as revokedAt, publisher
|
|
9197
|
+
SELECT local_id as localId, uid, schema_uid as schemaUid, revoked_at as revokedAt, publisher,
|
|
9198
|
+
attestation_created_at as attestationCreatedAt
|
|
9276
9199
|
FROM seeds
|
|
9277
9200
|
WHERE local_id = ${watchedSeedLocalId}
|
|
9278
9201
|
`;
|
|
9279
|
-
|
|
9280
|
-
|
|
9202
|
+
// The tag binds every interpolation as a parameter, so the order goes in the strings.
|
|
9203
|
+
const versionsQueryText = [
|
|
9204
|
+
`SELECT local_id as localId, uid, seed_local_id as seedLocalId, revoked_at as revokedAt,
|
|
9205
|
+
attestation_created_at as attestationCreatedAt
|
|
9281
9206
|
FROM versions
|
|
9282
|
-
WHERE seed_local_id =
|
|
9283
|
-
|
|
9284
|
-
|
|
9207
|
+
WHERE seed_local_id = `,
|
|
9208
|
+
` ORDER BY ${LATEST_VERSION_ORDER_SQL}`,
|
|
9209
|
+
];
|
|
9210
|
+
const versionsQuery = (sql) => sql(Object.assign([...versionsQueryText], { raw: versionsQueryText }), watchedSeedLocalId);
|
|
9285
9211
|
const instanceState = itemInstanceState.get(this);
|
|
9286
9212
|
if (!instanceState) {
|
|
9287
9213
|
logger('[Item._setupLiveQuerySubscription] Instance state not found');
|
|
@@ -9327,6 +9253,8 @@ class Item {
|
|
|
9327
9253
|
revokedAt: seedRow.revokedAt ?? undefined,
|
|
9328
9254
|
// claimUnpublishedDrafts (here or in another tab) stamps drafts' publisher.
|
|
9329
9255
|
...(seedRow.publisher ? { publisher: seedRow.publisher } : {}),
|
|
9256
|
+
// Written by publish (persistSeedUid) after the item took its uid.
|
|
9257
|
+
...(seedRow.attestationCreatedAt ? { attestationCreatedAt: seedRow.attestationCreatedAt } : {}),
|
|
9330
9258
|
});
|
|
9331
9259
|
}, {
|
|
9332
9260
|
immediate: true,
|
|
@@ -9350,9 +9278,17 @@ class Item {
|
|
|
9350
9278
|
type: 'updateContext',
|
|
9351
9279
|
latestVersionLocalId: undefined,
|
|
9352
9280
|
latestVersionUid: undefined,
|
|
9281
|
+
lastVersionPublishedAt: undefined,
|
|
9353
9282
|
});
|
|
9354
9283
|
return;
|
|
9355
9284
|
}
|
|
9285
|
+
// As versionData computes it: the newest attestation among the live versions.
|
|
9286
|
+
let lastVersionPublishedAt;
|
|
9287
|
+
for (const v of versionRows) {
|
|
9288
|
+
if (isVersionRevoked(v.revokedAt) || !v.attestationCreatedAt)
|
|
9289
|
+
continue;
|
|
9290
|
+
lastVersionPublishedAt = Math.max(lastVersionPublishedAt ?? 0, v.attestationCreatedAt);
|
|
9291
|
+
}
|
|
9356
9292
|
const latestVersionLocalId = latestVersion.localId;
|
|
9357
9293
|
logger(`[Item._setupLiveQuerySubscription] Versions updated, latest version: ${latestVersionLocalId}`);
|
|
9358
9294
|
// Query metadata for the latest version
|
|
@@ -9437,6 +9373,7 @@ class Item {
|
|
|
9437
9373
|
type: 'updateContext',
|
|
9438
9374
|
latestVersionLocalId,
|
|
9439
9375
|
latestVersionUid: latestVersion.uid || undefined,
|
|
9376
|
+
lastVersionPublishedAt,
|
|
9440
9377
|
});
|
|
9441
9378
|
}, {
|
|
9442
9379
|
immediate: true,
|
|
@@ -9543,7 +9480,7 @@ class Item {
|
|
|
9543
9480
|
return;
|
|
9544
9481
|
}
|
|
9545
9482
|
// Through the outbox (ADR 0019): after the item's pending edits, not before them
|
|
9546
|
-
const { appendOutboxOpAndWait, startItemOutbox, throwItemWriteError } = await import('./index-
|
|
9483
|
+
const { appendOutboxOpAndWait, startItemOutbox, throwItemWriteError } = await import('./index-CkYb3wcU.js');
|
|
9547
9484
|
startItemOutbox();
|
|
9548
9485
|
await appendOutboxOpAndWait({
|
|
9549
9486
|
seedLocalId: context.seedLocalId,
|
|
@@ -9570,5 +9507,5 @@ var Item$1 = /*#__PURE__*/Object.freeze({
|
|
|
9570
9507
|
Item: Item
|
|
9571
9508
|
});
|
|
9572
9509
|
|
|
9573
|
-
export {
|
|
9574
|
-
//# sourceMappingURL=Item-
|
|
9510
|
+
export { getMetadataLatest as $, getItemData as A, waitForEntityIdle as B, compareMetadataRowsLatestFirst as C, getEasSchemaUidForModel as D, getLatestPublishedVersionRow as E, parseListPropertyValueFromStorage as F, chunkValues as G, rowsPerInsert as H, Item as I, getGetAdditionalSyncAddresses as J, isVersionRevoked as K, isActorStopped as L, METADATA_LATEST_FIRST_ORDER_SQL as M, DEFAULT_READY_TIMEOUT_MS as N, OUTBOX_DEFER_MS as O, createReactiveProxy as P, sameEntity as Q, findEntity as R, forceRemoveFromCaches as S, runDestroyLifecycle as T, latestVersionOrder as U, isPublishedMetadataRow as V, ClientManagerState as W, MachineIds as X, PUBLISH_NOT_CONFIGURED_MESSAGE as Y, createNewItem as Z, getGetPublisherForNewSeeds as _, appendOutboxOpAndWait as a, getPublishExecutor as a0, getRevokeExecutor as a1, getUploadExecutor as a2, getVersionData$1 as a3, isLocalUnsealedDraft as a4, isSeedRowOwned as a5, localUnsealedDraftSql as a6, ownedPublisherSql as a7, ownedSeedsSql as a8, pickLatestMetadataRowPerProperty as a9, placeholderUidSql as aa, propertyMachine as ab, publisherInAddressListSql as ac, publisherIsInOwnedSet as ad, setAdditionalSyncAddresses as ae, setGetPublisherForNewSeeds as af, setPublishExecutor as ag, setRevokeExecutor as ah, setUploadExecutor as ai, ActorKeyedState as aj, clearDestroySubscriptions as ak, unloadEntity as al, ClientManagerEvents as am, getSeedPublisher as an, propertyNameVariants as ao, createSeed as ap, createMetadata as aq, updateItemPropertyValue as ar, resolvePublisherFromSeedRow as as, getPropertyData$1 as at, Item$1 as au, waitForOutboxOp as b, appendOutboxOp as c, OUTBOX_MAX_ATTEMPTS as d, OUTBOX_PRUNE_AFTER_MS as e, OUTBOX_PRUNE_FAILED_AFTER_MS as f, getOutboxOps as g, OUTBOX_RETRY_DELAYS_MS as h, OutboxOpDeferredError as i, OutboxOpFailedError as j, OutboxOpRejectedError as k, drainOutbox as l, getPendingSetValue as m, outboxOpValue as n, outboxOpResult as o, pruneOutbox as p, ItemProperty as q, registerOutboxApplier as r, startOutbox as s, ItemPropertySaveValidationError as t, OwnershipError as u, assertItemOwned as v, waitForPendingOutboxOps as w, isItemOwned as x, writeInBatches as y, selectInBatches as z };
|
|
9511
|
+
//# sourceMappingURL=Item-0oDoTPhi.js.map
|