@seedprotocol/sdk 0.7.4 → 0.7.5-next.871.g8788c94

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 (135) hide show
  1. package/README.md +99 -0
  2. package/dist/{BasePathResolver-DrzGVH9L.js → BasePathResolver-B-fK7_N_.js} +142 -8
  3. package/dist/BasePathResolver-B-fK7_N_.js.map +1 -0
  4. package/dist/{ClientManager-Dfu4jcgm.js → ClientManager-C7VkO5Hg.js} +342 -206
  5. package/dist/ClientManager-C7VkO5Hg.js.map +1 -0
  6. package/dist/{Item-BUUFuywT.js → Item-BDmsdNTQ.js} +234 -163
  7. package/dist/Item-BDmsdNTQ.js.map +1 -0
  8. package/dist/{ModelProperty-B6cnRvIz.js → ModelProperty-Cqw6yn7y.js} +37 -37
  9. package/dist/{ModelProperty-B6cnRvIz.js.map → ModelProperty-Cqw6yn7y.js.map} +1 -1
  10. package/dist/{Schema-Bf-jOLq0.js → Schema-BJLYOUgp.js} +57 -37
  11. package/dist/Schema-BJLYOUgp.js.map +1 -0
  12. package/dist/{SchemaValidationService-BNYMacsx.js → SchemaValidationService-CzybXLiS.js} +6 -6
  13. package/dist/{SchemaValidationService-BNYMacsx.js.map → SchemaValidationService-CzybXLiS.js.map} +1 -1
  14. package/dist/{backfillMetadataPropertyIds-C2-s_jUa.js → backfillMetadataPropertyIds-DAsETfD_.js} +3 -3
  15. package/dist/{backfillMetadataPropertyIds-C2-s_jUa.js.map → backfillMetadataPropertyIds-DAsETfD_.js.map} +1 -1
  16. package/dist/{configurePlatform-BzfirKuM.js → configurePlatform-CFQF_i1T.js} +2 -2
  17. package/dist/{configurePlatform-BzfirKuM.js.map → configurePlatform-CFQF_i1T.js.map} +1 -1
  18. package/dist/{detachRowsBeforeDelete-B0Daoz9Z.js → detachRowsBeforeDelete-D4gxxk46.js} +2 -2
  19. package/dist/{detachRowsBeforeDelete-B0Daoz9Z.js.map → detachRowsBeforeDelete-D4gxxk46.js.map} +1 -1
  20. package/dist/discardNewDraft-g8w3uHFM.js +78 -0
  21. package/dist/discardNewDraft-g8w3uHFM.js.map +1 -0
  22. package/dist/{eas-Dq5Kx_Nd.js → eas-BcXZ2hIn.js} +25 -12
  23. package/dist/eas-BcXZ2hIn.js.map +1 -0
  24. package/dist/{errors-DdWbxb_n.js → errors-CCMxedOB.js} +43 -38
  25. package/dist/errors-CCMxedOB.js.map +1 -0
  26. package/dist/{getItem-9bYSErSj.js → getItem-BUs1Xa48.js} +4 -4
  27. package/dist/{getItem-9bYSErSj.js.map → getItem-BUs1Xa48.js.map} +1 -1
  28. package/dist/{getPublishPayload-DPy-uMrR.js → getPublishPayload-CwNOhnir.js} +25 -15
  29. package/dist/getPublishPayload-CwNOhnir.js.map +1 -0
  30. package/dist/{getPublishUploads-J-143iSV.js → getPublishUploads-pEOrXJbF.js} +506 -45
  31. package/dist/getPublishUploads-pEOrXJbF.js.map +1 -0
  32. package/dist/{index-7y2f_iQz.js → index-BQSK-r_A.js} +2 -2
  33. package/dist/index-BQSK-r_A.js.map +1 -0
  34. package/dist/{index-C61Rxy0F.js → index-zAs84LDi.js} +8 -8
  35. package/dist/index-zAs84LDi.js.map +1 -0
  36. package/dist/{index.browser-C1pisOEa.js → index.browser-irwaBIj0.js} +11 -11
  37. package/dist/{index.browser-C1pisOEa.js.map → index.browser-irwaBIj0.js.map} +1 -1
  38. package/dist/{index.node-BAlST8pD.js → index.node-BYkndQN7.js} +6 -6
  39. package/dist/{index.node-BAlST8pD.js.map → index.node-BYkndQN7.js.map} +1 -1
  40. package/dist/main.js +91 -504
  41. package/dist/main.js.map +1 -1
  42. package/dist/{mimeTypes-DHAHC4eZ.js → mimeTypes-C9r76DCH.js} +7 -2
  43. package/dist/{mimeTypes-DHAHC4eZ.js.map → mimeTypes-C9r76DCH.js.map} +1 -1
  44. package/dist/node.js +10 -10
  45. package/dist/platform.browser.js +6 -6
  46. package/dist/platform.node.js +4 -4
  47. package/dist/{property-zFPMtR3T.js → property-5AD2naVS.js} +7 -7
  48. package/dist/{property-zFPMtR3T.js.map → property-5AD2naVS.js.map} +1 -1
  49. package/dist/{propertyValidationRules-CeFVhdQg.js → propertyValidationRules-Bdgz0Nrr.js} +10 -10
  50. package/dist/{propertyValidationRules-CeFVhdQg.js.map → propertyValidationRules-Bdgz0Nrr.js.map} +1 -1
  51. package/dist/{publishDraftGraph-CuVq6iAR.js → publishDraftGraph-DGhC9ifI.js} +6 -6
  52. package/dist/{publishDraftGraph-CuVq6iAR.js.map → publishDraftGraph-DGhC9ifI.js.map} +1 -1
  53. package/dist/{resetAmbiguousLegacyItemData-DsFTnMBz.js → resetAmbiguousLegacyItemData-HSB77N9c.js} +2 -2
  54. package/dist/{resetAmbiguousLegacyItemData-DsFTnMBz.js.map → resetAmbiguousLegacyItemData-HSB77N9c.js.map} +1 -1
  55. package/dist/{resolveModelForSyncedSeed-RUsgAZXG.js → resolveModelForSyncedSeed-CAKAJgr6.js} +2 -2
  56. package/dist/{resolveModelForSyncedSeed-RUsgAZXG.js.map → resolveModelForSyncedSeed-CAKAJgr6.js.map} +1 -1
  57. package/dist/src/Item/Item.d.ts +4 -1
  58. package/dist/src/Item/Item.d.ts.map +1 -1
  59. package/dist/src/Item/errors.d.ts +3 -1
  60. package/dist/src/Item/errors.d.ts.map +1 -1
  61. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -1
  62. package/dist/src/Model/Model.d.ts +2 -1
  63. package/dist/src/Model/Model.d.ts.map +1 -1
  64. package/dist/src/Schema/Schema.d.ts.map +1 -1
  65. package/dist/src/Schema/service/schemaMachine.d.ts +3 -0
  66. package/dist/src/Schema/service/schemaMachine.d.ts.map +1 -1
  67. package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
  68. package/dist/src/db/alignRowPublishers.d.ts +25 -0
  69. package/dist/src/db/alignRowPublishers.d.ts.map +1 -0
  70. package/dist/src/db/canonicalizeModelTypes.d.ts +2 -2
  71. package/dist/src/db/canonicalizeModelTypes.d.ts.map +1 -1
  72. package/dist/src/db/read/getModelSchemas.d.ts +3 -2
  73. package/dist/src/db/read/getModelSchemas.d.ts.map +1 -1
  74. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  75. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  76. package/dist/src/db/read/getSchemaUidForModel.d.ts.map +1 -1
  77. package/dist/src/db/read/getSeedPublisher.d.ts +7 -0
  78. package/dist/src/db/read/getSeedPublisher.d.ts.map +1 -0
  79. package/dist/src/db/read/nameMatchLevels.d.ts +64 -0
  80. package/dist/src/db/read/nameMatchLevels.d.ts.map +1 -0
  81. package/dist/src/db/read/resolveModelRecord.d.ts.map +1 -1
  82. package/dist/src/db/read/summarizePublishWork.d.ts +2 -0
  83. package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
  84. package/dist/src/db/write/applyArweaveL1TransactionIdLocal.d.ts +5 -3
  85. package/dist/src/db/write/applyArweaveL1TransactionIdLocal.d.ts.map +1 -1
  86. package/dist/src/db/write/claimUnpublishedDrafts.d.ts +4 -2
  87. package/dist/src/db/write/claimUnpublishedDrafts.d.ts.map +1 -1
  88. package/dist/src/db/write/createMetadata.d.ts.map +1 -1
  89. package/dist/src/db/write/createNewItem.d.ts.map +1 -1
  90. package/dist/src/db/write/createSeed.d.ts.map +1 -1
  91. package/dist/src/db/write/createVersion.d.ts.map +1 -1
  92. package/dist/src/db/write/discardNewDraft.d.ts +8 -0
  93. package/dist/src/db/write/discardNewDraft.d.ts.map +1 -0
  94. package/dist/src/db/write/restoreDataItemIdsOverwrittenByL1.d.ts +18 -0
  95. package/dist/src/db/write/restoreDataItemIdsOverwrittenByL1.d.ts.map +1 -0
  96. package/dist/src/db/write/updateItemPropertyValue.d.ts.map +1 -1
  97. package/dist/src/eas.d.ts.map +1 -1
  98. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  99. package/dist/src/helpers/constants.d.ts.map +1 -1
  100. package/dist/src/helpers/db.d.ts.map +1 -1
  101. package/dist/src/helpers/easValueTypes.d.ts +16 -0
  102. package/dist/src/helpers/easValueTypes.d.ts.map +1 -0
  103. package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts +13 -2
  104. package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts.map +1 -1
  105. package/dist/src/helpers/ownership.d.ts +9 -12
  106. package/dist/src/helpers/ownership.d.ts.map +1 -1
  107. package/dist/src/helpers/publishConfig.d.ts +9 -4
  108. package/dist/src/helpers/publishConfig.d.ts.map +1 -1
  109. package/dist/src/imports/index.d.ts +1 -1
  110. package/dist/src/imports/index.d.ts.map +1 -1
  111. package/dist/src/imports/json.d.ts.map +1 -1
  112. package/dist/src/index.d.ts +2 -1
  113. package/dist/src/index.d.ts.map +1 -1
  114. package/dist/src/types/import.d.ts +20 -0
  115. package/dist/src/types/import.d.ts.map +1 -1
  116. package/dist/{syncDbWithEas-CRpnkq00.js → syncDbWithEas-BmJXqfgN.js} +92 -22
  117. package/dist/syncDbWithEas-BmJXqfgN.js.map +1 -0
  118. package/dist/{tabEvents-nBUq_1u1.js → tabEvents-DXun7vdK.js} +4 -4
  119. package/dist/{tabEvents-nBUq_1u1.js.map → tabEvents-DXun7vdK.js.map} +1 -1
  120. package/dist/{tolerantWebAccess-DIt3R8_u.js → tolerantWebAccess-DXxgX2x7.js} +7 -7
  121. package/dist/{tolerantWebAccess-DIt3R8_u.js.map → tolerantWebAccess-DXxgX2x7.js.map} +1 -1
  122. package/dist/{updateSeedRevokedAt-DtTPSzpM.js → updateSeedRevokedAt-DkLSDwUX.js} +3 -3
  123. package/dist/{updateSeedRevokedAt-DtTPSzpM.js.map → updateSeedRevokedAt-DkLSDwUX.js.map} +1 -1
  124. package/package.json +9 -5
  125. package/dist/BasePathResolver-DrzGVH9L.js.map +0 -1
  126. package/dist/ClientManager-Dfu4jcgm.js.map +0 -1
  127. package/dist/Item-BUUFuywT.js.map +0 -1
  128. package/dist/Schema-Bf-jOLq0.js.map +0 -1
  129. package/dist/eas-Dq5Kx_Nd.js.map +0 -1
  130. package/dist/errors-DdWbxb_n.js.map +0 -1
  131. package/dist/getPublishPayload-DPy-uMrR.js.map +0 -1
  132. package/dist/getPublishUploads-J-143iSV.js.map +0 -1
  133. package/dist/index-7y2f_iQz.js.map +0 -1
  134. package/dist/index-C61Rxy0F.js.map +0 -1
  135. package/dist/syncDbWithEas-CRpnkq00.js.map +0 -1
