@seedprotocol/sdk 0.7.0 → 0.7.1

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 (148) hide show
  1. package/dist/{BasePathResolver-ndE8XTpw.js → BasePathResolver-DRT09oVv.js} +2 -2
  2. package/dist/{BasePathResolver-ndE8XTpw.js.map → BasePathResolver-DRT09oVv.js.map} +1 -1
  3. package/dist/{ClientManager-DLleL_2e.js → ClientManager-DngaZdw6.js} +20 -20
  4. package/dist/{ClientManager-DLleL_2e.js.map → ClientManager-DngaZdw6.js.map} +1 -1
  5. package/dist/{Item-zBFWQDU9.js → Item-ZUAmf943.js} +118 -72
  6. package/dist/{Item-zBFWQDU9.js.map → Item-ZUAmf943.js.map} +1 -1
  7. package/dist/{ModelProperty-lth9L37R.js → ModelProperty-6llK4MTH.js} +64 -35
  8. package/dist/ModelProperty-6llK4MTH.js.map +1 -0
  9. package/dist/{Schema-DOhlrQ-N.js → Schema-D-Ud-XYw.js} +106 -57
  10. package/dist/Schema-D-Ud-XYw.js.map +1 -0
  11. package/dist/{SchemaValidationService-DDKr5piy.js → SchemaValidationService-IoS7JquP.js} +7 -7
  12. package/dist/{SchemaValidationService-DDKr5piy.js.map → SchemaValidationService-IoS7JquP.js.map} +1 -1
  13. package/dist/{backfillMetadataPropertyIds-fG3ujaSh.js → backfillMetadataPropertyIds-BlVeE7w7.js} +4 -4
  14. package/dist/{backfillMetadataPropertyIds-fG3ujaSh.js.map → backfillMetadataPropertyIds-BlVeE7w7.js.map} +1 -1
  15. package/dist/cjs/{ModelProperty-BEsIHAjk.js → ModelProperty-Dv7AQfmQ.js} +59 -30
  16. package/dist/cjs/ModelProperty-Dv7AQfmQ.js.map +1 -0
  17. package/dist/cjs/{Schema-qEp5mH1N.js → Schema-BHVp1g-M.js} +93 -44
  18. package/dist/cjs/Schema-BHVp1g-M.js.map +1 -0
  19. package/dist/cjs/{SchemaValidationService-CWEnZmOH.js → SchemaValidationService-BSU9knjf.js} +2 -2
  20. package/dist/cjs/{SchemaValidationService-CWEnZmOH.js.map → SchemaValidationService-BSU9knjf.js.map} +1 -1
  21. package/dist/cjs/{backfillMetadataPropertyIds-tw8JGMT0.js → backfillMetadataPropertyIds-WIovQ_d8.js} +3 -3
  22. package/dist/cjs/{backfillMetadataPropertyIds-tw8JGMT0.js.map → backfillMetadataPropertyIds-WIovQ_d8.js.map} +1 -1
  23. package/dist/cjs/{eas-CLiV2Hmn.js → eas-CUYXdr2t.js} +3 -3
  24. package/dist/cjs/{eas-CLiV2Hmn.js.map → eas-CUYXdr2t.js.map} +1 -1
  25. package/dist/cjs/{getItem-DSRtx_68.js → getItem-z1tHu0hu.js} +2 -2
  26. package/dist/cjs/{getItem-DSRtx_68.js.map → getItem-z1tHu0hu.js.map} +1 -1
  27. package/dist/cjs/{getLatestVersionRow-DVizNNoI.js → getLatestVersionRow-CcaabxIW.js} +2 -2
  28. package/dist/cjs/{getLatestVersionRow-DVizNNoI.js.map → getLatestVersionRow-CcaabxIW.js.map} +1 -1
  29. package/dist/cjs/{getPublishPayload-D5-dYtNq.js → getPublishPayload-CEP_e-Kv.js} +160 -204
  30. package/dist/cjs/getPublishPayload-CEP_e-Kv.js.map +1 -0
  31. package/dist/cjs/{getPublishUploads-B5Lq6q-_.js → getPublishUploads-Ctn5k1k6.js} +49 -10
  32. package/dist/cjs/getPublishUploads-Ctn5k1k6.js.map +1 -0
  33. package/dist/cjs/{index-C66AfYDG.js → index-Cvvt0-5B.js} +244 -87
  34. package/dist/cjs/index-Cvvt0-5B.js.map +1 -0
  35. package/dist/cjs/{index-B3UDbm1C.js → index-DfGhF1dc.js} +3 -3
  36. package/dist/cjs/index-DfGhF1dc.js.map +1 -0
  37. package/dist/cjs/{property-BVJIP7SX.js → property-DbEPQ1m9.js} +5 -5
  38. package/dist/cjs/{property-BVJIP7SX.js.map → property-DbEPQ1m9.js.map} +1 -1
  39. package/dist/cjs/publishDraftGraph-C38gf302.js +403 -0
  40. package/dist/cjs/publishDraftGraph-C38gf302.js.map +1 -0
  41. package/dist/cjs/{resetAmbiguousLegacyItemData-BaZqUui9.js → resetAmbiguousLegacyItemData-CfMhRHwK.js} +2 -2
  42. package/dist/cjs/{resetAmbiguousLegacyItemData-BaZqUui9.js.map → resetAmbiguousLegacyItemData-CfMhRHwK.js.map} +1 -1
  43. package/dist/cjs/{resolveModelForSyncedSeed-CC6dQctx.js → resolveModelForSyncedSeed-CNYaLOir.js} +2 -2
  44. package/dist/cjs/{resolveModelForSyncedSeed-CC6dQctx.js.map → resolveModelForSyncedSeed-CNYaLOir.js.map} +1 -1
  45. package/dist/cjs/{syncDbWithEas-Dk96sAG-.js → syncDbWithEas-d1iOdTTI.js} +20 -7
  46. package/dist/cjs/{syncDbWithEas-Dk96sAG-.js.map → syncDbWithEas-d1iOdTTI.js.map} +1 -1
  47. package/dist/{configurePlatform-BMoPG9vY.js → configurePlatform-CZpjyuCo.js} +4 -4
  48. package/dist/{configurePlatform-BMoPG9vY.js.map → configurePlatform-CZpjyuCo.js.map} +1 -1
  49. package/dist/{db-BJZN0a0a.js → db-Lw0KVZmc.js} +11 -11
  50. package/dist/{db-BJZN0a0a.js.map → db-Lw0KVZmc.js.map} +1 -1
  51. package/dist/{eas-B0hsMLqt.js → eas-CQ-Smzk2.js} +6 -6
  52. package/dist/{eas-B0hsMLqt.js.map → eas-CQ-Smzk2.js.map} +1 -1
  53. package/dist/{getItem-DEh4WfHG.js → getItem-CSfSok9f.js} +5 -5
  54. package/dist/{getItem-DEh4WfHG.js.map → getItem-CSfSok9f.js.map} +1 -1
  55. package/dist/{getLatestVersionRow-Brrl1AnW.js → getLatestVersionRow-72Atl9vB.js} +5 -5
  56. package/dist/{getLatestVersionRow-Brrl1AnW.js.map → getLatestVersionRow-72Atl9vB.js.map} +1 -1
  57. package/dist/{getPublishPayload-H032DHC7.js → getPublishPayload-76_KfB5Y.js} +155 -200
  58. package/dist/getPublishPayload-76_KfB5Y.js.map +1 -0
  59. package/dist/{getPublishUploads-CR66RlGJ.js → getPublishUploads-CqgMBD8f.js} +52 -13
  60. package/dist/getPublishUploads-CqgMBD8f.js.map +1 -0
  61. package/dist/{index-B0LgJblD.js → index-5b3JsS55.js} +2 -2
  62. package/dist/index-5b3JsS55.js.map +1 -0
  63. package/dist/{index-6bJuv5Tt.js → index-BpgD305l.js} +9 -9
  64. package/dist/{index-6bJuv5Tt.js.map → index-BpgD305l.js.map} +1 -1
  65. package/dist/{index-DtfjeuxC.js → index-Y-yYyRBf.js} +166 -75
  66. package/dist/index-Y-yYyRBf.js.map +1 -0
  67. package/dist/{index.browser-CNrqhvEA.js → index.browser-DaTzn79x.js} +9 -9
  68. package/dist/{index.browser-CNrqhvEA.js.map → index.browser-DaTzn79x.js.map} +1 -1
  69. package/dist/{index.node-DrHiTuOr.js → index.node-NYKqFOoe.js} +5 -5
  70. package/dist/{index.node-DrHiTuOr.js.map → index.node-NYKqFOoe.js.map} +1 -1
  71. package/dist/main.cjs +1 -1
  72. package/dist/main.js +257 -181
  73. package/dist/main.js.map +1 -1
  74. package/dist/node.js +12 -12
  75. package/dist/platform.browser.js +5 -5
  76. package/dist/platform.node.js +3 -3
  77. package/dist/{property-D2Nnsmm1.js → property-ByaiSyUK.js} +10 -10
  78. package/dist/{property-D2Nnsmm1.js.map → property-ByaiSyUK.js.map} +1 -1
  79. package/dist/publishDraftGraph-BRm6Pq3Q.js +405 -0
  80. package/dist/publishDraftGraph-BRm6Pq3Q.js.map +1 -0
  81. package/dist/{resetAmbiguousLegacyItemData-BqbHNUYk.js → resetAmbiguousLegacyItemData-B4dX6ZA1.js} +2 -2
  82. package/dist/{resetAmbiguousLegacyItemData-BqbHNUYk.js.map → resetAmbiguousLegacyItemData-B4dX6ZA1.js.map} +1 -1
  83. package/dist/{resolveModelForSyncedSeed-DQK6JfXS.js → resolveModelForSyncedSeed-B0tco3zG.js} +2 -2
  84. package/dist/{resolveModelForSyncedSeed-DQK6JfXS.js.map → resolveModelForSyncedSeed-B0tco3zG.js.map} +1 -1
  85. package/dist/src/Item/Item.d.ts +11 -0
  86. package/dist/src/Item/Item.d.ts.map +1 -1
  87. package/dist/src/ItemProperty/ItemProperty.d.ts +10 -0
  88. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  89. package/dist/src/Model/Model.d.ts +15 -2
  90. package/dist/src/Model/Model.d.ts.map +1 -1
  91. package/dist/src/Model/service/actors/createModelProperties.d.ts.map +1 -1
  92. package/dist/src/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
  93. package/dist/src/Model/service/actors/validateModel.d.ts.map +1 -1
  94. package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
  95. package/dist/src/ModelProperty/ModelProperty.d.ts +9 -1
  96. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  97. package/dist/src/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
  98. package/dist/src/ModelProperty/service/actors/saveToSchema.d.ts.map +1 -1
  99. package/dist/src/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
  100. package/dist/src/Schema/Schema.d.ts +7 -0
  101. package/dist/src/Schema/Schema.d.ts.map +1 -1
  102. package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +1 -1
  103. package/dist/src/Schema/service/actors/createModelInstances.d.ts.map +1 -1
  104. package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
  105. package/dist/src/db/read/getPublishPayload.d.ts +9 -0
  106. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  107. package/dist/src/db/read/getPublishUploads.d.ts +5 -0
  108. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  109. package/dist/src/db/read/publishDraftGraph.d.ts +57 -0
  110. package/dist/src/db/read/publishDraftGraph.d.ts.map +1 -0
  111. package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
  112. package/dist/src/helpers/entity/entityLiveQuery.d.ts.map +1 -1
  113. package/dist/src/helpers/entity/evictionEpoch.d.ts +18 -0
  114. package/dist/src/helpers/entity/evictionEpoch.d.ts.map +1 -0
  115. package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts +28 -6
  116. package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts.map +1 -1
  117. package/dist/src/index.d.ts +2 -1
  118. package/dist/src/index.d.ts.map +1 -1
  119. package/dist/src/services/write/actors/validateEntity.d.ts.map +1 -1
  120. package/dist/src/types/item.d.ts +7 -8
  121. package/dist/src/types/item.d.ts.map +1 -1
  122. package/dist/{syncDbWithEas-LRKr_NZF.js → syncDbWithEas-BPap9Sru.js} +14 -14
  123. package/dist/{syncDbWithEas-LRKr_NZF.js.map → syncDbWithEas-BPap9Sru.js.map} +1 -1
  124. package/dist/{tabEvents-DYI2GU7i.js → tabEvents-C6NXS6Jl.js} +6 -6
  125. package/dist/{tabEvents-DYI2GU7i.js.map → tabEvents-C6NXS6Jl.js.map} +1 -1
  126. package/dist/{tolerantWebAccess-CzOBz5M6.js → tolerantWebAccess-NBQ1NB4i.js} +6 -6
  127. package/dist/{tolerantWebAccess-CzOBz5M6.js.map → tolerantWebAccess-NBQ1NB4i.js.map} +1 -1
  128. package/dist/{updateSeedRevokedAt-B58ORbY3.js → updateSeedRevokedAt-CYwgVNlM.js} +3 -3
  129. package/dist/{updateSeedRevokedAt-B58ORbY3.js.map → updateSeedRevokedAt-CYwgVNlM.js.map} +1 -1
  130. package/package.json +8 -10
  131. package/dist/ModelProperty-lth9L37R.js.map +0 -1
  132. package/dist/Schema-DOhlrQ-N.js.map +0 -1
  133. package/dist/cjs/ModelProperty-BEsIHAjk.js.map +0 -1
  134. package/dist/cjs/Schema-qEp5mH1N.js.map +0 -1
  135. package/dist/cjs/getPublishPayload-D5-dYtNq.js.map +0 -1
  136. package/dist/cjs/getPublishUploads-B5Lq6q-_.js.map +0 -1
  137. package/dist/cjs/getSegmentedItemProperties-giHO7R3d.js +0 -147
  138. package/dist/cjs/getSegmentedItemProperties-giHO7R3d.js.map +0 -1
  139. package/dist/cjs/index-B3UDbm1C.js.map +0 -1
  140. package/dist/cjs/index-C66AfYDG.js.map +0 -1
  141. package/dist/getPublishPayload-H032DHC7.js.map +0 -1
  142. package/dist/getPublishUploads-CR66RlGJ.js.map +0 -1
  143. package/dist/getSegmentedItemProperties-C2EJ2G0N.js +0 -147
  144. package/dist/getSegmentedItemProperties-C2EJ2G0N.js.map +0 -1
  145. package/dist/index-B0LgJblD.js.map +0 -1
  146. package/dist/index-DtfjeuxC.js.map +0 -1
  147. package/dist/src/browser/helpers/index.d.ts +0 -4
  148. package/dist/src/browser/helpers/index.d.ts.map +0 -1
