@seedprotocol/sdk 0.7.3 → 0.7.4-next.784.g879c6a3

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 (127) hide show
  1. package/dist/{BasePathResolver-Cm4apKRb.js → BasePathResolver-DxdS0wJ0.js} +43 -8
  2. package/dist/BasePathResolver-DxdS0wJ0.js.map +1 -0
  3. package/dist/{ClientManager-i3nJASkg.js → ClientManager-De-vKHGe.js} +37 -38
  4. package/dist/ClientManager-De-vKHGe.js.map +1 -0
  5. package/dist/{Item-DBFchXpC.js → Item-cq9VcsAY.js} +365 -191
  6. package/dist/Item-cq9VcsAY.js.map +1 -0
  7. package/dist/{ModelProperty-BS49g01Y.js → ModelProperty-DuuoFXaC.js} +45 -37
  8. package/dist/ModelProperty-DuuoFXaC.js.map +1 -0
  9. package/dist/{Schema-CpMNEnUO.js → Schema-Dc5EA8Yb.js} +246 -68
  10. package/dist/Schema-Dc5EA8Yb.js.map +1 -0
  11. package/dist/{SchemaValidationService-DieV4KL-.js → SchemaValidationService-DViJ056F.js} +49 -36
  12. package/dist/SchemaValidationService-DViJ056F.js.map +1 -0
  13. package/dist/{backfillMetadataPropertyIds-DSoOoTnX.js → backfillMetadataPropertyIds-DacVthS5.js} +3 -3
  14. package/dist/{backfillMetadataPropertyIds-DSoOoTnX.js.map → backfillMetadataPropertyIds-DacVthS5.js.map} +1 -1
  15. package/dist/{configurePlatform-D0lQGAMQ.js → configurePlatform-DlZ23w7e.js} +2 -2
  16. package/dist/{configurePlatform-D0lQGAMQ.js.map → configurePlatform-DlZ23w7e.js.map} +1 -1
  17. package/dist/{detachRowsBeforeDelete-S0q-DJPT.js → detachRowsBeforeDelete-YRSZY6dO.js} +2 -2
  18. package/dist/{detachRowsBeforeDelete-S0q-DJPT.js.map → detachRowsBeforeDelete-YRSZY6dO.js.map} +1 -1
  19. package/dist/{eas-6pjU-OuX.js → eas-D_6ptL_F.js} +4 -4
  20. package/dist/{eas-6pjU-OuX.js.map → eas-D_6ptL_F.js.map} +1 -1
  21. package/dist/{index-8O3Uow-Y.js → errors-Cl8rbtKR.js} +192 -48
  22. package/dist/errors-Cl8rbtKR.js.map +1 -0
  23. package/dist/{getItem-CxBNZ-WL.js → getItem-BcmJcUZB.js} +5 -5
  24. package/dist/{getItem-CxBNZ-WL.js.map → getItem-BcmJcUZB.js.map} +1 -1
  25. package/dist/{getPublishPayload-CTCvRUoU.js → getPublishPayload-C278kK9P.js} +15 -15
  26. package/dist/{getPublishPayload-CTCvRUoU.js.map → getPublishPayload-C278kK9P.js.map} +1 -1
  27. package/dist/{getPublishUploads-SFHCbf_y.js → getPublishUploads-DJ1UPh7i.js} +9 -9
  28. package/dist/{getPublishUploads-SFHCbf_y.js.map → getPublishUploads-DJ1UPh7i.js.map} +1 -1
  29. package/dist/{index-Cvt5UBz4.js → index-CqnU-5i0.js} +9 -9
  30. package/dist/index-CqnU-5i0.js.map +1 -0
  31. package/dist/{index-AVFTVp1m.js → index-DAl9U4rn.js} +2 -2
  32. package/dist/index-DAl9U4rn.js.map +1 -0
  33. package/dist/{index.browser-DBhxRoe8.js → index.browser-J6QZ9smP.js} +10 -10
  34. package/dist/{index.browser-DBhxRoe8.js.map → index.browser-J6QZ9smP.js.map} +1 -1
  35. package/dist/{index.node-CJhlcNHM.js → index.node-C9VB9NlX.js} +9 -9
  36. package/dist/index.node-C9VB9NlX.js.map +1 -0
  37. package/dist/main.js +24 -24
  38. package/dist/{model-DGMe-TTm.js → model-oHA3YhOd.js} +5 -1
  39. package/dist/model-oHA3YhOd.js.map +1 -0
  40. package/dist/node.js +11 -11
  41. package/dist/node.js.map +1 -1
  42. package/dist/platform.browser.js +5 -5
  43. package/dist/platform.node.js +4 -4
  44. package/dist/{property-DwPD283A.js → property-Brgr5RdT.js} +11 -11
  45. package/dist/{property-DwPD283A.js.map → property-Brgr5RdT.js.map} +1 -1
  46. package/dist/propertyValidationRules-CDRitiiK.js +51 -0
  47. package/dist/propertyValidationRules-CDRitiiK.js.map +1 -0
  48. package/dist/{publishDraftGraph-BOn3_Occ.js → publishDraftGraph-C37ibxb5.js} +6 -6
  49. package/dist/{publishDraftGraph-BOn3_Occ.js.map → publishDraftGraph-C37ibxb5.js.map} +1 -1
  50. package/dist/{resetAmbiguousLegacyItemData-BkYmBeJc.js → resetAmbiguousLegacyItemData-CcLFRREE.js} +2 -2
  51. package/dist/{resetAmbiguousLegacyItemData-BkYmBeJc.js.map → resetAmbiguousLegacyItemData-CcLFRREE.js.map} +1 -1
  52. package/dist/{resolveModelForSyncedSeed-BL24nLa7.js → resolveModelForSyncedSeed-BTAeCOJE.js} +2 -2
  53. package/dist/{resolveModelForSyncedSeed-BL24nLa7.js.map → resolveModelForSyncedSeed-BTAeCOJE.js.map} +1 -1
  54. package/dist/src/Item/Item.d.ts +6 -2
  55. package/dist/src/Item/Item.d.ts.map +1 -1
  56. package/dist/src/Item/errors.d.ts +23 -0
  57. package/dist/src/Item/errors.d.ts.map +1 -0
  58. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  59. package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
  60. package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +1 -1
  61. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
  62. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.d.ts +19 -0
  63. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.d.ts.map +1 -1
  64. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +1 -1
  65. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -1
  66. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  67. package/dist/src/Model/Model.d.ts +2 -0
  68. package/dist/src/Model/Model.d.ts.map +1 -1
  69. package/dist/src/Model/service/actors/createModelProperties.d.ts.map +1 -1
  70. package/dist/src/ModelProperty/ModelProperty.d.ts +2 -0
  71. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  72. package/dist/src/Schema/Schema.d.ts +11 -2
  73. package/dist/src/Schema/Schema.d.ts.map +1 -1
  74. package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +1 -1
  75. package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
  76. package/dist/src/Schema/service/schemaMachine.d.ts.map +1 -1
  77. package/dist/src/Schema/service/validation/SchemaValidationService.d.ts +4 -1
  78. package/dist/src/Schema/service/validation/SchemaValidationService.d.ts.map +1 -1
  79. package/dist/src/db/Db/BaseDb.d.ts +5 -2
  80. package/dist/src/db/Db/BaseDb.d.ts.map +1 -1
  81. package/dist/src/db/write/updateItemPropertyValue.d.ts.map +1 -1
  82. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  83. package/dist/src/helpers/db.d.ts.map +1 -1
  84. package/dist/src/helpers/entity/draftSaveErrors.d.ts +4 -0
  85. package/dist/src/helpers/entity/draftSaveErrors.d.ts.map +1 -0
  86. package/dist/src/helpers/entity/entityUnload.d.ts +2 -1
  87. package/dist/src/helpers/entity/entityUnload.d.ts.map +1 -1
  88. package/dist/src/helpers/entity/evictionEpoch.d.ts +27 -2
  89. package/dist/src/helpers/entity/evictionEpoch.d.ts.map +1 -1
  90. package/dist/src/helpers/isSqliteUniqueConstraintError.d.ts.map +1 -1
  91. package/dist/src/helpers/model.d.ts.map +1 -1
  92. package/dist/src/helpers/propertyValidationRules.d.ts +12 -0
  93. package/dist/src/helpers/propertyValidationRules.d.ts.map +1 -0
  94. package/dist/src/helpers/propertyWriteQueue.d.ts +15 -0
  95. package/dist/src/helpers/propertyWriteQueue.d.ts.map +1 -0
  96. package/dist/src/helpers/schema.d.ts.map +1 -1
  97. package/dist/src/helpers/storageFileName.d.ts +7 -0
  98. package/dist/src/helpers/storageFileName.d.ts.map +1 -0
  99. package/dist/src/index.d.ts +1 -0
  100. package/dist/src/index.d.ts.map +1 -1
  101. package/dist/src/node/db/Db.d.ts +1 -1
  102. package/dist/src/node/db/Db.d.ts.map +1 -1
  103. package/dist/src/node/index.d.ts +1 -0
  104. package/dist/src/node/index.d.ts.map +1 -1
  105. package/dist/src/types/index.d.ts +12 -0
  106. package/dist/src/types/index.d.ts.map +1 -1
  107. package/dist/{syncDbWithEas-Bv2Fe38J.js → syncDbWithEas-B-Ho0IOB.js} +50 -27
  108. package/dist/syncDbWithEas-B-Ho0IOB.js.map +1 -0
  109. package/dist/{tabEvents-9s2WCYw-.js → tabEvents-BTzckWrN.js} +4 -4
  110. package/dist/{tabEvents-9s2WCYw-.js.map → tabEvents-BTzckWrN.js.map} +1 -1
  111. package/dist/{tolerantWebAccess-iUu80pAP.js → tolerantWebAccess-DOm2Xv-f.js} +6 -6
  112. package/dist/{tolerantWebAccess-iUu80pAP.js.map → tolerantWebAccess-DOm2Xv-f.js.map} +1 -1
  113. package/dist/{updateSeedRevokedAt-zBfi931j.js → updateSeedRevokedAt-IHXnJI-i.js} +3 -3
  114. package/dist/{updateSeedRevokedAt-zBfi931j.js.map → updateSeedRevokedAt-IHXnJI-i.js.map} +1 -1
  115. package/package.json +5 -5
  116. package/dist/BasePathResolver-Cm4apKRb.js.map +0 -1
  117. package/dist/ClientManager-i3nJASkg.js.map +0 -1
  118. package/dist/Item-DBFchXpC.js.map +0 -1
  119. package/dist/ModelProperty-BS49g01Y.js.map +0 -1
  120. package/dist/Schema-CpMNEnUO.js.map +0 -1
  121. package/dist/SchemaValidationService-DieV4KL-.js.map +0 -1
  122. package/dist/index-8O3Uow-Y.js.map +0 -1
  123. package/dist/index-AVFTVp1m.js.map +0 -1
  124. package/dist/index-Cvt5UBz4.js.map +0 -1
  125. package/dist/index.node-CJhlcNHM.js.map +0 -1
  126. package/dist/model-DGMe-TTm.js.map +0 -1
  127. package/dist/syncDbWithEas-Bv2Fe38J.js.map +0 -1
