payload 4.0.0-internal.a6582c6 → 4.0.0-internal.a7ca468
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/RichText.d.ts +1 -1
- package/dist/admin/RichText.d.ts.map +1 -1
- package/dist/admin/RichText.js.map +1 -1
- package/dist/admin/adapters/devReload.d.ts +13 -0
- package/dist/admin/adapters/devReload.d.ts.map +1 -1
- package/dist/admin/adapters/devReload.js +14 -1
- package/dist/admin/adapters/devReload.js.map +1 -1
- package/dist/auth/endpoints/login.d.ts.map +1 -1
- package/dist/auth/endpoints/login.js +2 -11
- package/dist/auth/endpoints/login.js.map +1 -1
- package/dist/auth/executeAccess.d.ts +1 -1
- package/dist/auth/executeAccess.d.ts.map +1 -1
- package/dist/auth/executeAccess.js.map +1 -1
- package/dist/auth/getLoginOptions.js.map +1 -1
- package/dist/auth/loginWithCookie.d.ts +33 -0
- package/dist/auth/loginWithCookie.d.ts.map +1 -0
- package/dist/auth/loginWithCookie.js +34 -0
- package/dist/auth/loginWithCookie.js.map +1 -0
- package/dist/auth/serverFunctions/cookies.d.ts +47 -0
- package/dist/auth/serverFunctions/cookies.d.ts.map +1 -0
- package/dist/auth/serverFunctions/cookies.js +52 -0
- package/dist/auth/serverFunctions/cookies.js.map +1 -0
- package/dist/auth/serverFunctions/login.d.ts +29 -0
- package/dist/auth/serverFunctions/login.d.ts.map +1 -0
- package/dist/auth/serverFunctions/login.js +63 -0
- package/dist/auth/serverFunctions/login.js.map +1 -0
- package/dist/auth/serverFunctions/logout.d.ts +17 -0
- package/dist/auth/serverFunctions/logout.d.ts.map +1 -0
- package/dist/auth/serverFunctions/logout.js +58 -0
- package/dist/auth/serverFunctions/logout.js.map +1 -0
- package/dist/auth/serverFunctions/refresh.d.ts +17 -0
- package/dist/auth/serverFunctions/refresh.d.ts.map +1 -0
- package/dist/auth/serverFunctions/refresh.js +61 -0
- package/dist/auth/serverFunctions/refresh.js.map +1 -0
- package/dist/auth/types.d.ts +9 -14
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/collections/config/defaults.d.ts +4 -4
- package/dist/collections/config/defaults.d.ts.map +1 -1
- package/dist/collections/config/defaults.js +37 -32
- package/dist/collections/config/defaults.js.map +1 -1
- package/dist/collections/config/sanitize.d.ts +4 -8
- package/dist/collections/config/sanitize.d.ts.map +1 -1
- package/dist/collections/config/sanitize.js +4 -21
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/collections/config/types.d.ts +52 -48
- package/dist/collections/config/types.d.ts.map +1 -1
- package/dist/collections/config/types.js.map +1 -1
- package/dist/collections/config/useAsTitle.spec.js +27 -27
- package/dist/collections/config/useAsTitle.spec.js.map +1 -1
- package/dist/collections/operations/updateByID.js +1 -0
- package/dist/collections/operations/updateByID.js.map +1 -1
- package/dist/config/build.js +1 -1
- package/dist/config/build.js.map +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +1 -1
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/orderable/index.d.ts +1 -1
- package/dist/config/orderable/index.d.ts.map +1 -1
- package/dist/config/orderable/index.js +2 -2
- package/dist/config/orderable/index.js.map +1 -1
- package/dist/config/sanitize.d.ts +1 -1
- package/dist/config/sanitize.d.ts.map +1 -1
- package/dist/config/sanitize.js +27 -30
- package/dist/config/sanitize.js.map +1 -1
- package/dist/config/types.d.ts +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/exports/auth.d.ts +5 -0
- package/dist/exports/auth.d.ts.map +1 -0
- package/dist/exports/auth.js +6 -0
- package/dist/exports/auth.js.map +1 -0
- package/dist/fields/config/reservedFieldNames.spec.js +18 -18
- package/dist/fields/config/reservedFieldNames.spec.js.map +1 -1
- package/dist/fields/config/sanitize.d.ts +6 -6
- package/dist/fields/config/sanitize.d.ts.map +1 -1
- package/dist/fields/config/sanitize.js +18 -19
- package/dist/fields/config/sanitize.js.map +1 -1
- package/dist/fields/config/sanitize.spec.js +105 -105
- package/dist/fields/config/sanitize.spec.js.map +1 -1
- package/dist/fields/config/types.d.ts +1 -1
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js +1 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/traverseFields.js +2 -0
- package/dist/fields/hooks/beforeValidate/traverseFields.js.map +1 -1
- package/dist/fields/validations.js +2 -2
- package/dist/fields/validations.js.map +1 -1
- package/dist/fields/validations.spec.js +61 -37
- package/dist/fields/validations.spec.js.map +1 -1
- package/dist/globals/config/sanitize.d.ts +3 -7
- package/dist/globals/config/sanitize.d.ts.map +1 -1
- package/dist/globals/config/sanitize.js +3 -6
- package/dist/globals/config/sanitize.js.map +1 -1
- package/dist/globals/config/sanitize.spec.js +6 -6
- package/dist/globals/config/sanitize.spec.js.map +1 -1
- package/dist/globals/operations/countGlobalVersions.d.ts.map +1 -1
- package/dist/globals/operations/countGlobalVersions.js +1 -0
- package/dist/globals/operations/countGlobalVersions.js.map +1 -1
- package/dist/index.bundled.d.ts +217 -223
- package/dist/index.d.ts +18 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +58 -20
- package/dist/index.js.map +1 -1
- package/dist/query-presets/constraints.js +1 -1
- package/dist/query-presets/constraints.js.map +1 -1
- package/dist/queues/config/collection.d.ts.map +1 -1
- package/dist/queues/config/collection.js +17 -31
- package/dist/queues/config/collection.js.map +1 -1
- package/dist/queues/config/global.d.ts +4 -4
- package/dist/queues/config/global.d.ts.map +1 -1
- package/dist/queues/config/global.js.map +1 -1
- package/dist/queues/config/types/index.d.ts +5 -19
- package/dist/queues/config/types/index.d.ts.map +1 -1
- package/dist/queues/config/types/index.js.map +1 -1
- package/dist/queues/config/types/taskTypes.d.ts +2 -5
- package/dist/queues/config/types/taskTypes.d.ts.map +1 -1
- package/dist/queues/config/types/taskTypes.js.map +1 -1
- package/dist/queues/config/types/workflowJSONTypes.d.ts +4 -3
- package/dist/queues/config/types/workflowJSONTypes.d.ts.map +1 -1
- package/dist/queues/config/types/workflowJSONTypes.js.map +1 -1
- package/dist/queues/config/types/workflowTypes.d.ts +7 -23
- package/dist/queues/config/types/workflowTypes.d.ts.map +1 -1
- package/dist/queues/config/types/workflowTypes.js.map +1 -1
- package/dist/queues/errors/handleTaskError.js +2 -2
- package/dist/queues/errors/handleTaskError.js.map +1 -1
- package/dist/queues/localAPI.d.ts +2 -2
- package/dist/queues/localAPI.d.ts.map +1 -1
- package/dist/queues/localAPI.js +61 -64
- package/dist/queues/localAPI.js.map +1 -1
- package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.d.ts +4 -4
- package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.d.ts.map +1 -1
- package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.js.map +1 -1
- package/dist/queues/operations/runJobs/index.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/index.js +12 -14
- package/dist/queues/operations/runJobs/index.js.map +1 -1
- package/dist/queues/operations/runJobs/runJSONJob/index.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/runJSONJob/index.js.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +2 -2
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
- package/dist/queues/operations/runJobs/runJob/importHandlerPath.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/uploads/generateFileData.js +4 -1
- package/dist/uploads/generateFileData.js.map +1 -1
- package/dist/uploads/getImageSize.d.ts +12 -1
- package/dist/uploads/getImageSize.d.ts.map +1 -1
- package/dist/uploads/getImageSize.js +20 -18
- package/dist/uploads/getImageSize.js.map +1 -1
- package/dist/uploads/getImageSize.spec.js +298 -0
- package/dist/uploads/getImageSize.spec.js.map +1 -0
- package/dist/uploads/probeImageSize.d.ts +39 -0
- package/dist/uploads/probeImageSize.d.ts.map +1 -0
- package/dist/uploads/probeImageSize.js +374 -0
- package/dist/uploads/probeImageSize.js.map +1 -0
- package/dist/uploads/probeImageSize.spec.js +366 -0
- package/dist/uploads/probeImageSize.spec.js.map +1 -0
- package/dist/utilities/appendNonTrashedFilter.d.ts +1 -1
- package/dist/utilities/appendNonTrashedFilter.d.ts.map +1 -1
- package/dist/utilities/appendNonTrashedFilter.js.map +1 -1
- package/dist/utilities/configToJSONSchema.spec.js +33 -33
- package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
- package/dist/utilities/traverseFields.d.ts.map +1 -1
- package/dist/utilities/traverseFields.js +20 -22
- package/dist/utilities/traverseFields.js.map +1 -1
- package/dist/utilities/traverseFields.spec.js +112 -0
- package/dist/utilities/traverseFields.spec.js.map +1 -1
- package/dist/utilities/unflattenData.d.ts +3 -0
- package/dist/utilities/unflattenData.d.ts.map +1 -0
- package/dist/utilities/unflattenData.js +14 -0
- package/dist/utilities/unflattenData.js.map +1 -0
- package/package.json +8 -3
- package/dist/uploads/tempFile.d.ts +0 -7
- package/dist/uploads/tempFile.d.ts.map +0 -1
- package/dist/uploads/tempFile.js +0 -39
- package/dist/uploads/tempFile.js.map +0 -1
package/dist/admin/RichText.d.ts
CHANGED
|
@@ -199,6 +199,6 @@ export type RichTextAdapterProvider<Value extends object = object, AdapterProps
|
|
|
199
199
|
*/
|
|
200
200
|
isRoot?: boolean;
|
|
201
201
|
parentIsLocalized: boolean;
|
|
202
|
-
}) =>
|
|
202
|
+
}) => RichTextAdapter<Value, AdapterProps, ExtraFieldProperties>;
|
|
203
203
|
export {};
|
|
204
204
|
//# sourceMappingURL=RichText.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../../src/admin/RichText.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OA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C,wBAAwB,EAAE,wBAAwB,CAAC,CAAA;CACrF,GAAG,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,oBAAoB,CAAC,CAAA;AAElE,MAAM,MAAM,uBAAuB,CACjC,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,YAAY,GAAG,GAAG,EAClB,oBAAoB,GAAG,EAAE,IACvB,CAAC,EACH,MAAM,EACN,MAAM,EACN,iBAAiB,GAClB,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,iBAAiB,EAAE,OAAO,CAAA;CAC3B,KAAK,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,oBAAoB,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/admin/RichText.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { I18n } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\n\nimport type { SanitizedCollectionConfig, TypeWithID } from '../collections/config/types.js'\nimport type { ImportMapGenerators, PayloadComponent, SanitizedConfig } from '../config/types.js'\nimport type { ValidationFieldError } from '../errors/ValidationError.js'\nimport type {\n FieldAffectingData,\n RichTextField,\n RichTextFieldClient,\n Validate,\n} from '../fields/config/types.js'\nimport type { SanitizedGlobalConfig } from '../globals/config/types.js'\nimport type { RequestContext, TypedFallbackLocale } from '../index.js'\nimport type { JsonObject, PayloadRequest, PopulateType } from '../types/index.js'\nimport type { FieldsToJSONSchemaArgs } from '../utilities/configToJSONSchema.js'\nimport type { RichTextFieldClientProps, RichTextFieldServerProps } from './fields/RichText.js'\nimport type { FieldDiffClientProps, FieldDiffServerProps, FieldSchemaMap } from './types.js'\n\nexport type AfterReadRichTextHookArgs<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TData extends TypeWithID = any,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TValue = any,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TSiblingData = any,\n> = {\n currentDepth?: number\n\n depth?: number\n\n draft?: boolean\n\n fallbackLocale?: TypedFallbackLocale\n fieldPromises?: Promise<void>[]\n\n /** Boolean to denote if this hook is running against finding one, or finding many within the afterRead hook. */\n findMany?: boolean\n\n flattenLocales?: boolean\n\n locale?: string\n\n /** A string relating to which operation the field type is currently executing within. */\n operation?: 'create' | 'delete' | 'read' | 'update'\n\n overrideAccess?: boolean\n\n populate?: PopulateType\n\n populationPromises?: Promise<void>[]\n showHiddenFields?: boolean\n triggerAccessControl?: boolean\n triggerHooks?: boolean\n}\n\nexport type AfterChangeRichTextHookArgs<\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = {\n /** A string relating to which operation the field type is currently executing within. */\n operation: 'create' | 'update'\n /** The document before changes were applied. */\n previousDoc?: TData\n /** The sibling data of the document before changes being applied. */\n previousSiblingDoc?: TSiblingData\n /** The previous value of the field, before changes */\n previousValue?: TValue\n}\n\nexport type BeforeValidateRichTextHookArgs<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = {\n /** A string relating to which operation the field type is currently executing within. */\n operation: 'create' | 'update'\n overrideAccess?: boolean\n /** The sibling data of the document before changes being applied. */\n previousSiblingDoc?: TSiblingData\n /** The previous value of the field, before changes */\n previousValue?: TValue\n}\n\nexport type BeforeChangeRichTextHookArgs<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = {\n /**\n * The original data with locales (not modified by any hooks). Only available in `beforeChange` and `beforeDuplicate` field hooks.\n */\n docWithLocales?: JsonObject\n\n duplicate?: boolean\n\n errors?: ValidationFieldError[]\n /**\n * Built up field label\n *\n * @example \"Group Field > Tab Field > Rich Text Field\"\n */\n fieldLabelPath: string\n /** Only available in `beforeChange` field hooks */\n mergeLocaleActions?: (() => Promise<void> | void)[]\n /** A string relating to which operation the field type is currently executing within. */\n operation?: 'create' | 'delete' | 'read' | 'update'\n overrideAccess: boolean\n /** The sibling data of the document before changes being applied. */\n previousSiblingDoc?: TSiblingData\n /** The previous value of the field, before changes */\n previousValue?: TValue\n /**\n * The original siblingData with locales (not modified by any hooks).\n */\n siblingDocWithLocales?: JsonObject\n skipValidation?: boolean\n}\n\nexport type BaseRichTextHookArgs<\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = {\n /** The collection which the field belongs to. If the field belongs to a global, this will be null. */\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n /** The data passed to update the document within create and update operations, and the full document itself in the afterRead hook. */\n data?: Partial<TData>\n /** The field which the hook is running against. */\n field: FieldAffectingData\n /** The global which the field belongs to. If the field belongs to a collection, this will be null. */\n global: null | SanitizedGlobalConfig\n indexPath: number[]\n /** The full original document in `update` operations. In the `afterChange` hook, this is the resulting document of the operation. */\n originalDoc?: TData\n parentIsLocalized: boolean\n /**\n * The path of the field, e.g. [\"group\", \"myArray\", 1, \"textField\"]. The path is the schemaPath but with indexes and would be used in the context of field data, not field schemas.\n */\n path: (number | string)[]\n /** The Express request object. It is mocked for Local API operations. */\n req: PayloadRequest\n /**\n * The schemaPath of the field, e.g. [\"group\", \"myArray\", \"textField\"]. The schemaPath is the path but without indexes and would be used in the context of field schemas, not field data.\n */\n schemaPath: string[]\n /** The sibling data passed to a field that the hook is running against. */\n siblingData: Partial<TSiblingData>\n /** The value of the field. */\n value?: TValue\n}\n\nexport type AfterReadRichTextHook<\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = (\n args: AfterReadRichTextHookArgs<TData, TValue, TSiblingData> &\n BaseRichTextHookArgs<TData, TValue, TSiblingData>,\n) => Promise<TValue> | TValue\n\nexport type AfterChangeRichTextHook<\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = (\n args: AfterChangeRichTextHookArgs<TData, TValue, TSiblingData> &\n BaseRichTextHookArgs<TData, TValue, TSiblingData>,\n) => Promise<TValue> | TValue\n\nexport type BeforeChangeRichTextHook<\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = (\n args: BaseRichTextHookArgs<TData, TValue, TSiblingData> &\n BeforeChangeRichTextHookArgs<TData, TValue, TSiblingData>,\n) => Promise<TValue> | TValue\n\nexport type BeforeValidateRichTextHook<\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = (\n args: BaseRichTextHookArgs<TData, TValue, TSiblingData> &\n BeforeValidateRichTextHookArgs<TData, TValue, TSiblingData>,\n) => Promise<TValue> | TValue\n\nexport type RichTextHooks = {\n afterChange?: AfterChangeRichTextHook[]\n afterRead?: AfterReadRichTextHook[]\n beforeChange?: BeforeChangeRichTextHook[]\n beforeValidate?: BeforeValidateRichTextHook[]\n}\n\ntype RichTextAdapterBase<\n Value extends object = object,\n AdapterProps = any,\n ExtraFieldProperties = {},\n> = {\n /**\n * Provide a function that can be used to add items to the import map. This is useful for\n * making modules available to the client.\n */\n generateImportMap?: ImportMapGenerators[0]\n /**\n * Provide a function that can be used to add items to the schema map. This is useful for\n * richtext sub-fields the server needs to \"know\" about in order to do things like calculate form state.\n *\n * This function is run within `buildFieldSchemaMap`.\n */\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n field: RichTextField\n i18n: I18n<any, any>\n schemaMap: FieldSchemaMap\n schemaPath: string\n }) => FieldSchemaMap\n /**\n * Like an afterRead hook, but runs only for the GraphQL resolver. For populating data, this should be used, as afterRead hooks do not have a depth in graphQL.\n *\n * To populate stuff / resolve field hooks, mutate the incoming populationPromises or fieldPromises array. They will then be awaited in the correct order within payload itself.\n * @param data\n */\n graphQLPopulationPromises?: (data: {\n context: RequestContext\n currentDepth?: number\n depth: number\n draft: boolean\n field: RichTextField<Value, AdapterProps, ExtraFieldProperties>\n fieldPromises: Promise<void>[]\n findMany: boolean\n flattenLocales: boolean\n overrideAccess?: boolean\n parentIsLocalized: boolean\n populateArg?: PopulateType\n populationPromises: Promise<void>[]\n req: PayloadRequest\n showHiddenFields: boolean\n siblingDoc: JsonObject\n }) => void\n hooks?: RichTextHooks\n /**\n * Return the JSON schema for the field value. The JSON schema is read by\n * `json-schema-to-typescript` which is used to generate types for this richtext field\n * payload-types.ts)\n */\n jsonSchema?: (\n args: {\n field: RichTextField<Value, AdapterProps, ExtraFieldProperties>\n isRequired: boolean\n } & Pick<\n FieldsToJSONSchemaArgs,\n | 'collectionIDFieldTypes'\n | 'config'\n | 'i18n'\n | 'interfaceNameDefinitions'\n | 'typeStringDefinitions'\n | 'variant'\n >,\n ) => JSONSchema4\n /**\n * Provide validation function for the richText field. This function is run the same way\n * as other field validation functions.\n */\n validate: Validate<\n Value,\n Value,\n unknown,\n RichTextField<Value, AdapterProps, ExtraFieldProperties>\n >\n}\n\nexport type RichTextAdapter<\n Value extends object = any,\n AdapterProps = any,\n ExtraFieldProperties = any,\n> = {\n /**\n * Component that will be displayed in the list view. Can be typed as\n * `DefaultCellComponentProps` or `DefaultServerCellComponentProps`.\n */\n CellComponent: PayloadComponent<never>\n /**\n * Component that will be displayed in the version diff view.\n * If not provided, richtext content will be diffed as JSON.\n */\n DiffComponent?: PayloadComponent<\n FieldDiffServerProps<RichTextField, RichTextFieldClient>,\n FieldDiffClientProps<RichTextFieldClient>\n >\n /**\n * Component that will be displayed in the edit view.\n */\n FieldComponent: PayloadComponent<RichTextFieldServerProps, RichTextFieldClientProps>\n} & RichTextAdapterBase<Value, AdapterProps, ExtraFieldProperties>\n\nexport type RichTextAdapterProvider<\n Value extends object = object,\n AdapterProps = any,\n ExtraFieldProperties = {},\n> = ({\n config,\n isRoot,\n parentIsLocalized,\n}: {\n config: SanitizedConfig\n /**\n * Whether or not this is the root richText editor, defined in the top-level `editor` property\n * of the Payload Config.\n *\n * @default false\n */\n isRoot?: boolean\n parentIsLocalized: boolean\n}) =>\n | Promise<RichTextAdapter<Value, AdapterProps, ExtraFieldProperties>>\n | RichTextAdapter<Value, AdapterProps, ExtraFieldProperties>\n"],"names":[],"mappings":"AAAA,qDAAqD,GA8SrD,WAoB8D"}
|
|
1
|
+
{"version":3,"sources":["../../src/admin/RichText.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { I18n } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\n\nimport type { SanitizedCollectionConfig, TypeWithID } from '../collections/config/types.js'\nimport type { ImportMapGenerators, PayloadComponent, SanitizedConfig } from '../config/types.js'\nimport type { ValidationFieldError } from '../errors/ValidationError.js'\nimport type {\n FieldAffectingData,\n RichTextField,\n RichTextFieldClient,\n Validate,\n} from '../fields/config/types.js'\nimport type { SanitizedGlobalConfig } from '../globals/config/types.js'\nimport type { RequestContext, TypedFallbackLocale } from '../index.js'\nimport type { JsonObject, PayloadRequest, PopulateType } from '../types/index.js'\nimport type { FieldsToJSONSchemaArgs } from '../utilities/configToJSONSchema.js'\nimport type { RichTextFieldClientProps, RichTextFieldServerProps } from './fields/RichText.js'\nimport type { FieldDiffClientProps, FieldDiffServerProps, FieldSchemaMap } from './types.js'\n\nexport type AfterReadRichTextHookArgs<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TData extends TypeWithID = any,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TValue = any,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TSiblingData = any,\n> = {\n currentDepth?: number\n\n depth?: number\n\n draft?: boolean\n\n fallbackLocale?: TypedFallbackLocale\n fieldPromises?: Promise<void>[]\n\n /** Boolean to denote if this hook is running against finding one, or finding many within the afterRead hook. */\n findMany?: boolean\n\n flattenLocales?: boolean\n\n locale?: string\n\n /** A string relating to which operation the field type is currently executing within. */\n operation?: 'create' | 'delete' | 'read' | 'update'\n\n overrideAccess?: boolean\n\n populate?: PopulateType\n\n populationPromises?: Promise<void>[]\n showHiddenFields?: boolean\n triggerAccessControl?: boolean\n triggerHooks?: boolean\n}\n\nexport type AfterChangeRichTextHookArgs<\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = {\n /** A string relating to which operation the field type is currently executing within. */\n operation: 'create' | 'update'\n /** The document before changes were applied. */\n previousDoc?: TData\n /** The sibling data of the document before changes being applied. */\n previousSiblingDoc?: TSiblingData\n /** The previous value of the field, before changes */\n previousValue?: TValue\n}\n\nexport type BeforeValidateRichTextHookArgs<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = {\n /** A string relating to which operation the field type is currently executing within. */\n operation: 'create' | 'update'\n overrideAccess?: boolean\n /** The sibling data of the document before changes being applied. */\n previousSiblingDoc?: TSiblingData\n /** The previous value of the field, before changes */\n previousValue?: TValue\n}\n\nexport type BeforeChangeRichTextHookArgs<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = {\n /**\n * The original data with locales (not modified by any hooks). Only available in `beforeChange` and `beforeDuplicate` field hooks.\n */\n docWithLocales?: JsonObject\n\n duplicate?: boolean\n\n errors?: ValidationFieldError[]\n /**\n * Built up field label\n *\n * @example \"Group Field > Tab Field > Rich Text Field\"\n */\n fieldLabelPath: string\n /** Only available in `beforeChange` field hooks */\n mergeLocaleActions?: (() => Promise<void> | void)[]\n /** A string relating to which operation the field type is currently executing within. */\n operation?: 'create' | 'delete' | 'read' | 'update'\n overrideAccess: boolean\n /** The sibling data of the document before changes being applied. */\n previousSiblingDoc?: TSiblingData\n /** The previous value of the field, before changes */\n previousValue?: TValue\n /**\n * The original siblingData with locales (not modified by any hooks).\n */\n siblingDocWithLocales?: JsonObject\n skipValidation?: boolean\n}\n\nexport type BaseRichTextHookArgs<\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = {\n /** The collection which the field belongs to. If the field belongs to a global, this will be null. */\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n /** The data passed to update the document within create and update operations, and the full document itself in the afterRead hook. */\n data?: Partial<TData>\n /** The field which the hook is running against. */\n field: FieldAffectingData\n /** The global which the field belongs to. If the field belongs to a collection, this will be null. */\n global: null | SanitizedGlobalConfig\n indexPath: number[]\n /** The full original document in `update` operations. In the `afterChange` hook, this is the resulting document of the operation. */\n originalDoc?: TData\n parentIsLocalized: boolean\n /**\n * The path of the field, e.g. [\"group\", \"myArray\", 1, \"textField\"]. The path is the schemaPath but with indexes and would be used in the context of field data, not field schemas.\n */\n path: (number | string)[]\n /** The Express request object. It is mocked for Local API operations. */\n req: PayloadRequest\n /**\n * The schemaPath of the field, e.g. [\"group\", \"myArray\", \"textField\"]. The schemaPath is the path but without indexes and would be used in the context of field schemas, not field data.\n */\n schemaPath: string[]\n /** The sibling data passed to a field that the hook is running against. */\n siblingData: Partial<TSiblingData>\n /** The value of the field. */\n value?: TValue\n}\n\nexport type AfterReadRichTextHook<\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = (\n args: AfterReadRichTextHookArgs<TData, TValue, TSiblingData> &\n BaseRichTextHookArgs<TData, TValue, TSiblingData>,\n) => Promise<TValue> | TValue\n\nexport type AfterChangeRichTextHook<\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = (\n args: AfterChangeRichTextHookArgs<TData, TValue, TSiblingData> &\n BaseRichTextHookArgs<TData, TValue, TSiblingData>,\n) => Promise<TValue> | TValue\n\nexport type BeforeChangeRichTextHook<\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = (\n args: BaseRichTextHookArgs<TData, TValue, TSiblingData> &\n BeforeChangeRichTextHookArgs<TData, TValue, TSiblingData>,\n) => Promise<TValue> | TValue\n\nexport type BeforeValidateRichTextHook<\n TData extends TypeWithID = any,\n TValue = any,\n TSiblingData = any,\n> = (\n args: BaseRichTextHookArgs<TData, TValue, TSiblingData> &\n BeforeValidateRichTextHookArgs<TData, TValue, TSiblingData>,\n) => Promise<TValue> | TValue\n\nexport type RichTextHooks = {\n afterChange?: AfterChangeRichTextHook[]\n afterRead?: AfterReadRichTextHook[]\n beforeChange?: BeforeChangeRichTextHook[]\n beforeValidate?: BeforeValidateRichTextHook[]\n}\n\ntype RichTextAdapterBase<\n Value extends object = object,\n AdapterProps = any,\n ExtraFieldProperties = {},\n> = {\n /**\n * Provide a function that can be used to add items to the import map. This is useful for\n * making modules available to the client.\n */\n generateImportMap?: ImportMapGenerators[0]\n /**\n * Provide a function that can be used to add items to the schema map. This is useful for\n * richtext sub-fields the server needs to \"know\" about in order to do things like calculate form state.\n *\n * This function is run within `buildFieldSchemaMap`.\n */\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n field: RichTextField\n i18n: I18n<any, any>\n schemaMap: FieldSchemaMap\n schemaPath: string\n }) => FieldSchemaMap\n /**\n * Like an afterRead hook, but runs only for the GraphQL resolver. For populating data, this should be used, as afterRead hooks do not have a depth in graphQL.\n *\n * To populate stuff / resolve field hooks, mutate the incoming populationPromises or fieldPromises array. They will then be awaited in the correct order within payload itself.\n * @param data\n */\n graphQLPopulationPromises?: (data: {\n context: RequestContext\n currentDepth?: number\n depth: number\n draft: boolean\n field: RichTextField<Value, AdapterProps, ExtraFieldProperties>\n fieldPromises: Promise<void>[]\n findMany: boolean\n flattenLocales: boolean\n overrideAccess?: boolean\n parentIsLocalized: boolean\n populateArg?: PopulateType\n populationPromises: Promise<void>[]\n req: PayloadRequest\n showHiddenFields: boolean\n siblingDoc: JsonObject\n }) => void\n hooks?: RichTextHooks\n /**\n * Return the JSON schema for the field value. The JSON schema is read by\n * `json-schema-to-typescript` which is used to generate types for this richtext field\n * payload-types.ts)\n */\n jsonSchema?: (\n args: {\n field: RichTextField<Value, AdapterProps, ExtraFieldProperties>\n isRequired: boolean\n } & Pick<\n FieldsToJSONSchemaArgs,\n | 'collectionIDFieldTypes'\n | 'config'\n | 'i18n'\n | 'interfaceNameDefinitions'\n | 'typeStringDefinitions'\n | 'variant'\n >,\n ) => JSONSchema4\n /**\n * Provide validation function for the richText field. This function is run the same way\n * as other field validation functions.\n */\n validate: Validate<\n Value,\n Value,\n unknown,\n RichTextField<Value, AdapterProps, ExtraFieldProperties>\n >\n}\n\nexport type RichTextAdapter<\n Value extends object = any,\n AdapterProps = any,\n ExtraFieldProperties = any,\n> = {\n /**\n * Component that will be displayed in the list view. Can be typed as\n * `DefaultCellComponentProps` or `DefaultServerCellComponentProps`.\n */\n CellComponent: PayloadComponent<never>\n /**\n * Component that will be displayed in the version diff view.\n * If not provided, richtext content will be diffed as JSON.\n */\n DiffComponent?: PayloadComponent<\n FieldDiffServerProps<RichTextField, RichTextFieldClient>,\n FieldDiffClientProps<RichTextFieldClient>\n >\n /**\n * Component that will be displayed in the edit view.\n */\n FieldComponent: PayloadComponent<RichTextFieldServerProps, RichTextFieldClientProps>\n} & RichTextAdapterBase<Value, AdapterProps, ExtraFieldProperties>\n\nexport type RichTextAdapterProvider<\n Value extends object = object,\n AdapterProps = any,\n ExtraFieldProperties = {},\n> = ({\n config,\n isRoot,\n parentIsLocalized,\n}: {\n config: SanitizedConfig\n /**\n * Whether or not this is the root richText editor, defined in the top-level `editor` property\n * of the Payload Config.\n *\n * @default false\n */\n isRoot?: boolean\n parentIsLocalized: boolean\n}) => RichTextAdapter<Value, AdapterProps, ExtraFieldProperties>\n"],"names":[],"mappings":"AAAA,qDAAqD,GA8SrD,WAkBgE"}
|
|
@@ -6,4 +6,17 @@ export type DevReloadStrategy = {
|
|
|
6
6
|
connect: (onReload: () => void) => DevReloadCleanup;
|
|
7
7
|
};
|
|
8
8
|
export type DevReloadCleanup = () => void;
|
|
9
|
+
/**
|
|
10
|
+
* Registers the strategy `getPayload` uses to learn the config changed on disk.
|
|
11
|
+
* Covers callers that never see `InitOptions`, such as `handleEndpoints`.
|
|
12
|
+
* Pass `null` to unregister.
|
|
13
|
+
*
|
|
14
|
+
* Scoped to this module instance rather than `globalThis`, so the registrar has
|
|
15
|
+
* to run in the same module graph as the `getPayload` calls it should affect.
|
|
16
|
+
* Framework adapters register from their server runtime, which resolves the
|
|
17
|
+
* same copy of `payload` as the app.
|
|
18
|
+
*/
|
|
19
|
+
export declare const registerDevReloadStrategy: (strategy: DevReloadStrategy | null) => void;
|
|
20
|
+
/** The strategy set by {@link registerDevReloadStrategy}, or `null` if none is registered. */
|
|
21
|
+
export declare const getRegisteredDevReloadStrategy: () => DevReloadStrategy | null;
|
|
9
22
|
//# sourceMappingURL=devReload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devReload.d.ts","sourceRoot":"","sources":["../../../src/admin/adapters/devReload.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,gBAAgB,CAAA;CACpD,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAA"}
|
|
1
|
+
{"version":3,"file":"devReload.d.ts","sourceRoot":"","sources":["../../../src/admin/adapters/devReload.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,gBAAgB,CAAA;CACpD,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAA;AAIzC;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,aAAc,iBAAiB,GAAG,IAAI,KAAG,IAE9E,CAAA;AAED,8FAA8F;AAC9F,eAAO,MAAM,8BAA8B,QAAO,iBAAiB,GAAG,IAA0B,CAAA"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Strategy for dev-mode HMR/reload detection.
|
|
3
3
|
* Each framework adapter provides its own implementation.
|
|
4
|
-
*/
|
|
4
|
+
*/ let registeredStrategy = null;
|
|
5
|
+
/**
|
|
6
|
+
* Registers the strategy `getPayload` uses to learn the config changed on disk.
|
|
7
|
+
* Covers callers that never see `InitOptions`, such as `handleEndpoints`.
|
|
8
|
+
* Pass `null` to unregister.
|
|
9
|
+
*
|
|
10
|
+
* Scoped to this module instance rather than `globalThis`, so the registrar has
|
|
11
|
+
* to run in the same module graph as the `getPayload` calls it should affect.
|
|
12
|
+
* Framework adapters register from their server runtime, which resolves the
|
|
13
|
+
* same copy of `payload` as the app.
|
|
14
|
+
*/ export const registerDevReloadStrategy = (strategy)=>{
|
|
15
|
+
registeredStrategy = strategy;
|
|
16
|
+
};
|
|
17
|
+
/** The strategy set by {@link registerDevReloadStrategy}, or `null` if none is registered. */ export const getRegisteredDevReloadStrategy = ()=>registeredStrategy;
|
|
5
18
|
|
|
6
19
|
//# sourceMappingURL=devReload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/adapters/devReload.ts"],"sourcesContent":["/**\n * Strategy for dev-mode HMR/reload detection.\n * Each framework adapter provides its own implementation.\n */\nexport type DevReloadStrategy = {\n connect: (onReload: () => void) => DevReloadCleanup\n}\n\nexport type DevReloadCleanup = () => void\n"],"names":[],"mappings":"AAAA;;;CAGC,
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/adapters/devReload.ts"],"sourcesContent":["/**\n * Strategy for dev-mode HMR/reload detection.\n * Each framework adapter provides its own implementation.\n */\nexport type DevReloadStrategy = {\n connect: (onReload: () => void) => DevReloadCleanup\n}\n\nexport type DevReloadCleanup = () => void\n\nlet registeredStrategy: DevReloadStrategy | null = null\n\n/**\n * Registers the strategy `getPayload` uses to learn the config changed on disk.\n * Covers callers that never see `InitOptions`, such as `handleEndpoints`.\n * Pass `null` to unregister.\n *\n * Scoped to this module instance rather than `globalThis`, so the registrar has\n * to run in the same module graph as the `getPayload` calls it should affect.\n * Framework adapters register from their server runtime, which resolves the\n * same copy of `payload` as the app.\n */\nexport const registerDevReloadStrategy = (strategy: DevReloadStrategy | null): void => {\n registeredStrategy = strategy\n}\n\n/** The strategy set by {@link registerDevReloadStrategy}, or `null` if none is registered. */\nexport const getRegisteredDevReloadStrategy = (): DevReloadStrategy | null => registeredStrategy\n"],"names":["registeredStrategy","registerDevReloadStrategy","strategy","getRegisteredDevReloadStrategy"],"mappings":"AAAA;;;CAGC,GAOD,IAAIA,qBAA+C;AAEnD;;;;;;;;;CASC,GACD,OAAO,MAAMC,4BAA4B,CAACC;IACxCF,qBAAqBE;AACvB,EAAC;AAED,4FAA4F,GAC5F,OAAO,MAAMC,iCAAiC,IAAgCH,mBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/auth/endpoints/login.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/auth/endpoints/login.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAO3D,eAAO,MAAM,YAAY,EAAE,cAsC1B,CAAA"}
|
|
@@ -2,8 +2,7 @@ import { status as httpStatus } from 'http-status';
|
|
|
2
2
|
import { getRequestCollection } from '../../utilities/getRequestEntity.js';
|
|
3
3
|
import { headersWithCors } from '../../utilities/headersWithCors.js';
|
|
4
4
|
import { isNumber } from '../../utilities/isNumber.js';
|
|
5
|
-
import {
|
|
6
|
-
import { loginOperation } from '../operations/login.js';
|
|
5
|
+
import { loginWithCookie } from '../loginWithCookie.js';
|
|
7
6
|
export const loginHandler = async (req)=>{
|
|
8
7
|
const collection = getRequestCollection(req);
|
|
9
8
|
const { searchParams, t } = req;
|
|
@@ -16,20 +15,12 @@ export const loginHandler = async (req)=>{
|
|
|
16
15
|
email: typeof req.data?.email === 'string' ? req.data.email : '',
|
|
17
16
|
password: typeof req.data?.password === 'string' ? req.data.password : ''
|
|
18
17
|
};
|
|
19
|
-
const result = await
|
|
18
|
+
const { cookie, result } = await loginWithCookie({
|
|
20
19
|
collection,
|
|
21
20
|
data: authData,
|
|
22
21
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
23
22
|
req
|
|
24
23
|
});
|
|
25
|
-
const cookie = generatePayloadCookie({
|
|
26
|
-
collectionAuthConfig: collection.config.auth,
|
|
27
|
-
cookiePrefix: req.payload.config.cookiePrefix,
|
|
28
|
-
token: result.token
|
|
29
|
-
});
|
|
30
|
-
if (collection.config.auth.removeTokenFromResponses) {
|
|
31
|
-
delete result.token;
|
|
32
|
-
}
|
|
33
24
|
return Response.json({
|
|
34
25
|
message: t('authentication:passed'),
|
|
35
26
|
...result
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/auth/endpoints/login.ts"],"sourcesContent":["import { status as httpStatus } from 'http-status'\n\nimport type { PayloadHandler } from '../../config/types.js'\n\nimport { getRequestCollection } from '../../utilities/getRequestEntity.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\nimport { isNumber } from '../../utilities/isNumber.js'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/auth/endpoints/login.ts"],"sourcesContent":["import { status as httpStatus } from 'http-status'\n\nimport type { PayloadHandler } from '../../config/types.js'\n\nimport { getRequestCollection } from '../../utilities/getRequestEntity.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\nimport { isNumber } from '../../utilities/isNumber.js'\nimport { loginWithCookie } from '../loginWithCookie.js'\n\nexport const loginHandler: PayloadHandler = async (req) => {\n const collection = getRequestCollection(req)\n const { searchParams, t } = req\n const depth = searchParams.get('depth')\n const authData =\n collection.config.auth?.loginWithUsername !== false\n ? {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n password: typeof req.data?.password === 'string' ? req.data.password : '',\n username: typeof req.data?.username === 'string' ? req.data.username : '',\n }\n : {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n password: typeof req.data?.password === 'string' ? req.data.password : '',\n }\n\n const { cookie, result } = await loginWithCookie({\n collection,\n data: authData,\n depth: isNumber(depth) ? Number(depth) : undefined,\n req,\n })\n\n return Response.json(\n {\n message: t('authentication:passed'),\n ...result,\n },\n {\n headers: headersWithCors({\n headers: new Headers({\n 'Set-Cookie': cookie,\n }),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["status","httpStatus","getRequestCollection","headersWithCors","isNumber","loginWithCookie","loginHandler","req","collection","searchParams","t","depth","get","authData","config","auth","loginWithUsername","email","data","password","username","cookie","result","Number","undefined","Response","json","message","headers","Headers","OK"],"mappings":"AAAA,SAASA,UAAUC,UAAU,QAAQ,cAAa;AAIlD,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,QAAQ,QAAQ,8BAA6B;AACtD,SAASC,eAAe,QAAQ,wBAAuB;AAEvD,OAAO,MAAMC,eAA+B,OAAOC;IACjD,MAAMC,aAAaN,qBAAqBK;IACxC,MAAM,EAAEE,YAAY,EAAEC,CAAC,EAAE,GAAGH;IAC5B,MAAMI,QAAQF,aAAaG,GAAG,CAAC;IAC/B,MAAMC,WACJL,WAAWM,MAAM,CAACC,IAAI,EAAEC,sBAAsB,QAC1C;QACEC,OAAO,OAAOV,IAAIW,IAAI,EAAED,UAAU,WAAWV,IAAIW,IAAI,CAACD,KAAK,GAAG;QAC9DE,UAAU,OAAOZ,IAAIW,IAAI,EAAEC,aAAa,WAAWZ,IAAIW,IAAI,CAACC,QAAQ,GAAG;QACvEC,UAAU,OAAOb,IAAIW,IAAI,EAAEE,aAAa,WAAWb,IAAIW,IAAI,CAACE,QAAQ,GAAG;IACzE,IACA;QACEH,OAAO,OAAOV,IAAIW,IAAI,EAAED,UAAU,WAAWV,IAAIW,IAAI,CAACD,KAAK,GAAG;QAC9DE,UAAU,OAAOZ,IAAIW,IAAI,EAAEC,aAAa,WAAWZ,IAAIW,IAAI,CAACC,QAAQ,GAAG;IACzE;IAEN,MAAM,EAAEE,MAAM,EAAEC,MAAM,EAAE,GAAG,MAAMjB,gBAAgB;QAC/CG;QACAU,MAAML;QACNF,OAAOP,SAASO,SAASY,OAAOZ,SAASa;QACzCjB;IACF;IAEA,OAAOkB,SAASC,IAAI,CAClB;QACEC,SAASjB,EAAE;QACX,GAAGY,MAAM;IACX,GACA;QACEM,SAASzB,gBAAgB;YACvByB,SAAS,IAAIC,QAAQ;gBACnB,cAAcR;YAChB;YACAd;QACF;QACAP,QAAQC,WAAW6B,EAAE;IACvB;AAEJ,EAAC"}
|
|
@@ -7,6 +7,6 @@ type OperationArgs = {
|
|
|
7
7
|
isReadingStaticFile?: boolean;
|
|
8
8
|
req: PayloadRequest;
|
|
9
9
|
};
|
|
10
|
-
export declare const executeAccess: ({ id, data, disableErrors, isReadingStaticFile, req }: OperationArgs, access
|
|
10
|
+
export declare const executeAccess: ({ id, data, disableErrors, isReadingStaticFile, req }: OperationArgs, access?: Access) => Promise<AccessResult>;
|
|
11
11
|
export {};
|
|
12
12
|
//# sourceMappingURL=executeAccess.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeAccess.d.ts","sourceRoot":"","sources":["../../src/auth/executeAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAIvD,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AACD,eAAO,MAAM,aAAa,0DACuC,aAAa,
|
|
1
|
+
{"version":3,"file":"executeAccess.d.ts","sourceRoot":"","sources":["../../src/auth/executeAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAIvD,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AACD,eAAO,MAAM,aAAa,0DACuC,aAAa,WACnE,MAAM,KACd,OAAO,CAAC,YAAY,CA0BtB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/auth/executeAccess.ts"],"sourcesContent":["import type { Access, AccessResult } from '../config/types.js'\nimport type { PayloadRequest } from '../types/index.js'\n\nimport { Forbidden } from '../errors/index.js'\n\ntype OperationArgs = {\n data?: any\n disableErrors?: boolean\n id?: number | string\n isReadingStaticFile?: boolean\n req: PayloadRequest\n}\nexport const executeAccess = async (\n { id, data, disableErrors, isReadingStaticFile = false, req }: OperationArgs,\n access
|
|
1
|
+
{"version":3,"sources":["../../src/auth/executeAccess.ts"],"sourcesContent":["import type { Access, AccessResult } from '../config/types.js'\nimport type { PayloadRequest } from '../types/index.js'\n\nimport { Forbidden } from '../errors/index.js'\n\ntype OperationArgs = {\n data?: any\n disableErrors?: boolean\n id?: number | string\n isReadingStaticFile?: boolean\n req: PayloadRequest\n}\nexport const executeAccess = async (\n { id, data, disableErrors, isReadingStaticFile = false, req }: OperationArgs,\n access?: Access,\n): Promise<AccessResult> => {\n if (access) {\n const resolvedConstraint = await access({\n id,\n data,\n isReadingStaticFile,\n req,\n })\n\n if (!resolvedConstraint) {\n if (!disableErrors) {\n throw new Forbidden(req.t)\n }\n }\n\n return resolvedConstraint\n }\n\n if (req.user) {\n return true\n }\n\n if (!disableErrors) {\n throw new Forbidden(req.t)\n }\n return false\n}\n"],"names":["Forbidden","executeAccess","id","data","disableErrors","isReadingStaticFile","req","access","resolvedConstraint","t","user"],"mappings":"AAGA,SAASA,SAAS,QAAQ,qBAAoB;AAS9C,OAAO,MAAMC,gBAAgB,OAC3B,EAAEC,EAAE,EAAEC,IAAI,EAAEC,aAAa,EAAEC,sBAAsB,KAAK,EAAEC,GAAG,EAAiB,EAC5EC;IAEA,IAAIA,QAAQ;QACV,MAAMC,qBAAqB,MAAMD,OAAO;YACtCL;YACAC;YACAE;YACAC;QACF;QAEA,IAAI,CAACE,oBAAoB;YACvB,IAAI,CAACJ,eAAe;gBAClB,MAAM,IAAIJ,UAAUM,IAAIG,CAAC;YAC3B;QACF;QAEA,OAAOD;IACT;IAEA,IAAIF,IAAII,IAAI,EAAE;QACZ,OAAO;IACT;IAEA,IAAI,CAACN,eAAe;QAClB,MAAM,IAAIJ,UAAUM,IAAIG,CAAC;IAC3B;IACA,OAAO;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/auth/getLoginOptions.ts"],"sourcesContent":["import type { Auth } from './types.js'\n\nexport const getLoginOptions = (\n loginWithUsername: Auth['loginWithUsername'],\n): {\n canLoginWithEmail: boolean\n canLoginWithUsername: boolean\n} => {\n return {\n canLoginWithEmail: !loginWithUsername || loginWithUsername.allowEmailLogin
|
|
1
|
+
{"version":3,"sources":["../../src/auth/getLoginOptions.ts"],"sourcesContent":["import type { Auth } from './types.js'\n\nexport const getLoginOptions = (\n loginWithUsername: Auth['loginWithUsername'],\n): {\n canLoginWithEmail: boolean\n canLoginWithUsername: boolean\n} => {\n return {\n canLoginWithEmail: !loginWithUsername || loginWithUsername.allowEmailLogin,\n canLoginWithUsername: Boolean(loginWithUsername),\n }\n}\n"],"names":["getLoginOptions","loginWithUsername","canLoginWithEmail","allowEmailLogin","canLoginWithUsername","Boolean"],"mappings":"AAEA,OAAO,MAAMA,kBAAkB,CAC7BC;IAKA,OAAO;QACLC,mBAAmB,CAACD,qBAAqBA,kBAAkBE,eAAe;QAC1EC,sBAAsBC,QAAQJ;IAChC;AACF,EAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Collection } from '../collections/config/types.js';
|
|
2
|
+
import type { AuthCollectionSlug } from '../index.js';
|
|
3
|
+
import type { PayloadRequest } from '../types/index.js';
|
|
4
|
+
import type { generateCookie } from './cookies.js';
|
|
5
|
+
import type { LoginResult } from './operations/login.js';
|
|
6
|
+
import { loginOperation } from './operations/login.js';
|
|
7
|
+
type CookieObject = Extract<ReturnType<typeof generateCookie<true>>, {
|
|
8
|
+
name: string;
|
|
9
|
+
}>;
|
|
10
|
+
type LoginWithCookieArgs<TReturnCookieAsObject extends boolean> = {
|
|
11
|
+
collection: Collection;
|
|
12
|
+
data: Parameters<typeof loginOperation>[0]['data'];
|
|
13
|
+
depth?: number;
|
|
14
|
+
overrideAccess?: boolean;
|
|
15
|
+
req: PayloadRequest;
|
|
16
|
+
/** Return the cookie as parts rather than a serialized header string. */
|
|
17
|
+
returnCookieAsObject?: TReturnCookieAsObject;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Runs the login operation and builds the auth cookie from its token, then
|
|
21
|
+
* applies `auth.removeTokenFromResponses` to the returned result.
|
|
22
|
+
*
|
|
23
|
+
* The order matters: the token has to be read before the flag strips it, or the
|
|
24
|
+
* caller ends up returning a user with no way to establish a session. Shared by
|
|
25
|
+
* the REST login handler and the framework adapters' `login` server function so
|
|
26
|
+
* that ordering only exists in one place.
|
|
27
|
+
*/
|
|
28
|
+
export declare const loginWithCookie: <TSlug extends AuthCollectionSlug, TReturnCookieAsObject extends boolean = false>({ collection, data, depth, overrideAccess, req, returnCookieAsObject, }: LoginWithCookieArgs<TReturnCookieAsObject>) => Promise<{
|
|
29
|
+
cookie: TReturnCookieAsObject extends true ? CookieObject : string;
|
|
30
|
+
result: LoginResult<TSlug>;
|
|
31
|
+
}>;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=loginWithCookie.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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
1
|
+
import { generatePayloadCookie } from './cookies.js';
|
|
2
|
+
import { loginOperation } from './operations/login.js';
|
|
3
|
+
/**
|
|
4
|
+
* Runs the login operation and builds the auth cookie from its token, then
|
|
5
|
+
* applies `auth.removeTokenFromResponses` to the returned result.
|
|
6
|
+
*
|
|
7
|
+
* The order matters: the token has to be read before the flag strips it, or the
|
|
8
|
+
* caller ends up returning a user with no way to establish a session. Shared by
|
|
9
|
+
* the REST login handler and the framework adapters' `login` server function so
|
|
10
|
+
* that ordering only exists in one place.
|
|
11
|
+
*/ export const loginWithCookie = async ({ collection, data, depth, overrideAccess, req, returnCookieAsObject })=>{
|
|
12
|
+
const result = await loginOperation({
|
|
13
|
+
collection,
|
|
14
|
+
data,
|
|
15
|
+
depth,
|
|
16
|
+
overrideAccess,
|
|
17
|
+
req
|
|
18
|
+
});
|
|
19
|
+
const cookie = generatePayloadCookie({
|
|
20
|
+
collectionAuthConfig: collection.config.auth,
|
|
21
|
+
cookiePrefix: req.payload.config.cookiePrefix,
|
|
22
|
+
returnCookieAsObject: returnCookieAsObject ?? false,
|
|
23
|
+
token: result.token
|
|
24
|
+
});
|
|
25
|
+
if (collection.config.auth.removeTokenFromResponses) {
|
|
26
|
+
delete result.token;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
cookie,
|
|
30
|
+
result
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=loginWithCookie.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/auth/loginWithCookie.ts"],"sourcesContent":["import type { Collection } from '../collections/config/types.js'\nimport type { AuthCollectionSlug } from '../index.js'\nimport type { PayloadRequest } from '../types/index.js'\nimport type { generateCookie } from './cookies.js'\nimport type { LoginResult } from './operations/login.js'\n\nimport { generatePayloadCookie } from './cookies.js'\nimport { loginOperation } from './operations/login.js'\n\ntype CookieObject = Extract<ReturnType<typeof generateCookie<true>>, { name: string }>\n\ntype LoginWithCookieArgs<TReturnCookieAsObject extends boolean> = {\n collection: Collection\n data: Parameters<typeof loginOperation>[0]['data']\n depth?: number\n overrideAccess?: boolean\n req: PayloadRequest\n /** Return the cookie as parts rather than a serialized header string. */\n returnCookieAsObject?: TReturnCookieAsObject\n}\n\n/**\n * Runs the login operation and builds the auth cookie from its token, then\n * applies `auth.removeTokenFromResponses` to the returned result.\n *\n * The order matters: the token has to be read before the flag strips it, or the\n * caller ends up returning a user with no way to establish a session. Shared by\n * the REST login handler and the framework adapters' `login` server function so\n * that ordering only exists in one place.\n */\nexport const loginWithCookie = async <\n TSlug extends AuthCollectionSlug,\n TReturnCookieAsObject extends boolean = false,\n>({\n collection,\n data,\n depth,\n overrideAccess,\n req,\n returnCookieAsObject,\n}: LoginWithCookieArgs<TReturnCookieAsObject>): Promise<{\n cookie: TReturnCookieAsObject extends true ? CookieObject : string\n result: LoginResult<TSlug>\n}> => {\n const result = await loginOperation({\n collection,\n data,\n depth,\n overrideAccess,\n req,\n })\n\n const cookie = generatePayloadCookie({\n collectionAuthConfig: collection.config.auth,\n cookiePrefix: req.payload.config.cookiePrefix,\n returnCookieAsObject: returnCookieAsObject ?? false,\n token: result.token!,\n }) as TReturnCookieAsObject extends true ? CookieObject : string\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.token\n }\n\n return { cookie, result }\n}\n"],"names":["generatePayloadCookie","loginOperation","loginWithCookie","collection","data","depth","overrideAccess","req","returnCookieAsObject","result","cookie","collectionAuthConfig","config","auth","cookiePrefix","payload","token","removeTokenFromResponses"],"mappings":"AAMA,SAASA,qBAAqB,QAAQ,eAAc;AACpD,SAASC,cAAc,QAAQ,wBAAuB;AActD;;;;;;;;CAQC,GACD,OAAO,MAAMC,kBAAkB,OAG7B,EACAC,UAAU,EACVC,IAAI,EACJC,KAAK,EACLC,cAAc,EACdC,GAAG,EACHC,oBAAoB,EACuB;IAI3C,MAAMC,SAAS,MAAMR,eAAe;QAClCE;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,MAAMG,SAASV,sBAAsB;QACnCW,sBAAsBR,WAAWS,MAAM,CAACC,IAAI;QAC5CC,cAAcP,IAAIQ,OAAO,CAACH,MAAM,CAACE,YAAY;QAC7CN,sBAAsBA,wBAAwB;QAC9CQ,OAAOP,OAAOO,KAAK;IACrB;IAEA,IAAIb,WAAWS,MAAM,CAACC,IAAI,CAACI,wBAAwB,EAAE;QACnD,OAAOR,OAAOO,KAAK;IACrB;IAEA,OAAO;QAAEN;QAAQD;IAAO;AAC1B,EAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ServerAdapter } from '../../admin/adapters/server.js';
|
|
2
|
+
import type { Auth } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Object form returned by `generatePayloadCookie`/`generateExpiredPayloadCookie`
|
|
5
|
+
* when `returnCookieAsObject` is `true`.
|
|
6
|
+
*/
|
|
7
|
+
export type GeneratedCookie = {
|
|
8
|
+
domain?: string;
|
|
9
|
+
expires?: string;
|
|
10
|
+
httpOnly?: boolean;
|
|
11
|
+
maxAge?: number;
|
|
12
|
+
name: string;
|
|
13
|
+
path?: string;
|
|
14
|
+
sameSite?: 'Lax' | 'None' | 'Strict';
|
|
15
|
+
secure?: boolean;
|
|
16
|
+
value: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
type AuthCookieArgs = {
|
|
19
|
+
authConfig: Auth;
|
|
20
|
+
cookiePrefix: string;
|
|
21
|
+
serverAdapter: ServerAdapter;
|
|
22
|
+
};
|
|
23
|
+
/** Writes an already-generated cookie through the framework's cookie API. */
|
|
24
|
+
export declare function applyAuthCookie({ cookie, serverAdapter, }: {
|
|
25
|
+
cookie: GeneratedCookie;
|
|
26
|
+
serverAdapter: ServerAdapter;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
/** Writes the Payload auth cookie for `token` through the framework's cookie API. */
|
|
29
|
+
export declare function setAuthCookie({ authConfig, cookiePrefix, serverAdapter, token, }: {
|
|
30
|
+
token: string;
|
|
31
|
+
} & AuthCookieArgs): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Expires the Payload auth cookie. Written with the same `domain`/`path`/`secure`
|
|
34
|
+
* attributes it was set with — a mismatched `domain` leaves the original cookie
|
|
35
|
+
* in place.
|
|
36
|
+
*/
|
|
37
|
+
export declare function clearAuthCookie({ authConfig, cookiePrefix, serverAdapter, }: AuthCookieArgs): Promise<void>;
|
|
38
|
+
/** Reads the request's existing Payload auth cookie, if any. */
|
|
39
|
+
export declare function getExistingAuthToken({ cookiePrefix, serverAdapter, }: {
|
|
40
|
+
cookiePrefix: string;
|
|
41
|
+
serverAdapter: ServerAdapter;
|
|
42
|
+
}): Promise<{
|
|
43
|
+
name: string;
|
|
44
|
+
value: string;
|
|
45
|
+
} | undefined>;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=cookies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../../src/auth/serverFunctions/cookies.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAIvC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAA;IACpC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAC1B,CAAA;AAcD,KAAK,cAAc,GAAG;IACpB,UAAU,EAAE,IAAI,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,aAAa,CAAA;CAC7B,CAAA;AAED,6EAA6E;AAC7E,wBAAsB,eAAe,CAAC,EACpC,MAAM,EACN,aAAa,GACd,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,aAAa,EAAE,aAAa,CAAA;CAC7B,GAAG,OAAO,CAAC,IAAI,CAAC,CAMhB;AAED,qFAAqF;AACrF,wBAAsB,aAAa,CAAC,EAClC,UAAU,EACV,YAAY,EACZ,aAAa,EACb,KAAK,GACN,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CASpD;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,EACpC,UAAU,EACV,YAAY,EACZ,aAAa,GACd,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhC;AAED,gEAAgE;AAChE,wBAAsB,oBAAoB,CAAC,EACzC,YAAY,EACZ,aAAa,GACd,EAAE;IACD,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,aAAa,CAAA;CAC7B,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC,CASvD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { generateExpiredPayloadCookie, generatePayloadCookie } from '../cookies.js';
|
|
2
|
+
// `generateCookie` emits capitalized `SameSite` values (as they appear in the
|
|
3
|
+
// header); `CookieOptions` takes the lowercase form.
|
|
4
|
+
const toCookieOptions = (cookie)=>({
|
|
5
|
+
domain: cookie.domain,
|
|
6
|
+
expires: cookie.expires ? new Date(cookie.expires) : undefined,
|
|
7
|
+
httpOnly: cookie.httpOnly,
|
|
8
|
+
maxAge: cookie.maxAge,
|
|
9
|
+
path: cookie.path,
|
|
10
|
+
sameSite: cookie.sameSite?.toLowerCase(),
|
|
11
|
+
secure: cookie.secure
|
|
12
|
+
});
|
|
13
|
+
/** Writes an already-generated cookie through the framework's cookie API. */ export async function applyAuthCookie({ cookie, serverAdapter }) {
|
|
14
|
+
if (!cookie.value) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
await serverAdapter.setCookie(cookie.name, cookie.value, toCookieOptions(cookie));
|
|
18
|
+
}
|
|
19
|
+
/** Writes the Payload auth cookie for `token` through the framework's cookie API. */ export async function setAuthCookie({ authConfig, cookiePrefix, serverAdapter, token }) {
|
|
20
|
+
const cookie = generatePayloadCookie({
|
|
21
|
+
collectionAuthConfig: authConfig,
|
|
22
|
+
cookiePrefix,
|
|
23
|
+
returnCookieAsObject: true,
|
|
24
|
+
token
|
|
25
|
+
});
|
|
26
|
+
await applyAuthCookie({
|
|
27
|
+
cookie,
|
|
28
|
+
serverAdapter
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Expires the Payload auth cookie. Written with the same `domain`/`path`/`secure`
|
|
33
|
+
* attributes it was set with — a mismatched `domain` leaves the original cookie
|
|
34
|
+
* in place.
|
|
35
|
+
*/ export async function clearAuthCookie({ authConfig, cookiePrefix, serverAdapter }) {
|
|
36
|
+
const cookie = generateExpiredPayloadCookie({
|
|
37
|
+
collectionAuthConfig: authConfig,
|
|
38
|
+
cookiePrefix,
|
|
39
|
+
returnCookieAsObject: true
|
|
40
|
+
});
|
|
41
|
+
await serverAdapter.setCookie(cookie.name, '', toCookieOptions(cookie));
|
|
42
|
+
}
|
|
43
|
+
/** Reads the request's existing Payload auth cookie, if any. */ export async function getExistingAuthToken({ cookiePrefix, serverAdapter }) {
|
|
44
|
+
const store = await serverAdapter.getCookies();
|
|
45
|
+
const allCookies = store.getAll?.();
|
|
46
|
+
if (allCookies) {
|
|
47
|
+
return allCookies.find((cookie)=>cookie.name.startsWith(cookiePrefix));
|
|
48
|
+
}
|
|
49
|
+
return store.get(`${cookiePrefix}-token`) ?? undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=cookies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/auth/serverFunctions/cookies.ts"],"sourcesContent":["import type { CookieOptions } from '../../admin/adapters/cookies.js'\nimport type { ServerAdapter } from '../../admin/adapters/server.js'\nimport type { Auth } from '../types.js'\n\nimport { generateExpiredPayloadCookie, generatePayloadCookie } from '../cookies.js'\n\n/**\n * Object form returned by `generatePayloadCookie`/`generateExpiredPayloadCookie`\n * when `returnCookieAsObject` is `true`.\n */\nexport type GeneratedCookie = {\n domain?: string\n expires?: string\n httpOnly?: boolean\n maxAge?: number\n name: string\n path?: string\n sameSite?: 'Lax' | 'None' | 'Strict'\n secure?: boolean\n value: string | undefined\n}\n\n// `generateCookie` emits capitalized `SameSite` values (as they appear in the\n// header); `CookieOptions` takes the lowercase form.\nconst toCookieOptions = (cookie: GeneratedCookie): CookieOptions => ({\n domain: cookie.domain,\n expires: cookie.expires ? new Date(cookie.expires) : undefined,\n httpOnly: cookie.httpOnly,\n maxAge: cookie.maxAge,\n path: cookie.path,\n sameSite: cookie.sameSite?.toLowerCase() as CookieOptions['sameSite'],\n secure: cookie.secure,\n})\n\ntype AuthCookieArgs = {\n authConfig: Auth\n cookiePrefix: string\n serverAdapter: ServerAdapter\n}\n\n/** Writes an already-generated cookie through the framework's cookie API. */\nexport async function applyAuthCookie({\n cookie,\n serverAdapter,\n}: {\n cookie: GeneratedCookie\n serverAdapter: ServerAdapter\n}): Promise<void> {\n if (!cookie.value) {\n return\n }\n\n await serverAdapter.setCookie(cookie.name, cookie.value, toCookieOptions(cookie))\n}\n\n/** Writes the Payload auth cookie for `token` through the framework's cookie API. */\nexport async function setAuthCookie({\n authConfig,\n cookiePrefix,\n serverAdapter,\n token,\n}: { token: string } & AuthCookieArgs): Promise<void> {\n const cookie = generatePayloadCookie({\n collectionAuthConfig: authConfig,\n cookiePrefix,\n returnCookieAsObject: true,\n token,\n }) as GeneratedCookie\n\n await applyAuthCookie({ cookie, serverAdapter })\n}\n\n/**\n * Expires the Payload auth cookie. Written with the same `domain`/`path`/`secure`\n * attributes it was set with — a mismatched `domain` leaves the original cookie\n * in place.\n */\nexport async function clearAuthCookie({\n authConfig,\n cookiePrefix,\n serverAdapter,\n}: AuthCookieArgs): Promise<void> {\n const cookie = generateExpiredPayloadCookie({\n collectionAuthConfig: authConfig,\n cookiePrefix,\n returnCookieAsObject: true,\n }) as GeneratedCookie\n\n await serverAdapter.setCookie(cookie.name, '', toCookieOptions(cookie))\n}\n\n/** Reads the request's existing Payload auth cookie, if any. */\nexport async function getExistingAuthToken({\n cookiePrefix,\n serverAdapter,\n}: {\n cookiePrefix: string\n serverAdapter: ServerAdapter\n}): Promise<{ name: string; value: string } | undefined> {\n const store = await serverAdapter.getCookies()\n const allCookies = store.getAll?.()\n\n if (allCookies) {\n return allCookies.find((cookie) => cookie.name.startsWith(cookiePrefix))\n }\n\n return store.get(`${cookiePrefix}-token`) ?? undefined\n}\n"],"names":["generateExpiredPayloadCookie","generatePayloadCookie","toCookieOptions","cookie","domain","expires","Date","undefined","httpOnly","maxAge","path","sameSite","toLowerCase","secure","applyAuthCookie","serverAdapter","value","setCookie","name","setAuthCookie","authConfig","cookiePrefix","token","collectionAuthConfig","returnCookieAsObject","clearAuthCookie","getExistingAuthToken","store","getCookies","allCookies","getAll","find","startsWith","get"],"mappings":"AAIA,SAASA,4BAA4B,EAAEC,qBAAqB,QAAQ,gBAAe;AAkBnF,8EAA8E;AAC9E,qDAAqD;AACrD,MAAMC,kBAAkB,CAACC,SAA4C,CAAA;QACnEC,QAAQD,OAAOC,MAAM;QACrBC,SAASF,OAAOE,OAAO,GAAG,IAAIC,KAAKH,OAAOE,OAAO,IAAIE;QACrDC,UAAUL,OAAOK,QAAQ;QACzBC,QAAQN,OAAOM,MAAM;QACrBC,MAAMP,OAAOO,IAAI;QACjBC,UAAUR,OAAOQ,QAAQ,EAAEC;QAC3BC,QAAQV,OAAOU,MAAM;IACvB,CAAA;AAQA,2EAA2E,GAC3E,OAAO,eAAeC,gBAAgB,EACpCX,MAAM,EACNY,aAAa,EAId;IACC,IAAI,CAACZ,OAAOa,KAAK,EAAE;QACjB;IACF;IAEA,MAAMD,cAAcE,SAAS,CAACd,OAAOe,IAAI,EAAEf,OAAOa,KAAK,EAAEd,gBAAgBC;AAC3E;AAEA,mFAAmF,GACnF,OAAO,eAAegB,cAAc,EAClCC,UAAU,EACVC,YAAY,EACZN,aAAa,EACbO,KAAK,EAC8B;IACnC,MAAMnB,SAASF,sBAAsB;QACnCsB,sBAAsBH;QACtBC;QACAG,sBAAsB;QACtBF;IACF;IAEA,MAAMR,gBAAgB;QAAEX;QAAQY;IAAc;AAChD;AAEA;;;;CAIC,GACD,OAAO,eAAeU,gBAAgB,EACpCL,UAAU,EACVC,YAAY,EACZN,aAAa,EACE;IACf,MAAMZ,SAASH,6BAA6B;QAC1CuB,sBAAsBH;QACtBC;QACAG,sBAAsB;IACxB;IAEA,MAAMT,cAAcE,SAAS,CAACd,OAAOe,IAAI,EAAE,IAAIhB,gBAAgBC;AACjE;AAEA,8DAA8D,GAC9D,OAAO,eAAeuB,qBAAqB,EACzCL,YAAY,EACZN,aAAa,EAId;IACC,MAAMY,QAAQ,MAAMZ,cAAca,UAAU;IAC5C,MAAMC,aAAaF,MAAMG,MAAM;IAE/B,IAAID,YAAY;QACd,OAAOA,WAAWE,IAAI,CAAC,CAAC5B,SAAWA,OAAOe,IAAI,CAACc,UAAU,CAACX;IAC5D;IAEA,OAAOM,MAAMM,GAAG,CAAC,GAAGZ,aAAa,MAAM,CAAC,KAAKd;AAC/C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ServerAdapter } from '../../admin/adapters/server.js';
|
|
2
|
+
import type { SanitizedConfig } from '../../config/types.js';
|
|
3
|
+
import type { AuthCollectionSlug } from '../../index.js';
|
|
4
|
+
import type { MaybePromise } from '../../types/index.js';
|
|
5
|
+
import type { LoginResult } from '../operations/login.js';
|
|
6
|
+
export type LoginArgs<TSlug extends AuthCollectionSlug> = {
|
|
7
|
+
collection: TSlug;
|
|
8
|
+
config: MaybePromise<SanitizedConfig>;
|
|
9
|
+
password: string;
|
|
10
|
+
serverAdapter: ServerAdapter;
|
|
11
|
+
} & ({
|
|
12
|
+
email: string;
|
|
13
|
+
username?: never;
|
|
14
|
+
} | {
|
|
15
|
+
email?: never;
|
|
16
|
+
username: string;
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* `LoginArgs` as the adapters expose it — they bind `serverAdapter` themselves.
|
|
20
|
+
* Distributes over the email/username union so the either-or survives; a plain
|
|
21
|
+
* `Omit` collapses the union and accepts both keys at once.
|
|
22
|
+
*/
|
|
23
|
+
export type LoginArgsWithoutServerAdapter<TSlug extends AuthCollectionSlug> = LoginArgs<TSlug> extends infer TArgs ? TArgs extends unknown ? Omit<TArgs, 'serverAdapter'> : never : never;
|
|
24
|
+
/**
|
|
25
|
+
* Logs a user in and writes the auth cookie through the supplied `serverAdapter`,
|
|
26
|
+
* so the function is framework-agnostic; each adapter binds its own.
|
|
27
|
+
*/
|
|
28
|
+
export declare function login<TSlug extends AuthCollectionSlug>({ collection, config, email, password, serverAdapter, username, }: LoginArgs<TSlug>): Promise<LoginResult<TSlug>>;
|
|
29
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/auth/serverFunctions/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAOzD,MAAM,MAAM,SAAS,CAAC,KAAK,SAAS,kBAAkB,IAAI;IACxD,UAAU,EAAE,KAAK,CAAA;IACjB,MAAM,EAAE,YAAY,CAAC,eAAe,CAAC,CAAA;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,aAAa,CAAA;CAC7B,GAAG,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAE/E;;;;GAIG;AACH,MAAM,MAAM,6BAA6B,CAAC,KAAK,SAAS,kBAAkB,IACxE,SAAS,CAAC,KAAK,CAAC,SAAS,MAAM,KAAK,GAChC,KAAK,SAAS,OAAO,GACnB,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,GAC5B,KAAK,GACP,KAAK,CAAA;AAEX;;;GAGG;AACH,wBAAsB,KAAK,CAAC,KAAK,SAAS,kBAAkB,EAAE,EAC5D,UAAU,EACV,MAAM,EACN,KAAK,EACL,QAAQ,EACR,aAAa,EACb,QAAQ,GACT,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAgDhD"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { getPayload } from '../../index.js';
|
|
2
|
+
import { createLocalReq } from '../../utilities/createLocalReq.js';
|
|
3
|
+
import { loginWithCookie } from '../loginWithCookie.js';
|
|
4
|
+
import { applyAuthCookie } from './cookies.js';
|
|
5
|
+
/**
|
|
6
|
+
* Logs a user in and writes the auth cookie through the supplied `serverAdapter`,
|
|
7
|
+
* so the function is framework-agnostic; each adapter binds its own.
|
|
8
|
+
*/ export async function login({ collection, config, email, password, serverAdapter, username }) {
|
|
9
|
+
const payload = await getPayload({
|
|
10
|
+
config,
|
|
11
|
+
cron: true
|
|
12
|
+
});
|
|
13
|
+
const authConfig = payload.collections[collection]?.config.auth;
|
|
14
|
+
if (!authConfig) {
|
|
15
|
+
throw new Error(`No auth config found for collection: ${collection}`);
|
|
16
|
+
}
|
|
17
|
+
const loginWithUsername = authConfig.loginWithUsername ?? false;
|
|
18
|
+
if (loginWithUsername) {
|
|
19
|
+
if (loginWithUsername.allowEmailLogin) {
|
|
20
|
+
if (!email && !username) {
|
|
21
|
+
throw new Error('Email or username is required.');
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
if (!username) {
|
|
25
|
+
throw new Error('Username is required.');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
if (!email) {
|
|
30
|
+
throw new Error('Email is required.');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
let loginData;
|
|
34
|
+
if (loginWithUsername) {
|
|
35
|
+
loginData = username ? {
|
|
36
|
+
password,
|
|
37
|
+
username
|
|
38
|
+
} : {
|
|
39
|
+
email,
|
|
40
|
+
password
|
|
41
|
+
};
|
|
42
|
+
} else {
|
|
43
|
+
loginData = {
|
|
44
|
+
email,
|
|
45
|
+
password
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const collectionConfig = payload.collections[collection];
|
|
49
|
+
const { cookie, result } = await loginWithCookie({
|
|
50
|
+
collection: collectionConfig,
|
|
51
|
+
data: loginData,
|
|
52
|
+
overrideAccess: true,
|
|
53
|
+
req: await createLocalReq({}, payload),
|
|
54
|
+
returnCookieAsObject: true
|
|
55
|
+
});
|
|
56
|
+
await applyAuthCookie({
|
|
57
|
+
cookie,
|
|
58
|
+
serverAdapter
|
|
59
|
+
});
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/auth/serverFunctions/login.ts"],"sourcesContent":["import type { ServerAdapter } from '../../admin/adapters/server.js'\nimport type { SanitizedConfig } from '../../config/types.js'\nimport type { AuthCollectionSlug } from '../../index.js'\nimport type { MaybePromise } from '../../types/index.js'\nimport type { LoginResult } from '../operations/login.js'\n\nimport { getPayload } from '../../index.js'\nimport { createLocalReq } from '../../utilities/createLocalReq.js'\nimport { loginWithCookie } from '../loginWithCookie.js'\nimport { applyAuthCookie } from './cookies.js'\n\nexport type LoginArgs<TSlug extends AuthCollectionSlug> = {\n collection: TSlug\n config: MaybePromise<SanitizedConfig>\n password: string\n serverAdapter: ServerAdapter\n} & ({ email: string; username?: never } | { email?: never; username: string })\n\n/**\n * `LoginArgs` as the adapters expose it — they bind `serverAdapter` themselves.\n * Distributes over the email/username union so the either-or survives; a plain\n * `Omit` collapses the union and accepts both keys at once.\n */\nexport type LoginArgsWithoutServerAdapter<TSlug extends AuthCollectionSlug> =\n LoginArgs<TSlug> extends infer TArgs\n ? TArgs extends unknown\n ? Omit<TArgs, 'serverAdapter'>\n : never\n : never\n\n/**\n * Logs a user in and writes the auth cookie through the supplied `serverAdapter`,\n * so the function is framework-agnostic; each adapter binds its own.\n */\nexport async function login<TSlug extends AuthCollectionSlug>({\n collection,\n config,\n email,\n password,\n serverAdapter,\n username,\n}: LoginArgs<TSlug>): Promise<LoginResult<TSlug>> {\n const payload = await getPayload({ config, cron: true })\n\n const authConfig = payload.collections[collection]?.config.auth\n\n if (!authConfig) {\n throw new Error(`No auth config found for collection: ${collection}`)\n }\n\n const loginWithUsername = authConfig.loginWithUsername ?? false\n\n if (loginWithUsername) {\n if (loginWithUsername.allowEmailLogin) {\n if (!email && !username) {\n throw new Error('Email or username is required.')\n }\n } else {\n if (!username) {\n throw new Error('Username is required.')\n }\n }\n } else {\n if (!email) {\n throw new Error('Email is required.')\n }\n }\n\n let loginData\n\n if (loginWithUsername) {\n loginData = username ? { password, username } : { email, password }\n } else {\n loginData = { email, password }\n }\n\n const collectionConfig = payload.collections[collection]!\n\n const { cookie, result } = await loginWithCookie({\n collection: collectionConfig,\n data: loginData as Parameters<typeof loginWithCookie>[0]['data'],\n overrideAccess: true,\n req: await createLocalReq({}, payload),\n returnCookieAsObject: true,\n })\n\n await applyAuthCookie({ cookie, serverAdapter })\n\n return result as LoginResult<TSlug>\n}\n"],"names":["getPayload","createLocalReq","loginWithCookie","applyAuthCookie","login","collection","config","email","password","serverAdapter","username","payload","cron","authConfig","collections","auth","Error","loginWithUsername","allowEmailLogin","loginData","collectionConfig","cookie","result","data","overrideAccess","req","returnCookieAsObject"],"mappings":"AAMA,SAASA,UAAU,QAAQ,iBAAgB;AAC3C,SAASC,cAAc,QAAQ,oCAAmC;AAClE,SAASC,eAAe,QAAQ,wBAAuB;AACvD,SAASC,eAAe,QAAQ,eAAc;AAqB9C;;;CAGC,GACD,OAAO,eAAeC,MAAwC,EAC5DC,UAAU,EACVC,MAAM,EACNC,KAAK,EACLC,QAAQ,EACRC,aAAa,EACbC,QAAQ,EACS;IACjB,MAAMC,UAAU,MAAMX,WAAW;QAAEM;QAAQM,MAAM;IAAK;IAEtD,MAAMC,aAAaF,QAAQG,WAAW,CAACT,WAAW,EAAEC,OAAOS;IAE3D,IAAI,CAACF,YAAY;QACf,MAAM,IAAIG,MAAM,CAAC,qCAAqC,EAAEX,YAAY;IACtE;IAEA,MAAMY,oBAAoBJ,WAAWI,iBAAiB,IAAI;IAE1D,IAAIA,mBAAmB;QACrB,IAAIA,kBAAkBC,eAAe,EAAE;YACrC,IAAI,CAACX,SAAS,CAACG,UAAU;gBACvB,MAAM,IAAIM,MAAM;YAClB;QACF,OAAO;YACL,IAAI,CAACN,UAAU;gBACb,MAAM,IAAIM,MAAM;YAClB;QACF;IACF,OAAO;QACL,IAAI,CAACT,OAAO;YACV,MAAM,IAAIS,MAAM;QAClB;IACF;IAEA,IAAIG;IAEJ,IAAIF,mBAAmB;QACrBE,YAAYT,WAAW;YAAEF;YAAUE;QAAS,IAAI;YAAEH;YAAOC;QAAS;IACpE,OAAO;QACLW,YAAY;YAAEZ;YAAOC;QAAS;IAChC;IAEA,MAAMY,mBAAmBT,QAAQG,WAAW,CAACT,WAAW;IAExD,MAAM,EAAEgB,MAAM,EAAEC,MAAM,EAAE,GAAG,MAAMpB,gBAAgB;QAC/CG,YAAYe;QACZG,MAAMJ;QACNK,gBAAgB;QAChBC,KAAK,MAAMxB,eAAe,CAAC,GAAGU;QAC9Be,sBAAsB;IACxB;IAEA,MAAMvB,gBAAgB;QAAEkB;QAAQZ;IAAc;IAE9C,OAAOa;AACT"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ServerAdapter } from '../../admin/adapters/server.js';
|
|
2
|
+
import type { SanitizedConfig } from '../../config/types.js';
|
|
3
|
+
import type { MaybePromise } from '../../types/index.js';
|
|
4
|
+
export type LogoutArgs = {
|
|
5
|
+
allSessions?: boolean;
|
|
6
|
+
config: MaybePromise<SanitizedConfig>;
|
|
7
|
+
serverAdapter: ServerAdapter;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Logs the current user out and expires the auth cookie through the supplied
|
|
11
|
+
* `serverAdapter`, so the function is framework-agnostic; each adapter binds its own.
|
|
12
|
+
*/
|
|
13
|
+
export declare function logout({ allSessions, config, serverAdapter, }: LogoutArgs): Promise<{
|
|
14
|
+
message: string;
|
|
15
|
+
success: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=logout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/auth/serverFunctions/logout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAOxD,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,EAAE,YAAY,CAAC,eAAe,CAAC,CAAA;IACrC,aAAa,EAAE,aAAa,CAAA;CAC7B,CAAA;AAED;;;GAGG;AACH,wBAAsB,MAAM,CAAC,EAC3B,WAAmB,EACnB,MAAM,EACN,aAAa,GACd,EAAE,UAAU,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAoC7D"}
|