@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,10 +1,10 @@
1
1
  import { startCase, isEqual } from 'lodash-es';
2
- import { B as BaseDb, o as easSyncProcesses, I as eventEmitter, ac as isBrowser, a1 as isNode, aE as normalizeAddressConfig, aS as isTestOrSeedDev, j as appState, aT as downloadAllFilesRequestHandler, aU as downloadAllFilesBinaryRequestHandler, h as BaseFileManager, ag as loadNameMatchLevels, t as models$1, s as modelUids, C as seeds, aF as normalizeAddressList, A as schemas, aP as loadModelsFromDbForSchema, aM as addSchemaToDb, aJ as isInternalSchema, ai as generateId, aR as clearNameMatchLevels, aV as warnOnInvalidNameMatch, aW as INTERNAL_SCHEMA_IDS, aX as linkModelToSchema, n as normalizeDataType, ab as easPropertyNameForPublish, au as SEED_PROTOCOL_SCHEMA_NAME, r as modelSchemas, m as metadata$1, v as properties, L as resolveItemModelFileId, F as versions, ae as normalizePublisher, p as htmlEmbeddedImageCoPublish, k as arweaveL1FinalizeJobs, z as publishProcesses, aY as getWatchedAddressesFromDb, aZ as getOwnedAddressesFromDb, a_ as CLIENT_NOT_INITIALIZED } from './index-DpgQMIRq.js';
2
+ import { B as BaseDb, o as easSyncProcesses, I as eventEmitter, al as isBrowser, a1 as isNode, aE as normalizeAddressConfig, aS as isTestOrSeedDev, j as appState, aT as downloadAllFilesRequestHandler, aU as downloadAllFilesBinaryRequestHandler, h as BaseFileManager, ae as loadNameMatchLevels, t as models$1, s as modelUids, C as seeds, aF as normalizeAddressList, A as schemas, aP as loadModelsFromDbForSchema, aM as addSchemaToDb, aJ as isInternalSchema, ah as generateId, aR as clearNameMatchLevels, aV as warnOnInvalidNameMatch, aW as INTERNAL_SCHEMA_IDS, aX as linkModelToSchema, n as normalizeDataType, ab as easPropertyNameForPublish, au as SEED_PROTOCOL_SCHEMA_NAME, r as modelSchemas, m as metadata$1, v as properties, L as resolveItemModelFileId, F as versions, ac as normalizePublisher, p as htmlEmbeddedImageCoPublish, k as arweaveL1FinalizeJobs, z as publishProcesses, aY as getWatchedAddressesFromDb, aZ as getOwnedAddressesFromDb, a_ as CLIENT_NOT_INITIALIZED } from './index-C-NqjjY_.js';
3
3
  import debug from 'debug';
4
4
  import { createActor, setup, assign, fromPromise, fromCallback, waitFor } from 'xstate';
5
- import { u as MachineIds, a0 as ClientManagerEvents, a1 as withLockedItemStorageRow, a2 as getItemStorageFilePath, a3 as writeItemStorageFile, e as compareMetadataRowsLatestFirst, w as writeInBatches, a4 as resolvePublisherFromSeedRow, C as ClientManagerState, G as isLocalUnsealedDraft, s as selectInBatches, I as Item } from './Item-D6j0IvBP.js';
5
+ import { x as MachineIds, a2 as ClientManagerEvents, a3 as withLockedItemStorageRow, a4 as getItemStorageFilePath, a5 as writeItemStorageFile, e as compareMetadataRowsLatestFirst, w as writeInBatches, a6 as resolvePublisherFromSeedRow, C as ClientManagerState, J as isLocalUnsealedDraft, s as selectInBatches, I as Item } from './Item-BiMHgg-_.js';
6
6
  import { eq, inArray, and, isNotNull, ne, desc, countDistinct, isNull, or, sql, like } from 'drizzle-orm';
7
- import { a as withDbTabLock, i as isLeaderTab, c as postTabMessage, o as onTabMessage, w as whenLeaderTab, l as listenForOtherTabsEvents, s as startTabCoordination, b as withSeedDbLock, e as emitAcrossTabs, A as ADDRESSES_PERSISTED_EVENT, p as parseAddressesPersistedPayload, L as LOCAL_COPIES_REMOVED_EVENT } from './tabEvents-DksXwk3X.js';
7
+ import { a as withDbTabLock, i as isLeaderTab, d as postTabMessage, o as onTabMessage, w as whenLeaderTab, l as listenForOtherTabsEvents, s as startTabCoordination, b as withSeedDbLock, e as emitAcrossTabs, A as ADDRESSES_PERSISTED_EVENT, p as parseAddressesPersistedPayload, L as LOCAL_COPIES_REMOVED_EVENT } from './tabEvents-UH-wNsZC.js';
8
8
  import { seedGatewayConfigFromSeedConfig, setPreferredArweaveReadBaseUrls, resolveSeedGatewayEndpoints, setResolvedSeedGatewayEndpoints, BaseArweaveClient, ensureReadGatewaySelected, DEFAULT_ARWEAVE_HOST } from '@seedprotocol/arweave';
