payload 3.0.0-beta.72 → 3.0.0-beta.74
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 +2 -1
- package/dist/admin/RichText.d.ts.map +1 -1
- package/dist/admin/RichText.js.map +1 -1
- package/dist/admin/elements/Cell.d.ts +1 -0
- package/dist/admin/elements/Cell.d.ts.map +1 -1
- package/dist/admin/elements/Cell.js.map +1 -1
- package/dist/admin/fields/Array.d.ts +3 -1
- package/dist/admin/fields/Array.d.ts.map +1 -1
- package/dist/admin/fields/Array.js.map +1 -1
- package/dist/admin/fields/Blocks.d.ts +3 -1
- package/dist/admin/fields/Blocks.d.ts.map +1 -1
- package/dist/admin/fields/Blocks.js.map +1 -1
- package/dist/admin/fields/Checkbox.d.ts +3 -1
- package/dist/admin/fields/Checkbox.d.ts.map +1 -1
- package/dist/admin/fields/Checkbox.js.map +1 -1
- package/dist/admin/fields/Code.d.ts +3 -1
- package/dist/admin/fields/Code.d.ts.map +1 -1
- package/dist/admin/fields/Code.js.map +1 -1
- package/dist/admin/fields/Date.d.ts +3 -1
- package/dist/admin/fields/Date.d.ts.map +1 -1
- package/dist/admin/fields/Date.js.map +1 -1
- package/dist/admin/fields/Email.d.ts +3 -1
- package/dist/admin/fields/Email.d.ts.map +1 -1
- package/dist/admin/fields/Email.js.map +1 -1
- package/dist/admin/fields/JSON.d.ts +3 -1
- package/dist/admin/fields/JSON.d.ts.map +1 -1
- package/dist/admin/fields/JSON.js.map +1 -1
- package/dist/admin/fields/Number.d.ts +3 -1
- package/dist/admin/fields/Number.d.ts.map +1 -1
- package/dist/admin/fields/Number.js.map +1 -1
- package/dist/admin/fields/Point.d.ts +3 -1
- package/dist/admin/fields/Point.d.ts.map +1 -1
- package/dist/admin/fields/Point.js.map +1 -1
- package/dist/admin/fields/Radio.d.ts +3 -1
- package/dist/admin/fields/Radio.d.ts.map +1 -1
- package/dist/admin/fields/Radio.js.map +1 -1
- package/dist/admin/fields/Relationship.d.ts +3 -1
- package/dist/admin/fields/Relationship.d.ts.map +1 -1
- package/dist/admin/fields/Relationship.js.map +1 -1
- package/dist/admin/fields/RichText.d.ts +3 -1
- package/dist/admin/fields/RichText.d.ts.map +1 -1
- package/dist/admin/fields/RichText.js.map +1 -1
- package/dist/admin/fields/Select.d.ts +3 -1
- package/dist/admin/fields/Select.d.ts.map +1 -1
- package/dist/admin/fields/Select.js.map +1 -1
- package/dist/admin/fields/Text.d.ts +3 -1
- package/dist/admin/fields/Text.d.ts.map +1 -1
- package/dist/admin/fields/Text.js.map +1 -1
- package/dist/admin/fields/Textarea.d.ts +3 -1
- package/dist/admin/fields/Textarea.d.ts.map +1 -1
- package/dist/admin/fields/Textarea.js.map +1 -1
- package/dist/admin/fields/Upload.d.ts +3 -2
- package/dist/admin/fields/Upload.d.ts.map +1 -1
- package/dist/admin/fields/Upload.js.map +1 -1
- package/dist/admin/forms/FieldDescription.d.ts +1 -2
- package/dist/admin/forms/FieldDescription.d.ts.map +1 -1
- package/dist/admin/forms/FieldDescription.js.map +1 -1
- package/dist/admin/forms/Form.d.ts +2 -2
- package/dist/admin/forms/Form.d.ts.map +1 -1
- package/dist/admin/forms/Form.js.map +1 -1
- package/dist/admin/forms/Label.d.ts +5 -3
- package/dist/admin/forms/Label.d.ts.map +1 -1
- package/dist/admin/forms/Label.js.map +1 -1
- package/dist/auth/baseFields/email.d.ts +2 -4
- package/dist/auth/baseFields/email.d.ts.map +1 -1
- package/dist/auth/baseFields/email.js +21 -21
- package/dist/auth/baseFields/email.js.map +1 -1
- package/dist/auth/baseFields/username.d.ts +2 -2
- package/dist/auth/baseFields/username.d.ts.map +1 -1
- package/dist/auth/baseFields/username.js +1 -1
- package/dist/auth/baseFields/username.js.map +1 -1
- package/dist/auth/ensureUsernameOrEmail.d.ts +17 -0
- package/dist/auth/ensureUsernameOrEmail.d.ts.map +1 -0
- package/dist/auth/ensureUsernameOrEmail.js +43 -0
- package/dist/auth/ensureUsernameOrEmail.js.map +1 -0
- package/dist/auth/getAuthFields.d.ts.map +1 -1
- package/dist/auth/getAuthFields.js +18 -10
- package/dist/auth/getAuthFields.js.map +1 -1
- package/dist/auth/operations/registerFirstUser.d.ts.map +1 -1
- package/dist/auth/operations/registerFirstUser.js +8 -0
- package/dist/auth/operations/registerFirstUser.js.map +1 -1
- package/dist/auth/types.d.ts +6 -1
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/collections/config/defaults.d.ts.map +1 -1
- package/dist/collections/config/defaults.js +2 -1
- package/dist/collections/config/defaults.js.map +1 -1
- package/dist/collections/config/sanitize.d.ts.map +1 -1
- package/dist/collections/config/sanitize.js +17 -4
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/collections/operations/create.d.ts.map +1 -1
- package/dist/collections/operations/create.js +8 -0
- package/dist/collections/operations/create.js.map +1 -1
- package/dist/collections/operations/update.d.ts.map +1 -1
- package/dist/collections/operations/update.js +11 -0
- package/dist/collections/operations/update.js.map +1 -1
- package/dist/collections/operations/updateByID.d.ts.map +1 -1
- package/dist/collections/operations/updateByID.js +11 -0
- package/dist/collections/operations/updateByID.js.map +1 -1
- package/dist/errors/ValidationError.d.ts +6 -8
- package/dist/errors/ValidationError.d.ts.map +1 -1
- package/dist/errors/ValidationError.js.map +1 -1
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js.map +1 -1
- package/dist/fields/config/client.d.ts +16 -15
- package/dist/fields/config/client.d.ts.map +1 -1
- package/dist/fields/config/types.d.ts +3 -1
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.js +1 -0
- package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
- package/dist/fields/validations.d.ts +65 -74
- package/dist/fields/validations.d.ts.map +1 -1
- package/dist/fields/validations.js +20 -4
- package/dist/fields/validations.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/uploads/types.d.ts +6 -0
- package/dist/uploads/types.d.ts.map +1 -1
- package/dist/uploads/types.js.map +1 -1
- package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
- package/dist/utilities/configToJSONSchema.js +88 -57
- package/dist/utilities/configToJSONSchema.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TextField } from '../../fields/config/types.js';
|
|
2
|
+
import type { TextFieldValidation } from '../../fields/validations.js';
|
|
2
3
|
import type { ErrorComponent } from '../forms/Error.js';
|
|
3
4
|
import type { DescriptionComponent, FormFieldBase, LabelComponent } from '../types.js';
|
|
4
5
|
export type TextFieldProps = {
|
|
@@ -12,8 +13,9 @@ export type TextFieldProps = {
|
|
|
12
13
|
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
13
14
|
path?: string;
|
|
14
15
|
placeholder?: TextField['admin']['placeholder'];
|
|
16
|
+
validate?: TextFieldValidation;
|
|
15
17
|
width?: string;
|
|
16
|
-
} & FormFieldBase
|
|
18
|
+
} & Omit<FormFieldBase, 'validate'>;
|
|
17
19
|
export type TextFieldLabelComponent = LabelComponent<'text'>;
|
|
18
20
|
export type TextFieldDescriptionComponent = DescriptionComponent<'text'>;
|
|
19
21
|
export type TextFieldErrorComponent = ErrorComponent<'text'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/admin/fields/Text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,a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b,SAAS,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAA;IACxD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAA;IAC/C,QAAQ,CAAC,EAAE,mBAAmB,CAAA;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;AAEnC,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;AAE5D,MAAM,MAAM,6BAA6B,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAA;AAExE,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/fields/Text.ts"],"sourcesContent":["import type { TextField } from '../../fields/config/types.js'\nimport type { ErrorComponent } from '../forms/Error.js'\nimport type { DescriptionComponent, FormFieldBase, LabelComponent } from '../types.js'\n\nexport type TextFieldProps = {\n hasMany?: boolean\n inputRef?: React.MutableRefObject<HTMLInputElement>\n maxLength?: number\n maxRows?: number\n minLength?: number\n minRows?: number\n name?: string\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>\n path?: string\n placeholder?: TextField['admin']['placeholder']\n width?: string\n} & FormFieldBase
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/fields/Text.ts"],"sourcesContent":["import type { TextField } from '../../fields/config/types.js'\nimport type { TextFieldValidation } from '../../fields/validations.js'\nimport type { ErrorComponent } from '../forms/Error.js'\nimport type { DescriptionComponent, FormFieldBase, LabelComponent } from '../types.js'\n\nexport type TextFieldProps = {\n hasMany?: boolean\n inputRef?: React.MutableRefObject<HTMLInputElement>\n maxLength?: number\n maxRows?: number\n minLength?: number\n minRows?: number\n name?: string\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>\n path?: string\n placeholder?: TextField['admin']['placeholder']\n validate?: TextFieldValidation\n width?: string\n} & Omit<FormFieldBase, 'validate'>\n\nexport type TextFieldLabelComponent = LabelComponent<'text'>\n\nexport type TextFieldDescriptionComponent = DescriptionComponent<'text'>\n\nexport type TextFieldErrorComponent = ErrorComponent<'text'>\n"],"names":[],"mappings":"AAwBA,WAA4D"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TextareaField } from '../../fields/config/types.js';
|
|
2
|
+
import type { TextareaFieldValidation } from '../../fields/validations.js';
|
|
2
3
|
import type { ErrorComponent } from '../forms/Error.js';
|
|
3
4
|
import type { DescriptionComponent, FormFieldBase, LabelComponent } from '../types.js';
|
|
4
5
|
export type TextareaFieldProps = {
|
|
@@ -8,8 +9,9 @@ export type TextareaFieldProps = {
|
|
|
8
9
|
path?: string;
|
|
9
10
|
placeholder?: TextareaField['admin']['placeholder'];
|
|
10
11
|
rows?: number;
|
|
12
|
+
validate?: TextareaFieldValidation;
|
|
11
13
|
width?: string;
|
|
12
|
-
} & FormFieldBase
|
|
14
|
+
} & Omit<FormFieldBase, 'validate'>;
|
|
13
15
|
export type TextareaFieldLabelComponent = LabelComponent<'textarea'>;
|
|
14
16
|
export type TextareaFieldDescriptionComponent = DescriptionComponent<'textarea'>;
|
|
15
17
|
export type TextareaFieldErrorComponent = ErrorComponent<'textarea'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../src/admin/fields/Textarea.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEtF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SA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@@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/fields/Textarea.ts"],"sourcesContent":["import type { TextareaField } from '../../fields/config/types.js'\nimport type { ErrorComponent } from '../forms/Error.js'\nimport type { DescriptionComponent, FormFieldBase, LabelComponent } from '../types.js'\n\nexport type TextareaFieldProps = {\n maxLength?: number\n minLength?: number\n name?: string\n path?: string\n placeholder?: TextareaField['admin']['placeholder']\n rows?: number\n width?: string\n} & FormFieldBase
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/fields/Textarea.ts"],"sourcesContent":["import type { TextareaField } from '../../fields/config/types.js'\nimport type { TextareaFieldValidation } from '../../fields/validations.js'\nimport type { ErrorComponent } from '../forms/Error.js'\nimport type { DescriptionComponent, FormFieldBase, LabelComponent } from '../types.js'\n\nexport type TextareaFieldProps = {\n maxLength?: number\n minLength?: number\n name?: string\n path?: string\n placeholder?: TextareaField['admin']['placeholder']\n rows?: number\n validate?: TextareaFieldValidation\n width?: string\n} & Omit<FormFieldBase, 'validate'>\n\nexport type TextareaFieldLabelComponent = LabelComponent<'textarea'>\n\nexport type TextareaFieldDescriptionComponent = DescriptionComponent<'textarea'>\n\nexport type TextareaFieldErrorComponent = ErrorComponent<'textarea'>\n"],"names":[],"mappings":"AAoBA,WAAoE"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type { DescriptionComponent, FormFieldBase, LabelComponent, UploadField } from 'payload';
|
|
1
|
+
import type { DescriptionComponent, FormFieldBase, LabelComponent, UploadField, UploadFieldValidation } from 'payload';
|
|
2
2
|
import type { ErrorComponent } from '../forms/Error.js';
|
|
3
3
|
export type UploadFieldProps = {
|
|
4
4
|
filterOptions?: UploadField['filterOptions'];
|
|
5
5
|
name?: string;
|
|
6
6
|
path?: string;
|
|
7
7
|
relationTo?: UploadField['relationTo'];
|
|
8
|
+
validate?: UploadFieldValidation;
|
|
8
9
|
width?: string;
|
|
9
|
-
} & FormFieldBase
|
|
10
|
+
} & Omit<FormFieldBase, 'validate'>;
|
|
10
11
|
export type UploadFieldLabelComponent = LabelComponent<'upload'>;
|
|
11
12
|
export type UploadFieldDescriptionComponent = DescriptionComponent<'upload'>;
|
|
12
13
|
export type UploadFieldErrorComponent = ErrorComponent<'upload'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Upload.d.ts","sourceRoot":"","sources":["../../../src/admin/fields/Upload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Upload.d.ts","sourceRoot":"","sources":["../../../src/admin/fields/Upload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,WAAW,EACX,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,aAAa,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAA;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;IACtC,QAAQ,CAAC,EAAE,qBAAqB,CAAA;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;AAEnC,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAA;AAEhE,MAAM,MAAM,+BAA+B,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAA;AAE5E,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/fields/Upload.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/fields/Upload.ts"],"sourcesContent":["import type {\n DescriptionComponent,\n FormFieldBase,\n LabelComponent,\n UploadField,\n UploadFieldValidation,\n} from 'payload'\n\nimport type { ErrorComponent } from '../forms/Error.js'\n\nexport type UploadFieldProps = {\n filterOptions?: UploadField['filterOptions']\n name?: string\n path?: string\n relationTo?: UploadField['relationTo']\n validate?: UploadFieldValidation\n width?: string\n} & Omit<FormFieldBase, 'validate'>\n\nexport type UploadFieldLabelComponent = LabelComponent<'upload'>\n\nexport type UploadFieldDescriptionComponent = DescriptionComponent<'upload'>\n\nexport type UploadFieldErrorComponent = ErrorComponent<'upload'>\n"],"names":[],"mappings":"AAuBA,WAAgE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { CustomComponent, LabelFunction, ServerProps } from '../../config/types.js';
|
|
3
|
-
import type { FieldComponentProps } from '../types.js';
|
|
4
3
|
import type { FieldTypes } from './FieldTypes.js';
|
|
5
4
|
export type DescriptionFunction = LabelFunction;
|
|
6
5
|
export type DescriptionComponent<T extends keyof FieldTypes = any> = CustomComponent<FieldDescriptionProps<T>>;
|
|
@@ -13,5 +12,5 @@ export type GenericDescriptionProps = {
|
|
|
13
12
|
};
|
|
14
13
|
export type FieldDescriptionProps<T extends keyof FieldTypes = any> = {
|
|
15
14
|
type: T;
|
|
16
|
-
} &
|
|
15
|
+
} & GenericDescriptionProps & Partial<ServerProps>;
|
|
17
16
|
//# sourceMappingURL=FieldDescription.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldDescription.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/FieldDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"FieldDescription.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/FieldDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAA;AAE/C,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,UAAU,GAAG,GAAG,IAAI,eAAe,CAClF,qBAAqB,CAAC,CAAC,CAAC,CACzB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAA;AAC/E,MAAM,MAAM,uBAAuB,GAAG;IACpC,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAA;IAC7C,eAAe,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAA;CACnC,CAAA;AACD,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,MAAM,UAAU,GAAG,GAAG,IAAI;IACpE,IAAI,EAAE,CAAC,CAAA;CACR,GAAG,uBAAuB,GACzB,OAAO,CAAC,WAAW,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/forms/FieldDescription.ts"],"sourcesContent":["import type React from 'react'\n\nimport type { CustomComponent, LabelFunction, ServerProps } from '../../config/types.js'\nimport type { FieldComponentProps } from '../types.js'\nimport type { FieldTypes } from './FieldTypes.js'\n\nexport type DescriptionFunction = LabelFunction\n\nexport type DescriptionComponent<T extends keyof FieldTypes = any> = CustomComponent<\n FieldDescriptionProps<T>\n>\n\nexport type Description = DescriptionFunction | Record<string, string> | string\nexport type GenericDescriptionProps = {\n CustomDescription?: React.ReactNode\n className?: string\n description?: Record<string, string> | string\n marginPlacement?: 'bottom' | 'top'\n}\nexport type FieldDescriptionProps<T extends keyof FieldTypes = any> = {\n type: T\n} &
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/forms/FieldDescription.ts"],"sourcesContent":["import type React from 'react'\n\nimport type { CustomComponent, LabelFunction, ServerProps } from '../../config/types.js'\nimport type { FieldComponentProps } from '../types.js'\nimport type { FieldTypes } from './FieldTypes.js'\n\nexport type DescriptionFunction = LabelFunction\n\nexport type DescriptionComponent<T extends keyof FieldTypes = any> = CustomComponent<\n FieldDescriptionProps<T>\n>\n\nexport type Description = DescriptionFunction | Record<string, string> | string\nexport type GenericDescriptionProps = {\n CustomDescription?: React.ReactNode\n className?: string\n description?: Record<string, string> | string\n marginPlacement?: 'bottom' | 'top'\n}\nexport type FieldDescriptionProps<T extends keyof FieldTypes = any> = {\n type: T\n} & GenericDescriptionProps &\n Partial<ServerProps>\n"],"names":[],"mappings":"AAmBA,WAGsB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Field, Validate } from '../../fields/config/types.js';
|
|
2
2
|
import type { Where } from '../../types/index.js';
|
|
3
3
|
export type Data = {
|
|
4
4
|
[key: string]: any;
|
|
@@ -21,7 +21,7 @@ export type FormField = {
|
|
|
21
21
|
passesCondition?: boolean;
|
|
22
22
|
rows?: Row[];
|
|
23
23
|
valid: boolean;
|
|
24
|
-
validate?:
|
|
24
|
+
validate?: Validate;
|
|
25
25
|
value: unknown;
|
|
26
26
|
};
|
|
27
27
|
export type FormState = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/Form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/Form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAEjD,MAAM,MAAM,IAAI,GAAG;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,GAAG,GAAG;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC,YAAY,EAAE,OAAO,CAAA;IACrB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACZ,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CAC1B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/forms/Form.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/forms/Form.ts"],"sourcesContent":["import type { Field, Validate } from '../../fields/config/types.js'\nimport type { Where } from '../../types/index.js'\n\nexport type Data = {\n [key: string]: any\n}\n\nexport type Row = {\n blockType?: string\n collapsed?: boolean\n id: string\n}\n\nexport type FilterOptionsResult = {\n [relation: string]: Where | boolean\n}\n\nexport type FormField = {\n disableFormData?: boolean\n errorMessage?: string\n errorPaths?: string[]\n fieldSchema?: Field\n filterOptions?: FilterOptionsResult\n initialValue: unknown\n passesCondition?: boolean\n rows?: Row[]\n valid: boolean\n validate?: Validate\n value: unknown\n}\n\nexport type FormState = {\n [path: string]: FormField\n}\n"],"names":[],"mappings":"AA+BA,WAEC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { CustomComponent
|
|
2
|
-
import type { FieldComponentProps } from '../fields/index.js';
|
|
1
|
+
import type { CustomComponent } from '../../config/types.js';
|
|
3
2
|
import type { FormFieldBase } from './Field.js';
|
|
4
3
|
import type { FieldTypes } from './FieldTypes.js';
|
|
5
4
|
export type GenericLabelProps = {
|
|
@@ -9,8 +8,11 @@ export type GenericLabelProps = {
|
|
|
9
8
|
unstyled?: boolean;
|
|
10
9
|
} & FormFieldBase;
|
|
11
10
|
export type LabelProps<T extends keyof FieldTypes = any> = {
|
|
11
|
+
label?: FormFieldBase['label'];
|
|
12
|
+
required?: boolean;
|
|
13
|
+
} & {
|
|
12
14
|
type: T;
|
|
13
|
-
} &
|
|
15
|
+
} & GenericLabelProps;
|
|
14
16
|
export type SanitizedLabelProps<T extends keyof FieldTypes = any> = Omit<LabelProps<T>, 'label' | 'required'>;
|
|
15
17
|
export type LabelComponent<T extends keyof FieldTypes = any> = CustomComponent<LabelProps<T>>;
|
|
16
18
|
//# sourceMappingURL=Label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/Label.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/Label.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,uBAAuB,CAAA;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,aAAa,CAAA;AAEjB,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,UAAU,GAAG,GAAG,IAAI;IACzD,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG;IACF,IAAI,EAAE,CAAC,CAAA;CACR,GAAG,iBAAiB,CAAA;AACrB,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,MAAM,UAAU,GAAG,GAAG,IAAI,IAAI,CACtE,UAAU,CAAC,CAAC,CAAC,EACb,OAAO,GAAG,UAAU,CACrB,CAAA;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,UAAU,GAAG,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/forms/Label.ts"],"sourcesContent":["import type { CustomComponent, ServerProps } from '../../config/types.js'\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/forms/Label.ts"],"sourcesContent":["import type { CustomComponent, ServerProps } from '../../config/types.js'\nimport type { FormFieldBase } from './Field.js'\nimport type { FieldTypes } from './FieldTypes.js'\n\nexport type GenericLabelProps = {\n as?: 'label' | 'span'\n htmlFor?: string\n schemaPath?: string\n unstyled?: boolean\n} & FormFieldBase\n\nexport type LabelProps<T extends keyof FieldTypes = any> = {\n label?: FormFieldBase['label']\n required?: boolean\n} & {\n type: T\n} & GenericLabelProps\nexport type SanitizedLabelProps<T extends keyof FieldTypes = any> = Omit<\n LabelProps<T>,\n 'label' | 'required'\n>\n\nexport type LabelComponent<T extends keyof FieldTypes = any> = CustomComponent<LabelProps<T>>\n"],"names":[],"mappings":"AAsBA,WAA6F"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const
|
|
3
|
-
required?: boolean;
|
|
4
|
-
}) => Field;
|
|
1
|
+
import type { EmailField } from '../../fields/config/types.js';
|
|
2
|
+
export declare const emailFieldConfig: EmailField;
|
|
5
3
|
//# sourceMappingURL=email.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../../src/auth/baseFields/email.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../../src/auth/baseFields/email.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAI9D,eAAO,MAAM,gBAAgB,EAAE,UAqB9B,CAAA"}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { email } from '../../fields/validations.js';
|
|
2
|
-
export const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
2
|
+
export const emailFieldConfig = {
|
|
3
|
+
name: 'email',
|
|
4
|
+
type: 'email',
|
|
5
|
+
admin: {
|
|
6
|
+
components: {
|
|
7
|
+
Field: ()=>null
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
hooks: {
|
|
11
|
+
beforeChange: [
|
|
12
|
+
({ value })=>{
|
|
13
|
+
if (value) {
|
|
14
|
+
return value.toLowerCase().trim();
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
label: ({ t })=>t('general:email'),
|
|
20
|
+
required: true,
|
|
21
|
+
unique: true,
|
|
22
|
+
validate: email
|
|
23
|
+
};
|
|
24
24
|
|
|
25
25
|
//# sourceMappingURL=email.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/auth/baseFields/email.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/auth/baseFields/email.ts"],"sourcesContent":["import type { EmailField } from '../../fields/config/types.js'\n\nimport { email } from '../../fields/validations.js'\n\nexport const emailFieldConfig: EmailField = {\n name: 'email',\n type: 'email',\n admin: {\n components: {\n Field: () => null,\n },\n },\n hooks: {\n beforeChange: [\n ({ value }) => {\n if (value) {\n return value.toLowerCase().trim()\n }\n },\n ],\n },\n label: ({ t }) => t('general:email'),\n required: true,\n unique: true,\n validate: email,\n}\n"],"names":["email","emailFieldConfig","name","type","admin","components","Field","hooks","beforeChange","value","toLowerCase","trim","label","t","required","unique","validate"],"mappings":"AAEA,SAASA,KAAK,QAAQ,8BAA6B;AAEnD,OAAO,MAAMC,mBAA+B;IAC1CC,MAAM;IACNC,MAAM;IACNC,OAAO;QACLC,YAAY;YACVC,OAAO,IAAM;QACf;IACF;IACAC,OAAO;QACLC,cAAc;YACZ,CAAC,EAAEC,KAAK,EAAE;gBACR,IAAIA,OAAO;oBACT,OAAOA,MAAMC,WAAW,GAAGC,IAAI;gBACjC;YACF;SACD;IACH;IACAC,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;IACpBC,UAAU;IACVC,QAAQ;IACRC,UAAUhB;AACZ,EAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const
|
|
1
|
+
import type { TextField } from '../../fields/config/types.js';
|
|
2
|
+
export declare const usernameFieldConfig: TextField;
|
|
3
3
|
//# sourceMappingURL=username.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"username.d.ts","sourceRoot":"","sources":["../../../src/auth/baseFields/username.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"username.d.ts","sourceRoot":"","sources":["../../../src/auth/baseFields/username.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAI7D,eAAO,MAAM,mBAAmB,EAAE,SAqBjC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/auth/baseFields/username.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/auth/baseFields/username.ts"],"sourcesContent":["import type { TextField } from '../../fields/config/types.js'\n\nimport { username } from '../../fields/validations.js'\n\nexport const usernameFieldConfig: TextField = {\n name: 'username',\n type: 'text',\n admin: {\n components: {\n Field: () => null,\n },\n },\n hooks: {\n beforeChange: [\n ({ value }) => {\n if (value) {\n return value.toLowerCase().trim()\n }\n },\n ],\n },\n label: ({ t }) => t('authentication:username'),\n required: true,\n unique: true,\n validate: username,\n}\n"],"names":["username","usernameFieldConfig","name","type","admin","components","Field","hooks","beforeChange","value","toLowerCase","trim","label","t","required","unique","validate"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,8BAA6B;AAEtD,OAAO,MAAMC,sBAAiC;IAC5CC,MAAM;IACNC,MAAM;IACNC,OAAO;QACLC,YAAY;YACVC,OAAO,IAAM;QACf;IACF;IACAC,OAAO;QACLC,cAAc;YACZ,CAAC,EAAEC,KAAK,EAAE;gBACR,IAAIA,OAAO;oBACT,OAAOA,MAAMC,WAAW,GAAGC,IAAI;gBACjC;YACF;SACD;IACH;IACAC,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;IACpBC,UAAU;IACVC,QAAQ;IACRC,UAAUhB;AACZ,EAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RequiredDataFromCollectionSlug } from '../collections/config/types.js';
|
|
2
|
+
import type { AuthCollection, CollectionSlug, PayloadRequest } from '../index.js';
|
|
3
|
+
type ValidateUsernameOrEmailArgs<TSlug extends CollectionSlug> = {
|
|
4
|
+
authOptions: AuthCollection['config']['auth'];
|
|
5
|
+
collectionSlug: string;
|
|
6
|
+
data: RequiredDataFromCollectionSlug<TSlug>;
|
|
7
|
+
req: PayloadRequest;
|
|
8
|
+
} & ({
|
|
9
|
+
operation: 'create';
|
|
10
|
+
originalDoc?: never;
|
|
11
|
+
} | {
|
|
12
|
+
operation: 'update';
|
|
13
|
+
originalDoc: RequiredDataFromCollectionSlug<TSlug>;
|
|
14
|
+
});
|
|
15
|
+
export declare const ensureUsernameOrEmail: <TSlug extends CollectionSlug>({ authOptions: { disableLocalStrategy, loginWithUsername }, collectionSlug, data, operation, originalDoc, req, }: ValidateUsernameOrEmailArgs<TSlug>) => void;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=ensureUsernameOrEmail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensureUsernameOrEmail.d.ts","sourceRoot":"","sources":["../../src/auth/ensureUsernameOrEmail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAA;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjF,KAAK,2BAA2B,CAAC,KAAK,SAAS,cAAc,IAAI;IAC/D,WAAW,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAA;IAC7C,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,8BAA8B,CAAC,KAAK,CAAC,CAAA;IAC3C,GAAG,EAAE,cAAc,CAAA;CACpB,GAAG,CACA;IACE,SAAS,EAAE,QAAQ,CAAA;IACnB,WAAW,CAAC,EAAE,KAAK,CAAA;CACpB,GACD;IACE,SAAS,EAAE,QAAQ,CAAA;IACnB,WAAW,EAAE,8BAA8B,CAAC,KAAK,CAAC,CAAA;CACnD,CACJ,CAAA;AACD,eAAO,MAAM,qBAAqB,GAAI,KAAK,SAAS,cAAc,oHAO/D,2BAA2B,CAAC,KAAK,CAAC,SAiDpC,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ValidationError } from '../errors/index.js';
|
|
2
|
+
export const ensureUsernameOrEmail = ({ authOptions: { disableLocalStrategy, loginWithUsername }, collectionSlug, data, operation, originalDoc, req })=>{
|
|
3
|
+
// neither username or email are required
|
|
4
|
+
// and neither are provided
|
|
5
|
+
// so we need to manually validate
|
|
6
|
+
if (!disableLocalStrategy && loginWithUsername && !loginWithUsername.requireEmail && !loginWithUsername.requireUsername) {
|
|
7
|
+
let missingFields = false;
|
|
8
|
+
if (operation === 'create' && !data.email && !data.username) {
|
|
9
|
+
missingFields = true;
|
|
10
|
+
} else if (operation === 'update') {
|
|
11
|
+
// prevent clearing both email and username
|
|
12
|
+
if ('email' in data && !data.email && 'username' in data && !data.username) {
|
|
13
|
+
missingFields = true;
|
|
14
|
+
}
|
|
15
|
+
// prevent clearing email if no username
|
|
16
|
+
if ('email' in data && !data.email && !originalDoc.username) {
|
|
17
|
+
missingFields = true;
|
|
18
|
+
}
|
|
19
|
+
// prevent clearing username if no email
|
|
20
|
+
if ('username' in data && !data.username && !originalDoc.email) {
|
|
21
|
+
missingFields = true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (missingFields) {
|
|
25
|
+
throw new ValidationError({
|
|
26
|
+
collection: collectionSlug,
|
|
27
|
+
errors: [
|
|
28
|
+
{
|
|
29
|
+
field: 'username',
|
|
30
|
+
message: 'Username or email is required'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
field: 'email',
|
|
34
|
+
message: 'Username or email is required'
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}, req.t);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=ensureUsernameOrEmail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/auth/ensureUsernameOrEmail.ts"],"sourcesContent":["import type { RequiredDataFromCollectionSlug } from '../collections/config/types.js'\nimport type { AuthCollection, CollectionSlug, PayloadRequest } from '../index.js'\n\nimport { ValidationError } from '../errors/index.js'\n\ntype ValidateUsernameOrEmailArgs<TSlug extends CollectionSlug> = {\n authOptions: AuthCollection['config']['auth']\n collectionSlug: string\n data: RequiredDataFromCollectionSlug<TSlug>\n req: PayloadRequest\n} & (\n | {\n operation: 'create'\n originalDoc?: never\n }\n | {\n operation: 'update'\n originalDoc: RequiredDataFromCollectionSlug<TSlug>\n }\n)\nexport const ensureUsernameOrEmail = <TSlug extends CollectionSlug>({\n authOptions: { disableLocalStrategy, loginWithUsername },\n collectionSlug,\n data,\n operation,\n originalDoc,\n req,\n}: ValidateUsernameOrEmailArgs<TSlug>) => {\n // neither username or email are required\n // and neither are provided\n // so we need to manually validate\n if (\n !disableLocalStrategy &&\n loginWithUsername &&\n !loginWithUsername.requireEmail &&\n !loginWithUsername.requireUsername\n ) {\n let missingFields = false\n if (operation === 'create' && !data.email && !data.username) {\n missingFields = true\n } else if (operation === 'update') {\n // prevent clearing both email and username\n if ('email' in data && !data.email && 'username' in data && !data.username) {\n missingFields = true\n }\n // prevent clearing email if no username\n if ('email' in data && !data.email && !originalDoc.username) {\n missingFields = true\n }\n // prevent clearing username if no email\n if ('username' in data && !data.username && !originalDoc.email) {\n missingFields = true\n }\n }\n\n if (missingFields) {\n throw new ValidationError(\n {\n collection: collectionSlug,\n errors: [\n {\n field: 'username',\n message: 'Username or email is required',\n },\n {\n field: 'email',\n message: 'Username or email is required',\n },\n ],\n },\n req.t,\n )\n }\n }\n\n return\n}\n"],"names":["ValidationError","ensureUsernameOrEmail","authOptions","disableLocalStrategy","loginWithUsername","collectionSlug","data","operation","originalDoc","req","requireEmail","requireUsername","missingFields","email","username","collection","errors","field","message","t"],"mappings":"AAGA,SAASA,eAAe,QAAQ,qBAAoB;AAiBpD,OAAO,MAAMC,wBAAwB,CAA+B,EAClEC,aAAa,EAAEC,oBAAoB,EAAEC,iBAAiB,EAAE,EACxDC,cAAc,EACdC,IAAI,EACJC,SAAS,EACTC,WAAW,EACXC,GAAG,EACgC;IACnC,yCAAyC;IACzC,2BAA2B;IAC3B,kCAAkC;IAClC,IACE,CAACN,wBACDC,qBACA,CAACA,kBAAkBM,YAAY,IAC/B,CAACN,kBAAkBO,eAAe,EAClC;QACA,IAAIC,gBAAgB;QACpB,IAAIL,cAAc,YAAY,CAACD,KAAKO,KAAK,IAAI,CAACP,KAAKQ,QAAQ,EAAE;YAC3DF,gBAAgB;QAClB,OAAO,IAAIL,cAAc,UAAU;YACjC,2CAA2C;YAC3C,IAAI,WAAWD,QAAQ,CAACA,KAAKO,KAAK,IAAI,cAAcP,QAAQ,CAACA,KAAKQ,QAAQ,EAAE;gBAC1EF,gBAAgB;YAClB;YACA,wCAAwC;YACxC,IAAI,WAAWN,QAAQ,CAACA,KAAKO,KAAK,IAAI,CAACL,YAAYM,QAAQ,EAAE;gBAC3DF,gBAAgB;YAClB;YACA,wCAAwC;YACxC,IAAI,cAAcN,QAAQ,CAACA,KAAKQ,QAAQ,IAAI,CAACN,YAAYK,KAAK,EAAE;gBAC9DD,gBAAgB;YAClB;QACF;QAEA,IAAIA,eAAe;YACjB,MAAM,IAAIZ,gBACR;gBACEe,YAAYV;gBACZW,QAAQ;oBACN;wBACEC,OAAO;wBACPC,SAAS;oBACX;oBACA;wBACED,OAAO;wBACPC,SAAS;oBACX;iBACD;YACH,GACAT,IAAIU,CAAC;QAET;IACF;IAEA;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAuthFields.d.ts","sourceRoot":"","sources":["../../src/auth/getAuthFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"getAuthFields.d.ts","sourceRoot":"","sources":["../../src/auth/getAuthFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAa,MAAM,2BAA2B,CAAA;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AASlD,eAAO,MAAM,iBAAiB,eAAgB,gBAAgB,KAAG,KAAK,EAsCrE,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { accountLockFields } from './baseFields/accountLock.js';
|
|
2
2
|
import { apiKeyFields } from './baseFields/apiKey.js';
|
|
3
3
|
import { baseAuthFields } from './baseFields/auth.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { emailFieldConfig } from './baseFields/email.js';
|
|
5
|
+
import { usernameFieldConfig } from './baseFields/username.js';
|
|
6
6
|
import { verificationFields } from './baseFields/verification.js';
|
|
7
7
|
export const getBaseAuthFields = (authConfig)=>{
|
|
8
8
|
const authFields = [];
|
|
@@ -10,17 +10,25 @@ export const getBaseAuthFields = (authConfig)=>{
|
|
|
10
10
|
authFields.push(...apiKeyFields);
|
|
11
11
|
}
|
|
12
12
|
if (!authConfig.disableLocalStrategy) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
}
|
|
13
|
+
const emailField = {
|
|
14
|
+
...emailFieldConfig
|
|
15
|
+
};
|
|
16
|
+
let usernameField;
|
|
16
17
|
if (authConfig.loginWithUsername) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
usernameField = {
|
|
19
|
+
...usernameFieldConfig
|
|
20
|
+
};
|
|
21
|
+
if (typeof authConfig.loginWithUsername === 'object') {
|
|
22
|
+
if (authConfig.loginWithUsername.requireEmail === false) {
|
|
23
|
+
emailField.required = false;
|
|
24
|
+
}
|
|
25
|
+
if (authConfig.loginWithUsername.requireUsername === false) {
|
|
26
|
+
usernameField.required = false;
|
|
27
|
+
}
|
|
21
28
|
}
|
|
22
|
-
authFields.push(usernameField);
|
|
23
29
|
}
|
|
30
|
+
authFields.push(emailField);
|
|
31
|
+
if (usernameField) authFields.push(usernameField);
|
|
24
32
|
authFields.push(...baseAuthFields);
|
|
25
33
|
if (authConfig.verify) {
|
|
26
34
|
authFields.push(...verificationFields);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/auth/getAuthFields.ts"],"sourcesContent":["import type { Field } from '../fields/config/types.js'\nimport type { IncomingAuthType } from './types.js'\n\nimport { accountLockFields } from './baseFields/accountLock.js'\nimport { apiKeyFields } from './baseFields/apiKey.js'\nimport { baseAuthFields } from './baseFields/auth.js'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/auth/getAuthFields.ts"],"sourcesContent":["import type { Field, TextField } from '../fields/config/types.js'\nimport type { IncomingAuthType } from './types.js'\n\nimport { accountLockFields } from './baseFields/accountLock.js'\nimport { apiKeyFields } from './baseFields/apiKey.js'\nimport { baseAuthFields } from './baseFields/auth.js'\nimport { emailFieldConfig } from './baseFields/email.js'\nimport { usernameFieldConfig } from './baseFields/username.js'\nimport { verificationFields } from './baseFields/verification.js'\n\nexport const getBaseAuthFields = (authConfig: IncomingAuthType): Field[] => {\n const authFields: Field[] = []\n\n if (authConfig.useAPIKey) {\n authFields.push(...apiKeyFields)\n }\n\n if (!authConfig.disableLocalStrategy) {\n const emailField = { ...emailFieldConfig }\n let usernameField: TextField | undefined\n\n if (authConfig.loginWithUsername) {\n usernameField = { ...usernameFieldConfig }\n if (typeof authConfig.loginWithUsername === 'object') {\n if (authConfig.loginWithUsername.requireEmail === false) {\n emailField.required = false\n }\n if (authConfig.loginWithUsername.requireUsername === false) {\n usernameField.required = false\n }\n }\n }\n\n authFields.push(emailField)\n if (usernameField) authFields.push(usernameField)\n\n authFields.push(...baseAuthFields)\n\n if (authConfig.verify) {\n authFields.push(...verificationFields)\n }\n\n if (authConfig.maxLoginAttempts > 0) {\n authFields.push(...accountLockFields)\n }\n }\n\n return authFields\n}\n"],"names":["accountLockFields","apiKeyFields","baseAuthFields","emailFieldConfig","usernameFieldConfig","verificationFields","getBaseAuthFields","authConfig","authFields","useAPIKey","push","disableLocalStrategy","emailField","usernameField","loginWithUsername","requireEmail","required","requireUsername","verify","maxLoginAttempts"],"mappings":"AAGA,SAASA,iBAAiB,QAAQ,8BAA6B;AAC/D,SAASC,YAAY,QAAQ,yBAAwB;AACrD,SAASC,cAAc,QAAQ,uBAAsB;AACrD,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,kBAAkB,QAAQ,+BAA8B;AAEjE,OAAO,MAAMC,oBAAoB,CAACC;IAChC,MAAMC,aAAsB,EAAE;IAE9B,IAAID,WAAWE,SAAS,EAAE;QACxBD,WAAWE,IAAI,IAAIT;IACrB;IAEA,IAAI,CAACM,WAAWI,oBAAoB,EAAE;QACpC,MAAMC,aAAa;YAAE,GAAGT,gBAAgB;QAAC;QACzC,IAAIU;QAEJ,IAAIN,WAAWO,iBAAiB,EAAE;YAChCD,gBAAgB;gBAAE,GAAGT,mBAAmB;YAAC;YACzC,IAAI,OAAOG,WAAWO,iBAAiB,KAAK,UAAU;gBACpD,IAAIP,WAAWO,iBAAiB,CAACC,YAAY,KAAK,OAAO;oBACvDH,WAAWI,QAAQ,GAAG;gBACxB;gBACA,IAAIT,WAAWO,iBAAiB,CAACG,eAAe,KAAK,OAAO;oBAC1DJ,cAAcG,QAAQ,GAAG;gBAC3B;YACF;QACF;QAEAR,WAAWE,IAAI,CAACE;QAChB,IAAIC,eAAeL,WAAWE,IAAI,CAACG;QAEnCL,WAAWE,IAAI,IAAIR;QAEnB,IAAIK,WAAWW,MAAM,EAAE;YACrBV,WAAWE,IAAI,IAAIL;QACrB;QAEA,IAAIE,WAAWY,gBAAgB,GAAG,GAAG;YACnCX,WAAWE,IAAI,IAAIV;QACrB;IACF;IAEA,OAAOQ;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerFirstUser.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/registerFirstUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,UAAU,EACV,sBAAsB,EACtB,8BAA8B,EAC/B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"registerFirstUser.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/registerFirstUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,UAAU,EACV,sBAAsB,EACtB,8BAA8B,EAC/B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAQ1D,MAAM,MAAM,SAAS,CAAC,KAAK,SAAS,cAAc,IAAI;IACpD,UAAU,EAAE,UAAU,CAAA;IACtB,IAAI,EAAE,gCAAgC,CAAC,KAAK,CAAC,CAAC,mBAAmB,CAAC,GAChE,8BAA8B,CAAC,KAAK,CAAC,CAAA;IACvC,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,MAAM,CAAC,KAAK,IAAI;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,KAAK,CAAA;CACb,CAAA;AAED,eAAO,MAAM,0BAA0B,GAAU,KAAK,SAAS,cAAc,QACrE,SAAS,CAAC,KAAK,CAAC,KACrB,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CA4E/C,CAAA"}
|
|
@@ -2,10 +2,18 @@ import { Forbidden } from '../../errors/index.js';
|
|
|
2
2
|
import { commitTransaction } from '../../utilities/commitTransaction.js';
|
|
3
3
|
import { initTransaction } from '../../utilities/initTransaction.js';
|
|
4
4
|
import { killTransaction } from '../../utilities/killTransaction.js';
|
|
5
|
+
import { ensureUsernameOrEmail } from '../ensureUsernameOrEmail.js';
|
|
5
6
|
export const registerFirstUserOperation = async (args)=>{
|
|
6
7
|
const { collection: { config, config: { slug, auth: { verify } } }, data, req, req: { payload } } = args;
|
|
7
8
|
try {
|
|
8
9
|
const shouldCommit = await initTransaction(req);
|
|
10
|
+
ensureUsernameOrEmail({
|
|
11
|
+
authOptions: config.auth,
|
|
12
|
+
collectionSlug: slug,
|
|
13
|
+
data,
|
|
14
|
+
operation: 'create',
|
|
15
|
+
req
|
|
16
|
+
});
|
|
9
17
|
const doc = await payload.db.findOne({
|
|
10
18
|
collection: config.slug,
|
|
11
19
|
req
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/auth/operations/registerFirstUser.ts"],"sourcesContent":["import type {\n AuthOperationsFromCollectionSlug,\n Collection,\n DataFromCollectionSlug,\n RequiredDataFromCollectionSlug,\n} from '../../collections/config/types.js'\nimport type { CollectionSlug } from '../../index.js'\nimport type { PayloadRequest } from '../../types/index.js'\n\nimport { Forbidden } from '../../errors/index.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\n\nexport type Arguments<TSlug extends CollectionSlug> = {\n collection: Collection\n data: AuthOperationsFromCollectionSlug<TSlug>['registerFirstUser'] &\n RequiredDataFromCollectionSlug<TSlug>\n req: PayloadRequest\n}\n\nexport type Result<TData> = {\n exp?: number\n token?: string\n user?: TData\n}\n\nexport const registerFirstUserOperation = async <TSlug extends CollectionSlug>(\n args: Arguments<TSlug>,\n): Promise<Result<DataFromCollectionSlug<TSlug>>> => {\n const {\n collection: {\n config,\n config: {\n slug,\n auth: { verify },\n },\n },\n data,\n req,\n req: { payload },\n } = args\n\n try {\n const shouldCommit = await initTransaction(req)\n\n const doc = await payload.db.findOne({\n collection: config.slug,\n req,\n })\n\n if (doc) throw new Forbidden(req.t)\n\n // /////////////////////////////////////\n // Register first user\n // /////////////////////////////////////\n\n const result = await payload.create<TSlug>({\n collection: slug as TSlug,\n data,\n overrideAccess: true,\n req,\n })\n\n // auto-verify (if applicable)\n if (verify) {\n await payload.update({\n id: result.id,\n collection: slug,\n data: {\n _verified: true,\n },\n req,\n })\n }\n\n // /////////////////////////////////////\n // Log in new user\n // /////////////////////////////////////\n\n const { exp, token } = await payload.login({\n ...args,\n collection: slug,\n req,\n })\n\n if (shouldCommit) await commitTransaction(req)\n\n return {\n exp,\n token,\n user: result,\n }\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["Forbidden","commitTransaction","initTransaction","killTransaction","registerFirstUserOperation","args","collection","config","slug","auth","verify","data","req","payload","shouldCommit","doc","db","findOne","t","result","create","overrideAccess","update","id","_verified","exp","token","login","user","error"],"mappings":"AASA,SAASA,SAAS,QAAQ,wBAAuB;AACjD,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;
|
|
1
|
+
{"version":3,"sources":["../../../src/auth/operations/registerFirstUser.ts"],"sourcesContent":["import type {\n AuthOperationsFromCollectionSlug,\n Collection,\n DataFromCollectionSlug,\n RequiredDataFromCollectionSlug,\n} from '../../collections/config/types.js'\nimport type { CollectionSlug } from '../../index.js'\nimport type { PayloadRequest } from '../../types/index.js'\n\nimport { Forbidden } from '../../errors/index.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { ensureUsernameOrEmail } from '../ensureUsernameOrEmail.js'\n\nexport type Arguments<TSlug extends CollectionSlug> = {\n collection: Collection\n data: AuthOperationsFromCollectionSlug<TSlug>['registerFirstUser'] &\n RequiredDataFromCollectionSlug<TSlug>\n req: PayloadRequest\n}\n\nexport type Result<TData> = {\n exp?: number\n token?: string\n user?: TData\n}\n\nexport const registerFirstUserOperation = async <TSlug extends CollectionSlug>(\n args: Arguments<TSlug>,\n): Promise<Result<DataFromCollectionSlug<TSlug>>> => {\n const {\n collection: {\n config,\n config: {\n slug,\n auth: { verify },\n },\n },\n data,\n req,\n req: { payload },\n } = args\n\n try {\n const shouldCommit = await initTransaction(req)\n\n ensureUsernameOrEmail<TSlug>({\n authOptions: config.auth,\n collectionSlug: slug,\n data,\n operation: 'create',\n req,\n })\n\n const doc = await payload.db.findOne({\n collection: config.slug,\n req,\n })\n\n if (doc) throw new Forbidden(req.t)\n\n // /////////////////////////////////////\n // Register first user\n // /////////////////////////////////////\n\n const result = await payload.create<TSlug>({\n collection: slug as TSlug,\n data,\n overrideAccess: true,\n req,\n })\n\n // auto-verify (if applicable)\n if (verify) {\n await payload.update({\n id: result.id,\n collection: slug,\n data: {\n _verified: true,\n },\n req,\n })\n }\n\n // /////////////////////////////////////\n // Log in new user\n // /////////////////////////////////////\n\n const { exp, token } = await payload.login({\n ...args,\n collection: slug,\n req,\n })\n\n if (shouldCommit) await commitTransaction(req)\n\n return {\n exp,\n token,\n user: result,\n }\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["Forbidden","commitTransaction","initTransaction","killTransaction","ensureUsernameOrEmail","registerFirstUserOperation","args","collection","config","slug","auth","verify","data","req","payload","shouldCommit","authOptions","collectionSlug","operation","doc","db","findOne","t","result","create","overrideAccess","update","id","_verified","exp","token","login","user","error"],"mappings":"AASA,SAASA,SAAS,QAAQ,wBAAuB;AACjD,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE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,8 +101,13 @@ export type AuthStrategy = {
|
|
|
101
101
|
name: string;
|
|
102
102
|
};
|
|
103
103
|
export type LoginWithUsernameOptions = {
|
|
104
|
-
allowEmailLogin?:
|
|
104
|
+
allowEmailLogin?: false;
|
|
105
105
|
requireEmail?: boolean;
|
|
106
|
+
requireUsername?: true;
|
|
107
|
+
} | {
|
|
108
|
+
allowEmailLogin?: true;
|
|
109
|
+
requireEmail?: boolean;
|
|
110
|
+
requireUsername?: boolean;
|
|
106
111
|
};
|
|
107
112
|
export interface IncomingAuthType {
|
|
108
113
|
cookies?: {
|
package/dist/auth/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9D,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE;QACP,CAAC,SAAS,EAAE,MAAM,GAAG;YACnB,MAAM,EAAE;gBACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAAA;aACtC,CAAA;SACF,CAAA;KACF,CAAA;IACD,MAAM,EAAE;QACN,UAAU,EAAE,OAAO,CAAA;KACpB,CAAA;IACD,MAAM,CAAC,EAAE;QACP,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAAA;KACtC,CAAA;IACD,IAAI,EAAE;QACJ,UAAU,EAAE,OAAO,CAAA;KACpB,CAAA;IACD,MAAM,EAAE;QACN,UAAU,EAAE,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BAAiB,EAAE,wBAAwB,GAAG,KAAK,CAAA;IACnD,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAAA;CAChC;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,IAAI,KAAK,CAE7E"}
|
package/dist/auth/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/auth/types.ts"],"sourcesContent":["import type { DeepRequired } from 'ts-essentials'\n\nimport type { Payload } from '../index.js'\nimport type { PayloadRequest, Where } from '../types/index.js'\n\nexport type Permission = {\n permission: boolean\n where?: Record<string, unknown>\n}\n\nexport type FieldPermissions = {\n blocks?: {\n [blockSlug: string]: {\n fields: {\n [fieldName: string]: FieldPermissions\n }\n }\n }\n create: {\n permission: boolean\n }\n fields?: {\n [fieldName: string]: FieldPermissions\n }\n read: {\n permission: boolean\n }\n update: {\n permission: boolean\n }\n}\n\nexport type CollectionPermission = {\n create: Permission\n delete: Permission\n fields: {\n [fieldName: string]: FieldPermissions\n }\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type GlobalPermission = {\n fields: {\n [fieldName: string]: FieldPermissions\n }\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type DocumentPermissions = CollectionPermission | GlobalPermission\nexport type Permissions = {\n canAccessAdmin: boolean\n collections: {\n [collectionSlug: string]: CollectionPermission\n }\n globals?: {\n [globalSlug: string]: GlobalPermission\n }\n}\n\nexport type User = {\n [key: string]: any // This NEEDS to be an any, otherwise it breaks the Omit for ClientUser below\n collection: string\n email?: string\n id: number | string\n username?: string\n}\n\n/**\n * `collection` is not available one the client. It's only available on the server (req.user)\n * On the client, you can access the collection via config.admin.user. Config can be accessed using the useConfig() hook\n */\nexport type ClientUser = Omit<User, 'collection'>\n\ntype GenerateVerifyEmailHTML<TUser = any> = (args: {\n req: PayloadRequest\n token: string\n user: TUser\n}) => Promise<string> | string\n\ntype GenerateVerifyEmailSubject<TUser = any> = (args: {\n req: PayloadRequest\n token: string\n user: TUser\n}) => Promise<string> | string\n\ntype GenerateForgotPasswordEmailHTML<TUser = any> = (args?: {\n req?: PayloadRequest\n token?: string\n user?: TUser\n}) => Promise<string> | string\n\ntype GenerateForgotPasswordEmailSubject<TUser = any> = (args?: {\n req?: PayloadRequest\n token?: string\n user?: TUser\n}) => Promise<string> | string\n\nexport type AuthStrategyFunctionArgs = {\n headers: Request['headers']\n isGraphQL?: boolean\n payload: Payload\n}\n\nexport type AuthStrategyResult = {\n responseHeaders?: Headers\n user: User | null\n}\n\nexport type AuthStrategyFunction = (\n args: AuthStrategyFunctionArgs,\n) => AuthStrategyResult | Promise<AuthStrategyResult>\nexport type AuthStrategy = {\n authenticate: AuthStrategyFunction\n name: string\n}\n\nexport type LoginWithUsernameOptions
|
|
1
|
+
{"version":3,"sources":["../../src/auth/types.ts"],"sourcesContent":["import type { DeepRequired } from 'ts-essentials'\n\nimport type { Payload } from '../index.js'\nimport type { PayloadRequest, Where } from '../types/index.js'\n\nexport type Permission = {\n permission: boolean\n where?: Record<string, unknown>\n}\n\nexport type FieldPermissions = {\n blocks?: {\n [blockSlug: string]: {\n fields: {\n [fieldName: string]: FieldPermissions\n }\n }\n }\n create: {\n permission: boolean\n }\n fields?: {\n [fieldName: string]: FieldPermissions\n }\n read: {\n permission: boolean\n }\n update: {\n permission: boolean\n }\n}\n\nexport type CollectionPermission = {\n create: Permission\n delete: Permission\n fields: {\n [fieldName: string]: FieldPermissions\n }\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type GlobalPermission = {\n fields: {\n [fieldName: string]: FieldPermissions\n }\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type DocumentPermissions = CollectionPermission | GlobalPermission\nexport type Permissions = {\n canAccessAdmin: boolean\n collections: {\n [collectionSlug: string]: CollectionPermission\n }\n globals?: {\n [globalSlug: string]: GlobalPermission\n }\n}\n\nexport type User = {\n [key: string]: any // This NEEDS to be an any, otherwise it breaks the Omit for ClientUser below\n collection: string\n email?: string\n id: number | string\n username?: string\n}\n\n/**\n * `collection` is not available one the client. It's only available on the server (req.user)\n * On the client, you can access the collection via config.admin.user. Config can be accessed using the useConfig() hook\n */\nexport type ClientUser = Omit<User, 'collection'>\n\ntype GenerateVerifyEmailHTML<TUser = any> = (args: {\n req: PayloadRequest\n token: string\n user: TUser\n}) => Promise<string> | string\n\ntype GenerateVerifyEmailSubject<TUser = any> = (args: {\n req: PayloadRequest\n token: string\n user: TUser\n}) => Promise<string> | string\n\ntype GenerateForgotPasswordEmailHTML<TUser = any> = (args?: {\n req?: PayloadRequest\n token?: string\n user?: TUser\n}) => Promise<string> | string\n\ntype GenerateForgotPasswordEmailSubject<TUser = any> = (args?: {\n req?: PayloadRequest\n token?: string\n user?: TUser\n}) => Promise<string> | string\n\nexport type AuthStrategyFunctionArgs = {\n headers: Request['headers']\n isGraphQL?: boolean\n payload: Payload\n}\n\nexport type AuthStrategyResult = {\n responseHeaders?: Headers\n user: User | null\n}\n\nexport type AuthStrategyFunction = (\n args: AuthStrategyFunctionArgs,\n) => AuthStrategyResult | Promise<AuthStrategyResult>\nexport type AuthStrategy = {\n authenticate: AuthStrategyFunction\n name: string\n}\n\nexport type LoginWithUsernameOptions =\n | {\n allowEmailLogin?: false\n requireEmail?: boolean\n // If `allowEmailLogin` is false, `requireUsername` must be true (default: true)\n requireUsername?: true\n }\n | {\n allowEmailLogin?: true\n requireEmail?: boolean\n requireUsername?: boolean\n }\n\nexport interface IncomingAuthType {\n cookies?: {\n domain?: string\n sameSite?: 'Lax' | 'None' | 'Strict' | boolean\n secure?: boolean\n }\n depth?: number\n disableLocalStrategy?: true\n forgotPassword?: {\n generateEmailHTML?: GenerateForgotPasswordEmailHTML\n generateEmailSubject?: GenerateForgotPasswordEmailSubject\n }\n lockTime?: number\n loginWithUsername?: LoginWithUsernameOptions | boolean\n maxLoginAttempts?: number\n removeTokenFromResponses?: true\n strategies?: AuthStrategy[]\n tokenExpiration?: number\n useAPIKey?: boolean\n verify?:\n | {\n generateEmailHTML?: GenerateVerifyEmailHTML\n generateEmailSubject?: GenerateVerifyEmailSubject\n }\n | boolean\n}\n\nexport type VerifyConfig = {\n generateEmailHTML?: GenerateVerifyEmailHTML\n generateEmailSubject?: GenerateVerifyEmailSubject\n}\n\nexport interface Auth\n extends Omit<DeepRequired<IncomingAuthType>, 'forgotPassword' | 'loginWithUsername' | 'verify'> {\n forgotPassword?: {\n generateEmailHTML?: GenerateForgotPasswordEmailHTML\n generateEmailSubject?: GenerateForgotPasswordEmailSubject\n }\n loginWithUsername: LoginWithUsernameOptions | false\n verify?: VerifyConfig | boolean\n}\n\nexport function hasWhereAccessResult(result: Where | boolean): result is Where {\n return result && typeof result === 'object'\n}\n"],"names":["hasWhereAccessResult","result"],"mappings":"AA+KA,OAAO,SAASA,qBAAqBC,MAAuB;IAC1D,OAAOA,UAAU,OAAOA,WAAW;AACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/collections/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AACrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAIlD,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,gBAAgB,CA6C9C,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,gBAW1B,CAAA;AAED,eAAO,MAAM,yBAAyB,EAAE,
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/collections/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AACrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAIlD,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,gBAAgB,CA6C9C,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,gBAW1B,CAAA;AAED,eAAO,MAAM,yBAAyB,EAAE,wBAIvC,CAAA"}
|