@payloadcms/ui 3.89.0-internal.95c9cba → 3.90.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.
- package/dist/elements/BulkUpload/FormsManager/createFormData.d.ts +1 -1
- package/dist/elements/BulkUpload/FormsManager/createFormData.d.ts.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/createFormData.js +7 -3
- package/dist/elements/BulkUpload/FormsManager/createFormData.js.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.js +4 -2
- package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.d.ts +13 -0
- package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.d.ts.map +1 -0
- package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.js +41 -0
- package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.js.map +1 -0
- package/dist/elements/PublishButton/ScheduleDrawer/index.d.ts.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/index.js +8 -54
- package/dist/elements/PublishButton/ScheduleDrawer/index.js.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/types.js.map +1 -1
- package/dist/elements/Spinner/index.d.ts +19 -0
- package/dist/elements/Spinner/index.d.ts.map +1 -0
- package/dist/elements/Spinner/index.js +51 -0
- package/dist/elements/Spinner/index.js.map +1 -0
- package/dist/elements/Spinner/index.scss +23 -0
- package/dist/exports/client/index.d.ts +4 -1
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +24 -24
- package/dist/exports/client/index.js.map +4 -4
- package/dist/fields/Tabs/index.d.ts.map +1 -1
- package/dist/fields/Tabs/index.js +109 -234
- package/dist/fields/Tabs/index.js.map +1 -1
- package/dist/fields/Tabs/resolveRestoredTabIndex.d.ts +19 -0
- package/dist/fields/Tabs/resolveRestoredTabIndex.d.ts.map +1 -0
- package/dist/fields/Tabs/resolveRestoredTabIndex.js +20 -0
- package/dist/fields/Tabs/resolveRestoredTabIndex.js.map +1 -0
- package/dist/fields/Tabs/resolveRestoredTabIndex.spec.js +53 -0
- package/dist/fields/Tabs/resolveRestoredTabIndex.spec.js.map +1 -0
- package/dist/forms/Form/index.d.ts.map +1 -1
- package/dist/forms/Form/index.js +6 -2
- package/dist/forms/Form/index.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/renderField.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/renderField.js +3 -2
- package/dist/forms/fieldSchemasToFormState/renderField.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts +12 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts.map +1 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js +32 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js.map +1 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts +8 -6
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js +25 -9
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.spec.js +179 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.spec.js.map +1 -0
- package/dist/forms/fieldSchemasToFormState/types.d.ts +1 -0
- package/dist/forms/fieldSchemasToFormState/types.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/types.js.map +1 -1
- package/dist/icons/Eye/index.scss +1 -1
- package/dist/icons/Refresh/index.d.ts +7 -0
- package/dist/icons/Refresh/index.d.ts.map +1 -0
- package/dist/icons/Refresh/index.js +35 -0
- package/dist/icons/Refresh/index.js.map +1 -0
- package/dist/icons/Refresh/index.scss +11 -0
- package/dist/icons/Spinner/index.d.ts +8 -0
- package/dist/icons/Spinner/index.d.ts.map +1 -0
- package/dist/icons/Spinner/index.js +34 -0
- package/dist/icons/Spinner/index.js.map +1 -0
- package/dist/icons/Spinner/index.scss +12 -0
- package/dist/providers/LivePreview/index.d.ts.map +1 -1
- package/dist/providers/LivePreview/index.js +13 -6
- package/dist/providers/LivePreview/index.js.map +1 -1
- package/dist/providers/ServerFunctions/index.d.ts +5 -1
- package/dist/providers/ServerFunctions/index.d.ts.map +1 -1
- package/dist/providers/ServerFunctions/index.js +15 -0
- package/dist/providers/ServerFunctions/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utilities/buildFormState.d.ts.map +1 -1
- package/dist/utilities/buildFormState.js +6 -2
- package/dist/utilities/buildFormState.js.map +1 -1
- package/dist/utilities/formatAbsoluteURL.d.ts +1 -1
- package/dist/utilities/formatAbsoluteURL.d.ts.map +1 -1
- package/dist/utilities/formatAbsoluteURL.js +18 -8
- package/dist/utilities/formatAbsoluteURL.js.map +1 -1
- package/dist/utilities/formatAbsoluteURL.spec.js +27 -0
- package/dist/utilities/formatAbsoluteURL.spec.js.map +1 -0
- package/dist/utilities/isAbsoluteURL.d.ts +3 -0
- package/dist/utilities/isAbsoluteURL.d.ts.map +1 -0
- package/dist/utilities/isAbsoluteURL.js +15 -0
- package/dist/utilities/isAbsoluteURL.js.map +1 -0
- package/dist/utilities/isAbsoluteURL.spec.js +11 -0
- package/dist/utilities/isAbsoluteURL.spec.js.map +1 -0
- package/dist/utilities/isHttpURL.d.ts +3 -0
- package/dist/utilities/isHttpURL.d.ts.map +1 -0
- package/dist/utilities/isHttpURL.js +12 -0
- package/dist/utilities/isHttpURL.js.map +1 -0
- package/dist/utilities/isHttpURL.spec.js +25 -0
- package/dist/utilities/isHttpURL.spec.js.map +1 -0
- package/dist/utilities/schedulePublishHandler.d.ts +8 -1
- package/dist/utilities/schedulePublishHandler.d.ts.map +1 -1
- package/dist/utilities/schedulePublishHandler.js +78 -5
- package/dist/utilities/schedulePublishHandler.js.map +1 -1
- package/dist/views/Edit/Auth/APIKey.d.ts +1 -1
- package/dist/views/Edit/Auth/APIKey.d.ts.map +1 -1
- package/dist/views/Edit/Auth/APIKey.js +216 -59
- package/dist/views/Edit/Auth/APIKey.js.map +1 -1
- package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts +11 -0
- package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts.map +1 -0
- package/dist/views/Edit/Auth/APIKeyGenerationModal.js +113 -0
- package/dist/views/Edit/Auth/APIKeyGenerationModal.js.map +1 -0
- package/dist/views/Edit/Auth/index.d.ts.map +1 -1
- package/dist/views/Edit/Auth/index.js +10 -30
- package/dist/views/Edit/Auth/index.js.map +1 -1
- package/dist/views/Edit/Auth/index.scss +73 -36
- package/dist/views/Edit/Auth/types.d.ts +1 -1
- package/dist/views/Edit/Auth/types.d.ts.map +1 -1
- package/dist/views/Edit/Auth/types.js.map +1 -1
- package/package.json +6 -5
- package/dist/elements/GenerateConfirmation/index.d.ts +0 -7
- package/dist/elements/GenerateConfirmation/index.d.ts.map +0 -1
- package/dist/elements/GenerateConfirmation/index.js +0 -95
- package/dist/elements/GenerateConfirmation/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildFormState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildFormState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,cAAc,EACf,MAAM,SAAS,CAAA;AAehB,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,gBAAgB,EAAE,MAAM,CAAA;IACxB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,KAAK,2BAA2B,GAAG;IACjC,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,GAAG,CACA;IACE,OAAO,EAAE,MAAM,CAAA;CAChB,GACD,WAAW,CACd,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,yBAAyB,GAAG,2BAA2B,CAAA;AAE1F,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAChD,kBAAkB,EAClB,OAAO,CAAC,oBAAoB,CAAC,CAwB9B,CAAA;AAED,eAAO,MAAM,cAAc,SACnB,kBAAkB,KACvB,OAAO,CAAC,2BAA2B,
|
|
1
|
+
{"version":3,"file":"buildFormState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildFormState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,cAAc,EACf,MAAM,SAAS,CAAA;AAehB,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,gBAAgB,EAAE,MAAM,CAAA;IACxB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,KAAK,2BAA2B,GAAG;IACjC,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,GAAG,CACA;IACE,OAAO,EAAE,MAAM,CAAA;CAChB,GACD,WAAW,CACd,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,yBAAyB,GAAG,2BAA2B,CAAA;AAE1F,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAChD,kBAAkB,EAClB,OAAO,CAAC,oBAAoB,CAAC,CAwB9B,CAAA;AAED,eAAO,MAAM,cAAc,SACnB,kBAAkB,KACvB,OAAO,CAAC,2BAA2B,CAuNrC,CAAA"}
|
|
@@ -69,7 +69,8 @@ export const buildFormState = async args => {
|
|
|
69
69
|
select,
|
|
70
70
|
skipClientConfigAuth,
|
|
71
71
|
skipValidation,
|
|
72
|
-
updateLastEdited
|
|
72
|
+
updateLastEdited,
|
|
73
|
+
user
|
|
73
74
|
} = args;
|
|
74
75
|
const selectMode = select ? getSelectMode(select) : undefined;
|
|
75
76
|
if (!collectionSlug && !globalSlug && !widgetSlug) {
|
|
@@ -148,7 +149,10 @@ export const buildFormState = async args => {
|
|
|
148
149
|
previousFormState: formState,
|
|
149
150
|
readOnly,
|
|
150
151
|
renderAllFields,
|
|
151
|
-
renderFieldFn: renderField
|
|
152
|
+
renderFieldFn: renderFieldArgs => renderField({
|
|
153
|
+
...renderFieldArgs,
|
|
154
|
+
user
|
|
155
|
+
}),
|
|
152
156
|
req,
|
|
153
157
|
schemaPath,
|
|
154
158
|
select,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildFormState.js","names":["canAccessAdmin","formatErrors","UnauthorizedError","getSelectMode","reduceFieldsToValues","fieldSchemasToFormState","renderField","getClientConfig","getClientSchemaMap","getSchemaMap","handleFormStateLocking","handleLivePreview","handlePreview","handleStaleDataCheck","buildFormStateHandler","args","req","res","buildFormState","err","payload","logger","error","msg","message","id","idFromArgs","checkForStaleData","collectionSlug","data","incomingData","docPermissions","docPreferences","documentFormState","formState","globalSlug","initialBlockData","initialBlockFormState","mockRSCs","operation","originalUpdatedAt","readOnly","renderAllFields","i18n","config","returnLivePreviewURL","returnLockStatus","returnPreviewURL","widgetSlug","schemaPath","select","skipClientConfigAuth","skipValidation","updateLastEdited","selectMode","undefined","Error","schemaMap","clientSchemaMap","importMap","user","fieldOrEntityConfig","get","fields","length","type","documentData","blockData","Array","isArray","formStateResult","clientFieldSchemaMap","fieldSchemaMap","permissions","preferences","previousFormState","renderFieldFn","collections","upload","file","lockedStateResult","staleDataStateResult","lockedState","staleDataState","state","livePreviewURL","previewURL"],"sources":["../../src/utilities/buildFormState.ts"],"sourcesContent":["import type {\n BuildFormStateArgs,\n ClientConfig,\n ClientUser,\n ErrorResult,\n FormState,\n ServerFunction,\n} from 'payload'\n\nimport { canAccessAdmin, formatErrors, UnauthorizedError } from 'payload'\nimport { getSelectMode, reduceFieldsToValues } from 'payload/shared'\n\nimport { fieldSchemasToFormState } from '../forms/fieldSchemasToFormState/index.js'\nimport { renderField } from '../forms/fieldSchemasToFormState/renderField.js'\nimport { getClientConfig } from './getClientConfig.js'\nimport { getClientSchemaMap } from './getClientSchemaMap.js'\nimport { getSchemaMap } from './getSchemaMap.js'\nimport { handleFormStateLocking } from './handleFormStateLocking.js'\nimport { handleLivePreview } from './handleLivePreview.js'\nimport { handlePreview } from './handlePreview.js'\nimport { handleStaleDataCheck } from './handleStaleDataCheck.js'\n\nexport type LockedState = {\n isLocked: boolean\n lastEditedAt: string\n user?: ClientUser | number | string\n}\n\nexport type StaleDataState = {\n currentUpdatedAt: string\n isStale: boolean\n}\n\ntype BuildFormStateSuccessResult = {\n clientConfig?: ClientConfig\n errors?: never\n indexPath?: string\n livePreviewURL?: string\n lockedState?: LockedState\n previewURL?: string\n staleDataState?: StaleDataState\n state: FormState\n}\n\ntype BuildFormStateErrorResult = {\n livePreviewURL?: never\n lockedState?: never\n previewURL?: never\n staleDataState?: never\n state?: never\n} & (\n | {\n message: string\n }\n | ErrorResult\n)\n\nexport type BuildFormStateResult = BuildFormStateErrorResult | BuildFormStateSuccessResult\n\nexport const buildFormStateHandler: ServerFunction<\n BuildFormStateArgs,\n Promise<BuildFormStateResult>\n> = async (args) => {\n const { req } = args\n\n try {\n await canAccessAdmin({ req })\n const res = await buildFormState(args)\n\n return res\n } catch (err) {\n req.payload.logger.error({ err, msg: `There was an error building form state` })\n\n if (err.message === 'Could not find field schema for given path') {\n return {\n message: err.message,\n }\n }\n\n if (err.message === 'Unauthorized') {\n throw new UnauthorizedError()\n }\n\n return formatErrors(err)\n }\n}\n\nexport const buildFormState = async (\n args: BuildFormStateArgs,\n): Promise<BuildFormStateSuccessResult> => {\n const {\n id: idFromArgs,\n checkForStaleData,\n collectionSlug,\n data: incomingData,\n docPermissions,\n docPreferences,\n documentFormState,\n formState,\n globalSlug,\n initialBlockData,\n initialBlockFormState,\n mockRSCs,\n operation,\n originalUpdatedAt,\n readOnly,\n renderAllFields,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n },\n returnLivePreviewURL,\n returnLockStatus,\n returnPreviewURL,\n widgetSlug,\n schemaPath = collectionSlug || globalSlug || widgetSlug,\n select,\n skipClientConfigAuth,\n skipValidation,\n updateLastEdited,\n } = args\n\n const selectMode = select ? getSelectMode(select) : undefined\n\n if (!collectionSlug && !globalSlug && !widgetSlug) {\n throw new Error('Either collectionSlug, globalSlug, or widgetSlug must be provided')\n }\n\n const schemaMap = getSchemaMap({\n collectionSlug,\n config,\n globalSlug,\n i18n,\n widgetSlug,\n })\n\n const clientSchemaMap = getClientSchemaMap({\n collectionSlug,\n config: getClientConfig({\n config,\n i18n,\n importMap: req.payload.importMap,\n user: skipClientConfigAuth ? true : req.user,\n }),\n globalSlug,\n i18n,\n payload,\n schemaMap,\n widgetSlug,\n })\n\n const id = collectionSlug ? idFromArgs : undefined\n const fieldOrEntityConfig = schemaMap.get(schemaPath)\n\n if (!fieldOrEntityConfig) {\n throw new Error(`Could not find \"${schemaPath}\" in the fieldSchemaMap`)\n }\n\n if (\n (!('fields' in fieldOrEntityConfig) ||\n !fieldOrEntityConfig.fields ||\n !fieldOrEntityConfig.fields.length) &&\n 'type' in fieldOrEntityConfig &&\n fieldOrEntityConfig.type !== 'blocks'\n ) {\n throw new Error(\n `The field found in fieldSchemaMap for \"${schemaPath}\" does not contain any subfields.`,\n )\n }\n\n // If there is form state but no data, deduce data from that form state, e.g. on initial load\n // Otherwise, use the incoming data as the source of truth, e.g. on subsequent saves\n const data = incomingData || reduceFieldsToValues(formState, true)\n\n let documentData = undefined\n\n if (documentFormState) {\n documentData = reduceFieldsToValues(documentFormState, true)\n }\n\n let blockData = initialBlockData\n\n if (initialBlockFormState) {\n blockData = reduceFieldsToValues(initialBlockFormState, true)\n }\n\n /**\n * When building state for sub schemas we need to adjust:\n * - `fields`\n * - `parentSchemaPath`\n * - `parentPath`\n *\n * Type assertion is fine because we wrap sub schemas in an array\n * so we can safely map over them within `fieldSchemasToFormState`\n */\n const fields = Array.isArray(fieldOrEntityConfig)\n ? fieldOrEntityConfig\n : 'fields' in fieldOrEntityConfig\n ? fieldOrEntityConfig.fields\n : [fieldOrEntityConfig]\n\n // Ensure data.id is present during form state requests, where the data\n // is passed from the client as an argument, without the ID\n if (!data.id && id) {\n data.id = id\n }\n\n const formStateResult = await fieldSchemasToFormState({\n id,\n clientFieldSchemaMap: clientSchemaMap,\n collectionSlug,\n data,\n documentData,\n fields,\n fieldSchemaMap: schemaMap,\n initialBlockData: blockData,\n mockRSCs,\n operation,\n permissions: docPermissions?.fields || {},\n preferences: docPreferences || { fields: {} },\n previousFormState: formState,\n readOnly,\n renderAllFields,\n renderFieldFn: renderField,\n req,\n schemaPath,\n select,\n selectMode,\n skipValidation,\n })\n\n // Maintain form state of auth / upload fields\n if (collectionSlug && formState) {\n if (payload.collections[collectionSlug]?.config?.upload && formState.file) {\n formStateResult.file = formState.file\n }\n }\n\n let lockedStateResult: LockedState | undefined\n\n if (returnLockStatus) {\n lockedStateResult = await handleFormStateLocking({\n id,\n collectionSlug,\n globalSlug,\n req,\n updateLastEdited,\n })\n }\n\n let staleDataStateResult: StaleDataState | undefined\n\n if (checkForStaleData && originalUpdatedAt && ((collectionSlug && id) || globalSlug)) {\n staleDataStateResult = await handleStaleDataCheck({\n id,\n collectionSlug,\n globalSlug,\n originalUpdatedAt,\n req,\n })\n }\n\n const res: BuildFormStateSuccessResult = {\n lockedState: lockedStateResult,\n staleDataState: staleDataStateResult,\n state: formStateResult,\n }\n\n if (returnLivePreviewURL) {\n const { livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (livePreviewURL) {\n res.livePreviewURL = livePreviewURL\n }\n }\n\n if (returnPreviewURL) {\n const { previewURL } = await handlePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (previewURL) {\n res.previewURL = previewURL\n }\n }\n\n return res\n}\n"],"mappings":"AASA,SAASA,cAAc,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ;AAChE,SAASC,aAAa,EAAEC,oBAAoB,QAAQ;AAEpD,SAASC,uBAAuB,QAAQ;AACxC,SAASC,WAAW,QAAQ;AAC5B,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,QAAQ;AAC7B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAC9B,SAASC,oBAAoB,QAAQ;AAuCrC,OAAO,MAAMC,qBAAA,GAGT,MAAOC,IAAA;EACT,MAAM;IAAEC;EAAG,CAAE,GAAGD,IAAA;EAEhB,IAAI;IACF,MAAMf,cAAA,CAAe;MAAEgB;IAAI;IAC3B,MAAMC,GAAA,GAAM,MAAMC,cAAA,CAAeH,IAAA;IAEjC,OAAOE,GAAA;EACT,EAAE,OAAOE,GAAA,EAAK;IACZH,GAAA,CAAII,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC;MAAEH,GAAA;MAAKI,GAAA,EAAK;IAAyC;IAE9E,IAAIJ,GAAA,CAAIK,OAAO,KAAK,8CAA8C;MAChE,OAAO;QACLA,OAAA,EAASL,GAAA,CAAIK;MACf;IACF;IAEA,IAAIL,GAAA,CAAIK,OAAO,KAAK,gBAAgB;MAClC,MAAM,IAAItB,iBAAA;IACZ;IAEA,OAAOD,YAAA,CAAakB,GAAA;EACtB;AACF;AAEA,OAAO,MAAMD,cAAA,GAAiB,MAC5BH,IAAA;EAEA,MAAM;IACJU,EAAA,EAAIC,UAAU;IACdC,iBAAiB;IACjBC,cAAc;IACdC,IAAA,EAAMC,YAAY;IAClBC,cAAc;IACdC,cAAc;IACdC,iBAAiB;IACjBC,SAAS;IAC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sE,UAAA,EAAY;MACdrE,GAAA,CAAIqE,UAAU,GAAGA,UAAA;IACnB;EACF;EAEA,OAAOrE,GAAA;AACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"buildFormState.js","names":["canAccessAdmin","formatErrors","UnauthorizedError","getSelectMode","reduceFieldsToValues","fieldSchemasToFormState","renderField","getClientConfig","getClientSchemaMap","getSchemaMap","handleFormStateLocking","handleLivePreview","handlePreview","handleStaleDataCheck","buildFormStateHandler","args","req","res","buildFormState","err","payload","logger","error","msg","message","id","idFromArgs","checkForStaleData","collectionSlug","data","incomingData","docPermissions","docPreferences","documentFormState","formState","globalSlug","initialBlockData","initialBlockFormState","mockRSCs","operation","originalUpdatedAt","readOnly","renderAllFields","i18n","config","returnLivePreviewURL","returnLockStatus","returnPreviewURL","widgetSlug","schemaPath","select","skipClientConfigAuth","skipValidation","updateLastEdited","user","selectMode","undefined","Error","schemaMap","clientSchemaMap","importMap","fieldOrEntityConfig","get","fields","length","type","documentData","blockData","Array","isArray","formStateResult","clientFieldSchemaMap","fieldSchemaMap","permissions","preferences","previousFormState","renderFieldFn","renderFieldArgs","collections","upload","file","lockedStateResult","staleDataStateResult","lockedState","staleDataState","state","livePreviewURL","previewURL"],"sources":["../../src/utilities/buildFormState.ts"],"sourcesContent":["import type {\n BuildFormStateArgs,\n ClientConfig,\n ClientUser,\n ErrorResult,\n FormState,\n ServerFunction,\n} from 'payload'\n\nimport { canAccessAdmin, formatErrors, UnauthorizedError } from 'payload'\nimport { getSelectMode, reduceFieldsToValues } from 'payload/shared'\n\nimport { fieldSchemasToFormState } from '../forms/fieldSchemasToFormState/index.js'\nimport { renderField } from '../forms/fieldSchemasToFormState/renderField.js'\nimport { getClientConfig } from './getClientConfig.js'\nimport { getClientSchemaMap } from './getClientSchemaMap.js'\nimport { getSchemaMap } from './getSchemaMap.js'\nimport { handleFormStateLocking } from './handleFormStateLocking.js'\nimport { handleLivePreview } from './handleLivePreview.js'\nimport { handlePreview } from './handlePreview.js'\nimport { handleStaleDataCheck } from './handleStaleDataCheck.js'\n\nexport type LockedState = {\n isLocked: boolean\n lastEditedAt: string\n user?: ClientUser | number | string\n}\n\nexport type StaleDataState = {\n currentUpdatedAt: string\n isStale: boolean\n}\n\ntype BuildFormStateSuccessResult = {\n clientConfig?: ClientConfig\n errors?: never\n indexPath?: string\n livePreviewURL?: string\n lockedState?: LockedState\n previewURL?: string\n staleDataState?: StaleDataState\n state: FormState\n}\n\ntype BuildFormStateErrorResult = {\n livePreviewURL?: never\n lockedState?: never\n previewURL?: never\n staleDataState?: never\n state?: never\n} & (\n | {\n message: string\n }\n | ErrorResult\n)\n\nexport type BuildFormStateResult = BuildFormStateErrorResult | BuildFormStateSuccessResult\n\nexport const buildFormStateHandler: ServerFunction<\n BuildFormStateArgs,\n Promise<BuildFormStateResult>\n> = async (args) => {\n const { req } = args\n\n try {\n await canAccessAdmin({ req })\n const res = await buildFormState(args)\n\n return res\n } catch (err) {\n req.payload.logger.error({ err, msg: `There was an error building form state` })\n\n if (err.message === 'Could not find field schema for given path') {\n return {\n message: err.message,\n }\n }\n\n if (err.message === 'Unauthorized') {\n throw new UnauthorizedError()\n }\n\n return formatErrors(err)\n }\n}\n\nexport const buildFormState = async (\n args: BuildFormStateArgs,\n): Promise<BuildFormStateSuccessResult> => {\n const {\n id: idFromArgs,\n checkForStaleData,\n collectionSlug,\n data: incomingData,\n docPermissions,\n docPreferences,\n documentFormState,\n formState,\n globalSlug,\n initialBlockData,\n initialBlockFormState,\n mockRSCs,\n operation,\n originalUpdatedAt,\n readOnly,\n renderAllFields,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n },\n returnLivePreviewURL,\n returnLockStatus,\n returnPreviewURL,\n widgetSlug,\n schemaPath = collectionSlug || globalSlug || widgetSlug,\n select,\n skipClientConfigAuth,\n skipValidation,\n updateLastEdited,\n user,\n } = args\n\n const selectMode = select ? getSelectMode(select) : undefined\n\n if (!collectionSlug && !globalSlug && !widgetSlug) {\n throw new Error('Either collectionSlug, globalSlug, or widgetSlug must be provided')\n }\n\n const schemaMap = getSchemaMap({\n collectionSlug,\n config,\n globalSlug,\n i18n,\n widgetSlug,\n })\n\n const clientSchemaMap = getClientSchemaMap({\n collectionSlug,\n config: getClientConfig({\n config,\n i18n,\n importMap: req.payload.importMap,\n user: skipClientConfigAuth ? true : req.user,\n }),\n globalSlug,\n i18n,\n payload,\n schemaMap,\n widgetSlug,\n })\n\n const id = collectionSlug ? idFromArgs : undefined\n const fieldOrEntityConfig = schemaMap.get(schemaPath)\n\n if (!fieldOrEntityConfig) {\n throw new Error(`Could not find \"${schemaPath}\" in the fieldSchemaMap`)\n }\n\n if (\n (!('fields' in fieldOrEntityConfig) ||\n !fieldOrEntityConfig.fields ||\n !fieldOrEntityConfig.fields.length) &&\n 'type' in fieldOrEntityConfig &&\n fieldOrEntityConfig.type !== 'blocks'\n ) {\n throw new Error(\n `The field found in fieldSchemaMap for \"${schemaPath}\" does not contain any subfields.`,\n )\n }\n\n // If there is form state but no data, deduce data from that form state, e.g. on initial load\n // Otherwise, use the incoming data as the source of truth, e.g. on subsequent saves\n const data = incomingData || reduceFieldsToValues(formState, true)\n\n let documentData = undefined\n\n if (documentFormState) {\n documentData = reduceFieldsToValues(documentFormState, true)\n }\n\n let blockData = initialBlockData\n\n if (initialBlockFormState) {\n blockData = reduceFieldsToValues(initialBlockFormState, true)\n }\n\n /**\n * When building state for sub schemas we need to adjust:\n * - `fields`\n * - `parentSchemaPath`\n * - `parentPath`\n *\n * Type assertion is fine because we wrap sub schemas in an array\n * so we can safely map over them within `fieldSchemasToFormState`\n */\n const fields = Array.isArray(fieldOrEntityConfig)\n ? fieldOrEntityConfig\n : 'fields' in fieldOrEntityConfig\n ? fieldOrEntityConfig.fields\n : [fieldOrEntityConfig]\n\n // Ensure data.id is present during form state requests, where the data\n // is passed from the client as an argument, without the ID\n if (!data.id && id) {\n data.id = id\n }\n\n const formStateResult = await fieldSchemasToFormState({\n id,\n clientFieldSchemaMap: clientSchemaMap,\n collectionSlug,\n data,\n documentData,\n fields,\n fieldSchemaMap: schemaMap,\n initialBlockData: blockData,\n mockRSCs,\n operation,\n permissions: docPermissions?.fields || {},\n preferences: docPreferences || { fields: {} },\n previousFormState: formState,\n readOnly,\n renderAllFields,\n renderFieldFn: (renderFieldArgs) => renderField({ ...renderFieldArgs, user }),\n req,\n schemaPath,\n select,\n selectMode,\n skipValidation,\n })\n\n // Maintain form state of auth / upload fields\n if (collectionSlug && formState) {\n if (payload.collections[collectionSlug]?.config?.upload && formState.file) {\n formStateResult.file = formState.file\n }\n }\n\n let lockedStateResult: LockedState | undefined\n\n if (returnLockStatus) {\n lockedStateResult = await handleFormStateLocking({\n id,\n collectionSlug,\n globalSlug,\n req,\n updateLastEdited,\n })\n }\n\n let staleDataStateResult: StaleDataState | undefined\n\n if (checkForStaleData && originalUpdatedAt && ((collectionSlug && id) || globalSlug)) {\n staleDataStateResult = await handleStaleDataCheck({\n id,\n collectionSlug,\n globalSlug,\n originalUpdatedAt,\n req,\n })\n }\n\n const res: BuildFormStateSuccessResult = {\n lockedState: lockedStateResult,\n staleDataState: staleDataStateResult,\n state: formStateResult,\n }\n\n if (returnLivePreviewURL) {\n const { livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (livePreviewURL) {\n res.livePreviewURL = livePreviewURL\n }\n }\n\n if (returnPreviewURL) {\n const { previewURL } = await handlePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (previewURL) {\n res.previewURL = previewURL\n }\n }\n\n return res\n}\n"],"mappings":"AASA,SAASA,cAAc,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ;AAChE,SAASC,aAAa,EAAEC,oBAAoB,QAAQ;AAEpD,SAASC,uBAAuB,QAAQ;AACxC,SAASC,WAAW,QAAQ;A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QmC,MAAA,IAAU7C,SAAA,CAAU8C,IAAI,EAAE;MACzEV,eAAA,CAAgBU,IAAI,GAAG9C,SAAA,CAAU8C,IAAI;IACvC;EACF;EAEA,IAAIC,iBAAA;EAEJ,IAAInC,gBAAA,EAAkB;IACpBmC,iBAAA,GAAoB,MAAMvE,sBAAA,CAAuB;MAC/Ce,EAAA;MACAG,cAAA;MACAO,UAAA;MACAnB,GAAA;MACAqC;IACF;EACF;EAEA,IAAI6B,oBAAA;EAEJ,IAAIvD,iBAAA,IAAqBa,iBAAA,KAAsBZ,cAAC,IAAkBH,EAAA,IAAOU,UAAS,GAAI;IACpF+C,oBAAA,GAAuB,MAAMrE,oBAAA,CAAqB;MAChDY,EAAA;MACAG,cAAA;MACAO,UAAA;MACAK,iBAAA;MACAxB;IACF;EACF;EAEA,MAAMC,GAAA,GAAmC;IACvCkE,WAAA,EAAaF,iBAAA;IACbG,cAAA,EAAgBF,oBAAA;IAChBG,KAAA,EAAOf;EACT;EAEA,IAAIzB,oBAAA,EAAsB;IACxB,MAAM;MAAEyC;IAAc,CAAE,GAAG,MAAM3E,iBAAA,CAAkB;MACjDiB,cAAA;MACAgB,MAAA;MACAf,IAAA;MACAM,UAAA;MACAnB;IACF;IAEA;IACA;IACA,IAAIsE,cAAA,EAAgB;MAClBrE,GAAA,CAAIqE,cAAc,GAAGA,cAAA;IACvB;EACF;EAEA,IAAIvC,gBAAA,EAAkB;IACpB,MAAM;MAAEwC;IAAU,CAAE,GAAG,MAAM3E,aAAA,CAAc;MACzCgB,cAAA;MACAgB,MAAA;MACAf,IAAA;MACAM,UAAA;MACAnB;IACF;IAEA;IACA;IACA,IAAIuE,UAAA,EAAY;MACdtE,GAAA,CAAIsE,UAAU,GAAGA,UAAA;IACnB;EACF;EAEA,OAAOtE,GAAA;AACT","ignoreList":[]}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* Note: This MUST be called within the client environment as it relies on the `window` object
|
|
5
5
|
* to determine the absolute URL.
|
|
6
6
|
*/
|
|
7
|
-
export declare const formatAbsoluteURL: (incomingURL: string) =>
|
|
7
|
+
export declare const formatAbsoluteURL: (incomingURL: string) => string | undefined;
|
|
8
8
|
//# sourceMappingURL=formatAbsoluteURL.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatAbsoluteURL.d.ts","sourceRoot":"","sources":["../../src/utilities/formatAbsoluteURL.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatAbsoluteURL.d.ts","sourceRoot":"","sources":["../../src/utilities/formatAbsoluteURL.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,gBAAiB,MAAM,KAAG,MAAM,GAAG,SAmBhE,CAAA"}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
try {
|
|
3
|
-
return new URL(url, window.location.origin).href;
|
|
4
|
-
} catch {
|
|
5
|
-
return url;
|
|
6
|
-
}
|
|
7
|
-
};
|
|
1
|
+
import { isHttpURL } from './isHttpURL.js';
|
|
8
2
|
/**
|
|
9
3
|
* Ensures the provided URL is absolute. If not, it converts it to an absolute URL based
|
|
10
4
|
* on the current window location.
|
|
11
5
|
* Note: This MUST be called within the client environment as it relies on the `window` object
|
|
12
6
|
* to determine the absolute URL.
|
|
13
7
|
*/
|
|
14
|
-
export const formatAbsoluteURL = incomingURL =>
|
|
8
|
+
export const formatAbsoluteURL = incomingURL => {
|
|
9
|
+
try {
|
|
10
|
+
// This throws for malformed URLs, e.g. `https://[wrong`.
|
|
11
|
+
// Preformed absolute URLs ignore `window.location.origin` when parsed.
|
|
12
|
+
const parsedURL = new URL(incomingURL, window.location.origin);
|
|
13
|
+
// If the given URL is already absolute, preserve its original format exactly, i.e. `new URL()` may have added a trailing slash
|
|
14
|
+
if (incomingURL.startsWith('http://') || incomingURL.startsWith('https://')) {
|
|
15
|
+
return incomingURL;
|
|
16
|
+
}
|
|
17
|
+
if (isHttpURL(parsedURL)) {
|
|
18
|
+
return parsedURL.href;
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
} catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
15
25
|
//# sourceMappingURL=formatAbsoluteURL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatAbsoluteURL.js","names":["
|
|
1
|
+
{"version":3,"file":"formatAbsoluteURL.js","names":["isHttpURL","formatAbsoluteURL","incomingURL","parsedURL","URL","window","location","origin","startsWith","href","undefined"],"sources":["../../src/utilities/formatAbsoluteURL.ts"],"sourcesContent":["import { isHttpURL } from './isHttpURL.js'\n\n/**\n * Ensures the provided URL is absolute. If not, it converts it to an absolute URL based\n * on the current window location.\n * Note: This MUST be called within the client environment as it relies on the `window` object\n * to determine the absolute URL.\n */\nexport const formatAbsoluteURL = (incomingURL: string): string | undefined => {\n try {\n // This throws for malformed URLs, e.g. `https://[wrong`.\n // Preformed absolute URLs ignore `window.location.origin` when parsed.\n const parsedURL = new URL(incomingURL, window.location.origin)\n\n // If the given URL is already absolute, preserve its original format exactly, i.e. `new URL()` may have added a trailing slash\n if (incomingURL.startsWith('http://') || incomingURL.startsWith('https://')) {\n return incomingURL\n }\n\n if (isHttpURL(parsedURL)) {\n return parsedURL.href\n }\n\n return undefined\n } catch {\n return undefined\n }\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ;AAE1B;;;;;;AAMA,OAAO,MAAMC,iBAAA,GAAqBC,WAAA;EAChC,IAAI;IACF;IACA;IACA,MAAMC,SAAA,GAAY,IAAIC,GAAA,CAAIF,WAAA,EAAaG,MAAA,CAAOC,QAAQ,CAACC,MAAM;IAE7D;IACA,IAAIL,WAAA,CAAYM,UAAU,CAAC,cAAcN,WAAA,CAAYM,UAAU,CAAC,aAAa;MAC3E,OAAON,WAAA;IACT;IAEA,IAAIF,SAAA,CAAUG,SAAA,GAAY;MACxB,OAAOA,SAAA,CAAUM,IAAI;IACvB;IAEA,OAAOC,SAAA;EACT,EAAE,MAAM;IACN,OAAOA,SAAA;EACT;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { formatAbsoluteURL } from './formatAbsoluteURL.js';
|
|
3
|
+
describe('formatAbsoluteURL', () => {
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
vi.stubGlobal('window', {
|
|
6
|
+
location: {
|
|
7
|
+
origin: 'https://admin.example.com'
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
vi.unstubAllGlobals();
|
|
13
|
+
});
|
|
14
|
+
it.each([['/preview', 'https://admin.example.com/preview'], ['preview?draft=true', 'https://admin.example.com/preview?draft=true'], ['../preview', 'https://admin.example.com/preview'], ['?draft=true', 'https://admin.example.com/?draft=true'], ['#preview', 'https://admin.example.com/#preview'], ['//preview.example.com/page', 'https://preview.example.com/page'], ['', 'https://admin.example.com/']])('should resolve relative URL %s against the admin origin', (input, expected) => {
|
|
15
|
+
expect(formatAbsoluteURL(input)).toBe(expected);
|
|
16
|
+
});
|
|
17
|
+
it.each(['http://preview.example.com', 'https://preview.example.com', 'https://preview.example.com:443/one/../two?draft=true#preview'])('should preserve absolute HTTP(S) URL %s', input => {
|
|
18
|
+
expect(formatAbsoluteURL(input)).toBe(input);
|
|
19
|
+
});
|
|
20
|
+
it.each(['mailto:editor@example.com', 'file:///preview.html'])('should return undefined for unsupported URL %s', input => {
|
|
21
|
+
expect(formatAbsoluteURL(input)).toBeUndefined();
|
|
22
|
+
});
|
|
23
|
+
it.each(['http://', 'https://', 'https://[invalid'])('should return undefined for invalid URL %s', input => {
|
|
24
|
+
expect(formatAbsoluteURL(input)).toBeUndefined();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=formatAbsoluteURL.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatAbsoluteURL.spec.js","names":["afterEach","beforeEach","describe","expect","it","vi","formatAbsoluteURL","stubGlobal","location","origin","unstubAllGlobals","each","input","expected","toBe","toBeUndefined"],"sources":["../../src/utilities/formatAbsoluteURL.spec.ts"],"sourcesContent":["import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'\n\nimport { formatAbsoluteURL } from './formatAbsoluteURL.js'\n\ndescribe('formatAbsoluteURL', () => {\n beforeEach(() => {\n vi.stubGlobal('window', {\n location: { origin: 'https://admin.example.com' },\n })\n })\n\n afterEach(() => {\n vi.unstubAllGlobals()\n })\n\n it.each([\n ['/preview', 'https://admin.example.com/preview'],\n ['preview?draft=true', 'https://admin.example.com/preview?draft=true'],\n ['../preview', 'https://admin.example.com/preview'],\n ['?draft=true', 'https://admin.example.com/?draft=true'],\n ['#preview', 'https://admin.example.com/#preview'],\n ['//preview.example.com/page', 'https://preview.example.com/page'],\n ['', 'https://admin.example.com/'],\n ])('should resolve relative URL %s against the admin origin', (input, expected) => {\n expect(formatAbsoluteURL(input)).toBe(expected)\n })\n\n it.each([\n 'http://preview.example.com',\n 'https://preview.example.com',\n 'https://preview.example.com:443/one/../two?draft=true#preview',\n ])('should preserve absolute HTTP(S) URL %s', (input) => {\n expect(formatAbsoluteURL(input)).toBe(input)\n })\n\n it.each(['mailto:editor@example.com', 'file:///preview.html'])(\n 'should return undefined for unsupported URL %s',\n (input) => {\n expect(formatAbsoluteURL(input)).toBeUndefined()\n },\n )\n\n it.each(['http://', 'https://', 'https://[invalid'])(\n 'should return undefined for invalid URL %s',\n (input) => {\n expect(formatAbsoluteURL(input)).toBeUndefined()\n },\n )\n})\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ;AAEhE,SAASC,iBAAiB,QAAQ;AAElCJ,QAAA,CAAS,qBAAqB;EAC5BD,UAAA,CAAW;IACTI,EAAA,CAAGE,UAAU,CAAC,UAAU;MACtBC,QAAA,EAAU;QAAEC,MAAA,EAAQ;MAA4B;IAClD;EACF;EAEAT,SAAA,CAAU;IACRK,EAAA,CAAGK,gBAAgB;EACrB;EAEAN,EAAA,CAAGO,IAAI,CAAC,CACN,CAAC,YAAY,oCAAoC,EACjD,CAAC,sBAAsB,+CAA+C,EACtE,CAAC,cAAc,oCAAoC,EACnD,CAAC,eAAe,wCAAwC,EACxD,CAAC,YAAY,qCAAqC,EAClD,CAAC,8BAA8B,mCAAmC,EAClE,CAAC,IAAI,6BAA6B,CACnC,EAAE,2DAA2D,CAACC,KAAA,EAAOC,QAAA;IACpEV,MAAA,CAAOG,iBAAA,CAAkBM,KAAA,GAAQE,IAAI,CAACD,QAAA;EACxC;EAEAT,EAAA,CAAGO,IAAI,CAAC,CACN,8BACA,+BACA,gEACD,EAAE,2CAA4CC,KAAA;IAC7CT,MAAA,CAAOG,iBAAA,CAAkBM,KAAA,GAAQE,IAAI,CAACF,KAAA;EACxC;EAEAR,EAAA,CAAGO,IAAI,CAAC,CAAC,6BAA6B,uBAAuB,EAC3D,kDACCC,KAAA;IACCT,MAAA,CAAOG,iBAAA,CAAkBM,KAAA,GAAQG,aAAa;EAChD;EAGFX,EAAA,CAAGO,IAAI,CAAC,CAAC,WAAW,YAAY,mBAAmB,EACjD,8CACCC,KAAA;IACCT,MAAA,CAAOG,iBAAA,CAAkBM,KAAA,GAAQG,aAAa;EAChD;AAEJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isAbsoluteURL.d.ts","sourceRoot":"","sources":["../../src/utilities/isAbsoluteURL.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,eAAO,MAAM,aAAa,iBAAkB,MAAM,GAAG,GAAG,KAAG,OAe1D,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Checks whether a URL is absolute or relative. */export const isAbsoluteURL = incomingURL => {
|
|
2
|
+
if (!incomingURL) {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
if (incomingURL instanceof URL) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
new URL(incomingURL);
|
|
10
|
+
return true;
|
|
11
|
+
} catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=isAbsoluteURL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isAbsoluteURL.js","names":["isAbsoluteURL","incomingURL","URL"],"sources":["../../src/utilities/isAbsoluteURL.ts"],"sourcesContent":["/** Checks whether a URL is absolute or relative. */\nexport const isAbsoluteURL = (incomingURL?: string | URL): boolean => {\n if (!incomingURL) {\n return false\n }\n\n if (incomingURL instanceof URL) {\n return true\n }\n\n try {\n new URL(incomingURL)\n return true\n } catch {\n return false\n }\n}\n"],"mappings":"AAAA,oDACA,OAAO,MAAMA,aAAA,GAAiBC,WAAA;EAC5B,IAAI,CAACA,WAAA,EAAa;IAChB,OAAO;EACT;EAEA,IAAIA,WAAA,YAAuBC,GAAA,EAAK;IAC9B,OAAO;EACT;EAEA,IAAI;IACF,IAAIA,GAAA,CAAID,WAAA;IACR,OAAO;EACT,EAAE,MAAM;IACN,OAAO;EACT;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { isAbsoluteURL } from './isAbsoluteURL.js';
|
|
3
|
+
describe('isAbsoluteURL', () => {
|
|
4
|
+
it.each(['http://example.com', 'https://example.com/preview', 'mailto:editor@example.com', 'file:///preview.html', new URL('https://example.com/preview')])('should accept absolute URL %s', input => {
|
|
5
|
+
expect(isAbsoluteURL(input)).toBe(true);
|
|
6
|
+
});
|
|
7
|
+
it.each([undefined, '', '/preview', '../preview', 'preview?draft=true', '?draft=true', '#preview', '//example.com/preview', 'https://', 'https://[invalid'])('should reject relative, absent, or invalid URL %s', input => {
|
|
8
|
+
expect(isAbsoluteURL(input)).toBe(false);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=isAbsoluteURL.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isAbsoluteURL.spec.js","names":["describe","expect","it","isAbsoluteURL","each","URL","input","toBe","undefined"],"sources":["../../src/utilities/isAbsoluteURL.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport { isAbsoluteURL } from './isAbsoluteURL.js'\n\ndescribe('isAbsoluteURL', () => {\n it.each([\n 'http://example.com',\n 'https://example.com/preview',\n 'mailto:editor@example.com',\n 'file:///preview.html',\n new URL('https://example.com/preview'),\n ])('should accept absolute URL %s', (input) => {\n expect(isAbsoluteURL(input)).toBe(true)\n })\n\n it.each([\n undefined,\n '',\n '/preview',\n '../preview',\n 'preview?draft=true',\n '?draft=true',\n '#preview',\n '//example.com/preview',\n 'https://',\n 'https://[invalid',\n ])('should reject relative, absent, or invalid URL %s', (input) => {\n expect(isAbsoluteURL(input)).toBe(false)\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ;AAErC,SAASC,aAAa,QAAQ;AAE9BH,QAAA,CAAS,iBAAiB;EACxBE,EAAA,CAAGE,IAAI,CAAC,CACN,sBACA,+BACA,6BACA,wBACA,IAAIC,GAAA,CAAI,+BACT,EAAE,iCAAkCC,KAAA;IACnCL,MAAA,CAAOE,aAAA,CAAcG,KAAA,GAAQC,IAAI,CAAC;EACpC;EAEAL,EAAA,CAAGE,IAAI,CAAC,CACNI,SAAA,EACA,IACA,YACA,cACA,sBACA,eACA,YACA,yBACA,YACA,mBACD,EAAE,qDAAsDF,KAAA;IACvDL,MAAA,CAAOE,aAAA,CAAcG,KAAA,GAAQC,IAAI,CAAC;EACpC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isHttpURL.d.ts","sourceRoot":"","sources":["../../src/utilities/isHttpURL.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,eAAO,MAAM,SAAS,iBAAkB,MAAM,GAAG,GAAG,KAAG,OAatD,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Allows only HTTP(S) URLs, e.g. `http://` or `https://`. */export const isHttpURL = incomingURL => {
|
|
2
|
+
if (!incomingURL) {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
try {
|
|
6
|
+
const url = typeof incomingURL === 'string' ? new URL(incomingURL, window.location.origin) : incomingURL;
|
|
7
|
+
return url.protocol === 'http:' || url.protocol === 'https:';
|
|
8
|
+
} catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=isHttpURL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isHttpURL.js","names":["isHttpURL","incomingURL","url","URL","window","location","origin","protocol"],"sources":["../../src/utilities/isHttpURL.ts"],"sourcesContent":["/** Allows only HTTP(S) URLs, e.g. `http://` or `https://`. */\nexport const isHttpURL = (incomingURL?: string | URL): boolean => {\n if (!incomingURL) {\n return false\n }\n\n try {\n const url =\n typeof incomingURL === 'string' ? new URL(incomingURL, window.location.origin) : incomingURL\n\n return url.protocol === 'http:' || url.protocol === 'https:'\n } catch {\n return false\n }\n}\n"],"mappings":"AAAA,8DACA,OAAO,MAAMA,SAAA,GAAaC,WAAA;EACxB,IAAI,CAACA,WAAA,EAAa;IAChB,OAAO;EACT;EAEA,IAAI;IACF,MAAMC,GAAA,GACJ,OAAOD,WAAA,KAAgB,WAAW,IAAIE,GAAA,CAAIF,WAAA,EAAaG,MAAA,CAAOC,QAAQ,CAACC,MAAM,IAAIL,WAAA;IAEnF,OAAOC,GAAA,CAAIK,QAAQ,KAAK,WAAWL,GAAA,CAAIK,QAAQ,KAAK;EACtD,EAAE,MAAM;IACN,OAAO;EACT;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { isHttpURL } from './isHttpURL.js';
|
|
3
|
+
describe('isHttpURL', () => {
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
vi.stubGlobal('window', {
|
|
6
|
+
location: {
|
|
7
|
+
origin: 'https://admin.example.com'
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
vi.unstubAllGlobals();
|
|
13
|
+
});
|
|
14
|
+
it.each([['https://preview.example.com', true], ['mailto:editor@example.com', false]])('should validate parsed URL %s without the client environment', (input, expected) => {
|
|
15
|
+
vi.stubGlobal('window', undefined);
|
|
16
|
+
expect(isHttpURL(new URL(input))).toBe(expected);
|
|
17
|
+
});
|
|
18
|
+
it.each(['http://preview.example.com', 'https://preview.example.com', '/preview', 'preview?draft=true', '../preview', '?draft=true', '#preview', '//preview.example.com/page'])('should accept HTTP(S) or relative URL %s', input => {
|
|
19
|
+
expect(isHttpURL(input)).toBe(true);
|
|
20
|
+
});
|
|
21
|
+
it.each([undefined, '', 'mailto:editor@example.com', 'file:///preview.html', 'https://[invalid', 'http://'])('should reject absent, unsupported, or invalid URL %s', input => {
|
|
22
|
+
expect(isHttpURL(input)).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=isHttpURL.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isHttpURL.spec.js","names":["afterEach","beforeEach","describe","expect","it","vi","isHttpURL","stubGlobal","location","origin","unstubAllGlobals","each","input","expected","undefined","URL","toBe"],"sources":["../../src/utilities/isHttpURL.spec.ts"],"sourcesContent":["import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'\n\nimport { isHttpURL } from './isHttpURL.js'\n\ndescribe('isHttpURL', () => {\n beforeEach(() => {\n vi.stubGlobal('window', {\n location: { origin: 'https://admin.example.com' },\n })\n })\n\n afterEach(() => {\n vi.unstubAllGlobals()\n })\n\n it.each([\n ['https://preview.example.com', true],\n ['mailto:editor@example.com', false],\n ] as const)('should validate parsed URL %s without the client environment', (input, expected) => {\n vi.stubGlobal('window', undefined)\n\n expect(isHttpURL(new URL(input))).toBe(expected)\n })\n\n it.each([\n 'http://preview.example.com',\n 'https://preview.example.com',\n '/preview',\n 'preview?draft=true',\n '../preview',\n '?draft=true',\n '#preview',\n '//preview.example.com/page',\n ])('should accept HTTP(S) or relative URL %s', (input) => {\n expect(isHttpURL(input)).toBe(true)\n })\n\n it.each([\n undefined,\n '',\n 'mailto:editor@example.com',\n 'file:///preview.html',\n 'https://[invalid',\n 'http://',\n ])('should reject absent, unsupported, or invalid URL %s', (input) => {\n expect(isHttpURL(input)).toBe(false)\n })\n})\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ;AAEhE,SAASC,SAAS,QAAQ;AAE1BJ,QAAA,CAAS,aAAa;EACpBD,UAAA,CAAW;IACTI,EAAA,CAAGE,UAAU,CAAC,UAAU;MACtBC,QAAA,EAAU;QAAEC,MAAA,EAAQ;MAA4B;IAClD;EACF;EAEAT,SAAA,CAAU;IACRK,EAAA,CAAGK,gBAAgB;EACrB;EAEAN,EAAA,CAAGO,IAAI,CAAC,CACN,CAAC,+BAA+B,KAAK,EACrC,CAAC,6BAA6B,MAAM,CACrC,EAAW,gEAAgE,CAACC,KAAA,EAAOC,QAAA;IAClFR,EAAA,CAAGE,UAAU,CAAC,UAAUO,SAAA;IAExBX,MAAA,CAAOG,SAAA,CAAU,IAAIS,GAAA,CAAIH,KAAA,IAASI,IAAI,CAACH,QAAA;EACzC;EAEAT,EAAA,CAAGO,IAAI,CAAC,CACN,8BACA,+BACA,YACA,sBACA,cACA,eACA,YACA,6BACD,EAAE,4CAA6CC,KAAA;IAC9CT,MAAA,CAAOG,SAAA,CAAUM,KAAA,GAAQI,IAAI,CAAC;EAChC;EAEAZ,EAAA,CAAGO,IAAI,CAAC,CACNG,SAAA,EACA,IACA,6BACA,wBACA,oBACA,UACD,EAAE,wDAAyDF,KAAA;IAC1DT,MAAA,CAAOG,SAAA,CAAUM,KAAA,GAAQI,IAAI,CAAC;EAChC;AACF","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SchedulePublishTaskInput, ServerFunction } from 'payload';
|
|
2
|
+
import type { UpcomingEvent } from '../elements/PublishButton/ScheduleDrawer/types.js';
|
|
2
3
|
export type SchedulePublishHandlerArgs = {
|
|
3
4
|
date?: Date;
|
|
4
5
|
/**
|
|
@@ -8,5 +9,11 @@ export type SchedulePublishHandlerArgs = {
|
|
|
8
9
|
localeToPublish?: string;
|
|
9
10
|
timezone?: string;
|
|
10
11
|
} & Pick<SchedulePublishTaskInput, 'doc' | 'global' | 'type'>;
|
|
12
|
+
export type GetUpcomingScheduledPublishHandlerArgs = {
|
|
13
|
+
collectionSlug?: string;
|
|
14
|
+
globalSlug?: string;
|
|
15
|
+
id?: number | string;
|
|
16
|
+
};
|
|
17
|
+
export declare const getUpcomingScheduledPublishHandler: ServerFunction<GetUpcomingScheduledPublishHandlerArgs, Promise<UpcomingEvent[]>>;
|
|
11
18
|
export declare const schedulePublishHandler: ServerFunction<SchedulePublishHandlerArgs>;
|
|
12
19
|
//# sourceMappingURL=schedulePublishHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedulePublishHandler.d.ts","sourceRoot":"","sources":["../../src/utilities/schedulePublishHandler.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"schedulePublishHandler.d.ts","sourceRoot":"","sources":["../../src/utilities/schedulePublishHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAKvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAA;AAItF,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,CAAC,EAAE,IAAI,CAAA;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,IAAI,CAAC,wBAAwB,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC,CAAA;AAE7D,MAAM,MAAM,sCAAsC,GAAG;IACnD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,kCAAkC,EAAE,cAAc,CAC7D,sCAAsC,EACtC,OAAO,CAAC,aAAa,EAAE,CAAC,CA0DzB,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,cAAc,CAAC,0BAA0B,CA+D7E,CAAA"}
|
|
@@ -1,4 +1,68 @@
|
|
|
1
|
-
import { canAccessAdmin } from 'payload';
|
|
1
|
+
import { canAccessAdmin, docAccessOperation, docAccessOperationGlobal, Forbidden } from 'payload';
|
|
2
|
+
import { hasScheduledPublishEnabled } from 'payload/shared';
|
|
3
|
+
import { buildUpcomingScheduleWhere } from '../elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.js';
|
|
4
|
+
export const getUpcomingScheduledPublishHandler = async ({
|
|
5
|
+
id,
|
|
6
|
+
collectionSlug,
|
|
7
|
+
globalSlug,
|
|
8
|
+
req
|
|
9
|
+
}) => {
|
|
10
|
+
const {
|
|
11
|
+
payload
|
|
12
|
+
} = req;
|
|
13
|
+
await canAccessAdmin({
|
|
14
|
+
req
|
|
15
|
+
});
|
|
16
|
+
const collectionConfig = collectionSlug ? payload.collections[collectionSlug]?.config : undefined;
|
|
17
|
+
const globalConfig = globalSlug ? payload.config.globals.find(({
|
|
18
|
+
slug
|
|
19
|
+
}) => slug === globalSlug) : undefined;
|
|
20
|
+
const entityConfig = collectionConfig || globalConfig;
|
|
21
|
+
const hasValidTarget = Boolean(entityConfig && hasScheduledPublishEnabled(entityConfig) && (collectionConfig && id !== undefined && !globalSlug || globalConfig && !collectionSlug));
|
|
22
|
+
if (!hasValidTarget) {
|
|
23
|
+
throw new Forbidden(req.t);
|
|
24
|
+
}
|
|
25
|
+
const hasPublishPermission = collectionConfig ? (await docAccessOperation({
|
|
26
|
+
id,
|
|
27
|
+
collection: {
|
|
28
|
+
config: collectionConfig
|
|
29
|
+
},
|
|
30
|
+
data: {
|
|
31
|
+
_status: 'published'
|
|
32
|
+
},
|
|
33
|
+
req
|
|
34
|
+
})).update : (await docAccessOperationGlobal({
|
|
35
|
+
data: {
|
|
36
|
+
_status: 'published'
|
|
37
|
+
},
|
|
38
|
+
globalConfig,
|
|
39
|
+
req
|
|
40
|
+
})).update;
|
|
41
|
+
if (!hasPublishPermission) {
|
|
42
|
+
throw new Forbidden(req.t);
|
|
43
|
+
}
|
|
44
|
+
const {
|
|
45
|
+
docs
|
|
46
|
+
} = await payload.db.find({
|
|
47
|
+
collection: 'payload-jobs',
|
|
48
|
+
limit: 0,
|
|
49
|
+
sort: 'waitUntil',
|
|
50
|
+
where: buildUpcomingScheduleWhere({
|
|
51
|
+
id,
|
|
52
|
+
collectionSlug,
|
|
53
|
+
globalSlug
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
return docs.map(job => ({
|
|
57
|
+
id: job.id,
|
|
58
|
+
input: {
|
|
59
|
+
type: job.input?.type === 'unpublish' ? 'unpublish' : 'publish',
|
|
60
|
+
locale: job.input?.locale,
|
|
61
|
+
timezone: job.input?.timezone
|
|
62
|
+
},
|
|
63
|
+
waitUntil: job.waitUntil
|
|
64
|
+
}));
|
|
65
|
+
};
|
|
2
66
|
export const schedulePublishHandler = async ({
|
|
3
67
|
type,
|
|
4
68
|
date,
|
|
@@ -23,9 +87,15 @@ export const schedulePublishHandler = async ({
|
|
|
23
87
|
collection: 'payload-jobs',
|
|
24
88
|
req,
|
|
25
89
|
where: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
90
|
+
and: [{
|
|
91
|
+
id: {
|
|
92
|
+
equals: deleteID
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
taskSlug: {
|
|
96
|
+
equals: 'schedulePublish'
|
|
97
|
+
}
|
|
98
|
+
}]
|
|
29
99
|
}
|
|
30
100
|
});
|
|
31
101
|
}
|
|
@@ -36,7 +106,10 @@ export const schedulePublishHandler = async ({
|
|
|
36
106
|
global,
|
|
37
107
|
locale: localeToPublish,
|
|
38
108
|
timezone,
|
|
39
|
-
user: user.
|
|
109
|
+
user: user && user.collection ? {
|
|
110
|
+
relationTo: user.collection,
|
|
111
|
+
value: user.id
|
|
112
|
+
} : undefined
|
|
40
113
|
},
|
|
41
114
|
task: 'schedulePublish',
|
|
42
115
|
waitUntil: date
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedulePublishHandler.js","names":["canAccessAdmin","
|
|
1
|
+
{"version":3,"file":"schedulePublishHandler.js","names":["canAccessAdmin","docAccessOperation","docAccessOperationGlobal","Forbidden","hasScheduledPublishEnabled","buildUpcomingScheduleWhere","getUpcomingScheduledPublishHandler","id","collectionSlug","globalSlug","req","payload","collectionConfig","collections","config","undefined","globalConfig","globals","find","slug","entityConfig","hasValidTarget","Boolean","t","hasPublishPermission","collection","data","_status","update","docs","db","limit","sort","where","map","job","input","type","locale","timezone","waitUntil","schedulePublishHandler","date","deleteID","doc","global","localeToPublish","i18n","user","delete","and","equals","taskSlug","jobs","queue","relationTo","value","task","err","error","logger","message"],"sources":["../../src/utilities/schedulePublishHandler.ts"],"sourcesContent":["import type { SchedulePublishTaskInput, ServerFunction } from 'payload'\n\nimport { canAccessAdmin, docAccessOperation, docAccessOperationGlobal, Forbidden } from 'payload'\nimport { hasScheduledPublishEnabled } from 'payload/shared'\n\nimport type { UpcomingEvent } from '../elements/PublishButton/ScheduleDrawer/types.js'\n\nimport { buildUpcomingScheduleWhere } from '../elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.js'\n\nexport type SchedulePublishHandlerArgs = {\n date?: Date\n /**\n * The job id to delete to remove a scheduled publish event\n */\n deleteID?: number | string\n localeToPublish?: string\n timezone?: string\n} & Pick<SchedulePublishTaskInput, 'doc' | 'global' | 'type'>\n\nexport type GetUpcomingScheduledPublishHandlerArgs = {\n collectionSlug?: string\n globalSlug?: string\n id?: number | string\n}\n\nexport const getUpcomingScheduledPublishHandler: ServerFunction<\n GetUpcomingScheduledPublishHandlerArgs,\n Promise<UpcomingEvent[]>\n> = async ({ id, collectionSlug, globalSlug, req }) => {\n const { payload } = req\n\n await canAccessAdmin({ req })\n\n const collectionConfig = collectionSlug ? payload.collections[collectionSlug]?.config : undefined\n const globalConfig = globalSlug\n ? payload.config.globals.find(({ slug }) => slug === globalSlug)\n : undefined\n const entityConfig = collectionConfig || globalConfig\n const hasValidTarget = Boolean(\n entityConfig &&\n hasScheduledPublishEnabled(entityConfig) &&\n ((collectionConfig && id !== undefined && !globalSlug) || (globalConfig && !collectionSlug)),\n )\n\n if (!hasValidTarget) {\n throw new Forbidden(req.t)\n }\n\n const hasPublishPermission = collectionConfig\n ? (\n await docAccessOperation({\n id,\n collection: { config: collectionConfig },\n data: { _status: 'published' },\n req,\n })\n ).update\n : (\n await docAccessOperationGlobal({\n data: { _status: 'published' },\n globalConfig,\n req,\n })\n ).update\n\n if (!hasPublishPermission) {\n throw new Forbidden(req.t)\n }\n\n const { docs } = await payload.db.find<UpcomingEvent>({\n collection: 'payload-jobs',\n limit: 0,\n sort: 'waitUntil',\n where: buildUpcomingScheduleWhere({ id, collectionSlug, globalSlug }),\n })\n\n return docs.map((job) => ({\n id: job.id,\n input: {\n type: job.input?.type === 'unpublish' ? 'unpublish' : 'publish',\n locale: job.input?.locale,\n timezone: job.input?.timezone,\n },\n waitUntil: job.waitUntil,\n }))\n}\n\nexport const schedulePublishHandler: ServerFunction<SchedulePublishHandlerArgs> = async ({\n type,\n date,\n deleteID,\n doc,\n global,\n localeToPublish,\n req,\n timezone,\n}) => {\n const { i18n, payload, user } = req\n\n await canAccessAdmin({ req })\n\n try {\n if (deleteID) {\n await payload.delete({\n collection: 'payload-jobs',\n req,\n where: {\n and: [{ id: { equals: deleteID } }, { taskSlug: { equals: 'schedulePublish' } }],\n },\n })\n }\n\n await payload.jobs.queue({\n input: {\n type,\n doc,\n global,\n locale: localeToPublish,\n timezone,\n user:\n user && user.collection\n ? {\n relationTo: user.collection,\n value: user.id,\n }\n : undefined,\n },\n task: 'schedulePublish',\n waitUntil: date,\n })\n } catch (err) {\n let error\n\n if (deleteID) {\n error = `Error deleting scheduled publish event with ID ${deleteID}`\n } else {\n error = `Error scheduling ${type} for `\n if (doc) {\n error += `document with ID ${doc.value} in collection ${doc.relationTo}`\n }\n }\n\n payload.logger.error({ err }, error)\n\n return {\n error,\n }\n }\n\n return { message: i18n.t('general:success') }\n}\n"],"mappings":"AAEA,SAASA,cAAc,EAAEC,kBAAkB,EAAEC,wBAAwB,EAAEC,SAAS,QAAQ;AACxF,SAASC,0BAA0B,QAAQ;AAI3C,SAASC,0BAA0B,QAAQ;AAkB3C,OAAO,MAAMC,kCAAA,GAGT,MAAAA,CAAO;EAAEC,EAAE;EAAEC,cAAc;EAAEC,UAAU;EAAEC;AAAG,CAAE;EAChD,MAAM;IAAEC;EAAO,CAAE,GAAGD,GAAA;EAEpB,MAAMV,cAAA,CAAe;IAAEU;EAAI;EAE3B,MAAME,gBAAA,GAAmBJ,cAAA,GAAiBG,OAAA,CAAQE,WAAW,CAACL,cAAA,CAAe,EAAEM,MAAA,GAASC,SAAA;EACxF,MAAMC,YAAA,GAAeP,UAAA,GACjBE,OAAA,CAAQG,MAAM,CAACG,OAAO,CAACC,IAAI,CAAC,CAAC;IAAEC;EAA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S,oBAAoBf,GAAA,CAAIY,KAAK,kBAAkBZ,GAAA,CAAIW,UAAU,EAAE;MAC1E;IACF;IAEA5C,OAAA,CAAQiD,MAAM,CAACD,KAAK,CAAC;MAAED;IAAI,GAAGC,KAAA;IAE9B,OAAO;MACLA;IACF;EACF;EAEA,OAAO;IAAEE,OAAA,EAASd,IAAA,CAAKxB,CAAC,CAAC;EAAmB;AAC9C","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIKey.d.ts","sourceRoot":"","sources":["../../../../src/views/Edit/Auth/APIKey.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"APIKey.d.ts","sourceRoot":"","sources":["../../../../src/views/Edit/Auth/APIKey.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA+C,MAAM,OAAO,CAAA;AAwBnE,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAgUvF,CAAA"}
|