@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
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { sql } from 'drizzle-orm';
|
|
2
|
+
import debug from 'debug';
|
|
3
|
+
|
|
4
|
+
const logger = debug('seedSdk:db:minimumUpgradeVersion');
|
|
5
|
+
/** The oldest SDK whose local database a newer SDK opens as it is. Older ones are recreated. */
|
|
6
|
+
const MIN_UPGRADE_SDK_VERSION = '0.7.7';
|
|
7
|
+
/**
|
|
8
|
+
* `when` of migration 0020, the first one 0.7.7 doesn't ship: a database that applied it was opened
|
|
9
|
+
* by 0.7.8 or later. SDKs 0.7.2 to 0.7.7 all ship migrations 0000-0019, so the count alone can't
|
|
10
|
+
* tell 0.7.7 from older.
|
|
11
|
+
*/
|
|
12
|
+
const FIRST_MIGRATION_AFTER_MIN_VERSION_MILLIS = 1792354539632;
|
|
13
|
+
/**
|
|
14
|
+
* appState key that 0.7.7's first init wrote (its stored-display-URL fix) and no older SDK did. It
|
|
15
|
+
* tells a 0.7.7 database from an older one with the same migrations.
|
|
16
|
+
*/
|
|
17
|
+
const MIN_VERSION_APP_STATE_KEY = 'storedDisplayUrlsCleared';
|
|
18
|
+
/** First column of the first row. libsql's rows index like arrays but aren't iterable. */
|
|
19
|
+
const firstValue = async (db, query) => (await db.values(query))[0]?.[0];
|
|
20
|
+
const hasTable = async (db, name) => (await db.values(sql `SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ${name}`)).length > 0;
|
|
21
|
+
/**
|
|
22
|
+
* True if an SDK older than {@link MIN_UPGRADE_SDK_VERSION} wrote this database and no newer SDK
|
|
23
|
+
* has opened it since. False for a new (empty) database.
|
|
24
|
+
*/
|
|
25
|
+
async function isOlderThanMinimumUpgradeVersion(db) {
|
|
26
|
+
if (!(await hasTable(db, '__drizzle_migrations')))
|
|
27
|
+
return false;
|
|
28
|
+
const lastMigration = await firstValue(db, sql `SELECT MAX(created_at) FROM __drizzle_migrations`);
|
|
29
|
+
if (lastMigration == null)
|
|
30
|
+
return false;
|
|
31
|
+
if (Number(lastMigration) >= FIRST_MIGRATION_AFTER_MIN_VERSION_MILLIS)
|
|
32
|
+
return false;
|
|
33
|
+
if (!(await hasTable(db, 'appState')))
|
|
34
|
+
return true;
|
|
35
|
+
const marker = await db.values(sql `SELECT 1 FROM appState WHERE key = ${MIN_VERSION_APP_STATE_KEY}`);
|
|
36
|
+
return marker.length === 0;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Drops every table, view and trigger, so the migrations that follow build the database as on a
|
|
40
|
+
* fresh install. `__drizzle_migrations` goes last: if this stops halfway, the next start still sees
|
|
41
|
+
* an old database and drops the rest.
|
|
42
|
+
*/
|
|
43
|
+
async function dropAllObjects(db) {
|
|
44
|
+
const rows = await db.values(sql `SELECT type, name FROM sqlite_master
|
|
45
|
+
WHERE type IN ('view', 'trigger', 'table') AND name NOT LIKE 'sqlite_%'`);
|
|
46
|
+
const order = { trigger: 0, view: 1, table: 2 };
|
|
47
|
+
const objects = rows
|
|
48
|
+
.map((row) => [String(row[0]), String(row[1])])
|
|
49
|
+
.sort(([typeA, nameA], [typeB, nameB]) => order[typeA] - order[typeB] ||
|
|
50
|
+
Number(nameA === '__drizzle_migrations') - Number(nameB === '__drizzle_migrations'));
|
|
51
|
+
const foreignKeys = await firstValue(db, sql `PRAGMA foreign_keys`);
|
|
52
|
+
// Dropping a parent table would otherwise run foreign key checks against tables not dropped yet.
|
|
53
|
+
await db.run(sql `PRAGMA foreign_keys = OFF`);
|
|
54
|
+
try {
|
|
55
|
+
for (const [type, name] of objects) {
|
|
56
|
+
await db.run(sql.raw(`DROP ${type.toUpperCase()} IF EXISTS "${name.replace(/"/g, '""')}"`));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
if (Number(foreignKeys) === 1)
|
|
61
|
+
await db.run(sql `PRAGMA foreign_keys = ON`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Recreates a database an SDK older than {@link MIN_UPGRADE_SDK_VERSION} wrote (decision D1 of the
|
|
66
|
+
* 2026-10 SDK audit): its tables are dropped before migrations run, so everything not yet published
|
|
67
|
+
* is gone and published data comes back through EAS sync. Files under filesDir stay where they are.
|
|
68
|
+
* Call it before migrations, holding the migrate lock. Returns true if it recreated the database.
|
|
69
|
+
*/
|
|
70
|
+
async function recreateIfOlderThanMinimumUpgradeVersion(db) {
|
|
71
|
+
if (!(await isOlderThanMinimumUpgradeVersion(db)))
|
|
72
|
+
return false;
|
|
73
|
+
console.warn(`[seed-protocol] This local database was written by an SDK older than ${MIN_UPGRADE_SDK_VERSION}. ` +
|
|
74
|
+
'It is being recreated: unpublished items are dropped, and published items come back through EAS sync.');
|
|
75
|
+
await dropAllObjects(db);
|
|
76
|
+
logger('dropped the tables of a database older than %s', MIN_UPGRADE_SDK_VERSION);
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { recreateIfOlderThanMinimumUpgradeVersion as r };
|
|
81
|
+
//# sourceMappingURL=minimumUpgradeVersion-BDhHvHtr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minimumUpgradeVersion-BDhHvHtr.js","sources":["../../src/db/minimumUpgradeVersion.ts"],"sourcesContent":["import { sql, type SQL } from 'drizzle-orm'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:db:minimumUpgradeVersion')\n\n/** The oldest SDK whose local database a newer SDK opens as it is. Older ones are recreated. */\nexport const MIN_UPGRADE_SDK_VERSION = '0.7.7'\n\n/**\n * `when` of migration 0020, the first one 0.7.7 doesn't ship: a database that applied it was opened\n * by 0.7.8 or later. SDKs 0.7.2 to 0.7.7 all ship migrations 0000-0019, so the count alone can't\n * tell 0.7.7 from older.\n */\nexport const FIRST_MIGRATION_AFTER_MIN_VERSION_MILLIS = 1792354539632\n\n/**\n * appState key that 0.7.7's first init wrote (its stored-display-URL fix) and no older SDK did. It\n * tells a 0.7.7 database from an older one with the same migrations.\n */\nexport const MIN_VERSION_APP_STATE_KEY = 'storedDisplayUrlsCleared'\n\n/** The part of a Drizzle SQLite database (sqlite-proxy or libsql) the check needs. */\ntype SqlRunner = {\n values: (query: SQL) => Promise<unknown[][]>\n run: (query: SQL) => Promise<unknown>\n}\n\n/** First column of the first row. libsql's rows index like arrays but aren't iterable. */\nconst firstValue = async (db: SqlRunner, query: SQL): Promise<unknown> => (await db.values(query))[0]?.[0]\n\nconst hasTable = async (db: SqlRunner, name: string): Promise<boolean> =>\n (await db.values(sql`SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ${name}`)).length > 0\n\n/**\n * True if an SDK older than {@link MIN_UPGRADE_SDK_VERSION} wrote this database and no newer SDK\n * has opened it since. False for a new (empty) database.\n */\nexport async function isOlderThanMinimumUpgradeVersion(db: SqlRunner): Promise<boolean> {\n if (!(await hasTable(db, '__drizzle_migrations'))) return false\n const lastMigration = await firstValue(db, sql`SELECT MAX(created_at) FROM __drizzle_migrations`)\n if (lastMigration == null) return false\n if (Number(lastMigration) >= FIRST_MIGRATION_AFTER_MIN_VERSION_MILLIS) return false\n if (!(await hasTable(db, 'appState'))) return true\n const marker = await db.values(sql`SELECT 1 FROM appState WHERE key = ${MIN_VERSION_APP_STATE_KEY}`)\n return marker.length === 0\n}\n\n/**\n * Drops every table, view and trigger, so the migrations that follow build the database as on a\n * fresh install. `__drizzle_migrations` goes last: if this stops halfway, the next start still sees\n * an old database and drops the rest.\n */\nasync function dropAllObjects(db: SqlRunner): Promise<void> {\n const rows = await db.values(\n sql`SELECT type, name FROM sqlite_master\n WHERE type IN ('view', 'trigger', 'table') AND name NOT LIKE 'sqlite_%'`,\n )\n const order = { trigger: 0, view: 1, table: 2 } as Record<string, number>\n const objects = rows\n .map((row) => [String(row[0]), String(row[1])] as const)\n .sort(([typeA, nameA], [typeB, nameB]) =>\n order[typeA]! - order[typeB]! ||\n Number(nameA === '__drizzle_migrations') - Number(nameB === '__drizzle_migrations'))\n const foreignKeys = await firstValue(db, sql`PRAGMA foreign_keys`)\n // Dropping a parent table would otherwise run foreign key checks against tables not dropped yet.\n await db.run(sql`PRAGMA foreign_keys = OFF`)\n try {\n for (const [type, name] of objects) {\n await db.run(sql.raw(`DROP ${type.toUpperCase()} IF EXISTS \"${name.replace(/\"/g, '\"\"')}\"`))\n }\n } finally {\n if (Number(foreignKeys) === 1) await db.run(sql`PRAGMA foreign_keys = ON`)\n }\n}\n\n/**\n * Recreates a database an SDK older than {@link MIN_UPGRADE_SDK_VERSION} wrote (decision D1 of the\n * 2026-10 SDK audit): its tables are dropped before migrations run, so everything not yet published\n * is gone and published data comes back through EAS sync. Files under filesDir stay where they are.\n * Call it before migrations, holding the migrate lock. Returns true if it recreated the database.\n */\nexport async function recreateIfOlderThanMinimumUpgradeVersion(db: SqlRunner): Promise<boolean> {\n if (!(await isOlderThanMinimumUpgradeVersion(db))) return false\n console.warn(\n `[seed-protocol] This local database was written by an SDK older than ${MIN_UPGRADE_SDK_VERSION}. ` +\n 'It is being recreated: unpublished items are dropped, and published items come back through EAS sync.',\n )\n await dropAllObjects(db)\n logger('dropped the tables of a database older than %s', MIN_UPGRADE_SDK_VERSION)\n return true\n}\n"],"names":[],"mappings":";;;AAGA,MAAM,MAAM,GA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E,IAAA,IAAI,EAAE,MAAM,gCAAgC,CAAC,EAAE,CAAC,CAAC;AAAE,QAAA,OAAO,KAAK;AAC/D,IAAA,OAAO,CAAC,IAAI,CACV,CAAA,qEAAA,EAAwE,uBAAuB,CAAA,EAAA,CAAI;AACjG,QAAA,uGAAuG,CAC1G;AACD,IAAA,MAAM,cAAc,CAAC,EAAE,CAAC;AACxB,IAAA,MAAM,CAAC,gDAAgD,EAAE,uBAAuB,CAAC;AACjF,IAAA,OAAO,IAAI;AACb;;"}
|
package/dist/{modelPropertyRecordSchemas-C_lYTzMr.js → modelPropertyRecordSchemas-C5lW9aA-.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { eq, inArray } from 'drizzle-orm';
|
|
2
|
-
import {
|
|
3
|
-
import { resolveModelValidationRules } from './propertyValidationRules-
|
|
4
|
-
import { t as timingMarks } from './changeFeed-
|
|
2
|
+
import { R as resolveModelRecord, E as properties, p as models } from './index-Dx_GTdyQ.js';
|
|
3
|
+
import { resolveModelValidationRules } from './propertyValidationRules-CyHdpcPP.js';
|
|
4
|
+
import { t as timingMarks } from './changeFeed-DKdVlUmt.js';
|
|
5
5
|
import 'debug';
|
|
6
6
|
import '@seedprotocol/arweave';
|
|
7
7
|
import '@seedprotocol/eas';
|
|
@@ -11,11 +11,11 @@ import '@sinclair/typebox';
|
|
|
11
11
|
import 'drizzle-orm/sqlite-core';
|
|
12
12
|
import 'nanoid';
|
|
13
13
|
import 'nanoid-dictionary';
|
|
14
|
-
import '@seedprotocol/query';
|
|
15
14
|
import '@noble/hashes/sha256';
|
|
16
15
|
import '@noble/hashes/sha3';
|
|
17
16
|
import '@noble/hashes/utils';
|
|
18
17
|
import 'lodash-es';
|
|
18
|
+
import './eventBus-7vxTCc3a.js';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* One read per model while it's in flight: an item's properties load together and would otherwise
|
|
@@ -91,4 +91,4 @@ const readModelPropertyRecordSchemas = async (modelName, modelFileId, db) => {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
export { loadModelPropertyRecordSchemas };
|
|
94
|
-
//# sourceMappingURL=modelPropertyRecordSchemas-
|
|
94
|
+
//# sourceMappingURL=modelPropertyRecordSchemas-C5lW9aA-.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modelPropertyRecordSchemas-
|
|
1
|
+
{"version":3,"file":"modelPropertyRecordSchemas-C5lW9aA-.js","sources":["../../src/ItemProperty/service/actors/modelPropertyRecordSchemas.ts"],"sourcesContent":["import { eq, inArray } from 'drizzle-orm'\nimport type { BaseDb } from '@/db/Db/BaseDb'\nimport { models, properties } from '@/seedSchema'\nimport { resolveModelRecord } from '@/db/read/resolveModelRecord'\nimport { resolveModelValidationRules } from '@/helpers/propertyValidationRules'\nimport { timingMarks } from '@/helpers/timing'\n\ntype Db = NonNullable<ReturnType<typeof BaseDb.getAppDb>>\n\nexport type PropertyRecordSchema = {\n id: number\n dataType: string\n ref?: string\n refValueType?: string\n storageType?: string\n localStorageDir?: string\n filenameSuffix?: string\n required?: boolean\n validation?: unknown\n}\n\n/**\n * One read per model while it's in flight: an item's properties load together and would otherwise\n * each look up the same model row, properties and schema data. Nothing is kept once the read\n * settles, so a later load sees schema changes.\n */\nconst inFlight = new Map<string, Promise<Map<string, PropertyRecordSchema>>>()\n\n/**\n * Every property's record schema for one model, read from the database (properties table, ref\n * model names, validation rules from the schema), keyed by property name. Empty when the model has\n * no row. Rejects when the model can't be resolved (e.g. an ambiguous name).\n */\nexport function loadModelPropertyRecordSchemas(\n modelName: string,\n modelFileId: string | undefined,\n db: Db,\n): Promise<Map<string, PropertyRecordSchema>> {\n const key = JSON.stringify([modelName, modelFileId ?? null])\n const existing = inFlight.get(key)\n if (existing) return existing\n const read = readModelPropertyRecordSchemas(modelName, modelFileId, db)\n inFlight.set(key, read)\n const forget = () => {\n if (inFlight.get(key) === read) inFlight.delete(key)\n }\n read.then(forget, forget)\n return read\n}\n\nconst readModelPropertyRecordSchemas = async (\n modelName: string,\n modelFileId: string | undefined,\n db: Db,\n): Promise<Map<string, PropertyRecordSchema>> => {\n const schemas = new Map<string, PropertyRecordSchema>()\n const timing = timingMarks()\n const modelRecord = await resolveModelRecord(modelName, { modelFileId }, db)\n timing.mark('model record')\n if (!modelRecord?.id) return schemas\n\n const propertyRecords: (typeof properties.$inferSelect)[] = await db\n .select()\n .from(properties)\n .where(eq(properties.modelId, modelRecord.id))\n // properties has refModelId but not the ref model's name\n const refModelIds = [\n ...new Set(propertyRecords.map((r) => r.refModelId).filter((id): id is number => id != null)),\n ]\n const refModelNames = new Map<number, string>()\n if (refModelIds.length > 0) {\n const refModelRows = await db\n .select({ id: models.id, name: models.name })\n .from(models)\n .where(inArray(models.id, refModelIds))\n for (const row of refModelRows as { id: number; name: string }[]) refModelNames.set(row.id, row.name)\n }\n timing.mark('properties')\n // Validation rules (enum, pattern, ...) aren't in the properties table\n const validationRules = await resolveModelValidationRules(\n modelName,\n propertyRecords.map((r) => r.name),\n { modelFileId: modelRecord.schemaFileId ?? modelFileId },\n )\n\n timing.mark('validation rules')\n timing.log(`model ${modelName} property schemas`)\n\n for (const propRecord of propertyRecords) {\n if (schemas.has(propRecord.name)) continue\n const validation = validationRules.get(propRecord.name)\n schemas.set(propRecord.name, {\n id: propRecord.id,\n dataType: propRecord.dataType,\n ref: propRecord.refModelId != null ? refModelNames.get(propRecord.refModelId) : undefined,\n refValueType: propRecord.refValueType || undefined,\n storageType: propRecord.storageType || undefined,\n localStorageDir: propRecord.localStorageDir || undefined,\n filenameSuffix: propRecord.filenameSuffix || undefined,\n required: (propRecord as { required?: boolean }).required ?? undefined,\n ...(validation ? { validation } : {}),\n })\n }\n return schemas\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA;;;;AAIG;AACH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAsD;AAE9E;;;;AAIG;SACa,8BAA8B,CAC5C,SAAiB,EACjB,WAA+B,EAC/B,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AAU,CAAC,EAAE;YACjB,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,GAAG,EAAE,UAAU,CAAC,UAAU,IAAI,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,SAAS;AACzF,YAAA,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,SAAS;AAClD,YAAA,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;AAChD,YAAA,eAAe,EAAE,UAAU,CAAC,eAAe,IAAI,SAAS;AACxD,YAAA,cAAc,EAAE,UAAU,CAAC,cAAc,IAAI,SAAS;AACtD,YAAA,QAAQ,EAAG,UAAqC,CAAC,QAAQ,IAAI,SAAS;AACtE,YAAA,IAAI,UAAU,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;AACtC,SAAA,CAAC;IACJ;AACA,IAAA,OAAO,OAAO;AAChB,CAAC;;"}
|
package/dist/node.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import { enableMapSet } from 'immer';
|
|
2
|
-
export { C as ConflictError, I as ItemCreateValidationError, M as Model, U as UnknownModelError } from './errors-
|
|
3
|
-
|
|
4
|
-
export { I as AmbiguousModelError, S as INIT_SCRIPT_SUCCESS_MESSAGE, U as SCHEMA_TS, h as appState, k as config, J as eventEmitter, V as getCorrectId, W as isPublishedSeedRef, m as metadata, s as modelUids, t as models, X as normalizeRelationPropertyValue, Y as resolveSeedIdsFromRefString, C as seeds, F as versions } from './index-C0SetTd1.js';
|
|
2
|
+
export { C as ConflictError, I as ItemCreateValidationError, M as Model, U as UnknownModelError } from './errors-D1zHAqjr.js';
|
|
3
|
+
export { A as AmbiguousModelError, P as Property, h as appState, j as config, k as getCorrectId, l as isPublishedSeedRef, m as metadata, o as modelUids, p as models, q as normalizeRelationPropertyValue, r as resolveSeedIdsFromRefString, s as seeds, v as versions } from './index-Dx_GTdyQ.js';
|
|
5
4
|
import 'pluralize';
|
|
6
5
|
import '@seedprotocol/eas';
|
|
7
6
|
import 'drizzle-orm';
|
|
8
|
-
export { I as Item,
|
|
9
|
-
import { c as createPlatformServices } from './index.node-
|
|
10
|
-
export { D as Db, F as FileManager,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import { c as configurePlatform } from './configurePlatform-AWild9o4.js';
|
|
15
|
-
export { B as BasePathResolver } from './configurePlatform-AWild9o4.js';
|
|
16
|
-
import { execSync } from 'child_process';
|
|
17
|
-
import path from 'path';
|
|
7
|
+
export { I as Item, q as ItemProperty, t as ItemPropertySaveValidationError, u as OwnershipError, v as assertItemOwned, x as isItemOwned } from './Item-0oDoTPhi.js';
|
|
8
|
+
import { c as createPlatformServices } from './index.node-CzMwMr_d.js';
|
|
9
|
+
export { D as Db, F as FileManager, r as resolveSdkDrizzleMigrationsDir } from './index.node-CzMwMr_d.js';
|
|
10
|
+
export { C as client, h as getRefValueType, i as importJsonSchema, l as loadSchemaFromFile, r as readJsonImportFile, j as syncSchemaFromSource, k as transformImportToSchemaFile } from './ClientManager-GZfXErDX.js';
|
|
11
|
+
export { e as eventEmitter } from './eventBus-7vxTCc3a.js';
|
|
12
|
+
import { configurePlatform } from './configurePlatform-CrMafpMW.js';
|
|
18
13
|
import 'xstate';
|
|
19
14
|
import 'debug';
|
|
20
15
|
import './model-oHA3YhOd.js';
|
|
@@ -23,228 +18,26 @@ import '@seedprotocol/arweave';
|
|
|
23
18
|
import 'drizzle-orm/sqlite-core';
|
|
24
19
|
import 'nanoid';
|
|
25
20
|
import 'nanoid-dictionary';
|
|
26
|
-
import '@seedprotocol/query';
|
|
27
21
|
import '@noble/hashes/sha256';
|
|
28
22
|
import '@noble/hashes/sha3';
|
|
29
23
|
import '@noble/hashes/utils';
|
|
30
24
|
import 'lodash-es';
|
|
31
|
-
import './changeFeed-
|
|
25
|
+
import './changeFeed-DKdVlUmt.js';
|
|
32
26
|
import 'rxjs';
|
|
33
27
|
import 'fs/promises';
|
|
28
|
+
import 'fs';
|
|
29
|
+
import 'path';
|
|
34
30
|
import 'url';
|
|
35
31
|
import 'node:url';
|
|
36
|
-
import './index-
|
|
32
|
+
import './index-PbnKw2es.js';
|
|
37
33
|
import '@libsql/client';
|
|
38
34
|
import 'drizzle-orm/libsql';
|
|
39
35
|
import 'drizzle-orm/libsql/migrator';
|
|
36
|
+
import './minimumUpgradeVersion-BDhHvHtr.js';
|
|
40
37
|
import '@seedprotocol/arweave/node';
|
|
41
38
|
import '@seedprotocol/eas/node';
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Parses markdown frontmatter from a file
|
|
45
|
-
* @param filePath Path to the markdown file
|
|
46
|
-
* @returns The parsed frontmatter as an object, or null if no frontmatter found
|
|
47
|
-
*/
|
|
48
|
-
const parseMarkdownFrontmatter = (filePath) => {
|
|
49
|
-
const content = readFileSync(filePath, 'utf-8');
|
|
50
|
-
// Check for frontmatter delimiters (more flexible regex)
|
|
51
|
-
// Matches --- at start, optional whitespace, content, ---, optional whitespace
|
|
52
|
-
const frontmatterRegex = /^---\s*\n([\s\S]*?)\n---(\s*\n|$)/;
|
|
53
|
-
const match = content.match(frontmatterRegex);
|
|
54
|
-
if (!match) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
const frontmatterYaml = match[1];
|
|
58
|
-
try {
|
|
59
|
-
const frontmatter = yaml.load(frontmatterYaml);
|
|
60
|
-
return frontmatter;
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
throw new Error(`Failed to parse YAML frontmatter in ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Converts a seed config from frontmatter to ModelDefinitions format
|
|
68
|
-
* @param config The seed configuration from frontmatter
|
|
69
|
-
* @returns ModelDefinitions object ready to be saved to database
|
|
70
|
-
*/
|
|
71
|
-
const processSeedConfig = (config) => {
|
|
72
|
-
if (!config.seed) {
|
|
73
|
-
throw new Error('No seed configuration found in frontmatter');
|
|
74
|
-
}
|
|
75
|
-
const { model: modelName, properties: propertiesConfig } = config.seed;
|
|
76
|
-
if (!modelName) {
|
|
77
|
-
throw new Error('Model name is required in seed configuration');
|
|
78
|
-
}
|
|
79
|
-
if (!propertiesConfig || Object.keys(propertiesConfig).length === 0) {
|
|
80
|
-
throw new Error('Properties are required in seed configuration');
|
|
81
|
-
}
|
|
82
|
-
// Convert property configs to Property definitions
|
|
83
|
-
const schema = {};
|
|
84
|
-
for (const [propertyName, propertyConfig] of Object.entries(propertiesConfig)) {
|
|
85
|
-
const { type, target, itemsType } = propertyConfig;
|
|
86
|
-
if (!type) {
|
|
87
|
-
throw new Error(`Property type is required for ${propertyName}`);
|
|
88
|
-
}
|
|
89
|
-
// Map the type to Property constructor
|
|
90
|
-
switch (type) {
|
|
91
|
-
case ModelPropertyDataTypes.Text:
|
|
92
|
-
schema[propertyName] = Property.Text();
|
|
93
|
-
break;
|
|
94
|
-
case ModelPropertyDataTypes.Number:
|
|
95
|
-
schema[propertyName] = Property.Number();
|
|
96
|
-
break;
|
|
97
|
-
case ModelPropertyDataTypes.Boolean:
|
|
98
|
-
schema[propertyName] = Property.Boolean();
|
|
99
|
-
break;
|
|
100
|
-
case ModelPropertyDataTypes.Date:
|
|
101
|
-
schema[propertyName] = Property.Date();
|
|
102
|
-
break;
|
|
103
|
-
case ModelPropertyDataTypes.Image:
|
|
104
|
-
schema[propertyName] = Property.Image();
|
|
105
|
-
break;
|
|
106
|
-
case ModelPropertyDataTypes.Json:
|
|
107
|
-
schema[propertyName] = Property.Json();
|
|
108
|
-
break;
|
|
109
|
-
case ModelPropertyDataTypes.File:
|
|
110
|
-
schema[propertyName] = Property.File();
|
|
111
|
-
break;
|
|
112
|
-
case ModelPropertyDataTypes.Relation:
|
|
113
|
-
if (!target) {
|
|
114
|
-
throw new Error(`Target model is required for Relation property ${propertyName}`);
|
|
115
|
-
}
|
|
116
|
-
schema[propertyName] = Property.Relation(target);
|
|
117
|
-
break;
|
|
118
|
-
case ModelPropertyDataTypes.List:
|
|
119
|
-
if (itemsType) {
|
|
120
|
-
// List of primitives: itemsType = 'Text', 'Number', etc.
|
|
121
|
-
if (itemsType === ModelPropertyDataTypes.Relation && target) {
|
|
122
|
-
schema[propertyName] = Property.List('Relation', target);
|
|
123
|
-
}
|
|
124
|
-
else if (itemsType !== ModelPropertyDataTypes.Relation) {
|
|
125
|
-
schema[propertyName] = Property.List(itemsType);
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
throw new Error(`List of relations requires target model for property ${propertyName}`);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
else if (target) {
|
|
132
|
-
// Backward compat: target = model name for list of relations
|
|
133
|
-
schema[propertyName] = Property.List('Relation', target);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
throw new Error(`List property ${propertyName} requires either itemsType (e.g. 'Text') or target (model name for list of relations)`);
|
|
137
|
-
}
|
|
138
|
-
break;
|
|
139
|
-
default:
|
|
140
|
-
throw new Error(`Unknown property type: ${type} for property ${propertyName}`);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
// Create a mock ModelClass structure that matches ModelDefinitions
|
|
144
|
-
// This is a simplified version that works with addModelsToInternalDb
|
|
145
|
-
const modelClass = {
|
|
146
|
-
schema,
|
|
147
|
-
// addModelsToDb reads property definitions from the model's snapshot context, not from `schema`;
|
|
148
|
-
// without this it saves the model with no properties (and no Relation/List ref models).
|
|
149
|
-
_getSnapshotContext: () => ({ properties: schema }),
|
|
150
|
-
create: async () => {
|
|
151
|
-
throw new Error('Model.create() should not be called directly');
|
|
152
|
-
},
|
|
153
|
-
originalConstructor: class {
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
return {
|
|
157
|
-
[modelName]: modelClass,
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
/**
|
|
161
|
-
* Reads a markdown file, parses frontmatter, and saves models/properties to database
|
|
162
|
-
* @param filePath Path to the markdown file
|
|
163
|
-
* @param db Database instance (BetterSQLite3Database or SqliteRemoteDatabase)
|
|
164
|
-
* @returns The created ModelDefinitions
|
|
165
|
-
*/
|
|
166
|
-
const saveModelsFromMarkdown = async (filePath, _db) => {
|
|
167
|
-
// Parse frontmatter
|
|
168
|
-
const frontmatter = parseMarkdownFrontmatter(filePath);
|
|
169
|
-
if (!frontmatter) {
|
|
170
|
-
throw new Error(`No frontmatter found in ${filePath}`);
|
|
171
|
-
}
|
|
172
|
-
// Validate and process seed config
|
|
173
|
-
const seedConfig = frontmatter;
|
|
174
|
-
const modelDefinitions = processSeedConfig(seedConfig);
|
|
175
|
-
// Save to database
|
|
176
|
-
await addModelsToDb(modelDefinitions, undefined, undefined, undefined);
|
|
177
|
-
return modelDefinitions;
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Webpack / Next.js config helper for Seed Protocol apps.
|
|
182
|
-
* @deprecated Use `withSeed` from `@seedprotocol/next`, which covers Turbopack and webpack and
|
|
183
|
-
* sets the cross-origin isolation headers.
|
|
184
|
-
*/
|
|
185
|
-
const withSeed = (config, webpack, isServer) => {
|
|
186
|
-
config.plugins.push(new webpack.NormalModuleReplacementPlugin(/node:/, (resource) => {
|
|
187
|
-
resource.request = resource.request.replace(/^node:/, '');
|
|
188
|
-
}));
|
|
189
|
-
if (!isServer) {
|
|
190
|
-
config.resolve.alias['fs'] = '@zenfs/core';
|
|
191
|
-
config.resolve.alias['node:fs'] = '@zenfs/core';
|
|
192
|
-
config.resolve.alias['node:path'] = 'path-browserify';
|
|
193
|
-
config.resolve.alias['path'] = 'path-browserify';
|
|
194
|
-
}
|
|
195
|
-
if (isServer) {
|
|
196
|
-
config.externals.push('@sqlite.org/sqlite-wasm');
|
|
197
|
-
config.externals.push('chokidar');
|
|
198
|
-
config.externals.push('arweave');
|
|
199
|
-
}
|
|
200
|
-
return config;
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
const commandExists = (command) => {
|
|
204
|
-
try {
|
|
205
|
-
execSync(`which ${command}`, { stdio: 'ignore' });
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
catch {
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
/**
|
|
213
|
-
* Finds the seed binary path, trying multiple locations
|
|
214
|
-
* @returns The path to the seed binary, or null if not found
|
|
215
|
-
*/
|
|
216
|
-
const findSeedBinary = () => {
|
|
217
|
-
const cwd = process.cwd();
|
|
218
|
-
const possiblePaths = [
|
|
219
|
-
path.join(cwd, 'node_modules', '.bin', 'seed'),
|
|
220
|
-
path.join(cwd, 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),
|
|
221
|
-
path.join(cwd, '..', 'node_modules', '.bin', 'seed'),
|
|
222
|
-
path.join(cwd, '..', 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),
|
|
223
|
-
path.join(cwd, '..', '..', 'node_modules', '.bin', 'seed'),
|
|
224
|
-
path.join(cwd, '..', '..', 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),
|
|
225
|
-
];
|
|
226
|
-
for (const binPath of possiblePaths) {
|
|
227
|
-
if (fs__default.existsSync(binPath)) {
|
|
228
|
-
return binPath;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return null;
|
|
232
|
-
};
|
|
233
|
-
/**
|
|
234
|
-
* Ensures the Node app DB exists and SDK migrations are applied.
|
|
235
|
-
* (Formerly `runSeedInit`; its CLI spawn / npx fallbacks were removed in 0.5.0, see docs/adr/0018-fixed-sdk-tables-no-runtime-codegen.md.)
|
|
236
|
-
*/
|
|
237
|
-
const ensureNodeDbSchema = async (_schemaFileDir, appFilesDirPath) => {
|
|
238
|
-
if (!appFilesDirPath) {
|
|
239
|
-
throw new Error('ensureNodeDbSchema requires appFilesDirPath');
|
|
240
|
-
}
|
|
241
|
-
await BaseDb.prepareDb(appFilesDirPath);
|
|
242
|
-
};
|
|
243
|
-
/** @deprecated Use ensureNodeDbSchema */
|
|
244
|
-
const runSeedInit = ensureNodeDbSchema;
|
|
39
|
+
import '@seedprotocol/query';
|
|
245
40
|
|
|
246
41
|
configurePlatform(createPlatformServices());
|
|
247
42
|
enableMapSet();
|
|
248
|
-
|
|
249
|
-
export { Property, commandExists, ensureNodeDbSchema, findSeedBinary, parseMarkdownFrontmatter, processSeedConfig, runSeedInit, saveModelsFromMarkdown, withSeed };
|
|
250
43
|
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sources":["../../src/imports/markdown.ts","../../src/node/webpack/index.ts","../../src/node/helpers/scripts.ts","../../src/node/index.ts"],"sourcesContent":["import yaml from 'js-yaml'\nimport { readFileSync } from 'fs'\nimport { Property, ModelPropertyDataTypes } from '@/Schema'\nimport { ModelDefinitions } from '@/types'\nimport { addModelsToDb } from '../helpers/db'\nimport type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3'\nimport { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy'\nimport type { Model } from '@/Model/Model'\n\n/**\n * Configuration structure expected in markdown frontmatter\n */\ntype SeedConfig = {\n seed: {\n model: string\n properties: {\n [propertyName: string]: {\n type: string\n target?: string\n /** For List: element type when primitive (e.g. 'Text', 'Number'). Use target for list of relations. */\n itemsType?: string\n }\n }\n }\n}\n\n/**\n * Parses markdown frontmatter from a file\n * @param filePath Path to the markdown file\n * @returns The parsed frontmatter as an object, or null if no frontmatter found\n */\nexport const parseMarkdownFrontmatter = (\n filePath: string,\n): Record<string, any> | null => {\n const content = readFileSync(filePath, 'utf-8')\n \n // Check for frontmatter delimiters (more flexible regex)\n // Matches --- at start, optional whitespace, content, ---, optional whitespace\n const frontmatterRegex = /^---\\s*\\n([\\s\\S]*?)\\n---(\\s*\\n|$)/\n const match = content.match(frontmatterRegex)\n \n if (!match) {\n return null\n }\n \n const frontmatterYaml = match[1]\n \n try {\n const frontmatter = yaml.load(frontmatterYaml) as Record<string, any>\n return frontmatter\n } catch (error) {\n throw new Error(\n `Failed to parse YAML frontmatter in ${filePath}: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n}\n\n/**\n * Converts a seed config from frontmatter to ModelDefinitions format\n * @param config The seed configuration from frontmatter\n * @returns ModelDefinitions object ready to be saved to database\n */\nexport const processSeedConfig = (config: SeedConfig): ModelDefinitions => {\n if (!config.seed) {\n throw new Error('No seed configuration found in frontmatter')\n }\n \n const { model: modelName, properties: propertiesConfig } = config.seed\n \n if (!modelName) {\n throw new Error('Model name is required in seed configuration')\n }\n \n if (!propertiesConfig || Object.keys(propertiesConfig).length === 0) {\n throw new Error('Properties are required in seed configuration')\n }\n \n // Convert property configs to Property definitions\n const schema: Record<string, any> = {}\n \n for (const [propertyName, propertyConfig] of Object.entries(propertiesConfig)) {\n const { type, target, itemsType } = propertyConfig\n \n if (!type) {\n throw new Error(`Property type is required for ${propertyName}`)\n }\n \n // Map the type to Property constructor\n switch (type) {\n case ModelPropertyDataTypes.Text:\n schema[propertyName] = Property.Text()\n break\n case ModelPropertyDataTypes.Number:\n schema[propertyName] = Property.Number()\n break\n case ModelPropertyDataTypes.Boolean:\n schema[propertyName] = Property.Boolean()\n break\n case ModelPropertyDataTypes.Date:\n schema[propertyName] = Property.Date()\n break\n case ModelPropertyDataTypes.Image:\n schema[propertyName] = Property.Image()\n break\n case ModelPropertyDataTypes.Json:\n schema[propertyName] = Property.Json()\n break\n case ModelPropertyDataTypes.File:\n schema[propertyName] = Property.File()\n break\n case ModelPropertyDataTypes.Relation:\n if (!target) {\n throw new Error(\n `Target model is required for Relation property ${propertyName}`,\n )\n }\n schema[propertyName] = Property.Relation(target)\n break\n case ModelPropertyDataTypes.List:\n if (itemsType) {\n // List of primitives: itemsType = 'Text', 'Number', etc.\n if (itemsType === ModelPropertyDataTypes.Relation && target) {\n schema[propertyName] = Property.List('Relation', target)\n } else if (itemsType !== ModelPropertyDataTypes.Relation) {\n schema[propertyName] = Property.List(itemsType as any)\n } else {\n throw new Error(\n `List of relations requires target model for property ${propertyName}`,\n )\n }\n } else if (target) {\n // Backward compat: target = model name for list of relations\n schema[propertyName] = Property.List('Relation', target)\n } else {\n throw new Error(\n `List property ${propertyName} requires either itemsType (e.g. 'Text') or target (model name for list of relations)`,\n )\n }\n break\n default:\n throw new Error(\n `Unknown property type: ${type} for property ${propertyName}`,\n )\n }\n }\n \n // Create a mock ModelClass structure that matches ModelDefinitions\n // This is a simplified version that works with addModelsToInternalDb\n const modelClass = {\n schema,\n // addModelsToDb reads property definitions from the model's snapshot context, not from `schema`;\n // without this it saves the model with no properties (and no Relation/List ref models).\n _getSnapshotContext: () => ({ properties: schema }),\n create: async () => {\n throw new Error('Model.create() should not be called directly')\n },\n originalConstructor: class {},\n }\n \n return {\n [modelName]: modelClass as any as Model,\n }\n}\n\n/**\n * Reads a markdown file, parses frontmatter, and saves models/properties to database\n * @param filePath Path to the markdown file\n * @param db Database instance (BetterSQLite3Database or SqliteRemoteDatabase)\n * @returns The created ModelDefinitions\n */\nexport const saveModelsFromMarkdown = async (\n filePath: string,\n _db: BetterSQLite3Database<any> | SqliteRemoteDatabase<any>,\n): Promise<ModelDefinitions> => {\n // Parse frontmatter\n const frontmatter = parseMarkdownFrontmatter(filePath)\n \n if (!frontmatter) {\n throw new Error(`No frontmatter found in ${filePath}`)\n }\n \n // Validate and process seed config\n const seedConfig = frontmatter as SeedConfig\n const modelDefinitions = processSeedConfig(seedConfig)\n \n // Save to database\n await addModelsToDb(modelDefinitions, undefined, undefined, undefined)\n \n return modelDefinitions\n}\n","/**\n * Webpack / Next.js config helper for Seed Protocol apps.\n * @deprecated Use `withSeed` from `@seedprotocol/next`, which covers Turbopack and webpack and\n * sets the cross-origin isolation headers.\n */\nexport const withSeed = (config: any, webpack: any, isServer: boolean) => {\n config.plugins.push(\n new webpack.NormalModuleReplacementPlugin(/node:/, (resource: { request: string }) => {\n resource.request = resource.request.replace(/^node:/, '')\n }),\n )\n\n if (!isServer) {\n config.resolve.alias['fs'] = '@zenfs/core'\n config.resolve.alias['node:fs'] = '@zenfs/core'\n config.resolve.alias['node:path'] = 'path-browserify'\n config.resolve.alias['path'] = 'path-browserify'\n }\n\n if (isServer) {\n config.externals.push('@sqlite.org/sqlite-wasm')\n config.externals.push('chokidar')\n config.externals.push('arweave')\n }\n\n return config\n}\n","import { execSync } from 'child_process'\nimport path from 'path'\nimport fs from 'fs'\nimport { BaseDb } from '@/db/Db/BaseDb'\n\nexport const commandExists = (command: string): boolean => {\n try {\n execSync(`which ${command}`, { stdio: 'ignore' })\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Finds the seed binary path, trying multiple locations\n * @returns The path to the seed binary, or null if not found\n */\nexport const findSeedBinary = (): string | null => {\n const cwd = process.cwd()\n\n const possiblePaths = [\n path.join(cwd, 'node_modules', '.bin', 'seed'),\n path.join(cwd, 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n path.join(cwd, '..', 'node_modules', '.bin', 'seed'),\n path.join(cwd, '..', 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n path.join(cwd, '..', '..', 'node_modules', '.bin', 'seed'),\n path.join(cwd, '..', '..', 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n ]\n\n for (const binPath of possiblePaths) {\n if (fs.existsSync(binPath)) {\n return binPath\n }\n }\n\n return null\n}\n\n/**\n * Ensures the Node app DB exists and SDK migrations are applied.\n * (Formerly `runSeedInit`; its CLI spawn / npx fallbacks were removed in 0.5.0, see docs/adr/0018-fixed-sdk-tables-no-runtime-codegen.md.)\n */\nexport const ensureNodeDbSchema = async (\n _schemaFileDir?: string,\n appFilesDirPath?: string\n): Promise<void> => {\n if (!appFilesDirPath) {\n throw new Error('ensureNodeDbSchema requires appFilesDirPath')\n }\n\n await BaseDb.prepareDb(appFilesDirPath)\n}\n\n/** @deprecated Use ensureNodeDbSchema */\nexport const runSeedInit = ensureNodeDbSchema\n","import { enableMapSet } from 'immer'\n\n// Core schema exports\nexport { Model, Property } from '../Schema'\n\n// Core classes\nexport { Item } from '../Item/Item'\nexport { ItemProperty, ItemPropertySaveValidationError } from '../ItemProperty/ItemProperty'\nexport type { IItem, IItemProperty } from '../interfaces'\n\n// Errors\nexport { AmbiguousModelError } from '../Model/errors'\nexport { ItemCreateValidationError, UnknownModelError, type ItemCreateProblem } from '../Item/errors'\nexport { ConflictError, type ConflictResult } from '../Schema/errors'\nexport { OwnershipError, assertItemOwned, isItemOwned } from '../helpers/ownership'\n\n// Node.js specific exports\nexport { FileManager } from './helpers/FileManager'\nexport { Db, resolveSdkDrizzleMigrationsDir } from './db/Db'\n\n// Schema exports\nexport { models, versions, seeds, metadata, appState, config, modelUids } from '../seedSchema'\n\n// Model access - use Model static methods instead\n// Models are accessible via Model.all(), Model.getById(), Model.getByName(), etc.\n\n// Helper exports\nexport { getCorrectId } from '../helpers'\nexport {\n isPublishedSeedRef,\n normalizeRelationPropertyValue,\n resolveSeedIdsFromRefString,\n} from '../helpers/relationSeedRef'\n\n// Import exports\nexport * from '../imports'\n\n// Event bus\nexport { eventEmitter } from '../eventBus'\n\n// Webpack helper\nexport { withSeed } from './webpack'\n\n// Types\n// Note: PublishUpload type is available from '../db/read/getPublishUploads'\n// Type-only exports cause issues with Rollup's parser. Import directly if needed:\n// import type { PublishUpload } from '@seedprotocol/sdk/db/read/getPublishUploads'\n\n// Client\nexport { client } from '../client'\n\n// All types\nexport * from '../types'\nexport type { MultiTabMode } from '../helpers/tabCoordinator'\nexport type { SyncFromEasOptions } from '../events/item/syncDbWithEas'\nexport type { HtmlEmbeddedDataUriPolicy } from '../helpers/property'\n\n// CLI exports\nexport { PathResolver } from './helpers/PathResolver'\nexport { BasePathResolver } from '../helpers/PathResolver/BasePathResolver'\nexport {\n commandExists,\n ensureNodeDbSchema,\n runSeedInit,\n findSeedBinary,\n} from './helpers/scripts'\nexport { INIT_SCRIPT_SUCCESS_MESSAGE, SCHEMA_TS } from '../helpers/constants'\n\n// Side effect imports for CLI — register platform services\nimport { createPlatformServices } from '../platform/index.node'\nimport { configurePlatform } from '../platform/configurePlatform'\nconfigurePlatform(createPlatformServices())\n\nenableMapSet() "],"names":["fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA;;;;AAIG;AACI,MAAM,wBAAwB,GAAG,CACtC,QAAgB,KACc;IAC9B,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;;;IAI/C,MAAM,gBAAgB,GAAG,mCAAmC;IAC5D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAE7C,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,IAAI;IACb;AAEA,IAAA,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC;AAEhC,IAAA,IAAI;QACF,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAwB;AACrE,QAAA,OAAO,WAAW;IACpB;IAAE,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,CAAA,oCAAA,EAAuC,QAAQ,KAAK,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA,CAAE,CAC7G;IACH;AACF;AAEA;;;;AAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,MAAkB,KAAsB;AACxE,IAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;AAChB,QAAA,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC;IAC/D;AAEA,IAAA,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC,IAAI;IAEtE,IAAI,CAAC,SAAS,EAAE;AACd,QAAA,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC;IACjE;AAEA,IAAA,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAA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B;IACF;AAEA,IAAA,OAAO,IAAI;AACb;AAEA;;;AAGG;AACI,MAAM,kBAAkB,GAAG,OAChC,cAAuB,EACvB,eAAwB,KACP;IACjB,IAAI,CAAC,eAAe,EAAE;AACpB,QAAA,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC;IAChE;AAEA,IAAA,MAAM,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC;AACzC;AAEA;AACO,MAAM,WAAW,GAAG;;ACgB3B,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;AAE3C,YAAY,EAAE;;"}
|
|
1
|
+
{"version":3,"file":"node.js","sources":["../../src/node/index.ts"],"sourcesContent":["import { enableMapSet } from 'immer'\n\n// Core schema exports\nexport { Model, Property } from '../Schema'\n\n// Core classes\nexport { Item } from '../Item/Item'\nexport { ItemProperty, ItemPropertySaveValidationError } from '../ItemProperty/ItemProperty'\nexport type { IItem, IItemProperty } from '../interfaces'\n\n// Errors\nexport { AmbiguousModelError } from '../Model/errors'\nexport { ItemCreateValidationError, UnknownModelError, type ItemCreateProblem } from '../Item/errors'\nexport { ConflictError, type ConflictResult } from '../Schema/errors'\nexport { OwnershipError, assertItemOwned, isItemOwned } from '../helpers/ownership'\n\n// Node.js specific exports\nexport { FileManager } from './helpers/FileManager'\nexport { Db, resolveSdkDrizzleMigrationsDir } from './db/Db'\n\n// Schema exports\nexport { models, versions, seeds, metadata, appState, config, modelUids } from '../seedSchema'\n\n// Model access - use Model static methods instead\n// Models are accessible via Model.all(), Model.getById(), Model.getByName(), etc.\n\n// Helper exports\nexport { getCorrectId } from '../helpers'\nexport {\n isPublishedSeedRef,\n normalizeRelationPropertyValue,\n resolveSeedIdsFromRefString,\n} from '../helpers/relationSeedRef'\n\n// Import exports\nexport * from '../imports'\n\n// Event bus\nexport { eventEmitter } from '../eventBus'\n\n// Types\n// Note: PublishUpload type is available from '../db/read/getPublishUploads'\n// Type-only exports cause issues with Rollup's parser. Import directly if needed:\n// import type { PublishUpload } from '@seedprotocol/sdk/db/read/getPublishUploads'\n\n// Client\nexport { client } from '../client'\n\n// All types\nexport * from '../types'\nexport type { MultiTabMode } from '../helpers/tabCoordinator'\nexport type { SyncFromEasOptions } from '../events/item/syncDbWithEas'\nexport type { HtmlEmbeddedDataUriPolicy } from '../helpers/property'\n\n// Register the Node platform services\nimport { createPlatformServices } from '../platform/index.node'\nimport { configurePlatform } from '../platform/configurePlatform'\nconfigurePlatform(createPlatformServices())\n\nenableMapSet() "],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;AAE3C,YAAY,EAAE"}
|
package/dist/platform.browser.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { c as createPlatformServices, r as resolveFilesDir } from './index.browser-
|
|
2
|
-
export {
|
|
3
|
-
import './changeFeed-
|
|
1
|
+
export { c as createPlatformServices, r as resolveFilesDir } from './index.browser-i9uPJice.js';
|
|
2
|
+
export { configurePlatform } from './configurePlatform-CrMafpMW.js';
|
|
3
|
+
import './changeFeed-DKdVlUmt.js';
|
|
4
4
|
import 'debug';
|
|
5
|
-
import './
|
|
5
|
+
import './eventBus-7vxTCc3a.js';
|
|
6
|
+
import './index-Dx_GTdyQ.js';
|
|
6
7
|
import '@seedprotocol/arweave';
|
|
7
8
|
import '@seedprotocol/eas';
|
|
8
9
|
import 'xstate';
|
|
@@ -12,16 +13,16 @@ import 'drizzle-orm/sqlite-core';
|
|
|
12
13
|
import 'drizzle-orm';
|
|
13
14
|
import 'nanoid';
|
|
14
15
|
import 'nanoid-dictionary';
|
|
15
|
-
import '@seedprotocol/query';
|
|
16
16
|
import '@noble/hashes/sha256';
|
|
17
17
|
import '@noble/hashes/sha3';
|
|
18
18
|
import '@noble/hashes/utils';
|
|
19
19
|
import 'lodash-es';
|
|
20
20
|
import './mimeTypes-C9r76DCH.js';
|
|
21
|
-
import './errors-
|
|
21
|
+
import './errors-C1qUEZ7A.js';
|
|
22
22
|
import 'drizzle-orm/sqlite-proxy';
|
|
23
|
-
import './index-
|
|
23
|
+
import './index-PbnKw2es.js';
|
|
24
24
|
import 'sqlocal/drizzle';
|
|
25
|
+
import './minimumUpgradeVersion-BDhHvHtr.js';
|
|
25
26
|
import 'rxjs';
|
|
26
27
|
import 'graphql-request';
|
|
27
28
|
import 'arweave';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.browser.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"platform.browser.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/platform.node.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { c as createPlatformServices, a as resolveFilesDir } from './index.node-
|
|
1
|
+
export { c as createPlatformServices, a as resolveFilesDir } from './index.node-CzMwMr_d.js';
|
|
2
2
|
import '@seedprotocol/arweave/node';
|
|
3
3
|
import '@seedprotocol/eas/node';
|
|
4
|
-
export {
|
|
5
|
-
import '
|
|
4
|
+
export { configurePlatform } from './configurePlatform-CrMafpMW.js';
|
|
5
|
+
import 'fs/promises';
|
|
6
6
|
import 'fs';
|
|
7
|
-
import './index-
|
|
7
|
+
import './index-Dx_GTdyQ.js';
|
|
8
8
|
import 'debug';
|
|
9
9
|
import '@seedprotocol/arweave';
|
|
10
10
|
import '@seedprotocol/eas';
|
|
@@ -15,17 +15,17 @@ import 'drizzle-orm/sqlite-core';
|
|
|
15
15
|
import 'drizzle-orm';
|
|
16
16
|
import 'nanoid';
|
|
17
17
|
import 'nanoid-dictionary';
|
|
18
|
-
import '@seedprotocol/query';
|
|
19
18
|
import '@noble/hashes/sha256';
|
|
20
19
|
import '@noble/hashes/sha3';
|
|
21
20
|
import '@noble/hashes/utils';
|
|
22
21
|
import 'lodash-es';
|
|
23
|
-
import '
|
|
22
|
+
import 'path';
|
|
24
23
|
import 'url';
|
|
25
24
|
import 'node:url';
|
|
26
|
-
import './index-
|
|
25
|
+
import './index-PbnKw2es.js';
|
|
27
26
|
import '@libsql/client';
|
|
28
27
|
import 'drizzle-orm/libsql';
|
|
29
28
|
import 'drizzle-orm/libsql/migrator';
|
|
30
29
|
import 'rxjs';
|
|
30
|
+
import './minimumUpgradeVersion-BDhHvHtr.js';
|
|
31
31
|
//# sourceMappingURL=platform.node.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import pluralize from 'pluralize';
|
|
2
|
-
import {
|
|
3
|
-
export { M as ModelPropertyDataTypes, P as Property, T as THtmlEmbeddedDataUriPolicy, a as TProperty, b as TPropertyConstructor, c as TPropertyDataType, d as TPropertyDefs, e as TStorageType, i as isDataType, n as normalizeDataType } from './index-
|
|
2
|
+
import { L as BaseDb, E as properties, p as models, N as resolveStorageNameToSchemaName, g as normalizePropertyRecordSchema } from './index-Dx_GTdyQ.js';
|
|
3
|
+
export { M as ModelPropertyDataTypes, P as Property, T as THtmlEmbeddedDataUriPolicy, a as TProperty, b as TPropertyConstructor, c as TPropertyDataType, d as TPropertyDefs, e as TStorageType, i as isDataType, n as normalizeDataType } from './index-Dx_GTdyQ.js';
|
|
4
4
|
import { and, eq } from 'drizzle-orm';
|
|
5
5
|
import { modelPropertiesToObject } from './model-oHA3YhOd.js';
|
|
6
6
|
import 'debug';
|
|
@@ -11,7 +11,6 @@ import '@sinclair/typebox';
|
|
|
11
11
|
import 'drizzle-orm/sqlite-core';
|
|
12
12
|
import 'nanoid';
|
|
13
13
|
import 'nanoid-dictionary';
|
|
14
|
-
import '@seedprotocol/query';
|
|
15
14
|
import '@noble/hashes/sha256';
|
|
16
15
|
import '@noble/hashes/sha3';
|
|
17
16
|
import '@noble/hashes/utils';
|
|
@@ -55,16 +54,16 @@ const getPropertySchema = async (modelName, propertyName,
|
|
|
55
54
|
/** Which model is meant when several schemas define one named modelName (Model.id and/or schema). */
|
|
56
55
|
scope = {}) => {
|
|
57
56
|
// Dynamic import to break circular dependency
|
|
58
|
-
const _mod_0 = await import('./errors-
|
|
57
|
+
const _mod_0 = await import('./errors-D1zHAqjr.js');
|
|
59
58
|
const _ns_0 = _mod_0.i;
|
|
60
59
|
const modelMod = _ns_0;
|
|
61
60
|
const { Model } = modelMod;
|
|
62
|
-
const _mod_1 = await import('./Schema-
|
|
63
|
-
const _ns_1 = _mod_1.
|
|
61
|
+
const _mod_1 = await import('./Schema-PFZwG9Nl.js');
|
|
62
|
+
const _ns_1 = _mod_1.a;
|
|
64
63
|
const schemaMod = _ns_1;
|
|
65
64
|
const { Schema } = schemaMod;
|
|
66
|
-
const _mod_2 = await import('./index-
|
|
67
|
-
const _ns_2 = _mod_2.
|
|
65
|
+
const _mod_2 = await import('./index-Dx_GTdyQ.js');
|
|
66
|
+
const _ns_2 = _mod_2.be;
|
|
68
67
|
const { resolveModelRecord } = _ns_2;
|
|
69
68
|
const model = await Model.resolveAsync(modelName, scope);
|
|
70
69
|
if (!model) {
|
|
@@ -287,4 +286,4 @@ scope = {}) => {
|
|
|
287
286
|
};
|
|
288
287
|
|
|
289
288
|
export { getPropertySchema, normalizePropertyRecordSchema };
|
|
290
|
-
//# sourceMappingURL=property-
|
|
289
|
+
//# sourceMappingURL=property-BwYtg5Q_.js.map
|