payload 3.0.0-beta.25 → 3.0.0-beta.27

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 (38) hide show
  1. package/dist/admin/RichText.d.ts +7 -1
  2. package/dist/admin/RichText.d.ts.map +1 -1
  3. package/dist/admin/RichText.js.map +1 -1
  4. package/dist/config/defaults.d.ts.map +1 -1
  5. package/dist/config/defaults.js +1 -0
  6. package/dist/config/defaults.js.map +1 -1
  7. package/dist/config/sanitize.d.ts.map +1 -1
  8. package/dist/config/sanitize.js +12 -4
  9. package/dist/config/sanitize.js.map +1 -1
  10. package/dist/errors/MissingEditorProp.js +1 -1
  11. package/dist/errors/MissingEditorProp.js.map +1 -1
  12. package/dist/exports/types.d.ts +1 -1
  13. package/dist/exports/types.d.ts.map +1 -1
  14. package/dist/exports/types.js.map +1 -1
  15. package/dist/fields/config/client.d.ts +3 -0
  16. package/dist/fields/config/client.d.ts.map +1 -1
  17. package/dist/fields/config/sanitize.d.ts.map +1 -1
  18. package/dist/fields/config/sanitize.js +2 -1
  19. package/dist/fields/config/sanitize.js.map +1 -1
  20. package/dist/fields/config/schema.d.ts.map +1 -1
  21. package/dist/fields/config/schema.js +7 -2
  22. package/dist/fields/config/schema.js.map +1 -1
  23. package/dist/fields/config/types.d.ts +24 -4
  24. package/dist/fields/config/types.d.ts.map +1 -1
  25. package/dist/fields/config/types.js.map +1 -1
  26. package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
  27. package/dist/fields/hooks/afterRead/promise.js +2 -1
  28. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/translations/getLocalI18n.d.ts +1 -1
  32. package/dist/translations/getLocalI18n.d.ts.map +1 -1
  33. package/dist/translations/getLocalI18n.js +1 -1
  34. package/dist/translations/getLocalI18n.js.map +1 -1
  35. package/dist/utilities/createLocalReq.d.ts.map +1 -1
  36. package/dist/utilities/createLocalReq.js +4 -3
  37. package/dist/utilities/createLocalReq.js.map +1 -1
  38. package/package.json +2 -2
@@ -60,8 +60,14 @@ export type RichTextAdapter<Value extends object = object, AdapterProps = any, E
60
60
  CellComponent: React.FC<any>;
61
61
  FieldComponent: React.FC<RichTextFieldProps<Value, AdapterProps, ExtraFieldProperties>>;
62
62
  };
