@payloadcms/ui 3.13.0 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/elements/PublishButton/index.d.ts.map +1 -1
  2. package/dist/elements/PublishButton/index.js +11 -4
  3. package/dist/elements/PublishButton/index.js.map +1 -1
  4. package/dist/elements/SaveButton/index.d.ts.map +1 -1
  5. package/dist/elements/SaveButton/index.js +12 -4
  6. package/dist/elements/SaveButton/index.js.map +1 -1
  7. package/dist/elements/SaveDraftButton/index.d.ts.map +1 -1
  8. package/dist/elements/SaveDraftButton/index.js +3 -2
  9. package/dist/elements/SaveDraftButton/index.js.map +1 -1
  10. package/dist/elements/Upload/index.d.ts.map +1 -1
  11. package/dist/elements/Upload/index.js +6 -2
  12. package/dist/elements/Upload/index.js.map +1 -1
  13. package/dist/exports/client/index.js +22 -22
  14. package/dist/exports/client/index.js.map +3 -3
  15. package/dist/exports/shared/index.js +2 -2
  16. package/dist/exports/shared/index.js.map +3 -3
  17. package/dist/fields/Upload/HasMany/index.d.ts.map +1 -1
  18. package/dist/fields/Upload/HasMany/index.js +6 -4
  19. package/dist/fields/Upload/HasMany/index.js.map +1 -1
  20. package/dist/fields/Upload/Input.d.ts.map +1 -1
  21. package/dist/fields/Upload/Input.js +166 -143
  22. package/dist/fields/Upload/Input.js.map +1 -1
  23. package/dist/fields/Upload/RelationshipContent/index.d.ts +1 -1
  24. package/dist/fields/Upload/RelationshipContent/index.d.ts.map +1 -1
  25. package/dist/fields/Upload/RelationshipContent/index.js +55 -45
  26. package/dist/fields/Upload/RelationshipContent/index.js.map +1 -1
  27. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts +3 -0
  28. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts.map +1 -1
  29. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js +22 -24
  30. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js.map +1 -1
  31. package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/promise.d.ts.map +1 -1
  32. package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/promise.js +14 -7
  33. package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/promise.js.map +1 -1
  34. package/dist/forms/fieldSchemasToFormState/index.d.ts.map +1 -1
  35. package/dist/forms/fieldSchemasToFormState/index.js.map +1 -1
  36. package/dist/forms/fieldSchemasToFormState/iterateFields.d.ts.map +1 -1
  37. package/dist/forms/fieldSchemasToFormState/iterateFields.js +26 -3
  38. package/dist/forms/fieldSchemasToFormState/iterateFields.js.map +1 -1
  39. package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
  40. package/dist/providers/DocumentInfo/index.js +6 -0
  41. package/dist/providers/DocumentInfo/index.js.map +1 -1
  42. package/dist/providers/DocumentInfo/types.d.ts +3 -0
  43. package/dist/providers/DocumentInfo/types.d.ts.map +1 -1
  44. package/dist/providers/DocumentInfo/types.js.map +1 -1
  45. package/dist/providers/ServerFunctions/index.d.ts +5 -2
  46. package/dist/providers/ServerFunctions/index.d.ts.map +1 -1
  47. package/dist/providers/ServerFunctions/index.js +1 -0
  48. package/dist/providers/ServerFunctions/index.js.map +1 -1
  49. package/dist/utilities/abortAndIgnore.d.ts +8 -0
  50. package/dist/utilities/abortAndIgnore.d.ts.map +1 -1
  51. package/dist/utilities/abortAndIgnore.js +11 -5
  52. package/dist/utilities/abortAndIgnore.js.map +1 -1
  53. package/dist/utilities/buildClientFieldSchemaMap/index.d.ts.map +1 -1
  54. package/dist/utilities/buildClientFieldSchemaMap/index.js +4 -6
  55. package/dist/utilities/buildClientFieldSchemaMap/index.js.map +1 -1
  56. package/dist/utilities/buildFieldSchemaMap/index.d.ts.map +1 -1
  57. package/dist/utilities/buildFieldSchemaMap/index.js +4 -6
  58. package/dist/utilities/buildFieldSchemaMap/index.js.map +1 -1
  59. package/dist/utilities/schedulePublishHandler.d.ts +1 -1
  60. package/dist/utilities/schedulePublishHandler.d.ts.map +1 -1
  61. package/dist/utilities/schedulePublishHandler.js +25 -4
  62. package/dist/utilities/schedulePublishHandler.js.map +1 -1
  63. package/dist/views/Edit/Auth/index.d.ts.map +1 -1
  64. package/dist/views/Edit/Auth/index.js +79 -90
  65. package/dist/views/Edit/Auth/index.js.map +1 -1
  66. package/dist/views/Edit/Auth/types.d.ts +0 -1
  67. package/dist/views/Edit/Auth/types.d.ts.map +1 -1
  68. package/dist/views/Edit/Auth/types.js.map +1 -1
  69. package/dist/views/Edit/index.d.ts.map +1 -1
  70. package/dist/views/Edit/index.js +2 -8
  71. package/dist/views/Edit/index.js.map +1 -1
  72. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/providers/DocumentInfo/types.ts"],"sourcesContent":["import type {\n ClientCollectionConfig,\n ClientGlobalConfig,\n ClientUser,\n Data,\n DocumentPreferences,\n FormState,\n InsideFieldsPreferences,\n SanitizedCollectionConfig,\n SanitizedDocumentPermissions,\n SanitizedGlobalConfig,\n TypedUser,\n} from 'payload'\nimport type React from 'react'\n\nexport type DocumentInfoProps = {\n readonly action?: string\n readonly AfterDocument?: React.ReactNode\n readonly AfterFields?: React.ReactNode\n readonly apiURL?: string\n readonly BeforeFields?: React.ReactNode\n readonly collectionSlug?: SanitizedCollectionConfig['slug']\n readonly currentEditor: TypedUser\n readonly disableActions?: boolean\n readonly disableCreate?: boolean\n readonly disableLeaveWithoutSaving?: boolean\n readonly docPermissions?: SanitizedDocumentPermissions\n readonly globalSlug?: SanitizedGlobalConfig['slug']\n readonly hasPublishedDoc: boolean\n readonly hasPublishPermission?: boolean\n readonly hasSavePermission?: boolean\n readonly id?: number | string\n readonly initialData?: Data\n readonly initialState?: FormState\n readonly isEditing?: boolean\n readonly isLocked: boolean\n readonly lastUpdateTime: number\n readonly mostRecentVersionIsAutosaved: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n readonly unpublishedVersionCount: number\n readonly Upload?: React.ReactNode\n readonly versionCount: number\n}\n\nexport type DocumentInfoContext = {\n currentEditor?: ClientUser | null | number | string\n docConfig?: ClientCollectionConfig | ClientGlobalConfig\n documentIsLocked?: boolean\n getDocPermissions: (data?: Data) => Promise<void>\n getDocPreferences: () => Promise<DocumentPreferences>\n incrementVersionCount: () => void\n isInitializing: boolean\n preferencesKey?: string\n savedDocumentData?: Data\n setCurrentEditor?: React.Dispatch<React.SetStateAction<ClientUser>>\n setDocFieldPreferences: (\n field: string,\n fieldPreferences: { [key: string]: unknown } & Partial<InsideFieldsPreferences>,\n ) => void\n setDocumentIsLocked?: React.Dispatch<React.SetStateAction<boolean>>\n setDocumentTitle: (title: string) => void\n setHasPublishedDoc: React.Dispatch<React.SetStateAction<boolean>>\n setLastUpdateTime: React.Dispatch<React.SetStateAction<number>>\n setMostRecentVersionIsAutosaved: React.Dispatch<React.SetStateAction<boolean>>\n setUnpublishedVersionCount: React.Dispatch<React.SetStateAction<number>>\n title: string\n unlockDocument: (docID: number | string, slug: string) => Promise<void>\n unpublishedVersionCount: number\n updateDocumentEditor: (docID: number | string, slug: string, user: ClientUser) => Promise<void>\n updateSavedDocumentData: (data: Data) => void\n} & DocumentInfoProps\n"],"mappings":"AA6CA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/providers/DocumentInfo/types.ts"],"sourcesContent":["import type {\n ClientCollectionConfig,\n ClientGlobalConfig,\n ClientUser,\n Data,\n DocumentPreferences,\n FormState,\n InsideFieldsPreferences,\n SanitizedCollectionConfig,\n SanitizedDocumentPermissions,\n SanitizedGlobalConfig,\n TypedUser,\n} from 'payload'\nimport type React from 'react'\n\nexport type DocumentInfoProps = {\n readonly action?: string\n readonly AfterDocument?: React.ReactNode\n readonly AfterFields?: React.ReactNode\n readonly apiURL?: string\n readonly BeforeFields?: React.ReactNode\n readonly collectionSlug?: SanitizedCollectionConfig['slug']\n readonly currentEditor: TypedUser\n readonly disableActions?: boolean\n readonly disableCreate?: boolean\n readonly disableLeaveWithoutSaving?: boolean\n readonly docPermissions?: SanitizedDocumentPermissions\n readonly globalSlug?: SanitizedGlobalConfig['slug']\n readonly hasPublishedDoc: boolean\n readonly hasPublishPermission?: boolean\n readonly hasSavePermission?: boolean\n readonly id?: number | string\n readonly initialData?: Data\n readonly initialState?: FormState\n readonly isEditing?: boolean\n readonly isLocked: boolean\n readonly lastUpdateTime: number\n readonly mostRecentVersionIsAutosaved: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n readonly unpublishedVersionCount: number\n readonly Upload?: React.ReactNode\n readonly versionCount: number\n}\n\nexport type DocumentInfoContext = {\n currentEditor?: ClientUser | null | number | string\n docConfig?: ClientCollectionConfig | ClientGlobalConfig\n documentIsLocked?: boolean\n getDocPermissions: (data?: Data) => Promise<void>\n getDocPreferences: () => Promise<DocumentPreferences>\n incrementVersionCount: () => void\n isInitializing: boolean\n preferencesKey?: string\n savedDocumentData?: Data\n setCurrentEditor?: React.Dispatch<React.SetStateAction<ClientUser>>\n setDocFieldPreferences: (\n field: string,\n fieldPreferences: { [key: string]: unknown } & Partial<InsideFieldsPreferences>,\n ) => void\n setDocumentIsLocked?: React.Dispatch<React.SetStateAction<boolean>>\n setDocumentTitle: (title: string) => void\n setHasPublishedDoc: React.Dispatch<React.SetStateAction<boolean>>\n setLastUpdateTime: React.Dispatch<React.SetStateAction<number>>\n setMostRecentVersionIsAutosaved: React.Dispatch<React.SetStateAction<boolean>>\n setUnpublishedVersionCount: React.Dispatch<React.SetStateAction<number>>\n setUploadStatus?: (status: 'failed' | 'idle' | 'uploading') => void\n title: string\n unlockDocument: (docID: number | string, slug: string) => Promise<void>\n unpublishedVersionCount: number\n updateDocumentEditor: (docID: number | string, slug: string, user: ClientUser) => Promise<void>\n updateSavedDocumentData: (data: Data) => void\n uploadStatus?: 'failed' | 'idle' | 'uploading'\n versionCount: number\n} & DocumentInfoProps\n"],"mappings":"AA6CA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { BuildFormStateArgs, BuildTableStateArgs, Data, DocumentSlots, Locale, ServerFunctionClient } from 'payload';
