@seedprotocol/sdk 0.7.5 → 0.7.6-next.957.g6bb7768

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 (220) hide show
  1. package/README.md +2 -2
  2. package/dist/{ClientManager-DRf4uuei.js → ClientManager-D6YA20jP.js} +207 -149
  3. package/dist/ClientManager-D6YA20jP.js.map +1 -0
  4. package/dist/{Item-DTJPMjFk.js → Item-B1MH0tXx.js} +126 -86
  5. package/dist/Item-B1MH0tXx.js.map +1 -0
  6. package/dist/{ModelProperty-Dto5C0om.js → ModelProperty-Dw6dHdu_.js} +37 -37
  7. package/dist/{ModelProperty-Dto5C0om.js.map → ModelProperty-Dw6dHdu_.js.map} +1 -1
  8. package/dist/{Schema-8DxGcORY.js → Schema-DppObO6h.js} +62 -212
  9. package/dist/Schema-DppObO6h.js.map +1 -0
  10. package/dist/{SchemaValidationService-CE92y1TT.js → SchemaValidationService-DXQ-D531.js} +6 -6
  11. package/dist/{SchemaValidationService-CE92y1TT.js.map → SchemaValidationService-DXQ-D531.js.map} +1 -1
  12. package/dist/{backfillMetadataPropertyIds-CRqp-BqX.js → backfillMetadataPropertyIds-Uhzlwg9X.js} +3 -3
  13. package/dist/{backfillMetadataPropertyIds-CRqp-BqX.js.map → backfillMetadataPropertyIds-Uhzlwg9X.js.map} +1 -1
  14. package/dist/configurePlatform-CVoh3JeR.js +81 -0
  15. package/dist/configurePlatform-CVoh3JeR.js.map +1 -0
  16. package/dist/{detachRowsBeforeDelete-BVetHtn2.js → detachRowsBeforeDelete-CtmIFpgV.js} +2 -2
  17. package/dist/{detachRowsBeforeDelete-BVetHtn2.js.map → detachRowsBeforeDelete-CtmIFpgV.js.map} +1 -1
  18. package/dist/{discardNewDraft-CEOouygG.js → discardNewDraft-oGYdB5vS.js} +5 -5
  19. package/dist/{discardNewDraft-CEOouygG.js.map → discardNewDraft-oGYdB5vS.js.map} +1 -1
  20. package/dist/dist/ClientManager-D6YA20jP.d.ts +933 -0
  21. package/dist/dist/ClientManager-D6YA20jP.d.ts.map +1 -0
  22. package/dist/dist/Item-B1MH0tXx.d.ts +898 -0
  23. package/dist/dist/Item-B1MH0tXx.d.ts.map +1 -0
  24. package/dist/dist/ModelProperty-Dw6dHdu_.d.ts +315 -0
  25. package/dist/dist/ModelProperty-Dw6dHdu_.d.ts.map +1 -0
  26. package/dist/dist/Schema-DppObO6h.d.ts +601 -0
  27. package/dist/dist/Schema-DppObO6h.d.ts.map +1 -0
  28. package/dist/dist/SchemaValidationService-DXQ-D531.d.ts +118 -0
  29. package/dist/dist/SchemaValidationService-DXQ-D531.d.ts.map +1 -0
  30. package/dist/dist/backfillMetadataPropertyIds-Uhzlwg9X.d.ts +7 -0
  31. package/dist/dist/backfillMetadataPropertyIds-Uhzlwg9X.d.ts.map +1 -0
  32. package/dist/dist/configurePlatform-CVoh3JeR.d.ts +30 -0
  33. package/dist/dist/configurePlatform-CVoh3JeR.d.ts.map +1 -0
  34. package/dist/dist/detachRowsBeforeDelete-CtmIFpgV.d.ts +13 -0
  35. package/dist/dist/detachRowsBeforeDelete-CtmIFpgV.d.ts.map +1 -0
  36. package/dist/dist/discardNewDraft-oGYdB5vS.d.ts +8 -0
  37. package/dist/dist/discardNewDraft-oGYdB5vS.d.ts.map +1 -0
  38. package/dist/dist/eas-CSm5wmry.d.ts +12 -0
  39. package/dist/dist/eas-CSm5wmry.d.ts.map +1 -0
  40. package/dist/dist/errors-3tc6XkCB.d.ts +487 -0
  41. package/dist/dist/errors-3tc6XkCB.d.ts.map +1 -0
  42. package/dist/dist/errors-Do7v6RKu.d.ts +22 -0
  43. package/dist/dist/errors-Do7v6RKu.d.ts.map +1 -0
  44. package/dist/dist/getItem-DM3a-7XE.d.ts +6 -0
  45. package/dist/dist/getItem-DM3a-7XE.d.ts.map +1 -0
  46. package/dist/dist/getPublishPayload-CJF0k5d8.d.ts +47 -0
  47. package/dist/dist/getPublishPayload-CJF0k5d8.d.ts.map +1 -0
  48. package/dist/dist/getPublishUploads-C7-fYIgX.d.ts +89 -0
  49. package/dist/dist/getPublishUploads-C7-fYIgX.d.ts.map +1 -0
  50. package/dist/dist/index--mmQ3LQu.d.ts +6 -0
  51. package/dist/dist/index--mmQ3LQu.d.ts.map +1 -0
  52. package/dist/dist/index-B7yAoYli.d.ts +2752 -0
  53. package/dist/dist/index-B7yAoYli.d.ts.map +1 -0
  54. package/dist/dist/index-CrvIcVFJ.d.ts +4475 -0
  55. package/dist/dist/index-CrvIcVFJ.d.ts.map +1 -0
  56. package/dist/dist/index.browser-BmVS-c2C.d.ts +8445 -0
  57. package/dist/dist/index.browser-BmVS-c2C.d.ts.map +1 -0
  58. package/dist/dist/index.node-BKpbCAWt.d.ts +11123 -0
  59. package/dist/dist/index.node-BKpbCAWt.d.ts.map +1 -0
  60. package/dist/dist/mimeTypes-C9r76DCH.d.ts +30 -0
  61. package/dist/dist/mimeTypes-C9r76DCH.d.ts.map +1 -0
  62. package/dist/dist/model-oHA3YhOd.d.ts +6 -0
  63. package/dist/dist/model-oHA3YhOd.d.ts.map +1 -0
  64. package/dist/dist/platform.browser.d.ts +3 -0
  65. package/dist/dist/platform.browser.d.ts.map +1 -0
  66. package/dist/dist/platform.node.d.ts +3 -0
  67. package/dist/dist/platform.node.d.ts.map +1 -0
  68. package/dist/dist/property-DQ-Owzki.d.ts +37 -0
  69. package/dist/dist/property-DQ-Owzki.d.ts.map +1 -0
  70. package/dist/dist/propertyValidationRules-BDhFjlwP.d.ts +8 -0
  71. package/dist/dist/propertyValidationRules-BDhFjlwP.d.ts.map +1 -0
  72. package/dist/dist/publishDraftGraph-CzPd9oe9.d.ts +76 -0
  73. package/dist/dist/publishDraftGraph-CzPd9oe9.d.ts.map +1 -0
  74. package/dist/dist/resetAmbiguousLegacyItemData-cXZm4NuG.d.ts +17 -0
  75. package/dist/dist/resetAmbiguousLegacyItemData-cXZm4NuG.d.ts.map +1 -0
  76. package/dist/dist/resolveModelForSyncedSeed-BgxtVCHI.d.ts +21 -0
  77. package/dist/dist/resolveModelForSyncedSeed-BgxtVCHI.d.ts.map +1 -0
  78. package/dist/dist/syncDbWithEas-Y5GysSCm.d.ts +22 -0
  79. package/dist/dist/syncDbWithEas-Y5GysSCm.d.ts.map +1 -0
  80. package/dist/dist/tabEvents-D9x26vf2.d.ts +81 -0
  81. package/dist/dist/tabEvents-D9x26vf2.d.ts.map +1 -0
  82. package/dist/dist/tolerantWebAccess-BFU2t-SC.d.ts +113 -0
  83. package/dist/dist/tolerantWebAccess-BFU2t-SC.d.ts.map +1 -0
  84. package/dist/dist/updateSeedRevokedAt-CCF8WWYS.d.ts +11 -0
  85. package/dist/dist/updateSeedRevokedAt-CCF8WWYS.d.ts.map +1 -0
  86. package/dist/drizzle.js +2 -0
  87. package/dist/drizzle.js.map +1 -0
  88. package/dist/{eas-D7jvWMnI.js → eas-CSm5wmry.js} +3 -3
  89. package/dist/{eas-D7jvWMnI.js.map → eas-CSm5wmry.js.map} +1 -1
  90. package/dist/{errors-CIrbsN_i.js → errors-3tc6XkCB.js} +81 -36
  91. package/dist/errors-3tc6XkCB.js.map +1 -0
  92. package/dist/errors-Do7v6RKu.js +34 -0
  93. package/dist/errors-Do7v6RKu.js.map +1 -0
  94. package/dist/{getItem-CxU_kT5W.js → getItem-DM3a-7XE.js} +4 -4
  95. package/dist/{getItem-CxU_kT5W.js.map → getItem-DM3a-7XE.js.map} +1 -1
  96. package/dist/{getPublishPayload-DTjOKd3y.js → getPublishPayload-CJF0k5d8.js} +31 -25
  97. package/dist/getPublishPayload-CJF0k5d8.js.map +1 -0
  98. package/dist/{getPublishUploads-CVTBo_OV.js → getPublishUploads-C7-fYIgX.js} +6 -6
  99. package/dist/{getPublishUploads-CVTBo_OV.js.map → getPublishUploads-C7-fYIgX.js.map} +1 -1
  100. package/dist/{index-CMxEil8T.js → index--mmQ3LQu.js} +8 -8
  101. package/dist/index--mmQ3LQu.js.map +1 -0
  102. package/dist/{index-DWK-LOUY.js → index-B7yAoYli.js} +2 -2
  103. package/dist/index-B7yAoYli.js.map +1 -0
  104. package/dist/{BasePathResolver-CBTXCMFL.js → index-CrvIcVFJ.js} +304 -285
  105. package/dist/index-CrvIcVFJ.js.map +1 -0
  106. package/dist/{index.browser-shRXMeB3.js → index.browser-BmVS-c2C.js} +34 -44
  107. package/dist/index.browser-BmVS-c2C.js.map +1 -0
  108. package/dist/{index.node-DAKJNYp5.js → index.node-BKpbCAWt.js} +43 -7
  109. package/dist/index.node-BKpbCAWt.js.map +1 -0
  110. package/dist/main.js +23 -24
  111. package/dist/main.js.map +1 -1
  112. package/dist/node.js +13 -10
  113. package/dist/node.js.map +1 -1
  114. package/dist/platform.browser.js +7 -7
  115. package/dist/platform.node.js +4 -4
  116. package/dist/{property-lz9yIpyA.js → property-DQ-Owzki.js} +7 -7
  117. package/dist/{property-lz9yIpyA.js.map → property-DQ-Owzki.js.map} +1 -1
  118. package/dist/{propertyValidationRules-LuIwoQoJ.js → propertyValidationRules-BDhFjlwP.js} +10 -10
  119. package/dist/{propertyValidationRules-LuIwoQoJ.js.map → propertyValidationRules-BDhFjlwP.js.map} +1 -1
  120. package/dist/{publishDraftGraph-CgSLPKvQ.js → publishDraftGraph-CzPd9oe9.js} +41 -8
  121. package/dist/publishDraftGraph-CzPd9oe9.js.map +1 -0
  122. package/dist/{resetAmbiguousLegacyItemData-CuamkAAh.js → resetAmbiguousLegacyItemData-cXZm4NuG.js} +2 -2
  123. package/dist/{resetAmbiguousLegacyItemData-CuamkAAh.js.map → resetAmbiguousLegacyItemData-cXZm4NuG.js.map} +1 -1
  124. package/dist/{resolveModelForSyncedSeed-BbSctSvz.js → resolveModelForSyncedSeed-BgxtVCHI.js} +2 -2
  125. package/dist/{resolveModelForSyncedSeed-BbSctSvz.js.map → resolveModelForSyncedSeed-BgxtVCHI.js.map} +1 -1
  126. package/dist/src/Item/Item.d.ts.map +1 -1
  127. package/dist/src/ItemProperty/service/actors/initialize.d.ts.map +1 -1
  128. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
  129. package/dist/src/ItemProperty/service/actors/saveValueToDb/rowContext.d.ts +10 -0
  130. package/dist/src/ItemProperty/service/actors/saveValueToDb/rowContext.d.ts.map +1 -0
  131. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.d.ts.map +1 -1
  132. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveHtml.d.ts.map +1 -1
  133. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +1 -1
  134. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -1
  135. package/dist/src/ItemProperty/service/propertyMachine.d.ts +20 -20
  136. package/dist/src/Model/Model.d.ts +8 -0
  137. package/dist/src/Model/Model.d.ts.map +1 -1
  138. package/dist/src/ModelProperty/ModelProperty.d.ts +1 -1
  139. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +3 -3
  140. package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +1 -1
  141. package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
  142. package/dist/src/Schema/service/actors/writeModelsToDb.d.ts.map +1 -1
  143. package/dist/src/browser/db/Db.d.ts.map +1 -1
  144. package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
  145. package/dist/src/client/actors/addModelsToDb.d.ts.map +1 -1
  146. package/dist/src/client/actors/platformClassesInit.d.ts +1 -7
  147. package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
  148. package/dist/src/client/actors/saveAppState.d.ts.map +1 -1
  149. package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
  150. package/dist/src/client/seedConfigDefaults.d.ts +10 -0
  151. package/dist/src/client/seedConfigDefaults.d.ts.map +1 -0
  152. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  153. package/dist/src/db/write/updateItemPropertyValue.d.ts +6 -0
  154. package/dist/src/db/write/updateItemPropertyValue.d.ts.map +1 -1
  155. package/dist/src/drizzle/index.d.ts +7 -0
  156. package/dist/src/drizzle/index.d.ts.map +1 -0
  157. package/dist/src/events/files/download.d.ts.map +1 -1
  158. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  159. package/dist/src/helpers/FileManager/errors.d.ts +11 -0
  160. package/dist/src/helpers/FileManager/errors.d.ts.map +1 -1
  161. package/dist/src/helpers/db.d.ts +14 -0
  162. package/dist/src/helpers/db.d.ts.map +1 -1
  163. package/dist/src/helpers/dotSeedPath.d.ts +7 -0
  164. package/dist/src/helpers/dotSeedPath.d.ts.map +1 -0
  165. package/dist/src/helpers/entity/entityLiveQuery.d.ts.map +1 -1
  166. package/dist/src/helpers/environment.d.ts +5 -0
  167. package/dist/src/helpers/environment.d.ts.map +1 -1
  168. package/dist/src/helpers/getSegmentedItemProperties.d.ts.map +1 -1
  169. package/dist/src/helpers/metadataPropertyNames.d.ts +10 -0
  170. package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
  171. package/dist/src/helpers/reconcilePropertyDraftRows.d.ts +9 -0
  172. package/dist/src/helpers/reconcilePropertyDraftRows.d.ts.map +1 -0
  173. package/dist/src/helpers/updateSchema.d.ts.map +1 -1
  174. package/dist/src/imports/index.d.ts +1 -1
  175. package/dist/src/imports/index.d.ts.map +1 -1
  176. package/dist/src/imports/json.d.ts +18 -5
  177. package/dist/src/imports/json.d.ts.map +1 -1
  178. package/dist/src/index.d.ts +2 -2
  179. package/dist/src/index.d.ts.map +1 -1
  180. package/dist/src/node/helpers/resolveFilesDir.d.ts +8 -0
  181. package/dist/src/node/helpers/resolveFilesDir.d.ts.map +1 -0
  182. package/dist/src/node/webpack/index.d.ts +2 -0
  183. package/dist/src/node/webpack/index.d.ts.map +1 -1
  184. package/dist/src/platform/index.browser.d.ts +5 -0
  185. package/dist/src/platform/index.browser.d.ts.map +1 -1
  186. package/dist/src/platform/index.node.d.ts +1 -0
  187. package/dist/src/platform/index.node.d.ts.map +1 -1
  188. package/dist/src/stores/eas.d.ts +1 -1
  189. package/dist/src/stores/eas.d.ts.map +1 -1
  190. package/dist/src/types/import.d.ts +15 -0
  191. package/dist/src/types/import.d.ts.map +1 -1
  192. package/dist/src/types/index.d.ts +8 -4
  193. package/dist/src/types/index.d.ts.map +1 -1
  194. package/dist/{syncDbWithEas-CrAY9Rl2.js → syncDbWithEas-Y5GysSCm.js} +17 -13
  195. package/dist/syncDbWithEas-Y5GysSCm.js.map +1 -0
  196. package/dist/{tabEvents-BGBYV65P.js → tabEvents-D9x26vf2.js} +4 -4
  197. package/dist/{tabEvents-BGBYV65P.js.map → tabEvents-D9x26vf2.js.map} +1 -1
  198. package/dist/{tolerantWebAccess-DVHCEulL.js → tolerantWebAccess-BFU2t-SC.js} +8 -8
  199. package/dist/{tolerantWebAccess-DVHCEulL.js.map → tolerantWebAccess-BFU2t-SC.js.map} +1 -1
  200. package/dist/{updateSeedRevokedAt-Dy5J8CfQ.js → updateSeedRevokedAt-CCF8WWYS.js} +3 -3
  201. package/dist/{updateSeedRevokedAt-Dy5J8CfQ.js.map → updateSeedRevokedAt-CCF8WWYS.js.map} +1 -1
  202. package/package.json +31 -31
  203. package/dist/BasePathResolver-CBTXCMFL.js.map +0 -1
  204. package/dist/ClientManager-DRf4uuei.js.map +0 -1
  205. package/dist/Item-DTJPMjFk.js.map +0 -1
  206. package/dist/Schema-8DxGcORY.js.map +0 -1
  207. package/dist/configurePlatform-D4aGjKNk.js +0 -31
  208. package/dist/configurePlatform-D4aGjKNk.js.map +0 -1
  209. package/dist/errors-CIrbsN_i.js.map +0 -1
  210. package/dist/errors-CrBxGWah.js +0 -17
  211. package/dist/errors-CrBxGWah.js.map +0 -1
  212. package/dist/getPublishPayload-DTjOKd3y.js.map +0 -1
  213. package/dist/index-CMxEil8T.js.map +0 -1
  214. package/dist/index-DWK-LOUY.js.map +0 -1
  215. package/dist/index.browser-shRXMeB3.js.map +0 -1
  216. package/dist/index.node-DAKJNYp5.js.map +0 -1
  217. package/dist/publishDraftGraph-CgSLPKvQ.js.map +0 -1
  218. package/dist/src/client/nodeEndpointDefaults.d.ts +0 -8
  219. package/dist/src/client/nodeEndpointDefaults.d.ts.map +0 -1
  220. package/dist/syncDbWithEas-CrAY9Rl2.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { waitFor, fromCallback, setup, assign, stateIn, createActor, isMachineSnapshot } from 'xstate';
