@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.
Files changed (148) hide show
  1. package/dist/{BasePathResolver-ndE8XTpw.js → BasePathResolver-DRT09oVv.js} +2 -2
  2. package/dist/{BasePathResolver-ndE8XTpw.js.map → BasePathResolver-DRT09oVv.js.map} +1 -1
  3. package/dist/{ClientManager-DLleL_2e.js → ClientManager-DngaZdw6.js} +20 -20
  4. package/dist/{ClientManager-DLleL_2e.js.map → ClientManager-DngaZdw6.js.map} +1 -1
  5. package/dist/{Item-zBFWQDU9.js → Item-ZUAmf943.js} +118 -72
  6. package/dist/{Item-zBFWQDU9.js.map → Item-ZUAmf943.js.map} +1 -1
  7. package/dist/{ModelProperty-lth9L37R.js → ModelProperty-6llK4MTH.js} +64 -35
  8. package/dist/ModelProperty-6llK4MTH.js.map +1 -0
  9. package/dist/{Schema-DOhlrQ-N.js → Schema-D-Ud-XYw.js} +106 -57
  10. package/dist/Schema-D-Ud-XYw.js.map +1 -0
  11. package/dist/{SchemaValidationService-DDKr5piy.js → SchemaValidationService-IoS7JquP.js} +7 -7
  12. package/dist/{SchemaValidationService-DDKr5piy.js.map → SchemaValidationService-IoS7JquP.js.map} +1 -1
  13. package/dist/{backfillMetadataPropertyIds-fG3ujaSh.js → backfillMetadataPropertyIds-BlVeE7w7.js} +4 -4
  14. package/dist/{backfillMetadataPropertyIds-fG3ujaSh.js.map → backfillMetadataPropertyIds-BlVeE7w7.js.map} +1 -1
  15. package/dist/cjs/{ModelProperty-BEsIHAjk.js → ModelProperty-Dv7AQfmQ.js} +59 -30
  16. package/dist/cjs/ModelProperty-Dv7AQfmQ.js.map +1 -0
  17. package/dist/cjs/{Schema-qEp5mH1N.js → Schema-BHVp1g-M.js} +93 -44
  18. package/dist/cjs/Schema-BHVp1g-M.js.map +1 -0
  19. package/dist/cjs/{SchemaValidationService-CWEnZmOH.js → SchemaValidationService-BSU9knjf.js} +2 -2
  20. package/dist/cjs/{SchemaValidationService-CWEnZmOH.js.map → SchemaValidationService-BSU9knjf.js.map} +1 -1
  21. package/dist/cjs/{backfillMetadataPropertyIds-tw8JGMT0.js → backfillMetadataPropertyIds-WIovQ_d8.js} +3 -3
  22. package/dist/cjs/{backfillMetadataPropertyIds-tw8JGMT0.js.map → backfillMetadataPropertyIds-WIovQ_d8.js.map} +1 -1
  23. package/dist/cjs/{eas-CLiV2Hmn.js → eas-CUYXdr2t.js} +3 -3
  24. package/dist/cjs/{eas-CLiV2Hmn.js.map → eas-CUYXdr2t.js.map} +1 -1
  25. package/dist/cjs/{getItem-DSRtx_68.js → getItem-z1tHu0hu.js} +2 -2
  26. package/dist/cjs/{getItem-DSRtx_68.js.map → getItem-z1tHu0hu.js.map} +1 -1
  27. package/dist/cjs/{getLatestVersionRow-DVizNNoI.js → getLatestVersionRow-CcaabxIW.js} +2 -2
  28. package/dist/cjs/{getLatestVersionRow-DVizNNoI.js.map → getLatestVersionRow-CcaabxIW.js.map} +1 -1
  29. package/dist/cjs/{getPublishPayload-D5-dYtNq.js → getPublishPayload-CEP_e-Kv.js} +160 -204
  30. package/dist/cjs/getPublishPayload-CEP_e-Kv.js.map +1 -0
  31. package/dist/cjs/{getPublishUploads-B5Lq6q-_.js → getPublishUploads-Ctn5k1k6.js} +49 -10
  32. package/dist/cjs/getPublishUploads-Ctn5k1k6.js.map +1 -0
  33. package/dist/cjs/{index-C66AfYDG.js → index-Cvvt0-5B.js} +244 -87
  34. package/dist/cjs/index-Cvvt0-5B.js.map +1 -0
  35. package/dist/cjs/{index-B3UDbm1C.js → index-DfGhF1dc.js} +3 -3
  36. package/dist/cjs/index-DfGhF1dc.js.map +1 -0
  37. package/dist/cjs/{property-BVJIP7SX.js → property-DbEPQ1m9.js} +5 -5
  38. package/dist/cjs/{property-BVJIP7SX.js.map → property-DbEPQ1m9.js.map} +1 -1
  39. package/dist/cjs/publishDraftGraph-C38gf302.js +403 -0
  40. package/dist/cjs/publishDraftGraph-C38gf302.js.map +1 -0
  41. package/dist/cjs/{resetAmbiguousLegacyItemData-BaZqUui9.js → resetAmbiguousLegacyItemData-CfMhRHwK.js} +2 -2
  42. package/dist/cjs/{resetAmbiguousLegacyItemData-BaZqUui9.js.map → resetAmbiguousLegacyItemData-CfMhRHwK.js.map} +1 -1
  43. package/dist/cjs/{resolveModelForSyncedSeed-CC6dQctx.js → resolveModelForSyncedSeed-CNYaLOir.js} +2 -2
  44. package/dist/cjs/{resolveModelForSyncedSeed-CC6dQctx.js.map → resolveModelForSyncedSeed-CNYaLOir.js.map} +1 -1
  45. package/dist/cjs/{syncDbWithEas-Dk96sAG-.js → syncDbWithEas-d1iOdTTI.js} +20 -7
  46. package/dist/cjs/{syncDbWithEas-Dk96sAG-.js.map → syncDbWithEas-d1iOdTTI.js.map} +1 -1
  47. package/dist/{configurePlatform-BMoPG9vY.js → configurePlatform-CZpjyuCo.js} +4 -4
  48. package/dist/{configurePlatform-BMoPG9vY.js.map → configurePlatform-CZpjyuCo.js.map} +1 -1
  49. package/dist/{db-BJZN0a0a.js → db-Lw0KVZmc.js} +11 -11
  50. package/dist/{db-BJZN0a0a.js.map → db-Lw0KVZmc.js.map} +1 -1
  51. package/dist/{eas-B0hsMLqt.js → eas-CQ-Smzk2.js} +6 -6
  52. package/dist/{eas-B0hsMLqt.js.map → eas-CQ-Smzk2.js.map} +1 -1
  53. package/dist/{getItem-DEh4WfHG.js → getItem-CSfSok9f.js} +5 -5
  54. package/dist/{getItem-DEh4WfHG.js.map → getItem-CSfSok9f.js.map} +1 -1
  55. package/dist/{getLatestVersionRow-Brrl1AnW.js → getLatestVersionRow-72Atl9vB.js} +5 -5
  56. package/dist/{getLatestVersionRow-Brrl1AnW.js.map → getLatestVersionRow-72Atl9vB.js.map} +1 -1
  57. package/dist/{getPublishPayload-H032DHC7.js → getPublishPayload-76_KfB5Y.js} +155 -200
  58. package/dist/getPublishPayload-76_KfB5Y.js.map +1 -0
  59. package/dist/{getPublishUploads-CR66RlGJ.js → getPublishUploads-CqgMBD8f.js} +52 -13
  60. package/dist/getPublishUploads-CqgMBD8f.js.map +1 -0
  61. package/dist/{index-B0LgJblD.js → index-5b3JsS55.js} +2 -2
  62. package/dist/index-5b3JsS55.js.map +1 -0
  63. package/dist/{index-6bJuv5Tt.js → index-BpgD305l.js} +9 -9
  64. package/dist/{index-6bJuv5Tt.js.map → index-BpgD305l.js.map} +1 -1
  65. package/dist/{index-DtfjeuxC.js → index-Y-yYyRBf.js} +166 -75
  66. package/dist/index-Y-yYyRBf.js.map +1 -0
  67. package/dist/{index.browser-CNrqhvEA.js → index.browser-DaTzn79x.js} +9 -9
  68. package/dist/{index.browser-CNrqhvEA.js.map → index.browser-DaTzn79x.js.map} +1 -1
  69. package/dist/{index.node-DrHiTuOr.js → index.node-NYKqFOoe.js} +5 -5
  70. package/dist/{index.node-DrHiTuOr.js.map → index.node-NYKqFOoe.js.map} +1 -1
  71. package/dist/main.cjs +1 -1
  72. package/dist/main.js +257 -181
  73. package/dist/main.js.map +1 -1
  74. package/dist/node.js +12 -12
  75. package/dist/platform.browser.js +5 -5
  76. package/dist/platform.node.js +3 -3
  77. package/dist/{property-D2Nnsmm1.js → property-ByaiSyUK.js} +10 -10
  78. package/dist/{property-D2Nnsmm1.js.map → property-ByaiSyUK.js.map} +1 -1
  79. package/dist/publishDraftGraph-BRm6Pq3Q.js +405 -0
  80. package/dist/publishDraftGraph-BRm6Pq3Q.js.map +1 -0
  81. package/dist/{resetAmbiguousLegacyItemData-BqbHNUYk.js → resetAmbiguousLegacyItemData-B4dX6ZA1.js} +2 -2
  82. package/dist/{resetAmbiguousLegacyItemData-BqbHNUYk.js.map → resetAmbiguousLegacyItemData-B4dX6ZA1.js.map} +1 -1
  83. package/dist/{resolveModelForSyncedSeed-DQK6JfXS.js → resolveModelForSyncedSeed-B0tco3zG.js} +2 -2
  84. package/dist/{resolveModelForSyncedSeed-DQK6JfXS.js.map → resolveModelForSyncedSeed-B0tco3zG.js.map} +1 -1
  85. package/dist/src/Item/Item.d.ts +11 -0
  86. package/dist/src/Item/Item.d.ts.map +1 -1
  87. package/dist/src/ItemProperty/ItemProperty.d.ts +10 -0
  88. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  89. package/dist/src/Model/Model.d.ts +15 -2
  90. package/dist/src/Model/Model.d.ts.map +1 -1
  91. package/dist/src/Model/service/actors/createModelProperties.d.ts.map +1 -1
  92. package/dist/src/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
  93. package/dist/src/Model/service/actors/validateModel.d.ts.map +1 -1
  94. package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
  95. package/dist/src/ModelProperty/ModelProperty.d.ts +9 -1
  96. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  97. package/dist/src/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
  98. package/dist/src/ModelProperty/service/actors/saveToSchema.d.ts.map +1 -1
  99. package/dist/src/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
  100. package/dist/src/Schema/Schema.d.ts +7 -0
  101. package/dist/src/Schema/Schema.d.ts.map +1 -1
  102. package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +1 -1
  103. package/dist/src/Schema/service/actors/createModelInstances.d.ts.map +1 -1
  104. package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
  105. package/dist/src/db/read/getPublishPayload.d.ts +9 -0
  106. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  107. package/dist/src/db/read/getPublishUploads.d.ts +5 -0
  108. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  109. package/dist/src/db/read/publishDraftGraph.d.ts +57 -0
  110. package/dist/src/db/read/publishDraftGraph.d.ts.map +1 -0
  111. package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
  112. package/dist/src/helpers/entity/entityLiveQuery.d.ts.map +1 -1
  113. package/dist/src/helpers/entity/evictionEpoch.d.ts +18 -0
  114. package/dist/src/helpers/entity/evictionEpoch.d.ts.map +1 -0
  115. package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts +28 -6
  116. package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts.map +1 -1
  117. package/dist/src/index.d.ts +2 -1
  118. package/dist/src/index.d.ts.map +1 -1
  119. package/dist/src/services/write/actors/validateEntity.d.ts.map +1 -1
  120. package/dist/src/types/item.d.ts +7 -8
  121. package/dist/src/types/item.d.ts.map +1 -1
  122. package/dist/{syncDbWithEas-LRKr_NZF.js → syncDbWithEas-BPap9Sru.js} +14 -14
  123. package/dist/{syncDbWithEas-LRKr_NZF.js.map → syncDbWithEas-BPap9Sru.js.map} +1 -1
  124. package/dist/{tabEvents-DYI2GU7i.js → tabEvents-C6NXS6Jl.js} +6 -6
  125. package/dist/{tabEvents-DYI2GU7i.js.map → tabEvents-C6NXS6Jl.js.map} +1 -1
  126. package/dist/{tolerantWebAccess-CzOBz5M6.js → tolerantWebAccess-NBQ1NB4i.js} +6 -6
  127. package/dist/{tolerantWebAccess-CzOBz5M6.js.map → tolerantWebAccess-NBQ1NB4i.js.map} +1 -1
  128. package/dist/{updateSeedRevokedAt-B58ORbY3.js → updateSeedRevokedAt-CYwgVNlM.js} +3 -3
  129. package/dist/{updateSeedRevokedAt-B58ORbY3.js.map → updateSeedRevokedAt-CYwgVNlM.js.map} +1 -1
  130. package/package.json +8 -10
  131. package/dist/ModelProperty-lth9L37R.js.map +0 -1
  132. package/dist/Schema-DOhlrQ-N.js.map +0 -1
  133. package/dist/cjs/ModelProperty-BEsIHAjk.js.map +0 -1
  134. package/dist/cjs/Schema-qEp5mH1N.js.map +0 -1
  135. package/dist/cjs/getPublishPayload-D5-dYtNq.js.map +0 -1
  136. package/dist/cjs/getPublishUploads-B5Lq6q-_.js.map +0 -1
  137. package/dist/cjs/getSegmentedItemProperties-giHO7R3d.js +0 -147
  138. package/dist/cjs/getSegmentedItemProperties-giHO7R3d.js.map +0 -1
  139. package/dist/cjs/index-B3UDbm1C.js.map +0 -1
  140. package/dist/cjs/index-C66AfYDG.js.map +0 -1
  141. package/dist/getPublishPayload-H032DHC7.js.map +0 -1
  142. package/dist/getPublishUploads-CR66RlGJ.js.map +0 -1
  143. package/dist/getSegmentedItemProperties-C2EJ2G0N.js +0 -147
  144. package/dist/getSegmentedItemProperties-C2EJ2G0N.js.map +0 -1
  145. package/dist/index-B0LgJblD.js.map +0 -1
  146. package/dist/index-DtfjeuxC.js.map +0 -1
  147. package/dist/src/browser/helpers/index.d.ts +0 -4
  148. package/dist/src/browser/helpers/index.d.ts.map +0 -1
