@seedprotocol/sdk 0.7.2-next.593.gd5bd4ea → 0.7.3-next.613.g79a8dfd
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/{ClientManager-ClCwwhwo.js → ClientManager-DDA9956Y.js} +9 -9
- package/dist/{ClientManager-ClCwwhwo.js.map → ClientManager-DDA9956Y.js.map} +1 -1
- package/dist/{Item-B9Y4VuK1.js → Item-D4FigtYS.js} +40 -40
- package/dist/{Item-B9Y4VuK1.js.map → Item-D4FigtYS.js.map} +1 -1
- package/dist/{ModelProperty-BMePcicQ.js → ModelProperty-BDt6AU2h.js} +23 -23
- package/dist/{ModelProperty-BMePcicQ.js.map → ModelProperty-BDt6AU2h.js.map} +1 -1
- package/dist/{Schema-COsEXXaR.js → Schema-B8xqLWkL.js} +28 -28
- package/dist/{Schema-COsEXXaR.js.map → Schema-B8xqLWkL.js.map} +1 -1
- package/dist/{SchemaValidationService-DabGMzSE.js → SchemaValidationService-BPxkfDLU.js} +6 -6
- package/dist/{SchemaValidationService-DabGMzSE.js.map → SchemaValidationService-BPxkfDLU.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-Ck6fumnm.js → backfillMetadataPropertyIds-DuTPcv8t.js} +3 -3
- package/dist/{backfillMetadataPropertyIds-Ck6fumnm.js.map → backfillMetadataPropertyIds-DuTPcv8t.js.map} +1 -1
- package/dist/cjs/{ModelProperty-BT6Un_MB.js → ModelProperty-B-cZm1yU.js} +21 -21
- package/dist/cjs/{ModelProperty-BT6Un_MB.js.map → ModelProperty-B-cZm1yU.js.map} +1 -1
- package/dist/cjs/{Schema-BXhXdUsA.js → Schema-STP972Xw.js} +23 -23
- package/dist/cjs/{Schema-BXhXdUsA.js.map → Schema-STP972Xw.js.map} +1 -1
- package/dist/cjs/{SchemaValidationService-CC18QDfc.js → SchemaValidationService-CKNW1bKg.js} +2 -2
- package/dist/cjs/{SchemaValidationService-CC18QDfc.js.map → SchemaValidationService-CKNW1bKg.js.map} +1 -1
- package/dist/cjs/{backfillMetadataPropertyIds-DEHC9ejq.js → backfillMetadataPropertyIds-CP3y1skt.js} +3 -3
- package/dist/cjs/{backfillMetadataPropertyIds-DEHC9ejq.js.map → backfillMetadataPropertyIds-CP3y1skt.js.map} +1 -1
- package/dist/cjs/{eas-C3CL0l7l.js → eas-CAnUC4wd.js} +3 -3
- package/dist/cjs/{eas-C3CL0l7l.js.map → eas-CAnUC4wd.js.map} +1 -1
- package/dist/cjs/{getItem-CrwWYCkj.js → getItem-CWgb3e9G.js} +2 -2
- package/dist/cjs/{getItem-CrwWYCkj.js.map → getItem-CWgb3e9G.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-DRJh7WR0.js → getPublishPayload-BsZWiJ03.js} +11 -11
- package/dist/cjs/{getPublishPayload-DRJh7WR0.js.map → getPublishPayload-BsZWiJ03.js.map} +1 -1
- package/dist/cjs/{getPublishUploads-Bh22D3zJ.js → getPublishUploads-BQr8aMVP.js} +4 -4
- package/dist/cjs/{getPublishUploads-Bh22D3zJ.js.map → getPublishUploads-BQr8aMVP.js.map} +1 -1
- package/dist/cjs/{index-BA1RIYFG.js → index-nA5PxBSs.js} +3 -3
- package/dist/cjs/index-nA5PxBSs.js.map +1 -0
- package/dist/cjs/{index-Dls7aMjr.js → index-usKaANAq.js} +79 -37
- package/dist/cjs/index-usKaANAq.js.map +1 -0
- package/dist/cjs/{property-ZerTWizX.js → property-xMwPhQ5N.js} +5 -5
- package/dist/cjs/{property-ZerTWizX.js.map → property-xMwPhQ5N.js.map} +1 -1
- package/dist/cjs/{publishDraftGraph-CPOAcQFf.js → publishDraftGraph-BRWlR1KO.js} +4 -4
- package/dist/cjs/{publishDraftGraph-CPOAcQFf.js.map → publishDraftGraph-BRWlR1KO.js.map} +1 -1
- package/dist/cjs/{resetAmbiguousLegacyItemData-adDl4LcT.js → resetAmbiguousLegacyItemData-8nfkj9rz.js} +2 -2
- package/dist/cjs/{resetAmbiguousLegacyItemData-adDl4LcT.js.map → resetAmbiguousLegacyItemData-8nfkj9rz.js.map} +1 -1
- package/dist/cjs/{resolveModelForSyncedSeed-DoNThPdL.js → resolveModelForSyncedSeed-kYRuDWYw.js} +2 -2
- package/dist/cjs/{resolveModelForSyncedSeed-DoNThPdL.js.map → resolveModelForSyncedSeed-kYRuDWYw.js.map} +1 -1
- package/dist/cjs/{syncDbWithEas-CYfPkus9.js → syncDbWithEas-DqRhV8o2.js} +7 -7
- package/dist/cjs/{syncDbWithEas-CYfPkus9.js.map → syncDbWithEas-DqRhV8o2.js.map} +1 -1
- package/dist/{configurePlatform-xU3Hsno3.js → configurePlatform-YcOiDQBZ.js} +3 -3
- package/dist/{configurePlatform-xU3Hsno3.js.map → configurePlatform-YcOiDQBZ.js.map} +1 -1
- package/dist/{db-W1g29qsM.js → db-CQt-gcAl.js} +3 -3
- package/dist/{db-W1g29qsM.js.map → db-CQt-gcAl.js.map} +1 -1
- package/dist/{eas-CSwV6MvB.js → eas-CpOD74Ke.js} +4 -4
- package/dist/{eas-CSwV6MvB.js.map → eas-CpOD74Ke.js.map} +1 -1
- package/dist/{getItem-BYQeM3DY.js → getItem-B_OoFkd7.js} +4 -4
- package/dist/{getItem-BYQeM3DY.js.map → getItem-B_OoFkd7.js.map} +1 -1
- package/dist/{getPublishPayload-D5CQZd-y.js → getPublishPayload-Xl3sRkR-.js} +14 -14
- package/dist/{getPublishPayload-D5CQZd-y.js.map → getPublishPayload-Xl3sRkR-.js.map} +1 -1
- package/dist/{getPublishUploads-BGpDsrBp.js → getPublishUploads-DHP01KgU.js} +8 -8
- package/dist/{getPublishUploads-BGpDsrBp.js.map → getPublishUploads-DHP01KgU.js.map} +1 -1
- package/dist/{index-Bev-hZF-.js → index-BGt4_oPO.js} +8 -8
- package/dist/index-BGt4_oPO.js.map +1 -0
- package/dist/{index-DRXC5Mra.js → index-Xl1_4Lmb.js} +23 -23
- package/dist/{index-DRXC5Mra.js.map → index-Xl1_4Lmb.js.map} +1 -1
- package/dist/{index.browser-DO20vYuP.js → index.browser-CjTe0vt1.js} +5 -5
- package/dist/{index.browser-DO20vYuP.js.map → index.browser-CjTe0vt1.js.map} +1 -1
- package/dist/{index.node-C4iyOhdo.js → index.node-Cfa7npS6.js} +2 -2
- package/dist/{index.node-C4iyOhdo.js.map → index.node-Cfa7npS6.js.map} +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.js +24 -24
- package/dist/node.js +9 -9
- package/dist/platform.browser.js +3 -3
- package/dist/platform.node.js +1 -1
- package/dist/{property-BT1zDSkd.js → property-BrXkY1Rg.js} +8 -8
- package/dist/{property-BT1zDSkd.js.map → property-BrXkY1Rg.js.map} +1 -1
- package/dist/{publishDraftGraph-Bcfrdj7-.js → publishDraftGraph-X0Wr9txE.js} +7 -7
- package/dist/{publishDraftGraph-Bcfrdj7-.js.map → publishDraftGraph-X0Wr9txE.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-CLlumTBq.js → resolveModelForSyncedSeed-DFVdnYq8.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-CLlumTBq.js.map → resolveModelForSyncedSeed-DFVdnYq8.js.map} +1 -1
- package/dist/src/helpers/tabLocks.d.ts +11 -1
- package/dist/src/helpers/tabLocks.d.ts.map +1 -1
- package/dist/{syncDbWithEas-BQsXjGhe.js → syncDbWithEas-BU-jZ5bJ.js} +11 -11
- package/dist/{syncDbWithEas-BQsXjGhe.js.map → syncDbWithEas-BU-jZ5bJ.js.map} +1 -1
- package/dist/{tabEvents-C9qUKx_z.js → tabEvents-BZJMY5uK.js} +49 -7
- package/dist/tabEvents-BZJMY5uK.js.map +1 -0
- package/dist/{tolerantWebAccess-B-9bwxbw.js → tolerantWebAccess-BZ2RA_mb.js} +4 -4
- package/dist/{tolerantWebAccess-B-9bwxbw.js.map → tolerantWebAccess-BZ2RA_mb.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-D6q0h7pj.js → updateSeedRevokedAt-iLpzae1i.js} +2 -2
- package/dist/{updateSeedRevokedAt-D6q0h7pj.js.map → updateSeedRevokedAt-iLpzae1i.js.map} +1 -1
- package/package.json +5 -5
- package/dist/cjs/index-BA1RIYFG.js.map +0 -1
- package/dist/cjs/index-Dls7aMjr.js.map +0 -1
- package/dist/index-Bev-hZF-.js.map +0 -1
- package/dist/tabEvents-C9qUKx_z.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var main_cjs = require('./index-
|
|
3
|
+
var main_cjs = require('./index-usKaANAq.js');
|
|
4
4
|
var arweave = require('@seedprotocol/arweave');
|
|
5
|
-
var publishDraftGraph = require('./publishDraftGraph-
|
|
5
|
+
var publishDraftGraph = require('./publishDraftGraph-BRWlR1KO.js');
|
|
6
6
|
var debug = require('debug');
|
|
7
7
|
var drizzleOrm = require('drizzle-orm');
|
|
8
8
|
require('pluralize');
|
|
@@ -32,7 +32,7 @@ require('js-yaml');
|
|
|
32
32
|
require('child_process');
|
|
33
33
|
require('@seedprotocol/arweave/node');
|
|
34
34
|
require('@seedprotocol/eas/node');
|
|
35
|
-
require('./property-
|
|
35
|
+
require('./property-xMwPhQ5N.js');
|
|
36
36
|
|
|
37
37
|
const logger = debug('seedSdk:item:getPublishUploads');
|
|
38
38
|
const EXTENSION_TO_MIME = {
|
|
@@ -492,4 +492,4 @@ const getPublishUploads = async (item, uploads = [], relatedItemProperty, option
|
|
|
492
492
|
exports.getPublishUploads = getPublishUploads;
|
|
493
493
|
exports.itemHasPublishUploadCandidates = itemHasPublishUploadCandidates;
|
|
494
494
|
exports.prepareArweaveTransaction = prepareArweaveTransaction;
|
|
495
|
-
//# sourceMappingURL=getPublishUploads-
|
|
495
|
+
//# sourceMappingURL=getPublishUploads-BQr8aMVP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPublishUploads-Bh22D3zJ.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":["BaseArweaveClient","normalizeDataType","BaseFileManager","resolveSeedIdsFromRefString","normalizeRelationPropertyValue","isDataType","ModelPropertyDataTypes","getContentHash","BaseDb","htmlEmbeddedImageCoPublish","eq","Item","getSegmentedItemProperties","isPublishedSeedRef","getPublishDraftGraph"],"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,e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ACX,OAAO;AACR,SAAA,CAAC;QAEF,IAAI,CAAC,WAAW,EAAE;;YAEhB,IAAIE,2BAAkB,CAAC,aAAa,CAAC;gBAAE;YACvC,MAAM,IAAI,KAAK,CACb,CAAA,yBAAA,EAA4B,gBAAgB,CAAC,YAAY,CAAA,CAAE,CAC5D;QACH;QAEA,OAAO,GAAG,MAAM,wBAAwB,CAAC,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE;AAC/E,YAAA,GAAG,OAAO;AACV,YAAA,qBAAqB,EAAE,IAAI;AAC5B,SAAA,CAAC;IACJ;AAEA,IAAA,OAAO,OAAO;AAChB,CAAC;AAED;;;AAGG;AACI,MAAM,iBAAiB,GAAG,OAC/B,IAAgB,EAChB,OAAA,GAA2B,EAAE,EAC7B,mBAAwC,EACxC,OAAkC,KAChC;AACF,IAAA,OAAO,GAAG,MAAM,wBAAwB,CAAC,IAAI,EAAE,OAAO,EAAE,mBAAmB,EAAE,OAAO,CAAC;AAErF,IAAA,IAAI,OAAO,EAAE,qBAAqB,EAAE;AAClC,QAAA,OAAO,OAAO;IAChB;AAEA,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMC,sCAAoB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACrE,IAAA,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,MAAM,EAAE;QAClD,OAAO,GAAG,MAAM,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,GAAG,EAAE,OAAO,CAAC;IAC9F;AAEA,IAAA,OAAO,OAAO;AAChB;;;;"}
|
|
1
|
+
{"version":3,"file":"getPublishUploads-BQr8aMVP.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":["BaseArweaveClient","normalizeDataType","BaseFileManager","resolveSeedIdsFromRefString","normalizeRelationPropertyValue","isDataType","ModelPropertyDataTypes","getContentHash","BaseDb","htmlEmbeddedImageCoPublish","eq","Item","getSegmentedItemProperties","isPublishedSeedRef","getPublishDraftGraph"],"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,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kB,CAAC,aAAa,CAAC;gBAAE;YACvC,MAAM,IAAI,KAAK,CACb,CAAA,yBAAA,EAA4B,gBAAgB,CAAC,YAAY,CAAA,CAAE,CAC5D;QACH;QAEA,OAAO,GAAG,MAAM,wBAAwB,CAAC,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE;AAC/E,YAAA,GAAG,OAAO;AACV,YAAA,qBAAqB,EAAE,IAAI;AAC5B,SAAA,CAAC;IACJ;AAEA,IAAA,OAAO,OAAO;AAChB,CAAC;AAED;;;AAGG;AACI,MAAM,iBAAiB,GAAG,OAC/B,IAAgB,EAChB,OAAA,GAA2B,EAAE,EAC7B,mBAAwC,EACxC,OAAkC,KAChC;AACF,IAAA,OAAO,GAAG,MAAM,wBAAwB,CAAC,IAAI,EAAE,OAAO,EAAE,mBAAmB,EAAE,OAAO,CAAC;AAErF,IAAA,IAAI,OAAO,EAAE,qBAAqB,EAAE;AAClC,QAAA,OAAO,OAAO;IAChB;AAEA,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMC,sCAAoB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACrE,IAAA,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,MAAM,EAAE;QAClD,OAAO,GAAG,MAAM,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,GAAG,EAAE,OAAO,CAAC;IAC9F;AAEA,IAAA,OAAO,OAAO;AAChB;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('reflect-metadata');
|
|
4
|
-
var main_cjs = require('./index-
|
|
5
|
-
var property = require('./property-
|
|
4
|
+
var main_cjs = require('./index-usKaANAq.js');
|
|
5
|
+
var property = require('./property-xMwPhQ5N.js');
|
|
6
6
|
require('immer');
|
|
7
7
|
require('xstate');
|
|
8
8
|
require('drizzle-orm/sqlite-core');
|
|
@@ -67,4 +67,4 @@ exports.isDataType = main_cjs.isDataType;
|
|
|
67
67
|
exports.normalizeDataType = main_cjs.normalizeDataType;
|
|
68
68
|
exports.normalizePropertyRecordSchema = main_cjs.normalizePropertyRecordSchema;
|
|
69
69
|
exports.getPropertySchema = property.getPropertySchema;
|
|
70
|
-
//# sourceMappingURL=index-
|
|
70
|
+
//# sourceMappingURL=index-nA5PxBSs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-nA5PxBSs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -4461,7 +4461,7 @@ const createPropertyInstances = async (propertyFileIds) => {
|
|
|
4461
4461
|
return;
|
|
4462
4462
|
}
|
|
4463
4463
|
try {
|
|
4464
|
-
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
4464
|
+
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-B-cZm1yU.js'); });
|
|
4465
4465
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
4466
4466
|
if (!ModelProperty) {
|
|
4467
4467
|
logger$w('createPropertyInstances: ModelProperty not available from dynamic import');
|
|
@@ -4674,7 +4674,7 @@ const loadOrCreateModel = xstate.fromCallback(({ sendBack, input: { context }, s
|
|
|
4674
4674
|
// Step 2: Fallback to Schema context (only if database doesn't have the model)
|
|
4675
4675
|
// This handles the case where model exists in schema file but not yet in database
|
|
4676
4676
|
try {
|
|
4677
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-
|
|
4677
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-STP972Xw.js'); });
|
|
4678
4678
|
const { Schema } = schemaMod;
|
|
4679
4679
|
// Stopped meanwhile (unloaded, or evicted with its schema): don't load the schema again
|
|
4680
4680
|
if (isActorStopped(self))
|
|
@@ -4919,7 +4919,7 @@ const loadOrCreateModel = xstate.fromCallback(({ sendBack, input: { context }, s
|
|
|
4919
4919
|
}
|
|
4920
4920
|
// Mark schema as draft when a new model is created so saveNewVersion() can persist it
|
|
4921
4921
|
try {
|
|
4922
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-
|
|
4922
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-STP972Xw.js'); });
|
|
4923
4923
|
const { Schema } = schemaMod;
|
|
4924
4924
|
if (!isActorStopped(self)) {
|
|
4925
4925
|
const schema = Schema.create(schemaName, { waitForReady: false });
|
|
@@ -4965,10 +4965,10 @@ const validateModel = xstate.fromCallback(({ sendBack, input: { context }, self
|
|
|
4965
4965
|
const _validateModel = async () => {
|
|
4966
4966
|
try {
|
|
4967
4967
|
// Use dynamic imports to break circular dependencies
|
|
4968
|
-
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
4968
|
+
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-CKNW1bKg.js'); });
|
|
4969
4969
|
const { SchemaValidationService } = validationServiceMod;
|
|
4970
4970
|
const validationService = new SchemaValidationService();
|
|
4971
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-
|
|
4971
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-STP972Xw.js'); });
|
|
4972
4972
|
const { Schema } = schemaMod;
|
|
4973
4973
|
// Validate model structure
|
|
4974
4974
|
const structureResult = validationService.validateModelStructure(context);
|
|
@@ -5085,7 +5085,7 @@ const createModelProperties = xstate.fromCallback(({ sendBack, input, self }) =>
|
|
|
5085
5085
|
return;
|
|
5086
5086
|
}
|
|
5087
5087
|
logger$u(`Creating ${Object.keys(propertyDefinitions).length} properties for model "${modelName}" (id: ${_dbId})`);
|
|
5088
|
-
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
5088
|
+
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-B-cZm1yU.js'); });
|
|
5089
5089
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
5090
5090
|
if (!ModelProperty) {
|
|
5091
5091
|
logger$u('ModelProperty not available from dynamic import');
|
|
@@ -5225,7 +5225,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
|
|
|
5225
5225
|
const evictionEpoch = currentEvictionEpoch();
|
|
5226
5226
|
/** The schema to validate against; throws (validation then skips the schema check) once it was evicted. */
|
|
5227
5227
|
const schemaForValidation = async (schemaName) => {
|
|
5228
|
-
const { Schema } = await Promise.resolve().then(function () { return require('./Schema-
|
|
5228
|
+
const { Schema } = await Promise.resolve().then(function () { return require('./Schema-STP972Xw.js'); });
|
|
5229
5229
|
if (schemaEvictedSince(schemaName, evictionEpoch)) {
|
|
5230
5230
|
throw new Error(`Schema "${schemaName}" was evicted during validation`);
|
|
5231
5231
|
}
|
|
@@ -5241,7 +5241,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
|
|
|
5241
5241
|
const structureMsg = `[validateEntity] Validating model structure`;
|
|
5242
5242
|
logger$t(structureMsg);
|
|
5243
5243
|
// Use existing Model validation
|
|
5244
|
-
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
5244
|
+
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-CKNW1bKg.js'); });
|
|
5245
5245
|
const { SchemaValidationService } = validationServiceMod;
|
|
5246
5246
|
const validationService = new SchemaValidationService();
|
|
5247
5247
|
// Validate model structure
|
|
@@ -5291,7 +5291,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
|
|
|
5291
5291
|
}
|
|
5292
5292
|
else if (entityInput.entityType === 'modelProperty') {
|
|
5293
5293
|
// Use existing ModelProperty validation
|
|
5294
|
-
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
5294
|
+
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-CKNW1bKg.js'); });
|
|
5295
5295
|
const { SchemaValidationService } = validationServiceMod;
|
|
5296
5296
|
const validationService = new SchemaValidationService();
|
|
5297
5297
|
// Validate property structure
|
|
@@ -5331,7 +5331,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
|
|
|
5331
5331
|
}
|
|
5332
5332
|
else if (entityInput.entityType === 'schema') {
|
|
5333
5333
|
// Schema validation - use existing validation
|
|
5334
|
-
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
5334
|
+
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-CKNW1bKg.js'); });
|
|
5335
5335
|
const { SchemaValidationService } = validationServiceMod;
|
|
5336
5336
|
const validationService = new SchemaValidationService();
|
|
5337
5337
|
const schemaResult = validationService.validateSchema(entityInput.entityData);
|
|
@@ -5420,7 +5420,7 @@ const writeToDatabase = xstate.fromCallback(({ sendBack, input }) => {
|
|
|
5420
5420
|
// initial write completes is not overwritten by the stale requestWrite payload.
|
|
5421
5421
|
let dataToWrite = input.entityData;
|
|
5422
5422
|
try {
|
|
5423
|
-
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
5423
|
+
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-B-cZm1yU.js'); });
|
|
5424
5424
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
5425
5425
|
if (ModelProperty && typeof ModelProperty.getById === 'function') {
|
|
5426
5426
|
const instance = ModelProperty.getById(input.entityId);
|
|
@@ -5814,7 +5814,7 @@ const modelMachine = xstate.setup({
|
|
|
5814
5814
|
// Create ModelProperty instances for any new property IDs
|
|
5815
5815
|
if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
|
|
5816
5816
|
// Import and create instances asynchronously (fire-and-forget)
|
|
5817
|
-
Promise.resolve().then(function () { return require('./ModelProperty-
|
|
5817
|
+
Promise.resolve().then(function () { return require('./ModelProperty-B-cZm1yU.js'); }).then(({ ModelProperty }) => {
|
|
5818
5818
|
if (self.getSnapshot().status === 'stopped')
|
|
5819
5819
|
return;
|
|
5820
5820
|
const createPromises = newPropertyIds.map(async (propertyFileId) => {
|
|
@@ -6544,7 +6544,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
6544
6544
|
const schemaNameToTry = schemaName ?? model$1?.schemaName;
|
|
6545
6545
|
if (schemaNameToTry) {
|
|
6546
6546
|
try {
|
|
6547
|
-
const { Schema } = await Promise.resolve().then(function () { return require('./Schema-
|
|
6547
|
+
const { Schema } = await Promise.resolve().then(function () { return require('./Schema-STP972Xw.js'); });
|
|
6548
6548
|
const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false });
|
|
6549
6549
|
const schemaContext = schemaInstance.getService().getSnapshot().context;
|
|
6550
6550
|
if (schemaContext.models?.[modelName]?.properties) {
|
|
@@ -6597,7 +6597,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
6597
6597
|
}
|
|
6598
6598
|
}
|
|
6599
6599
|
if (Object.keys(propertySchemas).length === 0) {
|
|
6600
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
6600
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-nA5PxBSs.js'); });
|
|
6601
6601
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
6602
6602
|
const KNOWN_MODEL_FALLBACKS = {
|
|
6603
6603
|
Post: {
|
|
@@ -6614,7 +6614,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
6614
6614
|
}
|
|
6615
6615
|
}
|
|
6616
6616
|
// Fallbacks above may return schema-file shape ({ type, model, items }); normalize to dataType/ref/refValueType.
|
|
6617
|
-
const { normalizePropertyRecordSchema } = await Promise.resolve().then(function () { return require('./property-
|
|
6617
|
+
const { normalizePropertyRecordSchema } = await Promise.resolve().then(function () { return require('./property-xMwPhQ5N.js'); });
|
|
6618
6618
|
propertySchemas = Object.fromEntries(Object.entries(propertySchemas).map(([name, def]) => [name, normalizePropertyRecordSchema(def)]));
|
|
6619
6619
|
// Collapse rows that map to the same instance key (e.g. authorIdentityIds + authors -> authors).
|
|
6620
6620
|
// ItemProperty.create cache does not sync propertyValue on hit; processing order would otherwise
|
|
@@ -6647,7 +6647,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
6647
6647
|
// Infer propertyRecordSchema from metadata when schema is missing (enables persistence)
|
|
6648
6648
|
let propSchema = propertySchemas[propertyName];
|
|
6649
6649
|
if (!propSchema && isRefTypeFromMeta) {
|
|
6650
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
6650
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-nA5PxBSs.js'); });
|
|
6651
6651
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
6652
6652
|
propSchema = {
|
|
6653
6653
|
dataType: refSeedType === 'html' ? ModelPropertyDataTypes.Html
|
|
@@ -6914,9 +6914,9 @@ const runPublish = xstate.fromCallback(({ sendBack, input: { context } }) => {
|
|
|
6914
6914
|
sendBack({ type: 'publishError', error: new Error(`Item not found for seedLocalId: ${seedLocalId}`) });
|
|
6915
6915
|
return;
|
|
6916
6916
|
}
|
|
6917
|
-
const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-
|
|
6917
|
+
const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-BQr8aMVP.js'); });
|
|
6918
6918
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
6919
|
-
const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-
|
|
6919
|
+
const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-BsZWiJ03.js'); });
|
|
6920
6920
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
6921
6921
|
const uploads = await getPublishUploads(item);
|
|
6922
6922
|
let uploadedTransactions = [];
|
|
@@ -7891,7 +7891,7 @@ const resolveRelatedValue = xstate.fromCallback(({ sendBack, input: { context }
|
|
|
7891
7891
|
const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
|
|
7892
7892
|
const _resolveRelatedValue = async () => {
|
|
7893
7893
|
// Use dynamic import to break circular dependency
|
|
7894
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
7894
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-nA5PxBSs.js'); });
|
|
7895
7895
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
7896
7896
|
if (!propertyValue || !isRelation || populatedFromDb) {
|
|
7897
7897
|
return;
|
|
@@ -8385,7 +8385,7 @@ const hydrateFromDb = xstate.fromCallback(({ sendBack, input: { context } }) =>
|
|
|
8385
8385
|
// to use dynamically imported ModelPropertyDataTypes
|
|
8386
8386
|
const _hydrateFromDb = async () => {
|
|
8387
8387
|
// Use dynamic import to break circular dependency
|
|
8388
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
8388
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-nA5PxBSs.js'); });
|
|
8389
8389
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
8390
8390
|
const appDb = BaseDb.getAppDb();
|
|
8391
8391
|
const whereClauses = [];
|
|
@@ -8762,7 +8762,7 @@ const loadOrCreateProperty = xstate.fromCallback(({ sendBack, input: { context }
|
|
|
8762
8762
|
};
|
|
8763
8763
|
// Merge with schema from file/DB to get validation rules (enum, pattern, etc.) - properties table doesn't store these
|
|
8764
8764
|
try {
|
|
8765
|
-
const { getPropertySchema } = await Promise.resolve().then(function () { return require('./property-
|
|
8765
|
+
const { getPropertySchema } = await Promise.resolve().then(function () { return require('./property-xMwPhQ5N.js'); });
|
|
8766
8766
|
let schemaFromFile = await getPropertySchema(normalizedModelName, propertyName, {
|
|
8767
8767
|
modelFileId: modelRecord?.schemaFileId ?? modelFileId,
|
|
8768
8768
|
});
|
|
@@ -9183,9 +9183,9 @@ const analyzeInput = xstate.fromCallback(({ sendBack, input: { context, event }
|
|
|
9183
9183
|
}
|
|
9184
9184
|
const _analyzeInput = async () => {
|
|
9185
9185
|
// Use dynamic import to break circular dependency
|
|
9186
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
9186
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-nA5PxBSs.js'); });
|
|
9187
9187
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
9188
|
-
const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
9188
|
+
const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-CKNW1bKg.js'); });
|
|
9189
9189
|
let propertyName = propertyNameRaw;
|
|
9190
9190
|
if (!propertyName) {
|
|
9191
9191
|
throw new Error('propertyName is required');
|
|
@@ -9365,7 +9365,9 @@ function parseAddressesPersistedPayload(value) {
|
|
|
9365
9365
|
* database and OPFS tree; the browser releases a tab's locks when it closes or crashes, so a lock
|
|
9366
9366
|
* can't go stale. See docs/MULTI_TAB.md.
|
|
9367
9367
|
*
|
|
9368
|
-
*
|
|
9368
|
+
* Node has Web Locks from 24.5, scoped to the process. Where they're missing (older Node, old
|
|
9369
|
+
* browsers), sections still run one at a time within this JS realm (see `withProcessLock`), which
|
|
9370
|
+
* covers a single Node process but not other tabs or worker threads.
|
|
9369
9371
|
* Not re-entrant: requesting a name the caller already holds waits forever, so take each lock
|
|
9370
9372
|
* only at the outermost call site.
|
|
9371
9373
|
*/
|
|
@@ -9389,7 +9391,7 @@ class TabLockTimeoutError extends Error {
|
|
|
9389
9391
|
async function withTabLock(name, fn, { timeoutMs = TAB_LOCK_WAIT_TIMEOUT_MS } = {}) {
|
|
9390
9392
|
const locks = typeof navigator !== 'undefined' ? navigator.locks : undefined;
|
|
9391
9393
|
if (!locks)
|
|
9392
|
-
return fn
|
|
9394
|
+
return withProcessLock(name, fn, { timeoutMs });
|
|
9393
9395
|
try {
|
|
9394
9396
|
// The timeout bounds the wait only; once granted, fn runs to completion. Infinity waits for as
|
|
9395
9397
|
// long as the holder runs (it can't outlive its tab).
|
|
@@ -9403,6 +9405,46 @@ async function withTabLock(name, fn, { timeoutMs = TAB_LOCK_WAIT_TIMEOUT_MS } =
|
|
|
9403
9405
|
throw error;
|
|
9404
9406
|
}
|
|
9405
9407
|
}
|
|
9408
|
+
/** Tail of each name's queue: resolves once every section queued so far has finished or given up. */
|
|
9409
|
+
const processLockTails = new Map();
|
|
9410
|
+
/**
|
|
9411
|
+
* The `withTabLock` fallback without Web Locks: an exclusive, first-come-first-served lock per name
|
|
9412
|
+
* within this JS realm. Like Web Locks, `timeoutMs` bounds the wait only, and a waiter that times
|
|
9413
|
+
* out doesn't let later waiters in before the current holder finishes.
|
|
9414
|
+
*/
|
|
9415
|
+
async function withProcessLock(name, fn, { timeoutMs = TAB_LOCK_WAIT_TIMEOUT_MS } = {}) {
|
|
9416
|
+
const previous = processLockTails.get(name) ?? Promise.resolve();
|
|
9417
|
+
let release;
|
|
9418
|
+
const done = new Promise((resolve) => (release = resolve));
|
|
9419
|
+
const tail = previous.then(() => done);
|
|
9420
|
+
processLockTails.set(name, tail);
|
|
9421
|
+
void tail.then(() => {
|
|
9422
|
+
if (processLockTails.get(name) === tail)
|
|
9423
|
+
processLockTails.delete(name);
|
|
9424
|
+
});
|
|
9425
|
+
try {
|
|
9426
|
+
await waitForTurn(previous, name, timeoutMs);
|
|
9427
|
+
}
|
|
9428
|
+
catch (error) {
|
|
9429
|
+
release();
|
|
9430
|
+
throw error;
|
|
9431
|
+
}
|
|
9432
|
+
try {
|
|
9433
|
+
return await fn();
|
|
9434
|
+
}
|
|
9435
|
+
finally {
|
|
9436
|
+
release();
|
|
9437
|
+
}
|
|
9438
|
+
}
|
|
9439
|
+
function waitForTurn(previous, name, timeoutMs) {
|
|
9440
|
+
if (!Number.isFinite(timeoutMs))
|
|
9441
|
+
return previous;
|
|
9442
|
+
let timer;
|
|
9443
|
+
const timedOut = new Promise((_, reject) => {
|
|
9444
|
+
timer = setTimeout(() => reject(new TabLockTimeoutError(name, timeoutMs)), timeoutMs);
|
|
9445
|
+
});
|
|
9446
|
+
return Promise.race([previous, timedOut]).finally(() => clearTimeout(timer));
|
|
9447
|
+
}
|
|
9406
9448
|
|
|
9407
9449
|
const logger$h = debug('seedSdk:helpers:tabCoordinator');
|
|
9408
9450
|
let state;
|
|
@@ -9675,7 +9717,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
|
|
|
9675
9717
|
propertyRecordSchema?.validation &&
|
|
9676
9718
|
metadataValues.propertyValue != null &&
|
|
9677
9719
|
metadataValues.propertyValue !== '') {
|
|
9678
|
-
const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
9720
|
+
const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-CKNW1bKg.js'); });
|
|
9679
9721
|
const validationService = new SchemaValidationService();
|
|
9680
9722
|
const validationResult = validationService.validatePropertyValue(metadataValues.propertyValue, normalizeDataType(propertyRecordSchema.dataType), propertyRecordSchema.validation, propertyRecordSchema.refValueType
|
|
9681
9723
|
? normalizeDataType(String(propertyRecordSchema.refValueType))
|
|
@@ -10257,7 +10299,7 @@ const saveRelation = xstate.fromCallback(({ sendBack, input: { context, event }
|
|
|
10257
10299
|
}
|
|
10258
10300
|
const _saveRelation = async () => {
|
|
10259
10301
|
// Use dynamic import to break circular dependency
|
|
10260
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
10302
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-nA5PxBSs.js'); });
|
|
10261
10303
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
10262
10304
|
if (!propertyNameRaw) {
|
|
10263
10305
|
throw new Error('propertyName is required');
|
|
@@ -11223,7 +11265,7 @@ class ItemProperty {
|
|
|
11223
11265
|
return;
|
|
11224
11266
|
}
|
|
11225
11267
|
// Use dynamic import to break circular dependency
|
|
11226
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
11268
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-nA5PxBSs.js'); });
|
|
11227
11269
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
11228
11270
|
const { context } = snapshot;
|
|
11229
11271
|
const { propertyRecordSchema } = context;
|
|
@@ -12667,12 +12709,12 @@ class Item {
|
|
|
12667
12709
|
};
|
|
12668
12710
|
this.getPublishUploads = async (options) => {
|
|
12669
12711
|
// Use dynamic import to break circular dependency
|
|
12670
|
-
const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-
|
|
12712
|
+
const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-BQr8aMVP.js'); });
|
|
12671
12713
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
12672
12714
|
return await getPublishUploads(this, [], undefined, options);
|
|
12673
12715
|
};
|
|
12674
12716
|
this.getPublishPayload = async (uploadedTransactions, options) => {
|
|
12675
|
-
const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-
|
|
12717
|
+
const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-BsZWiJ03.js'); });
|
|
12676
12718
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
12677
12719
|
return await getPublishPayload(this, uploadedTransactions, options);
|
|
12678
12720
|
};
|
|
@@ -14478,7 +14520,7 @@ const runEasSync = xstate.fromPromise(async ({ input, }) => {
|
|
|
14478
14520
|
requestPayload: input.requestPayload,
|
|
14479
14521
|
persistedSnapshot: input.runningSnapshot,
|
|
14480
14522
|
});
|
|
14481
|
-
const { runSyncFromEas } = await Promise.resolve().then(function () { return require('./syncDbWithEas-
|
|
14523
|
+
const { runSyncFromEas } = await Promise.resolve().then(function () { return require('./syncDbWithEas-DqRhV8o2.js'); });
|
|
14482
14524
|
try {
|
|
14483
14525
|
// Sync checks for rows and then inserts the rest (no unique index on uids), so syncs in
|
|
14484
14526
|
// different tabs take turns. A sync can run for minutes, so wait without a timeout.
|
|
@@ -19349,7 +19391,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
|
|
|
19349
19391
|
// Lazy import cache for ModelProperty to avoid circular dependency
|
|
19350
19392
|
// Eagerly start loading to minimize delay on first access
|
|
19351
19393
|
let ModelPropertyClass = null;
|
|
19352
|
-
const modelPropertyImportPromise = Promise.resolve().then(function () { return require('./ModelProperty-
|
|
19394
|
+
const modelPropertyImportPromise = Promise.resolve().then(function () { return require('./ModelProperty-B-cZm1yU.js'); })
|
|
19353
19395
|
.then(module => {
|
|
19354
19396
|
ModelPropertyClass = module.ModelProperty;
|
|
19355
19397
|
return ModelPropertyClass;
|
|
@@ -19365,7 +19407,7 @@ function getModelProperty() {
|
|
|
19365
19407
|
return ModelPropertyClass;
|
|
19366
19408
|
}
|
|
19367
19409
|
// Lazy import for Schema to avoid circular dependency
|
|
19368
|
-
const schemaImportPromise = Promise.resolve().then(function () { return require('./Schema-
|
|
19410
|
+
const schemaImportPromise = Promise.resolve().then(function () { return require('./Schema-STP972Xw.js'); })
|
|
19369
19411
|
.then(module => module.Schema)
|
|
19370
19412
|
.catch(() => null);
|
|
19371
19413
|
// WeakMap to store mutable state per Model instance
|
|
@@ -21430,7 +21472,7 @@ function resolveSdkDrizzleMigrationsDir(sdkRootDir) {
|
|
|
21430
21472
|
})();
|
|
21431
21473
|
// Also resolve relative to this module so temp-cwd tests / odd roots still find
|
|
21432
21474
|
// packages/sdk/src/db/drizzle (or dist/db/drizzle after publish).
|
|
21433
|
-
const moduleDir = path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cjs/index-
|
|
21475
|
+
const moduleDir = path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cjs/index-usKaANAq.js', document.baseURI).href))));
|
|
21434
21476
|
const candidates = [
|
|
21435
21477
|
path.join(root, 'db', 'drizzle'), // production: sdkRoot is dist/
|
|
21436
21478
|
path.join(root, 'dist', 'db', 'drizzle'), // sdk package root with built dist
|
|
@@ -21500,10 +21542,10 @@ class NodeDb {
|
|
|
21500
21542
|
logger$1('[Db.prepareDb] running migrations from %s', outDir);
|
|
21501
21543
|
await migrator.migrate(db, { migrationsFolder: outDir });
|
|
21502
21544
|
this.db = db;
|
|
21503
|
-
const { backfillMetadataPropertyIds } = await Promise.resolve().then(function () { return require('./backfillMetadataPropertyIds-
|
|
21545
|
+
const { backfillMetadataPropertyIds } = await Promise.resolve().then(function () { return require('./backfillMetadataPropertyIds-CP3y1skt.js'); });
|
|
21504
21546
|
await backfillMetadataPropertyIds();
|
|
21505
21547
|
// One-time: clear item data whose model can't be determined (seeds.model_file_id, migration 0015)
|
|
21506
|
-
const { resetAmbiguousLegacyItemData } = await Promise.resolve().then(function () { return require('./resetAmbiguousLegacyItemData-
|
|
21548
|
+
const { resetAmbiguousLegacyItemData } = await Promise.resolve().then(function () { return require('./resetAmbiguousLegacyItemData-8nfkj9rz.js'); });
|
|
21507
21549
|
await resetAmbiguousLegacyItemData();
|
|
21508
21550
|
return this.db;
|
|
21509
21551
|
}
|
|
@@ -22126,4 +22168,4 @@ exports.withSeed = withSeed;
|
|
|
22126
22168
|
exports.writeInBatches = writeInBatches;
|
|
22127
22169
|
exports.writeProcessMachine = writeProcessMachine;
|
|
22128
22170
|
exports.writeToDatabase = writeToDatabase$1;
|
|
22129
|
-
//# sourceMappingURL=index-
|
|
22171
|
+
//# sourceMappingURL=index-usKaANAq.js.map
|