@@ -1,13 +1,13 @@
1
1
  import { fromCallback, setup, assign, createActor } from 'xstate';
2
- import { g as getRefValueType, H as createModelsFromJson, p as listCompleteSchemaFiles, J as getLatestSchemaVersion, l as loadSchemaFromFile, K as jsonPropertiesToSchemaProperties, q as loadAllSchemasFromDb, k as getClient } from './ClientManager-Dfu4jcgm.js';
3
- import { at as SEED_PROTOCOL_SCHEMA_NAME, E as BaseDb, z as schemas, aL as addSchemaToDb, i as isDataType, M as ModelPropertyDataTypes, $ as generateId, a5 as addModelsToDb, s as models, q as modelSchemas, u as properties, J as BaseFileManager, aN as loadModelsFromDbForSchema, aI as isInternalSchema } from './BasePathResolver-DrzGVH9L.js';
2
+ import { av as SEED_PROTOCOL_SCHEMA_NAME, B as BaseDb, A as schemas, aN as addSchemaToDb, i as isDataType, M as ModelPropertyDataTypes, al as generateId, O as addModelsToDb, t as models, r as modelSchemas, v as properties, h as BaseFileManager, aQ as loadModelsFromDbForSchema, aK as isInternalSchema, aR as clearNameMatchLevels } from './BasePathResolver-B-fK7_N_.js';
3
+ import { g as getRefValueType, J as createModelsFromJson, q as listCompleteSchemaFiles, K as getLatestSchemaVersion, l as loadSchemaFromFile, L as jsonPropertiesToSchemaProperties, u as loadAllSchemasFromDb, m as getClient } from './ClientManager-C7VkO5Hg.js';
4
4
  import { eq, desc, and } from 'drizzle-orm';
