@seedprotocol/sdk 0.7.7 → 0.7.8-next.1034.g2acd2a2

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 (195) hide show
  1. package/dist/{ClientManager-2GtDWHq6.js → ClientManager-DBKvmJov.js} +64 -36
  2. package/dist/ClientManager-DBKvmJov.js.map +1 -0
  3. package/dist/{Item-D6j0IvBP.js → Item-BiMHgg-_.js} +539 -486
  4. package/dist/Item-BiMHgg-_.js.map +1 -0
  5. package/dist/{ModelProperty-B52C3CQ2.js → ModelProperty-C1Fzcnbm.js} +50 -51
  6. package/dist/ModelProperty-C1Fzcnbm.js.map +1 -0
  7. package/dist/{Schema-O1QLoXv6.js → Schema-COTbavcm.js} +97 -82
  8. package/dist/Schema-COTbavcm.js.map +1 -0
  9. package/dist/{SchemaValidationService-BxCbfDaI.js → SchemaValidationService-paOfbcwd.js} +6 -6
  10. package/dist/{SchemaValidationService-BxCbfDaI.js.map → SchemaValidationService-paOfbcwd.js.map} +1 -1
  11. package/dist/{backfillMetadataPropertyIds-CzSbuucw.js → backfillMetadataPropertyIds-BkpBahbz.js} +3 -3
  12. package/dist/{backfillMetadataPropertyIds-CzSbuucw.js.map → backfillMetadataPropertyIds-BkpBahbz.js.map} +1 -1
  13. package/dist/{configurePlatform-Bbpw_R4y.js → configurePlatform-_XR45RnJ.js} +2 -2
  14. package/dist/{configurePlatform-Bbpw_R4y.js.map → configurePlatform-_XR45RnJ.js.map} +1 -1
  15. package/dist/{detachRowsBeforeDelete-D1TyEMco.js → detachRowsBeforeDelete-C1iapUFl.js} +2 -2
  16. package/dist/{detachRowsBeforeDelete-D1TyEMco.js.map → detachRowsBeforeDelete-C1iapUFl.js.map} +1 -1
  17. package/dist/{discardNewDraft-hiVaUVjV.js → discardNewDraft-D4nrwp3T.js} +5 -5
  18. package/dist/{discardNewDraft-hiVaUVjV.js.map → discardNewDraft-D4nrwp3T.js.map} +1 -1
  19. package/dist/dist/{ClientManager-2GtDWHq6.d.ts → ClientManager-DBKvmJov.d.ts} +20 -1
  20. package/dist/dist/ClientManager-DBKvmJov.d.ts.map +1 -0
  21. package/dist/dist/{Item-D6j0IvBP.d.ts → Item-BiMHgg-_.d.ts} +146 -85
  22. package/dist/dist/Item-BiMHgg-_.d.ts.map +1 -0
  23. package/dist/dist/{ModelProperty-B52C3CQ2.d.ts → ModelProperty-C1Fzcnbm.d.ts} +1 -1
  24. package/dist/dist/{ModelProperty-B52C3CQ2.d.ts.map → ModelProperty-C1Fzcnbm.d.ts.map} +1 -1
  25. package/dist/dist/{Schema-O1QLoXv6.d.ts → Schema-COTbavcm.d.ts} +11 -4
  26. package/dist/dist/Schema-COTbavcm.d.ts.map +1 -0
  27. package/dist/dist/{SchemaValidationService-BxCbfDaI.d.ts → SchemaValidationService-paOfbcwd.d.ts} +1 -1
  28. package/dist/dist/{SchemaValidationService-BxCbfDaI.d.ts.map → SchemaValidationService-paOfbcwd.d.ts.map} +1 -1
  29. package/dist/dist/{backfillMetadataPropertyIds-CzSbuucw.d.ts → backfillMetadataPropertyIds-BkpBahbz.d.ts} +1 -1
  30. package/dist/dist/backfillMetadataPropertyIds-BkpBahbz.d.ts.map +1 -0
  31. package/dist/dist/{configurePlatform-Bbpw_R4y.d.ts → configurePlatform-_XR45RnJ.d.ts} +1 -1
  32. package/dist/dist/configurePlatform-_XR45RnJ.d.ts.map +1 -0
  33. package/dist/dist/{detachRowsBeforeDelete-D1TyEMco.d.ts → detachRowsBeforeDelete-C1iapUFl.d.ts} +1 -1
  34. package/dist/dist/detachRowsBeforeDelete-C1iapUFl.d.ts.map +1 -0
  35. package/dist/dist/{discardNewDraft-hiVaUVjV.d.ts → discardNewDraft-D4nrwp3T.d.ts} +1 -1
  36. package/dist/dist/discardNewDraft-D4nrwp3T.d.ts.map +1 -0
  37. package/dist/dist/{eas-DOdj-EMK.d.ts → eas-BRVEGT97.d.ts} +1 -1
  38. package/dist/dist/eas-BRVEGT97.d.ts.map +1 -0
  39. package/dist/dist/{errors-KM-yq2MD.d.ts → errors-CQagdED2.d.ts} +39 -24
  40. package/dist/dist/errors-CQagdED2.d.ts.map +1 -0
  41. package/dist/dist/{getItem-Bh0zv-o1.d.ts → getItem-Jpr1SKIL.d.ts} +1 -1
  42. package/dist/dist/getItem-Jpr1SKIL.d.ts.map +1 -0
  43. package/dist/dist/{getPublishPayload-oH8wJhnH.d.ts → getPublishPayload-Bmeqtq4l.d.ts} +1 -1
  44. package/dist/dist/{getPublishPayload-oH8wJhnH.d.ts.map → getPublishPayload-Bmeqtq4l.d.ts.map} +1 -1
  45. package/dist/dist/{getPublishUploads-Cex-NBe6.d.ts → getPublishUploads-7nW1kMZV.d.ts} +1 -1
  46. package/dist/dist/{getPublishUploads-Cex-NBe6.d.ts.map → getPublishUploads-7nW1kMZV.d.ts.map} +1 -1
  47. package/dist/dist/{index-BbFwftAv.d.ts → index-3_hGVu7v.d.ts} +1 -1
  48. package/dist/dist/{index-BbFwftAv.d.ts.map → index-3_hGVu7v.d.ts.map} +1 -1
  49. package/dist/dist/{index-DpgQMIRq.d.ts → index-C-NqjjY_.d.ts} +11 -5
  50. package/dist/dist/index-C-NqjjY_.d.ts.map +1 -0
  51. package/dist/dist/{index-BAao3_Po.d.ts → index-DM3zrNtX.d.ts} +5 -5
  52. package/dist/dist/index-DM3zrNtX.d.ts.map +1 -0
  53. package/dist/dist/{index.browser-nndbVM7z.d.ts → index.browser-DGoOSs1J.d.ts} +1 -1
  54. package/dist/dist/{index.browser-nndbVM7z.d.ts.map → index.browser-DGoOSs1J.d.ts.map} +1 -1
  55. package/dist/dist/{index.node-BUfx-JaP.d.ts → index.node-CTv62R2a.d.ts} +1 -1
  56. package/dist/dist/{index.node-BUfx-JaP.d.ts.map → index.node-CTv62R2a.d.ts.map} +1 -1
  57. package/dist/dist/platform.browser.d.ts +2 -2
  58. package/dist/dist/platform.node.d.ts +2 -2
  59. package/dist/dist/{property-BDBvImLs.d.ts → property-DaUy4XMe.d.ts} +3 -3
  60. package/dist/dist/property-DaUy4XMe.d.ts.map +1 -0
  61. package/dist/dist/{propertyValidationRules-BlfLn4rP.d.ts → propertyValidationRules-DbbWvBzj.d.ts} +1 -1
  62. package/dist/dist/propertyValidationRules-DbbWvBzj.d.ts.map +1 -0
  63. package/dist/dist/{publishDraftGraph-CLO85LLz.d.ts → publishDraftGraph-CCa6EzeO.d.ts} +1 -1
  64. package/dist/dist/{publishDraftGraph-CLO85LLz.d.ts.map → publishDraftGraph-CCa6EzeO.d.ts.map} +1 -1
  65. package/dist/dist/{resetAmbiguousLegacyItemData-Cy8ik7xk.d.ts → resetAmbiguousLegacyItemData--PN1v53N.d.ts} +1 -1
  66. package/dist/dist/resetAmbiguousLegacyItemData--PN1v53N.d.ts.map +1 -0
  67. package/dist/dist/{resolveModelForSyncedSeed-DFr4COc4.d.ts → resolveModelForSyncedSeed-VDzkS6Rs.d.ts} +1 -1
  68. package/dist/dist/resolveModelForSyncedSeed-VDzkS6Rs.d.ts.map +1 -0
  69. package/dist/dist/{syncDbWithEas-CAOlw3i-.d.ts → syncDbWithEas-D0gyJ58h.d.ts} +1 -1
  70. package/dist/dist/syncDbWithEas-D0gyJ58h.d.ts.map +1 -0
  71. package/dist/dist/{tabEvents-DksXwk3X.d.ts → tabEvents-UH-wNsZC.d.ts} +7 -4
  72. package/dist/dist/tabEvents-UH-wNsZC.d.ts.map +1 -0
  73. package/dist/dist/{tolerantWebAccess-CEIjFGf0.d.ts → tolerantWebAccess-CpcTCAZv.d.ts} +1 -1
  74. package/dist/dist/{tolerantWebAccess-CEIjFGf0.d.ts.map → tolerantWebAccess-CpcTCAZv.d.ts.map} +1 -1
  75. package/dist/dist/{updateSeedRevokedAt-Cjr35YjE.d.ts → updateSeedRevokedAt-D230zfWk.d.ts} +1 -1
  76. package/dist/dist/updateSeedRevokedAt-D230zfWk.d.ts.map +1 -0
  77. package/dist/{eas-DOdj-EMK.js → eas-BRVEGT97.js} +4 -4
  78. package/dist/{eas-DOdj-EMK.js.map → eas-BRVEGT97.js.map} +1 -1
  79. package/dist/{errors-KM-yq2MD.js → errors-CQagdED2.js} +222 -275
  80. package/dist/errors-CQagdED2.js.map +1 -0
  81. package/dist/{getItem-Bh0zv-o1.js → getItem-Jpr1SKIL.js} +4 -4
  82. package/dist/{getItem-Bh0zv-o1.js.map → getItem-Jpr1SKIL.js.map} +1 -1
  83. package/dist/{getPublishPayload-oH8wJhnH.js → getPublishPayload-Bmeqtq4l.js} +15 -15
  84. package/dist/{getPublishPayload-oH8wJhnH.js.map → getPublishPayload-Bmeqtq4l.js.map} +1 -1
  85. package/dist/{getPublishUploads-Cex-NBe6.js → getPublishUploads-7nW1kMZV.js} +6 -6
  86. package/dist/{getPublishUploads-Cex-NBe6.js.map → getPublishUploads-7nW1kMZV.js.map} +1 -1
  87. package/dist/{index-BbFwftAv.js → index-3_hGVu7v.js} +2 -2
  88. package/dist/index-3_hGVu7v.js.map +1 -0
  89. package/dist/{index-DpgQMIRq.js → index-C-NqjjY_.js} +18 -3
  90. package/dist/index-C-NqjjY_.js.map +1 -0
  91. package/dist/{index-BAao3_Po.js → index-DM3zrNtX.js} +8 -8
  92. package/dist/index-DM3zrNtX.js.map +1 -0
  93. package/dist/{index.browser-nndbVM7z.js → index.browser-DGoOSs1J.js} +27 -18
  94. package/dist/index.browser-DGoOSs1J.js.map +1 -0
  95. package/dist/{index.node-BUfx-JaP.js → index.node-CTv62R2a.js} +6 -6
  96. package/dist/{index.node-BUfx-JaP.js.map → index.node-CTv62R2a.js.map} +1 -1
  97. package/dist/main.js +24 -24
  98. package/dist/node.js +11 -11
  99. package/dist/platform.browser.js +5 -5
  100. package/dist/platform.node.js +4 -4
  101. package/dist/{property-BDBvImLs.js → property-DaUy4XMe.js} +9 -11
  102. package/dist/property-DaUy4XMe.js.map +1 -0
  103. package/dist/{propertyValidationRules-BlfLn4rP.js → propertyValidationRules-DbbWvBzj.js} +10 -10
  104. package/dist/{propertyValidationRules-BlfLn4rP.js.map → propertyValidationRules-DbbWvBzj.js.map} +1 -1
  105. package/dist/{publishDraftGraph-CLO85LLz.js → publishDraftGraph-CCa6EzeO.js} +6 -6
  106. package/dist/{publishDraftGraph-CLO85LLz.js.map → publishDraftGraph-CCa6EzeO.js.map} +1 -1
  107. package/dist/{resetAmbiguousLegacyItemData-Cy8ik7xk.js → resetAmbiguousLegacyItemData--PN1v53N.js} +2 -2
  108. package/dist/{resetAmbiguousLegacyItemData-Cy8ik7xk.js.map → resetAmbiguousLegacyItemData--PN1v53N.js.map} +1 -1
  109. package/dist/{resolveModelForSyncedSeed-DFr4COc4.js → resolveModelForSyncedSeed-VDzkS6Rs.js} +2 -2
  110. package/dist/{resolveModelForSyncedSeed-DFr4COc4.js.map → resolveModelForSyncedSeed-VDzkS6Rs.js.map} +1 -1
  111. package/dist/src/Item/Item.d.ts +23 -6
  112. package/dist/src/Item/Item.d.ts.map +1 -1
  113. package/dist/src/Item/service/itemMachineSingle.d.ts.map +1 -1
  114. package/dist/src/ItemProperty/ItemProperty.d.ts +38 -6
  115. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  116. package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
  117. package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +1 -1
  118. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  119. package/dist/src/Model/Model.d.ts +50 -9
  120. package/dist/src/Model/Model.d.ts.map +1 -1
  121. package/dist/src/Model/service/actors/validateModel.d.ts.map +1 -1
  122. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  123. package/dist/src/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
  124. package/dist/src/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
  125. package/dist/src/Schema/Schema.d.ts +22 -3
  126. package/dist/src/Schema/Schema.d.ts.map +1 -1
  127. package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +1 -1
  128. package/dist/src/Schema/service/actors/createModelInstances.d.ts.map +1 -1
  129. package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
  130. package/dist/src/browser/db/Db.d.ts.map +1 -1
  131. package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
  132. package/dist/src/client/ClientManager.d.ts +13 -0
  133. package/dist/src/client/ClientManager.d.ts.map +1 -1
  134. package/dist/src/helpers/entity/entityCache.d.ts +2 -42
  135. package/dist/src/helpers/entity/entityCache.d.ts.map +1 -1
  136. package/dist/src/helpers/entity/entityCommon.d.ts +9 -0
  137. package/dist/src/helpers/entity/entityCommon.d.ts.map +1 -1
  138. package/dist/src/helpers/entity/entityDestroy.d.ts +13 -7
  139. package/dist/src/helpers/entity/entityDestroy.d.ts.map +1 -1
  140. package/dist/src/helpers/entity/entityLiveQuery.d.ts +3 -2
  141. package/dist/src/helpers/entity/entityLiveQuery.d.ts.map +1 -1
  142. package/dist/src/helpers/entity/entityState.d.ts +28 -0
  143. package/dist/src/helpers/entity/entityState.d.ts.map +1 -0
  144. package/dist/src/helpers/entity/entityUnload.d.ts +3 -2
  145. package/dist/src/helpers/entity/entityUnload.d.ts.map +1 -1
  146. package/dist/src/helpers/entity/index.d.ts +1 -0
  147. package/dist/src/helpers/entity/index.d.ts.map +1 -1
  148. package/dist/src/helpers/metadataPropertyNames.d.ts +6 -0
  149. package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
  150. package/dist/src/helpers/property.d.ts.map +1 -1
  151. package/dist/src/helpers/reactiveProxy.d.ts +18 -0
  152. package/dist/src/helpers/reactiveProxy.d.ts.map +1 -1
  153. package/dist/src/helpers/sessionObjectUrls.d.ts +4 -0
  154. package/dist/src/helpers/sessionObjectUrls.d.ts.map +1 -0
  155. package/dist/src/imports/json.d.ts.map +1 -1
  156. package/dist/{syncDbWithEas-CAOlw3i-.js → syncDbWithEas-D0gyJ58h.js} +19 -19
  157. package/dist/syncDbWithEas-D0gyJ58h.js.map +1 -0
  158. package/dist/{tabEvents-DksXwk3X.js → tabEvents-UH-wNsZC.js} +24 -7
  159. package/dist/tabEvents-UH-wNsZC.js.map +1 -0
  160. package/dist/{tolerantWebAccess-CEIjFGf0.js → tolerantWebAccess-CpcTCAZv.js} +6 -6
  161. package/dist/{tolerantWebAccess-CEIjFGf0.js.map → tolerantWebAccess-CpcTCAZv.js.map} +1 -1
  162. package/dist/{updateSeedRevokedAt-Cjr35YjE.js → updateSeedRevokedAt-D230zfWk.js} +3 -3
  163. package/dist/{updateSeedRevokedAt-Cjr35YjE.js.map → updateSeedRevokedAt-D230zfWk.js.map} +1 -1
  164. package/package.json +6 -6
  165. package/dist/ClientManager-2GtDWHq6.js.map +0 -1
  166. package/dist/Item-D6j0IvBP.js.map +0 -1
  167. package/dist/ModelProperty-B52C3CQ2.js.map +0 -1
  168. package/dist/Schema-O1QLoXv6.js.map +0 -1
  169. package/dist/dist/ClientManager-2GtDWHq6.d.ts.map +0 -1
  170. package/dist/dist/Item-D6j0IvBP.d.ts.map +0 -1
  171. package/dist/dist/Schema-O1QLoXv6.d.ts.map +0 -1
  172. package/dist/dist/backfillMetadataPropertyIds-CzSbuucw.d.ts.map +0 -1
  173. package/dist/dist/configurePlatform-Bbpw_R4y.d.ts.map +0 -1
  174. package/dist/dist/detachRowsBeforeDelete-D1TyEMco.d.ts.map +0 -1
  175. package/dist/dist/discardNewDraft-hiVaUVjV.d.ts.map +0 -1
  176. package/dist/dist/eas-DOdj-EMK.d.ts.map +0 -1
  177. package/dist/dist/errors-KM-yq2MD.d.ts.map +0 -1
  178. package/dist/dist/getItem-Bh0zv-o1.d.ts.map +0 -1
  179. package/dist/dist/index-BAao3_Po.d.ts.map +0 -1
  180. package/dist/dist/index-DpgQMIRq.d.ts.map +0 -1
  181. package/dist/dist/property-BDBvImLs.d.ts.map +0 -1
  182. package/dist/dist/propertyValidationRules-BlfLn4rP.d.ts.map +0 -1
  183. package/dist/dist/resetAmbiguousLegacyItemData-Cy8ik7xk.d.ts.map +0 -1
  184. package/dist/dist/resolveModelForSyncedSeed-DFr4COc4.d.ts.map +0 -1
  185. package/dist/dist/syncDbWithEas-CAOlw3i-.d.ts.map +0 -1
  186. package/dist/dist/tabEvents-DksXwk3X.d.ts.map +0 -1
  187. package/dist/dist/updateSeedRevokedAt-Cjr35YjE.d.ts.map +0 -1
  188. package/dist/errors-KM-yq2MD.js.map +0 -1
  189. package/dist/index-BAao3_Po.js.map +0 -1
  190. package/dist/index-BbFwftAv.js.map +0 -1
  191. package/dist/index-DpgQMIRq.js.map +0 -1
  192. package/dist/index.browser-nndbVM7z.js.map +0 -1
  193. package/dist/property-BDBvImLs.js.map +0 -1
  194. package/dist/syncDbWithEas-CAOlw3i-.js.map +0 -1
  195. package/dist/tabEvents-DksXwk3X.js.map +0 -1