2
- import { B as BaseDb, F as versions, m as metadata, C as seeds, G as resolveStorageNameToSchemaName, a_ as toSchemaPropertyName, A as schemas, t as models, r as modelSchemas, aY as getOwnedAddressesFromDb, a5 as ZERO_BYTES32, aG as normalizeAddressList, am as normalizeHexAddress, aD as getAddressesForItemsFilter, a9 as INTERNAL_PROPERTY_NAMES, h as BaseFileManager, a$ as getStorageTransactionIdForSeedUid, b0 as convertTxIdToImage, i as isDataType, ah as normalizePublisher, n as normalizeDataType, b1 as getMetadataPropertyNamesForQuery, aC as ensureImageLocal, au as ImageSize, b2 as downloadTransactionIdWithDedupe, b3 as resolveMetadataRecord, v as properties, M as ModelPropertyDataTypes, al as generateId, ac as INTERNAL_DATA_TYPES, s as modelUids, ad as listRelationEasPropertyName, ae as easPropertyNameForPublish, N as resolveItemModelFileId, b4 as getPropertyIdForSchemaFileId, L as getPropertyIdForModelAndName, an as toMetadataPropertyName, b5 as getDataTypeFromString, b6 as getMimeType, _ as INTERNAL_STORAGE_MODEL_FILE_IDS, a2 as getItemStorageSubdir, a3 as getItemStorageLocalFileName, g as normalizePropertyRecordSchema, b7 as listRelationStoragePropertyName, b8 as PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP, R as getCorrectId, I as eventEmitter, b9 as getAlternatePropertyNameForInstanceLookup, aa as isStorageSeedRef } from './BasePathResolver-CBTXCMFL.js';
2
+ import { B as BaseDb, F as versions, m as metadata, C as seeds, G as resolveStorageNameToSchemaName, a$ as toSchemaPropertyName, A as schemas, t as models, r as modelSchemas, aZ as getOwnedAddressesFromDb, a2 as ZERO_BYTES32, aF as normalizeAddressList, aj as normalizeHexAddress, aC as getAddressesForItemsFilter, a6 as INTERNAL_PROPERTY_NAMES, b0 as easSchemaDefinitionForProperty, h as BaseFileManager, b1 as getStorageTransactionIdForSeedUid, b2 as convertTxIdToImage, i as isDataType, ae as normalizePublisher, n as normalizeDataType, b3 as getMetadataPropertyNamesForQuery, aB as ensureImageLocal, at as ImageSize, b4 as downloadTransactionIdWithDedupe, b5 as resolveMetadataRecord, v as properties, M as ModelPropertyDataTypes, ai as generateId, a9 as INTERNAL_DATA_TYPES, s as modelUids, aa as listRelationEasPropertyName, ab as easPropertyNameForPublish, L as resolveItemModelFileId, b6 as getPropertyIdForSchemaFileId, K as getPropertyIdForModelAndName, ak as toMetadataPropertyName, b7 as getDataTypeFromString, b8 as getMimeType, X as INTERNAL_STORAGE_MODEL_FILE_IDS, $ as getItemStorageSubdir, a0 as getItemStorageLocalFileName, g as normalizePropertyRecordSchema, b9 as listRelationStoragePropertyName, ba as PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP, Q as getCorrectId, I as eventEmitter, bb as getAlternatePropertyNameForInstanceLookup, a7 as isStorageSeedRef } from './index-CrvIcVFJ.js';
3
3
  import { or, isNull, eq, max, count, and, getTableColumns, sql, desc, inArray, isNotNull, gt } from 'drizzle-orm';
