@seedprotocol/sdk 0.7.0 → 0.7.2-next.593.gd5bd4ea

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 (160) hide show
  1. package/dist/{BasePathResolver-ndE8XTpw.js → BasePathResolver-BdxCSIzn.js} +2 -2
  2. package/dist/{BasePathResolver-ndE8XTpw.js.map → BasePathResolver-BdxCSIzn.js.map} +1 -1
  3. package/dist/{ClientManager-DLleL_2e.js → ClientManager-ClCwwhwo.js} +28 -23
  4. package/dist/ClientManager-ClCwwhwo.js.map +1 -0
  5. package/dist/{Item-zBFWQDU9.js → Item-B9Y4VuK1.js} +140 -74
  6. package/dist/Item-B9Y4VuK1.js.map +1 -0
  7. package/dist/{ModelProperty-lth9L37R.js → ModelProperty-BMePcicQ.js} +64 -36
  8. package/dist/ModelProperty-BMePcicQ.js.map +1 -0
  9. package/dist/{Schema-DOhlrQ-N.js → Schema-COsEXXaR.js} +106 -58
  10. package/dist/Schema-COsEXXaR.js.map +1 -0
  11. package/dist/{SchemaValidationService-DDKr5piy.js → SchemaValidationService-DabGMzSE.js} +7 -8
  12. package/dist/{SchemaValidationService-DDKr5piy.js.map → SchemaValidationService-DabGMzSE.js.map} +1 -1
  13. package/dist/{backfillMetadataPropertyIds-fG3ujaSh.js → backfillMetadataPropertyIds-Ck6fumnm.js} +4 -4
  14. package/dist/{backfillMetadataPropertyIds-fG3ujaSh.js.map → backfillMetadataPropertyIds-Ck6fumnm.js.map} +1 -1
  15. package/dist/cjs/{ModelProperty-BEsIHAjk.js → ModelProperty-BT6Un_MB.js} +59 -30
  16. package/dist/cjs/ModelProperty-BT6Un_MB.js.map +1 -0
  17. package/dist/cjs/{Schema-qEp5mH1N.js → Schema-BXhXdUsA.js} +93 -44
  18. package/dist/cjs/Schema-BXhXdUsA.js.map +1 -0
  19. package/dist/cjs/{SchemaValidationService-CWEnZmOH.js → SchemaValidationService-CC18QDfc.js} +2 -2
  20. package/dist/cjs/{SchemaValidationService-CWEnZmOH.js.map → SchemaValidationService-CC18QDfc.js.map} +1 -1
  21. package/dist/cjs/{backfillMetadataPropertyIds-tw8JGMT0.js → backfillMetadataPropertyIds-DEHC9ejq.js} +3 -3
  22. package/dist/cjs/{backfillMetadataPropertyIds-tw8JGMT0.js.map → backfillMetadataPropertyIds-DEHC9ejq.js.map} +1 -1
  23. package/dist/cjs/{eas-CLiV2Hmn.js → eas-C3CL0l7l.js} +3 -3
  24. package/dist/cjs/{eas-CLiV2Hmn.js.map → eas-C3CL0l7l.js.map} +1 -1
  25. package/dist/cjs/{getItem-DSRtx_68.js → getItem-CrwWYCkj.js} +2 -2
  26. package/dist/cjs/{getItem-DSRtx_68.js.map → getItem-CrwWYCkj.js.map} +1 -1
  27. package/dist/cjs/{getPublishPayload-D5-dYtNq.js → getPublishPayload-DRJh7WR0.js} +171 -209
  28. package/dist/cjs/getPublishPayload-DRJh7WR0.js.map +1 -0
  29. package/dist/cjs/{getPublishUploads-B5Lq6q-_.js → getPublishUploads-Bh22D3zJ.js} +49 -10
  30. package/dist/cjs/getPublishUploads-Bh22D3zJ.js.map +1 -0
  31. package/dist/cjs/{index-B3UDbm1C.js → index-BA1RIYFG.js} +3 -3
  32. package/dist/cjs/index-BA1RIYFG.js.map +1 -0
  33. package/dist/cjs/{index-C66AfYDG.js → index-Dls7aMjr.js} +281 -90
  34. package/dist/cjs/index-Dls7aMjr.js.map +1 -0
  35. package/dist/cjs/{property-BVJIP7SX.js → property-ZerTWizX.js} +5 -5
  36. package/dist/cjs/{property-BVJIP7SX.js.map → property-ZerTWizX.js.map} +1 -1
  37. package/dist/cjs/publishDraftGraph-CPOAcQFf.js +403 -0
  38. package/dist/cjs/publishDraftGraph-CPOAcQFf.js.map +1 -0
  39. package/dist/cjs/{resetAmbiguousLegacyItemData-BaZqUui9.js → resetAmbiguousLegacyItemData-adDl4LcT.js} +2 -2
  40. package/dist/cjs/{resetAmbiguousLegacyItemData-BaZqUui9.js.map → resetAmbiguousLegacyItemData-adDl4LcT.js.map} +1 -1
  41. package/dist/cjs/{resolveModelForSyncedSeed-CC6dQctx.js → resolveModelForSyncedSeed-DoNThPdL.js} +2 -2
  42. package/dist/cjs/{resolveModelForSyncedSeed-CC6dQctx.js.map → resolveModelForSyncedSeed-DoNThPdL.js.map} +1 -1
  43. package/dist/cjs/{syncDbWithEas-Dk96sAG-.js → syncDbWithEas-CYfPkus9.js} +20 -7
  44. package/dist/cjs/{syncDbWithEas-Dk96sAG-.js.map → syncDbWithEas-CYfPkus9.js.map} +1 -1
  45. package/dist/{configurePlatform-BMoPG9vY.js → configurePlatform-xU3Hsno3.js} +4 -4
  46. package/dist/{configurePlatform-BMoPG9vY.js.map → configurePlatform-xU3Hsno3.js.map} +1 -1
  47. package/dist/{db-BJZN0a0a.js → db-W1g29qsM.js} +31 -27
  48. package/dist/{db-BJZN0a0a.js.map → db-W1g29qsM.js.map} +1 -1
  49. package/dist/{eas-B0hsMLqt.js → eas-CSwV6MvB.js} +6 -6
  50. package/dist/{eas-B0hsMLqt.js.map → eas-CSwV6MvB.js.map} +1 -1
  51. package/dist/{getItem-DEh4WfHG.js → getItem-BYQeM3DY.js} +5 -6
  52. package/dist/{getItem-DEh4WfHG.js.map → getItem-BYQeM3DY.js.map} +1 -1
  53. package/dist/{getPublishPayload-H032DHC7.js → getPublishPayload-D5CQZd-y.js} +167 -206
  54. package/dist/getPublishPayload-D5CQZd-y.js.map +1 -0
  55. package/dist/{getPublishUploads-CR66RlGJ.js → getPublishUploads-BGpDsrBp.js} +52 -14
  56. package/dist/getPublishUploads-BGpDsrBp.js.map +1 -0
  57. package/dist/{index-6bJuv5Tt.js → index-Bev-hZF-.js} +9 -10
  58. package/dist/index-Bev-hZF-.js.map +1 -0
  59. package/dist/{index-B0LgJblD.js → index-CSOQFAOn.js} +2 -2
  60. package/dist/index-CSOQFAOn.js.map +1 -0
  61. package/dist/{index-DtfjeuxC.js → index-DRXC5Mra.js} +167 -75
  62. package/dist/index-DRXC5Mra.js.map +1 -0
  63. package/dist/{index.browser-CNrqhvEA.js → index.browser-DO20vYuP.js} +9 -9
  64. package/dist/{index.browser-CNrqhvEA.js.map → index.browser-DO20vYuP.js.map} +1 -1
  65. package/dist/{index.node-DrHiTuOr.js → index.node-C4iyOhdo.js} +5 -5
  66. package/dist/{index.node-DrHiTuOr.js.map → index.node-C4iyOhdo.js.map} +1 -1
  67. package/dist/main.cjs +1 -1
  68. package/dist/main.js +258 -183
  69. package/dist/main.js.map +1 -1
  70. package/dist/node.js +14 -15
  71. package/dist/node.js.map +1 -1
  72. package/dist/platform.browser.js +5 -5
  73. package/dist/platform.node.js +3 -3
  74. package/dist/{property-D2Nnsmm1.js → property-BT1zDSkd.js} +10 -11
  75. package/dist/property-BT1zDSkd.js.map +1 -0
  76. package/dist/publishDraftGraph-Bcfrdj7-.js +405 -0
  77. package/dist/publishDraftGraph-Bcfrdj7-.js.map +1 -0
  78. package/dist/{resetAmbiguousLegacyItemData-BqbHNUYk.js → resetAmbiguousLegacyItemData-Ci6PM_vC.js} +2 -2
  79. package/dist/{resetAmbiguousLegacyItemData-BqbHNUYk.js.map → resetAmbiguousLegacyItemData-Ci6PM_vC.js.map} +1 -1
  80. package/dist/{resolveModelForSyncedSeed-DQK6JfXS.js → resolveModelForSyncedSeed-CLlumTBq.js} +2 -2
  81. package/dist/{resolveModelForSyncedSeed-DQK6JfXS.js.map → resolveModelForSyncedSeed-CLlumTBq.js.map} +1 -1
  82. package/dist/src/Item/Item.d.ts +11 -0
  83. package/dist/src/Item/Item.d.ts.map +1 -1
  84. package/dist/src/ItemProperty/ItemProperty.d.ts +10 -0
  85. package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
  86. package/dist/src/Model/Model.d.ts +15 -2
  87. package/dist/src/Model/Model.d.ts.map +1 -1
  88. package/dist/src/Model/service/actors/createModelProperties.d.ts.map +1 -1
  89. package/dist/src/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
  90. package/dist/src/Model/service/actors/validateModel.d.ts.map +1 -1
  91. package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
  92. package/dist/src/ModelProperty/ModelProperty.d.ts +9 -1
  93. package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
  94. package/dist/src/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
  95. package/dist/src/ModelProperty/service/actors/saveToSchema.d.ts.map +1 -1
  96. package/dist/src/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
  97. package/dist/src/Schema/Schema.d.ts +7 -0
  98. package/dist/src/Schema/Schema.d.ts.map +1 -1
  99. package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +1 -1
  100. package/dist/src/Schema/service/actors/createModelInstances.d.ts.map +1 -1
  101. package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
  102. package/dist/src/db/read/getPublishPayload.d.ts +9 -0
  103. package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
  104. package/dist/src/db/read/getPublishUploads.d.ts +5 -0
  105. package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
  106. package/dist/src/db/read/publishDraftGraph.d.ts +57 -0
  107. package/dist/src/db/read/publishDraftGraph.d.ts.map +1 -0
  108. package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
  109. package/dist/src/helpers/entity/entityLiveQuery.d.ts.map +1 -1
  110. package/dist/src/helpers/entity/evictionEpoch.d.ts +18 -0
  111. package/dist/src/helpers/entity/evictionEpoch.d.ts.map +1 -0
  112. package/dist/src/helpers/generateId.d.ts +4 -0
  113. package/dist/src/helpers/generateId.d.ts.map +1 -1
  114. package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts +28 -6
  115. package/dist/src/helpers/htmlEmbeddedDataUriPublish.d.ts.map +1 -1
  116. package/dist/src/index.d.ts +2 -1
  117. package/dist/src/index.d.ts.map +1 -1
  118. package/dist/src/query/createLocalQueryDataSource.d.ts.map +1 -1
  119. package/dist/src/services/write/actors/validateEntity.d.ts.map +1 -1
  120. package/dist/src/types/item.d.ts +7 -8
  121. package/dist/src/types/item.d.ts.map +1 -1
  122. package/dist/{syncDbWithEas-LRKr_NZF.js → syncDbWithEas-BQsXjGhe.js} +15 -16
  123. package/dist/syncDbWithEas-BQsXjGhe.js.map +1 -0
  124. package/dist/{tabEvents-DYI2GU7i.js → tabEvents-C9qUKx_z.js} +28 -11
  125. package/dist/tabEvents-C9qUKx_z.js.map +1 -0
  126. package/dist/{tolerantWebAccess-CzOBz5M6.js → tolerantWebAccess-B-9bwxbw.js} +6 -6
  127. package/dist/{tolerantWebAccess-CzOBz5M6.js.map → tolerantWebAccess-B-9bwxbw.js.map} +1 -1
  128. package/dist/{updateSeedRevokedAt-B58ORbY3.js → updateSeedRevokedAt-D6q0h7pj.js} +3 -3
  129. package/dist/{updateSeedRevokedAt-B58ORbY3.js.map → updateSeedRevokedAt-D6q0h7pj.js.map} +1 -1
  130. package/package.json +13 -10
  131. package/dist/ClientManager-DLleL_2e.js.map +0 -1
  132. package/dist/Item-zBFWQDU9.js.map +0 -1
  133. package/dist/ModelProperty-lth9L37R.js.map +0 -1
  134. package/dist/Schema-DOhlrQ-N.js.map +0 -1
  135. package/dist/cjs/ModelProperty-BEsIHAjk.js.map +0 -1
  136. package/dist/cjs/Schema-qEp5mH1N.js.map +0 -1
  137. package/dist/cjs/getLatestVersionRow-DVizNNoI.js +0 -59
  138. package/dist/cjs/getLatestVersionRow-DVizNNoI.js.map +0 -1
  139. package/dist/cjs/getPublishPayload-D5-dYtNq.js.map +0 -1
  140. package/dist/cjs/getPublishUploads-B5Lq6q-_.js.map +0 -1
  141. package/dist/cjs/getSegmentedItemProperties-giHO7R3d.js +0 -147
  142. package/dist/cjs/getSegmentedItemProperties-giHO7R3d.js.map +0 -1
  143. package/dist/cjs/index-B3UDbm1C.js.map +0 -1
  144. package/dist/cjs/index-C66AfYDG.js.map +0 -1
  145. package/dist/generateId-BopUwD8F.js +0 -9
  146. package/dist/generateId-BopUwD8F.js.map +0 -1
  147. package/dist/getLatestVersionRow-Brrl1AnW.js +0 -46
  148. package/dist/getLatestVersionRow-Brrl1AnW.js.map +0 -1
  149. package/dist/getPublishPayload-H032DHC7.js.map +0 -1
  150. package/dist/getPublishUploads-CR66RlGJ.js.map +0 -1
  151. package/dist/getSegmentedItemProperties-C2EJ2G0N.js +0 -147
  152. package/dist/getSegmentedItemProperties-C2EJ2G0N.js.map +0 -1
  153. package/dist/index-6bJuv5Tt.js.map +0 -1
  154. package/dist/index-B0LgJblD.js.map +0 -1
  155. package/dist/index-DtfjeuxC.js.map +0 -1
  156. package/dist/property-D2Nnsmm1.js.map +0 -1
  157. package/dist/src/browser/helpers/index.d.ts +0 -4
  158. package/dist/src/browser/helpers/index.d.ts.map +0 -1
  159. package/dist/syncDbWithEas-LRKr_NZF.js.map +0 -1
  160. package/dist/tabEvents-DYI2GU7i.js.map +0 -1