@@ -1,16 +1,32 @@
1
1
  import { fromCallback, fromPromise, setup, assign, createActor } from 'xstate';
2
- import { B as BaseDb, m as models, p as properties, K as isInternalSchema, i as modelSchemas, s as schemas } from './BasePathResolver-ndE8XTpw.js';
2
+ import { B as BaseDb, j as models, p as properties, K as isInternalSchema, g as modelSchemas, s as schemas } from './BasePathResolver-DRT09oVv.js';
3
3
  import { eq, and, isNull, or } from 'drizzle-orm';
4
- import './tabEvents-DYI2GU7i.js';
4
+ import './tabEvents-C6NXS6Jl.js';
5
5
  import debug from 'debug';
6
6
  import { generateId } from './generateId-BopUwD8F.js';
7
- import { G as writeModelToDb, K as writePropertyToDb, O as addSchemaToDb, A as AmbiguousModelError, Q as renameModelInDb, d as TProperty } from './db-BJZN0a0a.js';
8
- import { j as waitForEntityIdle, T as getInvariantSafePropertyDescriptor, m as findEntity, C as ClientManagerState, I as Item, U as clearDestroySubscriptions, n as forceRemoveFromCaches, V as unloadEntity, o as runDestroyLifecycle } from './Item-zBFWQDU9.js';
9
- import { h as getClient } from './ClientManager-DLleL_2e.js';
7
+ import { G as writeModelToDb, K as writePropertyToDb, O as addSchemaToDb, A as AmbiguousModelError, Q as renameModelInDb, d as TProperty } from './db-Lw0KVZmc.js';
8
+ import { j as waitForEntityIdle, T as getInvariantSafePropertyDescriptor, m as findEntity, C as ClientManagerState, I as Item, U as clearDestroySubscriptions, n as forceRemoveFromCaches, V as unloadEntity, o as runDestroyLifecycle } from './Item-ZUAmf943.js';
9
+ import { h as getClient } from './ClientManager-DngaZdw6.js';
10
10
  import { modelPropertiesToObject } from './model-DGMe-TTm.js';
