@payloadcms/next 3.0.0-beta.113 → 3.0.0-beta.115

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.
Files changed (28) hide show
  1. package/dist/elements/DocumentHeader/Tabs/Tab/index.scss +70 -68
  2. package/dist/elements/DocumentHeader/Tabs/index.scss +41 -39
  3. package/dist/elements/DocumentHeader/index.scss +44 -42
  4. package/dist/elements/DocumentLocked/index.scss +28 -26
  5. package/dist/elements/DocumentTakeOver/index.scss +28 -26
  6. package/dist/elements/FormHeader/index.scss +7 -5
  7. package/dist/elements/LeaveWithoutSaving/index.scss +28 -26
  8. package/dist/elements/Nav/NavWrapper/index.scss +20 -18
  9. package/dist/elements/Nav/index.scss +127 -125
  10. package/dist/prod/styles.css +1 -1
  11. package/dist/routes/rest/collections/update.d.ts.map +1 -1
  12. package/dist/routes/rest/collections/update.js +2 -0
  13. package/dist/routes/rest/collections/update.js.map +1 -1
  14. package/dist/templates/Default/Wrapper/index.scss +38 -36
  15. package/dist/templates/Default/index.scss +60 -58
  16. package/dist/templates/Minimal/index.scss +22 -20
  17. package/dist/utilities/initPage/handleAdminPage.d.ts +4 -3
  18. package/dist/utilities/initPage/handleAdminPage.d.ts.map +1 -1
  19. package/dist/utilities/initPage/handleAdminPage.js +2 -1
  20. package/dist/utilities/initPage/handleAdminPage.js.map +1 -1
  21. package/dist/utilities/initPage/index.d.ts.map +1 -1
  22. package/dist/utilities/initPage/index.js +1 -0
  23. package/dist/utilities/initPage/index.js.map +1 -1
  24. package/dist/views/API/RenderJSON/index.scss +68 -66
  25. package/dist/views/Account/index.js +1 -1
  26. package/dist/views/Account/index.js.map +1 -1
  27. package/dist/views/Versions/index.js.map +1 -1
  28. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/update.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,MAAM,EAAE,sBA2DpB,CAAA"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/update.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,MAAM,EAAE,sBA6DpB,CAAA"}