@@ -1,40 +1,20 @@
1
- import { n as normalizeDataType, M as ModelPropertyDataTypes, r as resolveModelRecord, m as getItemModelScope } from './db-BJZN0a0a.js';
2
- import { B as BaseDb, r as seeds, Z as ZERO_BYTES32, v as versions, p as properties, V as VERSION_SCHEMA_UID, m as models, h as htmlEmbeddedImageCoPublish, y as INTERNAL_PROPERTY_NAMES, z as defaultAttestationData, A as INTERNAL_DATA_TYPES } from './BasePathResolver-ndE8XTpw.js';
1
+ import { p as resolveModelRecord, q as getItemModelScope, M as ModelPropertyDataTypes, n as normalizeDataType } from './db-Lw0KVZmc.js';
2
+ import { Z as ZERO_BYTES32, B as BaseDb, p as properties, V as VERSION_SCHEMA_UID, j as models, h as htmlEmbeddedImageCoPublish, I as INTERNAL_PROPERTY_NAMES, w as defaultAttestationData, x as INTERNAL_DATA_TYPES } from './BasePathResolver-DRT09oVv.js';
3
3
  import { SchemaEncoder } from '@ethereum-attestation-service/eas-sdk';
4
- import { r as resolveSeedIdsFromRefString, n as normalizeRelationPropertyValue, i as isPublishedSeedRef, g as getCorrectId, a as isStorageSeedRef, t as toSnakeCase$1 } from './tabEvents-DYI2GU7i.js';
4
+ import { r as resolveSeedIdsFromRefString, n as normalizeRelationPropertyValue, i as isPublishedSeedRef, g as getCorrectId, a as isStorageSeedRef, t as toSnakeCase$1 } from './tabEvents-C6NXS6Jl.js';
5
5
  import { toSnakeCase } from 'drizzle-orm/casing';
