@seedprotocol/sdk 0.4.29 → 0.4.30
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/{ArweaveClient-BeW65rGS.js → ArweaveClient-BA7b13Dl.js} +3 -3
- package/dist/{ArweaveClient-BeW65rGS.js.map → ArweaveClient-BA7b13Dl.js.map} +1 -1
- package/dist/{ArweaveClient-lm4d-WFB.js → ArweaveClient-DJ8Q63JQ.js} +3 -3
- package/dist/{ArweaveClient-lm4d-WFB.js.map → ArweaveClient-DJ8Q63JQ.js.map} +1 -1
- package/dist/{Db-VYLhDCFW.js → Db-BHMXF86s.js} +4 -4
- package/dist/{Db-VYLhDCFW.js.map → Db-BHMXF86s.js.map} +1 -1
- package/dist/{Db-CbS7T1_D.js → Db-qgwjsLKI.js} +4 -4
- package/dist/{Db-CbS7T1_D.js.map → Db-qgwjsLKI.js.map} +1 -1
- package/dist/{EasClient-BsdrEbha.js → EasClient-BqU4c27A.js} +2 -2
- package/dist/{EasClient-BsdrEbha.js.map → EasClient-BqU4c27A.js.map} +1 -1
- package/dist/{EasClient-McZ-yLnh.js → EasClient-DjSKI-Jp.js} +2 -2
- package/dist/{EasClient-McZ-yLnh.js.map → EasClient-DjSKI-Jp.js.map} +1 -1
- package/dist/{FileManager-wXAlwkmU.js → FileManager-DIbVCWke.js} +5 -5
- package/dist/FileManager-DIbVCWke.js.map +1 -0
- package/dist/{FileManager-8X0RFG8j.js → FileManager-DJ-mFSmc.js} +2 -2
- package/dist/{FileManager-8X0RFG8j.js.map → FileManager-DJ-mFSmc.js.map} +1 -1
- package/dist/{ModelProperty-e1IIoSSC.js → ModelProperty-jBpPbg3l.js} +17 -17
- package/dist/{ModelProperty-e1IIoSSC.js.map → ModelProperty-jBpPbg3l.js.map} +1 -1
- package/dist/{PathResolver-C_AdI9lp.js → PathResolver-CxmIkVyO.js} +2 -2
- package/dist/{PathResolver-C_AdI9lp.js.map → PathResolver-CxmIkVyO.js.map} +1 -1
- package/dist/{PathResolver-CCuiAvIu.js → PathResolver-DmFG4fR1.js} +2 -2
- package/dist/{PathResolver-CCuiAvIu.js.map → PathResolver-DmFG4fR1.js.map} +1 -1
- package/dist/{QueryClient-BCuLIB8_.js → QueryClient-7vk66LoN.js} +2 -2
- package/dist/{QueryClient-BCuLIB8_.js.map → QueryClient-7vk66LoN.js.map} +1 -1
- package/dist/{QueryClient-F2a7YH_K.js → QueryClient-CHayftHv.js} +2 -2
- package/dist/{QueryClient-F2a7YH_K.js.map → QueryClient-CHayftHv.js.map} +1 -1
- package/dist/{Schema-3_R_m7fn.js → Schema-CyWoCyDH.js} +22 -22
- package/dist/{Schema-3_R_m7fn.js.map → Schema-CyWoCyDH.js.map} +1 -1
- package/dist/{SchemaValidationService-BAPhc_z8.js → SchemaValidationService-ByxyqvS9.js} +2 -2
- package/dist/{SchemaValidationService-BAPhc_z8.js.map → SchemaValidationService-ByxyqvS9.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-pnhgDwmf.js → backfillMetadataPropertyIds-CUenpA6t.js} +2 -2
- package/dist/{backfillMetadataPropertyIds-pnhgDwmf.js.map → backfillMetadataPropertyIds-CUenpA6t.js.map} +1 -1
- package/dist/cjs/{ModelProperty-B_wtA6Tp.js → ModelProperty-BEpPD4wH.js} +17 -17
- package/dist/cjs/{ModelProperty-B_wtA6Tp.js.map → ModelProperty-BEpPD4wH.js.map} +1 -1
- package/dist/cjs/{Schema-DycmdXix.js → Schema-DgvWd1wc.js} +20 -20
- package/dist/cjs/{Schema-DycmdXix.js.map → Schema-DgvWd1wc.js.map} +1 -1
- package/dist/cjs/{SchemaValidationService-CutWcs3L.js → SchemaValidationService-DazyAm6l.js} +2 -2
- package/dist/cjs/{SchemaValidationService-CutWcs3L.js.map → SchemaValidationService-DazyAm6l.js.map} +1 -1
- package/dist/cjs/{backfillMetadataPropertyIds-BtL7WeI5.js → backfillMetadataPropertyIds-BHJnW-NK.js} +2 -2
- package/dist/cjs/{backfillMetadataPropertyIds-BtL7WeI5.js.map → backfillMetadataPropertyIds-BHJnW-NK.js.map} +1 -1
- package/dist/cjs/{getItem-B1qXuyLl.js → getItem-CStbsCge.js} +2 -2
- package/dist/cjs/{getItem-B1qXuyLl.js.map → getItem-CStbsCge.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-DGtDyXfX.js → getPublishPayload-Bws1mdNc.js} +11 -11
- package/dist/cjs/{getPublishPayload-DGtDyXfX.js.map → getPublishPayload-Bws1mdNc.js.map} +1 -1
- package/dist/cjs/{getPublishUploads-BMVJ2gfR.js → getPublishUploads-BNYeCNf_.js} +4 -4
- package/dist/cjs/{getPublishUploads-BMVJ2gfR.js.map → getPublishUploads-BNYeCNf_.js.map} +1 -1
- package/dist/cjs/{getSegmentedItemProperties-V0HYWzgM.js → getSegmentedItemProperties-CkhTBPSP.js} +3 -3
- package/dist/cjs/{getSegmentedItemProperties-V0HYWzgM.js.map → getSegmentedItemProperties-CkhTBPSP.js.map} +1 -1
- package/dist/cjs/{index-Dbu8yrzO.js → index-BLco2YiE.js} +3 -3
- package/dist/cjs/index-BLco2YiE.js.map +1 -0
- package/dist/cjs/{index-C0v35eOT.js → index-CZ7yR-bZ.js} +41 -41
- package/dist/cjs/{index-C0v35eOT.js.map → index-CZ7yR-bZ.js.map} +1 -1
- package/dist/cjs/{ownership-BPK6LY7d.js → ownership-B1I8eLiv.js} +2 -2
- package/dist/cjs/{ownership-BPK6LY7d.js.map → ownership-B1I8eLiv.js.map} +1 -1
- package/dist/cjs/{property-Ctv4ZGoa.js → property-sm3N2yBU.js} +4 -4
- package/dist/cjs/{property-Ctv4ZGoa.js.map → property-sm3N2yBU.js.map} +1 -1
- package/dist/cjs/{syncDbWithEas-DgZ7Acmb.js → syncDbWithEas-Dh9HSiwm.js} +5 -5
- package/dist/cjs/{syncDbWithEas-DgZ7Acmb.js.map → syncDbWithEas-Dh9HSiwm.js.map} +1 -1
- package/dist/{getItem-2pjRoJa0.js → getItem-CdgsloEB.js} +2 -2
- package/dist/{getItem-2pjRoJa0.js.map → getItem-CdgsloEB.js.map} +1 -1
- package/dist/{getPublishPayload-BAPoXumQ.js → getPublishPayload-DlkHAsOA.js} +11 -11
- package/dist/{getPublishPayload-BAPoXumQ.js.map → getPublishPayload-DlkHAsOA.js.map} +1 -1
- package/dist/{getPublishUploads-D75w3Et5.js → getPublishUploads-BeukCBiR.js} +4 -4
- package/dist/{getPublishUploads-D75w3Et5.js.map → getPublishUploads-BeukCBiR.js.map} +1 -1
- package/dist/{getSegmentedItemProperties-BLU_UBYI.js → getSegmentedItemProperties-B_yciZHD.js} +3 -3
- package/dist/{getSegmentedItemProperties-BLU_UBYI.js.map → getSegmentedItemProperties-B_yciZHD.js.map} +1 -1
- package/dist/{index-DKXcFcFk.js → index-C3oIxmh-.js} +52 -52
- package/dist/{index-DKXcFcFk.js.map → index-C3oIxmh-.js.map} +1 -1
- package/dist/{index-CKY29lZp.js → index-CfZAy_U1.js} +2 -2
- package/dist/index-CfZAy_U1.js.map +1 -0
- package/dist/{index-CjrqUOwu.js → index-j0nIoPTo.js} +3 -3
- package/dist/index-j0nIoPTo.js.map +1 -0
- package/dist/main.cjs +1 -1
- package/dist/main.js +13 -13
- package/dist/node.js +10 -10
- package/dist/{ownership-BbSCKuz4.js → ownership-Br40yugt.js} +2 -2
- package/dist/{ownership-BbSCKuz4.js.map → ownership-Br40yugt.js.map} +1 -1
- package/dist/{property-D0iZYPNc.js → property-DlfKPjHu.js} +5 -5
- package/dist/{property-D0iZYPNc.js.map → property-DlfKPjHu.js.map} +1 -1
- package/dist/{queries-D4DDYMy9.js → queries-CIlWKRoN.js} +2 -2
- package/dist/{queries-D4DDYMy9.js.map → queries-CIlWKRoN.js.map} +1 -1
- package/dist/src/vite/index.d.ts.map +1 -1
- package/dist/{syncDbWithEas-D3gGL9OM.js → syncDbWithEas-Dsa5kEMM.js} +6 -6
- package/dist/{syncDbWithEas-D3gGL9OM.js.map → syncDbWithEas-Dsa5kEMM.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-DrtFzF85.js → updateSeedRevokedAt-DHDIH0zy.js} +2 -2
- package/dist/{updateSeedRevokedAt-DrtFzF85.js.map → updateSeedRevokedAt-DHDIH0zy.js.map} +1 -1
- package/dist/vite.cjs +102 -4
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.js +102 -4
- package/dist/vite.js.map +1 -1
- package/package.json +1 -1
- package/dist/FileManager-wXAlwkmU.js.map +0 -1
- package/dist/cjs/index-Dbu8yrzO.js.map +0 -1
- package/dist/index-CKY29lZp.js.map +0 -1
- package/dist/index-CjrqUOwu.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as resolveSeedIdsFromRefString, t as normalizeRelationPropertyValue, u as Item, b as ModelPropertyDataTypes, v as BaseFileManager, w as getContentHash, p as BaseDb, x as htmlEmbeddedImageCoPublish, y as BaseArweaveClient } from './index-
|
|
2
|
-
import { g as getSegmentedItemProperties } from './getSegmentedItemProperties-
|
|
1
|
+
import { r as resolveSeedIdsFromRefString, t as normalizeRelationPropertyValue, u as Item, b as ModelPropertyDataTypes, v as BaseFileManager, w as getContentHash, p as BaseDb, x as htmlEmbeddedImageCoPublish, y as BaseArweaveClient } from './index-C3oIxmh-.js';
|
|
2
|
+
import { g as getSegmentedItemProperties } from './getSegmentedItemProperties-B_yciZHD.js';
|
|
3
3
|
import debug from 'debug';
|
|
4
4
|
import { eq } from 'drizzle-orm';
|
|
5
5
|
import 'pluralize';
|
|
@@ -15,7 +15,7 @@ import 'rxjs';
|
|
|
15
15
|
import 'arweave';
|
|
16
16
|
import 'js-sha3';
|
|
17
17
|
import 'reflect-metadata';
|
|
18
|
-
import './property-
|
|
18
|
+
import './property-DlfKPjHu.js';
|
|
19
19
|
|
|
20
20
|
const logger = debug('seedSdk:item:getPublishUploads');
|
|
21
21
|
const EXTENSION_TO_MIME = {
|
|
@@ -421,4 +421,4 @@ const getPublishUploads = async (item, uploads = [], relatedItemProperty, option
|
|
|
421
421
|
};
|
|
422
422
|
|
|
423
423
|
export { getPublishUploads, itemHasPublishUploadCandidates, prepareArweaveTransaction };
|
|
424
|
-
//# sourceMappingURL=getPublishUploads-
|
|
424
|
+
//# sourceMappingURL=getPublishUploads-BeukCBiR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPublishUploads-D75w3Et5.js","sources":["../../src/db/read/getPublishUploads.ts"],"sourcesContent":["import { BaseFileManager } from '@/helpers'\nimport {\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 } from '@/helpers/property'\n\nconst logger = debug('seedSdk:item:getPublishUploads')\n\n/** Optional tags merged into each Arweave tx after Content-SHA-256 / Content-Type. */\nexport type GetPublishUploadsOptions = {\n arweaveUploadTags?: TransactionTag[]\n /**\n * Html storage seed local ids to skip (phase 1 of two-phase embedded-image publish).\n */\n deferHtmlStorageSeedLocalIds?: string[]\n /**\n * When set, only Html storage seeds in this list are included (phase 2). Non-Html storage uploads are omitted.\n */\n onlyHtmlStorageSeedLocalIds?: string[]\n /** When true, do not recurse into relation properties (phase 2 must not re-upload related items). */\n skipRelationRecursion?: boolean\n}\n\nconst EXTENSION_TO_MIME: Record<string, string> = {\n png: 'image/png',\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n gif: 'image/gif',\n webp: 'image/webp',\n svg: 'image/svg+xml',\n html: 'text/html',\n htm: 'text/html',\n json: 'application/json',\n txt: 'text/plain',\n}\n\nconst getMimeTypeFromPath = (filePathOrName: string): string | undefined => {\n const ext = filePathOrName.split('.').pop()?.toLowerCase()\n return ext ? EXTENSION_TO_MIME[ext] : undefined\n}\n\nconst toUint8Array = async (data: Buffer | Blob): Promise<Uint8Array> => {\n if (typeof Blob !== 'undefined' && data instanceof Blob) {\n return new Uint8Array(await data.arrayBuffer())\n }\n return new Uint8Array(data as Buffer)\n}\n\nexport const prepareArweaveTransaction = async (\n data: string | Uint8Array,\n contentHash: string | undefined,\n contentType?: string,\n additionalTags?: TransactionTag[],\n): Promise<ArweaveTransaction> => {\n const tags: TransactionTag[] = []\n if (contentHash) {\n tags.push({ name: 'Content-SHA-256', value: contentHash })\n logger('contentHash', contentHash)\n logger('adding content hash tag')\n }\n if (contentType) {\n tags.push({ name: 'Content-Type', value: contentType })\n }\n if (additionalTags?.length) {\n tags.push(...additionalTags)\n }\n\n const tx = await BaseArweaveClient.createTransaction(data, {\n tags: tags.length ? tags : undefined,\n })\n\n return tx\n}\n\n\nconst getStorageDirForDataType = (dataType: string): string => {\n switch (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 (dataType === ModelPropertyDataTypes.Html) {\n if (options?.deferHtmlStorageSeedLocalIds?.includes(seedLocalId)) {\n continue\n }\n if (\n options?.onlyHtmlStorageSeedLocalIds?.length &&\n !options.onlyHtmlStorageSeedLocalIds.includes(seedLocalId)\n ) {\n continue\n }\n } else if (options?.onlyHtmlStorageSeedLocalIds?.length) {\n continue\n }\n\n const baseDir = getStorageDirForDataType(dataType)\n const filePath = `${baseDir}/${refResolvedValue}`\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n continue\n }\n\n const fileBuffer = await BaseFileManager.readFileAsBuffer(filePath)\n const fileContents = await toUint8Array(fileBuffer)\n\n const contentHash = await getContentHash(fileContents)\n const contentType = getMimeTypeFromPath(refResolvedValue)\n\n const transaction = await prepareArweaveTransaction(\n fileContents,\n contentHash,\n contentType,\n extra,\n )\n\n uploads.push({\n itemPropertyName: itemProperty.propertyName,\n itemPropertyLocalId: itemProperty.localId,\n seedLocalId,\n versionLocalId: itemProperty.versionLocalId!,\n transactionToSign: transaction,\n })\n }\n\n return uploads\n}\n\nasync function appendCoPublishedImageUploads(\n item: IItem<any>,\n uploads: PublishUpload[],\n options?: GetPublishUploadsOptions,\n): Promise<PublishUpload[]> {\n const appDb = BaseDb.getAppDb()\n if (!appDb || options?.onlyHtmlStorageSeedLocalIds?.length) return uploads\n\n const rows = await appDb\n .select()\n .from(htmlEmbeddedImageCoPublish)\n .where(eq(htmlEmbeddedImageCoPublish.parentSeedLocalId, item.seedLocalId))\n\n const seen = new Set(uploads.map((u) => u.seedLocalId))\n\n for (const row of rows) {\n if (seen.has(row.imageSeedLocalId)) continue\n const imageItem = await Item.find({ seedLocalId: row.imageSeedLocalId, modelName: 'Image' })\n if (!imageItem) continue\n const st =\n imageItem.internalProperties['storageTransactionId'] ??\n imageItem.allProperties['storageTransactionId']\n const stSnap = st?.getService().getSnapshot()\n const stCtx = stSnap && 'context' in stSnap ? stSnap.context : undefined\n const stValue = typeof (stCtx as { propertyValue?: unknown } | undefined)?.propertyValue === 'string'\n ? ((stCtx as { propertyValue?: string }).propertyValue ?? '')\n : ''\n const decoded = decodeDataUriImage(stValue)\n\n const more: PublishUpload[] = []\n if (decoded && st && st.localId && st.versionLocalId) {\n const contentHash = await getContentHash(decoded.bytes)\n const transaction = await prepareArweaveTransaction(\n decoded.bytes,\n contentHash,\n decoded.mimeType,\n options?.arweaveUploadTags,\n )\n more.push({\n itemPropertyName: st.propertyName,\n itemPropertyLocalId: st.localId,\n seedLocalId: imageItem.seedLocalId,\n versionLocalId: st.versionLocalId,\n transactionToSign: transaction,\n })\n }\n for (const u of more) {\n if (!seen.has(u.seedLocalId)) {\n uploads.push(u)\n seen.add(u.seedLocalId)\n }\n }\n }\n return uploads\n}\n\nexport type UploadProperty = {\n itemProperty: IItemProperty<any>\n childProperties: IItemProperty<any>[]\n}\ntype ChildUploadData = {\n propertyName: string\n localStoragePath: string\n}\n\n/**\n * True if publish would include at least one Arweave upload (local file / storage seed present).\n * Does not create Arweave transactions or hit the network — use for routing (e.g. skip EAS-only)\n * when {@link getPublishUploads} would fail early (e.g. gateway unreachable during tx creation).\n */\nasync function storageSeedHasUploadCandidates(\n itemStorageSeedProperties: IItemProperty<any>[],\n): Promise<boolean> {\n for (const itemProperty of itemStorageSeedProperties) {\n const snapshot = itemProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const propertyValue = (context as any).propertyValue\n const refResolvedValue = (context as any).refResolvedValue\n if (!refResolvedValue) {\n continue\n }\n\n const { seedLocalId } = resolveSeedIdsFromRefString(\n normalizeRelationPropertyValue(propertyValue) ?? '',\n )\n if (!seedLocalId) {\n continue\n }\n\n const dataType =\n itemProperty.propertyDef?.refValueType ??\n itemProperty.propertyDef?.dataType ??\n 'Image'\n const baseDir = getStorageDirForDataType(dataType)\n const filePath = `${baseDir}/${refResolvedValue}`\n\n if (await BaseFileManager.pathExists(filePath)) {\n return true\n }\n }\n\n return false\n}\n\nasync function uploadPropertyWouldUpload(\n uploadProperty: UploadProperty,\n relatedItemProperty?: IItemProperty<any>,\n): Promise<boolean> {\n const childUploads: ChildUploadData[] = []\n\n for (const childProperty of uploadProperty.childProperties) {\n const filePath = childProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n continue\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n continue\n }\n\n childUploads.push({\n propertyName: childProperty.propertyName,\n localStoragePath: filePath,\n })\n }\n\n if (childUploads.length > 0) {\n return true\n }\n\n if (relatedItemProperty && relatedItemProperty.localStoragePath) {\n const filePath = relatedItemProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n return false\n }\n\n return await BaseFileManager.pathExists(filePath)\n }\n\n return false\n}\n\nexport async function itemHasPublishUploadCandidates(\n item: IItem<any>,\n relatedItemProperty?: IItemProperty<any>,\n): Promise<boolean> {\n const { itemUploadProperties, itemRelationProperties, itemImageProperties } =\n await getSegmentedItemProperties(item)\n\n for (const uploadProperty of itemUploadProperties) {\n if (await uploadPropertyWouldUpload(uploadProperty, relatedItemProperty)) {\n return true\n }\n }\n\n if (await storageSeedHasUploadCandidates(itemImageProperties)) {\n return true\n }\n\n for (const relationProperty of itemRelationProperties) {\n const snapshot = relationProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const propertyValue = (context as any).propertyValue\n\n if (!propertyValue || relationProperty.uid) {\n continue\n }\n\n const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(\n normalizeRelationPropertyValue(propertyValue) ?? '',\n )\n if (!seedLocalId && !seedUid) {\n throw new Error(\n `Invalid relation value for ${relationProperty.propertyName}: expected local seed id or 0x uid`,\n )\n }\n\n const relatedItem = await Item.find({\n seedLocalId,\n seedUid,\n })\n\n if (!relatedItem) {\n throw new Error(\n `No relatedItem found for ${relationProperty.propertyName}`,\n )\n }\n\n if (await itemHasPublishUploadCandidates(relatedItem, relationProperty)) {\n return true\n }\n }\n\n return false\n}\n\nconst processUploadProperty = async (\n uploadProperty: UploadProperty,\n uploads: PublishUpload[],\n relatedItemProperty?: IItemProperty<any>,\n options?: GetPublishUploadsOptions,\n): Promise<PublishUpload[]> => {\n const extra = options?.arweaveUploadTags\n const itemProperty = uploadProperty.itemProperty\n\n const childUploads: ChildUploadData[] = []\n\n for (const childProperty of uploadProperty.childProperties) {\n const filePath = childProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n continue\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n continue\n }\n\n childUploads.push({\n propertyName: childProperty.propertyName,\n localStoragePath: filePath,\n })\n }\n\n let fileContents\n let transaction: ArweaveTransaction\n\n if (!childUploads || childUploads.length === 0) {\n if (relatedItemProperty && relatedItemProperty.localStoragePath) {\n const filePath = relatedItemProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n return uploads\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n return uploads\n }\n\n try {\n const fileBuffer = await BaseFileManager.readFileAsBuffer(filePath)\n fileContents = await toUint8Array(fileBuffer)\n } catch (e) {\n const fs = await BaseFileManager.getFs()\n fileContents = await toUint8Array(fs.readFileSync(filePath))\n }\n }\n if (!fileContents) {\n return uploads\n }\n }\n\n if (childUploads.length > 0) {\n const separator = '===FILE_SEPARATOR==='\n // let compositeFileContents = `${itemProperty.propertyName}${separator}${mainFileContents}`\n let compositeFileContents = ''\n\n for (const childUpload of childUploads) {\n let childUploadContents\n\n const fs = await BaseFileManager.getFs()\n\n try {\n childUploadContents = await fs.promises.readFile(\n childUpload.localStoragePath,\n )\n } catch (e) {\n childUploadContents = fs.readFileSync(childUpload.localStoragePath)\n }\n\n compositeFileContents += `${separator}${childUpload.propertyName}${separator}${childUploadContents}`\n }\n\n if (typeof document !== 'undefined') {\n fileContents = new TextEncoder().encode(compositeFileContents)\n } else {\n fileContents = Buffer.from(compositeFileContents)\n }\n }\n\n if (!fileContents) {\n throw new Error(`No file contents found for ${itemProperty.propertyName}`)\n }\n\n const uint8Array = new Uint8Array(fileContents)\n\n const contentHash = await getContentHash(uint8Array)\n\n let contentType: string | undefined\n if (childUploads.length === 0 && relatedItemProperty?.localStoragePath) {\n contentType = getMimeTypeFromPath(relatedItemProperty.localStoragePath)\n } else if (childUploads.length > 0) {\n contentType = 'application/octet-stream'\n }\n\n transaction = await prepareArweaveTransaction(\n uint8Array,\n contentHash,\n contentType,\n extra,\n )\n\n let itemPropertyLocalId = relatedItemProperty\n ? relatedItemProperty.localId\n : itemProperty.localId\n let itemPropertyName = relatedItemProperty\n ? relatedItemProperty.propertyName\n : itemProperty.propertyName\n\n uploads.push({\n itemPropertyName,\n itemPropertyLocalId,\n seedLocalId: itemProperty.seedLocalId!,\n versionLocalId: itemProperty.versionLocalId!,\n transactionToSign: transaction,\n })\n\n return uploads\n}\n\nexport const getPublishUploads = async (\n item: IItem<any>,\n uploads: PublishUpload[] = [],\n relatedItemProperty?: IItemProperty<any>,\n options?: GetPublishUploadsOptions,\n) => {\n const { itemUploadProperties, itemRelationProperties, itemImageProperties } =\n await getSegmentedItemProperties(item)\n\n if (!relatedItemProperty && options?.onlyHtmlStorageSeedLocalIds?.length) {\n const storageSeedUploads = await getStorageSeedUploads(itemImageProperties, options)\n uploads.push(...storageSeedUploads)\n return uploads\n }\n\n for (const uploadProperty of itemUploadProperties) {\n uploads = await processUploadProperty(\n uploadProperty,\n uploads,\n relatedItemProperty,\n options,\n )\n }\n\n const storageSeedUploads = await getStorageSeedUploads(itemImageProperties, options)\n uploads.push(...storageSeedUploads)\n\n if (!relatedItemProperty && !options?.onlyHtmlStorageSeedLocalIds?.length) {\n uploads = await appendCoPublishedImageUploads(item, uploads, options)\n }\n\n if (options?.skipRelationRecursion) {\n return uploads\n }\n\n for (const relationProperty of itemRelationProperties) {\n const snapshot = relationProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const propertyValue = (context as any).propertyValue\n\n if (!propertyValue || relationProperty.uid) {\n continue\n }\n\n const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(\n normalizeRelationPropertyValue(propertyValue) ?? '',\n )\n if (!seedLocalId && !seedUid) {\n throw new Error(\n `Invalid relation value for ${relationProperty.propertyName}: expected local seed id or 0x uid`,\n )\n }\n\n const relatedItem = await Item.find({\n seedLocalId,\n seedUid,\n })\n\n if (!relatedItem) {\n throw new Error(\n `No relatedItem found for ${relationProperty.propertyName}`,\n )\n }\n\n uploads = await getPublishUploads(relatedItem, uploads, relationProperty, options)\n }\n\n return uploads\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,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;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YAClC,WAAW;YACX,OAAO;AACR,SAAA,CAAC;QAEF,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CACb,CAAA,yBAAA,EAA4B,gBAAgB,CAAC,YAAY,CAAA,CAAE,CAC5D;QACH;AAEA,QAAA,OAAO,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,CAAC;IACpF;AAEA,IAAA,OAAO,OAAO;AAChB;;;;"}
|
|
1
|
+
{"version":3,"file":"getPublishUploads-BeukCBiR.js","sources":["../../src/db/read/getPublishUploads.ts"],"sourcesContent":["import { BaseFileManager } from '@/helpers'\nimport {\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 } from '@/helpers/property'\n\nconst logger = debug('seedSdk:item:getPublishUploads')\n\n/** Optional tags merged into each Arweave tx after Content-SHA-256 / Content-Type. */\nexport type GetPublishUploadsOptions = {\n arweaveUploadTags?: TransactionTag[]\n /**\n * Html storage seed local ids to skip (phase 1 of two-phase embedded-image publish).\n */\n deferHtmlStorageSeedLocalIds?: string[]\n /**\n * When set, only Html storage seeds in this list are included (phase 2). Non-Html storage uploads are omitted.\n */\n onlyHtmlStorageSeedLocalIds?: string[]\n /** When true, do not recurse into relation properties (phase 2 must not re-upload related items). */\n skipRelationRecursion?: boolean\n}\n\nconst EXTENSION_TO_MIME: Record<string, string> = {\n png: 'image/png',\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n gif: 'image/gif',\n webp: 'image/webp',\n svg: 'image/svg+xml',\n html: 'text/html',\n htm: 'text/html',\n json: 'application/json',\n txt: 'text/plain',\n}\n\nconst getMimeTypeFromPath = (filePathOrName: string): string | undefined => {\n const ext = filePathOrName.split('.').pop()?.toLowerCase()\n return ext ? EXTENSION_TO_MIME[ext] : undefined\n}\n\nconst toUint8Array = async (data: Buffer | Blob): Promise<Uint8Array> => {\n if (typeof Blob !== 'undefined' && data instanceof Blob) {\n return new Uint8Array(await data.arrayBuffer())\n }\n return new Uint8Array(data as Buffer)\n}\n\nexport const prepareArweaveTransaction = async (\n data: string | Uint8Array,\n contentHash: string | undefined,\n contentType?: string,\n additionalTags?: TransactionTag[],\n): Promise<ArweaveTransaction> => {\n const tags: TransactionTag[] = []\n if (contentHash) {\n tags.push({ name: 'Content-SHA-256', value: contentHash })\n logger('contentHash', contentHash)\n logger('adding content hash tag')\n }\n if (contentType) {\n tags.push({ name: 'Content-Type', value: contentType })\n }\n if (additionalTags?.length) {\n tags.push(...additionalTags)\n }\n\n const tx = await BaseArweaveClient.createTransaction(data, {\n tags: tags.length ? tags : undefined,\n })\n\n return tx\n}\n\n\nconst getStorageDirForDataType = (dataType: string): string => {\n switch (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 (dataType === ModelPropertyDataTypes.Html) {\n if (options?.deferHtmlStorageSeedLocalIds?.includes(seedLocalId)) {\n continue\n }\n if (\n options?.onlyHtmlStorageSeedLocalIds?.length &&\n !options.onlyHtmlStorageSeedLocalIds.includes(seedLocalId)\n ) {\n continue\n }\n } else if (options?.onlyHtmlStorageSeedLocalIds?.length) {\n continue\n }\n\n const baseDir = getStorageDirForDataType(dataType)\n const filePath = `${baseDir}/${refResolvedValue}`\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n continue\n }\n\n const fileBuffer = await BaseFileManager.readFileAsBuffer(filePath)\n const fileContents = await toUint8Array(fileBuffer)\n\n const contentHash = await getContentHash(fileContents)\n const contentType = getMimeTypeFromPath(refResolvedValue)\n\n const transaction = await prepareArweaveTransaction(\n fileContents,\n contentHash,\n contentType,\n extra,\n )\n\n uploads.push({\n itemPropertyName: itemProperty.propertyName,\n itemPropertyLocalId: itemProperty.localId,\n seedLocalId,\n versionLocalId: itemProperty.versionLocalId!,\n transactionToSign: transaction,\n })\n }\n\n return uploads\n}\n\nasync function appendCoPublishedImageUploads(\n item: IItem<any>,\n uploads: PublishUpload[],\n options?: GetPublishUploadsOptions,\n): Promise<PublishUpload[]> {\n const appDb = BaseDb.getAppDb()\n if (!appDb || options?.onlyHtmlStorageSeedLocalIds?.length) return uploads\n\n const rows = await appDb\n .select()\n .from(htmlEmbeddedImageCoPublish)\n .where(eq(htmlEmbeddedImageCoPublish.parentSeedLocalId, item.seedLocalId))\n\n const seen = new Set(uploads.map((u) => u.seedLocalId))\n\n for (const row of rows) {\n if (seen.has(row.imageSeedLocalId)) continue\n const imageItem = await Item.find({ seedLocalId: row.imageSeedLocalId, modelName: 'Image' })\n if (!imageItem) continue\n const st =\n imageItem.internalProperties['storageTransactionId'] ??\n imageItem.allProperties['storageTransactionId']\n const stSnap = st?.getService().getSnapshot()\n const stCtx = stSnap && 'context' in stSnap ? stSnap.context : undefined\n const stValue = typeof (stCtx as { propertyValue?: unknown } | undefined)?.propertyValue === 'string'\n ? ((stCtx as { propertyValue?: string }).propertyValue ?? '')\n : ''\n const decoded = decodeDataUriImage(stValue)\n\n const more: PublishUpload[] = []\n if (decoded && st && st.localId && st.versionLocalId) {\n const contentHash = await getContentHash(decoded.bytes)\n const transaction = await prepareArweaveTransaction(\n decoded.bytes,\n contentHash,\n decoded.mimeType,\n options?.arweaveUploadTags,\n )\n more.push({\n itemPropertyName: st.propertyName,\n itemPropertyLocalId: st.localId,\n seedLocalId: imageItem.seedLocalId,\n versionLocalId: st.versionLocalId,\n transactionToSign: transaction,\n })\n }\n for (const u of more) {\n if (!seen.has(u.seedLocalId)) {\n uploads.push(u)\n seen.add(u.seedLocalId)\n }\n }\n }\n return uploads\n}\n\nexport type UploadProperty = {\n itemProperty: IItemProperty<any>\n childProperties: IItemProperty<any>[]\n}\ntype ChildUploadData = {\n propertyName: string\n localStoragePath: string\n}\n\n/**\n * True if publish would include at least one Arweave upload (local file / storage seed present).\n * Does not create Arweave transactions or hit the network — use for routing (e.g. skip EAS-only)\n * when {@link getPublishUploads} would fail early (e.g. gateway unreachable during tx creation).\n */\nasync function storageSeedHasUploadCandidates(\n itemStorageSeedProperties: IItemProperty<any>[],\n): Promise<boolean> {\n for (const itemProperty of itemStorageSeedProperties) {\n const snapshot = itemProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const propertyValue = (context as any).propertyValue\n const refResolvedValue = (context as any).refResolvedValue\n if (!refResolvedValue) {\n continue\n }\n\n const { seedLocalId } = resolveSeedIdsFromRefString(\n normalizeRelationPropertyValue(propertyValue) ?? '',\n )\n if (!seedLocalId) {\n continue\n }\n\n const dataType =\n itemProperty.propertyDef?.refValueType ??\n itemProperty.propertyDef?.dataType ??\n 'Image'\n const baseDir = getStorageDirForDataType(dataType)\n const filePath = `${baseDir}/${refResolvedValue}`\n\n if (await BaseFileManager.pathExists(filePath)) {\n return true\n }\n }\n\n return false\n}\n\nasync function uploadPropertyWouldUpload(\n uploadProperty: UploadProperty,\n relatedItemProperty?: IItemProperty<any>,\n): Promise<boolean> {\n const childUploads: ChildUploadData[] = []\n\n for (const childProperty of uploadProperty.childProperties) {\n const filePath = childProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n continue\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n continue\n }\n\n childUploads.push({\n propertyName: childProperty.propertyName,\n localStoragePath: filePath,\n })\n }\n\n if (childUploads.length > 0) {\n return true\n }\n\n if (relatedItemProperty && relatedItemProperty.localStoragePath) {\n const filePath = relatedItemProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n return false\n }\n\n return await BaseFileManager.pathExists(filePath)\n }\n\n return false\n}\n\nexport async function itemHasPublishUploadCandidates(\n item: IItem<any>,\n relatedItemProperty?: IItemProperty<any>,\n): Promise<boolean> {\n const { itemUploadProperties, itemRelationProperties, itemImageProperties } =\n await getSegmentedItemProperties(item)\n\n for (const uploadProperty of itemUploadProperties) {\n if (await uploadPropertyWouldUpload(uploadProperty, relatedItemProperty)) {\n return true\n }\n }\n\n if (await storageSeedHasUploadCandidates(itemImageProperties)) {\n return true\n }\n\n for (const relationProperty of itemRelationProperties) {\n const snapshot = relationProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const propertyValue = (context as any).propertyValue\n\n if (!propertyValue || relationProperty.uid) {\n continue\n }\n\n const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(\n normalizeRelationPropertyValue(propertyValue) ?? '',\n )\n if (!seedLocalId && !seedUid) {\n throw new Error(\n `Invalid relation value for ${relationProperty.propertyName}: expected local seed id or 0x uid`,\n )\n }\n\n const relatedItem = await Item.find({\n seedLocalId,\n seedUid,\n })\n\n if (!relatedItem) {\n throw new Error(\n `No relatedItem found for ${relationProperty.propertyName}`,\n )\n }\n\n if (await itemHasPublishUploadCandidates(relatedItem, relationProperty)) {\n return true\n }\n }\n\n return false\n}\n\nconst processUploadProperty = async (\n uploadProperty: UploadProperty,\n uploads: PublishUpload[],\n relatedItemProperty?: IItemProperty<any>,\n options?: GetPublishUploadsOptions,\n): Promise<PublishUpload[]> => {\n const extra = options?.arweaveUploadTags\n const itemProperty = uploadProperty.itemProperty\n\n const childUploads: ChildUploadData[] = []\n\n for (const childProperty of uploadProperty.childProperties) {\n const filePath = childProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n continue\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n continue\n }\n\n childUploads.push({\n propertyName: childProperty.propertyName,\n localStoragePath: filePath,\n })\n }\n\n let fileContents\n let transaction: ArweaveTransaction\n\n if (!childUploads || childUploads.length === 0) {\n if (relatedItemProperty && relatedItemProperty.localStoragePath) {\n const filePath = relatedItemProperty.localStoragePath\n\n if (!filePath || filePath.endsWith('undefined')) {\n return uploads\n }\n\n const exists = await BaseFileManager.pathExists(filePath)\n if (!exists) {\n return uploads\n }\n\n try {\n const fileBuffer = await BaseFileManager.readFileAsBuffer(filePath)\n fileContents = await toUint8Array(fileBuffer)\n } catch (e) {\n const fs = await BaseFileManager.getFs()\n fileContents = await toUint8Array(fs.readFileSync(filePath))\n }\n }\n if (!fileContents) {\n return uploads\n }\n }\n\n if (childUploads.length > 0) {\n const separator = '===FILE_SEPARATOR==='\n // let compositeFileContents = `${itemProperty.propertyName}${separator}${mainFileContents}`\n let compositeFileContents = ''\n\n for (const childUpload of childUploads) {\n let childUploadContents\n\n const fs = await BaseFileManager.getFs()\n\n try {\n childUploadContents = await fs.promises.readFile(\n childUpload.localStoragePath,\n )\n } catch (e) {\n childUploadContents = fs.readFileSync(childUpload.localStoragePath)\n }\n\n compositeFileContents += `${separator}${childUpload.propertyName}${separator}${childUploadContents}`\n }\n\n if (typeof document !== 'undefined') {\n fileContents = new TextEncoder().encode(compositeFileContents)\n } else {\n fileContents = Buffer.from(compositeFileContents)\n }\n }\n\n if (!fileContents) {\n throw new Error(`No file contents found for ${itemProperty.propertyName}`)\n }\n\n const uint8Array = new Uint8Array(fileContents)\n\n const contentHash = await getContentHash(uint8Array)\n\n let contentType: string | undefined\n if (childUploads.length === 0 && relatedItemProperty?.localStoragePath) {\n contentType = getMimeTypeFromPath(relatedItemProperty.localStoragePath)\n } else if (childUploads.length > 0) {\n contentType = 'application/octet-stream'\n }\n\n transaction = await prepareArweaveTransaction(\n uint8Array,\n contentHash,\n contentType,\n extra,\n )\n\n let itemPropertyLocalId = relatedItemProperty\n ? relatedItemProperty.localId\n : itemProperty.localId\n let itemPropertyName = relatedItemProperty\n ? relatedItemProperty.propertyName\n : itemProperty.propertyName\n\n uploads.push({\n itemPropertyName,\n itemPropertyLocalId,\n seedLocalId: itemProperty.seedLocalId!,\n versionLocalId: itemProperty.versionLocalId!,\n transactionToSign: transaction,\n })\n\n return uploads\n}\n\nexport const getPublishUploads = async (\n item: IItem<any>,\n uploads: PublishUpload[] = [],\n relatedItemProperty?: IItemProperty<any>,\n options?: GetPublishUploadsOptions,\n) => {\n const { itemUploadProperties, itemRelationProperties, itemImageProperties } =\n await getSegmentedItemProperties(item)\n\n if (!relatedItemProperty && options?.onlyHtmlStorageSeedLocalIds?.length) {\n const storageSeedUploads = await getStorageSeedUploads(itemImageProperties, options)\n uploads.push(...storageSeedUploads)\n return uploads\n }\n\n for (const uploadProperty of itemUploadProperties) {\n uploads = await processUploadProperty(\n uploadProperty,\n uploads,\n relatedItemProperty,\n options,\n )\n }\n\n const storageSeedUploads = await getStorageSeedUploads(itemImageProperties, options)\n uploads.push(...storageSeedUploads)\n\n if (!relatedItemProperty && !options?.onlyHtmlStorageSeedLocalIds?.length) {\n uploads = await appendCoPublishedImageUploads(item, uploads, options)\n }\n\n if (options?.skipRelationRecursion) {\n return uploads\n }\n\n for (const relationProperty of itemRelationProperties) {\n const snapshot = relationProperty.getService().getSnapshot()\n const context = 'context' in snapshot ? snapshot.context : null\n if (!context) {\n continue\n }\n const propertyValue = (context as any).propertyValue\n\n if (!propertyValue || relationProperty.uid) {\n continue\n }\n\n const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(\n normalizeRelationPropertyValue(propertyValue) ?? '',\n )\n if (!seedLocalId && !seedUid) {\n throw new Error(\n `Invalid relation value for ${relationProperty.propertyName}: expected local seed id or 0x uid`,\n )\n }\n\n const relatedItem = await Item.find({\n seedLocalId,\n seedUid,\n })\n\n if (!relatedItem) {\n throw new Error(\n `No relatedItem found for ${relationProperty.propertyName}`,\n )\n }\n\n uploads = await getPublishUploads(relatedItem, uploads, relationProperty, options)\n }\n\n return uploads\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,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,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B,gBAAgB,CAAC,YAAY,CAAA,kCAAA,CAAoC,CAChG;QACH;AAEA,QAAA,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC;YAClC,WAAW;YACX,OAAO;AACR,SAAA,CAAC;QAEF,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CACb,CAAA,yBAAA,EAA4B,gBAAgB,CAAC,YAAY,CAAA,CAAE,CAC5D;QACH;AAEA,QAAA,OAAO,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,CAAC;IACpF;AAEA,IAAA,OAAO,OAAO;AAChB;;;;"}
|
package/dist/{getSegmentedItemProperties-BLU_UBYI.js → getSegmentedItemProperties-B_yciZHD.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { b as ModelPropertyDataTypes, p as BaseDb, A as models, C as properties } from './index-
|
|
3
|
-
import { getPropertySchema } from './property-
|
|
2
|
+
import { b as ModelPropertyDataTypes, p as BaseDb, A as models, C as properties } from './index-C3oIxmh-.js';
|
|
3
|
+
import { getPropertySchema } from './property-DlfKPjHu.js';
|
|
4
4
|
import { eq, and } from 'drizzle-orm';
|
|
5
5
|
import { upperFirst, camelCase } from 'lodash-es';
|
|
6
6
|
|
|
@@ -142,4 +142,4 @@ const getSegmentedItemProperties = async (item) => {
|
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
export { getSegmentedItemProperties as g };
|
|
145
|
-
//# sourceMappingURL=getSegmentedItemProperties-
|
|
145
|
+
//# sourceMappingURL=getSegmentedItemProperties-B_yciZHD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSegmentedItemProperties-BLU_UBYI.js","sources":["../../src/helpers/getSegmentedItemProperties.ts"],"sourcesContent":["import { UploadProperty } from '@/db/read/getPublishUploads'\nimport { IItem } from '@/interfaces'\nimport { ModelPropertyDataTypes } from '@/Schema'\nimport { getPropertySchema, TProperty } from '@/helpers/property'\nimport type { Static } from '@sinclair/typebox'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { models, properties } from '@/seedSchema'\nimport { eq, and } from 'drizzle-orm'\nimport { camelCase, upperFirst } from 'lodash-es'\nasync function resolvePropertyDef(\n modelName: string,\n propertyName: string,\n): Promise<{ dataType?: string; ref?: string; refValueType?: string; storageType?: string; localStorageDir?: string; filenameSuffix?: string; required?: boolean } | undefined> {\n let schema = await getPropertySchema(modelName, propertyName)\n if (schema) return schema\n const db = BaseDb.getAppDb()\n if (!db) return undefined\n try {\n const normalizedModelName = upperFirst(camelCase(modelName))\n const modelRecords = await db\n .select({ id: models.id })\n .from(models)\n .where(eq(models.name, normalizedModelName))\n .limit(1)\n if (modelRecords.length === 0 || !modelRecords[0].id) return undefined\n const propertyRecords = await db\n .select()\n .from(properties)\n .where(\n and(\n eq(properties.modelId, modelRecords[0].id),\n eq(properties.name, propertyName),\n ),\n )\n .limit(1)\n if (propertyRecords.length === 0) return undefined\n const propRecord = propertyRecords[0]\n let refModelName: string | undefined\n if (propRecord.refModelId != null) {\n const refModelRows = await db\n .select({ name: models.name })\n .from(models)\n .where(eq(models.id, propRecord.refModelId))\n .limit(1)\n refModelName = refModelRows[0]?.name ?? undefined\n }\n return {\n dataType: propRecord.dataType,\n ref: refModelName ?? undefined,\n refValueType: propRecord.refValueType || undefined,\n storageType: propRecord.storageType || undefined,\n localStorageDir: propRecord.localStorageDir || undefined,\n filenameSuffix: propRecord.filenameSuffix || undefined,\n required: propRecord.required ?? undefined,\n }\n } catch {\n return undefined\n }\n}\n\nexport const getSegmentedItemProperties = async (item: IItem<any>) => {\n const itemBasicProperties = []\n const itemRelationProperties = []\n const itemListProperties = []\n const itemUploadProperties: UploadProperty[] = []\n const itemImageProperties = []\n const itemStorageProperties = []\n let itemStorageTransactionProperty: UploadProperty | undefined\n\n for (const itemProperty of item.properties) {\n let propertyDef = itemProperty.propertyDef\n // When propertyDef is missing (e.g. external app, Model not registered), resolve inline\n // so properties are not skipped and metadata attestations can be created\n if (!propertyDef && item.modelName) {\n const resolved = await resolvePropertyDef(item.modelName, itemProperty.propertyName)\n if (resolved) {\n itemProperty.getService().send({ type: 'updateContext', propertyRecordSchema: resolved })\n propertyDef = resolved as Static<typeof TProperty>\n } else {\n // Last resort: Model and DB don't have schema. Use Text so property routes to\n // itemBasicProperties and can be attested (covers title, description, etc.)\n const fallbackDef = { dataType: 'Text' as const }\n itemProperty.getService().send({ type: 'updateContext', propertyRecordSchema: fallbackDef })\n propertyDef = fallbackDef as Static<typeof TProperty>\n }\n }\n if (!propertyDef) {\n continue\n }\n\n const isItemStorage =\n propertyDef.storageType &&\n propertyDef.storageType === 'ItemStorage'\n\n\n const isStorageTransaction =\n itemProperty.propertyName === 'storageTransactionId' ||\n itemProperty.propertyName === 'storage_transaction_id'\n\n const isStorageSeedType =\n propertyDef.dataType === ModelPropertyDataTypes.Image ||\n propertyDef.dataType === ModelPropertyDataTypes.File ||\n propertyDef.dataType === ModelPropertyDataTypes.Html ||\n propertyDef.dataType === ModelPropertyDataTypes.Json ||\n (propertyDef.dataType === ModelPropertyDataTypes.Relation &&\n (propertyDef.refValueType === ModelPropertyDataTypes.Image ||\n propertyDef.refValueType === ModelPropertyDataTypes.File ||\n propertyDef.refValueType === ModelPropertyDataTypes.Html ||\n propertyDef.refValueType === ModelPropertyDataTypes.Json))\n\n if (isStorageSeedType) {\n itemImageProperties.push(itemProperty)\n if (propertyDef.dataType === ModelPropertyDataTypes.Relation) {\n itemRelationProperties.push(itemProperty)\n }\n continue\n }\n\n if (propertyDef.dataType === ModelPropertyDataTypes.Relation) {\n itemRelationProperties.push(itemProperty)\n continue\n }\n\n if (propertyDef.dataType === ModelPropertyDataTypes.List) {\n // List-of-relations: ref present, goes to processListProperty\n // List-of-primitives: ref absent, treat as basic property\n const listRef =\n propertyDef.ref || (propertyDef as { refModelName?: string }).refModelName\n if (listRef) {\n itemListProperties.push(itemProperty)\n } else {\n itemBasicProperties.push(itemProperty)\n }\n continue\n }\n\n if (isItemStorage) {\n itemStorageProperties.push(itemProperty)\n continue\n }\n\n if (isStorageTransaction) {\n itemStorageTransactionProperty = { itemProperty, childProperties: [] }\n continue\n }\n\n itemBasicProperties.push(itemProperty)\n }\n\n if (itemStorageTransactionProperty && itemStorageProperties.length > 0) {\n itemStorageTransactionProperty.childProperties = itemStorageProperties\n }\n\n if (itemStorageTransactionProperty) {\n itemUploadProperties.push(itemStorageTransactionProperty)\n }\n\n return {\n itemBasicProperties,\n itemRelationProperties,\n itemListProperties,\n itemUploadProperties,\n itemImageProperties,\n }\n}\n"],"names":[],"mappings":";;;;;;AASA,eAAe,kBAAkB,CAC/B,SAAiB,EACjB,YAAoB,EAAA;IAEpB,IAAI,MAAM,GAAG,MAAM,iBAAiB,CAAC,SAAS,EAAE,YAAY,CAAC;AAC7D,IAAA,IAAI,MAAM;AAAE,QAAA,OAAO,MAAM;AACzB,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE;AAC5B,IAAA,IAAI,CAAC,EAAE;AAAE,QAAA,OAAO,SAAS;AACzB,IAAA,IAAI;QACF,MAAM,mBAAmB,GAAG,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC5D,MAAM,YAAY,GAAG,MAAM;aACxB,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE;aACxB,IAAI,CAAC,MAAM;aACX,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,mBAAmB,CAAC;aAC1C,KAAK,CAAC,CAAC,CAAC;AACX,QAAA,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE;AAAE,YAAA,OAAO,SAAS;QACtE,MAAM,eAAe,GAAG,MAAM;AAC3B,aAAA,MAAM;aACN,IAAI,CAAC,UAAU;aACf,KAAK,CACJ,GAAG,CACD,EAAE,CAAC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,8BAA8B,IAAI,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE;AACtE,QAAA,8BAA8B,CAAC,eAAe,GAAG,qBAAqB;IACxE;IAEA,IAAI,8BAA8B,EAAE;AAClC,QAAA,oBAAoB,CAAC,IAAI,CAAC,8BAA8B,CAAC;IAC3D;IAEA,OAAO;QACL,mBAAmB;QACnB,sBAAsB;QACtB,kBAAkB;QAClB,oBAAoB;QACpB,mBAAmB;KACpB;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"getSegmentedItemProperties-B_yciZHD.js","sources":["../../src/helpers/getSegmentedItemProperties.ts"],"sourcesContent":["import { UploadProperty } from '@/db/read/getPublishUploads'\nimport { IItem } from '@/interfaces'\nimport { ModelPropertyDataTypes } from '@/Schema'\nimport { getPropertySchema, TProperty } from '@/helpers/property'\nimport type { Static } from '@sinclair/typebox'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { models, properties } from '@/seedSchema'\nimport { eq, and } from 'drizzle-orm'\nimport { camelCase, upperFirst } from 'lodash-es'\nasync function resolvePropertyDef(\n modelName: string,\n propertyName: string,\n): Promise<{ dataType?: string; ref?: string; refValueType?: string; storageType?: string; localStorageDir?: string; filenameSuffix?: string; required?: boolean } | undefined> {\n let schema = await getPropertySchema(modelName, propertyName)\n if (schema) return schema\n const db = BaseDb.getAppDb()\n if (!db) return undefined\n try {\n const normalizedModelName = upperFirst(camelCase(modelName))\n const modelRecords = await db\n .select({ id: models.id })\n .from(models)\n .where(eq(models.name, normalizedModelName))\n .limit(1)\n if (modelRecords.length === 0 || !modelRecords[0].id) return undefined\n const propertyRecords = await db\n .select()\n .from(properties)\n .where(\n and(\n eq(properties.modelId, modelRecords[0].id),\n eq(properties.name, propertyName),\n ),\n )\n .limit(1)\n if (propertyRecords.length === 0) return undefined\n const propRecord = propertyRecords[0]\n let refModelName: string | undefined\n if (propRecord.refModelId != null) {\n const refModelRows = await db\n .select({ name: models.name })\n .from(models)\n .where(eq(models.id, propRecord.refModelId))\n .limit(1)\n refModelName = refModelRows[0]?.name ?? undefined\n }\n return {\n dataType: propRecord.dataType,\n ref: refModelName ?? undefined,\n refValueType: propRecord.refValueType || undefined,\n storageType: propRecord.storageType || undefined,\n localStorageDir: propRecord.localStorageDir || undefined,\n filenameSuffix: propRecord.filenameSuffix || undefined,\n required: propRecord.required ?? undefined,\n }\n } catch {\n return undefined\n }\n}\n\nexport const getSegmentedItemProperties = async (item: IItem<any>) => {\n const itemBasicProperties = []\n const itemRelationProperties = []\n const itemListProperties = []\n const itemUploadProperties: UploadProperty[] = []\n const itemImageProperties = []\n const itemStorageProperties = []\n let itemStorageTransactionProperty: UploadProperty | undefined\n\n for (const itemProperty of item.properties) {\n let propertyDef = itemProperty.propertyDef\n // When propertyDef is missing (e.g. external app, Model not registered), resolve inline\n // so properties are not skipped and metadata attestations can be created\n if (!propertyDef && item.modelName) {\n const resolved = await resolvePropertyDef(item.modelName, itemProperty.propertyName)\n if (resolved) {\n itemProperty.getService().send({ type: 'updateContext', propertyRecordSchema: resolved })\n propertyDef = resolved as Static<typeof TProperty>\n } else {\n // Last resort: Model and DB don't have schema. Use Text so property routes to\n // itemBasicProperties and can be attested (covers title, description, etc.)\n const fallbackDef = { dataType: 'Text' as const }\n itemProperty.getService().send({ type: 'updateContext', propertyRecordSchema: fallbackDef })\n propertyDef = fallbackDef as Static<typeof TProperty>\n }\n }\n if (!propertyDef) {\n continue\n }\n\n const isItemStorage =\n propertyDef.storageType &&\n propertyDef.storageType === 'ItemStorage'\n\n\n const isStorageTransaction =\n itemProperty.propertyName === 'storageTransactionId' ||\n itemProperty.propertyName === 'storage_transaction_id'\n\n const isStorageSeedType =\n propertyDef.dataType === ModelPropertyDataTypes.Image ||\n propertyDef.dataType === ModelPropertyDataTypes.File ||\n propertyDef.dataType === ModelPropertyDataTypes.Html ||\n propertyDef.dataType === ModelPropertyDataTypes.Json ||\n (propertyDef.dataType === ModelPropertyDataTypes.Relation &&\n (propertyDef.refValueType === ModelPropertyDataTypes.Image ||\n propertyDef.refValueType === ModelPropertyDataTypes.File ||\n propertyDef.refValueType === ModelPropertyDataTypes.Html ||\n propertyDef.refValueType === ModelPropertyDataTypes.Json))\n\n if (isStorageSeedType) {\n itemImageProperties.push(itemProperty)\n if (propertyDef.dataType === ModelPropertyDataTypes.Relation) {\n itemRelationProperties.push(itemProperty)\n }\n continue\n }\n\n if (propertyDef.dataType === ModelPropertyDataTypes.Relation) {\n itemRelationProperties.push(itemProperty)\n continue\n }\n\n if (propertyDef.dataType === ModelPropertyDataTypes.List) {\n // List-of-relations: ref present, goes to processListProperty\n // List-of-primitives: ref absent, treat as basic property\n const listRef =\n propertyDef.ref || (propertyDef as { refModelName?: string }).refModelName\n if (listRef) {\n itemListProperties.push(itemProperty)\n } else {\n itemBasicProperties.push(itemProperty)\n }\n continue\n }\n\n if (isItemStorage) {\n itemStorageProperties.push(itemProperty)\n continue\n }\n\n if (isStorageTransaction) {\n itemStorageTransactionProperty = { itemProperty, childProperties: [] }\n continue\n }\n\n itemBasicProperties.push(itemProperty)\n }\n\n if (itemStorageTransactionProperty && itemStorageProperties.length > 0) {\n itemStorageTransactionProperty.childProperties = itemStorageProperties\n }\n\n if (itemStorageTransactionProperty) {\n itemUploadProperties.push(itemStorageTransactionProperty)\n }\n\n return {\n itemBasicProperties,\n itemRelationProperties,\n itemListProperties,\n itemUploadProperties,\n itemImageProperties,\n }\n}\n"],"names":[],"mappings":";;;;;;AASA,eAAe,kBAAkB,CAC/B,SAAiB,EACjB,YAAoB,EAAA;IAEpB,IAAI,MAAM,GAAG,MAAM,iBAAiB,CAAC,SAAS,EAAE,YAAY,CAAC;AAC7D,IAAA,IAAI,MAAM;AAAE,QAAA,OAAO,MAAM;AACzB,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE;AAC5B,IAAA,IAAI,CAAC,EAAE;AAAE,QAAA,OAAO,SAAS;AACzB,IAAA,IAAI;QACF,MAAM,mBAAmB,GAAG,UAAU,CAAC,SAAS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,MAAM,OAAO,GACX,WAAW,CAAC,GAAG,IAAK,WAAyC,CAAC,YAAY;YAC5E,IAAI,OAAO,EAAE;AACX,gBAAA,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC;YACvC;iBAAO;AACL,gBAAA,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;YACxC;YACA;QACF;QAEA,IAAI,aAAa,EAAE;AACjB,YAAA,qBAAqB,CAAC,IAAI,CAAC,YAAY,CAAC;YACxC;QACF;QAEA,IAAI,oBAAoB,EAAE;YACxB,8BAA8B,GAAG,EAAE,YAAY,EAAE,eAAe,EAAE,EAAE,EAAE;YACtE;QACF;AAEA,QAAA,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC;IACxC;IAEA,IAAI,8BAA8B,IAAI,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE;AACtE,QAAA,8BAA8B,CAAC,eAAe,GAAG,qBAAqB;IACxE;IAEA,IAAI,8BAA8B,EAAE;AAClC,QAAA,oBAAoB,CAAC,IAAI,CAAC,8BAA8B,CAAC;IAC3D;IAEA,OAAO;QACL,mBAAmB;QACnB,sBAAsB;QACtB,kBAAkB;QAClB,oBAAoB;QACpB,mBAAmB;KACpB;AACH;;;;"}
|
|
@@ -2205,7 +2205,7 @@ const createPropertyInstances = async (propertyFileIds) => {
|
|
|
2205
2205
|
return;
|
|
2206
2206
|
}
|
|
2207
2207
|
try {
|
|
2208
|
-
const mod = await import('./ModelProperty-
|
|
2208
|
+
const mod = await import('./ModelProperty-jBpPbg3l.js');
|
|
2209
2209
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
2210
2210
|
if (!ModelProperty) {
|
|
2211
2211
|
logger$t('createPropertyInstances: ModelProperty not available from dynamic import');
|
|
@@ -2389,7 +2389,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2389
2389
|
// Step 2: Fallback to Schema context (only if database doesn't have the model)
|
|
2390
2390
|
// This handles the case where model exists in schema file but not yet in database
|
|
2391
2391
|
try {
|
|
2392
|
-
const _mod_0 = await import('./Schema-
|
|
2392
|
+
const _mod_0 = await import('./Schema-CyWoCyDH.js');
|
|
2393
2393
|
const _ns_0 = _mod_0.b;
|
|
2394
2394
|
const schemaMod = _ns_0;
|
|
2395
2395
|
const { Schema } = schemaMod;
|
|
@@ -2635,7 +2635,7 @@ const loadOrCreateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2635
2635
|
}
|
|
2636
2636
|
// Mark schema as draft when a new model is created so saveNewVersion() can persist it
|
|
2637
2637
|
try {
|
|
2638
|
-
const _mod_1 = await import('./Schema-
|
|
2638
|
+
const _mod_1 = await import('./Schema-CyWoCyDH.js');
|
|
2639
2639
|
const _ns_1 = _mod_1.b;
|
|
2640
2640
|
const schemaMod = _ns_1;
|
|
2641
2641
|
const { Schema } = schemaMod;
|
|
@@ -2681,10 +2681,10 @@ const validateModel = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2681
2681
|
const _validateModel = async () => {
|
|
2682
2682
|
try {
|
|
2683
2683
|
// Use dynamic imports to break circular dependencies
|
|
2684
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
2684
|
+
const validationServiceMod = await import('./SchemaValidationService-ByxyqvS9.js');
|
|
2685
2685
|
const { SchemaValidationService } = validationServiceMod;
|
|
2686
2686
|
const validationService = new SchemaValidationService();
|
|
2687
|
-
const _mod_2 = await import('./Schema-
|
|
2687
|
+
const _mod_2 = await import('./Schema-CyWoCyDH.js');
|
|
2688
2688
|
const _ns_2 = _mod_2.b;
|
|
2689
2689
|
const schemaMod = _ns_2;
|
|
2690
2690
|
const { Schema } = schemaMod;
|
|
@@ -2796,7 +2796,7 @@ const createModelProperties = fromCallback(({ sendBack, input }) => {
|
|
|
2796
2796
|
return;
|
|
2797
2797
|
}
|
|
2798
2798
|
logger$r(`Creating ${Object.keys(propertyDefinitions).length} properties for model "${modelName}" (id: ${_dbId})`);
|
|
2799
|
-
const mod = await import('./ModelProperty-
|
|
2799
|
+
const mod = await import('./ModelProperty-jBpPbg3l.js');
|
|
2800
2800
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
2801
2801
|
if (!ModelProperty) {
|
|
2802
2802
|
logger$r('ModelProperty not available from dynamic import');
|
|
@@ -2900,7 +2900,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
2900
2900
|
const structureMsg = `[validateEntity] Validating model structure`;
|
|
2901
2901
|
logger$q(structureMsg);
|
|
2902
2902
|
// Use existing Model validation
|
|
2903
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
2903
|
+
const validationServiceMod = await import('./SchemaValidationService-ByxyqvS9.js');
|
|
2904
2904
|
const { SchemaValidationService } = validationServiceMod;
|
|
2905
2905
|
const validationService = new SchemaValidationService();
|
|
2906
2906
|
// Validate model structure
|
|
@@ -2918,7 +2918,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
2918
2918
|
if (entityInput.entityData.schemaName) {
|
|
2919
2919
|
try {
|
|
2920
2920
|
logger$q(`[validateEntity] Validating model against schema "${entityInput.entityData.schemaName}"`);
|
|
2921
|
-
const _mod_3 = await import('./Schema-
|
|
2921
|
+
const _mod_3 = await import('./Schema-CyWoCyDH.js');
|
|
2922
2922
|
const _ns_3 = _mod_3.b;
|
|
2923
2923
|
const schemaMod = _ns_3;
|
|
2924
2924
|
const { Schema } = schemaMod;
|
|
@@ -2956,7 +2956,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
2956
2956
|
}
|
|
2957
2957
|
else if (entityInput.entityType === 'modelProperty') {
|
|
2958
2958
|
// Use existing ModelProperty validation
|
|
2959
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
2959
|
+
const validationServiceMod = await import('./SchemaValidationService-ByxyqvS9.js');
|
|
2960
2960
|
const { SchemaValidationService } = validationServiceMod;
|
|
2961
2961
|
const validationService = new SchemaValidationService();
|
|
2962
2962
|
// Validate property structure
|
|
@@ -2971,7 +2971,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
2971
2971
|
// If schema name and model name provided, validate against schema
|
|
2972
2972
|
if (entityInput.entityData._schemaName && entityInput.entityData.modelName) {
|
|
2973
2973
|
try {
|
|
2974
|
-
const _mod_4 = await import('./Schema-
|
|
2974
|
+
const _mod_4 = await import('./Schema-CyWoCyDH.js');
|
|
2975
2975
|
const _ns_4 = _mod_4.b;
|
|
2976
2976
|
const schemaMod = _ns_4;
|
|
2977
2977
|
const { Schema } = schemaMod;
|
|
@@ -3002,7 +3002,7 @@ const validateEntity = fromPromise(async ({ input }) => {
|
|
|
3002
3002
|
}
|
|
3003
3003
|
else if (entityInput.entityType === 'schema') {
|
|
3004
3004
|
// Schema validation - use existing validation
|
|
3005
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
3005
|
+
const validationServiceMod = await import('./SchemaValidationService-ByxyqvS9.js');
|
|
3006
3006
|
const { SchemaValidationService } = validationServiceMod;
|
|
3007
3007
|
const validationService = new SchemaValidationService();
|
|
3008
3008
|
const schemaResult = validationService.validateSchema(entityInput.entityData);
|
|
@@ -4954,7 +4954,7 @@ const writeToDatabase = fromCallback(({ sendBack, input }) => {
|
|
|
4954
4954
|
// initial write completes is not overwritten by the stale requestWrite payload.
|
|
4955
4955
|
let dataToWrite = input.entityData;
|
|
4956
4956
|
try {
|
|
4957
|
-
const mod = await import('./ModelProperty-
|
|
4957
|
+
const mod = await import('./ModelProperty-jBpPbg3l.js');
|
|
4958
4958
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
4959
4959
|
if (ModelProperty && typeof ModelProperty.getById === 'function') {
|
|
4960
4960
|
const instance = ModelProperty.getById(input.entityId);
|
|
@@ -5334,7 +5334,7 @@ const modelMachine = setup({
|
|
|
5334
5334
|
// Create ModelProperty instances for any new property IDs
|
|
5335
5335
|
if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
|
|
5336
5336
|
// Import and create instances asynchronously (fire-and-forget)
|
|
5337
|
-
import('./ModelProperty-
|
|
5337
|
+
import('./ModelProperty-jBpPbg3l.js').then(({ ModelProperty }) => {
|
|
5338
5338
|
const createPromises = newPropertyIds.map(async (propertyFileId) => {
|
|
5339
5339
|
try {
|
|
5340
5340
|
const property = await ModelProperty.createById(propertyFileId);
|
|
@@ -6753,7 +6753,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
6753
6753
|
const schemaNameToTry = model$1?.schemaName;
|
|
6754
6754
|
if (schemaNameToTry) {
|
|
6755
6755
|
try {
|
|
6756
|
-
const _mod_5 = await import('./Schema-
|
|
6756
|
+
const _mod_5 = await import('./Schema-CyWoCyDH.js');
|
|
6757
6757
|
const _ns_5 = _mod_5.b;
|
|
6758
6758
|
const { Schema } = _ns_5;
|
|
6759
6759
|
const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false });
|
|
@@ -6804,7 +6804,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
6804
6804
|
}
|
|
6805
6805
|
}
|
|
6806
6806
|
if (Object.keys(propertySchemas).length === 0) {
|
|
6807
|
-
const schemaMod = await import('./index-
|
|
6807
|
+
const schemaMod = await import('./index-j0nIoPTo.js');
|
|
6808
6808
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
6809
6809
|
const KNOWN_MODEL_FALLBACKS = {
|
|
6810
6810
|
Post: {
|
|
@@ -6851,7 +6851,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
6851
6851
|
// Infer propertyRecordSchema from metadata when schema is missing (enables persistence)
|
|
6852
6852
|
let propSchema = propertySchemas[propertyName];
|
|
6853
6853
|
if (!propSchema && isRefTypeFromMeta) {
|
|
6854
|
-
const schemaMod = await import('./index-
|
|
6854
|
+
const schemaMod = await import('./index-j0nIoPTo.js');
|
|
6855
6855
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
6856
6856
|
propSchema = {
|
|
6857
6857
|
dataType: refSeedType === 'html' ? ModelPropertyDataTypes.Html
|
|
@@ -7108,9 +7108,9 @@ const runPublish = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
7108
7108
|
sendBack({ type: 'publishError', error: new Error(`Item not found for seedLocalId: ${seedLocalId}`) });
|
|
7109
7109
|
return;
|
|
7110
7110
|
}
|
|
7111
|
-
const getPublishUploadsMod = await import('./getPublishUploads-
|
|
7111
|
+
const getPublishUploadsMod = await import('./getPublishUploads-BeukCBiR.js');
|
|
7112
7112
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
7113
|
-
const getPublishPayloadMod = await import('./getPublishPayload-
|
|
7113
|
+
const getPublishPayloadMod = await import('./getPublishPayload-DlkHAsOA.js');
|
|
7114
7114
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
7115
7115
|
const uploads = await getPublishUploads(item);
|
|
7116
7116
|
let uploadedTransactions = [];
|
|
@@ -7950,7 +7950,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
7950
7950
|
const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
|
|
7951
7951
|
const _resolveRelatedValue = async () => {
|
|
7952
7952
|
// Use dynamic import to break circular dependency
|
|
7953
|
-
const schemaMod = await import('./index-
|
|
7953
|
+
const schemaMod = await import('./index-j0nIoPTo.js');
|
|
7954
7954
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
7955
7955
|
if (!propertyValue || !isRelation || populatedFromDb) {
|
|
7956
7956
|
return;
|
|
@@ -8958,7 +8958,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
8958
8958
|
// to use dynamically imported ModelPropertyDataTypes
|
|
8959
8959
|
const _hydrateFromDb = async () => {
|
|
8960
8960
|
// Use dynamic import to break circular dependency
|
|
8961
|
-
const schemaMod = await import('./index-
|
|
8961
|
+
const schemaMod = await import('./index-j0nIoPTo.js');
|
|
8962
8962
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
8963
8963
|
const appDb = BaseDb.getAppDb();
|
|
8964
8964
|
const whereClauses = [];
|
|
@@ -9321,7 +9321,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
9321
9321
|
};
|
|
9322
9322
|
// Merge with schema from file/DB to get validation rules (enum, pattern, etc.) - properties table doesn't store these
|
|
9323
9323
|
try {
|
|
9324
|
-
const { getPropertySchema } = await import('./property-
|
|
9324
|
+
const { getPropertySchema } = await import('./property-DlfKPjHu.js');
|
|
9325
9325
|
let schemaFromFile = await getPropertySchema(normalizedModelName, propertyName);
|
|
9326
9326
|
if (!schemaFromFile?.validation) {
|
|
9327
9327
|
// Fallback: get validation from schemaData in database (Schema context may not be loaded yet)
|
|
@@ -9786,9 +9786,9 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
|
9786
9786
|
}
|
|
9787
9787
|
const _analyzeInput = async () => {
|
|
9788
9788
|
// Use dynamic import to break circular dependency
|
|
9789
|
-
const schemaMod = await import('./index-
|
|
9789
|
+
const schemaMod = await import('./index-j0nIoPTo.js');
|
|
9790
9790
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
9791
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
9791
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-ByxyqvS9.js');
|
|
9792
9792
|
let propertyName = propertyNameRaw;
|
|
9793
9793
|
if (!propertyName) {
|
|
9794
9794
|
throw new Error('propertyName is required');
|
|
@@ -9986,7 +9986,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
|
|
|
9986
9986
|
propertyRecordSchema?.validation &&
|
|
9987
9987
|
metadataValues.propertyValue != null &&
|
|
9988
9988
|
metadataValues.propertyValue !== '') {
|
|
9989
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
9989
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-ByxyqvS9.js');
|
|
9990
9990
|
const validationService = new SchemaValidationService();
|
|
9991
9991
|
const validationResult = validationService.validatePropertyValue(metadataValues.propertyValue, propertyRecordSchema.dataType, propertyRecordSchema.validation, propertyRecordSchema.refValueType);
|
|
9992
9992
|
if (!validationResult.isValid && validationResult.errors.length > 0) {
|
|
@@ -10577,7 +10577,7 @@ const saveRelation = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
|
10577
10577
|
}
|
|
10578
10578
|
const _saveRelation = async () => {
|
|
10579
10579
|
// Use dynamic import to break circular dependency
|
|
10580
|
-
const schemaMod = await import('./index-
|
|
10580
|
+
const schemaMod = await import('./index-j0nIoPTo.js');
|
|
10581
10581
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
10582
10582
|
if (!propertyNameRaw) {
|
|
10583
10583
|
throw new Error('propertyName is required');
|
|
@@ -11621,7 +11621,7 @@ class ItemProperty {
|
|
|
11621
11621
|
return;
|
|
11622
11622
|
}
|
|
11623
11623
|
// Use dynamic import to break circular dependency
|
|
11624
|
-
const schemaMod = await import('./index-
|
|
11624
|
+
const schemaMod = await import('./index-j0nIoPTo.js');
|
|
11625
11625
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
11626
11626
|
const { context } = snapshot;
|
|
11627
11627
|
const { propertyRecordSchema } = context;
|
|
@@ -11792,7 +11792,7 @@ class ItemProperty {
|
|
|
11792
11792
|
const normalizedRefValueType = normalizeDataType(propertyRecordSchema?.refValueType);
|
|
11793
11793
|
const propertyNames = getMetadataPropertyNamesForQuery(propertyName, normalizedDataType, normalizedRefValueType);
|
|
11794
11794
|
const propertyNameVariant = propertyNames.length > 1 ? propertyNames[1] : undefined;
|
|
11795
|
-
const _mod_6 = await import('./index-
|
|
11795
|
+
const _mod_6 = await import('./index-CfZAy_U1.js');
|
|
11796
11796
|
const _ns_6 = _mod_6.s;
|
|
11797
11797
|
const seedSchemaMod = _ns_6;
|
|
11798
11798
|
const { metadata } = seedSchemaMod;
|
|
@@ -12522,7 +12522,7 @@ class ItemProperty {
|
|
|
12522
12522
|
}
|
|
12523
12523
|
async save() {
|
|
12524
12524
|
const ctx = this._getSnapshotContext();
|
|
12525
|
-
const { assertItemOwned } = await import('./ownership-
|
|
12525
|
+
const { assertItemOwned } = await import('./ownership-Br40yugt.js');
|
|
12526
12526
|
await assertItemOwned({
|
|
12527
12527
|
seedLocalId: ctx?.seedLocalId ?? undefined,
|
|
12528
12528
|
seedUid: ctx?.seedUid ?? undefined,
|
|
@@ -12615,7 +12615,7 @@ class ItemProperty {
|
|
|
12615
12615
|
if (!propertyName || (!seedLocalId && !seedUid))
|
|
12616
12616
|
return;
|
|
12617
12617
|
if (db) {
|
|
12618
|
-
const _mod_7 = await import('./index-
|
|
12618
|
+
const _mod_7 = await import('./index-CfZAy_U1.js');
|
|
12619
12619
|
const _ns_7 = _mod_7.s;
|
|
12620
12620
|
const seedSchemaMod = _ns_7;
|
|
12621
12621
|
const { metadata } = seedSchemaMod;
|
|
@@ -12863,7 +12863,7 @@ class Item {
|
|
|
12863
12863
|
});
|
|
12864
12864
|
};
|
|
12865
12865
|
this.unpublish = async () => {
|
|
12866
|
-
const { assertItemOwned } = await import('./ownership-
|
|
12866
|
+
const { assertItemOwned } = await import('./ownership-Br40yugt.js');
|
|
12867
12867
|
const { getRevokeExecutor } = await Promise.resolve().then(function () { return publishConfig; });
|
|
12868
12868
|
await assertItemOwned(this);
|
|
12869
12869
|
const seedUid = this.seedUid;
|
|
@@ -12887,7 +12887,7 @@ class Item {
|
|
|
12887
12887
|
this._service.send({ type: 'updateContext', revokedAt });
|
|
12888
12888
|
};
|
|
12889
12889
|
this.publish = async () => {
|
|
12890
|
-
const { assertItemOwned } = await import('./ownership-
|
|
12890
|
+
const { assertItemOwned } = await import('./ownership-Br40yugt.js');
|
|
12891
12891
|
await assertItemOwned(this);
|
|
12892
12892
|
this._service.send({ type: 'startPublish' });
|
|
12893
12893
|
return new Promise((resolve, reject) => {
|
|
@@ -12923,12 +12923,12 @@ class Item {
|
|
|
12923
12923
|
};
|
|
12924
12924
|
this.getPublishUploads = async (options) => {
|
|
12925
12925
|
// Use dynamic import to break circular dependency
|
|
12926
|
-
const getPublishUploadsMod = await import('./getPublishUploads-
|
|
12926
|
+
const getPublishUploadsMod = await import('./getPublishUploads-BeukCBiR.js');
|
|
12927
12927
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
12928
12928
|
return await getPublishUploads(this, [], undefined, options);
|
|
12929
12929
|
};
|
|
12930
12930
|
this.getPublishPayload = async (uploadedTransactions, options) => {
|
|
12931
|
-
const getPublishPayloadMod = await import('./getPublishPayload-
|
|
12931
|
+
const getPublishPayloadMod = await import('./getPublishPayload-DlkHAsOA.js');
|
|
12932
12932
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
12933
12933
|
return await getPublishPayload(this, uploadedTransactions, options);
|
|
12934
12934
|
};
|
|
@@ -13669,7 +13669,7 @@ class Item {
|
|
|
13669
13669
|
if (!appDb || Item.instanceCache.size === 0) {
|
|
13670
13670
|
return;
|
|
13671
13671
|
}
|
|
13672
|
-
const _mod_8 = await import('./index-
|
|
13672
|
+
const _mod_8 = await import('./index-CfZAy_U1.js');
|
|
13673
13673
|
const _ns_8 = _mod_8.s;
|
|
13674
13674
|
const { metadata } = _ns_8;
|
|
13675
13675
|
const { eq, and } = await import('drizzle-orm');
|
|
@@ -14120,7 +14120,7 @@ class Item {
|
|
|
14120
14120
|
itemActor.send(event);
|
|
14121
14121
|
};
|
|
14122
14122
|
try {
|
|
14123
|
-
const _mod_9 = await import('./index-
|
|
14123
|
+
const _mod_9 = await import('./index-CfZAy_U1.js');
|
|
14124
14124
|
const _ns_9 = _mod_9.s;
|
|
14125
14125
|
const seedSchemaMod = _ns_9;
|
|
14126
14126
|
const { seeds, versions, metadata } = seedSchemaMod;
|
|
@@ -14426,7 +14426,7 @@ class Item {
|
|
|
14426
14426
|
* Destroy the item: soft delete in DB, remove from caches, clean up subscriptions, stop service.
|
|
14427
14427
|
*/
|
|
14428
14428
|
async destroy() {
|
|
14429
|
-
const { assertItemOwned } = await import('./ownership-
|
|
14429
|
+
const { assertItemOwned } = await import('./ownership-Br40yugt.js');
|
|
14430
14430
|
await assertItemOwned(this);
|
|
14431
14431
|
const context = this._getSnapshotContext();
|
|
14432
14432
|
const cacheKeys = Item.collectInstanceCacheKeysForInstance(this);
|
|
@@ -14582,7 +14582,7 @@ const runEasSync = fromPromise(async ({ input, }) => {
|
|
|
14582
14582
|
requestPayload: input.requestPayload,
|
|
14583
14583
|
persistedSnapshot: input.runningSnapshot,
|
|
14584
14584
|
});
|
|
14585
|
-
const { runSyncFromEas } = await import('./syncDbWithEas-
|
|
14585
|
+
const { runSyncFromEas } = await import('./syncDbWithEas-Dsa5kEMM.js');
|
|
14586
14586
|
try {
|
|
14587
14587
|
await runSyncFromEas(toRunSyncArg(input.options));
|
|
14588
14588
|
await finalizeEasSyncProcessRow(rowId, {
|
|
@@ -14892,20 +14892,20 @@ const platformClassesInit = fromCallback(({ sendBack, input: { context, event }
|
|
|
14892
14892
|
let PathResolver;
|
|
14893
14893
|
let EasClient;
|
|
14894
14894
|
if (isBrowser()) {
|
|
14895
|
-
FileManager = (await import('./FileManager-
|
|
14896
|
-
Db = (await import('./Db-
|
|
14897
|
-
QueryClient = (await import('./QueryClient-
|
|
14898
|
-
ArweaveClient = (await import('./ArweaveClient-
|
|
14899
|
-
PathResolver = (await import('./PathResolver-
|
|
14900
|
-
EasClient = (await import('./EasClient-
|
|
14895
|
+
FileManager = (await import('./FileManager-DJ-mFSmc.js')).FileManager;
|
|
14896
|
+
Db = (await import('./Db-BHMXF86s.js')).Db;
|
|
14897
|
+
QueryClient = (await import('./QueryClient-7vk66LoN.js')).QueryClient;
|
|
14898
|
+
ArweaveClient = (await import('./ArweaveClient-BA7b13Dl.js')).ArweaveClient;
|
|
14899
|
+
PathResolver = (await import('./PathResolver-CxmIkVyO.js')).PathResolver;
|
|
14900
|
+
EasClient = (await import('./EasClient-DjSKI-Jp.js')).EasClient;
|
|
14901
14901
|
}
|
|
14902
14902
|
else if (isNode()) {
|
|
14903
|
-
FileManager = (await import('./FileManager-
|
|
14904
|
-
Db = (await import('./Db-
|
|
14905
|
-
QueryClient = (await import('./QueryClient-
|
|
14906
|
-
ArweaveClient = (await import('./ArweaveClient-
|
|
14907
|
-
PathResolver = (await import('./PathResolver-
|
|
14908
|
-
EasClient = (await import('./EasClient-
|
|
14903
|
+
FileManager = (await import('./FileManager-DIbVCWke.js')).FileManager;
|
|
14904
|
+
Db = (await import('./Db-qgwjsLKI.js')).Db;
|
|
14905
|
+
QueryClient = (await import('./QueryClient-CHayftHv.js')).QueryClient;
|
|
14906
|
+
ArweaveClient = (await import('./ArweaveClient-DJ8Q63JQ.js')).ArweaveClient;
|
|
14907
|
+
PathResolver = (await import('./PathResolver-DmFG4fR1.js')).PathResolver;
|
|
14908
|
+
EasClient = (await import('./EasClient-BqU4c27A.js')).EasClient;
|
|
14909
14909
|
}
|
|
14910
14910
|
else {
|
|
14911
14911
|
throw new Error(`Unable to determine environment. isBrowser()=${isBrowser()}, isNode()=${isNode()}. Platform-specific implementations could not be loaded.`);
|
|
@@ -18305,7 +18305,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
|
|
|
18305
18305
|
// Lazy import cache for ModelProperty to avoid circular dependency
|
|
18306
18306
|
// Eagerly start loading to minimize delay on first access
|
|
18307
18307
|
let ModelPropertyClass = null;
|
|
18308
|
-
const modelPropertyImportPromise = import('./ModelProperty-
|
|
18308
|
+
const modelPropertyImportPromise = import('./ModelProperty-jBpPbg3l.js')
|
|
18309
18309
|
.then(module => {
|
|
18310
18310
|
ModelPropertyClass = module.ModelProperty;
|
|
18311
18311
|
return ModelPropertyClass;
|
|
@@ -18322,7 +18322,7 @@ function getModelProperty() {
|
|
|
18322
18322
|
}
|
|
18323
18323
|
// Lazy import cache for Schema to avoid circular dependency
|
|
18324
18324
|
let SchemaClass = null;
|
|
18325
|
-
const schemaImportPromise = (async () => { const _mod_10 = await import('./Schema-
|
|
18325
|
+
const schemaImportPromise = (async () => { const _mod_10 = await import('./Schema-CyWoCyDH.js'); return _mod_10.b; })()
|
|
18326
18326
|
.then(module => {
|
|
18327
18327
|
SchemaClass = module.Schema;
|
|
18328
18328
|
return SchemaClass;
|
|
@@ -20063,4 +20063,4 @@ const TModelValues = Type.Record(Type.String(), Type.Any());
|
|
|
20063
20063
|
const TModelSchema = Type.Record(Type.String(), TProperty);
|
|
20064
20064
|
|
|
20065
20065
|
export { getItemData as $, models$1 as A, Boolean$1 as B, properties as C, Date$1 as D, isValidEasAttestationUid as E, File$1 as F, getLatestPublishedVersionRow as G, Html as H, Image as I, Json as J, modelPropertiesToObject as K, List as L, Model as M, Number$1 as N, parseListPropertyValueFromStorage as O, Property as P, getCorrectId as Q, Relation as R, INTERNAL_PROPERTY_NAMES as S, TModelValues as T, defaultAttestationData as U, VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA as V, INTERNAL_DATA_TYPES as W, toSnakeCase as X, getEasSchemaUidForSchemaDefinition as Y, ZERO_BYTES32 as Z, getEasSchemaForItemProperty as _, TModelSchema as a, compareMetadataRowsLatestFirst as a$, resolveStorageNameToSchemaName as a0, appState as a1, BasePathResolver as a2, SEED_CONFIG_FILE as a3, SEED_CONFIG_FALLBACKS as a4, BaseEasClient as a5, EAS_ENDPOINT as a6, BaseQueryClient as a7, arweaveL1FinalizeJobs as a8, config as a9, GET_SEEDS as aA, GET_VERSIONS as aB, GET_PROPERTIES as aC, setSchemaUidForSchemaDefinition as aD, parseEasRelationPropertyName as aE, addModelsToDb$1 as aF, SCHEMA_NJK as aG, ItemProperty as aH, ClientManager as aI, INIT_SCRIPT_SUCCESS_MESSAGE as aJ, SCHEMA_TS as aK, getRefValueType as aL, importJsonSchema as aM, loadSchemaFromFile as aN, readJsonImportFile as aO, syncSchemaFromSource as aP, transformImportToSchemaFile as aQ, writeProcessMachine as aR, getModelIdByFileId as aS, waitForEntityIdle as aT, createReactiveProxy as aU, findEntity as aV, forceRemoveFromCaches as aW, runDestroyLifecycle as aX, getModelId as aY, isPlaceholderUid as aZ, normalizeBytes32Hex as a_, easSyncProcesses as aa, metadata$1 as ab, modelRelations as ac, modelSchemas as ad, modelUids as ae, modelsRelations as af, propertiesRelations as ag, propertyUidRelations as ah, propertyUids as ai, publishProcesses as aj, schemas as ak, uploadProcesses as al, versions as am, graphql as an, getPropertyIdForModelAndName as ao, getAllAddressesFromDb as ap, getModelSchemasFromEas as aq, getSeedsFromSchemaUids as ar, getItemVersionsFromEas as as, getItemPropertiesFromEas as at, pickLatestPropertyAttestationsByRefAndSchema as au, scheduleBulkFilesDownloadFromEasSync as av, eventEmitter as aw, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as ax, generateId as ay, escapeSqliteString as az, ModelPropertyDataTypes as b, isInternalSchema as b$, getArweaveUrlForTransaction as b0, ADDRESSES_PERSISTED_EVENT as b1, parseAddressesPersistedPayload as b2, getClient as b3, ClientManagerState as b4, MachineIds as b5, createNewItem as b6, getVersionData$1 as b7, getMetadataLatest as b8, loadAllSchemasFromDb as b9, queryArweaveGatewayTransaction as bA, queryArweaveGatewayTransactionWithFallback as bB, ensureReadGatewaySelected as bC, invalidateReadGatewayCache as bD, resetArweaveReadGatewayForTests as bE, setUploadExecutor as bF, getUploadExecutor as bG, setGetPublisherForNewSeeds as bH, getGetPublisherForNewSeeds as bI, setRevokeExecutor as bJ, getRevokeExecutor as bK, setAdditionalSyncAddresses as bL, createSchema as bM, readSchema as bN, listCompleteSchemaFiles as bO, getSchemaNameFromId as bP, easSyncActor as bQ, startEasSyncActor as bR, sendEasSyncClientRequest as bS, requestEasSyncFromAddressChange as bT, requestEasSyncFromEventBus as bU, requestEasSyncFromModelsInit as bV, mergeEasSyncRequestIntents as bW, addSchemaToDb as bX, createModelsFromJson as bY, loadModelsFromDbForSchema as bZ, getLatestSchemaVersion as b_, propertyMachine as ba, SEED_PROTOCOL_SCHEMA_NAME as bb, ImageSize as bc, setSchemaUidForModel as bd, getCanonicalItemPropertiesFromEas as be, getEasSchemaUidBySchemaName as bf, getSeedsBySchemaName as bg, withExcludeRevokedFilter as bh, classifyMediaRef as bi, resolveMediaRef as bj, normalizeFeedItemFields as bk, getFeedItemStringField as bl, SeedModels as bm, DEFAULT_ARWEAVE_HOST as bn, DEFAULT_ARWEAVE_GATEWAYS as bo, DEFAULT_ARWEAVE_GRAPHQL_URL as bp, getDefaultArweaveReadGatewayHostsOrdered as bq, mergePrimaryHostWithDefaults as br, isKnownArweaveGatewayHostname as bs, getAddressesForItemsFilter as bt, normalizeUploadApiBaseUrl as bu, getUploadApiArweaveDataUrl as bv, getUploadPipelineTransactionStatus as bw, getUploadApiArweaveStatusUrl as bx, getArweaveUploadStatus as by, isArweaveL1AnchoringComplete as bz, TPropertyDataType as c, createModelFromJson as c0, ConflictError as c1, unloadEntity as c2, clearDestroySubscriptions as c3, setupEntityLiveQuery as c4, ModelSchema as c5, BaseFileManager$1 as c6, db as c7, eas as c8, getPropertyData$1 as c9, Item$1 as ca, schema as cb, SEEDPROTOCOL_Seed_Protocol_v1 as cc, Model$1 as cd, TStorageType as d, THtmlEmbeddedDataUriPolicy as e, TProperty as f, TPropertyConstructor as g, TPropertyDefs as h, PropertyMetadataKey as i, PropertyConstructor as j, Text as k, DEFAULT_TEXT_MAX_LENGTH as l, TValidationRules as m, normalizeDataType as n, getOwnedAddressesFromDb as o, BaseDb as p, getGetAdditionalSyncAddresses as q, resolveSeedIdsFromRefString as r, seeds as s, normalizeRelationPropertyValue as t, Item as u, BaseFileManager as v, getContentHash as w, htmlEmbeddedImageCoPublish as x, BaseArweaveClient as y, getEasSchemaUidForModel as z };
|
|
20066
|
-
//# sourceMappingURL=index-
|
|
20066
|
+
//# sourceMappingURL=index-C3oIxmh-.js.map
|