@@ -1,15 +1,15 @@
1
1
  import { fromCallback, setup, assign, createActor } from 'xstate';
2
- import { i as isActorStopped, w as writeProcessMachine, c as currentEvictionEpoch, M as Model, b as anyEvictionSince, s as schemaEvictedSince } from './index-8O3Uow-Y.js';
3
- import { E as BaseDb, s as models, u as properties, z as schemas, q as modelSchemas, ai as getModelIdByFileId, n as normalizeDataType, $ as generateId, M as ModelPropertyDataTypes, J as BaseFileManager, aj as getModelId, ak as setCachedPropertyRefresher } from './BasePathResolver-Cm4apKRb.js';
2
+ import { i as isActorStopped, w as writeProcessMachine, c as currentEvictionEpoch, M as Model, b as anyEvictionSince, s as schemaEvictedSince } from './errors-Cl8rbtKR.js';
3
+ import { E as BaseDb, s as models, u as properties, z as schemas, q as modelSchemas, ai as getModelIdByFileId, n as normalizeDataType, $ as generateId, M as ModelPropertyDataTypes, J as BaseFileManager, aj as getModelId, ak as setCachedPropertyRefresher } from './BasePathResolver-DxdS0wJ0.js';
4
4
  import 'pluralize';
5
5
  import { eq, and, inArray } from 'drizzle-orm';