6
- import { i as isVersionRevoked, f as getEasSchemaUidForModel, h as getLatestPublishedVersionRow, p as parseListPropertyValueFromStorage, l as listRelationEasPropertyName } from './Item-zBFWQDU9.js';
6
+ import { a as getEasSchemaUidForModel, b as getLatestPublishedVersionRow, p as parseListPropertyValueFromStorage, l as listRelationEasPropertyName } from './Item-ZUAmf943.js';
7
7
  import { isValidEasAttestationUid, getEasSchemaUidForSchemaDefinition } from '@seedprotocol/eas';
8
- import { eq, and, isNotNull, sql } from 'drizzle-orm';
9
- import { g as getSegmentedItemProperties } from './getSegmentedItemProperties-C2EJ2G0N.js';
10
- import { getPropertySchema } from './property-D2Nnsmm1.js';
8
+ import { i as isSeedRevoked, a as getSegmentedItemProperties, f as findRelatedSeedRow, r as relatedModelNameFromDef, h as htmlPropertyNameForHtmlSeed, b as isUnpublishedSeed, c as isLivePublishedSeed, d as draftWalkProperties } from './publishDraftGraph-BRm6Pq3Q.js';
9
+ import { getPropertySchema } from './property-ByaiSyUK.js';
11
10
  import { modelPropertiesToObject } from './model-DGMe-TTm.js';
12
11
  import { upperFirst, camelCase } from 'lodash-es';
12
+ import { and, eq, sql } from 'drizzle-orm';
13
13
  import debug from 'debug';
14
14
  import '@noble/hashes/sha3';
15
15
  import '@noble/hashes/utils';
16
16
  import 'reflect-metadata';
17
- import './index-DtfjeuxC.js';
18
- import 'pluralize';
19
-
20
- /**
21
- * True when the item's seed attestation was revoked (`seeds.revoked_at` set, by unpublish or EAS
22
- * sync). Such a seed can't take new versions: publishing again creates a new seed attestation
23
- * (see "Republishing" in docs/ATTESTATION_REVOCATION.md).
24
- */
25
- const isSeedRevoked = async (seedLocalId) => {
26
- if (!seedLocalId)
27
- return false;
28
- const appDb = BaseDb.getAppDb();
29
- if (!appDb)
30
- return false;
31
- const [row] = await appDb
32
- .select({ revokedAt: seeds.revokedAt })
33
- .from(seeds)
34
- .where(eq(seeds.localId, seedLocalId))
35
- .limit(1);
36
- return isVersionRevoked(row?.revokedAt);
37
- };
17
+ import './index-Y-yYyRBf.js';
38
18
 
39
19
  /** UTF-8 string to 0x-prefixed bytes32 hex (right-padded with zeros). */