1
+ import type { BuildFormStateArgs, BuildTableStateArgs, Data, DocumentSlots, ErrorResult, Locale, ServerFunctionClient } from 'payload';
2
2
  import React from 'react';
3
3
  import type { buildFormStateHandler } from '../../utilities/buildFormState.js';
4
4
  import type { buildTableStateHandler } from '../../utilities/buildTableState.js';
@@ -27,7 +27,10 @@ type RenderDocument = (args: {
27
27
  }) => Promise<{
28
28
  data: Data;
29
29
  Document: React.ReactNode;
30
- }>;
30
+ } | ({
31
+ data: never;
32
+ Document: never;
33
+ } & ErrorResult)>;
31
34
  type CopyDataFromLocaleClient = (args: {
32
35
  signal?: AbortSignal;
33
36
  } & Omit<CopyDataFromLocaleArgs, 'req'>) => Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/ServerFunctions/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,IAAI,EACJ,aAAa,EACb,MAAM,EACN,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAqC,MAAM,OAAO,CAAA;AAEzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AAC9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAA;AACnF,OAAO,KAAK,EACV,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,2CAA2C,CAAA;AAElD,KAAK,kBAAkB,GAAG,CACxB,IAAI,EAAE;IACJ,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,GAAG,IAAI,CAAC,kBAAkB,EAAE,cAAc,GAAG,KAAK,CAAC,KACjD,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAE7C,KAAK,qBAAqB,GAAG,CAC3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AAE,MAAM,CAAA;IACtB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,KAAK,OAAO,CAAC,aAAa,CAAC,CAAA;AAE5B,KAAK,0BAA0B,GAAG;IAChC,kBAAkB,EAAE,wBAAwB,CAAA;IAC5C,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,YAAY,EAAE,kBAAkB,CAAA;IAChC,aAAa,EAAE,mBAAmB,CAAA;IAClC,cAAc,EAAE,cAAc,CAAA;IAC9B,eAAe,EAAE,qBAAqB,CAAA;IACtC,cAAc,EAAE,oBAAoB,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,sBAAsB,2CAElC,CAAA;AAED,eAAO,MAAM,kBAAkB,kCAM9B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC;IAC7C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,cAAc,EAAE,oBAAoB,CAAA;CACrC,CAiJA,CAAA"}
@@ -114,6 +114,7 @@ export const ServerFunctionsProvider = ({
114
114
  ...rest
115
115
  }
116
116
  });
117
+ // TODO: infer this type when `strictNullChecks` is enabled
117
118
  return result;