@@ -1,13 +1,13 @@
1
- import { r as resolveSeedIdsFromRefString, n as normalizeRelationPropertyValue, i as isPublishedSeedRef } from './tabEvents-DYI2GU7i.js';
1
+ import { r as resolveSeedIdsFromRefString, n as normalizeRelationPropertyValue, i as isPublishedSeedRef } from './tabEvents-C9qUKx_z.js';
2
2
  import { BaseArweaveClient } from '@seedprotocol/arweave';
3
- import { g as getSegmentedItemProperties } from './getSegmentedItemProperties-C2EJ2G0N.js';
3
+ import { g as getPublishDraftGraph, a as getSegmentedItemProperties } from './publishDraftGraph-Bcfrdj7-.js';
4
4
  import debug from 'debug';
5
- import { g as getContentHash } from './ClientManager-DLleL_2e.js';
6
- import { I as Item } from './Item-zBFWQDU9.js';
7
- import { a as BaseFileManager, B as BaseDb, h as htmlEmbeddedImageCoPublish } from './BasePathResolver-ndE8XTpw.js';
5
+ import { g as getContentHash } from './ClientManager-ClCwwhwo.js';
6
+ import { I as Item } from './Item-B9Y4VuK1.js';
7
+ import { B as BaseFileManager, a as BaseDb, h as htmlEmbeddedImageCoPublish } from './BasePathResolver-BdxCSIzn.js';
8
8
  import { eq } from 'drizzle-orm';
