@seedprotocol/sdk 0.6.7 → 0.6.8

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 (201) hide show
  1. package/dist/{BasePathResolver-qV0apdVY.js → BasePathResolver-B6CKqoKw.js} +16 -5
  2. package/dist/BasePathResolver-B6CKqoKw.js.map +1 -0
  3. package/dist/{ClientManager-Y5EWQuJj.js → ClientManager-ChcmUL47.js} +619 -264
  4. package/dist/ClientManager-ChcmUL47.js.map +1 -0
  5. package/dist/{ModelProperty-DuB5nk6A.js → ModelProperty-D79uV42p.js} +33 -30
  6. package/dist/ModelProperty-D79uV42p.js.map +1 -0
  7. package/dist/{Schema-BYM-GNdE.js → Schema-a8uO-hIZ.js} +43 -43
  8. package/dist/Schema-a8uO-hIZ.js.map +1 -0
  9. package/dist/{SchemaValidationService-Dr6nmwPm.js → SchemaValidationService-Y49vqast.js} +13 -12
  10. package/dist/SchemaValidationService-Y49vqast.js.map +1 -0
  11. package/dist/{backfillMetadataPropertyIds-BzbAB-C5.js → backfillMetadataPropertyIds-CBsf7LnU.js} +5 -3
  12. package/dist/{backfillMetadataPropertyIds-BzbAB-C5.js.map → backfillMetadataPropertyIds-CBsf7LnU.js.map} +1 -1
  13. package/dist/cjs/{ModelProperty-CDTOx5zi.js → ModelProperty-D9FGaGuE.js} +21 -17
  14. package/dist/cjs/ModelProperty-D9FGaGuE.js.map +1 -0
  15. package/dist/cjs/{Schema-XXcwj3hV.js → Schema-BiJIPLEL.js} +25 -24
  16. package/dist/cjs/Schema-BiJIPLEL.js.map +1 -0
  17. package/dist/cjs/{SchemaValidationService-Z7OhtGn5.js → SchemaValidationService-DtYs_CNY.js} +5 -3
  18. package/dist/cjs/SchemaValidationService-DtYs_CNY.js.map +1 -0
  19. package/dist/cjs/{backfillMetadataPropertyIds-Bt4fzfIV.js → backfillMetadataPropertyIds-2XaN3b9S.js} +3 -2
  20. package/dist/cjs/{backfillMetadataPropertyIds-Bt4fzfIV.js.map → backfillMetadataPropertyIds-2XaN3b9S.js.map} +1 -1
  21. package/dist/cjs/{eas-DdI-4vwl.js → eas-CMNppmGE.js} +4 -3
  22. package/dist/cjs/{eas-DdI-4vwl.js.map → eas-CMNppmGE.js.map} +1 -1
  23. package/dist/cjs/{getItem-B_2GeTQf.js → getItem-B6jEINjW.js} +3 -2
  24. package/dist/cjs/{getItem-B_2GeTQf.js.map → getItem-B6jEINjW.js.map} +1 -1
  25. package/dist/cjs/{getPublishPayload-Jmgi1RUj.js → getPublishPayload-D5DhLGvN.js} +64 -59
  26. package/dist/cjs/getPublishPayload-D5DhLGvN.js.map +1 -0
  27. package/dist/cjs/{getPublishUploads-DNULcrN5.js → getPublishUploads-DMhCCKYF.js} +17 -10
  28. package/dist/cjs/getPublishUploads-DMhCCKYF.js.map +1 -0
  29. package/dist/cjs/{getSegmentedItemProperties-DK82kjri.js → getSegmentedItemProperties-CU8rtBAo.js} +3 -51
  30. package/dist/cjs/getSegmentedItemProperties-CU8rtBAo.js.map +1 -0
  31. package/dist/cjs/{index-DM1WR83P.js → index-CSNtEnbF.js} +879 -467
  32. package/dist/cjs/index-CSNtEnbF.js.map +1 -0
  33. package/dist/cjs/{index-tpO1Nj4v.js → index-DPp9rdRL.js} +6 -3
  34. package/dist/cjs/index-DPp9rdRL.js.map +1 -0
  35. package/dist/cjs/{property-DmvgA8FD.js → property-DlKiAWt4.js} +7 -4
  36. package/dist/cjs/{property-DmvgA8FD.js.map → property-DlKiAWt4.js.map} +1 -1
  37. package/dist/cjs/{syncDbWithEas-3hOoPdu1.js → syncDbWithEas-C6n34o_Q.js} +11 -6
  38. package/dist/cjs/syncDbWithEas-C6n34o_Q.js.map +1 -0
  39. package/dist/{configurePlatform-CCYQruij.js → configurePlatform-CE0Vew17.js} +5 -5
  40. package/dist/{configurePlatform-CCYQruij.js.map → configurePlatform-CE0Vew17.js.map} +1 -1
  41. package/dist/db/drizzle/0014_add_error_code_to_publish_processes.sql +1 -0
  42. package/dist/db/drizzle/meta/0014_snapshot.json +1269 -0
  43. package/dist/db/drizzle/meta/_journal.json +7 -0
  44. package/dist/{db-CceyWksv.js → db-WbrzEf7c.js} +254 -35
  45. package/dist/db-WbrzEf7c.js.map +1 -0
  46. package/dist/{eas-CH8iFIST.js → eas-CfYCu4IX.js} +6 -6
  47. package/dist/{eas-CH8iFIST.js.map → eas-CfYCu4IX.js.map} +1 -1
  48. package/dist/{getItem-C7Mtfz6O.js → getItem-Br-bGNFO.js} +6 -6
  49. package/dist/{getItem-C7Mtfz6O.js.map → getItem-Br-bGNFO.js.map} +1 -1
  50. package/dist/{getPublishPayload-2gnnDdMh.js → getPublishPayload-BIrTVUxb.js} +66 -62
  51. package/dist/getPublishPayload-BIrTVUxb.js.map +1 -0
  52. package/dist/{getPublishUploads-AKISt3JA.js → getPublishUploads-C6cDeZdz.js} +19 -13
  53. package/dist/getPublishUploads-C6cDeZdz.js.map +1 -0
  54. package/dist/{getSegmentedItemProperties-eIjvhCP_.js → getSegmentedItemProperties-BmKE71vU.js} +5 -5
  55. package/dist/{getSegmentedItemProperties-eIjvhCP_.js.map → getSegmentedItemProperties-BmKE71vU.js.map} +1 -1
  56. package/dist/{constants-DSqHBPNe.js → index-280bL-n4.js} +32 -257
  57. package/dist/index-280bL-n4.js.map +1 -0
  58. package/dist/{index-CHi212ST.js → index-ClSv5pTA.js} +13 -13
  59. package/dist/index-ClSv5pTA.js.map +1 -0
  60. package/dist/{index-CsmiM0RI.js → index-Djd3667v.js} +2 -2
  61. package/dist/index-Djd3667v.js.map +1 -0
  62. package/dist/{index-BFpbtEsg.js → index-HRHkbVQd.js} +24 -24
  63. package/dist/{index-BFpbtEsg.js.map → index-HRHkbVQd.js.map} +1 -1
  64. package/dist/{index.node-CbWB4MDz.js → index.node-DBtQkEfz.js} +8 -6
  65. package/dist/index.node-DBtQkEfz.js.map +1 -0
  66. package/dist/main.cjs +6 -1
  67. package/dist/main.cjs.map +1 -1
  68. package/dist/main.js +36 -38
  69. package/dist/main.js.map +1 -1
  70. package/dist/node.js +15 -14
  71. package/dist/node.js.map +1 -1
  72. package/dist/platform.browser.js +108 -46
  73. package/dist/platform.browser.js.map +1 -1
  74. package/dist/platform.node.js +4 -3
  75. package/dist/platform.node.js.map +1 -1
  76. package/dist/{property-CWKcZ5YZ.js → property-CQjuZ4JW.js} +14 -13
  77. package/dist/property-CQjuZ4JW.js.map +1 -0
  78. package/dist/seedSchema/PublishProcessSchema.ts +1 -0
  79. package/dist/src/Item/Item.d.ts +6 -0
  80. package/dist/src/Item/Item.d.ts.map +1 -1
  81. package/dist/src/Item/service/actors/loadOrCreateItem.d.ts.map +1 -1
  82. package/dist/src/ItemProperty/ItemProperty.d.ts +10 -1
  83. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  84. package/dist/src/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
  85. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +1 -1
  86. package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
  87. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  88. package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
  89. package/dist/src/Schema/service/actors/writeModelsToDb.d.ts.map +1 -1
  90. package/dist/src/Schema/service/addModelsMachine.d.ts.map +1 -1
  91. package/dist/src/Schema/service/validation/SchemaValidationService.d.ts.map +1 -1
  92. package/dist/src/browser/db/drizzleFiles.d.ts +3 -2
  93. package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
  94. package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
  95. package/dist/src/browser/helpers/EasClient.d.ts +2 -1
  96. package/dist/src/browser/helpers/EasClient.d.ts.map +1 -1
  97. package/dist/src/browser/helpers/FileManager.d.ts +1 -1
  98. package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
  99. package/dist/src/browser/workers/FileDownloader.d.ts +1 -1
  100. package/dist/src/browser/workers/FileDownloader.d.ts.map +1 -1
  101. package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
  102. package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
  103. package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
  104. package/dist/src/client/constants.d.ts +4 -0
  105. package/dist/src/client/constants.d.ts.map +1 -1
  106. package/dist/src/client/nodeEndpointDefaults.d.ts +8 -0
  107. package/dist/src/client/nodeEndpointDefaults.d.ts.map +1 -0
  108. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  109. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  110. package/dist/src/db/read/getRelatedItemsForPublish.d.ts.map +1 -1
  111. package/dist/src/db/write/createMetadata.d.ts.map +1 -1
  112. package/dist/src/events/files/download.d.ts.map +1 -1
  113. package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
  114. package/dist/src/helpers/ArweaveClient/index.d.ts.map +1 -1
  115. package/dist/src/helpers/FileManager/BaseFileManager.d.ts +2 -2
  116. package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
  117. package/dist/src/helpers/FileManager/IFileManager.d.ts +4 -0
  118. package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
  119. package/dist/src/helpers/constants.d.ts +8 -0
  120. package/dist/src/helpers/constants.d.ts.map +1 -1
  121. package/dist/src/helpers/db.d.ts +6 -0
  122. package/dist/src/helpers/db.d.ts.map +1 -1
  123. package/dist/src/helpers/gateway/gatewayState.d.ts +1 -1
  124. package/dist/src/helpers/gateway/gatewayState.d.ts.map +1 -1
  125. package/dist/src/helpers/localDbChain.d.ts +22 -0
  126. package/dist/src/helpers/localDbChain.d.ts.map +1 -0
  127. package/dist/src/helpers/metadataPropertyNames.d.ts +9 -0
  128. package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
  129. package/dist/src/helpers/property/index.d.ts +12 -0
  130. package/dist/src/helpers/property/index.d.ts.map +1 -1
  131. package/dist/src/helpers/readHtmlBodyForStorageSeed.d.ts.map +1 -1
  132. package/dist/src/helpers/relationSeedRef.d.ts +8 -0
  133. package/dist/src/helpers/relationSeedRef.d.ts.map +1 -1
  134. package/dist/src/index.d.ts +9 -5
  135. package/dist/src/index.d.ts.map +1 -1
  136. package/dist/src/node/easLodashHook.d.ts +2 -0
  137. package/dist/src/node/easLodashHook.d.ts.map +1 -0
  138. package/dist/src/node/easLodashRegister.d.ts +2 -0
  139. package/dist/src/node/easLodashRegister.d.ts.map +1 -0
  140. package/dist/src/node/helpers/FileManager.d.ts +2 -1
  141. package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
  142. package/dist/src/node/index.d.ts +2 -1
  143. package/dist/src/node/index.d.ts.map +1 -1
  144. package/dist/src/seedSchema/PublishProcessSchema.d.ts +19 -0
  145. package/dist/src/seedSchema/PublishProcessSchema.d.ts.map +1 -1
  146. package/dist/src/types/fileManager.d.ts +4 -0
  147. package/dist/src/types/fileManager.d.ts.map +1 -1
  148. package/dist/src/types/index.d.ts +15 -1
  149. package/dist/src/types/index.d.ts.map +1 -1
  150. package/dist/{syncDbWithEas-5kZneTEL.js → syncDbWithEas-CuARXfyN.js} +16 -12
  151. package/dist/syncDbWithEas-CuARXfyN.js.map +1 -0
  152. package/dist/{updateSeedRevokedAt-CgfOBtqJ.js → updateSeedRevokedAt-CBcLfHWs.js} +2 -2
  153. package/dist/{updateSeedRevokedAt-CgfOBtqJ.js.map → updateSeedRevokedAt-CBcLfHWs.js.map} +1 -1
  154. package/package.json +11 -7
  155. package/src/node/easLodashHook.js +22 -0
  156. package/src/node/easLodashRegister.js +13 -0
  157. package/dist/BasePathResolver-qV0apdVY.js.map +0 -1
  158. package/dist/ClientManager-Y5EWQuJj.js.map +0 -1
  159. package/dist/ModelProperty-DuB5nk6A.js.map +0 -1
  160. package/dist/Schema-BYM-GNdE.js.map +0 -1
  161. package/dist/SchemaValidationService-Dr6nmwPm.js.map +0 -1
  162. package/dist/cjs/ModelProperty-CDTOx5zi.js.map +0 -1
  163. package/dist/cjs/Schema-XXcwj3hV.js.map +0 -1
  164. package/dist/cjs/SchemaValidationService-Z7OhtGn5.js.map +0 -1
  165. package/dist/cjs/getPublishPayload-Jmgi1RUj.js.map +0 -1
  166. package/dist/cjs/getPublishUploads-DNULcrN5.js.map +0 -1
  167. package/dist/cjs/getSegmentedItemProperties-DK82kjri.js.map +0 -1
  168. package/dist/cjs/index-DM1WR83P.js.map +0 -1
  169. package/dist/cjs/index-tpO1Nj4v.js.map +0 -1
  170. package/dist/cjs/syncDbWithEas-3hOoPdu1.js.map +0 -1
  171. package/dist/constants-DSqHBPNe.js.map +0 -1
  172. package/dist/db-CceyWksv.js.map +0 -1
  173. package/dist/getPublishPayload-2gnnDdMh.js.map +0 -1
  174. package/dist/getPublishUploads-AKISt3JA.js.map +0 -1
  175. package/dist/index-CHi212ST.js.map +0 -1
  176. package/dist/index-CsmiM0RI.js.map +0 -1
  177. package/dist/index.node-CbWB4MDz.js.map +0 -1
  178. package/dist/property-CWKcZ5YZ.js.map +0 -1
  179. package/dist/seedSchema/AppStateSchema.d.ts +0 -82
  180. package/dist/seedSchema/AppStateSchema.d.ts.map +0 -1
  181. package/dist/seedSchema/ConfigSchema.d.ts +0 -101
  182. package/dist/seedSchema/ConfigSchema.d.ts.map +0 -1
  183. package/dist/seedSchema/MetadataSchema.d.ts +0 -422
  184. package/dist/seedSchema/MetadataSchema.d.ts.map +0 -1
  185. package/dist/seedSchema/ModelSchema.d.ts +0 -243
  186. package/dist/seedSchema/ModelSchema.d.ts.map +0 -1
  187. package/dist/seedSchema/ModelSchemaSchema.d.ts +0 -61
  188. package/dist/seedSchema/ModelSchemaSchema.d.ts.map +0 -1
  189. package/dist/seedSchema/ModelUidSchema.d.ts +0 -64
  190. package/dist/seedSchema/ModelUidSchema.d.ts.map +0 -1
  191. package/dist/seedSchema/PropertyUidSchema.d.ts +0 -64
  192. package/dist/seedSchema/PropertyUidSchema.d.ts.map +0 -1
  193. package/dist/seedSchema/SchemaSchema.d.ts +0 -169
  194. package/dist/seedSchema/SchemaSchema.d.ts.map +0 -1
  195. package/dist/seedSchema/SeedSchema.d.ts +0 -192
  196. package/dist/seedSchema/SeedSchema.d.ts.map +0 -1
  197. package/dist/seedSchema/VersionSchema.d.ts +0 -194
  198. package/dist/seedSchema/VersionSchema.d.ts.map +0 -1
  199. package/dist/seedSchema/index.d.ts +0 -14
  200. package/dist/seedSchema/index.d.ts.map +0 -1
  201. package/dist/syncDbWithEas-5kZneTEL.js.map +0 -1