11
11
  import { toSnakeCase } from 'drizzle-orm/casing';
12
12
  import { Type } from '@sinclair/typebox';
13
13
 
14
+ /**
15
+ * Common getters and utilities for entity classes
16
+ * These work with any entity that has a getService() method returning an XState actor
17
+ */
18
+ /**
19
+ * Get the current state value from an entity's service
20
+ */
21
+ /**
22
+ * Whether an actor has been stopped (unload, destroy, or Schema eviction). Async work started by an
23
+ * entity (DB lookups, retry timers) must check this before sending, since a stopped actor ignores
24
+ * events and XState warns about every one of them.
25
+ */
26
+ function isActorStopped(actor) {
27
+ return actor.getSnapshot().status === 'stopped';
28
+ }
29
+
14
30
  const logger$7 = debug('seedSdk:model:actors:loadOrCreateModel');
15
31
  /**
16
32
  * Create ModelProperty instances for all property IDs to ensure they're cached
@@ -22,7 +38,7 @@ const createPropertyInstances = async (propertyFileIds) => {
22
38
  return;
23
39
  }
24
40
  try {
25
- const mod = await import('./ModelProperty-lth9L37R.js');
41
+ const mod = await import('./ModelProperty-6llK4MTH.js');
26
42
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
27
43
  if (!ModelProperty) {
28
44
  logger$7('createPropertyInstances: ModelProperty not available from dynamic import');
@@ -53,7 +69,7 @@ const createPropertyInstances = async (propertyFileIds) => {
53
69
  // Don't throw - this is best-effort to pre-populate cache
54
70
  }
55
71
  };
56
- const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
72
+ const loadOrCreateModel = fromCallback(({ sendBack, input: { context }, self }) => {
57
73
  const _loadOrCreateModel = async () => {
58
74
  const { modelName, schemaName, id, _idFromSchema } = context; // id is now the schemaFileId (string)
59
75
  if (!modelName || !schemaName) {
@@ -88,10 +104,10 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
88
104
  if (!modelRecord) {
89
105
  // Model names are only unique per schema: prefer this schema's row, and otherwise only
90
106
  // consider same-name rows that no schema claims yet (never another schema's model).
91
- const _mod_0 = await import('./BasePathResolver-ndE8XTpw.js');
107
+ const _mod_0 = await import('./BasePathResolver-DRT09oVv.js');
92
108
  const _ns_0 = _mod_0.R;
93
109
  const { modelSchemas } = _ns_0;
94
- const _mod_1 = await import('./BasePathResolver-ndE8XTpw.js');
110
+ const _mod_1 = await import('./BasePathResolver-DRT09oVv.js');
95
111
  const _ns_1 = _mod_1.Q;
96
112
  const { schemas: schemasTable } = _ns_1;
97
113
  let dbModels = await db
@@ -196,7 +212,9 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
196
212
  .map((record) => record.schemaFileId)
197
213
  .filter((id) => id !== null && id !== undefined);
198
214
  if (propertyFileIds.length > 0) {
199
- await createPropertyInstances(propertyFileIds);
215
+ // Not for a model stopped meanwhile (unloaded, or evicted with its schema)
216
+ if (!isActorStopped(self))
217
+ await createPropertyInstances(propertyFileIds);
200
218
  }
201
219
  // Generate schemaFileId if not set
202
220
  if (!schemaFileId) {
@@ -237,10 +255,13 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
237
255
  // Step 2: Fallback to Schema context (only if database doesn't have the model)
238
256
  // This handles the case where model exists in schema file but not yet in database
239
257
  try {
240
- const _mod_2 = await import('./Schema-DOhlrQ-N.js');
258
+ const _mod_2 = await import('./Schema-D-Ud-XYw.js');
241
259
  const _ns_2 = _mod_2.b;
242
260
  const schemaMod = _ns_2;
243
261
  const { Schema } = schemaMod;
262
+ // Stopped meanwhile (unloaded, or evicted with its schema): don't load the schema again
263
+ if (isActorStopped(self))
264
+ return;
244
265
  const schema = Schema.create(schemaName, { waitForReady: false });
245
266
  const schemaSnapshot = schema.getService().getSnapshot();
246
267
  // Wait for schema to load if it's still loading
@@ -385,11 +406,11 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
385
406
  }
386
407
  // Also check database for models (in case they're persisted but not in Schema context)
387
408
  if (db) {
388
- const _mod_3 = await import('./BasePathResolver-ndE8XTpw.js');
409
+ const _mod_3 = await import('./BasePathResolver-DRT09oVv.js');
389
410
  const _ns_3 = _mod_3.R;
390
411
  const modelSchemaSchemaMod = _ns_3;
391
412
  const { modelSchemas } = modelSchemaSchemaMod;
392
- const _mod_4 = await import('./BasePathResolver-ndE8XTpw.js');
413
+ const _mod_4 = await import('./BasePathResolver-DRT09oVv.js');
393
414
  const _ns_4 = _mod_4.Q;
394
415
  const schemaSchemaMod = _ns_4;
395
416
  const { schemas: schemasTable } = schemaSchemaMod;
@@ -485,12 +506,14 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
485
506
  }
486
507
  // Mark schema as draft when a new model is created so saveNewVersion() can persist it
487
508
  try {
488
- const _mod_5 = await import('./Schema-DOhlrQ-N.js');
509
+ const _mod_5 = await import('./Schema-D-Ud-XYw.js');
489
510
  const _ns_5 = _mod_5.b;
490
511
  const schemaMod = _ns_5;
491
512
  const { Schema } = schemaMod;
492
- const schema = Schema.create(schemaName, { waitForReady: false });
493
- schema.getService().send({ type: 'markAsDraft', propertyKey: 'schema:models' });
513
+ if (!isActorStopped(self)) {
514
+ const schema = Schema.create(schemaName, { waitForReady: false });
515
+ schema.getService().send({ type: 'markAsDraft', propertyKey: 'schema:models' });
516
+ }
494
517
  }
495
518
  catch (err) {
496
519
  logger$7(`Failed to mark schema as draft after creating model: ${err}`);
@@ -511,7 +534,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
511
534
  const logger$6 = debug('seedSdk:model:actors:validateModel');
512
535
  // Validation timeout in milliseconds (10 seconds)
513
536
  const VALIDATION_TIMEOUT_MS = 10000;
514
- const validateModel = fromCallback(({ sendBack, input: { context } }) => {
537
+ const validateModel = fromCallback(({ sendBack, input: { context }, self }) => {
515
538
  let hasResponded = false;
516
539
  // Timeout handler to ensure we always respond
517
540
  const timeoutId = setTimeout(() => {
@@ -531,10 +554,10 @@ const validateModel = fromCallback(({ sendBack, input: { context } }) => {
531
554
  const _validateModel = async () => {
532
555
  try {
533
556
  // Use dynamic imports to break circular dependencies
534
- const validationServiceMod = await import('./SchemaValidationService-DDKr5piy.js');
557
+ const validationServiceMod = await import('./SchemaValidationService-IoS7JquP.js');
535
558
  const { SchemaValidationService } = validationServiceMod;
536
559
  const validationService = new SchemaValidationService();
537
- const _mod_6 = await import('./Schema-DOhlrQ-N.js');
560
+ const _mod_6 = await import('./Schema-D-Ud-XYw.js');
538
561
  const _ns_6 = _mod_6.b;
539
562
  const schemaMod = _ns_6;
540
563
  const { Schema } = schemaMod;
@@ -551,6 +574,9 @@ const validateModel = fromCallback(({ sendBack, input: { context } }) => {
551
574
  // If we have schema name, validate against schema
552
575
  // CRITICAL: Use validateModelAgainstSchema which doesn't require the model to be in schema context
553
576
  // This allows validation BEFORE registration, preventing update loops
577
+ // Stopped meanwhile (unloaded, or evicted with its schema): don't load the schema again
578
+ if (isActorStopped(self))
579
+ return;
554
580
  if (context.schemaName) {
555
581
  try {
556
582
  const schema = Schema.create(context.schemaName, {
@@ -633,7 +659,11 @@ const validateModel = fromCallback(({ sendBack, input: { context } }) => {
633
659
  });
634
660
 
635
661
  const logger$5 = debug('seedSdk:model:actors:createModelProperties');
636
- const createModelProperties = fromCallback(({ sendBack, input }) => {
662
+ const createModelProperties = fromCallback(({ sendBack, input, self }) => {
663
+ // The model was stopped (unloaded, or evicted with its schema by Schema.destroy / test cleanup) while
664
+ // this ran: stopping it stops this actor too, but can't cancel the awaits below. A stopped model
665
+ // creates no properties (they'd be cached for a model that's gone, and write rows under it).
666
+ const stopped = () => isActorStopped(self);
637
667
  const _createProperties = async () => {
638
668
  const { context, propertyDefinitions } = input;
639
669
  const { id, _dbId, modelName, schemaName } = context;
@@ -646,7 +676,7 @@ const createModelProperties = fromCallback(({ sendBack, input }) => {
646
676
  return;
647
677
  }
648
678
  logger$5(`Creating ${Object.keys(propertyDefinitions).length} properties for model "${modelName}" (id: ${_dbId})`);
649
- const mod = await import('./ModelProperty-lth9L37R.js');
679
+ const mod = await import('./ModelProperty-6llK4MTH.js');
650
680
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
651
681
  if (!ModelProperty) {
652
682
  logger$5('ModelProperty not available from dynamic import');
@@ -687,7 +717,7 @@ const createModelProperties = fromCallback(({ sendBack, input }) => {
687
717
  }
688
718
  else if (refModelName) {
689
719
  // Fallback: resolve the ref by name within this model's schema
690
- const _mod_7 = await import('./db-BJZN0a0a.js');
720
+ const _mod_7 = await import('./db-Lw0KVZmc.js');
691
721
  const _ns_7 = _mod_7.Y;
692
722
  const { resolveModelRecord } = _ns_7;
693
723
  const refModelRecord = await resolveModelRecord(refModelName, { schemaName }, db);
@@ -702,6 +732,10 @@ const createModelProperties = fromCallback(({ sendBack, input }) => {
702
732
  // Continue without refModelId - it will be resolved later in _initializeOriginalValues
703
733
  }
704
734
  }
735
+ if (stopped()) {
736
+ logger$5(`Model "${modelName}" was stopped while creating its properties; not creating the rest`);
737
+ return;
738
+ }
705
739
  // Create ModelProperty instance
706
740
  // This will load from DB if it exists, or create new instance
707
741
  // The property should already be in DB from writeModelToDb
@@ -740,6 +774,37 @@ const createModelProperties = fromCallback(({ sendBack, input }) => {
740
774
  };
741
775
  });
742
776
 
777
+ /**
778
+ * Eviction epochs: lets work that was started before a schema's Model/ModelProperty instances were
779
+ * evicted (Schema.destroy, test cleanup) tell, when it finishes, that it must not put instances for
780
+ * that schema back in the caches. Stopping the evicted actors can't cancel such work (a DB lookup
781
+ * that ends in Model.create, a model's property creation), and finishing it after the eviction would
782
+ * rebuild instances from rows that are about to be deleted, which then write themselves again.
783
+ *
784
+ * Capture `currentEvictionEpoch()` when the work starts; before creating or caching an instance, skip
785
+ * it when `schemaEvictedSince(schemaName, epoch)`. Work started after an eviction is unaffected.
786
+ */
787
+ let epoch = 0;
788
+ const lastEvictionBySchema = new Map();
789
+ function currentEvictionEpoch() {
790
+ return epoch;
791
+ }
792
+ /** Called by Model.evictForSchema. */
793
+ function recordSchemaEviction(schemaName) {
794
+ epoch += 1;
795
+ lastEvictionBySchema.set(schemaName, epoch);
796
+ }
797
+ /** True when the schema's instances were evicted after `since` (an epoch from currentEvictionEpoch). */
798
+ function schemaEvictedSince(schemaName, since) {
799
+ if (epoch === since || !schemaName)
800
+ return false;
801
+ return (lastEvictionBySchema.get(schemaName) ?? 0) > since;
802
+ }
803
+ /** True when any schema was evicted after `since` (cheap check before looking up which schemas apply). */
804
+ function anyEvictionSince(since) {
805
+ return epoch !== since;
806
+ }
807
+
743
808
  const logger$4 = debug('seedSdk:write:validateEntity');
