@payloadcms/next 3.65.0-canary.7 → 3.65.0-canary.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initReq.d.ts","sourceRoot":"","sources":["../../src/utilities/initReq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,0BAA0B,CAAA;AACnF,OAAO,KAAK,EACV,SAAS,EACT,MAAM,EAEN,cAAc,EACd,eAAe,EACf,oBAAoB,EAErB,MAAM,SAAS,CAAA;AAGhB,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EACL,cAAc,EAMf,MAAM,SAAS,CAAA;AAKhB,KAAK,MAAM,GAAG;IACZ,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAA;IAC/C,YAAY,EAAE,iBAAiB,CAAA;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,oBAAoB,CAAA;IACjC,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAcD;;;GAGG;AACH,eAAO,MAAM,OAAO,iEAMjB;IACD,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IACzD,SAAS,EAAE,SAAS,CAAA;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;CACjD,KAAG,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"initReq.d.ts","sourceRoot":"","sources":["../../src/utilities/initReq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,0BAA0B,CAAA;AACnF,OAAO,KAAK,EACV,SAAS,EACT,MAAM,EAEN,cAAc,EACd,eAAe,EACf,oBAAoB,EAErB,MAAM,SAAS,CAAA;AAGhB,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EACL,cAAc,EAMf,MAAM,SAAS,CAAA;AAKhB,KAAK,MAAM,GAAG;IACZ,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAA;IAC/C,YAAY,EAAE,iBAAiB,CAAA;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,oBAAoB,CAAA;IACjC,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAcD;;;GAGG;AACH,eAAO,MAAM,OAAO,iEAMjB;IACD,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IACzD,SAAS,EAAE,SAAS,CAAA;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;CACjD,KAAG,OAAO,CAAC,MAAM,CA0FjB,CAAA"}
|
|
@@ -90,6 +90,21 @@ export const initReq = async function ({
|
|
|
90
90
|
permissions,
|
|
91
91
|
req
|
|
92
92
|
};
|
|
93
|
-
}, key)
|
|
93
|
+
}, key).then(result => {
|
|
94
|
+
// CRITICAL: Create a shallow copy of req before returning to prevent
|
|
95
|
+
// mutations from propagating to the cached req object.
|
|
96
|
+
// This ensures parallel operations using the same cache key don't affect each other.
|
|
97
|
+
return {
|
|
98
|
+
...result,
|
|
99
|
+
req: {
|
|
100
|
+
...result.req,
|
|
101
|
+
...(result.req?.context ? {
|
|
102
|
+
context: {
|
|
103
|
+
...result.req.context
|
|
104
|
+
}
|
|
105
|
+
} : {})
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
});
|
|
94
109
|
};
|
|
95
110
|
//# sourceMappingURL=initReq.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initReq.js","names":["initI18n","headers","getHeaders","createLocalReq","executeAuthStrategies","getAccessResults","getPayload","getRequestLanguage","parseCookies","getRequestLocale","selectiveCache","partialReqCache","reqCache","initReq","canSetHeaders","configPromise","importMap","key","overrides","cookies","partialResult","get","config","payload","cron","languageCode","i18n","context","language","responseHeaders","user","req","reqOverrides","optionsOverrides","host","locale","code","permissions"],"sources":["../../src/utilities/initReq.ts"],"sourcesContent":["import type { AcceptedLanguages, I18n, I18nClient } from '@payloadcms/translations'\nimport type {\n ImportMap,\n Locale,\n Payload,\n PayloadRequest,\n SanitizedConfig,\n SanitizedPermissions,\n TypedUser,\n} from 'payload'\n\nimport { initI18n } from '@payloadcms/translations'\nimport { headers as getHeaders } from 'next/headers.js'\nimport {\n createLocalReq,\n executeAuthStrategies,\n getAccessResults,\n getPayload,\n getRequestLanguage,\n parseCookies,\n} from 'payload'\n\nimport { getRequestLocale } from './getRequestLocale.js'\nimport { selectiveCache } from './selectiveCache.js'\n\ntype Result = {\n cookies: Map<string, string>\n headers: Awaited<ReturnType<typeof getHeaders>>\n languageCode: AcceptedLanguages\n locale?: Locale\n permissions: SanitizedPermissions\n req: PayloadRequest\n}\n\ntype PartialResult = {\n i18n: I18nClient\n languageCode: AcceptedLanguages\n payload: Payload\n responseHeaders: Headers\n user: null | TypedUser\n}\n\n// Create cache instances for different parts of our application\nconst partialReqCache = selectiveCache<PartialResult>('partialReq')\nconst reqCache = selectiveCache<Result>('req')\n\n/**\n * Initializes a full request object, including the `req` object and access control.\n * As access control and getting the request locale is dependent on the current URL and\n */\nexport const initReq = async function ({\n canSetHeaders,\n configPromise,\n importMap,\n key,\n overrides,\n}: {\n canSetHeaders?: boolean\n configPromise: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n key: string\n overrides?: Parameters<typeof createLocalReq>[0]\n}): Promise<Result> {\n const headers = await getHeaders()\n const cookies = parseCookies(headers)\n\n const partialResult = await partialReqCache.get(async () => {\n const config = await configPromise\n const payload = await getPayload({ config, cron: true, importMap })\n const languageCode = getRequestLanguage({\n config,\n cookies,\n headers,\n })\n\n const i18n: I18nClient = await initI18n({\n config: config.i18n,\n context: 'client',\n language: languageCode,\n })\n\n const { responseHeaders, user } = await executeAuthStrategies({\n canSetHeaders,\n headers,\n payload,\n })\n\n return {\n i18n,\n languageCode,\n payload,\n responseHeaders,\n user,\n }\n }, 'global')\n\n return reqCache.get(async () => {\n
|
|
1
|
+
{"version":3,"file":"initReq.js","names":["initI18n","headers","getHeaders","createLocalReq","executeAuthStrategies","getAccessResults","getPayload","getRequestLanguage","parseCookies","getRequestLocale","selectiveCache","partialReqCache","reqCache","initReq","canSetHeaders","configPromise","importMap","key","overrides","cookies","partialResult","get","config","payload","cron","languageCode","i18n","context","language","responseHeaders","user","req","reqOverrides","optionsOverrides","host","locale","code","permissions","then","result"],"sources":["../../src/utilities/initReq.ts"],"sourcesContent":["import type { AcceptedLanguages, I18n, I18nClient } from '@payloadcms/translations'\nimport type {\n ImportMap,\n Locale,\n Payload,\n PayloadRequest,\n SanitizedConfig,\n SanitizedPermissions,\n TypedUser,\n} from 'payload'\n\nimport { initI18n } from '@payloadcms/translations'\nimport { headers as getHeaders } from 'next/headers.js'\nimport {\n createLocalReq,\n executeAuthStrategies,\n getAccessResults,\n getPayload,\n getRequestLanguage,\n parseCookies,\n} from 'payload'\n\nimport { getRequestLocale } from './getRequestLocale.js'\nimport { selectiveCache } from './selectiveCache.js'\n\ntype Result = {\n cookies: Map<string, string>\n headers: Awaited<ReturnType<typeof getHeaders>>\n languageCode: AcceptedLanguages\n locale?: Locale\n permissions: SanitizedPermissions\n req: PayloadRequest\n}\n\ntype PartialResult = {\n i18n: I18nClient\n languageCode: AcceptedLanguages\n payload: Payload\n responseHeaders: Headers\n user: null | TypedUser\n}\n\n// Create cache instances for different parts of our application\nconst partialReqCache = selectiveCache<PartialResult>('partialReq')\nconst reqCache = selectiveCache<Result>('req')\n\n/**\n * Initializes a full request object, including the `req` object and access control.\n * As access control and getting the request locale is dependent on the current URL and\n */\nexport const initReq = async function ({\n canSetHeaders,\n configPromise,\n importMap,\n key,\n overrides,\n}: {\n canSetHeaders?: boolean\n configPromise: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n key: string\n overrides?: Parameters<typeof createLocalReq>[0]\n}): Promise<Result> {\n const headers = await getHeaders()\n const cookies = parseCookies(headers)\n\n const partialResult = await partialReqCache.get(async () => {\n const config = await configPromise\n const payload = await getPayload({ config, cron: true, importMap })\n const languageCode = getRequestLanguage({\n config,\n cookies,\n headers,\n })\n\n const i18n: I18nClient = await initI18n({\n config: config.i18n,\n context: 'client',\n language: languageCode,\n })\n\n const { responseHeaders, user } = await executeAuthStrategies({\n canSetHeaders,\n headers,\n payload,\n })\n\n return {\n i18n,\n languageCode,\n payload,\n responseHeaders,\n user,\n }\n }, 'global')\n\n return reqCache\n .get(async () => {\n const { i18n, languageCode, payload, responseHeaders, user } = partialResult\n\n const { req: reqOverrides, ...optionsOverrides } = overrides || {}\n\n const req = await createLocalReq(\n {\n req: {\n headers,\n host: headers.get('host'),\n i18n: i18n as I18n,\n responseHeaders,\n user,\n ...(reqOverrides || {}),\n },\n ...(optionsOverrides || {}),\n },\n payload,\n )\n\n const locale = await getRequestLocale({\n req,\n })\n\n req.locale = locale?.code\n\n const permissions = await getAccessResults({\n req,\n })\n\n return {\n cookies,\n headers,\n languageCode,\n locale,\n permissions,\n req,\n }\n }, key)\n .then((result) => {\n // CRITICAL: Create a shallow copy of req before returning to prevent\n // mutations from propagating to the cached req object.\n // This ensures parallel operations using the same cache key don't affect each other.\n return {\n ...result,\n req: {\n ...result.req,\n ...(result.req?.context\n ? {\n context: { ...result.req.context },\n }\n : {}),\n },\n }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EC;IAAI,CAAE,GAAGV,aAAA;IAE/D,MAAM;MAAEW,GAAA,EAAKC,YAAY;MAAE,GAAGC;IAAA,CAAkB,GAAGf,SAAA,IAAa,CAAC;IAEjE,MAAMa,GAAA,GAAM,MAAM5B,cAAA,CAChB;MACE4B,GAAA,EAAK;QACH9B,OAAA;QACAiC,IAAA,EAAMjC,OAAA,CAAQoB,GAAG,CAAC;QAClBK,IAAA,EAAMA,IAAA;QACNG,eAAA;QACAC,IAAA;QACA,IAAIE,YAAA,IAAgB,CAAC,CAAC;MACxB;MACA,IAAIC,gBAAA,IAAoB,CAAC,CAAC;IAC5B,GACAV,OAAA;IAGF,MAAMY,MAAA,GAAS,MAAM1B,gBAAA,CAAiB;MACpCsB;IACF;IAEAA,GAAA,CAAII,MAAM,GAAGA,MAAA,EAAQC,IAAA;IAErB,MAAMC,WAAA,GAAc,MAAMhC,gBAAA,CAAiB;MACzC0B;IACF;IAEA,OAAO;MACLZ,OAAA;MACAlB,OAAA;MACAwB,YAAA;MACAU,MAAA;MACAE,WAAA;MACAN;IACF;EACF,GAAGd,GAAA,EACFqB,IAAI,CAAEC,MAAA;IACL;IACA;IACA;IACA,OAAO;MACL,GAAGA,MAAM;MACTR,GAAA,EAAK;QACH,GAAGQ,MAAA,CAAOR,GAAG;QACb,IAAIQ,MAAA,CAAOR,GAAG,EAAEJ,OAAA,GACZ;UACEA,OAAA,EAAS;YAAE,GAAGY,MAAA,CAAOR,GAAG,CAACJ;UAAQ;QACnC,IACA,CAAC,CAAC;MACR;IACF;EACF;AACJ","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/next",
|
|
3
|
-
"version": "3.65.0-canary.
|
|
3
|
+
"version": "3.65.0-canary.8",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -97,9 +97,9 @@
|
|
|
97
97
|
"qs-esm": "7.0.2",
|
|
98
98
|
"sass": "1.77.4",
|
|
99
99
|
"uuid": "10.0.0",
|
|
100
|
-
"@payloadcms/graphql": "3.65.0-canary.
|
|
101
|
-
"@payloadcms/
|
|
102
|
-
"@payloadcms/
|
|
100
|
+
"@payloadcms/graphql": "3.65.0-canary.8",
|
|
101
|
+
"@payloadcms/ui": "3.65.0-canary.8",
|
|
102
|
+
"@payloadcms/translations": "3.65.0-canary.8"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@babel/cli": "7.27.2",
|
|
@@ -116,13 +116,13 @@
|
|
|
116
116
|
"esbuild": "0.25.5",
|
|
117
117
|
"esbuild-sass-plugin": "3.3.1",
|
|
118
118
|
"swc-plugin-transform-remove-imports": "4.0.4",
|
|
119
|
-
"
|
|
120
|
-
"
|
|
119
|
+
"payload": "3.65.0-canary.8",
|
|
120
|
+
"@payloadcms/eslint-config": "3.28.0"
|
|
121
121
|
},
|
|
122
122
|
"peerDependencies": {
|
|
123
123
|
"graphql": "^16.8.1",
|
|
124
124
|
"next": "^15.2.3",
|
|
125
|
-
"payload": "3.65.0-canary.
|
|
125
|
+
"payload": "3.65.0-canary.8"
|
|
126
126
|
},
|
|
127
127
|
"engines": {
|
|
128
128
|
"node": "^18.20.2 || >=20.9.0"
|