@@ -1,25 +1,25 @@
1
- import { r as resolveSeedIdsFromRefString, k as normalizeRelationPropertyValue, M as ModelPropertyDataTypes } from './constants-DSqHBPNe.js';
1
+ import { r as resolveSeedIdsFromRefString, n as normalizeRelationPropertyValue, i as isPublishedSeedRef } from './index-280bL-n4.js';
2
2
  import { BaseArweaveClient } from '@seedprotocol/arweave';
3
- import { g as getSegmentedItemProperties } from './getSegmentedItemProperties-eIjvhCP_.js';
3
+ import { g as getSegmentedItemProperties } from './getSegmentedItemProperties-BmKE71vU.js';
4
4
  import debug from 'debug';
5
- import { I as Item, g as getContentHash } from './ClientManager-Y5EWQuJj.js';
6
- import { B as BaseFileManager, a as BaseDb, h as htmlEmbeddedImageCoPublish } from './BasePathResolver-qV0apdVY.js';
5
+ import { I as Item, g as getContentHash } from './ClientManager-ChcmUL47.js';
6
+ import { B as BaseFileManager, a as BaseDb, h as htmlEmbeddedImageCoPublish } from './BasePathResolver-B6CKqoKw.js';
7
7
  import { eq } from 'drizzle-orm';