744
809
  // XState v5 type inference bug: fromPromise types are inverted
745
810
  // We use type assertion to work around this
@@ -747,6 +812,20 @@ const validateEntity = fromPromise(async ({ input }) => {
747
812
  // Type assertion to fix XState v5 type inference bug
748
813
  // Convert through unknown to avoid type overlap error
749
814
  const entityInput = input;
815
+ // Validation awaits imports before looking up the schema; the entity can be evicted with its
816
+ // schema meanwhile (Schema.destroy, test cleanup). Schema.create would then load the evicted
817
+ // schema again, and its load re-creates the schema's models from rows being deleted.
818
+ const evictionEpoch = currentEvictionEpoch();
819
+ /** The schema to validate against; throws (validation then skips the schema check) once it was evicted. */
820
+ const schemaForValidation = async (schemaName) => {
821
+ const _mod_8 = await import('./Schema-D-Ud-XYw.js');
822
+ const _ns_8 = _mod_8.b;
823
+ const { Schema } = _ns_8;
824
+ if (schemaEvictedSince(schemaName, evictionEpoch)) {
825
+ throw new Error(`Schema "${schemaName}" was evicted during validation`);
826
+ }
827
+ return Schema.create(schemaName, { waitForReady: false });
828
+ };
750
829
  const _validate = async () => {
751
830
  try {
752
831
  const msg = `[validateEntity] Starting validation for ${entityInput.entityType}`;
@@ -757,7 +836,7 @@ const validateEntity = fromPromise(async ({ input }) => {
757
836
  const structureMsg = `[validateEntity] Validating model structure`;
758
837
  logger$4(structureMsg);
759
838
  // Use existing Model validation
760
- const validationServiceMod = await import('./SchemaValidationService-DDKr5piy.js');
839
+ const validationServiceMod = await import('./SchemaValidationService-IoS7JquP.js');
761
840
  const { SchemaValidationService } = validationServiceMod;
762
841
  const validationService = new SchemaValidationService();
763
842
  // Validate model structure
@@ -775,13 +854,7 @@ const validateEntity = fromPromise(async ({ input }) => {
775
854
  if (entityInput.entityData.schemaName) {
776
855
  try {
777
856
  logger$4(`[validateEntity] Validating model against schema "${entityInput.entityData.schemaName}"`);
778
- const _mod_8 = await import('./Schema-DOhlrQ-N.js');
779
- const _ns_8 = _mod_8.b;
780
- const schemaMod = _ns_8;
781
- const { Schema } = schemaMod;
782
- const schema = Schema.create(entityInput.entityData.schemaName, {
783
- waitForReady: false,
784
- });
857
+ const schema = await schemaForValidation(entityInput.entityData.schemaName);
785
858
  const schemaSnapshot = schema.getService().getSnapshot();
786
859
  const schemaStatus = schemaSnapshot.value;
787
860
  logger$4(`[validateEntity] Schema status: ${schemaStatus}`);
@@ -813,7 +886,7 @@ const validateEntity = fromPromise(async ({ input }) => {
813
886
  }
814
887
  else if (entityInput.entityType === 'modelProperty') {
815
888
  // Use existing ModelProperty validation
816
- const validationServiceMod = await import('./SchemaValidationService-DDKr5piy.js');
889
+ const validationServiceMod = await import('./SchemaValidationService-IoS7JquP.js');
817
890
  const { SchemaValidationService } = validationServiceMod;
818
891
  const validationService = new SchemaValidationService();
819
892
  // Validate property structure
@@ -828,13 +901,7 @@ const validateEntity = fromPromise(async ({ input }) => {
828
901
  // If schema name and model name provided, validate against schema
829
902
  if (entityInput.entityData._schemaName && entityInput.entityData.modelName) {
830
903
  try {
831
- const _mod_9 = await import('./Schema-DOhlrQ-N.js');
832
- const _ns_9 = _mod_9.b;
833
- const schemaMod = _ns_9;
834
- const { Schema } = schemaMod;
835
- const schema = Schema.create(entityInput.entityData._schemaName, {
836
- waitForReady: false,
837
- });
904
+ const schema = await schemaForValidation(entityInput.entityData._schemaName);
838
905
  const schemaSnapshot = schema.getService().getSnapshot();
839
906
  const schemaStatus = schemaSnapshot.value;
840
907
  if (schemaStatus === 'idle') {
@@ -859,7 +926,7 @@ const validateEntity = fromPromise(async ({ input }) => {
859
926
  }
860
927
  else if (entityInput.entityType === 'schema') {
861
928
  // Schema validation - use existing validation
862
- const validationServiceMod = await import('./SchemaValidationService-DDKr5piy.js');
929
+ const validationServiceMod = await import('./SchemaValidationService-IoS7JquP.js');
863
930
  const { SchemaValidationService } = validationServiceMod;
864
931
  const validationService = new SchemaValidationService();
865
932
  const schemaResult = validationService.validateSchema(entityInput.entityData);
@@ -948,7 +1015,7 @@ const writeToDatabase = fromCallback(({ sendBack, input }) => {
948
1015
  // initial write completes is not overwritten by the stale requestWrite payload.
949
1016
  let dataToWrite = input.entityData;
950
1017
  try {
951
- const mod = await import('./ModelProperty-lth9L37R.js');
1018
+ const mod = await import('./ModelProperty-6llK4MTH.js');
952
1019
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
953
1020
  if (ModelProperty && typeof ModelProperty.getById === 'function') {
954
1021
  const instance = ModelProperty.getById(input.entityId);
@@ -1331,16 +1398,23 @@ const modelMachine = setup({
1331
1398
  ({ context, event, self }) => {
1332
1399
  if (event._liveQueryPropertyIds !== undefined) {
1333
1400
  const newPropertyIds = event._liveQueryPropertyIds;
1401
+ // The model can be evicted with its schema (Schema.destroy, test cleanup) before the
1402
+ // timer and import below run: then create nothing, and drop lookups an eviction overtakes.
1403
+ const evictionEpoch = currentEvictionEpoch();
1334
1404
  // Use setTimeout to check after assign has been applied
1335
1405
  setTimeout(() => {
1336
- self.getSnapshot();
1406
+ const snapshot = self.getSnapshot();
1407
+ if (snapshot.status === 'stopped')
1408
+ return;
1337
1409
  // Create ModelProperty instances for any new property IDs
1338
1410
  if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
1339
1411
  // Import and create instances asynchronously (fire-and-forget)
1340
- import('./ModelProperty-lth9L37R.js').then(({ ModelProperty }) => {
1412
+ import('./ModelProperty-6llK4MTH.js').then(({ ModelProperty }) => {
1413
+ if (self.getSnapshot().status === 'stopped')
1414
+ return;
1341
1415
  const createPromises = newPropertyIds.map(async (propertyFileId) => {
1342
1416
  try {
1343
- const property = await ModelProperty.createById(propertyFileId);
1417
+ const property = await ModelProperty.createById(propertyFileId, { evictionEpoch });
1344
1418
  if (property) {
1345
1419
  logger$1(`[modelMachine] Created/cached ModelProperty instance for propertyFileId "${propertyFileId}" after _liveQueryPropertyIds update`);
1346
1420
  }
@@ -1638,22 +1712,6 @@ class ConflictError extends Error {
1638
1712
  }
1639
1713
  }
1640
1714
 
1641
- /**
1642
- * Common getters and utilities for entity classes
1643
- * These work with any entity that has a getService() method returning an XState actor
1644
- */
1645
- /**
1646
- * Get the current state value from an entity's service
1647
- */
1648
- /**
1649
- * Whether an actor has been stopped (unload, destroy, or Schema eviction). Async work started by an
1650
- * entity (DB lookups, retry timers) must check this before sending, since a stopped actor ignores
1651
- * events and XState warns about every one of them.
1652
- */
1653
- function isActorStopped(actor) {
1654
- return actor.getSnapshot().status === 'stopped';
1655
- }
1656
-
1657
1715
  /**
1658
1716
  * Set up liveQuery subscription for an entity
1659
1717
  * This enables cross-instance synchronization (e.g., changes in other tabs/windows)
@@ -1679,7 +1737,10 @@ function setupEntityLiveQuery(instance, config) {
1679
1737
  const initialIds = config.extractEntityIds(initialRows);
1680
1738
  if (initialIds.length > 0) {
1681
1739
  logger(`Initial query returned ${initialIds.length} entities`);
1682
- // Create child instances if provided
1740
+ // Create child instances if provided (not for a stopped entity: an unloaded or evicted
1741
+ // parent must not re-cache its children)
1742
+ if (isActorStopped(instance.getService()))
1743
+ return;
1683
1744
  if (config.createChildInstances) {
1684
1745
  await config.createChildInstances(initialIds);
1685
1746
  }
@@ -1710,7 +1771,9 @@ function setupEntityLiveQuery(instance, config) {
1710
1771
  }
1711
1772
  logger(`Query returned ${rows.length} rows`);
1712
1773
  const ids = config.extractEntityIds(rows);
1713
- // Create child instances if provided (before updating context)
1774
+ // Create child instances if provided (before updating context; not for a stopped entity)
1775
+ if (isActorStopped(instance.getService()))
1776
+ return;
1714
1777
  if (config.createChildInstances && ids.length > 0) {
1715
1778
  await config.createChildInstances(ids);
1716
1779
  }
@@ -1851,7 +1914,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
1851
1914
  // Lazy import cache for ModelProperty to avoid circular dependency
1852
1915
  // Eagerly start loading to minimize delay on first access
1853
1916
  let ModelPropertyClass = null;
1854
- const modelPropertyImportPromise = import('./ModelProperty-lth9L37R.js')
1917
+ const modelPropertyImportPromise = import('./ModelProperty-6llK4MTH.js')
1855
1918
  .then(module => {
1856
1919
  ModelPropertyClass = module.ModelProperty;
1857
1920
  return ModelPropertyClass;
@@ -1867,7 +1930,7 @@ function getModelProperty() {
1867
1930
  return ModelPropertyClass;
1868
1931
  }
1869
1932
  // Lazy import for Schema to avoid circular dependency
1870
- const schemaImportPromise = (async () => { const _mod_12 = await import('./Schema-DOhlrQ-N.js'); return _mod_12.b; })()
1933
+ const schemaImportPromise = (async () => { const _mod_11 = await import('./Schema-D-Ud-XYw.js'); return _mod_11.b; })()
1871
1934
  .then(module => module.Schema)
1872
1935
  .catch(() => null);
1873
1936
  // WeakMap to store mutable state per Model instance
@@ -2365,6 +2428,9 @@ class Model {
2365
2428
  resolve();
2366
2429
  }, 10000);
2367
2430
  });
2431
+ // Unloaded or evicted (e.g. Schema.destroy) while it loaded: a stopped model never writes
2432
+ if (isActorStopped(proxiedInstance._service))
2433
+ return;
2368
2434
  // Only write if validation passed (model is in idle state, not error)
2369
2435
  const finalSnapshot = proxiedInstance._service.getSnapshot();
2370
2436
  if (finalSnapshot.value === 'idle' && (!finalSnapshot.context._validationErrors || finalSnapshot.context._validationErrors.length === 0)) {
@@ -2488,8 +2554,8 @@ class Model {
2488
2554
  }
2489
2555
  logger(`WARNING: Could not verify schema exists in database: ${error}. Proceeding anyway.`);
2490
2556
  }
2491
- // Track pending write
2492
- Model.trackPendingWrite(finalSnapshot.context.id, schemaId); // id is now the schemaFileId (string)
2557
+ const pendingModelFileId = finalSnapshot.context.id;
2558
+ const pendingSchemaId = schemaId;
2493
2559
  // Wait for writeProcess to be spawned (it's spawned in idle state entry action)
2494
2560
  // Retry a few times if writeProcess isn't available yet
2495
2561
  let retries = 0;
@@ -2500,6 +2566,8 @@ class Model {
2500
2566
  return;
2501
2567
  const currentSnapshot = proxiedInstance._service.getSnapshot();
2502
2568
  if (currentSnapshot.context.writeProcess) {
2569
+ // Track pending write (only once it really starts: a stopped model leaves none behind)
2570
+ Model.trackPendingWrite(pendingModelFileId, pendingSchemaId); // id is now the schemaFileId (string)
2503
2571
  logger(`Triggering write process for model "${finalSnapshot.context.modelName}" (schemaId: ${schemaId})`);
2504
2572
  // Use pending property definitions if available, otherwise convert from ModelProperty instances
2505
2573
  let propertiesObject = {};
@@ -2720,6 +2788,7 @@ class Model {
2720
2788
  if (scope.modelFileId || scope.schemaName) {
2721
2789
  const db = BaseDb.getAppDb();
2722
2790
  if (db) {
2791
+ const evictionEpoch = currentEvictionEpoch();
2723
2792
  try {
2724
2793
  const rows = await db
2725
2794
  .select({
@@ -2736,6 +2805,9 @@ class Model {
2736
2805
  .limit(1);
2737
2806
  const record = rows[0];
2738
2807
  if (record?.modelName && record.schemaName && record.modelFileId) {
2808
+ // Its schema was evicted while we read the row: don't bring the model back.
2809
+ if (schemaEvictedSince(record.schemaName, evictionEpoch))
2810
+ return undefined;
2739
2811
  return this.create(record.modelName, record.schemaName, { id: record.modelFileId });
2740
2812
  }
2741
2813
  }
@@ -2754,7 +2826,7 @@ class Model {
2754
2826
  * @param schemaName - Optional schema name (will query DB if not provided)
2755
2827
  * @returns The Model instance if found, undefined otherwise
2756
2828
  */
2757
- static async getByNameAsync(modelName, schemaName) {
2829
+ static async getByNameAsync(modelName, schemaName, options) {
2758
2830
  // First try cache
2759
2831
  const cached = this.getByName(modelName, schemaName);
2760
2832
  if (cached) {
@@ -2766,11 +2838,12 @@ class Model {
2766
2838
  if (!db) {
2767
2839
  return undefined;
2768
2840
  }
2841
+ const evictionEpoch = options?.evictionEpoch ?? currentEvictionEpoch();
2769
2842
  try {
2770
2843
  // Query model by name (throws AmbiguousModelError when several schemas define it)
2771
- const _mod_10 = await import('./db-BJZN0a0a.js');
2772
- const _ns_10 = _mod_10.Y;
2773
- const { resolveModelRecord } = _ns_10;
2844
+ const _mod_9 = await import('./db-Lw0KVZmc.js');
2845
+ const _ns_9 = _mod_9.Y;
2846
+ const { resolveModelRecord } = _ns_9;
2774
2847
  const resolved = await resolveModelRecord(modelName, {}, db);
2775
2848
  if (!resolved?.schemaFileId) {
2776
2849
  return undefined;
@@ -2793,6 +2866,10 @@ class Model {
2793
2866
  if (!record.modelName || !record.schemaName || !record.modelFileId) {
2794
2867
  return undefined;
2795
2868
  }
2869
+ // Its schema was evicted while we read the row: don't bring the model back.
2870
+ if (schemaEvictedSince(record.schemaName, evictionEpoch)) {
2871
+ return undefined;
2872
+ }
2796
2873
  // Create model instance (will be cached)
2797
2874
  return this.create(record.modelName, record.schemaName, {
2798
2875
  id: record.modelFileId, // id is now the schemaFileId (string)
@@ -2814,7 +2891,7 @@ class Model {
2814
2891
  * @param modelFileId - The model file ID to look up
2815
2892
  * @returns The Model instance if found, undefined otherwise
2816
2893
  */
2817
- static async createById(modelFileId) {
2894
+ static async createById(modelFileId, options) {
2818
2895
  if (!modelFileId) {
2819
2896
  return undefined;
2820
2897
  }
@@ -2830,6 +2907,7 @@ class Model {
2830
2907
  logger(`Model.createById: Database not available for ID "${modelFileId}"`);
2831
2908
  return undefined;
2832
2909
  }
2910
+ const evictionEpoch = options?.evictionEpoch ?? currentEvictionEpoch();
2833
2911
  try {
2834
2912
  // Query model by schemaFileId and join to get schema name
2835
2913
  const modelRecords = await db
@@ -2852,6 +2930,12 @@ class Model {
2852
2930
  logger(`Model.createById: Missing modelName or schemaName for ID "${modelFileId}"`);
2853
2931
  return undefined;
2854
2932
  }
2933
+ // Its schema was evicted while we read the row (e.g. a Schema live query in flight during
2934
+ // Schema.destroy or test cleanup): don't bring the model back.
2935
+ if (schemaEvictedSince(schemaName, evictionEpoch)) {
2936
+ logger(`Model.createById: schema "${schemaName}" was evicted during the lookup of "${modelFileId}"`);
2937
+ return undefined;
2938
+ }
2855
2939
  // Step 3: Create model using existing create method (which will handle caching)
2856
2940
  logger(`Model.createById: Creating model "${modelName}" in schema "${schemaName}" from ID "${modelFileId}"`);
2857
2941
  return this.create(modelName, schemaName, {
@@ -2906,6 +2990,7 @@ class Model {
2906
2990
  logger(`Model.createBySchemaId: Database not available for schema "${schemaIdentifier}"`);
2907
2991
  return [];
2908
2992
  }
2993
+ const evictionEpoch = currentEvictionEpoch();
2909
2994
  try {
2910
2995
  // Query all models for this schema - support both schemaFileId and schema name
2911
2996
  const modelRecords = await db
@@ -2928,6 +3013,10 @@ class Model {
2928
3013
  if (!record.modelName || !record.schemaName || !record.modelFileId) {
2929
3014
  continue;
2930
3015
  }
3016
+ // Its schema was evicted while we read the rows: don't bring its models back.
3017
+ if (schemaEvictedSince(record.schemaName, evictionEpoch)) {
3018
+ continue;
3019
+ }
2931
3020
  // Check cache first
2932
3021
  const cached = this.getById(record.modelFileId);
2933
3022
  if (cached) {
@@ -3374,6 +3463,8 @@ class Model {
3374
3463
  * @returns names of the evicted models (so callers can evict their ModelProperty instances)
3375
3464
  */
3376
3465
  static evictForSchema(schemaName) {
3466
+ // Work already running for this schema's models must not re-cache them when it finishes.
3467
+ recordSchemaEviction(schemaName);
3377
3468
  const instances = new Set();
3378
3469
  for (const { instance } of this.instanceCacheById.values())
3379
3470
  instances.add(instance);
@@ -3526,9 +3617,9 @@ class Model {
3526
3617
  return undefined;
3527
3618
  }
3528
3619
  // Model names are only unique per schema: find this model's row by its id (schemaFileId).
3529
- const _mod_11 = await import('./db-BJZN0a0a.js');
3530
- const _ns_11 = _mod_11.Y;
3531
- const { resolveModelRecord } = _ns_11;
3620
+ const _mod_10 = await import('./db-Lw0KVZmc.js');
3621
+ const _ns_10 = _mod_10.Y;
3622
+ const { resolveModelRecord } = _ns_10;
3532
3623
  const modelRecord = await resolveModelRecord(modelName, { modelFileId: context.id, schemaName: context.schemaName }, db);
3533
3624
  if (!modelRecord?.id) {
3534
3625
  return undefined;
@@ -3731,5 +3822,5 @@ var Model$1 = /*#__PURE__*/Object.freeze({
3731
3822
  const TModelValues = Type.Record(Type.String(), Type.Any());
3732
3823
  const TModelSchema = Type.Record(Type.String(), TProperty);
3733
3824
 
3734
- export { ConflictError as C, Model as M, TModelSchema as T, TModelValues as a, writeToDatabase$1 as b, Model$1 as c, isActorStopped as i, setupEntityLiveQuery as s, writeProcessMachine as w };
3735
- //# sourceMappingURL=index-DtfjeuxC.js.map
3825
+ export { ConflictError as C, Model as M, TModelSchema as T, TModelValues as a, anyEvictionSince as b, currentEvictionEpoch as c, setupEntityLiveQuery as d, writeToDatabase$1 as e, Model$1 as f, isActorStopped as i, schemaEvictedSince as s, writeProcessMachine as w };
3826
+ //# sourceMappingURL=index-Y-yYyRBf.js.map