payload 3.49.0-canary.8 → 3.49.1
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/elements/Cell.d.ts +2 -0
- package/dist/admin/elements/Cell.d.ts.map +1 -1
- package/dist/admin/elements/Cell.js.map +1 -1
- package/dist/admin/forms/Field.d.ts +3 -0
- package/dist/admin/forms/Field.d.ts.map +1 -1
- package/dist/admin/forms/Field.js.map +1 -1
- package/dist/admin/forms/Form.d.ts +1 -0
- package/dist/admin/forms/Form.d.ts.map +1 -1
- package/dist/admin/forms/Form.js.map +1 -1
- package/dist/admin/views/document.d.ts +6 -0
- package/dist/admin/views/document.d.ts.map +1 -1
- package/dist/admin/views/document.js.map +1 -1
- package/dist/admin/views/index.d.ts +2 -1
- package/dist/admin/views/index.d.ts.map +1 -1
- package/dist/admin/views/index.js.map +1 -1
- package/dist/admin/views/list.d.ts +4 -1
- package/dist/admin/views/list.d.ts.map +1 -1
- package/dist/admin/views/list.js.map +1 -1
- package/dist/auth/isUserLocked.d.ts +1 -1
- package/dist/auth/isUserLocked.d.ts.map +1 -1
- package/dist/auth/isUserLocked.js +1 -1
- package/dist/auth/isUserLocked.js.map +1 -1
- package/dist/auth/operations/forgotPassword.d.ts.map +1 -1
- package/dist/auth/operations/forgotPassword.js +7 -0
- package/dist/auth/operations/forgotPassword.js.map +1 -1
- package/dist/auth/operations/init.d.ts.map +1 -1
- package/dist/auth/operations/init.js +10 -1
- package/dist/auth/operations/init.js.map +1 -1
- package/dist/auth/operations/local/login.d.ts +1 -0
- package/dist/auth/operations/local/login.d.ts.map +1 -1
- package/dist/auth/operations/local/login.js.map +1 -1
- package/dist/auth/operations/login.d.ts +5 -0
- package/dist/auth/operations/login.d.ts.map +1 -1
- package/dist/auth/operations/login.js +45 -4
- package/dist/auth/operations/login.js.map +1 -1
- package/dist/auth/operations/logout.d.ts.map +1 -1
- package/dist/auth/operations/logout.js +9 -3
- package/dist/auth/operations/logout.js.map +1 -1
- package/dist/auth/operations/refresh.d.ts.map +1 -1
- package/dist/auth/operations/refresh.js +14 -5
- package/dist/auth/operations/refresh.js.map +1 -1
- package/dist/auth/operations/registerFirstUser.d.ts.map +1 -1
- package/dist/auth/operations/registerFirstUser.js +8 -1
- package/dist/auth/operations/registerFirstUser.js.map +1 -1
- package/dist/auth/operations/resetPassword.d.ts.map +1 -1
- package/dist/auth/operations/resetPassword.js +11 -4
- package/dist/auth/operations/resetPassword.js.map +1 -1
- package/dist/auth/operations/unlock.d.ts.map +1 -1
- package/dist/auth/operations/unlock.js +7 -0
- package/dist/auth/operations/unlock.js.map +1 -1
- package/dist/auth/operations/verifyEmail.d.ts.map +1 -1
- package/dist/auth/operations/verifyEmail.js +9 -3
- package/dist/auth/operations/verifyEmail.js.map +1 -1
- package/dist/auth/strategies/local/incrementLoginAttempts.d.ts +4 -4
- package/dist/auth/strategies/local/incrementLoginAttempts.d.ts.map +1 -1
- package/dist/auth/strategies/local/incrementLoginAttempts.js +104 -27
- package/dist/auth/strategies/local/incrementLoginAttempts.js.map +1 -1
- package/dist/auth/strategies/local/resetLoginAttempts.d.ts.map +1 -1
- package/dist/auth/strategies/local/resetLoginAttempts.js +3 -4
- package/dist/auth/strategies/local/resetLoginAttempts.js.map +1 -1
- package/dist/collections/config/sanitize.d.ts.map +1 -1
- package/dist/collections/config/sanitize.js +17 -1
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/collections/config/types.d.ts +15 -2
- package/dist/collections/config/types.d.ts.map +1 -1
- package/dist/collections/config/types.js.map +1 -1
- package/dist/collections/endpoints/delete.d.ts.map +1 -1
- package/dist/collections/endpoints/delete.js +2 -1
- package/dist/collections/endpoints/delete.js.map +1 -1
- package/dist/collections/endpoints/deleteByID.d.ts.map +1 -1
- package/dist/collections/endpoints/deleteByID.js +3 -1
- package/dist/collections/endpoints/deleteByID.js.map +1 -1
- package/dist/collections/endpoints/find.d.ts.map +1 -1
- package/dist/collections/endpoints/find.js +2 -1
- package/dist/collections/endpoints/find.js.map +1 -1
- package/dist/collections/endpoints/findByID.d.ts.map +1 -1
- package/dist/collections/endpoints/findByID.js +3 -1
- package/dist/collections/endpoints/findByID.js.map +1 -1
- package/dist/collections/endpoints/findDistinct.d.ts.map +1 -1
- package/dist/collections/endpoints/findDistinct.js +2 -1
- package/dist/collections/endpoints/findDistinct.js.map +1 -1
- package/dist/collections/endpoints/findVersionByID.d.ts.map +1 -1
- package/dist/collections/endpoints/findVersionByID.js +3 -1
- package/dist/collections/endpoints/findVersionByID.js.map +1 -1
- package/dist/collections/endpoints/findVersions.d.ts.map +1 -1
- package/dist/collections/endpoints/findVersions.js +2 -1
- package/dist/collections/endpoints/findVersions.js.map +1 -1
- package/dist/collections/endpoints/index.js +1 -0
- package/dist/collections/endpoints/index.js.map +1 -1
- package/dist/collections/endpoints/preview.d.ts.map +1 -1
- package/dist/collections/endpoints/preview.js +2 -1
- package/dist/collections/endpoints/preview.js.map +1 -1
- package/dist/collections/endpoints/update.d.ts.map +1 -1
- package/dist/collections/endpoints/update.js +2 -1
- package/dist/collections/endpoints/update.js.map +1 -1
- package/dist/collections/endpoints/updateByID.d.ts.map +1 -1
- package/dist/collections/endpoints/updateByID.js +3 -1
- package/dist/collections/endpoints/updateByID.js.map +1 -1
- package/dist/collections/operations/delete.d.ts +1 -0
- package/dist/collections/operations/delete.d.ts.map +1 -1
- package/dist/collections/operations/delete.js +9 -2
- package/dist/collections/operations/delete.js.map +1 -1
- package/dist/collections/operations/deleteByID.d.ts +1 -0
- package/dist/collections/operations/deleteByID.d.ts.map +1 -1
- package/dist/collections/operations/deleteByID.js +14 -6
- package/dist/collections/operations/deleteByID.js.map +1 -1
- package/dist/collections/operations/find.d.ts +1 -0
- package/dist/collections/operations/find.d.ts.map +1 -1
- package/dist/collections/operations/find.js +8 -1
- package/dist/collections/operations/find.js.map +1 -1
- package/dist/collections/operations/findByID.d.ts +1 -0
- package/dist/collections/operations/findByID.d.ts.map +1 -1
- package/dist/collections/operations/findByID.js +9 -2
- package/dist/collections/operations/findByID.js.map +1 -1
- package/dist/collections/operations/findDistinct.d.ts +1 -0
- package/dist/collections/operations/findDistinct.d.ts.map +1 -1
- package/dist/collections/operations/findDistinct.js +9 -2
- package/dist/collections/operations/findDistinct.js.map +1 -1
- package/dist/collections/operations/findVersionByID.d.ts +1 -0
- package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
- package/dist/collections/operations/findVersionByID.js +11 -3
- package/dist/collections/operations/findVersionByID.js.map +1 -1
- package/dist/collections/operations/findVersions.d.ts +1 -0
- package/dist/collections/operations/findVersions.d.ts.map +1 -1
- package/dist/collections/operations/findVersions.js +10 -2
- package/dist/collections/operations/findVersions.js.map +1 -1
- package/dist/collections/operations/local/delete.d.ts +8 -0
- package/dist/collections/operations/local/delete.d.ts.map +1 -1
- package/dist/collections/operations/local/delete.js +2 -1
- package/dist/collections/operations/local/delete.js.map +1 -1
- package/dist/collections/operations/local/find.d.ts +9 -0
- package/dist/collections/operations/local/find.d.ts.map +1 -1
- package/dist/collections/operations/local/find.js +2 -1
- package/dist/collections/operations/local/find.js.map +1 -1
- package/dist/collections/operations/local/findByID.d.ts +9 -0
- package/dist/collections/operations/local/findByID.d.ts.map +1 -1
- package/dist/collections/operations/local/findByID.js +3 -2
- package/dist/collections/operations/local/findByID.js.map +1 -1
- package/dist/collections/operations/local/findDistinct.d.ts +9 -0
- package/dist/collections/operations/local/findDistinct.d.ts.map +1 -1
- package/dist/collections/operations/local/findDistinct.js +2 -1
- package/dist/collections/operations/local/findDistinct.js.map +1 -1
- package/dist/collections/operations/local/findVersionByID.d.ts +9 -0
- package/dist/collections/operations/local/findVersionByID.d.ts.map +1 -1
- package/dist/collections/operations/local/findVersionByID.js +4 -3
- package/dist/collections/operations/local/findVersionByID.js.map +1 -1
- package/dist/collections/operations/local/findVersions.d.ts +9 -0
- package/dist/collections/operations/local/findVersions.d.ts.map +1 -1
- package/dist/collections/operations/local/findVersions.js +3 -2
- package/dist/collections/operations/local/findVersions.js.map +1 -1
- package/dist/collections/operations/local/update.d.ts +7 -0
- package/dist/collections/operations/local/update.d.ts.map +1 -1
- package/dist/collections/operations/local/update.js +2 -1
- package/dist/collections/operations/local/update.js.map +1 -1
- package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
- package/dist/collections/operations/restoreVersion.js +3 -0
- package/dist/collections/operations/restoreVersion.js.map +1 -1
- package/dist/collections/operations/update.d.ts +1 -0
- package/dist/collections/operations/update.d.ts.map +1 -1
- package/dist/collections/operations/update.js +17 -2
- package/dist/collections/operations/update.js.map +1 -1
- package/dist/collections/operations/updateByID.d.ts +1 -0
- package/dist/collections/operations/updateByID.d.ts.map +1 -1
- package/dist/collections/operations/updateByID.js +22 -6
- package/dist/collections/operations/updateByID.js.map +1 -1
- package/dist/database/getLocalizedPaths.d.ts.map +1 -1
- package/dist/database/getLocalizedPaths.js +6 -7
- package/dist/database/getLocalizedPaths.js.map +1 -1
- package/dist/database/queryValidation/validateSearchParams.d.ts.map +1 -1
- package/dist/database/queryValidation/validateSearchParams.js +15 -15
- package/dist/database/queryValidation/validateSearchParams.js.map +1 -1
- package/dist/uploads/checkFileRestrictions.d.ts.map +1 -1
- package/dist/uploads/checkFileRestrictions.js +9 -1
- package/dist/uploads/checkFileRestrictions.js.map +1 -1
- package/dist/uploads/detectSvgFromXml.d.ts +5 -0
- package/dist/uploads/detectSvgFromXml.d.ts.map +1 -0
- package/dist/uploads/detectSvgFromXml.js +43 -0
- package/dist/uploads/detectSvgFromXml.js.map +1 -0
- package/dist/uploads/endpoints/getFile.d.ts.map +1 -1
- package/dist/uploads/endpoints/getFile.js +5 -1
- package/dist/uploads/endpoints/getFile.js.map +1 -1
- package/dist/uploads/getExternalFile.d.ts.map +1 -1
- package/dist/uploads/getExternalFile.js +1 -1
- package/dist/uploads/getExternalFile.js.map +1 -1
- package/dist/uploads/types.d.ts +6 -1
- package/dist/uploads/types.d.ts.map +1 -1
- package/dist/uploads/types.js.map +1 -1
- package/dist/utilities/appendNonTrashedFilter.d.ts +8 -0
- package/dist/utilities/appendNonTrashedFilter.d.ts.map +1 -0
- package/dist/utilities/appendNonTrashedFilter.js +29 -0
- package/dist/utilities/appendNonTrashedFilter.js.map +1 -0
- package/dist/utilities/getEntityPolicies.d.ts.map +1 -1
- package/dist/utilities/getEntityPolicies.js +2 -1
- package/dist/utilities/getEntityPolicies.js.map +1 -1
- package/package.json +2 -2
|
@@ -2,6 +2,7 @@ import type { I18nClient } from '@payloadcms/translations';
|
|
|
2
2
|
import type { SanitizedCollectionConfig } from '../../collections/config/types.js';
|
|
3
3
|
import type { ArrayFieldClient, BlocksFieldClient, CheckboxFieldClient, ClientField, CodeFieldClient, DateFieldClient, EmailFieldClient, Field, GroupFieldClient, JSONFieldClient, NumberFieldClient, PointFieldClient, RadioFieldClient, RelationshipFieldClient, SelectFieldClient, TextareaFieldClient, TextFieldClient, UploadFieldClient } from '../../fields/config/types.js';
|
|
4
4
|
import type { Payload } from '../../types/index.js';
|
|
5
|
+
import type { ViewTypes } from '../types.js';
|
|
5
6
|
export type RowData = Record<string, any>;
|
|
6
7
|
export type DefaultCellComponentProps<TField extends ClientField = ClientField, TCellData = undefined> = {
|
|
7
8
|
readonly cellData: TCellData extends undefined ? TField extends RelationshipFieldClient ? number | Record<string, any> | string : TField extends NumberFieldClient ? TField['hasMany'] extends true ? number[] : number : TField extends TextFieldClient ? TField['hasMany'] extends true ? string[] : string : TField extends CodeFieldClient | EmailFieldClient | JSONFieldClient | RadioFieldClient | TextareaFieldClient ? string : TField extends BlocksFieldClient ? {
|
|
@@ -23,6 +24,7 @@ export type DefaultCellComponentProps<TField extends ClientField = ClientField,
|
|
|
23
24
|
rowData: RowData;
|
|
24
25
|
}) => void;
|
|
25
26
|
rowData: RowData;
|
|
27
|
+
viewType?: ViewTypes;
|
|
26
28
|
};
|
|
27
29
|
export type DefaultServerCellComponentProps<TField extends ClientField = ClientField, TCellData = any> = {
|
|
28
30
|
collectionConfig: SanitizedCollectionConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/admin/elements/Cell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAClF,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,KAAK,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EAClB,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/admin/elements/Cell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAClF,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,KAAK,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EAClB,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC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,CAAC,MAAM,CAAC,CAAA;IACjD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE;QACf,QAAQ,EAAE,OAAO,CAAA;QACjB,cAAc,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAA;QACjD,OAAO,EAAE,OAAO,CAAA;KACjB,KAAK,IAAI,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,+BAA+B,CACzC,MAAM,SAAS,WAAW,GAAG,WAAW,EACxC,SAAS,GAAG,GAAG,IACb;IACF,gBAAgB,EAAE,yBAAyB,CAAA;IAC3C,KAAK,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,IAAI,CAAC,yBAAyB,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/elements/Cell.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport type { SanitizedCollectionConfig } from '../../collections/config/types.js'\nimport type {\n ArrayFieldClient,\n BlocksFieldClient,\n CheckboxFieldClient,\n ClientField,\n CodeFieldClient,\n DateFieldClient,\n EmailFieldClient,\n Field,\n GroupFieldClient,\n JSONFieldClient,\n NumberFieldClient,\n PointFieldClient,\n RadioFieldClient,\n RelationshipFieldClient,\n SelectFieldClient,\n TextareaFieldClient,\n TextFieldClient,\n UploadFieldClient,\n} from '../../fields/config/types.js'\nimport type { Payload } from '../../types/index.js'\n\nexport type RowData = Record<string, any>\n\nexport type DefaultCellComponentProps<\n TField extends ClientField = ClientField,\n TCellData = undefined,\n> = {\n readonly cellData: TCellData extends undefined\n ? TField extends RelationshipFieldClient\n ? number | Record<string, any> | string\n : TField extends NumberFieldClient\n ? TField['hasMany'] extends true\n ? number[]\n : number\n : TField extends TextFieldClient\n ? TField['hasMany'] extends true\n ? string[]\n : string\n : TField extends\n | CodeFieldClient\n | EmailFieldClient\n | JSONFieldClient\n | RadioFieldClient\n | TextareaFieldClient\n ? string\n : TField extends BlocksFieldClient\n ? {\n [key: string]: any\n blockType: string\n }[]\n : TField extends CheckboxFieldClient\n ? boolean\n : TField extends DateFieldClient\n ? Date | number | string\n : TField extends GroupFieldClient\n ? Record<string, any>\n : TField extends UploadFieldClient\n ? File | string\n : TField extends ArrayFieldClient\n ? Record<string, unknown>[]\n : TField extends SelectFieldClient\n ? TField['hasMany'] extends true\n ? string[]\n : string\n : TField extends PointFieldClient\n ? { x: number; y: number }\n : any\n : TCellData\n className?: string\n collectionSlug: SanitizedCollectionConfig['slug']\n columnIndex?: number\n customCellProps?: Record<string, any>\n field: TField\n link?: boolean\n onClick?: (args: {\n cellData: unknown\n collectionSlug: SanitizedCollectionConfig['slug']\n rowData: RowData\n }) => void\n rowData: RowData\n}\n\nexport type DefaultServerCellComponentProps<\n TField extends ClientField = ClientField,\n TCellData = any,\n> = {\n collectionConfig: SanitizedCollectionConfig\n field: Field\n i18n: I18nClient\n payload: Payload\n} & Omit<DefaultCellComponentProps<TField, TCellData>, 'field'>\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/elements/Cell.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport type { SanitizedCollectionConfig } from '../../collections/config/types.js'\nimport type {\n ArrayFieldClient,\n BlocksFieldClient,\n CheckboxFieldClient,\n ClientField,\n CodeFieldClient,\n DateFieldClient,\n EmailFieldClient,\n Field,\n GroupFieldClient,\n JSONFieldClient,\n NumberFieldClient,\n PointFieldClient,\n RadioFieldClient,\n RelationshipFieldClient,\n SelectFieldClient,\n TextareaFieldClient,\n TextFieldClient,\n UploadFieldClient,\n} from '../../fields/config/types.js'\nimport type { Payload } from '../../types/index.js'\nimport type { ViewTypes } from '../types.js'\n\nexport type RowData = Record<string, any>\n\nexport type DefaultCellComponentProps<\n TField extends ClientField = ClientField,\n TCellData = undefined,\n> = {\n readonly cellData: TCellData extends undefined\n ? TField extends RelationshipFieldClient\n ? number | Record<string, any> | string\n : TField extends NumberFieldClient\n ? TField['hasMany'] extends true\n ? number[]\n : number\n : TField extends TextFieldClient\n ? TField['hasMany'] extends true\n ? string[]\n : string\n : TField extends\n | CodeFieldClient\n | EmailFieldClient\n | JSONFieldClient\n | RadioFieldClient\n | TextareaFieldClient\n ? string\n : TField extends BlocksFieldClient\n ? {\n [key: string]: any\n blockType: string\n }[]\n : TField extends CheckboxFieldClient\n ? boolean\n : TField extends DateFieldClient\n ? Date | number | string\n : TField extends GroupFieldClient\n ? Record<string, any>\n : TField extends UploadFieldClient\n ? File | string\n : TField extends ArrayFieldClient\n ? Record<string, unknown>[]\n : TField extends SelectFieldClient\n ? TField['hasMany'] extends true\n ? string[]\n : string\n : TField extends PointFieldClient\n ? { x: number; y: number }\n : any\n : TCellData\n className?: string\n collectionSlug: SanitizedCollectionConfig['slug']\n columnIndex?: number\n customCellProps?: Record<string, any>\n field: TField\n link?: boolean\n onClick?: (args: {\n cellData: unknown\n collectionSlug: SanitizedCollectionConfig['slug']\n rowData: RowData\n }) => void\n rowData: RowData\n viewType?: ViewTypes\n}\n\nexport type DefaultServerCellComponentProps<\n TField extends ClientField = ClientField,\n TCellData = any,\n> = {\n collectionConfig: SanitizedCollectionConfig\n field: Field\n i18n: I18nClient\n payload: Payload\n} & Omit<DefaultCellComponentProps<TField, TCellData>, 'field'>\n"],"names":[],"mappings":"AAwFA,WAQ+D"}
|
|
@@ -54,6 +54,9 @@ export type FieldPaths = {
|
|
|
54
54
|
*/
|
|
55
55
|
path: string;
|
|
56
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* TODO: This should be renamed to `FieldComponentServerProps` or similar
|
|
59
|
+
*/
|
|
57
60
|
export type ServerComponentProps = {
|
|
58
61
|
clientField: ClientFieldWithOptionalType;
|
|
59
62
|
clientFieldSchemaMap: ClientFieldSchemaMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/Field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC9E,OAAO,KAAK,EACV,oBAAoB,EACpB,SAAS,EACT,IAAI,EACJ,cAAc,EACd,SAAS,EACT,SAAS,EACT,aAAa,EACd,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,2BAA2B,GAAG,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;AAE3E,MAAM,MAAM,oBAAoB,GAAG;IACjC,gBAAgB,CAAC,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAA;IAChD,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,CAAA;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,yBAAyB,CAAA;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,cAAc,CAAC,EAAE,aAAa,EAAE,CAAA;IAChC;;;;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AAE,YAAY,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/forms/Field.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { MarkOptional } from 'ts-essentials'\n\nimport type { SanitizedFieldPermissions } from '../../auth/types.js'\nimport type { ClientBlock, ClientField, Field } from '../../fields/config/types.js'\nimport type { TypedUser } from '../../index.js'\nimport type { DocumentPreferences } from '../../preferences/types.js'\nimport type { Operation, Payload, PayloadRequest } from '../../types/index.js'\nimport type {\n ClientFieldSchemaMap,\n ClientTab,\n Data,\n FieldSchemaMap,\n FormField,\n FormState,\n RenderedField,\n} from '../types.js'\n\nexport type ClientFieldWithOptionalType = MarkOptional<ClientField, 'type'>\n\nexport type ClientComponentProps = {\n customComponents?: FormField['customComponents']\n field: ClientBlock | ClientField | ClientTab\n forceRender?: boolean\n permissions?: SanitizedFieldPermissions\n readOnly?: boolean\n renderedBlocks?: RenderedField[]\n /**\n * Used to extract field configs from a schemaMap.\n * Does not include indexes.\n *\n * @default field.name\n **/\n schemaPath?: string\n}\n\n// TODO: maybe we can come up with a better name?\nexport type FieldPaths = {\n /**\n * @default ''\n */\n indexPath?: string\n /**\n * @default ''\n */\n parentPath?: string\n /**\n * The path built up to the point of the field\n * excluding the field name.\n *\n * @default ''\n */\n parentSchemaPath?: string\n /**\n * A built up path to access FieldState in the form state.\n * Nested fields will have a path that includes the parent field names\n * if they are nested within a group, array, block or named tab.\n *\n * Collapsibles and unnamed tabs will have arbitrary paths\n * that look like _index-0, _index-1, etc.\n *\n * Row fields will not have a path.\n *\n * @example 'parentGroupField.childTextField'\n *\n * @default field.name\n */\n path: string\n}\n\nexport type ServerComponentProps = {\n clientField: ClientFieldWithOptionalType\n clientFieldSchemaMap: ClientFieldSchemaMap\n collectionSlug: string\n data: Data\n field: Field\n /**\n * The fieldSchemaMap that is created before form state is built is made available here.\n */\n fieldSchemaMap: FieldSchemaMap\n /**\n * Server Components will also have available to the entire form state.\n * We cannot add it to ClientComponentProps as that would blow up the size of the props sent to the client.\n */\n formState: FormState\n i18n: I18nClient\n id?: number | string\n operation: Operation\n payload: Payload\n permissions: SanitizedFieldPermissions\n preferences: DocumentPreferences\n req: PayloadRequest\n siblingData: Data\n user: TypedUser\n value?: unknown\n}\n\nexport type ClientFieldBase<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = {\n readonly field: TFieldClient\n} & Omit<ClientComponentProps, 'customComponents' | 'field'>\n\nexport type ServerFieldBase<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = {\n readonly clientField: TFieldClient\n readonly field: TFieldServer\n} & Omit<ClientComponentProps, 'field'> &\n Omit<ServerComponentProps, 'clientField' | 'field'>\n\nexport type FieldClientComponent<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n AdditionalProps extends Record<string, unknown> = Record<string, unknown>,\n> = React.ComponentType<AdditionalProps & ClientFieldBase<TFieldClient>>\n\nexport type FieldServerComponent<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n AdditionalProps extends Record<string, unknown> = Record<string, unknown>,\n> = React.ComponentType<AdditionalProps & ServerFieldBase<TFieldServer, TFieldClient>>\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/forms/Field.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { MarkOptional } from 'ts-essentials'\n\nimport type { SanitizedFieldPermissions } from '../../auth/types.js'\nimport type { ClientBlock, ClientField, Field } from '../../fields/config/types.js'\nimport type { TypedUser } from '../../index.js'\nimport type { DocumentPreferences } from '../../preferences/types.js'\nimport type { Operation, Payload, PayloadRequest } from '../../types/index.js'\nimport type {\n ClientFieldSchemaMap,\n ClientTab,\n Data,\n FieldSchemaMap,\n FormField,\n FormState,\n RenderedField,\n} from '../types.js'\n\nexport type ClientFieldWithOptionalType = MarkOptional<ClientField, 'type'>\n\nexport type ClientComponentProps = {\n customComponents?: FormField['customComponents']\n field: ClientBlock | ClientField | ClientTab\n forceRender?: boolean\n permissions?: SanitizedFieldPermissions\n readOnly?: boolean\n renderedBlocks?: RenderedField[]\n /**\n * Used to extract field configs from a schemaMap.\n * Does not include indexes.\n *\n * @default field.name\n **/\n schemaPath?: string\n}\n\n// TODO: maybe we can come up with a better name?\nexport type FieldPaths = {\n /**\n * @default ''\n */\n indexPath?: string\n /**\n * @default ''\n */\n parentPath?: string\n /**\n * The path built up to the point of the field\n * excluding the field name.\n *\n * @default ''\n */\n parentSchemaPath?: string\n /**\n * A built up path to access FieldState in the form state.\n * Nested fields will have a path that includes the parent field names\n * if they are nested within a group, array, block or named tab.\n *\n * Collapsibles and unnamed tabs will have arbitrary paths\n * that look like _index-0, _index-1, etc.\n *\n * Row fields will not have a path.\n *\n * @example 'parentGroupField.childTextField'\n *\n * @default field.name\n */\n path: string\n}\n\n/**\n * TODO: This should be renamed to `FieldComponentServerProps` or similar\n */\nexport type ServerComponentProps = {\n clientField: ClientFieldWithOptionalType\n clientFieldSchemaMap: ClientFieldSchemaMap\n collectionSlug: string\n data: Data\n field: Field\n /**\n * The fieldSchemaMap that is created before form state is built is made available here.\n */\n fieldSchemaMap: FieldSchemaMap\n /**\n * Server Components will also have available to the entire form state.\n * We cannot add it to ClientComponentProps as that would blow up the size of the props sent to the client.\n */\n formState: FormState\n i18n: I18nClient\n id?: number | string\n operation: Operation\n payload: Payload\n permissions: SanitizedFieldPermissions\n preferences: DocumentPreferences\n req: PayloadRequest\n siblingData: Data\n user: TypedUser\n value?: unknown\n}\n\nexport type ClientFieldBase<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = {\n readonly field: TFieldClient\n} & Omit<ClientComponentProps, 'customComponents' | 'field'>\n\nexport type ServerFieldBase<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = {\n readonly clientField: TFieldClient\n readonly field: TFieldServer\n} & Omit<ClientComponentProps, 'field'> &\n Omit<ServerComponentProps, 'clientField' | 'field'>\n\nexport type FieldClientComponent<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n AdditionalProps extends Record<string, unknown> = Record<string, unknown>,\n> = React.ComponentType<AdditionalProps & ClientFieldBase<TFieldClient>>\n\nexport type FieldServerComponent<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n AdditionalProps extends Record<string, unknown> = Record<string, unknown>,\n> = React.ComponentType<AdditionalProps & ServerFieldBase<TFieldServer, TFieldClient>>\n"],"names":[],"mappings":"AAwHA,WAIsF"}
|
|
@@ -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,MAAM,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAC3E,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,gBAAgB,CAAC,EAAE;QACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;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MAAM,kBAAkB,CAAA;IACnC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAIlB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,gBAAgB,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, Option, 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 customComponents?: {\n RowLabel?: React.ReactNode\n }\n id: string\n isLoading?: boolean\n lastRenderedPath?: string\n}\n\nexport type FilterOptionsResult = {\n [relation: string]: boolean | Where\n}\n\nexport type FieldState = {\n /**\n * This is used to determine if the field was added by the server.\n * This ensures the field is not ignored by the client when merging form state.\n * This can happen because the current local state is treated as the source of truth.\n * See `mergeServerFormState` for more details.\n */\n addedByServer?: boolean\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 }\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 /**\n * The path of the field when its custom components were last rendered.\n * This is used to denote if a field has been rendered, and if so,\n * what path it was rendered under last.\n *\n * If this path is undefined, or, if it is different\n * from the current path of a given field, the field's components will be re-rendered.\n */\n lastRenderedPath?: string\n passesCondition?: boolean\n rows?: Row[]\n /**\n * The result of running `field.filterOptions` on select fields.\n */\n selectFilterOptions?: Option[]\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 /**\n * If true, will not render RSCs and instead return a simple string in their place.\n * This is useful for environments that lack RSC support, such as Jest.\n * Form state can still be built, but any server components will be omitted.\n * @default false\n */\n mockRSCs?: boolean\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":"AAwFA,
|
|
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, Option, 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 customComponents?: {\n RowLabel?: React.ReactNode\n }\n id: string\n isLoading?: boolean\n lastRenderedPath?: string\n}\n\nexport type FilterOptionsResult = {\n [relation: string]: boolean | Where\n}\n\nexport type FieldState = {\n /**\n * This is used to determine if the field was added by the server.\n * This ensures the field is not ignored by the client when merging form state.\n * This can happen because the current local state is treated as the source of truth.\n * See `mergeServerFormState` for more details.\n */\n addedByServer?: boolean\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 }\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 /**\n * The path of the field when its custom components were last rendered.\n * This is used to denote if a field has been rendered, and if so,\n * what path it was rendered under last.\n *\n * If this path is undefined, or, if it is different\n * from the current path of a given field, the field's components will be re-rendered.\n */\n lastRenderedPath?: string\n passesCondition?: boolean\n rows?: Row[]\n /**\n * The result of running `field.filterOptions` on select fields.\n */\n selectFilterOptions?: Option[]\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 /**\n * If true, will not render RSCs and instead return a simple string in their place.\n * This is useful for environments that lack RSC support, such as Jest.\n * Form state can still be built, but any server components will be omitted.\n * @default false\n */\n mockRSCs?: boolean\n operation?: 'create' | 'update'\n readOnly?: boolean\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":"AAwFA,WAiDC"}
|
|
@@ -2,6 +2,7 @@ import type { SanitizedPermissions } from '../../auth/types.js';
|
|
|
2
2
|
import type { SanitizedCollectionConfig } from '../../collections/config/types.js';
|
|
3
3
|
import type { PayloadComponent, SanitizedConfig, ServerProps } from '../../config/types.js';
|
|
4
4
|
import type { SanitizedGlobalConfig } from '../../globals/config/types.js';
|
|
5
|
+
import type { PayloadRequest } from '../../types/index.js';
|
|
5
6
|
import type { Data, DocumentSlots, FormState } from '../types.js';
|
|
6
7
|
import type { InitPageResult, ViewTypes } from './index.js';
|
|
7
8
|
export type EditViewProps = {
|
|
@@ -44,6 +45,7 @@ export type DocumentTabServerPropsOnly = {
|
|
|
44
45
|
readonly collectionConfig?: SanitizedCollectionConfig;
|
|
45
46
|
readonly globalConfig?: SanitizedGlobalConfig;
|
|
46
47
|
readonly permissions: SanitizedPermissions;
|
|
48
|
+
readonly req: PayloadRequest;
|
|
47
49
|
} & ServerProps;
|
|
48
50
|
export type DocumentTabClientProps = {
|
|
49
51
|
path: string;
|
|
@@ -51,9 +53,13 @@ export type DocumentTabClientProps = {
|
|
|
51
53
|
export type DocumentTabServerProps = DocumentTabClientProps & DocumentTabServerPropsOnly;
|
|
52
54
|
export type DocumentTabCondition = (args: {
|
|
53
55
|
collectionConfig: SanitizedCollectionConfig;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated: Use `req.payload.config` instead. This will be removed in v4.
|
|
58
|
+
*/
|
|
54
59
|
config: SanitizedConfig;
|
|
55
60
|
globalConfig: SanitizedGlobalConfig;
|
|
56
61
|
permissions: SanitizedPermissions;
|
|
62
|
+
req: PayloadRequest;
|
|
57
63
|
}) => boolean;
|
|
58
64
|
export type DocumentTabConfig = {
|
|
59
65
|
readonly Component?: DocumentTabComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/admin/views/document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,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AE,eAAe,CAAC,QAAQ,CAAC,CAAA;KAClC,KAAK,MAAM,CAAC,GACb,MAAM,CAAA;IACV,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,GAAG,OAAO,CAAA;IACnE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;IAC5E,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAA;CACjC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;IAClD,IAAI,EAAE,MAAM,CAAA;CACb,CAAC,CAAA;AAIF,MAAM,MAAM,iCAAiC,GAAG,EAAE,CAAA;AAClD,MAAM,MAAM,qCAAqC,GAAG,EAAE,GAAG,WAAW,CAAA;AACpE,MAAM,MAAM,iCAAiC,GAAG,iCAAiC,GAC/E,qCAAqC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/views/document.ts"],"sourcesContent":["import type { SanitizedPermissions } from '../../auth/types.js'\nimport type { SanitizedCollectionConfig } from '../../collections/config/types.js'\nimport type { PayloadComponent, SanitizedConfig, ServerProps } from '../../config/types.js'\nimport type { SanitizedGlobalConfig } from '../../globals/config/types.js'\nimport type { Data, DocumentSlots, FormState } from '../types.js'\nimport type { InitPageResult, ViewTypes } from './index.js'\n\nexport type EditViewProps = {\n readonly collectionSlug?: string\n readonly globalSlug?: string\n}\n/**\n * Properties specific to the versions view\n */\nexport type RenderDocumentVersionsProperties = {\n /**\n * @default false\n */\n disableGutter?: boolean\n /**\n * Use createdAt cell that appends params to the url on version selection instead of redirecting user\n * @default false\n */\n useVersionDrawerCreatedAtCell?: boolean\n}\n\nexport type DocumentViewServerPropsOnly = {\n doc: Data\n hasPublishedDoc: boolean\n initPageResult: InitPageResult\n routeSegments: string[]\n versions?: RenderDocumentVersionsProperties\n} & ServerProps\n\nexport type DocumentViewServerProps = DocumentViewClientProps & DocumentViewServerPropsOnly\n\nexport type DocumentViewClientProps = {\n documentSubViewType: DocumentSubViewTypes\n formState: FormState\n viewType: ViewTypes\n} & DocumentSlots\n\n/**\n * @todo: This should be renamed to `DocumentSubViewType` (singular)\n */\nexport type DocumentSubViewTypes = 'api' | 'default' | 'version' | 'versions'\n\nexport type DocumentTabServerPropsOnly = {\n readonly apiURL?: string\n readonly collectionConfig?: SanitizedCollectionConfig\n readonly globalConfig?: SanitizedGlobalConfig\n readonly permissions: SanitizedPermissions\n} & ServerProps\n\nexport type DocumentTabClientProps = {\n path: string\n}\n\nexport type DocumentTabServerProps = DocumentTabClientProps & DocumentTabServerPropsOnly\n\nexport type DocumentTabCondition = (args: {\n collectionConfig: SanitizedCollectionConfig\n config: SanitizedConfig\n globalConfig: SanitizedGlobalConfig\n permissions: SanitizedPermissions\n}) => boolean\n\n// Everything is optional because we merge in the defaults\n// i.e. the config may override the `Default` view with a `label` but not an `href`\nexport type DocumentTabConfig = {\n readonly Component?: DocumentTabComponent\n readonly condition?: DocumentTabCondition\n readonly href?:\n | ((args: {\n apiURL: string\n collection: SanitizedCollectionConfig\n global: SanitizedGlobalConfig\n id?: string\n routes: SanitizedConfig['routes']\n }) => string)\n | string\n readonly isActive?: ((args: { href: string }) => boolean) | boolean\n readonly label?: ((args: { t: (key: string) => string }) => string) | string\n readonly newTab?: boolean\n /**\n * Sets the order to render the tab in the admin panel\n * Recommended to use increments of 100 (e.g. 0, 100, 200)\n */\n readonly order?: number\n readonly Pill?: PayloadComponent\n}\n\n/**\n * @todo: Remove this type as it's only used internally for the config (above)\n */\nexport type DocumentTabComponent = PayloadComponent<{\n path: string\n}>\n\n// BeforeDocumentControls\n\nexport type BeforeDocumentControlsClientProps = {}\nexport type BeforeDocumentControlsServerPropsOnly = {} & ServerProps\nexport type BeforeDocumentControlsServerProps = BeforeDocumentControlsClientProps &\n BeforeDocumentControlsServerPropsOnly\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/views/document.ts"],"sourcesContent":["import type { SanitizedPermissions } from '../../auth/types.js'\nimport type { SanitizedCollectionConfig } from '../../collections/config/types.js'\nimport type { PayloadComponent, SanitizedConfig, ServerProps } from '../../config/types.js'\nimport type { SanitizedGlobalConfig } from '../../globals/config/types.js'\nimport type { PayloadRequest } from '../../types/index.js'\nimport type { Data, DocumentSlots, FormState } from '../types.js'\nimport type { InitPageResult, ViewTypes } from './index.js'\n\nexport type EditViewProps = {\n readonly collectionSlug?: string\n readonly globalSlug?: string\n}\n/**\n * Properties specific to the versions view\n */\nexport type RenderDocumentVersionsProperties = {\n /**\n * @default false\n */\n disableGutter?: boolean\n /**\n * Use createdAt cell that appends params to the url on version selection instead of redirecting user\n * @default false\n */\n useVersionDrawerCreatedAtCell?: boolean\n}\n\nexport type DocumentViewServerPropsOnly = {\n doc: Data\n hasPublishedDoc: boolean\n initPageResult: InitPageResult\n routeSegments: string[]\n versions?: RenderDocumentVersionsProperties\n} & ServerProps\n\nexport type DocumentViewServerProps = DocumentViewClientProps & DocumentViewServerPropsOnly\n\nexport type DocumentViewClientProps = {\n documentSubViewType: DocumentSubViewTypes\n formState: FormState\n viewType: ViewTypes\n} & DocumentSlots\n\n/**\n * @todo: This should be renamed to `DocumentSubViewType` (singular)\n */\nexport type DocumentSubViewTypes = 'api' | 'default' | 'version' | 'versions'\n\nexport type DocumentTabServerPropsOnly = {\n readonly apiURL?: string\n readonly collectionConfig?: SanitizedCollectionConfig\n readonly globalConfig?: SanitizedGlobalConfig\n readonly permissions: SanitizedPermissions\n readonly req: PayloadRequest\n} & ServerProps\n\nexport type DocumentTabClientProps = {\n path: string\n}\n\nexport type DocumentTabServerProps = DocumentTabClientProps & DocumentTabServerPropsOnly\n\nexport type DocumentTabCondition = (args: {\n collectionConfig: SanitizedCollectionConfig\n /**\n * @deprecated: Use `req.payload.config` instead. This will be removed in v4.\n */\n config: SanitizedConfig\n globalConfig: SanitizedGlobalConfig\n permissions: SanitizedPermissions\n req: PayloadRequest\n}) => boolean\n\n// Everything is optional because we merge in the defaults\n// i.e. the config may override the `Default` view with a `label` but not an `href`\nexport type DocumentTabConfig = {\n readonly Component?: DocumentTabComponent\n readonly condition?: DocumentTabCondition\n readonly href?:\n | ((args: {\n apiURL: string\n collection: SanitizedCollectionConfig\n global: SanitizedGlobalConfig\n id?: string\n routes: SanitizedConfig['routes']\n }) => string)\n | string\n readonly isActive?: ((args: { href: string }) => boolean) | boolean\n readonly label?: ((args: { t: (key: string) => string }) => string) | string\n readonly newTab?: boolean\n /**\n * Sets the order to render the tab in the admin panel\n * Recommended to use increments of 100 (e.g. 0, 100, 200)\n */\n readonly order?: number\n readonly Pill?: PayloadComponent\n}\n\n/**\n * @todo: Remove this type as it's only used internally for the config (above)\n */\nexport type DocumentTabComponent = PayloadComponent<{\n path: string\n}>\n\n// BeforeDocumentControls\n\nexport type BeforeDocumentControlsClientProps = {}\nexport type BeforeDocumentControlsServerPropsOnly = {} & ServerProps\nexport type BeforeDocumentControlsServerProps = BeforeDocumentControlsClientProps &\n BeforeDocumentControlsServerPropsOnly\n"],"names":[],"mappings":"AA6GA,WACuC"}
|
|
@@ -44,6 +44,7 @@ export type AdminViewServerPropsOnly = {
|
|
|
44
44
|
readonly redirectAfterCreate?: boolean;
|
|
45
45
|
readonly redirectAfterDelete?: boolean;
|
|
46
46
|
readonly redirectAfterDuplicate?: boolean;
|
|
47
|
+
readonly redirectAfterRestore?: boolean;
|
|
47
48
|
} & ServerProps;
|
|
48
49
|
export type AdminViewServerProps = AdminViewClientProps & AdminViewServerPropsOnly;
|
|
49
50
|
/**
|
|
@@ -70,7 +71,7 @@ export type InitPageResult = {
|
|
|
70
71
|
/**
|
|
71
72
|
* @todo This should be renamed to `ViewType` (singular)
|
|
72
73
|
*/
|
|
73
|
-
export type ViewTypes = 'account' | 'collection-folders' | 'dashboard' | 'document' | 'folders' | 'list' | 'reset' | 'verify' | 'version';
|
|
74
|
+
export type ViewTypes = 'account' | 'collection-folders' | 'dashboard' | 'document' | 'folders' | 'list' | 'reset' | 'trash' | 'verify' | 'version';
|
|
74
75
|
export type ServerPropsFromView = {
|
|
75
76
|
collectionConfig?: SanitizedConfig['collections'][number];
|
|
76
77
|
globalConfig?: SanitizedConfig['globals'][number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/admin/views/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAA;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAClF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EACV,eAAe,EACf,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EACZ,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAEzD,MA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M,GAAG,MAAM,CAAA;IACvB,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,eAAe,EAAE,eAAe,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,oBAAoB,CAAA;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,cAAc,CAAA;IACnB,YAAY,EAAE,wBAAwB,CAAA;IACtC,eAAe,EAAE,eAAe,CAAA;CACjC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,oBAAoB,GACpB,WAAW,GACX,UAAU,GACV,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,SAAS,CAAA;AAEb,MAAM,MAAM,mBAAmB,GAAG;IAChC,gBAAgB,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA;IACzD,YAAY,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAA;IACjD,WAAW,EAAE,eAAe,EAAE,CAAA;CAC/B,CAAA;AAGD,MAAM,MAAM,0BAA0B,GAAG;IACvC,cAAc,CAAC,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAA;IAClD,WAAW,EAAE,iBAAiB,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,EAAE,GAAG,WAAW,CAAA;AAE7D,MAAM,MAAM,0BAA0B,GAAG,0BAA0B,GAAG,8BAA8B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/views/index.ts"],"sourcesContent":["import type { ClientTranslationsObject } from '@payloadcms/translations'\n\nimport type { SanitizedPermissions } from '../../auth/index.js'\nimport type { ImportMap } from '../../bin/generateImportMap/index.js'\nimport type { SanitizedCollectionConfig } from '../../collections/config/types.js'\nimport type { ClientConfig } from '../../config/client.js'\nimport type {\n CustomComponent,\n Locale,\n MetaConfig,\n PayloadComponent,\n SanitizedConfig,\n ServerProps,\n} from '../../config/types.js'\nimport type { SanitizedGlobalConfig } from '../../globals/config/types.js'\nimport type { PayloadRequest } from '../../types/index.js'\nimport type { LanguageOptions } from '../LanguageOptions.js'\nimport type { Data, StaticDescription } from '../types.js'\nimport type { DocumentSubViewTypes } from './document.js'\n\nexport type AdminViewConfig = {\n Component: PayloadComponent\n /** Whether the path should be matched exactly or as a prefix */\n exact?: boolean\n meta?: MetaConfig\n /**\n * Any valid URL path or array of paths that [`path-to-regexp`](https://www.npmjs.com/package/path-to-regex) understands. Must begin with a forward slash (`/`).\n */\n path?: `/${string}`\n sensitive?: boolean\n strict?: boolean\n}\n\nexport type AdminViewClientProps = {\n browseByFolderSlugs?: SanitizedCollectionConfig['slug'][]\n clientConfig: ClientConfig\n documentSubViewType?: DocumentSubViewTypes\n viewType: ViewTypes\n}\n\nexport type AdminViewServerPropsOnly = {\n readonly clientConfig: ClientConfig\n readonly disableActions?: boolean\n /**\n * @todo remove `docID` here as it is already contained in `initPageResult`\n */\n readonly docID?: number | string\n readonly folderID?: number | string\n readonly importMap: ImportMap\n readonly initialData?: Data\n readonly initPageResult: InitPageResult\n readonly params?: { [key: string]: string | string[] | undefined }\n readonly redirectAfterCreate?: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n} & ServerProps\n\nexport type AdminViewServerProps = AdminViewClientProps & AdminViewServerPropsOnly\n\n/**\n * @deprecated This should be removed in favor of direct props\n */\nexport type AdminViewComponent = PayloadComponent<AdminViewServerProps>\n\nexport type VisibleEntities = {\n collections: SanitizedCollectionConfig['slug'][]\n globals: SanitizedGlobalConfig['slug'][]\n}\n\nexport type InitPageResult = {\n collectionConfig?: SanitizedCollectionConfig\n cookies: Map<string, string>\n docID?: number | string\n globalConfig?: SanitizedGlobalConfig\n languageOptions: LanguageOptions\n locale?: Locale\n permissions: SanitizedPermissions\n redirectTo?: string\n req: PayloadRequest\n translations: ClientTranslationsObject\n visibleEntities: VisibleEntities\n}\n\n/**\n * @todo This should be renamed to `ViewType` (singular)\n */\nexport type ViewTypes =\n | 'account'\n | 'collection-folders'\n | 'dashboard'\n | 'document'\n | 'folders'\n | 'list'\n | 'reset'\n | 'verify'\n | 'version'\n\nexport type ServerPropsFromView = {\n collectionConfig?: SanitizedConfig['collections'][number]\n globalConfig?: SanitizedConfig['globals'][number]\n viewActions: CustomComponent[]\n}\n\n// Description\nexport type ViewDescriptionClientProps = {\n collectionSlug?: SanitizedCollectionConfig['slug']\n description: StaticDescription\n}\n\nexport type ViewDescriptionServerPropsOnly = {} & ServerProps\n\nexport type ViewDescriptionServerProps = ViewDescriptionClientProps & ViewDescriptionServerPropsOnly\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/views/index.ts"],"sourcesContent":["import type { ClientTranslationsObject } from '@payloadcms/translations'\n\nimport type { SanitizedPermissions } from '../../auth/index.js'\nimport type { ImportMap } from '../../bin/generateImportMap/index.js'\nimport type { SanitizedCollectionConfig } from '../../collections/config/types.js'\nimport type { ClientConfig } from '../../config/client.js'\nimport type {\n CustomComponent,\n Locale,\n MetaConfig,\n PayloadComponent,\n SanitizedConfig,\n ServerProps,\n} from '../../config/types.js'\nimport type { SanitizedGlobalConfig } from '../../globals/config/types.js'\nimport type { PayloadRequest } from '../../types/index.js'\nimport type { LanguageOptions } from '../LanguageOptions.js'\nimport type { Data, StaticDescription } from '../types.js'\nimport type { DocumentSubViewTypes } from './document.js'\n\nexport type AdminViewConfig = {\n Component: PayloadComponent\n /** Whether the path should be matched exactly or as a prefix */\n exact?: boolean\n meta?: MetaConfig\n /**\n * Any valid URL path or array of paths that [`path-to-regexp`](https://www.npmjs.com/package/path-to-regex) understands. Must begin with a forward slash (`/`).\n */\n path?: `/${string}`\n sensitive?: boolean\n strict?: boolean\n}\n\nexport type AdminViewClientProps = {\n browseByFolderSlugs?: SanitizedCollectionConfig['slug'][]\n clientConfig: ClientConfig\n documentSubViewType?: DocumentSubViewTypes\n viewType: ViewTypes\n}\n\nexport type AdminViewServerPropsOnly = {\n readonly clientConfig: ClientConfig\n readonly disableActions?: boolean\n /**\n * @todo remove `docID` here as it is already contained in `initPageResult`\n */\n readonly docID?: number | string\n readonly folderID?: number | string\n readonly importMap: ImportMap\n readonly initialData?: Data\n readonly initPageResult: InitPageResult\n readonly params?: { [key: string]: string | string[] | undefined }\n readonly redirectAfterCreate?: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n readonly redirectAfterRestore?: boolean\n} & ServerProps\n\nexport type AdminViewServerProps = AdminViewClientProps & AdminViewServerPropsOnly\n\n/**\n * @deprecated This should be removed in favor of direct props\n */\nexport type AdminViewComponent = PayloadComponent<AdminViewServerProps>\n\nexport type VisibleEntities = {\n collections: SanitizedCollectionConfig['slug'][]\n globals: SanitizedGlobalConfig['slug'][]\n}\n\nexport type InitPageResult = {\n collectionConfig?: SanitizedCollectionConfig\n cookies: Map<string, string>\n docID?: number | string\n globalConfig?: SanitizedGlobalConfig\n languageOptions: LanguageOptions\n locale?: Locale\n permissions: SanitizedPermissions\n redirectTo?: string\n req: PayloadRequest\n translations: ClientTranslationsObject\n visibleEntities: VisibleEntities\n}\n\n/**\n * @todo This should be renamed to `ViewType` (singular)\n */\nexport type ViewTypes =\n | 'account'\n | 'collection-folders'\n | 'dashboard'\n | 'document'\n | 'folders'\n | 'list'\n | 'reset'\n | 'trash'\n | 'verify'\n | 'version'\n\nexport type ServerPropsFromView = {\n collectionConfig?: SanitizedConfig['collections'][number]\n globalConfig?: SanitizedConfig['globals'][number]\n viewActions: CustomComponent[]\n}\n\n// Description\nexport type ViewDescriptionClientProps = {\n collectionSlug?: SanitizedCollectionConfig['slug']\n description: StaticDescription\n}\n\nexport type ViewDescriptionServerPropsOnly = {} & ServerProps\n\nexport type ViewDescriptionServerProps = ViewDescriptionClientProps & ViewDescriptionServerPropsOnly\n"],"names":[],"mappings":"AAiHA,WAAoG"}
|
|
@@ -5,7 +5,7 @@ import type { CollectionPreferences } from '../../preferences/types.js';
|
|
|
5
5
|
import type { QueryPreset } from '../../query-presets/types.js';
|
|
6
6
|
import type { ResolvedFilterOptions } from '../../types/index.js';
|
|
7
7
|
import type { Column } from '../elements/Table.js';
|
|
8
|
-
import type { Data } from '../types.js';
|
|
8
|
+
import type { Data, ViewTypes } from '../types.js';
|
|
9
9
|
export type ListViewSlots = {
|
|
10
10
|
AfterList?: React.ReactNode;
|
|
11
11
|
AfterListTable?: React.ReactNode;
|
|
@@ -38,6 +38,7 @@ export type ListViewClientProps = {
|
|
|
38
38
|
disableQueryPresets?: boolean;
|
|
39
39
|
enableRowSelections?: boolean;
|
|
40
40
|
hasCreatePermission: boolean;
|
|
41
|
+
hasDeletePermission?: boolean;
|
|
41
42
|
/**
|
|
42
43
|
* @deprecated
|
|
43
44
|
*/
|
|
@@ -51,10 +52,12 @@ export type ListViewClientProps = {
|
|
|
51
52
|
queryPresetPermissions?: SanitizedCollectionPermission;
|
|
52
53
|
renderedFilters?: Map<string, React.ReactNode>;
|
|
53
54
|
resolvedFilterOptions?: Map<string, ResolvedFilterOptions>;
|
|
55
|
+
viewType: ViewTypes;
|
|
54
56
|
} & ListViewSlots;
|
|
55
57
|
export type ListViewSlotSharedClientProps = {
|
|
56
58
|
collectionSlug: SanitizedCollectionConfig['slug'];
|
|
57
59
|
hasCreatePermission: boolean;
|
|
60
|
+
hasDeletePermission?: boolean;
|
|
58
61
|
newDocumentURL: string;
|
|
59
62
|
};
|
|
60
63
|
export type BeforeListClientProps = ListViewSlotSharedClientProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/admin/views/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,KAAK,EACV,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EA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C,cAAc,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAA;IACjD,mBAAmB,EAAE,OAAO,CAAA;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAGD,MAAM,MAAM,qBAAqB,GAAG,6BAA6B,CAAA;AACjE,MAAM,MAAM,yBAAyB,GAAG,EAAE,GAAG,uBAAuB,CAAA;AACpE,MAAM,MAAM,qBAAqB,GAAG,qBAAqB,GAAG,yBAAyB,CAAA;AAGrF,MAAM,MAAM,0BAA0B,GAAG,6BAA6B,CAAA;AACtE,MAAM,MAAM,8BAA8B,GAAG,EAAE,GAAG,uBAAuB,CAAA;AACzE,MAAM,MAAM,0BAA0B,GAAG,0BAA0B,GAAG,8BAA8B,CAAA;AAGpG,MAAM,MAAM,oBAAoB,GAAG,6BAA6B,CAAA;AAChE,MAAM,MAAM,wBAAwB,GAAG,EAAE,GAAG,uBAAuB,CAAA;AACnE,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GAAG,wBAAwB,CAAA;AAGlF,MAAM,MAAM,yBAAyB,GAAG,6BAA6B,CAAA;AACrE,MAAM,MAAM,6BAA6B,GAAG,EAAE,GAAG,uBAAuB,CAAA;AACxE,MAAM,MAAM,yBAAyB,GAAG,yBAAyB,GAAG,6BAA6B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/views/list.ts"],"sourcesContent":["import type { SanitizedCollectionPermission } from '../../auth/types.js'\nimport type {\n CollectionAdminOptions,\n SanitizedCollectionConfig,\n} from '../../collections/config/types.js'\nimport type { ServerProps } from '../../config/types.js'\nimport type { CollectionPreferences } from '../../preferences/types.js'\nimport type { QueryPreset } from '../../query-presets/types.js'\nimport type { ResolvedFilterOptions } from '../../types/index.js'\nimport type { Column } from '../elements/Table.js'\nimport type { Data } from '../types.js'\n\nexport type ListViewSlots = {\n AfterList?: React.ReactNode\n AfterListTable?: React.ReactNode\n BeforeList?: React.ReactNode\n BeforeListTable?: React.ReactNode\n Description?: React.ReactNode\n listMenuItems?: React.ReactNode[]\n Table: React.ReactNode | React.ReactNode[]\n}\n\n/**\n * The `ListViewServerPropsOnly` approach is needed to ensure type strictness when injecting component props\n * There is no way to do something like `Omit<ListViewServerProps, keyof ListViewClientProps>`\n * This is because `ListViewClientProps` is a union which is impossible to exclude from\n * Exporting explicitly defined `ListViewServerPropsOnly`, etc. allows for the strictest typing\n */\nexport type ListViewServerPropsOnly = {\n collectionConfig: SanitizedCollectionConfig\n data: Data\n limit: number\n listPreferences: CollectionPreferences\n listSearchableFields: CollectionAdminOptions['listSearchableFields']\n} & ServerProps\n\nexport type ListViewServerProps = ListViewClientProps & ListViewServerPropsOnly\n\nexport type ListViewClientProps = {\n beforeActions?: React.ReactNode[]\n collectionSlug: SanitizedCollectionConfig['slug']\n columnState: Column[]\n disableBulkDelete?: boolean\n disableBulkEdit?: boolean\n disableQueryPresets?: boolean\n enableRowSelections?: boolean\n hasCreatePermission: boolean\n /**\n * @deprecated\n */\n listPreferences?: CollectionPreferences\n newDocumentURL: string\n /**\n * @deprecated\n */\n preferenceKey?: string\n queryPreset?: QueryPreset\n queryPresetPermissions?: SanitizedCollectionPermission\n renderedFilters?: Map<string, React.ReactNode>\n resolvedFilterOptions?: Map<string, ResolvedFilterOptions>\n} & ListViewSlots\n\nexport type ListViewSlotSharedClientProps = {\n collectionSlug: SanitizedCollectionConfig['slug']\n hasCreatePermission: boolean\n newDocumentURL: string\n}\n\n// BeforeList\nexport type BeforeListClientProps = ListViewSlotSharedClientProps\nexport type BeforeListServerPropsOnly = {} & ListViewServerPropsOnly\nexport type BeforeListServerProps = BeforeListClientProps & BeforeListServerPropsOnly\n\n// BeforeListTable\nexport type BeforeListTableClientProps = ListViewSlotSharedClientProps\nexport type BeforeListTableServerPropsOnly = {} & ListViewServerPropsOnly\nexport type BeforeListTableServerProps = BeforeListTableClientProps & BeforeListTableServerPropsOnly\n\n// AfterList\nexport type AfterListClientProps = ListViewSlotSharedClientProps\nexport type AfterListServerPropsOnly = {} & ListViewServerPropsOnly\nexport type AfterListServerProps = AfterListClientProps & AfterListServerPropsOnly\n\n// AfterListTable\nexport type AfterListTableClientProps = ListViewSlotSharedClientProps\nexport type AfterListTableServerPropsOnly = {} & ListViewServerPropsOnly\nexport type AfterListTableServerProps = AfterListTableClientProps & AfterListTableServerPropsOnly\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/views/list.ts"],"sourcesContent":["import type { SanitizedCollectionPermission } from '../../auth/types.js'\nimport type {\n CollectionAdminOptions,\n SanitizedCollectionConfig,\n} from '../../collections/config/types.js'\nimport type { ServerProps } from '../../config/types.js'\nimport type { CollectionPreferences } from '../../preferences/types.js'\nimport type { QueryPreset } from '../../query-presets/types.js'\nimport type { ResolvedFilterOptions } from '../../types/index.js'\nimport type { Column } from '../elements/Table.js'\nimport type { Data, ViewTypes } from '../types.js'\n\nexport type ListViewSlots = {\n AfterList?: React.ReactNode\n AfterListTable?: React.ReactNode\n BeforeList?: React.ReactNode\n BeforeListTable?: React.ReactNode\n Description?: React.ReactNode\n listMenuItems?: React.ReactNode[]\n Table: React.ReactNode | React.ReactNode[]\n}\n\n/**\n * The `ListViewServerPropsOnly` approach is needed to ensure type strictness when injecting component props\n * There is no way to do something like `Omit<ListViewServerProps, keyof ListViewClientProps>`\n * This is because `ListViewClientProps` is a union which is impossible to exclude from\n * Exporting explicitly defined `ListViewServerPropsOnly`, etc. allows for the strictest typing\n */\nexport type ListViewServerPropsOnly = {\n collectionConfig: SanitizedCollectionConfig\n data: Data\n limit: number\n listPreferences: CollectionPreferences\n listSearchableFields: CollectionAdminOptions['listSearchableFields']\n} & ServerProps\n\nexport type ListViewServerProps = ListViewClientProps & ListViewServerPropsOnly\n\nexport type ListViewClientProps = {\n beforeActions?: React.ReactNode[]\n collectionSlug: SanitizedCollectionConfig['slug']\n columnState: Column[]\n disableBulkDelete?: boolean\n disableBulkEdit?: boolean\n disableQueryPresets?: boolean\n enableRowSelections?: boolean\n hasCreatePermission: boolean\n hasDeletePermission?: boolean\n /**\n * @deprecated\n */\n listPreferences?: CollectionPreferences\n newDocumentURL: string\n /**\n * @deprecated\n */\n preferenceKey?: string\n queryPreset?: QueryPreset\n queryPresetPermissions?: SanitizedCollectionPermission\n renderedFilters?: Map<string, React.ReactNode>\n resolvedFilterOptions?: Map<string, ResolvedFilterOptions>\n viewType: ViewTypes\n} & ListViewSlots\n\nexport type ListViewSlotSharedClientProps = {\n collectionSlug: SanitizedCollectionConfig['slug']\n hasCreatePermission: boolean\n hasDeletePermission?: boolean\n newDocumentURL: string\n}\n\n// BeforeList\nexport type BeforeListClientProps = ListViewSlotSharedClientProps\nexport type BeforeListServerPropsOnly = {} & ListViewServerPropsOnly\nexport type BeforeListServerProps = BeforeListClientProps & BeforeListServerPropsOnly\n\n// BeforeListTable\nexport type BeforeListTableClientProps = ListViewSlotSharedClientProps\nexport type BeforeListTableServerPropsOnly = {} & ListViewServerPropsOnly\nexport type BeforeListTableServerProps = BeforeListTableClientProps & BeforeListTableServerPropsOnly\n\n// AfterList\nexport type AfterListClientProps = ListViewSlotSharedClientProps\nexport type AfterListServerPropsOnly = {} & ListViewServerPropsOnly\nexport type AfterListServerProps = AfterListClientProps & AfterListServerPropsOnly\n\n// AfterListTable\nexport type AfterListTableClientProps = ListViewSlotSharedClientProps\nexport type AfterListTableServerPropsOnly = {} & ListViewServerPropsOnly\nexport type AfterListTableServerProps = AfterListTableClientProps & AfterListTableServerPropsOnly\n"],"names":[],"mappings":"AAyFA,WAAiG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const isUserLocked: (date:
|
|
1
|
+
export declare const isUserLocked: (date: Date) => boolean;
|
|
2
2
|
//# sourceMappingURL=isUserLocked.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUserLocked.d.ts","sourceRoot":"","sources":["../../src/auth/isUserLocked.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,SAAU,
|
|
1
|
+
{"version":3,"file":"isUserLocked.d.ts","sourceRoot":"","sources":["../../src/auth/isUserLocked.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,SAAU,IAAI,KAAG,OAKzC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/auth/isUserLocked.ts"],"sourcesContent":["export const isUserLocked = (date:
|
|
1
|
+
{"version":3,"sources":["../../src/auth/isUserLocked.ts"],"sourcesContent":["export const isUserLocked = (date: Date): boolean => {\n if (!date) {\n return false\n }\n return date.getTime() > Date.now()\n}\n"],"names":["isUserLocked","date","getTime","Date","now"],"mappings":"AAAA,OAAO,MAAMA,eAAe,CAACC;IAC3B,IAAI,CAACA,MAAM;QACT,OAAO;IACT;IACA,OAAOA,KAAKC,OAAO,KAAKC,KAAKC,GAAG;AAClC,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgotPassword.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/forgotPassword.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,gCAAgC,EAChC,UAAU,EACX,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"forgotPassword.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/forgotPassword.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,gCAAgC,EAChC,UAAU,EACX,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,sBAAsB,CAAA;AAYjE,MAAM,MAAM,SAAS,CAAC,KAAK,SAAS,cAAc,IAAI;IACpD,UAAU,EAAE,UAAU,CAAA;IACtB,IAAI,EAAE;QACJ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,GAAG,gCAAgC,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,CAAA;IAC7D,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAE3B,eAAO,MAAM,uBAAuB,GAAU,KAAK,SAAS,cAAc,gBAC1D,SAAS,CAAC,KAAK,CAAC,KAC7B,OAAO,CAAC,IAAI,GAAG,MAAM,CAqMvB,CAAA"}
|
|
@@ -4,6 +4,7 @@ import { URL } from 'url';
|
|
|
4
4
|
import { buildAfterOperation } from '../../collections/operations/utils.js';
|
|
5
5
|
import { APIError } from '../../errors/index.js';
|
|
6
6
|
import { Forbidden } from '../../index.js';
|
|
7
|
+
import { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js';
|
|
7
8
|
import { commitTransaction } from '../../utilities/commitTransaction.js';
|
|
8
9
|
import { formatAdminURL } from '../../utilities/formatAdminURL.js';
|
|
9
10
|
import { initTransaction } from '../../utilities/initTransaction.js';
|
|
@@ -60,6 +61,12 @@ export const forgotPasswordOperation = async (incomingArgs)=>{
|
|
|
60
61
|
}
|
|
61
62
|
};
|
|
62
63
|
}
|
|
64
|
+
// Exclude trashed users unless `trash: true`
|
|
65
|
+
whereConstraint = appendNonTrashedFilter({
|
|
66
|
+
enableTrash: collectionConfig.trash,
|
|
67
|
+
trash: false,
|
|
68
|
+
where: whereConstraint
|
|
69
|
+
});
|
|
63
70
|
let user = await payload.db.findOne({
|
|
64
71
|
collection: collectionConfig.slug,
|
|
65
72
|
req,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/auth/operations/forgotPassword.ts"],"sourcesContent":["import crypto from 'crypto'\nimport { status as httpStatus } from 'http-status'\nimport { URL } from 'url'\n\nimport type {\n AuthOperationsFromCollectionSlug,\n Collection,\n} from '../../collections/config/types.js'\nimport type { CollectionSlug } from '../../index.js'\nimport type { PayloadRequest, Where } from '../../types/index.js'\n\nimport { buildAfterOperation } from '../../collections/operations/utils.js'\nimport { APIError } from '../../errors/index.js'\nimport { Forbidden } from '../../index.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { formatAdminURL } from '../../utilities/formatAdminURL.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { getLoginOptions } from '../getLoginOptions.js'\n\nexport type Arguments<TSlug extends CollectionSlug> = {\n collection: Collection\n data: {\n [key: string]: unknown\n } & AuthOperationsFromCollectionSlug<TSlug>['forgotPassword']\n disableEmail?: boolean\n expiration?: number\n req: PayloadRequest\n}\n\nexport type Result = string\n\nexport const forgotPasswordOperation = async <TSlug extends CollectionSlug>(\n incomingArgs: Arguments<TSlug>,\n): Promise<null | string> => {\n const loginWithUsername = incomingArgs.collection.config.auth.loginWithUsername\n const { data } = incomingArgs\n\n const { canLoginWithEmail, canLoginWithUsername } = getLoginOptions(loginWithUsername)\n\n const sanitizedEmail =\n (canLoginWithEmail && (incomingArgs.data.email || '').toLowerCase().trim()) || null\n const sanitizedUsername =\n 'username' in data && typeof data?.username === 'string'\n ? data.username.toLowerCase().trim()\n : null\n\n let args = incomingArgs\n\n if (incomingArgs.collection.config.auth.disableLocalStrategy) {\n throw new Forbidden(incomingArgs.req.t)\n }\n if (!sanitizedEmail && !sanitizedUsername) {\n throw new APIError(\n `Missing ${loginWithUsername ? 'username' : 'email'}.`,\n httpStatus.BAD_REQUEST,\n )\n }\n\n try {\n const shouldCommit = await initTransaction(args.req)\n\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n if (args.collection.config.hooks?.beforeOperation?.length) {\n for (const hook of args.collection.config.hooks.beforeOperation) {\n args =\n (await hook({\n args,\n collection: args.collection?.config,\n context: args.req.context,\n operation: 'forgotPassword',\n req: args.req,\n })) || args\n }\n }\n\n const {\n collection: { config: collectionConfig },\n disableEmail,\n expiration,\n req: {\n payload: { config, email },\n payload,\n },\n req,\n } = args\n\n // /////////////////////////////////////\n // Forget password\n // /////////////////////////////////////\n\n let token: string = crypto.randomBytes(20).toString('hex')\n type UserDoc = {\n email?: string\n id: number | string\n resetPasswordExpiration?: string\n resetPasswordToken?: string\n }\n\n if (!sanitizedEmail && !sanitizedUsername) {\n throw new APIError(\n `Missing ${loginWithUsername ? 'username' : 'email'}.`,\n httpStatus.BAD_REQUEST,\n )\n }\n\n let whereConstraint: Where = {}\n\n if (canLoginWithEmail && sanitizedEmail) {\n whereConstraint = {\n email: {\n equals: sanitizedEmail,\n },\n }\n } else if (canLoginWithUsername && sanitizedUsername) {\n whereConstraint = {\n username: {\n equals: sanitizedUsername,\n },\n }\n }\n\n let user = await payload.db.findOne<UserDoc>({\n collection: collectionConfig.slug,\n req,\n where: whereConstraint,\n })\n\n // We don't want to indicate specifically that an email was not found,\n // as doing so could lead to the exposure of registered emails.\n // Therefore, we prefer to fail silently.\n if (!user) {\n await commitTransaction(args.req)\n return null\n }\n\n const resetPasswordExpiration = new Date(\n Date.now() + (collectionConfig.auth?.forgotPassword?.expiration ?? expiration ?? 3600000),\n ).toISOString()\n\n user = await payload.update({\n id: user.id,\n collection: collectionConfig.slug,\n data: {\n resetPasswordExpiration,\n resetPasswordToken: token,\n },\n req,\n })\n\n if (!disableEmail && user.email) {\n const protocol = new URL(req.url!).protocol // includes the final :\n const serverURL =\n config.serverURL !== null && config.serverURL !== ''\n ? config.serverURL\n : `${protocol}//${req.headers.get('host')}`\n const forgotURL = formatAdminURL({\n adminRoute: config.routes.admin,\n path: `${config.admin.routes.reset}/${token}`,\n serverURL,\n })\n let html = `${req.t('authentication:youAreReceivingResetPassword')}\n <a href=\"${forgotURL}\">${forgotURL}</a>\n ${req.t('authentication:youDidNotRequestPassword')}`\n\n if (typeof collectionConfig.auth.forgotPassword?.generateEmailHTML === 'function') {\n html = await collectionConfig.auth.forgotPassword.generateEmailHTML({\n req,\n token,\n user,\n })\n }\n\n let subject = req.t('authentication:resetYourPassword')\n\n if (typeof collectionConfig.auth.forgotPassword?.generateEmailSubject === 'function') {\n subject = await collectionConfig.auth.forgotPassword.generateEmailSubject({\n req,\n token,\n user,\n })\n }\n\n await email.sendEmail({\n from: `\"${email.defaultFromName}\" <${email.defaultFromAddress}>`,\n html,\n subject,\n to: user.email,\n })\n }\n\n // /////////////////////////////////////\n // afterForgotPassword - Collection\n // /////////////////////////////////////\n\n if (collectionConfig.hooks?.afterForgotPassword?.length) {\n for (const hook of collectionConfig.hooks.afterForgotPassword) {\n await hook({ args, collection: args.collection?.config, context: req.context })\n }\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n token = await buildAfterOperation({\n args,\n collection: args.collection?.config,\n operation: 'forgotPassword',\n result: token,\n })\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return token\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["crypto","status","httpStatus","URL","buildAfterOperation","APIError","Forbidden","commitTransaction","formatAdminURL","initTransaction","killTransaction","getLoginOptions","forgotPasswordOperation","incomingArgs","loginWithUsername","collection","config","auth","data","canLoginWithEmail","canLoginWithUsername","sanitizedEmail","email","toLowerCase","trim","sanitizedUsername","username","args","disableLocalStrategy","req","t","BAD_REQUEST","shouldCommit","hooks","beforeOperation","length","hook","context","operation","collectionConfig","disableEmail","expiration","payload","token","randomBytes","toString","whereConstraint","equals","user","db","findOne","slug","where","resetPasswordExpiration","Date","now","forgotPassword","toISOString","update","id","resetPasswordToken","protocol","url","serverURL","headers","get","forgotURL","adminRoute","routes","admin","path","reset","html","generateEmailHTML","subject","generateEmailSubject","sendEmail","from","defaultFromName","defaultFromAddress","to","afterForgotPassword","result","error"],"mappings":"AAAA,OAAOA,YAAY,SAAQ;AAC3B,SAASC,U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uC,cAAc,CAACmB,oBAAoB,CAAC;oBACxE9C;oBACAc;oBACAK;gBACF;YACF;YAEA,MAAM1B,MAAMsD,SAAS,CAAC;gBACpBC,MAAM,CAAC,CAAC,EAAEvD,MAAMwD,eAAe,CAAC,GAAG,EAAExD,MAAMyD,kBAAkB,CAAC,CAAC,CAAC;gBAChEP;gBACAE;gBACAM,IAAIhC,KAAK1B,KAAK;YAChB;QACF;QAEA,wCAAwC;QACxC,mCAAmC;QACnC,wCAAwC;QAExC,IAAIiB,iBAAiBN,KAAK,EAAEgD,qBAAqB9C,QAAQ;YACvD,KAAK,MAAMC,QAAQG,iBAAiBN,KAAK,CAACgD,mBAAmB,CAAE;gBAC7D,MAAM7C,KAAK;oBAAET;oBAAMZ,YAAYY,KAAKZ,UAAU,EAAEC;oBAAQqB,SAASR,IAAIQ,OAAO;gBAAC;YAC/E;QACF;QAEA,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCM,QAAQ,MAAMvC,oBAAoB;YAChCuB;YACAZ,YAAYY,KAAKZ,UAAU,EAAEC;YAC7BsB,WAAW;YACX4C,QAAQvC;QACV;QAEA,IAAIX,cAAc;YAChB,MAAMzB,kBAAkBsB;QAC1B;QAEA,OAAOc;IACT,EAAE,OAAOwC,OAAgB;QACvB,MAAMzE,gBAAgBiB,KAAKE,GAAG;QAC9B,MAAMsD;IACR;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/auth/operations/forgotPassword.ts"],"sourcesContent":["import crypto from 'crypto'\nimport { status as httpStatus } from 'http-status'\nimport { URL } from 'url'\n\nimport type {\n AuthOperationsFromCollectionSlug,\n Collection,\n} from '../../collections/config/types.js'\nimport type { CollectionSlug } from '../../index.js'\nimport type { PayloadRequest, Where } from '../../types/index.js'\n\nimport { buildAfterOperation } from '../../collections/operations/utils.js'\nimport { APIError } from '../../errors/index.js'\nimport { Forbidden } from '../../index.js'\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { formatAdminURL } from '../../utilities/formatAdminURL.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { getLoginOptions } from '../getLoginOptions.js'\n\nexport type Arguments<TSlug extends CollectionSlug> = {\n collection: Collection\n data: {\n [key: string]: unknown\n } & AuthOperationsFromCollectionSlug<TSlug>['forgotPassword']\n disableEmail?: boolean\n expiration?: number\n req: PayloadRequest\n}\n\nexport type Result = string\n\nexport const forgotPasswordOperation = async <TSlug extends CollectionSlug>(\n incomingArgs: Arguments<TSlug>,\n): Promise<null | string> => {\n const loginWithUsername = incomingArgs.collection.config.auth.loginWithUsername\n const { data } = incomingArgs\n\n const { canLoginWithEmail, canLoginWithUsername } = getLoginOptions(loginWithUsername)\n\n const sanitizedEmail =\n (canLoginWithEmail && (incomingArgs.data.email || '').toLowerCase().trim()) || null\n const sanitizedUsername =\n 'username' in data && typeof data?.username === 'string'\n ? data.username.toLowerCase().trim()\n : null\n\n let args = incomingArgs\n\n if (incomingArgs.collection.config.auth.disableLocalStrategy) {\n throw new Forbidden(incomingArgs.req.t)\n }\n if (!sanitizedEmail && !sanitizedUsername) {\n throw new APIError(\n `Missing ${loginWithUsername ? 'username' : 'email'}.`,\n httpStatus.BAD_REQUEST,\n )\n }\n\n try {\n const shouldCommit = await initTransaction(args.req)\n\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n if (args.collection.config.hooks?.beforeOperation?.length) {\n for (const hook of args.collection.config.hooks.beforeOperation) {\n args =\n (await hook({\n args,\n collection: args.collection?.config,\n context: args.req.context,\n operation: 'forgotPassword',\n req: args.req,\n })) || args\n }\n }\n\n const {\n collection: { config: collectionConfig },\n disableEmail,\n expiration,\n req: {\n payload: { config, email },\n payload,\n },\n req,\n } = args\n\n // /////////////////////////////////////\n // Forget password\n // /////////////////////////////////////\n\n let token: string = crypto.randomBytes(20).toString('hex')\n type UserDoc = {\n email?: string\n id: number | string\n resetPasswordExpiration?: string\n resetPasswordToken?: string\n }\n\n if (!sanitizedEmail && !sanitizedUsername) {\n throw new APIError(\n `Missing ${loginWithUsername ? 'username' : 'email'}.`,\n httpStatus.BAD_REQUEST,\n )\n }\n\n let whereConstraint: Where = {}\n\n if (canLoginWithEmail && sanitizedEmail) {\n whereConstraint = {\n email: {\n equals: sanitizedEmail,\n },\n }\n } else if (canLoginWithUsername && sanitizedUsername) {\n whereConstraint = {\n username: {\n equals: sanitizedUsername,\n },\n }\n }\n\n // Exclude trashed users unless `trash: true`\n whereConstraint = appendNonTrashedFilter({\n enableTrash: collectionConfig.trash,\n trash: false,\n where: whereConstraint,\n })\n\n let user = await payload.db.findOne<UserDoc>({\n collection: collectionConfig.slug,\n req,\n where: whereConstraint,\n })\n\n // We don't want to indicate specifically that an email was not found,\n // as doing so could lead to the exposure of registered emails.\n // Therefore, we prefer to fail silently.\n if (!user) {\n await commitTransaction(args.req)\n return null\n }\n\n const resetPasswordExpiration = new Date(\n Date.now() + (collectionConfig.auth?.forgotPassword?.expiration ?? expiration ?? 3600000),\n ).toISOString()\n\n user = await payload.update({\n id: user.id,\n collection: collectionConfig.slug,\n data: {\n resetPasswordExpiration,\n resetPasswordToken: token,\n },\n req,\n })\n\n if (!disableEmail && user.email) {\n const protocol = new URL(req.url!).protocol // includes the final :\n const serverURL =\n config.serverURL !== null && config.serverURL !== ''\n ? config.serverURL\n : `${protocol}//${req.headers.get('host')}`\n const forgotURL = formatAdminURL({\n adminRoute: config.routes.admin,\n path: `${config.admin.routes.reset}/${token}`,\n serverURL,\n })\n let html = `${req.t('authentication:youAreReceivingResetPassword')}\n <a href=\"${forgotURL}\">${forgotURL}</a>\n ${req.t('authentication:youDidNotRequestPassword')}`\n\n if (typeof collectionConfig.auth.forgotPassword?.generateEmailHTML === 'function') {\n html = await collectionConfig.auth.forgotPassword.generateEmailHTML({\n req,\n token,\n user,\n })\n }\n\n let subject = req.t('authentication:resetYourPassword')\n\n if (typeof collectionConfig.auth.forgotPassword?.generateEmailSubject === 'function') {\n subject = await collectionConfig.auth.forgotPassword.generateEmailSubject({\n req,\n token,\n user,\n })\n }\n\n await email.sendEmail({\n from: `\"${email.defaultFromName}\" <${email.defaultFromAddress}>`,\n html,\n subject,\n to: user.email,\n })\n }\n\n // /////////////////////////////////////\n // afterForgotPassword - Collection\n // /////////////////////////////////////\n\n if (collectionConfig.hooks?.afterForgotPassword?.length) {\n for (const hook of collectionConfig.hooks.afterForgotPassword) {\n await hook({ args, collection: args.collection?.config, context: req.context })\n }\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n token = await buildAfterOperation({\n args,\n collection: args.collection?.config,\n operation: 'forgotPassword',\n result: token,\n })\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return token\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["crypto","status","httpStatus","URL","buildAfterOperation","APIError","Forbidden","appendNonTrashedFilter","commitTransaction","formatAdminURL","initTransaction","killTransaction","getLoginOptions","forgotPasswordOperation","incomingArgs","loginWithUsername","collection","config","auth","data","canLoginWithEmail","canLoginWithUsername","sanitizedEmail","email","toLowerCase","trim","sanitizedUsername","username","args","disableLocalStrategy","req","t","BAD_REQUEST","shouldCommit","hooks","beforeOperation","length","hook","context","operation","collectionConfig","disableEmail","expiration","payload","token","randomBytes","toString","whereConstraint","equals","enableTrash","trash","where","user","db","findOne","slug","resetPasswordExpiration","Date","now","forgotPassword","toISOString","update","id","resetPasswordToken","protocol","url","serverURL","headers","get","forgotURL","adminRoute","routes","admin","path","reset","html","generateEmailHTML","subject","generateEmailSubject","sendEmail","from","defaultFromName","defaultFromAddress","to","afterForgotPassword","result","error"],"mappings":"AAAA,OAAOA,YAAY,SAAQ;AAC3B,SAASC,UAAUC,UAAU,QAAQ,cAAa;AAClD,SAASC,GAAG,QAAQ,MAAK;AASzB,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E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AY;gBACpFD,UAAU,MAAMrC,iBAAiBtB,IAAI,CAACyC,cAAc,CAACmB,oBAAoB,CAAC;oBACxEhD;oBACAc;oBACAQ;gBACF;YACF;YAEA,MAAM7B,MAAMwD,SAAS,CAAC;gBACpBC,MAAM,CAAC,CAAC,EAAEzD,MAAM0D,eAAe,CAAC,GAAG,EAAE1D,MAAM2D,kBAAkB,CAAC,CAAC,CAAC;gBAChEP;gBACAE;gBACAM,IAAI/B,KAAK7B,KAAK;YAChB;QACF;QAEA,wCAAwC;QACxC,mCAAmC;QACnC,wCAAwC;QAExC,IAAIiB,iBAAiBN,KAAK,EAAEkD,qBAAqBhD,QAAQ;YACvD,KAAK,MAAMC,QAAQG,iBAAiBN,KAAK,CAACkD,mBAAmB,CAAE;gBAC7D,MAAM/C,KAAK;oBAAET;oBAAMZ,YAAYY,KAAKZ,UAAU,EAAEC;oBAAQqB,SAASR,IAAIQ,OAAO;gBAAC;YAC/E;QACF;QAEA,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCM,QAAQ,MAAMxC,oBAAoB;YAChCwB;YACAZ,YAAYY,KAAKZ,UAAU,EAAEC;YAC7BsB,WAAW;YACX8C,QAAQzC;QACV;QAEA,IAAIX,cAAc;YAChB,MAAMzB,kBAAkBsB;QAC1B;QAEA,OAAOc;IACT,EAAE,OAAO0C,OAAgB;QACvB,MAAM3E,gBAAgBiB,KAAKE,GAAG;QAC9B,MAAMwD;IACR;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,sBAAsB,CAAA;AAIjE,eAAO,MAAM,aAAa,SAAgB;IACxC,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC,OAAO,CAmBlB,CAAA"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js';
|
|
1
2
|
export const initOperation = async (args)=>{
|
|
2
3
|
const { collection: slug, req } = args;
|
|
4
|
+
const collectionConfig = req.payload.config.collections?.find((c)=>c.slug === slug);
|
|
5
|
+
// Exclude trashed documents unless `trash: true`
|
|
6
|
+
const where = appendNonTrashedFilter({
|
|
7
|
+
enableTrash: Boolean(collectionConfig?.trash),
|
|
8
|
+
trash: false,
|
|
9
|
+
where: {}
|
|
10
|
+
});
|
|
3
11
|
const doc = await req.payload.db.findOne({
|
|
4
12
|
collection: slug,
|
|
5
|
-
req
|
|
13
|
+
req,
|
|
14
|
+
where
|
|
6
15
|
});
|
|
7
16
|
return !!doc;
|
|
8
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/auth/operations/init.ts"],"sourcesContent":["import type { PayloadRequest } from '../../types/index.js'\n\nexport const initOperation = async (args: {\n collection: string\n req: PayloadRequest\n}): Promise<boolean> => {\n const { collection: slug, req } = args\n\n const doc = await req.payload.db.findOne({\n collection: slug,\n req,\n })\n\n return !!doc\n}\n"],"names":["initOperation","args","collection","slug","req","
|
|
1
|
+
{"version":3,"sources":["../../../src/auth/operations/init.ts"],"sourcesContent":["import type { PayloadRequest, Where } from '../../types/index.js'\n\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\n\nexport const initOperation = async (args: {\n collection: string\n req: PayloadRequest\n}): Promise<boolean> => {\n const { collection: slug, req } = args\n\n const collectionConfig = req.payload.config.collections?.find((c) => c.slug === slug)\n\n // Exclude trashed documents unless `trash: true`\n const where: Where = appendNonTrashedFilter({\n enableTrash: Boolean(collectionConfig?.trash),\n trash: false,\n where: {},\n })\n\n const doc = await req.payload.db.findOne({\n collection: slug,\n req,\n where,\n })\n\n return !!doc\n}\n"],"names":["appendNonTrashedFilter","initOperation","args","collection","slug","req","collectionConfig","payload","config","collections","find","c","where","enableTrash","Boolean","trash","doc","db","findOne"],"mappings":"AAEA,SAASA,sBAAsB,QAAQ,4CAA2C;AAElF,OAAO,MAAMC,gBAAgB,OAAOC;IAIlC,MAAM,EAAEC,YAAYC,IAAI,EAAEC,GAAG,EAAE,GAAGH;IAElC,MAAMI,mBAAmBD,IAAIE,OAAO,CAACC,MAAM,CAACC,WAAW,EAAEC,KAAK,CAACC,IAAMA,EAAEP,IAAI,KAAKA;IAEhF,iDAAiD;IACjD,MAAMQ,QAAeZ,uBAAuB;QAC1Ca,aAAaC,QAAQR,kBAAkBS;QACvCA,OAAO;QACPH,OAAO,CAAC;IACV;IAEA,MAAMI,MAAM,MAAMX,IAAIE,OAAO,CAACU,EAAE,CAACC,OAAO,CAAC;QACvCf,YAAYC;QACZC;QACAO;IACF;IAEA,OAAO,CAAC,CAACI;AACX,EAAC"}
|
|
@@ -11,6 +11,7 @@ export type Options<TSlug extends CollectionSlug> = {
|
|
|
11
11
|
overrideAccess?: boolean;
|
|
12
12
|
req?: Partial<PayloadRequest>;
|
|
13
13
|
showHiddenFields?: boolean;
|
|
14
|
+
trash?: boolean;
|
|
14
15
|
};
|
|
15
16
|
export declare function loginLocal<TSlug extends CollectionSlug>(payload: Payload, options: Options<TSlug>): Promise<{
|
|
16
17
|
user: DataFromCollectionSlug<TSlug>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/auth/operations/local/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,cAAc,EACd,sBAAsB,EACtB,OAAO,EACP,cAAc,EACf,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM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UAAU,CAAC,KAAK,SAAS,cAAc,EAC3D,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC;IAAE,IAAI,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAA;CAAE,GAAG,MAAM,CAAC,CAiC3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/auth/operations/local/login.ts"],"sourcesContent":["import type {\n AuthOperationsFromCollectionSlug,\n CollectionSlug,\n DataFromCollectionSlug,\n Payload,\n RequestContext,\n} from '../../../index.js'\nimport type { PayloadRequest } from '../../../types/index.js'\nimport type { Result } from '../login.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { loginOperation } from '../login.js'\n\nexport type Options<TSlug extends CollectionSlug> = {\n collection: TSlug\n context?: RequestContext\n data: AuthOperationsFromCollectionSlug<TSlug>['login']\n depth?: number\n fallbackLocale?: string\n locale?: string\n overrideAccess?: boolean\n req?: Partial<PayloadRequest>\n showHiddenFields?: boolean\n}\n\nexport async function loginLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<{ user: DataFromCollectionSlug<TSlug> } & Result> {\n const {\n collection: collectionSlug,\n data,\n depth,\n overrideAccess = true,\n showHiddenFields,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Login Operation.`,\n )\n }\n\n const args = {\n collection,\n data,\n depth,\n overrideAccess,\n req: await createLocalReq(options, payload),\n showHiddenFields,\n }\n\n const result = await loginOperation<TSlug>(args)\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.token\n }\n\n return result\n}\n"],"names":["APIError","createLocalReq","loginOperation","loginLocal","payload","options","collection","collectionSlug","data","depth","overrideAccess","showHiddenFields","collections","String","args","req","result","config","auth","removeTokenFromResponses","token"],"mappings":"AAUA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,cAAa;
|
|
1
|
+
{"version":3,"sources":["../../../../src/auth/operations/local/login.ts"],"sourcesContent":["import type {\n AuthOperationsFromCollectionSlug,\n CollectionSlug,\n DataFromCollectionSlug,\n Payload,\n RequestContext,\n} from '../../../index.js'\nimport type { PayloadRequest } from '../../../types/index.js'\nimport type { Result } from '../login.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { loginOperation } from '../login.js'\n\nexport type Options<TSlug extends CollectionSlug> = {\n collection: TSlug\n context?: RequestContext\n data: AuthOperationsFromCollectionSlug<TSlug>['login']\n depth?: number\n fallbackLocale?: string\n locale?: string\n overrideAccess?: boolean\n req?: Partial<PayloadRequest>\n showHiddenFields?: boolean\n trash?: boolean\n}\n\nexport async function loginLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<{ user: DataFromCollectionSlug<TSlug> } & Result> {\n const {\n collection: collectionSlug,\n data,\n depth,\n overrideAccess = true,\n showHiddenFields,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Login Operation.`,\n )\n }\n\n const args = {\n collection,\n data,\n depth,\n overrideAccess,\n req: await createLocalReq(options, payload),\n showHiddenFields,\n }\n\n const result = await loginOperation<TSlug>(args)\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.token\n }\n\n return result\n}\n"],"names":["APIError","createLocalReq","loginOperation","loginLocal","payload","options","collection","collectionSlug","data","depth","overrideAccess","showHiddenFields","collections","String","args","req","result","config","auth","removeTokenFromResponses","token"],"mappings":"AAUA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,cAAa;AAe5C,OAAO,eAAeC,WACpBC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EACJC,YAAYC,cAAc,EAC1BC,IAAI,EACJC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,gBAAgB,EACjB,GAAGN;IAEJ,MAAMC,aAAaF,QAAQQ,WAAW,CAACL,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEa,OAAON,gBAAgB,iCAAiC,CAAC;IAEzF;IAEA,MAAMO,OAAO;QACXR;QACAE;QACAC;QACAC;QACAK,KAAK,MAAMd,eAAeI,SAASD;QACnCO;IACF;IAEA,MAAMK,SAAS,MAAMd,eAAsBY;IAE3C,IAAIR,WAAWW,MAAM,CAACC,IAAI,CAACC,wBAAwB,EAAE;QACnD,OAAOH,OAAOI,KAAK;IACrB;IAEA,OAAOJ;AACT"}
|
|
@@ -19,6 +19,11 @@ type CheckLoginPermissionArgs = {
|
|
|
19
19
|
req: PayloadRequest;
|
|
20
20
|
user: any;
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Throws an error if the user is locked or does not exist.
|
|
24
|
+
* This does not check the login attempts, only the lock status. Whoever increments login attempts
|
|
25
|
+
* is responsible for locking the user properly, not whoever checks the login permission.
|
|
26
|
+
*/
|
|
22
27
|
export declare const checkLoginPermission: ({ loggingInWithUsername, req, user, }: CheckLoginPermissionArgs) => void;
|
|
23
28
|
export declare const loginOperation: <TSlug extends CollectionSlug>(incomingArgs: Arguments<TSlug>) => Promise<{
|
|
24
29
|
user: DataFromCollectionSlug<TSlug>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/login.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gCAAgC,EAChC,UAAU,EACV,sBAAsB,EACvB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,KAAK,EAA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