@seedprotocol/sdk 0.7.2 → 0.7.3-next.654.g52217f6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BasePathResolver-BdxCSIzn.js → BasePathResolver-CfSfMW5_.js} +7 -10
- package/dist/BasePathResolver-CfSfMW5_.js.map +1 -0
- package/dist/{ClientManager-ClCwwhwo.js → ClientManager-C-QXqUK9.js} +438 -153
- package/dist/ClientManager-C-QXqUK9.js.map +1 -0
- package/dist/{Item-B9Y4VuK1.js → Item-C7sUUu2B.js} +291 -105
- package/dist/Item-C7sUUu2B.js.map +1 -0
- package/dist/{ModelProperty-BMePcicQ.js → ModelProperty-DJxeOOrc.js} +28 -27
- package/dist/ModelProperty-DJxeOOrc.js.map +1 -0
- package/dist/{Schema-COsEXXaR.js → Schema-fXtvd-yL.js} +30 -30
- package/dist/{Schema-COsEXXaR.js.map → Schema-fXtvd-yL.js.map} +1 -1
- package/dist/{SchemaValidationService-DabGMzSE.js → SchemaValidationService-CvRS2HSO.js} +10 -9
- package/dist/{SchemaValidationService-DabGMzSE.js.map → SchemaValidationService-CvRS2HSO.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-Ck6fumnm.js → backfillMetadataPropertyIds-SXW-8C64.js} +4 -4
- package/dist/{backfillMetadataPropertyIds-Ck6fumnm.js.map → backfillMetadataPropertyIds-SXW-8C64.js.map} +1 -1
- package/dist/cjs/{ModelProperty-BT6Un_MB.js → ModelProperty-DXZ39Wyv.js} +24 -23
- package/dist/cjs/{ModelProperty-BT6Un_MB.js.map → ModelProperty-DXZ39Wyv.js.map} +1 -1
- package/dist/cjs/{Schema-BXhXdUsA.js → Schema-DdP109QD.js} +26 -25
- package/dist/cjs/{Schema-BXhXdUsA.js.map → Schema-DdP109QD.js.map} +1 -1
- package/dist/cjs/{SchemaValidationService-CC18QDfc.js → SchemaValidationService-CSXxx7sQ.js} +5 -4
- package/dist/cjs/{SchemaValidationService-CC18QDfc.js.map → SchemaValidationService-CSXxx7sQ.js.map} +1 -1
- package/dist/cjs/{backfillMetadataPropertyIds-DEHC9ejq.js → backfillMetadataPropertyIds-CPYoaMl4.js} +6 -5
- package/dist/cjs/{backfillMetadataPropertyIds-DEHC9ejq.js.map → backfillMetadataPropertyIds-CPYoaMl4.js.map} +1 -1
- package/dist/cjs/{eas-C3CL0l7l.js → eas-B2YDQssV.js} +6 -5
- package/dist/cjs/{eas-C3CL0l7l.js.map → eas-B2YDQssV.js.map} +1 -1
- package/dist/cjs/{getItem-CrwWYCkj.js → getItem-DgnaQzbE.js} +5 -4
- package/dist/cjs/{getItem-CrwWYCkj.js.map → getItem-DgnaQzbE.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-DRJh7WR0.js → getPublishPayload-CqlqRdot.js} +12 -11
- package/dist/cjs/{getPublishPayload-DRJh7WR0.js.map → getPublishPayload-CqlqRdot.js.map} +1 -1
- package/dist/cjs/getPublishUploads-DsXY9S4U.js +872 -0
- package/dist/cjs/getPublishUploads-DsXY9S4U.js.map +1 -0
- package/dist/cjs/{index-BA1RIYFG.js → index-BHaWOwNF.js} +6 -5
- package/dist/cjs/index-BHaWOwNF.js.map +1 -0
- package/dist/cjs/{index-Dls7aMjr.js → index-C4XlgCJ4.js} +1200 -528
- package/dist/cjs/index-C4XlgCJ4.js.map +1 -0
- package/dist/cjs/{property-ZerTWizX.js → property-fa0iju0J.js} +8 -7
- package/dist/cjs/{property-ZerTWizX.js.map → property-fa0iju0J.js.map} +1 -1
- package/dist/cjs/{publishDraftGraph-CPOAcQFf.js → publishDraftGraph-3ASwAlD7.js} +4 -4
- package/dist/cjs/{publishDraftGraph-CPOAcQFf.js.map → publishDraftGraph-3ASwAlD7.js.map} +1 -1
- package/dist/cjs/{resetAmbiguousLegacyItemData-adDl4LcT.js → resetAmbiguousLegacyItemData-Bu_MBBYt.js} +5 -4
- package/dist/cjs/{resetAmbiguousLegacyItemData-adDl4LcT.js.map → resetAmbiguousLegacyItemData-Bu_MBBYt.js.map} +1 -1
- package/dist/cjs/{resolveModelForSyncedSeed-DoNThPdL.js → resolveModelForSyncedSeed-BANIiuFU.js} +2 -2
- package/dist/cjs/{resolveModelForSyncedSeed-DoNThPdL.js.map → resolveModelForSyncedSeed-BANIiuFU.js.map} +1 -1
- package/dist/cjs/{syncDbWithEas-CYfPkus9.js → syncDbWithEas-CrmxxmUW.js} +10 -9
- package/dist/cjs/{syncDbWithEas-CYfPkus9.js.map → syncDbWithEas-CrmxxmUW.js.map} +1 -1
- package/dist/{configurePlatform-xU3Hsno3.js → configurePlatform-BRw2j0ZN.js} +7 -4
- package/dist/{configurePlatform-xU3Hsno3.js.map → configurePlatform-BRw2j0ZN.js.map} +1 -1
- package/dist/{db-W1g29qsM.js → db-D9K_f5cF.js} +14 -14
- package/dist/{db-W1g29qsM.js.map → db-D9K_f5cF.js.map} +1 -1
- package/dist/{eas-CSwV6MvB.js → eas-DHxfswCt.js} +8 -5
- package/dist/eas-DHxfswCt.js.map +1 -0
- package/dist/{getItem-BYQeM3DY.js → getItem-d6N_aM6S.js} +8 -5
- package/dist/{getItem-BYQeM3DY.js.map → getItem-d6N_aM6S.js.map} +1 -1
- package/dist/{getPublishPayload-D5CQZd-y.js → getPublishPayload-BHrxVtzY.js} +16 -16
- package/dist/{getPublishPayload-D5CQZd-y.js.map → getPublishPayload-BHrxVtzY.js.map} +1 -1
- package/dist/getPublishUploads-BEqRiKIS.js +657 -0
- package/dist/getPublishUploads-BEqRiKIS.js.map +1 -0
- package/dist/{index-Bev-hZF-.js → index-CiMEoGu3.js} +12 -11
- package/dist/index-CiMEoGu3.js.map +1 -0
- package/dist/{index-CSOQFAOn.js → index-DglvthOk.js} +2 -2
- package/dist/index-DglvthOk.js.map +1 -0
- package/dist/{index-DRXC5Mra.js → index-s15q14rm.js} +29 -29
- package/dist/{index-DRXC5Mra.js.map → index-s15q14rm.js.map} +1 -1
- package/dist/{index.browser-DO20vYuP.js → index.browser-Cm06tP4X.js} +553 -165
- package/dist/index.browser-Cm06tP4X.js.map +1 -0
- package/dist/{index.node-C4iyOhdo.js → index.node-C30dmFgn.js} +5 -5
- package/dist/{index.node-C4iyOhdo.js.map → index.node-C30dmFgn.js.map} +1 -1
- package/dist/main.cjs +4 -3
- package/dist/main.cjs.map +1 -1
- package/dist/main.js +32 -44
- package/dist/main.js.map +1 -1
- package/dist/mimeTypes-DHAHC4eZ.js +204 -0
- package/dist/mimeTypes-DHAHC4eZ.js.map +1 -0
- package/dist/node.js +13 -12
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +9 -7
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.node.js +3 -3
- package/dist/{property-BT1zDSkd.js → property-DhmmYAvQ.js} +12 -9
- package/dist/property-DhmmYAvQ.js.map +1 -0
- package/dist/{publishDraftGraph-Bcfrdj7-.js → publishDraftGraph-yYP74WRt.js} +8 -8
- package/dist/{publishDraftGraph-Bcfrdj7-.js.map → publishDraftGraph-yYP74WRt.js.map} +1 -1
- package/dist/{resetAmbiguousLegacyItemData-Ci6PM_vC.js → resetAmbiguousLegacyItemData-Bk0QyDW8.js} +2 -2
- package/dist/{resetAmbiguousLegacyItemData-Ci6PM_vC.js.map → resetAmbiguousLegacyItemData-Bk0QyDW8.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-CLlumTBq.js → resolveModelForSyncedSeed-8cAzvUFd.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-CLlumTBq.js.map → resolveModelForSyncedSeed-8cAzvUFd.js.map} +1 -1
- package/dist/src/Item/Item.d.ts +1 -1
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -1
- package/dist/src/browser/helpers/FileManager.d.ts +4 -1
- package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/browser/helpers/tolerantWebAccess.d.ts +79 -4
- package/dist/src/browser/helpers/tolerantWebAccess.d.ts.map +1 -1
- package/dist/src/browser/workers/FileDownloader.d.ts +19 -4
- package/dist/src/browser/workers/FileDownloader.d.ts.map +1 -1
- package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
- package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
- package/dist/src/db/migrateLegacyItemStorageRows.d.ts +57 -0
- package/dist/src/db/migrateLegacyItemStorageRows.d.ts.map +1 -0
- package/dist/src/db/read/getCompositeChildPaths.d.ts +13 -0
- package/dist/src/db/read/getCompositeChildPaths.d.ts.map +1 -0
- package/dist/src/db/read/getItems.d.ts.map +1 -1
- package/dist/src/db/read/getPublishUploads.d.ts +32 -3
- package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
- package/dist/src/db/write/convertVerbatimItemStorageRow.d.ts +44 -0
- package/dist/src/db/write/convertVerbatimItemStorageRow.d.ts.map +1 -0
- package/dist/src/db/write/createNewItem.d.ts.map +1 -1
- package/dist/src/events/files/download.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts +3 -3
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/IFileManager.d.ts +25 -1
- package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
- package/dist/src/helpers/arweaveContentTags.d.ts +33 -0
- package/dist/src/helpers/arweaveContentTags.d.ts.map +1 -0
- package/dist/src/helpers/compositeUpload.d.ts +28 -0
- package/dist/src/helpers/compositeUpload.d.ts.map +1 -0
- package/dist/src/helpers/itemStorageFile.d.ts +57 -0
- package/dist/src/helpers/itemStorageFile.d.ts.map +1 -0
- package/dist/src/helpers/mapWithConcurrency.d.ts +7 -0
- package/dist/src/helpers/mapWithConcurrency.d.ts.map +1 -0
- package/dist/src/helpers/mimeTypes.d.ts +43 -0
- package/dist/src/helpers/mimeTypes.d.ts.map +1 -0
- package/dist/src/helpers/ownership.d.ts +19 -3
- package/dist/src/helpers/ownership.d.ts.map +1 -1
- package/dist/src/helpers/storageDir.d.ts +16 -0
- package/dist/src/helpers/storageDir.d.ts.map +1 -0
- package/dist/src/helpers/tabCoordinator.d.ts +5 -1
- package/dist/src/helpers/tabCoordinator.d.ts.map +1 -1
- package/dist/src/helpers/tabEvents.d.ts +23 -2
- package/dist/src/helpers/tabEvents.d.ts.map +1 -1
- package/dist/src/helpers/tabLocks.d.ts +11 -1
- package/dist/src/helpers/tabLocks.d.ts.map +1 -1
- package/dist/src/index.d.ts +6 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types/fileManager.d.ts +3 -14
- package/dist/src/types/fileManager.d.ts.map +1 -1
- package/dist/src/types/publish.d.ts +14 -0
- package/dist/src/types/publish.d.ts.map +1 -1
- package/dist/{syncDbWithEas-BQsXjGhe.js → syncDbWithEas--HUA9WNb.js} +15 -14
- package/dist/syncDbWithEas--HUA9WNb.js.map +1 -0
- package/dist/{tabEvents-C9qUKx_z.js → tabEvents-DguZpCCv.js} +338 -60
- package/dist/tabEvents-DguZpCCv.js.map +1 -0
- package/dist/tolerantWebAccess-BZYWt09Y.js +551 -0
- package/dist/tolerantWebAccess-BZYWt09Y.js.map +1 -0
- package/dist/{updateSeedRevokedAt-D6q0h7pj.js → updateSeedRevokedAt-D_EG-q3b.js} +3 -3
- package/dist/{updateSeedRevokedAt-D6q0h7pj.js.map → updateSeedRevokedAt-D_EG-q3b.js.map} +1 -1
- package/package.json +5 -5
- package/dist/BasePathResolver-BdxCSIzn.js.map +0 -1
- package/dist/ClientManager-ClCwwhwo.js.map +0 -1
- package/dist/Item-B9Y4VuK1.js.map +0 -1
- package/dist/ModelProperty-BMePcicQ.js.map +0 -1
- package/dist/cjs/getPublishUploads-Bh22D3zJ.js +0 -495
- package/dist/cjs/getPublishUploads-Bh22D3zJ.js.map +0 -1
- package/dist/cjs/index-BA1RIYFG.js.map +0 -1
- package/dist/cjs/index-Dls7aMjr.js.map +0 -1
- package/dist/eas-CSwV6MvB.js.map +0 -1
- package/dist/getPublishUploads-BGpDsrBp.js +0 -484
- package/dist/getPublishUploads-BGpDsrBp.js.map +0 -1
- package/dist/index-Bev-hZF-.js.map +0 -1
- package/dist/index-CSOQFAOn.js.map +0 -1
- package/dist/index.browser-DO20vYuP.js.map +0 -1
- package/dist/property-BT1zDSkd.js.map +0 -1
- package/dist/syncDbWithEas-BQsXjGhe.js.map +0 -1
- package/dist/tabEvents-C9qUKx_z.js.map +0 -1
- package/dist/tolerantWebAccess-B-9bwxbw.js +0 -160
- package/dist/tolerantWebAccess-B-9bwxbw.js.map +0 -1
package/dist/eas-CSwV6MvB.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eas-CSwV6MvB.js","sources":["../../src/eas.ts"],"sourcesContent":["export {\n getItemVersionsFromEas,\n getItemPropertiesFromEas,\n getCanonicalItemPropertiesFromEas,\n getEasSchemaUidBySchemaName,\n getSeedsFromSchemaUids,\n getSeedsBySchemaName,\n getSeedUidsBySchemaName,\n getPublishedByFromEas,\n decodePublishedByData,\n hashPublishedByBatch,\n verifyPublishedByBatch,\n PUBLISHED_BY_SCHEMA_DEF,\n PUBLISHED_BY_SCHEMA_NAME,\n} from '@seedprotocol/eas'\nexport type {\n Attestation,\n EASSchema,\n PublishedByDecoded,\n GetPublishedByFromEasParams,\n} from '@seedprotocol/eas'\n\nimport { toSnakeCase } from '@/helpers'\nimport { withExcludeRevokedFilter } from '@seedprotocol/eas'\nimport { BaseEasClient } from '@seedprotocol/eas'\nimport { BaseQueryClient } from '@seedprotocol/eas'\nimport { GET_SCHEMAS } from '@seedprotocol/eas'\nimport type { EASSchema } from '@seedprotocol/eas'\n\ntype GetModelSchemasFromEas = () => Promise<EASSchema[]>\n\n/** Stays in SDK: depends on local Model registry. */\nexport const getModelSchemasFromEas: GetModelSchemasFromEas = async () => {\n const queryClient = BaseQueryClient.getQueryClient()\n const easClient = BaseEasClient.getEasClient()\n\n const modelMod = await import('./Model/Model')\n const { Model } = modelMod\n const allModels = await Model.all()\n const modelNames = allModels.map((m) => m.modelName).filter((name): name is string => !!name)\n\n if (modelNames.length === 0) {\n return []\n }\n\n const OR: Record<string, unknown>[] = []\n const hasImageModel = modelNames.includes('Image')\n\n for (const modelName of modelNames) {\n const snake = toSnakeCase(modelName)\n OR.push({\n schema: {\n equals: `bytes32 ${snake}`,\n },\n })\n const altSchema = `bytes32 ${modelName}`\n if (altSchema !== `bytes32 ${snake}`) {\n OR.push({\n schema: {\n equals: altSchema,\n },\n })\n }\n }\n\n if (hasImageModel) {\n OR.push({\n schema: {\n equals: `bytes32 image`,\n },\n })\n }\n\n const modelSchemas = await queryClient.fetchQuery({\n queryKey: [`getSchemasAllModels`, [...modelNames].sort()],\n queryFn: async () =>\n easClient.request(GET_SCHEMAS, {\n where: {\n OR,\n },\n }),\n })\n\n if (!modelSchemas?.schemas?.length) {\n return []\n }\n\n return modelSchemas.schemas as EASSchema[]\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA+BA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsB,GAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW;AACvE,CAAA,CAAA,CAAA,CAAA,MAAM,CAAA,CAAA,CAAA,C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A,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;SACF,CAAC;AACL,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC;AAEF,CAAA,CAAA,CAAA,CAAA,IAAI,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAE,MAAM,CAAA,CAAE;AAClC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAE;IACX;IAEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsB;AAC5C,CAAA;;"}
|
|
@@ -1,484 +0,0 @@
|
|
|
1
|
-
import { r as resolveSeedIdsFromRefString, n as normalizeRelationPropertyValue, i as isPublishedSeedRef } from './tabEvents-C9qUKx_z.js';
|
|
2
|
-
import { BaseArweaveClient } from '@seedprotocol/arweave';
|
|
3
|
-
import { g as getPublishDraftGraph, a as getSegmentedItemProperties } from './publishDraftGraph-Bcfrdj7-.js';
|
|
4
|
-
import debug from 'debug';
|
|
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
|
-
import { eq } from 'drizzle-orm';
|
|
9
|
-
import 'pluralize';
|
|
10
|
-
import { k as isDataType, M as ModelPropertyDataTypes, n as normalizeDataType } from './db-W1g29qsM.js';
|
|
11
|
-
import '@seedprotocol/eas';
|
|
12
|
-
import 'xstate';
|
|
13
|
-
import 'nanoid';
|
|
14
|
-
import 'nanoid-dictionary';
|
|
15
|
-
import '@seedprotocol/query';
|
|
16
|
-
import 'lodash-es';
|
|
17
|
-
import 'reflect-metadata';
|
|
18
|
-
import './index-DRXC5Mra.js';
|
|
19
|
-
import './model-DGMe-TTm.js';
|
|
20
|
-
import 'drizzle-orm/casing';
|
|
21
|
-
import '@sinclair/typebox';
|
|
22
|
-
import './property-BT1zDSkd.js';
|
|
23
|
-
import '@noble/hashes/sha3';
|
|
24
|
-
import '@noble/hashes/utils';
|
|
25
|
-
import 'rxjs';
|
|
26
|
-
import 'drizzle-orm/sqlite-core';
|
|
27
|
-
|
|
28
|
-
const logger = debug('seedSdk:item:getPublishUploads');
|
|
29
|
-
const EXTENSION_TO_MIME = {
|
|
30
|
-
png: 'image/png',
|
|
31
|
-
jpg: 'image/jpeg',
|
|
32
|
-
jpeg: 'image/jpeg',
|
|
33
|
-
gif: 'image/gif',
|
|
34
|
-
webp: 'image/webp',
|
|
35
|
-
svg: 'image/svg+xml',
|
|
36
|
-
html: 'text/html',
|
|
37
|
-
htm: 'text/html',
|
|
38
|
-
json: 'application/json',
|
|
39
|
-
txt: 'text/plain',
|
|
40
|
-
};
|
|
41
|
-
const getMimeTypeFromPath = (filePathOrName) => {
|
|
42
|
-
const ext = filePathOrName.split('.').pop()?.toLowerCase();
|
|
43
|
-
return ext ? EXTENSION_TO_MIME[ext] : undefined;
|
|
44
|
-
};
|
|
45
|
-
const toUint8Array = async (data) => {
|
|
46
|
-
if (typeof Blob !== 'undefined' && data instanceof Blob) {
|
|
47
|
-
return new Uint8Array(await data.arrayBuffer());
|
|
48
|
-
}
|
|
49
|
-
return new Uint8Array(data);
|
|
50
|
-
};
|
|
51
|
-
const prepareArweaveTransaction = async (data, contentHash, contentType, additionalTags) => {
|
|
52
|
-
const tags = [];
|
|
53
|
-
if (contentHash) {
|
|
54
|
-
tags.push({ name: 'Content-SHA-256', value: contentHash });
|
|
55
|
-
logger('contentHash', contentHash);
|
|
56
|
-
logger('adding content hash tag');
|
|
57
|
-
}
|
|
58
|
-
if (contentType) {
|
|
59
|
-
tags.push({ name: 'Content-Type', value: contentType });
|
|
60
|
-
}
|
|
61
|
-
if (additionalTags?.length) {
|
|
62
|
-
tags.push(...additionalTags);
|
|
63
|
-
}
|
|
64
|
-
const tx = await BaseArweaveClient.createTransaction(data, {
|
|
65
|
-
tags: tags.length ? tags : undefined,
|
|
66
|
-
});
|
|
67
|
-
return tx;
|
|
68
|
-
};
|
|
69
|
-
const getStorageDirForDataType = (dataType) => {
|
|
70
|
-
switch (normalizeDataType(dataType)) {
|
|
71
|
-
case 'Image':
|
|
72
|
-
return BaseFileManager.getFilesPath('images');
|
|
73
|
-
case 'File':
|
|
74
|
-
return BaseFileManager.getFilesPath('files');
|
|
75
|
-
case 'Html':
|
|
76
|
-
return BaseFileManager.getFilesPath('html');
|
|
77
|
-
case 'Json':
|
|
78
|
-
return BaseFileManager.getFilesPath('json');
|
|
79
|
-
default:
|
|
80
|
-
return BaseFileManager.getFilesPath('images');
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
const DATA_URI_IMAGE = /^data:(image\/[a-zA-Z0-9.+-]+);base64,([\s\S]*)$/i;
|
|
84
|
-
function decodeDataUriImage(dataUri) {
|
|
85
|
-
const m = DATA_URI_IMAGE.exec((dataUri ?? '').trim());
|
|
86
|
-
if (!m)
|
|
87
|
-
return null;
|
|
88
|
-
try {
|
|
89
|
-
const mimeType = m[1].toLowerCase().trim();
|
|
90
|
-
const base64 = m[2].replace(/\s/g, '');
|
|
91
|
-
const binary = Uint8Array.from(atob(base64), (c) => c.charCodeAt(0));
|
|
92
|
-
return { mimeType, bytes: binary };
|
|
93
|
-
}
|
|
94
|
-
catch {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
const getStorageSeedUploads = async (itemStorageSeedProperties, options) => {
|
|
99
|
-
const uploads = [];
|
|
100
|
-
const extra = options?.arweaveUploadTags;
|
|
101
|
-
for (const itemProperty of itemStorageSeedProperties) {
|
|
102
|
-
const snapshot = itemProperty.getService().getSnapshot();
|
|
103
|
-
const context = 'context' in snapshot ? snapshot.context : null;
|
|
104
|
-
if (!context) {
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
const propertyValue = context.propertyValue;
|
|
108
|
-
const refResolvedValue = context.refResolvedValue;
|
|
109
|
-
if (!refResolvedValue) {
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
// propertyValue is the storage seed's seedLocalId; use it for the upload so processRelationOrImageProperty can match
|
|
113
|
-
const { seedLocalId } = resolveSeedIdsFromRefString(normalizeRelationPropertyValue(propertyValue) ?? '');
|
|
114
|
-
if (!seedLocalId) {
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
const dataType = itemProperty.propertyDef?.refValueType ??
|
|
118
|
-
itemProperty.propertyDef?.dataType ??
|
|
119
|
-
'Image';
|
|
120
|
-
if (isDataType(dataType, ModelPropertyDataTypes.Html)) {
|
|
121
|
-
if (options?.deferHtmlStorageSeedLocalIds?.includes(seedLocalId)) {
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
if (options?.onlyHtmlStorageSeedLocalIds?.length &&
|
|
125
|
-
!options.onlyHtmlStorageSeedLocalIds.includes(seedLocalId)) {
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
else if (options?.onlyHtmlStorageSeedLocalIds?.length) {
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
const baseDir = getStorageDirForDataType(dataType);
|
|
133
|
-
const filePath = `${baseDir}/${refResolvedValue}`;
|
|
134
|
-
const exists = await BaseFileManager.pathExists(filePath);
|
|
135
|
-
if (!exists) {
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
const fileBuffer = await BaseFileManager.readFileAsBuffer(filePath);
|
|
139
|
-
const fileContents = await toUint8Array(fileBuffer);
|
|
140
|
-
const contentHash = await getContentHash(fileContents);
|
|
141
|
-
const contentType = getMimeTypeFromPath(refResolvedValue);
|
|
142
|
-
const transaction = await prepareArweaveTransaction(fileContents, contentHash, contentType, extra);
|
|
143
|
-
uploads.push({
|
|
144
|
-
itemPropertyName: itemProperty.propertyName,
|
|
145
|
-
itemPropertyLocalId: itemProperty.localId,
|
|
146
|
-
seedLocalId,
|
|
147
|
-
versionLocalId: itemProperty.versionLocalId,
|
|
148
|
-
transactionToSign: transaction,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
return uploads;
|
|
152
|
-
};
|
|
153
|
-
async function appendCoPublishedImageUploads(item, uploads, options) {
|
|
154
|
-
const appDb = BaseDb.getAppDb();
|
|
155
|
-
if (!appDb || options?.onlyHtmlStorageSeedLocalIds?.length)
|
|
156
|
-
return uploads;
|
|
157
|
-
const rows = await appDb
|
|
158
|
-
.select()
|
|
159
|
-
.from(htmlEmbeddedImageCoPublish)
|
|
160
|
-
.where(eq(htmlEmbeddedImageCoPublish.parentSeedLocalId, item.seedLocalId));
|
|
161
|
-
const seen = new Set(uploads.map((u) => u.seedLocalId));
|
|
162
|
-
for (const row of rows) {
|
|
163
|
-
if (seen.has(row.imageSeedLocalId))
|
|
164
|
-
continue;
|
|
165
|
-
const imageItem = await Item.find({ seedLocalId: row.imageSeedLocalId, modelName: 'Image' });
|
|
166
|
-
if (!imageItem)
|
|
167
|
-
continue;
|
|
168
|
-
const st = imageItem.internalProperties['storageTransactionId'] ??
|
|
169
|
-
imageItem.allProperties['storageTransactionId'];
|
|
170
|
-
const stSnap = st?.getService().getSnapshot();
|
|
171
|
-
const stCtx = stSnap && 'context' in stSnap ? stSnap.context : undefined;
|
|
172
|
-
const stValue = typeof stCtx?.propertyValue === 'string'
|
|
173
|
-
? (stCtx.propertyValue ?? '')
|
|
174
|
-
: '';
|
|
175
|
-
const decoded = decodeDataUriImage(stValue);
|
|
176
|
-
const more = [];
|
|
177
|
-
if (decoded && st && st.localId && st.versionLocalId) {
|
|
178
|
-
const contentHash = await getContentHash(decoded.bytes);
|
|
179
|
-
const transaction = await prepareArweaveTransaction(decoded.bytes, contentHash, decoded.mimeType, options?.arweaveUploadTags);
|
|
180
|
-
more.push({
|
|
181
|
-
itemPropertyName: st.propertyName,
|
|
182
|
-
itemPropertyLocalId: st.localId,
|
|
183
|
-
seedLocalId: imageItem.seedLocalId,
|
|
184
|
-
versionLocalId: st.versionLocalId,
|
|
185
|
-
transactionToSign: transaction,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
for (const u of more) {
|
|
189
|
-
if (!seen.has(u.seedLocalId)) {
|
|
190
|
-
uploads.push(u);
|
|
191
|
-
seen.add(u.seedLocalId);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return uploads;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* True if publish would include at least one Arweave upload (local file / storage seed present).
|
|
199
|
-
* Does not create Arweave transactions or hit the network — use for routing (e.g. skip EAS-only)
|
|
200
|
-
* when {@link getPublishUploads} would fail early (e.g. gateway unreachable during tx creation).
|
|
201
|
-
*/
|
|
202
|
-
async function storageSeedHasUploadCandidates(itemStorageSeedProperties) {
|
|
203
|
-
for (const itemProperty of itemStorageSeedProperties) {
|
|
204
|
-
const snapshot = itemProperty.getService().getSnapshot();
|
|
205
|
-
const context = 'context' in snapshot ? snapshot.context : null;
|
|
206
|
-
if (!context) {
|
|
207
|
-
continue;
|
|
208
|
-
}
|
|
209
|
-
const propertyValue = context.propertyValue;
|
|
210
|
-
const refResolvedValue = context.refResolvedValue;
|
|
211
|
-
if (!refResolvedValue) {
|
|
212
|
-
continue;
|
|
213
|
-
}
|
|
214
|
-
const { seedLocalId } = resolveSeedIdsFromRefString(normalizeRelationPropertyValue(propertyValue) ?? '');
|
|
215
|
-
if (!seedLocalId) {
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
|
-
const dataType = itemProperty.propertyDef?.refValueType ??
|
|
219
|
-
itemProperty.propertyDef?.dataType ??
|
|
220
|
-
'Image';
|
|
221
|
-
const baseDir = getStorageDirForDataType(dataType);
|
|
222
|
-
const filePath = `${baseDir}/${refResolvedValue}`;
|
|
223
|
-
if (await BaseFileManager.pathExists(filePath)) {
|
|
224
|
-
return true;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
async function uploadPropertyWouldUpload(uploadProperty, relatedItemProperty) {
|
|
230
|
-
const childUploads = [];
|
|
231
|
-
for (const childProperty of uploadProperty.childProperties) {
|
|
232
|
-
const filePath = childProperty.localStoragePath;
|
|
233
|
-
if (!filePath || filePath.endsWith('undefined')) {
|
|
234
|
-
continue;
|
|
235
|
-
}
|
|
236
|
-
const exists = await BaseFileManager.pathExists(filePath);
|
|
237
|
-
if (!exists) {
|
|
238
|
-
continue;
|
|
239
|
-
}
|
|
240
|
-
childUploads.push({
|
|
241
|
-
propertyName: childProperty.propertyName,
|
|
242
|
-
localStoragePath: filePath,
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
if (childUploads.length > 0) {
|
|
246
|
-
return true;
|
|
247
|
-
}
|
|
248
|
-
if (relatedItemProperty && relatedItemProperty.localStoragePath) {
|
|
249
|
-
const filePath = relatedItemProperty.localStoragePath;
|
|
250
|
-
if (!filePath || filePath.endsWith('undefined')) {
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
253
|
-
return await BaseFileManager.pathExists(filePath);
|
|
254
|
-
}
|
|
255
|
-
return false;
|
|
256
|
-
}
|
|
257
|
-
async function itemOwnUploadCandidates(item, relatedItemProperty, recurseStorageRelations) {
|
|
258
|
-
const { itemUploadProperties, itemRelationProperties, itemImageProperties } = await getSegmentedItemProperties(item);
|
|
259
|
-
for (const uploadProperty of itemUploadProperties) {
|
|
260
|
-
if (await uploadPropertyWouldUpload(uploadProperty, relatedItemProperty)) {
|
|
261
|
-
return true;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
if (await storageSeedHasUploadCandidates(itemImageProperties)) {
|
|
265
|
-
return true;
|
|
266
|
-
}
|
|
267
|
-
if (!recurseStorageRelations)
|
|
268
|
-
return false;
|
|
269
|
-
const storageProperties = new Set(itemImageProperties);
|
|
270
|
-
for (const relationProperty of itemRelationProperties) {
|
|
271
|
-
if (!storageProperties.has(relationProperty))
|
|
272
|
-
continue;
|
|
273
|
-
const snapshot = relationProperty.getService().getSnapshot();
|
|
274
|
-
const context = 'context' in snapshot ? snapshot.context : null;
|
|
275
|
-
if (!context) {
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
const propertyValue = context.propertyValue;
|
|
279
|
-
if (!propertyValue || relationProperty.uid) {
|
|
280
|
-
continue;
|
|
281
|
-
}
|
|
282
|
-
const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(normalizeRelationPropertyValue(propertyValue) ?? '');
|
|
283
|
-
if (!seedLocalId && !seedUid) {
|
|
284
|
-
throw new Error(`Invalid relation value for ${relationProperty.propertyName}: expected local seed id or 0x uid`);
|
|
285
|
-
}
|
|
286
|
-
const relatedItem = await Item.find({
|
|
287
|
-
seedLocalId,
|
|
288
|
-
seedUid,
|
|
289
|
-
});
|
|
290
|
-
if (!relatedItem) {
|
|
291
|
-
// Related seed referenced by attested uid with no local copy: already published, nothing to upload.
|
|
292
|
-
if (isPublishedSeedRef(propertyValue))
|
|
293
|
-
continue;
|
|
294
|
-
throw new Error(`No relatedItem found for ${relationProperty.propertyName}`);
|
|
295
|
-
}
|
|
296
|
-
if (await itemOwnUploadCandidates(relatedItem, relationProperty, false)) {
|
|
297
|
-
return true;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return false;
|
|
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
|
-
}
|
|
313
|
-
const processUploadProperty = async (uploadProperty, uploads, relatedItemProperty, options) => {
|
|
314
|
-
const extra = options?.arweaveUploadTags;
|
|
315
|
-
const itemProperty = uploadProperty.itemProperty;
|
|
316
|
-
const childUploads = [];
|
|
317
|
-
for (const childProperty of uploadProperty.childProperties) {
|
|
318
|
-
const filePath = childProperty.localStoragePath;
|
|
319
|
-
if (!filePath || filePath.endsWith('undefined')) {
|
|
320
|
-
continue;
|
|
321
|
-
}
|
|
322
|
-
const exists = await BaseFileManager.pathExists(filePath);
|
|
323
|
-
if (!exists) {
|
|
324
|
-
continue;
|
|
325
|
-
}
|
|
326
|
-
childUploads.push({
|
|
327
|
-
propertyName: childProperty.propertyName,
|
|
328
|
-
localStoragePath: filePath,
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
let fileContents;
|
|
332
|
-
let transaction;
|
|
333
|
-
if (!childUploads || childUploads.length === 0) {
|
|
334
|
-
if (relatedItemProperty && relatedItemProperty.localStoragePath) {
|
|
335
|
-
const filePath = relatedItemProperty.localStoragePath;
|
|
336
|
-
if (!filePath || filePath.endsWith('undefined')) {
|
|
337
|
-
return uploads;
|
|
338
|
-
}
|
|
339
|
-
const exists = await BaseFileManager.pathExists(filePath);
|
|
340
|
-
if (!exists) {
|
|
341
|
-
return uploads;
|
|
342
|
-
}
|
|
343
|
-
try {
|
|
344
|
-
const fileBuffer = await BaseFileManager.readFileAsBuffer(filePath);
|
|
345
|
-
fileContents = await toUint8Array(fileBuffer);
|
|
346
|
-
}
|
|
347
|
-
catch (e) {
|
|
348
|
-
const fs = await BaseFileManager.getFs();
|
|
349
|
-
fileContents = await toUint8Array(fs.readFileSync(filePath));
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
if (!fileContents) {
|
|
353
|
-
return uploads;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
if (childUploads.length > 0) {
|
|
357
|
-
const separator = '===FILE_SEPARATOR===';
|
|
358
|
-
// let compositeFileContents = `${itemProperty.propertyName}${separator}${mainFileContents}`
|
|
359
|
-
let compositeFileContents = '';
|
|
360
|
-
for (const childUpload of childUploads) {
|
|
361
|
-
let childUploadContents;
|
|
362
|
-
const fs = await BaseFileManager.getFs();
|
|
363
|
-
try {
|
|
364
|
-
childUploadContents = await fs.promises.readFile(childUpload.localStoragePath);
|
|
365
|
-
}
|
|
366
|
-
catch (e) {
|
|
367
|
-
childUploadContents = fs.readFileSync(childUpload.localStoragePath);
|
|
368
|
-
}
|
|
369
|
-
compositeFileContents += `${separator}${childUpload.propertyName}${separator}${childUploadContents}`;
|
|
370
|
-
}
|
|
371
|
-
if (typeof document !== 'undefined') {
|
|
372
|
-
fileContents = new TextEncoder().encode(compositeFileContents);
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
fileContents = Buffer.from(compositeFileContents);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
if (!fileContents) {
|
|
379
|
-
throw new Error(`No file contents found for ${itemProperty.propertyName}`);
|
|
380
|
-
}
|
|
381
|
-
const uint8Array = new Uint8Array(fileContents);
|
|
382
|
-
const contentHash = await getContentHash(uint8Array);
|
|
383
|
-
let contentType;
|
|
384
|
-
if (childUploads.length === 0 && relatedItemProperty?.localStoragePath) {
|
|
385
|
-
contentType = getMimeTypeFromPath(relatedItemProperty.localStoragePath);
|
|
386
|
-
}
|
|
387
|
-
else if (childUploads.length > 0) {
|
|
388
|
-
contentType = 'application/octet-stream';
|
|
389
|
-
}
|
|
390
|
-
transaction = await prepareArweaveTransaction(uint8Array, contentHash, contentType, extra);
|
|
391
|
-
let itemPropertyLocalId = relatedItemProperty
|
|
392
|
-
? relatedItemProperty.localId
|
|
393
|
-
: itemProperty.localId;
|
|
394
|
-
let itemPropertyName = relatedItemProperty
|
|
395
|
-
? relatedItemProperty.propertyName
|
|
396
|
-
: itemProperty.propertyName;
|
|
397
|
-
uploads.push({
|
|
398
|
-
itemPropertyName,
|
|
399
|
-
itemPropertyLocalId,
|
|
400
|
-
seedLocalId: itemProperty.seedLocalId,
|
|
401
|
-
versionLocalId: itemProperty.versionLocalId,
|
|
402
|
-
transactionToSign: transaction,
|
|
403
|
-
});
|
|
404
|
-
return uploads;
|
|
405
|
-
};
|
|
406
|
-
/** No seed uid yet: a related item in this state is published together with the item. */
|
|
407
|
-
const isDraftItem = (item) => !item.seedUid || item.seedUid === '0x' + '0'.repeat(64);
|
|
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) => {
|
|
410
|
-
const { itemUploadProperties, itemRelationProperties, itemImageProperties } = await getSegmentedItemProperties(item);
|
|
411
|
-
// Phase 2 of an embedded-image publish: only the deferred Html storage seeds, of this item and of
|
|
412
|
-
// the related items published with it (whose Html can embed images too).
|
|
413
|
-
const onlyDeferredHtml = !!options?.onlyHtmlStorageSeedLocalIds?.length;
|
|
414
|
-
if (onlyDeferredHtml) {
|
|
415
|
-
const storageSeedUploads = await getStorageSeedUploads(itemImageProperties, options);
|
|
416
|
-
uploads.push(...storageSeedUploads);
|
|
417
|
-
}
|
|
418
|
-
else {
|
|
419
|
-
for (const uploadProperty of itemUploadProperties) {
|
|
420
|
-
uploads = await processUploadProperty(uploadProperty, uploads, relatedItemProperty, options);
|
|
421
|
-
}
|
|
422
|
-
const storageSeedUploads = await getStorageSeedUploads(itemImageProperties, options);
|
|
423
|
-
uploads.push(...storageSeedUploads);
|
|
424
|
-
// Images embedded in this item's Html: the published item's, and a related draft's published with it.
|
|
425
|
-
if (!relatedItemProperty || isDraftItem(item)) {
|
|
426
|
-
uploads = await appendCoPublishedImageUploads(item, uploads, options);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
if (options?.skipRelationRecursion) {
|
|
430
|
-
return uploads;
|
|
431
|
-
}
|
|
432
|
-
// Relations to Image/File/Html/Json items: their file, read through the relation property.
|
|
433
|
-
const storageProperties = new Set(itemImageProperties);
|
|
434
|
-
for (const relationProperty of itemRelationProperties) {
|
|
435
|
-
if (!storageProperties.has(relationProperty))
|
|
436
|
-
continue;
|
|
437
|
-
const snapshot = relationProperty.getService().getSnapshot();
|
|
438
|
-
const context = 'context' in snapshot ? snapshot.context : null;
|
|
439
|
-
if (!context) {
|
|
440
|
-
continue;
|
|
441
|
-
}
|
|
442
|
-
const propertyValue = context.propertyValue;
|
|
443
|
-
if (!propertyValue || relationProperty.uid) {
|
|
444
|
-
continue;
|
|
445
|
-
}
|
|
446
|
-
const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(normalizeRelationPropertyValue(propertyValue) ?? '');
|
|
447
|
-
if (!seedLocalId && !seedUid) {
|
|
448
|
-
throw new Error(`Invalid relation value for ${relationProperty.propertyName}: expected local seed id or 0x uid`);
|
|
449
|
-
}
|
|
450
|
-
const relatedItem = await Item.find({
|
|
451
|
-
seedLocalId,
|
|
452
|
-
seedUid,
|
|
453
|
-
});
|
|
454
|
-
if (!relatedItem) {
|
|
455
|
-
// Related seed referenced by attested uid with no local copy: already published, nothing to upload.
|
|
456
|
-
if (isPublishedSeedRef(propertyValue))
|
|
457
|
-
continue;
|
|
458
|
-
throw new Error(`No relatedItem found for ${relationProperty.propertyName}`);
|
|
459
|
-
}
|
|
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);
|
|
479
|
-
}
|
|
480
|
-
return uploads;
|
|
481
|
-
};
|
|
482
|
-
|
|
483
|
-
export { getPublishUploads, itemHasPublishUploadCandidates, prepareArweaveTransaction };
|
|
484
|
-
//# sourceMappingURL=getPublishUploads-BGpDsrBp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,CAAC,GAAG,SAAS;AACjD,CAAC;AAED,MAAM,YAAY,GAAG,OAAO,IAAmB,KAAyB;IACtE,IAAI,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,YAAY,IAAI,EAAE;QACvD,OAAO,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;IACjD;AACA,IAAA,OAAO,IAAI,UAAU,CAAC,IAAc,CAAC;AACvC,CAAC;AAEM,MAAM,yBAAyB,GAAG,OACvC,IAAyB,EACzB,WAA+B,EAC/B,WAAoB,EACpB,cAAiC,KACF;IAC/B,MAAM,IAAI,GAAqB,EAAE;IACjC,IAAI,WAAW,EAAE;AACf,QAAA,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,WAAW,EA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,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,GAAG,EAAE,OAAO,CAAC;IAC9F;AAEA,IAAA,OAAO,OAAO;AAChB;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-Bev-hZF-.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-CSOQFAOn.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|