63
- export type RichTextAdapterProvider<Value extends object = object, AdapterProps = any, ExtraFieldProperties = {}> = ({ config, }: {
63
+ export type RichTextAdapterProvider<Value extends object = object, AdapterProps = any, ExtraFieldProperties = {}> = ({ config, isRoot, }: {
64
64
  config: SanitizedConfig;
65
+ /**
66
+ * Whether or not this is the root richText editor, defined in the payload.config.ts.
67
+ *
68
+ * @default false
69
+ */
70
+ isRoot?: boolean;
65
71
  }) => Promise<RichTextAdapter<Value, AdapterProps, ExtraFieldProperties>> | RichTextAdapter<Value, AdapterProps, ExtraFieldProperties>;
66
72
  export {};
67
73
  //# sourceMappingURL=RichText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../../src/admin/RichText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,OAAO,KAAK,EAAU,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAC1F,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AAE5E,MAAM,MAAM,kBAAkB,CAC5B,KAAK,SAAS,MAAM,EACpB,YAAY,EACZ,oBAAoB,GAAG,EAAE,IACvB,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,YA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;QAC3B,gBAAgB,EAAE,OAAO,CAAA;QACzB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KACpC,KAAK,IAAI,CAAA;IACV,QAAQ,EAAE,QAAQ,CAChB,KAAK,EACL,KAAK,EACL,OAAO,EACP,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,oBAAoB,CAAC,CACzD,CAAA;CACF,CAAA;AAED,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,YAAY,GAAG,GAAG,EAClB,oBAAoB,GAAG,EAAE,IACvB,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,oBAAoB,CAAC,GAAG;IACnE,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA;IAC5B,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAAE,YAAY,EAAE,oBAAoB,CAAC,CAAC,CAAA;CACxF,CAAA;AAED,MAAM,MAAM,uBAAuB,CACjC,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,YAAY,GAAG,GAAG,EAClB,oBAAoB,GAAG,EAAE,IACvB,CAAC,EACH,MAAM,EACN,MAAM,GACP,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,KACG,OAAO,CAAC,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,oBAAoB,CAAC,CAAC,GACnE,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,oBAAoB,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/admin/RichText.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\n\nimport type { Config, SanitizedConfig } from '../config/types.js'\nimport type { Field, FieldBase, RichTextField, Validate } from '../fields/config/types.js'\nimport type { PayloadRequestWithData, RequestContext } from '../types/index.js'\nimport type { WithServerSideProps } from './elements/WithServerSideProps.js'\n\nexport type RichTextFieldProps<\n Value extends object,\n AdapterProps,\n ExtraFieldProperties = {},\n> = Omit<RichTextField<Value, AdapterProps, ExtraFieldProperties>, 'type'> & {\n path?: string\n}\n\ntype RichTextAdapterBase<\n Value extends object = object,\n AdapterProps = any,\n ExtraFieldProperties = {},\n> = {\n generateComponentMap: (args: {\n WithServerSideProps: WithServerSideProps\n config: SanitizedConfig\n i18n: I18n\n schemaPath: string\n }) => Map<string, React.ReactNode>\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n i18n: I18n\n schemaMap: Map<string, Field[]>\n schemaPath: string\n }) => Map<string, Field[]>\n hooks?: FieldBase['hooks']\n outputSchema?: ({\n collectionIDFieldTypes,\n config,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n field: RichTextField<Value, AdapterProps, ExtraFieldProperties>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n /**\n * Like an afterRead hook, but runs for both afterRead AND in the GraphQL resolver. For populating data, this should be used.\n *\n * To populate stuff / resolve field hooks, mutate the incoming populationPromises or fieldPromises array. They will then be awaited in the correct order within payload itself.\n * @param data\n */\n populationPromises?: (data: {\n context: RequestContext\n currentDepth?: number\n depth: number\n draft: boolean\n field: RichTextField<Value, AdapterProps, ExtraFieldProperties>\n fieldPromises: Promise<void>[]\n findMany: boolean\n flattenLocales: boolean\n overrideAccess?: boolean\n populationPromises: Promise<void>[]\n req: PayloadRequestWithData\n showHiddenFields: boolean\n siblingDoc: Record<string, unknown>\n }) => void\n validate: Validate<\n Value,\n Value,\n unknown,\n RichTextField<Value, AdapterProps, ExtraFieldProperties>\n >\n}\n\nexport type RichTextAdapter<\n Value extends object = object,\n AdapterProps = any,\n ExtraFieldProperties = {},\n> = RichTextAdapterBase<Value, AdapterProps, ExtraFieldProperties> & {\n CellComponent: React.FC<any>\n FieldComponent: React.FC<RichTextFieldProps<Value, AdapterProps, ExtraFieldProperties>>\n}\n\nexport type RichTextAdapterProvider<\n Value extends object = object,\n AdapterProps = any,\n ExtraFieldProperties = {},\n> = ({\n config,\n}: {\n config: SanitizedConfig\n}) =>\n | Promise<RichTextAdapter<Value, AdapterProps, ExtraFieldProperties>>\n | RichTextAdapter<Value, AdapterProps, ExtraFieldProperties>\n"],"names":[],"rangeMappings":"","mappings":"AAwFA,WAU8D"}
1
+ {"version":3,"sources":["../../src/admin/RichText.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\n\nimport type { Config, SanitizedConfig } from '../config/types.js'\nimport type { Field, FieldBase, RichTextField, Validate } from '../fields/config/types.js'\nimport type { PayloadRequestWithData, RequestContext } from '../types/index.js'\nimport type { WithServerSideProps } from './elements/WithServerSideProps.js'\n\nexport type RichTextFieldProps<\n Value extends object,\n AdapterProps,\n ExtraFieldProperties = {},\n> = Omit<RichTextField<Value, AdapterProps, ExtraFieldProperties>, 'type'> & {\n path?: string\n}\n\ntype RichTextAdapterBase<\n Value extends object = object,\n AdapterProps = any,\n ExtraFieldProperties = {},\n> = {\n generateComponentMap: (args: {\n WithServerSideProps: WithServerSideProps\n config: SanitizedConfig\n i18n: I18n\n schemaPath: string\n }) => Map<string, React.ReactNode>\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n i18n: I18n\n schemaMap: Map<string, Field[]>\n schemaPath: string\n }) => Map<string, Field[]>\n hooks?: FieldBase['hooks']\n outputSchema?: ({\n collectionIDFieldTypes,\n config,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n field: RichTextField<Value, AdapterProps, ExtraFieldProperties>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n /**\n * Like an afterRead hook, but runs for both afterRead AND in the GraphQL resolver. For populating data, this should be used.\n *\n * To populate stuff / resolve field hooks, mutate the incoming populationPromises or fieldPromises array. They will then be awaited in the correct order within payload itself.\n * @param data\n */\n populationPromises?: (data: {\n context: RequestContext\n currentDepth?: number\n depth: number\n draft: boolean\n field: RichTextField<Value, AdapterProps, ExtraFieldProperties>\n fieldPromises: Promise<void>[]\n findMany: boolean\n flattenLocales: boolean\n overrideAccess?: boolean\n populationPromises: Promise<void>[]\n req: PayloadRequestWithData\n showHiddenFields: boolean\n siblingDoc: Record<string, unknown>\n }) => void\n validate: Validate<\n Value,\n Value,\n unknown,\n RichTextField<Value, AdapterProps, ExtraFieldProperties>\n >\n}\n\nexport type RichTextAdapter<\n Value extends object = object,\n AdapterProps = any,\n ExtraFieldProperties = {},\n> = RichTextAdapterBase<Value, AdapterProps, ExtraFieldProperties> & {\n CellComponent: React.FC<any>\n FieldComponent: React.FC<RichTextFieldProps<Value, AdapterProps, ExtraFieldProperties>>\n}\n\nexport type RichTextAdapterProvider<\n Value extends object = object,\n AdapterProps = any,\n ExtraFieldProperties = {},\n> = ({\n config,\n isRoot,\n}: {\n config: SanitizedConfig\n /**\n * Whether or not this is the root richText editor, defined in the payload.config.ts.\n *\n * @default false\n */\n isRoot?: boolean\n}) =>\n | Promise<RichTextAdapter<Value, AdapterProps, ExtraFieldProperties>>\n | RichTextAdapter<Value, AdapterProps, ExtraFieldProperties>\n"],"names":[],"rangeMappings":"","mappings":"AAwFA,WAiB8D"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,eAAO,MAAM,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,QAAQ,GAAG,QAAQ,CA0C7D,CAAA"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,eAAO,MAAM,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,QAAQ,GAAG,QAAQ,CA2C7D,CAAA"}
@@ -26,6 +26,7 @@ export const defaults = {
26
26
  maxComplexity: 1000
27
27
  },
28
28
  hooks: {},
29
+ i18n: {},
29
30
  localization: false,
30
31
  maxDepth: 10,
31
32
  routes: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/config/defaults.ts"],"sourcesContent":["import type { Config } from './types.js'\n\nexport const defaults: Omit<Config, 'db' | 'editor' | 'secret'> = {\n admin: {\n avatar: 'default',\n components: {},\n custom: {},\n dateFormat: 'MMMM do yyyy, h:mm a',\n disable: false,\n inactivityRoute: '/logout-inactivity',\n logoutRoute: '/logout',\n meta: {\n titleSuffix: '- Payload',\n },\n },\n bin: [],\n collections: [],\n cookiePrefix: 'payload',\n cors: [],\n csrf: [],\n custom: {},\n defaultDepth: 2,\n defaultMaxTextLength: 40000,\n endpoints: [],\n globals: [],\n graphQL: {\n disablePlaygroundInProduction: true,\n maxComplexity: 1000,\n },\n hooks: {},\n localization: false,\n maxDepth: 10,\n routes: {\n admin: '/admin',\n api: '/api',\n graphQL: '/graphql',\n graphQLPlayground: '/graphql-playground',\n },\n serverURL: '',\n telemetry: true,\n typescript: {\n outputFile: `${typeof process?.cwd === 'function' ? process.cwd() : ''}/payload-types.ts`,\n },\n upload: {},\n}\n"],"names":["defaults","admin","avatar","components","custom","dateFormat","disable","inactivityRoute","logoutRoute","meta","titleSuffix","bin","collections","cookiePrefix","cors","csrf","defaultDepth","defaultMaxTextLength","endpoints","globals","graphQL","disablePlaygroundInProduction","maxComplexity","hooks","localization","maxDepth","routes","api","graphQLPlayground","serverURL","telemetry","typescript","outputFile","process","cwd","upload"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,MAAMA,WAAqD;IAChEC,OAAO;QACLC,QAAQ;QACRC,YAAY,CAAC;QACbC,QAAQ,CAAC;QACTC,YAAY;QACZC,SAAS;QACTC,iBAAiB;QACjBC,aAAa;QACbC,MAAM;YACJC,aAAa;QACf;IACF;IACAC,KAAK,EAAE;IACPC,aAAa,EAAE;IACfC,cAAc;IACdC,MAAM,EAAE;IACRC,MAAM,EAAE;IACRX,QAAQ,CAAC;IACTY,cAAc;IACdC,sBAAsB;IACtBC,WAAW,EAAE;IACbC,SAAS,EAAE;IACXC,SAAS;QACPC,+BAA+B;QAC/BC,eAAe;IACjB;IACAC,OAAO,CAAC;IACRC,cAAc;IACdC,UAAU;IACVC,QAAQ;QACNzB,OAAO;QACP0B,KAAK;QACLP,SAAS;QACTQ,mBAAmB;IACrB;IACAC,WAAW;IACXC,WAAW;IACXC,YAAY;QACVC,YAAY,CAAC,EAAE,OAAOC,SAASC,QAAQ,aAAaD,QAAQC,GAAG,KAAK,GAAG,iBAAiB,CAAC;IAC3F;IACAC,QAAQ,CAAC;AACX,EAAC"}
1
+ {"version":3,"sources":["../../src/config/defaults.ts"],"sourcesContent":["import type { Config } from './types.js'\n\nexport const defaults: Omit<Config, 'db' | 'editor' | 'secret'> = {\n admin: {\n avatar: 'default',\n components: {},\n custom: {},\n dateFormat: 'MMMM do yyyy, h:mm a',\n disable: false,\n inactivityRoute: '/logout-inactivity',\n logoutRoute: '/logout',\n meta: {\n titleSuffix: '- Payload',\n },\n },\n bin: [],\n collections: [],\n cookiePrefix: 'payload',\n cors: [],\n csrf: [],\n custom: {},\n defaultDepth: 2,\n defaultMaxTextLength: 40000,\n endpoints: [],\n globals: [],\n graphQL: {\n disablePlaygroundInProduction: true,\n maxComplexity: 1000,\n },\n hooks: {},\n i18n: {},\n localization: false,\n maxDepth: 10,\n routes: {\n admin: '/admin',\n api: '/api',\n graphQL: '/graphql',\n graphQLPlayground: '/graphql-playground',\n },\n serverURL: '',\n telemetry: true,\n typescript: {\n outputFile: `${typeof process?.cwd === 'function' ? process.cwd() : ''}/payload-types.ts`,\n },\n upload: {},\n}\n"],"names":["defaults","admin","avatar","components","custom","dateFormat","disable","inactivityRoute","logoutRoute","meta","titleSuffix","bin","collections","cookiePrefix","cors","csrf","defaultDepth","defaultMaxTextLength","endpoints","globals","graphQL","disablePlaygroundInProduction","maxComplexity","hooks","i18n","localization","maxDepth","routes","api","graphQLPlayground","serverURL","telemetry","typescript","outputFile","process","cwd","upload"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,MAAMA,WAAqD;IAChEC,OAAO;QACLC,QAAQ;QACRC,YAAY,CAAC;QACbC,QAAQ,CAAC;QACTC,YAAY;QACZC,SAAS;QACTC,iBAAiB;QACjBC,aAAa;QACbC,MAAM;YACJC,aAAa;QACf;IACF;IACAC,KAAK,EAAE;IACPC,aAAa,EAAE;IACfC,cAAc;IACdC,MAAM,EAAE;IACRC,MAAM,EAAE;IACRX,QAAQ,CAAC;IACTY,cAAc;IACdC,sBAAsB;IACtBC,WAAW,EAAE;IACbC,SAAS,EAAE;IACXC,SAAS;QACPC,+BAA+B;QAC/BC,eAAe;IACjB;IACAC,OAAO,CAAC;IACRC,MAAM,CAAC;IACPC,cAAc;IACdC,UAAU;IACVC,QAAQ;QACN1B,OAAO;QACP2B,KAAK;QACLR,SAAS;QACTS,mBAAmB;IACrB;IACAC,WAAW;IACXC,WAAW;IACXC,YAAY;QACVC,YAAY,CAAC,EAAE,OAAOC,SAASC,QAAQ,aAAaD,QAAQC,GAAG,KAAK,GAAG,iBAAiB,CAAC;IAC3F;IACAC,QAAQ,CAAC;AACX,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/config/sanitize.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,MAAM,EAGN,eAAe,EAChB,MAAM,YAAY,CAAA;AAsCnB,eAAO,MAAM,cAAc,mBAA0B,MAAM,KAAG,QAAQ,eAAe,CAoGpF,CAAA"}
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/config/sanitize.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,MAAM,EAGN,eAAe,EAChB,MAAM,YAAY,CAAA;AAsCnB,eAAO,MAAM,cAAc,mBAA0B,MAAM,KAAG,QAAQ,eAAe,CAmHpF,CAAA"}
@@ -63,14 +63,21 @@ export const sanitizeConfig = async (incomingConfig)=>{
63
63
  }));
64
64
  }
65
65
  }
