@seedprotocol/sdk 0.7.3-next.654.g52217f6 → 0.7.3

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 (187) hide show
  1. package/dist/{db-D9K_f5cF.js → BasePathResolver-Cm4apKRb.js} +2041 -127
  2. package/dist/BasePathResolver-Cm4apKRb.js.map +1 -0
  3. package/dist/{ClientManager-C-QXqUK9.js → ClientManager-i3nJASkg.js} +249 -147
  4. package/dist/ClientManager-i3nJASkg.js.map +1 -0
  5. package/dist/{Item-C7sUUu2B.js → Item-DBFchXpC.js} +259 -169
  6. package/dist/Item-DBFchXpC.js.map +1 -0
  7. package/dist/{ModelProperty-DJxeOOrc.js → ModelProperty-BS49g01Y.js} +166 -47
  8. package/dist/ModelProperty-BS49g01Y.js.map +1 -0
  9. package/dist/{Schema-fXtvd-yL.js → Schema-CpMNEnUO.js} +53 -42
  10. package/dist/Schema-CpMNEnUO.js.map +1 -0
  11. package/dist/{SchemaValidationService-CvRS2HSO.js → SchemaValidationService-DieV4KL-.js} +15 -17
  12. package/dist/{SchemaValidationService-CvRS2HSO.js.map → SchemaValidationService-DieV4KL-.js.map} +1 -1
  13. package/dist/{backfillMetadataPropertyIds-SXW-8C64.js → backfillMetadataPropertyIds-DSoOoTnX.js} +14 -7
  14. package/dist/{backfillMetadataPropertyIds-SXW-8C64.js.map → backfillMetadataPropertyIds-DSoOoTnX.js.map} +1 -1
  15. package/dist/{configurePlatform-BRw2j0ZN.js → configurePlatform-D0lQGAMQ.js} +5 -7
  16. package/dist/{configurePlatform-BRw2j0ZN.js.map → configurePlatform-D0lQGAMQ.js.map} +1 -1
  17. package/dist/detachRowsBeforeDelete-S0q-DJPT.js +50 -0
  18. package/dist/detachRowsBeforeDelete-S0q-DJPT.js.map +1 -0
  19. package/dist/{eas-DHxfswCt.js → eas-6pjU-OuX.js} +6 -8
  20. package/dist/eas-6pjU-OuX.js.map +1 -0
  21. package/dist/{getItem-d6N_aM6S.js → getItem-CxBNZ-WL.js} +10 -11
  22. package/dist/{getItem-d6N_aM6S.js.map → getItem-CxBNZ-WL.js.map} +1 -1
  23. package/dist/{getPublishPayload-BHrxVtzY.js → getPublishPayload-CTCvRUoU.js} +50 -18
  24. package/dist/getPublishPayload-CTCvRUoU.js.map +1 -0
  25. package/dist/{getPublishUploads-BEqRiKIS.js → getPublishUploads-SFHCbf_y.js} +13 -22
  26. package/dist/{getPublishUploads-BEqRiKIS.js.map → getPublishUploads-SFHCbf_y.js.map} +1 -1
  27. package/dist/{index-s15q14rm.js → index-8O3Uow-Y.js} +125 -57
  28. package/dist/index-8O3Uow-Y.js.map +1 -0
  29. package/dist/{index-DglvthOk.js → index-AVFTVp1m.js} +2 -2
  30. package/dist/index-AVFTVp1m.js.map +1 -0
  31. package/dist/index-Cvt5UBz4.js +30 -0
  32. package/dist/index-Cvt5UBz4.js.map +1 -0
  33. package/dist/{index.browser-Cm06tP4X.js → index.browser-DBhxRoe8.js} +11 -10
  34. package/dist/{index.browser-Cm06tP4X.js.map → index.browser-DBhxRoe8.js.map} +1 -1
  35. package/dist/{index.node-C30dmFgn.js → index.node-CJhlcNHM.js} +25 -13
  36. package/dist/index.node-CJhlcNHM.js.map +1 -0
  37. package/dist/main.js +27 -32
  38. package/dist/main.js.map +1 -1
  39. package/dist/node.js +19 -22
  40. package/dist/node.js.map +1 -1
  41. package/dist/platform.browser.js +9 -9
  42. package/dist/platform.node.js +18 -5
  43. package/dist/platform.node.js.map +1 -1
  44. package/dist/{property-DhmmYAvQ.js → property-DwPD283A.js} +11 -12
  45. package/dist/property-DwPD283A.js.map +1 -0
  46. package/dist/{publishDraftGraph-yYP74WRt.js → publishDraftGraph-BOn3_Occ.js} +6 -9
  47. package/dist/{publishDraftGraph-yYP74WRt.js.map → publishDraftGraph-BOn3_Occ.js.map} +1 -1
  48. package/dist/{resetAmbiguousLegacyItemData-Bk0QyDW8.js → resetAmbiguousLegacyItemData-BkYmBeJc.js} +14 -3
  49. package/dist/{resetAmbiguousLegacyItemData-Bk0QyDW8.js.map → resetAmbiguousLegacyItemData-BkYmBeJc.js.map} +1 -1
  50. package/dist/{resolveModelForSyncedSeed-8cAzvUFd.js → resolveModelForSyncedSeed-BL24nLa7.js} +2 -2
  51. package/dist/{resolveModelForSyncedSeed-8cAzvUFd.js.map → resolveModelForSyncedSeed-BL24nLa7.js.map} +1 -1
  52. package/dist/src/Item/Item.d.ts +20 -2
  53. package/dist/src/Item/Item.d.ts.map +1 -1
  54. package/dist/src/Item/service/actors/runPublish.d.ts +11 -2
  55. package/dist/src/Item/service/actors/runPublish.d.ts.map +1 -1
  56. package/dist/src/Item/service/itemMachineSingle.d.ts +12 -2
  57. package/dist/src/Item/service/itemMachineSingle.d.ts.map +1 -1
  58. package/dist/src/ItemProperty/ItemProperty.d.ts +5 -3
  59. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  60. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
  61. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  62. package/dist/src/Model/Model.d.ts +10 -4
  63. package/dist/src/Model/Model.d.ts.map +1 -1
  64. package/dist/src/Model/index.d.ts +2 -2
  65. package/dist/src/ModelProperty/ModelProperty.d.ts +10 -2
  66. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  67. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +3 -0
  68. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
  69. package/dist/src/Schema/Schema.d.ts +2 -2
  70. package/dist/src/Schema/Schema.d.ts.map +1 -1
  71. package/dist/src/Schema/index.d.ts +0 -1
  72. package/dist/src/Schema/index.d.ts.map +1 -1
  73. package/dist/src/client/ClientManager.d.ts +30 -11
  74. package/dist/src/client/ClientManager.d.ts.map +1 -1
  75. package/dist/src/client/actors/platformClassesInit.d.ts +6 -0
  76. package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
  77. package/dist/src/client/actors/processSchemaFiles.d.ts.map +1 -1
  78. package/dist/src/client/actors/saveConfig.d.ts +13 -6
  79. package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
  80. package/dist/src/db/read/getPublishPayload.d.ts +1 -1
  81. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  82. package/dist/src/db/write/claimUnpublishedDrafts.d.ts +2 -0
  83. package/dist/src/db/write/claimUnpublishedDrafts.d.ts.map +1 -1
  84. package/dist/src/eventBus.d.ts +5 -0
  85. package/dist/src/eventBus.d.ts.map +1 -1
  86. package/dist/src/helpers/cachedPropertyRefresh.d.ts +12 -0
  87. package/dist/src/helpers/cachedPropertyRefresh.d.ts.map +1 -0
  88. package/dist/src/helpers/db.d.ts +3 -0
  89. package/dist/src/helpers/db.d.ts.map +1 -1
  90. package/dist/src/helpers/easSdk.d.ts +16 -0
  91. package/dist/src/helpers/easSdk.d.ts.map +1 -0
  92. package/dist/src/helpers/entity/detachRowsBeforeDelete.d.ts +16 -0
  93. package/dist/src/helpers/entity/detachRowsBeforeDelete.d.ts.map +1 -0
  94. package/dist/src/helpers/entity/entityDestroy.d.ts +2 -0
  95. package/dist/src/helpers/entity/entityDestroy.d.ts.map +1 -1
  96. package/dist/src/helpers/ownership.d.ts +9 -1
  97. package/dist/src/helpers/ownership.d.ts.map +1 -1
  98. package/dist/src/helpers/property/index.d.ts +37 -51
  99. package/dist/src/helpers/property/index.d.ts.map +1 -1
  100. package/dist/src/helpers/publishConfig.d.ts +27 -8
  101. package/dist/src/helpers/publishConfig.d.ts.map +1 -1
  102. package/dist/src/helpers/updateSchema.d.ts +5 -0
  103. package/dist/src/helpers/updateSchema.d.ts.map +1 -1
  104. package/dist/src/helpers/waitForEntityIdle.d.ts +5 -0
  105. package/dist/src/helpers/waitForEntityIdle.d.ts.map +1 -1
  106. package/dist/src/imports/json.d.ts +9 -0
  107. package/dist/src/imports/json.d.ts.map +1 -1
  108. package/dist/src/index.d.ts +6 -4
  109. package/dist/src/index.d.ts.map +1 -1
  110. package/dist/src/interfaces/IItem.d.ts +7 -1
  111. package/dist/src/interfaces/IItem.d.ts.map +1 -1
  112. package/dist/src/node/db/Db.d.ts.map +1 -1
  113. package/dist/src/node/helpers/PathResolver.d.ts.map +1 -1
  114. package/dist/src/node/index.d.ts +8 -1
  115. package/dist/src/node/index.d.ts.map +1 -1
  116. package/dist/src/platform/index.browser.d.ts +2 -0
  117. package/dist/src/platform/index.browser.d.ts.map +1 -1
  118. package/dist/src/platform/index.node.d.ts +2 -0
  119. package/dist/src/platform/index.node.d.ts.map +1 -1
  120. package/dist/src/types/index.d.ts +12 -1
  121. package/dist/src/types/index.d.ts.map +1 -1
  122. package/dist/src/types/machines.d.ts +2 -0
  123. package/dist/src/types/machines.d.ts.map +1 -1
  124. package/dist/src/types/property.d.ts +8 -0
  125. package/dist/src/types/property.d.ts.map +1 -1
  126. package/dist/{syncDbWithEas--HUA9WNb.js → syncDbWithEas-Bv2Fe38J.js} +15 -16
  127. package/dist/syncDbWithEas-Bv2Fe38J.js.map +1 -0
  128. package/dist/tabEvents-9s2WCYw-.js +335 -0
  129. package/dist/tabEvents-9s2WCYw-.js.map +1 -0
  130. package/dist/{tolerantWebAccess-BZYWt09Y.js → tolerantWebAccess-iUu80pAP.js} +9 -9
  131. package/dist/{tolerantWebAccess-BZYWt09Y.js.map → tolerantWebAccess-iUu80pAP.js.map} +1 -1
  132. package/dist/{updateSeedRevokedAt-D_EG-q3b.js → updateSeedRevokedAt-zBfi931j.js} +3 -3
  133. package/dist/{updateSeedRevokedAt-D_EG-q3b.js.map → updateSeedRevokedAt-zBfi931j.js.map} +1 -1
  134. package/package.json +11 -12
  135. package/src/node/easLodashRegister.js +4 -0
  136. package/dist/BasePathResolver-CfSfMW5_.js +0 -676
  137. package/dist/BasePathResolver-CfSfMW5_.js.map +0 -1
  138. package/dist/ClientManager-C-QXqUK9.js.map +0 -1
  139. package/dist/Item-C7sUUu2B.js.map +0 -1
  140. package/dist/ModelProperty-DJxeOOrc.js.map +0 -1
  141. package/dist/Schema-fXtvd-yL.js.map +0 -1
  142. package/dist/cjs/ModelProperty-DXZ39Wyv.js +0 -1978
  143. package/dist/cjs/ModelProperty-DXZ39Wyv.js.map +0 -1
  144. package/dist/cjs/Schema-DdP109QD.js +0 -5257
  145. package/dist/cjs/Schema-DdP109QD.js.map +0 -1
  146. package/dist/cjs/SchemaValidationService-CSXxx7sQ.js +0 -779
  147. package/dist/cjs/SchemaValidationService-CSXxx7sQ.js.map +0 -1
  148. package/dist/cjs/backfillMetadataPropertyIds-CPYoaMl4.js +0 -90
  149. package/dist/cjs/backfillMetadataPropertyIds-CPYoaMl4.js.map +0 -1
  150. package/dist/cjs/eas-B2YDQssV.js +0 -139
  151. package/dist/cjs/eas-B2YDQssV.js.map +0 -1
  152. package/dist/cjs/getItem-DgnaQzbE.js +0 -59
  153. package/dist/cjs/getItem-DgnaQzbE.js.map +0 -1
  154. package/dist/cjs/getPublishPayload-CqlqRdot.js +0 -1604
  155. package/dist/cjs/getPublishPayload-CqlqRdot.js.map +0 -1
  156. package/dist/cjs/getPublishUploads-DsXY9S4U.js +0 -872
  157. package/dist/cjs/getPublishUploads-DsXY9S4U.js.map +0 -1
  158. package/dist/cjs/index-BHaWOwNF.js +0 -71
  159. package/dist/cjs/index-BHaWOwNF.js.map +0 -1
  160. package/dist/cjs/index-C4XlgCJ4.js +0 -22801
  161. package/dist/cjs/index-C4XlgCJ4.js.map +0 -1
  162. package/dist/cjs/index.browser-BSf8HpnU.js +0 -22
  163. package/dist/cjs/index.browser-BSf8HpnU.js.map +0 -1
  164. package/dist/cjs/property-fa0iju0J.js +0 -328
  165. package/dist/cjs/property-fa0iju0J.js.map +0 -1
  166. package/dist/cjs/publishDraftGraph-3ASwAlD7.js +0 -403
  167. package/dist/cjs/publishDraftGraph-3ASwAlD7.js.map +0 -1
  168. package/dist/cjs/resetAmbiguousLegacyItemData-Bu_MBBYt.js +0 -117
  169. package/dist/cjs/resetAmbiguousLegacyItemData-Bu_MBBYt.js.map +0 -1
  170. package/dist/cjs/resolveModelForSyncedSeed-BANIiuFU.js +0 -49
  171. package/dist/cjs/resolveModelForSyncedSeed-BANIiuFU.js.map +0 -1
  172. package/dist/cjs/syncDbWithEas-CrmxxmUW.js +0 -887
  173. package/dist/cjs/syncDbWithEas-CrmxxmUW.js.map +0 -1
  174. package/dist/db-D9K_f5cF.js.map +0 -1
  175. package/dist/eas-DHxfswCt.js.map +0 -1
  176. package/dist/getPublishPayload-BHrxVtzY.js.map +0 -1
  177. package/dist/index-CiMEoGu3.js +0 -32
  178. package/dist/index-CiMEoGu3.js.map +0 -1
  179. package/dist/index-DglvthOk.js.map +0 -1
  180. package/dist/index-s15q14rm.js.map +0 -1
  181. package/dist/index.node-C30dmFgn.js.map +0 -1
  182. package/dist/main.cjs +0 -85
  183. package/dist/main.cjs.map +0 -1
  184. package/dist/property-DhmmYAvQ.js.map +0 -1
  185. package/dist/syncDbWithEas--HUA9WNb.js.map +0 -1
  186. package/dist/tabEvents-DguZpCCv.js +0 -1580
  187. package/dist/tabEvents-DguZpCCv.js.map +0 -1
