@payloadcms/next 3.15.2-canary.64ffcd8 → 3.15.2-canary.de7619e
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/exports/utilities.d.ts +65 -5
- package/dist/exports/utilities.d.ts.map +1 -1
- package/dist/exports/utilities.js +49 -5
- package/dist/exports/utilities.js.map +1 -1
- package/dist/layouts/Root/index.d.ts.map +1 -1
- package/dist/layouts/Root/index.js +5 -2
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/layouts/Root/initJobAutoRun.d.ts +5 -0
- package/dist/layouts/Root/initJobAutoRun.d.ts.map +1 -0
- package/dist/layouts/Root/initJobAutoRun.js +23 -0
- package/dist/layouts/Root/initJobAutoRun.js.map +1 -0
- package/dist/routes/graphql/handler.d.ts.map +1 -1
- package/dist/routes/graphql/handler.js +1 -6
- package/dist/routes/graphql/handler.js.map +1 -1
- package/dist/routes/graphql/playground.d.ts +1 -1
- package/dist/routes/graphql/playground.d.ts.map +1 -1
- package/dist/routes/graphql/playground.js +1 -1
- package/dist/routes/graphql/playground.js.map +1 -1
- package/dist/routes/rest/index.d.ts +6 -26
- package/dist/routes/rest/index.d.ts.map +1 -1
- package/dist/routes/rest/index.js +25 -820
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/routes/rest/og/index.d.ts +2 -8
- package/dist/routes/rest/og/index.d.ts.map +1 -1
- package/dist/routes/rest/og/index.js +3 -6
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/templates/Default/index.d.ts +0 -4
- package/dist/templates/Default/index.d.ts.map +1 -1
- package/dist/templates/Default/index.js +1 -9
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/utilities/getNextRequestI18n.d.ts +1 -1
- package/dist/utilities/getNextRequestI18n.d.ts.map +1 -1
- package/dist/utilities/getNextRequestI18n.js +1 -1
- package/dist/utilities/getNextRequestI18n.js.map +1 -1
- package/dist/utilities/getPayloadHMR.d.ts +8 -0
- package/dist/utilities/getPayloadHMR.d.ts.map +1 -1
- package/dist/utilities/getPayloadHMR.js +8 -0
- package/dist/utilities/getPayloadHMR.js.map +1 -1
- package/dist/utilities/initReq.d.ts.map +1 -1
- package/dist/utilities/initReq.js +1 -2
- package/dist/utilities/initReq.js.map +1 -1
- package/dist/views/List/handleServerFunction.d.ts +1 -2
- package/dist/views/List/handleServerFunction.d.ts.map +1 -1
- package/dist/views/List/handleServerFunction.js.map +1 -1
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/Root/getViewFromConfig.d.ts +0 -1
- package/dist/views/Root/getViewFromConfig.d.ts.map +1 -1
- package/dist/views/Root/getViewFromConfig.js +0 -2
- package/dist/views/Root/getViewFromConfig.js.map +1 -1
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js +0 -5
- package/dist/views/Root/index.js.map +1 -1
- package/package.json +8 -7
- package/dist/fetchAPI-multipart/fileFactory.d.ts +0 -16
- package/dist/fetchAPI-multipart/fileFactory.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/fileFactory.js +0 -44
- package/dist/fetchAPI-multipart/fileFactory.js.map +0 -1
- package/dist/fetchAPI-multipart/handlers.d.ts +0 -14
- package/dist/fetchAPI-multipart/handlers.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/handlers.js +0 -87
- package/dist/fetchAPI-multipart/handlers.js.map +0 -1
- package/dist/fetchAPI-multipart/index.d.ts +0 -32
- package/dist/fetchAPI-multipart/index.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/index.js +0 -43
- package/dist/fetchAPI-multipart/index.js.map +0 -1
- package/dist/fetchAPI-multipart/isEligibleRequest.d.ts +0 -2
- package/dist/fetchAPI-multipart/isEligibleRequest.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/isEligibleRequest.js +0 -18
- package/dist/fetchAPI-multipart/isEligibleRequest.js.map +0 -1
- package/dist/fetchAPI-multipart/processMultipart.d.ts +0 -9
- package/dist/fetchAPI-multipart/processMultipart.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/processMultipart.js +0 -178
- package/dist/fetchAPI-multipart/processMultipart.js.map +0 -1
- package/dist/fetchAPI-multipart/processNested.d.ts +0 -2
- package/dist/fetchAPI-multipart/processNested.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/processNested.js +0 -31
- package/dist/fetchAPI-multipart/processNested.js.map +0 -1
- package/dist/fetchAPI-multipart/uploadTimer.d.ts +0 -7
- package/dist/fetchAPI-multipart/uploadTimer.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/uploadTimer.js +0 -20
- package/dist/fetchAPI-multipart/uploadTimer.js.map +0 -1
- package/dist/fetchAPI-multipart/utilities.d.ts +0 -65
- package/dist/fetchAPI-multipart/utilities.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/utilities.js +0 -227
- package/dist/fetchAPI-multipart/utilities.js.map +0 -1
- package/dist/fetchAPI-stream-file/index.d.ts +0 -5
- package/dist/fetchAPI-stream-file/index.d.ts.map +0 -1
- package/dist/fetchAPI-stream-file/index.js +0 -27
- package/dist/fetchAPI-stream-file/index.js.map +0 -1
- package/dist/routes/rest/auth/access.d.ts +0 -3
- package/dist/routes/rest/auth/access.d.ts.map +0 -1
- package/dist/routes/rest/auth/access.js +0 -28
- package/dist/routes/rest/auth/access.js.map +0 -1
- package/dist/routes/rest/auth/forgotPassword.d.ts +0 -3
- package/dist/routes/rest/auth/forgotPassword.d.ts.map +0 -1
- package/dist/routes/rest/auth/forgotPassword.js +0 -34
- package/dist/routes/rest/auth/forgotPassword.js.map +0 -1
- package/dist/routes/rest/auth/init.d.ts +0 -3
- package/dist/routes/rest/auth/init.d.ts.map +0 -1
- package/dist/routes/rest/auth/init.js +0 -20
- package/dist/routes/rest/auth/init.js.map +0 -1
- package/dist/routes/rest/auth/login.d.ts +0 -3
- package/dist/routes/rest/auth/login.d.ts.map +0 -1
- package/dist/routes/rest/auth/login.js +0 -49
- package/dist/routes/rest/auth/login.js.map +0 -1
- package/dist/routes/rest/auth/logout.d.ts +0 -3
- package/dist/routes/rest/auth/logout.d.ts.map +0 -1
- package/dist/routes/rest/auth/logout.js +0 -40
- package/dist/routes/rest/auth/logout.js.map +0 -1
- package/dist/routes/rest/auth/me.d.ts +0 -3
- package/dist/routes/rest/auth/me.d.ts.map +0 -1
- package/dist/routes/rest/auth/me.js +0 -28
- package/dist/routes/rest/auth/me.js.map +0 -1
- package/dist/routes/rest/auth/refresh.d.ts +0 -3
- package/dist/routes/rest/auth/refresh.d.ts.map +0 -1
- package/dist/routes/rest/auth/refresh.js +0 -38
- package/dist/routes/rest/auth/refresh.js.map +0 -1
- package/dist/routes/rest/auth/registerFirstUser.d.ts +0 -3
- package/dist/routes/rest/auth/registerFirstUser.d.ts.map +0 -1
- package/dist/routes/rest/auth/registerFirstUser.js +0 -48
- package/dist/routes/rest/auth/registerFirstUser.js.map +0 -1
- package/dist/routes/rest/auth/resetPassword.d.ts +0 -3
- package/dist/routes/rest/auth/resetPassword.d.ts.map +0 -1
- package/dist/routes/rest/auth/resetPassword.js +0 -43
- package/dist/routes/rest/auth/resetPassword.js.map +0 -1
- package/dist/routes/rest/auth/unlock.d.ts +0 -3
- package/dist/routes/rest/auth/unlock.d.ts.map +0 -1
- package/dist/routes/rest/auth/unlock.js +0 -32
- package/dist/routes/rest/auth/unlock.js.map +0 -1
- package/dist/routes/rest/auth/verifyEmail.d.ts +0 -3
- package/dist/routes/rest/auth/verifyEmail.d.ts.map +0 -1
- package/dist/routes/rest/auth/verifyEmail.js +0 -27
- package/dist/routes/rest/auth/verifyEmail.js.map +0 -1
- package/dist/routes/rest/checkEndpoints.d.ts +0 -5
- package/dist/routes/rest/checkEndpoints.d.ts.map +0 -1
- package/dist/routes/rest/checkEndpoints.js +0 -14
- package/dist/routes/rest/checkEndpoints.js.map +0 -1
- package/dist/routes/rest/collections/count.d.ts +0 -3
- package/dist/routes/rest/collections/count.d.ts.map +0 -1
- package/dist/routes/rest/collections/count.js +0 -19
- package/dist/routes/rest/collections/count.js.map +0 -1
- package/dist/routes/rest/collections/create.d.ts +0 -3
- package/dist/routes/rest/collections/create.d.ts.map +0 -1
- package/dist/routes/rest/collections/create.js +0 -39
- package/dist/routes/rest/collections/create.js.map +0 -1
- package/dist/routes/rest/collections/delete.d.ts +0 -3
- package/dist/routes/rest/collections/delete.d.ts.map +0 -1
- package/dist/routes/rest/collections/delete.js +0 -57
- package/dist/routes/rest/collections/delete.js.map +0 -1
- package/dist/routes/rest/collections/deleteByID.d.ts +0 -3
- package/dist/routes/rest/collections/deleteByID.d.ts.map +0 -1
- package/dist/routes/rest/collections/deleteByID.js +0 -50
- package/dist/routes/rest/collections/deleteByID.js.map +0 -1
- package/dist/routes/rest/collections/docAccess.d.ts +0 -3
- package/dist/routes/rest/collections/docAccess.d.ts.map +0 -1
- package/dist/routes/rest/collections/docAccess.js +0 -22
- package/dist/routes/rest/collections/docAccess.js.map +0 -1
- package/dist/routes/rest/collections/duplicate.d.ts +0 -3
- package/dist/routes/rest/collections/duplicate.d.ts.map +0 -1
- package/dist/routes/rest/collections/duplicate.js +0 -47
- package/dist/routes/rest/collections/duplicate.js.map +0 -1
- package/dist/routes/rest/collections/find.d.ts +0 -3
- package/dist/routes/rest/collections/find.d.ts.map +0 -1
- package/dist/routes/rest/collections/find.js +0 -43
- package/dist/routes/rest/collections/find.js.map +0 -1
- package/dist/routes/rest/collections/findByID.d.ts +0 -3
- package/dist/routes/rest/collections/findByID.d.ts.map +0 -1
- package/dist/routes/rest/collections/findByID.js +0 -38
- package/dist/routes/rest/collections/findByID.js.map +0 -1
- package/dist/routes/rest/collections/findVersionByID.d.ts +0 -3
- package/dist/routes/rest/collections/findVersionByID.d.ts.map +0 -1
- package/dist/routes/rest/collections/findVersionByID.js +0 -36
- package/dist/routes/rest/collections/findVersionByID.js.map +0 -1
- package/dist/routes/rest/collections/findVersions.d.ts +0 -3
- package/dist/routes/rest/collections/findVersions.d.ts.map +0 -1
- package/dist/routes/rest/collections/findVersions.js +0 -39
- package/dist/routes/rest/collections/findVersions.js.map +0 -1
- package/dist/routes/rest/collections/preview.d.ts +0 -3
- package/dist/routes/rest/collections/preview.d.ts.map +0 -1
- package/dist/routes/rest/collections/preview.js +0 -49
- package/dist/routes/rest/collections/preview.js.map +0 -1
- package/dist/routes/rest/collections/restoreVersion.d.ts +0 -3
- package/dist/routes/rest/collections/restoreVersion.d.ts.map +0 -1
- package/dist/routes/rest/collections/restoreVersion.js +0 -40
- package/dist/routes/rest/collections/restoreVersion.js.map +0 -1
- package/dist/routes/rest/collections/update.d.ts +0 -3
- package/dist/routes/rest/collections/update.d.ts.map +0 -1
- package/dist/routes/rest/collections/update.js +0 -62
- package/dist/routes/rest/collections/update.js.map +0 -1
- package/dist/routes/rest/collections/updateByID.d.ts +0 -3
- package/dist/routes/rest/collections/updateByID.d.ts.map +0 -1
- package/dist/routes/rest/collections/updateByID.js +0 -55
- package/dist/routes/rest/collections/updateByID.js.map +0 -1
- package/dist/routes/rest/files/checkFileAccess.d.ts +0 -7
- package/dist/routes/rest/files/checkFileAccess.d.ts.map +0 -1
- package/dist/routes/rest/files/checkFileAccess.js +0 -57
- package/dist/routes/rest/files/checkFileAccess.js.map +0 -1
- package/dist/routes/rest/files/getFile.d.ts +0 -9
- package/dist/routes/rest/files/getFile.d.ts.map +0 -1
- package/dist/routes/rest/files/getFile.js +0 -70
- package/dist/routes/rest/files/getFile.js.map +0 -1
- package/dist/routes/rest/files/getFileTypeFallback.d.ts +0 -7
- package/dist/routes/rest/files/getFileTypeFallback.d.ts.map +0 -1
- package/dist/routes/rest/files/getFileTypeFallback.js +0 -20
- package/dist/routes/rest/files/getFileTypeFallback.js.map +0 -1
- package/dist/routes/rest/globals/docAccess.d.ts +0 -3
- package/dist/routes/rest/globals/docAccess.d.ts.map +0 -1
- package/dist/routes/rest/globals/docAccess.js +0 -20
- package/dist/routes/rest/globals/docAccess.js.map +0 -1
- package/dist/routes/rest/globals/findOne.d.ts +0 -3
- package/dist/routes/rest/globals/findOne.d.ts.map +0 -1
- package/dist/routes/rest/globals/findOne.js +0 -30
- package/dist/routes/rest/globals/findOne.js.map +0 -1
- package/dist/routes/rest/globals/findVersionByID.d.ts +0 -3
- package/dist/routes/rest/globals/findVersionByID.d.ts.map +0 -1
- package/dist/routes/rest/globals/findVersionByID.js +0 -30
- package/dist/routes/rest/globals/findVersionByID.js.map +0 -1
- package/dist/routes/rest/globals/findVersions.d.ts +0 -3
- package/dist/routes/rest/globals/findVersions.d.ts.map +0 -1
- package/dist/routes/rest/globals/findVersions.js +0 -39
- package/dist/routes/rest/globals/findVersions.js.map +0 -1
- package/dist/routes/rest/globals/preview.d.ts +0 -3
- package/dist/routes/rest/globals/preview.d.ts.map +0 -1
- package/dist/routes/rest/globals/preview.js +0 -47
- package/dist/routes/rest/globals/preview.js.map +0 -1
- package/dist/routes/rest/globals/restoreVersion.d.ts +0 -3
- package/dist/routes/rest/globals/restoreVersion.d.ts.map +0 -1
- package/dist/routes/rest/globals/restoreVersion.js +0 -34
- package/dist/routes/rest/globals/restoreVersion.js.map +0 -1
- package/dist/routes/rest/globals/update.d.ts +0 -3
- package/dist/routes/rest/globals/update.d.ts.map +0 -1
- package/dist/routes/rest/globals/update.js +0 -46
- package/dist/routes/rest/globals/update.js.map +0 -1
- package/dist/routes/rest/routeError.d.ts +0 -9
- package/dist/routes/rest/routeError.d.ts.map +0 -1
- package/dist/routes/rest/routeError.js +0 -83
- package/dist/routes/rest/routeError.js.map +0 -1
- package/dist/routes/rest/types.d.ts +0 -23
- package/dist/routes/rest/types.d.ts.map +0 -1
- package/dist/routes/rest/types.js +0 -2
- package/dist/routes/rest/types.js.map +0 -1
- package/dist/routes/rest/utilities/sanitizeCollectionID.d.ts +0 -9
- package/dist/routes/rest/utilities/sanitizeCollectionID.d.ts.map +0 -1
- package/dist/routes/rest/utilities/sanitizeCollectionID.js +0 -20
- package/dist/routes/rest/utilities/sanitizeCollectionID.js.map +0 -1
- package/dist/utilities/addDataAndFileToRequest.d.ts +0 -8
- package/dist/utilities/addDataAndFileToRequest.d.ts.map +0 -1
- package/dist/utilities/addDataAndFileToRequest.js +0 -47
- package/dist/utilities/addDataAndFileToRequest.js.map +0 -1
- package/dist/utilities/addLocalesToRequest.d.ts +0 -17
- package/dist/utilities/addLocalesToRequest.d.ts.map +0 -1
- package/dist/utilities/addLocalesToRequest.js +0 -65
- package/dist/utilities/addLocalesToRequest.js.map +0 -1
- package/dist/utilities/createPayloadRequest.d.ts +0 -11
- package/dist/utilities/createPayloadRequest.d.ts.map +0 -1
- package/dist/utilities/createPayloadRequest.js +0 -103
- package/dist/utilities/createPayloadRequest.js.map +0 -1
- package/dist/utilities/getRequestLanguage.d.ts +0 -12
- package/dist/utilities/getRequestLanguage.d.ts.map +0 -1
- package/dist/utilities/getRequestLanguage.js +0 -19
- package/dist/utilities/getRequestLanguage.js.map +0 -1
- package/dist/utilities/headersWithCors.d.ts +0 -8
- package/dist/utilities/headersWithCors.d.ts.map +0 -1
- package/dist/utilities/headersWithCors.js +0 -24
- package/dist/utilities/headersWithCors.js.map +0 -1
- package/dist/utilities/mergeHeaders.d.ts +0 -2
- package/dist/utilities/mergeHeaders.d.ts.map +0 -1
- package/dist/utilities/mergeHeaders.js +0 -10
- package/dist/utilities/mergeHeaders.js.map +0 -1
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
export function iteratorToStream(iterator) {
|
|
3
|
-
return new ReadableStream({
|
|
4
|
-
async pull(controller) {
|
|
5
|
-
const {
|
|
6
|
-
done,
|
|
7
|
-
value
|
|
8
|
-
} = await iterator.next();
|
|
9
|
-
if (done) {
|
|
10
|
-
controller.close();
|
|
11
|
-
} else {
|
|
12
|
-
controller.enqueue(value);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
export async function* nodeStreamToIterator(stream) {
|
|
18
|
-
for await (const chunk of stream) {
|
|
19
|
-
yield new Uint8Array(chunk);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export function streamFile(path) {
|
|
23
|
-
const nodeStream = fs.createReadStream(path);
|
|
24
|
-
const data = iteratorToStream(nodeStreamToIterator(nodeStream));
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["fs","iteratorToStream","iterator","ReadableStream","pull","controller","done","value","next","close","enqueue","nodeStreamToIterator","stream","chunk","Uint8Array","streamFile","path","nodeStream","createReadStream","data"],"sources":["../../src/fetchAPI-stream-file/index.ts"],"sourcesContent":["import fs from 'fs'\n\nexport function iteratorToStream(iterator) {\n return new ReadableStream({\n async pull(controller) {\n const { done, value } = await iterator.next()\n if (done) {\n controller.close()\n } else {\n controller.enqueue(value)\n }\n },\n })\n}\n\nexport async function* nodeStreamToIterator(stream: fs.ReadStream) {\n for await (const chunk of stream) {\n yield new Uint8Array(chunk)\n }\n}\n\nexport function streamFile(path: string): ReadableStream {\n const nodeStream = fs.createReadStream(path)\n const data: ReadableStream = iteratorToStream(nodeStreamToIterator(nodeStream))\n return data\n}\n"],"mappings":"AAAA,OAAOA,EAAA,MAAQ;AAEf,OAAO,SAASC,iBAAiBC,QAAQ;EACvC,OAAO,IAAIC,cAAA,CAAe;IACxB,MAAMC,KAAKC,UAAU;MACnB,MAAM;QAAEC,IAAI;QAAEC;MAAK,CAAE,GAAG,MAAML,QAAA,CAASM,IAAI;MAC3C,IAAIF,IAAA,EAAM;QACRD,UAAA,CAAWI,KAAK;MAClB,OAAO;QACLJ,UAAA,CAAWK,OAAO,CAACH,KAAA;MACrB;IACF;EACF;AACF;AAEA,OAAO,gBAAgBI,qBAAqBC,MAAqB;EAC/D,WAAW,MAAMC,KAAA,IAASD,MAAA,EAAQ;IAChC,MAAM,IAAIE,UAAA,CAAWD,KAAA;EACvB;AACF;AAEA,OAAO,SAASE,WAAWC,IAAY;EACrC,MAAMC,UAAA,GAAajB,EAAA,CAAGkB,gBAAgB,CAACF,IAAA;EACvC,MAAMG,IAAA,GAAuBlB,gBAAA,CAAiBU,oBAAA,CAAqBM,UAAA;EACnE,OAAOE,IAAA;AACT","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/access.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAInD,eAAO,MAAM,MAAM,EAAE,gBA0BpB,CAAA"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { accessOperation } from 'payload';
|
|
3
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
4
|
-
export const access = async ({
|
|
5
|
-
req
|
|
6
|
-
}) => {
|
|
7
|
-
const headers = headersWithCors({
|
|
8
|
-
headers: new Headers(),
|
|
9
|
-
req
|
|
10
|
-
});
|
|
11
|
-
try {
|
|
12
|
-
const results = await accessOperation({
|
|
13
|
-
req
|
|
14
|
-
});
|
|
15
|
-
return Response.json(results, {
|
|
16
|
-
headers,
|
|
17
|
-
status: httpStatus.OK
|
|
18
|
-
});
|
|
19
|
-
} catch (e) {
|
|
20
|
-
return Response.json({
|
|
21
|
-
error: e
|
|
22
|
-
}, {
|
|
23
|
-
headers,
|
|
24
|
-
status: httpStatus.INTERNAL_SERVER_ERROR
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=access.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"access.js","names":["httpStatus","accessOperation","headersWithCors","access","req","headers","Headers","results","Response","json","status","OK","e","error","INTERNAL_SERVER_ERROR"],"sources":["../../../../src/routes/rest/auth/access.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { accessOperation } from 'payload'\n\nimport type { BaseRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const access: BaseRouteHandler = async ({ req }) => {\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n try {\n const results = await accessOperation({\n req,\n })\n\n return Response.json(results, {\n headers,\n status: httpStatus.OK,\n })\n } catch (e: unknown) {\n return Response.json(\n {\n error: e,\n },\n {\n headers,\n status: httpStatus.INTERNAL_SERVER_ERROR,\n },\n )\n }\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,eAAe,QAAQ;AAIhC,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,MAAA,GAA2B,MAAAA,CAAO;EAAEC;AAAG,CAAE;EACpD,MAAMC,OAAA,GAAUH,eAAA,CAAgB;IAC9BG,OAAA,EAAS,IAAIC,OAAA;IACbF;EACF;EAEA,IAAI;IACF,MAAMG,OAAA,GAAU,MAAMN,eAAA,CAAgB;MACpCG;IACF;IAEA,OAAOI,QAAA,CAASC,IAAI,CAACF,OAAA,EAAS;MAC5BF,OAAA;MACAK,MAAA,EAAQV,UAAA,CAAWW;IACrB;EACF,EAAE,OAAOC,CAAA,EAAY;IACnB,OAAOJ,QAAA,CAASC,IAAI,CAClB;MACEI,KAAA,EAAOD;IACT,GACA;MACEP,OAAA;MACAK,MAAA,EAAQV,UAAA,CAAWc;IACrB;EAEJ;AACF","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"forgotPassword.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/forgotPassword.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,cAAc,EAAE,sBA+B5B,CAAA"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { forgotPasswordOperation } from 'payload';
|
|
3
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
4
|
-
export const forgotPassword = async ({
|
|
5
|
-
collection,
|
|
6
|
-
req
|
|
7
|
-
}) => {
|
|
8
|
-
const {
|
|
9
|
-
t
|
|
10
|
-
} = req;
|
|
11
|
-
const authData = collection.config.auth?.loginWithUsername ? {
|
|
12
|
-
email: typeof req.data?.email === 'string' ? req.data.email : '',
|
|
13
|
-
username: typeof req.data?.username === 'string' ? req.data.username : ''
|
|
14
|
-
} : {
|
|
15
|
-
email: typeof req.data?.email === 'string' ? req.data.email : ''
|
|
16
|
-
};
|
|
17
|
-
await forgotPasswordOperation({
|
|
18
|
-
collection,
|
|
19
|
-
data: authData,
|
|
20
|
-
disableEmail: Boolean(req.data?.disableEmail),
|
|
21
|
-
expiration: typeof req.data.expiration === 'number' ? req.data.expiration : undefined,
|
|
22
|
-
req
|
|
23
|
-
});
|
|
24
|
-
return Response.json({
|
|
25
|
-
message: t('general:success')
|
|
26
|
-
}, {
|
|
27
|
-
headers: headersWithCors({
|
|
28
|
-
headers: new Headers(),
|
|
29
|
-
req
|
|
30
|
-
}),
|
|
31
|
-
status: httpStatus.OK
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=forgotPassword.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"forgotPassword.js","names":["httpStatus","forgotPasswordOperation","headersWithCors","forgotPassword","collection","req","t","authData","config","auth","loginWithUsername","email","data","username","disableEmail","Boolean","expiration","undefined","Response","json","message","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/auth/forgotPassword.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { forgotPasswordOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const forgotPassword: CollectionRouteHandler = async ({ collection, req }) => {\n const { t } = req\n const authData = collection.config.auth?.loginWithUsername\n ? {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n username: typeof req.data?.username === 'string' ? req.data.username : '',\n }\n : {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n }\n\n await forgotPasswordOperation({\n collection,\n data: authData,\n disableEmail: Boolean(req.data?.disableEmail),\n expiration: typeof req.data.expiration === 'number' ? req.data.expiration : undefined,\n req,\n })\n\n return Response.json(\n {\n message: t('general:success'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,uBAAuB,QAAQ;AAIxC,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,cAAA,GAAyC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EAC9E,MAAM;IAAEC;EAAC,CAAE,GAAGD,GAAA;EACd,MAAME,QAAA,GAAWH,UAAA,CAAWI,MAAM,CAACC,IAAI,EAAEC,iBAAA,GACrC;IACEC,KAAA,EAAO,OAAON,GAAA,CAAIO,IAAI,EAAED,KAAA,KAAU,WAAWN,GAAA,CAAIO,IAAI,CAACD,KAAK,GAAG;IAC9DE,QAAA,EAAU,OAAOR,GAAA,CAAIO,IAAI,EAAEC,QAAA,KAAa,WAAWR,GAAA,CAAIO,IAAI,CAACC,QAAQ,GAAG;EACzE,IACA;IACEF,KAAA,EAAO,OAAON,GAAA,CAAIO,IAAI,EAAED,KAAA,KAAU,WAAWN,GAAA,CAAIO,IAAI,CAACD,KAAK,GAAG;EAChE;EAEJ,MAAMV,uBAAA,CAAwB;IAC5BG,UAAA;IACAQ,IAAA,EAAML,QAAA;IACNO,YAAA,EAAcC,OAAA,CAAQV,GAAA,CAAIO,IAAI,EAAEE,YAAA;IAChCE,UAAA,EAAY,OAAOX,GAAA,CAAIO,IAAI,CAACI,UAAU,KAAK,WAAWX,GAAA,CAAIO,IAAI,CAACI,UAAU,GAAGC,SAAA;IAC5EZ;EACF;EAEA,OAAOa,QAAA,CAASC,IAAI,CAClB;IACEC,OAAA,EAASd,CAAA,CAAE;EACb,GACA;IACEe,OAAA,EAASnB,eAAA,CAAgB;MACvBmB,OAAA,EAAS,IAAIC,OAAA;MACbjB;IACF;IACAkB,MAAA,EAAQvB,UAAA,CAAWwB;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/init.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,IAAI,EAAE,sBAelB,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { initOperation } from 'payload';
|
|
2
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
3
|
-
export const init = async ({
|
|
4
|
-
collection,
|
|
5
|
-
req
|
|
6
|
-
}) => {
|
|
7
|
-
const initialized = await initOperation({
|
|
8
|
-
collection: collection.config.slug,
|
|
9
|
-
req
|
|
10
|
-
});
|
|
11
|
-
return Response.json({
|
|
12
|
-
initialized
|
|
13
|
-
}, {
|
|
14
|
-
headers: headersWithCors({
|
|
15
|
-
headers: new Headers(),
|
|
16
|
-
req
|
|
17
|
-
})
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=init.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","names":["initOperation","headersWithCors","init","collection","req","initialized","config","slug","Response","json","headers","Headers"],"sources":["../../../../src/routes/rest/auth/init.ts"],"sourcesContent":["import { initOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const init: CollectionRouteHandler = async ({ collection, req }) => {\n const initialized = await initOperation({\n collection: collection.config.slug,\n req,\n })\n\n return Response.json(\n { initialized },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n },\n )\n}\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ;AAI9B,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,IAAA,GAA+B,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACpE,MAAMC,WAAA,GAAc,MAAML,aAAA,CAAc;IACtCG,UAAA,EAAYA,UAAA,CAAWG,MAAM,CAACC,IAAI;IAClCH;EACF;EAEA,OAAOI,QAAA,CAASC,IAAI,CAClB;IAAEJ;EAAY,GACd;IACEK,OAAA,EAAST,eAAA,CAAgB;MACvBS,OAAA,EAAS,IAAIC,OAAA;MACbP;IACF;EACF;AAEJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/login.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,KAAK,EAAE,sBA+CnB,CAAA"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { generatePayloadCookie, loginOperation } from 'payload';
|
|
3
|
-
import { isNumber } from 'payload/shared';
|
|
4
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
-
export const login = async ({
|
|
6
|
-
collection,
|
|
7
|
-
req
|
|
8
|
-
}) => {
|
|
9
|
-
const {
|
|
10
|
-
searchParams,
|
|
11
|
-
t
|
|
12
|
-
} = req;
|
|
13
|
-
const depth = searchParams.get('depth');
|
|
14
|
-
const authData = collection.config.auth?.loginWithUsername !== false ? {
|
|
15
|
-
email: typeof req.data?.email === 'string' ? req.data.email : '',
|
|
16
|
-
password: typeof req.data?.password === 'string' ? req.data.password : '',
|
|
17
|
-
username: typeof req.data?.username === 'string' ? req.data.username : ''
|
|
18
|
-
} : {
|
|
19
|
-
email: typeof req.data?.email === 'string' ? req.data.email : '',
|
|
20
|
-
password: typeof req.data?.password === 'string' ? req.data.password : ''
|
|
21
|
-
};
|
|
22
|
-
const result = await loginOperation({
|
|
23
|
-
collection,
|
|
24
|
-
data: authData,
|
|
25
|
-
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
26
|
-
req
|
|
27
|
-
});
|
|
28
|
-
const cookie = generatePayloadCookie({
|
|
29
|
-
collectionAuthConfig: collection.config.auth,
|
|
30
|
-
cookiePrefix: req.payload.config.cookiePrefix,
|
|
31
|
-
token: result.token
|
|
32
|
-
});
|
|
33
|
-
if (collection.config.auth.removeTokenFromResponses) {
|
|
34
|
-
delete result.token;
|
|
35
|
-
}
|
|
36
|
-
return Response.json({
|
|
37
|
-
message: t('authentication:passed'),
|
|
38
|
-
...result
|
|
39
|
-
}, {
|
|
40
|
-
headers: headersWithCors({
|
|
41
|
-
headers: new Headers({
|
|
42
|
-
'Set-Cookie': cookie
|
|
43
|
-
}),
|
|
44
|
-
req
|
|
45
|
-
}),
|
|
46
|
-
status: httpStatus.OK
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=login.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","names":["httpStatus","generatePayloadCookie","loginOperation","isNumber","headersWithCors","login","collection","req","searchParams","t","depth","get","authData","config","auth","loginWithUsername","email","data","password","username","result","Number","undefined","cookie","collectionAuthConfig","cookiePrefix","payload","token","removeTokenFromResponses","Response","json","message","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/auth/login.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generatePayloadCookie, loginOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const login: CollectionRouteHandler = async ({ collection, req }) => {\n const { searchParams, t } = req\n const depth = searchParams.get('depth')\n const authData =\n collection.config.auth?.loginWithUsername !== false\n ? {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n password: typeof req.data?.password === 'string' ? req.data.password : '',\n username: typeof req.data?.username === 'string' ? req.data.username : '',\n }\n : {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n password: typeof req.data?.password === 'string' ? req.data.password : '',\n }\n\n const result = await loginOperation({\n collection,\n data: authData,\n depth: isNumber(depth) ? Number(depth) : undefined,\n req,\n })\n\n const cookie = generatePayloadCookie({\n collectionAuthConfig: collection.config.auth,\n cookiePrefix: req.payload.config.cookiePrefix,\n token: result.token,\n })\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.token\n }\n\n return Response.json(\n {\n message: t('authentication:passed'),\n ...result,\n },\n {\n headers: headersWithCors({\n headers: new Headers({\n 'Set-Cookie': cookie,\n }),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,qBAAqB,EAAEC,cAAc,QAAQ;AACtD,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,KAAA,GAAgC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACrE,MAAM;IAAEC,YAAY;IAAEC;EAAC,CAAE,GAAGF,GAAA;EAC5B,MAAMG,KAAA,GAAQF,YAAA,CAAaG,GAAG,CAAC;EAC/B,MAAMC,QAAA,GACJN,UAAA,CAAWO,MAAM,CAACC,IAAI,EAAEC,iBAAA,KAAsB,QAC1C;IACEC,KAAA,EAAO,OAAOT,GAAA,CAAIU,IAAI,EAAED,KAAA,KAAU,WAAWT,GAAA,CAAIU,IAAI,CAACD,KAAK,GAAG;IAC9DE,QAAA,EAAU,OAAOX,GAAA,CAAIU,IAAI,EAAEC,QAAA,KAAa,WAAWX,GAAA,CAAIU,IAAI,CAACC,QAAQ,GAAG;IACvEC,QAAA,EAAU,OAAOZ,GAAA,CAAIU,IAAI,EAAEE,QAAA,KAAa,WAAWZ,GAAA,CAAIU,IAAI,CAACE,QAAQ,GAAG;EACzE,IACA;IACEH,KAAA,EAAO,OAAOT,GAAA,CAAIU,IAAI,EAAED,KAAA,KAAU,WAAWT,GAAA,CAAIU,IAAI,CAACD,KAAK,GAAG;IAC9DE,QAAA,EAAU,OAAOX,GAAA,CAAIU,IAAI,EAAEC,QAAA,KAAa,WAAWX,GAAA,CAAIU,IAAI,CAACC,QAAQ,GAAG;EACzE;EAEN,MAAME,MAAA,GAAS,MAAMlB,cAAA,CAAe;IAClCI,UAAA;IACAW,IAAA,EAAML,QAAA;IACNF,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASW,MAAA,CAAOX,KAAA,IAASY,SAAA;IACzCf;EACF;EAEA,MAAMgB,MAAA,GAAStB,qBAAA,CAAsB;IACnCuB,oBAAA,EAAsBlB,UAAA,CAAWO,MAAM,CAACC,IAAI;IAC5CW,YAAA,EAAclB,GAAA,CAAImB,OAAO,CAACb,MAAM,CAACY,YAAY;IAC7CE,KAAA,EAAOP,MAAA,CAAOO;EAChB;EAEA,IAAIrB,UAAA,CAAWO,MAAM,CAACC,IAAI,CAACc,wBAAwB,EAAE;IACnD,OAAOR,MAAA,CAAOO,KAAK;EACrB;EAEA,OAAOE,QAAA,CAASC,IAAI,CAClB;IACEC,OAAA,EAAStB,CAAA,CAAE;IACX,GAAGW;EACL,GACA;IACEY,OAAA,EAAS5B,eAAA,CAAgB;MACvB4B,OAAA,EAAS,IAAIC,OAAA,CAAQ;QACnB,cAAcV;MAChB;MACAhB;IACF;IACA2B,MAAA,EAAQlC,UAAA,CAAWmC;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/logout.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,MAAM,EAAE,sBAyCpB,CAAA"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { generateExpiredPayloadCookie, logoutOperation } from 'payload';
|
|
3
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
4
|
-
export const logout = async ({
|
|
5
|
-
collection,
|
|
6
|
-
req
|
|
7
|
-
}) => {
|
|
8
|
-
const {
|
|
9
|
-
t
|
|
10
|
-
} = req;
|
|
11
|
-
const result = await logoutOperation({
|
|
12
|
-
collection,
|
|
13
|
-
req
|
|
14
|
-
});
|
|
15
|
-
const headers = headersWithCors({
|
|
16
|
-
headers: new Headers(),
|
|
17
|
-
req
|
|
18
|
-
});
|
|
19
|
-
if (!result) {
|
|
20
|
-
return Response.json({
|
|
21
|
-
message: t('error:logoutFailed')
|
|
22
|
-
}, {
|
|
23
|
-
headers,
|
|
24
|
-
status: httpStatus.BAD_REQUEST
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
const expiredCookie = generateExpiredPayloadCookie({
|
|
28
|
-
collectionAuthConfig: collection.config.auth,
|
|
29
|
-
config: req.payload.config,
|
|
30
|
-
cookiePrefix: req.payload.config.cookiePrefix
|
|
31
|
-
});
|
|
32
|
-
headers.set('Set-Cookie', expiredCookie);
|
|
33
|
-
return Response.json({
|
|
34
|
-
message: t('authentication:logoutSuccessful')
|
|
35
|
-
}, {
|
|
36
|
-
headers,
|
|
37
|
-
status: httpStatus.OK
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=logout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logout.js","names":["httpStatus","generateExpiredPayloadCookie","logoutOperation","headersWithCors","logout","collection","req","t","result","headers","Headers","Response","json","message","status","BAD_REQUEST","expiredCookie","collectionAuthConfig","config","auth","payload","cookiePrefix","set","OK"],"sources":["../../../../src/routes/rest/auth/logout.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generateExpiredPayloadCookie, logoutOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const logout: CollectionRouteHandler = async ({ collection, req }) => {\n const { t } = req\n const result = await logoutOperation({\n collection,\n req,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (!result) {\n return Response.json(\n {\n message: t('error:logoutFailed'),\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n }\n\n const expiredCookie = generateExpiredPayloadCookie({\n collectionAuthConfig: collection.config.auth,\n config: req.payload.config,\n cookiePrefix: req.payload.config.cookiePrefix,\n })\n\n headers.set('Set-Cookie', expiredCookie)\n\n return Response.json(\n {\n message: t('authentication:logoutSuccessful'),\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,4BAA4B,EAAEC,eAAe,QAAQ;AAI9D,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,MAAA,GAAiC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACtE,MAAM;IAAEC;EAAC,CAAE,GAAGD,GAAA;EACd,MAAME,MAAA,GAAS,MAAMN,eAAA,CAAgB;IACnCG,UAAA;IACAC;EACF;EAEA,MAAMG,OAAA,GAAUN,eAAA,CAAgB;IAC9BM,OAAA,EAAS,IAAIC,OAAA;IACbJ;EACF;EAEA,IAAI,CAACE,MAAA,EAAQ;IACX,OAAOG,QAAA,CAASC,IAAI,CAClB;MACEC,OAAA,EAASN,CAAA,CAAE;IACb,GACA;MACEE,OAAA;MACAK,MAAA,EAAQd,UAAA,CAAWe;IACrB;EAEJ;EAEA,MAAMC,aAAA,GAAgBf,4BAAA,CAA6B;IACjDgB,oBAAA,EAAsBZ,UAAA,CAAWa,MAAM,CAACC,IAAI;IAC5CD,MAAA,EAAQZ,GAAA,CAAIc,OAAO,CAACF,MAAM;IAC1BG,YAAA,EAAcf,GAAA,CAAIc,OAAO,CAACF,MAAM,CAACG;EACnC;EAEAZ,OAAA,CAAQa,GAAG,CAAC,cAAcN,aAAA;EAE1B,OAAOL,QAAA,CAASC,IAAI,CAClB;IACEC,OAAA,EAASN,CAAA,CAAE;EACb,GACA;IACEE,OAAA;IACAK,MAAA,EAAQd,UAAA,CAAWuB;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/me.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,EAAE,EAAE,sBA0BhB,CAAA"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { extractJWT, meOperation } from 'payload';
|
|
3
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
4
|
-
export const me = async ({
|
|
5
|
-
collection,
|
|
6
|
-
req
|
|
7
|
-
}) => {
|
|
8
|
-
const currentToken = extractJWT(req);
|
|
9
|
-
const result = await meOperation({
|
|
10
|
-
collection,
|
|
11
|
-
currentToken,
|
|
12
|
-
req
|
|
13
|
-
});
|
|
14
|
-
if (collection.config.auth.removeTokenFromResponses) {
|
|
15
|
-
delete result.token;
|
|
16
|
-
}
|
|
17
|
-
return Response.json({
|
|
18
|
-
...result,
|
|
19
|
-
message: req.t('authentication:account')
|
|
20
|
-
}, {
|
|
21
|
-
headers: headersWithCors({
|
|
22
|
-
headers: new Headers(),
|
|
23
|
-
req
|
|
24
|
-
}),
|
|
25
|
-
status: httpStatus.OK
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=me.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"me.js","names":["httpStatus","extractJWT","meOperation","headersWithCors","me","collection","req","currentToken","result","config","auth","removeTokenFromResponses","token","Response","json","message","t","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/auth/me.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { extractJWT, meOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const me: CollectionRouteHandler = async ({ collection, req }) => {\n const currentToken = extractJWT(req)\n\n const result = await meOperation({\n collection,\n currentToken,\n req,\n })\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.token\n }\n\n return Response.json(\n {\n ...result,\n message: req.t('authentication:account'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,UAAU,EAAEC,WAAW,QAAQ;AAIxC,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,EAAA,GAA6B,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EAClE,MAAMC,YAAA,GAAeN,UAAA,CAAWK,GAAA;EAEhC,MAAME,MAAA,GAAS,MAAMN,WAAA,CAAY;IAC/BG,UAAA;IACAE,YAAA;IACAD;EACF;EAEA,IAAID,UAAA,CAAWI,MAAM,CAACC,IAAI,CAACC,wBAAwB,EAAE;IACnD,OAAOH,MAAA,CAAOI,KAAK;EACrB;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACE,GAAGN,MAAM;IACTO,OAAA,EAAST,GAAA,CAAIU,CAAC,CAAC;EACjB,GACA;IACEC,OAAA,EAASd,eAAA,CAAgB;MACvBc,OAAA,EAAS,IAAIC,OAAA;MACbZ;IACF;IACAa,MAAA,EAAQnB,UAAA,CAAWoB;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/refresh.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,OAAO,EAAE,sBAqCrB,CAAA"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { generatePayloadCookie, refreshOperation } from 'payload';
|
|
3
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
4
|
-
export const refresh = async ({
|
|
5
|
-
collection,
|
|
6
|
-
req
|
|
7
|
-
}) => {
|
|
8
|
-
const {
|
|
9
|
-
t
|
|
10
|
-
} = req;
|
|
11
|
-
const headers = headersWithCors({
|
|
12
|
-
headers: new Headers(),
|
|
13
|
-
req
|
|
14
|
-
});
|
|
15
|
-
const result = await refreshOperation({
|
|
16
|
-
collection,
|
|
17
|
-
req
|
|
18
|
-
});
|
|
19
|
-
if (result.setCookie) {
|
|
20
|
-
const cookie = generatePayloadCookie({
|
|
21
|
-
collectionAuthConfig: collection.config.auth,
|
|
22
|
-
cookiePrefix: req.payload.config.cookiePrefix,
|
|
23
|
-
token: result.refreshedToken
|
|
24
|
-
});
|
|
25
|
-
if (collection.config.auth.removeTokenFromResponses) {
|
|
26
|
-
delete result.refreshedToken;
|
|
27
|
-
}
|
|
28
|
-
headers.set('Set-Cookie', cookie);
|
|
29
|
-
}
|
|
30
|
-
return Response.json({
|
|
31
|
-
message: t('authentication:tokenRefreshSuccessful'),
|
|
32
|
-
...result
|
|
33
|
-
}, {
|
|
34
|
-
headers,
|
|
35
|
-
status: httpStatus.OK
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=refresh.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"refresh.js","names":["httpStatus","generatePayloadCookie","refreshOperation","headersWithCors","refresh","collection","req","t","headers","Headers","result","setCookie","cookie","collectionAuthConfig","config","auth","cookiePrefix","payload","token","refreshedToken","removeTokenFromResponses","set","Response","json","message","status","OK"],"sources":["../../../../src/routes/rest/auth/refresh.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generatePayloadCookie, refreshOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const refresh: CollectionRouteHandler = async ({ collection, req }) => {\n const { t } = req\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n const result = await refreshOperation({\n collection,\n req,\n })\n\n if (result.setCookie) {\n const cookie = generatePayloadCookie({\n collectionAuthConfig: collection.config.auth,\n cookiePrefix: req.payload.config.cookiePrefix,\n token: result.refreshedToken,\n })\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.refreshedToken\n }\n\n headers.set('Set-Cookie', cookie)\n }\n\n return Response.json(\n {\n message: t('authentication:tokenRefreshSuccessful'),\n ...result,\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ;AAIxD,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,OAAA,GAAkC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACvE,MAAM;IAAEC;EAAC,CAAE,GAAGD,GAAA;EAEd,MAAME,OAAA,GAAUL,eAAA,CAAgB;IAC9BK,OAAA,EAAS,IAAIC,OAAA;IACbH;EACF;EAEA,MAAMI,MAAA,GAAS,MAAMR,gBAAA,CAAiB;IACpCG,UAAA;IACAC;EACF;EAEA,IAAII,MAAA,CAAOC,SAAS,EAAE;IACpB,MAAMC,MAAA,GAASX,qBAAA,CAAsB;MACnCY,oBAAA,EAAsBR,UAAA,CAAWS,MAAM,CAACC,IAAI;MAC5CC,YAAA,EAAcV,GAAA,CAAIW,OAAO,CAACH,MAAM,CAACE,YAAY;MAC7CE,KAAA,EAAOR,MAAA,CAAOS;IAChB;IAEA,IAAId,UAAA,CAAWS,MAAM,CAACC,IAAI,CAACK,wBAAwB,EAAE;MACnD,OAAOV,MAAA,CAAOS,cAAc;IAC9B;IAEAX,OAAA,CAAQa,GAAG,CAAC,cAAcT,MAAA;EAC5B;EAEA,OAAOU,QAAA,CAASC,IAAI,CAClB;IACEC,OAAA,EAASjB,CAAA,CAAE;IACX,GAAGG;EACL,GACA;IACEF,OAAA;IACAiB,MAAA,EAAQzB,UAAA,CAAW0B;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerFirstUser.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/registerFirstUser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,iBAAiB,EAAE,sBA6C/B,CAAA"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { generatePayloadCookie, registerFirstUserOperation } from 'payload';
|
|
3
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
4
|
-
export const registerFirstUser = async ({
|
|
5
|
-
collection,
|
|
6
|
-
req
|
|
7
|
-
}) => {
|
|
8
|
-
const {
|
|
9
|
-
data,
|
|
10
|
-
t
|
|
11
|
-
} = req;
|
|
12
|
-
const authData = collection.config.auth?.loginWithUsername ? {
|
|
13
|
-
email: typeof req.data?.email === 'string' ? req.data.email : '',
|
|
14
|
-
password: typeof req.data?.password === 'string' ? req.data.password : '',
|
|
15
|
-
username: typeof req.data?.username === 'string' ? req.data.username : ''
|
|
16
|
-
} : {
|
|
17
|
-
email: typeof req.data?.email === 'string' ? req.data.email : '',
|
|
18
|
-
password: typeof req.data?.password === 'string' ? req.data.password : ''
|
|
19
|
-
};
|
|
20
|
-
const result = await registerFirstUserOperation({
|
|
21
|
-
collection,
|
|
22
|
-
data: {
|
|
23
|
-
...data,
|
|
24
|
-
...authData
|
|
25
|
-
},
|
|
26
|
-
req
|
|
27
|
-
});
|
|
28
|
-
const cookie = generatePayloadCookie({
|
|
29
|
-
collectionAuthConfig: collection.config.auth,
|
|
30
|
-
cookiePrefix: req.payload.config.cookiePrefix,
|
|
31
|
-
token: result.token
|
|
32
|
-
});
|
|
33
|
-
return Response.json({
|
|
34
|
-
exp: result.exp,
|
|
35
|
-
message: t('authentication:successfullyRegisteredFirstUser'),
|
|
36
|
-
token: result.token,
|
|
37
|
-
user: result.user
|
|
38
|
-
}, {
|
|
39
|
-
headers: headersWithCors({
|
|
40
|
-
headers: new Headers({
|
|
41
|
-
'Set-Cookie': cookie
|
|
42
|
-
}),
|
|
43
|
-
req
|
|
44
|
-
}),
|
|
45
|
-
status: httpStatus.OK
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=registerFirstUser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerFirstUser.js","names":["httpStatus","generatePayloadCookie","registerFirstUserOperation","headersWithCors","registerFirstUser","collection","req","data","t","authData","config","auth","loginWithUsername","email","password","username","result","cookie","collectionAuthConfig","cookiePrefix","payload","token","Response","json","exp","message","user","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/auth/registerFirstUser.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generatePayloadCookie, registerFirstUserOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const registerFirstUser: CollectionRouteHandler = async ({ collection, req }) => {\n const { data, t } = req\n const authData = collection.config.auth?.loginWithUsername\n ? {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n password: typeof req.data?.password === 'string' ? req.data.password : '',\n username: typeof req.data?.username === 'string' ? req.data.username : '',\n }\n : {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n password: typeof req.data?.password === 'string' ? req.data.password : '',\n }\n\n const result = await registerFirstUserOperation({\n collection,\n data: {\n ...data,\n ...authData,\n },\n req,\n })\n\n const cookie = generatePayloadCookie({\n collectionAuthConfig: collection.config.auth,\n cookiePrefix: req.payload.config.cookiePrefix,\n token: result.token,\n })\n\n return Response.json(\n {\n exp: result.exp,\n message: t('authentication:successfullyRegisteredFirstUser'),\n token: result.token,\n user: result.user,\n },\n {\n headers: headersWithCors({\n headers: new Headers({\n 'Set-Cookie': cookie,\n }),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,qBAAqB,EAAEC,0BAA0B,QAAQ;AAIlE,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,iBAAA,GAA4C,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACjF,MAAM;IAAEC,IAAI;IAAEC;EAAC,CAAE,GAAGF,GAAA;EACpB,MAAMG,QAAA,GAAWJ,UAAA,CAAWK,MAAM,CAACC,IAAI,EAAEC,iBAAA,GACrC;IACEC,KAAA,EAAO,OAAOP,GAAA,CAAIC,IAAI,EAAEM,KAAA,KAAU,WAAWP,GAAA,CAAIC,IAAI,CAACM,KAAK,GAAG;IAC9DC,QAAA,EAAU,OAAOR,GAAA,CAAIC,IAAI,EAAEO,QAAA,KAAa,WAAWR,GAAA,CAAIC,IAAI,CAACO,QAAQ,GAAG;IACvEC,QAAA,EAAU,OAAOT,GAAA,CAAIC,IAAI,EAAEQ,QAAA,KAAa,WAAWT,GAAA,CAAIC,IAAI,CAACQ,QAAQ,GAAG;EACzE,IACA;IACEF,KAAA,EAAO,OAAOP,GAAA,CAAIC,IAAI,EAAEM,KAAA,KAAU,WAAWP,GAAA,CAAIC,IAAI,CAACM,KAAK,GAAG;IAC9DC,QAAA,EAAU,OAAOR,GAAA,CAAIC,IAAI,EAAEO,QAAA,KAAa,WAAWR,GAAA,CAAIC,IAAI,CAACO,QAAQ,GAAG;EACzE;EAEJ,MAAME,MAAA,GAAS,MAAMd,0BAAA,CAA2B;IAC9CG,UAAA;IACAE,IAAA,EAAM;MACJ,GAAGA,IAAI;MACP,GAAGE;IACL;IACAH;EACF;EAEA,MAAMW,MAAA,GAAShB,qBAAA,CAAsB;IACnCiB,oBAAA,EAAsBb,UAAA,CAAWK,MAAM,CAACC,IAAI;IAC5CQ,YAAA,EAAcb,GAAA,CAAIc,OAAO,CAACV,MAAM,CAACS,YAAY;IAC7CE,KAAA,EAAOL,MAAA,CAAOK;EAChB;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEC,GAAA,EAAKR,MAAA,CAAOQ,GAAG;IACfC,OAAA,EAASjB,CAAA,CAAE;IACXa,KAAA,EAAOL,MAAA,CAAOK,KAAK;IACnBK,IAAA,EAAMV,MAAA,CAAOU;EACf,GACA;IACEC,OAAA,EAASxB,eAAA,CAAgB;MACvBwB,OAAA,EAAS,IAAIC,OAAA,CAAQ;QACnB,cAAcX;MAChB;MACAX;IACF;IACAuB,MAAA,EAAQ7B,UAAA,CAAW8B;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resetPassword.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/resetPassword.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,aAAa,EAAE,sBAuC3B,CAAA"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { generatePayloadCookie, resetPasswordOperation } from 'payload';
|
|
3
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
4
|
-
export const resetPassword = async ({
|
|
5
|
-
collection,
|
|
6
|
-
req
|
|
7
|
-
}) => {
|
|
8
|
-
const {
|
|
9
|
-
searchParams,
|
|
10
|
-
t
|
|
11
|
-
} = req;
|
|
12
|
-
const depth = searchParams.get('depth');
|
|
13
|
-
const result = await resetPasswordOperation({
|
|
14
|
-
collection,
|
|
15
|
-
data: {
|
|
16
|
-
password: typeof req.data?.password === 'string' ? req.data.password : '',
|
|
17
|
-
token: typeof req.data?.token === 'string' ? req.data.token : ''
|
|
18
|
-
},
|
|
19
|
-
depth: depth ? Number(depth) : undefined,
|
|
20
|
-
req
|
|
21
|
-
});
|
|
22
|
-
const cookie = generatePayloadCookie({
|
|
23
|
-
collectionAuthConfig: collection.config.auth,
|
|
24
|
-
cookiePrefix: req.payload.config.cookiePrefix,
|
|
25
|
-
token: result.token
|
|
26
|
-
});
|
|
27
|
-
if (collection.config.auth.removeTokenFromResponses) {
|
|
28
|
-
delete result.token;
|
|
29
|
-
}
|
|
30
|
-
return Response.json({
|
|
31
|
-
message: t('authentication:passwordResetSuccessfully'),
|
|
32
|
-
...result
|
|
33
|
-
}, {
|
|
34
|
-
headers: headersWithCors({
|
|
35
|
-
headers: new Headers({
|
|
36
|
-
'Set-Cookie': cookie
|
|
37
|
-
}),
|
|
38
|
-
req
|
|
39
|
-
}),
|
|
40
|
-
status: httpStatus.OK
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=resetPassword.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resetPassword.js","names":["httpStatus","generatePayloadCookie","resetPasswordOperation","headersWithCors","resetPassword","collection","req","searchParams","t","depth","get","result","data","password","token","Number","undefined","cookie","collectionAuthConfig","config","auth","cookiePrefix","payload","removeTokenFromResponses","Response","json","message","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/auth/resetPassword.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generatePayloadCookie, resetPasswordOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const resetPassword: CollectionRouteHandler = async ({ collection, req }) => {\n const { searchParams, t } = req\n const depth = searchParams.get('depth')\n\n const result = await resetPasswordOperation({\n collection,\n data: {\n password: typeof req.data?.password === 'string' ? req.data.password : '',\n token: typeof req.data?.token === 'string' ? req.data.token : '',\n },\n depth: depth ? Number(depth) : undefined,\n req,\n })\n\n const cookie = generatePayloadCookie({\n collectionAuthConfig: collection.config.auth,\n cookiePrefix: req.payload.config.cookiePrefix,\n token: result.token,\n })\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.token\n }\n\n return Response.json(\n {\n message: t('authentication:passwordResetSuccessfully'),\n ...result,\n },\n {\n headers: headersWithCors({\n headers: new Headers({\n 'Set-Cookie': cookie,\n }),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,qBAAqB,EAAEC,sBAAsB,QAAQ;AAI9D,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,aAAA,GAAwC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EAC7E,MAAM;IAAEC,YAAY;IAAEC;EAAC,CAAE,GAAGF,GAAA;EAC5B,MAAMG,KAAA,GAAQF,YAAA,CAAaG,GAAG,CAAC;EAE/B,MAAMC,MAAA,GAAS,MAAMT,sBAAA,CAAuB;IAC1CG,UAAA;IACAO,IAAA,EAAM;MACJC,QAAA,EAAU,OAAOP,GAAA,CAAIM,IAAI,EAAEC,QAAA,KAAa,WAAWP,GAAA,CAAIM,IAAI,CAACC,QAAQ,GAAG;MACvEC,KAAA,EAAO,OAAOR,GAAA,CAAIM,IAAI,EAAEE,KAAA,KAAU,WAAWR,GAAA,CAAIM,IAAI,CAACE,KAAK,GAAG;IAChE;IACAL,KAAA,EAAOA,KAAA,GAAQM,MAAA,CAAON,KAAA,IAASO,SAAA;IAC/BV;EACF;EAEA,MAAMW,MAAA,GAAShB,qBAAA,CAAsB;IACnCiB,oBAAA,EAAsBb,UAAA,CAAWc,MAAM,CAACC,IAAI;IAC5CC,YAAA,EAAcf,GAAA,CAAIgB,OAAO,CAACH,MAAM,CAACE,YAAY;IAC7CP,KAAA,EAAOH,MAAA,CAAOG;EAChB;EAEA,IAAIT,UAAA,CAAWc,MAAM,CAACC,IAAI,CAACG,wBAAwB,EAAE;IACnD,OAAOZ,MAAA,CAAOG,KAAK;EACrB;EAEA,OAAOU,QAAA,CAASC,IAAI,CAClB;IACEC,OAAA,EAASlB,CAAA,CAAE;IACX,GAAGG;EACL,GACA;IACEgB,OAAA,EAASxB,eAAA,CAAgB;MACvBwB,OAAA,EAAS,IAAIC,OAAA,CAAQ;QACnB,cAAcX;MAChB;MACAX;IACF;IACAuB,MAAA,EAAQ7B,UAAA,CAAW8B;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unlock.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/unlock.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,MAAM,EAAE,sBA+BpB,CAAA"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { unlockOperation } from 'payload';
|
|
3
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
4
|
-
export const unlock = async ({
|
|
5
|
-
collection,
|
|
6
|
-
req
|
|
7
|
-
}) => {
|
|
8
|
-
const {
|
|
9
|
-
t
|
|
10
|
-
} = req;
|
|
11
|
-
const authData = collection.config.auth?.loginWithUsername !== false ? {
|
|
12
|
-
email: typeof req.data?.email === 'string' ? req.data.email : '',
|
|
13
|
-
username: typeof req.data?.username === 'string' ? req.data.username : ''
|
|
14
|
-
} : {
|
|
15
|
-
email: typeof req.data?.email === 'string' ? req.data.email : ''
|
|
16
|
-
};
|
|
17
|
-
await unlockOperation({
|
|
18
|
-
collection,
|
|
19
|
-
data: authData,
|
|
20
|
-
req
|
|
21
|
-
});
|
|
22
|
-
return Response.json({
|
|
23
|
-
message: t('general:success')
|
|
24
|
-
}, {
|
|
25
|
-
headers: headersWithCors({
|
|
26
|
-
headers: new Headers(),
|
|
27
|
-
req
|
|
28
|
-
}),
|
|
29
|
-
status: httpStatus.OK
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=unlock.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unlock.js","names":["httpStatus","unlockOperation","headersWithCors","unlock","collection","req","t","authData","config","auth","loginWithUsername","email","data","username","Response","json","message","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/auth/unlock.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { unlockOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const unlock: CollectionRouteHandler = async ({ collection, req }) => {\n const { t } = req\n\n const authData =\n collection.config.auth?.loginWithUsername !== false\n ? {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n username: typeof req.data?.username === 'string' ? req.data.username : '',\n }\n : {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n }\n\n await unlockOperation({\n collection,\n data: authData,\n req,\n })\n\n return Response.json(\n {\n message: t('general:success'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,eAAe,QAAQ;AAIhC,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,MAAA,GAAiC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACtE,MAAM;IAAEC;EAAC,CAAE,GAAGD,GAAA;EAEd,MAAME,QAAA,GACJH,UAAA,CAAWI,MAAM,CAACC,IAAI,EAAEC,iBAAA,KAAsB,QAC1C;IACEC,KAAA,EAAO,OAAON,GAAA,CAAIO,IAAI,EAAED,KAAA,KAAU,WAAWN,GAAA,CAAIO,IAAI,CAACD,KAAK,GAAG;IAC9DE,QAAA,EAAU,OAAOR,GAAA,CAAIO,IAAI,EAAEC,QAAA,KAAa,WAAWR,GAAA,CAAIO,IAAI,CAACC,QAAQ,GAAG;EACzE,IACA;IACEF,KAAA,EAAO,OAAON,GAAA,CAAIO,IAAI,EAAED,KAAA,KAAU,WAAWN,GAAA,CAAIO,IAAI,CAACD,KAAK,GAAG;EAChE;EAEN,MAAMV,eAAA,CAAgB;IACpBG,UAAA;IACAQ,IAAA,EAAML,QAAA;IACNF;EACF;EAEA,OAAOS,QAAA,CAASC,IAAI,CAClB;IACEC,OAAA,EAASV,CAAA,CAAE;EACb,GACA;IACEW,OAAA,EAASf,eAAA,CAAgB;MACvBe,OAAA,EAAS,IAAIC,OAAA;MACbb;IACF;IACAc,MAAA,EAAQnB,UAAA,CAAWoB;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verifyEmail.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/verifyEmail.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAI/D,eAAO,MAAM,WAAW,EAAE,4BAoBzB,CAAA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { verifyEmailOperation } from 'payload';
|
|
3
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
4
|
-
export const verifyEmail = async ({
|
|
5
|
-
id,
|
|
6
|
-
collection,
|
|
7
|
-
req
|
|
8
|
-
}) => {
|
|
9
|
-
const {
|
|
10
|
-
t
|
|
11
|
-
} = req;
|
|
12
|
-
await verifyEmailOperation({
|
|
13
|
-
collection,
|
|
14
|
-
req,
|
|
15
|
-
token: id
|
|
16
|
-
});
|
|
17
|
-
return Response.json({
|
|
18
|
-
message: t('authentication:accountVerified')
|
|
19
|
-
}, {
|
|
20
|
-
headers: headersWithCors({
|
|
21
|
-
headers: new Headers(),
|
|
22
|
-
req
|
|
23
|
-
}),
|
|
24
|
-
status: httpStatus.OK
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=verifyEmail.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verifyEmail.js","names":["httpStatus","verifyEmailOperation","headersWithCors","verifyEmail","id","collection","req","t","token","Response","json","message","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/auth/verifyEmail.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { verifyEmailOperation } from 'payload'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const verifyEmail: CollectionRouteHandlerWithID = async ({ id, collection, req }) => {\n const { t } = req\n await verifyEmailOperation({\n collection,\n req,\n token: id,\n })\n\n return Response.json(\n {\n message: t('authentication:accountVerified'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,oBAAoB,QAAQ;AAIrC,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,WAAA,GAA4C,MAAAA,CAAO;EAAEC,EAAE;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACrF,MAAM;IAAEC;EAAC,CAAE,GAAGD,GAAA;EACd,MAAML,oBAAA,CAAqB;IACzBI,UAAA;IACAC,GAAA;IACAE,KAAA,EAAOJ;EACT;EAEA,OAAOK,QAAA,CAASC,IAAI,CAClB;IACEC,OAAA,EAASJ,CAAA,CAAE;EACb,GACA;IACEK,OAAA,EAASV,eAAA,CAAgB;MACvBU,OAAA,EAAS,IAAIC,OAAA;MACbP;IACF;IACAQ,MAAA,EAAQd,UAAA,CAAWe;EACrB;AAEJ","ignoreList":[]}
|