8
8
  import 'pluralize';
9
+ import { k as isDataType, M as ModelPropertyDataTypes, n as normalizeDataType } from './db-WbrzEf7c.js';
9
10
  import '@seedprotocol/eas';
10
11
  import 'xstate';
11
- import '@sinclair/typebox';
12
- import './db-CceyWksv.js';
13
- import 'drizzle-orm/casing';
14
- import 'lodash-es';
15
12
  import 'nanoid';
16
13
  import 'nanoid-dictionary';
17
14
  import '@seedprotocol/query';
15
+ import 'lodash-es';
18
16
  import 'reflect-metadata';
19
- import './index-BFpbtEsg.js';
17
+ import './index-HRHkbVQd.js';
20
18
  import './generateId-BopUwD8F.js';
21
19
  import './model-DGMe-TTm.js';
22
- import './property-CWKcZ5YZ.js';
20
+ import 'drizzle-orm/casing';
21
+ import '@sinclair/typebox';
22
+ import './property-CQjuZ4JW.js';
23
23
  import '@noble/hashes/sha3';
24
24
  import '@noble/hashes/utils';
25
25
  import 'rxjs';
@@ -67,7 +67,7 @@ const prepareArweaveTransaction = async (data, contentHash, contentType, additio
67
67
  return tx;
68
68
  };
