payload 3.24.0 → 3.25.0-canary.6d6bbd2

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 (82) hide show
  1. package/dist/auth/strategies/jwt.d.ts.map +1 -1
  2. package/dist/auth/strategies/jwt.js +2 -0
  3. package/dist/auth/strategies/jwt.js.map +1 -1
  4. package/dist/bin/index.d.ts.map +1 -1
  5. package/dist/bin/index.js +9 -2
  6. package/dist/bin/index.js.map +1 -1
  7. package/dist/collections/operations/local/count.d.ts +31 -1
  8. package/dist/collections/operations/local/count.d.ts.map +1 -1
  9. package/dist/collections/operations/local/count.js.map +1 -1
  10. package/dist/collections/operations/local/countVersions.d.ts +31 -1
  11. package/dist/collections/operations/local/countVersions.d.ts.map +1 -1
  12. package/dist/collections/operations/local/countVersions.js.map +1 -1
  13. package/dist/collections/operations/local/create.d.ts +66 -1
  14. package/dist/collections/operations/local/create.d.ts.map +1 -1
  15. package/dist/collections/operations/local/create.js.map +1 -1
  16. package/dist/collections/operations/local/delete.d.ts +58 -1
  17. package/dist/collections/operations/local/delete.d.ts.map +1 -1
  18. package/dist/collections/operations/local/delete.js.map +1 -1
  19. package/dist/collections/operations/local/duplicate.d.ts +51 -1
  20. package/dist/collections/operations/local/duplicate.d.ts.map +1 -1
  21. package/dist/collections/operations/local/duplicate.js.map +1 -1
  22. package/dist/collections/operations/local/find.d.ts +76 -1
  23. package/dist/collections/operations/local/find.d.ts.map +1 -1
  24. package/dist/collections/operations/local/find.js.map +1 -1
  25. package/dist/collections/operations/local/findByID.d.ts +59 -1
  26. package/dist/collections/operations/local/findByID.d.ts.map +1 -1
  27. package/dist/collections/operations/local/findByID.js.map +1 -1
  28. package/dist/collections/operations/local/findVersionByID.d.ts +48 -1
  29. package/dist/collections/operations/local/findVersionByID.d.ts.map +1 -1
  30. package/dist/collections/operations/local/findVersionByID.js.map +1 -1
  31. package/dist/collections/operations/local/findVersions.d.ts +58 -1
  32. package/dist/collections/operations/local/findVersions.d.ts.map +1 -1
  33. package/dist/collections/operations/local/findVersions.js.map +1 -1
  34. package/dist/collections/operations/local/restoreVersion.d.ts +44 -1
  35. package/dist/collections/operations/local/restoreVersion.d.ts.map +1 -1
  36. package/dist/collections/operations/local/restoreVersion.js.map +1 -1
  37. package/dist/collections/operations/local/update.d.ts +88 -1
  38. package/dist/collections/operations/local/update.d.ts.map +1 -1
  39. package/dist/collections/operations/local/update.js.map +1 -1
  40. package/dist/fields/config/client.d.ts.map +1 -1
  41. package/dist/fields/config/client.js +8 -4
  42. package/dist/fields/config/client.js.map +1 -1
  43. package/dist/fields/config/types.d.ts +2 -1
  44. package/dist/fields/config/types.d.ts.map +1 -1
  45. package/dist/fields/config/types.js.map +1 -1
  46. package/dist/fields/validations.js +2 -2
  47. package/dist/fields/validations.js.map +1 -1
  48. package/dist/globals/operations/local/countGlobalVersions.d.ts +31 -1
  49. package/dist/globals/operations/local/countGlobalVersions.d.ts.map +1 -1
  50. package/dist/globals/operations/local/countGlobalVersions.js.map +1 -1
  51. package/dist/globals/operations/local/findOne.d.ts +46 -0
  52. package/dist/globals/operations/local/findOne.d.ts.map +1 -1
  53. package/dist/globals/operations/local/findOne.js.map +1 -1
  54. package/dist/globals/operations/local/findVersionByID.d.ts +47 -0
  55. package/dist/globals/operations/local/findVersionByID.d.ts.map +1 -1
  56. package/dist/globals/operations/local/findVersionByID.js.map +1 -1
  57. package/dist/globals/operations/local/findVersions.d.ts +57 -0
  58. package/dist/globals/operations/local/findVersions.d.ts.map +1 -1
  59. package/dist/globals/operations/local/findVersions.js.map +1 -1
  60. package/dist/globals/operations/local/restoreVersion.d.ts +40 -0
  61. package/dist/globals/operations/local/restoreVersion.d.ts.map +1 -1
  62. package/dist/globals/operations/local/restoreVersion.js.map +1 -1
  63. package/dist/globals/operations/local/update.d.ts +54 -0
  64. package/dist/globals/operations/local/update.d.ts.map +1 -1
  65. package/dist/globals/operations/local/update.js.map +1 -1
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +4 -1
  68. package/dist/index.js.map +1 -1
  69. package/dist/types/constants.d.ts +2 -2
  70. package/dist/types/constants.d.ts.map +1 -1
  71. package/dist/types/constants.js +1 -0
  72. package/dist/types/constants.js.map +1 -1
  73. package/dist/uploads/endpoints/getFile.d.ts.map +1 -1
  74. package/dist/uploads/endpoints/getFile.js +24 -1
  75. package/dist/uploads/endpoints/getFile.js.map +1 -1
  76. package/dist/utilities/checkDocumentLockStatus.js +2 -2
  77. package/dist/utilities/checkDocumentLockStatus.js.map +1 -1
  78. package/dist/utilities/configToJSONSchema.d.ts +1 -1
  79. package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
  80. package/dist/utilities/configToJSONSchema.js +46 -34
  81. package/dist/utilities/configToJSONSchema.js.map +1 -1
  82. package/package.json +2 -2
@@ -2,21 +2,64 @@ import type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../..
2
2
  import type { Document, PayloadRequest, PopulateType, SelectType } from '../../../types/index.js';
3
3
  import type { DataFromCollectionSlug } from '../../config/types.js';
4
4
  export type Options<TSlug extends CollectionSlug> = {
5
+ /**
6
+ * the Collection slug to operate against.
7
+ */
5
8
  collection: TSlug;
6
9
  /**
7
- * context, which will then be passed to req.context, which can be read by hooks
10
+ * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,
11
+ * which can be read by hooks. Useful if you want to pass additional information to the hooks which
12
+ * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook
13
+ * to determine if it should run or not.
8
14
  */
9
15
  context?: RequestContext;
16
+ /**
17
+ * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
18
+ */
10
19
  depth?: number;
20
+ /**
21
+ * Whether the document should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)
22
+ */
11
23
  draft?: boolean;
24
+ /**
25
+ * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.
26
+ */
12
27
  fallbackLocale?: false | TypedLocale;
28
+ /**
29
+ * The ID of the version to restore.
30
+ */
13
31
  id: string;
32
+ /**
33
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
34
+ */
14
35
  locale?: TypedLocale;
36
+ /**
37
+ * Skip access control.
38
+ * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the fron-end.
39
+ * @default true
40
+ */
15
41
  overrideAccess?: boolean;
42
+ /**
43
+ * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
44
+ */
16
45
  populate?: PopulateType;
46
+ /**
47
+ * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.
48
+ * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.
49
+ */
17
50
  req?: Partial<PayloadRequest>;
51
+ /**
52
+ * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
53
+ */
18
54
  select?: SelectType;
55
+ /**
56
+ * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.
57
+ * @default false
58
+ */
19
59
  showHiddenFields?: boolean;
60
+ /**
61
+ * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
62
+ */
20
63
  user?: Document;
21
64
  };