@@ -1,17 +1,21 @@
1
1
  import { waitFor, fromCallback, setup, assign, stateIn, createActor, isMachineSnapshot } from 'xstate';
2
- import { B as BaseDb, v as versions, m as metadata, q as seeds, s as schemas, i as models, f as modelSchemas, Z as ZERO_BYTES32, I as INTERNAL_PROPERTY_NAMES, t as BaseFileManager, D as ImageSize, p as properties, x as INTERNAL_DATA_TYPES, g as modelUids, C as INTERNAL_STORAGE_MODEL_FILE_IDS, P as PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP } from './BasePathResolver-CfSfMW5_.js';
2
+ import { n as normalizeDataType, E as BaseDb, C as versions, m as metadata, A as seeds, z as schemas, s as models, q as modelSchemas, aQ as getOwnedAddressesFromDb, a9 as ZERO_BYTES32, aB as normalizeAddressList, a0 as normalizeHexAddress, ay as getAddressesForItemsFilter, H as toSnakeCase$1, ad as INTERNAL_PROPERTY_NAMES, J as BaseFileManager, aS as getStorageTransactionIdForSeedUid, aT as convertTxIdToImage, i as isDataType, X as normalizePublisher, ax as ensureImageLocal, ap as ImageSize, aU as downloadTransactionIdWithDedupe, u as properties, M as ModelPropertyDataTypes, $ as generateId, ag as INTERNAL_DATA_TYPES, r as modelUids, L as resolveItemModelFileId, aV as getPropertyIdForSchemaFileId, K as getPropertyIdForModelAndName, aW as getDataTypeFromString, aX as getMimeType, am as INTERNAL_STORAGE_MODEL_FILE_IDS, V as getItemStorageSubdir, W as getItemStorageLocalFileName, g as normalizePropertyRecordSchema, aY as PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP, a5 as getCorrectId, G as eventEmitter, ae as isStorageSeedRef } from './BasePathResolver-Cm4apKRb.js';
3
3
  import { or, isNull, eq, max, count, and, getTableColumns, sql, desc, inArray, isNotNull, gt } from 'drizzle-orm';
4
4
  import pluralize from 'pluralize';
5
- import { n as normalizeDataType, W as getOwnedAddressesFromDb, E as normalizeAddressList, u as normalizeHexAddress, z as getAddressesForItemsFilter, k as isDataType, s as normalizePublisher, M as ModelPropertyDataTypes, r as resolveItemModelFileId, X as getPropertyIdForSchemaFileId, o as getPropertyIdForModelAndName, l as normalizePropertyRecordSchema, m as eventEmitter } from './db-D9K_f5cF.js';
6
5
  import debug from 'debug';
7
6
  import { BehaviorSubject } from 'rxjs';
8
7
  import { startCase, upperFirst, camelCase, orderBy } from 'lodash-es';
9
8
  import { toSnakeCase } from 'drizzle-orm/casing';
10
9
  import { isValidEasAttestationUid, isPlaceholderUid, BaseQueryClient, BaseEasClient, GET_SCHEMAS, getEasSchemaUidForSchemaDefinition, getSchemaUidForModelFromCache, cachedSchemaLookup, setSchemaUidForModel, getEasSchemaUidForExactDefinition } from '@seedprotocol/eas';
