payload 3.49.0-canary.7 → 3.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/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/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/functions/index.d.ts +6 -0
- package/dist/admin/functions/index.d.ts.map +1 -1
- package/dist/admin/functions/index.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 +5 -2
- package/dist/admin/views/list.d.ts.map +1 -1
- package/dist/admin/views/list.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.map +1 -1
- package/dist/auth/operations/login.js +7 -0
- 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/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/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 +22 -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/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/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/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/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/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/preferences/types.d.ts +1 -0
- package/dist/preferences/types.d.ts.map +1 -1
- package/dist/preferences/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/dist/utilities/transformColumnPreferences.d.ts.map +1 -1
- package/dist/utilities/transformColumnPreferences.js +3 -0
- package/dist/utilities/transformColumnPreferences.js.map +1 -1
- package/dist/utilities/traverseFields.d.ts.map +1 -1
- package/dist/utilities/traverseFields.js +9 -1
- package/dist/utilities/traverseFields.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,CAAA;AAEzC,MAAM,MAAM,yBAAyB,CACnC,MAAM,SAAS,WAAW,GAAG,WAAW,EACxC,SAAS,GAAG,SAAS,IACnB;IACF,QAAQ,CAAC,QAAQ,EAAE,SAAS,SAAS,SAA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AM,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"}
|
|
@@ -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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Languages } 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"}
|
|
@@ -28,9 +28,11 @@ export type ServerFunctionHandler = (args: {
|
|
|
28
28
|
} & ServerFunctionClientArgs) => Promise<unknown>;
|
|
29
29
|
export type ListQuery = {
|
|
30
30
|
columns?: ColumnsFromURL;
|
|
31
|
+
groupBy?: string;
|
|
31
32
|
limit?: number;
|
|
32
33
|
page?: number;
|
|
33
34
|
preset?: number | string;
|
|
35
|
+
queryByGroup?: Record<string, ListQuery>;
|
|
34
36
|
search?: string;
|
|
35
37
|
sort?: Sort;
|
|
36
38
|
where?: Where;
|
|
@@ -38,6 +40,10 @@ export type ListQuery = {
|
|
|
38
40
|
export type BuildTableStateArgs = {
|
|
39
41
|
collectionSlug: string | string[];
|
|
40
42
|
columns?: ColumnPreference[];
|
|
43
|
+
data?: PaginatedDocs;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Use `data` instead
|
|
46
|
+
*/
|
|
41
47
|
docs?: PaginatedDocs['docs'];
|
|
42
48
|
enableRowSelections?: boolean;
|
|
43
49
|
orderableFieldName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/admin/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AA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,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,cAAc,CAAA;IACnB,eAAe,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,oCAAoC,GAAG;IACjD;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAA;IACvB;;;;;;OAMG;IACH,oBAAoB,EAAE,cAAc,EAAE,CAAA;IACtC;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1B;;;;OAIG;IACH,yBAAyB,EAAE,cAAc,EAAE,CAAA;IAC3C;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IACrC,GAAG,EAAE,cAAc,CAAA;IACnB;;OAEG;IACH,IAAI,EAAE,cAAc,CAAA;CACrB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/functions/index.ts"],"sourcesContent":["import type { ImportMap } from '../../bin/generateImportMap/index.js'\nimport type { SanitizedConfig } from '../../config/types.js'\nimport type { PaginatedDocs } from '../../database/types.js'\nimport type { CollectionSlug, ColumnPreference, FolderSortKeys } from '../../index.js'\nimport type { PayloadRequest, Sort, Where } from '../../types/index.js'\nimport type { ColumnsFromURL } from '../../utilities/transformColumnPreferences.js'\n\nexport type DefaultServerFunctionArgs = {\n importMap: ImportMap\n req: PayloadRequest\n}\n\nexport type ServerFunctionArgs = {\n args: Record<string, unknown>\n name: string\n}\n\nexport type ServerFunctionClientArgs = {\n args: Record<string, unknown>\n name: string\n}\n\nexport type ServerFunctionClient = (args: ServerFunctionClientArgs) => Promise<unknown> | unknown\n\nexport type ServerFunction<\n TArgs extends object = Record<string, unknown>,\n TReturnType = Promise<unknown> | unknown,\n> = (args: DefaultServerFunctionArgs & TArgs) => TReturnType\n\nexport type ServerFunctionConfig = {\n fn: ServerFunction\n name: string\n}\n\nexport type ServerFunctionHandler = (\n args: {\n config: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n } & ServerFunctionClientArgs,\n) => Promise<unknown>\n\nexport type ListQuery = {\n /*\n * This is an of strings, i.e. `['title', '-slug']`\n * Use `transformColumnsToPreferences` and `transformColumnsToSearchParams` to convert it back and forth\n */\n columns?: ColumnsFromURL\n limit?: number\n page?: number\n preset?: number | string\n /*\n When provided, is automatically injected into the `where` object\n */\n search?: string\n sort?: Sort\n where?: Where\n} & Record<string, unknown>\n\nexport type BuildTableStateArgs = {\n collectionSlug: string | string[]\n columns?: ColumnPreference[]\n docs?: PaginatedDocs['docs']\n enableRowSelections?: boolean\n orderableFieldName: string\n parent?: {\n collectionSlug: CollectionSlug\n id: number | string\n joinPath: string\n }\n query?: ListQuery\n renderRowTypes?: boolean\n req: PayloadRequest\n tableAppearance?: 'condensed' | 'default'\n}\n\nexport type BuildCollectionFolderViewResult = {\n View: React.ReactNode\n}\n\nexport type GetFolderResultsComponentAndDataArgs = {\n /**\n * If true and no folderID is provided, only folders will be returned.\n * If false, the results will include documents from the active collections.\n */\n browseByFolder: boolean\n /**\n * Used to filter document types to include in the results/display.\n *\n * i.e. ['folders', 'posts'] will only include folders and posts in the results.\n *\n * collectionsToQuery?\n */\n collectionsToDisplay: CollectionSlug[]\n /**\n * Used to determine how the results should be displayed.\n */\n displayAs: 'grid' | 'list'\n /**\n * Used to filter folders by the collections they are assigned to.\n *\n * i.e. ['posts'] will only include folders that are assigned to the posts collections.\n */\n folderAssignedCollections: CollectionSlug[]\n /**\n * The ID of the folder to filter results by.\n */\n folderID: number | string | undefined\n req: PayloadRequest\n /**\n * The sort order for the results.\n */\n sort: FolderSortKeys\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/functions/index.ts"],"sourcesContent":["import type { ImportMap } from '../../bin/generateImportMap/index.js'\nimport type { SanitizedConfig } from '../../config/types.js'\nimport type { PaginatedDocs } from '../../database/types.js'\nimport type { CollectionSlug, ColumnPreference, FolderSortKeys } from '../../index.js'\nimport type { PayloadRequest, Sort, Where } from '../../types/index.js'\nimport type { ColumnsFromURL } from '../../utilities/transformColumnPreferences.js'\n\nexport type DefaultServerFunctionArgs = {\n importMap: ImportMap\n req: PayloadRequest\n}\n\nexport type ServerFunctionArgs = {\n args: Record<string, unknown>\n name: string\n}\n\nexport type ServerFunctionClientArgs = {\n args: Record<string, unknown>\n name: string\n}\n\nexport type ServerFunctionClient = (args: ServerFunctionClientArgs) => Promise<unknown> | unknown\n\nexport type ServerFunction<\n TArgs extends object = Record<string, unknown>,\n TReturnType = Promise<unknown> | unknown,\n> = (args: DefaultServerFunctionArgs & TArgs) => TReturnType\n\nexport type ServerFunctionConfig = {\n fn: ServerFunction\n name: string\n}\n\nexport type ServerFunctionHandler = (\n args: {\n config: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n } & ServerFunctionClientArgs,\n) => Promise<unknown>\n\nexport type ListQuery = {\n /*\n * This is an of strings, i.e. `['title', '-slug']`\n * Use `transformColumnsToPreferences` and `transformColumnsToSearchParams` to convert it back and forth\n */\n columns?: ColumnsFromURL\n /*\n * A string representing the field to group by, e.g. `category`\n * A leading hyphen represents descending order, e.g. `-category`\n */\n groupBy?: string\n limit?: number\n page?: number\n preset?: number | string\n queryByGroup?: Record<string, ListQuery>\n /*\n When provided, is automatically injected into the `where` object\n */\n search?: string\n sort?: Sort\n where?: Where\n} & Record<string, unknown>\n\nexport type BuildTableStateArgs = {\n collectionSlug: string | string[]\n columns?: ColumnPreference[]\n data?: PaginatedDocs\n /**\n * @deprecated Use `data` instead\n */\n docs?: PaginatedDocs['docs']\n enableRowSelections?: boolean\n orderableFieldName: string\n parent?: {\n collectionSlug: CollectionSlug\n id: number | string\n joinPath: string\n }\n query?: ListQuery\n renderRowTypes?: boolean\n req: PayloadRequest\n tableAppearance?: 'condensed' | 'default'\n}\n\nexport type BuildCollectionFolderViewResult = {\n View: React.ReactNode\n}\n\nexport type GetFolderResultsComponentAndDataArgs = {\n /**\n * If true and no folderID is provided, only folders will be returned.\n * If false, the results will include documents from the active collections.\n */\n browseByFolder: boolean\n /**\n * Used to filter document types to include in the results/display.\n *\n * i.e. ['folders', 'posts'] will only include folders and posts in the results.\n *\n * collectionsToQuery?\n */\n collectionsToDisplay: CollectionSlug[]\n /**\n * Used to determine how the results should be displayed.\n */\n displayAs: 'grid' | 'list'\n /**\n * Used to filter folders by the collections they are assigned to.\n *\n * i.e. ['posts'] will only include folders that are assigned to the posts collections.\n */\n folderAssignedCollections: CollectionSlug[]\n /**\n * The ID of the folder to filter results by.\n */\n folderID: number | string | undefined\n req: PayloadRequest\n /**\n * The sort order for the results.\n */\n sort: FolderSortKeys\n}\n"],"names":[],"mappings":"AAyFA,WAiCC"}
|
|
@@ -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,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,gBAAgB,CAAA;IAC3B,gEAAgE;IAChE,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,MAAM,EAAE,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,mBAAmB,CAAC,EAAE,yBAAyB,CAAC,MAAM,CAAC,EAAE,CAAA;IACzD,YA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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;
|
|
@@ -13,7 +13,7 @@ export type ListViewSlots = {
|
|
|
13
13
|
BeforeListTable?: React.ReactNode;
|
|
14
14
|
Description?: React.ReactNode;
|
|
15
15
|
listMenuItems?: React.ReactNode[];
|
|
16
|
-
Table: React.ReactNode;
|
|
16
|
+
Table: React.ReactNode | React.ReactNode[];
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
* The `ListViewServerPropsOnly` approach is needed to ensure type strictness when injecting component props
|
|
@@ -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,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AACvE,OAAO,KAAK,EAAE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,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\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 +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,UAAUC,UAAU,QAAQ,cAAa;AAClD,SAASC,GAAG,QAAQ,MAAK;AASzB,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,QAAQ,QAAQ,wBAAuB;AAChD,SAASC,SAAS,QAAQ,iBAAgB;AAC1C,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,cAAc,QAAQ,oCAAmC;AAClE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,wBAAuB;AAcvD,OAAO,MAAMC,0BAA0B,OACrCC;IAEA,MAAMC,oBAAoBD,aAAaE,UAAU,CAACC,MAAM,CAACC,IAAI,CAACH,iBAAiB;IAC/E,MAAM,EAAEI,IAAI,EAAE,GAAGL;IAEjB,MAAM,EAAEM,iBAAiB,EAAEC,oBAAoB,EAAE,GAAGT,gBAAgBG;IAEpE,MAAMO,iBACJ,AAACF,qBAAqB,AAACN,CAAAA,aAAaK,IAAI,CAACI,KAAK,IAAI,EAAC,EAAGC,WAAW,GAAGC,IAAI,MAAO;IACjF,MAAMC,oBACJ,cAAcP,QAAQ,OAAOA,MAAMQ,aAAa,WAC5CR,KAAKQ,QAAQ,CAACH,WAAW,GAAGC,IAAI,KAChC;IAEN,IAAIG,OAAOd;IAEX,IAAIA,aAAaE,UAAU,CAACC,MAAM,CAACC,IAAI,CAACW,oBAAoB,EAAE;QAC5D,MAAM,IAAItB,UAAUO,aAAagB,GAAG,CAACC,CAAC;IACxC;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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,SAASC,QAAQ,QAAQ,wBAAuB;AAChD,SAASC,SAAS,QAAQ,iBAAgB;AAC1C,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,cAAc,QAAQ,oCAAmC;AAClE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,wBAAuB;AAcvD,OAAO,MAAMC,0BAA0B,OACrCC;IAEA,MAAMC,oBAAoBD,aAAaE,UAAU,CAACC,MAAM,CAACC,IAAI,CAACH,iBAAiB;IAC/E,MAAM,EAAEI,IAAI,EAAE,GAAGL;IAEjB,MAAM,EAAEM,iBAAiB,EAAEC,oBAAoB,EAAE,GAAGT,gBAAgBG;IAEpE,MAAMO,iBACJ,AAACF,qBAAqB,AAACN,CAAAA,aAAaK,IAAI,CAACI,KAAK,IAAI,EAAC,EAAGC,WAAW,GAAGC,IAAI,MAAO;IACjF,MAAMC,oBACJ,cAAcP,QAAQ,OAAOA,MAAMQ,aAAa,WAC5CR,KAAKQ,QAAQ,CAACH,WAAW,GAAGC,IAAI,KAChC;IAEN,IAAIG,OAAOd;IAEX,IAAIA,aAAaE,UAAU,CAACC,MAAM,CAACC,IAAI,CAACW,oBAAoB,EAAE;QAC5D,MAAM,IAAIvB,UAAUQ,aAAagB,GAAG,CAACC,CAAC;IACxC;IACA,IAAI,CAACT,kBAAkB,CAACI,mBAAmB;QACzC,MAAM,IAAIrB,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|
|
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,aAAa,CAAA;AAMzC,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,IAAI;IAClD,UAAU,EAAE,KAAK,CAAA;IACjB,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,IAAI,EAAE,gCAAgC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAA;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAA;
|
|
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,aAAa,CAAA;AAMzC,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,IAAI;IAClD,UAAU,EAAE,KAAK,CAAA;IACjB,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,IAAI,EAAE,gCAAgC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAA;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,wBAAsB,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"}
|
|
@@ -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,EAAE,cAAc,EAAS,MAAM,sBAAsB,CAAA;
|
|
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,EAAE,cAAc,EAAS,MAAM,sBAAsB,CAAA;AAuBjE,MAAM,MAAM,MAAM,GAAG;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,SAAS,CAAC,KAAK,SAAS,cAAc,IAAI;IACpD,UAAU,EAAE,UAAU,CAAA;IACtB,IAAI,EAAE,gCAAgC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAA;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,KAAK,wBAAwB,GAAG;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,GAAG,EAAE,cAAc,CAAA;IACnB,IAAI,EAAE,GAAG,CAAA;CACV,CAAA;AAED,eAAO,MAAM,oBAAoB,0CAI9B,wBAAwB,SAQ1B,CAAA;AAED,eAAO,MAAM,cAAc,GAAU,KAAK,SAAS,cAAc,gBACjD,SAAS,CAAC,KAAK,CAAC,KAC7B,OAAO,CAAC;IAAE,IAAI,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAA;CAAE,GAAG,MAAM,CAsU1D,CAAA"}
|
|
@@ -3,6 +3,7 @@ import { buildAfterOperation } from '../../collections/operations/utils.js';
|
|
|
3
3
|
import { AuthenticationError, LockedAuth, UnverifiedEmail, ValidationError } from '../../errors/index.js';
|
|
4
4
|
import { afterRead } from '../../fields/hooks/afterRead/index.js';
|
|
5
5
|
import { Forbidden } from '../../index.js';
|
|
6
|
+
import { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js';
|
|
6
7
|
import { killTransaction } from '../../utilities/killTransaction.js';
|
|
7
8
|
import { sanitizeInternalFields } from '../../utilities/sanitizeInternalFields.js';
|
|
8
9
|
import { getFieldsToSign } from '../getFieldsToSign.js';
|
|
@@ -142,6 +143,12 @@ export const loginOperation = async (incomingArgs)=>{
|
|
|
142
143
|
} else if (canLoginWithUsername && sanitizedUsername) {
|
|
143
144
|
whereConstraint = usernameConstraint;
|
|
144
145
|
}
|
|
146
|
+
// Exclude trashed users
|
|
147
|
+
whereConstraint = appendNonTrashedFilter({
|
|
148
|
+
enableTrash: collectionConfig.trash,
|
|
149
|
+
trash: false,
|
|
150
|
+
where: whereConstraint
|
|
151
|
+
});
|
|
145
152
|
let user = await payload.db.findOne({
|
|
146
153
|
collection: collectionConfig.slug,
|
|
147
154
|
req,
|