4
4
  import debug from 'debug';
5
5
  import { BehaviorSubject } from 'rxjs';
@@ -7,7 +7,7 @@ import pluralize from 'pluralize';
7
7
  import { startCase, upperFirst, camelCase, orderBy } from 'lodash-es';
8
8
  import { isValidEasAttestationUid, easName, isPlaceholderUid, BaseQueryClient, BaseEasClient, GET_SCHEMAS, getEasSchemaUidForSchemaDefinition, getSchemaUidForModelFromCache, setSchemaUidForModel, cachedSchemaLookup, getEasSchemaUidForExactDefinition } from '@seedprotocol/eas';
9
9
  import { fetchArweaveRawTextAcrossGateways } from '@seedprotocol/arweave';
10
- import { d as notifyFileSaved, f as withTabLock } from './tabEvents-BGBYV65P.js';
10
+ import { d as notifyFileSaved, f as withTabLock } from './tabEvents-D9x26vf2.js';
11
11
  import { modelPropertiesToObject } from './model-oHA3YhOd.js';
12
12
 
13
13
  /**
@@ -580,7 +580,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
580
580
  const itemPropertyMod = await Promise.resolve().then(function () { return ItemProperty$1; });
581
581
  const { ItemProperty } = itemPropertyMod;
582
582
  const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
583
- const _mod_0 = await import('./errors-CIrbsN_i.js');
583
+ const _mod_0 = await import('./errors-3tc6XkCB.js');
584
584
  const _ns_0 = _mod_0.h;
585
585
  const { Model } = _ns_0;
586
586
  // Resolve Model and build property schemas (use getByNameAsync for models not yet in cache)
@@ -598,7 +598,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
598
598
  const schemaNameToTry = schemaName ?? model?.schemaName;
599
599
  if (schemaNameToTry) {
600
600
  try {
601
- const _mod_1 = await import('./Schema-8DxGcORY.js');
601
+ const _mod_1 = await import('./Schema-DppObO6h.js');
602
602
  const _ns_1 = _mod_1.b;
603
603
  const { Schema } = _ns_1;
604
604
  const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false });
@@ -614,8 +614,8 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
614
614
  }
615
615
  if (Object.keys(propertySchemas).length === 0) {
616
616
  try {
617
- const _mod_2 = await import('./ClientManager-DRf4uuei.js');
618
- const _ns_2 = _mod_2.M;
617
+ const _mod_2 = await import('./ClientManager-D6YA20jP.js');
618
+ const _ns_2 = _mod_2.N;
619
619
  const { loadAllSchemasFromDb } = _ns_2;
620
620
  const allSchemas = await loadAllSchemasFromDb();
621
621
  for (const { schema: schemaFile } of allSchemas) {
@@ -635,11 +635,11 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
635
635
  }
636
636
  if (Object.keys(propertySchemas).length === 0) {
637
637
  try {
638
- const _mod_3 = await import('./ClientManager-DRf4uuei.js');
639
- const _ns_3 = _mod_3.M;
638
+ const _mod_3 = await import('./ClientManager-D6YA20jP.js');
639
+ const _ns_3 = _mod_3.N;
640
640
  const { listCompleteSchemaFiles } = _ns_3;
641
- const _mod_4 = await import('./BasePathResolver-CBTXCMFL.js');
642
- const _ns_4 = _mod_4.bc;
641
+ const _mod_4 = await import('./index-CrvIcVFJ.js');
642
+ const _ns_4 = _mod_4.be;
643
643
  const { BaseFileManager } = _ns_4;
644
644
  const schemaFiles = await listCompleteSchemaFiles();
645
645
  for (const { filePath } of schemaFiles) {
@@ -659,7 +659,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
659
659
  }
660
660
  }
661
661
  if (Object.keys(propertySchemas).length === 0) {
662
- const schemaMod = await import('./index-CMxEil8T.js');
662
+ const schemaMod = await import('./index--mmQ3LQu.js');
663
663
  const { ModelPropertyDataTypes } = schemaMod;
664
664
  const KNOWN_MODEL_FALLBACKS = {
665
665
  Post: {
@@ -676,7 +676,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
676
676
  }
677
677
  }
678
678
  // Fallbacks above may return schema-file shape ({ type, model, items }); normalize to dataType/ref/refValueType.
679
- const { normalizePropertyRecordSchema } = await import('./property-lz9yIpyA.js');
679
+ const { normalizePropertyRecordSchema } = await import('./property-DQ-Owzki.js');
680
680
  propertySchemas = Object.fromEntries(Object.entries(propertySchemas).map(([name, def]) => [name, normalizePropertyRecordSchema(def)]));
681
681
  // Collapse rows that map to the same instance key (e.g. authorIdentityIds + authors -> authors).
682
682
  // ItemProperty.create cache does not sync propertyValue on hit; processing order would otherwise
@@ -709,7 +709,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
709
709
  // Infer propertyRecordSchema from metadata when schema is missing (enables persistence)
710
710
  let propSchema = propertySchemas[propertyName];
711
711
  if (!propSchema && isRefTypeFromMeta) {
712
- const schemaMod = await import('./index-CMxEil8T.js');
712
+ const schemaMod = await import('./index--mmQ3LQu.js');
713
713
  const { ModelPropertyDataTypes } = schemaMod;
714
714
  propSchema = {
715
715
  dataType: refSeedType === 'html' ? ModelPropertyDataTypes.Html
@@ -1711,8 +1711,8 @@ const getItemsData = async ({ modelName, modelFileId, schemaName, deleted, inclu
1711
1711
  conditions.push(eq(seeds.type, easName(modelName)));
1712
1712
  }
1713
1713
  if (!modelFileId && schemaName && modelName) {
1714
- const _mod_5 = await import('./BasePathResolver-CBTXCMFL.js');
1715
- const _ns_5 = _mod_5.bf;
1714
+ const _mod_5 = await import('./index-CrvIcVFJ.js');
1715
+ const _ns_5 = _mod_5.bh;
1716
1716
  const { resolveModelRecord } = _ns_5;
1717
1717
  modelFileId = (await resolveModelRecord(modelName, { schemaName }))?.schemaFileId ?? undefined;
1718
1718
  if (!modelFileId)
@@ -1908,7 +1908,10 @@ const initialize = fromCallback(({ sendBack, input: { context } }) => {
1908
1908
  !propertyRecordSchema.storageType ||
1909
1909
  propertyRecordSchema.storageType !== 'ItemStorage')) {
1910
1910
  try {
1911
- schemaUid = await getEasSchemaUidForSchemaDefinition({ schemaText: propertyName });
1911
+ // A name alone matches schemas of any type (`bytes32 storage_transaction_id` beside
1912
+ // `string storage_transaction_id`), so look up the exact definition when the type is known.
1913
+ const schemaText = easSchemaDefinitionForProperty(propertyName, propertyRecordSchema) ?? propertyName;
1914
+ schemaUid = await getEasSchemaUidForSchemaDefinition({ schemaText });
1912
1915
  if (schemaUid) {
1913
1916
  sendBack({ type: 'updateContext', schemaUid });
1914
1917
  }
@@ -1994,7 +1997,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
1994
1997
  const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
1995
1998
  const _resolveRelatedValue = async () => {
1996
1999
  // Use dynamic import to break circular dependency
1997
- const schemaMod = await import('./index-CMxEil8T.js');
2000
+ const schemaMod = await import('./index--mmQ3LQu.js');
1998
2001
  const { ModelPropertyDataTypes } = schemaMod;
1999
2002
  if (!propertyValue || !isRelation || populatedFromDb) {
2000
2003
  return;
@@ -2429,8 +2432,8 @@ async function readHtmlBodyFromChildStorageArweave(seedLocalId) {
2429
2432
  /* offline / bad tx id */