11
- import { t as toSnakeCase$1, Q as getStorageTransactionIdForSeedUid, R as convertTxIdToImage, q as ensureImageLocal, S as downloadTransactionIdWithDedupe, j as generateId, U as getDataTypeFromString, V as getMimeType, W as notifyFileSaved, X as withTabLock, a as getItemStorageSubdir, c as getItemStorageLocalFileName, e as getCorrectId, f as isStorageSeedRef } from './tabEvents-DguZpCCv.js';
12
10
  import { fetchArweaveRawTextAcrossGateways } from '@seedprotocol/arweave';
11
+ import { d as notifyFileSaved, f as withTabLock } from './tabEvents-9s2WCYw-.js';
13
12
  import { modelPropertiesToObject } from './model-DGMe-TTm.js';
14
13
 
14
+ /**
15
+ * Default readyTimeout for create/find/all with waitForReady. Loads that touch OPFS and the DB can take
16
+ * several seconds on slow devices and CI runners; a load that is really stuck still errors.
17
+ */
18
+ const DEFAULT_READY_TIMEOUT_MS = 15000;
15
19
  /**
16
20
  * Wait for an entity's state machine to reach 'idle' state
17
21
  * @param entity - Entity instance with getService() method
@@ -19,7 +23,7 @@ import { modelPropertiesToObject } from './model-DGMe-TTm.js';
19
23
  * @returns Promise that resolves when entity reaches idle, or rejects on error/timeout
20
24
  */