9
9
  import 'pluralize';
10
- import { k as isDataType, M as ModelPropertyDataTypes, n as normalizeDataType } from './db-BJZN0a0a.js';
10
+ import { k as isDataType, M as ModelPropertyDataTypes, n as normalizeDataType } from './db-W1g29qsM.js';
11
11
  import '@seedprotocol/eas';
12
12
  import 'xstate';
13
13
  import 'nanoid';
@@ -15,12 +15,11 @@ import 'nanoid-dictionary';
15
15
  import '@seedprotocol/query';
16
16
  import 'lodash-es';
17
17
  import 'reflect-metadata';
18
- import './index-DtfjeuxC.js';
19
- import './generateId-BopUwD8F.js';
18
+ import './index-DRXC5Mra.js';
20
19
  import './model-DGMe-TTm.js';
21
20
  import 'drizzle-orm/casing';
22
21
  import '@sinclair/typebox';
23
- import './property-D2Nnsmm1.js';
22
+ import './property-BT1zDSkd.js';
24
23
  import '@noble/hashes/sha3';
25
24
  import '@noble/hashes/utils';
26
25
  import 'rxjs';
@@ -255,7 +254,7 @@ async function uploadPropertyWouldUpload(uploadProperty, relatedItemProperty) {
255
254
  }