6
- import { modelPropertiesToObject } from './model-DGMe-TTm.js';
6
+ import { modelPropertiesToObject } from './model-oHA3YhOd.js';
7
7
  import debug from 'debug';
8
- import { S as Schema } from './Schema-CpMNEnUO.js';
9
- import { D as DEFAULT_READY_TIMEOUT_MS, n as waitForEntityIdle, o as createReactiveProxy, q as findEntity, t as forceRemoveFromCaches, u as runDestroyLifecycle } from './Item-DBFchXpC.js';
10
- import './ClientManager-i3nJASkg.js';
8
+ import { S as Schema } from './Schema-Dc5EA8Yb.js';
9
+ import { D as DEFAULT_READY_TIMEOUT_MS, n as waitForEntityIdle, o as createReactiveProxy, q as findEntity, t as forceRemoveFromCaches, u as runDestroyLifecycle } from './Item-cq9VcsAY.js';
10
+ import './ClientManager-De-vKHGe.js';
11
11
  import 'lodash-es';
12
- import './tabEvents-9s2WCYw-.js';
12
+ import './tabEvents-BTzckWrN.js';
13
13
  import '@seedprotocol/arweave';
14
14
  import '@seedprotocol/eas';
15
15
  import '@noble/hashes/sha3';
@@ -21,7 +21,7 @@ import 'drizzle-orm/sqlite-core';
21
21
  import 'nanoid';
