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

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 (166) hide show
  1. package/dist/{BasePathResolver-BdxCSIzn.js → BasePathResolver-CfSfMW5_.js} +7 -10
  2. package/dist/BasePathResolver-CfSfMW5_.js.map +1 -0
  3. package/dist/{ClientManager-ClCwwhwo.js → ClientManager-C-QXqUK9.js} +438 -153
  4. package/dist/ClientManager-C-QXqUK9.js.map +1 -0
  5. package/dist/{Item-B9Y4VuK1.js → Item-C7sUUu2B.js} +291 -105
  6. package/dist/Item-C7sUUu2B.js.map +1 -0
  7. package/dist/{ModelProperty-BMePcicQ.js → ModelProperty-DJxeOOrc.js} +28 -27
  8. package/dist/ModelProperty-DJxeOOrc.js.map +1 -0
  9. package/dist/{Schema-COsEXXaR.js → Schema-fXtvd-yL.js} +30 -30
  10. package/dist/{Schema-COsEXXaR.js.map → Schema-fXtvd-yL.js.map} +1 -1
  11. package/dist/{SchemaValidationService-DabGMzSE.js → SchemaValidationService-CvRS2HSO.js} +10 -9
  12. package/dist/{SchemaValidationService-DabGMzSE.js.map → SchemaValidationService-CvRS2HSO.js.map} +1 -1
  13. package/dist/{backfillMetadataPropertyIds-Ck6fumnm.js → backfillMetadataPropertyIds-SXW-8C64.js} +4 -4
  14. package/dist/{backfillMetadataPropertyIds-Ck6fumnm.js.map → backfillMetadataPropertyIds-SXW-8C64.js.map} +1 -1
  15. package/dist/cjs/{ModelProperty-BT6Un_MB.js → ModelProperty-DXZ39Wyv.js} +24 -23
  16. package/dist/cjs/{ModelProperty-BT6Un_MB.js.map → ModelProperty-DXZ39Wyv.js.map} +1 -1
  17. package/dist/cjs/{Schema-BXhXdUsA.js → Schema-DdP109QD.js} +26 -25
  18. package/dist/cjs/{Schema-BXhXdUsA.js.map → Schema-DdP109QD.js.map} +1 -1
  19. package/dist/cjs/{SchemaValidationService-CC18QDfc.js → SchemaValidationService-CSXxx7sQ.js} +5 -4
  20. package/dist/cjs/{SchemaValidationService-CC18QDfc.js.map → SchemaValidationService-CSXxx7sQ.js.map} +1 -1
  21. package/dist/cjs/{backfillMetadataPropertyIds-DEHC9ejq.js → backfillMetadataPropertyIds-CPYoaMl4.js} +6 -5
  22. package/dist/cjs/{backfillMetadataPropertyIds-DEHC9ejq.js.map → backfillMetadataPropertyIds-CPYoaMl4.js.map} +1 -1
  23. package/dist/cjs/{eas-C3CL0l7l.js → eas-B2YDQssV.js} +6 -5
  24. package/dist/cjs/{eas-C3CL0l7l.js.map → eas-B2YDQssV.js.map} +1 -1
  25. package/dist/cjs/{getItem-CrwWYCkj.js → getItem-DgnaQzbE.js} +5 -4
  26. package/dist/cjs/{getItem-CrwWYCkj.js.map → getItem-DgnaQzbE.js.map} +1 -1
  27. package/dist/cjs/{getPublishPayload-DRJh7WR0.js → getPublishPayload-CqlqRdot.js} +12 -11
  28. package/dist/cjs/{getPublishPayload-DRJh7WR0.js.map → getPublishPayload-CqlqRdot.js.map} +1 -1
  29. package/dist/cjs/getPublishUploads-DsXY9S4U.js +872 -0
  30. package/dist/cjs/getPublishUploads-DsXY9S4U.js.map +1 -0
  31. package/dist/cjs/{index-BA1RIYFG.js → index-BHaWOwNF.js} +6 -5
  32. package/dist/cjs/index-BHaWOwNF.js.map +1 -0
  33. package/dist/cjs/{index-Dls7aMjr.js → index-C4XlgCJ4.js} +1200 -528
  34. package/dist/cjs/index-C4XlgCJ4.js.map +1 -0
  35. package/dist/cjs/{property-ZerTWizX.js → property-fa0iju0J.js} +8 -7
  36. package/dist/cjs/{property-ZerTWizX.js.map → property-fa0iju0J.js.map} +1 -1
  37. package/dist/cjs/{publishDraftGraph-CPOAcQFf.js → publishDraftGraph-3ASwAlD7.js} +4 -4
  38. package/dist/cjs/{publishDraftGraph-CPOAcQFf.js.map → publishDraftGraph-3ASwAlD7.js.map} +1 -1
  39. package/dist/cjs/{resetAmbiguousLegacyItemData-adDl4LcT.js → resetAmbiguousLegacyItemData-Bu_MBBYt.js} +5 -4
  40. package/dist/cjs/{resetAmbiguousLegacyItemData-adDl4LcT.js.map → resetAmbiguousLegacyItemData-Bu_MBBYt.js.map} +1 -1
  41. package/dist/cjs/{resolveModelForSyncedSeed-DoNThPdL.js → resolveModelForSyncedSeed-BANIiuFU.js} +2 -2
  42. package/dist/cjs/{resolveModelForSyncedSeed-DoNThPdL.js.map → resolveModelForSyncedSeed-BANIiuFU.js.map} +1 -1
  43. package/dist/cjs/{syncDbWithEas-CYfPkus9.js → syncDbWithEas-CrmxxmUW.js} +10 -9
  44. package/dist/cjs/{syncDbWithEas-CYfPkus9.js.map → syncDbWithEas-CrmxxmUW.js.map} +1 -1
  45. package/dist/{configurePlatform-xU3Hsno3.js → configurePlatform-BRw2j0ZN.js} +7 -4
  46. package/dist/{configurePlatform-xU3Hsno3.js.map → configurePlatform-BRw2j0ZN.js.map} +1 -1
  47. package/dist/{db-W1g29qsM.js → db-D9K_f5cF.js} +14 -14
  48. package/dist/{db-W1g29qsM.js.map → db-D9K_f5cF.js.map} +1 -1
  49. package/dist/{eas-CSwV6MvB.js → eas-DHxfswCt.js} +8 -5
  50. package/dist/eas-DHxfswCt.js.map +1 -0
  51. package/dist/{getItem-BYQeM3DY.js → getItem-d6N_aM6S.js} +8 -5
  52. package/dist/{getItem-BYQeM3DY.js.map → getItem-d6N_aM6S.js.map} +1 -1
  53. package/dist/{getPublishPayload-D5CQZd-y.js → getPublishPayload-BHrxVtzY.js} +16 -16
  54. package/dist/{getPublishPayload-D5CQZd-y.js.map → getPublishPayload-BHrxVtzY.js.map} +1 -1
  55. package/dist/getPublishUploads-BEqRiKIS.js +657 -0
  56. package/dist/getPublishUploads-BEqRiKIS.js.map +1 -0
  57. package/dist/{index-Bev-hZF-.js → index-CiMEoGu3.js} +12 -11
  58. package/dist/index-CiMEoGu3.js.map +1 -0
  59. package/dist/{index-CSOQFAOn.js → index-DglvthOk.js} +2 -2
  60. package/dist/index-DglvthOk.js.map +1 -0
  61. package/dist/{index-DRXC5Mra.js → index-s15q14rm.js} +29 -29
  62. package/dist/{index-DRXC5Mra.js.map → index-s15q14rm.js.map} +1 -1
  63. package/dist/{index.browser-DO20vYuP.js → index.browser-Cm06tP4X.js} +553 -165
  64. package/dist/index.browser-Cm06tP4X.js.map +1 -0
  65. package/dist/{index.node-C4iyOhdo.js → index.node-C30dmFgn.js} +5 -5
  66. package/dist/{index.node-C4iyOhdo.js.map → index.node-C30dmFgn.js.map} +1 -1
  67. package/dist/main.cjs +4 -3
  68. package/dist/main.cjs.map +1 -1
  69. package/dist/main.js +32 -44
  70. package/dist/main.js.map +1 -1
  71. package/dist/mimeTypes-DHAHC4eZ.js +204 -0
  72. package/dist/mimeTypes-DHAHC4eZ.js.map +1 -0
  73. package/dist/node.js +13 -12
  74. package/dist/node.js.map +1 -1
  75. package/dist/platform.browser.js +9 -7
  76. package/dist/platform.browser.js.map +1 -1
  77. package/dist/platform.node.js +3 -3
  78. package/dist/{property-BT1zDSkd.js → property-DhmmYAvQ.js} +12 -9
  79. package/dist/property-DhmmYAvQ.js.map +1 -0
  80. package/dist/{publishDraftGraph-Bcfrdj7-.js → publishDraftGraph-yYP74WRt.js} +8 -8
  81. package/dist/{publishDraftGraph-Bcfrdj7-.js.map → publishDraftGraph-yYP74WRt.js.map} +1 -1
  82. package/dist/{resetAmbiguousLegacyItemData-Ci6PM_vC.js → resetAmbiguousLegacyItemData-Bk0QyDW8.js} +2 -2
  83. package/dist/{resetAmbiguousLegacyItemData-Ci6PM_vC.js.map → resetAmbiguousLegacyItemData-Bk0QyDW8.js.map} +1 -1
  84. package/dist/{resolveModelForSyncedSeed-CLlumTBq.js → resolveModelForSyncedSeed-8cAzvUFd.js} +2 -2
  85. package/dist/{resolveModelForSyncedSeed-CLlumTBq.js.map → resolveModelForSyncedSeed-8cAzvUFd.js.map} +1 -1
  86. package/dist/src/Item/Item.d.ts +1 -1
  87. package/dist/src/Item/Item.d.ts.map +1 -1
  88. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -1
  89. package/dist/src/browser/helpers/FileManager.d.ts +4 -1
  90. package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
  91. package/dist/src/browser/helpers/tolerantWebAccess.d.ts +79 -4
  92. package/dist/src/browser/helpers/tolerantWebAccess.d.ts.map +1 -1
  93. package/dist/src/browser/workers/FileDownloader.d.ts +19 -4
  94. package/dist/src/browser/workers/FileDownloader.d.ts.map +1 -1
  95. package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
  96. package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
  97. package/dist/src/db/migrateLegacyItemStorageRows.d.ts +57 -0
  98. package/dist/src/db/migrateLegacyItemStorageRows.d.ts.map +1 -0
  99. package/dist/src/db/read/getCompositeChildPaths.d.ts +13 -0
  100. package/dist/src/db/read/getCompositeChildPaths.d.ts.map +1 -0
  101. package/dist/src/db/read/getItems.d.ts.map +1 -1
  102. package/dist/src/db/read/getPublishUploads.d.ts +32 -3
  103. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  104. package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
  105. package/dist/src/db/write/convertVerbatimItemStorageRow.d.ts +44 -0
  106. package/dist/src/db/write/convertVerbatimItemStorageRow.d.ts.map +1 -0
  107. package/dist/src/db/write/createNewItem.d.ts.map +1 -1
  108. package/dist/src/events/files/download.d.ts.map +1 -1
  109. package/dist/src/helpers/FileManager/BaseFileManager.d.ts +3 -3
  110. package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
  111. package/dist/src/helpers/FileManager/IFileManager.d.ts +25 -1
  112. package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
  113. package/dist/src/helpers/arweaveContentTags.d.ts +33 -0
  114. package/dist/src/helpers/arweaveContentTags.d.ts.map +1 -0
  115. package/dist/src/helpers/compositeUpload.d.ts +28 -0
  116. package/dist/src/helpers/compositeUpload.d.ts.map +1 -0
  117. package/dist/src/helpers/itemStorageFile.d.ts +57 -0
  118. package/dist/src/helpers/itemStorageFile.d.ts.map +1 -0
  119. package/dist/src/helpers/mapWithConcurrency.d.ts +7 -0
  120. package/dist/src/helpers/mapWithConcurrency.d.ts.map +1 -0
  121. package/dist/src/helpers/mimeTypes.d.ts +43 -0
  122. package/dist/src/helpers/mimeTypes.d.ts.map +1 -0
  123. package/dist/src/helpers/ownership.d.ts +19 -3
  124. package/dist/src/helpers/ownership.d.ts.map +1 -1
  125. package/dist/src/helpers/storageDir.d.ts +16 -0
  126. package/dist/src/helpers/storageDir.d.ts.map +1 -0
  127. package/dist/src/helpers/tabCoordinator.d.ts +5 -1
  128. package/dist/src/helpers/tabCoordinator.d.ts.map +1 -1
  129. package/dist/src/helpers/tabEvents.d.ts +23 -2
  130. package/dist/src/helpers/tabEvents.d.ts.map +1 -1
  131. package/dist/src/helpers/tabLocks.d.ts +11 -1
  132. package/dist/src/helpers/tabLocks.d.ts.map +1 -1
  133. package/dist/src/index.d.ts +6 -4
  134. package/dist/src/index.d.ts.map +1 -1
  135. package/dist/src/types/fileManager.d.ts +3 -14
  136. package/dist/src/types/fileManager.d.ts.map +1 -1
  137. package/dist/src/types/publish.d.ts +14 -0
  138. package/dist/src/types/publish.d.ts.map +1 -1
  139. package/dist/{syncDbWithEas-BQsXjGhe.js → syncDbWithEas--HUA9WNb.js} +15 -14
  140. package/dist/syncDbWithEas--HUA9WNb.js.map +1 -0
  141. package/dist/{tabEvents-C9qUKx_z.js → tabEvents-DguZpCCv.js} +338 -60
  142. package/dist/tabEvents-DguZpCCv.js.map +1 -0
  143. package/dist/tolerantWebAccess-BZYWt09Y.js +551 -0
  144. package/dist/tolerantWebAccess-BZYWt09Y.js.map +1 -0
  145. package/dist/{updateSeedRevokedAt-D6q0h7pj.js → updateSeedRevokedAt-D_EG-q3b.js} +3 -3
  146. package/dist/{updateSeedRevokedAt-D6q0h7pj.js.map → updateSeedRevokedAt-D_EG-q3b.js.map} +1 -1
  147. package/package.json +5 -5
  148. package/dist/BasePathResolver-BdxCSIzn.js.map +0 -1
  149. package/dist/ClientManager-ClCwwhwo.js.map +0 -1
  150. package/dist/Item-B9Y4VuK1.js.map +0 -1
  151. package/dist/ModelProperty-BMePcicQ.js.map +0 -1
  152. package/dist/cjs/getPublishUploads-Bh22D3zJ.js +0 -495
  153. package/dist/cjs/getPublishUploads-Bh22D3zJ.js.map +0 -1
  154. package/dist/cjs/index-BA1RIYFG.js.map +0 -1
  155. package/dist/cjs/index-Dls7aMjr.js.map +0 -1
  156. package/dist/eas-CSwV6MvB.js.map +0 -1
  157. package/dist/getPublishUploads-BGpDsrBp.js +0 -484
  158. package/dist/getPublishUploads-BGpDsrBp.js.map +0 -1
  159. package/dist/index-Bev-hZF-.js.map +0 -1
  160. package/dist/index-CSOQFAOn.js.map +0 -1
  161. package/dist/index.browser-DO20vYuP.js.map +0 -1
  162. package/dist/property-BT1zDSkd.js.map +0 -1
  163. package/dist/syncDbWithEas-BQsXjGhe.js.map +0 -1
  164. package/dist/tabEvents-C9qUKx_z.js.map +0 -1
  165. package/dist/tolerantWebAccess-B-9bwxbw.js +0 -160
  166. package/dist/tolerantWebAccess-B-9bwxbw.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPublishUploads-BEqRiKIS.js","sources":["../../src/helpers/mapWithConcurrency.ts","../../src/helpers/compositeUpload.ts","../../src/db/read/getPublishUploads.ts"],"sourcesContent":["/**\n * `Promise.all(items.map(fn))` with at most `limit` calls in flight. Results keep the input order.\n * Rejects with the first error (by time); after that no new calls start, though calls already in\n * flight run to completion.\n */\nexport async function mapWithConcurrency<T, R>(\n items: readonly T[],\n limit: number,\n fn: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const results = new Array<R>(items.length)\n const workerCount = Math.max(1, Math.min(Math.floor(limit) || 1, items.length))\n let next = 0\n let failed = false\n\n const worker = async (): Promise<void> => {\n while (!failed && next < items.length) {\n const index = next++\n try {\n results[index] = await fn(items[index]!, index)\n } catch (error) {\n failed = true\n throw error\n }\n }\n }\n\n await Promise.all(Array.from({ length: workerCount }, worker))\n return results\n}\n","/**\n * Composite uploads: several ItemStorage files of one item in a single Arweave transaction.\n *\n * Producer: `getPublishUploads.ts` (`processUploadPropertyData`), for an item with a\n * `storageTransactionId` property and ItemStorage properties (e.g. a Post's `html` and `json`).\n * Consumer: the download worker (`browser/workers/filesDownload.ts`), which keeps its own copy of\n * {@link decodeCompositeUpload} because it runs from a string; a test keeps the two in step.\n *\n * Format (unchanged for text children, so composites already on Arweave still read):\n *\n * ===FILE_SEPARATOR===<name>===FILE_SEPARATOR===<utf-8 text> (repeated per child)\n *\n * A child that is not valid UTF-8 text (or whose text contains the separator) is written as\n * base64 under the name `<name>;base64`. Composites written before this suffix existed converted\n * every child to text, which corrupted binary children; those bytes cannot be recovered.\n */\nexport const COMPOSITE_SEPARATOR = '===FILE_SEPARATOR==='\nexport const COMPOSITE_BASE64_SUFFIX = ';base64'\n\nexport type CompositeChild = { name: string; bytes: Uint8Array }\n\nconst bytesToBase64 = (bytes: Uint8Array): string => {\n let binary = ''\n const chunk = 0x8000\n for (let i = 0; i < bytes.length; i += chunk) {\n binary += String.fromCharCode(...bytes.subarray(i, i + chunk))\n }\n return btoa(binary)\n}\n\nconst base64ToBytes = (base64: string): Uint8Array | undefined => {\n try {\n const binary = atob(base64.replace(/\\s/g, ''))\n const out = new Uint8Array(binary.length)\n for (let i = 0; i < binary.length; i++) out[i] = binary.charCodeAt(i)\n return out\n } catch {\n return undefined\n }\n}\n\n/** The child's text when it can travel as text: valid UTF-8, no NUL bytes, no separator. */\nconst childAsText = (bytes: Uint8Array): string | undefined => {\n if (bytes.includes(0)) return undefined\n let text: string\n try {\n text = new TextDecoder('utf-8', { fatal: true }).decode(bytes)\n } catch {\n return undefined\n }\n return text.includes(COMPOSITE_SEPARATOR) ? undefined : text\n}\n\nexport const encodeCompositeUpload = (children: CompositeChild[]): Uint8Array => {\n let composite = ''\n for (const { name, bytes } of children) {\n const text = childAsText(bytes)\n composite +=\n text !== undefined\n ? `${COMPOSITE_SEPARATOR}${name}${COMPOSITE_SEPARATOR}${text}`\n : `${COMPOSITE_SEPARATOR}${name}${COMPOSITE_BASE64_SUFFIX}${COMPOSITE_SEPARATOR}${bytesToBase64(bytes)}`\n }\n return new TextEncoder().encode(composite)\n}\n\nconst SEPARATOR_BYTES = new TextEncoder().encode(COMPOSITE_SEPARATOR)\n\n/** True when `bytes` start with the composite separator (checked on bytes, before any text heuristics). */\nexport const isCompositeUpload = (bytes: Uint8Array): boolean =>\n bytes.length >= SEPARATOR_BYTES.length && SEPARATOR_BYTES.every((b, i) => bytes[i] === b)\n\n/** Children of a composite, or `undefined` when `bytes` are not a well-formed composite. */\nexport const decodeCompositeUpload = (bytes: Uint8Array): CompositeChild[] | undefined => {\n if (!isCompositeUpload(bytes)) return undefined\n const parts = new TextDecoder('utf-8').decode(bytes).split(COMPOSITE_SEPARATOR).slice(1)\n if (parts.length % 2 !== 0) return undefined\n const encoder = new TextEncoder()\n const children: CompositeChild[] = []\n for (let i = 0; i < parts.length; i += 2) {\n const rawName = parts[i]!\n const content = parts[i + 1]!\n if (rawName.endsWith(COMPOSITE_BASE64_SUFFIX)) {\n const decoded = base64ToBytes(content)\n if (!decoded) return undefined\n children.push({ name: rawName.slice(0, -COMPOSITE_BASE64_SUFFIX.length), bytes: decoded })\n } else {\n children.push({ name: rawName, bytes: encoder.encode(content) })\n }\n }\n return children\n}\n","import { BaseFileManager } from '@/helpers'\nimport {\n getStorageDirForDataType,\n getItemStorageLocalFileName,\n getItemStorageSubdir,\n} from '@/helpers/storageDir'\nimport {\n isPublishedSeedRef,\n normalizeRelationPropertyValue,\n resolveSeedIdsFromRefString,\n} from '@/helpers/relationSeedRef'\nimport { BaseArweaveClient } from '@/helpers/ArweaveClient/BaseArweaveClient'\nimport { getSegmentedItemProperties } from '@/helpers/getSegmentedItemProperties'\nimport debug from 'debug'\nimport { IItem, IItemProperty } from '@/interfaces'\nimport { buildArweaveContentTags, getContentSha256 } from '@/helpers/arweaveContentTags'\nimport { Item } from '@/Item/Item'\nimport type { ArweaveTransaction, TransactionTag } from '@/types/arweave'\nimport type { PublishUpload, PublishUploadData } from '@/types/publish'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { htmlEmbeddedImageCoPublish } from '@/seedSchema/HtmlEmbeddedImageCoPublishSchema'\nimport { and, eq } from 'drizzle-orm'\nimport { metadata, type MetadataType } from '@/seedSchema'\nimport { compareMetadataRowsLatestFirst } from '@/helpers/compareMetadataRowsLatestFirst'\nimport { ModelPropertyDataTypes, isDataType } from '@/helpers/property'\nimport { getPublishDraftGraph } from '@/db/read/publishDraftGraph'\nimport { resolveUploadMimeType } from '@/helpers/mimeTypes'\nimport { mapWithConcurrency } from '@/helpers/mapWithConcurrency'\nimport { encodeCompositeUpload, type CompositeChild } from '@/helpers/compositeUpload'\nimport {\n convertVerbatimItemStorageRow,\n isVerbatimItemStorageDraftRow,\n} from '@/db/write/convertVerbatimItemStorageRow'\n\nconst logger = debug('seedSdk:item:getPublishUploads')\n\n/** L1 transactions {@link getPublishUploads} creates at once (each asks the gateway for price and anchor). */\nexport const CREATE_TRANSACTION_CONCURRENCY = 4\n\n/** Optional tags merged into each Arweave tx after Content-SHA-256 / Content-Type. */\nexport type GetPublishUploadsOptions = {\n arweaveUploadTags?: TransactionTag[]\n /**\n * Html storage seed local ids to skip (phase 1 of two-phase embedded-image publish).\n */\n deferHtmlStorageSeedLocalIds?: string[]\n /**\n * When set, only Html storage seeds in this list are included (phase 2). Non-Html storage uploads are omitted.\n */\n onlyHtmlStorageSeedLocalIds?: string[]\n /** When true, do not recurse into relation properties (phase 2 must not re-upload related items). */\n skipRelationRecursion?: boolean\n}\n\nconst toUint8Array = async (data: Buffer | Blob): Promise<Uint8Array> => {\n if (typeof Blob !== 'undefined' && data instanceof Blob) {\n return new Uint8Array(await data.arrayBuffer())\n }\n return new Uint8Array(data as Buffer)\n}\n\n/** A local file's bytes plus its MIME type: the Blob's own type, else the name's extension, else a sniff of the bytes. */\nconst readUploadFile = async (\n filePath: string,\n fileName: string = filePath,\n): Promise<{ bytes: Uint8Array; contentType: string | undefined }> => {\n const data = await BaseFileManager.readFileAsBuffer(filePath)\n const bytes = await toUint8Array(data)\n const sourceType = typeof Blob !== 'undefined' && data instanceof Blob ? data.type : undefined\n return { bytes, contentType: resolveUploadMimeType({ sourceType, fileName, bytes }) }\n}\n\nexport const prepareArweaveTransaction = async (\n data: string | Uint8Array,\n contentHash: string | undefined,\n contentType?: string,\n additionalTags?: TransactionTag[],\n): Promise<ArweaveTransaction> => {\n const tags = buildArweaveContentTags(contentHash, contentType, additionalTags)\n\n const tx = await BaseArweaveClient.createTransaction(data, {\n tags: tags.length ? tags : undefined,\n })\n\n return tx\n}\n\ntype UploadTarget = Pick<\n PublishUploadData,\n 'itemPropertyName' | 'itemPropertyLocalId' | 'seedLocalId' | 'versionLocalId'\n>\n\n/**\n * The one place an upload's bytes become a {@link PublishUploadData}: everything after this\n * (Content-SHA-256, tags, the L1 transaction or the bundler DataItem, signing) works from what it\n * returns. A future private-publish option that encrypts content belongs here, before the hash and\n * tags are computed, so both publish paths pick it up.\n */\nconst buildPublishUploadData = (\n data: Uint8Array,\n contentType: string | undefined,\n target: UploadTarget,\n options: GetPublishUploadsOptions | undefined,\n): PublishUploadData => {\n const contentHash = getContentSha256(data)\n return {\n data,\n contentHash,\n contentType,\n tags: buildArweaveContentTags(contentHash, contentType, options?.arweaveUploadTags),\n ...target,\n }\n}\n\n\n\nconst DATA_URI_IMAGE = /^data:(image\\/[a-zA-Z0-9.+-]+);base64,([\\s\\S]*)$/i\n\nfunction decodeDataUriImage(dataUri: string): { mimeType: string; bytes: Uint8Array } | null {\n const m = DATA_URI_IMAGE.exec((dataUri ?? '').trim())\n if (!m) return null\n try {\n const mimeType = m[1]!.toLowerCase().trim()\n const base64 = m[2]!.replace(/\\s/g, '')\n const binary = Uint8Array.from(atob(base64), (c) => c.charCodeAt(0))\n return { mimeType, bytes: binary }\n } catch {\n return null\n }\n}\n\nconst getStorageSeedUploadData = async (\n itemStorageSeedProperties: IItemProperty<any>[],\n options?: GetPublishUploadsOptions,\n): Promise<PublishUploadData[]> => {\n const uploads: PublishUploadData[] = []\n\n for (const itemProperty of itemStorageSeedProperties) {\n const snapshot = itemProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const propertyValue = (context as any).propertyValue\n const refResolvedValue = (context as any).refResolvedValue\n if (!refResolvedValue) {\n continue\n }\n\n // propertyValue is the storage seed's seedLocalId; use it for the upload so processRelationOrImageProperty can match\n const { seedLocalId } = resolveSeedIdsFromRefString(\n normalizeRelationPropertyValue(propertyValue) ?? '',\n )\n if (!seedLocalId) {\n continue\n }\n\n const dataType =\n itemProperty.propertyDef?.refValueType ??\n itemProperty.propertyDef?.dataType ??\n 'Image'\n\n if (isDataType(dataType, ModelPropertyDataTypes.Html)) {\n if (options?.deferHtmlStorageSeedLocalIds?.includes(seedLocalId)) {\n continue\n }\n if (\n options?.onlyHtmlStorageSeedLocalIds?.length &&\n !options.onlyHtmlStorageSeedLocalIds.includes(seedLocalId)\n ) {\n continue\n }\n } else if (options?.onlyHtmlStorageSeedLocalIds?.length) {\n continue\n }\n\n const baseDir = getStorageDirForDataType(dataType)\n const filePath = `${baseDir}/${refResolvedValue}`\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n continue\n }\n\n const { bytes: fileContents, contentType } = await readUploadFile(filePath, refResolvedValue)\n\n uploads.push(\n buildPublishUploadData(\n fileContents,\n contentType,\n {\n itemPropertyName: itemProperty.propertyName,\n itemPropertyLocalId: itemProperty.localId,\n seedLocalId,\n versionLocalId: itemProperty.versionLocalId!,\n },\n options,\n ),\n )\n }\n\n return uploads\n}\n\nasync function appendCoPublishedImageUploadData(\n item: IItem<any>,\n uploads: PublishUploadData[],\n options?: GetPublishUploadsOptions,\n): Promise<PublishUploadData[]> {\n const appDb = BaseDb.getAppDb()\n if (!appDb || options?.onlyHtmlStorageSeedLocalIds?.length) return uploads\n\n const rows = await appDb\n .select()\n .from(htmlEmbeddedImageCoPublish)\n .where(eq(htmlEmbeddedImageCoPublish.parentSeedLocalId, item.seedLocalId))\n\n const seen = new Set(uploads.map((u) => u.seedLocalId))\n\n for (const row of rows) {\n if (seen.has(row.imageSeedLocalId)) continue\n const imageItem = await Item.find({ seedLocalId: row.imageSeedLocalId, modelName: 'Image' })\n if (!imageItem) continue\n const st =\n imageItem.internalProperties['storageTransactionId'] ??\n imageItem.allProperties['storageTransactionId']\n const stSnap = st?.getService().getSnapshot()\n const stCtx = stSnap && 'context' in stSnap ? stSnap.context : undefined\n const stValue = typeof (stCtx as { propertyValue?: unknown } | undefined)?.propertyValue === 'string'\n ? ((stCtx as { propertyValue?: string }).propertyValue ?? '')\n : ''\n const decoded = decodeDataUriImage(stValue)\n\n const more: PublishUploadData[] = []\n if (decoded && st && st.localId && st.versionLocalId) {\n more.push(\n buildPublishUploadData(\n decoded.bytes,\n decoded.mimeType,\n {\n itemPropertyName: st.propertyName,\n itemPropertyLocalId: st.localId,\n seedLocalId: imageItem.seedLocalId,\n versionLocalId: st.versionLocalId,\n },\n options,\n ),\n )\n }\n for (const u of more) {\n if (!seen.has(u.seedLocalId)) {\n uploads.push(u)\n seen.add(u.seedLocalId)\n }\n }\n }\n return uploads\n}\n\nexport type UploadProperty = {\n itemProperty: IItemProperty<any>\n childProperties: IItemProperty<any>[]\n}\ntype ChildUploadData = {\n propertyName: string\n localStoragePath: string\n}\n\nconst isUsablePath = (filePath: string | void | null | undefined): filePath is string =>\n !!filePath && !filePath.endsWith('undefined') && !filePath.endsWith('null')\n\n/** The newest metadata row of an ItemStorage property, read from the DB (not the live query). */\nconst getLatestItemStorageRow = async (\n childProperty: IItemProperty<any>,\n): Promise<MetadataType | undefined> => {\n const appDb = BaseDb.getAppDb()\n const seedLocalId = childProperty.seedLocalId\n const propertyName = childProperty.storagePropertyName || childProperty.propertyName\n if (!appDb || !seedLocalId || !propertyName) return undefined\n const where = [eq(metadata.seedLocalId, seedLocalId), eq(metadata.propertyName, propertyName)]\n if (childProperty.versionLocalId) where.push(eq(metadata.versionLocalId, childProperty.versionLocalId))\n const rows: MetadataType[] = await appDb.select().from(metadata).where(and(...where))\n return [...rows].sort(compareMetadataRowsLatestFirst)[0]\n}\n\n/**\n * Write a legacy ItemStorage draft row's verbatim content to `<seedUid or seedLocalId><extension>`\n * and record it on the row (refResolvedValue, localStorageDir) and in the property context. The\n * row's propertyValue is cleared once the file is written, so the row has the same shape as one a\n * save makes and a later edit of the file never leaves stale text behind it.\n */\nconst migrateVerbatimItemStorageRow = async (\n childProperty: IItemProperty<any>,\n row: MetadataType,\n): Promise<string | undefined> => {\n const seedId = row.seedUid || childProperty.seedUid || row.seedLocalId || childProperty.seedLocalId\n if (!seedId || !row.localId) return undefined\n const propertyDef = childProperty.propertyDef\n const converted = await convertVerbatimItemStorageRow(row.localId, {\n seedId,\n localStorageDir: propertyDef?.localStorageDir || row.localStorageDir,\n filenameSuffix: propertyDef?.filenameSuffix,\n })\n if (!converted) return undefined\n const { fileName, filePath, localStorageDir, content } = converted\n // The content is still the value: keep it as renderValue (the property may show it from propertyValue).\n childProperty.getService().send({\n type: 'updateContext',\n refResolvedValue: fileName,\n localStorageDir,\n renderValue: content,\n })\n logger(`resolveItemStorageChildFile: wrote verbatim ${childProperty.propertyName} content to ${filePath}`)\n return filePath\n}\n\n/**\n * Local file of one ItemStorage child of a composite upload. Tries, in order: the property's\n * localStoragePath (context set by save / hydration / the live query), its newest metadata row's\n * refResolvedValue + localStorageDir, then (for a local draft whose propertyValue is the content\n * itself, as rows made before Item.create saved ItemStorage values) that content written to its\n * file, then (for a local draft, or no row) the name\n * saveItemStorage gives a new file (`<seedUid or seedLocalId><extension>` in the model's storage\n * directory). A published or derived row is never swapped for a local file of another name: that\n * file would be older content.\n *\n * `missingLocalEdit` lists the paths tried when nothing exists although the newest row is a saved\n * local edit (no attestation uid, not derived from one, refResolvedValue set by saveItemStorage):\n * that edit's file should be there. A published or derived row without a file (e.g. content not\n * downloaded, or a property the composite never had) is skipped as before.\n */\nexport const resolveItemStorageChildFile = async (\n childProperty: IItemProperty<any>,\n): Promise<{ filePath?: string; missingLocalEdit?: string[] }> => {\n const tried: string[] = []\n const tryPath = async (filePath: string | void | null | undefined): Promise<string | undefined> => {\n if (!isUsablePath(filePath) || tried.includes(filePath)) return undefined\n tried.push(filePath)\n return (await BaseFileManager.pathExists(filePath)) ? filePath : undefined\n }\n\n const fromContext = await tryPath(childProperty.localStoragePath)\n if (fromContext) return { filePath: fromContext }\n\n const row = await getLatestItemStorageRow(childProperty).catch((error) => {\n logger('resolveItemStorageChildFile: metadata lookup failed', error)\n return undefined\n })\n const propertyDef = childProperty.propertyDef\n const dir = getItemStorageSubdir(propertyDef?.localStorageDir || row?.localStorageDir)\n\n if (row?.refResolvedValue) {\n const fromRow = await tryPath(BaseFileManager.getFilesPath(dir, row.refResolvedValue))\n if (fromRow) return { filePath: fromRow }\n }\n\n const isLocalDraft = !!row && !row.uid && row.derivedFromUid == null\n\n // A local draft holding the content itself (no file reference): what Item.create / createNewItem\n // stored for ItemStorage values before they went through the save pipeline. Write it to the file a\n // save would have, point the row and the property at it, and upload that.\n if (row && isVerbatimItemStorageDraftRow(row)) {\n const migrated = await migrateVerbatimItemStorageRow(childProperty, row).catch((error) => {\n logger('resolveItemStorageChildFile: writing verbatim ItemStorage content failed', error)\n return undefined\n })\n if (migrated) return { filePath: migrated }\n }\n\n const suffix = propertyDef?.filenameSuffix\n const seedIds = !row || isLocalDraft\n ? [row?.seedUid, childProperty.seedUid, row?.seedLocalId, childProperty.seedLocalId]\n : []\n for (const seedId of seedIds) {\n if (!seedId) continue\n const derived = await tryPath(\n BaseFileManager.getFilesPath(dir, getItemStorageLocalFileName(seedId, suffix)),\n )\n if (derived) return { filePath: derived }\n }\n\n // saveItemStorage sets refResolvedValue on the draft row once the file is written. A draft row\n // without one is the empty row createNewItem makes for every model property: nothing to upload.\n return isLocalDraft && !!row?.refResolvedValue ? { missingLocalEdit: tried } : {}\n}\n\n/**\n * True if publish would include at least one Arweave upload (local file / storage seed present).\n * Does not create Arweave transactions or hit the network — use for routing (e.g. skip EAS-only)\n * when {@link getPublishUploads} would fail early (e.g. gateway unreachable during tx creation).\n */\nasync function storageSeedHasUploadCandidates(\n itemStorageSeedProperties: IItemProperty<any>[],\n): Promise<boolean> {\n for (const itemProperty of itemStorageSeedProperties) {\n const snapshot = itemProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const propertyValue = (context as any).propertyValue\n const refResolvedValue = (context as any).refResolvedValue\n if (!refResolvedValue) {\n continue\n }\n\n const { seedLocalId } = resolveSeedIdsFromRefString(\n normalizeRelationPropertyValue(propertyValue) ?? '',\n )\n if (!seedLocalId) {\n continue\n }\n\n const dataType =\n itemProperty.propertyDef?.refValueType ??\n itemProperty.propertyDef?.dataType ??\n 'Image'\n const baseDir = getStorageDirForDataType(dataType)\n const filePath = `${baseDir}/${refResolvedValue}`\n\n if (await BaseFileManager.pathExists(filePath)) {\n return true\n }\n }\n\n return false\n}\n\nasync function uploadPropertyWouldUpload(\n uploadProperty: UploadProperty,\n relatedItemProperty?: IItemProperty<any>,\n): Promise<boolean> {\n\n for (const childProperty of uploadProperty.childProperties) {\n // Not strict: a local edit whose file is missing still means \"would upload\", so the publish\n // goes ahead and fails loudly in processUploadPropertyData instead of skipping the upload.\n const resolved = await resolveItemStorageChildFile(childProperty)\n if (resolved.filePath || resolved.missingLocalEdit) {\n return true\n }\n }\n\n if (relatedItemProperty && relatedItemProperty.localStoragePath) {\n const filePath = relatedItemProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n return false\n }\n\n return await BaseFileManager.pathExists(filePath)\n }\n\n return false\n}\n\nasync function itemOwnUploadCandidates(\n item: IItem<any>,\n relatedItemProperty: IItemProperty<any> | undefined,\n recurseStorageRelations: boolean,\n): Promise<boolean> {\n const { itemUploadProperties, itemRelationProperties, itemImageProperties } =\n await getSegmentedItemProperties(item)\n\n for (const uploadProperty of itemUploadProperties) {\n if (await uploadPropertyWouldUpload(uploadProperty, relatedItemProperty)) {\n return true\n }\n }\n\n if (await storageSeedHasUploadCandidates(itemImageProperties)) {\n return true\n }\n\n if (!recurseStorageRelations) return false\n const storageProperties = new Set(itemImageProperties)\n for (const relationProperty of itemRelationProperties) {\n if (!storageProperties.has(relationProperty)) continue\n const snapshot = relationProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const propertyValue = (context as any).propertyValue\n\n if (!propertyValue || relationProperty.uid) {\n continue\n }\n\n const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(\n normalizeRelationPropertyValue(propertyValue) ?? '',\n )\n if (!seedLocalId && !seedUid) {\n throw new Error(\n `Invalid relation value for ${relationProperty.propertyName}: expected local seed id or 0x uid`,\n )\n }\n\n const relatedItem = await Item.find({\n seedLocalId,\n seedUid,\n })\n\n if (!relatedItem) {\n // Related seed referenced by attested uid with no local copy: already published, nothing to upload.\n if (isPublishedSeedRef(propertyValue)) continue\n throw new Error(\n `No relatedItem found for ${relationProperty.propertyName}`,\n )\n }\n\n if (await itemOwnUploadCandidates(relatedItem, relationProperty, false)) {\n return true\n }\n }\n\n return false\n}\n\n/** Same walk as getPublishUploads: the item and the draft items its publish carries along. */\nexport async function itemHasPublishUploadCandidates(\n item: IItem<any>,\n relatedItemProperty?: IItemProperty<any>,\n): Promise<boolean> {\n if (await itemOwnUploadCandidates(item, relatedItemProperty, true)) return true\n const { drafts } = await getPublishDraftGraph(item, { strict: true })\n for (const { item: draft, via, viaList } of drafts) {\n if (await itemOwnUploadCandidates(draft, viaList ? undefined : via, true)) return true\n }\n return false\n}\n\nconst processUploadPropertyData = async (\n uploadProperty: UploadProperty,\n uploads: PublishUploadData[],\n relatedItemProperty?: IItemProperty<any>,\n options?: GetPublishUploadsOptions,\n): Promise<PublishUploadData[]> => {\n const itemProperty = uploadProperty.itemProperty\n\n const childUploads: ChildUploadData[] = []\n\n for (const childProperty of uploadProperty.childProperties) {\n const { filePath, missingLocalEdit } = await resolveItemStorageChildFile(childProperty)\n\n if (!filePath) {\n if (missingLocalEdit) {\n // Uploading without it would publish a composite that silently lacks this edit.\n throw new Error(\n `Cannot publish ${itemProperty.seedLocalId}: the local file for ${childProperty.propertyName} ` +\n `was not found (looked in ${missingLocalEdit.join(', ')})`,\n )\n }\n continue\n }\n\n childUploads.push({\n propertyName: childProperty.propertyName,\n localStoragePath: filePath,\n })\n }\n\n let fileContents\n let fileContentType: string | undefined\n\n if (!childUploads || childUploads.length === 0) {\n if (relatedItemProperty && relatedItemProperty.localStoragePath) {\n const filePath = relatedItemProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n return uploads\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n return uploads\n }\n\n try {\n const read = await readUploadFile(filePath)\n fileContents = read.bytes\n fileContentType = read.contentType\n } catch (e) {\n const fs = await BaseFileManager.getFs()\n fileContents = await toUint8Array(fs.readFileSync(filePath))\n fileContentType = resolveUploadMimeType({ fileName: filePath, bytes: fileContents })\n }\n }\n if (!fileContents) {\n return uploads\n }\n }\n\n if (childUploads.length > 0) {\n // Composite of the item's ItemStorage files; see helpers/compositeUpload.ts for the format.\n // Children are read as bytes: a binary child is base64-framed instead of decoded as text.\n const children: CompositeChild[] = []\n const fs = await BaseFileManager.getFs()\n for (const childUpload of childUploads) {\n let childUploadContents: Uint8Array | string\n try {\n childUploadContents = await fs.promises.readFile(childUpload.localStoragePath)\n } catch (e) {\n childUploadContents = fs.readFileSync(childUpload.localStoragePath)\n }\n children.push({\n name: childUpload.propertyName,\n bytes:\n typeof childUploadContents === 'string'\n ? new TextEncoder().encode(childUploadContents)\n : new Uint8Array(childUploadContents),\n })\n }\n fileContents = encodeCompositeUpload(children)\n }\n\n if (!fileContents) {\n throw new Error(`No file contents found for ${itemProperty.propertyName}`)\n }\n\n const uint8Array = new Uint8Array(fileContents)\n\n let contentType: string | undefined\n if (childUploads.length === 0 && relatedItemProperty?.localStoragePath) {\n contentType = fileContentType\n } else if (childUploads.length > 0) {\n contentType = 'application/octet-stream'\n }\n\n let itemPropertyLocalId = relatedItemProperty\n ? relatedItemProperty.localId\n : itemProperty.localId\n let itemPropertyName = relatedItemProperty\n ? relatedItemProperty.propertyName\n : itemProperty.propertyName\n\n uploads.push(\n buildPublishUploadData(\n uint8Array,\n contentType,\n {\n itemPropertyName,\n itemPropertyLocalId,\n seedLocalId: itemProperty.seedLocalId!,\n versionLocalId: itemProperty.versionLocalId!,\n },\n options,\n ),\n )\n\n return uploads\n}\n\n/** No seed uid yet: a related item in this state is published together with the item. */\nconst isDraftItem = (item: IItem<any>): boolean =>\n !item.seedUid || item.seedUid === '0x' + '0'.repeat(64)\n\n/** One item's own uploads: its files, storage seeds, Html-embedded images, and the items its storage relations point at. */\nconst getItemOwnPublishUploadData = async (\n item: IItem<any>,\n uploads: PublishUploadData[],\n relatedItemProperty: IItemProperty<any> | undefined,\n options: GetPublishUploadsOptions | undefined,\n): Promise<PublishUploadData[]> => {\n const { itemUploadProperties, itemRelationProperties, itemImageProperties } =\n await getSegmentedItemProperties(item)\n\n // Phase 2 of an embedded-image publish: only the deferred Html storage seeds, of this item and of\n // the related items published with it (whose Html can embed images too).\n const onlyDeferredHtml = !!options?.onlyHtmlStorageSeedLocalIds?.length\n if (onlyDeferredHtml) {\n const storageSeedUploads = await getStorageSeedUploadData(itemImageProperties, options)\n uploads.push(...storageSeedUploads)\n } else {\n for (const uploadProperty of itemUploadProperties) {\n uploads = await processUploadPropertyData(\n uploadProperty,\n uploads,\n relatedItemProperty,\n options,\n )\n }\n\n const storageSeedUploads = await getStorageSeedUploadData(itemImageProperties, options)\n uploads.push(...storageSeedUploads)\n\n // Images embedded in this item's Html: the published item's, and a related draft's published with it.\n if (!relatedItemProperty || isDraftItem(item)) {\n uploads = await appendCoPublishedImageUploadData(item, uploads, options)\n }\n }\n\n if (options?.skipRelationRecursion) {\n return uploads\n }\n\n // Relations to Image/File/Html/Json items: their file, read through the relation property.\n const storageProperties = new Set(itemImageProperties)\n for (const relationProperty of itemRelationProperties) {\n if (!storageProperties.has(relationProperty)) continue\n const snapshot = relationProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const propertyValue = (context as any).propertyValue\n\n if (!propertyValue || relationProperty.uid) {\n continue\n }\n\n const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(\n normalizeRelationPropertyValue(propertyValue) ?? '',\n )\n if (!seedLocalId && !seedUid) {\n throw new Error(\n `Invalid relation value for ${relationProperty.propertyName}: expected local seed id or 0x uid`,\n )\n }\n\n const relatedItem = await Item.find({\n seedLocalId,\n seedUid,\n })\n\n if (!relatedItem) {\n // Related seed referenced by attested uid with no local copy: already published, nothing to upload.\n if (isPublishedSeedRef(propertyValue)) continue\n throw new Error(\n `No relatedItem found for ${relationProperty.propertyName}`,\n )\n }\n\n uploads = await getItemOwnPublishUploadData(relatedItem, uploads, relationProperty, {\n ...options,\n skipRelationRecursion: true,\n })\n }\n\n return uploads\n}\n\n/**\n * Upload data for a publish of `item`: its own, and that of every draft item the publish carries\n * along (reachable through relation and list properties, see publishDraftGraph.ts). Raw bytes plus\n * Content-SHA-256 / Content-Type / configured tags; no Arweave transaction is created, so this\n * does not touch the network. The bundler path in `@seedprotocol/publish` signs these as\n * DataItems; {@link getPublishUploads} turns them into L1 transactions.\n */\nexport const getPublishUploadData = async (\n item: IItem<any>,\n uploads: PublishUploadData[] = [],\n relatedItemProperty?: IItemProperty<any>,\n options?: GetPublishUploadsOptions,\n): Promise<PublishUploadData[]> => {\n uploads = await getItemOwnPublishUploadData(item, uploads, relatedItemProperty, options)\n\n if (options?.skipRelationRecursion) {\n return uploads\n }\n\n const { drafts } = await getPublishDraftGraph(item, { strict: true })\n for (const { item: draft, via, viaList } of drafts) {\n uploads = await getItemOwnPublishUploadData(draft, uploads, viaList ? undefined : via, options)\n }\n\n return uploads\n}\n\n/**\n * Arweave L1 transactions for a publish of `item`: {@link getPublishUploadData}, each made into an\n * unsigned transaction carrying the same tags.\n */\nexport const getPublishUploads = async (\n item: IItem<any>,\n uploads: PublishUpload[] = [],\n relatedItemProperty?: IItemProperty<any>,\n options?: GetPublishUploadsOptions,\n): Promise<PublishUpload[]> => {\n const uploadData = await getPublishUploadData(item, [], relatedItemProperty, options)\n // Each createTransaction fetches the price / anchor from the gateway: run a few at once.\n const created = await mapWithConcurrency(uploadData, CREATE_TRANSACTION_CONCURRENCY, async (upload) => ({\n itemPropertyName: upload.itemPropertyName,\n itemPropertyLocalId: upload.itemPropertyLocalId,\n seedLocalId: upload.seedLocalId,\n versionLocalId: upload.versionLocalId,\n transactionToSign: await BaseArweaveClient.createTransaction(upload.data, {\n tags: upload.tags.length ? upload.tags : undefined,\n }),\n }))\n uploads.push(...created)\n return uploads\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;AAIG;AACI,eAAe,kBAAkB,CACtC,KAAmB,EACnB,KAAa,EACb,EAA0C,EAAA;IAE1C,MAAM,OAAO,GAAG,IAAI,KAAK,CAAI,KAAK,CAAC,MAAM,CAAC;IAC1C,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/E,IAAI,IAAI,GAAG,CAAC;IACZ,IAAI,MAAM,GAAG,KAAK;AAElB,IAAA,MAAM,MAAM,GAAG,YAA0B;QACvC,OAAO,CAAC,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,MAAM,EAAE;AACrC,YAAA,MAAM,KAAK,GAAG,IAAI,EAAE;AACpB,YAAA,IAAI;AACF,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MAAM,MAAM;QACtG,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;QAC/C,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,iBAAiB,EAAE,MAAM,iBAAiB,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE;AACxE,YAAA,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,GAAG,SAAS;SACnD,CAAC;AACH,KAAA,CAAC,CAAC;AACH,IAAA,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;AACxB,IAAA,OAAO,OAAO;AAChB;;"}
@@ -1,31 +1,32 @@
1
1
  import 'reflect-metadata';
2
- export { M as Model, T as TModelSchema, a as TModelValues } from './index-DRXC5Mra.js';
3
- import { M as ModelPropertyDataTypes } from './db-W1g29qsM.js';
4
- export { B as Boolean, D as DEFAULT_TEXT_MAX_LENGTH, a as Date, F as File, H as Html, I as Image, J as Json, L as List, N as Number, P as Property, b as PropertyConstructor, c as PropertyMetadataKey, R as Relation, T as THtmlEmbeddedDataUriPolicy, d as TProperty, e as TPropertyConstructor, f as TPropertyDataType, g as TPropertyDefs, h as TStorageType, i as TValidationRules, j as Text, k as isDataType, n as normalizeDataType, l as normalizePropertyRecordSchema } from './db-W1g29qsM.js';
5
- export { getPropertySchema } from './property-BT1zDSkd.js';
2
+ export { M as Model, T as TModelSchema, a as TModelValues } from './index-s15q14rm.js';
3
+ import { M as ModelPropertyDataTypes } from './db-D9K_f5cF.js';
4
+ export { B as Boolean, D as DEFAULT_TEXT_MAX_LENGTH, a as Date, F as File, H as Html, I as Image, J as Json, L as List, N as Number, P as Property, b as PropertyConstructor, c as PropertyMetadataKey, R as Relation, T as THtmlEmbeddedDataUriPolicy, d as TProperty, e as TPropertyConstructor, f as TPropertyDataType, g as TPropertyDefs, h as TStorageType, i as TValidationRules, j as Text, k as isDataType, n as normalizeDataType, l as normalizePropertyRecordSchema } from './db-D9K_f5cF.js';
5
+ export { getPropertySchema } from './property-DhmmYAvQ.js';
6
6
  import 'xstate';
7
- import './BasePathResolver-BdxCSIzn.js';
7
+ import './BasePathResolver-CfSfMW5_.js';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'drizzle-orm';
10
10
  import '@seedprotocol/arweave';
11
- import './tabEvents-C9qUKx_z.js';
11
+ import './tabEvents-DguZpCCv.js';
12
12
  import 'debug';
13
13
  import '@seedprotocol/eas';
14
14
  import 'pluralize';
15
15
  import 'nanoid';
16
16
  import 'nanoid-dictionary';
17
17
  import '@seedprotocol/query';
18
+ import '@noble/hashes/sha256';
19
+ import '@noble/hashes/sha3';
20
+ import '@noble/hashes/utils';
18
21
  import 'lodash-es';
19
- import './Item-B9Y4VuK1.js';
22
+ import './Item-C7sUUu2B.js';
20
23
  import 'rxjs';
21
24
  import 'drizzle-orm/casing';
22
25
  import './model-DGMe-TTm.js';
23
- import './ClientManager-ClCwwhwo.js';
24
- import '@noble/hashes/sha3';
25
- import '@noble/hashes/utils';
26
+ import './ClientManager-C-QXqUK9.js';
26
27
  import '@sinclair/typebox';
27
28
 
28
29
 
29
30
 
30
31
  export { ModelPropertyDataTypes };
31
- //# sourceMappingURL=index-Bev-hZF-.js.map
32
+ //# sourceMappingURL=index-CiMEoGu3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CiMEoGu3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { m as metadata, b as appState, c as arweaveL1FinalizeJobs, d as config, e as easSyncProcesses, h as htmlEmbeddedImageCoPublish, f as modelRelations, g as modelSchemas, i as modelUids, j as models, k as modelsRelations, p as properties, l as propertiesRelations, n as propertyUidRelations, o as propertyUids, q as publishProcesses, s as schemas, r as seeds, u as uploadProcesses, v as versions } from './BasePathResolver-BdxCSIzn.js';
1
+ import { m as metadata, a as appState, b as arweaveL1FinalizeJobs, c as config, e as easSyncProcesses, h as htmlEmbeddedImageCoPublish, d as modelRelations, f as modelSchemas, g as modelUids, i as models, j as modelsRelations, p as properties, k as propertiesRelations, l as propertyUidRelations, n as propertyUids, o as publishProcesses, s as schemas, q as seeds, u as uploadProcesses, v as versions } from './BasePathResolver-CfSfMW5_.js';
2
2
 
3
3
  var schema = /*#__PURE__*/Object.freeze({
4
4
  __proto__: null,
@@ -25,4 +25,4 @@ var schema = /*#__PURE__*/Object.freeze({
25
25
  });
26
26
 
27
27
  export { schema as s };
28
- //# sourceMappingURL=index-CSOQFAOn.js.map
28
+ //# sourceMappingURL=index-DglvthOk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DglvthOk.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,11 +1,11 @@
1
1
  import { fromCallback, fromPromise, setup, assign, createActor } from 'xstate';
2
- import { a as BaseDb, j as models, p as properties, K as isInternalSchema, g as modelSchemas, s as schemas } from './BasePathResolver-BdxCSIzn.js';
2
+ import { B as BaseDb, i as models, p as properties, K as isInternalSchema, f as modelSchemas, s as schemas } from './BasePathResolver-CfSfMW5_.js';
3
3
  import { eq, and, isNull, or } from 'drizzle-orm';
4
- import { b as generateId } from './tabEvents-C9qUKx_z.js';
4
+ import { j as generateId } from './tabEvents-DguZpCCv.js';
5
5
  import debug from 'debug';
6
- import { G as writeModelToDb, K as writePropertyToDb, O as addSchemaToDb, A as AmbiguousModelError, Q as renameModelInDb, d as TProperty } from './db-W1g29qsM.js';
7
- import { j as waitForEntityIdle, S as getInvariantSafePropertyDescriptor, m as findEntity, C as ClientManagerState, I as Item, T as clearDestroySubscriptions, n as forceRemoveFromCaches, U as unloadEntity, o as runDestroyLifecycle } from './Item-B9Y4VuK1.js';
8
- import { h as getClient } from './ClientManager-ClCwwhwo.js';
6
+ import { G as writeModelToDb, K as writePropertyToDb, O as addSchemaToDb, A as AmbiguousModelError, Q as renameModelInDb, d as TProperty } from './db-D9K_f5cF.js';
7
+ import { k as waitForEntityIdle, V as getInvariantSafePropertyDescriptor, n as findEntity, C as ClientManagerState, I as Item, W as clearDestroySubscriptions, o as forceRemoveFromCaches, X as unloadEntity, q as runDestroyLifecycle } from './Item-C7sUUu2B.js';
8
+ import { k as getClient } from './ClientManager-C-QXqUK9.js';
9
9
  import { modelPropertiesToObject } from './model-DGMe-TTm.js';
10
10
  import { toSnakeCase } from 'drizzle-orm/casing';
11
11
  import { Type } from '@sinclair/typebox';
@@ -37,7 +37,7 @@ const createPropertyInstances = async (propertyFileIds) => {
37
37
  return;
38
38
  }
39
39
  try {
40
- const mod = await import('./ModelProperty-BMePcicQ.js');
40
+ const mod = await import('./ModelProperty-DJxeOOrc.js');
41
41
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
42
42
  if (!ModelProperty) {
43
43
  logger$7('createPropertyInstances: ModelProperty not available from dynamic import');
@@ -103,10 +103,10 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context }, self })
103
103
  if (!modelRecord) {
104
104
  // Model names are only unique per schema: prefer this schema's row, and otherwise only
105
105
  // consider same-name rows that no schema claims yet (never another schema's model).
106
- const _mod_0 = await import('./BasePathResolver-BdxCSIzn.js');
106
+ const _mod_0 = await import('./BasePathResolver-CfSfMW5_.js');
107
107
  const _ns_0 = _mod_0.R;
108
108
  const { modelSchemas } = _ns_0;
109
- const _mod_1 = await import('./BasePathResolver-BdxCSIzn.js');
109
+ const _mod_1 = await import('./BasePathResolver-CfSfMW5_.js');
110
110
  const _ns_1 = _mod_1.Q;
111
111
  const { schemas: schemasTable } = _ns_1;
112
112
  let dbModels = await db
@@ -254,7 +254,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context }, self })
254
254
  // Step 2: Fallback to Schema context (only if database doesn't have the model)
255
255
  // This handles the case where model exists in schema file but not yet in database
256
256
  try {
257
- const _mod_2 = await import('./Schema-COsEXXaR.js');
257
+ const _mod_2 = await import('./Schema-fXtvd-yL.js');
258
258
  const _ns_2 = _mod_2.b;
259
259
  const schemaMod = _ns_2;
260
260
  const { Schema } = schemaMod;
@@ -405,11 +405,11 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context }, self })
405
405
  }
