payload 3.0.0-beta.102 → 3.0.0-beta.104
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/fields/Array.d.ts +5 -5
- 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 +12 -12
- 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 +5 -5
- 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 +5 -5
- package/dist/admin/fields/Code.d.ts.map +1 -1
- package/dist/admin/fields/Code.js.map +1 -1
- package/dist/admin/fields/Collapsible.d.ts +5 -5
- package/dist/admin/fields/Collapsible.d.ts.map +1 -1
- package/dist/admin/fields/Collapsible.js.map +1 -1
- package/dist/admin/fields/Date.d.ts +5 -5
- 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 +5 -5
- package/dist/admin/fields/Email.d.ts.map +1 -1
- package/dist/admin/fields/Email.js.map +1 -1
- package/dist/admin/fields/Group.d.ts +5 -5
- package/dist/admin/fields/Group.d.ts.map +1 -1
- package/dist/admin/fields/Group.js.map +1 -1
- package/dist/admin/fields/JSON.d.ts +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +5 -5
- package/dist/admin/fields/RichText.d.ts.map +1 -1
- package/dist/admin/fields/RichText.js.map +1 -1
- package/dist/admin/fields/Row.d.ts +5 -5
- package/dist/admin/fields/Row.d.ts.map +1 -1
- package/dist/admin/fields/Row.js.map +1 -1
- package/dist/admin/fields/Select.d.ts +5 -5
- package/dist/admin/fields/Select.d.ts.map +1 -1
- package/dist/admin/fields/Select.js.map +1 -1
- package/dist/admin/fields/Tabs.d.ts +5 -5
- package/dist/admin/fields/Tabs.d.ts.map +1 -1
- package/dist/admin/fields/Tabs.js.map +1 -1
- package/dist/admin/fields/Text.d.ts +5 -5
- 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 +5 -5
- 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 +5 -5
- package/dist/admin/fields/Upload.d.ts.map +1 -1
- package/dist/admin/fields/Upload.js.map +1 -1
- package/dist/admin/forms/Description.d.ts +4 -3
- package/dist/admin/forms/Description.d.ts.map +1 -1
- package/dist/admin/forms/Description.js.map +1 -1
- package/dist/admin/forms/Error.d.ts +4 -3
- package/dist/admin/forms/Error.d.ts.map +1 -1
- package/dist/admin/forms/Error.js.map +1 -1
- package/dist/admin/forms/Field.d.ts +8 -7
- package/dist/admin/forms/Field.d.ts.map +1 -1
- package/dist/admin/forms/Field.js.map +1 -1
- package/dist/admin/forms/Label.d.ts +4 -3
- package/dist/admin/forms/Label.d.ts.map +1 -1
- package/dist/admin/forms/Label.js.map +1 -1
- package/dist/admin/types.d.ts +2 -2
- package/dist/admin/types.d.ts.map +1 -1
- package/dist/admin/types.js.map +1 -1
- package/dist/collections/config/sanitize.js +1 -1
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/fields/config/sanitize.spec.js.map +1 -1
- package/dist/fields/config/types.d.ts +22 -19
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/fields/validations.d.ts +4 -4
- package/dist/fields/validations.d.ts.map +1 -1
- package/dist/fields/validations.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/admin/types.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type { DocumentTabComponent, DocumentTabCondition, DocumentTabConfig, Doc
|
|
|
12
12
|
export type { CustomUpload } from './elements/Upload.js';
|
|
13
13
|
export type { WithServerSidePropsComponent, WithServerSidePropsComponentProps, } from './elements/WithServerSideProps.js';
|
|
14
14
|
export type { ArrayFieldClientComponent, ArrayFieldClientProps, ArrayFieldDescriptionClientComponent, ArrayFieldDescriptionServerComponent, ArrayFieldErrorClientComponent, ArrayFieldErrorServerComponent, ArrayFieldLabelClientComponent, ArrayFieldLabelServerComponent, ArrayFieldServerComponent, ArrayFieldServerProps, } from './fields/Array.js';
|
|
15
|
-
export type {
|
|
15
|
+
export type { BlocksFieldClientComponent, BlocksFieldClientProps, BlocksFieldDescriptionClientComponent, BlocksFieldDescriptionServerComponent, BlocksFieldErrorClientComponent, BlocksFieldErrorServerComponent, BlocksFieldLabelClientComponent, BlocksFieldLabelServerComponent, BlocksFieldServerComponent, BlocksFieldServerProps, } from './fields/Blocks.js';
|
|
16
16
|
export type { CheckboxFieldClientComponent, CheckboxFieldClientProps, CheckboxFieldDescriptionClientComponent, CheckboxFieldDescriptionServerComponent, CheckboxFieldErrorClientComponent, CheckboxFieldErrorServerComponent, CheckboxFieldLabelClientComponent, CheckboxFieldLabelServerComponent, CheckboxFieldServerComponent, CheckboxFieldServerProps, } from './fields/Checkbox.js';
|
|
17
17
|
export type { CodeFieldClientComponent, CodeFieldClientProps, CodeFieldDescriptionClientComponent, CodeFieldDescriptionServerComponent, CodeFieldErrorClientComponent, CodeFieldErrorServerComponent, CodeFieldLabelClientComponent, CodeFieldLabelServerComponent, CodeFieldServerComponent, CodeFieldServerProps, } from './fields/Code.js';
|
|
18
18
|
export type { CollapsibleFieldClientComponent, CollapsibleFieldClientProps, CollapsibleFieldDescriptionClientComponent, CollapsibleFieldDescriptionServerComponent, CollapsibleFieldErrorClientComponent, CollapsibleFieldErrorServerComponent, CollapsibleFieldLabelClientComponent, CollapsibleFieldLabelServerComponent, CollapsibleFieldServerComponent, CollapsibleFieldServerProps, } from './fields/Collapsible.js';
|
|
@@ -34,7 +34,7 @@ export type { TextareaFieldClientComponent, TextareaFieldClientProps, TextareaFi
|
|
|
34
34
|
export type { UploadFieldClientComponent, UploadFieldClientProps, UploadFieldDescriptionClientComponent, UploadFieldDescriptionServerComponent, UploadFieldErrorClientComponent, UploadFieldErrorServerComponent, UploadFieldLabelClientComponent, UploadFieldLabelServerComponent, UploadFieldServerComponent, UploadFieldServerProps, } from './fields/Upload.js';
|
|
35
35
|
export type { Description, DescriptionFunction, FieldDescriptionClientComponent, FieldDescriptionClientProps, FieldDescriptionServerComponent, FieldDescriptionServerProps, GenericDescriptionProps, StaticDescription, } from './forms/Description.js';
|
|
36
36
|
export type { FieldErrorClientComponent, FieldErrorClientProps, FieldErrorServerComponent, FieldErrorServerProps, GenericErrorProps, } from './forms/Error.js';
|
|
37
|
-
export type { FormFieldBase } from './forms/Field.js';
|
|
37
|
+
export type { FormFieldBase, ServerFieldBase } from './forms/Field.js';
|
|
38
38
|
export type { Data, FilterOptionsResult, FormField, FormState, Row } from './forms/Form.js';
|
|
39
39
|
export type { FieldLabelClientComponent, FieldLabelClientProps, FieldLabelServerComponent, FieldLabelServerProps, GenericLabelProps, SanitizedLabelProps, } from './forms/Label.js';
|
|
40
40
|
export type { RowLabel, RowLabelComponent } from './forms/RowLabel.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/admin/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,YAAY,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AACvF,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC5F,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACtE,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACtE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAChE,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAC1E,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,YAAY,EACV,4BAA4B,EAC5B,iCAAiC,GAClC,MAAM,mCAAmC,CAAA;AAE1C,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,oCAAoC,EACpC,oCAAoC,EACpC,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,mBAAmB,CAAA;AAE1B,YAAY,EACV,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/admin/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,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qBAAqB,CAAC,GAC5C,SAAS,CAAA;AAEb,MAAM,MAAM,qBAAqB,GAAG;IAClC,CAAC,CAAC,SAAS,UAAU,EACnB,SAAS,EAAE;QAAE,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG,IAAI,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAClE,KAAK,EAAE;QACL,WAAW,CAAC,EAAE,UAAU,CAAA;QACxB,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,EACD,QAAQ,EAAE,KAAK,CAAC,EAAE,EAClB,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,CAAC,CAAC,CAAA;IAErB,CAAC,CAAC,SAAS,UAAU,EACnB,UAAU,EAAE,CAAC;QAAE,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,EAChE,KAAK,EAAE;QACL,WAAW,CAAC,EAAE,UAAU,CAAA;QACxB,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,EACD,QAAQ,EAAE,KAAK,CAAC,EAAE,EAClB,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,CAAC,CAAC,EAAE,CAAA;CACxB,CAAA"}
|
package/dist/admin/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/admin/types.ts"],"sourcesContent":["import type React from 'react'\n\nimport type { PayloadComponent } from '../config/types.js'\nimport type { JsonObject } from '../types/index.js'\n\nexport type { CellComponentProps, DefaultCellComponentProps } from './elements/Cell.js'\nexport type { ConditionalDateProps } from './elements/DatePicker.js'\nexport type { DayPickerProps, SharedProps, TimePickerProps } from './elements/DatePicker.js'\nexport type { CustomPreviewButton } from './elements/PreviewButton.js'\nexport type { CustomPublishButton } from './elements/PublishButton.js'\nexport type { CustomSaveButton } from './elements/SaveButton.js'\nexport type { CustomSaveDraftButton } from './elements/SaveDraftButton.js'\nexport type {\n DocumentTabComponent,\n DocumentTabCondition,\n DocumentTabConfig,\n DocumentTabProps,\n} from './elements/Tab.js'\nexport type { CustomUpload } from './elements/Upload.js'\n\nexport type {\n WithServerSidePropsComponent,\n WithServerSidePropsComponentProps,\n} from './elements/WithServerSideProps.js'\n\nexport type {\n ArrayFieldClientComponent,\n ArrayFieldClientProps,\n ArrayFieldDescriptionClientComponent,\n ArrayFieldDescriptionServerComponent,\n ArrayFieldErrorClientComponent,\n ArrayFieldErrorServerComponent,\n ArrayFieldLabelClientComponent,\n ArrayFieldLabelServerComponent,\n ArrayFieldServerComponent,\n ArrayFieldServerProps,\n} from './fields/Array.js'\n\nexport type {\n BlockFieldDescriptionClientComponent,\n BlockFieldDescriptionServerComponent,\n BlockFieldErrorClientComponent,\n BlockFieldErrorServerComponent,\n BlockFieldLabelClientComponent,\n BlockFieldLabelServerComponent,\n BlocksFieldClientComponent,\n BlocksFieldClientProps,\n BlocksFieldServerComponent,\n BlocksFieldServerProps,\n} from './fields/Blocks.js'\n\nexport type {\n CheckboxFieldClientComponent,\n CheckboxFieldClientProps,\n CheckboxFieldDescriptionClientComponent,\n CheckboxFieldDescriptionServerComponent,\n CheckboxFieldErrorClientComponent,\n CheckboxFieldErrorServerComponent,\n CheckboxFieldLabelClientComponent,\n CheckboxFieldLabelServerComponent,\n CheckboxFieldServerComponent,\n CheckboxFieldServerProps,\n} from './fields/Checkbox.js'\n\nexport type {\n CodeFieldClientComponent,\n CodeFieldClientProps,\n CodeFieldDescriptionClientComponent,\n CodeFieldDescriptionServerComponent,\n CodeFieldErrorClientComponent,\n CodeFieldErrorServerComponent,\n CodeFieldLabelClientComponent,\n CodeFieldLabelServerComponent,\n CodeFieldServerComponent,\n CodeFieldServerProps,\n} from './fields/Code.js'\n\nexport type {\n CollapsibleFieldClientComponent,\n CollapsibleFieldClientProps,\n CollapsibleFieldDescriptionClientComponent,\n CollapsibleFieldDescriptionServerComponent,\n CollapsibleFieldErrorClientComponent,\n CollapsibleFieldErrorServerComponent,\n CollapsibleFieldLabelClientComponent,\n CollapsibleFieldLabelServerComponent,\n CollapsibleFieldServerComponent,\n CollapsibleFieldServerProps,\n} from './fields/Collapsible.js'\n\nexport type {\n DateFieldClientComponent,\n DateFieldClientProps,\n DateFieldDescriptionClientComponent,\n DateFieldDescriptionServerComponent,\n DateFieldErrorClientComponent,\n DateFieldErrorServerComponent,\n DateFieldLabelClientComponent,\n DateFieldLabelServerComponent,\n DateFieldServerComponent,\n DateFieldServerProps,\n} from './fields/Date.js'\n\nexport type {\n EmailFieldClientComponent,\n EmailFieldClientProps,\n EmailFieldDescriptionClientComponent,\n EmailFieldDescriptionServerComponent,\n EmailFieldErrorClientComponent,\n EmailFieldErrorServerComponent,\n EmailFieldLabelClientComponent,\n EmailFieldLabelServerComponent,\n EmailFieldServerComponent,\n EmailFieldServerProps,\n} from './fields/Email.js'\n\nexport type {\n GroupFieldClientComponent,\n GroupFieldClientProps,\n GroupFieldDescriptionClientComponent,\n GroupFieldDescriptionServerComponent,\n GroupFieldErrorClientComponent,\n GroupFieldErrorServerComponent,\n GroupFieldLabelClientComponent,\n GroupFieldLabelServerComponent,\n GroupFieldServerComponent,\n GroupFieldServerProps,\n} from './fields/Group.js'\n\nexport type { HiddenFieldProps } from './fields/Hidden.js'\n\nexport type {\n JSONFieldClientComponent,\n JSONFieldClientProps,\n JSONFieldDescriptionClientComponent,\n JSONFieldDescriptionServerComponent,\n JSONFieldErrorClientComponent,\n JSONFieldErrorServerComponent,\n JSONFieldLabelClientComponent,\n JSONFieldLabelServerComponent,\n JSONFieldServerComponent,\n JSONFieldServerProps,\n} from './fields/JSON.js'\n\nexport type {\n NumberFieldClientComponent,\n NumberFieldClientProps,\n NumberFieldDescriptionClientComponent,\n NumberFieldDescriptionServerComponent,\n NumberFieldErrorClientComponent,\n NumberFieldErrorServerComponent,\n NumberFieldLabelClientComponent,\n NumberFieldLabelServerComponent,\n NumberFieldServerComponent,\n NumberFieldServerProps,\n} from './fields/Number.js'\n\nexport type {\n PointFieldClientComponent,\n PointFieldClientProps,\n PointFieldDescriptionClientComponent,\n PointFieldDescriptionServerComponent,\n PointFieldErrorClientComponent,\n PointFieldErrorServerComponent,\n PointFieldLabelClientComponent,\n PointFieldLabelServerComponent,\n PointFieldServerComponent,\n PointFieldServerProps,\n} from './fields/Point.js'\n\nexport type {\n RadioFieldClientComponent,\n RadioFieldClientProps,\n RadioFieldDescriptionClientComponent,\n RadioFieldDescriptionServerComponent,\n RadioFieldErrorClientComponent,\n RadioFieldErrorServerComponent,\n RadioFieldLabelClientComponent,\n RadioFieldLabelServerComponent,\n RadioFieldServerComponent,\n RadioFieldServerProps,\n} from './fields/Radio.js'\n\nexport type {\n RelationshipFieldClientComponent,\n RelationshipFieldClientProps,\n RelationshipFieldDescriptionClientComponent,\n RelationshipFieldDescriptionServerComponent,\n RelationshipFieldErrorClientComponent,\n RelationshipFieldErrorServerComponent,\n RelationshipFieldLabelClientComponent,\n RelationshipFieldLabelServerComponent,\n RelationshipFieldServerComponent,\n RelationshipFieldServerProps,\n} from './fields/Relationship.js'\n\nexport type {\n RichTextFieldClientComponent,\n RichTextFieldClientProps,\n RichTextFieldDescriptionClientComponent,\n RichTextFieldDescriptionServerComponent,\n RichTextFieldErrorClientComponent,\n RichTextFieldErrorServerComponent,\n RichTextFieldLabelClientComponent,\n RichTextFieldLabelServerComponent,\n RichTextFieldServerComponent,\n RichTextFieldServerProps,\n} from './fields/RichText.js'\n\nexport type {\n RowFieldClientComponent,\n RowFieldClientProps,\n RowFieldDescriptionClientComponent,\n RowFieldDescriptionServerComponent,\n RowFieldErrorClientComponent,\n RowFieldErrorServerComponent,\n RowFieldLabelClientComponent,\n RowFieldLabelServerComponent,\n RowFieldServerComponent,\n RowFieldServerProps,\n} from './fields/Row.js'\n\nexport type {\n SelectFieldClientComponent,\n SelectFieldClientProps,\n SelectFieldDescriptionClientComponent,\n SelectFieldDescriptionServerComponent,\n SelectFieldErrorClientComponent,\n SelectFieldErrorServerComponent,\n SelectFieldLabelClientComponent,\n SelectFieldLabelServerComponent,\n SelectFieldServerComponent,\n SelectFieldServerProps,\n} from './fields/Select.js'\n\nexport type {\n ClientTab,\n TabsFieldClientComponent,\n TabsFieldClientProps,\n TabsFieldDescriptionClientComponent,\n TabsFieldDescriptionServerComponent,\n TabsFieldErrorClientComponent,\n TabsFieldErrorServerComponent,\n TabsFieldLabelClientComponent,\n TabsFieldLabelServerComponent,\n TabsFieldServerComponent,\n TabsFieldServerProps,\n} from './fields/Tabs.js'\n\nexport type {\n TextFieldClientComponent,\n TextFieldClientProps,\n TextFieldDescriptionClientComponent,\n TextFieldDescriptionServerComponent,\n TextFieldErrorClientComponent,\n TextFieldErrorServerComponent,\n TextFieldLabelClientComponent,\n TextFieldLabelServerComponent,\n TextFieldServerComponent,\n TextFieldServerProps,\n} from './fields/Text.js'\n\nexport type {\n TextareaFieldClientComponent,\n TextareaFieldClientProps,\n TextareaFieldDescriptionClientComponent,\n TextareaFieldDescriptionServerComponent,\n TextareaFieldErrorClientComponent,\n TextareaFieldErrorServerComponent,\n TextareaFieldLabelClientComponent,\n TextareaFieldLabelServerComponent,\n TextareaFieldServerComponent,\n TextareaFieldServerProps,\n} from './fields/Textarea.js'\n\nexport type {\n UploadFieldClientComponent,\n UploadFieldClientProps,\n UploadFieldDescriptionClientComponent,\n UploadFieldDescriptionServerComponent,\n UploadFieldErrorClientComponent,\n UploadFieldErrorServerComponent,\n UploadFieldLabelClientComponent,\n UploadFieldLabelServerComponent,\n UploadFieldServerComponent,\n UploadFieldServerProps,\n} from './fields/Upload.js'\n\nexport type {\n Description,\n DescriptionFunction,\n FieldDescriptionClientComponent,\n FieldDescriptionClientProps,\n FieldDescriptionServerComponent,\n FieldDescriptionServerProps,\n GenericDescriptionProps,\n StaticDescription,\n} from './forms/Description.js'\n\nexport type {\n FieldErrorClientComponent,\n FieldErrorClientProps,\n FieldErrorServerComponent,\n FieldErrorServerProps,\n GenericErrorProps,\n} from './forms/Error.js'\n\nexport type { FormFieldBase } from './forms/Field.js'\n\nexport type { Data, FilterOptionsResult, FormField, FormState, Row } from './forms/Form.js'\n\nexport type {\n FieldLabelClientComponent,\n FieldLabelClientProps,\n FieldLabelServerComponent,\n FieldLabelServerProps,\n GenericLabelProps,\n SanitizedLabelProps,\n} from './forms/Label.js'\n\nexport type { RowLabel, RowLabelComponent } from './forms/RowLabel.js'\n\nexport type { LanguageOptions } from './LanguageOptions.js'\n\nexport type {\n RichTextAdapter,\n RichTextAdapterProvider,\n RichTextGenerateComponentMap,\n RichTextHooks,\n} from './RichText.js'\n\nexport type {\n AdminViewComponent,\n AdminViewConfig,\n AdminViewProps,\n EditViewProps,\n InitPageResult,\n ServerSideEditViewProps,\n VisibleEntities,\n} from './views/types.js'\n\nexport type MappedServerComponent<TComponentClientProps extends JsonObject = JsonObject> = {\n Component: React.ComponentType<TComponentClientProps>\n props?: Partial<any>\n RenderedComponent: React.ReactNode\n type: 'server'\n}\n\nexport type MappedClientComponent<TComponentClientProps extends JsonObject = JsonObject> = {\n Component: React.ComponentType<TComponentClientProps>\n props?: Partial<TComponentClientProps>\n RenderedComponent?: React.ReactNode\n type: 'client'\n}\n\nexport type MappedEmptyComponent = {\n type: 'empty'\n}\n\nexport type MappedComponent<TComponentClientProps extends JsonObject = JsonObject> =\n | MappedClientComponent<TComponentClientProps>\n | MappedEmptyComponent\n | MappedServerComponent<TComponentClientProps>\n | undefined\n\nexport type CreateMappedComponent = {\n <T extends JsonObject>(\n component: { Component: React.FC<T> } | null | PayloadComponent<T>,\n props: {\n clientProps?: JsonObject\n serverProps?: object\n },\n fallback: React.FC,\n identifier: string,\n ): MappedComponent<T>\n\n <T extends JsonObject>(\n components: ({ Component: React.FC<T> } | PayloadComponent<T>)[],\n props: {\n clientProps?: JsonObject\n serverProps?: object\n },\n fallback: React.FC,\n identifier: string,\n ): MappedComponent<T>[]\n}\n"],"names":[],"mappings":"AA6WA,WAoBC"}
|
|
1
|
+
{"version":3,"sources":["../../src/admin/types.ts"],"sourcesContent":["import type React from 'react'\n\nimport type { PayloadComponent } from '../config/types.js'\nimport type { JsonObject } from '../types/index.js'\n\nexport type { CellComponentProps, DefaultCellComponentProps } from './elements/Cell.js'\nexport type { ConditionalDateProps } from './elements/DatePicker.js'\nexport type { DayPickerProps, SharedProps, TimePickerProps } from './elements/DatePicker.js'\nexport type { CustomPreviewButton } from './elements/PreviewButton.js'\nexport type { CustomPublishButton } from './elements/PublishButton.js'\nexport type { CustomSaveButton } from './elements/SaveButton.js'\nexport type { CustomSaveDraftButton } from './elements/SaveDraftButton.js'\nexport type {\n DocumentTabComponent,\n DocumentTabCondition,\n DocumentTabConfig,\n DocumentTabProps,\n} from './elements/Tab.js'\nexport type { CustomUpload } from './elements/Upload.js'\n\nexport type {\n WithServerSidePropsComponent,\n WithServerSidePropsComponentProps,\n} from './elements/WithServerSideProps.js'\n\nexport type {\n ArrayFieldClientComponent,\n ArrayFieldClientProps,\n ArrayFieldDescriptionClientComponent,\n ArrayFieldDescriptionServerComponent,\n ArrayFieldErrorClientComponent,\n ArrayFieldErrorServerComponent,\n ArrayFieldLabelClientComponent,\n ArrayFieldLabelServerComponent,\n ArrayFieldServerComponent,\n ArrayFieldServerProps,\n} from './fields/Array.js'\n\nexport type {\n BlocksFieldClientComponent,\n BlocksFieldClientProps,\n BlocksFieldDescriptionClientComponent,\n BlocksFieldDescriptionServerComponent,\n BlocksFieldErrorClientComponent,\n BlocksFieldErrorServerComponent,\n BlocksFieldLabelClientComponent,\n BlocksFieldLabelServerComponent,\n BlocksFieldServerComponent,\n BlocksFieldServerProps,\n} from './fields/Blocks.js'\n\nexport type {\n CheckboxFieldClientComponent,\n CheckboxFieldClientProps,\n CheckboxFieldDescriptionClientComponent,\n CheckboxFieldDescriptionServerComponent,\n CheckboxFieldErrorClientComponent,\n CheckboxFieldErrorServerComponent,\n CheckboxFieldLabelClientComponent,\n CheckboxFieldLabelServerComponent,\n CheckboxFieldServerComponent,\n CheckboxFieldServerProps,\n} from './fields/Checkbox.js'\n\nexport type {\n CodeFieldClientComponent,\n CodeFieldClientProps,\n CodeFieldDescriptionClientComponent,\n CodeFieldDescriptionServerComponent,\n CodeFieldErrorClientComponent,\n CodeFieldErrorServerComponent,\n CodeFieldLabelClientComponent,\n CodeFieldLabelServerComponent,\n CodeFieldServerComponent,\n CodeFieldServerProps,\n} from './fields/Code.js'\n\nexport type {\n CollapsibleFieldClientComponent,\n CollapsibleFieldClientProps,\n CollapsibleFieldDescriptionClientComponent,\n CollapsibleFieldDescriptionServerComponent,\n CollapsibleFieldErrorClientComponent,\n CollapsibleFieldErrorServerComponent,\n CollapsibleFieldLabelClientComponent,\n CollapsibleFieldLabelServerComponent,\n CollapsibleFieldServerComponent,\n CollapsibleFieldServerProps,\n} from './fields/Collapsible.js'\n\nexport type {\n DateFieldClientComponent,\n DateFieldClientProps,\n DateFieldDescriptionClientComponent,\n DateFieldDescriptionServerComponent,\n DateFieldErrorClientComponent,\n DateFieldErrorServerComponent,\n DateFieldLabelClientComponent,\n DateFieldLabelServerComponent,\n DateFieldServerComponent,\n DateFieldServerProps,\n} from './fields/Date.js'\n\nexport type {\n EmailFieldClientComponent,\n EmailFieldClientProps,\n EmailFieldDescriptionClientComponent,\n EmailFieldDescriptionServerComponent,\n EmailFieldErrorClientComponent,\n EmailFieldErrorServerComponent,\n EmailFieldLabelClientComponent,\n EmailFieldLabelServerComponent,\n EmailFieldServerComponent,\n EmailFieldServerProps,\n} from './fields/Email.js'\n\nexport type {\n GroupFieldClientComponent,\n GroupFieldClientProps,\n GroupFieldDescriptionClientComponent,\n GroupFieldDescriptionServerComponent,\n GroupFieldErrorClientComponent,\n GroupFieldErrorServerComponent,\n GroupFieldLabelClientComponent,\n GroupFieldLabelServerComponent,\n GroupFieldServerComponent,\n GroupFieldServerProps,\n} from './fields/Group.js'\n\nexport type { HiddenFieldProps } from './fields/Hidden.js'\n\nexport type {\n JSONFieldClientComponent,\n JSONFieldClientProps,\n JSONFieldDescriptionClientComponent,\n JSONFieldDescriptionServerComponent,\n JSONFieldErrorClientComponent,\n JSONFieldErrorServerComponent,\n JSONFieldLabelClientComponent,\n JSONFieldLabelServerComponent,\n JSONFieldServerComponent,\n JSONFieldServerProps,\n} from './fields/JSON.js'\n\nexport type {\n NumberFieldClientComponent,\n NumberFieldClientProps,\n NumberFieldDescriptionClientComponent,\n NumberFieldDescriptionServerComponent,\n NumberFieldErrorClientComponent,\n NumberFieldErrorServerComponent,\n NumberFieldLabelClientComponent,\n NumberFieldLabelServerComponent,\n NumberFieldServerComponent,\n NumberFieldServerProps,\n} from './fields/Number.js'\n\nexport type {\n PointFieldClientComponent,\n PointFieldClientProps,\n PointFieldDescriptionClientComponent,\n PointFieldDescriptionServerComponent,\n PointFieldErrorClientComponent,\n PointFieldErrorServerComponent,\n PointFieldLabelClientComponent,\n PointFieldLabelServerComponent,\n PointFieldServerComponent,\n PointFieldServerProps,\n} from './fields/Point.js'\n\nexport type {\n RadioFieldClientComponent,\n RadioFieldClientProps,\n RadioFieldDescriptionClientComponent,\n RadioFieldDescriptionServerComponent,\n RadioFieldErrorClientComponent,\n RadioFieldErrorServerComponent,\n RadioFieldLabelClientComponent,\n RadioFieldLabelServerComponent,\n RadioFieldServerComponent,\n RadioFieldServerProps,\n} from './fields/Radio.js'\n\nexport type {\n RelationshipFieldClientComponent,\n RelationshipFieldClientProps,\n RelationshipFieldDescriptionClientComponent,\n RelationshipFieldDescriptionServerComponent,\n RelationshipFieldErrorClientComponent,\n RelationshipFieldErrorServerComponent,\n RelationshipFieldLabelClientComponent,\n RelationshipFieldLabelServerComponent,\n RelationshipFieldServerComponent,\n RelationshipFieldServerProps,\n} from './fields/Relationship.js'\n\nexport type {\n RichTextFieldClientComponent,\n RichTextFieldClientProps,\n RichTextFieldDescriptionClientComponent,\n RichTextFieldDescriptionServerComponent,\n RichTextFieldErrorClientComponent,\n RichTextFieldErrorServerComponent,\n RichTextFieldLabelClientComponent,\n RichTextFieldLabelServerComponent,\n RichTextFieldServerComponent,\n RichTextFieldServerProps,\n} from './fields/RichText.js'\n\nexport type {\n RowFieldClientComponent,\n RowFieldClientProps,\n RowFieldDescriptionClientComponent,\n RowFieldDescriptionServerComponent,\n RowFieldErrorClientComponent,\n RowFieldErrorServerComponent,\n RowFieldLabelClientComponent,\n RowFieldLabelServerComponent,\n RowFieldServerComponent,\n RowFieldServerProps,\n} from './fields/Row.js'\n\nexport type {\n SelectFieldClientComponent,\n SelectFieldClientProps,\n SelectFieldDescriptionClientComponent,\n SelectFieldDescriptionServerComponent,\n SelectFieldErrorClientComponent,\n SelectFieldErrorServerComponent,\n SelectFieldLabelClientComponent,\n SelectFieldLabelServerComponent,\n SelectFieldServerComponent,\n SelectFieldServerProps,\n} from './fields/Select.js'\n\nexport type {\n ClientTab,\n TabsFieldClientComponent,\n TabsFieldClientProps,\n TabsFieldDescriptionClientComponent,\n TabsFieldDescriptionServerComponent,\n TabsFieldErrorClientComponent,\n TabsFieldErrorServerComponent,\n TabsFieldLabelClientComponent,\n TabsFieldLabelServerComponent,\n TabsFieldServerComponent,\n TabsFieldServerProps,\n} from './fields/Tabs.js'\n\nexport type {\n TextFieldClientComponent,\n TextFieldClientProps,\n TextFieldDescriptionClientComponent,\n TextFieldDescriptionServerComponent,\n TextFieldErrorClientComponent,\n TextFieldErrorServerComponent,\n TextFieldLabelClientComponent,\n TextFieldLabelServerComponent,\n TextFieldServerComponent,\n TextFieldServerProps,\n} from './fields/Text.js'\n\nexport type {\n TextareaFieldClientComponent,\n TextareaFieldClientProps,\n TextareaFieldDescriptionClientComponent,\n TextareaFieldDescriptionServerComponent,\n TextareaFieldErrorClientComponent,\n TextareaFieldErrorServerComponent,\n TextareaFieldLabelClientComponent,\n TextareaFieldLabelServerComponent,\n TextareaFieldServerComponent,\n TextareaFieldServerProps,\n} from './fields/Textarea.js'\n\nexport type {\n UploadFieldClientComponent,\n UploadFieldClientProps,\n UploadFieldDescriptionClientComponent,\n UploadFieldDescriptionServerComponent,\n UploadFieldErrorClientComponent,\n UploadFieldErrorServerComponent,\n UploadFieldLabelClientComponent,\n UploadFieldLabelServerComponent,\n UploadFieldServerComponent,\n UploadFieldServerProps,\n} from './fields/Upload.js'\n\nexport type {\n Description,\n DescriptionFunction,\n FieldDescriptionClientComponent,\n FieldDescriptionClientProps,\n FieldDescriptionServerComponent,\n FieldDescriptionServerProps,\n GenericDescriptionProps,\n StaticDescription,\n} from './forms/Description.js'\n\nexport type {\n FieldErrorClientComponent,\n FieldErrorClientProps,\n FieldErrorServerComponent,\n FieldErrorServerProps,\n GenericErrorProps,\n} from './forms/Error.js'\n\nexport type { FormFieldBase, ServerFieldBase } from './forms/Field.js'\n\nexport type { Data, FilterOptionsResult, FormField, FormState, Row } from './forms/Form.js'\n\nexport type {\n FieldLabelClientComponent,\n FieldLabelClientProps,\n FieldLabelServerComponent,\n FieldLabelServerProps,\n GenericLabelProps,\n SanitizedLabelProps,\n} from './forms/Label.js'\n\nexport type { RowLabel, RowLabelComponent } from './forms/RowLabel.js'\n\nexport type { LanguageOptions } from './LanguageOptions.js'\n\nexport type {\n RichTextAdapter,\n RichTextAdapterProvider,\n RichTextGenerateComponentMap,\n RichTextHooks,\n} from './RichText.js'\n\nexport type {\n AdminViewComponent,\n AdminViewConfig,\n AdminViewProps,\n EditViewProps,\n InitPageResult,\n ServerSideEditViewProps,\n VisibleEntities,\n} from './views/types.js'\n\nexport type MappedServerComponent<TComponentClientProps extends JsonObject = JsonObject> = {\n Component: React.ComponentType<TComponentClientProps>\n props?: Partial<any>\n RenderedComponent: React.ReactNode\n type: 'server'\n}\n\nexport type MappedClientComponent<TComponentClientProps extends JsonObject = JsonObject> = {\n Component: React.ComponentType<TComponentClientProps>\n props?: Partial<TComponentClientProps>\n RenderedComponent?: React.ReactNode\n type: 'client'\n}\n\nexport type MappedEmptyComponent = {\n type: 'empty'\n}\n\nexport type MappedComponent<TComponentClientProps extends JsonObject = JsonObject> =\n | MappedClientComponent<TComponentClientProps>\n | MappedEmptyComponent\n | MappedServerComponent<TComponentClientProps>\n | undefined\n\nexport type CreateMappedComponent = {\n <T extends JsonObject>(\n component: { Component: React.FC<T> } | null | PayloadComponent<T>,\n props: {\n clientProps?: JsonObject\n serverProps?: object\n },\n fallback: React.FC,\n identifier: string,\n ): MappedComponent<T>\n\n <T extends JsonObject>(\n components: ({ Component: React.FC<T> } | PayloadComponent<T>)[],\n props: {\n clientProps?: JsonObject\n serverProps?: object\n },\n fallback: React.FC,\n identifier: string,\n ): MappedComponent<T>[]\n}\n"],"names":[],"mappings":"AA6WA,WAoBC"}
|
|
@@ -31,7 +31,6 @@ export const sanitizeCollection = async (config, collection, /**
|
|
|
31
31
|
richTextSanitizationPromises,
|
|
32
32
|
validRelationships
|
|
33
33
|
});
|
|
34
|
-
validateUseAsTitle(sanitized);
|
|
35
34
|
if (sanitized.timestamps !== false) {
|
|
36
35
|
// add default timestamps fields only as needed
|
|
37
36
|
let hasUpdatedAt = null;
|
|
@@ -151,6 +150,7 @@ export const sanitizeCollection = async (config, collection, /**
|
|
|
151
150
|
if (collection?.admin?.pagination?.limits?.length) {
|
|
152
151
|
sanitized.admin.pagination.limits = collection.admin.pagination.limits;
|
|
153
152
|
}
|
|
153
|
+
validateUseAsTitle(sanitized);
|
|
154
154
|
return sanitized;
|
|
155
155
|
};
|
|
156
156
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/collections/config/sanitize.ts"],"sourcesContent":["import type { LoginWithUsernameOptions } from '../../auth/types.js'\nimport type { Config, SanitizedConfig } from '../../config/types.js'\nimport type { CollectionConfig, SanitizedCollectionConfig } from './types.js'\n\nimport { getBaseAuthFields } from '../../auth/getAuthFields.js'\nimport { TimestampsRequired } from '../../errors/TimestampsRequired.js'\nimport { sanitizeFields } from '../../fields/config/sanitize.js'\nimport { fieldAffectsData } from '../../fields/config/types.js'\nimport mergeBaseFields from '../../fields/mergeBaseFields.js'\nimport { getBaseUploadFields } from '../../uploads/getBaseFields.js'\nimport { deepMergeWithReactComponents } from '../../utilities/deepMerge.js'\nimport { formatLabels } from '../../utilities/formatLabels.js'\nimport baseVersionFields from '../../versions/baseFields.js'\nimport { versionDefaults } from '../../versions/defaults.js'\nimport { authDefaults, defaults, loginWithUsernameDefaults } from './defaults.js'\nimport { sanitizeAuthFields, sanitizeUploadFields } from './reservedFieldNames.js'\nimport { validateUseAsTitle } from './useAsTitle.js'\n\nexport const sanitizeCollection = async (\n config: Config,\n collection: CollectionConfig,\n /**\n * If this property is set, RichText fields won't be sanitized immediately. Instead, they will be added to this array as promises\n * so that you can sanitize them together, after the config has been sanitized.\n */\n richTextSanitizationPromises?: Array<(config: SanitizedConfig) => Promise<void>>,\n): Promise<SanitizedCollectionConfig> => {\n // /////////////////////////////////\n // Make copy of collection config\n // /////////////////////////////////\n\n const sanitized: CollectionConfig = deepMergeWithReactComponents(defaults, collection)\n\n // /////////////////////////////////\n // Sanitize fields\n // /////////////////////////////////\n\n const validRelationships = config.collections.map((c) => c.slug) || []\n sanitized.fields = await sanitizeFields({\n collectionConfig: sanitized,\n config,\n fields: sanitized.fields,\n parentIsLocalized: false,\n richTextSanitizationPromises,\n validRelationships,\n })\n\n validateUseAsTitle(sanitized)\n\n if (sanitized.timestamps !== false) {\n // add default timestamps fields only as needed\n let hasUpdatedAt = null\n let hasCreatedAt = null\n sanitized.fields.some((field) => {\n if (fieldAffectsData(field)) {\n if (field.name === 'updatedAt') {\n hasUpdatedAt = true\n }\n if (field.name === 'createdAt') {\n hasCreatedAt = true\n }\n }\n return hasCreatedAt && hasUpdatedAt\n })\n if (!hasUpdatedAt) {\n sanitized.fields.push({\n name: 'updatedAt',\n type: 'date',\n admin: {\n disableBulkEdit: true,\n hidden: true,\n },\n label: ({ t }) => t('general:updatedAt'),\n })\n }\n if (!hasCreatedAt) {\n sanitized.fields.push({\n name: 'createdAt',\n admin: {\n disableBulkEdit: true,\n hidden: true,\n },\n // The default sort for list view is createdAt. Thus, enabling indexing by default, is a major performance improvement, especially for large or a large amount of collections.\n type: 'date',\n index: true,\n label: ({ t }) => t('general:createdAt'),\n })\n }\n }\n\n sanitized.labels = sanitized.labels || formatLabels(sanitized.slug)\n\n if (sanitized.versions) {\n if (sanitized.versions === true) {\n sanitized.versions = { drafts: false }\n }\n\n if (sanitized.timestamps === false) {\n throw new TimestampsRequired(collection)\n }\n\n if (sanitized.versions.drafts) {\n if (sanitized.versions.drafts === true) {\n sanitized.versions.drafts = {\n autosave: false,\n validate: false,\n }\n }\n\n if (sanitized.versions.drafts.autosave === true) {\n sanitized.versions.drafts.autosave = {\n interval: versionDefaults.autosaveInterval,\n }\n }\n\n if (sanitized.versions.drafts.validate === undefined) {\n sanitized.versions.drafts.validate = false\n }\n\n sanitized.fields = mergeBaseFields(sanitized.fields, baseVersionFields)\n }\n }\n\n if (sanitized.upload) {\n if (sanitized.upload === true) {\n sanitized.upload = {}\n }\n\n // sanitize fields for reserved names\n sanitizeUploadFields(sanitized.fields, sanitized)\n\n // disable duplicate for uploads by default\n sanitized.disableDuplicate = sanitized.disableDuplicate || true\n\n sanitized.upload.bulkUpload = sanitized.upload?.bulkUpload ?? true\n sanitized.upload.staticDir = sanitized.upload.staticDir || sanitized.slug\n sanitized.admin.useAsTitle =\n sanitized.admin.useAsTitle && sanitized.admin.useAsTitle !== 'id'\n ? sanitized.admin.useAsTitle\n : 'filename'\n\n const uploadFields = getBaseUploadFields({\n collection: sanitized,\n config,\n })\n\n sanitized.fields = mergeBaseFields(sanitized.fields, uploadFields)\n }\n\n if (sanitized.auth) {\n // sanitize fields for reserved names\n sanitizeAuthFields(sanitized.fields, sanitized)\n\n sanitized.auth = deepMergeWithReactComponents(\n authDefaults,\n typeof sanitized.auth === 'object' ? sanitized.auth : {},\n )\n\n if (!sanitized.auth.disableLocalStrategy && sanitized.auth.verify === true) {\n sanitized.auth.verify = {}\n }\n\n // disable duplicate for auth enabled collections by default\n sanitized.disableDuplicate = sanitized.disableDuplicate || true\n\n if (!sanitized.auth.strategies) {\n sanitized.auth.strategies = []\n }\n\n if (sanitized.auth.loginWithUsername) {\n if (sanitized.auth.loginWithUsername === true) {\n sanitized.auth.loginWithUsername = loginWithUsernameDefaults\n } else {\n const loginWithUsernameWithDefaults = {\n ...loginWithUsernameDefaults,\n ...sanitized.auth.loginWithUsername,\n } as LoginWithUsernameOptions\n\n // if allowEmailLogin is false, requireUsername must be true\n if (loginWithUsernameWithDefaults.allowEmailLogin === false) {\n loginWithUsernameWithDefaults.requireUsername = true\n }\n sanitized.auth.loginWithUsername = loginWithUsernameWithDefaults\n }\n } else {\n sanitized.auth.loginWithUsername = false\n }\n\n sanitized.fields = mergeBaseFields(sanitized.fields, getBaseAuthFields(sanitized.auth))\n }\n\n if (collection?.admin?.pagination?.limits?.length) {\n sanitized.admin.pagination.limits = collection.admin.pagination.limits\n }\n\n return sanitized as SanitizedCollectionConfig\n}\n"],"names":["getBaseAuthFields","TimestampsRequired","sanitizeFields","fieldAffectsData","mergeBaseFields","getBaseUploadFields","deepMergeWithReactComponents","formatLabels","baseVersionFields","versionDefaults","authDefaults","defaults","loginWithUsernameDefaults","sanitizeAuthFields","sanitizeUploadFields","validateUseAsTitle","sanitizeCollection","config","collection","richTextSanitizationPromises","sanitized","validRelationships","collections","map","c","slug","fields","collectionConfig","parentIsLocalized","timestamps","hasUpdatedAt","hasCreatedAt","some","field","name","push","type","admin","disableBulkEdit","hidden","label","t","index","labels","versions","drafts","autosave","validate","interval","autosaveInterval","undefined","upload","disableDuplicate","bulkUpload","staticDir","useAsTitle","uploadFields","auth","disableLocalStrategy","verify","strategies","loginWithUsername","loginWithUsernameWithDefaults","allowEmailLogin","requireUsername","pagination","limits","length"],"mappings":"AAIA,SAASA,iBAAiB,QAAQ,8BAA6B;AAC/D,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,cAAc,QAAQ,kCAAiC;AAChE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,OAAOC,qBAAqB,kCAAiC;AAC7D,SAASC,mBAAmB,QAAQ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B,GAAGjD;YACrC,OAAO;gBACL,MAAMkD,gCAAgC;oBACpC,GAAGlD,yBAAyB;oBAC5B,GAAGQ,UAAUqC,IAAI,CAACI,iBAAiB;gBACrC;gBAEA,4DAA4D;gBAC5D,IAAIC,8BAA8BC,eAAe,KAAK,OAAO;oBAC3DD,8BAA8BE,eAAe,GAAG;gBAClD;gBACA5C,UAAUqC,IAAI,CAACI,iBAAiB,GAAGC;YACrC;QACF,OAAO;YACL1C,UAAUqC,IAAI,CAACI,iBAAiB,GAAG;QACrC;QAEAzC,UAAUM,MAAM,GAAGtB,gBAAgBgB,UAAUM,MAAM,EAAE1B,kBAAkBoB,UAAUqC,IAAI;IACvF;IAEA,IAAIvC,YAAYmB,OAAO4B,YAAYC,QAAQC,QAAQ;QACjD/C,UAAUiB,KAAK,CAAC4B,UAAU,CAACC,MAAM,GAAGhD,WAAWmB,KAAK,CAAC4B,UAAU,CAACC,MAAM;IACxE;IAEA,OAAO9C;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/config/sanitize.ts"],"sourcesContent":["import type { LoginWithUsernameOptions } from '../../auth/types.js'\nimport type { Config, SanitizedConfig } from '../../config/types.js'\nimport type { CollectionConfig, SanitizedCollectionConfig } from './types.js'\n\nimport { getBaseAuthFields } from '../../auth/getAuthFields.js'\nimport { TimestampsRequired } from '../../errors/TimestampsRequired.js'\nimport { sanitizeFields } from '../../fields/config/sanitize.js'\nimport { fieldAffectsData } from '../../fields/config/types.js'\nimport mergeBaseFields from '../../fields/mergeBaseFields.js'\nimport { getBaseUploadFields } from '../../uploads/getBaseFields.js'\nimport { deepMergeWithReactComponents } from '../../utilities/deepMerge.js'\nimport { formatLabels } from '../../utilities/formatLabels.js'\nimport baseVersionFields from '../../versions/baseFields.js'\nimport { versionDefaults } from '../../versions/defaults.js'\nimport { authDefaults, defaults, loginWithUsernameDefaults } from './defaults.js'\nimport { sanitizeAuthFields, sanitizeUploadFields } from './reservedFieldNames.js'\nimport { validateUseAsTitle } from './useAsTitle.js'\n\nexport const sanitizeCollection = async (\n config: Config,\n collection: CollectionConfig,\n /**\n * If this property is set, RichText fields won't be sanitized immediately. Instead, they will be added to this array as promises\n * so that you can sanitize them together, after the config has been sanitized.\n */\n richTextSanitizationPromises?: Array<(config: SanitizedConfig) => Promise<void>>,\n): Promise<SanitizedCollectionConfig> => {\n // /////////////////////////////////\n // Make copy of collection config\n // /////////////////////////////////\n\n const sanitized: CollectionConfig = deepMergeWithReactComponents(defaults, collection)\n\n // /////////////////////////////////\n // Sanitize fields\n // /////////////////////////////////\n\n const validRelationships = config.collections.map((c) => c.slug) || []\n sanitized.fields = await sanitizeFields({\n collectionConfig: sanitized,\n config,\n fields: sanitized.fields,\n parentIsLocalized: false,\n richTextSanitizationPromises,\n validRelationships,\n })\n\n if (sanitized.timestamps !== false) {\n // add default timestamps fields only as needed\n let hasUpdatedAt = null\n let hasCreatedAt = null\n sanitized.fields.some((field) => {\n if (fieldAffectsData(field)) {\n if (field.name === 'updatedAt') {\n hasUpdatedAt = true\n }\n if (field.name === 'createdAt') {\n hasCreatedAt = true\n }\n }\n return hasCreatedAt && hasUpdatedAt\n })\n if (!hasUpdatedAt) {\n sanitized.fields.push({\n name: 'updatedAt',\n type: 'date',\n admin: {\n disableBulkEdit: true,\n hidden: true,\n },\n label: ({ t }) => t('general:updatedAt'),\n })\n }\n if (!hasCreatedAt) {\n sanitized.fields.push({\n name: 'createdAt',\n admin: {\n disableBulkEdit: true,\n hidden: true,\n },\n // The default sort for list view is createdAt. Thus, enabling indexing by default, is a major performance improvement, especially for large or a large amount of collections.\n type: 'date',\n index: true,\n label: ({ t }) => t('general:createdAt'),\n })\n }\n }\n\n sanitized.labels = sanitized.labels || formatLabels(sanitized.slug)\n\n if (sanitized.versions) {\n if (sanitized.versions === true) {\n sanitized.versions = { drafts: false }\n }\n\n if (sanitized.timestamps === false) {\n throw new TimestampsRequired(collection)\n }\n\n if (sanitized.versions.drafts) {\n if (sanitized.versions.drafts === true) {\n sanitized.versions.drafts = {\n autosave: false,\n validate: false,\n }\n }\n\n if (sanitized.versions.drafts.autosave === true) {\n sanitized.versions.drafts.autosave = {\n interval: versionDefaults.autosaveInterval,\n }\n }\n\n if (sanitized.versions.drafts.validate === undefined) {\n sanitized.versions.drafts.validate = false\n }\n\n sanitized.fields = mergeBaseFields(sanitized.fields, baseVersionFields)\n }\n }\n\n if (sanitized.upload) {\n if (sanitized.upload === true) {\n sanitized.upload = {}\n }\n\n // sanitize fields for reserved names\n sanitizeUploadFields(sanitized.fields, sanitized)\n\n // disable duplicate for uploads by default\n sanitized.disableDuplicate = sanitized.disableDuplicate || true\n\n sanitized.upload.bulkUpload = sanitized.upload?.bulkUpload ?? true\n sanitized.upload.staticDir = sanitized.upload.staticDir || sanitized.slug\n sanitized.admin.useAsTitle =\n sanitized.admin.useAsTitle && sanitized.admin.useAsTitle !== 'id'\n ? sanitized.admin.useAsTitle\n : 'filename'\n\n const uploadFields = getBaseUploadFields({\n collection: sanitized,\n config,\n })\n\n sanitized.fields = mergeBaseFields(sanitized.fields, uploadFields)\n }\n\n if (sanitized.auth) {\n // sanitize fields for reserved names\n sanitizeAuthFields(sanitized.fields, sanitized)\n\n sanitized.auth = deepMergeWithReactComponents(\n authDefaults,\n typeof sanitized.auth === 'object' ? sanitized.auth : {},\n )\n\n if (!sanitized.auth.disableLocalStrategy && sanitized.auth.verify === true) {\n sanitized.auth.verify = {}\n }\n\n // disable duplicate for auth enabled collections by default\n sanitized.disableDuplicate = sanitized.disableDuplicate || true\n\n if (!sanitized.auth.strategies) {\n sanitized.auth.strategies = []\n }\n\n if (sanitized.auth.loginWithUsername) {\n if (sanitized.auth.loginWithUsername === true) {\n sanitized.auth.loginWithUsername = loginWithUsernameDefaults\n } else {\n const loginWithUsernameWithDefaults = {\n ...loginWithUsernameDefaults,\n ...sanitized.auth.loginWithUsername,\n } as LoginWithUsernameOptions\n\n // if allowEmailLogin is false, requireUsername must be true\n if (loginWithUsernameWithDefaults.allowEmailLogin === false) {\n loginWithUsernameWithDefaults.requireUsername = true\n }\n sanitized.auth.loginWithUsername = loginWithUsernameWithDefaults\n }\n } else {\n sanitized.auth.loginWithUsername = false\n }\n\n sanitized.fields = mergeBaseFields(sanitized.fields, getBaseAuthFields(sanitized.auth))\n }\n\n if (collection?.admin?.pagination?.limits?.length) {\n sanitized.admin.pagination.limits = collection.admin.pagination.limits\n }\n\n validateUseAsTitle(sanitized)\n\n return sanitized as SanitizedCollectionConfig\n}\n"],"names":["getBaseAuthFields","TimestampsRequired","sanitizeFields","fieldAffectsData","mergeBaseFields","getBaseUploadFields","deepMergeWithReactComponents","formatLabels","baseVersionFields","versionDefaults","authDefaults","defaults","loginWithUsernameDefaults","sanitizeAuthFields","sanitizeUploadFields","validateUseAsTitle","sanitizeCollection","config","collection","richTextSanitizationPromises","sanitized","validRelationships","collections","map","c","slug","fields","collectionConfig","parentIsLocalized","timestamps","hasUpdatedAt","hasCreatedAt","some","field","name","push","type","admin","disableBulkEdit","hidden","label","t","index","labels","versions","drafts","autosave","validate","interval","autosaveInterval","undefined","upload","disableDuplicate","bulkUpload","staticDir","useAsTitle","uploadFields","auth","disableLocalStrategy","verify","strategies","loginWithUsername","loginWithUsernameWithDefaults","allowEmailLogin","requireUsername","pagination","limits","length"],"mappings":"AAIA,SAASA,iBAAiB,QAAQ,8BAA6B;AAC/D,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,cAAc,QAAQ,kCAAiC;AAChE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,OAAOC,qBAAqB,kCAAiC;AAC7D,SAASC,mBAAmB,QAAQ,iCAAgC;AACpE,SAASC,4BAA4B,QAAQ,+BAA8B;AAC3E,SAASC,YAAY,QAAQ,kCAAiC;AAC9D,OAAOC,uBAAuB,+BAA8B;AAC5D,SAASC,eAAe,QAAQ,6BAA4B;AAC5D,SAASC,YAAY,EAAEC,QAAQ,EAAEC,yBAAyB,QAAQ,gBAAe;AACjF,SAASC,kBAAk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iBAAiB,GAAGC;YACrC;QACF,OAAO;YACL1C,UAAUqC,IAAI,CAACI,iBAAiB,GAAG;QACrC;QAEAzC,UAAUM,MAAM,GAAGtB,gBAAgBgB,UAAUM,MAAM,EAAE1B,kBAAkBoB,UAAUqC,IAAI;IACvF;IAEA,IAAIvC,YAAYmB,OAAO4B,YAAYC,QAAQC,QAAQ;QACjD/C,UAAUiB,KAAK,CAAC4B,UAAU,CAACC,MAAM,GAAGhD,WAAWmB,KAAK,CAAC4B,UAAU,CAACC,MAAM;IACxE;IAEAnD,mBAAmBK;IAEnB,OAAOA;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/config/sanitize.spec.ts"],"sourcesContent":["import type { Config } from '../../config/types.js'\nimport type {\n ArrayField,\n Block,\n BlockField,\n CheckboxField,\n Field,\n NumberField,\n TextField,\n} from './types.js'\n\nimport { InvalidFieldName, InvalidFieldRelationship, MissingFieldType } from '../../errors/index.js'\nimport { sanitizeFields } from './sanitize.js'\n\ndescribe('sanitizeFields', () => {\n const config = {} as Config\n it('should throw on missing type field', async () => {\n const fields: Field[] = [\n // @ts-expect-error\n {\n name: 'Some Collection',\n label: 'some-collection',\n },\n ]\n await expect(async () => {\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n }).rejects.toThrow(MissingFieldType)\n })\n it('should throw on invalid field name', async () => {\n const fields: Field[] = [\n {\n name: 'some.collection',\n type: 'text',\n label: 'some.collection',\n },\n ]\n await expect(async () => {\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n }).rejects.toThrow(InvalidFieldName)\n })\n\n describe('auto-labeling', () => {\n it('should populate label if missing', async () => {\n const fields: Field[] = [\n {\n name: 'someField',\n type: 'text',\n },\n ]\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as TextField\n expect(sanitizedField.name).toStrictEqual('someField')\n expect(sanitizedField.label).toStrictEqual('Some Field')\n expect(sanitizedField.type).toStrictEqual('text')\n })\n it('should allow auto-label override', async () => {\n const fields: Field[] = [\n {\n name: 'someField',\n type: 'text',\n label: 'Do not label',\n },\n ]\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as TextField\n expect(sanitizedField.name).toStrictEqual('someField')\n expect(sanitizedField.label).toStrictEqual('Do not label')\n expect(sanitizedField.type).toStrictEqual('text')\n })\n\n describe('opt-out', () => {\n it('should allow label opt-out', async () => {\n const fields: Field[] = [\n {\n name: 'someField',\n type: 'text',\n label: false,\n },\n ]\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as TextField\n expect(sanitizedField.name).toStrictEqual('someField')\n expect(sanitizedField.label).toStrictEqual(false)\n expect(sanitizedField.type).toStrictEqual('text')\n })\n\n it('should allow label opt-out for arrays', async () => {\n const arrayField: ArrayField = {\n name: 'items',\n type: 'array',\n fields: [\n {\n name: 'itemName',\n type: 'text',\n },\n ],\n label: false,\n }\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields: [arrayField],\n validRelationships: [],\n })\n )[0] as ArrayField\n expect(sanitizedField.name).toStrictEqual('items')\n expect(sanitizedField.label).toStrictEqual(false)\n expect(sanitizedField.type).toStrictEqual('array')\n expect(sanitizedField.labels).toBeUndefined()\n })\n it('should allow label opt-out for blocks', async () => {\n const fields: Field[] = [\n {\n name: 'noLabelBlock',\n type: 'blocks',\n blocks: [\n {\n slug: 'number',\n fields: [\n {\n name: 'testNumber',\n type: 'number',\n },\n ],\n },\n ],\n label: false,\n },\n ]\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as BlockField\n expect(sanitizedField.name).toStrictEqual('noLabelBlock')\n expect(sanitizedField.label).toStrictEqual(false)\n expect(sanitizedField.type).toStrictEqual('blocks')\n expect(sanitizedField.labels).toBeUndefined()\n })\n })\n\n it('should label arrays with plural and singular', async () => {\n const fields: Field[] = [\n {\n name: 'items',\n type: 'array',\n fields: [\n {\n name: 'itemName',\n type: 'text',\n },\n ],\n },\n ]\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as ArrayField\n expect(sanitizedField.name).toStrictEqual('items')\n expect(sanitizedField.label).toStrictEqual('Items')\n expect(sanitizedField.type).toStrictEqual('array')\n expect(sanitizedField.labels).toMatchObject({ plural: 'Items', singular: 'Item' })\n })\n\n it('should label blocks with plural and singular', async () => {\n const fields: Field[] = [\n {\n name: 'specialBlock',\n type: 'blocks',\n blocks: [\n {\n slug: 'number',\n fields: [{ name: 'testNumber', type: 'number' }],\n },\n ],\n },\n ]\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as BlockField\n expect(sanitizedField.name).toStrictEqual('specialBlock')\n expect(sanitizedField.label).toStrictEqual('Special Block')\n expect(sanitizedField.type).toStrictEqual('blocks')\n expect(sanitizedField.labels).toMatchObject({\n plural: 'Special Blocks',\n singular: 'Special Block',\n })\n expect((sanitizedField.blocks[0].fields[0] as NumberField).label).toStrictEqual('Test Number')\n })\n })\n\n describe('relationships', () => {\n it('should not throw on valid relationship', async () => {\n const validRelationships = ['some-collection']\n const fields: Field[] = [\n {\n name: 'My Relationship',\n type: 'relationship',\n label: 'my-relationship',\n relationTo: 'some-collection',\n },\n ]\n await expect(async () => {\n await sanitizeFields({ config, fields, validRelationships })\n }).not.toThrow()\n })\n\n it('should not throw on valid relationship - multiple', async () => {\n const validRelationships = ['some-collection', 'another-collection']\n const fields: Field[] = [\n {\n name: 'My Relationship',\n type: 'relationship',\n label: 'my-relationship',\n relationTo: ['some-collection', 'another-collection'],\n },\n ]\n await expect(async () => {\n await sanitizeFields({ config, fields, validRelationships })\n }).not.toThrow()\n })\n\n it('should not throw on valid relationship inside blocks', async () => {\n const validRelationships = ['some-collection']\n const relationshipBlock: Block = {\n slug: 'relationshipBlock',\n fields: [\n {\n name: 'My Relationship',\n type: 'relationship',\n label: 'my-relationship',\n relationTo: 'some-collection',\n },\n ],\n }\n const fields: Field[] = [\n {\n name: 'layout',\n type: 'blocks',\n blocks: [relationshipBlock],\n label: 'Layout Blocks',\n },\n ]\n await expect(async () => {\n await sanitizeFields({ config, fields, validRelationships })\n }).not.toThrow()\n })\n\n it('should throw on invalid relationship', async () => {\n const validRelationships = ['some-collection']\n const fields: Field[] = [\n {\n name: 'My Relationship',\n type: 'relationship',\n label: 'my-relationship',\n relationTo: 'not-valid',\n },\n ]\n await expect(async () => {\n await sanitizeFields({ config, fields, validRelationships })\n }).rejects.toThrow(InvalidFieldRelationship)\n })\n\n it('should throw on invalid relationship - multiple', async () => {\n const validRelationships = ['some-collection', 'another-collection']\n const fields: Field[] = [\n {\n name: 'My Relationship',\n type: 'relationship',\n label: 'my-relationship',\n relationTo: ['some-collection', 'not-valid'],\n },\n ]\n await expect(async () => {\n await sanitizeFields({ config, fields, validRelationships })\n }).rejects.toThrow(InvalidFieldRelationship)\n })\n\n it('should throw on invalid relationship inside blocks', async () => {\n const validRelationships = ['some-collection']\n const relationshipBlock: Block = {\n slug: 'relationshipBlock',\n fields: [\n {\n name: 'My Relationship',\n type: 'relationship',\n label: 'my-relationship',\n relationTo: 'not-valid',\n },\n ],\n }\n const fields: Field[] = [\n {\n name: 'layout',\n type: 'blocks',\n blocks: [relationshipBlock],\n label: 'Layout Blocks',\n },\n ]\n await expect(async () => {\n await sanitizeFields({ config, fields, validRelationships })\n }).rejects.toThrow(InvalidFieldRelationship)\n })\n\n it('should defaultValue of checkbox to false if required and undefined', async () => {\n const fields: Field[] = [\n {\n name: 'My Checkbox',\n type: 'checkbox',\n required: true,\n },\n ]\n\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as CheckboxField\n expect(sanitizedField.defaultValue).toStrictEqual(false)\n })\n\n it('should return empty field array if no fields', async () => {\n const sanitizedFields = await sanitizeFields({\n config,\n fields: [],\n validRelationships: [],\n })\n expect(sanitizedFields).toStrictEqual([])\n })\n })\n})\n"],"names":["InvalidFieldName","InvalidFieldRelationship","MissingFieldType","sanitizeFields","describe","config","it","fields","name","label","expect","validRelationships","rejects","toThrow","type","sanitizedField","toStrictEqual","arrayField","labels","toBeUndefined","blocks","slug","toMatchObject","plural","singular","relationTo","not","relationshipBlock","required","defaultValue","sanitizedFields"],"mappings":"AAWA,SAASA,gBAAgB,EAAEC,wBAAwB,EAAEC,gBAAgB,QAAQ,wBAAuB;AACpG,SAASC,cAAc,QAAQ,gBAAe;AAE9CC,SAAS,kBAAkB;IACzB,MAAMC,SAAS,CAAC;IAChBC,GAAG,sCAAsC;QACvC,MAAMC,SAAkB;YACtB,mBAAmB;YACnB;gBACEC,MAAM;gBACNC,OAAO;YACT;SACD;QACD,MAAMC,OAAO;YACX,MAAMP,eAAe;gBACnBE;gBACAE;gBACAI,oBAAoB,EAAE;YACxB;QACF,GAAGC,OAAO,CAACC,OAAO,CAACX;IACrB;IACAI,GAAG,sCAAsC;QACvC,MAAMC,SAAkB;YACtB;gBACEC,MAAM;gBACNM,MAAM;gBACNL,OAAO;YACT;SACD;QACD,MAAMC,OAAO;YACX,MAAMP,eAAe;gBACnBE;gBACAE;gBACAI,oBAAoB,EAAE;YACxB;QACF,GAAGC,OAAO,CAACC,OAAO,CAACb;IACrB;IAEAI,SAAS,iBAAiB;QACxBE,GAAG,oCAAoC;YACrC,MAAMC,SAAkB;gBACtB;oBACEC,MAAM;oBACNM,MAAM;gBACR;aACD;YACD,MAAMC,iBAAiB,AACrB,CAAA,MAAMZ,eAAe;gBACnBE;gBACAE;gBACAI,oBAAoB,EAAE;YACxB,EAAC,CACF,CAAC,EAAE;YACJD,OAAOK,eAAeP,IAAI,EAAEQ,aAAa,CAAC;YAC1CN,OAAOK,eAAeN,KAAK,EAAEO,aAAa,CAAC;YAC3CN,OAAOK,eAAeD,IAAI,EAAEE,aAAa,CAAC;QAC5C;QACAV,GAAG,oCAAoC;YACrC,MAAMC,SAAkB;gBACtB;oB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;gBACZ;aACD;YAED,MAAMb,iBAAiB,AACrB,CAAA,MAAMZ,eAAe;gBACnBE;gBACAE;gBACAI,oBAAoB,EAAE;YACxB,EAAC,CACF,CAAC,EAAE;YACJD,OAAOK,eAAec,YAAY,EAAEb,aAAa,CAAC;QACpD;QAEAV,GAAG,gDAAgD;YACjD,MAAMwB,kBAAkB,MAAM3B,eAAe;gBAC3CE;gBACAE,QAAQ,EAAE;gBACVI,oBAAoB,EAAE;YACxB;YACAD,OAAOoB,iBAAiBd,aAAa,CAAC,EAAE;QAC1C;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/config/sanitize.spec.ts"],"sourcesContent":["import type { Config } from '../../config/types.js'\nimport type {\n ArrayField,\n Block,\n BlocksField,\n CheckboxField,\n Field,\n NumberField,\n TextField,\n} from './types.js'\n\nimport { InvalidFieldName, InvalidFieldRelationship, MissingFieldType } from '../../errors/index.js'\nimport { sanitizeFields } from './sanitize.js'\n\ndescribe('sanitizeFields', () => {\n const config = {} as Config\n it('should throw on missing type field', async () => {\n const fields: Field[] = [\n // @ts-expect-error\n {\n name: 'Some Collection',\n label: 'some-collection',\n },\n ]\n await expect(async () => {\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n }).rejects.toThrow(MissingFieldType)\n })\n it('should throw on invalid field name', async () => {\n const fields: Field[] = [\n {\n name: 'some.collection',\n type: 'text',\n label: 'some.collection',\n },\n ]\n await expect(async () => {\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n }).rejects.toThrow(InvalidFieldName)\n })\n\n describe('auto-labeling', () => {\n it('should populate label if missing', async () => {\n const fields: Field[] = [\n {\n name: 'someField',\n type: 'text',\n },\n ]\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as TextField\n expect(sanitizedField.name).toStrictEqual('someField')\n expect(sanitizedField.label).toStrictEqual('Some Field')\n expect(sanitizedField.type).toStrictEqual('text')\n })\n it('should allow auto-label override', async () => {\n const fields: Field[] = [\n {\n name: 'someField',\n type: 'text',\n label: 'Do not label',\n },\n ]\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as TextField\n expect(sanitizedField.name).toStrictEqual('someField')\n expect(sanitizedField.label).toStrictEqual('Do not label')\n expect(sanitizedField.type).toStrictEqual('text')\n })\n\n describe('opt-out', () => {\n it('should allow label opt-out', async () => {\n const fields: Field[] = [\n {\n name: 'someField',\n type: 'text',\n label: false,\n },\n ]\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as TextField\n expect(sanitizedField.name).toStrictEqual('someField')\n expect(sanitizedField.label).toStrictEqual(false)\n expect(sanitizedField.type).toStrictEqual('text')\n })\n\n it('should allow label opt-out for arrays', async () => {\n const arrayField: ArrayField = {\n name: 'items',\n type: 'array',\n fields: [\n {\n name: 'itemName',\n type: 'text',\n },\n ],\n label: false,\n }\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields: [arrayField],\n validRelationships: [],\n })\n )[0] as ArrayField\n expect(sanitizedField.name).toStrictEqual('items')\n expect(sanitizedField.label).toStrictEqual(false)\n expect(sanitizedField.type).toStrictEqual('array')\n expect(sanitizedField.labels).toBeUndefined()\n })\n it('should allow label opt-out for blocks', async () => {\n const fields: Field[] = [\n {\n name: 'noLabelBlock',\n type: 'blocks',\n blocks: [\n {\n slug: 'number',\n fields: [\n {\n name: 'testNumber',\n type: 'number',\n },\n ],\n },\n ],\n label: false,\n },\n ]\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as BlocksField\n expect(sanitizedField.name).toStrictEqual('noLabelBlock')\n expect(sanitizedField.label).toStrictEqual(false)\n expect(sanitizedField.type).toStrictEqual('blocks')\n expect(sanitizedField.labels).toBeUndefined()\n })\n })\n\n it('should label arrays with plural and singular', async () => {\n const fields: Field[] = [\n {\n name: 'items',\n type: 'array',\n fields: [\n {\n name: 'itemName',\n type: 'text',\n },\n ],\n },\n ]\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as ArrayField\n expect(sanitizedField.name).toStrictEqual('items')\n expect(sanitizedField.label).toStrictEqual('Items')\n expect(sanitizedField.type).toStrictEqual('array')\n expect(sanitizedField.labels).toMatchObject({ plural: 'Items', singular: 'Item' })\n })\n\n it('should label blocks with plural and singular', async () => {\n const fields: Field[] = [\n {\n name: 'specialBlock',\n type: 'blocks',\n blocks: [\n {\n slug: 'number',\n fields: [{ name: 'testNumber', type: 'number' }],\n },\n ],\n },\n ]\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as BlocksField\n expect(sanitizedField.name).toStrictEqual('specialBlock')\n expect(sanitizedField.label).toStrictEqual('Special Block')\n expect(sanitizedField.type).toStrictEqual('blocks')\n expect(sanitizedField.labels).toMatchObject({\n plural: 'Special Blocks',\n singular: 'Special Block',\n })\n expect((sanitizedField.blocks[0].fields[0] as NumberField).label).toStrictEqual('Test Number')\n })\n })\n\n describe('relationships', () => {\n it('should not throw on valid relationship', async () => {\n const validRelationships = ['some-collection']\n const fields: Field[] = [\n {\n name: 'My Relationship',\n type: 'relationship',\n label: 'my-relationship',\n relationTo: 'some-collection',\n },\n ]\n await expect(async () => {\n await sanitizeFields({ config, fields, validRelationships })\n }).not.toThrow()\n })\n\n it('should not throw on valid relationship - multiple', async () => {\n const validRelationships = ['some-collection', 'another-collection']\n const fields: Field[] = [\n {\n name: 'My Relationship',\n type: 'relationship',\n label: 'my-relationship',\n relationTo: ['some-collection', 'another-collection'],\n },\n ]\n await expect(async () => {\n await sanitizeFields({ config, fields, validRelationships })\n }).not.toThrow()\n })\n\n it('should not throw on valid relationship inside blocks', async () => {\n const validRelationships = ['some-collection']\n const relationshipBlock: Block = {\n slug: 'relationshipBlock',\n fields: [\n {\n name: 'My Relationship',\n type: 'relationship',\n label: 'my-relationship',\n relationTo: 'some-collection',\n },\n ],\n }\n const fields: Field[] = [\n {\n name: 'layout',\n type: 'blocks',\n blocks: [relationshipBlock],\n label: 'Layout Blocks',\n },\n ]\n await expect(async () => {\n await sanitizeFields({ config, fields, validRelationships })\n }).not.toThrow()\n })\n\n it('should throw on invalid relationship', async () => {\n const validRelationships = ['some-collection']\n const fields: Field[] = [\n {\n name: 'My Relationship',\n type: 'relationship',\n label: 'my-relationship',\n relationTo: 'not-valid',\n },\n ]\n await expect(async () => {\n await sanitizeFields({ config, fields, validRelationships })\n }).rejects.toThrow(InvalidFieldRelationship)\n })\n\n it('should throw on invalid relationship - multiple', async () => {\n const validRelationships = ['some-collection', 'another-collection']\n const fields: Field[] = [\n {\n name: 'My Relationship',\n type: 'relationship',\n label: 'my-relationship',\n relationTo: ['some-collection', 'not-valid'],\n },\n ]\n await expect(async () => {\n await sanitizeFields({ config, fields, validRelationships })\n }).rejects.toThrow(InvalidFieldRelationship)\n })\n\n it('should throw on invalid relationship inside blocks', async () => {\n const validRelationships = ['some-collection']\n const relationshipBlock: Block = {\n slug: 'relationshipBlock',\n fields: [\n {\n name: 'My Relationship',\n type: 'relationship',\n label: 'my-relationship',\n relationTo: 'not-valid',\n },\n ],\n }\n const fields: Field[] = [\n {\n name: 'layout',\n type: 'blocks',\n blocks: [relationshipBlock],\n label: 'Layout Blocks',\n },\n ]\n await expect(async () => {\n await sanitizeFields({ config, fields, validRelationships })\n }).rejects.toThrow(InvalidFieldRelationship)\n })\n\n it('should defaultValue of checkbox to false if required and undefined', async () => {\n const fields: Field[] = [\n {\n name: 'My Checkbox',\n type: 'checkbox',\n required: true,\n },\n ]\n\n const sanitizedField = (\n await sanitizeFields({\n config,\n fields,\n validRelationships: [],\n })\n )[0] as CheckboxField\n expect(sanitizedField.defaultValue).toStrictEqual(false)\n })\n\n it('should return empty field array if no fields', async () => {\n const sanitizedFields = await sanitizeFields({\n config,\n fields: [],\n validRelationships: [],\n })\n expect(sanitizedFields).toStrictEqual([])\n })\n })\n})\n"],"names":["InvalidFieldName","InvalidFieldRelationship","MissingFieldType","sanitizeFields","describe","config","it","fields","name","label","expect","validRelationships","rejects","toThrow","type","sanitizedField","toStrictEqual","arrayField","labels","toBeUndefined","blocks","slug","toMatchObject","plural","singular","relationTo","not","relationshipBlock","required","defaultValue","sanitizedFields"],"mappings":"AAWA,SAASA,gBAAgB,EAAEC,wBAAwB,EAAEC,gBAAgB,QAAQ,wBAAuB;AACpG,SAASC,cAAc,QAAQ,gBAAe;AAE9CC,SAAS,kBAAkB;IACzB,MAAMC,SAAS,CAAC;IAChBC,GAAG,sCAAsC;QACvC,MAAMC,SAAkB;YACtB,mBAAmB;YACnB;gBACEC,MAAM;gBACNC,OAAO;YACT;SACD;QACD,MAAMC,OAAO;YACX,MAAMP,eAAe;gBACnBE;gBACAE;gBACAI,oBAAoB,EAAE;YACxB;QACF,GAAGC,OAAO,CAACC,OAAO,CAACX;IACrB;IACAI,GAAG,sCAAsC;QACvC,MAAMC,SAAkB;YACtB;gBACEC,MAAM;gBACNM,MAAM;gBACNL,OAAO;YACT;SACD;QACD,MAAMC,OAAO;YACX,MAAMP,eAAe;gBACnBE;gBACAE;gBACAI,oBAAoB,EAAE;YACxB;QACF,GAAGC,OAAO,CAACC,OAAO,CAACb;IACrB;IAEAI,SAAS,iBAAiB;QACxBE,GAAG,oCAAoC;YACrC,MAAMC,SAAkB;gBACtB;oBACEC,MAAM;oBACNM,MAAM;gBACR;aACD;YACD,MAAMC,iBAAiB,AACrB,CAAA,MAAMZ,eAAe;gBACnBE;gBACAE;gBACAI,oBAAoB,EAAE;YACxB,EAAC,CACF,CAAC,EAAE;YACJD,OAAOK,eAAeP,IAAI,EAAEQ,aAAa,CAAC;YAC1CN,OAAOK,eAAeN,KAAK,EAAEO,aAAa,CAAC;YAC3CN,OAAOK,eAAeD,IAAI,EAAEE,aAAa,CAAC;QAC5C;QACAV,GAAG,oCAAoC;YACrC,MAAMC,SAAkB;gBACtB;oBACEC,MAAM;oBACNM,MAAM;oBACNL,OAAO;gBAC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AAA,MAAMZ,eAAe;gBACnBE;gBACAE;gBACAI,oBAAoB,EAAE;YACxB,EAAC,CACF,CAAC,EAAE;YACJD,OAAOK,eAAec,YAAY,EAAEb,aAAa,CAAC;QACpD;QAEAV,GAAG,gDAAgD;YACjD,MAAMwB,kBAAkB,MAAM3B,eAAe;gBAC3CE;gBACAE,QAAQ,EAAE;gBACVI,oBAAoB,EAAE;YACxB;YACAD,OAAOoB,iBAAiBd,aAAa,CAAC,EAAE;QAC1C;IACF;AACF"}
|
|
@@ -2,8 +2,9 @@ import type { EditorProps } from '@monaco-editor/react';
|
|
|
2
2
|
import type { JSONSchema4 } from 'json-schema';
|
|
3
3
|
import type { CSSProperties } from 'react';
|
|
4
4
|
import type { DeepUndefinable } from 'ts-essentials';
|
|
5
|
+
import type { FieldClientComponent, FieldServerComponent } from '../../admin/forms/Field.js';
|
|
5
6
|
import type { RichTextAdapter, RichTextAdapterProvider } from '../../admin/RichText.js';
|
|
6
|
-
import type { ArrayFieldClientProps, ArrayFieldErrorClientComponent, ArrayFieldErrorServerComponent, ArrayFieldLabelClientComponent, ArrayFieldLabelServerComponent,
|
|
7
|
+
import type { ArrayFieldClientProps, ArrayFieldErrorClientComponent, ArrayFieldErrorServerComponent, ArrayFieldLabelClientComponent, ArrayFieldLabelServerComponent, BlocksFieldClientProps, BlocksFieldErrorClientComponent, BlocksFieldErrorServerComponent, CheckboxFieldClientProps, CheckboxFieldErrorClientComponent, CheckboxFieldErrorServerComponent, CheckboxFieldLabelClientComponent, CheckboxFieldLabelServerComponent, ClientTab, CodeFieldClientProps, CodeFieldErrorClientComponent, CodeFieldErrorServerComponent, CodeFieldLabelClientComponent, CodeFieldLabelServerComponent, CollapsibleFieldClientProps, CollapsibleFieldLabelClientComponent, CollapsibleFieldLabelServerComponent, ConditionalDateProps, DateFieldClientProps, DateFieldErrorClientComponent, DateFieldErrorServerComponent, DateFieldLabelClientComponent, DateFieldLabelServerComponent, Description, EmailFieldClientProps, EmailFieldErrorClientComponent, EmailFieldErrorServerComponent, EmailFieldLabelClientComponent, EmailFieldLabelServerComponent, FieldDescriptionClientComponent, FieldDescriptionServerComponent, GroupFieldClientProps, GroupFieldLabelClientComponent, GroupFieldLabelServerComponent, HiddenFieldProps, JSONFieldClientProps, JSONFieldErrorClientComponent, JSONFieldErrorServerComponent, JSONFieldLabelClientComponent, JSONFieldLabelServerComponent, MappedComponent, NumberFieldClientProps, NumberFieldErrorClientComponent, NumberFieldErrorServerComponent, NumberFieldLabelClientComponent, NumberFieldLabelServerComponent, PointFieldClientProps, PointFieldErrorClientComponent, PointFieldErrorServerComponent, PointFieldLabelClientComponent, PointFieldLabelServerComponent, RadioFieldClientProps, RadioFieldErrorClientComponent, RadioFieldErrorServerComponent, RadioFieldLabelClientComponent, RadioFieldLabelServerComponent, RelationshipFieldClientProps, RelationshipFieldErrorClientComponent, RelationshipFieldErrorServerComponent, RelationshipFieldLabelClientComponent, RelationshipFieldLabelServerComponent, RichTextFieldClientProps, RowFieldClientProps, RowLabelComponent, SelectFieldClientProps, SelectFieldErrorClientComponent, SelectFieldErrorServerComponent, SelectFieldLabelClientComponent, SelectFieldLabelServerComponent, StaticDescription, TabsFieldClientProps, TextareaFieldClientProps, TextareaFieldErrorClientComponent, TextareaFieldErrorServerComponent, TextareaFieldLabelClientComponent, TextareaFieldLabelServerComponent, TextFieldErrorClientComponent, TextFieldErrorServerComponent, TextFieldLabelClientComponent, TextFieldLabelServerComponent, UploadFieldClientProps } from '../../admin/types.js';
|
|
7
8
|
import type { SanitizedCollectionConfig, TypeWithID } from '../../collections/config/types.js';
|
|
8
9
|
import type { CustomComponent, LabelFunction, PayloadComponent, StaticLabel } from '../../config/types.js';
|
|
9
10
|
import type { DBIdentifierName } from '../../database/types.js';
|
|
@@ -121,7 +122,7 @@ type Admin = {
|
|
|
121
122
|
components?: {
|
|
122
123
|
Cell?: CustomComponent;
|
|
123
124
|
Description?: CustomComponent<FieldDescriptionClientComponent | FieldDescriptionServerComponent>;
|
|
124
|
-
Field?: CustomComponent
|
|
125
|
+
Field?: CustomComponent<FieldClientComponent | FieldServerComponent>;
|
|
125
126
|
/**
|
|
126
127
|
* The Filter component has to be a client component
|
|
127
128
|
*/
|
|
@@ -151,7 +152,7 @@ type Admin = {
|
|
|
151
152
|
position?: 'sidebar';
|
|
152
153
|
readOnly?: boolean;
|
|
153
154
|
style?: CSSProperties;
|
|
154
|
-
width?:
|
|
155
|
+
width?: CSSProperties['width'];
|
|
155
156
|
};
|
|
156
157
|
export type AdminClient = {
|
|
157
158
|
className?: string;
|
|
@@ -182,8 +183,10 @@ export type AdminClient = {
|
|
|
182
183
|
hidden?: boolean;
|
|
183
184
|
position?: 'sidebar';
|
|
184
185
|
readOnly?: boolean;
|
|
185
|
-
style?:
|
|
186
|
-
|
|
186
|
+
style?: {
|
|
187
|
+
'--field-width'?: CSSProperties['width'];
|
|
188
|
+
} & CSSProperties;
|
|
189
|
+
width?: CSSProperties['width'];
|
|
187
190
|
};
|
|
188
191
|
export type Labels = {
|
|
189
192
|
plural: LabelFunction | StaticLabel;
|
|
@@ -604,7 +607,7 @@ export type UIField = {
|
|
|
604
607
|
*/
|
|
605
608
|
disableListColumn?: boolean;
|
|
606
609
|
position?: string;
|
|
607
|
-
width?:
|
|
610
|
+
width?: CSSProperties['width'];
|
|
608
611
|
};
|
|
609
612
|
/** Extension point to add your custom data. Server only. */
|
|
610
613
|
custom?: Record<string, any>;
|
|
@@ -1018,10 +1021,10 @@ export type ClientBlock = {
|
|
|
1018
1021
|
fields: ClientField[];
|
|
1019
1022
|
labels?: LabelsClient;
|
|
1020
1023
|
} & Pick<Block, 'imageAltText' | 'imageURL' | 'slug'>;
|
|
1021
|
-
export type
|
|
1024
|
+
export type BlocksField = {
|
|
1022
1025
|
admin?: {
|
|
1023
1026
|
components?: {
|
|
1024
|
-
Error?: CustomComponent<
|
|
1027
|
+
Error?: CustomComponent<BlocksFieldErrorClientComponent | BlocksFieldErrorServerComponent>;
|
|
1025
1028
|
} & Admin['components'];
|
|
1026
1029
|
initCollapsed?: boolean;
|
|
1027
1030
|
/**
|
|
@@ -1035,17 +1038,17 @@ export type BlockField = {
|
|
|
1035
1038
|
maxRows?: number;
|
|
1036
1039
|
minRows?: number;
|
|
1037
1040
|
type: 'blocks';
|
|
1038
|
-
validate?: Validate<string, unknown, unknown,
|
|
1041
|
+
validate?: Validate<string, unknown, unknown, BlocksField>;
|
|
1039
1042
|
} & FieldBase;
|
|
1040
|
-
export type
|
|
1043
|
+
export type BlocksFieldClient = {
|
|
1041
1044
|
admin?: {
|
|
1042
1045
|
components?: {
|
|
1043
1046
|
Error?: MappedComponent;
|
|
1044
1047
|
} & AdminClient['components'];
|
|
1045
|
-
} & AdminClient & Pick<
|
|
1048
|
+
} & AdminClient & Pick<BlocksField['admin'], 'initCollapsed' | 'isSortable'>;
|
|
1046
1049
|
blocks: ClientBlock[];
|
|
1047
1050
|
labels?: LabelsClient;
|
|
1048
|
-
} & FieldBaseClient & Pick<
|
|
1051
|
+
} & FieldBaseClient & Pick<BlocksField, 'maxRows' | 'minRows' | 'type'>;
|
|
1049
1052
|
export type PointField = {
|
|
1050
1053
|
admin?: {
|
|
1051
1054
|
components?: {
|
|
@@ -1070,17 +1073,17 @@ export type PointFieldClient = {
|
|
|
1070
1073
|
} & AdminClient['components'];
|
|
1071
1074
|
} & AdminClient & Pick<PointField['admin'], 'placeholder' | 'step'>;
|
|
1072
1075
|
} & FieldBaseClient & Pick<PointField, 'type'>;
|
|
1073
|
-
export type Field = ArrayField |
|
|
1074
|
-
export type ClientField = ArrayFieldClient |
|
|
1076
|
+
export type Field = ArrayField | BlocksField | CheckboxField | CodeField | CollapsibleField | DateField | EmailField | GroupField | JSONField | NumberField | PointField | RadioField | RelationshipField | RichTextField | RowField | SelectField | TabsField | TextareaField | TextField | UIField | UploadField;
|
|
1077
|
+
export type ClientField = ArrayFieldClient | BlocksFieldClient | CheckboxFieldClient | CodeFieldClient | CollapsibleFieldClient | DateFieldClient | EmailFieldClient | GroupFieldClient | JSONFieldClient | NumberFieldClient | PointFieldClient | RadioFieldClient | RelationshipFieldClient | RichTextFieldClient | RowFieldClient | SelectFieldClient | TabsFieldClient | TextareaFieldClient | TextFieldClient | UIFieldClient | UploadFieldClient;
|
|
1075
1078
|
export type ClientFieldProps = ArrayFieldClientProps | BlocksFieldClientProps | CheckboxFieldClientProps | CodeFieldClientProps | CollapsibleFieldClientProps | DateFieldClientProps | EmailFieldClientProps | GroupFieldClientProps | HiddenFieldProps | JSONFieldClientProps | NumberFieldClientProps | PointFieldClientProps | RadioFieldClientProps | RelationshipFieldClientProps | RichTextFieldClientProps | RowFieldClientProps | SelectFieldClientProps | TabsFieldClientProps | TextareaFieldClientProps | UploadFieldClientProps;
|
|
1076
1079
|
type ExtractFieldTypes<T> = T extends {
|
|
1077
1080
|
type: infer U;
|
|
1078
1081
|
} ? U : never;
|
|
1079
1082
|
export type FieldTypes = ExtractFieldTypes<Field>;
|
|
1080
|
-
export type FieldAffectingData = ArrayField |
|
|
1081
|
-
export type FieldAffectingDataClient = ArrayFieldClient |
|
|
1082
|
-
export type NonPresentationalField = ArrayField |
|
|
1083
|
-
export type NonPresentationalFieldClient = ArrayFieldClient |
|
|
1083
|
+
export type FieldAffectingData = ArrayField | BlocksField | CheckboxField | CodeField | DateField | EmailField | GroupField | JSONField | NumberField | PointField | RadioField | RelationshipField | RichTextField | SelectField | TabAsField | TextareaField | TextField | UploadField;
|
|
1084
|
+
export type FieldAffectingDataClient = ArrayFieldClient | BlocksFieldClient | CheckboxFieldClient | CodeFieldClient | DateFieldClient | EmailFieldClient | GroupFieldClient | JSONFieldClient | NumberFieldClient | PointFieldClient | RadioFieldClient | RelationshipFieldClient | RichTextFieldClient | SelectFieldClient | TabAsFieldClient | TextareaFieldClient | TextFieldClient | UploadFieldClient;
|
|
1085
|
+
export type NonPresentationalField = ArrayField | BlocksField | CheckboxField | CodeField | CollapsibleField | DateField | EmailField | GroupField | JSONField | NumberField | PointField | RadioField | RelationshipField | RichTextField | RowField | SelectField | TabsField | TextareaField | TextField | UploadField;
|
|
1086
|
+
export type NonPresentationalFieldClient = ArrayFieldClient | BlocksFieldClient | CheckboxFieldClient | CodeFieldClient | CollapsibleFieldClient | DateFieldClient | EmailFieldClient | GroupFieldClient | JSONFieldClient | NumberFieldClient | PointFieldClient | RadioFieldClient | RelationshipFieldClient | RichTextFieldClient | RowFieldClient | SelectFieldClient | TabsFieldClient | TextareaFieldClient | TextFieldClient | UploadFieldClient;
|
|
1084
1087
|
export type FieldWithPath = {
|
|
1085
1088
|
path?: string;
|
|
1086
1089
|
} & Field;
|
|
@@ -1097,7 +1100,7 @@ export type FieldWithMaxDepth = RelationshipField | UploadField;
|
|
|
1097
1100
|
export type FieldWithMaxDepthClient = RelationshipFieldClient | UploadFieldClient;
|
|
1098
1101
|
export declare function fieldHasSubFields<TField extends ClientField | Field>(field: TField): field is TField & (TField extends ClientField ? FieldWithSubFieldsClient : FieldWithSubFields);
|
|
1099
1102
|
export declare function fieldIsArrayType<TField extends ClientField | Field>(field: TField): field is TField & (TField extends ClientField ? ArrayFieldClient : ArrayField);
|
|
1100
|
-
export declare function fieldIsBlockType<TField extends ClientField | Field>(field: TField): field is TField & (TField extends ClientField ?
|
|
1103
|
+
export declare function fieldIsBlockType<TField extends ClientField | Field>(field: TField): field is TField & (TField extends ClientField ? BlocksFieldClient : BlocksField);
|
|
1101
1104
|
export declare function fieldIsGroupType<TField extends ClientField | Field>(field: TField): field is TField & (TField extends ClientField ? GroupFieldClient : GroupField);
|
|
1102
1105
|
export declare function optionIsObject(option: Option): option is OptionObject;
|
|
1103
1106
|
export declare function optionsAreObjects(options: Option[]): options is OptionObject[];
|