22
22
  import 'nanoid-dictionary';
23
23
  import '@noble/hashes/sha256';
24
- import './SchemaValidationService-DieV4KL-.js';
24
+ import './SchemaValidationService-DViJ056F.js';
25
25
  import '@sinclair/typebox/value';
26
26
  import 'rxjs';
27
27
 
@@ -33,15 +33,15 @@ const logger$3 = debug('seedSdk:modelProperty:actors:saveToSchema');
33
33
  */
34
34
  async function getSchemaNameFromModel(modelName) {
35
35
  // Get the latest schema files and find which one contains this model
36
- const _mod_0 = await import('./ClientManager-i3nJASkg.js');
36
+ const _mod_0 = await import('./ClientManager-De-vKHGe.js');
37
37
  const _ns_0 = _mod_0.K;
38
38
  const schemaHelpersMod = _ns_0;
39
39
  const { listLatestSchemaFiles } = schemaHelpersMod;
40
40
  const latestSchemas = await listLatestSchemaFiles();
41
41
  for (const schema of latestSchemas) {
42
42
  try {
43
- const _mod_1 = await import('./BasePathResolver-Cm4apKRb.js');
44
- const _ns_1 = _mod_1.a_;
43
+ const _mod_1 = await import('./BasePathResolver-DxdS0wJ0.js');
44
+ const _ns_1 = _mod_1.a$;
45
45
  const fileManagerMod = _ns_1;
46
46
  const { BaseFileManager } = fileManagerMod;
47
47
  const content = await BaseFileManager.readFileAsString(schema.filePath);
@@ -60,7 +60,7 @@ async function getSchemaNameFromModel(modelName) {
60
60
  const saveToSchema = fromCallback(({ sendBack, input: { context }, self }) => {
61
61
  const _saveToSchema = async () => {
62
62
  // Use dynamic import to break circular dependency
63
- const validationServiceMod = await import('./SchemaValidationService-DieV4KL-.js');
63
+ const validationServiceMod = await import('./SchemaValidationService-DViJ056F.js');
64
64
  const { SchemaValidationService } = validationServiceMod;
65
65
  const validationService = new SchemaValidationService();
66
66
  // Validate property structure before saving
@@ -79,15 +79,15 @@ const saveToSchema = fromCallback(({ sendBack, input: { context }, self }) => {
79
79
  throw new Error(`Model not found for modelId: ${context.modelId}`);
80
80
  }
81
81
  // Persist to database only - schema file is updated only when user calls Schema.saveNewVersion()
82
- const _mod_2 = await import('./BasePathResolver-Cm4apKRb.js');
83
- const _ns_2 = _mod_2.b2;
82
+ const _mod_2 = await import('./BasePathResolver-DxdS0wJ0.js');
83
+ const _ns_2 = _mod_2.b3;
84
84
  const dbMod = _ns_2;
85
85
  const { savePropertyToDb } = dbMod;
86
86
  await savePropertyToDb(context);
87
87
  // Mark schema as draft so user knows to save
88
88
  const schemaName = context._schemaName ?? (await getSchemaNameFromModel(context.modelName));
89
89
  if (schemaName) {
90
- const _mod_3 = await import('./Schema-CpMNEnUO.js');
90
+ const _mod_3 = await import('./Schema-Dc5EA8Yb.js');
91
91
  const _ns_3 = _mod_3.b;
92
92
  const schemaMod = _ns_3;
93
93
  const { Schema } = schemaMod;
@@ -125,8 +125,8 @@ const compareAndMarkDraft = fromCallback(({ sendBack, input: { context }, self }
125
125
  const schemaFileIdForResolve = fullContext._propertyFileId || (typeof fullContext.id === 'string' ? fullContext.id : undefined);
126
126
  if (schemaFileIdForResolve && (fullContext.modelName === undefined || fullContext.dataType === undefined)) {
127
127
  try {
128
- const _mod_4 = await import('./BasePathResolver-Cm4apKRb.js');
129
- const _ns_4 = _mod_4.b2;
128
+ const _mod_4 = await import('./BasePathResolver-DxdS0wJ0.js');
129
+ const _ns_4 = _mod_4.b3;
130
130
  const dbMod = _ns_4;
131
131
  const { getPropertyModelNameAndDataType, getModelNameByModelId } = dbMod;
132
132
  let fromDb;
@@ -172,8 +172,8 @@ const compareAndMarkDraft = fromCallback(({ sendBack, input: { context }, self }
172
172
  if (fullContext.modelName && fullContext.name && schemaFileId) {
173
173
  logger$2(`[compareAndMarkDraft] _originalValues not set, but saving to database anyway for property ${context.modelName}:${context.name} (schemaFileId: ${schemaFileId})`);
174
174
  try {
175
- const _mod_5 = await import('./BasePathResolver-Cm4apKRb.js');
176
- const _ns_5 = _mod_5.b2;
175
+ const _mod_5 = await import('./BasePathResolver-DxdS0wJ0.js');
176
+ const _ns_5 = _mod_5.b3;
177
177
  const dbMod = _ns_5;
178
178
  const { savePropertyToDb } = dbMod;
179
179
  // Ensure _propertyFileId is set for savePropertyToDb to find the property
@@ -234,8 +234,8 @@ const compareAndMarkDraft = fromCallback(({ sendBack, input: { context }, self }
234
234
  logger$2(`Property ${fullContext.modelName}:${fullContext.name} has changes, marking as edited`);
235
235
  logger$2(`[compareAndMarkDraft] Context when saving: id=${fullContext.id}, _propertyFileId=${fullContext._propertyFileId}, name=${fullContext.name}, _originalValues.name=${fullContext._originalValues?.name}`);
236
236
  // Use dynamic import to break circular dependency
237
- const _mod_6 = await import('./BasePathResolver-Cm4apKRb.js');
238
- const _ns_6 = _mod_6.b2;
237
+ const _mod_6 = await import('./BasePathResolver-DxdS0wJ0.js');
238
+ const _ns_6 = _mod_6.b3;
239
239
  const dbMod = _ns_6;
240
240
  const { savePropertyToDb } = dbMod;
241
241
  // Save to database (but not JSON file) - always save to DB when there are changes
@@ -250,7 +250,7 @@ const compareAndMarkDraft = fromCallback(({ sendBack, input: { context }, self }
250
250
  // Mark schema as draft if schema name is available
251
251
  if (fullContext._schemaName) {
252
252
  // Get the Schema instance and mark it as draft
253
- const _mod_7 = await import('./Schema-CpMNEnUO.js');
253
+ const _mod_7 = await import('./Schema-Dc5EA8Yb.js');
254
254
  const _ns_7 = _mod_7.b;
255
255
  const schemaMod = _ns_7;
256
256
  const { Schema } = schemaMod;
@@ -272,7 +272,7 @@ const compareAndMarkDraft = fromCallback(({ sendBack, input: { context }, self }
272
272
  logger$2(`Property ${fullContext.modelName}:${fullContext.name} has no changes`);
273
273
  // Clear isEdited flag in database
274
274
  try {
275
- const _mod_8 = await import('./index-AVFTVp1m.js');
275
+ const _mod_8 = await import('./index-DAl9U4rn.js');
276
276
  const _ns_8 = _mod_8.s;
277
277
  const seedSchemaMod = _ns_8;
278
278
  const { properties: propertiesTable, models: modelsTable } = seedSchemaMod;
@@ -281,8 +281,8 @@ const compareAndMarkDraft = fromCallback(({ sendBack, input: { context }, self }
281
281
  const db = BaseDb.getAppDb();
282
282
  if (db && fullContext.modelName && fullContext.name) {
283
283
  // Find this property's model (model names are only unique per schema)
284
- const _mod_9 = await import('./BasePathResolver-Cm4apKRb.js');
285
- const _ns_9 = _mod_9.b1;
284
+ const _mod_9 = await import('./BasePathResolver-DxdS0wJ0.js');
285
+ const _ns_9 = _mod_9.b2;
286
286
  const { resolveModelRecord } = _ns_9;
287
287
  const modelRecord = await resolveModelRecord(fullContext.modelName, {
288
288
  modelId: typeof fullContext.modelId === 'number' ? fullContext.modelId : undefined,
@@ -341,8 +341,8 @@ const validateProperty = fromCallback(({ sendBack, input: { context }, self }) =
341
341
  // Brief wait so trackPendingWrite from ModelProperty.create() has time to run (it's in setTimeout(0))
342
342
  await new Promise((r) => setTimeout(r, 60));
343
343
  try {
344
- const _mod_10 = await import('./BasePathResolver-Cm4apKRb.js');
345
- const _ns_10 = _mod_10.b2;
344
+ const _mod_10 = await import('./BasePathResolver-DxdS0wJ0.js');
345
+ const _ns_10 = _mod_10.b3;
346
346
  const dbMod = _ns_10;
347
347
  const { getPropertyModelNameAndDataType, getModelNameByModelId } = dbMod;
348
348
  // Try pending write first (property row may not exist yet)
@@ -395,10 +395,10 @@ const validateProperty = fromCallback(({ sendBack, input: { context }, self }) =
395
395
  fullContext = { ...fullContext, dataType: (fullContext.dataType ?? context._originalValues?.dataType) || 'Text' };
396
396
  }
397
397
  // Use dynamic imports to break circular dependencies
398
- const validationServiceMod = await import('./SchemaValidationService-DieV4KL-.js');
398
+ const validationServiceMod = await import('./SchemaValidationService-DViJ056F.js');
399
399
  const { SchemaValidationService } = validationServiceMod;
400
400
  const validationService = new SchemaValidationService();
401
- const _mod_11 = await import('./Schema-CpMNEnUO.js');
401
+ const _mod_11 = await import('./Schema-Dc5EA8Yb.js');
402
402
  const _ns_11 = _mod_11.b;
403
403
  const schemaMod = _ns_11;
404
404
  const { Schema } = schemaMod;
@@ -1028,8 +1028,8 @@ class ModelProperty {
1028
1028
  return fallbackIsEdited;
1029
1029
  }
1030
1030
  // Find this property's model (by modelId when known; model names are only unique per schema)
1031
- const _mod_12 = await import('./BasePathResolver-Cm4apKRb.js');
1032
- const _ns_12 = _mod_12.b1;
1031
+ const _mod_12 = await import('./BasePathResolver-DxdS0wJ0.js');
1032
+ const _ns_12 = _mod_12.b2;
1033
1033
  const { resolveModelRecord } = _ns_12;
1034
1034
  const modelRecord = await resolveModelRecord(property.modelName, this._ownerModelScope(property), db);
1035
1035
  const modelRecords = modelRecord ? [modelRecord] : [];
@@ -1066,8 +1066,8 @@ class ModelProperty {
1066
1066
  return undefined;
1067
1067
  }
1068
1068
  // Resolve the ref within the owning model's schema
1069
- const _mod_13 = await import('./BasePathResolver-Cm4apKRb.js');
1070
- const _ns_13 = _mod_13.b1;
1069
+ const _mod_13 = await import('./BasePathResolver-DxdS0wJ0.js');
1070
+ const _ns_13 = _mod_13.b2;
1071
1071
  const { resolveRefModelRecord } = _ns_13;
1072
1072
  const refModelRecord = await resolveRefModelRecord(refModelName, property ? this._ownerModelScope(property) : { schemaName: this._getSnapshotContext()._schemaName }, db);
1073
1073
  if (refModelRecord?.id) {
@@ -1112,8 +1112,8 @@ class ModelProperty {
1112
1112
  }
1113
1113
  }
1114
1114
  if (!model && modelId) {
1115
- const _mod_14 = await import('./BasePathResolver-Cm4apKRb.js');
1116
- const _ns_14 = _mod_14.b1;
1115
+ const _mod_14 = await import('./BasePathResolver-DxdS0wJ0.js');
1116
+ const _ns_14 = _mod_14.b2;
1117
1117
  const { resolveModelRecord } = _ns_14;
1118
1118
  const modelFileId = (await resolveModelRecord(property.modelName, { modelId }))?.schemaFileId;
1119
1119
  model = modelFileId ? Model.getById(modelFileId) : undefined;
@@ -1354,6 +1354,14 @@ class ModelProperty {
1354
1354
  if (propertyWithId.refModelId && !cachedContext.refModelId) {
1355
1355
  needsUpdate.refModelId = propertyWithId.refModelId;
1356
1356
  }
1357
+ // Rules defined in code exist only on the instance: an instance cached from the DB row first
1358
+ // (which has no column for them) must still take them.
1359
+ if (propertyWithId.validation && !cachedContext.validation) {
1360
+ needsUpdate.validation = propertyWithId.validation;
1361
+ }
1362
+ if (propertyWithId.htmlEmbeddedDataUriPolicy && !cachedContext.htmlEmbeddedDataUriPolicy) {
1363
+ needsUpdate.htmlEmbeddedDataUriPolicy = propertyWithId.htmlEmbeddedDataUriPolicy;
1364
+ }
1357
1365
  if (Object.keys(needsUpdate).length > 0) {
1358
1366
  instance._service.send({
1359
1367
  type: 'updateContext',
@@ -2071,7 +2079,7 @@ class ModelProperty {
2071
2079
  .where(and(eq(schemas.name, schemaName), eq(models.name, modelName), eq(properties.name, propertyName)))
2072
2080
  .limit(1);
2073
2081
  if (propertyRecords.length > 0 && propertyRecords[0].propertyId != null) {
2074
- const { detachPropertyRows } = await import('./detachRowsBeforeDelete-S0q-DJPT.js');
2082
+ const { detachPropertyRows } = await import('./detachRowsBeforeDelete-YRSZY6dO.js');
2075
2083
  await detachPropertyRows(db, [propertyRecords[0].propertyId]);
2076
2084
  await db
2077
2085
  .delete(properties)
@@ -2115,4 +2123,4 @@ var ModelProperty$1 = /*#__PURE__*/Object.freeze({
2115
2123
  });
2116
2124
 
2117
2125
  export { ModelProperty };
2118
- //# sourceMappingURL=ModelProperty-BS49g01Y.js.map
2126
+ //# sourceMappingURL=ModelProperty-DuuoFXaC.js.map