5
5
  import debug from 'debug';
6
- import { c as currentEvictionEpoch, w as writeProcessMachine, t as trackDraftSave, M as Model, g as getDraftSaveError, C as ConflictError, r as recordSchemaDestroy, f as finishSchemaDestroy, d as setupEntityLiveQuery } from './errors-DdWbxb_n.js';
6
+ import { c as currentEvictionEpoch, w as writeProcessMachine, t as trackDraftSave, M as Model, g as getDraftSaveError, C as ConflictError, r as recordSchemaDestroy, f as finishSchemaDestroy, d as setupEntityLiveQuery } from './errors-CCMxedOB.js';
7
7
  import 'pluralize';
8
8
  import '@seedprotocol/eas';
9
- import { SchemaValidationService } from './SchemaValidationService-BNYMacsx.js';
10
- import { D as DEFAULT_READY_TIMEOUT_MS, l as waitForEntityIdle, m as createReactiveProxy, n as findEntity, C as ClientManagerState, _ as clearDestroySubscriptions, o as forceRemoveFromCaches, $ as unloadEntity, q as runDestroyLifecycle } from './Item-BUUFuywT.js';
9
+ import { SchemaValidationService } from './SchemaValidationService-CzybXLiS.js';
10
+ import { D as DEFAULT_READY_TIMEOUT_MS, d as waitForEntityIdle, m as createReactiveProxy, n as findEntity, C as ClientManagerState, _ as clearDestroySubscriptions, o as forceRemoveFromCaches, $ as unloadEntity, q as runDestroyLifecycle } from './Item-BDmsdNTQ.js';
11
11
 