@@ -10,6 +10,7 @@ export const update = async ({
10
10
  const {
11
11
  depth,
12
12
  draft,
13
+ limit,
13
14
  where
14
15
  } = req.query;
15
16
  const result = await updateOperation({
@@ -17,6 +18,7 @@ export const update = async ({
17
18
  data: req.data,
18
19
  depth: isNumber(depth) ? Number(depth) : undefined,
19
20
  draft: draft === 'true',
21
+ limit: isNumber(limit) ? Number(limit) : undefined,
20
22
  req,
21
23
  where
22
24
  });
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","names":["getTranslation","httpStatus","updateOperation","isNumber","headersWithCors","update","collection","req","depth","draft","where","query","result","data","Number","undefined","headers","Headers","errors","length","message","t","count","docs","label","config","labels","i18n","Response","json","status","OK","total","BAD_REQUEST"],"sources":["../../../../src/routes/rest/collections/update.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { updateOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const update: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, where } = req.query as {\n depth?: string\n draft?: string\n where?: Where\n }\n\n const result = await updateOperation({\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true',\n req,\n where,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (result.errors.length === 0) {\n const message = req.t('general:updatedCountSuccessfully', {\n count: result.docs.length,\n label: getTranslation(\n collection.config.labels[result.docs.length > 1 ? 'plural' : 'singular'],\n req.i18n,\n ),\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n }\n\n const total = result.docs.length + result.errors.length\n const message = req.t('error:unableToUpdateCount', {\n count: result.errors.length,\n label: getTranslation(collection.config.labels[total > 1 ? 'plural' : 'singular'], req.i18n),\n total,\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;AACvB,SAASC,eAAe,QAAQ;AAChC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,MAAA,GAAiC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACtE,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC;EAAK,CAAE,GAAGH,GAAA,CAAII,KAAK;EAMzC,MAAMC,MAAA,GAAS,MAAMV,eAAA,CAAgB;IACnCI,UAAA;IACAO,IAAA,EAAMN,GAAA,CAAIM,IAAI;IACdL,KAAA,EAAOL,QAAA,CAASK,KAAA,IAASM,MAAA,CAAON,KAAA,IAASO,SAAA;IACzCN,KAAA,EAAOA,KAAA,KAAU;IACjBF,GAAA;IACAG;EACF;EAEA,MAAMM,OAAA,GAAUZ,eAAA,CAAgB;IAC9BY,OAAA,EAAS,IAAIC,OAAA;IACbV;EACF;EAEA,IAAIK,MAAA,CAAOM,MAAM,CAACC,MAAM,KAAK,GAAG;IAC9B,MAAMC,OAAA,GAAUb,GAAA,CAAIc,CAAC,CAAC,oCAAoC;MACxDC,KAAA,EAAOV,MAAA,CAAOW,IAAI,CAACJ,MAAM;MACzBK,KAAA,EAAOxB,cAAA,CACLM,UAAA,CAAWmB,MAAM,CAACC,MAAM,CAACd,MAAA,CAAOW,IAAI,CAACJ,MAAM,GAAG,IAAI,WAAW,WAAW,EACxEZ,GAAA,CAAIoB,IAAI;IAEZ;IAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;MACE,GAAGjB,MAAM;MACTQ;IACF,GACA;MACEJ,OAAA;MACAc,MAAA,EAAQ7B,UAAA,CAAW8B;IACrB;EAEJ;EAEA,MAAMC,KAAA,GAAQpB,MAAA,CAAOW,IAAI,CAACJ,MAAM,GAAGP,MAAA,CAAOM,MAAM,CAACC,MAAM;EACvD,MAAMC,OAAA,GAAUb,GAAA,CAAIc,CAAC,CAAC,6BAA6B;IACjDC,KAAA,EAAOV,MAAA,CAAOM,MAAM,CAACC,MAAM;IAC3BK,KAAA,EAAOxB,cAAA,CAAeM,UAAA,CAAWmB,MAAM,CAACC,MAAM,CAACM,KAAA,GAAQ,IAAI,WAAW,WAAW,EAAEzB,GAAA,CAAIoB,IAAI;IAC3FK;EACF;EAEA,OAAOJ,QAAA,CAASC,IAAI,CAClB;IACE,GAAGjB,MAAM;IACTQ;EACF,GACA;IACEJ,OAAA;IACAc,MAAA,EAAQ7B,UAAA,CAAWgC;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"update.js","names":["getTranslation","httpStatus","updateOperation","isNumber","headersWithCors","update","collection","req","depth","draft","limit","where","query","result","data","Number","undefined","headers","Headers","errors","length","message","t","count","docs","label","config","labels","i18n","Response","json","status","OK","total","BAD_REQUEST"],"sources":["../../../../src/routes/rest/collections/update.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { updateOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const update: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, limit, where } = req.query as {\n depth?: string\n draft?: string\n limit?: string\n where?: Where\n }\n\n const result = await updateOperation({\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true',\n limit: isNumber(limit) ? Number(limit) : undefined,\n req,\n where,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (result.errors.length === 0) {\n const message = req.t('general:updatedCountSuccessfully', {\n count: result.docs.length,\n label: getTranslation(\n collection.config.labels[result.docs.length > 1 ? 'plural' : 'singular'],\n req.i18n,\n ),\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n }\n\n const total = result.docs.length + result.errors.length\n const message = req.t('error:unableToUpdateCount', {\n count: result.errors.length,\n label: getTranslation(collection.config.labels[total > 1 ? 'plural' : 'singular'], req.i18n),\n total,\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;AACvB,SAASC,eAAe,QAAQ;AAChC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,MAAA,GAAiC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACtE,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC;EAAK,CAAE,GAAGJ,GAAA,CAAIK,KAAK;EAOhD,MAAMC,MAAA,GAAS,MAAMX,eAAA,CAAgB;IACnCI,UAAA;IACAQ,IAAA,EAAMP,GAAA,CAAIO,IAAI;IACdN,KAAA,EAAOL,QAAA,CAASK,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCP,KAAA,EAAOA,KAAA,KAAU;IACjBC,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASK,MAAA,CAAOL,KAAA,IAASM,SAAA;IACzCT,GAAA;IACAI;EACF;EAEA,MAAMM,OAAA,GAAUb,eAAA,CAAgB;IAC9Ba,OAAA,EAAS,IAAIC,OAAA;IACbX;EACF;EAEA,IAAIM,MAAA,CAAOM,MAAM,CAACC,MAAM,KAAK,GAAG;IAC9B,MAAMC,OAAA,GAAUd,GAAA,CAAIe,CAAC,CAAC,oCAAoC;MACxDC,KAAA,EAAOV,MAAA,CAAOW,IAAI,CAACJ,MAAM;MACzBK,KAAA,EAAOzB,cAAA,CACLM,UAAA,CAAWoB,MAAM,CAACC,MAAM,CAACd,MAAA,CAAOW,IAAI,CAACJ,MAAM,GAAG,IAAI,WAAW,WAAW,EACxEb,GAAA,CAAIqB,IAAI;IAEZ;IAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;MACE,GAAGjB,MAAM;MACTQ;IACF,GACA;MACEJ,OAAA;MACAc,MAAA,EAAQ9B,UAAA,CAAW+B;IACrB;EAEJ;EAEA,MAAMC,KAAA,GAAQpB,MAAA,CAAOW,IAAI,CAACJ,MAAM,GAAGP,MAAA,CAAOM,MAAM,CAACC,MAAM;EACvD,MAAMC,OAAA,GAAUd,GAAA,CAAIe,CAAC,CAAC,6BAA6B;IACjDC,KAAA,EAAOV,MAAA,CAAOM,MAAM,CAACC,MAAM;IAC3BK,KAAA,EAAOzB,cAAA,CAAeM,UAAA,CAAWoB,MAAM,CAACC,MAAM,CAACM,KAAA,GAAQ,IAAI,WAAW,WAAW,EAAE1B,GAAA,CAAIqB,IAAI;IAC3FK;EACF;EAEA,OAAOJ,QAAA,CAASC,IAAI,CAClB;IACE,GAAGjB,MAAM;IACTQ;EACF,GACA;IACEJ,OAAA;IACAc,MAAA,EAAQ9B,UAAA,CAAWiC;EACrB;AAEJ","ignoreList":[]}
@@ -1,55 +1,57 @@
1
1
  @import '../../../scss/styles.scss';
2
2
 
3
- .template-default {
4
- min-height: 100vh;
5
- display: grid;
6
- position: relative;
7
- isolation: isolate;
8
-
9
- @media (prefers-reduced-motion) {
10
- transition: none;
11
- }
12
-
13
- &--nav-animate {
14
- transition: grid-template-columns var(--nav-trans-time) linear;
15
- }
3
+ @layer payload-default {
4
+ .template-default {
5
+ min-height: 100vh;
6
+ display: grid;
7
+ position: relative;
8
+ isolation: isolate;
16
9
 
17
- &--nav-open {
18
- .template-default {
19
- &__nav-overlay {
20
- transition: opacity var(--nav-trans-time) linear;
21
- }
10
+ @media (prefers-reduced-motion) {
11
+ transition: none;
22
12
  }
23
- }
24
- }
25
13
 
26
- @media (min-width: 1441px) {
27
- .template-default {
28
- grid-template-columns: 0 auto;
14
+ &--nav-animate {
15
+ transition: grid-template-columns var(--nav-trans-time) linear;
16
+ }
29
17
 
30
18
  &--nav-open {
31
- grid-template-columns: var(--nav-width) auto;
19
+ .template-default {
20
+ &__nav-overlay {
21
+ transition: opacity var(--nav-trans-time) linear;
22
+ }
23
+ }
32
24
  }
33
25
  }
34
- }
35
26
 
36
- @media (max-width: 1440px) {
37
- .template-default--nav-hydrated.template-default--nav-open {
38
- grid-template-columns: var(--nav-width) auto;
39
- }
27
+ @media (min-width: 1441px) {
28
+ .template-default {
29
+ grid-template-columns: 0 auto;
40
30
 
41
- .template-default {
42
- grid-template-columns: 1fr auto;
31
+ &--nav-open {
32
+ grid-template-columns: var(--nav-width) auto;
33
+ }
34
+ }
35
+ }
43
36
 
44
- .nav {
45
- display: none;
37
+ @media (max-width: 1440px) {
38
+ .template-default--nav-hydrated.template-default--nav-open {
39
+ grid-template-columns: var(--nav-width) auto;
46
40
  }
47
41
 
48
- &--nav-hydrated {
49
- grid-template-columns: 0 auto;
42
+ .template-default {
43
+ grid-template-columns: 1fr auto;
50
44
 
51
45
  .nav {
52
- display: unset;
46
+ display: none;
47
+ }
48
+
49
+ &--nav-hydrated {
50
+ grid-template-columns: 0 auto;
51
+
52
+ .nav {
53
+ display: unset;
54
+ }
53
55
  }
54
56
  }
55
57
  }
@@ -1,76 +1,78 @@
1
1
  @import '../../scss/styles.scss';
2
2
 
3
- .template-default {
4
- background-color: var(--theme-bg);
5
- color: var(--theme-text);
3
+ @layer payload-default {
4
+ .template-default {
5
+ background-color: var(--theme-bg);
6
+ color: var(--theme-text);
6
7
 
7
- [dir='rtl'] &__nav-toggler-wrapper {
8
- left: unset;
9
- right: 0;
10
- }
8
+ [dir='rtl'] &__nav-toggler-wrapper {
9
+ left: unset;
10
+ right: 0;
11
+ }
11
12
 
12
- &__nav-toggler-wrapper {
13
- position: sticky;
14
- z-index: var(--z-modal);
15
- top: 0;
16
- left: 0;
17
- height: 0;
18
- width: var(--gutter-h);
19
- display: flex;
20
- justify-content: center;
21
- }
13
+ &__nav-toggler-wrapper {
14
+ position: sticky;
15
+ z-index: var(--z-modal);
16
+ top: 0;
17
+ left: 0;
18
+ height: 0;
19
+ width: var(--gutter-h);
20
+ display: flex;
21
+ justify-content: center;
22
+ }
22
23
 
23
- &__nav-toggler-container {
24
- height: var(--app-header-height);
25
- display: flex;
26
- align-items: center;
27
- }
24
+ &__nav-toggler-container {
25
+ height: var(--app-header-height);
26
+ display: flex;
27
+ align-items: center;
28
+ }
28
29
 
29
- &__nav-toggler {
30
- display: flex;
31
- align-items: center;
32
- }
30
+ &__nav-toggler {
31
+ display: flex;
32
+ align-items: center;
33
+ }
33
34
 
34
- &__wrap {
35
- min-width: 0;
36
- width: 100%;
37
- flex-grow: 1;
38
- position: relative;
39
- background-color: var(--theme-bg);
40
- &:before {
41
- content: '';
42
- display: block;
43
- position: absolute;
44
- inset: 0;
45
- background-color: inherit;
46
- opacity: 0;
47
- z-index: var(--z-status);
48
- visibility: hidden;
49
- transition: all var(--nav-trans-time) linear;
35
+ &__wrap {
36
+ min-width: 0;
37
+ width: 100%;
38
+ flex-grow: 1;
39
+ position: relative;
40
+ background-color: var(--theme-bg);
41
+ &:before {
42
+ content: '';
43
+ display: block;
44
+ position: absolute;
45
+ inset: 0;
46
+ background-color: inherit;
47
+ opacity: 0;
48
+ z-index: var(--z-status);
49
+ visibility: hidden;
50
+ transition: all var(--nav-trans-time) linear;
51
+ }
50
52
  }
51
- }
52
53
 
53
- @include mid-break {
54
- &__nav-toggler-wrapper {
55
- .hamburger {
56
- left: unset;
54
+ @include mid-break {
55
+ &__nav-toggler-wrapper {
56
+ .hamburger {
57
+ left: unset;
58
+ }
57
59
  }
58
60
  }
59
- }
60
61
 
61
- @include small-break {
62
- &__nav-toggler-wrapper {
63
- width: unset;
64
- justify-content: unset;
62
+ @include small-break {
63
+ &__nav-toggler-wrapper {
64
+ width: unset;
65
+ justify-content: unset;
65
66
 
66
- .hamburger {
67
- display: none;
67
+ .hamburger {
68
+ display: none;
69
+ }
68
70
  }
69
- }
70
71
 
71
- .template-default {
72
- &__wrap {
73
- min-width: 100%;
72
+ .template-default {
73
+ &__wrap {
74
+ min-width: 100%;
75
+ }
74
76
  }
75
77
  }
76
78
  }
@@ -1,28 +1,30 @@
1
1
  @import '../../scss/styles';
2
2
 
3
- .template-minimal {
4
- display: flex;
5
- width: 100%;
6
- justify-content: center;
7
- align-items: center;
8
- padding: base(3) $baseline;
9
- margin-left: auto;
10
- margin-right: auto;
11
- min-height: 100%;
12
- background-color: var(--theme-bg-color);
13
- color: var(--theme-text);
3
+ @layer payload-default {
4
+ .template-minimal {
5
+ display: flex;
6
+ width: 100%;
7
+ justify-content: center;
8
+ align-items: center;
9
+ padding: base(3) $baseline;
10
+ margin-left: auto;
11
+ margin-right: auto;
12
+ min-height: 100%;
13
+ background-color: var(--theme-bg-color);
14
+ color: var(--theme-text);
14
15
 
15
- &--width-normal {
16
- .template-minimal__wrap {
17
- max-width: base(24);
18
- width: 100%;
16
+ &--width-normal {
17
+ .template-minimal__wrap {
18
+ max-width: base(24);
19
+ width: 100%;
20
+ }
19
21
  }
20
- }
21
22
 
22
- &--width-wide {
23
- .template-minimal__wrap {
24
- max-width: base(48);
25
- width: 100%;
23
+ &--width-wide {
24
+ .template-minimal__wrap {
25
+ max-width: base(48);
26
+ width: 100%;
27
+ }
26
28
  }
27
29
  }
28
30
  }
@@ -1,16 +1,17 @@
1
- import type { SanitizedCollectionConfig, SanitizedConfig, SanitizedGlobalConfig } from 'payload';
1
+ import type { Payload, SanitizedCollectionConfig, SanitizedConfig, SanitizedGlobalConfig } from 'payload';
2
2
  type Args = {
3
3
  adminRoute: string;
4
4
  config: SanitizedConfig;
5
+ defaultIDType: Payload['db']['defaultIDType'];
5
6
  route: string;
6
7
  };
7
8
  type RouteInfo = {
8
9
  collectionConfig?: SanitizedCollectionConfig;
9
10
  collectionSlug?: string;
10
- docID?: string;
11
+ docID?: number | string;
11
12
  globalConfig?: SanitizedGlobalConfig;
12
13
  globalSlug?: string;
13
14
  };
14
- export declare function getRouteInfo({ adminRoute, config, route }: Args): RouteInfo;
15
+ export declare function getRouteInfo({ adminRoute, config, defaultIDType, route }: Args): RouteInfo;
15
16
  export {};
16
17
  //# sourceMappingURL=handleAdminPage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleAdminPage.d.ts","sourceRoot":"","sources":["../../../src/utilities/initPage/handleAdminPage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIhG,KAAK,IAAI,GAAG;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,eAAe,CAAA;IACvB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AACD,KAAK,SAAS,GAAG;IACf,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,wBAAgB,YAAY,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,GAAG,SAAS,CA8B3E"}
1
+ {"version":3,"file":"handleAdminPage.d.ts","sourceRoot":"","sources":["../../../src/utilities/initPage/handleAdminPage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,yBAAyB,EACzB,eAAe,EACf,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAIhB,KAAK,IAAI,GAAG;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,eAAe,CAAA;IACvB,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,CAAA;IAC7C,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,KAAK,SAAS,GAAG;IACf,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,wBAAgB,YAAY,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,IAAI,GAAG,SAAS,CAoC1F"}
@@ -2,6 +2,7 @@ import { getRouteWithoutAdmin, isAdminRoute } from './shared.js';
2
2
  export function getRouteInfo({
3
3
  adminRoute,
4
4
  config,
5
+ defaultIDType,
5
6
  route
6
7
  }) {
7
8
  if (isAdminRoute({
@@ -17,7 +18,7 @@ export function getRouteInfo({
17
18
  const [entityType, entitySlug, createOrID] = routeSegments;
18
19
  const collectionSlug = entityType === 'collections' ? entitySlug : undefined;
19
20
  const globalSlug = entityType === 'globals' ? entitySlug : undefined;
20
- const docID = collectionSlug && createOrID !== 'create' ? createOrID : undefined;
21
+ const docID = collectionSlug && createOrID !== 'create' ? defaultIDType === 'number' ? Number(createOrID) : createOrID : undefined;
21
22
  let collectionConfig;
22
23
  let globalConfig;
23
24
  if (collectionSlug) {
@@ -1 +1 @@
1
- {"version":3,"file":"handleAdminPage.js","names":["getRouteWithoutAdmin","isAdminRoute","getRouteInfo","adminRoute","config","route","routeWithoutAdmin","routeSegments","split","filter","Boolean","entityType","entitySlug","createOrID","collectionSlug","undefined","globalSlug","docID","collectionConfig","globalConfig","collections","find","collection","slug","globals","global"],"sources":["../../../src/utilities/initPage/handleAdminPage.ts"],"sourcesContent":["import type { SanitizedCollectionConfig, SanitizedConfig, SanitizedGlobalConfig } from 'payload'\n\nimport { getRouteWithoutAdmin, isAdminRoute } from './shared.js'\n\ntype Args = {\n adminRoute: string\n config: SanitizedConfig\n route: string\n}\ntype RouteInfo = {\n collectionConfig?: SanitizedCollectionConfig\n collectionSlug?: string\n docID?: string\n globalConfig?: SanitizedGlobalConfig\n globalSlug?: string\n}\n\nexport function getRouteInfo({ adminRoute, config, route }: Args): RouteInfo {\n if (isAdminRoute({ adminRoute, config, route })) {\n const routeWithoutAdmin = getRouteWithoutAdmin({ adminRoute, route })\n const routeSegments = routeWithoutAdmin.split('/').filter(Boolean)\n const [entityType, entitySlug, createOrID] = routeSegments\n const collectionSlug = entityType === 'collections' ? entitySlug : undefined\n const globalSlug = entityType === 'globals' ? entitySlug : undefined\n const docID = collectionSlug && createOrID !== 'create' ? createOrID : undefined\n\n let collectionConfig: SanitizedCollectionConfig | undefined\n let globalConfig: SanitizedGlobalConfig | undefined\n\n if (collectionSlug) {\n collectionConfig = config.collections.find((collection) => collection.slug === collectionSlug)\n }\n\n if (globalSlug) {\n globalConfig = config.globals.find((global) => global.slug === globalSlug)\n }\n\n return {\n collectionConfig,\n collectionSlug,\n docID,\n globalConfig,\n globalSlug,\n }\n }\n\n return {}\n}\n"],"mappings":"AAEA,SAASA,oBAAoB,EAAEC,YAAY,QAAQ;AAenD,OAAO,SAASC,aAAa;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAK,CAAQ;EAC9D,IAAIJ,YAAA,CAAa;IAAEE,UAAA;IAAYC,MAAA;IAAQC;EAAM,IAAI;IAC/C,MAAMC,iBAAA,GAAoBN,oBAAA,CAAqB;MAAEG,UAAA;MAAYE;IAAM;IACnE,MAAME,aAAA,GAAgBD,iBAAA,CAAkBE,KAAK,CAAC,KAAKC,MAAM,CAACC,OAAA;IAC1D,MAAM,CAACC,UAAA,EAAYC,UAAA,EAAYC,UAAA,CAAW,GAAGN,aAAA;IAC7C,MAAMO,cAAA,GAAiBH,UAAA,KAAe,gBAAgBC,UAAA,GAAaG,SAAA;IACnE,MAAMC,UAAA,GAAaL,UAAA,KAAe,YAAYC,UAAA,GAAaG,SAAA;IAC3D,MAAME,KAAA,GAAQH,cAAA,IAAkBD,UAAA,KAAe,WAAWA,UAAA,GAAaE,SAAA;IAEvE,IAAIG,gBAAA;IACJ,IAAIC,YAAA;IAEJ,IAAIL,cAAA,EAAgB;MAClBI,gBAAA,GAAmBd,MAAA,CAAOgB,WAAW,CAACC,IAAI,CAAEC,UAAA,IAAeA,UAAA,CAAWC,IAAI,KAAKT,cAAA;IACjF;IAEA,IAAIE,UAAA,EAAY;MACdG,YAAA,GAAef,MAAA,CAAOoB,OAAO,CAACH,IAAI,CAAEI,MAAA,IAAWA,MAAA,CAAOF,IAAI,KAAKP,UAAA;IACjE;IAEA,OAAO;MACLE,gBAAA;MACAJ,cAAA;MACAG,KAAA;MACAE,YAAA;MACAH;IACF;EACF;EAEA,OAAO,CAAC;AACV","ignoreList":[]}
1
+ {"version":3,"file":"handleAdminPage.js","names":["getRouteWithoutAdmin","isAdminRoute","getRouteInfo","adminRoute","config","defaultIDType","route","routeWithoutAdmin","routeSegments","split","filter","Boolean","entityType","entitySlug","createOrID","collectionSlug","undefined","globalSlug","docID","Number","collectionConfig","globalConfig","collections","find","collection","slug","globals","global"],"sources":["../../../src/utilities/initPage/handleAdminPage.ts"],"sourcesContent":["import type {\n Payload,\n SanitizedCollectionConfig,\n SanitizedConfig,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport { getRouteWithoutAdmin, isAdminRoute } from './shared.js'\n\ntype Args = {\n adminRoute: string\n config: SanitizedConfig\n defaultIDType: Payload['db']['defaultIDType']\n route: string\n}\n\ntype RouteInfo = {\n collectionConfig?: SanitizedCollectionConfig\n collectionSlug?: string\n docID?: number | string\n globalConfig?: SanitizedGlobalConfig\n globalSlug?: string\n}\n\nexport function getRouteInfo({ adminRoute, config, defaultIDType, route }: Args): RouteInfo {\n if (isAdminRoute({ adminRoute, config, route })) {\n const routeWithoutAdmin = getRouteWithoutAdmin({ adminRoute, route })\n const routeSegments = routeWithoutAdmin.split('/').filter(Boolean)\n const [entityType, entitySlug, createOrID] = routeSegments\n const collectionSlug = entityType === 'collections' ? entitySlug : undefined\n const globalSlug = entityType === 'globals' ? entitySlug : undefined\n\n const docID =\n collectionSlug && createOrID !== 'create'\n ? defaultIDType === 'number'\n ? Number(createOrID)\n : createOrID\n : undefined\n\n let collectionConfig: SanitizedCollectionConfig | undefined\n let globalConfig: SanitizedGlobalConfig | undefined\n\n if (collectionSlug) {\n collectionConfig = config.collections.find((collection) => collection.slug === collectionSlug)\n }\n\n if (globalSlug) {\n globalConfig = config.globals.find((global) => global.slug === globalSlug)\n }\n\n return {\n collectionConfig,\n collectionSlug,\n docID,\n globalConfig,\n globalSlug,\n }\n }\n\n return {}\n}\n"],"mappings":"AAOA,SAASA,oBAAoB,EAAEC,YAAY,QAAQ;AAiBnD,OAAO,SAASC,aAAa;EAAEC,UAAU;EAAEC,MAAM;EAAEC,aAAa;EAAEC;AAAK,CAAQ;EAC7E,IAAIL,YAAA,CAAa;IAAEE,UAAA;IAAYC,MAAA;IAAQE;EAAM,IAAI;IAC/C,MAAMC,iBAAA,GAAoBP,oBAAA,CAAqB;MAAEG,UAAA;MAAYG;IAAM;IACnE,MAAME,aAAA,GAAgBD,iBAAA,CAAkBE,KAAK,CAAC,KAAKC,MAAM,CAACC,OAAA;IAC1D,MAAM,CAACC,UAAA,EAAYC,UAAA,EAAYC,UAAA,CAAW,GAAGN,aAAA;IAC7C,MAAMO,cAAA,GAAiBH,UAAA,KAAe,gBAAgBC,UAAA,GAAaG,SAAA;IACnE,MAAMC,UAAA,GAAaL,UAAA,KAAe,YAAYC,UAAA,GAAaG,SAAA;IAE3D,MAAME,KAAA,GACJH,cAAA,IAAkBD,UAAA,KAAe,WAC7BT,aAAA,KAAkB,WAChBc,MAAA,CAAOL,UAAA,IACPA,UAAA,GACFE,SAAA;IAEN,IAAII,gBAAA;IACJ,IAAIC,YAAA;IAEJ,IAAIN,cAAA,EAAgB;MAClBK,gBAAA,GAAmBhB,MAAA,CAAOkB,WAAW,CAACC,IAAI,CAAEC,UAAA,IAAeA,UAAA,CAAWC,IAAI,KAAKV,cAAA;IACjF;IAEA,IAAIE,UAAA,EAAY;MACdI,YAAA,GAAejB,MAAA,CAAOsB,OAAO,CAACH,IAAI,CAAEI,MAAA,IAAWA,MAAA,CAAOF,IAAI,KAAKR,UAAA;IACjE;IAEA,OAAO;MACLG,gBAAA;MACAL,cAAA;MACAG,KAAA;MACAG,YAAA;MACAJ;IACF;EACF;EAEA,OAAO,CAAC;AACV","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/initPage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAA2C,MAAM,SAAS,CAAA;AAQtF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAQtC,eAAO,MAAM,QAAQ,+DAKlB,IAAI,KAAG,OAAO,CAAC,cAAc,CAmJ/B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/initPage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAA2C,MAAM,SAAS,CAAA;AAQtF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAQtC,eAAO,MAAM,QAAQ,+DAKlB,IAAI,KAAG,OAAO,CAAC,cAAc,CAoJ/B,CAAA"}
@@ -141,6 +141,7 @@ export const initPage = async ({
141
141
  } = getRouteInfo({
142
142
  adminRoute,
143
143
  config: payload.config,
144
+ defaultIDType: payload.db.defaultIDType,
144
145
  route
145
146
  });
146
147
  if (collectionSlug && !collectionConfig || globalSlug && !globalConfig) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["findLocaleFromCode","headers","getHeaders","notFound","createLocalReq","isEntityHidden","parseCookies","qs","getPayloadHMR","initReq","getRouteInfo","handleAuthRedirect","isPublicAdminRoute","initPage","config","configPromise","importMap","route","searchParams","payload","queryString","stringify","addQueryPrefix","collections","globals","localization","routes","admin","adminRoute","cookies","i18n","permissions","user","req","fallbackLocale","host","get","query","parse","depth","ignoreQueryPrefix","url","serverURL","languageOptions","Object","entries","supportedLanguages","reduce","acc","language","languageConfig","keys","includes","push","label","translations","general","thisLanguage","value","localeParam","locale","defaultLocaleCode","defaultLocale","localeCode","find","collection","limit","where","and","equals","id","key","then","res","docs","error","code","visibleEntities","map","slug","hidden","filter","Boolean","redirectTo","canAccessAdmin","collectionConfig","collectionSlug","docID","globalConfig","globalSlug"],"sources":["../../../src/utilities/initPage/index.ts"],"sourcesContent":["import type { InitPageResult, Locale, PayloadRequest, VisibleEntities } from 'payload'\n\nimport { findLocaleFromCode } from '@payloadcms/ui/shared'\nimport { headers as getHeaders } from 'next/headers.js'\nimport { notFound } from 'next/navigation.js'\nimport { createLocalReq, isEntityHidden, parseCookies } from 'payload'\nimport * as qs from 'qs-esm'\n\nimport type { Args } from './types.js'\n\nimport { getPayloadHMR } from '../getPayloadHMR.js'\nimport { initReq } from '../initReq.js'\nimport { getRouteInfo } from './handleAdminPage.js'\nimport { handleAuthRedirect } from './handleAuthRedirect.js'\nimport { isPublicAdminRoute } from './shared.js'\n\nexport const initPage = async ({\n config: configPromise,\n importMap,\n route,\n searchParams,\n}: Args): Promise<InitPageResult> => {\n const headers = await getHeaders()\n const payload = await getPayloadHMR({ config: configPromise, importMap })\n const queryString = `${qs.stringify(searchParams ?? {}, { addQueryPrefix: true })}`\n\n const {\n collections,\n globals,\n localization,\n routes: { admin: adminRoute },\n } = payload.config\n\n const cookies = parseCookies(headers)\n\n const { i18n, permissions, user } = await initReq(payload.config)\n\n // Ideally, we should not need to recreate the req, because\n // we can get it from the above initReq.\n\n // We just need to -overwrite- the url and query of the req\n // we get above. Clone the req? We'll look into that eventually.\n const req = await createLocalReq(\n {\n fallbackLocale: null,\n req: {\n headers,\n host: headers.get('host'),\n i18n,\n query: qs.parse(queryString, {\n depth: 10,\n ignoreQueryPrefix: true,\n }),\n url: `${payload.config.serverURL}${route}${searchParams ? queryString : ''}`,\n } as PayloadRequest,\n },\n payload,\n )\n\n const languageOptions = Object.entries(payload.config.i18n.supportedLanguages || {}).reduce(\n (acc, [language, languageConfig]) => {\n if (Object.keys(payload.config.i18n.supportedLanguages).includes(language)) {\n acc.push({\n label: languageConfig.translations.general.thisLanguage,\n value: language,\n })\n }\n\n return acc\n },\n [],\n )\n\n req.user = user\n\n const localeParam = searchParams?.locale as string\n let locale: Locale\n\n if (localization) {\n const defaultLocaleCode = localization.defaultLocale ? localization.defaultLocale : 'en'\n let localeCode: string = localeParam\n\n if (!localeCode) {\n try {\n localeCode = await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n user,\n where: {\n and: [\n {\n 'user.relationTo': {\n equals: payload.config.admin.user,\n },\n },\n {\n 'user.value': {\n equals: user.id,\n },\n },\n {\n key: {\n equals: 'locale',\n },\n },\n ],\n },\n })\n ?.then((res) => res.docs?.[0]?.value as string)\n } catch (error) {} // eslint-disable-line no-empty\n }\n\n locale = findLocaleFromCode(localization, localeCode)\n\n if (!locale) {\n locale = findLocaleFromCode(localization, defaultLocaleCode)\n }\n req.locale = locale.code\n }\n\n const visibleEntities: VisibleEntities = {\n collections: collections\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n globals: globals\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n }\n\n let redirectTo = null\n\n if (\n !permissions.canAccessAdmin &&\n !isPublicAdminRoute({ adminRoute, config: payload.config, route })\n ) {\n redirectTo = handleAuthRedirect({\n config: payload.config,\n route,\n searchParams,\n user,\n })\n }\n\n const { collectionConfig, collectionSlug, docID, globalConfig, globalSlug } = getRouteInfo({\n adminRoute,\n config: payload.config,\n route,\n })\n\n if ((collectionSlug && !collectionConfig) || (globalSlug && !globalConfig)) {\n return notFound()\n }\n\n return {\n collectionConfig,\n cookies,\n docID,\n globalConfig,\n languageOptions,\n locale,\n permissions,\n redirectTo,\n req,\n translations: i18n.translations,\n visibleEntities,\n }\n}\n"],"mappings":"AAEA,SAASA,kBAAkB,QAAQ;AACnC,SAASC,OAAA,IAAWC,UAAU,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AACzB,SAASC,cAAc,EAAEC,cAAc,EAAEC,YAAY,QAAQ;AAC7D,YAAYC,EAAA,MAAQ;AAIpB,SAASC,aAAa,QAAQ;AAC9B,SAASC,OAAO,QAAQ;AACxB,SAASC,YAAY,QAAQ;AAC7B,SAASC,kBAAkB,QAAQ;AACnC,SAASC,kBAAkB,QAAQ;AAEnC,OAAO,MAAMC,QAAA,GAAW,MAAAA,CAAO;EAC7BC,MAAA,EAAQC,aAAa;EACrBC,SAAS;EACTC,KAAK;EACLC;AAAY,CACP;EACL,MAAMjB,OAAA,GAAU,MAAMC,UAAA;EACtB,MAAMiB,OAAA,GAAU,MAAMX,aAAA,CAAc;IAAEM,MAAA,EAAQC,aAAA;IAAeC;EAAU;EACvE,MAAMI,WAAA,GAAc,GAAGb,EAAA,CAAGc,SAAS,CAACH,YAAA,IAAgB,CAAC,GAAG;IAAEI,cAAA,EAAgB;EAAK,IAAI;EAEnF,MAAM;IACJC,WAAW;IACXC,OAAO;IACPC,YAAY;IACZC,MAAA,EAAQ;MAAEC,KAAA,EAAOC;IAAU;EAAE,CAC9B,GAAGT,OAAA,CAAQL,MAAM;EAElB,MAAMe,OAAA,GAAUvB,YAAA,CAAaL,OAAA;EAE7B,MAAM;IAAE6B,IAAI;IAAEC,WAAW;IAAEC;EAAI,CAAE,GAAG,MAAMvB,OAAA,CAAQU,OAAA,CAAQL,MAAM;EAEhE;EACA;EAEA;EACA;EACA,MAAMmB,GAAA,GAAM,MAAM7B,cAAA,CAChB;IACE8B,c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AkE,UAAA,GAAaxE,kBAAA,CAAmB;MAC9BG,MAAA,EAAQK,OAAA,CAAQL,MAAM;MACtBG,KAAA;MACAC,YAAA;MACAc;IACF;EACF;EAEA,MAAM;IAAEqD,gBAAgB;IAAEC,cAAc;IAAEC,KAAK;IAAEC,YAAY;IAAEC;EAAU,CAAE,GAAG/E,YAAA,CAAa;IACzFkB,UAAA;IACAd,MAAA,EAAQK,OAAA,CAAQL,MAAM;IACtBG;EACF;EAEA,IAAIqE,cAAC,IAAkB,CAACD,gBAAA,IAAsBI,UAAA,IAAc,CAACD,YAAA,EAAe;IAC1E,OAAOrF,QAAA;EACT;EAEA,OAAO;IACLkF,gBAAA;IACAxD,OAAA;IACA0D,KAAA;IACAC,YAAA;IACA7C,eAAA;IACAiB,MAAA;IACA7B,WAAA;IACAoD,UAAA;IACAlD,GAAA;IACAsB,YAAA,EAAczB,IAAA,CAAKyB,YAAY;IAC/BsB;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["findLocaleFromCode","headers","getHeaders","notFound","createLocalReq","isEntityHidden","parseCookies","qs","getPayloadHMR","initReq","getRouteInfo","handleAuthRedirect","isPublicAdminRoute","initPage","config","configPromise","importMap","route","searchParams","payload","queryString","stringify","addQueryPrefix","collections","globals","localization","routes","admin","adminRoute","cookies","i18n","permissions","user","req","fallbackLocale","host","get","query","parse","depth","ignoreQueryPrefix","url","serverURL","languageOptions","Object","entries","supportedLanguages","reduce","acc","language","languageConfig","keys","includes","push","label","translations","general","thisLanguage","value","localeParam","locale","defaultLocaleCode","defaultLocale","localeCode","find","collection","limit","where","and","equals","id","key","then","res","docs","error","code","visibleEntities","map","slug","hidden","filter","Boolean","redirectTo","canAccessAdmin","collectionConfig","collectionSlug","docID","globalConfig","globalSlug","defaultIDType","db"],"sources":["../../../src/utilities/initPage/index.ts"],"sourcesContent":["import type { InitPageResult, Locale, PayloadRequest, VisibleEntities } from 'payload'\n\nimport { findLocaleFromCode } from '@payloadcms/ui/shared'\nimport { headers as getHeaders } from 'next/headers.js'\nimport { notFound } from 'next/navigation.js'\nimport { createLocalReq, isEntityHidden, parseCookies } from 'payload'\nimport * as qs from 'qs-esm'\n\nimport type { Args } from './types.js'\n\nimport { getPayloadHMR } from '../getPayloadHMR.js'\nimport { initReq } from '../initReq.js'\nimport { getRouteInfo } from './handleAdminPage.js'\nimport { handleAuthRedirect } from './handleAuthRedirect.js'\nimport { isPublicAdminRoute } from './shared.js'\n\nexport const initPage = async ({\n config: configPromise,\n importMap,\n route,\n searchParams,\n}: Args): Promise<InitPageResult> => {\n const headers = await getHeaders()\n const payload = await getPayloadHMR({ config: configPromise, importMap })\n const queryString = `${qs.stringify(searchParams ?? {}, { addQueryPrefix: true })}`\n\n const {\n collections,\n globals,\n localization,\n routes: { admin: adminRoute },\n } = payload.config\n\n const cookies = parseCookies(headers)\n\n const { i18n, permissions, user } = await initReq(payload.config)\n\n // Ideally, we should not need to recreate the req, because\n // we can get it from the above initReq.\n\n // We just need to -overwrite- the url and query of the req\n // we get above. Clone the req? We'll look into that eventually.\n const req = await createLocalReq(\n {\n fallbackLocale: null,\n req: {\n headers,\n host: headers.get('host'),\n i18n,\n query: qs.parse(queryString, {\n depth: 10,\n ignoreQueryPrefix: true,\n }),\n url: `${payload.config.serverURL}${route}${searchParams ? queryString : ''}`,\n } as PayloadRequest,\n },\n payload,\n )\n\n const languageOptions = Object.entries(payload.config.i18n.supportedLanguages || {}).reduce(\n (acc, [language, languageConfig]) => {\n if (Object.keys(payload.config.i18n.supportedLanguages).includes(language)) {\n acc.push({\n label: languageConfig.translations.general.thisLanguage,\n value: language,\n })\n }\n\n return acc\n },\n [],\n )\n\n req.user = user\n\n const localeParam = searchParams?.locale as string\n let locale: Locale\n\n if (localization) {\n const defaultLocaleCode = localization.defaultLocale ? localization.defaultLocale : 'en'\n let localeCode: string = localeParam\n\n if (!localeCode) {\n try {\n localeCode = await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n user,\n where: {\n and: [\n {\n 'user.relationTo': {\n equals: payload.config.admin.user,\n },\n },\n {\n 'user.value': {\n equals: user.id,\n },\n },\n {\n key: {\n equals: 'locale',\n },\n },\n ],\n },\n })\n ?.then((res) => res.docs?.[0]?.value as string)\n } catch (error) {} // eslint-disable-line no-empty\n }\n\n locale = findLocaleFromCode(localization, localeCode)\n\n if (!locale) {\n locale = findLocaleFromCode(localization, defaultLocaleCode)\n }\n req.locale = locale.code\n }\n\n const visibleEntities: VisibleEntities = {\n collections: collections\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n globals: globals\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n }\n\n let redirectTo = null\n\n if (\n !permissions.canAccessAdmin &&\n !isPublicAdminRoute({ adminRoute, config: payload.config, route })\n ) {\n redirectTo = handleAuthRedirect({\n config: payload.config,\n route,\n searchParams,\n user,\n })\n }\n\n const { collectionConfig, collectionSlug, docID, globalConfig, globalSlug } = getRouteInfo({\n adminRoute,\n config: payload.config,\n defaultIDType: payload.db.defaultIDType,\n route,\n })\n\n if ((collectionSlug && !collectionConfig) || (globalSlug && !globalConfig)) {\n return notFound()\n }\n\n return {\n collectionConfig,\n cookies,\n docID,\n globalConfig,\n languageOptions,\n locale,\n permissions,\n redirectTo,\n req,\n translations: i18n.translations,\n visibleEntities,\n }\n}\n"],"mappings":"AAEA,SAASA,kBAAkB,QAAQ;AACnC,SAASC,OAAA,IAAWC,UAAU,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AACzB,SAASC,cAAc,EAAEC,cAAc,EAAEC,YAAY,QAAQ;AAC7D,YAAYC,EAAA,MAAQ;AAIpB,SAASC,aAAa,QAAQ;AAC9B,SAASC,OAAO,QAAQ;AACxB,SAASC,YAAY,QAAQ;AAC7B,SAASC,kBAAkB,QAAQ;AACnC,SAASC,kBAAkB,QAAQ;AAEnC,OAAO,MAAMC,QAAA,GAA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IACA7B,WAAA;IACAoD,UAAA;IACAlD,GAAA;IACAsB,YAAA,EAAczB,IAAA,CAAKyB,YAAY;IAC/BsB;EACF;AACF","ignoreList":[]}
@@ -1,90 +1,92 @@
1
1
  @import '../../../scss/styles.scss';
2
2
 
3
- .query-inspector {
4
- &__json-children {
5
- position: relative;
3
+ @layer payload-default {
4
+ .query-inspector {
5
+ &__json-children {
6
+ position: relative;
6
7
 
7
- &:before {
8
- content: '';
9
- position: absolute;
10
- top: 0;
11
- left: 8px;
12
- width: 1px;
13
- height: 100%;
14
- border-left: 1px dashed var(--theme-elevation-200);
8
+ &:before {
9
+ content: '';
10
+ position: absolute;
11
+ top: 0;
12
+ left: 8px;
13
+ width: 1px;
14
+ height: 100%;
15
+ border-left: 1px dashed var(--theme-elevation-200);
16
+ }
15
17
  }
16
- }
17
18
 
18
- &__list-wrap {
19
- position: relative;
20
- }
19
+ &__list-wrap {
20
+ position: relative;
21
+ }
21
22
 
22
- &__list-toggle {
23
- all: unset;
24
- width: 100%;
25
- text-align: left;
26
- cursor: pointer;
27
- border-radius: 3px;
28
- border-top-right-radius: 0;
29
- border-bottom-right-radius: 0;
30
- position: relative;
31
- display: flex;
32
- gap: 10px;
33
- align-items: center;
34
- left: -3px;
35
- width: calc(100% + 3px);
23
+ &__list-toggle {
24
+ all: unset;
25
+ width: 100%;
26
+ text-align: left;
27
+ cursor: pointer;
28
+ border-radius: 3px;
29
+ border-top-right-radius: 0;
30
+ border-bottom-right-radius: 0;
31
+ position: relative;
32
+ display: flex;
33
+ gap: 10px;
34
+ align-items: center;
35
+ left: -3px;
36
+ width: calc(100% + 3px);
36
37
 
37
- svg {
38
- margin-left: 5px;
39
- }
38
+ svg {
39
+ margin-left: 5px;
40
+ }
40
41
 
41
- svg .stroke {
42
- stroke: var(--theme-elevation-400);
43
- }
42
+ svg .stroke {
43
+ stroke: var(--theme-elevation-400);
44
+ }
44
45
 
45
- &:hover {
46
- background-color: var(--theme-elevation-100);
47
- }
46
+ &:hover {
47
+ background-color: var(--theme-elevation-100);
48
+ }
48
49
 
49
- &--empty {
50
- cursor: default;
51
- pointer-events: none;
50
+ &--empty {
51
+ cursor: default;
52
+ pointer-events: none;
53
+ }
52
54
  }
53
- }
54
55
 
55
- &__toggle-row-icon {
56
- &--open {
57
- transform: rotate(0deg);
58
- }
59
- &--closed {
60
- transform: rotate(-90deg);
56
+ &__toggle-row-icon {
57
+ &--open {
58
+ transform: rotate(0deg);
59
+ }
60
+ &--closed {
61
+ transform: rotate(-90deg);
62
+ }
61
63
  }
62
- }
63
64
 
64
- &__value-type {
65
- &--number {
66
- .query-inspector__value {
67
- color: var(--number-color);
65
+ &__value-type {
66
+ &--number {
67
+ .query-inspector__value {
68
+ color: var(--number-color);
69
+ }
68
70
  }
69
- }
70
71
 
71
- &--string {
72
- .query-inspector__value {
73
- color: var(--string-color);
72
+ &--string {
73
+ .query-inspector__value {
74
+ color: var(--string-color);
75
+ }
74
76
  }
75
77
  }
76
- }
77
78
 
78
- &__row-line--nested {
79
- margin-left: 25px;
80
- }
79
+ &__row-line--nested {
80
+ margin-left: 25px;
81
+ }
81
82
 
82
- &__bracket {
83
- position: relative;
83
+ &__bracket {
84
+ position: relative;
84
85
 
85
- &--position-end {
86
- left: 5px;
87
- width: calc(100% - 5px);
86
+ &--position-end {
87
+ left: 5px;
88
+ width: calc(100% - 5px);
89
+ }
88
90
  }
89
91
  }
90
92
  }
@@ -91,7 +91,7 @@ export const Account = async ({
91
91
  docPermissions: docPermissions,
92
92
  hasPublishPermission: hasPublishPermission,
93
93
  hasSavePermission: hasSavePermission,
94
- id: user?.id.toString(),
94
+ id: user?.id,
95
95
  initialData: data,
96
96
  initialState: formState,
97
97
  isEditing: true,