@payloadcms/next 3.0.0-beta.56 → 3.0.0-beta.57
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/prod/index.js +2 -2
- package/dist/prod/styles.css +1 -1
- package/dist/routes/graphql/handler.js +8 -12
- package/dist/routes/graphql/handler.js.map +1 -1
- package/dist/routes/rest/auth/forgotPassword.d.ts.map +1 -1
- package/dist/routes/rest/auth/forgotPassword.js +7 -3
- package/dist/routes/rest/auth/forgotPassword.js.map +1 -1
- package/dist/routes/rest/auth/login.d.ts.map +1 -1
- package/dist/routes/rest/auth/login.js +9 -4
- package/dist/routes/rest/auth/login.js.map +1 -1
- package/dist/routes/rest/auth/registerFirstUser.d.ts.map +1 -1
- package/dist/routes/rest/auth/registerFirstUser.js +9 -2
- package/dist/routes/rest/auth/registerFirstUser.js.map +1 -1
- package/dist/routes/rest/auth/verifyEmail.js +1 -1
- package/dist/routes/rest/auth/verifyEmail.js.map +1 -1
- package/dist/routes/rest/buildFormState.d.ts +2 -2
- package/dist/routes/rest/buildFormState.d.ts.map +1 -1
- package/dist/routes/rest/buildFormState.js.map +1 -1
- package/dist/routes/rest/files/checkFileAccess.d.ts +2 -2
- package/dist/routes/rest/files/checkFileAccess.d.ts.map +1 -1
- package/dist/routes/rest/files/checkFileAccess.js.map +1 -1
- package/dist/routes/rest/files/getFile.d.ts +2 -2
- package/dist/routes/rest/files/getFile.d.ts.map +1 -1
- package/dist/routes/rest/files/getFile.js.map +1 -1
- package/dist/routes/rest/index.d.ts.map +1 -1
- package/dist/routes/rest/index.js +59 -91
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/routes/rest/og/index.d.ts +2 -2
- package/dist/routes/rest/og/index.d.ts.map +1 -1
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/routes/rest/routeError.d.ts +2 -2
- package/dist/routes/rest/routeError.d.ts.map +1 -1
- package/dist/routes/rest/routeError.js.map +1 -1
- package/dist/routes/rest/types.d.ts +7 -7
- package/dist/routes/rest/types.d.ts.map +1 -1
- package/dist/routes/rest/types.js.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.d.ts +3 -6
- package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.js +15 -18
- package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
- package/dist/utilities/addLocalesToRequest.d.ts +2 -5
- package/dist/utilities/addLocalesToRequest.d.ts.map +1 -1
- package/dist/utilities/addLocalesToRequest.js +8 -9
- package/dist/utilities/addLocalesToRequest.js.map +1 -1
- package/dist/utilities/headersWithCors.d.ts +2 -2
- package/dist/utilities/headersWithCors.d.ts.map +1 -1
- package/dist/utilities/headersWithCors.js.map +1 -1
- package/dist/utilities/initPage/index.d.ts.map +1 -1
- package/dist/utilities/initPage/index.js.map +1 -1
- package/dist/views/Document/getDocumentData.d.ts +2 -2
- package/dist/views/Document/getDocumentData.d.ts.map +1 -1
- package/dist/views/Document/getDocumentData.js.map +1 -1
- package/dist/views/Edit/Default/Auth/APIKey.js.map +1 -1
- package/dist/views/Edit/Default/Auth/index.d.ts.map +1 -1
- package/dist/views/Edit/Default/Auth/index.js +10 -3
- package/dist/views/Edit/Default/Auth/index.js.map +1 -1
- package/dist/views/Edit/Default/Auth/types.d.ts +1 -0
- package/dist/views/Edit/Default/Auth/types.d.ts.map +1 -1
- package/dist/views/Edit/Default/Auth/types.js.map +1 -1
- package/dist/views/Edit/Default/index.d.ts.map +1 -1
- package/dist/views/Edit/Default/index.js +1 -0
- package/dist/views/Edit/Default/index.js.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +34 -6
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
- package/dist/views/Login/LoginForm/index.js +38 -8
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/routes/rest/og/index.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../../src/routes/rest/og/index.tsx"],"sourcesContent":["import type { PayloadRequest } from 'payload'\n\nimport { PayloadIcon } from '@payloadcms/ui/shared'\nimport fs from 'fs/promises'\nimport { ImageResponse } from 'next/og.js'\nimport { NextResponse } from 'next/server.js'\nimport path from 'path'\nimport React from 'react'\nimport { fileURLToPath } from 'url'\n\nimport { OGImage } from './image.js'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\nexport const runtime = 'nodejs'\n\nexport const contentType = 'image/png'\n\nexport const generateOGImage = async ({ req }: { req: PayloadRequest }) => {\n const config = req.payload.config\n\n if (config.admin.meta.defaultOGImageType === 'off') {\n return NextResponse.json({ error: `Open Graph images are disabled` }, { status: 400 })\n }\n\n try {\n const { searchParams } = new URL(req.url)\n\n const hasTitle = searchParams.has('title')\n const title = hasTitle ? searchParams.get('title')?.slice(0, 100) : ''\n const hasLeader = searchParams.has('leader')\n const leader = hasLeader ? searchParams.get('leader')?.slice(0, 100).replace('-', ' ') : ''\n const description = searchParams.has('description') ? searchParams.get('description') : ''\n const Icon = config.admin?.components?.graphics?.Icon || PayloadIcon\n\n let fontData\n\n try {\n // TODO: replace with `.woff2` file when supported\n // See https://github.com/vercel/next.js/issues/63935\n // Or better yet, use a CDN like Google Fonts if ever supported\n fontData = fs.readFile(path.join(dirname, 'roboto-regular.woff'))\n } catch (e) {\n console.error(`Error reading font file or not readable: ${e.message}`) // eslint-disable-line no-console\n }\n\n const fontFamily = 'Roboto, sans-serif'\n\n return new ImageResponse(\n (\n <OGImage\n Icon={Icon}\n description={description}\n fontFamily={fontFamily}\n leader={leader}\n title={title}\n />\n ),\n {\n ...(fontData\n ? {\n fonts: [\n {\n name: 'Roboto',\n data: await fontData,\n style: 'normal',\n weight: 400,\n },\n ],\n }\n : {}),\n height: 630,\n width: 1200,\n },\n )\n } catch (e: any) {\n console.error(`${e.message}`) // eslint-disable-line no-console\n return NextResponse.json({ error: `Internal Server Error: ${e.message}` }, { status: 500 })\n }\n}\n"],"names":["PayloadIcon","fs","ImageResponse","NextResponse","path","React","fileURLToPath","OGImage","filename","url","dirname","runtime","contentType","generateOGImage","req","config","payload","admin","meta","defaultOGImageType","json","error","status","searchParams","URL","hasTitle","has","title","get","slice","hasLeader","leader","replace","description","Icon","components","graphics","fontData","readFile","join","e","console","message","fontFamily","fonts","name","data","style","weight","height","width"],"mappings":";AAEA,SAASA,WAAW,QAAQ,wBAAuB;AACnD,OAAOC,QAAQ,cAAa;AAC5B,SAASC,aAAa,QAAQ,aAAY;AAC1C,SAASC,YAAY,QAAQ,iBAAgB;AAC7C,OAAOC,UAAU,OAAM;AACvB,OAAOC,WAAW,QAAO;AACzB,SAASC,aAAa,QAAQ,MAAK;AAEnC,SAASC,OAAO,QAAQ,aAAY;AAEpC,MAAMC,WAAWF,cAAc,YAAYG,GAAG;AAC9C,MAAMC,UAAUN,KAAKM,OAAO,CAACF;AAE7B,OAAO,MAAMG,UAAU,SAAQ;AAE/B,OAAO,MAAMC,cAAc,YAAW;AAEtC,OAAO,MAAMC,kBAAkB,OAAO,EAAEC,GAAG,EAA2B;IACpE,MAAMC,SAASD,IAAIE,OAAO,CAACD,MAAM;IAEjC,IAAIA,OAAOE,KAAK,CAACC,IAAI,CAACC,kBAAkB,KAAK,OAAO;QAClD,OAAOhB,aAAaiB,IAAI,CAAC;YAAEC,OAAO,CAAC,8BAA8B,CAAC;QAAC,GAAG;YAAEC,QAAQ;QAAI;IACtF;IAEA,IAAI;QACF,MAAM,EAAEC,YAAY,EAAE,GAAG,IAAIC,IAAIV,IAAIL,GAAG;QAExC,MAAMgB,WAAWF,aAAaG,GAAG,CAAC;QAClC,MAAMC,QAAQF,WAAWF,aAAaK,GAAG,CAAC,UAAUC,MAAM,GAAG,OAAO;QACpE,MAAMC,YAAYP,aAAaG,GAAG,CAAC;QACnC,MAAMK,SAASD,YAAYP,aAAaK,GAAG,CAAC,WAAWC,MAAM,GAAG,KAAKG,QAAQ,KAAK,OAAO;QACzF,MAAMC,cAAcV,aAAaG,GAAG,CAAC,iBAAiBH,aAAaK,GAAG,CAAC,iBAAiB;QACxF,MAAMM,OAAOnB,OAAOE,KAAK,EAAEkB,YAAYC,UAAUF,QAAQlC;QAEzD,IAAIqC;QAEJ,IAAI;YACF,kDAAkD;YAClD,qDAAqD;YACrD,+DAA+D;YAC/DA,WAAWpC,GAAGqC,QAAQ,CAAClC,KAAKmC,IAAI,CAAC7B,SAAS;QAC5C,EAAE,OAAO8B,GAAG;YACVC,QAAQpB,KAAK,CAAC,CAAC,yCAAyC,EAAEmB,EAAEE,OAAO,CAAC,CAAC,EAAE,iCAAiC;;QAC1G;QAEA,MAAMC,aAAa;QAEnB,OAAO,IAAIzC,4BAEP,KAACK;YACC2B,MAAMA;YACND,aAAaA;YACbU,YAAYA;YACZZ,QAAQA;YACRJ,OAAOA;YAGX;YACE,GAAIU,WACA;gBACEO,OAAO;oBACL;wBACEC,MAAM;wBACNC,MAAM,MAAMT;wBACZU,OAAO;wBACPC,QAAQ;oBACV;iBACD;YACH,IACA,CAAC,CAAC;YACNC,QAAQ;YACRC,OAAO;QACT;IAEJ,EAAE,OAAOV,GAAQ;QACfC,QAAQpB,KAAK,CAAC,CAAC,EAAEmB,EAAEE,OAAO,CAAC,CAAC,EAAE,iCAAiC;;QAC/D,OAAOvC,aAAaiB,IAAI,CAAC;YAAEC,OAAO,CAAC,uBAAuB,EAAEmB,EAAEE,OAAO,CAAC,CAAC;QAAC,GAAG;YAAEpB,QAAQ;QAAI;IAC3F;AACF,EAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Collection,
|
|
1
|
+
import type { Collection, PayloadRequest, SanitizedConfig } from 'payload';
|
|
2
2
|
import { APIError } from 'payload';
|
|
3
3
|
export type ErrorResponse = {
|
|
4
4
|
data?: any;
|
|
@@ -9,6 +9,6 @@ export declare const routeError: ({ collection, config: configArg, err, req, }:
|
|
|
9
9
|
collection?: Collection;
|
|
10
10
|
config: Promise<SanitizedConfig> | SanitizedConfig;
|
|
11
11
|
err: APIError;
|
|
12
|
-
req: Partial<
|
|
12
|
+
req: Partial<PayloadRequest>;
|
|
13
13
|
}) => Promise<Response>;
|
|
14
14
|
//# sourceMappingURL=routeError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routeError.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/routeError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"routeError.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/routeError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG1E,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAKlC,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AA+D7E,eAAO,MAAM,UAAU,iDAKpB;IACD,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IAClD,GAAG,EAAE,QAAQ,CAAA;IACb,GAAG,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;CAC7B,sBA8DA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/routes/rest/routeError.ts"],"sourcesContent":["import type { Collection,
|
|
1
|
+
{"version":3,"sources":["../../../src/routes/rest/routeError.ts"],"sourcesContent":["import type { Collection, PayloadRequest, SanitizedConfig } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { APIError } from 'payload'\n\nimport { getPayloadHMR } from '../../utilities/getPayloadHMR.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\n\nexport type ErrorResponse = { data?: any; errors: unknown[]; stack?: string }\n\nconst formatErrors = (incoming: { [key: string]: unknown } | APIError): ErrorResponse => {\n if (incoming) {\n // Cannot use `instanceof` to check error type: https://github.com/microsoft/TypeScript/issues/13965\n // Instead, get the prototype of the incoming error and check its constructor name\n const proto = Object.getPrototypeOf(incoming)\n\n // Payload 'ValidationError' and 'APIError'\n if (\n (proto.constructor.name === 'ValidationError' || proto.constructor.name === 'APIError') &&\n incoming.data\n ) {\n return {\n errors: [\n {\n name: incoming.name,\n data: incoming.data,\n message: incoming.message,\n },\n ],\n }\n }\n\n // Mongoose 'ValidationError': https://mongoosejs.com/docs/api/error.html#Error.ValidationError\n if (proto.constructor.name === 'ValidationError' && 'errors' in incoming && incoming.errors) {\n return {\n errors: Object.keys(incoming.errors).reduce((acc, key) => {\n acc.push({\n field: incoming.errors[key].path,\n message: incoming.errors[key].message,\n })\n return acc\n }, []),\n }\n }\n\n if (Array.isArray(incoming.message)) {\n return {\n errors: incoming.message,\n }\n }\n\n if (incoming.name) {\n return {\n errors: [\n {\n message: incoming.message,\n },\n ],\n }\n }\n }\n\n return {\n errors: [\n {\n message: 'An unknown error occurred.',\n },\n ],\n }\n}\n\nexport const routeError = async ({\n collection,\n config: configArg,\n err,\n req,\n}: {\n collection?: Collection\n config: Promise<SanitizedConfig> | SanitizedConfig\n err: APIError\n req: Partial<PayloadRequest>\n}) => {\n let payload = req?.payload\n\n if (!payload) {\n try {\n payload = await getPayloadHMR({ config: configArg })\n } catch (e) {\n return Response.json(\n {\n message: 'There was an error initializing Payload',\n },\n { status: httpStatus.INTERNAL_SERVER_ERROR },\n )\n }\n }\n\n req.payload = payload\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n const { config, logger } = payload\n\n let response = formatErrors(err)\n\n let status = err.status || httpStatus.INTERNAL_SERVER_ERROR\n\n logger.error(err.stack)\n\n // Internal server errors can contain anything, including potentially sensitive data.\n // Therefore, error details will be hidden from the response unless `config.debug` is `true`\n if (!config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {\n response = formatErrors(new APIError('Something went wrong.'))\n }\n\n if (config.debug && config.debug === true) {\n response.stack = err.stack\n }\n\n if (collection && typeof collection.config.hooks.afterError === 'function') {\n ;({ response, status } = collection.config.hooks.afterError(\n err,\n response,\n req?.context,\n collection.config,\n ) || { response, status })\n }\n\n if (typeof config.hooks.afterError === 'function') {\n ;({ response, status } = config.hooks.afterError(\n err,\n response,\n req?.context,\n collection?.config,\n ) || {\n response,\n status,\n })\n }\n\n return Response.json(response, { headers, status })\n}\n"],"names":["httpStatus","APIError","getPayloadHMR","headersWithCors","formatErrors","incoming","proto","Object","getPrototypeOf","constructor","name","data","errors","message","keys","reduce","acc","key","push","field","path","Array","isArray","routeError","collection","config","configArg","err","req","payload","e","Response","json","status","INTERNAL_SERVER_ERROR","headers","Headers","logger","response","error","stack","debug","hooks","afterError","context"],"mappings":"AAEA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,QAAQ,QAAQ,UAAS;AAElC,SAASC,aAAa,QAAQ,mCAAkC;AAChE,SAASC,eAAe,QAAQ,qCAAoC;AAIpE,MAAMC,eAAe,CAACC;IACpB,IAAIA,UAAU;QACZ,oGAAoG;QACpG,kFAAkF;QAClF,MAAMC,QAAQC,OAAOC,cAAc,CAACH;QAEpC,2CAA2C;QAC3C,IACE,AAACC,CAAAA,MAAMG,WAAW,CAACC,IAAI,KAAK,qBAAqBJ,MAAMG,WAAW,CAACC,IAAI,KAAK,UAAS,KACrFL,SAASM,IAAI,EACb;YACA,OAAO;gBACLC,QAAQ;oBACN;wBACEF,MAAML,SAASK,IAAI;wBACnBC,MAAMN,SAASM,IAAI;wBACnBE,SAASR,SAASQ,OAAO;oBAC3B;iBACD;YACH;QACF;QAEA,+FAA+F;QAC/F,IAAIP,MAAMG,WAAW,CAACC,IAA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AqF;IACrF,4FAA4F;IAC5F,IAAI,CAACf,OAAOgB,KAAK,IAAIR,WAAWjC,WAAWkC,qBAAqB,EAAE;QAChEI,WAAWlC,aAAa,IAAIH,SAAS;IACvC;IAEA,IAAIwB,OAAOgB,KAAK,IAAIhB,OAAOgB,KAAK,KAAK,MAAM;QACzCH,SAASE,KAAK,GAAGb,IAAIa,KAAK;IAC5B;IAEA,IAAIhB,cAAc,OAAOA,WAAWC,MAAM,CAACiB,KAAK,CAACC,UAAU,KAAK,YAAY;QACxE,CAAA,EAAEL,QAAQ,EAAEL,MAAM,EAAE,GAAGT,WAAWC,MAAM,CAACiB,KAAK,CAACC,UAAU,CACzDhB,KACAW,UACAV,KAAKgB,SACLpB,WAAWC,MAAM,KACd;YAAEa;YAAUL;QAAO,CAAA;IAC1B;IAEA,IAAI,OAAOR,OAAOiB,KAAK,CAACC,UAAU,KAAK,YAAY;QAC/C,CAAA,EAAEL,QAAQ,EAAEL,MAAM,EAAE,GAAGR,OAAOiB,KAAK,CAACC,UAAU,CAC9ChB,KACAW,UACAV,KAAKgB,SACLpB,YAAYC,WACT;YACHa;YACAL;QACF,CAAA;IACF;IAEA,OAAOF,SAASC,IAAI,CAACM,UAAU;QAAEH;QAASF;IAAO;AACnD,EAAC"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import type { Collection,
|
|
2
|
-
export type BaseRouteHandler = ({ req
|
|
3
|
-
req:
|
|
1
|
+
import type { Collection, PayloadRequest, SanitizedGlobalConfig } from 'payload';
|
|
2
|
+
export type BaseRouteHandler = ({ req }: {
|
|
3
|
+
req: PayloadRequest;
|
|
4
4
|
}) => Promise<Response> | Response;
|
|
5
5
|
export type CollectionRouteHandler = ({ collection, req, }: {
|
|
6
6
|
collection: Collection;
|
|
7
|
-
req:
|
|
7
|
+
req: PayloadRequest;
|
|
8
8
|
}) => Promise<Response> | Response;
|
|
9
9
|
export type CollectionRouteHandlerWithID = ({ id, collection, req, }: {
|
|
10
10
|
collection: Collection;
|
|
11
11
|
id: string;
|
|
12
|
-
req:
|
|
12
|
+
req: PayloadRequest;
|
|
13
13
|
}) => Promise<Response> | Response;
|
|
14
14
|
export type GlobalRouteHandler = ({ globalConfig, req, }: {
|
|
15
15
|
globalConfig: SanitizedGlobalConfig;
|
|
16
|
-
req:
|
|
16
|
+
req: PayloadRequest;
|
|
17
17
|
}) => Promise<Response> | Response;
|
|
18
18
|
export type GlobalRouteHandlerWithID = ({ id, globalConfig, req, }: {
|
|
19
19
|
globalConfig: SanitizedGlobalConfig;
|
|
20
20
|
id: string;
|
|
21
|
-
req:
|
|
21
|
+
req: PayloadRequest;
|
|
22
22
|
}) => Promise<Response> | Response;
|
|
23
23
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEhF,MAAM,MAAM,gBAAgB,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,cAAc,CAAA;CAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAA;AAEjG,MAAM,MAAM,sBAAsB,GAAG,CAAC,EACpC,UAAU,EACV,GAAG,GACJ,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,GAAG,EAAE,cAAc,CAAA;CACpB,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAA;AAElC,MAAM,MAAM,4BAA4B,GAAG,CAAC,EAC1C,EAAE,EACF,UAAU,EACV,GAAG,GACJ,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,cAAc,CAAA;CACpB,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAA;AAElC,MAAM,MAAM,kBAAkB,GAAG,CAAC,EAChC,YAAY,EACZ,GAAG,GACJ,EAAE;IACD,YAAY,EAAE,qBAAqB,CAAA;IACnC,GAAG,EAAE,cAAc,CAAA;CACpB,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAA;AAElC,MAAM,MAAM,wBAAwB,GAAG,CAAC,EACtC,EAAE,EACF,YAAY,EACZ,GAAG,GACJ,EAAE;IACD,YAAY,EAAE,qBAAqB,CAAA;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,cAAc,CAAA;CACpB,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/routes/rest/types.ts"],"sourcesContent":["import type { Collection,
|
|
1
|
+
{"version":3,"sources":["../../../src/routes/rest/types.ts"],"sourcesContent":["import type { Collection, PayloadRequest, SanitizedGlobalConfig } from 'payload'\n\nexport type BaseRouteHandler = ({ req }: { req: PayloadRequest }) => Promise<Response> | Response\n\nexport type CollectionRouteHandler = ({\n collection,\n req,\n}: {\n collection: Collection\n req: PayloadRequest\n}) => Promise<Response> | Response\n\nexport type CollectionRouteHandlerWithID = ({\n id,\n collection,\n req,\n}: {\n collection: Collection\n id: string\n req: PayloadRequest\n}) => Promise<Response> | Response\n\nexport type GlobalRouteHandler = ({\n globalConfig,\n req,\n}: {\n globalConfig: SanitizedGlobalConfig\n req: PayloadRequest\n}) => Promise<Response> | Response\n\nexport type GlobalRouteHandlerWithID = ({\n id,\n globalConfig,\n req,\n}: {\n globalConfig: SanitizedGlobalConfig\n id: string\n req: PayloadRequest\n}) => Promise<Response> | Response\n"],"names":[],"mappings":"AA8BA,WAQkC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { PayloadRequest
|
|
2
|
-
type
|
|
3
|
-
type AddDataAndFileToRequest = (args: {
|
|
4
|
-
request: PayloadRequest;
|
|
5
|
-
}) => Promise<ReturnType>;
|
|
1
|
+
import type { PayloadRequest } from 'payload';
|
|
2
|
+
type AddDataAndFileToRequest = (req: PayloadRequest) => Promise<void>;
|
|
6
3
|
/**
|
|
7
|
-
* Mutates the Request
|
|
4
|
+
* Mutates the Request, appending 'data' and 'file' if found
|
|
8
5
|
*/
|
|
9
6
|
export declare const addDataAndFileToRequest: AddDataAndFileToRequest;
|
|
10
7
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addDataAndFileToRequest.d.ts","sourceRoot":"","sources":["../../src/utilities/addDataAndFileToRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"addDataAndFileToRequest.d.ts","sourceRoot":"","sources":["../../src/utilities/addDataAndFileToRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAQ7C,KAAK,uBAAuB,GAAG,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAErE;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,uBAoCrC,CAAA"}
|
|
@@ -1,45 +1,42 @@
|
|
|
1
1
|
import { APIError } from 'payload';
|
|
2
2
|
import { fetchAPIFileUpload } from '../fetchAPI-multipart/index.js';
|
|
3
3
|
/**
|
|
4
|
-
* Mutates the Request
|
|
5
|
-
*/ export const addDataAndFileToRequest = async (
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
4
|
+
* Mutates the Request, appending 'data' and 'file' if found
|
|
5
|
+
*/ export const addDataAndFileToRequest = async (req)=>{
|
|
6
|
+
const { body, headers, method, payload } = req;
|
|
7
|
+
if (method && [
|
|
8
8
|
'PATCH',
|
|
9
9
|
'POST',
|
|
10
10
|
'PUT'
|
|
11
|
-
].includes(
|
|
12
|
-
const [contentType] = (
|
|
13
|
-
const
|
|
14
|
-
const bodyByteSize = parseInt(incomingRequest.headers.get('Content-Length') || '0', 10);
|
|
11
|
+
].includes(method.toUpperCase()) && body) {
|
|
12
|
+
const [contentType] = (headers.get('Content-Type') || '').split(';');
|
|
13
|
+
const bodyByteSize = parseInt(req.headers.get('Content-Length') || '0', 10);
|
|
15
14
|
if (contentType === 'application/json') {
|
|
16
15
|
let data = {};
|
|
17
16
|
try {
|
|
18
|
-
data = await
|
|
17
|
+
data = await req.json();
|
|
19
18
|
} catch (error) {
|
|
20
|
-
|
|
19
|
+
req.payload.logger.error(error);
|
|
21
20
|
} finally{
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
req.data = data;
|
|
22
|
+
req.json = ()=>Promise.resolve(data);
|
|
24
23
|
}
|
|
25
24
|
} else if (bodyByteSize && contentType.includes('multipart/')) {
|
|
26
25
|
const { error, fields, files } = await fetchAPIFileUpload({
|
|
27
|
-
options: config.upload,
|
|
28
|
-
request:
|
|
26
|
+
options: payload.config.upload,
|
|
27
|
+
request: req
|
|
29
28
|
});
|
|
30
29
|
if (error) {
|
|
31
30
|
throw new APIError(error.message);
|
|
32
31
|
}
|
|
33
32
|
if (files?.file) {
|
|
34
|
-
|
|
33
|
+
req.file = files.file;
|
|
35
34
|
}
|
|
36
35
|
if (fields?._payload && typeof fields._payload === 'string') {
|
|
37
|
-
|
|
36
|
+
req.data = JSON.parse(fields._payload);
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
return mutableRequest;
|
|
41
39
|
}
|
|
42
|
-
return incomingRequest;
|
|
43
40
|
};
|
|
44
41
|
|
|
45
42
|
//# sourceMappingURL=addDataAndFileToRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/addDataAndFileToRequest.ts"],"sourcesContent":["import type { PayloadRequest
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/addDataAndFileToRequest.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\n\nimport { APIError } from 'payload'\n\nimport type { FetchAPIFileUploadOptions } from '../fetchAPI-multipart/index.js'\n\nimport { fetchAPIFileUpload } from '../fetchAPI-multipart/index.js'\n\ntype AddDataAndFileToRequest = (req: PayloadRequest) => Promise<void>\n\n/**\n * Mutates the Request, appending 'data' and 'file' if found\n */\nexport const addDataAndFileToRequest: AddDataAndFileToRequest = async (req) => {\n const { body, headers, method, payload } = req\n\n if (method && ['PATCH', 'POST', 'PUT'].includes(method.toUpperCase()) && body) {\n const [contentType] = (headers.get('Content-Type') || '').split(';')\n const bodyByteSize = parseInt(req.headers.get('Content-Length') || '0', 10)\n\n if (contentType === 'application/json') {\n let data = {}\n try {\n data = await req.json()\n } catch (error) {\n req.payload.logger.error(error)\n } finally {\n req.data = data\n req.json = () => Promise.resolve(data)\n }\n } else if (bodyByteSize && contentType.includes('multipart/')) {\n const { error, fields, files } = await fetchAPIFileUpload({\n options: payload.config.upload as FetchAPIFileUploadOptions,\n request: req as Request,\n })\n\n if (error) {\n throw new APIError(error.message)\n }\n\n if (files?.file) {\n req.file = files.file\n }\n\n if (fields?._payload && typeof fields._payload === 'string') {\n req.data = JSON.parse(fields._payload)\n }\n }\n }\n}\n"],"names":["APIError","fetchAPIFileUpload","addDataAndFileToRequest","req","body","headers","method","payload","includes","toUpperCase","contentType","get","split","bodyByteSize","parseInt","data","json","error","logger","Promise","resolve","fields","files","options","config","upload","request","message","file","_payload","JSON","parse"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,UAAS;AAIlC,SAASC,kBAAkB,QAAQ,iCAAgC;AAInE;;CAEC,GACD,OAAO,MAAMC,0BAAmD,OAAOC;IACrE,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGJ;IAE3C,IAAIG,UAAU;QAAC;QAAS;QAAQ;KAAM,CAACE,QAAQ,CAACF,OAAOG,WAAW,OAAOL,MAAM;QAC7E,MAAM,CAACM,YAAY,GAAG,AAACL,CAAAA,QAAQM,GAAG,CAAC,mBAAmB,EAAC,EAAGC,KAAK,CAAC;QAChE,MAAMC,eAAeC,SAASX,IAAIE,OAAO,CAACM,GAAG,CAAC,qBAAqB,KAAK;QAExE,IAAID,gBAAgB,oBAAoB;YACtC,IAAIK,OAAO,CAAC;YACZ,IAAI;gBACFA,OAAO,MAAMZ,IAAIa,IAAI;YACvB,EAAE,OAAOC,OAAO;gBACdd,IAAII,OAAO,CAACW,MAAM,CAACD,KAAK,CAACA;YAC3B,SAAU;gBACRd,IAAIY,IAAI,GAAGA;gBACXZ,IAAIa,IAAI,GAAG,IAAMG,QAAQC,OAAO,CAACL;YACnC;QACF,OAAO,IAAIF,gBAAgBH,YAAYF,QAAQ,CAAC,eAAe;YAC7D,MAAM,EAAES,KAAK,EAAEI,MAAM,EAAEC,KAAK,EAAE,GAAG,MAAMrB,mBAAmB;gBACxDsB,SAAShB,QAAQiB,MAAM,CAACC,MAAM;gBAC9BC,SAASvB;YACX;YAEA,IAAIc,OAAO;gBACT,MAAM,IAAIjB,SAASiB,MAAMU,OAAO;YAClC;YAEA,IAAIL,OAAOM,MAAM;gBACfzB,IAAIyB,IAAI,GAAGN,MAAMM,IAAI;YACvB;YAEA,IAAIP,QAAQQ,YAAY,OAAOR,OAAOQ,QAAQ,KAAK,UAAU;gBAC3D1B,IAAIY,IAAI,GAAGe,KAAKC,KAAK,CAACV,OAAOQ,QAAQ;YACvC;QACF;IACF;AACF,EAAC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import type { PayloadRequest,
|
|
1
|
+
import type { PayloadRequest, SanitizedConfig } from 'payload';
|
|
2
2
|
/**
|
|
3
3
|
* Mutates the Request to contain 'locale' and 'fallbackLocale' based on data or searchParams
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
request: PayloadRequest & PayloadRequestData;
|
|
7
|
-
};
|
|
8
|
-
export declare function addLocalesToRequestFromData({ request }: Args): PayloadRequestWithData;
|
|
5
|
+
export declare function addLocalesToRequestFromData(req: PayloadRequest): void;
|
|
9
6
|
type SanitizeLocalesArgs = {
|
|
10
7
|
fallbackLocale: string;
|
|
11
8
|
locale: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addLocalesToRequest.d.ts","sourceRoot":"","sources":["../../src/utilities/addLocalesToRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"addLocalesToRequest.d.ts","sourceRoot":"","sources":["../../src/utilities/addLocalesToRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9D;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,CA+BrE;AAED,KAAK,mBAAmB,GAAG;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,eAAe,CAAC,cAAc,CAAC,CAAA;CAC9C,CAAA;AACD,KAAK,qBAAqB,GAAG;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AACD,eAAO,MAAM,eAAe,8CAIzB,mBAAmB,KAAG,qBAiBxB,CAAA"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Mutates the Request to contain 'locale' and 'fallbackLocale' based on data or searchParams
|
|
3
|
+
*/ export function addLocalesToRequestFromData(req) {
|
|
4
|
+
const { data, payload: { config } } = req;
|
|
3
5
|
if (data) {
|
|
4
|
-
let localeOnReq =
|
|
5
|
-
let fallbackLocaleOnReq =
|
|
6
|
+
let localeOnReq = req.locale;
|
|
7
|
+
let fallbackLocaleOnReq = req.fallbackLocale;
|
|
6
8
|
if (!localeOnReq && data?.locale && typeof data.locale === 'string') {
|
|
7
9
|
localeOnReq = data.locale;
|
|
8
10
|
}
|
|
@@ -14,12 +16,9 @@ export function addLocalesToRequestFromData({ request }) {
|
|
|
14
16
|
locale: localeOnReq,
|
|
15
17
|
localization: config.localization
|
|
16
18
|
});
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
if (fallbackLocale) mutableRequest.fallbackLocale = fallbackLocale;
|
|
20
|
-
return mutableRequest;
|
|
19
|
+
if (locale) req.locale = locale;
|
|
20
|
+
if (fallbackLocale) req.fallbackLocale = fallbackLocale;
|
|
21
21
|
}
|
|
22
|
-
return request;
|
|
23
22
|
}
|
|
24
23
|
export const sanitizeLocales = ({ fallbackLocale, locale, localization })=>{
|
|
25
24
|
if ([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/addLocalesToRequest.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/addLocalesToRequest.ts"],"sourcesContent":["import type { PayloadRequest, SanitizedConfig } from 'payload'\n\n/**\n * Mutates the Request to contain 'locale' and 'fallbackLocale' based on data or searchParams\n */\nexport function addLocalesToRequestFromData(req: PayloadRequest): void {\n const {\n data,\n payload: { config },\n } = req\n\n if (data) {\n let localeOnReq = req.locale\n let fallbackLocaleOnReq = req.fallbackLocale\n\n if (!localeOnReq && data?.locale && typeof data.locale === 'string') {\n localeOnReq = data.locale\n }\n\n if (\n !fallbackLocaleOnReq &&\n data?.['fallback-locale'] &&\n typeof data?.['fallback-locale'] === 'string'\n ) {\n fallbackLocaleOnReq = data['fallback-locale']\n }\n\n const { fallbackLocale, locale } = sanitizeLocales({\n fallbackLocale: fallbackLocaleOnReq,\n locale: localeOnReq,\n localization: config.localization,\n })\n\n if (locale) req.locale = locale\n if (fallbackLocale) req.fallbackLocale = fallbackLocale\n }\n}\n\ntype SanitizeLocalesArgs = {\n fallbackLocale: string\n locale: string\n localization: SanitizedConfig['localization']\n}\ntype SanitizeLocalesReturn = {\n fallbackLocale?: string\n locale?: string\n}\nexport const sanitizeLocales = ({\n fallbackLocale,\n locale,\n localization,\n}: SanitizeLocalesArgs): SanitizeLocalesReturn => {\n if (['none', 'null'].includes(fallbackLocale)) {\n fallbackLocale = 'null'\n } else if (localization && !localization.localeCodes.includes(fallbackLocale)) {\n fallbackLocale = localization.defaultLocale\n }\n\n if (locale === '*') {\n locale = 'all'\n } else if (localization && !localization.localeCodes.includes(locale)) {\n locale = localization.defaultLocale\n }\n\n return {\n fallbackLocale,\n locale,\n }\n}\n"],"names":["addLocalesToRequestFromData","req","data","payload","config","localeOnReq","locale","fallbackLocaleOnReq","fallbackLocale","sanitizeLocales","localization","includes","localeCodes","defaultLocale"],"mappings":"AAEA;;CAEC,GACD,OAAO,SAASA,4BAA4BC,GAAmB;IAC7D,MAAM,EACJC,IAAI,EACJC,SAAS,EAAEC,MAAM,EAAE,EACpB,GAAGH;IAEJ,IAAIC,MAAM;QACR,IAAIG,cAAcJ,IAAIK,MAAM;QAC5B,IAAIC,sBAAsBN,IAAIO,cAAc;QAE5C,IAAI,CAACH,eAAeH,MAAMI,UAAU,OAAOJ,KAAKI,MAAM,KAAK,UAAU;YACnED,cAAcH,KAAKI,MAAM;QAC3B;QAEA,IACE,CAACC,uBACDL,MAAM,CAAC,kBAAkB,IACzB,OAAOA,MAAM,CAAC,kBAAkB,KAAK,UACrC;YACAK,sBAAsBL,IAAI,CAAC,kBAAkB;QAC/C;QAEA,MAAM,EAAEM,cAAc,EAAEF,MAAM,EAAE,GAAGG,gBAAgB;YACjDD,gBAAgBD;YAChBD,QAAQD;YACRK,cAAcN,OAAOM,YAAY;QACnC;QAEA,IAAIJ,QAAQL,IAAIK,MAAM,GAAGA;QACzB,IAAIE,gBAAgBP,IAAIO,cAAc,GAAGA;IAC3C;AACF;AAWA,OAAO,MAAMC,kBAAkB,CAAC,EAC9BD,cAAc,EACdF,MAAM,EACNI,YAAY,EACQ;IACpB,IAAI;QAAC;QAAQ;KAAO,CAACC,QAAQ,CAACH,iBAAiB;QAC7CA,iBAAiB;IACnB,OAAO,IAAIE,gBAAgB,CAACA,aAAaE,WAAW,CAACD,QAAQ,CAACH,iBAAiB;QAC7EA,iBAAiBE,aAAaG,aAAa;IAC7C;IAEA,IAAIP,WAAW,KAAK;QAClBA,SAAS;IACX,OAAO,IAAII,gBAAgB,CAACA,aAAaE,WAAW,CAACD,QAAQ,CAACL,SAAS;QACrEA,SAASI,aAAaG,aAAa;IACrC;IAEA,OAAO;QACLL;QACAF;IACF;AACF,EAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PayloadRequest } from 'payload';
|
|
2
2
|
type CorsArgs = {
|
|
3
3
|
headers: Headers;
|
|
4
|
-
req: Partial<
|
|
4
|
+
req: Partial<PayloadRequest>;
|
|
5
5
|
};
|
|
6
6
|
export declare const headersWithCors: ({ headers, req }: CorsArgs) => Headers;
|
|
7
7
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headersWithCors.d.ts","sourceRoot":"","sources":["../../src/utilities/headersWithCors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"headersWithCors.d.ts","sourceRoot":"","sources":["../../src/utilities/headersWithCors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,KAAK,QAAQ,GAAG;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;CAC7B,CAAA;AACD,eAAO,MAAM,eAAe,qBAAsB,QAAQ,KAAG,OAoB5D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/headersWithCors.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/headersWithCors.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\n\ntype CorsArgs = {\n headers: Headers\n req: Partial<PayloadRequest>\n}\nexport const headersWithCors = ({ headers, req }: CorsArgs): Headers => {\n const cors = req?.payload.config.cors\n const requestOrigin = req?.headers.get('Origin')\n\n if (cors) {\n headers.set('Access-Control-Allow-Methods', 'PUT, PATCH, POST, GET, DELETE, OPTIONS')\n headers.set(\n 'Access-Control-Allow-Headers',\n 'Origin, X-Requested-With, Content-Type, Accept, Authorization, Content-Encoding, x-apollo-tracing',\n )\n\n if (cors === '*') {\n headers.set('Access-Control-Allow-Origin', '*')\n } else if (Array.isArray(cors) && cors.indexOf(requestOrigin) > -1) {\n headers.set('Access-Control-Allow-Credentials', 'true')\n headers.set('Access-Control-Allow-Origin', requestOrigin)\n }\n }\n\n return headers\n}\n"],"names":["headersWithCors","headers","req","cors","payload","config","requestOrigin","get","set","Array","isArray","indexOf"],"mappings":"AAMA,OAAO,MAAMA,kBAAkB,CAAC,EAAEC,OAAO,EAAEC,GAAG,EAAY;IACxD,MAAMC,OAAOD,KAAKE,QAAQC,OAAOF;IACjC,MAAMG,gBAAgBJ,KAAKD,QAAQM,IAAI;IAEvC,IAAIJ,MAAM;QACRF,QAAQO,GAAG,CAAC,gCAAgC;QAC5CP,QAAQO,GAAG,CACT,gCACA;QAGF,IAAIL,SAAS,KAAK;YAChBF,QAAQO,GAAG,CAAC,+BAA+B;QAC7C,OAAO,IAAIC,MAAMC,OAAO,CAACP,SAASA,KAAKQ,OAAO,CAACL,iBAAiB,CAAC,GAAG;YAClEL,QAAQO,GAAG,CAAC,oCAAoC;YAChDP,QAAQO,GAAG,CAAC,+BAA+BF;QAC7C;IACF;IAEA,OAAOL;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/initPage/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/initPage/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAA2C,MAAM,SAAS,CAAA;AAQtF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAOtC,eAAO,MAAM,QAAQ,iFAKlB,IAAI,KAAG,OAAO,CAAC,cAAc,CAyI/B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utilities/initPage/index.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { InitPageResult, Locale,
|
|
1
|
+
{"version":3,"sources":["../../../src/utilities/initPage/index.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { InitPageResult, Locale, PayloadRequest, VisibleEntities } from 'payload'\n\nimport { initI18n } from '@payloadcms/translations'\nimport { findLocaleFromCode } from '@payloadcms/ui/shared'\nimport { headers as getHeaders } from 'next/headers.js'\nimport { createLocalReq, isEntityHidden, parseCookies } from 'payload'\nimport qs from 'qs'\n\nimport type { Args } from './types.js'\n\nimport { getPayloadHMR } from '../getPayloadHMR.js'\nimport { getRequestLanguage } from '../getRequestLanguage.js'\nimport { handleAdminPage } from './handleAdminPage.js'\nimport { handleAuthRedirect } from './handleAuthRedirect.js'\n\nexport const initPage = async ({\n config: configPromise,\n redirectUnauthenticatedUser = false,\n route,\n searchParams,\n}: Args): Promise<InitPageResult> => {\n const headers = getHeaders()\n const payload = await getPayloadHMR({ config: configPromise })\n\n const {\n collections,\n globals,\n i18n: i18nConfig,\n localization,\n routes: { admin: adminRoute },\n } = payload.config\n\n const queryString = `${qs.stringify(searchParams ?? {}, { addQueryPrefix: true })}`\n const cookies = parseCookies(headers)\n const language = getRequestLanguage({ config: payload.config, cookies, headers })\n\n const i18n: I18nClient = await initI18n({\n config: i18nConfig,\n context: 'client',\n language,\n })\n\n const languageOptions = Object.entries(payload.config.i18n.supportedLanguages || {}).reduce(\n (acc, [language, languageConfig]) => {\n if (Object.keys(payload.config.i18n.supportedLanguages).includes(language)) {\n acc.push({\n label: languageConfig.translations.general.thisLanguage,\n value: language,\n })\n }\n\n return acc\n },\n [],\n )\n\n const req = await createLocalReq(\n {\n fallbackLocale: null,\n req: {\n host: headers.get('host'),\n i18n,\n query: qs.parse(queryString, {\n depth: 10,\n ignoreQueryPrefix: true,\n }),\n url: `${payload.config.serverURL}${route}${searchParams ? queryString : ''}`,\n } as PayloadRequest,\n },\n payload,\n )\n\n const { permissions, user } = await payload.auth({ headers, req })\n req.user = user\n\n const localeParam = searchParams?.locale as string\n let locale: Locale\n\n if (localization) {\n const defaultLocaleCode = localization.defaultLocale ? localization.defaultLocale : 'en'\n let localeCode: string = localeParam\n\n if (!localeCode) {\n try {\n localeCode = await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n user,\n where: {\n and: [\n {\n 'user.relationTo': {\n equals: payload.config.admin.user,\n },\n },\n {\n 'user.value': {\n equals: user.id,\n },\n },\n {\n key: {\n equals: 'locale',\n },\n },\n ],\n },\n })\n ?.then((res) => res.docs?.[0]?.value as string)\n } catch (error) {} // eslint-disable-line no-empty\n }\n\n locale = findLocaleFromCode(localization, localeCode)\n\n if (!locale) locale = findLocaleFromCode(localization, defaultLocaleCode)\n req.locale = locale.code\n }\n\n const visibleEntities: VisibleEntities = {\n collections: collections\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n globals: globals\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n }\n\n if (redirectUnauthenticatedUser && !user) {\n handleAuthRedirect({\n config: payload.config,\n redirectUnauthenticatedUser,\n route,\n searchParams,\n })\n }\n\n const { collectionConfig, docID, globalConfig } = handleAdminPage({\n adminRoute,\n config: payload.config,\n permissions,\n route,\n })\n\n return {\n collectionConfig,\n cookies,\n docID,\n globalConfig,\n languageOptions,\n locale,\n permissions,\n req,\n translations: i18n.translations,\n visibleEntities,\n }\n}\n"],"names":["initI18n","findLocaleFromCode","headers","getHeaders","createLocalReq","isEntityHidden","parseCookies","qs","getPayloadHMR","getRequestLanguage","handleAdminPage","handleAuthRedirect","initPage","config","configPromise","redirectUnauthenticatedUser","route","searchParams","payload","collections","globals","i18n","i18nConfig","localization","routes","admin","adminRoute","queryString","stringify","addQueryPrefix","cookies","language","context","languageOptions","Object","entries","supportedLanguages","reduce","acc","languageConfig","keys","includes","push","label","translations","general","thisLanguage","value","req","fallbackLocale","host","get","query","parse","depth","ignoreQueryPrefix","url","serverURL","permissions","user","auth","localeParam","locale","defaultLocaleCode","defaultLocale","localeCode","find","collection","limit","where","and","equals","id","key","then","res","docs","error","code","visibleEntities","map","slug","hidden","filter","Boolean","collectionConfig","docID","globalConfig"],"mappings":"AAGA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,kBAAkB,QAAQ,wBAAuB;AAC1D,SAASC,WAAWC,UAAU,QAAQ,kBAAiB;AACvD,SAASC,cAAc,EAAEC,cAAc,EAAEC,YAAY,QAAQ,UAAS;AACtE,OAAOC,QAAQ,KAAI;AAInB,SAASC,aAAa,QAAQ,sBAAqB;AACnD,SAASC,kBAAkB,QAAQ,2BAA0B;AAC7D,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,kBAAkB,QAAQ,0BAAyB;AAE5D,OAAO,MAAMC,WAAW,OAAO,EAC7BC,QAAQC,aAAa,EACrBC,8BAA8B,KAAK,EACnCC,KAAK,EACLC,YAAY,EACP;IACL,MAAMf,UAAUC;IAChB,MAAMe,UAAU,MAAMV,cAAc;QAAEK,QAAQC;IAAc;IAE5D,MAAM,EACJK,WAAW,EACXC,OAAO,EACPC,MAAMC,UAAU,EAChBC,YAAY,EACZC,QAAQ,EAAEC,OAAOC,UAAU,EAAE,EAC9B,GAAGR,QAAQL,MAAM;IAElB,MAAMc,cAAc,CAAC,EAAEpB,GAAGqB,SAAS,CAACX,gBAAgB,CAAC,GAAG;QAAEY,gBAAgB;IAAK,GAAG,CAAC;IACnF,MAAMC,UAAUxB,aAAaJ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AAKuB,YAAY;QAC/BmC;IACF;AACF,EAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Data, Locale,
|
|
1
|
+
import type { Data, Locale, PayloadRequest, SanitizedCollectionConfig, SanitizedGlobalConfig } from 'payload';
|
|
2
2
|
export declare const getDocumentData: (args: {
|
|
3
3
|
collectionConfig?: SanitizedCollectionConfig;
|
|
4
4
|
globalConfig?: SanitizedGlobalConfig;
|
|
5
5
|
id?: number | string;
|
|
6
6
|
locale: Locale;
|
|
7
|
-
req:
|
|
7
|
+
req: PayloadRequest;
|
|
8
8
|
}) => Promise<Data>;
|
|
9
9
|
//# sourceMappingURL=getDocumentData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDocumentData.d.ts","sourceRoot":"","sources":["../../../src/views/Document/getDocumentData.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,MAAM,EACN,
|
|
1
|
+
{"version":3,"file":"getDocumentData.d.ts","sourceRoot":"","sources":["../../../src/views/Document/getDocumentData.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,MAAM,EACN,cAAc,EACd,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAKhB,eAAO,MAAM,eAAe,SAAgB;IAC1C,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC,IAAI,CA4Bf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/Document/getDocumentData.tsx"],"sourcesContent":["import type {\n Data,\n Locale,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/views/Document/getDocumentData.tsx"],"sourcesContent":["import type {\n Data,\n Locale,\n PayloadRequest,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport { reduceFieldsToValues } from '@payloadcms/ui/shared'\nimport { buildFormState } from '@payloadcms/ui/utilities/buildFormState'\n\nexport const getDocumentData = async (args: {\n collectionConfig?: SanitizedCollectionConfig\n globalConfig?: SanitizedGlobalConfig\n id?: number | string\n locale: Locale\n req: PayloadRequest\n}): Promise<Data> => {\n const { id, collectionConfig, globalConfig, locale, req } = args\n\n try {\n const formState = await buildFormState({\n req: {\n ...req,\n data: {\n id,\n collectionSlug: collectionConfig?.slug,\n globalSlug: globalConfig?.slug,\n locale: locale?.code,\n operation: (collectionConfig && id) || globalConfig ? 'update' : 'create',\n schemaPath: collectionConfig?.slug || globalConfig?.slug,\n },\n },\n })\n\n const data = reduceFieldsToValues(formState, true)\n\n return {\n data,\n formState,\n }\n } catch (error) {\n console.error('Error getting document data', error) // eslint-disable-line no-console\n return {}\n }\n}\n"],"names":["reduceFieldsToValues","buildFormState","getDocumentData","args","id","collectionConfig","globalConfig","locale","req","formState","data","collectionSlug","slug","globalSlug","code","operation","schemaPath","error","console"],"mappings":"AAQA,SAASA,oBAAoB,QAAQ,wBAAuB;AAC5D,SAASC,cAAc,QAAQ,0CAAyC;AAExE,OAAO,MAAMC,kBAAkB,OAAOC;IAOpC,MAAM,EAAEC,EAAE,EAAEC,gBAAgB,EAAEC,YAAY,EAAEC,MAAM,EAAEC,GAAG,EAAE,GAAGL;IAE5D,IAAI;QACF,MAAMM,YAAY,MAAMR,eAAe;YACrCO,KAAK;gBACH,GAAGA,GAAG;gBACNE,MAAM;oBACJN;oBACAO,gBAAgBN,kBAAkBO;oBAClCC,YAAYP,cAAcM;oBAC1BL,QAAQA,QAAQO;oBAChBC,WAAW,AAACV,oBAAoBD,MAAOE,eAAe,WAAW;oBACjEU,YAAYX,kBAAkBO,QAAQN,cAAcM;gBACtD;YACF;QACF;QAEA,MAAMF,OAAOV,qBAAqBS,WAAW;QAE7C,OAAO;YACLC;YACAD;QACF;IACF,EAAE,OAAOQ,OAAO;QACdC,QAAQD,KAAK,CAAC,+BAA+BA,OAAO,iCAAiC;;QACrF,OAAO,CAAC;IACV;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/views/Edit/Default/Auth/APIKey.tsx"],"sourcesContent":["'use client'\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/views/Edit/Default/Auth/APIKey.tsx"],"sourcesContent":["'use client'\nimport type { PayloadRequest } from 'payload'\n\nimport {\n CopyToClipboard,\n FieldLabel,\n GenerateConfirmation,\n useConfig,\n useField,\n useFormFields,\n useTranslation,\n} from '@payloadcms/ui'\nimport { text } from 'payload/shared'\nimport React, { useEffect, useMemo, useState } from 'react'\nimport { v4 as uuidv4 } from 'uuid'\n\nconst path = 'apiKey'\nconst baseClass = 'api-key'\nconst fieldBaseClass = 'field-type'\n\nexport const APIKey: React.FC<{ enabled: boolean; readOnly?: boolean }> = ({\n enabled,\n readOnly,\n}) => {\n const [initialAPIKey] = useState(uuidv4())\n const [highlightedField, setHighlightedField] = useState(false)\n const { t } = useTranslation()\n const config = useConfig()\n\n const apiKey = useFormFields(([fields]) => (fields && fields[path]) || null)\n\n const validate = (val) =>\n text(val, {\n name: 'apiKey',\n type: 'text',\n data: {},\n maxLength: 48,\n minLength: 24,\n preferences: { fields: {} },\n req: {\n payload: {\n config,\n },\n t,\n } as PayloadRequest,\n siblingData: {},\n })\n\n const apiKeyValue = apiKey?.value\n\n const APIKeyLabel = useMemo(\n () => (\n <div className={`${baseClass}__label`}>\n <span>API Key</span>\n <CopyToClipboard value={apiKeyValue as string} />\n </div>\n ),\n [apiKeyValue],\n )\n\n const fieldType = useField({\n path: 'apiKey',\n validate,\n })\n\n const highlightField = () => {\n if (highlightedField) {\n setHighlightedField(false)\n }\n setTimeout(() => {\n setHighlightedField(true)\n }, 1)\n }\n\n const { setValue, value } = fieldType\n\n useEffect(() => {\n if (!apiKeyValue && enabled) {\n setValue(initialAPIKey)\n }\n if (!enabled) {\n setValue(null)\n }\n }, [apiKeyValue, enabled, setValue, initialAPIKey])\n\n useEffect(() => {\n if (highlightedField) {\n setTimeout(() => {\n setHighlightedField(false)\n }, 10000)\n }\n }, [highlightedField])\n\n if (!enabled) {\n return null\n }\n\n return (\n <React.Fragment>\n <div className={[fieldBaseClass, 'api-key', 'read-only'].filter(Boolean).join(' ')}>\n <FieldLabel CustomLabel={APIKeyLabel} htmlFor={path} />\n <input\n className={highlightedField ? 'highlight' : undefined}\n disabled\n id=\"apiKey\"\n name=\"apiKey\"\n type=\"text\"\n value={(value as string) || ''}\n />\n </div>\n {!readOnly && (\n <GenerateConfirmation highlightField={highlightField} setKey={() => setValue(uuidv4())} />\n )}\n </React.Fragment>\n )\n}\n"],"names":["CopyToClipboard","FieldLabel","GenerateConfirmation","useConfig","useField","useFormFields","useTranslation","text","React","useEffect","useMemo","useState","v4","uuidv4","path","baseClass","fieldBaseClass","APIKey","enabled","readOnly","initialAPIKey","highlightedField","setHighlightedField","t","config","apiKey","fields","validate","val","name","type","data","maxLength","minLength","preferences","req","payload","siblingData","apiKeyValue","value","APIKeyLabel","div","className","span","fieldType","highlightField","setTimeout","setValue","Fragment","filter","Boolean","join","CustomLabel","htmlFor","input","undefined","disabled","id","setKey"],"mappings":"AAAA;;AAGA,SACEA,eAAe,EACfC,UAAU,EACVC,oBAAoB,EACpBC,SAAS,EACTC,QAAQ,EACRC,aAAa,EACbC,cAAc,QACT,iBAAgB;AACvB,SAASC,IAAI,QAAQ,iBAAgB;AACrC,OAAOC,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAC3D,SAASC,MAAMC,MAAM,QAAQ,OAAM;AAEnC,MAAMC,OAAO;AACb,MAAMC,YAAY;AAClB,MAAMC,iBAAiB;AAEvB,OAAO,MAAMC,SAA6D,CAAC,EACzEC,OAAO,EACPC,QAAQ,EACT;IACC,MAAM,CAACC,cAA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BAAC1B;oBAAgB;oBAAW;iBAAY,CAACiC,MAAM,CAACC,SAASC,IAAI,CAAC;;kCAC5E,KAAClD;wBAAWmD,aAAaZ;wBAAaa,SAASvC;;kCAC/C,KAACwC;wBACCZ,WAAWrB,mBAAmB,cAAckC;wBAC5CC,QAAQ;wBACRC,IAAG;wBACH5B,MAAK;wBACLC,MAAK;wBACLS,OAAO,AAACA,SAAoB;;;;YAG/B,CAACpB,0BACA,KAACjB;gBAAqB2C,gBAAgBA;gBAAgBa,QAAQ,IAAMX,SAASlC;;;;AAIrF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/Edit/Default/Auth/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/Edit/Default/Auth/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAG/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGvC,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAkKhC,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button, CheckboxField, ConfirmPasswordField, EmailField, PasswordField, useConfig, useDocumentInfo, useFormFields, useFormModified, useTranslation } from '@payloadcms/ui';
|
|
3
|
+
import { Button, CheckboxField, ConfirmPasswordField, EmailField, PasswordField, TextField, useConfig, useDocumentInfo, useFormFields, useFormModified, useTranslation } from '@payloadcms/ui';
|
|
4
4
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
5
5
|
import { toast } from 'sonner';
|
|
6
6
|
import { APIKey } from './APIKey.js';
|
|
7
7
|
const baseClass = 'auth-fields';
|
|
8
8
|
export const Auth = (props)=>{
|
|
9
|
-
const { className, collectionSlug, disableLocalStrategy, email, operation, readOnly, requirePassword, useAPIKey, verify } = props;
|
|
9
|
+
const { className, collectionSlug, disableLocalStrategy, email, loginWithUsername, operation, readOnly, requirePassword, useAPIKey, verify } = props;
|
|
10
10
|
const [changingPassword, setChangingPassword] = useState(requirePassword);
|
|
11
11
|
const enableAPIKey = useFormFields(([fields])=>fields && fields?.enableAPIKey || null);
|
|
12
12
|
const dispatchFields = useFormFields((reducer)=>reducer[1]);
|
|
@@ -74,7 +74,7 @@ export const Auth = (props)=>{
|
|
|
74
74
|
children: [
|
|
75
75
|
!disableLocalStrategy && /*#__PURE__*/ _jsxs(React.Fragment, {
|
|
76
76
|
children: [
|
|
77
|
-
/*#__PURE__*/ _jsx(EmailField, {
|
|
77
|
+
!loginWithUsername && /*#__PURE__*/ _jsx(EmailField, {
|
|
78
78
|
autoComplete: "email",
|
|
79
79
|
disabled: disabled,
|
|
80
80
|
label: t('general:email'),
|
|
@@ -82,6 +82,13 @@ export const Auth = (props)=>{
|
|
|
82
82
|
readOnly: readOnly,
|
|
83
83
|
required: true
|
|
84
84
|
}),
|
|
85
|
+
loginWithUsername && /*#__PURE__*/ _jsx(TextField, {
|
|
86
|
+
disabled: disabled,
|
|
87
|
+
label: t('authentication:username'),
|
|
88
|
+
name: "username",
|
|
89
|
+
readOnly: readOnly,
|
|
90
|
+
required: true
|
|
91
|
+
}),
|
|
85
92
|
(changingPassword || requirePassword) && /*#__PURE__*/ _jsxs("div", {
|
|
86
93
|
className: `${baseClass}__changing-password`,
|
|
87
94
|
children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/views/Edit/Default/Auth/index.tsx"],"sourcesContent":["'use client'\n\nimport {\n Button,\n CheckboxField,\n ConfirmPasswordField,\n EmailField,\n PasswordField,\n useConfig,\n useDocumentInfo,\n useFormFields,\n useFormModified,\n useTranslation,\n} from '@payloadcms/ui'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { toast } from 'sonner'\n\nimport type { Props } from './types.js'\n\nimport { APIKey } from './APIKey.js'\nimport './index.scss'\n\nconst baseClass = 'auth-fields'\n\nexport const Auth: React.FC<Props> = (props) => {\n const {\n className,\n collectionSlug,\n disableLocalStrategy,\n email,\n operation,\n readOnly,\n requirePassword,\n useAPIKey,\n verify,\n } = props\n\n const [changingPassword, setChangingPassword] = useState(requirePassword)\n const enableAPIKey = useFormFields(([fields]) => (fields && fields?.enableAPIKey) || null)\n const dispatchFields = useFormFields((reducer) => reducer[1])\n const modified = useFormModified()\n const { i18n, t } = useTranslation()\n const { isInitializing } = useDocumentInfo()\n\n const {\n routes: { api },\n serverURL,\n } = useConfig()\n\n const handleChangePassword = useCallback(\n (state: boolean) => {\n if (!state) {\n dispatchFields({ type: 'REMOVE', path: 'password' })\n dispatchFields({ type: 'REMOVE', path: 'confirm-password' })\n }\n\n setChangingPassword(state)\n },\n [dispatchFields],\n )\n\n const unlock = useCallback(async () => {\n const url = `${serverURL}${api}/${collectionSlug}/unlock`\n const response = await fetch(url, {\n body: JSON.stringify({\n email,\n }),\n credentials: 'include',\n headers: {\n 'Accept-Language': i18n.language,\n 'Content-Type': 'application/json',\n },\n method: 'post',\n })\n\n if (response.status === 200) {\n toast.success(t('authentication:successfullyUnlocked'))\n } else {\n toast.error(t('authentication:failedToUnlock'))\n }\n }, [i18n, serverURL, api, collectionSlug, email, t])\n\n useEffect(() => {\n if (!modified) {\n setChangingPassword(false)\n }\n }, [modified])\n\n if (disableLocalStrategy && !useAPIKey) {\n return null\n }\n\n const disabled = readOnly || isInitializing\n\n return (\n <div className={[baseClass, className].filter(Boolean).join(' ')}>\n {!disableLocalStrategy && (\n <React.Fragment>\n <EmailField\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/views/Edit/Default/Auth/index.tsx"],"sourcesContent":["'use client'\n\nimport {\n Button,\n CheckboxField,\n ConfirmPasswordField,\n EmailField,\n PasswordField,\n TextField,\n useConfig,\n useDocumentInfo,\n useFormFields,\n useFormModified,\n useTranslation,\n} from '@payloadcms/ui'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { toast } from 'sonner'\n\nimport type { Props } from './types.js'\n\nimport { APIKey } from './APIKey.js'\nimport './index.scss'\n\nconst baseClass = 'auth-fields'\n\nexport const Auth: React.FC<Props> = (props) => {\n const {\n className,\n collectionSlug,\n disableLocalStrategy,\n email,\n loginWithUsername,\n operation,\n readOnly,\n requirePassword,\n useAPIKey,\n verify,\n } = props\n\n const [changingPassword, setChangingPassword] = useState(requirePassword)\n const enableAPIKey = useFormFields(([fields]) => (fields && fields?.enableAPIKey) || null)\n const dispatchFields = useFormFields((reducer) => reducer[1])\n const modified = useFormModified()\n const { i18n, t } = useTranslation()\n const { isInitializing } = useDocumentInfo()\n\n const {\n routes: { api },\n serverURL,\n } = useConfig()\n\n const handleChangePassword = useCallback(\n (state: boolean) => {\n if (!state) {\n dispatchFields({ type: 'REMOVE', path: 'password' })\n dispatchFields({ type: 'REMOVE', path: 'confirm-password' })\n }\n\n setChangingPassword(state)\n },\n [dispatchFields],\n )\n\n const unlock = useCallback(async () => {\n const url = `${serverURL}${api}/${collectionSlug}/unlock`\n const response = await fetch(url, {\n body: JSON.stringify({\n email,\n }),\n credentials: 'include',\n headers: {\n 'Accept-Language': i18n.language,\n 'Content-Type': 'application/json',\n },\n method: 'post',\n })\n\n if (response.status === 200) {\n toast.success(t('authentication:successfullyUnlocked'))\n } else {\n toast.error(t('authentication:failedToUnlock'))\n }\n }, [i18n, serverURL, api, collectionSlug, email, t])\n\n useEffect(() => {\n if (!modified) {\n setChangingPassword(false)\n }\n }, [modified])\n\n if (disableLocalStrategy && !useAPIKey) {\n return null\n }\n\n const disabled = readOnly || isInitializing\n\n return (\n <div className={[baseClass, className].filter(Boolean).join(' ')}>\n {!disableLocalStrategy && (\n <React.Fragment>\n {!loginWithUsername && (\n <EmailField\n autoComplete=\"email\"\n disabled={disabled}\n label={t('general:email')}\n name=\"email\"\n readOnly={readOnly}\n required\n />\n )}\n {loginWithUsername && (\n <TextField\n disabled={disabled}\n label={t('authentication:username')}\n name=\"username\"\n readOnly={readOnly}\n required\n />\n )}\n {(changingPassword || requirePassword) && (\n <div className={`${baseClass}__changing-password`}>\n <PasswordField\n autoComplete=\"off\"\n disabled={disabled}\n label={t('authentication:newPassword')}\n name=\"password\"\n required\n />\n <ConfirmPasswordField disabled={readOnly} />\n </div>\n )}\n <div className={`${baseClass}__controls`}>\n {changingPassword && !requirePassword && (\n <Button\n buttonStyle=\"secondary\"\n disabled={disabled}\n onClick={() => handleChangePassword(false)}\n size=\"small\"\n >\n {t('general:cancel')}\n </Button>\n )}\n {!changingPassword && !requirePassword && (\n <Button\n buttonStyle=\"secondary\"\n disabled={disabled}\n id=\"change-password\"\n onClick={() => handleChangePassword(true)}\n size=\"small\"\n >\n {t('authentication:changePassword')}\n </Button>\n )}\n {operation === 'update' && (\n <Button\n buttonStyle=\"secondary\"\n disabled={disabled}\n onClick={() => unlock()}\n size=\"small\"\n >\n {t('authentication:forceUnlock')}\n </Button>\n )}\n </div>\n </React.Fragment>\n )}\n {useAPIKey && (\n <div className={`${baseClass}__api-key`}>\n <CheckboxField\n disabled={disabled}\n label={t('authentication:enableAPIKey')}\n name=\"enableAPIKey\"\n readOnly={readOnly}\n />\n <APIKey enabled={!!enableAPIKey?.value} readOnly={readOnly} />\n </div>\n )}\n {verify && (\n <CheckboxField\n disabled={disabled}\n label={t('authentication:verified')}\n name=\"_verified\"\n readOnly={readOnly}\n />\n )}\n </div>\n )\n}\n"],"names":["Button","CheckboxField","ConfirmPasswordField","EmailField","PasswordField","TextField","useConfig","useDocumentInfo","useFormFields","useFormModified","useTranslation","React","useCallback","useEffect","useState","toast","APIKey","baseClass","Auth","props","className","collectionSlug","disableLocalStrategy","email","loginWithUsername","operation","readOnly","requirePassword","useAPIKey","verify","changingPassword","setChangingPassword","enableAPIKey","fields","dispatchFields","reducer","modified","i18n","t","isInitializing","routes","api","serverURL","handleChangePassword","state","type","path","unlock","url","response","fetch","body","JSON","stringify","credentials","headers","language","method","status","success","error","disabled","div","filter","Boolean","join","Fragment","autoComplete","label","name","required","buttonStyle","onClick","size","id","enabled","value"],"mappings":"AAAA;;AAEA,SACEA,MAAM,EACNC,aAAa,EACbC,oBAAoB,EACpBC,UAAU,EACVC,aAAa,EACbC,SAAS,EACTC,SAAS,EACTC,eAAe,EACfC,aAAa,EACbC,eAAe,EACfC,cAAc,QACT,iBAAgB;AACvB,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAC/D,SAASC,KAAK,QAAQ,SAAQ;AAI9B,SAASC,MAAM,QAAQ,cAAa;AAGpC,MAAMC,YAAY;AAElB,OAAO,MAAMC,OAAwB,CAACC;IACpC,MAAM,EACJC,SAAS,EACTC,cAAc,EACdC,oBAAoB,EACpBC,KAAK,EACLC,iBAAiB,EACjBC,SAAS,EACTC,QAAQ,EACRC,eAAe,EACfC,SAAS,EACTC,MAAM,EACP,GAAGV;IAEJ,MAAM,CAACW,kBAAkBC,oBAAoB,GAAGjB,SAASa;IACzD,MAAMK,eAAexB,cAAc,CAAC,CAACyB,OAAO,GAAK,AAACA,UAAUA,QAAQD,gBAAiB;IACrF,MAAME,iBAAiB1B,cAAc,CAAC2B,UAAYA,OAAO,CAAC,EAAE;IAC5D,MAAMC,WAAW3B;IACjB,MAAM,EAAE4B,IAAI,EAAEC,CAAC,EAAE,GAAG5B;IACpB,MAAM,EAAE6B,cAAc,EAAE,GAAGhC;IAE3B,MAAM,EACJiC,QAAQ,EAAEC,GAAG,EAAE,EACfC,SAAS,EACV,GAAGpC;IAEJ,MAAMqC,uBAAuB/B,YAC3B,CAACgC;QACC,IAAI,CAACA,OAAO;YACVV,eAAe;gBAAEW,MAAM;gBAAUC,MAAM;YAAW;YAClDZ,eAAe;gBAAEW,MAAM;gBAAUC,MAAM;YAAmB;QAC5D;QAEAf,oBAAoBa;IACtB,GACA;QAACV;KAAe;IAGlB,MAA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nC;;;;kCAGpC,MAACoC;wBAAI1C,WAAW,CAAC,EAAEH,UAAU,UAAU,CAAC;;4BACrCa,oBAAoB,CAACH,iCACpB,KAAC3B;gCACCuE,aAAY;gCACZV,UAAUA;gCACVW,SAAS,IAAM7B,qBAAqB;gCACpC8B,MAAK;0CAEJnC,EAAE;;4BAGN,CAACR,oBAAoB,CAACH,iCACrB,KAAC3B;gCACCuE,aAAY;gCACZV,UAAUA;gCACVa,IAAG;gCACHF,SAAS,IAAM7B,qBAAqB;gCACpC8B,MAAK;0CAEJnC,EAAE;;4BAGNb,cAAc,0BACb,KAACzB;gCACCuE,aAAY;gCACZV,UAAUA;gCACVW,SAAS,IAAMzB;gCACf0B,MAAK;0CAEJnC,EAAE;;;;;;YAMZV,2BACC,MAACkC;gBAAI1C,WAAW,CAAC,EAAEH,UAAU,SAAS,CAAC;;kCACrC,KAAChB;wBACC4D,UAAUA;wBACVO,OAAO9B,EAAE;wBACT+B,MAAK;wBACL3C,UAAUA;;kCAEZ,KAACV;wBAAO2D,SAAS,CAAC,CAAC3C,cAAc4C;wBAAOlD,UAAUA;;;;YAGrDG,wBACC,KAAC5B;gBACC4D,UAAUA;gBACVO,OAAO9B,EAAE;gBACT+B,MAAK;gBACL3C,UAAUA;;;;AAKpB,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/views/Edit/Default/Auth/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtE,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAA;IACjD,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC9B,QAAQ,EAAE,OAAO,CAAA;IACjB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAAA;CAChC,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/views/Edit/Default/Auth/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtE,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAA;IACjD,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,iBAAiB,EAAE,OAAO,CAAA;IAC1B,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC9B,QAAQ,EAAE,OAAO,CAAA;IACjB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAAA;CAChC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/views/Edit/Default/Auth/types.ts"],"sourcesContent":["import type { SanitizedCollectionConfig, VerifyConfig } from 'payload'\n\nexport type Props = {\n className?: string\n collectionSlug: SanitizedCollectionConfig['slug']\n disableLocalStrategy?: boolean\n email: string\n operation: 'create' | 'update'\n readOnly: boolean\n requirePassword?: boolean\n useAPIKey?: boolean\n verify?: VerifyConfig | boolean\n}\n"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/views/Edit/Default/Auth/types.ts"],"sourcesContent":["import type { SanitizedCollectionConfig, VerifyConfig } from 'payload'\n\nexport type Props = {\n className?: string\n collectionSlug: SanitizedCollectionConfig['slug']\n disableLocalStrategy?: boolean\n email: string\n loginWithUsername: boolean\n operation: 'create' | 'update'\n readOnly: boolean\n requirePassword?: boolean\n useAPIKey?: boolean\n verify?: VerifyConfig | boolean\n}\n"],"names":[],"mappings":"AAEA,WAWC"}
|