chore: properly export getFileByPath
This commit is contained in:
@@ -6,9 +6,10 @@ export { extractTranslations } from '../translations/extractTranslations.js'
|
|||||||
|
|
||||||
export { formatFilesize } from '../uploads/formatFilesize.js'
|
export { formatFilesize } from '../uploads/formatFilesize.js'
|
||||||
|
|
||||||
|
export { default as getFileByPath } from '../uploads/getFileByPath.js'
|
||||||
export { default as isImage } from '../uploads/isImage.js'
|
export { default as isImage } from '../uploads/isImage.js'
|
||||||
export { combineMerge } from '../utilities/combineMerge.js'
|
|
||||||
|
|
||||||
|
export { combineMerge } from '../utilities/combineMerge.js'
|
||||||
export {
|
export {
|
||||||
configToJSONSchema,
|
configToJSONSchema,
|
||||||
entityToJSONSchema,
|
entityToJSONSchema,
|
||||||
@@ -19,26 +20,26 @@ export { createArrayFromCommaDelineated } from '../utilities/createArrayFromComm
|
|||||||
export { createLocalReq } from '../utilities/createLocalReq.js'
|
export { createLocalReq } from '../utilities/createLocalReq.js'
|
||||||
export { deepCopyObject } from '../utilities/deepCopyObject.js'
|
export { deepCopyObject } from '../utilities/deepCopyObject.js'
|
||||||
export { deepMerge } from '../utilities/deepMerge.js'
|
export { deepMerge } from '../utilities/deepMerge.js'
|
||||||
export { fieldSchemaToJSON } from '../utilities/fieldSchemaToJSON.js'
|
|
||||||
|
|
||||||
|
export { fieldSchemaToJSON } from '../utilities/fieldSchemaToJSON.js'
|
||||||
export { default as flattenTopLevelFields } from '../utilities/flattenTopLevelFields.js'
|
export { default as flattenTopLevelFields } from '../utilities/flattenTopLevelFields.js'
|
||||||
|
|
||||||
export { formatLabels, formatNames, toWords } from '../utilities/formatLabels.js'
|
export { formatLabels, formatNames, toWords } from '../utilities/formatLabels.js'
|
||||||
|
|
||||||
export { getCollectionIDFieldTypes } from '../utilities/getCollectionIDFieldTypes.js'
|
export { getCollectionIDFieldTypes } from '../utilities/getCollectionIDFieldTypes.js'
|
||||||
|
|
||||||
export { getIDType } from '../utilities/getIDType.js'
|
export { getIDType } from '../utilities/getIDType.js'
|
||||||
export { getObjectDotNotation } from '../utilities/getObjectDotNotation.js'
|
export { getObjectDotNotation } from '../utilities/getObjectDotNotation.js'
|
||||||
export { default as getUniqueListBy } from '../utilities/getUniqueListBy.js'
|
export { default as getUniqueListBy } from '../utilities/getUniqueListBy.js'
|
||||||
export { isEntityHidden } from '../utilities/isEntityHidden.js'
|
export { isEntityHidden } from '../utilities/isEntityHidden.js'
|
||||||
|
|
||||||
export { isNumber } from '../utilities/isNumber.js'
|
export { isNumber } from '../utilities/isNumber.js'
|
||||||
|
|
||||||
export { isPlainObject } from '../utilities/isPlainObject.js'
|
export { isPlainObject } from '../utilities/isPlainObject.js'
|
||||||
|
|
||||||
export { isValidID } from '../utilities/isValidID.js'
|
export { isValidID } from '../utilities/isValidID.js'
|
||||||
|
|
||||||
export { default as isolateObjectProperty } from '../utilities/isolateObjectProperty.js'
|
export { default as isolateObjectProperty } from '../utilities/isolateObjectProperty.js'
|
||||||
export { setsAreEqual } from '../utilities/setsAreEqual.js'
|
|
||||||
|
|
||||||
|
export { setsAreEqual } from '../utilities/setsAreEqual.js'
|
||||||
export { default as toKebabCase } from '../utilities/toKebabCase.js'
|
export { default as toKebabCase } from '../utilities/toKebabCase.js'
|
||||||
export { default as wait } from '../utilities/wait.js'
|
export { default as wait } from '../utilities/wait.js'
|
||||||
export { default as wordBoundariesRegex } from '../utilities/wordBoundariesRegex.js'
|
export { default as wordBoundariesRegex } from '../utilities/wordBoundariesRegex.js'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { getFileByPath } from 'payload/utilities'
|
||||||
|
|
||||||
import getFileByPath from '../../packages/payload/src/uploads/getFileByPath.js'
|
|
||||||
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
||||||
import { devUser } from '../credentials.js'
|
import { devUser } from '../credentials.js'
|
||||||
import { MediaCollection } from './collections/Media/index.js'
|
import { MediaCollection } from './collections/Media/index.js'
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { type Payload } from 'payload'
|
import { type Payload } from 'payload'
|
||||||
|
import { getFileByPath } from 'payload/utilities'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
|
|
||||||
import getFileByPath from '../../packages/payload/src/uploads/getFileByPath.js'
|
|
||||||
import { devUser } from '../credentials.js'
|
import { devUser } from '../credentials.js'
|
||||||
import { seedDB } from '../helpers/seed.js'
|
import { seedDB } from '../helpers/seed.js'
|
||||||
import { anotherArrayDoc, arrayDoc } from './collections/Array/shared.js'
|
import { anotherArrayDoc, arrayDoc } from './collections/Array/shared.js'
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { Payload } from 'payload'
|
import type { Payload } from 'payload'
|
||||||
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { getFileByPath } from 'payload/utilities'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
|
|
||||||
import type { NextRESTClient } from '../helpers/NextRESTClient.js'
|
import type { NextRESTClient } from '../helpers/NextRESTClient.js'
|
||||||
@@ -9,7 +10,6 @@ import type { Media, Page, Post, Tenant } from './payload-types.js'
|
|||||||
import { handleMessage } from '../../packages/live-preview/src/handleMessage.js'
|
import { handleMessage } from '../../packages/live-preview/src/handleMessage.js'
|
||||||
import { mergeData } from '../../packages/live-preview/src/mergeData.js'
|
import { mergeData } from '../../packages/live-preview/src/mergeData.js'
|
||||||
import { traverseRichText } from '../../packages/live-preview/src/traverseRichText.js'
|
import { traverseRichText } from '../../packages/live-preview/src/traverseRichText.js'
|
||||||
import getFileByPath from '../../packages/payload/src/uploads/getFileByPath.js'
|
|
||||||
import { Pages } from './collections/Pages.js'
|
import { Pages } from './collections/Pages.js'
|
||||||
import { postsSlug } from './collections/Posts.js'
|
import { postsSlug } from './collections/Posts.js'
|
||||||
import configPromise from './config.js'
|
import configPromise from './config.js'
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ import type { Payload } from 'payload/types'
|
|||||||
|
|
||||||
import { expect, test } from '@playwright/test'
|
import { expect, test } from '@playwright/test'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { getFileByPath } from 'payload/utilities'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
|
|
||||||
import type { Page as PayloadPage } from './payload-types.js'
|
import type { Page as PayloadPage } from './payload-types.js'
|
||||||
|
|
||||||
import getFileByPath from '../../packages/payload/src/uploads/getFileByPath.js'
|
|
||||||
import { initPageConsoleErrorCatch } from '../helpers.js'
|
import { initPageConsoleErrorCatch } from '../helpers.js'
|
||||||
import { AdminUrlUtil } from '../helpers/adminUrlUtil.js'
|
import { AdminUrlUtil } from '../helpers/adminUrlUtil.js'
|
||||||
import { initPayloadE2E } from '../helpers/initPayloadE2E.js'
|
import { initPayloadE2E } from '../helpers/initPayloadE2E.js'
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import type { Payload } from 'payload'
|
import type { Payload } from 'payload'
|
||||||
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { getFileByPath } from 'payload/utilities'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
|
|
||||||
import getFileByPath from '../../packages/payload/src/uploads/getFileByPath.js'
|
|
||||||
import { initPayloadInt } from '../helpers/initPayloadInt.js'
|
import { initPayloadInt } from '../helpers/initPayloadInt.js'
|
||||||
import removeFiles from '../helpers/removeFiles.js'
|
import removeFiles from '../helpers/removeFiles.js'
|
||||||
import configPromise from './config.js'
|
import configPromise from './config.js'
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import path from 'path'
|
|
||||||
|
|
||||||
import type { Payload, PayloadRequest } from 'payload'
|
import type { Payload, PayloadRequest } from 'payload'
|
||||||
|
|
||||||
import getFileByPath from '../../../packages/payload/src/uploads/getFileByPath.js'
|
import path from 'path'
|
||||||
|
import { getFileByPath } from 'payload/utilities'
|
||||||
|
|
||||||
import { mediaSlug } from '../shared.js'
|
import { mediaSlug } from '../shared.js'
|
||||||
|
|
||||||
export const seed = async (payload: Payload): Promise<boolean> => {
|
export const seed = async (payload: Payload): Promise<boolean> => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { getFileByPath } from 'payload/utilities'
|
||||||
|
|
||||||
import getFileByPath from '../../packages/payload/src/uploads/getFileByPath.js'
|
|
||||||
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
||||||
import { devUser } from '../credentials.js'
|
import { devUser } from '../credentials.js'
|
||||||
import removeFiles from '../helpers/removeFiles.js'
|
import removeFiles from '../helpers/removeFiles.js'
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
|
import type { Payload } from 'payload'
|
||||||
|
|
||||||
import { File as FileBuffer } from 'buffer'
|
import { File as FileBuffer } from 'buffer'
|
||||||
import NodeFormData from 'form-data'
|
import NodeFormData from 'form-data'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { getPayload } from 'payload'
|
||||||
|
import { getFileByPath } from 'payload/utilities'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
import { promisify } from 'util'
|
import { promisify } from 'util'
|
||||||
|
|
||||||
import type { Payload } from 'payload'
|
|
||||||
import type { NextRESTClient } from '../helpers/NextRESTClient.js'
|
import type { NextRESTClient } from '../helpers/NextRESTClient.js'
|
||||||
import type { Enlarge, Media } from './payload-types.js'
|
import type { Enlarge, Media } from './payload-types.js'
|
||||||
|
|
||||||
import { getPayload } from 'payload'
|
|
||||||
import getFileByPath from '../../packages/payload/src/uploads/getFileByPath.js'
|
|
||||||
import { initPayloadInt } from '../helpers/initPayloadInt.js'
|
import { initPayloadInt } from '../helpers/initPayloadInt.js'
|
||||||
import { startMemoryDB } from '../startMemoryDB.js'
|
import { startMemoryDB } from '../startMemoryDB.js'
|
||||||
import configPromise from './config.js'
|
import configPromise from './config.js'
|
||||||
@@ -653,7 +654,6 @@ describe('Collections - Uploads', () => {
|
|||||||
expect(
|
expect(
|
||||||
async () =>
|
async () =>
|
||||||
await payload.create({
|
await payload.create({
|
||||||
// @ts-expect-error
|
|
||||||
collection: 'optional-file',
|
collection: 'optional-file',
|
||||||
data: {},
|
data: {},
|
||||||
}),
|
}),
|
||||||
@@ -663,7 +663,6 @@ describe('Collections - Uploads', () => {
|
|||||||
it('should throw an error if no file and filesRequiredOnCreate is true', async () => {
|
it('should throw an error if no file and filesRequiredOnCreate is true', async () => {
|
||||||
await expect(async () =>
|
await expect(async () =>
|
||||||
payload.create({
|
payload.create({
|
||||||
// @ts-expect-error
|
|
||||||
collection: 'required-file',
|
collection: 'required-file',
|
||||||
data: {},
|
data: {},
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -171,4 +171,4 @@
|
|||||||
"app/**/*.tsx",
|
"app/**/*.tsx",
|
||||||
"scripts/**/*.ts"
|
"scripts/**/*.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user