40
20
  function encodeBytes32String(value) {
@@ -88,84 +68,17 @@ class RelatedItemUnpublishedError extends PublishValidationFailedError {
88
68
  }
89
69
  }
90
70
 
91
- const selectSeed = {
92
- seedLocalId: seeds.localId,
93
- seedUid: seeds.uid,
94
- revokedAt: seeds.revokedAt,
95
- type: seeds.type,
96
- };
97
- /**
98
- * The local seed row a relation/list/image ref points at, by local id or uid. A uid that is no
99
- * seed's current uid can be the old uid of a seed that was unpublished and published again (a new
100
- * seed attestation, same local seed): its old version rows still record it, so it resolves to that
101
- * seed. Null when nothing local matches (e.g. a published uid with no local copy).
102
- */
103
- const findRelatedSeedRow = async ({ seedLocalId, seedUid, }) => {
104
- const appDb = BaseDb.getAppDb();
105
- if (!appDb)
106
- return null;
107
- if (seedLocalId) {
108
- const [row] = await appDb.select(selectSeed).from(seeds).where(eq(seeds.localId, seedLocalId)).limit(1);
109
- if (row?.seedLocalId)
110
- return row;
111
- }
112
- if (!seedUid || seedUid === ZERO_BYTES32)
113
- return null;
114
- const [byUid] = await appDb.select(selectSeed).from(seeds).where(eq(seeds.uid, seedUid)).limit(1);
115
- if (byUid?.seedLocalId)
116
- return byUid;
117
- const [version] = await appDb
118
- .select({ seedLocalId: versions.seedLocalId })
119
- .from(versions)
120
- .where(and(eq(versions.seedUid, seedUid), isNotNull(versions.seedLocalId)))
121
- .limit(1);
122
- if (!version?.seedLocalId)
123
- return null;
124
- const [republished] = await appDb
125
- .select(selectSeed)
126
- .from(seeds)
127
- .where(eq(seeds.localId, version.seedLocalId))
128
- .limit(1);
129
- return republished?.seedLocalId ? republished : null;
130
- };
131
- /** The seed is attested and its attestation is live. */
132
- const isLivePublishedSeed = (row) => !!row?.seedUid && row.seedUid !== ZERO_BYTES32 && !isVersionRevoked(row.revokedAt);
133
- /** The seed was attested and that attestation was revoked (unpublished). */
134
- const isUnpublishedSeed = (row) => !!row?.seedUid && row.seedUid !== ZERO_BYTES32 && isVersionRevoked(row.revokedAt);
135
- /** Model a relation/list/image property points at, from its definition. */
136
- function relatedModelNameFromDef(propertyDef) {
137
- const def = propertyDef;
138
- if (!def)
139
- return undefined;
140
- const dataType = normalizeDataType(def.dataType);
141
- if (dataType === ModelPropertyDataTypes.Image)
142
- return 'Image';
143
- if (dataType === ModelPropertyDataTypes.File)
144
- return 'File';
145
- if (dataType === ModelPropertyDataTypes.Html)
146
- return 'Html';
147
- return def.ref ?? def.refModelName;
148
- }
149
- /**
150
- * Name of the item's Html property whose value is the Html seed `htmlSeedLocalId`: the property
151
- * that refers to the images embedded in that Html (htmlEmbeddedImageCoPublish rows).
152
- */
153
- function htmlPropertyNameForHtmlSeed(item, htmlSeedLocalId) {
154
- const want = htmlSeedLocalId.trim();
155
- for (const p of item.properties ?? []) {
156
- if (normalizeDataType(p.propertyDef?.dataType) !== ModelPropertyDataTypes.Html)
157
- continue;
158
- const snap = p.getService().getSnapshot();
159
- const value = 'context' in snap ? snap.context.propertyValue : undefined;
160
- if (typeof value === 'string' && value.trim() === want)
161
- return p.propertyName;
162
- }
163
- return 'html';
164
- }
165
-
166
71
  debug('seedSdk:db:getPublishPayload');
167
72
  /** Case-insensitive dataType match (schema JSON may use "text" vs "Text"). */
168
73
  const matchesDataType = (actual, expected) => normalizeDataType(actual) === expected;