406
406
  // Also check database for models (in case they're persisted but not in Schema context)
407
407
  if (db) {
408
- const _mod_3 = await import('./BasePathResolver-BdxCSIzn.js');
408
+ const _mod_3 = await import('./BasePathResolver-CfSfMW5_.js');
409
409
  const _ns_3 = _mod_3.R;
410
410
  const modelSchemaSchemaMod = _ns_3;
411
411
  const { modelSchemas } = modelSchemaSchemaMod;
412
- const _mod_4 = await import('./BasePathResolver-BdxCSIzn.js');
412
+ const _mod_4 = await import('./BasePathResolver-CfSfMW5_.js');
413
413
  const _ns_4 = _mod_4.Q;
414
414
  const schemaSchemaMod = _ns_4;
415
415
  const { schemas: schemasTable } = schemaSchemaMod;
@@ -505,7 +505,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context }, self })
505
505
  }
506
506
  // Mark schema as draft when a new model is created so saveNewVersion() can persist it
507
507
  try {
508
- const _mod_5 = await import('./Schema-COsEXXaR.js');
508
+ const _mod_5 = await import('./Schema-fXtvd-yL.js');
509
509
  const _ns_5 = _mod_5.b;
510
510
  const schemaMod = _ns_5;
511
511
  const { Schema } = schemaMod;
@@ -553,10 +553,10 @@ const validateModel = fromCallback(({ sendBack, input: { context }, self }) => {
553
553
  const _validateModel = async () => {
554
554
  try {
555
555
  // Use dynamic imports to break circular dependencies
556
- const validationServiceMod = await import('./SchemaValidationService-DabGMzSE.js');
556
+ const validationServiceMod = await import('./SchemaValidationService-CvRS2HSO.js');
557
557
  const { SchemaValidationService } = validationServiceMod;
558
558
  const validationService = new SchemaValidationService();
559
- const _mod_6 = await import('./Schema-COsEXXaR.js');
559
+ const _mod_6 = await import('./Schema-fXtvd-yL.js');
560
560
  const _ns_6 = _mod_6.b;
561
561
  const schemaMod = _ns_6;
562
562
  const { Schema } = schemaMod;
@@ -675,7 +675,7 @@ const createModelProperties = fromCallback(({ sendBack, input, self }) => {
675
675
  return;
676
676
  }
677
677
  logger$5(`Creating ${Object.keys(propertyDefinitions).length} properties for model "${modelName}" (id: ${_dbId})`);
678
- const mod = await import('./ModelProperty-BMePcicQ.js');
678
+ const mod = await import('./ModelProperty-DJxeOOrc.js');
679
679
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
680
680
  if (!ModelProperty) {
681
681
  logger$5('ModelProperty not available from dynamic import');
@@ -700,8 +700,8 @@ const createModelProperties = fromCallback(({ sendBack, input, self }) => {
700
700
  : undefined;
701
701
  // Otherwise use provided ID or generate a random one
702
702
  // IDs should be generated in the import process before creating properties
703
- const _mod_7 = await import('./tabEvents-C9qUKx_z.js');
704
- const _ns_7 = _mod_7.P;
703
+ const _mod_7 = await import('./tabEvents-DguZpCCv.js');
704
+ const _ns_7 = _mod_7.Z;
705
705
  const { generateId } = _ns_7;
706
706
  const propertyFileId = propData.id || propertyRecord?.schemaFileId || generateId();
707
707
  logger$5(`Creating property "${propName}" with fileId "${propertyFileId}"`);
@@ -718,7 +718,7 @@ const createModelProperties = fromCallback(({ sendBack, input, self }) => {
718
718
  }
719
719
  else if (refModelName) {
720
720
  // Fallback: resolve the ref by name within this model's schema
721
- const _mod_8 = await import('./db-W1g29qsM.js');
721
+ const _mod_8 = await import('./db-D9K_f5cF.js');
722
722
  const _ns_8 = _mod_8.Y;
723
723
  const { resolveModelRecord } = _ns_8;
724
724
  const refModelRecord = await resolveModelRecord(refModelName, { schemaName }, db);
@@ -819,7 +819,7 @@ const validateEntity = fromPromise(async ({ input }) => {
819
819
  const evictionEpoch = currentEvictionEpoch();
820
820
  /** The schema to validate against; throws (validation then skips the schema check) once it was evicted. */
821
821
  const schemaForValidation = async (schemaName) => {
822
- const _mod_9 = await import('./Schema-COsEXXaR.js');
822
+ const _mod_9 = await import('./Schema-fXtvd-yL.js');
823
823
  const _ns_9 = _mod_9.b;
824
824
  const { Schema } = _ns_9;
825
825
  if (schemaEvictedSince(schemaName, evictionEpoch)) {
@@ -837,7 +837,7 @@ const validateEntity = fromPromise(async ({ input }) => {
837
837
  const structureMsg = `[validateEntity] Validating model structure`;
838
838
  logger$4(structureMsg);
839
839
  // Use existing Model validation
840
- const validationServiceMod = await import('./SchemaValidationService-DabGMzSE.js');
840
+ const validationServiceMod = await import('./SchemaValidationService-CvRS2HSO.js');
841
841
  const { SchemaValidationService } = validationServiceMod;
842
842
  const validationService = new SchemaValidationService();
843
843
  // Validate model structure
@@ -887,7 +887,7 @@ const validateEntity = fromPromise(async ({ input }) => {
887
887
  }
888
888
  else if (entityInput.entityType === 'modelProperty') {
889
889
  // Use existing ModelProperty validation
890
- const validationServiceMod = await import('./SchemaValidationService-DabGMzSE.js');
890
+ const validationServiceMod = await import('./SchemaValidationService-CvRS2HSO.js');
891
891
  const { SchemaValidationService } = validationServiceMod;
892
892
  const validationService = new SchemaValidationService();
893
893
  // Validate property structure
@@ -927,7 +927,7 @@ const validateEntity = fromPromise(async ({ input }) => {
927
927
  }
928
928
  else if (entityInput.entityType === 'schema') {
929
929
  // Schema validation - use existing validation
930
- const validationServiceMod = await import('./SchemaValidationService-DabGMzSE.js');
930
+ const validationServiceMod = await import('./SchemaValidationService-CvRS2HSO.js');
931
931
  const { SchemaValidationService } = validationServiceMod;
932
932
  const validationService = new SchemaValidationService();
933
933
  const schemaResult = validationService.validateSchema(entityInput.entityData);
@@ -1016,7 +1016,7 @@ const writeToDatabase = fromCallback(({ sendBack, input }) => {
1016
1016
  // initial write completes is not overwritten by the stale requestWrite payload.
1017
1017
  let dataToWrite = input.entityData;
1018
1018
  try {
1019
- const mod = await import('./ModelProperty-BMePcicQ.js');
1019
+ const mod = await import('./ModelProperty-DJxeOOrc.js');
1020
1020
  const ModelProperty = mod?.ModelProperty ?? mod?.default;
1021
1021
  if (ModelProperty && typeof ModelProperty.getById === 'function') {
1022
1022
  const instance = ModelProperty.getById(input.entityId);
@@ -1410,7 +1410,7 @@ const modelMachine = setup({
1410
1410
  // Create ModelProperty instances for any new property IDs
1411
1411
  if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
1412
1412
  // Import and create instances asynchronously (fire-and-forget)
1413
- import('./ModelProperty-BMePcicQ.js').then(({ ModelProperty }) => {
1413
+ import('./ModelProperty-DJxeOOrc.js').then(({ ModelProperty }) => {
1414
1414
  if (self.getSnapshot().status === 'stopped')
1415
1415
  return;
1416
1416
  const createPromises = newPropertyIds.map(async (propertyFileId) => {
@@ -1915,7 +1915,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
1915
1915
  // Lazy import cache for ModelProperty to avoid circular dependency
1916
1916
  // Eagerly start loading to minimize delay on first access
1917
1917
  let ModelPropertyClass = null;
1918
- const modelPropertyImportPromise = import('./ModelProperty-BMePcicQ.js')
1918
+ const modelPropertyImportPromise = import('./ModelProperty-DJxeOOrc.js')
1919
1919
  .then(module => {
1920
1920
  ModelPropertyClass = module.ModelProperty;
1921
1921
  return ModelPropertyClass;
@@ -1931,7 +1931,7 @@ function getModelProperty() {
1931
1931
  return ModelPropertyClass;
1932
1932
  }
1933
1933
  // Lazy import for Schema to avoid circular dependency
1934
- const schemaImportPromise = (async () => { const _mod_12 = await import('./Schema-COsEXXaR.js'); return _mod_12.b; })()
1934
+ const schemaImportPromise = (async () => { const _mod_12 = await import('./Schema-fXtvd-yL.js'); return _mod_12.b; })()
1935
1935
  .then(module => module.Schema)
1936
1936
  .catch(() => null);
1937
1937
  // WeakMap to store mutable state per Model instance
@@ -2842,7 +2842,7 @@ class Model {
2842
2842
  const evictionEpoch = options?.evictionEpoch ?? currentEvictionEpoch();
2843
2843
  try {
2844
2844
  // Query model by name (throws AmbiguousModelError when several schemas define it)
2845
- const _mod_10 = await import('./db-W1g29qsM.js');
2845
+ const _mod_10 = await import('./db-D9K_f5cF.js');
2846
2846
  const _ns_10 = _mod_10.Y;
2847
2847
  const { resolveModelRecord } = _ns_10;
2848
2848
  const resolved = await resolveModelRecord(modelName, {}, db);
@@ -3618,7 +3618,7 @@ class Model {
3618
3618
  return undefined;
3619
3619
  }
3620
3620
  // Model names are only unique per schema: find this model's row by its id (schemaFileId).
3621
- const _mod_11 = await import('./db-W1g29qsM.js');
3621
+ const _mod_11 = await import('./db-D9K_f5cF.js');
3622
3622
  const _ns_11 = _mod_11.Y;
3623
3623
  const { resolveModelRecord } = _ns_11;
3624
3624
  const modelRecord = await resolveModelRecord(modelName, { modelFileId: context.id, schemaName: context.schemaName }, db);
@@ -3824,4 +3824,4 @@ const TModelValues = Type.Record(Type.String(), Type.Any());
3824
3824
  const TModelSchema = Type.Record(Type.String(), TProperty);
3825
3825
 
3826
3826
  export { ConflictError as C, Model as M, TModelSchema as T, TModelValues as a, anyEvictionSince as b, currentEvictionEpoch as c, setupEntityLiveQuery as d, writeToDatabase$1 as e, Model$1 as f, isActorStopped as i, schemaEvictedSince as s, writeProcessMachine as w };
3827
- //# sourceMappingURL=index-DRXC5Mra.js.map
3827
+ //# sourceMappingURL=index-s15q14rm.js.map