payload 3.17.1 → 3.18.0-canary.030d28e
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/forms/Field.d.ts +1 -1
- package/dist/admin/forms/Field.d.ts.map +1 -1
- package/dist/admin/forms/Field.js.map +1 -1
- package/dist/admin/forms/Form.d.ts +3 -4
- package/dist/admin/forms/Form.d.ts.map +1 -1
- package/dist/admin/forms/Form.js.map +1 -1
- package/dist/admin/types.d.ts +6 -0
- package/dist/admin/types.d.ts.map +1 -1
- package/dist/admin/types.js.map +1 -1
- package/dist/collections/endpoints/index.d.ts.map +1 -1
- package/dist/collections/endpoints/index.js +6 -0
- package/dist/collections/endpoints/index.js.map +1 -1
- package/dist/collections/operations/delete.d.ts.map +1 -1
- package/dist/collections/operations/delete.js +12 -0
- package/dist/collections/operations/delete.js.map +1 -1
- package/dist/collections/operations/deleteByID.d.ts.map +1 -1
- package/dist/collections/operations/deleteByID.js +12 -0
- package/dist/collections/operations/deleteByID.js.map +1 -1
- package/dist/config/client.d.ts +1 -2
- package/dist/config/client.d.ts.map +1 -1
- package/dist/config/client.js +1 -6
- package/dist/config/client.js.map +1 -1
- package/dist/config/types.d.ts +1 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/fields/config/sanitize.js +2 -2
- package/dist/fields/config/sanitize.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/utilities/handleEndpoints.d.ts.map +1 -1
- package/dist/utilities/handleEndpoints.js +1 -0
- package/dist/utilities/handleEndpoints.js.map +1 -1
- package/dist/versions/deleteCollectionVersions.d.ts.map +1 -1
- package/dist/versions/deleteCollectionVersions.js +4 -1
- package/dist/versions/deleteCollectionVersions.js.map +1 -1
- package/dist/versions/deleteScheduledPublishJobs.d.ts +11 -0
- package/dist/versions/deleteScheduledPublishJobs.d.ts.map +1 -0
- package/dist/versions/deleteScheduledPublishJobs.js +46 -0
- package/dist/versions/deleteScheduledPublishJobs.js.map +1 -0
- package/dist/versions/payloadPackageList.d.ts.map +1 -1
- package/dist/versions/payloadPackageList.js +1 -0
- package/dist/versions/payloadPackageList.js.map +1 -1
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ import type { Operation, Payload, PayloadRequest } from '../../types/index.js';
|
|
|
7
7
|
import type { ClientFieldSchemaMap, ClientTab, Data, FieldSchemaMap, FormField, FormState, RenderedField } from '../types.js';
|
|
8
8
|
export type ClientFieldWithOptionalType = MarkOptional<ClientField, 'type'>;
|
|
9
9
|
export type ClientComponentProps = {
|
|
10
|
-
customComponents
|
|
10
|
+
customComponents?: FormField['customComponents'];
|
|
11
11
|
field: ClientBlock | ClientField | ClientTab;
|
|
12
12
|
forceRender?: boolean;
|
|
13
13
|
permissions?: SanitizedFieldPermissions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/Field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC9E,OAAO,KAAK,EACV,oBAAoB,EACpB,SAAS,EACT,IAAI,EACJ,cAAc,EACd,SAAS,EACT,SAAS,EACT,aAAa,EACd,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,2BAA2B,GAAG,YAAY,CAAC,W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AAa,GAAG,OAAO,CAAC,CAAA;AAErD,MAAM,MAAM,oBAAoB,CAC9B,YAAY,SAAS,2BAA2B,GAAG,2BAA2B,EAC9E,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACvE,KAAK,CAAC,aAAa,CAAC,eAAe,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC,CAAA;AAExE,MAAM,MAAM,oBAAoB,CAC9B,YAAY,SAAS,KAAK,GAAG,KAAK,EAClC,YAAY,SAAS,2BAA2B,GAAG,2BAA2B,EAC9E,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACvE,KAAK,CAAC,aAAa,CAAC,eAAe,GAAG,eAAe,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/forms/Field.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { MarkOptional } from 'ts-essentials'\n\nimport type { SanitizedFieldPermissions, User } from '../../auth/types.js'\nimport type { ClientBlock, ClientField, Field } from '../../fields/config/types.js'\nimport type { DocumentPreferences } from '../../preferences/types.js'\nimport type { Operation, Payload, PayloadRequest } from '../../types/index.js'\nimport type {\n ClientFieldSchemaMap,\n ClientTab,\n Data,\n FieldSchemaMap,\n FormField,\n FormState,\n RenderedField,\n} from '../types.js'\n\nexport type ClientFieldWithOptionalType = MarkOptional<ClientField, 'type'>\n\nexport type ClientComponentProps = {\n customComponents
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/forms/Field.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { MarkOptional } from 'ts-essentials'\n\nimport type { SanitizedFieldPermissions, User } from '../../auth/types.js'\nimport type { ClientBlock, ClientField, Field } from '../../fields/config/types.js'\nimport type { DocumentPreferences } from '../../preferences/types.js'\nimport type { Operation, Payload, PayloadRequest } from '../../types/index.js'\nimport type {\n ClientFieldSchemaMap,\n ClientTab,\n Data,\n FieldSchemaMap,\n FormField,\n FormState,\n RenderedField,\n} from '../types.js'\n\nexport type ClientFieldWithOptionalType = MarkOptional<ClientField, 'type'>\n\nexport type ClientComponentProps = {\n customComponents?: FormField['customComponents']\n field: ClientBlock | ClientField | ClientTab\n forceRender?: boolean\n permissions?: SanitizedFieldPermissions\n readOnly?: boolean\n renderedBlocks?: RenderedField[]\n /**\n * Used to extract field configs from a schemaMap.\n * Does not include indexes.\n *\n * @default field.name\n **/\n schemaPath?: string\n}\n\n// TODO: maybe we can come up with a better name?\nexport type FieldPaths = {\n /**\n * @default ''\n */\n indexPath?: string\n /**\n * @default ''\n */\n parentPath?: string\n /**\n * The path built up to the point of the field\n * excluding the field name.\n *\n * @default ''\n */\n parentSchemaPath?: string\n /**\n * A built up path to access FieldState in the form state.\n * Nested fields will have a path that includes the parent field names\n * if they are nested within a group, array, block or named tab.\n *\n * Collapsibles and unnamed tabs will have arbitrary paths\n * that look like _index-0, _index-1, etc.\n *\n * Row fields will not have a path.\n *\n * @example 'parentGroupField.childTextField'\n *\n * @default field.name\n */\n path: string\n}\n\nexport type ServerComponentProps = {\n clientField: ClientFieldWithOptionalType\n clientFieldSchemaMap: ClientFieldSchemaMap\n collectionSlug: string\n data: Data\n field: Field\n /**\n * The fieldSchemaMap that is created before form state is built is made available here.\n */\n fieldSchemaMap: FieldSchemaMap\n /**\n * Server Components will also have available to the entire form state.\n * We cannot add it to ClientComponentProps as that would blow up the size of the props sent to the client.\n */\n formState: FormState\n i18n: I18nClient\n id?: number | string\n operation: Operation\n payload: Payload\n permissions: SanitizedFieldPermissions\n preferences: DocumentPreferences\n req: PayloadRequest\n siblingData: Data\n user: User\n}\n\nexport type ClientFieldBase<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = {\n readonly field: TFieldClient\n} & Omit<ClientComponentProps, 'customComponents' | 'field'>\n\nexport type ServerFieldBase<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n> = {\n readonly clientField: TFieldClient\n readonly field: TFieldServer\n} & Omit<ClientComponentProps, 'field'> &\n Omit<ServerComponentProps, 'clientField' | 'field'>\n\nexport type FieldClientComponent<\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n AdditionalProps extends Record<string, unknown> = Record<string, unknown>,\n> = React.ComponentType<AdditionalProps & ClientFieldBase<TFieldClient>>\n\nexport type FieldServerComponent<\n TFieldServer extends Field = Field,\n TFieldClient extends ClientFieldWithOptionalType = ClientFieldWithOptionalType,\n AdditionalProps extends Record<string, unknown> = Record<string, unknown>,\n> = React.ComponentType<AdditionalProps & ServerFieldBase<TFieldServer, TFieldClient>>\n"],"names":[],"mappings":"AAmHA,WAIsF"}
|
|
@@ -40,14 +40,13 @@ export type FieldState = {
|
|
|
40
40
|
*/
|
|
41
41
|
fieldSchema?: Field;
|
|
42
42
|
filterOptions?: FilterOptionsResult;
|
|
43
|
-
initialValue
|
|
44
|
-
isSidebar?: boolean;
|
|
43
|
+
initialValue?: unknown;
|
|
45
44
|
passesCondition?: boolean;
|
|
46
45
|
requiresRender?: boolean;
|
|
47
46
|
rows?: Row[];
|
|
48
|
-
valid
|
|
47
|
+
valid?: boolean;
|
|
49
48
|
validate?: Validate;
|
|
50
|
-
value
|
|
49
|
+
value?: unknown;
|
|
51
50
|
};
|
|
52
51
|
export type FieldStateWithoutComponents = Omit<FieldState, 'customComponents'>;
|
|
53
52
|
export type FormState = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/admin/forms/Form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAElE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AACvE,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ACrB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAIpB,QAAQ,CAAC,EAAE,MAAM,kBAAkB,CAAA;IACnC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAI/B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,CACA;IACE,cAAc,EAAE,MAAM,CAAA;IAGtB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,GACD;IACE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB,CACJ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/admin/forms/Form.ts"],"sourcesContent":["import { type SupportedLanguages } from '@payloadcms/translations'\n\nimport type { SanitizedDocumentPermissions } from '../../auth/types.js'\nimport type { Field, Validate } from '../../fields/config/types.js'\nimport type { TypedLocale } from '../../index.js'\nimport type { DocumentPreferences } from '../../preferences/types.js'\nimport type { PayloadRequest, 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 isLoading?: boolean\n}\n\nexport type FilterOptionsResult = {\n [relation: string]: boolean | Where\n}\n\nexport type FieldState = {\n customComponents?: {\n /**\n * This is used by UI fields, as they can have arbitrary components defined if used\n * as a vessel to bring in custom components.\n */\n [key: string]: React.ReactNode | React.ReactNode[] | undefined\n AfterInput?: React.ReactNode\n BeforeInput?: React.ReactNode\n Description?: React.ReactNode\n Error?: React.ReactNode\n Field?: React.ReactNode\n Label?: React.ReactNode\n RowLabels?: React.ReactNode[]\n }\n disableFormData?: boolean\n errorMessage?: string\n errorPaths?: string[]\n /**\n * The fieldSchema may be part of the form state if `includeSchema: true` is passed to buildFormState.\n * This will never be in the form state of the client.\n */\n fieldSchema?: Field\n filterOptions?: FilterOptionsResult\n initialValue
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/forms/Form.ts"],"sourcesContent":["import { type SupportedLanguages } from '@payloadcms/translations'\n\nimport type { SanitizedDocumentPermissions } from '../../auth/types.js'\nimport type { Field, Validate } from '../../fields/config/types.js'\nimport type { TypedLocale } from '../../index.js'\nimport type { DocumentPreferences } from '../../preferences/types.js'\nimport type { PayloadRequest, 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 isLoading?: boolean\n}\n\nexport type FilterOptionsResult = {\n [relation: string]: boolean | Where\n}\n\nexport type FieldState = {\n customComponents?: {\n /**\n * This is used by UI fields, as they can have arbitrary components defined if used\n * as a vessel to bring in custom components.\n */\n [key: string]: React.ReactNode | React.ReactNode[] | undefined\n AfterInput?: React.ReactNode\n BeforeInput?: React.ReactNode\n Description?: React.ReactNode\n Error?: React.ReactNode\n Field?: React.ReactNode\n Label?: React.ReactNode\n RowLabels?: React.ReactNode[]\n }\n disableFormData?: boolean\n errorMessage?: string\n errorPaths?: string[]\n /**\n * The fieldSchema may be part of the form state if `includeSchema: true` is passed to buildFormState.\n * This will never be in the form state of the client.\n */\n fieldSchema?: Field\n filterOptions?: FilterOptionsResult\n initialValue?: unknown\n passesCondition?: boolean\n requiresRender?: boolean\n rows?: Row[]\n valid?: boolean\n validate?: Validate\n value?: unknown\n}\n\nexport type FieldStateWithoutComponents = Omit<FieldState, 'customComponents'>\n\nexport type FormState = {\n [path: string]: FieldState\n}\n\nexport type FormStateWithoutComponents = {\n [path: string]: FieldStateWithoutComponents\n}\n\nexport type BuildFormStateArgs = {\n data?: Data\n docPermissions: SanitizedDocumentPermissions | undefined\n docPreferences: DocumentPreferences\n fallbackLocale?: false | TypedLocale\n formState?: FormState\n id?: number | string\n /*\n If not i18n was passed, the language can be passed to init i18n\n */\n language?: keyof SupportedLanguages\n locale?: string\n operation?: 'create' | 'update'\n /*\n If true, will render field components within their state object\n */\n renderAllFields?: boolean\n req: PayloadRequest\n returnLockStatus?: boolean\n schemaPath: string\n updateLastEdited?: boolean\n} & (\n | {\n collectionSlug: string\n // Do not type it as never. This still makes it so that either collectionSlug or globalSlug is required, but makes it easier to provide both collectionSlug and globalSlug if it's\n // unclear which one is actually available.\n globalSlug?: string\n }\n | {\n collectionSlug?: string\n globalSlug: string\n }\n)\n"],"names":[],"mappings":"AAkEA,WAgCC"}
|
package/dist/admin/types.d.ts
CHANGED
|
@@ -94,6 +94,12 @@ export type RenderedField = {
|
|
|
94
94
|
Field: React.ReactNode;
|
|
95
95
|
indexPath?: string;
|
|
96
96
|
initialSchemaPath?: string;
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated
|
|
99
|
+
* This is a legacy property that will be removed in v4.
|
|
100
|
+
* Please use `fieldIsSidebar(field)` from `payload` instead.
|
|
101
|
+
* Or check `field.admin.position === 'sidebar'` directly.
|
|
102
|
+
*/
|
|
97
103
|
isSidebar: boolean;
|
|
98
104
|
path: string;
|
|
99
105
|
schemaPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/admin/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,KAAK,EACV,KAAK,EACL,WAAW,EACX,WAAW,EACX,KAAK,EACL,UAAU,EACV,GAAG,EACJ,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CA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ANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/admin/types.ts"],"sourcesContent":["import type { AcceptedLanguages, I18nClient } from '@payloadcms/translations'\nimport type React from 'react'\n\nimport type { ImportMap } from '../bin/generateImportMap/index.js'\nimport type { SanitizedConfig } from '../config/types.js'\nimport type {\n Block,\n ClientBlock,\n ClientField,\n Field,\n FieldTypes,\n Tab,\n} from '../fields/config/types.js'\nimport type { JsonObject } from '../types/index.js'\nimport type { ClientTab } from './fields/Tabs.js'\nimport type {\n BuildFormStateArgs,\n Data,\n FieldState,\n FieldStateWithoutComponents,\n FilterOptionsResult,\n FormState,\n FormStateWithoutComponents,\n Row,\n} from './forms/Form.js'\n\nexport type { DefaultCellComponentProps, DefaultServerCellComponentProps } from './elements/Cell.js'\nexport type { ConditionalDateProps } from './elements/DatePicker.js'\nexport type { DayPickerProps, SharedProps, TimePickerProps } from './elements/DatePicker.js'\nexport type { NavGroupPreferences, NavPreferences } from './elements/Nav.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'\n\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 JoinFieldClientComponent,\n JoinFieldClientProps,\n JoinFieldDescriptionClientComponent,\n JoinFieldDescriptionServerComponent,\n JoinFieldErrorClientComponent,\n JoinFieldErrorServerComponent,\n JoinFieldLabelClientComponent,\n JoinFieldLabelServerComponent,\n JoinFieldServerComponent,\n JoinFieldServerProps,\n} from './fields/Join.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 UIFieldClientComponent,\n UIFieldClientProps,\n UIFieldServerComponent,\n UIFieldServerProps,\n} from './fields/UI.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 {\n BuildFormStateArgs,\n Data,\n FieldState as FormField,\n FieldStateWithoutComponents as FormFieldWithoutComponents,\n FilterOptionsResult,\n FormState,\n FormStateWithoutComponents,\n Row,\n}\n\nexport type {\n ClientComponentProps,\n ClientFieldBase,\n ClientFieldWithOptionalType,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerComponentProps,\n ServerFieldBase,\n} from './forms/Field.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 {\n BuildTableStateArgs,\n DefaultServerFunctionArgs,\n ListQuery,\n ServerFunction,\n ServerFunctionArgs,\n ServerFunctionClient,\n ServerFunctionClientArgs,\n ServerFunctionConfig,\n ServerFunctionHandler,\n} from './functions/index.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 enum Action {\n RenderConfig = 'render-config',\n}\n\nexport type RenderEntityConfigArgs = {\n collectionSlug?: string\n data?: Data\n globalSlug?: string\n}\n\nexport type RenderRootConfigArgs = {}\n\nexport type RenderFieldConfigArgs = {\n collectionSlug?: string\n formState?: FormState\n globalSlug?: string\n schemaPath: string\n}\n\nexport type RenderConfigArgs = {\n action: Action.RenderConfig\n config: Promise<SanitizedConfig> | SanitizedConfig\n i18n: I18nClient\n importMap: ImportMap\n languageCode: AcceptedLanguages\n serverProps?: any\n} & (RenderEntityConfigArgs | RenderFieldConfigArgs | RenderRootConfigArgs)\n\nexport type PayloadServerAction = (\n args:\n | {\n [key: string]: any\n action: Action\n i18n: I18nClient\n }\n | RenderConfigArgs,\n) => Promise<string>\n\nexport type RenderedField = {\n Field: React.ReactNode\n indexPath?: string\n initialSchemaPath?: string\n isSidebar: boolean\n path: string\n schemaPath: string\n type: FieldTypes\n}\n\nexport type FieldRow = {\n RowLabel?: React.ReactNode\n}\n\nexport type DocumentSlots = {\n Description?: React.ReactNode\n PreviewButton?: React.ReactNode\n PublishButton?: React.ReactNode\n SaveButton?: React.ReactNode\n SaveDraftButton?: React.ReactNode\n Upload?: React.ReactNode\n}\n\nexport type { LanguageOptions } from './LanguageOptions.js'\n\nexport type { RichTextAdapter, RichTextAdapterProvider, RichTextHooks } from './RichText.js'\n\nexport type {\n AdminViewComponent,\n AdminViewConfig,\n AdminViewProps,\n ClientSideEditViewProps,\n EditViewProps,\n InitPageResult,\n ServerSideEditViewProps,\n VisibleEntities,\n} from './views/types.js'\n\ntype SchemaPath = {} & string\nexport type FieldSchemaMap = Map<\n SchemaPath,\n | {\n fields: Field[]\n }\n | Block\n | Field\n | Tab\n>\n\nexport type ClientFieldSchemaMap = Map<\n SchemaPath,\n | {\n fields: ClientField[]\n }\n | ClientBlock\n | ClientField\n | ClientTab\n>\n\nexport type DocumentEvent = {\n entitySlug: string\n id?: number | string\n updatedAt: string\n}\n"],"names":["Action"],"mappings":"AA6ZA,OAAO,IAAA,AAAKA,gCAAAA;;WAAAA;MAEX"}
|
|
1
|
+
{"version":3,"sources":["../../src/admin/types.ts"],"sourcesContent":["import type { AcceptedLanguages, I18nClient } from '@payloadcms/translations'\nimport type React from 'react'\n\nimport type { ImportMap } from '../bin/generateImportMap/index.js'\nimport type { SanitizedConfig } from '../config/types.js'\nimport type {\n Block,\n ClientBlock,\n ClientField,\n Field,\n FieldTypes,\n Tab,\n} from '../fields/config/types.js'\nimport type { JsonObject } from '../types/index.js'\nimport type { ClientTab } from './fields/Tabs.js'\nimport type {\n BuildFormStateArgs,\n Data,\n FieldState,\n FieldStateWithoutComponents,\n FilterOptionsResult,\n FormState,\n FormStateWithoutComponents,\n Row,\n} from './forms/Form.js'\n\nexport type { DefaultCellComponentProps, DefaultServerCellComponentProps } from './elements/Cell.js'\nexport type { ConditionalDateProps } from './elements/DatePicker.js'\nexport type { DayPickerProps, SharedProps, TimePickerProps } from './elements/DatePicker.js'\nexport type { NavGroupPreferences, NavPreferences } from './elements/Nav.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'\n\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 JoinFieldClientComponent,\n JoinFieldClientProps,\n JoinFieldDescriptionClientComponent,\n JoinFieldDescriptionServerComponent,\n JoinFieldErrorClientComponent,\n JoinFieldErrorServerComponent,\n JoinFieldLabelClientComponent,\n JoinFieldLabelServerComponent,\n JoinFieldServerComponent,\n JoinFieldServerProps,\n} from './fields/Join.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 UIFieldClientComponent,\n UIFieldClientProps,\n UIFieldServerComponent,\n UIFieldServerProps,\n} from './fields/UI.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 {\n BuildFormStateArgs,\n Data,\n FieldState as FormField,\n FieldStateWithoutComponents as FormFieldWithoutComponents,\n FilterOptionsResult,\n FormState,\n FormStateWithoutComponents,\n Row,\n}\n\nexport type {\n ClientComponentProps,\n ClientFieldBase,\n ClientFieldWithOptionalType,\n FieldClientComponent,\n FieldPaths,\n FieldServerComponent,\n ServerComponentProps,\n ServerFieldBase,\n} from './forms/Field.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 {\n BuildTableStateArgs,\n DefaultServerFunctionArgs,\n ListQuery,\n ServerFunction,\n ServerFunctionArgs,\n ServerFunctionClient,\n ServerFunctionClientArgs,\n ServerFunctionConfig,\n ServerFunctionHandler,\n} from './functions/index.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 enum Action {\n RenderConfig = 'render-config',\n}\n\nexport type RenderEntityConfigArgs = {\n collectionSlug?: string\n data?: Data\n globalSlug?: string\n}\n\nexport type RenderRootConfigArgs = {}\n\nexport type RenderFieldConfigArgs = {\n collectionSlug?: string\n formState?: FormState\n globalSlug?: string\n schemaPath: string\n}\n\nexport type RenderConfigArgs = {\n action: Action.RenderConfig\n config: Promise<SanitizedConfig> | SanitizedConfig\n i18n: I18nClient\n importMap: ImportMap\n languageCode: AcceptedLanguages\n serverProps?: any\n} & (RenderEntityConfigArgs | RenderFieldConfigArgs | RenderRootConfigArgs)\n\nexport type PayloadServerAction = (\n args:\n | {\n [key: string]: any\n action: Action\n i18n: I18nClient\n }\n | RenderConfigArgs,\n) => Promise<string>\n\nexport type RenderedField = {\n Field: React.ReactNode\n indexPath?: string\n initialSchemaPath?: string\n /**\n * @deprecated\n * This is a legacy property that will be removed in v4.\n * Please use `fieldIsSidebar(field)` from `payload` instead.\n * Or check `field.admin.position === 'sidebar'` directly.\n */\n isSidebar: boolean\n path: string\n schemaPath: string\n type: FieldTypes\n}\n\nexport type FieldRow = {\n RowLabel?: React.ReactNode\n}\n\nexport type DocumentSlots = {\n Description?: React.ReactNode\n PreviewButton?: React.ReactNode\n PublishButton?: React.ReactNode\n SaveButton?: React.ReactNode\n SaveDraftButton?: React.ReactNode\n Upload?: React.ReactNode\n}\n\nexport type { LanguageOptions } from './LanguageOptions.js'\n\nexport type { RichTextAdapter, RichTextAdapterProvider, RichTextHooks } from './RichText.js'\n\nexport type {\n AdminViewComponent,\n AdminViewConfig,\n AdminViewProps,\n ClientSideEditViewProps,\n EditViewProps,\n InitPageResult,\n ServerSideEditViewProps,\n VisibleEntities,\n} from './views/types.js'\n\ntype SchemaPath = {} & string\nexport type FieldSchemaMap = Map<\n SchemaPath,\n | {\n fields: Field[]\n }\n | Block\n | Field\n | Tab\n>\n\nexport type ClientFieldSchemaMap = Map<\n SchemaPath,\n | {\n fields: ClientField[]\n }\n | ClientBlock\n | ClientField\n | ClientTab\n>\n\nexport type DocumentEvent = {\n entitySlug: string\n id?: number | string\n updatedAt: string\n}\n"],"names":["Action"],"mappings":"AA6ZA,OAAO,IAAA,AAAKA,gCAAAA;;WAAAA;MAEX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/endpoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/endpoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAoBrD,eAAO,MAAM,0BAA0B,EAAE,QAAQ,EA+EhD,CAAA"}
|
|
@@ -9,6 +9,7 @@ import { duplicateHandler } from './duplicate.js';
|
|
|
9
9
|
import { findHandler } from './find.js';
|
|
10
10
|
import { findByIDHandler } from './findByID.js';
|
|
11
11
|
import { findVersionByIDHandler } from './findVersionByID.js';
|
|
12
|
+
import { findVersionsHandler } from './findVersions.js';
|
|
12
13
|
import { getFileHandler } from './getFile.js';
|
|
13
14
|
import { previewHandler } from './preview.js';
|
|
14
15
|
import { restoreVersionHandler } from './restoreVersion.js';
|
|
@@ -42,6 +43,11 @@ export const defaultCollectionEndpoints = [
|
|
|
42
43
|
method: 'post',
|
|
43
44
|
path: '/access/:id?'
|
|
44
45
|
},
|
|
46
|
+
{
|
|
47
|
+
handler: findVersionsHandler,
|
|
48
|
+
method: 'get',
|
|
49
|
+
path: '/versions'
|
|
50
|
+
},
|
|
45
51
|
{
|
|
46
52
|
handler: duplicateHandler,
|
|
47
53
|
method: 'post',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/collections/endpoints/index.ts"],"sourcesContent":["import type { Endpoint } from '../../config/types.js'\n\nimport { authCollectionEndpoints } from '../../auth/endpoints/index.js'\nimport { wrapInternalEndpoints } from '../../utilities/wrapInternalEndpoints.js'\nimport { countHandler } from './count.js'\nimport { createHandler } from './create.js'\nimport { deleteHandler } from './delete.js'\nimport { deleteByIDHandler } from './deleteByID.js'\nimport { docAccessHandler } from './docAccess.js'\nimport { duplicateHandler } from './duplicate.js'\nimport { findHandler } from './find.js'\nimport { findByIDHandler } from './findByID.js'\nimport { findVersionByIDHandler } from './findVersionByID.js'\nimport { getFileHandler } from './getFile.js'\nimport { previewHandler } from './preview.js'\nimport { restoreVersionHandler } from './restoreVersion.js'\nimport { updateHandler } from './update.js'\nimport { updateByIDHandler } from './updateByID.js'\n\nexport const defaultCollectionEndpoints: Endpoint[] = [\n ...authCollectionEndpoints,\n ...wrapInternalEndpoints([\n {\n handler: countHandler,\n method: 'get',\n path: '/count',\n },\n {\n handler: createHandler,\n method: 'post',\n path: '/',\n },\n {\n handler: deleteHandler,\n method: 'delete',\n path: '/',\n },\n {\n handler: deleteByIDHandler,\n method: 'delete',\n path: '/:id',\n },\n {\n handler: docAccessHandler,\n method: 'post',\n path: '/access/:id?',\n },\n {\n handler: duplicateHandler,\n method: 'post',\n path: '/:id/duplicate',\n },\n {\n handler: findHandler,\n method: 'get',\n path: '/',\n },\n {\n handler: findByIDHandler,\n method: 'get',\n path: '/:id',\n },\n {\n handler: findVersionByIDHandler,\n method: 'get',\n path: '/versions/:id',\n },\n {\n handler: getFileHandler,\n method: 'get',\n path: '/file/:filename',\n },\n {\n handler: previewHandler,\n method: 'get',\n path: '/:id/preview',\n },\n {\n handler: restoreVersionHandler,\n method: 'post',\n path: '/versions/:id',\n },\n {\n handler: updateHandler,\n method: 'patch',\n path: '/',\n },\n {\n handler: updateByIDHandler,\n method: 'patch',\n path: '/:id',\n },\n ]),\n]\n"],"names":["authCollectionEndpoints","wrapInternalEndpoints","countHandler","createHandler","deleteHandler","deleteByIDHandler","docAccessHandler","duplicateHandler","findHandler","findByIDHandler","findVersionByIDHandler","getFileHandler","previewHandler","restoreVersionHandler","updateHandler","updateByIDHandler","defaultCollectionEndpoints","handler","method","path"],"mappings":"AAEA,SAASA,uBAAuB,QAAQ,gCAA+B;AACvE,SAASC,qBAAqB,QAAQ,2CAA0C;AAChF,SAASC,YAAY,QAAQ,aAAY;AACzC,SAASC,aAAa,QAAQ,cAAa;AAC3C,SAASC,aAAa,QAAQ,cAAa;AAC3C,SAASC,iBAAiB,QAAQ,kBAAiB;AACnD,SAASC,gBAAgB,QAAQ,iBAAgB;AACjD,SAASC,gBAAgB,QAAQ,iBAAgB;AACjD,SAASC,WAAW,QAAQ,YAAW;AACvC,SAASC,eAAe,QAAQ,gBAAe;AAC/C,SAASC,sBAAsB,QAAQ,uBAAsB;AAC7D,SAASC,cAAc,QAAQ,eAAc;AAC7C,SAASC,cAAc,QAAQ,eAAc;AAC7C,SAASC,qBAAqB,QAAQ,sBAAqB;AAC3D,SAASC,aAAa,QAAQ,cAAa;AAC3C,SAASC,iBAAiB,QAAQ,kBAAiB;AAEnD,OAAO,MAAMC,6BAAyC;
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/endpoints/index.ts"],"sourcesContent":["import type { Endpoint } from '../../config/types.js'\n\nimport { authCollectionEndpoints } from '../../auth/endpoints/index.js'\nimport { wrapInternalEndpoints } from '../../utilities/wrapInternalEndpoints.js'\nimport { countHandler } from './count.js'\nimport { createHandler } from './create.js'\nimport { deleteHandler } from './delete.js'\nimport { deleteByIDHandler } from './deleteByID.js'\nimport { docAccessHandler } from './docAccess.js'\nimport { duplicateHandler } from './duplicate.js'\nimport { findHandler } from './find.js'\nimport { findByIDHandler } from './findByID.js'\nimport { findVersionByIDHandler } from './findVersionByID.js'\nimport { findVersionsHandler } from './findVersions.js'\nimport { getFileHandler } from './getFile.js'\nimport { previewHandler } from './preview.js'\nimport { restoreVersionHandler } from './restoreVersion.js'\nimport { updateHandler } from './update.js'\nimport { updateByIDHandler } from './updateByID.js'\n\nexport const defaultCollectionEndpoints: Endpoint[] = [\n ...authCollectionEndpoints,\n ...wrapInternalEndpoints([\n {\n handler: countHandler,\n method: 'get',\n path: '/count',\n },\n {\n handler: createHandler,\n method: 'post',\n path: '/',\n },\n {\n handler: deleteHandler,\n method: 'delete',\n path: '/',\n },\n {\n handler: deleteByIDHandler,\n method: 'delete',\n path: '/:id',\n },\n {\n handler: docAccessHandler,\n method: 'post',\n path: '/access/:id?',\n },\n {\n handler: findVersionsHandler,\n method: 'get',\n path: '/versions',\n },\n {\n handler: duplicateHandler,\n method: 'post',\n path: '/:id/duplicate',\n },\n {\n handler: findHandler,\n method: 'get',\n path: '/',\n },\n {\n handler: findByIDHandler,\n method: 'get',\n path: '/:id',\n },\n {\n handler: findVersionByIDHandler,\n method: 'get',\n path: '/versions/:id',\n },\n {\n handler: getFileHandler,\n method: 'get',\n path: '/file/:filename',\n },\n {\n handler: previewHandler,\n method: 'get',\n path: '/:id/preview',\n },\n {\n handler: restoreVersionHandler,\n method: 'post',\n path: '/versions/:id',\n },\n {\n handler: updateHandler,\n method: 'patch',\n path: '/',\n },\n {\n handler: updateByIDHandler,\n method: 'patch',\n path: '/:id',\n },\n ]),\n]\n"],"names":["authCollectionEndpoints","wrapInternalEndpoints","countHandler","createHandler","deleteHandler","deleteByIDHandler","docAccessHandler","duplicateHandler","findHandler","findByIDHandler","findVersionByIDHandler","findVersionsHandler","getFileHandler","previewHandler","restoreVersionHandler","updateHandler","updateByIDHandler","defaultCollectionEndpoints","handler","method","path"],"mappings":"AAEA,SAASA,uBAAuB,QAAQ,gCAA+B;AACvE,SAASC,qBAAqB,QAAQ,2CAA0C;AAChF,SAASC,YAAY,QAAQ,aAAY;AACzC,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AAM;QACR;KACD;CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/delete.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC3F,OAAO,KAAK,EAEV,mBAAmB,EACnB,UAAU,EAEV,wBAAwB,EACzB,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/delete.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC3F,OAAO,KAAK,EAEV,mBAAmB,EACnB,UAAU,EAEV,wBAAwB,EACzB,MAAM,oBAAoB,CAAA;AAiB3B,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,GAAG,EAAE,cAAc,CAAA;IACnB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,gBAEjC,SAAS,KACtB,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAyQ7C,CAAA"}
|
|
@@ -11,6 +11,7 @@ import { commitTransaction } from '../../utilities/commitTransaction.js';
|
|
|
11
11
|
import { initTransaction } from '../../utilities/initTransaction.js';
|
|
12
12
|
import { killTransaction } from '../../utilities/killTransaction.js';
|
|
13
13
|
import { deleteCollectionVersions } from '../../versions/deleteCollectionVersions.js';
|
|
14
|
+
import { deleteScheduledPublishJobs } from '../../versions/deleteScheduledPublishJobs.js';
|
|
14
15
|
import { buildAfterOperation } from './utils.js';
|
|
15
16
|
export const deleteOperation = async (incomingArgs)=>{
|
|
16
17
|
let args = incomingArgs;
|
|
@@ -105,6 +106,17 @@ export const deleteOperation = async (incomingArgs)=>{
|
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
108
|
// /////////////////////////////////////
|
|
109
|
+
// Delete scheduled posts
|
|
110
|
+
// /////////////////////////////////////
|
|
111
|
+
if (collectionConfig.versions?.drafts && collectionConfig.versions.drafts.schedulePublish) {
|
|
112
|
+
await deleteScheduledPublishJobs({
|
|
113
|
+
id,
|
|
114
|
+
slug: collectionConfig.slug,
|
|
115
|
+
payload,
|
|
116
|
+
req
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
// /////////////////////////////////////
|
|
108
120
|
// Delete document
|
|
109
121
|
// /////////////////////////////////////
|
|
110
122
|
await payload.db.deleteOne({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/collections/operations/delete.ts"],"sourcesContent":["import httpStatus from 'http-status'\n\nimport type { AccessResult } from '../../config/types.js'\nimport type { CollectionSlug } from '../../index.js'\nimport type { PayloadRequest, PopulateType, SelectType, Where } from '../../types/index.js'\nimport type {\n BeforeOperationHook,\n BulkOperationResult,\n Collection,\n DataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../config/types.js'\n\nimport executeAccess from '../../auth/executeAccess.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { validateQueryPaths } from '../../database/queryValidation/validateQueryPaths.js'\nimport { APIError } from '../../errors/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { deleteUserPreferences } from '../../preferences/deleteUserPreferences.js'\nimport { deleteAssociatedFiles } from '../../uploads/deleteAssociatedFiles.js'\nimport { checkDocumentLockStatus } from '../../utilities/checkDocumentLockStatus.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { deleteCollectionVersions } from '../../versions/deleteCollectionVersions.js'\nimport { buildAfterOperation } from './utils.js'\n\nexport type Arguments = {\n collection: Collection\n depth?: number\n disableTransaction?: boolean\n overrideAccess?: boolean\n overrideLock?: boolean\n populate?: PopulateType\n req: PayloadRequest\n select?: SelectType\n showHiddenFields?: boolean\n where: Where\n}\n\nexport const deleteOperation = async <\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n incomingArgs: Arguments,\n): Promise<BulkOperationResult<TSlug, TSelect>> => {\n let args = incomingArgs\n\n try {\n const shouldCommit = !args.disableTransaction && (await initTransaction(args.req))\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n await args.collection.config.hooks.beforeOperation.reduce(\n async (priorHook: BeforeOperationHook | Promise<void>, hook: BeforeOperationHook) => {\n await priorHook\n\n args =\n (await hook({\n args,\n collection: args.collection.config,\n context: args.req.context,\n operation: 'delete',\n req: args.req,\n })) || args\n },\n Promise.resolve(),\n )\n\n const {\n collection: { config: collectionConfig },\n depth,\n overrideAccess,\n overrideLock,\n populate,\n req: {\n fallbackLocale,\n locale,\n payload: { config },\n payload,\n },\n req,\n select,\n showHiddenFields,\n where,\n } = args\n\n if (!where) {\n throw new APIError(\"Missing 'where' query of documents to delete.\", httpStatus.BAD_REQUEST)\n }\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n let accessResult: AccessResult\n\n if (!overrideAccess) {\n accessResult = await executeAccess({ req }, collectionConfig.access.delete)\n }\n\n await validateQueryPaths({\n collectionConfig,\n overrideAccess,\n req,\n where,\n })\n\n const fullWhere = combineQueries(where, accessResult)\n\n // /////////////////////////////////////\n // Retrieve documents\n // /////////////////////////////////////\n\n const { docs } = await payload.db.find<DataFromCollectionSlug<TSlug>>({\n collection: collectionConfig.slug,\n locale,\n req,\n select,\n where: fullWhere,\n })\n\n const errors = []\n\n const promises = docs.map(async (doc) => {\n let result\n\n const { id } = doc\n\n try {\n // /////////////////////////////////////\n // Handle potentially locked documents\n // /////////////////////////////////////\n\n await checkDocumentLockStatus({\n id,\n collectionSlug: collectionConfig.slug,\n lockErrorMessage: `Document with ID ${id} is currently locked and cannot be deleted.`,\n overrideLock,\n req,\n })\n\n // /////////////////////////////////////\n // beforeDelete - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.beforeDelete.reduce(async (priorHook, hook) => {\n await priorHook\n\n return hook({\n id,\n collection: collectionConfig,\n context: req.context,\n req,\n })\n }, Promise.resolve())\n\n await deleteAssociatedFiles({\n collectionConfig,\n config,\n doc,\n overrideDelete: true,\n req,\n })\n\n // /////////////////////////////////////\n // Delete versions\n // /////////////////////////////////////\n\n if (collectionConfig.versions) {\n await deleteCollectionVersions({\n id,\n slug: collectionConfig.slug,\n payload,\n req,\n })\n }\n\n // /////////////////////////////////////\n // Delete document\n // /////////////////////////////////////\n\n await payload.db.deleteOne({\n collection: collectionConfig.slug,\n req,\n where: {\n id: {\n equals: id,\n },\n },\n })\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result = await afterRead({\n collection: collectionConfig,\n context: req.context,\n depth,\n doc: result || doc,\n draft: undefined,\n fallbackLocale,\n global: null,\n locale,\n overrideAccess,\n populate,\n req,\n select,\n showHiddenFields,\n })\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: result || doc,\n req,\n })) || result\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterDelete - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterDelete.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n id,\n collection: collectionConfig,\n context: req.context,\n doc: result,\n req,\n })) || result\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // 8. Return results\n // /////////////////////////////////////\n\n return result\n } catch (error) {\n errors.push({\n id: doc.id,\n message: error.message,\n })\n }\n return null\n })\n\n const awaitedDocs = await Promise.all(promises)\n\n // /////////////////////////////////////\n // Delete Preferences\n // /////////////////////////////////////\n\n await deleteUserPreferences({\n collectionConfig,\n ids: docs.map(({ id }) => id),\n payload,\n req,\n })\n\n let result = {\n docs: awaitedDocs.filter(Boolean),\n errors,\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'delete',\n result,\n })\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return result\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["httpStatus","executeAccess","combineQueries","validateQueryPaths","APIError","afterRead","deleteUserPreferences","deleteAssociatedFiles","checkDocumentLockStatus","commitTransaction","initTransaction","killTransaction","deleteCollectionVersions","buildAfterOperation","deleteOperation","incomingArgs","args","shouldCommit","disableTransaction","req","collection","config","hooks","beforeOperation","reduce","priorHook","hook","context","operation","Promise","resolve","collectionConfig","depth","overrideAccess","overrideLock","populate","fallbackLocale","locale","payload","select","showHiddenFields","where","BAD_REQUEST","accessResult","access","delete","fullWhere","docs","db","find","slug","errors","promises","map","doc","result","id","collectionSlug","lockErrorMessage","beforeDelete","overrideDelete","versions","deleteOne","equals","draft","undefined","global","afterDelete","error","push","message","awaitedDocs","all","ids","filter","Boolean"],"mappings":"AAAA,OAAOA,gBAAgB,cAAa;AAapC,OAAOC,mBAAmB,8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BACdjB,OAAOkB,IAAI,CAAC;oBACVb,IAAIF,IAAIE,EAAE;oBACVc,SAASF,MAAME,OAAO;gBACxB;YACF;YACA,OAAO;QACT;QAEA,MAAMC,cAAc,MAAM1C,QAAQ2C,GAAG,CAACpB;QAEtC,wCAAwC;QACxC,qBAAqB;QACrB,wCAAwC;QAExC,MAAM9C,sBAAsB;YAC1ByB;YACA0C,KAAK1B,KAAKM,GAAG,CAAC,CAAC,EAAEG,EAAE,EAAE,GAAKA;YAC1BlB;YACAnB;QACF;QAEA,IAAIoC,SAAS;YACXR,MAAMwB,YAAYG,MAAM,CAACC;YACzBxB;QACF;QAEA,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCI,SAAS,MAAM1C,oBAAoB;YACjCG;YACAI,YAAYW;YACZH,WAAW;YACX2B;QACF;QAEA,IAAItC,cAAc;YAChB,MAAMR,kBAAkBU;QAC1B;QAEA,OAAOoC;IACT,EAAE,OAAOa,OAAgB;QACvB,MAAMzD,gBAAgBK,KAAKG,GAAG;QAC9B,MAAMiD;IACR;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/operations/delete.ts"],"sourcesContent":["import httpStatus from 'http-status'\n\nimport type { AccessResult } from '../../config/types.js'\nimport type { CollectionSlug } from '../../index.js'\nimport type { PayloadRequest, PopulateType, SelectType, Where } from '../../types/index.js'\nimport type {\n BeforeOperationHook,\n BulkOperationResult,\n Collection,\n DataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../config/types.js'\n\nimport executeAccess from '../../auth/executeAccess.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { validateQueryPaths } from '../../database/queryValidation/validateQueryPaths.js'\nimport { APIError } from '../../errors/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { deleteUserPreferences } from '../../preferences/deleteUserPreferences.js'\nimport { deleteAssociatedFiles } from '../../uploads/deleteAssociatedFiles.js'\nimport { checkDocumentLockStatus } from '../../utilities/checkDocumentLockStatus.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { deleteCollectionVersions } from '../../versions/deleteCollectionVersions.js'\nimport { deleteScheduledPublishJobs } from '../../versions/deleteScheduledPublishJobs.js'\nimport { buildAfterOperation } from './utils.js'\n\nexport type Arguments = {\n collection: Collection\n depth?: number\n disableTransaction?: boolean\n overrideAccess?: boolean\n overrideLock?: boolean\n populate?: PopulateType\n req: PayloadRequest\n select?: SelectType\n showHiddenFields?: boolean\n where: Where\n}\n\nexport const deleteOperation = async <\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n incomingArgs: Arguments,\n): Promise<BulkOperationResult<TSlug, TSelect>> => {\n let args = incomingArgs\n\n try {\n const shouldCommit = !args.disableTransaction && (await initTransaction(args.req))\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n await args.collection.config.hooks.beforeOperation.reduce(\n async (priorHook: BeforeOperationHook | Promise<void>, hook: BeforeOperationHook) => {\n await priorHook\n\n args =\n (await hook({\n args,\n collection: args.collection.config,\n context: args.req.context,\n operation: 'delete',\n req: args.req,\n })) || args\n },\n Promise.resolve(),\n )\n\n const {\n collection: { config: collectionConfig },\n depth,\n overrideAccess,\n overrideLock,\n populate,\n req: {\n fallbackLocale,\n locale,\n payload: { config },\n payload,\n },\n req,\n select,\n showHiddenFields,\n where,\n } = args\n\n if (!where) {\n throw new APIError(\"Missing 'where' query of documents to delete.\", httpStatus.BAD_REQUEST)\n }\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n let accessResult: AccessResult\n\n if (!overrideAccess) {\n accessResult = await executeAccess({ req }, collectionConfig.access.delete)\n }\n\n await validateQueryPaths({\n collectionConfig,\n overrideAccess,\n req,\n where,\n })\n\n const fullWhere = combineQueries(where, accessResult)\n\n // /////////////////////////////////////\n // Retrieve documents\n // /////////////////////////////////////\n\n const { docs } = await payload.db.find<DataFromCollectionSlug<TSlug>>({\n collection: collectionConfig.slug,\n locale,\n req,\n select,\n where: fullWhere,\n })\n\n const errors = []\n\n const promises = docs.map(async (doc) => {\n let result\n\n const { id } = doc\n\n try {\n // /////////////////////////////////////\n // Handle potentially locked documents\n // /////////////////////////////////////\n\n await checkDocumentLockStatus({\n id,\n collectionSlug: collectionConfig.slug,\n lockErrorMessage: `Document with ID ${id} is currently locked and cannot be deleted.`,\n overrideLock,\n req,\n })\n\n // /////////////////////////////////////\n // beforeDelete - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.beforeDelete.reduce(async (priorHook, hook) => {\n await priorHook\n\n return hook({\n id,\n collection: collectionConfig,\n context: req.context,\n req,\n })\n }, Promise.resolve())\n\n await deleteAssociatedFiles({\n collectionConfig,\n config,\n doc,\n overrideDelete: true,\n req,\n })\n\n // /////////////////////////////////////\n // Delete versions\n // /////////////////////////////////////\n\n if (collectionConfig.versions) {\n await deleteCollectionVersions({\n id,\n slug: collectionConfig.slug,\n payload,\n req,\n })\n }\n\n // /////////////////////////////////////\n // Delete scheduled posts\n // /////////////////////////////////////\n if (collectionConfig.versions?.drafts && collectionConfig.versions.drafts.schedulePublish) {\n await deleteScheduledPublishJobs({\n id,\n slug: collectionConfig.slug,\n payload,\n req,\n })\n }\n\n // /////////////////////////////////////\n // Delete document\n // /////////////////////////////////////\n\n await payload.db.deleteOne({\n collection: collectionConfig.slug,\n req,\n where: {\n id: {\n equals: id,\n },\n },\n })\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result = await afterRead({\n collection: collectionConfig,\n context: req.context,\n depth,\n doc: result || doc,\n draft: undefined,\n fallbackLocale,\n global: null,\n locale,\n overrideAccess,\n populate,\n req,\n select,\n showHiddenFields,\n })\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: result || doc,\n req,\n })) || result\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterDelete - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterDelete.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n id,\n collection: collectionConfig,\n context: req.context,\n doc: result,\n req,\n })) || result\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // 8. Return results\n // /////////////////////////////////////\n\n return result\n } catch (error) {\n errors.push({\n id: doc.id,\n message: error.message,\n })\n }\n return null\n })\n\n const awaitedDocs = await Promise.all(promises)\n\n // /////////////////////////////////////\n // Delete Preferences\n // /////////////////////////////////////\n\n await deleteUserPreferences({\n collectionConfig,\n ids: docs.map(({ id }) => id),\n payload,\n req,\n })\n\n let result = {\n docs: awaitedDocs.filter(Boolean),\n errors,\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'delete',\n result,\n })\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return result\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["httpStatus","executeAccess","combineQueries","validateQueryPaths","APIError","afterRead","deleteUserPreferences","deleteAssociatedFiles","checkDocumentLockStatus","commitTransaction","initTransaction","killTransaction","deleteCollectionVersions","deleteScheduledPublishJobs","buildAfterOperation","deleteOperation","incomingArgs","args","shouldCommit","disableTransaction","req","collection","config","hooks","beforeOperation","reduce","priorHook","hook","context","operation","Promise","resolve","collectionConfig","depth","overrideAccess","overrideLock","populate","fallbackLocale","locale","payload","select","showHiddenFields","where","BAD_REQUEST","accessResult","access","delete","fullWhere","docs","db","find","slug","errors","promises","map","doc","result","id","collectionSlug","lockErrorMessage","beforeDelete","overrideDelete","versions","drafts","schedulePublish","deleteOne","equals","draft","undefined","global","afterDelete","error","push","message","awaitedDocs","all","ids","filter","Boolean"],"mappings":"AAAA,O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iBAAiBT,KAAK,CAAC+C,WAAW,CAAC7C,MAAM,CAAC,OAAOC,WAAWC;oBAChE,MAAMD;oBAEN8B,SACE,AAAC,MAAM7B,KAAK;wBACV8B;wBACApC,YAAYW;wBACZJ,SAASR,IAAIQ,OAAO;wBACpB2B,KAAKC;wBACLpC;oBACF,MAAOoC;gBACX,GAAG1B,QAAQC,OAAO;gBAElB,wCAAwC;gBACxC,oBAAoB;gBACpB,wCAAwC;gBAExC,OAAOyB;YACT,EAAE,OAAOe,OAAO;gBACdnB,OAAOoB,IAAI,CAAC;oBACVf,IAAIF,IAAIE,EAAE;oBACVgB,SAASF,MAAME,OAAO;gBACxB;YACF;YACA,OAAO;QACT;QAEA,MAAMC,cAAc,MAAM5C,QAAQ6C,GAAG,CAACtB;QAEtC,wCAAwC;QACxC,qBAAqB;QACrB,wCAAwC;QAExC,MAAM/C,sBAAsB;YAC1B0B;YACA4C,KAAK5B,KAAKM,GAAG,CAAC,CAAC,EAAEG,EAAE,EAAE,GAAKA;YAC1BlB;YACAnB;QACF;QAEA,IAAIoC,SAAS;YACXR,MAAM0B,YAAYG,MAAM,CAACC;YACzB1B;QACF;QAEA,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCI,SAAS,MAAM1C,oBAAoB;YACjCG;YACAI,YAAYW;YACZH,WAAW;YACX2B;QACF;QAEA,IAAItC,cAAc;YAChB,MAAMT,kBAAkBW;QAC1B;QAEA,OAAOoC;IACT,EAAE,OAAOe,OAAgB;QACvB,MAAM5D,gBAAgBM,KAAKG,GAAG;QAC9B,MAAMmD;IACR;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteByID.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/deleteByID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC9B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAuB,UAAU,EAA0B,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"deleteByID.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/deleteByID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC9B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAuB,UAAU,EAA0B,MAAM,oBAAoB,CAAA;AAiBjG,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,GAAG,EAAE,cAAc,CAAA;IACnB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAU,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,gBAClF,SAAS,KACtB,OAAO,CAAC,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAsOvD,CAAA"}
|
|
@@ -10,6 +10,7 @@ import { commitTransaction } from '../../utilities/commitTransaction.js';
|
|
|
10
10
|
import { initTransaction } from '../../utilities/initTransaction.js';
|
|
11
11
|
import { killTransaction } from '../../utilities/killTransaction.js';
|
|
12
12
|
import { deleteCollectionVersions } from '../../versions/deleteCollectionVersions.js';
|
|
13
|
+
import { deleteScheduledPublishJobs } from '../../versions/deleteScheduledPublishJobs.js';
|
|
13
14
|
import { buildAfterOperation } from './utils.js';
|
|
14
15
|
export const deleteByIDOperation = async (incomingArgs)=>{
|
|
15
16
|
let args = incomingArgs;
|
|
@@ -97,6 +98,17 @@ export const deleteByIDOperation = async (incomingArgs)=>{
|
|
|
97
98
|
});
|
|
98
99
|
}
|
|
99
100
|
// /////////////////////////////////////
|
|
101
|
+
// Delete scheduled posts
|
|
102
|
+
// /////////////////////////////////////
|
|
103
|
+
if (collectionConfig.versions?.drafts && collectionConfig.versions.drafts.schedulePublish) {
|
|
104
|
+
await deleteScheduledPublishJobs({
|
|
105
|
+
id,
|
|
106
|
+
slug: collectionConfig.slug,
|
|
107
|
+
payload,
|
|
108
|
+
req
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
// /////////////////////////////////////
|
|
100
112
|
// Delete document
|
|
101
113
|
// /////////////////////////////////////
|
|
102
114
|
let result = await req.payload.db.deleteOne({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/collections/operations/deleteByID.ts"],"sourcesContent":["import type { CollectionSlug } from '../../index.js'\nimport type {\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n} from '../../types/index.js'\nimport type { BeforeOperationHook, Collection, DataFromCollectionSlug } from '../config/types.js'\n\nimport executeAccess from '../../auth/executeAccess.js'\nimport { hasWhereAccessResult } from '../../auth/types.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { Forbidden, NotFound } from '../../errors/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { deleteUserPreferences } from '../../preferences/deleteUserPreferences.js'\nimport { deleteAssociatedFiles } from '../../uploads/deleteAssociatedFiles.js'\nimport { checkDocumentLockStatus } from '../../utilities/checkDocumentLockStatus.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { deleteCollectionVersions } from '../../versions/deleteCollectionVersions.js'\nimport { buildAfterOperation } from './utils.js'\n\nexport type Arguments = {\n collection: Collection\n depth?: number\n disableTransaction?: boolean\n id: number | string\n overrideAccess?: boolean\n overrideLock?: boolean\n populate?: PopulateType\n req: PayloadRequest\n select?: SelectType\n showHiddenFields?: boolean\n}\n\nexport const deleteByIDOperation = async <TSlug extends CollectionSlug, TSelect extends SelectType>(\n incomingArgs: Arguments,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>> => {\n let args = incomingArgs\n\n try {\n const shouldCommit = !args.disableTransaction && (await initTransaction(args.req))\n\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n await args.collection.config.hooks.beforeOperation.reduce(\n async (priorHook: BeforeOperationHook | Promise<void>, hook: BeforeOperationHook) => {\n await priorHook\n\n args =\n (await hook({\n args,\n collection: args.collection.config,\n context: args.req.context,\n operation: 'delete',\n req: args.req,\n })) || args\n },\n Promise.resolve(),\n )\n\n const {\n id,\n collection: { config: collectionConfig },\n depth,\n overrideAccess,\n overrideLock,\n populate,\n req: {\n fallbackLocale,\n locale,\n payload: { config },\n payload,\n },\n req,\n select,\n showHiddenFields,\n } = args\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n const accessResults = !overrideAccess\n ? await executeAccess({ id, req }, collectionConfig.access.delete)\n : true\n const hasWhereAccess = hasWhereAccessResult(accessResults)\n\n // /////////////////////////////////////\n // beforeDelete - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.beforeDelete.reduce(async (priorHook, hook) => {\n await priorHook\n\n return hook({\n id,\n collection: collectionConfig,\n context: req.context,\n req,\n })\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // Retrieve document\n // /////////////////////////////////////\n\n const docToDelete = await req.payload.db.findOne({\n collection: collectionConfig.slug,\n locale: req.locale,\n req,\n where: combineQueries({ id: { equals: id } }, accessResults),\n })\n\n if (!docToDelete && !hasWhereAccess) {\n throw new NotFound(req.t)\n }\n if (!docToDelete && hasWhereAccess) {\n throw new Forbidden(req.t)\n }\n\n // /////////////////////////////////////\n // Handle potentially locked documents\n // /////////////////////////////////////\n\n await checkDocumentLockStatus({\n id,\n collectionSlug: collectionConfig.slug,\n lockErrorMessage: `Document with ID ${id} is currently locked and cannot be deleted.`,\n overrideLock,\n req,\n })\n\n await deleteAssociatedFiles({\n collectionConfig,\n config,\n doc: docToDelete,\n overrideDelete: true,\n req,\n })\n\n // /////////////////////////////////////\n // Delete versions\n // /////////////////////////////////////\n\n if (collectionConfig.versions) {\n await deleteCollectionVersions({\n id,\n slug: collectionConfig.slug,\n payload,\n req,\n })\n }\n\n // /////////////////////////////////////\n // Delete document\n // /////////////////////////////////////\n\n let result: DataFromCollectionSlug<TSlug> = await req.payload.db.deleteOne({\n collection: collectionConfig.slug,\n req,\n select,\n where: { id: { equals: id } },\n })\n\n // /////////////////////////////////////\n // Delete Preferences\n // /////////////////////////////////////\n\n await deleteUserPreferences({\n collectionConfig,\n ids: [id],\n payload,\n req,\n })\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result = await afterRead({\n collection: collectionConfig,\n context: req.context,\n depth,\n doc: result,\n draft: undefined,\n fallbackLocale,\n global: null,\n locale,\n overrideAccess,\n populate,\n req,\n select,\n showHiddenFields,\n })\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: result,\n req,\n })) || result\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterDelete - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterDelete.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n id,\n collection: collectionConfig,\n context: req.context,\n doc: result,\n req,\n })) || result\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'deleteByID',\n result,\n })\n\n // /////////////////////////////////////\n // 8. Return results\n // /////////////////////////////////////\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return result as TransformCollectionWithSelect<TSlug, TSelect>\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["executeAccess","hasWhereAccessResult","combineQueries","Forbidden","NotFound","afterRead","deleteUserPreferences","deleteAssociatedFiles","checkDocumentLockStatus","commitTransaction","initTransaction","killTransaction","deleteCollectionVersions","buildAfterOperation","deleteByIDOperation","incomingArgs","args","shouldCommit","disableTransaction","req","collection","config","hooks","beforeOperation","reduce","priorHook","hook","context","operation","Promise","resolve","id","collectionConfig","depth","overrideAccess","overrideLock","populate","fallbackLocale","locale","payload","select","showHiddenFields","accessResults","access","delete","hasWhereAccess","beforeDelete","docToDelete","db","findOne","slug","where","equals","t","collectionSlug","lockErrorMessage","doc","overrideDelete","versions","result","deleteOne","ids","draft","undefined","global","afterDelete","error"],"mappings":"AASA,OAAOA,mBAAmB,8BAA6B;AACvD,SAASC,oBAAoB,QAAQ,sBAAqB;AAC1D,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,wBAAuB;AAC3D,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,qBAAqB,QAAQ,6CAA4C;AAClF,SAASC,qBAAqB,QAAQ,yCAAwC;AAC9E,SAASC,uBAAuB,QAAQ,6CAA4C;AACpF,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,wBAAwB,QAAQ,6CAA4C;AACrF,SAASC,mBAAmB,QAAQ,aAAY;AAehD,OAAO,MAAMC,sBAAsB,OACjCC;IAEA,IAAIC,OAAOD;IAEX,IAAI;QACF,MAAME,eAAe,CAACD,KAAKE,kBAAkB,IAAK,MAAMR,gBAAgBM,KAAKG,GAAG;QAEhF,wCAAwC;QACxC,+BAA+B;QAC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;QAEA,wCAAwC;QACxC,yBAAyB;QACzB,wCAAwC;QAExC,MAAMT,iBAAiBV,KAAK,CAACjB,SAAS,CAACmB,MAAM,CAAC,OAAOC,WAAWC;YAC9D,MAAMD;YAENkC,SACE,AAAC,MAAMjC,KAAK;gBACVN,YAAYY;gBACZL,SAASR,IAAIQ,OAAO;gBACpB6B,KAAKG;gBACLxC;YACF,MAAOwC;QACX,GAAG9B,QAAQC,OAAO;QAElB,wCAAwC;QACxC,2BAA2B;QAC3B,wCAAwC;QAExC,MAAME,iBAAiBV,KAAK,CAAC2C,WAAW,CAACzC,MAAM,CAAC,OAAOC,WAAWC;YAChE,MAAMD;YAENkC,SACE,AAAC,MAAMjC,KAAK;gBACVK;gBACAX,YAAYY;gBACZL,SAASR,IAAIQ,OAAO;gBACpB6B,KAAKG;gBACLxC;YACF,MAAOwC;QACX,GAAG9B,QAAQC,OAAO;QAElB,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExC6B,SAAS,MAAM9C,oBAAoB;YACjCG;YACAI,YAAYY;YACZJ,WAAW;YACX+B;QACF;QAEA,wCAAwC;QACxC,oBAAoB;QACpB,wCAAwC;QAExC,IAAI1C,cAAc;YAChB,MAAMR,kBAAkBU;QAC1B;QAEA,OAAOwC;IACT,EAAE,OAAOO,OAAgB;QACvB,MAAMvD,gBAAgBK,KAAKG,GAAG;QAC9B,MAAM+C;IACR;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/operations/deleteByID.ts"],"sourcesContent":["import type { CollectionSlug } from '../../index.js'\nimport type {\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n} from '../../types/index.js'\nimport type { BeforeOperationHook, Collection, DataFromCollectionSlug } from '../config/types.js'\n\nimport executeAccess from '../../auth/executeAccess.js'\nimport { hasWhereAccessResult } from '../../auth/types.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { Forbidden, NotFound } from '../../errors/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { deleteUserPreferences } from '../../preferences/deleteUserPreferences.js'\nimport { deleteAssociatedFiles } from '../../uploads/deleteAssociatedFiles.js'\nimport { checkDocumentLockStatus } from '../../utilities/checkDocumentLockStatus.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { deleteCollectionVersions } from '../../versions/deleteCollectionVersions.js'\nimport { deleteScheduledPublishJobs } from '../../versions/deleteScheduledPublishJobs.js'\nimport { buildAfterOperation } from './utils.js'\n\nexport type Arguments = {\n collection: Collection\n depth?: number\n disableTransaction?: boolean\n id: number | string\n overrideAccess?: boolean\n overrideLock?: boolean\n populate?: PopulateType\n req: PayloadRequest\n select?: SelectType\n showHiddenFields?: boolean\n}\n\nexport const deleteByIDOperation = async <TSlug extends CollectionSlug, TSelect extends SelectType>(\n incomingArgs: Arguments,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>> => {\n let args = incomingArgs\n\n try {\n const shouldCommit = !args.disableTransaction && (await initTransaction(args.req))\n\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n await args.collection.config.hooks.beforeOperation.reduce(\n async (priorHook: BeforeOperationHook | Promise<void>, hook: BeforeOperationHook) => {\n await priorHook\n\n args =\n (await hook({\n args,\n collection: args.collection.config,\n context: args.req.context,\n operation: 'delete',\n req: args.req,\n })) || args\n },\n Promise.resolve(),\n )\n\n const {\n id,\n collection: { config: collectionConfig },\n depth,\n overrideAccess,\n overrideLock,\n populate,\n req: {\n fallbackLocale,\n locale,\n payload: { config },\n payload,\n },\n req,\n select,\n showHiddenFields,\n } = args\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n const accessResults = !overrideAccess\n ? await executeAccess({ id, req }, collectionConfig.access.delete)\n : true\n const hasWhereAccess = hasWhereAccessResult(accessResults)\n\n // /////////////////////////////////////\n // beforeDelete - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.beforeDelete.reduce(async (priorHook, hook) => {\n await priorHook\n\n return hook({\n id,\n collection: collectionConfig,\n context: req.context,\n req,\n })\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // Retrieve document\n // /////////////////////////////////////\n\n const docToDelete = await req.payload.db.findOne({\n collection: collectionConfig.slug,\n locale: req.locale,\n req,\n where: combineQueries({ id: { equals: id } }, accessResults),\n })\n\n if (!docToDelete && !hasWhereAccess) {\n throw new NotFound(req.t)\n }\n if (!docToDelete && hasWhereAccess) {\n throw new Forbidden(req.t)\n }\n\n // /////////////////////////////////////\n // Handle potentially locked documents\n // /////////////////////////////////////\n\n await checkDocumentLockStatus({\n id,\n collectionSlug: collectionConfig.slug,\n lockErrorMessage: `Document with ID ${id} is currently locked and cannot be deleted.`,\n overrideLock,\n req,\n })\n\n await deleteAssociatedFiles({\n collectionConfig,\n config,\n doc: docToDelete,\n overrideDelete: true,\n req,\n })\n\n // /////////////////////////////////////\n // Delete versions\n // /////////////////////////////////////\n\n if (collectionConfig.versions) {\n await deleteCollectionVersions({\n id,\n slug: collectionConfig.slug,\n payload,\n req,\n })\n }\n\n // /////////////////////////////////////\n // Delete scheduled posts\n // /////////////////////////////////////\n if (collectionConfig.versions?.drafts && collectionConfig.versions.drafts.schedulePublish) {\n await deleteScheduledPublishJobs({\n id,\n slug: collectionConfig.slug,\n payload,\n req,\n })\n }\n\n // /////////////////////////////////////\n // Delete document\n // /////////////////////////////////////\n\n let result: DataFromCollectionSlug<TSlug> = await req.payload.db.deleteOne({\n collection: collectionConfig.slug,\n req,\n select,\n where: { id: { equals: id } },\n })\n\n // /////////////////////////////////////\n // Delete Preferences\n // /////////////////////////////////////\n\n await deleteUserPreferences({\n collectionConfig,\n ids: [id],\n payload,\n req,\n })\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result = await afterRead({\n collection: collectionConfig,\n context: req.context,\n depth,\n doc: result,\n draft: undefined,\n fallbackLocale,\n global: null,\n locale,\n overrideAccess,\n populate,\n req,\n select,\n showHiddenFields,\n })\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: result,\n req,\n })) || result\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterDelete - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterDelete.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n id,\n collection: collectionConfig,\n context: req.context,\n doc: result,\n req,\n })) || result\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'deleteByID',\n result,\n })\n\n // /////////////////////////////////////\n // 8. Return results\n // /////////////////////////////////////\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return result as TransformCollectionWithSelect<TSlug, TSelect>\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["executeAccess","hasWhereAccessResult","combineQueries","Forbidden","NotFound","afterRead","deleteUserPreferences","deleteAssociatedFiles","checkDocumentLockStatus","commitTransaction","initTransaction","killTransaction","deleteCollectionVersions","deleteScheduledPublishJobs","buildAfterOperation","deleteByIDOperation","incomingArgs","args","shouldCommit","disableTransaction","req","collection","config","hooks","beforeOperation","reduce","priorHook","hook","context","operation","Promise","resolve","id","collectionConfig","depth","overrideAccess","overrideLock","populate","fallbackLocale","locale","payload","select","showHiddenFields","accessResults","access","delete","hasWhereAccess","beforeDelete","docToDelete","db","findOne","slug","where","equals","t","collectionSlug","lockErrorMessage","doc","overrideDelete","versions","drafts","schedulePublish","result","deleteOne","ids","draft","undefined","global","afterDelete","error"],"mappings":"AASA,OAAOA,mBAAmB,8BAA6B;AACvD,SAASC,oBAAoB,QAAQ,sBAAqB;AAC1D,SAASC,cAAc,QAA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;YAENoC,SACE,AAAC,MAAMnC,KAAK;gBACVK;gBACAX,YAAYY;gBACZL,SAASR,IAAIQ,OAAO;gBACpB6B,KAAKK;gBACL1C;YACF,MAAO0C;QACX,GAAGhC,QAAQC,OAAO;QAElB,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExC+B,SAAS,MAAMhD,oBAAoB;YACjCG;YACAI,YAAYY;YACZJ,WAAW;YACXiC;QACF;QAEA,wCAAwC;QACxC,oBAAoB;QACpB,wCAAwC;QAExC,IAAI5C,cAAc;YAChB,MAAMT,kBAAkBW;QAC1B;QAEA,OAAO0C;IACT,EAAE,OAAOO,OAAgB;QACvB,MAAM1D,gBAAgBM,KAAKG,GAAG;QAC9B,MAAMiD;IACR;AACF,EAAC"}
|
package/dist/config/client.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ImportMap } from '../bin/generateImportMap/index.js';
|
|
|
3
3
|
import type { LivePreviewConfig, SanitizedConfig, ServerOnlyLivePreviewProperties } from './types.js';
|
|
4
4
|
import { type ClientCollectionConfig } from '../collections/config/client.js';
|
|
5
5
|
import { type ClientGlobalConfig } from '../globals/config/client.js';
|
|
6
|
-
export type ServerOnlyRootProperties = keyof Pick<SanitizedConfig, 'bin' | 'cors' | 'csrf' | 'custom' | 'db' | 'editor' | 'email' | 'endpoints' | 'graphQL' | 'hooks' | 'jobs' | 'logger' | 'onInit' | 'plugins' | 'secret' | 'sharp' | 'typescript'>;
|
|
6
|
+
export type ServerOnlyRootProperties = keyof Pick<SanitizedConfig, 'bin' | 'cors' | 'csrf' | 'custom' | 'db' | 'editor' | 'email' | 'endpoints' | 'graphQL' | 'hooks' | 'i18n' | 'jobs' | 'logger' | 'onInit' | 'plugins' | 'secret' | 'sharp' | 'typescript'>;
|
|
7
7
|
export type ServerOnlyRootAdminProperties = keyof Pick<SanitizedConfig['admin'], 'components'>;
|
|
8
8
|
export type ClientConfig = {
|
|
9
9
|
admin: {
|
|
@@ -12,7 +12,6 @@ export type ClientConfig = {
|
|
|
12
12
|
collections: ClientCollectionConfig[];
|
|
13
13
|
custom?: Record<string, any>;
|
|
14
14
|
globals: ClientGlobalConfig[];
|
|
15
|
-
i18n?: Omit<SanitizedConfig['i18n'], 'supportedLanguages'>;
|
|
16
15
|
} & Omit<SanitizedConfig, 'admin' | 'collections' | 'globals' | 'i18n' | ServerOnlyRootProperties>;
|
|
17
16
|
export declare const serverOnlyAdminConfigProperties: readonly Partial<ServerOnlyRootAdminProperties>[];
|
|
18
17
|
export declare const serverOnlyConfigProperties: readonly Partial<ServerOnlyRootProperties>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/config/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAG1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAA;AAClE,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,+BAA+B,EAChC,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,KAAK,kBAAkB,EAA6B,MAAM,6BAA6B,CAAA;AAEhG,MAAM,MAAM,wBAAwB,GAAG,MAAM,IAAI,CAC/C,eAAe,EACb,KAAK,GACL,MAAM,GACN,MAAM,GACN,QAAQ,GACR,IAAI,GACJ,QAAQ,GACR,OAAO,GACP,WAAW,GACX,SAAS,GACT,OAAO,GACP,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,OAAO,GACP,YAAY,CACf,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,CAAA;AAE9F,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE;QACL,WAAW,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,+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AAA;IACjF,WAAW,EAAE,sBAAsB,EAAE,CAAA;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,OAAO,EAAE,kBAAkB,EAAE,CAAA;CAC9B,GAAG,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG,wBAAwB,CAAC,CAAA;AAElG,eAAO,MAAM,+BAA+B,EAAE,SAAS,OAAO,CAAC,6BAA6B,CAAC,EAAO,CAAA;AAEpG,eAAO,MAAM,0BAA0B,EAAE,SAAS,OAAO,CAAC,wBAAwB,CAAC,EAoBlF,CAAA;AAED,eAAO,MAAM,kBAAkB,iCAI5B;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;CACrB,KAAG,YAoFH,CAAA"}
|
package/dist/config/client.js
CHANGED
|
@@ -11,6 +11,7 @@ export const serverOnlyConfigProperties = [
|
|
|
11
11
|
'secret',
|
|
12
12
|
'hooks',
|
|
13
13
|
'bin',
|
|
14
|
+
'i18n',
|
|
14
15
|
'typescript',
|
|
15
16
|
'cors',
|
|
16
17
|
'csrf',
|
|
@@ -64,12 +65,6 @@ export const createClientConfig = ({ config, i18n, importMap })=>{
|
|
|
64
65
|
importMap
|
|
65
66
|
});
|
|
66
67
|
break;
|
|
67
|
-
case 'i18n':
|
|
68
|
-
clientConfig.i18n = {
|
|
69
|
-
fallbackLanguage: config.i18n.fallbackLanguage,
|
|
70
|
-
translations: config.i18n.translations
|
|
71
|
-
};
|
|
72
|
-
break;
|
|
73
68
|
case 'localization':
|
|
74
69
|
if (typeof config.localization === 'object' && config.localization) {
|
|
75
70
|
clientConfig.localization = {};
|