12
12
  const logger$d = debug('seedSdk:schema:actors:loadOrCreateSchema');
13
13
  /**
@@ -51,7 +51,7 @@ const createModelInstances$2 = async (modelIds, evictionEpoch) => {
51
51
  return;
52
52
  }
53
53
  try {
54
- const _mod_0 = await import('./errors-DdWbxb_n.js');
54
+ const _mod_0 = await import('./errors-CCMxedOB.js');
55
55
  const _ns_0 = _mod_0.h;
56
56
  const modelMod = _ns_0;
57
57
  const { Model } = modelMod;
@@ -168,7 +168,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
168
168
  // For Seed Protocol, always load from internal file, never create new
169
169
  logger$d(`Loading internal Seed Protocol schema from SDK`);
170
170
  try {
171
- const _mod_1 = await import('./ClientManager-Dfu4jcgm.js');
171
+ const _mod_1 = await import('./ClientManager-C7VkO5Hg.js');
172
172
  const _ns_1 = _mod_1.S;
173
173
  const internalSchema = _ns_1;
174
174
  const schemaFile = internalSchema.default;
@@ -663,7 +663,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
663
663
  // Ensure models are populated (fallback for seed-protocol if missing)
664
664
  if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
665
665
  try {
666
- const _mod_2 = await import('./ClientManager-Dfu4jcgm.js');
666
+ const _mod_2 = await import('./ClientManager-C7VkO5Hg.js');
667
667
  const _ns_2 = _mod_2.S;
668
668
  const internalSchema = _ns_2;
669
669
  const internalSchemaFile = internalSchema.default;
@@ -894,7 +894,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
894
894
  // Ensure models are populated (fallback for seed-protocol if missing)
895
895
  if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
896
896
  try {
897
- const _mod_3 = await import('./ClientManager-Dfu4jcgm.js');
897
+ const _mod_3 = await import('./ClientManager-C7VkO5Hg.js');
898
898
  const _ns_3 = _mod_3.S;
899
899
  const internalSchema = _ns_3;
900
900
  const internalSchemaFile = internalSchema.default;
@@ -985,7 +985,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
985
985
  // Ensure models are populated (fallback for seed-protocol if missing)
986
986
  if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
987
987
  try {
988
- const _mod_4 = await import('./ClientManager-Dfu4jcgm.js');
988
+ const _mod_4 = await import('./ClientManager-C7VkO5Hg.js');
989
989
  const _ns_4 = _mod_4.S;
990
990
  const internalSchema = _ns_4;
991
991
  const internalSchemaFile = internalSchema.default;
@@ -1073,7 +1073,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
1073
1073
  // If schemaData is missing, try to load from internal schema file for seed-protocol
1074
1074
  if (!dbSchema.schemaData && schemaName === 'Seed Protocol') {
1075
1075
  try {
1076
- const _mod_5 = await import('./ClientManager-Dfu4jcgm.js');
1076
+ const _mod_5 = await import('./ClientManager-C7VkO5Hg.js');
1077
1077
  const _ns_5 = _mod_5.S;
1078
1078
  const internalSchema = _ns_5;
1079
1079
  const schemaFile = internalSchema.default;
@@ -1184,7 +1184,7 @@ const loadOrCreateSchema = fromCallback(({ sendBack, input: { context } }) => {
1184
1184
  // Ensure models are populated (fallback for seed-protocol if missing)
1185
1185
  if ((!mergedModels || Object.keys(mergedModels).length === 0) && schemaName === 'Seed Protocol') {
1186
1186
  try {
1187
- const _mod_6 = await import('./ClientManager-Dfu4jcgm.js');
1187
+ const _mod_6 = await import('./ClientManager-C7VkO5Hg.js');
1188
1188
  const _ns_6 = _mod_6.S;
1189
1189
  const internalSchema = _ns_6;
1190
1190
  const internalSchemaFile = internalSchema.default;
@@ -1511,7 +1511,7 @@ const createModelInstances$1 = async (modelIds, evictionEpoch) => {
1511
1511
  return;
1512
1512
  }
1513
1513
  try {
1514
- const _mod_7 = await import('./errors-DdWbxb_n.js');
1514
+ const _mod_7 = await import('./errors-CCMxedOB.js');
1515
1515
  const _ns_7 = _mod_7.h;
1516
1516
  const mod = _ns_7;
1517
1517
  const Model = mod?.Model ?? mod?.default;
@@ -1560,7 +1560,7 @@ const checkExistingSchema = fromCallback(({ sendBack, input: { context } }) => {
1560
1560
  if (isInternal && schemaName === SEED_PROTOCOL_SCHEMA_NAME) {
1561
1561
  // For Seed Protocol, check if it exists in database
1562
1562
  try {
1563
- const _mod_8 = await import('./ClientManager-Dfu4jcgm.js');
1563
+ const _mod_8 = await import('./ClientManager-C7VkO5Hg.js');
1564
1564
  const _ns_8 = _mod_8.S;
1565
1565
  const internalSchema = _ns_8;
1566
1566
  const schemaFile = internalSchema.default;
@@ -1922,7 +1922,7 @@ const writeSchemaToDb = fromCallback(({ sendBack, input }) => {
1922
1922
  if (isInternal && schemaName === SEED_PROTOCOL_SCHEMA_NAME) {
1923
1923
  // For Seed Protocol, load from internal file
1924
1924
  logger$b(`Loading internal Seed Protocol schema from SDK`);
1925
- const _mod_9 = await import('./ClientManager-Dfu4jcgm.js');
1925
+ const _mod_9 = await import('./ClientManager-C7VkO5Hg.js');
1926
1926
  const _ns_9 = _mod_9.S;
1927
1927
  const internalSchema = _ns_9;
1928
1928
  finalSchema = internalSchema.default;
@@ -2393,7 +2393,7 @@ const createModelInstances = fromCallback(({ sendBack, input }) => {
2393
2393
  return;
2394
2394
  }
2395
2395
  try {
2396
- const _mod_10 = await import('./errors-DdWbxb_n.js');
2396
+ const _mod_10 = await import('./errors-CCMxedOB.js');
2397
2397
  const _ns_10 = _mod_10.h;
2398
2398
  const modelMod = _ns_10;
2399
2399
  const { Model } = modelMod;
@@ -2482,7 +2482,7 @@ const verifyModelInstancesInCache = fromCallback(({ sendBack, input }) => {
2482
2482
  }
2483
2483
  try {
2484
2484
  const result = await verifyWithRetry$2(async () => {
2485
- const _mod_11 = await import('./errors-DdWbxb_n.js');
2485
+ const _mod_11 = await import('./errors-CCMxedOB.js');
2486
2486
  const _ns_11 = _mod_11.h;
2487
2487
  const modelMod = _ns_11;
2488
2488
  const { Model } = modelMod;
@@ -2541,8 +2541,8 @@ const writePropertiesToDb = fromCallback(({ sendBack, input }) => {
2541
2541
  const _write = async () => {
2542
2542
  const { modelIds } = input;
2543
2543
  try {
2544
- const _mod_12 = await import('./BasePathResolver-DrzGVH9L.js');
2545
- const _ns_12 = _mod_12.b6;
2544
+ const _mod_12 = await import('./BasePathResolver-B-fK7_N_.js');
2545
+ const _ns_12 = _mod_12.bb;
2546
2546
  const modelSchemaMod = _ns_12;
2547
2547
  const { models: modelsTable, properties: propertiesTable } = modelSchemaMod;
2548
2548
  const drizzleMod = await import('drizzle-orm');
@@ -2731,9 +2731,9 @@ const createPropertyInstances = fromCallback(({ sendBack, input }) => {
2731
2731
  return;
2732
2732
  }
2733
2733
  try {
2734
- const modProp = await import('./ModelProperty-B6cnRvIz.js');
2734
+ const modProp = await import('./ModelProperty-Cqw6yn7y.js');
2735
2735
  const ModelProperty = modProp?.ModelProperty ?? modProp?.default;
2736
- const _mod_13 = await import('./errors-DdWbxb_n.js');
2736
+ const _mod_13 = await import('./errors-CCMxedOB.js');
2737
2737
  const _ns_13 = _mod_13.h;
2738
2738
  const modModel = _ns_13;
2739
2739
  const Model = modModel?.Model ?? modModel?.default;
@@ -2840,7 +2840,7 @@ const verifyPropertyInstancesInCache = fromCallback(({ sendBack, input }) => {
2840
2840
  }
2841
2841
  try {
2842
2842
  const result = await verifyWithRetry(async () => {
2843
- const mod = await import('./ModelProperty-B6cnRvIz.js');
2843
+ const mod = await import('./ModelProperty-Cqw6yn7y.js');
2844
2844
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
2845
2845
  if (!ModelProperty) {
2846
2846
  throw new Error('ModelProperty not available from dynamic import');
@@ -3040,6 +3040,7 @@ const schemaMachine = setup({
3040
3040
  models: event.schema.models,
3041
3041
  enums: event.schema.enums,
3042
3042
  migrations: event.schema.migrations,
3043
+ nameMatch: event.schema.nameMatch,
3043
3044
  _isDraft: false,
3044
3045
  _isEdited: event.schemaRecord?.isEdited ?? false,
3045
3046
  _editedProperties: new Set(),
@@ -3084,6 +3085,7 @@ const schemaMachine = setup({
3084
3085
  metadata: ({ context, event }) => context.metadata ?? event.schema.metadata,
3085
3086
  enums: ({ context, event }) => context.enums ?? event.schema.enums,
3086
3087
  migrations: ({ context, event }) => context.migrations ?? event.schema.migrations,
3088
+ nameMatch: ({ context, event }) => context.nameMatch ?? event.schema.nameMatch,
3087
3089
  }),
3088
3090
  },
3089
3091
  writeError: {
@@ -3371,6 +3373,7 @@ const schemaMachine = setup({
3371
3373
  models: event.schema.models,
3372
3374
  enums: event.schema.enums,
3373
3375
  migrations: event.schema.migrations,
3376
+ nameMatch: event.schema.nameMatch,
3374
3377
  _isDraft: false,
3375
3378
  _editedProperties: new Set(),
3376
3379
  _validationErrors: undefined,
@@ -3404,6 +3407,7 @@ const schemaMachine = setup({
3404
3407
  models: context.models,
3405
3408
  enums: context.enums,
3406
3409
  migrations: context.migrations,
3410
+ nameMatch: context.nameMatch,
3407
3411
  },
3408
3412
  },
3409
3413
  });
@@ -3858,8 +3862,8 @@ async function loadSchemaWithRenames(schemaFilePath, modelRenames) {
3858
3862
  updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
3859
3863
  };
3860
3864
  // Use dynamic import to break circular dependency
3861
- const _mod_14 = await import('./BasePathResolver-DrzGVH9L.js');
3862
- const _ns_14 = _mod_14.bb;
3865
+ const _mod_14 = await import('./BasePathResolver-B-fK7_N_.js');
3866
+ const _ns_14 = _mod_14.bg;
3863
3867
  const dbMod = _ns_14;
3864
3868
  const { addSchemaToDb, addModelsToDb } = dbMod;
3865
3869
  // Add schema to database with schemaFileId
@@ -3978,8 +3982,8 @@ async function renameModelProperty(schemaName, modelName, oldPropertyName, newPr
3978
3982
  await BaseFileManager.waitForFileWithContent(newFilePath);
3979
3983
  logger$1(`Renamed property ${oldPropertyName} to ${newPropertyName} in schema ${schemaName} v${newVersion}`);
3980
3984
  // Migrate metadata rows so ItemProperty values follow the new name (prevents duplicate ItemProperties)
3981
- const _mod_15 = await import('./BasePathResolver-DrzGVH9L.js');
3982
- const _ns_15 = _mod_15.bb;
3985
+ const _mod_15 = await import('./BasePathResolver-B-fK7_N_.js');
3986
+ const _ns_15 = _mod_15.bg;
3983
3987
  const { migrateMetadataForPropertyRename } = _ns_15;
3984
3988
  const migratedCount = await migrateMetadataForPropertyRename(modelName, oldPropertyName, newPropertyName, oldProperty.id, { schemaName });
3985
3989
  if (migratedCount > 0) {
@@ -4975,7 +4979,7 @@ class Schema {
4975
4979
  const modelDbId = modelInstance.getService().getSnapshot().context._dbId;
4976
4980
  const db = BaseDb.getAppDb();
4977
4981
  if (propertyContexts.length === 0 && modelDbId && db) {
4978
- const { ModelProperty } = await import('./ModelProperty-B6cnRvIz.js');
4982
+ const { ModelProperty } = await import('./ModelProperty-Cqw6yn7y.js');
4979
4983
  const rows = await db.select().from(properties).where(eq(properties.modelId, modelDbId));
4980
4984
  propertyContexts = rows.map((row) => {
4981
4985
  const cached = row.schemaFileId ? ModelProperty.getById(row.schemaFileId) : undefined;
@@ -4992,21 +4996,32 @@ class Schema {
4992
4996
  };
4993
4997
  });
4994
4998
  }
4999
+ const contextModel = context.models?.[modelName];
5000
+ const fromContext = contextModel?.properties;
5001
+ // nameMatch lives only in the schema file (ADR 0009): keep each property's, found by id
5002
+ // first so a renamed property keeps it.
5003
+ const contextNameMatch = (ctx) => {
5004
+ const defs = Object.values(fromContext ?? {});
5005
+ const def = (ctx.id ? defs.find((d) => d?.id === ctx.id) : undefined) ?? fromContext?.[ctx.name];
5006
+ return def?.nameMatch;
5007
+ };
4995
5008
  for (const ctx of propertyContexts) {
4996
5009
  if (!ctx.name)
4997
5010
  continue;
4998
5011
  const { updates } = await convertPropertyToSchemaUpdate(ctx, modelName, ctx.name);
5012
+ const nameMatch = contextNameMatch(ctx);
4999
5013
  properties$1[ctx.name] = {
5000
5014
  ...(ctx.id ? { id: ctx.id } : {}),
5001
5015
  ...updates,
5002
5016
  ...(ctx.validation ? { validation: ctx.validation } : {}),
5003
5017
  ...(ctx.htmlEmbeddedDataUriPolicy ? { htmlEmbeddedDataUriPolicy: ctx.htmlEmbeddedDataUriPolicy } : {}),
5018
+ ...(nameMatch !== undefined ? { nameMatch } : {}),
5004
5019
  };
5005
5020
  }
5006
5021
  // No property instances loaded for this model: keep the definitions the schema has.
5007
- const fromContext = context.models?.[modelName]?.properties;
5008
5022
  models[modelName] = {
5009
5023
  ...(modelInstance.id ? { id: modelInstance.id } : {}),
5024
+ ...(contextModel?.nameMatch !== undefined ? { nameMatch: contextModel.nameMatch } : {}),
5010
5025
  properties: Object.keys(properties$1).length > 0 || !fromContext ? properties$1 : fromContext,
5011
5026
  };
5012
5027
  }
@@ -5065,6 +5080,7 @@ class Schema {
5065
5080
  models: modelsFromInstances, // Read from Model instances, not context.models
5066
5081
  enums: context.enums || {},
5067
5082
  migrations: context.migrations || [],
5083
+ ...(context.nameMatch !== undefined && { nameMatch: context.nameMatch }),
5068
5084
  };
5069
5085
  // Update draft in database with current state
5070
5086
  await addSchemaToDb({
@@ -5098,6 +5114,7 @@ class Schema {
5098
5114
  const publishedSchema = JSON.parse(fileContent);
5099
5115
  // Update database record: set isDraft = false and update schemaFileId
5100
5116
  if (dbSchema.length > 0) {
5117
+ clearNameMatchLevels(); // the stored schema file changes (ADR 0009)
5101
5118
  await db
5102
5119
  .update(schemas)
5103
5120
  .set({
@@ -5128,7 +5145,7 @@ class Schema {
5128
5145
  savedSchema: publishedSchema,
5129
5146
  });
5130
5147
  // Clear edited flags on all ModelProperty instances and in database
5131
- const modelPropertyMod = await import('./ModelProperty-B6cnRvIz.js');
5148
+ const modelPropertyMod = await import('./ModelProperty-Cqw6yn7y.js');
5132
5149
  const { ModelProperty } = modelPropertyMod;
5133
5150
  for (const propertyKey of context._editedProperties) {
5134
5151
  const [modelName, propertyName] = propertyKey.split(':');
@@ -5152,8 +5169,8 @@ class Schema {
5152
5169
  try {
5153
5170
  if (db && modelName && propertyName) {
5154
5171
  // Find this schema's model by name
5155
- const _mod_16 = await import('./BasePathResolver-DrzGVH9L.js');
5156
- const _ns_16 = _mod_16.ba;
5172
+ const _mod_16 = await import('./BasePathResolver-B-fK7_N_.js');
5173
+ const _ns_16 = _mod_16.bf;
5157
5174
  const { resolveModelRecord } = _ns_16;
5158
5175
  const modelRecord = await resolveModelRecord(modelName, { schemaName: thisSchemaName }, db);
5159
5176
  const modelRecords = modelRecord ? [modelRecord] : [];
@@ -5467,6 +5484,7 @@ class Schema {
5467
5484
  models: modelsFromInstances, // Read from Model instances, not context.models
5468
5485
  enums: context.enums || {},
5469
5486
  migrations: context.migrations || [],
5487
+ ...(context.nameMatch !== undefined && { nameMatch: context.nameMatch }),
5470
5488
  };
5471
5489
  // Log if there was a mismatch that we're fixing
5472
5490
  if (existingSchemaRecord?.schemaFileId && context.id && context.id !== finalSchemaFileId) {
@@ -5482,6 +5500,7 @@ class Schema {
5482
5500
  saveDraftLogger(`Saving schemaData with metadata.name="${currentSchema.metadata.name}", schemaData length=${schemaDataString.length}`);
5483
5501
  // CRITICAL: Ensure schemaFileId column matches schema.id (schema.id is now guaranteed to match finalSchemaFileId)
5484
5502
  // Always update schemaFileId to match the id in the schema JSON to maintain consistency
5503
+ clearNameMatchLevels(); // the stored schema file changes (ADR 0009)
5485
5504
  const updateData = {
5486
5505
  name: finalNewName,
5487
5506
  schemaData: schemaDataString,
@@ -5573,6 +5592,7 @@ class Schema {
5573
5592
  logger(`Found existing record by old name "${oldName}" (id: ${foundRecord.id}), updating to new name "${finalNewName}"`);
5574
5593
  // Update the existing record with the new name
5575
5594
  // CRITICAL: Ensure schemaFileId matches schema.id
5595
+ clearNameMatchLevels(); // the stored schema file changes (ADR 0009)
5576
5596
  await db
5577
5597
  .update(schemas)
5578
5598
  .set({
@@ -5777,10 +5797,10 @@ class Schema {
5777
5797
  // instances too, or a re-import would get them back with dangling _dbIds.
5778
5798
  if (schemaName) {
5779
5799
  const evictedModelNames = Model.evictForSchema(schemaName);
5780
- const { ModelProperty } = await import('./ModelProperty-B6cnRvIz.js');
5800
+ const { ModelProperty } = await import('./ModelProperty-Cqw6yn7y.js');
5781
5801
  ModelProperty.evictForModels(evictedModelNames, schemaName);
5782
5802
  // Evicting stops new writes but not ones already running; let those land before deleting their rows
5783
- const _mod_17 = await import('./errors-DdWbxb_n.js');
5803
+ const _mod_17 = await import('./errors-CCMxedOB.js');
5784
5804
  const _ns_17 = _mod_17.e;
5785
5805
  const { waitForInFlightWrites } = _ns_17;
5786
5806
  await waitForInFlightWrites();
@@ -5813,7 +5833,7 @@ class Schema {
5813
5833
  .map((r) => r.modelId)
5814
5834
  .filter((id) => id != null)),
5815
5835
  ];
5816
- const { detachModelRows } = await import('./detachRowsBeforeDelete-B0Daoz9Z.js');
5836
+ const { detachModelRows } = await import('./detachRowsBeforeDelete-D4gxxk46.js');
5817
5837
  await detachModelRows(db, modelIds);
5818
5838
  await db.delete(modelSchemas).where(inArray(modelSchemas.schemaId, schemaIds));
5819
5839
  for (const modelId of modelIds) {
@@ -5828,8 +5848,8 @@ class Schema {
5828
5848
  // the destroyed schema back on the next Schema.all().
5829
5849
  // Match on name as well as id: versions imported from complete schema files can each
5830
5850
  // have their own id, and any version left behind would bring the schema back.
5831
- const _mod_18 = await import('./ClientManager-Dfu4jcgm.js');
5832
- const _ns_18 = _mod_18.L;
5851
+ const _mod_18 = await import('./ClientManager-C7VkO5Hg.js');
5852
+ const _ns_18 = _mod_18.M;
5833
5853
  const { listCompleteSchemaFiles } = _ns_18;
5834
5854
  const files = await listCompleteSchemaFiles().catch(() => []);
5835
5855
  const fs = await BaseFileManager.getFs();
@@ -6024,4 +6044,4 @@ var Schema$1 = /*#__PURE__*/Object.freeze({
6024
6044
  });
6025
6045
 
6026
6046
  export { Schema as S, deletePropertyFromModel as a, Schema$1 as b, deleteModelFromSchema as d, renameModelProperty as r, schemaMachine as s, updateModelProperties as u };
6027
- //# sourceMappingURL=Schema-Bf-jOLq0.js.map
6047
+ //# sourceMappingURL=Schema-BJLYOUgp.js.map