2430
2433
  }
2431
2434
  try {
2432
- const _mod_6 = await import('./BasePathResolver-CBTXCMFL.js');
2433
- const _ns_6 = _mod_6.bh;
2435
+ const _mod_6 = await import('./index-CrvIcVFJ.js');
2436
+ const _ns_6 = _mod_6.bj;
2434
2437
  const { downloadTransactionIdWithDedupe } = _ns_6;
2435
2438
  await downloadTransactionIdWithDedupe(txId);
2436
2439
  const retryFp = BaseFileManager.getFilesPath('html', `${seedLocalId}.html`);
@@ -2490,7 +2493,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
2490
2493
  // to use dynamically imported ModelPropertyDataTypes
2491
2494
  const _hydrateFromDb = async () => {
2492
2495
  // Use dynamic import to break circular dependency
2493
- const schemaMod = await import('./index-CMxEil8T.js');
2496
+ const schemaMod = await import('./index--mmQ3LQu.js');
2494
2497
  const { ModelPropertyDataTypes } = schemaMod;
2495
2498
  const appDb = BaseDb.getAppDb();
2496
2499
  const whereClauses = [];
@@ -2771,12 +2774,12 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
2771
2774
  const modelNameForNew = context.modelName;
2772
2775
  if (modelNameForNew) {
2773
2776
  try {
2774
- const _mod_7 = await import('./errors-CIrbsN_i.js');
2777
+ const _mod_7 = await import('./errors-3tc6XkCB.js');
2775
2778
  const _ns_7 = _mod_7.h;
2776
2779
  const { Model } = _ns_7;
2777
2780
  const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
2778
- const _mod_8 = await import('./BasePathResolver-CBTXCMFL.js');
2779
- const _ns_8 = _mod_8.bf;
2781
+ const _mod_8 = await import('./index-CrvIcVFJ.js');
2782
+ const _ns_8 = _mod_8.bh;
2780
2783
  const { resolveItemModelFileId } = _ns_8;
2781
2784
  const normalizedModelName = upperFirst(camelCase(modelNameForNew));
2782
2785
  const itemModelFileId = await resolveItemModelFileId({
@@ -2829,8 +2832,8 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
2829
2832
  // It ends up in the context below, and later lookups by name (Model.getByName) can't match it.
2830
2833
  const modelName = context.modelName || (metadataRecord.modelType ? upperFirst(camelCase(metadataRecord.modelType)) : undefined);
2831
2834
  // Model names are only unique per schema: pin lookups to the item's own model row.
2832
- const _mod_9 = await import('./BasePathResolver-CBTXCMFL.js');
2833
- const _ns_9 = _mod_9.bf;
2835
+ const _mod_9 = await import('./index-CrvIcVFJ.js');
2836
+ const _ns_9 = _mod_9.bh;
2834
2837
  const { resolveItemModelFileId, resolveModelRecord } = _ns_9;
2835
2838
  const modelFileId = await resolveItemModelFileId({
2836
2839
  modelFileId: context.modelFileId,
@@ -2874,7 +2877,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
2874
2877
  required: propRecord.required ?? undefined,
2875
2878
  };
2876
2879
  // Validation rules (enum, pattern, ...) aren't in the properties table
2877
- const { resolvePropertyValidationRules } = await import('./propertyValidationRules-LuIwoQoJ.js');
2880
+ const { resolvePropertyValidationRules } = await import('./propertyValidationRules-BDhFjlwP.js');
2878
2881
  const validation = await resolvePropertyValidationRules(normalizedModelName, propertyName, {
2879
2882
  modelFileId: modelRecord?.schemaFileId ?? modelFileId,
2880
2883
  });
@@ -2891,7 +2894,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
2891
2894
  }
2892
2895
  if (!propertyRecordSchema && modelName) {
2893
2896
  try {
2894
- const _mod_10 = await import('./errors-CIrbsN_i.js');
2897
+ const _mod_10 = await import('./errors-3tc6XkCB.js');
2895
2898
  const _ns_10 = _mod_10.h;
2896
2899
  const { Model } = _ns_10;
2897
2900
  const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
@@ -3183,6 +3186,20 @@ const updateItemPropertyValue = async ({ localId: localIdParam, propertyName, ne
3183
3186
  .where(and(propertyNameWhere, eq(metadata.seedLocalId, seedLocalId)))
3184
3187
  .orderBy(sql.raw(METADATA_LATEST_FIRST_ORDER_SQL)));
3185
3188
  }
3189
+ // A localId can name a published row that an edit has since moved off (a property whose context
3190
+ // went stale). Compare with, and write to, the property's newest row instead: otherwise every save
3191
+ // adds another draft, and setting the published value back looks unchanged and keeps the draft.
3192
+ const localIdRow = localIdParam ? rows.find((row) => row.localId === localIdParam) : undefined;
3193
+ if (localIdRow?.uid && localIdRow.propertyName && localIdRow.seedLocalId) {
3194
+ const newestRows = (await appDb
3195
+ .select()
3196
+ .from(metadata)
3197
+ .where(and(eq(metadata.propertyName, localIdRow.propertyName), eq(metadata.seedLocalId, localIdRow.seedLocalId)))
3198
+ .orderBy(sql.raw(METADATA_LATEST_FIRST_ORDER_SQL))
3199
+ .limit(1));
3200
+ if (newestRows.length > 0)
3201
+ rows = newestRows;
3202
+ }
3186
3203
  if (rows && rows.length > 0) {
3187
3204
  const { localId, uid, propertyName: propertyNameFromDb, propertyValue: propertyValueFromDb, modelType, seedUid, seedLocalId: seedLocalIdFromDb, versionLocalId, versionUid, schemaUid, easDataType, localStorageDir: localStorageDirFromDb, refSeedType: refSeedTypeFromDb, refResolvedValue: refResolvedValueFromDb, refResolvedDisplayValue: refResolvedDisplayValueFromDb, } = rows[0];
3188
3205
  // Stored model types are the model's EAS name (ADR 0008): `blog_post` for BlogPost.
@@ -3193,7 +3210,7 @@ const updateItemPropertyValue = async ({ localId: localIdParam, propertyName, ne
3193
3210
  (refSeedTypeFromDb ?? null) === (refSeedType ?? null) &&
3194
3211
  (refResolvedValueFromDb ?? null) === (refResolvedValue ?? null)) {
3195
3212
  logger$2(`[db/write] [updateItemPropertyValue] value is the same as most recent record for property: ${propertyNameFromDb}`);
3196
- return;
3213
+ return localId == null ? undefined : { localId, uid: uid ?? null, schemaUid: schemaUid ?? '' };
3197
3214
  }
3198
3215
  // This means we already have a local-only record so we should just update that one
3199
3216
  if (!uid) {
@@ -3218,7 +3235,7 @@ const updateItemPropertyValue = async ({ localId: localIdParam, propertyName, ne
3218
3235
  .update(metadata)
3219
3236
  .set(updatePayload)
3220
3237
  .where(eq(metadata.localId, localId));
3221
- return;
3238
+ return { localId, uid: null, schemaUid: schemaUid ?? '' };
3222
3239
  }
3223
3240
  const seedDataFromDb = seedLocalId ? await getSeedData({ seedLocalId }) : null;
3224
3241
  const versionDataFromDb = versionLocalId ? await getVersionData({ localId: versionLocalId }) : null;
@@ -3246,6 +3263,7 @@ const updateItemPropertyValue = async ({ localId: localIdParam, propertyName, ne
3246
3263
  });
3247
3264
  return {
3248
3265
  localId: newLocalId,
3266
+ uid: null,
3249
3267
  schemaUid: schemaUid ?? '',
3250
3268
  };
3251
3269
  }
@@ -3283,6 +3301,7 @@ const updateItemPropertyValue = async ({ localId: localIdParam, propertyName, ne
3283
3301
  });
3284
3302
  return {
3285
3303
  localId: newLocalId,
3304
+ uid: null,
3286
3305
  schemaUid: schemaUid ?? '',
3287
3306
  };
3288
3307
  };
@@ -3329,6 +3348,12 @@ const reservePropertyWrite = (key) => {
3329
3348
  };
3330
3349
  const hasPendingPropertyWrite = (key) => !!key && (queues.get(key)?.pending ?? 0) > 0;
3331
3350
 
3351
+ /**
3352
+ * Points the context at the row the write left the value in. Editing a published row writes a new
3353
+ * draft row: keeping the old row's localId and uid would make patch Publish skip the edit as attested.
3354
+ */
3355
+ const rowContext = (result) => (result ? { localId: result.localId, uid: result.uid ?? undefined } : {});
3356
+
3332
3357
  const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
3333
3358
  const { localId, propertyName: propertyNameRaw, seedLocalId, versionLocalId, versionUid, propertyValue: existingValue, propertyRecordSchema, modelName, } = context;
3334
3359
  let { schemaUid } = context;
@@ -3354,9 +3379,9 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
3354
3379
  return false;
3355
3380
  }
3356
3381
  // Use dynamic import to break circular dependency
3357
- const schemaMod = await import('./index-CMxEil8T.js');
3382
+ const schemaMod = await import('./index--mmQ3LQu.js');
3358
3383
  const { ModelPropertyDataTypes } = schemaMod;
3359
- const { SchemaValidationService } = await import('./SchemaValidationService-CE92y1TT.js');
3384
+ const { SchemaValidationService } = await import('./SchemaValidationService-DXQ-D531.js');
3360
3385
  let propertyName = propertyNameRaw;
3361
3386
  if (!propertyName) {
3362
3387
  throw new Error('propertyName is required');
@@ -3464,8 +3489,7 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
3464
3489
  updatedContext.localId = localId;
3465
3490
  if (schemaUid)
3466
3491
  updatedContext.schemaUid = schemaUid;
3467
- if (!localId && result?.localId)
3468
- updatedContext.localId = result.localId;
3492
+ Object.assign(updatedContext, rowContext(result));
3469
3493
  if (!schemaUid && result?.schemaUid)
3470
3494
  updatedContext.schemaUid = result.schemaUid;
3471
3495
  sendBack({ type: 'updateContext', ...updatedContext });
@@ -3501,9 +3525,7 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
3501
3525
  if (schemaUid) {
3502
3526
  updatedContext.schemaUid = schemaUid;
3503
3527
  }
3504
- if (!localId && result?.localId) {
3505
- updatedContext.localId = result.localId;
3506
- }
3528
+ Object.assign(updatedContext, rowContext(result));
3507
3529
  if (!schemaUid && result?.schemaUid) {
3508
3530
  updatedContext.schemaUid = result.schemaUid;
3509
3531
  }
@@ -3679,7 +3701,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
3679
3701
  propertyRecordSchema?.validation &&
3680
3702
  metadataValues.propertyValue != null &&
3681
3703
  metadataValues.propertyValue !== '') {
3682
- const { SchemaValidationService } = await import('./SchemaValidationService-CE92y1TT.js');
3704
+ const { SchemaValidationService } = await import('./SchemaValidationService-DXQ-D531.js');
3683
3705
  const validationService = new SchemaValidationService();
3684
3706
  const validationResult = validationService.validatePropertyValue(metadataValues.propertyValue, normalizeDataType(propertyRecordSchema.dataType), propertyRecordSchema.validation, propertyRecordSchema.refValueType
3685
3707
  ? normalizeDataType(String(propertyRecordSchema.refValueType))
@@ -3941,8 +3963,9 @@ const saveImage = fromCallback(({ sendBack, input: { context, event } }) => {
3941
3963
  newLocalId = result.localId;
3942
3964
  }
3943
3965
  }
3966
+ let writtenRow = {};
3944
3967
  if (localId) {
3945
- await updateItemPropertyValue({
3968
+ writtenRow = rowContext(await updateItemPropertyValue({
3946
3969
  localId: localId,
3947
3970
  propertyName,
3948
3971
  newValue: newImageSeedLocalId,
@@ -3954,11 +3977,12 @@ const saveImage = fromCallback(({ sendBack, input: { context, event } }) => {
3954
3977
  refResolvedValue: fileName,
3955
3978
  localStorageDir: '/images',
3956
3979
  dataType: 'Image',
3957
- }); // Type assertion needed because newValue is not in MetadataType but is accepted by the function
3980
+ })); // Type assertion needed because newValue is not in MetadataType but is accepted by the function
3958
3981
  }
3959
3982
  sendBack({
3960
3983
  type: 'updateContext',
3961
3984
  localId: newLocalId || localId,
3985
+ ...writtenRow,
3962
3986
  propertyValue: newImageSeedLocalId,
3963
3987
  refSeedType: 'image',
3964
3988
  refSchemaUid: imageSchemaUid,
@@ -4135,8 +4159,9 @@ const saveFile = fromCallback(({ sendBack, input: { context, event } }) => {
4135
4159
  newLocalId = result.localId;
4136
4160
  }
4137
4161
  }
4162
+ let writtenRow = {};
4138
4163
  if (localId) {
4139
- await updateItemPropertyValue({
4164
+ writtenRow = rowContext(await updateItemPropertyValue({
4140
4165
  localId,
4141
4166
  propertyName,
4142
4167
  newValue: newFileSeedLocalId,
@@ -4149,11 +4174,12 @@ const saveFile = fromCallback(({ sendBack, input: { context, event } }) => {
4149
4174
  refResolvedValue: fileName,
4150
4175
  localStorageDir: '/files',
4151
4176
  dataType: 'File',
4152
- });
4177
+ }));
4153
4178
  }
4154
4179
  sendBack({
4155
4180
  type: 'updateContext',
4156
4181
  localId: newLocalId || localId,
4182
+ ...writtenRow,
4157
4183
  propertyValue: newFileSeedLocalId,
4158
4184
  refSeedType: 'file',
4159
4185
  refSchemaUid: fileSchemaUid,
@@ -4240,8 +4266,9 @@ const saveHtml = fromCallback(({ sendBack, input: { context, event } }) => {
4240
4266
  newLocalId = result.localId;
4241
4267
  }
4242
4268
  }
4269
+ let writtenRow = {};
4243
4270
  if (localId) {
4244
- await updateItemPropertyValue({
4271
+ writtenRow = rowContext(await updateItemPropertyValue({
4245
4272
  localId,
4246
4273
  propertyName,
4247
4274
  newValue: newHtmlSeedLocalId,
@@ -4254,11 +4281,12 @@ const saveHtml = fromCallback(({ sendBack, input: { context, event } }) => {
4254
4281
  refResolvedValue: fileName,
4255
4282
  localStorageDir: '/html',
4256
4283
  dataType: 'Html',
4257
- });
4284
+ }));
4258
4285
  }
4259
4286
  sendBack({
4260
4287
  type: 'updateContext',
4261
4288
  localId: newLocalId || localId,
4289
+ ...writtenRow,
4262
4290
  propertyValue: newHtmlSeedLocalId,
4263
4291
  refSeedType: 'html',
4264
4292
  refSchemaUid: htmlSchemaUid,
@@ -4292,7 +4320,7 @@ const saveRelation = fromCallback(({ sendBack, input: { context, event } }) => {
4292
4320
  }
4293
4321
  const _saveRelation = async () => {
4294
4322
  // Use dynamic import to break circular dependency
4295
- const schemaMod = await import('./index-CMxEil8T.js');
4323
+ const schemaMod = await import('./index--mmQ3LQu.js');
4296
4324
  const { ModelPropertyDataTypes } = schemaMod;
4297
4325
  if (!propertyNameRaw) {
4298
4326
  throw new Error('propertyName is required');
@@ -4604,8 +4632,10 @@ const saveItemStorage = fromCallback(({ sendBack, input: { context, event } }) =
4604
4632
  // the browser's metadata live query, which Node does not have at all.
4605
4633
  refResolvedValue: fileName,
4606
4634
  localStorageDir,
4607
- // Point the property at the draft row when the edit moved off a published row.
4608
- ...(propertyData.localId !== localId && { localId: propertyData.localId }),
4635
+ // Point the property at the draft row when the edit moved off a published row, and drop the
4636
+ // published row's uid with it: patch Publish skips a property that has one.
4637
+ localId: propertyData.localId ?? localId,
4638
+ uid: propertyData.uid ?? undefined,
4609
4639
  });
4610
4640
  return true;
4611
4641
  };
@@ -5011,11 +5041,11 @@ const getPropertyData = async ({ propertyName, seedLocalId, seedUid, modelName,
5011
5041
  let names = [...getMetadataPropertyNamesForQuery(propertyName)];
5012
5042
  if (modelName) {
5013
5043
  try {
5014
- const _mod_11 = await import('./errors-CIrbsN_i.js');
5044
+ const _mod_11 = await import('./errors-3tc6XkCB.js');
5015
5045
  const _ns_11 = _mod_11.h;
5016
5046
  const { Model } = _ns_11;
5017
- const _mod_12 = await import('./BasePathResolver-CBTXCMFL.js');
5018
- const _ns_12 = _mod_12.bf;
5047
+ const _mod_12 = await import('./index-CrvIcVFJ.js');
5048
+ const _ns_12 = _mod_12.bh;
5019
5049
  const { resolveItemModelFileId } = _ns_12;
5020
5050
  // Model names are only unique per schema: use the seed's own model when it is recorded.
5021
5051
  const modelFileId = await resolveItemModelFileId({ seedLocalId, seedUid });
@@ -5215,8 +5245,8 @@ const HTML_PROP_SEED_UID_RE = /^0x[a-fA-F0-9]{64}$/;
5215
5245
  */
5216
5246
  const resolvePropertyRecordSchemaFromSchemaData = async (modelName, propertyName, modelType, schemaName) => {
5217
5247
  try {
5218
- const _mod_13 = await import('./ClientManager-DRf4uuei.js');
5219
- const _ns_13 = _mod_13.M;
5248
+ const _mod_13 = await import('./ClientManager-D6YA20jP.js');
5249
+ const _ns_13 = _mod_13.N;
5220
5250
  const { loadAllSchemasFromDb } = _ns_13;
5221
5251
  const allSchemas = await loadAllSchemasFromDb();
5222
5252
  const modelNameAlt = modelType ? upperFirst(camelCase(modelType)) : '';
@@ -5269,12 +5299,12 @@ hints = {}) => {
5269
5299
  return undefined;
5270
5300
  }
5271
5301
  try {
5272
- const _mod_14 = await import('./errors-CIrbsN_i.js');
5302
+ const _mod_14 = await import('./errors-3tc6XkCB.js');
5273
5303
  const _ns_14 = _mod_14.h;
5274
5304
  const { Model } = _ns_14;
5275
5305
  const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
5276
- const _mod_15 = await import('./BasePathResolver-CBTXCMFL.js');
5277
- const _ns_15 = _mod_15.bf;
5306
+ const _mod_15 = await import('./index-CrvIcVFJ.js');
5307
+ const _ns_15 = _mod_15.bh;
5278
5308
  const { resolveItemModelFileId } = _ns_15;
5279
5309
  const modelFileId = await resolveItemModelFileId(hints);
5280
5310
  let model = modelFileId
@@ -5433,7 +5463,7 @@ class ItemProperty {
5433
5463
  return;
5434
5464
  }
5435
5465
  // Use dynamic import to break circular dependency
5436
- const schemaMod = await import('./index-CMxEil8T.js');
5466
+ const schemaMod = await import('./index--mmQ3LQu.js');
5437
5467
  const { ModelPropertyDataTypes } = schemaMod;
5438
5468
  const { context } = snapshot;
5439
5469
  const { propertyRecordSchema } = context;
@@ -5608,7 +5638,7 @@ class ItemProperty {
5608
5638
  const normalizedRefValueType = normalizeDataType(propertyRecordSchema?.refValueType);
5609
5639
  const propertyNames = getMetadataPropertyNamesForQuery(propertyName, normalizedDataType, normalizedRefValueType);
5610
5640
  const propertyNameVariant = propertyNames.length > 1 ? propertyNames[1] : undefined;
5611
- const _mod_16 = await import('./index-DWK-LOUY.js');
5641
+ const _mod_16 = await import('./index-B7yAoYli.js');
5612
5642
  const _ns_16 = _mod_16.s;
5613
5643
  const seedSchemaMod = _ns_16;
5614
5644
  const { metadata } = seedSchemaMod;
@@ -5832,8 +5862,8 @@ class ItemProperty {
5832
5862
  const ctx = this._service.getSnapshot().context;
5833
5863
  let modelFileId;
5834
5864
  try {
5835
- const _mod_17 = await import('./BasePathResolver-CBTXCMFL.js');
5836
- const _ns_17 = _mod_17.bf;
5865
+ const _mod_17 = await import('./index-CrvIcVFJ.js');
5866
+ const _ns_17 = _mod_17.bh;
5837
5867
  const { resolveItemModelFileId } = _ns_17;
5838
5868
  modelFileId = await resolveItemModelFileId({
5839
5869
  modelFileId: ctx.modelFileId,
@@ -6195,8 +6225,8 @@ class ItemProperty {
6195
6225
  const propertiesData = await getItemProperties({ seedLocalId, seedUid });
6196
6226
  const instances = [];
6197
6227
  const seenNormalized = new Set();
6198
- const _mod_18 = await import('./BasePathResolver-CBTXCMFL.js');
6199
- const _ns_18 = _mod_18.bf;
6228
+ const _mod_18 = await import('./index-CrvIcVFJ.js');
6229
+ const _ns_18 = _mod_18.bh;
6200
6230
  const { resolveItemModelFileId } = _ns_18;
6201
6231
  const itemModelFileId = await resolveItemModelFileId({ seedLocalId, seedUid });
6202
6232
  for (const data of propertiesData) {
@@ -6213,7 +6243,7 @@ class ItemProperty {
6213
6243
  }
6214
6244
  else if (baseName) {
6215
6245
  try {
6216
- const _mod_19 = await import('./errors-CIrbsN_i.js');
6246
+ const _mod_19 = await import('./errors-3tc6XkCB.js');
6217
6247
  const _ns_19 = _mod_19.h;
6218
6248
  const { Model } = _ns_19;
6219
6249
  const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
@@ -6230,7 +6260,7 @@ class ItemProperty {
6230
6260
  }
6231
6261
  if (modelName && propertyName) {
6232
6262
  try {
6233
- const _mod_20 = await import('./errors-CIrbsN_i.js');
6263
+ const _mod_20 = await import('./errors-3tc6XkCB.js');
6234
6264
  const _ns_20 = _mod_20.h;
6235
6265
  const { Model } = _ns_20;
6236
6266
  const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
@@ -6562,7 +6592,7 @@ class ItemProperty {
6562
6592
  if (!propertyName || (!seedLocalId && !seedUid))
6563
6593
  return;
6564
6594
  if (db) {
6565
- const _mod_21 = await import('./index-DWK-LOUY.js');
6595
+ const _mod_21 = await import('./index-B7yAoYli.js');
6566
6596
  const _ns_21 = _mod_21.s;
6567
6597
  const seedSchemaMod = _ns_21;
6568
6598
  const { metadata } = seedSchemaMod;
@@ -6607,7 +6637,7 @@ const createNewItem = async ({ modelName, modelFileId, ...propertyData }) => {
6607
6637
  }
6608
6638
  const seedType = easName(modelName);
6609
6639
  // Dynamic import to break circular dependency
6610
- const _mod_22 = await import('./errors-CIrbsN_i.js');
6640
+ const _mod_22 = await import('./errors-3tc6XkCB.js');
6611
6641
  const _ns_22 = _mod_22.h;
6612
6642
  const modelMod = _ns_22;
6613
6643
  const { Model } = modelMod;
@@ -6621,7 +6651,7 @@ const createNewItem = async ({ modelName, modelFileId, ...propertyData }) => {
6621
6651
  catch (error) {
6622
6652
  // The rows are separate inserts (no transaction): remove what was written so a failure leaves
6623
6653
  // no half-made draft.
6624
- const { discardNewDraft } = await import('./discardNewDraft-CEOouygG.js');
6654
+ const { discardNewDraft } = await import('./discardNewDraft-oGYdB5vS.js');
6625
6655
  await discardNewDraft(newSeedId).catch(() => undefined);
6626
6656
  throw error;
6627
6657
  }
@@ -6802,7 +6832,7 @@ const getModel = () => {
6802
6832
  // the fragile `import(...).then(n => n.X)` chunk-namespace pattern.
6803
6833
  if (!modelImportPromise) {
6804
6834
  modelImportPromise = (async () => {
6805
- const _mod_23 = await import('./errors-CIrbsN_i.js');
6835
+ const _mod_23 = await import('./errors-3tc6XkCB.js');
6806
6836
  const _ns_23 = _mod_23.h;
6807
6837
  const mod = _ns_23;
6808
6838
  ModelClass = mod.Model;
@@ -6871,6 +6901,12 @@ const itemInstanceState = new WeakMap();
6871
6901
  * which the instance and its reactive proxy share.
6872
6902
  */
6873
6903
  const supersededSeedUids = new WeakMap();
6904
+ /**
6905
+ * Each Item's reactive proxy, keyed by the raw instance. The class's arrow-function methods see the
6906
+ * raw instance as `this`, where tracked properties such as `seedUid` are getter-only; anything they
6907
+ * hand the item to that assigns tracked properties (the publish executor) must get the proxy.
6908
+ */
6909
+ const reactiveProxies = new WeakMap();
6874
6910
  class Item {
6875
6911
  constructor(initialValues) {
6876
6912
  this._propertiesSubject = new BehaviorSubject({});
@@ -6965,19 +7001,21 @@ class Item {
6965
7001
  }
6966
7002
  }
6967
7003
  });
6968
- this._service.send({ type: 'startPublish', item: this, options });
7004
+ // The executor assigns item.seedUid, which only the proxy accepts.
7005
+ const item = reactiveProxies.get(this) ?? this;
7006
+ this._service.send({ type: 'startPublish', item, options });
6969
7007
  });
6970
7008
  };
6971
7009
  this.getPublishUploads = async (options) => {
6972
7010
  // Use dynamic import to break circular dependency
6973
- const _mod_24 = await import('./getPublishUploads-CVTBo_OV.js');
7011
+ const _mod_24 = await import('./getPublishUploads-C7-fYIgX.js');
6974
7012
  const _ns_24 = _mod_24.o;
6975
7013
  const getPublishUploadsMod = _ns_24;
6976
7014
  const { getPublishUploads } = getPublishUploadsMod;
6977
7015
  return await getPublishUploads(this, [], undefined, options);
6978
7016
  };
6979
7017
  this.getPublishPayload = async (uploadedTransactions, options) => {
6980
- const _mod_25 = await import('./getPublishPayload-DTjOKd3y.js');
7018
+ const _mod_25 = await import('./getPublishPayload-CJF0k5d8.js');
6981
7019
  const _ns_25 = _mod_25.g;
6982
7020
  const getPublishPayloadMod = _ns_25;
6983
7021
  const { getPublishPayload } = getPublishPayloadMod;
@@ -7484,6 +7522,7 @@ class Item {
7484
7522
  return getInvariantSafePropertyDescriptor(target, prop, invent);
7485
7523
  },
7486
7524
  });
7525
+ reactiveProxies.set(newInstance, proxiedInstance);
7487
7526
  this.registerItemInInstanceCache(proxiedInstance);
7488
7527
  if (!waitForReady)
7489
7528
  return proxiedInstance;
@@ -7516,8 +7555,8 @@ class Item {
7516
7555
  const db = BaseDb.getAppDb();
7517
7556
  if (db && props.modelName) {
7518
7557
  // Model names are only unique per schema: resolve the exact models row from the most specific scope.
7519
- const _mod_26 = await import('./BasePathResolver-CBTXCMFL.js');
7520
- const _ns_26 = _mod_26.bf;
7558
+ const _mod_26 = await import('./index-CrvIcVFJ.js');
7559
+ const _ns_26 = _mod_26.bh;
7521
7560
  const { resolveModelRecord } = _ns_26;
7522
7561
  const modelRecord = await resolveModelRecord(props.modelName, {
7523
7562
  modelFileId: props.modelFileId ?? modelInstance?.id,
@@ -7525,7 +7564,7 @@ class Item {
7525
7564
  });
7526
7565
  const modelRecords = modelRecord ? [modelRecord] : [];
7527
7566
  if (!modelRecord) {
7528
- const _mod_27 = await import('./errors-CIrbsN_i.js');
7567
+ const _mod_27 = await import('./errors-3tc6XkCB.js');
7529
7568
  const _ns_27 = _mod_27.j;
7530
7569
  const { UnknownModelError } = _ns_27;
7531
7570
  throw new UnknownModelError(props.modelName, schemaName ?? modelInstance?.schemaName);
@@ -7536,11 +7575,11 @@ class Item {
7536
7575
  // Scope the constructor's Model lookup to this model's schema (as getItemData does on reload),
7537
7576
  // so a same-named model cached from another schema can't supply the property set.
7538
7577
  if (modelRecord && !props.schemaName) {
7539
- const _mod_28 = await import('./BasePathResolver-CBTXCMFL.js');
7540
- const _ns_28 = _mod_28.be;
7578
+ const _mod_28 = await import('./index-CrvIcVFJ.js');
7579
+ const _ns_28 = _mod_28.bg;
7541
7580
  const { modelSchemas } = _ns_28;
7542
- const _mod_29 = await import('./BasePathResolver-CBTXCMFL.js');
7543
- const _ns_29 = _mod_29.bd;
7581
+ const _mod_29 = await import('./index-CrvIcVFJ.js');
7582
+ const _ns_29 = _mod_29.bf;
7544
7583
  const { schemas: schemasTable } = _ns_29;
7545
7584
  const schemaRows = await db
7546
7585
  .select({ schemaName: schemasTable.name })
@@ -7704,6 +7743,7 @@ class Item {
7704
7743
  return getInvariantSafePropertyDescriptor(target, prop, invent);
7705
7744
  },
7706
7745
  });
7746
+ reactiveProxies.set(newInstance, proxiedInstance);
7707
7747
  this.registerItemInInstanceCache(proxiedInstance);
7708
7748
  // Storage values must be saved before returning, so wait for readiness even when not requested.
7709
7749
  if (!waitForReady && pipelineValues.length === 0)
@@ -7728,7 +7768,7 @@ class Item {
7728
7768
  /* best-effort cache cleanup */
7729
7769
  }
7730
7770
  try {
7731
- const { discardNewDraft } = await import('./discardNewDraft-CEOouygG.js');
7771
+ const { discardNewDraft } = await import('./discardNewDraft-oGYdB5vS.js');
7732
7772
  await discardNewDraft(seedLocalId);
7733
7773
  }
7734
7774
  catch (error) {
@@ -7752,7 +7792,7 @@ class Item {
7752
7792
  }
7753
7793
  catch (error) {
7754
7794
  if (error instanceof ItemPropertySaveValidationError) {
7755
- const _mod_30 = await import('./errors-CIrbsN_i.js');
7795
+ const _mod_30 = await import('./errors-3tc6XkCB.js');
7756
7796
  const _ns_30 = _mod_30.j;
7757
7797
  const { ItemCreateValidationError } = _ns_30;
7758
7798
  const created = new ItemCreateValidationError(item.modelName, error.validationErrors.map((e) => ({ property: propertyName, code: e.code, message: e.message })));
@@ -7919,7 +7959,7 @@ class Item {
7919
7959
  if (!appDb || Item.instanceCache.size === 0) {
7920
7960
  return;
7921
7961
  }
7922
- const _mod_31 = await import('./index-DWK-LOUY.js');
7962
+ const _mod_31 = await import('./index-B7yAoYli.js');
7923
7963
  const _ns_31 = _mod_31.s;
7924
7964
  const { metadata } = _ns_31;
7925
7965
  const { eq, and } = await import('drizzle-orm');
@@ -8082,11 +8122,11 @@ class Item {
8082
8122
  }
8083
8123
  /** Throws ItemCreateValidationError for unknown keys and values that break their property's rules. */
8084
8124
  static async assertValidCreateValues(props, propertyNames, dataTypeByPropertyName, skipKeys) {
8085
- const _mod_32 = await import('./errors-CIrbsN_i.js');
8125
+ const _mod_32 = await import('./errors-3tc6XkCB.js');
8086
8126
  const _ns_32 = _mod_32.j;
8087
8127
  const { ItemCreateValidationError } = _ns_32;
8088
- const { getPropertySchema } = await import('./property-lz9yIpyA.js');
8089
- const { SchemaValidationService } = await import('./SchemaValidationService-CE92y1TT.js');
8128
+ const { getPropertySchema } = await import('./property-DQ-Owzki.js');
8129
+ const { SchemaValidationService } = await import('./SchemaValidationService-DXQ-D531.js');
8090
8130
  const validationService = new SchemaValidationService();
8091
8131
  const modelName = props.modelName;
8092
8132
  const known = new Set(propertyNames);
@@ -8123,7 +8163,7 @@ class Item {
8123
8163
  // Not JSON: validated as given, and rejected as a non-array
8124
8164
  }
8125
8165
  }
8126
- const { resolvePropertyValidationRules } = await import('./propertyValidationRules-LuIwoQoJ.js');
8166
+ const { resolvePropertyValidationRules } = await import('./propertyValidationRules-BDhFjlwP.js');
8127
8167
  const rules = propertySchema?.validation ??
8128
8168
  (await resolvePropertyValidationRules(modelName, key, {
8129
8169
  modelFileId: props.modelFileId,
@@ -8454,7 +8494,7 @@ class Item {
8454
8494
  itemActor.send(event);
8455
8495
  };
8456
8496
  try {
8457
- const _mod_33 = await import('./index-DWK-LOUY.js');
8497
+ const _mod_33 = await import('./index-B7yAoYli.js');
8458
8498
  const _ns_33 = _mod_33.s;
8459
8499
  const seedSchemaMod = _ns_33;
8460
8500
  const { seeds, versions, metadata } = seedSchemaMod;
@@ -8824,5 +8864,5 @@ var Item$1 = /*#__PURE__*/Object.freeze({
8824
8864
  Item: Item
8825
8865
  });
8826
8866
 
8827
- export { unloadEntity as $, getPublishExecutor as A, getRevokeExecutor as B, ClientManagerState as C, DEFAULT_READY_TIMEOUT_MS as D, getUploadExecutor as E, getVersionData$1 as F, isLocalUnsealedDraft as G, isSeedRowOwned as H, Item as I, localUnsealedDraftSql as J, ownedPublisherSql as K, ownedSeedsSql as L, METADATA_LATEST_FIRST_ORDER_SQL as M, pickLatestMetadataRowPerProperty as N, OwnershipError as O, PUBLISH_NOT_CONFIGURED_MESSAGE as P, placeholderUidSql as Q, propertyMachine as R, publisherInAddressListSql as S, publisherIsInOwnedSet as T, setAdditionalSyncAddresses as U, setGetPublisherForNewSeeds as V, setPublishExecutor as W, setRevokeExecutor as X, setUploadExecutor as Y, getInvariantSafePropertyDescriptor as Z, clearDestroySubscriptions as _, ItemProperty as a, ClientManagerEvents as a0, withLockedItemStorageRow as a1, getItemStorageFilePath as a2, writeItemStorageFile as a3, resolvePublisherFromSeedRow as a4, getPropertyData$1 as a5, Item$1 as a6, ItemPropertySaveValidationError as b, assertItemOwned as c, waitForEntityIdle as d, compareMetadataRowsLatestFirst as e, getEasSchemaUidForModel as f, getItemData as g, getLatestPublishedVersionRow as h, isItemOwned as i, isVersionRevoked as j, chunkValues as k, getGetAdditionalSyncAddresses as l, createReactiveProxy as m, findEntity as n, forceRemoveFromCaches as o, parseListPropertyValueFromStorage as p, runDestroyLifecycle as q, rowsPerInsert as r, selectInBatches as s, isPublishedMetadataRow as t, MachineIds as u, createNewItem as v, writeInBatches as w, getEasSchemaForItemProperty as x, getGetPublisherForNewSeeds as y, getMetadataLatest as z };
8828
- //# sourceMappingURL=Item-DTJPMjFk.js.map
8867
+ export { unloadEntity as $, getPublishExecutor as A, getRevokeExecutor as B, ClientManagerState as C, DEFAULT_READY_TIMEOUT_MS as D, getUploadExecutor as E, getVersionData$1 as F, isLocalUnsealedDraft as G, isSeedRowOwned as H, Item as I, localUnsealedDraftSql as J, ownedPublisherSql as K, ownedSeedsSql as L, METADATA_LATEST_FIRST_ORDER_SQL as M, pickLatestMetadataRowPerProperty as N, OwnershipError as O, PUBLISH_NOT_CONFIGURED_MESSAGE as P, placeholderUidSql as Q, propertyMachine as R, publisherInAddressListSql as S, publisherIsInOwnedSet as T, setAdditionalSyncAddresses as U, setGetPublisherForNewSeeds as V, setPublishExecutor as W, setRevokeExecutor as X, setUploadExecutor as Y, getInvariantSafePropertyDescriptor as Z, clearDestroySubscriptions as _, ItemProperty as a, ClientManagerEvents as a0, withLockedItemStorageRow as a1, getItemStorageFilePath as a2, writeItemStorageFile as a3, resolvePublisherFromSeedRow as a4, getPropertyData$1 as a5, Item$1 as a6, ItemPropertySaveValidationError as b, assertItemOwned as c, waitForEntityIdle as d, compareMetadataRowsLatestFirst as e, getEasSchemaUidForModel as f, getItemData as g, getLatestPublishedVersionRow as h, isItemOwned as i, chunkValues as j, getGetAdditionalSyncAddresses as k, isVersionRevoked as l, createReactiveProxy as m, findEntity as n, forceRemoveFromCaches as o, parseListPropertyValueFromStorage as p, runDestroyLifecycle as q, rowsPerInsert as r, selectInBatches as s, isPublishedMetadataRow as t, MachineIds as u, createNewItem as v, writeInBatches as w, getEasSchemaForItemProperty as x, getGetPublisherForNewSeeds as y, getMetadataLatest as z };
8868
+ //# sourceMappingURL=Item-B1MH0tXx.js.map