@payloadcms/next 3.0.0-beta.102 → 3.0.0-beta.104

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.
@@ -7,7 +7,7 @@ const DEFAULT_OPTIONS = {
7
7
  abortOnLimit: false,
8
8
  createParentPath: false,
9
9
  debug: false,
10
- fileHandler: false,
10
+ defParamCharset: 'utf8',
11
11
  limitHandler: false,
12
12
  parseNested: false,
13
13
  preserveExtension: false,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["path","APIError","isEligibleRequest","processMultipart","debugLog","DEFAULT_OPTIONS","abortOnLimit","createParentPath","debug","fileHandler","limitHandler","parseNested","preserveExtension","responseOnLimit","safeFileNames","tempFileDir","join","process","cwd","uploadTimeout","uriDecodeFileNames","useTempFiles","fetchAPIFileUpload","options","request","uploadOptions","error","fields","undefined","files"],"sources":["../../src/fetchAPI-multipart/index.ts"],"sourcesContent":["import type { FetchAPIFileUploadOptions } from 'payload'\n\nimport path from 'path'\nimport { APIError } from 'payload'\n\nimport { isEligibleRequest } from './isEligibleRequest.js'\nimport { processMultipart } from './processMultipart.js'\nimport { debugLog } from './utilities.js'\n\nconst DEFAULT_OPTIONS = {\n abortOnLimit: false,\n createParentPath: false,\n debug: false,\n fileHandler: false,\n limitHandler: false,\n parseNested: false,\n preserveExtension: false,\n responseOnLimit: 'File size limit has been reached',\n safeFileNames: false,\n tempFileDir: path.join(process.cwd(), 'tmp'),\n uploadTimeout: 60000,\n uriDecodeFileNames: false,\n useTempFiles: false,\n}\n\nexport type FileShape = {\n data: Buffer\n encoding: string\n md5: Buffer | string\n mimetype: string\n mv: (filePath: string, callback: () => void) => Promise<void> | void\n name: string\n size: number\n tempFilePath: string\n truncated: boolean\n}\n\ntype FetchAPIFileUploadResponseFile = {\n data: Buffer\n mimetype: string\n name: string\n size: number\n tempFilePath?: string\n}\n\nexport type FetchAPIFileUploadResponse = {\n error?: APIError\n fields: Record<string, string>\n files: Record<string, FetchAPIFileUploadResponseFile>\n}\n\ntype FetchAPIFileUpload = (args: {\n options?: FetchAPIFileUploadOptions\n request: Request\n}) => Promise<FetchAPIFileUploadResponse>\nexport const fetchAPIFileUpload: FetchAPIFileUpload = async ({ options, request }) => {\n const uploadOptions: FetchAPIFileUploadOptions = { ...DEFAULT_OPTIONS, ...options }\n if (!isEligibleRequest(request)) {\n debugLog(uploadOptions, 'Request is not eligible for file upload!')\n return {\n error: new APIError('Request is not eligible for file upload', 500),\n fields: undefined,\n files: undefined,\n }\n } else {\n return processMultipart({ options: uploadOptions, request })\n }\n}\n"],"mappings":"AAEA,OAAOA,IAAA,MAAU;AACjB,SAASC,QAAQ,QAAQ;AAEzB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,QAAQ,QAAQ;AAEzB,MAAMC,eAAA,GAAkB;EACtBC,YAAA,EAAc;EACdC,gBAAA,EAAkB;EAClBC,KAAA,EAAO;EACPC,WAAA,EAAa;EACbC,YAAA,EAAc;EACdC,WAAA,EAAa;EACbC,iBAAA,EAAmB;EACnBC,eAAA,EAAiB;EACjBC,aAAA,EAAe;EACfC,WAAA,EAAaf,IAAA,CAAKgB,IAAI,CAACC,OAAA,CAAQC,GAAG,IAAI;EACtCC,aAAA,EAAe;EACfC,kBAAA,EAAoB;EACpBC,YAAA,EAAc;AAChB;AAgCA,OAAO,MAAMC,kBAAA,GAAyC,MAAAA,CAAO;EAAEC,OAAO;EAAEC;AAAO,CAAE;EAC/E,MAAMC,aAAA,GAA2C;IAAE,GAAGpB,eAAe;IAAE,GAAGkB;EAAQ;EAClF,IAAI,CAACrB,iBAAA,CAAkBsB,OAAA,GAAU;IAC/BpB,QAAA,CAASqB,aAAA,EAAe;IACxB,OAAO;MACLC,KAAA,EAAO,IAAIzB,QAAA,CAAS,2CAA2C;MAC/D0B,MAAA,EAAQC,SAAA;MACRC,KAAA,EAAOD;IACT;EACF,OAAO;IACL,OAAOzB,gBAAA,CAAiB;MAAEoB,OAAA,EAASE,aAAA;MAAeD;IAAQ;EAC5D;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["path","APIError","isEligibleRequest","processMultipart","debugLog","DEFAULT_OPTIONS","abortOnLimit","createParentPath","debug","defParamCharset","limitHandler","parseNested","preserveExtension","responseOnLimit","safeFileNames","tempFileDir","join","process","cwd","uploadTimeout","uriDecodeFileNames","useTempFiles","fetchAPIFileUpload","options","request","uploadOptions","error","fields","undefined","files"],"sources":["../../src/fetchAPI-multipart/index.ts"],"sourcesContent":["import type { FetchAPIFileUploadOptions } from 'payload'\n\nimport path from 'path'\nimport { APIError } from 'payload'\n\nimport { isEligibleRequest } from './isEligibleRequest.js'\nimport { processMultipart } from './processMultipart.js'\nimport { debugLog } from './utilities.js'\n\nconst DEFAULT_OPTIONS: FetchAPIFileUploadOptions = {\n abortOnLimit: false,\n createParentPath: false,\n debug: false,\n defParamCharset: 'utf8',\n limitHandler: false,\n parseNested: false,\n preserveExtension: false,\n responseOnLimit: 'File size limit has been reached',\n safeFileNames: false,\n tempFileDir: path.join(process.cwd(), 'tmp'),\n uploadTimeout: 60000,\n uriDecodeFileNames: false,\n useTempFiles: false,\n}\n\nexport type FileShape = {\n data: Buffer\n encoding: string\n md5: Buffer | string\n mimetype: string\n mv: (filePath: string, callback: () => void) => Promise<void> | void\n name: string\n size: number\n tempFilePath: string\n truncated: boolean\n}\n\ntype FetchAPIFileUploadResponseFile = {\n data: Buffer\n mimetype: string\n name: string\n size: number\n tempFilePath?: string\n}\n\nexport type FetchAPIFileUploadResponse = {\n error?: APIError\n fields: Record<string, string>\n files: Record<string, FetchAPIFileUploadResponseFile>\n}\n\ntype FetchAPIFileUpload = (args: {\n options?: FetchAPIFileUploadOptions\n request: Request\n}) => Promise<FetchAPIFileUploadResponse>\nexport const fetchAPIFileUpload: FetchAPIFileUpload = async ({ options, request }) => {\n const uploadOptions: FetchAPIFileUploadOptions = { ...DEFAULT_OPTIONS, ...options }\n if (!isEligibleRequest(request)) {\n debugLog(uploadOptions, 'Request is not eligible for file upload!')\n return {\n error: new APIError('Request is not eligible for file upload', 500),\n fields: undefined,\n files: undefined,\n }\n } else {\n return processMultipart({ options: uploadOptions, request })\n }\n}\n"],"mappings":"AAEA,OAAOA,IAAA,MAAU;AACjB,SAASC,QAAQ,QAAQ;AAEzB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,QAAQ,QAAQ;AAEzB,MAAMC,eAAA,GAA6C;EACjDC,YAAA,EAAc;EACdC,gBAAA,EAAkB;EAClBC,KAAA,EAAO;EACPC,eAAA,EAAiB;EACjBC,YAAA,EAAc;EACdC,WAAA,EAAa;EACbC,iBAAA,EAAmB;EACnBC,eAAA,EAAiB;EACjBC,aAAA,EAAe;EACfC,WAAA,EAAaf,IAAA,CAAKgB,IAAI,CAACC,OAAA,CAAQC,GAAG,IAAI;EACtCC,aAAA,EAAe;EACfC,kBAAA,EAAoB;EACpBC,YAAA,EAAc;AAChB;AAgCA,OAAO,MAAMC,kBAAA,GAAyC,MAAAA,CAAO;EAAEC,OAAO;EAAEC;AAAO,CAAE;EAC/E,MAAMC,aAAA,GAA2C;IAAE,GAAGpB,eAAe;IAAE,GAAGkB;EAAQ;EAClF,IAAI,CAACrB,iBAAA,CAAkBsB,OAAA,GAAU;IAC/BpB,QAAA,CAASqB,aAAA,EAAe;IACxB,OAAO;MACLC,KAAA,EAAO,IAAIzB,QAAA,CAAS,2CAA2C;MAC/D0B,MAAA,EAAQC,SAAA;MACRC,KAAA,EAAOD;IACT;EACF,OAAO;IACL,OAAOzB,gBAAA,CAAiB;MAAEoB,OAAA,EAASE,aAAA;MAAeD;IAAQ;EAC5D;AACF","ignoreList":[]}