@seedprotocol/sdk 0.7.9-next.1189.g5e63267 → 0.7.9

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 (581) hide show
  1. package/dist/BaseFileManager-BAlySv8w.js +650 -0
  2. package/dist/BaseFileManager-BAlySv8w.js.map +1 -0
  3. package/dist/{Item-CG5IhPtL.js → Item-Bf4kWKpH.js} +5576 -6649
  4. package/dist/Item-Bf4kWKpH.js.map +1 -0
  5. package/dist/{ModelProperty-DDD47KVm.js → ModelProperty-BlaEgb_U.js} +345 -709
  6. package/dist/ModelProperty-BlaEgb_U.js.map +1 -0
  7. package/dist/Schema-J_1f6p0c.js +1456 -0
  8. package/dist/Schema-J_1f6p0c.js.map +1 -0
  9. package/dist/{SchemaValidationService-CZzKNL04.js → SchemaValidationService-CnmKyzR-.js} +6 -9
  10. package/dist/{SchemaValidationService-CZzKNL04.js.map → SchemaValidationService-CnmKyzR-.js.map} +1 -1
  11. package/dist/{configurePlatform-Dukm2QwO.js → configurePlatform-CiOJ1R3q.js} +3 -12
  12. package/dist/configurePlatform-CiOJ1R3q.js.map +1 -0
  13. package/dist/db/drizzle/0026_add_content_hash_to_schemas.sql +1 -0
  14. package/dist/db/drizzle/0027_link_metadata_property_ids.sql +74 -0
  15. package/dist/db/drizzle/0028_add_definition_to_properties.sql +17 -0
  16. package/dist/db/drizzle/0029_dedupe_chain_uids_add_unique_indexes.sql +120 -0
  17. package/dist/db/drizzle/meta/0026_snapshot.json +1659 -0
  18. package/dist/db/drizzle/meta/0027_snapshot.json +1659 -0
  19. package/dist/db/drizzle/meta/0028_snapshot.json +1666 -0
  20. package/dist/db/drizzle/meta/0029_snapshot.json +1691 -0
  21. package/dist/db/drizzle/meta/_journal.json +29 -1
  22. package/dist/{detachRowsBeforeDelete-Di1enVUF.js → detachRowsBeforeDelete-sEaUwlOU.js} +2 -13
  23. package/dist/{detachRowsBeforeDelete-Di1enVUF.js.map → detachRowsBeforeDelete-sEaUwlOU.js.map} +1 -1
  24. package/dist/dist/{index-rOTW-2QZ.d.ts → BaseFileManager-BAlySv8w.d.ts} +1407 -2700
  25. package/dist/dist/BaseFileManager-BAlySv8w.d.ts.map +1 -0
  26. package/dist/dist/{configurePlatform-Dukm2QwO.d.ts → configurePlatform-CiOJ1R3q.d.ts} +1 -1
  27. package/dist/dist/configurePlatform-CiOJ1R3q.d.ts.map +1 -0
  28. package/dist/dist/{index-DxHpPNfn.d.ts → index-D0V-mjCV.d.ts} +39 -1
  29. package/dist/dist/{index-DxHpPNfn.d.ts.map → index-D0V-mjCV.d.ts.map} +1 -1
  30. package/dist/dist/{index.node-WsEJCOwC.d.ts → index.node-CYPemH-t.d.ts} +157 -5
  31. package/dist/dist/{index.node-WsEJCOwC.d.ts.map → index.node-CYPemH-t.d.ts.map} +1 -1
  32. package/dist/dist/platform.node.d.ts +2 -2
  33. package/dist/eas-wB_fQ8Tc.js +32 -0
  34. package/dist/eas-wB_fQ8Tc.js.map +1 -0
  35. package/dist/errors-DLSoqSHG.js +6550 -0
  36. package/dist/errors-DLSoqSHG.js.map +1 -0
  37. package/dist/getPublishPayload-BnIwpwz1.js +760 -0
  38. package/dist/getPublishPayload-BnIwpwz1.js.map +1 -0
  39. package/dist/getPublishPendingDiff-D6_-A5ns.js +125 -0
  40. package/dist/getPublishPendingDiff-D6_-A5ns.js.map +1 -0
  41. package/dist/getPublishUploads-sS6JfPgz.js +783 -0
  42. package/dist/getPublishUploads-sS6JfPgz.js.map +1 -0
  43. package/dist/{index-DQoyhp2c.js → index-BVBmz_cc.js} +11 -14
  44. package/dist/index-BVBmz_cc.js.map +1 -0
  45. package/dist/index-CYGWPoOx.js +27 -0
  46. package/dist/index-CYGWPoOx.js.map +1 -0
  47. package/dist/{index-DxHpPNfn.js → index-D0V-mjCV.js} +2 -2
  48. package/dist/index-D0V-mjCV.js.map +1 -0
  49. package/dist/index-DmTtj1nk.js +817 -0
  50. package/dist/index-DmTtj1nk.js.map +1 -0
  51. package/dist/{index.browser-QPWBkLJA.js → index.browser-CUmBVYen.js} +397 -356
  52. package/dist/index.browser-CUmBVYen.js.map +1 -0
  53. package/dist/{index.node-WsEJCOwC.js → index.node-CYPemH-t.js} +10 -10
  54. package/dist/index.node-CYPemH-t.js.map +1 -0
  55. package/dist/main.js +23 -1075
  56. package/dist/main.js.map +1 -1
  57. package/dist/modelPropertyRecordSchemas-C7UgA5TH.js +48 -0
  58. package/dist/modelPropertyRecordSchemas-C7UgA5TH.js.map +1 -0
  59. package/dist/node.js +14 -18
  60. package/dist/node.js.map +1 -1
  61. package/dist/platform.browser.js +8 -13
  62. package/dist/platform.browser.js.map +1 -1
  63. package/dist/platform.node.js +6 -16
  64. package/dist/platform.node.js.map +1 -1
  65. package/dist/property-BxUYznH0.js +87 -0
  66. package/dist/property-BxUYznH0.js.map +1 -0
  67. package/dist/publishGraph-EcB40Uii.js +311 -0
  68. package/dist/publishGraph-EcB40Uii.js.map +1 -0
  69. package/dist/readHtmlBodyForStorageSeed-D6KPtWoR.js +110 -0
  70. package/dist/readHtmlBodyForStorageSeed-D6KPtWoR.js.map +1 -0
  71. package/dist/seedSchema/ModelSchema.ts +4 -0
  72. package/dist/seedSchema/ModelSchemaSchema.ts +5 -2
  73. package/dist/seedSchema/PendingWriteSchema.ts +4 -1
  74. package/dist/seedSchema/SchemaSchema.ts +3 -0
  75. package/dist/seedSchema/SeedSchema.ts +8 -2
  76. package/dist/seedSchema/VersionSchema.ts +7 -2
  77. package/dist/seedSchema/attestedUid.ts +10 -0
  78. package/dist/src/Item/Item.d.ts +32 -30
  79. package/dist/src/Item/Item.d.ts.map +1 -1
  80. package/dist/src/Item/loadItem.d.ts +12 -0
  81. package/dist/src/Item/loadItem.d.ts.map +1 -0
  82. package/dist/src/Item/service/itemMachineSingle.d.ts +2 -13
  83. package/dist/src/Item/service/itemMachineSingle.d.ts.map +1 -1
  84. package/dist/src/ItemProperty/ItemProperty.d.ts +77 -46
  85. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  86. package/dist/src/ItemProperty/loadProperty.d.ts +11 -0
  87. package/dist/src/ItemProperty/loadProperty.d.ts.map +1 -0
  88. package/dist/src/ItemProperty/propertyWrite.d.ts +54 -0
  89. package/dist/src/ItemProperty/propertyWrite.d.ts.map +1 -0
  90. package/dist/src/ItemProperty/{service/actors/saveValueToDb/rowContext.d.ts → rowContext.d.ts} +1 -1
  91. package/dist/src/ItemProperty/rowContext.d.ts.map +1 -0
  92. package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts +6 -0
  93. package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
  94. package/dist/src/ItemProperty/service/actors/modelPropertyRecordSchemas.d.ts +5 -15
  95. package/dist/src/ItemProperty/service/actors/modelPropertyRecordSchemas.d.ts.map +1 -1
  96. package/dist/src/ItemProperty/service/propertyMachine.d.ts +4 -50
  97. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  98. package/dist/src/Model/Model.d.ts +26 -56
  99. package/dist/src/Model/Model.d.ts.map +1 -1
  100. package/dist/src/Model/createModelProperties.d.ts +10 -0
  101. package/dist/src/Model/createModelProperties.d.ts.map +1 -0
  102. package/dist/src/Model/loadModel.d.ts +13 -0
  103. package/dist/src/Model/loadModel.d.ts.map +1 -0
  104. package/dist/src/Model/service/actors/validateModel.d.ts.map +1 -1
  105. package/dist/src/Model/service/modelMachine.d.ts +5 -114
  106. package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
  107. package/dist/src/ModelProperty/ModelProperty.d.ts +44 -37
  108. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  109. package/dist/src/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
  110. package/dist/src/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
  111. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +6 -77
  112. package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
  113. package/dist/src/Schema/Schema.d.ts +36 -37
  114. package/dist/src/Schema/Schema.d.ts.map +1 -1
  115. package/dist/src/Schema/loadOrCreateSchema.d.ts +21 -0
  116. package/dist/src/Schema/loadOrCreateSchema.d.ts.map +1 -0
  117. package/dist/src/Schema/service/schemaMachine.d.ts +7 -125
  118. package/dist/src/Schema/service/schemaMachine.d.ts.map +1 -1
  119. package/dist/src/browser/db/Db.d.ts.map +1 -1
  120. package/dist/src/browser/db/changeFeed.d.ts +2 -18
  121. package/dist/src/browser/db/changeFeed.d.ts.map +1 -1
  122. package/dist/src/browser/db/drizzleFiles.d.ts +6 -2
  123. package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
  124. package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
  125. package/dist/src/browser/workers/imageResize.d.ts.map +1 -1
  126. package/dist/src/client/ClientManager.d.ts +90 -57
  127. package/dist/src/client/ClientManager.d.ts.map +1 -1
  128. package/dist/src/client/actors/addModelsToDb.d.ts +9 -7
  129. package/dist/src/client/actors/addModelsToDb.d.ts.map +1 -1
  130. package/dist/src/client/actors/dbInit.d.ts +3 -3
  131. package/dist/src/client/actors/dbInit.d.ts.map +1 -1
  132. package/dist/src/client/actors/fileSystemInit.d.ts +3 -3
  133. package/dist/src/client/actors/fileSystemInit.d.ts.map +1 -1
  134. package/dist/src/client/actors/platformClassesInit.d.ts +10 -5
  135. package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
  136. package/dist/src/client/actors/processSchemaFiles.d.ts +18 -3
  137. package/dist/src/client/actors/processSchemaFiles.d.ts.map +1 -1
  138. package/dist/src/client/actors/saveConfig.d.ts +6 -3
  139. package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
  140. package/dist/src/client/clientManagerMachine.d.ts +22 -20
  141. package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
  142. package/dist/src/client/constants.d.ts +1 -9
  143. package/dist/src/client/constants.d.ts.map +1 -1
  144. package/dist/src/client/readiness.d.ts +26 -0
  145. package/dist/src/client/readiness.d.ts.map +1 -0
  146. package/dist/src/db/read/currentPropertyRow.d.ts +61 -0
  147. package/dist/src/db/read/currentPropertyRow.d.ts.map +1 -0
  148. package/dist/src/db/read/findSeedRow.d.ts +20 -0
  149. package/dist/src/db/read/findSeedRow.d.ts.map +1 -0
  150. package/dist/src/db/read/findSeedRowsByUid.d.ts +4 -1
  151. package/dist/src/db/read/findSeedRowsByUid.d.ts.map +1 -1
  152. package/dist/src/db/read/getAttesterForSeed.d.ts +1 -1
  153. package/dist/src/db/read/getAttesterForSeed.d.ts.map +1 -1
  154. package/dist/src/db/read/getItemData.d.ts.map +1 -1
  155. package/dist/src/db/read/getItemProperties.d.ts +5 -0
  156. package/dist/src/db/read/getItemProperties.d.ts.map +1 -1
  157. package/dist/src/db/read/getMetadataAttestationUidsForSeedUid.d.ts.map +1 -1
  158. package/dist/src/db/read/getModelSchemas.d.ts +0 -7
  159. package/dist/src/db/read/getModelSchemas.d.ts.map +1 -1
  160. package/dist/src/db/read/getModelsData.d.ts.map +1 -1
  161. package/dist/src/db/read/getPropertyClear.d.ts +5 -1
  162. package/dist/src/db/read/getPropertyClear.d.ts.map +1 -1
  163. package/dist/src/db/read/getPublishPayload.d.ts +35 -40
  164. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  165. package/dist/src/db/read/getPublishPendingDiff.d.ts +2 -2
  166. package/dist/src/db/read/getPublishPendingDiff.d.ts.map +1 -1
  167. package/dist/src/db/read/getPublishUploads.d.ts +59 -28
  168. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  169. package/dist/src/db/read/getSchemaUidForModel.d.ts.map +1 -1
  170. package/dist/src/db/read/getSeedPublishState.d.ts.map +1 -1
  171. package/dist/src/db/read/getSeedPublisher.d.ts.map +1 -1
  172. package/dist/src/db/read/getVersionsForSeedUid.d.ts.map +1 -1
  173. package/dist/src/db/read/isSeedRevoked.d.ts.map +1 -1
  174. package/dist/src/db/read/localModelSchemaLookups.d.ts +8 -0
  175. package/dist/src/db/read/localModelSchemaLookups.d.ts.map +1 -0
  176. package/dist/src/db/read/metadataProperty.d.ts +104 -0
  177. package/dist/src/db/read/metadataProperty.d.ts.map +1 -0
  178. package/dist/src/db/read/publishGraph.d.ts +148 -0
  179. package/dist/src/db/read/publishGraph.d.ts.map +1 -0
  180. package/dist/src/db/read/resolveModelRecord.d.ts +26 -2
  181. package/dist/src/db/read/resolveModelRecord.d.ts.map +1 -1
  182. package/dist/src/db/read/resolveRelatedSeedRef.d.ts +1 -7
  183. package/dist/src/db/read/resolveRelatedSeedRef.d.ts.map +1 -1
  184. package/dist/src/db/read/subqueries/metadataLatest.d.ts +3 -1
  185. package/dist/src/db/read/subqueries/metadataLatest.d.ts.map +1 -1
  186. package/dist/src/db/read/summarizePublishWork.d.ts +13 -5
  187. package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
  188. package/dist/src/db/write/applyPropertyAttestationUidsFromPublish.d.ts +20 -21
  189. package/dist/src/db/write/applyPropertyAttestationUidsFromPublish.d.ts.map +1 -1
  190. package/dist/src/db/write/createMetadata.d.ts.map +1 -1
  191. package/dist/src/db/write/createNewItem.d.ts.map +1 -1
  192. package/dist/src/db/write/createSeeds.d.ts +5 -1
  193. package/dist/src/db/write/createSeeds.d.ts.map +1 -1
  194. package/dist/src/db/write/definitions.d.ts +127 -0
  195. package/dist/src/db/write/definitions.d.ts.map +1 -0
  196. package/dist/src/db/write/mergeChainRows.d.ts +22 -0
  197. package/dist/src/db/write/mergeChainRows.d.ts.map +1 -0
  198. package/dist/src/db/write/saveDefinition.d.ts +29 -0
  199. package/dist/src/db/write/saveDefinition.d.ts.map +1 -0
  200. package/dist/src/db/write/updateSeedUid.d.ts +4 -2
  201. package/dist/src/db/write/updateSeedUid.d.ts.map +1 -1
  202. package/dist/src/db/write/updateVersionUid.d.ts +12 -4
  203. package/dist/src/db/write/updateVersionUid.d.ts.map +1 -1
  204. package/dist/src/db/write/writeModelUids.d.ts +10 -0
  205. package/dist/src/db/write/writeModelUids.d.ts.map +1 -0
  206. package/dist/src/eas.d.ts +8 -6
  207. package/dist/src/eas.d.ts.map +1 -1
  208. package/dist/src/events/files/download.d.ts.map +1 -1
  209. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  210. package/dist/src/helpers/arweaveContentTags.d.ts +1 -1
  211. package/dist/src/helpers/arweaveContentTags.d.ts.map +1 -1
  212. package/dist/src/helpers/compareMetadataRowsLatestFirst.d.ts +18 -3
  213. package/dist/src/helpers/compareMetadataRowsLatestFirst.d.ts.map +1 -1
  214. package/dist/src/helpers/constants.d.ts +5 -2
  215. package/dist/src/helpers/constants.d.ts.map +1 -1
  216. package/dist/src/helpers/dataUrl.d.ts +10 -0
  217. package/dist/src/helpers/dataUrl.d.ts.map +1 -0
  218. package/dist/src/helpers/db.d.ts +54 -105
  219. package/dist/src/helpers/db.d.ts.map +1 -1
  220. package/dist/src/helpers/ensureImageLocal.d.ts.map +1 -1
  221. package/dist/src/helpers/entity/contextUpdate.d.ts +20 -0
  222. package/dist/src/helpers/entity/contextUpdate.d.ts.map +1 -0
  223. package/dist/src/helpers/entity/draftSaveErrors.d.ts +5 -0
  224. package/dist/src/helpers/entity/draftSaveErrors.d.ts.map +1 -1
  225. package/dist/src/helpers/entity/entityCache.d.ts +65 -3
  226. package/dist/src/helpers/entity/entityCache.d.ts.map +1 -1
  227. package/dist/src/helpers/entity/entityCommon.d.ts +0 -22
  228. package/dist/src/helpers/entity/entityCommon.d.ts.map +1 -1
  229. package/dist/src/helpers/entity/entityLifecycle.d.ts +75 -0
  230. package/dist/src/helpers/entity/entityLifecycle.d.ts.map +1 -0
  231. package/dist/src/helpers/entity/entityLiveQuery.d.ts +1 -23
  232. package/dist/src/helpers/entity/entityLiveQuery.d.ts.map +1 -1
  233. package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts +4 -9
  234. package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts.map +1 -1
  235. package/dist/src/helpers/index.d.ts +2 -24
  236. package/dist/src/helpers/index.d.ts.map +1 -1
  237. package/dist/src/helpers/localImageBlobUrl.d.ts +7 -0
  238. package/dist/src/helpers/localImageBlobUrl.d.ts.map +1 -0
  239. package/dist/src/helpers/mediaRef.d.ts +3 -70
  240. package/dist/src/helpers/mediaRef.d.ts.map +1 -1
  241. package/dist/src/helpers/metadataPropertyNames.d.ts +34 -26
  242. package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
  243. package/dist/src/helpers/mimeTypes.d.ts +2 -1
  244. package/dist/src/helpers/mimeTypes.d.ts.map +1 -1
  245. package/dist/src/helpers/model.d.ts.map +1 -1
  246. package/dist/src/helpers/ownership.d.ts.map +1 -1
  247. package/dist/src/helpers/property.d.ts +21 -26
  248. package/dist/src/helpers/property.d.ts.map +1 -1
  249. package/dist/src/helpers/propertyDefinition.d.ts +59 -0
  250. package/dist/src/helpers/propertyDefinition.d.ts.map +1 -0
  251. package/dist/src/helpers/readHtmlBodyForStorageSeed.d.ts.map +1 -1
  252. package/dist/src/helpers/relationSeedRef.d.ts +0 -7
  253. package/dist/src/helpers/relationSeedRef.d.ts.map +1 -1
  254. package/dist/src/helpers/schema.d.ts +24 -38
  255. package/dist/src/helpers/schema.d.ts.map +1 -1
  256. package/dist/src/helpers/schemaApply.d.ts +135 -0
  257. package/dist/src/helpers/schemaApply.d.ts.map +1 -0
  258. package/dist/src/helpers/tabEvents.d.ts.map +1 -1
  259. package/dist/src/helpers/updateSchema.d.ts +2 -18
  260. package/dist/src/helpers/updateSchema.d.ts.map +1 -1
  261. package/dist/src/imports/index.d.ts +1 -1
  262. package/dist/src/imports/index.d.ts.map +1 -1
  263. package/dist/src/imports/json.d.ts +8 -78
  264. package/dist/src/imports/json.d.ts.map +1 -1
  265. package/dist/src/index.d.ts +13 -13
  266. package/dist/src/index.d.ts.map +1 -1
  267. package/dist/src/interfaces/IItem.d.ts +5 -0
  268. package/dist/src/interfaces/IItem.d.ts.map +1 -1
  269. package/dist/src/interfaces/IItemProperty.d.ts +9 -7
  270. package/dist/src/interfaces/IItemProperty.d.ts.map +1 -1
  271. package/dist/src/node/db/Db.d.ts.map +1 -1
  272. package/dist/src/node/index.d.ts +2 -1
  273. package/dist/src/node/index.d.ts.map +1 -1
  274. package/dist/src/outbox/conflicts.d.ts +2 -0
  275. package/dist/src/outbox/conflicts.d.ts.map +1 -1
  276. package/dist/src/outbox/itemAppliers.d.ts +63 -14
  277. package/dist/src/outbox/itemAppliers.d.ts.map +1 -1
  278. package/dist/src/outbox/outbox.d.ts +14 -3
  279. package/dist/src/outbox/outbox.d.ts.map +1 -1
  280. package/dist/src/outbox/pendingValues.d.ts +3 -1
  281. package/dist/src/outbox/pendingValues.d.ts.map +1 -1
  282. package/dist/src/outbox/storageValueRow.d.ts +7 -0
  283. package/dist/src/outbox/storageValueRow.d.ts.map +1 -0
  284. package/dist/src/platform/configurePlatform.d.ts.map +1 -1
  285. package/dist/src/platform/index.browser.d.ts.map +1 -1
  286. package/dist/src/platform/index.node.d.ts.map +1 -1
  287. package/dist/src/seedSchema/ModelSchema.d.ts +19 -0
  288. package/dist/src/seedSchema/ModelSchema.d.ts.map +1 -1
  289. package/dist/src/seedSchema/ModelSchemaSchema.d.ts.map +1 -1
  290. package/dist/src/seedSchema/PendingWriteSchema.d.ts.map +1 -1
  291. package/dist/src/seedSchema/SchemaSchema.d.ts +19 -0
  292. package/dist/src/seedSchema/SchemaSchema.d.ts.map +1 -1
  293. package/dist/src/seedSchema/SeedSchema.d.ts.map +1 -1
  294. package/dist/src/seedSchema/VersionSchema.d.ts.map +1 -1
  295. package/dist/src/seedSchema/attestedUid.d.ts +9 -0
  296. package/dist/src/seedSchema/attestedUid.d.ts.map +1 -0
  297. package/dist/src/storageValue/content.d.ts +45 -0
  298. package/dist/src/storageValue/content.d.ts.map +1 -0
  299. package/dist/src/storageValue/findFile.d.ts +7 -0
  300. package/dist/src/storageValue/findFile.d.ts.map +1 -0
  301. package/dist/src/storageValue/resolve.d.ts +71 -0
  302. package/dist/src/storageValue/resolve.d.ts.map +1 -0
  303. package/dist/src/storageValue/save.d.ts +24 -0
  304. package/dist/src/storageValue/save.d.ts.map +1 -0
  305. package/dist/src/storageValue/stage.d.ts +22 -0
  306. package/dist/src/storageValue/stage.d.ts.map +1 -0
  307. package/dist/src/types/db.d.ts +0 -14
  308. package/dist/src/types/db.d.ts.map +1 -1
  309. package/dist/src/types/index.d.ts +3 -3
  310. package/dist/src/types/index.d.ts.map +1 -1
  311. package/dist/src/types/machines.d.ts +1 -1
  312. package/dist/src/types/machines.d.ts.map +1 -1
  313. package/dist/src/types/property.d.ts +9 -24
  314. package/dist/src/types/property.d.ts.map +1 -1
  315. package/dist/src/types/publish.d.ts +1 -1
  316. package/dist/src/types/publish.d.ts.map +1 -1
  317. package/dist/{syncDbWithEas-BMHoou6X.js → syncDbWithEas-CA7PvBgu.js} +112 -162
  318. package/dist/syncDbWithEas-CA7PvBgu.js.map +1 -0
  319. package/dist/tabEvents-CaVmngqr.js +3804 -0
  320. package/dist/tabEvents-CaVmngqr.js.map +1 -0
  321. package/dist/{tolerantWebAccess-BHndShch.js → tolerantWebAccess-BJqViq08.js} +10 -15
  322. package/dist/{tolerantWebAccess-BHndShch.js.map → tolerantWebAccess-BJqViq08.js.map} +1 -1
  323. package/dist/{resolveModelForSyncedSeed-fIURvYRV.js → updateSeedRevokedAt-BL9Bg-G7.js} +30 -4
  324. package/dist/updateSeedRevokedAt-BL9Bg-G7.js.map +1 -0
  325. package/package.json +6 -6
  326. package/dist/ClientManager-DqL0q_eu.js +0 -5292
  327. package/dist/ClientManager-DqL0q_eu.js.map +0 -1
  328. package/dist/Item-CG5IhPtL.js.map +0 -1
  329. package/dist/ModelProperty-DDD47KVm.js.map +0 -1
  330. package/dist/Schema-BS8oR7QV.js +0 -4370
  331. package/dist/Schema-BS8oR7QV.js.map +0 -1
  332. package/dist/backfillMetadataPropertyIds-C7P7FL6F.js +0 -72
  333. package/dist/backfillMetadataPropertyIds-C7P7FL6F.js.map +0 -1
  334. package/dist/changeFeed-M8sGbOrW.js +0 -726
  335. package/dist/changeFeed-M8sGbOrW.js.map +0 -1
  336. package/dist/configurePlatform-Dukm2QwO.js.map +0 -1
  337. package/dist/dist/ClientManager-DqL0q_eu.d.ts +0 -952
  338. package/dist/dist/ClientManager-DqL0q_eu.d.ts.map +0 -1
  339. package/dist/dist/Item-CG5IhPtL.d.ts +0 -1115
  340. package/dist/dist/Item-CG5IhPtL.d.ts.map +0 -1
  341. package/dist/dist/ModelProperty-DDD47KVm.d.ts +0 -315
  342. package/dist/dist/ModelProperty-DDD47KVm.d.ts.map +0 -1
  343. package/dist/dist/Schema-BS8oR7QV.d.ts +0 -432
  344. package/dist/dist/Schema-BS8oR7QV.d.ts.map +0 -1
  345. package/dist/dist/SchemaValidationService-CZzKNL04.d.ts +0 -118
  346. package/dist/dist/SchemaValidationService-CZzKNL04.d.ts.map +0 -1
  347. package/dist/dist/backfillMetadataPropertyIds-C7P7FL6F.d.ts +0 -7
  348. package/dist/dist/backfillMetadataPropertyIds-C7P7FL6F.d.ts.map +0 -1
  349. package/dist/dist/changeFeed-M8sGbOrW.d.ts +0 -160
  350. package/dist/dist/changeFeed-M8sGbOrW.d.ts.map +0 -1
  351. package/dist/dist/configurePlatform-Dukm2QwO.d.ts.map +0 -1
  352. package/dist/dist/detachRowsBeforeDelete-Di1enVUF.d.ts +0 -13
  353. package/dist/dist/detachRowsBeforeDelete-Di1enVUF.d.ts.map +0 -1
  354. package/dist/dist/eas-B5VJolSj.d.ts +0 -12
  355. package/dist/dist/eas-B5VJolSj.d.ts.map +0 -1
  356. package/dist/dist/errors-C1qUEZ7A.d.ts +0 -25
  357. package/dist/dist/errors-C1qUEZ7A.d.ts.map +0 -1
  358. package/dist/dist/errors-CS3nDpUU.d.ts +0 -515
  359. package/dist/dist/errors-CS3nDpUU.d.ts.map +0 -1
  360. package/dist/dist/eventBus-7vxTCc3a.d.ts +0 -18
  361. package/dist/dist/eventBus-7vxTCc3a.d.ts.map +0 -1
  362. package/dist/dist/findSeedRowsByUid-CuQmK7An.d.ts +0 -13
  363. package/dist/dist/findSeedRowsByUid-CuQmK7An.d.ts.map +0 -1
  364. package/dist/dist/getItem-Uha3_H0t.d.ts +0 -6
  365. package/dist/dist/getItem-Uha3_H0t.d.ts.map +0 -1
  366. package/dist/dist/getPublishPayload-pbin4lk8.d.ts +0 -65
  367. package/dist/dist/getPublishPayload-pbin4lk8.d.ts.map +0 -1
  368. package/dist/dist/getPublishPendingDiff-ByIaPvCn.d.ts +0 -18
  369. package/dist/dist/getPublishPendingDiff-ByIaPvCn.d.ts.map +0 -1
  370. package/dist/dist/getPublishUploads-BBqiowVc.d.ts +0 -89
  371. package/dist/dist/getPublishUploads-BBqiowVc.d.ts.map +0 -1
  372. package/dist/dist/index-DQoyhp2c.d.ts +0 -6
  373. package/dist/dist/index-DQoyhp2c.d.ts.map +0 -1
  374. package/dist/dist/index-njjjo74v.d.ts +0 -14
  375. package/dist/dist/index-njjjo74v.d.ts.map +0 -1
  376. package/dist/dist/index-rOTW-2QZ.d.ts.map +0 -1
  377. package/dist/dist/index.browser-QPWBkLJA.d.ts +0 -9959
  378. package/dist/dist/index.browser-QPWBkLJA.d.ts.map +0 -1
  379. package/dist/dist/mimeTypes-C9r76DCH.d.ts +0 -30
  380. package/dist/dist/mimeTypes-C9r76DCH.d.ts.map +0 -1
  381. package/dist/dist/model-oHA3YhOd.d.ts +0 -6
  382. package/dist/dist/model-oHA3YhOd.d.ts.map +0 -1
  383. package/dist/dist/modelPropertyRecordSchemas-onFOG2x6.d.ts +0 -7
  384. package/dist/dist/modelPropertyRecordSchemas-onFOG2x6.d.ts.map +0 -1
  385. package/dist/dist/platform.browser.d.ts +0 -3
  386. package/dist/dist/platform.browser.d.ts.map +0 -1
  387. package/dist/dist/property-C85DCD7K.d.ts +0 -37
  388. package/dist/dist/property-C85DCD7K.d.ts.map +0 -1
  389. package/dist/dist/propertyValidationRules-CjUPOFeu.d.ts +0 -13
  390. package/dist/dist/propertyValidationRules-CjUPOFeu.d.ts.map +0 -1
  391. package/dist/dist/publishDraftGraph-DBWAN72w.d.ts +0 -93
  392. package/dist/dist/publishDraftGraph-DBWAN72w.d.ts.map +0 -1
  393. package/dist/dist/resolveModelForSyncedSeed-fIURvYRV.d.ts +0 -21
  394. package/dist/dist/resolveModelForSyncedSeed-fIURvYRV.d.ts.map +0 -1
  395. package/dist/dist/syncDbWithEas-BMHoou6X.d.ts +0 -13
  396. package/dist/dist/syncDbWithEas-BMHoou6X.d.ts.map +0 -1
  397. package/dist/dist/tolerantWebAccess-BHndShch.d.ts +0 -113
  398. package/dist/dist/tolerantWebAccess-BHndShch.d.ts.map +0 -1
  399. package/dist/dist/updateSeedRevokedAt-DpfG6ztE.d.ts +0 -11
  400. package/dist/dist/updateSeedRevokedAt-DpfG6ztE.d.ts.map +0 -1
  401. package/dist/eas-B5VJolSj.js +0 -67
  402. package/dist/eas-B5VJolSj.js.map +0 -1
  403. package/dist/errors-CS3nDpUU.js +0 -4006
  404. package/dist/errors-CS3nDpUU.js.map +0 -1
  405. package/dist/eventBus-7vxTCc3a.js +0 -64
  406. package/dist/eventBus-7vxTCc3a.js.map +0 -1
  407. package/dist/findSeedRowsByUid-CuQmK7An.js +0 -47
  408. package/dist/findSeedRowsByUid-CuQmK7An.js.map +0 -1
  409. package/dist/getItem-Uha3_H0t.js +0 -45
  410. package/dist/getItem-Uha3_H0t.js.map +0 -1
  411. package/dist/getPublishPayload-pbin4lk8.js +0 -1736
  412. package/dist/getPublishPayload-pbin4lk8.js.map +0 -1
  413. package/dist/getPublishPendingDiff-ByIaPvCn.js +0 -118
  414. package/dist/getPublishPendingDiff-ByIaPvCn.js.map +0 -1
  415. package/dist/getPublishUploads-BBqiowVc.js +0 -1080
  416. package/dist/getPublishUploads-BBqiowVc.js.map +0 -1
  417. package/dist/index-DQoyhp2c.js.map +0 -1
  418. package/dist/index-DxHpPNfn.js.map +0 -1
  419. package/dist/index-njjjo74v.js +0 -29
  420. package/dist/index-njjjo74v.js.map +0 -1
  421. package/dist/index-rOTW-2QZ.js +0 -4760
  422. package/dist/index-rOTW-2QZ.js.map +0 -1
  423. package/dist/index.browser-QPWBkLJA.js.map +0 -1
  424. package/dist/index.node-WsEJCOwC.js.map +0 -1
  425. package/dist/mimeTypes-C9r76DCH.js +0 -209
  426. package/dist/mimeTypes-C9r76DCH.js.map +0 -1
  427. package/dist/model-oHA3YhOd.js +0 -29
  428. package/dist/model-oHA3YhOd.js.map +0 -1
  429. package/dist/modelPropertyRecordSchemas-onFOG2x6.js +0 -94
  430. package/dist/modelPropertyRecordSchemas-onFOG2x6.js.map +0 -1
  431. package/dist/property-C85DCD7K.js +0 -289
  432. package/dist/property-C85DCD7K.js.map +0 -1
  433. package/dist/propertyValidationRules-CjUPOFeu.js +0 -73
  434. package/dist/propertyValidationRules-CjUPOFeu.js.map +0 -1
  435. package/dist/publishDraftGraph-DBWAN72w.js +0 -505
  436. package/dist/publishDraftGraph-DBWAN72w.js.map +0 -1
  437. package/dist/resolveModelForSyncedSeed-fIURvYRV.js.map +0 -1
  438. package/dist/src/Item/service/actors/loadOrCreateItem.d.ts +0 -5
  439. package/dist/src/Item/service/actors/loadOrCreateItem.d.ts.map +0 -1
  440. package/dist/src/Item/service/actors/waitForDb.d.ts +0 -4
  441. package/dist/src/Item/service/actors/waitForDb.d.ts.map +0 -1
  442. package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts +0 -5
  443. package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +0 -1
  444. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts +0 -5
  445. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +0 -1
  446. package/dist/src/ItemProperty/service/actors/saveValueToDb/index.d.ts +0 -6
  447. package/dist/src/ItemProperty/service/actors/saveValueToDb/index.d.ts.map +0 -1
  448. package/dist/src/ItemProperty/service/actors/saveValueToDb/rowContext.d.ts.map +0 -1
  449. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.d.ts +0 -24
  450. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.d.ts.map +0 -1
  451. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveHtml.d.ts +0 -5
  452. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveHtml.d.ts.map +0 -1
  453. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts +0 -5
  454. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +0 -1
  455. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts +0 -10
  456. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +0 -1
  457. package/dist/src/ItemProperty/service/actors/saveValueToDb/storageValue.d.ts +0 -22
  458. package/dist/src/ItemProperty/service/actors/saveValueToDb/storageValue.d.ts.map +0 -1
  459. package/dist/src/ItemProperty/service/actors/waitForDb.d.ts +0 -4
  460. package/dist/src/ItemProperty/service/actors/waitForDb.d.ts.map +0 -1
  461. package/dist/src/Model/service/actors/createModelProperties.d.ts +0 -9
  462. package/dist/src/Model/service/actors/createModelProperties.d.ts.map +0 -1
  463. package/dist/src/Model/service/actors/loadOrCreateModel.d.ts +0 -5
  464. package/dist/src/Model/service/actors/loadOrCreateModel.d.ts.map +0 -1
  465. package/dist/src/Schema/service/actors/checkExistingSchema.d.ts +0 -5
  466. package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +0 -1
  467. package/dist/src/Schema/service/actors/createModelInstances.d.ts +0 -11
  468. package/dist/src/Schema/service/actors/createModelInstances.d.ts.map +0 -1
  469. package/dist/src/Schema/service/actors/createPropertyInstances.d.ts +0 -12
  470. package/dist/src/Schema/service/actors/createPropertyInstances.d.ts.map +0 -1
  471. package/dist/src/Schema/service/actors/validateSchema.d.ts +0 -5
  472. package/dist/src/Schema/service/actors/validateSchema.d.ts.map +0 -1
  473. package/dist/src/Schema/service/actors/verifyModelInstancesInCache.d.ts +0 -6
  474. package/dist/src/Schema/service/actors/verifyModelInstancesInCache.d.ts.map +0 -1
  475. package/dist/src/Schema/service/actors/verifyModelsInDb.d.ts +0 -7
  476. package/dist/src/Schema/service/actors/verifyModelsInDb.d.ts.map +0 -1
  477. package/dist/src/Schema/service/actors/verifyPropertiesInDb.d.ts +0 -8
  478. package/dist/src/Schema/service/actors/verifyPropertiesInDb.d.ts.map +0 -1
  479. package/dist/src/Schema/service/actors/verifyPropertyInstancesInCache.d.ts +0 -6
  480. package/dist/src/Schema/service/actors/verifyPropertyInstancesInCache.d.ts.map +0 -1
  481. package/dist/src/Schema/service/actors/verifySchemaInDb.d.ts +0 -7
  482. package/dist/src/Schema/service/actors/verifySchemaInDb.d.ts.map +0 -1
  483. package/dist/src/Schema/service/actors/writeModelsToDb.d.ts +0 -9
  484. package/dist/src/Schema/service/actors/writeModelsToDb.d.ts.map +0 -1
  485. package/dist/src/Schema/service/actors/writePropertiesToDb.d.ts +0 -10
  486. package/dist/src/Schema/service/actors/writePropertiesToDb.d.ts.map +0 -1
  487. package/dist/src/Schema/service/actors/writeSchemaToDb.d.ts +0 -11
  488. package/dist/src/Schema/service/actors/writeSchemaToDb.d.ts.map +0 -1
  489. package/dist/src/browser/helpers/ArweaveClient.d.ts +0 -14
  490. package/dist/src/browser/helpers/ArweaveClient.d.ts.map +0 -1
  491. package/dist/src/browser/helpers/EasClient.d.ts +0 -10
  492. package/dist/src/browser/helpers/EasClient.d.ts.map +0 -1
  493. package/dist/src/browser/helpers/QueryClient.d.ts +0 -9
  494. package/dist/src/browser/helpers/QueryClient.d.ts.map +0 -1
  495. package/dist/src/client/actors/addModelsToStore.d.ts +0 -4
  496. package/dist/src/client/actors/addModelsToStore.d.ts.map +0 -1
  497. package/dist/src/db/backfillMetadataPropertyIds.d.ts +0 -7
  498. package/dist/src/db/backfillMetadataPropertyIds.d.ts.map +0 -1
  499. package/dist/src/db/read/getItem.d.ts +0 -3
  500. package/dist/src/db/read/getItem.d.ts.map +0 -1
  501. package/dist/src/db/read/getPropertyData.d.ts +0 -4
  502. package/dist/src/db/read/getPropertyData.d.ts.map +0 -1
  503. package/dist/src/db/read/getRelatedItemsForPublish.d.ts +0 -10
  504. package/dist/src/db/read/getRelatedItemsForPublish.d.ts.map +0 -1
  505. package/dist/src/db/read/getSeedData.d.ts +0 -12
  506. package/dist/src/db/read/getSeedData.d.ts.map +0 -1
  507. package/dist/src/db/read/itemLoads.d.ts +0 -20
  508. package/dist/src/db/read/itemLoads.d.ts.map +0 -1
  509. package/dist/src/db/read/publishDraftGraph.d.ts +0 -64
  510. package/dist/src/db/read/publishDraftGraph.d.ts.map +0 -1
  511. package/dist/src/db/write/linkModelToSchema.d.ts +0 -12
  512. package/dist/src/db/write/linkModelToSchema.d.ts.map +0 -1
  513. package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts +0 -2
  514. package/dist/src/helpers/ArweaveClient/BaseArweaveClient.d.ts.map +0 -1
  515. package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts +0 -2
  516. package/dist/src/helpers/ArweaveClient/arweaveL1UploadApi.d.ts.map +0 -1
  517. package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts +0 -2
  518. package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts.map +0 -1
  519. package/dist/src/helpers/ArweaveClient/uploadApiVerification.d.ts +0 -2
  520. package/dist/src/helpers/ArweaveClient/uploadApiVerification.d.ts.map +0 -1
  521. package/dist/src/helpers/EasClient/BaseEasClient.d.ts +0 -2
  522. package/dist/src/helpers/EasClient/BaseEasClient.d.ts.map +0 -1
  523. package/dist/src/helpers/QueryClient/BaseQueryClient.d.ts +0 -2
  524. package/dist/src/helpers/QueryClient/BaseQueryClient.d.ts.map +0 -1
  525. package/dist/src/helpers/easUid.d.ts +0 -2
  526. package/dist/src/helpers/easUid.d.ts.map +0 -1
  527. package/dist/src/helpers/entity/entityDestroy.d.ts +0 -49
  528. package/dist/src/helpers/entity/entityDestroy.d.ts.map +0 -1
  529. package/dist/src/helpers/entity/entityFind.d.ts +0 -52
  530. package/dist/src/helpers/entity/entityFind.d.ts.map +0 -1
  531. package/dist/src/helpers/entity/entityState.d.ts +0 -28
  532. package/dist/src/helpers/entity/entityState.d.ts.map +0 -1
  533. package/dist/src/helpers/entity/entityUnload.d.ts +0 -56
  534. package/dist/src/helpers/entity/entityUnload.d.ts.map +0 -1
  535. package/dist/src/helpers/entity/evictionEpoch.d.ts +0 -43
  536. package/dist/src/helpers/entity/evictionEpoch.d.ts.map +0 -1
  537. package/dist/src/helpers/entity/index.d.ts +0 -12
  538. package/dist/src/helpers/entity/index.d.ts.map +0 -1
  539. package/dist/src/helpers/gateway/gatewayState.d.ts +0 -2
  540. package/dist/src/helpers/gateway/gatewayState.d.ts.map +0 -1
  541. package/dist/src/helpers/gateway/resolveSeedGatewayEndpoints.d.ts +0 -2
  542. package/dist/src/helpers/gateway/resolveSeedGatewayEndpoints.d.ts.map +0 -1
  543. package/dist/src/helpers/gateway/seedGatewayConfig.d.ts +0 -2
  544. package/dist/src/helpers/gateway/seedGatewayConfig.d.ts.map +0 -1
  545. package/dist/src/helpers/getSchemaForItemProperty.d.ts +0 -15
  546. package/dist/src/helpers/getSchemaForItemProperty.d.ts.map +0 -1
  547. package/dist/src/helpers/getSegmentedItemProperties.d.ts +0 -10
  548. package/dist/src/helpers/getSegmentedItemProperties.d.ts.map +0 -1
  549. package/dist/src/helpers/isSqliteUniqueConstraintError.d.ts +0 -7
  550. package/dist/src/helpers/isSqliteUniqueConstraintError.d.ts.map +0 -1
  551. package/dist/src/helpers/propertyValidationRules.d.ts +0 -20
  552. package/dist/src/helpers/propertyValidationRules.d.ts.map +0 -1
  553. package/dist/src/helpers/propertyWriteTickets.d.ts +0 -11
  554. package/dist/src/helpers/propertyWriteTickets.d.ts.map +0 -1
  555. package/dist/src/helpers/reconcilePropertyDraftRows.d.ts +0 -10
  556. package/dist/src/helpers/reconcilePropertyDraftRows.d.ts.map +0 -1
  557. package/dist/src/helpers/waitForEntityIdle.d.ts +0 -21
  558. package/dist/src/helpers/waitForEntityIdle.d.ts.map +0 -1
  559. package/dist/src/interfaces/IQueryClient.d.ts +0 -15
  560. package/dist/src/interfaces/IQueryClient.d.ts.map +0 -1
  561. package/dist/src/node/helpers/ArweaveClient.d.ts +0 -5
  562. package/dist/src/node/helpers/ArweaveClient.d.ts.map +0 -1
  563. package/dist/src/node/helpers/EasClient.d.ts +0 -5
  564. package/dist/src/node/helpers/EasClient.d.ts.map +0 -1
  565. package/dist/src/node/helpers/QueryClient.d.ts +0 -5
  566. package/dist/src/node/helpers/QueryClient.d.ts.map +0 -1
  567. package/dist/src/services/write/actors/validateEntity.d.ts +0 -6
  568. package/dist/src/services/write/actors/validateEntity.d.ts.map +0 -1
  569. package/dist/src/services/write/actors/writeToDatabase.d.ts +0 -14
  570. package/dist/src/services/write/actors/writeToDatabase.d.ts.map +0 -1
  571. package/dist/src/services/write/writeProcessMachine.d.ts +0 -56
  572. package/dist/src/services/write/writeProcessMachine.d.ts.map +0 -1
  573. package/dist/src/stores/eas.d.ts +0 -2
  574. package/dist/src/stores/eas.d.ts.map +0 -1
  575. package/dist/src/types/arweave.d.ts +0 -57
  576. package/dist/src/types/arweave.d.ts.map +0 -1
  577. package/dist/src/types/gateway.d.ts +0 -2
  578. package/dist/src/types/gateway.d.ts.map +0 -1
  579. package/dist/syncDbWithEas-BMHoou6X.js.map +0 -1
  580. package/dist/updateSeedRevokedAt-DpfG6ztE.js +0 -31
  581. package/dist/updateSeedRevokedAt-DpfG6ztE.js.map +0 -1
