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