@seedprotocol/sdk 0.7.0 → 0.7.2-next.593.gd5bd4ea
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/{BasePathResolver-ndE8XTpw.js → BasePathResolver-BdxCSIzn.js} +2 -2
- package/dist/{BasePathResolver-ndE8XTpw.js.map → BasePathResolver-BdxCSIzn.js.map} +1 -1
- package/dist/{ClientManager-DLleL_2e.js → ClientManager-ClCwwhwo.js} +28 -23
- package/dist/ClientManager-ClCwwhwo.js.map +1 -0
- package/dist/{Item-zBFWQDU9.js → Item-B9Y4VuK1.js} +140 -74
- package/dist/Item-B9Y4VuK1.js.map +1 -0
- package/dist/{ModelProperty-lth9L37R.js → ModelProperty-BMePcicQ.js} +64 -36
- package/dist/ModelProperty-BMePcicQ.js.map +1 -0
- package/dist/{Schema-DOhlrQ-N.js → Schema-COsEXXaR.js} +106 -58
- package/dist/Schema-COsEXXaR.js.map +1 -0
- package/dist/{SchemaValidationService-DDKr5piy.js → SchemaValidationService-DabGMzSE.js} +7 -8
- package/dist/{SchemaValidationService-DDKr5piy.js.map → SchemaValidationService-DabGMzSE.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-fG3ujaSh.js → backfillMetadataPropertyIds-Ck6fumnm.js} +4 -4
- package/dist/{backfillMetadataPropertyIds-fG3ujaSh.js.map → backfillMetadataPropertyIds-Ck6fumnm.js.map} +1 -1
- package/dist/cjs/{ModelProperty-BEsIHAjk.js → ModelProperty-BT6Un_MB.js} +59 -30
- package/dist/cjs/ModelProperty-BT6Un_MB.js.map +1 -0
- package/dist/cjs/{Schema-qEp5mH1N.js → Schema-BXhXdUsA.js} +93 -44
- package/dist/cjs/Schema-BXhXdUsA.js.map +1 -0
- package/dist/cjs/{SchemaValidationService-CWEnZmOH.js → SchemaValidationService-CC18QDfc.js} +2 -2
- package/dist/cjs/{SchemaValidationService-CWEnZmOH.js.map → SchemaValidationService-CC18QDfc.js.map} +1 -1
- package/dist/cjs/{backfillMetadataPropertyIds-tw8JGMT0.js → backfillMetadataPropertyIds-DEHC9ejq.js} +3 -3
- package/dist/cjs/{backfillMetadataPropertyIds-tw8JGMT0.js.map → backfillMetadataPropertyIds-DEHC9ejq.js.map} +1 -1
- package/dist/cjs/{eas-CLiV2Hmn.js → eas-C3CL0l7l.js} +3 -3
- package/dist/cjs/{eas-CLiV2Hmn.js.map → eas-C3CL0l7l.js.map} +1 -1
- package/dist/cjs/{getItem-DSRtx_68.js → getItem-CrwWYCkj.js} +2 -2
- package/dist/cjs/{getItem-DSRtx_68.js.map → getItem-CrwWYCkj.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-D5-dYtNq.js → getPublishPayload-DRJh7WR0.js} +171 -209
- package/dist/cjs/getPublishPayload-DRJh7WR0.js.map +1 -0
- package/dist/cjs/{getPublishUploads-B5Lq6q-_.js → getPublishUploads-Bh22D3zJ.js} +49 -10
- package/dist/cjs/getPublishUploads-Bh22D3zJ.js.map +1 -0
- package/dist/cjs/{index-B3UDbm1C.js → index-BA1RIYFG.js} +3 -3
- package/dist/cjs/index-BA1RIYFG.js.map +1 -0
- package/dist/cjs/{index-C66AfYDG.js → index-Dls7aMjr.js} +281 -90
- package/dist/cjs/index-Dls7aMjr.js.map +1 -0
- package/dist/cjs/{property-BVJIP7SX.js → property-ZerTWizX.js} +5 -5
- package/dist/cjs/{property-BVJIP7SX.js.map → property-ZerTWizX.js.map} +1 -1
- package/dist/cjs/publishDraftGraph-CPOAcQFf.js +403 -0
- package/dist/cjs/publishDraftGraph-CPOAcQFf.js.map +1 -0
- package/dist/cjs/{resetAmbiguousLegacyItemData-BaZqUui9.js → resetAmbiguousLegacyItemData-adDl4LcT.js} +2 -2
- package/dist/cjs/{resetAmbiguousLegacyItemData-BaZqUui9.js.map → resetAmbiguousLegacyItemData-adDl4LcT.js.map} +1 -1
- package/dist/cjs/{resolveModelForSyncedSeed-CC6dQctx.js → resolveModelForSyncedSeed-DoNThPdL.js} +2 -2
- package/dist/cjs/{resolveModelForSyncedSeed-CC6dQctx.js.map → resolveModelForSyncedSeed-DoNThPdL.js.map} +1 -1
- package/dist/cjs/{syncDbWithEas-Dk96sAG-.js → syncDbWithEas-CYfPkus9.js} +20 -7
- package/dist/cjs/{syncDbWithEas-Dk96sAG-.js.map → syncDbWithEas-CYfPkus9.js.map} +1 -1
- package/dist/{configurePlatform-BMoPG9vY.js → configurePlatform-xU3Hsno3.js} +4 -4
- package/dist/{configurePlatform-BMoPG9vY.js.map → configurePlatform-xU3Hsno3.js.map} +1 -1
- package/dist/{db-BJZN0a0a.js → db-W1g29qsM.js} +31 -27
- package/dist/{db-BJZN0a0a.js.map → db-W1g29qsM.js.map} +1 -1
- package/dist/{eas-B0hsMLqt.js → eas-CSwV6MvB.js} +6 -6
- package/dist/{eas-B0hsMLqt.js.map → eas-CSwV6MvB.js.map} +1 -1
- package/dist/{getItem-DEh4WfHG.js → getItem-BYQeM3DY.js} +5 -6
- package/dist/{getItem-DEh4WfHG.js.map → getItem-BYQeM3DY.js.map} +1 -1
- package/dist/{getPublishPayload-H032DHC7.js → getPublishPayload-D5CQZd-y.js} +167 -206
- package/dist/getPublishPayload-D5CQZd-y.js.map +1 -0
- package/dist/{getPublishUploads-CR66RlGJ.js → getPublishUploads-BGpDsrBp.js} +52 -14
- package/dist/getPublishUploads-BGpDsrBp.js.map +1 -0
- package/dist/{index-6bJuv5Tt.js → index-Bev-hZF-.js} +9 -10
- package/dist/index-Bev-hZF-.js.map +1 -0
- package/dist/{index-B0LgJblD.js → index-CSOQFAOn.js} +2 -2
- package/dist/index-CSOQFAOn.js.map +1 -0
- package/dist/{index-DtfjeuxC.js → index-DRXC5Mra.js} +167 -75
- package/dist/index-DRXC5Mra.js.map +1 -0
- package/dist/{index.browser-CNrqhvEA.js → index.browser-DO20vYuP.js} +9 -9
- package/dist/{index.browser-CNrqhvEA.js.map → index.browser-DO20vYuP.js.map} +1 -1
- package/dist/{index.node-DrHiTuOr.js → index.node-C4iyOhdo.js} +5 -5
- package/dist/{index.node-DrHiTuOr.js.map → index.node-C4iyOhdo.js.map} +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.js +258 -183
- package/dist/main.js.map +1 -1
- package/dist/node.js +14 -15
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +5 -5
- package/dist/platform.node.js +3 -3
- package/dist/{property-D2Nnsmm1.js → property-BT1zDSkd.js} +10 -11
- package/dist/property-BT1zDSkd.js.map +1 -0
- package/dist/publishDraftGraph-Bcfrdj7-.js +405 -0
- package/dist/publishDraftGraph-Bcfrdj7-.js.map +1 -0
- package/dist/{resetAmbiguousLegacyItemData-BqbHNUYk.js → resetAmbiguousLegacyItemData-Ci6PM_vC.js} +2 -2
- package/dist/{resetAmbiguousLegacyItemData-BqbHNUYk.js.map → resetAmbiguousLegacyItemData-Ci6PM_vC.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-DQK6JfXS.js → resolveModelForSyncedSeed-CLlumTBq.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-DQK6JfXS.js.map → resolveModelForSyncedSeed-CLlumTBq.js.map} +1 -1
- package/dist/src/Item/Item.d.ts +11 -0
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts +10 -0
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/src/Model/Model.d.ts +15 -2
- package/dist/src/Model/Model.d.ts.map +1 -1
- package/dist/src/Model/service/actors/createModelProperties.d.ts.map +1 -1
- package/dist/src/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
- package/dist/src/Model/service/actors/validateModel.d.ts.map +1 -1
- package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts +9 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/src/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
- package/dist/src/ModelProperty/service/actors/saveToSchema.d.ts.map +1 -1
- package/dist/src/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
- package/dist/src/Schema/Schema.d.ts +7 -0
- package/dist/src/Schema/Schema.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/createModelInstances.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
- package/dist/src/db/read/getPublishPayload.d.ts +9 -0
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/read/getPublishUploads.d.ts +5 -0
- package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/src/db/read/publishDraftGraph.d.ts +57 -0
- package/dist/src/db/read/publishDraftGraph.d.ts.map +1 -0
- package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
- package/dist/src/helpers/entity/entityLiveQuery.d.ts.map +1 -1
- package/dist/src/helpers/entity/evictionEpoch.d.ts +18 -0
- package/dist/src/helpers/entity/evictionEpoch.d.ts.map +1 -0
- package/dist/src/helpers/generateId.d.ts +4 -0
- package/dist/src/helpers/generateId.d.ts.map +1 -1
- package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts +28 -6
- package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/query/createLocalQueryDataSource.d.ts.map +1 -1
- package/dist/src/services/write/actors/validateEntity.d.ts.map +1 -1
- package/dist/src/types/item.d.ts +7 -8
- package/dist/src/types/item.d.ts.map +1 -1
- package/dist/{syncDbWithEas-LRKr_NZF.js → syncDbWithEas-BQsXjGhe.js} +15 -16
- package/dist/syncDbWithEas-BQsXjGhe.js.map +1 -0
- package/dist/{tabEvents-DYI2GU7i.js → tabEvents-C9qUKx_z.js} +28 -11
- package/dist/tabEvents-C9qUKx_z.js.map +1 -0
- package/dist/{tolerantWebAccess-CzOBz5M6.js → tolerantWebAccess-B-9bwxbw.js} +6 -6
- package/dist/{tolerantWebAccess-CzOBz5M6.js.map → tolerantWebAccess-B-9bwxbw.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-B58ORbY3.js → updateSeedRevokedAt-D6q0h7pj.js} +3 -3
- package/dist/{updateSeedRevokedAt-B58ORbY3.js.map → updateSeedRevokedAt-D6q0h7pj.js.map} +1 -1
- package/package.json +13 -10
- package/dist/ClientManager-DLleL_2e.js.map +0 -1
- package/dist/Item-zBFWQDU9.js.map +0 -1
- package/dist/ModelProperty-lth9L37R.js.map +0 -1
- package/dist/Schema-DOhlrQ-N.js.map +0 -1
- package/dist/cjs/ModelProperty-BEsIHAjk.js.map +0 -1
- package/dist/cjs/Schema-qEp5mH1N.js.map +0 -1
- package/dist/cjs/getLatestVersionRow-DVizNNoI.js +0 -59
- package/dist/cjs/getLatestVersionRow-DVizNNoI.js.map +0 -1
- package/dist/cjs/getPublishPayload-D5-dYtNq.js.map +0 -1
- package/dist/cjs/getPublishUploads-B5Lq6q-_.js.map +0 -1
- package/dist/cjs/getSegmentedItemProperties-giHO7R3d.js +0 -147
- package/dist/cjs/getSegmentedItemProperties-giHO7R3d.js.map +0 -1
- package/dist/cjs/index-B3UDbm1C.js.map +0 -1
- package/dist/cjs/index-C66AfYDG.js.map +0 -1
- package/dist/generateId-BopUwD8F.js +0 -9
- package/dist/generateId-BopUwD8F.js.map +0 -1
- package/dist/getLatestVersionRow-Brrl1AnW.js +0 -46
- package/dist/getLatestVersionRow-Brrl1AnW.js.map +0 -1
- package/dist/getPublishPayload-H032DHC7.js.map +0 -1
- package/dist/getPublishUploads-CR66RlGJ.js.map +0 -1
- package/dist/getSegmentedItemProperties-C2EJ2G0N.js +0 -147
- package/dist/getSegmentedItemProperties-C2EJ2G0N.js.map +0 -1
- package/dist/index-6bJuv5Tt.js.map +0 -1
- package/dist/index-B0LgJblD.js.map +0 -1
- package/dist/index-DtfjeuxC.js.map +0 -1
- package/dist/property-D2Nnsmm1.js.map +0 -1
- package/dist/src/browser/helpers/index.d.ts +0 -4
- package/dist/src/browser/helpers/index.d.ts.map +0 -1
- package/dist/syncDbWithEas-LRKr_NZF.js.map +0 -1
- package/dist/tabEvents-DYI2GU7i.js.map +0 -1
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { fromCallback, setup, assign, createActor } from 'xstate';
|
|
2
|
-
import { b as getRefValueType, D as createModelsFromJson, n as listCompleteSchemaFiles, F as getLatestSchemaVersion, l as loadSchemaFromFile, o as loadAllSchemasFromDb, h as getClient } from './ClientManager-
|
|
3
|
-
import './tabEvents-
|
|
4
|
-
import { O as addSchemaToDb, k as isDataType, M as ModelPropertyDataTypes, w as addModelsToDb, S as loadModelsFromDbForSchema } from './db-
|
|
5
|
-
import { F as SEED_PROTOCOL_SCHEMA_NAME,
|
|
2
|
+
import { b as getRefValueType, D as createModelsFromJson, n as listCompleteSchemaFiles, F as getLatestSchemaVersion, l as loadSchemaFromFile, o as loadAllSchemasFromDb, h as getClient } from './ClientManager-ClCwwhwo.js';
|
|
3
|
+
import { b as generateId } from './tabEvents-C9qUKx_z.js';
|
|
4
|
+
import { O as addSchemaToDb, k as isDataType, M as ModelPropertyDataTypes, w as addModelsToDb, S as loadModelsFromDbForSchema } from './db-W1g29qsM.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';
|
|
6
6
|
import { eq, desc, and } from 'drizzle-orm';
|
|
7
7
|
import debug from 'debug';
|
|
8
|
+
import { c as currentEvictionEpoch, w as writeProcessMachine, M as Model, C as ConflictError, d as setupEntityLiveQuery } from './index-DRXC5Mra.js';
|
|
8
9
|
import 'pluralize';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { w as writeProcessMachine, M as Model, C as ConflictError, s as setupEntityLiveQuery } from './index-DtfjeuxC.js';
|
|
12
|
-
import { j as waitForEntityIdle, k as createReactiveProxy, m as findEntity, C as ClientManagerState, V as unloadEntity, U as clearDestroySubscriptions, n as forceRemoveFromCaches, o as runDestroyLifecycle } from './Item-zBFWQDU9.js';
|
|
10
|
+
import { SchemaValidationService } from './SchemaValidationService-DabGMzSE.js';
|
|
11
|
+
import { j as waitForEntityIdle, k as createReactiveProxy, m as findEntity, C as ClientManagerState, T as clearDestroySubscriptions, n as forceRemoveFromCaches, U as unloadEntity, o as runDestroyLifecycle } from './Item-B9Y4VuK1.js';
|
|
13
12
|
|
|
14
13
|
const logger$d = debug('seedSdk:schema:actors:loadOrCreateSchema');
|
|
15
14
|
/**
|
|
@@ -48,20 +47,21 @@ const getModelIdsForSchema$1 = async (schemaId) => {
|
|
|
48
47
|
* This ensures that Model.getById() in Schema.getContext() will find the instances
|
|
49
48
|
* @param modelIds - Array of model file IDs to create instances for
|
|
50
49
|
*/
|
|
51
|
-
const createModelInstances$2 = async (modelIds) => {
|
|
50
|
+
const createModelInstances$2 = async (modelIds, evictionEpoch) => {
|
|
52
51
|
if (modelIds.length === 0) {
|
|
53
52
|
return;
|
|
54
53
|
}
|
|
55
54
|
try {
|
|
56
|
-
const _mod_0 = await import('./index-
|
|
57
|
-
const _ns_0 = _mod_0.
|
|
55
|
+
const _mod_0 = await import('./index-DRXC5Mra.js');
|
|
56
|
+
const _ns_0 = _mod_0.f;
|
|
58
57
|
const modelMod = _ns_0;
|
|
59
58
|
const { Model } = modelMod;
|
|
60
59
|
// Create instances for all model IDs in parallel
|
|
61
60
|
// Model.createById() will check cache first, then query DB and create if needed
|
|
62
61
|
const createPromises = modelIds.map(async (modelFileId) => {
|
|
63
62
|
try {
|
|
64
|
-
|
|
63
|
+
// Not if the schema was evicted (Schema.destroy, test cleanup) since this load started
|
|
64
|
+
const model = await Model.createById(modelFileId, { evictionEpoch });
|
|
65
65
|
if (model) {
|
|
66
66
|
logger$d(`Created/cached Model instance for modelFileId "${modelFileId}"`);
|
|
67
67
|
}
|
|
@@ -160,6 +160,7 @@ const getSchemaFilePath$2 = (name, version, schemaFileId) => {
|
|
|
160
160
|
return path.join(workingDir, filename);
|
|
161
161
|
};
|
|
162
162
|
const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
163
|
+
const evictionEpoch = currentEvictionEpoch();
|
|
163
164
|
const _loadOrCreateSchema = async () => {
|
|
164
165
|
const { schemaName } = context;
|
|
165
166
|
// Check if this is an internal SDK schema (should not create files in app directory) — use static import so consumer bundles resolve correctly
|
|
@@ -168,7 +169,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
168
169
|
// For Seed Protocol, always load from internal file, never create new
|
|
169
170
|
logger$d(`Loading internal Seed Protocol schema from SDK`);
|
|
170
171
|
try {
|
|
171
|
-
const _mod_1 = await import('./ClientManager-
|
|
172
|
+
const _mod_1 = await import('./ClientManager-ClCwwhwo.js');
|
|
172
173
|
const _ns_1 = _mod_1.S;
|
|
173
174
|
const internalSchema = _ns_1;
|
|
174
175
|
const schemaFile = internalSchema.default;
|
|
@@ -478,7 +479,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
478
479
|
if (schemaRecord && schemaRecord.id) {
|
|
479
480
|
modelIds = await getModelIdsForSchema$1(schemaRecord.id);
|
|
480
481
|
// Create Model instances so they're cached before getContext runs
|
|
481
|
-
await createModelInstances$2(modelIds);
|
|
482
|
+
await createModelInstances$2(modelIds, evictionEpoch);
|
|
482
483
|
}
|
|
483
484
|
sendBack({
|
|
484
485
|
type: 'loadOrCreateSchemaSuccess',
|
|
@@ -663,7 +664,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
663
664
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
664
665
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
665
666
|
try {
|
|
666
|
-
const _mod_2 = await import('./ClientManager-
|
|
667
|
+
const _mod_2 = await import('./ClientManager-ClCwwhwo.js');
|
|
667
668
|
const _ns_2 = _mod_2.S;
|
|
668
669
|
const internalSchema = _ns_2;
|
|
669
670
|
const internalSchemaFile = internalSchema.default;
|
|
@@ -727,7 +728,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
727
728
|
if (dbSchema.id) {
|
|
728
729
|
modelIds = await getModelIdsForSchema$1(dbSchema.id);
|
|
729
730
|
// Create Model instances so they're cached before getContext runs
|
|
730
|
-
await createModelInstances$2(modelIds);
|
|
731
|
+
await createModelInstances$2(modelIds, evictionEpoch);
|
|
731
732
|
}
|
|
732
733
|
// Track conflict detection metadata
|
|
733
734
|
const loadedAt = Date.now();
|
|
@@ -824,7 +825,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
824
825
|
if (draftsByFileId[0].id) {
|
|
825
826
|
modelIds = await getModelIdsForSchema$1(draftsByFileId[0].id);
|
|
826
827
|
// Create Model instances so they're cached before getContext runs
|
|
827
|
-
await createModelInstances$2(modelIds);
|
|
828
|
+
await createModelInstances$2(modelIds, evictionEpoch);
|
|
828
829
|
}
|
|
829
830
|
// Track conflict detection metadata
|
|
830
831
|
const loadedAt = Date.now();
|
|
@@ -892,7 +893,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
892
893
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
893
894
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
894
895
|
try {
|
|
895
|
-
const _mod_3 = await import('./ClientManager-
|
|
896
|
+
const _mod_3 = await import('./ClientManager-ClCwwhwo.js');
|
|
896
897
|
const _ns_3 = _mod_3.S;
|
|
897
898
|
const internalSchema = _ns_3;
|
|
898
899
|
const internalSchemaFile = internalSchema.default;
|
|
@@ -957,7 +958,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
957
958
|
if (dbSchema.id) {
|
|
958
959
|
modelIds = await getModelIdsForSchema$1(dbSchema.id);
|
|
959
960
|
// Create Model instances so they're cached before getContext runs
|
|
960
|
-
await createModelInstances$2(modelIds);
|
|
961
|
+
await createModelInstances$2(modelIds, evictionEpoch);
|
|
961
962
|
}
|
|
962
963
|
// Track conflict detection metadata from DB record
|
|
963
964
|
const loadedAt = Date.now();
|
|
@@ -983,7 +984,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
983
984
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
984
985
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
985
986
|
try {
|
|
986
|
-
const _mod_4 = await import('./ClientManager-
|
|
987
|
+
const _mod_4 = await import('./ClientManager-ClCwwhwo.js');
|
|
987
988
|
const _ns_4 = _mod_4.S;
|
|
988
989
|
const internalSchema = _ns_4;
|
|
989
990
|
const internalSchemaFile = internalSchema.default;
|
|
@@ -1047,7 +1048,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1047
1048
|
if (dbSchema.id) {
|
|
1048
1049
|
modelIds = await getModelIdsForSchema$1(dbSchema.id);
|
|
1049
1050
|
// Create Model instances so they're cached before getContext runs
|
|
1050
|
-
await createModelInstances$2(modelIds);
|
|
1051
|
+
await createModelInstances$2(modelIds, evictionEpoch);
|
|
1051
1052
|
}
|
|
1052
1053
|
// Track conflict detection metadata
|
|
1053
1054
|
const loadedAt = Date.now();
|
|
@@ -1071,7 +1072,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1071
1072
|
// If schemaData is missing, try to load from internal schema file for seed-protocol
|
|
1072
1073
|
if (!dbSchema.schemaData && schemaName === 'Seed Protocol') {
|
|
1073
1074
|
try {
|
|
1074
|
-
const _mod_5 = await import('./ClientManager-
|
|
1075
|
+
const _mod_5 = await import('./ClientManager-ClCwwhwo.js');
|
|
1075
1076
|
const _ns_5 = _mod_5.S;
|
|
1076
1077
|
const internalSchema = _ns_5;
|
|
1077
1078
|
const schemaFile = internalSchema.default;
|
|
@@ -1089,7 +1090,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1089
1090
|
if (dbSchema.id) {
|
|
1090
1091
|
modelIds = await getModelIdsForSchema$1(dbSchema.id);
|
|
1091
1092
|
// Create Model instances so they're cached before getContext runs
|
|
1092
|
-
await createModelInstances$2(modelIds);
|
|
1093
|
+
await createModelInstances$2(modelIds, evictionEpoch);
|
|
1093
1094
|
}
|
|
1094
1095
|
sendBack({
|
|
1095
1096
|
type: 'loadOrCreateSchemaSuccess',
|
|
@@ -1151,7 +1152,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1151
1152
|
if (matchingDraft.id) {
|
|
1152
1153
|
modelIds = await getModelIdsForSchema$1(matchingDraft.id);
|
|
1153
1154
|
// Create Model instances so they're cached before getContext runs
|
|
1154
|
-
await createModelInstances$2(modelIds);
|
|
1155
|
+
await createModelInstances$2(modelIds, evictionEpoch);
|
|
1155
1156
|
}
|
|
1156
1157
|
// Track conflict detection metadata
|
|
1157
1158
|
const loadedAt = Date.now();
|
|
@@ -1182,7 +1183,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1182
1183
|
// Ensure models are populated (fallback for seed-protocol if missing)
|
|
1183
1184
|
if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
|
|
1184
1185
|
try {
|
|
1185
|
-
const _mod_6 = await import('./ClientManager-
|
|
1186
|
+
const _mod_6 = await import('./ClientManager-ClCwwhwo.js');
|
|
1186
1187
|
const _ns_6 = _mod_6.S;
|
|
1187
1188
|
const internalSchema = _ns_6;
|
|
1188
1189
|
const internalSchemaFile = internalSchema.default;
|
|
@@ -1207,7 +1208,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1207
1208
|
if (schemaRecords.length > 0 && schemaRecords[0].id) {
|
|
1208
1209
|
modelIds = await getModelIdsForSchema$1(schemaRecords[0].id);
|
|
1209
1210
|
// Create Model instances so they're cached before getContext runs
|
|
1210
|
-
await createModelInstances$2(modelIds);
|
|
1211
|
+
await createModelInstances$2(modelIds, evictionEpoch);
|
|
1211
1212
|
}
|
|
1212
1213
|
}
|
|
1213
1214
|
}
|
|
@@ -1261,7 +1262,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1261
1262
|
if (foundSchema.id) {
|
|
1262
1263
|
modelIds = await getModelIdsForSchema$1(foundSchema.id);
|
|
1263
1264
|
// Create Model instances so they're cached before getContext runs
|
|
1264
|
-
await createModelInstances$2(modelIds);
|
|
1265
|
+
await createModelInstances$2(modelIds, evictionEpoch);
|
|
1265
1266
|
}
|
|
1266
1267
|
// Track conflict detection metadata
|
|
1267
1268
|
const loadedAt = Date.now();
|
|
@@ -1293,7 +1294,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1293
1294
|
if (foundSchema.id) {
|
|
1294
1295
|
modelIds = await getModelIdsForSchema$1(foundSchema.id);
|
|
1295
1296
|
// Create Model instances so they're cached before getContext runs
|
|
1296
|
-
await createModelInstances$2(modelIds);
|
|
1297
|
+
await createModelInstances$2(modelIds, evictionEpoch);
|
|
1297
1298
|
}
|
|
1298
1299
|
// Track conflict detection metadata
|
|
1299
1300
|
const loadedAt = Date.now();
|
|
@@ -1366,7 +1367,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1366
1367
|
if (schemaRecords.length > 0 && schemaRecords[0].id) {
|
|
1367
1368
|
modelIds = await getModelIdsForSchema$1(schemaRecords[0].id);
|
|
1368
1369
|
// Create Model instances so they're cached before getContext runs
|
|
1369
|
-
await createModelInstances$2(modelIds);
|
|
1370
|
+
await createModelInstances$2(modelIds, evictionEpoch);
|
|
1370
1371
|
}
|
|
1371
1372
|
}
|
|
1372
1373
|
}
|
|
@@ -1504,13 +1505,13 @@ const getSchemaFilePath$1 = (name, version, schemaFileId) => {
|
|
|
1504
1505
|
/**
|
|
1505
1506
|
* Create Model instances for all model IDs to ensure they're cached
|
|
1506
1507
|
*/
|
|
1507
|
-
const createModelInstances$1 = async (modelIds) => {
|
|
1508
|
+
const createModelInstances$1 = async (modelIds, evictionEpoch) => {
|
|
1508
1509
|
if (modelIds.length === 0) {
|
|
1509
1510
|
return;
|
|
1510
1511
|
}
|
|
1511
1512
|
try {
|
|
1512
|
-
const _mod_7 = await import('./index-
|
|
1513
|
-
const _ns_7 = _mod_7.
|
|
1513
|
+
const _mod_7 = await import('./index-DRXC5Mra.js');
|
|
1514
|
+
const _ns_7 = _mod_7.f;
|
|
1514
1515
|
const mod = _ns_7;
|
|
1515
1516
|
const Model = mod?.Model ?? mod?.default;
|
|
1516
1517
|
if (!Model) {
|
|
@@ -1519,7 +1520,8 @@ const createModelInstances$1 = async (modelIds) => {
|
|
|
1519
1520
|
}
|
|
1520
1521
|
const createPromises = modelIds.map(async (modelFileId) => {
|
|
1521
1522
|
try {
|
|
1522
|
-
|
|
1523
|
+
// Not if the schema was evicted (Schema.destroy, test cleanup) since this check started
|
|
1524
|
+
const model = await Model.createById(modelFileId, { evictionEpoch });
|
|
1523
1525
|
if (model) {
|
|
1524
1526
|
logger$c(`Created/cached Model instance for modelFileId "${modelFileId}"`);
|
|
1525
1527
|
}
|
|
@@ -1536,6 +1538,7 @@ const createModelInstances$1 = async (modelIds) => {
|
|
|
1536
1538
|
}
|
|
1537
1539
|
};
|
|
1538
1540
|
const checkExistingSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
1541
|
+
const evictionEpoch = currentEvictionEpoch();
|
|
1539
1542
|
const _check = async () => {
|
|
1540
1543
|
const { schemaName } = context;
|
|
1541
1544
|
if (!schemaName) {
|
|
@@ -1556,7 +1559,7 @@ const checkExistingSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1556
1559
|
if (isInternal && schemaName === SEED_PROTOCOL_SCHEMA_NAME) {
|
|
1557
1560
|
// For Seed Protocol, check if it exists in database
|
|
1558
1561
|
try {
|
|
1559
|
-
const _mod_8 = await import('./ClientManager-
|
|
1562
|
+
const _mod_8 = await import('./ClientManager-ClCwwhwo.js');
|
|
1560
1563
|
const _ns_8 = _mod_8.S;
|
|
1561
1564
|
const internalSchema = _ns_8;
|
|
1562
1565
|
const schemaFile = internalSchema.default;
|
|
@@ -1571,7 +1574,7 @@ const checkExistingSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1571
1574
|
let modelIds = [];
|
|
1572
1575
|
if (schemaRecord.id) {
|
|
1573
1576
|
modelIds = await getModelIdsForSchema(schemaRecord.id);
|
|
1574
|
-
await createModelInstances$1(modelIds);
|
|
1577
|
+
await createModelInstances$1(modelIds, evictionEpoch);
|
|
1575
1578
|
}
|
|
1576
1579
|
sendBack({
|
|
1577
1580
|
type: 'schemaFound',
|
|
@@ -1778,7 +1781,7 @@ const checkExistingSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1778
1781
|
let modelIds = [];
|
|
1779
1782
|
if (dbSchema.id) {
|
|
1780
1783
|
modelIds = await getModelIdsForSchema(dbSchema.id);
|
|
1781
|
-
await createModelInstances$1(modelIds);
|
|
1784
|
+
await createModelInstances$1(modelIds, evictionEpoch);
|
|
1782
1785
|
}
|
|
1783
1786
|
const loadedAt = Date.now();
|
|
1784
1787
|
const dbVersion = dbSchema.version || schemaFile.version;
|
|
@@ -1832,7 +1835,7 @@ const checkExistingSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1832
1835
|
let modelIds = [];
|
|
1833
1836
|
if (matchingDraft.id) {
|
|
1834
1837
|
modelIds = await getModelIdsForSchema(matchingDraft.id);
|
|
1835
|
-
await createModelInstances$1(modelIds);
|
|
1838
|
+
await createModelInstances$1(modelIds, evictionEpoch);
|
|
1836
1839
|
}
|
|
1837
1840
|
const loadedAt = Date.now();
|
|
1838
1841
|
const dbVersion = matchingDraft.version || schemaFile.version;
|
|
@@ -1867,7 +1870,7 @@ const checkExistingSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1867
1870
|
.limit(1);
|
|
1868
1871
|
if (schemaRecords.length > 0 && schemaRecords[0].id) {
|
|
1869
1872
|
modelIds = await getModelIdsForSchema(schemaRecords[0].id);
|
|
1870
|
-
await createModelInstances$1(modelIds);
|
|
1873
|
+
await createModelInstances$1(modelIds, evictionEpoch);
|
|
1871
1874
|
}
|
|
1872
1875
|
}
|
|
1873
1876
|
}
|
|
@@ -1916,7 +1919,7 @@ const writeSchemaToDb = fromCallback(({ sendBack, input }) => {
|
|
|
1916
1919
|
if (isInternal && schemaName === SEED_PROTOCOL_SCHEMA_NAME) {
|
|
1917
1920
|
// For Seed Protocol, load from internal file
|
|
1918
1921
|
logger$b(`Loading internal Seed Protocol schema from SDK`);
|
|
1919
|
-
const _mod_9 = await import('./ClientManager-
|
|
1922
|
+
const _mod_9 = await import('./ClientManager-ClCwwhwo.js');
|
|
1920
1923
|
const _ns_9 = _mod_9.S;
|
|
1921
1924
|
const internalSchema = _ns_9;
|
|
1922
1925
|
finalSchema = internalSchema.default;
|
|
@@ -2375,6 +2378,7 @@ const logger$7 = debug('seedSdk:schema:actors:createModelInstances');
|
|
|
2375
2378
|
* This ensures that Model.getById() in Schema.getContext() will find the instances
|
|
2376
2379
|
*/
|
|
2377
2380
|
const createModelInstances = fromCallback(({ sendBack, input }) => {
|
|
2381
|
+
const evictionEpoch = currentEvictionEpoch();
|
|
2378
2382
|
const _create = async () => {
|
|
2379
2383
|
const { modelIds, schemaName } = input;
|
|
2380
2384
|
if (modelIds.length === 0) {
|
|
@@ -2386,15 +2390,16 @@ const createModelInstances = fromCallback(({ sendBack, input }) => {
|
|
|
2386
2390
|
return;
|
|
2387
2391
|
}
|
|
2388
2392
|
try {
|
|
2389
|
-
const _mod_10 = await import('./index-
|
|
2390
|
-
const _ns_10 = _mod_10.
|
|
2393
|
+
const _mod_10 = await import('./index-DRXC5Mra.js');
|
|
2394
|
+
const _ns_10 = _mod_10.f;
|
|
2391
2395
|
const modelMod = _ns_10;
|
|
2392
2396
|
const { Model } = modelMod;
|
|
2393
2397
|
// Create instances for all model IDs in parallel
|
|
2394
2398
|
// Model.createById() will check cache first, then query DB and create if needed
|
|
2395
2399
|
const createPromises = modelIds.map(async (modelFileId) => {
|
|
2396
2400
|
try {
|
|
2397
|
-
|
|
2401
|
+
// Not if the schema was evicted (Schema.destroy, test cleanup) since this started
|
|
2402
|
+
const model = await Model.createById(modelFileId, { evictionEpoch });
|
|
2398
2403
|
if (model) {
|
|
2399
2404
|
logger$7(`Created/cached Model instance for modelFileId "${modelFileId}"`);
|
|
2400
2405
|
return true;
|
|
@@ -2474,8 +2479,8 @@ const verifyModelInstancesInCache = fromCallback(({ sendBack, input }) => {
|
|
|
2474
2479
|
}
|
|
2475
2480
|
try {
|
|
2476
2481
|
const result = await verifyWithRetry$2(async () => {
|
|
2477
|
-
const _mod_11 = await import('./index-
|
|
2478
|
-
const _ns_11 = _mod_11.
|
|
2482
|
+
const _mod_11 = await import('./index-DRXC5Mra.js');
|
|
2483
|
+
const _ns_11 = _mod_11.f;
|
|
2479
2484
|
const modelMod = _ns_11;
|
|
2480
2485
|
const { Model } = modelMod;
|
|
2481
2486
|
// Check each model ID in the cache
|
|
@@ -2533,7 +2538,7 @@ const writePropertiesToDb = fromCallback(({ sendBack, input }) => {
|
|
|
2533
2538
|
const _write = async () => {
|
|
2534
2539
|
const { modelIds } = input;
|
|
2535
2540
|
try {
|
|
2536
|
-
const _mod_12 = await import('./BasePathResolver-
|
|
2541
|
+
const _mod_12 = await import('./BasePathResolver-BdxCSIzn.js');
|
|
2537
2542
|
const _ns_12 = _mod_12.N;
|
|
2538
2543
|
const modelSchemaMod = _ns_12;
|
|
2539
2544
|
const { models: modelsTable, properties: propertiesTable } = modelSchemaMod;
|
|
@@ -2723,10 +2728,10 @@ const createPropertyInstances = fromCallback(({ sendBack, input }) => {
|
|
|
2723
2728
|
return;
|
|
2724
2729
|
}
|
|
2725
2730
|
try {
|
|
2726
|
-
const modProp = await import('./ModelProperty-
|
|
2731
|
+
const modProp = await import('./ModelProperty-BMePcicQ.js');
|
|
2727
2732
|
const ModelProperty = modProp?.ModelProperty ?? modProp?.default;
|
|
2728
|
-
const _mod_13 = await import('./index-
|
|
2729
|
-
const _ns_13 = _mod_13.
|
|
2733
|
+
const _mod_13 = await import('./index-DRXC5Mra.js');
|
|
2734
|
+
const _ns_13 = _mod_13.f;
|
|
2730
2735
|
const modModel = _ns_13;
|
|
2731
2736
|
const Model = modModel?.Model ?? modModel?.default;
|
|
2732
2737
|
if (!ModelProperty || !Model) {
|
|
@@ -2832,7 +2837,7 @@ const verifyPropertyInstancesInCache = fromCallback(({ sendBack, input }) => {
|
|
|
2832
2837
|
}
|
|
2833
2838
|
try {
|
|
2834
2839
|
const result = await verifyWithRetry(async () => {
|
|
2835
|
-
const mod = await import('./ModelProperty-
|
|
2840
|
+
const mod = await import('./ModelProperty-BMePcicQ.js');
|
|
2836
2841
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
2837
2842
|
if (!ModelProperty) {
|
|
2838
2843
|
throw new Error('ModelProperty not available from dynamic import');
|
|
@@ -3745,7 +3750,7 @@ async function loadSchemaWithRenames(schemaFilePath, modelRenames) {
|
|
|
3745
3750
|
updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
|
|
3746
3751
|
};
|
|
3747
3752
|
// Use dynamic import to break circular dependency
|
|
3748
|
-
const _mod_14 = await import('./db-
|
|
3753
|
+
const _mod_14 = await import('./db-W1g29qsM.js');
|
|
3749
3754
|
const _ns_14 = _mod_14.Z;
|
|
3750
3755
|
const dbMod = _ns_14;
|
|
3751
3756
|
const { addSchemaToDb, addModelsToDb } = dbMod;
|
|
@@ -3858,7 +3863,7 @@ async function renameModelProperty(schemaName, modelName, oldPropertyName, newPr
|
|
|
3858
3863
|
await BaseFileManager.waitForFileWithContent(newFilePath);
|
|
3859
3864
|
logger$1(`Renamed property ${oldPropertyName} to ${newPropertyName} in schema ${schemaName} v${newVersion}`);
|
|
3860
3865
|
// Migrate metadata rows so ItemProperty values follow the new name (prevents duplicate ItemProperties)
|
|
3861
|
-
const _mod_15 = await import('./db-
|
|
3866
|
+
const _mod_15 = await import('./db-W1g29qsM.js');
|
|
3862
3867
|
const _ns_15 = _mod_15.Z;
|
|
3863
3868
|
const { migrateMetadataForPropertyRename } = _ns_15;
|
|
3864
3869
|
const migratedCount = await migrateMetadataForPropertyRename(modelName, oldPropertyName, newPropertyName, oldProperty.id, { schemaName });
|
|
@@ -4965,7 +4970,7 @@ class Schema {
|
|
|
4965
4970
|
_dbVersion: publishedSchema.version,
|
|
4966
4971
|
});
|
|
4967
4972
|
// Clear edited flags on all ModelProperty instances and in database
|
|
4968
|
-
const modelPropertyMod = await import('./ModelProperty-
|
|
4973
|
+
const modelPropertyMod = await import('./ModelProperty-BMePcicQ.js');
|
|
4969
4974
|
const { ModelProperty } = modelPropertyMod;
|
|
4970
4975
|
for (const propertyKey of context._editedProperties) {
|
|
4971
4976
|
const [modelName, propertyName] = propertyKey.split(':');
|
|
@@ -4989,7 +4994,7 @@ class Schema {
|
|
|
4989
4994
|
try {
|
|
4990
4995
|
if (db && modelName && propertyName) {
|
|
4991
4996
|
// Find this schema's model by name
|
|
4992
|
-
const _mod_16 = await import('./db-
|
|
4997
|
+
const _mod_16 = await import('./db-W1g29qsM.js');
|
|
4993
4998
|
const _ns_16 = _mod_16.Y;
|
|
4994
4999
|
const { resolveModelRecord } = _ns_16;
|
|
4995
5000
|
const modelRecord = await resolveModelRecord(modelName, { schemaName: thisSchemaName }, db);
|
|
@@ -5492,6 +5497,47 @@ class Schema {
|
|
|
5492
5497
|
saveDraftLogger(`Removed schema from saving set (key: ${saveKey})`);
|
|
5493
5498
|
}
|
|
5494
5499
|
}
|
|
5500
|
+
/**
|
|
5501
|
+
* Force-evict the cached Schema instance(s) named `schemaName`, ignoring refCounts: stop their live
|
|
5502
|
+
* query and service. Schema.destroy does the same for itself. For code that deletes a schema's rows
|
|
5503
|
+
* without destroying it (test cleanup): a live Schema keeps re-creating its models from its live
|
|
5504
|
+
* query while their rows are being deleted.
|
|
5505
|
+
*/
|
|
5506
|
+
static evict(schemaName) {
|
|
5507
|
+
const instances = new Set();
|
|
5508
|
+
for (const { instance } of Schema.instanceCacheById.values())
|
|
5509
|
+
instances.add(instance);
|
|
5510
|
+
for (const { instance } of Schema.instanceCacheByName.values())
|
|
5511
|
+
instances.add(instance);
|
|
5512
|
+
for (const instance of instances) {
|
|
5513
|
+
let context;
|
|
5514
|
+
try {
|
|
5515
|
+
context = instance._getSnapshotContext();
|
|
5516
|
+
}
|
|
5517
|
+
catch {
|
|
5518
|
+
continue;
|
|
5519
|
+
}
|
|
5520
|
+
if (context.schemaName !== schemaName)
|
|
5521
|
+
continue;
|
|
5522
|
+
clearDestroySubscriptions(instance, {
|
|
5523
|
+
instanceState: schemaInstanceState,
|
|
5524
|
+
onUnload: () => schemaInstanceState.delete(instance),
|
|
5525
|
+
});
|
|
5526
|
+
forceRemoveFromCaches(instance, {
|
|
5527
|
+
getCacheKeys: () => [context.id, context.schemaName].filter((k) => !!k),
|
|
5528
|
+
caches: [
|
|
5529
|
+
Schema.instanceCacheById,
|
|
5530
|
+
Schema.instanceCacheByName,
|
|
5531
|
+
],
|
|
5532
|
+
});
|
|
5533
|
+
try {
|
|
5534
|
+
instance._service.stop();
|
|
5535
|
+
}
|
|
5536
|
+
catch {
|
|
5537
|
+
// Service might already be stopped
|
|
5538
|
+
}
|
|
5539
|
+
}
|
|
5540
|
+
}
|
|
5495
5541
|
unload() {
|
|
5496
5542
|
try {
|
|
5497
5543
|
const context = this._getSnapshotContext();
|
|
@@ -5559,11 +5605,11 @@ class Schema {
|
|
|
5559
5605
|
// instances too, or a re-import would get them back with dangling _dbIds.
|
|
5560
5606
|
if (schemaName) {
|
|
5561
5607
|
const evictedModelNames = Model.evictForSchema(schemaName);
|
|
5562
|
-
const { ModelProperty } = await import('./ModelProperty-
|
|
5608
|
+
const { ModelProperty } = await import('./ModelProperty-BMePcicQ.js');
|
|
5563
5609
|
ModelProperty.evictForModels(evictedModelNames, schemaName);
|
|
5564
5610
|
// Evicting stops new writes but not ones already running; let those land before deleting their rows
|
|
5565
|
-
const _mod_17 = await import('./index-
|
|
5566
|
-
const _ns_17 = _mod_17.
|
|
5611
|
+
const _mod_17 = await import('./index-DRXC5Mra.js');
|
|
5612
|
+
const _ns_17 = _mod_17.e;
|
|
5567
5613
|
const { waitForInFlightWrites } = _ns_17;
|
|
5568
5614
|
await waitForInFlightWrites();
|
|
5569
5615
|
}
|
|
@@ -5708,8 +5754,10 @@ class Schema {
|
|
|
5708
5754
|
}
|
|
5709
5755
|
},
|
|
5710
5756
|
createChildInstances: async (ids) => {
|
|
5757
|
+
// One at a time: an eviction of this schema part way through stops the rest
|
|
5758
|
+
const evictionEpoch = currentEvictionEpoch();
|
|
5711
5759
|
for (const id of ids) {
|
|
5712
|
-
await Model.createById(id);
|
|
5760
|
+
await Model.createById(id, { evictionEpoch });
|
|
5713
5761
|
}
|
|
5714
5762
|
},
|
|
5715
5763
|
queryInitialData: async (schemaId) => {
|
|
@@ -5786,4 +5834,4 @@ var Schema$1 = /*#__PURE__*/Object.freeze({
|
|
|
5786
5834
|
});
|
|
5787
5835
|
|
|
5788
5836
|
export { Schema as S, deletePropertyFromModel as a, Schema$1 as b, deleteModelFromSchema as d, renameModelProperty as r, schemaMachine as s, updateModelProperties as u };
|
|
5789
|
-
//# sourceMappingURL=Schema-
|
|
5837
|
+
//# sourceMappingURL=Schema-COsEXXaR.js.map
|