@seedprotocol/sdk 0.7.3-next.613.g79a8dfd → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{db-CQt-gcAl.js → BasePathResolver-Cm4apKRb.js} +2041 -127
- package/dist/BasePathResolver-Cm4apKRb.js.map +1 -0
- package/dist/{ClientManager-DDA9956Y.js → ClientManager-i3nJASkg.js} +664 -277
- package/dist/ClientManager-i3nJASkg.js.map +1 -0
- package/dist/{Item-D4FigtYS.js → Item-DBFchXpC.js} +495 -219
- package/dist/Item-DBFchXpC.js.map +1 -0
- package/dist/{ModelProperty-BDt6AU2h.js → ModelProperty-BS49g01Y.js} +167 -47
- package/dist/ModelProperty-BS49g01Y.js.map +1 -0
- package/dist/{Schema-B8xqLWkL.js → Schema-CpMNEnUO.js} +53 -42
- package/dist/Schema-CpMNEnUO.js.map +1 -0
- package/dist/{SchemaValidationService-BPxkfDLU.js → SchemaValidationService-DieV4KL-.js} +13 -14
- package/dist/{SchemaValidationService-BPxkfDLU.js.map → SchemaValidationService-DieV4KL-.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-DuTPcv8t.js → backfillMetadataPropertyIds-DSoOoTnX.js} +14 -7
- package/dist/{backfillMetadataPropertyIds-DuTPcv8t.js.map → backfillMetadataPropertyIds-DSoOoTnX.js.map} +1 -1
- package/dist/{configurePlatform-YcOiDQBZ.js → configurePlatform-D0lQGAMQ.js} +8 -7
- package/dist/{configurePlatform-YcOiDQBZ.js.map → configurePlatform-D0lQGAMQ.js.map} +1 -1
- package/dist/detachRowsBeforeDelete-S0q-DJPT.js +50 -0
- package/dist/detachRowsBeforeDelete-S0q-DJPT.js.map +1 -0
- package/dist/{eas-CpOD74Ke.js → eas-6pjU-OuX.js} +9 -8
- package/dist/eas-6pjU-OuX.js.map +1 -0
- package/dist/{getItem-B_OoFkd7.js → getItem-CxBNZ-WL.js} +13 -11
- package/dist/{getItem-B_OoFkd7.js.map → getItem-CxBNZ-WL.js.map} +1 -1
- package/dist/{getPublishPayload-Xl3sRkR-.js → getPublishPayload-CTCvRUoU.js} +50 -18
- package/dist/getPublishPayload-CTCvRUoU.js.map +1 -0
- package/dist/getPublishUploads-SFHCbf_y.js +648 -0
- package/dist/getPublishUploads-SFHCbf_y.js.map +1 -0
- package/dist/{index-Xl1_4Lmb.js → index-8O3Uow-Y.js} +125 -57
- package/dist/index-8O3Uow-Y.js.map +1 -0
- package/dist/{index-CSOQFAOn.js → index-AVFTVp1m.js} +2 -2
- package/dist/index-AVFTVp1m.js.map +1 -0
- package/dist/index-Cvt5UBz4.js +30 -0
- package/dist/index-Cvt5UBz4.js.map +1 -0
- package/dist/{index.browser-CjTe0vt1.js → index.browser-DBhxRoe8.js} +554 -165
- package/dist/index.browser-DBhxRoe8.js.map +1 -0
- package/dist/{index.node-Cfa7npS6.js → index.node-CJhlcNHM.js} +25 -13
- package/dist/index.node-CJhlcNHM.js.map +1 -0
- package/dist/main.js +30 -47
- package/dist/main.js.map +1 -1
- package/dist/mimeTypes-DHAHC4eZ.js +204 -0
- package/dist/mimeTypes-DHAHC4eZ.js.map +1 -0
- package/dist/node.js +19 -21
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +13 -11
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.node.js +18 -5
- package/dist/platform.node.js.map +1 -1
- package/dist/{property-BrXkY1Rg.js → property-DwPD283A.js} +14 -12
- package/dist/property-DwPD283A.js.map +1 -0
- package/dist/{publishDraftGraph-X0Wr9txE.js → publishDraftGraph-BOn3_Occ.js} +6 -9
- package/dist/{publishDraftGraph-X0Wr9txE.js.map → publishDraftGraph-BOn3_Occ.js.map} +1 -1
- package/dist/{resetAmbiguousLegacyItemData-Ci6PM_vC.js → resetAmbiguousLegacyItemData-BkYmBeJc.js} +14 -3
- package/dist/{resetAmbiguousLegacyItemData-Ci6PM_vC.js.map → resetAmbiguousLegacyItemData-BkYmBeJc.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-DFVdnYq8.js → resolveModelForSyncedSeed-BL24nLa7.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-DFVdnYq8.js.map → resolveModelForSyncedSeed-BL24nLa7.js.map} +1 -1
- package/dist/src/Item/Item.d.ts +21 -3
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/Item/service/actors/runPublish.d.ts +11 -2
- package/dist/src/Item/service/actors/runPublish.d.ts.map +1 -1
- package/dist/src/Item/service/itemMachineSingle.d.ts +12 -2
- package/dist/src/Item/service/itemMachineSingle.d.ts.map +1 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts +5 -3
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
- package/dist/src/Model/Model.d.ts +10 -4
- package/dist/src/Model/Model.d.ts.map +1 -1
- package/dist/src/Model/index.d.ts +2 -2
- package/dist/src/ModelProperty/ModelProperty.d.ts +10 -2
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +3 -0
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
- package/dist/src/Schema/Schema.d.ts +2 -2
- package/dist/src/Schema/Schema.d.ts.map +1 -1
- package/dist/src/Schema/index.d.ts +0 -1
- package/dist/src/Schema/index.d.ts.map +1 -1
- package/dist/src/browser/helpers/FileManager.d.ts +4 -1
- package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/browser/helpers/tolerantWebAccess.d.ts +79 -4
- package/dist/src/browser/helpers/tolerantWebAccess.d.ts.map +1 -1
- package/dist/src/browser/workers/FileDownloader.d.ts +19 -4
- 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/ClientManager.d.ts +30 -11
- package/dist/src/client/ClientManager.d.ts.map +1 -1
- package/dist/src/client/actors/platformClassesInit.d.ts +6 -0
- 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/actors/saveConfig.d.ts +13 -6
- package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
- package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
- package/dist/src/db/migrateLegacyItemStorageRows.d.ts +57 -0
- package/dist/src/db/migrateLegacyItemStorageRows.d.ts.map +1 -0
- package/dist/src/db/read/getCompositeChildPaths.d.ts +13 -0
- package/dist/src/db/read/getCompositeChildPaths.d.ts.map +1 -0
- package/dist/src/db/read/getItems.d.ts.map +1 -1
- package/dist/src/db/read/getPublishPayload.d.ts +1 -1
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/read/getPublishUploads.d.ts +32 -3
- package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
- package/dist/src/db/write/claimUnpublishedDrafts.d.ts +2 -0
- package/dist/src/db/write/claimUnpublishedDrafts.d.ts.map +1 -1
- package/dist/src/db/write/convertVerbatimItemStorageRow.d.ts +44 -0
- package/dist/src/db/write/convertVerbatimItemStorageRow.d.ts.map +1 -0
- package/dist/src/db/write/createNewItem.d.ts.map +1 -1
- package/dist/src/eventBus.d.ts +5 -0
- package/dist/src/eventBus.d.ts.map +1 -1
- package/dist/src/events/files/download.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts +3 -3
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/IFileManager.d.ts +25 -1
- package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
- package/dist/src/helpers/arweaveContentTags.d.ts +33 -0
- package/dist/src/helpers/arweaveContentTags.d.ts.map +1 -0
- package/dist/src/helpers/cachedPropertyRefresh.d.ts +12 -0
- package/dist/src/helpers/cachedPropertyRefresh.d.ts.map +1 -0
- package/dist/src/helpers/compositeUpload.d.ts +28 -0
- package/dist/src/helpers/compositeUpload.d.ts.map +1 -0
- package/dist/src/helpers/db.d.ts +3 -0
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/easSdk.d.ts +16 -0
- package/dist/src/helpers/easSdk.d.ts.map +1 -0
- package/dist/src/helpers/entity/detachRowsBeforeDelete.d.ts +16 -0
- package/dist/src/helpers/entity/detachRowsBeforeDelete.d.ts.map +1 -0
- package/dist/src/helpers/entity/entityDestroy.d.ts +2 -0
- package/dist/src/helpers/entity/entityDestroy.d.ts.map +1 -1
- package/dist/src/helpers/itemStorageFile.d.ts +57 -0
- package/dist/src/helpers/itemStorageFile.d.ts.map +1 -0
- package/dist/src/helpers/mapWithConcurrency.d.ts +7 -0
- package/dist/src/helpers/mapWithConcurrency.d.ts.map +1 -0
- package/dist/src/helpers/mimeTypes.d.ts +43 -0
- package/dist/src/helpers/mimeTypes.d.ts.map +1 -0
- package/dist/src/helpers/ownership.d.ts +28 -4
- package/dist/src/helpers/ownership.d.ts.map +1 -1
- package/dist/src/helpers/property/index.d.ts +37 -51
- package/dist/src/helpers/property/index.d.ts.map +1 -1
- package/dist/src/helpers/publishConfig.d.ts +27 -8
- package/dist/src/helpers/publishConfig.d.ts.map +1 -1
- package/dist/src/helpers/storageDir.d.ts +16 -0
- package/dist/src/helpers/storageDir.d.ts.map +1 -0
- package/dist/src/helpers/tabCoordinator.d.ts +5 -1
- package/dist/src/helpers/tabCoordinator.d.ts.map +1 -1
- package/dist/src/helpers/tabEvents.d.ts +23 -2
- package/dist/src/helpers/tabEvents.d.ts.map +1 -1
- package/dist/src/helpers/updateSchema.d.ts +5 -0
- package/dist/src/helpers/updateSchema.d.ts.map +1 -1
- package/dist/src/helpers/waitForEntityIdle.d.ts +5 -0
- package/dist/src/helpers/waitForEntityIdle.d.ts.map +1 -1
- package/dist/src/imports/json.d.ts +9 -0
- package/dist/src/imports/json.d.ts.map +1 -1
- package/dist/src/index.d.ts +11 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/interfaces/IItem.d.ts +7 -1
- package/dist/src/interfaces/IItem.d.ts.map +1 -1
- package/dist/src/node/db/Db.d.ts.map +1 -1
- package/dist/src/node/helpers/PathResolver.d.ts.map +1 -1
- package/dist/src/node/index.d.ts +8 -1
- package/dist/src/node/index.d.ts.map +1 -1
- package/dist/src/platform/index.browser.d.ts +2 -0
- package/dist/src/platform/index.browser.d.ts.map +1 -1
- package/dist/src/platform/index.node.d.ts +2 -0
- package/dist/src/platform/index.node.d.ts.map +1 -1
- package/dist/src/types/fileManager.d.ts +3 -14
- package/dist/src/types/fileManager.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +12 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/machines.d.ts +2 -0
- package/dist/src/types/machines.d.ts.map +1 -1
- package/dist/src/types/property.d.ts +8 -0
- package/dist/src/types/property.d.ts.map +1 -1
- package/dist/src/types/publish.d.ts +14 -0
- package/dist/src/types/publish.d.ts.map +1 -1
- package/dist/{syncDbWithEas-BU-jZ5bJ.js → syncDbWithEas-Bv2Fe38J.js} +17 -17
- package/dist/{syncDbWithEas-BU-jZ5bJ.js.map → syncDbWithEas-Bv2Fe38J.js.map} +1 -1
- package/dist/tabEvents-9s2WCYw-.js +335 -0
- package/dist/tabEvents-9s2WCYw-.js.map +1 -0
- package/dist/tolerantWebAccess-iUu80pAP.js +551 -0
- package/dist/tolerantWebAccess-iUu80pAP.js.map +1 -0
- package/dist/{updateSeedRevokedAt-iLpzae1i.js → updateSeedRevokedAt-zBfi931j.js} +3 -3
- package/dist/{updateSeedRevokedAt-iLpzae1i.js.map → updateSeedRevokedAt-zBfi931j.js.map} +1 -1
- package/package.json +11 -12
- package/src/node/easLodashRegister.js +4 -0
- package/dist/BasePathResolver-BdxCSIzn.js +0 -679
- package/dist/BasePathResolver-BdxCSIzn.js.map +0 -1
- package/dist/ClientManager-DDA9956Y.js.map +0 -1
- package/dist/Item-D4FigtYS.js.map +0 -1
- package/dist/ModelProperty-BDt6AU2h.js.map +0 -1
- package/dist/Schema-B8xqLWkL.js.map +0 -1
- package/dist/cjs/ModelProperty-B-cZm1yU.js +0 -1977
- package/dist/cjs/ModelProperty-B-cZm1yU.js.map +0 -1
- package/dist/cjs/Schema-STP972Xw.js +0 -5256
- package/dist/cjs/Schema-STP972Xw.js.map +0 -1
- package/dist/cjs/SchemaValidationService-CKNW1bKg.js +0 -778
- package/dist/cjs/SchemaValidationService-CKNW1bKg.js.map +0 -1
- package/dist/cjs/backfillMetadataPropertyIds-CP3y1skt.js +0 -89
- package/dist/cjs/backfillMetadataPropertyIds-CP3y1skt.js.map +0 -1
- package/dist/cjs/eas-CAnUC4wd.js +0 -138
- package/dist/cjs/eas-CAnUC4wd.js.map +0 -1
- package/dist/cjs/getItem-CWgb3e9G.js +0 -58
- package/dist/cjs/getItem-CWgb3e9G.js.map +0 -1
- package/dist/cjs/getPublishPayload-BsZWiJ03.js +0 -1603
- package/dist/cjs/getPublishPayload-BsZWiJ03.js.map +0 -1
- package/dist/cjs/getPublishUploads-BQr8aMVP.js +0 -495
- package/dist/cjs/getPublishUploads-BQr8aMVP.js.map +0 -1
- package/dist/cjs/index-nA5PxBSs.js +0 -70
- package/dist/cjs/index-nA5PxBSs.js.map +0 -1
- package/dist/cjs/index-usKaANAq.js +0 -22171
- package/dist/cjs/index-usKaANAq.js.map +0 -1
- package/dist/cjs/index.browser-BSf8HpnU.js +0 -22
- package/dist/cjs/index.browser-BSf8HpnU.js.map +0 -1
- package/dist/cjs/property-xMwPhQ5N.js +0 -327
- package/dist/cjs/property-xMwPhQ5N.js.map +0 -1
- package/dist/cjs/publishDraftGraph-BRWlR1KO.js +0 -403
- package/dist/cjs/publishDraftGraph-BRWlR1KO.js.map +0 -1
- package/dist/cjs/resetAmbiguousLegacyItemData-8nfkj9rz.js +0 -116
- package/dist/cjs/resetAmbiguousLegacyItemData-8nfkj9rz.js.map +0 -1
- package/dist/cjs/resolveModelForSyncedSeed-kYRuDWYw.js +0 -49
- package/dist/cjs/resolveModelForSyncedSeed-kYRuDWYw.js.map +0 -1
- package/dist/cjs/syncDbWithEas-DqRhV8o2.js +0 -886
- package/dist/cjs/syncDbWithEas-DqRhV8o2.js.map +0 -1
- package/dist/db-CQt-gcAl.js.map +0 -1
- package/dist/eas-CpOD74Ke.js.map +0 -1
- package/dist/getPublishPayload-Xl3sRkR-.js.map +0 -1
- package/dist/getPublishUploads-DHP01KgU.js +0 -484
- package/dist/getPublishUploads-DHP01KgU.js.map +0 -1
- package/dist/index-BGt4_oPO.js +0 -31
- package/dist/index-BGt4_oPO.js.map +0 -1
- package/dist/index-CSOQFAOn.js.map +0 -1
- package/dist/index-Xl1_4Lmb.js.map +0 -1
- package/dist/index.browser-CjTe0vt1.js.map +0 -1
- package/dist/index.node-Cfa7npS6.js.map +0 -1
- package/dist/main.cjs +0 -84
- package/dist/main.cjs.map +0 -1
- package/dist/property-BrXkY1Rg.js.map +0 -1
- package/dist/tabEvents-BZJMY5uK.js +0 -1344
- package/dist/tabEvents-BZJMY5uK.js.map +0 -1
- package/dist/tolerantWebAccess-BZ2RA_mb.js +0 -160
- package/dist/tolerantWebAccess-BZ2RA_mb.js.map +0 -1
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { fromCallback, setup, assign, createActor } from 'xstate';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { O as addSchemaToDb, k as isDataType, M as ModelPropertyDataTypes, w as addModelsToDb, S as loadModelsFromDbForSchema } from './db-CQt-gcAl.js';
|
|
5
|
-
import { F as SEED_PROTOCOL_SCHEMA_NAME, a as BaseDb, s as schemas, j as models, g as modelSchemas, p as properties, B as BaseFileManager, K as isInternalSchema } from './BasePathResolver-BdxCSIzn.js';
|
|
2
|
+
import { g as getRefValueType, G as createModelsFromJson, p as listCompleteSchemaFiles, H as getLatestSchemaVersion, l as loadSchemaFromFile, J as jsonPropertiesToSchemaProperties, q as loadAllSchemasFromDb, k as getClient } from './ClientManager-i3nJASkg.js';
|
|
3
|
+
import { aq as SEED_PROTOCOL_SCHEMA_NAME, E as BaseDb, z as schemas, aI as addSchemaToDb, i as isDataType, M as ModelPropertyDataTypes, $ as generateId, a2 as addModelsToDb, s as models, q as modelSchemas, u as properties, J as BaseFileManager, aK as loadModelsFromDbForSchema, aF as isInternalSchema } from './BasePathResolver-Cm4apKRb.js';
|
|
6
4
|
import { eq, desc, and } from 'drizzle-orm';
|
|
7
5
|
import debug from 'debug';
|
|
8
|
-
import { c as currentEvictionEpoch, w as writeProcessMachine, M as Model, C as ConflictError, d as setupEntityLiveQuery } from './index-
|
|
6
|
+
import { c as currentEvictionEpoch, w as writeProcessMachine, M as Model, C as ConflictError, d as setupEntityLiveQuery } from './index-8O3Uow-Y.js';
|
|
9
7
|
import 'pluralize';
|
|
10
|
-
import { SchemaValidationService } from './SchemaValidationService-
|
|
11
|
-
import {
|
|
8
|
+
import { SchemaValidationService } from './SchemaValidationService-DieV4KL-.js';
|
|
9
|
+
import { D as DEFAULT_READY_TIMEOUT_MS, n as waitForEntityIdle, o as createReactiveProxy, q as findEntity, C as ClientManagerState, a0 as clearDestroySubscriptions, t as forceRemoveFromCaches, a1 as unloadEntity, u as runDestroyLifecycle } from './Item-DBFchXpC.js';
|
|
12
10
|
|
|
13
11
|
const logger$d = debug('seedSdk:schema:actors:loadOrCreateSchema');
|
|
14
12
|
/**
|
|
@@ -52,7 +50,7 @@ const createModelInstances$2 = async (modelIds, evictionEpoch) => {
|
|
|
52
50
|
return;
|
|
53
51
|
}
|
|
54
52
|
try {
|
|
55
|
-
const _mod_0 = await import('./index-
|
|
53
|
+
const _mod_0 = await import('./index-8O3Uow-Y.js');
|
|
56
54
|
const _ns_0 = _mod_0.f;
|
|
57
55
|
const modelMod = _ns_0;
|
|
58
56
|
const { Model } = modelMod;
|
|
@@ -169,7 +167,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
169
167
|
// For Seed Protocol, always load from internal file, never create new
|
|
170
168
|
logger$d(`Loading internal Seed Protocol schema from SDK`);
|
|
171
169
|
try {
|
|
172
|
-
const _mod_1 = await import('./ClientManager-
|
|
170
|
+
const _mod_1 = await import('./ClientManager-i3nJASkg.js');
|
|
173
171
|
const _ns_1 = _mod_1.S;
|
|
174
172
|
const internalSchema = _ns_1;
|
|
175
173
|
const schemaFile = internalSchema.default;
|
|
@@ -664,7 +662,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
664
662
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
665
663
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
666
664
|
try {
|
|
667
|
-
const _mod_2 = await import('./ClientManager-
|
|
665
|
+
const _mod_2 = await import('./ClientManager-i3nJASkg.js');
|
|
668
666
|
const _ns_2 = _mod_2.S;
|
|
669
667
|
const internalSchema = _ns_2;
|
|
670
668
|
const internalSchemaFile = internalSchema.default;
|
|
@@ -893,7 +891,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
893
891
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
894
892
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
895
893
|
try {
|
|
896
|
-
const _mod_3 = await import('./ClientManager-
|
|
894
|
+
const _mod_3 = await import('./ClientManager-i3nJASkg.js');
|
|
897
895
|
const _ns_3 = _mod_3.S;
|
|
898
896
|
const internalSchema = _ns_3;
|
|
899
897
|
const internalSchemaFile = internalSchema.default;
|
|
@@ -984,7 +982,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
984
982
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
985
983
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
986
984
|
try {
|
|
987
|
-
const _mod_4 = await import('./ClientManager-
|
|
985
|
+
const _mod_4 = await import('./ClientManager-i3nJASkg.js');
|
|
988
986
|
const _ns_4 = _mod_4.S;
|
|
989
987
|
const internalSchema = _ns_4;
|
|
990
988
|
const internalSchemaFile = internalSchema.default;
|
|
@@ -1072,7 +1070,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1072
1070
|
// If schemaData is missing, try to load from internal schema file for seed-protocol
|
|
1073
1071
|
if (!dbSchema.schemaData && schemaName === 'Seed Protocol') {
|
|
1074
1072
|
try {
|
|
1075
|
-
const _mod_5 = await import('./ClientManager-
|
|
1073
|
+
const _mod_5 = await import('./ClientManager-i3nJASkg.js');
|
|
1076
1074
|
const _ns_5 = _mod_5.S;
|
|
1077
1075
|
const internalSchema = _ns_5;
|
|
1078
1076
|
const schemaFile = internalSchema.default;
|
|
@@ -1183,7 +1181,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1183
1181
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
1184
1182
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
1185
1183
|
try {
|
|
1186
|
-
const _mod_6 = await import('./ClientManager-
|
|
1184
|
+
const _mod_6 = await import('./ClientManager-i3nJASkg.js');
|
|
1187
1185
|
const _ns_6 = _mod_6.S;
|
|
1188
1186
|
const internalSchema = _ns_6;
|
|
1189
1187
|
const internalSchemaFile = internalSchema.default;
|
|
@@ -1510,7 +1508,7 @@ const createModelInstances$1 = async (modelIds, evictionEpoch) => {
|
|
|
1510
1508
|
return;
|
|
1511
1509
|
}
|
|
1512
1510
|
try {
|
|
1513
|
-
const _mod_7 = await import('./index-
|
|
1511
|
+
const _mod_7 = await import('./index-8O3Uow-Y.js');
|
|
1514
1512
|
const _ns_7 = _mod_7.f;
|
|
1515
1513
|
const mod = _ns_7;
|
|
1516
1514
|
const Model = mod?.Model ?? mod?.default;
|
|
@@ -1559,7 +1557,7 @@ const checkExistingSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1559
1557
|
if (isInternal && schemaName === SEED_PROTOCOL_SCHEMA_NAME) {
|
|
1560
1558
|
// For Seed Protocol, check if it exists in database
|
|
1561
1559
|
try {
|
|
1562
|
-
const _mod_8 = await import('./ClientManager-
|
|
1560
|
+
const _mod_8 = await import('./ClientManager-i3nJASkg.js');
|
|
1563
1561
|
const _ns_8 = _mod_8.S;
|
|
1564
1562
|
const internalSchema = _ns_8;
|
|
1565
1563
|
const schemaFile = internalSchema.default;
|
|
@@ -1919,7 +1917,7 @@ const writeSchemaToDb = fromCallback(({ sendBack, input }) => {
|
|
|
1919
1917
|
if (isInternal && schemaName === SEED_PROTOCOL_SCHEMA_NAME) {
|
|
1920
1918
|
// For Seed Protocol, load from internal file
|
|
1921
1919
|
logger$b(`Loading internal Seed Protocol schema from SDK`);
|
|
1922
|
-
const _mod_9 = await import('./ClientManager-
|
|
1920
|
+
const _mod_9 = await import('./ClientManager-i3nJASkg.js');
|
|
1923
1921
|
const _ns_9 = _mod_9.S;
|
|
1924
1922
|
const internalSchema = _ns_9;
|
|
1925
1923
|
finalSchema = internalSchema.default;
|
|
@@ -2390,7 +2388,7 @@ const createModelInstances = fromCallback(({ sendBack, input }) => {
|
|
|
2390
2388
|
return;
|
|
2391
2389
|
}
|
|
2392
2390
|
try {
|
|
2393
|
-
const _mod_10 = await import('./index-
|
|
2391
|
+
const _mod_10 = await import('./index-8O3Uow-Y.js');
|
|
2394
2392
|
const _ns_10 = _mod_10.f;
|
|
2395
2393
|
const modelMod = _ns_10;
|
|
2396
2394
|
const { Model } = modelMod;
|
|
@@ -2479,7 +2477,7 @@ const verifyModelInstancesInCache = fromCallback(({ sendBack, input }) => {
|
|
|
2479
2477
|
}
|
|
2480
2478
|
try {
|
|
2481
2479
|
const result = await verifyWithRetry$2(async () => {
|
|
2482
|
-
const _mod_11 = await import('./index-
|
|
2480
|
+
const _mod_11 = await import('./index-8O3Uow-Y.js');
|
|
2483
2481
|
const _ns_11 = _mod_11.f;
|
|
2484
2482
|
const modelMod = _ns_11;
|
|
2485
2483
|
const { Model } = modelMod;
|
|
@@ -2538,8 +2536,8 @@ const writePropertiesToDb = fromCallback(({ sendBack, input }) => {
|
|
|
2538
2536
|
const _write = async () => {
|
|
2539
2537
|
const { modelIds } = input;
|
|
2540
2538
|
try {
|
|
2541
|
-
const _mod_12 = await import('./BasePathResolver-
|
|
2542
|
-
const _ns_12 = _mod_12.
|
|
2539
|
+
const _mod_12 = await import('./BasePathResolver-Cm4apKRb.js');
|
|
2540
|
+
const _ns_12 = _mod_12.aZ;
|
|
2543
2541
|
const modelSchemaMod = _ns_12;
|
|
2544
2542
|
const { models: modelsTable, properties: propertiesTable } = modelSchemaMod;
|
|
2545
2543
|
const drizzleMod = await import('drizzle-orm');
|
|
@@ -2728,9 +2726,9 @@ const createPropertyInstances = fromCallback(({ sendBack, input }) => {
|
|
|
2728
2726
|
return;
|
|
2729
2727
|
}
|
|
2730
2728
|
try {
|
|
2731
|
-
const modProp = await import('./ModelProperty-
|
|
2729
|
+
const modProp = await import('./ModelProperty-BS49g01Y.js');
|
|
2732
2730
|
const ModelProperty = modProp?.ModelProperty ?? modProp?.default;
|
|
2733
|
-
const _mod_13 = await import('./index-
|
|
2731
|
+
const _mod_13 = await import('./index-8O3Uow-Y.js');
|
|
2734
2732
|
const _ns_13 = _mod_13.f;
|
|
2735
2733
|
const modModel = _ns_13;
|
|
2736
2734
|
const Model = modModel?.Model ?? modModel?.default;
|
|
@@ -2837,7 +2835,7 @@ const verifyPropertyInstancesInCache = fromCallback(({ sendBack, input }) => {
|
|
|
2837
2835
|
}
|
|
2838
2836
|
try {
|
|
2839
2837
|
const result = await verifyWithRetry(async () => {
|
|
2840
|
-
const mod = await import('./ModelProperty-
|
|
2838
|
+
const mod = await import('./ModelProperty-BS49g01Y.js');
|
|
2841
2839
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
2842
2840
|
if (!ModelProperty) {
|
|
2843
2841
|
throw new Error('ModelProperty not available from dynamic import');
|
|
@@ -3445,6 +3443,8 @@ const schemaMachine = setup({
|
|
|
3445
3443
|
});
|
|
3446
3444
|
|
|
3447
3445
|
const logger$1 = debug('seedSdk:helpers:updateSchema');
|
|
3446
|
+
// Schema reloads renameModelProperty deferred and that haven't finished yet
|
|
3447
|
+
const deferredSchemaReloads = new Set();
|
|
3448
3448
|
/**
|
|
3449
3449
|
* Get the file path for a schema file
|
|
3450
3450
|
*/
|
|
@@ -3750,17 +3750,24 @@ async function loadSchemaWithRenames(schemaFilePath, modelRenames) {
|
|
|
3750
3750
|
updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
|
|
3751
3751
|
};
|
|
3752
3752
|
// Use dynamic import to break circular dependency
|
|
3753
|
-
const _mod_14 = await import('./
|
|
3754
|
-
const _ns_14 = _mod_14.
|
|
3753
|
+
const _mod_14 = await import('./BasePathResolver-Cm4apKRb.js');
|
|
3754
|
+
const _ns_14 = _mod_14.b2;
|
|
3755
3755
|
const dbMod = _ns_14;
|
|
3756
3756
|
const { addSchemaToDb, addModelsToDb } = dbMod;
|
|
3757
3757
|
// Add schema to database with schemaFileId
|
|
3758
3758
|
const schemaRecord = await addSchemaToDb(schemaInput, schemaFile.id);
|
|
3759
|
+
// A cached Model keeps the properties it was created with (Model.create ignores the ones passed),
|
|
3760
|
+
// so addModelsToDb must take changed properties from this file, as in loadSchemaFromFile
|
|
3761
|
+
const propertyDefinitions = new Map(Object.entries(importData.models).map(([modelName, modelDef]) => [
|
|
3762
|
+
modelName,
|
|
3763
|
+
jsonPropertiesToSchemaProperties(modelName, modelDef, propertyFileIds.get(modelName)),
|
|
3764
|
+
]));
|
|
3759
3765
|
// Add models to database with model renames handled and schemaFileIds
|
|
3760
3766
|
await addModelsToDb(modelDefinitions, schemaRecord, modelRenames, {
|
|
3761
3767
|
schemaFileId: schemaFile.id,
|
|
3762
3768
|
modelFileIds,
|
|
3763
3769
|
propertyFileIds,
|
|
3770
|
+
propertyDefinitions,
|
|
3764
3771
|
});
|
|
3765
3772
|
// Models are now Model instances, no registration needed
|
|
3766
3773
|
// They should be created via Model.create() and are accessible via Model static methods
|
|
@@ -3863,8 +3870,8 @@ async function renameModelProperty(schemaName, modelName, oldPropertyName, newPr
|
|
|
3863
3870
|
await BaseFileManager.waitForFileWithContent(newFilePath);
|
|
3864
3871
|
logger$1(`Renamed property ${oldPropertyName} to ${newPropertyName} in schema ${schemaName} v${newVersion}`);
|
|
3865
3872
|
// Migrate metadata rows so ItemProperty values follow the new name (prevents duplicate ItemProperties)
|
|
3866
|
-
const _mod_15 = await import('./
|
|
3867
|
-
const _ns_15 = _mod_15.
|
|
3873
|
+
const _mod_15 = await import('./BasePathResolver-Cm4apKRb.js');
|
|
3874
|
+
const _ns_15 = _mod_15.b2;
|
|
3868
3875
|
const { migrateMetadataForPropertyRename } = _ns_15;
|
|
3869
3876
|
const migratedCount = await migrateMetadataForPropertyRename(modelName, oldPropertyName, newPropertyName, oldProperty.id, { schemaName });
|
|
3870
3877
|
if (migratedCount > 0) {
|
|
@@ -3873,11 +3880,13 @@ async function renameModelProperty(schemaName, modelName, oldPropertyName, newPr
|
|
|
3873
3880
|
// Defer loadSchemaFromFile to avoid sync cascade: it triggers addSchemaToDb/addModelsToDb,
|
|
3874
3881
|
// which post to BroadcastChannel and cause React invalidates. Running that synchronously
|
|
3875
3882
|
// can interrupt the save flow and cause freezes (e.g. updateContext/refetch loops).
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
}
|
|
3883
|
+
const reload = new Promise((resolve) => setTimeout(resolve, 100))
|
|
3884
|
+
.then(() => loadSchemaFromFile(newFilePath))
|
|
3885
|
+
.then(() => { }, (err) => {
|
|
3886
|
+
logger$1('Deferred loadSchemaFromFile after rename failed:', err);
|
|
3887
|
+
})
|
|
3888
|
+
.finally(() => deferredSchemaReloads.delete(reload));
|
|
3889
|
+
deferredSchemaReloads.add(reload);
|
|
3881
3890
|
return newFilePath;
|
|
3882
3891
|
}
|
|
3883
3892
|
/**
|
|
@@ -4167,7 +4176,7 @@ class Schema {
|
|
|
4167
4176
|
throw new Error('Schema name is required');
|
|
4168
4177
|
}
|
|
4169
4178
|
const waitForReady = options?.waitForReady !== false;
|
|
4170
|
-
const readyTimeout = options?.readyTimeout ??
|
|
4179
|
+
const readyTimeout = options?.readyTimeout ?? DEFAULT_READY_TIMEOUT_MS;
|
|
4171
4180
|
// First, check if we have an instance cached by name
|
|
4172
4181
|
if (this.instanceCacheByName.has(schemaName)) {
|
|
4173
4182
|
const { instance, refCount } = this.instanceCacheByName.get(schemaName);
|
|
@@ -4522,7 +4531,7 @@ class Schema {
|
|
|
4522
4531
|
* @param options - Find options including schemaFileId and wait configuration
|
|
4523
4532
|
* @returns Schema instance if found, undefined otherwise
|
|
4524
4533
|
*/
|
|
4525
|
-
static async find({ schemaFileId, waitForReady = true, readyTimeout =
|
|
4534
|
+
static async find({ schemaFileId, waitForReady = true, readyTimeout = DEFAULT_READY_TIMEOUT_MS, }) {
|
|
4526
4535
|
if (!schemaFileId) {
|
|
4527
4536
|
return undefined;
|
|
4528
4537
|
}
|
|
@@ -4550,7 +4559,7 @@ class Schema {
|
|
|
4550
4559
|
* @returns Array of Schema instances
|
|
4551
4560
|
*/
|
|
4552
4561
|
static async all(options = {}) {
|
|
4553
|
-
const { includeAllVersions = false, includeInternal = false, waitForReady = false, readyTimeout =
|
|
4562
|
+
const { includeAllVersions = false, includeInternal = false, waitForReady = false, readyTimeout = DEFAULT_READY_TIMEOUT_MS, } = options;
|
|
4554
4563
|
try {
|
|
4555
4564
|
// Use loadAllSchemasFromDb as single source of truth
|
|
4556
4565
|
// This intelligently merges database and file data, including drafts
|
|
@@ -4970,7 +4979,7 @@ class Schema {
|
|
|
4970
4979
|
_dbVersion: publishedSchema.version,
|
|
4971
4980
|
});
|
|
4972
4981
|
// Clear edited flags on all ModelProperty instances and in database
|
|
4973
|
-
const modelPropertyMod = await import('./ModelProperty-
|
|
4982
|
+
const modelPropertyMod = await import('./ModelProperty-BS49g01Y.js');
|
|
4974
4983
|
const { ModelProperty } = modelPropertyMod;
|
|
4975
4984
|
for (const propertyKey of context._editedProperties) {
|
|
4976
4985
|
const [modelName, propertyName] = propertyKey.split(':');
|
|
@@ -4994,8 +5003,8 @@ class Schema {
|
|
|
4994
5003
|
try {
|
|
4995
5004
|
if (db && modelName && propertyName) {
|
|
4996
5005
|
// Find this schema's model by name
|
|
4997
|
-
const _mod_16 = await import('./
|
|
4998
|
-
const _ns_16 = _mod_16.
|
|
5006
|
+
const _mod_16 = await import('./BasePathResolver-Cm4apKRb.js');
|
|
5007
|
+
const _ns_16 = _mod_16.b1;
|
|
4999
5008
|
const { resolveModelRecord } = _ns_16;
|
|
5000
5009
|
const modelRecord = await resolveModelRecord(modelName, { schemaName: thisSchemaName }, db);
|
|
5001
5010
|
const modelRecords = modelRecord ? [modelRecord] : [];
|
|
@@ -5605,10 +5614,10 @@ class Schema {
|
|
|
5605
5614
|
// instances too, or a re-import would get them back with dangling _dbIds.
|
|
5606
5615
|
if (schemaName) {
|
|
5607
5616
|
const evictedModelNames = Model.evictForSchema(schemaName);
|
|
5608
|
-
const { ModelProperty } = await import('./ModelProperty-
|
|
5617
|
+
const { ModelProperty } = await import('./ModelProperty-BS49g01Y.js');
|
|
5609
5618
|
ModelProperty.evictForModels(evictedModelNames, schemaName);
|
|
5610
5619
|
// Evicting stops new writes but not ones already running; let those land before deleting their rows
|
|
5611
|
-
const _mod_17 = await import('./index-
|
|
5620
|
+
const _mod_17 = await import('./index-8O3Uow-Y.js');
|
|
5612
5621
|
const _ns_17 = _mod_17.e;
|
|
5613
5622
|
const { waitForInFlightWrites } = _ns_17;
|
|
5614
5623
|
await waitForInFlightWrites();
|
|
@@ -5641,6 +5650,8 @@ class Schema {
|
|
|
5641
5650
|
.map((r) => r.modelId)
|
|
5642
5651
|
.filter((id) => id != null)),
|
|
5643
5652
|
];
|
|
5653
|
+
const { detachModelRows } = await import('./detachRowsBeforeDelete-S0q-DJPT.js');
|
|
5654
|
+
await detachModelRows(db, modelIds);
|
|
5644
5655
|
await db.delete(modelSchemas).where(inArray(modelSchemas.schemaId, schemaIds));
|
|
5645
5656
|
for (const modelId of modelIds) {
|
|
5646
5657
|
await db.delete(properties).where(eq(properties.modelId, modelId));
|
|
@@ -5834,4 +5845,4 @@ var Schema$1 = /*#__PURE__*/Object.freeze({
|
|
|
5834
5845
|
});
|
|
5835
5846
|
|
|
5836
5847
|
export { Schema as S, deletePropertyFromModel as a, Schema$1 as b, deleteModelFromSchema as d, renameModelProperty as r, schemaMachine as s, updateModelProperties as u };
|
|
5837
|
-
//# sourceMappingURL=Schema-
|
|
5848
|
+
//# sourceMappingURL=Schema-CpMNEnUO.js.map
|