256
255
  return false;
257
256
  }
258
- async function itemHasPublishUploadCandidates(item, relatedItemProperty) {
257
+ async function itemOwnUploadCandidates(item, relatedItemProperty, recurseStorageRelations) {
259
258
  const { itemUploadProperties, itemRelationProperties, itemImageProperties } = await getSegmentedItemProperties(item);
260
259
  for (const uploadProperty of itemUploadProperties) {
261
260
  if (await uploadPropertyWouldUpload(uploadProperty, relatedItemProperty)) {
@@ -265,7 +264,12 @@ async function itemHasPublishUploadCandidates(item, relatedItemProperty) {
265
264
  if (await storageSeedHasUploadCandidates(itemImageProperties)) {
266
265
  return true;
267
266
  }
267
+ if (!recurseStorageRelations)
268
+ return false;
269
+ const storageProperties = new Set(itemImageProperties);
268
270
  for (const relationProperty of itemRelationProperties) {
271
+ if (!storageProperties.has(relationProperty))
272
+ continue;
269
273
  const snapshot = relationProperty.getService().getSnapshot();
270
274
  const context = 'context' in snapshot ? snapshot.context : null;
271
275
  if (!context) {
@@ -289,12 +293,23 @@ async function itemHasPublishUploadCandidates(item, relatedItemProperty) {
289
293
  continue;
290
294
  throw new Error(`No relatedItem found for ${relationProperty.propertyName}`);
291
295
  }
292
- if (await itemHasPublishUploadCandidates(relatedItem, relationProperty)) {
296
+ if (await itemOwnUploadCandidates(relatedItem, relationProperty, false)) {
293
297
  return true;
294
298
  }
295
299
  }
296
300
  return false;
297
301
  }
302
+ /** Same walk as getPublishUploads: the item and the draft items its publish carries along. */
303
+ async function itemHasPublishUploadCandidates(item, relatedItemProperty) {
304
+ if (await itemOwnUploadCandidates(item, relatedItemProperty, true))
305
+ return true;
306
+ const { drafts } = await getPublishDraftGraph(item, { strict: true });
307
+ for (const { item: draft, via, viaList } of drafts) {
308
+ if (await itemOwnUploadCandidates(draft, viaList ? undefined : via, true))
309
+ return true;
310
+ }
311
+ return false;
312
+ }
298
313
  const processUploadProperty = async (uploadProperty, uploads, relatedItemProperty, options) => {
299
314
  const extra = options?.arweaveUploadTags;
300
315
  const itemProperty = uploadProperty.itemProperty;
@@ -390,7 +405,8 @@ const processUploadProperty = async (uploadProperty, uploads, relatedItemPropert
390
405
  };
391
406
  /** No seed uid yet: a related item in this state is published together with the item. */
392
407
  const isDraftItem = (item) => !item.seedUid || item.seedUid === '0x' + '0'.repeat(64);
393
- const getPublishUploads = async (item, uploads = [], relatedItemProperty, options) => {
408
+ /** One item's own uploads: its files, storage seeds, Html-embedded images, and the items its storage relations point at. */
409
+ const getItemOwnPublishUploads = async (item, uploads, relatedItemProperty, options) => {
394
410
  const { itemUploadProperties, itemRelationProperties, itemImageProperties } = await getSegmentedItemProperties(item);
395
411
  // Phase 2 of an embedded-image publish: only the deferred Html storage seeds, of this item and of
396
412
  // the related items published with it (whose Html can embed images too).
@@ -413,7 +429,11 @@ const getPublishUploads = async (item, uploads = [], relatedItemProperty, option
413
429
  if (options?.skipRelationRecursion) {
414
430
  return uploads;
415
431
  }
432
+ // Relations to Image/File/Html/Json items: their file, read through the relation property.
433
+ const storageProperties = new Set(itemImageProperties);
416
434
  for (const relationProperty of itemRelationProperties) {
435
+ if (!storageProperties.has(relationProperty))
436
+ continue;
417
437
  const snapshot = relationProperty.getService().getSnapshot();
418
438
  const context = 'context' in snapshot ? snapshot.context : null;
419
439
  if (!context) {
@@ -437,10 +457,28 @@ const getPublishUploads = async (item, uploads = [], relatedItemProperty, option
437
457
  continue;
438
458
  throw new Error(`No relatedItem found for ${relationProperty.propertyName}`);
439
459
  }
440
- uploads = await getPublishUploads(relatedItem, uploads, relationProperty, options);
460
+ uploads = await getItemOwnPublishUploads(relatedItem, uploads, relationProperty, {
461
+ ...options,
462
+ skipRelationRecursion: true,
463
+ });
464
+ }
465
+ return uploads;
466
+ };
467
+ /**
468
+ * Arweave uploads for a publish of `item`: its own, and those of every draft item the publish
469
+ * carries along (reachable through relation and list properties, see publishDraftGraph.ts).
470
+ */
471
+ const getPublishUploads = async (item, uploads = [], relatedItemProperty, options) => {
472
+ uploads = await getItemOwnPublishUploads(item, uploads, relatedItemProperty, options);
473
+ if (options?.skipRelationRecursion) {
474
+ return uploads;
475
+ }
476
+ const { drafts } = await getPublishDraftGraph(item, { strict: true });
477
+ for (const { item: draft, via, viaList } of drafts) {
478
+ uploads = await getItemOwnPublishUploads(draft, uploads, viaList ? undefined : via, options);
441
479
  }
442
480
  return uploads;
443
481
  };
444
482
 
445
483
  export { getPublishUploads, itemHasPublishUploadCandidates, prepareArweaveTransaction };
446
- //# sourceMappingURL=getPublishUploads-CR66RlGJ.js.map
484
+ //# sourceMappingURL=getPublishUploads-BGpDsrBp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPublishUploads-BGpDsrBp.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'\nimport { getPublishDraftGraph } from '@/db/read/publishDraftGraph'\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\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 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\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 getItemOwnPublishUploads = async (\n item: IItem<any>,\n uploads: PublishUpload[],\n relatedItemProperty: IItemProperty<any> | undefined,\n options: GetPublishUploadsOptions | undefined,\n) => {\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 getStorageSeedUploads(itemImageProperties, options)\n uploads.push(...storageSeedUploads)\n } else {\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 // 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 appendCoPublishedImageUploads(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 getItemOwnPublishUploads(relatedItem, uploads, relationProperty, {\n ...options,\n skipRelationRecursion: true,\n })\n }\n\n return uploads\n}\n\n/**\n * Arweave uploads for a publish of `item`: its own, and those of every draft item the publish\n * carries along (reachable through relation and list properties, see publishDraftGraph.ts).\n */\nexport const getPublishUploads = async (\n item: IItem<any>,\n uploads: PublishUpload[] = [],\n relatedItemProperty?: IItemProperty<any>,\n options?: GetPublishUploadsOptions,\n) => {\n uploads = await getItemOwnPublishUploads(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 getItemOwnPublishUploads(draft, uploads, viaList ? undefined : via, options)\n }\n\n return uploads\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,MAAM,GAAG,KAAK,CAAC,gCAAgC,CAAC;AAiBtD,MAAM,iBAAiB,GAA2B;AAChD,IAAA,GAAG,EAAE,WAAW;AAChB,IAAA,GAAG,EAAE,YAAY;AACjB,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,GAAG,EAAE,WAAW;AAChB,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,GAAG,EAAE,eAAe;AACpB,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,GAAG,EAAE,WAAW;AAChB,IAAA,IAAI,EAAE,kBAAkB;AACxB,IAAA,GAAG,EAAE,YAAY;CAClB;AAED,MAAM,mBAAmB,GAAG,CAAC,cAAsB,KAAwB;AACzE,IAAA,MAAM,GAAG,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE;AAC1D,IAAA,OAAO,GAAG,GAAG,iBAAiB,CAAC,GAAG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GG;AACI,MAAM,iBAAiB,GAAG,OAC/B,IAAgB,EAChB,OAAA,GAA2B,EAAE,EAC7B,mBAAwC,EACxC,OAAkC,KAChC;AACF,IAAA,OAAO,GAAG,MAAM,wBAAwB,CAAC,IAAI,EAAE,OAAO,EAAE,mBAAmB,EAAE,OAAO,CAAC;AAErF,IAAA,IAAI,OAAO,EAAE,qBAAqB,EAAE;AAClC,QAAA,OAAO,OAAO;IAChB;AAEA,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,oBAAoB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACrE,IAAA,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,MAAM,EAAE;QAClD,OAAO,GAAG,MAAM,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,GAAG,EAAE,OAAO,CAAC;IAC9F;AAEA,IAAA,OAAO,OAAO;AAChB;;"}
@@ -1,14 +1,14 @@
1
1
  import 'reflect-metadata';
2
- export { M as Model, T as TModelSchema, a as TModelValues } from './index-DtfjeuxC.js';
3
- import { M as ModelPropertyDataTypes } from './db-BJZN0a0a.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-BJZN0a0a.js';
5
- export { getPropertySchema } from './property-D2Nnsmm1.js';
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';
6
6
  import 'xstate';
7
- import './BasePathResolver-ndE8XTpw.js';
7
+ import './BasePathResolver-BdxCSIzn.js';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'drizzle-orm';
10
10
  import '@seedprotocol/arweave';
11
- import './tabEvents-DYI2GU7i.js';
11
+ import './tabEvents-C9qUKx_z.js';
12
12
  import 'debug';
13
13
  import '@seedprotocol/eas';
14
14
  import 'pluralize';
@@ -16,12 +16,11 @@ import 'nanoid';
16
16
  import 'nanoid-dictionary';
17
17
  import '@seedprotocol/query';
18
18
  import 'lodash-es';
19
- import './generateId-BopUwD8F.js';
20
- import './Item-zBFWQDU9.js';
19
+ import './Item-B9Y4VuK1.js';
21
20
  import 'rxjs';
22
21
  import 'drizzle-orm/casing';
23
22
  import './model-DGMe-TTm.js';
24
- import './ClientManager-DLleL_2e.js';
23
+ import './ClientManager-ClCwwhwo.js';
25
24
  import '@noble/hashes/sha3';
26
25
  import '@noble/hashes/utils';
27
26
  import '@sinclair/typebox';
@@ -29,4 +28,4 @@ import '@sinclair/typebox';
29
28
 
30
29
 
31
30
  export { ModelPropertyDataTypes };
32
- //# sourceMappingURL=index-6bJuv5Tt.js.map
31
+ //# sourceMappingURL=index-Bev-hZF-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Bev-hZF-.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { b as metadata, c as appState, d as arweaveL1FinalizeJobs, e as config, f as easSyncProcesses, h as htmlEmbeddedImageCoPublish, g as modelRelations, i as modelSchemas, j as modelUids, m 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-ndE8XTpw.js';
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';
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-B0LgJblD.js.map
28
+ //# sourceMappingURL=index-CSOQFAOn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CSOQFAOn.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}