74
+ /** True (and the property is deferred) when `targetSeedLocalId` is an item still in progress. */
75
+ function deferIfBackEdge(ctx, property, targetSeedLocalIds) {
76
+ if (!targetSeedLocalIds.some((id) => !!id && ctx.newSeedsInProgress?.has(id)))
77
+ return false;
78
+ ctx.deferredProperties ?? (ctx.deferredProperties = new Set());
79
+ ctx.deferredProperties.add(property);
80
+ return true;
81
+ }
169
82
  /**
170
83
  * Checks the seed a relation/list/image ref points at. A revoked (unpublished) seed is recorded in
171
84
  * `ctx.unpublishedRelatedItems`; a live published one maps the ref to its current uid. Returns
@@ -278,7 +191,7 @@ async function resolveVersionUid(seedLocalId, seedUid) {
278
191
  if (published?.uid)
279
192
  return published.uid;
280
193
  try {
281
- const { getItemVersionsFromEas } = await import('./eas-B0hsMLqt.js');
194
+ const { getItemVersionsFromEas } = await import('./eas-CQ-Smzk2.js');
282
195
  const attestations = await getItemVersionsFromEas({ seedUids: [seedUid] });
283
196
  const latest = attestations?.[0];
284
197
  if (latest?.id)
@@ -345,8 +258,8 @@ const ensurePropertyDefs = async (targetItem) => {
345
258
  schema = await getPropertySchema(targetItem.modelName, itemProperty.propertyName, targetScope);
346
259
  if (!schema) {
347
260
  try {
348
- const _mod_0 = await import('./index-DtfjeuxC.js');
349
- const _ns_0 = _mod_0.c;
261
+ const _mod_0 = await import('./index-Y-yYyRBf.js');
262
+ const _ns_0 = _mod_0.f;
350
263
  const { Model } = _ns_0;
351
264
  const normalizedModelName = upperFirst(camelCase(targetItem.modelName));
352
265
  let model = Model.resolve(normalizedModelName, targetScope);
@@ -423,6 +336,9 @@ const processBasicProperties = async (itemBasicProperties, itemPublishData, ctx,
423
336
  if (INTERNAL_PROPERTY_NAMES.includes(basicProperty.propertyName)) {
424
337
  continue;
425
338
  }
339
+ if (ctx.deferredProperties?.has(basicProperty)) {
340
+ continue;
341
+ }
426
342
  const snapshot = basicProperty.getService().getSnapshot();
427
343
  const context = 'context' in snapshot ? snapshot.context : null;
428
344
  const propertyDef = basicProperty.propertyDef ?? (context ? context.propertyRecordSchema : undefined);
@@ -513,7 +429,7 @@ const processBasicProperties = async (itemBasicProperties, itemPublishData, ctx,
513
429
  }
514
430
  // Validate against property validation rules (enum, pattern, minLength, maxLength) before encoding
515
431
  if (propertyDef?.validation) {
516
- const { SchemaValidationService } = await import('./SchemaValidationService-DDKr5piy.js');
432
+ const { SchemaValidationService } = await import('./SchemaValidationService-IoS7JquP.js');
517
433
  const validationService = new SchemaValidationService();
518
434
  const validationResult = validationService.validatePropertyValue(value, normalizeDataType(propertyDef.dataType), propertyDef.validation, propertyDef.refValueType
519
435
  ? normalizeDataType(propertyDef.refValueType)
@@ -653,7 +569,7 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
653
569
  matchesDataType(relationOrImageProperty.propertyDef?.refValueType, ModelPropertyDataTypes.Html) ||
654
570
  matchesDataType(relationOrImageProperty.propertyDef?.refValueType, ModelPropertyDataTypes.Json)));
655
571
  if (isStorageSeed && (context.seedLocalId || context.seedUid)) {
656
- const _mod_1 = await import('./Item-zBFWQDU9.js');
572
+ const _mod_1 = await import('./Item-ZUAmf943.js');
657
573
  const _ns_1 = _mod_1.Y;
658
574
  const { getPropertyData: getPropertyDataFromDb } = _ns_1;
659
575
  const metaRow = await getPropertyDataFromDb({
@@ -740,8 +656,11 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
740
656
  }
741
657
  // The local seed, also when the ref is the old uid of a seed published again since.
742
658
  const relatedSeed = await findRelatedSeedRow({ seedLocalId, seedUid });
659
+ if (!isStorageSeed && deferIfBackEdge(ctx, relationOrImageProperty, [relatedSeed?.seedLocalId ?? seedLocalId])) {
660
+ return multiPublishPayload;
661
+ }
743
662
  // Use dynamic import to break circular dependency
744
- const getItemMod = await import('./getItem-DEh4WfHG.js');
663
+ const getItemMod = await import('./getItem-CSfSok9f.js');
745
664
  const { getItem } = getItemMod;
746
665
  const relatedItem = await getItem(relatedSeed ? { seedLocalId: relatedSeed.seedLocalId } : { seedLocalId, seedUid });
747
666
  if (noteRelatedSeed(ctx, normalizedRef, relatedSeed, relationOrImageProperty.propertyName, relatedItem?.modelName ?? relatedModelNameFromDef(relationOrImageProperty.propertyDef))) {
@@ -761,7 +680,6 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
761
680
  if (relatedItem.seedUid && relatedItem.seedUid !== ZERO_BYTES32) {
762
681
  return multiPublishPayload;
763
682
  }
764
- const versionUid = getVersionUid(relatedItem);
765
683
  let modelName;
766
684
  if (matchesDataType(relationOrImageProperty.propertyDef?.dataType, ModelPropertyDataTypes.Image)) {
767
685
  modelName = 'Image';
@@ -780,68 +698,106 @@ const processRelationOrImageProperty = async (relationOrImageProperty, multiPubl
780
698
  addValidationError(ctx, `Model name not found for relation or image property: ${relationOrImageProperty.propertyName}`, relationOrImageProperty.propertyName);
781
699
  return multiPublishPayload;
782
700
  }
701
+ return processRelatedDraftItem({
702
+ relatedItem,
703
+ modelName,
704
+ // A storage seed (Image/File/Html/Json item) attests its own basic properties; a related model
705
+ // item is published with its full property set and the draft items it reaches in turn.
706
+ fullDraft: !isStorageSeed,
707
+ link: { publishLocalId: originalSeedLocalId, propertySchemaUid: relationOrImageSchemaUid },
708
+ reportPropertyName: relationOrImageProperty.propertyName,
709
+ multiPublishPayload,
710
+ uploadedTransactions,
711
+ ctx,
712
+ buildOpts,
713
+ });
714
+ };
715
+ /**
716
+ * The payload of a draft item (no seed uid) a published item refers to, published with it. Its
717
+ * request fills the referring property (`link`) through propertiesToUpdate. With `fullDraft`, the
718
+ * item's whole property set is attested: its storage seeds and Html-embedded images, and its own
719
+ * relation and list properties, whose draft targets are published with it in turn (depth first,
720
+ * see publishDraftGraph.ts). A draft already in the batch only gains the link.
721
+ */
722
+ async function processRelatedDraftItem({ relatedItem, modelName, fullDraft, link, reportPropertyName, multiPublishPayload, uploadedTransactions, ctx, buildOpts, }) {
723
+ const forceFullSnapshot = buildOpts?.forceFullSnapshot === true;
783
724
  const seedSchemaUid = await getEasSchemaUidForModel(modelName);
784
725
  if (!seedSchemaUid) {
785
- addValidationError(ctx, `Schema UID not found for model: ${modelName}`, relationOrImageProperty.propertyName);
726
+ addValidationError(ctx, `Schema UID not found for model: ${modelName}`, reportPropertyName);
786
727
  return multiPublishPayload;
787
728
  }
788
- if (mergeChildPublishPayloadIfDuplicateInBatch(multiPublishPayload, relatedItem.seedLocalId, originalSeedLocalId, relationOrImageSchemaUid)) {
729
+ if (multiPublishPayload.some((p) => p.localId === relatedItem.seedLocalId)) {
730
+ if (link) {
731
+ mergeChildPublishPayloadIfDuplicateInBatch(multiPublishPayload, relatedItem.seedLocalId, link.publishLocalId, link.propertySchemaUid);
732
+ }
789
733
  return multiPublishPayload;
790
734
  }
791
735
  let publishPayload = {
792
736
  localId: relatedItem.seedLocalId,
793
737
  seedIsRevocable: true,
794
738
  versionSchemaUid: VERSION_SCHEMA_UID,
795
- seedUid: seedUid || ZERO_BYTES32,
739
+ seedUid: ZERO_BYTES32,
796
740
  seedSchemaUid,
797
- versionUid,
741
+ versionUid: getVersionUid(relatedItem),
798
742
  listOfAttestations: [],
799
- propertiesToUpdate: [
800
- {
801
- publishLocalId: originalSeedLocalId,
802
- propertySchemaUid: relationOrImageSchemaUid,
803
- },
804
- ],
743
+ propertiesToUpdate: link ? [{ ...link }] : [],
805
744
  };
806
- await ensurePropertyDefs(relatedItem);
807
- const { itemBasicProperties, itemUploadProperties, itemImageProperties: relatedStorageSeedProperties } = await getSegmentedItemProperties(relatedItem);
808
- // A draft item related to the published one is published with it, including its own
809
- // Image/File/Html/Json properties and the images embedded in its Html (as for the item itself).
810
- if (!isStorageSeed) {
811
- multiPublishPayload = await processRelatedDraftStorageSeeds(relatedItem, relatedStorageSeedProperties, itemBasicProperties, multiPublishPayload, uploadedTransactions, ctx, buildOpts);
812
- }
813
- const relatedStorageUpload = resolveStorageTransactionUploadSlot(relatedItem, itemUploadProperties);
814
- if (relatedStorageUpload) {
815
- const transactionData = findUploadedTxForSeedLocalId(uploadedTransactions, relatedItem.seedLocalId);
816
- if (transactionData) {
817
- const itemProperty = relatedStorageUpload.itemProperty;
818
- // Publish encoding reads context.propertyValue; do not await ItemProperty.save() here — it
819
- // uses xstate waitFor(10s) for idle and can time out while the machine is busy or still loading.
820
- itemProperty.getService().send({
821
- type: 'updateContext',
822
- propertyValue: transactionData.txId,
823
- renderValue: transactionData.txId,
824
- });
825
- replaceStorageTransactionInBasicProperties(itemBasicProperties, itemProperty);
745
+ ctx.newSeedsInProgress ?? (ctx.newSeedsInProgress = new Set());
746
+ ctx.newSeedsInProgress.add(relatedItem.seedLocalId);
747
+ try {
748
+ await ensurePropertyDefs(relatedItem);
749
+ const segmented = await getSegmentedItemProperties(relatedItem);
750
+ const { itemBasicProperties, itemUploadProperties, itemImageProperties: relatedStorageSeedProperties } = segmented;
751
+ if (fullDraft) {
752
+ // Its own Image/File/Html/Json properties and the images embedded in its Html (as for the item itself).
753
+ multiPublishPayload = await processRelatedDraftStorageSeeds(relatedItem, relatedStorageSeedProperties, itemBasicProperties, multiPublishPayload, uploadedTransactions, ctx, buildOpts);
754
+ // Its relations and lists: their draft targets are published too (same walk as publishDraftGraph).
755
+ const { relationProperties, listProperties } = draftWalkProperties(segmented);
756
+ for (const relationProperty of relationProperties) {
757
+ multiPublishPayload = await processRelationOrImageProperty(relationProperty, multiPublishPayload, uploadedTransactions, relatedItem.seedLocalId, ctx, buildOpts);
758
+ itemBasicProperties.push(relationProperty);
759
+ }
760
+ for (const listProperty of listProperties) {
761
+ multiPublishPayload = await processListProperty(listProperty, multiPublishPayload, uploadedTransactions, relatedItem.seedLocalId, ctx, buildOpts);
762
+ itemBasicProperties.push(listProperty);
763
+ }
826
764
  }
827
- }
828
- for (const p of itemBasicProperties) {
829
- if (isStorageTransactionPropertyName(p.propertyName) &&
830
- !p.propertyDef &&
831
- relatedItem.modelName) {
832
- const schema = await getPropertySchema(relatedItem.modelName, 'storageTransactionId', await getItemModelScope(relatedItem));
833
- if (schema) {
834
- p.getService().send({ type: 'updateContext', propertyRecordSchema: schema });
765
+ const relatedStorageUpload = resolveStorageTransactionUploadSlot(relatedItem, itemUploadProperties);
766
+ if (relatedStorageUpload) {
767
+ const transactionData = findUploadedTxForSeedLocalId(uploadedTransactions, relatedItem.seedLocalId);
768
+ if (transactionData) {
769
+ const itemProperty = relatedStorageUpload.itemProperty;
770
+ // Publish encoding reads context.propertyValue; do not await ItemProperty.save() here — it
771
+ // uses xstate waitFor(10s) for idle and can time out while the machine is busy or still loading.
772
+ itemProperty.getService().send({
773
+ type: 'updateContext',
774
+ propertyValue: transactionData.txId,
775
+ renderValue: transactionData.txId,
776
+ });
777
+ replaceStorageTransactionInBasicProperties(itemBasicProperties, itemProperty);
835
778
  }
836
779
  }
780
+ for (const p of itemBasicProperties) {
781
+ if (isStorageTransactionPropertyName(p.propertyName) &&
782
+ !p.propertyDef &&
783
+ relatedItem.modelName) {
784
+ const schema = await getPropertySchema(relatedItem.modelName, 'storageTransactionId', await getItemModelScope(relatedItem));
785
+ if (schema) {
786
+ p.getService().send({ type: 'updateContext', propertyRecordSchema: schema });
787
+ }
788
+ }
789
+ }
790
+ dedupeOneStorageTransactionPropertyInList(itemBasicProperties);
791
+ publishPayload = await processBasicProperties(itemBasicProperties, publishPayload, ctx, {
792
+ forceFullSnapshot,
793
+ });
794
+ }
795
+ finally {
796
+ ctx.newSeedsInProgress.delete(relatedItem.seedLocalId);
837
797
  }
838
- dedupeOneStorageTransactionPropertyInList(itemBasicProperties);
839
- publishPayload = await processBasicProperties(itemBasicProperties, publishPayload, ctx, {
840
- forceFullSnapshot,
841
- });
842
798
  multiPublishPayload.push(publishPayload);
843
799
  return multiPublishPayload;
844
- };
800
+ }
845
801
  /**
846
802
  * Storage-seed properties (Image/File/Html/Json) of a draft item related to the published one, and
847
803
  * the images embedded in its Html (htmlEmbeddedImageCoPublish rows it owns): payloads for their seeds,
@@ -853,7 +809,7 @@ async function processRelatedDraftStorageSeeds(relatedItem, storageSeedPropertie
853
809
  multiPublishPayload = await processRelationOrImageProperty(storageSeedProperty, multiPublishPayload, uploadedTransactions, relatedItem.seedLocalId, ctx, buildOpts);
854
810
  itemBasicProperties.push(storageSeedProperty);
855
811
  }
856
- return processHtmlEmbeddedCoPublishImagePayloads(relatedItem, multiPublishPayload, uploadedTransactions, relatedItem.seedLocalId, ctx, buildOpts);
812
+ return processHtmlEmbeddedCoPublishImagePayloads(relatedItem, multiPublishPayload, uploadedTransactions, ctx, buildOpts);
857
813
  }
858
814
  async function resolveHtmlPropertySchemaUidByHtmlSeed(item, htmlSeedLocalId, ctx) {
859
815
  const want = htmlSeedLocalId.trim();
@@ -875,7 +831,7 @@ async function resolveHtmlPropertySchemaUidByHtmlSeed(item, htmlSeedLocalId, ctx
875
831
  addValidationError(ctx, `Could not find Html property for embedded image rewrite (html seed ${want}).`, 'html', 'html_embed_schema');
876
832
  return undefined;
877
833
  }
878
- async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPayload, uploadedTransactions, originalSeedLocalId, ctx, buildOpts) {
834
+ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPayload, uploadedTransactions, ctx, buildOpts) {
879
835
  const appDb = BaseDb.getAppDb();
880
836
  if (!appDb)
881
837
  return multiPublishPayload;
@@ -886,7 +842,7 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
886
842
  if (rows.length === 0)
887
843
  return multiPublishPayload;
888
844
  const forceFullSnapshot = buildOpts?.forceFullSnapshot === true;
889
- const getItemMod = await import('./getItem-DEh4WfHG.js');
845
+ const getItemMod = await import('./getItem-CSfSok9f.js');
890
846
  const { getItem } = getItemMod;
891
847
  const doneImages = new Set();
892
848
  for (const row of rows) {
@@ -899,6 +855,7 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
899
855
  if (noteRelatedSeed(ctx, row.imageSeedLocalId, imageSeed, htmlPropertyNameForHtmlSeed(item, row.htmlSeedLocalId), 'Image')) {
900
856
  continue;
901
857
  }
858
+ // The row's Html seed must still be the value of one of the item's Html properties.
902
859
  const htmlSchemaUid = await resolveHtmlPropertySchemaUidByHtmlSeed(item, row.htmlSeedLocalId, ctx);
903
860
  if (!htmlSchemaUid)
904
861
  continue;
@@ -915,10 +872,16 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
915
872
  addValidationError(ctx, `Schema UID not found for model: Image`, 'html');
916
873
  continue;
917
874
  }
918
- if (mergeChildPublishPayloadIfDuplicateInBatch(multiPublishPayload, relatedItem.seedLocalId, originalSeedLocalId, htmlSchemaUid)) {
875
+ // Already in the batch (e.g. also the value of an Image property): its payload is there.
876
+ if (multiPublishPayload.some((p) => p.localId === relatedItem.seedLocalId)) {
919
877
  continue;
920
878
  }
921
879
  const versionUid = getVersionUid(relatedItem);
880
+ // No propertiesToUpdate: the Html refers to the image by its Arweave URL (the data URI is
881
+ // rewritten to it before the Html is uploaded), not by seed uid. The Html property holds the Html
882
+ // storage seed's uid, which the Html seed's own request writes into it; the contract writes each
883
+ // updater's seed uid into the same data[0] (SeedPublishLib.setSeedReference), so an image
884
+ // targeting the Html property too would overwrite that reference with the image's seed uid.
922
885
  let publishPayload = {
923
886
  localId: relatedItem.seedLocalId,
924
887
  seedIsRevocable: true,
@@ -927,12 +890,7 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
927
890
  seedSchemaUid,
928
891
  versionUid,
929
892
  listOfAttestations: [],
930
- propertiesToUpdate: [
931
- {
932
- publishLocalId: originalSeedLocalId,
933
- propertySchemaUid: htmlSchemaUid,
934
- },
935
- ],
893
+ propertiesToUpdate: [],
936
894
  };
937
895
  await ensurePropertyDefs(relatedItem);
938
896
  const { itemBasicProperties, itemUploadProperties } = await getSegmentedItemProperties(relatedItem);
@@ -967,7 +925,7 @@ async function processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPaylo
967
925
  }
968
926
  return multiPublishPayload;
969
927
  }
970
- const processListProperty = async (listProperty, multiPublishPayload, originalSeedLocalId, ctx, buildOpts) => {
928
+ const processListProperty = async (listProperty, multiPublishPayload, uploadedTransactions, originalSeedLocalId, ctx, buildOpts) => {
971
929
  const forceFullSnapshot = buildOpts?.forceFullSnapshot === true;
972
930
  // processListProperty only handles list-of-relations; list-of-primitives go to itemBasicProperties
973
931
  if (!listProperty.propertyDef?.ref) {
@@ -1000,6 +958,7 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
1000
958
  : value != null
1001
959
  ? [value]
1002
960
  : [];
961
+ const members = [];
1003
962
  for (const seedId of iterableValue) {
1004
963
  const idStr = typeof seedId === 'string'
1005
964
  ? seedId
@@ -1011,9 +970,20 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
1011
970
  const { localId: seedLocalId, uid: seedUid } = getCorrectId(idStr);
1012
971
  if (!seedLocalId && !seedUid)
1013
972
  continue;
1014
- const relatedSeed = await findRelatedSeedRow({ seedLocalId, seedUid });
973
+ members.push({ idStr, seedLocalId, seedUid });
974
+ }
975
+ // A member that is an item still in progress (a cycle back to it) can't be attested in this
976
+ // publish, so the list is deferred; its other draft members are still published, unlinked.
977
+ const memberSeeds = await Promise.all(members.map((m) => findRelatedSeedRow({ seedLocalId: m.seedLocalId, seedUid: m.seedUid })));
978
+ const deferred = deferIfBackEdge(ctx, listProperty, members.map((m, i) => memberSeeds[i]?.seedLocalId ?? m.seedLocalId));
979
+ for (let i = 0; i < members.length; i++) {
980
+ const { idStr, seedLocalId, seedUid } = members[i];
981
+ const relatedSeed = memberSeeds[i] ?? null;
982
+ const memberLocalId = relatedSeed?.seedLocalId ?? seedLocalId;
983
+ if (memberLocalId && ctx.newSeedsInProgress?.has(memberLocalId))
984
+ continue;
1015
985
  // Use dynamic import to break circular dependency
1016
- const getItemMod = await import('./getItem-DEh4WfHG.js');
986
+ const getItemMod = await import('./getItem-CSfSok9f.js');
1017
987
  const { getItem } = getItemMod;
1018
988
  const relatedItem = await getItem(relatedSeed ? { seedLocalId: relatedSeed.seedLocalId } : { seedLocalId, seedUid });
1019
989
  if (noteRelatedSeed(ctx, idStr.trim(), relatedSeed, listProperty.propertyName, relatedItem?.modelName ?? relatedModelNameFromDef(listProperty.propertyDef))) {
@@ -1029,7 +999,6 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
1029
999
  if (relatedItem.seedUid && relatedItem.seedUid !== ZERO_BYTES32) {
1030
1000
  continue;
1031
1001
  }
1032
- const versionUid = getVersionUid(relatedItem);
1033
1002
  let modelName;
1034
1003
  if (listProperty.propertyDef?.ref || listProperty.propertyDef.refModelName) {
1035
1004
  const def = listProperty.propertyDef;
@@ -1048,36 +1017,17 @@ const processListProperty = async (listProperty, multiPublishPayload, originalSe
1048
1017
  addValidationError(ctx, `Model name not found for list property: ${listProperty.propertyName}`, listProperty.propertyName);
1049
1018
  continue;
1050
1019
  }
1051
- const seedSchemaUid = await getEasSchemaUidForModel(modelName);
1052
- if (!seedSchemaUid) {
1053
- addValidationError(ctx, `Schema UID not found for model: ${modelName}`, listProperty.propertyName);
1054
- continue;
1055
- }
1056
- if (mergeChildPublishPayloadIfDuplicateInBatch(multiPublishPayload, relatedItem.seedLocalId, originalSeedLocalId, listPropertySchemaUid)) {
1057
- continue;
1058
- }
1059
- let publishPayload = {
1060
- localId: relatedItem.seedLocalId,
1061
- seedIsRevocable: true,
1062
- versionSchemaUid: VERSION_SCHEMA_UID,
1063
- seedUid: seedUid || ZERO_BYTES32,
1064
- seedSchemaUid,
1065
- versionUid,
1066
- listOfAttestations: [],
1067
- propertiesToUpdate: [
1068
- {
1069
- publishLocalId: originalSeedLocalId,
1070
- propertySchemaUid: listPropertySchemaUid,
1071
- },
1072
- ],
1073
- };
1074
- await ensurePropertyDefs(relatedItem);
1075
- const { itemBasicProperties } = await getSegmentedItemProperties(relatedItem);
1076
- dedupeOneStorageTransactionPropertyInList(itemBasicProperties);
1077
- publishPayload = await processBasicProperties(itemBasicProperties, publishPayload, ctx, {
1078
- forceFullSnapshot,
1020
+ multiPublishPayload = await processRelatedDraftItem({
1021
+ relatedItem,
1022
+ modelName,
1023
+ fullDraft: true,
1024
+ link: deferred ? null : { publishLocalId: originalSeedLocalId, propertySchemaUid: listPropertySchemaUid },
1025
+ reportPropertyName: listProperty.propertyName,
1026
+ multiPublishPayload,
1027
+ uploadedTransactions,
1028
+ ctx,
1029
+ buildOpts,
1079
1030
  });
1080
- multiPublishPayload.push(publishPayload);
1081
1031
  }
1082
1032
  return multiPublishPayload;
1083
1033
  };
@@ -1221,6 +1171,11 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
1221
1171
  addValidationError(validationCtx, 'Publishing as a new version requires the item to already have a published Seed attestation (seed UID).', 'seedUid', 'publish_new_version_requires_seed');
1222
1172
  }
1223
1173
  let multiPublishPayload = [];
1174
+ // The root gets a new seed (draft, or revoked seed published again): related drafts referring
1175
+ // back to it can't attest its uid in this publish (see publishDraftGraph.ts).
1176
+ if (rootSeedUid === ZERO_BYTES32) {
1177
+ validationCtx.newSeedsInProgress = new Set([item.seedLocalId]);
1178
+ }
1224
1179
  // Each PublishPayload is generated from a Seed that needs publishing
1225
1180
  // First we need to determine all Seeds to publish
1226
1181
  // That means the Seed of the Item, plus any Seeds pointed to by Relations
@@ -1303,9 +1258,9 @@ const getPublishPayload = async (item, uploadedTransactions, options) => {
1303
1258
  multiPublishPayload = await processRelationOrImageProperty(relationProperty, multiPublishPayload, uploadedTransactions, item.seedLocalId, validationCtx, { forceFullSnapshot });
1304
1259
  itemBasicProperties.push(relationProperty);
1305
1260
  }
1306
- multiPublishPayload = await processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPayload, uploadedTransactions, item.seedLocalId, validationCtx, { forceFullSnapshot });
1261
+ multiPublishPayload = await processHtmlEmbeddedCoPublishImagePayloads(item, multiPublishPayload, uploadedTransactions, validationCtx, { forceFullSnapshot });
1307
1262
  for (const listProperty of itemListProperties) {
1308
- multiPublishPayload = await processListProperty(listProperty, multiPublishPayload, item.seedLocalId, validationCtx, { forceFullSnapshot });
1263
+ multiPublishPayload = await processListProperty(listProperty, multiPublishPayload, uploadedTransactions, item.seedLocalId, validationCtx, { forceFullSnapshot });
1309
1264
  itemBasicProperties.push(listProperty);
1310
1265
  }
1311
1266
  for (const p of itemBasicProperties) {
@@ -1628,5 +1583,5 @@ var getPublishPayload$1 = /*#__PURE__*/Object.freeze({
1628
1583
  validateItemForPublish: validateItemForPublish
1629
1584
  });
1630
1585
 
1631
- export { PublishValidationFailedError as P, RELATED_ITEM_UNPUBLISHED_CODE as R, isUnpublishedSeed as a, RelatedItemUnpublishedError as b, resolvePublishPayloadValues as c, findRelatedSeedRow as f, getPublishPayload$1 as g, htmlPropertyNameForHtmlSeed as h, isSeedRevoked as i, relatedModelNameFromDef as r, validateItemForPublish as v };
1632
- //# sourceMappingURL=getPublishPayload-H032DHC7.js.map
1586
+ export { PublishValidationFailedError as P, RELATED_ITEM_UNPUBLISHED_CODE as R, RelatedItemUnpublishedError as a, getPublishPayload$1 as g, resolvePublishPayloadValues as r, validateItemForPublish as v };
1587
+ //# sourceMappingURL=getPublishPayload-76_KfB5Y.js.map