@@ -0,0 +1,760 @@
1
+ import { isValidEasAttestationUid, VERSION_SCHEMA_UID, decodeEasNumber, getSchemaUidForSchemaDefinitionFromCache, easName, getEasSchemaUidForSchemaDefinition } from '@seedprotocol/eas';
2
+ import { $ as isNode, Z as ZERO_BYTES32, a0 as INTERNAL_PROPERTY_NAMES, M as ModelPropertyDataTypes, n as normalizeDataType, a1 as defaultAttestationData, v as INTERNAL_DATA_TYPES } from './tabEvents-CaVmngqr.js';
3
+ import { ae as matchMetadataProperty, af as metadataRowsOfProperty, ag as METADATA_LATEST_FIRST_ORDER_SQL, K as isPublishedMetadataRow, ah as getEasSchemaUidForModel, ai as isStorageSeedRef, a8 as listRelationEasPropertyName, a9 as easPropertyNameForPublish, aa as metadataStorageName } from './Item-Bf4kWKpH.js';
4
+ import { or, eq, and, sql } from 'drizzle-orm';
5
+ import { B as BaseDb, m as metadata } from './BaseFileManager-BAlySv8w.js';
6
+ import './errors-DLSoqSHG.js';
7
+ import 'pluralize';
8
+ import { g as getPublishGraph, h as htmlPropertyForHtmlSeed } from './publishGraph-EcB40Uii.js';
9
+
10
+ const isEmptyValue = (value) => value == null || value === '';
11
+ /**
12
+ * What publishing a property with an empty value does (ADR 0021). Undefined when there is nothing
13
+ * to publish: the newest row holds a value, or the property has no live attestation (never
14
+ * published, or already retracted). The property's rows are those linked by property_id, and rows
15
+ * with none stored under one of its names.
16
+ */
17
+ async function getPropertyClear(params) {
18
+ const { seedLocalId, seedUid, propertyName, propertyId, modelName, dataType, refValueType } = params;
19
+ if (!seedLocalId && !seedUid)
20
+ return undefined;
21
+ const appDb = BaseDb.getAppDb();
22
+ if (!appDb)
23
+ return undefined;
24
+ // The property's rows by property_id (decision D4), rows with none by name
25
+ const property = await matchMetadataProperty({ propertyId, propertyName, modelName, seedLocalId, seedUid, dataType, refValueType }, appDb);
26
+ const seedWhere = seedLocalId && seedUid
27
+ ? or(eq(metadata.seedLocalId, seedLocalId), eq(metadata.seedUid, seedUid))
28
+ : seedLocalId
29
+ ? eq(metadata.seedLocalId, seedLocalId)
30
+ : eq(metadata.seedUid, seedUid);
31
+ const rows = (await appDb
32
+ .select()
33
+ .from(metadata)
34
+ .where(and(metadataRowsOfProperty(property), seedWhere))
35
+ .orderBy(sql.raw(METADATA_LATEST_FIRST_ORDER_SQL)));
36
+ const newest = rows[0];
37
+ if (!newest || !isEmptyValue(newest.propertyValue))
38
+ return undefined;
39
+ const live = rows.filter((row) => isValidEasAttestationUid(row.uid) && row.revokedAt == null);
40
+ if (live.length === 0)
41
+ return undefined;
42
+ // `live` is newest first
43
+ const onVersion = live.filter((row) => row.versionUid === live[0].versionUid);
44
+ const values = new Set(onVersion.map((row) => row.propertyValue));
45
+ const retractScope = live.filter((row) => onVersion.includes(row) || values.has(row.propertyValue));
46
+ return { retract: !!newest.retract && !isPublishedMetadataRow(newest), live, retractScope };
47
+ }
48
+ /** The empty value of an EAS type, or undefined for `bool` and `uint256`, which have none (ADR 0021). */
49
+ function emptyEasValue(easDataType) {
50
+ if (easDataType === 'string')
51
+ return '';
52
+ if (easDataType === 'bytes32')
53
+ return `0x${'0'.repeat(64)}`;
54
+ if (easDataType === 'bytes32[]')
55
+ return [];
56
+ return undefined;
57
+ }
58
+ /**
59
+ * The seed's retracted properties that still have attestations to revoke (ADR 0021), with the
60
+ * attestations publish revokes for each.
61
+ */
62
+ async function getPendingRetractions(params) {
63
+ const { seedLocalId, seedUid } = params;
64
+ if (!seedLocalId && !seedUid)
65
+ return [];
66
+ const { getPublishPendingDiff } = await import('./getPublishPendingDiff-D6_-A5ns.js');
67
+ const { pendingProperties } = await getPublishPendingDiff({
68
+ seedLocalId: seedLocalId ?? undefined,
69
+ seedUid: seedUid ?? undefined,
70
+ });
71
+ const retractions = [];
72
+ for (const { propertyName, change } of pendingProperties) {
73
+ if (change !== 'retracted')
74
+ continue;
75
+ const clear = await getPropertyClear({ seedLocalId, seedUid, propertyName });
76
+ if (!clear?.retract)
77
+ continue;
78
+ const attestations = clear.retractScope
79
+ .filter((row) => row.uid && row.schemaUid)
80
+ .map((row) => ({ uid: row.uid, schemaUid: row.schemaUid }));
81
+ if (attestations.length > 0)
82
+ retractions.push({ propertyName, attestations });
83
+ }
84
+ return retractions;
85
+ }
86
+
87
+ let easSdkPromise;
88
+ /**
89
+ * Load eas-sdk on first use instead of at SDK import time.
90
+ *
91
+ * On Node this loads eas-sdk's CommonJS build. Its ESM build (2.9.1+) does
92
+ * `import { isEqual } from 'lodash'`, which Node rejects because lodash is
93
+ * CommonJS, so a static import made `import '@seedprotocol/sdk'` fail unless the
94
+ * app ran with `--import @seedprotocol/sdk/node-eas-lodash`.
95
+ *
96
+ * `process.getBuiltinModule` (Node 20.16+, 22.3+) keeps `node:module` out of the
97
+ * import graph, so browser bundlers never see it. Bundlers resolve the
98
+ * `import()` branch, and handle lodash there themselves.
99
+ */
100
+ function loadEasSdk() {
101
+ if (!easSdkPromise) {
102
+ easSdkPromise = (async () => {
103
+ if (isNode() && typeof document === 'undefined' && typeof process.getBuiltinModule === 'function') {
104
+ try {
105
+ const { createRequire } = process.getBuiltinModule('node:module');
106
+ return createRequire(import.meta.url)('@ethereum-attestation-service/eas-sdk');
107
+ }
108
+ catch {
109
+ // e.g. import.meta.url is not a file: URL (bundled renderer). Fall through.
110
+ }
111
+ }
112
+ return import('@ethereum-attestation-service/eas-sdk');
113
+ })();
114
+ easSdkPromise.catch(() => {
115
+ easSdkPromise = undefined;
116
+ });
117
+ }
118
+ return easSdkPromise;
119
+ }
120
+
121
+ /** UTF-8 string to 0x-prefixed bytes32 hex (right-padded with zeros). */
122
+ function encodeBytes32String(value) {
123
+ const bytes = new TextEncoder().encode(value);
124
+ if (bytes.length > 32) {
125
+ throw new Error(`encodeBytes32String: value exceeds 32 bytes (${bytes.length})`);
126
+ }
127
+ const hex = Array.from(bytes)
128
+ .map((b) => b.toString(16).padStart(2, '0'))
129
+ .join('');
130
+ return `0x${hex.padEnd(64, '0')}`;
131
+ }
132
+
133
+ /** Error thrown when publish validation fails. Includes all validation errors for user to fix. */
134
+ class PublishValidationFailedError extends Error {
135
+ constructor(message, validationErrors) {
136
+ super(message);
137
+ this.validationErrors = validationErrors;
138
+ this.name = 'PublishValidationFailedError';
139
+ }
140
+ }
141
+ /** Validation error code for a relation, list member or image/file ref to an unpublished seed. */
142
+ const RELATED_ITEM_UNPUBLISHED_CODE = 'related_item_unpublished';
143
+ const describeUnpublishedRelatedItem = (r) => `${r.propertyName} -> ${r.modelName} ${r.seedLocalId} (seed ${r.seedUid})`;
144
+ /**
145
+ * Thrown before anything is uploaded or attested when the item references items whose seed was
146
+ * unpublished: the parent would attest a revoked seed uid. Republish those items (which gives
147
+ * them a new seed uid) or remove the references, then publish again.
148
+ * See docs/ATTESTATION_REVOCATION.md ("Republishing").
149
+ *
150
+ * A PublishValidationFailedError, so validateItemForPublish and the publish package's checking
151
+ * step report it as validation errors (code `related_item_unpublished`, one per reference).
152
+ */
153
+ class RelatedItemUnpublishedError extends PublishValidationFailedError {
154
+ constructor(unpublishedRelatedItems, otherValidationErrors = []) {
155
+ const lines = unpublishedRelatedItems.map(describeUnpublishedRelatedItem);
156
+ const message = `Cannot publish: it references ${lines.length} unpublished item${lines.length === 1 ? '' : 's'} ` +
157
+ `(their seed attestations were revoked). Republish them or remove the references, then publish again:\n` +
158
+ lines.join('\n');
159
+ super(message, [
160
+ ...unpublishedRelatedItems.map((r) => ({
161
+ field: r.propertyName,
162
+ message: `${r.propertyName} references unpublished ${r.modelName} ${r.seedLocalId} (seed ${r.seedUid}). ` +
163
+ `Republish it or remove the reference.`,
164
+ code: RELATED_ITEM_UNPUBLISHED_CODE,
165
+ })),
166
+ ...otherValidationErrors,
167
+ ]);
168
+ this.name = 'RelatedItemUnpublishedError';
169
+ this.unpublishedRelatedItems = unpublishedRelatedItems;
170
+ }
171
+ }
172
+
173
+ const matchesDataType = (actual, expected) => normalizeDataType(actual) === expected;
174
+ /**
175
+ * An EAS uid (0x + 64 hex), as opposed to a local id. A "0x" prefix alone doesn't tell them apart:
176
+ * local ids are random alphanumerics, and about 1 in 3,844 starts with "0x".
177
+ */
178
+ function isUidRef(ref) {
179
+ return ref.length === 66 && ref.startsWith('0x');
180
+ }
181
+ function addValidationError(ctx, message, field, code = 'publish_validation') {
182
+ if (ctx.errors.some((e) => e.message === message && e.field === (field ?? '')))
183
+ return;
184
+ ctx.errors.push({ field: field ?? '', message, code });
185
+ }
186
+ /** Current uid for a ref to a live published seed, else the ref itself. */
187
+ const currentRelatedRef = (ctx, ref) => ctx.graph.relatedRefUids.get(ref.trim()) ?? ref;
188
+ const uploadedTxFor = (ctx, seedLocalId) => ctx.uploadedTransactions.find((u) => u.seedLocalId?.trim() === seedLocalId);
189
+ /** The EAS schema a property attests under. Reports an error and returns null when there is none. */
190
+ const getPropertyData = async (property, ctx) => {
191
+ const { key, definition } = property;
192
+ const rawDataType = definition.dataType;
193
+ const dataType = rawDataType ? normalizeDataType(String(rawDataType)) : undefined;
194
+ const easDataType = dataType ? INTERNAL_DATA_TYPES[dataType]?.eas : undefined;
195
+ if (!easDataType) {
196
+ addValidationError(ctx, `Unknown or unsupported property data type "${rawDataType ?? 'undefined'}" for property: ${key}. Supported types: ${Object.keys(INTERNAL_DATA_TYPES).join(', ')}.`, key);
197
+ return null;
198
+ }
199
+ // ADR 0008: list relations publish under their storage name (authors → author_identity_ids),
200
+ // single relations under their schema key (author), never the local authorId.
201
+ const listRelationName = listRelationEasPropertyName(key, definition);
202
+ const propertyNameForSchema = easPropertyNameForPublish(key, definition);
203
+ const schemaDef = `${easDataType} ${propertyNameForSchema}`;
204
+ // The UID ensureEasSchemasForItem resolved for this exact definition comes first. A row's
205
+ // schemaUid was looked up under the property's own name, which matches any type: Optimism
206
+ // Sepolia has `bytes32 storage_transaction_id` beside `string storage_transaction_id`, and
207
+ // attesting a string under the bytes32 one reads back as 0x…20. Trust the row's only when
208
+ // that name is the one published (not for a list relation, or a single relation stored as authorId).
209
+ const storageName = metadataStorageName(key, definition);
210
+ let schemaUid = getSchemaUidForSchemaDefinitionFromCache(schemaDef) ??
211
+ (!listRelationName && easName(storageName) === propertyNameForSchema ? property.row?.schemaUid ?? undefined : undefined);
212
+ if (!schemaUid) {
213
+ schemaUid = await getEasSchemaUidForSchemaDefinition({ schemaText: schemaDef });
214
+ }
215
+ if (!schemaUid) {
216
+ addValidationError(ctx, `EAS schema not found for "${schemaDef}" (property: ${key}). Register it before publishing (ensureEasSchemasForItem).`, key, 'publish_schema_not_found');
217
+ return null;
218
+ }
219
+ return { schemaUid, easDataType, schemaDef, propertyNameForSchema };
220
+ };
221
+ /** The label a required-value error uses for a relation or storage-seed property. */
222
+ function refTypeLabel(definition) {
223
+ for (const [type, label] of [
224
+ [ModelPropertyDataTypes.File, 'file'],
225
+ [ModelPropertyDataTypes.Image, 'image'],
226
+ [ModelPropertyDataTypes.Html, 'html'],
227
+ [ModelPropertyDataTypes.Json, 'json'],
228
+ ]) {
229
+ if (matchesDataType(definition.dataType, type) || matchesDataType(definition.refValueType, type))
230
+ return label;
231
+ }
232
+ return 'relation';
233
+ }
234
+ /** Required relation and storage-seed properties need a value pointing at an item. */
235
+ function checkRequiredRef(node, property, ctx) {
236
+ const { key, definition } = property;
237
+ if (definition.required !== true)
238
+ return;
239
+ const value = property.row?.propertyValue;
240
+ const refLabel = definition.ref ?? definition.refModelName ?? 'related';
241
+ if (value == null || value.trim() === '') {
242
+ addValidationError(ctx, `Required ${refTypeLabel(definition)} ${key} has no value. A value pointing to a valid ${refLabel} item is required to publish.`, key);
243
+ return;
244
+ }
245
+ for (const broken of ctx.graph.brokenRefs) {
246
+ if (broken.seedLocalId !== node.seedLocalId || broken.propertyKey !== key || broken.list)
247
+ continue;
248
+ addValidationError(ctx, broken.reason === 'invalid'
249
+ ? `Required relation ${key} has invalid value: ${JSON.stringify(value)}. ` +
250
+ `Value must be a valid seed reference (localId or uid) pointing to a ${refLabel} item.`
251
+ : `No related item found for required relation: ${key}. Value: ${JSON.stringify(value)} (seedLocalId/seedUid). ` +
252
+ `The related item may be missing, in a different database, or the reference may be broken.`, key);
253
+ }
254
+ }
255
+ /** A Boolean row value as stored ("true"/"false", "1"/"0"). */
256
+ const booleanFromRow = (value) => value === 'true' || value === '1' ? true : value === 'false' || value === '0' ? false : value;
257
+ /**
258
+ * The attestation of one property of `node`, or undefined when the publish leaves it out (no
259
+ * value, already attested in patch mode, deferred, invalid: the last reports an error).
260
+ */
261
+ async function attestProperty(node, property, versionUid, ctx) {
262
+ const { key, definition, row } = property;
263
+ const forceFullSnapshot = ctx.graph.forceFullSnapshot;
264
+ if (INTERNAL_PROPERTY_NAMES.includes(key) || property.deferred)
265
+ return undefined;
266
+ const isFileImageHtml = matchesDataType(definition.dataType, ModelPropertyDataTypes.File) ||
267
+ matchesDataType(definition.dataType, ModelPropertyDataTypes.Image) ||
268
+ matchesDataType(definition.dataType, ModelPropertyDataTypes.Html);
269
+ const isRef = property.kind === 'relation' || property.kind === 'storageSeed';
270
+ const isStorageTransaction = property.kind === 'storageTransaction';
271
+ // The storage transaction slot attests this publish's upload of the node's file(s).
272
+ const uploaded = isStorageTransaction ? uploadedTxFor(ctx, node.seedLocalId) : undefined;
273
+ if (isStorageTransaction && !uploaded)
274
+ return undefined;
275
+ let value = uploaded ? uploaded.txId : row?.propertyValue;
276
+ // 0 and false are values (ADR 0010). An empty value publishes only as a removal of a value
277
+ // attested before (ADR 0021); a retraction attests nothing (publish revokes instead).
278
+ let isRemoval = false;
279
+ if (value == null || value === '') {
280
+ if (property.uid && !forceFullSnapshot)
281
+ return undefined;
282
+ const clear = await getPropertyClear({
283
+ seedLocalId: node.seedLocalId,
284
+ seedUid: node.seedUid,
285
+ propertyId: definition._dbId,
286
+ modelName: node.modelName,
287
+ propertyName: key,
288
+ dataType: definition.dataType,
289
+ refValueType: definition.refValueType,
290
+ });
291
+ if (!clear || clear.retract)
292
+ return undefined;
293
+ isRemoval = true;
294
+ }
295
+ // Patch mode skips properties that already have an EAS uid, except a storage transaction this
296
+ // publish uploaded.
297
+ if (!isRemoval && property.uid && !forceFullSnapshot && !uploaded)
298
+ return undefined;
299
+ // File/Image/Html values must be a storage seed id by now. Raw content means the property's
300
+ // save pipeline never ran or failed (e.g. createNewItem with raw html), so it was never uploaded.
301
+ if (!isRemoval && isFileImageHtml && typeof value === 'string' && !isStorageSeedRef(value.trim())) {
302
+ addValidationError(ctx, `Invalid value for property: ${key}. Expected a storage seed id ` +
303
+ `(${normalizeDataType(definition.dataType)} content must be saved through the property before publishing), ` +
304
+ `got ${value.length > 40 ? `${value.slice(0, 40)}…` : value}.`, key, 'publish_storage_value_not_saved');
305
+ return undefined;
306
+ }
307
+ const propertyData = await getPropertyData(property, ctx);
308
+ if (!propertyData)
309
+ return undefined;
310
+ const { schemaUid, easDataType, schemaDef, propertyNameForSchema } = propertyData;
311
+ const isList = schemaDef.startsWith('bytes32[]');
312
+ let rawListIdsForResolve;
313
+ if (isRemoval) {
314
+ const empty = emptyEasValue(easDataType);
315
+ if (empty === undefined) {
316
+ addValidationError(ctx, `${key} can't be published empty: ${definition.dataType ?? easDataType} properties have no empty value. Clear it with clear({ retract: true }).`, key, 'publish_clear_unsupported');
317
+ return undefined;
318
+ }
319
+ value = empty;
320
+ }
321
+ else {
322
+ if (typeof value === 'string' && isRef)
323
+ value = currentRelatedRef(ctx, value.trim());
324
+ if (isList && typeof value === 'string') {
325
+ const text = value.trim();
326
+ if (text.startsWith('[')) {
327
+ try {
328
+ value = JSON.parse(text);
329
+ }
330
+ catch {
331
+ // reported below
332
+ }
333
+ }
334
+ else if (text.includes(',')) {
335
+ // Legacy comma-separated ids (pre-JSON List storage)
336
+ value = text.split(',').map((s) => s.trim()).filter(Boolean);
337
+ }
338
+ }
339
+ if (isList && !Array.isArray(value)) {
340
+ addValidationError(ctx, `Invalid value for property: ${key}. Expected an array of bytes32, got ${value}.`, key);
341
+ return undefined;
342
+ }
343
+ if (easDataType === 'bool' && typeof value === 'string')
344
+ value = booleanFromRow(value.trim());
345
+ // Validate against property validation rules (enum, pattern, minLength, maxLength) before encoding
346
+ if (definition.validation) {
347
+ const { SchemaValidationService } = await import('./SchemaValidationService-CnmKyzR-.js');
348
+ const result = new SchemaValidationService().validatePropertyValue(value, normalizeDataType(definition.dataType), definition.validation, definition.refValueType ? normalizeDataType(definition.refValueType) : undefined);
349
+ if (!result.isValid && result.errors.length > 0) {
350
+ const firstError = result.errors[0];
351
+ addValidationError(ctx, firstError.message, key, firstError.code ?? 'publish_validation');
352
+ return undefined;
353
+ }
354
+ }
355
+ if (isList) {
356
+ const encoded = [];
357
+ const rawIds = [];
358
+ for (const member of value) {
359
+ const id = typeof member === 'string' ? member.trim() : '';
360
+ if (!id)
361
+ continue;
362
+ const ref = currentRelatedRef(ctx, id);
363
+ rawIds.push(ref);
364
+ encoded.push(isUidRef(ref) ? ref : encodeBytes32String(ref));
365
+ }
366
+ value = encoded;
367
+ if (rawIds.some((id) => !isUidRef(id)))
368
+ rawListIdsForResolve = rawIds;
369
+ }
370
+ // uint256 (Date) must be numeric/BigInt; normalize ISO strings to Unix seconds
371
+ if (easDataType === 'uint256' && (typeof value === 'string' || value instanceof Date)) {
372
+ const ms = value instanceof Date ? value.getTime() : /^\d+$/.test(value) ? Number(value) : new Date(value).getTime();
373
+ value = BigInt(Math.floor(ms / 1000));
374
+ }
375
+ // ADR 0010: Number attests as its decimal string, in the form readers decode it to.
376
+ if (matchesDataType(definition.dataType, ModelPropertyDataTypes.Number)) {
377
+ const decimal = decodeEasNumber(value);
378
+ if (decimal === undefined) {
379
+ addValidationError(ctx, `Invalid value for property: ${key}. Expected a finite number, got ${JSON.stringify(value)}.`, key, 'publish_invalid_number');
380
+ return undefined;
381
+ }
382
+ value = decimal;
383
+ }
384
+ }
385
+ let encodedData;
386
+ try {
387
+ const { SchemaEncoder } = await loadEasSdk();
388
+ encodedData = new SchemaEncoder(schemaDef).encodeData([
389
+ { name: propertyNameForSchema, type: easDataType, value: value },
390
+ ]);
391
+ }
392
+ catch (encodeErr) {
393
+ addValidationError(ctx, `Failed to encode property ${key}: ${encodeErr instanceof Error ? encodeErr.message : String(encodeErr)}`, key);
394
+ return undefined;
395
+ }
396
+ const attestation = {
397
+ schema: schemaUid,
398
+ data: [
399
+ {
400
+ ...defaultAttestationData,
401
+ // The storage transaction references the Version attestation (contract may use when supported)
402
+ refUID: isStorageTransaction ? versionUid : defaultAttestationData.refUID,
403
+ data: encodedData,
404
+ },
405
+ ],
406
+ _propertyName: key,
407
+ ...(row?.localId ? { _metadataLocalId: row.localId } : {}),
408
+ ...(uploaded && uploaded.txId !== row?.propertyValue ? { _attestedValue: uploaded.txId } : {}),
409
+ };
410
+ // Refs to seeds of this publish by local id: resolution hints for resolvePublishPayloadValues
411
+ if (typeof value === 'string' &&
412
+ !isUidRef(value) &&
413
+ /^[a-zA-Z0-9_-]{10,21}$/.test(value.trim()) &&
414
+ (easDataType === 'bytes32' || easDataType === 'string')) {
415
+ attestation._propertyNameForSchema = propertyNameForSchema;
416
+ attestation._schemaDef = schemaDef;
417
+ attestation._unresolvedValue = value.trim();
418
+ attestation._easDataType = easDataType;
419
+ }
420
+ if (rawListIdsForResolve?.length) {
421
+ attestation._propertyNameForSchema = propertyNameForSchema;
422
+ attestation._schemaDef = schemaDef;
423
+ attestation._easDataType = 'bytes32[]';
424
+ attestation._rawListIdsForResolve = rawListIdsForResolve;
425
+ }
426
+ return attestation;
427
+ }
428
+ /** The order a node's properties attest in: basic values, its upload, refs, lists. */
429
+ const ATTEST_ORDER = ['basic', 'storageTransaction', 'relation', 'storageSeed', 'list'];
430
+ /** One node's request: its seed, version and property attestations, and the parent properties its seed uid fills. */
431
+ async function buildRequest(node, ctx) {
432
+ const { graph } = ctx;
433
+ const isRoot = node.kind === 'root';
434
+ // A storage seed or an embedded image attests its own basic properties only.
435
+ const full = isRoot || node.kind === 'draft';
436
+ const reportField = node.links[0]?.propertyKey;
437
+ let seedSchemaUid = isRoot ? node.seedSchemaUid : undefined;
438
+ seedSchemaUid ?? (seedSchemaUid = (await getEasSchemaUidForModel(node.modelName)) ?? undefined);
439
+ if (!seedSchemaUid)
440
+ addValidationError(ctx, `Schema UID not found for model: ${node.modelName}`, isRoot ? undefined : reportField);
441
+ let versionUid = node.version.uid ?? (node.newSeed ? undefined : node.version.publishedUid) ?? ZERO_BYTES32;
442
+ if (isRoot && graph.forceFullSnapshot && node.seedUid)
443
+ versionUid = ZERO_BYTES32;
444
+ const versionLocalId = versionUid === ZERO_BYTES32 && !node.version.uid ? node.version.localId : undefined;
445
+ const request = {
446
+ localId: node.seedLocalId,
447
+ ...(versionLocalId ? { versionLocalId } : {}),
448
+ seedIsRevocable: true,
449
+ seedSchemaUid: seedSchemaUid ?? ZERO_BYTES32,
450
+ seedUid: node.newSeed || !node.seedUid ? ZERO_BYTES32 : node.seedUid,
451
+ versionSchemaUid: VERSION_SCHEMA_UID,
452
+ versionUid,
453
+ listOfAttestations: [],
454
+ propertiesToUpdate: [],
455
+ };
456
+ for (const kind of ATTEST_ORDER) {
457
+ for (const property of node.properties) {
458
+ if (property.kind !== kind)
459
+ continue;
460
+ if (!full && kind !== 'basic' && kind !== 'storageTransaction')
461
+ continue;
462
+ if (full && (kind === 'relation' || kind === 'storageSeed'))
463
+ checkRequiredRef(node, property, ctx);
464
+ const attestation = await attestProperty(node, property, versionUid, ctx);
465
+ if (attestation)
466
+ request.listOfAttestations.push(attestation);
467
+ }
468
+ }
469
+ // Each property this seed's uid fills: the contract writes the uid into that attestation.
470
+ for (const { seedLocalId, propertyKey } of node.links) {
471
+ const owner = graph.nodes.find((n) => n.seedLocalId === seedLocalId);
472
+ const property = owner?.properties.find((p) => p.key === propertyKey);
473
+ if (!property)
474
+ continue;
475
+ const propertySchemaUid = (await getPropertyData(property, ctx))?.schemaUid;
476
+ if (!propertySchemaUid)
477
+ continue;
478
+ if (!request.propertiesToUpdate.some((u) => u.publishLocalId === seedLocalId && u.propertySchemaUid.toLowerCase() === propertySchemaUid.toLowerCase())) {
479
+ request.propertiesToUpdate.push({ publishLocalId: seedLocalId, propertySchemaUid });
480
+ }
481
+ }
482
+ return request;
483
+ }
484
+ /**
485
+ * Embedded image rows must still name an Html value of their owner, with a schema to attest under.
486
+ * No propertiesToUpdate: the Html refers to the image by its Arweave URL (the data URI is
487
+ * rewritten to it before the Html is uploaded), not by seed uid.
488
+ */
489
+ async function checkEmbeddedImages(ctx) {
490
+ const { graph } = ctx;
491
+ for (const owner of graph.nodes) {
492
+ for (const row of owner.embeddedImages) {
493
+ const imageNode = graph.nodes.find((n) => n.seedLocalId === row.imageSeedLocalId && n.kind === 'embeddedImage');
494
+ const missing = graph.missingEmbeddedImages.some((m) => m.imageSeedLocalId === row.imageSeedLocalId);
495
+ if (!imageNode && !missing)
496
+ continue;
497
+ const html = htmlPropertyForHtmlSeed(owner, row.htmlSeedLocalId);
498
+ if (!html) {
499
+ addValidationError(ctx, `Could not find Html property for embedded image rewrite (html seed ${row.htmlSeedLocalId.trim()}).`, 'html', 'html_embed_schema');
500
+ continue;
501
+ }
502
+ if (!(await getPropertyData(html, ctx)))
503
+ continue;
504
+ if (missing) {
505
+ addValidationError(ctx, `Embedded Image item not found for seed ${row.imageSeedLocalId}.`, 'html', 'html_embed_image_missing');
506
+ }
507
+ }
508
+ }
509
+ }
510
+ const getPublishPayload = async (item, uploadedTransactions, options) => {
511
+ const publishMode = options?.publishMode ?? 'patch';
512
+ const graph = await getPublishGraph(item, { publishMode });
513
+ const ctx = { graph, errors: [], uploadedTransactions };
514
+ if (publishMode === 'new_version' && !graph.root.seedUid) {
515
+ addValidationError(ctx, 'Publishing as a new version requires the item to already have a published Seed attestation (seed UID).', 'seedUid', 'publish_new_version_requires_seed');
516
+ }
517
+ let multiPublishPayload = [];
518
+ for (const node of graph.nodes)
519
+ multiPublishPayload.push(await buildRequest(node, ctx));
520
+ await checkEmbeddedImages(ctx);
521
+ // A request whose seed fills another request's property (propertiesToUpdate) publishes first, and a
522
+ // request encoding another's local id publishes after it.
523
+ multiPublishPayload = orderPayloadByDependencies(multiPublishPayload);
524
+ if (publishMode === 'new_version') {
525
+ const rootPayload = multiPublishPayload.find((p) => p.localId === graph.root.seedLocalId);
526
+ if (!rootPayload?.listOfAttestations.length) {
527
+ addValidationError(ctx, 'Publishing as a new version requires at least one property attestation for the item. ' +
528
+ 'Ensure required fields have values and that publishable properties are present.', 'listOfAttestations', 'publish_new_version_empty_snapshot');
529
+ }
530
+ }
531
+ // Stop before anything is uploaded or attested: the payload would attest revoked seed uids.
532
+ if (graph.unpublishedRelatedItems.length) {
533
+ throw new RelatedItemUnpublishedError(graph.unpublishedRelatedItems, ctx.errors);
534
+ }
535
+ if (ctx.errors.length > 0) {
536
+ const combinedMessage = ctx.errors.map((e) => e.message).join('\n');
537
+ throw new PublishValidationFailedError(`Validation failed (${ctx.errors.length} error${ctx.errors.length === 1 ? '' : 's'}):\n${combinedMessage}`, ctx.errors);
538
+ }
539
+ return multiPublishPayload;
540
+ };
541
+ /**
542
+ * Validates an item for publishing without performing Arweave or EAS work.
543
+ * Use in the checking step to fail fast before creating transactions.
544
+ * Pass empty array for uploadedTransactions when validating before Arweave upload.
545
+ */
546
+ const validateItemForPublish = async (item, uploadedTransactions = [], options) => {
547
+ try {
548
+ await getPublishPayload(item, uploadedTransactions, options);
549
+ return { isValid: true, errors: [] };
550
+ }
551
+ catch (err) {
552
+ if (err instanceof PublishValidationFailedError) {
553
+ return { isValid: false, errors: err.validationErrors };
554
+ }
555
+ throw err;
556
+ }
557
+ };
558
+ /**
559
+ * LocalIds in this batch referenced by attestations (bytes32 / bytes32[]) that must publish before this request.
560
+ */
561
+ function collectAttestationLocalRefIds(req, allLocalIds) {
562
+ const refs = [];
563
+ for (const att of req.listOfAttestations) {
564
+ if (att._unresolvedValue && allLocalIds.has(att._unresolvedValue))
565
+ refs.push(att._unresolvedValue);
566
+ for (const id of att._rawListIdsForResolve ?? []) {
567
+ const t = id != null ? String(id).trim() : '';
568
+ if (t && allLocalIds.has(t))
569
+ refs.push(t);
570
+ }
571
+ }
572
+ return refs;
573
+ }
574
+ /**
575
+ * Topological sort (Kahn): edge `from → to` means `from` must publish before `to`.
576
+ * - propertiesToUpdate: updater before updatee (contract injection).
577
+ * - _unresolvedValue / _rawListIdsForResolve: referenced seed before request that encodes the ref.
578
+ * Ties keep the input order (the graph's finish order).
579
+ */
580
+ function orderPayloadByDependencies(payload) {
581
+ if (payload.length <= 1)
582
+ return payload;
583
+ const byLocalId = new Map();
584
+ const indexOrder = new Map();
585
+ payload.forEach((p, i) => {
586
+ byLocalId.set(p.localId, p);
587
+ indexOrder.set(p.localId, i);
588
+ });
589
+ const allIds = new Set(byLocalId.keys());
590
+ const indegree = new Map([...allIds].map((id) => [id, 0]));
591
+ const adj = new Map();
592
+ const addEdge = (from, to) => {
593
+ if (from === to || !allIds.has(from) || !allIds.has(to))
594
+ return;
595
+ if (!adj.has(from))
596
+ adj.set(from, new Set());
597
+ const set = adj.get(from);
598
+ if (set.has(to))
599
+ return;
600
+ set.add(to);
601
+ indegree.set(to, (indegree.get(to) ?? 0) + 1);
602
+ };
603
+ for (const p of payload) {
604
+ for (const u of p.propertiesToUpdate)
605
+ addEdge(p.localId, u.publishLocalId);
606
+ for (const refId of collectAttestationLocalRefIds(p, allIds))
607
+ addEdge(refId, p.localId);
608
+ }
609
+ const byInputOrder = (a, b) => (indexOrder.get(a) ?? 0) - (indexOrder.get(b) ?? 0);
610
+ const queue = [...allIds].filter((id) => (indegree.get(id) ?? 0) === 0).sort(byInputOrder);
611
+ const result = [];
612
+ while (queue.length > 0) {
613
+ const id = queue.shift();
614
+ result.push(byLocalId.get(id));
615
+ for (const to of adj.get(id) ?? []) {
616
+ const next = (indegree.get(to) ?? 0) - 1;
617
+ indegree.set(to, next);
618
+ if (next === 0) {
619
+ queue.push(to);
620
+ queue.sort(byInputOrder);
621
+ }
622
+ }
623
+ }
624
+ if (result.length !== payload.length) {
625
+ const seen = new Set(result.map((r) => r.localId));
626
+ for (const p of payload)
627
+ if (!seen.has(p.localId))
628
+ result.push(p);
629
+ }
630
+ return result;
631
+ }
632
+ /** Normalize attestation UID to 32-byte hex for SchemaEncoder bytes32 fields. */
633
+ function padUidForBytes32Schema(uid) {
634
+ const t = uid.trim();
635
+ if (!t.startsWith('0x'))
636
+ return uid;
637
+ const hex = t.slice(2).replace(/[^0-9a-fA-F]/g, '');
638
+ if (hex.length === 0)
639
+ return uid;
640
+ return ('0x' + hex.padStart(64, '0').slice(-64)).toLowerCase();
641
+ }
642
+ /**
643
+ * Resolves relation/image property values (seedLocalId) to attestation uids after dependent seeds are published.
644
+ * Call after each payload is published, passing the returned attestation uid for that seed's localId.
645
+ * Returns an updated multiPayload with re-encoded attestations where resolution was applied.
646
+ */
647
+ const resolvePublishPayloadValues = async (multiPayload, resolvedUids) => {
648
+ if (Object.keys(resolvedUids).length === 0) {
649
+ return multiPayload;
650
+ }
651
+ const { SchemaEncoder } = await loadEasSdk();
652
+ const result = [];
653
+ for (const payload of multiPayload) {
654
+ const updatedAttestations = [];
655
+ for (const attestation of payload.listOfAttestations) {
656
+ const entry = attestation;
657
+ const rawList = entry._rawListIdsForResolve;
658
+ if (rawList &&
659
+ rawList.length > 0 &&
660
+ entry._schemaDef &&
661
+ (entry._propertyNameForSchema || entry._propertyName)) {
662
+ const fieldName = entry._propertyNameForSchema ?? easName(entry._propertyName);
663
+ const resolvedValues = [];
664
+ let allSlotsResolved = true;
665
+ for (const id of rawList) {
666
+ const trimmed = id.trim();
667
+ if (isUidRef(trimmed)) {
668
+ resolvedValues.push(padUidForBytes32Schema(trimmed));
669
+ continue;
670
+ }
671
+ const r = resolvedUids[trimmed];
672
+ if (r) {
673
+ resolvedValues.push(padUidForBytes32Schema(r));
674
+ continue;
675
+ }
676
+ allSlotsResolved = false;
677
+ break;
678
+ }
679
+ // Do not encode or clear hints until every slot has a real uid — otherwise sequential
680
+ // publish burns encodeBytes32String(localId) into data and drops _rawListIdsForResolve.
681
+ if (!allSlotsResolved) {
682
+ updatedAttestations.push({
683
+ ...entry,
684
+ data: Array.isArray(entry.data) ? entry.data : [entry.data],
685
+ });
686
+ continue;
687
+ }
688
+ const dataEncoder = new SchemaEncoder(entry._schemaDef);
689
+ const encodedData = dataEncoder.encodeData([
690
+ {
691
+ name: fieldName,
692
+ type: 'bytes32[]',
693
+ value: resolvedValues,
694
+ },
695
+ ]);
696
+ const baseData = Array.isArray(entry.data) ? entry.data[0] : entry.data;
697
+ updatedAttestations.push({
698
+ ...entry,
699
+ data: [
700
+ {
701
+ ...baseData,
702
+ data: encodedData,
703
+ },
704
+ ],
705
+ _rawListIdsForResolve: undefined,
706
+ _easDataType: undefined,
707
+ });
708
+ continue;
709
+ }
710
+ const resolvedUid = entry._unresolvedValue && resolvedUids[entry._unresolvedValue];
711
+ const easType = entry._easDataType || 'bytes32';
712
+ if (resolvedUid && entry._schemaDef && (entry._propertyNameForSchema || entry._propertyName)) {
713
+ const fieldName = entry._propertyNameForSchema ?? easName(entry._propertyName);
714
+ const valueForEncode = easType === 'bytes32' ? padUidForBytes32Schema(resolvedUid) : resolvedUid;
715
+ const dataEncoder = new SchemaEncoder(entry._schemaDef);
716
+ const encodedData = dataEncoder.encodeData([
717
+ {
718
+ name: fieldName,
719
+ type: easType,
720
+ value: valueForEncode,
721
+ },
722
+ ]);
723
+ const baseData = Array.isArray(entry.data) ? entry.data[0] : entry.data;
724
+ updatedAttestations.push({
725
+ ...entry,
726
+ data: [
727
+ {
728
+ ...baseData,
729
+ data: encodedData,
730
+ },
731
+ ],
732
+ _unresolvedValue: undefined,
733
+ });
734
+ }
735
+ else {
736
+ const normalizedEntry = {
737
+ ...entry,
738
+ data: Array.isArray(entry.data) ? entry.data : [entry.data],
739
+ };
740
+ updatedAttestations.push(normalizedEntry);
741
+ }
742
+ }
743
+ result.push({
744
+ ...payload,
745
+ listOfAttestations: updatedAttestations,
746
+ });
747
+ }
748
+ return result;
749
+ };
750
+
751
+ var getPublishPayload$1 = /*#__PURE__*/Object.freeze({
752
+ __proto__: null,
753
+ PublishValidationFailedError: PublishValidationFailedError,
754
+ getPublishPayload: getPublishPayload,
755
+ resolvePublishPayloadValues: resolvePublishPayloadValues,
756
+ validateItemForPublish: validateItemForPublish
757
+ });
758
+
759
+ export { PublishValidationFailedError as P, RELATED_ITEM_UNPUBLISHED_CODE as R, RelatedItemUnpublishedError as a, getPendingRetractions as b, getPublishPayload$1 as c, getPropertyClear as g, resolvePublishPayloadValues as r, validateItemForPublish as v };
760
+ //# sourceMappingURL=getPublishPayload-BnIwpwz1.js.map