payload 3.32.0-internal.f2e77bd → 3.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/forms/Form.d.ts +12 -1
- package/dist/admin/forms/Form.d.ts.map +1 -1
- package/dist/admin/forms/Form.js.map +1 -1
- package/dist/admin/functions/index.d.ts +1 -0
- package/dist/admin/functions/index.d.ts.map +1 -1
- package/dist/admin/functions/index.js.map +1 -1
- package/dist/bin/generateImportMap/index.js +3 -3
- package/dist/bin/generateImportMap/index.js.map +1 -1
- package/dist/bin/generateTypes.js +3 -3
- package/dist/bin/generateTypes.js.map +1 -1
- package/dist/collections/config/sanitize.d.ts.map +1 -1
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/collections/config/types.d.ts +11 -0
- package/dist/collections/config/types.d.ts.map +1 -1
- package/dist/collections/config/types.js.map +1 -1
- package/dist/config/orderable/fractional-indexing.d.ts +31 -0
- package/dist/config/orderable/fractional-indexing.d.ts.map +1 -0
- package/dist/config/orderable/fractional-indexing.js +295 -0
- package/dist/config/orderable/fractional-indexing.js.map +1 -0
- package/dist/config/orderable/index.d.ts +28 -0
- package/dist/config/orderable/index.d.ts.map +1 -0
- package/dist/config/orderable/index.js +259 -0
- package/dist/config/orderable/index.js.map +1 -0
- package/dist/config/sanitize.d.ts.map +1 -1
- package/dist/config/sanitize.js +3 -0
- package/dist/config/sanitize.js.map +1 -1
- package/dist/database/defaultUpdateJobs.d.ts.map +1 -1
- package/dist/database/defaultUpdateJobs.js +1 -4
- package/dist/database/defaultUpdateJobs.js.map +1 -1
- package/dist/database/types.d.ts +6 -0
- package/dist/database/types.d.ts.map +1 -1
- package/dist/database/types.js.map +1 -1
- package/dist/fields/config/types.d.ts +12 -1
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/queues/config/types/index.d.ts +15 -1
- package/dist/queues/config/types/index.d.ts.map +1 -1
- package/dist/queues/config/types/index.js.map +1 -1
- package/dist/queues/config/types/workflowTypes.d.ts +1 -1
- package/dist/queues/config/types/workflowTypes.d.ts.map +1 -1
- package/dist/queues/config/types/workflowTypes.js.map +1 -1
- package/dist/queues/localAPI.d.ts +12 -1
- package/dist/queues/localAPI.d.ts.map +1 -1
- package/dist/queues/localAPI.js +2 -0
- package/dist/queues/localAPI.js.map +1 -1
- package/dist/queues/operations/runJobs/index.d.ts +15 -2
- package/dist/queues/operations/runJobs/index.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/index.js +30 -4
- package/dist/queues/operations/runJobs/index.js.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +5 -1
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js +14 -1
- package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js.map +1 -1
- package/dist/queues/operations/runJobs/runJob/index.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/runJob/index.js +2 -0
- package/dist/queues/operations/runJobs/runJob/index.js.map +1 -1
- package/dist/queues/utilities/updateJob.d.ts.map +1 -1
- package/dist/queues/utilities/updateJob.js +10 -9
- package/dist/queues/utilities/updateJob.js.map +1 -1
- package/dist/uploads/deleteAssociatedFiles.js +3 -3
- package/dist/uploads/deleteAssociatedFiles.js.map +1 -1
- package/dist/uploads/fileExists.js +2 -2
- package/dist/uploads/fileExists.js.map +1 -1
- package/dist/uploads/generateFileData.d.ts.map +1 -1
- package/dist/uploads/generateFileData.js +4 -5
- package/dist/uploads/generateFileData.js.map +1 -1
- package/dist/uploads/getFileByPath.js +3 -3
- package/dist/uploads/getFileByPath.js.map +1 -1
- package/dist/uploads/getImageSize.js +2 -2
- package/dist/uploads/getImageSize.js.map +1 -1
- package/dist/uploads/imageResizer.js +2 -2
- package/dist/uploads/imageResizer.js.map +1 -1
- package/dist/uploads/saveBufferToFile.js +2 -2
- package/dist/uploads/saveBufferToFile.js.map +1 -1
- package/dist/uploads/tempFile.js +4 -4
- package/dist/uploads/tempFile.js.map +1 -1
- package/dist/uploads/unlinkTempFiles.d.ts.map +1 -1
- package/dist/uploads/unlinkTempFiles.js +2 -4
- package/dist/uploads/unlinkTempFiles.js.map +1 -1
- package/dist/utilities/configToJSONSchema.js +3 -3
- package/dist/utilities/configToJSONSchema.js.map +1 -1
- package/dist/utilities/configToJSONSchema.spec.js +29 -0
- package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
- package/dist/utilities/flattenAllFields.d.ts +5 -0
- package/dist/utilities/flattenAllFields.d.ts.map +1 -1
- package/dist/utilities/flattenAllFields.js +5 -1
- package/dist/utilities/flattenAllFields.js.map +1 -1
- package/package.json +2 -2
- package/dist/queues/utilities/sanitizeUpdateData.d.ts +0 -9
- package/dist/queues/utilities/sanitizeUpdateData.d.ts.map +0 -1
- package/dist/queues/utilities/sanitizeUpdateData.js +0 -25
- package/dist/queues/utilities/sanitizeUpdateData.js.map +0 -1
|
@@ -40,11 +40,22 @@ export type FieldState = {
|
|
|
40
40
|
*/
|
|
41
41
|
fieldSchema?: Field;
|
|
42
42
|
filterOptions?: FilterOptionsResult;
|
|
43
|
-
ignoreServerProps?: Partial<Record<keyof FieldState, boolean>>;
|
|
44
43
|
initialValue?: unknown;
|
|
45
44
|
passesCondition?: boolean;
|
|
46
45
|
requiresRender?: boolean;
|
|
47
46
|
rows?: Row[];
|
|
47
|
+
/**
|
|
48
|
+
* The `serverPropsToIgnore` obj is used to prevent the various properties from being overridden across form state requests.
|
|
49
|
+
* This can happen when queueing a form state request with `requiresRender: true` while the another is already processing.
|
|
50
|
+
* For example:
|
|
51
|
+
* 1. One "add row" action will set `requiresRender: true` and dispatch a form state request
|
|
52
|
+
* 2. Another "add row" action will set `requiresRender: true` and queue a form state request
|
|
53
|
+
* 3. The first request will return with `requiresRender: false`
|
|
54
|
+
* 4. The second request will be dispatched with `requiresRender: false` but should be `true`
|
|
55
|
+
* To fix this, only merge the `requiresRender` property if the previous state has not set it to `true`.
|
|
56
|
+
* See the `mergeServerFormState` function for implementation details.
|
|
57
|
+
*/
|
|
58
|
+
serverPropsToIgnore?: Array<keyof FieldState>;
|
|
48
59
|
valid?: boolean;
|
|
49
60
|
validate?: Validate;
|
|
50
61
|
value?: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/Form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAElE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAE7E,MAAM,MAAM,IAAI,GAAG;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,GAAG,GAAG;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAA;CACpC,CAA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AgB,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,CACA;IACE,cAAc,EAAE,MAAM,CAAA;IAGtB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,GACD;IACE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB,CACJ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/forms/Form.ts"],"sourcesContent":["import { type SupportedLanguages } from '@payloadcms/translations'\n\nimport type { SanitizedDocumentPermissions } from '../../auth/types.js'\nimport type { Field, Validate } from '../../fields/config/types.js'\nimport type { TypedLocale } from '../../index.js'\nimport type { DocumentPreferences } from '../../preferences/types.js'\nimport type { PayloadRequest, SelectType, Where } from '../../types/index.js'\n\nexport type Data = {\n [key: string]: any\n}\n\nexport type Row = {\n blockType?: string\n collapsed?: boolean\n id: string\n isLoading?: boolean\n}\n\nexport type FilterOptionsResult = {\n [relation: string]: boolean | Where\n}\n\nexport type FieldState = {\n customComponents?: {\n /**\n * This is used by UI fields, as they can have arbitrary components defined if used\n * as a vessel to bring in custom components.\n */\n [key: string]: React.ReactNode | React.ReactNode[] | undefined\n AfterInput?: React.ReactNode\n BeforeInput?: React.ReactNode\n Description?: React.ReactNode\n Error?: React.ReactNode\n Field?: React.ReactNode\n Label?: React.ReactNode\n RowLabels?: React.ReactNode[]\n }\n disableFormData?: boolean\n errorMessage?: string\n errorPaths?: string[]\n /**\n * The fieldSchema may be part of the form state if `includeSchema: true` is passed to buildFormState.\n * This will never be in the form state of the client.\n */\n fieldSchema?: Field\n filterOptions?: FilterOptionsResult\n
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/forms/Form.ts"],"sourcesContent":["import { type SupportedLanguages } from '@payloadcms/translations'\n\nimport type { SanitizedDocumentPermissions } from '../../auth/types.js'\nimport type { Field, Validate } from '../../fields/config/types.js'\nimport type { TypedLocale } from '../../index.js'\nimport type { DocumentPreferences } from '../../preferences/types.js'\nimport type { PayloadRequest, SelectType, Where } from '../../types/index.js'\n\nexport type Data = {\n [key: string]: any\n}\n\nexport type Row = {\n blockType?: string\n collapsed?: boolean\n id: string\n isLoading?: boolean\n}\n\nexport type FilterOptionsResult = {\n [relation: string]: boolean | Where\n}\n\nexport type FieldState = {\n customComponents?: {\n /**\n * This is used by UI fields, as they can have arbitrary components defined if used\n * as a vessel to bring in custom components.\n */\n [key: string]: React.ReactNode | React.ReactNode[] | undefined\n AfterInput?: React.ReactNode\n BeforeInput?: React.ReactNode\n Description?: React.ReactNode\n Error?: React.ReactNode\n Field?: React.ReactNode\n Label?: React.ReactNode\n RowLabels?: React.ReactNode[]\n }\n disableFormData?: boolean\n errorMessage?: string\n errorPaths?: string[]\n /**\n * The fieldSchema may be part of the form state if `includeSchema: true` is passed to buildFormState.\n * This will never be in the form state of the client.\n */\n fieldSchema?: Field\n filterOptions?: FilterOptionsResult\n initialValue?: unknown\n passesCondition?: boolean\n requiresRender?: boolean\n rows?: Row[]\n /**\n * The `serverPropsToIgnore` obj is used to prevent the various properties from being overridden across form state requests.\n * This can happen when queueing a form state request with `requiresRender: true` while the another is already processing.\n * For example:\n * 1. One \"add row\" action will set `requiresRender: true` and dispatch a form state request\n * 2. Another \"add row\" action will set `requiresRender: true` and queue a form state request\n * 3. The first request will return with `requiresRender: false`\n * 4. The second request will be dispatched with `requiresRender: false` but should be `true`\n * To fix this, only merge the `requiresRender` property if the previous state has not set it to `true`.\n * See the `mergeServerFormState` function for implementation details.\n */\n serverPropsToIgnore?: Array<keyof FieldState>\n valid?: boolean\n validate?: Validate\n value?: unknown\n}\n\nexport type FieldStateWithoutComponents = Omit<FieldState, 'customComponents'>\n\nexport type FormState = {\n [path: string]: FieldState\n}\n\nexport type FormStateWithoutComponents = {\n [path: string]: FieldStateWithoutComponents\n}\n\nexport type BuildFormStateArgs = {\n data?: Data\n docPermissions: SanitizedDocumentPermissions | undefined\n docPreferences: DocumentPreferences\n /**\n * In case `formState` is not the top-level, document form state, this can be passed to\n * provide the top-level form state.\n */\n documentFormState?: FormState\n fallbackLocale?: false | TypedLocale\n formState?: FormState\n id?: number | string\n initialBlockData?: Data\n initialBlockFormState?: FormState\n /*\n If not i18n was passed, the language can be passed to init i18n\n */\n language?: keyof SupportedLanguages\n locale?: string\n operation?: 'create' | 'update'\n /*\n If true, will render field components within their state object\n */\n renderAllFields?: boolean\n req: PayloadRequest\n returnLockStatus?: boolean\n schemaPath: string\n select?: SelectType\n skipValidation?: boolean\n updateLastEdited?: boolean\n} & (\n | {\n collectionSlug: string\n // Do not type it as never. This still makes it so that either collectionSlug or globalSlug is required, but makes it easier to provide both collectionSlug and globalSlug if it's\n // unclear which one is actually available.\n globalSlug?: string\n }\n | {\n collectionSlug?: string\n globalSlug: string\n }\n)\n"],"names":[],"mappings":"AA8EA,WAyCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/admin/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAA;AAEnF,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,SAAS,CAAA;IACpB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,IAAI,EAAE,MAAM,CAAA;CACb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;IACnB,eAAe,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;CAC1C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/functions/index.ts"],"sourcesContent":["import type { ImportMap } from '../../bin/generateImportMap/index.js'\nimport type { SanitizedConfig } from '../../config/types.js'\nimport type { PaginatedDocs } from '../../database/types.js'\nimport type { CollectionSlug, ColumnPreference } from '../../index.js'\nimport type { PayloadRequest, Sort, Where } from '../../types/index.js'\nimport type { ColumnsFromURL } from '../../utilities/transformColumnPreferences.js'\n\nexport type DefaultServerFunctionArgs = {\n importMap: ImportMap\n req: PayloadRequest\n}\n\nexport type ServerFunctionArgs = {\n args: Record<string, unknown>\n name: string\n}\n\nexport type ServerFunctionClientArgs = {\n args: Record<string, unknown>\n name: string\n}\n\nexport type ServerFunctionClient = (args: ServerFunctionClientArgs) => Promise<unknown> | unknown\n\nexport type ServerFunction = (\n args: DefaultServerFunctionArgs & ServerFunctionClientArgs['args'],\n) => Promise<unknown> | unknown\n\nexport type ServerFunctionConfig = {\n fn: ServerFunction\n name: string\n}\n\nexport type ServerFunctionHandler = (\n args: {\n config: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n } & ServerFunctionClientArgs,\n) => Promise<unknown>\n\nexport type ListQuery = {\n /*\n * This is an of strings, i.e. `['title', '-slug']`\n * Use `transformColumnsToPreferences` and `transformColumnsToSearchParams` to convert it back and forth\n */\n columns?: ColumnsFromURL\n limit?: string\n page?: string\n preset?: number | string\n /*\n When provided, is automatically injected into the `where` object\n */\n search?: string\n sort?: Sort\n where?: Where\n}\n\nexport type BuildTableStateArgs = {\n collectionSlug: string | string[]\n columns?: ColumnPreference[]\n docs?: PaginatedDocs['docs']\n enableRowSelections?: boolean\n parent?: {\n collectionSlug: CollectionSlug\n id: number | string\n joinPath: string\n }\n query?: ListQuery\n renderRowTypes?: boolean\n req: PayloadRequest\n tableAppearance?: 'condensed' | 'default'\n}\n"],"names":[],"mappings":"AAyDA,
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/functions/index.ts"],"sourcesContent":["import type { ImportMap } from '../../bin/generateImportMap/index.js'\nimport type { SanitizedConfig } from '../../config/types.js'\nimport type { PaginatedDocs } from '../../database/types.js'\nimport type { CollectionSlug, ColumnPreference } from '../../index.js'\nimport type { PayloadRequest, Sort, Where } from '../../types/index.js'\nimport type { ColumnsFromURL } from '../../utilities/transformColumnPreferences.js'\n\nexport type DefaultServerFunctionArgs = {\n importMap: ImportMap\n req: PayloadRequest\n}\n\nexport type ServerFunctionArgs = {\n args: Record<string, unknown>\n name: string\n}\n\nexport type ServerFunctionClientArgs = {\n args: Record<string, unknown>\n name: string\n}\n\nexport type ServerFunctionClient = (args: ServerFunctionClientArgs) => Promise<unknown> | unknown\n\nexport type ServerFunction = (\n args: DefaultServerFunctionArgs & ServerFunctionClientArgs['args'],\n) => Promise<unknown> | unknown\n\nexport type ServerFunctionConfig = {\n fn: ServerFunction\n name: string\n}\n\nexport type ServerFunctionHandler = (\n args: {\n config: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n } & ServerFunctionClientArgs,\n) => Promise<unknown>\n\nexport type ListQuery = {\n /*\n * This is an of strings, i.e. `['title', '-slug']`\n * Use `transformColumnsToPreferences` and `transformColumnsToSearchParams` to convert it back and forth\n */\n columns?: ColumnsFromURL\n limit?: string\n page?: string\n preset?: number | string\n /*\n When provided, is automatically injected into the `where` object\n */\n search?: string\n sort?: Sort\n where?: Where\n}\n\nexport type BuildTableStateArgs = {\n collectionSlug: string | string[]\n columns?: ColumnPreference[]\n docs?: PaginatedDocs['docs']\n enableRowSelections?: boolean\n orderableFieldName: string\n parent?: {\n collectionSlug: CollectionSlug\n id: number | string\n joinPath: string\n }\n query?: ListQuery\n renderRowTypes?: boolean\n req: PayloadRequest\n tableAppearance?: 'condensed' | 'default'\n}\n"],"names":[],"mappings":"AAyDA,WAeC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* eslint-disable no-console */ import fs from 'fs';
|
|
1
|
+
/* eslint-disable no-console */ import fs from 'fs/promises';
|
|
2
2
|
import process from 'node:process';
|
|
3
3
|
import { iterateConfig } from './iterateConfig.js';
|
|
4
4
|
import { addPayloadComponentToImportMap } from './utilities/addPayloadComponentToImportMap.js';
|
|
@@ -81,7 +81,7 @@ ${mapKeys.join(',\n')}
|
|
|
81
81
|
`;
|
|
82
82
|
if (!force) {
|
|
83
83
|
// Read current import map and check in the IMPORTS if there are any new imports. If not, don't write the file.
|
|
84
|
-
const currentImportMap = await fs.
|
|
84
|
+
const currentImportMap = await fs.readFile(importMapFilePath, 'utf-8');
|
|
85
85
|
if (currentImportMap?.trim() === importMapOutputFile?.trim()) {
|
|
86
86
|
if (log) {
|
|
87
87
|
console.log('No new imports found, skipping writing import map');
|
|
@@ -92,7 +92,7 @@ ${mapKeys.join(',\n')}
|
|
|
92
92
|
if (log) {
|
|
93
93
|
console.log('Writing import map to', importMapFilePath);
|
|
94
94
|
}
|
|
95
|
-
await fs.
|
|
95
|
+
await fs.writeFile(importMapFilePath, importMapOutputFile);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/bin/generateImportMap/index.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport fs from 'fs'\nimport process from 'node:process'\n\nimport type { PayloadComponent, SanitizedConfig } from '../../config/types.js'\n\nimport { iterateConfig } from './iterateConfig.js'\nimport { addPayloadComponentToImportMap } from './utilities/addPayloadComponentToImportMap.js'\nimport { getImportMapToBaseDirPath } from './utilities/getImportMapToBaseDirPath.js'\nimport { resolveImportMapFilePath } from './utilities/resolveImportMapFilePath.js'\n\ntype ImportIdentifier = string\ntype ImportSpecifier = string\ntype ImportPath = string\ntype UserImportPath = string\n\n/**\n * Import Map before being written to the file. Only contains all paths\n */\nexport type InternalImportMap = {\n [path: UserImportPath]: ImportIdentifier\n}\n\n/**\n * Imports of the import map.\n */\nexport type Imports = {\n [identifier: ImportIdentifier]: {\n path: ImportPath\n specifier: ImportSpecifier\n }\n}\n\n/**\n * Import Map after being imported from the actual import map. Contains all the actual imported components\n */\nexport type ImportMap = {\n [path: UserImportPath]: any\n}\n\nexport type AddToImportMap = (payloadComponent: PayloadComponent | PayloadComponent[]) => void\n\nexport async function generateImportMap(\n config: SanitizedConfig,\n options?: { force?: boolean; log: boolean },\n): Promise<void> {\n const shouldLog = options?.log ?? true\n\n if (shouldLog) {\n console.log('Generating import map')\n }\n\n const importMap: InternalImportMap = {}\n const imports: Imports = {}\n\n // Determine the root directory of the project - usually the directory where the src or app folder is located\n const rootDir = process.env.ROOT_DIR ?? process.cwd()\n\n const baseDir = config.admin.importMap.baseDir ?? process.cwd()\n\n const importMapFilePath = resolveImportMapFilePath({\n adminRoute: config.routes.admin,\n importMapFile: config?.admin?.importMap?.importMapFile,\n rootDir,\n })\n\n const importMapToBaseDirPath = getImportMapToBaseDirPath({\n baseDir,\n importMapPath: importMapFilePath,\n })\n\n const addToImportMap: AddToImportMap = (payloadComponent) => {\n if (!payloadComponent) {\n return\n }\n\n if (typeof payloadComponent !== 'object' && typeof payloadComponent !== 'string') {\n console.error(payloadComponent)\n throw new Error('addToImportMap > Payload component must be an object or a string')\n }\n\n if (Array.isArray(payloadComponent)) {\n for (const component of payloadComponent) {\n addPayloadComponentToImportMap({\n importMap,\n importMapToBaseDirPath,\n imports,\n payloadComponent: component,\n })\n }\n } else {\n addPayloadComponentToImportMap({\n importMap,\n importMapToBaseDirPath,\n imports,\n payloadComponent,\n })\n }\n }\n\n iterateConfig({\n addToImportMap,\n baseDir: config.admin.importMap.baseDir,\n config,\n importMap,\n imports,\n })\n\n await writeImportMap({\n componentMap: importMap,\n force: options?.force,\n importMap: imports,\n importMapFilePath,\n log: shouldLog,\n })\n}\n\nexport async function writeImportMap({\n componentMap,\n force,\n importMap,\n importMapFilePath,\n log,\n}: {\n componentMap: InternalImportMap\n force?: boolean\n importMap: Imports\n importMapFilePath: string\n log?: boolean\n}) {\n const imports: string[] = []\n for (const [identifier, { path, specifier }] of Object.entries(importMap)) {\n imports.push(`import { ${specifier} as ${identifier} } from '${path}'`)\n }\n\n const mapKeys: string[] = []\n for (const [userPath, identifier] of Object.entries(componentMap)) {\n mapKeys.push(` \"${userPath}\": ${identifier}`)\n }\n\n const importMapOutputFile = `${imports.join('\\n')}\n\nexport const importMap = {\n${mapKeys.join(',\\n')}\n}\n`\n\n if (!force) {\n // Read current import map and check in the IMPORTS if there are any new imports. If not, don't write the file.\n const currentImportMap = await fs.
|
|
1
|
+
{"version":3,"sources":["../../../src/bin/generateImportMap/index.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport fs from 'fs/promises'\nimport process from 'node:process'\n\nimport type { PayloadComponent, SanitizedConfig } from '../../config/types.js'\n\nimport { iterateConfig } from './iterateConfig.js'\nimport { addPayloadComponentToImportMap } from './utilities/addPayloadComponentToImportMap.js'\nimport { getImportMapToBaseDirPath } from './utilities/getImportMapToBaseDirPath.js'\nimport { resolveImportMapFilePath } from './utilities/resolveImportMapFilePath.js'\n\ntype ImportIdentifier = string\ntype ImportSpecifier = string\ntype ImportPath = string\ntype UserImportPath = string\n\n/**\n * Import Map before being written to the file. Only contains all paths\n */\nexport type InternalImportMap = {\n [path: UserImportPath]: ImportIdentifier\n}\n\n/**\n * Imports of the import map.\n */\nexport type Imports = {\n [identifier: ImportIdentifier]: {\n path: ImportPath\n specifier: ImportSpecifier\n }\n}\n\n/**\n * Import Map after being imported from the actual import map. Contains all the actual imported components\n */\nexport type ImportMap = {\n [path: UserImportPath]: any\n}\n\nexport type AddToImportMap = (payloadComponent: PayloadComponent | PayloadComponent[]) => void\n\nexport async function generateImportMap(\n config: SanitizedConfig,\n options?: { force?: boolean; log: boolean },\n): Promise<void> {\n const shouldLog = options?.log ?? true\n\n if (shouldLog) {\n console.log('Generating import map')\n }\n\n const importMap: InternalImportMap = {}\n const imports: Imports = {}\n\n // Determine the root directory of the project - usually the directory where the src or app folder is located\n const rootDir = process.env.ROOT_DIR ?? process.cwd()\n\n const baseDir = config.admin.importMap.baseDir ?? process.cwd()\n\n const importMapFilePath = resolveImportMapFilePath({\n adminRoute: config.routes.admin,\n importMapFile: config?.admin?.importMap?.importMapFile,\n rootDir,\n })\n\n const importMapToBaseDirPath = getImportMapToBaseDirPath({\n baseDir,\n importMapPath: importMapFilePath,\n })\n\n const addToImportMap: AddToImportMap = (payloadComponent) => {\n if (!payloadComponent) {\n return\n }\n\n if (typeof payloadComponent !== 'object' && typeof payloadComponent !== 'string') {\n console.error(payloadComponent)\n throw new Error('addToImportMap > Payload component must be an object or a string')\n }\n\n if (Array.isArray(payloadComponent)) {\n for (const component of payloadComponent) {\n addPayloadComponentToImportMap({\n importMap,\n importMapToBaseDirPath,\n imports,\n payloadComponent: component,\n })\n }\n } else {\n addPayloadComponentToImportMap({\n importMap,\n importMapToBaseDirPath,\n imports,\n payloadComponent,\n })\n }\n }\n\n iterateConfig({\n addToImportMap,\n baseDir: config.admin.importMap.baseDir,\n config,\n importMap,\n imports,\n })\n\n await writeImportMap({\n componentMap: importMap,\n force: options?.force,\n importMap: imports,\n importMapFilePath,\n log: shouldLog,\n })\n}\n\nexport async function writeImportMap({\n componentMap,\n force,\n importMap,\n importMapFilePath,\n log,\n}: {\n componentMap: InternalImportMap\n force?: boolean\n importMap: Imports\n importMapFilePath: string\n log?: boolean\n}) {\n const imports: string[] = []\n for (const [identifier, { path, specifier }] of Object.entries(importMap)) {\n imports.push(`import { ${specifier} as ${identifier} } from '${path}'`)\n }\n\n const mapKeys: string[] = []\n for (const [userPath, identifier] of Object.entries(componentMap)) {\n mapKeys.push(` \"${userPath}\": ${identifier}`)\n }\n\n const importMapOutputFile = `${imports.join('\\n')}\n\nexport const importMap = {\n${mapKeys.join(',\\n')}\n}\n`\n\n if (!force) {\n // Read current import map and check in the IMPORTS if there are any new imports. If not, don't write the file.\n const currentImportMap = await fs.readFile(importMapFilePath, 'utf-8')\n\n if (currentImportMap?.trim() === importMapOutputFile?.trim()) {\n if (log) {\n console.log('No new imports found, skipping writing import map')\n }\n return\n }\n }\n\n if (log) {\n console.log('Writing import map to', importMapFilePath)\n }\n\n await fs.writeFile(importMapFilePath, importMapOutputFile)\n}\n"],"names":["fs","process","iterateConfig","addPayloadComponentToImportMap","getImportMapToBaseDirPath","resolveImportMapFilePath","generateImportMap","config","options","shouldLog","log","console","importMap","imports","rootDir","env","ROOT_DIR","cwd","baseDir","admin","importMapFilePath","adminRoute","routes","importMapFile","importMapToBaseDirPath","importMapPath","addToImportMap","payloadComponent","error","Error","Array","isArray","component","writeImportMap","componentMap","force","identifier","path","specifier","Object","entries","push","mapKeys","userPath","importMapOutputFile","join","currentImportMap","readFile","trim","writeFile"],"mappings":"AAAA,6BAA6B,GAC7B,OAAOA,QAAQ,cAAa;AAC5B,OAAOC,aAAa,eAAc;AAIlC,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,8BAA8B,QAAQ,gDAA+C;AAC9F,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,wBAAwB,QAAQ,0CAAyC;AAiClF,OAAO,eAAeC,kBACpBC,MAAuB,EACvBC,OAA2C;IAE3C,MAAMC,YAAYD,SAASE,OAAO;IAElC,IAAID,WAAW;QACbE,QAAQD,GAAG,CAAC;IACd;IAEA,MAAME,YAA+B,CAAC;IACtC,MAAMC,UAAmB,CAAC;IAE1B,6GAA6G;IAC7G,MAAMC,UAAUb,QAAQc,GAAG,CAACC,QAAQ,IAAIf,QAAQgB,GAAG;IAEnD,MAAMC,UAAUX,OAAOY,KAAK,CAACP,SAAS,CAACM,OAAO,IAAIjB,QAAQgB,GAAG;IAE7D,MAAMG,oBAAoBf,yBAAyB;QACjDgB,YAAYd,OAAOe,MAAM,CAACH,KAAK;QAC/BI,eAAehB,QAAQY,OAAOP,WAAWW;QACzCT;IACF;IAEA,MAAMU,yBAAyBpB,0BAA0B;QACvDc;QACAO,e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B,CAAC;IAEC,IAAI,CAACV,OAAO;QACV,+GAA+G;QAC/G,MAAMW,mBAAmB,MAAM9C,GAAG+C,QAAQ,CAAC3B,mBAAmB;QAE9D,IAAI0B,kBAAkBE,WAAWJ,qBAAqBI,QAAQ;YAC5D,IAAItC,KAAK;gBACPC,QAAQD,GAAG,CAAC;YACd;YACA;QACF;IACF;IAEA,IAAIA,KAAK;QACPC,QAAQD,GAAG,CAAC,yBAAyBU;IACvC;IAEA,MAAMpB,GAAGiD,SAAS,CAAC7B,mBAAmBwB;AACxC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { initI18n } from '@payloadcms/translations';
|
|
2
|
-
import fs from 'fs';
|
|
2
|
+
import fs from 'fs/promises';
|
|
3
3
|
import { compile } from 'json-schema-to-typescript';
|
|
4
4
|
import { addSelectGenericsToGeneratedTypes } from '../utilities/addSelectGenericsToGeneretedTypes.js';
|
|
5
5
|
import { configToJSONSchema } from '../utilities/configToJSONSchema.js';
|
|
@@ -43,14 +43,14 @@ export async function generateTypes(config, options) {
|
|
|
43
43
|
}
|
|
44
44
|
// Diff the compiled types against the existing types file
|
|
45
45
|
try {
|
|
46
|
-
const existingTypes = fs.
|
|
46
|
+
const existingTypes = await fs.readFile(outputFile, 'utf-8');
|
|
47
47
|
if (compiled === existingTypes) {
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
} catch (_) {
|
|
51
51
|
// swallow err
|
|
52
52
|
}
|
|
53
|
-
fs.
|
|
53
|
+
await fs.writeFile(outputFile, compiled);
|
|
54
54
|
if (shouldLog) {
|
|
55
55
|
logger.info(`Types written to ${outputFile}`);
|
|
56
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bin/generateTypes.ts"],"sourcesContent":["import type { AcceptedLanguages } from '@payloadcms/translations'\n\nimport { initI18n } from '@payloadcms/translations'\nimport fs from 'fs'\nimport { compile } from 'json-schema-to-typescript'\n\nimport type { SanitizedConfig } from '../config/types.js'\n\nimport { addSelectGenericsToGeneratedTypes } from '../utilities/addSelectGenericsToGeneretedTypes.js'\nimport { configToJSONSchema } from '../utilities/configToJSONSchema.js'\nimport { getLogger } from '../utilities/logger.js'\n\nexport async function generateTypes(\n config: SanitizedConfig,\n options?: { log: boolean },\n): Promise<void> {\n const logger = getLogger('payload', 'sync')\n const outputFile = process.env.PAYLOAD_TS_OUTPUT_PATH || config.typescript.outputFile\n\n const shouldLog = options?.log ?? true\n\n if (shouldLog) {\n logger.info('Compiling TS types for Collections and Globals...')\n }\n\n const languages = Object.keys(config.i18n.supportedLanguages) as AcceptedLanguages[]\n\n const language = languages.includes('en') ? 'en' : config.i18n.fallbackLanguage\n\n const i18n = await initI18n({ config: config.i18n, context: 'api', language })\n\n const jsonSchema = configToJSONSchema(config, config.db.defaultIDType, i18n)\n\n const declare = `declare module 'payload' {\\n export interface GeneratedTypes extends Config {}\\n}`\n const declareWithTSIgnoreError = `declare module 'payload' {\\n // @ts-ignore \\n export interface GeneratedTypes extends Config {}\\n}`\n\n let compiled = await compile(jsonSchema, 'Config', {\n bannerComment:\n '/* tslint:disable */\\n/* eslint-disable */\\n/**\\n* This file was automatically generated by Payload.\\n* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,\\n* and re-run `payload generate:types` to regenerate this file.\\n*/',\n style: {\n singleQuote: true,\n },\n // Generates code for $defs that aren't referenced by the schema. Reason:\n // If a field defines an interfaceName, it should be included in the generated types\n // even if it's not used by another type. Reason: the user might want to use it in their own code.\n unreachableDefinitions: true,\n })\n\n compiled = addSelectGenericsToGeneratedTypes({ compiledGeneratedTypes: compiled })\n\n if (config.typescript.declare !== false) {\n if (config.typescript.declare?.ignoreTSError) {\n compiled += `\\n\\n${declareWithTSIgnoreError}`\n } else {\n compiled += `\\n\\n${declare}`\n }\n }\n\n // Diff the compiled types against the existing types file\n try {\n const existingTypes = fs.
|
|
1
|
+
{"version":3,"sources":["../../src/bin/generateTypes.ts"],"sourcesContent":["import type { AcceptedLanguages } from '@payloadcms/translations'\n\nimport { initI18n } from '@payloadcms/translations'\nimport fs from 'fs/promises'\nimport { compile } from 'json-schema-to-typescript'\n\nimport type { SanitizedConfig } from '../config/types.js'\n\nimport { addSelectGenericsToGeneratedTypes } from '../utilities/addSelectGenericsToGeneretedTypes.js'\nimport { configToJSONSchema } from '../utilities/configToJSONSchema.js'\nimport { getLogger } from '../utilities/logger.js'\n\nexport async function generateTypes(\n config: SanitizedConfig,\n options?: { log: boolean },\n): Promise<void> {\n const logger = getLogger('payload', 'sync')\n const outputFile = process.env.PAYLOAD_TS_OUTPUT_PATH || config.typescript.outputFile\n\n const shouldLog = options?.log ?? true\n\n if (shouldLog) {\n logger.info('Compiling TS types for Collections and Globals...')\n }\n\n const languages = Object.keys(config.i18n.supportedLanguages) as AcceptedLanguages[]\n\n const language = languages.includes('en') ? 'en' : config.i18n.fallbackLanguage\n\n const i18n = await initI18n({ config: config.i18n, context: 'api', language })\n\n const jsonSchema = configToJSONSchema(config, config.db.defaultIDType, i18n)\n\n const declare = `declare module 'payload' {\\n export interface GeneratedTypes extends Config {}\\n}`\n const declareWithTSIgnoreError = `declare module 'payload' {\\n // @ts-ignore \\n export interface GeneratedTypes extends Config {}\\n}`\n\n let compiled = await compile(jsonSchema, 'Config', {\n bannerComment:\n '/* tslint:disable */\\n/* eslint-disable */\\n/**\\n* This file was automatically generated by Payload.\\n* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,\\n* and re-run `payload generate:types` to regenerate this file.\\n*/',\n style: {\n singleQuote: true,\n },\n // Generates code for $defs that aren't referenced by the schema. Reason:\n // If a field defines an interfaceName, it should be included in the generated types\n // even if it's not used by another type. Reason: the user might want to use it in their own code.\n unreachableDefinitions: true,\n })\n\n compiled = addSelectGenericsToGeneratedTypes({ compiledGeneratedTypes: compiled })\n\n if (config.typescript.declare !== false) {\n if (config.typescript.declare?.ignoreTSError) {\n compiled += `\\n\\n${declareWithTSIgnoreError}`\n } else {\n compiled += `\\n\\n${declare}`\n }\n }\n\n // Diff the compiled types against the existing types file\n try {\n const existingTypes = await fs.readFile(outputFile, 'utf-8')\n\n if (compiled === existingTypes) {\n return\n }\n } catch (_) {\n // swallow err\n }\n\n await fs.writeFile(outputFile, compiled)\n if (shouldLog) {\n logger.info(`Types written to ${outputFile}`)\n }\n}\n"],"names":["initI18n","fs","compile","addSelectGenericsToGeneratedTypes","configToJSONSchema","getLogger","generateTypes","config","options","logger","outputFile","process","env","PAYLOAD_TS_OUTPUT_PATH","typescript","shouldLog","log","info","languages","Object","keys","i18n","supportedLanguages","language","includes","fallbackLanguage","context","jsonSchema","db","defaultIDType","declare","declareWithTSIgnoreError","compiled","bannerComment","style","singleQuote","unreachableDefinitions","compiledGeneratedTypes","ignoreTSError","existingTypes","readFile","_","writeFile"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,OAAOC,QAAQ,cAAa;AAC5B,SAASC,OAAO,QAAQ,4BAA2B;AAInD,SAASC,iCAAiC,QAAQ,oDAAmD;AACrG,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,SAAS,QAAQ,yBAAwB;AAElD,OAAO,eAAeC,cACpBC,MAAuB,EACvBC,OAA0B;IAE1B,MAAMC,SAASJ,UAAU,WAAW;IACpC,MAAMK,aAAaC,QAAQC,GAAG,CAACC,sBAAsB,IAAIN,OAAOO,UAAU,CAACJ,UAAU;IAErF,MAAMK,YAAYP,SAASQ,OAAO;IAElC,IAAID,WAAW;QACbN,OAAOQ,IAAI,CAAC;IACd;IAEA,MAAMC,YAAYC,OAAOC,IAAI,CAACb,OAAOc,IAAI,CAACC,kBAAkB;IAE5D,MAAMC,WAAWL,UAAUM,QAAQ,CAAC,QAAQ,OAAOjB,OAAOc,IAAI,CAACI,gBAAgB;IAE/E,MAAMJ,OAAO,MAAMrB,SAAS;QAAEO,QAAQA,OAAOc,IAAI;QAAEK,SAAS;QAAOH;IAAS;IAE5E,MAAMI,aAAavB,mBAAmBG,QAAQA,OAAOqB,EAAE,CAACC,aAAa,EAAER;IAEvE,MAAMS,UAAU,CAAC,kFAAkF,CAAC;IACpG,MAAMC,2BAA2B,CAAC,oGAAoG,CAAC;IAEvI,IAAIC,WAAW,MAAM9B,QAAQyB,YAAY,UAAU;QACjDM,eACE;QACFC,OAAO;YACLC,aAAa;QACf;QACA,yEAAyE;QACzE,oFAAoF;QACpF,kGAAkG;QAClGC,wBAAwB;IAC1B;IAEAJ,WAAW7B,kCAAkC;QAAEkC,wBAAwBL;IAAS;IAEhF,IAAIzB,OAAOO,UAAU,CAACgB,OAAO,KAAK,OAAO;QACvC,IAAIvB,OAAOO,UAAU,CAACgB,OAAO,EAAEQ,eAAe;YAC5CN,YAAY,CAAC,IAAI,EAAED,0BAA0B;QAC/C,OAAO;YACLC,YAAY,CAAC,IAAI,EAAEF,SAAS;QAC9B;IACF;IAEA,0DAA0D;IAC1D,IAAI;QACF,MAAMS,gBAAgB,MAAMtC,GAAGuC,QAAQ,CAAC9B,YAAY;QAEpD,IAAIsB,aAAaO,eAAe;YAC9B;QACF;IACF,EAAE,OAAOE,GAAG;IACV,cAAc;IAChB;IAEA,MAAMxC,GAAGyC,SAAS,CAAChC,YAAYsB;IAC/B,IAAIjB,WAAW;QACbN,OAAOQ,IAAI,CAAC,CAAC,iBAAiB,EAAEP,YAAY;IAC9C;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../src/collections/config/sanitize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../src/collections/config/sanitize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EACV,gBAAgB,EAChB,yBAAyB,EAG1B,MAAM,YAAY,CAAA;AAwBnB,eAAO,MAAM,kBAAkB,WACrB,MAAM,cACF,gBAAgB,iCAKG,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,wBAC1D,MAAM,EAAE,KAC7B,OAAO,CAAC,yBAAyB,CAkNnC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/collections/config/sanitize.ts"],"sourcesContent":["// @ts-strict-ignore\nimport type { Config, SanitizedConfig } from '../../config/types.js'\nimport type {\n CollectionConfig,\n SanitizedCollectionConfig,\n SanitizedJoin,\n SanitizedJoins,\n} from './types.js'\n\nimport { authCollectionEndpoints } from '../../auth/endpoints/index.js'\nimport { getBaseAuthFields } from '../../auth/getAuthFields.js'\nimport { TimestampsRequired } from '../../errors/TimestampsRequired.js'\nimport { sanitizeFields } from '../../fields/config/sanitize.js'\nimport { fieldAffectsData } from '../../fields/config/types.js'\nimport mergeBaseFields from '../../fields/mergeBaseFields.js'\nimport { uploadCollectionEndpoints } from '../../uploads/endpoints/index.js'\nimport { getBaseUploadFields } from '../../uploads/getBaseFields.js'\nimport { flattenAllFields } from '../../utilities/flattenAllFields.js'\nimport { formatLabels } from '../../utilities/formatLabels.js'\nimport baseVersionFields from '../../versions/baseFields.js'\nimport { versionDefaults } from '../../versions/defaults.js'\nimport { defaultCollectionEndpoints } from '../endpoints/index.js'\nimport {\n addDefaultsToAuthConfig,\n addDefaultsToCollectionConfig,\n addDefaultsToLoginWithUsernameConfig,\n} from './defaults.js'\nimport { sanitizeAuthFields, sanitizeUploadFields } from './reservedFieldNames.js'\nimport { sanitizeCompoundIndexes } from './sanitizeCompoundIndexes.js'\nimport { validateUseAsTitle } from './useAsTitle.js'\n\nexport const sanitizeCollection = async (\n config: Config,\n collection: CollectionConfig,\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 _validRelationships?: string[],\n): Promise<SanitizedCollectionConfig> => {\n if (collection._sanitized) {\n return collection as SanitizedCollectionConfig\n }\n collection._sanitized = true\n // /////////////////////////////////\n // Make copy of collection config\n // /////////////////////////////////\n\n const sanitized: CollectionConfig = addDefaultsToCollectionConfig(collection)\n\n // /////////////////////////////////\n // Sanitize fields\n // /////////////////////////////////\n\n const validRelationships = _validRelationships ?? config.collections.map((c) => c.slug) ?? []\n\n const joins: SanitizedJoins = {}\n const polymorphicJoins: SanitizedJoin[] = []\n sanitized.fields = await sanitizeFields({\n collectionConfig: sanitized,\n config,\n fields: sanitized.fields,\n joinPath: '',\n joins,\n parentIsLocalized: false,\n polymorphicJoins,\n richTextSanitizationPromises,\n validRelationships,\n })\n\n if (sanitized.endpoints !== false) {\n if (!sanitized.endpoints) {\n sanitized.endpoints = []\n }\n\n if (sanitized.auth) {\n for (const endpoint of authCollectionEndpoints) {\n sanitized.endpoints.push(endpoint)\n }\n }\n\n if (sanitized.upload) {\n for (const endpoint of uploadCollectionEndpoints) {\n sanitized.endpoints.push(endpoint)\n }\n }\n\n for (const endpoint of defaultCollectionEndpoints) {\n sanitized.endpoints.push(endpoint)\n }\n }\n\n if (sanitized.timestamps !== false) {\n // add default timestamps fields only as needed\n let hasUpdatedAt: boolean | null = null\n let hasCreatedAt: boolean | null = null\n sanitized.fields.some((field) => {\n if (fieldAffectsData(field)) {\n if (field.name === 'updatedAt') {\n hasUpdatedAt = true\n }\n if (field.name === 'createdAt') {\n hasCreatedAt = true\n }\n }\n return hasCreatedAt && hasUpdatedAt\n })\n if (!hasUpdatedAt) {\n sanitized.fields.push({\n name: 'updatedAt',\n type: 'date',\n admin: {\n disableBulkEdit: true,\n hidden: true,\n },\n index: true,\n label: ({ t }) => t('general:updatedAt'),\n })\n }\n if (!hasCreatedAt) {\n sanitized.fields.push({\n name: 'createdAt',\n admin: {\n disableBulkEdit: true,\n hidden: true,\n },\n // The default sort for list view is createdAt. Thus, enabling indexing by default, is a major performance improvement, especially for large or a large amount of collections.\n type: 'date',\n index: true,\n label: ({ t }) => t('general:createdAt'),\n })\n }\n }\n\n sanitized.labels = sanitized.labels || formatLabels(sanitized.slug)\n\n if (sanitized.versions) {\n if (sanitized.versions === true) {\n sanitized.versions = { drafts: false, maxPerDoc: 100 }\n }\n\n if (sanitized.timestamps === false) {\n throw new TimestampsRequired(collection)\n }\n\n sanitized.versions.maxPerDoc =\n typeof sanitized.versions.maxPerDoc === 'number' ? sanitized.versions.maxPerDoc : 100\n\n if (sanitized.versions.drafts) {\n if (sanitized.versions.drafts === true) {\n sanitized.versions.drafts = {\n autosave: false,\n validate: false,\n }\n }\n\n if (sanitized.versions.drafts.autosave === true) {\n sanitized.versions.drafts.autosave = {\n interval: versionDefaults.autosaveInterval,\n }\n }\n\n if (sanitized.versions.drafts.validate === undefined) {\n sanitized.versions.drafts.validate = false\n }\n\n sanitized.fields = mergeBaseFields(sanitized.fields, baseVersionFields)\n }\n }\n\n if (sanitized.upload) {\n if (sanitized.upload === true) {\n sanitized.upload = {}\n }\n\n // sanitize fields for reserved names\n sanitizeUploadFields(sanitized.fields, sanitized)\n\n sanitized.upload.cacheTags = sanitized.upload?.cacheTags ?? true\n sanitized.upload.bulkUpload = sanitized.upload?.bulkUpload ?? true\n sanitized.upload.staticDir = sanitized.upload.staticDir || sanitized.slug\n sanitized.admin.useAsTitle =\n sanitized.admin?.useAsTitle && sanitized.admin.useAsTitle !== 'id'\n ? sanitized.admin.useAsTitle\n : 'filename'\n\n const uploadFields = getBaseUploadFields({\n collection: sanitized,\n config,\n })\n\n sanitized.fields = mergeBaseFields(sanitized.fields, uploadFields)\n }\n\n if (sanitized.auth) {\n // sanitize fields for reserved names\n sanitizeAuthFields(sanitized.fields, sanitized)\n\n sanitized.auth = addDefaultsToAuthConfig(\n typeof sanitized.auth === 'boolean' ? {} : sanitized.auth,\n )\n\n // disable duplicate for auth enabled collections by default\n sanitized.disableDuplicate = sanitized.disableDuplicate ?? true\n\n if (sanitized.auth.loginWithUsername) {\n if (sanitized.auth.loginWithUsername === true) {\n sanitized.auth.loginWithUsername = addDefaultsToLoginWithUsernameConfig({})\n } else {\n const loginWithUsernameWithDefaults = addDefaultsToLoginWithUsernameConfig(\n sanitized.auth.loginWithUsername,\n )\n\n // if allowEmailLogin is false, requireUsername must be true\n if (loginWithUsernameWithDefaults.allowEmailLogin === false) {\n loginWithUsernameWithDefaults.requireUsername = true\n }\n sanitized.auth.loginWithUsername = loginWithUsernameWithDefaults\n }\n } else {\n sanitized.auth.loginWithUsername = false\n }\n\n if (!collection?.admin?.useAsTitle) {\n sanitized.admin.useAsTitle = sanitized.auth.loginWithUsername ? 'username' : 'email'\n }\n\n sanitized.fields = mergeBaseFields(sanitized.fields, getBaseAuthFields(sanitized.auth))\n }\n\n if (collection?.admin?.pagination?.limits?.length) {\n sanitized.admin.pagination.limits = collection.admin.pagination.limits\n }\n\n validateUseAsTitle(sanitized)\n\n const sanitizedConfig = sanitized as SanitizedCollectionConfig\n\n sanitizedConfig.joins = joins\n sanitizedConfig.polymorphicJoins = polymorphicJoins\n\n sanitizedConfig.flattenedFields = flattenAllFields({ fields: sanitizedConfig.fields })\n\n sanitizedConfig.sanitizedIndexes = sanitizeCompoundIndexes({\n fields: sanitizedConfig.flattenedFields,\n indexes: sanitizedConfig.indexes,\n })\n\n return sanitizedConfig\n}\n"],"names":["authCollectionEndpoints","getBaseAuthFields","TimestampsRequired","sanitizeFields","fieldAffectsData","mergeBaseFields","uploadCollectionEndpoints","getBaseUploadFields","flattenAllFields","formatLabels","baseVersionFields","versionDefaults","defaultCollectionEndpoints","addDefaultsToAuthConfig","addDefaultsToCollectionConfig","addDefaultsToLoginWithUsernameConfig","sanitizeAuthFields","sanitizeUploadFields","sanitizeCompoundIndexes","validateUseAsTitle","sanitizeCollection","config","collection","richTextSanitizationPromises","_validRelationships","_sanitized","sanitized","validRelationships","collections","map","c","slug","joins","polymorphicJoins","fields","collectionConfig","joinPath","parentIsLocalized","endpoints","auth","endpoint","push","upload","timestamps","hasUpdatedAt","hasCreatedAt","some","field","name","type","admin","disableBulkEdit","hidden","index","label","t","labels","versions","drafts","maxPerDoc","autosave","validate","interval","autosaveInterval","undefined","cacheTags","bulkUpload","staticDir","useAsTitle","uploadFields","disableDuplicate","loginWithUsername","loginWithUsernameWithDefaults","allowEmailLogin","requireUsername","pagination","limits","length","sanitizedConfig","flattenedFields","sanitizedIndexes","indexes"],"mappings":"AAAA,oBAAoB;AASpB,SAASA,uBAAuB,QAAQ,gCAA+B;AACvE,SAASC,iBAAiB,QAAQ,8BAA6B;AAC/D,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,cAAc,QAAQ,kCAAiC;AAChE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,OAAOC,qBAAqB,kCAAiC;AAC7D,SAASC,yBAAyB,QAAQ,mCAAkC;AAC5E,SAASC,mBAAmB,QAAQ,iCAAgC;AACpE,SAASC,gBAAgB,QAAQ,sCAAqC;AACtE,SAASC,YAAY,QAAQ,kCAAiC;AAC9D,OAAOC,uBAAuB,+BAA8B;AAC5D,SAASC,eAAe,QAAQ,6BAA4B;AAC5D,SAASC,0BAA0B,QAAQ,wBAAuB;AAClE,SACEC,uBAAuB,EACvBC,6BAA6B,EAC7BC,oCAAoC,QAC/B,gBAAe;AACtB,SAASC,kBAAkB,EAAEC,oBAAoB,QAAQ,0BAAyB;AAClF,SAASC,uBAAuB,QAAQ,+BAA8B;AACtE,SAASC,kBAAkB,QAAQ,kBAAiB;AAEpD,OAAO,MAAMC,qBAAqB,OAChCC,QACAC,YACA;;;GAGC,GACDC,8BACAC;IAEA,IAAIF,WAAWG,UAAU,EAAE;QACzB,OAAOH;IACT;IACAA,WAAWG,UAAU,GAAG;IACxB,oCAAoC;IACpC,iCAAiC;IACjC,oCAAoC;IAEpC,MAAMC,YAA8BZ,8BAA8BQ;IAElE,oCAAoC;IACpC,kBAAkB;IAClB,oCAAoC;IAEpC,MAAMK,qBAAqBH,uBAAuBH,OAAOO,WAAW,CAACC,GAAG,CAAC,C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AC5D,IAAIC,8BAA8BC,eAAe,KAAK,OAAO;oBAC3DD,8BAA8BE,eAAe,GAAG;gBAClD;gBACAhD,UAAUa,IAAI,CAACgC,iBAAiB,GAAGC;YACrC;QACF,OAAO;YACL9C,UAAUa,IAAI,CAACgC,iBAAiB,GAAG;QACrC;QAEA,IAAI,CAACjD,YAAY4B,OAAOkB,YAAY;YAClC1C,UAAUwB,KAAK,CAACkB,UAAU,GAAG1C,UAAUa,IAAI,CAACgC,iBAAiB,GAAG,aAAa;QAC/E;QAEA7C,UAAUQ,MAAM,GAAG7B,gBAAgBqB,UAAUQ,MAAM,EAAEjC,kBAAkByB,UAAUa,IAAI;IACvF;IAEA,IAAIjB,YAAY4B,OAAOyB,YAAYC,QAAQC,QAAQ;QACjDnD,UAAUwB,KAAK,CAACyB,UAAU,CAACC,MAAM,GAAGtD,WAAW4B,KAAK,CAACyB,UAAU,CAACC,MAAM;IACxE;IAEAzD,mBAAmBO;IAEnB,MAAMoD,kBAAkBpD;IAExBoD,gBAAgB9C,KAAK,GAAGA;IACxB8C,gBAAgB7C,gBAAgB,GAAGA;IAEnC6C,gBAAgBC,eAAe,GAAGvE,iBAAiB;QAAE0B,QAAQ4C,gBAAgB5C,MAAM;IAAC;IAEpF4C,gBAAgBE,gBAAgB,GAAG9D,wBAAwB;QACzDgB,QAAQ4C,gBAAgBC,eAAe;QACvCE,SAASH,gBAAgBG,OAAO;IAClC;IAEA,OAAOH;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/config/sanitize.ts"],"sourcesContent":["// @ts-strict-ignore\n\nimport type { Config, SanitizedConfig } from '../../config/types.js'\nimport type {\n CollectionConfig,\n SanitizedCollectionConfig,\n SanitizedJoin,\n SanitizedJoins,\n} from './types.js'\n\nimport { authCollectionEndpoints } from '../../auth/endpoints/index.js'\nimport { getBaseAuthFields } from '../../auth/getAuthFields.js'\nimport { TimestampsRequired } from '../../errors/TimestampsRequired.js'\nimport { sanitizeFields } from '../../fields/config/sanitize.js'\nimport { fieldAffectsData } from '../../fields/config/types.js'\nimport mergeBaseFields from '../../fields/mergeBaseFields.js'\nimport { uploadCollectionEndpoints } from '../../uploads/endpoints/index.js'\nimport { getBaseUploadFields } from '../../uploads/getBaseFields.js'\nimport { flattenAllFields } from '../../utilities/flattenAllFields.js'\nimport { formatLabels } from '../../utilities/formatLabels.js'\nimport baseVersionFields from '../../versions/baseFields.js'\nimport { versionDefaults } from '../../versions/defaults.js'\nimport { defaultCollectionEndpoints } from '../endpoints/index.js'\nimport {\n addDefaultsToAuthConfig,\n addDefaultsToCollectionConfig,\n addDefaultsToLoginWithUsernameConfig,\n} from './defaults.js'\nimport { sanitizeAuthFields, sanitizeUploadFields } from './reservedFieldNames.js'\nimport { sanitizeCompoundIndexes } from './sanitizeCompoundIndexes.js'\nimport { validateUseAsTitle } from './useAsTitle.js'\n\nexport const sanitizeCollection = async (\n config: Config,\n collection: CollectionConfig,\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 _validRelationships?: string[],\n): Promise<SanitizedCollectionConfig> => {\n if (collection._sanitized) {\n return collection as SanitizedCollectionConfig\n }\n collection._sanitized = true\n // /////////////////////////////////\n // Make copy of collection config\n // /////////////////////////////////\n\n const sanitized: CollectionConfig = addDefaultsToCollectionConfig(collection)\n\n // /////////////////////////////////\n // Sanitize fields\n // /////////////////////////////////\n\n const validRelationships = _validRelationships ?? config.collections.map((c) => c.slug) ?? []\n\n const joins: SanitizedJoins = {}\n const polymorphicJoins: SanitizedJoin[] = []\n sanitized.fields = await sanitizeFields({\n collectionConfig: sanitized,\n config,\n fields: sanitized.fields,\n joinPath: '',\n joins,\n parentIsLocalized: false,\n polymorphicJoins,\n richTextSanitizationPromises,\n validRelationships,\n })\n\n if (sanitized.endpoints !== false) {\n if (!sanitized.endpoints) {\n sanitized.endpoints = []\n }\n\n if (sanitized.auth) {\n for (const endpoint of authCollectionEndpoints) {\n sanitized.endpoints.push(endpoint)\n }\n }\n\n if (sanitized.upload) {\n for (const endpoint of uploadCollectionEndpoints) {\n sanitized.endpoints.push(endpoint)\n }\n }\n\n for (const endpoint of defaultCollectionEndpoints) {\n sanitized.endpoints.push(endpoint)\n }\n }\n\n if (sanitized.timestamps !== false) {\n // add default timestamps fields only as needed\n let hasUpdatedAt: boolean | null = null\n let hasCreatedAt: boolean | null = null\n sanitized.fields.some((field) => {\n if (fieldAffectsData(field)) {\n if (field.name === 'updatedAt') {\n hasUpdatedAt = true\n }\n if (field.name === 'createdAt') {\n hasCreatedAt = true\n }\n }\n return hasCreatedAt && hasUpdatedAt\n })\n if (!hasUpdatedAt) {\n sanitized.fields.push({\n name: 'updatedAt',\n type: 'date',\n admin: {\n disableBulkEdit: true,\n hidden: true,\n },\n index: true,\n label: ({ t }) => t('general:updatedAt'),\n })\n }\n if (!hasCreatedAt) {\n sanitized.fields.push({\n name: 'createdAt',\n admin: {\n disableBulkEdit: true,\n hidden: true,\n },\n // The default sort for list view is createdAt. Thus, enabling indexing by default, is a major performance improvement, especially for large or a large amount of collections.\n type: 'date',\n index: true,\n label: ({ t }) => t('general:createdAt'),\n })\n }\n }\n\n sanitized.labels = sanitized.labels || formatLabels(sanitized.slug)\n\n if (sanitized.versions) {\n if (sanitized.versions === true) {\n sanitized.versions = { drafts: false, maxPerDoc: 100 }\n }\n\n if (sanitized.timestamps === false) {\n throw new TimestampsRequired(collection)\n }\n\n sanitized.versions.maxPerDoc =\n typeof sanitized.versions.maxPerDoc === 'number' ? sanitized.versions.maxPerDoc : 100\n\n if (sanitized.versions.drafts) {\n if (sanitized.versions.drafts === true) {\n sanitized.versions.drafts = {\n autosave: false,\n validate: false,\n }\n }\n\n if (sanitized.versions.drafts.autosave === true) {\n sanitized.versions.drafts.autosave = {\n interval: versionDefaults.autosaveInterval,\n }\n }\n\n if (sanitized.versions.drafts.validate === undefined) {\n sanitized.versions.drafts.validate = false\n }\n\n sanitized.fields = mergeBaseFields(sanitized.fields, baseVersionFields)\n }\n }\n\n if (sanitized.upload) {\n if (sanitized.upload === true) {\n sanitized.upload = {}\n }\n\n // sanitize fields for reserved names\n sanitizeUploadFields(sanitized.fields, sanitized)\n\n sanitized.upload.cacheTags = sanitized.upload?.cacheTags ?? true\n sanitized.upload.bulkUpload = sanitized.upload?.bulkUpload ?? true\n sanitized.upload.staticDir = sanitized.upload.staticDir || sanitized.slug\n sanitized.admin.useAsTitle =\n sanitized.admin?.useAsTitle && sanitized.admin.useAsTitle !== 'id'\n ? sanitized.admin.useAsTitle\n : 'filename'\n\n const uploadFields = getBaseUploadFields({\n collection: sanitized,\n config,\n })\n\n sanitized.fields = mergeBaseFields(sanitized.fields, uploadFields)\n }\n\n if (sanitized.auth) {\n // sanitize fields for reserved names\n sanitizeAuthFields(sanitized.fields, sanitized)\n\n sanitized.auth = addDefaultsToAuthConfig(\n typeof sanitized.auth === 'boolean' ? {} : sanitized.auth,\n )\n\n // disable duplicate for auth enabled collections by default\n sanitized.disableDuplicate = sanitized.disableDuplicate ?? true\n\n if (sanitized.auth.loginWithUsername) {\n if (sanitized.auth.loginWithUsername === true) {\n sanitized.auth.loginWithUsername = addDefaultsToLoginWithUsernameConfig({})\n } else {\n const loginWithUsernameWithDefaults = addDefaultsToLoginWithUsernameConfig(\n sanitized.auth.loginWithUsername,\n )\n\n // if allowEmailLogin is false, requireUsername must be true\n if (loginWithUsernameWithDefaults.allowEmailLogin === false) {\n loginWithUsernameWithDefaults.requireUsername = true\n }\n sanitized.auth.loginWithUsername = loginWithUsernameWithDefaults\n }\n } else {\n sanitized.auth.loginWithUsername = false\n }\n\n if (!collection?.admin?.useAsTitle) {\n sanitized.admin.useAsTitle = sanitized.auth.loginWithUsername ? 'username' : 'email'\n }\n\n sanitized.fields = mergeBaseFields(sanitized.fields, getBaseAuthFields(sanitized.auth))\n }\n\n if (collection?.admin?.pagination?.limits?.length) {\n sanitized.admin.pagination.limits = collection.admin.pagination.limits\n }\n\n validateUseAsTitle(sanitized)\n\n const sanitizedConfig = sanitized as SanitizedCollectionConfig\n\n sanitizedConfig.joins = joins\n sanitizedConfig.polymorphicJoins = polymorphicJoins\n\n sanitizedConfig.flattenedFields = flattenAllFields({ fields: sanitizedConfig.fields })\n\n sanitizedConfig.sanitizedIndexes = sanitizeCompoundIndexes({\n fields: sanitizedConfig.flattenedFields,\n indexes: sanitizedConfig.indexes,\n })\n\n return sanitizedConfig\n}\n"],"names":["authCollectionEndpoints","getBaseAuthFields","TimestampsRequired","sanitizeFields","fieldAffectsData","mergeBaseFields","uploadCollectionEndpoints","getBaseUploadFields","flattenAllFields","formatLabels","baseVersionFields","versionDefaults","defaultCollectionEndpoints","addDefaultsToAuthConfig","addDefaultsToCollectionConfig","addDefaultsToLoginWithUsernameConfig","sanitizeAuthFields","sanitizeUploadFields","sanitizeCompoundIndexes","validateUseAsTitle","sanitizeCollection","config","collection","richTextSanitizationPromises","_validRelationships","_sanitized","sanitized","validRelationships","collections","map","c","slug","joins","polymorphicJoins","fields","collectionConfig","joinPath","parentIsLocalized","endpoints","auth","endpoint","push","upload","timestamps","hasUpdatedAt","hasCreatedAt","some","field","name","type","admin","disableBulkEdit","hidden","index","label","t","labels","versions","drafts","maxPerDoc","autosave","validate","interval","autosaveInterval","undefined","cacheTags","bulkUpload","staticDir","useAsTitle","uploadFields","disableDuplicate","loginWithUsername","loginWithUsernameWithDefaults","allowEmailLogin","requireUsername","pagination","limits","length","sanitizedConfig","flattenedFields","sanitizedIndexes","indexes"],"mappings":"AAAA,oBAAoB;AAUpB,SAASA,uBAAuB,QAAQ,gCAA+B;AACvE,SAASC,iBAAiB,QAAQ,8BAA6B;AAC/D,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,cAAc,QAAQ,kCAAiC;AAChE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,OAAOC,qBAAqB,kCAAiC;AAC7D,SAASC,yBAAyB,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UwB,KAAK,CAACyB,UAAU,CAACC,MAAM,GAAGtD,WAAW4B,KAAK,CAACyB,UAAU,CAACC,MAAM;IACxE;IAEAzD,mBAAmBO;IAEnB,MAAMoD,kBAAkBpD;IAExBoD,gBAAgB9C,KAAK,GAAGA;IACxB8C,gBAAgB7C,gBAAgB,GAAGA;IAEnC6C,gBAAgBC,eAAe,GAAGvE,iBAAiB;QAAE0B,QAAQ4C,gBAAgB5C,MAAM;IAAC;IAEpF4C,gBAAgBE,gBAAgB,GAAG9D,wBAAwB;QACzDgB,QAAQ4C,gBAAgBC,eAAe;QACvCE,SAASH,gBAAgBG,OAAO;IAClC;IAEA,OAAOH;AACT,EAAC"}
|
|
@@ -417,6 +417,17 @@ export type CollectionConfig<TSlug extends CollectionSlug = any> = {
|
|
|
417
417
|
lockDocuments?: {
|
|
418
418
|
duration: number;
|
|
419
419
|
} | false;
|
|
420
|
+
/**
|
|
421
|
+
* If true, enables custom ordering for the collection, and documents in the listView can be reordered via drag and drop.
|
|
422
|
+
* New documents are inserted at the end of the list according to this parameter.
|
|
423
|
+
*
|
|
424
|
+
* Under the hood, a field with {@link https://observablehq.com/@dgreensp/implementing-fractional-indexing|fractional indexing} is used to optimize inserts and reorderings.
|
|
425
|
+
*
|
|
426
|
+
* @default false
|
|
427
|
+
*
|
|
428
|
+
* @experimental There may be frequent breaking changes to this API
|
|
429
|
+
*/
|
|
430
|
+
orderable?: boolean;
|
|
420
431
|
slug: string;
|
|
421
432
|
/**
|
|
422
433
|
* Add `createdAt` and `updatedAt` fields
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/collections/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEtE,OAAO,K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type { GraphQLInputObjectType, GraphQLNonNull, GraphQLObjectType } from 'graphql'\nimport type { DeepRequired, IsAny, MarkOptional } from 'ts-essentials'\n\nimport type { CustomUpload } from '../../admin/types.js'\nimport type { Arguments as MeArguments } from '../../auth/operations/me.js'\nimport type {\n Arguments as RefreshArguments,\n Result as RefreshResult,\n} from '../../auth/operations/refresh.js'\nimport type { Auth, ClientUser, IncomingAuthType } from '../../auth/types.js'\nimport type {\n Access,\n AfterErrorHookArgs,\n AfterErrorResult,\n CustomComponent,\n EditConfig,\n Endpoint,\n EntityDescription,\n EntityDescriptionComponent,\n GeneratePreviewURL,\n LabelFunction,\n LivePreviewConfig,\n MetaConfig,\n PayloadComponent,\n StaticLabel,\n} from '../../config/types.js'\nimport type { DBIdentifierName } from '../../database/types.js'\nimport type {\n Field,\n FlattenedField,\n JoinField,\n RelationshipField,\n UploadField,\n} from '../../fields/config/types.js'\nimport type {\n CollectionSlug,\n JsonObject,\n RequestContext,\n TypedAuthOperations,\n TypedCollection,\n TypedCollectionSelect,\n TypedLocale,\n} from '../../index.js'\nimport type {\n PayloadRequest,\n SelectIncludeType,\n SelectType,\n Sort,\n TransformCollectionWithSelect,\n Where,\n} from '../../types/index.js'\nimport type { SanitizedUploadConfig, UploadConfig } from '../../uploads/types.js'\nimport type {\n IncomingCollectionVersions,\n SanitizedCollectionVersions,\n} from '../../versions/types.js'\nimport type { AfterOperationArg, AfterOperationMap } from '../operations/utils.js'\n\nexport type DataFromCollectionSlug<TSlug extends CollectionSlug> = TypedCollection[TSlug]\n\nexport type SelectFromCollectionSlug<TSlug extends CollectionSlug> = TypedCollectionSelect[TSlug]\n\nexport type AuthOperationsFromCollectionSlug<TSlug extends CollectionSlug> =\n TypedAuthOperations[TSlug]\n\nexport type RequiredDataFromCollection<TData extends JsonObject> = MarkOptional<\n TData,\n 'createdAt' | 'id' | 'sizes' | 'updatedAt'\n>\n\nexport type RequiredDataFromCollectionSlug<TSlug extends CollectionSlug> =\n RequiredDataFromCollection<DataFromCollectionSlug<TSlug>>\n\nexport type HookOperationType =\n | 'autosave'\n | 'count'\n | 'countVersions'\n | 'create'\n | 'delete'\n | 'forgotPassword'\n | 'login'\n | 'read'\n | 'refresh'\n | 'update'\n\ntype CreateOrUpdateOperation = Extract<HookOperationType, 'create' | 'update'>\n\nexport type BeforeOperationHook = (args: {\n args?: any\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n /**\n * Hook operation being performed\n */\n operation: HookOperationType\n req: PayloadRequest\n}) => any\n\nexport type BeforeValidateHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n data?: Partial<T>\n /**\n * Hook operation being performed\n */\n operation: CreateOrUpdateOperation\n /**\n * Original document before change\n *\n * `undefined` on 'create' operation\n */\n originalDoc?: T\n req: PayloadRequest\n}) => any\n\nexport type BeforeChangeHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n data: Partial<T>\n /**\n * Hook operation being performed\n */\n operation: CreateOrUpdateOperation\n /**\n * Original document before change\n *\n * `undefined` on 'create' operation\n */\n originalDoc?: T\n req: PayloadRequest\n}) => any\n\nexport type AfterChangeHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n doc: T\n /**\n * Hook operation being performed\n */\n operation: CreateOrUpdateOperation\n previousDoc: T\n req: PayloadRequest\n}) => any\n\nexport type BeforeReadHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n doc: T\n query: { [key: string]: any }\n req: PayloadRequest\n}) => any\n\nexport type AfterReadHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n doc: T\n findMany?: boolean\n query?: { [key: string]: any }\n req: PayloadRequest\n}) => any\n\nexport type BeforeDeleteHook = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n id: number | string\n req: PayloadRequest\n}) => any\n\nexport type AfterDeleteHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n doc: T\n id: number | string\n req: PayloadRequest\n}) => any\n\nexport type AfterOperationHook<TOperationGeneric extends CollectionSlug = string> = (\n arg: AfterOperationArg<TOperationGeneric>,\n) =>\n | Awaited<\n ReturnType<AfterOperationMap<TOperationGeneric>[keyof AfterOperationMap<TOperationGeneric>]>\n >\n | Promise<\n Awaited<\n ReturnType<AfterOperationMap<TOperationGeneric>[keyof AfterOperationMap<TOperationGeneric>]>\n >\n >\n\nexport type BeforeLoginHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n req: PayloadRequest\n user: T\n}) => any\n\nexport type AfterLoginHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n req: PayloadRequest\n token: string\n user: T\n}) => any\n\nexport type AfterLogoutHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n req: PayloadRequest\n}) => any\n\nexport type AfterMeHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n req: PayloadRequest\n response: unknown\n}) => any\n\nexport type RefreshHook<T extends TypeWithID = any> = (args: {\n args: RefreshArguments\n user: T\n}) => Promise<RefreshResult | void> | (RefreshResult | void)\n\nexport type MeHook<T extends TypeWithID = any> = (args: {\n args: MeArguments\n user: T\n}) => ({ exp: number; user: T } | void) | Promise<{ exp: number; user: T } | void>\n\nexport type AfterRefreshHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n exp: number\n req: PayloadRequest\n token: string\n}) => any\n\nexport type AfterErrorHook = (\n args: { collection: SanitizedCollectionConfig } & AfterErrorHookArgs,\n) => AfterErrorResult | Promise<AfterErrorResult>\n\nexport type AfterForgotPasswordHook = (args: {\n args?: any\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n}) => any\n\nexport type BaseListFilter = (args: {\n limit: number\n locale?: TypedLocale\n page: number\n req: PayloadRequest\n sort: string\n}) => null | Promise<null | Where> | Where\n\nexport type CollectionAdminOptions = {\n baseListFilter?: BaseListFilter\n /**\n * Custom admin components\n */\n components?: {\n afterList?: CustomComponent[]\n afterListTable?: CustomComponent[]\n beforeList?: CustomComponent[]\n beforeListTable?: CustomComponent[]\n Description?: EntityDescriptionComponent\n /**\n * Components within the edit view\n */\n edit?: {\n /**\n * Replaces the \"Preview\" button\n */\n PreviewButton?: CustomComponent\n /**\n * Replaces the \"Publish\" button\n * + drafts must be enabled\n */\n PublishButton?: CustomComponent\n /**\n * Replaces the \"Save\" button\n * + drafts must be disabled\n */\n SaveButton?: CustomComponent\n /**\n * Replaces the \"Save Draft\" button\n * + drafts must be enabled\n * + autosave must be disabled\n */\n SaveDraftButton?: CustomComponent\n /**\n * Replaces the \"Upload\" section\n * + upload must be enabled\n */\n Upload?: CustomUpload\n }\n listMenuItems?: CustomComponent[]\n views?: {\n /**\n * Set to a React component to replace the entire Edit View, including all nested routes.\n * Set to an object to replace or modify individual nested routes, or to add new ones.\n */\n edit?: EditConfig\n list?: {\n actions?: CustomComponent[]\n Component?: PayloadComponent\n }\n }\n }\n /** Extension point to add your custom data. Available in server and client. */\n custom?: Record<string, any>\n /**\n * Default columns to show in list view\n */\n defaultColumns?: string[]\n /**\n * Custom description for collection. This will also be used as JSDoc for the generated types\n */\n description?: EntityDescription\n /**\n * Disable the Copy To Locale button in the edit document view\n * @default false\n */\n disableCopyToLocale?: boolean\n enableRichTextLink?: boolean\n enableRichTextRelationship?: boolean\n /**\n * Specify a navigational group for collections in the admin sidebar.\n * - Provide a string to place the entity in a custom group.\n * - Provide a record to define localized group names.\n * - Set to `false` to exclude the entity from the sidebar / dashboard without disabling its routes.\n */\n group?: false | Record<string, string> | string\n /**\n * Exclude the collection from the admin nav and routes\n */\n hidden?: ((args: { user: ClientUser }) => boolean) | boolean\n /**\n * Hide the API URL within the Edit view\n */\n hideAPIURL?: boolean\n /**\n * Additional fields to be searched via the full text search\n */\n listSearchableFields?: string[]\n /**\n * Live preview options\n */\n livePreview?: LivePreviewConfig\n meta?: MetaConfig\n pagination?: {\n defaultLimit?: number\n limits?: number[]\n }\n /**\n * Function to generate custom preview URL\n */\n preview?: GeneratePreviewURL\n /**\n * Field to use as title in Edit View and first column in List view\n */\n useAsTitle?: string\n}\n\n/** Manage all aspects of a data collection */\nexport type CollectionConfig<TSlug extends CollectionSlug = any> = {\n /**\n * Do not set this property manually. This is set to true during sanitization, to avoid\n * sanitizing the same collection multiple times.\n */\n _sanitized?: boolean\n /**\n * Access control\n */\n access?: {\n admin?: ({ req }: { req: PayloadRequest }) => boolean | Promise<boolean>\n create?: Access\n delete?: Access\n read?: Access\n readVersions?: Access\n unlock?: Access\n update?: Access\n }\n /**\n * Collection admin options\n */\n admin?: CollectionAdminOptions\n /**\n * Collection login options\n *\n * Use `true` to enable with default options\n */\n auth?: boolean | IncomingAuthType\n /** Extension point to add your custom data. Server only. */\n custom?: Record<string, any>\n /**\n * Used to override the default naming of the database table or collection with your using a function or string\n * @WARNING: If you change this property with existing data, you will need to handle the renaming of the table in your database or by using migrations\n */\n dbName?: DBIdentifierName\n defaultPopulate?: IsAny<SelectFromCollectionSlug<TSlug>> extends true\n ? SelectType\n : SelectFromCollectionSlug<TSlug>\n /**\n * Default field to sort by in collection list view\n */\n defaultSort?: Sort\n /**\n * When true, do not show the \"Duplicate\" button while editing documents within this collection and prevent `duplicate` from all APIs\n */\n disableDuplicate?: boolean\n /**\n * Opt-in to enable query presets for this collection.\n * @see https://payloadcms.com/docs/query-presets/overview\n */\n enableQueryPresets?: boolean\n /**\n * Custom rest api endpoints, set false to disable all rest endpoints for this collection.\n */\n endpoints?: false | Omit<Endpoint, 'root'>[]\n fields: Field[]\n /**\n * Specify which fields should be selected always, regardless of the `select` query which can be useful that the field exists for access control / hooks\n */\n forceSelect?: IsAny<SelectFromCollectionSlug<TSlug>> extends true\n ? SelectIncludeType\n : SelectFromCollectionSlug<TSlug>\n /**\n * GraphQL configuration\n */\n graphQL?:\n | {\n disableMutations?: true\n disableQueries?: true\n pluralName?: string\n singularName?: string\n }\n | false\n /**\n * Hooks to modify Payload functionality\n */\n hooks?: {\n afterChange?: AfterChangeHook[]\n afterDelete?: AfterDeleteHook[]\n afterError?: AfterErrorHook[]\n afterForgotPassword?: AfterForgotPasswordHook[]\n afterLogin?: AfterLoginHook[]\n afterLogout?: AfterLogoutHook[]\n afterMe?: AfterMeHook[]\n afterOperation?: AfterOperationHook<TSlug>[]\n afterRead?: AfterReadHook[]\n afterRefresh?: AfterRefreshHook[]\n beforeChange?: BeforeChangeHook[]\n beforeDelete?: BeforeDeleteHook[]\n beforeLogin?: BeforeLoginHook[]\n beforeOperation?: BeforeOperationHook[]\n beforeRead?: BeforeReadHook[]\n beforeValidate?: BeforeValidateHook[]\n /**\n /**\n * Use the `me` hook to control the `me` operation.\n * Here, you can optionally instruct the me operation to return early,\n * and skip its default logic.\n */\n me?: MeHook[]\n /**\n * Use the `refresh` hook to control the refresh operation.\n * Here, you can optionally instruct the refresh operation to return early,\n * and skip its default logic.\n */\n refresh?: RefreshHook[]\n }\n /**\n * Define compound indexes for this collection.\n * This can be used to either speed up querying/sorting by 2 or more fields at the same time or\n * to ensure uniqueness between several fields.\n * Specify field paths\n * @example\n * [{ unique: true, fields: ['title', 'group.name'] }]\n * @default []\n */\n indexes?: CompoundIndex[]\n /**\n * Label configuration\n */\n labels?: {\n plural?: LabelFunction | StaticLabel\n singular?: LabelFunction | StaticLabel\n }\n /**\n * Enables / Disables the ability to lock documents while editing\n * @default true\n */\n lockDocuments?:\n | {\n duration: number\n }\n | false\n slug: string\n /**\n * Add `createdAt` and `updatedAt` fields\n *\n * @default true\n */\n timestamps?: boolean\n /**\n * Options used in typescript generation\n */\n typescript?: {\n /**\n * Typescript generation name given to the interface type\n */\n interface?: string\n }\n /**\n * Customize the handling of incoming file uploads\n *\n * @default false // disable uploads\n */\n upload?: boolean | UploadConfig\n /**\n * Enable versioning. Set it to true to enable default versions settings,\n * or customize versions options by setting the property equal to an object\n * containing the version options.\n *\n * @default false // disable versioning\n */\n versions?: boolean | IncomingCollectionVersions\n}\n\nexport type SanitizedJoin = {\n /**\n * The field configuration defining the join\n */\n field: JoinField\n getForeignPath?(args: { locale?: TypedLocale }): string\n /**\n * The path of the join field in dot notation\n */\n joinPath: string\n /**\n * `parentIsLocalized` is true if any parent field of the\n * field configuration defining the join is localized\n */\n parentIsLocalized: boolean\n targetField: RelationshipField | UploadField\n}\n\nexport type SanitizedJoins = {\n [collectionSlug: string]: SanitizedJoin[]\n}\n\n/**\n * @todo remove the `DeepRequired` in v4.\n * We don't actually guarantee that all properties are set when sanitizing configs.\n */\nexport interface SanitizedCollectionConfig\n extends Omit<\n DeepRequired<CollectionConfig>,\n 'auth' | 'endpoints' | 'fields' | 'slug' | 'upload' | 'versions'\n > {\n auth: Auth\n endpoints: Endpoint[] | false\n fields: Field[]\n /**\n * Fields in the database schema structure\n * Rows / collapsible / tabs w/o name `fields` merged to top, UIs are excluded\n */\n flattenedFields: FlattenedField[]\n /**\n * Object of collections to join 'Join Fields object keyed by collection\n */\n joins: SanitizedJoins\n\n /**\n * List of all polymorphic join fields\n */\n polymorphicJoins: SanitizedJoin[]\n\n sanitizedIndexes: SanitizedCompoundIndex[]\n\n slug: CollectionSlug\n upload: SanitizedUploadConfig\n versions: SanitizedCollectionVersions\n}\n\nexport type Collection = {\n config: SanitizedCollectionConfig\n customIDType?: 'number' | 'text'\n graphQL?: {\n countType: GraphQLObjectType\n JWT: GraphQLObjectType\n mutationInputType: GraphQLNonNull<any>\n paginatedType: GraphQLObjectType\n type: GraphQLObjectType\n updateMutationInputType: GraphQLNonNull<any>\n versionType: GraphQLObjectType\n whereInputType: GraphQLInputObjectType\n }\n}\n\nexport type BulkOperationResult<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n docs: TransformCollectionWithSelect<TSlug, TSelect>[]\n errors: {\n id: DataFromCollectionSlug<TSlug>['id']\n message: string\n }[]\n}\n\nexport type AuthCollection = {\n config: SanitizedCollectionConfig\n}\n\nexport type TypeWithID = {\n docId?: any\n id: number | string\n}\n\nexport type TypeWithTimestamps = {\n [key: string]: unknown\n createdAt: string\n id: number | string\n updatedAt: string\n}\n\nexport type CompoundIndex = {\n fields: string[]\n unique?: boolean\n}\n\nexport type SanitizedCompoundIndex = {\n fields: {\n field: FlattenedField\n localizedPath: string\n path: string\n pathHasLocalized: boolean\n }[]\n unique: boolean\n}\n"],"names":[],"mappings":"AAioBA,WAQC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/config/types.ts"],"sourcesContent":["import type { GraphQLInputObjectType, GraphQLNonNull, GraphQLObjectType } from 'graphql'\nimport type { DeepRequired, IsAny, MarkOptional } from 'ts-essentials'\n\nimport type { CustomUpload } from '../../admin/types.js'\nimport type { Arguments as MeArguments } from '../../auth/operations/me.js'\nimport type {\n Arguments as RefreshArguments,\n Result as RefreshResult,\n} from '../../auth/operations/refresh.js'\nimport type { Auth, ClientUser, IncomingAuthType } from '../../auth/types.js'\nimport type {\n Access,\n AfterErrorHookArgs,\n AfterErrorResult,\n CustomComponent,\n EditConfig,\n Endpoint,\n EntityDescription,\n EntityDescriptionComponent,\n GeneratePreviewURL,\n LabelFunction,\n LivePreviewConfig,\n MetaConfig,\n PayloadComponent,\n StaticLabel,\n} from '../../config/types.js'\nimport type { DBIdentifierName } from '../../database/types.js'\nimport type {\n Field,\n FlattenedField,\n JoinField,\n RelationshipField,\n UploadField,\n} from '../../fields/config/types.js'\nimport type {\n CollectionSlug,\n JsonObject,\n RequestContext,\n TypedAuthOperations,\n TypedCollection,\n TypedCollectionSelect,\n TypedLocale,\n} from '../../index.js'\nimport type {\n PayloadRequest,\n SelectIncludeType,\n SelectType,\n Sort,\n TransformCollectionWithSelect,\n Where,\n} from '../../types/index.js'\nimport type { SanitizedUploadConfig, UploadConfig } from '../../uploads/types.js'\nimport type {\n IncomingCollectionVersions,\n SanitizedCollectionVersions,\n} from '../../versions/types.js'\nimport type { AfterOperationArg, AfterOperationMap } from '../operations/utils.js'\n\nexport type DataFromCollectionSlug<TSlug extends CollectionSlug> = TypedCollection[TSlug]\n\nexport type SelectFromCollectionSlug<TSlug extends CollectionSlug> = TypedCollectionSelect[TSlug]\n\nexport type AuthOperationsFromCollectionSlug<TSlug extends CollectionSlug> =\n TypedAuthOperations[TSlug]\n\nexport type RequiredDataFromCollection<TData extends JsonObject> = MarkOptional<\n TData,\n 'createdAt' | 'id' | 'sizes' | 'updatedAt'\n>\n\nexport type RequiredDataFromCollectionSlug<TSlug extends CollectionSlug> =\n RequiredDataFromCollection<DataFromCollectionSlug<TSlug>>\n\nexport type HookOperationType =\n | 'autosave'\n | 'count'\n | 'countVersions'\n | 'create'\n | 'delete'\n | 'forgotPassword'\n | 'login'\n | 'read'\n | 'refresh'\n | 'update'\n\ntype CreateOrUpdateOperation = Extract<HookOperationType, 'create' | 'update'>\n\nexport type BeforeOperationHook = (args: {\n args?: any\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n /**\n * Hook operation being performed\n */\n operation: HookOperationType\n req: PayloadRequest\n}) => any\n\nexport type BeforeValidateHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n data?: Partial<T>\n /**\n * Hook operation being performed\n */\n operation: CreateOrUpdateOperation\n /**\n * Original document before change\n *\n * `undefined` on 'create' operation\n */\n originalDoc?: T\n req: PayloadRequest\n}) => any\n\nexport type BeforeChangeHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n data: Partial<T>\n /**\n * Hook operation being performed\n */\n operation: CreateOrUpdateOperation\n /**\n * Original document before change\n *\n * `undefined` on 'create' operation\n */\n originalDoc?: T\n req: PayloadRequest\n}) => any\n\nexport type AfterChangeHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n doc: T\n /**\n * Hook operation being performed\n */\n operation: CreateOrUpdateOperation\n previousDoc: T\n req: PayloadRequest\n}) => any\n\nexport type BeforeReadHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n doc: T\n query: { [key: string]: any }\n req: PayloadRequest\n}) => any\n\nexport type AfterReadHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n doc: T\n findMany?: boolean\n query?: { [key: string]: any }\n req: PayloadRequest\n}) => any\n\nexport type BeforeDeleteHook = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n id: number | string\n req: PayloadRequest\n}) => any\n\nexport type AfterDeleteHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n doc: T\n id: number | string\n req: PayloadRequest\n}) => any\n\nexport type AfterOperationHook<TOperationGeneric extends CollectionSlug = string> = (\n arg: AfterOperationArg<TOperationGeneric>,\n) =>\n | Awaited<\n ReturnType<AfterOperationMap<TOperationGeneric>[keyof AfterOperationMap<TOperationGeneric>]>\n >\n | Promise<\n Awaited<\n ReturnType<AfterOperationMap<TOperationGeneric>[keyof AfterOperationMap<TOperationGeneric>]>\n >\n >\n\nexport type BeforeLoginHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n req: PayloadRequest\n user: T\n}) => any\n\nexport type AfterLoginHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n req: PayloadRequest\n token: string\n user: T\n}) => any\n\nexport type AfterLogoutHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n req: PayloadRequest\n}) => any\n\nexport type AfterMeHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n req: PayloadRequest\n response: unknown\n}) => any\n\nexport type RefreshHook<T extends TypeWithID = any> = (args: {\n args: RefreshArguments\n user: T\n}) => Promise<RefreshResult | void> | (RefreshResult | void)\n\nexport type MeHook<T extends TypeWithID = any> = (args: {\n args: MeArguments\n user: T\n}) => ({ exp: number; user: T } | void) | Promise<{ exp: number; user: T } | void>\n\nexport type AfterRefreshHook<T extends TypeWithID = any> = (args: {\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n exp: number\n req: PayloadRequest\n token: string\n}) => any\n\nexport type AfterErrorHook = (\n args: { collection: SanitizedCollectionConfig } & AfterErrorHookArgs,\n) => AfterErrorResult | Promise<AfterErrorResult>\n\nexport type AfterForgotPasswordHook = (args: {\n args?: any\n /** The collection which this hook is being run on */\n collection: SanitizedCollectionConfig\n context: RequestContext\n}) => any\n\nexport type BaseListFilter = (args: {\n limit: number\n locale?: TypedLocale\n page: number\n req: PayloadRequest\n sort: string\n}) => null | Promise<null | Where> | Where\n\nexport type CollectionAdminOptions = {\n baseListFilter?: BaseListFilter\n /**\n * Custom admin components\n */\n components?: {\n afterList?: CustomComponent[]\n afterListTable?: CustomComponent[]\n beforeList?: CustomComponent[]\n beforeListTable?: CustomComponent[]\n Description?: EntityDescriptionComponent\n /**\n * Components within the edit view\n */\n edit?: {\n /**\n * Replaces the \"Preview\" button\n */\n PreviewButton?: CustomComponent\n /**\n * Replaces the \"Publish\" button\n * + drafts must be enabled\n */\n PublishButton?: CustomComponent\n /**\n * Replaces the \"Save\" button\n * + drafts must be disabled\n */\n SaveButton?: CustomComponent\n /**\n * Replaces the \"Save Draft\" button\n * + drafts must be enabled\n * + autosave must be disabled\n */\n SaveDraftButton?: CustomComponent\n /**\n * Replaces the \"Upload\" section\n * + upload must be enabled\n */\n Upload?: CustomUpload\n }\n listMenuItems?: CustomComponent[]\n views?: {\n /**\n * Set to a React component to replace the entire Edit View, including all nested routes.\n * Set to an object to replace or modify individual nested routes, or to add new ones.\n */\n edit?: EditConfig\n list?: {\n actions?: CustomComponent[]\n Component?: PayloadComponent\n }\n }\n }\n /** Extension point to add your custom data. Available in server and client. */\n custom?: Record<string, any>\n /**\n * Default columns to show in list view\n */\n defaultColumns?: string[]\n /**\n * Custom description for collection. This will also be used as JSDoc for the generated types\n */\n description?: EntityDescription\n /**\n * Disable the Copy To Locale button in the edit document view\n * @default false\n */\n disableCopyToLocale?: boolean\n enableRichTextLink?: boolean\n enableRichTextRelationship?: boolean\n /**\n * Specify a navigational group for collections in the admin sidebar.\n * - Provide a string to place the entity in a custom group.\n * - Provide a record to define localized group names.\n * - Set to `false` to exclude the entity from the sidebar / dashboard without disabling its routes.\n */\n group?: false | Record<string, string> | string\n /**\n * Exclude the collection from the admin nav and routes\n */\n hidden?: ((args: { user: ClientUser }) => boolean) | boolean\n /**\n * Hide the API URL within the Edit view\n */\n hideAPIURL?: boolean\n /**\n * Additional fields to be searched via the full text search\n */\n listSearchableFields?: string[]\n /**\n * Live preview options\n */\n livePreview?: LivePreviewConfig\n meta?: MetaConfig\n pagination?: {\n defaultLimit?: number\n limits?: number[]\n }\n /**\n * Function to generate custom preview URL\n */\n preview?: GeneratePreviewURL\n /**\n * Field to use as title in Edit View and first column in List view\n */\n useAsTitle?: string\n}\n\n/** Manage all aspects of a data collection */\nexport type CollectionConfig<TSlug extends CollectionSlug = any> = {\n /**\n * Do not set this property manually. This is set to true during sanitization, to avoid\n * sanitizing the same collection multiple times.\n */\n _sanitized?: boolean\n /**\n * Access control\n */\n access?: {\n admin?: ({ req }: { req: PayloadRequest }) => boolean | Promise<boolean>\n create?: Access\n delete?: Access\n read?: Access\n readVersions?: Access\n unlock?: Access\n update?: Access\n }\n /**\n * Collection admin options\n */\n admin?: CollectionAdminOptions\n /**\n * Collection login options\n *\n * Use `true` to enable with default options\n */\n auth?: boolean | IncomingAuthType\n /** Extension point to add your custom data. Server only. */\n custom?: Record<string, any>\n /**\n * Used to override the default naming of the database table or collection with your using a function or string\n * @WARNING: If you change this property with existing data, you will need to handle the renaming of the table in your database or by using migrations\n */\n dbName?: DBIdentifierName\n defaultPopulate?: IsAny<SelectFromCollectionSlug<TSlug>> extends true\n ? SelectType\n : SelectFromCollectionSlug<TSlug>\n /**\n * Default field to sort by in collection list view\n */\n defaultSort?: Sort\n /**\n * When true, do not show the \"Duplicate\" button while editing documents within this collection and prevent `duplicate` from all APIs\n */\n disableDuplicate?: boolean\n /**\n * Opt-in to enable query presets for this collection.\n * @see https://payloadcms.com/docs/query-presets/overview\n */\n enableQueryPresets?: boolean\n /**\n * Custom rest api endpoints, set false to disable all rest endpoints for this collection.\n */\n endpoints?: false | Omit<Endpoint, 'root'>[]\n fields: Field[]\n /**\n * Specify which fields should be selected always, regardless of the `select` query which can be useful that the field exists for access control / hooks\n */\n forceSelect?: IsAny<SelectFromCollectionSlug<TSlug>> extends true\n ? SelectIncludeType\n : SelectFromCollectionSlug<TSlug>\n /**\n * GraphQL configuration\n */\n graphQL?:\n | {\n disableMutations?: true\n disableQueries?: true\n pluralName?: string\n singularName?: string\n }\n | false\n /**\n * Hooks to modify Payload functionality\n */\n hooks?: {\n afterChange?: AfterChangeHook[]\n afterDelete?: AfterDeleteHook[]\n afterError?: AfterErrorHook[]\n afterForgotPassword?: AfterForgotPasswordHook[]\n afterLogin?: AfterLoginHook[]\n afterLogout?: AfterLogoutHook[]\n afterMe?: AfterMeHook[]\n afterOperation?: AfterOperationHook<TSlug>[]\n afterRead?: AfterReadHook[]\n afterRefresh?: AfterRefreshHook[]\n beforeChange?: BeforeChangeHook[]\n beforeDelete?: BeforeDeleteHook[]\n beforeLogin?: BeforeLoginHook[]\n beforeOperation?: BeforeOperationHook[]\n beforeRead?: BeforeReadHook[]\n beforeValidate?: BeforeValidateHook[]\n /**\n /**\n * Use the `me` hook to control the `me` operation.\n * Here, you can optionally instruct the me operation to return early,\n * and skip its default logic.\n */\n me?: MeHook[]\n /**\n * Use the `refresh` hook to control the refresh operation.\n * Here, you can optionally instruct the refresh operation to return early,\n * and skip its default logic.\n */\n refresh?: RefreshHook[]\n }\n /**\n * Define compound indexes for this collection.\n * This can be used to either speed up querying/sorting by 2 or more fields at the same time or\n * to ensure uniqueness between several fields.\n * Specify field paths\n * @example\n * [{ unique: true, fields: ['title', 'group.name'] }]\n * @default []\n */\n indexes?: CompoundIndex[]\n /**\n * Label configuration\n */\n labels?: {\n plural?: LabelFunction | StaticLabel\n singular?: LabelFunction | StaticLabel\n }\n /**\n * Enables / Disables the ability to lock documents while editing\n * @default true\n */\n lockDocuments?:\n | {\n duration: number\n }\n | false\n /**\n * If true, enables custom ordering for the collection, and documents in the listView can be reordered via drag and drop.\n * New documents are inserted at the end of the list according to this parameter.\n *\n * Under the hood, a field with {@link https://observablehq.com/@dgreensp/implementing-fractional-indexing|fractional indexing} is used to optimize inserts and reorderings.\n *\n * @default false\n *\n * @experimental There may be frequent breaking changes to this API\n */\n orderable?: boolean\n slug: string\n /**\n * Add `createdAt` and `updatedAt` fields\n *\n * @default true\n */\n timestamps?: boolean\n /**\n * Options used in typescript generation\n */\n typescript?: {\n /**\n * Typescript generation name given to the interface type\n */\n interface?: string\n }\n /**\n * Customize the handling of incoming file uploads\n *\n * @default false // disable uploads\n */\n upload?: boolean | UploadConfig\n /**\n * Enable versioning. Set it to true to enable default versions settings,\n * or customize versions options by setting the property equal to an object\n * containing the version options.\n *\n * @default false // disable versioning\n */\n versions?: boolean | IncomingCollectionVersions\n}\n\nexport type SanitizedJoin = {\n /**\n * The field configuration defining the join\n */\n field: JoinField\n getForeignPath?(args: { locale?: TypedLocale }): string\n /**\n * The path of the join field in dot notation\n */\n joinPath: string\n /**\n * `parentIsLocalized` is true if any parent field of the\n * field configuration defining the join is localized\n */\n parentIsLocalized: boolean\n targetField: RelationshipField | UploadField\n}\n\nexport type SanitizedJoins = {\n [collectionSlug: string]: SanitizedJoin[]\n}\n\n/**\n * @todo remove the `DeepRequired` in v4.\n * We don't actually guarantee that all properties are set when sanitizing configs.\n */\nexport interface SanitizedCollectionConfig\n extends Omit<\n DeepRequired<CollectionConfig>,\n 'auth' | 'endpoints' | 'fields' | 'slug' | 'upload' | 'versions'\n > {\n auth: Auth\n endpoints: Endpoint[] | false\n fields: Field[]\n /**\n * Fields in the database schema structure\n * Rows / collapsible / tabs w/o name `fields` merged to top, UIs are excluded\n */\n flattenedFields: FlattenedField[]\n /**\n * Object of collections to join 'Join Fields object keyed by collection\n */\n joins: SanitizedJoins\n\n /**\n * List of all polymorphic join fields\n */\n polymorphicJoins: SanitizedJoin[]\n\n sanitizedIndexes: SanitizedCompoundIndex[]\n\n slug: CollectionSlug\n upload: SanitizedUploadConfig\n versions: SanitizedCollectionVersions\n}\n\nexport type Collection = {\n config: SanitizedCollectionConfig\n customIDType?: 'number' | 'text'\n graphQL?: {\n countType: GraphQLObjectType\n JWT: GraphQLObjectType\n mutationInputType: GraphQLNonNull<any>\n paginatedType: GraphQLObjectType\n type: GraphQLObjectType\n updateMutationInputType: GraphQLNonNull<any>\n versionType: GraphQLObjectType\n whereInputType: GraphQLInputObjectType\n }\n}\n\nexport type BulkOperationResult<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n docs: TransformCollectionWithSelect<TSlug, TSelect>[]\n errors: {\n id: DataFromCollectionSlug<TSlug>['id']\n message: string\n }[]\n}\n\nexport type AuthCollection = {\n config: SanitizedCollectionConfig\n}\n\nexport type TypeWithID = {\n docId?: any\n id: number | string\n}\n\nexport type TypeWithTimestamps = {\n [key: string]: unknown\n createdAt: string\n id: number | string\n updatedAt: string\n}\n\nexport type CompoundIndex = {\n fields: string[]\n unique?: boolean\n}\n\nexport type SanitizedCompoundIndex = {\n fields: {\n field: FlattenedField\n localizedPath: string\n path: string\n pathHasLocalized: boolean\n }[]\n unique: boolean\n}\n"],"names":[],"mappings":"AA4oBA,WAQC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string | null | undefined} a
|
|
3
|
+
* @param {string | null | undefined} b
|
|
4
|
+
* @param {string=} digits
|
|
5
|
+
* @return {string}
|
|
6
|
+
*/
|
|
7
|
+
export function generateKeyBetween(a: string | null | undefined, b: string | null | undefined, digits?: string | undefined): string;
|
|
8
|
+
/**
|
|
9
|
+
* same preconditions as generateKeysBetween.
|
|
10
|
+
* n >= 0.
|
|
11
|
+
* Returns an array of n distinct keys in sorted order.
|
|
12
|
+
* If a and b are both null, returns [a0, a1, ...]
|
|
13
|
+
* If one or the other is null, returns consecutive "integer"
|
|
14
|
+
* keys. Otherwise, returns relatively short keys between
|
|
15
|
+
* a and b.
|
|
16
|
+
* @param {string | null | undefined} a
|
|
17
|
+
* @param {string | null | undefined} b
|
|
18
|
+
* @param {number} n
|
|
19
|
+
* @param {string} digits
|
|
20
|
+
* @return {string[]}
|
|
21
|
+
*/
|
|
22
|
+
export function generateNKeysBetween(a: string | null | undefined, b: string | null | undefined, n: number, digits?: string): string[];
|
|
23
|
+
/**
|
|
24
|
+
* THIS FILE IS COPIED FROM:
|
|
25
|
+
* https://github.com/rocicorp/fractional-indexing/blob/main/src/index.js
|
|
26
|
+
*
|
|
27
|
+
* I AM NOT INSTALLING THAT LIBRARY BECAUSE JEST COMPLAINS ABOUT THE ESM MODULE AND THE TESTS FAIL.
|
|
28
|
+
* DO NOT MODIFY IT
|
|
29
|
+
*/
|
|
30
|
+
export const BASE_62_DIGITS: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
31
|
+
//# sourceMappingURL=fractional-indexing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fractional-indexing.d.ts","sourceRoot":"","sources":["../../../src/config/orderable/fractional-indexing.js"],"names":[],"mappings":"AAkNA;;;;;GAKG;AACH,sCALW,MAAM,GAAG,IAAI,GAAG,SAAS,KACzB,MAAM,GAAG,IAAI,GAAG,SAAS,WACzB,MAAM,YAAC,GACN,MAAM,CAsDjB;AAED;;;;;;;;;;;;;GAaG;AACH,wCANW,MAAM,GAAG,IAAI,GAAG,SAAS,KACzB,MAAM,GAAG,IAAI,GAAG,SAAS,KACzB,MAAM,WACN,MAAM,GACL,MAAM,EAAE,CAmCnB;AA3TD;;;;;;GAMG;AAMH,6BAA8B,gEAAgE,CAAA"}
|