66
- config.i18n = {
66
+ const i18nConfig = {
67
67
  fallbackLanguage: 'en',
68
68
  supportedLanguages: {
69
69
  en
70
70
  },
71
- translations: {},
72
- ...incomingConfig?.i18n ?? {}
71
+ translations: {}
73
72
  };
73
+ if (incomingConfig?.i18n) {
74
+ i18nConfig.supportedLanguages = incomingConfig.i18n?.supportedLanguages || i18nConfig.supportedLanguages;
75
+ const supportedLangKeys = Object.keys(i18nConfig.supportedLanguages);
76
+ const fallbackLang = incomingConfig.i18n?.fallbackLanguage || i18nConfig.fallbackLanguage;
77
+ i18nConfig.fallbackLanguage = supportedLangKeys.includes(fallbackLang) ? fallbackLang : supportedLangKeys[0];
78
+ i18nConfig.translations = incomingConfig.i18n?.translations || i18nConfig.translations;
79
+ }
80
+ config.i18n = i18nConfig;
74
81
  configWithDefaults.collections.push(getPreferencesCollection(config));
75
82
  configWithDefaults.collections.push(migrationsCollection);
76
83
  const richTextSanitizationPromises = [];
@@ -93,7 +100,8 @@ export const sanitizeConfig = async (incomingConfig)=>{
93
100
  Execute richText sanitization
94
101
  */ if (typeof incomingConfig.editor === 'function') {
95
102
  config.editor = await incomingConfig.editor({
96
- config: config
103
+ config: config,
104
+ isRoot: true
97
105
  });
98
106
  }
99
107
  const promises = [];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/config/sanitize.ts"],"sourcesContent":["import { en } from '@payloadcms/translations/languages/en'\nimport merge from 'deepmerge'\n\nimport type {\n Config,\n LocalizationConfigWithLabels,\n LocalizationConfigWithNoLabels,\n SanitizedConfig,\n} from './types.js'\n\nimport { defaultUserCollection } from '../auth/defaultUser.js'\nimport { sanitizeCollection } from '../collections/config/sanitize.js'\nimport { migrationsCollection } from '../database/migrations/migrationsCollection.js'\nimport { InvalidConfiguration } from '../errors/index.js'\nimport { sanitizeGlobals } from '../globals/config/sanitize.js'\nimport getPreferencesCollection from '../preferences/preferencesCollection.js'\nimport checkDuplicateCollections from '../utilities/checkDuplicateCollections.js'\nimport { isPlainObject } from '../utilities/isPlainObject.js'\nimport { defaults } from './defaults.js'\n\nconst sanitizeAdminConfig = (configToSanitize: Config): Partial<SanitizedConfig> => {\n const sanitizedConfig = { ...configToSanitize }\n\n // add default user collection if none provided\n if (!sanitizedConfig?.admin?.user) {\n const firstCollectionWithAuth = sanitizedConfig.collections.find(({ auth }) => Boolean(auth))\n if (firstCollectionWithAuth) {\n sanitizedConfig.admin.user = firstCollectionWithAuth.slug\n } else {\n sanitizedConfig.admin.user = defaultUserCollection.slug\n sanitizedConfig.collections.push(defaultUserCollection)\n }\n }\n\n const userCollection = sanitizedConfig.collections.find(\n ({ slug }) => slug === sanitizedConfig.admin.user,\n )\n if (!userCollection || !userCollection.auth) {\n throw new InvalidConfiguration(\n `${sanitizedConfig.admin.user} is not a valid admin user collection`,\n )\n }\n\n return sanitizedConfig as unknown as Partial<SanitizedConfig>\n}\n\nexport const sanitizeConfig = async (incomingConfig: Config): Promise<SanitizedConfig> => {\n const configWithDefaults: Config = merge(defaults, incomingConfig, {\n isMergeableObject: isPlainObject,\n }) as Config\n\n if (!configWithDefaults?.serverURL) {\n configWithDefaults.serverURL = ''\n }\n\n const config: Partial<SanitizedConfig> = sanitizeAdminConfig(configWithDefaults)\n\n if (config.localization && config.localization.locales?.length > 0) {\n // clone localization config so to not break everything\n const firstLocale = config.localization.locales[0]\n if (typeof firstLocale === 'string') {\n config.localization.localeCodes = [\n ...(config.localization as unknown as LocalizationConfigWithNoLabels).locales,\n ]\n\n // is string[], so convert to Locale[]\n config.localization.locales = (\n config.localization as unknown as LocalizationConfigWithNoLabels\n ).locales.map((locale) => ({\n code: locale,\n label: locale,\n rtl: false,\n toString: () => locale,\n }))\n } else {\n // is Locale[], so convert to string[] for localeCodes\n config.localization.localeCodes = config.localization.locales.reduce((locales, locale) => {\n locales.push(locale.code)\n return locales\n }, [] as string[])\n\n config.localization.locales = (\n config.localization as LocalizationConfigWithLabels\n ).locales.map((locale) => ({\n ...locale,\n toString: () => locale.code,\n }))\n }\n }\n\n config.i18n = {\n fallbackLanguage: 'en',\n supportedLanguages: {\n en,\n },\n translations: {},\n ...(incomingConfig?.i18n ?? {}),\n }\n\n configWithDefaults.collections.push(getPreferencesCollection(config as unknown as Config))\n configWithDefaults.collections.push(migrationsCollection)\n\n const richTextSanitizationPromises: Array<(config: SanitizedConfig) => Promise<void>> = []\n for (let i = 0; i < config.collections.length; i++) {\n config.collections[i] = await sanitizeCollection(\n config as unknown as Config,\n config.collections[i],\n richTextSanitizationPromises,\n )\n }\n\n checkDuplicateCollections(config.collections)\n\n if (config.globals.length > 0) {\n config.globals = await sanitizeGlobals(\n config as unknown as Config,\n richTextSanitizationPromises,\n )\n }\n\n if (config.serverURL !== '') {\n config.csrf.push(config.serverURL)\n }\n\n // Get deduped list of upload adapters\n if (!config.upload) config.upload = { adapters: [] }\n config.upload.adapters = Array.from(\n new Set(config.collections.map((c) => c.upload?.adapter).filter(Boolean)),\n )\n\n /*\n Execute richText sanitization\n */\n if (typeof incomingConfig.editor === 'function') {\n config.editor = await incomingConfig.editor({\n config: config as SanitizedConfig,\n })\n }\n\n const promises: Promise<void>[] = []\n for (const sanitizeFunction of richTextSanitizationPromises) {\n promises.push(sanitizeFunction(config as SanitizedConfig))\n }\n await Promise.all(promises)\n\n return config as SanitizedConfig\n}\n"],"names":["en","merge","defaultUserCollection","sanitizeCollection","migrationsCollection","InvalidConfiguration","sanitizeGlobals","getPreferencesCollection","checkDuplicateCollections","isPlainObject","defaults","sanitizeAdminConfig","configToSanitize","sanitizedConfig","admin","user","firstCollectionWithAuth","collections","find","auth","Boolean","slug","push","userCollection","sanitizeConfig","incomingConfig","configWithDefaults","isMergeableObject","serverURL","config","localization","locales","length","firstLocale","localeCodes","map","locale","code","label","rtl","toString","reduce","i18n","fallbackLanguage","supportedLanguages","translations","richTextSanitizationPromises","i","globals","csrf","upload","adapters","Array","from","Set","c","adapter","filter","editor","promises","sanitizeFunction","Promise","all"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,EAAE,QAAQ,wCAAuC;AAC1D,OAAOC,WAAW,YAAW;AAS7B,SAASC,qBAAqB,QAAQ,yBAAwB;AAC9D,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,oBAAoB,QAAQ,iDAAgD;AACrF,SAASC,oBAAoB,QAAQ,qBAAoB;AACzD,SAASC,eAAe,QAAQ,gCAA+B;AAC/D,OAAOC,8BAA8B,0CAAyC;AAC9E,OAAOC,+BAA+B,4CAA2C;AACjF,SAASC,aAAa,QAAQ,gCAA+B;AAC7D,SAASC,QAAQ,QAAQ,gBAAe;AAExC,MAAMC,sBAAsB,CAACC;IAC3B,MAAMC,kBAAkB;QAAE,GAAGD,gBAAgB;IAAC;IAE9C,+CAA+C;IAC/C,IAAI,CAACC,iBAAiBC,OAAOC,MAAM;QACjC,MAAMC,0BAA0BH,gBAAgBI,WAAW,CAACC,IAAI,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKC,QAAQD;QACvF,IAAIH,yBAAyB;YAC3BH,gBAAgBC,KAAK,CAACC,IAAI,GAAGC,wBAAwBK,IAAI;QAC3D,OAAO;YACLR,gBAAgBC,KAAK,CAACC,IAAI,GAAGb,sBAAsBmB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,MAAM,GAAG,MAAMjC,eAAeiC,MAAM,CAAC;YAC1C7B,QAAQA;QACV;IACF;IAEA,MAAM8B,WAA4B,EAAE;IACpC,KAAK,MAAMC,oBAAoBd,6BAA8B;QAC3Da,SAASrC,IAAI,CAACsC,iBAAiB/B;IACjC;IACA,MAAMgC,QAAQC,GAAG,CAACH;IAElB,OAAO9B;AACT,EAAC"}
1
+ {"version":3,"sources":["../../src/config/sanitize.ts"],"sourcesContent":["import type { AcceptedLanguages } from '@payloadcms/translations'\n\nimport { en } from '@payloadcms/translations/languages/en'\nimport merge from 'deepmerge'\n\nimport type {\n Config,\n LocalizationConfigWithLabels,\n LocalizationConfigWithNoLabels,\n SanitizedConfig,\n} from './types.js'\n\nimport { defaultUserCollection } from '../auth/defaultUser.js'\nimport { sanitizeCollection } from '../collections/config/sanitize.js'\nimport { migrationsCollection } from '../database/migrations/migrationsCollection.js'\nimport { InvalidConfiguration } from '../errors/index.js'\nimport { sanitizeGlobals } from '../globals/config/sanitize.js'\nimport getPreferencesCollection from '../preferences/preferencesCollection.js'\nimport checkDuplicateCollections from '../utilities/checkDuplicateCollections.js'\nimport { isPlainObject } from '../utilities/isPlainObject.js'\nimport { defaults } from './defaults.js'\n\nconst sanitizeAdminConfig = (configToSanitize: Config): Partial<SanitizedConfig> => {\n const sanitizedConfig = { ...configToSanitize }\n\n // add default user collection if none provided\n if (!sanitizedConfig?.admin?.user) {\n const firstCollectionWithAuth = sanitizedConfig.collections.find(({ auth }) => Boolean(auth))\n if (firstCollectionWithAuth) {\n sanitizedConfig.admin.user = firstCollectionWithAuth.slug\n } else {\n sanitizedConfig.admin.user = defaultUserCollection.slug\n sanitizedConfig.collections.push(defaultUserCollection)\n }\n }\n\n const userCollection = sanitizedConfig.collections.find(\n ({ slug }) => slug === sanitizedConfig.admin.user,\n )\n if (!userCollection || !userCollection.auth) {\n throw new InvalidConfiguration(\n `${sanitizedConfig.admin.user} is not a valid admin user collection`,\n )\n }\n\n return sanitizedConfig as unknown as Partial<SanitizedConfig>\n}\n\nexport const sanitizeConfig = async (incomingConfig: Config): Promise<SanitizedConfig> => {\n const configWithDefaults: Config = merge(defaults, incomingConfig, {\n isMergeableObject: isPlainObject,\n }) as Config\n\n if (!configWithDefaults?.serverURL) {\n configWithDefaults.serverURL = ''\n }\n\n const config: Partial<SanitizedConfig> = sanitizeAdminConfig(configWithDefaults)\n\n if (config.localization && config.localization.locales?.length > 0) {\n // clone localization config so to not break everything\n const firstLocale = config.localization.locales[0]\n if (typeof firstLocale === 'string') {\n config.localization.localeCodes = [\n ...(config.localization as unknown as LocalizationConfigWithNoLabels).locales,\n ]\n\n // is string[], so convert to Locale[]\n config.localization.locales = (\n config.localization as unknown as LocalizationConfigWithNoLabels\n ).locales.map((locale) => ({\n code: locale,\n label: locale,\n rtl: false,\n toString: () => locale,\n }))\n } else {\n // is Locale[], so convert to string[] for localeCodes\n config.localization.localeCodes = config.localization.locales.reduce((locales, locale) => {\n locales.push(locale.code)\n return locales\n }, [] as string[])\n\n config.localization.locales = (\n config.localization as LocalizationConfigWithLabels\n ).locales.map((locale) => ({\n ...locale,\n toString: () => locale.code,\n }))\n }\n }\n\n const i18nConfig: SanitizedConfig['i18n'] = {\n fallbackLanguage: 'en',\n supportedLanguages: {\n en,\n },\n translations: {},\n }\n\n if (incomingConfig?.i18n) {\n i18nConfig.supportedLanguages =\n incomingConfig.i18n?.supportedLanguages || i18nConfig.supportedLanguages\n\n const supportedLangKeys = <AcceptedLanguages[]>Object.keys(i18nConfig.supportedLanguages)\n const fallbackLang = incomingConfig.i18n?.fallbackLanguage || i18nConfig.fallbackLanguage\n\n i18nConfig.fallbackLanguage = supportedLangKeys.includes(fallbackLang)\n ? fallbackLang\n : supportedLangKeys[0]\n i18nConfig.translations = incomingConfig.i18n?.translations || i18nConfig.translations\n }\n\n config.i18n = i18nConfig\n\n configWithDefaults.collections.push(getPreferencesCollection(config as unknown as Config))\n configWithDefaults.collections.push(migrationsCollection)\n\n const richTextSanitizationPromises: Array<(config: SanitizedConfig) => Promise<void>> = []\n for (let i = 0; i < config.collections.length; i++) {\n config.collections[i] = await sanitizeCollection(\n config as unknown as Config,\n config.collections[i],\n richTextSanitizationPromises,\n )\n }\n\n checkDuplicateCollections(config.collections)\n\n if (config.globals.length > 0) {\n config.globals = await sanitizeGlobals(\n config as unknown as Config,\n richTextSanitizationPromises,\n )\n }\n\n if (config.serverURL !== '') {\n config.csrf.push(config.serverURL)\n }\n\n // Get deduped list of upload adapters\n if (!config.upload) config.upload = { adapters: [] }\n config.upload.adapters = Array.from(\n new Set(config.collections.map((c) => c.upload?.adapter).filter(Boolean)),\n )\n\n /*\n Execute richText sanitization\n */\n if (typeof incomingConfig.editor === 'function') {\n config.editor = await incomingConfig.editor({\n config: config as SanitizedConfig,\n isRoot: true,\n })\n }\n\n const promises: Promise<void>[] = []\n for (const sanitizeFunction of richTextSanitizationPromises) {\n promises.push(sanitizeFunction(config as SanitizedConfig))\n }\n await Promise.all(promises)\n\n return config as SanitizedConfig\n}\n"],"names":["en","merge","defaultUserCollection","sanitizeCollection","migrationsCollection","InvalidConfiguration","sanitizeGlobals","getPreferencesCollection","checkDuplicateCollections","isPlainObject","defaults","sanitizeAdminConfig","configToSanitize","sanitizedConfig","admin","user","firstCollectionWithAuth","collections","find","auth","Boolean","slug","push","userCollection","sanitizeConfig","incomingConfig","configWithDefaults","isMergeableObject","serverURL","config","localization","locales","length","firstLocale","localeCodes","map","locale","code","label","rtl","toString","reduce","i18nConfig","fallbackLanguage","supportedLanguages","translations","i18n","supportedLangKeys","Object","keys","fallbackLang","includes","richTextSanitizationPromises","i","globals","csrf","upload","adapters","Array","from","Set","c","adapter","filter","editor","isRoot","promises","sanitizeFunction","Promise","all"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,E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AE;IACpC,KAAK,MAAMC,oBAAoBf,6BAA8B;QAC3Dc,SAAS5C,IAAI,CAAC6C,iBAAiBtC;IACjC;IACA,MAAMuC,QAAQC,GAAG,CAACH;IAElB,OAAOrC;AACT,EAAC"}
@@ -2,7 +2,7 @@ import { fieldAffectsData } from '../fields/config/types.js';
2
2
  import { APIError } from './APIError.js';
3
3
  export class MissingEditorProp extends APIError {
4
4
  constructor(field){
5
- super(`RichText field${fieldAffectsData(field) ? ` "${field.name}"` : ''} is missing the editor prop`);
5
+ super(`RichText field${fieldAffectsData(field) ? ` "${field.name}"` : ''} is missing the editor prop. For sub-richText fields, the editor props is required, as it would otherwise create infinite recursion.`);
6
6
  }
7
7
  }
8
8
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/errors/MissingEditorProp.ts"],"sourcesContent":["import type { Field } from '../fields/config/types.js'\n\nimport { fieldAffectsData } from '../fields/config/types.js'\nimport { APIError } from './APIError.js'\n\nexport class MissingEditorProp extends APIError {\n constructor(field: Field) {\n super(\n `RichText field${fieldAffectsData(field) ? ` \"${field.name}\"` : ''} is missing the editor prop`,\n )\n }\n}\n"],"names":["fieldAffectsData","APIError","MissingEditorProp","constructor","field","name"],"rangeMappings":";;;;;;","mappings":"AAEA,SAASA,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,QAAQ,QAAQ,gBAAe;AAExC,OAAO,MAAMC,0BAA0BD;IACrCE,YAAYC,KAAY,CAAE;QACxB,KAAK,CACH,CAAC,cAAc,EAAEJ,iBAAiBI,SAAS,CAAC,EAAE,EAAEA,MAAMC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,2BAA2B,CAAC;IAEnG;AACF"}
1
+ {"version":3,"sources":["../../src/errors/MissingEditorProp.ts"],"sourcesContent":["import type { Field } from '../fields/config/types.js'\n\nimport { fieldAffectsData } from '../fields/config/types.js'\nimport { APIError } from './APIError.js'\n\nexport class MissingEditorProp extends APIError {\n constructor(field: Field) {\n super(\n `RichText field${fieldAffectsData(field) ? ` \"${field.name}\"` : ''} is missing the editor prop. For sub-richText fields, the editor props is required, as it would otherwise create infinite recursion.`,\n )\n }\n}\n"],"names":["fieldAffectsData","APIError","MissingEditorProp","constructor","field","name"],"rangeMappings":";;;;;;","mappings":"AAEA,SAASA,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,QAAQ,QAAQ,gBAAe;AAExC,OAAO,MAAMC,0BAA0BD;IACrCE,YAAYC,KAAY,CAAE;QACxB,KAAK,CACH,CAAC,cAAc,EAAEJ,iBAAiBI,SAAS,CAAC,EAAE,EAAEA,MAAMC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,oIAAoI,CAAC;IAE5M;AACF"}
@@ -10,7 +10,7 @@ export type { AfterChangeHook as CollectionAfterChangeHook, AfterDeleteHook as C
10
10
  export type { ClientConfig } from './../config/client.js';
11
11
  export type { Access, AccessArgs, EditViewComponent, EntityDescription, EntityDescriptionComponent, EntityDescriptionFunction, SanitizedConfig, } from './../config/types.js';
12
12
  export type { ClientFieldConfig } from './../fields/config/client.js';
13
- export type { ArrayField, Block, BlockField, CheckboxField, ClientValidate, CodeField, CollapsibleField, Condition, DateField, EmailField, Field, FieldAccess, FieldAffectingData, FieldBase, FieldHook, FieldHookArgs, FieldPresentationalOnly, FieldWithMany, FieldWithMaxDepth, FieldWithPath, FieldWithRichTextRequiredEditor, FieldWithSubFields, FilterOptions, FilterOptionsProps, GroupField, HookName, JSONField, Labels, NamedTab, NonPresentationalField, NumberField, Option, OptionObject, PointField, PolymorphicRelationshipField, RadioField, RelationshipField, RelationshipValue, RichTextField, RichTextFieldRequiredEditor, RowAdmin, RowField, SelectField, SingleRelationshipField, Tab, TabAsField, TabsAdmin, TabsField, TextField, TextareaField, UIField, UnnamedTab, UploadField, Validate, ValidateOptions, ValueWithRelation, } from './../fields/config/types.js';
13
+ export type { ArrayField, Block, BlockField, CheckboxField, ClientValidate, CodeField, CollapsibleField, Condition, DateField, EmailField, Field, FieldAccess, FieldAffectingData, FieldBase, FieldHook, FieldHookArgs, FieldPresentationalOnly, FieldWithMany, FieldWithMaxDepth, FieldWithPath, FieldWithSubFields, FilterOptions, FilterOptionsProps, GroupField, HookName, JSONField, Labels, NamedTab, NonPresentationalField, NumberField, Option, OptionObject, PointField, PolymorphicRelationshipField, RadioField, RelationshipField, RelationshipValue, RichTextField, RowAdmin, RowField, SelectField, SingleRelationshipField, Tab, TabAsField, TabsAdmin, TabsField, TextField, TextareaField, UIField, UnnamedTab, UploadField, Validate, ValidateOptions, ValueWithRelation, } from './../fields/config/types.js';
14
14
  export { fieldAffectsData, fieldHasMaxDepth, fieldHasSubFields, fieldIsArrayType, fieldIsBlockType, fieldIsGroupType, fieldIsLocalized, fieldIsPresentationalOnly, fieldSupportsMany, optionIsObject, optionIsValue, optionsAreObjects, tabHasName, valueIsValueWithRelation, } from './../fields/config/types.js';
15
15
  export type { ClientGlobalConfig } from './../globals/config/client.js';
16
16
  export type { AfterChangeHook as GlobalAfterChangeHook, AfterReadHook as GlobalAfterReadHook, BeforeChangeHook as GlobalBeforeChangeHook, BeforeReadHook as GlobalBeforeReadHook, BeforeValidateHook as GlobalBeforeValidateHook, GlobalConfig, SanitizedGlobalConfig, } from './../globals/config/types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,mBAAmB,mBAAmB,CAAA;AACtC,mBAAmB,qBAAqB,CAAA;AAExC,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE7E,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjE,YAAY,EAAE,YAAY,IAAI,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAE9F,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,uBAAuB,EACvB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AAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,2BAA2B,EAC3B,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,uBAAuB,EACvB,GAAG,EACH,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,aAAa,EACb,OAAO,EACP,UAAU,EACV,WAAW,EACX,QAAQ,EACR,eAAe,EACf,iBAAiB,GAClB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,wBAAwB,GACzB,MAAM,6BAA6B,CAAA;AAEpC,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAEvE,YAAY,EACV,eAAe,IAAI,qBAAqB,EACxC,aAAa,IAAI,mBAAmB,EACpC,gBAAgB,IAAI,sBAAsB,EAC1C,cAAc,IAAI,oBAAoB,EACtC,kBAAkB,IAAI,wBAAwB,EAC9C,YAAY,EACZ,qBAAqB,GACtB,MAAM,8BAA8B,CAAA;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,mBAAmB,mBAAmB,CAAA;AACtC,mBAAmB,qBAAqB,CAAA;AAExC,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE7E,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjE,YAAY,EAAE,YAAY,IAAI,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAE9F,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,uBAA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EACV,4BAA4B,EAC5B,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,uBAAuB,EACvB,GAAG,EACH,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,aAAa,EACb,OAAO,EACP,UAAU,EACV,WAAW,EACX,QAAQ,EACR,eAAe,EACf,iBAAiB,GAClB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,wBAAwB,GACzB,MAAM,6BAA6B,CAAA;AAEpC,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAEvE,YAAY,EACV,eAAe,IAAI,qBAAqB,EACxC,aAAa,IAAI,mBAAmB,EACpC,gBAAgB,IAAI,sBAAsB,EAC1C,cAAc,IAAI,oBAAoB,EACtC,kBAAkB,IAAI,wBAAwB,EAC9C,YAAY,EACZ,qBAAqB,GACtB,MAAM,8BAA8B,CAAA;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/types.ts"],"sourcesContent":["export * from './../types/index.js'\nexport type * from '../admin/types.js'\nexport type * from '../uploads/types.js'\n\nexport type { DocumentPermissions, FieldPermissions } from '../auth/index.js'\n\nexport type { MeOperationResult } from '../auth/operations/me.js'\nexport type { EmailAdapter as PayloadEmailAdapter, SendEmailOptions } from '../email/types.js'\n\nexport type {\n CollapsedPreferences,\n DocumentPreferences,\n FieldsPreferences,\n InsideFieldsPreferences,\n PreferenceRequest,\n PreferenceUpdateRequest,\n TabsPreferences,\n} from '../preferences/types.js'\n\nexport type { ClientCollectionConfig } from './../collections/config/client.js'\n\nexport type {\n AfterChangeHook as CollectionAfterChangeHook,\n AfterDeleteHook as CollectionAfterDeleteHook,\n AfterErrorHook as CollectionAfterErrorHook,\n AfterForgotPasswordHook as CollectionAfterForgotPasswordHook,\n AfterLoginHook as CollectionAfterLoginHook,\n AfterOperationHook as CollectionAfterOperationHook,\n AfterReadHook as CollectionAfterReadHook,\n BeforeChangeHook as CollectionBeforeChangeHook,\n BeforeDeleteHook as CollectionBeforeDeleteHook,\n BeforeLoginHook as CollectionBeforeLoginHook,\n BeforeOperationHook as CollectionBeforeOperationHook,\n BeforeReadHook as CollectionBeforeReadHook,\n BeforeValidateHook as CollectionBeforeValidateHook,\n Collection,\n CollectionConfig,\n SanitizedCollectionConfig,\n TypeWithID,\n TypeWithTimestamps,\n} from './../collections/config/types.js'\n\nexport type { ClientConfig } from './../config/client.js'\nexport type {\n Access,\n AccessArgs,\n EditViewComponent,\n EntityDescription,\n EntityDescriptionComponent,\n EntityDescriptionFunction,\n SanitizedConfig,\n} from './../config/types.js'\nexport type { ClientFieldConfig } from './../fields/config/client.js'\nexport type {\n ArrayField,\n Block,\n BlockField,\n CheckboxField,\n ClientValidate,\n CodeField,\n CollapsibleField,\n Condition,\n DateField,\n EmailField,\n Field,\n FieldAccess,\n FieldAffectingData,\n FieldBase,\n FieldHook,\n FieldHookArgs,\n FieldPresentationalOnly,\n FieldWithMany,\n FieldWithMaxDepth,\n FieldWithPath,\n FieldWithRichTextRequiredEditor,\n FieldWithSubFields,\n FilterOptions,\n FilterOptionsProps,\n GroupField,\n HookName,\n JSONField,\n Labels,\n NamedTab,\n NonPresentationalField,\n NumberField,\n Option,\n OptionObject,\n PointField,\n PolymorphicRelationshipField,\n RadioField,\n RelationshipField,\n RelationshipValue,\n RichTextField,\n RichTextFieldRequiredEditor,\n RowAdmin,\n RowField,\n SelectField,\n SingleRelationshipField,\n Tab,\n TabAsField,\n TabsAdmin,\n TabsField,\n TextField,\n TextareaField,\n UIField,\n UnnamedTab,\n UploadField,\n Validate,\n ValidateOptions,\n ValueWithRelation,\n} from './../fields/config/types.js'\n\nexport {\n fieldAffectsData,\n fieldHasMaxDepth,\n fieldHasSubFields,\n fieldIsArrayType,\n fieldIsBlockType,\n fieldIsGroupType,\n fieldIsLocalized,\n fieldIsPresentationalOnly,\n fieldSupportsMany,\n optionIsObject,\n optionIsValue,\n optionsAreObjects,\n tabHasName,\n valueIsValueWithRelation,\n} from './../fields/config/types.js'\n\nexport type { ClientGlobalConfig } from './../globals/config/client.js'\n\nexport type {\n AfterChangeHook as GlobalAfterChangeHook,\n AfterReadHook as GlobalAfterReadHook,\n BeforeChangeHook as GlobalBeforeChangeHook,\n BeforeReadHook as GlobalBeforeReadHook,\n BeforeValidateHook as GlobalBeforeValidateHook,\n GlobalConfig,\n SanitizedGlobalConfig,\n} from './../globals/config/types.js'\n\nexport { validOperators } from './../types/constants.js'\n"],"names":["fieldAffectsData","fieldHasMaxDepth","fieldHasSubFields","fieldIsArrayType","fieldIsBlockType","fieldIsGroupType","fieldIsLocalized","fieldIsPresentationalOnly","fieldSupportsMany","optionIsObject","optionIsValue","optionsAreObjects","tabHasName","valueIsValueWithRelation","validOperators"],"rangeMappings":";;","mappings":"AAAA,cAAc,sBAAqB;AAgHnC,SACEA,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,yBAAyB,EACzBC,iBAAiB,EACjBC,cAAc,EACdC,aAAa,EACbC,iBAAiB,EACjBC,UAAU,EACVC,wBAAwB,QACnB,8BAA6B;AAcpC,SAASC,cAAc,QAAQ,0BAAyB"}
1
+ {"version":3,"sources":["../../src/exports/types.ts"],"sourcesContent":["export * from './../types/index.js'\nexport type * from '../admin/types.js'\nexport type * from '../uploads/types.js'\n\nexport type { DocumentPermissions, FieldPermissions } from '../auth/index.js'\n\nexport type { MeOperationResult } from '../auth/operations/me.js'\nexport type { EmailAdapter as PayloadEmailAdapter, SendEmailOptions } from '../email/types.js'\n\nexport type {\n CollapsedPreferences,\n DocumentPreferences,\n FieldsPreferences,\n InsideFieldsPreferences,\n PreferenceRequest,\n PreferenceUpdateRequest,\n TabsPreferences,\n} from '../preferences/types.js'\n\nexport type { ClientCollectionConfig } from './../collections/config/client.js'\n\nexport type {\n AfterChangeHook as CollectionAfterChangeHook,\n AfterDeleteHook as CollectionAfterDeleteHook,\n AfterErrorHook as CollectionAfterErrorHook,\n AfterForgotPasswordHook as CollectionAfterForgotPasswordHook,\n AfterLoginHook as CollectionAfterLoginHook,\n AfterOperationHook as CollectionAfterOperationHook,\n AfterReadHook as CollectionAfterReadHook,\n BeforeChangeHook as CollectionBeforeChangeHook,\n BeforeDeleteHook as CollectionBeforeDeleteHook,\n BeforeLoginHook as CollectionBeforeLoginHook,\n BeforeOperationHook as CollectionBeforeOperationHook,\n BeforeReadHook as CollectionBeforeReadHook,\n BeforeValidateHook as CollectionBeforeValidateHook,\n Collection,\n CollectionConfig,\n SanitizedCollectionConfig,\n TypeWithID,\n TypeWithTimestamps,\n} from './../collections/config/types.js'\n\nexport type { ClientConfig } from './../config/client.js'\nexport type {\n Access,\n AccessArgs,\n EditViewComponent,\n EntityDescription,\n EntityDescriptionComponent,\n EntityDescriptionFunction,\n SanitizedConfig,\n} from './../config/types.js'\nexport type { ClientFieldConfig } from './../fields/config/client.js'\nexport type {\n ArrayField,\n Block,\n BlockField,\n CheckboxField,\n ClientValidate,\n CodeField,\n CollapsibleField,\n Condition,\n DateField,\n EmailField,\n Field,\n FieldAccess,\n FieldAffectingData,\n FieldBase,\n FieldHook,\n FieldHookArgs,\n FieldPresentationalOnly,\n FieldWithMany,\n FieldWithMaxDepth,\n FieldWithPath,\n FieldWithSubFields,\n FilterOptions,\n FilterOptionsProps,\n GroupField,\n HookName,\n JSONField,\n Labels,\n NamedTab,\n NonPresentationalField,\n NumberField,\n Option,\n OptionObject,\n PointField,\n PolymorphicRelationshipField,\n RadioField,\n RelationshipField,\n RelationshipValue,\n RichTextField,\n RowAdmin,\n RowField,\n SelectField,\n SingleRelationshipField,\n Tab,\n TabAsField,\n TabsAdmin,\n TabsField,\n TextField,\n TextareaField,\n UIField,\n UnnamedTab,\n UploadField,\n Validate,\n ValidateOptions,\n ValueWithRelation,\n} from './../fields/config/types.js'\n\nexport {\n fieldAffectsData,\n fieldHasMaxDepth,\n fieldHasSubFields,\n fieldIsArrayType,\n fieldIsBlockType,\n fieldIsGroupType,\n fieldIsLocalized,\n fieldIsPresentationalOnly,\n fieldSupportsMany,\n optionIsObject,\n optionIsValue,\n optionsAreObjects,\n tabHasName,\n valueIsValueWithRelation,\n} from './../fields/config/types.js'\n\nexport type { ClientGlobalConfig } from './../globals/config/client.js'\n\nexport type {\n AfterChangeHook as GlobalAfterChangeHook,\n AfterReadHook as GlobalAfterReadHook,\n BeforeChangeHook as GlobalBeforeChangeHook,\n BeforeReadHook as GlobalBeforeReadHook,\n BeforeValidateHook as GlobalBeforeValidateHook,\n GlobalConfig,\n SanitizedGlobalConfig,\n} from './../globals/config/types.js'\n\nexport { validOperators } from './../types/constants.js'\n"],"names":["fieldAffectsData","fieldHasMaxDepth","fieldHasSubFields","fieldIsArrayType","fieldIsBlockType","fieldIsGroupType","fieldIsLocalized","fieldIsPresentationalOnly","fieldSupportsMany","optionIsObject","optionIsValue","optionsAreObjects","tabHasName","valueIsValueWithRelation","validOperators"],"rangeMappings":";;","mappings":"AAAA,cAAc,sBAAqB;AA8GnC,SACEA,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,yBAAyB,EACzBC,iBAAiB,EACjBC,cAAc,EACdC,aAAa,EACbC,iBAAiB,EACjBC,UAAU,EACVC,wBAAwB,QACnB,8BAA6B;AAcpC,SAASC,cAAc,QAAQ,0BAAyB"}
@@ -38,6 +38,7 @@ export declare const createClientFieldConfig: ({ field: incomingField, t, }: {
38
38
  Filter?: import("react").ComponentType<any>;
39
39
  };
40
40
  initCollapsed?: boolean;
41
+ isSortable?: boolean;
41
42
  };
42
43
  custom?: Record<string, any>;
43
44
  defaultValue?: any;
@@ -89,6 +90,7 @@ export declare const createClientFieldConfig: ({ field: incomingField, t, }: {
89
90
  width?: string;
90
91
  } & {
91
92
  initCollapsed?: boolean;
93
+ isSortable?: boolean;
92
94
  };
93
95
  custom?: Record<string, any>;
94
96
  defaultValue?: any;
@@ -963,6 +965,7 @@ export declare const createClientFieldConfig: ({ field: incomingField, t, }: {
963
965
  unique?: boolean;
964
966
  validate?: import("../../fields/config/types.js").Validate<any, any, any, object>;
965
967
  editor?: import("../../admin/RichText.js").RichTextAdapter<any, any, any> | import("../../admin/RichText.js").RichTextAdapterProvider<any, any, any>;
968
+ maxDepth?: number;
966
969
  type: "richText";
967
970
  } | {
968
971
  custom?: Record<string, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/fields/config/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEzD,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAEpE,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,cAAc,GAAG,OAAO,GAAG,UAAU,CAAC,CAAA;AAE7F,MAAM,MAAM,yBAAyB,GACjC,QAAQ,GACR,eAAe,GACf,OAAO,GACP,MAAM,IAAI,CAAC,SAAS,EAAE,QAAQ,GAAG,QAAQ,GAAG,cAAc,GAAG,OAAO,GAAG,UAAU,CAAC,CAAA;AAEtF,MAAM,MAAM,8BAA8B,GAAG,MAAM,IAAI,CACrD,SAAS,CAAC,OAAO,CAAC,EAClB,YAAY,GAAG,WAAW,GAAG,aAAa,CAC3C,CAAA;AAED,eAAO,MAAM,uBAAuB,iCAGjC;IACD,KAAK,EAAE,KAAK,CAAA;IACZ,CAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwEA,CAAA;AAED,eAAO,MAAM,wBAAwB,mBAGlC;IACD,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,CAAC,EAAE,SAAS,CAAA;CACb,KAAG,KAAK,EAAkE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../src/fields/config/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAgBvC,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAChC,MAAM,EAAE,KAAK,EAAE,CAAA;IACf;;;;OAIG;IACH,+BAA+B,CAAC,EAAE,OAAO,CAAA;IACzC;;;OAGG;IACH,4BAA4B,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IAEhF;;;OAGG;IACH,kBAAkB,EAAE,IAAI,GAAG,MAAM,EAAE,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,cAAc,+HAOxB,IAAI,KAAG,QAAQ,KAAK,EAAE,CAoMxB,CAAA"}
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../src/fields/config/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAgBvC,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAChC,MAAM,EAAE,KAAK,EAAE,CAAA;IACf;;;;OAIG;IACH,+BAA+B,CAAC,EAAE,OAAO,CAAA;IACzC;;;OAGG;IACH,4BAA4B,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IAEhF;;;OAGG;IACH,kBAAkB,EAAE,IAAI,GAAG,MAAM,EAAE,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,cAAc,+HAOxB,IAAI,KAAG,QAAQ,KAAK,EAAE,CAuMxB,CAAA"}
@@ -97,7 +97,8 @@ export const sanitizeFields = async ({ config, existingFieldNames = new Set(), f
97
97
  }
98
98
  if (typeof field.editor === 'function') {
99
99
  field.editor = await field.editor({
100
- config: _config
100
+ config: _config,
101
+ isRoot: requireFieldLevelRichTextEditor
101
102
  });
102
103
  }
103
104
  // Add editor adapter hooks to field hooks
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/config/sanitize.ts"],"sourcesContent":["import type { Config, SanitizedConfig } from '../../config/types.js'\nimport type { Field } from './types.js'\n\nimport { MissingEditorProp } from '../../errors/MissingEditorProp.js'\nimport {\n DuplicateFieldName,\n InvalidFieldName,\n InvalidFieldRelationship,\n MissingFieldType,\n} from '../../errors/index.js'\nimport { formatLabels, toWords } from '../../utilities/formatLabels.js'\nimport { baseBlockFields } from '../baseFields/baseBlockFields.js'\nimport { baseIDField } from '../baseFields/baseIDField.js'\nimport { setDefaultBeforeDuplicate } from '../setDefaultBeforeDuplicate.js'\nimport validations from '../validations.js'\nimport { fieldAffectsData, tabHasName } from './types.js'\n\ntype Args = {\n config: Config\n existingFieldNames?: Set<string>\n fields: Field[]\n /**\n * If true, a richText field will require an editor property to be set, as the sanitizeFields function will not add it from the payload config if not present.\n *\n * @default false\n */\n requireFieldLevelRichTextEditor?: boolean\n /**\n * If this property is set, RichText fields won't be sanitized immediately. Instead, they will be added to this array as promises\n * so that you can sanitize them together, after the config has been sanitized.\n */\n richTextSanitizationPromises?: Array<(config: SanitizedConfig) => Promise<void>>\n\n /**\n * If not null, will validate that upload and relationship fields do not relate to a collection that is not in this array.\n * This validation will be skipped if validRelationships is null.\n */\n validRelationships: null | string[]\n}\n\nexport const sanitizeFields = async ({\n config,\n existingFieldNames = new Set(),\n fields,\n requireFieldLevelRichTextEditor = false,\n richTextSanitizationPromises,\n validRelationships,\n}: Args): Promise<Field[]> => {\n if (!fields) return []\n\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i]\n\n if (!field.type) throw new MissingFieldType(field)\n\n // assert that field names do not contain forbidden characters\n if (fieldAffectsData(field) && field.name.includes('.')) {\n throw new InvalidFieldName(field, field.name)\n }\n\n // Auto-label\n if (\n 'name' in field &&\n field.name &&\n typeof field.label !== 'object' &&\n typeof field.label !== 'string' &&\n field.label !== false\n ) {\n field.label = toWords(field.name)\n }\n\n if (\n field.type === 'checkbox' &&\n typeof field.defaultValue === 'undefined' &&\n field.required === true\n ) {\n field.defaultValue = false\n }\n\n if (field.type === 'relationship' || field.type === 'upload') {\n if (validRelationships) {\n const relationships = Array.isArray(field.relationTo)\n ? field.relationTo\n : [field.relationTo]\n relationships.forEach((relationship: string) => {\n if (!validRelationships.includes(relationship)) {\n throw new InvalidFieldRelationship(field, relationship)\n }\n })\n }\n\n if (field.type === 'relationship') {\n if (field.min && !field.minRows) {\n console.warn(\n `(payload): The \"min\" property is deprecated for the Relationship field \"${field.name}\" and will be removed in a future version. Please use \"minRows\" instead.`,\n )\n }\n if (field.max && !field.maxRows) {\n console.warn(\n `(payload): The \"max\" property is deprecated for the Relationship field \"${field.name}\" and will be removed in a future version. Please use \"maxRows\" instead.`,\n )\n }\n field.minRows = field.minRows || field.min\n field.maxRows = field.maxRows || field.max\n }\n }\n\n if (field.type === 'blocks' && field.blocks) {\n field.blocks = field.blocks.map((block) => ({\n ...block,\n fields: block.fields.concat(baseBlockFields),\n }))\n }\n\n if (field.type === 'array' && field.fields) {\n field.fields.push(baseIDField)\n }\n\n if ((field.type === 'blocks' || field.type === 'array') && field.label) {\n field.labels = field.labels || formatLabels(field.name)\n }\n\n if (fieldAffectsData(field)) {\n if (existingFieldNames.has(field.name)) {\n throw new DuplicateFieldName(field.name)\n } else if (!['blockName', 'id'].includes(field.name)) {\n existingFieldNames.add(field.name)\n }\n\n if (field.localized && !config.localization) delete field.localized\n\n if (typeof field.validate === 'undefined') {\n const defaultValidate = validations[field.type]\n if (defaultValidate) {\n field.validate = (val, options) => defaultValidate(val, { ...field, ...options })\n } else {\n field.validate = () => true\n }\n }\n\n if (!field.hooks) field.hooks = {}\n if (!field.access) field.access = {}\n\n setDefaultBeforeDuplicate(field)\n }\n\n if (!field.admin) {\n field.admin = {}\n }\n\n // Make sure that the richText field has an editor\n if (field.type === 'richText') {\n const sanitizeRichText = async (_config: SanitizedConfig) => {\n if (!field.editor) {\n if (_config.editor && !requireFieldLevelRichTextEditor) {\n // config.editor should be sanitized at this point\n field.editor = _config.editor\n } else {\n throw new MissingEditorProp(field)\n }\n }\n\n if (typeof field.editor === 'function') {\n field.editor = await field.editor({ config: _config })\n }\n\n // Add editor adapter hooks to field hooks\n if (!field.hooks) field.hooks = {}\n\n const mergeHooks = (hookName: keyof typeof field.editor.hooks) => {\n if (typeof field.editor === 'function') return\n\n if (field.editor?.hooks?.[hookName]?.length) {\n field.hooks[hookName] = field.hooks[hookName]\n ? field.hooks[hookName].concat(field.editor.hooks[hookName])\n : [...field.editor.hooks[hookName]]\n }\n }\n\n mergeHooks('afterRead')\n mergeHooks('afterChange')\n mergeHooks('beforeChange')\n mergeHooks('beforeValidate')\n mergeHooks('beforeDuplicate')\n }\n if (richTextSanitizationPromises) {\n richTextSanitizationPromises.push(sanitizeRichText)\n } else {\n await sanitizeRichText(config as unknown as SanitizedConfig)\n }\n }\n\n if ('fields' in field && field.fields) {\n field.fields = await sanitizeFields({\n config,\n existingFieldNames: fieldAffectsData(field) ? new Set() : existingFieldNames,\n fields: field.fields,\n requireFieldLevelRichTextEditor,\n richTextSanitizationPromises,\n validRelationships,\n })\n }\n\n if (field.type === 'tabs') {\n for (let j = 0; j < field.tabs.length; j++) {\n const tab = field.tabs[j]\n if (tabHasName(tab) && typeof tab.label === 'undefined') {\n tab.label = toWords(tab.name)\n }\n\n tab.fields = await sanitizeFields({\n config,\n existingFieldNames: tabHasName(tab) ? new Set() : existingFieldNames,\n fields: tab.fields,\n requireFieldLevelRichTextEditor,\n richTextSanitizationPromises,\n validRelationships,\n })\n field.tabs[j] = tab\n }\n }\n\n if ('blocks' in field && field.blocks) {\n for (let j = 0; j < field.blocks.length; j++) {\n const block = field.blocks[j]\n block.labels = !block.labels ? formatLabels(block.slug) : block.labels\n\n block.fields = await sanitizeFields({\n config,\n existingFieldNames: new Set(),\n fields: block.fields,\n requireFieldLevelRichTextEditor,\n richTextSanitizationPromises,\n validRelationships,\n })\n field.blocks[j] = block\n }\n }\n\n fields[i] = field\n }\n\n return fields\n}\n"],"names":["MissingEditorProp","DuplicateFieldName","InvalidFieldName","InvalidFieldRelationship","MissingFieldType","formatLabels","toWords","baseBlockFields","baseIDField","setDefaultBeforeDuplicate","validations","fieldAffectsData","tabHasName","sanitizeFields","config","existingFieldNames","Set","fields","requireFieldLevelRichTextEditor","richTextSanitizationPromises","validRelationships","i","length","field","type","name","includes","label","defaultValue","required","relationships","Array","isArray","relationTo","forEach","relationship","min","minRows","console","warn","max","maxRows","blocks","map","block","concat","push","labels","has","add","localized","localization","validate","defaultValidate","val","options","hooks","access","admin","sanitizeRichText","_config","editor","mergeHooks","hookName","j","tabs","tab","slug"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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AK,QAAQ;YACzB,IAAK,IAAIwC,IAAI,GAAGA,IAAIzC,MAAM0C,IAAI,CAAC3C,MAAM,EAAE0C,IAAK;gBAC1C,MAAME,MAAM3C,MAAM0C,IAAI,CAACD,EAAE;gBACzB,IAAIpD,WAAWsD,QAAQ,OAAOA,IAAIvC,KAAK,KAAK,aAAa;oBACvDuC,IAAIvC,KAAK,GAAGrB,QAAQ4D,IAAIzC,IAAI;gBAC9B;gBAEAyC,IAAIjD,MAAM,GAAG,MAAMJ,eAAe;oBAChCC;oBACAC,oBAAoBH,WAAWsD,OAAO,IAAIlD,QAAQD;oBAClDE,QAAQiD,IAAIjD,MAAM;oBAClBC;oBACAC;oBACAC;gBACF;gBACAG,MAAM0C,IAAI,CAACD,EAAE,GAAGE;YAClB;QACF;QAEA,IAAI,YAAY3C,SAASA,MAAMmB,MAAM,EAAE;YACrC,IAAK,IAAIsB,IAAI,GAAGA,IAAIzC,MAAMmB,MAAM,CAACpB,MAAM,EAAE0C,IAAK;gBAC5C,MAAMpB,QAAQrB,MAAMmB,MAAM,CAACsB,EAAE;gBAC7BpB,MAAMG,MAAM,GAAG,CAACH,MAAMG,MAAM,GAAG1C,aAAauC,MAAMuB,IAAI,IAAIvB,MAAMG,MAAM;gBAEtEH,MAAM3B,MAAM,GAAG,MAAMJ,eAAe;oBAClCC;oBACAC,oBAAoB,IAAIC;oBACxBC,QAAQ2B,MAAM3B,MAAM;oBACpBC;oBACAC;oBACAC;gBACF;gBACAG,MAAMmB,MAAM,CAACsB,EAAE,GAAGpB;YACpB;QACF;QAEA3B,MAAM,CAACI,EAAE,GAAGE;IACd;IAEA,OAAON;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/fields/config/sanitize.ts"],"sourcesContent":["import type { Config, SanitizedConfig } from '../../config/types.js'\nimport type { Field } from './types.js'\n\nimport { MissingEditorProp } from '../../errors/MissingEditorProp.js'\nimport {\n DuplicateFieldName,\n InvalidFieldName,\n InvalidFieldRelationship,\n MissingFieldType,\n} from '../../errors/index.js'\nimport { formatLabels, toWords } from '../../utilities/formatLabels.js'\nimport { baseBlockFields } from '../baseFields/baseBlockFields.js'\nimport { baseIDField } from '../baseFields/baseIDField.js'\nimport { setDefaultBeforeDuplicate } from '../setDefaultBeforeDuplicate.js'\nimport validations from '../validations.js'\nimport { fieldAffectsData, tabHasName } from './types.js'\n\ntype Args = {\n config: Config\n existingFieldNames?: Set<string>\n fields: Field[]\n /**\n * If true, a richText field will require an editor property to be set, as the sanitizeFields function will not add it from the payload config if not present.\n *\n * @default false\n */\n requireFieldLevelRichTextEditor?: boolean\n /**\n * If this property is set, RichText fields won't be sanitized immediately. Instead, they will be added to this array as promises\n * so that you can sanitize them together, after the config has been sanitized.\n */\n richTextSanitizationPromises?: Array<(config: SanitizedConfig) => Promise<void>>\n\n /**\n * If not null, will validate that upload and relationship fields do not relate to a collection that is not in this array.\n * This validation will be skipped if validRelationships is null.\n */\n validRelationships: null | string[]\n}\n\nexport const sanitizeFields = async ({\n config,\n existingFieldNames = new Set(),\n fields,\n requireFieldLevelRichTextEditor = false,\n richTextSanitizationPromises,\n validRelationships,\n}: Args): Promise<Field[]> => {\n if (!fields) return []\n\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i]\n\n if (!field.type) throw new MissingFieldType(field)\n\n // assert that field names do not contain forbidden characters\n if (fieldAffectsData(field) && field.name.includes('.')) {\n throw new InvalidFieldName(field, field.name)\n }\n\n // Auto-label\n if (\n 'name' in field &&\n field.name &&\n typeof field.label !== 'object' &&\n typeof field.label !== 'string' &&\n field.label !== false\n ) {\n field.label = toWords(field.name)\n }\n\n if (\n field.type === 'checkbox' &&\n typeof field.defaultValue === 'undefined' &&\n field.required === true\n ) {\n field.defaultValue = false\n }\n\n if (field.type === 'relationship' || field.type === 'upload') {\n if (validRelationships) {\n const relationships = Array.isArray(field.relationTo)\n ? field.relationTo\n : [field.relationTo]\n relationships.forEach((relationship: string) => {\n if (!validRelationships.includes(relationship)) {\n throw new InvalidFieldRelationship(field, relationship)\n }\n })\n }\n\n if (field.type === 'relationship') {\n if (field.min && !field.minRows) {\n console.warn(\n `(payload): The \"min\" property is deprecated for the Relationship field \"${field.name}\" and will be removed in a future version. Please use \"minRows\" instead.`,\n )\n }\n if (field.max && !field.maxRows) {\n console.warn(\n `(payload): The \"max\" property is deprecated for the Relationship field \"${field.name}\" and will be removed in a future version. Please use \"maxRows\" instead.`,\n )\n }\n field.minRows = field.minRows || field.min\n field.maxRows = field.maxRows || field.max\n }\n }\n\n if (field.type === 'blocks' && field.blocks) {\n field.blocks = field.blocks.map((block) => ({\n ...block,\n fields: block.fields.concat(baseBlockFields),\n }))\n }\n\n if (field.type === 'array' && field.fields) {\n field.fields.push(baseIDField)\n }\n\n if ((field.type === 'blocks' || field.type === 'array') && field.label) {\n field.labels = field.labels || formatLabels(field.name)\n }\n\n if (fieldAffectsData(field)) {\n if (existingFieldNames.has(field.name)) {\n throw new DuplicateFieldName(field.name)\n } else if (!['blockName', 'id'].includes(field.name)) {\n existingFieldNames.add(field.name)\n }\n\n if (field.localized && !config.localization) delete field.localized\n\n if (typeof field.validate === 'undefined') {\n const defaultValidate = validations[field.type]\n if (defaultValidate) {\n field.validate = (val, options) => defaultValidate(val, { ...field, ...options })\n } else {\n field.validate = () => true\n }\n }\n\n if (!field.hooks) field.hooks = {}\n if (!field.access) field.access = {}\n\n setDefaultBeforeDuplicate(field)\n }\n\n if (!field.admin) {\n field.admin = {}\n }\n\n // Make sure that the richText field has an editor\n if (field.type === 'richText') {\n const sanitizeRichText = async (_config: SanitizedConfig) => {\n if (!field.editor) {\n if (_config.editor && !requireFieldLevelRichTextEditor) {\n // config.editor should be sanitized at this point\n field.editor = _config.editor\n } else {\n throw new MissingEditorProp(field)\n }\n }\n\n if (typeof field.editor === 'function') {\n field.editor = await field.editor({\n config: _config,\n isRoot: requireFieldLevelRichTextEditor,\n })\n }\n\n // Add editor adapter hooks to field hooks\n if (!field.hooks) field.hooks = {}\n\n const mergeHooks = (hookName: keyof typeof field.editor.hooks) => {\n if (typeof field.editor === 'function') return\n\n if (field.editor?.hooks?.[hookName]?.length) {\n field.hooks[hookName] = field.hooks[hookName]\n ? field.hooks[hookName].concat(field.editor.hooks[hookName])\n : [...field.editor.hooks[hookName]]\n }\n }\n\n mergeHooks('afterRead')\n mergeHooks('afterChange')\n mergeHooks('beforeChange')\n mergeHooks('beforeValidate')\n mergeHooks('beforeDuplicate')\n }\n if (richTextSanitizationPromises) {\n richTextSanitizationPromises.push(sanitizeRichText)\n } else {\n await sanitizeRichText(config as unknown as SanitizedConfig)\n }\n }\n\n if ('fields' in field && field.fields) {\n field.fields = await sanitizeFields({\n config,\n existingFieldNames: fieldAffectsData(field) ? new Set() : existingFieldNames,\n fields: field.fields,\n requireFieldLevelRichTextEditor,\n richTextSanitizationPromises,\n validRelationships,\n })\n }\n\n if (field.type === 'tabs') {\n for (let j = 0; j < field.tabs.length; j++) {\n const tab = field.tabs[j]\n if (tabHasName(tab) && typeof tab.label === 'undefined') {\n tab.label = toWords(tab.name)\n }\n\n tab.fields = await sanitizeFields({\n config,\n existingFieldNames: tabHasName(tab) ? new Set() : existingFieldNames,\n fields: tab.fields,\n requireFieldLevelRichTextEditor,\n richTextSanitizationPromises,\n validRelationships,\n })\n field.tabs[j] = tab\n }\n }\n\n if ('blocks' in field && field.blocks) {\n for (let j = 0; j < field.blocks.length; j++) {\n const block = field.blocks[j]\n block.labels = !block.labels ? formatLabels(block.slug) : block.labels\n\n block.fields = await sanitizeFields({\n config,\n existingFieldNames: new Set(),\n fields: block.fields,\n requireFieldLevelRichTextEditor,\n richTextSanitizationPromises,\n validRelationships,\n })\n field.blocks[j] = block\n }\n }\n\n fields[i] = field\n }\n\n return fields\n}\n"],"names":["MissingEditorProp","DuplicateFieldName","InvalidFieldName","InvalidFieldRelationship","MissingFieldType","formatLabels","toWords","baseBlockFields","baseIDField","setDefaultBeforeDuplicate","validations","fieldAffectsData","tabHasName","sanitizeFields","config","existingFieldNames","Set","fields","requireFieldLevelRichTextEditor","richTextSanitizationPromises","validRelationships","i","length","field","type","name","includes","label","defaultValue","required","relationships","Array","isArray","relationTo","forEach","relationship","min","minRows","console","warn","max","maxRows","blocks","map","block","concat","push","labels","has","add","localized","localization","validate","defaultValidate","val","options","hooks","access","admin","sanitizeRichText","_config","editor","isRoot","mergeHooks","hookName","j","tabs","tab","slug"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,iBAAiB,QAAQ,oCAAmC;AACrE,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,wBAAwB,EACxBC,gBAAgB,QACX,wBAAuB;AAC9B,SAASC,YAAY,EAAEC,OAAO,QAAQ,kCAAiC;AACvE,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,WAAW,QAAQ,+BAA8B;AAC1D,SAASC,yBAAyB,QAAQ,kCAAiC;AAC3E,OAAOC,iBAAiB,oBAAmB;AAC3C,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,aAAY;AAyBzD,OAAO,MAAMC,iBAAiB,OAAO,EACnCC,MAAM,EACNC,qBAAqB,IAAIC,KAAK,EAC9BC,MAAM,EACNC,kCAAkC,KAAK,EACvCC,4BAA4B,EAC5BC,kBAAkB,EACb;IACL,IAAI,CAACH,QAAQ,OAAO,EAAE;IAEtB,IAAK,IAAII,IAAI,GAAGA,IAAIJ,OAAOK,MAAM,EAAED,IAAK;QACtC,MAAME,QAAQN,MAAM,CAACI,EAAE;QAEvB,IAAI,CAACE,MAAMC,IAAI,EAAE,MAAM,IAAIpB,iBAAiBmB;QAE5C,8DAA8D;QAC9D,IAAIZ,iBAAiBY,UAAUA,MAAME,IAAI,CAACC,QAAQ,CAAC,MAA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e,WAAW,CAAA"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/fields/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AAIrB,eAAO,MAAM,wBAAwB,uBAOvB,CAAA;AAEd,eAAO,MAAM,eAAe,uBAgB1B,CAAA;AAEF,eAAO,MAAM,SAAS,uBAoCV,CAAA;AAEZ,eAAO,MAAM,OAAO,uBAKlB,CAAA;AAEF,eAAO,MAAM,IAAI,uBAsBf,CAAA;AAEF,eAAO,MAAM,MAAM,uBAgCjB,CAAA;AAEF,eAAO,MAAM,QAAQ,uBAiBnB,CAAA;AAEF,eAAO,MAAM,KAAK,uBAgBhB,CAAA;AAEF,eAAO,MAAM,IAAI,uBAYf,CAAA;AAEF,eAAO,MAAM,IAAI,uBAYf,CAAA;AAEF,eAAO,MAAM,MAAM,uBAgCjB,CAAA;AAEF,eAAO,MAAM,KAAK,uBA4BhB,CAAA;AAEF,eAAO,MAAM,GAAG,uBAId,CAAA;AAEF,eAAO,MAAM,WAAW,uBAKtB,CAAA;AAeF,eAAO,MAAM,IAAI,uBAQf,CAAA;AAEF,eAAO,MAAM,KAAK,uBAShB,CAAA;AAEF,eAAO,MAAM,KAAK,uBA2BhB,CAAA;AAEF,eAAO,MAAM,MAAM,uBAajB,CAAA;AAEF,eAAO,MAAM,QAAQ,uBAYnB,CAAA;AAEF,eAAO,MAAM,KAAK,uBAYhB,CAAA;AAEF,eAAO,MAAM,YAAY,uBA+BvB,CAAA;AAEF,eAAO,MAAM,MAAM,uBA+CjB,CAAA;AAEF,eAAO,MAAM,QAAQ,uBAsBnB,CAAA;AAEF,eAAO,MAAM,IAAI,uBAyBf,CAAA;AAEF,eAAO,MAAM,EAAE,uBAqBb,CAAA;AAEF,QAAA,MAAM,WAAW,6BAyBH,CAAA;AAEd,eAAe,WAAW,CAAA"}
@@ -277,7 +277,8 @@ export const array = baseField.keys({
277
277
  admin: baseAdminFields.keys({
278
278
  components: baseAdminComponentFields.keys({
279
279
  RowLabel: componentSchema
280
- }).default({})
280
+ }).default({}),
281
+ isSortable: joi.boolean()
281
282
  }).default({}),
282
283
  dbName: joi.alternatives().try(joi.string(), joi.func()),
283
284
  defaultValue: joi.alternatives().try(joi.array().items(joi.object()), joi.func()),
@@ -379,6 +380,9 @@ export const relationship = baseField.keys({
379
380
  export const blocks = baseField.keys({
380
381
  name: joi.string().required(),
381
382
  type: joi.string().valid('blocks').required(),
383
+ admin: baseAdminFields.keys({
384
+ isSortable: joi.boolean()
385
+ }).default({}),
382
386
  blocks: joi.array().items(joi.object({
383
387
  slug: joi.string().required(),
384
388
  admin: joi.object().keys({
@@ -431,7 +435,8 @@ export const richText = baseField.keys({
431
435
  outputSchema: joi.func().optional(),
432
436
  populationPromise: joi.func().optional(),
433
437
  validate: joi.func().required()
434
- }).unknown()
438
+ }).unknown(),
439
+ maxDepth: joi.number()
435
440
  });
436
441
  export const date = baseField.keys({
437
442
  name: joi.string().required(),