21
25
  async function waitForEntityIdle(entity, options = {}) {
22
- const { timeout = 5000, throwOnError = true } = options;
26
+ const { timeout = DEFAULT_READY_TIMEOUT_MS, throwOnError = true } = options;
23
27
  const service = entity.getService();
24
28
  const currentSnapshot = service.getSnapshot();
25
29
  const isSnapshotIdle = (snapshot) => {
@@ -93,10 +97,20 @@ async function getPublisherForNewSeedsWithTimeout() {
93
97
  return undefined;
94
98
  }
95
99
  }
100
+ let publishExecutor = null;
101
+ function setPublishExecutor(executor) {
102
+ publishExecutor = executor;
103
+ }
104
+ function getPublishExecutor() {
105
+ return publishExecutor;
106
+ }
107
+ const PUBLISH_NOT_CONFIGURED_MESSAGE = 'Publishing is not configured. item.publish() needs @seedprotocol/publish: call initPublish() from it, or mount <PublishProvider config={...}>, before publishing.';
96
108
  let uploadExecutor = null;
109
+ /** @deprecated See UploadExecutor. */
97
110
  function setUploadExecutor(executor) {
98
111
  uploadExecutor = executor;
99
112
  }
113
+ /** @deprecated See UploadExecutor. */
100
114
  function getUploadExecutor() {
101
115
  return uploadExecutor;
102
116
  }
@@ -117,13 +131,16 @@ function getGetAdditionalSyncAddresses() {
117
131
 
118
132
  var publishConfig = /*#__PURE__*/Object.freeze({
119
133
  __proto__: null,
134
+ PUBLISH_NOT_CONFIGURED_MESSAGE: PUBLISH_NOT_CONFIGURED_MESSAGE,
120
135
  getGetAdditionalSyncAddresses: getGetAdditionalSyncAddresses,
121
136
  getGetPublisherForNewSeeds: getGetPublisherForNewSeeds,
137
+ getPublishExecutor: getPublishExecutor,
122
138
  getPublisherForNewSeedsWithTimeout: getPublisherForNewSeedsWithTimeout,
123
139
  getRevokeExecutor: getRevokeExecutor,
124
140
  getUploadExecutor: getUploadExecutor,
125
141
  setAdditionalSyncAddresses: setAdditionalSyncAddresses,
126
142
  setGetPublisherForNewSeeds: setGetPublisherForNewSeeds,
143
+ setPublishExecutor: setPublishExecutor,
127
144
  setRevokeExecutor: setRevokeExecutor,
128
145
  setUploadExecutor: setUploadExecutor
129
146
  });
@@ -708,7 +725,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
708
725
  const itemPropertyMod = await Promise.resolve().then(function () { return ItemProperty$1; });
709
726
  const { ItemProperty } = itemPropertyMod;
710
727
  const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
711
- const _mod_0 = await import('./index-s15q14rm.js');
728
+ const _mod_0 = await import('./index-8O3Uow-Y.js');
712
729
  const _ns_0 = _mod_0.f;
713
730
  const { Model } = _ns_0;
714
731
  // Resolve Model and build property schemas (use getByNameAsync for models not yet in cache)
@@ -726,7 +743,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
726
743
  const schemaNameToTry = schemaName ?? model?.schemaName;
727
744
  if (schemaNameToTry) {
728
745
  try {
729
- const _mod_1 = await import('./Schema-fXtvd-yL.js');
746
+ const _mod_1 = await import('./Schema-CpMNEnUO.js');
730
747
  const _ns_1 = _mod_1.b;
731
748
  const { Schema } = _ns_1;
732
749
  const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false });
@@ -742,8 +759,8 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
742
759
  }
743
760
  if (Object.keys(propertySchemas).length === 0) {
744
761
  try {
745
- const _mod_2 = await import('./ClientManager-C-QXqUK9.js');
746
- const _ns_2 = _mod_2.I;
762
+ const _mod_2 = await import('./ClientManager-i3nJASkg.js');
763
+ const _ns_2 = _mod_2.K;
747
764
  const { loadAllSchemasFromDb } = _ns_2;
748
765
  const allSchemas = await loadAllSchemasFromDb();
749
766
  for (const { schema: schemaFile } of allSchemas) {
@@ -763,11 +780,11 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
763
780
  }
764
781
  if (Object.keys(propertySchemas).length === 0) {
765
782
  try {
766
- const _mod_3 = await import('./ClientManager-C-QXqUK9.js');
767
- const _ns_3 = _mod_3.I;
783
+ const _mod_3 = await import('./ClientManager-i3nJASkg.js');
784
+ const _ns_3 = _mod_3.K;
768
785
  const { listCompleteSchemaFiles } = _ns_3;
769
- const _mod_4 = await import('./BasePathResolver-CfSfMW5_.js');
770
- const _ns_4 = _mod_4.O;
786
+ const _mod_4 = await import('./BasePathResolver-Cm4apKRb.js');
787
+ const _ns_4 = _mod_4.a_;
771
788
  const { BaseFileManager } = _ns_4;
772
789
  const schemaFiles = await listCompleteSchemaFiles();
773
790
  for (const { filePath } of schemaFiles) {
@@ -787,7 +804,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
787
804
  }
788
805
  }
789
806
  if (Object.keys(propertySchemas).length === 0) {
790
- const schemaMod = await import('./index-CiMEoGu3.js');
807
+ const schemaMod = await import('./index-Cvt5UBz4.js');
791
808
  const { ModelPropertyDataTypes } = schemaMod;
792
809
  const KNOWN_MODEL_FALLBACKS = {
793
810
  Post: {
@@ -804,7 +821,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
804
821
  }
805
822
  }
806
823
  // Fallbacks above may return schema-file shape ({ type, model, items }); normalize to dataType/ref/refValueType.
807
- const { normalizePropertyRecordSchema } = await import('./property-DhmmYAvQ.js');
824
+ const { normalizePropertyRecordSchema } = await import('./property-DwPD283A.js');
808
825
  propertySchemas = Object.fromEntries(Object.entries(propertySchemas).map(([name, def]) => [name, normalizePropertyRecordSchema(def)]));
809
826
  // Collapse rows that map to the same instance key (e.g. authorIdentityIds + authors -> authors).
810
827
  // ItemProperty.create cache does not sync propertyValue on hit; processing order would otherwise
@@ -837,7 +854,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
837
854
  // Infer propertyRecordSchema from metadata when schema is missing (enables persistence)
838
855
  let propSchema = propertySchemas[propertyName];
839
856
  if (!propSchema && isRefTypeFromMeta) {
840
- const schemaMod = await import('./index-CiMEoGu3.js');
857
+ const schemaMod = await import('./index-Cvt5UBz4.js');
841
858
  const { ModelPropertyDataTypes } = schemaMod;
842
859
  propSchema = {
843
860
  dataType: refSeedType === 'html' ? ModelPropertyDataTypes.Html
@@ -1089,48 +1106,36 @@ const loadOrCreateItem = fromCallback(({ sendBack, input: { context } }) => {
1089
1106
  });
1090
1107
 
1091
1108
  const logger$7 = debug('seedSdk:Item:runPublish');
1092
- const runPublish = fromCallback(({ sendBack, input: { context } }) => {
1109
+ /**
1110
+ * Runs the publish for item.publish() by handing the item to the PublishExecutor that
1111
+ * @seedprotocol/publish registers, which uploads to Arweave and writes to EAS.
1112
+ */
1113
+ const runPublish = fromCallback(({ sendBack, input: { context, item: itemFromEvent, options } }) => {
1093
1114
  const { seedLocalId } = context;
1094
1115
  const _runPublish = async () => {
1095
1116
  if (!seedLocalId) {
1096
1117
  sendBack({ type: 'publishError', error: new Error('Item has no seedLocalId') });
1097
1118
  return;
1098
1119
  }
1120
+ const executor = getPublishExecutor();
1121
+ if (!executor) {
1122
+ sendBack({ type: 'publishError', error: new Error(PUBLISH_NOT_CONFIGURED_MESSAGE) });
1123
+ return;
1124
+ }
1099
1125
  try {
1100
- const itemMod = await Promise.resolve().then(function () { return Item$1; });
1101
- const { Item } = itemMod;
1102
- const item = await Item.find({ seedLocalId });
1126
+ // item.publish() sends its own instance; look it up only if startPublish came without one.
1127
+ const item = itemFromEvent ??
1128
+ (await (await Promise.resolve().then(function () { return Item$1; })).Item.find({ seedLocalId }));
1103
1129
  if (!item) {
1104
- sendBack({ type: 'publishError', error: new Error(`Item not found for seedLocalId: ${seedLocalId}`) });
1130
+ sendBack({ type: 'publishError', error: new Error(`Item not found: ${seedLocalId}`) });
1105
1131
  return;
1106
1132
  }
1107
- const getPublishUploadsMod = await import('./getPublishUploads-BEqRiKIS.js');
1108
- const { getPublishUploads } = getPublishUploadsMod;
1109
- const _mod_5 = await import('./getPublishPayload-BHrxVtzY.js');
1110
- const _ns_5 = _mod_5.g;
1111
- const getPublishPayloadMod = _ns_5;
1112
- const { getPublishPayload } = getPublishPayloadMod;
1113
- const uploads = await getPublishUploads(item);
1114
- let uploadedTransactions = [];
1115
- const executor = getUploadExecutor();
1116
- if (executor && uploads.length > 0) {
1117
- for (const upload of uploads) {
1118
- const { txId } = await executor(upload);
1119
- uploadedTransactions.push({
1120
- txId,
1121
- seedLocalId: upload.seedLocalId,
1122
- versionLocalId: upload.versionLocalId,
1123
- });
1124
- }
1125
- }
1126
- await getPublishPayload(item, uploadedTransactions);
1127
- logger$7('runPublish: payload prepared (upload/EAS submit stubbed)');
1133
+ await executor(item, options);
1128
1134
  sendBack({ type: 'publishSuccess' });
1129
1135
  }
1130
- catch (err) {
1131
- const error = err instanceof Error ? err : new Error(String(err));
1136
+ catch (error) {
1132
1137
  logger$7('runPublish error:', error);
1133
- sendBack({ type: 'publishError', error });
1138
+ sendBack({ type: 'publishError', error: error instanceof Error ? error : new Error(String(error)) });
1134
1139
  }
1135
1140
  };
1136
1141
  _runPublish();
@@ -1258,7 +1263,11 @@ const itemMachineSingle = setup({
1258
1263
  },
1259
1264
  invoke: {
1260
1265
  src: 'runPublish',
1261
- input: ({ context }) => ({ context }),
1266
+ input: ({ context, event }) => ({
1267
+ context,
1268
+ item: event.item,
1269
+ options: event.options,
1270
+ }),
1262
1271
  },
1263
1272
  },
1264
1273
  waitingForDb: {
@@ -1656,6 +1665,17 @@ async function batchLatestPublishedVersionBySeedLocalIds(seedLocalIds) {
1656
1665
  }
1657
1666
 
1658
1667
  const READ_ONLY_ERROR = 'Item is read-only: you do not own this item';
1668
+ /**
1669
+ * Thrown by write operations (save, destroy, publish, unpublish) on an item none
1670
+ * of the client's addresses own. See isItemOwned for what counts as owned.
1671
+ */
1672
+ class OwnershipError extends Error {
1673
+ constructor(message = READ_ONLY_ERROR) {
1674
+ super(message);
1675
+ this.name = 'OwnershipError';
1676
+ Object.setPrototypeOf(this, OwnershipError.prototype);
1677
+ }
1678
+ }
1659
1679
  async function getSeedRowForItem(item) {
1660
1680
  const appDb = BaseDb.getAppDb();
1661
1681
  if (!appDb)
@@ -1794,17 +1814,19 @@ async function isItemOwned(item) {
1794
1814
  return isSeedRowOwned(row, ownedAddresses);
1795
1815
  }
1796
1816
  /**
1797
- * Throws if the item is not owned. Use before write operations (publish, save, destroy).
1817
+ * Throws OwnershipError if the item is not owned. Use before write operations
1818
+ * (publish, save, destroy).
1798
1819
  */
1799
1820
  async function assertItemOwned(item) {
1800
1821
  const owned = await isItemOwned(item);
1801
1822
  if (!owned) {
1802
- throw new Error(READ_ONLY_ERROR);
1823
+ throw new OwnershipError();
1803
1824
  }
1804
1825
  }
1805
1826
 
1806
1827
  var ownership = /*#__PURE__*/Object.freeze({
1807
1828
  __proto__: null,
1829
+ OwnershipError: OwnershipError,
1808
1830
  assertItemOwned: assertItemOwned,
1809
1831
  isItemOwned: isItemOwned,
1810
1832
  isLocalUnsealedDraft: isLocalUnsealedDraft,
@@ -1838,9 +1860,9 @@ const getItemsData = async ({ modelName, modelFileId, schemaName, deleted, inclu
1838
1860
  conditions.push(eq(seeds.type, toSnakeCase(modelName)));
1839
1861
  }
1840
1862
  if (!modelFileId && schemaName && modelName) {
1841
- const _mod_6 = await import('./db-D9K_f5cF.js');
1842
- const _ns_6 = _mod_6.Y;
1843
- const { resolveModelRecord } = _ns_6;
1863
+ const _mod_5 = await import('./BasePathResolver-Cm4apKRb.js');
1864
+ const _ns_5 = _mod_5.b1;
1865
+ const { resolveModelRecord } = _ns_5;
1844
1866
  modelFileId = (await resolveModelRecord(modelName, { schemaName }))?.schemaFileId ?? undefined;
1845
1867
  if (!modelFileId)
1846
1868
  return []; // that schema has no such model
@@ -2121,7 +2143,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
2121
2143
  const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
2122
2144
  const _resolveRelatedValue = async () => {
2123
2145
  // Use dynamic import to break circular dependency
2124
- const schemaMod = await import('./index-CiMEoGu3.js');
2146
+ const schemaMod = await import('./index-Cvt5UBz4.js');
2125
2147
  const { ModelPropertyDataTypes } = schemaMod;
2126
2148
  if (!propertyValue || !isRelation || populatedFromDb) {
2127
2149
  return;
@@ -2556,9 +2578,9 @@ async function readHtmlBodyFromChildStorageArweave(seedLocalId) {
2556
2578
  /* offline / bad tx id */
2557
2579
  }
2558
2580
  try {
2559
- const _mod_7 = await import('./tabEvents-DguZpCCv.js');
2560
- const _ns_7 = _mod_7.Y;
2561
- const { downloadTransactionIdWithDedupe } = _ns_7;
2581
+ const _mod_6 = await import('./BasePathResolver-Cm4apKRb.js');
2582
+ const _ns_6 = _mod_6.b3;
2583
+ const { downloadTransactionIdWithDedupe } = _ns_6;
2562
2584
  await downloadTransactionIdWithDedupe(txId);
2563
2585
  const retryFp = BaseFileManager.getFilesPath('html', `${seedLocalId}.html`);
2564
2586
  if (await BaseFileManager.pathExists(retryFp)) {
@@ -2617,7 +2639,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
2617
2639
  // to use dynamically imported ModelPropertyDataTypes
2618
2640
  const _hydrateFromDb = async () => {
2619
2641
  // Use dynamic import to break circular dependency
2620
- const schemaMod = await import('./index-CiMEoGu3.js');
2642
+ const schemaMod = await import('./index-Cvt5UBz4.js');
2621
2643
  const { ModelPropertyDataTypes } = schemaMod;
2622
2644
  const appDb = BaseDb.getAppDb();
2623
2645
  const whereClauses = [];
@@ -2896,13 +2918,13 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
2896
2918
  const modelNameForNew = context.modelName;
2897
2919
  if (modelNameForNew) {
2898
2920
  try {
2899
- const _mod_8 = await import('./index-s15q14rm.js');
2900
- const _ns_8 = _mod_8.f;
2901
- const { Model } = _ns_8;
2921
+ const _mod_7 = await import('./index-8O3Uow-Y.js');
2922
+ const _ns_7 = _mod_7.f;
2923
+ const { Model } = _ns_7;
2902
2924
  const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
2903
- const _mod_9 = await import('./db-D9K_f5cF.js');
2904
- const _ns_9 = _mod_9.Y;
2905
- const { resolveItemModelFileId } = _ns_9;
2925
+ const _mod_8 = await import('./BasePathResolver-Cm4apKRb.js');
2926
+ const _ns_8 = _mod_8.b1;
2927
+ const { resolveItemModelFileId } = _ns_8;
2906
2928
  const normalizedModelName = upperFirst(camelCase(modelNameForNew));
2907
2929
  const itemModelFileId = await resolveItemModelFileId({
2908
2930
  modelFileId: context.modelFileId,
@@ -2954,9 +2976,9 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
2954
2976
  // It ends up in the context below, and later lookups by name (Model.getByName) can't match it.
2955
2977
  const modelName = context.modelName || (metadataRecord.modelType ? upperFirst(camelCase(metadataRecord.modelType)) : undefined);
2956
2978
  // Model names are only unique per schema: pin lookups to the item's own model row.
2957
- const _mod_10 = await import('./db-D9K_f5cF.js');
2958
- const _ns_10 = _mod_10.Y;
2959
- const { resolveItemModelFileId, resolveModelRecord } = _ns_10;
2979
+ const _mod_9 = await import('./BasePathResolver-Cm4apKRb.js');
2980
+ const _ns_9 = _mod_9.b1;
2981
+ const { resolveItemModelFileId, resolveModelRecord } = _ns_9;
2960
2982
  const modelFileId = await resolveItemModelFileId({
2961
2983
  modelFileId: context.modelFileId,
2962
2984
  seedLocalId: seedLocalId ?? metadataRecord.seedLocalId,
@@ -3000,18 +3022,18 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
3000
3022
  };
3001
3023
  // Merge with schema from file/DB to get validation rules (enum, pattern, etc.) - properties table doesn't store these
3002
3024
  try {
3003
- const { getPropertySchema } = await import('./property-DhmmYAvQ.js');
3025
+ const { getPropertySchema } = await import('./property-DwPD283A.js');
3004
3026
  let schemaFromFile = await getPropertySchema(normalizedModelName, propertyName, {
3005
3027
  modelFileId: modelRecord?.schemaFileId ?? modelFileId,
3006
3028
  });
3007
3029
  if (!schemaFromFile?.validation) {
3008
3030
  // Fallback: get validation from schemaData in database (Schema context may not be loaded yet)
3009
- const _mod_11 = await import('./BasePathResolver-CfSfMW5_.js');
3010
- const _ns_11 = _mod_11.Q;
3011
- const { schemas: schemasTable } = _ns_11;
3012
- const _mod_12 = await import('./BasePathResolver-CfSfMW5_.js');
3013
- const _ns_12 = _mod_12.R;
3014
- const { modelSchemas } = _ns_12;
3031
+ const _mod_10 = await import('./BasePathResolver-Cm4apKRb.js');
3032
+ const _ns_10 = _mod_10.a$;
3033
+ const { schemas: schemasTable } = _ns_10;
3034
+ const _mod_11 = await import('./BasePathResolver-Cm4apKRb.js');
3035
+ const _ns_11 = _mod_11.b0;
3036
+ const { modelSchemas } = _ns_11;
3015
3037
  const modelSchemaRows = await db
3016
3038
  .select({ schemaId: modelSchemas.schemaId })
3017
3039
  .from(modelSchemas)
@@ -3050,9 +3072,9 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
3050
3072
  }
3051
3073
  if (!propertyRecordSchema && modelName) {
3052
3074
  try {
3053
- const _mod_13 = await import('./index-s15q14rm.js');
3054
- const _ns_13 = _mod_13.f;
3055
- const { Model } = _ns_13;
3075
+ const _mod_12 = await import('./index-8O3Uow-Y.js');
3076
+ const _ns_12 = _mod_12.f;
3077
+ const { Model } = _ns_12;
3056
3078
  const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
3057
3079
  const normalizedModelName = upperFirst(camelCase(modelName));
3058
3080
  // Try PascalCase first ("post" -> "Post"); then findByModelType for names with spaces ("new_model" -> "New model")
@@ -3426,10 +3448,16 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
3426
3448
  throw new Error('Missing propertyRecordSchema');
3427
3449
  }
3428
3450
  const _analyzeInput = async () => {
3451
+ // Assignment writes straight to the DB, so check ownership here as save()/destroy()/publish() do.
3452
+ const { isItemOwned, OwnershipError } = await Promise.resolve().then(function () { return ownership; });
3453
+ if (!(await isItemOwned({ seedLocalId: seedLocalId ?? undefined, seedUid: context.seedUid ?? undefined }))) {
3454
+ sendBack({ type: 'saveFailed', error: new OwnershipError() });
3455
+ return false;
3456
+ }
3429
3457
  // Use dynamic import to break circular dependency
3430
- const schemaMod = await import('./index-CiMEoGu3.js');
3458
+ const schemaMod = await import('./index-Cvt5UBz4.js');
3431
3459
  const { ModelPropertyDataTypes } = schemaMod;
3432
- const { SchemaValidationService } = await import('./SchemaValidationService-CvRS2HSO.js');
3460
+ const { SchemaValidationService } = await import('./SchemaValidationService-DieV4KL-.js');
3433
3461
  let propertyName = propertyNameRaw;
3434
3462
  if (!propertyName) {
3435
3463
  throw new Error('propertyName is required');
@@ -3583,6 +3611,8 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
3583
3611
  if (isDone) {
3584
3612
  sendBack({ type: 'saveValueToDbSuccess' });
3585
3613
  }
3614
+ }, (error) => {
3615
+ sendBack({ type: 'saveFailed', error });
3586
3616
  });
3587
3617
  });
3588
3618
 
@@ -3719,7 +3749,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
3719
3749
  propertyRecordSchema?.validation &&
3720
3750
  metadataValues.propertyValue != null &&
3721
3751
  metadataValues.propertyValue !== '') {
3722
- const { SchemaValidationService } = await import('./SchemaValidationService-CvRS2HSO.js');
3752
+ const { SchemaValidationService } = await import('./SchemaValidationService-DieV4KL-.js');
3723
3753
  const validationService = new SchemaValidationService();
3724
3754
  const validationResult = validationService.validatePropertyValue(metadataValues.propertyValue, normalizeDataType(propertyRecordSchema.dataType), propertyRecordSchema.validation, propertyRecordSchema.refValueType
3725
3755
  ? normalizeDataType(String(propertyRecordSchema.refValueType))
@@ -4301,7 +4331,7 @@ const saveRelation = fromCallback(({ sendBack, input: { context, event } }) => {
4301
4331
  }
4302
4332
  const _saveRelation = async () => {
4303
4333
  // Use dynamic import to break circular dependency
4304
- const schemaMod = await import('./index-CiMEoGu3.js');
4334
+ const schemaMod = await import('./index-Cvt5UBz4.js');
4305
4335
  const { ModelPropertyDataTypes } = schemaMod;
4306
4336
  if (!propertyNameRaw) {
4307
4337
  throw new Error('propertyName is required');
@@ -4679,9 +4709,23 @@ const propertyMachine = setup({
4679
4709
  isSaving: true,
4680
4710
  _saveError: undefined,
4681
4711
  _saveValidationErrors: undefined,
4712
+ _valueBeforeSave: ({ event }) => event.before,
4682
4713
  }),
4683
4714
  target: '.saving',
4684
4715
  },
4716
+ /** analyzeInput refused (item not owned) or failed before writing: restore the shown value. */
4717
+ saveFailed: {
4718
+ target: '.idle',
4719
+ actions: assign(({ context, event }) => {
4720
+ const error = event.error;
4721
+ return {
4722
+ isSaving: false,
4723
+ _saveError: error instanceof Error ? { message: error.message, name: error.name } : { message: String(error) },
4724
+ ...(context._valueBeforeSave ?? {}),
4725
+ _valueBeforeSave: undefined,
4726
+ };
4727
+ }),
4728
+ },
4685
4729
  updateContext: {
4686
4730
  actions: assign(({ context, event }) => {
4687
4731
  const newContext = Object.assign({}, context);
@@ -4981,12 +5025,12 @@ const getPropertyData = async ({ propertyName, seedLocalId, seedUid, modelName,
4981
5025
  let names = [...getMetadataPropertyNamesForQuery(propertyName)];
4982
5026
  if (modelName) {
4983
5027
  try {
4984
- const _mod_14 = await import('./index-s15q14rm.js');
4985
- const _ns_14 = _mod_14.f;
4986
- const { Model } = _ns_14;
4987
- const _mod_15 = await import('./db-D9K_f5cF.js');
4988
- const _ns_15 = _mod_15.Y;
4989
- const { resolveItemModelFileId } = _ns_15;
5028
+ const _mod_13 = await import('./index-8O3Uow-Y.js');
5029
+ const _ns_13 = _mod_13.f;
5030
+ const { Model } = _ns_13;
5031
+ const _mod_14 = await import('./BasePathResolver-Cm4apKRb.js');
5032
+ const _ns_14 = _mod_14.b1;
5033
+ const { resolveItemModelFileId } = _ns_14;
4990
5034
  // Model names are only unique per schema: use the seed's own model when it is recorded.
4991
5035
  const modelFileId = await resolveItemModelFileId({ seedLocalId, seedUid });
4992
5036
  const model = await Model.resolveAsync(modelName, { modelFileId });
@@ -5146,6 +5190,8 @@ function forceRemoveFromCaches(instance, config) {
5146
5190
  /**
5147
5191
  * Run the service event sequence and stop the service:
5148
5192
  * destroyStarted -> doDestroy -> (destroyError on failure) -> stop.
5193
+ * A doDestroy failure is recorded on the service (destroyError) and rethrown, so destroy()
5194
+ * rejects instead of resolving with the rows still in the DB.
5149
5195
  * Event names must match what the entity machines expect.
5150
5196
  */
5151
5197
  async function runDestroyLifecycle(instance, config) {
@@ -5156,6 +5202,7 @@ async function runDestroyLifecycle(instance, config) {
5156
5202
  }
5157
5203
  catch (error) {
5158
5204
  service.send({ type: 'destroyError', error });
5205
+ throw error;
5159
5206
  }
5160
5207
  finally {
5161
5208
  try {
@@ -5175,9 +5222,9 @@ const HTML_PROP_SEED_UID_RE = /^0x[a-fA-F0-9]{64}$/;
5175
5222
  */
5176
5223
  const resolvePropertyRecordSchemaFromSchemaData = async (modelName, propertyName, modelType, schemaName) => {
5177
5224
  try {
5178
- const _mod_16 = await import('./ClientManager-C-QXqUK9.js');
5179
- const _ns_16 = _mod_16.I;
5180
- const { loadAllSchemasFromDb } = _ns_16;
5225
+ const _mod_15 = await import('./ClientManager-i3nJASkg.js');
5226
+ const _ns_15 = _mod_15.K;
5227
+ const { loadAllSchemasFromDb } = _ns_15;
5181
5228
  const allSchemas = await loadAllSchemasFromDb();
5182
5229
  const modelNameAlt = modelType ? upperFirst(camelCase(modelType)) : '';
5183
5230
  for (const { schema } of allSchemas) {
@@ -5229,13 +5276,13 @@ hints = {}) => {
5229
5276
  return undefined;
5230
5277
  }
5231
5278
  try {
5232
- const _mod_17 = await import('./index-s15q14rm.js');
5233
- const _ns_17 = _mod_17.f;
5234
- const { Model } = _ns_17;
5279
+ const _mod_16 = await import('./index-8O3Uow-Y.js');
5280
+ const _ns_16 = _mod_16.f;
5281
+ const { Model } = _ns_16;
5235
5282
  const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
5236
- const _mod_18 = await import('./db-D9K_f5cF.js');
5237
- const _ns_18 = _mod_18.Y;
5238
- const { resolveItemModelFileId } = _ns_18;
5283
+ const _mod_17 = await import('./BasePathResolver-Cm4apKRb.js');
5284
+ const _ns_17 = _mod_17.b1;
5285
+ const { resolveItemModelFileId } = _ns_17;
5239
5286
  const modelFileId = await resolveItemModelFileId(hints);
5240
5287
  let model = modelFileId
5241
5288
  ? await Model.resolveAsync(modelName || modelTypeToModelName(modelType ?? ''), { modelFileId })
@@ -5393,7 +5440,7 @@ class ItemProperty {
5393
5440
  return;
5394
5441
  }
5395
5442
  // Use dynamic import to break circular dependency
5396
- const schemaMod = await import('./index-CiMEoGu3.js');
5443
+ const schemaMod = await import('./index-Cvt5UBz4.js');
5397
5444
  const { ModelPropertyDataTypes } = schemaMod;
5398
5445
  const { context } = snapshot;
5399
5446
  const { propertyRecordSchema } = context;
@@ -5564,9 +5611,9 @@ class ItemProperty {
5564
5611
  const normalizedRefValueType = normalizeDataType(propertyRecordSchema?.refValueType);
5565
5612
  const propertyNames = getMetadataPropertyNamesForQuery(propertyName, normalizedDataType, normalizedRefValueType);
5566
5613
  const propertyNameVariant = propertyNames.length > 1 ? propertyNames[1] : undefined;
5567
- const _mod_19 = await import('./index-DglvthOk.js');
5568
- const _ns_19 = _mod_19.s;
5569
- const seedSchemaMod = _ns_19;
5614
+ const _mod_18 = await import('./index-AVFTVp1m.js');
5615
+ const _ns_18 = _mod_18.s;
5616
+ const seedSchemaMod = _ns_18;
5570
5617
  const { metadata } = seedSchemaMod;
5571
5618
  const drizzleMod = await import('drizzle-orm');
5572
5619
  const { eq, and, or } = drizzleMod;
@@ -5780,9 +5827,9 @@ class ItemProperty {
5780
5827
  const ctx = this._service.getSnapshot().context;
5781
5828
  let modelFileId;
5782
5829
  try {
5783
- const _mod_20 = await import('./db-D9K_f5cF.js');
5784
- const _ns_20 = _mod_20.Y;
5785
- const { resolveItemModelFileId } = _ns_20;
5830
+ const _mod_19 = await import('./BasePathResolver-Cm4apKRb.js');
5831
+ const _ns_19 = _mod_19.b1;
5832
+ const { resolveItemModelFileId } = _ns_19;
5786
5833
  modelFileId = await resolveItemModelFileId({
5787
5834
  modelFileId: ctx.modelFileId,
5788
5835
  seedLocalId: ctx.seedLocalId,
@@ -5895,7 +5942,7 @@ class ItemProperty {
5895
5942
  }
5896
5943
  static create(props, options) {
5897
5944
  const waitForReady = options?.waitForReady !== false;
5898
- const readyTimeout = options?.readyTimeout ?? 5000;
5945
+ const readyTimeout = options?.readyTimeout ?? DEFAULT_READY_TIMEOUT_MS;
5899
5946
  const { propertyName, seedLocalId, seedUid, versionLocalId, versionUid } = props;
5900
5947
  if (!propertyName || (!seedLocalId && !seedUid)) {
5901
5948
  if (!waitForReady)
@@ -6081,7 +6128,7 @@ class ItemProperty {
6081
6128
  }
6082
6129
  return undefined;
6083
6130
  }
6084
- static async find({ propertyName, seedLocalId, seedUid, modelName: modelNameOption, waitForReady = true, readyTimeout = 5000, }) {
6131
+ static async find({ propertyName, seedLocalId, seedUid, modelName: modelNameOption, waitForReady = true, readyTimeout = DEFAULT_READY_TIMEOUT_MS, }) {
6085
6132
  if ((!seedLocalId && !seedUid) || !propertyName) {
6086
6133
  return undefined;
6087
6134
  }
@@ -6135,7 +6182,7 @@ class ItemProperty {
6135
6182
  * Loads property data via getItemProperties, creates instances via create, optionally waits for idle.
6136
6183
  */
6137
6184
  static async all(params, options) {
6138
- const { waitForReady = false, readyTimeout = 5000 } = options ?? {};
6185
+ const { waitForReady = false, readyTimeout = DEFAULT_READY_TIMEOUT_MS } = options ?? {};
6139
6186
  const { seedLocalId, seedUid } = params;
6140
6187
  if (!seedLocalId && !seedUid) {
6141
6188
  return [];
@@ -6143,9 +6190,9 @@ class ItemProperty {
6143
6190
  const propertiesData = await getItemProperties({ seedLocalId, seedUid });
6144
6191
  const instances = [];
6145
6192
  const seenNormalized = new Set();
6146
- const _mod_21 = await import('./db-D9K_f5cF.js');
6147
- const _ns_21 = _mod_21.Y;
6148
- const { resolveItemModelFileId } = _ns_21;
6193
+ const _mod_20 = await import('./BasePathResolver-Cm4apKRb.js');
6194
+ const _ns_20 = _mod_20.b1;
6195
+ const { resolveItemModelFileId } = _ns_20;
6149
6196
  const itemModelFileId = await resolveItemModelFileId({ seedLocalId, seedUid });
6150
6197
  for (const data of propertiesData) {
6151
6198
  const d = data;
@@ -6161,9 +6208,9 @@ class ItemProperty {
6161
6208
  }
6162
6209
  else if (baseName) {
6163
6210
  try {
6164
- const _mod_22 = await import('./index-s15q14rm.js');
6165
- const _ns_22 = _mod_22.f;
6166
- const { Model } = _ns_22;
6211
+ const _mod_21 = await import('./index-8O3Uow-Y.js');
6212
+ const _ns_21 = _mod_21.f;
6213
+ const { Model } = _ns_21;
6167
6214
  const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
6168
6215
  const model = await Model.resolveAsync(modelName, { modelFileId });
6169
6216
  if (model?.properties) {
@@ -6178,9 +6225,9 @@ class ItemProperty {
6178
6225
  }
6179
6226
  if (modelName && propertyName) {
6180
6227
  try {
6181
- const _mod_23 = await import('./index-s15q14rm.js');
6182
- const _ns_23 = _mod_23.f;
6183
- const { Model } = _ns_23;
6228
+ const _mod_22 = await import('./index-8O3Uow-Y.js');
6229
+ const _ns_22 = _mod_22.f;
6230
+ const { Model } = _ns_22;
6184
6231
  const { modelPropertiesToObject } = await import('./model-DGMe-TTm.js');
6185
6232
  const model = await Model.resolveAsync(modelName, { modelFileId });
6186
6233
  if (model?.properties?.length) {
@@ -6336,6 +6383,8 @@ class ItemProperty {
6336
6383
  if (currentValue === value) {
6337
6384
  return;
6338
6385
  }
6386
+ // Restored if the save is refused (item not owned) or fails.
6387
+ const before = { propertyValue: context.propertyValue, renderValue: context.renderValue };
6339
6388
  // Update context immediately so UI shows the value before save completes
6340
6389
  this._service.send({
6341
6390
  type: 'updateContext',
@@ -6354,7 +6403,7 @@ class ItemProperty {
6354
6403
  if (!schema)
6355
6404
  return false;
6356
6405
  this._service.send({ type: 'updateContext', propertyRecordSchema: schema });
6357
- this._service.send({ type: 'save', newValue: value });
6406
+ this._service.send({ type: 'save', newValue: value, before });
6358
6407
  return true;
6359
6408
  }, () => false);
6360
6409
  this._pendingSchemaSave = pending;
@@ -6367,6 +6416,7 @@ class ItemProperty {
6367
6416
  this._service.send({
6368
6417
  type: 'save',
6369
6418
  newValue: value,
6419
+ before,
6370
6420
  });
6371
6421
  }
6372
6422
  }
@@ -6476,10 +6526,17 @@ class ItemProperty {
6476
6526
  }
6477
6527
  }
6478
6528
  /**
6479
- * Destroy the item property: remove from caches, delete metadata from DB, remove from parent Item, stop service.
6529
+ * Destroy the item property: remove from caches, delete its metadata rows (every version of
6530
+ * this item's value) from the DB, remove it from the parent Item, and stop the service.
6531
+ * Throws OwnershipError if none of the client's addresses own the item.
6480
6532
  */
6481
6533
  async destroy() {
6482
6534
  const context = this._getSnapshotContext();
6535
+ const { assertItemOwned } = await Promise.resolve().then(function () { return ownership; });
6536
+ await assertItemOwned({
6537
+ seedLocalId: context.seedLocalId ?? undefined,
6538
+ seedUid: context.seedUid ?? undefined,
6539
+ });
6483
6540
  const cacheKey = ItemProperty.cacheKey(context.seedUid || context.seedLocalId || '', context.propertyName || '');
6484
6541
  const cacheKeys = cacheKey && cacheKey !== 'Item__' ? [cacheKey] : [];
6485
6542
  clearDestroySubscriptions(this, {
@@ -6500,17 +6557,16 @@ class ItemProperty {
6500
6557
  if (!propertyName || (!seedLocalId && !seedUid))
6501
6558
  return;
6502
6559
  if (db) {
6503
- const _mod_24 = await import('./index-DglvthOk.js');
6504
- const _ns_24 = _mod_24.s;
6505
- const seedSchemaMod = _ns_24;
6560
+ const _mod_23 = await import('./index-AVFTVp1m.js');
6561
+ const _ns_23 = _mod_23.s;
6562
+ const seedSchemaMod = _ns_23;
6506
6563
  const { metadata } = seedSchemaMod;
6507
6564
  const drizzleMod = await import('drizzle-orm');
6508
- const { and, eq, or } = drizzleMod;
6565
+ const { and, eq } = drizzleMod;
6509
6566
  const conditions = [eq(metadata.propertyName, propertyName)];
6510
- if (seedLocalId && seedUid) {
6511
- conditions.push(or(eq(metadata.seedLocalId, seedLocalId), eq(metadata.seedUid, seedUid)));
6512
- }
6513
- else if (seedLocalId) {
6567
+ // Match this item's local rows only. Matching seedUid too would also delete rows of
6568
+ // other local copies of the same seed (e.g. duplicate EAS syncs).
6569
+ if (seedLocalId) {
6514
6570
  conditions.push(eq(metadata.seedLocalId, seedLocalId));
6515
6571
  }
6516
6572
  else if (seedUid) {
@@ -6546,9 +6602,9 @@ const createNewItem = async ({ modelName, modelFileId, ...propertyData }) => {
6546
6602
  }
6547
6603
  const seedType = toSnakeCase(modelName);
6548
6604
  // Dynamic import to break circular dependency
6549
- const _mod_25 = await import('./index-s15q14rm.js');
6550
- const _ns_25 = _mod_25.f;
6551
- const modelMod = _ns_25;
6605
+ const _mod_24 = await import('./index-8O3Uow-Y.js');
6606
+ const _ns_24 = _mod_24.f;
6607
+ const modelMod = _ns_24;
6552
6608
  const { Model } = modelMod;
6553
6609
  const model = await Model.resolveAsync(modelName, { modelFileId });
6554
6610
  const propertySchemas = model?.properties ? modelPropertiesToObject(model.properties) : undefined;
@@ -6616,7 +6672,7 @@ const createNewItem = async ({ modelName, modelFileId, ...propertyData }) => {
6616
6672
  * @returns Entity instance if found, undefined otherwise
6617
6673
  */
6618
6674
  async function findEntity(config, params, options = {}) {
6619
- const { waitForReady = true, readyTimeout = 5000 } = options;
6675
+ const { waitForReady = true, readyTimeout = DEFAULT_READY_TIMEOUT_MS } = options;
6620
6676
  let instance;
6621
6677
  // Try ID lookup first (most specific)
6622
6678
  if (params.id) {
@@ -6729,9 +6785,9 @@ const getModel = () => {
6729
6785
  // the fragile `import(...).then(n => n.X)` chunk-namespace pattern.
6730
6786
  if (!modelImportPromise) {
6731
6787
  modelImportPromise = (async () => {
6732
- const _mod_26 = await import('./index-s15q14rm.js');
6733
- const _ns_26 = _mod_26.f;
6734
- const mod = _ns_26;
6788
+ const _mod_25 = await import('./index-8O3Uow-Y.js');
6789
+ const _ns_25 = _mod_25.f;
6790
+ const mod = _ns_25;
6735
6791
  ModelClass = mod.Model;
6736
6792
  return mod;
6737
6793
  })();
@@ -6847,29 +6903,41 @@ class Item {
6847
6903
  latestVersionUid: head?.uid ?? undefined,
6848
6904
  });
6849
6905
  };
6850
- this.publish = async () => {
6906
+ /**
6907
+ * Upload this item's files to Arweave and write its attestations to EAS.
6908
+ *
6909
+ * Requires @seedprotocol/publish. Its `initPublish()` (or `<PublishProvider config>`)
6910
+ * registers the PublishExecutor this delegates to; without it, publish() throws
6911
+ * PUBLISH_NOT_CONFIGURED_MESSAGE. `options` are passed to that package unchanged (its
6912
+ * CreatePublishOptions: signers, Arweave tags, `publishMode`, `onPublished`, ...).
6913
+ *
6914
+ * Resolves when the publish has finished, and rejects with the publish package's error
6915
+ * if it failed. Throws OwnershipError if none of the client's addresses own the item.
6916
+ */
6917
+ this.publish = async (options) => {
6851
6918
  const { assertItemOwned } = await Promise.resolve().then(function () { return ownership; });
6919
+ const { getPublishExecutor, PUBLISH_NOT_CONFIGURED_MESSAGE } = await Promise.resolve().then(function () { return publishConfig; });
6852
6920
  await assertItemOwned(this);
6853
- this._service.send({ type: 'startPublish' });
6921
+ if (!getPublishExecutor()) {
6922
+ throw new Error(PUBLISH_NOT_CONFIGURED_MESSAGE);
6923
+ }
6924
+ const current = this._service.getSnapshot().value;
6925
+ if (current !== 'idle') {
6926
+ throw new Error(current === 'publishing'
6927
+ ? 'Item is already being published.'
6928
+ : `Item is not ready to publish (state: ${current}).`);
6929
+ }
6854
6930
  return new Promise((resolve, reject) => {
6931
+ // Subscribe before sending: subscribe() does not replay the current snapshot,
6932
+ // so a subscription made after startPublish could miss the 'publishing' state.
6855
6933
  let wasPublishing = false;
6856
- const timeoutMs = 300000; // 5 minutes, match previous handler timeout
6857
- const timeoutId = setTimeout(() => {
6858
- unsub.unsubscribe();
6859
- if (!wasPublishing) {
6860
- reject(new Error('Publish did not start (timeout)'));
6861
- }
6862
- else {
6863
- reject(new Error('Publish timed out'));
6864
- }
6865
- }, timeoutMs);
6866
6934
  const unsub = this._service.subscribe((snapshot) => {
6867
6935
  const value = snapshot.value;
6868
6936
  if (value === 'publishing') {
6869
6937
  wasPublishing = true;
6938
+ return;
6870
6939
  }
6871
6940
  if (value === 'idle' && wasPublishing) {
6872
- clearTimeout(timeoutId);
6873
6941
  unsub.unsubscribe();
6874
6942
  const ctx = snapshot.context;
6875
6943
  if (ctx._publishError) {
@@ -6880,18 +6948,19 @@ class Item {
6880
6948
  }
6881
6949
  }
6882
6950
  });
6951
+ this._service.send({ type: 'startPublish', item: this, options });
6883
6952
  });
6884
6953
  };
6885
6954
  this.getPublishUploads = async (options) => {
6886
6955
  // Use dynamic import to break circular dependency
6887
- const getPublishUploadsMod = await import('./getPublishUploads-BEqRiKIS.js');
6956
+ const getPublishUploadsMod = await import('./getPublishUploads-SFHCbf_y.js');
6888
6957
  const { getPublishUploads } = getPublishUploadsMod;
6889
6958
  return await getPublishUploads(this, [], undefined, options);
6890
6959
  };
6891
6960
  this.getPublishPayload = async (uploadedTransactions, options) => {
6892
- const _mod_27 = await import('./getPublishPayload-BHrxVtzY.js');
6893
- const _ns_27 = _mod_27.g;
6894
- const getPublishPayloadMod = _ns_27;
6961
+ const _mod_26 = await import('./getPublishPayload-CTCvRUoU.js');
6962
+ const _ns_26 = _mod_26.g;
6963
+ const getPublishPayloadMod = _ns_26;
6895
6964
  const { getPublishPayload } = getPublishPayloadMod;
6896
6965
  return await getPublishPayload(this, uploadedTransactions, options);
6897
6966
  };
@@ -7248,7 +7317,7 @@ class Item {
7248
7317
  }
7249
7318
  static async create(props, options) {
7250
7319
  const waitForReady = options?.waitForReady !== false;
7251
- const readyTimeout = options?.readyTimeout ?? 5000;
7320
+ const readyTimeout = options?.readyTimeout ?? DEFAULT_READY_TIMEOUT_MS;
7252
7321
  if (!props.modelName && props.type) {
7253
7322
  props.modelName = startCase(props.type);
7254
7323
  }
@@ -7425,9 +7494,9 @@ class Item {
7425
7494
  const db = BaseDb.getAppDb();
7426
7495
  if (db && props.modelName) {
7427
7496
  // Model names are only unique per schema: resolve the exact models row from the most specific scope.
7428
- const _mod_28 = await import('./db-D9K_f5cF.js');
7429
- const _ns_28 = _mod_28.Y;
7430
- const { resolveModelRecord } = _ns_28;
7497
+ const _mod_27 = await import('./BasePathResolver-Cm4apKRb.js');
7498
+ const _ns_27 = _mod_27.b1;
7499
+ const { resolveModelRecord } = _ns_27;
7431
7500
  const modelRecord = await resolveModelRecord(props.modelName, {
7432
7501
  modelFileId: props.modelFileId ?? modelInstance?.id,
7433
7502
  schemaName: schemaName ?? modelInstance?.schemaName,
@@ -7439,12 +7508,12 @@ class Item {
7439
7508
  // Scope the constructor's Model lookup to this model's schema (as getItemData does on reload),
7440
7509
  // so a same-named model cached from another schema can't supply the property set.
7441
7510
  if (modelRecord && !props.schemaName) {
7442
- const _mod_29 = await import('./BasePathResolver-CfSfMW5_.js');
7443
- const _ns_29 = _mod_29.R;
7444
- const { modelSchemas } = _ns_29;
7445
- const _mod_30 = await import('./BasePathResolver-CfSfMW5_.js');
7446
- const _ns_30 = _mod_30.Q;
7447
- const { schemas: schemasTable } = _ns_30;
7511
+ const _mod_28 = await import('./BasePathResolver-Cm4apKRb.js');
7512
+ const _ns_28 = _mod_28.b0;
7513
+ const { modelSchemas } = _ns_28;
7514
+ const _mod_29 = await import('./BasePathResolver-Cm4apKRb.js');
7515
+ const _ns_29 = _mod_29.a$;
7516
+ const { schemas: schemasTable } = _ns_29;
7448
7517
  const schemaRows = await db
7449
7518
  .select({ schemaName: schemasTable.name })
7450
7519
  .from(modelSchemas)
@@ -7745,7 +7814,7 @@ class Item {
7745
7814
  modelName,
7746
7815
  });
7747
7816
  }
7748
- static async find({ modelName, seedLocalId, seedUid, waitForReady = true, readyTimeout = 5000, }) {
7817
+ static async find({ modelName, seedLocalId, seedUid, waitForReady = true, readyTimeout = DEFAULT_READY_TIMEOUT_MS, }) {
7749
7818
  if (!seedLocalId && !seedUid) {
7750
7819
  return undefined;
7751
7820
  }
@@ -7771,7 +7840,7 @@ class Item {
7771
7840
  }
7772
7841
  }
7773
7842
  static async all(modelName, deleted, options) {
7774
- const { waitForReady = false, readyTimeout = 5000, includeEas = false, addressFilter, modelFileId, schemaName, } = options ?? {};
7843
+ const { waitForReady = false, readyTimeout = DEFAULT_READY_TIMEOUT_MS, includeEas = false, addressFilter, modelFileId, schemaName, } = options ?? {};
7775
7844
  const itemsData = await getItemsData({ modelName, modelFileId, schemaName, deleted, includeEas, addressFilter });
7776
7845
  const itemInstances = [];
7777
7846
  for (const itemData of itemsData) {
@@ -7795,9 +7864,9 @@ class Item {
7795
7864
  if (!appDb || Item.instanceCache.size === 0) {
7796
7865
  return;
7797
7866
  }
7798
- const _mod_31 = await import('./index-DglvthOk.js');
7799
- const _ns_31 = _mod_31.s;
7800
- const { metadata } = _ns_31;
7867
+ const _mod_30 = await import('./index-AVFTVp1m.js');
7868
+ const _ns_30 = _mod_30.s;
7869
+ const { metadata } = _ns_30;
7801
7870
  const { eq, and } = await import('drizzle-orm');
7802
7871
  const dedupedInstances = new Map();
7803
7872
  for (const entry of Item.instanceCache.values()) {
@@ -7956,8 +8025,27 @@ class Item {
7956
8025
  });
7957
8026
  state.definedPropertyNames.add(propertyName);
7958
8027
  }
7959
- static async publish(item) {
7960
- await item.publish();
8028
+ /** Same as `item.publish(options)`; requires @seedprotocol/publish. */
8029
+ /**
8030
+ * Set `publisher` on loaded Items for these seeds (after claimUnpublishedDrafts stamped
8031
+ * their rows). Items that aren't loaded read it from the DB when they load.
8032
+ */
8033
+ static setPublisherForCachedSeeds(seedLocalIds, publisher) {
8034
+ const normalized = normalizePublisher(publisher);
8035
+ if (!normalized)
8036
+ return;
8037
+ for (const seedLocalId of seedLocalIds) {
8038
+ const item = Item.getById(seedLocalId);
8039
+ if (!item)
8040
+ continue;
8041
+ const status = item.getService().getSnapshot().status;
8042
+ if (status === 'stopped' || status === 'done')
8043
+ continue;
8044
+ item.getService().send({ type: 'updateContext', publisher: normalized });
8045
+ }
8046
+ }
8047
+ static async publish(item, options) {
8048
+ await item.publish(options);
7961
8049
  }
7962
8050
  get serviceContext() {
7963
8051
  const snapshot = this._service.getSnapshot();
@@ -8254,9 +8342,9 @@ class Item {
8254
8342
  itemActor.send(event);
8255
8343
  };
8256
8344
  try {
8257
- const _mod_32 = await import('./index-DglvthOk.js');
8258
- const _ns_32 = _mod_32.s;
8259
- const seedSchemaMod = _ns_32;
8345
+ const _mod_31 = await import('./index-AVFTVp1m.js');
8346
+ const _ns_31 = _mod_31.s;
8347
+ const seedSchemaMod = _ns_31;
8260
8348
  const { seeds, versions, metadata } = seedSchemaMod;
8261
8349
  const drizzleMod = await import('drizzle-orm');
8262
8350
  const { eq, and } = drizzleMod;
@@ -8347,7 +8435,7 @@ class Item {
8347
8435
  // Watch the seed row by local id: its uid changes when an unpublished item is published
8348
8436
  // again (a new seed attestation), and a watch on the uid would stop seeing the row.
8349
8437
  const seeds$ = BaseDb.liveQuery((sql) => sql `
8350
- SELECT local_id as localId, uid, schema_uid as schemaUid, revoked_at as revokedAt
8438
+ SELECT local_id as localId, uid, schema_uid as schemaUid, revoked_at as revokedAt, publisher
8351
8439
  FROM seeds
8352
8440
  WHERE local_id = ${watchedSeedLocalId}
8353
8441
  `);
@@ -8397,6 +8485,8 @@ class Item {
8397
8485
  seedLocalId: seedRow.localId,
8398
8486
  schemaUid: seedRow.schemaUid || undefined,
8399
8487
  revokedAt: seedRow.revokedAt ?? undefined,
8488
+ // claimUnpublishedDrafts (here or in another tab) stamps drafts' publisher.
8489
+ ...(seedRow.publisher ? { publisher: seedRow.publisher } : {}),
8400
8490
  });
8401
8491
  },
8402
8492
  error: (error) => {
@@ -8607,5 +8697,5 @@ var Item$1 = /*#__PURE__*/Object.freeze({
8607
8697
  Item: Item
8608
8698
  });
8609
8699
 
8610
- export { writeItemStorageFile as $, getRevokeExecutor as A, getUploadExecutor as B, ClientManagerState as C, getVersionData$1 as D, isItemOwned as E, isLocalUnsealedDraft as F, isSeedRowOwned as G, localUnsealedDraftSql as H, Item as I, ownedPublisherSql as J, ownedSeedsSql as K, pickLatestMetadataRowPerProperty as L, METADATA_LATEST_FIRST_ORDER_SQL as M, placeholderUidSql as N, propertyMachine as O, publisherInAddressListSql as P, publisherIsInOwnedSet as Q, setAdditionalSyncAddresses as R, setGetPublisherForNewSeeds as S, setRevokeExecutor as T, setUploadExecutor as U, getInvariantSafePropertyDescriptor as V, clearDestroySubscriptions as W, unloadEntity as X, ClientManagerEvents as Y, withLockedItemStorageRow as Z, getItemStorageFilePath as _, getEasSchemaUidForModel as a, resolvePublisherFromSeedRow as a0, getPropertyData$1 as a1, Item$1 as a2, getLatestPublishedVersionRow as b, compareMetadataRowsLatestFirst as c, chunkValues as d, rowsPerInsert as e, getGetAdditionalSyncAddresses as f, getItemData as g, ItemProperty as h, ItemPropertySaveValidationError as i, isVersionRevoked as j, waitForEntityIdle as k, listRelationEasPropertyName as l, createReactiveProxy as m, findEntity as n, forceRemoveFromCaches as o, parseListPropertyValueFromStorage as p, runDestroyLifecycle as q, resolveStorageNameToSchemaName 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 };
8611
- //# sourceMappingURL=Item-C7sUUu2B.js.map
8700
+ export { getInvariantSafePropertyDescriptor 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 _, chunkValues 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, rowsPerInsert as b, compareMetadataRowsLatestFirst as c, getGetAdditionalSyncAddresses as d, ItemProperty as e, ItemPropertySaveValidationError as f, getItemData as g, assertItemOwned as h, isItemOwned as i, getEasSchemaUidForModel as j, getLatestPublishedVersionRow as k, listRelationEasPropertyName as l, isVersionRevoked as m, waitForEntityIdle as n, createReactiveProxy as o, parseListPropertyValueFromStorage as p, findEntity as q, resolveStorageNameToSchemaName 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 };
8701
+ //# sourceMappingURL=Item-DBFchXpC.js.map