118
119
  } catch (_err) {
119
120
  console.error(_err) // eslint-disable-line no-console
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","createContext","useCallback","ServerFunctionsContext","undefined","useServerFunctions","context","useContext","Error","ServerFunctionsProvider","children","serverFunction","getDocumentSlots","args","name","schedulePublish","signal","remoteSignal","rest","aborted","result","_err","console","error","type","doc","value","relationTo","getFormState","fallbackLocale","state","getTableState","renderDocument","copyDataFromLocale","_jsx","Provider"],"sources":["../../../src/providers/ServerFunctions/index.tsx"],"sourcesContent":["import type {\n BuildFormStateArgs,\n BuildTableStateArgs,\n Data,\n DocumentSlots,\n Locale,\n ServerFunctionClient,\n} from 'payload'\n\nimport React, { createContext, useCallback } from 'react'\n\nimport type { buildFormStateHandler } from '../../utilities/buildFormState.js'\nimport type { buildTableStateHandler } from '../../utilities/buildTableState.js'\nimport type { CopyDataFromLocaleArgs } from '../../utilities/copyDataFromLocale.js'\nimport type {\n schedulePublishHandler,\n SchedulePublishHandlerArgs,\n} from '../../utilities/schedulePublishHandler.js'\n\ntype GetFormStateClient = (\n args: {\n signal?: AbortSignal\n } & Omit<BuildFormStateArgs, 'clientConfig' | 'req'>,\n) => ReturnType<typeof buildFormStateHandler>\n\ntype SchedulePublishClient = (\n args: {\n signal?: AbortSignal\n } & Omit<SchedulePublishHandlerArgs, 'clientConfig' | 'req'>,\n) => ReturnType<typeof schedulePublishHandler>\n\ntype GetTableStateClient = (\n args: {\n signal?: AbortSignal\n } & Omit<BuildTableStateArgs, 'clientConfig' | 'req'>,\n) => ReturnType<typeof buildTableStateHandler>\n\ntype RenderDocument = (args: {\n collectionSlug: string\n disableActions?: boolean\n docID?: number | string\n drawerSlug?: string\n initialData?: Data\n locale?: Locale\n overrideEntityVisibility?: boolean\n redirectAfterDelete?: boolean\n redirectAfterDuplicate?: boolean\n signal?: AbortSignal\n}) => Promise<{ data: Data; Document: React.ReactNode }>\n\ntype CopyDataFromLocaleClient = (\n args: {\n signal?: AbortSignal\n } & Omit<CopyDataFromLocaleArgs, 'req'>,\n) => Promise<{ data: Data }>\n\ntype GetDocumentSlots = (args: {\n collectionSlug: string\n signal?: AbortSignal\n}) => Promise<DocumentSlots>\n\ntype ServerFunctionsContextType = {\n copyDataFromLocale: CopyDataFromLocaleClient\n getDocumentSlots: GetDocumentSlots\n getFormState: GetFormStateClient\n getTableState: GetTableStateClient\n renderDocument: RenderDocument\n schedulePublish: SchedulePublishClient\n serverFunction: ServerFunctionClient\n}\n\nexport const ServerFunctionsContext = createContext<ServerFunctionsContextType | undefined>(\n undefined,\n)\n\nexport const useServerFunctions = () => {\n const context = React.useContext(ServerFunctionsContext)\n if (context === undefined) {\n throw new Error('useServerFunctions must be used within a ServerFunctionsProvider')\n }\n return context\n}\n\nexport const ServerFunctionsProvider: React.FC<{\n children: React.ReactNode\n serverFunction: ServerFunctionClient\n}> = ({ children, serverFunction }) => {\n if (!serverFunction) {\n throw new Error('ServerFunctionsProvider requires a serverFunction prop')\n }\n\n const getDocumentSlots = useCallback<GetDocumentSlots>(\n async (args) =>\n await serverFunction({\n name: 'render-document-slots',\n args,\n }),\n [serverFunction],\n )\n\n const schedulePublish = useCallback<SchedulePublishClient>(\n async (args) => {\n const { signal: remoteSignal, ...rest } = args\n\n try {\n if (!remoteSignal?.aborted) {\n const result = (await serverFunction({\n name: 'schedule-publish',\n args: { ...rest },\n })) as ReturnType<typeof schedulePublishHandler> // TODO: infer this type when `strictNullChecks` is enabled\n\n if (!remoteSignal?.aborted) {\n return result\n }\n }\n } catch (_err) {\n console.error(_err) // eslint-disable-line no-console\n }\n\n let error = `Error scheduling ${rest.type}`\n\n if (rest.doc) {\n error += ` for document with ID ${rest.doc.value} in collection ${rest.doc.relationTo}`\n }\n\n return { error: '' }\n },\n [serverFunction],\n )\n\n const getFormState = useCallback<GetFormStateClient>(\n async (args) => {\n const { signal: remoteSignal, ...rest } = args || {}\n\n try {\n if (!remoteSignal?.aborted) {\n const result = (await serverFunction({\n name: 'form-state',\n args: { fallbackLocale: false, ...rest },\n })) as ReturnType<typeof buildFormStateHandler> // TODO: infer this type when `strictNullChecks` is enabled\n\n if (!remoteSignal?.aborted) {\n return result\n }\n }\n } catch (_err) {\n console.error(_err) // eslint-disable-line no-console\n }\n\n return { state: null }\n },\n [serverFunction],\n )\n\n const getTableState = useCallback<GetTableStateClient>(\n async (args) => {\n const { signal: remoteSignal, ...rest } = args || {}\n\n try {\n if (!remoteSignal?.aborted) {\n const result = (await serverFunction({\n name: 'table-state',\n args: { fallbackLocale: false, ...rest },\n })) as ReturnType<typeof buildTableStateHandler> // TODO: infer this type when `strictNullChecks` is enabled\n\n if (!remoteSignal?.aborted) {\n return result\n }\n }\n } catch (_err) {\n console.error(_err) // eslint-disable-line no-console\n }\n\n // return { state: args.formState }\n },\n [serverFunction],\n )\n\n const renderDocument = useCallback<RenderDocument>(\n async (args) => {\n const { signal: remoteSignal, ...rest } = args || {}\n\n try {\n const result = (await serverFunction({\n name: 'render-document',\n args: { fallbackLocale: false, ...rest },\n })) as { data: Data; Document: React.ReactNode }\n\n return result\n } catch (_err) {\n console.error(_err) // eslint-disable-line no-console\n }\n },\n [serverFunction],\n )\n\n const copyDataFromLocale = useCallback<CopyDataFromLocaleClient>(\n async (args) => {\n const { signal: remoteSignal, ...rest } = args || {}\n\n try {\n const result = (await serverFunction({\n name: 'copy-data-from-locale',\n args: rest,\n })) as { data: Data }\n\n if (!remoteSignal?.aborted) {\n return result\n }\n } catch (_err) {\n console.error(_err) // eslint-disable-line no-console\n }\n },\n [serverFunction],\n )\n\n return (\n <ServerFunctionsContext.Provider\n value={{\n copyDataFromLocale,\n getDocumentSlots,\n getFormState,\n getTableState,\n renderDocument,\n schedulePublish,\n serverFunction,\n }}\n >\n {children}\n </ServerFunctionsContext.Provider>\n )\n}\n"],"mappings":";AASA,OAAOA,KAAA,IAASC,aAAa,EAAEC,WAAW,QAAQ;AA8DlD,OAAO,MAAMC,sBAAA,gBAAyBF,aAAA,CACpCG,SAAA;AAGF,OAAO,MAAMC,kBAAA,GAAqBA,CAAA;EAChC,MAAMC,OAAA,GAAUN,KAAA,CAAMO,UAAU,CAACJ,sBAAA;EACjC,IAAIG,OAAA,KAAYF,SAAA,EAAW;IACzB,MAAM,IAAII,KAAA,CAAM;EAClB;EACA,OAAOF,OAAA;AACT;AAEA,OAAO,MAAMG,uBAAA,GAGRA,CAAC;EAAEC,QAAQ;EAAEC;AAAc,CAAE;EAChC,IAAI,CAACA,cAAA,EAAgB;IACnB,MAAM,IAAIH,KAAA,CAAM;EAClB;EAEA,MAAMI,gBAAA,GAAmBV,WAAA,CACvB,MAAOW,IAAA,IACL,MAAMF,cAAA,CAAe;IACnBG,IAAA,EAAM;IACND;EACF,IACF,CAACF,cAAA,CAAe;EAGlB,MAAMI,eAAA,GAAkBb,WAAA,CACtB,MAAOW,IAAA;IACL,MAAM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OAAA,EAAS;QAC1B,OAAOC,MAAA;MACT;IACF,EAAE,OAAOC,IAAA,EAAM;MACbC,OAAA,CAAQC,KAAK,CAACF,IAAA,EAAM;MAAA;IACtB;EACF,GACA,CAACV,cAAA,CAAe;EAGlB,oBACEuB,IAAA,CAAC/B,sBAAA,CAAuBgC,QAAQ;IAC9BT,KAAA,EAAO;MACLO,kBAAA;MACArB,gBAAA;MACAgB,YAAA;MACAG,aAAA;MACAC,cAAA;MACAjB,eAAA;MACAJ;IACF;cAECD;;AAGP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","createContext","useCallback","ServerFunctionsContext","undefined","useServerFunctions","context","useContext","Error","ServerFunctionsProvider","children","serverFunction","getDocumentSlots","args","name","schedulePublish","signal","remoteSignal","rest","aborted","result","_err","console","error","type","doc","value","relationTo","getFormState","fallbackLocale","state","getTableState","renderDocument","copyDataFromLocale","_jsx","Provider"],"sources":["../../../src/providers/ServerFunctions/index.tsx"],"sourcesContent":["import type {\n BuildFormStateArgs,\n BuildTableStateArgs,\n Data,\n DocumentSlots,\n ErrorResult,\n Locale,\n ServerFunctionClient,\n} from 'payload'\n\nimport React, { createContext, useCallback } from 'react'\n\nimport type { buildFormStateHandler } from '../../utilities/buildFormState.js'\nimport type { buildTableStateHandler } from '../../utilities/buildTableState.js'\nimport type { CopyDataFromLocaleArgs } from '../../utilities/copyDataFromLocale.js'\nimport type {\n schedulePublishHandler,\n SchedulePublishHandlerArgs,\n} from '../../utilities/schedulePublishHandler.js'\n\ntype GetFormStateClient = (\n args: {\n signal?: AbortSignal\n } & Omit<BuildFormStateArgs, 'clientConfig' | 'req'>,\n) => ReturnType<typeof buildFormStateHandler>\n\ntype SchedulePublishClient = (\n args: {\n signal?: AbortSignal\n } & Omit<SchedulePublishHandlerArgs, 'clientConfig' | 'req'>,\n) => ReturnType<typeof schedulePublishHandler>\n\ntype GetTableStateClient = (\n args: {\n signal?: AbortSignal\n } & Omit<BuildTableStateArgs, 'clientConfig' | 'req'>,\n) => ReturnType<typeof buildTableStateHandler>\n\ntype RenderDocument = (args: {\n collectionSlug: string\n disableActions?: boolean\n docID?: number | string\n drawerSlug?: string\n initialData?: Data\n locale?: Locale\n overrideEntityVisibility?: boolean\n redirectAfterDelete?: boolean\n redirectAfterDuplicate?: boolean\n signal?: AbortSignal\n}) => Promise<\n { data: Data; Document: React.ReactNode } | ({ data: never; Document: never } & ErrorResult)\n>\n\ntype CopyDataFromLocaleClient = (\n args: {\n signal?: AbortSignal\n } & Omit<CopyDataFromLocaleArgs, 'req'>,\n) => Promise<{ data: Data }>\n\ntype GetDocumentSlots = (args: {\n collectionSlug: string\n signal?: AbortSignal\n}) => Promise<DocumentSlots>\n\ntype ServerFunctionsContextType = {\n copyDataFromLocale: CopyDataFromLocaleClient\n getDocumentSlots: GetDocumentSlots\n getFormState: GetFormStateClient\n getTableState: GetTableStateClient\n renderDocument: RenderDocument\n schedulePublish: SchedulePublishClient\n serverFunction: ServerFunctionClient\n}\n\nexport const ServerFunctionsContext = createContext<ServerFunctionsContextType | undefined>(\n undefined,\n)\n\nexport const useServerFunctions = () => {\n const context = React.useContext(ServerFunctionsContext)\n if (context === undefined) {\n throw new Error('useServerFunctions must be used within a ServerFunctionsProvider')\n }\n return context\n}\n\nexport const ServerFunctionsProvider: React.FC<{\n children: React.ReactNode\n serverFunction: ServerFunctionClient\n}> = ({ children, serverFunction }) => {\n if (!serverFunction) {\n throw new Error('ServerFunctionsProvider requires a serverFunction prop')\n }\n\n const getDocumentSlots = useCallback<GetDocumentSlots>(\n async (args) =>\n await serverFunction({\n name: 'render-document-slots',\n args,\n }),\n [serverFunction],\n )\n\n const schedulePublish = useCallback<SchedulePublishClient>(\n async (args) => {\n const { signal: remoteSignal, ...rest } = args\n\n try {\n if (!remoteSignal?.aborted) {\n const result = (await serverFunction({\n name: 'schedule-publish',\n args: { ...rest },\n })) as Awaited<ReturnType<typeof schedulePublishHandler>> // TODO: infer this type when `strictNullChecks` is enabled\n\n if (!remoteSignal?.aborted) {\n return result\n }\n }\n } catch (_err) {\n console.error(_err) // eslint-disable-line no-console\n }\n\n let error = `Error scheduling ${rest.type}`\n\n if (rest.doc) {\n error += ` for document with ID ${rest.doc.value} in collection ${rest.doc.relationTo}`\n }\n\n return { error: '' }\n },\n [serverFunction],\n )\n\n const getFormState = useCallback<GetFormStateClient>(\n async (args) => {\n const { signal: remoteSignal, ...rest } = args || {}\n\n try {\n if (!remoteSignal?.aborted) {\n const result = (await serverFunction({\n name: 'form-state',\n args: { fallbackLocale: false, ...rest },\n })) as Awaited<ReturnType<typeof buildFormStateHandler>> // TODO: infer this type when `strictNullChecks` is enabled\n\n if (!remoteSignal?.aborted) {\n return result\n }\n }\n } catch (_err) {\n console.error(_err) // eslint-disable-line no-console\n }\n\n return { state: null }\n },\n [serverFunction],\n )\n\n const getTableState = useCallback<GetTableStateClient>(\n async (args) => {\n const { signal: remoteSignal, ...rest } = args || {}\n\n try {\n if (!remoteSignal?.aborted) {\n const result = (await serverFunction({\n name: 'table-state',\n args: { fallbackLocale: false, ...rest },\n })) as Awaited<ReturnType<typeof buildTableStateHandler>> // TODO: infer this type when `strictNullChecks` is enabled\n\n if (!remoteSignal?.aborted) {\n return result\n }\n }\n } catch (_err) {\n console.error(_err) // eslint-disable-line no-console\n }\n\n // return { state: args.formState }\n },\n [serverFunction],\n )\n\n const renderDocument = useCallback<RenderDocument>(\n async (args) => {\n const { signal: remoteSignal, ...rest } = args || {}\n\n try {\n const result = (await serverFunction({\n name: 'render-document',\n args: { fallbackLocale: false, ...rest },\n })) as Awaited<ReturnType<typeof renderDocument>> // TODO: infer this type when `strictNullChecks` is enabled\n\n return result\n } catch (_err) {\n console.error(_err) // eslint-disable-line no-console\n }\n },\n [serverFunction],\n )\n\n const copyDataFromLocale = useCallback<CopyDataFromLocaleClient>(\n async (args) => {\n const { signal: remoteSignal, ...rest } = args || {}\n\n try {\n const result = (await serverFunction({\n name: 'copy-data-from-locale',\n args: rest,\n })) as { data: Data }\n\n if (!remoteSignal?.aborted) {\n return result\n }\n } catch (_err) {\n console.error(_err) // eslint-disable-line no-console\n }\n },\n [serverFunction],\n )\n\n return (\n <ServerFunctionsContext.Provider\n value={{\n copyDataFromLocale,\n getDocumentSlots,\n getFormState,\n getTableState,\n renderDocument,\n schedulePublish,\n serverFunction,\n }}\n >\n {children}\n </ServerFunctionsContext.Provider>\n )\n}\n"],"mappings":";AAUA,OAAOA,KAAA,IAASC,aAAa,EAAEC,WAAW,QAAQ;AAgElD,OAAO,MAAMC,sBAAA,gBAAyBF,aAAA,CACpCG,SAAA;AAGF,OAAO,MAAMC,kBAAA,GAAqBA,CAAA;EAChC,MAAMC,OAAA,GAAUN,KAAA,CAAMO,UAAU,CAACJ,sBAAA;EACjC,IAAIG,OAAA,KAAYF,SAAA,EAAW;IACzB,MAAM,IAAII,KAAA,CAAM;EAClB;EACA,OAAOF,OAAA;AACT;AAEA,OAAO,MAAMG,uBAAA,GAGRA,CAAC;EAAEC,QAAQ;EAAEC;AAAc,CAAE;EAChC,IAAI,CAACA,cAAA,EAAgB;IACnB,MAAM,IAAIH,KAAA,CAAM;EAClB;EAEA,MAAMI,gBAAA,GAAmBV,WAAA,CACvB,MAAOW,IAAA,IACL,MAAMF,cAAA,CAAe;IACnBG,IAAA,EAAM;IACND;EACF,IACF,CAACF,cAAA,CAAe;EAGlB,MAAMI,eAAA,GAAkBb,WAAA,CACtB,MAAOW,IAAA;IACL,MAAM;MAAEG,MAAA,EAAQC,YAAY;MAAE,GAAGC;IAAA,CAAM,GAAGL,IAAA;IAE1C,IAAI;MACF,IAAI,CAACI,YAAA,EAAcE,OAAA,EAAS;QAC1B,MAAMC,MAAA,GAAU,MAAMT,cAAA,CAAe;UACnCG,IAAA,EAAM;UACND,IAAA,EAAM;YAAE,GAAGK;UAAK;QAClB;QAA0D;QAE1D,IAAI,CAACD,YAAA,EAAcE,OAAA,EAAS;UAC1B,OAAOC,MAAA;QACT;MACF;IACF,EAAE,OAAOC,IAAA,EAAM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List":[]}
@@ -1,3 +1,11 @@
1
1
  export declare function abortAndIgnore(abortController: AbortController): void;
2
+ /**
3
+ * Use this function when an effect is triggered multiple times over and you want to cancel the previous effect.
4
+ * It will abort the previous effect and create a new AbortController for the next effect.
5
+ * Important: You must also _reset_ the `abortControllerRef` after the effect is done, otherwise the next effect will be aborted immediately.
6
+ * For example, run `abortControllerRef.current = null` in a `finally` block or after an awaited promise.
7
+ * @param abortControllerRef
8
+ * @returns {AbortController}
9
+ */
2
10
  export declare function handleAbortRef(abortControllerRef: React.RefObject<AbortController>): AbortController;
3
11
  //# sourceMappingURL=abortAndIgnore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"abortAndIgnore.d.ts","sourceRoot":"","sources":["../../src/utilities/abortAndIgnore.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,eAAe,EAAE,eAAe,QAQ9D;AAED,wBAAgB,cAAc,CAC5B,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,GACnD,eAAe,CAajB"}
1
+ {"version":3,"file":"abortAndIgnore.d.ts","sourceRoot":"","sources":["../../src/utilities/abortAndIgnore.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,eAAe,EAAE,eAAe,QAQ9D;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,GACnD,eAAe,CAcjB"}
@@ -7,18 +7,24 @@ export function abortAndIgnore(abortController) {
7
7
  }
8
8
  }
9
9
  }
10
+ /**
11
+ * Use this function when an effect is triggered multiple times over and you want to cancel the previous effect.
12
+ * It will abort the previous effect and create a new AbortController for the next effect.
13
+ * Important: You must also _reset_ the `abortControllerRef` after the effect is done, otherwise the next effect will be aborted immediately.
14
+ * For example, run `abortControllerRef.current = null` in a `finally` block or after an awaited promise.
15
+ * @param abortControllerRef
16
+ * @returns {AbortController}
17
+ */
10
18
  export function handleAbortRef(abortControllerRef) {
19
+ const newController = new AbortController();
11
20
  if (abortControllerRef.current) {
12
21
  try {
13
22
  abortControllerRef.current.abort();
14
- abortControllerRef.current = null;
15
23
  } catch (_err) {
16
24
  // swallow error
17
25
  }
18
- } else {
19
- const controller = new AbortController();
20
- abortControllerRef.current = controller;
21
- return controller;
22
26
  }
27
+ abortControllerRef.current = newController;
28
+ return newController;
23
29
  }
24
30
  //# sourceMappingURL=abortAndIgnore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"abortAndIgnore.js","names":["abortAndIgnore","abortController","abort","_err","handleAbortRef","abortControllerRef","current","controller","AbortController"],"sources":["../../src/utilities/abortAndIgnore.ts"],"sourcesContent":["export function abortAndIgnore(abortController: AbortController) {\n if (abortController) {\n try {\n abortController.abort()\n } catch (_err) {\n // swallow error\n }\n }\n}\n\nexport function handleAbortRef(\n abortControllerRef: React.RefObject<AbortController>,\n): AbortController {\n if (abortControllerRef.current) {\n try {\n abortControllerRef.current.abort()\n abortControllerRef.current = null\n } catch (_err) {\n // swallow error\n }\n } else {\n const controller = new AbortController()\n abortControllerRef.current = controller\n return controller\n }\n}\n"],"mappings":"AAAA,OAAO,SAASA,eAAeC,eAAgC;EAC7D,IAAIA,eAAA,EAAiB;IACnB,IAAI;MACFA,eAAA,CAAgBC,KAAK;IACvB,EAAE,OAAOC,IAAA,EAAM;MACb;IAAA;EAEJ;AACF;AAEA,OAAO,SAASC,eACdC,kBAAoD;EAEpD,IAAIA,kBAAA,CAAmBC,OAAO,EAAE;IAC9B,IAAI;MACFD,kBAAA,CAAmBC,OAAO,CAACJ,KAAK;MAChCG,kBAAA,CAAmBC,OAAO,GAAG;IAC/B,EAAE,OAAOH,IAAA,EAAM;MACb;IAAA;EAEJ,OAAO;IACL,MAAMI,UAAA,GAAa,IAAIC,eAAA;IACvBH,kBAAA,CAAmBC,OAAO,GAAGC,UAAA;IAC7B,OAAOA,UAAA;EACT;AACF","ignoreList":[]}
1
+ {"version":3,"file":"abortAndIgnore.js","names":["abortAndIgnore","abortController","abort","_err","handleAbortRef","abortControllerRef","newController","AbortController","current"],"sources":["../../src/utilities/abortAndIgnore.ts"],"sourcesContent":["export function abortAndIgnore(abortController: AbortController) {\n if (abortController) {\n try {\n abortController.abort()\n } catch (_err) {\n // swallow error\n }\n }\n}\n\n/**\n * Use this function when an effect is triggered multiple times over and you want to cancel the previous effect.\n * It will abort the previous effect and create a new AbortController for the next effect.\n * Important: You must also _reset_ the `abortControllerRef` after the effect is done, otherwise the next effect will be aborted immediately.\n * For example, run `abortControllerRef.current = null` in a `finally` block or after an awaited promise.\n * @param abortControllerRef\n * @returns {AbortController}\n */\nexport function handleAbortRef(\n abortControllerRef: React.RefObject<AbortController>,\n): AbortController {\n const newController = new AbortController()\n\n if (abortControllerRef.current) {\n try {\n abortControllerRef.current.abort()\n } catch (_err) {\n // swallow error\n }\n }\n\n abortControllerRef.current = newController\n\n return newController\n}\n"],"mappings":"AAAA,OAAO,SAASA,eAAeC,eAAgC;EAC7D,IAAIA,eAAA,EAAiB;IACnB,IAAI;MACFA,eAAA,CAAgBC,KAAK;IACvB,EAAE,OAAOC,IAAA,EAAM;MACb;IAAA;EAEJ;AACF;AAEA;;;;;;;;AAQA,OAAO,SAASC,eACdC,kBAAoD;EAEpD,MAAMC,aAAA,GAAgB,IAAIC,eAAA;EAE1B,IAAIF,kBAAA,CAAmBG,OAAO,EAAE;IAC9B,IAAI;MACFH,kBAAA,CAAmBG,OAAO,CAACN,KAAK;IAClC,EAAE,OAAOC,IAAA,EAAM;MACb;IAAA;EAEJ;EAEAE,kBAAA,CAAmBG,OAAO,GAAGF,aAAA;EAE7B,OAAOA,aAAA;AACT","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/buildClientFieldSchemaMap/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EACV,YAAY,EAEZ,oBAAoB,EACpB,cAAc,EACd,OAAO,EAER,MAAM,SAAS,CAAA;AAiBhB;;GAEG;AACH,eAAO,MAAM,yBAAyB,SAAU;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,YAAY,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,cAAc,CAAA;CAC1B,KAAG;IAAE,oBAAoB,EAAE,oBAAoB,CAAA;CA0D/C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/buildClientFieldSchemaMap/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EACV,YAAY,EAEZ,oBAAoB,EACpB,cAAc,EACd,OAAO,EAER,MAAM,SAAS,CAAA;AAiBhB;;GAEG;AACH,eAAO,MAAM,yBAAyB,SAAU;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,YAAY,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,cAAc,CAAA;CAC1B,KAAG;IAAE,oBAAoB,EAAE,oBAAoB,CAAA;CAwD/C,CAAA"}
@@ -24,22 +24,20 @@ export const buildClientFieldSchemaMap = args => {
24
24
  if (collectionSlug) {
25
25
  const matchedCollection = config.collections.find(collection => collection.slug === collectionSlug);
26
26
  if (matchedCollection) {
27
+ let fieldsToSet = matchedCollection?.fields || [];
27
28
  if (matchedCollection.auth && !matchedCollection.auth.disableLocalStrategy) {
28
- // register schema with auth schemaPath
29
29
  ;
30
30
  baseAuthFields[0].label = i18n.t('general:password');
31
31
  baseAuthFields[1].label = i18n.t('authentication:confirmPassword');
32
- clientSchemaMap.set(`_${matchedCollection.slug}.auth`, {
33
- fields: [...baseAuthFields, ...matchedCollection.fields]
34
- });
32
+ fieldsToSet = baseAuthFields.concat(fieldsToSet);
35
33
  }
36
34
  clientSchemaMap.set(collectionSlug, {
37
- fields: matchedCollection.fields
35
+ fields: fieldsToSet
38
36
  });
39
37
  traverseFields({
40
38
  clientSchemaMap,
41
39
  config,
42
- fields: matchedCollection.fields,
40
+ fields: fieldsToSet,
43
41
  i18n,
44
42
  parentIndexPath: '',
45
43
  parentSchemaPath: collectionSlug,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["traverseFields","baseAuthFields","name","type","required","buildClientFieldSchemaMap","args","collectionSlug","config","globalSlug","i18n","payload","schemaMap","clientSchemaMap","Map","matchedCollection","collections","find","collection","slug","auth","disableLocalStrategy","label","t","set","fields","parentIndexPath","parentSchemaPath","matchedGlobal","globals","global","clientFieldSchemaMap"],"sources":["../../../src/utilities/buildClientFieldSchemaMap/index.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type {\n ClientConfig,\n ClientField,\n ClientFieldSchemaMap,\n FieldSchemaMap,\n Payload,\n TextFieldClient,\n} from 'payload'\n\nimport { traverseFields } from './traverseFields.js'\n\nconst baseAuthFields: ClientField[] = [\n {\n name: 'password',\n type: 'text',\n required: true,\n },\n {\n name: 'confirm-password',\n type: 'text',\n required: true,\n },\n]\n\n/**\n * Flattens the config fields into a map of field schemas\n */\nexport const buildClientFieldSchemaMap = (args: {\n collectionSlug?: string\n config: ClientConfig\n globalSlug?: string\n i18n: I18n\n payload: Payload\n schemaMap: FieldSchemaMap\n}): { clientFieldSchemaMap: ClientFieldSchemaMap } => {\n const { collectionSlug, config, globalSlug, i18n, payload, schemaMap } = args\n\n const clientSchemaMap: ClientFieldSchemaMap = new Map()\n\n if (collectionSlug) {\n const matchedCollection = config.collections.find(\n (collection) => collection.slug === collectionSlug,\n )\n\n if (matchedCollection) {\n if (matchedCollection.auth && !matchedCollection.auth.disableLocalStrategy) {\n // register schema with auth schemaPath\n ;(baseAuthFields[0] as TextFieldClient).label = i18n.t('general:password')\n ;(baseAuthFields[1] as TextFieldClient).label = i18n.t('authentication:confirmPassword')\n\n clientSchemaMap.set(`_${matchedCollection.slug}.auth`, {\n fields: [...baseAuthFields, ...matchedCollection.fields],\n })\n }\n\n clientSchemaMap.set(collectionSlug, {\n fields: matchedCollection.fields,\n })\n\n traverseFields({\n clientSchemaMap,\n config,\n fields: matchedCollection.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: collectionSlug,\n payload,\n schemaMap,\n })\n }\n } else if (globalSlug) {\n const matchedGlobal = config.globals.find((global) => global.slug === globalSlug)\n\n if (matchedGlobal) {\n clientSchemaMap.set(globalSlug, {\n fields: matchedGlobal.fields,\n })\n\n traverseFields({\n clientSchemaMap,\n config,\n fields: matchedGlobal.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: globalSlug,\n payload,\n schemaMap,\n })\n }\n }\n\n return { clientFieldSchemaMap: clientSchemaMap }\n}\n"],"mappings":"AAUA,SAASA,cAAc,QAAQ;AAE/B,MAAMC,cAAA,GAAgC,CACpC;EACEC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;AACZ,GACA;EACEF,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;AACZ,EACD;AAED;;;AAGA,OAAO,MAAMC,yBAAA,GAA6BC,IAAA;EAQxC,MAAM;IAAEC,cAAc;IAAEC,MAAM;IAAEC,UAAU;IAAEC,IAAI;IAAEC,OAAO;IAAEC;EAAS,CAAE,GAAGN,IAAA;EAEzE,MAAMO,eAAA,GAAwC,IAAIC,GAAA;EAElD,IAAIP,cAAA,EAAgB;IAClB,MAAMQ,iBAAA,GAAoBP,MAAA,CAAOQ,WAAW,CAACC,IAAI,CAC9CC,UAAA,IAAeA,UAAA,CAAWC,IAAI,KAAKZ,cAAA;IAGtC,IAAIQ,iBAAA,EAAmB;MACrB,IAAIA,iBAAA,CAAkBK,IAAI,IAAI,CAACL,iBAAA,CAAkBK,IAAI,CAACC,oBAAoB,EAAE;QAC1E;;QACEpB,cAAc,CAAC,EAAE,CAAqBqB,KAAK,GAAGZ,IAAA,CAAKa,CAAC,CAAC;QACrDtB,cAAc,CAAC,EAAE,CAAqBqB,KAAK,GAAGZ,IAAA,CAAKa,CAAC,CAAC;QAEvDV,eAAA,CAAgBW,GAAG,CAAC,IAAIT,iBAAA,CAAkBI,IAAI,OAAO,EAAE;UACrDM,MAAA,EAAQ,C,GAAIxB,cAAA,E,GAAmBc,iBAAA,CAAkBU,MAAM;QACzD;MACF;MAEAZ,eAAA,CAAgBW,GAAG,CAACjB,cAAA,EAAgB;QAClCkB,MAAA,EAAQV,iBAAA,CAAkBU;MAC5B;MAEAzB,cAAA,CAAe;QACba,eAAA;QACAL,MAAA;QACAiB,MAAA,EAAQV,iBAAA,CAAkBU,MAAM;QAChCf,IAAA;QACAgB,eAAA,EAAiB;QACjBC,gBAAA,EAAkBpB,cAAA;QAClBI,OAAA;QACAC;MACF;IACF;EACF,OAAO,IAAIH,UAAA,EAAY;IACrB,MAAMmB,aAAA,GAAgBpB,MAAA,CAAOqB,OAAO,CAACZ,IAAI,CAAEa,MAAA,IAAWA,MAAA,CAAOX,IAAI,KAAKV,UAAA;IAEtE,IAAImB,aAAA,EAAe;MACjBf,eAAA,CAAgBW,GAAG,CAACf,UAAA,EAAY;QAC9BgB,MAAA,EAAQG,aAAA,CAAcH;MACxB;MAEAzB,cAAA,CAAe;QACba,eAAA;QACAL,MAAA;QACAiB,MAAA,EAAQG,aAAA,CAAcH,MAAM;QAC5Bf,IAAA;QACAgB,eAAA,EAAiB;QACjBC,gBAAA,EAAkBlB,UAAA;QAClBE,OAAA;QACAC;MACF;IACF;EACF;EAEA,OAAO;IAAEmB,oBAAA,EAAsBlB;EAAgB;AACjD","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["traverseFields","baseAuthFields","name","type","required","buildClientFieldSchemaMap","args","collectionSlug","config","globalSlug","i18n","payload","schemaMap","clientSchemaMap","Map","matchedCollection","collections","find","collection","slug","fieldsToSet","fields","auth","disableLocalStrategy","label","t","concat","set","parentIndexPath","parentSchemaPath","matchedGlobal","globals","global","clientFieldSchemaMap"],"sources":["../../../src/utilities/buildClientFieldSchemaMap/index.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type {\n ClientConfig,\n ClientField,\n ClientFieldSchemaMap,\n FieldSchemaMap,\n Payload,\n TextFieldClient,\n} from 'payload'\n\nimport { traverseFields } from './traverseFields.js'\n\nconst baseAuthFields: ClientField[] = [\n {\n name: 'password',\n type: 'text',\n required: true,\n },\n {\n name: 'confirm-password',\n type: 'text',\n required: true,\n },\n]\n\n/**\n * Flattens the config fields into a map of field schemas\n */\nexport const buildClientFieldSchemaMap = (args: {\n collectionSlug?: string\n config: ClientConfig\n globalSlug?: string\n i18n: I18n\n payload: Payload\n schemaMap: FieldSchemaMap\n}): { clientFieldSchemaMap: ClientFieldSchemaMap } => {\n const { collectionSlug, config, globalSlug, i18n, payload, schemaMap } = args\n\n const clientSchemaMap: ClientFieldSchemaMap = new Map()\n\n if (collectionSlug) {\n const matchedCollection = config.collections.find(\n (collection) => collection.slug === collectionSlug,\n )\n\n if (matchedCollection) {\n let fieldsToSet = matchedCollection?.fields || []\n\n if (matchedCollection.auth && !matchedCollection.auth.disableLocalStrategy) {\n ;(baseAuthFields[0] as TextFieldClient).label = i18n.t('general:password')\n ;(baseAuthFields[1] as TextFieldClient).label = i18n.t('authentication:confirmPassword')\n fieldsToSet = baseAuthFields.concat(fieldsToSet)\n }\n\n clientSchemaMap.set(collectionSlug, {\n fields: fieldsToSet,\n })\n\n traverseFields({\n clientSchemaMap,\n config,\n fields: fieldsToSet,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: collectionSlug,\n payload,\n schemaMap,\n })\n }\n } else if (globalSlug) {\n const matchedGlobal = config.globals.find((global) => global.slug === globalSlug)\n\n if (matchedGlobal) {\n clientSchemaMap.set(globalSlug, {\n fields: matchedGlobal.fields,\n })\n\n traverseFields({\n clientSchemaMap,\n config,\n fields: matchedGlobal.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: globalSlug,\n payload,\n schemaMap,\n })\n }\n }\n\n return { clientFieldSchemaMap: clientSchemaMap }\n}\n"],"mappings":"AAUA,SAASA,cAAc,QAAQ;AAE/B,MAAMC,cAAA,GAAgC,CACpC;EACEC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;AACZ,GACA;EACEF,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;AACZ,EACD;AAED;;;AAGA,OAAO,MAAMC,yBAAA,GAA6BC,IAAA;EAQxC,MAAM;IAAEC,cAAc;IAAEC,MAAM;IAAEC,UAAU;IAAEC,IAAI;IAAEC,OAAO;IAAEC;EAAS,CAAE,GAAGN,IAAA;EAEzE,MAAMO,eAAA,GAAwC,IAAIC,GAAA;EAElD,IAAIP,cAAA,EAAgB;IAClB,MAAMQ,iBAAA,GAAoBP,MAAA,CAAOQ,WAAW,CAACC,IAAI,CAC9CC,UAAA,IAAeA,UAAA,CAAWC,IAAI,KAAKZ,cAAA;IAGtC,IAAIQ,iBAAA,EAAmB;MACrB,IAAIK,WAAA,GAAcL,iBAAA,EAAmBM,MAAA,IAAU,EAAE;MAEjD,IAAIN,iBAAA,CAAkBO,IAAI,IAAI,CAACP,iBAAA,CAAkBO,IAAI,CAACC,oBAAoB,EAAE;;QACxEtB,cAAc,CAAC,EAAE,CAAqBuB,KAAK,GAAGd,IAAA,CAAKe,CAAC,CAAC;QACrDxB,cAAc,CAAC,EAAE,CAAqBuB,KAAK,GAAGd,IAAA,CAAKe,CAAC,CAAC;QACvDL,WAAA,GAAcnB,cAAA,CAAeyB,MAAM,CAACN,WAAA;MACtC;MAEAP,eAAA,CAAgBc,GAAG,CAACpB,cAAA,EAAgB;QAClCc,MAAA,EAAQD;MACV;MAEApB,cAAA,CAAe;QACba,eAAA;QACAL,MAAA;QACAa,MAAA,EAAQD,WAAA;QACRV,IAAA;QACAkB,eAAA,EAAiB;QACjBC,gBAAA,EAAkBtB,cAAA;QAClBI,OAAA;QACAC;MACF;IACF;EACF,OAAO,IAAIH,UAAA,EAAY;IACrB,MAAMqB,aAAA,GAAgBtB,MAAA,CAAOuB,OAAO,CAACd,IAAI,CAAEe,MAAA,IAAWA,MAAA,CAAOb,IAAI,KAAKV,UAAA;IAEtE,IAAIqB,aAAA,EAAe;MACjBjB,eAAA,CAAgBc,GAAG,CAAClB,UAAA,EAAY;QAC9BY,MAAA,EAAQS,aAAA,CAAcT;MACxB;MAEArB,cAAA,CAAe;QACba,eAAA;QACAL,MAAA;QACAa,MAAA,EAAQS,aAAA,CAAcT,MAAM;QAC5BX,IAAA;QACAkB,eAAA,EAAiB;QACjBC,gBAAA,EAAkBpB,UAAA;QAClBE,OAAA;QACAC;MACF;IACF;EACF;EAEA,OAAO;IAAEqB,oBAAA,EAAsBpB;EAAgB;AACjD","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/buildFieldSchemaMap/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAS,cAAc,EAAE,eAAe,EAAa,MAAM,SAAS,CAAA;AAqBhF;;GAEG;AACH,eAAO,MAAM,mBAAmB,SAAU;IACxC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,eAAe,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,IAAI,CAAA;CACX,KAAG;IAAE,cAAc,EAAE,cAAc,CAAA;CAsDnC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/buildFieldSchemaMap/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAS,cAAc,EAAE,eAAe,EAAa,MAAM,SAAS,CAAA;AAqBhF;;GAEG;AACH,eAAO,MAAM,mBAAmB,SAAU;IACxC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,eAAe,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,IAAI,CAAA;CACX,KAAG;IAAE,cAAc,EAAE,cAAc,CAAA;CAoDnC,CAAA"}
@@ -25,21 +25,19 @@ export const buildFieldSchemaMap = args => {
25
25
  if (collectionSlug) {
26
26
  const matchedCollection = config.collections.find(collection => collection.slug === collectionSlug);
27
27
  if (matchedCollection) {
28
+ let fieldsToSet = matchedCollection?.fields || [];
28
29
  if (matchedCollection.auth && !matchedCollection.auth.disableLocalStrategy) {
29
- // register schema with auth schemaPath
30
30
  ;
31
31
  baseAuthFields[0].label = i18n.t('general:password');
32
32
  baseAuthFields[1].label = i18n.t('authentication:confirmPassword');
33
- schemaMap.set(`_${matchedCollection.slug}.auth`, {
34
- fields: [...baseAuthFields, ...matchedCollection.fields]
35
- });
33
+ fieldsToSet = baseAuthFields.concat(fieldsToSet);
36
34
  }
37
35
  schemaMap.set(collectionSlug, {
38
- fields: matchedCollection.fields
36
+ fields: fieldsToSet
39
37
  });
40
38
  traverseFields({
41
39
  config,
42
- fields: matchedCollection.fields,
40
+ fields: fieldsToSet,
43
41
  i18n,
44
42
  parentIndexPath: '',
45
43
  parentSchemaPath: collectionSlug,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["confirmPassword","password","traverseFields","baseAuthFields","name","type","required","validate","buildFieldSchemaMap","args","collectionSlug","config","globalSlug","i18n","schemaMap","Map","matchedCollection","collections","find","collection","slug","auth","disableLocalStrategy","label","t","set","fields","parentIndexPath","parentSchemaPath","matchedGlobal","globals","global","fieldSchemaMap"],"sources":["../../../src/utilities/buildFieldSchemaMap/index.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { Field, FieldSchemaMap, SanitizedConfig, TextField } from 'payload'\n\nimport { confirmPassword, password } from 'payload/shared'\n\nimport { traverseFields } from './traverseFields.js'\n\nconst baseAuthFields: Field[] = [\n {\n name: 'password',\n type: 'text',\n required: true,\n validate: password,\n },\n {\n name: 'confirm-password',\n type: 'text',\n required: true,\n validate: confirmPassword,\n },\n]\n\n/**\n * Flattens the config fields into a map of field schemas\n */\nexport const buildFieldSchemaMap = (args: {\n collectionSlug?: string\n config: SanitizedConfig\n globalSlug?: string\n i18n: I18n\n}): { fieldSchemaMap: FieldSchemaMap } => {\n const { collectionSlug, config, globalSlug, i18n } = args\n\n const schemaMap: FieldSchemaMap = new Map()\n\n if (collectionSlug) {\n const matchedCollection = config.collections.find(\n (collection) => collection.slug === collectionSlug,\n )\n\n if (matchedCollection) {\n if (matchedCollection.auth && !matchedCollection.auth.disableLocalStrategy) {\n // register schema with auth schemaPath\n ;(baseAuthFields[0] as TextField).label = i18n.t('general:password')\n ;(baseAuthFields[1] as TextField).label = i18n.t('authentication:confirmPassword')\n\n schemaMap.set(`_${matchedCollection.slug}.auth`, {\n fields: [...baseAuthFields, ...matchedCollection.fields],\n })\n }\n\n schemaMap.set(collectionSlug, {\n fields: matchedCollection.fields,\n })\n\n traverseFields({\n config,\n fields: matchedCollection.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: collectionSlug,\n schemaMap,\n })\n }\n } else if (globalSlug) {\n const matchedGlobal = config.globals.find((global) => global.slug === globalSlug)\n\n if (matchedGlobal) {\n schemaMap.set(globalSlug, {\n fields: matchedGlobal.fields,\n })\n\n traverseFields({\n config,\n fields: matchedGlobal.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: globalSlug,\n schemaMap,\n })\n }\n }\n\n return { fieldSchemaMap: schemaMap }\n}\n"],"mappings":"AAGA,SAASA,eAAe,EAAEC,QAAQ,QAAQ;AAE1C,SAASC,cAAc,QAAQ;AAE/B,MAAMC,cAAA,GAA0B,CAC9B;EACEC,IA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,CAACZ,IAAI,CAAEa,MAAA,IAAWA,MAAA,CAAOX,IAAI,KAAKR,UAAA;IAEtE,IAAIiB,aAAA,EAAe;MACjBf,SAAA,CAAUW,GAAG,CAACb,UAAA,EAAY;QACxBc,MAAA,EAAQG,aAAA,CAAcH;MACxB;MAEAxB,cAAA,CAAe;QACbS,MAAA;QACAe,MAAA,EAAQG,aAAA,CAAcH,MAAM;QAC5Bb,IAAA;QACAc,eAAA,EAAiB;QACjBC,gBAAA,EAAkBhB,UAAA;QAClBE;MACF;IACF;EACF;EAEA,OAAO;IAAEkB,cAAA,EAAgBlB;EAAU;AACrC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["confirmPassword","password","traverseFields","baseAuthFields","name","type","required","validate","buildFieldSchemaMap","args","collectionSlug","config","globalSlug","i18n","schemaMap","Map","matchedCollection","collections","find","collection","slug","fieldsToSet","fields","auth","disableLocalStrategy","label","t","concat","set","parentIndexPath","parentSchemaPath","matchedGlobal","globals","global","fieldSchemaMap"],"sources":["../../../src/utilities/buildFieldSchemaMap/index.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { Field, FieldSchemaMap, SanitizedConfig, TextField } from 'payload'\n\nimport { confirmPassword, password } from 'payload/shared'\n\nimport { traverseFields } from './traverseFields.js'\n\nconst baseAuthFields: Field[] = [\n {\n name: 'password',\n type: 'text',\n required: true,\n validate: password,\n },\n {\n name: 'confirm-password',\n type: 'text',\n required: true,\n validate: confirmPassword,\n },\n]\n\n/**\n * Flattens the config fields into a map of field schemas\n */\nexport const buildFieldSchemaMap = (args: {\n collectionSlug?: string\n config: SanitizedConfig\n globalSlug?: string\n i18n: I18n\n}): { fieldSchemaMap: FieldSchemaMap } => {\n const { collectionSlug, config, globalSlug, i18n } = args\n\n const schemaMap: FieldSchemaMap = new Map()\n\n if (collectionSlug) {\n const matchedCollection = config.collections.find(\n (collection) => collection.slug === collectionSlug,\n )\n\n if (matchedCollection) {\n let fieldsToSet = matchedCollection?.fields || []\n\n if (matchedCollection.auth && !matchedCollection.auth.disableLocalStrategy) {\n ;(baseAuthFields[0] as TextField).label = i18n.t('general:password')\n ;(baseAuthFields[1] as TextField).label = i18n.t('authentication:confirmPassword')\n fieldsToSet = baseAuthFields.concat(fieldsToSet)\n }\n\n schemaMap.set(collectionSlug, {\n fields: fieldsToSet,\n })\n\n traverseFields({\n config,\n fields: fieldsToSet,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: collectionSlug,\n schemaMap,\n })\n }\n } else if (globalSlug) {\n const matchedGlobal = config.globals.find((global) => global.slug === globalSlug)\n\n if (matchedGlobal) {\n schemaMap.set(globalSlug, {\n fields: matchedGlobal.fields,\n })\n\n traverseFields({\n config,\n fields: matchedGlobal.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: globalSlug,\n schemaMap,\n })\n }\n }\n\n return { fieldSchemaMap: schemaMap }\n}\n"],"mappings":"AAGA,SAASA,eAAe,EAAEC,QAAQ,QAAQ;AAE1C,SAASC,cAAc,QAAQ;AAE/B,MAAMC,cAAA,GAA0B,CAC9B;EACEC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;EACVC,QAAA,EAAUN;AACZ,GACA;EACEG,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;EACVC,QAAA,EAAUP;AACZ,EACD;AAED;;;AAGA,OAAO,MAAMQ,mBAAA,GAAuBC,IAAA;EAMlC,MAAM;IAAEC,cAAc;IAAEC,MAAM;IAAEC,UAAU;IAAEC;EAAI,CAAE,GAAGJ,IAAA;EAErD,MAAMK,SAAA,GAA4B,IAAIC,GAAA;EAEtC,IAAIL,cAAA,EAAgB;IAClB,MAAMM,iBAAA,GAAoBL,MAAA,CAAOM,WAAW,CAACC,IAAI,CAC9CC,UAAA,IAAeA,UAAA,CAAWC,IAAI,KAAKV,cAAA;IAGtC,IAAIM,iBAAA,EAAmB;MACrB,IAAIK,WAAA,GAAcL,iBAAA,EAAmBM,MAAA,IAAU,EAAE;MAEjD,IAAIN,iBAAA,CAAkBO,IAAI,IAAI,CAACP,iBAAA,CAAkBO,IAAI,CAACC,oBAAoB,EAAE;;QACxErB,cAAc,CAAC,EAAE,CAAesB,KAAK,GAAGZ,IAAA,CAAKa,CAAC,CAAC;QAC/CvB,cAAc,CAAC,EAAE,CAAesB,KAAK,GAAGZ,IAAA,CAAKa,CAAC,CAAC;QACjDL,WAAA,GAAclB,cAAA,CAAewB,MAAM,CAACN,WAAA;MACtC;MAEAP,SAAA,CAAUc,GAAG,CAAClB,cAAA,EAAgB;QAC5BY,MAAA,EAAQD;MACV;MAEAnB,cAAA,CAAe;QACbS,MAAA;QACAW,MAAA,EAAQD,WAAA;QACRR,IAAA;QACAgB,eAAA,EAAiB;QACjBC,gBAAA,EAAkBpB,cAAA;QAClBI;MACF;IACF;EACF,OAAO,IAAIF,UAAA,EAAY;IACrB,MAAMmB,aAAA,GAAgBpB,MAAA,CAAOqB,OAAO,CAACd,IAAI,CAAEe,MAAA,IAAWA,MAAA,CAAOb,IAAI,KAAKR,UAAA;IAEtE,IAAImB,aAAA,EAAe;MACjBjB,SAAA,CAAUc,GAAG,CAAChB,UAAA,EAAY;QACxBU,MAAA,EAAQS,aAAA,CAAcT;MACxB;MAEApB,cAAA,CAAe;QACbS,MAAA;QACAW,MAAA,EAAQS,aAAA,CAAcT,MAAM;QAC5BT,IAAA;QACAgB,eAAA,EAAiB;QACjBC,gBAAA,EAAkBlB,UAAA;QAClBE;MACF;IACF;EACF;EAEA,OAAO;IAAEoB,cAAA,EAAgBpB;EAAU;AACrC","ignoreList":[]}
@@ -3,7 +3,7 @@ export type SchedulePublishHandlerArgs = {
3
3
  date: Date;
4
4
  req: PayloadRequest;
5
5
  } & SchedulePublishTaskInput;
6
- export declare const schedulePublishHandler: ({ type, date, doc, global, locale, req: { i18n, payload }, }: SchedulePublishHandlerArgs) => Promise<{
6
+ export declare const schedulePublishHandler: ({ type, date, doc, global, locale, req, }: SchedulePublishHandlerArgs) => Promise<{
7
7
  error: string;
8
8
  message?: undefined;
9
9
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"schedulePublishHandler.d.ts","sourceRoot":"","sources":["../../src/utilities/schedulePublishHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAEvE,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,IAAI,CAAA;IACV,GAAG,EAAE,cAAc,CAAA;CACpB,GAAG,wBAAwB,CAAA;AAE5B,eAAO,MAAM,sBAAsB,iEAOhC,0BAA0B;;;;;;EA4B5B,CAAA"}
1
+ {"version":3,"file":"schedulePublishHandler.d.ts","sourceRoot":"","sources":["../../src/utilities/schedulePublishHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAEvE,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,IAAI,CAAA;IACV,GAAG,EAAE,cAAc,CAAA;CACpB,GAAG,wBAAwB,CAAA;AAE5B,eAAO,MAAM,sBAAsB,8CAOhC,0BAA0B;;;;;;EAqD5B,CAAA"}
@@ -4,18 +4,39 @@ export const schedulePublishHandler = async ({
4
4
  doc,
5
5
  global,
6
6
  locale,
7
- req: {
7
+ req
8
+ }) => {
9
+ const {
8
10
  i18n,
9
- payload
11
+ payload,
12
+ user
13
+ } = req;
14
+ const incomingUserSlug = user?.collection;
15
+ const adminUserSlug = payload.config.admin.user;
16
+ if (!incomingUserSlug) {
17
+ throw new Error('Unauthorized');
18
+ }
19
+ const adminAccessFunction = payload.collections[incomingUserSlug].config.access?.admin;
20
+ // Run the admin access function from the config if it exists
21
+ if (adminAccessFunction) {
22
+ const canAccessAdmin = await adminAccessFunction({
23
+ req
24
+ });
25
+ if (!canAccessAdmin) {
26
+ throw new Error('Unauthorized');
27
+ }
28
+ // Match the user collection to the global admin config
29
+ } else if (adminUserSlug !== incomingUserSlug) {
30
+ throw new Error('Unauthorized');
10
31
  }
11
- }) => {
12
32
  try {
13
33
  await payload.jobs.queue({
14
34
  input: {
15
35
  type,
16
36
  doc,
17
37
  global,
18
- locale
38
+ locale,
39
+ user: user.id
19
40
  },
20
41
  task: 'schedulePublish',
21
42
  waitUntil: date
@@ -1 +1 @@
1
- {"version":3,"file":"schedulePublishHandler.js","names":["schedulePublishHandler","type","date","doc","global","locale","req","i18n","payload","jobs","queue","input","task","waitUntil","err","error","value","relationTo","logger","message","t"],"sources":["../../src/utilities/schedulePublishHandler.ts"],"sourcesContent":["import type { PayloadRequest, SchedulePublishTaskInput } from 'payload'\n\nexport type SchedulePublishHandlerArgs = {\n date: Date\n req: PayloadRequest\n} & SchedulePublishTaskInput\n\nexport const schedulePublishHandler = async ({\n type,\n date,\n doc,\n global,\n locale,\n req: { i18n, payload },\n}: SchedulePublishHandlerArgs) => {\n try {\n await payload.jobs.queue({\n input: {\n type,\n doc,\n global,\n locale,\n },\n task: 'schedulePublish',\n waitUntil: date,\n })\n } catch (err) {\n let error = `Error scheduling ${type} for `\n\n if (doc) {\n error += `document with ID ${doc.value} in collection ${doc.relationTo}`\n }\n\n payload.logger.error(error)\n payload.logger.error(err)\n\n return {\n error,\n }\n }\n\n return { message: i18n.t('general:success') }\n}\n"],"mappings":"AAOA,OAAO,MAAMA,sBAAA,GAAyB,MAAAA,CAAO;EAC3CC,IAAI;EACJC,IAAI;EACJC,GAAG;EACHC,MAAM;EACNC,MAAM;EACNC,GAAA,EAAK;IAAEC,IAAI;IAAEC;EAAO;AAAE,CACK;EAC3B,IAAI;IACF,MAAMA,OAAA,CAAQC,IAAI,CAACC,KAAK,CAAC;MACvBC,KAAA,EAAO;QACLV,IAAA;QACAE,GAAA;QACAC,MAAA;QACAC;MACF;MACAO,IAAA,EAAM;MACNC,SAAA,EAAWX;IACb;EACF,EAAE,OAAOY,GAAA,EAAK;IACZ,IAAIC,KAAA,GAAQ,oBAAoBd,IAAA,OAAW;IAE3C,IAAIE,GAAA,EAAK;MACPY,KAAA,IAAS,oBAAoBZ,GAAA,CAAIa,KAAK,kBAAkBb,GAAA,CAAIc,UAAU,EAAE;IAC1E;IAEAT,OAAA,CAAQU,MAAM,CAACH,KAAK,CAACA,KAAA;IACrBP,OAAA,CAAQU,MAAM,CAACH,KAAK,CAACD,GAAA;IAErB,OAAO;MACLC;IACF;EACF;EAEA,OAAO;IAAEI,OAAA,EAASZ,IAAA,CAAKa,CAAC,CAAC;EAAmB;AAC9C","ignoreList":[]}
1
+ {"version":3,"file":"schedulePublishHandler.js","names":["schedulePublishHandler","type","date","doc","global","locale","req","i18n","payload","user","incomingUserSlug","collection","adminUserSlug","config","admin","Error","adminAccessFunction","collections","access","canAccessAdmin","jobs","queue","input","id","task","waitUntil","err","error","value","relationTo","logger","message","t"],"sources":["../../src/utilities/schedulePublishHandler.ts"],"sourcesContent":["import type { PayloadRequest, SchedulePublishTaskInput } from 'payload'\n\nexport type SchedulePublishHandlerArgs = {\n date: Date\n req: PayloadRequest\n} & SchedulePublishTaskInput\n\nexport const schedulePublishHandler = async ({\n type,\n date,\n doc,\n global,\n locale,\n req,\n}: SchedulePublishHandlerArgs) => {\n const { i18n, payload, user } = req\n\n const incomingUserSlug = user?.collection\n\n const adminUserSlug = payload.config.admin.user\n\n if (!incomingUserSlug) {\n throw new Error('Unauthorized')\n }\n\n const adminAccessFunction = payload.collections[incomingUserSlug].config.access?.admin\n\n // Run the admin access function from the config if it exists\n if (adminAccessFunction) {\n const canAccessAdmin = await adminAccessFunction({ req })\n\n if (!canAccessAdmin) {\n throw new Error('Unauthorized')\n }\n // Match the user collection to the global admin config\n } else if (adminUserSlug !== incomingUserSlug) {\n throw new Error('Unauthorized')\n }\n\n try {\n await payload.jobs.queue({\n input: {\n type,\n doc,\n global,\n locale,\n user: user.id,\n },\n task: 'schedulePublish',\n waitUntil: date,\n })\n } catch (err) {\n let error = `Error scheduling ${type} for `\n\n if (doc) {\n error += `document with ID ${doc.value} in collection ${doc.relationTo}`\n }\n\n payload.logger.error(error)\n payload.logger.error(err)\n\n return {\n error,\n }\n }\n\n return { message: i18n.t('general:success') }\n}\n"],"mappings":"AAOA,OAAO,MAAMA,sBAAA,GAAyB,MAAAA,CAAO;EAC3CC,IAAI;EACJC,IAAI;EACJC,GAAG;EACHC,MAAM;EACNC,MAAM;EACNC;AAAG,CACwB;EAC3B,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC;EAAI,CAAE,GAAGH,GAAA;EAEhC,MAAMI,gBAAA,GAAmBD,IAAA,EAAME,UAAA;EAE/B,MAAMC,aAAA,GAAgBJ,OAAA,CAAQK,MAAM,CAACC,KAAK,CAACL,IAAI;EAE/C,IAAI,CAACC,gBAAA,EAAkB;IACrB,MAAM,IAAIK,KAAA,CAAM;EAClB;EAEA,MAAMC,mBAAA,GAAsBR,OAAA,CAAQS,WAAW,CAACP,gBAAA,CAAiB,CAACG,MAAM,CAACK,MAAM,EAAEJ,KAAA;EAEjF;EACA,IAAIE,mBAAA,EAAqB;IACvB,MAAMG,cAAA,GAAiB,MAAMH,mBAAA,CAAoB;MAAEV;IAAI;IAEvD,IAAI,CAACa,cAAA,EAAgB;MACnB,MAAM,IAAIJ,KAAA,CAAM;IAClB;IACA;EACF,OAAO,IAAIH,aAAA,KAAkBF,gBAAA,EAAkB;IAC7C,MAAM,IAAIK,KAAA,CAAM;EAClB;EAEA,IAAI;IACF,MAAMP,OAAA,CAAQY,IAAI,CAACC,KAAK,CAAC;MACvBC,KAAA,EAAO;QACLrB,IAAA;QACAE,GAAA;QACAC,MAAA;QACAC,MAAA;QACAI,IAAA,EAAMA,IAAA,CAAKc;MACb;MACAC,IAAA,EAAM;MACNC,SAAA,EAAWvB;IACb;EACF,EAAE,OAAOwB,GAAA,EAAK;IACZ,IAAIC,KAAA,GAAQ,oBAAoB1B,IAAA,OAAW;IAE3C,IAAIE,GAAA,EAAK;MACPwB,KAAA,IAAS,oBAAoBxB,GAAA,CAAIyB,KAAK,kBAAkBzB,GAAA,CAAI0B,UAAU,EAAE;IAC1E;IAEArB,OAAA,CAAQsB,MAAM,CAACH,KAAK,CAACA,KAAA;IACrBnB,OAAA,CAAQsB,MAAM,CAACH,KAAK,CAACD,GAAA;IAErB,OAAO;MACLC;IACF;EACF;EAEA,OAAO;IAAEI,OAAA,EAASxB,IAAA,CAAKyB,CAAC,CAAC;EAAmB;AAC9C","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Edit/Auth/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAGxE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAavC,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAuNhC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Edit/Auth/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAGxE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAavC,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAiNhC,CAAA"}