@@ -1,13 +1,13 @@
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, i as isDataType, 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, 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-DpgQMIRq.js';
2
+ import { B as BaseDb, F as versions, m as metadata, C as seeds, G as resolveStorageNameToSchemaName, a$ as toSchemaPropertyName, i as isDataType, A as schemas, t as models, r as modelSchemas, aZ as getOwnedAddressesFromDb, a2 as ZERO_BYTES32, aF as normalizeAddressList, ai as normalizeHexAddress, aC as getAddressesForItemsFilter, a6 as INTERNAL_PROPERTY_NAMES, b0 as easSchemaDefinitionForProperty, h as BaseFileManager, b1 as getStorageTransactionIdForSeedUid, b2 as convertTxIdToImage, ac 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, ah 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, aj 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 toItemPropertyKey, bc as getAlternatePropertyNameForInstanceLookup, a7 as isStorageSeedRef } from './index-C-NqjjY_.js';
3
3
  import { or, isNull, eq, max, count, and, getTableColumns, sql, desc, inArray, gt, isNotNull } from 'drizzle-orm';
4
4
  import pluralize from 'pluralize';
5
5
  import debug from 'debug';
6
6
  import { BehaviorSubject } from 'rxjs';
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
+ import { c as createSessionObjectUrl, f as notifyFileSaved, g as withTabLock, r as revokeSessionObjectUrl, h as isSessionObjectUrl } from './tabEvents-UH-wNsZC.js';
9
10
  import { fetchArweaveRawTextAcrossGateways } from '@seedprotocol/arweave';
10
- import { d as notifyFileSaved, f as withTabLock } from './tabEvents-DksXwk3X.js';
11
11
  import { modelPropertiesToObject } from './model-oHA3YhOd.js';
12
12
 
13
13
  /**
@@ -144,6 +144,29 @@ var publishConfig = /*#__PURE__*/Object.freeze({
144
144
  setUploadExecutor: setUploadExecutor
145
145
  });
146
146
 
147
+ /**
148
+ * Common getters and utilities for entity classes
149
+ * These work with any entity that has a getService() method returning an XState actor
150
+ */
151
+ /**
152
+ * Get the current state value from an entity's service
153
+ */
154
+ /**
155
+ * Whether two references are the same entity: an instance and its reactive proxy are different
156
+ * objects that share one actor.
157
+ */
158
+ function sameEntity(a, b) {
159
+ return a === b || a.getService() === b.getService();
160
+ }
161
+ /**
162
+ * Whether an actor has been stopped (unload, destroy, or Schema eviction). Async work started by an
163
+ * entity (DB lookups, retry timers) must check this before sending, since a stopped actor ignores
164
+ * events and XState warns about every one of them.
165
+ */
166
+ function isActorStopped(actor) {
167
+ return actor.getSnapshot().status === 'stopped';
168
+ }
169
+
147
170
  /**
148
171
  * Proxy [[GetOwnProperty]] that stays compatible with the target.
149
172
  * Never overrides an own descriptor, never invents on a non-extensible target,
@@ -180,7 +203,7 @@ function getInvariantSafePropertyDescriptor(target, prop, invent) {
180
203
  * The Proxy implementation preserves all methods via Reflect.get, so this is safe.
181
204
  */
182
205
  function createReactiveProxy(config) {
183
- const { instance, trackedProperties, getContext, sendUpdate } = config;
206
+ const { instance, trackedProperties, getContext, sendUpdate, resolve, virtualKeys, onSet } = config;
184
207
  // Convert readonly array to regular array for includes() checks
185
208
  const trackedPropsSet = new Set(trackedProperties);
186
209
  // Create the proxy - TypeScript needs explicit type assertion to preserve all methods
@@ -198,6 +221,9 @@ function createReactiveProxy(config) {
198
221
  const context = getContext(instance);
199
222
  return context[prop];
200
223
  }
224
+ const virtual = typeof prop === 'string' ? resolve?.(instance, prop) : undefined;
225
+ if (virtual)
226
+ return virtual.get();
201
227
  // For methods and non-tracked properties, use Reflect
202
228
  return Reflect.get(target, prop);
203
229
  },
@@ -211,10 +237,15 @@ function createReactiveProxy(config) {
211
237
  sendUpdate(instance, prop, value);
212
238
  return true; // Indicate success
213
239
  }
214
- // For non-tracked properties, use Reflect. Also trigger sendUpdate for virtual
215
- // 'value' so the callback runs when .value is assigned (e.g. ItemProperty).
216
- if (typeof prop === 'string' && prop === 'value') {
217
- sendUpdate(instance, prop, value);
240
+ if (typeof prop === 'string') {
241
+ const virtual = resolve?.(instance, prop);
242
+ if (virtual) {
243
+ if (!virtual.set)
244
+ throw new TypeError(`Cannot set ${prop}: it is read-only.`);
245
+ virtual.set(value);
246
+ return true;
247
+ }
248
+ onSet?.(instance, prop, value);
218
249
  }
219
250
  return Reflect.set(target, prop, value);
220
251
  },
@@ -224,14 +255,19 @@ function createReactiveProxy(config) {
224
255
  const context = getContext(instance);
225
256
  return prop in context;
226
257
  }
258
+ if (typeof prop === 'string' && resolve?.(instance, prop))
259
+ return true;
227
260
  return Reflect.has(target, prop);
228
261
  },
229
262
  ownKeys(target) {
230
- // Only return keys that actually exist on the target object
231
- // This is required when the target is non-extensible (e.g., frozen by Immer)
232
- // Tracked properties are virtual (read from context), so we don't include them here
233
- // They're accessible via the get trap, but don't appear in ownKeys
234
- return Reflect.ownKeys(target);
263
+ // Tracked properties are virtual (read from context), so we don't include them here.
264
+ // They're accessible via the get trap, but don't appear in ownKeys. Resolved names do, when
265
+ // the target is extensible (a non-extensible one, e.g. frozen by Immer, can't report them).
266
+ const keys = Reflect.ownKeys(target);
267
+ if (!virtualKeys || !Object.isExtensible(target))
268
+ return keys;
269
+ const extra = virtualKeys(instance).filter((key) => !keys.includes(key));
270
+ return extra.length > 0 ? [...keys, ...extra] : keys;
235
271
  },
236
272
  getOwnPropertyDescriptor(target, prop) {
237
273
  let invent;
@@ -241,6 +277,11 @@ function createReactiveProxy(config) {
241
277
  invent = { value: context[prop] };
242
278
  }
243
279
  }
280
+ else if (typeof prop === 'string') {
281
+ const virtual = resolve?.(instance, prop);
282
+ if (virtual)
283
+ invent = { value: virtual.get(), writable: !!virtual.set };
284
+ }
244
285
  return getInvariantSafePropertyDescriptor(target, prop, invent);
245
286
  }
246
287
  });
@@ -580,8 +621,8 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
580
621
  const itemPropertyMod = await Promise.resolve().then(function () { return ItemProperty$1; });
581
622
  const { ItemProperty } = itemPropertyMod;
582
623
  const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
583
- const _mod_0 = await import('./errors-KM-yq2MD.js');
584
- const _ns_0 = _mod_0.j;
624
+ const _mod_0 = await import('./errors-CQagdED2.js');
625
+ const _ns_0 = _mod_0.i;
585
626
  const { Model } = _ns_0;
586
627
  // Resolve Model and build property schemas (use getByNameAsync for models not yet in cache)
587
628
  let propertySchemas = {};
@@ -598,10 +639,10 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
598
639
  const schemaNameToTry = schemaName ?? model?.schemaName;
599
640
  if (schemaNameToTry) {
600
641
  try {
601
- const _mod_1 = await import('./Schema-O1QLoXv6.js');
642
+ const _mod_1 = await import('./Schema-COTbavcm.js');
602
643
  const _ns_1 = _mod_1.b;
603
644
  const { Schema } = _ns_1;
604
- const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false });
645
+ const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false, hold: false });
605
646
  const schemaContext = schemaInstance.getService().getSnapshot().context;
606
647
  if (schemaContext.models?.[modelName]?.properties) {
607
648
  propertySchemas = schemaContext.models[modelName].properties;
@@ -614,7 +655,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
614
655
  }