9
9
  import { configureEasReadChain, easName, BaseQueryClient, BaseEasClient, GET_SCHEMAS, whenEasReadChainSettled, getEasReadChainId, DEFAULT_EAS_CHAIN_ID, isEasReadChainConfigured, isPlaceholderUid, localNamesInBestMatchTier, isValidEasAttestationUid } from '@seedprotocol/eas';
10
10
  import 'pluralize';
@@ -212,7 +212,7 @@ function toRunSyncArg(options) {
212
212
  return undefined;
213
213
  }
214
214
  const runEasSync = fromPromise(async ({ input, }) => {
215
- const { runSyncFromEas } = await import('./syncDbWithEas-CAOlw3i-.js');
215
+ const { runSyncFromEas } = await import('./syncDbWithEas-D0gyJ58h.js');
216
216
  // Sync checks for rows and then inserts the rest (no unique index on uids), so syncs in
217
217
  // different tabs take turns. A sync can run for minutes, so wait without a timeout.
218
218
  await withDbTabLock('eas-sync', async () => {
@@ -590,7 +590,7 @@ const platformClassesInit = fromCallback(({ sendBack, input: { context, event }
590
590
  if (!config) {
591
591
  throw new Error('client.init requires a config');
592
592
  }
593
- const _mod_0 = await import('./configurePlatform-Bbpw_R4y.js');
593
+ const _mod_0 = await import('./configurePlatform-_XR45RnJ.js');
594
594
  const _ns_0 = _mod_0.a;
595
595
  const { configurePlatform } = _ns_0;
596
596
  if (isBrowser()) {
@@ -1980,8 +1980,8 @@ function getRefValueType(prop) {
1980
1980
  * @returns Promise that resolves when properties are found, or rejects if not found after max retries
1981
1981
  */
1982
1982
  const verifyPropertiesPersisted = async (db, modelId, modelName, maxRetries = 10, retryDelay = 100) => {
1983
- const _mod_1 = await import('./index-DpgQMIRq.js');
1984
- const _ns_1 = _mod_1.bd;
1983
+ const _mod_1 = await import('./index-C-NqjjY_.js');
1984
+ const _ns_1 = _mod_1.be;
1985
1985
  const modelSchemaMod = _ns_1;
1986
1986
  const { properties: propertiesTable } = modelSchemaMod;
1987
1987
  const drizzleMod = await import('drizzle-orm');
@@ -2387,8 +2387,8 @@ async function importSchema(importFilePathOrContents, version, options) {
2387
2387
  // Check DB for existing schema by name+version (same as minimal path)
2388
2388
  const db = BaseDb.getAppDb();
2389
2389
  if (db) {
2390
- const _mod_2 = await import('./index-DpgQMIRq.js');
2391
- const _ns_2 = _mod_2.bf;
2390
+ const _mod_2 = await import('./index-C-NqjjY_.js');
2391
+ const _ns_2 = _mod_2.bg;
2392
2392
  const schemaSchemaMod = _ns_2;
2393
2393
  const { schemas: schemasTable } = schemaSchemaMod;
2394
2394
  const drizzleMod = await import('drizzle-orm');
@@ -2479,8 +2479,8 @@ async function importSchema(importFilePathOrContents, version, options) {
2479
2479
  // For minimal imports: check DB for existing schema before creating new file
2480
2480
  const db = BaseDb.getAppDb();
2481
2481
  if (db) {
2482
- const _mod_3 = await import('./index-DpgQMIRq.js');
2483
- const _ns_3 = _mod_3.bf;
2482
+ const _mod_3 = await import('./index-C-NqjjY_.js');
2483
+ const _ns_3 = _mod_3.bg;
2484
2484
  const schemaSchemaMod = _ns_3;
2485
2485
  const { schemas: schemasTable } = schemaSchemaMod;
2486
2486
  const drizzleMod = await import('drizzle-orm');
@@ -2662,8 +2662,8 @@ async function importSchema(importFilePathOrContents, version, options) {
2662
2662
  updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
2663
2663
  };
2664
2664
  // Use dynamic import to break circular dependency
2665
- const _mod_4 = await import('./index-DpgQMIRq.js');
2666
- const _ns_4 = _mod_4.bi;
2665
+ const _mod_4 = await import('./index-C-NqjjY_.js');
2666
+ const _ns_4 = _mod_4.bj;
2667
2667
  const dbMod = _ns_4;
2668
2668
  const { addSchemaToDb, addModelsToDb } = dbMod;
2669
2669
  // Try to add schema and models to database if database is available
@@ -2684,12 +2684,12 @@ async function importSchema(importFilePathOrContents, version, options) {
2684
2684
  });
2685
2685
  // Verify expected models are linked (single attempt - addModelsToDb already confirmed)
2686
2686
  const expectedModelNames = Object.keys(schemaFile.models || {});
2687
- const _mod_5 = await import('./index-DpgQMIRq.js');
2688
- const _ns_5 = _mod_5.bg;
2687
+ const _mod_5 = await import('./index-C-NqjjY_.js');
2688
+ const _ns_5 = _mod_5.bh;
2689
2689
  const modelSchemaSchemaMod = _ns_5;
2690
2690
  const { modelSchemas } = modelSchemaSchemaMod;
2691
- const _mod_6 = await import('./index-DpgQMIRq.js');
2692
- const _ns_6 = _mod_6.bd;
2691
+ const _mod_6 = await import('./index-C-NqjjY_.js');
2692
+ const _ns_6 = _mod_6.be;
2693
2693
  const modelSchemaMod = _ns_6;
2694
2694
  const { models: modelsTable } = modelSchemaMod;
2695
2695
  const drizzleMod = await import('drizzle-orm');
@@ -2890,8 +2890,8 @@ async function applySchemaToDb(schemaFile, modelDefinitions, modelFileIds, prope
2890
2890
  createdAt: new Date(schemaFile.metadata.createdAt).getTime(),
2891
2891
  updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
2892
2892
  };
2893
- const _mod_7 = await import('./index-DpgQMIRq.js');
2894
- const _ns_7 = _mod_7.bi;
2893
+ const _mod_7 = await import('./index-C-NqjjY_.js');
2894
+ const _ns_7 = _mod_7.bj;
2895
2895
  const dbMod = _ns_7;
2896
2896
  const { addSchemaToDb, addModelsToDb } = dbMod;
2897
2897
  const db = BaseDb.getAppDb();
@@ -2922,8 +2922,8 @@ async function applySchemaToDb(schemaFile, modelDefinitions, modelFileIds, prope
2922
2922
  * draft (its edits aren't the app's to undo) or a newer version than schemaFile.
2923
2923
  */
2924
2924
  async function getModelsDroppedFromStoredSchema(db, schemaFile) {
2925
- const _mod_8 = await import('./index-DpgQMIRq.js');
2926
- const _ns_8 = _mod_8.bf;
2925
+ const _mod_8 = await import('./index-C-NqjjY_.js');
2926
+ const _ns_8 = _mod_8.bg;
2927
2927
  const { schemas: schemasTable } = _ns_8;
2928
2928
  const { eq } = await import('drizzle-orm');
2929
2929
  const rows = await db
@@ -2950,11 +2950,11 @@ async function getModelsDroppedFromStoredSchema(db, schemaFile) {
2950
2950
  }
2951
2951
  /** Delete the model_schemas rows linking the named models to the schema. The models and their items stay. */
2952
2952
  async function unlinkModelsFromSchema(db, schemaId, modelNames) {
2953
- const _mod_9 = await import('./index-DpgQMIRq.js');
2954
- const _ns_9 = _mod_9.bg;
2953
+ const _mod_9 = await import('./index-C-NqjjY_.js');
2954
+ const _ns_9 = _mod_9.bh;
2955
2955
  const { modelSchemas } = _ns_9;
2956
- const _mod_10 = await import('./index-DpgQMIRq.js');
2957
- const _ns_10 = _mod_10.bd;
2956
+ const _mod_10 = await import('./index-C-NqjjY_.js');
2957
+ const _ns_10 = _mod_10.be;
2958
2958
  const { models: modelsTable } = _ns_10;
2959
2959
  const { and, eq, inArray } = await import('drizzle-orm');
2960
2960
  const links = await db
@@ -3116,12 +3116,12 @@ const loadSchemaFromFile = async (schemaFilePath) => {
3116
3116
  ]));
3117
3117
  const { schemaRecord } = await applySchemaToDb(schemaFile, modelDefinitions, modelFileIds, propertyFileIds, propertyDefinitions).finally(rowsWritten.settle);
3118
3118
  // Query the database to get model IDs that were just created
3119
- const _mod_11 = await import('./index-DpgQMIRq.js');
3120
- const _ns_11 = _mod_11.bg;
3119
+ const _mod_11 = await import('./index-C-NqjjY_.js');
3120
+ const _ns_11 = _mod_11.bh;
3121
3121
  const modelSchemaSchemaMod = _ns_11;
3122
3122
  const { modelSchemas } = modelSchemaSchemaMod;
3123
- const _mod_12 = await import('./index-DpgQMIRq.js');
3124
- const _ns_12 = _mod_12.bd;
3123
+ const _mod_12 = await import('./index-C-NqjjY_.js');
3124
+ const _ns_12 = _mod_12.be;
3125
3125
  const modelSchemaMod = _ns_12;
3126
3126
  const { models: modelsTable } = modelSchemaMod;
3127
3127
  const drizzleMod = await import('drizzle-orm');
@@ -3186,8 +3186,8 @@ const loadSchemaFromFile = async (schemaFilePath) => {
3186
3186
  // After properties are created (file path), ensure schemaFile has the correct IDs from database
3187
3187
  // Query the database to get the actual schemaFileId values that were used
3188
3188
  // This ensures schemaData matches what's actually in the database
3189
- const _mod_13 = await import('./index-DpgQMIRq.js');
3190
- const _ns_13 = _mod_13.bd;
3189
+ const _mod_13 = await import('./index-C-NqjjY_.js');
3190
+ const _ns_13 = _mod_13.be;
3191
3191
  const modelSchemaMod2 = _ns_13;
3192
3192
  const { properties: propertiesTable } = modelSchemaMod2;
3193
3193
  let schemaFileUpdated = false;
@@ -3222,8 +3222,8 @@ const loadSchemaFromFile = async (schemaFilePath) => {
3222
3222
  // This is important even if nothing changed, to ensure consistency
3223
3223
  const updatedSchemaData = JSON.stringify(schemaFile, null, 2);
3224
3224
  // Update the schema record in the database with current schemaData
3225
- const _mod_14 = await import('./index-DpgQMIRq.js');
3226
- const _ns_14 = _mod_14.bf;
3225
+ const _mod_14 = await import('./index-C-NqjjY_.js');
3226
+ const _ns_14 = _mod_14.bg;
3227
3227
  const schemaSchemaMod = _ns_14;
3228
3228
  const { schemas: schemasTable } = schemaSchemaMod;
3229
3229
  await db
@@ -3349,8 +3349,8 @@ const createRowsWrittenSignal = () => {
3349
3349
  const createModelFromJson = async (modelName, modelDef, schemaName, modelFileId, // Optional modelFileId from JSON file
3350
3350
  propertyFileIds, // Optional map of property names to their file IDs from the JSON file
3351
3351
  persistedBy) => {
3352
- const _mod_15 = await import('./errors-KM-yq2MD.js');
3353
- const _ns_15 = _mod_15.j;
3352
+ const _mod_15 = await import('./errors-CQagdED2.js');
3353
+ const _ns_15 = _mod_15.i;
3354
3354
  const modelMod = _ns_15;
3355
3355
  const { Model } = modelMod;
3356
3356
  const convertedProperties = jsonPropertiesToSchemaProperties(modelName, modelDef, propertyFileIds);
@@ -3363,12 +3363,15 @@ persistedBy) => {
3363
3363
  else {
3364
3364
  logger$7(`Warning: Creating schema model "${modelName}" without modelFileId - it will be renamed if duplicates exist`);
3365
3365
  }
3366
+ // The schema holds its models once (Model.takeSchemaHold); a model it already holds takes no more.
3367
+ const schemaHold = Model.takeSchemaHold(modelFileId);
3366
3368
  const modelInstance = Model.create(modelName, schemaName, {
3367
3369
  modelFileId: modelFileId, // Pass modelFileId (preferred) as id (schemaFileId) from JSON file
3368
3370
  id: modelFileId, // Also pass as id for backward compatibility
3369
3371
  properties: convertedProperties,
3370
3372
  waitForReady: false,
3371
3373
  persistedBy,
3374
+ ...(!schemaHold && { hold: false }),
3372
3375
  });
3373
3376
  return modelInstance;
3374
3377
  };
@@ -5513,6 +5516,18 @@ const createClientManager = () => {
5513
5516
  };
5514
5517
  // Replaced when init runs after stop(): an xstate actor can't be started again once stopped.
5515
5518
  let { actor: clientManager, actorSubscription: subscription } = createClientManager();
5519
+ const serviceListeners = new Set();
5520
+ /** Tells subscribeService listeners that the clientManager actor was replaced or stopped. */
5521
+ const notifyServiceListeners = () => {
5522
+ for (const listener of [...serviceListeners]) {
5523
+ try {
5524
+ listener(clientManager);
5525
+ }
5526
+ catch (error) {
5527
+ logger('subscribeService listener threw:', error);
5528
+ }
5529
+ }
5530
+ };
5516
5531
  /** Config of the init that is running or has succeeded; cleared when init fails or the client stops. */
5517
5532
  let activeInitConfig;
5518
5533
  const INIT_CONFIG_CONFLICT_MESSAGE = 'client.init was already called with a different config. The SDK keeps the config it was ' +
@@ -5540,6 +5555,7 @@ const stopClient = ({ unsubscribe }) => {
5540
5555
  clientManager.stop();
5541
5556
  if (unsubscribe)
5542
5557
  subscription.unsubscribe();
5558
+ notifyServiceListeners();
5543
5559
  };
5544
5560
  const coalescedInit = createCoalescedAsync(async (options) => {
5545
5561
  // If the actor is stopped (e.g., from a previous failed test), restart it
@@ -5550,6 +5566,7 @@ const coalescedInit = createCoalescedAsync(async (options) => {
5550
5566
  // stop() (or a failed test) stopped it: start over with a new actor and a clean context.
5551
5567
  logger('Client manager was stopped, creating a new one');
5552
5568
  ({ actor: clientManager, actorSubscription: subscription } = createClientManager());
5569
+ notifyServiceListeners();
5553
5570
  }
5554
5571
  // Clear any stale context from previous failed initializations
5555
5572
  // This ensures we start with a clean slate before the new init updates it
@@ -5629,6 +5646,17 @@ const clientInstance = {
5629
5646
  // ensureInitialized();
5630
5647
  return clientManager;
5631
5648
  },
5649
+ /**
5650
+ * Calls `listener` with the clientManager actor when it changes: `init()` after `stop()`
5651
+ * replaces the actor, and `stop()` ends the current one. Subscribe to the actor itself for its
5652
+ * state changes. Returns a function that removes the listener.
5653
+ */
5654
+ subscribeService: (listener) => {
5655
+ serviceListeners.add(listener);
5656
+ return () => {
5657
+ serviceListeners.delete(listener);
5658
+ };
5659
+ },
5632
5660
  /**
5633
5661
  * Initialise the SDK. Calls made while an init is running share it. Once initialised, a
5634
5662
  * call with the same config resolves at once and applies any change in `addresses`; a
@@ -5788,4 +5816,4 @@ var ClientManager$1 = /*#__PURE__*/Object.freeze({
5788
5816
  });
5789
5817
 
5790
5818
  export { requestEasSyncFromEventBus as A, requestEasSyncFromModelsInit as B, ClientManager as C, sendEasSyncClientRequest as D, EAS_CHAIN_ID_APP_STATE_KEY as E, setRetriesWhenOnlineEnabled as F, startEasSyncActor as G, unregisterSeedQueryLocalSource as H, INIT_CONFIG_CONFLICT_MESSAGE as I, createRowsWrittenSignal as J, createModelsFromJson as K, getLatestSchemaVersion as L, jsonPropertiesToSchemaProperties as M, schema as N, ClientManager$1 as O, SEEDPROTOCOL_Seed_Protocol_v1 as S, getContentHash as a, isVerbatimItemStorageDraftRow as b, convertVerbatimItemStorageRow as c, assertLocalDbChain as d, claimUnpublishedDrafts as e, createLocalQueryDataSource as f, getRefValueType as g, hardDeleteLocalSeedsByLocalIds as h, importJsonSchema as i, createSchema as j, easSyncActor as k, loadSchemaFromFile as l, getClient as m, getPublishedSeedRecord as n, getSchemaNameFromId as o, isSeedQueryLocalSourceRegistered as p, listCompleteSchemaFiles as q, readJsonImportFile as r, syncSchemaFromSource as s, transformImportToSchemaFile as t, loadAllSchemasFromDb as u, mergeEasSyncRequestIntents as v, waitForEasReadChain as w, readSchema as x, registerSeedQueryLocalSource as y, requestEasSyncFromAddressChange as z };
5791
- //# sourceMappingURL=ClientManager-2GtDWHq6.js.map
5819
+ //# sourceMappingURL=ClientManager-DBKvmJov.js.map