69
69
  const getStorageDirForDataType = (dataType) => {
70
- switch (dataType) {
70
+ switch (normalizeDataType(dataType)) {
71
71
  case 'Image':
72
72
  return BaseFileManager.getFilesPath('images');
73
73
  case 'File':
@@ -117,7 +117,7 @@ const getStorageSeedUploads = async (itemStorageSeedProperties, options) => {
117
117
  const dataType = itemProperty.propertyDef?.refValueType ??
118
118
  itemProperty.propertyDef?.dataType ??
119
119
  'Image';
120
- if (dataType === ModelPropertyDataTypes.Html) {
120
+ if (isDataType(dataType, ModelPropertyDataTypes.Html)) {
121
121
  if (options?.deferHtmlStorageSeedLocalIds?.includes(seedLocalId)) {
122
122
  continue;
123
123
  }
@@ -283,6 +283,9 @@ async function itemHasPublishUploadCandidates(item, relatedItemProperty) {
283
283
  seedUid,
284
284
  });
285
285
  if (!relatedItem) {
286
+ // Related seed referenced by attested uid with no local copy: already published, nothing to upload.
287
+ if (isPublishedSeedRef(propertyValue))
288
+ continue;
286
289
  throw new Error(`No relatedItem found for ${relationProperty.propertyName}`);
287
290
  }
288
291
  if (await itemHasPublishUploadCandidates(relatedItem, relationProperty)) {
@@ -421,6 +424,9 @@ const getPublishUploads = async (item, uploads = [], relatedItemProperty, option
421
424
  seedUid,
422
425
  });
423
426
  if (!relatedItem) {
427
+ // Related seed referenced by attested uid with no local copy: already published, nothing to upload.
428
+ if (isPublishedSeedRef(propertyValue))
429
+ continue;
424
430
  throw new Error(`No relatedItem found for ${relationProperty.propertyName}`);
425
431
  }
426
432
  uploads = await getPublishUploads(relatedItem, uploads, relationProperty, options);
@@ -429,4 +435,4 @@ const getPublishUploads = async (item, uploads = [], relatedItemProperty, option
429
435
  };
430
436
 
431
437
  export { getPublishUploads, itemHasPublishUploadCandidates, prepareArweaveTransaction };
432
- //# sourceMappingURL=getPublishUploads-AKISt3JA.js.map
438
+ //# sourceMappingURL=getPublishUploads-C6cDeZdz.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPublishUploads-C6cDeZdz.js","sources":["../../src/db/read/getPublishUploads.ts"],"sourcesContent":["import { BaseFileManager } from '@/helpers'\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 { getContentHash } from '@/helpers/crypto'\nimport { Item } from '@/Item/Item'\nimport type { ArweaveTransaction, TransactionTag } from '@/types/arweave'\nimport { PublishUpload } from '@/types/publish'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { htmlEmbeddedImageCoPublish } from '@/seedSchema/HtmlEmbeddedImageCoPublishSchema'\nimport { eq } from 'drizzle-orm'\nimport { ModelPropertyDataTypes, isDataType, normalizeDataType } from '@/helpers/property'\n\nconst logger = debug('seedSdk:item:getPublishUploads')\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 EXTENSION_TO_MIME: Record<string, string> = {\n png: 'image/png',\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n gif: 'image/gif',\n webp: 'image/webp',\n svg: 'image/svg+xml',\n html: 'text/html',\n htm: 'text/html',\n json: 'application/json',\n txt: 'text/plain',\n}\n\nconst getMimeTypeFromPath = (filePathOrName: string): string | undefined => {\n const ext = filePathOrName.split('.').pop()?.toLowerCase()\n return ext ? EXTENSION_TO_MIME[ext] : undefined\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\nexport const prepareArweaveTransaction = async (\n data: string | Uint8Array,\n contentHash: string | undefined,\n contentType?: string,\n additionalTags?: TransactionTag[],\n): Promise<ArweaveTransaction> => {\n const tags: TransactionTag[] = []\n if (contentHash) {\n tags.push({ name: 'Content-SHA-256', value: contentHash })\n logger('contentHash', contentHash)\n logger('adding content hash tag')\n }\n if (contentType) {\n tags.push({ name: 'Content-Type', value: contentType })\n }\n if (additionalTags?.length) {\n tags.push(...additionalTags)\n }\n\n const tx = await BaseArweaveClient.createTransaction(data, {\n tags: tags.length ? tags : undefined,\n })\n\n return tx\n}\n\n\nconst getStorageDirForDataType = (dataType: string): string => {\n switch (normalizeDataType(dataType)) {\n case 'Image':\n return BaseFileManager.getFilesPath('images')\n case 'File':\n return BaseFileManager.getFilesPath('files')\n case 'Html':\n return BaseFileManager.getFilesPath('html')\n case 'Json':\n return BaseFileManager.getFilesPath('json')\n default:\n return BaseFileManager.getFilesPath('images')\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 getStorageSeedUploads = async (\n itemStorageSeedProperties: IItemProperty<any>[],\n options?: GetPublishUploadsOptions,\n) => {\n const uploads: PublishUpload[] = []\n const extra = options?.arweaveUploadTags\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 fileBuffer = await BaseFileManager.readFileAsBuffer(filePath)\n const fileContents = await toUint8Array(fileBuffer)\n\n const contentHash = await getContentHash(fileContents)\n const contentType = getMimeTypeFromPath(refResolvedValue)\n\n const transaction = await prepareArweaveTransaction(\n fileContents,\n contentHash,\n contentType,\n extra,\n )\n\n uploads.push({\n itemPropertyName: itemProperty.propertyName,\n itemPropertyLocalId: itemProperty.localId,\n seedLocalId,\n versionLocalId: itemProperty.versionLocalId!,\n transactionToSign: transaction,\n })\n }\n\n return uploads\n}\n\nasync function appendCoPublishedImageUploads(\n item: IItem<any>,\n uploads: PublishUpload[],\n options?: GetPublishUploadsOptions,\n): Promise<PublishUpload[]> {\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: PublishUpload[] = []\n if (decoded && st && st.localId && st.versionLocalId) {\n const contentHash = await getContentHash(decoded.bytes)\n const transaction = await prepareArweaveTransaction(\n decoded.bytes,\n contentHash,\n decoded.mimeType,\n options?.arweaveUploadTags,\n )\n more.push({\n itemPropertyName: st.propertyName,\n itemPropertyLocalId: st.localId,\n seedLocalId: imageItem.seedLocalId,\n versionLocalId: st.versionLocalId,\n transactionToSign: transaction,\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\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 const childUploads: ChildUploadData[] = []\n\n for (const childProperty of uploadProperty.childProperties) {\n const filePath = childProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n continue\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n continue\n }\n\n childUploads.push({\n propertyName: childProperty.propertyName,\n localStoragePath: filePath,\n })\n }\n\n if (childUploads.length > 0) {\n return true\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\nexport async function itemHasPublishUploadCandidates(\n item: IItem<any>,\n relatedItemProperty?: IItemProperty<any>,\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 for (const relationProperty of itemRelationProperties) {\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 itemHasPublishUploadCandidates(relatedItem, relationProperty)) {\n return true\n }\n }\n\n return false\n}\n\nconst processUploadProperty = async (\n uploadProperty: UploadProperty,\n uploads: PublishUpload[],\n relatedItemProperty?: IItemProperty<any>,\n options?: GetPublishUploadsOptions,\n): Promise<PublishUpload[]> => {\n const extra = options?.arweaveUploadTags\n const itemProperty = uploadProperty.itemProperty\n\n const childUploads: ChildUploadData[] = []\n\n for (const childProperty of uploadProperty.childProperties) {\n const filePath = childProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n continue\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n continue\n }\n\n childUploads.push({\n propertyName: childProperty.propertyName,\n localStoragePath: filePath,\n })\n }\n\n let fileContents\n let transaction: ArweaveTransaction\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 fileBuffer = await BaseFileManager.readFileAsBuffer(filePath)\n fileContents = await toUint8Array(fileBuffer)\n } catch (e) {\n const fs = await BaseFileManager.getFs()\n fileContents = await toUint8Array(fs.readFileSync(filePath))\n }\n }\n if (!fileContents) {\n return uploads\n }\n }\n\n if (childUploads.length > 0) {\n const separator = '===FILE_SEPARATOR==='\n // let compositeFileContents = `${itemProperty.propertyName}${separator}${mainFileContents}`\n let compositeFileContents = ''\n\n for (const childUpload of childUploads) {\n let childUploadContents\n\n const fs = await BaseFileManager.getFs()\n\n try {\n childUploadContents = await fs.promises.readFile(\n childUpload.localStoragePath,\n )\n } catch (e) {\n childUploadContents = fs.readFileSync(childUpload.localStoragePath)\n }\n\n compositeFileContents += `${separator}${childUpload.propertyName}${separator}${childUploadContents}`\n }\n\n if (typeof document !== 'undefined') {\n fileContents = new TextEncoder().encode(compositeFileContents)\n } else {\n fileContents = Buffer.from(compositeFileContents)\n }\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 const contentHash = await getContentHash(uint8Array)\n\n let contentType: string | undefined\n if (childUploads.length === 0 && relatedItemProperty?.localStoragePath) {\n contentType = getMimeTypeFromPath(relatedItemProperty.localStoragePath)\n } else if (childUploads.length > 0) {\n contentType = 'application/octet-stream'\n }\n\n transaction = await prepareArweaveTransaction(\n uint8Array,\n contentHash,\n contentType,\n extra,\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 itemPropertyName,\n itemPropertyLocalId,\n seedLocalId: itemProperty.seedLocalId!,\n versionLocalId: itemProperty.versionLocalId!,\n transactionToSign: transaction,\n })\n\n return uploads\n}\n\nexport const getPublishUploads = async (\n item: IItem<any>,\n uploads: PublishUpload[] = [],\n relatedItemProperty?: IItemProperty<any>,\n options?: GetPublishUploadsOptions,\n) => {\n const { itemUploadProperties, itemRelationProperties, itemImageProperties } =\n await getSegmentedItemProperties(item)\n\n if (!relatedItemProperty && options?.onlyHtmlStorageSeedLocalIds?.length) {\n const storageSeedUploads = await getStorageSeedUploads(itemImageProperties, options)\n uploads.push(...storageSeedUploads)\n return uploads\n }\n\n for (const uploadProperty of itemUploadProperties) {\n uploads = await processUploadProperty(\n uploadProperty,\n uploads,\n relatedItemProperty,\n options,\n )\n }\n\n const storageSeedUploads = await getStorageSeedUploads(itemImageProperties, options)\n uploads.push(...storageSeedUploads)\n\n if (!relatedItemProperty && !options?.onlyHtmlStorageSeedLocalIds?.length) {\n uploads = await appendCoPublishedImageUploads(item, uploads, options)\n }\n\n if (options?.skipRelationRecursion) {\n return uploads\n }\n\n for (const relationProperty of itemRelationProperties) {\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 getPublishUploads(relatedItem, uploads, relationProperty, options)\n }\n\n return uploads\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,MAAM,GAAG,KAAK,C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AAE;YAC1C;QACF;AAEA,QAAA,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,2BAA2B,CAC1D,8BAA8B,CAAC,aAAa,CAAC,IAAI,EAAE,CACpD;AACD,QAAA,IAAI,CAAC,WAAW,IAAI,CAAC,OAAO,EAAE;YAC5B,MAAM,IAAI,KAAK,CACb,CAAA,2BAAA,EAA8B,gBAAgB,CAAC,YAAY,CAAA,kCAAA,CAAoC,CAChG;QACH;AAEA,QAAA,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC;YAClC,WAAW;YACX,OAAO;AACR,SAAA,CAAC;QAEF,IAAI,CAAC,WAAW,EAAE;;YAEhB,IAAI,kBAAkB,CAAC,aAAa,CAAC;gBAAE;YACvC,MAAM,IAAI,KAAK,CACb,CAAA,yBAAA,EAA4B,gBAAgB,CAAC,YAAY,CAAA,CAAE,CAC5D;QACH;AAEA,QAAA,OAAO,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,CAAC;IACpF;AAEA,IAAA,OAAO,OAAO;AAChB;;"}
@@ -1,8 +1,8 @@
1
1
  import 'reflect-metadata';
2
- import './index-BFpbtEsg.js';
3
- import { M as ModelPropertyDataTypes, n as normalizeDataType } from './constants-DSqHBPNe.js';
4
- import { getPropertySchema } from './property-CWKcZ5YZ.js';
5
- import { a as BaseDb, m as models, p as properties } from './BasePathResolver-qV0apdVY.js';
2
+ import './index-HRHkbVQd.js';
3
+ import { M as ModelPropertyDataTypes, n as normalizeDataType } from './db-WbrzEf7c.js';
4
+ import { getPropertySchema } from './property-CQjuZ4JW.js';
5
+ import { a as BaseDb, m as models, p as properties } from './BasePathResolver-B6CKqoKw.js';
6
6
  import { eq, and } from 'drizzle-orm';
7
7
  import { upperFirst, camelCase } from 'lodash-es';
8
8
 
@@ -145,4 +145,4 @@ const getSegmentedItemProperties = async (item) => {
145
145
  };
146
146
 
147
147
  export { getSegmentedItemProperties as g };
148
- //# sourceMappingURL=getSegmentedItemProperties-eIjvhCP_.js.map
148
+ //# sourceMappingURL=getSegmentedItemProperties-BmKE71vU.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getSegmentedItemProperties-eIjvhCP_.js","sources":["../../src/helpers/getSegmentedItemProperties.ts"],"sourcesContent":["import { UploadProperty } from '@/db/read/getPublishUploads'\nimport { IItem } from '@/interfaces'\nimport { ModelPropertyDataTypes, normalizeDataType } from '@/Schema'\nimport { getPropertySchema, TProperty } from '@/helpers/property'\nimport type { Static } from '@sinclair/typebox'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { models, properties } from '@/seedSchema'\nimport { eq, and } from 'drizzle-orm'\nimport { camelCase, upperFirst } from 'lodash-es'\n\nconst matchesDataType = (\n actual: string | undefined,\n expected: ModelPropertyDataTypes | string,\n): boolean => normalizeDataType(actual) === expected\nasync function resolvePropertyDef(\n modelName: string,\n propertyName: string,\n): Promise<{ dataType?: string; ref?: string; refValueType?: string; storageType?: string; localStorageDir?: string; filenameSuffix?: string; required?: boolean } | undefined> {\n let schema = await getPropertySchema(modelName, propertyName)\n if (schema) return schema\n const db = BaseDb.getAppDb()\n if (!db) return undefined\n try {\n const normalizedModelName = upperFirst(camelCase(modelName))\n const modelRecords = await db\n .select({ id: models.id })\n .from(models)\n .where(eq(models.name, normalizedModelName))\n .limit(1)\n if (modelRecords.length === 0 || !modelRecords[0].id) return undefined\n const propertyRecords = await db\n .select()\n .from(properties)\n .where(\n and(\n eq(properties.modelId, modelRecords[0].id),\n eq(properties.name, propertyName),\n ),\n )\n .limit(1)\n if (propertyRecords.length === 0) return undefined\n const propRecord = propertyRecords[0]\n let refModelName: string | undefined\n if (propRecord.refModelId != null) {\n const refModelRows = await db\n .select({ name: models.name })\n .from(models)\n .where(eq(models.id, propRecord.refModelId))\n .limit(1)\n refModelName = refModelRows[0]?.name ?? undefined\n }\n return {\n dataType: propRecord.dataType,\n ref: refModelName ?? undefined,\n refValueType: propRecord.refValueType || undefined,\n storageType: propRecord.storageType || undefined,\n localStorageDir: propRecord.localStorageDir || undefined,\n filenameSuffix: propRecord.filenameSuffix || undefined,\n required: propRecord.required ?? undefined,\n }\n } catch {\n return undefined\n }\n}\n\nexport const getSegmentedItemProperties = async (item: IItem<any>) => {\n const itemBasicProperties = []\n const itemRelationProperties = []\n const itemListProperties = []\n const itemUploadProperties: UploadProperty[] = []\n const itemImageProperties = []\n const itemStorageProperties = []\n let itemStorageTransactionProperty: UploadProperty | undefined\n\n for (const itemProperty of item.properties) {\n let propertyDef = itemProperty.propertyDef\n // When propertyDef is missing (e.g. external app, Model not registered), resolve inline\n // so properties are not skipped and metadata attestations can be created\n if (!propertyDef && item.modelName) {\n const resolved = await resolvePropertyDef(item.modelName, itemProperty.propertyName)\n if (resolved) {\n itemProperty.getService().send({ type: 'updateContext', propertyRecordSchema: resolved })\n propertyDef = resolved as Static<typeof TProperty>\n } else {\n // Last resort: Model and DB don't have schema. Use Text so property routes to\n // itemBasicProperties and can be attested (covers title, description, etc.)\n const fallbackDef = { dataType: 'Text' as const }\n itemProperty.getService().send({ type: 'updateContext', propertyRecordSchema: fallbackDef })\n propertyDef = fallbackDef as Static<typeof TProperty>\n }\n }\n if (!propertyDef) {\n continue\n }\n\n const isItemStorage =\n propertyDef.storageType &&\n propertyDef.storageType === 'ItemStorage'\n\n\n const isStorageTransaction =\n itemProperty.propertyName === 'storageTransactionId' ||\n itemProperty.propertyName === 'storage_transaction_id'\n\n const isStorageSeedType =\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Image) ||\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.File) ||\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Html) ||\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Json) ||\n (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Relation) &&\n (matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.Image) ||\n matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.File) ||\n matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.Html) ||\n matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.Json)))\n\n if (isStorageSeedType) {\n itemImageProperties.push(itemProperty)\n if (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Relation)) {\n itemRelationProperties.push(itemProperty)\n }\n continue\n }\n\n if (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Relation)) {\n itemRelationProperties.push(itemProperty)\n continue\n }\n\n if (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.List)) {\n // List-of-relations: ref present, goes to processListProperty\n // List-of-primitives: ref absent, treat as basic property\n const listRef =\n propertyDef.ref || (propertyDef as { refModelName?: string }).refModelName\n if (listRef) {\n itemListProperties.push(itemProperty)\n } else {\n itemBasicProperties.push(itemProperty)\n }\n continue\n }\n\n if (isItemStorage) {\n itemStorageProperties.push(itemProperty)\n continue\n }\n\n if (isStorageTransaction) {\n itemStorageTransactionProperty = { itemProperty, childProperties: [] }\n continue\n }\n\n itemBasicProperties.push(itemProperty)\n }\n\n if (itemStorageTransactionProperty && itemStorageProperties.length > 0) {\n itemStorageTransactionProperty.childProperties = itemStorageProperties\n }\n\n if (itemStorageTransactionProperty) {\n itemUploadProperties.push(itemStorageTransactionProperty)\n }\n\n return {\n itemBasicProperties,\n itemRelationProperties,\n itemListProperties,\n itemUploadProperties,\n itemImageProperties,\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAUA,MAAM,eAAe,GAAG,CACtB,MAA0B,EAC1B,QAAyC,KAC7B,iBAAiB,CAAC,MAAM,CAAC,KAAK,QAAQ;AACpD,eAAe,kBAAkB,CAC/B,SAAiB,EACjB,YAAoB,EAAA;IAEpB,IAAI,MAAM,GAAG,MAAM,iBAAiB,CAAC,SAAS,EAAE,YAAY,CAAC;AAC7D,IAAA,IAAI,MAAM;AAAE,QAAA,OAAO,MAAM;AACzB,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE;AAC5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B,CAAC,IAAI,CAAC,YAAY,CAAC;YAC3C;YACA;QACF;QAEA,IAAI,eAAe,CAAC,WAAW,CAAC,QAAQ,EAAE,sBAAsB,CAAC,QAAQ,CAAC,EAAE;AAC1E,YAAA,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC;YACzC;QACF;QAEA,IAAI,eAAe,CAAC,WAAW,CAAC,QAAQ,EAAE,sBAAsB,CAAC,IAAI,CAAC,EAAE;;;YAGtE,MAAM,OAAO,GACX,WAAW,CAAC,GAAG,IAAK,WAAyC,CAAC,YAAY;YAC5E,IAAI,OAAO,EAAE;AACX,gBAAA,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC;YACvC;iBAAO;AACL,gBAAA,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;YACxC;YACA;QACF;QAEA,IAAI,aAAa,EAAE;AACjB,YAAA,qBAAqB,CAAC,IAAI,CAAC,YAAY,CAAC;YACxC;QACF;QAEA,IAAI,oBAAoB,EAAE;YACxB,8BAA8B,GAAG,EAAE,YAAY,EAAE,eAAe,EAAE,EAAE,EAAE;YACtE;QACF;AAEA,QAAA,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;IACxC;IAEA,IAAI,8BAA8B,IAAI,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE;AACtE,QAAA,8BAA8B,CAAC,eAAe,GAAG,qBAAqB;IACxE;IAEA,IAAI,8BAA8B,EAAE;AAClC,QAAA,oBAAoB,CAAC,IAAI,CAAC,8BAA8B,CAAC;IAC3D;IAEA,OAAO;QACL,mBAAmB;QACnB,sBAAsB;QACtB,kBAAkB;QAClB,oBAAoB;QACpB,mBAAmB;KACpB;AACH;;"}
1
+ {"version":3,"file":"getSegmentedItemProperties-BmKE71vU.js","sources":["../../src/helpers/getSegmentedItemProperties.ts"],"sourcesContent":["import { UploadProperty } from '@/db/read/getPublishUploads'\nimport { IItem } from '@/interfaces'\nimport { ModelPropertyDataTypes, normalizeDataType } from '@/Schema'\nimport { getPropertySchema, TProperty } from '@/helpers/property'\nimport type { Static } from '@sinclair/typebox'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { models, properties } from '@/seedSchema'\nimport { eq, and } from 'drizzle-orm'\nimport { camelCase, upperFirst } from 'lodash-es'\n\nconst matchesDataType = (\n actual: string | undefined,\n expected: ModelPropertyDataTypes | string,\n): boolean => normalizeDataType(actual) === expected\nasync function resolvePropertyDef(\n modelName: string,\n propertyName: string,\n): Promise<{ dataType?: string; ref?: string; refValueType?: string; storageType?: string; localStorageDir?: string; filenameSuffix?: string; required?: boolean } | undefined> {\n let schema = await getPropertySchema(modelName, propertyName)\n if (schema) return schema\n const db = BaseDb.getAppDb()\n if (!db) return undefined\n try {\n const normalizedModelName = upperFirst(camelCase(modelName))\n const modelRecords = await db\n .select({ id: models.id })\n .from(models)\n .where(eq(models.name, normalizedModelName))\n .limit(1)\n if (modelRecords.length === 0 || !modelRecords[0].id) return undefined\n const propertyRecords = await db\n .select()\n .from(properties)\n .where(\n and(\n eq(properties.modelId, modelRecords[0].id),\n eq(properties.name, propertyName),\n ),\n )\n .limit(1)\n if (propertyRecords.length === 0) return undefined\n const propRecord = propertyRecords[0]\n let refModelName: string | undefined\n if (propRecord.refModelId != null) {\n const refModelRows = await db\n .select({ name: models.name })\n .from(models)\n .where(eq(models.id, propRecord.refModelId))\n .limit(1)\n refModelName = refModelRows[0]?.name ?? undefined\n }\n return {\n dataType: propRecord.dataType,\n ref: refModelName ?? undefined,\n refValueType: propRecord.refValueType || undefined,\n storageType: propRecord.storageType || undefined,\n localStorageDir: propRecord.localStorageDir || undefined,\n filenameSuffix: propRecord.filenameSuffix || undefined,\n required: propRecord.required ?? undefined,\n }\n } catch {\n return undefined\n }\n}\n\nexport const getSegmentedItemProperties = async (item: IItem<any>) => {\n const itemBasicProperties = []\n const itemRelationProperties = []\n const itemListProperties = []\n const itemUploadProperties: UploadProperty[] = []\n const itemImageProperties = []\n const itemStorageProperties = []\n let itemStorageTransactionProperty: UploadProperty | undefined\n\n for (const itemProperty of item.properties) {\n let propertyDef = itemProperty.propertyDef\n // When propertyDef is missing (e.g. external app, Model not registered), resolve inline\n // so properties are not skipped and metadata attestations can be created\n if (!propertyDef && item.modelName) {\n const resolved = await resolvePropertyDef(item.modelName, itemProperty.propertyName)\n if (resolved) {\n itemProperty.getService().send({ type: 'updateContext', propertyRecordSchema: resolved })\n propertyDef = resolved as Static<typeof TProperty>\n } else {\n // Last resort: Model and DB don't have schema. Use Text so property routes to\n // itemBasicProperties and can be attested (covers title, description, etc.)\n const fallbackDef = { dataType: 'Text' as const }\n itemProperty.getService().send({ type: 'updateContext', propertyRecordSchema: fallbackDef })\n propertyDef = fallbackDef as Static<typeof TProperty>\n }\n }\n if (!propertyDef) {\n continue\n }\n\n const isItemStorage =\n propertyDef.storageType &&\n propertyDef.storageType === 'ItemStorage'\n\n\n const isStorageTransaction =\n itemProperty.propertyName === 'storageTransactionId' ||\n itemProperty.propertyName === 'storage_transaction_id'\n\n const isStorageSeedType =\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Image) ||\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.File) ||\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Html) ||\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Json) ||\n (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Relation) &&\n (matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.Image) ||\n matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.File) ||\n matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.Html) ||\n matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.Json)))\n\n if (isStorageSeedType) {\n itemImageProperties.push(itemProperty)\n if (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Relation)) {\n itemRelationProperties.push(itemProperty)\n }\n continue\n }\n\n if (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Relation)) {\n itemRelationProperties.push(itemProperty)\n continue\n }\n\n if (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.List)) {\n // List-of-relations: ref present, goes to processListProperty\n // List-of-primitives: ref absent, treat as basic property\n const listRef =\n propertyDef.ref || (propertyDef as { refModelName?: string }).refModelName\n if (listRef) {\n itemListProperties.push(itemProperty)\n } else {\n itemBasicProperties.push(itemProperty)\n }\n continue\n }\n\n if (isItemStorage) {\n itemStorageProperties.push(itemProperty)\n continue\n }\n\n if (isStorageTransaction) {\n itemStorageTransactionProperty = { itemProperty, childProperties: [] }\n continue\n }\n\n itemBasicProperties.push(itemProperty)\n }\n\n if (itemStorageTransactionProperty && itemStorageProperties.length > 0) {\n itemStorageTransactionProperty.childProperties = itemStorageProperties\n }\n\n if (itemStorageTransactionProperty) {\n itemUploadProperties.push(itemStorageTransactionProperty)\n }\n\n return {\n itemBasicProperties,\n itemRelationProperties,\n itemListProperties,\n itemUploadProperties,\n itemImageProperties,\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAUA,MAAM,eAAe,GAAG,CACtB,MAA0B,EAC1B,QAAyC,KAC7B,iBAAiB,CAAC,MAAM,CAAC,KAAK,QAAQ;AACpD,eAAe,kBAAkB,CAC/B,SAAiB,EACjB,YAAoB,EAAA;IAEpB,IAAI,MAAM,GAAG,MAAM,iBAAiB,CAAC,SAAS,EAAE,YAAY,CAAC;AAC7D,IAAA,IAAI,MAAM;AAAE,QAAA,OAAO,MAAM;AACzB,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE;AAC5B,IAAA,IAAI,CAAC,EAAE;AAAE,QAAA,OAAO,SAAS;AACzB,IAAA,IAAI;QACF,MAAM,mBAAmB,GAAG,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC5D,MAAM,YAAY,GAAG,MAAM;aACxB,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE;aACxB,IAAI,CAAC,MAAM;aACX,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC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,OAAO,GACX,WAAW,CAAC,GAAG,IAAK,WAAyC,CAAC,YAAY;YAC5E,IAAI,OAAO,EAAE;AACX,gBAAA,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC;YACvC;iBAAO;AACL,gBAAA,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;YACxC;YACA;QACF;QAEA,IAAI,aAAa,EAAE;AACjB,YAAA,qBAAqB,CAAC,IAAI,CAAC,YAAY,CAAC;YACxC;QACF;QAEA,IAAI,oBAAoB,EAAE;YACxB,8BAA8B,GAAG,EAAE,YAAY,EAAE,eAAe,EAAE,EAAE,EAAE;YACtE;QACF;AAEA,QAAA,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;IACxC;IAEA,IAAI,8BAA8B,IAAI,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE;AACtE,QAAA,8BAA8B,CAAC,eAAe,GAAG,qBAAqB;IACxE;IAEA,IAAI,8BAA8B,EAAE;AAClC,QAAA,oBAAoB,CAAC,IAAI,CAAC,8BAA8B,CAAC;IAC3D;IAEA,OAAO;QACL,mBAAmB;QACnB,sBAAsB;QACtB,kBAAkB;QAClB,oBAAoB;QACpB,mBAAmB;KACpB;AACH;;"}
@@ -1,181 +1,16 @@
1
1
  import debug from 'debug';
2
- import { a as BaseDb, b as metadata, B as BaseFileManager, c as appState, C as ImageSize } from './BasePathResolver-qV0apdVY.js';
3
- import { isEasAttestationExplorerUrl, BaseArweaveClient, ensureReadGatewaySelected } from '@seedprotocol/arweave';
2
+ import { a as BaseDb, b as metadata, B as BaseFileManager, c as appState, C as ImageSize } from './BasePathResolver-B6CKqoKw.js';
3
+ import { isEasAttestationExplorerUrl, BaseArweaveClient, ensureReadGatewaySelected, getArweaveReadBaseUrls } from '@seedprotocol/arweave';
4
4
  import { BaseQueryClient, BaseEasClient, GET_FILES_METADATA } from '@seedprotocol/eas';
5
5
  import { waitFor } from 'xstate';
6
6
  import 'pluralize';
7
- import { Type } from '@sinclair/typebox';
7
+ import { p as getAllAddressesFromDb } from './db-WbrzEf7c.js';
8
8
  import { and, eq, or, isNotNull } from 'drizzle-orm';
9
- import { a as getAllAddressesFromDb } from './db-CceyWksv.js';
10
9
  import 'nanoid';
11
10
  import 'nanoid-dictionary';
12
11
  import '@seedprotocol/query';
13
12
  import { throttle } from 'lodash-es';
14
13
 
15
- /** Default maximum length for Text properties when not explicitly set. Html holds arbitrary-length content and does not use this limit. */
16
- const DEFAULT_TEXT_MAX_LENGTH = 255;
17
- /**
18
- * TypeBox schema for ValidationRules
19
- */
20
- const TValidationRules = Type.Object({
21
- pattern: Type.Optional(Type.String()),
22
- minLength: Type.Optional(Type.Integer({ minimum: 0 })),
23
- maxLength: Type.Optional(Type.Integer({ minimum: 1 })),
24
- enum: Type.Optional(Type.Array(Type.Any())),
25
- custom: Type.Optional(Type.String()),
26
- }, { additionalProperties: true });
27
-
28
- /**
29
- * Enum for all property data types
30
- */
31
- var ModelPropertyDataTypes;
32
- (function (ModelPropertyDataTypes) {
33
- ModelPropertyDataTypes["Text"] = "Text";
34
- ModelPropertyDataTypes["Number"] = "Number";
35
- ModelPropertyDataTypes["List"] = "List";
36
- ModelPropertyDataTypes["Relation"] = "Relation";
37
- ModelPropertyDataTypes["Image"] = "Image";
38
- ModelPropertyDataTypes["Json"] = "Json";
39
- ModelPropertyDataTypes["File"] = "File";
40
- ModelPropertyDataTypes["Boolean"] = "Boolean";
41
- ModelPropertyDataTypes["Date"] = "Date";
42
- ModelPropertyDataTypes["Html"] = "Html";
43
- })(ModelPropertyDataTypes || (ModelPropertyDataTypes = {}));
44
- /** Known data types in lowercase for normalization */
45
- const DATA_TYPE_LOWER_MAP = {
46
- text: 'Text',
47
- string: 'Text', // JSON Schema convention
48
- number: 'Number',
49
- list: 'List',
50
- relation: 'Relation',
51
- image: 'Image',
52
- json: 'Json',
53
- file: 'File',
54
- boolean: 'Boolean',
55
- date: 'Date',
56
- html: 'Html',
57
- blob: 'Blob',
58
- };
59
- /**
60
- * Normalize dataType to canonical PascalCase form.
61
- * Accepts lowercase (e.g. 'text') or mixed case and returns 'Text'.
62
- * Use when ingesting dataType from JSON schema files.
63
- */
64
- function normalizeDataType(value) {
65
- if (!value || typeof value !== 'string')
66
- return value ?? '';
67
- const lower = value.toLowerCase().trim();
68
- return DATA_TYPE_LOWER_MAP[lower] ?? value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
69
- }
70
- const TPropertyDataType = Type.Union([
71
- Type.Literal(ModelPropertyDataTypes.Text),
72
- Type.Literal(ModelPropertyDataTypes.Number),
73
- Type.Literal(ModelPropertyDataTypes.List),
74
- Type.Literal(ModelPropertyDataTypes.Relation),
75
- Type.Literal(ModelPropertyDataTypes.Image),
76
- Type.Literal(ModelPropertyDataTypes.Json),
77
- Type.Literal(ModelPropertyDataTypes.File),
78
- Type.Literal(ModelPropertyDataTypes.Boolean),
79
- Type.Literal(ModelPropertyDataTypes.Date),
80
- Type.Literal(ModelPropertyDataTypes.Html),
81
- ]);
82
- const TStorageType = Type.Union([
83
- Type.Literal('ItemStorage'), // Looks for a storageTransactionId property on the item
84
- Type.Literal('PropertyStorage'), // Looks for a storageTransactionId value on the property
85
- ]);
86
- /** How publish handles `data:image/*` URIs inside Html storage. Only applies when `dataType === 'Html'`. */
87
- const THtmlEmbeddedDataUriPolicy = Type.Union([
88
- Type.Literal('materialize'),
89
- Type.Literal('preserve'),
90
- ]);
91
- const TProperty = Type.Object({
92
- id: Type.Optional(Type.String()), // schemaFileId (string) - public ID
93
- _dbId: Type.Optional(Type.Number()), // Database integer ID - internal only
94
- name: Type.Optional(Type.String()),
95
- dataType: TPropertyDataType,
96
- ref: Type.Optional(Type.String()),
97
- // modelId: string (modelFileId) in code; number only for DB foreign keys when resolved
98
- modelId: Type.Optional(Type.Union([Type.Number(), Type.String()])),
99
- modelName: Type.Optional(Type.String()),
100
- refModelId: Type.Optional(Type.Number()),
101
- refModelName: Type.Optional(Type.String()),
102
- refValueType: Type.Optional(TPropertyDataType),
103
- storageType: Type.Optional(TStorageType),
104
- localStorageDir: Type.Optional(Type.String()),
105
- filenameSuffix: Type.Optional(Type.String()),
106
- validation: Type.Optional(TValidationRules),
107
- required: Type.Optional(Type.Boolean()),
108
- /** When set on an Html property: `materialize` uploads embedded images as Image seeds and rewrites src; `preserve` leaves data URIs. */
109
- htmlEmbeddedDataUriPolicy: Type.Optional(THtmlEmbeddedDataUriPolicy),
110
- });
111
- const TPropertyConstructor = Type.Function([
112
- Type.Optional(Type.Union([Type.String(), TStorageType, Type.Undefined()])),
113
- Type.Optional(Type.Union([Type.String(), TPropertyDataType])),
114
- Type.Optional(Type.Union([Type.String(), Type.Boolean()])),
115
- ], TProperty);
116
- const TPropertyDefs = Type.Record(TPropertyDataType, TPropertyConstructor);
117
- function htmlPropertyFactory(opts) {
118
- return {
119
- dataType: ModelPropertyDataTypes.Html,
120
- ...(opts?.htmlEmbeddedDataUriPolicy
121
- ? { htmlEmbeddedDataUriPolicy: opts.htmlEmbeddedDataUriPolicy }
122
- : {}),
123
- };
124
- }
125
- const Property = {
126
- Text: (storageType, localStorageDir, filenameSuffix) => ({
127
- dataType: ModelPropertyDataTypes.Text,
128
- storageType,
129
- localStorageDir,
130
- filenameSuffix,
131
- TObject: Type.String(),
132
- }),
133
- Json: () => ({ dataType: ModelPropertyDataTypes.Json }),
134
- File: () => ({ dataType: ModelPropertyDataTypes.File }),
135
- Number: () => ({ dataType: ModelPropertyDataTypes.Number }),
136
- /**
137
- * Create a List property. refValueType is required; ref is required only for list of relations.
138
- * @param refValueType - Element type: 'Text', 'Number', 'Relation', etc.
139
- * @param ref - Model name when refValueType is 'Relation' (optional for primitives)
140
- * @example List('Text') - list of strings
141
- * @example List('Relation', 'Tag') - list of relations to Tag model
142
- */
143
- List: (refValueType, ref) => ({
144
- dataType: ModelPropertyDataTypes.List,
145
- ref,
146
- refValueType,
147
- }),
148
- Relation: (ref, refValueType, required) => ({
149
- dataType: ModelPropertyDataTypes.Relation,
150
- ref,
151
- refValueType,
152
- required,
153
- }),
154
- Image: () => ({ dataType: ModelPropertyDataTypes.Image }),
155
- Boolean: () => ({ dataType: ModelPropertyDataTypes.Boolean }),
156
- Date: () => ({ dataType: ModelPropertyDataTypes.Date }),
157
- Html: htmlPropertyFactory,
158
- /** `Html` opts are not representable in `TPropertyConstructor`; keep runtime shape via double assert. */
159
- };
160
- const PropertyMetadataKey = Symbol('property');
161
- const PropertyConstructor = (propertyType) => {
162
- return function (parentClassPrototype, propertyKey) {
163
- const existingProperties = Reflect.getMetadata(PropertyMetadataKey, parentClassPrototype) || [];
164
- existingProperties.push({ propertyKey, propertyType });
165
- Reflect.defineMetadata(PropertyMetadataKey, existingProperties, parentClassPrototype);
166
- };
167
- };
168
- const Text = (storageType, srcDir, filenameSuffix) => PropertyConstructor(Property.Text(storageType, srcDir, filenameSuffix));
169
- const Number$1 = () => PropertyConstructor(Property.Number());
170
- const Json = () => PropertyConstructor(Property.Json());
171
- const File = () => PropertyConstructor(Property.File());
172
- const Image = () => PropertyConstructor(Property.Image());
173
- const Relation = (ref, refValueType, required) => PropertyConstructor(Property.Relation(ref, refValueType, required)); // Adjust for actual relation type
174
- const List = (refValueType, ref) => PropertyConstructor(Property.List(refValueType, ref));
175
- const Boolean = () => PropertyConstructor(Property.Boolean());
176
- const Date$1 = () => PropertyConstructor(Property.Date());
177
- const Html = (opts) => PropertyConstructor(htmlPropertyFactory(opts));
178
-
179
14
  /** Same rules as getCorrectId in helpers/index (avoid barrel circular import). */
180
15
  function parseLocalIdOrUid(localIdOrUid) {
181
16
  const id = { localId: undefined, uid: undefined };
@@ -221,6 +56,27 @@ function resolveSeedIdsFromRefString(s) {
221
56
  }
222
57
  return {};
223
58
  }
59
+ /**
60
+ * True when a relation ref is an attested seed uid (0x…) rather than a local id. A uid only exists once
61
+ * the seed is on EAS, so publish can attest the uid as-is when no local copy exists (e.g. a server
62
+ * publishing on someone's behalf that only holds the uids it was given). Callers must not walk into it.
63
+ */
64
+ function isPublishedSeedRef(value) {
65
+ const ref = normalizeRelationPropertyValue(value);
66
+ if (!ref)
67
+ return false;
68
+ const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(ref);
69
+ return !!seedUid && !seedLocalId;
70
+ }
71
+ /**
72
+ * Storage seed local id (nanoid) or 0x uid. Stricter than resolveSeedIdsFromRefString, which accepts
73
+ * any 10-char string (so a 10-char html snippet like "<p>raw</p>" would pass as a local id).
74
+ */
75
+ const STORAGE_SEED_REF = /^(?:[A-Za-z0-9_-]{10,21}|0x[0-9a-fA-F]{64})$/;
76
+ /** True when a File/Image/Html value is already a storage seed reference rather than raw content. */
77
+ function isStorageSeedRef(value) {
78
+ return typeof value === 'string' && STORAGE_SEED_REF.test(value.trim());
79
+ }
224
80
 
225
81
  const seedUidToStorageTransactionId = new Map();
226
82
  const getStorageTransactionIdForSeedUid = async (seedUid) => {
@@ -621,8 +477,8 @@ const syncDbFiles = async (endpoints) => {
621
477
  const getAppDbReady = async () => {
622
478
  if (!BaseDb.isAppDbReady()) {
623
479
  // Wait for ClientManager to be ready (DB_INIT state or later)
624
- const _mod_0 = await import('./ClientManager-Y5EWQuJj.js');
625
- const _ns_0 = _mod_0.ai;
480
+ const _mod_0 = await import('./ClientManager-ChcmUL47.js');
481
+ const _ns_0 = _mod_0.ap;
626
482
  const clientManagerMod = _ns_0;
627
483
  const { getClient } = clientManagerMod;
628
484
  const clientManager = getClient();
@@ -809,10 +665,13 @@ const downloadTransactionIds = async (rawTransactionIds, options) => {
809
665
  if (transactionIdsToDownload.length === 0) {
810
666
  return false;
811
667
  }
668
+ // Preferred gateways first: a just-published item is only on the gateway it was uploaded through.
669
+ const arweaveBaseUrls = getArweaveReadBaseUrls();
812
670
  if (transactionIdsToDownload.length === 1) {
813
671
  await BaseFileManager.downloadFileByTransactionId({
814
672
  transactionId: transactionIdsToDownload[0],
815
673
  arweaveHost: BaseArweaveClient.getBaseUrl(),
674
+ arweaveBaseUrls,
816
675
  excludedTransactions,
817
676
  });
818
677
  }
@@ -820,6 +679,7 @@ const downloadTransactionIds = async (rawTransactionIds, options) => {
820
679
  await BaseFileManager.downloadAllFiles({
821
680
  transactionIds: transactionIdsToDownload,
822
681
  arweaveHost: BaseArweaveClient.getBaseUrl(),
682
+ arweaveBaseUrls,
823
683
  excludedTransactions,
824
684
  });
825
685
  }
@@ -1258,90 +1118,5 @@ const getArweaveUrlForTransaction = (storageTransactionId) => {
1258
1118
  return BaseArweaveClient.getRawUrl(storageTransactionId);
1259
1119
  };
1260
1120
 
1261
- const ENV = (typeof process !== 'undefined' && process.env)
1262
- ? process.env
1263
- : (typeof window !== 'undefined' && window.env)
1264
- ? window.env
1265
- : {};
1266
- var MachineIds;
1267
- (function (MachineIds) {
1268
- MachineIds["CLIENT_MANAGER"] = "@seedSdk/clientManager";
1269
- MachineIds["EAS_SYNC_MANAGER"] = "@seedSdk/easSyncManager";
1270
- MachineIds["GLOBAL"] = "@seedSdk/global";
1271
- MachineIds["INTERNAL"] = "@seedSdk/internal";
1272
- MachineIds["EAS"] = "@seedSdk/eas";
1273
- MachineIds["ITEM"] = "@seedSdk/item";
1274
- MachineIds["ALL_ITEMS"] = "@seedSdk/allItems";
1275
- MachineIds["MODEL"] = "@seedSdk/model";
1276
- MachineIds["FILE_SYSTEM"] = "@seedSdk/fileSystem";
1277
- })(MachineIds || (MachineIds = {}));
1278
- const { INTERNAL, GLOBAL, EAS, MODEL } = MachineIds;
1279
- var ClientManagerState;
1280
- (function (ClientManagerState) {
1281
- ClientManagerState["UNINITIALIZED"] = "uninitialized";
1282
- ClientManagerState["PLATFORM_CLASSES_INIT"] = "platformClassesInit";
1283
- ClientManagerState["FILE_SYSTEM_INIT"] = "fileSystemInit";
1284
- ClientManagerState["DB_INIT"] = "dbInit";
1285
- ClientManagerState["SAVE_CONFIG"] = "saveConfig";
1286
- ClientManagerState["ADD_MODELS_TO_STORE"] = "addModelsToStore";
1287
- ClientManagerState["ADD_MODELS_TO_DB"] = "addModelsToDb";
1288
- ClientManagerState["PROCESS_SCHEMA_FILES"] = "processSchemaFiles";
1289
- ClientManagerState["IDLE"] = "idle";
1290
- ClientManagerState["INIT_FAILED"] = "initFailed";
1291
- })(ClientManagerState || (ClientManagerState = {}));
1292
- var ClientManagerEvents;
1293
- (function (ClientManagerEvents) {
1294
- ClientManagerEvents["UPDATE_CONTEXT"] = "updateContext";
1295
- ClientManagerEvents["PLATFORM_CLASSES_READY"] = "platformClassesReady";
1296
- ClientManagerEvents["FILE_SYSTEM_READY"] = "fileSystemReady";
1297
- ClientManagerEvents["DB_READY"] = "dbReady";
1298
- ClientManagerEvents["SAVE_CONFIG_SUCCESS"] = "saveConfigSuccess";
1299
- ClientManagerEvents["SAVE_APP_STATE_SUCCESS"] = "saveAppStateSuccess";
1300
- ClientManagerEvents["SAVE_APP_STATE_ERROR"] = "saveAppStateError";
1301
- ClientManagerEvents["SET_ADDRESSES"] = "setAddresses";
1302
- ClientManagerEvents["ADD_MODELS_TO_STORE_SUCCESS"] = "addModelsToStoreSuccess";
1303
- ClientManagerEvents["ADD_MODELS_TO_DB_SUCCESS"] = "addModelsToDbSuccess";
1304
- ClientManagerEvents["PROCESS_SCHEMA_FILES_SUCCESS"] = "processSchemaFilesSuccess";
1305
- })(ClientManagerEvents || (ClientManagerEvents = {}));
1306
- var GlobalState;
1307
- (function (GlobalState) {
1308
- GlobalState["UNINITIALIZED"] = "uninitialized";
1309
- GlobalState["INITIALIZING"] = "initializing";
1310
- GlobalState["INITIALIZED"] = "initialized";
1311
- GlobalState["PUBLISHING_ITEM"] = "publishingItem";
1312
- GlobalState["ADDING_MODELS_TO_DB"] = "addingModelsToDb";
1313
- })(GlobalState || (GlobalState = {}));
1314
- const { UNINITIALIZED: GLOBAL_UNINITIALIZED, INITIALIZING, INITIALIZED, PUBLISHING_ITEM, ADDING_MODELS_TO_DB, } = GlobalState;
1315
- var InternalState;
1316
- (function (InternalState) {
1317
- InternalState["IDLE"] = "idle";
1318
- InternalState["INITIALIZING"] = "initializing";
1319
- InternalState["VALIDATING_INPUT"] = "validatingInput";
1320
- InternalState["CONFIGURING_FS"] = "configuringFs";
1321
- InternalState["LOADING_SEED_DB"] = "loadingSeedDb";
1322
- InternalState["SAVING_CONFIG"] = "savingConfig";
1323
- InternalState["LOADING_APP_DB"] = "loadingAppDb";
1324
- InternalState["LOADING_SDK_DB"] = "loadingSdkDb";
1325
- })(InternalState || (InternalState = {}));
1326
- const { VALIDATING_INPUT, CONFIGURING_FS, LOADING_SEED_DB, LOADING_APP_DB } = InternalState;
1327
- var PublishMachineStates;
1328
- (function (PublishMachineStates) {
1329
- PublishMachineStates["VALIDATING_ITEM_DATA"] = "validatingItemData";
1330
- PublishMachineStates["CREATING_PUBLISH_ATTEMPT"] = "creatingPublishAttempt";
1331
- PublishMachineStates["UPLOADING"] = "uploading";
1332
- PublishMachineStates["PREPARING_PUBLISH_REQUEST_DATA"] = "preparingPublishRequestData";
1333
- PublishMachineStates["PUBLISHING"] = "publishing";
1334
- PublishMachineStates["IDLE"] = "idle";
1335
- })(PublishMachineStates || (PublishMachineStates = {}));
1336
- const EAS_ENDPOINT = ENV.NEXT_PUBLIC_EAS_ENDPOINT ||
1337
- ENV.EAS_ENDPOINT ||
1338
- 'https://optimism-sepolia.easscan.org/graphql';
1339
- /**
1340
- * @deprecated Use BaseArweaveClient.getHost() instead.
1341
- * This constant is kept for backward compatibility but will be removed in a future version.
1342
- * Migration: import { BaseArweaveClient } from '@/helpers' and use BaseArweaveClient.getHost()
1343
- */
1344
- ENV.NEXT_PUBLIC_ARWEAVE_HOST || 'ar.seedprotocol.io';
1345
-
1346
- export { getStorageTransactionIdForSeedUid as A, Boolean as B, ClientManagerState as C, DEFAULT_TEXT_MAX_LENGTH as D, EAS_ENDPOINT as E, File as F, convertTxIdToImage as G, Html as H, Image as I, Json as J, downloadTransactionIdWithDedupe as K, List as L, ModelPropertyDataTypes as M, Number$1 as N, getDataTypeFromString as O, Property as P, getMimeType as Q, Relation as R, isBrowser as S, THtmlEmbeddedDataUriPolicy as T, isNode as U, downloadAllFilesRequestHandler as V, downloadAllFilesBinaryRequestHandler as W, ClientManagerEvents as X, download as Y, Date$1 as a, PropertyConstructor as b, PropertyMetadataKey as c, TProperty as d, TPropertyConstructor as e, TPropertyDataType as f, TPropertyDefs as g, TStorageType as h, TValidationRules as i, Text as j, normalizeRelationPropertyValue as k, getCorrectId as l, eventEmitter as m, normalizeDataType as n, getArweaveUrlForTransaction as o, MachineIds as p, classifyMediaRef as q, resolveSeedIdsFromRefString as r, scheduleBulkFilesDownloadFromEasSync as s, toSnakeCase as t, closestImageSize as u, ensureImageLocal as v, getFeedItemStringField as w, normalizeArweaveTxIdForEnsure as x, normalizeFeedItemFields as y, resolveMediaRef as z };
1347
- //# sourceMappingURL=constants-DSqHBPNe.js.map
1121
+ export { isStorageSeedRef as a, getArweaveUrlForTransaction as b, classifyMediaRef as c, closestImageSize as d, eventEmitter as e, ensureImageLocal as f, getCorrectId as g, getFeedItemStringField as h, isPublishedSeedRef as i, normalizeArweaveTxIdForEnsure as j, normalizeFeedItemFields as k, resolveMediaRef as l, getStorageTransactionIdForSeedUid as m, normalizeRelationPropertyValue as n, convertTxIdToImage as o, downloadTransactionIdWithDedupe as p, getDataTypeFromString as q, resolveSeedIdsFromRefString as r, scheduleBulkFilesDownloadFromEasSync as s, toSnakeCase as t, getMimeType as u, isNode as v, isBrowser as w, downloadAllFilesRequestHandler as x, downloadAllFilesBinaryRequestHandler as y, download as z };
1122
+ //# sourceMappingURL=index-280bL-n4.js.map