@payloadcms/next 3.1.1 → 3.2.0
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/layouts/Root/checkDependencies.d.ts +1 -1
- package/dist/layouts/Root/checkDependencies.d.ts.map +1 -1
- package/dist/layouts/Root/checkDependencies.js +2 -2
- package/dist/layouts/Root/checkDependencies.js.map +1 -1
- package/dist/layouts/Root/index.d.ts.map +1 -1
- package/dist/layouts/Root/index.js +3 -4
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/prod/styles.css +1 -1
- package/dist/utilities/handleServerFunctions.d.ts.map +1 -1
- package/dist/utilities/handleServerFunctions.js +2 -0
- package/dist/utilities/handleServerFunctions.js.map +1 -1
- package/dist/views/Account/index.d.ts.map +1 -1
- package/dist/views/Account/index.js +1 -0
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/Document/getVersions.d.ts +8 -1
- package/dist/views/Document/getVersions.d.ts.map +1 -1
- package/dist/views/Document/getVersions.js +57 -33
- package/dist/views/Document/getVersions.js.map +1 -1
- package/dist/views/Document/handleServerFunction.d.ts +2 -7
- package/dist/views/Document/handleServerFunction.d.ts.map +1 -1
- package/dist/views/Document/handleServerFunction.js +5 -22
- package/dist/views/Document/handleServerFunction.js.map +1 -1
- package/dist/views/Document/index.d.ts +3 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +3 -1
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/List/handleServerFunction.d.ts +2 -7
- package/dist/views/List/handleServerFunction.d.ts.map +1 -1
- package/dist/views/List/handleServerFunction.js +5 -22
- package/dist/views/List/handleServerFunction.js.map +1 -1
- package/dist/views/List/index.d.ts +1 -0
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +2 -1
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
- package/dist/views/Login/LoginForm/index.js +39 -33
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js +2 -2
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +2 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js +2 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +3 -3
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/types.d.ts +3 -3
- package/dist/views/Version/RenderFieldsToDiff/fields/types.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/types.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.js +3 -2
- package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
- package/package.json +6 -6
- package/dist/utilities/getClientConfig.d.ts +0 -8
- package/dist/utilities/getClientConfig.d.ts.map +0 -1
- package/dist/utilities/getClientConfig.js +0 -16
- package/dist/utilities/getClientConfig.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["RenderServerComponent","formatAdminURL","notFound","redirect","React","Fragment","DefaultTemplate","MinimalTemplate","
|
|
1
|
+
{"version":3,"file":"index.js","names":["RenderServerComponent","formatAdminURL","getClientConfig","notFound","redirect","React","Fragment","DefaultTemplate","MinimalTemplate","initPage","getViewFromConfig","generatePageMetadata","RootPage","config","configPromise","importMap","params","paramsPromise","searchParams","searchParamsPromise","admin","routes","createFirstUser","_createFirstUserRoute","user","userSlug","adminRoute","currentRoute","path","Array","isArray","segments","join","DefaultView","initPageOptions","serverProps","templateClassName","templateType","initPageResult","dbHasUser","req","payload","db","findOne","collection","then","doc","Component","payloadComponent","redirectTo","createFirstUserRoute","collectionConfig","collections","find","slug","disableLocalStrategy","auth","clientConfig","i18n","RenderedView","clientProps","Fallback","_jsxs","_jsx","className","locale","permissions","viewActions","visibleEntities","globals"],"sources":["../../../src/views/Root/index.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { Metadata } from 'next'\nimport type { ImportMap, SanitizedConfig } from 'payload'\n\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { formatAdminURL } from '@payloadcms/ui/shared'\nimport { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig'\nimport { notFound, redirect } from 'next/navigation.js'\nimport React, { Fragment } from 'react'\n\nimport { DefaultTemplate } from '../../templates/Default/index.js'\nimport { MinimalTemplate } from '../../templates/Minimal/index.js'\nimport { initPage } from '../../utilities/initPage/index.js'\nimport { getViewFromConfig } from './getViewFromConfig.js'\n\nexport { generatePageMetadata } from './meta.js'\n\nexport type GenerateViewMetadata = (args: {\n config: SanitizedConfig\n i18n: I18nClient\n isEditing?: boolean\n params?: { [key: string]: string | string[] }\n}) => Promise<Metadata>\n\nexport const RootPage = async ({\n config: configPromise,\n importMap,\n params: paramsPromise,\n searchParams: searchParamsPromise,\n}: {\n readonly config: Promise<SanitizedConfig>\n readonly importMap: ImportMap\n readonly params: Promise<{\n segments: string[]\n }>\n readonly searchParams: Promise<{\n [key: string]: string | string[]\n }>\n}) => {\n const config = await configPromise\n\n const {\n admin: {\n routes: { createFirstUser: _createFirstUserRoute },\n user: userSlug,\n },\n routes: { admin: adminRoute },\n } = config\n\n const params = await paramsPromise\n const currentRoute = formatAdminURL({\n adminRoute,\n path: `${Array.isArray(params.segments) ? `/${params.segments.join('/')}` : ''}`,\n })\n\n const segments = Array.isArray(params.segments) ? params.segments : []\n\n const searchParams = await searchParamsPromise\n\n const { DefaultView, initPageOptions, serverProps, templateClassName, templateType } =\n getViewFromConfig({\n adminRoute,\n config,\n currentRoute,\n importMap,\n searchParams,\n segments,\n })\n\n const initPageResult = await initPage(initPageOptions)\n\n const dbHasUser =\n initPageResult.req.user ||\n (await initPageResult?.req.payload.db\n .findOne({\n collection: userSlug,\n req: initPageResult?.req,\n })\n ?.then((doc) => !!doc))\n\n if (!DefaultView?.Component && !DefaultView?.payloadComponent) {\n if (initPageResult?.req?.user) {\n notFound()\n }\n\n if (dbHasUser) {\n redirect(adminRoute)\n }\n }\n\n if (typeof initPageResult?.redirectTo === 'string') {\n redirect(initPageResult.redirectTo)\n }\n\n if (initPageResult) {\n const createFirstUserRoute = formatAdminURL({ adminRoute, path: _createFirstUserRoute })\n\n const collectionConfig = config.collections.find(({ slug }) => slug === userSlug)\n const disableLocalStrategy = collectionConfig?.auth?.disableLocalStrategy\n\n if (disableLocalStrategy && currentRoute === createFirstUserRoute) {\n redirect(adminRoute)\n }\n\n if (!dbHasUser && currentRoute !== createFirstUserRoute && !disableLocalStrategy) {\n redirect(createFirstUserRoute)\n }\n\n if (dbHasUser && currentRoute === createFirstUserRoute) {\n redirect(adminRoute)\n }\n }\n\n if (!DefaultView?.Component && !DefaultView?.payloadComponent && !dbHasUser) {\n redirect(adminRoute)\n }\n\n const clientConfig = getClientConfig({\n config,\n i18n: initPageResult?.req.i18n,\n importMap,\n })\n\n const RenderedView = RenderServerComponent({\n clientProps: { clientConfig },\n Component: DefaultView.payloadComponent,\n Fallback: DefaultView.Component,\n importMap,\n serverProps: {\n ...serverProps,\n clientConfig,\n i18n: initPageResult?.req.i18n,\n importMap,\n initPageResult,\n params,\n payload: initPageResult?.req.payload,\n searchParams,\n },\n })\n\n return (\n <Fragment>\n {!templateType && <Fragment>{RenderedView}</Fragment>}\n {templateType === 'minimal' && (\n <MinimalTemplate className={templateClassName}>{RenderedView}</MinimalTemplate>\n )}\n {templateType === 'default' && (\n <DefaultTemplate\n i18n={initPageResult?.req.i18n}\n locale={initPageResult?.locale}\n params={params}\n payload={initPageResult?.req.payload}\n permissions={initPageResult?.permissions}\n searchParams={searchParams}\n user={initPageResult?.req.user}\n viewActions={serverProps.viewActions}\n visibleEntities={{\n // The reason we are not passing in initPageResult.visibleEntities directly is due to a \"Cannot assign to read only property of object '#<Object>\" error introduced in React 19\n // which this caused as soon as initPageResult.visibleEntities is passed in\n collections: initPageResult?.visibleEntities?.collections,\n globals: initPageResult?.visibleEntities?.globals,\n }}\n >\n {RenderedView}\n </DefaultTemplate>\n )}\n </Fragment>\n )\n}\n"],"mappings":";AAIA,SAASA,qBAAqB,QAAQ;AACtC,SAASC,cAAc,QAAQ;AAC/B,SAASC,eAAe,QAAQ;AAChC,SAASC,QAAQ,EAAEC,QAAQ,QAAQ;AACnC,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAEhC,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,SAASC,QAAQ,QAAQ;AACzB,SAASC,iBAAiB,QAAQ;AAElC,SAASC,oBAAoB,QAAQ;AASrC,OAAO,MAAMC,QAAA,GAAW,MAAAA,CAAO;EAC7BC,MAAA,EAAQC,aAAa;EACrBC,SAAS;EACTC,MAAA,EAAQC,aAAa;EACrBC,YAAA,EAAcC;AAAmB,CAUlC;EACC,MAAMN,MAAA,GAAS,MAAMC,aAAA;EAErB,MAAM;IACJM,KAAA,EAAO;MACLC,MAAA,EAAQ;QAAEC,eAAA,EAAiBC;MAAqB,CAAE;MAClDC,IAAA,EAAMC;IAAQ,CACf;IACDJ,MAAA,EAAQ;MAAED,KAAA,EAAOM;IAAU;EAAE,CAC9B,GAAGb,MAAA;EAEJ,MAAMG,MAAA,GAAS,MAAMC,aAAA;EACrB,MAAMU,YAAA,GAAe1B,cAAA,CAAe;IAClCyB,UAAA;IACAE,IAAA,EAAM,GAAGC,KAAA,CAAMC,OAAO,CAACd,MAAA,CAAOe,QAAQ,IAAI,IAAIf,MAAA,CAAOe,QAAQ,CAACC,IAAI,CAAC,MAAM,GAAG;EAC9E;EAEA,MAAMD,QAAA,GAAWF,KAAA,CAAMC,OAAO,CAACd,MAAA,CAAOe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AQ3B,cAAA,EAAgB2B,MAAA;MACxBjD,MAAA,EAAQA,MAAA;MACRyB,OAAA,EAASH,cAAA,EAAgBE,GAAA,CAAIC,OAAA;MAC7ByB,WAAA,EAAa5B,cAAA,EAAgB4B,WAAA;MAC7BhD,YAAA,EAAcA,YAAA;MACdM,IAAA,EAAMc,cAAA,EAAgBE,GAAA,CAAIhB,IAAA;MAC1B2C,WAAA,EAAahC,WAAA,CAAYgC,WAAW;MACpCC,eAAA,EAAiB;QACf;QACA;QACAhB,WAAA,EAAad,cAAA,EAAgB8B,eAAA,EAAiBhB,WAAA;QAC9CiB,OAAA,EAAS/B,cAAA,EAAgB8B,eAAA,EAAiBC;MAC5C;gBAECV;;;AAKX","ignoreList":[]}
|
|
@@ -11,10 +11,10 @@ const Iterable = ({
|
|
|
11
11
|
comparison,
|
|
12
12
|
diffComponents,
|
|
13
13
|
field,
|
|
14
|
+
fieldPermissions,
|
|
14
15
|
i18n,
|
|
15
16
|
locale,
|
|
16
17
|
locales,
|
|
17
|
-
permissions,
|
|
18
18
|
version
|
|
19
19
|
}) => {
|
|
20
20
|
const versionRowCount = Array.isArray(version) ? version.length : 0;
|
|
@@ -57,7 +57,7 @@ const Iterable = ({
|
|
|
57
57
|
children: /*#__PURE__*/_jsx(RenderFieldsToDiff, {
|
|
58
58
|
comparison: comparisonRow,
|
|
59
59
|
diffComponents: diffComponents,
|
|
60
|
-
fieldPermissions:
|
|
60
|
+
fieldPermissions: fieldPermissions,
|
|
61
61
|
fields: fields,
|
|
62
62
|
i18n: i18n,
|
|
63
63
|
locales: locales,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getTranslation","getUniqueListBy","React","RenderFieldsToDiff","Label","baseClass","Iterable","comparison","diffComponents","field","i18n","locale","locales","
|
|
1
|
+
{"version":3,"file":"index.js","names":["getTranslation","getUniqueListBy","React","RenderFieldsToDiff","Label","baseClass","Iterable","comparison","diffComponents","field","fieldPermissions","i18n","locale","locales","version","versionRowCount","Array","isArray","length","comparisonRowCount","maxRows","Math","max","_jsxs","className","label","_jsx","Fragment","from","keys","map","row","i","versionRow","comparisonRow","fields","type","blockType","matchedBlock","blocks","find","block","slug","matchedVersionBlock","matchedComparisonBlock","t","labels","plural"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Iterable/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientField } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { getUniqueListBy } from 'payload/shared'\nimport React from 'react'\n\nimport type { DiffComponentProps } from '../types.js'\n\nimport RenderFieldsToDiff from '../../index.js'\nimport Label from '../../Label/index.js'\nimport './index.scss'\n\nconst baseClass = 'iterable-diff'\n\nconst Iterable: React.FC<DiffComponentProps> = ({\n comparison,\n diffComponents,\n field,\n fieldPermissions,\n i18n,\n locale,\n locales,\n version,\n}) => {\n const versionRowCount = Array.isArray(version) ? version.length : 0\n const comparisonRowCount = Array.isArray(comparison) ? comparison.length : 0\n const maxRows = Math.max(versionRowCount, comparisonRowCount)\n\n return (\n <div className={baseClass}>\n {'label' in field && field.label && typeof field.label !== 'function' && (\n <Label>\n {locale && <span className={`${baseClass}__locale-label`}>{locale}</span>}\n {getTranslation(field.label, i18n)}\n </Label>\n )}\n {maxRows > 0 && (\n <React.Fragment>\n {Array.from(Array(maxRows).keys()).map((row, i) => {\n const versionRow = version?.[i] || {}\n const comparisonRow = comparison?.[i] || {}\n\n let fields: ClientField[] = []\n\n if (field.type === 'array' && 'fields' in field) {\n fields = field.fields\n }\n\n if (field.type === 'blocks') {\n fields = [\n // {\n // name: 'blockType',\n // label: i18n.t('fields:blockType'),\n // type: 'text',\n // },\n ]\n\n if (versionRow?.blockType === comparisonRow?.blockType) {\n const matchedBlock = ('blocks' in field &&\n field.blocks?.find((block) => block.slug === versionRow?.blockType)) || {\n fields: [],\n }\n\n fields = [...fields, ...matchedBlock.fields]\n } else {\n const matchedVersionBlock = ('blocks' in field &&\n field.blocks?.find((block) => block.slug === versionRow?.blockType)) || {\n fields: [],\n }\n\n const matchedComparisonBlock = ('blocks' in field &&\n field.blocks?.find((block) => block.slug === comparisonRow?.blockType)) || {\n fields: [],\n }\n\n fields = getUniqueListBy<ClientField>(\n [...fields, ...matchedVersionBlock.fields, ...matchedComparisonBlock.fields],\n 'name',\n )\n }\n }\n\n return (\n <div className={`${baseClass}__wrap`} key={i}>\n <RenderFieldsToDiff\n comparison={comparisonRow}\n diffComponents={diffComponents}\n fieldPermissions={fieldPermissions}\n fields={fields}\n i18n={i18n}\n locales={locales}\n version={versionRow}\n />\n </div>\n )\n })}\n </React.Fragment>\n )}\n {maxRows === 0 && (\n <div className={`${baseClass}__no-rows`}>\n {i18n.t('version:noRowsFound', {\n label:\n 'labels' in field && field.labels?.plural\n ? getTranslation(field.labels.plural, i18n)\n : i18n.t('general:rows'),\n })}\n </div>\n )}\n </div>\n )\n}\n\nexport default Iterable\n"],"mappings":"AAAA;;;AAGA,SAASA,cAAc,QAAQ;AAC/B,SAASC,eAAe,QAAQ;AAChC,OAAOC,KAAA,MAAW;AAIlB,OAAOC,kBAAA,MAAwB;AAC/B,OAAOC,KAAA,MAAW;AAGlB,MAAMC,SAAA,GAAY;AAElB,MAAMC,QAAA,GAAyCA,CAAC;EAC9CC,UAAU;EACVC,cAAc;EACdC,KAAK;EACLC,gBAAgB;EAChBC,IAAI;EACJC,MAAM;EACNC,OAAO;EACPC;AAAO,CACR;EACC,MAAMC,eAAA,GAAkBC,KAAA,CAAMC,OAAO,CAACH,OAAA,IAAWA,OAAA,CAAQI,MAAM,GAAG;EAClE,MAAMC,kBAAA,GAAqBH,KAAA,CAAMC,OAAO,CAACV,UAAA,IAAcA,UAAA,CAAWW,MAAM,GAAG;EAC3E,MAAME,OAAA,GAAUC,IAAA,CAAKC,GAAG,CAACP,eAAA,EAAiBI,kBAAA;EAE1C,oBACEI,KAAA,CAAC;IAAIC,SAAA,EAAWnB,SAAA;eACb,WAAWI,KAAA,IAASA,KAAA,CAAMgB,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KAAe;cACxEF,MAAA,EAAQ;YACV;YAEA,MAAMS,sBAAA,GAAyB,QAAC,IAAYnC,KAAA,IAC1CA,KAAA,CAAM8B,MAAM,EAAEC,IAAA,CAAMC,KAAA,IAAUA,KAAA,CAAMC,IAAI,KAAKR,aAAA,EAAeG,SAAA,KAAe;cAC3EF,MAAA,EAAQ;YACV;YAEAA,MAAA,GAASlC,eAAA,CACP,C,GAAIkC,MAAA,E,GAAWQ,mBAAA,CAAoBR,MAAM,E,GAAKS,sBAAA,CAAuBT,MAAM,CAAC,EAC5E;UAEJ;QACF;QAEA,oBACET,IAAA,CAAC;UAAIF,SAAA,EAAW,GAAGnB,SAAA,QAAiB;oBAClC,aAAAqB,IAAA,CAACvB,kBAAA;YACCI,UAAA,EAAY2B,aAAA;YACZ1B,cAAA,EAAgBA,cAAA;YAChBE,gBAAA,EAAkBA,gBAAA;YAClByB,MAAA,EAAQA,MAAA;YACRxB,IAAA,EAAMA,IAAA;YACNE,OAAA,EAASA,OAAA;YACTC,OAAA,EAASmB;;WAR8BD,CAAA;MAY/C;QAGHZ,OAAA,KAAY,kBACXM,IAAA,CAAC;MAAIF,SAAA,EAAW,GAAGnB,SAAA,WAAoB;gBACpCM,IAAA,CAAKkC,CAAC,CAAC,uBAAuB;QAC7BpB,KAAA,EACE,YAAYhB,KAAA,IAASA,KAAA,CAAMqC,MAAM,EAAEC,MAAA,GAC/B/C,cAAA,CAAeS,KAAA,CAAMqC,MAAM,CAACC,MAAM,EAAEpC,IAAA,IACpCA,IAAA,CAAKkC,CAAC,CAAC;MACf;;;AAKV;AAEA,eAAevC,QAAA","ignoreList":[]}
|
|
@@ -11,11 +11,11 @@ const Nested = ({
|
|
|
11
11
|
diffComponents,
|
|
12
12
|
disableGutter = false,
|
|
13
13
|
field,
|
|
14
|
+
fieldPermissions,
|
|
14
15
|
fields,
|
|
15
16
|
i18n,
|
|
16
17
|
locale,
|
|
17
18
|
locales,
|
|
18
|
-
permissions,
|
|
19
19
|
version
|
|
20
20
|
}) => {
|
|
21
21
|
return /*#__PURE__*/_jsxs("div", {
|
|
@@ -30,7 +30,7 @@ const Nested = ({
|
|
|
30
30
|
children: /*#__PURE__*/_jsx(RenderFieldsToDiff, {
|
|
31
31
|
comparison: comparison,
|
|
32
32
|
diffComponents: diffComponents,
|
|
33
|
-
fieldPermissions:
|
|
33
|
+
fieldPermissions: fieldPermissions,
|
|
34
34
|
fields: fields,
|
|
35
35
|
i18n: i18n,
|
|
36
36
|
locales: locales,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getTranslation","React","RenderFieldsToDiff","Label","baseClass","Nested","comparison","diffComponents","disableGutter","field","fields","i18n","locale","locales","
|
|
1
|
+
{"version":3,"file":"index.js","names":["getTranslation","React","RenderFieldsToDiff","Label","baseClass","Nested","comparison","diffComponents","disableGutter","field","fieldPermissions","fields","i18n","locale","locales","version","_jsxs","className","label","_jsx","filter","Boolean","join"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Nested/index.tsx"],"sourcesContent":["'use client'\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport type { DiffComponentProps } from '../types.js'\n\nimport RenderFieldsToDiff from '../../index.js'\nimport Label from '../../Label/index.js'\nimport './index.scss'\n\nconst baseClass = 'nested-diff'\n\nconst Nested: React.FC<DiffComponentProps> = ({\n comparison,\n diffComponents,\n disableGutter = false,\n field,\n fieldPermissions,\n fields,\n i18n,\n locale,\n locales,\n version,\n}) => {\n return (\n <div className={baseClass}>\n {'label' in field && field.label && typeof field.label !== 'function' && (\n <Label>\n {locale && <span className={`${baseClass}__locale-label`}>{locale}</span>}\n {getTranslation(field.label, i18n)}\n </Label>\n )}\n <div\n className={[`${baseClass}__wrap`, !disableGutter && `${baseClass}__wrap--gutter`]\n .filter(Boolean)\n .join(' ')}\n >\n <RenderFieldsToDiff\n comparison={comparison}\n diffComponents={diffComponents}\n fieldPermissions={fieldPermissions}\n fields={fields}\n i18n={i18n}\n locales={locales}\n version={version}\n />\n </div>\n </div>\n )\n}\n\nexport default Nested\n"],"mappings":"AAAA;;;AACA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAIlB,OAAOC,kBAAA,MAAwB;AAC/B,OAAOC,KAAA,MAAW;AAGlB,MAAMC,SAAA,GAAY;AAElB,MAAMC,MAAA,GAAuCA,CAAC;EAC5CC,UAAU;EACVC,cAAc;EACdC,aAAA,GAAgB,KAAK;EACrBC,KAAK;EACLC,gBAAgB;EAChBC,MAAM;EACNC,IAAI;EACJC,MAAM;EACNC,OAAO;EACPC;AAAO,CACR;EACC,oBACEC,KAAA,CAAC;IAAIC,SAAA,EAAWb,SAAA;eACb,WAAWK,KAAA,IAASA,KAAA,CAAMS,KAAK,IAAI,OAAOT,KAAA,CAAMS,KAAK,KAAK,2BACzDF,KAAA,CAACb,KAAA;iBACEU,MAAA,iBAAUM,IAAA,CAAC;QAAKF,SAAA,EAAW,GAAGb,SAAA,gBAAyB;kBAAGS;UAC1Db,cAAA,CAAeS,KAAA,CAAMS,KAAK,EAAEN,IAAA;qBAGjCO,IAAA,CAAC;MACCF,SAAA,EAAW,CAAC,GAAGb,SAAA,QAAiB,EAAE,CAACI,aAAA,IAAiB,GAAGJ,SAAA,gBAAyB,CAAC,CAC9EgB,MAAM,CAACC,OAAA,EACPC,IAAI,CAAC;gBAER,aAAAH,IAAA,CAACjB,kBAAA;QACCI,UAAA,EAAYA,UAAA;QACZC,cAAA,EAAgBA,cAAA;QAChBG,gBAAA,EAAkBA,gBAAA;QAClBC,MAAA,EAAQA,MAAA;QACRC,IAAA,EAAMA,IAAA;QACNE,OAAA,EAASA,OAAA;QACTC,OAAA,EAASA;;;;AAKnB;AAEA,eAAeV,MAAA","ignoreList":[]}
|
|
@@ -9,10 +9,10 @@ const Tabs = ({
|
|
|
9
9
|
comparison,
|
|
10
10
|
diffComponents,
|
|
11
11
|
field,
|
|
12
|
+
fieldPermissions,
|
|
12
13
|
i18n,
|
|
13
14
|
locale,
|
|
14
15
|
locales,
|
|
15
|
-
permissions,
|
|
16
16
|
version
|
|
17
17
|
}) => {
|
|
18
18
|
return /*#__PURE__*/_jsx("div", {
|
|
@@ -25,18 +25,18 @@ const Tabs = ({
|
|
|
25
25
|
comparison: comparison?.[tab.name],
|
|
26
26
|
diffComponents: diffComponents,
|
|
27
27
|
field: field,
|
|
28
|
+
fieldPermissions: fieldPermissions,
|
|
28
29
|
fields: tab.fields,
|
|
29
30
|
i18n: i18n,
|
|
30
31
|
locale: locale,
|
|
31
32
|
locales: locales,
|
|
32
|
-
permissions: permissions,
|
|
33
33
|
version: version?.[tab.name]
|
|
34
34
|
}, i);
|
|
35
35
|
}
|
|
36
36
|
return /*#__PURE__*/_jsx(RenderFieldsToDiff, {
|
|
37
37
|
comparison: comparison,
|
|
38
38
|
diffComponents: diffComponents,
|
|
39
|
-
fieldPermissions:
|
|
39
|
+
fieldPermissions: fieldPermissions,
|
|
40
40
|
fields: tab.fields,
|
|
41
41
|
i18n: i18n,
|
|
42
42
|
locales: locales,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","RenderFieldsToDiff","Nested","baseClass","Tabs","comparison","diffComponents","field","i18n","locale","locales","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","RenderFieldsToDiff","Nested","baseClass","Tabs","comparison","diffComponents","field","fieldPermissions","i18n","locale","locales","version","_jsx","className","tabs","map","tab","i","name","fields"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Tabs/index.tsx"],"sourcesContent":["'use client'\nimport type { TabsFieldClient } from 'payload'\n\nimport React from 'react'\n\nimport type { DiffComponentProps } from '../types.js'\n\nimport RenderFieldsToDiff from '../../index.js'\nimport Nested from '../Nested/index.js'\n\nconst baseClass = 'tabs-diff'\n\nconst Tabs: React.FC<DiffComponentProps<TabsFieldClient>> = ({\n comparison,\n diffComponents,\n field,\n fieldPermissions,\n i18n,\n locale,\n locales,\n version,\n}) => {\n return (\n <div className={baseClass}>\n <div className={`${baseClass}__wrap`}>\n {field.tabs.map((tab, i) => {\n if ('name' in tab) {\n return (\n <Nested\n comparison={comparison?.[tab.name]}\n diffComponents={diffComponents}\n field={field}\n fieldPermissions={fieldPermissions}\n fields={tab.fields}\n i18n={i18n}\n key={i}\n locale={locale}\n locales={locales}\n version={version?.[tab.name]}\n />\n )\n }\n\n return (\n <RenderFieldsToDiff\n comparison={comparison}\n diffComponents={diffComponents}\n fieldPermissions={fieldPermissions}\n fields={tab.fields}\n i18n={i18n}\n key={i}\n locales={locales}\n version={version}\n />\n )\n })}\n </div>\n </div>\n )\n}\n\nexport default Tabs\n"],"mappings":"AAAA;;;AAGA,OAAOA,KAAA,MAAW;AAIlB,OAAOC,kBAAA,MAAwB;AAC/B,OAAOC,MAAA,MAAY;AAEnB,MAAMC,SAAA,GAAY;AAElB,MAAMC,IAAA,GAAsDA,CAAC;EAC3DC,UAAU;EACVC,cAAc;EACdC,KAAK;EACLC,gBAAgB;EAChBC,IAAI;EACJC,MAAM;EACNC,OAAO;EACPC;AAAO,CACR;EACC,oBACEC,IAAA,CAAC;IAAIC,SAAA,EAAWX,SAAA;cACd,aAAAU,IAAA,CAAC;MAAIC,SAAA,EAAW,GAAGX,SAAA,QAAiB;gBACjCI,KAAA,CAAMQ,IAAI,CAACC,GAAG,CAAC,CAACC,GAAA,EAAKC,CAAA;QACpB,IAAI,UAAUD,GAAA,EAAK;UACjB,oBACEJ,IAAA,CAACX,MAAA;YACCG,UAAA,EAAYA,UAAA,GAAaY,GAAA,CAAIE,IAAI,CAAC;YAClCb,cAAA,EAAgBA,cAAA;YAChBC,KAAA,EAAOA,KAAA;YACPC,gBAAA,EAAkBA,gBAAA;YAClBY,MAAA,EAAQH,GAAA,CAAIG,MAAM;YAClBX,IAAA,EAAMA,IAAA;YAENC,MAAA,EAAQA,MAAA;YACRC,OAAA,EAASA,OAAA;YACTC,OAAA,EAASA,OAAA,GAAUK,GAAA,CAAIE,IAAI;aAHtBD,CAAA;QAMX;QAEA,oBACEL,IAAA,CAACZ,kBAAA;UACCI,UAAA,EAAYA,UAAA;UACZC,cAAA,EAAgBA,cAAA;UAChBE,gBAAA,EAAkBA,gBAAA;UAClBY,MAAA,EAAQH,GAAA,CAAIG,MAAM;UAClBX,IAAA,EAAMA,IAAA;UAENE,OAAA,EAASA,OAAA;UACTC,OAAA,EAASA;WAFJM,CAAA;MAKX;;;AAIR;AAEA,eAAed,IAAA","ignoreList":[]}
|
|
@@ -9,14 +9,14 @@ export type DiffComponentProps<TField extends ClientField = ClientField> = {
|
|
|
9
9
|
readonly diffMethod?: DiffMethod;
|
|
10
10
|
readonly disableGutter?: boolean;
|
|
11
11
|
readonly field: TField;
|
|
12
|
+
readonly fieldPermissions?: {
|
|
13
|
+
[key: string]: SanitizedFieldPermissions;
|
|
14
|
+
} | true;
|
|
12
15
|
readonly fields: ClientField[];
|
|
13
16
|
readonly i18n: I18nClient;
|
|
14
17
|
readonly isRichText?: boolean;
|
|
15
18
|
readonly locale?: string;
|
|
16
19
|
readonly locales?: string[];
|
|
17
|
-
readonly permissions?: {
|
|
18
|
-
[key: string]: SanitizedFieldPermissions;
|
|
19
|
-
} | true;
|
|
20
20
|
readonly version: any;
|
|
21
21
|
};
|
|
22
22
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/views/Version/RenderFieldsToDiff/fields/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AACrE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAE7D,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,E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,UAAU,CAAA;IAChC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAA;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,gBAAgB,CAAC,EACtB;QACE,CAAC,GAAG,EAAE,MAAM,GAAG,yBAAyB,CAAA;KACzC,GACD,IAAI,CAAA;IACR,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,CAAA;IAC9B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAA;CACtB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/views/Version/RenderFieldsToDiff/fields/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { ClientField, SanitizedFieldPermissions } from 'payload'\nimport type React from 'react'\nimport type { DiffMethod } from 'react-diff-viewer-continued'\n\nexport type DiffComponents = Record<string, React.FC<DiffComponentProps>>\n\nexport type DiffComponentProps<TField extends ClientField = ClientField> = {\n readonly comparison: any\n readonly diffComponents: DiffComponents\n readonly diffMethod?: DiffMethod\n readonly disableGutter?: boolean\n readonly field: TField\n readonly fields: ClientField[]\n readonly i18n: I18nClient\n readonly isRichText?: boolean\n readonly locale?: string\n readonly locales?: string[]\n readonly
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/views/Version/RenderFieldsToDiff/fields/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { ClientField, SanitizedFieldPermissions } from 'payload'\nimport type React from 'react'\nimport type { DiffMethod } from 'react-diff-viewer-continued'\n\nexport type DiffComponents = Record<string, React.FC<DiffComponentProps>>\n\nexport type DiffComponentProps<TField extends ClientField = ClientField> = {\n readonly comparison: any\n readonly diffComponents: DiffComponents\n readonly diffMethod?: DiffMethod\n readonly disableGutter?: boolean\n readonly field: TField\n readonly fieldPermissions?:\n | {\n [key: string]: SanitizedFieldPermissions\n }\n | true\n readonly fields: ClientField[]\n readonly i18n: I18nClient\n readonly isRichText?: boolean\n readonly locale?: string\n readonly locales?: string[]\n readonly version: any\n}\n"],"mappings":"AAOA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Version/RenderFieldsToDiff/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAkB,KAAK,EAAE,MAAM,YAAY,CAAA;AAIvD,OAAO,cAAc,CAAA;AAIrB,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Version/RenderFieldsToDiff/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAkB,KAAK,EAAE,MAAM,YAAY,CAAA;AAIvD,OAAO,cAAc,CAAA;AAIrB,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA0IvC,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -34,7 +34,7 @@ const RenderFieldsToDiff = ({
|
|
|
34
34
|
const versionValue = valueIsObject ? JSON.stringify(version?.[fieldName]) : version?.[fieldName];
|
|
35
35
|
const comparisonValue = valueIsObject ? JSON.stringify(comparison?.[fieldName]) : comparison?.[fieldName];
|
|
36
36
|
const hasPermission = fieldPermissions === true || fieldPermissions?.[fieldName] === true || fieldPermissions?.[fieldName]?.read;
|
|
37
|
-
const subFieldPermissions = fieldPermissions?.[fieldName] === true || fieldPermissions?.[fieldName]?.fields;
|
|
37
|
+
const subFieldPermissions = fieldPermissions === true || fieldPermissions?.[fieldName] === true || fieldPermissions?.[fieldName]?.fields;
|
|
38
38
|
if (!hasPermission) {
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
@@ -87,6 +87,7 @@ const RenderFieldsToDiff = ({
|
|
|
87
87
|
comparison: comparison,
|
|
88
88
|
diffComponents: diffComponents,
|
|
89
89
|
field: field,
|
|
90
|
+
fieldPermissions: fieldPermissions,
|
|
90
91
|
fields: [],
|
|
91
92
|
i18n: i18n,
|
|
92
93
|
locales: locales,
|
|
@@ -100,10 +101,10 @@ const RenderFieldsToDiff = ({
|
|
|
100
101
|
diffComponents: diffComponents,
|
|
101
102
|
disableGutter: true,
|
|
102
103
|
field: field,
|
|
104
|
+
fieldPermissions: fieldPermissions,
|
|
103
105
|
fields: field.fields,
|
|
104
106
|
i18n: i18n,
|
|
105
107
|
locales: locales,
|
|
106
|
-
permissions: fieldPermissions,
|
|
107
108
|
version: version
|
|
108
109
|
}, i);
|
|
109
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["fieldAffectsData","React","diffMethods","Nested","baseClass","RenderFieldsToDiff","comparison","diffComponents","__diffComponents","fieldPermissions","fields","i18n","locales","version","_jsx","className","map","field","i","name","Component","type","isRichText","diffMethod","fieldName","valueIsObject","versionValue","JSON","stringify","comparisonValue","hasPermission","read","subFieldPermissions","baseCellProps","localized","locale","index","versionLocaleValue","comparisonLocaleValue","cellProps","join","Tabs","tabs","disableGutter"
|
|
1
|
+
{"version":3,"file":"index.js","names":["fieldAffectsData","React","diffMethods","Nested","baseClass","RenderFieldsToDiff","comparison","diffComponents","__diffComponents","fieldPermissions","fields","i18n","locales","version","_jsx","className","map","field","i","name","Component","type","isRichText","diffMethod","fieldName","valueIsObject","versionValue","JSON","stringify","comparisonValue","hasPermission","read","subFieldPermissions","baseCellProps","localized","locale","index","versionLocaleValue","comparisonLocaleValue","cellProps","join","Tabs","tabs","disableGutter"],"sources":["../../../../src/views/Version/RenderFieldsToDiff/index.tsx"],"sourcesContent":["'use client'\nimport type { DiffMethod } from 'react-diff-viewer-continued'\n\nimport { fieldAffectsData } from 'payload/shared'\nimport React from 'react'\n\nimport type { diffComponents as _diffComponents } from './fields/index.js'\nimport type { FieldDiffProps, Props } from './types.js'\n\nimport { diffMethods } from './fields/diffMethods.js'\nimport Nested from './fields/Nested/index.js'\nimport './index.scss'\n\nconst baseClass = 'render-field-diffs'\n\nconst RenderFieldsToDiff: React.FC<Props> = ({\n comparison,\n diffComponents: __diffComponents,\n fieldPermissions,\n fields,\n i18n,\n locales,\n version,\n}) => {\n // typing it as `as typeof _diffComponents` here ensures the TField generics of DiffComponentProps are respected.\n // Without it, you could pass a UI field to the Tabs component, without it erroring\n const diffComponents: typeof _diffComponents = __diffComponents as typeof _diffComponents\n\n return (\n <div className={baseClass}>\n {fields?.map((field, i) => {\n if ('name' in field && field.name === 'id') {\n return null\n }\n\n const Component = diffComponents[field.type]\n\n const isRichText = field.type === 'richText'\n const diffMethod: DiffMethod = diffMethods[field.type] || 'CHARS'\n\n if (Component) {\n if (fieldAffectsData(field)) {\n const fieldName = field.name\n const valueIsObject = field.type === 'code' || field.type === 'json'\n\n const versionValue = valueIsObject\n ? JSON.stringify(version?.[fieldName])\n : version?.[fieldName]\n\n const comparisonValue = valueIsObject\n ? JSON.stringify(comparison?.[fieldName])\n : comparison?.[fieldName]\n\n const hasPermission =\n fieldPermissions === true ||\n fieldPermissions?.[fieldName] === true ||\n fieldPermissions?.[fieldName]?.read\n\n const subFieldPermissions =\n fieldPermissions === true ||\n fieldPermissions?.[fieldName] === true ||\n fieldPermissions?.[fieldName]?.fields\n\n if (!hasPermission) {\n return null\n }\n\n const baseCellProps: FieldDiffProps = {\n comparison: comparisonValue,\n diffComponents,\n diffMethod,\n field,\n fieldPermissions: subFieldPermissions,\n fields: 'fields' in field ? field?.fields : fields,\n i18n,\n isRichText,\n locales,\n version: versionValue,\n }\n\n if (field.localized) {\n return (\n <div className={`${baseClass}__field`} key={i}>\n {locales.map((locale, index) => {\n const versionLocaleValue = versionValue?.[locale]\n const comparisonLocaleValue = comparisonValue?.[locale]\n\n const cellProps = {\n ...baseCellProps,\n comparison: comparisonLocaleValue,\n version: versionLocaleValue,\n }\n\n return (\n <div className={`${baseClass}__locale`} key={[locale, index].join('-')}>\n <div className={`${baseClass}__locale-value`}>\n <Component {...cellProps} locale={locale} />\n </div>\n </div>\n )\n })}\n </div>\n )\n }\n\n return (\n <div className={`${baseClass}__field`} key={i}>\n <Component {...baseCellProps} />\n </div>\n )\n }\n\n if (field.type === 'tabs' && 'tabs' in field) {\n const Tabs = diffComponents.tabs\n\n return (\n <Tabs\n comparison={comparison}\n diffComponents={diffComponents}\n field={field}\n fieldPermissions={fieldPermissions}\n fields={[]}\n i18n={i18n}\n key={i}\n locales={locales}\n version={version}\n />\n )\n }\n\n // At this point, we are dealing with a `row`, etc\n if ('fields' in field) {\n return (\n <Nested\n comparison={comparison}\n diffComponents={diffComponents}\n disableGutter\n field={field}\n fieldPermissions={fieldPermissions}\n fields={field.fields}\n i18n={i18n}\n key={i}\n locales={locales}\n version={version}\n />\n )\n }\n }\n\n return null\n })}\n </div>\n )\n}\n\nexport default RenderFieldsToDiff\n"],"mappings":"AAAA;;;AAGA,SAASA,gBAAgB,QAAQ;AACjC,OAAOC,KAAA,MAAW;AAKlB,SAASC,WAAW,QAAQ;AAC5B,OAAOC,MAAA,MAAY;AAGnB,MAAMC,SAAA,GAAY;AAElB,MAAMC,kBAAA,GAAsCA,CAAC;EAC3CC,UAAU;EACVC,cAAA,EAAgBC,gBAAgB;EAChCC,gBAAgB;EAChBC,MAAM;EACNC,IAAI;EACJC,OAAO;EACPC;AAAO,CACR;EACC;EACA;EACA,MAAMN,cAAA,GAAyCC,gBAAA;EAE/C,oBACEM,IAAA,CAAC;IAAIC,SAAA,EAAWX,SAAA;cACbM,MAAA,EAAQM,GAAA,CAAI,CAAC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AASA,OAAA;YACTC,OAAA,EAASA;aAFJK,CAAA;QAKX;QAEA;QACA,IAAI,YAAYD,KAAA,EAAO;UACrB,oBACEH,IAAA,CAACX,MAAA;YACCG,UAAA,EAAYA,UAAA;YACZC,cAAA,EAAgBA,cAAA;YAChBoC,aAAa;YACb1B,KAAA,EAAOA,KAAA;YACPR,gBAAA,EAAkBA,gBAAA;YAClBC,MAAA,EAAQO,KAAA,CAAMP,MAAM;YACpBC,IAAA,EAAMA,IAAA;YAENC,OAAA,EAASA,OAAA;YACTC,OAAA,EAASA;aAFJK,CAAA;QAKX;MACF;MAEA,OAAO;IACT;;AAGN;AAEA,eAAeb,kBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/next",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"sass": "1.77.4",
|
|
80
80
|
"sonner": "^1.5.0",
|
|
81
81
|
"uuid": "10.0.0",
|
|
82
|
-
"@payloadcms/
|
|
83
|
-
"@payloadcms/
|
|
84
|
-
"@payloadcms/
|
|
82
|
+
"@payloadcms/graphql": "3.2.0",
|
|
83
|
+
"@payloadcms/translations": "3.2.0",
|
|
84
|
+
"@payloadcms/ui": "3.2.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@babel/cli": "^7.24.5",
|
|
@@ -100,12 +100,12 @@
|
|
|
100
100
|
"eslint-plugin-react-compiler": "19.0.0-beta-a7bf2bd-20241110",
|
|
101
101
|
"swc-plugin-transform-remove-imports": "1.15.0",
|
|
102
102
|
"@payloadcms/eslint-config": "3.0.0",
|
|
103
|
-
"payload": "3.
|
|
103
|
+
"payload": "3.2.0"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"graphql": "^16.8.1",
|
|
107
107
|
"next": "^15.0.0",
|
|
108
|
-
"payload": "3.
|
|
108
|
+
"payload": "3.2.0"
|
|
109
109
|
},
|
|
110
110
|
"engines": {
|
|
111
111
|
"node": "^18.20.2 || >=20.9.0"
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { I18nClient } from '@payloadcms/translations';
|
|
2
|
-
import type { ClientConfig, ImportMap, SanitizedConfig } from 'payload';
|
|
3
|
-
export declare const getClientConfig: (args: {
|
|
4
|
-
config: SanitizedConfig;
|
|
5
|
-
i18n: I18nClient;
|
|
6
|
-
importMap: ImportMap;
|
|
7
|
-
}) => Promise<ClientConfig>;
|
|
8
|
-
//# sourceMappingURL=getClientConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getClientConfig.d.ts","sourceRoot":"","sources":["../../src/utilities/getClientConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAKvE,eAAO,MAAM,eAAe,SACb;IACX,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;CACrB,KAAG,OAAO,CAAC,YAAY,CAWzB,CAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createClientConfig } from 'payload';
|
|
2
|
-
import { cache } from 'react';
|
|
3
|
-
export const getClientConfig = cache(async args => {
|
|
4
|
-
const {
|
|
5
|
-
config,
|
|
6
|
-
i18n,
|
|
7
|
-
importMap
|
|
8
|
-
} = args;
|
|
9
|
-
const clientConfig = createClientConfig({
|
|
10
|
-
config,
|
|
11
|
-
i18n,
|
|
12
|
-
importMap
|
|
13
|
-
});
|
|
14
|
-
return Promise.resolve(clientConfig);
|
|
15
|
-
});
|
|
16
|
-
//# sourceMappingURL=getClientConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getClientConfig.js","names":["createClientConfig","cache","getClientConfig","args","config","i18n","importMap","clientConfig","Promise","resolve"],"sources":["../../src/utilities/getClientConfig.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { ClientConfig, ImportMap, SanitizedConfig } from 'payload'\n\nimport { createClientConfig } from 'payload'\nimport { cache } from 'react'\n\nexport const getClientConfig = cache(\n async (args: {\n config: SanitizedConfig\n i18n: I18nClient\n importMap: ImportMap\n }): Promise<ClientConfig> => {\n const { config, i18n, importMap } = args\n\n const clientConfig = createClientConfig({\n config,\n i18n,\n importMap,\n })\n\n return Promise.resolve(clientConfig)\n },\n)\n"],"mappings":"AAGA,SAASA,kBAAkB,QAAQ;AACnC,SAASC,KAAK,QAAQ;AAEtB,OAAO,MAAMC,eAAA,GAAkBD,KAAA,CAC7B,MAAOE,IAAA;EAKL,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC;EAAS,CAAE,GAAGH,IAAA;EAEpC,MAAMI,YAAA,GAAeP,kBAAA,CAAmB;IACtCI,MAAA;IACAC,IAAA;IACAC;EACF;EAEA,OAAOE,OAAA,CAAQC,OAAO,CAACF,YAAA;AACzB","ignoreList":[]}
|