22
65
  export default function restoreVersionLocal<TSlug extends CollectionSlug>(payload: Payload, options: Options<TSlug>): Promise<DataFromCollectionSlug<TSlug>>;
@@ -1 +1 @@
1
- {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/restoreVersion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACjG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAMnE,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,IAAI;IAClD,UAAU,EAAE,KAAK,CAAA;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB,CAAA;AAED,wBAA8B,mBAAmB,CAAC,KAAK,SAAS,cAAc,EAC5E,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAkCxC"}
1
+ {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/restoreVersion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACjG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAMnE,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,IAAI;IAClD;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB,CAAA;AAED,wBAA8B,mBAAmB,CAAC,KAAK,SAAS,cAAc,EAC5E,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAkCxC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/restoreVersion.ts"],"sourcesContent":["// @ts-strict-ignore\nimport type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type { Document, PayloadRequest, PopulateType, SelectType } from '../../../types/index.js'\nimport type { DataFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { restoreVersionOperation } from '../restoreVersion.js'\n\nexport type Options<TSlug extends CollectionSlug> = {\n collection: TSlug\n /**\n * context, which will then be passed to req.context, which can be read by hooks\n */\n context?: RequestContext\n depth?: number\n draft?: boolean\n fallbackLocale?: false | TypedLocale\n id: string\n locale?: TypedLocale\n overrideAccess?: boolean\n populate?: PopulateType\n req?: Partial<PayloadRequest>\n select?: SelectType\n showHiddenFields?: boolean\n user?: Document\n}\n\nexport default async function restoreVersionLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<DataFromCollectionSlug<TSlug>> {\n const {\n id,\n collection: collectionSlug,\n depth,\n overrideAccess = true,\n populate,\n select,\n showHiddenFields,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(\n collectionSlug,\n )} can't be found. Restore Version Operation.`,\n )\n }\n\n const args = {\n id,\n collection,\n depth,\n overrideAccess,\n payload,\n populate,\n req: await createLocalReq(options, payload),\n select,\n showHiddenFields,\n }\n\n return restoreVersionOperation(args)\n}\n"],"names":["APIError","createLocalReq","restoreVersionOperation","restoreVersionLocal","payload","options","id","collection","collectionSlug","depth","overrideAccess","populate","select","showHiddenFields","collections","String","args","req"],"mappings":"AAAA,oBAAoB;AAKpB,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,uBAAuB,QAAQ,uBAAsB;AAqB9D,eAAe,eAAeC,oBAC5BC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EACJC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EACjB,GAAGR;IAEJ,MAAME,aAAaH,QAAQU,WAAW,CAACN,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIP,SACR,CAAC,yBAAyB,EAAEe,OAC1BP,gBACA,2CAA2C,CAAC;IAElD;IAEA,MAAMQ,OAAO;QACXV;QACAC;QACAE;QACAC;QACAN;QACAO;QACAM,KAAK,MAAMhB,eAAeI,SAASD;QACnCQ;QACAC;IACF;IAEA,OAAOX,wBAAwBc;AACjC"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/restoreVersion.ts"],"sourcesContent":["// @ts-strict-ignore\nimport type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type { Document, PayloadRequest, PopulateType, SelectType } from '../../../types/index.js'\nimport type { DataFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { restoreVersionOperation } from '../restoreVersion.js'\n\nexport type Options<TSlug extends CollectionSlug> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Whether the document should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * The ID of the version to restore.\n */\n id: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the fron-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.\n */\n select?: SelectType\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n}\n\nexport default async function restoreVersionLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<DataFromCollectionSlug<TSlug>> {\n const {\n id,\n collection: collectionSlug,\n depth,\n overrideAccess = true,\n populate,\n select,\n showHiddenFields,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(\n collectionSlug,\n )} can't be found. Restore Version Operation.`,\n )\n }\n\n const args = {\n id,\n collection,\n depth,\n overrideAccess,\n payload,\n populate,\n req: await createLocalReq(options, payload),\n select,\n showHiddenFields,\n }\n\n return restoreVersionOperation(args)\n}\n"],"names":["APIError","createLocalReq","restoreVersionOperation","restoreVersionLocal","payload","options","id","collection","collectionSlug","depth","overrideAccess","populate","select","showHiddenFields","collections","String","args","req"],"mappings":"AAAA,oBAAoB;AAKpB,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,uBAAuB,QAAQ,uBAAsB;AAgE9D,eAAe,eAAeC,oBAC5BC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EACJC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EACjB,GAAGR;IAEJ,MAAME,aAAaH,QAAQU,WAAW,CAACN,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIP,SACR,CAAC,yBAAyB,EAAEe,OAC1BP,gBACA,2CAA2C,CAAC;IAElD;IAEA,MAAMQ,OAAO;QACXV;QACAC;QACAE;QACAC;QACAN;QACAO;QACAM,KAAK,MAAMhB,eAAeI,SAASD;QACnCQ;QACAC;IACF;IAEA,OAAOX,wBAAwBc;AACjC"}
@@ -4,38 +4,125 @@ import type { Document, PayloadRequest, PopulateType, SelectType, TransformColle
4
4
  import type { File } from '../../../uploads/types.js';
5
5
  import type { BulkOperationResult, RequiredDataFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js';
6
6
  export type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {
7
+ /**
8
+ * Whether the current update should be marked as from autosave.
9
+ * `versions.drafts.autosave` should be specified.
10
+ */
7
11
  autosave?: boolean;
12
+ /**
13
+ * the Collection slug to operate against.
14
+ */
8
15
  collection: TSlug;
9
16
  /**
10
- * context, which will then be passed to req.context, which can be read by hooks
17
+ * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,
18
+ * which can be read by hooks. Useful if you want to pass additional information to the hooks which
19
+ * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook
20
+ * to determine if it should run or not.
11
21
  */
12
22
  context?: RequestContext;
23
+ /**
24
+ * The document / documents data to update.
25
+ */
13
26
  data: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>;
27
+ /**
28
+ * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
29
+ */
14
30
  depth?: number;
31
+ /**
32
+ * When set to `true`, a [database transactions](https://payloadcms.com/docs/database/transactions) will not be initialized.
33
+ * @default false
34
+ */
15
35
  disableTransaction?: boolean;
36
+ /**
37
+ * Update documents to a draft.
38
+ */
16
39
  draft?: boolean;
40
+ /**
41
+ * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.
42
+ */
17
43
  fallbackLocale?: false | TypedLocale;
44
+ /**
45
+ * A `File` object when updating a collection with `upload: true`.
46
+ */
18
47
  file?: File;
48
+ /**
49
+ * A file path when creating a collection with `upload: true`.
50
+ */
19
51
  filePath?: string;
52
+ /**
53
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
54
+ */
20
55
  locale?: TypedLocale;
56
+ /**
57
+ * Skip access control.
58
+ * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the fron-end.
59
+ * @default true
60
+ */
21
61
  overrideAccess?: boolean;
62
+ /**
63
+ * By default, document locks are ignored (`true`). Set to `false` to enforce locks and prevent operations when a document is locked by another user. [More details](https://payloadcms.com/docs/admin/locked-documents).
64
+ * @default true
65
+ */
22
66
  overrideLock?: boolean;
67
+ /**
68
+ * If you are uploading a file and would like to replace
69
+ * the existing file instead of generating a new filename,
70
+ * you can set the following property to `true`
71
+ */
23
72
  overwriteExistingFiles?: boolean;
73
+ /**
74
+ * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
75
+ */
24
76
  populate?: PopulateType;
77
+ /**
78
+ * Publish the document / documents with a specific locale.
79
+ */
25
80
  publishSpecificLocale?: string;
81
+ /**
82
+ * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.
83
+ * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.
84
+ */
26
85
  req?: Partial<PayloadRequest>;
86
+ /**
87
+ * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
88
+ */
27
89
  select?: TSelect;
90
+ /**
91
+ * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.
92
+ * @default false
93
+ */
28
94
  showHiddenFields?: boolean;
95
+ /**
96
+ * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
97
+ */
29
98
  user?: Document;
30
99
  };
31
100
  export type ByIDOptions<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>> = {
101
+ /**
102
+ * The ID of the document to update.
103
+ */
32
104
  id: number | string;
105
+ /**
106
+ * Limit documents to update
107
+ */
33
108
  limit?: never;
109
+ /**
110
+ * A filter [query](https://payloadcms.com/docs/queries/overview)
111
+ */
34
112
  where?: never;
35
113
  } & BaseOptions<TSlug, TSelect>;
36
114
  export type ManyOptions<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>> = {
115
+ /**
116
+ * The ID of the document to update.
117
+ */
37
118
  id?: never;
119
+ /**
120
+ * Limit documents to update
121
+ */
38
122
  limit?: number;
123
+ /**
124
+ * A filter [query](https://payloadcms.com/docs/queries/overview)
125
+ */
39
126
  where: Where;
40
127
  } & BaseOptions<TSlug, TSelect>;
41
128
  export type Options<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>> = ByIDOptions<TSlug, TSelect> | ManyOptions<TSlug, TSelect>;
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/update.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC7B,KAAK,EACN,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,KAAK,EACV,mBAAmB,EACnB,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,uBAAuB,CAAA;AAQ9B,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI;IAClF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,KAAK,CAAA;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,IAAI,EAAE,WAAW,CAAC,8BAA8B,CAAC,KAAK,CAAC,CAAC,CAAA;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC,IAAI,CAAC,E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OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AAmE/F,eAAe,WAAW,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/update.ts"],"sourcesContent":["// @ts-strict-ignore\nimport type { DeepPartial } from 'ts-essentials'\n\nimport type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n Where,\n} from '../../../types/index.js'\nimport type { File } from '../../../uploads/types.js'\nimport type {\n BulkOperationResult,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { getFileByPath } from '../../../uploads/getFileByPath.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { updateOperation } from '../update.js'\nimport { updateByIDOperation } from '../updateByID.js'\n\nexport type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n autosave?: boolean\n collection: TSlug\n /**\n * context, which will then be passed to req.context, which can be read by hooks\n */\n context?: RequestContext\n data: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>\n depth?: number\n disableTransaction?: boolean\n draft?: boolean\n fallbackLocale?: false | TypedLocale\n file?: File\n filePath?: string\n locale?: TypedLocale\n overrideAccess?: boolean\n overrideLock?: boolean\n overwriteExistingFiles?: boolean\n populate?: PopulateType\n publishSpecificLocale?: string\n req?: Partial<PayloadRequest>\n select?: TSelect\n showHiddenFields?: boolean\n user?: Document\n}\n\nexport type ByIDOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n id: number | string\n limit?: never\n where?: never\n} & BaseOptions<TSlug, TSelect>\n\nexport type ManyOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n id?: never\n limit?: number\n where: Where\n} & BaseOptions<TSlug, TSelect>\n\nexport type Options<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = ByIDOptions<TSlug, TSelect> | ManyOptions<TSlug, TSelect>\n\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ByIDOptions<TSlug, TSelect>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ManyOptions<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>> {\n const {\n id,\n autosave,\n collection: collectionSlug,\n data,\n depth,\n disableTransaction,\n draft,\n file,\n filePath,\n limit,\n overrideAccess = true,\n overrideLock,\n overwriteExistingFiles = false,\n populate,\n publishSpecificLocale,\n select,\n showHiddenFields,\n where,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Update Operation.`,\n )\n }\n\n const req = await createLocalReq(options, payload)\n req.file = file ?? (await getFileByPath(filePath))\n\n const args = {\n id,\n autosave,\n collection,\n data,\n depth,\n disableTransaction,\n draft,\n limit,\n overrideAccess,\n overrideLock,\n overwriteExistingFiles,\n payload,\n populate,\n publishSpecificLocale,\n req,\n select,\n showHiddenFields,\n where,\n }\n\n if (options.id) {\n return updateByIDOperation<TSlug, TSelect>(args)\n }\n return updateOperation<TSlug, TSelect>(args)\n}\n\nexport default updateLocal\n"],"names":["APIError","getFileByPath","createLocalReq","updateOperation","updateByIDOperation","updateLocal","payload","options","id","autosave","collection","collectionSlug","data","depth","disableTransaction","draft","file","filePath","limit","overrideAccess","overrideLock","overwriteExistingFiles","populate","publishSpecificLocale","select","showHiddenFields","where","collections","String","req","args"],"mappings":"AAAA,oBAAoB;AAmBpB,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,aAAa,QAAQ,oCAAmC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AAC9C,SAASC,mBAAmB,QAAQ,mBAAkB;AAwEtD,eAAeC,YAIbC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,EAAE,EACFC,QAAQ,EACRC,YAAYC,cAAc,EAC1BC,IAAI,EACJC,KAAK,EACLC,kBAAkB,EAClBC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,YAAY,EACZC,yBAAyB,KAAK,EAC9BC,QAAQ,EACRC,qBAAqB,EACrBC,MAAM,EACNC,gBAAgB,EAChBC,KAAK,EACN,GAAGnB;IAEJ,MAAMG,aAAaJ,QAAQqB,WAAW,CAAChB,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIV,SACR,CAAC,yBAAyB,EAAE4B,OAAOjB,gBAAgB,kCAAkC,CAAC;IAE1F;IAEA,MAAMkB,MAAM,MAAM3B,eAAeK,SAASD;IAC1CuB,IAAIb,IAAI,GAAGA,QAAS,MAAMf,cAAcgB;IAExC,MAAMa,OAAO;QACXtB;QACAC;QACAC;QACAE;QACAC;QACAC;QACAC;QACAG;QACAC;QACAC;QACAC;QACAf;QACAgB;QACAC;QACAM;QACAL;QACAC;QACAC;IACF;IAEA,IAAInB,QAAQC,EAAE,EAAE;QACd,OAAOJ,oBAAoC0B;IAC7C;IACA,OAAO3B,gBAAgC2B;AACzC;AAEA,eAAezB,YAAW"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/update.ts"],"sourcesContent":["// @ts-strict-ignore\nimport type { DeepPartial } from 'ts-essentials'\n\nimport type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n Where,\n} from '../../../types/index.js'\nimport type { File } from '../../../uploads/types.js'\nimport type {\n BulkOperationResult,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { getFileByPath } from '../../../uploads/getFileByPath.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { updateOperation } from '../update.js'\nimport { updateByIDOperation } from '../updateByID.js'\n\nexport type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n /**\n * Whether the current update should be marked as from autosave.\n * `versions.drafts.autosave` should be specified.\n */\n autosave?: boolean\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * The document / documents data to update.\n */\n data: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, a [database transactions](https://payloadcms.com/docs/database/transactions) will not be initialized.\n * @default false\n */\n disableTransaction?: boolean\n /**\n * Update documents to a draft.\n */\n draft?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * A `File` object when updating a collection with `upload: true`.\n */\n file?: File\n /**\n * A file path when creating a collection with `upload: true`.\n */\n filePath?: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the fron-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * By default, document locks are ignored (`true`). Set to `false` to enforce locks and prevent operations when a document is locked by another user. [More details](https://payloadcms.com/docs/admin/locked-documents).\n * @default true\n */\n overrideLock?: boolean\n /**\n * If you are uploading a file and would like to replace\n * the existing file instead of generating a new filename,\n * you can set the following property to `true`\n */\n overwriteExistingFiles?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * Publish the document / documents with a specific locale.\n */\n publishSpecificLocale?: string\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.\n */\n select?: TSelect\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n}\n\nexport type ByIDOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to update.\n */\n id: number | string\n /**\n * Limit documents to update\n */\n limit?: never\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: never\n} & BaseOptions<TSlug, TSelect>\n\nexport type ManyOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to update.\n */\n id?: never\n /**\n * Limit documents to update\n */\n limit?: number\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where: Where\n} & BaseOptions<TSlug, TSelect>\n\nexport type Options<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = ByIDOptions<TSlug, TSelect> | ManyOptions<TSlug, TSelect>\n\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ByIDOptions<TSlug, TSelect>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ManyOptions<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>> {\n const {\n id,\n autosave,\n collection: collectionSlug,\n data,\n depth,\n disableTransaction,\n draft,\n file,\n filePath,\n limit,\n overrideAccess = true,\n overrideLock,\n overwriteExistingFiles = false,\n populate,\n publishSpecificLocale,\n select,\n showHiddenFields,\n where,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Update Operation.`,\n )\n }\n\n const req = await createLocalReq(options, payload)\n req.file = file ?? (await getFileByPath(filePath))\n\n const args = {\n id,\n autosave,\n collection,\n data,\n depth,\n disableTransaction,\n draft,\n limit,\n overrideAccess,\n overrideLock,\n overwriteExistingFiles,\n payload,\n populate,\n publishSpecificLocale,\n req,\n select,\n showHiddenFields,\n where,\n }\n\n if (options.id) {\n return updateByIDOperation<TSlug, TSelect>(args)\n }\n return updateOperation<TSlug, TSelect>(args)\n}\n\nexport default updateLocal\n"],"names":["APIError","getFileByPath","createLocalReq","updateOperation","updateByIDOperation","updateLocal","payload","options","id","autosave","collection","collectionSlug","data","depth","disableTransaction","draft","file","filePath","limit","overrideAccess","overrideLock","overwriteExistingFiles","populate","publishSpecificLocale","select","showHiddenFields","where","collections","String","req","args"],"mappings":"AAAA,oBAAoB;AAmBpB,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,aAAa,QAAQ,oCAAmC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AAC9C,SAASC,mBAAmB,QAAQ,mBAAkB;AA+JtD,eAAeC,YAIbC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,EAAE,EACFC,QAAQ,EACRC,YAAYC,cAAc,EAC1BC,IAAI,EACJC,KAAK,EACLC,kBAAkB,EAClBC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,YAAY,EACZC,yBAAyB,KAAK,EAC9BC,QAAQ,EACRC,qBAAqB,EACrBC,MAAM,EACNC,gBAAgB,EAChBC,KAAK,EACN,GAAGnB;IAEJ,MAAMG,aAAaJ,QAAQqB,WAAW,CAAChB,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIV,SACR,CAAC,yBAAyB,EAAE4B,OAAOjB,gBAAgB,kCAAkC,CAAC;IAE1F;IAEA,MAAMkB,MAAM,MAAM3B,eAAeK,SAASD;IAC1CuB,IAAIb,IAAI,GAAGA,QAAS,MAAMf,cAAcgB;IAExC,MAAMa,OAAO;QACXtB;QACAC;QACAC;QACAE;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3B,CAAA;AA6BD,eAAO,MAAM,kBAAkB,gDAK5B;IACD,MAAM,EAAE,CAAC,KAAK,GAAG,MAAM,CAAC,EAAE,CAAA;IAC1B,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,CAAA;IACvD,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;CACrB,KAAG,CAAC,WAAW,GAAG,MAAM,CAAC,EAAE,GAAG,WAAW,EAqEzC,CAAA;AAED,eAAO,MAAM,iBAAiB,8DAK3B;IACD,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,CAAA;IACvD,KAAK,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;CACrB,KAAG,WAsQH,CAAA;AAED,eAAO,MAAM,kBAAkB,iEAM5B;IACD,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,CAAA;IACvD,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;CACrB,KAAG,WAAW,EAkCd,CAAA"}
@@ -40,10 +40,14 @@ export const createClientBlocks = ({ blocks, defaultIDType, i18n, importMap })=>
40
40
  if (block.imageURL) {
41
41
  clientBlock.imageURL = block.imageURL;
42
42
  }
43
- if (block.admin?.custom) {
44
- clientBlock.admin = {
45
- custom: block.admin.custom
46
- };
43
+ if (block.admin?.custom || block.admin?.group) {
44
+ clientBlock.admin = {};
45
+ if (block.admin.custom) {
46
+ clientBlock.admin.custom = block.admin.custom;
47
+ }
48
+ if (block.admin.group) {
49
+ clientBlock.admin.group = block.admin.group;
50
+ }
47
51
  }
48
52
  if (block?.admin?.jsx) {
49
53
  const jsxResolved = getFromImportMap({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/config/client.ts"],"sourcesContent":["// @ts-strict-ignore\n/* eslint-disable perfectionist/sort-switch-case */\n// Keep perfectionist/sort-switch-case disabled - it incorrectly messes up the ordering of the switch cases, causing it to break\nimport type { I18nClient } from '@payloadcms/translations'\n\nimport type {\n AdminClient,\n ArrayFieldClient,\n Block,\n BlockJSX,\n BlocksFieldClient,\n ClientBlock,\n ClientField,\n Field,\n FieldBase,\n JoinFieldClient,\n LabelsClient,\n RadioFieldClient,\n RowFieldClient,\n SelectFieldClient,\n TabsFieldClient,\n} from '../../fields/config/types.js'\nimport type { Payload } from '../../types/index.js'\n\nimport { getFromImportMap } from '../../bin/generateImportMap/getFromImportMap.js'\nimport { MissingEditorProp } from '../../errors/MissingEditorProp.js'\nimport { fieldAffectsData } from '../../fields/config/types.js'\nimport { flattenTopLevelFields, type ImportMap } from '../../index.js'\n\n// Should not be used - ClientField should be used instead. This is why we don't export ClientField, we don't want people\n// to accidentally use it instead of ClientField and get confused\n\nexport { ClientField }\n\nexport type ServerOnlyFieldProperties =\n | 'dbName' // can be a function\n | 'editor' // This is a `richText` only property\n | 'enumName' // can be a function\n | 'filterOptions' // This is a `relationship` and `upload` only property\n | 'graphQL'\n | 'label'\n | 'typescriptSchema'\n | 'validate'\n | keyof Pick<FieldBase, 'access' | 'custom' | 'defaultValue' | 'hooks'>\n\nexport type ServerOnlyFieldAdminProperties = keyof Pick<\n FieldBase['admin'],\n 'components' | 'condition'\n>\n\nconst serverOnlyFieldProperties: Partial<ServerOnlyFieldProperties>[] = [\n 'hooks',\n 'access',\n 'validate',\n 'defaultValue',\n 'filterOptions', // This is a `relationship` and `upload` only property\n 'editor', // This is a `richText` only property\n 'custom',\n 'typescriptSchema',\n 'dbName', // can be a function\n 'enumName', // can be a function\n 'graphQL', // client does not need graphQL\n // the following props are handled separately (see below):\n // `label`\n // `fields`\n // `blocks`\n // `tabs`\n // `admin`\n]\nconst serverOnlyFieldAdminProperties: Partial<ServerOnlyFieldAdminProperties>[] = [\n 'condition',\n 'components',\n]\ntype FieldWithDescription = {\n admin: AdminClient\n} & ClientField\n\nexport const createClientBlocks = ({\n blocks,\n defaultIDType,\n i18n,\n importMap,\n}: {\n blocks: (Block | string)[]\n defaultIDType: Payload['config']['db']['defaultIDType']\n i18n: I18nClient\n importMap: ImportMap\n}): (ClientBlock | string)[] | ClientBlock[] => {\n const clientBlocks: (ClientBlock | string)[] = []\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i]\n\n if (typeof block === 'string') {\n // Do not process blocks that are just strings - they are processed once in the client config\n clientBlocks.push(block)\n continue\n }\n\n const clientBlock: ClientBlock = {\n slug: block.slug,\n fields: [],\n }\n if (block.imageAltText) {\n clientBlock.imageAltText = block.imageAltText\n }\n if (block.imageURL) {\n clientBlock.imageURL = block.imageURL\n }\n\n if (block.admin?.custom) {\n clientBlock.admin = {\n custom: block.admin.custom,\n }\n }\n\n if (block?.admin?.jsx) {\n const jsxResolved = getFromImportMap<BlockJSX>({\n importMap,\n PayloadComponent: block.admin.jsx,\n schemaPath: '',\n })\n clientBlock.jsx = jsxResolved\n }\n\n if (block.labels) {\n clientBlock.labels = {} as unknown as LabelsClient\n\n if (block.labels.singular) {\n if (typeof block.labels.singular === 'function') {\n clientBlock.labels.singular = block.labels.singular({ t: i18n.t })\n } else {\n clientBlock.labels.singular = block.labels.singular\n }\n if (typeof block.labels.plural === 'function') {\n clientBlock.labels.plural = block.labels.plural({ t: i18n.t })\n } else {\n clientBlock.labels.plural = block.labels.plural\n }\n }\n }\n\n clientBlock.fields = createClientFields({\n defaultIDType,\n fields: block.fields,\n i18n,\n importMap,\n })\n\n clientBlocks.push(clientBlock)\n }\n\n return clientBlocks\n}\n\nexport const createClientField = ({\n defaultIDType,\n field: incomingField,\n i18n,\n importMap,\n}: {\n defaultIDType: Payload['config']['db']['defaultIDType']\n field: Field\n i18n: I18nClient\n importMap: ImportMap\n}): ClientField => {\n const clientField: ClientField = {} as ClientField\n\n for (const key in incomingField) {\n if (serverOnlyFieldProperties.includes(key as any)) {\n continue\n }\n\n switch (key) {\n case 'admin':\n if (!incomingField.admin) {\n break\n }\n\n clientField.admin = {} as AdminClient\n\n for (const adminKey in incomingField.admin) {\n if (serverOnlyFieldAdminProperties.includes(adminKey as any)) {\n continue\n }\n\n switch (adminKey) {\n case 'description':\n if ('description' in incomingField.admin) {\n if (typeof incomingField.admin?.description !== 'function') {\n ;(clientField as FieldWithDescription).admin.description =\n incomingField.admin.description\n }\n }\n\n break\n\n default:\n clientField.admin[adminKey] = incomingField.admin[adminKey]\n }\n }\n\n break\n\n case 'blocks':\n case 'fields':\n case 'tabs':\n // Skip - we handle sub-fields in the switch below\n break\n\n case 'label':\n //@ts-expect-error - would need to type narrow\n if (typeof incomingField.label === 'function') {\n //@ts-expect-error - would need to type narrow\n clientField.label = incomingField.label({ t: i18n.t })\n } else {\n //@ts-expect-error - would need to type narrow\n clientField.label = incomingField.label\n }\n\n break\n\n default:\n clientField[key] = incomingField[key]\n }\n }\n\n switch (incomingField.type) {\n case 'array': {\n if (incomingField.labels) {\n const field = clientField as unknown as ArrayFieldClient\n\n field.labels = {} as unknown as LabelsClient\n\n if (incomingField.labels.singular) {\n if (typeof incomingField.labels.singular === 'function') {\n field.labels.singular = incomingField.labels.singular({ t: i18n.t })\n } else {\n field.labels.singular = incomingField.labels.singular\n }\n if (typeof incomingField.labels.plural === 'function') {\n field.labels.plural = incomingField.labels.plural({ t: i18n.t })\n } else {\n field.labels.plural = incomingField.labels.plural\n }\n }\n }\n }\n // falls through\n case 'collapsible':\n case 'group':\n case 'row': {\n const field = clientField as unknown as RowFieldClient\n\n if (!field.fields) {\n field.fields = []\n }\n\n field.fields = createClientFields({\n defaultIDType,\n disableAddingID: incomingField.type !== 'array',\n fields: incomingField.fields,\n i18n,\n importMap,\n })\n\n break\n }\n\n case 'blocks': {\n const field = clientField as unknown as BlocksFieldClient\n\n if (incomingField.labels) {\n field.labels = {} as unknown as LabelsClient\n\n if (incomingField.labels.singular) {\n if (typeof incomingField.labels.singular === 'function') {\n field.labels.singular = incomingField.labels.singular({ t: i18n.t })\n } else {\n field.labels.singular = incomingField.labels.singular\n }\n if (typeof incomingField.labels.plural === 'function') {\n field.labels.plural = incomingField.labels.plural({ t: i18n.t })\n } else {\n field.labels.plural = incomingField.labels.plural\n }\n }\n }\n\n if (incomingField.blockReferences?.length) {\n field.blockReferences = createClientBlocks({\n blocks: incomingField.blockReferences,\n defaultIDType,\n i18n,\n importMap,\n })\n }\n\n if (incomingField.blocks?.length) {\n field.blocks = createClientBlocks({\n blocks: incomingField.blocks,\n defaultIDType,\n i18n,\n importMap,\n }) as ClientBlock[]\n }\n\n break\n }\n\n case 'join': {\n const field = clientField as JoinFieldClient\n\n field.targetField = {\n relationTo: field.targetField?.relationTo,\n }\n\n break\n }\n\n case 'radio':\n // falls through\n case 'select': {\n const field = clientField as RadioFieldClient | SelectFieldClient\n\n if (incomingField.options?.length) {\n for (let i = 0; i < incomingField.options.length; i++) {\n const option = incomingField.options[i]\n\n if (typeof option === 'object' && typeof option.label === 'function') {\n if (!field.options) {\n field.options = []\n }\n\n field.options[i] = {\n label: option.label({ t: i18n.t }),\n value: option.value,\n }\n }\n }\n }\n\n break\n }\n\n case 'richText': {\n if (!incomingField?.editor) {\n throw new MissingEditorProp(incomingField) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof incomingField?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n break\n }\n\n case 'tabs': {\n const field = clientField as unknown as TabsFieldClient\n\n if (incomingField.tabs?.length) {\n field.tabs = []\n\n for (let i = 0; i < incomingField.tabs.length; i++) {\n const tab = incomingField.tabs[i]\n const clientTab = {} as unknown as TabsFieldClient['tabs'][0]\n\n for (const key in tab) {\n if (serverOnlyFieldProperties.includes(key as any)) {\n continue\n }\n\n const tabProp = tab[key]\n\n if (key === 'fields') {\n clientTab.fields = createClientFields({\n defaultIDType,\n disableAddingID: true,\n fields: tab.fields,\n i18n,\n importMap,\n })\n } else if (\n (key === 'label' || key === 'description') &&\n typeof tabProp === 'function'\n ) {\n clientTab[key] = tabProp({ t: i18n.t })\n } else if (key === 'admin') {\n clientTab.admin = {} as AdminClient\n\n for (const adminKey in tab.admin) {\n if (serverOnlyFieldAdminProperties.includes(adminKey as any)) {\n continue\n }\n\n switch (adminKey) {\n case 'description':\n if ('description' in tab.admin) {\n if (typeof tab.admin?.description === 'function') {\n clientTab.admin.description = tab.admin.description({ t: i18n.t })\n } else {\n clientTab.admin.description = tab.admin.description\n }\n }\n\n break\n\n default:\n clientField.admin[adminKey] = tab.admin[adminKey]\n }\n }\n } else {\n clientTab[key] = tabProp\n }\n }\n field.tabs[i] = clientTab\n }\n }\n\n break\n }\n\n default:\n break\n }\n\n return clientField\n}\n\nexport const createClientFields = ({\n defaultIDType,\n disableAddingID,\n fields,\n i18n,\n importMap,\n}: {\n defaultIDType: Payload['config']['db']['defaultIDType']\n disableAddingID?: boolean\n fields: Field[]\n i18n: I18nClient\n importMap: ImportMap\n}): ClientField[] => {\n const clientFields: ClientField[] = []\n\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i]\n\n const clientField = createClientField({\n defaultIDType,\n field,\n i18n,\n importMap,\n })\n\n clientFields.push(clientField)\n }\n\n const hasID = flattenTopLevelFields(fields).some((f) => fieldAffectsData(f) && f.name === 'id')\n\n if (!disableAddingID && !hasID) {\n clientFields.push({\n name: 'id',\n type: defaultIDType,\n admin: {\n description: 'The unique identifier for this document',\n disableBulkEdit: true,\n disabled: true,\n hidden: true,\n },\n hidden: true,\n label: 'ID',\n })\n }\n\n return clientFields\n}\n"],"names":["getFromImportMap","MissingEditorProp","fieldAffectsData","flattenTopLevelFields","serverOnlyFieldProperties","serverOnlyFieldAdminProperties","createClientBlocks","blocks","defaultIDType","i18n","importMap","clientBlocks","i","length","block","push","clientBlock","slug","fields","imageAltText","imageURL","admin","custom","jsx","jsxResolved","PayloadComponent","schemaPath","labels","singular","t","plural","createClientFields","createClientField","field","incomingField","clientField","key","includes","adminKey","description","label","type","disableAddingID","blockReferences","targetField","relationTo","options","option","value","editor","Error","tabs","tab","clientTab","tabProp","clientFields","hasID","some","f","name","disableBulkEdit","disabled","hidden"],"mappings":"AAAA,oBAAoB;AACpB,iDAAiD,GACjD,gIAAgI;AAsBhI,SAASA,gBAAgB,QAAQ,kDAAiD;AAClF,SAASC,iBAAiB,QAAQ,oCAAmC;AACrE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,qBAAqB,QAAwB,iBAAgB;AAuBtE,MAAMC,4BAAkE;IACtE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CAOD;AACD,MAAMC,iCAA4E;IAChF;IACA;CACD;AAKD,OAAO,MAAMC,qBAAqB,CAAC,EACjCC,MAAM,EACNC,aAAa,EACbC,IAAI,EACJC,SAAS,EAMV;IACC,MAAMC,eAAyC,EAAE;IACjD,IAAK,IAAIC,IAAI,GAAGA,IAAIL,OAAOM,MAAM,EAAED,IAAK;QACtC,MAAME,QAAQP,MAAM,CAACK,EAAE;QAEvB,IAAI,OAAOE,UAAU,UAAU;YAC7B,6FAA6F;YAC7FH,aAAaI,IAAI,CAACD;YAClB;QACF;QAEA,MAAME,cAA2B;YAC/BC,MAAMH,MAAMG,IAAI;YAChBC,QAAQ,EAAE;QACZ;QACA,IAAIJ,MAAMK,YAAY,EAAE;YACtBH,YAAYG,YAAY,GAAGL,MAAMK,YAAY;QAC/C;QACA,IAAIL,MAAMM,QAAQ,EAAE;YAClBJ,YAAYI,QAAQ,GAAGN,MAAMM,QAAQ;QACvC;QAEA,IAAIN,MAAMO,KAAK,EAAEC,QAAQ;YACvBN,YAAYK,KAAK,GAAG;gBAClBC,QAAQR,MAAMO,KAAK,CAACC,MAAM;YAC5B;QACF;QAEA,IAAIR,OAAOO,OAAOE,KAAK;YACrB,MAAMC,cAAcxB,iBAA2B;gBAC7CU;g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wCAEF;4CACEJ,YAAYd,KAAK,CAACiB,SAAS,GAAGc,IAAI/B,KAAK,CAACiB,SAAS;oCACrD;gCACF;4BACF,OAAO;gCACLe,SAAS,CAACjB,IAAI,GAAGkB;4BACnB;wBACF;wBACArB,MAAMkB,IAAI,CAACvC,EAAE,GAAGyC;oBAClB;gBACF;gBAEA;YACF;QAEA;YACE;IACJ;IAEA,OAAOlB;AACT,EAAC;AAED,OAAO,MAAMJ,qBAAqB,CAAC,EACjCvB,aAAa,EACbkC,eAAe,EACfxB,MAAM,EACNT,IAAI,EACJC,SAAS,EAOV;IACC,MAAM6C,eAA8B,EAAE;IAEtC,IAAK,IAAI3C,IAAI,GAAGA,IAAIM,OAAOL,MAAM,EAAED,IAAK;QACtC,MAAMqB,QAAQf,MAAM,CAACN,EAAE;QAEvB,MAAMuB,cAAcH,kBAAkB;YACpCxB;YACAyB;YACAxB;YACAC;QACF;QAEA6C,aAAaxC,IAAI,CAACoB;IACpB;IAEA,MAAMqB,QAAQrD,sBAAsBe,QAAQuC,IAAI,CAAC,CAACC,IAAMxD,iBAAiBwD,MAAMA,EAAEC,IAAI,KAAK;IAE1F,IAAI,CAACjB,mBAAmB,CAACc,OAAO;QAC9BD,aAAaxC,IAAI,CAAC;YAChB4C,MAAM;YACNlB,MAAMjC;YACNa,OAAO;gBACLkB,aAAa;gBACbqB,iBAAiB;gBACjBC,UAAU;gBACVC,QAAQ;YACV;YACAA,QAAQ;YACRtB,OAAO;QACT;IACF;IAEA,OAAOe;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/fields/config/client.ts"],"sourcesContent":["// @ts-strict-ignore\n/* eslint-disable perfectionist/sort-switch-case */\n// Keep perfectionist/sort-switch-case disabled - it incorrectly messes up the ordering of the switch cases, causing it to break\nimport type { I18nClient } from '@payloadcms/translations'\n\nimport type {\n AdminClient,\n ArrayFieldClient,\n Block,\n BlockJSX,\n BlocksFieldClient,\n ClientBlock,\n ClientField,\n Field,\n FieldBase,\n JoinFieldClient,\n LabelsClient,\n RadioFieldClient,\n RowFieldClient,\n SelectFieldClient,\n TabsFieldClient,\n} from '../../fields/config/types.js'\nimport type { Payload } from '../../types/index.js'\n\nimport { getFromImportMap } from '../../bin/generateImportMap/getFromImportMap.js'\nimport { MissingEditorProp } from '../../errors/MissingEditorProp.js'\nimport { fieldAffectsData } from '../../fields/config/types.js'\nimport { flattenTopLevelFields, type ImportMap } from '../../index.js'\n\n// Should not be used - ClientField should be used instead. This is why we don't export ClientField, we don't want people\n// to accidentally use it instead of ClientField and get confused\n\nexport { ClientField }\n\nexport type ServerOnlyFieldProperties =\n | 'dbName' // can be a function\n | 'editor' // This is a `richText` only property\n | 'enumName' // can be a function\n | 'filterOptions' // This is a `relationship` and `upload` only property\n | 'graphQL'\n | 'label'\n | 'typescriptSchema'\n | 'validate'\n | keyof Pick<FieldBase, 'access' | 'custom' | 'defaultValue' | 'hooks'>\n\nexport type ServerOnlyFieldAdminProperties = keyof Pick<\n FieldBase['admin'],\n 'components' | 'condition'\n>\n\nconst serverOnlyFieldProperties: Partial<ServerOnlyFieldProperties>[] = [\n 'hooks',\n 'access',\n 'validate',\n 'defaultValue',\n 'filterOptions', // This is a `relationship` and `upload` only property\n 'editor', // This is a `richText` only property\n 'custom',\n 'typescriptSchema',\n 'dbName', // can be a function\n 'enumName', // can be a function\n 'graphQL', // client does not need graphQL\n // the following props are handled separately (see below):\n // `label`\n // `fields`\n // `blocks`\n // `tabs`\n // `admin`\n]\nconst serverOnlyFieldAdminProperties: Partial<ServerOnlyFieldAdminProperties>[] = [\n 'condition',\n 'components',\n]\ntype FieldWithDescription = {\n admin: AdminClient\n} & ClientField\n\nexport const createClientBlocks = ({\n blocks,\n defaultIDType,\n i18n,\n importMap,\n}: {\n blocks: (Block | string)[]\n defaultIDType: Payload['config']['db']['defaultIDType']\n i18n: I18nClient\n importMap: ImportMap\n}): (ClientBlock | string)[] | ClientBlock[] => {\n const clientBlocks: (ClientBlock | string)[] = []\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i]\n\n if (typeof block === 'string') {\n // Do not process blocks that are just strings - they are processed once in the client config\n clientBlocks.push(block)\n continue\n }\n\n const clientBlock: ClientBlock = {\n slug: block.slug,\n fields: [],\n }\n if (block.imageAltText) {\n clientBlock.imageAltText = block.imageAltText\n }\n if (block.imageURL) {\n clientBlock.imageURL = block.imageURL\n }\n\n if (block.admin?.custom || block.admin?.group) {\n clientBlock.admin = {}\n if (block.admin.custom) {\n clientBlock.admin.custom = block.admin.custom\n }\n if (block.admin.group) {\n clientBlock.admin.group = block.admin.group\n }\n }\n\n if (block?.admin?.jsx) {\n const jsxResolved = getFromImportMap<BlockJSX>({\n importMap,\n PayloadComponent: block.admin.jsx,\n schemaPath: '',\n })\n clientBlock.jsx = jsxResolved\n }\n\n if (block.labels) {\n clientBlock.labels = {} as unknown as LabelsClient\n\n if (block.labels.singular) {\n if (typeof block.labels.singular === 'function') {\n clientBlock.labels.singular = block.labels.singular({ t: i18n.t })\n } else {\n clientBlock.labels.singular = block.labels.singular\n }\n if (typeof block.labels.plural === 'function') {\n clientBlock.labels.plural = block.labels.plural({ t: i18n.t })\n } else {\n clientBlock.labels.plural = block.labels.plural\n }\n }\n }\n\n clientBlock.fields = createClientFields({\n defaultIDType,\n fields: block.fields,\n i18n,\n importMap,\n })\n\n clientBlocks.push(clientBlock)\n }\n\n return clientBlocks\n}\n\nexport const createClientField = ({\n defaultIDType,\n field: incomingField,\n i18n,\n importMap,\n}: {\n defaultIDType: Payload['config']['db']['defaultIDType']\n field: Field\n i18n: I18nClient\n importMap: ImportMap\n}): ClientField => {\n const clientField: ClientField = {} as ClientField\n\n for (const key in incomingField) {\n if (serverOnlyFieldProperties.includes(key as any)) {\n continue\n }\n\n switch (key) {\n case 'admin':\n if (!incomingField.admin) {\n break\n }\n\n clientField.admin = {} as AdminClient\n\n for (const adminKey in incomingField.admin) {\n if (serverOnlyFieldAdminProperties.includes(adminKey as any)) {\n continue\n }\n\n switch (adminKey) {\n case 'description':\n if ('description' in incomingField.admin) {\n if (typeof incomingField.admin?.description !== 'function') {\n ;(clientField as FieldWithDescription).admin.description =\n incomingField.admin.description\n }\n }\n\n break\n\n default:\n clientField.admin[adminKey] = incomingField.admin[adminKey]\n }\n }\n\n break\n\n case 'blocks':\n case 'fields':\n case 'tabs':\n // Skip - we handle sub-fields in the switch below\n break\n\n case 'label':\n //@ts-expect-error - would need to type narrow\n if (typeof incomingField.label === 'function') {\n //@ts-expect-error - would need to type narrow\n clientField.label = incomingField.label({ t: i18n.t })\n } else {\n //@ts-expect-error - would need to type narrow\n clientField.label = incomingField.label\n }\n\n break\n\n default:\n clientField[key] = incomingField[key]\n }\n }\n\n switch (incomingField.type) {\n case 'array': {\n if (incomingField.labels) {\n const field = clientField as unknown as ArrayFieldClient\n\n field.labels = {} as unknown as LabelsClient\n\n if (incomingField.labels.singular) {\n if (typeof incomingField.labels.singular === 'function') {\n field.labels.singular = incomingField.labels.singular({ t: i18n.t })\n } else {\n field.labels.singular = incomingField.labels.singular\n }\n if (typeof incomingField.labels.plural === 'function') {\n field.labels.plural = incomingField.labels.plural({ t: i18n.t })\n } else {\n field.labels.plural = incomingField.labels.plural\n }\n }\n }\n }\n // falls through\n case 'collapsible':\n case 'group':\n case 'row': {\n const field = clientField as unknown as RowFieldClient\n\n if (!field.fields) {\n field.fields = []\n }\n\n field.fields = createClientFields({\n defaultIDType,\n disableAddingID: incomingField.type !== 'array',\n fields: incomingField.fields,\n i18n,\n importMap,\n })\n\n break\n }\n\n case 'blocks': {\n const field = clientField as unknown as BlocksFieldClient\n\n if (incomingField.labels) {\n field.labels = {} as unknown as LabelsClient\n\n if (incomingField.labels.singular) {\n if (typeof incomingField.labels.singular === 'function') {\n field.labels.singular = incomingField.labels.singular({ t: i18n.t })\n } else {\n field.labels.singular = incomingField.labels.singular\n }\n if (typeof incomingField.labels.plural === 'function') {\n field.labels.plural = incomingField.labels.plural({ t: i18n.t })\n } else {\n field.labels.plural = incomingField.labels.plural\n }\n }\n }\n\n if (incomingField.blockReferences?.length) {\n field.blockReferences = createClientBlocks({\n blocks: incomingField.blockReferences,\n defaultIDType,\n i18n,\n importMap,\n })\n }\n\n if (incomingField.blocks?.length) {\n field.blocks = createClientBlocks({\n blocks: incomingField.blocks,\n defaultIDType,\n i18n,\n importMap,\n }) as ClientBlock[]\n }\n\n break\n }\n\n case 'join': {\n const field = clientField as JoinFieldClient\n\n field.targetField = {\n relationTo: field.targetField?.relationTo,\n }\n\n break\n }\n\n case 'radio':\n // falls through\n case 'select': {\n const field = clientField as RadioFieldClient | SelectFieldClient\n\n if (incomingField.options?.length) {\n for (let i = 0; i < incomingField.options.length; i++) {\n const option = incomingField.options[i]\n\n if (typeof option === 'object' && typeof option.label === 'function') {\n if (!field.options) {\n field.options = []\n }\n\n field.options[i] = {\n label: option.label({ t: i18n.t }),\n value: option.value,\n }\n }\n }\n }\n\n break\n }\n\n case 'richText': {\n if (!incomingField?.editor) {\n throw new MissingEditorProp(incomingField) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof incomingField?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n break\n }\n\n case 'tabs': {\n const field = clientField as unknown as TabsFieldClient\n\n if (incomingField.tabs?.length) {\n field.tabs = []\n\n for (let i = 0; i < incomingField.tabs.length; i++) {\n const tab = incomingField.tabs[i]\n const clientTab = {} as unknown as TabsFieldClient['tabs'][0]\n\n for (const key in tab) {\n if (serverOnlyFieldProperties.includes(key as any)) {\n continue\n }\n\n const tabProp = tab[key]\n\n if (key === 'fields') {\n clientTab.fields = createClientFields({\n defaultIDType,\n disableAddingID: true,\n fields: tab.fields,\n i18n,\n importMap,\n })\n } else if (\n (key === 'label' || key === 'description') &&\n typeof tabProp === 'function'\n ) {\n clientTab[key] = tabProp({ t: i18n.t })\n } else if (key === 'admin') {\n clientTab.admin = {} as AdminClient\n\n for (const adminKey in tab.admin) {\n if (serverOnlyFieldAdminProperties.includes(adminKey as any)) {\n continue\n }\n\n switch (adminKey) {\n case 'description':\n if ('description' in tab.admin) {\n if (typeof tab.admin?.description === 'function') {\n clientTab.admin.description = tab.admin.description({ t: i18n.t })\n } else {\n clientTab.admin.description = tab.admin.description\n }\n }\n\n break\n\n default:\n clientField.admin[adminKey] = tab.admin[adminKey]\n }\n }\n } else {\n clientTab[key] = tabProp\n }\n }\n field.tabs[i] = clientTab\n }\n }\n\n break\n }\n\n default:\n break\n }\n\n return clientField\n}\n\nexport const createClientFields = ({\n defaultIDType,\n disableAddingID,\n fields,\n i18n,\n importMap,\n}: {\n defaultIDType: Payload['config']['db']['defaultIDType']\n disableAddingID?: boolean\n fields: Field[]\n i18n: I18nClient\n importMap: ImportMap\n}): ClientField[] => {\n const clientFields: ClientField[] = []\n\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i]\n\n const clientField = createClientField({\n defaultIDType,\n field,\n i18n,\n importMap,\n })\n\n clientFields.push(clientField)\n }\n\n const hasID = flattenTopLevelFields(fields).some((f) => fieldAffectsData(f) && f.name === 'id')\n\n if (!disableAddingID && !hasID) {\n clientFields.push({\n name: 'id',\n type: defaultIDType,\n admin: {\n description: 'The unique identifier for this document',\n disableBulkEdit: true,\n disabled: true,\n hidden: true,\n },\n hidden: true,\n label: 'ID',\n })\n }\n\n return clientFields\n}\n"],"names":["getFromImportMap","MissingEditorProp","fieldAffectsData","flattenTopLevelFields","serverOnlyFieldProperties","serverOnlyFieldAdminProperties","createClientBlocks","blocks","defaultIDType","i18n","importMap","clientBlocks","i","length","block","push","clientBlock","slug","fields","imageAltText","imageURL","admin","custom","group","jsx","jsxResolved","PayloadComponent","schemaPath","labels","singular","t","plural","createClientFields","createClientField","field","incomingField","clientField","key","includes","adminKey","description","label","type","disableAddingID","blockReferences","targetField","relationTo","options","option","value","editor","Error","tabs","tab","clientTab","tabProp","clientFields","hasID","some","f","name","disableBulkEdit","disabled","hidden"],"mappings":"AAAA,oBAAoB;AACpB,iDAAiD,GACjD,gIAAgI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;wCAEF;4CACEJ,YAAYf,KAAK,CAACkB,SAAS,GAAGc,IAAIhC,KAAK,CAACkB,SAAS;oCACrD;gCACF;4BACF,OAAO;gCACLe,SAAS,CAACjB,IAAI,GAAGkB;4BACnB;wBACF;wBACArB,MAAMkB,IAAI,CAACxC,EAAE,GAAG0C;oBAClB;gBACF;gBAEA;YACF;QAEA;YACE;IACJ;IAEA,OAAOlB;AACT,EAAC;AAED,OAAO,MAAMJ,qBAAqB,CAAC,EACjCxB,aAAa,EACbmC,eAAe,EACfzB,MAAM,EACNT,IAAI,EACJC,SAAS,EAOV;IACC,MAAM8C,eAA8B,EAAE;IAEtC,IAAK,IAAI5C,IAAI,GAAGA,IAAIM,OAAOL,MAAM,EAAED,IAAK;QACtC,MAAMsB,QAAQhB,MAAM,CAACN,EAAE;QAEvB,MAAMwB,cAAcH,kBAAkB;YACpCzB;YACA0B;YACAzB;YACAC;QACF;QAEA8C,aAAazC,IAAI,CAACqB;IACpB;IAEA,MAAMqB,QAAQtD,sBAAsBe,QAAQwC,IAAI,CAAC,CAACC,IAAMzD,iBAAiByD,MAAMA,EAAEC,IAAI,KAAK;IAE1F,IAAI,CAACjB,mBAAmB,CAACc,OAAO;QAC9BD,aAAazC,IAAI,CAAC;YAChB6C,MAAM;YACNlB,MAAMlC;YACNa,OAAO;gBACLmB,aAAa;gBACbqB,iBAAiB;gBACjBC,UAAU;gBACVC,QAAQ;YACV;YACAA,QAAQ;YACRtB,OAAO;QACT;IACF;IAEA,OAAOe;AACT,EAAC"}
@@ -1033,6 +1033,7 @@ export type Block = {
1033
1033
  };
1034
1034
  /** Extension point to add your custom data. Available in server and client. */
1035
1035
  custom?: Record<string, any>;
1036
+ group?: Record<string, string> | string;
1036
1037
  jsx?: PayloadComponent;
1037
1038
  };
1038
1039
  /** Extension point to add your custom data. Server only. */
@@ -1060,7 +1061,7 @@ export type Block = {
1060
1061
  slug: string;
1061
1062
  };
1062
1063
  export type ClientBlock = {
1063
- admin?: Pick<Block['admin'], 'custom'>;
1064
+ admin?: Pick<Block['admin'], 'custom' | 'group'>;
1064
1065
  fields: ClientField[];
1065
1066
  labels?: LabelsClient;
1066
1067
  } & Pick<Block, 'imageAltText' | 'imageURL' | 'jsx' | 'slug'>;