615
656
  if (Object.keys(propertySchemas).length === 0) {
616
657
  try {
617
- const _mod_2 = await import('./ClientManager-2GtDWHq6.js');
658
+ const _mod_2 = await import('./ClientManager-DBKvmJov.js');
618
659
  const _ns_2 = _mod_2.N;
619
660
  const { loadAllSchemasFromDb } = _ns_2;
620
661
  const allSchemas = await loadAllSchemasFromDb();
@@ -635,11 +676,11 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
635
676
  }
636
677
  if (Object.keys(propertySchemas).length === 0) {
637
678
  try {
638
- const _mod_3 = await import('./ClientManager-2GtDWHq6.js');
679
+ const _mod_3 = await import('./ClientManager-DBKvmJov.js');
639
680
  const _ns_3 = _mod_3.N;
640
681
  const { listCompleteSchemaFiles } = _ns_3;
641
- const _mod_4 = await import('./index-DpgQMIRq.js');
642
- const _ns_4 = _mod_4.be;
682
+ const _mod_4 = await import('./index-C-NqjjY_.js');
683
+ const _ns_4 = _mod_4.bf;
643
684
  const { BaseFileManager } = _ns_4;
644
685
  const schemaFiles = await listCompleteSchemaFiles();
645
686
  for (const { filePath } of schemaFiles) {
@@ -659,7 +700,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
659
700
  }
660
701
  }
661
702
  if (Object.keys(propertySchemas).length === 0) {
662
- const schemaMod = await import('./index-BAao3_Po.js');
703
+ const schemaMod = await import('./index-DM3zrNtX.js');
663
704
  const { ModelPropertyDataTypes } = schemaMod;
664
705
  const KNOWN_MODEL_FALLBACKS = {
665
706
  Post: {
@@ -676,7 +717,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
676
717
  }
677
718
  }
678
719
  // Fallbacks above may return schema-file shape ({ type, model, items }); normalize to dataType/ref/refValueType.
679
- const { normalizePropertyRecordSchema } = await import('./property-BDBvImLs.js');
720
+ const { normalizePropertyRecordSchema } = await import('./property-DaUy4XMe.js');
680
721
  propertySchemas = Object.fromEntries(Object.entries(propertySchemas).map(([name, def]) => [name, normalizePropertyRecordSchema(def)]));
681
722
  // Collapse rows that map to the same instance key (e.g. authorIdentityIds + authors -> authors).
682
723
  // ItemProperty.create cache does not sync propertyValue on hit; processing order would otherwise
@@ -709,7 +750,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
709
750
  // Infer propertyRecordSchema from metadata when schema is missing (enables persistence)
710
751
  let propSchema = propertySchemas[propertyName];
711
752
  if (!propSchema && isRefTypeFromMeta) {
712
- const schemaMod = await import('./index-BAao3_Po.js');
753
+ const schemaMod = await import('./index-DM3zrNtX.js');
713
754
  const { ModelPropertyDataTypes } = schemaMod;
714
755
  propSchema = {
715
756
  dataType: refSeedType === 'html' ? ModelPropertyDataTypes.Html
@@ -739,7 +780,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
739
780
  : metaRow.refResolvedDisplayValue ?? undefined,
740
781
  localStorageDir: metaRow.localStorageDir ?? undefined,
741
782
  };
742
- const property = ItemProperty.create(createProps, { waitForReady: false });
783
+ const property = ItemProperty.create(createProps, { waitForReady: false, hold: false });
743
784
  if (property) {
744
785
  propertyInstances.set(propertyName, property);
745
786
  logger$9(`Created/cached ItemProperty instance for propertyName "${propertyName}" with propertyRecordSchema: ${!!createProps.propertyRecordSchema}`);
@@ -769,7 +810,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
769
810
  schemaUid: undefined,
770
811
  propertyRecordSchema: propSchema,
771
812
  };
772
- const property = ItemProperty.create(createProps, { waitForReady: false });
813
+ const property = ItemProperty.create(createProps, { waitForReady: false, hold: false });
773
814
  if (property) {
774
815
  propertyInstances.set(propertyName, property);
775
816
  logger$9(`Created placeholder ItemProperty for model property "${propertyName}" (no metadata)`);
@@ -1026,7 +1067,7 @@ const itemMachineSingle = setup({
1026
1067
  },
1027
1068
  updateProperties: {
1028
1069
  actions: assign({
1029
- propertiesUpdatedAt: Date.now(),
1070
+ propertiesUpdatedAt: () => Date.now(),
1030
1071
  }),
1031
1072
  },
1032
1073
  updateValue: {
@@ -1070,9 +1111,11 @@ const itemMachineSingle = setup({
1070
1111
  },
1071
1112
  updateContext: {
1072
1113
  actions: assign(({ context, event }) => {
1114
+ // Every key the event carries: one sent before loading sets it (revokedAt, versionsCount,
1115
+ // createdAt) must not be dropped because the context doesn't have it yet.
1073
1116
  const updates = {};
1074
1117
  for (const key in event) {
1075
- if (key !== 'type' && key in context) {
1118
+ if (key !== 'type') {
1076
1119
  updates[key] = event[key];
1077
1120
  }
1078
1121
  }
@@ -1715,8 +1758,8 @@ const getItemsData = async ({ modelName, modelFileId, schemaName, deleted, inclu
1715
1758
  conditions.push(eq(seeds.type, easName(modelName)));
1716
1759
  }
1717
1760
  if (!modelFileId && schemaName && modelName) {
1718
- const _mod_5 = await import('./index-DpgQMIRq.js');
1719
- const _ns_5 = _mod_5.bh;
1761
+ const _mod_5 = await import('./index-C-NqjjY_.js');
1762
+ const _ns_5 = _mod_5.bi;
1720
1763
  const { resolveModelRecord } = _ns_5;
1721
1764
  modelFileId = (await resolveModelRecord(modelName, { schemaName }))?.schemaFileId ?? undefined;
1722
1765
  if (!modelFileId)
@@ -2001,7 +2044,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
2001
2044
  const { isRelation, propertyValue, propertyName, propertyRecordSchema, populatedFromDb, } = context;
2002
2045
  const _resolveRelatedValue = async () => {
2003
2046
  // Use dynamic import to break circular dependency
2004
- const schemaMod = await import('./index-BAao3_Po.js');
2047
+ const schemaMod = await import('./index-DM3zrNtX.js');
2005
2048
  const { ModelPropertyDataTypes } = schemaMod;
2006
2049
  if (!propertyValue || !isRelation || populatedFromDb) {
2007
2050
  return;
@@ -2436,8 +2479,8 @@ async function readHtmlBodyFromChildStorageArweave(seedLocalId) {
2436
2479
  /* offline / bad tx id */
2437
2480
  }
2438
2481
  try {
2439
- const _mod_6 = await import('./index-DpgQMIRq.js');
2440
- const _ns_6 = _mod_6.bj;
2482
+ const _mod_6 = await import('./index-C-NqjjY_.js');
2483
+ const _ns_6 = _mod_6.bk;
2441
2484
  const { downloadTransactionIdWithDedupe } = _ns_6;
2442
2485
  await downloadTransactionIdWithDedupe(txId);
2443
2486
  const retryFp = BaseFileManager.getFilesPath('html', `${seedLocalId}.html`);
@@ -2497,7 +2540,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
2497
2540
  // to use dynamically imported ModelPropertyDataTypes
2498
2541
  const _hydrateFromDb = async () => {
2499
2542
  // Use dynamic import to break circular dependency
2500
- const schemaMod = await import('./index-BAao3_Po.js');
2543
+ const schemaMod = await import('./index-DM3zrNtX.js');
2501
2544
  const { ModelPropertyDataTypes } = schemaMod;
2502
2545
  const appDb = BaseDb.getAppDb();
2503
2546
  const whereClauses = [];
@@ -2598,7 +2641,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
2598
2641
  localStorageDir = `/${dir}`;
2599
2642
  if (filePath) {
2600
2643
  const file = await BaseFileManager.readFile(filePath);
2601
- refResolvedDisplayValue = URL.createObjectURL(file);
2644
+ refResolvedDisplayValue = createSessionObjectUrl(file);
2602
2645
  renderValue = refResolvedDisplayValue;
2603
2646
  // Do not persist blob URL - it is session-scoped
2604
2647
  }
@@ -2779,12 +2822,12 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
2779
2822
  const modelNameForNew = context.modelName;
2780
2823
  if (modelNameForNew) {
2781
2824
  try {
2782
- const _mod_7 = await import('./errors-KM-yq2MD.js');
2783
- const _ns_7 = _mod_7.j;
2825
+ const _mod_7 = await import('./errors-CQagdED2.js');
2826
+ const _ns_7 = _mod_7.i;
2784
2827
  const { Model } = _ns_7;
2785
2828
  const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
2786
- const _mod_8 = await import('./index-DpgQMIRq.js');
2787
- const _ns_8 = _mod_8.bh;
2829
+ const _mod_8 = await import('./index-C-NqjjY_.js');
2830
+ const _ns_8 = _mod_8.bi;
2788
2831
  const { resolveItemModelFileId } = _ns_8;
2789
2832
  const normalizedModelName = upperFirst(camelCase(modelNameForNew));
2790
2833
  const itemModelFileId = await resolveItemModelFileId({
@@ -2837,8 +2880,8 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
2837
2880
  // It ends up in the context below, and later lookups by name (Model.getByName) can't match it.
2838
2881
  const modelName = context.modelName || (metadataRecord.modelType ? upperFirst(camelCase(metadataRecord.modelType)) : undefined);
2839
2882
  // Model names are only unique per schema: pin lookups to the item's own model row.
2840
- const _mod_9 = await import('./index-DpgQMIRq.js');
2841
- const _ns_9 = _mod_9.bh;
2883
+ const _mod_9 = await import('./index-C-NqjjY_.js');
2884
+ const _ns_9 = _mod_9.bi;
2842
2885
  const { resolveItemModelFileId, resolveModelRecord } = _ns_9;
2843
2886
  const modelFileId = await resolveItemModelFileId({
2844
2887
  modelFileId: context.modelFileId,
@@ -2882,7 +2925,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
2882
2925
  required: propRecord.required ?? undefined,
2883
2926
  };
2884
2927
  // Validation rules (enum, pattern, ...) aren't in the properties table
2885
- const { resolvePropertyValidationRules } = await import('./propertyValidationRules-BlfLn4rP.js');
2928
+ const { resolvePropertyValidationRules } = await import('./propertyValidationRules-DbbWvBzj.js');
2886
2929
  const validation = await resolvePropertyValidationRules(normalizedModelName, propertyName, {
2887
2930
  modelFileId: modelRecord?.schemaFileId ?? modelFileId,
2888
2931
  });
@@ -2900,8 +2943,8 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
2900
2943
  // Fix 1: Fallback to in-memory Model when DB doesn't have model/properties yet (e.g. runtime-created model)
2901
2944
  if (!propertyRecordSchema && modelName) {
2902
2945
  try {
2903
- const _mod_10 = await import('./errors-KM-yq2MD.js');
2904
- const _ns_10 = _mod_10.j;
2946
+ const _mod_10 = await import('./errors-CQagdED2.js');
2947
+ const _ns_10 = _mod_10.i;
2905
2948
  const { Model } = _ns_10;
2906
2949
  const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
2907
2950
  const normalizedModelName = upperFirst(camelCase(modelName));
@@ -3039,7 +3082,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
3039
3082
  const filePath = await resolveMatchingFilePath(dir, metadataRecord.refResolvedValue);
3040
3083
  if (filePath) {
3041
3084
  const file = await BaseFileManager.readFile(filePath);
3042
- const freshBlobUrl = URL.createObjectURL(file);
3085
+ const freshBlobUrl = createSessionObjectUrl(file);
3043
3086
  renderValue = freshBlobUrl;
3044
3087
  refResolvedDisplayValue = freshBlobUrl;
3045
3088
  }
@@ -3389,9 +3432,9 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
3389
3432
  return false;
3390
3433
  }
3391
3434
  // Use dynamic import to break circular dependency
3392
- const schemaMod = await import('./index-BAao3_Po.js');
3435
+ const schemaMod = await import('./index-DM3zrNtX.js');
3393
3436
  const { ModelPropertyDataTypes } = schemaMod;
3394
- const { SchemaValidationService } = await import('./SchemaValidationService-BxCbfDaI.js');
3437
+ const { SchemaValidationService } = await import('./SchemaValidationService-paOfbcwd.js');
3395
3438
  const propertyName = propertyNameRaw;
3396
3439
  if (!propertyName) {
3397
3440
  throw new Error('propertyName is required');
@@ -3704,7 +3747,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
3704
3747
  propertyRecordSchema?.validation &&
3705
3748
  metadataValues.propertyValue != null &&
3706
3749
  metadataValues.propertyValue !== '') {
3707
- const { SchemaValidationService } = await import('./SchemaValidationService-BxCbfDaI.js');
3750
+ const { SchemaValidationService } = await import('./SchemaValidationService-paOfbcwd.js');
3708
3751
  const validationService = new SchemaValidationService();
3709
3752
  const validationResult = validationService.validatePropertyValue(metadataValues.propertyValue, normalizeDataType(propertyRecordSchema.dataType), propertyRecordSchema.validation, propertyRecordSchema.refValueType
3710
3753
  ? normalizeDataType(String(propertyRecordSchema.refValueType))
@@ -4898,6 +4941,8 @@ const propertyMachine = setup({
4898
4941
  actions: assign({
4899
4942
  isSaving: false,
4900
4943
  _saveValidationErrors: undefined,
4944
+ // Only a refused or failed save restores it; kept after success, it pinned the old value.
4945
+ _valueBeforeSave: undefined,
4901
4946
  }),
4902
4947
  },
4903
4948
  },
@@ -4919,11 +4964,11 @@ const getPropertyData = async ({ propertyName, seedLocalId, seedUid, modelName,
4919
4964
  let names = [...getMetadataPropertyNamesForQuery(propertyName)];
4920
4965
  if (modelName) {
4921
4966
  try {
4922
- const _mod_11 = await import('./errors-KM-yq2MD.js');
4923
- const _ns_11 = _mod_11.j;
4967
+ const _mod_11 = await import('./errors-CQagdED2.js');
4968
+ const _ns_11 = _mod_11.i;
4924
4969
  const { Model } = _ns_11;
4925
- const _mod_12 = await import('./index-DpgQMIRq.js');
4926
- const _ns_12 = _mod_12.bh;
4970
+ const _mod_12 = await import('./index-C-NqjjY_.js');
4971
+ const _ns_12 = _mod_12.bi;
4927
4972
  const { resolveItemModelFileId } = _ns_12;
4928
4973
  // Model names are only unique per schema: use the seed's own model when it is recorded.
4929
4974
  const modelFileId = await resolveItemModelFileId({ seedLocalId, seedUid });
@@ -4979,26 +5024,30 @@ var getPropertyData$1 = /*#__PURE__*/Object.freeze({
4979
5024
  function unloadEntity(instance, config) {
4980
5025
  // Get cache keys for this instance
4981
5026
  const cacheKeys = config.getCacheKeys(instance);
4982
- // Remove from all caches (decrement refCount, delete if 0)
4983
- let stillReferenced = false;
5027
+ // Release one hold per entry. An entry stored under several keys (a name and an id) is one
5028
+ // instance's count: decrement it once, and when it reaches 0 delete every key that holds it.
5029
+ const found = [];
4984
5030
  for (const cache of config.caches) {
4985
5031
  for (const key of cacheKeys) {
4986
5032
  const entry = cache.get(key);
4987
- if (entry) {
4988
- entry.refCount -= 1;
4989
- if (entry.refCount <= 0) {
4990
- cache.delete(key);
4991
- // Also remove from secondary caches if provided
4992
- if (config.secondaryCaches) {
4993
- for (const secondaryCache of config.secondaryCaches) {
4994
- secondaryCache.delete(key);
4995
- }
4996
- }
4997
- }
4998
- else {
4999
- cache.set(key, entry);
5000
- stillReferenced = true;
5001
- }
5033
+ if (entry)
5034
+ found.push({ cache, key, entry });
5035
+ }
5036
+ }
5037
+ const entries = new Set(found.map(({ entry }) => entry));
5038
+ for (const entry of entries)
5039
+ entry.refCount -= 1;
5040
+ let stillReferenced = false;
5041
+ for (const { cache, key, entry } of found) {
5042
+ if (entry.refCount > 0) {
5043
+ stillReferenced = true;
5044
+ continue;
5045
+ }
5046
+ cache.delete(key);
5047
+ // Also remove from secondary caches if provided
5048
+ if (config.secondaryCaches) {
5049
+ for (const secondaryCache of config.secondaryCaches) {
5050
+ secondaryCache.delete(key);
5002
5051
  }
5003
5052
  }
5004
5053
  }
@@ -5041,20 +5090,50 @@ function unloadEntity(instance, config) {
5041
5090
  }
5042
5091
  }
5043
5092
 
5093
+ /**
5094
+ * Per-instance state for an entity (liveQuery subscriptions and the like), keyed by the entity's
5095
+ * actor. An entity's raw instance and its reactive proxy are different objects that share one
5096
+ * actor. State set from the constructor (`this` = raw instance) must be found again from methods
5097
+ * called on the proxy (`this` = proxy), so a WeakMap keyed by the instance misses there.
5098
+ *
5099
+ * `getService()` must return the actor before the first `set`.
5100
+ */
5101
+ class ActorKeyedState {
5102
+ constructor() {
5103
+ this.states = new WeakMap();
5104
+ }
5105
+ get(instance) {
5106
+ return this.states.get(instance.getService());
5107
+ }
5108
+ set(instance, state) {
5109
+ this.states.set(instance.getService(), state);
5110
+ return this;
5111
+ }
5112
+ delete(instance) {
5113
+ return this.states.delete(instance.getService());
5114
+ }
5115
+ has(instance) {
5116
+ return this.states.has(instance.getService());
5117
+ }
5118
+ }
5119
+
5044
5120
  /**
5045
5121
  * Shared helpers for entity destroy operations.
5046
5122
  * Used by Schema, Model, ModelProperty, Item, and ItemProperty destroy() methods.
5047
5123
  */
5048
5124
  /**
5049
- * Unsubscribe liveQuery and any extra subscription (e.g. Item/ItemProperty _subscription).
5050
- * Swallows errors so one failure doesn't block the rest.
5125
+ * Unsubscribe the entity's liveQueries and any extra subscription (e.g. Item/ItemProperty
5126
+ * _subscription). Swallows errors so one failure doesn't block the rest.
5051
5127
  */
5052
5128
  function clearDestroySubscriptions(instance, config) {
5053
5129
  const instanceState = config.instanceState.get(instance);
5054
- if (instanceState?.liveQuerySubscription) {
5130
+ for (const key of ['liveQuerySubscription', 'schemaLiveQuerySubscription']) {
5131
+ const subscription = instanceState?.[key];
5132
+ if (!subscription)
5133
+ continue;
5055
5134
  try {
5056
- instanceState.liveQuerySubscription.unsubscribe();
5057
- instanceState.liveQuerySubscription = null;
5135
+ subscription.unsubscribe();
5136
+ instanceState[key] = null;
5058
5137
  }
5059
5138
  catch {
5060
5139
  // Ignore errors during cleanup
@@ -5123,7 +5202,7 @@ const HTML_PROP_SEED_UID_RE = /^0x[a-fA-F0-9]{64}$/;
5123
5202
  */
5124
5203
  const resolvePropertyRecordSchemaFromSchemaData = async (modelName, propertyName, modelType, schemaName) => {
5125
5204
  try {
5126
- const _mod_13 = await import('./ClientManager-2GtDWHq6.js');
5205
+ const _mod_13 = await import('./ClientManager-DBKvmJov.js');
5127
5206
  const _ns_13 = _mod_13.N;
5128
5207
  const { loadAllSchemasFromDb } = _ns_13;
5129
5208
  const allSchemas = await loadAllSchemasFromDb();
@@ -5177,29 +5256,29 @@ hints = {}) => {
5177
5256
  return undefined;
5178
5257
  }
5179
5258
  try {
5180
- const _mod_14 = await import('./errors-KM-yq2MD.js');
5181
- const _ns_14 = _mod_14.j;
5259
+ const _mod_14 = await import('./errors-CQagdED2.js');
5260
+ const _ns_14 = _mod_14.i;
5182
5261
  const { Model } = _ns_14;
5183
5262
  const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
5184
- const _mod_15 = await import('./index-DpgQMIRq.js');
5185
- const _ns_15 = _mod_15.bh;
5263
+ const _mod_15 = await import('./index-C-NqjjY_.js');
5264
+ const _ns_15 = _mod_15.bi;
5186
5265
  const { resolveItemModelFileId } = _ns_15;
5187
5266
  const modelFileId = await resolveItemModelFileId(hints);
5188
5267
  let model = modelFileId
5189
5268
  ? await Model.resolveAsync(modelName || modelTypeToModelName(modelType ?? ''), { modelFileId })
5190
5269
  : undefined;
5191
5270
  if (!model?.properties?.length && modelName) {
5192
- model = Model.getByName(modelName);
5271
+ model = Model.peekByName(modelName);
5193
5272
  }
5194
5273
  if (!model?.properties?.length && modelType) {
5195
5274
  model = Model.findByModelType(modelType);
5196
5275
  }
5197
5276
  // Fallback: load from DB when not in cache (fixes external app persistence when Model not yet loaded)
5198
5277
  if (!model?.properties?.length && modelName) {
5199
- model = await Model.getByNameAsync(modelName);
5278
+ model = await Model.getByNameAsync(modelName, undefined, { hold: false });
5200
5279
  }
5201
5280
  if (!model?.properties?.length && modelType) {
5202
- model = await Model.getByNameAsync(modelTypeToModelName(modelType));
5281
+ model = await Model.getByNameAsync(modelTypeToModelName(modelType), undefined, { hold: false });
5203
5282
  }
5204
5283
  if (!model?.properties?.length) {
5205
5284
  // Fallback: resolve from schema JSON when Model not in cache/DB (e.g. PermaPress sync failed but schema in DB)
@@ -5244,9 +5323,43 @@ const TRACKED_PROPERTIES$1 = [
5244
5323
  'localId',
5245
5324
  'uid',
5246
5325
  ];
5247
- // WeakMap to store mutable state per ItemProperty instance
5248
- // This avoids issues with read-only properties when instances are frozen by Immer
5249
- const itemPropertyInstanceState = new WeakMap();
5326
+ // SDK-minted blob URLs a property's context has held, by actor (the raw instance and its proxy share
5327
+ // one). An entry no context field references any more is revoked; the rest are revoked on unload.
5328
+ const heldObjectUrls = new WeakMap();
5329
+ const trackHeldObjectUrls = (context, held) => {
5330
+ const referenced = new Set([
5331
+ context.refResolvedDisplayValue,
5332
+ context.renderValue,
5333
+ context.propertyValue,
5334
+ // Restored if the pending save is refused.
5335
+ context._valueBeforeSave?.renderValue,
5336
+ context._valueBeforeSave?.propertyValue,
5337
+ ].filter(isSessionObjectUrl));
5338
+ for (const url of held) {
5339
+ if (!referenced.has(url)) {
5340
+ held.delete(url);
5341
+ revokeSessionObjectUrl(url);
5342
+ }
5343
+ }
5344
+ for (const url of referenced)
5345
+ held.add(url);
5346
+ };
5347
+ const revokeHeldObjectUrls = (service) => {
5348
+ const held = heldObjectUrls.get(service);
5349
+ if (!held)
5350
+ return;
5351
+ for (const url of held)
5352
+ revokeSessionObjectUrl(url);
5353
+ held.clear();
5354
+ };
5355
+ // Mutable state per ItemProperty instance
5356
+ const itemPropertyInstanceState = new ActorKeyedState();
5357
+ /**
5358
+ * Each cached instance's entry in `ItemProperty.instanceCache`, keyed by its actor. Every key the
5359
+ * instance is cached under shares this one entry, so `retain` and the constructor's re-keying find
5360
+ * it without scanning the cache.
5361
+ */
5362
+ const cacheEntries = new WeakMap();
5250
5363
  /** Thrown by ItemProperty.save() when the value failed validation (enum, pattern, minLength, maxLength). */
5251
5364
  class ItemPropertySaveValidationError extends Error {
5252
5365
  constructor(message, validationErrors) {
@@ -5336,25 +5449,34 @@ class ItemProperty {
5336
5449
  this._service = createActor(propertyMachine, {
5337
5450
  input: serviceInput,
5338
5451
  });
5452
+ // Synchronous and reading the latest snapshot: the async subscriber below can run on stale ones.
5453
+ const held = new Set();
5454
+ heldObjectUrls.set(this._service, held);
5455
+ this._service.subscribe(() => trackHeldObjectUrls(this._service.getSnapshot().context, held));
5339
5456
  this._subscription = this._service.subscribe(async (snapshot) => {
5340
5457
  if (!snapshot || !snapshot.context) {
5341
5458
  return;
5342
5459
  }
5343
5460
  // Use dynamic import to break circular dependency
5344
- const schemaMod = await import('./index-BAao3_Po.js');
5461
+ const schemaMod = await import('./index-DM3zrNtX.js');
5345
5462
  const { ModelPropertyDataTypes } = schemaMod;
5346
5463
  const { context } = snapshot;
5347
5464
  const { propertyRecordSchema } = context;
5348
5465
  if (context.seedLocalId && context.propertyName) {
5349
5466
  const cacheKey = ItemProperty.cacheKey(context.seedLocalId, context.propertyName);
5350
- if (!ItemProperty.instanceCache.has(cacheKey)) {
5351
- ItemProperty.instanceCache.set(cacheKey, {
5352
- instance: this,
5353
- refCount: 1,
5354
- });
5467
+ // The context's ids or name can change after create (a seed uid arrives, a List of relation
5468
+ // moves to its storage name): add the new key to this instance's entry. Never a new entry
5469
+ // or count, and nothing once the instance was unloaded (this runs after an await).
5470
+ const entry = cacheEntries.get(this._service);
5471
+ if (entry &&
5472
+ !ItemProperty.instanceCache.has(cacheKey) &&
5473
+ this._service.getSnapshot().status === 'active') {
5474
+ ItemProperty.instanceCache.set(cacheKey, entry);
5355
5475
  }
5356
5476
  }
5357
5477
  let renderValue;
5478
+ // Set when this pass minted the display URL; stored with it so the next pass reuses it.
5479
+ let mintedDisplayValue;
5358
5480
  const isImage = propertyRecordSchema &&
5359
5481
  isDataType(propertyRecordSchema.dataType, ModelPropertyDataTypes.Image);
5360
5482
  const isFile = propertyRecordSchema &&
@@ -5384,7 +5506,7 @@ class ItemProperty {
5384
5506
  if (isImage && !context.refResolvedValue && (isFileValue || isBlobValue)) {
5385
5507
  const fileOrBlob = pv;
5386
5508
  const fileName = fileOrBlob instanceof File ? fileOrBlob.name : 'image';
5387
- const blobUrl = URL.createObjectURL(fileOrBlob);
5509
+ const blobUrl = createSessionObjectUrl(fileOrBlob);
5388
5510
  this._service.send({
5389
5511
  type: 'updateContext',
5390
5512
  refResolvedValue: fileName,
@@ -5414,15 +5536,17 @@ class ItemProperty {
5414
5536
  renderValue = context.refResolvedDisplayValue;
5415
5537
  }
5416
5538
  if (!context.refResolvedDisplayValue) {
5417
- renderValue = await BaseFileManager.getContentUrlFromPath(filePath);
5539
+ renderValue = mintedDisplayValue = await BaseFileManager.getContentUrlFromPath(filePath);
5418
5540
  }
5419
5541
  }
5420
5542
  if (exists && isFile) {
5421
5543
  // A File's value is its content URL (a blob URL in browsers, file:// in Node), as saveFile
5422
5544
  // and hydrateFromDb set it. Reading the text here made the value change from the URL to
5423
5545
  // the file's contents a moment after every save or load.
5424
- renderValue =
5425
- context.refResolvedDisplayValue ?? (await BaseFileManager.getContentUrlFromPath(filePath));
5546
+ renderValue = context.refResolvedDisplayValue;
5547
+ if (!renderValue) {
5548
+ renderValue = mintedDisplayValue = await BaseFileManager.getContentUrlFromPath(filePath);
5549
+ }
5426
5550
  }
5427
5551
  if (!exists) {
5428
5552
  // Keep filename for display when File object is present but not yet saved to disk
@@ -5466,16 +5590,25 @@ class ItemProperty {
5466
5590
  transformedPropertyName = this._alias;
5467
5591
  }
5468
5592
  if (skipTransform && !this._alias) ;
5593
+ // The context moved on while this pass awaited; the pass for the newer snapshot decides.
5594
+ // Sending here put back values (and revoked URLs) that the newer pass had replaced.
5595
+ if (this._service.getSnapshot().context !== context) {
5596
+ if (mintedDisplayValue)
5597
+ revokeSessionObjectUrl(mintedDisplayValue);
5598
+ return;
5599
+ }
5469
5600
  // Update context with renderValue instead of BehaviorSubject
5470
5601
  // The reactive proxy will handle reactivity
5471
5602
  const currentRenderValue = context.renderValue || context.propertyValue;
5472
5603
  if (currentRenderValue === renderValue) {
5473
5604
  return;
5474
5605
  }
5475
- // Update context with new renderValue
5606
+ // Update context with new renderValue. A minted URL goes into refResolvedDisplayValue too:
5607
+ // sent as renderValue alone, the next pass minted another, and so on about 60 times a second.
5476
5608
  this._service.send({
5477
5609
  type: 'updateContext',
5478
5610
  renderValue,
5611
+ ...(mintedDisplayValue ? { refResolvedDisplayValue: mintedDisplayValue } : {}),
5479
5612
  });
5480
5613
  });
5481
5614
  this._service.start();
@@ -5518,6 +5651,8 @@ class ItemProperty {
5518
5651
  // File and Image display values are session URLs minted from the file on disk; the column holds
5519
5652
  // nothing useful for them (older versions stored blob: URLs that die on reload). Keep the minted
5520
5653
  // one unless the row now points at a different file, then clear it so the next render mints anew.
5654
+ // A kept URL is also the renderValue: the row's propertyValue (the storage seed id) showed for a
5655
+ // moment on every write to the metadata table, then the subscriber put the URL back.
5521
5656
  const displayValueFromRow = (row) => {
5522
5657
  const { context } = this._service.getSnapshot();
5523
5658
  const isSessionUrlType = normalizedDataType === 'Image' ||
@@ -5528,8 +5663,9 @@ class ItemProperty {
5528
5663
  if (!isSessionUrlType) {
5529
5664
  return { refResolvedDisplayValue: row.refResolvedDisplayValue || undefined };
5530
5665
  }
5531
- if ((row.refResolvedValue || undefined) === context.refResolvedValue)
5532
- return {};
5666
+ if ((row.refResolvedValue || undefined) === context.refResolvedValue) {
5667
+ return context.refResolvedDisplayValue ? { renderValue: context.refResolvedDisplayValue } : {};
5668
+ }
5533
5669
  return { refResolvedDisplayValue: undefined };
5534
5670
  };
5535
5671
  const drizzleMod = await import('drizzle-orm');
@@ -5655,6 +5791,9 @@ class ItemProperty {
5655
5791
  logger('[ItemProperty._setupLiveQuerySubscription] Instance state not found');
5656
5792
  return;
5657
5793
  }
5794
+ // Unloaded or destroyed while setup awaited: subscribing now would leak the query.
5795
+ if (isActorStopped(this._service))
5796
+ return;
5658
5797
  // Subscribe to liveQuery updates
5659
5798
  const subscription = metadata$.subscribe({
5660
5799
  next: async (metadataRows) => {
@@ -5752,8 +5891,8 @@ class ItemProperty {
5752
5891
  const ctx = this._service.getSnapshot().context;
5753
5892
  let modelFileId;
5754
5893
  try {
5755
- const _mod_16 = await import('./index-DpgQMIRq.js');
5756
- const _ns_16 = _mod_16.bh;
5894
+ const _mod_16 = await import('./index-C-NqjjY_.js');
5895
+ const _ns_16 = _mod_16.bi;
5757
5896
  const { resolveItemModelFileId } = _ns_16;
5758
5897
  modelFileId = await resolveItemModelFileId({
5759
5898
  modelFileId: ctx.modelFileId,
@@ -5794,6 +5933,9 @@ class ItemProperty {
5794
5933
  logger('[ItemProperty._setupPropertySchemaLiveQuery] Instance state not found');
5795
5934
  return;
5796
5935
  }
5936
+ // Unloaded or destroyed while setup awaited: subscribing now would leak the query.
5937
+ if (isActorStopped(this._service))
5938
+ return;
5797
5939
  const subscription = schema$.subscribe({
5798
5940
  next: (rows) => {
5799
5941
  if (rows.length === 0)
@@ -5868,6 +6010,7 @@ class ItemProperty {
5868
6010
  static create(props, options) {
5869
6011
  const waitForReady = options?.waitForReady !== false;
5870
6012
  const readyTimeout = options?.readyTimeout ?? DEFAULT_READY_TIMEOUT_MS;
6013
+ const holds = options?.hold === false ? 0 : 1;
5871
6014
  const { propertyName, seedLocalId, seedUid } = props;
5872
6015
  if (!propertyName || (!seedLocalId && !seedUid)) {
5873
6016
  if (!waitForReady)
@@ -5884,9 +6027,10 @@ class ItemProperty {
5884
6027
  ? keyByUid
5885
6028
  : null;
5886
6029
  if (lookupKey) {
5887
- const { instance, refCount } = this.instanceCache.get(lookupKey);
5888
- const entry = { instance, refCount: refCount + 1 };
5889
- this.instanceCache.set(lookupKey, entry);
6030
+ // One entry under both keys: one hold count for the instance
6031
+ const entry = this.instanceCache.get(lookupKey);
6032
+ entry.refCount += holds;
6033
+ const { instance } = entry;
5890
6034
  const otherKey = lookupKey === keyByLocal ? keyByUid : keyByLocal;
5891
6035
  if (otherKey)
5892
6036
  this.instanceCache.set(otherKey, entry);
@@ -5960,21 +6104,9 @@ class ItemProperty {
5960
6104
  if (!this.instanceCache.has(cacheKey)) {
5961
6105
  const newInstance = new ItemProperty(props);
5962
6106
  // Wrap instance in Proxy for reactive property access
5963
- const proxiedInstance = createReactiveProxy({
5964
- instance: newInstance,
5965
- service: newInstance._service,
5966
- trackedProperties: TRACKED_PROPERTIES$1,
5967
- getContext: (instance) => {
5968
- return instance._getSnapshotContext();
5969
- },
5970
- sendUpdate: (instance, prop, value) => {
5971
- instance._service.send({
5972
- type: 'updateContext',
5973
- [prop]: value,
5974
- });
5975
- },
5976
- });
5977
- const entry = { instance: proxiedInstance, refCount: 1 };
6107
+ const proxiedInstance = ItemProperty.wrapInProxy(newInstance);
6108
+ const entry = { instance: proxiedInstance, refCount: holds };
6109
+ cacheEntries.set(newInstance._service, entry);
5978
6110
  this.instanceCache.set(cacheKey, entry);
5979
6111
  if (keyByUid && keyByUid !== cacheKey)
5980
6112
  this.instanceCache.set(keyByUid, entry);
@@ -5987,21 +6119,9 @@ class ItemProperty {
5987
6119
  if (!this.instanceCache.has(cacheKey)) {
5988
6120
  const newInstance = new ItemProperty(props);
5989
6121
  // Wrap instance in Proxy for reactive property access
5990
- const proxiedInstance = createReactiveProxy({
5991
- instance: newInstance,
5992
- service: newInstance._service,
5993
- trackedProperties: TRACKED_PROPERTIES$1,
5994
- getContext: (instance) => {
5995
- return instance._getSnapshotContext();
5996
- },
5997
- sendUpdate: (instance, prop, value) => {
5998
- instance._service.send({
5999
- type: 'updateContext',
6000
- [prop]: value,
6001
- });
6002
- },
6003
- });
6004
- const entry = { instance: proxiedInstance, refCount: 1 };
6122
+ const proxiedInstance = ItemProperty.wrapInProxy(newInstance);
6123
+ const entry = { instance: proxiedInstance, refCount: holds };
6124
+ cacheEntries.set(newInstance._service, entry);
6005
6125
  this.instanceCache.set(cacheKey, entry);
6006
6126
  if (keyByLocal && keyByLocal !== cacheKey)
6007
6127
  this.instanceCache.set(keyByLocal, entry);
@@ -6012,24 +6132,31 @@ class ItemProperty {
6012
6132
  }
6013
6133
  const newInstance = new ItemProperty(props);
6014
6134
  // Wrap instance in Proxy for reactive property access
6015
- const result = createReactiveProxy({
6016
- instance: newInstance,
6017
- service: newInstance._service,
6018
- trackedProperties: TRACKED_PROPERTIES$1,
6019
- getContext: (instance) => {
6020
- return instance._getSnapshotContext();
6021
- },
6022
- sendUpdate: (instance, prop, value) => {
6023
- instance._service.send({
6024
- type: 'updateContext',
6025
- [prop]: value,
6026
- });
6027
- },
6028
- });
6135
+ const result = ItemProperty.wrapInProxy(newInstance);
6029
6136
  if (!waitForReady)
6030
6137
  return result;
6031
6138
  return waitForEntityIdle(result, { timeout: readyTimeout }).then(() => result);
6032
6139
  }
6140
+ /**
6141
+ * Wraps a new instance in its reactive proxy: tracked names read from and write to the actor's
6142
+ * context, and assigning `value` also sends it to the actor before the setter runs.
6143
+ */
6144
+ static wrapInProxy(instance) {
6145
+ const sendUpdate = (target, prop, value) => {
6146
+ target._service.send({ type: 'updateContext', [prop]: value });
6147
+ };
6148
+ return createReactiveProxy({
6149
+ instance,
6150
+ service: instance._service,
6151
+ trackedProperties: TRACKED_PROPERTIES$1,
6152
+ getContext: (target) => target._getSnapshotContext(),
6153
+ sendUpdate,
6154
+ onSet: (target, prop, value) => {
6155
+ if (prop === 'value')
6156
+ sendUpdate(target, prop, value);
6157
+ },
6158
+ });
6159
+ }
6033
6160
  /**
6034
6161
  * The cached ItemProperty when it can be read right now (idle, not saving), the state
6035
6162
  * `ItemProperty.find()` waits for. Otherwise undefined. Unlike `find`, it takes no cache hold, so
@@ -6053,21 +6180,20 @@ class ItemProperty {
6053
6180
  }
6054
6181
  return undefined;
6055
6182
  }
6056
- static async find({ propertyName, seedLocalId, seedUid, modelName: modelNameOption, waitForReady = true, readyTimeout = DEFAULT_READY_TIMEOUT_MS, }) {
6183
+ /** Takes a hold on the instance it returns: release it with `unload()`. */
6184
+ static async find({ propertyName, seedLocalId, seedUid, modelName: modelNameOption, waitForReady = true, readyTimeout = DEFAULT_READY_TIMEOUT_MS, hold, }) {
6057
6185
  if ((!seedLocalId && !seedUid) || !propertyName) {
6058
6186
  return undefined;
6059
6187
  }
6060
6188
  const cacheKeyId = seedUid || seedLocalId;
6061
6189
  const cacheKey = ItemProperty.cacheKey(cacheKeyId, propertyName);
6062
6190
  let foundProperty;
6063
- // Check cache first
6064
- if (this.instanceCache.has(cacheKey)) {
6065
- const { instance, refCount } = this.instanceCache.get(cacheKey);
6066
- this.instanceCache.set(cacheKey, {
6067
- instance,
6068
- refCount: refCount + 1,
6069
- });
6070
- foundProperty = instance;
6191
+ // Check cache first. Mutate the entry: it may also be stored under the item's other id.
6192
+ const cachedEntry = this.instanceCache.get(cacheKey);
6193
+ if (cachedEntry) {
6194
+ if (hold !== false)
6195
+ cachedEntry.refCount += 1;
6196
+ foundProperty = cachedEntry.instance;
6071
6197
  }
6072
6198
  else {
6073
6199
  // Query database
@@ -6092,7 +6218,7 @@ class ItemProperty {
6092
6218
  seedUid: propertyData.seedUid ?? seedUid,
6093
6219
  propertyId: propertyData.propertyId,
6094
6220
  });
6095
- foundProperty = ItemProperty.create({ ...propertyData, modelName, propertyRecordSchema }, { waitForReady: false });
6221
+ foundProperty = ItemProperty.create({ ...propertyData, modelName, propertyRecordSchema }, { waitForReady: false, hold });
6096
6222
  }
6097
6223
  if (!foundProperty) {
6098
6224
  return undefined;
@@ -6105,9 +6231,10 @@ class ItemProperty {
6105
6231
  /**
6106
6232
  * Get all ItemProperty instances for an item.
6107
6233
  * Loads property data via getItemProperties, creates instances via create, optionally waits for idle.
6234
+ * Takes a hold on each instance, as `create` does.
6108
6235
  */
6109
6236
  static async all(params, options) {
6110
- const { waitForReady = false, readyTimeout = DEFAULT_READY_TIMEOUT_MS } = options ?? {};
6237
+ const { waitForReady = false, readyTimeout = DEFAULT_READY_TIMEOUT_MS, hold } = options ?? {};
6111
6238
  const { seedLocalId, seedUid } = params;
6112
6239
  if (!seedLocalId && !seedUid) {
6113
6240
  return [];
@@ -6115,8 +6242,8 @@ class ItemProperty {
6115
6242
  const propertiesData = await getItemProperties({ seedLocalId, seedUid });
6116
6243
  const instances = [];
6117
6244
  const seenNormalized = new Set();
6118
- const _mod_17 = await import('./index-DpgQMIRq.js');
6119
- const _ns_17 = _mod_17.bh;
6245
+ const _mod_17 = await import('./index-C-NqjjY_.js');
6246
+ const _ns_17 = _mod_17.bi;
6120
6247
  const { resolveItemModelFileId } = _ns_17;
6121
6248
  const itemModelFileId = await resolveItemModelFileId({ seedLocalId, seedUid });
6122
6249
  for (const data of propertiesData) {
@@ -6133,8 +6260,8 @@ class ItemProperty {
6133
6260
  }
6134
6261
  else if (baseName) {
6135
6262
  try {
6136
- const _mod_18 = await import('./errors-KM-yq2MD.js');
6137
- const _ns_18 = _mod_18.j;
6263
+ const _mod_18 = await import('./errors-CQagdED2.js');
6264
+ const _ns_18 = _mod_18.i;
6138
6265
  const { Model } = _ns_18;
6139
6266
  const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
6140
6267
  const model = await Model.resolveAsync(modelName, { modelFileId });
@@ -6150,8 +6277,8 @@ class ItemProperty {
6150
6277
  }
6151
6278
  if (modelName && propertyName) {
6152
6279
  try {
6153
- const _mod_19 = await import('./errors-KM-yq2MD.js');
6154
- const _ns_19 = _mod_19.j;
6280
+ const _mod_19 = await import('./errors-CQagdED2.js');
6281
+ const _ns_19 = _mod_19.i;
6155
6282
  const { Model } = _ns_19;
6156
6283
  const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
6157
6284
  const model = await Model.resolveAsync(modelName, { modelFileId });
@@ -6180,7 +6307,7 @@ class ItemProperty {
6180
6307
  modelFileId,
6181
6308
  propertyRecordSchema,
6182
6309
  };
6183
- const instance = this.create(createProps, { waitForReady: false });
6310
+ const instance = this.create(createProps, { waitForReady: false, hold });
6184
6311
  if (instance) {
6185
6312
  instances.push(instance);
6186
6313
  }
@@ -6192,18 +6319,44 @@ class ItemProperty {
6192
6319
  }
6193
6320
  return instances;
6194
6321
  }
6322
+ /**
6323
+ * @internal Takes one more hold on a cached, running instance, released with `unload()`. False
6324
+ * (and no hold) when the instance isn't cached or was stopped.
6325
+ */
6326
+ static retain(instance) {
6327
+ const service = instance.getService();
6328
+ const entry = cacheEntries.get(service);
6329
+ if (!entry || service.getSnapshot().status !== 'active')
6330
+ return false;
6331
+ entry.refCount += 1;
6332
+ return true;
6333
+ }
6195
6334
  static cacheKey(seedLocalIdOrUid, propertyName) {
6196
6335
  const { uid, localId } = getCorrectId(seedLocalIdOrUid);
6197
6336
  return `Item_${uid || localId}_${propertyName}`;
6198
6337
  }
6199
- /** Clears instance cache for an item (for test isolation when run in group). */
6338
+ /**
6339
+ * Drops an item's properties from the instance cache, under every key they're cached by. A dropped
6340
+ * instance someone still holds keeps running but is detached: it doesn't re-key itself into the
6341
+ * cache when its context changes, so the next lookup creates a fresh instance.
6342
+ */
6200
6343
  static clearInstanceCacheForItem(seedLocalIdOrUid) {
6201
6344
  const { uid, localId } = getCorrectId(seedLocalIdOrUid);
6202
6345
  const prefix = `Item_${uid || localId}_`;
6203
- for (const key of Array.from(this.instanceCache.keys())) {
6346
+ const dropped = new Set();
6347
+ for (const [key, entry] of this.instanceCache) {
6204
6348
  if (key.startsWith(prefix))
6349
+ dropped.add(entry);
6350
+ }
6351
+ for (const [key, entry] of Array.from(this.instanceCache)) {
6352
+ if (dropped.has(entry))
6205
6353
  this.instanceCache.delete(key);
6206
6354
  }
6355
+ for (const entry of dropped) {
6356
+ const service = entry.instance.getService();
6357
+ if (cacheEntries.get(service) === entry)
6358
+ cacheEntries.delete(service);
6359
+ }
6207
6360
  }
6208
6361
  getService() {
6209
6362
  return this._service;
@@ -6406,22 +6559,21 @@ class ItemProperty {
6406
6559
  // })
6407
6560
  // })
6408
6561
  }
6562
+ /**
6563
+ * Every cache key holding this instance: its item's local id and seed uid, and the name it had
6564
+ * before a rename (List of relation). They share one entry.
6565
+ */
6566
+ _cacheKeys() {
6567
+ const keys = [];
6568
+ for (const [key, entry] of ItemProperty.instanceCache) {
6569
+ if (entry.instance.getService() === this._service)
6570
+ keys.push(key);
6571
+ }
6572
+ return keys;
6573
+ }
6409
6574
  unload() {
6410
6575
  try {
6411
- const context = this._getSnapshotContext();
6412
- const cacheKey = ItemProperty.cacheKey(context.seedUid || context.seedLocalId || '', context.propertyName || '');
6413
- const cacheKeys = [];
6414
- if (cacheKey && cacheKey !== 'Item__') {
6415
- cacheKeys.push(cacheKey);
6416
- }
6417
- // Renamed after construction (List of relation): also drop the entry cached under the old name.
6418
- const publicName = this.propertyName;
6419
- if (publicName && publicName !== context.propertyName) {
6420
- const aliasKey = ItemProperty.cacheKey(context.seedUid || context.seedLocalId || '', publicName);
6421
- if (aliasKey && aliasKey !== 'Item__' && ItemProperty.instanceCache.get(aliasKey)?.instance === this) {
6422
- cacheKeys.push(aliasKey);
6423
- }
6424
- }
6576
+ const cacheKeys = this._cacheKeys();
6425
6577
  unloadEntity(this, {
6426
6578
  getCacheKeys: () => cacheKeys,
6427
6579
  caches: [ItemProperty.instanceCache],
@@ -6430,6 +6582,7 @@ class ItemProperty {
6430
6582
  onUnload: (instance) => {
6431
6583
  // Clean up additional subscriptions
6432
6584
  instance._subscription?.unsubscribe();
6585
+ revokeHeldObjectUrls(instance._service);
6433
6586
  const state = itemPropertyInstanceState.get(instance);
6434
6587
  if (state?.schemaLiveQuerySubscription) {
6435
6588
  state.schemaLiveQuerySubscription.unsubscribe();
@@ -6450,6 +6603,7 @@ class ItemProperty {
6450
6603
  instanceState.schemaLiveQuerySubscription = null;
6451
6604
  }
6452
6605
  this._subscription?.unsubscribe();
6606
+ revokeHeldObjectUrls(this._service);
6453
6607
  try {
6454
6608
  this._service.stop();
6455
6609
  }
@@ -6470,8 +6624,7 @@ class ItemProperty {
6470
6624
  seedLocalId: context.seedLocalId ?? undefined,
6471
6625
  seedUid: context.seedUid ?? undefined,
6472
6626
  });
6473
- const cacheKey = ItemProperty.cacheKey(context.seedUid || context.seedLocalId || '', context.propertyName || '');
6474
- const cacheKeys = cacheKey && cacheKey !== 'Item__' ? [cacheKey] : [];
6627
+ const cacheKeys = this._cacheKeys();
6475
6628
  clearDestroySubscriptions(this, {
6476
6629
  instanceState: itemPropertyInstanceState,
6477
6630
  onUnload: (instance) => instance._subscription?.unsubscribe(),
@@ -6490,7 +6643,7 @@ class ItemProperty {
6490
6643
  if (!propertyName || (!seedLocalId && !seedUid))
6491
6644
  return;
6492
6645
  if (db) {
6493
- const _mod_20 = await import('./index-BbFwftAv.js');
6646
+ const _mod_20 = await import('./index-3_hGVu7v.js');
6494
6647
  const _ns_20 = _mod_20.s;
6495
6648
  const seedSchemaMod = _ns_20;
6496
6649
  const { metadata } = seedSchemaMod;
@@ -6511,7 +6664,7 @@ class ItemProperty {
6511
6664
  }
6512
6665
  const itemMod = await Promise.resolve().then(function () { return Item$1; });
6513
6666
  const { Item } = itemMod;
6514
- const item = Item.getById((seedLocalId || seedUid));
6667
+ const item = Item.peek(seedLocalId || seedUid);
6515
6668
  if (item) {
6516
6669
  item.getService().send({ type: 'removePropertyInstance', propertyName });
6517
6670
  }
@@ -6535,8 +6688,8 @@ const createNewItem = async ({ modelName, modelFileId, ...propertyData }) => {
6535
6688
  }
6536
6689
  const seedType = easName(modelName);
6537
6690
  // Dynamic import to break circular dependency
6538
- const _mod_21 = await import('./errors-KM-yq2MD.js');
6539
- const _ns_21 = _mod_21.j;
6691
+ const _mod_21 = await import('./errors-CQagdED2.js');
6692
+ const _ns_21 = _mod_21.i;
6540
6693
  const modelMod = _ns_21;
6541
6694
  const { Model } = modelMod;
6542
6695
  const model = await Model.resolveAsync(modelName, { modelFileId });
@@ -6549,7 +6702,7 @@ const createNewItem = async ({ modelName, modelFileId, ...propertyData }) => {
6549
6702
  catch (error) {
6550
6703
  // The rows are separate inserts (no transaction): remove what was written so a failure leaves
6551
6704
  // no half-made draft.
6552
- const { discardNewDraft } = await import('./discardNewDraft-hiVaUVjV.js');
6705
+ const { discardNewDraft } = await import('./discardNewDraft-D4nrwp3T.js');
6553
6706
  await discardNewDraft(newSeedId).catch(() => undefined);
6554
6707
  throw error;
6555
6708
  }
@@ -6731,8 +6884,8 @@ const getModel = () => {
6731
6884
  // the fragile `import(...).then(n => n.X)` chunk-namespace pattern.
6732
6885
  if (!modelImportPromise) {
6733
6886
  modelImportPromise = (async () => {
6734
- const _mod_22 = await import('./errors-KM-yq2MD.js');
6735
- const _ns_22 = _mod_22.j;
6887
+ const _mod_22 = await import('./errors-CQagdED2.js');
6888
+ const _ns_22 = _mod_22.i;
6736
6889
  const mod = _ns_22;
6737
6890
  ModelClass = mod.Model;
6738
6891
  return mod;
@@ -6788,9 +6941,8 @@ const TRACKED_PROPERTIES = [
6788
6941
  'publisher',
6789
6942
  'revokedAt',
6790
6943
  ];
6791
- // WeakMap to store mutable state per Item instance
6792
- // This avoids issues with read-only properties when instances are frozen by Immer
6793
- const itemInstanceState = new WeakMap();
6944
+ // Mutable state per Item instance
6945
+ const itemInstanceState = new ActorKeyedState();
6794
6946
  /**
6795
6947
  * Seed uids an item has moved away from (a republish gives the item a new seed uid) whose seed row
6796
6948
  * may still hold them: the new uid is set on the item before its DB write lands, and until then the
@@ -6800,11 +6952,55 @@ const itemInstanceState = new WeakMap();
6800
6952
  */
6801
6953
  const supersededSeedUids = new WeakMap();
6802
6954
  /**
6803
- * Each Item's reactive proxy, keyed by the raw instance. The class's arrow-function methods see the
6804
- * raw instance as `this`, where tracked properties such as `seedUid` are getter-only; anything they
6805
- * hand the item to that assigns tracked properties (the publish executor) must get the proxy.
6955
+ * The ItemProperty instances an item holds, keyed by the item's actor, then by each property's
6956
+ * actor. An item takes one hold on each instance in its `propertyInstances` map while it is there
6957
+ * and releases it when the instance leaves the map or the item's actor stops. The SDK code that puts
6958
+ * instances in the map looks them up with `hold: false`, so these are their only item-owned holds.
6959
+ */
6960
+ const propertyHolds = new WeakMap();
6961
+ function syncPropertyHolds(itemService, propertyInstances) {
6962
+ let held = propertyHolds.get(itemService);
6963
+ if (!held) {
6964
+ held = new Map();
6965
+ propertyHolds.set(itemService, held);
6966
+ }
6967
+ const current = new Set();
6968
+ for (const property of propertyInstances?.values() ?? []) {
6969
+ const propertyService = property.getService();
6970
+ current.add(propertyService);
6971
+ if (!held.has(propertyService) && ItemProperty.retain(property))
6972
+ held.set(propertyService, property);
6973
+ }
6974
+ for (const [propertyService, property] of held) {
6975
+ if (current.has(propertyService))
6976
+ continue;
6977
+ held.delete(propertyService);
6978
+ property.unload();
6979
+ }
6980
+ }
6981
+ function releasePropertyHolds(itemService) {
6982
+ const held = propertyHolds.get(itemService);
6983
+ if (!held)
6984
+ return;
6985
+ propertyHolds.delete(itemService);
6986
+ for (const property of held.values()) {
6987
+ try {
6988
+ property.unload();
6989
+ }
6990
+ catch {
6991
+ // Already stopped
6992
+ }
6993
+ }
6994
+ }
6995
+ /**
6996
+ * Each Item's reactive proxy, keyed by its actor. The class's arrow-function methods see the raw
6997
+ * instance as `this`, where tracked properties such as `seedUid` are getter-only and model
6998
+ * properties (`item.title`) don't exist; anything they hand the item to (the publish executor)
6999
+ * must get the proxy.
6806
7000
  */
6807
7001
  const reactiveProxies = new WeakMap();
7002
+ /** The latest seed uid write per item, keyed by its actor (see `_persistSeedUid`). */
7003
+ const pendingSeedUidWrites = new WeakMap();
6808
7004
  class Item {
6809
7005
  constructor(initialValues) {
6810
7006
  this._propertiesSubject = new BehaviorSubject({});
@@ -6900,20 +7096,20 @@ class Item {
6900
7096
  }
6901
7097
  });
6902
7098
  // The executor assigns item.seedUid, which only the proxy accepts.
6903
- const item = reactiveProxies.get(this) ?? this;
7099
+ const item = reactiveProxies.get(this._service) ?? this;
6904
7100
  this._service.send({ type: 'startPublish', item, options });
6905
7101
  });
6906
7102
  };
6907
7103
  this.getPublishUploads = async (options) => {
6908
7104
  // Use dynamic import to break circular dependency
6909
- const _mod_23 = await import('./getPublishUploads-Cex-NBe6.js');
7105
+ const _mod_23 = await import('./getPublishUploads-7nW1kMZV.js');
6910
7106
  const _ns_23 = _mod_23.o;
6911
7107
  const getPublishUploadsMod = _ns_23;
6912
7108
  const { getPublishUploads } = getPublishUploadsMod;
6913
7109
  return await getPublishUploads(this, [], undefined, options);
6914
7110
  };
6915
7111
  this.getPublishPayload = async (uploadedTransactions, options) => {
6916
- const _mod_24 = await import('./getPublishPayload-oH8wJhnH.js');
7112
+ const _mod_24 = await import('./getPublishPayload-Bmeqtq4l.js');
6917
7113
  const _ns_24 = _mod_24.g;
6918
7114
  const getPublishPayloadMod = _ns_24;
6919
7115
  const { getPublishPayload } = getPublishPayloadMod;
@@ -6971,58 +7167,28 @@ class Item {
6971
7167
  context.propertyInstances.size === 0) {
6972
7168
  return;
6973
7169
  }
6974
- const state = itemInstanceState.get(this);
6975
7170
  const propertiesObj = {};
6976
7171
  for (const [key, propertyInstance] of context.propertyInstances) {
6977
7172
  if (typeof key !== 'string' || INTERNAL_PROPERTY_NAMES.includes(key)) {
6978
7173
  propertiesObj[key.toString()] = propertyInstance;
6979
7174
  continue;
6980
7175
  }
6981
- let transformedKey = key;
6982
- if (propertyInstance.alias) {
6983
- transformedKey = propertyInstance.alias;
6984
- }
6985
- if (!propertyInstance.alias && key.endsWith('Ids')) {
6986
- transformedKey = key.slice(0, -3); // Remove 'Ids'
6987
- transformedKey = pluralize(transformedKey);
6988
- }
6989
- if (!propertyInstance.alias &&
6990
- key.endsWith('Id') &&
6991
- !PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP.has(key)) {
6992
- transformedKey = key.slice(0, -2); // Remove 'Id'
6993
- }
6994
- propertiesObj[transformedKey] = propertyInstance;
6995
- }
6996
- // Define accessors for any property instances we don't have yet (e.g. from loadOrCreateItem)
6997
- const definedSet = state?.definedPropertyNames;
6998
- if (definedSet) {
6999
- for (const key of context.propertyInstances.keys()) {
7000
- if (typeof key !== 'string' || INTERNAL_PROPERTY_NAMES.includes(key)) {
7001
- continue;
7002
- }
7003
- if (!definedSet.has(key)) {
7004
- this._definePropertyAccessor(key);
7005
- }
7006
- }
7007
- // Html/Image/File/Relation store as e.g. htmlId; ensure schema name (html) has accessor when htmlId exists
7008
- for (const key of context.propertyInstances.keys()) {
7009
- if (typeof key !== 'string' || INTERNAL_PROPERTY_NAMES.includes(key))
7010
- continue;
7011
- const schemaBaseName = toSchemaPropertyName(key);
7012
- if (schemaBaseName &&
7013
- (schemaKeys.includes(schemaBaseName) || schemaKeys.length === 0) &&
7014
- !definedSet.has(schemaBaseName)) {
7015
- this._definePropertyAccessor(schemaBaseName);
7016
- }
7017
- }
7176
+ propertiesObj[toItemPropertyKey(key, propertyInstance.alias)] = propertyInstance;
7018
7177
  }
7019
7178
  this._propertiesSubject.next(propertiesObj);
7020
7179
  });
7180
+ // Hold the properties in the map; release them all when the actor stops (last unload, destroy,
7181
+ // eviction or error), whichever teardown path stops it.
7182
+ const itemService = this._service;
7183
+ itemService.subscribe({
7184
+ next: (snapshot) => syncPropertyHolds(itemService, snapshot.context?.propertyInstances),
7185
+ complete: () => releasePropertyHolds(itemService),
7186
+ error: () => releasePropertyHolds(itemService),
7187
+ });
7021
7188
  this._service.start();
7022
7189
  // Initialize instance state in WeakMap
7023
7190
  itemInstanceState.set(this, {
7024
7191
  liveQuerySubscription: null,
7025
- definedPropertyNames: new Set(),
7026
7192
  });
7027
7193
  // Set up liveQuery subscription for cross-instance updates
7028
7194
  this._setupLiveQuerySubscription();
@@ -7123,7 +7289,7 @@ class Item {
7123
7289
  static collectInstanceCacheKeysForInstance(instance) {
7124
7290
  const keys = [];
7125
7291
  for (const [k, v] of this.instanceCache) {
7126
- if (v.instance === instance)
7292
+ if (sameEntity(v.instance, instance))
7127
7293
  keys.push(k);
7128
7294
  }
7129
7295
  return keys;
@@ -7143,6 +7309,95 @@ class Item {
7143
7309
  throw new Error('Item.registerItemInInstanceCache: missing seedLocalId and seedUid');
7144
7310
  }
7145
7311
  }
7312
+ /**
7313
+ * Wraps a new instance in its reactive proxy: tracked names read from and write to the actor's
7314
+ * context, and the model's property names (`item.title`, or `item.html` for `htmlId`) read and
7315
+ * write their ItemProperty's value.
7316
+ */
7317
+ static wrapInProxy(instance) {
7318
+ const proxy = createReactiveProxy({
7319
+ instance,
7320
+ service: instance._service,
7321
+ trackedProperties: TRACKED_PROPERTIES,
7322
+ getContext: (target) => target._getSnapshotContext(),
7323
+ sendUpdate: (target, prop, value) => {
7324
+ if (prop === 'publisher')
7325
+ throw new Error('Cannot set item.publisher: publisher is read-only.');
7326
+ Item.sendTrackedPropertyUpdate(target, prop, value);
7327
+ if (prop === 'seedUid' && typeof value === 'string' && value.length > 0) {
7328
+ target._persistSeedUid(value);
7329
+ }
7330
+ },
7331
+ resolve: (target, prop) => {
7332
+ const property = target._findPropertyInstance(prop);
7333
+ if (!property)
7334
+ return undefined;
7335
+ return {
7336
+ get: () => property.value,
7337
+ set: (value) => {
7338
+ property.value = value;
7339
+ },
7340
+ };
7341
+ },
7342
+ virtualKeys: (target) => target._propertyInstanceNames(),
7343
+ onSet: (_target, prop) => {
7344
+ if (prop === 'properties') {
7345
+ // Properties are read-only computed values from propertyInstances, managed via ItemProperty instances
7346
+ throw new Error('Cannot set item.properties directly. Properties are computed from ItemProperty instances.');
7347
+ }
7348
+ },
7349
+ });
7350
+ reactiveProxies.set(instance._service, proxy);
7351
+ return proxy;
7352
+ }
7353
+ /**
7354
+ * The ItemProperty a model property name reads and writes on the item: by its name, or by its
7355
+ * storage name (`html` finds `htmlId` and the other way round). Internal names don't resolve.
7356
+ */
7357
+ _findPropertyInstance(propertyName) {
7358
+ if (INTERNAL_PROPERTY_NAMES.includes(propertyName))
7359
+ return undefined;
7360
+ const instances = this._service.getSnapshot().context.propertyInstances;
7361
+ if (!instances || instances.size === 0)
7362
+ return undefined;
7363
+ const direct = instances.get(propertyName);
7364
+ if (direct)
7365
+ return direct;
7366
+ const altKey = getAlternatePropertyNameForInstanceLookup(propertyName);
7367
+ return altKey ? instances.get(altKey) : undefined;
7368
+ }
7369
+ /** Every name `_findPropertyInstance` resolves: the stored names and their schema names. */
7370
+ _propertyInstanceNames() {
7371
+ const instances = this._service.getSnapshot().context.propertyInstances;
7372
+ if (!instances)
7373
+ return [];
7374
+ const names = new Set();
7375
+ for (const key of instances.keys()) {
7376
+ if (typeof key !== 'string' || INTERNAL_PROPERTY_NAMES.includes(key))
7377
+ continue;
7378
+ names.add(key);
7379
+ const schemaName = toSchemaPropertyName(key);
7380
+ if (schemaName && !INTERNAL_PROPERTY_NAMES.includes(schemaName))
7381
+ names.add(schemaName);
7382
+ }
7383
+ return [...names];
7384
+ }
7385
+ /**
7386
+ * Writes an assigned seed uid to the item's seed row, so later loads and getPublishPayload see it.
7387
+ * Writes run one after another per item, so the last assignment is the one that stays.
7388
+ */
7389
+ _persistSeedUid(seedUid) {
7390
+ const seedLocalId = this._getSnapshotContext().seedLocalId;
7391
+ if (!seedLocalId)
7392
+ return;
7393
+ const previous = pendingSeedUidWrites.get(this._service) ?? Promise.resolve();
7394
+ const write = previous
7395
+ .then(() => updateSeedUid({ seedLocalId, seedUid }))
7396
+ .catch((err) => {
7397
+ itemLogger('updateSeedUid failed:', err);
7398
+ });
7399
+ pendingSeedUidWrites.set(this._service, write);
7400
+ }
7146
7401
  /**
7147
7402
  * Sets a tracked context property from the proxy. Setting `seedUid` to a different uid means a
7148
7403
  * new seed attestation (publishing again after unpublish): the revocation belonged to the old
@@ -7206,6 +7461,13 @@ class Item {
7206
7461
  }
7207
7462
  return (ctx.propertyInstances?.size ?? 0) > 0;
7208
7463
  }
7464
+ /**
7465
+ * The cached Item for a seedLocalId or seedUid, in any state, without taking a hold. For SDK code
7466
+ * that reads or messages the item and doesn't hand it to a caller.
7467
+ */
7468
+ static peek(id) {
7469
+ return id ? this.findItemInstanceCacheEntryById(id)?.instance : undefined;
7470
+ }
7209
7471
  /**
7210
7472
  * The cached Item for a seedLocalId or seedUid when it can be read right now: idle and hydrated,
7211
7473
  * so at least what `Item.find()` would wait for. Otherwise undefined. Unlike `getById`, it takes
@@ -7345,82 +7607,7 @@ class Item {
7345
7607
  const { latestVersionUid, ...propsWithoutVersionUid } = props;
7346
7608
  const propsWithModel = { ...propsWithoutVersionUid };
7347
7609
  const newInstance = new Item(propsWithModel);
7348
- // Wrap instance in Proxy for reactive property access
7349
- const proxiedInstance = new Proxy(newInstance, {
7350
- get(target, prop) {
7351
- // Handle special properties
7352
- if (prop === '_service') {
7353
- return Reflect.get(target, prop);
7354
- }
7355
- // Handle tracked properties
7356
- if (typeof prop === 'string' && TRACKED_PROPERTIES.includes(prop)) {
7357
- const context = target._getSnapshotContext();
7358
- return context[prop];
7359
- }
7360
- // Handle 'properties' getter - not tracked, but accessible via getter
7361
- if (typeof prop === 'string' && prop === 'properties') {
7362
- // Delegate to the getter method on the instance
7363
- return target.properties;
7364
- }
7365
- // For methods and other properties, use Reflect
7366
- return Reflect.get(target, prop);
7367
- },
7368
- set(target, prop, value) {
7369
- // Handle special properties
7370
- if (prop === '_service') {
7371
- return Reflect.set(target, prop, value);
7372
- }
7373
- if (typeof prop === 'string' && prop === 'publisher') {
7374
- throw new Error('Cannot set item.publisher: publisher is read-only.');
7375
- }
7376
- // Handle tracked properties
7377
- if (typeof prop === 'string' && TRACKED_PROPERTIES.includes(prop)) {
7378
- // Standard property update
7379
- Item.sendTrackedPropertyUpdate(target, prop, value);
7380
- // Auto-persist seedUid to DB when assigned so future loads and getPublishPayload see it
7381
- if (prop === 'seedUid' && typeof value === 'string' && value.length > 0) {
7382
- const seedLocalId = target._getSnapshotContext().seedLocalId;
7383
- if (seedLocalId) {
7384
- void updateSeedUid({ seedLocalId, seedUid: value }).catch((err) => {
7385
- itemLogger('updateSeedUid failed:', err);
7386
- });
7387
- }
7388
- }
7389
- return true;
7390
- }
7391
- // Handle 'properties' - read-only computed property
7392
- if (typeof prop === 'string' && prop === 'properties') {
7393
- // Properties are read-only computed values from propertyInstances
7394
- // Cannot be set directly - properties are managed via ItemProperty instances
7395
- throw new Error('Cannot set item.properties directly. Properties are computed from ItemProperty instances.');
7396
- }
7397
- // For non-tracked properties, use Reflect
7398
- return Reflect.set(target, prop, value);
7399
- },
7400
- has(target, prop) {
7401
- // Check tracked properties
7402
- if (typeof prop === 'string' && TRACKED_PROPERTIES.includes(prop)) {
7403
- const context = target._getSnapshotContext();
7404
- return prop in context;
7405
- }
7406
- return Reflect.has(target, prop);
7407
- },
7408
- ownKeys(target) {
7409
- // Return keys from target
7410
- return Reflect.ownKeys(target);
7411
- },
7412
- getOwnPropertyDescriptor(target, prop) {
7413
- let invent;
7414
- if (typeof prop === 'string' && TRACKED_PROPERTIES.includes(prop)) {
7415
- const context = target._getSnapshotContext();
7416
- if (prop in context) {
7417
- invent = { value: context[prop] };
7418
- }
7419
- }
7420
- return getInvariantSafePropertyDescriptor(target, prop, invent);
7421
- },
7422
- });
7423
- reactiveProxies.set(newInstance, proxiedInstance);
7610
+ const proxiedInstance = Item.wrapInProxy(newInstance);
7424
7611
  this.registerItemInInstanceCache(proxiedInstance);
7425
7612
  if (!waitForReady)
7426
7613
  return proxiedInstance;
@@ -7453,8 +7640,8 @@ class Item {
7453
7640
  const db = BaseDb.getAppDb();
7454
7641
  if (db && props.modelName) {
7455
7642
  // Model names are only unique per schema: resolve the exact models row from the most specific scope.
7456
- const _mod_25 = await import('./index-DpgQMIRq.js');
7457
- const _ns_25 = _mod_25.bh;
7643
+ const _mod_25 = await import('./index-C-NqjjY_.js');
7644
+ const _ns_25 = _mod_25.bi;
7458
7645
  const { resolveModelRecord } = _ns_25;
7459
7646
  const modelRecord = await resolveModelRecord(props.modelName, {
7460
7647
  modelFileId: props.modelFileId ?? modelInstance?.id,
@@ -7462,8 +7649,8 @@ class Item {
7462
7649
  });
7463
7650
  const modelRecords = modelRecord ? [modelRecord] : [];
7464
7651
  if (!modelRecord) {
7465
- const _mod_26 = await import('./errors-KM-yq2MD.js');
7466
- const _ns_26 = _mod_26.k;
7652
+ const _mod_26 = await import('./errors-CQagdED2.js');
7653
+ const _ns_26 = _mod_26.j;
7467
7654
  const { UnknownModelError } = _ns_26;
7468
7655
  throw new UnknownModelError(props.modelName, schemaName ?? modelInstance?.schemaName);
7469
7656
  }
@@ -7473,11 +7660,11 @@ class Item {
7473
7660
  // Scope the constructor's Model lookup to this model's schema (as getItemData does on reload),
7474
7661
  // so a same-named model cached from another schema can't supply the property set.
7475
7662
  if (modelRecord && !props.schemaName) {
7476
- const _mod_27 = await import('./index-DpgQMIRq.js');
7477
- const _ns_27 = _mod_27.bg;
7663
+ const _mod_27 = await import('./index-C-NqjjY_.js');
7664
+ const _ns_27 = _mod_27.bh;
7478
7665
  const { modelSchemas } = _ns_27;
7479
- const _mod_28 = await import('./index-DpgQMIRq.js');
7480
- const _ns_28 = _mod_28.bf;
7666
+ const _mod_28 = await import('./index-C-NqjjY_.js');
7667
+ const _ns_28 = _mod_28.bg;
7481
7668
  const { schemas: schemasTable } = _ns_28;
7482
7669
  const schemaRows = await db
7483
7670
  .select({ schemaName: schemasTable.name })
@@ -7551,95 +7738,7 @@ class Item {
7551
7738
  const { latestVersionUid, ...propsWithoutVersionUid } = props;
7552
7739
  const propsWithModel = { ...propsWithoutVersionUid };
7553
7740
  const newInstance = new Item(propsWithModel);
7554
- // Wrap instance in Proxy for reactive property access
7555
- const proxiedInstance = new Proxy(newInstance, {
7556
- get(target, prop) {
7557
- // Handle special properties
7558
- if (prop === '_service') {
7559
- return Reflect.get(target, prop);
7560
- }
7561
- // Handle tracked properties
7562
- if (typeof prop === 'string' && TRACKED_PROPERTIES.includes(prop)) {
7563
- // Special handling for properties - compute from propertyInstances Map
7564
- if (prop === 'properties') {
7565
- const snapshot = target._service.getSnapshot();
7566
- const context = snapshot.context;
7567
- const propertyInstances = context.propertyInstances;
7568
- if (!propertyInstances || propertyInstances.size === 0) {
7569
- return [];
7570
- }
7571
- // Get model schema keys for filtering
7572
- const modelSchemaKeys = target._getModelSchemaKeys();
7573
- // Convert Map to array, filtering by model schema
7574
- const properties = [];
7575
- for (const [key, propertyInstance] of propertyInstances) {
7576
- // Skip internal properties
7577
- if (INTERNAL_PROPERTY_NAMES.includes(key)) {
7578
- continue;
7579
- }
7580
- // Include if it's a model property
7581
- const isModelProp = target._isModelProperty(key, modelSchemaKeys);
7582
- if (isModelProp) {
7583
- properties.push(propertyInstance);
7584
- }
7585
- }
7586
- // CRITICAL: Always create a new array reference so React detects changes
7587
- return [...properties];
7588
- }
7589
- const context = target._getSnapshotContext();
7590
- return context[prop];
7591
- }
7592
- // For methods and other properties, use Reflect
7593
- return Reflect.get(target, prop);
7594
- },
7595
- set(target, prop, value) {
7596
- // Handle special properties
7597
- if (prop === '_service') {
7598
- return Reflect.set(target, prop, value);
7599
- }
7600
- if (typeof prop === 'string' && prop === 'publisher') {
7601
- throw new Error('Cannot set item.publisher: publisher is read-only.');
7602
- }
7603
- // Handle tracked properties
7604
- if (typeof prop === 'string' && TRACKED_PROPERTIES.includes(prop)) {
7605
- if (prop === 'properties') {
7606
- // Properties are read-only computed values from propertyInstances
7607
- // Cannot be set directly - properties are managed via ItemProperty instances
7608
- throw new Error('Cannot set item.properties directly. Properties are computed from ItemProperty instances.');
7609
- }
7610
- else {
7611
- // Standard property update
7612
- Item.sendTrackedPropertyUpdate(target, prop, value);
7613
- }
7614
- return true;
7615
- }
7616
- // For non-tracked properties, use Reflect
7617
- return Reflect.set(target, prop, value);
7618
- },
7619
- has(target, prop) {
7620
- // Check tracked properties
7621
- if (typeof prop === 'string' && TRACKED_PROPERTIES.includes(prop)) {
7622
- const context = target._getSnapshotContext();
7623
- return prop in context;
7624
- }
7625
- return Reflect.has(target, prop);
7626
- },
7627
- ownKeys(target) {
7628
- // Return keys from target
7629
- return Reflect.ownKeys(target);
7630
- },
7631
- getOwnPropertyDescriptor(target, prop) {
7632
- let invent;
7633
- if (typeof prop === 'string' && TRACKED_PROPERTIES.includes(prop)) {
7634
- const context = target._getSnapshotContext();
7635
- if (prop in context) {
7636
- invent = { value: context[prop] };
7637
- }
7638
- }
7639
- return getInvariantSafePropertyDescriptor(target, prop, invent);
7640
- },
7641
- });
7642
- reactiveProxies.set(newInstance, proxiedInstance);
7741
+ const proxiedInstance = Item.wrapInProxy(newInstance);
7643
7742
  this.registerItemInInstanceCache(proxiedInstance);
7644
7743
  // Storage values must be saved before returning, so wait for readiness even when not requested.
7645
7744
  if (!waitForReady && pipelineValues.length === 0)
@@ -7664,7 +7763,7 @@ class Item {
7664
7763
  /* best-effort cache cleanup */
7665
7764
  }
7666
7765
  try {
7667
- const { discardNewDraft } = await import('./discardNewDraft-hiVaUVjV.js');
7766
+ const { discardNewDraft } = await import('./discardNewDraft-D4nrwp3T.js');
7668
7767
  await discardNewDraft(seedLocalId);
7669
7768
  }
7670
7769
  catch (error) {
@@ -7680,8 +7779,8 @@ class Item {
7680
7779
  for (const [propertyName, value] of pipelineValues) {
7681
7780
  const property = await this.waitForPropertyInstance(item, propertyName, timeout);
7682
7781
  if (!property) {
7683
- const _mod_29 = await import('./errors-KM-yq2MD.js');
7684
- const _ns_29 = _mod_29.k;
7782
+ const _mod_29 = await import('./errors-CQagdED2.js');
7783
+ const _ns_29 = _mod_29.j;
7685
7784
  const { ItemCreateError } = _ns_29;
7686
7785
  throw new ItemCreateError(`Item.create: property ${item.modelName}.${propertyName} did not load for item ${item.seedLocalId}; value was not saved`, { code: 'property_not_loaded', modelName: item.modelName, property: propertyName, seedLocalId: item.seedLocalId });
7687
7786
  }
@@ -7692,15 +7791,15 @@ class Item {
7692
7791
  }
7693
7792
  catch (error) {
7694
7793
  if (error instanceof ItemPropertySaveValidationError) {
7695
- const _mod_30 = await import('./errors-KM-yq2MD.js');
7696
- const _ns_30 = _mod_30.k;
7794
+ const _mod_30 = await import('./errors-CQagdED2.js');
7795
+ const _ns_30 = _mod_30.j;
7697
7796
  const { ItemCreateValidationError } = _ns_30;
7698
7797
  const created = new ItemCreateValidationError(item.modelName, error.validationErrors.map((e) => ({ property: propertyName, code: e.code, message: e.message })));
7699
7798
  created.cause = error;
7700
7799
  throw created;
7701
7800
  }
7702
- const _mod_31 = await import('./errors-KM-yq2MD.js');
7703
- const _ns_31 = _mod_31.k;
7801
+ const _mod_31 = await import('./errors-CQagdED2.js');
7802
+ const _ns_31 = _mod_31.j;
7704
7803
  const { ItemCreateError } = _ns_31;
7705
7804
  throw new ItemCreateError(`Item.create: failed to save ${item.modelName}.${propertyName} for item ${item.seedLocalId}: ` +
7706
7805
  (error instanceof Error ? error.message : String(error)), { code: 'save_failed', modelName: item.modelName, property: propertyName, seedLocalId: item.seedLocalId, cause: error });
@@ -7841,11 +7940,12 @@ class Item {
7841
7940
  const { waitForReady = false, readyTimeout = DEFAULT_READY_TIMEOUT_MS, includeEas = false, addressFilter, modelFileId, schemaName, } = options ?? {};
7842
7941
  const itemsData = await getItemsData({ modelName, modelFileId, schemaName, deleted, includeEas, addressFilter });
7843
7942
  const itemInstances = [];
7943
+ // Built without waiting; with waitForReady the items are then awaited together, below.
7844
7944
  for (const itemData of itemsData) {
7845
7945
  itemInstances.push(await Item.create({
7846
7946
  ...itemData,
7847
7947
  modelName,
7848
- }));
7948
+ }, { waitForReady: false }));
7849
7949
  }
7850
7950
  if (waitForReady && itemInstances.length > 0) {
7851
7951
  await Promise.all(itemInstances.map((item) => this.waitForItemInstanceReadyForRead(item, readyTimeout)));
@@ -7862,7 +7962,7 @@ class Item {
7862
7962
  if (!appDb || Item.instanceCache.size === 0) {
7863
7963
  return;
7864
7964
  }
7865
- const _mod_32 = await import('./index-BbFwftAv.js');
7965
+ const _mod_32 = await import('./index-3_hGVu7v.js');
7866
7966
  const _ns_32 = _mod_32.s;
7867
7967
  const { metadata } = _ns_32;
7868
7968
  const { eq, and } = await import('drizzle-orm');
@@ -7938,6 +8038,7 @@ class Item {
7938
8038
  seedLocalId,
7939
8039
  seedUid,
7940
8040
  modelName: itemModelName,
8041
+ hold: false,
7941
8042
  });
7942
8043
  if (property) {
7943
8044
  sendToItemMachine({
@@ -7976,8 +8077,10 @@ class Item {
7976
8077
  if (this._storageTransactionId) {
7977
8078
  props.storageTransactionId = this._storageTransactionId;
7978
8079
  }
8080
+ // The item's own hold is taken when the instance enters its map (syncPropertyHolds)
7979
8081
  const propertyInstance = ItemProperty.create(props, {
7980
8082
  waitForReady: false,
8083
+ hold: false,
7981
8084
  });
7982
8085
  if (!propertyInstance || !props.propertyName) {
7983
8086
  return;
@@ -7987,49 +8090,14 @@ class Item {
7987
8090
  propertyName: props.propertyName,
7988
8091
  propertyInstance,
7989
8092
  });
7990
- this._definePropertyAccessor(props.propertyName);
7991
- }
7992
- /**
7993
- * Defines a property accessor on this Item that delegates get/set to the
7994
- * ItemProperty in context.propertyInstances at access time (so the correct
7995
- * instance is used after loadOrCreateItemSuccess merges DB-backed instances).
7996
- */
7997
- _definePropertyAccessor(propertyName) {
7998
- let state = itemInstanceState.get(this);
7999
- if (!state) {
8000
- state = { liveQuerySubscription: null, definedPropertyNames: new Set() };
8001
- itemInstanceState.set(this, state);
8002
- }
8003
- if (state.definedPropertyNames.has(propertyName)) {
8004
- return;
8005
- }
8006
- const altKey = getAlternatePropertyNameForInstanceLookup(propertyName);
8007
- Object.defineProperty(this, propertyName, {
8008
- get: () => {
8009
- const instances = this._service.getSnapshot().context.propertyInstances;
8010
- const inst = instances?.get(propertyName) ?? (altKey ? instances?.get(altKey) : undefined);
8011
- const val = inst?.value;
8012
- return val;
8013
- },
8014
- set: (value) => {
8015
- const instances = this._service.getSnapshot().context.propertyInstances;
8016
- const inst = instances?.get(propertyName) ?? (altKey ? instances?.get(altKey) : undefined);
8017
- if (inst) {
8018
- inst.value = value;
8019
- }
8020
- },
8021
- enumerable: true,
8022
- configurable: true,
8023
- });
8024
- state.definedPropertyNames.add(propertyName);
8025
8093
  }
8026
8094
  /** Throws ItemCreateValidationError for unknown keys and values that break their property's rules. */
8027
8095
  static async assertValidCreateValues(props, propertyNames, dataTypeByPropertyName, skipKeys) {
8028
- const _mod_33 = await import('./errors-KM-yq2MD.js');
8029
- const _ns_33 = _mod_33.k;
8096
+ const _mod_33 = await import('./errors-CQagdED2.js');
8097
+ const _ns_33 = _mod_33.j;
8030
8098
  const { ItemCreateValidationError } = _ns_33;
8031
- const { getPropertySchema } = await import('./property-BDBvImLs.js');
8032
- const { SchemaValidationService } = await import('./SchemaValidationService-BxCbfDaI.js');
8099
+ const { getPropertySchema } = await import('./property-DaUy4XMe.js');
8100
+ const { SchemaValidationService } = await import('./SchemaValidationService-paOfbcwd.js');
8033
8101
  const validationService = new SchemaValidationService();
8034
8102
  const modelName = props.modelName;
8035
8103
  const known = new Set(propertyNames);
@@ -8066,7 +8134,7 @@ class Item {
8066
8134
  // Not JSON: validated as given, and rejected as a non-array
8067
8135
  }
8068
8136
  }
8069
- const { resolvePropertyValidationRules } = await import('./propertyValidationRules-BlfLn4rP.js');
8137
+ const { resolvePropertyValidationRules } = await import('./propertyValidationRules-DbbWvBzj.js');
8070
8138
  const rules = propertySchema?.validation ??
8071
8139
  (await resolvePropertyValidationRules(modelName, key, {
8072
8140
  modelFileId: props.modelFileId,
@@ -8254,17 +8322,7 @@ class Item {
8254
8322
  // Prefer propertyInstance.propertyName if available (most reliable)
8255
8323
  // Otherwise use the Map key
8256
8324
  const propertyName = propertyInstance.propertyName || key;
8257
- // Apply transformations if needed
8258
- let transformedKey = propertyName;
8259
- if (propertyInstance.alias) {
8260
- transformedKey = propertyInstance.alias;
8261
- }
8262
- else if (propertyName.endsWith('Ids')) {
8263
- transformedKey = pluralize(propertyName.slice(0, -3));
8264
- }
8265
- else if (propertyName.endsWith('Id')) {
8266
- transformedKey = propertyName.slice(0, -2);
8267
- }
8325
+ const transformedKey = toItemPropertyKey(propertyName, propertyInstance.alias);
8268
8326
  if (!schemaKeys.includes(transformedKey)) {
8269
8327
  schemaKeys.push(transformedKey);
8270
8328
  }
@@ -8295,19 +8353,9 @@ class Item {
8295
8353
  if (!propertyInstance) {
8296
8354
  return false;
8297
8355
  }
8298
- // Apply same transformation as _getSchemaKeysFromPropertyInstances
8356
+ // Same key as _getSchemaKeysFromPropertyInstances
8299
8357
  const propertyName = propertyInstance.propertyName || key;
8300
- let transformedKey = propertyName;
8301
- if (propertyInstance.alias) {
8302
- transformedKey = propertyInstance.alias;
8303
- }
8304
- else if (propertyName.endsWith('Ids')) {
8305
- transformedKey = pluralize(propertyName.slice(0, -3));
8306
- }
8307
- else if (propertyName.endsWith('Id')) {
8308
- transformedKey = propertyName.slice(0, -2);
8309
- }
8310
- return modelSchemaKeys.includes(transformedKey);
8358
+ return modelSchemaKeys.includes(toItemPropertyKey(propertyName, propertyInstance.alias));
8311
8359
  }
8312
8360
  /**
8313
8361
  * Returns only properties that are defined in the Model's schema
@@ -8397,7 +8445,7 @@ class Item {
8397
8445
  itemActor.send(event);
8398
8446
  };
8399
8447
  try {
8400
- const _mod_34 = await import('./index-BbFwftAv.js');
8448
+ const _mod_34 = await import('./index-3_hGVu7v.js');
8401
8449
  const _ns_34 = _mod_34.s;
8402
8450
  const seedSchemaMod = _ns_34;
8403
8451
  const { seeds, metadata } = seedSchemaMod;
@@ -8463,6 +8511,7 @@ class Item {
8463
8511
  seedLocalId: watchedSeedLocalId,
8464
8512
  seedUid: this._getSnapshotContext().seedUid ?? seedUid,
8465
8513
  modelName: itemModelName,
8514
+ hold: false,
8466
8515
  });
8467
8516
  if (property) {
8468
8517
  logger(`[Item._setupLiveQuerySubscription] Created/cached ItemProperty instance for propertyName "${metaRow.propertyName}"`);
@@ -8506,6 +8555,9 @@ class Item {
8506
8555
  logger('[Item._setupLiveQuerySubscription] Instance state not found');
8507
8556
  return;
8508
8557
  }
8558
+ // Unloaded or destroyed while setup awaited: subscribing now would leak the query.
8559
+ if (isActorStopped(this._service))
8560
+ return;
8509
8561
  // Subscribe to seeds updates
8510
8562
  const seedsSubscription = seeds$.subscribe({
8511
8563
  next: async (seedRows) => {
@@ -8616,6 +8668,7 @@ class Item {
8616
8668
  seedLocalId: watchedSeedLocalId,
8617
8669
  seedUid: this._getSnapshotContext().seedUid ?? seedUid,
8618
8670
  modelName: itemModelName,
8671
+ hold: false,
8619
8672
  });
8620
8673
  if (property) {
8621
8674
  sendToItemMachine({
@@ -8767,5 +8820,5 @@ var Item$1 = /*#__PURE__*/Object.freeze({
8767
8820
  Item: Item
8768
8821
  });
8769
8822
 
8770
- 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 };
8771
- //# sourceMappingURL=Item-D6j0IvBP.js.map
8823
+ export { ActorKeyedState as $, getGetPublisherForNewSeeds as A, getMetadataLatest as B, ClientManagerState as C, DEFAULT_READY_TIMEOUT_MS as D, getPublishExecutor as E, getRevokeExecutor as F, getUploadExecutor as G, getVersionData$1 as H, Item as I, isLocalUnsealedDraft as J, isSeedRowOwned as K, localUnsealedDraftSql as L, METADATA_LATEST_FIRST_ORDER_SQL as M, ownedPublisherSql as N, OwnershipError as O, PUBLISH_NOT_CONFIGURED_MESSAGE as P, ownedSeedsSql as Q, pickLatestMetadataRowPerProperty as R, placeholderUidSql as S, propertyMachine as T, publisherInAddressListSql as U, publisherIsInOwnedSet as V, setAdditionalSyncAddresses as W, setGetPublisherForNewSeeds as X, setPublishExecutor as Y, setRevokeExecutor as Z, setUploadExecutor as _, ItemProperty as a, clearDestroySubscriptions as a0, unloadEntity as a1, ClientManagerEvents as a2, withLockedItemStorageRow as a3, getItemStorageFilePath as a4, writeItemStorageFile as a5, resolvePublisherFromSeedRow as a6, getPropertyData$1 as a7, Item$1 as a8, 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, isActorStopped as m, createReactiveProxy as n, sameEntity as o, parseListPropertyValueFromStorage as p, findEntity as q, rowsPerInsert as r, selectInBatches as s, forceRemoveFromCaches as t, runDestroyLifecycle as u, isPublishedMetadataRow as v, writeInBatches as w, MachineIds as x, createNewItem as y, getEasSchemaForItemProperty as z };
8824
+ //# sourceMappingURL=Item-BiMHgg-_.js.map