hash
stringlengths
40
40
date
stringdate
2020-04-17 22:01:00
2025-03-21 18:34:11
author
stringclasses
90 values
commit_message
stringlengths
9
197
is_merge
bool
1 class
masked_commit_message
stringlengths
4
170
type
stringclasses
8 values
git_diff
stringlengths
160
5.96M
a1813ca4b32dfcd8ca3604f7f03b1ba316d740e2
2022-12-15 20:35:49
Jacob Fletcher
fix: stringifies date in DateTime field for useAsTitle (#1674)
false
stringifies date in DateTime field for useAsTitle (#1674)
fix
diff --git a/src/admin/components/forms/field-types/DateTime/index.tsx b/src/admin/components/forms/field-types/DateTime/index.tsx index 3166b1b491e..57f5dd23d06 100644 --- a/src/admin/components/forms/field-types/DateTime/index.tsx +++ b/src/admin/components/forms/field-types/DateTime/index.tsx @@ -88,7 +88,9 @@ const DateTime: React.FC<Props> = (props) => { {...date} placeholder={getTranslation(placeholder, i18n)} readOnly={readOnly} - onChange={readOnly ? undefined : setValue} + onChange={(incomingDate) => { + if (!readOnly) setValue(incomingDate.toISOString()); + }} value={value as Date} /> </div> diff --git a/test/fields/collections/Date/index.ts b/test/fields/collections/Date/index.ts index fc69a6fda48..578a94e54d5 100644 --- a/test/fields/collections/Date/index.ts +++ b/test/fields/collections/Date/index.ts @@ -5,7 +5,7 @@ export const defaultText = 'default-text'; const DateFields: CollectionConfig = { slug: 'date-fields', admin: { - useAsTitle: 'date', + useAsTitle: 'default', }, fields: [ {
f4b099a3d151dd4df15a3961c5af1df9cb17694c
2022-12-07 01:26:14
Jacob Fletcher
chore: removes useDrawer hook and drawer context
false
removes useDrawer hook and drawer context
chore
diff --git a/src/admin/components/elements/DocumentDrawer/index.tsx b/src/admin/components/elements/DocumentDrawer/index.tsx index b8ad412c150..c577fb303eb 100644 --- a/src/admin/components/elements/DocumentDrawer/index.tsx +++ b/src/admin/components/elements/DocumentDrawer/index.tsx @@ -8,7 +8,7 @@ import X from '../../icons/X'; import { Fields } from '../../forms/Form/types'; import buildStateFromSchema from '../../forms/Form/buildStateFromSchema'; import { getTranslation } from '../../../../utilities/getTranslation'; -import { Drawer, DrawerToggler, useDrawerDepth } from '../Drawer'; +import { Drawer, DrawerToggler } from '../Drawer'; import Button from '../Button'; import { useConfig } from '../../utilities/Config'; import { useLocale } from '../../utilities/Locale'; @@ -21,6 +21,7 @@ import { useRelatedCollections } from '../../forms/field-types/Relationship/AddN import { SanitizedCollectionConfig } from '../../../../collections/config/types'; import IDLabel from '../IDLabel'; import './index.scss'; +import { useEditDepth } from '../../utilities/EditDepth'; const baseClass = 'doc-drawer'; @@ -189,7 +190,7 @@ export const DocumentDrawer: React.FC<DocumentDrawerProps> = ({ }; export const useDocumentDrawer: UseDocumentDrawer = ({ id, collectionSlug }) => { - const drawerDepth = useDrawerDepth(); + const drawerDepth = useEditDepth(); const uuid = useId(); const { modalState, toggleModal } = useModal(); const [isOpen, setIsOpen] = useState(false); diff --git a/src/admin/components/elements/Drawer/index.tsx b/src/admin/components/elements/Drawer/index.tsx index 29a8f8b4016..0b62cccf9f5 100644 --- a/src/admin/components/elements/Drawer/index.tsx +++ b/src/admin/components/elements/Drawer/index.tsx @@ -1,15 +1,12 @@ -import React, { createContext, useCallback, useContext, useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; import { Modal, useModal } from '@faceless-ui/modal'; import { useWindowInfo } from '@faceless-ui/window-info'; import { Props, TogglerProps } from './types'; import './index.scss'; +import { EditDepthContext, useEditDepth } from '../../utilities/EditDepth'; const baseClass = 'drawer'; -export const DrawerDepthContext = createContext(0); - -export const useDrawerDepth = (): number => useContext(DrawerDepthContext); - const zBase = 100; const formatDrawerSlug = ({ @@ -29,7 +26,7 @@ export const DrawerToggler: React.FC<TogglerProps> = ({ ...rest }) => { const { openModal } = useModal(); - const drawerDepth = useDrawerDepth(); + const drawerDepth = useEditDepth(); const handleClick = useCallback((e) => { openModal(formatSlug !== false ? formatDrawerSlug({ slug, depth: drawerDepth }) : slug); @@ -55,7 +52,7 @@ export const Drawer: React.FC<Props> = ({ }) => { const { toggleModal, modalState } = useModal(); const { breakpoints: { m: midBreak } } = useWindowInfo(); - const drawerDepth = useDrawerDepth(); + const drawerDepth = useEditDepth(); const [isOpen, setIsOpen] = useState(false); const [modalSlug] = useState(() => (formatSlug !== false ? formatDrawerSlug({ slug, depth: drawerDepth }) : slug)); @@ -91,23 +88,11 @@ export const Drawer: React.FC<Props> = ({ </button> <div className={`${baseClass}__content`}> <div className={`${baseClass}__content-children`}> - <DrawerDepthContext.Provider value={drawerDepth + 1}> + <EditDepthContext.Provider value={drawerDepth + 1}> {children} - </DrawerDepthContext.Provider> + </EditDepthContext.Provider> </div> </div> </Modal> ); }; - -export type IDrawerContext = { - Drawer: React.FC<Props>, - DrawerToggler: React.FC<TogglerProps> -} - -export const DrawerContext = createContext({ - Drawer, - DrawerToggler, -}); - -export const useDrawer = (): IDrawerContext => useContext(DrawerContext);
316f0722d8d8945dd1bbe4025b77954a550db9e5
2024-02-29 23:01:17
Jacob Fletcher
chore(next): removes app dir
false
removes app dir
chore
diff --git a/packages/next/src/app/(payload)/admin/(dashboard)/account/page.tsx b/packages/next/src/app/(payload)/admin/(dashboard)/account/page.tsx deleted file mode 100644 index c17fe0a013a..00000000000 --- a/packages/next/src/app/(payload)/admin/(dashboard)/account/page.tsx +++ /dev/null @@ -1,8 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import { Account, generateMetadata as generateMeta } from '@payloadcms/next/pages/Account' -import config from '@payload-config' - -export const generateMetadata = async () => generateMeta({ config }) - -export default ({ searchParams }) => Account({ config, searchParams }) diff --git a/packages/next/src/app/(payload)/admin/(dashboard)/collections/[collection]/[...segments]/layout.tsx b/packages/next/src/app/(payload)/admin/(dashboard)/collections/[collection]/[...segments]/layout.tsx deleted file mode 100644 index 1129ec4e0a1..00000000000 --- a/packages/next/src/app/(payload)/admin/(dashboard)/collections/[collection]/[...segments]/layout.tsx +++ /dev/null @@ -1,11 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import React from 'react' -import { DocumentLayout } from '@payloadcms/next/layouts/Document' -import configPromise from '@payload-config' - -export default async ({ children, params }: { children: React.ReactNode; params }) => ( - <DocumentLayout config={configPromise} collectionSlug={params.collection}> - {children} - </DocumentLayout> -) diff --git a/packages/next/src/app/(payload)/admin/(dashboard)/collections/[collection]/[...segments]/page.tsx b/packages/next/src/app/(payload)/admin/(dashboard)/collections/[collection]/[...segments]/page.tsx deleted file mode 100644 index e11a1fcd028..00000000000 --- a/packages/next/src/app/(payload)/admin/(dashboard)/collections/[collection]/[...segments]/page.tsx +++ /dev/null @@ -1,13 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import { Document, generateMetadata as generateMeta } from '@payloadcms/next/pages/Document' -import config from '@payload-config' - -export const generateMetadata = async ({ params }) => generateMeta({ config, params }) - -export default ({ params, searchParams }) => - Document({ - params, - searchParams, - config, - }) diff --git a/packages/next/src/app/(payload)/admin/(dashboard)/collections/[collection]/page.tsx b/packages/next/src/app/(payload)/admin/(dashboard)/collections/[collection]/page.tsx deleted file mode 100644 index 0fa74fed4e4..00000000000 --- a/packages/next/src/app/(payload)/admin/(dashboard)/collections/[collection]/page.tsx +++ /dev/null @@ -1,14 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import { ListView, generateMetadata as generateMeta } from '@payloadcms/next/pages/List' -import config from '@payload-config' - -export const generateMetadata = async ({ params }) => generateMeta({ config, params }) - -export default ({ params, searchParams }) => - ListView({ - collectionSlug: params.collection, - searchParams, - config, - route: `/collections/${params.collection + (params.segments?.length ? `/${params.segments.join('/')}` : '')}`, - }) diff --git a/packages/next/src/app/(payload)/admin/(dashboard)/globals/[global]/[[...segments]]/page.tsx b/packages/next/src/app/(payload)/admin/(dashboard)/globals/[global]/[[...segments]]/page.tsx deleted file mode 100644 index 29ad7d580ca..00000000000 --- a/packages/next/src/app/(payload)/admin/(dashboard)/globals/[global]/[[...segments]]/page.tsx +++ /dev/null @@ -1,13 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import { Document, generateMetadata as generateMeta } from '@payloadcms/next/pages/Document' -import config from '@payload-config' - -export const generateMetadata = async ({ params }) => generateMeta({ config, params }) - -export default ({ params, searchParams }) => - Document({ - config, - params, - searchParams, - }) diff --git a/packages/next/src/app/(payload)/admin/(dashboard)/globals/[global]/layout.tsx b/packages/next/src/app/(payload)/admin/(dashboard)/globals/[global]/layout.tsx deleted file mode 100644 index e8d9a9441fb..00000000000 --- a/packages/next/src/app/(payload)/admin/(dashboard)/globals/[global]/layout.tsx +++ /dev/null @@ -1,11 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import React from 'react' -import { DocumentLayout } from '@payloadcms/next/layouts/Document' -import configPromise from '@payload-config' - -export default async ({ children, params }: { children: React.ReactNode; params }) => ( - <DocumentLayout config={configPromise} globalSlug={params.global}> - {children} - </DocumentLayout> -) diff --git a/packages/next/src/app/(payload)/admin/(dashboard)/layout.tsx b/packages/next/src/app/(payload)/admin/(dashboard)/layout.tsx deleted file mode 100644 index f68b4da4e25..00000000000 --- a/packages/next/src/app/(payload)/admin/(dashboard)/layout.tsx +++ /dev/null @@ -1,9 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import React from 'react' -import { AdminLayout } from '@payloadcms/next/layouts/Admin' -import configPromise from '@payload-config' - -export default async ({ children }: { children: React.ReactNode }) => ( - <AdminLayout config={configPromise}>{children}</AdminLayout> -) diff --git a/packages/next/src/app/(payload)/admin/(dashboard)/page.tsx b/packages/next/src/app/(payload)/admin/(dashboard)/page.tsx deleted file mode 100644 index f316270ca50..00000000000 --- a/packages/next/src/app/(payload)/admin/(dashboard)/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import { Dashboard, generateMetadata as generateMeta } from '@payloadcms/next/pages/Dashboard' -import { Metadata } from 'next' -import config from '@payload-config' - -export const generateMetadata = async (): Promise<Metadata> => generateMeta({ config }) - -export default async ({ searchParams }) => Dashboard({ config, searchParams }) diff --git a/packages/next/src/app/(payload)/admin/create-first-user/page.tsx b/packages/next/src/app/(payload)/admin/create-first-user/page.tsx deleted file mode 100644 index 4d2afb2840b..00000000000 --- a/packages/next/src/app/(payload)/admin/create-first-user/page.tsx +++ /dev/null @@ -1,13 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import React from 'react' -import { - CreateFirstUser, - generateMetadata as generateMeta, -} from '@payloadcms/next/pages/CreateFirstUser' -import { Metadata } from 'next' -import config from '@payload-config' - -export const generateMetadata = async (): Promise<Metadata> => generateMeta({ config }) - -export default async () => <CreateFirstUser config={config} /> diff --git a/packages/next/src/app/(payload)/admin/forgot/page.tsx b/packages/next/src/app/(payload)/admin/forgot/page.tsx deleted file mode 100644 index 036f58ab2fa..00000000000 --- a/packages/next/src/app/(payload)/admin/forgot/page.tsx +++ /dev/null @@ -1,13 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import React from 'react' -import { - ForgotPassword, - generateMetadata as generateMeta, -} from '@payloadcms/next/pages/ForgotPassword' -import { Metadata } from 'next' -import config from '@payload-config' - -export const generateMetadata = async (): Promise<Metadata> => generateMeta({ config }) - -export default async () => <ForgotPassword config={config} /> diff --git a/packages/next/src/app/(payload)/admin/login/page.tsx b/packages/next/src/app/(payload)/admin/login/page.tsx deleted file mode 100644 index 0c1a4f92f31..00000000000 --- a/packages/next/src/app/(payload)/admin/login/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import React from 'react' -import { Login, generateMetadata as generateMeta } from '@payloadcms/next/pages/Login' -import { Metadata } from 'next' -import config from '@payload-config' - -export const generateMetadata = async (): Promise<Metadata> => generateMeta({ config }) - -export default async ({ searchParams }) => <Login config={config} searchParams={searchParams} /> diff --git a/packages/next/src/app/(payload)/admin/logout-inactivity/page.tsx b/packages/next/src/app/(payload)/admin/logout-inactivity/page.tsx deleted file mode 100644 index 1edb8e41a03..00000000000 --- a/packages/next/src/app/(payload)/admin/logout-inactivity/page.tsx +++ /dev/null @@ -1,12 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import React from 'react' -import { Logout, generateMetadata as generateMeta } from '@payloadcms/next/pages/Logout' -import { Metadata } from 'next' -import config from '@payload-config' - -export const generateMetadata = async (): Promise<Metadata> => generateMeta({ config }) - -export default async ({ searchParams }) => ( - <Logout config={config} searchParams={searchParams} inactivity /> -) diff --git a/packages/next/src/app/(payload)/admin/logout/page.tsx b/packages/next/src/app/(payload)/admin/logout/page.tsx deleted file mode 100644 index e0b81ec2b30..00000000000 --- a/packages/next/src/app/(payload)/admin/logout/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import React from 'react' -import { Logout, generateMetadata as generateMeta } from '@payloadcms/next/pages/Logout' -import { Metadata } from 'next' -import config from '@payload-config' - -export const generateMetadata = async (): Promise<Metadata> => generateMeta({ config }) - -export default async ({ searchParams }) => <Logout config={config} searchParams={searchParams} /> diff --git a/packages/next/src/app/(payload)/admin/reset/[token]/page.tsx b/packages/next/src/app/(payload)/admin/reset/[token]/page.tsx deleted file mode 100644 index dede4ba214b..00000000000 --- a/packages/next/src/app/(payload)/admin/reset/[token]/page.tsx +++ /dev/null @@ -1,13 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import React from 'react' -import { - ResetPassword, - generateMetadata as generateMeta, -} from '@payloadcms/next/pages/ResetPassword' -import { Metadata } from 'next' -import config from '@payload-config' - -export const generateMetadata = async (): Promise<Metadata> => generateMeta({ config }) - -export default async ({ params }) => <ResetPassword config={config} token={params.token} /> diff --git a/packages/next/src/app/(payload)/admin/unauthorized/page.tsx b/packages/next/src/app/(payload)/admin/unauthorized/page.tsx deleted file mode 100644 index 3f53a2a9bde..00000000000 --- a/packages/next/src/app/(payload)/admin/unauthorized/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import React from 'react' -import { Unauthorized, generateMetadata as generateMeta } from '@payloadcms/next/pages/Unauthorized' -import { Metadata } from 'next' -import config from '@payload-config' - -export const generateMetadata = async (): Promise<Metadata> => generateMeta({ config }) - -export default async () => <Unauthorized config={config} /> diff --git a/packages/next/src/app/(payload)/admin/verify/[token]/page.tsx b/packages/next/src/app/(payload)/admin/verify/[token]/page.tsx deleted file mode 100644 index 03b35a35e1d..00000000000 --- a/packages/next/src/app/(payload)/admin/verify/[token]/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import React from 'react' -import { Verify, generateMetadata as generateMeta } from '@payloadcms/next/pages/Verify' -import { Metadata } from 'next' -import config from '@payload-config' - -export const generateMetadata = async (): Promise<Metadata> => generateMeta({ config }) - -export default async ({ params }) => <Verify config={config} token={params.token} /> diff --git a/packages/next/src/app/(payload)/api/[...slug]/route.ts b/packages/next/src/app/(payload)/api/[...slug]/route.ts deleted file mode 100644 index a131881fe30..00000000000 --- a/packages/next/src/app/(payload)/api/[...slug]/route.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY it because it could be re-written at any time. */ -import config from '@payload-config' -import { REST_GET, REST_DELETE, REST_PATCH, REST_POST } from '@payloadcms/next/routes' - -export const GET = REST_GET(config) -export const POST = REST_POST(config) -export const DELETE = REST_DELETE(config) -export const PATCH = REST_PATCH(config) diff --git a/packages/next/src/app/(payload)/api/[collection]/file/[filename]/route.ts b/packages/next/src/app/(payload)/api/[collection]/file/[filename]/route.ts deleted file mode 100644 index f34a6a668c9..00000000000 --- a/packages/next/src/app/(payload)/api/[collection]/file/[filename]/route.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY it because it could be re-written at any time. */ -import config from '@payload-config' -import { GET_STATIC_FILE } from '@payloadcms/next/routes' - -export const GET = GET_STATIC_FILE(config) diff --git a/packages/next/src/app/(payload)/api/graphql-playground/route.ts b/packages/next/src/app/(payload)/api/graphql-playground/route.ts deleted file mode 100644 index 7b7f279983f..00000000000 --- a/packages/next/src/app/(payload)/api/graphql-playground/route.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY it because it could be re-written at any time. */ -import config from '@payload-config' -import { GRAPHQL_PLAYGROUND_GET } from '@payloadcms/next/routes' - -export const GET = GRAPHQL_PLAYGROUND_GET(config) diff --git a/packages/next/src/app/(payload)/api/graphql/route.ts b/packages/next/src/app/(payload)/api/graphql/route.ts deleted file mode 100644 index c2723e439fb..00000000000 --- a/packages/next/src/app/(payload)/api/graphql/route.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY it because it could be re-written at any time. */ -import config from '@payload-config' -import { GRAPHQL_POST } from '@payloadcms/next/routes' - -export const POST = GRAPHQL_POST(config) diff --git a/packages/next/src/app/(payload)/layout.tsx b/packages/next/src/app/(payload)/layout.tsx deleted file mode 100644 index e957ffafb2d..00000000000 --- a/packages/next/src/app/(payload)/layout.tsx +++ /dev/null @@ -1,9 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import React from 'react' -import { RootLayout } from '@payloadcms/next/layouts/Root' -import configPromise from '@payload-config' - -export default async ({ children }: { children: React.ReactNode }) => ( - <RootLayout config={configPromise}>{children}</RootLayout> -) diff --git a/packages/next/src/app/(payload)/page.tsx b/packages/next/src/app/(payload)/page.tsx deleted file mode 100644 index bf29bc29f2e..00000000000 --- a/packages/next/src/app/(payload)/page.tsx +++ /dev/null @@ -1,6 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ -import { RootPage } from '@payloadcms/next/pages/Root' -import config from '@payload-config' - -export default () => RootPage({ config }) diff --git a/packages/next/src/app/api/[...slug]/route.ts b/packages/next/src/app/api/[...slug]/route.ts deleted file mode 100644 index b178b1ce5dc..00000000000 --- a/packages/next/src/app/api/[...slug]/route.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY it because it could be re-written at any time. */ -import { REST_DELETE, REST_GET, REST_PATCH, REST_POST } from '@payloadcms/next/routes' -import config from 'payload-config' - -export const GET = REST_GET(config) -export const POST = REST_POST(config) -export const DELETE = REST_DELETE(config) -export const PATCH = REST_PATCH(config) diff --git a/packages/next/src/app/api/[collection]/file/[filename]/route.ts b/packages/next/src/app/api/[collection]/file/[filename]/route.ts deleted file mode 100644 index 4faaa09c021..00000000000 --- a/packages/next/src/app/api/[collection]/file/[filename]/route.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY it because it could be re-written at any time. */ -import { GET_STATIC_FILE } from '@payloadcms/next/routes' -import config from 'payload-config' - -export const GET = GET_STATIC_FILE(config) diff --git a/packages/next/src/app/api/graphql-playground/route.ts b/packages/next/src/app/api/graphql-playground/route.ts deleted file mode 100644 index 0c03d920a4c..00000000000 --- a/packages/next/src/app/api/graphql-playground/route.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY it because it could be re-written at any time. */ -import { GRAPHQL_PLAYGROUND_GET } from '@payloadcms/next/routes' - -export const GET = GRAPHQL_PLAYGROUND_GET diff --git a/packages/next/src/app/api/graphql/route.ts b/packages/next/src/app/api/graphql/route.ts deleted file mode 100644 index 87e7220832b..00000000000 --- a/packages/next/src/app/api/graphql/route.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ -/* DO NOT MODIFY it because it could be re-written at any time. */ -import { GRAPHQL_POST } from '@payloadcms/next/routes' -import config from 'payload-config' - -export const POST = GRAPHQL_POST(config)
74f89239223fe64682c2a96c820b151f8f109089
2023-10-09 06:07:32
Dan Ribbens
fix: default rateLimit window changed from 1.5 to 15 minutes (#3486)
false
default rateLimit window changed from 1.5 to 15 minutes (#3486)
fix
diff --git a/packages/payload/src/config/defaults.ts b/packages/payload/src/config/defaults.ts index f5d329227dd..3404bed6516 100644 --- a/packages/payload/src/config/defaults.ts +++ b/packages/payload/src/config/defaults.ts @@ -43,7 +43,7 @@ export const defaults: Omit<Config, 'db' | 'editor'> = { maxDepth: 10, rateLimit: { max: 500, - window: 15 * 60 * 100, // 15min default, + window: 15 * 60 * 1000, // 15min default, }, routes: { admin: '/admin', diff --git a/packages/payload/src/config/types.ts b/packages/payload/src/config/types.ts index 4b4a90ab980..1e2006088cc 100644 --- a/packages/payload/src/config/types.ts +++ b/packages/payload/src/config/types.ts @@ -14,7 +14,6 @@ import type { Configuration } from 'webpack' import type { DocumentTab } from '../admin/components/elements/DocumentHeader/Tabs/types' import type { RichTextAdapter } from '../admin/components/forms/field-types/RichText/types' import type { ContextType } from '../admin/components/utilities/DocumentInfo/types' -import type { CollectionEditViewProps, GlobalEditViewProps } from '../admin/components/views/types' import type { User } from '../auth/types' import type { PayloadBundler } from '../bundlers/types' import type { @@ -43,10 +42,10 @@ export type Plugin = (config: Config) => Config | Promise<Config> export type LivePreviewConfig = { /** - Device breakpoints to use for the `iframe` of the Live Preview window. - Options are displayed in the Live Preview toolbar. - The `responsive` breakpoint is included by default. - */ + Device breakpoints to use for the `iframe` of the Live Preview window. + Options are displayed in the Live Preview toolbar. + The `responsive` breakpoint is included by default. + */ breakpoints?: { height: number | string label: string @@ -54,11 +53,11 @@ export type LivePreviewConfig = { width: number | string }[] /** - The URL of the frontend application. This will be rendered within an `iframe` as its `src`. - Payload will send a `window.postMessage()` to this URL with the document data in real-time. - The frontend application is responsible for receiving the message and updating the UI accordingly. - Use the `useLivePreview` hook to get started in React applications. - */ + The URL of the frontend application. This will be rendered within an `iframe` as its `src`. + Payload will send a `window.postMessage()` to this URL with the document data in real-time. + The frontend application is responsible for receiving the message and updating the UI accordingly. + Use the `useLivePreview` hook to get started in React applications. + */ url?: | ((args: { data: Record<string, any>; documentInfo: ContextType; locale: Locale }) => string) | string @@ -637,7 +636,7 @@ export type Config = { * * @default * { - * window: 15 * 60 * 100, // 1.5 minutes, + * window: 15 * 60 * 1000, // 15 minutes, * max: 500, * } */ diff --git a/test/buildConfigWithDefaults.ts b/test/buildConfigWithDefaults.ts index dc6bafdaadc..393d5f032ab 100644 --- a/test/buildConfigWithDefaults.ts +++ b/test/buildConfigWithDefaults.ts @@ -36,7 +36,7 @@ export function buildConfigWithDefaults(testConfig?: Partial<Config>): Promise<S editor: slateEditor({}), rateLimit: { max: 9999999999, - window: 15 * 60 * 100, // 15min default, + window: 15 * 60 * 1000, // 15min default, }, telemetry: false, ...testConfig,
cddb08de1a7f0d88d3a1530badd469a09f48bf18
2024-04-11 02:41:20
Elliot DeNolf
chore: ignore payload/i18n
false
ignore payload/i18n
chore
diff --git a/packages/payload/.gitignore b/packages/payload/.gitignore index ffc0797a2d1..0a54c684f1a 100644 --- a/packages/payload/.gitignore +++ b/packages/payload/.gitignore @@ -24,3 +24,4 @@ /node.d.ts /uploads.js /uploads.d.ts +/i18n
5fae18e9402ac0ee97520aa29b3cbaf8817cf6e7
2023-01-04 23:16:18
James
chore: passing tests
false
passing tests
chore
diff --git a/package.json b/package.json index 1f60de7ae9c..029c866bf84 100644 --- a/package.json +++ b/package.json @@ -276,6 +276,7 @@ "jest": "^29.3.1", "jest-environment-jsdom": "^29.3.1", "mongodb-memory-server": "^7.2.0", + "node-fetch": "2", "nodemon": "^2.0.6", "passport-strategy": "^1.0.0", "release-it": "^15.5.0", diff --git a/test/dev.js b/test/dev.js index 43d184b3606..cfc70de5c54 100644 --- a/test/dev.js +++ b/test/dev.js @@ -21,6 +21,7 @@ process.env.PAYLOAD_CONFIG_PATH = configPath; process.env.PAYLOAD_DROP_DATABASE = 'true'; swcRegister({ + sourceMaps: true, jsc: { parser: { syntax: 'typescript', diff --git a/test/helpers/rest.ts b/test/helpers/rest.ts index 67d4c2e75b6..15b146c8b67 100644 --- a/test/helpers/rest.ts +++ b/test/helpers/rest.ts @@ -1,12 +1,11 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import qs from 'qs'; +import fetch from 'node-fetch'; import type { Config } from '../../src/config/types'; import type { PaginatedDocs } from '../../src/mongoose/types'; import type { Where } from '../../src/types'; import { devUser } from '../credentials'; -require('isomorphic-fetch'); - type Args = { serverURL: string; defaultSlug: string; diff --git a/yarn.lock b/yarn.lock index f3d4afcf38c..efc4b8248c0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8650,7 +8650,7 @@ node-domexception@^1.0.0: resolved "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== [email protected], node-fetch@^2.6.1, node-fetch@^2.6.7: +node-fetch@2, [email protected], node-fetch@^2.6.1, node-fetch@^2.6.7: version "2.6.7" resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
48aa27ce701e44561edf442ee6c248b007ecafcb
2022-02-11 01:22:58
James
fix: improperly typed local create method
false
improperly typed local create method
fix
diff --git a/src/collections/operations/local/create.ts b/src/collections/operations/local/create.ts index e216d554d60..ead3f763e24 100644 --- a/src/collections/operations/local/create.ts +++ b/src/collections/operations/local/create.ts @@ -14,7 +14,7 @@ export type Options<T> = { showHiddenFields?: boolean filePath?: string overwriteExistingFiles?: boolean - req: PayloadRequest + req?: PayloadRequest draft?: boolean }
69af8d9c83ddd5a6752b59ec41e0807002a41394
2023-10-12 23:13:46
Alessio Gravili
chore: remove duplicate z-index property
false
remove duplicate z-index property
chore
diff --git a/packages/richtext-lexical/src/field/features/Link/plugins/floatingLinkEditor/index.scss b/packages/richtext-lexical/src/field/features/Link/plugins/floatingLinkEditor/index.scss index 3a04f658112..71d74a51165 100644 --- a/packages/richtext-lexical/src/field/features/Link/plugins/floatingLinkEditor/index.scss +++ b/packages/richtext-lexical/src/field/features/Link/plugins/floatingLinkEditor/index.scss @@ -16,7 +16,6 @@ html[data-theme='light'] { position: absolute; top: 0; left: 0; - z-index: 10; opacity: 0; border-radius: 6.25px; transition: opacity 0.2s;
cb6ceaec7644c8a2ff9b465bc4599b18b9980ee3
2024-11-17 22:13:43
Elliot DeNolf
chore(release): v3.0.0-beta.134 [skip ci]
false
v3.0.0-beta.134 [skip ci]
chore
diff --git a/package.json b/package.json index 46d159f3078..9ec5b197acd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload-monorepo", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "private": true, "type": "module", "scripts": { diff --git a/packages/create-payload-app/package.json b/packages/create-payload-app/package.json index a0852975339..a59798cf5b5 100644 --- a/packages/create-payload-app/package.json +++ b/packages/create-payload-app/package.json @@ -1,6 +1,6 @@ { "name": "create-payload-app", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "homepage": "https://payloadcms.com", "repository": { "type": "git", diff --git a/packages/db-mongodb/package.json b/packages/db-mongodb/package.json index 0f8fab12fc2..20f8de9e878 100644 --- a/packages/db-mongodb/package.json +++ b/packages/db-mongodb/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/db-mongodb", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "The officially supported MongoDB database adapter for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/db-postgres/package.json b/packages/db-postgres/package.json index 38e44e71a5d..80a160d8dd8 100644 --- a/packages/db-postgres/package.json +++ b/packages/db-postgres/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/db-postgres", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "The officially supported Postgres database adapter for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/db-sqlite/package.json b/packages/db-sqlite/package.json index 576163e4417..f54ffe2c3af 100644 --- a/packages/db-sqlite/package.json +++ b/packages/db-sqlite/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/db-sqlite", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "The officially supported SQLite database adapter for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/db-vercel-postgres/package.json b/packages/db-vercel-postgres/package.json index 0f49d0057f9..0d2a329db76 100644 --- a/packages/db-vercel-postgres/package.json +++ b/packages/db-vercel-postgres/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/db-vercel-postgres", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Vercel Postgres adapter for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/drizzle/package.json b/packages/drizzle/package.json index 3c2ed158bdb..f76d5af4828 100644 --- a/packages/drizzle/package.json +++ b/packages/drizzle/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/drizzle", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "A library of shared functions used by different payload database adapters", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/email-nodemailer/package.json b/packages/email-nodemailer/package.json index 2243bf48f8f..747be47a295 100644 --- a/packages/email-nodemailer/package.json +++ b/packages/email-nodemailer/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/email-nodemailer", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Payload Nodemailer Email Adapter", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/email-resend/package.json b/packages/email-resend/package.json index c69ffa5679e..bf89474552e 100644 --- a/packages/email-resend/package.json +++ b/packages/email-resend/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/email-resend", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Payload Resend Email Adapter", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/graphql/package.json b/packages/graphql/package.json index 32feaff6ff4..a614b976edc 100644 --- a/packages/graphql/package.json +++ b/packages/graphql/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/graphql", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "homepage": "https://payloadcms.com", "repository": { "type": "git", diff --git a/packages/live-preview-react/package.json b/packages/live-preview-react/package.json index 9f873379f37..3b4914d2a32 100644 --- a/packages/live-preview-react/package.json +++ b/packages/live-preview-react/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/live-preview-react", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "The official React SDK for Payload Live Preview", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/live-preview-vue/package.json b/packages/live-preview-vue/package.json index a69493a7be3..e39ba7f90d3 100644 --- a/packages/live-preview-vue/package.json +++ b/packages/live-preview-vue/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/live-preview-vue", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "The official Vue SDK for Payload Live Preview", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/live-preview/package.json b/packages/live-preview/package.json index 9839de6045c..63da48a0b4c 100644 --- a/packages/live-preview/package.json +++ b/packages/live-preview/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/live-preview", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "The official live preview JavaScript SDK for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/next/package.json b/packages/next/package.json index a184360d6f0..1398ed95729 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/next", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "homepage": "https://payloadcms.com", "repository": { "type": "git", diff --git a/packages/payload-cloud/package.json b/packages/payload-cloud/package.json index 4bd340ef92c..7849e54800f 100644 --- a/packages/payload-cloud/package.json +++ b/packages/payload-cloud/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/payload-cloud", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "The official Payload Cloud plugin", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/payload/package.json b/packages/payload/package.json index 37cc64821f4..ed40d1d46af 100644 --- a/packages/payload/package.json +++ b/packages/payload/package.json @@ -1,6 +1,6 @@ { "name": "payload", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Node, React, Headless CMS and Application Framework built on Next.js", "keywords": [ "admin panel", diff --git a/packages/plugin-cloud-storage/package.json b/packages/plugin-cloud-storage/package.json index b69d8eab12d..d4becbbcb4f 100644 --- a/packages/plugin-cloud-storage/package.json +++ b/packages/plugin-cloud-storage/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-cloud-storage", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "The official cloud storage plugin for Payload CMS", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/plugin-form-builder/package.json b/packages/plugin-form-builder/package.json index 8aec5da429c..6fd285ac818 100644 --- a/packages/plugin-form-builder/package.json +++ b/packages/plugin-form-builder/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-form-builder", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Form builder plugin for Payload CMS", "keywords": [ "payload", diff --git a/packages/plugin-nested-docs/package.json b/packages/plugin-nested-docs/package.json index a4b6eb9a17e..dc88f3e776c 100644 --- a/packages/plugin-nested-docs/package.json +++ b/packages/plugin-nested-docs/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-nested-docs", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "The official Nested Docs plugin for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/plugin-redirects/package.json b/packages/plugin-redirects/package.json index 22853ea7412..fb58dbed7f6 100644 --- a/packages/plugin-redirects/package.json +++ b/packages/plugin-redirects/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-redirects", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Redirects plugin for Payload", "keywords": [ "payload", diff --git a/packages/plugin-search/package.json b/packages/plugin-search/package.json index a0dc64ecff5..56f94bb4250 100644 --- a/packages/plugin-search/package.json +++ b/packages/plugin-search/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-search", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Search plugin for Payload", "keywords": [ "payload", diff --git a/packages/plugin-sentry/package.json b/packages/plugin-sentry/package.json index 4ee7e3e3a77..011e116fc2e 100644 --- a/packages/plugin-sentry/package.json +++ b/packages/plugin-sentry/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-sentry", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Sentry plugin for Payload", "keywords": [ "payload", diff --git a/packages/plugin-seo/package.json b/packages/plugin-seo/package.json index 494f5b4ca52..4c83c7ed9d9 100644 --- a/packages/plugin-seo/package.json +++ b/packages/plugin-seo/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-seo", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "SEO plugin for Payload", "keywords": [ "payload", diff --git a/packages/plugin-stripe/package.json b/packages/plugin-stripe/package.json index 0d4c3354a28..d152ed2b9ad 100644 --- a/packages/plugin-stripe/package.json +++ b/packages/plugin-stripe/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-stripe", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Stripe plugin for Payload", "keywords": [ "payload", diff --git a/packages/richtext-lexical/package.json b/packages/richtext-lexical/package.json index c5a3881cb94..831342996cd 100644 --- a/packages/richtext-lexical/package.json +++ b/packages/richtext-lexical/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/richtext-lexical", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "The officially supported Lexical richtext adapter for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/richtext-slate/package.json b/packages/richtext-slate/package.json index d8a873f7b50..b77167ed3b3 100644 --- a/packages/richtext-slate/package.json +++ b/packages/richtext-slate/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/richtext-slate", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "The officially supported Slate richtext adapter for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/storage-azure/package.json b/packages/storage-azure/package.json index 93472cfa231..17f9e8f20e7 100644 --- a/packages/storage-azure/package.json +++ b/packages/storage-azure/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/storage-azure", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Payload storage adapter for Azure Blob Storage", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/storage-gcs/package.json b/packages/storage-gcs/package.json index f873b6f4986..1ec22f94829 100644 --- a/packages/storage-gcs/package.json +++ b/packages/storage-gcs/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/storage-gcs", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Payload storage adapter for Google Cloud Storage", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/storage-s3/package.json b/packages/storage-s3/package.json index 1ff1bb82202..8ae333a5a55 100644 --- a/packages/storage-s3/package.json +++ b/packages/storage-s3/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/storage-s3", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Payload storage adapter for Amazon S3", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/storage-uploadthing/package.json b/packages/storage-uploadthing/package.json index cad255f1730..5e8c264c9b6 100644 --- a/packages/storage-uploadthing/package.json +++ b/packages/storage-uploadthing/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/storage-uploadthing", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Payload storage adapter for uploadthing", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/storage-vercel-blob/package.json b/packages/storage-vercel-blob/package.json index e9c4c04c05f..141f0de56e8 100644 --- a/packages/storage-vercel-blob/package.json +++ b/packages/storage-vercel-blob/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/storage-vercel-blob", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "description": "Payload storage adapter for Vercel Blob Storage", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/translations/package.json b/packages/translations/package.json index 8ee0a6e40df..4666caef9c4 100644 --- a/packages/translations/package.json +++ b/packages/translations/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/translations", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "homepage": "https://payloadcms.com", "repository": { "type": "git", diff --git a/packages/ui/package.json b/packages/ui/package.json index f8ef2580178..4984bf0700b 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/ui", - "version": "3.0.0-beta.133", + "version": "3.0.0-beta.134", "homepage": "https://payloadcms.com", "repository": { "type": "git",
c50f4237a43dbd48218cfab88084b532b75f055a
2024-12-17 01:12:56
Said Akhrarov
docs: fix links in rich-text referencing old lexical sections (#9972)
false
fix links in rich-text referencing old lexical sections (#9972)
docs
diff --git a/docs/rich-text/building-custom-features.mdx b/docs/rich-text/building-custom-features.mdx index 6c298754061..d4484780ccc 100644 --- a/docs/rich-text/building-custom-features.mdx +++ b/docs/rich-text/building-custom-features.mdx @@ -79,7 +79,7 @@ This allows you to add i18n translations scoped to your feature. This specific e ### Markdown Transformers#server-feature-markdown-transformers -The Server Feature, just like the Client Feature, allows you to add markdown transformers. Markdown transformers on the server are used when [converting the editor from or to markdown](/docs/lexical/converters#markdown-lexical). +The Server Feature, just like the Client Feature, allows you to add markdown transformers. Markdown transformers on the server are used when [converting the editor from or to markdown](/docs/rich-text/converters#markdown-lexical). ```ts import { createServerFeature } from '@payloadcms/richtext-lexical'; diff --git a/docs/rich-text/overview.mdx b/docs/rich-text/overview.mdx index d3cfc31f369..cab44b992c9 100644 --- a/docs/rich-text/overview.mdx +++ b/docs/rich-text/overview.mdx @@ -180,7 +180,7 @@ Notice how even the toolbars are features? That's how extensible our lexical edi ## Creating your own, custom Feature -You can find more information about creating your own feature in our [building custom feature docs](/docs/lexical/building-custom-features). +You can find more information about creating your own feature in our [building custom feature docs](/docs/rich-text/building-custom-features). ## TypeScript
037ccdd96e250b506ceccf8222a0fa2345fe1d84
2023-08-02 02:23:45
Jacob Fletcher
chore(examples): updates preview example (#3099)
false
updates preview example (#3099)
chore
diff --git a/examples/preview/next-app/.env.example b/examples/draft-preview/next-app/.env.example similarity index 100% rename from examples/preview/next-app/.env.example rename to examples/draft-preview/next-app/.env.example diff --git a/examples/preview/next-app/.eslintrc.js b/examples/draft-preview/next-app/.eslintrc.js similarity index 100% rename from examples/preview/next-app/.eslintrc.js rename to examples/draft-preview/next-app/.eslintrc.js diff --git a/examples/preview/next-app/.gitignore b/examples/draft-preview/next-app/.gitignore similarity index 100% rename from examples/preview/next-app/.gitignore rename to examples/draft-preview/next-app/.gitignore diff --git a/examples/preview/cms/.prettierrc.js b/examples/draft-preview/next-app/.prettierrc.js similarity index 100% rename from examples/preview/cms/.prettierrc.js rename to examples/draft-preview/next-app/.prettierrc.js diff --git a/examples/preview/next-app/README.md b/examples/draft-preview/next-app/README.md similarity index 72% rename from examples/preview/next-app/README.md rename to examples/draft-preview/next-app/README.md index df0e45c2945..b4d9b169e65 100644 --- a/examples/preview/next-app/README.md +++ b/examples/draft-preview/next-app/README.md @@ -1,14 +1,14 @@ -# Payload Preview Example Front-End +# Payload Draft Preview Example Front-End -This is a [Next.js](https://nextjs.org) app using the [App Router](https://nextjs.org/docs/app). It was made explicitly for Payload's [Preview Example](https://github.com/payloadcms/payload/tree/master/examples/preview/cms). +This is a [Next.js](https://nextjs.org) app using the [App Router](https://nextjs.org/docs/app). It was made explicitly for Payload's [Draft Preview Example](https://github.com/payloadcms/payload/tree/master/examples/draft-preview). -> This example uses the App Router, the latest API of Next.js. If your app is using the legacy [Pages Router](https://nextjs.org/docs/pages), check out the official [Pages Router Example](https://github.com/payloadcms/payload/tree/master/examples/preview/next-pages). +> This example uses the App Router, the latest API of Next.js. If your app is using the legacy [Pages Router](https://nextjs.org/docs/pages), check out the official [Pages Router Example](https://github.com/payloadcms/payload/tree/master/examples/draft-preview/next-pages). ## Getting Started ### Payload -First you'll need a running [Payload](https://github.com/payloadcms/payload) app. If you have not done so already, open up the `cms` folder and follow the setup instructions. Take note of your `serverURL`, you'll need this in the next step. +First you'll need a running Payload app. There is one made explicitly for this example and [can be found here](https://github.com/payloadcms/payload/tree/master/examples/draft-preview/payload). If you have not done so already, clone it down and follow the setup instructions there. This will provide all the necessary APIs that your Next.js app requires for authentication. ### Next.js @@ -18,7 +18,7 @@ First you'll need a running [Payload](https://github.com/payloadcms/payload) app 4. `yarn dev` or `npm run dev` to start the server 5. `open http://localhost:3001` to see the result -Once running you will find a couple seeded pages on your local environment with some basic instructions. You can also start editing the pages by modifying the documents within Payload. See the [Preview Example](https://github.com/payloadcms/payload/tree/master/examples/preview/cms) for full details. +Once running you will find a couple seeded pages on your local environment with some basic instructions. You can also start editing the pages by modifying the documents within Payload. See the [Draft Preview Example](https://github.com/payloadcms/payload/tree/master/examples/draft-preview/payload) for full details. ## Learn More diff --git a/examples/preview/next-app/app/[slug]/index.module.scss b/examples/draft-preview/next-app/app/[slug]/index.module.scss similarity index 100% rename from examples/preview/next-app/app/[slug]/index.module.scss rename to examples/draft-preview/next-app/app/[slug]/index.module.scss diff --git a/examples/preview/next-app/app/[slug]/page.tsx b/examples/draft-preview/next-app/app/[slug]/page.tsx similarity index 91% rename from examples/preview/next-app/app/[slug]/page.tsx rename to examples/draft-preview/next-app/app/[slug]/page.tsx index deb9b700d5e..91831868395 100644 --- a/examples/preview/next-app/app/[slug]/page.tsx +++ b/examples/draft-preview/next-app/app/[slug]/page.tsx @@ -2,9 +2,10 @@ import { draftMode } from 'next/headers' import { notFound } from 'next/navigation' import { Page } from '../../payload-types' +import { fetchPage } from '../_api/fetchPage' +import { fetchPages } from '../_api/fetchPages' import { Gutter } from '../_components/Gutter' import RichText from '../_components/RichText' -import { fetchPage, fetchPages } from '../cms' import classes from './index.module.scss' diff --git a/examples/preview/next-app/app/cms.ts b/examples/draft-preview/next-app/app/_api/fetchPage.ts similarity index 56% rename from examples/preview/next-app/app/cms.ts rename to examples/draft-preview/next-app/app/_api/fetchPage.ts index 02166bcf534..5e0798e81bd 100644 --- a/examples/preview/next-app/app/cms.ts +++ b/examples/draft-preview/next-app/app/_api/fetchPage.ts @@ -1,12 +1,17 @@ -import { cookies } from 'next/headers' +import type { RequestCookie } from 'next/dist/compiled/@edge-runtime/cookies' -import type { Page } from '../payload-types' +import type { Page } from '../../payload-types' export const fetchPage = async ( slug: string, draft?: boolean, ): Promise<Page | undefined | null> => { - const payloadToken = cookies().get('payload-token') + let payloadToken: RequestCookie | undefined + + if (draft) { + const { cookies } = await import('next/headers') + payloadToken = cookies().get('payload-token') + } const pageRes: { docs: Page[] @@ -27,13 +32,3 @@ export const fetchPage = async ( return pageRes?.docs?.[0] ?? null } - -export const fetchPages = async (): Promise<Page[]> => { - const pageRes: { - docs: Page[] - } = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/pages?depth=0&limit=100`).then(res => - res.json(), - ) // eslint-disable-line function-paren-newline - - return pageRes?.docs ?? [] -} diff --git a/examples/draft-preview/next-app/app/_api/fetchPages.ts b/examples/draft-preview/next-app/app/_api/fetchPages.ts new file mode 100644 index 00000000000..d1c4cb9e051 --- /dev/null +++ b/examples/draft-preview/next-app/app/_api/fetchPages.ts @@ -0,0 +1,11 @@ +import type { Page } from '../../payload-types' + +export const fetchPages = async (): Promise<Page[]> => { + const pageRes: { + docs: Page[] + } = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/pages?depth=0&limit=100`).then(res => + res.json(), + ) // eslint-disable-line function-paren-newline + + return pageRes?.docs ?? [] +} diff --git a/examples/preview/next-app/app/_components/AdminBar/index.client.tsx b/examples/draft-preview/next-app/app/_components/AdminBar/index.client.tsx similarity index 100% rename from examples/preview/next-app/app/_components/AdminBar/index.client.tsx rename to examples/draft-preview/next-app/app/_components/AdminBar/index.client.tsx diff --git a/examples/preview/next-app/app/_components/AdminBar/index.module.scss b/examples/draft-preview/next-app/app/_components/AdminBar/index.module.scss similarity index 73% rename from examples/preview/next-app/app/_components/AdminBar/index.module.scss rename to examples/draft-preview/next-app/app/_components/AdminBar/index.module.scss index 5a3ea063141..ad9516097ad 100644 --- a/examples/preview/next-app/app/_components/AdminBar/index.module.scss +++ b/examples/draft-preview/next-app/app/_components/AdminBar/index.module.scss @@ -1,17 +1,22 @@ .adminBar { z-index: 10; width: 100%; - background-color: rgb(var(--foreground-rgb)); + background-color: rgba(var(--foreground-rgb), 0.075); padding: calc(var(--base) * 0.5) 0; display: none; + visibility: hidden; + opacity: 0; + transition: opacity 150ms linear; } .payloadAdminBar { - color: rgb(var(--background-rgb)) !important; + color: rgb(var(--foreground-rgb)) !important; } .show { display: block; + visibility: visible; + opacity: 1; } .controls { diff --git a/examples/preview/next-app/app/_components/AdminBar/index.tsx b/examples/draft-preview/next-app/app/_components/AdminBar/index.tsx similarity index 100% rename from examples/preview/next-app/app/_components/AdminBar/index.tsx rename to examples/draft-preview/next-app/app/_components/AdminBar/index.tsx diff --git a/examples/preview/next-app/app/_components/Button/index.module.scss b/examples/draft-preview/next-app/app/_components/Button/index.module.scss similarity index 100% rename from examples/preview/next-app/app/_components/Button/index.module.scss rename to examples/draft-preview/next-app/app/_components/Button/index.module.scss diff --git a/examples/preview/next-app/app/_components/Button/index.tsx b/examples/draft-preview/next-app/app/_components/Button/index.tsx similarity index 100% rename from examples/preview/next-app/app/_components/Button/index.tsx rename to examples/draft-preview/next-app/app/_components/Button/index.tsx diff --git a/examples/preview/next-app/app/_components/CMSLink/index.tsx b/examples/draft-preview/next-app/app/_components/CMSLink/index.tsx similarity index 100% rename from examples/preview/next-app/app/_components/CMSLink/index.tsx rename to examples/draft-preview/next-app/app/_components/CMSLink/index.tsx diff --git a/examples/preview/next-app/app/_components/Gutter/index.module.scss b/examples/draft-preview/next-app/app/_components/Gutter/index.module.scss similarity index 100% rename from examples/preview/next-app/app/_components/Gutter/index.module.scss rename to examples/draft-preview/next-app/app/_components/Gutter/index.module.scss diff --git a/examples/preview/next-app/app/_components/Gutter/index.tsx b/examples/draft-preview/next-app/app/_components/Gutter/index.tsx similarity index 100% rename from examples/preview/next-app/app/_components/Gutter/index.tsx rename to examples/draft-preview/next-app/app/_components/Gutter/index.tsx diff --git a/examples/preview/next-app/app/_components/Header/index.module.scss b/examples/draft-preview/next-app/app/_components/Header/index.module.scss similarity index 100% rename from examples/preview/next-app/app/_components/Header/index.module.scss rename to examples/draft-preview/next-app/app/_components/Header/index.module.scss diff --git a/examples/preview/next-app/app/_components/Header/index.tsx b/examples/draft-preview/next-app/app/_components/Header/index.tsx similarity index 100% rename from examples/preview/next-app/app/_components/Header/index.tsx rename to examples/draft-preview/next-app/app/_components/Header/index.tsx diff --git a/examples/preview/next-app/app/_components/RichText/index.module.scss b/examples/draft-preview/next-app/app/_components/RichText/index.module.scss similarity index 100% rename from examples/preview/next-app/app/_components/RichText/index.module.scss rename to examples/draft-preview/next-app/app/_components/RichText/index.module.scss diff --git a/examples/preview/next-app/app/_components/RichText/index.tsx b/examples/draft-preview/next-app/app/_components/RichText/index.tsx similarity index 100% rename from examples/preview/next-app/app/_components/RichText/index.tsx rename to examples/draft-preview/next-app/app/_components/RichText/index.tsx diff --git a/examples/preview/next-app/app/_components/RichText/serialize.tsx b/examples/draft-preview/next-app/app/_components/RichText/serialize.tsx similarity index 100% rename from examples/preview/next-app/app/_components/RichText/serialize.tsx rename to examples/draft-preview/next-app/app/_components/RichText/serialize.tsx diff --git a/examples/preview/next-app/app/api/exit-preview/route.ts b/examples/draft-preview/next-app/app/api/exit-preview/route.ts similarity index 100% rename from examples/preview/next-app/app/api/exit-preview/route.ts rename to examples/draft-preview/next-app/app/api/exit-preview/route.ts diff --git a/examples/preview/next-app/app/api/preview/route.ts b/examples/draft-preview/next-app/app/api/preview/route.ts similarity index 100% rename from examples/preview/next-app/app/api/preview/route.ts rename to examples/draft-preview/next-app/app/api/preview/route.ts diff --git a/examples/preview/next-app/app/api/revalidate/route.ts b/examples/draft-preview/next-app/app/api/revalidate/route.ts similarity index 100% rename from examples/preview/next-app/app/api/revalidate/route.ts rename to examples/draft-preview/next-app/app/api/revalidate/route.ts diff --git a/examples/preview/next-app/app/app.scss b/examples/draft-preview/next-app/app/app.scss similarity index 100% rename from examples/preview/next-app/app/app.scss rename to examples/draft-preview/next-app/app/app.scss diff --git a/examples/preview/next-app/app/layout.tsx b/examples/draft-preview/next-app/app/layout.tsx similarity index 100% rename from examples/preview/next-app/app/layout.tsx rename to examples/draft-preview/next-app/app/layout.tsx diff --git a/examples/preview/next-app/app/page.tsx b/examples/draft-preview/next-app/app/page.tsx similarity index 100% rename from examples/preview/next-app/app/page.tsx rename to examples/draft-preview/next-app/app/page.tsx diff --git a/examples/preview/next-app/next-env.d.ts b/examples/draft-preview/next-app/next-env.d.ts similarity index 100% rename from examples/preview/next-app/next-env.d.ts rename to examples/draft-preview/next-app/next-env.d.ts diff --git a/examples/preview/next-app/next.config.js b/examples/draft-preview/next-app/next.config.js similarity index 100% rename from examples/preview/next-app/next.config.js rename to examples/draft-preview/next-app/next.config.js diff --git a/examples/preview/next-app/package.json b/examples/draft-preview/next-app/package.json similarity index 95% rename from examples/preview/next-app/package.json rename to examples/draft-preview/next-app/package.json index de159267992..6b89a38b76f 100644 --- a/examples/preview/next-app/package.json +++ b/examples/draft-preview/next-app/package.json @@ -1,5 +1,5 @@ { - "name": "payload-example-nextjs-preview-app", + "name": "payload-draft-preview-next-app", "version": "0.1.0", "private": true, "scripts": { diff --git a/examples/preview/cms/src/payload-types.ts b/examples/draft-preview/next-app/payload-types.ts similarity index 100% rename from examples/preview/cms/src/payload-types.ts rename to examples/draft-preview/next-app/payload-types.ts diff --git a/examples/preview/next-app/public/favicon.ico b/examples/draft-preview/next-app/public/favicon.ico similarity index 100% rename from examples/preview/next-app/public/favicon.ico rename to examples/draft-preview/next-app/public/favicon.ico diff --git a/examples/preview/next-app/public/favicon.svg b/examples/draft-preview/next-app/public/favicon.svg similarity index 100% rename from examples/preview/next-app/public/favicon.svg rename to examples/draft-preview/next-app/public/favicon.svg diff --git a/examples/preview/next-app/tsconfig.json b/examples/draft-preview/next-app/tsconfig.json similarity index 100% rename from examples/preview/next-app/tsconfig.json rename to examples/draft-preview/next-app/tsconfig.json diff --git a/examples/preview/next-app/yarn.lock b/examples/draft-preview/next-app/yarn.lock similarity index 100% rename from examples/preview/next-app/yarn.lock rename to examples/draft-preview/next-app/yarn.lock diff --git a/examples/preview/next-pages/.editorconfig b/examples/draft-preview/next-pages/.editorconfig similarity index 100% rename from examples/preview/next-pages/.editorconfig rename to examples/draft-preview/next-pages/.editorconfig diff --git a/examples/preview/next-pages/.env.example b/examples/draft-preview/next-pages/.env.example similarity index 100% rename from examples/preview/next-pages/.env.example rename to examples/draft-preview/next-pages/.env.example diff --git a/examples/preview/next-pages/.eslintrc.js b/examples/draft-preview/next-pages/.eslintrc.js similarity index 100% rename from examples/preview/next-pages/.eslintrc.js rename to examples/draft-preview/next-pages/.eslintrc.js diff --git a/examples/preview/next-pages/.gitignore b/examples/draft-preview/next-pages/.gitignore similarity index 100% rename from examples/preview/next-pages/.gitignore rename to examples/draft-preview/next-pages/.gitignore diff --git a/examples/preview/next-app/.prettierrc.js b/examples/draft-preview/next-pages/.prettierrc.js similarity index 100% rename from examples/preview/next-app/.prettierrc.js rename to examples/draft-preview/next-pages/.prettierrc.js diff --git a/examples/preview/next-pages/README.md b/examples/draft-preview/next-pages/README.md similarity index 72% rename from examples/preview/next-pages/README.md rename to examples/draft-preview/next-pages/README.md index 0dbd80a67f5..b01b952e865 100644 --- a/examples/preview/next-pages/README.md +++ b/examples/draft-preview/next-pages/README.md @@ -1,14 +1,14 @@ -# Payload Preview Example Front-End +# Payload Draft Preview Example Front-End -This is a [Next.js](https://nextjs.org) app using the [Pages Router](https://nextjs.org/docs/pages). It was made explicitly for Payload's [Preview Example](https://github.com/payloadcms/payload/tree/master/examples/preview/cms). +This is a [Next.js](https://nextjs.org) app using the [Pages Router](https://nextjs.org/docs/pages). It was made explicitly for Payload's [Draft Preview Example](https://github.com/payloadcms/payload/tree/master/examples/draft-preview). -> This example uses the Pages Router, the legacy API of Next.js. If your app is using the latest [App Router](https://nextjs.org/docs/app), check out the official [App Router Example](https://github.com/payloadcms/payload/tree/master/examples/preview/next-app). +> This example uses the Pages Router, the legacy API of Next.js. If your app is using the latest [App Router](https://nextjs.org/docs/app), check out the official [App Router Example](https://github.com/payloadcms/payload/tree/master/examples/draft-preview/next-app). ## Getting Started ### Payload -First you'll need a running [Payload](https://github.com/payloadcms/payload) app. If you have not done so already, open up the `cms` folder and follow the setup instructions. Take note of your `serverURL`, you'll need this in the next step. +First you'll need a running Payload app. There is one made explicitly for this example and [can be found here](https://github.com/payloadcms/payload/tree/master/examples/draft-preview/payload). If you have not done so already, clone it down and follow the setup instructions there. This will provide all the necessary APIs that your Next.js app requires for authentication. ### Next.js @@ -18,7 +18,7 @@ First you'll need a running [Payload](https://github.com/payloadcms/payload) app 4. `yarn dev` or `npm run dev` to start the server 5. `open http://localhost:3001` to see the result -Once running you will find a couple seeded pages on your local environment with some basic instructions. You can also start editing the pages by modifying the documents within Payload. See the [Preview Example](https://github.com/payloadcms/payload/tree/master/examples/preview/cms) for full details. +Once running you will find a couple seeded pages on your local environment with some basic instructions. You can also start editing the pages by modifying the documents within Payload. See the [Draft Preview Example](https://github.com/payloadcms/payload/tree/master/examples/draft-preview/payload) for full details. ## Learn More diff --git a/examples/preview/next-pages/next-env.d.ts b/examples/draft-preview/next-pages/next-env.d.ts similarity index 100% rename from examples/preview/next-pages/next-env.d.ts rename to examples/draft-preview/next-pages/next-env.d.ts diff --git a/examples/preview/next-pages/next.config.js b/examples/draft-preview/next-pages/next.config.js similarity index 100% rename from examples/preview/next-pages/next.config.js rename to examples/draft-preview/next-pages/next.config.js diff --git a/examples/preview/next-pages/package.json b/examples/draft-preview/next-pages/package.json similarity index 95% rename from examples/preview/next-pages/package.json rename to examples/draft-preview/next-pages/package.json index f25c75e71d3..e83bc55a5d3 100644 --- a/examples/preview/next-pages/package.json +++ b/examples/draft-preview/next-pages/package.json @@ -1,5 +1,5 @@ { - "name": "payload-example-nextjs-preview-pages", + "name": "payload-draft-preview-next-pages", "version": "0.1.0", "private": true, "scripts": { diff --git a/examples/preview/next-pages/public/favicon.ico b/examples/draft-preview/next-pages/public/favicon.ico similarity index 100% rename from examples/preview/next-pages/public/favicon.ico rename to examples/draft-preview/next-pages/public/favicon.ico diff --git a/examples/preview/next-pages/public/favicon.svg b/examples/draft-preview/next-pages/public/favicon.svg similarity index 100% rename from examples/preview/next-pages/public/favicon.svg rename to examples/draft-preview/next-pages/public/favicon.svg diff --git a/examples/preview/next-pages/src/components/AdminBar/index.module.scss b/examples/draft-preview/next-pages/src/components/AdminBar/index.module.scss similarity index 73% rename from examples/preview/next-pages/src/components/AdminBar/index.module.scss rename to examples/draft-preview/next-pages/src/components/AdminBar/index.module.scss index 5a3ea063141..ad9516097ad 100644 --- a/examples/preview/next-pages/src/components/AdminBar/index.module.scss +++ b/examples/draft-preview/next-pages/src/components/AdminBar/index.module.scss @@ -1,17 +1,22 @@ .adminBar { z-index: 10; width: 100%; - background-color: rgb(var(--foreground-rgb)); + background-color: rgba(var(--foreground-rgb), 0.075); padding: calc(var(--base) * 0.5) 0; display: none; + visibility: hidden; + opacity: 0; + transition: opacity 150ms linear; } .payloadAdminBar { - color: rgb(var(--background-rgb)) !important; + color: rgb(var(--foreground-rgb)) !important; } .show { display: block; + visibility: visible; + opacity: 1; } .controls { diff --git a/examples/preview/next-pages/src/components/AdminBar/index.tsx b/examples/draft-preview/next-pages/src/components/AdminBar/index.tsx similarity index 100% rename from examples/preview/next-pages/src/components/AdminBar/index.tsx rename to examples/draft-preview/next-pages/src/components/AdminBar/index.tsx diff --git a/examples/preview/next-pages/src/components/Button/index.module.scss b/examples/draft-preview/next-pages/src/components/Button/index.module.scss similarity index 100% rename from examples/preview/next-pages/src/components/Button/index.module.scss rename to examples/draft-preview/next-pages/src/components/Button/index.module.scss diff --git a/examples/preview/next-pages/src/components/Button/index.tsx b/examples/draft-preview/next-pages/src/components/Button/index.tsx similarity index 100% rename from examples/preview/next-pages/src/components/Button/index.tsx rename to examples/draft-preview/next-pages/src/components/Button/index.tsx diff --git a/examples/preview/next-pages/src/components/CMSLink/index.tsx b/examples/draft-preview/next-pages/src/components/CMSLink/index.tsx similarity index 100% rename from examples/preview/next-pages/src/components/CMSLink/index.tsx rename to examples/draft-preview/next-pages/src/components/CMSLink/index.tsx diff --git a/examples/preview/next-pages/src/components/Gutter/index.module.scss b/examples/draft-preview/next-pages/src/components/Gutter/index.module.scss similarity index 100% rename from examples/preview/next-pages/src/components/Gutter/index.module.scss rename to examples/draft-preview/next-pages/src/components/Gutter/index.module.scss diff --git a/examples/preview/next-pages/src/components/Gutter/index.tsx b/examples/draft-preview/next-pages/src/components/Gutter/index.tsx similarity index 100% rename from examples/preview/next-pages/src/components/Gutter/index.tsx rename to examples/draft-preview/next-pages/src/components/Gutter/index.tsx diff --git a/examples/preview/next-pages/src/components/Header/index.module.scss b/examples/draft-preview/next-pages/src/components/Header/index.module.scss similarity index 100% rename from examples/preview/next-pages/src/components/Header/index.module.scss rename to examples/draft-preview/next-pages/src/components/Header/index.module.scss diff --git a/examples/preview/next-pages/src/components/Header/index.tsx b/examples/draft-preview/next-pages/src/components/Header/index.tsx similarity index 100% rename from examples/preview/next-pages/src/components/Header/index.tsx rename to examples/draft-preview/next-pages/src/components/Header/index.tsx diff --git a/examples/preview/next-pages/src/components/RichText/index.module.scss b/examples/draft-preview/next-pages/src/components/RichText/index.module.scss similarity index 100% rename from examples/preview/next-pages/src/components/RichText/index.module.scss rename to examples/draft-preview/next-pages/src/components/RichText/index.module.scss diff --git a/examples/preview/next-pages/src/components/RichText/index.tsx b/examples/draft-preview/next-pages/src/components/RichText/index.tsx similarity index 100% rename from examples/preview/next-pages/src/components/RichText/index.tsx rename to examples/draft-preview/next-pages/src/components/RichText/index.tsx diff --git a/examples/preview/next-pages/src/components/RichText/serialize.tsx b/examples/draft-preview/next-pages/src/components/RichText/serialize.tsx similarity index 100% rename from examples/preview/next-pages/src/components/RichText/serialize.tsx rename to examples/draft-preview/next-pages/src/components/RichText/serialize.tsx diff --git a/examples/preview/next-pages/src/pages/[slug].module.scss b/examples/draft-preview/next-pages/src/pages/[slug].module.scss similarity index 100% rename from examples/preview/next-pages/src/pages/[slug].module.scss rename to examples/draft-preview/next-pages/src/pages/[slug].module.scss diff --git a/examples/preview/next-pages/src/pages/[slug].tsx b/examples/draft-preview/next-pages/src/pages/[slug].tsx similarity index 100% rename from examples/preview/next-pages/src/pages/[slug].tsx rename to examples/draft-preview/next-pages/src/pages/[slug].tsx diff --git a/examples/preview/next-pages/src/pages/_app.tsx b/examples/draft-preview/next-pages/src/pages/_app.tsx similarity index 100% rename from examples/preview/next-pages/src/pages/_app.tsx rename to examples/draft-preview/next-pages/src/pages/_app.tsx diff --git a/examples/preview/next-pages/src/pages/api/exit-preview.ts b/examples/draft-preview/next-pages/src/pages/api/exit-preview.ts similarity index 100% rename from examples/preview/next-pages/src/pages/api/exit-preview.ts rename to examples/draft-preview/next-pages/src/pages/api/exit-preview.ts diff --git a/examples/preview/next-pages/src/pages/api/preview.ts b/examples/draft-preview/next-pages/src/pages/api/preview.ts similarity index 100% rename from examples/preview/next-pages/src/pages/api/preview.ts rename to examples/draft-preview/next-pages/src/pages/api/preview.ts diff --git a/examples/preview/next-pages/src/pages/api/revalidate.ts b/examples/draft-preview/next-pages/src/pages/api/revalidate.ts similarity index 100% rename from examples/preview/next-pages/src/pages/api/revalidate.ts rename to examples/draft-preview/next-pages/src/pages/api/revalidate.ts diff --git a/examples/preview/next-pages/src/pages/app.scss b/examples/draft-preview/next-pages/src/pages/app.scss similarity index 100% rename from examples/preview/next-pages/src/pages/app.scss rename to examples/draft-preview/next-pages/src/pages/app.scss diff --git a/examples/preview/next-pages/src/pages/index.tsx b/examples/draft-preview/next-pages/src/pages/index.tsx similarity index 100% rename from examples/preview/next-pages/src/pages/index.tsx rename to examples/draft-preview/next-pages/src/pages/index.tsx diff --git a/examples/preview/next-app/payload-types.ts b/examples/draft-preview/next-pages/src/payload-types.ts similarity index 100% rename from examples/preview/next-app/payload-types.ts rename to examples/draft-preview/next-pages/src/payload-types.ts diff --git a/examples/preview/next-pages/tsconfig.json b/examples/draft-preview/next-pages/tsconfig.json similarity index 100% rename from examples/preview/next-pages/tsconfig.json rename to examples/draft-preview/next-pages/tsconfig.json diff --git a/examples/preview/next-pages/yarn.lock b/examples/draft-preview/next-pages/yarn.lock similarity index 100% rename from examples/preview/next-pages/yarn.lock rename to examples/draft-preview/next-pages/yarn.lock diff --git a/examples/preview/cms/.env.example b/examples/draft-preview/payload/.env.example similarity index 75% rename from examples/preview/cms/.env.example rename to examples/draft-preview/payload/.env.example index 758bbbdc8c5..573121d1be5 100644 --- a/examples/preview/cms/.env.example +++ b/examples/draft-preview/payload/.env.example @@ -1,9 +1,9 @@ -MONGODB_URI=mongodb://127.0.0.1/payload-example-preview +MONGODB_URI=mongodb://127.0.0.1/payload-example-draft-preview PAYLOAD_SECRET=ENTER-STRING-HERE PAYLOAD_PUBLIC_SERVER_URL=http://localhost:3000 PAYLOAD_PUBLIC_SITE_URL=http://localhost:3001 PAYLOAD_PUBLIC_DRAFT_SECRET=EXAMPLE_DRAFT_SECRET COOKIE_DOMAIN=localhost REVALIDATION_KEY=EXAMPLE_REVALIDATION_KEY -PAYLOAD_SEED=true +PAYLOAD_PUBLIC_SEED=true PAYLOAD_DROP_DATABASE=true diff --git a/examples/preview/cms/.eslintrc.js b/examples/draft-preview/payload/.eslintrc.js similarity index 100% rename from examples/preview/cms/.eslintrc.js rename to examples/draft-preview/payload/.eslintrc.js diff --git a/examples/preview/cms/.gitignore b/examples/draft-preview/payload/.gitignore similarity index 100% rename from examples/preview/cms/.gitignore rename to examples/draft-preview/payload/.gitignore diff --git a/examples/preview/next-pages/.prettierrc.js b/examples/draft-preview/payload/.prettierrc.js similarity index 100% rename from examples/preview/next-pages/.prettierrc.js rename to examples/draft-preview/payload/.prettierrc.js diff --git a/examples/preview/cms/.vscode/launch.json b/examples/draft-preview/payload/.vscode/launch.json similarity index 100% rename from examples/preview/cms/.vscode/launch.json rename to examples/draft-preview/payload/.vscode/launch.json diff --git a/examples/preview/cms/README.md b/examples/draft-preview/payload/README.md similarity index 69% rename from examples/preview/cms/README.md rename to examples/draft-preview/payload/README.md index bfbd6152497..f8d0c0c6c3b 100644 --- a/examples/preview/cms/README.md +++ b/examples/draft-preview/payload/README.md @@ -1,8 +1,11 @@ -# Payload Preview Example +# Payload Draft Preview Example -This example demonstrates how to implement preview in [Payload](https://github.com/payloadcms/payload) using [Versions](https://payloadcms.com/docs/versions/overview) and [Drafts](https://payloadcms.com/docs/versions/drafts). Preview allows you to see draft content on your front-end before it is published. +The [Payload Draft Preview Example](https://github.com/payloadcms/payload/tree/master/examples/draft-preview) demonstrates how to implement draft preview in [Payload](https://github.com/payloadcms/payload) using [Versions](https://payloadcms.com/docs/versions/overview) and [Drafts](https://payloadcms.com/docs/versions/drafts). Draft preview allows you to see content on your front-end before it is published. There are various fully working front-ends made explicitly for this example, including: -There is a fully working Next.js app made explicitly for this example which can be found [here](../next-app). Follow the instructions there to get started. If you are setting up preview for another front-end, please consider contributing to this repo with your own example! +- [Next.js App Router](../next-app) +- [Next.js Pages Router](../next-pages) + +Follow the instructions in each respective README to get started. If you are setting up draft preview for another front-end, please consider contributing to this repo with your own example! ## Quick Start @@ -17,7 +20,7 @@ That's it! Changes made in `./src` will be reflected in your app. See the [Devel ## How it works -Preview works by sending the user to your front-end with a `secret` along with their http-only cookies. Your front-end catches the request, verifies the authenticity, then enters into it's own preview mode. Once in preview mode, your front-end can begin securely requesting draft documents from Payload. +Draft preview works by sending the user to your front-end with a `secret` along with their http-only cookies. Your front-end catches the request, verifies the authenticity, then enters into it's own preview mode. Once in preview mode, your front-end can begin securely requesting draft documents from Payload. See [Preview Mode](#preview-mode) for more details. ### Collections @@ -27,11 +30,11 @@ See the [Collections](https://payloadcms.com/docs/configuration/collections) doc The `users` collection is auth-enabled which provides access to the admin panel. When previewing documents on your front-end, the user's JWT is used to authenticate the request. See [Pages](#pages) for more details. - For additional help with authentication, see the [Authentication](https://payloadcms.com/docs/authentication/overview#authentication-overview) docs or the official [Auth Example](https://github.com/payloadcms/payload/tree/master/examples/auth/cms#readme). + For additional help with authentication, see the [Authentication](https://payloadcms.com/docs/authentication/overview#authentication-overview) docs or the official [Auth Example](https://github.com/payloadcms/payload/tree/master/examples/auth). - #### Pages - The `pages` collection is draft-enabled and has access control that restricts public users from viewing pages with a `draft` status. To fetch draft documents on your front-end, simply include the `draft=true` query param along with the `Authorization` header once you have entered [Preview Mode](#preview-mode). + The `pages` collection is draft-enabled and has access control that restricts public users from viewing pages with a `_status` of `draft`. To fetch draft documents on your front-end, simply include the `draft=true` query param along with the `Authorization` header once you have entered [Preview Mode](#preview-mode). ```ts const preview = true; // set this based on your own front-end environment (see `Preview Mode` below) @@ -52,7 +55,7 @@ See the [Collections](https://payloadcms.com/docs/configuration/collections) doc ### Preview Mode -To enter preview mode, the user first needs to have at least one draft document saved. When they click the "preview" button from the Payload admin panel, a custom [preview function](https://payloadcms.com/docs/configuration/collections#preview) routes them to your front-end with a `secret` and their http-only cookies. An API route on your front-end will verify the secret and token before entering into it's own preview mode. Once in preview mode, it can begin requesting drafts from Payload using the `Authorization` header, see [Pages](#pages) for more details. +To preview draft documents, the user first needs to have at least one draft document saved. When they click the "preview" button from the Payload admin panel, a custom [preview function](https://payloadcms.com/docs/configuration/collections#preview) routes them to your front-end with a `secret` along with their http-only cookies. An API route on your front-end will verify the secret and token before entering into it's own preview mode. Once in preview mode, it can begin requesting drafts from Payload using the `Authorization` header. See [Pages](#pages) for more details. > "Preview mode" looks differently for every front-end framework. For instance, check out the differences between Next.js [Preview Mode](https://nextjs.org/docs/pages/building-your-application/configuring/preview-mode) in the Pages Router and [Draft Mode](https://nextjs.org/docs/pages/building-your-application/configuring/draft-mode) in the App Router. In Next.js, methods are provided that set cookies in your browser, but this may not be the case for all frameworks. @@ -64,11 +67,11 @@ If your front-end is statically generated then you may also want to regenerate t ### Admin Bar -You might also want to render an admin bar on your front-end so that logged-in users can quickly navigate between the front-end and Payload as they're editing. For React apps, check out the official [Payload Admin Bar](https://github.com/payloadcms/payload-admin-bar). For other frameworks, simply hit the `/me` route with `credentials: include` and render your own admin bar if the user is logged in in order to display quick links to your CMS. +You might also want to render an admin bar on your front-end so that logged-in users can quickly navigate between the front-end and Payload as they're editing. For React apps, check out the official [Payload Admin Bar](https://github.com/payloadcms/payload-admin-bar). For other frameworks, simply hit the `/me` route with `credentials: 'include'` and render your own admin bar if the user is logged in. ### CORS -The [`cors`](https://payloadcms.com/docs/production/preventing-abuse#cross-origin-resource-sharing-cors), [`csrf`](https://payloadcms.com/docs/production/preventing-abuse#cross-site-request-forgery-csrf), and [`cookies`](https://payloadcms.com/docs/authentication/config#options) settings are configured to ensure that the admin panel and front-end can communicate with each other securely. If you are combining your front-end and admin panel into a single application that runs of a shared port and domain, you can remove these settings from your config. +The [`cors`](https://payloadcms.com/docs/production/preventing-abuse#cross-origin-resource-sharing-cors), [`csrf`](https://payloadcms.com/docs/production/preventing-abuse#cross-site-request-forgery-csrf), and [`cookies`](https://payloadcms.com/docs/authentication/config#options) settings are configured to ensure that the admin panel and front-end can communicate with each other securely. If you are combining your front-end and admin panel into a single application that runs of a shared port and domain, you can simplify your config by removing these settings. For more details on this, see the [CORS](https://payloadcms.com/docs/production/preventing-abuse#cross-origin-resource-sharing-cors) docs. @@ -76,10 +79,9 @@ For more details on this, see the [CORS](https://payloadcms.com/docs/production/ To spin up this example locally, follow the [Quick Start](#quick-start). - ### Seed -On boot, a seed script is included to scaffold a basic database for you to use as an example. This is done by setting the `PAYLOAD_DROP_DATABASE` and `PAYLOAD_SEED` environment variables which are included in the `.env.example` by default. You can remove these from your `.env` to prevent this behavior. You can also freshly seed your project at any time by running `yarn seed`. This seed creates a user with email `[email protected]` and password `demo` along with a home page and an example page with two versions, one published and the other draft. +On boot, a seed script is included to scaffold a basic database for you to use as an example. This is done by setting the `PAYLOAD_DROP_DATABASE` and `PAYLOAD_PUBLIC_SEED` environment variables which are included in the `.env.example` by default. You can remove these from your `.env` to prevent this behavior. You can also freshly seed your project at any time by running `yarn seed`. This seed creates a user with email `[email protected]` and password `demo` along with a home page and an example page with two versions, one published and the other draft. > NOTICE: seeding the database is destructive because it drops your current database to populate a fresh one from the seed template. Only run this command if you are starting a new project or can afford to lose your current data. diff --git a/examples/preview/cms/nodemon.json b/examples/draft-preview/payload/nodemon.json similarity index 100% rename from examples/preview/cms/nodemon.json rename to examples/draft-preview/payload/nodemon.json diff --git a/examples/preview/cms/package.json b/examples/draft-preview/payload/package.json similarity index 91% rename from examples/preview/cms/package.json rename to examples/draft-preview/payload/package.json index 81973708957..41c760340fa 100644 --- a/examples/preview/cms/package.json +++ b/examples/draft-preview/payload/package.json @@ -6,7 +6,7 @@ "license": "MIT", "scripts": { "dev": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts nodemon", - "seed": "rm -rf media && cross-env PAYLOAD_SEED=true PAYLOAD_DROP_DATABASE=true PAYLOAD_CONFIG_PATH=src/payload.config.ts ts-node src/server.ts", + "seed": "rm -rf media && cross-env PAYLOAD_PUBLIC_SEED=true PAYLOAD_DROP_DATABASE=true PAYLOAD_CONFIG_PATH=src/payload.config.ts ts-node src/server.ts", "build:payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build", "build:server": "tsc", "build": "yarn copyfiles && yarn build:payload && yarn build:server", @@ -43,4 +43,4 @@ "ts-node": "^9.1.1", "typescript": "^4.8.4" } -} \ No newline at end of file +} diff --git a/examples/preview/cms/src/collections/Pages/access/loggedIn.ts b/examples/draft-preview/payload/src/collections/Pages/access/loggedIn.ts similarity index 100% rename from examples/preview/cms/src/collections/Pages/access/loggedIn.ts rename to examples/draft-preview/payload/src/collections/Pages/access/loggedIn.ts diff --git a/examples/preview/cms/src/collections/Pages/access/publishedOrLoggedIn.ts b/examples/draft-preview/payload/src/collections/Pages/access/publishedOrLoggedIn.ts similarity index 100% rename from examples/preview/cms/src/collections/Pages/access/publishedOrLoggedIn.ts rename to examples/draft-preview/payload/src/collections/Pages/access/publishedOrLoggedIn.ts diff --git a/examples/preview/cms/src/collections/Pages/hooks/formatSlug.ts b/examples/draft-preview/payload/src/collections/Pages/hooks/formatSlug.ts similarity index 100% rename from examples/preview/cms/src/collections/Pages/hooks/formatSlug.ts rename to examples/draft-preview/payload/src/collections/Pages/hooks/formatSlug.ts diff --git a/examples/draft-preview/payload/src/collections/Pages/hooks/revalidatePage.ts b/examples/draft-preview/payload/src/collections/Pages/hooks/revalidatePage.ts new file mode 100644 index 00000000000..1bafe431276 --- /dev/null +++ b/examples/draft-preview/payload/src/collections/Pages/hooks/revalidatePage.ts @@ -0,0 +1,37 @@ +import type { AfterChangeHook } from 'payload/dist/collections/config/types' + +// ensure that the home page is revalidated at '/' instead of '/home' +export const formatAppURL = ({ doc }): string => { + const pathToUse = doc.slug === 'home' ? '' : doc.slug + const { pathname } = new URL(`${process.env.PAYLOAD_PUBLIC_SITE_URL}/${pathToUse}`) + return pathname +} + +// Revalidate the page in the background, so the user doesn't have to wait +// Notice that the hook itself is not async and we are not awaiting `revalidate` +// Only revalidate existing docs that are published +export const revalidatePage: AfterChangeHook = ({ doc, req, operation }) => { + if (operation === 'update' && doc._status === 'published') { + const url = formatAppURL({ doc }) + + const revalidate = async (): Promise<void> => { + try { + const res = await fetch( + `${process.env.PAYLOAD_PUBLIC_SITE_URL}/api/revalidate?secret=${process.env.REVALIDATION_KEY}&revalidatePath=${url}`, + ) + + if (res.ok) { + req.payload.logger.info(`Revalidated path ${url}`) + } else { + req.payload.logger.error(`Error revalidating path ${url}`) + } + } catch (err: unknown) { + req.payload.logger.error(`Error hitting revalidate route for ${url}`) + } + } + + revalidate() + } + + return doc +} diff --git a/examples/preview/cms/src/collections/Pages/index.ts b/examples/draft-preview/payload/src/collections/Pages/index.ts similarity index 100% rename from examples/preview/cms/src/collections/Pages/index.ts rename to examples/draft-preview/payload/src/collections/Pages/index.ts diff --git a/examples/preview/cms/src/collections/Users.ts b/examples/draft-preview/payload/src/collections/Users.ts similarity index 100% rename from examples/preview/cms/src/collections/Users.ts rename to examples/draft-preview/payload/src/collections/Users.ts diff --git a/examples/draft-preview/payload/src/components/BeforeLogin/index.tsx b/examples/draft-preview/payload/src/components/BeforeLogin/index.tsx new file mode 100644 index 00000000000..5108a4fef6c --- /dev/null +++ b/examples/draft-preview/payload/src/components/BeforeLogin/index.tsx @@ -0,0 +1,17 @@ +import React from 'react' + +const BeforeLogin: React.FC = () => { + if (process.env.PAYLOAD_PUBLIC_SEED === 'true') { + return ( + <p> + {'Log in with the email '} + <strong>[email protected]</strong> + {' and the password '} + <strong>demo</strong>. + </p> + ) + } + return null +} + +export default BeforeLogin diff --git a/examples/preview/cms/src/fields/link.ts b/examples/draft-preview/payload/src/fields/link.ts similarity index 100% rename from examples/preview/cms/src/fields/link.ts rename to examples/draft-preview/payload/src/fields/link.ts diff --git a/examples/preview/cms/src/fields/richText/elements.ts b/examples/draft-preview/payload/src/fields/richText/elements.ts similarity index 100% rename from examples/preview/cms/src/fields/richText/elements.ts rename to examples/draft-preview/payload/src/fields/richText/elements.ts diff --git a/examples/preview/cms/src/fields/richText/index.ts b/examples/draft-preview/payload/src/fields/richText/index.ts similarity index 100% rename from examples/preview/cms/src/fields/richText/index.ts rename to examples/draft-preview/payload/src/fields/richText/index.ts diff --git a/examples/preview/cms/src/fields/richText/leaves.ts b/examples/draft-preview/payload/src/fields/richText/leaves.ts similarity index 100% rename from examples/preview/cms/src/fields/richText/leaves.ts rename to examples/draft-preview/payload/src/fields/richText/leaves.ts diff --git a/examples/preview/cms/src/globals/MainMenu.ts b/examples/draft-preview/payload/src/globals/MainMenu.ts similarity index 100% rename from examples/preview/cms/src/globals/MainMenu.ts rename to examples/draft-preview/payload/src/globals/MainMenu.ts diff --git a/examples/preview/next-pages/src/payload-types.ts b/examples/draft-preview/payload/src/payload-types.ts similarity index 100% rename from examples/preview/next-pages/src/payload-types.ts rename to examples/draft-preview/payload/src/payload-types.ts diff --git a/examples/preview/cms/src/payload.config.ts b/examples/draft-preview/payload/src/payload.config.ts similarity index 84% rename from examples/preview/cms/src/payload.config.ts rename to examples/draft-preview/payload/src/payload.config.ts index 55f4047fde1..e5ac8a1fa30 100644 --- a/examples/preview/cms/src/payload.config.ts +++ b/examples/draft-preview/payload/src/payload.config.ts @@ -3,10 +3,16 @@ import { buildConfig } from 'payload/config' import { Pages } from './collections/Pages' import { Users } from './collections/Users' +import BeforeLogin from './components/BeforeLogin' import { MainMenu } from './globals/MainMenu' export default buildConfig({ collections: [Pages, Users], + admin: { + components: { + beforeLogin: [BeforeLogin], + }, + }, serverURL: process.env.PAYLOAD_PUBLIC_SERVER_URL, cors: [ process.env.PAYLOAD_PUBLIC_SERVER_URL || '', diff --git a/examples/preview/cms/src/seed/home.ts b/examples/draft-preview/payload/src/seed/home.ts similarity index 76% rename from examples/preview/cms/src/seed/home.ts rename to examples/draft-preview/payload/src/seed/home.ts index 9601b768b06..f248531aa89 100644 --- a/examples/preview/cms/src/seed/home.ts +++ b/examples/draft-preview/payload/src/seed/home.ts @@ -21,7 +21,7 @@ export const home: Partial<Page> = { { type: 'link', newTab: true, - url: 'https://github.com/payloadcms/payload/tree/master/examples/redirects/cms', + url: 'https://github.com/payloadcms/payload/tree/master/examples/redirects', children: [{ text: '' }], }, { text: '' }, @@ -29,10 +29,10 @@ export const home: Partial<Page> = { type: 'link', linkType: 'custom', newTab: true, - url: 'https://github.com/payloadcms/payload/tree/master/examples/preview/cms', - children: [{ text: 'Preview Example' }], + url: 'https://github.com/payloadcms/payload/tree/master/examples/draft-preview/payload', + children: [{ text: 'Draft Preview Example' }], }, - { text: '. This example demonstrates how to implement preview into Payload using ' }, + { text: '. This example demonstrates how to implement draft preview into Payload using ' }, { type: 'link', newTab: true, @@ -50,9 +50,9 @@ export const home: Partial<Page> = { linkType: 'custom', url: 'http://localhost:3000/admin', newTab: true, - children: [{ text: 'Log in' }], + children: [{ text: 'Log in to the admin panel' }], }, - { text: ' to the admin panel and refresh this page to see the ' }, + { text: ' and refresh this page to see the ' }, { type: 'link', linkType: 'custom', @@ -61,7 +61,7 @@ export const home: Partial<Page> = { children: [{ text: 'Payload Admin Bar' }], }, { - text: ' appear at the top of the viewport. This will allow you to seamlessly navigate between the two apps. Then, navigate to the ', + text: ' appear at the top of this site. This will allow you to seamlessly navigate between the two apps. Then, navigate to the ', }, { type: 'link', @@ -69,7 +69,7 @@ export const home: Partial<Page> = { url: 'http://localhost:3001/example-page', children: [{ text: 'example page' }], }, - { text: ' to see how access to draft content is controlled. ' }, + { text: ' to see how we control access to draft content. ' }, ], }, ], diff --git a/examples/preview/cms/src/seed/index.ts b/examples/draft-preview/payload/src/seed/index.ts similarity index 100% rename from examples/preview/cms/src/seed/index.ts rename to examples/draft-preview/payload/src/seed/index.ts diff --git a/examples/preview/cms/src/seed/page.ts b/examples/draft-preview/payload/src/seed/page.ts similarity index 71% rename from examples/preview/cms/src/seed/page.ts rename to examples/draft-preview/payload/src/seed/page.ts index ddf69df7e2e..7b02abded06 100644 --- a/examples/preview/cms/src/seed/page.ts +++ b/examples/draft-preview/payload/src/seed/page.ts @@ -22,10 +22,10 @@ export const examplePage: Partial<Page> = { linkType: 'custom', url: 'http://localhost:3000/admin', newTab: true, - children: [{ text: 'Log in' }], + children: [{ text: 'Log in to the admin panel' }], }, { - text: ' to the admin panel and click "preview" to return to this page and view the latest draft content in Next.js preview mode. To make additional changes to the draft, click "save draft" before returning to the preview.', + text: ' and click "preview" to return to this page and view the latest draft content in Next.js preview mode. To make additional changes to the draft, click "save draft" before returning to the preview.', }, ], }, diff --git a/examples/preview/cms/src/seed/pageDraft.ts b/examples/draft-preview/payload/src/seed/pageDraft.ts similarity index 100% rename from examples/preview/cms/src/seed/pageDraft.ts rename to examples/draft-preview/payload/src/seed/pageDraft.ts diff --git a/examples/preview/cms/src/server.ts b/examples/draft-preview/payload/src/server.ts similarity index 92% rename from examples/preview/cms/src/server.ts rename to examples/draft-preview/payload/src/server.ts index 985169f2ede..bd78c6e1f5d 100644 --- a/examples/preview/cms/src/server.ts +++ b/examples/draft-preview/payload/src/server.ts @@ -26,7 +26,7 @@ const start = async (): Promise<void> => { }, }) - if (process.env.PAYLOAD_SEED === 'true') { + if (process.env.PAYLOAD_PUBLIC_SEED === 'true') { payload.logger.info('---- SEEDING DATABASE ----') await seed(payload) } diff --git a/examples/preview/cms/src/utilities/deepMerge.ts b/examples/draft-preview/payload/src/utilities/deepMerge.ts similarity index 100% rename from examples/preview/cms/src/utilities/deepMerge.ts rename to examples/draft-preview/payload/src/utilities/deepMerge.ts diff --git a/examples/preview/cms/tsconfig.json b/examples/draft-preview/payload/tsconfig.json similarity index 100% rename from examples/preview/cms/tsconfig.json rename to examples/draft-preview/payload/tsconfig.json diff --git a/examples/preview/cms/yarn.lock b/examples/draft-preview/payload/yarn.lock similarity index 100% rename from examples/preview/cms/yarn.lock rename to examples/draft-preview/payload/yarn.lock diff --git a/examples/preview/cms/src/collections/Pages/hooks/revalidatePage.ts b/examples/preview/cms/src/collections/Pages/hooks/revalidatePage.ts deleted file mode 100644 index 55c2be34d6c..00000000000 --- a/examples/preview/cms/src/collections/Pages/hooks/revalidatePage.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { AfterChangeHook } from 'payload/dist/collections/config/types' - -// ensure that the home page is revalidated at '/' instead of '/home' -export const formatAppURL = ({ doc }): string => { - const pathToUse = doc.slug === 'home' ? '' : doc.slug - const { pathname } = new URL(`${process.env.PAYLOAD_PUBLIC_SITE_URL}/${pathToUse}`) - return pathname -} - -// Revalidate the page in the background, so the user doesn't have to wait -// Notice that the hook itself is not async and we are not awaiting `revalidate` -export const revalidatePage: AfterChangeHook = ({ doc, req }) => { - const url = formatAppURL({ doc }) - - const revalidate = async (): Promise<void> => { - try { - const res = await fetch( - `${process.env.PAYLOAD_PUBLIC_SITE_URL}/api/revalidate?secret=${process.env.REVALIDATION_KEY}&revalidatePath=${url}`, - ) - - if (res.ok) { - req.payload.logger.info(`Revalidated path ${url}`) - } else { - req.payload.logger.error(`Error revalidating path ${url}`) - } - } catch (err: unknown) { - req.payload.logger.error(`Error hitting revalidate route for ${url}`) - } - } - - revalidate() - - return doc -}
471d21410ac9ac852a8581a019dd6759f56cd8b2
2022-12-08 01:17:47
Dan Ribbens
fix: change edit key to prevent richtext editor from crashing (#1616)
false
change edit key to prevent richtext editor from crashing (#1616)
fix
diff --git a/src/admin/components/Routes.tsx b/src/admin/components/Routes.tsx index a6b9e1cccb0..ef2c0fbd120 100644 --- a/src/admin/components/Routes.tsx +++ b/src/admin/components/Routes.tsx @@ -13,6 +13,7 @@ import StayLoggedIn from './modals/StayLoggedIn'; import Versions from './views/Versions'; import Version from './views/Version'; import { DocumentInfoProvider } from './utilities/DocumentInfo'; +import { useLocale } from './utilities/Locale'; const Dashboard = lazy(() => import('./views/Dashboard')); const ForgotPassword = lazy(() => import('./views/ForgotPassword')); @@ -31,6 +32,7 @@ const Routes = () => { const [initialized, setInitialized] = useState(null); const { user, permissions, refreshCookie } = useAuth(); const { i18n } = useTranslation(); + const locale = useLocale(); const canAccessAdmin = permissions?.canAccessAdmin; @@ -218,7 +220,7 @@ const Routes = () => { if (permissions?.collections?.[collection.slug]?.read?.permission) { return ( <DocumentInfoProvider - key={`${collection.slug}-edit-${id}`} + key={`${collection.slug}-edit-${id}-${locale}`} collection={collection} id={id} > @@ -291,7 +293,10 @@ const Routes = () => { render={(routeProps) => { if (permissions?.globals?.[global.slug]?.read?.permission) { return ( - <DocumentInfoProvider global={global}> + <DocumentInfoProvider + global={global} + key={`${global.slug}-${locale}`} + > <EditGlobal {...routeProps} global={global} diff --git a/src/admin/components/forms/field-types/RichText/RichText.tsx b/src/admin/components/forms/field-types/RichText/RichText.tsx index f00928d07bb..7c7ffe5e6ff 100644 --- a/src/admin/components/forms/field-types/RichText/RichText.tsx +++ b/src/admin/components/forms/field-types/RichText/RichText.tsx @@ -71,7 +71,6 @@ const RichText: React.FC<Props> = (props) => { const [loaded, setLoaded] = useState(false); const [enabledElements, setEnabledElements] = useState({}); const [enabledLeaves, setEnabledLeaves] = useState({}); - const [initialValueKey, setInitialValueKey] = useState(''); const editorRef = useRef(null); const toolbarRef = useRef(null); @@ -140,7 +139,6 @@ const RichText: React.FC<Props> = (props) => { showError, setValue, errorMessage, - initialValue, } = fieldType; const classes = [ @@ -181,10 +179,6 @@ const RichText: React.FC<Props> = (props) => { } }, [loaded, elements, leaves]); - useEffect(() => { - setInitialValueKey(JSON.stringify(initialValue || '')); - }, [initialValue]); - useEffect(() => { function setClickableState(clickState: 'disabled' | 'enabled') { const selectors = 'button, a, [role="button"]'; @@ -228,7 +222,6 @@ const RichText: React.FC<Props> = (props) => { return ( <div - key={initialValueKey} className={classes} style={{ ...style,
927a1ab0497c4243891b4905035383c143f33bf0
2023-10-13 20:27:48
Elliot DeNolf
chore(release): plugin-nested-stripe/0.0.15
false
plugin-nested-stripe/0.0.15
chore
diff --git a/packages/plugin-stripe/package.json b/packages/plugin-stripe/package.json index f5077590a94..6f6afe5ffcd 100644 --- a/packages/plugin-stripe/package.json +++ b/packages/plugin-stripe/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-stripe", - "version": "0.0.15-beta.0", + "version": "0.0.15", "homepage:": "https://payloadcms.com", "repository": "[email protected]:payloadcms/plugin-stripe.git", "description": "Stripe plugin for Payload",
9056b9fe9ba9c8259fa8037f4d1bbdd4a3c3890a
2024-10-18 01:53:45
Sasha
fix(db-mongodb): virtual fields within row / collapsible / tabs (#8733)
false
virtual fields within row / collapsible / tabs (#8733)
fix
diff --git a/packages/db-mongodb/src/models/buildSchema.ts b/packages/db-mongodb/src/models/buildSchema.ts index d986d41a184..c2c8a4fcc6b 100644 --- a/packages/db-mongodb/src/models/buildSchema.ts +++ b/packages/db-mongodb/src/models/buildSchema.ts @@ -246,6 +246,10 @@ const fieldToSchemaMap: Record<string, FieldSchemaGenerator> = { buildSchemaOptions: BuildSchemaOptions, ): void => { field.fields.forEach((subField: Field) => { + if (fieldIsVirtual(subField)) { + return + } + const addFieldSchema: FieldSchemaGenerator = fieldToSchemaMap[subField.type] if (addFieldSchema) { @@ -501,6 +505,10 @@ const fieldToSchemaMap: Record<string, FieldSchemaGenerator> = { buildSchemaOptions: BuildSchemaOptions, ): void => { field.fields.forEach((subField: Field) => { + if (fieldIsVirtual(subField)) { + return + } + const addFieldSchema: FieldSchemaGenerator = fieldToSchemaMap[subField.type] if (addFieldSchema) { @@ -545,6 +553,9 @@ const fieldToSchemaMap: Record<string, FieldSchemaGenerator> = { ): void => { field.tabs.forEach((tab) => { if (tabHasName(tab)) { + if (fieldIsVirtual(tab)) { + return + } const baseSchema = { type: buildSchema(config, tab.fields, { disableUnique: buildSchemaOptions.disableUnique, @@ -562,6 +573,9 @@ const fieldToSchemaMap: Record<string, FieldSchemaGenerator> = { }) } else { tab.fields.forEach((subField: Field) => { + if (fieldIsVirtual(subField)) { + return + } const addFieldSchema: FieldSchemaGenerator = fieldToSchemaMap[subField.type] if (addFieldSchema) { diff --git a/test/database/config.ts b/test/database/config.ts index 0d243cea379..2d23bd29a09 100644 --- a/test/database/config.ts +++ b/test/database/config.ts @@ -318,6 +318,42 @@ export default buildConfigWithDefaults({ virtual: true, fields: [], }, + { + type: 'row', + fields: [ + { + type: 'text', + name: 'textWithinRow', + virtual: true, + }, + ], + }, + { + type: 'collapsible', + fields: [ + { + type: 'text', + name: 'textWithinCollapsible', + virtual: true, + }, + ], + label: 'Colllapsible', + }, + { + type: 'tabs', + tabs: [ + { + label: 'tab', + fields: [ + { + type: 'text', + name: 'textWithinTabs', + virtual: true, + }, + ], + }, + ], + }, ], }, ], diff --git a/test/database/int.spec.ts b/test/database/int.spec.ts index 5d7e52c10fa..189e6f425f8 100644 --- a/test/database/int.spec.ts +++ b/test/database/int.spec.ts @@ -810,6 +810,21 @@ describe('database', () => { expect(resLocal.textHooked).toBe('hooked') }) + + it('should not save a nested field to tabs/row/collapsible with virtual: true to the db', async () => { + const res = await payload.create({ + data: { + textWithinCollapsible: '1', + textWithinRow: '2', + textWithinTabs: '3', + }, + collection: 'fields-persistance', + }) + + expect(res.textWithinCollapsible).toBeUndefined() + expect(res.textWithinRow).toBeUndefined() + expect(res.textWithinTabs).toBeUndefined() + }) }) it('should not allow to query by a field with `virtual: true`', async () => { diff --git a/test/database/payload-types.ts b/test/database/payload-types.ts index 76b08c09c9a..354c1c83567 100644 --- a/test/database/payload-types.ts +++ b/test/database/payload-types.ts @@ -60,6 +60,7 @@ export interface UserAuthOperations { export interface Post { id: string; title: string; + hasTransaction?: boolean | null; throwAfterChange?: boolean | null; updatedAt: string; createdAt: string; @@ -225,6 +226,9 @@ export interface FieldsPersistance { id?: string | null; }[] | null; + textWithinRow?: string | null; + textWithinCollapsible?: string | null; + textWithinTabs?: string | null; updatedAt: string; createdAt: string; } @@ -289,14 +293,10 @@ export interface PayloadLockedDocument { value: string | User; } | null); globalSlug?: string | null; - _lastEdited: { - user: { - relationTo: 'users'; - value: string | User; - }; - editedAt?: string | null; + user: { + relationTo: 'users'; + value: string | User; }; - isLocked?: boolean | null; updatedAt: string; createdAt: string; }
75b993bc6b55ba00c088c8d935c99bcd355813fb
2024-03-08 00:47:24
Jacob Fletcher
fix(next): account view isEditing prop
false
account view isEditing prop
fix
diff --git a/packages/next/src/views/Account/index.tsx b/packages/next/src/views/Account/index.tsx index 003ba6351f6..1a827e361db 100644 --- a/packages/next/src/views/Account/index.tsx +++ b/packages/next/src/views/Account/index.tsx @@ -13,9 +13,9 @@ import React from 'react' import type { AdminViewProps } from '../Root/index.d.ts' +import { formatTitle } from '../Edit/Default/SetDocumentTitle/formatTitle.js' import { EditView } from '../Edit/index.js' import { Settings } from './Settings/index.js' -import { formatTitle } from '../Edit/Default/SetDocumentTitle/formatTitle.js' export { generateAccountMetadata } from './meta.js' @@ -103,6 +103,7 @@ export const Account: React.FC<AdminViewProps> = async ({ initPageResult, search id={user?.id} initialData={data} initialState={initialState} + isEditing title={formatTitle({ collectionConfig, dateFormat: config.admin.dateFormat, @@ -113,8 +114,8 @@ export const Account: React.FC<AdminViewProps> = async ({ initPageResult, search <DocumentHeader collectionConfig={collectionConfig} config={payload.config} - i18n={i18n} hideTabs + i18n={i18n} /> <HydrateClientUser permissions={permissions} user={user} /> <RenderCustomComponent
47c9a1d80f368c8ca9321409771fb626e66ec806
2024-02-10 00:44:38
Jarrod Flesch
chore: misc file omissions
false
misc file omissions
chore
diff --git a/packages/payload/.gitignore b/packages/payload/.gitignore index 7977f0666d1..bf984651116 100644 --- a/packages/payload/.gitignore +++ b/packages/payload/.gitignore @@ -18,3 +18,5 @@ /utilities.js /versions.d.ts /versions.js +/operations.js +/operations.d.ts diff --git a/packages/payload/newFiles.ts b/packages/payload/newFiles.ts deleted file mode 100644 index e69de29bb2d..00000000000
5dbbd8f88b9e89169ed24fe1af5977d9d191fed4
2023-11-10 21:12:00
Elliot DeNolf
chore(release): db-mongodb/1.0.8 [skip ci]
false
db-mongodb/1.0.8 [skip ci]
chore
diff --git a/packages/db-mongodb/package.json b/packages/db-mongodb/package.json index bef74d25b12..0d5b6ce5ee0 100644 --- a/packages/db-mongodb/package.json +++ b/packages/db-mongodb/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/db-mongodb", - "version": "1.0.7", + "version": "1.0.8", "description": "The officially supported MongoDB database adapter for Payload", "repository": "https://github.com/payloadcms/payload", "license": "MIT",
bf11eacf5a1bf32c37022ca4f034567ed101d92d
2024-02-26 19:20:24
Jarrod Flesch
chore: for alexical
false
for alexical
chore
diff --git a/.vscode/settings.json b/.vscode/settings.json index 2f96e20ffef..613cac0d438 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -36,6 +36,26 @@ "typescript.tsdk": "node_modules/typescript/lib", // Load .git-blame-ignore-revs file "gitlens.advanced.blame.customArguments": ["--ignore-revs-file", ".git-blame-ignore-revs"], + "workbench.colorCustomizations": { + "activityBar.activeBackground": "#7fafca", + "activityBar.background": "#7fafca", + "activityBar.foreground": "#15202b", + "activityBar.inactiveForeground": "#15202b99", + "activityBarBadge.background": "#b44b8e", + "activityBarBadge.foreground": "#e7e7e7", + "commandCenter.border": "#15202b99", + "sash.hoverBorder": "#7fafca", + "statusBar.background": "#5b98bb", + "statusBar.foreground": "#15202b", + "statusBarItem.hoverBackground": "#437ea0", + "statusBarItem.remoteBackground": "#5b98bb", + "statusBarItem.remoteForeground": "#15202b", + "titleBar.activeBackground": "#5b98bb", + "titleBar.activeForeground": "#15202b", + "titleBar.inactiveBackground": "#5b98bb99", + "titleBar.inactiveForeground": "#15202b99" + }, + "peacock.color": "#5b98bb", "[javascript][typescript][typescriptreact]": { "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit"
6d41f6c56d486684e7decefa8f81b4f62ef4885d
2024-04-12 00:47:33
Elliot DeNolf
fix(ui): actual scss paths [skip ci]
false
actual scss paths [skip ci]
fix
diff --git a/packages/ui/package.json b/packages/ui/package.json index 41926adb2b6..8d877555c8e 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -82,9 +82,9 @@ "types": "./src/utilities/*.ts" }, "./scss": { - "import": "./src/styles.scss", - "require": "./src/styles.scss", - "default": "./src/styles.scss" + "import": "./src/scss/styles.scss", + "require": "./src/scss/styles.scss", + "default": "./src/scss/styles.scss" }, "./scss/app.scss": "./src/scss/app.scss" }, @@ -163,9 +163,9 @@ "default": "./dist/prod/styles.css" }, "./scss": { - "import": "./dist/styles.scss", - "require": "./dist/styles.scss", - "default": "./dist/styles.scss" + "import": "./dist/scss/styles.scss", + "require": "./dist/scss/styles.scss", + "default": "./dist/scss/styles.scss" }, "./scss/app.scss": "./dist/scss/app.scss" }
39d075b9998e51d462b2207a1bbfc0326a7eb46a
2022-07-18 03:30:38
James
fix: ensures passing partial data to update works when fields are localized
false
ensures passing partial data to update works when fields are localized
fix
diff --git a/src/fields/hooks/beforeChange/promise.ts b/src/fields/hooks/beforeChange/promise.ts index 9849771e068..092bcb93124 100644 --- a/src/fields/hooks/beforeChange/promise.ts +++ b/src/fields/hooks/beforeChange/promise.ts @@ -58,8 +58,8 @@ export const promise = async ({ if (typeof siblingData[field.name] === 'undefined') { // If no incoming data, but existing document data is found, merge it in if (typeof siblingDoc[field.name] !== 'undefined') { - if (field.localized && typeof siblingDoc[field.name] === 'object' && siblingDoc[field.name] !== null) { - siblingData[field.name] = siblingDoc[field.name][req.locale]; + if (field.localized && typeof siblingDocWithLocales[field.name] === 'object' && siblingDocWithLocales[field.name] !== null) { + siblingData[field.name] = siblingDocWithLocales[field.name][req.locale]; } else { siblingData[field.name] = siblingDoc[field.name]; } diff --git a/test/localization/config.ts b/test/localization/config.ts index 69f5dafbef3..4a7f4be38c6 100644 --- a/test/localization/config.ts +++ b/test/localization/config.ts @@ -22,6 +22,8 @@ export type LocalizedPostAllLocale = LocalizedPost & { export const slug = 'localized-posts'; export const withLocalizedRelSlug = 'with-localized-relationship'; +export const withRequiredLocalizedFields = 'localized-required'; + const openAccess = { read: () => true, create: () => true, @@ -50,6 +52,43 @@ export default buildConfig({ }, ], }, + { + slug: withRequiredLocalizedFields, + fields: [ + { + name: 'title', + type: 'text', + required: true, + localized: true, + }, + { + name: 'layout', + type: 'blocks', + required: true, + localized: true, + blocks: [ + { + slug: 'text', + fields: [ + { + name: 'text', + type: 'text', + }, + ], + }, + { + slug: 'number', + fields: [ + { + name: 'number', + type: 'number', + }, + ], + }, + ], + }, + ], + }, { slug: withLocalizedRelSlug, access: openAccess, diff --git a/test/localization/int.spec.ts b/test/localization/int.spec.ts index 0719befced7..f30ef978946 100644 --- a/test/localization/int.spec.ts +++ b/test/localization/int.spec.ts @@ -1,9 +1,9 @@ import mongoose from 'mongoose'; import { initPayloadTest } from '../helpers/configHelpers'; import payload from '../../src'; -import type { LocalizedPost, WithLocalizedRelationship } from './payload-types'; +import type { LocalizedPost, WithLocalizedRelationship, LocalizedRequired } from './payload-types'; import type { LocalizedPostAllLocale } from './config'; -import config, { slug, withLocalizedRelSlug } from './config'; +import config, { slug, withLocalizedRelSlug, withRequiredLocalizedFields } from './config'; import { defaultLocale, englishTitle, @@ -446,6 +446,56 @@ describe('Localization', () => { }); }); }); + + describe('Localized - required', () => { + it('should update without passing all required fields', async () => { + const newDoc = await payload.create({ + collection: withRequiredLocalizedFields, + data: { + title: 'hello', + layout: [ + { + blockType: 'text', + text: 'laiwejfilwaje', + }, + ], + }, + }); + + await payload.update({ + collection: withRequiredLocalizedFields, + id: newDoc.id, + locale: spanishLocale, + data: { + title: 'en espanol, big bird', + layout: [ + { + blockType: 'number', + number: 12, + }, + ], + }, + }); + + const updatedDoc = await payload.update<LocalizedRequired>({ + collection: withRequiredLocalizedFields, + id: newDoc.id, + data: { + title: 'hello x2', + }, + }); + + expect(updatedDoc.layout[0].blockType).toStrictEqual('text'); + + const spanishDoc = await payload.findByID({ + collection: withRequiredLocalizedFields, + id: newDoc.id, + locale: spanishLocale, + }); + + expect(spanishDoc.layout[0].blockType).toStrictEqual('number'); + }); + }); }); async function createLocalizedPost(data: { diff --git a/test/localization/payload-types.ts b/test/localization/payload-types.ts index 0a1c107914e..8717f408324 100644 --- a/test/localization/payload-types.ts +++ b/test/localization/payload-types.ts @@ -17,6 +17,30 @@ export interface LocalizedPost { createdAt: string; updatedAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "localized-required". + */ +export interface LocalizedRequired { + id: string; + title: string; + layout: ( + | { + text?: string; + id?: string; + blockName?: string; + blockType: 'text'; + } + | { + number?: number; + id?: string; + blockName?: string; + blockType: 'number'; + } + )[]; + createdAt: string; + updatedAt: string; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "with-localized-relationship".
690a3cfa6841a2733fb62043bb33c0606c10c6a7
2024-03-26 08:26:28
Jacob Fletcher
fix(ui): threads data through document info context
false
threads data through document info context
fix
diff --git a/packages/next/src/views/Edit/Default/index.tsx b/packages/next/src/views/Edit/Default/index.tsx index 32ccd5a751e..157e3a5aa2c 100644 --- a/packages/next/src/views/Edit/Default/index.tsx +++ b/packages/next/src/views/Edit/Default/index.tsx @@ -41,6 +41,7 @@ export const DefaultEditView: React.FC = () => { action, apiURL, collectionSlug, + data, disableActions, disableLeaveWithoutSaving, docPermissions, @@ -49,7 +50,6 @@ export const DefaultEditView: React.FC = () => { getVersions, globalSlug, hasSavePermission, - initialData: data, initialState, isEditing, onSave: onSaveFromContext, diff --git a/packages/ui/src/providers/DocumentInfo/index.tsx b/packages/ui/src/providers/DocumentInfo/index.tsx index 5697c6f7f0b..e60a71e529c 100644 --- a/packages/ui/src/providers/DocumentInfo/index.tsx +++ b/packages/ui/src/providers/DocumentInfo/index.tsx @@ -382,6 +382,7 @@ export const DocumentInfoProvider: React.FC< const value: DocumentInfoContext = { ...props, + data, docConfig, docPermissions, getDocPermissions, diff --git a/packages/ui/src/providers/DocumentInfo/types.ts b/packages/ui/src/providers/DocumentInfo/types.ts index 3fcafd73a64..331b465345a 100644 --- a/packages/ui/src/providers/DocumentInfo/types.ts +++ b/packages/ui/src/providers/DocumentInfo/types.ts @@ -36,6 +36,7 @@ export type DocumentInfoProps = { } export type DocumentInfo = DocumentInfoProps & { + data: Data docConfig?: ClientCollectionConfig | ClientGlobalConfig preferencesKey?: string publishedDoc?: TypeWithID & TypeWithTimestamps & { _status?: string }
b9a9dad60a78a59140fa308cb4a5f5013df61faa
2024-04-16 20:44:44
Jacob Fletcher
fix(plugin-seo): uses correct key for ukrainian translation
false
uses correct key for ukrainian translation
fix
diff --git a/packages/plugin-seo/src/translations/index.ts b/packages/plugin-seo/src/translations/index.ts index 7104df69451..22cc49c6402 100644 --- a/packages/plugin-seo/src/translations/index.ts +++ b/packages/plugin-seo/src/translations/index.ts @@ -149,7 +149,7 @@ export const translations = { tooShort: 'Zbyt krótkie', }, }, - uk: { + ua: { $schema: './translation-schema.json', 'plugin-seo': { almostThere: 'Ще трошки', @@ -162,11 +162,14 @@ export const translations = { checksPassing: '{{current}}/{{max}} перевірок пройдено', good: 'Чудово', imageAutoGenerationTip: 'Автоматична генерація використає зображення з головного блоку', - lengthTipDescription: 'Має бути від {{minLength}} до {{maxLength}} символів. Щоб дізнатися, як писати якісні метаописи — перегляньте ', - lengthTipTitle: 'Має бути від {{minLength}} до {{maxLength}} символів. Щоб дізнатися, як писати якісні метазаголовки — перегляньте ', + lengthTipDescription: + 'Має бути від {{minLength}} до {{maxLength}} символів. Щоб дізнатися, як писати якісні метаописи — перегляньте ', + lengthTipTitle: + 'Має бути від {{minLength}} до {{maxLength}} символів. Щоб дізнатися, як писати якісні метазаголовки — перегляньте ', noImage: 'Немає зображення', preview: 'Попередній перегляд', - previewDescription: 'Реальне відображення може відрізнятися в залежності від вмісту та релевантності пошуку.', + previewDescription: + 'Реальне відображення може відрізнятися в залежності від вмісту та релевантності пошуку.', tooLong: 'Задовгий', tooShort: 'Закороткий', }, diff --git a/packages/plugin-seo/src/translations/uk.json b/packages/plugin-seo/src/translations/ua.json similarity index 100% rename from packages/plugin-seo/src/translations/uk.json rename to packages/plugin-seo/src/translations/ua.json diff --git a/packages/translations/src/exports/all.ts b/packages/translations/src/exports/all.ts index 4e6b32043cd..04919e7bd29 100644 --- a/packages/translations/src/exports/all.ts +++ b/packages/translations/src/exports/all.ts @@ -26,7 +26,7 @@ import { ru } from '../languages/ru.js' import { sv } from '../languages/sv.js' import { th } from '../languages/th.js' import { tr } from '../languages/tr.js' -import { uk } from '../languages/uk.js' +import { ua } from '../languages/ua.js' import { vi } from '../languages/vi.js' import { zh } from '../languages/zh.js' import { zhTw } from '../languages/zhTw.js' @@ -58,7 +58,7 @@ export const translations = { sv, th, tr, - uk, + ua, vi, zh, 'zh-TW': zhTw, diff --git a/packages/translations/src/importDateFNSLocale.ts b/packages/translations/src/importDateFNSLocale.ts index 7dad7fcc53f..71dee01f39e 100644 --- a/packages/translations/src/importDateFNSLocale.ts +++ b/packages/translations/src/importDateFNSLocale.ts @@ -96,7 +96,7 @@ export const importDateFNSLocale = async (locale: string): Promise<Locale> => { result = await import('date-fns/locale/tr') break - case 'uk': + case 'ua': result = await import('date-fns/locale/uk') break diff --git a/packages/translations/src/languages/uk.ts b/packages/translations/src/languages/ua.ts similarity index 98% rename from packages/translations/src/languages/uk.ts rename to packages/translations/src/languages/ua.ts index 71005b0a611..fee84621cc3 100644 --- a/packages/translations/src/languages/uk.ts +++ b/packages/translations/src/languages/ua.ts @@ -1,7 +1,7 @@ import type { Language } from '../types.js' -export const uk: Language = { - dateFNSKey: 'uk', +export const ua: Language = { + dateFNSKey: 'ua', translations: { authentication: { account: 'Обліковий запис', @@ -33,7 +33,8 @@ export const uk: Language = { lockUntil: 'Заблокувати до', logBackIn: 'Увійти знову', logOut: 'Вийти', - loggedIn: 'Щоб увйти в систему з іншого облікового запису, спочатку <0>вийдіть з системи</0>.', + loggedIn: + 'Щоб увйти в систему з іншого облікового запису, спочатку <0>вийдіть з системи</0>.', loggedInChangePassword: 'Щоб змінити ваш пароль, перейдіть до <0>сторінки облікового запису</0> і змініть ваш пароль.', loggedOutInactivity: 'Ви вийшли з системи через бездіяльність.', @@ -41,7 +42,8 @@ export const uk: Language = { login: 'Увійти', loginAttempts: 'Спроби входу', loginUser: 'Вхід користувача в систему', - loginWithAnotherUser: 'Щоб увйти в систему з іншого облікового запису, спочатку <0>вийдіть з системи</0>.', + loginWithAnotherUser: + 'Щоб увйти в систему з іншого облікового запису, спочатку <0>вийдіть з системи</0>.', logout: 'Вийти', logoutUser: 'Вийти з системи', newAPIKeyGenerated: 'Новий API ключ згенеровано.', diff --git a/packages/translations/src/types.ts b/packages/translations/src/types.ts index 1e06bf82b77..a9d399afb8f 100644 --- a/packages/translations/src/types.ts +++ b/packages/translations/src/types.ts @@ -26,7 +26,7 @@ type DateFNSKeys = | 'sv' | 'th' | 'tr' - | 'uk' + | 'ua' | 'vi' | 'zh-CN' | 'zh-TW'
32440d23f733c4a009e89d1fb27a4cbcf9d82a35
2024-04-05 02:10:58
Jacob Fletcher
chore(ui): extracts collection and global component maps into standalone files
false
extracts collection and global component maps into standalone files
chore
diff --git a/packages/ui/src/providers/ComponentMap/buildComponentMap/mapActions.tsx b/packages/ui/src/providers/ComponentMap/buildComponentMap/actions.tsx similarity index 100% rename from packages/ui/src/providers/ComponentMap/buildComponentMap/mapActions.tsx rename to packages/ui/src/providers/ComponentMap/buildComponentMap/actions.tsx diff --git a/packages/ui/src/providers/ComponentMap/buildComponentMap/collections.tsx b/packages/ui/src/providers/ComponentMap/buildComponentMap/collections.tsx new file mode 100644 index 00000000000..7449e1cfa9c --- /dev/null +++ b/packages/ui/src/providers/ComponentMap/buildComponentMap/collections.tsx @@ -0,0 +1,132 @@ +import type { + AdminViewProps, + EditViewProps, + SanitizedCollectionConfig, + SanitizedConfig, +} from 'payload/types' + +import React from 'react' + +import type { CollectionComponentMap } from './types.js' + +import { mapActions } from './actions.js' +import { mapFields } from './fields.js' + +export const mapCollections = ({ + DefaultEditView, + DefaultListView, + collections, + config, + readOnly: readOnlyOverride, +}: { + DefaultEditView: React.FC<EditViewProps> + DefaultListView: React.FC<AdminViewProps> + collections: SanitizedCollectionConfig[] + config: SanitizedConfig + readOnly?: boolean +}): { + [key: SanitizedCollectionConfig['slug']]: CollectionComponentMap +} => + collections.reduce((acc, collectionConfig) => { + const { slug, fields } = collectionConfig + + const internalCollections = ['payload-preferences', 'payload-migrations'] + + if (internalCollections.includes(slug)) { + return acc + } + + const editViewFromConfig = collectionConfig?.admin?.components?.views?.Edit + + const listViewFromConfig = collectionConfig?.admin?.components?.views?.List + + const CustomEditView = + typeof editViewFromConfig === 'function' + ? editViewFromConfig + : typeof editViewFromConfig === 'object' && typeof editViewFromConfig.Default === 'function' + ? editViewFromConfig.Default + : typeof editViewFromConfig?.Default === 'object' && + 'Component' in editViewFromConfig.Default && + typeof editViewFromConfig.Default.Component === 'function' + ? (editViewFromConfig.Default.Component as React.FC<EditViewProps>) + : undefined + + const CustomListView = + typeof listViewFromConfig === 'function' + ? listViewFromConfig + : typeof listViewFromConfig === 'object' && + typeof listViewFromConfig.Component === 'function' + ? listViewFromConfig.Component + : undefined + + const Edit = (CustomEditView as React.FC<EditViewProps>) || DefaultEditView + + const List = CustomListView || DefaultListView + + const beforeList = collectionConfig?.admin?.components?.BeforeList + + const beforeListTable = collectionConfig?.admin?.components?.BeforeListTable + + const afterList = collectionConfig?.admin?.components?.AfterList + + const afterListTable = collectionConfig?.admin?.components?.AfterListTable + + const SaveButtonComponent = collectionConfig?.admin?.components?.edit?.SaveButton + const SaveButton = SaveButtonComponent ? <SaveButtonComponent /> : undefined + + const SaveDraftButtonComponent = collectionConfig?.admin?.components?.edit?.SaveDraftButton + const SaveDraftButton = SaveDraftButtonComponent ? <SaveDraftButtonComponent /> : undefined + + const PreviewButtonComponent = collectionConfig?.admin?.components?.edit?.PreviewButton + const PreviewButton = PreviewButtonComponent ? <PreviewButtonComponent /> : undefined + + const PublishButtonComponent = collectionConfig?.admin?.components?.edit?.PublishButton + const PublishButton = PublishButtonComponent ? <PublishButtonComponent /> : undefined + + const BeforeList = + (beforeList && Array.isArray(beforeList) && beforeList?.map((Component) => <Component />)) || + null + + const BeforeListTable = + (beforeListTable && + Array.isArray(beforeListTable) && + beforeListTable?.map((Component) => <Component />)) || + null + + const AfterList = + (afterList && Array.isArray(afterList) && afterList?.map((Component) => <Component />)) || + null + + const AfterListTable = + (afterListTable && + Array.isArray(afterListTable) && + afterListTable?.map((Component) => <Component />)) || + null + + const componentMap: CollectionComponentMap = { + AfterList, + AfterListTable, + BeforeList, + BeforeListTable, + Edit: <Edit collectionSlug={collectionConfig.slug} />, + List: <List collectionSlug={collectionConfig.slug} />, + PreviewButton, + PublishButton, + SaveButton, + SaveDraftButton, + actionsMap: mapActions({ + collectionConfig, + }), + fieldMap: mapFields({ + config, + fieldSchema: fields, + readOnly: readOnlyOverride, + }), + isPreviewEnabled: !!collectionConfig?.admin?.preview, + } + + return { + ...acc, + [slug]: componentMap, + } + }, {}) diff --git a/packages/ui/src/providers/ComponentMap/buildComponentMap/mapFields.tsx b/packages/ui/src/providers/ComponentMap/buildComponentMap/fields.tsx similarity index 100% rename from packages/ui/src/providers/ComponentMap/buildComponentMap/mapFields.tsx rename to packages/ui/src/providers/ComponentMap/buildComponentMap/fields.tsx diff --git a/packages/ui/src/providers/ComponentMap/buildComponentMap/globals.tsx b/packages/ui/src/providers/ComponentMap/buildComponentMap/globals.tsx new file mode 100644 index 00000000000..a9bb38f3a9f --- /dev/null +++ b/packages/ui/src/providers/ComponentMap/buildComponentMap/globals.tsx @@ -0,0 +1,74 @@ +import type { EditViewProps, SanitizedConfig, SanitizedGlobalConfig } from 'payload/types' + +import React from 'react' + +import type { GlobalComponentMap } from './types.js' + +import { mapActions } from './actions.js' +import { mapFields } from './fields.js' + +export const mapGlobals = ({ + DefaultEditView, + config, + globals, + readOnly: readOnlyOverride, +}: { + DefaultEditView: React.FC<EditViewProps> + config: SanitizedConfig + globals: SanitizedGlobalConfig[] + readOnly?: boolean +}): { + [key: SanitizedGlobalConfig['slug']]: GlobalComponentMap +} => + globals.reduce((acc, globalConfig) => { + const { slug, fields } = globalConfig + + const editViewFromConfig = globalConfig?.admin?.components?.views?.Edit + + const SaveButton = globalConfig?.admin?.components?.elements?.SaveButton + const SaveButtonComponent = SaveButton ? <SaveButton /> : undefined + + const SaveDraftButton = globalConfig?.admin?.components?.elements?.SaveDraftButton + const SaveDraftButtonComponent = SaveDraftButton ? <SaveDraftButton /> : undefined + + const PreviewButton = globalConfig?.admin?.components?.elements?.PreviewButton + const PreviewButtonComponent = PreviewButton ? <PreviewButton /> : undefined + + const PublishButton = globalConfig?.admin?.components?.elements?.PublishButton + const PublishButtonComponent = PublishButton ? <PublishButton /> : undefined + + const CustomEditView = + typeof editViewFromConfig === 'function' + ? editViewFromConfig + : typeof editViewFromConfig === 'object' && typeof editViewFromConfig.Default === 'function' + ? editViewFromConfig.Default + : typeof editViewFromConfig?.Default === 'object' && + 'Component' in editViewFromConfig.Default && + typeof editViewFromConfig.Default.Component === 'function' + ? editViewFromConfig.Default.Component + : undefined + + const Edit = (CustomEditView as React.FC<EditViewProps>) || DefaultEditView + + const componentMap: GlobalComponentMap = { + Edit: <Edit globalSlug={globalConfig.slug} />, + PreviewButton: PreviewButtonComponent, + PublishButton: PublishButtonComponent, + SaveButton: SaveButtonComponent, + SaveDraftButton: SaveDraftButtonComponent, + actionsMap: mapActions({ + globalConfig, + }), + fieldMap: mapFields({ + config, + fieldSchema: fields, + readOnly: readOnlyOverride, + }), + isPreviewEnabled: !!globalConfig?.admin?.preview, + } + + return { + ...acc, + [slug]: componentMap, + } + }, {}) diff --git a/packages/ui/src/providers/ComponentMap/buildComponentMap/index.tsx b/packages/ui/src/providers/ComponentMap/buildComponentMap/index.tsx index 1d4c623f648..f9f669aa632 100644 --- a/packages/ui/src/providers/ComponentMap/buildComponentMap/index.tsx +++ b/packages/ui/src/providers/ComponentMap/buildComponentMap/index.tsx @@ -1,15 +1,15 @@ -import type { EditViewProps, SanitizedConfig } from 'payload/types' +import type { AdminViewProps, EditViewProps, SanitizedConfig } from 'payload/types' import React from 'react' -import type { CollectionComponentMap, ComponentMap, GlobalComponentMap } from './types.js' +import type { ComponentMap } from './types.js' -import { mapActions } from './mapActions.js' -import { mapFields } from './mapFields.js' +import { mapCollections } from './collections.js' +import { mapGlobals } from './globals.js' export const buildComponentMap = (args: { DefaultEditView: React.FC<EditViewProps> - DefaultListView: React.FC<EditViewProps> + DefaultListView: React.FC<AdminViewProps> children: React.ReactNode config: SanitizedConfig readOnly?: boolean @@ -17,166 +17,22 @@ export const buildComponentMap = (args: { componentMap: ComponentMap wrappedChildren: React.ReactNode } => { - const { DefaultEditView, DefaultListView, children, config, readOnly: readOnlyOverride } = args - - // Collections - const collections = config.collections.reduce((acc, collectionConfig) => { - const { slug, fields } = collectionConfig - - const internalCollections = ['payload-preferences', 'payload-migrations'] - - if (internalCollections.includes(slug)) { - return acc - } - - const editViewFromConfig = collectionConfig?.admin?.components?.views?.Edit - - const listViewFromConfig = collectionConfig?.admin?.components?.views?.List - - const CustomEditView = - typeof editViewFromConfig === 'function' - ? editViewFromConfig - : typeof editViewFromConfig === 'object' && typeof editViewFromConfig.Default === 'function' - ? editViewFromConfig.Default - : typeof editViewFromConfig?.Default === 'object' && - 'Component' in editViewFromConfig.Default && - typeof editViewFromConfig.Default.Component === 'function' - ? (editViewFromConfig.Default.Component as React.FC<EditViewProps>) - : undefined - - const CustomListView = - typeof listViewFromConfig === 'function' - ? listViewFromConfig - : typeof listViewFromConfig === 'object' && - typeof listViewFromConfig.Component === 'function' - ? listViewFromConfig.Component - : undefined - - const Edit = (CustomEditView as React.FC<EditViewProps>) || DefaultEditView - - const List = CustomListView || DefaultListView - - const beforeList = collectionConfig?.admin?.components?.BeforeList - - const beforeListTable = collectionConfig?.admin?.components?.BeforeListTable - - const afterList = collectionConfig?.admin?.components?.AfterList - - const afterListTable = collectionConfig?.admin?.components?.AfterListTable - - const SaveButtonComponent = collectionConfig?.admin?.components?.edit?.SaveButton - const SaveButton = SaveButtonComponent ? <SaveButtonComponent /> : undefined - - const SaveDraftButtonComponent = collectionConfig?.admin?.components?.edit?.SaveDraftButton - const SaveDraftButton = SaveDraftButtonComponent ? <SaveDraftButtonComponent /> : undefined - - const PreviewButtonComponent = collectionConfig?.admin?.components?.edit?.PreviewButton - const PreviewButton = PreviewButtonComponent ? <PreviewButtonComponent /> : undefined - - const PublishButtonComponent = collectionConfig?.admin?.components?.edit?.PublishButton - const PublishButton = PublishButtonComponent ? <PublishButtonComponent /> : undefined - - const BeforeList = - (beforeList && Array.isArray(beforeList) && beforeList?.map((Component) => <Component />)) || - null - - const BeforeListTable = - (beforeListTable && - Array.isArray(beforeListTable) && - beforeListTable?.map((Component) => <Component />)) || - null - - const AfterList = - (afterList && Array.isArray(afterList) && afterList?.map((Component) => <Component />)) || - null - - const AfterListTable = - (afterListTable && - Array.isArray(afterListTable) && - afterListTable?.map((Component) => <Component />)) || - null - - const componentMap: CollectionComponentMap = { - AfterList, - AfterListTable, - BeforeList, - BeforeListTable, - Edit: <Edit collectionSlug={collectionConfig.slug} />, - List: <List collectionSlug={collectionConfig.slug} />, - PreviewButton, - PublishButton, - SaveButton, - SaveDraftButton, - actionsMap: mapActions({ - collectionConfig, - }), - fieldMap: mapFields({ - config, - fieldSchema: fields, - readOnly: readOnlyOverride, - }), - isPreviewEnabled: !!collectionConfig?.admin?.preview, - } - - return { - ...acc, - [slug]: componentMap, - } - }, {}) - - // Globals - const globals = config.globals.reduce((acc, globalConfig) => { - const { slug, fields } = globalConfig - - const editViewFromConfig = globalConfig?.admin?.components?.views?.Edit - - const SaveButton = globalConfig?.admin?.components?.elements?.SaveButton - const SaveButtonComponent = SaveButton ? <SaveButton /> : undefined - - const SaveDraftButton = globalConfig?.admin?.components?.elements?.SaveDraftButton - const SaveDraftButtonComponent = SaveDraftButton ? <SaveDraftButton /> : undefined - - const PreviewButton = globalConfig?.admin?.components?.elements?.PreviewButton - const PreviewButtonComponent = PreviewButton ? <PreviewButton /> : undefined - - const PublishButton = globalConfig?.admin?.components?.elements?.PublishButton - const PublishButtonComponent = PublishButton ? <PublishButton /> : undefined - - const CustomEditView = - typeof editViewFromConfig === 'function' - ? editViewFromConfig - : typeof editViewFromConfig === 'object' && typeof editViewFromConfig.Default === 'function' - ? editViewFromConfig.Default - : typeof editViewFromConfig?.Default === 'object' && - 'Component' in editViewFromConfig.Default && - typeof editViewFromConfig.Default.Component === 'function' - ? editViewFromConfig.Default.Component - : undefined - - const Edit = (CustomEditView as React.FC<EditViewProps>) || DefaultEditView - - const componentMap: GlobalComponentMap = { - Edit: <Edit globalSlug={globalConfig.slug} />, - PreviewButton: PreviewButtonComponent, - PublishButton: PublishButtonComponent, - SaveButton: SaveButtonComponent, - SaveDraftButton: SaveDraftButtonComponent, - actionsMap: mapActions({ - globalConfig, - }), - fieldMap: mapFields({ - config, - fieldSchema: fields, - readOnly: readOnlyOverride, - }), - isPreviewEnabled: !!globalConfig?.admin?.preview, - } - - return { - ...acc, - [slug]: componentMap, - } - }, {}) + const { DefaultEditView, DefaultListView, children, config, readOnly } = args + + const collections = mapCollections({ + DefaultEditView, + DefaultListView, + collections: config.collections, + config, + readOnly, + }) + + const globals = mapGlobals({ + DefaultEditView, + config, + globals: config.globals, + readOnly, + }) const NestProviders = ({ children, providers }) => { const Component = providers[0] diff --git a/packages/ui/src/utilities/buildComponentMap.ts b/packages/ui/src/utilities/buildComponentMap.ts index 0205acb97a0..b4dd74d0d56 100644 --- a/packages/ui/src/utilities/buildComponentMap.ts +++ b/packages/ui/src/utilities/buildComponentMap.ts @@ -1,3 +1,3 @@ +export { mapFields } from '../providers/ComponentMap/buildComponentMap/fields.js' export { buildComponentMap } from '../providers/ComponentMap/buildComponentMap/index.js' -export { mapFields } from '../providers/ComponentMap/buildComponentMap/mapFields.js' export type * from '../providers/ComponentMap/buildComponentMap/types.js'
6d8aca5ab3ef72f909169b8caeba901f74d66043
2025-03-01 07:59:07
Alessio Gravili
fix(richtext-lexical): ensure nested forms do not use form element (#11462)
false
ensure nested forms do not use form element (#11462)
fix
diff --git a/packages/richtext-lexical/src/features/blocks/client/component/index.tsx b/packages/richtext-lexical/src/features/blocks/client/component/index.tsx index a7348e12cc0..5b17cda0adb 100644 --- a/packages/richtext-lexical/src/features/blocks/client/component/index.tsx +++ b/packages/richtext-lexical/src/features/blocks/client/component/index.tsx @@ -541,6 +541,7 @@ export const BlockComponent: React.FC<Props> = (props) => { return await onChange({ formState, submit: true }) }, ]} + el="div" fields={clientBlockFields} initialState={initialState} onChange={[onChange]} diff --git a/packages/richtext-lexical/src/features/blocks/client/componentInline/index.tsx b/packages/richtext-lexical/src/features/blocks/client/componentInline/index.tsx index 10330ddb3c2..8b38497e412 100644 --- a/packages/richtext-lexical/src/features/blocks/client/componentInline/index.tsx +++ b/packages/richtext-lexical/src/features/blocks/client/componentInline/index.tsx @@ -391,6 +391,7 @@ export const InlineBlockComponent: React.FC<Props> = (props) => { }, ]} disableValidationOnSubmit + el="div" fields={clientBlock?.fields} initialState={initialState || {}} onChange={[onChange]} diff --git a/packages/ui/src/forms/Form/index.tsx b/packages/ui/src/forms/Form/index.tsx index 8e8bc2c2b27..319ba9c0906 100644 --- a/packages/ui/src/forms/Form/index.tsx +++ b/packages/ui/src/forms/Form/index.tsx @@ -66,6 +66,7 @@ export const Form: React.FC<FormProps> = (props) => { disableSuccessStatus, disableValidationOnSubmit, // fields: fieldsFromProps = collection?.fields || global?.fields, + el, handleResponse, initialState, // fully formed initial field state isDocumentForm, @@ -783,8 +784,10 @@ export const Form: React.FC<FormProps> = (props) => { } : {} + const El: 'form' = (el as unknown as 'form') || 'form' + return ( - <form + <El action={typeof action === 'function' ? void action : action} className={classes} method={method} @@ -816,7 +819,7 @@ export const Form: React.FC<FormProps> = (props) => { </FormWatchContext.Provider> </FormContext.Provider> </DocumentFormContextComponent> - </form> + </El> ) } diff --git a/packages/ui/src/forms/Form/types.ts b/packages/ui/src/forms/Form/types.ts index f68a23eeb90..7c0266441b9 100644 --- a/packages/ui/src/forms/Form/types.ts +++ b/packages/ui/src/forms/Form/types.ts @@ -25,6 +25,10 @@ export type FormProps = { * you can disable checks that the form makes before it submits */ disableValidationOnSubmit?: boolean + /** + * If you don't want the form to be a <form> element, you can pass a string here to use as the wrapper element. + */ + el?: string /** * By default, the form will get the field schema (not data) from the current document. If you pass this in, you can override that behavior. * This is very useful for sub-forms, where the form's field schema is not necessarily the field schema of the current document (e.g. for the Blocks diff --git a/test/fields/collections/Lexical/e2e/blocks/e2e.spec.ts b/test/fields/collections/Lexical/e2e/blocks/e2e.spec.ts index 2fc74922ab2..e384a5b9c6d 100644 --- a/test/fields/collections/Lexical/e2e/blocks/e2e.spec.ts +++ b/test/fields/collections/Lexical/e2e/blocks/e2e.spec.ts @@ -1190,7 +1190,7 @@ describe('lexicalBlocks', () => { // Ensure radio button option1 of radioButtonBlock2 (the default option) is still selected await expect( radioButtonBlock2.locator('.radio-input:has-text("Option 1")').first(), - ).toBeChecked() + ).toHaveClass(/radio-input--is-selected/) // Click radio button option3 of radioButtonBlock2 await radioButtonBlock2 @@ -1201,7 +1201,7 @@ describe('lexicalBlocks', () => { // Ensure previously clicked option2 of radioButtonBlock1 is still selected await expect( radioButtonBlock1.locator('.radio-input:has-text("Option 2")').first(), - ).toBeChecked() + ).toHaveClass(/radio-input--is-selected/) /** * Now save and check the actual data. radio button block 1 should have option2 selected and radio button block 2 should have option3 selected
150c55de79f92035b3bb740bfd1fa0c4cba2ebc8
2024-11-25 19:50:22
Sasha
chore(next): remove deep copying of `docPermissions` in the Version View (#9491)
false
remove deep copying of `docPermissions` in the Version View (#9491)
chore
diff --git a/packages/next/src/views/Version/index.tsx b/packages/next/src/views/Version/index.tsx index 384d72a22d8..39710c33269 100644 --- a/packages/next/src/views/Version/index.tsx +++ b/packages/next/src/views/Version/index.tsx @@ -8,7 +8,6 @@ import type { } from 'payload' import { notFound } from 'next/navigation.js' -import { deepCopyObjectSimple } from 'payload' import React from 'react' import { getLatestVersion } from '../Versions/getLatestVersion.js' @@ -140,14 +139,7 @@ export const VersionView: PayloadServerReactComponent<EditViewComponent> = async return ( <DefaultVersionView doc={doc} - /** - * After bumping the Next.js canary to 104, and React to 19.0.0-rc-06d0b89e-20240801" we have to deepCopy the permissions object (https://github.com/payloadcms/payload/pull/7541). - * If both HydrateClientUser and RenderCustomComponent receive the same permissions object (same object reference), we get a - * "TypeError: Cannot read properties of undefined (reading '$$typeof')" error - * - * // TODO: Revisit this in the future and figure out why this is happening. Might be a React/Next.js bug. We don't know why it happens, and a future React/Next version might unbreak this (keep an eye on this and remove deepCopyObjectSimple if that's the case) - */ - docPermissions={deepCopyObjectSimple(docPermissions)} + docPermissions={docPermissions} initialComparisonDoc={latestVersion} latestDraftVersion={latestDraftVersion?.id} latestPublishedVersion={latestPublishedVersion?.id} diff --git a/test/versions/payload-types.ts b/test/versions/payload-types.ts index f054d023cbf..f5bee2ffbba 100644 --- a/test/versions/payload-types.ts +++ b/test/versions/payload-types.ts @@ -60,9 +60,9 @@ export interface Config { user: User & { collection: 'users'; }; - jobs?: { + jobs: { tasks: unknown; - workflows?: unknown; + workflows: unknown; }; } export interface UserAuthOperations {
8f729bba41094db69e26faae3828defcd8f9c9f1
2024-01-24 02:49:45
Jarrod Flesch
chore: remove findByID from req
false
remove findByID from req
chore
diff --git a/packages/payload/package.json b/packages/payload/package.json index f1ee50ec16f..7f1abf402d0 100644 --- a/packages/payload/package.json +++ b/packages/payload/package.json @@ -64,7 +64,6 @@ "json-schema-to-typescript": "11.0.3", "jsonwebtoken": "9.0.1", "jwt-decode": "3.1.2", - "micro-memoize": "4.1.2", "minimist": "1.2.8", "mkdirp": "1.0.4", "monaco-editor": "0.38.0", diff --git a/packages/payload/src/collections/operations/findByID.ts b/packages/payload/src/collections/operations/findByID.ts index 7235486e5a4..06c115a4ade 100644 --- a/packages/payload/src/collections/operations/findByID.ts +++ b/packages/payload/src/collections/operations/findByID.ts @@ -1,6 +1,4 @@ /* eslint-disable no-underscore-dangle */ -import memoize from 'micro-memoize' - import type { FindOneArgs } from '../../database/types' import type { PayloadRequest } from '../../types' import type { Collection, TypeWithID } from '../config/types' @@ -63,7 +61,6 @@ export const findByIDOperation = async <T extends TypeWithID>( try { const shouldCommit = await initTransaction(req) - const { transactionID } = req // ///////////////////////////////////// // Access @@ -91,25 +88,7 @@ export const findByIDOperation = async <T extends TypeWithID>( if (!findOneArgs.where.and[0].id) throw new NotFound(req.t) - if (!req.findByID) { - req.findByID = { [transactionID]: {} } - } else if (!req.findByID[transactionID]) { - req.findByID[transactionID] = {} - } - - if (!req.findByID[transactionID][collectionConfig.slug]) { - const nonMemoizedFindByID = async (query: FindOneArgs) => req.payload.db.findOne(query) - - req.findByID[transactionID][collectionConfig.slug] = memoize(nonMemoizedFindByID, { - isPromise: true, - maxSize: 100, - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore This is straight from their docs, bad typings - transformKey: JSON.stringify, - }) - } - - let result = (await req.findByID[transactionID][collectionConfig.slug](findOneArgs)) as T + let result = await req.payload.db.findOne<T>(findOneArgs) if (!result) { if (!disableErrors) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c65acd7c03a..616543df550 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -576,9 +576,6 @@ importers: jwt-decode: specifier: 3.1.2 version: 3.1.2 - micro-memoize: - specifier: 4.1.2 - version: 4.1.2 minimist: specifier: 1.2.8 version: 1.2.8 @@ -6362,7 +6359,7 @@ packages: resolution: {integrity: sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==} engines: {node: '>= 14'} dependencies: - debug: 4.3.4([email protected]) + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: true @@ -7944,6 +7941,18 @@ packages: ms: 2.1.3 supports-color: 5.5.0 + /[email protected]: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + dev: true + /[email protected]([email protected]): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} @@ -9338,8 +9347,12 @@ packages: dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 +<<<<<<< Updated upstream webpack: 5.88.2(@swc/[email protected]) dev: true +======= + webpack: 5.88.2 +>>>>>>> Stashed changes /[email protected]: resolution: {integrity: sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==} @@ -9719,7 +9732,7 @@ packages: dependencies: basic-ftp: 5.0.3 data-uri-to-buffer: 5.0.1 - debug: 4.3.4([email protected]) + debug: 4.3.4 fs-extra: 8.1.0 transitivePeerDependencies: - supports-color @@ -10267,7 +10280,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4([email protected]) + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: true @@ -10307,7 +10320,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4([email protected]) + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: true @@ -12231,10 +12244,6 @@ packages: resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} engines: {node: '>= 0.6'} - /[email protected]: - resolution: {integrity: sha512-+HzcV2H+rbSJzApgkj0NdTakkC+bnyeiUxgT6/m7mjcz1CmM22KYFKp+EVj1sWe4UYcnriJr5uqHQD/gMHLD+g==} - dev: false - /[email protected]: resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} engines: {node: '>=8.6'} @@ -12304,7 +12313,11 @@ packages: dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 +<<<<<<< Updated upstream webpack: 5.88.2(@swc/[email protected]) +======= + webpack: 5.88.2 +>>>>>>> Stashed changes webpack-sources: 1.4.3 dev: true @@ -13139,7 +13152,7 @@ packages: dependencies: '@tootallnate/quickjs-emscripten': 0.23.0 agent-base: 7.1.0 - debug: 4.3.4([email protected]) + debug: 4.3.4 get-uri: 6.0.1 http-proxy-agent: 7.0.0 https-proxy-agent: 7.0.2 @@ -13701,7 +13714,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4([email protected]) + debug: 4.3.4 http-proxy-agent: 7.0.0 https-proxy-agent: 7.0.2 lru-cache: 7.18.3 @@ -14849,7 +14862,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4([email protected]) + debug: 4.3.4 socks: 2.7.1 transitivePeerDependencies: - supports-color @@ -15368,6 +15381,29 @@ packages: webpack: 5.88.2(@swc/[email protected]) dev: true + /[email protected]([email protected]): + resolution: {integrity: sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==} + engines: {node: '>= 10.13.0'} + peerDependencies: + '@swc/core': '*' + esbuild: '*' + uglify-js: '*' + webpack: ^5.1.0 + peerDependenciesMeta: + '@swc/core': + optional: true + esbuild: + optional: true + uglify-js: + optional: true + dependencies: + '@jridgewell/trace-mapping': 0.3.19 + jest-worker: 27.5.1 + schema-utils: 3.3.0 + serialize-javascript: 6.0.1 + terser: 5.19.2 + webpack: 5.88.2 + /[email protected]: resolution: {integrity: sha512-qC5+dmecKJA4cpYxRa5aVkKehYsQKc+AHeKl0Oe62aYjBL8ZA33tTljktDHJSaxxMnbI5ZYw+o/S2DxxLu8OfA==} engines: {node: '>=10'} @@ -16151,7 +16187,50 @@ packages: engines: {node: '>=10.13.0'} dev: true +<<<<<<< Updated upstream /[email protected](@swc/[email protected]): +======= + /[email protected]: + resolution: {integrity: sha512-JmcgNZ1iKj+aiR0OvTYtWQqJwq37Pf683dY9bVORwVbUrDhLhdn/PlO2sHsFHPkj7sHNQF3JwaAkp49V+Sq1tQ==} + engines: {node: '>=10.13.0'} + hasBin: true + peerDependencies: + webpack-cli: '*' + peerDependenciesMeta: + webpack-cli: + optional: true + dependencies: + '@types/eslint-scope': 3.7.4 + '@types/estree': 1.0.1 + '@webassemblyjs/ast': 1.11.6 + '@webassemblyjs/wasm-edit': 1.11.6 + '@webassemblyjs/wasm-parser': 1.11.6 + acorn: 8.10.0 + acorn-import-assertions: 1.9.0([email protected]) + browserslist: 4.21.10 + chrome-trace-event: 1.0.3 + enhanced-resolve: 5.15.0 + es-module-lexer: 1.3.1 + eslint-scope: 5.1.1 + events: 3.3.0 + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + json-parse-even-better-errors: 2.3.1 + loader-runner: 4.3.0 + mime-types: 2.1.35 + neo-async: 2.6.2 + schema-utils: 3.3.0 + tapable: 2.2.1 + terser-webpack-plugin: 5.3.9([email protected]) + watchpack: 2.4.0 + webpack-sources: 3.2.3 + transitivePeerDependencies: + - '@swc/core' + - esbuild + - uglify-js + + /[email protected](@swc/[email protected])([email protected]): +>>>>>>> Stashed changes resolution: {integrity: sha512-JmcgNZ1iKj+aiR0OvTYtWQqJwq37Pf683dY9bVORwVbUrDhLhdn/PlO2sHsFHPkj7sHNQF3JwaAkp49V+Sq1tQ==} engines: {node: '>=10.13.0'} hasBin: true
08eb13d189819be777a69d3290abb9a9e822d9f0
2024-12-21 17:53:01
Sam
docs: remove stray backtick from Nested Docs Plugin page (#10118)
false
remove stray backtick from Nested Docs Plugin page (#10118)
docs
diff --git a/docs/plugins/nested-docs.mdx b/docs/plugins/nested-docs.mdx index cf0dc8e7376..b3621ebc215 100644 --- a/docs/plugins/nested-docs.mdx +++ b/docs/plugins/nested-docs.mdx @@ -196,7 +196,7 @@ const examplePageConfig: CollectionConfig = { }, // Note: if you override the `filterOptions` of the `parent` field, // be sure to continue to prevent the document from referencing itself as the parent like this: - // filterOptions: ({ id }) => ({ id: {not_equals: id }})` + // filterOptions: ({ id }) => ({ id: {not_equals: id }}) }, ), createBreadcrumbsField(
2697974694112440bf1737c4ce535ba77bf4b194
2023-05-08 22:53:09
Alessio Gravili
fix: fix tests by hard-coding the URL in the logger
false
fix tests by hard-coding the URL in the logger
fix
diff --git a/test/buildConfig.ts b/test/buildConfig.ts index 09cc4dd41ac..bd5693216e3 100644 --- a/test/buildConfig.ts +++ b/test/buildConfig.ts @@ -12,8 +12,6 @@ export function buildConfig(config?: Partial<Config>): Promise<SanitizedConfig> ...config, }; - baseConfig.serverURL = baseConfig.serverURL || 'http://localhost:3000'; - baseConfig.admin = { ...(baseConfig.admin || {}), webpack: (webpackConfig) => { diff --git a/test/dev.ts b/test/dev.ts index 728ed5ad49b..fd2a1e45a9c 100644 --- a/test/dev.ts +++ b/test/dev.ts @@ -49,8 +49,8 @@ const startDev = async () => { externalRouter.use(payload.authenticate); expressApp.listen(3000, async () => { - payload.logger.info(`Admin URL on ${payload.getAdminURL()}`); - payload.logger.info(`API URL on ${payload.getAPIURL()}`); + payload.logger.info(`Admin URL on http://localhost:3000${payload.getAdminURL()}`); + payload.logger.info(`API URL on http://localhost:3000${payload.getAPIURL()}`); }); };
d57a78616a9da2b674a60d7eb0b8c439a5b895e0
2025-03-03 23:54:05
Ondřej Nývlt
docs: clarify that image resizing/cropping require `sharp` to be specified in payload config (#11470)
false
clarify that image resizing/cropping require `sharp` to be specified in payload config (#11470)
docs
diff --git a/docs/upload/overview.mdx b/docs/upload/overview.mdx index aa88c687026..f12a06160e8 100644 --- a/docs/upload/overview.mdx +++ b/docs/upload/overview.mdx @@ -185,6 +185,8 @@ The [Admin Panel](../admin/overview) will also automatically display all availab Behind the scenes, Payload relies on [`sharp`](https://sharp.pixelplumbing.com/api-resize#resize) to perform its image resizing. You can specify additional options for `sharp` to use while resizing your images. +Note that for image resizing to work, `sharp` must be specified in your [Payload Config](../configuration/overview). This is configured by default if you created your Payload project with `create-payload-app`. See `sharp` in [Config Options](../configuration/overview#config-options). + #### Accessing the resized images in hooks All auto-resized images are exposed to be re-used in hooks and similar via an object that is bound to `req.payloadUploadSizes`.
0dd17e6347800c59348b20736bc25629120c7b8e
2024-08-20 06:57:26
Elliot DeNolf
chore(release): v3.0.0-beta.86 [skip ci]
false
v3.0.0-beta.86 [skip ci]
chore
diff --git a/package.json b/package.json index 777f2804c2f..511c3ebaaf9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload-monorepo", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "private": true, "type": "module", "scripts": { diff --git a/packages/create-payload-app/package.json b/packages/create-payload-app/package.json index d6b7ec84c55..e326bd3ac3d 100644 --- a/packages/create-payload-app/package.json +++ b/packages/create-payload-app/package.json @@ -1,6 +1,6 @@ { "name": "create-payload-app", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "homepage": "https://payloadcms.com", "repository": { "type": "git", diff --git a/packages/db-mongodb/package.json b/packages/db-mongodb/package.json index 407e412006a..0bd80e734d2 100644 --- a/packages/db-mongodb/package.json +++ b/packages/db-mongodb/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/db-mongodb", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "The officially supported MongoDB database adapter for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/db-postgres/package.json b/packages/db-postgres/package.json index 5a1f160150f..31a74269909 100644 --- a/packages/db-postgres/package.json +++ b/packages/db-postgres/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/db-postgres", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "The officially supported Postgres database adapter for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/db-sqlite/package.json b/packages/db-sqlite/package.json index 92d1ac1348e..fe4102373bb 100644 --- a/packages/db-sqlite/package.json +++ b/packages/db-sqlite/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/db-sqlite", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "The officially supported SQLite database adapter for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/drizzle/package.json b/packages/drizzle/package.json index 6f945156912..47d68172dc3 100644 --- a/packages/drizzle/package.json +++ b/packages/drizzle/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/drizzle", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "A library of shared functions used by different payload database adapters", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/email-nodemailer/package.json b/packages/email-nodemailer/package.json index 36644061e12..d9ab6fa1aa2 100644 --- a/packages/email-nodemailer/package.json +++ b/packages/email-nodemailer/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/email-nodemailer", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "Payload Nodemailer Email Adapter", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/email-resend/package.json b/packages/email-resend/package.json index 20a12336b2b..bda8c27e8f0 100644 --- a/packages/email-resend/package.json +++ b/packages/email-resend/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/email-resend", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "Payload Resend Email Adapter", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/graphql/package.json b/packages/graphql/package.json index 3d4290eecc2..ce588faf14f 100644 --- a/packages/graphql/package.json +++ b/packages/graphql/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/graphql", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "homepage": "https://payloadcms.com", "repository": { "type": "git", diff --git a/packages/live-preview-react/package.json b/packages/live-preview-react/package.json index 65223dbde34..a502673a374 100644 --- a/packages/live-preview-react/package.json +++ b/packages/live-preview-react/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/live-preview-react", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "The official React SDK for Payload Live Preview", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/live-preview-vue/package.json b/packages/live-preview-vue/package.json index 0c983dec382..ea65aeaa7e9 100644 --- a/packages/live-preview-vue/package.json +++ b/packages/live-preview-vue/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/live-preview-vue", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "The official Vue SDK for Payload Live Preview", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/live-preview/package.json b/packages/live-preview/package.json index 05ceae32943..01ddfd0d79c 100644 --- a/packages/live-preview/package.json +++ b/packages/live-preview/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/live-preview", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "The official live preview JavaScript SDK for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/next/package.json b/packages/next/package.json index f23e37848db..795fd886703 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/next", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "homepage": "https://payloadcms.com", "repository": { "type": "git", diff --git a/packages/payload/package.json b/packages/payload/package.json index 32cdb311165..ee093dccfda 100644 --- a/packages/payload/package.json +++ b/packages/payload/package.json @@ -1,6 +1,6 @@ { "name": "payload", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "Node, React, Headless CMS and Application Framework built on Next.js", "keywords": [ "admin panel", diff --git a/packages/plugin-cloud-storage/package.json b/packages/plugin-cloud-storage/package.json index 4834994ef4a..478084bf5f2 100644 --- a/packages/plugin-cloud-storage/package.json +++ b/packages/plugin-cloud-storage/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-cloud-storage", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "The official cloud storage plugin for Payload CMS", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/plugin-cloud/package.json b/packages/plugin-cloud/package.json index f70ee395dc4..fe439f1ccbb 100644 --- a/packages/plugin-cloud/package.json +++ b/packages/plugin-cloud/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-cloud", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "The official Payload Cloud plugin", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/plugin-form-builder/package.json b/packages/plugin-form-builder/package.json index fe434144f3f..e748baa127b 100644 --- a/packages/plugin-form-builder/package.json +++ b/packages/plugin-form-builder/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-form-builder", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "Form builder plugin for Payload CMS", "keywords": [ "payload", diff --git a/packages/plugin-nested-docs/package.json b/packages/plugin-nested-docs/package.json index 187024432b6..5625e88ce39 100644 --- a/packages/plugin-nested-docs/package.json +++ b/packages/plugin-nested-docs/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-nested-docs", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "The official Nested Docs plugin for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/plugin-redirects/package.json b/packages/plugin-redirects/package.json index d1ae8a57609..e81556e34c0 100644 --- a/packages/plugin-redirects/package.json +++ b/packages/plugin-redirects/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-redirects", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "Redirects plugin for Payload", "keywords": [ "payload", diff --git a/packages/plugin-relationship-object-ids/package.json b/packages/plugin-relationship-object-ids/package.json index 29cd349a608..5fe8cea11af 100644 --- a/packages/plugin-relationship-object-ids/package.json +++ b/packages/plugin-relationship-object-ids/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-relationship-object-ids", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "A Payload plugin to store all relationship IDs as ObjectIDs", "repository": { "type": "git", diff --git a/packages/plugin-search/package.json b/packages/plugin-search/package.json index 6d1111bb00c..55e3c570a91 100644 --- a/packages/plugin-search/package.json +++ b/packages/plugin-search/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-search", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "Search plugin for Payload", "keywords": [ "payload", diff --git a/packages/plugin-seo/package.json b/packages/plugin-seo/package.json index 0810821110c..a41a70bec55 100644 --- a/packages/plugin-seo/package.json +++ b/packages/plugin-seo/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-seo", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "SEO plugin for Payload", "keywords": [ "payload", diff --git a/packages/plugin-stripe/package.json b/packages/plugin-stripe/package.json index d9914ae2f98..c617f83b84c 100644 --- a/packages/plugin-stripe/package.json +++ b/packages/plugin-stripe/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-stripe", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "Stripe plugin for Payload", "keywords": [ "payload", diff --git a/packages/richtext-lexical/package.json b/packages/richtext-lexical/package.json index 61e1daa04b3..4504cb2248b 100644 --- a/packages/richtext-lexical/package.json +++ b/packages/richtext-lexical/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/richtext-lexical", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "The officially supported Lexical richtext adapter for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/richtext-slate/package.json b/packages/richtext-slate/package.json index 1e0fe9d2c97..e8359ccb147 100644 --- a/packages/richtext-slate/package.json +++ b/packages/richtext-slate/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/richtext-slate", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "The officially supported Slate richtext adapter for Payload", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/storage-azure/package.json b/packages/storage-azure/package.json index 7e9fa555369..9d53303e63c 100644 --- a/packages/storage-azure/package.json +++ b/packages/storage-azure/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/storage-azure", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "Payload storage adapter for Azure Blob Storage", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/storage-gcs/package.json b/packages/storage-gcs/package.json index 60375cb156a..17d52656f0e 100644 --- a/packages/storage-gcs/package.json +++ b/packages/storage-gcs/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/storage-gcs", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "Payload storage adapter for Google Cloud Storage", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/storage-s3/package.json b/packages/storage-s3/package.json index d3e63adfeec..0227551e524 100644 --- a/packages/storage-s3/package.json +++ b/packages/storage-s3/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/storage-s3", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "Payload storage adapter for Amazon S3", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/storage-uploadthing/package.json b/packages/storage-uploadthing/package.json index 067cc191a44..fd5a8bf3519 100644 --- a/packages/storage-uploadthing/package.json +++ b/packages/storage-uploadthing/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/storage-uploadthing", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "Payload storage adapter for uploadthing", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/storage-vercel-blob/package.json b/packages/storage-vercel-blob/package.json index 08f657d9465..af0769c9e9e 100644 --- a/packages/storage-vercel-blob/package.json +++ b/packages/storage-vercel-blob/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/storage-vercel-blob", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "description": "Payload storage adapter for Vercel Blob Storage", "homepage": "https://payloadcms.com", "repository": { diff --git a/packages/translations/package.json b/packages/translations/package.json index 6f64d62e89e..1d5376d02dc 100644 --- a/packages/translations/package.json +++ b/packages/translations/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/translations", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "homepage": "https://payloadcms.com", "repository": { "type": "git", diff --git a/packages/ui/package.json b/packages/ui/package.json index 114a04aaee0..06aa8fdc5a2 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/ui", - "version": "3.0.0-beta.85", + "version": "3.0.0-beta.86", "homepage": "https://payloadcms.com", "repository": { "type": "git",
7a59e7da46c18ecbadab192513aa1434a93e0146
2024-12-31 03:50:31
James Mikrut
feat: adds more control over how to disable graphql for collections /… (#10265)
false
adds more control over how to disable graphql for collections /… (#10265)
feat
diff --git a/docs/configuration/collections.mdx b/docs/configuration/collections.mdx index f5a215b48c6..41cdf0192a3 100644 --- a/docs/configuration/collections.mdx +++ b/docs/configuration/collections.mdx @@ -68,7 +68,7 @@ The following options are available: | **`dbName`** | Custom table or Collection name depending on the Database Adapter. Auto-generated from slug if not defined. | | **`endpoints`** | Add custom routes to the REST API. Set to `false` to disable routes. [More details](../rest-api/overview#custom-endpoints). | | **`fields`** \* | Array of field types that will determine the structure and functionality of the data stored within this Collection. [More details](../fields/overview). | -| **`graphQL`** | An object with `singularName` and `pluralName` strings used in schema generation. Auto-generated from slug if not defined. Set to `false` to disable GraphQL. | +| **`graphQL`** | Manage GraphQL-related properties for this collection. [More](#graphql) | | **`hooks`** | Entry point for Hooks. [More details](../hooks/overview#collection-hooks). | | **`labels`** | Singular and plural labels for use in identifying this Collection throughout Payload. Auto-generated from slug if not defined. | | **`lockDocuments`** | Enables or disables document locking. By default, document locking is enabled. Set to an object to configure, or set to `false` to disable locking. [More details](../admin/locked-documents). | @@ -77,7 +77,7 @@ The following options are available: | **`typescript`** | An object with property `interface` as the text used in schema generation. Auto-generated from slug if not defined. | | **`upload`** | Specify options if you would like this Collection to support file uploads. For more, consult the [Uploads](../upload/overview) documentation. | | **`versions`** | Set to true to enable default options, or configure with object properties. [More details](../versions/overview#collection-config). | -| **`defaultPopulate`** | Specify which fields to select when this Collection is populated from another document. [More Details](../queries/select#defaultpopulate-collection-config-property). | +| **`defaultPopulate`** | Specify which fields to select when this Collection is populated from another document. [More Details](../queries/select#defaultpopulate-collection-config-property). | _\* An asterisk denotes that a property is required._ @@ -97,6 +97,19 @@ Fields define the schema of the Documents within a Collection. To learn more, go You can customize the way that the [Admin Panel](../admin/overview) behaves on a Collection-by-Collection basis. To learn more, go to the [Collection Admin Options](../admin/collections) documentation. +## GraphQL + +You can completely disable GraphQL for this collection by passing `graphQL: false` to your collection config. This will completely disable all queries, mutations, and types from appearing in your GraphQL schema. + +You can also pass an object to the collection's `graphQL` property, which allows you to define the following properties: + +| Option | Description | +| ---------------------- | ----------------------------------------------------------------------------------- | +| **`singularName`** | Override the "singular" name that will be used in GraphQL schema generation. | +| **`pluralName`** | Override the "plural" name that will be used in GraphQL schema generation. | +| **`disableQueries`** | Disable all GraphQL queries that correspond to this collection by passing `true`. | +| **`disableMutations`** | Disable all GraphQL mutations that correspond to this collection by passing `true`. | + ## TypeScript You can import types from Payload to help make writing your Collection configs easier and type-safe. There are two main types that represent the Collection Config, `CollectionConfig` and `SanitizeCollectionConfig`. diff --git a/docs/configuration/globals.mdx b/docs/configuration/globals.mdx index 13d43b6b9ff..0ec2c665e60 100644 --- a/docs/configuration/globals.mdx +++ b/docs/configuration/globals.mdx @@ -74,7 +74,7 @@ The following options are available: | **`description`** | Text or React component to display below the Global header to give editors more information. | | **`endpoints`** | Add custom routes to the REST API. [More details](../rest-api/overview#custom-endpoints). | | **`fields`** \* | Array of field types that will determine the structure and functionality of the data stored within this Global. [More details](../fields/overview). | -| **`graphQL.name`** | Text used in schema generation. Auto-generated from slug if not defined. | +| **`graphQL`** | Manage GraphQL-related properties related to this global. [More details](#graphql) | | **`hooks`** | Entry point for Hooks. [More details](../hooks/overview#global-hooks). | | **`label`** | Text for the name in the Admin Panel or an object with keys for each language. Auto-generated from slug if not defined. | | **`lockDocuments`** | Enables or disables document locking. By default, document locking is enabled. Set to an object to configure, or set to `false` to disable locking. [More details](../admin/locked-documents). | @@ -100,6 +100,18 @@ Fields define the schema of the Global. To learn more, go to the [Fields](../fie You can customize the way that the [Admin Panel](../admin/overview) behaves on a Global-by-Global basis. To learn more, go to the [Global Admin Options](../admin/globals) documentation. +## GraphQL + +You can completely disable GraphQL for this global by passing `graphQL: false` to your global config. This will completely disable all queries, mutations, and types from appearing in your GraphQL schema. + +You can also pass an object to the global's `graphQL` property, which allows you to define the following properties: + +| Option | Description | +| ---------------------- | ----------------------------------------------------------------------------------- | +| **`name`** | Override the name that will be used in GraphQL schema generation. | +| **`disableQueries`** | Disable all GraphQL queries that correspond to this global by passing `true`. | +| **`disableMutations`** | Disable all GraphQL mutations that correspond to this global by passing `true`. | + ## TypeScript You can import types from Payload to help make writing your Global configs easier and type-safe. There are two main types that represent the Global Config, `GlobalConfig` and `SanitizeGlobalConfig`. diff --git a/packages/graphql/src/schema/initCollections.ts b/packages/graphql/src/schema/initCollections.ts index 947a97e6dd7..3194b074e64 100644 --- a/packages/graphql/src/schema/initCollections.ts +++ b/packages/graphql/src/schema/initCollections.ts @@ -63,7 +63,9 @@ export function initCollections({ config, graphqlResult }: InitCollectionsGraphQ let singularName let pluralName + const fromSlug = formatNames(collection.config.slug) + if (graphQL.singularName) { singularName = toWords(graphQL.singularName, true) } else { @@ -168,124 +170,133 @@ export function initCollections({ config, graphqlResult }: InitCollectionsGraphQ collection.graphQL.updateMutationInputType = new GraphQLNonNull(updateMutationInputType) } - graphqlResult.Query.fields[singularName] = { - type: collection.graphQL.type, - args: { - id: { type: new GraphQLNonNull(idType) }, - draft: { type: GraphQLBoolean }, - ...(config.localization - ? { - fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, - locale: { type: graphqlResult.types.localeInputType }, - } - : {}), - }, - resolve: findByIDResolver(collection), - } - - graphqlResult.Query.fields[pluralName] = { - type: buildPaginatedListType(pluralName, collection.graphQL.type), - args: { - draft: { type: GraphQLBoolean }, - where: { type: collection.graphQL.whereInputType }, - ...(config.localization - ? { - fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, - locale: { type: graphqlResult.types.localeInputType }, - } - : {}), - limit: { type: GraphQLInt }, - page: { type: GraphQLInt }, - pagination: { type: GraphQLBoolean }, - sort: { type: GraphQLString }, - }, - resolve: findResolver(collection), - } + const queriesEnabled = + typeof collectionConfig.graphQL !== 'object' || !collectionConfig.graphQL.disableQueries + const mutationsEnabled = + typeof collectionConfig.graphQL !== 'object' || !collectionConfig.graphQL.disableMutations - graphqlResult.Query.fields[`count${pluralName}`] = { - type: new GraphQLObjectType({ - name: `count${pluralName}`, - fields: { - totalDocs: { type: GraphQLInt }, + if (queriesEnabled) { + graphqlResult.Query.fields[singularName] = { + type: collection.graphQL.type, + args: { + id: { type: new GraphQLNonNull(idType) }, + draft: { type: GraphQLBoolean }, + ...(config.localization + ? { + fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, + locale: { type: graphqlResult.types.localeInputType }, + } + : {}), }, - }), - args: { - draft: { type: GraphQLBoolean }, - where: { type: collection.graphQL.whereInputType }, - ...(config.localization - ? { - locale: { type: graphqlResult.types.localeInputType }, - } - : {}), - }, - resolve: countResolver(collection), - } - - graphqlResult.Query.fields[`docAccess${singularName}`] = { - type: buildPolicyType({ - type: 'collection', - entity: collectionConfig, - scope: 'docAccess', - typeSuffix: 'DocAccess', - }), - args: { - id: { type: new GraphQLNonNull(idType) }, - }, - resolve: docAccessResolver(collection), - } + resolve: findByIDResolver(collection), + } - graphqlResult.Mutation.fields[`create${singularName}`] = { - type: collection.graphQL.type, - args: { - ...(createMutationInputType - ? { data: { type: collection.graphQL.mutationInputType } } - : {}), - draft: { type: GraphQLBoolean }, - ...(config.localization - ? { - locale: { type: graphqlResult.types.localeInputType }, - } - : {}), - }, - resolve: createResolver(collection), - } + graphqlResult.Query.fields[pluralName] = { + type: buildPaginatedListType(pluralName, collection.graphQL.type), + args: { + draft: { type: GraphQLBoolean }, + where: { type: collection.graphQL.whereInputType }, + ...(config.localization + ? { + fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, + locale: { type: graphqlResult.types.localeInputType }, + } + : {}), + limit: { type: GraphQLInt }, + page: { type: GraphQLInt }, + pagination: { type: GraphQLBoolean }, + sort: { type: GraphQLString }, + }, + resolve: findResolver(collection), + } - graphqlResult.Mutation.fields[`update${singularName}`] = { - type: collection.graphQL.type, - args: { - id: { type: new GraphQLNonNull(idType) }, - autosave: { type: GraphQLBoolean }, - ...(updateMutationInputType - ? { data: { type: collection.graphQL.updateMutationInputType } } - : {}), - draft: { type: GraphQLBoolean }, - ...(config.localization - ? { - locale: { type: graphqlResult.types.localeInputType }, - } - : {}), - }, - resolve: updateResolver(collection), - } + graphqlResult.Query.fields[`count${pluralName}`] = { + type: new GraphQLObjectType({ + name: `count${pluralName}`, + fields: { + totalDocs: { type: GraphQLInt }, + }, + }), + args: { + draft: { type: GraphQLBoolean }, + where: { type: collection.graphQL.whereInputType }, + ...(config.localization + ? { + locale: { type: graphqlResult.types.localeInputType }, + } + : {}), + }, + resolve: countResolver(collection), + } - graphqlResult.Mutation.fields[`delete${singularName}`] = { - type: collection.graphQL.type, - args: { - id: { type: new GraphQLNonNull(idType) }, - }, - resolve: getDeleteResolver(collection), + graphqlResult.Query.fields[`docAccess${singularName}`] = { + type: buildPolicyType({ + type: 'collection', + entity: collectionConfig, + scope: 'docAccess', + typeSuffix: 'DocAccess', + }), + args: { + id: { type: new GraphQLNonNull(idType) }, + }, + resolve: docAccessResolver(collection), + } } - if (collectionConfig.disableDuplicate !== true) { - graphqlResult.Mutation.fields[`duplicate${singularName}`] = { + if (mutationsEnabled) { + graphqlResult.Mutation.fields[`create${singularName}`] = { type: collection.graphQL.type, args: { - id: { type: new GraphQLNonNull(idType) }, ...(createMutationInputType ? { data: { type: collection.graphQL.mutationInputType } } : {}), + draft: { type: GraphQLBoolean }, + ...(config.localization + ? { + locale: { type: graphqlResult.types.localeInputType }, + } + : {}), }, - resolve: duplicateResolver(collection), + resolve: createResolver(collection), + } + + graphqlResult.Mutation.fields[`update${singularName}`] = { + type: collection.graphQL.type, + args: { + id: { type: new GraphQLNonNull(idType) }, + autosave: { type: GraphQLBoolean }, + ...(updateMutationInputType + ? { data: { type: collection.graphQL.updateMutationInputType } } + : {}), + draft: { type: GraphQLBoolean }, + ...(config.localization + ? { + locale: { type: graphqlResult.types.localeInputType }, + } + : {}), + }, + resolve: updateResolver(collection), + } + + graphqlResult.Mutation.fields[`delete${singularName}`] = { + type: collection.graphQL.type, + args: { + id: { type: new GraphQLNonNull(idType) }, + }, + resolve: getDeleteResolver(collection), + } + + if (collectionConfig.disableDuplicate !== true) { + graphqlResult.Mutation.fields[`duplicate${singularName}`] = { + type: collection.graphQL.type, + args: { + id: { type: new GraphQLNonNull(idType) }, + ...(createMutationInputType + ? { data: { type: collection.graphQL.mutationInputType } } + : {}), + }, + resolve: duplicateResolver(collection), + } } } @@ -318,52 +329,57 @@ export function initCollections({ config, graphqlResult }: InitCollectionsGraphQ parentName: `${singularName}Version`, }) - graphqlResult.Query.fields[`version${formatName(singularName)}`] = { - type: collection.graphQL.versionType, - args: { - id: { type: versionIDType }, - ...(config.localization - ? { - fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, - locale: { type: graphqlResult.types.localeInputType }, - } - : {}), - }, - resolve: findVersionByIDResolver(collection), - } - graphqlResult.Query.fields[`versions${pluralName}`] = { - type: buildPaginatedListType( - `versions${formatName(pluralName)}`, - collection.graphQL.versionType, - ), - args: { - where: { - type: buildWhereInputType({ - name: `versions${singularName}`, - fields: versionCollectionFields, - parentName: `versions${singularName}`, - }), + if (queriesEnabled) { + graphqlResult.Query.fields[`version${formatName(singularName)}`] = { + type: collection.graphQL.versionType, + args: { + id: { type: versionIDType }, + ...(config.localization + ? { + fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, + locale: { type: graphqlResult.types.localeInputType }, + } + : {}), }, - ...(config.localization - ? { - fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, - locale: { type: graphqlResult.types.localeInputType }, - } - : {}), - limit: { type: GraphQLInt }, - page: { type: GraphQLInt }, - pagination: { type: GraphQLBoolean }, - sort: { type: GraphQLString }, - }, - resolve: findVersionsResolver(collection), + resolve: findVersionByIDResolver(collection), + } + graphqlResult.Query.fields[`versions${pluralName}`] = { + type: buildPaginatedListType( + `versions${formatName(pluralName)}`, + collection.graphQL.versionType, + ), + args: { + where: { + type: buildWhereInputType({ + name: `versions${singularName}`, + fields: versionCollectionFields, + parentName: `versions${singularName}`, + }), + }, + ...(config.localization + ? { + fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, + locale: { type: graphqlResult.types.localeInputType }, + } + : {}), + limit: { type: GraphQLInt }, + page: { type: GraphQLInt }, + pagination: { type: GraphQLBoolean }, + sort: { type: GraphQLString }, + }, + resolve: findVersionsResolver(collection), + } } - graphqlResult.Mutation.fields[`restoreVersion${formatName(singularName)}`] = { - type: collection.graphQL.type, - args: { - id: { type: versionIDType }, - draft: { type: GraphQLBoolean }, - }, - resolve: restoreVersionResolver(collection), + + if (mutationsEnabled) { + graphqlResult.Mutation.fields[`restoreVersion${formatName(singularName)}`] = { + type: collection.graphQL.type, + args: { + id: { type: versionIDType }, + draft: { type: GraphQLBoolean }, + }, + resolve: restoreVersionResolver(collection), + } } } @@ -397,90 +413,20 @@ export function initCollections({ config, graphqlResult }: InitCollectionsGraphQ parentName: formatName(`${slug}JWT`), }) - graphqlResult.Query.fields[`me${singularName}`] = { - type: new GraphQLObjectType({ - name: formatName(`${slug}Me`), - fields: { - collection: { - type: GraphQLString, - }, - exp: { - type: GraphQLInt, - }, - strategy: { - type: GraphQLString, - }, - token: { - type: GraphQLString, - }, - user: { - type: collection.graphQL.type, - }, - }, - }), - resolve: me(collection), - } - - graphqlResult.Query.fields[`initialized${singularName}`] = { - type: GraphQLBoolean, - resolve: init(collection.config.slug), - } - - graphqlResult.Mutation.fields[`refreshToken${singularName}`] = { - type: new GraphQLObjectType({ - name: formatName(`${slug}Refreshed${singularName}`), - fields: { - exp: { - type: GraphQLInt, - }, - refreshedToken: { - type: GraphQLString, - }, - strategy: { - type: GraphQLString, - }, - user: { - type: collection.graphQL.JWT, - }, - }, - }), - resolve: refresh(collection), - } - - graphqlResult.Mutation.fields[`logout${singularName}`] = { - type: GraphQLString, - resolve: logout(collection), - } - - if (!collectionConfig.auth.disableLocalStrategy) { - const authArgs = {} - - const { canLoginWithEmail, canLoginWithUsername } = getLoginOptions( - collectionConfig.auth.loginWithUsername, - ) - - if (canLoginWithEmail) { - authArgs['email'] = { type: new GraphQLNonNull(GraphQLString) } - } - if (canLoginWithUsername) { - authArgs['username'] = { type: new GraphQLNonNull(GraphQLString) } - } - - if (collectionConfig.auth.maxLoginAttempts > 0) { - graphqlResult.Mutation.fields[`unlock${singularName}`] = { - type: new GraphQLNonNull(GraphQLBoolean), - args: authArgs, - resolve: unlock(collection), - } - } - - graphqlResult.Mutation.fields[`login${singularName}`] = { + if (queriesEnabled) { + graphqlResult.Query.fields[`me${singularName}`] = { type: new GraphQLObjectType({ - name: formatName(`${slug}LoginResult`), + name: formatName(`${slug}Me`), fields: { + collection: { + type: GraphQLString, + }, exp: { type: GraphQLInt, }, + strategy: { + type: GraphQLString, + }, token: { type: GraphQLString, }, @@ -489,44 +435,118 @@ export function initCollections({ config, graphqlResult }: InitCollectionsGraphQ }, }, }), - args: { - ...authArgs, - password: { type: GraphQLString }, - }, - resolve: login(collection), + resolve: me(collection), } - graphqlResult.Mutation.fields[`forgotPassword${singularName}`] = { - type: new GraphQLNonNull(GraphQLBoolean), - args: { - disableEmail: { type: GraphQLBoolean }, - expiration: { type: GraphQLInt }, - ...authArgs, - }, - resolve: forgotPassword(collection), + graphqlResult.Query.fields[`initialized${singularName}`] = { + type: GraphQLBoolean, + resolve: init(collection.config.slug), } + } - graphqlResult.Mutation.fields[`resetPassword${singularName}`] = { + if (mutationsEnabled) { + graphqlResult.Mutation.fields[`refreshToken${singularName}`] = { type: new GraphQLObjectType({ - name: formatName(`${slug}ResetPassword`), + name: formatName(`${slug}Refreshed${singularName}`), fields: { - token: { type: GraphQLString }, - user: { type: collection.graphQL.type }, + exp: { + type: GraphQLInt, + }, + refreshedToken: { + type: GraphQLString, + }, + strategy: { + type: GraphQLString, + }, + user: { + type: collection.graphQL.JWT, + }, }, }), - args: { - password: { type: GraphQLString }, - token: { type: GraphQLString }, - }, - resolve: resetPassword(collection), + resolve: refresh(collection), } - graphqlResult.Mutation.fields[`verifyEmail${singularName}`] = { - type: GraphQLBoolean, - args: { - token: { type: GraphQLString }, - }, - resolve: verifyEmail(collection), + graphqlResult.Mutation.fields[`logout${singularName}`] = { + type: GraphQLString, + resolve: logout(collection), + } + + if (!collectionConfig.auth.disableLocalStrategy) { + const authArgs = {} + + const { canLoginWithEmail, canLoginWithUsername } = getLoginOptions( + collectionConfig.auth.loginWithUsername, + ) + + if (canLoginWithEmail) { + authArgs['email'] = { type: new GraphQLNonNull(GraphQLString) } + } + if (canLoginWithUsername) { + authArgs['username'] = { type: new GraphQLNonNull(GraphQLString) } + } + + if (collectionConfig.auth.maxLoginAttempts > 0) { + graphqlResult.Mutation.fields[`unlock${singularName}`] = { + type: new GraphQLNonNull(GraphQLBoolean), + args: authArgs, + resolve: unlock(collection), + } + } + + graphqlResult.Mutation.fields[`login${singularName}`] = { + type: new GraphQLObjectType({ + name: formatName(`${slug}LoginResult`), + fields: { + exp: { + type: GraphQLInt, + }, + token: { + type: GraphQLString, + }, + user: { + type: collection.graphQL.type, + }, + }, + }), + args: { + ...authArgs, + password: { type: GraphQLString }, + }, + resolve: login(collection), + } + + graphqlResult.Mutation.fields[`forgotPassword${singularName}`] = { + type: new GraphQLNonNull(GraphQLBoolean), + args: { + disableEmail: { type: GraphQLBoolean }, + expiration: { type: GraphQLInt }, + ...authArgs, + }, + resolve: forgotPassword(collection), + } + + graphqlResult.Mutation.fields[`resetPassword${singularName}`] = { + type: new GraphQLObjectType({ + name: formatName(`${slug}ResetPassword`), + fields: { + token: { type: GraphQLString }, + user: { type: collection.graphQL.type }, + }, + }), + args: { + password: { type: GraphQLString }, + token: { type: GraphQLString }, + }, + resolve: resetPassword(collection), + } + + graphqlResult.Mutation.fields[`verifyEmail${singularName}`] = { + type: GraphQLBoolean, + args: { + token: { type: GraphQLString }, + }, + resolve: verifyEmail(collection), + } } } } diff --git a/packages/graphql/src/schema/initGlobals.ts b/packages/graphql/src/schema/initGlobals.ts index 46a7e3d8615..37794582e37 100644 --- a/packages/graphql/src/schema/initGlobals.ts +++ b/packages/graphql/src/schema/initGlobals.ts @@ -61,44 +61,51 @@ export function initGlobals({ config, graphqlResult }: InitGlobalsGraphQLArgs): : null, } - graphqlResult.Query.fields[formattedName] = { - type: graphqlResult.globals.graphQL[slug].type, - args: { - draft: { type: GraphQLBoolean }, - ...(config.localization - ? { - fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, - locale: { type: graphqlResult.types.localeInputType }, - } - : {}), - }, - resolve: findOne(global), - } + const queriesEnabled = typeof global.graphQL !== 'object' || !global.graphQL.disableQueries + const mutationsEnabled = typeof global.graphQL !== 'object' || !global.graphQL.disableMutations + + if (queriesEnabled) { + graphqlResult.Query.fields[formattedName] = { + type: graphqlResult.globals.graphQL[slug].type, + args: { + draft: { type: GraphQLBoolean }, + ...(config.localization + ? { + fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, + locale: { type: graphqlResult.types.localeInputType }, + } + : {}), + }, + resolve: findOne(global), + } - graphqlResult.Mutation.fields[`update${formattedName}`] = { - type: graphqlResult.globals.graphQL[slug].type, - args: { - ...(updateMutationInputType - ? { data: { type: graphqlResult.globals.graphQL[slug].mutationInputType } } - : {}), - draft: { type: GraphQLBoolean }, - ...(config.localization - ? { - locale: { type: graphqlResult.types.localeInputType }, - } - : {}), - }, - resolve: update(global), + graphqlResult.Query.fields[`docAccess${formattedName}`] = { + type: buildPolicyType({ + type: 'global', + entity: global, + scope: 'docAccess', + typeSuffix: 'DocAccess', + }), + resolve: docAccessResolver(global), + } } - graphqlResult.Query.fields[`docAccess${formattedName}`] = { - type: buildPolicyType({ - type: 'global', - entity: global, - scope: 'docAccess', - typeSuffix: 'DocAccess', - }), - resolve: docAccessResolver(global), + if (mutationsEnabled) { + graphqlResult.Mutation.fields[`update${formattedName}`] = { + type: graphqlResult.globals.graphQL[slug].type, + args: { + ...(updateMutationInputType + ? { data: { type: graphqlResult.globals.graphQL[slug].mutationInputType } } + : {}), + draft: { type: GraphQLBoolean }, + ...(config.localization + ? { + locale: { type: graphqlResult.types.localeInputType }, + } + : {}), + }, + resolve: update(global), + } } if (global.versions) { @@ -131,53 +138,58 @@ export function initGlobals({ config, graphqlResult }: InitGlobalsGraphQLArgs): parentName: `${formattedName}Version`, }) - graphqlResult.Query.fields[`version${formatName(formattedName)}`] = { - type: graphqlResult.globals.graphQL[slug].versionType, - args: { - id: { type: idType }, - draft: { type: GraphQLBoolean }, - ...(config.localization - ? { - fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, - locale: { type: graphqlResult.types.localeInputType }, - } - : {}), - }, - resolve: findVersionByID(global), - } - graphqlResult.Query.fields[`versions${formattedName}`] = { - type: buildPaginatedListType( - `versions${formatName(formattedName)}`, - graphqlResult.globals.graphQL[slug].versionType, - ), - args: { - where: { - type: buildWhereInputType({ - name: `versions${formattedName}`, - fields: versionGlobalFields, - parentName: `versions${formattedName}`, - }), + if (queriesEnabled) { + graphqlResult.Query.fields[`version${formatName(formattedName)}`] = { + type: graphqlResult.globals.graphQL[slug].versionType, + args: { + id: { type: idType }, + draft: { type: GraphQLBoolean }, + ...(config.localization + ? { + fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, + locale: { type: graphqlResult.types.localeInputType }, + } + : {}), }, - ...(config.localization - ? { - fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, - locale: { type: graphqlResult.types.localeInputType }, - } - : {}), - limit: { type: GraphQLInt }, - page: { type: GraphQLInt }, - pagination: { type: GraphQLBoolean }, - sort: { type: GraphQLString }, - }, - resolve: findVersions(global), + resolve: findVersionByID(global), + } + graphqlResult.Query.fields[`versions${formattedName}`] = { + type: buildPaginatedListType( + `versions${formatName(formattedName)}`, + graphqlResult.globals.graphQL[slug].versionType, + ), + args: { + where: { + type: buildWhereInputType({ + name: `versions${formattedName}`, + fields: versionGlobalFields, + parentName: `versions${formattedName}`, + }), + }, + ...(config.localization + ? { + fallbackLocale: { type: graphqlResult.types.fallbackLocaleInputType }, + locale: { type: graphqlResult.types.localeInputType }, + } + : {}), + limit: { type: GraphQLInt }, + page: { type: GraphQLInt }, + pagination: { type: GraphQLBoolean }, + sort: { type: GraphQLString }, + }, + resolve: findVersions(global), + } } - graphqlResult.Mutation.fields[`restoreVersion${formatName(formattedName)}`] = { - type: graphqlResult.globals.graphQL[slug].type, - args: { - id: { type: idType }, - draft: { type: GraphQLBoolean }, - }, - resolve: restoreVersion(global), + + if (mutationsEnabled) { + graphqlResult.Mutation.fields[`restoreVersion${formatName(formattedName)}`] = { + type: graphqlResult.globals.graphQL[slug].type, + args: { + id: { type: idType }, + draft: { type: GraphQLBoolean }, + }, + resolve: restoreVersion(global), + } } } }) diff --git a/packages/payload/src/collections/config/types.ts b/packages/payload/src/collections/config/types.ts index 9d6640a8c55..862969d9044 100644 --- a/packages/payload/src/collections/config/types.ts +++ b/packages/payload/src/collections/config/types.ts @@ -424,6 +424,8 @@ export type CollectionConfig<TSlug extends CollectionSlug = any> = { */ graphQL?: | { + disableMutations?: true + disableQueries?: true pluralName?: string singularName?: string } diff --git a/packages/payload/src/globals/config/types.ts b/packages/payload/src/globals/config/types.ts index 7aaebcc6f9a..7b8b071a388 100644 --- a/packages/payload/src/globals/config/types.ts +++ b/packages/payload/src/globals/config/types.ts @@ -160,6 +160,8 @@ export type GlobalConfig = { fields: Field[] graphQL?: | { + disableMutations?: true + disableQueries?: true name?: string } | false
6fa5866f994e3c214fe3d57e0bfb7e792ba56cc0
2023-09-29 18:35:02
Jarrod Flesch
feat: 2.0 popover style updates (#3404)
false
2.0 popover style updates (#3404)
feat
diff --git a/packages/payload/src/admin/components/elements/ArrayAction/index.scss b/packages/payload/src/admin/components/elements/ArrayAction/index.scss index ef539d6542a..1efda12c71b 100644 --- a/packages/payload/src/admin/components/elements/ArrayAction/index.scss +++ b/packages/payload/src/admin/components/elements/ArrayAction/index.scss @@ -11,16 +11,6 @@ } } - &.popup--active .array-actions__button { - background: var(--theme-elevation-0); - } - - &__button, - &__action { - @extend %btn-reset; - cursor: pointer; - } - &__actions { list-style: none; margin: 0; @@ -28,9 +18,6 @@ } &__action { - @extend %btn-reset; - display: block; - svg { position: relative; top: -1px; @@ -40,10 +27,6 @@ stroke-width: 1px; } } - - &:hover { - opacity: 0.7; - } } &__move-up { diff --git a/packages/payload/src/admin/components/elements/ArrayAction/index.tsx b/packages/payload/src/admin/components/elements/ArrayAction/index.tsx index 19af7631e7e..590848ea89b 100644 --- a/packages/payload/src/admin/components/elements/ArrayAction/index.tsx +++ b/packages/payload/src/admin/components/elements/ArrayAction/index.tsx @@ -9,6 +9,7 @@ import More from '../../icons/More' import Plus from '../../icons/Plus' import X from '../../icons/X' import Popup from '../Popup' +import * as PopupList from '../Popup/PopupButtonList' import './index.scss' const baseClass = 'array-actions' @@ -31,73 +32,69 @@ export const ArrayAction: React.FC<Props> = ({ horizontalAlign="center" render={({ close }) => { return ( - <React.Fragment> + <PopupList.ButtonGroup buttonSize="small"> {index !== 0 && ( - <button + <PopupList.Button className={`${baseClass}__action ${baseClass}__move-up`} onClick={() => { moveRow(index, index - 1) close() }} - type="button" > <Chevron /> {t('moveUp')} - </button> + </PopupList.Button> )} {index < rowCount - 1 && ( - <button - className={`${baseClass}__action ${baseClass}__move-down`} + <PopupList.Button + className={`${baseClass}__action`} onClick={() => { moveRow(index, index + 1) close() }} - type="button" > <Chevron /> {t('moveDown')} - </button> + </PopupList.Button> )} {!hasMaxRows && ( <React.Fragment> - <button + <PopupList.Button className={`${baseClass}__action ${baseClass}__add`} onClick={() => { addRow(index + 1) close() }} - type="button" > <Plus /> {t('addBelow')} - </button> - <button + </PopupList.Button> + <PopupList.Button className={`${baseClass}__action ${baseClass}__duplicate`} onClick={() => { duplicateRow(index) close() }} - type="button" > <Copy /> {t('duplicate')} - </button> + </PopupList.Button> </React.Fragment> )} - <button + <PopupList.Button className={`${baseClass}__action ${baseClass}__remove`} onClick={() => { removeRow(index) close() }} - type="button" > <X /> {t('remove')} - </button> - </React.Fragment> + </PopupList.Button> + </PopupList.ButtonGroup> ) }} + size="medium" /> ) } diff --git a/packages/payload/src/admin/components/elements/DocumentControls/index.scss b/packages/payload/src/admin/components/elements/DocumentControls/index.scss index 5fc0a102c0c..f7c8aafd4f6 100644 --- a/packages/payload/src/admin/components/elements/DocumentControls/index.scss +++ b/packages/payload/src/admin/components/elements/DocumentControls/index.scss @@ -73,13 +73,14 @@ } &__controls-wrapper { + --controls-gap: calc(var(--base) / 2); + --dot-button-width: calc(var(--base) * 2); display: flex; align-items: center; margin: 0; - // move to the right to account for the padding on the dots - // this will make sure the alignment is correct - // while still keeping a large button hitbox - transform: translate3d(var(--base), 0, 0); + gap: var(--controls-gap); + padding-right: calc(var(--controls-gap) + var(--dot-button-width)); + position: relative; } &__controls { @@ -94,27 +95,20 @@ } } - &__popup { - .popup-button { - padding: var(--base); - background: transparent; - border: none; - cursor: pointer; - color: var(--theme-elevation-500); - - &:hover { - color: var(--theme-text); - } - } - } - &__dots { - display: flex; - gap: 2px; - background-color: transparent; - padding: 0; + height: 100%; + margin: 0; + + .btn__label { + height: 100%; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + gap: 2px; + } - > div { + > span > span > div { width: 3px; height: 3px; border-radius: 100%; @@ -122,49 +116,15 @@ } } - &__popup-actions { - list-style: none; - padding: 0; - margin: 0; - display: flex; - flex-direction: column; - gap: calc(var(--base) / 4); - - a { - text-decoration: none; - } - - li { - position: relative; - - &::before { - content: ''; - display: block; - position: absolute; - height: 100%; - width: 100%; - border-radius: 1px; - background: var(--theme-elevation-100); - width: calc(100% + (var(--base) / 2)); - left: calc(var(--base) / -4); - top: 0; - opacity: 0; - transition: opacity 50ms linear; - } - - &:hover::before { - opacity: 1; - } + &__popup { + position: absolute; + right: 0; + top: 0; + bottom: 0; + width: var(--dot-button-width); - > * { - position: relative; - width: 100%; - height: 100%; - text-align: left; - font-size: inherit; - line-height: inherit; - font-family: inherit; - } + .popup__trigger-wrap { + height: 100%; } } diff --git a/packages/payload/src/admin/components/elements/DocumentControls/index.tsx b/packages/payload/src/admin/components/elements/DocumentControls/index.tsx index 3c6fcd3b84a..0e27942e9d7 100644 --- a/packages/payload/src/admin/components/elements/DocumentControls/index.tsx +++ b/packages/payload/src/admin/components/elements/DocumentControls/index.tsx @@ -1,6 +1,5 @@ import React, { Fragment } from 'react' import { useTranslation } from 'react-i18next' -import { Link } from 'react-router-dom' import type { CollectionPermission, GlobalPermission } from '../../../../auth' import type { SanitizedCollectionConfig, SanitizedGlobalConfig } from '../../../../exports/types' @@ -9,10 +8,12 @@ import { formatDate } from '../../../utilities/formatDate' import { useConfig } from '../../utilities/Config' import { useDocumentInfo } from '../../utilities/DocumentInfo' import Autosave from '../Autosave' +import Button from '../Button' import DeleteDocument from '../DeleteDocument' import DuplicateDocument from '../DuplicateDocument' import { Gutter } from '../Gutter' import Popup from '../Popup' +import * as PopupList from '../Popup/PopupButtonList' import PreviewButton from '../PreviewButton' import { Publish } from '../Publish' import { Save } from '../Save' @@ -30,9 +31,9 @@ export const DocumentControls: React.FC<{ global?: SanitizedGlobalConfig hasSavePermission?: boolean id?: string + isAccountView?: boolean isEditing?: boolean permissions?: CollectionPermission | GlobalPermission - isAccountView?: boolean }> = (props) => { const { id, @@ -41,9 +42,9 @@ export const DocumentControls: React.FC<{ disableActions, global, hasSavePermission, + isAccountView, isEditing, permissions, - isAccountView, } = props const { publishedDoc } = useDocumentInfo() @@ -73,6 +74,8 @@ export const DocumentControls: React.FC<{ !global?.versions?.drafts?.autosave } + const showDotMenu = Boolean(collection && !disableActions) + return ( <Gutter className={baseClass}> <div className={`${baseClass}__wrapper`}> @@ -187,49 +190,47 @@ export const DocumentControls: React.FC<{ </React.Fragment> )} </div> - {Boolean(collection && !disableActions) && ( + {showDotMenu && ( <Popup button={ - <div className={`${baseClass}__dots`}> + <Button buttonStyle="secondary" className={`${baseClass}__dots`} el="div"> <div /> <div /> <div /> - </div> + </Button> } - caret={false} className={`${baseClass}__popup`} - horizontalAlign="center" + horizontalAlign="right" size="large" verticalAlign="bottom" > - <ul className={`${baseClass}__popup-actions`}> + <PopupList.ButtonGroup> {'create' in permissions && permissions?.create?.permission && ( <React.Fragment> - <li> - <Link - id="action-create" - to={`${adminRoute}/collections/${collection?.slug}/create`} - > - {t('createNew')} - </Link> - </li> + <PopupList.Button + id="action-create" + to={`${adminRoute}/collections/${collection?.slug}/create`} + > + {t('createNew')} + </PopupList.Button> + {!collection?.admin?.disableDuplicate && isEditing && ( - <li> + <PopupList.Button> <DuplicateDocument collection={collection} id={id} slug={collection?.slug} /> - </li> + </PopupList.Button> )} </React.Fragment> )} {'delete' in permissions && permissions?.delete?.permission && id && ( - <li> + <PopupList.Button> <DeleteDocument buttonId="action-delete" collection={collection} id={id} /> - </li> + </PopupList.Button> )} - </ul> + </PopupList.ButtonGroup> </Popup> )} </div> diff --git a/packages/payload/src/admin/components/elements/Localizer/index.scss b/packages/payload/src/admin/components/elements/Localizer/index.scss index c5b370ab8ed..5736d81c8a7 100644 --- a/packages/payload/src/admin/components/elements/Localizer/index.scss +++ b/packages/payload/src/admin/components/elements/Localizer/index.scss @@ -18,7 +18,7 @@ button { color: currentColor; - padding: base(0.25) 0; + padding: 0; font-size: 1rem; line-height: base(1); background: transparent; @@ -39,33 +39,10 @@ &__button { white-space: nowrap; + display: flex; } span { color: var(--theme-elevation-400); } - - ul { - list-style: none; - padding: 0; - max-height: base(8); - margin: 0; - - li a { - all: unset; - cursor: pointer; - padding-right: 0; - - &:hover, - &:focus-visible { - text-decoration: underline; - } - } - } - - @include mid-break { - .popup__content { - width: calc(100vw - calc(var(--gutter-h) * 2)); - } - } } diff --git a/packages/payload/src/admin/components/elements/Localizer/index.tsx b/packages/payload/src/admin/components/elements/Localizer/index.tsx index db8dde9eaee..23b5626b568 100644 --- a/packages/payload/src/admin/components/elements/Localizer/index.tsx +++ b/packages/payload/src/admin/components/elements/Localizer/index.tsx @@ -1,13 +1,13 @@ import qs from 'qs' import React from 'react' import { useTranslation } from 'react-i18next' -import { Link } from 'react-router-dom' import { Chevron } from '../..' import { useConfig } from '../../utilities/Config' import { useLocale } from '../../utilities/Locale' import { useSearchParams } from '../../utilities/SearchParams' import Popup from '../Popup' +import * as PopupList from '../Popup/PopupButtonList' import './index.scss' const baseClass = 'localizer' @@ -37,20 +37,10 @@ const Localizer: React.FC<{ <Chevron className={`${baseClass}__chevron`} /> </div> } - caret={false} - horizontalAlign="left" + horizontalAlign="right" render={({ close }) => ( - <ul> + <PopupList.ButtonGroup> {locales.map((localeOption) => { - const baseLocaleClass = `${baseClass}__locale` - - const localeClasses = [ - baseLocaleClass, - locale.code === localeOption.code && `${baseLocaleClass}--active`, - ] - .filter(Boolean) - .join('') - const newParams = { ...searchParams, locale: localeOption.code, @@ -60,20 +50,19 @@ const Localizer: React.FC<{ if (localeOption.code !== locale.code) { return ( - <li className={localeClasses} key={localeOption.code}> - <Link onClick={close} to={{ search }}> - {localeOption.label} - {localeOption.label !== localeOption.code && ` (${localeOption.code})`} - </Link> - </li> + <PopupList.Button key={localeOption.code} onClick={close} to={{ search }}> + {localeOption.label} + {localeOption.label !== localeOption.code && ` (${localeOption.code})`} + </PopupList.Button> ) } return null })} - </ul> + </PopupList.ButtonGroup> )} showScrollbar + size="large" /> </div> ) diff --git a/packages/payload/src/admin/components/elements/PerPage/index.scss b/packages/payload/src/admin/components/elements/PerPage/index.scss index 11b595aa44d..5d76a482ed1 100644 --- a/packages/payload/src/admin/components/elements/PerPage/index.scss +++ b/packages/payload/src/admin/components/elements/PerPage/index.scss @@ -7,12 +7,6 @@ margin: 0; } - .popup-button--default { - @extend %btn-reset; - position: relative; - cursor: pointer; - } - &__button { @extend %btn-reset; cursor: pointer; diff --git a/packages/payload/src/admin/components/elements/PerPage/index.tsx b/packages/payload/src/admin/components/elements/PerPage/index.tsx index 7c0fbd4f07e..7197b1e66bb 100644 --- a/packages/payload/src/admin/components/elements/PerPage/index.tsx +++ b/packages/payload/src/admin/components/elements/PerPage/index.tsx @@ -7,6 +7,7 @@ import { defaults } from '../../../../collections/config/defaults' import Chevron from '../../icons/Chevron' import { useSearchParams } from '../../utilities/SearchParams' import Popup from '../Popup' +import * as PopupList from '../Popup/PopupButtonList' import './index.scss' const baseClass = 'per-page' @@ -43,43 +44,37 @@ const PerPage: React.FC<Props> = ({ } horizontalAlign="right" render={({ close }) => ( - <div> - <ul> - {limits.map((limitNumber, i) => ( - <li className={`${baseClass}-item`} key={i}> - <button - className={[ - `${baseClass}__button`, - limitNumber === Number(limit) && `${baseClass}__button-active`, - ] - .filter(Boolean) - .join(' ')} - onClick={() => { - close() - if (handleChange) handleChange(limitNumber) - if (modifySearchParams) { - history.replace({ - search: qs.stringify( - { - ...params, - limit: limitNumber, - page: resetPage ? 1 : params.page, - }, - { addQueryPrefix: true }, - ), - }) - } - }} - type="button" - > - {limitNumber === Number(limit) && <Chevron />} - {limitNumber} - </button> - </li> - ))} - </ul> - </div> + <PopupList.ButtonGroup> + {limits.map((limitNumber, i) => ( + <PopupList.Button + className={[limitNumber === Number(limit) && `${baseClass}__button-active`] + .filter(Boolean) + .join(' ')} + key={i} + onClick={() => { + close() + if (handleChange) handleChange(limitNumber) + if (modifySearchParams) { + history.replace({ + search: qs.stringify( + { + ...params, + limit: limitNumber, + page: resetPage ? 1 : params.page, + }, + { addQueryPrefix: true }, + ), + }) + } + }} + > + {limitNumber === Number(limit) && <Chevron />} + {limitNumber} + </PopupList.Button> + ))} + </PopupList.ButtonGroup> )} + size="small" /> </div> ) diff --git a/packages/payload/src/admin/components/elements/Popup/PopupButton/index.scss b/packages/payload/src/admin/components/elements/Popup/PopupButton/index.scss deleted file mode 100644 index 27c47e294e2..00000000000 --- a/packages/payload/src/admin/components/elements/Popup/PopupButton/index.scss +++ /dev/null @@ -1,5 +0,0 @@ -@import '../../../../scss/styles.scss'; - -.popup-button { - display: inline-flex; -} diff --git a/packages/payload/src/admin/components/elements/Popup/PopupButtonList/index.scss b/packages/payload/src/admin/components/elements/Popup/PopupButtonList/index.scss new file mode 100644 index 00000000000..7ff5ee2785f --- /dev/null +++ b/packages/payload/src/admin/components/elements/Popup/PopupButtonList/index.scss @@ -0,0 +1,47 @@ +@import '../../../../scss/styles.scss'; + +.popup-button-list { + display: flex; + flex-direction: column; + text-align: left; + --list-button-padding: calc(var(--base) * 0.5); + + &__text-align--left { + text-align: left; + } + + &__text-align--center { + text-align: center; + } + + &__text-align--right { + text-align: right; + } + + &__button { + @extend %btn-reset; + padding-left: var(--list-button-padding); + padding-right: var(--list-button-padding); + padding-top: 2px; + padding-bottom: 2px; + cursor: pointer; + text-align: inherit; + line-height: var(--base); + text-decoration: none; + border-radius: 3px; + + button { + @extend %btn-reset; + + &:focus-visible { + outline: none; + } + } + + &:hover, + &:focus-visible, + &:focus-within { + background-color: var(--popup-button-highlight); + } + } +} diff --git a/packages/payload/src/admin/components/elements/Popup/PopupButtonList/index.tsx b/packages/payload/src/admin/components/elements/Popup/PopupButtonList/index.tsx new file mode 100644 index 00000000000..f4f11a0f152 --- /dev/null +++ b/packages/payload/src/admin/components/elements/Popup/PopupButtonList/index.tsx @@ -0,0 +1,75 @@ +import type { LinkProps } from 'react-router-dom' + +import * as React from 'react' +import { Link } from 'react-router-dom' + +import './index.scss' + +const baseClass = 'popup-button-list' +export const ButtonGroup: React.FC<{ + buttonSize?: 'default' | 'small' + children: React.ReactNode + className?: string + textAlign?: 'center' | 'left' | 'right' +}> = ({ buttonSize = 'default', children, className, textAlign = 'left' }) => { + const classes = [ + baseClass, + className, + `${baseClass}__text-align--${textAlign}`, + `${baseClass}__button-size--${buttonSize}`, + ] + .filter(Boolean) + .join(' ') + return <div className={classes}>{children}</div> +} + +type MenuButtonProps = { + children: React.ReactNode + className?: string + id?: string + onClick?: () => void + to?: LinkProps['to'] +} +export const Button: React.FC<MenuButtonProps> = ({ id, children, className, onClick, to }) => { + const classes = [`${baseClass}__button`, className].filter(Boolean).join(' ') + + if (to) { + return ( + <Link + className={classes} + id={id} + onClick={() => { + if (onClick) { + onClick() + } + }} + to={to} + > + {children} + </Link> + ) + } + + if (onClick) { + return ( + <button + className={classes} + id={id} + onClick={() => { + if (onClick) { + onClick() + } + }} + type="button" + > + {children} + </button> + ) + } + + return ( + <div className={classes} id={id}> + {children} + </div> + ) +} diff --git a/packages/payload/src/admin/components/elements/Popup/PopupTrigger/index.scss b/packages/payload/src/admin/components/elements/Popup/PopupTrigger/index.scss new file mode 100644 index 00000000000..dbe5ab2e89d --- /dev/null +++ b/packages/payload/src/admin/components/elements/Popup/PopupTrigger/index.scss @@ -0,0 +1,14 @@ +@import '../../../../scss/styles.scss'; + +.popup-button { + height: 100%; + color: currentColor; + padding: 0; + font-size: 1rem; + line-height: base(1); + background: transparent; + border: 0; + font-weight: 600; + cursor: pointer; + display: inline-flex; +} diff --git a/packages/payload/src/admin/components/elements/Popup/PopupButton/index.tsx b/packages/payload/src/admin/components/elements/Popup/PopupTrigger/index.tsx similarity index 91% rename from packages/payload/src/admin/components/elements/Popup/PopupButton/index.tsx rename to packages/payload/src/admin/components/elements/Popup/PopupTrigger/index.tsx index b51a879831e..6266538b735 100644 --- a/packages/payload/src/admin/components/elements/Popup/PopupButton/index.tsx +++ b/packages/payload/src/admin/components/elements/Popup/PopupTrigger/index.tsx @@ -6,7 +6,7 @@ import './index.scss' const baseClass = 'popup-button' -const PopupButton: React.FC<Props> = (props) => { +export const PopupTrigger: React.FC<Props> = (props) => { const { active, button, buttonType, className, setActive } = props const classes = [baseClass, className, `${baseClass}--${buttonType}`].filter(Boolean).join(' ') @@ -41,5 +41,3 @@ const PopupButton: React.FC<Props> = (props) => { </button> ) } - -export default PopupButton diff --git a/packages/payload/src/admin/components/elements/Popup/PopupButton/types.ts b/packages/payload/src/admin/components/elements/Popup/PopupTrigger/types.ts similarity index 100% rename from packages/payload/src/admin/components/elements/Popup/PopupButton/types.ts rename to packages/payload/src/admin/components/elements/Popup/PopupTrigger/types.ts diff --git a/packages/payload/src/admin/components/elements/Popup/index.scss b/packages/payload/src/admin/components/elements/Popup/index.scss index e4031b793dc..31fd2f6a0fd 100644 --- a/packages/payload/src/admin/components/elements/Popup/index.scss +++ b/packages/payload/src/admin/components/elements/Popup/index.scss @@ -1,43 +1,48 @@ @import '../../../scss/styles.scss'; .popup { + --popup-button-highlight: var(--theme-elevation-200); + --popup-bg: var(--theme-input-bg); + --popup-text: var(--theme-text); + --popup-caret-size: 10px; + --popup-x-padding: calc(var(--base) * 0.33); + --popup-padding: calc(var(--base) * 0.5); position: relative; &__content { position: absolute; - background: var(--theme-input-bg); + background: var(--popup-bg); opacity: 0; visibility: hidden; pointer-events: none; z-index: var(--z-popup); max-width: calc(100vw - #{$baseline}); - - &--caret { - &:after { - content: ' '; - position: absolute; - top: calc(100% - 1px); - border: 12px solid transparent; - border-top-color: var(--theme-input-bg); - } - } + color: var(--popup-text); + border-radius: 4px; + padding-left: var(--popup-padding); + padding-right: var(--popup-padding); + min-width: var(--popup-width, auto); } - &__wrap { + &__hide-scrollbar { overflow: hidden; } - .popup__scroll { - padding: $baseline; + &__scroll-container { overflow-y: auto; white-space: nowrap; - padding-right: calc(var(--scrollbar-width) + #{$baseline}); width: calc(100% + var(--scrollbar-width)); + padding-top: var(--popup-padding); + padding-bottom: var(--popup-padding); + } + + &__scroll-content { + width: calc(100% - var(--scrollbar-width)); } &--show-scrollbar { - .popup__scroll { - padding-right: 0; + .popup__scroll-container, + .popup__scroll-content { width: 100%; } } @@ -52,62 +57,23 @@ //////////////////////////////// &--size-small { - .popup__scroll { - [dir='ltr'] & { - padding: base(0.75) calc(var(--scrollbar-width) + #{base(0.75)}) base(0.75) base(0.75); - } - [dir='rtl'] & { - padding: base(0.75) base(0.75) base(0.75) calc(var(--scrollbar-width) + #{base(0.75)}); - } - } - + --popup-width: 100px; .popup__content { @include shadow-m; } - - &.popup--h-align-left { - .popup__content { - left: - base(0.5); - - &:after { - left: base(0.425); - } - } - } } - &--size-large { + &--size-medium { + --popup-width: 150px; .popup__content { @include shadow-lg; } - - .popup__scroll { - padding: base(1) calc(var(--scrollbar-width) + #{base(1.5)}) base(1) base(1.5); - } } - &--size-wide { + &--size-large { + --popup-width: 200px; .popup__content { - @include shadow-m; - - &:after { - border: 12px solid transparent; - border-top-color: var(--theme-input-bg); - } - } - - .popup__scroll { - padding: base(0.25) base(0.5); - } - - &.popup--align-left { - .popup__content { - left: - base(0.5); - - &:after { - left: base(0.425); - } - } + @include shadow-lg; } } @@ -116,12 +82,8 @@ //////////////////////////////// &--h-align-left { - .popup__content { - left: - base(1.75); - - &:after { - left: base(1.75); - } + .popup__caret { + left: var(--popup-padding); } } @@ -129,26 +91,21 @@ .popup__content { left: 50%; transform: translateX(-50%); + } - &:after { - left: 50%; - transform: translateX(-50%); - } + .popup__caret { + left: 50%; + transform: translateX(-50%); } } &--h-align-right { .popup__content { - right: - base(1.75); - [dir='rtl'] & { - right: - base(0.75); - } - &:after { - right: base(1.75); - [dir='rtl'] & { - right: base(0.75); - } - } + right: 0; + } + + .popup__caret { + right: var(--popup-padding); } } @@ -156,46 +113,32 @@ // VERTICAL ALIGNMENT //////////////////////////////// - &--v-align-top { - .popup__content { - bottom: calc(100% + #{$baseline}); - } + &__caret { + position: absolute; + border: var(--popup-caret-size) solid transparent; } - &--v-align-bottom { + &--v-align-top { .popup__content { - @include shadow-lg-top; - top: calc(100% + #{base(0.5)}); - - &:after { - top: unset; - bottom: calc(100% - 1px); - border-top-color: transparent !important; - border-bottom-color: var(--theme-input-bg); - } + @include shadow-lg; + bottom: calc(100% + var(--popup-caret-size)); } - &.popup--color-dark { - .popup__content { - &:after { - border-bottom-color: var(--theme-elevation-800); - } - } + .popup__caret { + top: calc(100% - 1px); + border-top-color: var(--popup-bg); } } - //////////////////////////////// - // COLOR - //////////////////////////////// - - &--color-dark { + &--v-align-bottom { .popup__content { - background: var(--theme-elevation-800); - color: var(--theme-input-bg); + @include shadow-lg-top; + top: calc(100% + var(--popup-caret-size)); + } - &:after { - border-top-color: var(--theme-elevation-800); - } + .popup__caret { + bottom: calc(100% - 1px); + border-bottom-color: var(--popup-bg); } } @@ -212,69 +155,55 @@ } @include mid-break { - &__scroll, - &--size-large .popup__scroll { - padding: base(0.75); - padding-right: calc(var(--scrollbar-width) + #{base(0.75)}); - } - - &--h-align-left { - .popup__content { - left: - base(0.5); - - &:after { - left: base(0.5); - } - } - } + --popup-padding: calc(var(--base) * 0.25); &--h-align-center { .popup__content { left: 50%; transform: translateX(-0%); + } - &:after { - left: 50%; - transform: translateX(-0%); - } + .popup__caret { + left: 50%; + transform: translateX(-0%); } } &--h-align-right { .popup__content { - right: - base(0.5); + right: 0; + } - &:after { - right: base(0.5); - } + .popup__caret { + right: var(--popup-padding); } } &--force-h-align-left { .popup__content { - left: - base(0.5); + left: 0; right: unset; transform: unset; + } - &:after { - left: base(0.5); - right: unset; - transform: unset; - } + .popup__caret { + left: var(--popup-padding); + right: unset; + transform: unset; } } &--force-h-align-right { .popup__content { - right: - base(0.5); + right: 0; left: unset; transform: unset; + } - &:after { - right: base(0.5); - left: unset; - transform: unset; - } + .popup__caret { + right: var(--popup-padding); + left: unset; + transform: unset; } } } diff --git a/packages/payload/src/admin/components/elements/Popup/index.tsx b/packages/payload/src/admin/components/elements/Popup/index.tsx index 96bc8465da8..4e577758906 100644 --- a/packages/payload/src/admin/components/elements/Popup/index.tsx +++ b/packages/payload/src/admin/components/elements/Popup/index.tsx @@ -4,7 +4,7 @@ import React, { useCallback, useEffect, useRef, useState } from 'react' import type { Props } from './types' import useIntersect from '../../../hooks/useIntersect' -import PopupButton from './PopupButton' +import { PopupTrigger } from './PopupTrigger' import './index.scss' const baseClass = 'popup' @@ -18,16 +18,14 @@ const Popup: React.FC<Props> = (props) => { caret = true, children, className, - color = 'light', forceOpen, horizontalAlign: horizontalAlignFromProps = 'left', initActive = false, onToggleOpen, - padding, render, showOnHover = false, showScrollbar = false, - size = 'small', + size = 'medium', verticalAlign: verticalAlignFromProps = 'top', } = props @@ -38,7 +36,6 @@ const Popup: React.FC<Props> = (props) => { threshold: 1, }) - const buttonRef = useRef(null) const contentRef = useRef(null) const [active, setActive] = useState(initActive) const [verticalAlign, setVerticalAlign] = useState(verticalAlignFromProps) @@ -57,8 +54,8 @@ const Popup: React.FC<Props> = (props) => { } = bounds let boundingTopPos = 100 - let boundingRightPos = window.innerWidth - let boundingBottomPos = window.innerHeight + let boundingRightPos = document.documentElement.clientWidth + let boundingBottomPos = document.documentElement.clientHeight let boundingLeftPos = 0 if (boundingRef?.current) { @@ -131,7 +128,6 @@ const Popup: React.FC<Props> = (props) => { baseClass, className, `${baseClass}--size-${size}`, - `${baseClass}--color-${color}`, `${baseClass}--v-align-${verticalAlign}`, `${baseClass}--h-align-${horizontalAlign}`, active && `${baseClass}--active`, @@ -142,39 +138,35 @@ const Popup: React.FC<Props> = (props) => { return ( <div className={classes}> - <div className={`${baseClass}__wrapper`} ref={buttonRef}> + <div className={`${baseClass}__trigger-wrap`}> {showOnHover ? ( <div className={`${baseClass}__on-hover-watch`} onMouseEnter={() => setActive(true)} onMouseLeave={() => setActive(false)} > - <PopupButton + <PopupTrigger {...{ active, button, buttonType, className: buttonClassName, setActive }} /> </div> ) : ( - <PopupButton {...{ active, button, buttonType, className: buttonClassName, setActive }} /> + <PopupTrigger + {...{ active, button, buttonType, className: buttonClassName, setActive }} + /> )} </div> - <div - className={[`${baseClass}__content`, caret && `${baseClass}__content--caret`] - .filter(Boolean) - .join(' ')} - ref={contentRef} - > - <div className={`${baseClass}__wrap`} ref={intersectionRef}> - <div - className={`${baseClass}__scroll`} - style={{ - padding, - }} - > - {render && render({ close: () => setActive(false) })} - {children && children} + <div className={`${baseClass}__content`} ref={contentRef}> + <div className={`${baseClass}__hide-scrollbar`} ref={intersectionRef}> + <div className={`${baseClass}__scroll-container`}> + <div className={`${baseClass}__scroll-content`}> + {render && render({ close: () => setActive(false) })} + {children && children} + </div> </div> </div> + + {caret && <div className={`${baseClass}__caret`} />} </div> </div> ) diff --git a/packages/payload/src/admin/components/elements/Popup/types.ts b/packages/payload/src/admin/components/elements/Popup/types.ts index 87827e5c9fb..f80e4eafd80 100644 --- a/packages/payload/src/admin/components/elements/Popup/types.ts +++ b/packages/payload/src/admin/components/elements/Popup/types.ts @@ -9,15 +9,13 @@ export type Props = { caret?: boolean children?: React.ReactNode className?: string - color?: 'dark' | 'light' forceOpen?: boolean horizontalAlign?: 'center' | 'left' | 'right' initActive?: boolean onToggleOpen?: (active: boolean) => void - padding?: CSSProperties['padding'] render?: (any) => React.ReactNode showOnHover?: boolean showScrollbar?: boolean - size?: 'large' | 'small' | 'wide' + size?: 'fit-content' | 'large' | 'medium' | 'small' verticalAlign?: 'bottom' | 'top' } diff --git a/packages/payload/src/admin/components/forms/field-types/Relationship/AddNew/index.scss b/packages/payload/src/admin/components/forms/field-types/Relationship/AddNew/index.scss index 4d5b149fc02..193ebd9be9f 100644 --- a/packages/payload/src/admin/components/forms/field-types/Relationship/AddNew/index.scss +++ b/packages/payload/src/admin/components/forms/field-types/Relationship/AddNew/index.scss @@ -4,7 +4,7 @@ display: flex; align-items: stretch; - .popup__wrapper { + .popup__trigger-wrap { display: flex; align-items: stretch; height: 100%; @@ -22,27 +22,4 @@ display: flex; cursor: pointer; } - - &__relations { - list-style: none; - margin: 0; - padding: 0; - - li:not(:last-child) { - margin-bottom: base(0.375); - } - } - - &__relation-button { - @extend %btn-reset; - cursor: pointer; - display: block; - padding: base(0.125) 0; - text-align: center; - width: 100%; - - &:hover { - opacity: 0.7; - } - } } diff --git a/packages/payload/src/admin/components/forms/field-types/Relationship/AddNew/index.tsx b/packages/payload/src/admin/components/forms/field-types/Relationship/AddNew/index.tsx index a34efa17b73..1619704fcea 100644 --- a/packages/payload/src/admin/components/forms/field-types/Relationship/AddNew/index.tsx +++ b/packages/payload/src/admin/components/forms/field-types/Relationship/AddNew/index.tsx @@ -2,6 +2,7 @@ import React, { Fragment, useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import type { SanitizedCollectionConfig } from '../../../../../../collections/config/types' +import type { EditViewProps } from '../../../../views/types' import type { Value } from '../types' import type { Props } from './types' @@ -9,13 +10,13 @@ import { getTranslation } from '../../../../../../utilities/getTranslation' import Button from '../../../../elements/Button' import { useDocumentDrawer } from '../../../../elements/DocumentDrawer' import Popup from '../../../../elements/Popup' +import * as PopupList from '../../../../elements/Popup/PopupButtonList' import Tooltip from '../../../../elements/Tooltip' import Plus from '../../../../icons/Plus' import { useAuth } from '../../../../utilities/Auth' import { useConfig } from '../../../../utilities/Config' import './index.scss' import { useRelatedCollections } from './useRelatedCollections' -import { EditViewProps } from '../../../../views/types' const baseClass = 'relationship-add-new' @@ -85,7 +86,7 @@ export const AddNewRelation: React.FC<Props> = ({ [relationTo, collectionConfig, dispatchOptions, i18n, hasMany, setValue, value, config], ) - const onPopopToggle = useCallback((state) => { + const onPopupToggle = useCallback((state) => { setPopupOpen(state) }, []) @@ -161,31 +162,30 @@ export const AddNewRelation: React.FC<Props> = ({ } buttonType="custom" horizontalAlign="center" - onToggleOpen={onPopopToggle} + onToggleOpen={onPopupToggle} render={({ close: closePopup }) => ( - <ul className={`${baseClass}__relations`}> + <PopupList.ButtonGroup> {relatedCollections.map((relatedCollection) => { if (permissions.collections[relatedCollection.slug].create.permission) { return ( - <li key={relatedCollection.slug}> - <button - className={`${baseClass}__relation-button ${baseClass}__relation-button--${relatedCollection.slug}`} - onClick={() => { - closePopup() - setSelectedCollection(relatedCollection.slug) - }} - type="button" - > - {getTranslation(relatedCollection.labels.singular, i18n)} - </button> - </li> + <PopupList.Button + className={`${baseClass}__relation-button--${relatedCollection.slug}`} + key={relatedCollection.slug} + onClick={() => { + closePopup() + setSelectedCollection(relatedCollection.slug) + }} + > + {getTranslation(relatedCollection.labels.singular, i18n)} + </PopupList.Button> ) } return null })} - </ul> + </PopupList.ButtonGroup> )} + size="medium" /> {collectionConfig && permissions.collections[collectionConfig.slug].create.permission && ( diff --git a/packages/payload/src/admin/scss/vars.scss b/packages/payload/src/admin/scss/vars.scss index 041d975a6e2..9b7a6ab29d4 100644 --- a/packages/payload/src/admin/scss/vars.scss +++ b/packages/payload/src/admin/scss/vars.scss @@ -85,8 +85,8 @@ $focus-box-shadow: 0 0 0 $style-stroke-width-m var(--theme-success-500); @mixin shadow-lg-top { box-shadow: - 0 -2px 20px 7px rgba(0, 2, 4, 0.1), - 0 6px 4px -4px rgba(0, 2, 4, 0.02); + 0 -20px 35px -10px rgba(0, 2, 4, 0.2), + 0 -6px 4px -4px rgba(0, 2, 4, 0.02); } @mixin shadow { diff --git a/packages/richtext-slate/src/field/elements/link/Element/index.scss b/packages/richtext-slate/src/field/elements/link/Element/index.scss index 83df44107df..0cb98f3579e 100644 --- a/packages/richtext-slate/src/field/elements/link/Element/index.scss +++ b/packages/richtext-slate/src/field/elements/link/Element/index.scss @@ -11,14 +11,13 @@ bottom: 0; left: 0; - .popup__scroll, - .popup__wrap { + .popup__hide-scrollbar, + .popup__scroll-container { overflow: visible; } - .popup__scroll { + .popup__scroll-content { white-space: pre; - padding-right: base(0.5); } } @@ -35,7 +34,7 @@ @extend %btn-reset; font-weight: 600; cursor: pointer; - margin: 0 0 0 base(0.25); + margin: 0; &:hover, &:focus-visible { @@ -48,7 +47,29 @@ max-width: base(8); overflow: hidden; text-overflow: ellipsis; - margin-right: base(0.25); + border-radius: 2px; + + &:hover { + background-color: var(--popup-button-highlight); + } + } +} + +.rich-text-link__popup { + display: flex; + gap: calc(var(--base) * 0.25); + button { + &:hover { + .btn__icon { + background-color: var(--popup-button-highlight); + .fill { + fill: var(--theme-text); + } + .stroke { + stroke: var(--theme-text); + } + } + } } } diff --git a/packages/richtext-slate/src/field/elements/link/Element/index.tsx b/packages/richtext-slate/src/field/elements/link/Element/index.tsx index 26be4d3d9f5..008f065dc7c 100644 --- a/packages/richtext-slate/src/field/elements/link/Element/index.tsx +++ b/packages/richtext-slate/src/field/elements/link/Element/index.tsx @@ -159,6 +159,7 @@ export const LinkElement: React.FC<{ href={`${config.routes.admin}/collections/${element.doc.relationTo}/${element.doc.value}`} rel="noreferrer" target="_blank" + title={`${config.routes.admin}/collections/${element.doc.relationTo}/${element.doc.value}`} > label </a> @@ -170,6 +171,7 @@ export const LinkElement: React.FC<{ href={element.url} rel="noreferrer" target="_blank" + title={element.url} > {element.url} </a> @@ -200,7 +202,7 @@ export const LinkElement: React.FC<{ /> </div> )} - size="small" + size="fit-content" verticalAlign="bottom" /> </span> diff --git a/test/fields/e2e.spec.ts b/test/fields/e2e.spec.ts index e661b4028d8..4299e1b2250 100644 --- a/test/fields/e2e.spec.ts +++ b/test/fields/e2e.spec.ts @@ -321,13 +321,13 @@ describe('fields', () => { const firstBlockSelector = blocksDrawer .locator('.blocks-drawer__blocks .blocks-drawer__block') .first() - await expect(firstBlockSelector).toContainText('Text') + await expect(firstBlockSelector).toContainText('Content') await firstBlockSelector.click() // ensure the block was appended to the rows const addedRow = page.locator('#field-blocks .blocks-field__row').last() await expect(addedRow).toBeVisible() - await expect(addedRow.locator('.blocks-field__block-pill-text')).toContainText('Text') + await expect(addedRow.locator('.blocks-field__block-pill-content')).toContainText('Content') }) test('should open blocks drawer from block row and add below', async () => { @@ -348,13 +348,13 @@ describe('fields', () => { const firstBlockSelector = blocksDrawer .locator('.blocks-drawer__blocks .blocks-drawer__block') .first() - await expect(firstBlockSelector).toContainText('Text') + await expect(firstBlockSelector).toContainText('Content') await firstBlockSelector.click() // ensure the block was inserted beneath the first in the rows const addedRow = page.locator('#field-blocks #blocks-row-1') await expect(addedRow).toBeVisible() - await expect(addedRow.locator('.blocks-field__block-pill-text')).toContainText('Text') // went from `Number` to `Text` + await expect(addedRow.locator('.blocks-field__block-pill-content')).toContainText('Content') // went from `Number` to `Content` }) test('should use i18n block labels', async () => { @@ -488,18 +488,16 @@ describe('fields', () => { await page.locator('#potentiallyEmptyArray-row-1 .array-actions__button').click() await page - .locator('#potentiallyEmptyArray-row-1 .popup__scroll .array-actions__remove') + .locator('#potentiallyEmptyArray-row-1 .popup__scroll-container .array-actions__remove') .click() await page.locator('#potentiallyEmptyArray-row-0 .array-actions__button').click() await page - .locator('#potentiallyEmptyArray-row-0 .popup__scroll .array-actions__remove') + .locator('#potentiallyEmptyArray-row-0 .popup__scroll-container .array-actions__remove') .click() - const rows = await page.locator( - '#field-potentiallyEmptyArray > .array-field__draggable-rows', - ) + const rows = page.locator('#field-potentiallyEmptyArray > .array-field__draggable-rows') - expect(rows).not.toBeVisible() + await expect(rows).toBeHidden() }) test('should remove existing row', async () => { @@ -513,15 +511,13 @@ describe('fields', () => { await page.locator('#potentiallyEmptyArray-row-0 .array-actions__button').click() await page .locator( - '#potentiallyEmptyArray-row-0 .popup__scroll .array-actions__action.array-actions__remove', + '#potentiallyEmptyArray-row-0 .popup__scroll-container .array-actions__action.array-actions__remove', ) .click() - const rows = await page.locator( - '#field-potentiallyEmptyArray > .array-field__draggable-rows', - ) + const rows = page.locator('#field-potentiallyEmptyArray > .array-field__draggable-rows') - expect(rows).not.toBeVisible() + await expect(rows).toBeHidden() }) test('should add row after removing existing row', async () => { @@ -537,7 +533,7 @@ describe('fields', () => { await page.locator('#potentiallyEmptyArray-row-1 .array-actions__button').click() await page .locator( - '#potentiallyEmptyArray-row-1 .popup__scroll .array-actions__action.array-actions__remove', + '#potentiallyEmptyArray-row-1 .popup__scroll-container .array-actions__action.array-actions__remove', ) .click() await page.locator('#field-potentiallyEmptyArray > .array-field__add-row').click()
aee86c613601e630dfd4fa02411272faae62b3bb
2022-03-07 21:26:21
James
chore: beta release
false
beta release
chore
diff --git a/CHANGELOG.md b/CHANGELOG.md index bb2f3859725..2493ddc6d10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## [0.14.29-beta.0](https://github.com/payloadcms/payload/compare/v0.14.0...v0.14.29-beta.0) (2022-03-07) +## [0.14.30-beta.0](https://github.com/payloadcms/payload/compare/v0.14.0...v0.14.30-beta.0) (2022-03-07) ### Bug Fixes @@ -26,6 +26,7 @@ ### Features * :tada: versions, drafts, & autosave! +* adds originalDoc to field access control ([c979513](https://github.com/payloadcms/payload/commit/c9795133b376d8159457a0a38784d0b53a549061)) * [#458](https://github.com/payloadcms/payload/issues/458), provides field hooks with sibling data ([8e23a24](https://github.com/payloadcms/payload/commit/8e23a24f34ef7425bb4d43e96e869b255740c739)) * add before and after login components ([#427](https://github.com/payloadcms/payload/issues/427)) ([5591eea](https://github.com/payloadcms/payload/commit/5591eeafca1aa6e8abcc2d8276f7478e00b75ef2)) * add logMockCredentials email option ([ff33453](https://github.com/payloadcms/payload/commit/ff3345373630ca6913165284123a62269b3fa2c6)) diff --git a/package.json b/package.json index 9449acc4ed5..3adb4772a8e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload", - "version": "0.14.29-beta.0", + "version": "0.14.30-beta.0", "description": "Node, React and MongoDB Headless CMS and Application Framework", "license": "SEE LICENSE IN license.md", "author": {
c62707cd515c0a21da1dc2cd5a9c69f396d4baa0
2022-01-01 01:02:18
James
feat: working autosave
false
working autosave
feat
diff --git a/src/admin/components/elements/Autosave/index.tsx b/src/admin/components/elements/Autosave/index.tsx index 4ecf14edf99..af52b50f8a8 100644 --- a/src/admin/components/elements/Autosave/index.tsx +++ b/src/admin/components/elements/Autosave/index.tsx @@ -68,8 +68,9 @@ const Autosave: React.FC<Props> = ({ collection, global, id, publishedDocUpdated const timeToSaveAgain = lastSavedDate.getTime(); if (Date.now() >= timeToSaveAgain) { + setSaving(true); + setTimeout(async () => { - setSaving(true); let url: string; let method: string; let entityFields: Field[] = [];
72fc413764c6c42ba64a45f01d99b68ad3bd46c4
2021-11-02 08:41:54
James
fix: ensures buildQuery works with fields as well as simultaneous or / and
false
ensures buildQuery works with fields as well as simultaneous or / and
fix
diff --git a/src/mongoose/buildQuery.ts b/src/mongoose/buildQuery.ts index 81afd02765d..e8282205810 100644 --- a/src/mongoose/buildQuery.ts +++ b/src/mongoose/buildQuery.ts @@ -105,8 +105,6 @@ class ParamParser { } else if (typeof searchParam?.value === 'object') { result = deepmerge(result, searchParam.value, { arrayMerge: combineMerge }); } - - return result; } } }
6a6094c1a71e33d6af358fed64e69085429c239f
2023-09-25 21:10:30
Dan Ribbens
chore: adds postgres destroy
false
adds postgres destroy
chore
diff --git a/packages/db-postgres/src/destroy.ts b/packages/db-postgres/src/destroy.ts new file mode 100644 index 00000000000..d377ee2da62 --- /dev/null +++ b/packages/db-postgres/src/destroy.ts @@ -0,0 +1,7 @@ +import type { Destroy } from 'payload/database' + +import type { PostgresAdapter } from './types' + +export const destroy: Destroy = async function destroy (this: PostgresAdapter) { + await this.pool.end() +} diff --git a/packages/db-postgres/src/index.ts b/packages/db-postgres/src/index.ts index 047991a15cb..58e6c731179 100644 --- a/packages/db-postgres/src/index.ts +++ b/packages/db-postgres/src/index.ts @@ -13,6 +13,7 @@ import { createVersion } from './createVersion' import { deleteMany } from './deleteMany' import { deleteOne } from './deleteOne' import { deleteVersions } from './deleteVersions' +import { destroy } from './destroy' import { find } from './find' import { findGlobal } from './findGlobal' import { findGlobalVersions } from './findGlobalVersions' @@ -29,16 +30,15 @@ import { updateGlobalVersion } from './updateGlobalVersion' import { updateVersion } from './updateVersion' import { webpack } from './webpack' -// import { destroy } from './destroy'; - -export function postgresAdapter(args: Args): PostgresAdapterResult { - function adapter({ payload }: { payload: Payload }) { +export function postgresAdapter (args: Args): PostgresAdapterResult { + function adapter ({ payload }: { payload: Payload }) { return createDatabaseAdapter<PostgresAdapter>({ ...args, beginTransaction, commitTransaction, pool: undefined, ...(args.migrationDir && { migrationDir: args.migrationDir }), + name: 'postgres', connect, create, createGlobal, @@ -47,15 +47,14 @@ export function postgresAdapter(args: Args): PostgresAdapterResult { createVersion, db: undefined, defaultIDType: 'number', - findGlobalVersions, - // destroy, - name: 'postgres', deleteMany, deleteOne, deleteVersions, + destroy, enums: {}, find, findGlobal, + findGlobalVersions, findOne, findVersions, init,
e197e0316f9c01f945dc7f6d21ac28f9f0420f1d
2023-10-22 03:28:47
Alessio Gravili
fix(richtext-*): hasMany relationships not populated correctly
false
hasMany relationships not populated correctly
fix
diff --git a/packages/richtext-lexical/src/populate/recurseNestedFields.ts b/packages/richtext-lexical/src/populate/recurseNestedFields.ts index ab994882403..b6afc05ceb8 100644 --- a/packages/richtext-lexical/src/populate/recurseNestedFields.ts +++ b/packages/richtext-lexical/src/populate/recurseNestedFields.ts @@ -36,6 +36,7 @@ export const recurseNestedFields = ({ if (field.type === 'relationship') { if (field.hasMany && Array.isArray(data[field.name])) { if (Array.isArray(field.relationTo)) { + // polymorphic relationship data[field.name].forEach(({ relationTo, value }, i) => { const collection = req.payload.collections[relationTo] if (collection) { @@ -99,21 +100,23 @@ export const recurseNestedFields = ({ } } if (typeof data[field.name] !== 'undefined' && typeof field.relationTo === 'string') { - const collection = req.payload.collections[field.relationTo] - promises.push( - populate({ - id: data[field.name], - collection, - currentDepth, - data, - depth, - field, - key: field.name, - overrideAccess, - req, - showHiddenFields, - }), - ) + if (!('hasMany' in field) || !field.hasMany) { + const collection = req.payload.collections[field.relationTo] + promises.push( + populate({ + id: data[field.name], + collection, + currentDepth, + data, + depth, + field, + key: field.name, + overrideAccess, + req, + showHiddenFields, + }), + ) + } } } else if (fieldHasSubFields(field) && !fieldIsArrayType(field)) { if (fieldAffectsData(field) && typeof data[field.name] === 'object') { diff --git a/packages/richtext-slate/src/data/recurseNestedFields.ts b/packages/richtext-slate/src/data/recurseNestedFields.ts index 1fe5526cc3a..0b426b816fd 100644 --- a/packages/richtext-slate/src/data/recurseNestedFields.ts +++ b/packages/richtext-slate/src/data/recurseNestedFields.ts @@ -76,21 +76,23 @@ export const recurseNestedFields = ({ data[field.name]?.value && data[field.name]?.relationTo ) { - const collection = req.payload.collections[data[field.name].relationTo] - promises.push( - populate({ - id: data[field.name].value, - collection, - currentDepth, - data: data[field.name], - depth, - field, - key: 'value', - overrideAccess, - req, - showHiddenFields, - }), - ) + if (!('hasMany' in field) || !field.hasMany) { + const collection = req.payload.collections[data[field.name].relationTo] + promises.push( + populate({ + id: data[field.name].value, + collection, + currentDepth, + data: data[field.name], + depth, + field, + key: 'value', + overrideAccess, + req, + showHiddenFields, + }), + ) + } } } if (typeof data[field.name] !== 'undefined' && typeof field.relationTo === 'string') {
f2bf2399fa34c49b3b68be55257908b0f8733962
2022-06-08 21:07:31
Dan Ribbens
fix: custom fields values resetting in ui (#626)
false
custom fields values resetting in ui (#626)
fix
diff --git a/src/admin/components/utilities/RenderCustomComponent/index.tsx b/src/admin/components/utilities/RenderCustomComponent/index.tsx index 8985a193aca..efa60f698c9 100644 --- a/src/admin/components/utilities/RenderCustomComponent/index.tsx +++ b/src/admin/components/utilities/RenderCustomComponent/index.tsx @@ -1,14 +1,12 @@ import React from 'react'; import { Props } from './types'; -import withCondition from '../../forms/withCondition'; const RenderCustomComponent: React.FC<Props> = (props) => { const { CustomComponent, DefaultComponent, componentProps } = props; if (CustomComponent) { - const ConditionalCustomComponent = withCondition(CustomComponent); return ( - <ConditionalCustomComponent {...componentProps} /> + <CustomComponent {...componentProps} /> ); } diff --git a/src/fields/config/sanitize.ts b/src/fields/config/sanitize.ts index c74d2b1b011..a39fb64eac5 100644 --- a/src/fields/config/sanitize.ts +++ b/src/fields/config/sanitize.ts @@ -4,6 +4,7 @@ import { baseBlockFields } from '../baseFields/baseBlockFields'; import validations from '../validations'; import { baseIDField } from '../baseFields/baseIDField'; import { Field, fieldAffectsData } from './types'; +import withCondition from '../../admin/components/forms/withCondition'; const sanitizeFields = (fields: Field[], validRelationships: string[]): Field[] => { if (!fields) return []; @@ -57,7 +58,13 @@ const sanitizeFields = (fields: Field[], validRelationships: string[]): Field[] if (!field.access) field.access = {}; } - if (!field.admin) field.admin = {}; + if (field.admin) { + if (field.admin.condition && field.admin.components?.Field) { + field.admin.components.Field = withCondition(field.admin.components?.Field); + } + } else { + field.admin = {}; + } if ('fields' in field && field.fields) field.fields = sanitizeFields(field.fields, validRelationships);
85658c7017cb7dccc985fa5086454d8915987618
2021-01-03 22:30:35
James
docs: spelling, REST auth ops, Upload progress
false
spelling, REST auth ops, Upload progress
docs
diff --git a/docs/Admin/overview.mdx b/docs/Admin/overview.mdx index 9b6c9b56a71..0c373128384 100644 --- a/docs/Admin/overview.mdx +++ b/docs/Admin/overview.mdx @@ -9,7 +9,7 @@ Payload dynamically generates a beautiful, fully functional React admin panel to The Payload Admin panel is built with Webpack, code-split, highly performant (even with 100+ fields), and written fully in TypeScript. It's meant to be simple enough to give you a starting point but not bring too much complexity, so that you can easily customize it to suit the needs of your application and your editors. <br/> -![Array field in Payload admin panel](/images/admin.jpg) +![Payload's Admin panel built in React](/images/admin.jpg) *Screenshot of the Admin panel while editing a document from an example `AllFields` collection* diff --git a/docs/Admin/webpack.mdx b/docs/Admin/webpack.mdx index 14e5ebeb437..d4e83adc406 100644 --- a/docs/Admin/webpack.mdx +++ b/docs/Admin/webpack.mdx @@ -152,7 +152,7 @@ The above code will alias the file at path `createStripeSubscriptionPath` to a m export default {}; ``` -Now, when Webpack sees that you're attempting to import your `createStripeSubscriptionPath` file, it'll disregard that actual file and load your mock file instead. Not only will your Admin panel now bundle succcessfully, you will have optimized its filesize by removing unnecessary code! And you might have learned something about Webpack, too. +Now, when Webpack sees that you're attempting to import your `createStripeSubscriptionPath` file, it'll disregard that actual file and load your mock file instead. Not only will your Admin panel now bundle successfully, you will have optimized its filesize by removing unnecessary code! And you might have learned something about Webpack, too. ## Admin environment vars diff --git a/docs/Authentication/operations.mdx b/docs/Authentication/operations.mdx index 017506b6d58..fbecd9308ec 100644 --- a/docs/Authentication/operations.mdx +++ b/docs/Authentication/operations.mdx @@ -266,7 +266,7 @@ const result = await payload.verifyEmail({ ### Unlock -If a user locls themselves out and you wish to deliberately unlock them, you can utilize the Unlock operation. The Admin panel features an Unlock control automatically for all collections that feature max login attempts, but you can programmatically unlock users as well by using the Unlock operation. +If a user locks themselves out and you wish to deliberately unlock them, you can utilize the Unlock operation. The Admin panel features an Unlock control automatically for all collections that feature max login attempts, but you can programmatically unlock users as well by using the Unlock operation. To restrict who is allowed to unlock users, you can utilize the [`unlock`](/docs/access-control/overview#unlock) access control function. diff --git a/docs/Authentication/overview.mdx b/docs/Authentication/overview.mdx index 604ddd97633..7f0c1d6fe26 100644 --- a/docs/Authentication/overview.mdx +++ b/docs/Authentication/overview.mdx @@ -10,7 +10,10 @@ order: 10 Authentication is used within the Payload Admin panel itself as well as throughout your app(s) themselves however you determine necessary. -Here are some common use cases of Authentication outside of Payload's dashboard itself: +![Authentication admin panel functionality](/images/auth-admin.jpg) +*Admin panel screenshot depicting an Admins Collection with Auth enabled* + +**Here are some common use cases of Authentication outside of Payload's dashboard itself:** - Customer accounts for an ecommerce app - Customer accounts for a SaaS product diff --git a/docs/Authentication/using-middleware.mdx b/docs/Authentication/using-middleware.mdx index 6af2bf5d3e2..d8d402f9df2 100644 --- a/docs/Authentication/using-middleware.mdx +++ b/docs/Authentication/using-middleware.mdx @@ -4,11 +4,11 @@ label: Using the Middleware order: 40 --- -Because Payload uses your existing Express server, you are free to add whatever logic you need to your app through endpoints of your own. However, Payload does not add its middleware to your Express app itself—instead, ist scopes all of its middelware to Payload-specific routers. +Because Payload uses your existing Express server, you are free to add whatever logic you need to your app through endpoints of your own. However, Payload does not add its middleware to your Express app itself—instead, ist scopes all of its middleware to Payload-specific routers. This approach has a ton of benefits - it's great for isolation of concerns and limiting scope, but it also means that your additional routes won't have access to Payload's user authentication. -If you would like to make use of Payload's built-in authentication within your custom routes, you can to add Payload's authentication middeware. +If you would like to make use of Payload's built-in authentication within your custom routes, you can to add Payload's authentication middleware. Example in `server.js`: ```js diff --git a/docs/Configuration/collections.mdx b/docs/Configuration/collections.mdx index 744eceb8a8e..5ac7eaa6f78 100644 --- a/docs/Configuration/collections.mdx +++ b/docs/Configuration/collections.mdx @@ -70,7 +70,7 @@ You can customize the way that the Admin panel behaves on a collection-by-collec Collection `admin` options can accept a `preview` function that will be used to generate a link pointing to the frontend of your app to preview data. -If the function is specified, a Preview button will automatically appear in the corrresponding collection's Edit view. Clicking the Preview button will link to the URL that is generated by the function. +If the function is specified, a Preview button will automatically appear in the corresponding collection's Edit view. Clicking the Preview button will link to the URL that is generated by the function. The preview function accepts the document being edited as an argument. @@ -104,7 +104,7 @@ You can specify extremely granular access control (what users can do with docume ### Hooks -Hooks are a powerful way to extend collection functionality and execute your own logic, and can be defined on a collectiion by collection basis. To learn more, go to the [Hooks](/docs/hooks/overview) documentation. +Hooks are a powerful way to extend collection functionality and execute your own logic, and can be defined on a collection by collection basis. To learn more, go to the [Hooks](/docs/hooks/overview) documentation. ### Field types diff --git a/docs/Configuration/overview.mdx b/docs/Configuration/overview.mdx index b82675d4e56..04c860b6e64 100644 --- a/docs/Configuration/overview.mdx +++ b/docs/Configuration/overview.mdx @@ -6,7 +6,7 @@ order: 10 Payload is a *config-based*, code-first CMS and application framework. The Payload config is central to everything that Payload does. It scaffolds the data that Payload stores as well as maintains custom React components, hook logic, custom validations, and much more. The config itself and all of its dependencies are run through Babel, so you can take full advantage of newer JavaScript features and even directly import React components containing JSX. -<strong>Also, because the Payload source code is fully written in TypeScript, its configs are strongly typed—meaning that even if you aren't using TypeScript to build your project, your IDE (such as VSCode) may still provide helpful information like typeahead suggestions while you write your config.</strong> +<strong>Also, because the Payload source code is fully written in TypeScript, its configs are strongly typed—meaning that even if you aren't using TypeScript to build your project, your IDE (such as VSCode) may still provide helpful information like type-ahead suggestions while you write your config.</strong> <Banner type="warning"> <strong>Important:</strong><br />This file is included in the Payload admin bundle, so make sure you do not embed any sensitive information. diff --git a/docs/Hooks/fields.mdx b/docs/Hooks/fields.mdx index 22879753e32..16cc844b8cd 100644 --- a/docs/Hooks/fields.mdx +++ b/docs/Hooks/fields.mdx @@ -6,7 +6,7 @@ order: 30 Field-level hooks offer incredible potential for encapsulating your logic. They help to isolate concerns and package up functionalities to be easily reusable across your projects. -Example use cases include: +**Example use cases include:** - Automatically add an `owner` relationship to a Document based on the `req.user.id` - Encrypt / decrypt a sensitive field using `beforeValidate` and `afterRead` hooks @@ -14,12 +14,12 @@ Example use cases include: - Format incoming data such as kebab-casing a document `slug` with `beforeValidate` - Restrict updating a document to only once every X hours using the `beforeChange` hook -All field types provide the following hooks: +**All field types provide the following hooks:** -- [beforeValidate](#beforeValidate) -- [beforeChange](#beforeChange) -- [afterChange](#afterChange) -- [afterRead](#afterRead) +- `beforeValidate` +- `beforeChange` +- `afterChange` +- `afterRead` ## Config diff --git a/docs/Hooks/overview.mdx b/docs/Hooks/overview.mdx index 894b86a06ed..2013cacaf6f 100644 --- a/docs/Hooks/overview.mdx +++ b/docs/Hooks/overview.mdx @@ -40,4 +40,4 @@ You can specify hooks in the following contexts: - [Collection Hooks](/docs/hooks/collections) - [Field Hooks](/docs/hooks/fields) -- [Global Hooks](/docs/hoooks/globals) +- [Global Hooks](/docs/hooks/globals) diff --git a/docs/REST-API/overview.mdx b/docs/REST-API/overview.mdx index 03857c9b8fb..190a17a8cf2 100644 --- a/docs/REST-API/overview.mdx +++ b/docs/REST-API/overview.mdx @@ -37,7 +37,20 @@ The `find` endpoint supports the following additional query parameters: - [sort](/docs/queries/overview#sort) - sort by field - [where](/docs/queries/overview) - pass a `where` query to constrain returned documents - [limit](/docs/queries/pagination#pagination-controls) - limit the returned documents to a certain number -- [page](/docs/queries/pagination#pagination-controls) - get a specfic page of documents +- [page](/docs/queries/pagination#pagination-controls) - get a specific page of documents + +## Auth Operations + +| Method | Path | Description | +| -------- | --------------------------- | ----------- | +| `POST` | `/api/{collectionSlug}/verify/:token` | [Email verification](/docs/authentication/operations#verify-by-email), if enabled. | +| `POST` | `/api/{collectionSlug}/unlock` | [Unlock a user's account](/docs/authentication/operations#unlock), if enabled. | +| `POST` | `/api/{collectionSlug}/login` | [Logs in](/docs/authentication/operations#login) a user with email / password. | +| `POST` | `/api/{collectionSlug}/logout` | [Logs out](/docs/authentication/operations#logout) a user. | +| `POST` | `/api/{collectionSlug}/refresh-token` | [Refreshes a token](/docs/authentication/operations#refresh) that has not yet expired. | +| `GET` | `/api/{collectionSlug}/me` | [Returns the currently logged in user with token](/docs/authentication/operations#me). | +| `POST` | `/api/{collectionSlug}/forgot-password` | [Password reset workflow](/docs/authentication/operations#forgot-password) entry point. | +| `POST` | `/api/{collectionSlug}/reset-password` | [To reset the user's password](/docs/authentication/operations#reset-password). | ## Globals diff --git a/docs/Upload/config.mdx b/docs/Upload/config.mdx index b9c02f22e38..55b1b00e220 100644 --- a/docs/Upload/config.mdx +++ b/docs/Upload/config.mdx @@ -1,16 +1,108 @@ --- -title: Upload Config +title: Uploads label: Config order: 10 --- -Talk about how to configure uploads here. +<Banner> + Payload provides for everything you need to enable file upload, storage, and management directly on your server—including extremely powerful file access control. +</Banner> + +![Upload admin panel functionality](/images/upload-admin.jpg) +*Admin panel screenshot depicting a Media Collection with Upload enabled* + +**Here are some common use cases of Uploads:** + +- Creating a "Media Library" that contains images for use throughout your site or app +- Building a Gated Content library where users need to sign up to gain access to downloadable assets like ebook PDFs, whitepapers, etc. +- Storing publicly available, downloadable assets like software, ZIP files, MP4s, etc. + +**By simply enabling Upload functionality on a Collection, Payload will automatically transform your Collection into a robust file management / storage solution. The following modifications will be made:** + +1. `filename`, `mimeType`, and `filesize` fields will be automatically added to your Collection. Optionally, if you pass `imageSizes` to your Collection's Upload config, a [`sizes` array](#image-sizes) will also be added containing auto-resized image sizes and filenames. +1. The Admin panel will modify its built-in `List` component to show a thumbnail gallery of your Uploads instead of the default Table view +1. The Admin panel will modify its `Edit` view(s) to add a new set of corresponding Upload UI which will allow for file upload +1. The `create`, `update`, and `delete` Collection operations will be modified to support file upload, re-upload, and deletion + +### Enabling Uploads + +Every Payload Collection can opt-in to supporting Uploads by specifying the `upload` property on the Collection's config to either `true` or to an object containing `upload` options. + +<Banner type="success"> + <strong>Tip:</strong><br/> + A common pattern is to create a <strong>Media</strong> collection and enable <strong>upload</strong> on that collection. +</Banner> + +#### Collection Upload Options + +| Option | Description | +| ---------------------- | -------------| +| **`staticURL`** * | The base URL path to use to access you uploads. Example: `/media` | +| **`staticDir`** * | The folder directory to use to store media in. Can be either an absolute path or relative to the directory that contains your config. | +| **`imageSizes`** | If specified, image uploads will be automatically resized in accordance to these image sizes. [More](#image-sizes) | +| **`adminThumbnail`** | Which of your provided image sizes to use for the admin panel's thumbnail. Typically a size around 500x500px or so works well. | + +*An asterisk denotes that a property above is required.* + +**Example Upload collection:** +```js +const Media = { + slug: 'media', + upload: { + staticURL: '/media', + staticDir: 'media', + imageSizes: [ + { + name: 'thumbnail', + width: 400, + height: 300, + crop: 'centre', + }, + { + name: 'card', + width: 768, + height: 1024, + crop: 'centre', + } + ] + } +} +``` + +### Payload-wide Upload Options + +Payload relies on the [`express-fileupload`](https://www.npmjs.com/package/express-fileupload) package to manage file uploads in Express. In addition to the Upload options specifiable on a Collection by Collection basis, you can also control the `express-fileupload` options by passing your base Payload config an `upload` property containing an object supportive of all `express-fileupload` properties which use `Busboy` under the hood. [Click here](https://github.com/mscdex/busboy#api) for more documentation about what you can control. + +A common example of what you might want to customize within Payload-wide Upload options would be to increase the allowed `fileSize` of uploads sent to Payload: + +```js +import { buildConfig } from 'payload/config'; + +export default buildConfig({ + serverURL: 'http://localhost:3000', + collections: [ + { + slug: 'media', + fields: [ + { + name: 'alt', + type: 'text', + }, + ], + upload: true, + }, + ], + upload: { + limits: { + fileSize: 5000000, // 5MB, written in bytes + } + } +}); +``` + Need to cover: -1. Global upload config #global -1. Can have multiple collections -1. Static directory 1. How to upload (multipart/form-data) 1. Uploading is REST-only 1. Access control
c7744c5bf0e3bd4a10a194e73a20911f0c626376
2023-09-19 00:07:51
Dan Ribbens
test: conditional geojson
false
conditional geojson
test
diff --git a/test/collections-rest/int.spec.ts b/test/collections-rest/int.spec.ts index b95ead84c5a..22b92793541 100644 --- a/test/collections-rest/int.spec.ts +++ b/test/collections-rest/int.spec.ts @@ -1,20 +1,13 @@ -import { randomBytes } from 'crypto' - -import type { Relation } from './config' -import type { ErrorOnHook, Post } from './payload-types' - -import payload from '../../packages/payload/src' -import { mapAsync } from '../../packages/payload/src/utilities/mapAsync' -import { initPayloadTest } from '../helpers/configHelpers' -import { RESTClient } from '../helpers/rest' -import config, { - customIdNumberSlug, - customIdSlug, - errorOnHookSlug, - pointSlug, - relationSlug, - slug, -} from './config' +import { randomBytes } from 'crypto'; + +import type { Relation } from './config'; +import type { ErrorOnHook, Post } from './payload-types'; + +import payload from '../../packages/payload/src'; +import { mapAsync } from '../../packages/payload/src/utilities/mapAsync'; +import { initPayloadTest } from '../helpers/configHelpers'; +import { RESTClient } from '../helpers/rest'; +import config, { customIdNumberSlug, customIdSlug, errorOnHookSlug, pointSlug, relationSlug, slug, } from './config'; let client: RESTClient @@ -25,12 +18,14 @@ describe('collections-rest', () => { // Wait for indexes to be created, // as we need them to query by point - await new Promise((resolve, reject) => { - payload.db.collections[pointSlug].ensureIndexes(function (err) { - if (err) reject(err) - resolve(true) + if (payload.db.name === 'mongoose') { + await new Promise((resolve, reject) => { + payload.db.collections[pointSlug].ensureIndexes(function (err) { + if (err) reject(err) + resolve(true) + }) }) - }) + } }) afterAll(async () => { @@ -116,11 +111,12 @@ describe('collections-rest', () => { }) const description = 'updated' - const { status, docs } = await client.updateMany<Post>({ + const { status, docs, errors } = await client.updateMany({ where: { title: { equals: 'title' } }, data: { description }, }) + expect(errors).toHaveLength(0); expect(status).toEqual(200) expect(docs[0].title).toEqual('title') // Check was not modified expect(docs[0].description).toEqual(description) @@ -870,162 +866,164 @@ describe('collections-rest', () => { }) }) - describe('near', () => { - const point = [10, 20] - const [lat, lng] = point - it('should return a document near a point', async () => { - const near = `${lat + 0.01}, ${lng + 0.01}, 10000` - const { status, result } = await client.find({ - slug: pointSlug, - query: { - point: { - near, + if (['mongoose'].includes(process.env.PAYLOAD_DATABASE)) { + describe('near', () => { + const point = [10, 20] + const [lat, lng] = point + it('should return a document near a point', async () => { + const near = `${lat + 0.01}, ${lng + 0.01}, 10000` + const { status, result } = await client.find({ + slug: pointSlug, + query: { + point: { + near, + }, }, - }, - }) - - expect(status).toEqual(200) - expect(result.docs).toHaveLength(1) - }) + }) - it('should not return a point far away', async () => { - const near = `${lng + 1}, ${lat - 1}, 5000` - const { status, result } = await client.find({ - slug: pointSlug, - query: { - point: { - near, - }, - }, + expect(status).toEqual(200) + expect(result.docs).toHaveLength(1) }) - expect(status).toEqual(200) - expect(result.docs).toHaveLength(0) - }) - - it('should sort find results by nearest distance', async () => { - // creating twice as many records as we are querying to get a random sample - await mapAsync([...Array(10)], async () => { - // setTimeout used to randomize the creation timestamp - setTimeout(async () => { - await payload.create({ - collection: pointSlug, - data: { - // only randomize longitude to make distance comparison easy - point: [Math.random(), 0], + it('should not return a point far away', async () => { + const near = `${lng + 1}, ${lat - 1}, 5000` + const { status, result } = await client.find({ + slug: pointSlug, + query: { + point: { + near, }, - }) - }, Math.random()) - }) + }, + }) - const { result } = await client.find({ - slug: pointSlug, - query: { - // querying large enough range to include all docs - point: { near: '0, 0, 100000, 0' }, - }, - limit: 5, + expect(status).toEqual(200) + expect(result.docs).toHaveLength(0) }) - const { docs } = result - let previous = 0 - docs.forEach(({ point: coordinates }) => { - // the next document point should always be greater than the one before - expect(previous).toBeLessThanOrEqual(coordinates[0]) - ;[previous] = coordinates + + it('should sort find results by nearest distance', async () => { + // creating twice as many records as we are querying to get a random sample + await mapAsync([...Array(10)], async () => { + // setTimeout used to randomize the creation timestamp + setTimeout(async () => { + await payload.create({ + collection: pointSlug, + data: { + // only randomize longitude to make distance comparison easy + point: [Math.random(), 0], + }, + }) + }, Math.random()) + }) + + const { result } = await client.find({ + slug: pointSlug, + query: { + // querying large enough range to include all docs + point: { near: '0, 0, 100000, 0' }, + }, + limit: 5, + }) + const { docs } = result + let previous = 0 + docs.forEach(({ point: coordinates }) => { + // the next document point should always be greater than the one before + expect(previous).toBeLessThanOrEqual(coordinates[0]) + ;[previous] = coordinates + }) }) }) - }) - describe('within', () => { - type Point = [number, number] - const polygon: Point[] = [ - [9.0, 19.0], // bottom-left - [9.0, 21.0], // top-left - [11.0, 21.0], // top-right - [11.0, 19.0], // bottom-right - [9.0, 19.0], // back to starting point to close the polygon - ] - it('should return a document with the point inside the polygon', async () => { - // There should be 1 total points document populated by default with the point [10, 20] - const { status, result } = await client.find({ - slug: pointSlug, - query: { - point: { - within: { - type: 'Polygon', - coordinates: [polygon], + describe('within', () => { + type Point = [number, number] + const polygon: Point[] = [ + [9.0, 19.0], // bottom-left + [9.0, 21.0], // top-left + [11.0, 21.0], // top-right + [11.0, 19.0], // bottom-right + [9.0, 19.0], // back to starting point to close the polygon + ] + it('should return a document with the point inside the polygon', async () => { + // There should be 1 total points document populated by default with the point [10, 20] + const { status, result } = await client.find({ + slug: pointSlug, + query: { + point: { + within: { + type: 'Polygon', + coordinates: [polygon], + }, }, }, - }, - }) + }) - expect(status).toEqual(200) - expect(result.docs).toHaveLength(1) - }) + expect(status).toEqual(200) + expect(result.docs).toHaveLength(1) + }) - it('should not return a document with the point outside a smaller polygon', async () => { - const { status, result } = await client.find({ - slug: pointSlug, - query: { - point: { - within: { - type: 'Polygon', - coordinates: [polygon.map((vertex) => vertex.map((coord) => coord * 0.1))], // Reduce polygon to 10% of its size + it('should not return a document with the point outside a smaller polygon', async () => { + const { status, result } = await client.find({ + slug: pointSlug, + query: { + point: { + within: { + type: 'Polygon', + coordinates: [polygon.map((vertex) => vertex.map((coord) => coord * 0.1))], // Reduce polygon to 10% of its size + }, }, }, - }, - }) + }) - expect(status).toEqual(200) - expect(result.docs).toHaveLength(0) + expect(status).toEqual(200) + expect(result.docs).toHaveLength(0) + }) }) - }) - describe('intersects', () => { - type Point = [number, number] - const polygon: Point[] = [ - [9.0, 19.0], // bottom-left - [9.0, 21.0], // top-left - [11.0, 21.0], // top-right - [11.0, 19.0], // bottom-right - [9.0, 19.0], // back to starting point to close the polygon - ] - - it('should return a document with the point intersecting the polygon', async () => { - // There should be 1 total points document populated by default with the point [10, 20] - const { status, result } = await client.find({ - slug: pointSlug, - query: { - point: { - intersects: { - type: 'Polygon', - coordinates: [polygon], + describe('intersects', () => { + type Point = [number, number] + const polygon: Point[] = [ + [9.0, 19.0], // bottom-left + [9.0, 21.0], // top-left + [11.0, 21.0], // top-right + [11.0, 19.0], // bottom-right + [9.0, 19.0], // back to starting point to close the polygon + ] + + it('should return a document with the point intersecting the polygon', async () => { + // There should be 1 total points document populated by default with the point [10, 20] + const { status, result } = await client.find({ + slug: pointSlug, + query: { + point: { + intersects: { + type: 'Polygon', + coordinates: [polygon], + }, }, }, - }, - }) + }) - expect(status).toEqual(200) - expect(result.docs).toHaveLength(1) - }) + expect(status).toEqual(200) + expect(result.docs).toHaveLength(1) + }) - it('should not return a document with the point not intersecting a smaller polygon', async () => { - const { status, result } = await client.find({ - slug: pointSlug, - query: { - point: { - intersects: { - type: 'Polygon', - coordinates: [polygon.map((vertex) => vertex.map((coord) => coord * 0.1))], // Reduce polygon to 10% of its size + it('should not return a document with the point not intersecting a smaller polygon', async () => { + const { status, result } = await client.find({ + slug: pointSlug, + query: { + point: { + intersects: { + type: 'Polygon', + coordinates: [polygon.map((vertex) => vertex.map((coord) => coord * 0.1))], // Reduce polygon to 10% of its size + }, }, }, - }, - }) + }) - expect(status).toEqual(200) - expect(result.docs).toHaveLength(0) + expect(status).toEqual(200) + expect(result.docs).toHaveLength(0) + }) }) - }) + } it('or', async () => { const post1 = await createPost({ title: 'post1' })
ef141d499b9cfb1c5f584aeb413005f08f374223
2024-03-16 17:05:27
Elliot DeNolf
ci: bump all actions to use Node 20. 16 is deprecated.
false
bump all actions to use Node 20. 16 is deprecated.
ci
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 60df8a7ecb0..2b51858b8ce 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,12 +46,12 @@ jobs: fetch-depth: 25 - name: Use Node.js 18 - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - name: Install pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v3 with: version: 8 run_install: false @@ -61,7 +61,7 @@ jobs: run: | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} @@ -74,7 +74,7 @@ jobs: - run: pnpm run build:core - name: Cache build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} @@ -90,12 +90,12 @@ jobs: fetch-depth: 25 - name: Use Node.js 18 - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - name: Install pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v3 with: version: 8 run_install: false @@ -105,7 +105,7 @@ jobs: run: | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} @@ -135,18 +135,18 @@ jobs: steps: - name: Use Node.js 18 - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - name: Install pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v3 with: version: 8 run_install: false - name: Restore build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} @@ -213,18 +213,18 @@ jobs: steps: - name: Use Node.js 18 - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - name: Install pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v3 with: version: 8 run_install: false - name: Restore build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} @@ -233,7 +233,7 @@ jobs: run: pnpm exec playwright install - name: E2E Tests - uses: nick-fields/retry@v2 + uses: nick-fields/retry@v3 with: retry_on: error max_attempts: 2 @@ -254,18 +254,18 @@ jobs: steps: - name: Use Node.js 18 - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - name: Install pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v3 with: version: 8 run_install: false - name: Restore build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} @@ -294,18 +294,18 @@ jobs: steps: - name: Use Node.js 18 - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - name: Install pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v3 with: version: 8 run_install: false - name: Restore build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} @@ -332,7 +332,7 @@ jobs: fetch-depth: 25 - name: Use Node.js 18 - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18
2c36468431aca959ef9fbd8647c25c525e9abd79
2023-05-05 02:25:46
Dan Ribbens
chore(release): v1.7.5
false
v1.7.5
chore
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ce7d719996..e1879565d8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ +## [1.7.5](https://github.com/payloadcms/payload/compare/v1.7.4...v1.7.5) (2023-05-04) + + +### Bug Fixes + +* make incrementName match multiple digits ([#2609](https://github.com/payloadcms/payload/issues/2609)) ([8dbf0a2](https://github.com/payloadcms/payload/commit/8dbf0a2bd88db1b361ce16bb730613de489f2ed2)) + + +### Features + +* collection admin.enableRichTextLink property ([#2560](https://github.com/payloadcms/payload/issues/2560)) ([9678992](https://github.com/payloadcms/payload/commit/967899229f458d06a3931d086bcc49299dc310b7)) +* custom admin buttons ([#2618](https://github.com/payloadcms/payload/issues/2618)) ([1d58007](https://github.com/payloadcms/payload/commit/1d58007606fa7e34007f2a56a3ca653d2cd3404d)) + ## [1.7.4](https://github.com/payloadcms/payload/compare/v1.7.3...v1.7.4) (2023-05-02) diff --git a/package.json b/package.json index b798625bfe5..07762ab8deb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload", - "version": "1.7.4", + "version": "1.7.5", "description": "Node, React and MongoDB Headless CMS and Application Framework", "license": "MIT", "engines": {
4dc6c09347aed73d12e21b92f5c66c6ed19ccb19
2023-10-14 17:06:32
Alessio Gravili
feat(richtext-lexical): SlateToLexical migration feature
false
SlateToLexical migration feature
feat
diff --git a/packages/richtext-lexical/src/cell/index.tsx b/packages/richtext-lexical/src/cell/index.tsx index 0227e6d3e30..f493c047b35 100644 --- a/packages/richtext-lexical/src/cell/index.tsx +++ b/packages/richtext-lexical/src/cell/index.tsx @@ -16,17 +16,38 @@ export const RichTextCell: React.FC< const [preview, setPreview] = React.useState('Loading...') useEffect(() => { - if (data == null) { + let dataToUse = data + if (dataToUse == null) { setPreview('') return } + + // Transform data through load hooks + if (editorConfig?.features?.hooks?.load?.length) { + editorConfig.features.hooks.load.forEach((hook) => { + dataToUse = hook({ incomingEditorState: dataToUse }) + }) + } + + // If data is from Slate and not Lexical + if (dataToUse && Array.isArray(dataToUse) && !('root' in dataToUse)) { + setPreview('') + return + } + + // If data is from payload-plugin-lexical + if (dataToUse && 'jsonContent' in dataToUse) { + setPreview('') + return + } + // initialize headless editor const headlessEditor = createHeadlessEditor({ namespace: editorConfig.lexical.namespace, nodes: getEnabledNodes({ editorConfig }), theme: editorConfig.lexical.theme, }) - headlessEditor.setEditorState(headlessEditor.parseEditorState(data)) + headlessEditor.setEditorState(headlessEditor.parseEditorState(dataToUse)) const textContent = headlessEditor.getEditorState().read(() => { diff --git a/packages/richtext-lexical/src/field/Field.tsx b/packages/richtext-lexical/src/field/Field.tsx index 6ee0abcd7b5..1eb7cd6a254 100644 --- a/packages/richtext-lexical/src/field/Field.tsx +++ b/packages/richtext-lexical/src/field/Field.tsx @@ -89,9 +89,16 @@ const RichText: React.FC<FieldProps> = (props) => { fieldProps={props} initialState={initialValue} onChange={(editorState, editor, tags) => { - const json = editorState.toJSON() + let serializedEditorState = editorState.toJSON() - setValue(json) + // Transform state through save hooks + if (editorConfig?.features?.hooks?.save?.length) { + editorConfig.features.hooks.save.forEach((hook) => { + serializedEditorState = hook({ incomingEditorState: serializedEditorState }) + }) + } + + setValue(serializedEditorState) }} readOnly={readOnly} setValue={setValue} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/heading.ts b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/heading.ts new file mode 100644 index 00000000000..ac031c6887f --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/heading.ts @@ -0,0 +1,25 @@ +import type { SerializedHeadingNode } from '@lexical/rich-text' + +import type { SlateNodeConverter } from '../types' + +import { convertSlateNodesToLexical } from '..' + +export const HeadingConverter: SlateNodeConverter = { + converter({ converters, slateNode }) { + return { + children: convertSlateNodesToLexical({ + canContainParagraphs: false, + converters, + parentNodeType: 'heading', + slateNodes: slateNode.children || [], + }), + direction: 'ltr', + format: '', + indent: 0, + tag: slateNode.type as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6', // Slate puts the tag (h1 / h2 / ...) inside of node.type + type: 'heading', + version: 1, + } as const as SerializedHeadingNode + }, + nodeTypes: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], +} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/indent.ts b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/indent.ts new file mode 100644 index 00000000000..b5e7212977a --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/indent.ts @@ -0,0 +1,65 @@ +import type { SerializedLexicalNode, SerializedParagraphNode } from 'lexical' + +import type { SlateNodeConverter } from '../types' + +import { convertSlateNodesToLexical } from '..' + +export const IndentConverter: SlateNodeConverter = { + converter({ converters, slateNode }) { + console.log('slateToLexical > IndentConverter > converter', JSON.stringify(slateNode, null, 2)) + const convertChildren = (node: any, indentLevel: number = 0): SerializedLexicalNode => { + if ( + (node?.type && (!node.children || node.type !== 'indent')) || + (!node?.type && node?.text) + ) { + console.log( + 'slateToLexical > IndentConverter > convertChildren > node', + JSON.stringify(node, null, 2), + ) + console.log( + 'slateToLexical > IndentConverter > convertChildren > nodeOutput', + JSON.stringify( + convertSlateNodesToLexical({ + canContainParagraphs: false, + converters, + parentNodeType: 'indent', + slateNodes: [node], + }), + + null, + 2, + ), + ) + + return { + ...convertSlateNodesToLexical({ + canContainParagraphs: false, + converters, + parentNodeType: 'indent', + slateNodes: [node], + })[0], + indent: indentLevel, + } as const as SerializedLexicalNode + } + + const children = node.children.map((child: any) => convertChildren(child, indentLevel + 1)) + console.log('slateToLexical > IndentConverter > children', JSON.stringify(children, null, 2)) + return { + children: children, + direction: 'ltr', + format: '', + indent: indentLevel, + type: 'paragraph', + version: 1, + } as const as SerializedParagraphNode + } + + console.log( + 'slateToLexical > IndentConverter > output', + JSON.stringify(convertChildren(slateNode), null, 2), + ) + + return convertChildren(slateNode) + }, + nodeTypes: ['indent'], +} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/link.ts b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/link.ts new file mode 100644 index 00000000000..80458d90b02 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/link.ts @@ -0,0 +1,29 @@ +import type { SerializedLinkNode } from '../../../../Link/nodes/LinkNode' +import type { SlateNodeConverter } from '../types' + +import { convertSlateNodesToLexical } from '..' + +export const LinkConverter: SlateNodeConverter = { + converter({ converters, slateNode }) { + return { + children: convertSlateNodesToLexical({ + canContainParagraphs: false, + converters, + parentNodeType: 'link', + slateNodes: slateNode.children || [], + }), + direction: 'ltr', + fields: { + doc: slateNode.doc || undefined, + linkType: slateNode.linkType || 'custom', + newTab: slateNode.newTab || false, + url: slateNode.url || undefined, + }, + format: '', + indent: 0, + type: 'link', + version: 1, + } as const as SerializedLinkNode + }, + nodeTypes: ['link'], +} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/listItem.ts b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/listItem.ts new file mode 100644 index 00000000000..1775803dab8 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/listItem.ts @@ -0,0 +1,26 @@ +import type { SerializedListItemNode } from '@lexical/list' + +import type { SlateNodeConverter } from '../types' + +import { convertSlateNodesToLexical } from '..' + +export const ListItemConverter: SlateNodeConverter = { + converter({ childIndex, converters, slateNode }) { + return { + checked: undefined, + children: convertSlateNodesToLexical({ + canContainParagraphs: false, + converters, + parentNodeType: 'listitem', + slateNodes: slateNode.children || [], + }), + direction: 'ltr', + format: '', + indent: 0, + type: 'listitem', + value: childIndex + 1, + version: 1, + } as const as SerializedListItemNode + }, + nodeTypes: ['li'], +} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/orderedList.ts b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/orderedList.ts new file mode 100644 index 00000000000..d3cef265044 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/orderedList.ts @@ -0,0 +1,27 @@ +import type { SerializedListNode } from '@lexical/list' + +import type { SlateNodeConverter } from '../types' + +import { convertSlateNodesToLexical } from '..' + +export const OrderedListConverter: SlateNodeConverter = { + converter({ converters, slateNode }) { + return { + children: convertSlateNodesToLexical({ + canContainParagraphs: false, + converters, + parentNodeType: 'list', + slateNodes: slateNode.children || [], + }), + direction: 'ltr', + format: '', + indent: 0, + listType: 'number', + start: 1, + tag: 'ol', + type: 'list', + version: 1, + } as const as SerializedListNode + }, + nodeTypes: ['ol'], +} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/relationship.ts b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/relationship.ts new file mode 100644 index 00000000000..d881e053857 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/relationship.ts @@ -0,0 +1,17 @@ +import type { SerializedRelationshipNode } from '../../../../../..' +import type { SlateNodeConverter } from '../types' + +export const RelationshipConverter: SlateNodeConverter = { + converter({ slateNode }) { + return { + format: '', + relationTo: slateNode.relationTo, + type: 'relationship', + value: { + id: slateNode?.value?.id || '', + }, + version: 1, + } as const as SerializedRelationshipNode + }, + nodeTypes: ['relationship'], +} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/unknown.ts b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/unknown.ts new file mode 100644 index 00000000000..05fa300eebe --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/unknown.ts @@ -0,0 +1,27 @@ +import type { SerializedUnknownConvertedNode } from '../../nodes/unknownConvertedNode' +import type { SlateNodeConverter } from '../types' + +import { convertSlateNodesToLexical } from '..' + +export const UnknownConverter: SlateNodeConverter = { + converter({ converters, slateNode }) { + return { + children: convertSlateNodesToLexical({ + canContainParagraphs: false, + converters, + parentNodeType: 'unknownConverted', + slateNodes: slateNode.children || [], + }), + data: { + nodeData: slateNode, + nodeType: slateNode.type, + }, + direction: 'ltr', + format: '', + indent: 0, + type: 'unknownConverted', + version: 1, + } as const as SerializedUnknownConvertedNode + }, + nodeTypes: ['unknown'], +} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/unorderedList.ts b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/unorderedList.ts new file mode 100644 index 00000000000..fd82b3a7e23 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/unorderedList.ts @@ -0,0 +1,27 @@ +import type { SerializedListNode } from '@lexical/list' + +import type { SlateNodeConverter } from '../types' + +import { convertSlateNodesToLexical } from '..' + +export const UnorderedListConverter: SlateNodeConverter = { + converter({ converters, slateNode }) { + return { + children: convertSlateNodesToLexical({ + canContainParagraphs: false, + converters, + parentNodeType: 'list', + slateNodes: slateNode.children || [], + }), + direction: 'ltr', + format: '', + indent: 0, + listType: 'bullet', + start: 1, + tag: 'ul', + type: 'list', + version: 1, + } as const as SerializedListNode + }, + nodeTypes: ['ul'], +} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/upload.ts b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/upload.ts new file mode 100644 index 00000000000..a3b59d6a5c5 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/converters/upload.ts @@ -0,0 +1,20 @@ +import type { SerializedUploadNode } from '../../../../../..' +import type { SlateNodeConverter } from '../types' + +export const UploadConverter: SlateNodeConverter = { + converter({ slateNode }) { + return { + fields: { + ...slateNode.fields, + }, + format: '', + relationTo: slateNode.relationTo, + type: 'upload', + value: { + id: slateNode.value?.id || '', + }, + version: 1, + } as const as SerializedUploadNode + }, + nodeTypes: ['upload'], +} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/defaultConverters.ts b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/defaultConverters.ts new file mode 100644 index 00000000000..d0f5ff75b0b --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/defaultConverters.ts @@ -0,0 +1,23 @@ +import type { SlateNodeConverter } from './types' + +import { HeadingConverter } from './converters/heading' +import { IndentConverter } from './converters/indent' +import { LinkConverter } from './converters/link' +import { ListItemConverter } from './converters/listItem' +import { OrderedListConverter } from './converters/orderedList' +import { RelationshipConverter } from './converters/relationship' +import { UnknownConverter } from './converters/unknown' +import { UnorderedListConverter } from './converters/unorderedList' +import { UploadConverter } from './converters/upload' + +export const defaultConverters: SlateNodeConverter[] = [ + UnknownConverter, + UploadConverter, + UnorderedListConverter, + OrderedListConverter, + RelationshipConverter, + ListItemConverter, + LinkConverter, + HeadingConverter, + IndentConverter, +] diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/index.ts b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/index.ts new file mode 100644 index 00000000000..bf52b2ee466 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/index.ts @@ -0,0 +1,137 @@ +import type { + SerializedEditorState, + SerializedLexicalNode, + SerializedParagraphNode, + SerializedTextNode, +} from 'lexical' + +import type { SlateNode, SlateNodeConverter } from './types' + +import { NodeFormat } from '../../../../lexical/utils/nodeFormat' + +export function convertSlateToLexical({ + converters, + slateData, +}: { + converters: SlateNodeConverter[] + slateData: SlateNode[] +}): SerializedEditorState { + return { + root: { + children: convertSlateNodesToLexical({ + canContainParagraphs: true, + converters, + parentNodeType: 'root', + slateNodes: slateData, + }), + direction: 'ltr', + format: '', + indent: 0, + type: 'root', + version: 1, + }, + } +} + +export function convertSlateNodesToLexical({ + canContainParagraphs, + converters, + parentNodeType, + slateNodes, +}: { + canContainParagraphs: boolean + converters: SlateNodeConverter[] + /** + * Type of the parent lexical node (not the type of the original, parent slate type) + */ + parentNodeType: string + slateNodes: SlateNode[] +}): SerializedLexicalNode[] { + const unknownConverter = converters.find((converter) => converter.nodeTypes.includes('unknown')) + return ( + slateNodes.map((slateNode, i) => { + if (!('type' in slateNode)) { + if (canContainParagraphs) { + // This is a paragraph node. They do not have a type property in Slate + return convertParagraphNode(converters, slateNode) + } else { + // This is a simple text node. canContainParagraphs may be false if this is nested inside of a paragraph already, since paragraphs cannot contain paragraphs + return convertTextNode(slateNode) + } + } + if (slateNode.type === 'p') { + return convertParagraphNode(converters, slateNode) + } + + const converter = converters.find((converter) => converter.nodeTypes.includes(slateNode.type)) + + if (converter) { + return converter.converter({ childIndex: i, converters, parentNodeType, slateNode }) + } + + console.warn('slateToLexical > No converter found for node type: ' + slateNode.type) + return unknownConverter?.converter({ + childIndex: i, + converters, + parentNodeType, + slateNode, + }) + }) || [] + ) +} + +export function convertParagraphNode( + converters: SlateNodeConverter[], + node: SlateNode, +): SerializedParagraphNode { + return { + children: convertSlateNodesToLexical({ + canContainParagraphs: false, + converters, + parentNodeType: 'paragraph', + slateNodes: node.children || [], + }), + direction: 'ltr', + format: '', + indent: 0, + type: 'paragraph', + version: 1, + } +} +export function convertTextNode(node: SlateNode): SerializedTextNode { + return { + detail: 0, + format: convertNodeToFormat(node), + mode: 'normal', + style: '', + text: node.text, + type: 'text', + version: 1, + } +} + +export function convertNodeToFormat(node: SlateNode): number { + let format = 0 + if (node.bold) { + format = format | NodeFormat.IS_BOLD + } + if (node.italic) { + format = format | NodeFormat.IS_ITALIC + } + if (node.strikethrough) { + format = format | NodeFormat.IS_STRIKETHROUGH + } + if (node.underline) { + format = format | NodeFormat.IS_UNDERLINE + } + if (node.subscript) { + format = format | NodeFormat.IS_SUBSCRIPT + } + if (node.superscript) { + format = format | NodeFormat.IS_SUPERSCRIPT + } + if (node.code) { + format = format | NodeFormat.IS_CODE + } + return format +} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/types.ts b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/types.ts new file mode 100644 index 00000000000..3710efe87a0 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/converter/types.ts @@ -0,0 +1,22 @@ +import type { SerializedLexicalNode } from 'lexical' + +export type SlateNodeConverter<T extends SerializedLexicalNode = SerializedLexicalNode> = { + converter: ({ + childIndex, + converters, + parentNodeType, + slateNode, + }: { + childIndex: number + converters: SlateNodeConverter[] + parentNodeType: string + slateNode: SlateNode + }) => T + nodeTypes: string[] +} + +export type SlateNode = { + [key: string]: any + children?: SlateNode[] + type?: string // doesn't always have type, e.g. for paragraphs +} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/index.ts b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/index.ts new file mode 100644 index 00000000000..6dc9ff010de --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/index.ts @@ -0,0 +1,56 @@ +import type { FeatureProvider } from '../../types' +import type { SlateNodeConverter } from './converter/types' + +import { convertSlateToLexical } from './converter' +import { defaultConverters } from './converter/defaultConverters' +import { UnknownConvertedNode } from './nodes/unknownConvertedNode' + +type Props = { + converters?: + | (({ defaultConverters }: { defaultConverters: SlateNodeConverter[] }) => SlateNodeConverter[]) + | SlateNodeConverter[] +} + +export const SlateToLexicalFeature = (props?: Props): FeatureProvider => { + if (!props) { + props = {} + } + + props.converters = + props?.converters && typeof props?.converters === 'function' + ? props.converters({ defaultConverters: defaultConverters }) + : (props?.converters as SlateNodeConverter[]) || defaultConverters + + return { + feature: ({ resolvedFeatures, unsanitizedEditorConfig }) => { + return { + hooks: { + load({ incomingEditorState }) { + if ( + !incomingEditorState || + !Array.isArray(incomingEditorState) || + 'root' in incomingEditorState + ) { + // incomingEditorState null or not from Slate + return incomingEditorState + } + // Slate => convert to lexical + + return convertSlateToLexical({ + converters: props.converters as SlateNodeConverter[], + slateData: incomingEditorState, + }) + }, + }, + nodes: [ + { + node: UnknownConvertedNode, + type: UnknownConvertedNode.getType(), + }, + ], + props, + } + }, + key: 'slateToLexical', + } +} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/nodes/unknownConvertedNode/index.scss b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/nodes/unknownConvertedNode/index.scss new file mode 100644 index 00000000000..7eedad7329b --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/nodes/unknownConvertedNode/index.scss @@ -0,0 +1,16 @@ +@import 'payload/scss'; + +span.unknownConverted { + text-transform: uppercase; + font-family: 'Roboto Mono', monospace; + letter-spacing: 2px; + font-size: base(0.5); + margin: 0 0 base(1); + background: red; + color: white; + display: inline-block; + + div { + background: red; + } +} diff --git a/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/nodes/unknownConvertedNode/index.tsx b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/nodes/unknownConvertedNode/index.tsx new file mode 100644 index 00000000000..dffbc0cae3e --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/SlateToLexical/nodes/unknownConvertedNode/index.tsx @@ -0,0 +1,97 @@ +import type { SerializedLexicalNode, Spread } from 'lexical' + +import { addClassNamesToElement } from '@lexical/utils' +import { DecoratorNode, type EditorConfig, type LexicalNode, type NodeKey } from 'lexical' +import React from 'react' + +import './index.scss' + +export type UnknownConvertedNodeData = { + nodeData: unknown + nodeType: string +} + +export type SerializedUnknownConvertedNode = Spread< + { + data: UnknownConvertedNodeData + }, + SerializedLexicalNode +> + +/** @noInheritDoc */ +export class UnknownConvertedNode extends DecoratorNode<JSX.Element> { + __data: UnknownConvertedNodeData + + constructor({ data, key }: { data: UnknownConvertedNodeData; key?: NodeKey }) { + super(key) + this.__data = data + } + + static clone(node: UnknownConvertedNode): UnknownConvertedNode { + return new UnknownConvertedNode({ + data: node.__data, + key: node.__key, + }) + } + + static getType(): string { + return 'unknownConverted' + } + + static importJSON(serializedNode: SerializedUnknownConvertedNode): UnknownConvertedNode { + const node = $createUnknownConvertedNode({ data: serializedNode.data }) + return node + } + + canInsertTextAfter(): true { + return true + } + + canInsertTextBefore(): true { + return true + } + + createDOM(config: EditorConfig): HTMLElement { + const element = document.createElement('span') + addClassNamesToElement(element, 'unknownConverted') + return element + } + + decorate(): JSX.Element | null { + return <div>Unknown converted Slate node: {this.__data?.nodeType}</div> + } + + exportJSON(): SerializedUnknownConvertedNode { + return { + data: this.__data, + type: this.getType(), + version: 1, + } + } + + // Mutation + + isInline(): boolean { + return true + } + + updateDOM(prevNode: UnknownConvertedNode, dom: HTMLElement): boolean { + return false + } +} + +export function $createUnknownConvertedNode({ + data, +}: { + data: UnknownConvertedNodeData +}): UnknownConvertedNode { + return new UnknownConvertedNode({ + data, + }) +} + +export function $isUnknownConvertedNode( + node: LexicalNode | null | undefined, +): node is UnknownConvertedNode { + return node instanceof UnknownConvertedNode +} diff --git a/packages/richtext-lexical/src/field/features/types.ts b/packages/richtext-lexical/src/field/features/types.ts index e711e18eaaf..0277bc6fe05 100644 --- a/packages/richtext-lexical/src/field/features/types.ts +++ b/packages/richtext-lexical/src/field/features/types.ts @@ -51,6 +51,18 @@ export type Feature = { floatingSelectToolbar?: { sections: FloatingToolbarSection[] } + hooks?: { + load?: ({ + incomingEditorState, + }: { + incomingEditorState: SerializedEditorState + }) => SerializedEditorState + save?: ({ + incomingEditorState, + }: { + incomingEditorState: SerializedEditorState + }) => SerializedEditorState + } markdownTransformers?: Transformer[] nodes?: Array<{ afterReadPromises?: Array<AfterReadPromise> @@ -123,6 +135,22 @@ export type SanitizedFeatures = Required< floatingSelectToolbar: { sections: FloatingToolbarSection[] } + hooks: { + load: Array< + ({ + incomingEditorState, + }: { + incomingEditorState: SerializedEditorState + }) => SerializedEditorState + > + save: Array< + ({ + incomingEditorState, + }: { + incomingEditorState: SerializedEditorState + }) => SerializedEditorState + > + } plugins?: Array< | { // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more "outside" functionality diff --git a/packages/richtext-lexical/src/field/lexical/LexicalProvider.tsx b/packages/richtext-lexical/src/field/lexical/LexicalProvider.tsx index 5d7ec3f19c4..9eb10a7a39e 100644 --- a/packages/richtext-lexical/src/field/lexical/LexicalProvider.tsx +++ b/packages/richtext-lexical/src/field/lexical/LexicalProvider.tsx @@ -21,7 +21,16 @@ export type LexicalProviderProps = { value: SerializedEditorState } export const LexicalProvider: React.FC<LexicalProviderProps> = (props) => { - const { editorConfig, fieldProps, initialState, onChange, readOnly, setValue, value } = props + const { editorConfig, fieldProps, onChange, readOnly, setValue } = props + let { initialState, value } = props + + // Transform initialState through load hooks + if (editorConfig?.features?.hooks?.load?.length) { + editorConfig.features.hooks.load.forEach((hook) => { + initialState = hook({ incomingEditorState: initialState }) + value = hook({ incomingEditorState: value }) + }) + } if ( (value && Array.isArray(value) && !('root' in value)) || diff --git a/packages/richtext-lexical/src/field/lexical/config/sanitize.ts b/packages/richtext-lexical/src/field/lexical/config/sanitize.ts index cf39b20c436..ad793c0a006 100644 --- a/packages/richtext-lexical/src/field/lexical/config/sanitize.ts +++ b/packages/richtext-lexical/src/field/lexical/config/sanitize.ts @@ -10,6 +10,10 @@ export const sanitizeFeatures = (features: ResolvedFeatureMap): SanitizedFeature floatingSelectToolbar: { sections: [], }, + hooks: { + load: [], + save: [], + }, markdownTransformers: [], nodes: [], plugins: [], @@ -21,6 +25,15 @@ export const sanitizeFeatures = (features: ResolvedFeatureMap): SanitizedFeature } features.forEach((feature) => { + if (feature.hooks) { + if (feature.hooks?.load?.length) { + sanitized.hooks.load = sanitized.hooks.load.concat(feature.hooks.load) + } + if (feature.hooks?.save?.length) { + sanitized.hooks.save = sanitized.hooks.save.concat(feature.hooks.save) + } + } + if (feature.nodes?.length) { sanitized.nodes = sanitized.nodes.concat(feature.nodes) feature.nodes.forEach((node) => { diff --git a/packages/richtext-lexical/src/field/lexical/utils/nodeFormat.ts b/packages/richtext-lexical/src/field/lexical/utils/nodeFormat.ts new file mode 100644 index 00000000000..5cb26c167c0 --- /dev/null +++ b/packages/richtext-lexical/src/field/lexical/utils/nodeFormat.ts @@ -0,0 +1,124 @@ +/* eslint-disable perfectionist/sort-objects */ +/* eslint-disable regexp/no-obscure-range */ +/* eslint-disable @typescript-eslint/no-redundant-type-constituents */ +//This copy-and-pasted from lexical here here: https://github.com/facebook/lexical/blob/c2ceee223f46543d12c574e62155e619f9a18a5d/packages/lexical/src/LexicalConstants.ts + +import type { ElementFormatType, TextFormatType } from 'lexical' +import type { TextDetailType, TextModeType } from 'lexical/nodes/LexicalTextNode' + +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + +// DOM +export const NodeFormat = { + DOM_ELEMENT_TYPE: 1, + DOM_TEXT_TYPE: 3, + // Reconciling + NO_DIRTY_NODES: 0, + HAS_DIRTY_NODES: 1, + FULL_RECONCILE: 2, + // Text node modes + IS_NORMAL: 0, + IS_TOKEN: 1, + IS_SEGMENTED: 2, + IS_INERT: 3, + // Text node formatting + IS_BOLD: 1, + IS_ITALIC: 1 << 1, + IS_STRIKETHROUGH: 1 << 2, + IS_UNDERLINE: 1 << 3, + IS_CODE: 1 << 4, + IS_SUBSCRIPT: 1 << 5, + IS_SUPERSCRIPT: 1 << 6, + IS_HIGHLIGHT: 1 << 7, + // Text node details + IS_DIRECTIONLESS: 1, + IS_UNMERGEABLE: 1 << 1, + // Element node formatting + IS_ALIGN_LEFT: 1, + IS_ALIGN_CENTER: 2, + IS_ALIGN_RIGHT: 3, + IS_ALIGN_JUSTIFY: 4, + IS_ALIGN_START: 5, + IS_ALIGN_END: 6, +} as const + +export const IS_ALL_FORMATTING = + NodeFormat.IS_BOLD | + NodeFormat.IS_ITALIC | + NodeFormat.IS_STRIKETHROUGH | + NodeFormat.IS_UNDERLINE | + NodeFormat.IS_CODE | + NodeFormat.IS_SUBSCRIPT | + NodeFormat.IS_SUPERSCRIPT | + NodeFormat.IS_HIGHLIGHT + +// Reconciliation +export const NON_BREAKING_SPACE = '\u00A0' + +export const DOUBLE_LINE_BREAK = '\n\n' + +// For FF, we need to use a non-breaking space, or it gets composition +// in a stuck state. + +const RTL = '\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC' +const LTR = + 'A-Za-z\u00C0-\u00D6\u00D8-\u00F6' + + '\u00F8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C' + + '\uFE00-\uFE6F\uFEFD-\uFFFF' + +// eslint-disable-next-line no-misleading-character-class +export const RTL_REGEX = new RegExp('^[^' + LTR + ']*[' + RTL + ']') +// eslint-disable-next-line no-misleading-character-class +export const LTR_REGEX = new RegExp('^[^' + RTL + ']*[' + LTR + ']') + +export const TEXT_TYPE_TO_FORMAT: Record<TextFormatType | string, number> = { + bold: NodeFormat.IS_BOLD, + code: NodeFormat.IS_CODE, + highlight: NodeFormat.IS_HIGHLIGHT, + italic: NodeFormat.IS_ITALIC, + strikethrough: NodeFormat.IS_STRIKETHROUGH, + subscript: NodeFormat.IS_SUBSCRIPT, + superscript: NodeFormat.IS_SUPERSCRIPT, + underline: NodeFormat.IS_UNDERLINE, +} + +export const DETAIL_TYPE_TO_DETAIL: Record<TextDetailType | string, number> = { + directionless: NodeFormat.IS_DIRECTIONLESS, + unmergeable: NodeFormat.IS_UNMERGEABLE, +} + +export const ELEMENT_TYPE_TO_FORMAT: Record<Exclude<ElementFormatType, ''>, number> = { + center: NodeFormat.IS_ALIGN_CENTER, + end: NodeFormat.IS_ALIGN_END, + justify: NodeFormat.IS_ALIGN_JUSTIFY, + left: NodeFormat.IS_ALIGN_LEFT, + right: NodeFormat.IS_ALIGN_RIGHT, + start: NodeFormat.IS_ALIGN_START, +} + +export const ELEMENT_FORMAT_TO_TYPE: Record<number, ElementFormatType> = { + [NodeFormat.IS_ALIGN_CENTER]: 'center', + [NodeFormat.IS_ALIGN_END]: 'end', + [NodeFormat.IS_ALIGN_JUSTIFY]: 'justify', + [NodeFormat.IS_ALIGN_LEFT]: 'left', + [NodeFormat.IS_ALIGN_RIGHT]: 'right', + [NodeFormat.IS_ALIGN_START]: 'start', +} + +export const TEXT_MODE_TO_TYPE: Record<TextModeType, 0 | 1 | 2> = { + normal: NodeFormat.IS_NORMAL, + segmented: NodeFormat.IS_SEGMENTED, + token: NodeFormat.IS_TOKEN, +} + +export const TEXT_TYPE_TO_MODE: Record<number, TextModeType> = { + [NodeFormat.IS_NORMAL]: 'normal', + [NodeFormat.IS_SEGMENTED]: 'segmented', + [NodeFormat.IS_TOKEN]: 'token', +} diff --git a/packages/richtext-lexical/src/index.ts b/packages/richtext-lexical/src/index.ts index b6266462988..b74d97ae87b 100644 --- a/packages/richtext-lexical/src/index.ts +++ b/packages/richtext-lexical/src/index.ts @@ -153,6 +153,7 @@ export { IndentFeature } from './field/features/indent' export { CheckListFeature } from './field/features/lists/CheckList' export { OrderedListFeature } from './field/features/lists/OrderedList' export { UnoderedListFeature } from './field/features/lists/UnorderedList' +export { SlateToLexicalFeature } from './field/features/migrations/SlateToLexical' export type { AfterReadPromise, Feature, @@ -201,6 +202,20 @@ export { isHTMLElement } from './field/lexical/utils/guard' export { invariant } from './field/lexical/utils/invariant' export { joinClasses } from './field/lexical/utils/joinClasses' export { createBlockNode } from './field/lexical/utils/markdown/createBlockNode' +export { + DETAIL_TYPE_TO_DETAIL, + DOUBLE_LINE_BREAK, + ELEMENT_FORMAT_TO_TYPE, + ELEMENT_TYPE_TO_FORMAT, + IS_ALL_FORMATTING, + LTR_REGEX, + NON_BREAKING_SPACE, + NodeFormat, + RTL_REGEX, + TEXT_MODE_TO_TYPE, + TEXT_TYPE_TO_FORMAT, + TEXT_TYPE_TO_MODE, +} from './field/lexical/utils/nodeFormat' export { Point, isPoint } from './field/lexical/utils/point' export { Rect } from './field/lexical/utils/rect' export { setFloatingElemPosition } from './field/lexical/utils/setFloatingElemPosition' diff --git a/test/fields/collections/Lexical/index.ts b/test/fields/collections/Lexical/index.ts index 5fadb7f9c48..914442b0faf 100644 --- a/test/fields/collections/Lexical/index.ts +++ b/test/fields/collections/Lexical/index.ts @@ -21,6 +21,7 @@ export const LexicalFields: CollectionConfig = { slug: 'lexical-fields', admin: { useAsTitle: 'title', + listSearchableFields: ['title', 'richTextLexicalCustomFields'], }, access: { read: () => true,
9f37bf7397393be45ab66c50ce1962c820ca8b5e
2024-05-06 23:23:34
Elliot DeNolf
ci(scripts): improve footer parsing trailing quote
false
improve footer parsing trailing quote
ci
diff --git a/scripts/utils/updateChangelog.ts b/scripts/utils/updateChangelog.ts index 4ad2d20322f..c887cc57924 100755 --- a/scripts/utils/updateChangelog.ts +++ b/scripts/utils/updateChangelog.ts @@ -195,11 +195,17 @@ function formatCommitForChangelog(commit: GitCommit, includeBreakingNotes = fals if (isBreaking && includeBreakingNotes) { // Parse breaking change notes from commit body const [rawNotes, _] = commit.body.split('\n\n') - const notes = rawNotes + let notes = rawNotes .split('\n') .map((l) => `> ${l}`) .join('\n') .trim() + + // Remove random trailing quotes that sometimes appear + if (notes.endsWith('"')) { + notes = notes.slice(0, -1) + } + formatted += `\n\n${notes}\n\n` }
eb69885a890ab06de4610d8a8f4fcce51152debc
2024-12-31 01:33:29
Anders Semb Hermansen
fix: close db connections after running jobs from command line. (#9994)
false
close db connections after running jobs from command line. (#9994)
fix
diff --git a/packages/payload/src/bin/index.ts b/packages/payload/src/bin/index.ts index 2d7d9363d49..637c8142958 100755 --- a/packages/payload/src/bin/index.ts +++ b/packages/payload/src/bin/index.ts @@ -102,10 +102,14 @@ export const bin = async () => { return } else { - return await payload.jobs.run({ + await payload.jobs.run({ limit, queue, }) + + await payload.db.destroy() // close database connections after running jobs so process can exit cleanly + + return } }
8b186dbf83d1d2429a0f7a2a7ef9c69c41280349
2023-06-23 21:02:02
DireWolf707
docs: add default value for GCS_CREDENTIALS (#48)
false
add default value for GCS_CREDENTIALS (#48)
docs
diff --git a/README.md b/README.md index 55906d8d6ed..1c0df7a1cf0 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ const adapter = gcsAdapter({ // you can choose any method for authentication, and authorization which is being provided by `@google-cloud/storage` keyFilename: './gcs-credentials.json', //OR - credentials: JSON.parse(process.env.GCS_CREDENTIALS) // this env variable will have stringify version of your credentials.json file + credentials: JSON.parse(process.env.GCS_CREDENTIALS || "{}") // this env variable will have stringify version of your credentials.json file }, bucket: process.env.GCS_BUCKET, })
95c43a2ab4ab12b16ea6dfa5ffaa4d61bd3ec3e1
2023-11-07 22:35:51
Elliot DeNolf
chore: sync payload package readme
false
sync payload package readme
chore
diff --git a/packages/payload/README.md b/packages/payload/README.md index 651ee49cdaf..edba3a7c761 100644 --- a/packages/payload/README.md +++ b/packages/payload/README.md @@ -26,9 +26,8 @@ </h4> <hr/> -<h3> - 🎉 Payload 2.0 is now available! Read more in the <a target="_blank" href="https://payloadcms.com/blog/payload-2-0" rel="dofollow"><strong>announcement post</strong></a> -</h3> +> [!IMPORTANT] +> 🎉 <strong>Payload 2.0 is now available!</strong> Read more in the <a target="_blank" href="https://payloadcms.com/blog/payload-2-0" rel="dofollow"><strong>announcement post</strong></a>. <h3>Benefits over a regular CMS</h3> <ul>
6c0f99082b94ea36e88d80dc2f3d546c11094373
2024-08-13 23:02:46
Alessio Gravili
chore: install tsx in monorepo (#7656)
false
install tsx in monorepo (#7656)
chore
diff --git a/package.json b/package.json index 60176d8b379..6ab49656527 100644 --- a/package.json +++ b/package.json @@ -152,6 +152,7 @@ "sort-package-json": "^2.10.0", "swc-plugin-transform-remove-imports": "1.15.0", "tempy": "1.0.1", + "tsx": "4.17.0", "turbo": "^1.13.3", "typescript": "5.5.4" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6790b3f031b..e13df5a2ab8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -186,6 +186,9 @@ importers: tempy: specifier: 1.0.1 version: 1.0.1 + tsx: + specifier: 4.17.0 + version: 4.17.0 turbo: specifier: ^1.13.3 version: 1.13.4 @@ -10522,7 +10525,6 @@ packages: resolution: {integrity: sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==} dependencies: resolve-pkg-maps: 1.0.0 - dev: false /[email protected]: resolution: {integrity: sha512-8EHPljDvs7qKykr6uw8b+lqLiUc/vUg+KVTI0uND4s63TdsZM2Xus3mflvF0DDG9SiM4RlCkFGL+7aAjRmV7KA==} @@ -14106,7 +14108,6 @@ packages: /[email protected]: resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} - dev: false /[email protected]: resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} @@ -15471,6 +15472,17 @@ packages: /[email protected]: resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==} + /[email protected]: + resolution: {integrity: sha512-eN4mnDA5UMKDt4YZixo9tBioibaMBpoxBkD+rIPAjVmYERSG0/dWEY1CEFuV89CgASlKL499q8AhmkMnnjtOJg==} + engines: {node: '>=18.0.0'} + hasBin: true + dependencies: + esbuild: 0.23.0 + get-tsconfig: 4.7.5 + optionalDependencies: + fsevents: 2.3.3 + dev: true + /[email protected]: resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==} dependencies:
e64660f2d8a93e05dccb0eaa8c54153e7d17ec9a
2024-04-05 20:07:58
Paul
fix(db-postgres): querying by localised relations postgres (#5686)
false
querying by localised relations postgres (#5686)
fix
diff --git a/packages/db-postgres/src/queries/getTableColumnFromPath.ts b/packages/db-postgres/src/queries/getTableColumnFromPath.ts index ac86d6b3469..08e083f81b2 100644 --- a/packages/db-postgres/src/queries/getTableColumnFromPath.ts +++ b/packages/db-postgres/src/queries/getTableColumnFromPath.ts @@ -360,13 +360,32 @@ export const getTableColumnFromPath = ({ ) // Join in the relationships table - joinAliases.push({ - condition: and( - eq((aliasTable || adapter.tables[rootTableName]).id, aliasRelationshipTable.parent), - like(aliasRelationshipTable.path, `${constraintPath}${field.name}`), - ), - table: aliasRelationshipTable, - }) + if (locale && field.localized && adapter.payload.config.localization) { + joinAliases.push({ + condition: and( + eq((aliasTable || adapter.tables[rootTableName]).id, aliasRelationshipTable.parent), + eq(aliasRelationshipTable.locale, locale), + like(aliasRelationshipTable.path, `${constraintPath}${field.name}`), + ), + table: aliasRelationshipTable, + }) + if (locale !== 'all') { + constraints.push({ + columnName: 'locale', + table: aliasRelationshipTable, + value: locale, + }) + } + } else { + // Join in the relationships table + joinAliases.push({ + condition: and( + eq((aliasTable || adapter.tables[rootTableName]).id, aliasRelationshipTable.parent), + like(aliasRelationshipTable.path, `${constraintPath}${field.name}`), + ), + table: aliasRelationshipTable, + }) + } selectFields[`${relationTableName}.path`] = aliasRelationshipTable.path diff --git a/test/relationships/config.ts b/test/relationships/config.ts index 6b5cf083a43..81a312a69ac 100644 --- a/test/relationships/config.ts +++ b/test/relationships/config.ts @@ -10,6 +10,7 @@ import { polymorphicRelationshipsSlug, relationSlug, slug, + slugWithLocalizedRel, treeSlug, } from './shared.js' @@ -47,6 +48,10 @@ const collectionWithName = (collectionSlug: string): CollectionConfig => { } export default buildConfigWithDefaults({ + localization: { + locales: ['en', 'de'], + defaultLocale: 'en', + }, collections: [ { slug, @@ -109,6 +114,23 @@ export default buildConfigWithDefaults({ }, ], }, + { + slug: slugWithLocalizedRel, + access: openAccess, + fields: [ + { + name: 'title', + type: 'text', + }, + // Relationship + { + name: 'relationField', + type: 'relationship', + relationTo: relationSlug, + localized: true, + }, + ], + }, collectionWithName(relationSlug), { ...collectionWithName(defaultAccessRelSlug), diff --git a/test/relationships/int.spec.ts b/test/relationships/int.spec.ts index a6a65aa7176..571b5d3fab0 100644 --- a/test/relationships/int.spec.ts +++ b/test/relationships/int.spec.ts @@ -10,6 +10,7 @@ import type { CustomIdRelation, Director, Post, + PostsLocalized, Relation, } from './payload-types.js' @@ -23,6 +24,7 @@ import { polymorphicRelationshipsSlug, relationSlug, slug, + slugWithLocalizedRel, treeSlug, usersSlug, } from './shared.js' @@ -517,6 +519,85 @@ describe('Relationships', () => { expect(doc?.relationField).toMatchObject({ id: relation.id, name: relation.name }) }) }) + + describe('with localization', () => { + let relation1: Relation + let relation2: Relation + let localizedPost1: PostsLocalized + let localizedPost2: PostsLocalized + + beforeAll(async () => { + relation1 = await payload.create<Relation>({ + collection: relationSlug, + data: { + name: 'english', + }, + }) + + relation2 = await payload.create<Relation>({ + collection: relationSlug, + data: { + name: 'german', + }, + }) + + localizedPost1 = await payload.create<'postsLocalized'>({ + collection: slugWithLocalizedRel, + data: { + title: 'english', + relationField: relation1.id, + }, + locale: 'en', + }) + + await payload.update({ + id: localizedPost1.id, + collection: slugWithLocalizedRel, + locale: 'de', + data: { + relationField: relation2.id, + }, + }) + + localizedPost2 = await payload.create({ + collection: slugWithLocalizedRel, + data: { + title: 'german', + relationField: relation2.id, + }, + locale: 'de', + }) + }) + it('should find two docs for german locale', async () => { + const { docs } = await payload.find<PostsLocalized>({ + collection: slugWithLocalizedRel, + locale: 'de', + where: { + relationField: { + equals: relation2.id, + }, + }, + }) + + const mappedIds = docs.map((doc) => doc?.id) + expect(mappedIds).toContain(localizedPost1.id) + expect(mappedIds).toContain(localizedPost2.id) + }) + + it("shouldn't find a relationship query outside of the specified locale", async () => { + const { docs } = await payload.find<PostsLocalized>({ + collection: slugWithLocalizedRel, + locale: 'en', + where: { + relationField: { + equals: relation2.id, + }, + }, + }) + + expect(docs.map((doc) => doc?.id)).not.toContain(localizedPost2.id) + }) + }) }) describe('Nested Querying', () => { diff --git a/test/relationships/payload-types.ts b/test/relationships/payload-types.ts index 5be831cc306..ab6fabea895 100644 --- a/test/relationships/payload-types.ts +++ b/test/relationships/payload-types.ts @@ -8,6 +8,7 @@ export interface Config { collections: { posts: Post + postsLocalized: PostsLocalized relation: Relation 'strict-access': StrictAccess 'chained-relation': ChainedRelation @@ -35,6 +36,13 @@ export interface Post { updatedAt: string createdAt: string } +export interface PostsLocalized { + id: string + title?: string | null + relationField?: (string | null) | Relation + updatedAt: string + createdAt: string +} export interface Relation { id: string name?: string diff --git a/test/relationships/shared.ts b/test/relationships/shared.ts index e29e44f4503..037e2fd8134 100644 --- a/test/relationships/shared.ts +++ b/test/relationships/shared.ts @@ -1,5 +1,6 @@ export const usersSlug = 'users' export const slug = 'posts' +export const slugWithLocalizedRel = 'postsLocalized' export const relationSlug = 'relation' export const defaultAccessRelSlug = 'strict-access' export const chainedRelSlug = 'chained'
07f3f273cd2c2329d728036aa8aa8c704bd30188
2024-06-28 02:52:01
James Mikrut
feat: adds refresh hooks (#6965)
false
adds refresh hooks (#6965)
feat
diff --git a/docs/hooks/collections.mdx b/docs/hooks/collections.mdx index d94681aa9f2..b3e878c9b5a 100644 --- a/docs/hooks/collections.mdx +++ b/docs/hooks/collections.mdx @@ -26,6 +26,8 @@ Additionally, `auth`-enabled collections feature the following hooks: - [afterRefresh](#afterrefresh) - [afterMe](#afterme) - [afterForgotPassword](#afterforgotpassword) +- [refresh](#refresh) +- [me](#me) ## Config @@ -59,6 +61,8 @@ export const ExampleHooks: CollectionConfig = { afterRefresh: [(args) => {...}], afterMe: [(args) => {...}], afterForgotPassword: [(args) => {...}], + refresh: [(args) => {...}], + me: [(args) => {...}], }, } ``` @@ -299,6 +303,32 @@ const afterForgotPasswordHook: CollectionAfterForgotPasswordHook = async ({ }) => {...} ``` +### refresh + +For auth-enabled Collections, this hook allows you to optionally replace the default behavior of the `refresh` operation with your own. If you optionally return a value from your hook, the operation will not perform its own logic and continue. + +```ts +import type { CollectionRefreshHook } from 'payload' + +const myRefreshHook: CollectionRefreshHook = async ({ + args, // arguments passed into the `refresh` operation + user, // the user as queried from the database +}) => {...} +``` + +### me + +For auth-enabled Collections, this hook allows you to optionally replace the default behavior of the `me` operation with your own. If you optionally return a value from your hook, the operation will not perform its own logic and continue. + +```ts +import type { CollectionMeHook } from 'payload' + +const meHook: CollectionMeHook = async ({ + args, // arguments passed into the `me` operation + user, // the user as queried from the database +}) => {...} +``` + ## TypeScript Payload exports a type for each Collection hook which can be accessed as follows: @@ -319,5 +349,7 @@ import type { CollectionAfterRefreshHook, CollectionAfterMeHook, CollectionAfterForgotPasswordHook, + CollectionRefreshHook, + CollectionMeHook, } from 'payload' ``` diff --git a/packages/next/src/routes/rest/auth/refresh.ts b/packages/next/src/routes/rest/auth/refresh.ts index 5c826f55292..bc65e441d47 100644 --- a/packages/next/src/routes/rest/auth/refresh.ts +++ b/packages/next/src/routes/rest/auth/refresh.ts @@ -32,18 +32,20 @@ export const refresh: CollectionRouteHandler = async ({ collection, req }) => { token, }) - const cookie = generatePayloadCookie({ - collectionConfig: collection.config, - payload: req.payload, - token: result.refreshedToken, - }) - - if (collection.config.auth.removeTokenFromResponses) { - delete result.refreshedToken + if (result.setCookie) { + const cookie = generatePayloadCookie({ + collectionConfig: collection.config, + payload: req.payload, + token: result.refreshedToken, + }) + + if (collection.config.auth.removeTokenFromResponses) { + delete result.refreshedToken + } + + headers.set('Set-Cookie', cookie) } - headers.set('Set-Cookie', cookie) - return Response.json( { message: t('authentication:tokenRefreshSuccessful'), diff --git a/packages/payload/src/auth/operations/me.ts b/packages/payload/src/auth/operations/me.ts index 4a0f6b96714..87602c8d14b 100644 --- a/packages/payload/src/auth/operations/me.ts +++ b/packages/payload/src/auth/operations/me.ts @@ -18,11 +18,9 @@ export type Arguments = { req: PayloadRequestWithData } -export const meOperation = async ({ - collection, - currentToken, - req, -}: Arguments): Promise<MeOperationResult> => { +export const meOperation = async (args: Arguments): Promise<MeOperationResult> => { + const { collection, currentToken, req } = args + let result: MeOperationResult = { user: null, } @@ -48,16 +46,32 @@ export const meOperation = async ({ delete user.collection - result = { - collection: req.user.collection, - strategy: req.user._strategy, - user, + // ///////////////////////////////////// + // me hook - Collection + // ///////////////////////////////////// + + for (const meHook of collection.config.hooks.me) { + const hookResult = await meHook({ args, user }) + + if (hookResult) { + result.user = hookResult.user + result.exp = hookResult.exp + + break + } } - if (currentToken) { - const decoded = jwt.decode(currentToken) as jwt.JwtPayload - if (decoded) result.exp = decoded.exp - result.token = currentToken + result.collection = req.user.collection + result.strategy = req.user._strategy + + if (!result.user) { + result.user = user + + if (currentToken) { + const decoded = jwt.decode(currentToken) as jwt.JwtPayload + if (decoded) result.exp = decoded.exp + if (!collection.config.auth.removeTokenFromResponses) result.token = currentToken + } } } diff --git a/packages/payload/src/auth/operations/refresh.ts b/packages/payload/src/auth/operations/refresh.ts index c025081a234..65a668f2e02 100644 --- a/packages/payload/src/auth/operations/refresh.ts +++ b/packages/payload/src/auth/operations/refresh.ts @@ -14,6 +14,7 @@ import { getFieldsToSign } from '../getFieldsToSign.js' export type Result = { exp: number refreshedToken: string + setCookie?: boolean strategy?: string user: Document } @@ -74,23 +75,41 @@ export const refreshOperation = async (incomingArgs: Arguments): Promise<Result> req: args.req, }) - const fieldsToSign = getFieldsToSign({ - collectionConfig, - email: user?.email as string, - user: args?.req?.user, - }) + let result: Result - const refreshedToken = jwt.sign(fieldsToSign, secret, { - expiresIn: collectionConfig.auth.tokenExpiration, - }) + // ///////////////////////////////////// + // refresh hook - Collection + // ///////////////////////////////////// + + for (const refreshHook of args.collection.config.hooks.refresh) { + const hookResult = await refreshHook({ args, user }) - const exp = (jwt.decode(refreshedToken) as Record<string, unknown>).exp as number + if (hookResult) { + result = hookResult + break + } + } - let result: Result = { - exp, - refreshedToken, - strategy: args.req.user._strategy, - user, + if (!result) { + const fieldsToSign = getFieldsToSign({ + collectionConfig, + email: user?.email as string, + user: args?.req?.user, + }) + + const refreshedToken = jwt.sign(fieldsToSign, secret, { + expiresIn: collectionConfig.auth.tokenExpiration, + }) + + const exp = (jwt.decode(refreshedToken) as Record<string, unknown>).exp as number + + result = { + exp, + refreshedToken, + setCookie: true, + strategy: args.req.user._strategy, + user, + } } // ///////////////////////////////////// @@ -104,9 +123,9 @@ export const refreshOperation = async (incomingArgs: Arguments): Promise<Result> (await hook({ collection: args.collection?.config, context: args.req.context, - exp, + exp: result.exp, req: args.req, - token: refreshedToken, + token: result.refreshedToken, })) || result }, Promise.resolve()) diff --git a/packages/payload/src/collections/config/defaults.ts b/packages/payload/src/collections/config/defaults.ts index 7ade122043f..6ed643a8092 100644 --- a/packages/payload/src/collections/config/defaults.ts +++ b/packages/payload/src/collections/config/defaults.ts @@ -39,6 +39,8 @@ export const defaults = { beforeOperation: [], beforeRead: [], beforeValidate: [], + me: [], + refresh: [], }, timestamps: true, upload: false, diff --git a/packages/payload/src/collections/config/schema.ts b/packages/payload/src/collections/config/schema.ts index 3826269abc5..961dce24cf3 100644 --- a/packages/payload/src/collections/config/schema.ts +++ b/packages/payload/src/collections/config/schema.ts @@ -141,6 +141,8 @@ const collectionSchema = joi.object().keys({ beforeOperation: joi.array().items(joi.func()), beforeRead: joi.array().items(joi.func()), beforeValidate: joi.array().items(joi.func()), + me: joi.array().items(joi.func()), + refresh: joi.array().items(joi.func()), }), labels: joi.object({ plural: joi diff --git a/packages/payload/src/collections/config/types.ts b/packages/payload/src/collections/config/types.ts index c9cf9ee5a1a..6de6f3564dd 100644 --- a/packages/payload/src/collections/config/types.ts +++ b/packages/payload/src/collections/config/types.ts @@ -8,6 +8,11 @@ import type { CustomSaveDraftButton, CustomUpload, } from '../../admin/types.js' +import type { Arguments as MeArguments } from '../../auth/operations/me.js' +import type { + Arguments as RefreshArguments, + Result as RefreshResult, +} from '../../auth/operations/refresh.js' import type { Auth, ClientUser, IncomingAuthType } from '../../auth/types.js' import type { Access, @@ -204,6 +209,16 @@ export type AfterMeHook<T extends TypeWithID = any> = (args: { response: unknown }) => any +export type RefreshHook<T extends TypeWithID = any> = (args: { + args: RefreshArguments + user: T +}) => Promise<RefreshResult | void> | (RefreshResult | void) + +export type MeHook<T extends TypeWithID = any> = (args: { + args: MeArguments + user: T +}) => ({ exp: number; user: T } | void) | Promise<{ exp: number; user: T } | void> + export type AfterRefreshHook<T extends TypeWithID = any> = (args: { /** The collection which this hook is being run on */ collection: SanitizedCollectionConfig @@ -398,6 +413,19 @@ export type CollectionConfig<TSlug extends CollectionSlug = any> = { beforeOperation?: BeforeOperationHook[] beforeRead?: BeforeReadHook[] beforeValidate?: BeforeValidateHook[] + /** + /** + * Use the `me` hook to control the `me` operation. + * Here, you can optionally instruct the me operation to return early, + * and skip its default logic. + */ + me?: MeHook[] + /** + * Use the `refresh` hook to control the refresh operation. + * Here, you can optionally instruct the refresh operation to return early, + * and skip its default logic. + */ + refresh?: RefreshHook[] } /** * Label configuration diff --git a/packages/payload/src/index.ts b/packages/payload/src/index.ts index 1ea7e3b1e9e..ded1281a6c6 100644 --- a/packages/payload/src/index.ts +++ b/packages/payload/src/index.ts @@ -674,6 +674,8 @@ export type { Collection, CollectionConfig, DataFromCollectionSlug, + MeHook as CollectionMeHook, + RefreshHook as CollectionRefreshHook, RequiredDataFromCollection, RequiredDataFromCollectionSlug, SanitizedCollectionConfig, diff --git a/test/hooks/collections/Users/index.ts b/test/hooks/collections/Users/index.ts index 9b1a22e9e6f..b39439ac772 100644 --- a/test/hooks/collections/Users/index.ts +++ b/test/hooks/collections/Users/index.ts @@ -4,6 +4,8 @@ import { AuthenticationError } from 'payload' import { devUser, regularUser } from '../../../credentials.js' import { afterLoginHook } from './afterLoginHook.js' +import { meHook } from './meHook.js' +import { refreshHook } from './refreshHook.js' const beforeLoginHook: BeforeLoginHook = ({ req, user }) => { const isAdmin = user.roles.includes('admin') ? user : undefined @@ -45,6 +47,8 @@ const Users: CollectionConfig = { }, ], hooks: { + me: [meHook], + refresh: [refreshHook], afterLogin: [afterLoginHook], beforeLogin: [beforeLoginHook], }, diff --git a/test/hooks/collections/Users/meHook.ts b/test/hooks/collections/Users/meHook.ts new file mode 100644 index 00000000000..ef59c2efce2 --- /dev/null +++ b/test/hooks/collections/Users/meHook.ts @@ -0,0 +1,10 @@ +import type { MeHook } from 'node_modules/payload/src/collections/config/types.js' + +export const meHook: MeHook = ({ user }) => { + if (user.email === '[email protected]') { + return { + exp: 10000, + user, + } + } +} diff --git a/test/hooks/collections/Users/refreshHook.ts b/test/hooks/collections/Users/refreshHook.ts new file mode 100644 index 00000000000..0bb2a9bc99d --- /dev/null +++ b/test/hooks/collections/Users/refreshHook.ts @@ -0,0 +1,12 @@ +import type { RefreshHook } from 'node_modules/payload/src/collections/config/types.js' + +export const refreshHook: RefreshHook = ({ user }) => { + if (user.email === '[email protected]') { + return { + exp: 1, + refreshedToken: 'fake', + strategy: 'local-jwt', + user, + } + } +} diff --git a/test/hooks/int.spec.ts b/test/hooks/int.spec.ts index d4443c45624..e365fd9b4f5 100644 --- a/test/hooks/int.spec.ts +++ b/test/hooks/int.spec.ts @@ -326,6 +326,32 @@ describe('Hooks', () => { }) describe('auth collection hooks', () => { + let hookUser + let hookUserToken + + beforeAll(async () => { + const email = '[email protected]' + + hookUser = await payload.create({ + collection: hooksUsersSlug, + data: { + email, + password: devUser.password, + roles: ['admin'], + }, + }) + + const { token } = await payload.login({ + collection: hooksUsersSlug, + data: { + email: hookUser.email, + password: devUser.password, + }, + }) + + hookUserToken = token + }) + it('should call afterLogin hook', async () => { const { user } = await payload.login({ collection: hooksUsersSlug, @@ -353,6 +379,31 @@ describe('Hooks', () => { }), ).rejects.toThrow(AuthenticationError) }) + + it('should respect refresh hooks', async () => { + const response = await restClient.POST(`/${hooksUsersSlug}/refresh-token`, { + headers: { + Authorization: `JWT ${hookUserToken}`, + }, + }) + + const data = await response.json() + + expect(data.exp).toStrictEqual(1) + expect(data.refreshedToken).toStrictEqual('fake') + }) + + it('should respect me hooks', async () => { + const response = await restClient.GET(`/${hooksUsersSlug}/me`, { + headers: { + Authorization: `JWT ${hookUserToken}`, + }, + }) + + const data = await response.json() + + expect(data.exp).toStrictEqual(10000) + }) }) describe('hook parameter data', () => {
a8190154d1553ddd66063658d34e29a8d1747c28
2021-02-11 03:12:41
Dan Ribbens
chore: update changelog
false
update changelog
chore
diff --git a/CHANGELOG.md b/CHANGELOG.md index d9e4b0228cf..67b498fb161 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.2.11](https://github.com/payloadcms/payload/compare/v0.2.11...v0.2.12) (2021-02-05) + +### Bug Fixes +* middleware for cors set up on static files ([55e0de1](https://github.com/payloadcms/payload/commit/55e0de1719ec387e2182bf33922602243f7eda94)) +* file size in local operations ([0feb7b7](https://github.com/payloadcms/payload/commit/0feb7b7379de6429cf5cb1cdbdad0142f72cc5dc)) + + ## [0.2.11](https://github.com/payloadcms/payload/compare/v0.2.10...v0.2.11) (2021-02-05) ### Features
9b497414fec3c6198df06e4b3ed47fa6aa6b8968
2025-01-28 16:54:07
Jessica Chowdhury
feat: allow publish and publish specific locale buttons to be swapped (#9438)
false
allow publish and publish specific locale buttons to be swapped (#9438)
feat
diff --git a/packages/payload/src/config/client.ts b/packages/payload/src/config/client.ts index b0e6a74cfc3..175c100618e 100644 --- a/packages/payload/src/config/client.ts +++ b/packages/payload/src/config/client.ts @@ -129,6 +129,10 @@ export const createClientConfig = ({ if (config.localization.defaultLocale) { clientConfig.localization.defaultLocale = config.localization.defaultLocale } + if (config.localization.defaultLocalePublishOption) { + clientConfig.localization.defaultLocalePublishOption = + config.localization.defaultLocalePublishOption + } if (config.localization.fallback) { clientConfig.localization.fallback = config.localization.fallback } diff --git a/packages/payload/src/config/types.ts b/packages/payload/src/config/types.ts index 10d10abf23c..51991d94d26 100644 --- a/packages/payload/src/config/types.ts +++ b/packages/payload/src/config/types.ts @@ -455,6 +455,14 @@ export type BaseLocalizationConfig = { * @example `"en"` */ defaultLocale: string + /** + * Change the locale used by the default Publish button. + * If set to `all`, all locales will be published. + * If set to `active`, only the locale currently being edited will be published. + * The non-default option will be available via the secondary button. + * @default 'all' + */ + defaultLocalePublishOption?: 'active' | 'all' /** Set to `true` to let missing values in localised fields fall back to the values in `defaultLocale` * * If false, then no requests will fallback unless a fallbackLocale is specified in the request. diff --git a/packages/translations/src/clientKeys.ts b/packages/translations/src/clientKeys.ts index 0ea8a477628..15a1253c012 100644 --- a/packages/translations/src/clientKeys.ts +++ b/packages/translations/src/clientKeys.ts @@ -370,6 +370,7 @@ export const clientTranslationKeys = createClientTranslationKeys([ 'version:previouslyPublished', 'version:problemRestoringVersion', 'version:publish', + 'version:publishAllLocales', 'version:publishChanges', 'version:published', 'version:publishIn', diff --git a/packages/translations/src/languages/ar.ts b/packages/translations/src/languages/ar.ts index df0a2a52265..9ddbc10165e 100644 --- a/packages/translations/src/languages/ar.ts +++ b/packages/translations/src/languages/ar.ts @@ -455,6 +455,7 @@ export const arTranslations: DefaultTranslationsObject = { previouslyPublished: 'نشر سابقا', problemRestoringVersion: 'حدث خطأ في استعادة هذه النّسخة', publish: 'نشر', + publishAllLocales: 'نشر جميع المواقع', publishChanges: 'نشر التّغييرات', published: 'تمّ النّشر', publishIn: 'نشر في {{locale}}', diff --git a/packages/translations/src/languages/az.ts b/packages/translations/src/languages/az.ts index 7a5059ce438..4d6e06b49fc 100644 --- a/packages/translations/src/languages/az.ts +++ b/packages/translations/src/languages/az.ts @@ -464,6 +464,7 @@ export const azTranslations: DefaultTranslationsObject = { previouslyPublished: 'Daha əvvəl nəşr olunmuş', problemRestoringVersion: 'Bu versiyanın bərpasında problem yaşandı', publish: 'Dərc et', + publishAllLocales: 'Bütün lokalizasiyaları dərc edin', publishChanges: 'Dəyişiklikləri dərc et', published: 'Dərc edilmiş', publishIn: '{{locale}} dili ilə nəşr edin', diff --git a/packages/translations/src/languages/bg.ts b/packages/translations/src/languages/bg.ts index 19c5901def9..a48c436d7a9 100644 --- a/packages/translations/src/languages/bg.ts +++ b/packages/translations/src/languages/bg.ts @@ -463,6 +463,7 @@ export const bgTranslations: DefaultTranslationsObject = { previouslyPublished: 'Предишно публикувано', problemRestoringVersion: 'Имаше проблем при възстановяването на тази версия', publish: 'Публикувай', + publishAllLocales: 'Публикувайте всички локали', publishChanges: 'Публикувай промените', published: 'Публикувано', publishIn: 'Публикувайте в {{locale}}', diff --git a/packages/translations/src/languages/ca.ts b/packages/translations/src/languages/ca.ts index e8ede0ff114..e219e9fa214 100644 --- a/packages/translations/src/languages/ca.ts +++ b/packages/translations/src/languages/ca.ts @@ -466,6 +466,7 @@ export const caTranslations: DefaultTranslationsObject = { previouslyPublished: 'Publicat anteriorment', problemRestoringVersion: 'Hi ha hagut un problema en restaurar aquesta versió', publish: 'Publicar', + publishAllLocales: 'Publica totes les configuracions regionals', publishChanges: 'Publicar canvis', published: 'Publicat', publishIn: 'Publicar en {{locale}}', diff --git a/packages/translations/src/languages/cs.ts b/packages/translations/src/languages/cs.ts index 8962ebca031..69e2520fd69 100644 --- a/packages/translations/src/languages/cs.ts +++ b/packages/translations/src/languages/cs.ts @@ -460,6 +460,7 @@ export const csTranslations: DefaultTranslationsObject = { previouslyPublished: 'Dříve publikováno', problemRestoringVersion: 'Při obnovování této verze došlo k problému', publish: 'Publikovat', + publishAllLocales: 'Publikujte všechny lokalizace', publishChanges: 'Publikovat změny', published: 'Publikováno', publishIn: 'Publikovat v {{locale}}', diff --git a/packages/translations/src/languages/da.ts b/packages/translations/src/languages/da.ts index 30ef653b091..7ba78182ce4 100644 --- a/packages/translations/src/languages/da.ts +++ b/packages/translations/src/languages/da.ts @@ -462,6 +462,7 @@ export const daTranslations: DefaultTranslationsObject = { previouslyPublished: 'Tidligere offentliggjort', problemRestoringVersion: 'Der opstod et problem med at gendanne denne version', publish: 'Offentliggør', + publishAllLocales: 'Udgiv alle lokalindstillinger', publishChanges: 'Offentliggør ændringer', published: 'Offentliggjort', publishIn: 'Offentliggør i', diff --git a/packages/translations/src/languages/de.ts b/packages/translations/src/languages/de.ts index 6cb2d06e140..48cb363b678 100644 --- a/packages/translations/src/languages/de.ts +++ b/packages/translations/src/languages/de.ts @@ -468,6 +468,7 @@ export const deTranslations: DefaultTranslationsObject = { previouslyPublished: 'Zuvor Veröffentlicht', problemRestoringVersion: 'Es gab ein Problem bei der Wiederherstellung dieser Version', publish: 'Veröffentlichen', + publishAllLocales: 'Veröffentlichen Sie alle Lokalisierungen', publishChanges: 'Änderungen veröffentlichen', published: 'Veröffentlicht', publishIn: 'Veröffentlichen in {{locale}}', diff --git a/packages/translations/src/languages/en.ts b/packages/translations/src/languages/en.ts index 4de9629f0ca..d5a1ba61ec9 100644 --- a/packages/translations/src/languages/en.ts +++ b/packages/translations/src/languages/en.ts @@ -464,6 +464,7 @@ export const enTranslations = { previouslyPublished: 'Previously Published', problemRestoringVersion: 'There was a problem restoring this version', publish: 'Publish', + publishAllLocales: 'Publish all locales', publishChanges: 'Publish changes', published: 'Published', publishIn: 'Publish in {{locale}}', diff --git a/packages/translations/src/languages/es.ts b/packages/translations/src/languages/es.ts index 7b10fb255d4..17413138bc6 100644 --- a/packages/translations/src/languages/es.ts +++ b/packages/translations/src/languages/es.ts @@ -468,6 +468,7 @@ export const esTranslations: DefaultTranslationsObject = { previouslyPublished: 'Publicado Anteriormente', problemRestoringVersion: 'Ocurrió un problema al restaurar esta versión', publish: 'Publicar', + publishAllLocales: 'Publicar todas las configuraciones regionales', publishChanges: 'Publicar cambios', published: 'Publicado', publishIn: 'Publicar en {{locale}}', diff --git a/packages/translations/src/languages/et.ts b/packages/translations/src/languages/et.ts index 6f0507cce16..fa89b0f2087 100644 --- a/packages/translations/src/languages/et.ts +++ b/packages/translations/src/languages/et.ts @@ -457,6 +457,7 @@ export const etTranslations: DefaultTranslationsObject = { previouslyPublished: 'Varem avaldatud', problemRestoringVersion: 'Selle versiooni taastamisel tekkis probleem', publish: 'Avalda', + publishAllLocales: 'Avaldage kõik lokaadid', publishChanges: 'Avalda muudatused', published: 'Avaldatud', publishIn: 'Avalda keeles {{locale}}', diff --git a/packages/translations/src/languages/fa.ts b/packages/translations/src/languages/fa.ts index 95529274db5..d7401f7c2c5 100644 --- a/packages/translations/src/languages/fa.ts +++ b/packages/translations/src/languages/fa.ts @@ -459,6 +459,7 @@ export const faTranslations: DefaultTranslationsObject = { previouslyPublished: 'قبلا منتشر شده', problemRestoringVersion: 'مشکلی در بازیابی این نگارش وجود دارد', publish: 'انتشار', + publishAllLocales: 'انتشار در تمام مکان‌های محلی', publishChanges: 'انتشار تغییرات', published: 'انتشار یافته', publishIn: 'منتشر کنید در {{locale}}', diff --git a/packages/translations/src/languages/fr.ts b/packages/translations/src/languages/fr.ts index 7c63a823e93..7aea267a705 100644 --- a/packages/translations/src/languages/fr.ts +++ b/packages/translations/src/languages/fr.ts @@ -476,6 +476,7 @@ export const frTranslations: DefaultTranslationsObject = { previouslyPublished: 'Précédemment publié', problemRestoringVersion: 'Un problème est survenu lors de la restauration de cette version', publish: 'Publier', + publishAllLocales: 'Publier toutes les localités', publishChanges: 'Publier les modifications', published: 'Publié', publishIn: 'Publier en {{locale}}', diff --git a/packages/translations/src/languages/he.ts b/packages/translations/src/languages/he.ts index 05559711500..a190b112d5c 100644 --- a/packages/translations/src/languages/he.ts +++ b/packages/translations/src/languages/he.ts @@ -449,6 +449,7 @@ export const heTranslations: DefaultTranslationsObject = { previouslyPublished: 'פורסם בעבר', problemRestoringVersion: 'הייתה בעיה בשחזור הגרסה הזו', publish: 'פרסם', + publishAllLocales: 'פרסם את כל המיקומים', publishChanges: 'פרסם שינויים', published: 'פורסם', publishIn: 'פרסם ב-{{locale}}', diff --git a/packages/translations/src/languages/hr.ts b/packages/translations/src/languages/hr.ts index 91dbd03b2dd..1e0520651fb 100644 --- a/packages/translations/src/languages/hr.ts +++ b/packages/translations/src/languages/hr.ts @@ -460,6 +460,7 @@ export const hrTranslations: DefaultTranslationsObject = { previouslyPublished: 'Prethodno objavljeno', problemRestoringVersion: 'Nastao je problem pri vraćanju ove verzije', publish: 'Objaviti', + publishAllLocales: 'Objavi sve lokalne postavke', publishChanges: 'Objavi promjene', published: 'Objavljeno', publishIn: 'Objavi na {{locale}}', diff --git a/packages/translations/src/languages/hu.ts b/packages/translations/src/languages/hu.ts index 1a4dc3d1811..0e88c733133 100644 --- a/packages/translations/src/languages/hu.ts +++ b/packages/translations/src/languages/hu.ts @@ -468,6 +468,7 @@ export const huTranslations: DefaultTranslationsObject = { previouslyPublished: 'Korábban Közzétéve', problemRestoringVersion: 'Hiba történt a verzió visszaállításakor', publish: 'Közzététel', + publishAllLocales: 'Közzétesz az összes helyszínen', publishChanges: 'Módosítások közzététele', published: 'Közzétett', publishIn: 'Közzététel ebben a {{locale}} területkódban', diff --git a/packages/translations/src/languages/it.ts b/packages/translations/src/languages/it.ts index 8c68f455e64..6e3248b6517 100644 --- a/packages/translations/src/languages/it.ts +++ b/packages/translations/src/languages/it.ts @@ -468,6 +468,7 @@ export const itTranslations: DefaultTranslationsObject = { previouslyPublished: 'Precedentemente Pubblicato', problemRestoringVersion: 'Si è verificato un problema durante il ripristino di questa versione', publish: 'Pubblicare', + publishAllLocales: 'Pubblica tutte le località', publishChanges: 'Pubblica modifiche', published: 'Pubblicato', publishIn: 'Pubblica in {{locale}}', diff --git a/packages/translations/src/languages/ja.ts b/packages/translations/src/languages/ja.ts index 184f1d32dad..5dbae93ee05 100644 --- a/packages/translations/src/languages/ja.ts +++ b/packages/translations/src/languages/ja.ts @@ -461,6 +461,7 @@ export const jaTranslations: DefaultTranslationsObject = { previouslyPublished: '以前に公開された', problemRestoringVersion: 'このバージョンの復元に問題がありました。', publish: '公開する', + publishAllLocales: 'すべてのロケールを公開する', publishChanges: '変更内容を公開', published: '公開済み', publishIn: '{{locale}}で公開する', diff --git a/packages/translations/src/languages/ko.ts b/packages/translations/src/languages/ko.ts index d95769ea758..006cc12f7f1 100644 --- a/packages/translations/src/languages/ko.ts +++ b/packages/translations/src/languages/ko.ts @@ -456,6 +456,7 @@ export const koTranslations: DefaultTranslationsObject = { previouslyPublished: '이전에 발표된', problemRestoringVersion: '이 버전을 복원하는 중 문제가 발생했습니다.', publish: '게시', + publishAllLocales: '모든 로케일을 게시하십시오', publishChanges: '변경 사항 게시', published: '게시됨', publishIn: '{{locale}}에서 게시하십시오.', diff --git a/packages/translations/src/languages/my.ts b/packages/translations/src/languages/my.ts index 4d843977806..66fd3c661a5 100644 --- a/packages/translations/src/languages/my.ts +++ b/packages/translations/src/languages/my.ts @@ -471,6 +471,7 @@ export const myTranslations: DefaultTranslationsObject = { previouslyPublished: 'တိုင်းရင်းသားထုတ်ဝေခဲ့', problemRestoringVersion: 'ဤဗားရှင်းကို ပြန်လည်ရယူရာတွင် ပြဿနာရှိနေသည်။', publish: 'ထုတ်ဝေသည်။', + publishAllLocales: 'နိုင်ငံတကာစာလုံးအားလုံးကို ထုတ်ဝေပါ', publishChanges: 'အပြောင်းအလဲများကို တင်ခဲ့သည်။', published: 'တင်ပြီးပြီ။', publishIn: 'Terbitkan di {{locale}}', diff --git a/packages/translations/src/languages/nb.ts b/packages/translations/src/languages/nb.ts index 057fa8774e6..3ebdc2f4768 100644 --- a/packages/translations/src/languages/nb.ts +++ b/packages/translations/src/languages/nb.ts @@ -464,6 +464,7 @@ export const nbTranslations: DefaultTranslationsObject = { previouslyPublished: 'Tidligere Publisert', problemRestoringVersion: 'Det oppstod et problem med gjenoppretting av denne versjonen', publish: 'Publisere', + publishAllLocales: 'Publiser alle språk', publishChanges: 'Publiser endringer', published: 'Publisert', publishIn: 'Publiser i {{locale}}', diff --git a/packages/translations/src/languages/nl.ts b/packages/translations/src/languages/nl.ts index 6955917b53b..a375c2390ee 100644 --- a/packages/translations/src/languages/nl.ts +++ b/packages/translations/src/languages/nl.ts @@ -468,6 +468,7 @@ export const nlTranslations: DefaultTranslationsObject = { previouslyPublished: 'Eerder gepubliceerd', problemRestoringVersion: 'Er was een probleem bij het herstellen van deze versie', publish: 'Publiceren', + publishAllLocales: 'Publiceer alle taalinstellingen', publishChanges: 'Publiceer wijzigingen', published: 'Gepubliceerd', publishIn: 'Publiceer in {{locale}}', diff --git a/packages/translations/src/languages/pl.ts b/packages/translations/src/languages/pl.ts index 5f082f58119..30ab770b4d4 100644 --- a/packages/translations/src/languages/pl.ts +++ b/packages/translations/src/languages/pl.ts @@ -463,6 +463,7 @@ export const plTranslations: DefaultTranslationsObject = { previouslyPublished: 'Wcześniej opublikowane', problemRestoringVersion: 'Wystąpił problem podczas przywracania tej wersji', publish: 'Publikuj', + publishAllLocales: 'Opublikuj wszystkie lokalizacje', publishChanges: 'Opublikuj zmiany', published: 'Opublikowano', publishIn: 'Opublikuj w {{locale}}', diff --git a/packages/translations/src/languages/pt.ts b/packages/translations/src/languages/pt.ts index 2b3bec10407..72dc0575c64 100644 --- a/packages/translations/src/languages/pt.ts +++ b/packages/translations/src/languages/pt.ts @@ -464,6 +464,7 @@ export const ptTranslations: DefaultTranslationsObject = { previouslyPublished: 'Publicado Anteriormente', problemRestoringVersion: 'Ocorreu um problema ao restaurar essa versão', publish: 'Publicar', + publishAllLocales: 'Publicar todas as localidades', publishChanges: 'Publicar alterações', published: 'Publicado', publishIn: 'Publicar em {{locale}}', diff --git a/packages/translations/src/languages/ro.ts b/packages/translations/src/languages/ro.ts index c0ad5546cc7..b87d6e52f09 100644 --- a/packages/translations/src/languages/ro.ts +++ b/packages/translations/src/languages/ro.ts @@ -471,6 +471,7 @@ export const roTranslations: DefaultTranslationsObject = { previouslyPublished: 'Publicat anterior', problemRestoringVersion: 'A existat o problemă la restaurarea acestei versiuni', publish: 'Publicați', + publishAllLocales: 'Publicați toate configurările regionale și lingvistice', publishChanges: 'Publicați modificările', published: 'Publicat', publishIn: 'Publicați în {{locale}}', diff --git a/packages/translations/src/languages/rs.ts b/packages/translations/src/languages/rs.ts index 3bdb894b370..cdc3ceae139 100644 --- a/packages/translations/src/languages/rs.ts +++ b/packages/translations/src/languages/rs.ts @@ -459,6 +459,7 @@ export const rsTranslations: DefaultTranslationsObject = { previouslyPublished: 'Prethodno objavljeno', problemRestoringVersion: 'Настао је проблем при враћању ове верзије', publish: 'Објавити', + publishAllLocales: 'Objavi sve lokalitete', publishChanges: 'Објави промене', published: 'Објављено', publishIn: 'Objavi na {{locale}}', diff --git a/packages/translations/src/languages/rsLatin.ts b/packages/translations/src/languages/rsLatin.ts index b2eb2aacb1f..e36cc0e8423 100644 --- a/packages/translations/src/languages/rsLatin.ts +++ b/packages/translations/src/languages/rsLatin.ts @@ -461,6 +461,7 @@ export const rsLatinTranslations: DefaultTranslationsObject = { previouslyPublished: 'Prethodno objavljeno', problemRestoringVersion: 'Nastao je problem pri vraćanju ove verzije', publish: 'Objaviti', + publishAllLocales: 'Objavi sve lokalne postavke', publishChanges: 'Objavljivanje', published: 'Objavljeno', publishIn: 'Objavite na {{locale}}', diff --git a/packages/translations/src/languages/ru.ts b/packages/translations/src/languages/ru.ts index b7b8a1f2a4f..04e2100b278 100644 --- a/packages/translations/src/languages/ru.ts +++ b/packages/translations/src/languages/ru.ts @@ -466,6 +466,7 @@ export const ruTranslations: DefaultTranslationsObject = { previouslyPublished: 'Ранее опубликовано', problemRestoringVersion: 'Возникла проблема с восстановлением этой версии', publish: 'Публиковать', + publishAllLocales: 'Опубликовать все локали', publishChanges: 'Опубликовать изменения', published: 'Опубликовано', publishIn: 'Опубликовать на {{locale}}', diff --git a/packages/translations/src/languages/sk.ts b/packages/translations/src/languages/sk.ts index 549b91eb416..4886b92b251 100644 --- a/packages/translations/src/languages/sk.ts +++ b/packages/translations/src/languages/sk.ts @@ -463,6 +463,7 @@ export const skTranslations: DefaultTranslationsObject = { previouslyPublished: 'Predtým publikované', problemRestoringVersion: 'Pri obnovovaní tejto verzie došlo k problému', publish: 'Publikovať', + publishAllLocales: 'Publikujte všetky lokality', publishChanges: 'Publikovať zmeny', published: 'Publikované', publishIn: 'Publikujte v {{locale}}', diff --git a/packages/translations/src/languages/sl.ts b/packages/translations/src/languages/sl.ts index 217b7226524..faee5e310c8 100644 --- a/packages/translations/src/languages/sl.ts +++ b/packages/translations/src/languages/sl.ts @@ -460,6 +460,7 @@ export const slTranslations: DefaultTranslationsObject = { previouslyPublished: 'Predhodno objavljeno', problemRestoringVersion: 'Pri obnavljanju te različice je prišlo do težave', publish: 'Objavi', + publishAllLocales: 'Objavi vse jezike', publishChanges: 'Objavi spremembe', published: 'Objavljeno', publishIn: 'Objavi v {{locale}}', diff --git a/packages/translations/src/languages/sv.ts b/packages/translations/src/languages/sv.ts index 68719450385..fb18a58aa69 100644 --- a/packages/translations/src/languages/sv.ts +++ b/packages/translations/src/languages/sv.ts @@ -463,6 +463,7 @@ export const svTranslations: DefaultTranslationsObject = { previouslyPublished: 'Tidigare publicerad', problemRestoringVersion: 'Det uppstod ett problem när den här versionen skulle återställas', publish: 'Publicera', + publishAllLocales: 'Publicera alla lokaliseringsinställningar', publishChanges: 'Publicera ändringar', published: 'Publicerad', publishIn: 'Publicera i {{locale}}', diff --git a/packages/translations/src/languages/th.ts b/packages/translations/src/languages/th.ts index d32ffbcdf65..f227f550846 100644 --- a/packages/translations/src/languages/th.ts +++ b/packages/translations/src/languages/th.ts @@ -454,6 +454,7 @@ export const thTranslations: DefaultTranslationsObject = { previouslyPublished: 'เผยแพร่ก่อนหน้านี้', problemRestoringVersion: 'เกิดปัญหาระหว่างการกู้คืนเวอร์ชันนี้', publish: 'เผยแพร่', + publishAllLocales: 'เผยแพร่ทุกสถานที่', publishChanges: 'เผยแพร่การแก้ไข', published: 'เผยแพร่แล้ว', publishIn: 'เผยแพร่ใน {{locale}}', diff --git a/packages/translations/src/languages/tr.ts b/packages/translations/src/languages/tr.ts index 46829eebf8c..0c88e834dd3 100644 --- a/packages/translations/src/languages/tr.ts +++ b/packages/translations/src/languages/tr.ts @@ -465,6 +465,7 @@ export const trTranslations: DefaultTranslationsObject = { previouslyPublished: 'Daha Önce Yayınlanmış', problemRestoringVersion: 'Bu sürüme geri döndürürken bir hatayla karşılaşıldı.', publish: 'Yayınla', + publishAllLocales: 'Tüm yerel ayarları yayınla', publishChanges: 'Değişiklikleri yayınla', published: 'Yayınlandı', publishIn: '{{locale}} dilinde yayınlayın.', diff --git a/packages/translations/src/languages/uk.ts b/packages/translations/src/languages/uk.ts index fe389e10338..10a9f574f22 100644 --- a/packages/translations/src/languages/uk.ts +++ b/packages/translations/src/languages/uk.ts @@ -461,6 +461,7 @@ export const ukTranslations: DefaultTranslationsObject = { previouslyPublished: 'Раніше опубліковано', problemRestoringVersion: 'Виникла проблема з відновленням цієї версії', publish: 'Опублікувати', + publishAllLocales: 'Опублікуйте всі локалі', publishChanges: 'Опублікувати зміни', published: 'Опубліковано', publishIn: 'Опублікувати в {{locale}}', diff --git a/packages/translations/src/languages/vi.ts b/packages/translations/src/languages/vi.ts index b1998877477..af5162960b9 100644 --- a/packages/translations/src/languages/vi.ts +++ b/packages/translations/src/languages/vi.ts @@ -458,6 +458,7 @@ export const viTranslations: DefaultTranslationsObject = { previouslyPublished: 'Đã xuất bản trước đây', problemRestoringVersion: 'Đã xảy ra vấn đề khi khôi phục phiên bản này', publish: 'Công bố', + publishAllLocales: 'Xuất bản tất cả địa phương', publishChanges: 'Xuất bản tài liệu', published: 'Đã xuất bản', publishIn: 'Xuất bản trong {{locale}}', diff --git a/packages/translations/src/languages/zh.ts b/packages/translations/src/languages/zh.ts index fe54e986957..01e23676da8 100644 --- a/packages/translations/src/languages/zh.ts +++ b/packages/translations/src/languages/zh.ts @@ -444,6 +444,7 @@ export const zhTranslations: DefaultTranslationsObject = { previouslyPublished: '先前发布过的', problemRestoringVersion: '恢复这个版本时发生了问题', publish: '发布', + publishAllLocales: '发布所有地区设置', publishChanges: '发布修改', published: '已发布', publishIn: '在{{locale}}发布', diff --git a/packages/translations/src/languages/zhTw.ts b/packages/translations/src/languages/zhTw.ts index 37e053203bd..9c2c31a862a 100644 --- a/packages/translations/src/languages/zhTw.ts +++ b/packages/translations/src/languages/zhTw.ts @@ -444,6 +444,7 @@ export const zhTwTranslations: DefaultTranslationsObject = { previouslyPublished: '先前出版過的', problemRestoringVersion: '回復這個版本時發生了問題', publish: '發佈', + publishAllLocales: '發布所有地區設定', publishChanges: '發佈修改', published: '已發佈', publishIn: '在 {{locale}} 發佈', diff --git a/packages/ui/src/elements/PublishButton/index.tsx b/packages/ui/src/elements/PublishButton/index.tsx index 4d8523a4332..79170ba38db 100644 --- a/packages/ui/src/elements/PublishButton/index.tsx +++ b/packages/ui/src/elements/PublishButton/index.tsx @@ -46,7 +46,7 @@ export const PublishButton: React.FC<{ label?: string }> = ({ label: labelProp } serverURL, } = config - const { i18n, t } = useTranslation() + const { t } = useTranslation() const label = labelProp || t('version:publishChanges') const entityConfig = React.useMemo(() => { @@ -165,6 +165,28 @@ export const PublishButton: React.FC<{ label?: string }> = ({ label: labelProp } [api, collectionSlug, globalSlug, id, serverURL, setHasPublishedDoc, submit, uploadStatus], ) + const publishAll = + localization && localization.defaultLocalePublishOption !== 'active' ? true : false + + const activeLocale = + localization && + localization?.locales.find((locale) => + typeof locale === 'string' ? locale === localeCode : locale.code === localeCode, + ) + + const activeLocaleLabel = + typeof activeLocale.label === 'string' + ? activeLocale.label + : (activeLocale.label?.[localeCode] ?? undefined) + + const defaultPublish = publishAll ? publish : () => publishSpecificLocale(activeLocale.code) + const defaultLabel = publishAll ? label : t('version:publishIn', { locale: activeLocaleLabel }) + + const secondaryPublish = publishAll ? () => publishSpecificLocale(activeLocale.code) : publish + const secondaryLabel = publishAll + ? t('version:publishIn', { locale: activeLocaleLabel }) + : t('version:publishAllLocales') + if (!hasPublishPermission) { return null } @@ -174,7 +196,7 @@ export const PublishButton: React.FC<{ label?: string }> = ({ label: labelProp } <FormSubmit buttonId="action-save" disabled={!canPublish} - onClick={publish} + onClick={defaultPublish} size="medium" SubMenuPopupContent={ localization || canSchedulePublish @@ -188,33 +210,13 @@ export const PublishButton: React.FC<{ label?: string }> = ({ label: labelProp } </PopupList.Button> </PopupList.ButtonGroup> )} - {localization - ? localization.locales.map((locale) => { - const formattedLabel = - typeof locale.label === 'string' - ? locale.label - : locale.label && locale.label[i18n?.language] - - const isActive = - typeof locale === 'string' - ? locale === localeCode - : locale.code === localeCode - - if (isActive) { - return ( - <PopupList.ButtonGroup key={locale.code}> - <PopupList.Button - onClick={() => [publishSpecificLocale(locale.code), close()]} - > - {t('version:publishIn', { - locale: formattedLabel || locale.code, - })} - </PopupList.Button> - </PopupList.ButtonGroup> - ) - } - }) - : null} + {localization && ( + <PopupList.ButtonGroup> + <PopupList.Button onClick={secondaryPublish}> + {secondaryLabel} + </PopupList.Button> + </PopupList.ButtonGroup> + )} </React.Fragment> ) } @@ -222,7 +224,7 @@ export const PublishButton: React.FC<{ label?: string }> = ({ label: labelProp } } type="button" > - {label} + {localization ? defaultLabel : label} </FormSubmit> {canSchedulePublish && isModalOpen(drawerSlug) && <ScheduleDrawer slug={drawerSlug} />} </React.Fragment> diff --git a/test/admin/config.ts b/test/admin/config.ts index 4c9ba3a3249..cf16ca32533 100644 --- a/test/admin/config.ts +++ b/test/admin/config.ts @@ -179,6 +179,7 @@ export default buildConfigWithDefaults({ }, }, localization: { + defaultLocalePublishOption: 'active', defaultLocale: 'en', locales: [ { diff --git a/test/admin/e2e/document-view/e2e.spec.ts b/test/admin/e2e/document-view/e2e.spec.ts index 405f086ca60..218575613ab 100644 --- a/test/admin/e2e/document-view/e2e.spec.ts +++ b/test/admin/e2e/document-view/e2e.spec.ts @@ -531,6 +531,15 @@ describe('Document View', () => { }) }) }) + + describe('publish button', () => { + test('should show publish active locale button with defaultLocalePublishOption', async () => { + await navigateToDoc(page, postsUrl) + const publishButton = await page.locator('#action-save') + await expect(publishButton).toBeVisible() + await expect(publishButton).toContainText('Publish in English') + }) + }) }) async function createPost(overrides?: Partial<Post>): Promise<Post> {
18d9314f22dbbed51925abbe46f5ae16b4412bae
2024-08-12 21:15:39
James Mikrut
docs: adds prod migrations (#7631)
false
adds prod migrations (#7631)
docs
diff --git a/app/(payload)/admin/importMap.js b/app/(payload)/admin/importMap.js new file mode 100644 index 00000000000..8ef7021383f --- /dev/null +++ b/app/(payload)/admin/importMap.js @@ -0,0 +1 @@ +export const importMap = {} diff --git a/docs/database/migrations.mdx b/docs/database/migrations.mdx index 5668d59ed38..35532b0cc04 100644 --- a/docs/database/migrations.mdx +++ b/docs/database/migrations.mdx @@ -211,3 +211,32 @@ In the example above, we've specified a `ci` script which we can use as our "bui This will require that your build pipeline can connect to your database, and it will simply run the `payload migrate` command prior to starting the build process. By calling `payload migrate`, Payload will automatically execute any migrations in your `/migrations` folder that have not yet been executed against your production database, in the order that they were created. If it fails, the deployment will be rejected. But now, with your build script set up to run your migrations, you will be all set! Next time you deploy, your CI will execute the required migrations for you, and your database will be caught up with the shape that your Payload Config requires. + +## Running migrations in production + +In certain cases, you might want to run migrations at runtime when the server starts. Running them during build time may be impossible due to not having access to your database connection while building or similar reasoning. + +If you're using a long-running server or container where your Node server starts up one time and then stays initialized, you might prefer to run migrations on server startup instead of within your CI. + +In order to run migrations at runtime, on initialization, you can pass your migrations to your database adapter under the `prodMigrations` key as follows: + +```ts +// Import your migrations from the `index.ts` file +// that Payload generates for you +import { migrations } from './migrations' +import { buildConfig } from 'payload' + +export default buildConfig({ + // your config here + db: postgresAdapter({ + // your adapter config here + prodMigrations: migrations + }) +}) +``` + +Passing your migrations as shown above will tell Payload, in production only, to execute any migrations that need to be run prior to completing the initialization of Payload. This is ideal for long-running services where Payload will only be initialized at startup. + +<Banner type="warning"> + Warning - if Payload is instructed to run migrations in production, this may slow down serverless cold starts on platforms such as Vercel. Generally, this option should only be used for long-running servers / containers. +</Banner> diff --git a/docs/database/overview.mdx b/docs/database/overview.mdx index c318c8eb6a4..6aa7c1ca20c 100644 --- a/docs/database/overview.mdx +++ b/docs/database/overview.mdx @@ -12,7 +12,7 @@ Currently, Payload officially supports the following Database Adapters: - [MongoDB](/docs/database/mongodb) with [Mongoose](https://mongoosejs.com/) - [Postgres](/docs/database/postgres) with [Drizzle](https://drizzle.team/) -- Coming soon: SQLite and MySQL using Drizzle. +- [SQLite](/docs/database/sqlite) with [Drizzle](https://drizzle.team/) To configure a Database Adapter, use the `db` property in your [Payload Config](../configuration/overview): @@ -59,7 +59,7 @@ You should prefer MongoDB if: Many projects might call for more rigid database architecture where the shape of your data is strongly enforced at the database level. For example, if you know the shape of your data and it's relatively "flat", and you don't anticipate it to change often, your workload might suit relational databases like Postgres very well. -You should prefer a relational DB like Postgres if: +You should prefer a relational DB like Postgres or SQLite if: - You are comfortable with [Migrations](./migrations) - You require enforced data consistency at the database level
10eab8765358f5ee98b37ae191d6b3c2287f8ea3
2024-12-06 19:40:17
Nikola Spalevic
chore(translations): improved serbian translations for the lexical editor (#9795)
false
improved serbian translations for the lexical editor (#9795)
chore
diff --git a/packages/richtext-lexical/src/features/align/server/i18n.ts b/packages/richtext-lexical/src/features/align/server/i18n.ts index 3fce160de3b..e2de85df0c8 100644 --- a/packages/richtext-lexical/src/features/align/server/i18n.ts +++ b/packages/richtext-lexical/src/features/align/server/i18n.ts @@ -134,14 +134,14 @@ export const i18n: Partial<GenericLanguages> = { alignRightLabel: 'Aliniați la dreapta', }, rs: { - alignCenterLabel: 'Centriraj', - alignJustifyLabel: 'Poravnaj opravdaj', - alignLeftLabel: 'Poravnaj levo', - alignRightLabel: 'Poravnaj desno', + alignCenterLabel: 'Поравнај по средини', + alignJustifyLabel: 'Поравнај обострано', + alignLeftLabel: 'Поравнај лево', + alignRightLabel: 'Поравнај десно', }, 'rs-latin': { - alignCenterLabel: 'Poravnaj centar', - alignJustifyLabel: 'Poravnaj opravdanje', + alignCenterLabel: 'Poravnaj po sredini', + alignJustifyLabel: 'Poravnaj obostrano', alignLeftLabel: 'Poravnaj levo', alignRightLabel: 'Poravnaj desno', }, diff --git a/packages/richtext-lexical/src/features/blockquote/server/i18n.ts b/packages/richtext-lexical/src/features/blockquote/server/i18n.ts index 56a44b71118..498e7e9ca57 100644 --- a/packages/richtext-lexical/src/features/blockquote/server/i18n.ts +++ b/packages/richtext-lexical/src/features/blockquote/server/i18n.ts @@ -68,7 +68,7 @@ export const i18n: Partial<GenericLanguages> = { label: 'Citat', }, rs: { - label: 'Blok citat', + label: 'Блок цитата', }, 'rs-latin': { label: 'Blok citata', diff --git a/packages/richtext-lexical/src/features/blocks/server/i18n.ts b/packages/richtext-lexical/src/features/blocks/server/i18n.ts index 2720003e588..d60e4fe253d 100644 --- a/packages/richtext-lexical/src/features/blocks/server/i18n.ts +++ b/packages/richtext-lexical/src/features/blocks/server/i18n.ts @@ -201,18 +201,18 @@ export const i18n: Partial<GenericLanguages> = { }, rs: { inlineBlocks: { - create: 'Kreiraj {{label}}', - edit: 'Izmeni {{label}}', - label: 'Umetnuti blokovi', - remove: 'Ukloni {{label}}', + create: 'Креирај {{label}}', + edit: 'Измени {{label}}', + label: 'Уметнути блокови', + remove: 'Уклони {{label}}', }, - label: 'Blokovi', + label: 'Блокови', }, 'rs-latin': { inlineBlocks: { create: 'Kreiraj {{label}}', edit: 'Izmeni {{label}}', - label: 'Unutar blokovi', + label: 'Umetnuti blokovi', remove: 'Ukloni {{oznaka}}', }, label: 'Blokovi', diff --git a/packages/richtext-lexical/src/features/heading/server/i18n.ts b/packages/richtext-lexical/src/features/heading/server/i18n.ts index 8cefa5c662b..037c862935a 100644 --- a/packages/richtext-lexical/src/features/heading/server/i18n.ts +++ b/packages/richtext-lexical/src/features/heading/server/i18n.ts @@ -68,7 +68,7 @@ export const i18n: Partial<GenericLanguages> = { label: 'Titlu {{headingLevel}}', }, rs: { - label: 'Naslov {{headingLevel}}', + label: 'Наслов {{headingLevel}}', }, 'rs-latin': { label: 'Naslov {{headingLevel}}', diff --git a/packages/richtext-lexical/src/features/horizontalRule/server/i18n.ts b/packages/richtext-lexical/src/features/horizontalRule/server/i18n.ts index 6ff8e0a5140..c986cdb687b 100644 --- a/packages/richtext-lexical/src/features/horizontalRule/server/i18n.ts +++ b/packages/richtext-lexical/src/features/horizontalRule/server/i18n.ts @@ -68,7 +68,7 @@ export const i18n: Partial<GenericLanguages> = { label: 'Linie orizontală', }, rs: { - label: 'Horizontalna linija', + label: 'Хоризонтална линија', }, 'rs-latin': { label: 'Horizontalna linija', diff --git a/packages/richtext-lexical/src/features/indent/server/i18n.ts b/packages/richtext-lexical/src/features/indent/server/i18n.ts index e9e4035ed6f..7af9361ca0e 100644 --- a/packages/richtext-lexical/src/features/indent/server/i18n.ts +++ b/packages/richtext-lexical/src/features/indent/server/i18n.ts @@ -90,8 +90,8 @@ export const i18n: Partial<GenericLanguages> = { increaseLabel: 'Crește indentarea', }, rs: { - decreaseLabel: 'Smanji uvlačenje', - increaseLabel: 'Povećaj uvlačenje', + decreaseLabel: 'Смањи увлачење', + increaseLabel: 'Повећај увлачење', }, 'rs-latin': { decreaseLabel: 'Smanji uvlačenje', diff --git a/packages/richtext-lexical/src/features/link/server/i18n.ts b/packages/richtext-lexical/src/features/link/server/i18n.ts index d78047e6406..bb6f51d3c3c 100644 --- a/packages/richtext-lexical/src/features/link/server/i18n.ts +++ b/packages/richtext-lexical/src/features/link/server/i18n.ts @@ -90,7 +90,7 @@ export const i18n: Partial<GenericLanguages> = { loadingWithEllipsis: 'Se încarcă...', }, rs: { - label: 'Veza', + label: 'Веза', loadingWithEllipsis: 'Учитавање...', }, 'rs-latin': { diff --git a/packages/richtext-lexical/src/features/lists/checklist/server/i18n.ts b/packages/richtext-lexical/src/features/lists/checklist/server/i18n.ts index 9dc5cdbcefd..0fd14530db1 100644 --- a/packages/richtext-lexical/src/features/lists/checklist/server/i18n.ts +++ b/packages/richtext-lexical/src/features/lists/checklist/server/i18n.ts @@ -68,10 +68,10 @@ export const i18n: Partial<GenericLanguages> = { label: 'Listă de verificare', }, rs: { - label: 'Lista provere', + label: 'Контролна листа', }, 'rs-latin': { - label: 'Lista provere', + label: 'Kontrolna lista', }, ru: { label: 'Список Проверки', diff --git a/packages/richtext-lexical/src/features/lists/orderedList/server/i18n.ts b/packages/richtext-lexical/src/features/lists/orderedList/server/i18n.ts index c3f9e22796a..9c633c0deb5 100644 --- a/packages/richtext-lexical/src/features/lists/orderedList/server/i18n.ts +++ b/packages/richtext-lexical/src/features/lists/orderedList/server/i18n.ts @@ -68,10 +68,10 @@ export const i18n: Partial<GenericLanguages> = { label: 'Lista ordonată', }, rs: { - label: 'Naručeni Spisak', + label: 'Уређена листа', }, 'rs-latin': { - label: 'Naručeni spisak', + label: 'Uređena lista', }, ru: { label: 'Упорядоченный список', diff --git a/packages/richtext-lexical/src/features/lists/unorderedList/server/i18n.ts b/packages/richtext-lexical/src/features/lists/unorderedList/server/i18n.ts index 33a18dfe698..34607d5bc7c 100644 --- a/packages/richtext-lexical/src/features/lists/unorderedList/server/i18n.ts +++ b/packages/richtext-lexical/src/features/lists/unorderedList/server/i18n.ts @@ -68,10 +68,10 @@ export const i18n: Partial<GenericLanguages> = { label: 'Listă neordonată', }, rs: { - label: 'Neporedani spisak', + label: 'Неуређена листа', }, 'rs-latin': { - label: 'Neuređena Lista', + label: 'Neuređena lista', }, ru: { label: 'Несортированный список', diff --git a/packages/richtext-lexical/src/features/paragraph/server/i18n.ts b/packages/richtext-lexical/src/features/paragraph/server/i18n.ts index ee0f9d8b582..95cd9900ec9 100644 --- a/packages/richtext-lexical/src/features/paragraph/server/i18n.ts +++ b/packages/richtext-lexical/src/features/paragraph/server/i18n.ts @@ -90,12 +90,12 @@ export const i18n: Partial<GenericLanguages> = { label2: 'Text normal', }, rs: { - label: 'Paragraf', - label2: 'Normalan tekst', + label: 'Параграф', + label2: 'Oбичан текст', }, 'rs-latin': { label: 'Paragraf', - label2: 'Normalan tekst', + label2: 'Običan tekst', }, ru: { label: 'Параграф', diff --git a/packages/richtext-lexical/src/features/relationship/server/i18n.ts b/packages/richtext-lexical/src/features/relationship/server/i18n.ts index dcd4764dfbf..76379e0cf96 100644 --- a/packages/richtext-lexical/src/features/relationship/server/i18n.ts +++ b/packages/richtext-lexical/src/features/relationship/server/i18n.ts @@ -68,10 +68,10 @@ export const i18n: Partial<GenericLanguages> = { label: 'Relație', }, rs: { - label: 'Veza', + label: 'Релација', }, 'rs-latin': { - label: 'Odnos', + label: 'Relacija', }, ru: { label: 'Отношения', diff --git a/packages/richtext-lexical/src/features/upload/server/i18n.ts b/packages/richtext-lexical/src/features/upload/server/i18n.ts index d6da11dcad6..1f7fc055e55 100644 --- a/packages/richtext-lexical/src/features/upload/server/i18n.ts +++ b/packages/richtext-lexical/src/features/upload/server/i18n.ts @@ -68,7 +68,7 @@ export const i18n: Partial<GenericLanguages> = { label: 'Încarcă', }, rs: { - label: 'Otpremi', + label: 'Отпреми', }, 'rs-latin': { label: 'Otpremi', diff --git a/packages/richtext-lexical/src/i18n.ts b/packages/richtext-lexical/src/i18n.ts index b273e4a8adb..fb7d1795b90 100644 --- a/packages/richtext-lexical/src/i18n.ts +++ b/packages/richtext-lexical/src/i18n.ts @@ -134,10 +134,10 @@ export const i18n: Partial<GenericLanguages> = { toolbarItemsActive: '{{count}} activ', }, rs: { - placeholder: "Počnite da kucate, ili pritisnite '/' za komande...", - slashMenuBasicGroupLabel: 'Osnovno', - slashMenuListGroupLabel: 'Liste', - toolbarItemsActive: '{{count}} aktivno', + placeholder: "Почните да куцате, или притисните '/' за команде...", + slashMenuBasicGroupLabel: 'Основно', + slashMenuListGroupLabel: 'Листе', + toolbarItemsActive: '{{count}} активно', }, 'rs-latin': { placeholder: "Počnite da kucate, ili pritisnite '/' za komande...",
6e57040aafb1d00e147d3e850f8da66c7762e87b
2022-02-10 04:34:21
James
chore: ensures version comparison does not allow to compare same version to itself
false
ensures version comparison does not allow to compare same version to itself
chore
diff --git a/src/admin/components/views/Version/Compare/index.tsx b/src/admin/components/views/Version/Compare/index.tsx index 6244780e092..685b17b9ab3 100644 --- a/src/admin/components/views/Version/Compare/index.tsx +++ b/src/admin/components/views/Version/Compare/index.tsx @@ -5,6 +5,7 @@ import format from 'date-fns/format'; import { Props } from './types'; import ReactSelect from '../../../elements/ReactSelect'; import { PaginatedDocs } from '../../../../../mongoose/types'; +import { Where } from '../../../../../types'; import { mostRecentVersionOption } from '../shared'; import './index.scss'; @@ -18,7 +19,7 @@ const baseOptions = [ ]; const CompareVersion: React.FC<Props> = (props) => { - const { onChange, value, baseURL, parentID } = props; + const { onChange, value, baseURL, versionID, parentID } = props; const { admin: { @@ -33,19 +34,30 @@ const CompareVersion: React.FC<Props> = (props) => { const getResults = useCallback(async ({ lastLoadedPage: lastLoadedPageArg, } = {}) => { - const query = { + const query: { + [key: string]: unknown + where: Where + } = { limit: maxResultsPerRequest, page: lastLoadedPageArg, depth: 0, - where: undefined, + where: { + and: [ + { + id: { + not_equals: versionID, + }, + }, + ], + }, }; if (parentID) { - query.where = { + query.where.and.push({ parent: { equals: parentID, }, - }; + }); } const search = qs.stringify(query); @@ -66,7 +78,7 @@ const CompareVersion: React.FC<Props> = (props) => { } else { setErrorLoading('An error has occurred.'); } - }, [dateFormat, baseURL, parentID]); + }, [dateFormat, baseURL, parentID, versionID]); const classes = [ 'field-type', diff --git a/src/admin/components/views/Version/Compare/types.ts b/src/admin/components/views/Version/Compare/types.ts index 5430d8e355c..014d1ae3853 100644 --- a/src/admin/components/views/Version/Compare/types.ts +++ b/src/admin/components/views/Version/Compare/types.ts @@ -6,6 +6,7 @@ export type Props = { onChange: (val: CompareOption) => void, value: CompareOption, baseURL: string + versionID: string parentID?: string } diff --git a/src/admin/components/views/Version/Version.tsx b/src/admin/components/views/Version/Version.tsx index 7240129c313..d2b91705ba4 100644 --- a/src/admin/components/views/Version/Version.tsx +++ b/src/admin/components/views/Version/Version.tsx @@ -188,6 +188,7 @@ const VersionView: React.FC<Props> = ({ collection, global }) => { </header> <div className={`${baseClass}__controls`}> <CompareVersion + versionID={versionID} baseURL={compareBaseURL} parentID={parentID} value={compareValue}
037662d9f5b8be94dfb5c239dadaf12bdabfe33a
2024-11-19 22:10:20
Jessica Chowdhury
chore(examples): migrates `custom-component` example to latest beta [skip-lint] (#9170)
false
migrates `custom-component` example to latest beta [skip-lint] (#9170)
chore
diff --git a/examples/custom-components/README.md b/examples/custom-components/README.md index 926a7282e9d..54cb5f8cc87 100644 --- a/examples/custom-components/README.md +++ b/examples/custom-components/README.md @@ -1,46 +1,67 @@ # Payload Custom Components Example -This example demonstrates how to use Custom Components in [Payload](https://github.com/payloadcms/payload) Admin Panel. This example includes custom components for every field type available in Payload, including both server and client components. It also includes custom views, custom nav links, and more. +This example demonstrates how to use Custom Components in the [Payload](https://github.com/payloadcms/payload) Admin Panel. Custom components allow you to extend Payload by providing custom UI elements for fields, collections, and views. This example covers custom components for every field type available in Payload, including both server and client components. ## Quick Start -To spin up this example locally, follow these steps: +To spin up this example locally, follow the steps below: 1. Clone this repo -1. `cd` into this directory and run `pnpm i --ignore-workspace`\*, `yarn`, or `npm install` +1. Navigate into the project directory and install dependencies using your preferred package manager: - > \*If you are running using pnpm within the Payload Monorepo, the `--ignore-workspace` flag is needed so that pnpm generates a lockfile in this example's directory despite the fact that one exists in root. +- `pnpm i --ignore-workspace`\*, `yarn`, or `npm install` -1. `pnpm dev`, `yarn dev` or `npm run dev` to start the server - - Press `y` when prompted to seed the database -1. `open http://localhost:3000` to access the home page -1. `open http://localhost:3000/admin` to access the admin panel - - Login with email `[email protected]` and password `demo` +> \*NOTE: The --ignore-workspace flag is needed if you are running this example within the Payload monorepo to avoid workspace conflicts. + +1. Start the server: + - Depending on your package manager, run `pnpm dev`, `yarn dev` or `npm run dev` + - When prompted, type `y` then `enter` to seed the database with sample data +1. Access the application: + - Open your browser and navigate to `http://localhost:3000` to access the homepage. + - Open `http://localhost:3000/admin` to access the admin panel. +1. Login: + +- Use the following credentials to log into the admin panel: + > `Email: [email protected]` > `Password: demo` ## How it works ### Collections -See the [Collections](https://payloadcms.com/docs/configuration/collections) docs for details on how to extend any of this functionality. +[Collections](https://payloadcms.com/docs/configuration/collections) in Payload allow you to define structured content types. This example includes multiple collections, with a focus on: - #### Users - The `users` collection is auth-enabled which provides access to the admin panel. + The `users` collection is **auth-enabled**, providing access to the admin panel and enabling user authentication. This collection shows how to implement a basic user collection with authentication. - For additional help with authentication, see the official [Auth Example](https://github.com/payloadcms/payload/tree/main/examples/auth/cms#readme) or the [Authentication](https://payloadcms.com/docs/authentication/overview#authentication-overview) docs. + - For more details on setting up authentication, checkout the [Auth Example](https://github.com/payloadcms/payload/tree/main/examples/auth/cms#readme) and the [Authentication Overview](https://payloadcms.com/docs/authentication/overview#authentication-overview). - #### Fields - The `fields` collection contains every field type available in Payload, each with custom components filled in every available "slot", i.e. `admin.components.Field`, `admin.components.Label`, etc. There are two of every field, one for server components, and the other for client components. This pattern shows how to use custom components in both environments, no matter which field type you are using. + The `fields` collection demonstrates all the **field types** available in Payload, each one configured with custom components. This includes every available "slot" for custom components (e.g., `admin.components.Field`, `admin.components.Label`, `admin.components.Input`, etc.). For each field type, two examples are provided: one using **server-side components** and the other using **client-side components**. This pattern illustrates how to customize both types of components across different field types. + + - **Custom Field Components**: Custom components allow you to tailor the UI and behavior of the admin panel fields. This can be useful for implementing complex interactions, custom validation, or UI enhancements. For example, you might use a custom component to replace a simple text input with a date picker or a rich text editor. - #### Views - The `views` collection demonstrates how to add collection-level views, including the default view and custom tabs. + The `views` collection demonstrates how to create **collection-level views**, such as custom tabs or layout configurations. This is where you can modify how data is displayed in the admin panel beyond the default list and edit views. Custom views give you full control over how content is presented to users. - #### Root Views - The `root-views` collection demonstrates how to add a root document-level view to the admin panel. + The `root-views` collection shows how to implement **root-level views** in the admin panel. These views can be used to modify the global admin interface, adding custom sections or settings that appear outside of collections. + +## Troubleshooting + +If you encounter any issues during setup or while running the example, here are a few things to try: + +- **Missing dependencies**: If you see errors related to missing packages, try deleting the `node_modules` folder and the lockfile (`package-lock.json` or `pnpm-lock.yaml`), then rerun `npm install` or `pnpm i`. + +- **Port conflicts**: If the development server isn't starting, ensure that port `3000` isn't being used by another process. You can change the port by modifying the `package.json` file or setting the `PORT` environment variable. + +- **Seed data issues**: If the database seeding fails, try clearing the database and then rerun the seeding process. ## Questions If you have any issues or questions, reach out to us on [Discord](https://discord.com/invite/payload) or start a [GitHub discussion](https://github.com/payloadcms/payload/discussions). + +For more detailed documentation on how to extend and customize Payload, check out the full [Payload documentation](https://payloadcms.com/docs). diff --git a/examples/custom-components/next-env.d.ts b/examples/custom-components/next-env.d.ts index 4f11a03dc6c..40c3d68096c 100644 --- a/examples/custom-components/next-env.d.ts +++ b/examples/custom-components/next-env.d.ts @@ -2,4 +2,4 @@ /// <reference types="next/image-types/global" /> // NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. +// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. diff --git a/examples/custom-components/package.json b/examples/custom-components/package.json index d5df9fd5b1d..8ead1814879 100644 --- a/examples/custom-components/package.json +++ b/examples/custom-components/package.json @@ -5,10 +5,10 @@ "license": "MIT", "type": "module", "scripts": { - "_dev": "cross-env NODE_OPTIONS=--no-deprecation && pnpm generate:importmap && next dev", + "_dev": "cross-env NODE_OPTIONS=--no-deprecation next dev", "build": "cross-env NODE_OPTIONS=--no-deprecation next build", - "dev": "cross-env NODE_OPTIONS=--no-deprecation && pnpm generate:importmap && pnpm seed && next dev --turbo", - "generate:importmap": "payload generate:importmap", + "dev": "cross-env PAYLOAD_SEED=true PAYLOAD_DROP_DATABASE=true NODE_OPTIONS=--no-deprecation next dev", + "generate:importmap": "cross-env NODE_OPTIONS=--no-deprecation payload generate:importmap", "generate:schema": "payload-graphql generate:schema", "generate:types": "payload generate:types", "payload": "cross-env NODE_OPTIONS=--no-deprecation payload", @@ -16,28 +16,41 @@ "start": "cross-env NODE_OPTIONS=--no-deprecation next start" }, "dependencies": { - "@payloadcms/db-mongodb": "3.0.0-beta.106", - "@payloadcms/next": "3.0.0-beta.106", - "@payloadcms/richtext-lexical": "3.0.0-beta.106", - "@payloadcms/ui": "3.0.0-beta.106", + "@payloadcms/db-mongodb": "beta", + "@payloadcms/next": "beta", + "@payloadcms/richtext-lexical": "beta", + "@payloadcms/ui": "beta", "cross-env": "^7.0.3", "dotenv": "^8.2.0", "graphql": "^16.9.0", - "next": "15.0.0-canary.160", - "payload": "3.0.0-beta.106", - "react": "19.0.0-rc-5dcb0097-20240918", - "react-dom": "19.0.0-rc-5dcb0097-20240918" + "install": "^0.13.0", + "next": "15.0.0", + "payload": "beta", + "react": "19.0.0-rc-65a56d0e-20241020", + "react-dom": "19.0.0-rc-65a56d0e-20241020" }, "devDependencies": { - "@payloadcms/graphql": "3.0.0-beta.106", - "@types/react": "npm:[email protected]", - "@types/react-dom": "npm:[email protected]", + "@payloadcms/graphql": "beta", + "@swc/core": "^1.6.13", + "@types/ejs": "^3.1.5", + "@types/react": "npm:[email protected]", + "@types/react-dom": "npm:[email protected]", "eslint": "^8.57.0", - "eslint-config-next": "15.0.0-canary.146", - "tsx": "^4.7.1", + "eslint-config-next": "15.0.0", + "tsx": "^4.16.2", "typescript": "5.5.2" }, "engines": { "node": "^18.20.2 || >=20.9.0" + }, + "pnpm": { + "overrides": { + "@types/react": "npm:[email protected]", + "@types/react-dom": "npm:[email protected]" + } + }, + "overrides": { + "@types/react": "npm:[email protected]", + "@types/react-dom": "npm:[email protected]" } } diff --git a/examples/custom-components/pnpm-lock.yaml b/examples/custom-components/pnpm-lock.yaml index 3e2e0c6fc30..bf55449ee93 100644 --- a/examples/custom-components/pnpm-lock.yaml +++ b/examples/custom-components/pnpm-lock.yaml @@ -4,22 +4,26 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +overrides: + '@types/react': npm:[email protected] + '@types/react-dom': npm:[email protected] + importers: .: dependencies: '@payloadcms/db-mongodb': - specifier: 3.0.0-beta.106 - version: 3.0.0-beta.106(@aws-sdk/[email protected](@aws-sdk/[email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])) + specifier: beta + version: 3.0.0-beta.134(@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected])))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]) '@payloadcms/next': - specifier: 3.0.0-beta.106 - version: 3.0.0-beta.106([email protected])([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected]) + specifier: beta + version: 3.0.0-beta.134([email protected])([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected]) '@payloadcms/richtext-lexical': - specifier: 3.0.0-beta.106 - version: 3.0.0-beta.106(qmob7ztvrhi3hehnabxq6mtmna) + specifier: beta + version: 3.0.0-beta.134(rum3bl6v33f63ro4asslgdde2u) '@payloadcms/ui': - specifier: 3.0.0-beta.106 - version: 3.0.0-beta.106([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected]) + specifier: beta + version: 3.0.0-beta.134([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected]) cross-env: specifier: ^7.0.3 version: 7.0.3 @@ -29,37 +33,46 @@ importers: graphql: specifier: ^16.9.0 version: 16.9.0 + install: + specifier: ^0.13.0 + version: 0.13.0 next: - specifier: 15.0.0-canary.104 - version: 15.0.0-canary.104([email protected]([email protected]))([email protected])([email protected]) + specifier: 15.0.0 + version: 15.0.0([email protected]([email protected]))([email protected])([email protected]) payload: - specifier: 3.0.0-beta.106 - version: 3.0.0-beta.106([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) + specifier: beta + version: 3.0.0-beta.134([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) react: - specifier: 19.0.0-rc-06d0b89e-20240801 - version: 19.0.0-rc-06d0b89e-20240801 + specifier: 19.0.0-rc-65a56d0e-20241020 + version: 19.0.0-rc-65a56d0e-20241020 react-dom: - specifier: 19.0.0-rc-06d0b89e-20240801 - version: 19.0.0-rc-06d0b89e-20240801([email protected]) + specifier: 19.0.0-rc-65a56d0e-20241020 + version: 19.0.0-rc-65a56d0e-20241020([email protected]) devDependencies: '@payloadcms/graphql': - specifier: 3.0.0-beta.106 - version: 3.0.0-beta.106([email protected])([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]) + specifier: beta + version: 3.0.0-beta.134([email protected])([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]) + '@swc/core': + specifier: ^1.6.13 + version: 1.9.2(@swc/[email protected]) + '@types/ejs': + specifier: ^3.1.5 + version: 3.1.5 '@types/react': - specifier: npm:[email protected] - version: [email protected] + specifier: npm:[email protected] + version: [email protected] '@types/react-dom': - specifier: npm:[email protected] - version: [email protected] + specifier: npm:[email protected] + version: [email protected] eslint: specifier: ^8.57.0 version: 8.57.0 eslint-config-next: - specifier: 15.0.0-canary.146 - version: 15.0.0-canary.146([email protected])([email protected]) + specifier: 15.0.0 + version: 15.0.0([email protected])([email protected]) tsx: - specifier: ^4.7.1 - version: 4.19.0 + specifier: ^4.16.2 + version: 4.19.2 typescript: specifier: 5.5.2 version: 5.5.2 @@ -628,10 +641,6 @@ packages: cpu: [x64] os: [win32] - '@isaacs/[email protected]': - resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} - engines: {node: '>=12'} - '@jridgewell/[email protected]': resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} engines: {node: '>=6.0.0'} @@ -742,65 +751,59 @@ packages: '@mongodb-js/[email protected]': resolution: {integrity: sha512-tVkljjeEaAhCqTzajSdgbQ6gE6f3oneVwa3iXR6csiEwXXOFsiC6Uh9iAjAhXPtqa/XMDHWjjeNH/77m/Yq2dw==} - '@next/[email protected]': - resolution: {integrity: sha512-7wOJhe62uL4ViZOumMwuPev4IxQaXJ4g97iMsXelOF+Q5QuuFXzbxIXh4OJMVAHZJMYkM5VyD2zxV66iYU01DQ==} + '@next/[email protected]': + resolution: {integrity: sha512-Mcv8ZVmEgTO3bePiH/eJ7zHqQEs2gCqZ0UId2RxHmDDc7Pw6ngfSrOFlxG8XDpaex+n2G+TKPsQAf28MO+88Gw==} - '@next/[email protected]': - resolution: {integrity: sha512-6W0ndQvHR9sXcqcKeR/inD2UTRCs9+VkSK3lfaGmEuZs7EjwwXMO2BPYjz9oBrtfPL3xuTjtXsHKSsalYQ5l1Q==} + '@next/[email protected]': + resolution: {integrity: sha512-t9Xy32pjNOvVn2AS+Utt6VmyrshbpfUMhIjFO60gI58deSo/KgLOp31XZ4O+kY/Is8WAGYwA5gR7kOb1eORDBA==} - '@next/[email protected]': - resolution: {integrity: sha512-LxEIbbYzSME/wFHu/dC8XAKY0F6b98ZjItj8ZzI+pB7nenGyE78eNuCzQG3DYWe+CwGNtKHTggYk1DFQTZ+Rjw==} + '@next/[email protected]': + resolution: {integrity: sha512-UG/Gnsq6Sc4wRhO9qk+vc/2v4OfRXH7GEH6/TGlNF5eU/vI9PIO7q+kgd65X2DxJ+qIpHWpzWwlPLmqMi1FE9A==} - '@next/[email protected]': - resolution: {integrity: sha512-tLrkGDlVAch+dwLr0lwZt6t//KQhwJQamTt86bFeSEgmuWg8escVD5608XjIicpy4oYUeTG2e7EDjvW1/9C7+Q==} + '@next/[email protected]': + resolution: {integrity: sha512-Gjgs3N7cFa40a9QT9AEHnuGKq69/bvIOn0SLGDV+ordq07QOP4k1GDOVedMHEjVeqy1HBLkL8rXnNTuMZIv79A==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@next/[email protected]': - resolution: {integrity: sha512-NokpzlJHGzldMdx5ALJi9w8sZbFVQj3KPjMg1EKutvkX8Z0TgZguoj0Hb+0Dh7o6fBK0CqH1mYQd/IgYeqvYew==} + '@next/[email protected]': + resolution: {integrity: sha512-BUtTvY5u9s5berAuOEydAUlVMjnl6ZjXS+xVrMt317mglYZ2XXjY8YRDCaz9vYMjBNPXH8Gh75Cew5CMdVbWTw==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@next/[email protected]': - resolution: {integrity: sha512-U9P1bXaxMyGrY7HdJ1fdtS5vy2yfWF7z1Qt/8OBcZi5y6WWHloZmJ/jRMXxoHJ1lcLSsC1EcubYHgV5ys1NDcA==} + '@next/[email protected]': + resolution: {integrity: sha512-sbCoEpuWUBpYoLSgYrk0CkBv8RFv4ZlPxbwqRHr/BWDBJppTBtF53EvsntlfzQJ9fosYX12xnS6ltxYYwsMBjg==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/[email protected]': - resolution: {integrity: sha512-PDOS3ySD0/YBVvKn/JhQ8xjh4HU4v2MCvqFHaoahu9v1ydmUOeuDRjQk4hUliXgvKuE/ZZksP3a9TrzpbDScsA==} + '@next/[email protected]': + resolution: {integrity: sha512-JAw84qfL81aQCirXKP4VkgmhiDpXJupGjt8ITUkHrOVlBd+3h5kjfPva5M0tH2F9KKSgJQHEo3F5S5tDH9h2ww==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/[email protected]': - resolution: {integrity: sha512-jYNKOIkqL4puFpeNjIZ/riK0+adDyjENjACMlU3HyuG7A0xCYAFxBIbmwjbGmpSv99+PPB/gAbGnB0TT2PDHUQ==} + '@next/[email protected]': + resolution: {integrity: sha512-r5Smd03PfxrGKMewdRf2RVNA1CU5l2rRlvZLQYZSv7FUsXD5bKEcOZ/6/98aqRwL7diXOwD8TCWJk1NbhATQHg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/[email protected]': - resolution: {integrity: sha512-xX3ZUWM4syINdEqsUhvQWBjoFa2P8PL96adQUfph4cpUrkrUbnBQbWA2vSdSvwoC6a80wSX+buuhJptvxzEl3A==} + '@next/[email protected]': + resolution: {integrity: sha512-fM6qocafz4Xjhh79CuoQNeGPhDHGBBUbdVtgNFJOUM8Ih5ZpaDZlTvqvqsh5IoO06CGomxurEGqGz/4eR/FaMQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/[email protected]': - resolution: {integrity: sha512-kUMeZOhueb5wXZTQTPvdl4V4wtJKh49TcVAHS7kcDTU9m8jrIQ3beKURWtzjD4iizgl/iar8CHuYS5CAnCGqAw==} + '@next/[email protected]': + resolution: {integrity: sha512-ZOd7c/Lz1lv7qP/KzR513XEa7QzW5/P0AH3A5eR1+Z/KmDOvMucht0AozccPc0TqhdV1xaXmC0Fdx0hoNzk6ng==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@next/[email protected]': - resolution: {integrity: sha512-6q5HYiACa6GH7+RyTlLMdUlivwi75bw2L9PRYRBuw4C0SvLYMwBf7SlshbrCrNYbIAaGajYJLZjv3IXFnsZBjA==} - engines: {node: '>= 10'} - cpu: [ia32] - os: [win32] - - '@next/[email protected]': - resolution: {integrity: sha512-OeY5GRHRv5qMPwK2e1ipX+EeTDPmRITM9OBeaeIllubWprLGeLxnC1NbKYKCt6IfCboX+wanZKQcbuyH5RMtlg==} + '@next/[email protected]': + resolution: {integrity: sha512-2RVWcLtsqg4LtaoJ3j7RoKpnWHgcrz5XvuUGE7vBYU2i6M2XeD9Y8RlLaF770LEIScrrl8MdWsp6odtC6sZccg==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -821,63 +824,59 @@ packages: resolution: {integrity: sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==} engines: {node: '>=12.4.0'} - '@payloadcms/[email protected]': - resolution: {integrity: sha512-wD3xFuGRmk26S+JTweILknIbjixL1HF+ceLc+lsWDkdYEKeZ3aO8DDGkws51JJ3WlC3NC08Pz1WbGttV+kx+5Q==} + '@payloadcms/[email protected]': + resolution: {integrity: sha512-wiVbmSXdYy5VkOhHRxlScsLk3INmLhzcqn09RSY/EJz89Zw2khh08nJEBtIIbxdcxVVaeZkupwk9zkH/KV2fxw==} peerDependencies: - payload: 3.0.0-beta.106 + payload: 3.0.0-beta.134 - '@payloadcms/[email protected]': - resolution: {integrity: sha512-lLdE/CHz5e7ahOaDpM4+CedYdhm6E+Kuv8EFmkARQwrm9bFyNt6XfGdqp0Fsbwy0ka77Q2rkV640nWOVXBj4ew==} + '@payloadcms/[email protected]': + resolution: {integrity: sha512-XHj9vX8R9rrrUz67Ilu4MixAzT5PjKBs1g21vzKmORiLJAiTMBSQkdFHuvvjvo+F9WIHxhjNFeFIGSPWj5Wdow==} hasBin: true peerDependencies: graphql: ^16.8.1 - payload: 3.0.0-beta.106 + payload: 3.0.0-beta.134 - '@payloadcms/[email protected]': - resolution: {integrity: sha512-343ptzsRzv3usKcB73mH5hALxRq0eO1hCSnyYSuMbTs+Czo3bSV+RLN1k9hs/5S1/Wr3G1b9Mo4/QTaC99240A==} + '@payloadcms/[email protected]': + resolution: {integrity: sha512-dFCuqiFWZ26kmamZ5yTAJ/vRzUlqqiI2HofggUvKPBofd62eqvH6jFQ1iQHmGrA0AuxM/NB1yq0WC81ayFEU4w==} engines: {node: ^18.20.2 || >=20.9.0} peerDependencies: graphql: ^16.8.1 - next: ^15.0.0-canary.104 - payload: 3.0.0-beta.106 + next: ^15.0.0 + payload: 3.0.0-beta.134 - '@payloadcms/[email protected]': - resolution: {integrity: sha512-SB92SGFs/plFASifGL6w8atNMIEUpkatdWWCJXY/OstS++c3lqsB4brs9oWzuMUgdrTBHMXpiYndiK9xc6AS7A==} + '@payloadcms/[email protected]': + resolution: {integrity: sha512-r0Y3Iy2bfMkmdzbXJB0Pl8yfQE4X2y26A1unh9ZUOWLkujy9kwynS+tJZshDlWZfWMC1qGDE0Eq4A/hHH1DB6A==} engines: {node: ^18.20.2 || >=20.9.0} peerDependencies: '@faceless-ui/modal': 3.0.0-beta.2 '@faceless-ui/scroll-info': 2.0.0-beta.0 - '@lexical/headless': 0.17.0 - '@lexical/link': 0.17.0 - '@lexical/list': 0.17.0 - '@lexical/mark': 0.17.0 - '@lexical/markdown': 0.17.0 - '@lexical/react': 0.17.0 - '@lexical/rich-text': 0.17.0 - '@lexical/selection': 0.17.0 - '@lexical/table': 0.17.0 - '@lexical/utils': 0.17.0 - '@payloadcms/next': 3.0.0-beta.106 - lexical: 0.17.0 - payload: 3.0.0-beta.106 - react: ^19.0.0 || ^19.0.0-rc-06d0b89e-20240801 - react-dom: ^19.0.0 || ^19.0.0-rc-06d0b89e-20240801 - - '@payloadcms/[email protected]': - resolution: {integrity: sha512-WHqeHXyz8WR7XgUxf8yzz6JwE4985boduCwm/SW7FrWo71Y34Q6MG62tU/pVJwudDnr/FP4Gv++8XdAr7YUeDg==} - - '@payloadcms/[email protected]': - resolution: {integrity: sha512-p0SDLg6itm5Dvy+gUJ9JJsb/v2uxeBoWrnG93CmLwQrzO4/p3rX2hDTS42PzhmvD4br0e+Qw1r9p3SjXmRRw3A==} + '@lexical/headless': 0.20.0 + '@lexical/link': 0.20.0 + '@lexical/list': 0.20.0 + '@lexical/mark': 0.20.0 + '@lexical/markdown': 0.20.0 + '@lexical/react': 0.20.0 + '@lexical/rich-text': 0.20.0 + '@lexical/selection': 0.20.0 + '@lexical/table': 0.20.0 + '@lexical/utils': 0.20.0 + '@payloadcms/next': 3.0.0-beta.134 + lexical: 0.20.0 + payload: 3.0.0-beta.134 + react: ^19.0.0 || ^19.0.0-rc-65a56d0e-20241020 + react-dom: ^19.0.0 || ^19.0.0-rc-65a56d0e-20241020 + + '@payloadcms/[email protected]': + resolution: {integrity: sha512-TRWHsPQu5wkrqX/CYIWTrQSNvZtxk0mtabjXiqRquX8MWuW4Sd3pxOZ7i0d0pG8SnpGftIzrAo46LsGHYEdutA==} + + '@payloadcms/[email protected]': + resolution: {integrity: sha512-h+1y9V4ct4YwnlzUpCuZTiYAOVMQ2m4/KHKOYAGNbygWIzuSVJ16GkucSnKmYNJi8pkb9KAiMllRVwDSwGPPrw==} engines: {node: ^18.20.2 || >=20.9.0} peerDependencies: - next: ^15.0.0-canary.104 - payload: 3.0.0-beta.106 - react: ^19.0.0 || ^19.0.0-rc-06d0b89e-20240801 - react-dom: ^19.0.0 || ^19.0.0-rc-06d0b89e-20240801 - - '@pkgjs/[email protected]': - resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} - engines: {node: '>=14'} + next: ^15.0.0 + payload: 3.0.0-beta.134 + react: ^19.0.0 || ^19.0.0-rc-65a56d0e-20241020 + react-dom: ^19.0.0 || ^19.0.0-rc-65a56d0e-20241020 '@rtsao/[email protected]': resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==} @@ -1049,11 +1048,83 @@ packages: resolution: {integrity: sha512-rUeT12bxFnplYDe815GXbq/oixEGHfRFFtcTF3YdDi/JaENIM6aSYYLJydG83UNzLXeRI5K8abYd/8Sp/QM0kA==} engines: {node: '>=16.0.0'} + '@swc/[email protected]': + resolution: {integrity: sha512-nETmsCoY29krTF2PtspEgicb3tqw7Ci5sInTI03EU5zpqYbPjoPH99BVTjj0OsF53jP5MxwnLI5Hm21lUn1d6A==} + engines: {node: '>=10'} + cpu: [arm64] + os: [darwin] + + '@swc/[email protected]': + resolution: {integrity: sha512-9gD+bwBz8ZByjP6nZTXe/hzd0tySIAjpDHgkFiUrc+5zGF+rdTwhcNrzxNHJmy6mw+PW38jqII4uspFHUqqxuQ==} + engines: {node: '>=10'} + cpu: [x64] + os: [darwin] + + '@swc/[email protected]': + resolution: {integrity: sha512-kYq8ief1Qrn+WmsTWAYo4r+Coul4dXN6cLFjiPZ29Cv5pyU+GFvSPAB4bEdMzwy99rCR0u2P10UExaeCjurjvg==} + engines: {node: '>=10'} + cpu: [arm] + os: [linux] + + '@swc/[email protected]': + resolution: {integrity: sha512-n0W4XiXlmEIVqxt+rD3ZpkogsEWUk1jJ+i5bQNgB+1JuWh0fBE8c/blDgTQXa0GB5lTPVDZQussgdNOCnAZwiA==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + + '@swc/[email protected]': + resolution: {integrity: sha512-8xzrOmsyCC1zrx2Wzx/h8dVsdewO1oMCwBTLc1gSJ/YllZYTb04pNm6NsVbzUX2tKddJVRgSJXV10j/NECLwpA==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + + '@swc/[email protected]': + resolution: {integrity: sha512-kZrNz/PjRQKcchWF6W292jk3K44EoVu1ad5w+zbS4jekIAxsM8WwQ1kd+yjUlN9jFcF8XBat5NKIs9WphJCVXg==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + + '@swc/[email protected]': + resolution: {integrity: sha512-TTIpR4rjMkhX1lnFR+PSXpaL83TrQzp9znRdp2TzYrODlUd/R20zOwSo9vFLCyH6ZoD47bccY7QeGZDYT3nlRg==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + + '@swc/[email protected]': + resolution: {integrity: sha512-+Eg2d4icItKC0PMjZxH7cSYFLWk0aIp94LNmOw6tPq0e69ax6oh10upeq0D1fjWsKLmOJAWEvnXlayZcijEXDw==} + engines: {node: '>=10'} + cpu: [arm64] + os: [win32] + + '@swc/[email protected]': + resolution: {integrity: sha512-nLWBi4vZDdM/LkiQmPCakof8Dh1/t5EM7eudue04V1lIcqx9YHVRS3KMwEaCoHLGg0c312Wm4YgrWQd9vwZ5zQ==} + engines: {node: '>=10'} + cpu: [ia32] + os: [win32] + + '@swc/[email protected]': + resolution: {integrity: sha512-ik/k+JjRJBFkXARukdU82tSVx0CbExFQoQ78qTO682esbYXzjdB5eLVkoUbwen299pnfr88Kn4kyIqFPTje8Xw==} + engines: {node: '>=10'} + cpu: [x64] + os: [win32] + + '@swc/[email protected]': + resolution: {integrity: sha512-dYyEkO6mRYtZFpnOsnYzv9rY69fHAHoawYOjGOEcxk9WYtaJhowMdP/w6NcOKnz2G7GlZaenjkzkMa6ZeQeMsg==} + engines: {node: '>=10'} + peerDependencies: + '@swc/helpers': '*' + peerDependenciesMeta: + '@swc/helpers': + optional: true + '@swc/[email protected]': resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} - '@swc/[email protected]': - resolution: {integrity: sha512-KMZNXiGibsW9kvZAO1Pam2JPTDBm+KSHMMHWdsyI/1DbIZjT2A6Gy3hblVXUMEDvUAKq+e0vL0X0o54owWji7g==} + '@swc/[email protected]': + resolution: {integrity: sha512-UoKGxQ3r5kYI9dALKJapMmuK+1zWM/H17Z1+iwnNmzcJRnfFuevZs375TA5rW31pu4BS4NoSy1fRsexDXfWn5w==} + + '@swc/[email protected]': + resolution: {integrity: sha512-XKaZ+dzDIQ9Ot9o89oJQ/aluI17+VvUnIpYJTcZtvv1iYX6MzHh3Ik2CSR7MdPKpPwfZXHBeCingb2b4PoDVdw==} '@tokenizer/[email protected]': resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==} @@ -1061,35 +1132,35 @@ packages: '@types/[email protected]': resolution: {integrity: sha512-kG7WrUuAKK0NoyxfQHsVE6j1m01s6kMma64E+OZenQABMQyTJop1DumUWcLwAQ2JzpefU7PDYoRDKl8uZosFjw==} + '@types/[email protected]': + resolution: {integrity: sha512-nv+GSx77ZtXiJzwKdsASqi+YQ5Z7vwHsTP0JY2SiQgjGckkBRKZnk8nIM+7oUZ1VCtuTz0+By4qVR7fqzp/Dfg==} + '@types/[email protected]': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} '@types/[email protected]': resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} + '@types/[email protected]': + resolution: {integrity: sha512-lfx+dftrEZcdBPczf9d0Qv0x+j/rfNCMuC6OcfXmO8gkfeNAY88PgKUbvG56whcN23gc27yenwF6oJZXGFpYxg==} + '@types/[email protected]': resolution: {integrity: sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==} '@types/[email protected]': resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==} - '@types/[email protected]': - resolution: {integrity: sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==} - '@types/[email protected]': resolution: {integrity: sha512-RM05tAniPZ5DZPzzNFP+DmrcOdD0efDUxMy3145oljWSl3x9ZV5vhme98gTxFrj2lhXvmGNnUiuDyJgY9IKkNA==} - '@types/[email protected]': - resolution: {integrity: sha512-WeqMfGJLGuLCqHGYRGHxnKrXcTitc6L/nBUWfWPcTarG3t9PsquqUMuVeXZeca+mglY4Vo5GZjCi0A3Or2lnxA==} - '@types/[email protected]': resolution: {integrity: sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==} '@types/[email protected]': resolution: {integrity: sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==} - '@types/[email protected]': - resolution: {integrity: sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==} + '@types/[email protected]': + resolution: {integrity: sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==} '@typescript-eslint/[email protected]': resolution: {integrity: sha512-rg8LGdv7ri3oAlenMACk9e+AR4wUV0yrrG+XKsGKOK0EVgeEDqurkXMPILG2836fW4ibokTB5v4b6Z9+GYQDEw==} @@ -1151,10 +1222,6 @@ packages: '@ungap/[email protected]': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} - [email protected]: - resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} - engines: {node: '>=6.5'} - [email protected]: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -1175,10 +1242,6 @@ packages: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} - [email protected]: - resolution: {integrity: sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==} - engines: {node: '>=12'} - [email protected]: resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} engines: {node: '>=4'} @@ -1187,10 +1250,6 @@ packages: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} - [email protected]: - resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} - engines: {node: '>=12'} - [email protected]: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} @@ -1259,9 +1318,6 @@ packages: [email protected]: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - [email protected]: - resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - [email protected]: resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} engines: {node: '>=8'} @@ -1285,18 +1341,9 @@ packages: [email protected]: resolution: {integrity: sha512-vgnKAUzcDoa+AeyYwXCoHyF2q6u/8H46dxu5JN+4/TZeq/Dlinn0K6GvxsCLb3LHUJl0m/TLiEK31kUwtgocMQ==} - [email protected]: - resolution: {integrity: sha512-Ry9wCtIZ5kGqkJoi6aD8KjxFZEx78guTQDnpXWiNthsxzrxAK/i8E6pCHAIZTbaEFWcOCvbecMukfK7XUvyLpQ==} - engines: {node: '>=6.9.0'} - - [email protected]: - resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} - - [email protected]: - resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} - - [email protected]: - resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} + [email protected]: + resolution: {integrity: sha512-X9hJeyeM0//Fus+0pc5dSUMhhrrmWwQUtdavaQeF3Ta6m69matZkGWV/MrBcnwUeLC8W9kwwc2hfkZgUuCX3Ig==} + engines: {node: '>=16.20.1'} [email protected]: resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} @@ -1371,8 +1418,8 @@ packages: [email protected]: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - [email protected]: - resolution: {integrity: sha512-uuUHie0sfPP542TKGzPFal0W1wo1beuKAqIZdaavcONx8OoqdnJRKjkinbRTOta4FaCa1RcIL+7mMJWX3pQGVg==} + [email protected]: + resolution: {integrity: sha512-wKGOQRRvdnd89pCeH96e2Fn4wkbenSP6LMHfjfyNLMbGuHEFbMqQNuxXqd0oXG9caIOQ1FTvc5Uijp9/4jujnQ==} [email protected]: resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==} @@ -1381,6 +1428,10 @@ packages: resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==} engines: {node: '>=10'} + [email protected]: + resolution: {integrity: sha512-onMB0OkDjkXunhdW9htFjEhqrD54+M94i6ackoUkjHKbRnXdyEyKRelp4nJ1kAz32+s27jP1FsebpJCVl0BsvA==} + engines: {node: '>=18.0'} + [email protected]: resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} @@ -1420,6 +1471,9 @@ packages: [email protected]: resolution: {integrity: sha512-y8e109LYGgoQDveiEBD3DYXKba1jWf5BA8YU1FL5Tvm0BTdEfy54WLCwnuYWZNnzzvALy/QQ4Hov+Q9RVRv+Zw==} + [email protected]: + resolution: {integrity: sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==} + [email protected]: resolution: {integrity: sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==} @@ -1486,15 +1540,6 @@ packages: resolution: {integrity: sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==} engines: {node: '>=10'} - [email protected]: - resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - - [email protected]: - resolution: {integrity: sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==} - - [email protected]: - resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - [email protected]: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} @@ -1558,10 +1603,10 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} - [email protected]: - resolution: {integrity: sha512-Fq69R4ZCq1nQj93O0KOCuhdb/2ovXVHYSOWoMac9xpGfnGOg+7+GuIh15MtrZ3c5T/odmPwWkI1SRK/zLT9kVw==} + [email protected]: + resolution: {integrity: sha512-HFeTwCR2lFEUWmdB00WZrzaak2CvMvxici38gQknA6Bu2HPizSE4PNFGaFzr5GupjBt+SBJ/E0GIP57ZptOD3g==} peerDependencies: - eslint: ^7.23.0 || ^8.0.0 + eslint: ^7.23.0 || ^8.0.0 || ^9.0.0 typescript: '>=3.3.1' peerDependenciesMeta: typescript: @@ -1604,12 +1649,33 @@ packages: eslint-import-resolver-webpack: optional: true - [email protected]: - resolution: {integrity: sha512-/mHNE9jINJfiD2EKkg1BKyPyUk4zdnT54YgbOgfjSakWT5oyX/qQLVNTkehyfpcMxZXMy1zyonZ2v7hZTX43Yw==} + [email protected]: + resolution: {integrity: sha512-wALZ0HFoytlyh/1+4wuZ9FJCD/leWHQzzrxJ8+rebyReSLk7LApMyd3WJaLVoN+D5+WIdJyDK1c6JnE65V4Zyg==} engines: {node: '>=4'} peerDependencies: '@typescript-eslint/parser': '*' - eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 + eslint: '*' + eslint-import-resolver-node: '*' + eslint-import-resolver-typescript: '*' + eslint-import-resolver-webpack: '*' + peerDependenciesMeta: + '@typescript-eslint/parser': + optional: true + eslint: + optional: true + eslint-import-resolver-node: + optional: true + eslint-import-resolver-typescript: + optional: true + eslint-import-resolver-webpack: + optional: true + + [email protected]: + resolution: {integrity: sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==} + engines: {node: '>=4'} + peerDependencies: + '@typescript-eslint/parser': '*' + eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9 peerDependenciesMeta: '@typescript-eslint/parser': optional: true @@ -1620,11 +1686,11 @@ packages: peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9 - [email protected]: - resolution: {integrity: sha512-QzliNJq4GinDBcD8gPB5v0wh6g8q3SUi6EFF0x8N/BL9PoVs0atuGc47ozMRyOWAKdwaZ5OnbOEa3WR+dSGKuQ==} + [email protected]: + resolution: {integrity: sha512-hIOwI+5hYGpJEc4uPRmz2ulCjAGD/N13Lukkh8cLV0i2IRk/bdZDYjgLVHj+U9Z704kLIdIO6iueGvxNur0sgw==} engines: {node: '>=10'} peerDependencies: - eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 + eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 [email protected]: resolution: {integrity: sha512-Rbj2R9zwP2GYNcIak4xoAMV57hrBh3hTaR0k7hVjwCQgryE/pw5px4b13EYjduOI0hfXyZhwBxaGpOTbWSGzKQ==} @@ -1665,14 +1731,6 @@ packages: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} - [email protected]: - resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} - engines: {node: '>=6'} - - [email protected]: - resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} - engines: {node: '>=0.8.x'} - [email protected]: resolution: {integrity: sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ==} @@ -1710,13 +1768,21 @@ packages: [email protected]: resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} + [email protected]: + resolution: {integrity: sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + [email protected]: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} - [email protected]: - resolution: {integrity: sha512-hlDw5Ev+9e883s0pwUsuuYNu4tD7GgpUnOvykjv1Gya0ZIjuKumthDRua90VUn6/nlRKAjcxLUnHNTIUWwWIiw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + [email protected]: + resolution: {integrity: sha512-mROwiKLZf/Kwa/2Rol+OOZQn1eyTkPB3ZTwC0ExY6OLFCbgxHYZvBm7xI77NvfZFMKBsmuXfmLJnD4eEftEhrA==} + engines: {node: '>=18'} [email protected]: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} @@ -1729,10 +1795,6 @@ packages: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} engines: {node: '>=10'} - [email protected]: - resolution: {integrity: sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==} - engines: {node: '>=18'} - [email protected]: resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} engines: {node: ^10.12.0 || >=12.0.0} @@ -1746,10 +1808,6 @@ packages: [email protected]: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} - [email protected]: - resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} - engines: {node: '>=14'} - [email protected]: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} @@ -1776,8 +1834,8 @@ packages: resolution: {integrity: sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==} engines: {node: '>= 0.4'} - [email protected]: - resolution: {integrity: sha512-Pgba6TExTZ0FJAn1qkJAjIeKoDJ3CsI2ChuLohJnZl/tTU8MVrq3b+2t5UOPfRa4RMsorClBjJALkJUMjG1PAw==} + [email protected]: + resolution: {integrity: sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==} [email protected]: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} @@ -1787,10 +1845,6 @@ packages: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} - [email protected]: - resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} - hasBin: true - [email protected]: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} deprecated: Glob versions prior to v9 are no longer supported @@ -1905,6 +1959,10 @@ packages: [email protected]: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + [email protected]: + resolution: {integrity: sha512-zDml/jzr2PKU9I8J/xyZBQn8rPCAY//UOYNmR01XwNwyfhEWObo2SWfSl1+0tm1u6PhxLwDnfsT/6jB7OUxqFA==} + engines: {node: '>= 0.10'} + [email protected]: resolution: {integrity: sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==} engines: {node: '>= 0.4'} @@ -1971,10 +2029,6 @@ packages: [email protected]: resolution: {integrity: sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw==} - [email protected]: - resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} - engines: {node: '>=8'} - [email protected]: resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} engines: {node: '>= 0.4'} @@ -2050,8 +2104,8 @@ packages: [email protected]: resolution: {integrity: sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==} - [email protected]: - resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + [email protected]: + resolution: {integrity: sha512-AMlnetc9+CV9asI19zHmrgS/WYsWUwCn2R7RzlbJWD7F9eWYUTGyBmU9o6PxngtLGOiDGPRu+Uc4fhKzbpteZQ==} [email protected]: resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} @@ -2078,8 +2132,8 @@ packages: [email protected]: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} - [email protected]: - resolution: {integrity: sha512-gSSg20skxv+ZQqR8Y8itZt+2iYFGNgneuTgf/Va0TBw+zo6JsykDG1bqhkhMs5g/vIdqmZx55oQJLbgOEuxPJw==} + [email protected]: + resolution: {integrity: sha512-iOKdzTUWEVM4nlxpFudFsWyUiu/Jakkga4OZPEt7CGoSEsAsUgdOZqR6pcgx2STBek9Gm4hcarJpXSzIvZ/hKA==} engines: {node: '>=16.0.0'} hasBin: true @@ -2096,22 +2150,12 @@ packages: resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} hasBin: true - [email protected]: - resolution: {integrity: sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==} - engines: {node: '>=12', npm: '>=6'} - [email protected]: resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==} engines: {node: '>=4.0'} - [email protected]: - resolution: {integrity: sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==} - - [email protected]: - resolution: {integrity: sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==} - - [email protected]: - resolution: {integrity: sha512-7jFxRVm+jD+rkq3kY0iZDJfsO2/t4BBPeEb2qKn2lR/9KhuksYk5hxzfRYWMPV8P/x2d0kHD306YyWLzjjH+uA==} + [email protected]: + resolution: {integrity: sha512-C3iHfuGUXK2u8/ipq9LfjFfXFxAZMQJJq7vLS45r3D9Y2xQ/m4S8zaR4zMLFWh9AsNPXmcFfUDhTEO8UIC/V6Q==} engines: {node: '>=12.0.0'} [email protected]: @@ -2147,34 +2191,9 @@ packages: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} - [email protected]: - resolution: {integrity: sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - - [email protected]: - resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==} - - [email protected]: - resolution: {integrity: sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==} - - [email protected]: - resolution: {integrity: sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==} - - [email protected]: - resolution: {integrity: sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==} - - [email protected]: - resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==} - - [email protected]: - resolution: {integrity: sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==} - [email protected]: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} - [email protected]: - resolution: {integrity: sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==} - [email protected]: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} @@ -2182,9 +2201,6 @@ packages: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true - [email protected]: - resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} - [email protected]: resolution: {integrity: sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==} @@ -2212,35 +2228,58 @@ packages: [email protected]: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} - [email protected]: - resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} - engines: {node: '>=16 || 14 >=14.17'} - [email protected]: resolution: {integrity: sha512-xaGwVV1fq343cM7aOYB6lVE4Ugf0UyimdD/x5PWcWBMKENwectaEu77FAN7c5sFiyumqeJdX1RPTh1ocioyDjw==} - [email protected]: - resolution: {integrity: sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==} + [email protected]: + resolution: {integrity: sha512-XqMGwRX0Lgn05TDB4PyG2h2kKO/FfWJyCzYQbIhXUxz7ETt0I/FqHjUeqj37irJ+Dl1ZtU82uYyj14u2XsZKfg==} + + [email protected]: + resolution: {integrity: sha512-gP9vduuYWb9ZkDM546M+MP2qKVk5ZG2wPF63OvSRuUbqCR+11ZCAE1mOfllhlAG0wcoJY5yDL/rV3OmYEwXIzg==} + engines: {node: '>=16.20.1'} + peerDependencies: + '@aws-sdk/credential-providers': ^3.188.0 + '@mongodb-js/zstd': ^1.1.0 + gcp-metadata: ^5.2.0 + kerberos: ^2.0.1 + mongodb-client-encryption: '>=6.0.0 <7' + snappy: ^7.2.2 + socks: ^2.7.1 + peerDependenciesMeta: + '@aws-sdk/credential-providers': + optional: true + '@mongodb-js/zstd': + optional: true + gcp-metadata: + optional: true + kerberos: + optional: true + mongodb-client-encryption: + optional: true + snappy: + optional: true + socks: + optional: true - [email protected]: - resolution: {integrity: sha512-MBuyYiPUPRTqfH2dV0ya4dcr2E5N52ocBuZ8Sgg/M030nGF78v855B3Z27mZJnp8PxjnUquEnAtjOsphgMZOlQ==} - engines: {node: '>=12.9.0'} + [email protected]: + resolution: {integrity: sha512-Ai478tHedZy3U2ITBEp2H4rQEviRan3TK4p/umlFqIzgPF1R0hNKvzzQGIb1l2h+Z32QLU3NqaoWKu4vOOUElQ==} + engines: {node: '>=4.0.0'} - [email protected]: - resolution: {integrity: sha512-xW5GugkE21DJiu9e13EOxKt4ejEKQkRP/S1PkkXRjnk2rRZVKBcld1nPV+VJ/YCPfm8hb3sz9OvI7O38RmixkA==} + [email protected]: + resolution: {integrity: sha512-kFxhot+yw9KmpAGSSrF/o+f00aC2uawgNUbhyaM0USS9L7dln1NA77/pLg4lgOaRgXMtfgCENamjqZwIM1Zrig==} engines: {node: '>=4.0.0'} - [email protected]: - resolution: {integrity: sha512-MNJymaaXali7w7rHBxVUoQ3HzHHMk/7I/+yeeoSa4rUzdjZwIWQznBNvVgc0A8ghuJwsuIkb5LyLV6gSjGjWyQ==} - engines: {node: '>=12.0.0'} + [email protected]: + resolution: {integrity: sha512-l7DgeY1szT98+EKU8GYnga5WnyatAu+kOQ2VlVX1Mxif6A0Umt0YkSiksCiyGxzx8SPhGe9a53ND1GD4yVDrPA==} + engines: {node: '>=16.20.1'} [email protected]: resolution: {integrity: sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==} engines: {node: '>=4.0.0'} - [email protected]: - resolution: {integrity: sha512-J5heI+P08I6VJ2Ky3+33IpCdAvlYGTSUjwTPxkAr8i8EoduPMBX2OY/wa3IKZIQl7MU4SbFk8ndgSKyB/cl1zA==} - engines: {node: '>=12.0.0'} + [email protected]: + resolution: {integrity: sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==} + engines: {node: '>=14.0.0'} [email protected]: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -2253,16 +2292,16 @@ packages: [email protected]: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - [email protected]: - resolution: {integrity: sha512-LVzRmV/p/BGGYmTjlZSmCULmBQ2S5ov1nQAXYssu4cEMhkpklQVgh2I+uHHgo/xgdqIIcEBlUgsfV+CfKVsM6Q==} + [email protected]: + resolution: {integrity: sha512-/ivqF6gCShXpKwY9hfrIQYh8YMge8L3W+w1oRLv/POmK4MOQnh+FscZ8a0fRFTSQWE+2z9ctNYvELD9vP2FV+A==} engines: {node: '>=18.18.0'} hasBin: true peerDependencies: '@opentelemetry/api': ^1.1.0 '@playwright/test': ^1.41.2 babel-plugin-react-compiler: '*' - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801 + react: ^18.2.0 || 19.0.0-rc-65a56d0e-20241020 + react-dom: ^18.2.0 || 19.0.0-rc-65a56d0e-20241020 sass: ^1.3.0 peerDependenciesMeta: '@opentelemetry/api': @@ -2332,21 +2371,10 @@ packages: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} - [email protected]: - resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - [email protected]: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} - [email protected]: - resolution: {integrity: sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - - [email protected]: - resolution: {integrity: sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==} - [email protected]: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -2359,10 +2387,6 @@ packages: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} - [email protected]: - resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - [email protected]: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} @@ -2374,10 +2398,6 @@ packages: [email protected]: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - [email protected]: - resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} - engines: {node: '>=16 || 14 >=14.18'} - [email protected]: resolution: {integrity: sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==} @@ -2385,8 +2405,8 @@ packages: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} - [email protected]: - resolution: {integrity: sha512-LYBzGJWTKEcJNJojQvSEO2BvkAL8MPKG2M8VyYQ1bH1xd74wSc7Nx0L17cavqmbAFqu7zeZrDCSJ1OdOzFFpSg==} + [email protected]: + resolution: {integrity: sha512-1c5PpUt/NqAzAGBy1IR34DC707UnukxySbditZJ8ZDmxEVoRTXoTloL2QV+mLWh5vOUZTPcvUzaTgN1NukRnuw==} engines: {node: ^18.20.2 || >=20.9.0} hasBin: true peerDependencies: @@ -2403,18 +2423,22 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} - [email protected]: - resolution: {integrity: sha512-Guhh8EZfPCfH+PMXAb6rKOjGQEoy0xlAIn+irODG5kgfYV+BQ0rGYYWTIel3P5mmyXqkYkPmdIkywsn6QKUR1Q==} + [email protected]: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + + [email protected]: + resolution: {integrity: sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==} - [email protected]: - resolution: {integrity: sha512-O05NuD9tkRasFRWVaF/uHLOvoRDFD7tb5VMertr78rbsYFjYp48Vg3477EshVAF5eZaEw+OpDl/tu+B0R5o+7g==} + [email protected]: + resolution: {integrity: sha512-cQBBIVG3YajgoUjo1FdKVRX6t9XPxwB9lcNJVD5GCnNM4Y6T12YYx8c6zEejxQsU0wrg9TwmDulcE9LR7qcJqA==} hasBin: true [email protected]: resolution: {integrity: sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA==} - [email protected]: - resolution: {integrity: sha512-afSfrq/hUiW/MFmQcLEwV9Zh8Ry6MrMTOyBU53o/fc0gEl+1OZ/Fks/xQCM2nOC0C/OfDtQMnT2d8c3kpcfSzA==} + [email protected]: + resolution: {integrity: sha512-xSEmD4pLnV54t0NOUN16yCl7RIB1c5UUOse5HSyEXtBp+FgFQyPeDutc+Q2ZO7/22vImV7VfEjH/1zV2QuqvYw==} hasBin: true [email protected]: @@ -2442,12 +2466,8 @@ packages: resolution: {integrity: sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==} engines: {node: '>=6'} - [email protected]: - resolution: {integrity: sha512-mqn0kFRl0EoqhnL0GQ0veqFHyIN1yig9RHh/InzORTUiZHFRAur+aMtRkELNwGs9aNwKS6tg/An4NYBPGwvtzQ==} - - [email protected]: - resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} - engines: {node: '>= 0.6.0'} + [email protected]: + resolution: {integrity: sha512-/MyYDxttz7DfGMMHiysAsFE4qF+pQYAA8ziO/3NcRVrQ5fSk+Mns4QZA/oRPFzvcqNoVJXQNWNAsdwBXLUkQKw==} [email protected]: resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} @@ -2496,10 +2516,10 @@ packages: react: ^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 react-dom: ^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 - [email protected]: - resolution: {integrity: sha512-6JIbEXFwsRkI3gLKhcmjvQ3GKsP4NR/BjPyTKyp7xYeQEeiH01TypGVbc/K6nU1/y4jNGFGkxH3ZFbKKZwCecw==} + [email protected]: + resolution: {integrity: sha512-OrsgAX3LQ6JtdBJayK4nG1Hj5JebzWyhKSsrP/bmkeFxulb0nG2LaPloJ6kBkAxtgjiwRyGUciJ4+Qu64gy/KA==} peerDependencies: - react: 19.0.0-rc-06d0b89e-20240801 + react: 19.0.0-rc-65a56d0e-20241020 [email protected]: resolution: {integrity: sha512-uM9uPzZJTF6wRQORmSrvOIgt4lJ9MC1sNgEOj2XGsDTRE4kmpWxg7ENK9EWNKJRMAOY9z0MuF4yIfl6gp4sotA==} @@ -2538,22 +2558,10 @@ packages: react: '>=16.6.0' react-dom: '>=16.6.0' - [email protected]: - resolution: {integrity: sha512-moBKIME1GBgs8onH1xCs+gzPWyLF62m+2XbD4GpirxeRDca7GLA8UQZO9IuQvf1uxCpVWCG8FrpU/D2x7Plknw==} + [email protected]: + resolution: {integrity: sha512-rZqpfd9PP/A97j9L1MR6fvWSMgs3khgIyLd0E+gYoCcLrxXndj+ySPRVlDPDC3+f7rm8efHNL4B6HeapqU6gzw==} engines: {node: '>=0.10.0'} - [email protected]: - resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} - engines: {node: '>= 6'} - - [email protected]: - resolution: {integrity: sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - - [email protected]: - resolution: {integrity: sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==} - engines: {node: '>=8'} - [email protected]: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} @@ -2608,9 +2616,6 @@ packages: resolution: {integrity: sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==} engines: {node: '>=0.4'} - [email protected]: - resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} - [email protected]: resolution: {integrity: sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==} engines: {node: '>= 0.4'} @@ -2627,11 +2632,11 @@ packages: engines: {node: '>=14.0.0'} hasBin: true - [email protected]: - resolution: {integrity: sha512-5RF+494IBigvBHUPYId9MhAWyN0cZZq3o82oAbYvZuc2IFc4mZYHS3z2MuJ5Lwm39zGWDEzB404X6BO47zbt5w==} + [email protected]: + resolution: {integrity: sha512-360BMNajOhMyrirau0pzWVgeakvrfjbfdqHnX2K+tSGTmn6tBN+6K5NhhaebqeXXWyCU3rl5FApjgF2GN0W5JA==} - [email protected]: - resolution: {integrity: sha512-qS+xGFF7AljP2APO2iJe8zESNsK20k25MACz+WGOXPybUsRdi1ssvaoF93im2nSX2q/XT3wKkjdz6RQfbmaxdw==} + [email protected]: + resolution: {integrity: sha512-HxWcXSy0sNnf+TKRkMwyVD1z19AAVQ4gUub8m7VxJUUfSu3J4lr1T+AagohKEypiW5dbQhJuCtAumPY6z9RQ1g==} [email protected]: resolution: {integrity: sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==} @@ -2672,12 +2677,8 @@ packages: resolution: {integrity: sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==} engines: {node: '>= 0.4'} - [email protected]: - resolution: {integrity: sha512-Wv6BjQ5zbhW7VFefWusVP33T/EM0vYikCaQ2qR8yULbsilAT8/wQaXvuQ3ptGLpoKx+lihJE3y2UTgKDyyNHZQ==} - - [email protected]: - resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} - engines: {node: '>=14'} + [email protected]: + resolution: {integrity: sha512-Rtlj66/b0ICeFzYTuNvX/EF1igRbbnGSvEyT79McoZa/DeGhMyC5pWKOEsZKnpkqtSeovd5FL/bjHWC3CIIvCQ==} [email protected]: resolution: {integrity: sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==} @@ -2734,14 +2735,6 @@ packages: resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} engines: {node: '>=10.0.0'} - [email protected]: - resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} - engines: {node: '>=8'} - - [email protected]: - resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} - engines: {node: '>=12'} - [email protected]: resolution: {integrity: sha512-E34CkBgyeqNDcrbU76cDjL5JLcVrtSdYq0MEh/B10r17pRP4ciHLwTgnuLV8Ay6cgEMLkcBkFCKyFZ43YldYzg==} @@ -2763,17 +2756,10 @@ packages: resolution: {integrity: sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==} engines: {node: '>= 0.4'} - [email protected]: - resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} - [email protected]: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} - [email protected]: - resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} - engines: {node: '>=12'} - [email protected]: resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} engines: {node: '>=4'} @@ -2785,8 +2771,8 @@ packages: [email protected]: resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==} - [email protected]: - resolution: {integrity: sha512-mKX8HA/cdBqMKUr0MMZAFssCkIGoZeSCMXgnt79yKxNFguMLVFgRe6wB+fsL0NmoHDbeyZXczy7vEPSoo3rkzg==} + [email protected]: + resolution: {integrity: sha512-ExzDvHYPj6F6QkSNe/JxSlBxTh3OrI6wrAIz53ulxo1c4hBJ1bT9C/JrAthEKHWG9riVH3Xzg7B03Oxty6S2Lw==} engines: {node: '>=16'} [email protected]: @@ -2830,6 +2816,10 @@ packages: [email protected]: resolution: {integrity: sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==} + [email protected]: + resolution: {integrity: sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==} + engines: {node: '>=12.0.0'} + [email protected]: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} engines: {node: '>=4'} @@ -2838,13 +2828,13 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} - [email protected]: - resolution: {integrity: sha512-Y2fmSnZjQdDb9W4w4r1tswlMHylzWIeOKpx0aZH9BgGtACHhrk3OkT52AzwcuqTRBZtvvnTjDBh8eynMulu8Vg==} + [email protected]: + resolution: {integrity: sha512-lbDrTLVsHhOMljPscd0yitpozq7Ga2M5Cvez5AjGg8GASBjtt6iERCAJ93yommPmz62fb45oFIXHEZ3u9bfJEA==} engines: {node: '>=14.16'} - [email protected]: - resolution: {integrity: sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==} - engines: {node: '>=12'} + [email protected]: + resolution: {integrity: sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==} + engines: {node: '>=14'} [email protected]: resolution: {integrity: sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==} @@ -2855,8 +2845,8 @@ packages: peerDependencies: typescript: '>=4.2.0' - [email protected]: - resolution: {integrity: sha512-Xwag0TULqriaugXqVdDiGZ5wuZpqABZlpwQ2Ho4GDyiu/R2Xjkp/9+zcFxL7uzeLl/QCPrflnvpVYyS3ouT7Zw==} + [email protected]: + resolution: {integrity: sha512-/FrVAZ76JLTWxJOERk04fm8hYENDo0PWSP3YLQKxevLwWtxemGcl5JJEzN4iqfDlRve0ckyfFaOBu4xbNH/wZw==} peerDependencies: typescript: '>=4.5.0' peerDependenciesMeta: @@ -2869,13 +2859,8 @@ packages: [email protected]: resolution: {integrity: sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==} - [email protected]: - resolution: {integrity: sha512-bV30kM7bsLZKZIOCHeMNVMJ32/LuJzLVajkQI/qf92J2Qr08ueLQvW00PUZGiuLPP760UINwupgUj8qrSCPUKg==} - engines: {node: '>=18.0.0'} - hasBin: true - - [email protected]: - resolution: {integrity: sha512-0flMz1lh74BR4wOvBjuh9olbnwqCPc35OOlfyzHba0Dc+QNUeWX/Gq2YTbnwcWPO3BMd8fkzRVrHcsR+a7z7rA==} + [email protected]: + resolution: {integrity: sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==} engines: {node: '>=18.0.0'} hasBin: true @@ -2903,27 +2888,27 @@ packages: resolution: {integrity: sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==} engines: {node: '>= 0.4'} - [email protected]: - resolution: {integrity: sha512-U1qAZtPiPsv7R6BJlxeXFZsPre2jBG/DtzWJ0tAqqZfwuySo+0pT0df39wn+42OaHvXNDterwC4O0uw8el5BXQ==} + [email protected]: + resolution: {integrity: sha512-VSLZJl8VXCD0fAWp7DUTFUDCcZ8DVXOQmjhJMD03odgeFmu14ZQJHCXeETm3BEAhJqfgJaFkLnGkQv88sRx0fQ==} - [email protected]: - resolution: {integrity: sha512-bcE50h2P/Ajmf3jMPIqL01PDqxo8lwqRIy3idjyadaLKF9vcXbma2CsJkKj0KHBAFllQZkXLTJ8ZpwmUnTv5EQ==} + [email protected]: + resolution: {integrity: sha512-RshndUfqTW6K3STLPis8BtAYCGOkMbtvYsi90gmVNDZBXUyUc5juf2PE9LfS/JmOlUIRO8cWTS/1MTnmhjDqyQ==} [email protected]: resolution: {integrity: sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==} engines: {node: '>=14.17'} hasBin: true + [email protected]: + resolution: {integrity: sha512-ZPtzy0hu4cZjv3z5NW9gfKnNLjoz4y6uv4HlelAjDK7sY/xOkKZv9xK/WQpcsBB3jEybChz9DPC2U/+cusjJVQ==} + engines: {node: '>=18'} + [email protected]: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} [email protected]: resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} - [email protected]: - resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} - engines: {node: '>=18'} - [email protected]: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} @@ -2945,9 +2930,6 @@ packages: [email protected]: resolution: {integrity: sha512-Xn0w3MtiQ6zoz2vFyUVruaCL53O/DwUvkEeOvj+uulMm0BkUGYWmBYVyElqZaSLhY6ZD0ulfU3aBra2aVT4xfA==} - [email protected]: - resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - [email protected]: resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==} hasBin: true @@ -2960,9 +2942,9 @@ packages: resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} engines: {node: '>=12'} - [email protected]: - resolution: {integrity: sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==} - engines: {node: '>=12'} + [email protected]: + resolution: {integrity: sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==} + engines: {node: '>=16'} [email protected]: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} @@ -2988,14 +2970,6 @@ packages: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} - [email protected]: - resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} - engines: {node: '>=10'} - - [email protected]: - resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} - engines: {node: '>=12'} - [email protected]: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} @@ -3028,10 +3002,6 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} - [email protected]: - resolution: {integrity: sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==} - engines: {node: '>=12.20'} - snapshots: '@apidevtools/[email protected]': @@ -3542,29 +3512,29 @@ snapshots: '@babel/helper-validator-identifier': 7.24.7 to-fast-properties: 2.0.0 - '@dnd-kit/[email protected]([email protected])': + '@dnd-kit/[email protected]([email protected])': dependencies: - react: 19.0.0-rc-06d0b89e-20240801 + react: 19.0.0-rc-65a56d0e-20241020 tslib: 2.7.0 - '@dnd-kit/[email protected]([email protected]([email protected]))([email protected])': + '@dnd-kit/[email protected]([email protected]([email protected]))([email protected])': dependencies: - '@dnd-kit/accessibility': 3.1.0([email protected]) - '@dnd-kit/utilities': 3.2.2([email protected]) - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) + '@dnd-kit/accessibility': 3.1.0([email protected]) + '@dnd-kit/utilities': 3.2.2([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) tslib: 2.7.0 - '@dnd-kit/[email protected](@dnd-kit/[email protected]([email protected]([email protected]))([email protected]))([email protected])': + '@dnd-kit/[email protected](@dnd-kit/[email protected]([email protected]([email protected]))([email protected]))([email protected])': dependencies: - '@dnd-kit/core': 6.0.8([email protected]([email protected]))([email protected]) - '@dnd-kit/utilities': 3.2.2([email protected]) - react: 19.0.0-rc-06d0b89e-20240801 + '@dnd-kit/core': 6.0.8([email protected]([email protected]))([email protected]) + '@dnd-kit/utilities': 3.2.2([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 tslib: 2.7.0 - '@dnd-kit/[email protected]([email protected])': + '@dnd-kit/[email protected]([email protected])': dependencies: - react: 19.0.0-rc-06d0b89e-20240801 + react: 19.0.0-rc-65a56d0e-20241020 tslib: 2.7.0 '@emnapi/[email protected]': @@ -3610,19 +3580,19 @@ snapshots: '@emotion/[email protected]': {} - '@emotion/[email protected]([email protected])([email protected])': + '@emotion/[email protected]([email protected])([email protected])': dependencies: '@babel/runtime': 7.25.6 '@emotion/babel-plugin': 11.12.0 '@emotion/cache': 11.13.1 '@emotion/serialize': 1.3.1 - '@emotion/use-insertion-effect-with-fallbacks': 1.1.0([email protected]) + '@emotion/use-insertion-effect-with-fallbacks': 1.1.0([email protected]) '@emotion/utils': 1.4.0 '@emotion/weak-memoize': 0.4.0 hoist-non-react-statics: 3.3.2 - react: 19.0.0-rc-06d0b89e-20240801 + react: 19.0.0-rc-65a56d0e-20241020 optionalDependencies: - '@types/react': [email protected] + '@types/react': [email protected] transitivePeerDependencies: - supports-color @@ -3638,9 +3608,9 @@ snapshots: '@emotion/[email protected]': {} - '@emotion/[email protected]([email protected])': + '@emotion/[email protected]([email protected])': dependencies: - react: 19.0.0-rc-06d0b89e-20240801 + react: 19.0.0-rc-65a56d0e-20241020 '@emotion/[email protected]': {} @@ -3741,23 +3711,23 @@ snapshots: '@eslint/[email protected]': {} - '@faceless-ui/[email protected]([email protected]([email protected]))([email protected])': + '@faceless-ui/[email protected]([email protected]([email protected]))([email protected])': dependencies: body-scroll-lock: 4.0.0-beta.0 focus-trap: 7.5.4 - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) - react-transition-group: 4.4.5([email protected]([email protected]))([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) + react-transition-group: 4.4.5([email protected]([email protected]))([email protected]) - '@faceless-ui/[email protected]([email protected]([email protected]))([email protected])': + '@faceless-ui/[email protected]([email protected]([email protected]))([email protected])': dependencies: - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) - '@faceless-ui/[email protected]([email protected]([email protected]))([email protected])': + '@faceless-ui/[email protected]([email protected]([email protected]))([email protected])': dependencies: - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) '@floating-ui/[email protected]': dependencies: @@ -3768,18 +3738,18 @@ snapshots: '@floating-ui/core': 1.6.7 '@floating-ui/utils': 0.2.7 - '@floating-ui/[email protected]([email protected]([email protected]))([email protected])': + '@floating-ui/[email protected]([email protected]([email protected]))([email protected])': dependencies: '@floating-ui/dom': 1.6.10 - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) - '@floating-ui/[email protected]([email protected]([email protected]))([email protected])': + '@floating-ui/[email protected]([email protected]([email protected]))([email protected])': dependencies: - '@floating-ui/react-dom': 2.1.1([email protected]([email protected]))([email protected]) + '@floating-ui/react-dom': 2.1.1([email protected]([email protected]))([email protected]) '@floating-ui/utils': 0.2.7 - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) tabbable: 6.2.0 '@floating-ui/[email protected]': {} @@ -3871,15 +3841,6 @@ snapshots: '@img/[email protected]': optional: true - '@isaacs/[email protected]': - dependencies: - string-width: 5.1.2 - string-width-cjs: [email protected] - strip-ansi: 7.1.0 - strip-ansi-cjs: [email protected] - wrap-ansi: 8.1.0 - wrap-ansi-cjs: [email protected] - '@jridgewell/[email protected]': dependencies: '@jridgewell/set-array': 1.2.1 @@ -3913,7 +3874,7 @@ snapshots: lexical: 0.17.0 prismjs: 1.29.0 - '@lexical/[email protected]([email protected]([email protected]))([email protected])': + '@lexical/[email protected]([email protected]([email protected]))([email protected])': dependencies: '@lexical/html': 0.17.0 '@lexical/link': 0.17.0 @@ -3921,8 +3882,8 @@ snapshots: '@lexical/table': 0.17.0 '@lexical/utils': 0.17.0 lexical: 0.17.0 - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) '@lexical/[email protected]': dependencies: @@ -3988,11 +3949,11 @@ snapshots: '@lexical/utils': 0.17.0 lexical: 0.17.0 - '@lexical/[email protected]([email protected]([email protected]))([email protected])([email protected])': + '@lexical/[email protected]([email protected]([email protected]))([email protected])([email protected])': dependencies: '@lexical/clipboard': 0.17.0 '@lexical/code': 0.17.0 - '@lexical/devtools-core': 0.17.0([email protected]([email protected]))([email protected]) + '@lexical/devtools-core': 0.17.0([email protected]([email protected]))([email protected]) '@lexical/dragon': 0.17.0 '@lexical/hashtag': 0.17.0 '@lexical/history': 0.17.0 @@ -4009,9 +3970,9 @@ snapshots: '@lexical/utils': 0.17.0 '@lexical/yjs': 0.17.0([email protected]) lexical: 0.17.0 - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) - react-error-boundary: 3.1.4([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) + react-error-boundary: 3.1.4([email protected]) transitivePeerDependencies: - yjs @@ -4053,51 +4014,47 @@ snapshots: monaco-editor: 0.51.0 state-local: 1.0.7 - '@monaco-editor/[email protected]([email protected])([email protected]([email protected]))([email protected])': + '@monaco-editor/[email protected]([email protected])([email protected]([email protected]))([email protected])': dependencies: '@monaco-editor/loader': 1.4.0([email protected]) monaco-editor: 0.51.0 - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) '@mongodb-js/[email protected]': dependencies: sparse-bitfield: 3.0.3 - optional: true - '@next/[email protected]': {} + '@next/[email protected]': {} - '@next/[email protected]': {} + '@next/[email protected]': {} - '@next/[email protected]': + '@next/[email protected]': dependencies: fast-glob: 3.3.1 - '@next/[email protected]': - optional: true - - '@next/[email protected]': + '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true '@nodelib/[email protected]': @@ -4114,88 +4071,91 @@ snapshots: '@nolyfill/[email protected]': {} - '@payloadcms/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))': + '@payloadcms/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected])))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])': dependencies: - bson-objectid: 2.0.4 http-status: 1.6.2 - mongoose: 6.12.3(@aws-sdk/[email protected](@aws-sdk/[email protected])) - mongoose-paginate-v2: 1.7.22 - payload: 3.0.0-beta.106([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) + mongoose: 8.8.1(@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected])))([email protected]) + mongoose-aggregate-paginate-v2: 1.1.2 + mongoose-paginate-v2: 1.8.5 + payload: 3.0.0-beta.134([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) prompts: 2.4.2 uuid: 10.0.0 transitivePeerDependencies: - - '@aws-sdk/client-sso-oidc' - - aws-crt + - '@aws-sdk/credential-providers' + - '@mongodb-js/zstd' + - gcp-metadata + - kerberos + - mongodb-client-encryption + - snappy + - socks - supports-color - '@payloadcms/[email protected]([email protected])([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])': + '@payloadcms/[email protected]([email protected])([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])': dependencies: graphql: 16.9.0 graphql-scalars: 1.22.2([email protected]) - payload: 3.0.0-beta.106([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) + payload: 3.0.0-beta.134([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) pluralize: 8.0.0 - ts-essentials: 10.0.2([email protected]) - tsx: 4.19.1 + ts-essentials: 10.0.3([email protected]) + tsx: 4.19.2 transitivePeerDependencies: - typescript - '@payloadcms/[email protected]([email protected])([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected])': + '@payloadcms/[email protected]([email protected])([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected])': dependencies: - '@dnd-kit/core': 6.0.8([email protected]([email protected]))([email protected]) - '@payloadcms/graphql': 3.0.0-beta.106([email protected])([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]) - '@payloadcms/translations': 3.0.0-beta.106 - '@payloadcms/ui': 3.0.0-beta.106([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected]) + '@dnd-kit/core': 6.0.8([email protected]([email protected]))([email protected]) + '@payloadcms/graphql': 3.0.0-beta.134([email protected])([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]) + '@payloadcms/translations': 3.0.0-beta.134 + '@payloadcms/ui': 3.0.0-beta.134([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected]) busboy: 1.6.0 - file-type: 17.1.6 + file-type: 19.3.0 graphql: 16.9.0 graphql-http: 1.22.1([email protected]) graphql-playground-html: 1.6.30 http-status: 1.6.2 - next: 15.0.0-canary.104([email protected]([email protected]))([email protected])([email protected]) + next: 15.0.0([email protected]([email protected]))([email protected])([email protected]) path-to-regexp: 6.2.2 - payload: 3.0.0-beta.106([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) + payload: 3.0.0-beta.134([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) qs-esm: 7.0.2 - react-diff-viewer-continued: 3.2.6([email protected]([email protected]))([email protected]) + react-diff-viewer-continued: 3.2.6([email protected]([email protected]))([email protected]) sass: 1.77.4 - sonner: 1.5.0([email protected]([email protected]))([email protected]) + sonner: 1.5.0([email protected]([email protected]))([email protected]) uuid: 10.0.0 - ws: 8.18.0 transitivePeerDependencies: - '@types/react' - - bufferutil - monaco-editor - react - react-dom - supports-color - typescript - - utf-8-validate - '@payloadcms/[email protected](qmob7ztvrhi3hehnabxq6mtmna)': + '@payloadcms/[email protected](rum3bl6v33f63ro4asslgdde2u)': dependencies: - '@faceless-ui/modal': 3.0.0-beta.2([email protected]([email protected]))([email protected]) - '@faceless-ui/scroll-info': 2.0.0-beta.0([email protected]([email protected]))([email protected]) + '@faceless-ui/modal': 3.0.0-beta.2([email protected]([email protected]))([email protected]) + '@faceless-ui/scroll-info': 2.0.0-beta.0([email protected]([email protected]))([email protected]) '@lexical/headless': 0.17.0 '@lexical/link': 0.17.0 '@lexical/list': 0.17.0 '@lexical/mark': 0.17.0 '@lexical/markdown': 0.17.0 - '@lexical/react': 0.17.0([email protected]([email protected]))([email protected])([email protected]) + '@lexical/react': 0.17.0([email protected]([email protected]))([email protected])([email protected]) '@lexical/rich-text': 0.17.0 '@lexical/selection': 0.17.0 '@lexical/table': 0.17.0 '@lexical/utils': 0.17.0 - '@payloadcms/next': 3.0.0-beta.106([email protected])([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected]) - '@payloadcms/translations': 3.0.0-beta.106 - '@payloadcms/ui': 3.0.0-beta.106([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected]) + '@payloadcms/next': 3.0.0-beta.134([email protected])([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected]) + '@payloadcms/translations': 3.0.0-beta.134 + '@payloadcms/ui': 3.0.0-beta.134([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected]) '@types/uuid': 10.0.0 bson-objectid: 2.0.4 dequal: 2.0.3 escape-html: 1.0.3 lexical: 0.17.0 - payload: 3.0.0-beta.106([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) - react-error-boundary: 4.0.13([email protected]) + payload: 3.0.0-beta.134([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) + react-error-boundary: 4.0.13([email protected]) + ts-essentials: 10.0.3([email protected]) uuid: 10.0.0 transitivePeerDependencies: - '@types/react' @@ -4204,38 +4164,38 @@ snapshots: - supports-color - typescript - '@payloadcms/[email protected]': + '@payloadcms/[email protected]': dependencies: - date-fns: 3.3.1 + date-fns: 4.1.0 - '@payloadcms/[email protected]([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected])': + '@payloadcms/[email protected]([email protected])([email protected]([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected])': dependencies: - '@dnd-kit/core': 6.0.8([email protected]([email protected]))([email protected]) - '@dnd-kit/sortable': 7.0.2(@dnd-kit/[email protected]([email protected]([email protected]))([email protected]))([email protected]) - '@faceless-ui/modal': 3.0.0-beta.2([email protected]([email protected]))([email protected]) - '@faceless-ui/scroll-info': 2.0.0-beta.0([email protected]([email protected]))([email protected]) - '@faceless-ui/window-info': 3.0.0-beta.0([email protected]([email protected]))([email protected]) - '@monaco-editor/react': 4.6.0([email protected])([email protected]([email protected]))([email protected]) - '@payloadcms/translations': 3.0.0-beta.106 + '@dnd-kit/core': 6.0.8([email protected]([email protected]))([email protected]) + '@dnd-kit/sortable': 7.0.2(@dnd-kit/[email protected]([email protected]([email protected]))([email protected]))([email protected]) + '@faceless-ui/modal': 3.0.0-beta.2([email protected]([email protected]))([email protected]) + '@faceless-ui/scroll-info': 2.0.0-beta.0([email protected]([email protected]))([email protected]) + '@faceless-ui/window-info': 3.0.0-beta.0([email protected]([email protected]))([email protected]) + '@monaco-editor/react': 4.6.0([email protected])([email protected]([email protected]))([email protected]) + '@payloadcms/translations': 3.0.0-beta.134 body-scroll-lock: 4.0.0-beta.0 bson-objectid: 2.0.4 - date-fns: 3.3.1 + date-fns: 4.1.0 dequal: 2.0.3 md5: 2.3.0 - next: 15.0.0-canary.104([email protected]([email protected]))([email protected])([email protected]) + next: 15.0.0([email protected]([email protected]))([email protected])([email protected]) object-to-formdata: 4.5.1 - payload: 3.0.0-beta.106([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) + payload: 3.0.0-beta.134([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) qs-esm: 7.0.2 - react: 19.0.0-rc-06d0b89e-20240801 - react-animate-height: 2.1.2([email protected]([email protected]))([email protected]) - react-datepicker: 6.9.0([email protected]([email protected]))([email protected]) - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) - react-image-crop: 10.1.8([email protected]) - react-select: 5.8.0([email protected]([email protected]))([email protected])([email protected]) - scheduler: 0.25.0-rc-f994737d14-20240522 - sonner: 1.5.0([email protected]([email protected]))([email protected]) - ts-essentials: 10.0.2([email protected]) - use-context-selector: 2.0.0([email protected])([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-animate-height: 2.1.2([email protected]([email protected]))([email protected]) + react-datepicker: 6.9.0([email protected]([email protected]))([email protected]) + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) + react-image-crop: 10.1.8([email protected]) + react-select: 5.8.0([email protected]([email protected]))([email protected])([email protected]) + scheduler: 0.0.0-experimental-3edc000d-20240926 + sonner: 1.5.0([email protected]([email protected]))([email protected]) + ts-essentials: 10.0.3([email protected]) + use-context-selector: 2.0.0([email protected])([email protected]) uuid: 10.0.0 transitivePeerDependencies: - '@types/react' @@ -4243,9 +4203,6 @@ snapshots: - supports-color - typescript - '@pkgjs/[email protected]': - optional: true - '@rtsao/[email protected]': {} '@rushstack/[email protected]': {} @@ -4559,46 +4516,93 @@ snapshots: tslib: 2.7.0 optional: true + '@swc/[email protected]': + optional: true + + '@swc/[email protected]': + optional: true + + '@swc/[email protected]': + optional: true + + '@swc/[email protected]': + optional: true + + '@swc/[email protected]': + optional: true + + '@swc/[email protected]': + optional: true + + '@swc/[email protected]': + optional: true + + '@swc/[email protected]': + optional: true + + '@swc/[email protected]': + optional: true + + '@swc/[email protected]': + optional: true + + '@swc/[email protected](@swc/[email protected])': + dependencies: + '@swc/counter': 0.1.3 + '@swc/types': 0.1.15 + optionalDependencies: + '@swc/core-darwin-arm64': 1.9.2 + '@swc/core-darwin-x64': 1.9.2 + '@swc/core-linux-arm-gnueabihf': 1.9.2 + '@swc/core-linux-arm64-gnu': 1.9.2 + '@swc/core-linux-arm64-musl': 1.9.2 + '@swc/core-linux-x64-gnu': 1.9.2 + '@swc/core-linux-x64-musl': 1.9.2 + '@swc/core-win32-arm64-msvc': 1.9.2 + '@swc/core-win32-ia32-msvc': 1.9.2 + '@swc/core-win32-x64-msvc': 1.9.2 + '@swc/helpers': 0.5.13 + '@swc/[email protected]': {} - '@swc/[email protected]': + '@swc/[email protected]': dependencies: tslib: 2.7.0 + '@swc/[email protected]': + dependencies: + '@swc/counter': 0.1.3 + '@tokenizer/[email protected]': {} '@types/[email protected]': dependencies: '@types/node': 22.5.4 + '@types/[email protected]': {} + '@types/[email protected]': {} '@types/[email protected]': {} + '@types/[email protected]': {} + '@types/[email protected]': dependencies: undici-types: 6.19.8 '@types/[email protected]': {} - '@types/[email protected]': {} - '@types/[email protected]': dependencies: - '@types/react': 18.3.5 - - '@types/[email protected]': - dependencies: - '@types/prop-types': 15.7.12 - csstype: 3.1.3 + '@types/react': [email protected] '@types/[email protected]': {} '@types/[email protected]': {} - '@types/[email protected]': + '@types/[email protected]': dependencies: - '@types/node': 22.5.4 '@types/webidl-conversions': 7.0.3 '@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])': @@ -4684,10 +4688,6 @@ snapshots: '@ungap/[email protected]': {} - [email protected]: - dependencies: - event-target-shim: 5.0.1 - [email protected]([email protected]): dependencies: acorn: 8.12.1 @@ -4710,8 +4710,6 @@ snapshots: [email protected]: {} - [email protected]: {} - [email protected]: dependencies: color-convert: 1.9.3 @@ -4720,8 +4718,6 @@ snapshots: dependencies: color-convert: 2.0.1 - [email protected]: {} - [email protected]: dependencies: normalize-path: 3.0.0 @@ -4818,8 +4814,6 @@ snapshots: [email protected]: {} - [email protected]: {} - [email protected]: {} [email protected]: {} @@ -4842,21 +4836,7 @@ snapshots: [email protected]: {} - [email protected]: - dependencies: - buffer: 5.7.1 - - [email protected]: {} - - [email protected]: - dependencies: - base64-js: 1.5.1 - ieee754: 1.2.1 - - [email protected]: - dependencies: - base64-js: 1.5.1 - ieee754: 1.2.1 + [email protected]: {} [email protected]: dependencies: @@ -4937,7 +4917,7 @@ snapshots: [email protected]: {} - [email protected]: + [email protected]: dependencies: simple-wcswidth: 1.0.1 @@ -4951,6 +4931,8 @@ snapshots: path-type: 4.0.0 yaml: 1.10.2 + [email protected]: {} + [email protected]: dependencies: cross-spawn: 7.0.3 @@ -4991,6 +4973,8 @@ snapshots: [email protected]: {} + [email protected]: {} + [email protected]: {} [email protected]: @@ -5060,14 +5044,6 @@ snapshots: [email protected]: {} - [email protected]: {} - - [email protected]: - dependencies: - safe-buffer: 5.2.1 - - [email protected]: {} - [email protected]: {} [email protected]: @@ -5220,19 +5196,19 @@ snapshots: [email protected]: {} - [email protected]([email protected])([email protected]): + [email protected]([email protected])([email protected]): dependencies: - '@next/eslint-plugin-next': 15.0.0-canary.146 + '@next/eslint-plugin-next': 15.0.0 '@rushstack/eslint-patch': 1.10.4 '@typescript-eslint/eslint-plugin': 8.4.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]) '@typescript-eslint/parser': 8.4.0([email protected])([email protected]) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]) - eslint-plugin-import: 2.30.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]))([email protected]) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]) + eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]))([email protected]) eslint-plugin-jsx-a11y: 6.10.0([email protected]) eslint-plugin-react: 7.35.2([email protected]) - eslint-plugin-react-hooks: 4.6.2([email protected]) + eslint-plugin-react-hooks: 5.0.0([email protected]) optionalDependencies: typescript: 5.5.2 transitivePeerDependencies: @@ -5248,37 +5224,48 @@ snapshots: transitivePeerDependencies: - supports-color - [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]): + [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.3.7 enhanced-resolve: 5.17.1 eslint: 8.57.0 - eslint-module-utils: 2.11.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]))([email protected]) + eslint-module-utils: 2.11.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]))([email protected]) fast-glob: 3.3.2 - get-tsconfig: 4.8.0 + get-tsconfig: 4.8.1 is-bun-module: 1.2.1 is-glob: 4.0.3 optionalDependencies: - eslint-plugin-import: 2.30.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]))([email protected]) + eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]))([email protected]) transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color - [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]))([email protected]): + [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]))([email protected]): + dependencies: + debug: 3.2.7 + optionalDependencies: + '@typescript-eslint/parser': 8.4.0([email protected])([email protected]) + eslint: 8.57.0 + eslint-import-resolver-node: 0.3.9 + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]) + transitivePeerDependencies: + - supports-color + + [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]))([email protected]): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 8.4.0([email protected])([email protected]) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]) transitivePeerDependencies: - supports-color - [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]))([email protected]): + [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]))([email protected]): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -5289,7 +5276,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.11.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]))([email protected]) + eslint-module-utils: 2.12.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]))([email protected]) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -5298,6 +5285,7 @@ snapshots: object.groupby: 1.0.3 object.values: 1.2.0 semver: 6.3.1 + string.prototype.trimend: 1.0.8 tsconfig-paths: 3.15.0 optionalDependencies: '@typescript-eslint/parser': 8.4.0([email protected])([email protected]) @@ -5326,7 +5314,7 @@ snapshots: safe-regex-test: 1.0.3 string.prototype.includes: 2.0.0 - [email protected]([email protected]): + [email protected]([email protected]): dependencies: eslint: 8.57.0 @@ -5420,10 +5408,6 @@ snapshots: [email protected]: {} - [email protected]: {} - - [email protected]: {} - [email protected]: {} [email protected]: {} @@ -5463,15 +5447,19 @@ snapshots: dependencies: reusify: 1.0.4 + [email protected]([email protected]): + optionalDependencies: + picomatch: 4.0.2 + [email protected]: dependencies: flat-cache: 3.2.0 - [email protected]: + [email protected]: dependencies: - readable-web-to-node-stream: 3.0.2 - strtok3: 7.1.1 - token-types: 5.0.1 + strtok3: 8.1.0 + token-types: 6.0.0 + uint8array-extras: 1.4.0 [email protected]: dependencies: @@ -5484,12 +5472,6 @@ snapshots: locate-path: 6.0.0 path-exists: 4.0.0 - [email protected]: - dependencies: - locate-path: 7.2.0 - path-exists: 5.0.0 - unicorn-magic: 0.1.0 - [email protected]: dependencies: flatted: 3.3.1 @@ -5506,11 +5488,6 @@ snapshots: dependencies: is-callable: 1.2.7 - [email protected]: - dependencies: - cross-spawn: 7.0.3 - signal-exit: 4.1.0 - [email protected]: {} [email protected]: @@ -5541,7 +5518,7 @@ snapshots: es-errors: 1.3.0 get-intrinsic: 1.2.4 - [email protected]: + [email protected]: dependencies: resolve-pkg-maps: 1.0.0 @@ -5553,15 +5530,6 @@ snapshots: dependencies: is-glob: 4.0.3 - [email protected]: - dependencies: - foreground-child: 3.3.0 - jackspeak: 3.4.3 - minimatch: 9.0.5 - minipass: 7.1.2 - package-json-from-dist: 1.0.0 - path-scurry: 1.11.1 - [email protected]: dependencies: fs.realpath: 1.0.0 @@ -5659,6 +5627,8 @@ snapshots: [email protected]: {} + [email protected]: {} + [email protected]: dependencies: es-errors: 1.3.0 @@ -5669,6 +5639,7 @@ snapshots: dependencies: jsbn: 1.1.0 sprintf-js: 1.1.3 + optional: true [email protected]: dependencies: @@ -5728,8 +5699,6 @@ snapshots: dependencies: call-bind: 1.0.7 - [email protected]: {} - [email protected]: dependencies: has-tostringtag: 1.0.2 @@ -5798,11 +5767,7 @@ snapshots: reflect.getprototypeof: 1.0.6 set-function-name: 2.0.2 - [email protected]: - dependencies: - '@isaacs/cliui': 8.0.2 - optionalDependencies: - '@pkgjs/parseargs': 0.11.0 + [email protected]: {} [email protected]: {} @@ -5812,7 +5777,8 @@ snapshots: dependencies: argparse: 2.0.1 - [email protected]: {} + [email protected]: + optional: true [email protected]: {} @@ -5820,16 +5786,17 @@ snapshots: [email protected]: {} - [email protected]: + [email protected]: dependencies: '@apidevtools/json-schema-ref-parser': 11.7.0 '@types/json-schema': 7.0.15 - glob: 10.4.5 + '@types/lodash': 4.17.13 is-glob: 4.0.3 js-yaml: 4.1.0 lodash: 4.17.21 minimist: 1.2.8 prettier: 3.3.3 + tinyglobby: 0.2.10 [email protected]: {} @@ -5841,19 +5808,6 @@ snapshots: dependencies: minimist: 1.2.8 - [email protected]: - dependencies: - jws: 3.2.2 - lodash.includes: 4.3.0 - lodash.isboolean: 3.0.3 - lodash.isinteger: 4.0.4 - lodash.isnumber: 3.0.3 - lodash.isplainobject: 4.0.6 - lodash.isstring: 4.0.1 - lodash.once: 4.1.1 - ms: 2.1.3 - semver: 7.6.3 - [email protected]: dependencies: array-includes: 3.1.8 @@ -5861,18 +5815,7 @@ snapshots: object.assign: 4.1.5 object.values: 1.2.0 - [email protected]: - dependencies: - buffer-equal-constant-time: 1.0.1 - ecdsa-sig-formatter: 1.0.11 - safe-buffer: 5.2.1 - - [email protected]: - dependencies: - jwa: 1.4.1 - safe-buffer: 5.2.1 - - [email protected]: {} + [email protected]: {} [email protected]: dependencies: @@ -5903,34 +5846,14 @@ snapshots: dependencies: p-locate: 5.0.0 - [email protected]: - dependencies: - p-locate: 6.0.0 - - [email protected]: {} - - [email protected]: {} - - [email protected]: {} - - [email protected]: {} - - [email protected]: {} - - [email protected]: {} - [email protected]: {} - [email protected]: {} - [email protected]: {} [email protected]: dependencies: js-tokens: 4.0.0 - [email protected]: {} - [email protected]: dependencies: charenc: 0.0.2 @@ -5939,8 +5862,7 @@ snapshots: [email protected]: {} - [email protected]: - optional: true + [email protected]: {} [email protected]: {} @@ -5959,46 +5881,48 @@ snapshots: [email protected]: {} - [email protected]: {} - [email protected]: {} - [email protected]: + [email protected]: dependencies: - '@types/whatwg-url': 8.2.2 - whatwg-url: 11.0.0 + '@types/whatwg-url': 11.0.5 + whatwg-url: 13.0.0 - [email protected](@aws-sdk/[email protected](@aws-sdk/[email protected])): + [email protected](@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected])))([email protected]): dependencies: - bson: 4.7.2 - mongodb-connection-string-url: 2.6.0 - socks: 2.8.3 + '@mongodb-js/saslprep': 1.1.9 + bson: 6.9.0 + mongodb-connection-string-url: 3.0.1 optionalDependencies: '@aws-sdk/credential-providers': 3.645.0(@aws-sdk/[email protected](@aws-sdk/[email protected])) - '@mongodb-js/saslprep': 1.1.9 - transitivePeerDependencies: - - '@aws-sdk/client-sso-oidc' - - aws-crt + socks: 2.8.3 + + [email protected]: {} - [email protected]: {} + [email protected]: {} - [email protected](@aws-sdk/[email protected](@aws-sdk/[email protected])): + [email protected](@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected])))([email protected]): dependencies: - bson: 4.7.2 - kareem: 2.5.1 - mongodb: 4.17.1(@aws-sdk/[email protected](@aws-sdk/[email protected])) + bson: 6.9.0 + kareem: 2.6.3 + mongodb: 6.10.0(@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected])))([email protected]) mpath: 0.9.0 - mquery: 4.0.3 + mquery: 5.0.0 ms: 2.1.3 - sift: 16.0.1 + sift: 17.1.3 transitivePeerDependencies: - - '@aws-sdk/client-sso-oidc' - - aws-crt + - '@aws-sdk/credential-providers' + - '@mongodb-js/zstd' + - gcp-metadata + - kerberos + - mongodb-client-encryption + - snappy + - socks - supports-color [email protected]: {} - [email protected]: + [email protected]: dependencies: debug: 4.3.7 transitivePeerDependencies: @@ -6010,28 +5934,26 @@ snapshots: [email protected]: {} - [email protected]([email protected]([email protected]))([email protected])([email protected]): + [email protected]([email protected]([email protected]))([email protected])([email protected]): dependencies: - '@next/env': 15.0.0-canary.104 + '@next/env': 15.0.0 '@swc/counter': 0.1.3 - '@swc/helpers': 0.5.12 + '@swc/helpers': 0.5.13 busboy: 1.6.0 caniuse-lite: 1.0.30001659 - graceful-fs: 4.2.11 postcss: 8.4.31 - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) - styled-jsx: 5.1.6([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) + styled-jsx: 5.1.6([email protected]) optionalDependencies: - '@next/swc-darwin-arm64': 15.0.0-canary.104 - '@next/swc-darwin-x64': 15.0.0-canary.104 - '@next/swc-linux-arm64-gnu': 15.0.0-canary.104 - '@next/swc-linux-arm64-musl': 15.0.0-canary.104 - '@next/swc-linux-x64-gnu': 15.0.0-canary.104 - '@next/swc-linux-x64-musl': 15.0.0-canary.104 - '@next/swc-win32-arm64-msvc': 15.0.0-canary.104 - '@next/swc-win32-ia32-msvc': 15.0.0-canary.104 - '@next/swc-win32-x64-msvc': 15.0.0-canary.104 + '@next/swc-darwin-arm64': 15.0.0 + '@next/swc-darwin-x64': 15.0.0 + '@next/swc-linux-arm64-gnu': 15.0.0 + '@next/swc-linux-arm64-musl': 15.0.0 + '@next/swc-linux-x64-gnu': 15.0.0 + '@next/swc-linux-x64-musl': 15.0.0 + '@next/swc-win32-arm64-msvc': 15.0.0 + '@next/swc-win32-x64-msvc': 15.0.0 sass: 1.77.4 sharp: 0.33.5 transitivePeerDependencies: @@ -6104,20 +6026,10 @@ snapshots: dependencies: yocto-queue: 0.1.0 - [email protected]: - dependencies: - yocto-queue: 1.1.1 - [email protected]: dependencies: p-limit: 3.1.0 - [email protected]: - dependencies: - p-limit: 4.0.0 - - [email protected]: {} - [email protected]: dependencies: callsites: 3.1.0 @@ -6131,57 +6043,53 @@ snapshots: [email protected]: {} - [email protected]: {} - [email protected]: {} [email protected]: {} [email protected]: {} - [email protected]: - dependencies: - lru-cache: 10.4.3 - minipass: 7.1.2 - [email protected]: {} [email protected]: {} - [email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]): + [email protected]([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]): dependencies: - '@monaco-editor/react': 4.6.0([email protected])([email protected]([email protected]))([email protected]) - '@next/env': 15.0.0-rc.0 - '@payloadcms/translations': 3.0.0-beta.106 + '@monaco-editor/react': 4.6.0([email protected])([email protected]([email protected]))([email protected]) + '@next/env': 15.0.3 + '@payloadcms/translations': 3.0.0-beta.134 '@types/busboy': 1.5.4 ajv: 8.17.1 bson-objectid: 2.0.4 ci-info: 4.0.0 - console-table-printer: 2.11.2 + console-table-printer: 2.12.1 + croner: 9.0.0 dataloader: 2.2.2 deepmerge: 4.3.1 - file-type: 17.1.6 - find-up: 7.0.0 - get-tsconfig: 4.8.0 + file-type: 19.3.0 + get-tsconfig: 4.8.1 graphql: 16.9.0 http-status: 1.6.2 image-size: 1.1.1 - json-schema-to-typescript: 15.0.1 - jsonwebtoken: 9.0.2 + jose: 5.9.6 + json-schema-to-typescript: 15.0.3 minimist: 1.2.8 - pino: 9.3.1 - pino-pretty: 11.2.1 + pino: 9.5.0 + pino-pretty: 13.0.0 pluralize: 8.0.0 sanitize-filename: 1.6.3 scmp: 2.1.0 - ts-essentials: 10.0.2([email protected]) - tsx: 4.19.1 + ts-essentials: 10.0.3([email protected]) + tsx: 4.19.2 uuid: 10.0.0 + ws: 8.18.0 transitivePeerDependencies: + - bufferutil - monaco-editor - react - react-dom - typescript + - utf-8-validate [email protected]: {} @@ -6189,12 +6097,13 @@ snapshots: [email protected]: {} - [email protected]: + [email protected]: {} + + [email protected]: dependencies: - readable-stream: 4.5.2 split2: 4.2.0 - [email protected]: + [email protected]: dependencies: colorette: 2.0.20 dateformat: 4.6.3 @@ -6204,23 +6113,22 @@ snapshots: joycon: 3.1.1 minimist: 1.2.8 on-exit-leak-free: 2.1.2 - pino-abstract-transport: 1.2.0 + pino-abstract-transport: 2.0.0 pump: 3.0.0 - readable-stream: 4.5.2 secure-json-parse: 2.7.0 sonic-boom: 4.1.0 strip-json-comments: 3.1.1 [email protected]: {} - [email protected]: + [email protected]: dependencies: atomic-sleep: 1.0.0 fast-redact: 3.5.0 on-exit-leak-free: 2.1.2 - pino-abstract-transport: 1.2.0 + pino-abstract-transport: 2.0.0 pino-std-serializers: 7.0.0 - process-warning: 3.0.0 + process-warning: 4.0.0 quick-format-unescaped: 4.0.4 real-require: 0.2.0 safe-stable-stringify: 2.5.0 @@ -6243,9 +6151,7 @@ snapshots: [email protected]: {} - [email protected]: {} - - [email protected]: {} + [email protected]: {} [email protected]: dependencies: @@ -6275,106 +6181,88 @@ snapshots: [email protected]: {} - [email protected]([email protected]([email protected]))([email protected]): + [email protected]([email protected]([email protected]))([email protected]): dependencies: classnames: 2.5.1 prop-types: 15.8.1 - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) - [email protected]([email protected]([email protected]))([email protected]): + [email protected]([email protected]([email protected]))([email protected]): dependencies: - '@floating-ui/react': 0.26.23([email protected]([email protected]))([email protected]) + '@floating-ui/react': 0.26.23([email protected]([email protected]))([email protected]) clsx: 2.1.1 date-fns: 3.3.1 prop-types: 15.8.1 - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) - react-onclickoutside: 6.13.1([email protected]([email protected]))([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) + react-onclickoutside: 6.13.1([email protected]([email protected]))([email protected]) - [email protected]([email protected]([email protected]))([email protected]): + [email protected]([email protected]([email protected]))([email protected]): dependencies: '@emotion/css': 11.13.0 classnames: 2.5.1 diff: 5.2.0 memoize-one: 6.0.0 prop-types: 15.8.1 - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) transitivePeerDependencies: - supports-color - [email protected]([email protected]): + [email protected]([email protected]): dependencies: - react: 19.0.0-rc-06d0b89e-20240801 - scheduler: 0.25.0-rc-06d0b89e-20240801 + react: 19.0.0-rc-65a56d0e-20241020 + scheduler: 0.25.0-rc-65a56d0e-20241020 - [email protected]([email protected]): + [email protected]([email protected]): dependencies: '@babel/runtime': 7.25.6 - react: 19.0.0-rc-06d0b89e-20240801 + react: 19.0.0-rc-65a56d0e-20241020 - [email protected]([email protected]): + [email protected]([email protected]): dependencies: '@babel/runtime': 7.25.6 - react: 19.0.0-rc-06d0b89e-20240801 + react: 19.0.0-rc-65a56d0e-20241020 - [email protected]([email protected]): + [email protected]([email protected]): dependencies: - react: 19.0.0-rc-06d0b89e-20240801 + react: 19.0.0-rc-65a56d0e-20241020 [email protected]: {} - [email protected]([email protected]([email protected]))([email protected]): + [email protected]([email protected]([email protected]))([email protected]): dependencies: - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) - [email protected]([email protected]([email protected]))([email protected])([email protected]): + [email protected]([email protected]([email protected]))([email protected])([email protected]): dependencies: '@babel/runtime': 7.25.6 '@emotion/cache': 11.13.1 - '@emotion/react': 11.13.3([email protected])([email protected]) + '@emotion/react': 11.13.3([email protected])([email protected]) '@floating-ui/dom': 1.6.10 '@types/react-transition-group': 4.4.11 memoize-one: 6.0.0 prop-types: 15.8.1 - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) - react-transition-group: 4.4.5([email protected]([email protected]))([email protected]) - use-isomorphic-layout-effect: 1.1.2([email protected])([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) + react-transition-group: 4.4.5([email protected]([email protected]))([email protected]) + use-isomorphic-layout-effect: 1.1.2([email protected])([email protected]) transitivePeerDependencies: - '@types/react' - supports-color - [email protected]([email protected]([email protected]))([email protected]): + [email protected]([email protected]([email protected]))([email protected]): dependencies: '@babel/runtime': 7.25.6 dom-helpers: 5.2.1 loose-envify: 1.4.0 prop-types: 15.8.1 - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) - - [email protected]: {} + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) - [email protected]: - dependencies: - inherits: 2.0.4 - string_decoder: 1.3.0 - util-deprecate: 1.0.2 - - [email protected]: - dependencies: - abort-controller: 3.0.0 - buffer: 6.0.3 - events: 3.3.0 - process: 0.11.10 - string_decoder: 1.3.0 - - [email protected]: - dependencies: - readable-stream: 3.6.2 + [email protected]: {} [email protected]: dependencies: @@ -6436,8 +6324,6 @@ snapshots: has-symbols: 1.0.3 isarray: 2.0.5 - [email protected]: {} - [email protected]: dependencies: call-bind: 1.0.7 @@ -6456,9 +6342,9 @@ snapshots: immutable: 4.3.7 source-map-js: 1.2.1 - [email protected]: {} + [email protected]: {} - [email protected]: {} + [email protected]: {} [email protected]: {} @@ -6524,9 +6410,7 @@ snapshots: get-intrinsic: 1.2.4 object-inspect: 1.13.2 - [email protected]: {} - - [email protected]: {} + [email protected]: {} [email protected]: dependencies: @@ -6537,21 +6421,23 @@ snapshots: [email protected]: {} - [email protected]: {} + [email protected]: + optional: true [email protected]: dependencies: ip-address: 9.0.5 smart-buffer: 4.2.0 + optional: true [email protected]: dependencies: atomic-sleep: 1.0.0 - [email protected]([email protected]([email protected]))([email protected]): + [email protected]([email protected]([email protected]))([email protected]): dependencies: - react: 19.0.0-rc-06d0b89e-20240801 - react-dom: 19.0.0-rc-06d0b89e-20240801([email protected]) + react: 19.0.0-rc-65a56d0e-20241020 + react-dom: 19.0.0-rc-65a56d0e-20241020([email protected]) [email protected]: {} @@ -6560,11 +6446,11 @@ snapshots: [email protected]: dependencies: memory-pager: 1.5.0 - optional: true [email protected]: {} - [email protected]: {} + [email protected]: + optional: true [email protected]: {} @@ -6574,18 +6460,6 @@ snapshots: [email protected]: {} - [email protected]: - dependencies: - emoji-regex: 8.0.0 - is-fullwidth-code-point: 3.0.0 - strip-ansi: 6.0.1 - - [email protected]: - dependencies: - eastasianwidth: 0.2.0 - emoji-regex: 9.2.2 - strip-ansi: 7.1.0 - [email protected]: dependencies: define-properties: 1.2.1 @@ -6630,18 +6504,10 @@ snapshots: define-properties: 1.2.1 es-object-atoms: 1.0.0 - [email protected]: - dependencies: - safe-buffer: 5.2.1 - [email protected]: dependencies: ansi-regex: 5.0.1 - [email protected]: - dependencies: - ansi-regex: 6.1.0 - [email protected]: {} [email protected]: {} @@ -6649,15 +6515,15 @@ snapshots: [email protected]: optional: true - [email protected]: + [email protected]: dependencies: '@tokenizer/token': 0.3.0 peek-readable: 5.2.0 - [email protected]([email protected]): + [email protected]([email protected]): dependencies: client-only: 0.0.1 - react: 19.0.0-rc-06d0b89e-20240801 + react: 19.0.0-rc-65a56d0e-20241020 [email protected]: {} @@ -6681,18 +6547,23 @@ snapshots: dependencies: real-require: 0.2.0 + [email protected]: + dependencies: + fdir: 6.4.2([email protected]) + picomatch: 4.0.2 + [email protected]: {} [email protected]: dependencies: is-number: 7.0.0 - [email protected]: + [email protected]: dependencies: '@tokenizer/token': 0.3.0 ieee754: 1.2.1 - [email protected]: + [email protected]: dependencies: punycode: 2.3.1 @@ -6704,7 +6575,7 @@ snapshots: dependencies: typescript: 5.5.2 - [email protected]([email protected]): + [email protected]([email protected]): optionalDependencies: typescript: 5.5.2 @@ -6717,17 +6588,10 @@ snapshots: [email protected]: {} - [email protected]: + [email protected]: dependencies: esbuild: 0.23.1 - get-tsconfig: 4.8.0 - optionalDependencies: - fsevents: 2.3.3 - - [email protected]: - dependencies: - esbuild: 0.23.1 - get-tsconfig: 4.8.0 + get-tsconfig: 4.8.1 optionalDependencies: fsevents: 2.3.3 @@ -6769,16 +6633,18 @@ snapshots: is-typed-array: 1.1.13 possible-typed-array-names: 1.0.0 - [email protected]: + [email protected]: dependencies: - '@types/react': 18.3.5 + '@types/react': [email protected] - [email protected]: + [email protected]: dependencies: csstype: 3.1.3 [email protected]: {} + [email protected]: {} + [email protected]: dependencies: call-bind: 1.0.7 @@ -6788,27 +6654,23 @@ snapshots: [email protected]: {} - [email protected]: {} - [email protected]: dependencies: punycode: 2.3.1 - [email protected]([email protected])([email protected]): + [email protected]([email protected])([email protected]): dependencies: - react: 19.0.0-rc-06d0b89e-20240801 - scheduler: 0.25.0-rc-f994737d14-20240522 + react: 19.0.0-rc-65a56d0e-20241020 + scheduler: 0.0.0-experimental-3edc000d-20240926 - [email protected]([email protected])([email protected]): + [email protected]([email protected])([email protected]): dependencies: - react: 19.0.0-rc-06d0b89e-20240801 + react: 19.0.0-rc-65a56d0e-20241020 optionalDependencies: - '@types/react': [email protected] + '@types/react': [email protected] [email protected]: {} - [email protected]: {} - [email protected]: {} [email protected]: @@ -6816,9 +6678,9 @@ snapshots: [email protected]: {} - [email protected]: + [email protected]: dependencies: - tr46: 3.0.0 + tr46: 4.1.1 webidl-conversions: 7.0.0 [email protected]: @@ -6865,18 +6727,6 @@ snapshots: [email protected]: {} - [email protected]: - dependencies: - ansi-styles: 4.3.0 - string-width: 4.2.3 - strip-ansi: 6.0.1 - - [email protected]: - dependencies: - ansi-styles: 6.2.1 - string-width: 5.1.2 - strip-ansi: 7.1.0 - [email protected]: {} [email protected]: {} @@ -6893,5 +6743,3 @@ snapshots: lib0: 0.2.97 [email protected]: {} - - [email protected]: {} diff --git a/examples/custom-components/src/app/(payload)/admin/[[...segments]]/not-found.tsx b/examples/custom-components/src/app/(payload)/admin/[[...segments]]/not-found.tsx index faeff9ecfc4..180e6f81cdf 100644 --- a/examples/custom-components/src/app/(payload)/admin/[[...segments]]/not-found.tsx +++ b/examples/custom-components/src/app/(payload)/admin/[[...segments]]/not-found.tsx @@ -8,12 +8,12 @@ import { generatePageMetadata, NotFoundPage } from '@payloadcms/next/views' import { importMap } from '../importMap.js' type Args = { - params: { + params: Promise<{ segments: string[] - } - searchParams: { + }> + searchParams: Promise<{ [key: string]: string | string[] - } + }> } export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> => diff --git a/examples/custom-components/src/app/(payload)/admin/[[...segments]]/page.tsx b/examples/custom-components/src/app/(payload)/admin/[[...segments]]/page.tsx index 496e4301c49..4ff779a080e 100644 --- a/examples/custom-components/src/app/(payload)/admin/[[...segments]]/page.tsx +++ b/examples/custom-components/src/app/(payload)/admin/[[...segments]]/page.tsx @@ -8,14 +8,13 @@ import { generatePageMetadata, RootPage } from '@payloadcms/next/views' import { importMap } from '../importMap.js' type Args = { - params: { + params: Promise<{ segments: string[] - } - searchParams: { + }> + searchParams: Promise<{ [key: string]: string | string[] - } + }> } - export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> => generatePageMetadata({ config, params, searchParams }) diff --git a/examples/custom-components/src/app/(payload)/admin/importMap.js b/examples/custom-components/src/app/(payload)/admin/importMap.js index f8ca17e9698..0194604bea0 100644 --- a/examples/custom-components/src/app/(payload)/admin/importMap.js +++ b/examples/custom-components/src/app/(payload)/admin/importMap.js @@ -1,162 +1,113 @@ -import { CustomArrayFieldLabelServer as CustomArrayFieldLabelServer_0 } from '@/collections/Fields/array/components/server/Label' -import { CustomArrayFieldServer as CustomArrayFieldServer_1 } from '@/collections/Fields/array/components/server/Field' -import { CustomArrayFieldLabelClient as CustomArrayFieldLabelClient_2 } from '@/collections/Fields/array/components/client/Label' -import { CustomArrayFieldClient as CustomArrayFieldClient_3 } from '@/collections/Fields/array/components/client/Field' -import { CustomBlocksFieldServer as CustomBlocksFieldServer_4 } from '@/collections/Fields/blocks/components/server/Field' -import { CustomBlocksFieldClient as CustomBlocksFieldClient_5 } from '@/collections/Fields/blocks/components/client/Field' -import { CustomCheckboxFieldLabelServer as CustomCheckboxFieldLabelServer_6 } from '@/collections/Fields/checkbox/components/server/Label' -import { CustomCheckboxFieldServer as CustomCheckboxFieldServer_7 } from '@/collections/Fields/checkbox/components/server/Field' -import { CustomCheckboxFieldLabelClient as CustomCheckboxFieldLabelClient_8 } from '@/collections/Fields/checkbox/components/client/Label' -import { CustomCheckboxFieldClient as CustomCheckboxFieldClient_9 } from '@/collections/Fields/checkbox/components/client/Field' -import { CustomDateFieldLabelServer as CustomDateFieldLabelServer_10 } from '@/collections/Fields/date/components/server/Label' -import { CustomDateFieldServer as CustomDateFieldServer_11 } from '@/collections/Fields/date/components/server/Field' -import { CustomDateFieldLabelClient as CustomDateFieldLabelClient_12 } from '@/collections/Fields/date/components/client/Label' -import { CustomDateFieldClient as CustomDateFieldClient_13 } from '@/collections/Fields/date/components/client/Field' -import { CustomEmailFieldLabelServer as CustomEmailFieldLabelServer_14 } from '@/collections/Fields/email/components/server/Label' -import { CustomEmailFieldServer as CustomEmailFieldServer_15 } from '@/collections/Fields/email/components/server/Field' -import { CustomEmailFieldLabelClient as CustomEmailFieldLabelClient_16 } from '@/collections/Fields/email/components/client/Label' -import { CustomEmailFieldClient as CustomEmailFieldClient_17 } from '@/collections/Fields/email/components/client/Field' -import { CustomNumberFieldLabelServer as CustomNumberFieldLabelServer_18 } from '@/collections/Fields/number/components/server/Label' -import { CustomNumberFieldServer as CustomNumberFieldServer_19 } from '@/collections/Fields/number/components/server/Field' -import { CustomNumberFieldLabelClient as CustomNumberFieldLabelClient_20 } from '@/collections/Fields/number/components/client/Label' -import { CustomNumberFieldClient as CustomNumberFieldClient_21 } from '@/collections/Fields/number/components/client/Field' -import { CustomPointFieldLabelServer as CustomPointFieldLabelServer_22 } from '@/collections/Fields/point/components/server/Label' -import { CustomPointFieldServer as CustomPointFieldServer_23 } from '@/collections/Fields/point/components/server/Field' -import { CustomPointFieldLabelClient as CustomPointFieldLabelClient_24 } from '@/collections/Fields/point/components/client/Label' -import { CustomPointFieldClient as CustomPointFieldClient_25 } from '@/collections/Fields/point/components/client/Field' -import { CustomRadioFieldLabelServer as CustomRadioFieldLabelServer_26 } from '@/collections/Fields/radio/components/server/Label' -import { CustomRadioFieldServer as CustomRadioFieldServer_27 } from '@/collections/Fields/radio/components/server/Field' -import { CustomRadioFieldLabelClient as CustomRadioFieldLabelClient_28 } from '@/collections/Fields/radio/components/client/Label' -import { CustomRadioFieldClient as CustomRadioFieldClient_29 } from '@/collections/Fields/radio/components/client/Field' -import { CustomRelationshipFieldLabelServer as CustomRelationshipFieldLabelServer_30 } from '@/collections/Fields/relationship/components/server/Label' -import { CustomRelationshipFieldServer as CustomRelationshipFieldServer_31 } from '@/collections/Fields/relationship/components/server/Field' -import { CustomRelationshipFieldLabelClient as CustomRelationshipFieldLabelClient_32 } from '@/collections/Fields/relationship/components/client/Label' -import { CustomRelationshipFieldClient as CustomRelationshipFieldClient_33 } from '@/collections/Fields/relationship/components/client/Field' -import { CustomSelectFieldLabelServer as CustomSelectFieldLabelServer_34 } from '@/collections/Fields/select/components/server/Label' -import { CustomSelectFieldServer as CustomSelectFieldServer_35 } from '@/collections/Fields/select/components/server/Field' -import { CustomSelectFieldLabelClient as CustomSelectFieldLabelClient_36 } from '@/collections/Fields/select/components/client/Label' -import { CustomSelectFieldClient as CustomSelectFieldClient_37 } from '@/collections/Fields/select/components/client/Field' -import { CustomTextFieldLabelServer as CustomTextFieldLabelServer_38 } from '@/collections/Fields/text/components/server/Label' -import { CustomTextFieldServer as CustomTextFieldServer_39 } from '@/collections/Fields/text/components/server/Field' -import { CustomTextFieldLabelClient as CustomTextFieldLabelClient_40 } from '@/collections/Fields/text/components/client/Label' -import { CustomTextFieldClient as CustomTextFieldClient_41 } from '@/collections/Fields/text/components/client/Field' -import { CustomTextareaFieldLabelServer as CustomTextareaFieldLabelServer_42 } from '@/collections/Fields/textarea/components/server/Label' -import { CustomTextareaFieldServer as CustomTextareaFieldServer_43 } from '@/collections/Fields/textarea/components/server/Field' -import { CustomTextareaFieldLabelClient as CustomTextareaFieldLabelClient_44 } from '@/collections/Fields/textarea/components/client/Label' -import { CustomTextareaFieldClient as CustomTextareaFieldClient_45 } from '@/collections/Fields/textarea/components/client/Field' -import { CustomTabEditView as CustomTabEditView_46 } from '@/collections/Views/components/CustomTabEditView' -import { CustomDefaultEditView as CustomDefaultEditView_47 } from '@/collections/Views/components/CustomDefaultEditView' -import { CustomRootEditView as CustomRootEditView_48 } from '@/collections/RootViews/components/CustomRootEditView' -import { LinkToCustomView as LinkToCustomView_49 } from '@/components/afterNavLinks/LinkToCustomView' -import { LinkToCustomMinimalView as LinkToCustomMinimalView_50 } from '@/components/afterNavLinks/LinkToCustomMinimalView' -import { LinkToCustomDefaultView as LinkToCustomDefaultView_51 } from '@/components/afterNavLinks/LinkToCustomDefaultView' -import { CustomRootView as CustomRootView_52 } from '@/components/views/CustomRootView' -import { CustomDefaultRootView as CustomDefaultRootView_53 } from '@/components/views/CustomDefaultRootView' -import { CustomMinimalRootView as CustomMinimalRootView_54 } from '@/components/views/CustomMinimalRootView' +import { CustomArrayFieldLabelServer as CustomArrayFieldLabelServer_f8d063e9b7f25c350451c1865199c947 } from '@/collections/Fields/array/components/server/Label' +import { CustomArrayFieldServer as CustomArrayFieldServer_4c3c139a9b1a198103c8a2ec2869c837 } from '@/collections/Fields/array/components/server/Field' +import { CustomArrayFieldLabelClient as CustomArrayFieldLabelClient_c07dc2c547c47aca8e9f471795279e9d } from '@/collections/Fields/array/components/client/Label' +import { CustomArrayFieldClient as CustomArrayFieldClient_60ede271f2b85983daf36710010ad8ab } from '@/collections/Fields/array/components/client/Field' +import { CustomBlocksFieldServer as CustomBlocksFieldServer_61732537ad2c492ac9938959902f6954 } from '@/collections/Fields/blocks/components/server/Field' +import { CustomBlocksFieldClient as CustomBlocksFieldClient_2ef3a03de3974b6f18f07623af0cd515 } from '@/collections/Fields/blocks/components/client/Field' +import { CustomCheckboxFieldLabelServer as CustomCheckboxFieldLabelServer_48cd2d9639f54745ad4cdb6905c825d9 } from '@/collections/Fields/checkbox/components/server/Label' +import { CustomCheckboxFieldServer as CustomCheckboxFieldServer_85023d60242dd4cca7c406a728ec37a8 } from '@/collections/Fields/checkbox/components/server/Field' +import { CustomCheckboxFieldLabelClient as CustomCheckboxFieldLabelClient_f2b214145c1cbe98957573cf62455194 } from '@/collections/Fields/checkbox/components/client/Label' +import { CustomCheckboxFieldClient as CustomCheckboxFieldClient_a13e6003bc89da826df764d7234782de } from '@/collections/Fields/checkbox/components/client/Field' +import { CustomDateFieldLabelServer as CustomDateFieldLabelServer_ae9eb459b79a1363a40d62b1e463aa6b } from '@/collections/Fields/date/components/server/Label' +import { CustomDateFieldServer as CustomDateFieldServer_9d448604d99b3b06826ea95986ffd27b } from '@/collections/Fields/date/components/server/Field' +import { CustomDateFieldLabelClient as CustomDateFieldLabelClient_0b6c1439c63aadfd306cf432713a52d8 } from '@/collections/Fields/date/components/client/Label' +import { CustomDateFieldClient as CustomDateFieldClient_4ef537c727f5de7c26aaea94024a0b2c } from '@/collections/Fields/date/components/client/Field' +import { CustomEmailFieldLabelServer as CustomEmailFieldLabelServer_a5097abb06efbe71fc6ba1636f7194ab } from '@/collections/Fields/email/components/server/Label' +import { CustomEmailFieldServer as CustomEmailFieldServer_457ae84519701bf0b287c30a994ddab1 } from '@/collections/Fields/email/components/server/Field' +import { CustomEmailFieldLabelClient as CustomEmailFieldLabelClient_147edabdb378c855b9c8c06b8c627e50 } from '@/collections/Fields/email/components/client/Label' +import { CustomEmailFieldClient as CustomEmailFieldClient_e22bcec891915f255e5ac6e1850aeb97 } from '@/collections/Fields/email/components/client/Field' +import { CustomNumberFieldLabelServer as CustomNumberFieldLabelServer_1b47d0cd70ad88e23dcf9c4f91bf319f } from '@/collections/Fields/number/components/server/Label' +import { CustomNumberFieldServer as CustomNumberFieldServer_54fc6ad95d89a3b66b59136e84d20b86 } from '@/collections/Fields/number/components/server/Field' +import { CustomNumberFieldLabelClient as CustomNumberFieldLabelClient_dd3e3dcfc7b07c3a02f947ac81718a51 } from '@/collections/Fields/number/components/client/Label' +import { CustomNumberFieldClient as CustomNumberFieldClient_5d5605680426c77470fd74d010fe051f } from '@/collections/Fields/number/components/client/Field' +import { CustomPointFieldLabelServer as CustomPointFieldLabelServer_c5fb0c717f353a8c6149238dd7d92ec9 } from '@/collections/Fields/point/components/server/Label' +import { CustomPointFieldServer as CustomPointFieldServer_a23d13971ed0ff10615e3248bb1ee55d } from '@/collections/Fields/point/components/server/Field' +import { CustomPointFieldLabelClient as CustomPointFieldLabelClient_3c6c8c891bc098021e618d5cf4dc3150 } from '@/collections/Fields/point/components/client/Label' +import { CustomPointFieldClient as CustomPointFieldClient_abb4ee1633cbc83b4cec9b8abb95f132 } from '@/collections/Fields/point/components/client/Field' +import { CustomRadioFieldLabelServer as CustomRadioFieldLabelServer_5c732ac2af72bb41657cc9a1a22bc67b } from '@/collections/Fields/radio/components/server/Label' +import { CustomRadioFieldServer as CustomRadioFieldServer_b7edb363e225e2976a994da8e8803e60 } from '@/collections/Fields/radio/components/server/Field' +import { CustomRadioFieldLabelClient as CustomRadioFieldLabelClient_d46d0583023d87065f05972901727bbf } from '@/collections/Fields/radio/components/client/Label' +import { CustomRadioFieldClient as CustomRadioFieldClient_42845db96f999817cb9f0a590413d669 } from '@/collections/Fields/radio/components/client/Field' +import { CustomRelationshipFieldLabelServer as CustomRelationshipFieldLabelServer_7c45510caabe204587b638c40f0d0a70 } from '@/collections/Fields/relationship/components/server/Label' +import { CustomRelationshipFieldServer as CustomRelationshipFieldServer_d2e0b17d4b1c00b1fc726f0ea55ddc16 } from '@/collections/Fields/relationship/components/server/Field' +import { CustomRelationshipFieldLabelClient as CustomRelationshipFieldLabelClient_37b268226ded7dd38d5cb8f2952f4b3a } from '@/collections/Fields/relationship/components/client/Label' +import { CustomRelationshipFieldClient as CustomRelationshipFieldClient_eb1bc838beb92b05ba1bb9c1fdfd7869 } from '@/collections/Fields/relationship/components/client/Field' +import { CustomSelectFieldLabelServer as CustomSelectFieldLabelServer_653acab80b672fd4ebeeed757e09d4c9 } from '@/collections/Fields/select/components/server/Label' +import { CustomSelectFieldServer as CustomSelectFieldServer_ee886c859ef756c29ae7383a2be0a08a } from '@/collections/Fields/select/components/server/Field' +import { CustomSelectFieldLabelClient as CustomSelectFieldLabelClient_2db542ef2e0a664acaa5679fc14aa54b } from '@/collections/Fields/select/components/client/Label' +import { CustomSelectFieldClient as CustomSelectFieldClient_c8b4c7f3e98b5887ca262dd841bffa2f } from '@/collections/Fields/select/components/client/Field' +import { CustomTextFieldLabelServer as CustomTextFieldLabelServer_64a4b68861269d69d4c16a0f651b7ac9 } from '@/collections/Fields/text/components/server/Label' +import { CustomTextFieldServer as CustomTextFieldServer_e0caaef49c00003336b08d834c0c9fe9 } from '@/collections/Fields/text/components/server/Field' +import { CustomTextFieldLabelClient as CustomTextFieldLabelClient_9af2b9e4733a9fc79fb9dfb1578c18bf } from '@/collections/Fields/text/components/client/Label' +import { CustomTextFieldClient as CustomTextFieldClient_c7c0687b5204b201f8b1af831f34fd98 } from '@/collections/Fields/text/components/client/Field' +import { CustomTextareaFieldLabelServer as CustomTextareaFieldLabelServer_5c8f706a3452bccefa9f5044e2cd250c } from '@/collections/Fields/textarea/components/server/Label' +import { CustomTextareaFieldServer as CustomTextareaFieldServer_3f7b621f5c4c42971fc099a1fa492d99 } from '@/collections/Fields/textarea/components/server/Field' +import { CustomTextareaFieldLabelClient as CustomTextareaFieldLabelClient_9959ee64353edb5f2606b52187275823 } from '@/collections/Fields/textarea/components/client/Label' +import { CustomTextareaFieldClient as CustomTextareaFieldClient_4fd3331c38982e86768c64dcc9a10691 } from '@/collections/Fields/textarea/components/client/Field' +import { CustomTabEditView as CustomTabEditView_0a7acb05a3192ecfa7e07f8b42e7a193 } from '@/collections/Views/components/CustomTabEditView' +import { CustomDefaultEditView as CustomDefaultEditView_2d3c652c5909d3a3dc3464f0547d5424 } from '@/collections/Views/components/CustomDefaultEditView' +import { CustomRootEditView as CustomRootEditView_ba37229da543ad3c8dc40f7a48771f99 } from '@/collections/RootViews/components/CustomRootEditView' +import { LinkToCustomView as LinkToCustomView_6f16fe358985478a2ead2354ef2cc9a0 } from '@/components/afterNavLinks/LinkToCustomView' +import { LinkToCustomMinimalView as LinkToCustomMinimalView_fd2cefb054695a5b60b860a69d67d15d } from '@/components/afterNavLinks/LinkToCustomMinimalView' +import { LinkToCustomDefaultView as LinkToCustomDefaultView_4c5f581c8bfa951ce2f83c24c4f36b3b } from '@/components/afterNavLinks/LinkToCustomDefaultView' +import { CustomRootView as CustomRootView_1ebb91ef5ff1ea4dc9a27ceb8e9ee0ab } from '@/components/views/CustomRootView' +import { CustomDefaultRootView as CustomDefaultRootView_a2f8ce99b3a1692f7ec03a907e1ea4ce } from '@/components/views/CustomDefaultRootView' +import { CustomMinimalRootView as CustomMinimalRootView_9211f699dea5524a957f33011b786586 } from '@/components/views/CustomMinimalRootView' export const importMap = { - '@/collections/Fields/array/components/server/Label#CustomArrayFieldLabelServer': - CustomArrayFieldLabelServer_0, - '@/collections/Fields/array/components/server/Field#CustomArrayFieldServer': - CustomArrayFieldServer_1, - '@/collections/Fields/array/components/client/Label#CustomArrayFieldLabelClient': - CustomArrayFieldLabelClient_2, - '@/collections/Fields/array/components/client/Field#CustomArrayFieldClient': - CustomArrayFieldClient_3, - '@/collections/Fields/blocks/components/server/Field#CustomBlocksFieldServer': - CustomBlocksFieldServer_4, - '@/collections/Fields/blocks/components/client/Field#CustomBlocksFieldClient': - CustomBlocksFieldClient_5, - '@/collections/Fields/checkbox/components/server/Label#CustomCheckboxFieldLabelServer': - CustomCheckboxFieldLabelServer_6, - '@/collections/Fields/checkbox/components/server/Field#CustomCheckboxFieldServer': - CustomCheckboxFieldServer_7, - '@/collections/Fields/checkbox/components/client/Label#CustomCheckboxFieldLabelClient': - CustomCheckboxFieldLabelClient_8, - '@/collections/Fields/checkbox/components/client/Field#CustomCheckboxFieldClient': - CustomCheckboxFieldClient_9, - '@/collections/Fields/date/components/server/Label#CustomDateFieldLabelServer': - CustomDateFieldLabelServer_10, - '@/collections/Fields/date/components/server/Field#CustomDateFieldServer': - CustomDateFieldServer_11, - '@/collections/Fields/date/components/client/Label#CustomDateFieldLabelClient': - CustomDateFieldLabelClient_12, - '@/collections/Fields/date/components/client/Field#CustomDateFieldClient': - CustomDateFieldClient_13, - '@/collections/Fields/email/components/server/Label#CustomEmailFieldLabelServer': - CustomEmailFieldLabelServer_14, - '@/collections/Fields/email/components/server/Field#CustomEmailFieldServer': - CustomEmailFieldServer_15, - '@/collections/Fields/email/components/client/Label#CustomEmailFieldLabelClient': - CustomEmailFieldLabelClient_16, - '@/collections/Fields/email/components/client/Field#CustomEmailFieldClient': - CustomEmailFieldClient_17, - '@/collections/Fields/number/components/server/Label#CustomNumberFieldLabelServer': - CustomNumberFieldLabelServer_18, - '@/collections/Fields/number/components/server/Field#CustomNumberFieldServer': - CustomNumberFieldServer_19, - '@/collections/Fields/number/components/client/Label#CustomNumberFieldLabelClient': - CustomNumberFieldLabelClient_20, - '@/collections/Fields/number/components/client/Field#CustomNumberFieldClient': - CustomNumberFieldClient_21, - '@/collections/Fields/point/components/server/Label#CustomPointFieldLabelServer': - CustomPointFieldLabelServer_22, - '@/collections/Fields/point/components/server/Field#CustomPointFieldServer': - CustomPointFieldServer_23, - '@/collections/Fields/point/components/client/Label#CustomPointFieldLabelClient': - CustomPointFieldLabelClient_24, - '@/collections/Fields/point/components/client/Field#CustomPointFieldClient': - CustomPointFieldClient_25, - '@/collections/Fields/radio/components/server/Label#CustomRadioFieldLabelServer': - CustomRadioFieldLabelServer_26, - '@/collections/Fields/radio/components/server/Field#CustomRadioFieldServer': - CustomRadioFieldServer_27, - '@/collections/Fields/radio/components/client/Label#CustomRadioFieldLabelClient': - CustomRadioFieldLabelClient_28, - '@/collections/Fields/radio/components/client/Field#CustomRadioFieldClient': - CustomRadioFieldClient_29, - '@/collections/Fields/relationship/components/server/Label#CustomRelationshipFieldLabelServer': - CustomRelationshipFieldLabelServer_30, - '@/collections/Fields/relationship/components/server/Field#CustomRelationshipFieldServer': - CustomRelationshipFieldServer_31, - '@/collections/Fields/relationship/components/client/Label#CustomRelationshipFieldLabelClient': - CustomRelationshipFieldLabelClient_32, - '@/collections/Fields/relationship/components/client/Field#CustomRelationshipFieldClient': - CustomRelationshipFieldClient_33, - '@/collections/Fields/select/components/server/Label#CustomSelectFieldLabelServer': - CustomSelectFieldLabelServer_34, - '@/collections/Fields/select/components/server/Field#CustomSelectFieldServer': - CustomSelectFieldServer_35, - '@/collections/Fields/select/components/client/Label#CustomSelectFieldLabelClient': - CustomSelectFieldLabelClient_36, - '@/collections/Fields/select/components/client/Field#CustomSelectFieldClient': - CustomSelectFieldClient_37, - '@/collections/Fields/text/components/server/Label#CustomTextFieldLabelServer': - CustomTextFieldLabelServer_38, - '@/collections/Fields/text/components/server/Field#CustomTextFieldServer': - CustomTextFieldServer_39, - '@/collections/Fields/text/components/client/Label#CustomTextFieldLabelClient': - CustomTextFieldLabelClient_40, - '@/collections/Fields/text/components/client/Field#CustomTextFieldClient': - CustomTextFieldClient_41, - '@/collections/Fields/textarea/components/server/Label#CustomTextareaFieldLabelServer': - CustomTextareaFieldLabelServer_42, - '@/collections/Fields/textarea/components/server/Field#CustomTextareaFieldServer': - CustomTextareaFieldServer_43, - '@/collections/Fields/textarea/components/client/Label#CustomTextareaFieldLabelClient': - CustomTextareaFieldLabelClient_44, - '@/collections/Fields/textarea/components/client/Field#CustomTextareaFieldClient': - CustomTextareaFieldClient_45, - '@/collections/Views/components/CustomTabEditView#CustomTabEditView': CustomTabEditView_46, - '@/collections/Views/components/CustomDefaultEditView#CustomDefaultEditView': - CustomDefaultEditView_47, - '@/collections/RootViews/components/CustomRootEditView#CustomRootEditView': CustomRootEditView_48, - '@/components/afterNavLinks/LinkToCustomView#LinkToCustomView': LinkToCustomView_49, - '@/components/afterNavLinks/LinkToCustomMinimalView#LinkToCustomMinimalView': - LinkToCustomMinimalView_50, - '@/components/afterNavLinks/LinkToCustomDefaultView#LinkToCustomDefaultView': - LinkToCustomDefaultView_51, - '@/components/views/CustomRootView#CustomRootView': CustomRootView_52, - '@/components/views/CustomDefaultRootView#CustomDefaultRootView': CustomDefaultRootView_53, - '@/components/views/CustomMinimalRootView#CustomMinimalRootView': CustomMinimalRootView_54, + "@/collections/Fields/array/components/server/Label#CustomArrayFieldLabelServer": CustomArrayFieldLabelServer_f8d063e9b7f25c350451c1865199c947, + "@/collections/Fields/array/components/server/Field#CustomArrayFieldServer": CustomArrayFieldServer_4c3c139a9b1a198103c8a2ec2869c837, + "@/collections/Fields/array/components/client/Label#CustomArrayFieldLabelClient": CustomArrayFieldLabelClient_c07dc2c547c47aca8e9f471795279e9d, + "@/collections/Fields/array/components/client/Field#CustomArrayFieldClient": CustomArrayFieldClient_60ede271f2b85983daf36710010ad8ab, + "@/collections/Fields/blocks/components/server/Field#CustomBlocksFieldServer": CustomBlocksFieldServer_61732537ad2c492ac9938959902f6954, + "@/collections/Fields/blocks/components/client/Field#CustomBlocksFieldClient": CustomBlocksFieldClient_2ef3a03de3974b6f18f07623af0cd515, + "@/collections/Fields/checkbox/components/server/Label#CustomCheckboxFieldLabelServer": CustomCheckboxFieldLabelServer_48cd2d9639f54745ad4cdb6905c825d9, + "@/collections/Fields/checkbox/components/server/Field#CustomCheckboxFieldServer": CustomCheckboxFieldServer_85023d60242dd4cca7c406a728ec37a8, + "@/collections/Fields/checkbox/components/client/Label#CustomCheckboxFieldLabelClient": CustomCheckboxFieldLabelClient_f2b214145c1cbe98957573cf62455194, + "@/collections/Fields/checkbox/components/client/Field#CustomCheckboxFieldClient": CustomCheckboxFieldClient_a13e6003bc89da826df764d7234782de, + "@/collections/Fields/date/components/server/Label#CustomDateFieldLabelServer": CustomDateFieldLabelServer_ae9eb459b79a1363a40d62b1e463aa6b, + "@/collections/Fields/date/components/server/Field#CustomDateFieldServer": CustomDateFieldServer_9d448604d99b3b06826ea95986ffd27b, + "@/collections/Fields/date/components/client/Label#CustomDateFieldLabelClient": CustomDateFieldLabelClient_0b6c1439c63aadfd306cf432713a52d8, + "@/collections/Fields/date/components/client/Field#CustomDateFieldClient": CustomDateFieldClient_4ef537c727f5de7c26aaea94024a0b2c, + "@/collections/Fields/email/components/server/Label#CustomEmailFieldLabelServer": CustomEmailFieldLabelServer_a5097abb06efbe71fc6ba1636f7194ab, + "@/collections/Fields/email/components/server/Field#CustomEmailFieldServer": CustomEmailFieldServer_457ae84519701bf0b287c30a994ddab1, + "@/collections/Fields/email/components/client/Label#CustomEmailFieldLabelClient": CustomEmailFieldLabelClient_147edabdb378c855b9c8c06b8c627e50, + "@/collections/Fields/email/components/client/Field#CustomEmailFieldClient": CustomEmailFieldClient_e22bcec891915f255e5ac6e1850aeb97, + "@/collections/Fields/number/components/server/Label#CustomNumberFieldLabelServer": CustomNumberFieldLabelServer_1b47d0cd70ad88e23dcf9c4f91bf319f, + "@/collections/Fields/number/components/server/Field#CustomNumberFieldServer": CustomNumberFieldServer_54fc6ad95d89a3b66b59136e84d20b86, + "@/collections/Fields/number/components/client/Label#CustomNumberFieldLabelClient": CustomNumberFieldLabelClient_dd3e3dcfc7b07c3a02f947ac81718a51, + "@/collections/Fields/number/components/client/Field#CustomNumberFieldClient": CustomNumberFieldClient_5d5605680426c77470fd74d010fe051f, + "@/collections/Fields/point/components/server/Label#CustomPointFieldLabelServer": CustomPointFieldLabelServer_c5fb0c717f353a8c6149238dd7d92ec9, + "@/collections/Fields/point/components/server/Field#CustomPointFieldServer": CustomPointFieldServer_a23d13971ed0ff10615e3248bb1ee55d, + "@/collections/Fields/point/components/client/Label#CustomPointFieldLabelClient": CustomPointFieldLabelClient_3c6c8c891bc098021e618d5cf4dc3150, + "@/collections/Fields/point/components/client/Field#CustomPointFieldClient": CustomPointFieldClient_abb4ee1633cbc83b4cec9b8abb95f132, + "@/collections/Fields/radio/components/server/Label#CustomRadioFieldLabelServer": CustomRadioFieldLabelServer_5c732ac2af72bb41657cc9a1a22bc67b, + "@/collections/Fields/radio/components/server/Field#CustomRadioFieldServer": CustomRadioFieldServer_b7edb363e225e2976a994da8e8803e60, + "@/collections/Fields/radio/components/client/Label#CustomRadioFieldLabelClient": CustomRadioFieldLabelClient_d46d0583023d87065f05972901727bbf, + "@/collections/Fields/radio/components/client/Field#CustomRadioFieldClient": CustomRadioFieldClient_42845db96f999817cb9f0a590413d669, + "@/collections/Fields/relationship/components/server/Label#CustomRelationshipFieldLabelServer": CustomRelationshipFieldLabelServer_7c45510caabe204587b638c40f0d0a70, + "@/collections/Fields/relationship/components/server/Field#CustomRelationshipFieldServer": CustomRelationshipFieldServer_d2e0b17d4b1c00b1fc726f0ea55ddc16, + "@/collections/Fields/relationship/components/client/Label#CustomRelationshipFieldLabelClient": CustomRelationshipFieldLabelClient_37b268226ded7dd38d5cb8f2952f4b3a, + "@/collections/Fields/relationship/components/client/Field#CustomRelationshipFieldClient": CustomRelationshipFieldClient_eb1bc838beb92b05ba1bb9c1fdfd7869, + "@/collections/Fields/select/components/server/Label#CustomSelectFieldLabelServer": CustomSelectFieldLabelServer_653acab80b672fd4ebeeed757e09d4c9, + "@/collections/Fields/select/components/server/Field#CustomSelectFieldServer": CustomSelectFieldServer_ee886c859ef756c29ae7383a2be0a08a, + "@/collections/Fields/select/components/client/Label#CustomSelectFieldLabelClient": CustomSelectFieldLabelClient_2db542ef2e0a664acaa5679fc14aa54b, + "@/collections/Fields/select/components/client/Field#CustomSelectFieldClient": CustomSelectFieldClient_c8b4c7f3e98b5887ca262dd841bffa2f, + "@/collections/Fields/text/components/server/Label#CustomTextFieldLabelServer": CustomTextFieldLabelServer_64a4b68861269d69d4c16a0f651b7ac9, + "@/collections/Fields/text/components/server/Field#CustomTextFieldServer": CustomTextFieldServer_e0caaef49c00003336b08d834c0c9fe9, + "@/collections/Fields/text/components/client/Label#CustomTextFieldLabelClient": CustomTextFieldLabelClient_9af2b9e4733a9fc79fb9dfb1578c18bf, + "@/collections/Fields/text/components/client/Field#CustomTextFieldClient": CustomTextFieldClient_c7c0687b5204b201f8b1af831f34fd98, + "@/collections/Fields/textarea/components/server/Label#CustomTextareaFieldLabelServer": CustomTextareaFieldLabelServer_5c8f706a3452bccefa9f5044e2cd250c, + "@/collections/Fields/textarea/components/server/Field#CustomTextareaFieldServer": CustomTextareaFieldServer_3f7b621f5c4c42971fc099a1fa492d99, + "@/collections/Fields/textarea/components/client/Label#CustomTextareaFieldLabelClient": CustomTextareaFieldLabelClient_9959ee64353edb5f2606b52187275823, + "@/collections/Fields/textarea/components/client/Field#CustomTextareaFieldClient": CustomTextareaFieldClient_4fd3331c38982e86768c64dcc9a10691, + "@/collections/Views/components/CustomTabEditView#CustomTabEditView": CustomTabEditView_0a7acb05a3192ecfa7e07f8b42e7a193, + "@/collections/Views/components/CustomDefaultEditView#CustomDefaultEditView": CustomDefaultEditView_2d3c652c5909d3a3dc3464f0547d5424, + "@/collections/RootViews/components/CustomRootEditView#CustomRootEditView": CustomRootEditView_ba37229da543ad3c8dc40f7a48771f99, + "@/components/afterNavLinks/LinkToCustomView#LinkToCustomView": LinkToCustomView_6f16fe358985478a2ead2354ef2cc9a0, + "@/components/afterNavLinks/LinkToCustomMinimalView#LinkToCustomMinimalView": LinkToCustomMinimalView_fd2cefb054695a5b60b860a69d67d15d, + "@/components/afterNavLinks/LinkToCustomDefaultView#LinkToCustomDefaultView": LinkToCustomDefaultView_4c5f581c8bfa951ce2f83c24c4f36b3b, + "@/components/views/CustomRootView#CustomRootView": CustomRootView_1ebb91ef5ff1ea4dc9a27ceb8e9ee0ab, + "@/components/views/CustomDefaultRootView#CustomDefaultRootView": CustomDefaultRootView_a2f8ce99b3a1692f7ec03a907e1ea4ce, + "@/components/views/CustomMinimalRootView#CustomMinimalRootView": CustomMinimalRootView_9211f699dea5524a957f33011b786586 } diff --git a/examples/custom-components/src/app/(payload)/layout.tsx b/examples/custom-components/src/app/(payload)/layout.tsx index af755c33b2f..7f8698e1380 100644 --- a/examples/custom-components/src/app/(payload)/layout.tsx +++ b/examples/custom-components/src/app/(payload)/layout.tsx @@ -1,8 +1,10 @@ +import type { ServerFunctionClient } from 'payload' + +import '@payloadcms/next/css' /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ /* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ import config from '@payload-config' -import '@payloadcms/next/css' -import { RootLayout } from '@payloadcms/next/layouts' +import { handleServerFunctions, RootLayout } from '@payloadcms/next/layouts' import React from 'react' import { importMap } from './admin/importMap.js' @@ -12,8 +14,17 @@ type Args = { children: React.ReactNode } +const serverFunction: ServerFunctionClient = async function (args) { + 'use server' + return handleServerFunctions({ + ...args, + config, + importMap, + }) +} + const Layout = ({ children }: Args) => ( - <RootLayout config={config} importMap={importMap}> + <RootLayout config={config} importMap={importMap} serverFunction={serverFunction}> {children} </RootLayout> ) diff --git a/examples/custom-components/src/collections/Fields/array/components/client/Field.tsx b/examples/custom-components/src/collections/Fields/array/components/client/Field.tsx index d843b737521..83f1b6b0da8 100644 --- a/examples/custom-components/src/collections/Fields/array/components/client/Field.tsx +++ b/examples/custom-components/src/collections/Fields/array/components/client/Field.tsx @@ -4,6 +4,6 @@ import type { ArrayFieldClientComponent } from 'payload' import { ArrayField } from '@payloadcms/ui' import React from 'react' -export const CustomArrayFieldClient: ArrayFieldClientComponent = ({ field }) => { - return <ArrayField field={field} /> +export const CustomArrayFieldClient: ArrayFieldClientComponent = (props) => { + return <ArrayField field={props?.field} path={props?.path} permissions={props?.permissions} /> } diff --git a/examples/custom-components/src/collections/Fields/array/components/client/Label.tsx b/examples/custom-components/src/collections/Fields/array/components/client/Label.tsx index b811c4b856f..6fca5d80ca7 100644 --- a/examples/custom-components/src/collections/Fields/array/components/client/Label.tsx +++ b/examples/custom-components/src/collections/Fields/array/components/client/Label.tsx @@ -4,6 +4,6 @@ import type { ArrayFieldLabelClientComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomArrayFieldLabelClient: ArrayFieldLabelClientComponent = ({ field }) => { - return <FieldLabel field={field} /> +export const CustomArrayFieldLabelClient: ArrayFieldLabelClientComponent = (props) => { + return <FieldLabel label={props?.label} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/array/components/server/Field.tsx b/examples/custom-components/src/collections/Fields/array/components/server/Field.tsx index 515c41779fe..20fa20155cc 100644 --- a/examples/custom-components/src/collections/Fields/array/components/server/Field.tsx +++ b/examples/custom-components/src/collections/Fields/array/components/server/Field.tsx @@ -3,6 +3,7 @@ import type React from 'react' import { ArrayField } from '@payloadcms/ui' -export const CustomArrayFieldServer: ArrayFieldServerComponent = ({ clientField }) => { - return <ArrayField field={clientField} /> +export const CustomArrayFieldServer: ArrayFieldServerComponent = (props) => { + const path = (props?.path || props?.field?.name || '') as string + return <ArrayField field={props.clientField} path={path} permissions={props?.permissions} /> } diff --git a/examples/custom-components/src/collections/Fields/array/components/server/Label.tsx b/examples/custom-components/src/collections/Fields/array/components/server/Label.tsx index 56d6942dab9..990b3898fe3 100644 --- a/examples/custom-components/src/collections/Fields/array/components/server/Label.tsx +++ b/examples/custom-components/src/collections/Fields/array/components/server/Label.tsx @@ -3,6 +3,6 @@ import type { ArrayFieldLabelServerComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomArrayFieldLabelServer: ArrayFieldLabelServerComponent = ({ clientField }) => { - return <FieldLabel field={clientField} /> +export const CustomArrayFieldLabelServer: ArrayFieldLabelServerComponent = (props) => { + return <FieldLabel label={props?.label} /> } diff --git a/examples/custom-components/src/collections/Fields/blocks/components/client/Field.tsx b/examples/custom-components/src/collections/Fields/blocks/components/client/Field.tsx index a94dbeeeb31..e766d408965 100644 --- a/examples/custom-components/src/collections/Fields/blocks/components/client/Field.tsx +++ b/examples/custom-components/src/collections/Fields/blocks/components/client/Field.tsx @@ -4,6 +4,6 @@ import type { BlocksFieldClientComponent } from 'payload' import { BlocksField } from '@payloadcms/ui' import React from 'react' -export const CustomBlocksFieldClient: BlocksFieldClientComponent = ({ field }) => { - return <BlocksField field={field} /> +export const CustomBlocksFieldClient: BlocksFieldClientComponent = (props) => { + return <BlocksField field={props?.field} path={props.path} permissions={props?.permissions} /> } diff --git a/examples/custom-components/src/collections/Fields/blocks/components/client/Label.tsx b/examples/custom-components/src/collections/Fields/blocks/components/client/Label.tsx index 3e42942cd41..2494f02c3f1 100644 --- a/examples/custom-components/src/collections/Fields/blocks/components/client/Label.tsx +++ b/examples/custom-components/src/collections/Fields/blocks/components/client/Label.tsx @@ -4,6 +4,6 @@ import type { BlocksFieldLabelClientComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomBlocksFieldLabelClient: BlocksFieldLabelClientComponent = ({ field }) => { - return <FieldLabel field={field} /> +export const CustomBlocksFieldLabelClient: BlocksFieldLabelClientComponent = (props) => { + return <FieldLabel label={props?.label} /> } diff --git a/examples/custom-components/src/collections/Fields/blocks/components/server/Field.tsx b/examples/custom-components/src/collections/Fields/blocks/components/server/Field.tsx index 81fb40ec336..89707ee518e 100644 --- a/examples/custom-components/src/collections/Fields/blocks/components/server/Field.tsx +++ b/examples/custom-components/src/collections/Fields/blocks/components/server/Field.tsx @@ -3,6 +3,7 @@ import type React from 'react' import { BlocksField } from '@payloadcms/ui' -export const CustomBlocksFieldServer: BlocksFieldServerComponent = ({ clientField }) => { - return <BlocksField field={clientField} /> +export const CustomBlocksFieldServer: BlocksFieldServerComponent = (props) => { + const path = (props?.path || props?.field?.name || '') as string + return <BlocksField field={props?.clientField} path={path} permissions={props?.permissions} /> } diff --git a/examples/custom-components/src/collections/Fields/blocks/components/server/Label.tsx b/examples/custom-components/src/collections/Fields/blocks/components/server/Label.tsx index 7dbe81b35b1..a1d89ce1aae 100644 --- a/examples/custom-components/src/collections/Fields/blocks/components/server/Label.tsx +++ b/examples/custom-components/src/collections/Fields/blocks/components/server/Label.tsx @@ -3,6 +3,6 @@ import type { BlocksFieldLabelServerComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomBlocksFieldLabelServer: BlocksFieldLabelServerComponent = ({ clientField }) => { - return <FieldLabel field={clientField} /> +export const CustomBlocksFieldLabelServer: BlocksFieldLabelServerComponent = (props) => { + return <FieldLabel label={props?.label} /> } diff --git a/examples/custom-components/src/collections/Fields/checkbox/components/client/Field.tsx b/examples/custom-components/src/collections/Fields/checkbox/components/client/Field.tsx index e8c902bd21c..da45ceaefd6 100644 --- a/examples/custom-components/src/collections/Fields/checkbox/components/client/Field.tsx +++ b/examples/custom-components/src/collections/Fields/checkbox/components/client/Field.tsx @@ -4,6 +4,6 @@ import type { CheckboxFieldClientComponent } from 'payload' import { CheckboxField } from '@payloadcms/ui' import React from 'react' -export const CustomCheckboxFieldClient: CheckboxFieldClientComponent = ({ field }) => { - return <CheckboxField field={field} /> +export const CustomCheckboxFieldClient: CheckboxFieldClientComponent = (props) => { + return <CheckboxField field={props?.field} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/checkbox/components/client/Label.tsx b/examples/custom-components/src/collections/Fields/checkbox/components/client/Label.tsx index 6d9c9eff437..2677895f329 100644 --- a/examples/custom-components/src/collections/Fields/checkbox/components/client/Label.tsx +++ b/examples/custom-components/src/collections/Fields/checkbox/components/client/Label.tsx @@ -4,6 +4,6 @@ import type { CheckboxFieldLabelClientComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomCheckboxFieldLabelClient: CheckboxFieldLabelClientComponent = ({ field }) => { - return <FieldLabel field={field} /> +export const CustomCheckboxFieldLabelClient: CheckboxFieldLabelClientComponent = (props) => { + return <FieldLabel label={props?.label} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/checkbox/components/server/Field.tsx b/examples/custom-components/src/collections/Fields/checkbox/components/server/Field.tsx index f962953f667..ebfb9e54fef 100644 --- a/examples/custom-components/src/collections/Fields/checkbox/components/server/Field.tsx +++ b/examples/custom-components/src/collections/Fields/checkbox/components/server/Field.tsx @@ -3,6 +3,7 @@ import type React from 'react' import { CheckboxField } from '@payloadcms/ui' -export const CustomCheckboxFieldServer: CheckboxFieldServerComponent = ({ clientField }) => { - return <CheckboxField field={clientField} /> +export const CustomCheckboxFieldServer: CheckboxFieldServerComponent = (props) => { + const path = (props?.path || props?.field?.name || '') as string + return <CheckboxField field={props?.clientField} path={path} /> } diff --git a/examples/custom-components/src/collections/Fields/checkbox/components/server/Label.tsx b/examples/custom-components/src/collections/Fields/checkbox/components/server/Label.tsx index 16bf9774b4c..045ea7c9ffb 100644 --- a/examples/custom-components/src/collections/Fields/checkbox/components/server/Label.tsx +++ b/examples/custom-components/src/collections/Fields/checkbox/components/server/Label.tsx @@ -3,9 +3,6 @@ import type { CheckboxFieldLabelServerComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomCheckboxFieldLabelServer: CheckboxFieldLabelServerComponent = ({ - clientField, - label, -}) => { - return <FieldLabel field={clientField} label={label} /> +export const CustomCheckboxFieldLabelServer: CheckboxFieldLabelServerComponent = (props) => { + return <FieldLabel label={props?.label} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/date/components/client/Field.tsx b/examples/custom-components/src/collections/Fields/date/components/client/Field.tsx index 288cc91b64e..3a1b1921670 100644 --- a/examples/custom-components/src/collections/Fields/date/components/client/Field.tsx +++ b/examples/custom-components/src/collections/Fields/date/components/client/Field.tsx @@ -4,6 +4,6 @@ import type { DateFieldClientComponent } from 'payload' import { DateTimeField } from '@payloadcms/ui' import React from 'react' -export const CustomDateFieldClient: DateFieldClientComponent = ({ field }) => { - return <DateTimeField field={field} /> +export const CustomDateFieldClient: DateFieldClientComponent = (props) => { + return <DateTimeField field={props?.field} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/date/components/client/Label.tsx b/examples/custom-components/src/collections/Fields/date/components/client/Label.tsx index 7ea02c8001f..9668194211c 100644 --- a/examples/custom-components/src/collections/Fields/date/components/client/Label.tsx +++ b/examples/custom-components/src/collections/Fields/date/components/client/Label.tsx @@ -4,6 +4,6 @@ import type { DateFieldLabelClientComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomDateFieldLabelClient: DateFieldLabelClientComponent = ({ field }) => { - return <FieldLabel field={field} /> +export const CustomDateFieldLabelClient: DateFieldLabelClientComponent = (props) => { + return <FieldLabel label={props?.label} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/date/components/server/Field.tsx b/examples/custom-components/src/collections/Fields/date/components/server/Field.tsx index e0d6ba48942..a6b428a8b76 100644 --- a/examples/custom-components/src/collections/Fields/date/components/server/Field.tsx +++ b/examples/custom-components/src/collections/Fields/date/components/server/Field.tsx @@ -3,6 +3,7 @@ import type React from 'react' import { DateTimeField } from '@payloadcms/ui' -export const CustomDateFieldServer: DateFieldServerComponent = ({ clientField }) => { - return <DateTimeField field={clientField} /> +export const CustomDateFieldServer: DateFieldServerComponent = (props) => { + const path = (props?.path || props?.field?.name || '') as string + return <DateTimeField field={props?.clientField} path={path} /> } diff --git a/examples/custom-components/src/collections/Fields/date/components/server/Label.tsx b/examples/custom-components/src/collections/Fields/date/components/server/Label.tsx index 38f369eb1d5..d59484d1bdd 100644 --- a/examples/custom-components/src/collections/Fields/date/components/server/Label.tsx +++ b/examples/custom-components/src/collections/Fields/date/components/server/Label.tsx @@ -3,6 +3,6 @@ import type { DateFieldLabelServerComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomDateFieldLabelServer: DateFieldLabelServerComponent = ({ clientField }) => { - return <FieldLabel field={clientField} /> +export const CustomDateFieldLabelServer: DateFieldLabelServerComponent = (props) => { + return <FieldLabel label={props?.label} /> } diff --git a/examples/custom-components/src/collections/Fields/email/components/client/Field.tsx b/examples/custom-components/src/collections/Fields/email/components/client/Field.tsx index 0ad4c92658b..cc5dcc192e4 100644 --- a/examples/custom-components/src/collections/Fields/email/components/client/Field.tsx +++ b/examples/custom-components/src/collections/Fields/email/components/client/Field.tsx @@ -4,6 +4,6 @@ import type { EmailFieldClientComponent } from 'payload' import { EmailField } from '@payloadcms/ui' import React from 'react' -export const CustomEmailFieldClient: EmailFieldClientComponent = ({ field }) => { - return <EmailField field={field} /> +export const CustomEmailFieldClient: EmailFieldClientComponent = (props) => { + return <EmailField field={props?.field} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/email/components/client/Label.tsx b/examples/custom-components/src/collections/Fields/email/components/client/Label.tsx index 56993217aa6..e295bbf529b 100644 --- a/examples/custom-components/src/collections/Fields/email/components/client/Label.tsx +++ b/examples/custom-components/src/collections/Fields/email/components/client/Label.tsx @@ -4,6 +4,6 @@ import type { EmailFieldLabelClientComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomEmailFieldLabelClient: EmailFieldLabelClientComponent = ({ field }) => { - return <FieldLabel field={field} /> +export const CustomEmailFieldLabelClient: EmailFieldLabelClientComponent = (props) => { + return <FieldLabel label={props?.label} /> } diff --git a/examples/custom-components/src/collections/Fields/email/components/server/Field.tsx b/examples/custom-components/src/collections/Fields/email/components/server/Field.tsx index f8655e3c93a..81ccb2d66b9 100644 --- a/examples/custom-components/src/collections/Fields/email/components/server/Field.tsx +++ b/examples/custom-components/src/collections/Fields/email/components/server/Field.tsx @@ -3,6 +3,7 @@ import type React from 'react' import { EmailField } from '@payloadcms/ui' -export const CustomEmailFieldServer: EmailFieldServerComponent = ({ clientField }) => { - return <EmailField field={clientField} /> +export const CustomEmailFieldServer: EmailFieldServerComponent = (props) => { + const path = (props?.path || props?.field?.name || '') as string + return <EmailField field={props?.clientField} path={path} /> } diff --git a/examples/custom-components/src/collections/Fields/email/components/server/Label.tsx b/examples/custom-components/src/collections/Fields/email/components/server/Label.tsx index f07896a168f..2b65b95778b 100644 --- a/examples/custom-components/src/collections/Fields/email/components/server/Label.tsx +++ b/examples/custom-components/src/collections/Fields/email/components/server/Label.tsx @@ -3,6 +3,6 @@ import type { EmailFieldLabelServerComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomEmailFieldLabelServer: EmailFieldLabelServerComponent = ({ clientField }) => { - return <FieldLabel field={clientField} /> +export const CustomEmailFieldLabelServer: EmailFieldLabelServerComponent = (props) => { + return <FieldLabel label={props?.label} /> } diff --git a/examples/custom-components/src/collections/Fields/number/components/client/Field.tsx b/examples/custom-components/src/collections/Fields/number/components/client/Field.tsx index 9fbe270cb0d..30a7bde94bc 100644 --- a/examples/custom-components/src/collections/Fields/number/components/client/Field.tsx +++ b/examples/custom-components/src/collections/Fields/number/components/client/Field.tsx @@ -4,6 +4,6 @@ import type { NumberFieldClientComponent } from 'payload' import { NumberField } from '@payloadcms/ui' import React from 'react' -export const CustomNumberFieldClient: NumberFieldClientComponent = ({ field }) => { - return <NumberField field={field} /> +export const CustomNumberFieldClient: NumberFieldClientComponent = (props) => { + return <NumberField field={props?.field} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/number/components/client/Label.tsx b/examples/custom-components/src/collections/Fields/number/components/client/Label.tsx index e6a8517e477..55da82bc803 100644 --- a/examples/custom-components/src/collections/Fields/number/components/client/Label.tsx +++ b/examples/custom-components/src/collections/Fields/number/components/client/Label.tsx @@ -4,6 +4,6 @@ import type { NumberFieldLabelClientComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomNumberFieldLabelClient: NumberFieldLabelClientComponent = ({ field }) => { - return <FieldLabel field={field} /> +export const CustomNumberFieldLabelClient: NumberFieldLabelClientComponent = (props) => { + return <FieldLabel label={props?.label} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/number/components/server/Field.tsx b/examples/custom-components/src/collections/Fields/number/components/server/Field.tsx index 0cb7e729078..3e42dee111b 100644 --- a/examples/custom-components/src/collections/Fields/number/components/server/Field.tsx +++ b/examples/custom-components/src/collections/Fields/number/components/server/Field.tsx @@ -3,6 +3,7 @@ import type React from 'react' import { NumberField } from '@payloadcms/ui' -export const CustomNumberFieldServer: NumberFieldServerComponent = ({ clientField }) => { - return <NumberField field={clientField} /> +export const CustomNumberFieldServer: NumberFieldServerComponent = (props) => { + const path = (props?.path || props?.field?.name || '') as string + return <NumberField field={props?.clientField} path={path} /> } diff --git a/examples/custom-components/src/collections/Fields/number/components/server/Label.tsx b/examples/custom-components/src/collections/Fields/number/components/server/Label.tsx index 73c959bd54e..0ff183f3ccd 100644 --- a/examples/custom-components/src/collections/Fields/number/components/server/Label.tsx +++ b/examples/custom-components/src/collections/Fields/number/components/server/Label.tsx @@ -3,6 +3,6 @@ import type { NumberFieldLabelServerComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomNumberFieldLabelServer: NumberFieldLabelServerComponent = ({ clientField }) => { - return <FieldLabel field={clientField} /> +export const CustomNumberFieldLabelServer: NumberFieldLabelServerComponent = (props) => { + return <FieldLabel label={props?.label} /> } diff --git a/examples/custom-components/src/collections/Fields/point/components/client/Field.tsx b/examples/custom-components/src/collections/Fields/point/components/client/Field.tsx index 5ec17dd706d..dfb8f2abe11 100644 --- a/examples/custom-components/src/collections/Fields/point/components/client/Field.tsx +++ b/examples/custom-components/src/collections/Fields/point/components/client/Field.tsx @@ -4,6 +4,6 @@ import type { PointFieldClientComponent } from 'payload' import { PointField } from '@payloadcms/ui' import React from 'react' -export const CustomPointFieldClient: PointFieldClientComponent = ({ field }) => { - return <PointField field={field} /> +export const CustomPointFieldClient: PointFieldClientComponent = (props) => { + return <PointField field={props?.field} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/point/components/client/Label.tsx b/examples/custom-components/src/collections/Fields/point/components/client/Label.tsx index 74dde59b398..ca3a7794c59 100644 --- a/examples/custom-components/src/collections/Fields/point/components/client/Label.tsx +++ b/examples/custom-components/src/collections/Fields/point/components/client/Label.tsx @@ -4,6 +4,6 @@ import type { PointFieldLabelClientComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomPointFieldLabelClient: PointFieldLabelClientComponent = ({ field }) => { - return <FieldLabel field={field} /> +export const CustomPointFieldLabelClient: PointFieldLabelClientComponent = (props) => { + return <FieldLabel label={props?.label} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/point/components/server/Field.tsx b/examples/custom-components/src/collections/Fields/point/components/server/Field.tsx index d84ef86b95e..18a5c6c2cb0 100644 --- a/examples/custom-components/src/collections/Fields/point/components/server/Field.tsx +++ b/examples/custom-components/src/collections/Fields/point/components/server/Field.tsx @@ -3,6 +3,7 @@ import type React from 'react' import { PointField } from '@payloadcms/ui' -export const CustomPointFieldServer: PointFieldServerComponent = ({ clientField }) => { - return <PointField field={clientField} /> +export const CustomPointFieldServer: PointFieldServerComponent = (props) => { + const path = (props?.path || props?.field?.name || '') as string + return <PointField field={props?.clientField} path={path} /> } diff --git a/examples/custom-components/src/collections/Fields/point/components/server/Label.tsx b/examples/custom-components/src/collections/Fields/point/components/server/Label.tsx index 343bce32d83..ff5ab72824a 100644 --- a/examples/custom-components/src/collections/Fields/point/components/server/Label.tsx +++ b/examples/custom-components/src/collections/Fields/point/components/server/Label.tsx @@ -3,6 +3,6 @@ import type { PointFieldLabelServerComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomPointFieldLabelServer: PointFieldLabelServerComponent = ({ clientField }) => { - return <FieldLabel field={clientField} /> +export const CustomPointFieldLabelServer: PointFieldLabelServerComponent = (props) => { + return <FieldLabel label={props?.label} /> } diff --git a/examples/custom-components/src/collections/Fields/radio/components/client/Field.tsx b/examples/custom-components/src/collections/Fields/radio/components/client/Field.tsx index 816aca734ab..41cd5d5ce30 100644 --- a/examples/custom-components/src/collections/Fields/radio/components/client/Field.tsx +++ b/examples/custom-components/src/collections/Fields/radio/components/client/Field.tsx @@ -4,6 +4,6 @@ import type { RadioFieldClientComponent } from 'payload' import { RadioGroupField } from '@payloadcms/ui' import React from 'react' -export const CustomRadioFieldClient: RadioFieldClientComponent = ({ field }) => { - return <RadioGroupField field={field} /> +export const CustomRadioFieldClient: RadioFieldClientComponent = (props) => { + return <RadioGroupField field={props?.field} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/radio/components/client/Label.tsx b/examples/custom-components/src/collections/Fields/radio/components/client/Label.tsx index 55be913a437..e034927cc6b 100644 --- a/examples/custom-components/src/collections/Fields/radio/components/client/Label.tsx +++ b/examples/custom-components/src/collections/Fields/radio/components/client/Label.tsx @@ -4,6 +4,6 @@ import type { RadioFieldLabelClientComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomRadioFieldLabelClient: RadioFieldLabelClientComponent = ({ field, label }) => { - return <FieldLabel field={field} label={label} /> +export const CustomRadioFieldLabelClient: RadioFieldLabelClientComponent = (props) => { + return <FieldLabel label={props?.label} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/radio/components/server/Field.tsx b/examples/custom-components/src/collections/Fields/radio/components/server/Field.tsx index 92c037b0cb8..b24a775b412 100644 --- a/examples/custom-components/src/collections/Fields/radio/components/server/Field.tsx +++ b/examples/custom-components/src/collections/Fields/radio/components/server/Field.tsx @@ -3,6 +3,7 @@ import type React from 'react' import { RadioGroupField } from '@payloadcms/ui' -export const CustomRadioFieldServer: RadioFieldServerComponent = ({ clientField }) => { - return <RadioGroupField field={clientField} /> +export const CustomRadioFieldServer: RadioFieldServerComponent = (props) => { + const path = (props?.path || props?.field?.name || '') as string + return <RadioGroupField field={props?.clientField} path={path} /> } diff --git a/examples/custom-components/src/collections/Fields/radio/components/server/Label.tsx b/examples/custom-components/src/collections/Fields/radio/components/server/Label.tsx index 118ac266a72..fb129770260 100644 --- a/examples/custom-components/src/collections/Fields/radio/components/server/Label.tsx +++ b/examples/custom-components/src/collections/Fields/radio/components/server/Label.tsx @@ -3,9 +3,6 @@ import type { RadioFieldLabelServerComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomRadioFieldLabelServer: RadioFieldLabelServerComponent = ({ - clientField, - label, -}) => { - return <FieldLabel field={clientField} label={label} /> +export const CustomRadioFieldLabelServer: RadioFieldLabelServerComponent = (props) => { + return <FieldLabel label={props?.label} /> } diff --git a/examples/custom-components/src/collections/Fields/relationship/components/client/Field.tsx b/examples/custom-components/src/collections/Fields/relationship/components/client/Field.tsx index 63b0e6558e0..50ca8536c83 100644 --- a/examples/custom-components/src/collections/Fields/relationship/components/client/Field.tsx +++ b/examples/custom-components/src/collections/Fields/relationship/components/client/Field.tsx @@ -4,6 +4,6 @@ import type { RelationshipFieldClientComponent } from 'payload' import { RelationshipField } from '@payloadcms/ui' import React from 'react' -export const CustomRelationshipFieldClient: RelationshipFieldClientComponent = ({ field }) => { - return <RelationshipField field={field} /> +export const CustomRelationshipFieldClient: RelationshipFieldClientComponent = (props) => { + return <RelationshipField field={props?.field} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/relationship/components/client/Label.tsx b/examples/custom-components/src/collections/Fields/relationship/components/client/Label.tsx index b53c22a13b4..236677e6987 100644 --- a/examples/custom-components/src/collections/Fields/relationship/components/client/Label.tsx +++ b/examples/custom-components/src/collections/Fields/relationship/components/client/Label.tsx @@ -4,9 +4,8 @@ import type { RelationshipFieldLabelClientComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomRelationshipFieldLabelClient: RelationshipFieldLabelClientComponent = ({ - field, - label, -}) => { - return <FieldLabel field={field} label={label} /> +export const CustomRelationshipFieldLabelClient: RelationshipFieldLabelClientComponent = ( + props, +) => { + return <FieldLabel label={props?.label} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/relationship/components/server/Field.tsx b/examples/custom-components/src/collections/Fields/relationship/components/server/Field.tsx index ff74a9dd8f4..a949d50ab32 100644 --- a/examples/custom-components/src/collections/Fields/relationship/components/server/Field.tsx +++ b/examples/custom-components/src/collections/Fields/relationship/components/server/Field.tsx @@ -3,8 +3,7 @@ import type React from 'react' import { RelationshipField } from '@payloadcms/ui' -export const CustomRelationshipFieldServer: RelationshipFieldServerComponent = ({ - clientField, -}) => { - return <RelationshipField field={clientField} /> +export const CustomRelationshipFieldServer: RelationshipFieldServerComponent = (props) => { + const path = (props?.path || props?.field?.name || '') as string + return <RelationshipField field={props?.clientField} path={path} /> } diff --git a/examples/custom-components/src/collections/Fields/relationship/components/server/Label.tsx b/examples/custom-components/src/collections/Fields/relationship/components/server/Label.tsx index e8657fff74b..16444bbf7c6 100644 --- a/examples/custom-components/src/collections/Fields/relationship/components/server/Label.tsx +++ b/examples/custom-components/src/collections/Fields/relationship/components/server/Label.tsx @@ -3,9 +3,8 @@ import type { RelationshipFieldLabelServerComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomRelationshipFieldLabelServer: RelationshipFieldLabelServerComponent = ({ - clientField, - label, -}) => { - return <FieldLabel field={clientField} label={label} /> +export const CustomRelationshipFieldLabelServer: RelationshipFieldLabelServerComponent = ( + props, +) => { + return <FieldLabel label={props?.label} /> } diff --git a/examples/custom-components/src/collections/Fields/select/components/client/Field.tsx b/examples/custom-components/src/collections/Fields/select/components/client/Field.tsx index 34a196c066f..4b1860ba0e9 100644 --- a/examples/custom-components/src/collections/Fields/select/components/client/Field.tsx +++ b/examples/custom-components/src/collections/Fields/select/components/client/Field.tsx @@ -4,6 +4,6 @@ import type { SelectFieldClientComponent } from 'payload' import { SelectField } from '@payloadcms/ui' import React from 'react' -export const CustomSelectFieldClient: SelectFieldClientComponent = ({ field }) => { - return <SelectField field={field} /> +export const CustomSelectFieldClient: SelectFieldClientComponent = (props) => { + return <SelectField field={props?.field} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/select/components/client/Label.tsx b/examples/custom-components/src/collections/Fields/select/components/client/Label.tsx index e3434c513e6..0c79fd49aaf 100644 --- a/examples/custom-components/src/collections/Fields/select/components/client/Label.tsx +++ b/examples/custom-components/src/collections/Fields/select/components/client/Label.tsx @@ -4,6 +4,6 @@ import type { SelectFieldLabelClientComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomSelectFieldLabelClient: SelectFieldLabelClientComponent = ({ field, label }) => { - return <FieldLabel field={field} label={label} /> +export const CustomSelectFieldLabelClient: SelectFieldLabelClientComponent = (props) => { + return <FieldLabel label={props?.label} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/select/components/server/Field.tsx b/examples/custom-components/src/collections/Fields/select/components/server/Field.tsx index 9b830af3cbe..00ea8bb76fa 100644 --- a/examples/custom-components/src/collections/Fields/select/components/server/Field.tsx +++ b/examples/custom-components/src/collections/Fields/select/components/server/Field.tsx @@ -3,6 +3,7 @@ import type React from 'react' import { SelectField } from '@payloadcms/ui' -export const CustomSelectFieldServer: SelectFieldServerComponent = ({ clientField }) => { - return <SelectField field={clientField} /> +export const CustomSelectFieldServer: SelectFieldServerComponent = (props) => { + const path = (props?.path || props?.field?.name || '') as string + return <SelectField field={props?.clientField} path={path} /> } diff --git a/examples/custom-components/src/collections/Fields/select/components/server/Label.tsx b/examples/custom-components/src/collections/Fields/select/components/server/Label.tsx index 3518743640a..2a3560e1a3c 100644 --- a/examples/custom-components/src/collections/Fields/select/components/server/Label.tsx +++ b/examples/custom-components/src/collections/Fields/select/components/server/Label.tsx @@ -3,9 +3,6 @@ import type { SelectFieldLabelServerComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomSelectFieldLabelServer: SelectFieldLabelServerComponent = ({ - clientField, - label, -}) => { - return <FieldLabel field={clientField} label={label} /> +export const CustomSelectFieldLabelServer: SelectFieldLabelServerComponent = (props) => { + return <FieldLabel label={props?.label} /> } diff --git a/examples/custom-components/src/collections/Fields/text/components/client/Field.tsx b/examples/custom-components/src/collections/Fields/text/components/client/Field.tsx index c78c8e1480a..bfad63cca97 100644 --- a/examples/custom-components/src/collections/Fields/text/components/client/Field.tsx +++ b/examples/custom-components/src/collections/Fields/text/components/client/Field.tsx @@ -4,6 +4,6 @@ import type { TextFieldClientComponent } from 'payload' import { TextField } from '@payloadcms/ui' import React from 'react' -export const CustomTextFieldClient: TextFieldClientComponent = ({ field }) => { - return <TextField field={field} /> +export const CustomTextFieldClient: TextFieldClientComponent = (props) => { + return <TextField field={props?.field} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/text/components/client/Label.tsx b/examples/custom-components/src/collections/Fields/text/components/client/Label.tsx index bc500b6f9e7..71e3af3f64a 100644 --- a/examples/custom-components/src/collections/Fields/text/components/client/Label.tsx +++ b/examples/custom-components/src/collections/Fields/text/components/client/Label.tsx @@ -4,6 +4,6 @@ import type { TextFieldLabelClientComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomTextFieldLabelClient: TextFieldLabelClientComponent = ({ field, label }) => { - return <FieldLabel field={field} label={label} /> +export const CustomTextFieldLabelClient: TextFieldLabelClientComponent = (props) => { + return <FieldLabel label={props?.label} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/text/components/server/Field.tsx b/examples/custom-components/src/collections/Fields/text/components/server/Field.tsx index 0f9ac581520..080574e47c2 100644 --- a/examples/custom-components/src/collections/Fields/text/components/server/Field.tsx +++ b/examples/custom-components/src/collections/Fields/text/components/server/Field.tsx @@ -3,6 +3,7 @@ import type React from 'react' import { TextField } from '@payloadcms/ui' -export const CustomTextFieldServer: TextFieldServerComponent = ({ clientField }) => { - return <TextField field={clientField} /> +export const CustomTextFieldServer: TextFieldServerComponent = (props) => { + const path = (props?.path || props?.field?.name || '') as string + return <TextField field={props?.clientField} path={path} /> } diff --git a/examples/custom-components/src/collections/Fields/text/components/server/Label.tsx b/examples/custom-components/src/collections/Fields/text/components/server/Label.tsx index 5bf2f7b7d93..eedfbcd1096 100644 --- a/examples/custom-components/src/collections/Fields/text/components/server/Label.tsx +++ b/examples/custom-components/src/collections/Fields/text/components/server/Label.tsx @@ -3,9 +3,6 @@ import type { TextFieldLabelServerComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomTextFieldLabelServer: TextFieldLabelServerComponent = ({ - clientField, - label, -}) => { - return <FieldLabel field={clientField} label={label} /> +export const CustomTextFieldLabelServer: TextFieldLabelServerComponent = (props) => { + return <FieldLabel label={props?.label} /> } diff --git a/examples/custom-components/src/collections/Fields/textarea/components/client/Field.tsx b/examples/custom-components/src/collections/Fields/textarea/components/client/Field.tsx index b7630f198ba..585aa36e6ae 100644 --- a/examples/custom-components/src/collections/Fields/textarea/components/client/Field.tsx +++ b/examples/custom-components/src/collections/Fields/textarea/components/client/Field.tsx @@ -4,6 +4,6 @@ import type { TextareaFieldClientComponent } from 'payload' import { TextareaField } from '@payloadcms/ui' import React from 'react' -export const CustomTextareaFieldClient: TextareaFieldClientComponent = ({ field }) => { - return <TextareaField field={field} /> +export const CustomTextareaFieldClient: TextareaFieldClientComponent = (props) => { + return <TextareaField field={props?.field} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/textarea/components/client/Label.tsx b/examples/custom-components/src/collections/Fields/textarea/components/client/Label.tsx index d9aa978a794..50173c4c945 100644 --- a/examples/custom-components/src/collections/Fields/textarea/components/client/Label.tsx +++ b/examples/custom-components/src/collections/Fields/textarea/components/client/Label.tsx @@ -4,9 +4,6 @@ import type { TextareaFieldLabelClientComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomTextareaFieldLabelClient: TextareaFieldLabelClientComponent = ({ - field, - label, -}) => { - return <FieldLabel field={field} label={label} /> +export const CustomTextareaFieldLabelClient: TextareaFieldLabelClientComponent = (props) => { + return <FieldLabel label={props?.label} path={props?.path} /> } diff --git a/examples/custom-components/src/collections/Fields/textarea/components/server/Field.tsx b/examples/custom-components/src/collections/Fields/textarea/components/server/Field.tsx index 0bb0d562e91..ede87ffc1ee 100644 --- a/examples/custom-components/src/collections/Fields/textarea/components/server/Field.tsx +++ b/examples/custom-components/src/collections/Fields/textarea/components/server/Field.tsx @@ -3,6 +3,7 @@ import type React from 'react' import { TextareaField } from '@payloadcms/ui' -export const CustomTextareaFieldServer: TextareaFieldServerComponent = ({ clientField }) => { - return <TextareaField field={clientField} /> +export const CustomTextareaFieldServer: TextareaFieldServerComponent = (props) => { + const path = (props?.path || props?.field?.name || '') as string + return <TextareaField field={props?.clientField} path={path} /> } diff --git a/examples/custom-components/src/collections/Fields/textarea/components/server/Label.tsx b/examples/custom-components/src/collections/Fields/textarea/components/server/Label.tsx index 03cfb07805f..a9989223626 100644 --- a/examples/custom-components/src/collections/Fields/textarea/components/server/Label.tsx +++ b/examples/custom-components/src/collections/Fields/textarea/components/server/Label.tsx @@ -3,9 +3,6 @@ import type { TextareaFieldLabelServerComponent } from 'payload' import { FieldLabel } from '@payloadcms/ui' import React from 'react' -export const CustomTextareaFieldLabelServer: TextareaFieldLabelServerComponent = ({ - clientField, - label, -}) => { - return <FieldLabel field={clientField} label={label} /> +export const CustomTextareaFieldLabelServer: TextareaFieldLabelServerComponent = (props) => { + return <FieldLabel label={props?.label} /> } diff --git a/examples/custom-components/src/payload-types.ts b/examples/custom-components/src/payload-types.ts index da4f5cf4d78..f05b9d36493 100644 --- a/examples/custom-components/src/payload-types.ts +++ b/examples/custom-components/src/payload-types.ts @@ -15,17 +15,33 @@ export interface Config { 'custom-views': CustomView; 'custom-root-views': CustomRootView; users: User; + 'payload-locked-documents': PayloadLockedDocument; 'payload-preferences': PayloadPreference; 'payload-migrations': PayloadMigration; }; + collectionsJoins: {}; + collectionsSelect: { + 'custom-fields': CustomFieldsSelect<false> | CustomFieldsSelect<true>; + 'custom-views': CustomViewsSelect<false> | CustomViewsSelect<true>; + 'custom-root-views': CustomRootViewsSelect<false> | CustomRootViewsSelect<true>; + users: UsersSelect<false> | UsersSelect<true>; + 'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>; + 'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>; + 'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>; + }; db: { defaultIDType: string; }; globals: {}; + globalsSelect: {}; locale: null; user: User & { collection: 'users'; }; + jobs?: { + tasks: unknown; + workflows?: unknown; + }; } export interface UserAuthOperations { forgotPassword: { @@ -148,6 +164,37 @@ export interface User { lockUntil?: string | null; password?: string | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-locked-documents". + */ +export interface PayloadLockedDocument { + id: string; + document?: + | ({ + relationTo: 'custom-fields'; + value: string | CustomField; + } | null) + | ({ + relationTo: 'custom-views'; + value: string | CustomView; + } | null) + | ({ + relationTo: 'custom-root-views'; + value: string | CustomRootView; + } | null) + | ({ + relationTo: 'users'; + value: string | User; + } | null); + globalSlug?: string | null; + user: { + relationTo: 'users'; + value: string | User; + }; + updatedAt: string; + createdAt: string; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-preferences". @@ -182,6 +229,134 @@ export interface PayloadMigration { updatedAt: string; createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-fields_select". + */ +export interface CustomFieldsSelect<T extends boolean = true> { + title?: T; + arrayFieldServerComponent?: + | T + | { + title?: T; + id?: T; + }; + arrayFieldClientComponent?: + | T + | { + title?: T; + id?: T; + }; + blocksFieldServerComponent?: + | T + | { + text?: + | T + | { + content?: T; + id?: T; + blockName?: T; + }; + }; + blocksFieldClientComponent?: + | T + | { + text?: + | T + | { + content?: T; + id?: T; + blockName?: T; + }; + }; + checkboxFieldServerComponent?: T; + checkboxFieldClientComponent?: T; + dateFieldServerComponent?: T; + dateFieldClientComponent?: T; + emailFieldServerComponent?: T; + emailFieldClientComponent?: T; + numberFieldServerComponent?: T; + numberFieldClientComponent?: T; + pointFieldServerComponent?: T; + pointFieldClientComponent?: T; + radioFieldServerComponent?: T; + radioFieldClientComponent?: T; + relationshipFieldServerComponent?: T; + relationshipFieldClientComponent?: T; + selectFieldServerComponent?: T; + selectFieldClientComponent?: T; + textFieldServerComponent?: T; + textFieldClientComponent?: T; + textareaFieldServerComponent?: T; + textareaFieldClientComponent?: T; + updatedAt?: T; + createdAt?: T; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-views_select". + */ +export interface CustomViewsSelect<T extends boolean = true> { + title?: T; + updatedAt?: T; + createdAt?: T; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-root-views_select". + */ +export interface CustomRootViewsSelect<T extends boolean = true> { + title?: T; + updatedAt?: T; + createdAt?: T; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users_select". + */ +export interface UsersSelect<T extends boolean = true> { + updatedAt?: T; + createdAt?: T; + email?: T; + resetPasswordToken?: T; + resetPasswordExpiration?: T; + salt?: T; + hash?: T; + loginAttempts?: T; + lockUntil?: T; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-locked-documents_select". + */ +export interface PayloadLockedDocumentsSelect<T extends boolean = true> { + document?: T; + globalSlug?: T; + user?: T; + updatedAt?: T; + createdAt?: T; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences_select". + */ +export interface PayloadPreferencesSelect<T extends boolean = true> { + user?: T; + key?: T; + value?: T; + updatedAt?: T; + createdAt?: T; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations_select". + */ +export interface PayloadMigrationsSelect<T extends boolean = true> { + name?: T; + batch?: T; + updatedAt?: T; + createdAt?: T; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "auth".
aee6ca05ccff6b690a83974485d411224dd0821a
2023-04-17 21:04:31
Elliot DeNolf
fix: proper height data for animated gifs (#2506)
false
proper height data for animated gifs (#2506)
fix
diff --git a/src/uploads/generateFileData.ts b/src/uploads/generateFileData.ts index e5915e90a59..70376dd4bf1 100644 --- a/src/uploads/generateFileData.ts +++ b/src/uploads/generateFileData.ts @@ -108,10 +108,13 @@ export const generateFileData = async <T>({ } if (sharpFile) { + const metadata = await sharpFile.metadata(); fileBuffer = await sharpFile.toBuffer({ resolveWithObject: true }); - ({ mime, ext } = await fromBuffer(fileBuffer.data)); + ({ mime, ext } = await fromBuffer(fileBuffer.data)); // This is getting an incorrect gif height back. fileData.width = fileBuffer.info.width; - fileData.height = fileBuffer.info.height; + + // Animated GIFs aggregate the height from every frame, so we need to use divide by number of pages + fileData.height = sharpOptions.animated ? (fileBuffer.info.height / metadata.pages) : fileBuffer.info.height; fileData.filesize = fileBuffer.data.length; } else { mime = file.mimetype; diff --git a/test/uploads/config.ts b/test/uploads/config.ts index a84a26f5132..b5867c02035 100644 --- a/test/uploads/config.ts +++ b/test/uploads/config.ts @@ -53,12 +53,43 @@ export default buildConfig({ }, ], }, + { + slug: 'gif-resize', + upload: { + staticURL: '/media-gif', + staticDir: './media-gif', + mimeTypes: ['image/gif'], + resizeOptions: { + position: 'center', + width: 200, + height: 200, + }, + formatOptions: { + format: 'gif', + }, + imageSizes: [ + { + name: 'small', + width: 100, + height: 100, + formatOptions: { format: 'gif', options: { quality: 90 } }, + }, + { + name: 'large', + width: 1000, + height: 1000, + formatOptions: { format: 'gif', options: { quality: 90 } }, + }, + ], + }, + fields: [], + }, { slug: mediaSlug, upload: { staticURL: '/media', staticDir: './media', - mimeTypes: ['image/png', 'image/jpg', 'image/jpeg', 'image/svg+xml', 'audio/mpeg'], + mimeTypes: ['image/png', 'image/jpg', 'image/jpeg', 'image/gif', 'image/svg+xml', 'audio/mpeg'], resizeOptions: { width: 1280, height: 720,
7cccca8194e0eb8b39b49199d6a0342ac91df045
2024-04-03 20:41:19
Jessica Chowdhury
chore(alpha): update fields-relationship e2e tests (#5553)
false
update fields-relationship e2e tests (#5553)
chore
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e5ea4ba01e8..a3789c7bdad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -249,7 +249,7 @@ jobs: # - admin - auth - field-error-states - # - fields-relationship + - fields-relationship # - fields - fields/lexical - live-preview diff --git a/packages/ui/src/elements/withMergedProps/index.tsx b/packages/ui/src/elements/withMergedProps/index.tsx index 35d3c563cf5..e84ab4b7201 100644 --- a/packages/ui/src/elements/withMergedProps/index.tsx +++ b/packages/ui/src/elements/withMergedProps/index.tsx @@ -28,7 +28,7 @@ export function withMergedProps<ToMergeIntoProps, CompleteReturnProps>({ }): React.FC<CompleteReturnProps> { // A wrapper around the args.Component to inject the args.toMergeArgs as props, which are merged with the passed props const MergedPropsComponent: React.FC<CompleteReturnProps> = (passedProps) => { - const mergedProps = deepMerge(toMergeIntoProps, passedProps) + const mergedProps = deepMerge(passedProps, toMergeIntoProps) return <Component {...mergedProps} /> } diff --git a/packages/ui/src/forms/Form/mergeServerFormState.ts b/packages/ui/src/forms/Form/mergeServerFormState.ts index 92d4111cbd1..12be405789a 100644 --- a/packages/ui/src/forms/Form/mergeServerFormState.ts +++ b/packages/ui/src/forms/Form/mergeServerFormState.ts @@ -1,5 +1,7 @@ import type { FormState } from 'payload/types' +import deepEquals from 'deep-equal' + import { mergeErrorPaths } from './mergeErrorPaths.js' const serverPropsToAccept = ['passesCondition', 'valid', 'errorMessage'] @@ -38,6 +40,16 @@ export const mergeServerFormState = ( newFieldState.errorPaths = errorPathsResult.result } + /** + * Handle filterOptions + */ + if (incomingState[path]?.filterOptions || newFieldState.filterOptions) { + if (!deepEquals(incomingState[path]?.filterOptions, newFieldState.filterOptions)) { + changed = true + newFieldState.filterOptions = incomingState[path].filterOptions + } + } + /** * Handle the rest which is in serverPropsToAccept */ diff --git a/test/fields-relationship/config.ts b/test/fields-relationship/config.ts index 2f0cf23824f..77a2746d8bd 100644 --- a/test/fields-relationship/config.ts +++ b/test/fields-relationship/config.ts @@ -192,7 +192,7 @@ export default buildConfigWithDefaults({ }, { admin: { - useAsTitle: 'meta.title', + useAsTitle: 'name', }, fields: [ ...baseRelationshipFields, diff --git a/test/fields-relationship/e2e.spec.ts b/test/fields-relationship/e2e.spec.ts index 9fbbce0e72e..d5aa467ee82 100644 --- a/test/fields-relationship/e2e.spec.ts +++ b/test/fields-relationship/e2e.spec.ts @@ -251,7 +251,7 @@ describe('fields - relationship', () => { // then verify that the filtered field's options match let filteredField = page.locator(`#field-${fieldName} .react-select`) await filteredField.click({ delay: 100 }) - const filteredOptions = filteredField.locator('.rs__option') + let filteredOptions = filteredField.locator('.rs__option') await expect(filteredOptions).toHaveCount(1) // one doc await filteredOptions.nth(0).click() await expect(filteredField).toContainText(relationOneDoc.id) @@ -268,6 +268,7 @@ describe('fields - relationship', () => { // then verify that the filtered field's options match filteredField = page.locator(`#field-${fieldName} .react-select`) await filteredField.click({ delay: 100 }) + filteredOptions = filteredField.locator('.rs__option') await expect(filteredOptions).toHaveCount(2) // two options because the currently selected option is still there await filteredOptions.nth(1).click() await expect(filteredField).toContainText(anotherRelationOneDoc.id)
36d51de201b27ef91f43f05992d980ad306ba9f3
2020-12-31 01:29:54
Jarrod Flesch
fix: adds delete and unlock to joi baseField schema
false
adds delete and unlock to joi baseField schema
fix
diff --git a/src/fields/config/schema.ts b/src/fields/config/schema.ts index 44b2eeccc32..9b1a7abb00f 100644 --- a/src/fields/config/schema.ts +++ b/src/fields/config/schema.ts @@ -33,6 +33,8 @@ export const baseField = joi.object().keys({ create: joi.func(), read: joi.func(), update: joi.func(), + delete: joi.func(), + unlock: joi.func(), }), hooks: joi.object() .keys({
52589f7c59557720e61fd2ae636e3d5cfaa5d32d
2023-01-30 21:01:30
Jarrod Flesch
chore: removes top level spread of version data on version doc
false
removes top level spread of version data on version doc
chore
diff --git a/src/versions/saveVersion.ts b/src/versions/saveVersion.ts index f5499a5ee2e..a02cb3213bd 100644 --- a/src/versions/saveVersion.ts +++ b/src/versions/saveVersion.ts @@ -77,7 +77,6 @@ export const saveVersion = async ({ if (createNewVersion) { const data: Record<string, unknown> = { - ...versionData, autosave: Boolean(autosave), version: versionData, createdAt: draft ? now : new Date(doc.createdAt).toISOString(),
75e776ddb43b292eae6c1204589d9dc22deab50c
2023-03-13 23:59:59
PatrikKozak
fix: flattens title fields to allow seaching by title if title inside Row field
false
flattens title fields to allow seaching by title if title inside Row field
fix
diff --git a/src/admin/components/elements/ListControls/index.tsx b/src/admin/components/elements/ListControls/index.tsx index cca645d3a84..b29c4fcc259 100644 --- a/src/admin/components/elements/ListControls/index.tsx +++ b/src/admin/components/elements/ListControls/index.tsx @@ -10,6 +10,7 @@ import Button from '../Button'; import { Props } from './types'; import { useSearchParams } from '../../utilities/SearchParams'; import validateWhereQuery from '../WhereBuilder/validateWhereQuery'; +import flattenFields from '../../../../utilities/flattenTopLevelFields'; import { getTextFieldsToBeSearched } from './getTextFieldsToBeSearched'; import { getTranslation } from '../../../../utilities/getTranslation'; @@ -37,7 +38,10 @@ const ListControls: React.FC<Props> = (props) => { const params = useSearchParams(); const shouldInitializeWhereOpened = validateWhereQuery(params?.where); - const [titleField] = useState(() => fields.find((field) => fieldAffectsData(field) && field.name === useAsTitle)); + const [titleField] = useState(() => { + const topLevelFields = flattenFields(fields); + return topLevelFields.find((field) => fieldAffectsData(field) && field.name === useAsTitle); + }); const [textFieldsToBeSearched] = useState(getTextFieldsToBeSearched(listSearchableFields, fields)); const [visibleDrawer, setVisibleDrawer] = useState<'where' | 'sort' | 'columns'>(shouldInitializeWhereOpened ? 'where' : undefined); const { t, i18n } = useTranslation('general');
546011d8a97b2c1b7307e3314e2a50a9d3fc5ef8
2022-07-21 03:35:47
Elliot DeNolf
chore: add MIT license badge
false
add MIT license badge
chore
diff --git a/README.md b/README.md index 39df6f76f1e..e0499916fd5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ <h1 align="center">Payload</h1> <p align="center">A free and open-source TypeScript headless CMS & application framework built with Express, MongoDB and React.</p> <p align="center"> + <a href="https://opensource.org/licenses/MIT"> + <img src="https://img.shields.io/badge/License-MIT-blue.svg" /> + </a> <a href="https://github.com/payloadcms/payload/actions"> <img src="https://github.com/payloadcms/payload/workflows/build/badge.svg" /> </a>
356f174b9ff601facb0062d0b65db18803ef2aa2
2023-08-04 22:52:05
Dan Ribbens
feat: set JWT token field name with saveToJWT (#3126)
false
set JWT token field name with saveToJWT (#3126)
feat
diff --git a/docs/authentication/overview.mdx b/docs/authentication/overview.mdx index 0bf7b6a92f4..32bedf00ce2 100644 --- a/docs/authentication/overview.mdx +++ b/docs/authentication/overview.mdx @@ -83,9 +83,11 @@ Once enabled, each document that is created within the Collection can be thought Successfully logging in returns a `JWT` (JSON web token) which is how a user will identify themselves to Payload. By providing this JWT via either an HTTP-only cookie or an `Authorization` header, Payload will automatically identify the user and add its user JWT data to the Express `req`, which is available throughout Payload including within access control, hooks, and more. +You can specify what data gets encoded to the JWT token by setting `saveToJWT` to true in your auth collection fields. If you wish to use a different key other than the field `name`, you can provide it to `saveToJWT` as a string. + <Banner type="success"> <strong>Tip:</strong><br/> - You can access the logged in user from access control functions and hooks via the Express <strong>req</strong>. The logged in user is automatically added as the <strong>user</strong> property. + You can access the logged-in user from access control functions and hooks via the Express <strong>req</strong>. The logged-in user is automatically added as the <strong>user</strong> property. </Banner> ### HTTP-only cookies diff --git a/src/auth/operations/getFieldsToSign.ts b/src/auth/operations/getFieldsToSign.ts index e5a86cf9e11..83ad020bd08 100644 --- a/src/auth/operations/getFieldsToSign.ts +++ b/src/auth/operations/getFieldsToSign.ts @@ -18,16 +18,17 @@ export const getFieldsToSign = (args: { ...signedFields, }; + // get subfields from non-named fields like rows if (!fieldAffectsData(field) && fieldHasSubFields(field)) { field.fields.forEach((subField) => { if (fieldAffectsData(subField) && subField.saveToJWT) { - result[subField.name] = user[subField.name]; + result[typeof subField.saveToJWT === 'string' ? subField.saveToJWT : subField.name] = user[subField.name]; } }); } if (fieldAffectsData(field) && field.saveToJWT) { - result[field.name] = user[field.name]; + result[typeof field.saveToJWT === 'string' ? field.saveToJWT : field.name] = user[field.name]; } return result; diff --git a/src/auth/operations/resetPassword.ts b/src/auth/operations/resetPassword.ts index c4e04830f88..20635c2943d 100644 --- a/src/auth/operations/resetPassword.ts +++ b/src/auth/operations/resetPassword.ts @@ -3,7 +3,7 @@ import { Response } from 'express'; import { Collection } from '../../collections/config/types'; import { APIError } from '../../errors'; import getCookieExpiration from '../../utilities/getCookieExpiration'; -import { fieldAffectsData } from '../../fields/config/types'; +import { getFieldsToSign } from './getFieldsToSign'; import { PayloadRequest } from '../../express/types'; import { authenticateLocalStrategy } from '../strategies/local/authenticate'; import { generatePasswordSaltHash } from '../strategies/local/generatePasswordSaltHash'; @@ -83,18 +83,10 @@ async function resetPassword(args: Arguments): Promise<Result> { await authenticateLocalStrategy({ password: data.password, doc }); - const fieldsToSign = collectionConfig.fields.reduce((signedFields, field) => { - if (fieldAffectsData(field) && field.saveToJWT) { - return { - ...signedFields, - [field.name]: user[field.name], - }; - } - return signedFields; - }, { + const fieldsToSign = getFieldsToSign({ + collectionConfig, + user, email: user.email, - id: user.id, - collection: collectionConfig.slug, }); const token = jwt.sign( diff --git a/src/fields/config/schema.ts b/src/fields/config/schema.ts index 2d1f2dd7329..c1125aa6f90 100644 --- a/src/fields/config/schema.ts +++ b/src/fields/config/schema.ts @@ -33,7 +33,10 @@ export const baseField = joi.object().keys({ joi.valid(false), ), required: joi.boolean().default(false), - saveToJWT: joi.boolean().default(false), + saveToJWT: joi.alternatives().try( + joi.boolean(), + joi.string(), + ).default(false), unique: joi.boolean().default(false), localized: joi.boolean().default(false), index: joi.boolean().default(false), diff --git a/src/fields/config/types.ts b/src/fields/config/types.ts index 6b0bdc234c5..edbc0b6e8b9 100644 --- a/src/fields/config/types.ts +++ b/src/fields/config/types.ts @@ -1,7 +1,7 @@ /* eslint-disable no-use-before-define */ import { CSSProperties } from 'react'; import { Editor } from 'slate'; -import type { TFunction, i18n as Ii18n } from 'i18next'; +import type { i18n as Ii18n, TFunction } from 'i18next'; import type { EditorProps } from '@monaco-editor/react'; import { Operation, Where } from '../../types'; import { SanitizedConfig } from '../../config/types'; @@ -108,7 +108,7 @@ export interface FieldBase { index?: boolean; defaultValue?: any; hidden?: boolean; - saveToJWT?: boolean + saveToJWT?: string | boolean; localized?: boolean; validate?: Validate; hooks?: { diff --git a/test/auth/config.ts b/test/auth/config.ts index 0e396976db2..d4066183929 100644 --- a/test/auth/config.ts +++ b/test/auth/config.ts @@ -6,6 +6,10 @@ import { AuthDebug } from './AuthDebug'; export const slug = 'users'; +export const namedSaveToJWTValue = 'namedSaveToJWT value'; + +export const saveToJWTKey = 'x-custom-jwt-property-name'; + export default buildConfigWithDefaults({ admin: { user: 'users', @@ -38,6 +42,12 @@ export default buildConfigWithDefaults({ saveToJWT: true, hasMany: true, }, + { + name: 'namedSaveToJWT', + type: 'text', + defaultValue: namedSaveToJWTValue, + saveToJWT: saveToJWTKey, + }, { name: 'custom', label: 'Custom', diff --git a/test/auth/int.spec.ts b/test/auth/int.spec.ts index 6d5cd1547f4..af866e4d617 100644 --- a/test/auth/int.spec.ts +++ b/test/auth/int.spec.ts @@ -1,7 +1,8 @@ import mongoose from 'mongoose'; +import jwtDecode from 'jwt-decode'; import payload from '../../src'; import { initPayloadTest } from '../helpers/configHelpers'; -import { slug } from './config'; +import { namedSaveToJWTValue, saveToJWTKey, slug } from './config'; import { devUser } from '../credentials'; import type { User } from '../../src/auth'; @@ -101,6 +102,24 @@ describe('Auth', () => { expect(data.user.email).toBeDefined(); }); + it('should have fields saved to JWT', async () => { + const { + email: jwtEmail, + collection, + roles, + [saveToJWTKey]: customJWTPropertyKey, + iat, + exp, + } = jwtDecode<User>(token); + + expect(jwtEmail).toBeDefined(); + expect(collection).toEqual('users'); + expect(Array.isArray(roles)).toBeTruthy(); + // 'x-custom-jwt-property-name': 'namedSaveToJWT value' + expect(customJWTPropertyKey).toEqual(namedSaveToJWTValue); + expect(iat).toBeDefined(); + expect(exp).toBeDefined(); + }); it('should allow authentication with an API key with useAPIKey', async () => { const apiKey = '0123456789ABCDEFGH';
9ac7a3ed4925aad3c8d8a60873aee15207dd51c9
2025-03-11 00:50:58
Jessica Chowdhury
fix(ui): adds fallback locale when defaultLocale is unavailable (#11614)
false
adds fallback locale when defaultLocale is unavailable (#11614)
fix
diff --git a/packages/ui/src/fields/Array/index.tsx b/packages/ui/src/fields/Array/index.tsx index 6ad79c062a6..08a9f783924 100644 --- a/packages/ui/src/fields/Array/index.tsx +++ b/packages/ui/src/fields/Array/index.tsx @@ -69,7 +69,7 @@ export const ArrayFieldComponent: ArrayFieldClientComponent = (props) => { const editingDefaultLocale = (() => { if (localization && localization.fallback) { - const defaultLocale = localization.defaultLocale || 'en' + const defaultLocale = localization.defaultLocale return locale === defaultLocale } diff --git a/packages/ui/src/fields/Blocks/index.tsx b/packages/ui/src/fields/Blocks/index.tsx index fe6de2e8c31..e0904f65070 100644 --- a/packages/ui/src/fields/Blocks/index.tsx +++ b/packages/ui/src/fields/Blocks/index.tsx @@ -76,7 +76,7 @@ const BlocksFieldComponent: BlocksFieldClientComponent = (props) => { const editingDefaultLocale = (() => { if (localization && localization.fallback) { - const defaultLocale = localization.defaultLocale || 'en' + const defaultLocale = localization.defaultLocale return locale === defaultLocale } diff --git a/packages/ui/src/forms/NullifyField/index.tsx b/packages/ui/src/forms/NullifyField/index.tsx index 7fa03aa66b6..a3f5defdb8e 100644 --- a/packages/ui/src/forms/NullifyField/index.tsx +++ b/packages/ui/src/forms/NullifyField/index.tsx @@ -24,12 +24,15 @@ export const NullifyLocaleField: React.FC<NullifyLocaleFieldProps> = ({ config: { localization }, } = useConfig() const [checked, setChecked] = React.useState<boolean>(typeof fieldValue !== 'number') - const defaultLocale = - localization && localization.defaultLocale ? localization.defaultLocale : 'en' const { t } = useTranslation() - if (!localized || currentLocale === defaultLocale || (localization && !localization.fallback)) { - // hide when field is not localized or editing default locale or when fallback is disabled + if (!localized || !localization) { + // hide when field is not localized or localization is not enabled + return null + } + + if (localization.defaultLocale === currentLocale || !localization.fallback) { + // if editing default locale or when fallback is disabled return null } diff --git a/packages/ui/src/providers/Locale/index.tsx b/packages/ui/src/providers/Locale/index.tsx index 26ec89a32d7..0aaa2884e7b 100644 --- a/packages/ui/src/providers/Locale/index.tsx +++ b/packages/ui/src/providers/Locale/index.tsx @@ -48,14 +48,13 @@ export const LocaleProvider: React.FC<{ children?: React.ReactNode; locale?: Loc const { user } = useAuth() - const defaultLocale = - localization && localization.defaultLocale ? localization.defaultLocale : 'en' + const defaultLocale = localization ? localization.defaultLocale : 'en' const { getPreference, setPreference } = usePreferences() const localeFromParams = useSearchParams().get('locale') const [locale, setLocale] = React.useState<Locale>(() => { - if (!localization) { + if (!localization || (localization && !localization.locales.length)) { // TODO: return null V4 return {} as Locale } @@ -63,7 +62,8 @@ export const LocaleProvider: React.FC<{ children?: React.ReactNode; locale?: Loc return ( findLocaleFromCode(localization, localeFromParams) || findLocaleFromCode(localization, initialLocaleFromPrefs) || - findLocaleFromCode(localization, defaultLocale) + findLocaleFromCode(localization, defaultLocale) || + findLocaleFromCode(localization, localization.locales[0].code) ) }) @@ -97,14 +97,16 @@ export const LocaleProvider: React.FC<{ children?: React.ReactNode; locale?: Loc if (localization && user?.id) { const localeToUse = localeFromParams || - (await fetchPreferences<Locale['code']>('locale', fetchURL)?.then((res) => res.value)) || - defaultLocale + (await fetchPreferences<Locale['code']>('locale', fetchURL)?.then((res) => res.value)) const newLocale = findLocaleFromCode(localization, localeToUse) || - findLocaleFromCode(localization, defaultLocale) + findLocaleFromCode(localization, defaultLocale) || + findLocaleFromCode(localization, localization?.locales?.[0]?.code) - setLocale(newLocale) + if (newLocale) { + setLocale(newLocale) + } } }
9cb84c48b9d73f9f5d48c1d82d9bea861b51bc00
2024-08-13 19:54:30
Patrik
fix(live-preview): encode query string url (#7635)
false
encode query string url (#7635)
fix
diff --git a/packages/live-preview/src/mergeData.ts b/packages/live-preview/src/mergeData.ts index fe099355ad9..b95ed5d3cb6 100644 --- a/packages/live-preview/src/mergeData.ts +++ b/packages/live-preview/src/mergeData.ts @@ -71,7 +71,9 @@ export const mergeData = async <T>(args: { try { res = await requestHandler({ apiPath: apiRoute || '/api', - endpoint: `${collection}?depth=${depth}&where[id][in]=${Array.from(ids).join(',')}`, + endpoint: encodeURI( + `${collection}?depth=${depth}&where[id][in]=${Array.from(ids).join(',')}`, + ), serverURL, }).then((res) => res.json()) diff --git a/test/live-preview/int.spec.ts b/test/live-preview/int.spec.ts index 3127b1b1aa3..df893647e65 100644 --- a/test/live-preview/int.spec.ts +++ b/test/live-preview/int.spec.ts @@ -31,6 +31,7 @@ describe('Collections - Live Preview', () => { let serverURL let testPost: Post + let testPostTwo: Post let tenant: Tenant let media: Media @@ -54,6 +55,15 @@ describe('Collections - Live Preview', () => { }, }) + testPostTwo = await payload.create({ + collection: postsSlug, + data: { + slug: 'post-2', + title: 'Test Post 2', + tenant: tenant.id, + }, + }) + // Create image const filePath = path.resolve(dirname, './seed/image-1.jpg') const file = await getFileByPath(filePath) @@ -1280,4 +1290,85 @@ describe('Collections - Live Preview', () => { expect(merge3.layout).toHaveLength(0) expect(merge3._numberOfRequests).toEqual(0) }) + + it('properly encodes URLs in requests', async () => { + const initialData: Partial<Page> = { + title: 'Test Page', + } + + let capturedEndpoint: string | undefined + + const customRequestHandler = async ({ apiPath, endpoint, serverURL }) => { + capturedEndpoint = `${serverURL}${apiPath}/${endpoint}` + + const mockResponse = { + ok: true, + status: 200, + headers: new Headers({ 'Content-Type': 'application/json' }), + json: () => ({ + docs: [ + { + id: testPost.id, + slug: 'post-1', + tenant: { id: 'tenant-id', title: 'Tenant 1' }, + title: 'Test Post', + createdAt: new Date().toISOString(), + updatedAt: new Date().toISOString(), + }, + { + id: testPostTwo.id, + slug: 'post-2', + tenant: { id: 'tenant-id', title: 'Tenant 1' }, + title: 'Test Post 2', + createdAt: new Date().toISOString(), + updatedAt: new Date().toISOString(), + }, + ], + }), + } + + return Promise.resolve(mockResponse as unknown as Response) + } + + const mergedData = await mergeData({ + depth: 1, + fieldSchema: schemaJSON, + incomingData: { + ...initialData, + relationshipPolyHasMany: [ + { value: testPost.id, relationTo: postsSlug }, + { value: testPostTwo.id, relationTo: postsSlug }, + ], + }, + initialData, + serverURL, + returnNumberOfRequests: true, + collectionPopulationRequestHandler: customRequestHandler, + }) + + expect(mergedData.relationshipPolyHasMany).toMatchObject([ + { + value: { + id: testPost.id, + slug: 'post-1', + title: 'Test Post', + }, + relationTo: postsSlug, + }, + { + value: { + id: testPostTwo.id, + slug: 'post-2', + title: 'Test Post 2', + }, + relationTo: postsSlug, + }, + ]) + + // Verify that the request was made to the properly encoded URL + // Without encodeURI wrapper the request URL - would receive string: "undefined/api/posts?depth=1&where[id][in]=66ba7ab6a60a945d10c8b976,66ba7ab6a60a945d10c8b979 + expect(capturedEndpoint).toContain( + encodeURI(`posts?depth=1&where[id][in]=${testPost.id},${testPostTwo.id}`), + ) + }) })
ee7221c986404c67e17f06985d8222744919ed47
2024-04-09 19:04:11
James
chore: sets maxRetries
false
sets maxRetries
chore
diff --git a/test/playwright.config.ts b/test/playwright.config.ts index 09500f6eb92..586dc245775 100644 --- a/test/playwright.config.ts +++ b/test/playwright.config.ts @@ -25,4 +25,5 @@ export default defineConfig({ timeout: EXPECT_TIMEOUT, }, workers: 16, + maxFailures: 1, }) diff --git a/tsconfig.json b/tsconfig.json index 51483129206..f076b0be8ff 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -37,7 +37,7 @@ ], "paths": { "@payload-config": [ - "./test/_community/config.ts" + "./test/fields/config.ts" ], "@payloadcms/live-preview": [ "./packages/live-preview/src" @@ -161,4 +161,4 @@ ".next/types/**/*.ts", "scripts/**/*.ts" ] -} +} \ No newline at end of file
bc4f6aaf9ce24c6120deda000174681fd7c335e4
2024-03-23 01:16:01
Alessio Gravili
chore: improve id type of adminUrlUtil
false
improve id type of adminUrlUtil
chore
diff --git a/test/helpers/adminUrlUtil.ts b/test/helpers/adminUrlUtil.ts index 2254d5ce4a3..09e5239d5df 100644 --- a/test/helpers/adminUrlUtil.ts +++ b/test/helpers/adminUrlUtil.ts @@ -18,7 +18,7 @@ export class AdminUrlUtil { return `${this.admin}/collections/${slug}` } - edit(id: string): string { + edit(id: number | string): string { return `${this.list}/${id}` }
48b60fc90509a291bbbb6380e71c821bdf8cc8c7
2024-11-21 09:49:18
Alessio Gravili
chore(richtext-lexical): enable strict: true (#9394)
false
enable strict: true (#9394)
chore
diff --git a/packages/richtext-lexical/src/features/blocks/client/component/index.tsx b/packages/richtext-lexical/src/features/blocks/client/component/index.tsx index 9e3cd3873f6..f91e922b8e0 100644 --- a/packages/richtext-lexical/src/features/blocks/client/component/index.tsx +++ b/packages/richtext-lexical/src/features/blocks/client/component/index.tsx @@ -162,7 +162,7 @@ export const BlockComponent: React.FC<Props> = (props) => { const { i18n, t } = useTranslation<object, string>() const onChange = useCallback( - async ({ formState: prevFormState, submit }: { formState: FormState; submit: boolean }) => { + async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => { abortAndIgnore(onChangeAbortControllerRef.current) const controller = new AbortController() diff --git a/packages/richtext-lexical/src/features/blocks/server/graphQLPopulationPromise.ts b/packages/richtext-lexical/src/features/blocks/server/graphQLPopulationPromise.ts index 158fc0efdad..79c12486835 100644 --- a/packages/richtext-lexical/src/features/blocks/server/graphQLPopulationPromise.ts +++ b/packages/richtext-lexical/src/features/blocks/server/graphQLPopulationPromise.ts @@ -9,7 +9,9 @@ import { recursivelyPopulateFieldsForGraphQL } from '../../../populateGraphQL/re export const blockPopulationPromiseHOC = ( blocks: Block[], ): PopulationPromise<SerializedBlockNode | SerializedInlineBlockNode> => { - const blockPopulationPromise: PopulationPromise<SerializedBlockNode> = ({ + const blockPopulationPromise: PopulationPromise< + SerializedBlockNode | SerializedInlineBlockNode + > = ({ context, currentDepth, depth, diff --git a/packages/richtext-lexical/src/features/converters/html/converter/defaultConverters.ts b/packages/richtext-lexical/src/features/converters/html/converter/defaultConverters.ts index 848d895a4ab..8802e10c1d8 100644 --- a/packages/richtext-lexical/src/features/converters/html/converter/defaultConverters.ts +++ b/packages/richtext-lexical/src/features/converters/html/converter/defaultConverters.ts @@ -4,7 +4,7 @@ import { LinebreakHTMLConverter } from './converters/linebreak.js' import { ParagraphHTMLConverter } from './converters/paragraph.js' import { TextHTMLConverter } from './converters/text.js' -export const defaultHTMLConverters: HTMLConverter[] = [ +export const defaultHTMLConverters: HTMLConverter<any>[] = [ ParagraphHTMLConverter, TextHTMLConverter, LinebreakHTMLConverter, diff --git a/packages/richtext-lexical/src/features/experimental_table/client/plugins/TableCellResizerPlugin/index.tsx b/packages/richtext-lexical/src/features/experimental_table/client/plugins/TableCellResizerPlugin/index.tsx index 3d6b25a1e0c..4a35614e71b 100644 --- a/packages/richtext-lexical/src/features/experimental_table/client/plugins/TableCellResizerPlugin/index.tsx +++ b/packages/richtext-lexical/src/features/experimental_table/client/plugins/TableCellResizerPlugin/index.tsx @@ -314,7 +314,19 @@ function TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element { [activeCell, mouseUpHandler], ) - const getResizers = useCallback(() => { + const [resizerStyles, setResizerStyles] = useState<{ + bottom?: null | React.CSSProperties + left?: null | React.CSSProperties + right?: null | React.CSSProperties + top?: null | React.CSSProperties + }>({ + bottom: null, + left: null, + right: null, + top: null, + }) + + useEffect(() => { if (activeCell) { const { height, left, top, width } = activeCell.elem.getBoundingClientRect() const zoom = calculateZoomLevel(activeCell.elem) @@ -324,16 +336,16 @@ function TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element { backgroundColor: 'none', cursor: 'row-resize', height: `${zoneWidth}px`, - left: `${window.pageXOffset + left}px`, - top: `${window.pageYOffset + top + height - zoneWidth / 2}px`, + left: `${window.scrollX + left}px`, + top: `${window.scrollY + top + height - zoneWidth / 2}px`, width: `${width}px`, }, right: { backgroundColor: 'none', cursor: 'col-resize', height: `${height}px`, - left: `${window.pageXOffset + left + width - zoneWidth / 2}px`, - top: `${window.pageYOffset + top}px`, + left: `${window.scrollX + left + width - zoneWidth / 2}px`, + top: `${window.scrollY + top}px`, width: `${zoneWidth}px`, }, } @@ -342,13 +354,13 @@ function TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element { if (draggingDirection && mouseCurrentPos && tableRect) { if (isHeightChanging(draggingDirection)) { - styles[draggingDirection].left = `${window.pageXOffset + tableRect.left}px` - styles[draggingDirection].top = `${window.pageYOffset + mouseCurrentPos.y / zoom}px` + styles[draggingDirection].left = `${window.scrollX + tableRect.left}px` + styles[draggingDirection].top = `${window.scrollY + mouseCurrentPos.y / zoom}px` styles[draggingDirection].height = '3px' styles[draggingDirection].width = `${tableRect.width}px` } else { - styles[draggingDirection].top = `${window.pageYOffset + tableRect.top}px` - styles[draggingDirection].left = `${window.pageXOffset + mouseCurrentPos.x / zoom}px` + styles[draggingDirection].top = `${window.scrollY + tableRect.top}px` + styles[draggingDirection].left = `${window.scrollX + mouseCurrentPos.x / zoom}px` styles[draggingDirection].width = '3px' styles[draggingDirection].height = `${tableRect.height}px` } @@ -356,19 +368,17 @@ function TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element { styles[draggingDirection].backgroundColor = '#adf' } - return styles - } - - return { - bottom: null, - left: null, - right: null, - top: null, + setResizerStyles(styles) + } else { + setResizerStyles({ + bottom: null, + left: null, + right: null, + top: null, + }) } }, [activeCell, draggingDirection, mouseCurrentPos]) - const resizerStyles = getResizers() - return ( <div ref={resizerRef}> {activeCell != null && !isMouseDown && ( diff --git a/packages/richtext-lexical/src/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.tsx b/packages/richtext-lexical/src/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.tsx index 74336268edd..ca912b4fccc 100644 --- a/packages/richtext-lexical/src/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.tsx +++ b/packages/richtext-lexical/src/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.tsx @@ -218,6 +218,7 @@ function TableHoverActionsContainer({ className={editorConfig.editorConfig.lexical.theme.tableAddRows} onClick={() => insertAction(true)} style={{ ...position }} + type="button" /> )} {isShownColumn && ( @@ -225,6 +226,7 @@ function TableHoverActionsContainer({ className={editorConfig.editorConfig.lexical.theme.tableAddColumns} onClick={() => insertAction(false)} style={{ ...position }} + type="button" /> )} </> diff --git a/packages/richtext-lexical/src/features/experimental_table/client/utils/useDebounce.ts b/packages/richtext-lexical/src/features/experimental_table/client/utils/useDebounce.ts index 5549cc0b6cf..ff472735d15 100644 --- a/packages/richtext-lexical/src/features/experimental_table/client/utils/useDebounce.ts +++ b/packages/richtext-lexical/src/features/experimental_table/client/utils/useDebounce.ts @@ -1,27 +1,35 @@ 'use client' -import { useMemo, useRef } from 'react' +import { useCallback, useEffect, useRef } from 'react' import debounce from './debounce.js' +// Define the type for debounced function that includes cancel method +interface DebouncedFunction<T extends (...args: any[]) => any> { + (...args: Parameters<T>): ReturnType<T> + cancel: () => void +} + export function useDebounce<T extends (...args: never[]) => void>( fn: T, ms: number, maxWait?: number, ) { - const funcRef = useRef<null | T>(null) - funcRef.current = fn + // Update the ref type to include cancel method + const debouncedRef = useRef<DebouncedFunction<T> | null>(null) + + useEffect(() => { + debouncedRef.current = debounce(fn, ms, { maxWait }) as DebouncedFunction<T> + + return () => { + debouncedRef.current?.cancel() + } + }, [fn, ms, maxWait]) + + const callback = useCallback((...args: Parameters<T>) => { + if (debouncedRef.current) { + debouncedRef.current(...args) + } + }, []) - return useMemo( - () => - debounce( - (...args: Parameters<T>) => { - if (funcRef.current) { - funcRef.current(...args) - } - }, - ms, - { maxWait }, - ), - [ms, maxWait], - ) + return callback } diff --git a/packages/richtext-lexical/src/features/lists/checklist/server/index.ts b/packages/richtext-lexical/src/features/lists/checklist/server/index.ts index d97d215a3b4..5ddaa68a5d0 100644 --- a/packages/richtext-lexical/src/features/lists/checklist/server/index.ts +++ b/packages/richtext-lexical/src/features/lists/checklist/server/index.ts @@ -18,7 +18,7 @@ export const ChecklistFeature = createServerFeature({ : [ createNode({ converters: { - html: ListHTMLConverter, + html: ListHTMLConverter as any, // ListHTMLConverter uses a different generic type than ListNode[exportJSON], thus we need to cast as any }, node: ListNode, }), diff --git a/packages/richtext-lexical/src/features/lists/orderedList/server/index.ts b/packages/richtext-lexical/src/features/lists/orderedList/server/index.ts index b681b5dd197..a497edb52bf 100644 --- a/packages/richtext-lexical/src/features/lists/orderedList/server/index.ts +++ b/packages/richtext-lexical/src/features/lists/orderedList/server/index.ts @@ -17,7 +17,7 @@ export const OrderedListFeature = createServerFeature({ : [ createNode({ converters: { - html: ListHTMLConverter, + html: ListHTMLConverter as any, // ListHTMLConverter uses a different generic type than ListNode[exportJSON], thus we need to cast as any }, node: ListNode, }), diff --git a/packages/richtext-lexical/src/features/lists/unorderedList/server/index.ts b/packages/richtext-lexical/src/features/lists/unorderedList/server/index.ts index e9907ef2ed5..6ed27d42768 100644 --- a/packages/richtext-lexical/src/features/lists/unorderedList/server/index.ts +++ b/packages/richtext-lexical/src/features/lists/unorderedList/server/index.ts @@ -14,7 +14,7 @@ export const UnorderedListFeature = createServerFeature({ nodes: [ createNode({ converters: { - html: ListHTMLConverter, + html: ListHTMLConverter as any, // ListHTMLConverter uses a different generic type than ListNode[exportJSON], thus we need to cast as any }, node: ListNode, }), diff --git a/packages/richtext-lexical/src/features/relationship/server/nodes/RelationshipNode.tsx b/packages/richtext-lexical/src/features/relationship/server/nodes/RelationshipNode.tsx index e5620790c7b..48ccb24f40d 100644 --- a/packages/richtext-lexical/src/features/relationship/server/nodes/RelationshipNode.tsx +++ b/packages/richtext-lexical/src/features/relationship/server/nodes/RelationshipNode.tsx @@ -104,13 +104,16 @@ export class RelationshipServerNode extends DecoratorBlockNode { return false } - decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null { + decorate(_editor: LexicalEditor, _config: EditorConfig): JSX.Element | null { return null } exportDOM(): DOMExportOutput { const element = document.createElement('div') - element.setAttribute('data-lexical-relationship-id', String(this.__data?.value)) + element.setAttribute( + 'data-lexical-relationship-id', + String(typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value), + ) element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo) const text = document.createTextNode(this.getTextContent()) @@ -132,7 +135,7 @@ export class RelationshipServerNode extends DecoratorBlockNode { } getTextContent(): string { - return `${this.__data?.relationTo} relation to ${this.__data?.value}` + return `${this.__data?.relationTo} relation to ${typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value}` } setData(data: RelationshipData): void { diff --git a/packages/richtext-lexical/src/features/toolbars/fixed/client/Toolbar/index.tsx b/packages/richtext-lexical/src/features/toolbars/fixed/client/Toolbar/index.tsx index 9f1a46cb74e..a2e5b670002 100644 --- a/packages/richtext-lexical/src/features/toolbars/fixed/client/Toolbar/index.tsx +++ b/packages/richtext-lexical/src/features/toolbars/fixed/client/Toolbar/index.tsx @@ -8,7 +8,7 @@ import { useMemo } from 'react' import type { EditorConfigContextType } from '../../../../../lexical/config/client/EditorConfigProvider.js' import type { SanitizedClientEditorConfig } from '../../../../../lexical/config/types.js' -import type { PluginComponentWithAnchor } from '../../../../typesClient.js' +import type { PluginComponent } from '../../../../typesClient.js' import type { ToolbarGroup, ToolbarGroupItem } from '../../../types.js' import type { FixedToolbarFeatureProps } from '../../server/index.js' @@ -58,7 +58,7 @@ function ToolbarGroupComponent({ group: ToolbarGroup index: number }): React.ReactNode { - const { i18n } = useTranslation() + const { i18n } = useTranslation<{}, string>() const { fieldProps: { featureClientSchemaMap, schemaPath }, } = useEditorConfigContext() @@ -106,9 +106,8 @@ function ToolbarGroupComponent({ return ( <div className={`fixed-toolbar__group fixed-toolbar__group-${group.key}`} key={group.key}> - {group.type === 'dropdown' && - group.items.length && - (DropdownIcon ? ( + {group.type === 'dropdown' && group.items.length ? ( + DropdownIcon ? ( <ToolbarDropdown anchorElem={anchorElem} editor={editor} @@ -129,14 +128,15 @@ function ToolbarGroupComponent({ maxActiveItems={1} onActiveChange={onActiveChange} /> - ))} - {group.type === 'buttons' && - group.items.length && - group.items.map((item) => { - return ( - <ButtonGroupItem anchorElem={anchorElem} editor={editor} item={item} key={item.key} /> - ) - })} + ) + ) : null} + {group.type === 'buttons' && group.items.length + ? group.items.map((item) => { + return ( + <ButtonGroupItem anchorElem={anchorElem} editor={editor} item={item} key={item.key} /> + ) + }) + : null} {index < editorConfig.features.toolbarFixed?.groups.length - 1 && <div className="divider" />} </div> ) @@ -196,14 +196,18 @@ function FixedToolbar({ ) if (overlapping) { - currentToolbarElem.className = 'fixed-toolbar fixed-toolbar--overlapping' - parentToolbarElem.className = 'fixed-toolbar fixed-toolbar--hide' + currentToolbarElem.classList.remove('fixed-toolbar') + currentToolbarElem.classList.add('fixed-toolbar', 'fixed-toolbar--overlapping') + parentToolbarElem.classList.remove('fixed-toolbar') + parentToolbarElem.classList.add('fixed-toolbar', 'fixed-toolbar--hide') } else { if (!currentToolbarElem.classList.contains('fixed-toolbar--overlapping')) { return } - currentToolbarElem.className = 'fixed-toolbar' - parentToolbarElem.className = 'fixed-toolbar' + currentToolbarElem.classList.remove('fixed-toolbar--overlapping') + currentToolbarElem.classList.add('fixed-toolbar') + parentToolbarElem.classList.remove('fixed-toolbar--hide') + parentToolbarElem.classList.add('fixed-toolbar') } }, 50, @@ -256,10 +260,7 @@ const getParentEditorWithFixedToolbar = ( return false } -export const FixedToolbarPlugin: PluginComponentWithAnchor<FixedToolbarFeatureProps> = ({ - anchorElem, - clientProps, -}) => { +export const FixedToolbarPlugin: PluginComponent<FixedToolbarFeatureProps> = ({ clientProps }) => { const [currentEditor] = useLexicalComposerContext() const editorConfigContext = useEditorConfigContext() @@ -287,7 +288,7 @@ export const FixedToolbarPlugin: PluginComponentWithAnchor<FixedToolbarFeaturePr return ( <FixedToolbar - anchorElem={anchorElem} + anchorElem={document.body} editor={editor} editorConfig={editorConfig} parentWithFixedToolbar={parentWithFixedToolbar} diff --git a/packages/richtext-lexical/src/features/toolbars/inline/client/Toolbar/index.tsx b/packages/richtext-lexical/src/features/toolbars/inline/client/Toolbar/index.tsx index e5194e57f53..59a834b7942 100644 --- a/packages/richtext-lexical/src/features/toolbars/inline/client/Toolbar/index.tsx +++ b/packages/richtext-lexical/src/features/toolbars/inline/client/Toolbar/index.tsx @@ -95,9 +95,8 @@ function ToolbarGroupComponent({ className={`inline-toolbar-popup__group inline-toolbar-popup__group-${group.key}`} key={group.key} > - {group.type === 'dropdown' && - group.items.length && - (DropdownIcon ? ( + {group.type === 'dropdown' && group.items.length ? ( + DropdownIcon ? ( <ToolbarDropdown anchorElem={anchorElem} editor={editor} @@ -114,14 +113,15 @@ function ToolbarGroupComponent({ maxActiveItems={1} onActiveChange={onActiveChange} /> - ))} - {group.type === 'buttons' && - group.items.length && - group.items.map((item) => { - return ( - <ButtonGroupItem anchorElem={anchorElem} editor={editor} item={item} key={item.key} /> - ) - })} + ) + ) : null} + {group.type === 'buttons' && group.items.length + ? group.items.map((item) => { + return ( + <ButtonGroupItem anchorElem={anchorElem} editor={editor} item={item} key={item.key} /> + ) + }) + : null} {index < editorConfig.features.toolbarInline?.groups.length - 1 && ( <div className="divider" /> )} diff --git a/packages/richtext-lexical/src/features/toolbars/shared/ToolbarButton/index.tsx b/packages/richtext-lexical/src/features/toolbars/shared/ToolbarButton/index.tsx index 1ab09fb2525..91ca2ad90e9 100644 --- a/packages/richtext-lexical/src/features/toolbars/shared/ToolbarButton/index.tsx +++ b/packages/richtext-lexical/src/features/toolbars/shared/ToolbarButton/index.tsx @@ -2,7 +2,7 @@ import type { LexicalEditor } from 'lexical' import { mergeRegister } from '@lexical/utils' -import { $getSelection } from 'lexical' +import { $addUpdateTag, $getSelection } from 'lexical' import React, { useCallback, useEffect, useState } from 'react' import type { ToolbarGroupItem } from '../../types.js' @@ -84,9 +84,10 @@ export const ToolbarButton = ({ className={className} onClick={() => { if (enabled !== false) { - editor._updateTags = new Set(['toolbar', ...editor._updateTags]) // without setting the tags, our onSelect will not be able to trigger our onChange as focus onChanges are ignored. - editor.focus(() => { + editor.update(() => { + $addUpdateTag('toolbar') + }) // We need to wrap the onSelect in the callback, so the editor is properly focused before the onSelect is called. item.onSelect?.({ editor, diff --git a/packages/richtext-lexical/src/features/toolbars/shared/ToolbarDropdown/DropDown.tsx b/packages/richtext-lexical/src/features/toolbars/shared/ToolbarDropdown/DropDown.tsx index 1daae08ad94..5d616f745bf 100644 --- a/packages/richtext-lexical/src/features/toolbars/shared/ToolbarDropdown/DropDown.tsx +++ b/packages/richtext-lexical/src/features/toolbars/shared/ToolbarDropdown/DropDown.tsx @@ -1,7 +1,6 @@ 'use client' -import type { LexicalEditor } from 'lexical' - import { Button } from '@payloadcms/ui' +import { $addUpdateTag, type LexicalEditor } from 'lexical' import React, { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react' import { createPortal } from 'react-dom' @@ -74,9 +73,10 @@ export function DropDownItem({ iconStyle="none" onClick={() => { if (enabled !== false) { - editor._updateTags = new Set(['toolbar', ...editor._updateTags]) // without setting the tags, our onSelect will not be able to trigger our onChange as focus onChanges are ignored. - editor.focus(() => { + editor.update(() => { + $addUpdateTag('toolbar') + }) // We need to wrap the onSelect in the callback, so the editor is properly focused before the onSelect is called. item.onSelect?.({ editor, diff --git a/packages/richtext-lexical/src/features/toolbars/shared/ToolbarDropdown/index.tsx b/packages/richtext-lexical/src/features/toolbars/shared/ToolbarDropdown/index.tsx index a78e265798d..344fd4dbab9 100644 --- a/packages/richtext-lexical/src/features/toolbars/shared/ToolbarDropdown/index.tsx +++ b/packages/richtext-lexical/src/features/toolbars/shared/ToolbarDropdown/index.tsx @@ -28,7 +28,7 @@ const ToolbarItem = ({ enabled?: boolean item: ToolbarGroupItem }) => { - const { i18n } = useTranslation() + const { i18n } = useTranslation<{}, string>() const { fieldProps: { featureClientSchemaMap, schemaPath }, } = useEditorConfigContext() @@ -173,19 +173,20 @@ export const ToolbarDropdown = ({ key={groupKey} label={label} > - {items.length && - items.map((item) => { - return ( - <ToolbarItem - active={activeItemKeys.includes(item.key)} - anchorElem={anchorElem} - editor={editor} - enabled={enabledItemKeys.includes(item.key)} - item={item} - key={item.key} - /> - ) - })} + {items.length + ? items.map((item) => { + return ( + <ToolbarItem + active={activeItemKeys.includes(item.key)} + anchorElem={anchorElem} + editor={editor} + enabled={enabledItemKeys.includes(item.key)} + item={item} + key={item.key} + /> + ) + }) + : null} </DropDown> ) } diff --git a/packages/richtext-lexical/src/features/typesClient.ts b/packages/richtext-lexical/src/features/typesClient.ts index e329c2fba30..57bfe2d3465 100644 --- a/packages/richtext-lexical/src/features/typesClient.ts +++ b/packages/richtext-lexical/src/features/typesClient.ts @@ -1,6 +1,7 @@ import type { Klass, LexicalEditor, LexicalNode, LexicalNodeReplacement } from 'lexical' import type { RichTextFieldClient } from 'payload' import type React from 'react' +import type { JSX } from 'react' import type { ClientEditorConfig } from '../lexical/config/types.js' import type { SlashMenuGroup } from '../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js' @@ -47,6 +48,52 @@ export type PluginComponentWithAnchor<ClientFeatureProps = any> = React.FC<{ clientProps: ClientFeatureProps }> +/** + * Plugins are react components which get added to the editor. You can use them to interact with lexical, e.g. to create a command which creates a node, or opens a modal, or some other more "outside" functionality + */ +export type SanitizedPlugin = + | { + clientProps: any + // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more "outside" functionality + Component: PluginComponent + key: string + position: 'bottom' // Determines at which position the Component will be added. + } + | { + clientProps: any + // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more "outside" functionality + Component: PluginComponent + key: string + position: 'normal' // Determines at which position the Component will be added. + } + | { + clientProps: any + // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more "outside" functionality + Component: PluginComponent + key: string + position: 'top' // Determines at which position the Component will be added. + } + | { + clientProps: any + // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more "outside" functionality + Component: PluginComponentWithAnchor + desktopOnly?: boolean + key: string + position: 'floatingAnchorElem' // Determines at which position the Component will be added. + } + | { + clientProps: any + Component: PluginComponent + key: string + position: 'aboveContainer' + } + | { + clientProps: any + Component: PluginComponent + key: string + position: 'belowContainer' + } + export type ClientFeature<ClientFeatureProps> = { markdownTransformers?: ( | ((props: { @@ -93,7 +140,7 @@ export type ClientFeature<ClientFeatureProps> = { /** * Client Features can register their own providers, which will be nested below the EditorConfigProvider */ - providers?: Array<React.FC> + providers?: Array<React.FC<{ children: JSX.Element }>> /** * Return props, to make it easy to retrieve passed in props to this Feature for the client if anyone wants to */ @@ -154,52 +201,6 @@ export type ResolvedClientFeatureMap = Map<string, ResolvedClientFeature<any>> export type ClientFeatureProviderMap = Map<string, FeatureProviderClient<any, any>> -/** - * Plugins are react components which get added to the editor. You can use them to interact with lexical, e.g. to create a command which creates a node, or opens a modal, or some other more "outside" functionality - */ -export type SanitizedPlugin = - | { - clientProps: any - // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more "outside" functionality - Component: PluginComponent - key: string - position: 'bottom' // Determines at which position the Component will be added. - } - | { - clientProps: any - // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more "outside" functionality - Component: PluginComponent - key: string - position: 'normal' // Determines at which position the Component will be added. - } - | { - clientProps: any - // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more "outside" functionality - Component: PluginComponent - key: string - position: 'top' // Determines at which position the Component will be added. - } - | { - clientProps: any - // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more "outside" functionality - Component: PluginComponentWithAnchor - desktopOnly?: boolean - key: string - position: 'floatingAnchorElem' // Determines at which position the Component will be added. - } - | { - clientProps: any - Component: PluginComponent - key: string - position: 'aboveContainer' - } - | { - clientProps: any - Component: PluginComponent - key: string - position: 'belowContainer' - } - export type SanitizedClientFeatures = { /** The keys of all enabled features */ enabledFeatures: string[] diff --git a/packages/richtext-lexical/src/features/typesServer.ts b/packages/richtext-lexical/src/features/typesServer.ts index 5cc53c6f248..0b3b7c99cbe 100644 --- a/packages/richtext-lexical/src/features/typesServer.ts +++ b/packages/richtext-lexical/src/features/typesServer.ts @@ -12,7 +12,6 @@ import type { Field, FieldSchemaMap, JsonObject, - Payload, PayloadComponent, PayloadRequest, PopulateType, diff --git a/packages/richtext-lexical/src/features/upload/client/nodes/UploadNode.tsx b/packages/richtext-lexical/src/features/upload/client/nodes/UploadNode.tsx index 0bafd3b0af2..e414e37cd59 100644 --- a/packages/richtext-lexical/src/features/upload/client/nodes/UploadNode.tsx +++ b/packages/richtext-lexical/src/features/upload/client/nodes/UploadNode.tsx @@ -57,9 +57,9 @@ export class UploadNode extends UploadServerNode { return super.getType() } - static importDOM(): DOMConversionMap | null { + static importDOM(): DOMConversionMap<HTMLImageElement> { return { - img: (node: HTMLImageElement) => ({ + img: (node) => ({ conversion: $convertUploadElement, priority: 0, }), diff --git a/packages/richtext-lexical/src/features/upload/client/plugin/index.tsx b/packages/richtext-lexical/src/features/upload/client/plugin/index.tsx index 6ad94774db4..c3c6d08407b 100644 --- a/packages/richtext-lexical/src/features/upload/client/plugin/index.tsx +++ b/packages/richtext-lexical/src/features/upload/client/plugin/index.tsx @@ -14,7 +14,7 @@ import { } from 'lexical' import React, { useEffect } from 'react' -import type { PluginComponentWithAnchor } from '../../../typesClient.js' +import type { PluginComponent } from '../../../typesClient.js' import type { UploadData } from '../../server/nodes/UploadNode.js' import type { UploadFeaturePropsClient } from '../feature.client.js' @@ -26,9 +26,7 @@ export type InsertUploadPayload = Readonly<Omit<UploadData, 'id'> & Partial<Pick export const INSERT_UPLOAD_COMMAND: LexicalCommand<InsertUploadPayload> = createCommand('INSERT_UPLOAD_COMMAND') -export const UploadPlugin: PluginComponentWithAnchor<UploadFeaturePropsClient> = ({ - clientProps, -}) => { +export const UploadPlugin: PluginComponent<UploadFeaturePropsClient> = ({ clientProps }) => { const [editor] = useLexicalComposerContext() const { config: { collections }, diff --git a/packages/richtext-lexical/src/features/upload/server/nodes/UploadNode.tsx b/packages/richtext-lexical/src/features/upload/server/nodes/UploadNode.tsx index a3cb8ce3948..ce3965cfd16 100644 --- a/packages/richtext-lexical/src/features/upload/server/nodes/UploadNode.tsx +++ b/packages/richtext-lexical/src/features/upload/server/nodes/UploadNode.tsx @@ -97,9 +97,9 @@ export class UploadServerNode extends DecoratorBlockNode { return 'upload' } - static importDOM(): DOMConversionMap | null { + static importDOM(): DOMConversionMap<HTMLImageElement> { return { - img: (node: HTMLImageElement) => ({ + img: (node) => ({ conversion: $convertUploadServerElement, priority: 0, }), diff --git a/packages/richtext-lexical/src/lexical/config/client/sanitize.ts b/packages/richtext-lexical/src/lexical/config/client/sanitize.ts index b1c7d660fea..9ba4847f080 100644 --- a/packages/richtext-lexical/src/lexical/config/client/sanitize.ts +++ b/packages/richtext-lexical/src/lexical/config/client/sanitize.ts @@ -49,7 +49,7 @@ export const sanitizeClientFeatures = ( feature.plugins.forEach((plugin, i) => { sanitized.plugins?.push({ clientProps: feature.sanitizedClientFeatureProps, - Component: plugin.Component, + Component: plugin.Component as any, // Appeases strict: true key: feature.key + i, position: plugin.position, }) diff --git a/packages/richtext-lexical/src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx b/packages/richtext-lexical/src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx index b442780fcd4..9c4e5d54b39 100644 --- a/packages/richtext-lexical/src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx +++ b/packages/richtext-lexical/src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx @@ -147,12 +147,13 @@ function isTriggerVisibleInNearestScrollContainer( // Reposition the menu on scroll, window resize, and element resize. export function useDynamicPositioning( resolution: MenuResolution | null, - targetElement: HTMLElement | null, + targetElementRef: RefObject<HTMLElement | null>, onReposition: () => void, onVisibilityChange?: (isInView: boolean) => void, ) { const [editor] = useLexicalComposerContext() useEffect(() => { + const targetElement = targetElementRef.current if (targetElement != null && resolution != null) { const rootElement = editor.getRootElement() const rootScrollParent = @@ -186,12 +187,12 @@ export function useDynamicPositioning( }) resizeObserver.observe(targetElement) return () => { - resizeObserver.unobserve(targetElement) + resizeObserver.disconnect() window.removeEventListener('resize', onReposition) document.removeEventListener('scroll', handleScroll, true) } } - }, [targetElement, editor, onVisibilityChange, onReposition, resolution]) + }, [editor, onVisibilityChange, onReposition, resolution, targetElementRef]) } export const SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND: LexicalCommand<{ @@ -529,7 +530,7 @@ export function useMenuAnchorRef( [resolution, setResolution], ) - useDynamicPositioning(resolution, anchorElementRef.current, positionMenu, onVisibilityChange) + useDynamicPositioning(resolution, anchorElementRef, positionMenu, onVisibilityChange) return anchorElementRef } diff --git a/packages/richtext-lexical/src/lexical/plugins/SlashMenu/index.tsx b/packages/richtext-lexical/src/lexical/plugins/SlashMenu/index.tsx index 53dcd7dc78a..c652c77f448 100644 --- a/packages/richtext-lexical/src/lexical/plugins/SlashMenu/index.tsx +++ b/packages/richtext-lexical/src/lexical/plugins/SlashMenu/index.tsx @@ -1,6 +1,4 @@ 'use client' -import type { TextNode } from 'lexical' - import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js' import { useTranslation } from '@payloadcms/ui' import { useCallback, useMemo, useState } from 'react' @@ -26,18 +24,20 @@ function SlashMenuItem({ item, onClick, onMouseEnter, + ref, }: { index: number isSelected: boolean item: SlashMenuItemInternal onClick: () => void onMouseEnter: () => void + ref?: React.Ref<HTMLButtonElement> }) { const { fieldProps: { featureClientSchemaMap, schemaPath }, } = useEditorConfigContext() - const { i18n } = useTranslation() + const { i18n } = useTranslation<{}, string>() let className = `${baseClass}__item ${baseClass}__item-${item.key}` if (isSelected) { @@ -64,9 +64,7 @@ function SlashMenuItem({ key={item.key} onClick={onClick} onMouseEnter={onMouseEnter} - ref={(element) => { - item.ref = { current: element } - }} + ref={ref} role="option" tabIndex={-1} type="button" @@ -86,7 +84,7 @@ export function SlashMenuPlugin({ const [editor] = useLexicalComposerContext() const [queryString, setQueryString] = useState<null | string>(null) const { editorConfig } = useEditorConfigContext() - const { i18n } = useTranslation() + const { i18n } = useTranslation<{}, string>() const { fieldProps: { featureClientSchemaMap, schemaPath }, } = useEditorConfigContext() @@ -231,6 +229,9 @@ export function SlashMenuPlugin({ onMouseEnter={() => { setSelectedItemKey(item.key) }} + ref={(el) => { + ;(item as SlashMenuItemInternal).ref = { current: el } + }} /> ))} </div> diff --git a/packages/richtext-lexical/tsconfig.json b/packages/richtext-lexical/tsconfig.json index 3d9f932f35e..7a795018fd4 100644 --- a/packages/richtext-lexical/tsconfig.json +++ b/packages/richtext-lexical/tsconfig.json @@ -9,6 +9,7 @@ "noImplicitAny": true, "outDir": "./dist" /* Specify an output folder for all emitted files. */, "rootDir": "./src" /* Specify the root folder within your source files. */, + "strict": true }, "exclude": [ "dist", diff --git a/test/fields/payload-types.ts b/test/fields/payload-types.ts index 218df9acd38..68ad61a01d7 100644 --- a/test/fields/payload-types.ts +++ b/test/fields/payload-types.ts @@ -121,9 +121,9 @@ export interface Config { user: User & { collection: 'users'; }; - jobs?: { + jobs: { tasks: unknown; - workflows?: unknown; + workflows: unknown; }; } export interface UserAuthOperations {
bf142ff74689854ce41497742a2ba70a5465d80f
2022-01-22 03:16:56
James
chore: beta release
false
beta release
chore
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4940d42b5df..7ef14526e9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +## [0.14.9-beta.0](https://github.com/payloadcms/payload/compare/v0.14.0...v0.14.9-beta.0) (2022-01-21) + + +### Bug Fixes + +* awaits beforeDelete hooks ([609b871](https://github.com/payloadcms/payload/commit/609b871fa274e8b6d9eaf301e52ab42179aad9b7)) +* ensures multipart/form-data using _payload flattens field data before sending ([ae44727](https://github.com/payloadcms/payload/commit/ae44727fb9734fc3801f7249fa9e78668311c09e)) +* ensures nested lists always render properly ([20e5dfb](https://github.com/payloadcms/payload/commit/20e5dfbb4ab8dab320d60772f5195c5faffe38d3)) +* new slate version types ([c5de01b](https://github.com/payloadcms/payload/commit/c5de01bfc48ca6793c1526499fe934d9ad8f0cc9)) +* type error in useField ([ef4e6d3](https://github.com/payloadcms/payload/commit/ef4e6d32a90215c07aa2c1e7217cf53558bfae97)) + + +### Features + +* adds indentation controls to rich text ([7df50f9](https://github.com/payloadcms/payload/commit/7df50f9bf9d4867e65bdd8cebdf43e0ab1737a63)) +* builds a way for multipart/form-data reqs to retain non-string values ([65b0ad7](https://github.com/payloadcms/payload/commit/65b0ad7f084a9c279a1e4fb799542f97c645653d)) +* enhances rich text upload with custom field API ([0e4eb90](https://github.com/payloadcms/payload/commit/0e4eb906f2881dca518fea6b41e460bc57da9801)) +* exposes FieldWithPath type for reuse ([df3a836](https://github.com/payloadcms/payload/commit/df3a83634fcb64724ef239600e3af4fc295fee4f)) +* rich text indent PoC ([2deed8b](https://github.com/payloadcms/payload/commit/2deed8b1464931c4bc76a288923b307cf04b6a4a)) + ## [0.14.8-beta.0](https://github.com/payloadcms/payload/compare/v0.14.0...v0.14.8-beta.0) (2022-01-14) diff --git a/package.json b/package.json index d6ff24f723a..aa5b5895032 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload", - "version": "0.14.8-beta.0", + "version": "0.14.9-beta.0", "description": "Node, React and MongoDB Headless CMS and Application Framework", "license": "SEE LICENSE IN license.md", "author": {
b21b4719fc176dab689b7dd20e515dc4f6c40a20
2023-09-15 21:56:29
James
chore: ports webpack bundler over to monorepo package
false
ports webpack bundler over to monorepo package
chore
diff --git a/package.json b/package.json index 234577270b6..32955420374 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "@testing-library/react": "13.4.0", "@types/jest": "29.5.4", "@types/node": "20.5.7", + "@types/react": "18.2.15", "@types/testing-library__jest-dom": "5.14.8", "copyfiles": "2.4.1", "cross-env": "7.0.3", @@ -52,6 +53,7 @@ "jest": "29.6.4", "jest-environment-jsdom": "29.6.4", "prettier": "^3.0.3", + "react": "18.2.0", "shelljs": "0.8.5", "ts-node": "10.9.1", "typescript": "5.2.2", diff --git a/packages/bundler-vite/package.json b/packages/bundler-vite/package.json new file mode 100644 index 00000000000..af5400536ef --- /dev/null +++ b/packages/bundler-vite/package.json @@ -0,0 +1,34 @@ +{ + "name": "@payloadcms/bundler-vite", + "version": "0.0.1", + "description": "The officially supported Vite bundler adapter for Payload", + "repository": "https://github.com/payloadcms/payload", + "license": "MIT", + "author": { + "email": "[email protected]", + "name": "Payload", + "url": "https://payloadcms.com" + }, + "main": "./src/index.ts", + "types": "./src/index.ts", + "scripts": { + "build:swc": "swc ./src -d ./dist --config-file .swcrc", + "build:types": "tsc --emitDeclarationOnly --outDir dist", + "builddisabled": "pnpm build:swc && pnpm build:types" + }, + "dependencies": { + "@vitejs/plugin-react": "^4.0.4", + "vite": "^4.4.9", + "vite-plugin-commonjs": "^0.8.2", + "vite-plugin-virtual": "^0.2.0" + }, + "devDependencies": { + "@payloadcms/eslint-config": "workspace:*", + "payload": "workspace:*" + }, + "publishConfig": { + "main": "./dist/index.js", + "registry": "https://registry.npmjs.org/", + "types": "./dist/index.d.ts" + } +} diff --git a/packages/bundler-vite/src/mocks/dotENV.js b/packages/bundler-vite/src/mocks/dotENV.js new file mode 100644 index 00000000000..3b2fe989dec --- /dev/null +++ b/packages/bundler-vite/src/mocks/dotENV.js @@ -0,0 +1,3 @@ +export default { + config: () => null, +}; diff --git a/packages/bundler-vite/src/mocks/emptyModule.js b/packages/bundler-vite/src/mocks/emptyModule.js new file mode 100644 index 00000000000..eb6d09f48cd --- /dev/null +++ b/packages/bundler-vite/src/mocks/emptyModule.js @@ -0,0 +1 @@ +export default () => { }; diff --git a/packages/bundler-vite/src/mocks/fileMock.js b/packages/bundler-vite/src/mocks/fileMock.js new file mode 100644 index 00000000000..bff78232057 --- /dev/null +++ b/packages/bundler-vite/src/mocks/fileMock.js @@ -0,0 +1 @@ +export default 'file-stub'; diff --git a/packages/bundler-vite/src/types.ts b/packages/bundler-vite/src/types.ts new file mode 100644 index 00000000000..372f604d3c5 --- /dev/null +++ b/packages/bundler-vite/src/types.ts @@ -0,0 +1,8 @@ +import type { PayloadHandler, SanitizedConfig } from 'payload/config'; +import type { Payload } from '../payload'; + +export interface PayloadBundler { + dev: (payload: Payload) => Promise<PayloadHandler>, // this would be a typical Express middleware handler + build: (payloadConfig: SanitizedConfig) => Promise<void> // used in `payload build` + serve: (payload: Payload) => Promise<PayloadHandler> // serve built files in production +} diff --git a/packages/bundler-vite/src/vite/bundler.ts b/packages/bundler-vite/src/vite/bundler.ts new file mode 100644 index 00000000000..016583d0cd9 --- /dev/null +++ b/packages/bundler-vite/src/vite/bundler.ts @@ -0,0 +1,11 @@ +import type { InlineConfig } from 'vite'; +import { PayloadBundler } from '../types'; +import { devAdmin } from './scripts/dev'; +import { buildAdmin } from './scripts/build'; +import { serveAdmin } from './scripts/serve'; + +export default (viteConfig?: InlineConfig): PayloadBundler => ({ + dev: async (payload) => devAdmin({ payload, viteConfig }), + build: async (payloadConfig) => buildAdmin({ payloadConfig, viteConfig }), + serve: async (payload) => serveAdmin({ payload }), +}); diff --git a/packages/bundler-vite/src/vite/configs/vite.ts b/packages/bundler-vite/src/vite/configs/vite.ts new file mode 100644 index 00000000000..a2247e15fa1 --- /dev/null +++ b/packages/bundler-vite/src/vite/configs/vite.ts @@ -0,0 +1,169 @@ +/* eslint-disable no-param-reassign */ +import path from 'path'; +import { InlineConfig, createLogger } from 'vite'; +import viteCommonJS from 'vite-plugin-commonjs'; +import virtual from 'vite-plugin-virtual'; +import scss from 'rollup-plugin-scss'; +import image from '@rollup/plugin-image'; +import rollupCommonJS from '@rollup/plugin-commonjs'; +import react from '@vitejs/plugin-react'; +import getPort from 'get-port'; +import type { SanitizedConfig } from '../../../config/types'; + +const logger = createLogger('warn', { prefix: '[VITE-WARNING]', allowClearScreen: false }); +const originalWarning = logger.warn; +logger.warn = (msg, options) => { + // TODO: fix this? removed these warnings to make debugging easier + if (msg.includes('Default and named imports from CSS files are deprecated')) return; + originalWarning(msg, options); +}; + +const bundlerPath = path.resolve(__dirname, '../bundler'); +const mockModulePath = path.resolve(__dirname, '../../mocks/emptyModule.js'); +const mockDotENVPath = path.resolve(__dirname, '../../mocks/dotENV.js'); +const relativeAdminPath = path.resolve(__dirname, '../../../admin'); + +export const getViteConfig = async (payloadConfig: SanitizedConfig): Promise<InlineConfig> => { + const hmrPort = await getPort(); + + const absoluteAliases = { + [`${bundlerPath}`]: path.resolve(__dirname, '../mock.js'), + }; + + const alias = [ + { find: 'path', replacement: require.resolve('path-browserify') }, + { find: 'payload-config', replacement: payloadConfig.paths.rawConfig }, + { find: /payload$/, replacement: mockModulePath }, + { find: '~payload-user-css', replacement: payloadConfig.admin.css }, + { find: '~react-toastify', replacement: 'react-toastify' }, + { find: 'dotenv', replacement: mockDotENVPath }, + ]; + + if (payloadConfig.admin.webpack && typeof payloadConfig.admin.webpack === 'function') { + const webpackConfig = payloadConfig.admin.webpack({ + resolve: { + alias: {}, + }, + }); + + if (Object.keys(webpackConfig.resolve.alias).length > 0) { + Object.entries(webpackConfig.resolve.alias).forEach(([source, target]) => { + if (path.isAbsolute(source)) { + absoluteAliases[source] = target; + } else { + alias[source] = target; + } + }); + } + } + + return { + root: path.resolve(__dirname, '../'), + base: payloadConfig.routes.admin, + customLogger: logger, + optimizeDeps: { + exclude: [ + // Dependencies that need aliases should be excluded + // from pre-bundling + ], + include: [ + 'payload/**/*.tsx', + 'payload/**/*.ts', + 'slate', + 'slate-react', + 'slate-history', + 'is-hotkey', + 'slate-hyperscript', + '@monaco-editor/react', + ], + }, + server: { + middlewareMode: true, + hmr: { + port: hmrPort, + }, + }, + resolve: { + alias, + }, + define: { + __dirname: '""', + 'module.hot': 'undefined', + 'process.env': '{}', + }, + plugins: [ + { + name: 'absolute-aliases', + enforce: 'pre', + resolveId(source, importer) { + let fullSourcePath: string; + + // TODO: need to handle this better. This is overly simple. + if (source.startsWith('.')) { + fullSourcePath = path.resolve(path.dirname(importer), source); + } + + if (fullSourcePath) { + const aliasMatch = absoluteAliases[fullSourcePath]; + if (aliasMatch) { + return aliasMatch; + } + } + + return null; + }, + }, + virtual({ + crypto: 'export default {}', + https: 'export default {}', + http: 'export default {}', + }), + react(), + // viteCommonJS(), + { + name: 'init-admin-panel', + transformIndexHtml(html) { + const indexFile = process.env.PAYLOAD_DEV_MODE === 'true' ? 'index.tsx' : 'index.js'; + + if (html.includes(`/${indexFile}`)) return html; + + return html.replace( + '</body>', + `<script> var exports = {}; </script></script><script type="module" src="${payloadConfig.routes.admin}/${indexFile}"></script></body>`, + ); + }, + }, + ], + build: { + outDir: payloadConfig.admin.buildPath, + commonjsOptions: { + transformMixedEsModules: true, + include: [/payload/], + }, + rollupOptions: { + // output: { + // manualChunks: { + // jsonWorker: ['monaco-editor/esm/vs/language/json/json.worker'], + // cssWorker: ['monaco-editor/esm/vs/language/css/css.worker'], + // htmlWorker: ['monaco-editor/esm/vs/language/html/html.worker'], + // tsWorker: ['monaco-editor/esm/vs/language/typescript/ts.worker'], + // editorWorker: ['monaco-editor/esm/vs/editor/editor.worker'], + // }, + // }, + plugins: [ + image(), + rollupCommonJS(), + scss({ + output: path.resolve(payloadConfig.admin.buildPath, 'styles.css'), + outputStyle: 'compressed', + include: [`${relativeAdminPath}/**/*.scss`], + }), + ], + treeshake: true, + input: { + main: path.resolve(__dirname, relativeAdminPath), + }, + }, + }, + }; +}; diff --git a/packages/bundler-vite/src/vite/index.html b/packages/bundler-vite/src/vite/index.html new file mode 100644 index 00000000000..b334e908991 --- /dev/null +++ b/packages/bundler-vite/src/vite/index.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> + <link rel="icon" href="data:," data-placeholder-favicon /> +</head> + +<body> + <div id="app"></div> + <div id="portal"></div> + <h1>Hello</h1> + <script type="module" src="./index.tsx"></script> +</body> + +</html> \ No newline at end of file diff --git a/packages/bundler-vite/src/vite/index.tsx b/packages/bundler-vite/src/vite/index.tsx new file mode 100644 index 00000000000..95007c75528 --- /dev/null +++ b/packages/bundler-vite/src/vite/index.tsx @@ -0,0 +1,14 @@ +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore - need to do this because this file doesn't actually exist +import React from 'react'; +import { createRoot } from 'react-dom/client'; +import { Root } from '../../admin/Root'; + +const container = document.getElementById('app'); +const root = createRoot(container); // createRoot(container!) if you use TypeScript +root.render(<Root />); + +// Needed for Hot Module Replacement +if (typeof (module.hot) !== 'undefined') { + module.hot.accept(); +} diff --git a/packages/bundler-vite/src/vite/mock.js b/packages/bundler-vite/src/vite/mock.js new file mode 100644 index 00000000000..2d1ec238274 --- /dev/null +++ b/packages/bundler-vite/src/vite/mock.js @@ -0,0 +1 @@ +export default () => {}; diff --git a/packages/bundler-vite/src/vite/scripts/build.ts b/packages/bundler-vite/src/vite/scripts/build.ts new file mode 100644 index 00000000000..56bddad6dca --- /dev/null +++ b/packages/bundler-vite/src/vite/scripts/build.ts @@ -0,0 +1,21 @@ +import vite from 'vite'; +import type { InlineConfig } from 'vite'; +import { SanitizedConfig } from '../../../config/types'; +import { getViteConfig } from '../configs/vite'; + +type BuildAdminType = (options: { + payloadConfig: SanitizedConfig + viteConfig: InlineConfig; +}) => Promise<void>; +export const buildAdmin: BuildAdminType = async ({ payloadConfig, viteConfig: viteConfigArg }) => { + const viteConfig = await getViteConfig(payloadConfig); + + // TODO: merge vite configs (https://vitejs.dev/guide/api-javascript.html#mergeconfig) + + try { + vite.build(viteConfig); + } catch (e) { + console.error(e); + throw new Error('Error: there was an error building the vite prod config.'); + } +}; diff --git a/packages/bundler-vite/src/vite/scripts/dev.ts b/packages/bundler-vite/src/vite/scripts/dev.ts new file mode 100644 index 00000000000..46664eb7732 --- /dev/null +++ b/packages/bundler-vite/src/vite/scripts/dev.ts @@ -0,0 +1,28 @@ +import type { InlineConfig } from 'vite'; +import vite from 'vite'; +import express from 'express'; +import type { PayloadHandler } from '../../../config/types'; +import { Payload } from '../../../payload'; +import { getViteConfig } from '../configs/vite'; + +const router = express.Router(); + +type DevAdminType = (options: { + payload: Payload; + viteConfig: InlineConfig; +}) => Promise<PayloadHandler>; +export const devAdmin: DevAdminType = async ({ payload, viteConfig: viteConfigArg }) => { + // TODO: merge vite configs (https://vitejs.dev/guide/api-javascript.html#mergeconfig) + + try { + const viteConfig = await getViteConfig(payload.config); + const viteServer = await vite.createServer(viteConfig); + + router.use(viteServer.middlewares); + } catch (err) { + console.error(err); + throw new Error('Error: there was an error creating the vite dev server.'); + } + + return router; +}; diff --git a/packages/bundler-vite/src/vite/scripts/serve.ts b/packages/bundler-vite/src/vite/scripts/serve.ts new file mode 100644 index 00000000000..9dfa0cc43fd --- /dev/null +++ b/packages/bundler-vite/src/vite/scripts/serve.ts @@ -0,0 +1,27 @@ +import express from 'express'; +import compression from 'compression'; +import history from 'connect-history-api-fallback'; +import type { PayloadHandler } from '../../../config/types'; +import { Payload } from '../../../payload'; + +const router = express.Router(); + +type ServeAdminType = (options: { payload: Payload }) => Promise<PayloadHandler>; + +export const serveAdmin: ServeAdminType = async ({ payload }) => { + router.use(payload.config.routes.admin, history()); + + router.get('*', (req, res, next) => { + if (req.path.substr(-1) === '/' && req.path.length > 1) { + const query = req.url.slice(req.path.length); + res.redirect(301, req.path.slice(0, -1) + query); + } else { + next(); + } + }); + + router.use(compression(payload.config.express.compression)); + router.use(express.static(payload.config.admin.buildPath, { redirect: false })); + + return router; +}; diff --git a/packages/bundler-vite/src/webpack/bundler.ts b/packages/bundler-vite/src/webpack/bundler.ts new file mode 100644 index 00000000000..8170e79e78b --- /dev/null +++ b/packages/bundler-vite/src/webpack/bundler.ts @@ -0,0 +1,11 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ +import { PayloadBundler } from '../types'; +import { devAdmin } from './scripts/dev'; +import { buildAdmin } from './scripts/build'; +import { serveAdmin } from './scripts/serve'; + +export default (): PayloadBundler => ({ + dev: async (payload) => devAdmin({ payload }), + build: async (payloadConfig) => buildAdmin({ payloadConfig }), + serve: async (payload) => serveAdmin({ payload }), +}); diff --git a/packages/payload/src/bundlers/webpack/components.config.ts b/packages/bundler-vite/src/webpack/components.config.ts similarity index 72% rename from packages/payload/src/bundlers/webpack/components.config.ts rename to packages/bundler-vite/src/webpack/components.config.ts index 62d24bba15d..cd1858e4034 100644 --- a/packages/payload/src/bundlers/webpack/components.config.ts +++ b/packages/bundler-vite/src/webpack/components.config.ts @@ -1,9 +1,7 @@ -import MiniCSSExtractPlugin from 'mini-css-extract-plugin' -import path from 'path' -const terser = import('terser') // IMPORTANT - DO NOT REMOVE: This is required for pnpm's default isolated mode to work - even though the import is not used. This is due to a typescript bug: https://github.com/microsoft/TypeScript/issues/47663#issuecomment-1519138189. (tsbugisolatedmode) -import OptimizeCSSAssetsPlugin from 'css-minimizer-webpack-plugin' -// eslint-disable-next-line @typescript-eslint/no-var-requires -const TerserPlugin = require('terser-webpack-plugin') // Needs to be require. TypeScript is too dumb to make it an import +import path from 'path'; +import MiniCSSExtractPlugin from 'mini-css-extract-plugin'; +import TerserJSPlugin from 'terser-webpack-plugin'; +import OptimizeCSSAssetsPlugin from 'css-minimizer-webpack-plugin'; export default { entry: { @@ -12,12 +10,24 @@ export default { externals: { react: 'react', }, + output: { + path: path.resolve(__dirname, '../../../components'), + publicPath: '/', + filename: 'index.js', + libraryTarget: 'commonjs2', + }, + optimization: { + minimizer: [new TerserJSPlugin({ + extractComments: false, + }), new OptimizeCSSAssetsPlugin({})], + }, mode: 'production', + stats: 'errors-only', module: { rules: [ { - exclude: /node_modules/, test: /\.(t|j)sx?$/, + exclude: /node_modules/, use: [ { loader: require.resolve('swc-loader'), @@ -27,16 +37,16 @@ export default { { oneOf: [ { + test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/], loader: require.resolve('url-loader'), options: { limit: 10000, name: 'static/media/[name].[hash:8].[ext]', }, - test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/], }, { - sideEffects: true, test: /\.(sa|sc|c)ss$/, + sideEffects: true, use: [ MiniCSSExtractPlugin.loader, 'css-loader', @@ -44,7 +54,9 @@ export default { loader: 'postcss-loader', options: { postcssOptions: { - plugins: ['postcss-preset-env'], + plugins: [ + 'postcss-preset-env', + ], }, }, }, @@ -62,20 +74,6 @@ export default { }, ], }, - optimization: { - minimizer: [ - new TerserPlugin({ - extractComments: false, - }), - new OptimizeCSSAssetsPlugin({}), - ], - }, - output: { - filename: 'index.js', - libraryTarget: 'commonjs2', - path: path.resolve(__dirname, '../../../components'), - publicPath: '/', - }, plugins: [ new MiniCSSExtractPlugin({ filename: 'styles.css', @@ -88,5 +86,4 @@ export default { }, modules: ['node_modules', path.resolve(__dirname, '../../../node_modules')], }, - stats: 'errors-only', -} +}; diff --git a/packages/bundler-vite/src/webpack/configs/base.ts b/packages/bundler-vite/src/webpack/configs/base.ts new file mode 100644 index 00000000000..c8c32232754 --- /dev/null +++ b/packages/bundler-vite/src/webpack/configs/base.ts @@ -0,0 +1,93 @@ +import path from 'path'; +import HtmlWebpackPlugin from 'html-webpack-plugin'; +import webpack, { Configuration } from 'webpack'; +import type { SanitizedConfig } from '../../../config/types'; + +const mockModulePath = path.resolve(__dirname, '../../mocks/emptyModule.js'); +const mockDotENVPath = path.resolve(__dirname, '../../mocks/dotENV.js'); + +const nodeModulesPath = path.resolve(__dirname, '../../../../node_modules'); +const adminFolderPath = path.resolve(__dirname, '../../../admin'); +const bundlerPath = path.resolve(__dirname, '../bundler'); + +export const getBaseConfig = (payloadConfig: SanitizedConfig): Configuration => ({ + entry: { + main: [ + adminFolderPath, + ], + }, + resolveLoader: { + modules: ['node_modules', path.join(__dirname, nodeModulesPath)], + }, + module: { + rules: [ + { + test: /\.(t|j)sx?$/, + exclude: /\/node_modules\/(?!.+\.tsx?$).*$/, + use: [ + { + loader: require.resolve('swc-loader'), + options: { + jsc: { + parser: { + syntax: 'typescript', + tsx: true, + }, + }, + }, + }, + ], + }, + { + oneOf: [ + { + test: /\.(?:ico|gif|png|jpg|jpeg|woff(2)?|eot|ttf|otf|svg)$/i, + type: 'asset/resource', + }, + ], + }, + ], + }, + resolve: { + fallback: { + crypto: false, + https: false, + http: false, + }, + modules: ['node_modules', path.resolve(__dirname, nodeModulesPath)], + alias: { + path: require.resolve('path-browserify'), + 'payload-config': payloadConfig.paths.rawConfig, + payload$: mockModulePath, + 'payload-user-css': payloadConfig.admin.css, + dotenv: mockDotENVPath, + [bundlerPath]: mockModulePath, + }, + extensions: ['.ts', '.tsx', '.js', '.json'], + }, + plugins: [ + new webpack.ProvidePlugin( + { process: require.resolve('process/browser') }, + ), + new webpack.DefinePlugin( + Object.entries(process.env).reduce( + (values, [key, val]) => { + if (key.indexOf('PAYLOAD_PUBLIC_') === 0) { + return ({ + ...values, + [`process.env.${key}`]: `'${val}'`, + }); + } + + return values; + }, + {}, + ), + ), + new HtmlWebpackPlugin({ + template: payloadConfig.admin.indexHTML, + filename: path.normalize('./index.html'), + }), + new webpack.HotModuleReplacementPlugin(), + ], +}); diff --git a/packages/payload/src/bundlers/webpack/configs/dev.ts b/packages/bundler-vite/src/webpack/configs/dev.ts similarity index 79% rename from packages/payload/src/bundlers/webpack/configs/dev.ts rename to packages/bundler-vite/src/webpack/configs/dev.ts index 776c6bcedba..969a87c544e 100644 --- a/packages/payload/src/bundlers/webpack/configs/dev.ts +++ b/packages/bundler-vite/src/webpack/configs/dev.ts @@ -1,26 +1,21 @@ -import type { Configuration } from 'webpack' - -import md5 from 'md5' -import webpack from 'webpack' - -import type { SanitizedConfig } from '../../../config/types' - -import { getBaseConfig } from './base' +import webpack, { Configuration } from 'webpack'; +import md5 from 'md5'; +import { getBaseConfig } from './base'; +import { SanitizedConfig } from '../../../config/types'; export const getDevConfig = (payloadConfig: SanitizedConfig): Configuration => { - const baseConfig = getBaseConfig(payloadConfig) as any + const baseConfig = getBaseConfig(payloadConfig) as any; let webpackConfig: Configuration = { ...baseConfig, cache: { - buildDependencies: { - config: [__filename], - }, type: 'filesystem', // version cache when there are changes to aliases version: md5(Object.entries(baseConfig.resolve.alias).join()), + buildDependencies: { + config: [__filename], + }, }, - devtool: 'inline-source-map', entry: { ...baseConfig.entry, main: [ @@ -28,19 +23,23 @@ export const getDevConfig = (payloadConfig: SanitizedConfig): Configuration => { ...(baseConfig.entry.main as string[]), ], }, - mode: 'development', output: { - filename: '[name].js', - path: '/', publicPath: `${payloadConfig.routes.admin}/`, + path: '/', + filename: '[name].js', }, - plugins: [...baseConfig.plugins, new webpack.HotModuleReplacementPlugin()], + devtool: 'inline-source-map', + mode: 'development', stats: 'errors-warnings', - } + plugins: [ + ...baseConfig.plugins, + new webpack.HotModuleReplacementPlugin(), + ], + }; webpackConfig.module.rules.push({ - sideEffects: true, test: /\.(scss|css)$/, + sideEffects: true, /* * The loaders here are run in reverse order. Here is how your loaders are being processed: * 1. sass-loader: This loader compiles your SCSS into CSS. @@ -53,7 +52,7 @@ export const getDevConfig = (payloadConfig: SanitizedConfig): Configuration => { { loader: require.resolve('css-loader'), options: { - url: (url) => !url.startsWith('/'), + url: (url) => (!url.startsWith('/')), }, }, { @@ -66,11 +65,11 @@ export const getDevConfig = (payloadConfig: SanitizedConfig): Configuration => { }, require.resolve('sass-loader'), ], - }) + }); if (payloadConfig.admin.webpack && typeof payloadConfig.admin.webpack === 'function') { - webpackConfig = payloadConfig.admin.webpack(webpackConfig) + webpackConfig = payloadConfig.admin.webpack(webpackConfig); } - return webpackConfig -} + return webpackConfig; +}; diff --git a/packages/payload/src/bundlers/webpack/configs/prod.ts b/packages/bundler-vite/src/webpack/configs/prod.ts similarity index 75% rename from packages/payload/src/bundlers/webpack/configs/prod.ts rename to packages/bundler-vite/src/webpack/configs/prod.ts index ce2e8619474..57282312372 100644 --- a/packages/payload/src/bundlers/webpack/configs/prod.ts +++ b/packages/bundler-vite/src/webpack/configs/prod.ts @@ -1,38 +1,36 @@ -import type { Configuration, WebpackPluginInstance } from 'webpack' - -import MiniCSSExtractPlugin from 'mini-css-extract-plugin' -import { SwcMinifyWebpackPlugin } from 'swc-minify-webpack-plugin' -import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' - -import type { SanitizedConfig } from '../../../config/types' - -import { getBaseConfig } from './base' +import { Configuration, WebpackPluginInstance } from 'webpack'; +import MiniCSSExtractPlugin from 'mini-css-extract-plugin'; +import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; +import { SwcMinifyWebpackPlugin } from 'swc-minify-webpack-plugin'; +import { getBaseConfig } from './base'; +import { SanitizedConfig } from '../../../config/types'; export const getProdConfig = (payloadConfig: SanitizedConfig): Configuration => { - const baseConfig = getBaseConfig(payloadConfig) as any + const baseConfig = getBaseConfig(payloadConfig) as any; let webpackConfig: Configuration = { ...baseConfig, + output: { + publicPath: `${payloadConfig.routes.admin}/`, + path: payloadConfig.admin.buildPath, + filename: '[name].[chunkhash].js', + chunkFilename: '[name].[chunkhash].js', + }, mode: 'production', + stats: 'errors-only', optimization: { minimizer: [new SwcMinifyWebpackPlugin()], splitChunks: { cacheGroups: { styles: { - chunks: 'all', - enforce: true, name: 'styles', test: /\.(sa|sc|c)ss$/, + chunks: 'all', + enforce: true, }, }, }, }, - output: { - chunkFilename: '[name].[chunkhash].js', - filename: '[name].[chunkhash].js', - path: payloadConfig.admin.buildPath, - publicPath: `${payloadConfig.routes.admin}/`, - }, plugins: [ ...baseConfig.plugins, new MiniCSSExtractPlugin({ @@ -40,18 +38,17 @@ export const getProdConfig = (payloadConfig: SanitizedConfig): Configuration => ignoreOrder: true, }), ], - stats: 'errors-only', - } + }; webpackConfig.module.rules.push({ - sideEffects: true, test: /\.(scss|css)$/, + sideEffects: true, use: [ MiniCSSExtractPlugin.loader, { loader: require.resolve('css-loader'), options: { - url: (url) => !url.startsWith('/'), + url: (url) => (!url.startsWith('/')), }, }, { @@ -64,15 +61,15 @@ export const getProdConfig = (payloadConfig: SanitizedConfig): Configuration => }, require.resolve('sass-loader'), ], - }) + }); if (process.env.PAYLOAD_ANALYZE_BUNDLE) { - webpackConfig.plugins.push(new BundleAnalyzerPlugin() as unknown as WebpackPluginInstance) + webpackConfig.plugins.push(new BundleAnalyzerPlugin() as unknown as WebpackPluginInstance); } if (payloadConfig.admin.webpack && typeof payloadConfig.admin.webpack === 'function') { - webpackConfig = payloadConfig.admin.webpack(webpackConfig) + webpackConfig = payloadConfig.admin.webpack(webpackConfig); } - return webpackConfig -} + return webpackConfig; +}; diff --git a/packages/bundler-vite/src/webpack/scripts/build.ts b/packages/bundler-vite/src/webpack/scripts/build.ts new file mode 100644 index 00000000000..ce9484b6c4a --- /dev/null +++ b/packages/bundler-vite/src/webpack/scripts/build.ts @@ -0,0 +1,27 @@ +import webpack from 'webpack'; +import { getProdConfig } from '../configs/prod'; +import { SanitizedConfig } from '../../../config/types'; + +type BuildAdminType = (options: { payloadConfig: SanitizedConfig }) => Promise<void>; +export const buildAdmin: BuildAdminType = async ({ payloadConfig }) => { + try { + const webpackConfig = getProdConfig(payloadConfig); + webpack(webpackConfig, (err, stats) => { + if (err || stats.hasErrors()) { + // Handle errors here + + if (stats) { + console.error(stats.toString({ + chunks: false, + colors: true, + })); + } else { + console.error(err.message); + } + } + }); + } catch (err) { + console.error(err); + throw new Error('Error: there was an error building the webpack prod config.'); + } +}; diff --git a/packages/bundler-vite/src/webpack/scripts/dev.ts b/packages/bundler-vite/src/webpack/scripts/dev.ts new file mode 100644 index 00000000000..35b279febb9 --- /dev/null +++ b/packages/bundler-vite/src/webpack/scripts/dev.ts @@ -0,0 +1,31 @@ +import webpack from 'webpack'; +import express from 'express'; +import webpackDevMiddleware from 'webpack-dev-middleware'; +import webpackHotMiddleware from 'webpack-hot-middleware'; +import history from 'connect-history-api-fallback'; +import type { PayloadHandler } from '../../../config/types'; +import { Payload } from '../../../payload'; +import { getDevConfig } from '../configs/dev'; + +const router = express.Router(); + +type DevAdminType = (options: { payload: Payload }) => Promise<PayloadHandler>; +export const devAdmin: DevAdminType = async ({ payload }) => { + router.use(history()); + + try { + const webpackConfig = getDevConfig(payload.config); + const compiler = webpack(webpackConfig); + + router.use(webpackDevMiddleware(compiler, { + publicPath: '/', + })); + + router.use(webpackHotMiddleware(compiler)); + } catch (err) { + console.error(err); + throw new Error('Error: there was an error creating the webpack dev server.'); + } + + return router; +}; diff --git a/packages/bundler-vite/src/webpack/scripts/serve.ts b/packages/bundler-vite/src/webpack/scripts/serve.ts new file mode 100644 index 00000000000..44958d29909 --- /dev/null +++ b/packages/bundler-vite/src/webpack/scripts/serve.ts @@ -0,0 +1,35 @@ +import express from 'express'; +import compression from 'compression'; +import history from 'connect-history-api-fallback'; +import type { PayloadHandler } from '../../../config/types'; +import { Payload } from '../../../payload'; + +const router = express.Router(); + +type ServeAdminType = (options: { payload: Payload }) => Promise<PayloadHandler>; + +export const serveAdmin: ServeAdminType = async ({ payload }) => { + router.use(history()); + + router.get('*', (req, res, next) => { + if (req.path.substr(-1) === '/' && req.path.length > 1) { + const query = req.url.slice(req.path.length); + res.redirect(301, req.path.slice(0, -1) + query); + } else { + next(); + } + }); + + router.use(compression(payload.config.express.compression)); + router.use(express.static(payload.config.admin.buildPath, { + redirect: false, + setHeaders: (res, path) => { + const staticFilesRegex = new RegExp('.(svg|css|js|jp(e)?g|png|avif|webp|webm|gif|ico|woff|woff2|ttf|otf)$', 'i'); + if (path.match(staticFilesRegex)) { + res.set('Cache-Control', `public, max-age=${60 * 60 * 24 * 365}, immutable`); + } + }, + })); + + return router; +}; diff --git a/packages/bundler-webpack/package.json b/packages/bundler-webpack/package.json new file mode 100644 index 00000000000..44010336a3f --- /dev/null +++ b/packages/bundler-webpack/package.json @@ -0,0 +1,58 @@ +{ + "name": "@payloadcms/bundler-webpack", + "version": "0.0.1", + "description": "The officially supported Webpack bundler adapter for Payload", + "repository": "https://github.com/payloadcms/payload", + "license": "MIT", + "author": { + "email": "[email protected]", + "name": "Payload", + "url": "https://payloadcms.com" + }, + "main": "./src/index.ts", + "types": "./src/index.ts", + "scripts": { + "build:swc": "swc ./src -d ./dist --config-file .swcrc", + "build:types": "tsc --emitDeclarationOnly --outDir dist", + "builddisabled": "pnpm build:swc && pnpm build:types" + }, + "dependencies": { + "compression": "1.7.4", + "connect-history-api-fallback": "1.6.0", + "css-minimizer-webpack-plugin": "^5.0.0", + "file-loader": "6.2.0", + "html-webpack-plugin": "^5.5.0", + "md5": "2.3.0", + "mini-css-extract-plugin": "1.6.2", + "path-browserify": "1.0.1", + "postcss": "8.4.27", + "postcss-loader": "6.2.1", + "postcss-preset-env": "9.0.0", + "style-loader": "^2.0.0", + "swc-loader": "^0.2.3", + "swc-minify-webpack-plugin": "^2.1.0", + "terser-webpack-plugin": "^5.3.6", + "url-loader": "4.1.1", + "webpack": "^5.78.0", + "webpack-bundle-analyzer": "^4.8.0", + "webpack-cli": "^4.10.0", + "webpack-dev-middleware": "6.0.1", + "webpack-hot-middleware": "^2.25.3" + }, + "devDependencies": { + "@payloadcms/eslint-config": "workspace:*", + "@types/extract-text-webpack-plugin": "^3.0.7", + "@types/html-webpack-plugin": "^3.2.6", + "@types/mini-css-extract-plugin": "^1.4.3", + "@types/optimize-css-assets-webpack-plugin": "^5.0.5", + "@types/webpack-bundle-analyzer": "^4.6.0", + "@types/webpack-env": "^1.18.0", + "@types/webpack-hot-middleware": "2.25.6", + "payload": "workspace:*" + }, + "publishConfig": { + "main": "./dist/index.js", + "registry": "https://registry.npmjs.org/", + "types": "./dist/index.d.ts" + } +} diff --git a/packages/payload/src/bundlers/webpack/bundler.ts b/packages/bundler-webpack/src/bundler.ts similarity index 85% rename from packages/payload/src/bundlers/webpack/bundler.ts rename to packages/bundler-webpack/src/bundler.ts index ff96a6bca68..e674e9c4aa4 100644 --- a/packages/payload/src/bundlers/webpack/bundler.ts +++ b/packages/bundler-webpack/src/bundler.ts @@ -1,12 +1,11 @@ /* eslint-disable @typescript-eslint/no-var-requires */ -import type { PayloadBundler } from '../types' - -import { buildAdmin } from './scripts/build' +import { PayloadBundler } from '../../payload/dist/bundlers/types' import { devAdmin } from './scripts/dev' +import { buildAdmin } from './scripts/build' import { serveAdmin } from './scripts/serve' export default (): PayloadBundler => ({ - build: async (payloadConfig) => buildAdmin({ payloadConfig }), dev: async (payload) => devAdmin({ payload }), + build: async (payloadConfig) => buildAdmin({ payloadConfig }), serve: async (payload) => serveAdmin({ payload }), }) diff --git a/packages/payload/src/bundlers/webpack/configs/base.ts b/packages/bundler-webpack/src/configs/base.ts similarity index 79% rename from packages/payload/src/bundlers/webpack/configs/base.ts rename to packages/bundler-webpack/src/configs/base.ts index 584cd66122e..925aaa63f99 100644 --- a/packages/payload/src/bundlers/webpack/configs/base.ts +++ b/packages/bundler-webpack/src/configs/base.ts @@ -1,27 +1,27 @@ -import type { Configuration } from 'webpack' - -import HtmlWebpackPlugin from 'html-webpack-plugin' import path from 'path' -import webpack from 'webpack' - -import type { SanitizedConfig } from '../../../config/types' +import HtmlWebpackPlugin from 'html-webpack-plugin' +import webpack, { Configuration } from 'webpack' +import type { SanitizedConfig } from 'payload/config' -const mockModulePath = path.resolve(__dirname, '../../mocks/emptyModule.js') -const mockDotENVPath = path.resolve(__dirname, '../../mocks/dotENV.js') +const mockModulePath = path.resolve(__dirname, '../mocks/emptyModule.js') +const mockDotENVPath = path.resolve(__dirname, '../mocks/dotENV.js') -const nodeModulesPath = path.resolve(__dirname, '../../../../node_modules') -const adminFolderPath = path.resolve(__dirname, '../../../admin') +const nodeModulesPath = path.resolve(__dirname, '../../node_modules') +const adminFolderPath = path.resolve(nodeModulesPath, 'payload/dist/admin') const bundlerPath = path.resolve(__dirname, '../bundler') export const getBaseConfig = (payloadConfig: SanitizedConfig): Configuration => ({ entry: { main: [adminFolderPath], }, + resolveLoader: { + modules: ['node_modules', nodeModulesPath], + }, module: { rules: [ { - exclude: /\/node_modules\/(?!.+\.tsx?$).*$/, test: /\.(t|j)sx?$/, + exclude: /\/node_modules\/(?!.+\.tsx?$).*$/, use: [ { loader: require.resolve('swc-loader'), @@ -46,6 +46,23 @@ export const getBaseConfig = (payloadConfig: SanitizedConfig): Configuration => }, ], }, + resolve: { + fallback: { + crypto: false, + https: false, + http: false, + }, + modules: ['node_modules', path.resolve(__dirname, nodeModulesPath)], + alias: { + path: require.resolve('path-browserify'), + 'payload-config': payloadConfig.paths.rawConfig, + payload$: mockModulePath, + 'payload-user-css': payloadConfig.admin.css, + dotenv: mockDotENVPath, + [bundlerPath]: mockModulePath, + }, + extensions: ['.ts', '.tsx', '.js', '.json'], + }, plugins: [ new webpack.ProvidePlugin({ process: require.resolve('process/browser') }), new webpack.DefinePlugin( @@ -61,28 +78,9 @@ export const getBaseConfig = (payloadConfig: SanitizedConfig): Configuration => }, {}), ), new HtmlWebpackPlugin({ - filename: path.normalize('./index.html'), template: payloadConfig.admin.indexHTML, + filename: path.normalize('./index.html'), }), + new webpack.HotModuleReplacementPlugin(), ], - resolve: { - alias: { - [bundlerPath]: mockModulePath, - dotenv: mockDotENVPath, - payload$: mockModulePath, - 'payload-config': payloadConfig.paths.rawConfig, - 'payload-user-css': payloadConfig.admin.css, - }, - extensions: ['.ts', '.tsx', '.js', '.json'], - fallback: { - crypto: false, - http: false, - https: false, - path: require.resolve('path-browserify'), - }, - modules: ['node_modules', path.resolve(__dirname, nodeModulesPath)], - }, - resolveLoader: { - modules: ['node_modules', path.join(__dirname, nodeModulesPath)], - }, }) diff --git a/packages/bundler-webpack/src/configs/dev.ts b/packages/bundler-webpack/src/configs/dev.ts new file mode 100644 index 00000000000..74aa426914d --- /dev/null +++ b/packages/bundler-webpack/src/configs/dev.ts @@ -0,0 +1,77 @@ +import webpack, { Configuration } from 'webpack' +import md5 from 'md5' +import { getBaseConfig } from './base' +import { SanitizedConfig } from 'payload/config' + +export const getDevConfig = (payloadConfig: SanitizedConfig): Configuration => { + const baseConfig = getBaseConfig(payloadConfig) as any + + let webpackConfig: Configuration = { + ...baseConfig, + module: { + ...baseConfig.module, + rules: [ + ...baseConfig.module.rules, + { + test: /\.(scss|css)$/, + sideEffects: true, + /* + * The loaders here are run in reverse order. Here is how your loaders are being processed: + * 1. sass-loader: This loader compiles your SCSS into CSS. + * 2. postcss-loader: This loader applies postcss transformations (with preset-env plugin in your case). + * 3. css-loader: This loader interprets @import and url() like import/require() and will resolve them. + * 4. style-loader: This loader injects CSS into the DOM. + */ + use: [ + require.resolve('style-loader'), + { + loader: require.resolve('css-loader'), + options: { + url: (url) => !url.startsWith('/'), + }, + }, + { + loader: require.resolve('postcss-loader'), + options: { + postcssOptions: { + plugins: [require.resolve('postcss-preset-env')], + }, + }, + }, + require.resolve('sass-loader'), + ], + }, + ], + }, + cache: { + type: 'filesystem', + // version cache when there are changes to aliases + version: md5(Object.entries(baseConfig.resolve.alias).join()), + buildDependencies: { + config: [__filename], + }, + }, + entry: { + ...baseConfig.entry, + main: [ + `webpack-hot-middleware/client?path=${payloadConfig.routes.admin}/__webpack_hmr`, + ...(baseConfig.entry.main as string[]), + ], + }, + output: { + publicPath: `${payloadConfig.routes.admin}/`, + path: '/', + filename: '[name].js', + }, + devtool: 'inline-source-map', + mode: 'development', + stats: 'errors-warnings', + plugins: [...baseConfig.plugins, new webpack.HotModuleReplacementPlugin()], + } + + if (payloadConfig.admin.webpack && typeof payloadConfig.admin.webpack === 'function') { + webpackConfig = payloadConfig.admin.webpack(webpackConfig) + } + + return webpackConfig +} diff --git a/packages/bundler-webpack/src/configs/prod.ts b/packages/bundler-webpack/src/configs/prod.ts new file mode 100644 index 00000000000..fff3094ce15 --- /dev/null +++ b/packages/bundler-webpack/src/configs/prod.ts @@ -0,0 +1,77 @@ +import { Configuration, WebpackPluginInstance } from 'webpack' +import MiniCSSExtractPlugin from 'mini-css-extract-plugin' +import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' +import { SwcMinifyWebpackPlugin } from 'swc-minify-webpack-plugin' +import { getBaseConfig } from './base' +import { SanitizedConfig } from 'payload/config' + +export const getProdConfig = (payloadConfig: SanitizedConfig): Configuration => { + const baseConfig = getBaseConfig(payloadConfig) as any + + let webpackConfig: Configuration = { + ...baseConfig, + module: { + ...baseConfig.module, + rules: [ + ...baseConfig.module.rules, + { + test: /\.(scss|css)$/, + sideEffects: true, + use: [ + MiniCSSExtractPlugin.loader, + { + loader: require.resolve('css-loader'), + options: { + url: (url) => !url.startsWith('/'), + }, + }, + { + loader: require.resolve('postcss-loader'), + options: { + postcssOptions: { + plugins: [require.resolve('postcss-preset-env')], + }, + }, + }, + require.resolve('sass-loader'), + ], + }, + ], + }, + output: { + publicPath: `${payloadConfig.routes.admin}/`, + path: payloadConfig.admin.buildPath, + filename: '[name].[chunkhash].js', + chunkFilename: '[name].[chunkhash].js', + }, + mode: 'production', + stats: 'errors-only', + optimization: { + minimizer: [new SwcMinifyWebpackPlugin()], + splitChunks: { + cacheGroups: { + styles: { + name: 'styles', + test: /\.(sa|sc|c)ss$/, + chunks: 'all', + enforce: true, + }, + }, + }, + }, + plugins: [ + ...baseConfig.plugins, + new MiniCSSExtractPlugin({ + filename: '[name].[contenthash].css', + ignoreOrder: true, + }), + ...(process.env.PAYLOAD_ANALYZE_BUNDLE ? [new BundleAnalyzerPlugin()] : []), + ], + } + + if (payloadConfig.admin.webpack && typeof payloadConfig.admin.webpack === 'function') { + webpackConfig = payloadConfig.admin.webpack(webpackConfig) + } + + return webpackConfig +} diff --git a/packages/bundler-webpack/src/mocks/dotENV.js b/packages/bundler-webpack/src/mocks/dotENV.js new file mode 100644 index 00000000000..9ddda98f1ee --- /dev/null +++ b/packages/bundler-webpack/src/mocks/dotENV.js @@ -0,0 +1,3 @@ +export default { + config: () => null, +} diff --git a/packages/bundler-webpack/src/mocks/emptyModule.js b/packages/bundler-webpack/src/mocks/emptyModule.js new file mode 100644 index 00000000000..ead516c976e --- /dev/null +++ b/packages/bundler-webpack/src/mocks/emptyModule.js @@ -0,0 +1 @@ +export default () => {} diff --git a/packages/bundler-webpack/src/mocks/fileMock.js b/packages/bundler-webpack/src/mocks/fileMock.js new file mode 100644 index 00000000000..e25c9a3dc45 --- /dev/null +++ b/packages/bundler-webpack/src/mocks/fileMock.js @@ -0,0 +1 @@ +export default 'file-stub' diff --git a/packages/payload/src/bundlers/webpack/scripts/build.ts b/packages/bundler-webpack/src/scripts/build.ts similarity index 92% rename from packages/payload/src/bundlers/webpack/scripts/build.ts rename to packages/bundler-webpack/src/scripts/build.ts index 3bc0d5f8850..a9839fc423b 100644 --- a/packages/payload/src/bundlers/webpack/scripts/build.ts +++ b/packages/bundler-webpack/src/scripts/build.ts @@ -1,8 +1,6 @@ import webpack from 'webpack' - -import type { SanitizedConfig } from '../../../config/types' - import { getProdConfig } from '../configs/prod' +import { SanitizedConfig } from 'payload/config' type BuildAdminType = (options: { payloadConfig: SanitizedConfig }) => Promise<void> export const buildAdmin: BuildAdminType = async ({ payloadConfig }) => { diff --git a/packages/payload/src/bundlers/webpack/scripts/dev.ts b/packages/bundler-webpack/src/scripts/dev.ts similarity index 88% rename from packages/payload/src/bundlers/webpack/scripts/dev.ts rename to packages/bundler-webpack/src/scripts/dev.ts index 85e3e276a63..4226eb1c143 100644 --- a/packages/payload/src/bundlers/webpack/scripts/dev.ts +++ b/packages/bundler-webpack/src/scripts/dev.ts @@ -1,12 +1,10 @@ -import history from 'connect-history-api-fallback' -import express from 'express' import webpack from 'webpack' +import express from 'express' import webpackDevMiddleware from 'webpack-dev-middleware' import webpackHotMiddleware from 'webpack-hot-middleware' - -import type { PayloadHandler } from '../../../config/types' -import type { Payload } from '../../../payload' - +import history from 'connect-history-api-fallback' +import type { PayloadHandler } from 'payload/config' +import { Payload } from 'payload' import { getDevConfig } from '../configs/dev' const router = express.Router() diff --git a/packages/payload/src/bundlers/webpack/scripts/serve.ts b/packages/bundler-webpack/src/scripts/serve.ts similarity index 90% rename from packages/payload/src/bundlers/webpack/scripts/serve.ts rename to packages/bundler-webpack/src/scripts/serve.ts index a54b7e489f6..ed1fdd5412b 100644 --- a/packages/payload/src/bundlers/webpack/scripts/serve.ts +++ b/packages/bundler-webpack/src/scripts/serve.ts @@ -1,9 +1,8 @@ +import express from 'express' import compression from 'compression' import history from 'connect-history-api-fallback' -import express from 'express' - -import type { PayloadHandler } from '../../../config/types' -import type { Payload } from '../../../payload' +import type { PayloadHandler } from 'payload/config' +import { Payload } from 'payload' const router = express.Router() diff --git a/packages/payload/package.json b/packages/payload/package.json index 5c3d2babbf2..7c4a571bc13 100644 --- a/packages/payload/package.json +++ b/packages/payload/package.json @@ -62,8 +62,6 @@ "conf": "10.2.0", "connect-history-api-fallback": "1.6.0", "console-table-printer": "2.11.2", - "css-loader": "5.2.7", - "css-minimizer-webpack-plugin": "5.0.1", "dataloader": "2.2.2", "date-fns": "2.30.0", "deep-equal": "2.2.2", @@ -72,7 +70,6 @@ "express": "4.18.2", "express-fileupload": "1.4.0", "express-rate-limit": "5.5.1", - "file-loader": "6.2.0", "file-type": "16.5.4", "find-up": "4.1.0", "flatley": "5.2.0", @@ -99,7 +96,6 @@ "md5": "2.3.0", "method-override": "3.0.0", "micro-memoize": "4.1.2", - "mini-css-extract-plugin": "1.6.2", "minimist": "1.2.8", "mkdirp": "1.0.4", "monaco-editor": "0.38.0", @@ -110,13 +106,9 @@ "passport-headerapikey": "1.2.2", "passport-jwt": "4.0.1", "passport-local": "1.0.0", - "path-browserify": "1.0.1", "pino": "8.15.0", "pino-pretty": "10.2.0", "pluralize": "8.0.0", - "postcss": "8.4.27", - "postcss-loader": "6.2.1", - "postcss-preset-env": "9.0.0", "probe-image-size": "6.0.0", "process": "0.11.10", "qs": "6.11.2", @@ -134,7 +126,6 @@ "react-toastify": "8.2.0", "sanitize-filename": "1.6.3", "sass": "1.64.0", - "sass-loader": "12.6.0", "scheduler": "0.23.0", "scmp": "2.1.0", "sharp": "0.31.3", @@ -142,19 +133,9 @@ "slate-history": "0.86.0", "slate-hyperscript": "0.81.3", "slate-react": "0.92.0", - "style-loader": "2.0.0", - "swc-loader": "0.2.3", - "swc-minify-webpack-plugin": "2.1.1", - "terser-webpack-plugin": "5.3.9", "ts-essentials": "7.0.3", - "url-loader": "4.1.1", "use-context-selector": "1.4.1", - "uuid": "8.3.2", - "webpack": "5.88.2", - "webpack-bundle-analyzer": "4.9.0", - "webpack-cli": "4.10.0", - "webpack-dev-middleware": "6.0.1", - "webpack-hot-middleware": "2.25.4" + "uuid": "8.3.2" }, "devDependencies": { "@payloadcms/eslint-config": "workspace:*", @@ -162,15 +143,11 @@ "@types/asap": "2.0.0", "@types/body-parser": "1.19.2", "@types/compression": "1.7.2", - "@types/connect-history-api-fallback": "1.5.0", "@types/express": "4.17.17", "@types/express-fileupload": "1.4.1", "@types/express-rate-limit": "5.1.3", "@types/express-serve-static-core": "4.17.35", - "@types/extract-text-webpack-plugin": "3.0.7", - "@types/file-loader": "4.2.1", "@types/hapi__joi": "17.1.9", - "@types/html-webpack-plugin": "3.2.6", "@types/ignore-styles": "5.0.0", "@types/is-hotkey": "0.1.7", "@types/isomorphic-fetch": "0.0.36", @@ -179,12 +156,10 @@ "@types/jsonwebtoken": "8.5.9", "@types/method-override": "0.0.32", "@types/mime": "2.0.3", - "@types/mini-css-extract-plugin": "1.4.3", "@types/minimist": "1.2.2", "@types/mkdirp": "1.0.2", "@types/node-fetch": "2.6.4", "@types/nodemailer": "6.4.8", - "@types/optimize-css-assets-webpack-plugin": "5.0.5", "@types/passport": "1.0.12", "@types/passport-anonymous": "1.0.3", "@types/passport-jwt": "3.0.9", @@ -192,7 +167,6 @@ "@types/pluralize": "0.0.29", "@types/prismjs": "1.26.0", "@types/probe-image-size": "7.2.0", - "@types/prop-types": "15.7.5", "@types/qs": "6.9.7", "@types/qs-middleware": "1.0.1", "@types/react": "18.2.15", @@ -202,29 +176,36 @@ "@types/react-router-dom": "5.3.3", "@types/shelljs": "0.8.12", "@types/uuid": "8.3.4", - "@types/webpack-bundle-analyzer": "4.6.0", - "@types/webpack-env": "1.18.1", - "@types/webpack-hot-middleware": "2.25.6", - "better-sqlite3": "8.5.0", "confusing-browser-globals": "1.0.11", "copyfiles": "2.4.1", "cross-env": "7.0.3", + "css-loader": "5.2.7", + "css-minimizer-webpack-plugin": "^5.0.0", + "file-loader": "6.2.0", "form-data": "3.0.1", "get-port": "5.1.1", "glob": "8.1.0", "graphql-request": "3.7.0", + "mini-css-extract-plugin": "1.6.2", "mongodb-memory-server": "8.13.0", "node-fetch": "2.6.12", "nodemon": "3.0.1", "object.assign": "4.1.4", "object.entries": "1.1.6", "passport-strategy": "1.0.0", + "postcss-loader": "6.2.1", + "postcss-preset-env": "9.0.0", "release-it": "16.1.3", "rimraf": "3.0.2", + "sass-loader": "12.6.0", "serve-static": "1.15.0", "shelljs": "0.8.5", "slash": "3.0.0", - "terser": "5.19.2" + "swc-loader": "^0.2.3", + "terser": "5.19.2", + "terser-webpack-plugin": "^5.3.6", + "url-loader": "4.1.1", + "webpack": "^5.78.0" }, "engines": { "node": ">=14", diff --git a/packages/payload/src/admin/components.config.ts b/packages/payload/src/admin/components.config.ts new file mode 100644 index 00000000000..ab93e3cd70f --- /dev/null +++ b/packages/payload/src/admin/components.config.ts @@ -0,0 +1,94 @@ +import type { Configuration } from 'webpack' + +import OptimizeCSSAssetsPlugin from 'css-minimizer-webpack-plugin' +import MiniCSSExtractPlugin from 'mini-css-extract-plugin' +import path from 'path' +import TerserJSPlugin from 'terser-webpack-plugin' + +const componentWebpackConfig: Configuration = { + entry: { + main: [path.resolve(__dirname, './components/index.js')], + }, + externals: { + react: 'react', + }, + mode: 'production', + module: { + rules: [ + { + exclude: /node_modules/, + test: /\.(t|j)sx?$/, + use: [ + { + loader: require.resolve('swc-loader'), + }, + ], + }, + { + oneOf: [ + { + loader: require.resolve('url-loader'), + options: { + name: 'static/media/[name].[hash:8].[ext]', + limit: 10000, + }, + test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/], + }, + { + sideEffects: true, + test: /\.(sa|sc|c)ss$/, + use: [ + MiniCSSExtractPlugin.loader, + 'css-loader', + { + loader: 'postcss-loader', + options: { + postcssOptions: { + plugins: ['postcss-preset-env'], + }, + }, + }, + 'sass-loader', + ], + }, + { + exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/], + loader: require.resolve('file-loader'), + options: { + name: 'static/media/[name].[hash:8].[ext]', + }, + }, + ], + }, + ], + }, + optimization: { + minimizer: [ + new TerserJSPlugin({ + extractComments: false, + }), + new OptimizeCSSAssetsPlugin({}), + ], + }, + output: { + filename: 'index.js', + libraryTarget: 'commonjs2', + path: path.resolve(__dirname, '../../components'), + publicPath: '/', + }, + plugins: [ + new MiniCSSExtractPlugin({ + filename: 'styles.css', + ignoreOrder: true, + }), + ], + resolve: { + alias: { + 'payload-scss-overrides': path.resolve(__dirname, './scss/overrides.scss'), + }, + modules: ['node_modules', path.resolve(__dirname, '../../node_modules')], + }, + stats: 'errors-only', +} + +export default componentWebpackConfig diff --git a/packages/payload/src/config/sanitize.ts b/packages/payload/src/config/sanitize.ts index 6a99d90fc91..84beb263204 100644 --- a/packages/payload/src/config/sanitize.ts +++ b/packages/payload/src/config/sanitize.ts @@ -6,11 +6,9 @@ import type { LocalizationConfigWithLabels, LocalizationConfigWithNoLabels, SanitizedConfig, - SanitizedLocalizationConfig, } from './types' import { defaultUserCollection } from '../auth/defaultUser' -import getDefaultBundler from '../bundlers/webpack/bundler' import sanitizeCollection from '../collections/config/sanitize' import { migrationsCollection } from '../database/migrations/migrationsCollection' import { InvalidConfiguration } from '../errors' @@ -39,11 +37,6 @@ const sanitizeAdminConfig = (configToSanitize: Config): Partial<SanitizedConfig> ) } - // add default bundler if none provided - if (!sanitizedConfig.admin.bundler) { - sanitizedConfig.admin.bundler = getDefaultBundler() - } - return sanitizedConfig as Partial<SanitizedConfig> } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f51e2a2c389..1d9d6631a5f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,6 +39,9 @@ importers: '@types/node': specifier: 20.5.7 version: 20.5.7 + '@types/react': + specifier: 18.2.15 + version: 18.2.15 '@types/testing-library__jest-dom': specifier: 5.14.8 version: 5.14.8 @@ -63,6 +66,9 @@ importers: prettier: specifier: ^3.0.3 version: 3.0.3 + react: + specifier: 18.2.0 + version: 18.2.0 shelljs: specifier: 0.8.5 version: 0.8.5 @@ -76,6 +82,122 @@ importers: specifier: ^9.0.0 version: 9.0.0 + packages/bundler-vite: + dependencies: + '@vitejs/plugin-react': + specifier: ^4.0.4 + version: 4.0.4([email protected]) + vite: + specifier: ^4.4.9 + version: 4.4.9(@types/[email protected]) + vite-plugin-commonjs: + specifier: ^0.8.2 + version: 0.8.2 + vite-plugin-virtual: + specifier: ^0.2.0 + version: 0.2.0([email protected]) + devDependencies: + '@payloadcms/eslint-config': + specifier: workspace:* + version: link:../eslint-config-payload + payload: + specifier: workspace:* + version: link:../payload + + packages/bundler-webpack: + dependencies: + compression: + specifier: 1.7.4 + version: 1.7.4 + connect-history-api-fallback: + specifier: 1.6.0 + version: 1.6.0 + css-minimizer-webpack-plugin: + specifier: ^5.0.0 + version: 5.0.1([email protected]) + file-loader: + specifier: 6.2.0 + version: 6.2.0([email protected]) + html-webpack-plugin: + specifier: ^5.5.0 + version: 5.5.3([email protected]) + md5: + specifier: 2.3.0 + version: 2.3.0 + mini-css-extract-plugin: + specifier: 1.6.2 + version: 1.6.2([email protected]) + path-browserify: + specifier: 1.0.1 + version: 1.0.1 + postcss: + specifier: 8.4.27 + version: 8.4.27 + postcss-loader: + specifier: 6.2.1 + version: 6.2.1([email protected])([email protected]) + postcss-preset-env: + specifier: 9.0.0 + version: 9.0.0([email protected]) + style-loader: + specifier: ^2.0.0 + version: 2.0.0([email protected]) + swc-loader: + specifier: ^0.2.3 + version: 0.2.3(@swc/[email protected])([email protected]) + swc-minify-webpack-plugin: + specifier: ^2.1.0 + version: 2.1.1(@swc/[email protected])([email protected]) + terser-webpack-plugin: + specifier: ^5.3.6 + version: 5.3.9(@swc/[email protected])([email protected]) + url-loader: + specifier: 4.1.1 + version: 4.1.1([email protected])([email protected]) + webpack: + specifier: ^5.78.0 + version: 5.88.2(@swc/[email protected])([email protected]) + webpack-bundle-analyzer: + specifier: ^4.8.0 + version: 4.9.0 + webpack-cli: + specifier: ^4.10.0 + version: 4.10.0([email protected])([email protected]) + webpack-dev-middleware: + specifier: 6.0.1 + version: 6.0.1([email protected]) + webpack-hot-middleware: + specifier: ^2.25.3 + version: 2.25.4 + devDependencies: + '@payloadcms/eslint-config': + specifier: workspace:* + version: link:../eslint-config-payload + '@types/extract-text-webpack-plugin': + specifier: ^3.0.7 + version: 3.0.7 + '@types/html-webpack-plugin': + specifier: ^3.2.6 + version: 3.2.6 + '@types/mini-css-extract-plugin': + specifier: ^1.4.3 + version: 1.4.3(@swc/[email protected])([email protected]) + '@types/optimize-css-assets-webpack-plugin': + specifier: ^5.0.5 + version: 5.0.5 + '@types/webpack-bundle-analyzer': + specifier: ^4.6.0 + version: 4.6.0(@swc/[email protected])([email protected]) + '@types/webpack-env': + specifier: ^1.18.0 + version: 1.18.1 + '@types/webpack-hot-middleware': + specifier: 2.25.6 + version: 2.25.6(@swc/[email protected])([email protected]) + payload: + specifier: workspace:* + version: link:../payload + packages/db-mongodb: dependencies: bson-objectid: @@ -248,12 +370,6 @@ importers: console-table-printer: specifier: 2.11.2 version: 2.11.2 - css-loader: - specifier: 5.2.7 - version: 5.2.7([email protected]) - css-minimizer-webpack-plugin: - specifier: 5.0.1 - version: 5.0.1([email protected]) dataloader: specifier: 2.2.2 version: 2.2.2 @@ -278,9 +394,6 @@ importers: express-rate-limit: specifier: 5.5.1 version: 5.5.1 - file-loader: - specifier: 6.2.0 - version: 6.2.0([email protected]) file-type: specifier: 16.5.4 version: 16.5.4 @@ -359,9 +472,6 @@ importers: micro-memoize: specifier: 4.1.2 version: 4.1.2 - mini-css-extract-plugin: - specifier: 1.6.2 - version: 1.6.2([email protected]) minimist: specifier: 1.2.8 version: 1.2.8 @@ -392,9 +502,6 @@ importers: passport-local: specifier: 1.0.0 version: 1.0.0 - path-browserify: - specifier: 1.0.1 - version: 1.0.1 pino: specifier: 8.15.0 version: 8.15.0 @@ -404,15 +511,6 @@ importers: pluralize: specifier: 8.0.0 version: 8.0.0 - postcss: - specifier: 8.4.27 - version: 8.4.27 - postcss-loader: - specifier: 6.2.1 - version: 6.2.1([email protected])([email protected]) - postcss-preset-env: - specifier: 9.0.0 - version: 9.0.0([email protected]) probe-image-size: specifier: 6.0.0 version: 6.0.0 @@ -464,9 +562,6 @@ importers: sass: specifier: 1.64.0 version: 1.64.0 - sass-loader: - specifier: 12.6.0 - version: 12.6.0([email protected])([email protected]) scheduler: specifier: 0.23.0 version: 0.23.0 @@ -488,45 +583,15 @@ importers: slate-react: specifier: 0.92.0 version: 0.92.0([email protected])([email protected])([email protected]) - style-loader: - specifier: 2.0.0 - version: 2.0.0([email protected]) - swc-loader: - specifier: 0.2.3 - version: 0.2.3(@swc/[email protected])([email protected]) - swc-minify-webpack-plugin: - specifier: 2.1.1 - version: 2.1.1(@swc/[email protected])([email protected]) - terser-webpack-plugin: - specifier: 5.3.9 - version: 5.3.9(@swc/[email protected])([email protected]) ts-essentials: specifier: 7.0.3 version: 7.0.3([email protected]) - url-loader: - specifier: 4.1.1 - version: 4.1.1([email protected])([email protected]) use-context-selector: specifier: 1.4.1 version: 1.4.1([email protected])([email protected])([email protected]) uuid: specifier: 8.3.2 version: 8.3.2 - webpack: - specifier: 5.88.2 - version: 5.88.2(@swc/[email protected])([email protected]) - webpack-bundle-analyzer: - specifier: 4.9.0 - version: 4.9.0 - webpack-cli: - specifier: 4.10.0 - version: 4.10.0([email protected])([email protected]) - webpack-dev-middleware: - specifier: 6.0.1 - version: 6.0.1([email protected]) - webpack-hot-middleware: - specifier: 2.25.4 - version: 2.25.4 devDependencies: '@payloadcms/eslint-config': specifier: workspace:* @@ -543,9 +608,6 @@ importers: '@types/compression': specifier: 1.7.2 version: 1.7.2 - '@types/connect-history-api-fallback': - specifier: 1.5.0 - version: 1.5.0 '@types/express': specifier: 4.17.17 version: 4.17.17 @@ -558,18 +620,9 @@ importers: '@types/express-serve-static-core': specifier: 4.17.35 version: 4.17.35 - '@types/extract-text-webpack-plugin': - specifier: 3.0.7 - version: 3.0.7 - '@types/file-loader': - specifier: 4.2.1 - version: 4.2.1 '@types/hapi__joi': specifier: 17.1.9 version: 17.1.9 - '@types/html-webpack-plugin': - specifier: 3.2.6 - version: 3.2.6 '@types/ignore-styles': specifier: 5.0.0 version: 5.0.0 @@ -594,9 +647,6 @@ importers: '@types/mime': specifier: 2.0.3 version: 2.0.3 - '@types/mini-css-extract-plugin': - specifier: 1.4.3 - version: 1.4.3(@swc/[email protected])([email protected]) '@types/minimist': specifier: 1.2.2 version: 1.2.2 @@ -609,9 +659,6 @@ importers: '@types/nodemailer': specifier: 6.4.8 version: 6.4.8 - '@types/optimize-css-assets-webpack-plugin': - specifier: 5.0.5 - version: 5.0.5 '@types/passport': specifier: 1.0.12 version: 1.0.12 @@ -633,9 +680,6 @@ importers: '@types/probe-image-size': specifier: 7.2.0 version: 7.2.0 - '@types/prop-types': - specifier: 15.7.5 - version: 15.7.5 '@types/qs': specifier: 6.9.7 version: 6.9.7 @@ -663,18 +707,6 @@ importers: '@types/uuid': specifier: 8.3.4 version: 8.3.4 - '@types/webpack-bundle-analyzer': - specifier: 4.6.0 - version: 4.6.0(@swc/[email protected])([email protected]) - '@types/webpack-env': - specifier: 1.18.1 - version: 1.18.1 - '@types/webpack-hot-middleware': - specifier: 2.25.6 - version: 2.25.6(@swc/[email protected])([email protected]) - better-sqlite3: - specifier: 8.5.0 - version: 8.5.0 confusing-browser-globals: specifier: 1.0.11 version: 1.0.11 @@ -684,6 +716,15 @@ importers: cross-env: specifier: 7.0.3 version: 7.0.3 + css-loader: + specifier: 5.2.7 + version: 5.2.7([email protected]) + css-minimizer-webpack-plugin: + specifier: ^5.0.0 + version: 5.0.1([email protected]) + file-loader: + specifier: 6.2.0 + version: 6.2.0([email protected]) form-data: specifier: 3.0.1 version: 3.0.1 @@ -696,6 +737,9 @@ importers: graphql-request: specifier: 3.7.0 version: 3.7.0([email protected]) + mini-css-extract-plugin: + specifier: 1.6.2 + version: 1.6.2([email protected]) mongodb-memory-server: specifier: 8.13.0 version: 8.13.0 @@ -714,12 +758,21 @@ importers: passport-strategy: specifier: 1.0.0 version: 1.0.0 + postcss-loader: + specifier: 6.2.1 + version: 6.2.1([email protected])([email protected]) + postcss-preset-env: + specifier: 9.0.0 + version: 9.0.0([email protected]) release-it: specifier: 16.1.3 version: 16.1.3 rimraf: specifier: 3.0.2 version: 3.0.2 + sass-loader: + specifier: 12.6.0 + version: 12.6.0([email protected])([email protected]) serve-static: specifier: 1.15.0 version: 1.15.0 @@ -729,9 +782,21 @@ importers: slash: specifier: 3.0.0 version: 3.0.0 + swc-loader: + specifier: ^0.2.3 + version: 0.2.3(@swc/[email protected])([email protected]) terser: specifier: 5.19.2 version: 5.19.2 + terser-webpack-plugin: + specifier: ^5.3.6 + version: 5.3.9(@swc/[email protected])([email protected]) + url-loader: + specifier: 4.1.1 + version: 4.1.1([email protected])([email protected]) + webpack: + specifier: ^5.78.0 + version: 5.88.2(@swc/[email protected])([email protected]) packages: @@ -1494,6 +1559,26 @@ packages: '@babel/core': 7.22.11 '@babel/helper-plugin-utils': 7.22.5 + /@babel/[email protected](@babel/[email protected]): + resolution: {integrity: sha512-nTh2ogNUtxbiSbxaT4Ds6aXnXEipHweN9YRgOX/oNXdf0cCrGn/+2LozFa3lnPV5D90MkjhgckCPBrsoSc1a7g==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.22.11 + '@babel/helper-plugin-utils': 7.22.5 + dev: false + + /@babel/[email protected](@babel/[email protected]): + resolution: {integrity: sha512-yIiRO6yobeEIaI0RTbIr8iAK9FcBHLtZq0S89ZPjDLQXBA4xvghaKqI0etp/tF3htTM0sazJKKLz9oEiGRtu7w==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.22.11 + '@babel/helper-plugin-utils': 7.22.5 + dev: false + /@babel/[email protected]: resolution: {integrity: sha512-ee7jVNlWN09+KftVOu9n7S8gQzD/Z6hN/I8VBRXW4P1+Xe7kJGXMwu8vds4aGIMHZnNbdpSWCfZZtinytpcAvA==} engines: {node: '>=6.9.0'} @@ -1560,12 +1645,10 @@ packages: dependencies: '@csstools/css-parser-algorithms': 2.3.1(@csstools/[email protected]) '@csstools/css-tokenizer': 2.2.0 - dev: false /@csstools/[email protected]: resolution: {integrity: sha512-rBODd1rY01QcenD34QxbQxLc1g+Uh7z1X/uzTHNQzJUnFCT9/EZYI7KWq+j0YfWMXJsRJ8lVkqBcB0R/qLr+yg==} engines: {node: ^14 || ^16 || >=18} - dev: false /@csstools/[email protected](@csstools/[email protected])(@csstools/[email protected]): resolution: {integrity: sha512-7mJZ8gGRtSQfQKBQFi5N0Z+jzNC0q8bIkwojP1W0w+APzEqHu5wJoGVsvKxVnVklu9F8tW1PikbBRseYnAdv+g==} @@ -1576,7 +1659,6 @@ packages: dependencies: '@csstools/css-parser-algorithms': 2.3.1(@csstools/[email protected]) '@csstools/css-tokenizer': 2.2.0 - dev: false /@csstools/[email protected](@csstools/[email protected])(@csstools/[email protected]): resolution: {integrity: sha512-YaEnCoPTdhE4lPQFH3dU4IEk8S+yCnxS88wMv45JzlnMfZp57hpqA6qf2gX8uv7IJTJ/43u6pTQmhy7hCjlz7g==} @@ -1589,7 +1671,6 @@ packages: '@csstools/css-calc': 1.1.3(@csstools/[email protected])(@csstools/[email protected]) '@csstools/css-parser-algorithms': 2.3.1(@csstools/[email protected]) '@csstools/css-tokenizer': 2.2.0 - dev: false /@csstools/[email protected](@csstools/[email protected]): resolution: {integrity: sha512-xrvsmVUtefWMWQsGgFffqWSK03pZ1vfDki4IVIIUxxDKnGBzqNgv0A7SB1oXtVNEkcVO8xi1ZrTL29HhSu5kGA==} @@ -1598,12 +1679,10 @@ packages: '@csstools/css-tokenizer': ^2.2.0 dependencies: '@csstools/css-tokenizer': 2.2.0 - dev: false /@csstools/[email protected]: resolution: {integrity: sha512-wErmsWCbsmig8sQKkM6pFhr/oPha1bHfvxsUY5CYSQxwyhA9Ulrs8EqCgClhg4Tgg2XapVstGqSVcz0xOYizZA==} engines: {node: ^14 || ^16 || >=18} - dev: false /@csstools/[email protected](@csstools/[email protected])(@csstools/[email protected]): resolution: {integrity: sha512-V/OUXYX91tAC1CDsiY+HotIcJR+vPtzrX8pCplCpT++i8ThZZsq5F5dzZh/bDM3WUOjrvC1ljed1oSJxMfjqhw==} @@ -1614,7 +1693,6 @@ packages: dependencies: '@csstools/css-parser-algorithms': 2.3.1(@csstools/[email protected]) '@csstools/css-tokenizer': 2.2.0 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-dVPVVqQG0FixjM9CG/+8eHTsCAxRKqmNh6H69IpruolPlnEF1611f2AoLK8TijTSAsqBSclKd4WHs1KUb/LdJw==} @@ -1625,7 +1703,6 @@ packages: '@csstools/selector-specificity': 3.0.0([email protected]) postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-b1ptNkr1UWP96EEHqKBWWaV5m/0hgYGctgA/RVZhONeP1L3T/8hwoqDm9bB23yVCfOgE9U93KI9j06+pEkJTvw==} @@ -1638,7 +1715,6 @@ packages: '@csstools/css-tokenizer': 2.2.0 '@csstools/postcss-progressive-custom-properties': 2.3.0([email protected]) postcss: 8.4.27 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-QGXjGugTluqFZWzVf+S3wCiRiI0ukXlYqCi7OnpDotP/zaVTyl/aqZujLFzTOXy24BoWnu89frGMc79ohY5eog==} @@ -1651,7 +1727,6 @@ packages: '@csstools/css-tokenizer': 2.2.0 '@csstools/postcss-progressive-custom-properties': 2.3.0([email protected]) postcss: 8.4.27 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-ntkGj+1uDa/u6lpjPxnkPcjJn7ChO/Kcy08YxctOZI7vwtrdYvFhmE476dq8bj1yna306+jQ9gzXIG/SWfOaRg==} @@ -1661,7 +1736,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-IHeFIcksjI8xKX7PWLzAyigM3UvJdZ4btejeNa7y/wXxqD5dyPPZuY55y8HGTrS6ETVTRqfIznoCPtTzIX7ygQ==} @@ -1674,7 +1748,6 @@ packages: '@csstools/css-tokenizer': 2.2.0 '@csstools/postcss-progressive-custom-properties': 3.0.0([email protected]) postcss: 8.4.27 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-FYe2K8EOYlL1BUm2HTXVBo6bWAj0xl4khOk6EFhQHy/C5p3rlr8OcetzQuwMeNQ3v25nB06QTgqUHoOUwoEqhA==} @@ -1686,7 +1759,6 @@ packages: '@csstools/css-parser-algorithms': 2.3.1(@csstools/[email protected]) '@csstools/css-tokenizer': 2.2.0 postcss: 8.4.27 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-FH3+zfOfsgtX332IIkRDxiYLmgwyNk49tfltpC6dsZaO4RV2zWY6x9VMIC5cjvmjlDO7DIThpzqaqw2icT8RbQ==} @@ -1697,7 +1769,6 @@ packages: '@csstools/postcss-progressive-custom-properties': 3.0.0([email protected]) postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-0I6siRcDymG3RrkNTSvHDMxTQ6mDyYE8awkcaHNgtYacd43msl+4ZWDfQ1yZQ/viczVWjqJkLmPiRHSgxn5nZA==} @@ -1708,7 +1779,6 @@ packages: '@csstools/selector-specificity': 3.0.0([email protected]) postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-Wki4vxsF6icRvRz8eF9bPpAvwaAt0RHwhVOyzfoFg52XiIMjb6jcbHkGxwpJXP4DVrnFEwpwmrz5aTRqOW82kg==} @@ -1717,7 +1787,6 @@ packages: postcss: ^8.4 dependencies: postcss: 8.4.27 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-lCQ1aX8c5+WI4t5EoYf3alTzJNNocMqTb+u1J9CINdDhFh1fjovqK+0aHalUHsNstZmzFPNzIkU4Mb3eM9U8SA==} @@ -1727,7 +1796,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-R5s19SscS7CHoxvdYNMu2Y3WDwG4JjdhsejqjunDB1GqfzhtHSvL7b5XxCkUWqm2KRl35hI6kJ4HEaCDd/3BXg==} @@ -1737,7 +1805,6 @@ packages: dependencies: '@csstools/css-tokenizer': 2.2.0 postcss: 8.4.27 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-5LGLdu8cJgRPmvkjUNqOPKIKeHbyQmoGKooB5Rh0mp5mLaNI9bl+IjFZ2keY0cztZYsriJsGf6Lu8R5XetuwoQ==} @@ -1750,7 +1817,6 @@ packages: '@csstools/css-tokenizer': 2.2.0 '@csstools/media-query-list-parser': 2.1.4(@csstools/[email protected])(@csstools/[email protected]) postcss: 8.4.27 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-kQJR6NvTRidsaRjCdHGjra2+fLoFiDQOm5B2aZrhmXqng/hweXjruboKzB326rxQO2L0m0T+gCKbZgyuncyhLg==} @@ -1762,7 +1828,6 @@ packages: '@csstools/css-tokenizer': 2.2.0 '@csstools/media-query-list-parser': 2.1.4(@csstools/[email protected])(@csstools/[email protected]) postcss: 8.4.27 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-HsB66aDWAouOwD/GcfDTS0a7wCuVWaTpXcjl5VKP0XvFxDiU+r0T8FG7xgb6ovZNZ+qzvGIwRM+CLHhDgXrYgQ==} @@ -1772,7 +1837,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-6Nw55PRXEKEVqn3bzA8gRRPYxr5tf5PssvcE5DRA/nAxKgKtgNZMCHCSd1uxTCWeyLnkf6h5tYRSB0P1Vh/K/A==} @@ -1782,7 +1846,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-3TIz+dCPlQPzz4yAEYXchUpfuU2gRYK4u1J+1xatNX85Isg4V+IbLyppblWLV4Vb6npFF8qsHN17rNuxOIy/6w==} @@ -1795,7 +1858,6 @@ packages: '@csstools/css-tokenizer': 2.2.0 '@csstools/postcss-progressive-custom-properties': 3.0.0([email protected]) postcss: 8.4.27 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-Zd8ojyMlsL919TBExQ1I0CTpBDdyCpH/yOdqatZpuC3sd22K4SwC7+Yez3Q/vmXMWSAl+shjNeFZ7JMyxMjK+Q==} @@ -1805,7 +1867,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-2/D3CCL9DN2xhuUTP8OKvKnaqJ1j4yZUxuGLsCUOQ16wnDAuMLKLkflOmZF5tsPh/02VPeXRmqIN+U595WAulw==} @@ -1815,7 +1876,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-9B8br/7q0bjD1fV3yE22izjc7Oy5hDbDgwdFEz207cdJHYC9yQneJzP3H+/w3RgC7uyfEVhyyhkGRx5YAfJtmg==} @@ -1828,7 +1888,6 @@ packages: '@csstools/css-tokenizer': 2.2.0 '@csstools/postcss-progressive-custom-properties': 3.0.0([email protected]) postcss: 8.4.27 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-GFNVsD97OuEcfHmcT0/DAZWAvTM/FFBDQndIOLawNc1Wq8YqpZwBdHa063Lq+Irk7azygTT+Iinyg3Lt76p7rg==} @@ -1838,7 +1897,6 @@ packages: dependencies: postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-y1sykToXorFE+5cjtp//xAMWEAEple0kcZn2QhzEFIZDDNvGOCp5JvvmmPGsC3eDlj6yQp70l9uXZNLnimEYfA==} @@ -1850,7 +1908,6 @@ packages: '@csstools/css-parser-algorithms': 2.3.1(@csstools/[email protected]) '@csstools/css-tokenizer': 2.2.0 postcss: 8.4.27 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-BAa1MIMJmEZlJ+UkPrkyoz3DC7kLlIl2oDya5yXgvUrelpwxddgz8iMp69qBStdXwuMyfPx46oZcSNx8Z0T2eA==} @@ -1861,7 +1918,6 @@ packages: '@csstools/color-helpers': 3.0.0 postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-hW+JPv0MPQfWC1KARgvJI6bisEUFAZWSvUNq/khGCupYV/h6Z9R2ZFz0Xc633LXBst0ezbXpy7NpnPurSx5Klw==} @@ -1873,7 +1929,6 @@ packages: '@csstools/css-parser-algorithms': 2.3.1(@csstools/[email protected]) '@csstools/css-tokenizer': 2.2.0 postcss: 8.4.27 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-P0JD1WHh3avVyKKRKjd0dZIjCEeaBer8t1BbwGMUDtSZaLhXlLNBqZ8KkqHzYWXOJgHleXAny2/sx8LYl6qhEA==} @@ -1882,7 +1937,6 @@ packages: postcss: ^8.4 dependencies: postcss: 8.4.27 - dev: false /@csstools/[email protected]([email protected]): resolution: {integrity: sha512-hBI9tfBtuPIi885ZsZ32IMEU/5nlZH/KOVYJCOh7gyMxaVLGmLedYqFN6Ui1LXkI8JlC8IsuC0rF0btcRZKd5g==} @@ -1891,7 +1945,6 @@ packages: postcss-selector-parser: ^6.0.13 dependencies: postcss-selector-parser: 6.0.13 - dev: false /@date-io/[email protected]: resolution: {integrity: sha512-+EQE8xZhRM/hsY0CDTVyayMDDY5ihc4MqXCrPxooKw19yAzUIC6uUqsZeaOFNL9YKTNxYKrJP5DFgE8o5xRCOw==} @@ -3778,7 +3831,6 @@ packages: /@trysound/[email protected]: resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} engines: {node: '>=10.13.0'} - dev: false /@tsconfig/[email protected]: resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} @@ -3860,13 +3912,6 @@ packages: '@types/express': 4.17.17 dev: true - /@types/[email protected]: - resolution: {integrity: sha512-4x5FkPpLipqwthjPsF7ZRbOv3uoLUFkTA9G9v583qi4pACvq0uTELrB8OLUzPWUI4IJIyvM85vzkV1nyiI2Lig==} - dependencies: - '@types/express-serve-static-core': 4.17.35 - '@types/node': 20.5.6 - dev: true - /@types/[email protected]: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: @@ -3925,12 +3970,6 @@ packages: '@types/webpack': 4.41.33 dev: true - /@types/[email protected]: - resolution: {integrity: sha512-ImtIwnIEEMgyE7DK1JduhiDv+8WzfRWb3BPuf6RiBD1ySz05vyDRhGiKvIcuUPxUzMNBRZHN0pB+bWXSX3+t1w==} - dependencies: - '@types/webpack': 4.41.33 - dev: true - /@types/[email protected]: resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} dependencies: @@ -4063,7 +4102,7 @@ packages: /@types/[email protected](@swc/[email protected])([email protected]): resolution: {integrity: sha512-jyOSVaF4ie2jUGr1uohqeyDrp7ktRthdFxDKzTgbPZtl0QI5geEopW7UKD/DEfn0XgV1KEq/RnZlUmnrEAWbmg==} dependencies: - '@types/node': 20.5.6 + '@types/node': 20.5.7 tapable: 2.2.1 webpack: 5.88.2(@swc/[email protected])([email protected]) transitivePeerDependencies: @@ -4134,7 +4173,6 @@ packages: /@types/[email protected]: resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} - dev: false /@types/[email protected]: resolution: {integrity: sha512-unE2IivuYx6LUHlHokKMebx2TVi/YhqnnwM/Z3teGa/HTsRKgpD0PWrjpbw15ES8K8QNSCnRmXb/NpOyTem0tA==} @@ -4353,7 +4391,7 @@ packages: /@types/[email protected](@swc/[email protected])([email protected]): resolution: {integrity: sha512-XeQmQCCXdZdap+A/60UKmxW5Mz31Vp9uieGlHB3T4z/o2OLVLtTI3bvTuS6A2OWd/rbAAQiGGWIEFQACu16szA==} dependencies: - '@types/node': 20.5.6 + '@types/node': 20.5.7 tapable: 2.2.1 webpack: 5.88.2(@swc/[email protected])([email protected]) transitivePeerDependencies: @@ -4618,6 +4656,21 @@ packages: eslint-visitor-keys: 3.4.3 dev: false + /@vitejs/[email protected]([email protected]): + resolution: {integrity: sha512-7wU921ABnNYkETiMaZy7XqpueMnpu5VxvVps13MjmCo+utBdD79sZzrApHawHtVX66cCJQQTXFcjH0y9dSUK8g==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + vite: ^4.2.0 + dependencies: + '@babel/core': 7.22.11 + '@babel/plugin-transform-react-jsx-self': 7.22.5(@babel/[email protected]) + '@babel/plugin-transform-react-jsx-source': 7.22.5(@babel/[email protected]) + react-refresh: 0.14.0 + vite: 4.4.9(@types/[email protected]) + transitivePeerDependencies: + - supports-color + dev: false + /@webassemblyjs/[email protected]: resolution: {integrity: sha512-IN1xI7PwOvLPgjcf180gC1bqn3q/QaOCwYUahIOhbYUu8KA/3tw2RT/T0Gidi1l7Hhj5D/INhJxiICObqpMu4Q==} dependencies: @@ -4835,7 +4888,6 @@ packages: optional: true dependencies: ajv: 8.12.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==} @@ -4851,7 +4903,6 @@ packages: dependencies: ajv: 8.12.0 fast-deep-equal: 3.1.3 - dev: false /[email protected]: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} @@ -4868,7 +4919,6 @@ packages: json-schema-traverse: 1.0.0 require-from-string: 2.0.2 uri-js: 4.4.1 - dev: false /[email protected]: resolution: {integrity: sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==} @@ -5108,7 +5158,6 @@ packages: picocolors: 1.0.0 postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]: resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} @@ -5230,7 +5279,6 @@ packages: /[email protected]: resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==} - dev: false /[email protected]: resolution: {integrity: sha512-b6weQyEUKsDGFlACWSIOfveEnImkJyK/FGW6FAG42loyoquvjdtOIqO6yBFzHyqyVVhNgNkQxxx09SFLK28YnA==} @@ -5326,7 +5374,6 @@ packages: /[email protected]: resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} - dev: false /[email protected]: resolution: {integrity: sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==} @@ -5532,7 +5579,6 @@ packages: caniuse-lite: 1.0.30001523 lodash.memoize: 4.1.2 lodash.uniq: 4.5.0 - dev: false /[email protected]: resolution: {integrity: sha512-I5q5cisATTPZ1mc588Z//pj/Ox80ERYDfR71YnvY7raS/NOk8xXlZcB0sF7JdqaV//kOaa6aus7lRfpdnt1eBA==} @@ -5736,7 +5782,6 @@ packages: /[email protected]: resolution: {integrity: sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==} - dev: false /[email protected]: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} @@ -6054,7 +6099,6 @@ packages: parse-json: 5.2.0 path-type: 4.0.0 yaml: 1.10.2 - dev: false /[email protected]: resolution: {integrity: sha512-3rTMnFJA1tCOPwRxtgF4wd7Ab2qvDbL8jX+3smjIbS4HlZBagTlpERbdN7iAbWlrfxE3M8c27kTwTawQ7st+OQ==} @@ -6120,7 +6164,6 @@ packages: dependencies: postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-rtdthzxKuyq6IzqX6jEcIzQF/YqccluefyCYheovBOLhFT/drQA9zj/UbRAa9J7C0o6EG6u3E6g+vKkay7/k3g==} @@ -6129,7 +6172,6 @@ packages: postcss: ^8.0.9 dependencies: postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-X+r+JBuoO37FBOWVNhVJhxtSBUFHgHbrcc0CjFT28JEdOw1qaDwABv/uunyodUuSy2hMPe9j/HjssxSlvUmKjg==} @@ -6141,7 +6183,6 @@ packages: postcss: 8.4.27 postcss-selector-parser: 6.0.13 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-Q7mOvpBNBG7YrVGMxRxcBJZFL75o+cH2abNASdibkj/fffYD8qWbInZrD0S9ccI6vZclF3DsHE7njGlLtaHbhg==} @@ -6160,7 +6201,7 @@ packages: schema-utils: 3.3.0 semver: 7.5.4 webpack: 5.88.2(@swc/[email protected])([email protected]) - dev: false + dev: true /[email protected]([email protected]): resolution: {integrity: sha512-3caImjKFQkS+ws1TGcFn0V1HyDJFq1Euy589JlD6/3rV2kj+w7r5G9WDMgSHvpvXHNZ2calVypZWuEDQd9wfLg==} @@ -6194,7 +6235,6 @@ packages: schema-utils: 4.2.0 serialize-javascript: 6.0.1 webpack: 5.88.2(@swc/[email protected])([email protected]) - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-03QGAk/FXIRseDdLb7XAiu6gidQ0Nd8945xuM7VFVPpc6goJsG9uIO8xQjTxwbPdPIIV4o4AJoOJyt8gwDl67g==} @@ -6203,7 +6243,6 @@ packages: postcss: ^8.4 dependencies: postcss: 8.4.27 - dev: false /[email protected]: resolution: {integrity: sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==} @@ -6223,7 +6262,6 @@ packages: domhandler: 5.0.3 domutils: 3.1.0 nth-check: 2.1.1 - dev: false /[email protected]: resolution: {integrity: sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==} @@ -6231,7 +6269,6 @@ packages: dependencies: mdn-data: 2.0.28 source-map-js: 1.0.2 - dev: false /[email protected]: resolution: {integrity: sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==} @@ -6239,12 +6276,10 @@ packages: dependencies: mdn-data: 2.0.30 source-map-js: 1.0.2 - dev: false /[email protected]: resolution: {integrity: sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==} engines: {node: '>= 6'} - dev: false /[email protected]: resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==} @@ -6252,13 +6287,11 @@ packages: /[email protected]: resolution: {integrity: sha512-kM+Fs0BFyhJNeE6wbOrlnRsugRdL6vn7QcON0aBDZ7XRd7RI2pMlk+nxoHuTb4Et+aBobXgK0I+6NGLA0LLgTw==} - dev: false /[email protected]: resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} engines: {node: '>=4'} hasBin: true - dev: false /[email protected]: resolution: {integrity: sha512-FAaLDaplstoRsDR8XGYH51znUN0UY7nMc6Z9/fvE8EXGwvJE9hu7W2vHwx1+bd6gCYnln9nLbzxFTrcO9YQDZw==} @@ -6300,7 +6333,6 @@ packages: postcss-reduce-transforms: 6.0.0([email protected]) postcss-svgo: 6.0.0([email protected]) postcss-unique-selectors: 6.0.0([email protected]) - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-Z39TLP+1E0KUcd7LGyF4qMfu8ZufI0rDzhdyAMsa/8UyNUU8wpS0fhdBxbQbv32r64ea00h4878gommRVg2BHw==} @@ -6309,7 +6341,6 @@ packages: postcss: ^8.2.15 dependencies: postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-fVO1JdJ0LSdIGJq68eIxOqFpIJrZqXUsBt8fkrBcztCQqAjQD51OhZp7tc0ImcbwXD4k7ny84QTV90nZhmqbkg==} @@ -6320,14 +6351,12 @@ packages: cssnano-preset-default: 6.0.1([email protected]) lilconfig: 2.1.0 postcss: 8.4.27 - dev: false /[email protected]: resolution: {integrity: sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==} engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0, npm: '>=7.0.0'} dependencies: css-tree: 2.2.1 - dev: false /[email protected]: resolution: {integrity: sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==} @@ -6668,11 +6697,9 @@ packages: domelementtype: 2.3.0 domhandler: 5.0.3 entities: 4.5.0 - dev: false /[email protected]: resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} - dev: false /[email protected]: resolution: {integrity: sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==} @@ -6693,7 +6720,6 @@ packages: engines: {node: '>= 4'} dependencies: domelementtype: 2.3.0 - dev: false /[email protected]: resolution: {integrity: sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==} @@ -6709,7 +6735,6 @@ packages: dom-serializer: 2.0.0 domelementtype: 2.3.0 domhandler: 5.0.3 - dev: false /[email protected]: resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==} @@ -6863,7 +6888,6 @@ packages: /[email protected]: resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==} engines: {node: '>= 4'} - dev: false /[email protected]: resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} @@ -7799,7 +7823,6 @@ packages: loader-utils: 2.0.4 schema-utils: 3.3.0 webpack: 5.88.2(@swc/[email protected])([email protected]) - dev: false /[email protected]: resolution: {integrity: sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==} @@ -7969,7 +7992,6 @@ packages: /[email protected]: resolution: {integrity: sha512-/KxoyCnPM0GwYI4NN0Iag38Tqt+od3/mLuguepLgCAKPn0ZhC544nssAW0tG2/00zXEYl9W+7hwAIpLHo6Oc7Q==} - dev: false /[email protected]: resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} @@ -8689,7 +8711,7 @@ packages: postcss: ^8.1.0 dependencies: postcss: 8.4.27 - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} @@ -8708,7 +8730,6 @@ packages: /[email protected]: resolution: {integrity: sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA==} - dev: false /[email protected]: resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} @@ -9767,7 +9788,6 @@ packages: /[email protected]: resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} - dev: false /[email protected]: resolution: {integrity: sha512-7DE8mpG+/fVw+dTpjbxnx47TaMnDfOI1jwft9g1VybltZCduyRQPJPvc+zzKY9WPHxhPWczyFuYa6I8Mw4iU5A==} @@ -9876,7 +9896,6 @@ packages: /[email protected]: resolution: {integrity: sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA==} engines: {node: '>= 8'} - dev: false /[email protected]: resolution: {integrity: sha512-tN0MCzyWnoz/4nHS6uxdlFWoUZT7ABptwKPQ52Ea7URk6vll88bWBVhodtnlfEuCcKWNGoc+uGbw1cwa9IKh/w==} @@ -9910,7 +9929,6 @@ packages: /[email protected]: resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} engines: {node: '>=10'} - dev: false /[email protected]: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} @@ -9936,7 +9954,6 @@ packages: big.js: 5.2.2 emojis-list: 3.0.0 json5: 2.2.3 - dev: false /[email protected]: resolution: {integrity: sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==} @@ -9996,7 +10013,6 @@ packages: /[email protected]: resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==} - dev: false /[email protected]: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} @@ -10008,7 +10024,6 @@ packages: /[email protected]: resolution: {integrity: sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==} - dev: false /[email protected]: resolution: {integrity: sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww==} @@ -10094,6 +10109,13 @@ packages: engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dev: true + /[email protected]: + resolution: {integrity: sha512-B7xGbll2fG/VjP+SWg4sX3JynwIU0mjoTc6MPpKNuIvftk6u6vqhDnk1R80b8C2GBR6ywqy+1DcKBrevBg+bmw==} + engines: {node: '>=12'} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + dev: false + /[email protected]: resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} engines: {node: '>=8'} @@ -10141,11 +10163,9 @@ packages: /[email protected]: resolution: {integrity: sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==} - dev: false /[email protected]: resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==} - dev: false /[email protected]: resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} @@ -10292,7 +10312,6 @@ packages: schema-utils: 3.3.0 webpack: 5.88.2(@swc/[email protected])([email protected]) webpack-sources: 1.4.3 - dev: false /[email protected]: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} @@ -10483,7 +10502,6 @@ packages: resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - dev: false /[email protected]: resolution: {integrity: sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==} @@ -10649,7 +10667,6 @@ packages: /[email protected]: resolution: {integrity: sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==} engines: {node: '>=0.10.0'} - dev: false /[email protected]: resolution: {integrity: sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==} @@ -10685,7 +10702,6 @@ packages: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} dependencies: boolbase: 1.0.0 - dev: false /[email protected]: resolution: {integrity: sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==} @@ -11336,7 +11352,6 @@ packages: dependencies: postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-TipgjGyzP5QzEhsOZUaIkeO5mKeMFpebWzRogWG/ysonUlnHcq5aJe0jOjpfzUU8PeSaBQnrE8ehR0QA5vs8PQ==} @@ -11347,7 +11362,6 @@ packages: postcss: 8.4.27 postcss-selector-parser: 6.0.13 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-ry4b1Llo/9zz+PKC+030KUnPITTJAHeOwjfAyyB60eT0AorGLdzp52s31OsPRHRf8NchkgFoG2y6fCfn1IV1Ow==} @@ -11357,7 +11371,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-kaWTgnhRKFtfMF8H0+NQBFxgr5CGg05WGe07Mc1ld6XHwwRWlqSbHOW0zwf+BtkBQpsdVUu7+gl9dtdvhWMedw==} @@ -11368,7 +11381,6 @@ packages: '@csstools/postcss-progressive-custom-properties': 3.0.0([email protected]) postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-SfPjgr//VQ/DOCf80STIAsdAs7sbIbxATvVmd+Ec7JvR8onz9pjawhq3BJM3Pie40EE3TyB0P6hft16D33Nlyg==} @@ -11378,7 +11390,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-RmUFL+foS05AKglkEoqfx+KFdKRVmqUAxlHNz4jLqIi7046drIPyerdl4B6j/RA2BSP8FI8gJcHmLRrwJOMnHw==} @@ -11388,7 +11399,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-EuO+bAUmutWoZYgHn2T1dG1pPqHU6L4TjzPlu4t1wZGXQ/fxV16xg2EJmYi0z+6r+MGV1yvpx1BHkUaRrPa2bw==} @@ -11401,7 +11411,6 @@ packages: colord: 2.9.3 postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-U5D8QhVwqT++ecmy8rnTb+RL9n/B806UVaS3m60lqle4YDFcpbS3ae5bTQIh3wOGUSDHSEtMYLs/38dNG7EYFw==} @@ -11412,7 +11421,6 @@ packages: browserslist: 4.21.10 postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-NxDn7C6GJ7X8TsWOa8MbCdq9rLERRLcPfQSp856k1jzMreL8X9M6iWk35JjPRIb9IfRnVohmxAylDRx7n4Rv4g==} @@ -11425,7 +11433,6 @@ packages: '@csstools/css-tokenizer': 2.2.0 '@csstools/media-query-list-parser': 2.1.4(@csstools/[email protected])(@csstools/[email protected]) postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-q4VgtIKSy5+KcUvQ0WxTjDy9DZjQ5VCXAZ9+tT9+aPMbA0z6s2t1nMw0QHszru1ib5ElkXl9JUpYYU37VVUs7g==} @@ -11438,7 +11445,6 @@ packages: '@csstools/css-tokenizer': 2.2.0 postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-TU2xyUUBTlpiLnwyE2ZYMUIYB41MKMkBZ8X8ntkqRDQ8sdBLhFFsPgNcOliBd5+/zcK51C9hRnSE7hKUJMxQSw==} @@ -11451,7 +11457,6 @@ packages: '@csstools/css-tokenizer': 2.2.0 postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-Oy5BBi0dWPwij/IA+yDYj+/OBMQ9EPqAzTHeSNUYrUWdll/PRJmcbiUj0MNcsBi681I1gcSTLvMERPaXzdbvJg==} @@ -11461,7 +11466,6 @@ packages: dependencies: postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-p2skSGqzPMZkEQvJsgnkBhCn8gI7NzRH2683EEjrIkoMiwRELx68yoUJ3q3DGSGuQ8Ug9Gsn+OuDr46yfO+eFw==} @@ -11470,7 +11474,6 @@ packages: postcss: ^8.2.15 dependencies: postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-bU1SXIizMLtDW4oSsi5C/xHKbhLlhek/0/yCnoMQany9k3nPBq+Ctsv/9oMmyqbR96HYHxZcHyK2HR5P/mqoGA==} @@ -11479,7 +11482,6 @@ packages: postcss: ^8.2.15 dependencies: postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-b+h1S1VT6dNhpcg+LpyiUrdnEZfICF0my7HAKgJixJLW7BnNmpRH34+uw/etf5AhOlIhIAuXApSzzDzMI9K/gQ==} @@ -11488,7 +11490,6 @@ packages: postcss: ^8.2.15 dependencies: postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-4VELwssYXDFigPYAZ8vL4yX4mUepF/oCBeeIT4OXsJPYOtvJumyz9WflmJWTfDwCUcpDR+z0zvCWBXgTx35SVw==} @@ -11497,7 +11498,6 @@ packages: postcss: ^8.2.15 dependencies: postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-wR8npIkrIVUTicUpCWSSo1f/g7gAEIH70FMqCugY4m4j6TX4E0T2Q5rhfO0gqv00biBZdLyb+HkW8x6as+iJNQ==} @@ -11508,7 +11508,6 @@ packages: '@csstools/postcss-progressive-custom-properties': 3.0.0([email protected]) postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-zA4TbVaIaT8npZBEROhZmlc+GBKE8AELPHXE7i4TmIUEQhw/P/mSJfY9t6tBzpQ1rABeGtEOHYrW4SboQeONMQ==} @@ -11518,7 +11517,6 @@ packages: dependencies: postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-E7+J9nuQzZaA37D/MUZMX1K817RZGDab8qw6pFwzAkDd/QtlWJ9/WTKmzewNiuxzeq6WWY7ATiRePVoDKp+DnA==} @@ -11528,7 +11526,6 @@ packages: dependencies: postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-1fmkBaCALD72CK2a9i468mA/+tr9/1cBxRRMXOUaZqO43oWPR5imcyPjXwuv7PXbCid4ndlP5zWhidQVVa3hmA==} @@ -11536,7 +11533,6 @@ packages: postcss: ^8.1.0 dependencies: postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-YjsEEL6890P7MCv6fch6Am1yq0EhQCJMXyT4LBohiu87+4/WqR7y5W3RIv53WdA901hhytgRvjlrAhibhW4qsA==} @@ -11545,7 +11541,6 @@ packages: postcss: ^8.4 dependencies: postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-bg58QnJexFpPBU4IGPAugAPKV0FuFtX5rHYNSKVaV91TpHN7iwyEzz1bkIPCiSU5+BUN00e+3fV5KFrwIgRocw==} @@ -11555,7 +11550,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-0ueD7rPqX8Pn1xJIjay0AZeIuDoF+V+VvMt/uOnn+4ezUKhZM/NokDeP6DwMNyIoYByuN/94IQnt5FEkaN59xQ==} @@ -11563,7 +11557,6 @@ packages: postcss: ^8.0.0 dependencies: postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-/Xl6JitDh7jWkcOLxrHcAlEaqkxyaG3g4iDMy5RyhNaiQPJ9Egf2+Mxp1W2qnH5jB2bj59f3RbdKmC6qx1IcXA==} @@ -11576,7 +11569,6 @@ packages: '@csstools/css-tokenizer': 2.2.0 '@csstools/postcss-progressive-custom-properties': 3.0.0([email protected]) postcss: 8.4.27 - dev: false /[email protected]([email protected])([email protected]): resolution: {integrity: sha512-WbbYpmAaKcux/P66bZ40bpWsBucjx/TTgVVzRZ9yUO8yQfVBlameJ0ZGVaPfH64hNSBh63a+ICP5nqOpBA0w+Q==} @@ -11590,7 +11582,6 @@ packages: postcss: 8.4.27 semver: 7.5.4 webpack: 5.88.2(@swc/[email protected])([email protected]) - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-zYf3vHkoW82f5UZTEXChTJvH49Yl9X37axTZsJGxrCG2kOUwtaAoz9E7tqYg0lsIoJLybaL8fk/2mOi81zVIUw==} @@ -11600,7 +11591,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-4VSfd1lvGkLTLYcxFuISDtWUfFS4zXe0FpF149AyziftPFQIWxjvFSKhA4MIxMe4XM3yTDgQMbSNgzIVxChbIg==} @@ -11611,7 +11601,6 @@ packages: postcss: 8.4.27 postcss-value-parser: 4.2.0 stylehacks: 6.0.0([email protected]) - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-a4tlmJIQo9SCjcfiCcCMg/ZCEe0XTkl/xK0XHBs955GWg9xDX3NwP9pwZ78QUOWB8/0XCjZeJn98Dae0zg6AAw==} @@ -11624,7 +11613,6 @@ packages: cssnano-utils: 4.0.0([email protected]) postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-zNRAVtyh5E8ndZEYXA4WS8ZYsAp798HiIQ1V2UF/C/munLp2r1UGHwf1+6JFu7hdEhJFN+W1WJQKBrtjhFgEnA==} @@ -11634,7 +11622,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-wO0F6YfVAR+K1xVxF53ueZJza3L+R3E6cp0VwuXJQejnNUH0DjcAFe3JEBeTY1dLwGa0NlDWueCA1VlEfiKgAA==} @@ -11646,7 +11633,6 @@ packages: cssnano-utils: 4.0.0([email protected]) postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-Fz/wMQDveiS0n5JPcvsMeyNXOIMrwF88n7196puSuQSWSa+/Ofc1gDOSY2xi8+A4PqB5dlYCKk/WfqKqsI+ReQ==} @@ -11658,7 +11644,6 @@ packages: cssnano-utils: 4.0.0([email protected]) postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-ec/q9JNCOC2CRDNnypipGfOhbYPuUkewGwLnbv6omue/PSASbHSU7s6uSQ0tcFRVv731oMIx8k0SP4ZX6be/0g==} @@ -11668,7 +11653,6 @@ packages: dependencies: postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==} @@ -11677,7 +11661,7 @@ packages: postcss: ^8.1.0 dependencies: postcss: 8.4.27 - dev: false + dev: true /[email protected]([email protected]): resolution: {integrity: sha512-2/u2zraspoACtrbFRnTijMiQtb4GW4BvatjaG/bCjYQo8kLTdevCUlwuBHx2sCnSyrI3x3qj4ZK1j5LQBgzmwA==} @@ -11689,7 +11673,7 @@ packages: postcss: 8.4.27 postcss-selector-parser: 6.0.13 postcss-value-parser: 4.2.0 - dev: false + dev: true /[email protected]([email protected]): resolution: {integrity: sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==} @@ -11699,7 +11683,7 @@ packages: dependencies: postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false + dev: true /[email protected]([email protected]): resolution: {integrity: sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==} @@ -11709,7 +11693,7 @@ packages: dependencies: icss-utils: 5.1.0([email protected]) postcss: 8.4.27 - dev: false + dev: true /[email protected]([email protected]): resolution: {integrity: sha512-6LCqCWP9pqwXw/njMvNK0hGY44Fxc4B2EsGbn6xDcxbNRzP8GYoxT7yabVVMLrX3quqOJ9hg2jYMsnkedOf8pA==} @@ -11720,7 +11704,6 @@ packages: '@csstools/selector-specificity': 3.0.0([email protected]) postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-cqundwChbu8yO/gSWkuFDmKrCZ2vJzDAocheT2JTd0sFNA4HMGoKMfbk2B+J0OmO0t5GUkiAkSM5yF2rSLUjgQ==} @@ -11729,7 +11712,6 @@ packages: postcss: ^8.2.15 dependencies: postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-Qyt5kMrvy7dJRO3OjF7zkotGfuYALETZE+4lk66sziWSPzlBEt7FrUshV6VLECkI4EN8Z863O6Nci4NXQGNzYw==} @@ -11739,7 +11721,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-mPCzhSV8+30FZyWhxi6UoVRYd3ZBJgTRly4hOkaSifo0H+pjDYcii/aVT4YE6QpOil15a5uiv6ftnY3rm0igPg==} @@ -11749,7 +11730,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-50W5JWEBiOOAez2AKBh4kRFm2uhrT3O1Uwdxz7k24aKtbD83vqmcVG7zoIwo6xI2FZ/HDlbrCopXhLeTpQib1A==} @@ -11759,7 +11739,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-KWkIB7TrPOiqb8ZZz6homet2KWKJwIlysF5ICPZrXAylGe2hzX/HSf4NTX2rRPJMAtlRsj/yfkrWGavFuB+c0w==} @@ -11769,7 +11748,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-tpIXWciXBp5CiFs8sem90IWlw76FV4oi6QEWfQwyeREVwUy39VSeSqjAT7X0Qw650yAimYW5gkl2Gd871N5SQg==} @@ -11779,7 +11757,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-ui5crYkb5ubEUDugDc786L/Me+DXp2dLg3fVJbqyAl0VPkAeALyAijF2zOsnZyaS1HyfPuMH0DwyY18VMFVNkg==} @@ -11790,7 +11767,6 @@ packages: browserslist: 4.21.10 postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-98mvh2QzIPbb02YDIrYvAg4OUzGH7s1ZgHlD3fIdTHLgPLRpv1ZTKJDnSAKr4Rt21ZQFzwhGMXxpXlfrUBKFHw==} @@ -11800,7 +11776,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-7cfE1AyLiK0+ZBG6FmLziJzqQCpTQY+8XjMhMAz8WSBSCsCNNUKujgIgjCAmDT3cJ+3zjTXFkoD15ZPsckArVw==} @@ -11810,7 +11785,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-lyDrCOtntq5Y1JZpBFzIWm2wG9kbEdujpNt4NLannF+J9c8CgFIzPa80YQfdza+Y+yFfzbYj/rfoOsYsooUWTQ==} @@ -11819,7 +11793,6 @@ packages: postcss: ^8.2 dependencies: postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-K36XzUDpvfG/nWkjs6d1hRBydeIxGpKS2+n+ywlKPzx1nMYDYpoGbcjhj5AwVYJK1qV2/SDoDEnHzlPD6s3nMg==} @@ -11830,7 +11803,6 @@ packages: cssnano-utils: 4.0.0([email protected]) postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-2rlxDyeSics/hC2FuMdPnWiP9WUPZ5x7FTuArXLFVpaSQ2woPSfZS4RD59HuEokbZhs/wPUQJ1E3MT6zVv94MQ==} @@ -11840,7 +11812,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-1JGu8oCjVXLa9q9rFTo4MbeeA5FMe00/9C7lN4va606Rdb+HkxXtXsmEDrIraQ11fGz/WvKWa8gMuCKkrXpTsQ==} @@ -11848,7 +11819,6 @@ packages: postcss: ^8 dependencies: postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-qLEPD9VPH5opDVemwmRaujODF9nExn24VOC3ghgVLEvfYN7VZLwJHes0q/C9YR5hI2UC3VgBE8Wkdp1TxCXhtg==} @@ -11858,7 +11828,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-L0x/Nluq+/FkidIYjU7JtkmRL2/QmXuYkxuM3C5y9VG3iGLljF9PuBHQ7kzKRoVfwnca0VNN0Zb3a/bxVJ12vA==} @@ -11923,7 +11892,6 @@ packages: postcss-replace-overflow-wrap: 4.0.0([email protected]) postcss-selector-not: 7.0.1([email protected]) postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-QNCYIL98VKFKY6HGDEJpF6+K/sg9bxcUYnOmNHJxZS5wsFDFaVoPeG68WAuhsqwbIBSo/b9fjEnTwY2mTSD+uA==} @@ -11933,7 +11901,6 @@ packages: dependencies: postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-s2UOnidpVuXu6JiiI5U+fV2jamAw5YNA9Fdi/GRK0zLDLCfXmSGqQtzpUPtfN66RtCbb9fFHoyZdQaxOB3WxVA==} @@ -11944,7 +11911,6 @@ packages: browserslist: 4.21.10 caniuse-api: 3.0.0 postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-FQ9f6xM1homnuy1wLe9lP1wujzxnwt1EwiigtWwuyf8FsqqXUDUp2Ulxf9A5yjlUOTdCJO6lonYjg1mgqIIi2w==} @@ -11954,7 +11920,6 @@ packages: dependencies: postcss: 8.4.27 postcss-value-parser: 4.2.0 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-KmF7SBPphT4gPPcKZc7aDkweHiKEEO8cla/GjcBK+ckKxiZslIu3C4GCRW3DNfL0o7yW7kMQu9xlZ1kXRXLXtw==} @@ -11962,7 +11927,6 @@ packages: postcss: ^8.0.3 dependencies: postcss: 8.4.27 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-1zT5C27b/zeJhchN7fP0kBr16Cc61mu7Si9uWWLoA3Px/D9tIJPKchJCkUH3tPO5D0pCFmGeApAv8XpXBQJ8SQ==} @@ -11972,7 +11936,6 @@ packages: dependencies: postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /[email protected]: resolution: {integrity: sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ==} @@ -11980,7 +11943,6 @@ packages: dependencies: cssesc: 3.0.0 util-deprecate: 1.0.2 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-r9zvj/wGAoAIodn84dR/kFqwhINp5YsJkLoujybWG59grR/IHx+uQ2Zo+IcOwM0jskfYX3R0mo+1Kip1VSNcvw==} @@ -11991,7 +11953,6 @@ packages: postcss: 8.4.27 postcss-value-parser: 4.2.0 svgo: 3.0.2 - dev: false /[email protected]([email protected]): resolution: {integrity: sha512-EPQzpZNxOxP7777t73RQpZE5e9TrnCrkvp7AH7a0l89JmZiPnS82y216JowHXwpBCQitfyxrof9TK3rYbi7/Yw==} @@ -12001,11 +11962,9 @@ packages: dependencies: postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /[email protected]: resolution: {integrity: sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==} - dev: false /[email protected]: resolution: {integrity: sha512-gY/ACJtJPSmUFPDCHtX78+01fHa64FaU4zaaWfuh1MhGJISufJAH4cun6k/8fwsHYeK4UQmENQK+tRLCFJE8JQ==} @@ -12014,7 +11973,6 @@ packages: nanoid: 3.3.6 picocolors: 1.0.0 source-map-js: 1.0.2 - dev: false /[email protected]: resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} @@ -12441,6 +12399,11 @@ packages: react-fast-compare: 3.2.2 warning: 4.0.3 + /[email protected]: + resolution: {integrity: sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==} + engines: {node: '>=0.10.0'} + dev: false + /[email protected]([email protected]): resolution: {integrity: sha512-m4EqFMHv/Ih4kpcBCONHbkT68KoAeHN4p3lAGoNryfHi0dMy0kCzEZakiKRsvg5wHZ/JLrLW8o8KomWiz/qbYQ==} peerDependencies: @@ -12773,7 +12736,6 @@ packages: /[email protected]: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} engines: {node: '>=0.10.0'} - dev: false /[email protected]: resolution: {integrity: sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==} @@ -12875,6 +12837,14 @@ packages: dependencies: glob: 7.2.3 + /[email protected]: + resolution: {integrity: sha512-c+ebvQz0VIH4KhhCpDsI+Bik0eT8ZFEVZEYw0cGMVqIP8zc+gnwl7iXCamTw7vzv2MeuZFZfdx5JJIq+ehzDlg==} + engines: {node: '>=14.18.0', npm: '>=8.0.0'} + hasBin: true + optionalDependencies: + fsevents: 2.3.3 + dev: false + /[email protected]: resolution: {integrity: sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==} engines: {node: '>=12'} @@ -12965,7 +12935,7 @@ packages: neo-async: 2.6.2 sass: 1.64.0 webpack: 5.88.2(@swc/[email protected])([email protected]) - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-m7YtAGmQta9uANIUJwXesAJMSncqH+3INc8kdVXs6eV6GUC8Qu2IYKQSN8PRLgiQfpca697G94klm2leYMxSHw==} @@ -12975,7 +12945,6 @@ packages: chokidar: 3.5.3 immutable: 4.3.4 source-map-js: 1.0.2 - dev: false /[email protected]: resolution: {integrity: sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==} @@ -13009,7 +12978,6 @@ packages: ajv: 8.12.0 ajv-formats: 2.1.1([email protected]) ajv-keywords: 5.1.0([email protected]) - dev: false /[email protected]: resolution: {integrity: sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==} @@ -13319,12 +13287,10 @@ packages: /[email protected]: resolution: {integrity: sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==} - dev: false /[email protected]: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} - dev: false /[email protected]: resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==} @@ -13611,7 +13577,6 @@ packages: browserslist: 4.21.10 postcss: 8.4.27 postcss-selector-parser: 6.0.13 - dev: false /[email protected]: resolution: {integrity: sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==} @@ -13650,7 +13615,6 @@ packages: css-tree: 2.3.1 csso: 5.0.5 picocolors: 1.0.0 - dev: false /[email protected](@swc/[email protected])([email protected]): resolution: {integrity: sha512-D1p6XXURfSPleZZA/Lipb3A8pZ17fP4NObZvFCDjK/OKljroqDpPmsBdTraWhVBqUNpcWBQY1imWdoPScRlQ7A==} @@ -13660,7 +13624,6 @@ packages: dependencies: '@swc/core': 1.3.76 webpack: 5.88.2(@swc/[email protected])([email protected]) - dev: false /[email protected](@swc/[email protected])([email protected]): resolution: {integrity: sha512-/9ud/libNWUC5p71vXWhW/O2Nc0essW8D9pY4P4ol0ceM8OcFbNr41R9YFqTkmktqUL2t0WwXau+FkR4T1+PJA==} @@ -14268,7 +14231,6 @@ packages: mime-types: 2.1.35 schema-utils: 3.3.0 webpack: 5.88.2(@swc/[email protected])([email protected]) - dev: false /[email protected]: resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} @@ -14357,6 +14319,68 @@ packages: resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} engines: {node: '>= 0.8'} + /[email protected]: + resolution: {integrity: sha512-UJlvuioutS7Tno3p3Dqxkr0G4xXt8ILYsJzOiyvFlEsyAxFRofsBGHN/Sl15q0Y4vtvvC7+QZCc6GuUxOM6Cmg==} + dependencies: + acorn: 8.10.0 + fast-glob: 3.3.1 + magic-string: 0.30.3 + vite-plugin-dynamic-import: 1.5.0 + dev: false + + /[email protected]: + resolution: {integrity: sha512-Qp85c+AVJmLa8MLni74U4BDiWpUeFNx7NJqbGZyR2XJOU7mgW0cb7nwlAMucFyM4arEd92Nfxp4j44xPi6Fu7g==} + dependencies: + acorn: 8.10.0 + es-module-lexer: 1.3.0 + fast-glob: 3.3.1 + magic-string: 0.30.3 + dev: false + + /[email protected]([email protected]): + resolution: {integrity: sha512-mUzoGq08YHyx7dW4WyZeNb1GPJIEEDrcjuDNiLP0om0g05/ODgjl8BQeZlH2iWJWVu1izLWfQHcpPMcMSaWnRg==} + peerDependencies: + vite: ^2.0.0 || ^3.0.0 || ^4.0.0 + dependencies: + vite: 4.4.9(@types/[email protected]) + dev: false + + /[email protected](@types/[email protected]): + resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==} + engines: {node: ^14.18.0 || >=16.0.0} + hasBin: true + peerDependencies: + '@types/node': '>= 14' + less: '*' + lightningcss: ^1.21.0 + sass: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + dependencies: + '@types/node': 20.5.7 + esbuild: 0.18.20 + postcss: 8.4.27 + rollup: 3.29.1 + optionalDependencies: + fsevents: 2.3.3 + dev: false + /[email protected]: resolution: {integrity: sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==} engines: {node: '>=0.10.0'} @@ -14492,7 +14516,6 @@ packages: dependencies: source-list-map: 2.0.1 source-map: 0.6.1 - dev: false /[email protected]: resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==} @@ -14763,7 +14786,6 @@ packages: /[email protected]: resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} engines: {node: '>= 6'} - dev: false /[email protected]: resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} diff --git a/test/buildConfigWithDefaults.ts b/test/buildConfigWithDefaults.ts index f15685c418e..6e599a62092 100644 --- a/test/buildConfigWithDefaults.ts +++ b/test/buildConfigWithDefaults.ts @@ -2,6 +2,7 @@ import path from 'path' import type { Config, SanitizedConfig } from '../packages/payload/src/config/types' +import webpackBundler from '../packages/bundler-webpack/src/bundler' import { mongooseAdapter } from '../packages/db-mongodb/src/index' import { postgresAdapter } from '../packages/db-postgres/src/index' import { buildConfig as buildPayloadConfig } from '../packages/payload/src/config/build' @@ -39,6 +40,7 @@ export function buildConfigWithDefaults(testConfig?: Partial<Config>): Promise<S password: 'test', }, ...(config.admin || {}), + bundler: webpackBundler(), webpack: (webpackConfig) => { const existingConfig = typeof testConfig?.admin?.webpack === 'function' @@ -46,6 +48,13 @@ export function buildConfigWithDefaults(testConfig?: Partial<Config>): Promise<S : webpackConfig return { ...existingConfig, + resolveLoader: { + ...(existingConfig.resolveLoader || {}), + modules: [ + ...(existingConfig?.resolveLoader?.modules || []), + path.resolve(__dirname, '../packages/payload/node_modules'), + ], + }, name, cache: process.env.NODE_ENV === 'test' ? { type: 'memory' } : existingConfig.cache, resolve: {
985eb5989330da60ff47a6dad65c0ef82261f12e
2023-02-21 20:37:11
Dan Ribbens
chore(release): v1.6.14
false
v1.6.14
chore
diff --git a/CHANGELOG.md b/CHANGELOG.md index ebe659aac62..4a255a7c22f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ +## [1.6.14](https://github.com/payloadcms/payload/compare/v1.6.13...v1.6.14) (2023-02-21) + + +### Bug Fixes + +* [#2091](https://github.com/payloadcms/payload/issues/2091) admin translations for filter operators ([#2143](https://github.com/payloadcms/payload/issues/2143)) ([8a8c392](https://github.com/payloadcms/payload/commit/8a8c3920950ece5995f81bff717b30a2baf8f219)) +* [#2096](https://github.com/payloadcms/payload/issues/2096), allows custom ts paths with payload generate:types ([686a616](https://github.com/payloadcms/payload/commit/686a616b4cf06685fd22b075cf87ceafec455e40)) +* [#2117](https://github.com/payloadcms/payload/issues/2117) collection pagination defaultLimit ([#2147](https://github.com/payloadcms/payload/issues/2147)) ([2a4db38](https://github.com/payloadcms/payload/commit/2a4db3896ead2b49c0a7ebc5da6b9825b223ca19)) +* [#2131](https://github.com/payloadcms/payload/issues/2131), doesn't log in unverified user after resetting password ([3eb85b1](https://github.com/payloadcms/payload/commit/3eb85b1554ceb705c4a1436af4d9ba982e4cdbdf)) +* [#2134](https://github.com/payloadcms/payload/issues/2134), allows links to be populated without having relationship or upload enabled ([32a0778](https://github.com/payloadcms/payload/commit/32a0778fc4311509699b14f9a3f145380ec56e25)) +* [#2148](https://github.com/payloadcms/payload/issues/2148), adds queryHiddenFields property to find operation ([15b6bb3](https://github.com/payloadcms/payload/commit/15b6bb3d756697428775df5ece3c6092d0537d82)) +* checks locale is valid for monaco code editor ([#2144](https://github.com/payloadcms/payload/issues/2144)) ([40224ed](https://github.com/payloadcms/payload/commit/40224ed1bcd886be8bf2f5b42a272db7615495c1)) +* generate proper json field type according to rfc ([#2137](https://github.com/payloadcms/payload/issues/2137)) ([7e88698](https://github.com/payloadcms/payload/commit/7e8869858cfca70b2e996d984e065da75398076b)) +* removes custom header and gutter from rte link drawer [#2120](https://github.com/payloadcms/payload/issues/2120) ([#2135](https://github.com/payloadcms/payload/issues/2135)) ([6a7663b](https://github.com/payloadcms/payload/commit/6a7663beb57f624ea52d95a8f26345dcd32d65bc)) +* sizes property optional on upload ([#2066](https://github.com/payloadcms/payload/issues/2066)) ([79d047e](https://github.com/payloadcms/payload/commit/79d047e64fd40507abf9de2ced5dab7aeb2bb6fa)) +* useFacet config option to disable $facet aggregation ([#2141](https://github.com/payloadcms/payload/issues/2141)) ([b4a2074](https://github.com/payloadcms/payload/commit/b4a20741b2d995e5e46875c2ae1f11ff5b319e6b)) + ## [1.6.13](https://github.com/payloadcms/payload/compare/v1.6.12...v1.6.13) (2023-02-18) diff --git a/package.json b/package.json index 8868a806341..568bbc63ae5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload", - "version": "1.6.13", + "version": "1.6.14", "description": "Node, React and MongoDB Headless CMS and Application Framework", "license": "MIT", "engines": {
7720f452d3eb52cff42e243a1a59b17e95bb2450
2023-02-02 01:47:48
Elliot DeNolf
ci: generate graphql schema in GH action
false
generate graphql schema in GH action
ci
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a47f93d93e6..b2adb432b31 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,6 +44,9 @@ jobs: - name: Generate Payload Types run: yarn dev:generate-types fields + - name: Generate GraphQL schema file + run: yarn dev:generate-graphql-schema + - name: Install Playwright Browsers run: npx playwright install --with-deps - name: E2E Tests diff --git a/package.json b/package.json index 251cd92801b..97fb7bac111 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "build:watch": "nodemon --watch 'src/**' --ext 'ts,tsx' --exec \"yarn build:tsc\"", "dev": "nodemon", "dev:generate-types": "ts-node -T ./test/generateTypes.ts", + "dev:generate-graphql-schema": "cross-env PAYLOAD_CONFIG_PATH=test/graphql-schema-gen/config.ts ts-node -T ./src/bin/generateGraphQLSchema.ts", "pretest": "yarn build", "test": "yarn test:int && yarn test:components && yarn test:e2e", "test:int": "cross-env DISABLE_LOGGING=true jest --forceExit --detectOpenHandles", diff --git a/test/generateGraphQLSchema.ts b/test/generateGraphQLSchema.ts new file mode 100644 index 00000000000..4ede12af24a --- /dev/null +++ b/test/generateGraphQLSchema.ts @@ -0,0 +1,19 @@ +import path from 'path'; +import fs from 'fs'; +import { generateGraphQLSchema } from '../src/bin/generateGraphQLSchema'; + +const [testConfigDir] = process.argv.slice(2); + +const testDir = path.resolve(__dirname, testConfigDir); +setPaths(testDir); +generateGraphQLSchema(); + +// Set config path and TS output path using test dir +function setPaths(dir) { + const configPath = path.resolve(dir, 'config.ts'); + if (fs.existsSync(configPath)) { + process.env.PAYLOAD_CONFIG_PATH = configPath; + return true; + } + return false; +} diff --git a/test/graphql-schema-gen/config.ts b/test/graphql-schema-gen/config.ts new file mode 100644 index 00000000000..f86d80bde74 --- /dev/null +++ b/test/graphql-schema-gen/config.ts @@ -0,0 +1,84 @@ +import path from 'path'; +import type { CollectionConfig } from '../../src/collections/config/types'; +import { buildConfig } from '../buildConfig'; + +export interface Relation { + id: string; + name: string; +} + +const openAccess = { + create: () => true, + read: () => true, + update: () => true, + delete: () => true, +}; + +const collectionWithName = (collectionSlug: string): CollectionConfig => { + return { + slug: collectionSlug, + access: openAccess, + fields: [ + { + name: 'name', + type: 'text', + }, + ], + }; +}; + +export const slug = 'posts'; +export const relationSlug = 'relation'; +export default buildConfig({ + graphQL: { + schemaOutputFile: path.resolve(__dirname, 'generated-schema.graphql'), + }, + collections: [ + { + slug, + access: openAccess, + fields: [ + { + name: 'title', + type: 'text', + }, + { + name: 'description', + type: 'text', + }, + { + name: 'number', + type: 'number', + }, + // Relationship + { + name: 'relationField', + type: 'relationship', + relationTo: relationSlug, + }, + // Relation hasMany + { + name: 'relationHasManyField', + type: 'relationship', + relationTo: relationSlug, + hasMany: true, + }, + // Relation multiple relationTo + { + name: 'relationMultiRelationTo', + type: 'relationship', + relationTo: [relationSlug, 'dummy'], + }, + // Relation multiple relationTo hasMany + { + name: 'relationMultiRelationToHasMany', + type: 'relationship', + relationTo: [relationSlug, 'dummy'], + hasMany: true, + }, + ], + }, + collectionWithName(relationSlug), + collectionWithName('dummy'), + ], +}); diff --git a/test/graphql-schema-gen/generated-schema.graphql b/test/graphql-schema-gen/generated-schema.graphql new file mode 100644 index 00000000000..0f3dbaa17d6 --- /dev/null +++ b/test/graphql-schema-gen/generated-schema.graphql @@ -0,0 +1,1444 @@ +type Query { + Post(id: String!, draft: Boolean): Post + Posts(where: Post_where, draft: Boolean, page: Int, limit: Int, sort: String): Posts + docAccessPost(id: String!): postsDocAccess + Relation(id: String!, draft: Boolean): Relation + Relations(where: Relation_where, draft: Boolean, page: Int, limit: Int, sort: String): Relations + docAccessRelation(id: String!): relationDocAccess + Dummy(id: String!, draft: Boolean): Dummy + Dummies(where: Dummy_where, draft: Boolean, page: Int, limit: Int, sort: String): Dummies + docAccessDummy(id: String!): dummyDocAccess + User(id: String!, draft: Boolean): User + Users(where: User_where, draft: Boolean, page: Int, limit: Int, sort: String): Users + docAccessUser(id: String!): usersDocAccess + meUser: usersMe + initializedUser: Boolean + Preference(key: String): Preference + Access: Access +} + +type Post { + id: String + createdAt: DateTime! + updatedAt: DateTime! + title: String + description: String + number: Float + relationField: Relation + relationHasManyField: [Relation!] + relationMultiRelationTo: Post_RelationMultiRelationTo_Relationship + relationMultiRelationToHasMany: [Post_RelationMultiRelationToHasMany_Relationship!] +} + +""" +A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. +""" +scalar DateTime + +type Relation { + id: String + createdAt: DateTime! + updatedAt: DateTime! + name: String +} + +type Post_RelationMultiRelationTo_Relationship { + relationTo: Post_RelationMultiRelationTo_RelationTo + value: Post_RelationMultiRelationTo +} + +enum Post_RelationMultiRelationTo_RelationTo { + relation + dummy +} + +union Post_RelationMultiRelationTo = Relation | Dummy + +type Dummy { + id: String + createdAt: DateTime! + updatedAt: DateTime! + name: String +} + +type Post_RelationMultiRelationToHasMany_Relationship { + relationTo: Post_RelationMultiRelationToHasMany_RelationTo + value: Post_RelationMultiRelationToHasMany +} + +enum Post_RelationMultiRelationToHasMany_RelationTo { + relation + dummy +} + +union Post_RelationMultiRelationToHasMany = Relation | Dummy + +type Posts { + docs: [Post] + totalDocs: Int + offset: Int + limit: Int + totalPages: Int + page: Int + pagingCounter: Int + hasPrevPage: Boolean + hasNextPage: Boolean + prevPage: Int + nextPage: Int +} + +input Post_where { + title: Post_title_operator + description: Post_description_operator + number: Post_number_operator + relationField: Post_relationField_operator + relationHasManyField: Post_relationHasManyField_operator + relationMultiRelationTo: Post_relationMultiRelationTo_Relation + relationMultiRelationToHasMany: Post_relationMultiRelationToHasMany_Relation + id: Post_id_operator + createdAt: Post_createdAt_operator + updatedAt: Post_updatedAt_operator + OR: [Post_where_or] + AND: [Post_where_and] +} + +input Post_title_operator { + equals: String + not_equals: String + like: String + contains: String + in: [String] + not_in: [String] + all: [String] + exists: Boolean +} + +input Post_description_operator { + equals: String + not_equals: String + like: String + contains: String + in: [String] + not_in: [String] + all: [String] + exists: Boolean +} + +input Post_number_operator { + equals: Float + not_equals: Float + greater_than_equal: Float + greater_than: Float + less_than_equal: Float + less_than: Float + exists: Boolean +} + +input Post_relationField_operator { + equals: String + not_equals: String + in: [String] + not_in: [String] + all: [String] + exists: Boolean +} + +input Post_relationHasManyField_operator { + equals: String + not_equals: String + in: [String] + not_in: [String] + all: [String] + exists: Boolean +} + +input Post_relationMultiRelationTo_Relation { + relationTo: Post_relationMultiRelationTo_Relation_RelationTo + value: String +} + +enum Post_relationMultiRelationTo_Relation_RelationTo { + relation + dummy +} + +input Post_relationMultiRelationToHasMany_Relation { + relationTo: Post_relationMultiRelationToHasMany_Relation_RelationTo + value: String +} + +enum Post_relationMultiRelationToHasMany_Relation_RelationTo { + relation + dummy +} + +input Post_id_operator { + equals: JSON + not_equals: JSON + in: [JSON] + not_in: [JSON] + all: [JSON] + exists: Boolean +} + +""" +The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). +""" +scalar JSON + +input Post_createdAt_operator { + equals: DateTime + not_equals: DateTime + greater_than_equal: DateTime + greater_than: DateTime + less_than_equal: DateTime + less_than: DateTime + like: DateTime + exists: Boolean +} + +input Post_updatedAt_operator { + equals: DateTime + not_equals: DateTime + greater_than_equal: DateTime + greater_than: DateTime + less_than_equal: DateTime + less_than: DateTime + like: DateTime + exists: Boolean +} + +input Post_where_or { + title: Post_title_operator + description: Post_description_operator + number: Post_number_operator + relationField: Post_relationField_operator + relationHasManyField: Post_relationHasManyField_operator + relationMultiRelationTo: Post_relationMultiRelationTo_Relation + relationMultiRelationToHasMany: Post_relationMultiRelationToHasMany_Relation + id: Post_id_operator + createdAt: Post_createdAt_operator + updatedAt: Post_updatedAt_operator +} + +input Post_where_and { + title: Post_title_operator + description: Post_description_operator + number: Post_number_operator + relationField: Post_relationField_operator + relationHasManyField: Post_relationHasManyField_operator + relationMultiRelationTo: Post_relationMultiRelationTo_Relation + relationMultiRelationToHasMany: Post_relationMultiRelationToHasMany_Relation + id: Post_id_operator + createdAt: Post_createdAt_operator + updatedAt: Post_updatedAt_operator +} + +type postsDocAccess { + fields: PostsDocAccessFields + create: PostsCreateDocAccess + read: PostsReadDocAccess + update: PostsUpdateDocAccess + delete: PostsDeleteDocAccess +} + +type PostsDocAccessFields { + title: PostsDocAccessFields_title + description: PostsDocAccessFields_description + number: PostsDocAccessFields_number + relationField: PostsDocAccessFields_relationField + relationHasManyField: PostsDocAccessFields_relationHasManyField + relationMultiRelationTo: PostsDocAccessFields_relationMultiRelationTo + relationMultiRelationToHasMany: PostsDocAccessFields_relationMultiRelationToHasMany +} + +type PostsDocAccessFields_title { + create: PostsDocAccessFields_title_Create + read: PostsDocAccessFields_title_Read + update: PostsDocAccessFields_title_Update + delete: PostsDocAccessFields_title_Delete +} + +type PostsDocAccessFields_title_Create { + permission: Boolean! +} + +type PostsDocAccessFields_title_Read { + permission: Boolean! +} + +type PostsDocAccessFields_title_Update { + permission: Boolean! +} + +type PostsDocAccessFields_title_Delete { + permission: Boolean! +} + +type PostsDocAccessFields_description { + create: PostsDocAccessFields_description_Create + read: PostsDocAccessFields_description_Read + update: PostsDocAccessFields_description_Update + delete: PostsDocAccessFields_description_Delete +} + +type PostsDocAccessFields_description_Create { + permission: Boolean! +} + +type PostsDocAccessFields_description_Read { + permission: Boolean! +} + +type PostsDocAccessFields_description_Update { + permission: Boolean! +} + +type PostsDocAccessFields_description_Delete { + permission: Boolean! +} + +type PostsDocAccessFields_number { + create: PostsDocAccessFields_number_Create + read: PostsDocAccessFields_number_Read + update: PostsDocAccessFields_number_Update + delete: PostsDocAccessFields_number_Delete +} + +type PostsDocAccessFields_number_Create { + permission: Boolean! +} + +type PostsDocAccessFields_number_Read { + permission: Boolean! +} + +type PostsDocAccessFields_number_Update { + permission: Boolean! +} + +type PostsDocAccessFields_number_Delete { + permission: Boolean! +} + +type PostsDocAccessFields_relationField { + create: PostsDocAccessFields_relationField_Create + read: PostsDocAccessFields_relationField_Read + update: PostsDocAccessFields_relationField_Update + delete: PostsDocAccessFields_relationField_Delete +} + +type PostsDocAccessFields_relationField_Create { + permission: Boolean! +} + +type PostsDocAccessFields_relationField_Read { + permission: Boolean! +} + +type PostsDocAccessFields_relationField_Update { + permission: Boolean! +} + +type PostsDocAccessFields_relationField_Delete { + permission: Boolean! +} + +type PostsDocAccessFields_relationHasManyField { + create: PostsDocAccessFields_relationHasManyField_Create + read: PostsDocAccessFields_relationHasManyField_Read + update: PostsDocAccessFields_relationHasManyField_Update + delete: PostsDocAccessFields_relationHasManyField_Delete +} + +type PostsDocAccessFields_relationHasManyField_Create { + permission: Boolean! +} + +type PostsDocAccessFields_relationHasManyField_Read { + permission: Boolean! +} + +type PostsDocAccessFields_relationHasManyField_Update { + permission: Boolean! +} + +type PostsDocAccessFields_relationHasManyField_Delete { + permission: Boolean! +} + +type PostsDocAccessFields_relationMultiRelationTo { + create: PostsDocAccessFields_relationMultiRelationTo_Create + read: PostsDocAccessFields_relationMultiRelationTo_Read + update: PostsDocAccessFields_relationMultiRelationTo_Update + delete: PostsDocAccessFields_relationMultiRelationTo_Delete +} + +type PostsDocAccessFields_relationMultiRelationTo_Create { + permission: Boolean! +} + +type PostsDocAccessFields_relationMultiRelationTo_Read { + permission: Boolean! +} + +type PostsDocAccessFields_relationMultiRelationTo_Update { + permission: Boolean! +} + +type PostsDocAccessFields_relationMultiRelationTo_Delete { + permission: Boolean! +} + +type PostsDocAccessFields_relationMultiRelationToHasMany { + create: PostsDocAccessFields_relationMultiRelationToHasMany_Create + read: PostsDocAccessFields_relationMultiRelationToHasMany_Read + update: PostsDocAccessFields_relationMultiRelationToHasMany_Update + delete: PostsDocAccessFields_relationMultiRelationToHasMany_Delete +} + +type PostsDocAccessFields_relationMultiRelationToHasMany_Create { + permission: Boolean! +} + +type PostsDocAccessFields_relationMultiRelationToHasMany_Read { + permission: Boolean! +} + +type PostsDocAccessFields_relationMultiRelationToHasMany_Update { + permission: Boolean! +} + +type PostsDocAccessFields_relationMultiRelationToHasMany_Delete { + permission: Boolean! +} + +type PostsCreateDocAccess { + permission: Boolean! + where: JSONObject +} + +""" +The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). +""" +scalar JSONObject + +type PostsReadDocAccess { + permission: Boolean! + where: JSONObject +} + +type PostsUpdateDocAccess { + permission: Boolean! + where: JSONObject +} + +type PostsDeleteDocAccess { + permission: Boolean! + where: JSONObject +} + +type Relations { + docs: [Relation] + totalDocs: Int + offset: Int + limit: Int + totalPages: Int + page: Int + pagingCounter: Int + hasPrevPage: Boolean + hasNextPage: Boolean + prevPage: Int + nextPage: Int +} + +input Relation_where { + name: Relation_name_operator + id: Relation_id_operator + createdAt: Relation_createdAt_operator + updatedAt: Relation_updatedAt_operator + OR: [Relation_where_or] + AND: [Relation_where_and] +} + +input Relation_name_operator { + equals: String + not_equals: String + like: String + contains: String + in: [String] + not_in: [String] + all: [String] + exists: Boolean +} + +input Relation_id_operator { + equals: JSON + not_equals: JSON + in: [JSON] + not_in: [JSON] + all: [JSON] + exists: Boolean +} + +input Relation_createdAt_operator { + equals: DateTime + not_equals: DateTime + greater_than_equal: DateTime + greater_than: DateTime + less_than_equal: DateTime + less_than: DateTime + like: DateTime + exists: Boolean +} + +input Relation_updatedAt_operator { + equals: DateTime + not_equals: DateTime + greater_than_equal: DateTime + greater_than: DateTime + less_than_equal: DateTime + less_than: DateTime + like: DateTime + exists: Boolean +} + +input Relation_where_or { + name: Relation_name_operator + id: Relation_id_operator + createdAt: Relation_createdAt_operator + updatedAt: Relation_updatedAt_operator +} + +input Relation_where_and { + name: Relation_name_operator + id: Relation_id_operator + createdAt: Relation_createdAt_operator + updatedAt: Relation_updatedAt_operator +} + +type relationDocAccess { + fields: RelationDocAccessFields + create: RelationCreateDocAccess + read: RelationReadDocAccess + update: RelationUpdateDocAccess + delete: RelationDeleteDocAccess +} + +type RelationDocAccessFields { + name: RelationDocAccessFields_name +} + +type RelationDocAccessFields_name { + create: RelationDocAccessFields_name_Create + read: RelationDocAccessFields_name_Read + update: RelationDocAccessFields_name_Update + delete: RelationDocAccessFields_name_Delete +} + +type RelationDocAccessFields_name_Create { + permission: Boolean! +} + +type RelationDocAccessFields_name_Read { + permission: Boolean! +} + +type RelationDocAccessFields_name_Update { + permission: Boolean! +} + +type RelationDocAccessFields_name_Delete { + permission: Boolean! +} + +type RelationCreateDocAccess { + permission: Boolean! + where: JSONObject +} + +type RelationReadDocAccess { + permission: Boolean! + where: JSONObject +} + +type RelationUpdateDocAccess { + permission: Boolean! + where: JSONObject +} + +type RelationDeleteDocAccess { + permission: Boolean! + where: JSONObject +} + +type Dummies { + docs: [Dummy] + totalDocs: Int + offset: Int + limit: Int + totalPages: Int + page: Int + pagingCounter: Int + hasPrevPage: Boolean + hasNextPage: Boolean + prevPage: Int + nextPage: Int +} + +input Dummy_where { + name: Dummy_name_operator + id: Dummy_id_operator + createdAt: Dummy_createdAt_operator + updatedAt: Dummy_updatedAt_operator + OR: [Dummy_where_or] + AND: [Dummy_where_and] +} + +input Dummy_name_operator { + equals: String + not_equals: String + like: String + contains: String + in: [String] + not_in: [String] + all: [String] + exists: Boolean +} + +input Dummy_id_operator { + equals: JSON + not_equals: JSON + in: [JSON] + not_in: [JSON] + all: [JSON] + exists: Boolean +} + +input Dummy_createdAt_operator { + equals: DateTime + not_equals: DateTime + greater_than_equal: DateTime + greater_than: DateTime + less_than_equal: DateTime + less_than: DateTime + like: DateTime + exists: Boolean +} + +input Dummy_updatedAt_operator { + equals: DateTime + not_equals: DateTime + greater_than_equal: DateTime + greater_than: DateTime + less_than_equal: DateTime + less_than: DateTime + like: DateTime + exists: Boolean +} + +input Dummy_where_or { + name: Dummy_name_operator + id: Dummy_id_operator + createdAt: Dummy_createdAt_operator + updatedAt: Dummy_updatedAt_operator +} + +input Dummy_where_and { + name: Dummy_name_operator + id: Dummy_id_operator + createdAt: Dummy_createdAt_operator + updatedAt: Dummy_updatedAt_operator +} + +type dummyDocAccess { + fields: DummyDocAccessFields + create: DummyCreateDocAccess + read: DummyReadDocAccess + update: DummyUpdateDocAccess + delete: DummyDeleteDocAccess +} + +type DummyDocAccessFields { + name: DummyDocAccessFields_name +} + +type DummyDocAccessFields_name { + create: DummyDocAccessFields_name_Create + read: DummyDocAccessFields_name_Read + update: DummyDocAccessFields_name_Update + delete: DummyDocAccessFields_name_Delete +} + +type DummyDocAccessFields_name_Create { + permission: Boolean! +} + +type DummyDocAccessFields_name_Read { + permission: Boolean! +} + +type DummyDocAccessFields_name_Update { + permission: Boolean! +} + +type DummyDocAccessFields_name_Delete { + permission: Boolean! +} + +type DummyCreateDocAccess { + permission: Boolean! + where: JSONObject +} + +type DummyReadDocAccess { + permission: Boolean! + where: JSONObject +} + +type DummyUpdateDocAccess { + permission: Boolean! + where: JSONObject +} + +type DummyDeleteDocAccess { + permission: Boolean! + where: JSONObject +} + +type User { + id: String + createdAt: DateTime! + updatedAt: DateTime! + email: EmailAddress + resetPasswordToken: String + resetPasswordExpiration: DateTime + loginAttempts: Float + lockUntil: DateTime + password: String! +} + +""" +A field whose value conforms to the standard internet email address format as specified in RFC822: https://www.w3.org/Protocols/rfc822/. +""" +scalar EmailAddress @specifiedBy(url: "https://www.w3.org/Protocols/rfc822/") + +type Users { + docs: [User] + totalDocs: Int + offset: Int + limit: Int + totalPages: Int + page: Int + pagingCounter: Int + hasPrevPage: Boolean + hasNextPage: Boolean + prevPage: Int + nextPage: Int +} + +input User_where { + email: User_email_operator + id: User_id_operator + createdAt: User_createdAt_operator + updatedAt: User_updatedAt_operator + OR: [User_where_or] + AND: [User_where_and] +} + +input User_email_operator { + equals: EmailAddress + not_equals: EmailAddress + like: EmailAddress + contains: EmailAddress + in: [EmailAddress] + not_in: [EmailAddress] + all: [EmailAddress] + exists: Boolean +} + +input User_id_operator { + equals: JSON + not_equals: JSON + in: [JSON] + not_in: [JSON] + all: [JSON] + exists: Boolean +} + +input User_createdAt_operator { + equals: DateTime + not_equals: DateTime + greater_than_equal: DateTime + greater_than: DateTime + less_than_equal: DateTime + less_than: DateTime + like: DateTime + exists: Boolean +} + +input User_updatedAt_operator { + equals: DateTime + not_equals: DateTime + greater_than_equal: DateTime + greater_than: DateTime + less_than_equal: DateTime + less_than: DateTime + like: DateTime + exists: Boolean +} + +input User_where_or { + email: User_email_operator + id: User_id_operator + createdAt: User_createdAt_operator + updatedAt: User_updatedAt_operator +} + +input User_where_and { + email: User_email_operator + id: User_id_operator + createdAt: User_createdAt_operator + updatedAt: User_updatedAt_operator +} + +type usersDocAccess { + fields: UsersDocAccessFields + create: UsersCreateDocAccess + read: UsersReadDocAccess + update: UsersUpdateDocAccess + delete: UsersDeleteDocAccess + unlock: UsersUnlockDocAccess +} + +type UsersDocAccessFields { + email: UsersDocAccessFields_email + password: UsersDocAccessFields_password +} + +type UsersDocAccessFields_email { + create: UsersDocAccessFields_email_Create + read: UsersDocAccessFields_email_Read + update: UsersDocAccessFields_email_Update + delete: UsersDocAccessFields_email_Delete +} + +type UsersDocAccessFields_email_Create { + permission: Boolean! +} + +type UsersDocAccessFields_email_Read { + permission: Boolean! +} + +type UsersDocAccessFields_email_Update { + permission: Boolean! +} + +type UsersDocAccessFields_email_Delete { + permission: Boolean! +} + +type UsersDocAccessFields_password { + create: UsersDocAccessFields_password_Create + read: UsersDocAccessFields_password_Read + update: UsersDocAccessFields_password_Update + delete: UsersDocAccessFields_password_Delete +} + +type UsersDocAccessFields_password_Create { + permission: Boolean! +} + +type UsersDocAccessFields_password_Read { + permission: Boolean! +} + +type UsersDocAccessFields_password_Update { + permission: Boolean! +} + +type UsersDocAccessFields_password_Delete { + permission: Boolean! +} + +type UsersCreateDocAccess { + permission: Boolean! + where: JSONObject +} + +type UsersReadDocAccess { + permission: Boolean! + where: JSONObject +} + +type UsersUpdateDocAccess { + permission: Boolean! + where: JSONObject +} + +type UsersDeleteDocAccess { + permission: Boolean! + where: JSONObject +} + +type UsersUnlockDocAccess { + permission: Boolean! + where: JSONObject +} + +type usersMe { + token: String + user: User + exp: Int + collection: String +} + +type Preference { + key: String! + value: JSON + createdAt: DateTime! + updatedAt: DateTime! +} + +type Access { + canAccessAdmin: Boolean! + posts: postsAccess + relation: relationAccess + dummy: dummyAccess + users: usersAccess +} + +type postsAccess { + fields: PostsFields + create: PostsCreateAccess + read: PostsReadAccess + update: PostsUpdateAccess + delete: PostsDeleteAccess +} + +type PostsFields { + title: PostsFields_title + description: PostsFields_description + number: PostsFields_number + relationField: PostsFields_relationField + relationHasManyField: PostsFields_relationHasManyField + relationMultiRelationTo: PostsFields_relationMultiRelationTo + relationMultiRelationToHasMany: PostsFields_relationMultiRelationToHasMany +} + +type PostsFields_title { + create: PostsFields_title_Create + read: PostsFields_title_Read + update: PostsFields_title_Update + delete: PostsFields_title_Delete +} + +type PostsFields_title_Create { + permission: Boolean! +} + +type PostsFields_title_Read { + permission: Boolean! +} + +type PostsFields_title_Update { + permission: Boolean! +} + +type PostsFields_title_Delete { + permission: Boolean! +} + +type PostsFields_description { + create: PostsFields_description_Create + read: PostsFields_description_Read + update: PostsFields_description_Update + delete: PostsFields_description_Delete +} + +type PostsFields_description_Create { + permission: Boolean! +} + +type PostsFields_description_Read { + permission: Boolean! +} + +type PostsFields_description_Update { + permission: Boolean! +} + +type PostsFields_description_Delete { + permission: Boolean! +} + +type PostsFields_number { + create: PostsFields_number_Create + read: PostsFields_number_Read + update: PostsFields_number_Update + delete: PostsFields_number_Delete +} + +type PostsFields_number_Create { + permission: Boolean! +} + +type PostsFields_number_Read { + permission: Boolean! +} + +type PostsFields_number_Update { + permission: Boolean! +} + +type PostsFields_number_Delete { + permission: Boolean! +} + +type PostsFields_relationField { + create: PostsFields_relationField_Create + read: PostsFields_relationField_Read + update: PostsFields_relationField_Update + delete: PostsFields_relationField_Delete +} + +type PostsFields_relationField_Create { + permission: Boolean! +} + +type PostsFields_relationField_Read { + permission: Boolean! +} + +type PostsFields_relationField_Update { + permission: Boolean! +} + +type PostsFields_relationField_Delete { + permission: Boolean! +} + +type PostsFields_relationHasManyField { + create: PostsFields_relationHasManyField_Create + read: PostsFields_relationHasManyField_Read + update: PostsFields_relationHasManyField_Update + delete: PostsFields_relationHasManyField_Delete +} + +type PostsFields_relationHasManyField_Create { + permission: Boolean! +} + +type PostsFields_relationHasManyField_Read { + permission: Boolean! +} + +type PostsFields_relationHasManyField_Update { + permission: Boolean! +} + +type PostsFields_relationHasManyField_Delete { + permission: Boolean! +} + +type PostsFields_relationMultiRelationTo { + create: PostsFields_relationMultiRelationTo_Create + read: PostsFields_relationMultiRelationTo_Read + update: PostsFields_relationMultiRelationTo_Update + delete: PostsFields_relationMultiRelationTo_Delete +} + +type PostsFields_relationMultiRelationTo_Create { + permission: Boolean! +} + +type PostsFields_relationMultiRelationTo_Read { + permission: Boolean! +} + +type PostsFields_relationMultiRelationTo_Update { + permission: Boolean! +} + +type PostsFields_relationMultiRelationTo_Delete { + permission: Boolean! +} + +type PostsFields_relationMultiRelationToHasMany { + create: PostsFields_relationMultiRelationToHasMany_Create + read: PostsFields_relationMultiRelationToHasMany_Read + update: PostsFields_relationMultiRelationToHasMany_Update + delete: PostsFields_relationMultiRelationToHasMany_Delete +} + +type PostsFields_relationMultiRelationToHasMany_Create { + permission: Boolean! +} + +type PostsFields_relationMultiRelationToHasMany_Read { + permission: Boolean! +} + +type PostsFields_relationMultiRelationToHasMany_Update { + permission: Boolean! +} + +type PostsFields_relationMultiRelationToHasMany_Delete { + permission: Boolean! +} + +type PostsCreateAccess { + permission: Boolean! + where: JSONObject +} + +type PostsReadAccess { + permission: Boolean! + where: JSONObject +} + +type PostsUpdateAccess { + permission: Boolean! + where: JSONObject +} + +type PostsDeleteAccess { + permission: Boolean! + where: JSONObject +} + +type relationAccess { + fields: RelationFields + create: RelationCreateAccess + read: RelationReadAccess + update: RelationUpdateAccess + delete: RelationDeleteAccess +} + +type RelationFields { + name: RelationFields_name +} + +type RelationFields_name { + create: RelationFields_name_Create + read: RelationFields_name_Read + update: RelationFields_name_Update + delete: RelationFields_name_Delete +} + +type RelationFields_name_Create { + permission: Boolean! +} + +type RelationFields_name_Read { + permission: Boolean! +} + +type RelationFields_name_Update { + permission: Boolean! +} + +type RelationFields_name_Delete { + permission: Boolean! +} + +type RelationCreateAccess { + permission: Boolean! + where: JSONObject +} + +type RelationReadAccess { + permission: Boolean! + where: JSONObject +} + +type RelationUpdateAccess { + permission: Boolean! + where: JSONObject +} + +type RelationDeleteAccess { + permission: Boolean! + where: JSONObject +} + +type dummyAccess { + fields: DummyFields + create: DummyCreateAccess + read: DummyReadAccess + update: DummyUpdateAccess + delete: DummyDeleteAccess +} + +type DummyFields { + name: DummyFields_name +} + +type DummyFields_name { + create: DummyFields_name_Create + read: DummyFields_name_Read + update: DummyFields_name_Update + delete: DummyFields_name_Delete +} + +type DummyFields_name_Create { + permission: Boolean! +} + +type DummyFields_name_Read { + permission: Boolean! +} + +type DummyFields_name_Update { + permission: Boolean! +} + +type DummyFields_name_Delete { + permission: Boolean! +} + +type DummyCreateAccess { + permission: Boolean! + where: JSONObject +} + +type DummyReadAccess { + permission: Boolean! + where: JSONObject +} + +type DummyUpdateAccess { + permission: Boolean! + where: JSONObject +} + +type DummyDeleteAccess { + permission: Boolean! + where: JSONObject +} + +type usersAccess { + fields: UsersFields + create: UsersCreateAccess + read: UsersReadAccess + update: UsersUpdateAccess + delete: UsersDeleteAccess + unlock: UsersUnlockAccess +} + +type UsersFields { + email: UsersFields_email + password: UsersFields_password +} + +type UsersFields_email { + create: UsersFields_email_Create + read: UsersFields_email_Read + update: UsersFields_email_Update + delete: UsersFields_email_Delete +} + +type UsersFields_email_Create { + permission: Boolean! +} + +type UsersFields_email_Read { + permission: Boolean! +} + +type UsersFields_email_Update { + permission: Boolean! +} + +type UsersFields_email_Delete { + permission: Boolean! +} + +type UsersFields_password { + create: UsersFields_password_Create + read: UsersFields_password_Read + update: UsersFields_password_Update + delete: UsersFields_password_Delete +} + +type UsersFields_password_Create { + permission: Boolean! +} + +type UsersFields_password_Read { + permission: Boolean! +} + +type UsersFields_password_Update { + permission: Boolean! +} + +type UsersFields_password_Delete { + permission: Boolean! +} + +type UsersCreateAccess { + permission: Boolean! + where: JSONObject +} + +type UsersReadAccess { + permission: Boolean! + where: JSONObject +} + +type UsersUpdateAccess { + permission: Boolean! + where: JSONObject +} + +type UsersDeleteAccess { + permission: Boolean! + where: JSONObject +} + +type UsersUnlockAccess { + permission: Boolean! + where: JSONObject +} + +type Mutation { + createPost(data: mutationPostInput!, draft: Boolean): Post + updatePost(id: String!, data: mutationPostUpdateInput!, draft: Boolean, autosave: Boolean): Post + deletePost(id: String!): Post + createRelation(data: mutationRelationInput!, draft: Boolean): Relation + updateRelation(id: String!, data: mutationRelationUpdateInput!, draft: Boolean, autosave: Boolean): Relation + deleteRelation(id: String!): Relation + createDummy(data: mutationDummyInput!, draft: Boolean): Dummy + updateDummy(id: String!, data: mutationDummyUpdateInput!, draft: Boolean, autosave: Boolean): Dummy + deleteDummy(id: String!): Dummy + createUser(data: mutationUserInput!, draft: Boolean): User + updateUser(id: String!, data: mutationUserUpdateInput!, draft: Boolean, autosave: Boolean): User + deleteUser(id: String!): User + refreshTokenUser(token: String): usersRefreshedUser + logoutUser: String + unlockUser(email: String!): Boolean! + loginUser(email: String, password: String): usersLoginResult + forgotPasswordUser(email: String!, disableEmail: Boolean, expiration: Int): Boolean! + resetPasswordUser(token: String, password: String): usersResetPassword + verifyEmailUser(token: String): Boolean + updatePreference(key: String!, value: JSON): Preference + deletePreference(key: String!): Preference +} + +input mutationPostInput { + title: String + description: String + number: Float + relationField: String + relationHasManyField: [String] + relationMultiRelationTo: Post_RelationMultiRelationToRelationshipInput + relationMultiRelationToHasMany: [Post_RelationMultiRelationToHasManyRelationshipInput] +} + +input Post_RelationMultiRelationToRelationshipInput { + relationTo: Post_RelationMultiRelationToRelationshipInputRelationTo + value: JSON +} + +enum Post_RelationMultiRelationToRelationshipInputRelationTo { + relation + dummy +} + +input Post_RelationMultiRelationToHasManyRelationshipInput { + relationTo: Post_RelationMultiRelationToHasManyRelationshipInputRelationTo + value: JSON +} + +enum Post_RelationMultiRelationToHasManyRelationshipInputRelationTo { + relation + dummy +} + +input mutationPostUpdateInput { + title: String + description: String + number: Float + relationField: String + relationHasManyField: [String] + relationMultiRelationTo: PostUpdate_RelationMultiRelationToRelationshipInput + relationMultiRelationToHasMany: [PostUpdate_RelationMultiRelationToHasManyRelationshipInput] +} + +input PostUpdate_RelationMultiRelationToRelationshipInput { + relationTo: PostUpdate_RelationMultiRelationToRelationshipInputRelationTo + value: JSON +} + +enum PostUpdate_RelationMultiRelationToRelationshipInputRelationTo { + relation + dummy +} + +input PostUpdate_RelationMultiRelationToHasManyRelationshipInput { + relationTo: PostUpdate_RelationMultiRelationToHasManyRelationshipInputRelationTo + value: JSON +} + +enum PostUpdate_RelationMultiRelationToHasManyRelationshipInputRelationTo { + relation + dummy +} + +input mutationRelationInput { + name: String +} + +input mutationRelationUpdateInput { + name: String +} + +input mutationDummyInput { + name: String +} + +input mutationDummyUpdateInput { + name: String +} + +input mutationUserInput { + email: String + resetPasswordToken: String + resetPasswordExpiration: String + loginAttempts: Float + lockUntil: String + password: String! +} + +input mutationUserUpdateInput { + email: String + resetPasswordToken: String + resetPasswordExpiration: String + loginAttempts: Float + lockUntil: String + password: String +} + +type usersRefreshedUser { + user: usersJWT + refreshedToken: String + exp: Int +} + +type usersJWT { + email: EmailAddress! + collection: String! +} + +type usersLoginResult { + token: String + user: User + exp: Int +} + +type usersResetPassword { + token: String + user: User +} \ No newline at end of file
1dc748d3415e2f5ca4e3412ceffba77d1ee97007
2025-02-21 21:01:24
Sasha
perf(db-mongodb): remove `JSON.parse(JSON.stringify)` copying of results (#11293)
false
remove `JSON.parse(JSON.stringify)` copying of results (#11293)
perf
diff --git a/packages/db-mongodb/src/create.ts b/packages/db-mongodb/src/create.ts index 49e549b7e47..3c99e793243 100644 --- a/packages/db-mongodb/src/create.ts +++ b/packages/db-mongodb/src/create.ts @@ -5,7 +5,7 @@ import type { MongooseAdapter } from './index.js' import { getSession } from './utilities/getSession.js' import { handleError } from './utilities/handleError.js' -import { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js' +import { transform } from './utilities/transform.js' export const create: Create = async function create( this: MongooseAdapter, @@ -18,31 +18,31 @@ export const create: Create = async function create( let doc - const sanitizedData = sanitizeRelationshipIDs({ - config: this.payload.config, + transform({ + adapter: this, data, fields: this.payload.collections[collection].config.fields, + operation: 'write', }) if (this.payload.collections[collection].customIDType) { - sanitizedData._id = sanitizedData.id + data._id = data.id } try { - ;[doc] = await Model.create([sanitizedData], options) + ;[doc] = await Model.create([data], options) } catch (error) { handleError({ collection, error, req }) } - // doc.toJSON does not do stuff like converting ObjectIds to string, or date strings to date objects. That's why we use JSON.parse/stringify here - const result: Document = JSON.parse(JSON.stringify(doc)) - const verificationToken = doc._verificationToken + doc = doc.toObject() - // custom id type reset - result.id = result._id - if (verificationToken) { - result._verificationToken = verificationToken - } + transform({ + adapter: this, + data: doc, + fields: this.payload.collections[collection].config.fields, + operation: 'read', + }) - return result + return doc } diff --git a/packages/db-mongodb/src/createGlobal.ts b/packages/db-mongodb/src/createGlobal.ts index 969eeaed7ca..28c10b39caa 100644 --- a/packages/db-mongodb/src/createGlobal.ts +++ b/packages/db-mongodb/src/createGlobal.ts @@ -4,8 +4,7 @@ import type { CreateGlobal } from 'payload' import type { MongooseAdapter } from './index.js' import { getSession } from './utilities/getSession.js' -import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js' -import { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js' +import { transform } from './utilities/transform.js' export const createGlobal: CreateGlobal = async function createGlobal( this: MongooseAdapter, @@ -13,26 +12,28 @@ export const createGlobal: CreateGlobal = async function createGlobal( ) { const Model = this.globals - const global = sanitizeRelationshipIDs({ - config: this.payload.config, - data: { - globalType: slug, - ...data, - }, + transform({ + adapter: this, + data, fields: this.payload.config.globals.find((globalConfig) => globalConfig.slug === slug).fields, + globalSlug: slug, + operation: 'write', }) const options: CreateOptions = { session: await getSession(this, req), } - let [result] = (await Model.create([global], options)) as any + let [result] = (await Model.create([data], options)) as any - result = JSON.parse(JSON.stringify(result)) + result = result.toObject() - // custom id type reset - result.id = result._id - result = sanitizeInternalFields(result) + transform({ + adapter: this, + data: result, + fields: this.payload.config.globals.find((globalConfig) => globalConfig.slug === slug).fields, + operation: 'read', + }) return result } diff --git a/packages/db-mongodb/src/createGlobalVersion.ts b/packages/db-mongodb/src/createGlobalVersion.ts index a6fe7ccb5f4..2137ca84aa6 100644 --- a/packages/db-mongodb/src/createGlobalVersion.ts +++ b/packages/db-mongodb/src/createGlobalVersion.ts @@ -1,11 +1,11 @@ import type { CreateOptions } from 'mongoose' -import { buildVersionGlobalFields, type CreateGlobalVersion, type Document } from 'payload' +import { buildVersionGlobalFields, type CreateGlobalVersion } from 'payload' import type { MongooseAdapter } from './index.js' import { getSession } from './utilities/getSession.js' -import { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js' +import { transform } from './utilities/transform.js' export const createGlobalVersion: CreateGlobalVersion = async function createGlobalVersion( this: MongooseAdapter, @@ -26,25 +26,30 @@ export const createGlobalVersion: CreateGlobalVersion = async function createGlo session: await getSession(this, req), } - const data = sanitizeRelationshipIDs({ - config: this.payload.config, - data: { - autosave, - createdAt, - latest: true, - parent, - publishedLocale, - snapshot, - updatedAt, - version: versionData, - }, - fields: buildVersionGlobalFields( - this.payload.config, - this.payload.config.globals.find((global) => global.slug === globalSlug), - ), + const data = { + autosave, + createdAt, + latest: true, + parent, + publishedLocale, + snapshot, + updatedAt, + version: versionData, + } + + const fields = buildVersionGlobalFields( + this.payload.config, + this.payload.config.globals.find((global) => global.slug === globalSlug), + ) + + transform({ + adapter: this, + data, + fields, + operation: 'write', }) - const [doc] = await VersionModel.create([data], options, req) + let [doc] = await VersionModel.create([data], options, req) await VersionModel.updateMany( { @@ -70,13 +75,14 @@ export const createGlobalVersion: CreateGlobalVersion = async function createGlo options, ) - const result: Document = JSON.parse(JSON.stringify(doc)) - const verificationToken = doc._verificationToken + doc = doc.toObject() - // custom id type reset - result.id = result._id - if (verificationToken) { - result._verificationToken = verificationToken - } - return result + transform({ + adapter: this, + data: doc, + fields, + operation: 'read', + }) + + return doc } diff --git a/packages/db-mongodb/src/createVersion.ts b/packages/db-mongodb/src/createVersion.ts index 3482345e24c..a0894adc881 100644 --- a/packages/db-mongodb/src/createVersion.ts +++ b/packages/db-mongodb/src/createVersion.ts @@ -1,12 +1,11 @@ import type { CreateOptions } from 'mongoose' -import { Types } from 'mongoose' -import { buildVersionCollectionFields, type CreateVersion, type Document } from 'payload' +import { buildVersionCollectionFields, type CreateVersion } from 'payload' import type { MongooseAdapter } from './index.js' import { getSession } from './utilities/getSession.js' -import { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js' +import { transform } from './utilities/transform.js' export const createVersion: CreateVersion = async function createVersion( this: MongooseAdapter, @@ -27,25 +26,30 @@ export const createVersion: CreateVersion = async function createVersion( session: await getSession(this, req), } - const data = sanitizeRelationshipIDs({ - config: this.payload.config, - data: { - autosave, - createdAt, - latest: true, - parent, - publishedLocale, - snapshot, - updatedAt, - version: versionData, - }, - fields: buildVersionCollectionFields( - this.payload.config, - this.payload.collections[collectionSlug].config, - ), + const data = { + autosave, + createdAt, + latest: true, + parent, + publishedLocale, + snapshot, + updatedAt, + version: versionData, + } + + const fields = buildVersionCollectionFields( + this.payload.config, + this.payload.collections[collectionSlug].config, + ) + + transform({ + adapter: this, + data, + fields, + operation: 'write', }) - const [doc] = await VersionModel.create([data], options, req) + let [doc] = await VersionModel.create([data], options, req) const parentQuery = { $or: [ @@ -56,13 +60,6 @@ export const createVersion: CreateVersion = async function createVersion( }, ], } - if (data.parent instanceof Types.ObjectId) { - parentQuery.$or.push({ - parent: { - $eq: data.parent.toString(), - }, - }) - } await VersionModel.updateMany( { @@ -89,13 +86,14 @@ export const createVersion: CreateVersion = async function createVersion( options, ) - const result: Document = JSON.parse(JSON.stringify(doc)) - const verificationToken = doc._verificationToken + doc = doc.toObject() - // custom id type reset - result.id = result._id - if (verificationToken) { - result._verificationToken = verificationToken - } - return result + transform({ + adapter: this, + data: doc, + fields, + operation: 'read', + }) + + return doc } diff --git a/packages/db-mongodb/src/deleteOne.ts b/packages/db-mongodb/src/deleteOne.ts index 1ba5c2b7fdd..0ae32315315 100644 --- a/packages/db-mongodb/src/deleteOne.ts +++ b/packages/db-mongodb/src/deleteOne.ts @@ -1,12 +1,12 @@ import type { QueryOptions } from 'mongoose' -import type { DeleteOne, Document } from 'payload' +import type { DeleteOne } from 'payload' import type { MongooseAdapter } from './index.js' import { buildQuery } from './queries/buildQuery.js' import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js' import { getSession } from './utilities/getSession.js' -import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js' +import { transform } from './utilities/transform.js' export const deleteOne: DeleteOne = async function deleteOne( this: MongooseAdapter, @@ -35,11 +35,12 @@ export const deleteOne: DeleteOne = async function deleteOne( return null } - let result: Document = JSON.parse(JSON.stringify(doc)) - - // custom id type reset - result.id = result._id - result = sanitizeInternalFields(result) + transform({ + adapter: this, + data: doc, + fields: this.payload.collections[collection].config.fields, + operation: 'read', + }) - return result + return doc } diff --git a/packages/db-mongodb/src/find.ts b/packages/db-mongodb/src/find.ts index ab8733f87c4..65f556ec33b 100644 --- a/packages/db-mongodb/src/find.ts +++ b/packages/db-mongodb/src/find.ts @@ -10,7 +10,7 @@ import { buildSortParam } from './queries/buildSortParam.js' import { buildJoinAggregation } from './utilities/buildJoinAggregation.js' import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js' import { getSession } from './utilities/getSession.js' -import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js' +import { transform } from './utilities/transform.js' export const find: Find = async function find( this: MongooseAdapter, @@ -133,13 +133,12 @@ export const find: Find = async function find( result = await Model.paginate(query, paginationOptions) } - const docs = JSON.parse(JSON.stringify(result.docs)) + transform({ + adapter: this, + data: result.docs, + fields: this.payload.collections[collection].config.fields, + operation: 'read', + }) - return { - ...result, - docs: docs.map((doc) => { - doc.id = doc._id - return sanitizeInternalFields(doc) - }), - } + return result } diff --git a/packages/db-mongodb/src/findGlobal.ts b/packages/db-mongodb/src/findGlobal.ts index 61b61abdf7a..dbefa258c8e 100644 --- a/packages/db-mongodb/src/findGlobal.ts +++ b/packages/db-mongodb/src/findGlobal.ts @@ -8,14 +8,15 @@ import type { MongooseAdapter } from './index.js' import { buildQuery } from './queries/buildQuery.js' import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js' import { getSession } from './utilities/getSession.js' -import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js' +import { transform } from './utilities/transform.js' export const findGlobal: FindGlobal = async function findGlobal( this: MongooseAdapter, { slug, locale, req, select, where }, ) { const Model = this.globals - const fields = this.payload.globals.config.find((each) => each.slug === slug).flattenedFields + const globalConfig = this.payload.globals.config.find((each) => each.slug === slug) + const fields = globalConfig.flattenedFields const options: QueryOptions = { lean: true, select: buildProjectionFromSelect({ @@ -34,18 +35,18 @@ export const findGlobal: FindGlobal = async function findGlobal( where: combineQueries({ globalType: { equals: slug } }, where), }) - let doc = (await Model.findOne(query, {}, options)) as any + const doc = (await Model.findOne(query, {}, options)) as any if (!doc) { return null } - if (doc._id) { - doc.id = doc._id - delete doc._id - } - doc = JSON.parse(JSON.stringify(doc)) - doc = sanitizeInternalFields(doc) + transform({ + adapter: this, + data: doc, + fields: globalConfig.fields, + operation: 'read', + }) return doc } diff --git a/packages/db-mongodb/src/findGlobalVersions.ts b/packages/db-mongodb/src/findGlobalVersions.ts index b028a8d2247..2ecd21edded 100644 --- a/packages/db-mongodb/src/findGlobalVersions.ts +++ b/packages/db-mongodb/src/findGlobalVersions.ts @@ -9,18 +9,15 @@ import { buildQuery } from './queries/buildQuery.js' import { buildSortParam } from './queries/buildSortParam.js' import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js' import { getSession } from './utilities/getSession.js' -import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js' +import { transform } from './utilities/transform.js' export const findGlobalVersions: FindGlobalVersions = async function findGlobalVersions( this: MongooseAdapter, { global, limit, locale, page, pagination, req, select, skip, sort: sortArg, where }, ) { + const globalConfig = this.payload.globals.config.find(({ slug }) => slug === global) const Model = this.versions[global] - const versionFields = buildVersionGlobalFields( - this.payload.config, - this.payload.globals.config.find(({ slug }) => slug === global), - true, - ) + const versionFields = buildVersionGlobalFields(this.payload.config, globalConfig, true) const session = await getSession(this, req) const options: QueryOptions = { @@ -103,13 +100,13 @@ export const findGlobalVersions: FindGlobalVersions = async function findGlobalV } const result = await Model.paginate(query, paginationOptions) - const docs = JSON.parse(JSON.stringify(result.docs)) - - return { - ...result, - docs: docs.map((doc) => { - doc.id = doc._id - return sanitizeInternalFields(doc) - }), - } + + transform({ + adapter: this, + data: result.docs, + fields: buildVersionGlobalFields(this.payload.config, globalConfig), + operation: 'read', + }) + + return result } diff --git a/packages/db-mongodb/src/findOne.ts b/packages/db-mongodb/src/findOne.ts index 8db28b3d591..7fec58d949d 100644 --- a/packages/db-mongodb/src/findOne.ts +++ b/packages/db-mongodb/src/findOne.ts @@ -1,5 +1,5 @@ import type { AggregateOptions, QueryOptions } from 'mongoose' -import type { Document, FindOne } from 'payload' +import type { FindOne } from 'payload' import type { MongooseAdapter } from './index.js' @@ -7,7 +7,7 @@ import { buildQuery } from './queries/buildQuery.js' import { buildJoinAggregation } from './utilities/buildJoinAggregation.js' import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js' import { getSession } from './utilities/getSession.js' -import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js' +import { transform } from './utilities/transform.js' export const findOne: FindOne = async function findOne( this: MongooseAdapter, @@ -58,11 +58,7 @@ export const findOne: FindOne = async function findOne( return null } - let result: Document = JSON.parse(JSON.stringify(doc)) + transform({ adapter: this, data: doc, fields: collectionConfig.fields, operation: 'read' }) - // custom id type reset - result.id = result._id - result = sanitizeInternalFields(result) - - return result + return doc } diff --git a/packages/db-mongodb/src/findVersions.ts b/packages/db-mongodb/src/findVersions.ts index 0f123b1f23f..0b5eb37459b 100644 --- a/packages/db-mongodb/src/findVersions.ts +++ b/packages/db-mongodb/src/findVersions.ts @@ -9,7 +9,7 @@ import { buildQuery } from './queries/buildQuery.js' import { buildSortParam } from './queries/buildSortParam.js' import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js' import { getSession } from './utilities/getSession.js' -import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js' +import { transform } from './utilities/transform.js' export const findVersions: FindVersions = async function findVersions( this: MongooseAdapter, @@ -104,13 +104,13 @@ export const findVersions: FindVersions = async function findVersions( } const result = await Model.paginate(query, paginationOptions) - const docs = JSON.parse(JSON.stringify(result.docs)) - return { - ...result, - docs: docs.map((doc) => { - doc.id = doc._id - return sanitizeInternalFields(doc) - }), - } + transform({ + adapter: this, + data: result.docs, + fields: buildVersionCollectionFields(this.payload.config, collectionConfig), + operation: 'read', + }) + + return result } diff --git a/packages/db-mongodb/src/models/buildSchema.ts b/packages/db-mongodb/src/models/buildSchema.ts index af7f5015856..2c6d5b69ed1 100644 --- a/packages/db-mongodb/src/models/buildSchema.ts +++ b/packages/db-mongodb/src/models/buildSchema.ts @@ -476,6 +476,7 @@ const fieldToSchemaMap: Record<string, FieldSchemaGenerator> = { if (fieldShouldBeLocalized({ field, parentIsLocalized }) && payload.config.localization) { schemaToReturn = { + _id: false, type: payload.config.localization.localeCodes.reduce((locales, locale) => { let localeSchema: { [key: string]: any } = {} @@ -698,6 +699,7 @@ const fieldToSchemaMap: Record<string, FieldSchemaGenerator> = { if (fieldShouldBeLocalized({ field, parentIsLocalized }) && payload.config.localization) { schemaToReturn = { + _id: false, type: payload.config.localization.localeCodes.reduce((locales, locale) => { let localeSchema: { [key: string]: any } = {} diff --git a/packages/db-mongodb/src/predefinedMigrations/migrateRelationshipsV2_V3.ts b/packages/db-mongodb/src/predefinedMigrations/migrateRelationshipsV2_V3.ts index 11d5f4b4fce..7eabd677698 100644 --- a/packages/db-mongodb/src/predefinedMigrations/migrateRelationshipsV2_V3.ts +++ b/packages/db-mongodb/src/predefinedMigrations/migrateRelationshipsV2_V3.ts @@ -6,11 +6,12 @@ import { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload' import type { MongooseAdapter } from '../index.js' import { getSession } from '../utilities/getSession.js' -import { sanitizeRelationshipIDs } from '../utilities/sanitizeRelationshipIDs.js' +import { transform } from '../utilities/transform.js' const migrateModelWithBatching = async ({ batchSize, config, + db, fields, Model, parentIsLocalized, @@ -18,6 +19,7 @@ const migrateModelWithBatching = async ({ }: { batchSize: number config: SanitizedConfig + db: MongooseAdapter fields: Field[] Model: Model<any> parentIsLocalized: boolean @@ -49,7 +51,7 @@ const migrateModelWithBatching = async ({ } for (const doc of docs) { - sanitizeRelationshipIDs({ config, data: doc, fields, parentIsLocalized }) + transform({ adapter: db, data: doc, fields, operation: 'write', parentIsLocalized }) } await Model.collection.bulkWrite( @@ -124,6 +126,7 @@ export async function migrateRelationshipsV2_V3({ await migrateModelWithBatching({ batchSize, config, + db, fields: collection.fields, Model: db.collections[collection.slug], parentIsLocalized: false, @@ -139,6 +142,7 @@ export async function migrateRelationshipsV2_V3({ await migrateModelWithBatching({ batchSize, config, + db, fields: buildVersionCollectionFields(config, collection), Model: db.versions[collection.slug], parentIsLocalized: false, @@ -167,10 +171,11 @@ export async function migrateRelationshipsV2_V3({ // in case if the global doesn't exist in the database yet (not saved) if (doc) { - sanitizeRelationshipIDs({ - config, + transform({ + adapter: db, data: doc, fields: global.fields, + operation: 'write', }) await GlobalsModel.collection.updateOne( @@ -191,6 +196,7 @@ export async function migrateRelationshipsV2_V3({ await migrateModelWithBatching({ batchSize, config, + db, fields: buildVersionGlobalFields(config, global), Model: db.versions[global.slug], parentIsLocalized: false, diff --git a/packages/db-mongodb/src/queryDrafts.ts b/packages/db-mongodb/src/queryDrafts.ts index 0216d24fd09..1a8ba6269b4 100644 --- a/packages/db-mongodb/src/queryDrafts.ts +++ b/packages/db-mongodb/src/queryDrafts.ts @@ -10,7 +10,7 @@ import { buildSortParam } from './queries/buildSortParam.js' import { buildJoinAggregation } from './utilities/buildJoinAggregation.js' import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js' import { getSession } from './utilities/getSession.js' -import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js' +import { transform } from './utilities/transform.js' export const queryDrafts: QueryDrafts = async function queryDrafts( this: MongooseAdapter, @@ -124,18 +124,18 @@ export const queryDrafts: QueryDrafts = async function queryDrafts( result = await VersionModel.paginate(versionQuery, paginationOptions) } - const docs = JSON.parse(JSON.stringify(result.docs)) - - return { - ...result, - docs: docs.map((doc) => { - doc = { - _id: doc.parent, - id: doc.parent, - ...doc.version, - } + transform({ + adapter: this, + data: result.docs, + fields: buildVersionCollectionFields(this.payload.config, collectionConfig), + operation: 'read', + }) - return sanitizeInternalFields(doc) - }), + for (let i = 0; i < result.docs.length; i++) { + const id = result.docs[i].parent + result.docs[i] = result.docs[i].version + result.docs[i].id = id } + + return result } diff --git a/packages/db-mongodb/src/updateGlobal.ts b/packages/db-mongodb/src/updateGlobal.ts index 86686064db2..3ed8a04b3cd 100644 --- a/packages/db-mongodb/src/updateGlobal.ts +++ b/packages/db-mongodb/src/updateGlobal.ts @@ -5,8 +5,7 @@ import type { MongooseAdapter } from './index.js' import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js' import { getSession } from './utilities/getSession.js' -import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js' -import { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js' +import { transform } from './utilities/transform.js' export const updateGlobal: UpdateGlobal = async function updateGlobal( this: MongooseAdapter, @@ -27,25 +26,11 @@ export const updateGlobal: UpdateGlobal = async function updateGlobal( session: await getSession(this, req), } - let result + transform({ adapter: this, data, fields, globalSlug: slug, operation: 'write' }) - const sanitizedData = sanitizeRelationshipIDs({ - config: this.payload.config, - data, - fields, - }) + const result: any = await Model.findOneAndUpdate({ globalType: slug }, data, options) - result = await Model.findOneAndUpdate({ globalType: slug }, sanitizedData, options) - - if (!result) { - return null - } - - result = JSON.parse(JSON.stringify(result)) - - // custom id type reset - result.id = result._id - result = sanitizeInternalFields(result) + transform({ adapter: this, data: result, fields, globalSlug: slug, operation: 'read' }) return result } diff --git a/packages/db-mongodb/src/updateGlobalVersion.ts b/packages/db-mongodb/src/updateGlobalVersion.ts index 3337d63f5b6..9bc4b592eac 100644 --- a/packages/db-mongodb/src/updateGlobalVersion.ts +++ b/packages/db-mongodb/src/updateGlobalVersion.ts @@ -7,7 +7,7 @@ import type { MongooseAdapter } from './index.js' import { buildQuery } from './queries/buildQuery.js' import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js' import { getSession } from './utilities/getSession.js' -import { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js' +import { transform } from './utilities/transform.js' export async function updateGlobalVersion<T extends TypeWithID>( this: MongooseAdapter, @@ -47,26 +47,15 @@ export async function updateGlobalVersion<T extends TypeWithID>( where: whereToUse, }) - const sanitizedData = sanitizeRelationshipIDs({ - config: this.payload.config, - data: versionData, - fields, - }) + transform({ adapter: this, data: versionData, fields, operation: 'write' }) - const doc = await VersionModel.findOneAndUpdate(query, sanitizedData, options) + const doc = await VersionModel.findOneAndUpdate(query, versionData, options) if (!doc) { return null } - const result = JSON.parse(JSON.stringify(doc)) - - const verificationToken = doc._verificationToken + transform({ adapter: this, data: doc, fields, operation: 'read' }) - // custom id type reset - result.id = result._id - if (verificationToken) { - result._verificationToken = verificationToken - } - return result + return doc } diff --git a/packages/db-mongodb/src/updateOne.ts b/packages/db-mongodb/src/updateOne.ts index 569a36a83b7..25dd47ba370 100644 --- a/packages/db-mongodb/src/updateOne.ts +++ b/packages/db-mongodb/src/updateOne.ts @@ -7,8 +7,7 @@ import { buildQuery } from './queries/buildQuery.js' import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js' import { getSession } from './utilities/getSession.js' import { handleError } from './utilities/handleError.js' -import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js' -import { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js' +import { transform } from './utilities/transform.js' export const updateOne: UpdateOne = async function updateOne( this: MongooseAdapter, @@ -39,14 +38,10 @@ export const updateOne: UpdateOne = async function updateOne( let result - const sanitizedData = sanitizeRelationshipIDs({ - config: this.payload.config, - data, - fields, - }) + transform({ adapter: this, data, fields, operation: 'write' }) try { - result = await Model.findOneAndUpdate(query, sanitizedData, options) + result = await Model.findOneAndUpdate(query, data, options) } catch (error) { handleError({ collection, error, req }) } @@ -55,9 +50,7 @@ export const updateOne: UpdateOne = async function updateOne( return null } - result = JSON.parse(JSON.stringify(result)) - result.id = result._id - result = sanitizeInternalFields(result) + transform({ adapter: this, data: result, fields, operation: 'read' }) return result } diff --git a/packages/db-mongodb/src/updateVersion.ts b/packages/db-mongodb/src/updateVersion.ts index 4f9bd5d4c52..a2431388a41 100644 --- a/packages/db-mongodb/src/updateVersion.ts +++ b/packages/db-mongodb/src/updateVersion.ts @@ -7,7 +7,7 @@ import type { MongooseAdapter } from './index.js' import { buildQuery } from './queries/buildQuery.js' import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js' import { getSession } from './utilities/getSession.js' -import { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js' +import { transform } from './utilities/transform.js' export const updateVersion: UpdateVersion = async function updateVersion( this: MongooseAdapter, @@ -45,26 +45,15 @@ export const updateVersion: UpdateVersion = async function updateVersion( where: whereToUse, }) - const sanitizedData = sanitizeRelationshipIDs({ - config: this.payload.config, - data: versionData, - fields, - }) + transform({ adapter: this, data: versionData, fields, operation: 'write' }) - const doc = await VersionModel.findOneAndUpdate(query, sanitizedData, options) + const doc = await VersionModel.findOneAndUpdate(query, versionData, options) if (!doc) { return null } - const result = JSON.parse(JSON.stringify(doc)) - - const verificationToken = doc._verificationToken + transform({ adapter: this, data: doc, fields, operation: 'write' }) - // custom id type reset - result.id = result._id - if (verificationToken) { - result._verificationToken = verificationToken - } - return result + return doc } diff --git a/packages/db-mongodb/src/utilities/sanitizeInternalFields.ts b/packages/db-mongodb/src/utilities/sanitizeInternalFields.ts deleted file mode 100644 index 14ab00da676..00000000000 --- a/packages/db-mongodb/src/utilities/sanitizeInternalFields.ts +++ /dev/null @@ -1,20 +0,0 @@ -const internalFields = ['__v'] - -export const sanitizeInternalFields = <T extends Record<string, unknown>>(incomingDoc: T): T => - Object.entries(incomingDoc).reduce((newDoc, [key, val]): T => { - if (key === '_id') { - return { - ...newDoc, - id: val, - } - } - - if (internalFields.indexOf(key) > -1) { - return newDoc - } - - return { - ...newDoc, - [key]: val, - } - }, {} as T) diff --git a/packages/db-mongodb/src/utilities/sanitizeRelationshipIDs.ts b/packages/db-mongodb/src/utilities/sanitizeRelationshipIDs.ts deleted file mode 100644 index cb699cc2946..00000000000 --- a/packages/db-mongodb/src/utilities/sanitizeRelationshipIDs.ts +++ /dev/null @@ -1,165 +0,0 @@ -import type { CollectionConfig, Field, SanitizedConfig, TraverseFieldsCallback } from 'payload' - -import { Types } from 'mongoose' -import { traverseFields } from 'payload' -import { fieldAffectsData, fieldShouldBeLocalized } from 'payload/shared' - -type Args = { - config: SanitizedConfig - data: Record<string, unknown> - fields: Field[] - parentIsLocalized?: boolean -} - -interface RelationObject { - relationTo: string - value: number | string -} - -function isValidRelationObject(value: unknown): value is RelationObject { - return typeof value === 'object' && value !== null && 'relationTo' in value && 'value' in value -} - -const convertValue = ({ - relatedCollection, - value, -}: { - relatedCollection: CollectionConfig - value: number | string -}): number | string | Types.ObjectId => { - const customIDField = relatedCollection.fields.find( - (field) => fieldAffectsData(field) && field.name === 'id', - ) - - if (customIDField) { - return value - } - - try { - return new Types.ObjectId(value) - } catch { - return value - } -} - -const sanitizeRelationship = ({ config, field, locale, ref, value }) => { - let relatedCollection: CollectionConfig | undefined - let result = value - - const hasManyRelations = typeof field.relationTo !== 'string' - - if (!hasManyRelations) { - relatedCollection = config.collections?.find(({ slug }) => slug === field.relationTo) - } - - if (Array.isArray(value)) { - result = value.map((val) => { - // Handle has many - if (relatedCollection && val && (typeof val === 'string' || typeof val === 'number')) { - return convertValue({ - relatedCollection, - value: val, - }) - } - - // Handle has many - polymorphic - if (isValidRelationObject(val)) { - const relatedCollectionForSingleValue = config.collections?.find( - ({ slug }) => slug === val.relationTo, - ) - - if (relatedCollectionForSingleValue) { - return { - relationTo: val.relationTo, - value: convertValue({ - relatedCollection: relatedCollectionForSingleValue, - value: val.value, - }), - } - } - } - - return val - }) - } - - // Handle has one - polymorphic - if (isValidRelationObject(value)) { - relatedCollection = config.collections?.find(({ slug }) => slug === value.relationTo) - - if (relatedCollection) { - result = { - relationTo: value.relationTo, - value: convertValue({ relatedCollection, value: value.value }), - } - } - } - - // Handle has one - if (relatedCollection && value && (typeof value === 'string' || typeof value === 'number')) { - result = convertValue({ - relatedCollection, - value, - }) - } - if (locale) { - ref[locale] = result - } else { - ref[field.name] = result - } -} - -export const sanitizeRelationshipIDs = ({ - config, - data, - fields, - parentIsLocalized, -}: Args): Record<string, unknown> => { - const sanitize: TraverseFieldsCallback = ({ field, ref }) => { - if (!ref || typeof ref !== 'object') { - return - } - - if (field.type === 'relationship' || field.type === 'upload') { - if (!ref[field.name]) { - return - } - - // handle localized relationships - if (config.localization && fieldShouldBeLocalized({ field, parentIsLocalized })) { - const locales = config.localization.locales - const fieldRef = ref[field.name] - if (typeof fieldRef !== 'object') { - return - } - - for (const { code } of locales) { - const value = ref[field.name][code] - if (value) { - sanitizeRelationship({ config, field, locale: code, ref: fieldRef, value }) - } - } - } else { - // handle non-localized relationships - sanitizeRelationship({ - config, - field, - locale: undefined, - ref, - value: ref[field.name], - }) - } - } - } - - traverseFields({ - callback: sanitize, - config, - fields, - fillEmpty: false, - parentIsLocalized, - ref: data, - }) - - return data -} diff --git a/packages/db-mongodb/src/utilities/sanitizeRelationshipIDs.spec.ts b/packages/db-mongodb/src/utilities/transform.spec.ts similarity index 95% rename from packages/db-mongodb/src/utilities/sanitizeRelationshipIDs.spec.ts rename to packages/db-mongodb/src/utilities/transform.spec.ts index 4bc8c3c64f1..85b5bdb49e8 100644 --- a/packages/db-mongodb/src/utilities/sanitizeRelationshipIDs.spec.ts +++ b/packages/db-mongodb/src/utilities/transform.spec.ts @@ -2,7 +2,8 @@ import { flattenAllFields, type Field, type SanitizedConfig } from 'payload' import { Types } from 'mongoose' -import { sanitizeRelationshipIDs } from './sanitizeRelationshipIDs.js' +import { transform } from './transform.js' +import type { MongooseAdapter } from '../index.js' const flattenRelationshipValues = (obj: Record<string, any>, prefix = ''): Record<string, any> => { return Object.keys(obj).reduce( @@ -297,7 +298,7 @@ const relsData = { }, } -describe('sanitizeRelationshipIDs', () => { +describe('transform', () => { it('should sanitize relationships', () => { const data = { ...relsData, @@ -382,7 +383,18 @@ describe('sanitizeRelationshipIDs', () => { } const flattenValuesBefore = Object.values(flattenRelationshipValues(data)) - sanitizeRelationshipIDs({ config, data, fields: config.collections[0].fields }) + const mockAdapter = { + payload: { + config, + }, + } as MongooseAdapter + + transform({ + adapter: mockAdapter, + operation: 'write', + data, + fields: config.collections[0].fields, + }) const flattenValuesAfter = Object.values(flattenRelationshipValues(data)) flattenValuesAfter.forEach((value, i) => { diff --git a/packages/db-mongodb/src/utilities/transform.ts b/packages/db-mongodb/src/utilities/transform.ts new file mode 100644 index 00000000000..02c7b63cdf8 --- /dev/null +++ b/packages/db-mongodb/src/utilities/transform.ts @@ -0,0 +1,347 @@ +import type { + CollectionConfig, + DateField, + Field, + JoinField, + RelationshipField, + SanitizedConfig, + TraverseFieldsCallback, + UploadField, +} from 'payload' + +import { Types } from 'mongoose' +import { traverseFields } from 'payload' +import { fieldAffectsData, fieldShouldBeLocalized } from 'payload/shared' + +import type { MongooseAdapter } from '../index.js' + +interface RelationObject { + relationTo: string + value: number | string +} + +function isValidRelationObject(value: unknown): value is RelationObject { + return typeof value === 'object' && value !== null && 'relationTo' in value && 'value' in value +} + +const convertRelationshipValue = ({ + operation, + relatedCollection, + validateRelationships, + value, +}: { + operation: Args['operation'] + relatedCollection: CollectionConfig + validateRelationships?: boolean + value: unknown +}) => { + const customIDField = relatedCollection.fields.find( + (field) => fieldAffectsData(field) && field.name === 'id', + ) + + if (operation === 'read') { + if (value instanceof Types.ObjectId) { + return value.toHexString() + } + + return value + } + + if (customIDField) { + return value + } + + if (typeof value === 'string') { + try { + return new Types.ObjectId(value) + } catch (e) { + if (validateRelationships) { + throw e + } + return value + } + } + + return value +} + +const sanitizeRelationship = ({ + config, + field, + locale, + operation, + ref, + validateRelationships, + value, +}: { + config: SanitizedConfig + field: JoinField | RelationshipField | UploadField + locale?: string + operation: Args['operation'] + ref: Record<string, unknown> + validateRelationships?: boolean + value?: unknown +}) => { + if (field.type === 'join') { + if ( + operation === 'read' && + value && + typeof value === 'object' && + 'docs' in value && + Array.isArray(value.docs) + ) { + for (let i = 0; i < value.docs.length; i++) { + const item = value.docs[i] + + if (item instanceof Types.ObjectId) { + value.docs[i] = item.toHexString() + } else if (Array.isArray(field.collection) && item) { + // Fields here for polymorphic joins cannot be determinted, JSON.parse needed + value.docs[i] = JSON.parse(JSON.stringify(value.docs[i])) + } + } + } + + return value + } + let relatedCollection: CollectionConfig | undefined + let result = value + + const hasManyRelations = typeof field.relationTo !== 'string' + + if (!hasManyRelations) { + relatedCollection = config.collections?.find(({ slug }) => slug === field.relationTo) + } + + if (Array.isArray(value)) { + result = value.map((val) => { + // Handle has many - polymorphic + if (isValidRelationObject(val)) { + const relatedCollectionForSingleValue = config.collections?.find( + ({ slug }) => slug === val.relationTo, + ) + + if (relatedCollectionForSingleValue) { + return { + relationTo: val.relationTo, + value: convertRelationshipValue({ + operation, + relatedCollection: relatedCollectionForSingleValue, + validateRelationships, + value: val.value, + }), + } + } + } + + if (relatedCollection) { + return convertRelationshipValue({ + operation, + relatedCollection, + validateRelationships, + value: val, + }) + } + + return val + }) + } + // Handle has one - polymorphic + else if (isValidRelationObject(value)) { + relatedCollection = config.collections?.find(({ slug }) => slug === value.relationTo) + + if (relatedCollection) { + result = { + relationTo: value.relationTo, + value: convertRelationshipValue({ + operation, + relatedCollection, + validateRelationships, + value: value.value, + }), + } + } + } + // Handle has one + else if (relatedCollection) { + result = convertRelationshipValue({ + operation, + relatedCollection, + validateRelationships, + value, + }) + } + + if (locale) { + ref[locale] = result + } else { + ref[field.name] = result + } +} + +const sanitizeDate = ({ + field, + locale, + ref, + value, +}: { + field: DateField + locale?: string + ref: Record<string, unknown> + value: unknown +}) => { + if (!value) { + return + } + + if (value instanceof Date) { + value = value.toISOString() + } + + if (locale) { + ref[locale] = value + } else { + ref[field.name] = value + } +} + +type Args = { + /** instance of the adapter */ + adapter: MongooseAdapter + /** data to transform, can be an array of documents or a single document */ + data: Record<string, unknown> | Record<string, unknown>[] + /** fields accossiated with the data */ + fields: Field[] + /** slug of the global, pass only when the operation is `write` */ + globalSlug?: string + /** + * Type of the operation + * read - sanitizes ObjectIDs, Date to strings. + * write - sanitizes string relationships to ObjectIDs. + */ + operation: 'read' | 'write' + parentIsLocalized?: boolean + /** + * Throw errors on invalid relationships + * @default true + */ + validateRelationships?: boolean +} + +export const transform = ({ + adapter, + data, + fields, + globalSlug, + operation, + parentIsLocalized, + validateRelationships = true, +}: Args) => { + if (Array.isArray(data)) { + for (let i = 0; i < data.length; i++) { + transform({ adapter, data: data[i], fields, globalSlug, operation, validateRelationships }) + } + return + } + + const { + payload: { config }, + } = adapter + + if (operation === 'read') { + delete data['__v'] + data.id = data._id + delete data['_id'] + + if (data.id instanceof Types.ObjectId) { + data.id = data.id.toHexString() + } + } + + if (operation === 'write' && globalSlug) { + data.globalType = globalSlug + } + + const sanitize: TraverseFieldsCallback = ({ field, ref }) => { + if (!ref || typeof ref !== 'object') { + return + } + + if (field.type === 'date' && operation === 'read' && ref[field.name]) { + if (config.localization && fieldShouldBeLocalized({ field, parentIsLocalized })) { + const fieldRef = ref[field.name] + if (!fieldRef || typeof fieldRef !== 'object') { + return + } + + for (const locale of config.localization.localeCodes) { + sanitizeDate({ + field, + ref: fieldRef, + value: fieldRef[locale], + }) + } + } else { + sanitizeDate({ + field, + ref: ref as Record<string, unknown>, + value: ref[field.name], + }) + } + } + + if ( + field.type === 'relationship' || + field.type === 'upload' || + (operation === 'read' && field.type === 'join') + ) { + if (!ref[field.name]) { + return + } + + // handle localized relationships + if (config.localization && fieldShouldBeLocalized({ field, parentIsLocalized })) { + const locales = config.localization.locales + const fieldRef = ref[field.name] + if (typeof fieldRef !== 'object') { + return + } + + for (const { code } of locales) { + const value = ref[field.name][code] + if (value) { + sanitizeRelationship({ + config, + field, + locale: code, + operation, + ref: fieldRef, + validateRelationships, + value, + }) + } + } + } else { + // handle non-localized relationships + sanitizeRelationship({ + config, + field, + locale: undefined, + operation, + ref: ref as Record<string, unknown>, + validateRelationships, + value: ref[field.name], + }) + } + } + } + + traverseFields({ + callback: sanitize, + config, + fields, + fillEmpty: false, + parentIsLocalized, + ref: data, + }) +} diff --git a/test/joins/int.spec.ts b/test/joins/int.spec.ts index 12b535e01cb..a83c3b3f92d 100644 --- a/test/joins/int.spec.ts +++ b/test/joins/int.spec.ts @@ -175,7 +175,10 @@ describe('Joins Field', () => { collection: categoriesSlug, }) - expect(Object.keys(categoryWithPosts)).toStrictEqual(['id', 'group']) + expect(categoryWithPosts).toStrictEqual({ + id: categoryWithPosts.id, + group: categoryWithPosts.group, + }) expect(categoryWithPosts.group.relatedPosts.docs).toHaveLength(10) expect(categoryWithPosts.group.relatedPosts.docs[0]).toHaveProperty('id') diff --git a/test/select/int.spec.ts b/test/select/int.spec.ts index a106a8d2cb4..dd8cf4f2c1a 100644 --- a/test/select/int.spec.ts +++ b/test/select/int.spec.ts @@ -1648,7 +1648,10 @@ describe('Select', () => { }, }) - expect(Object.keys(res)).toStrictEqual(['id', 'text']) + expect(res).toStrictEqual({ + id: res.id, + text: res.text, + }) }) it('should apply select with updateByID', async () => { @@ -1661,7 +1664,10 @@ describe('Select', () => { select: { text: true }, }) - expect(Object.keys(res)).toStrictEqual(['id', 'text']) + expect(res).toStrictEqual({ + id: res.id, + text: res.text, + }) }) it('should apply select with updateBulk', async () => { @@ -1680,7 +1686,10 @@ describe('Select', () => { assert(res.docs[0]) - expect(Object.keys(res.docs[0])).toStrictEqual(['id', 'text']) + expect(res.docs[0]).toStrictEqual({ + id: res.docs[0].id, + text: res.docs[0].text, + }) }) it('should apply select with deleteByID', async () => { @@ -1692,7 +1701,10 @@ describe('Select', () => { select: { text: true }, }) - expect(Object.keys(res)).toStrictEqual(['id', 'text']) + expect(res).toStrictEqual({ + id: res.id, + text: res.text, + }) }) it('should apply select with deleteBulk', async () => { @@ -1710,7 +1722,10 @@ describe('Select', () => { assert(res.docs[0]) - expect(Object.keys(res.docs[0])).toStrictEqual(['id', 'text']) + expect(res.docs[0]).toStrictEqual({ + id: res.docs[0].id, + text: res.docs[0].text, + }) }) it('should apply select with duplicate', async () => { @@ -1722,7 +1737,10 @@ describe('Select', () => { select: { text: true }, }) - expect(Object.keys(res)).toStrictEqual(['id', 'text']) + expect(res).toStrictEqual({ + id: res.id, + text: res.text, + }) }) })
888734dcdf775f416395f8830561c47235bb9019
2022-09-07 04:33:43
Elliot DeNolf
fix: accented label char sanitization for GraphQL (#1080)
false
accented label char sanitization for GraphQL (#1080)
fix
diff --git a/src/graphql/utilities/formatName.spec.ts b/src/graphql/utilities/formatName.spec.ts new file mode 100644 index 00000000000..528ff36a149 --- /dev/null +++ b/src/graphql/utilities/formatName.spec.ts @@ -0,0 +1,18 @@ +/* eslint-disable indent */ +/* eslint-disable jest/prefer-strict-equal */ +import formatName from './formatName'; + +describe('formatName', () => { + it.each` + char | expected + ${'á'} | ${'a'} + ${'è'} | ${'e'} + ${'í'} | ${'i'} + ${'ó'} | ${'o'} + ${'ú'} | ${'u'} + ${'ñ'} | ${'n'} + ${'ü'} | ${'u'} + `('should convert accented character: $char', ({ char, expected }) => { + expect(formatName(char)).toEqual(expected); + }); +}); diff --git a/src/graphql/utilities/formatName.ts b/src/graphql/utilities/formatName.ts index 979b9bf9ccc..d1cde537bc9 100644 --- a/src/graphql/utilities/formatName.ts +++ b/src/graphql/utilities/formatName.ts @@ -10,6 +10,10 @@ const formatName = (string: string): string => { } const formatted = sanitizedString + // Convert accented characters + .normalize('NFKD') + .replace(/[\u0300-\u036f]/g, '') + .replace(/\./g, '_') .replace(/-|\//g, '_') .replace(/\+/g, '_')
0779f8d73da4767e9918b04cc8795e52b2198f4c
2023-03-07 03:16:07
James Mikrut
feat: improves ui performance with thousands of fields
false
improves ui performance with thousands of fields
feat
diff --git a/src/admin/components/forms/field-types/Array/index.tsx b/src/admin/components/forms/field-types/Array/index.tsx index a6eb3de2376..b2a6a5e08ef 100644 --- a/src/admin/components/forms/field-types/Array/index.tsx +++ b/src/admin/components/forms/field-types/Array/index.tsx @@ -321,7 +321,6 @@ const ArrayFieldType: React.FC<Props> = (props) => { /> <RenderFields className={`${baseClass}__fields`} - forceRender readOnly={readOnly} fieldTypes={fieldTypes} permissions={permissions?.fields} diff --git a/src/admin/components/forms/field-types/Blocks/index.tsx b/src/admin/components/forms/field-types/Blocks/index.tsx index 6f6bed1271d..6854fc3a798 100644 --- a/src/admin/components/forms/field-types/Blocks/index.tsx +++ b/src/admin/components/forms/field-types/Blocks/index.tsx @@ -197,6 +197,7 @@ const BlocksField: React.FC<Props> = (props) => { useEffect(() => { const initializeRowState = async () => { const data = formContext.getDataByPath<Row[]>(path); + const preferences = (await getPreference(preferencesKey)) || { fields: {} }; dispatchRows({ type: 'SET_ALL', data: data || [], collapsedState: preferences?.fields?.[path]?.collapsed, initCollapsed }); }; @@ -332,7 +333,6 @@ const BlocksField: React.FC<Props> = (props) => { /> <RenderFields className={`${baseClass}__fields`} - forceRender readOnly={readOnly} fieldTypes={fieldTypes} permissions={permissions?.fields} diff --git a/test/dev.ts b/test/dev.ts index 3265d72ea83..728ed5ad49b 100644 --- a/test/dev.ts +++ b/test/dev.ts @@ -27,7 +27,7 @@ const expressApp = express(); const startDev = async () => { await payload.init({ secret: uuid(), - mongoURL: process.env.MONGO_URL || 'mongodb://localhost/payload', + mongoURL: process.env.MONGO_URL || 'mongodb://127.0.0.1/payload', express: expressApp, email: { logMockCredentials: true,
4acb1336552ff127f7856f3fcd1faf4c58902f78
2024-04-18 23:45:55
Elliot DeNolf
chore: export SendMailOptions
false
export SendMailOptions
chore
diff --git a/packages/payload/src/config/types.ts b/packages/payload/src/config/types.ts index 6ed38693d26..eb5a7bd20d1 100644 --- a/packages/payload/src/config/types.ts +++ b/packages/payload/src/config/types.ts @@ -16,7 +16,7 @@ import type { SanitizedCollectionConfig, } from '../collections/config/types.js' import type { DatabaseAdapterResult } from '../database/types.js' -import type { EmailAdapter } from '../email/types.js' +import type { EmailAdapter, SendMailOptions } from '../email/types.js' import type { GlobalConfig, Globals, SanitizedGlobalConfig } from '../globals/config/types.js' import type { Payload } from '../index.js' import type { PayloadRequest, Where } from '../types/index.js' diff --git a/packages/payload/src/email/types.ts b/packages/payload/src/email/types.ts index 0d4460bf606..6d3677ebc5d 100644 --- a/packages/payload/src/email/types.ts +++ b/packages/payload/src/email/types.ts @@ -1,5 +1,7 @@ import type { SendMailOptions } from 'nodemailer' +export type { SendMailOptions } + export type EmailAdapter< TSendEmailOptions extends SendMailOptions, KSendEmailResponse = unknown,
c45ee0d26bb80452efd736943568f1e4890a0101
2024-08-30 21:55:24
Elliot DeNolf
ci: add drizzle as valid pr title scope [skip ci]
false
add drizzle as valid pr title scope [skip ci]
ci
diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml index 8aac6f53569..9a4cfc53b82 100644 --- a/.github/workflows/pr-title.yml +++ b/.github/workflows/pr-title.yml @@ -39,6 +39,7 @@ jobs: db-mongodb db-postgres db-sqlite + drizzle email-nodemailer eslint graphql
9278eec2b6ae0224cb7234f7e2354bc42ce48ac4
2025-01-14 01:43:54
Elliot DeNolf
fix: better messaging when no arg passed to payload cli (#10550)
false
better messaging when no arg passed to payload cli (#10550)
fix
diff --git a/packages/payload/src/bin/index.ts b/packages/payload/src/bin/index.ts index 637c8142958..0db33cb859a 100755 --- a/packages/payload/src/bin/index.ts +++ b/packages/payload/src/bin/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import { Cron } from 'croner' import minimist from 'minimist' import { pathToFileURL } from 'node:url' @@ -11,7 +12,18 @@ import { generateImportMap } from './generateImportMap/index.js' import { generateTypes } from './generateTypes.js' import { info } from './info.js' import { loadEnv } from './loadEnv.js' -import { migrate } from './migrate.js' +import { migrate, availableCommands as migrateCommands } from './migrate.js' + +// Note: this does not account for any user bin scripts +const availableScripts = [ + 'generate:db-schema', + 'generate:importmap', + 'generate:types', + 'info', + 'jobs:run', + 'run', + ...migrateCommands, +] as const export const bin = async () => { loadEnv() @@ -137,6 +149,8 @@ export const bin = async () => { process.exit(0) } - console.error(`Unknown script: "${script}".`) + console.error(script ? `Unknown command: "${script}"` : 'Please provide a command to run') + console.log(`\nAvailable commands:\n${availableScripts.map((c) => ` - ${c}`).join('\n')}`) + process.exit(1) } diff --git a/packages/payload/src/bin/migrate.ts b/packages/payload/src/bin/migrate.ts index db4d2aa4537..d1dd2ff0c29 100644 --- a/packages/payload/src/bin/migrate.ts +++ b/packages/payload/src/bin/migrate.ts @@ -14,7 +14,7 @@ const prettySyncLogger = { loggerOptions: {}, } -const availableCommands = [ +export const availableCommands = [ 'migrate', 'migrate:create', 'migrate:down',
27ea4f76f03ffad94549532170eba952ff28ed2d
2024-03-02 00:08:39
Alessio Gravili
feat(richtext-lexical): slateToLexicalFeature
false
slateToLexicalFeature
feat
diff --git a/packages/richtext-lexical/src/field/features/migrations/lexicalPluginToLexical/feature.client.tsx b/packages/richtext-lexical/src/field/features/migrations/lexicalPluginToLexical/feature.client.tsx index df3b604aa10..bac35753510 100644 --- a/packages/richtext-lexical/src/field/features/migrations/lexicalPluginToLexical/feature.client.tsx +++ b/packages/richtext-lexical/src/field/features/migrations/lexicalPluginToLexical/feature.client.tsx @@ -1,7 +1,7 @@ 'use client' import type { FeatureProviderProviderClient } from '../../types' -import type { PayloadPluginLexicalData } from './converter/types' +import type { LexicalPluginNodeConverter, PayloadPluginLexicalData } from './converter/types' import { createClientComponent } from '../../createClientComponent' import { convertLexicalPluginToLexical } from './converter' @@ -11,7 +11,7 @@ const LexicalPluginToLexicalFeatureClient: FeatureProviderProviderClient<null> = return { clientFeatureProps: props, feature: ({ clientFunctions, resolvedFeatures }) => { - const converters = Object.values(clientFunctions) + const converters: LexicalPluginNodeConverter[] = Object.values(clientFunctions) return { clientFeatureProps: props, diff --git a/packages/richtext-lexical/src/field/features/migrations/lexicalPluginToLexical/feature.server.ts b/packages/richtext-lexical/src/field/features/migrations/lexicalPluginToLexical/feature.server.ts index bfdde9d60af..b7b2adb1e6d 100644 --- a/packages/richtext-lexical/src/field/features/migrations/lexicalPluginToLexical/feature.server.ts +++ b/packages/richtext-lexical/src/field/features/migrations/lexicalPluginToLexical/feature.server.ts @@ -29,7 +29,9 @@ export const LexicalPluginToLexicalFeature: FeatureProviderProviderServer< if (props?.converters && typeof props?.converters === 'function') { converters = props.converters({ defaultConverters }) - } else if (!props?.converters) { + } else if (props.converters && typeof props?.converters !== 'function') { + converters = props.converters + } else { converters = defaultConverters } diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/blockquote/client.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/blockquote/client.ts new file mode 100644 index 00000000000..35f8baa83cf --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/blockquote/client.ts @@ -0,0 +1,6 @@ +'use client' + +import { createFeaturePropComponent } from '../../../../../createFeaturePropComponent' +import { _SlateBlockquoteConverter } from './converter' + +export const BlockQuoteConverterClient = createFeaturePropComponent(_SlateBlockquoteConverter) diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/blockquote.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/blockquote/converter.ts similarity index 67% rename from packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/blockquote.ts rename to packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/blockquote/converter.ts index eacda1c90f9..9166a10be15 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/blockquote.ts +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/blockquote/converter.ts @@ -1,10 +1,10 @@ import type { SerializedQuoteNode } from '@lexical/rich-text' -import type { SlateNodeConverter } from '../types' +import type { SlateNodeConverter } from '../../types' -import { convertSlateNodesToLexical } from '../index' +import { convertSlateNodesToLexical } from '../..' -export const SlateBlockquoteConverter: SlateNodeConverter = { +export const _SlateBlockquoteConverter: SlateNodeConverter = { converter({ converters, slateNode }) { return { type: 'quote', @@ -12,7 +12,7 @@ export const SlateBlockquoteConverter: SlateNodeConverter = { canContainParagraphs: false, converters, parentNodeType: 'quote', - slateNodes: slateNode.children || [], + slateNodes: slateNode.children, }), direction: 'ltr', format: '', diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/blockquote/index.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/blockquote/index.ts new file mode 100644 index 00000000000..1dd41f0cf07 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/blockquote/index.ts @@ -0,0 +1,9 @@ +import type { SlateNodeConverterProvider } from '../../types' + +import { BlockQuoteConverterClient } from './client' +import { _SlateBlockquoteConverter } from './converter' + +export const SlateBlockquoteConverter: SlateNodeConverterProvider = { + ClientComponent: BlockQuoteConverterClient, + converter: _SlateBlockquoteConverter, +} diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/heading/client.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/heading/client.ts new file mode 100644 index 00000000000..98f37f02946 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/heading/client.ts @@ -0,0 +1,5 @@ +'use client' +import { createFeaturePropComponent } from '../../../../../createFeaturePropComponent' +import { _SlateHeadingConverter } from './converter' + +export const HeadingConverterClient = createFeaturePropComponent(_SlateHeadingConverter) diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/heading.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/heading/converter.ts similarity index 74% rename from packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/heading.ts rename to packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/heading/converter.ts index 290c37470f9..94ce756e60e 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/heading.ts +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/heading/converter.ts @@ -1,10 +1,10 @@ import type { SerializedHeadingNode } from '@lexical/rich-text' -import type { SlateNodeConverter } from '../types' +import type { SlateNodeConverter } from '../../types' -import { convertSlateNodesToLexical } from '..' +import { convertSlateNodesToLexical } from '../..' -export const SlateHeadingConverter: SlateNodeConverter = { +export const _SlateHeadingConverter: SlateNodeConverter = { converter({ converters, slateNode }) { return { type: 'heading', @@ -12,7 +12,7 @@ export const SlateHeadingConverter: SlateNodeConverter = { canContainParagraphs: false, converters, parentNodeType: 'heading', - slateNodes: slateNode.children || [], + slateNodes: slateNode.children, }), direction: 'ltr', format: '', diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/heading/index.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/heading/index.ts new file mode 100644 index 00000000000..1881deecb7d --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/heading/index.ts @@ -0,0 +1,9 @@ +import type { SlateNodeConverterProvider } from '../../types' + +import { HeadingConverterClient } from './client' +import { _SlateHeadingConverter } from './converter' + +export const SlateHeadingConverter: SlateNodeConverterProvider = { + ClientComponent: HeadingConverterClient, + converter: _SlateHeadingConverter, +} diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/indent.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/indent.ts deleted file mode 100644 index 5641ca934aa..00000000000 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/indent.ts +++ /dev/null @@ -1,65 +0,0 @@ -import type { SerializedLexicalNode, SerializedParagraphNode } from 'lexical' - -import type { SlateNodeConverter } from '../types' - -import { convertSlateNodesToLexical } from '..' - -export const SlateIndentConverter: SlateNodeConverter = { - converter({ converters, slateNode }) { - console.log('slateToLexical > IndentConverter > converter', JSON.stringify(slateNode, null, 2)) - const convertChildren = (node: any, indentLevel: number = 0): SerializedLexicalNode => { - if ( - (node?.type && (!node.children || node.type !== 'indent')) || - (!node?.type && node?.text) - ) { - console.log( - 'slateToLexical > IndentConverter > convertChildren > node', - JSON.stringify(node, null, 2), - ) - console.log( - 'slateToLexical > IndentConverter > convertChildren > nodeOutput', - JSON.stringify( - convertSlateNodesToLexical({ - canContainParagraphs: false, - converters, - parentNodeType: 'indent', - slateNodes: [node], - }), - - null, - 2, - ), - ) - - return { - ...convertSlateNodesToLexical({ - canContainParagraphs: false, - converters, - parentNodeType: 'indent', - slateNodes: [node], - })[0], - indent: indentLevel, - } as const as SerializedLexicalNode - } - - const children = node.children.map((child: any) => convertChildren(child, indentLevel + 1)) - console.log('slateToLexical > IndentConverter > children', JSON.stringify(children, null, 2)) - return { - type: 'paragraph', - children: children, - direction: 'ltr', - format: '', - indent: indentLevel, - version: 1, - } as const as SerializedParagraphNode - } - - console.log( - 'slateToLexical > IndentConverter > output', - JSON.stringify(convertChildren(slateNode), null, 2), - ) - - return convertChildren(slateNode) - }, - nodeTypes: ['indent'], -} diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/indent/client.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/indent/client.ts new file mode 100644 index 00000000000..dad6c3b2ec5 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/indent/client.ts @@ -0,0 +1,6 @@ +'use client' + +import { createFeaturePropComponent } from '../../../../../createFeaturePropComponent' +import { _SlateIndentConverter } from './converter' + +export const IndentConverterClient = createFeaturePropComponent(_SlateIndentConverter) diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/indent/converter.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/indent/converter.ts new file mode 100644 index 00000000000..6f500411087 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/indent/converter.ts @@ -0,0 +1,39 @@ +import type { SerializedLexicalNode, SerializedParagraphNode } from 'lexical' + +import type { SlateNodeConverter } from '../../types' + +import { convertSlateNodesToLexical } from '../..' + +export const _SlateIndentConverter: SlateNodeConverter = { + converter({ converters, slateNode }) { + const convertChildren = (node: any, indentLevel: number = 0): SerializedLexicalNode => { + if ( + (node?.type && (!node.children || node.type !== 'indent')) || + (!node?.type && node?.text) + ) { + return { + ...convertSlateNodesToLexical({ + canContainParagraphs: false, + converters, + parentNodeType: 'indent', + slateNodes: [node], + })[0], + indent: indentLevel, + } as const as SerializedLexicalNode + } + + const children = node.children.map((child: any) => convertChildren(child, indentLevel + 1)) + return { + type: 'paragraph', + children, + direction: 'ltr', + format: '', + indent: indentLevel, + version: 1, + } as const as SerializedParagraphNode + } + + return convertChildren(slateNode) + }, + nodeTypes: ['indent'], +} diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/indent/index.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/indent/index.ts new file mode 100644 index 00000000000..5dccb8b2a19 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/indent/index.ts @@ -0,0 +1,9 @@ +import type { SlateNodeConverterProvider } from '../../types' + +import { IndentConverterClient } from './client' +import { _SlateIndentConverter } from './converter' + +export const SlateIndentConverter: SlateNodeConverterProvider = { + ClientComponent: IndentConverterClient, + converter: _SlateIndentConverter, +} diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/link/client.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/link/client.ts new file mode 100644 index 00000000000..91e3515eb05 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/link/client.ts @@ -0,0 +1,6 @@ +'use client' + +import { createFeaturePropComponent } from '../../../../../createFeaturePropComponent' +import { _SlateLinkConverter } from './converter' + +export const LinkConverterClient = createFeaturePropComponent(_SlateLinkConverter) diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/link.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/link/converter.ts similarity index 68% rename from packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/link.ts rename to packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/link/converter.ts index 285fce3cae0..99eb4043b67 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/link.ts +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/link/converter.ts @@ -1,9 +1,9 @@ -import type { SerializedLinkNode } from '../../../../link/nodes/LinkNode' -import type { SlateNodeConverter } from '../types' +import type { SerializedLinkNode } from '../../../../../link/nodes/types' +import type { SlateNodeConverter } from '../../types' -import { convertSlateNodesToLexical } from '..' +import { convertSlateNodesToLexical } from '../..' -export const SlateLinkConverter: SlateNodeConverter = { +export const _SlateLinkConverter: SlateNodeConverter = { converter({ converters, slateNode }) { return { type: 'link', @@ -11,7 +11,7 @@ export const SlateLinkConverter: SlateNodeConverter = { canContainParagraphs: false, converters, parentNodeType: 'link', - slateNodes: slateNode.children || [], + slateNodes: slateNode.children, }), direction: 'ltr', fields: { diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/link/index.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/link/index.ts new file mode 100644 index 00000000000..2736638a2f1 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/link/index.ts @@ -0,0 +1,9 @@ +import type { SlateNodeConverterProvider } from '../../types' + +import { LinkConverterClient } from './client' +import { _SlateLinkConverter } from './converter' + +export const SlateLinkConverter: SlateNodeConverterProvider = { + ClientComponent: LinkConverterClient, + converter: _SlateLinkConverter, +} diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/listItem/client.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/listItem/client.ts new file mode 100644 index 00000000000..36c9f2ba53d --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/listItem/client.ts @@ -0,0 +1,6 @@ +'use client' + +import { createFeaturePropComponent } from '../../../../../createFeaturePropComponent' +import { _SlateListItemConverter } from './converter' + +export const ListItemConverterClient = createFeaturePropComponent(_SlateListItemConverter) diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/listItem.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/listItem/converter.ts similarity index 70% rename from packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/listItem.ts rename to packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/listItem/converter.ts index d7905871a3c..40b4b44acd9 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/listItem.ts +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/listItem/converter.ts @@ -1,10 +1,10 @@ import type { SerializedListItemNode } from '@lexical/list' -import type { SlateNodeConverter } from '../types' +import type { SlateNodeConverter } from '../../types' -import { convertSlateNodesToLexical } from '..' +import { convertSlateNodesToLexical } from '../..' -export const SlateListItemConverter: SlateNodeConverter = { +export const _SlateListItemConverter: SlateNodeConverter = { converter({ childIndex, converters, slateNode }) { return { type: 'listitem', @@ -13,7 +13,7 @@ export const SlateListItemConverter: SlateNodeConverter = { canContainParagraphs: false, converters, parentNodeType: 'listitem', - slateNodes: slateNode.children || [], + slateNodes: slateNode.children, }), direction: 'ltr', format: '', diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/listItem/index.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/listItem/index.ts new file mode 100644 index 00000000000..12b446f1623 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/listItem/index.ts @@ -0,0 +1,9 @@ +import type { SlateNodeConverterProvider } from '../../types' + +import { ListItemConverterClient } from './client' +import { _SlateListItemConverter } from './converter' + +export const SlateListItemConverter: SlateNodeConverterProvider = { + ClientComponent: ListItemConverterClient, + converter: _SlateListItemConverter, +} diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/orderedList/client.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/orderedList/client.ts new file mode 100644 index 00000000000..f0a9613d911 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/orderedList/client.ts @@ -0,0 +1,6 @@ +'use client' + +import { createFeaturePropComponent } from '../../../../../createFeaturePropComponent' +import { _SlateOrderedListConverter } from './converter' + +export const OrderedListConverterClient = createFeaturePropComponent(_SlateOrderedListConverter) diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/orderedList.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/orderedList/converter.ts similarity index 69% rename from packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/orderedList.ts rename to packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/orderedList/converter.ts index 7d34a27a285..57a8f695d62 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/orderedList.ts +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/orderedList/converter.ts @@ -1,10 +1,10 @@ import type { SerializedListNode } from '@lexical/list' -import type { SlateNodeConverter } from '../types' +import type { SlateNodeConverter } from '../../types' -import { convertSlateNodesToLexical } from '..' +import { convertSlateNodesToLexical } from '../..' -export const SlateOrderedListConverter: SlateNodeConverter = { +export const _SlateOrderedListConverter: SlateNodeConverter = { converter({ converters, slateNode }) { return { type: 'list', @@ -12,7 +12,7 @@ export const SlateOrderedListConverter: SlateNodeConverter = { canContainParagraphs: false, converters, parentNodeType: 'list', - slateNodes: slateNode.children || [], + slateNodes: slateNode.children, }), direction: 'ltr', format: '', diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/orderedList/index.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/orderedList/index.ts new file mode 100644 index 00000000000..10c0bf4fa46 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/orderedList/index.ts @@ -0,0 +1,9 @@ +import type { SlateNodeConverterProvider } from '../../types' + +import { OrderedListConverterClient } from './client' +import { _SlateOrderedListConverter } from './converter' + +export const SlateOrderedListConverter: SlateNodeConverterProvider = { + ClientComponent: OrderedListConverterClient, + converter: _SlateOrderedListConverter, +} diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/relationship/client.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/relationship/client.ts new file mode 100644 index 00000000000..9ff754565a5 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/relationship/client.ts @@ -0,0 +1,6 @@ +'use client' + +import { createFeaturePropComponent } from '../../../../../createFeaturePropComponent' +import { _SlateRelationshipConverter } from './converter' + +export const RelationshipConverterClient = createFeaturePropComponent(_SlateRelationshipConverter) diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/relationship.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/relationship/converter.ts similarity index 69% rename from packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/relationship.ts rename to packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/relationship/converter.ts index a2be41653e6..4c662e16618 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/relationship.ts +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/relationship/converter.ts @@ -1,7 +1,7 @@ -import type { SerializedRelationshipNode } from '../../../../../..' -import type { SlateNodeConverter } from '../types' +import type { SerializedRelationshipNode } from '../../../../../relationship/nodes/RelationshipNode' +import type { SlateNodeConverter } from '../../types' -export const SlateRelationshipConverter: SlateNodeConverter = { +export const _SlateRelationshipConverter: SlateNodeConverter = { converter({ slateNode }) { return { type: 'relationship', diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/relationship/index.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/relationship/index.ts new file mode 100644 index 00000000000..efad39059b4 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/relationship/index.ts @@ -0,0 +1,9 @@ +import type { SlateNodeConverterProvider } from '../../types' + +import { RelationshipConverterClient } from './client' +import { _SlateRelationshipConverter } from './converter' + +export const SlateRelationshipConverter: SlateNodeConverterProvider = { + ClientComponent: RelationshipConverterClient, + converter: _SlateRelationshipConverter, +} diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unknown/client.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unknown/client.ts new file mode 100644 index 00000000000..eb5618cf8eb --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unknown/client.ts @@ -0,0 +1,6 @@ +'use client' + +import { createFeaturePropComponent } from '../../../../../createFeaturePropComponent' +import { _SlateUnknownConverter } from './converter' + +export const UnknownConverterClient = createFeaturePropComponent(_SlateUnknownConverter) diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unknown.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unknown/converter.ts similarity index 62% rename from packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unknown.ts rename to packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unknown/converter.ts index 8f239f122bd..7e10f81aede 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unknown.ts +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unknown/converter.ts @@ -1,9 +1,9 @@ -import type { SerializedUnknownConvertedNode } from '../../nodes/unknownConvertedNode' -import type { SlateNodeConverter } from '../types' +import type { SerializedUnknownConvertedNode } from '../../../nodes/unknownConvertedNode' +import type { SlateNodeConverter } from '../../types' -import { convertSlateNodesToLexical } from '..' +import { convertSlateNodesToLexical } from '../..' -export const SlateUnknownConverter: SlateNodeConverter = { +export const _SlateUnknownConverter: SlateNodeConverter = { converter({ converters, slateNode }) { return { type: 'unknownConverted', @@ -11,7 +11,7 @@ export const SlateUnknownConverter: SlateNodeConverter = { canContainParagraphs: false, converters, parentNodeType: 'unknownConverted', - slateNodes: slateNode.children || [], + slateNodes: slateNode.children, }), data: { nodeData: slateNode, diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unknown/index.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unknown/index.ts new file mode 100644 index 00000000000..9282825e9fe --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unknown/index.ts @@ -0,0 +1,9 @@ +import type { SlateNodeConverterProvider } from '../../types' + +import { UnknownConverterClient } from './client' +import { _SlateUnknownConverter } from './converter' + +export const SlateUnknownConverter: SlateNodeConverterProvider = { + ClientComponent: UnknownConverterClient, + converter: _SlateUnknownConverter, +} diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unorderedList/client.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unorderedList/client.ts new file mode 100644 index 00000000000..9db90af0b07 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unorderedList/client.ts @@ -0,0 +1,6 @@ +'use client' + +import { createFeaturePropComponent } from '../../../../../createFeaturePropComponent' +import { _SlateUnorderedListConverter } from './converter' + +export const UnorderedListConverterClient = createFeaturePropComponent(_SlateUnorderedListConverter) diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unorderedList.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unorderedList/converter.ts similarity index 69% rename from packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unorderedList.ts rename to packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unorderedList/converter.ts index f68e4428dcb..fb041f98f7a 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unorderedList.ts +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unorderedList/converter.ts @@ -1,10 +1,10 @@ import type { SerializedListNode } from '@lexical/list' -import type { SlateNodeConverter } from '../types' +import type { SlateNodeConverter } from '../../types' -import { convertSlateNodesToLexical } from '..' +import { convertSlateNodesToLexical } from '../..' -export const SlateUnorderedListConverter: SlateNodeConverter = { +export const _SlateUnorderedListConverter: SlateNodeConverter = { converter({ converters, slateNode }) { return { type: 'list', @@ -12,7 +12,7 @@ export const SlateUnorderedListConverter: SlateNodeConverter = { canContainParagraphs: false, converters, parentNodeType: 'list', - slateNodes: slateNode.children || [], + slateNodes: slateNode.children, }), direction: 'ltr', format: '', diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unorderedList/index.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unorderedList/index.ts new file mode 100644 index 00000000000..6cd10db76e6 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/unorderedList/index.ts @@ -0,0 +1,9 @@ +import type { SlateNodeConverterProvider } from '../../types' + +import { UnorderedListConverterClient } from './client' +import { _SlateUnorderedListConverter } from './converter' + +export const SlateUnorderedListConverter: SlateNodeConverterProvider = { + ClientComponent: UnorderedListConverterClient, + converter: _SlateUnorderedListConverter, +} diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/upload/client.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/upload/client.ts new file mode 100644 index 00000000000..7f7fcff7345 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/upload/client.ts @@ -0,0 +1,6 @@ +'use client' + +import { createFeaturePropComponent } from '../../../../../createFeaturePropComponent' +import { _SlateUploadConverter } from './converter' + +export const UploadConverterClient = createFeaturePropComponent(_SlateUploadConverter) diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/upload.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/upload/converter.ts similarity index 62% rename from packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/upload.ts rename to packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/upload/converter.ts index 64f35dabe5d..7fe402c3e77 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/upload.ts +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/upload/converter.ts @@ -1,7 +1,7 @@ -import type { SerializedUploadNode } from '../../../../../..' -import type { SlateNodeConverter } from '../types' +import type { SerializedUploadNode } from '../../../../../upload/nodes/UploadNode' +import type { SlateNodeConverter } from '../../types' -export const SlateUploadConverter: SlateNodeConverter = { +export const _SlateUploadConverter: SlateNodeConverter = { converter({ slateNode }) { return { type: 'upload', diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/upload/index.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/upload/index.ts new file mode 100644 index 00000000000..7c5d5a71a93 --- /dev/null +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/converters/upload/index.ts @@ -0,0 +1,9 @@ +import type { SlateNodeConverterProvider } from '../../types' + +import { UploadConverterClient } from './client' +import { _SlateUploadConverter } from './converter' + +export const SlateUploadConverter: SlateNodeConverterProvider = { + ClientComponent: UploadConverterClient, + converter: _SlateUploadConverter, +} diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/defaultConverters.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/defaultConverters.ts index 59a35548b8e..98f87d403ba 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/defaultConverters.ts +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/defaultConverters.ts @@ -1,4 +1,4 @@ -import type { SlateNodeConverter } from './types' +import type { SlateNodeConverterProvider } from './types' import { SlateBlockquoteConverter } from './converters/blockquote' import { SlateHeadingConverter } from './converters/heading' @@ -11,15 +11,15 @@ import { SlateUnknownConverter } from './converters/unknown' import { SlateUnorderedListConverter } from './converters/unorderedList' import { SlateUploadConverter } from './converters/upload' -export const defaultSlateConverters: SlateNodeConverter[] = [ - SlateUnknownConverter, - SlateUploadConverter, - SlateUnorderedListConverter, - SlateOrderedListConverter, - SlateRelationshipConverter, - SlateListItemConverter, - SlateLinkConverter, +export const defaultSlateConverters: SlateNodeConverterProvider[] = [ SlateBlockquoteConverter, SlateHeadingConverter, SlateIndentConverter, + SlateLinkConverter, + SlateListItemConverter, + SlateOrderedListConverter, + SlateRelationshipConverter, + SlateUnorderedListConverter, + SlateUploadConverter, + SlateUnknownConverter, ] diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/index.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/index.ts index 77540de71b4..6b79b2418d5 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/index.ts +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/index.ts @@ -40,13 +40,16 @@ export function convertSlateNodesToLexical({ slateNodes, }: { canContainParagraphs: boolean - converters: SlateNodeConverter[] + converters: SlateNodeConverter[] | undefined /** * Type of the parent lexical node (not the type of the original, parent slate type) */ parentNodeType: string slateNodes: SlateNode[] }): SerializedLexicalNode[] { + if (!converters?.length) { + return [] + } const unknownConverter = converters.find((converter) => converter.nodeTypes.includes('unknown')) return ( slateNodes.map((slateNode, i) => { diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/types.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/types.ts index 3710efe87a0..b775315caea 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/types.ts +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/converter/types.ts @@ -1,4 +1,5 @@ import type { SerializedLexicalNode } from 'lexical' +import type React from 'react' export type SlateNodeConverter<T extends SerializedLexicalNode = SerializedLexicalNode> = { converter: ({ @@ -20,3 +21,13 @@ export type SlateNode = { children?: SlateNode[] type?: string // doesn't always have type, e.g. for paragraphs } + +export type SlateNodeConverterClientComponent = React.FC<{ + componentKey: string + featureKey: string +}> + +export type SlateNodeConverterProvider = { + ClientComponent: SlateNodeConverterClientComponent + converter: SlateNodeConverter +} diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/feature.client.tsx b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/feature.client.tsx index 2fc5f060a90..2a92031f5f9 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/feature.client.tsx +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/feature.client.tsx @@ -7,37 +7,35 @@ import { createClientComponent } from '../../createClientComponent' import { convertSlateToLexical } from './converter' import { UnknownConvertedNode } from './nodes/unknownConvertedNode' -export type SlateToLexicalFeatureClientProps = { - converters: SlateNodeConverter[] -} - -const SlateToLexicalFeatureClient: FeatureProviderProviderClient< - SlateToLexicalFeatureClientProps -> = (props) => { +const SlateToLexicalFeatureClient: FeatureProviderProviderClient<undefined> = (props) => { return { clientFeatureProps: props, - feature: () => ({ - clientFeatureProps: props, - hooks: { - load({ incomingEditorState }) { - if ( - !incomingEditorState || - !Array.isArray(incomingEditorState) || - 'root' in incomingEditorState - ) { - // incomingEditorState null or not from Slate - return incomingEditorState - } - // Slate => convert to lexical + feature: ({ clientFunctions }) => { + const converters: SlateNodeConverter[] = Object.values(clientFunctions) + + return { + clientFeatureProps: props, + hooks: { + load({ incomingEditorState }) { + if ( + !incomingEditorState || + !Array.isArray(incomingEditorState) || + 'root' in incomingEditorState + ) { + // incomingEditorState null or not from Slate + return incomingEditorState + } + // Slate => convert to lexical - return convertSlateToLexical({ - converters: props.converters, - slateData: incomingEditorState, - }) + return convertSlateToLexical({ + converters, + slateData: incomingEditorState, + }) + }, }, - }, - nodes: [UnknownConvertedNode], - }), + nodes: [UnknownConvertedNode], + } + }, } } diff --git a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/feature.server.ts b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/feature.server.ts index 3a22d598ede..ee0de870eea 100644 --- a/packages/richtext-lexical/src/field/features/migrations/slateToLexical/feature.server.ts +++ b/packages/richtext-lexical/src/field/features/migrations/slateToLexical/feature.server.ts @@ -1,6 +1,7 @@ +import type React from 'react' + import type { FeatureProviderProviderServer } from '../../types' -import type { SlateNodeConverter } from './converter/types' -import type { SlateToLexicalFeatureClientProps } from './feature.client' +import type { SlateNodeConverterProvider } from './converter/types' import { defaultSlateConverters } from './converter/defaultConverters' import { SlateToLexicalFeatureClientComponent } from './feature.client' @@ -8,32 +9,52 @@ import { UnknownConvertedNode } from './nodes/unknownConvertedNode' export type SlateToLexicalFeatureProps = { converters?: - | (({ defaultConverters }: { defaultConverters: SlateNodeConverter[] }) => SlateNodeConverter[]) - | SlateNodeConverter[] + | (({ + defaultConverters, + }: { + defaultConverters: SlateNodeConverterProvider[] + }) => SlateNodeConverterProvider[]) + | SlateNodeConverterProvider[] } export const SlateToLexicalFeature: FeatureProviderProviderServer< SlateToLexicalFeatureProps, - SlateToLexicalFeatureClientProps + undefined > = (props) => { if (!props) { props = {} } - props.converters = - props?.converters && typeof props?.converters === 'function' - ? props.converters({ defaultConverters: defaultSlateConverters }) - : (props?.converters as SlateNodeConverter[]) || defaultSlateConverters - - const clientProps: SlateToLexicalFeatureClientProps = { - converters: props.converters, + let converters: SlateNodeConverterProvider[] = [] + if (props?.converters && typeof props?.converters === 'function') { + converters = props.converters({ defaultConverters: defaultSlateConverters }) + } else if (props.converters && typeof props?.converters !== 'function') { + converters = props.converters + } else { + converters = defaultSlateConverters } + props.converters = converters + return { feature: () => { return { ClientComponent: SlateToLexicalFeatureClientComponent, - clientFeatureProps: clientProps, + clientFeatureProps: null, + generateComponentMap: () => { + const map: { + [key: string]: React.FC + } = {} + + for (const converter of converters) { + if (converter.ClientComponent) { + const key = converter.converter.nodeTypes.join('-') + map[key] = converter.ClientComponent + } + } + + return map + }, nodes: [ { node: UnknownConvertedNode, diff --git a/test/buildConfigWithDefaults.ts b/test/buildConfigWithDefaults.ts index 0f24e54bb66..78c084736fb 100644 --- a/test/buildConfigWithDefaults.ts +++ b/test/buildConfigWithDefaults.ts @@ -8,7 +8,6 @@ import { IndentFeature, InlineCodeFeature, ItalicFeature, - LexicalPluginToLexicalFeature, LinkFeature, OrderedListFeature, StrikethroughFeature, @@ -108,7 +107,6 @@ export function buildConfigWithDefaults(testConfig?: Partial<Config>): Promise<S SuperscriptFeature(), InlineCodeFeature(), TreeViewFeature(), - LexicalPluginToLexicalFeature(), HeadingFeature(), IndentFeature(), BlocksFeature({
07c3f757e63506d5a93864baf1d58aa21c47a740
2022-01-04 03:52:37
James
chore: beta release
false
beta release
chore
diff --git a/CHANGELOG.md b/CHANGELOG.md index 22a1e48dc56..69fda915c88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.14.1-beta.0](https://github.com/payloadcms/payload/compare/v0.14.0...v0.14.1-beta.0) (2022-01-03) + + +### Features + +* builds a way for multipart/form-data reqs to retain non-string values ([65b0ad7](https://github.com/payloadcms/payload/commit/65b0ad7f084a9c279a1e4fb799542f97c645653d)) + # [0.14.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.14.0) (2022-01-03) diff --git a/package.json b/package.json index eb5d408b52c..3caee287120 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload", - "version": "0.14.0", + "version": "0.14.1-beta.0", "description": "Node, React and MongoDB Headless CMS and Application Framework", "license": "SEE LICENSE IN license.md", "author": {
00a1ce754acf695ad38be35bb032be47b3affe9d
2023-10-24 23:40:14
Elliot DeNolf
ci: conventional commits changelog (#3843)
false
conventional commits changelog (#3843)
ci
diff --git a/changelog.config.js b/changelog.config.js new file mode 100644 index 00000000000..d7dbff7b883 --- /dev/null +++ b/changelog.config.js @@ -0,0 +1,39 @@ +module.exports = { + // gitRawCommitsOpts: { + // from: 'v2.0.9', + // path: 'packages/payload', + // }, + // infile: 'CHANGELOG.md', + options: { + preset: { + name: 'conventionalcommits', + types: [ + { section: 'Features', type: 'feat' }, + { section: 'Features', type: 'feature' }, + { section: 'Bug Fixes', type: 'fix' }, + { section: 'Documentation', type: 'docs' }, + ], + }, + }, + // outfile: 'NEW.md', + writerOpts: { + commitGroupsSort: (a, b) => { + const groupOrder = ['Features', 'Bug Fixes', 'Documentation'] + return groupOrder.indexOf(a.title) - groupOrder.indexOf(b.title) + }, + + // Scoped commits at the end, alphabetical sort + commitsSort: (a, b) => { + if (a.scope || b.scope) { + if (!a.scope) return -1 + if (!b.scope) return 1 + return a.scope === b.scope + ? a.subject.localeCompare(b.subject) + : a.scope.localeCompare(b.scope) + } + + // Alphabetical sort + return a.subject.localeCompare(b.subject) + }, + }, +} diff --git a/package.json b/package.json index d81d0a0504d..92a77118dc0 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,10 @@ "@swc/register": "0.1.10", "@testing-library/jest-dom": "5.17.0", "@testing-library/react": "13.4.0", + "@types/concat-stream": "^2.0.1", + "@types/conventional-changelog": "^3.1.4", + "@types/conventional-changelog-core": "^4.2.5", + "@types/conventional-changelog-preset-loader": "^2.3.4", "@types/fs-extra": "^11.0.2", "@types/jest": "29.5.4", "@types/minimist": "1.2.2", @@ -50,8 +54,13 @@ "@types/semver": "^7.5.3", "@types/shelljs": "0.8.12", "@types/testing-library__jest-dom": "5.14.8", + "add-stream": "^1.0.0", "chalk": "^5.3.0", "chalk-template": "1.1.0", + "concat-stream": "^2.0.0", + "conventional-changelog": "^5.1.0", + "conventional-changelog-core": "^7.0.0", + "conventional-changelog-preset-loader": "^4.1.0", "copyfiles": "2.4.1", "cross-env": "7.0.3", "dotenv": "8.6.0", @@ -59,6 +68,7 @@ "form-data": "3.0.1", "fs-extra": "10.1.0", "get-port": "5.1.1", + "get-stream": "6.0.1", "glob": "8.1.0", "graphql-request": "6.1.0", "husky": "^8.0.3", @@ -74,12 +84,14 @@ "prettier": "^3.0.3", "prompts": "2.4.2", "qs": "6.11.2", + "read-stream": "^2.1.1", "rimraf": "3.0.2", "semver": "^7.5.4", "shelljs": "0.8.5", "simple-git": "^3.20.0", "slash": "3.0.0", "slate": "0.91.4", + "tempfile": "^3.0.0", "ts-node": "10.9.1", "tsx": "^3.13.0", "turbo": "^1.10.15", diff --git a/packages/live-preview/asdf.txt b/packages/live-preview/asdf.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d995f09c263..1bd8f2e8b1e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,6 +39,18 @@ importers: '@testing-library/react': specifier: 13.4.0 version: 13.4.0([email protected])([email protected]) + '@types/concat-stream': + specifier: ^2.0.1 + version: 2.0.1 + '@types/conventional-changelog': + specifier: ^3.1.4 + version: 3.1.4 + '@types/conventional-changelog-core': + specifier: ^4.2.5 + version: 4.2.5 + '@types/conventional-changelog-preset-loader': + specifier: ^2.3.4 + version: 2.3.4 '@types/fs-extra': specifier: ^11.0.2 version: 11.0.2 @@ -69,12 +81,27 @@ importers: '@types/testing-library__jest-dom': specifier: 5.14.8 version: 5.14.8 + add-stream: + specifier: ^1.0.0 + version: 1.0.0 chalk: specifier: ^5.3.0 version: 5.3.0 chalk-template: specifier: 1.1.0 version: 1.1.0 + concat-stream: + specifier: ^2.0.0 + version: 2.0.0 + conventional-changelog: + specifier: ^5.1.0 + version: 5.1.0 + conventional-changelog-core: + specifier: ^7.0.0 + version: 7.0.0 + conventional-changelog-preset-loader: + specifier: ^4.1.0 + version: 4.1.0 copyfiles: specifier: 2.4.1 version: 2.4.1 @@ -96,6 +123,9 @@ importers: get-port: specifier: 5.1.1 version: 5.1.1 + get-stream: + specifier: 6.0.1 + version: 6.0.1 glob: specifier: 8.1.0 version: 8.1.0 @@ -141,6 +171,9 @@ importers: qs: specifier: 6.11.2 version: 6.11.2 + read-stream: + specifier: ^2.1.1 + version: 2.1.1 rimraf: specifier: 3.0.2 version: 3.0.2 @@ -159,6 +192,9 @@ importers: slate: specifier: 0.91.4 version: 0.91.4 + tempfile: + specifier: ^3.0.0 + version: 3.0.0 ts-node: specifier: 10.9.1 version: 10.9.1(@swc/[email protected])(@types/[email protected])([email protected]) @@ -2191,6 +2227,7 @@ packages: /@aws-sdk/[email protected]: resolution: {integrity: sha512-6lqbmorwerN4v+J5dqbHPAsjynI0mkEF+blf+69QTaKKGaxBBVaXgqoqul9RXYcK5MMrrYRbQIMd0zYOoy90kA==} engines: {node: '>=14.0.0'} + requiresBuild: true dependencies: '@smithy/types': 2.3.5 tslib: 2.6.2 @@ -3405,6 +3442,11 @@ packages: engines: {node: '>=6.9.0'} dev: true + /@hutson/[email protected]: + resolution: {integrity: sha512-e5+YUKENATs1JgYHMzTr2MW/NDcXGfYFAuOQU8gJgF/kEh4EqKgfGrfLI67bMD4tbhZVlkigz/9YYwWcbOFthg==} + engines: {node: '>=10.13.0'} + dev: true + /@iarna/[email protected]: resolution: {integrity: sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==} dev: true @@ -3428,7 +3470,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 - '@types/node': 20.6.2 + '@types/node': 16.18.58 chalk: 4.1.2 jest-message-util: 29.7.0 jest-util: 29.7.0 @@ -3544,7 +3586,7 @@ packages: '@jest/transform': 29.7.0 '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.19 - '@types/node': 20.6.2 + '@types/node': 16.18.58 chalk: 4.1.2 collect-v8-coverage: 1.0.2 exit: 0.1.2 @@ -3625,7 +3667,7 @@ packages: dependencies: '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.1 - '@types/node': 20.6.2 + '@types/node': 16.18.58 '@types/yargs': 16.0.5 chalk: 4.1.2 dev: true @@ -4837,6 +4879,7 @@ packages: /@smithy/[email protected]: resolution: {integrity: sha512-ehyDt8M9hehyxrLQGoA1BGPou8Js1Ocoh5M0ngDhJMqbFmNK5N6Xhr9/ZExWkyIW8XcGkiMPq3ZUEE0ScrhbuQ==} engines: {node: '>=14.0.0'} + requiresBuild: true dependencies: tslib: 2.6.2 @@ -5432,7 +5475,7 @@ packages: /@types/[email protected]: resolution: {integrity: sha512-JAymE2skNionWnBUwby3MatzPUw4D/6/7FX1qxBXLzmRnFxmqU0luIof7om0I8R3B/rSr9FKUnFCqxZ/NeGbrw==} dependencies: - '@types/node': 20.6.2 + '@types/node': 16.18.58 dev: true /@types/[email protected]: @@ -5440,14 +5483,14 @@ packages: dependencies: '@types/http-cache-semantics': 4.0.2 '@types/keyv': 3.1.4 - '@types/node': 20.6.2 + '@types/node': 16.18.58 '@types/responselike': 1.0.0 dev: true /@types/[email protected]: resolution: {integrity: sha512-lcoZHjUAANLTACLGi+O/0pN+oKQAQ8zAMWJSxiBRNLxqZG/WE8hfXJUs1eYwJOvOnDJrvxU1kR77UiVJ3+9N0Q==} dependencies: - '@types/node': 20.6.2 + '@types/node': 16.18.58 source-map: 0.6.1 dev: true @@ -5461,12 +5504,67 @@ packages: '@types/express': 4.17.17 dev: true + /@types/[email protected]: + resolution: {integrity: sha512-v5HP9ZsRbzFq5XRo2liUZPKzwbGK5SuGVMWZjE6iJOm/JNdESk3/rkfcPe0lcal0C32PTLVlYUYqGpMGNdDsDg==} + dependencies: + '@types/node': 16.18.58 + dev: true + /@types/[email protected]: resolution: {integrity: sha512-P63Zd/JUGq+PdrM1lv0Wv5SBYeA2+CORvbrXbngriYY0jzLUWfQMQQxOhjONEz/wlHOAxOdY7CY65rgQdTjq2w==} dependencies: '@types/node': 20.6.2 dev: true + /@types/[email protected]: + resolution: {integrity: sha512-K3M39aAnBYUt61Z1te+p/bu+IIK4gq8AaMAtj2M5O7Py6qyxhc0FRFO42F71rTM6dSFSJOacuIm0KvwzwTLsRw==} + dependencies: + '@types/conventional-changelog-writer': 4.0.7 + '@types/conventional-commits-parser': 3.0.5 + '@types/conventional-recommended-bump': 9.0.2 + '@types/git-raw-commits': 2.0.2 + '@types/node': 16.18.58 + '@types/normalize-package-data': 2.4.1 + dev: true + + /@types/[email protected]: + resolution: {integrity: sha512-Ke8+QrYiAXPAuxaKJgps2oTHOBPcC7svj4cp9OpkdShgytD5Z+aC5sUdo340gsTe7HqvvyeHAHxmMuwEAq2GYQ==} + dependencies: + '@types/conventional-changelog-core': 4.2.5 + '@types/conventional-changelog-writer': 4.0.7 + '@types/conventional-commits-parser': 3.0.5 + dev: true + + /@types/[email protected]: + resolution: {integrity: sha512-N6Z5wEBzKkf4HY3Z6JLSqB+OP42u4tcD0gcnP3yfJhCFIwd6SIqQGFcZqEnO2FUHX0f11EFIdO7Uue4aFu4Ylw==} + dependencies: + '@types/conventional-commits-parser': 3.0.5 + '@types/node': 16.18.58 + dev: true + + /@types/[email protected]: + resolution: {integrity: sha512-imWdLUAbDB+IJsA12u3wUrMkYGP3aLyf9l/697o6OFB20PKd5SMMvugPuAW44P6TDesm8M3m8Hh6+uhTeNqRPw==} + dependencies: + '@types/conventional-changelog-core': 4.2.5 + '@types/conventional-changelog-writer': 4.0.7 + '@types/conventional-commits-parser': 3.0.5 + '@types/node': 16.18.58 + dev: true + + /@types/[email protected]: + resolution: {integrity: sha512-vuj8zjxJPFOHj3HCNr3lPp67O1s/0rQMKYIkpYQQDpNE/ncXJjUTTTJdpCXqfg+Cbc9RAs71OXrFCeI4jbWWrw==} + dependencies: + '@types/node': 16.18.58 + dev: true + + /@types/[email protected]: + resolution: {integrity: sha512-HdjEmk+neFWM3SM4ksssVHXWK/UmYnDWJPUd+pOXx5kyrhvaKOsAKFg4SQugLSi003mbq5y/6xHh7Z40aG8ARw==} + dependencies: + '@types/conventional-changelog-core': 4.2.5 + '@types/conventional-changelog-writer': 4.0.7 + '@types/conventional-commits-parser': 3.0.5 + dev: true + /@types/[email protected]: resolution: {integrity: sha512-E9ZPeZwh81/gDPVH4XpvcS4ewH/Ub4XJeM5xYAUP0BexGORIyCRYzSivlGOuGbVc4MH3//+z3h4CbrnMZMeUdA==} dev: true @@ -5540,6 +5638,12 @@ packages: '@types/node': 16.18.58 dev: true + /@types/[email protected]: + resolution: {integrity: sha512-UTG4omPQz3qmePeOZ4Ofb+SvJPrdSBzdEPSlPURLoqnV9qeqxZj58T50+L330vFuxIE2bRf1R3yDcW15cOD71w==} + dependencies: + '@types/node': 16.18.58 + dev: true + /@types/[email protected]: resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} dependencies: @@ -5549,7 +5653,7 @@ packages: /@types/[email protected]: resolution: {integrity: sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==} dependencies: - '@types/node': 20.6.2 + '@types/node': 16.18.58 /@types/[email protected]: resolution: {integrity: sha512-oOMFT8vmCTFncsF1engrs04jatz8/Anwx3De9uxnOK4chgSEgWBvFtpSoJo8u3784JNO+ql5tzRR6phHoRnscQ==} @@ -5659,7 +5763,7 @@ packages: /@types/[email protected]: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} dependencies: - '@types/node': 20.6.2 + '@types/node': 16.18.58 dev: true /@types/[email protected]: @@ -5723,7 +5827,7 @@ packages: /@types/[email protected]: resolution: {integrity: sha512-6XzvzEyJ2ozFNfPajFmqH9JOt0Hp+9TawaYpJT59iIP/zR0U37cfWCRwosyIeEBBZBi021Osq4jGAD3AOju5fg==} dependencies: - '@types/node': 20.6.2 + '@types/node': 16.18.58 dev: true /@types/[email protected]: @@ -5919,7 +6023,7 @@ packages: /@types/[email protected]: resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==} dependencies: - '@types/node': 20.6.2 + '@types/node': 16.18.58 dev: true /@types/[email protected]: @@ -5936,7 +6040,7 @@ packages: resolution: {integrity: sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==} dependencies: '@types/mime': 1.3.2 - '@types/node': 20.6.2 + '@types/node': 16.18.58 dev: true /@types/[email protected]: @@ -5944,7 +6048,7 @@ packages: dependencies: '@types/http-errors': 2.0.2 '@types/mime': 2.0.3 - '@types/node': 20.6.2 + '@types/node': 16.18.58 dev: true /@types/[email protected]: @@ -6035,7 +6139,7 @@ packages: /@types/[email protected]: resolution: {integrity: sha512-Ft7YH3lEVRQ6ls8k4Ff1oB4jN6oy/XmU6tQISKdhfh+1mR+viZFphS6WL0IrtDOzvefmJg5a0s7ZQoRXwqTEFg==} dependencies: - '@types/node': 20.6.2 + '@types/node': 16.18.58 '@types/source-list-map': 0.1.2 source-map: 0.7.4 dev: true @@ -6054,13 +6158,13 @@ packages: /@types/[email protected]: resolution: {integrity: sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==} dependencies: - '@types/node': 20.6.2 + '@types/node': 16.18.58 '@types/webidl-conversions': 7.0.0 /@types/[email protected]: resolution: {integrity: sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==} dependencies: - '@types/node': 20.6.2 + '@types/node': 16.18.58 dev: false /@types/[email protected]: @@ -7793,16 +7897,33 @@ packages: compare-func: 2.0.0 dev: true + /[email protected]: + resolution: {integrity: sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==} + engines: {node: '>=16'} + dependencies: + compare-func: 2.0.0 + dev: true + /[email protected]: resolution: {integrity: sha512-pnN5bWpH+iTUWU3FaYdw5lJmfWeqSyrUkG+wyHBI9tC1dLNnHkbAOg1SzTQ7zBqiFrfo55h40VsGXWMdopwc5g==} engines: {node: '>=14'} dev: true + /[email protected]: + resolution: {integrity: sha512-q2YtiN7rnT1TGwPTwjjBSIPIzDJCRE+XAUahWxnh+buKK99Kks4WLMHoexw38GXx9OUxAsrp44f9qXe5VEMYhw==} + engines: {node: '>=16'} + dev: true + /[email protected]: resolution: {integrity: sha512-wzchZt9HEaAZrenZAUUHMCFcuYzGoZ1wG/kTRMICxsnW5AXohYMRxnyecP9ob42Gvn5TilhC0q66AtTPRSNMfw==} engines: {node: '>=14'} dev: true + /[email protected]: + resolution: {integrity: sha512-hQSojc/5imn1GJK3A75m9hEZZhc3urojA5gMpnar4JHmgLnuM3CUIARPpEk86glEKr3c54Po3WV/vCaO/U8g3Q==} + engines: {node: '>=16'} + dev: true + /[email protected]: resolution: {integrity: sha512-3cS3GEtR78zTfMzk0AizXKKIdN4OvSh7ibNz6/DPbhWWQu7LqE/8+/GqSodV+sywUR2gpJAdP/1JFf4XtN7Zpw==} engines: {node: '>=14'} @@ -7810,6 +7931,13 @@ packages: compare-func: 2.0.0 dev: true + /[email protected]: + resolution: {integrity: sha512-NKXYmMR/Hr1DevQegFB4MwfM5Vv0m4UIxKZTTYuD98lpTknaZlSRrDOG4X7wIXpGkfsYxZTghUN+Qq+T0YQI7w==} + engines: {node: '>=16'} + dependencies: + compare-func: 2.0.0 + dev: true + /[email protected]: resolution: {integrity: sha512-RhQOcDweXNWvlRwUDCpaqXzbZemKPKncCWZG50Alth72WITVd6nhVk9MJ6w1k9PFNBcZ3YwkdkChE+8+ZwtUug==} engines: {node: '>=14'} @@ -7827,26 +7955,62 @@ packages: read-pkg-up: 3.0.0 dev: true + /[email protected]: + resolution: {integrity: sha512-UYgaB1F/COt7VFjlYKVE/9tTzfU3VUq47r6iWf6lM5T7TlOxr0thI63ojQueRLIpVbrtHK4Ffw+yQGduw2Bhdg==} + engines: {node: '>=16'} + dependencies: + '@hutson/parse-repository-url': 5.0.0 + add-stream: 1.0.0 + conventional-changelog-writer: 7.0.1 + conventional-commits-parser: 5.0.0 + git-raw-commits: 4.0.0 + git-semver-tags: 7.0.1 + hosted-git-info: 7.0.1 + normalize-package-data: 6.0.0 + read-pkg: 8.1.0 + read-pkg-up: 10.1.0 + dev: true + /[email protected]: resolution: {integrity: sha512-7PYthCoSxIS98vWhVcSphMYM322OxptpKAuHYdVspryI0ooLDehRXWeRWgN+zWSBXKl/pwdgAg8IpLNSM1/61A==} engines: {node: '>=14'} dev: true + /[email protected]: + resolution: {integrity: sha512-D0IMhwcJUg1Y8FSry6XAplEJcljkHVlvAZddhhsdbL1rbsqRsMfGx/PIkPYq0ru5aDgn+OxhQ5N5yR7P9mfsvA==} + engines: {node: '>=16'} + dev: true + /[email protected]: resolution: {integrity: sha512-nEZ9byP89hIU0dMx37JXQkE1IpMmqKtsaR24X7aM3L6Yy/uAtbb+ogqthuNYJkeO1HyvK7JsX84z8649hvp43Q==} engines: {node: '>=14'} dev: true + /[email protected]: + resolution: {integrity: sha512-6JtLWqAQIeJLn/OzUlYmzd9fKeNSWmQVim9kql+v4GrZwLx807kAJl3IJVc3jTYfVKWLxhC3BGUxYiuVEcVjgA==} + engines: {node: '>=16'} + dev: true + /[email protected]: resolution: {integrity: sha512-HqxihpUMfIuxvlPvC6HltA4ZktQEUan/v3XQ77+/zbu8No/fqK3rxSZaYeHYant7zRxQNIIli7S+qLS9tX9zQA==} engines: {node: '>=14'} dev: true + /[email protected]: + resolution: {integrity: sha512-yWyy5c7raP9v7aTvPAWzqrztACNO9+FEI1FSYh7UP7YT1AkWgv5UspUeB5v3Ibv4/o60zj2o9GF2tqKQ99lIsw==} + engines: {node: '>=16'} + dev: true + /[email protected]: resolution: {integrity: sha512-TTIN5CyzRMf8PUwyy4IOLmLV2DFmPtasKN+x7EQKzwSX8086XYwo+NeaeA3VUT8bvKaIy5z/JoWUvi7huUOgaw==} engines: {node: '>=14'} dev: true + /[email protected]: + resolution: {integrity: sha512-slLjlXLRNa/icMI3+uGLQbtrgEny3RgITeCxevJB+p05ExiTgHACP5p3XiMKzjBn80n+Rzr83XMYfRInEtCPPw==} + engines: {node: '>=16'} + dev: true + /[email protected]: resolution: {integrity: sha512-bQof4byF4q+n+dwFRkJ/jGf9dCNUv4/kCDcjeCizBvfF81TeimPZBB6fT4HYbXgxxfxWXNl/i+J6T0nI4by6DA==} engines: {node: '>=14'} @@ -7854,11 +8018,23 @@ packages: compare-func: 2.0.0 dev: true + /[email protected]: + resolution: {integrity: sha512-LyXq1bbl0yG0Ai1SbLxIk8ZxUOe3AjnlwE6sVRQmMgetBk+4gY9EO3d00zlEt8Y8gwsITytDnPORl8al7InTjg==} + engines: {node: '>=16'} + dependencies: + compare-func: 2.0.0 + dev: true + /[email protected]: resolution: {integrity: sha512-qy9XbdSLmVnwnvzEisjxdDiLA4OmV3o8db+Zdg4WiFw14fP3B6XNz98X0swPPpkTd/pc1K7+adKgEDM1JCUMiA==} engines: {node: '>=14'} dev: true + /[email protected]: + resolution: {integrity: sha512-HozQjJicZTuRhCRTq4rZbefaiCzRM2pr6u2NL3XhrmQm4RMnDXfESU6JKu/pnKwx5xtdkYfNCsbhN5exhiKGJA==} + engines: {node: '>=16'} + dev: true + /[email protected]: resolution: {integrity: sha512-359t9aHorPw+U+nHzUXHS5ZnPBOizRxfQsWT5ZDHBfvfxQOAik+yfuhKXG66CN5LEWPpMNnIMHUTCKeYNprvHQ==} engines: {node: '>=14'} @@ -7873,6 +8049,19 @@ packages: split: 1.0.1 dev: true + /[email protected]: + resolution: {integrity: sha512-Uo+R9neH3r/foIvQ0MKcsXkX642hdm9odUp7TqgFS7BsalTcjzRlIfWZrZR1gbxOozKucaKt5KAbjW8J8xRSmA==} + engines: {node: '>=16'} + hasBin: true + dependencies: + conventional-commits-filter: 4.0.0 + handlebars: 4.7.8 + json-stringify-safe: 5.0.1 + meow: 12.1.1 + semver: 7.5.4 + split2: 4.2.0 + dev: true + /[email protected]: resolution: {integrity: sha512-JbZjwE1PzxQCvm+HUTIr+pbSekS8qdOZzMakdFyPtdkEWwFvwEJYONzjgMm0txCb2yBcIcfKDmg8xtCKTdecNQ==} engines: {node: '>=14'} @@ -7890,6 +8079,23 @@ packages: conventional-changelog-preset-loader: 3.0.0 dev: true + /[email protected]: + resolution: {integrity: sha512-aWyE/P39wGYRPllcCEZDxTVEmhyLzTc9XA6z6rVfkuCD2UBnhV/sgSOKbQrEG5z9mEZJjnopjgQooTKxEg8mAg==} + engines: {node: '>=16'} + dependencies: + conventional-changelog-angular: 7.0.0 + conventional-changelog-atom: 4.0.0 + conventional-changelog-codemirror: 4.0.0 + conventional-changelog-conventionalcommits: 7.0.2 + conventional-changelog-core: 7.0.0 + conventional-changelog-ember: 4.0.0 + conventional-changelog-eslint: 5.0.0 + conventional-changelog-express: 4.0.0 + conventional-changelog-jquery: 5.0.0 + conventional-changelog-jshint: 4.0.0 + conventional-changelog-preset-loader: 4.1.0 + dev: true + /[email protected]: resolution: {integrity: sha512-1ymej8b5LouPx9Ox0Dw/qAO2dVdfpRFq28e5Y0jJEU8ZrLdy0vOSkkIInwmxErFGhg6SALro60ZrwYFVTUDo4Q==} engines: {node: '>=14'} @@ -7898,6 +8104,11 @@ packages: modify-values: 1.0.1 dev: true + /[email protected]: + resolution: {integrity: sha512-rnpnibcSOdFcdclpFwWa+pPlZJhXE7l+XK04zxhbWrhgpR96h33QLz8hITTXbcYICxVr3HZFtbtUAQ+4LdBo9A==} + engines: {node: '>=16'} + dev: true + /[email protected]: resolution: {integrity: sha512-WRv5j1FsVM5FISJkoYMR6tPk07fkKT0UodruX4je86V4owk451yjXAKzKAPOs9l7y59E2viHUS9eQ+dfUA9NSg==} engines: {node: '>=14'} @@ -7909,6 +8120,17 @@ packages: split2: 3.2.2 dev: true + /[email protected]: + resolution: {integrity: sha512-ZPMl0ZJbw74iS9LuX9YIAiW8pfM5p3yh2o/NbXHbkFuZzY5jvdi5jFycEOkmBW5H5I7nA+D6f3UcsCLP2vvSEA==} + engines: {node: '>=16'} + hasBin: true + dependencies: + JSONStream: 1.3.5 + is-text-path: 2.0.0 + meow: 12.1.1 + split2: 4.2.0 + dev: true + /[email protected]: resolution: {integrity: sha512-Ft79FF4SlOFvX4PkwFDRnaNiIVX7YbmqGU0RwccUaiGvgp3S0a8ipR2/Qxk31vclDNM+GSdJOVs2KrsUCjblVA==} engines: {node: '>=14'} @@ -8287,6 +8509,11 @@ packages: engines: {node: '>=8'} dev: true + /[email protected]: + resolution: {integrity: sha512-wAV9QHOsNbwnWdNW2FYvE1P56wtgSbM+3SZcdGiWQILwVjACCXDCI3Ai8QlCjMDB8YK5zySiXZYBiwGmNY3lnw==} + engines: {node: '>=12'} + dev: true + /[email protected]: resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==} engines: {node: '>= 12'} @@ -9942,6 +10169,14 @@ packages: locate-path: 6.0.0 path-exists: 4.0.0 + /[email protected]: + resolution: {integrity: sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + locate-path: 7.2.0 + path-exists: 5.0.0 + dev: true + /[email protected]: resolution: {integrity: sha512-+iwzCJ7C5v5KgcBuueqVoNiHVoQpwiUK5XFLjf0affFTep+Wcw93tPvmb8tqujDNmzhBDPddnWV/qgWSXgq+Hg==} engines: {node: '>=12'} @@ -10209,6 +10444,16 @@ packages: split2: 3.2.2 dev: true + /[email protected]: + resolution: {integrity: sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==} + engines: {node: '>=16'} + hasBin: true + dependencies: + dargs: 8.1.0 + meow: 12.1.1 + split2: 4.2.0 + dev: true + /[email protected]: resolution: {integrity: sha512-eU+GGrZgccNJcsDH5LkXR3PB9M958hxc7sbA8DFJjrv9j4L2P/eZfKhM+QD6wyzpiv+b1BpK0XrYCxkovtjSLw==} engines: {node: '>=4'} @@ -10226,6 +10471,15 @@ packages: semver: 7.5.4 dev: true + /[email protected]: + resolution: {integrity: sha512-NY0ZHjJzyyNXHTDZmj+GG7PyuAKtMsyWSwh07CR2hOZFa+/yoTsXci/nF2obzL8UDhakFNkD9gNdt/Ed+cxh2Q==} + engines: {node: '>=16'} + hasBin: true + dependencies: + meow: 12.1.1 + semver: 7.5.4 + dev: true + /[email protected]: resolution: {integrity: sha512-ONdIrbBCFusq1Oy0sC71F5azx8bVkvtZtMJAsv+a6lz5YAmbNnLD6HAB4gptHZVLPR8S2/kVN6Gab7lryq5+lQ==} dependencies: @@ -10606,6 +10860,13 @@ packages: lru-cache: 6.0.0 dev: true + /[email protected]: + resolution: {integrity: sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==} + engines: {node: ^16.14.0 || >=18.0.0} + dependencies: + lru-cache: 10.0.1 + dev: true + /[email protected]: resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==} engines: {node: '>=12'} @@ -11180,6 +11441,13 @@ packages: text-extensions: 1.9.0 dev: true + /[email protected]: + resolution: {integrity: sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==} + engines: {node: '>=8'} + dependencies: + text-extensions: 2.4.0 + dev: true + /[email protected]: resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} engines: {node: '>= 0.4'} @@ -11373,7 +11641,7 @@ packages: '@jest/expect': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.6.2 + '@types/node': 16.18.58 chalk: 4.1.2 co: 4.6.0 dedent: 1.5.1 @@ -11634,7 +11902,7 @@ packages: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.6.2 + '@types/node': 16.18.58 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -11653,7 +11921,7 @@ packages: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.6 - '@types/node': 20.6.2 + '@types/node': 16.18.58 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -11760,7 +12028,7 @@ packages: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.6.2 + '@types/node': 16.18.58 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -11790,7 +12058,7 @@ packages: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.6.2 + '@types/node': 16.18.58 chalk: 4.1.2 cjs-module-lexer: 1.2.3 collect-v8-coverage: 1.0.2 @@ -11863,7 +12131,7 @@ packages: dependencies: '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.6.2 + '@types/node': 16.18.58 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -11874,7 +12142,7 @@ packages: resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} engines: {node: '>= 10.13.0'} dependencies: - '@types/node': 20.6.2 + '@types/node': 16.18.58 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -12047,6 +12315,11 @@ packages: /[email protected]: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + /[email protected]: + resolution: {integrity: sha512-iZbGHafX/59r39gPwVPRBGw0QQKnA7tte5pSMrhWOW7swGsVvVTjmfyAV9pNqk8YGT7tRCdxRu8uzcgZwoDooA==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + dev: true + /[email protected]: resolution: {integrity: sha512-EaEE9Y4VZ8b9jW5zce5a9L3+p4C9AqgIRHbNVDJahfMnoKzcd4sDb98BLxLdQhJEuRAXyKLg4H66NKm80W8ilg==} engines: {node: '>=12.0.0'} @@ -12237,6 +12510,11 @@ packages: /[email protected]: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + /[email protected]: + resolution: {integrity: sha512-cNOjgCnLB+FnvWWtyRTzmB3POJ+cXxTA81LoW7u8JdmhfXzriropYwpjShnz1QLLWsQwY7nIxoDmcPTwphDK9w==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + /[email protected]: resolution: {integrity: sha512-Mw0cL6HXnHN1ag0mN/Dg4g6sr8uf8sn98w2Oc1ECtFto9tvRF7nkXGJRbx8gPlHyoR0pLyBr2lQHbWwmUHe1Sw==} engines: {node: ^16.14.0 || >=18.0.0} @@ -12323,6 +12601,13 @@ packages: dependencies: p-locate: 5.0.0 + /[email protected]: + resolution: {integrity: sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + p-locate: 6.0.0 + dev: true + /[email protected]: resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} dev: true @@ -12450,6 +12735,11 @@ packages: engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dev: true + /[email protected]: + resolution: {integrity: sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==} + engines: {node: 14 || >=16.14} + dev: true + /[email protected]: resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} dependencies: @@ -12568,6 +12858,11 @@ packages: requiresBuild: true optional: true + /[email protected]: + resolution: {integrity: sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==} + engines: {node: '>=16.10'} + dev: true + /[email protected]: resolution: {integrity: sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q==} engines: {node: '>=10'} @@ -13103,6 +13398,16 @@ packages: validate-npm-package-license: 3.0.4 dev: true + /[email protected]: + resolution: {integrity: sha512-UL7ELRVxYBHBgYEtZCXjxuD5vPxnmvMGq0jp/dGPKKrN7tfsBh2IY7TlJ15WWwdjRWD3RJbnsygUurTK3xkPkg==} + engines: {node: ^16.14.0 || >=18.0.0} + dependencies: + hosted-git-info: 7.0.1 + is-core-module: 2.13.0 + semver: 7.5.4 + validate-npm-package-license: 3.0.4 + dev: true + /[email protected]: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -13379,6 +13684,13 @@ packages: dependencies: yocto-queue: 0.1.0 + /[email protected]: + resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + yocto-queue: 1.0.0 + dev: true + /[email protected]: resolution: {integrity: sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==} engines: {node: '>=4'} @@ -13404,6 +13716,13 @@ packages: dependencies: p-limit: 3.1.0 + /[email protected]: + resolution: {integrity: sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + p-limit: 4.0.0 + dev: true + /[email protected]: resolution: {integrity: sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==} engines: {node: '>=4'} @@ -13481,6 +13800,17 @@ packages: json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 + /[email protected]: + resolution: {integrity: sha512-ihtdrgbqdONYD156Ap6qTcaGcGdkdAxodO1wLqQ/j7HP1u2sFYppINiq4jyC8F+Nm+4fVufylCV00QmkTHkSUg==} + engines: {node: '>=16'} + dependencies: + '@babel/code-frame': 7.22.13 + error-ex: 1.3.2 + json-parse-even-better-errors: 3.0.0 + lines-and-columns: 2.0.3 + type-fest: 3.13.0 + dev: true + /[email protected]: resolution: {integrity: sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==} engines: {node: '>=0.10.0'} @@ -13568,6 +13898,11 @@ packages: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} + /[email protected]: + resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + /[email protected]: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} @@ -13867,7 +14202,7 @@ packages: uuid: 8.3.2 webpack: 5.88.2(@swc/[email protected])([email protected]) webpack-bundle-analyzer: 4.9.1 - webpack-cli: 4.10.0([email protected])([email protected]) + webpack-cli: 4.10.0([email protected]) webpack-dev-middleware: 6.0.1([email protected]) webpack-hot-middleware: 2.25.4 transitivePeerDependencies: @@ -14911,6 +15246,11 @@ packages: resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} engines: {node: '>= 0.6.0'} + /[email protected]: + resolution: {integrity: sha512-oNpcutj+nYX2FjdEW7PGltWhXulAnFlM0My/k48L90hARCOJtvBbQXc/6itV2jDvU5xAAtonP+r6wmQgCcbAUA==} + engines: {node: '>= 0.6.0'} + dev: true + /[email protected]: resolution: {integrity: sha512-22wJUOD3zswWFqgwjNHa1965LvqTX87WPu/lreY2KSd7SVcERfuZ4GfUaOnJNnvtoIv2yXT/W00YIGMetXtFXg==} engines: {node: '>= 0.4'} @@ -15349,6 +15689,15 @@ packages: dependencies: loose-envify: 1.4.0 + /[email protected]: + resolution: {integrity: sha512-aNtBq4jR8NawpKJQldrQcSW9y/d+KWH4v24HWkHljOZ7H0av+YTGANBzRh9A5pw7v/bLVsLVPpOhJ7gHNVy8lA==} + engines: {node: '>=16'} + dependencies: + find-up: 6.3.0 + read-pkg: 8.1.0 + type-fest: 4.4.0 + dev: true + /[email protected]: resolution: {integrity: sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw==} engines: {node: '>=4'} @@ -15385,6 +15734,23 @@ packages: type-fest: 0.6.0 dev: true + /[email protected]: + resolution: {integrity: sha512-PORM8AgzXeskHO/WEv312k9U03B8K9JSiWF/8N9sUuFjBa+9SF2u6K7VClzXwDXab51jCd8Nd36CNM+zR97ScQ==} + engines: {node: '>=16'} + dependencies: + '@types/normalize-package-data': 2.4.1 + normalize-package-data: 6.0.0 + parse-json: 7.1.0 + type-fest: 4.4.0 + dev: true + + /[email protected]: + resolution: {integrity: sha512-UcZnoo+AEM+ipqwOQ4JLxkIDYyWvOT3hvcal/fSL3VFFUKeHoHgC89gltJtekAejj+ji7dTe0TVb5mpj8/kt0g==} + dependencies: + process: 0.5.2 + readable-stream: github.com/Raynos/readable-stream/b1a911ce6e4f4c5a7e2948cd23c2f9ee1ea0696f + dev: true + /[email protected]: resolution: {integrity: sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==} dependencies: @@ -16628,6 +16994,19 @@ packages: streamx: 2.15.1 dev: false + /[email protected]: + resolution: {integrity: sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==} + engines: {node: '>=8'} + dev: true + + /[email protected]: + resolution: {integrity: sha512-uNFCg478XovRi85iD42egu+eSFUmmka750Jy7L5tfHI5hQKKtbPnxaSaXAbBqCDYrw3wx4tXjKwci4/QmsZJxw==} + engines: {node: '>=8'} + dependencies: + temp-dir: 2.0.0 + uuid: 3.4.0 + dev: true + /[email protected]: resolution: {integrity: sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==} engines: {node: '>=8'} @@ -16708,6 +17087,11 @@ packages: engines: {node: '>=0.10'} dev: true + /[email protected]: + resolution: {integrity: sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==} + engines: {node: '>=8'} + dev: true + /[email protected]: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} @@ -17111,7 +17495,11 @@ packages: /[email protected]: resolution: {integrity: sha512-Gur3yQGM9qiLNs0KPP7LPgeRbio2QTt4xXouobMCarR0/wyW3F+F/+OWwshg3NG0Adon7uQfSZBpB46NfhoF1A==} engines: {node: '>=14.16'} - dev: false + + /[email protected]: + resolution: {integrity: sha512-HT3RRs7sTfY22KuPQJkD/XjbTbxgP2Je5HPt6H6JEGvcjHd5Lqru75EbrP3tb4FYjNJ+DjLp+MNQTFQU0mhXNw==} + engines: {node: '>=16'} + dev: true /[email protected]: resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} @@ -17357,6 +17745,12 @@ packages: resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} engines: {node: '>= 0.4.0'} + /[email protected]: + resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==} + deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. + hasBin: true + dev: true + /[email protected]: resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} hasBin: true @@ -17983,6 +18377,17 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} + /[email protected]: + resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} + engines: {node: '>=12.20'} + dev: true + /[email protected]: resolution: {integrity: sha512-wvWkphh5WQsJbVk1tbx1l1Ly4yg+XecD+Mq280uBGt9wa5BKSWf4Mhp6GmrkPixhMxmabYY7RbzlwVP32pbGCg==} dev: false + + github.com/Raynos/readable-stream/b1a911ce6e4f4c5a7e2948cd23c2f9ee1ea0696f: + resolution: {tarball: https://codeload.github.com/Raynos/readable-stream/tar.gz/b1a911ce6e4f4c5a7e2948cd23c2f9ee1ea0696f} + name: readable-stream + version: 0.3.1 + dev: true diff --git a/release.config.js b/release.config.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/scripts/lib/getPackageDetails.ts b/scripts/lib/getPackageDetails.ts index cfd4bd49796..d5dce7177bd 100644 --- a/scripts/lib/getPackageDetails.ts +++ b/scripts/lib/getPackageDetails.ts @@ -13,13 +13,22 @@ export type PackageDetails = { newCommits: number shortName: string packagePath: string + prevGitTag: string + prevGitTagHash: string publishedVersion: string publishDate: string version: string } -export const getPackageDetails = async (): Promise<PackageDetails[]> => { - const packageDirs = fse.readdirSync(packagesDir).filter((d) => d !== 'eslint-config-payload') +export const getPackageDetails = async (pkg?: string): Promise<PackageDetails[]> => { + let packageDirs: string[] = [] + if (pkg) { + packageDirs = fse.readdirSync(packagesDir).filter((d) => d === pkg) + } else { + packageDirs = fse.readdirSync(packagesDir).filter((d) => d !== 'eslint-config-payload') + } + console.log(packageDirs) + const packageDetails = await Promise.all( packageDirs.map(async (dirName) => { const packageJson = await fse.readJson(`${packagesDir}/${dirName}/package.json`) @@ -49,6 +58,8 @@ export const getPackageDetails = async (): Promise<PackageDetails[]> => { newCommits: newCommits.total, shortName: dirName, packagePath: `packages/${dirName}`, + prevGitTag, + prevGitTagHash, publishedVersion, publishDate, version: packageJson.version, diff --git a/scripts/release.ts b/scripts/release.ts index c1e054d4969..79a94bd780b 100755 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -1,4 +1,5 @@ import fse from 'fs-extra' +import path from 'path' import { ExecSyncOptions, execSync } from 'child_process' import chalk from 'chalk' import prompts from 'prompts' @@ -6,12 +7,16 @@ import minimist from 'minimist' import chalkTemplate from 'chalk-template' import { PackageDetails, getPackageDetails, showPackageDetails } from './lib/getPackageDetails' import semver from 'semver' +import { updateChangelog } from './utils/updateChangelog' +import simpleGit from 'simple-git' + +const git = simpleGit(path.resolve(__dirname, '..')) const execOpts: ExecSyncOptions = { stdio: 'inherit' } const args = minimist(process.argv.slice(2)) async function main() { - const { tag = 'latest', bump = 'patch' } = args + const { tag = 'latest', bump = 'patch', pkg } = args if (!semver.RELEASE_TYPES.includes(bump)) { abort(`Invalid bump type: ${bump}.\n\nMust be one of: ${semver.RELEASE_TYPES.join(', ')}`) @@ -21,33 +26,38 @@ async function main() { abort(`Prerelease bumps must have tag: beta or canary`) } - const packageDetails = await getPackageDetails() + const packageDetails = await getPackageDetails(pkg) showPackageDetails(packageDetails) - const { packagesToRelease } = (await prompts({ - type: 'multiselect', - name: 'packagesToRelease', - message: 'Select packages to release', - instructions: 'Space to select. Enter to submit.', - choices: packageDetails.map((p) => { - const title = p?.newCommits ? chalk.bold.green(p?.shortName) : p?.shortName - return { - title, - value: p.shortName, - } - }), - })) as { packagesToRelease: string[] } + let packagesToRelease: string[] = [] + if (packageDetails.length > 1 && !pkg) { + ;({ packagesToRelease } = (await prompts({ + type: 'multiselect', + name: 'packagesToRelease', + message: 'Select packages to release', + instructions: 'Space to select. Enter to submit.', + choices: packageDetails.map((p) => { + const title = p?.newCommits ? chalk.bold.green(p?.shortName) : p?.shortName + return { + title, + value: p.shortName, + } + }), + })) as { packagesToRelease: string[] }) - if (!packagesToRelease) { - abort() - } + if (!packagesToRelease) { + abort() + } - if (packagesToRelease.length === 0) { - abort('Please specify a package to publish') - } + if (packagesToRelease.length === 0) { + abort('Please specify a package to publish') + } - if (packagesToRelease.find((p) => p === 'payload' && packagesToRelease.length > 1)) { - abort('Cannot publish payload with other packages. Release Payload first.') + if (packagesToRelease.find((p) => p === 'payload' && packagesToRelease.length > 1)) { + abort('Cannot publish payload with other packages. Release Payload first.') + } + } else { + packagesToRelease = [packageDetails[0].shortName] } const packageMap = packageDetails.reduce( @@ -94,9 +104,19 @@ ${packagesToRelease const packageObj = await fse.readJson(`${packagePath}/package.json`) const newVersion = packageObj.version + if (pkg === 'payload') { + const shouldUpdateChangelog = await confirm(`🧑‍💻 Update Changelog?`) + if (shouldUpdateChangelog) { + updateChangelog({ pkg: packageMap[pkg], bump }) + } + } + const tagName = `${shortName}/${newVersion}` const shouldCommit = await confirm(`🧑‍💻 Commit Release?`) if (shouldCommit) { + if (pkg === 'payload') { + execSync(`git add CHANGELOG.md`, execOpts) + } execSync(`git add ${packagePath}/package.json`, execOpts) execSync(`git commit -m "chore(release): ${tagName} [skip ci]" `, execOpts) } diff --git a/scripts/update-changelog.ts b/scripts/update-changelog.ts new file mode 100755 index 00000000000..16a7098b6fe --- /dev/null +++ b/scripts/update-changelog.ts @@ -0,0 +1,133 @@ +import fse, { createWriteStream, createReadStream } from 'fs-extra' +import { ExecSyncOptions, execSync } from 'child_process' +import chalk from 'chalk' +import path from 'path' +import prompts from 'prompts' +import minimist from 'minimist' +import chalkTemplate from 'chalk-template' +import { PackageDetails, getPackageDetails, showPackageDetails } from './lib/getPackageDetails' +import semver from 'semver' +import addStream from 'add-stream' +import tempfile from 'tempfile' +import concatSream from 'concat-stream' +import getStream from 'get-stream' +import conventionalChangelogCore, { + Options, + Context, + GitRawCommitsOptions, + ParserOptions, + WriterOptions, +} from 'conventional-changelog-core' +import conventionalChangelog, { Options as ChangelogOptions } from 'conventional-changelog' + +const execOpts: ExecSyncOptions = { stdio: 'inherit' } +const args = minimist(process.argv.slice(2)) + +async function main() { + const { tag = 'latest', bump = 'patch' } = args + const packageName = args._[0] + + const packageDetails = await getPackageDetails() + showPackageDetails(packageDetails) + + let pkg: PackageDetails | undefined + if (packageName) { + pkg = packageDetails.find((p) => p.shortName === packageName) + if (!pkg) { + abort(`Package not found: ${packageName}`) + } + } else { + ;({ pkg } = (await prompts({ + type: 'select', + name: 'pkg', + message: 'Select package to update changelog', + choices: packageDetails.map((p) => { + const title = p?.newCommits ? chalk.bold.green(p?.shortName) : p?.shortName + return { + title, + value: p, + } + }), + })) as { pkg: PackageDetails }) + } + + console.log({ pkg }) + if (!pkg) { + abort() + process.exit(1) + } + + // Prefix to find prev tag + const tagPrefix = pkg.shortName === 'payload' ? 'v' : pkg.prevGitTag.split('/')[0] + '/' + + const generateChangelog = await confirm('Generate changelog?') + if (!generateChangelog) { + abort() + } + + const nextReleaseVersion = semver.inc(pkg.version, bump) as string + const changelogStream = conventionalChangelog( + { + preset: 'conventionalcommits', + append: true, // Does this work? + // currentTag: pkg.prevGitTag, // The prefix is added automatically apparently? + tagPrefix, + pkg: { + path: `${pkg.packagePath}/package.json`, + }, + }, + { + version: nextReleaseVersion, // next release + }, + { + path: 'packages', + // path: pkg.packagePath, + // from: pkg.prevGitTag, + // to: 'HEAD' + }, + ).on('error', (err) => { + console.error(err.stack) + console.error(err.toString()) + process.exit(1) + }) + + const changelogFile = 'CHANGELOG.md' + const readStream = fse.createReadStream(changelogFile) + + const tmp = tempfile() + + changelogStream + .pipe(addStream(readStream)) + .pipe(createWriteStream(tmp)) + .on('finish', () => { + createReadStream(tmp).pipe(createWriteStream(changelogFile)) + }) +} + +main().catch((error) => { + console.error(error) + process.exit(1) +}) + +async function abort(message = 'Abort', exitCode = 1) { + console.error(chalk.bold.red(`\n${message}\n`)) + process.exit(exitCode) +} + +async function confirm(message: string): Promise<boolean> { + const { confirm } = await prompts( + { + name: 'confirm', + initial: false, + message, + type: 'confirm', + }, + { + onCancel: () => { + abort() + }, + }, + ) + + return confirm +} diff --git a/scripts/utils/updateChangelog.ts b/scripts/utils/updateChangelog.ts new file mode 100755 index 00000000000..3820043aa20 --- /dev/null +++ b/scripts/utils/updateChangelog.ts @@ -0,0 +1,54 @@ +import addStream from 'add-stream' +import { ExecSyncOptions } from 'child_process' +import conventionalChangelog from 'conventional-changelog' +import fse, { createReadStream, createWriteStream } from 'fs-extra' +import minimist from 'minimist' +import semver, { ReleaseType } from 'semver' +import tempfile from 'tempfile' +import { PackageDetails } from '../lib/getPackageDetails' + +type Args = { + pkg: PackageDetails + bump: ReleaseType +} + +export const updateChangelog = ({ pkg, bump }: Args) => { + // Prefix to find prev tag + const tagPrefix = pkg.shortName === 'payload' ? 'v' : pkg.prevGitTag.split('/')[0] + '/' + + const nextReleaseVersion = semver.inc(pkg.version, bump) as string + const changelogStream = conventionalChangelog( + { + preset: 'conventionalcommits', + tagPrefix, + pkg: { + path: `${pkg.packagePath}/package.json`, + }, + }, + { + version: nextReleaseVersion, // next release + }, + { + path: 'packages', + // path: pkg.packagePath, + // from: pkg.prevGitTag, + // to: 'HEAD' + }, + ).on('error', (err) => { + console.error(err.stack) + console.error(err.toString()) + process.exit(1) + }) + + const changelogFile = 'CHANGELOG.md' + const readStream = fse.createReadStream(changelogFile) + + const tmp = tempfile() + + changelogStream + .pipe(addStream(readStream)) + .pipe(createWriteStream(tmp)) + .on('finish', () => { + createReadStream(tmp).pipe(createWriteStream(changelogFile)) + }) +}
bb10ed5b7d52cadc78c0c4c332ba9a6af22410ac
2024-03-09 01:10:23
Jarrod Flesch
fix: sync localization data after switching locale (#5277)
false
sync localization data after switching locale (#5277)
fix
diff --git a/packages/next/src/views/Edit/index.client.tsx b/packages/next/src/views/Edit/index.client.tsx index 159e90f7293..1fcaec44ede 100644 --- a/packages/next/src/views/Edit/index.client.tsx +++ b/packages/next/src/views/Edit/index.client.tsx @@ -13,7 +13,7 @@ import React, { Fragment, useEffect } from 'react' import { useCallback } from 'react' export const EditViewClient: React.FC = () => { - const { collectionSlug, getDocPermissions, getVersions, globalSlug, isEditing, setDocumentInfo } = + const { collectionSlug, getDocPermissions, getVersions, globalSlug, isEditing, setOnSave } = useDocumentInfo() const { @@ -58,10 +58,8 @@ export const EditViewClient: React.FC = () => { ) useEffect(() => { - setDocumentInfo({ - onSave, - }) - }, [setDocumentInfo, onSave]) + setOnSave(onSave) + }, [setOnSave, onSave]) // Allow the `DocumentInfoProvider` to hydrate if (!Edit || (!collectionSlug && !globalSlug)) { diff --git a/packages/ui/src/elements/Localizer/index.tsx b/packages/ui/src/elements/Localizer/index.tsx index fe4b0609586..ff019f47660 100644 --- a/packages/ui/src/elements/Localizer/index.tsx +++ b/packages/ui/src/elements/Localizer/index.tsx @@ -50,6 +50,7 @@ const Localizer: React.FC<{ }, }), ) + router.refresh() close() }} > diff --git a/packages/ui/src/elements/PublishMany/index.tsx b/packages/ui/src/elements/PublishMany/index.tsx index 77a063b4eb9..a8e4a8b088f 100644 --- a/packages/ui/src/elements/PublishMany/index.tsx +++ b/packages/ui/src/elements/PublishMany/index.tsx @@ -98,6 +98,8 @@ export const PublishMany: React.FC<Props> = (props) => { slug, t, toggleModal, + router, + stringifyParams, ]) if (!versions?.drafts || selectAll === SelectAllStatus.None || !hasPermission) { diff --git a/packages/ui/src/elements/UnpublishMany/index.tsx b/packages/ui/src/elements/UnpublishMany/index.tsx index ca834aaf7f9..652455e3355 100644 --- a/packages/ui/src/elements/UnpublishMany/index.tsx +++ b/packages/ui/src/elements/UnpublishMany/index.tsx @@ -94,6 +94,8 @@ export const UnpublishMany: React.FC<Props> = (props) => { slug, t, toggleModal, + router, + stringifyParams, ]) if (!versions?.drafts || selectAll === SelectAllStatus.None || !hasPermission) { diff --git a/packages/ui/src/providers/DocumentInfo/index.tsx b/packages/ui/src/providers/DocumentInfo/index.tsx index eac35e4e4d0..a0901e0a1d1 100644 --- a/packages/ui/src/providers/DocumentInfo/index.tsx +++ b/packages/ui/src/providers/DocumentInfo/index.tsx @@ -20,7 +20,6 @@ import { useConfig } from '../Config/index.js' import { useLocale } from '../Locale/index.js' import { usePreferences } from '../Preferences/index.js' import { useTranslation } from '../Translation/index.js' -import { documentInfoReducer } from './reducer.js' const Context = createContext({} as DocumentInfoContext) @@ -32,20 +31,11 @@ export const DocumentInfoProvider: React.FC< DocumentInfoProps & { children: React.ReactNode } -> = ({ children, ...rest }) => { - const [documentInfo, dispatchDocumentInfo] = useReducer(documentInfoReducer, rest) - - const setDocumentInfo = useCallback( - (newInfo: DocumentInfo) => { - dispatchDocumentInfo({ - type: 'SET_DOC_INFO', - payload: newInfo, - }) - }, - [dispatchDocumentInfo], - ) +> = ({ children, ...props }) => { + const [documentTitle, setDocumentTitle] = useState(props.title) + const [onSave, setOnSave] = useState(() => props.onSave) - const { id, collectionSlug, globalSlug } = documentInfo + const { id, collectionSlug, globalSlug } = props const { collections, @@ -69,13 +59,6 @@ export const DocumentInfoProvider: React.FC< const [unpublishedVersions, setUnpublishedVersions] = useState<PaginatedDocs<TypeWithVersion<any>>>(null) - const setDocumentTitle = useCallback((title: string) => { - dispatchDocumentInfo({ - type: 'SET_DOC_TITLE', - payload: title, - }) - }, []) - const baseURL = `${serverURL}${api}` let slug: string let pluralType: 'collections' | 'globals' @@ -285,9 +268,13 @@ export const DocumentInfoProvider: React.FC< void getVersions() }, [getVersions]) + useEffect(() => { + setDocumentTitle(props.title) + }, [props.title]) + useEffect(() => { const loadDocPermissions = async () => { - const docPermissions: DocumentPermissions = rest.docPermissions + const docPermissions: DocumentPermissions = props.docPermissions if (!docPermissions) await getDocPermissions() else setDocPermissions(docPermissions) } @@ -295,37 +282,21 @@ export const DocumentInfoProvider: React.FC< if (collectionSlug || globalSlug) { void loadDocPermissions() } - }, [getDocPermissions, rest.docPermissions, setDocPermissions, collectionSlug, globalSlug]) - - useEffect(() => { - const loadDocPreferences = async () => { - let docPreferences: DocumentPreferences = rest.docPreferences - if (!docPreferences) docPreferences = await getDocPreferences() - - dispatchDocumentInfo({ - type: 'SET_DOC_INFO', - payload: { - docPreferences, - }, - }) - } - - if (id) { - void loadDocPreferences() - } - }, [getDocPreferences, preferencesKey, rest.docPreferences, id]) + }, [getDocPermissions, props.docPermissions, setDocPermissions, collectionSlug, globalSlug]) const value: DocumentInfoContext = { - ...documentInfo, + ...props, docConfig, docPermissions, getDocPermissions, getDocPreferences, getVersions, + onSave, publishedDoc, setDocFieldPreferences, - setDocumentInfo, setDocumentTitle, + setOnSave, + title: documentTitle, unpublishedVersions, versions, } diff --git a/packages/ui/src/providers/DocumentInfo/reducer.ts b/packages/ui/src/providers/DocumentInfo/reducer.ts deleted file mode 100644 index 001ef9e61e6..00000000000 --- a/packages/ui/src/providers/DocumentInfo/reducer.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { DocumentInfo } from './index.js' - -type SET = { - payload: Partial<DocumentInfo> - type: 'SET_DOC_INFO' -} - -type SET_TITLE = { - payload: string - type: 'SET_DOC_TITLE' -} - -type RESET = { - payload: DocumentInfo - type: 'RESET_DOC_INFO' -} - -type Action = RESET | SET | SET_TITLE - -export const documentInfoReducer = (state: DocumentInfo, action: Action): DocumentInfo => { - switch (action.type) { - case 'SET_DOC_INFO': - return { - ...state, - ...action.payload, - } - case 'SET_DOC_TITLE': - return { - ...state, - title: action.payload, - } - case 'RESET_DOC_INFO': - return { - ...action.payload, - } - default: - return state - } -} diff --git a/packages/ui/src/providers/DocumentInfo/types.ts b/packages/ui/src/providers/DocumentInfo/types.ts index add6c0f2b82..ba54723cc0e 100644 --- a/packages/ui/src/providers/DocumentInfo/types.ts +++ b/packages/ui/src/providers/DocumentInfo/types.ts @@ -48,6 +48,6 @@ export type DocumentInfoContext = Omit<DocumentInfo, 'docPreferences'> & { getDocPreferences: () => Promise<{ [key: string]: unknown }> getVersions: () => Promise<void> setDocFieldPreferences: (field: string, fieldPreferences: { [key: string]: unknown }) => void - setDocumentInfo?: React.Dispatch<React.SetStateAction<Partial<DocumentInfo>>> setDocumentTitle: (title: string) => void + setOnSave: (data: Data) => Promise<void> | void } diff --git a/test/_community/config.ts b/test/_community/config.ts index 9caac4a1ce1..f335261eefd 100644 --- a/test/_community/config.ts +++ b/test/_community/config.ts @@ -19,7 +19,6 @@ export default buildConfigWithDefaults({ }, onInit: async (payload) => { - console.log('onInit') await payload.create({ collection: 'users', data: {
8769d042f91c8f932b5c0b938f58d525fd8f64bc
2023-05-15 22:59:06
Jarrod Flesch
chore: adds use client directive atop custom react components (#42)
false
adds use client directive atop custom react components (#42)
chore
diff --git a/packages/plugin-form-builder/src/collections/Forms/DynamicFieldSelector.tsx b/packages/plugin-form-builder/src/collections/Forms/DynamicFieldSelector.tsx index db4df57baf8..36dbd8fcc09 100644 --- a/packages/plugin-form-builder/src/collections/Forms/DynamicFieldSelector.tsx +++ b/packages/plugin-form-builder/src/collections/Forms/DynamicFieldSelector.tsx @@ -1,3 +1,5 @@ +'use client' + import React, { useEffect, useState } from 'react' import { Select, useForm } from 'payload/components/forms' import { TextField } from 'payload/dist/fields/config/types' diff --git a/packages/plugin-form-builder/src/collections/Forms/DynamicPriceSelector.tsx b/packages/plugin-form-builder/src/collections/Forms/DynamicPriceSelector.tsx index ca99888510e..830f8c45275 100644 --- a/packages/plugin-form-builder/src/collections/Forms/DynamicPriceSelector.tsx +++ b/packages/plugin-form-builder/src/collections/Forms/DynamicPriceSelector.tsx @@ -1,3 +1,5 @@ +'use client' + import React, { useEffect, useState } from 'react'; import { Text, useWatchForm } from 'payload/components/forms'; import { Props as TextFieldType } from 'payload/dist/admin/components/forms/field-types/Text/types';
e490f0bce6d3f2c94091f68d2ce38d0111467a8f
2024-03-06 02:42:17
James
chore: attempts to abstract sharp to optional dependency
false
attempts to abstract sharp to optional dependency
chore
diff --git a/package.json b/package.json index 9f453461d07..a747901bec5 100644 --- a/package.json +++ b/package.json @@ -129,6 +129,7 @@ "read-stream": "^2.1.1", "rimraf": "3.0.2", "semver": "^7.5.4", + "sharp": "0.32.6", "shelljs": "0.8.5", "simple-git": "^3.20.0", "slash": "3.0.0", diff --git a/packages/payload/package.json b/packages/payload/package.json index f25214a4487..8435cec094b 100644 --- a/packages/payload/package.json +++ b/packages/payload/package.json @@ -65,8 +65,7 @@ "probe-image-size": "6.0.0", "sanitize-filename": "1.6.3", "scheduler": "0.23.0", - "scmp": "2.1.0", - "sharp": "0.32.6" + "scmp": "2.1.0" }, "devDependencies": { "@monaco-editor/react": "4.5.1", @@ -113,7 +112,8 @@ "release-it": "17.1.1", "rimraf": "3.0.2", "serve-static": "1.15.0", - "ts-essentials": "7.0.3" + "ts-essentials": "7.0.3", + "sharp": "0.32.6" }, "engines": { "node": ">=18.17.0" diff --git a/packages/payload/src/config/schema.ts b/packages/payload/src/config/schema.ts index 6a74dd0fb50..2ed972a8323 100644 --- a/packages/payload/src/config/schema.ts +++ b/packages/payload/src/config/schema.ts @@ -177,6 +177,7 @@ export default joi.object({ return value }), + sharp: joi.any(), telemetry: joi.boolean(), typescript: joi.object({ declare: joi.boolean(), diff --git a/packages/payload/src/config/types.ts b/packages/payload/src/config/types.ts index e40b4dfde19..e550463bd7a 100644 --- a/packages/payload/src/config/types.ts +++ b/packages/payload/src/config/types.ts @@ -5,6 +5,7 @@ import type { Transporter } from 'nodemailer' import type SMTPConnection from 'nodemailer/lib/smtp-connection' import type { DestinationStream, LoggerOptions } from 'pino' import type React from 'react' +import type { default as sharp } from 'sharp' import type { DeepRequired } from 'ts-essentials' import type { Payload } from '..' @@ -359,6 +360,23 @@ export type LocalizationConfig = Prettify< LocalizationConfigWithLabels | LocalizationConfigWithNoLabels > +export type SharpDependency = ( + input?: + | ArrayBuffer + | Buffer + | Float32Array + | Float64Array + | Int8Array + | Int16Array + | Int32Array + | Uint8Array + | Uint8ClampedArray + | Uint16Array + | Uint32Array + | string, + options?: sharp.SharpOptions, +) => sharp.Sharp + /** * This is the central configuration * @@ -635,6 +653,11 @@ export type Config = { * @see https://payloadcms.com/docs/configuration/overview#options */ serverURL?: string + /** + * Pass in a local copy of Sharp if you'd like to use it. + * + */ + sharp?: SharpDependency /** Send anonymous telemetry data about general usage. */ telemetry?: boolean /** Control how typescript interfaces are generated from your collections. */ diff --git a/packages/payload/src/uploads/cropImage.ts b/packages/payload/src/uploads/cropImage.ts index 62627b8a72d..3f08a58f689 100644 --- a/packages/payload/src/uploads/cropImage.ts +++ b/packages/payload/src/uploads/cropImage.ts @@ -1,10 +1,8 @@ -import sharp from 'sharp' - export const percentToPixel = (value, dimension) => { return Math.floor((parseFloat(value) / 100) * dimension) } -export default async function cropImage({ cropData, dimensions, file }) { +export default async function cropImage({ cropData, dimensions, file, sharp }) { try { const { height, width, x, y } = cropData diff --git a/packages/payload/src/uploads/generateFileData.ts b/packages/payload/src/uploads/generateFileData.ts index 8e763912f92..ae0c4b6859e 100644 --- a/packages/payload/src/uploads/generateFileData.ts +++ b/packages/payload/src/uploads/generateFileData.ts @@ -4,7 +4,6 @@ import { fromBuffer } from 'file-type' import fs from 'fs' import mkdirp from 'mkdirp' import sanitize from 'sanitize-filename' -import sharp from 'sharp' import type { Collection } from '../collections/config/types' import type { SanitizedConfig } from '../config/types' @@ -49,6 +48,8 @@ export const generateFileData = async <T>({ } } + const { sharp } = req.payload.config + let file = req.file const { searchParams } = req @@ -113,7 +114,7 @@ export const generateFileData = async <T>({ if (fileIsAnimated) sharpOptions.animated = true - if (fileHasAdjustments) { + if (fileHasAdjustments && sharp) { if (file.tempFilePath) { sharpFile = sharp(file.tempFilePath, sharpOptions).rotate() // pass rotate() to auto-rotate based on EXIF data. https://github.com/payloadcms/payload/pull/3081 } else { @@ -180,8 +181,8 @@ export const generateFileData = async <T>({ fileData.filename = fsSafeName let fileForResize = file - if (cropData) { - const { data: croppedImage, info } = await cropImage({ cropData, dimensions, file }) + if (cropData && sharp) { + const { data: croppedImage, info } = await cropImage({ cropData, dimensions, file, sharp }) filesToSave.push({ buffer: croppedImage, @@ -223,7 +224,7 @@ export const generateFileData = async <T>({ } } - if (Array.isArray(imageSizes) && fileSupportsResize) { + if (Array.isArray(imageSizes) && fileSupportsResize && sharp) { req.payloadUploadSizes = {} const { sizeData, sizesToSave } = await resizeAndTransformImageSizes({ config: collectionConfig, @@ -238,6 +239,7 @@ export const generateFileData = async <T>({ mimeType: fileData.mimeType, req, savedFilename: fsSafeName || file.name, + sharp, staticPath, }) diff --git a/packages/payload/src/uploads/imageResizer.ts b/packages/payload/src/uploads/imageResizer.ts index 5bb061a5899..de8ba2c553c 100644 --- a/packages/payload/src/uploads/imageResizer.ts +++ b/packages/payload/src/uploads/imageResizer.ts @@ -1,11 +1,12 @@ -import type { OutputInfo } from 'sharp' +import type { OutputInfo, default as Sharp } from 'sharp' +import type sharp from 'sharp' import { fromBuffer } from 'file-type' import fs from 'fs' import sanitize from 'sanitize-filename' -import sharp from 'sharp' import type { SanitizedCollectionConfig } from '../collections/config/types' +import type { SharpDependency } from '../exports/config' import type { UploadEdits } from '../exports/types' import type { CustomPayloadRequest, PayloadRequest } from '../types' import type { FileSize, FileSizes, FileToSave, ImageSize, ProbedImageSize } from './types' @@ -24,6 +25,7 @@ type ResizeArgs = { } } savedFilename: string + sharp: SharpDependency staticPath: string } @@ -213,6 +215,7 @@ export default async function resizeAndTransformImageSizes({ mimeType, req, savedFilename, + sharp, staticPath, }: ResizeArgs): Promise<ImageSizesResult> { const { imageSizes } = config.upload diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5854dbae14e..0c33b1488d4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -230,6 +230,9 @@ importers: semver: specifier: ^7.5.4 version: 7.6.0 + sharp: + specifier: 0.32.6 + version: 0.32.6 shelljs: specifier: 0.8.5 version: 0.8.5 @@ -716,9 +719,6 @@ importers: scmp: specifier: 2.1.0 version: 2.1.0 - sharp: - specifier: 0.32.6 - version: 0.32.6 devDependencies: '@monaco-editor/react': specifier: 4.5.1 @@ -852,6 +852,9 @@ importers: serve-static: specifier: 1.15.0 version: 1.15.0 + sharp: + specifier: 0.32.6 + version: 0.32.6 ts-essentials: specifier: 7.0.3 version: 7.0.3([email protected]) @@ -7496,6 +7499,7 @@ packages: /[email protected]: resolution: {integrity: sha512-5Tk1HLk6b6ctmjIkAcU/Ujv/1WqiDl0F0JdRCR80VsOcUlHcu7pWeWRlOqQLHfDEsVx9YH/aif5AG4ehoCtTmg==} + dev: true /[email protected](@babel/[email protected]): resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} @@ -7579,6 +7583,7 @@ packages: /[email protected]: resolution: {integrity: sha512-Yyyqff4PIFfSuthCZqLlPISTWHmnQxoPuAvkmgzsJEmG3CesdIv6Xweayl0JkCZJSB2yYIdJyEz97tpxNhgjbg==} requiresBuild: true + dev: true optional: true /[email protected]: @@ -7589,13 +7594,13 @@ packages: bare-os: 2.2.0 bare-path: 2.1.0 streamx: 2.16.1 - dev: false + dev: true optional: true /[email protected]: resolution: {integrity: sha512-hD0rOPfYWOMpVirTACt4/nK8mC55La12K5fY1ij8HAdfQakD62M+H4o4tpfKzVGLgRDTuk3vjA4GqGXXCeFbag==} requiresBuild: true - dev: false + dev: true optional: true /[email protected]: @@ -7603,7 +7608,7 @@ packages: requiresBuild: true dependencies: bare-os: 2.2.0 - dev: false + dev: true optional: true /[email protected]: @@ -7955,7 +7960,7 @@ packages: /[email protected]: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==} @@ -8096,7 +8101,7 @@ packages: dependencies: color-name: 1.1.4 simple-swizzle: 0.2.2 - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==} @@ -8104,7 +8109,7 @@ packages: dependencies: color-convert: 2.0.1 color-string: 1.9.1 - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==} @@ -8875,6 +8880,7 @@ packages: engines: {node: '>=10'} dependencies: mimic-response: 3.1.0 + dev: true /[email protected]: resolution: {integrity: sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==} @@ -8933,6 +8939,7 @@ packages: /[email protected]: resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==} engines: {node: '>=4.0.0'} + dev: true /[email protected]: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} @@ -10113,7 +10120,7 @@ packages: /[email protected]: resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==} engines: {node: '>=6'} - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==} @@ -10223,6 +10230,7 @@ packages: /[email protected]: resolution: {integrity: sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==} + dev: true /[email protected]: resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} @@ -10537,7 +10545,7 @@ packages: /[email protected]: resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==} - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==} @@ -10740,7 +10748,7 @@ packages: /[email protected]: resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==} - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} @@ -11402,7 +11410,7 @@ packages: /[email protected]: resolution: {integrity: sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==} - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==} @@ -13218,6 +13226,7 @@ packages: /[email protected]: resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==} engines: {node: '>=10'} + dev: true /[email protected]: resolution: {integrity: sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==} @@ -13281,7 +13290,7 @@ packages: /[email protected]: resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} @@ -13450,7 +13459,7 @@ packages: /[email protected]: resolution: {integrity: sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==} - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} @@ -13587,11 +13596,11 @@ packages: engines: {node: '>=10'} dependencies: semver: 7.6.0 - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==} - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} @@ -15130,7 +15139,7 @@ packages: simple-get: 4.0.1 tar-fs: 2.1.1 tunnel-agent: 0.6.0 - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} @@ -15318,6 +15327,7 @@ packages: /[email protected]: resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==} + dev: true /[email protected]: resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==} @@ -15354,6 +15364,7 @@ packages: ini: 1.3.8 minimist: 1.2.8 strip-json-comments: 2.0.1 + dev: true /[email protected]([email protected])([email protected]): resolution: {integrity: sha512-A9jfz/4CTdsIsE7WCQtO9UkOpMBcBRh8LxyHl2eoZz1ki02jpyUL5xt58gabd0CyeLQ8fRyQ+s2lyV2Ufu8Owg==} @@ -16175,7 +16186,7 @@ packages: simple-get: 4.0.1 tar-fs: 3.0.5 tunnel-agent: 0.6.0 - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==} @@ -16230,7 +16241,7 @@ packages: /[email protected]: resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==} @@ -16238,7 +16249,7 @@ packages: decompress-response: 6.0.0 once: 1.4.0 simple-concat: 1.0.1 - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-6JujwSs0ac82jkGjMHiCnTifvf1crOiY/+tfs/Pqih6iow7VrpNKRRNdWm6RtaXpvvv/JGNYhlUtLhGFqHF+Yw==} @@ -16254,7 +16265,7 @@ packages: resolution: {integrity: sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==} dependencies: is-arrayish: 0.3.2 - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==} @@ -16515,6 +16526,7 @@ packages: queue-tick: 1.0.1 optionalDependencies: bare-events: 2.2.0 + dev: true /[email protected]: resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==} @@ -16649,6 +16661,7 @@ packages: /[email protected]: resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==} engines: {node: '>=0.10.0'} + dev: true /[email protected]: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} @@ -16805,7 +16818,7 @@ packages: mkdirp-classic: 0.5.3 pump: 3.0.0 tar-stream: 2.2.0 - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-JOgGAmZyMgbqpLwct7ZV8VzkEB6pxXFBVErLtb+XCOqzc6w1xiWKI9GVd6bwk68EX7eJ4DWmfXVmq8K2ziZTGg==} @@ -16815,7 +16828,7 @@ packages: optionalDependencies: bare-fs: 2.2.1 bare-path: 2.1.0 - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==} @@ -16826,7 +16839,7 @@ packages: fs-constants: 1.0.0 inherits: 2.0.4 readable-stream: 3.6.2 - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==} @@ -16834,6 +16847,7 @@ packages: b4a: 1.6.6 fast-fifo: 1.3.2 streamx: 2.16.1 + dev: true /[email protected]: resolution: {integrity: sha512-resvxdc6Mgb7YEThw6G6bExlXKkv6+YbuzGg9xuXxSgxJF7Ozs+o8Y9+2R3sArdWdW8nOokoQb1yrpFB0pQK2g==} @@ -17228,7 +17242,7 @@ packages: resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==} dependencies: safe-buffer: 5.2.1 - dev: false + dev: true /[email protected]: resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} diff --git a/test/buildConfigWithDefaults.ts b/test/buildConfigWithDefaults.ts index bb56a2dd6e0..1f6ee2a6375 100644 --- a/test/buildConfigWithDefaults.ts +++ b/test/buildConfigWithDefaults.ts @@ -1,4 +1,5 @@ import path from 'path' +import sharp from 'sharp' import type { Config, SanitizedConfig } from '../packages/payload/src/config/types' @@ -161,6 +162,7 @@ export function buildConfigWithDefaults(testConfig?: Partial<Config>): Promise<S }), ], }), + sharp, telemetry: false, ...testConfig, }
c1abd16a7fa3feb85cde00298b39603f5bf4175f
2025-01-06 21:30:12
Sasha
templates: use `cross-env` in the plugin template to achieve compatibility with Windows (#10390)
false
use `cross-env` in the plugin template to achieve compatibility with Windows (#10390)
templates
diff --git a/templates/plugin/package.json b/templates/plugin/package.json index 1c2cda248db..229802d90a7 100644 --- a/templates/plugin/package.json +++ b/templates/plugin/package.json @@ -35,7 +35,7 @@ "dev": "payload run ./dev/server.ts", "dev:generate-importmap": "pnpm dev:payload generate:importmap", "dev:generate-types": "pnpm dev:payload generate:types", - "dev:payload": "PAYLOAD_CONFIG_PATH=./dev/payload.config.ts payload", + "dev:payload": "cross-env PAYLOAD_CONFIG_PATH=./dev/payload.config.ts payload", "lint": "eslint ./src", "lint:fix": "eslint ./src --fix", "prepublishOnly": "pnpm clean && pnpm build", @@ -58,6 +58,7 @@ "@types/react": "19.0.1", "@types/react-dom": "19.0.1", "copyfiles": "2.4.1", + "cross-env": "^7.0.3", "eslint": "^9.16.0", "eslint-config-next": "15.1.0", "graphql": "^16.8.1",
ac34380eb8ad9d280d5fc4744bce9e2f133e5411
2024-06-09 01:04:26
Alessio Gravili
fix(ui): set checkbox htmlFor by default, fixing some checkbox labels not toggling the checkbox (#6684)
false
set checkbox htmlFor by default, fixing some checkbox labels not toggling the checkbox (#6684)
fix
diff --git a/packages/ui/src/fields/Checkbox/Input.tsx b/packages/ui/src/fields/Checkbox/Input.tsx index 843b89c918e..051b3a21993 100644 --- a/packages/ui/src/fields/Checkbox/Input.tsx +++ b/packages/ui/src/fields/Checkbox/Input.tsx @@ -78,6 +78,7 @@ export const CheckboxInput: React.FC<CheckboxInputProps> = ({ </div> <FieldLabel CustomLabel={CustomLabel} + htmlFor={id} label={label} required={required} {...(labelProps || {})}
8feed39fb92f2e194ae628b090cbb84d802586b6
2022-07-25 02:38:35
Vincent Van Dijck
fix: trim trailing whitespaces of email in login
false
trim trailing whitespaces of email in login
fix
diff --git a/src/auth/operations/login.ts b/src/auth/operations/login.ts index 0f26873ba0c..fcc8879e1ca 100644 --- a/src/auth/operations/login.ts +++ b/src/auth/operations/login.ts @@ -70,7 +70,7 @@ async function login<T>(incomingArgs: Arguments): Promise<Result & { user: T}> { const { email: unsanitizedEmail, password } = data; - const email = unsanitizedEmail ? (unsanitizedEmail as string).toLowerCase() : null; + const email = unsanitizedEmail ? (unsanitizedEmail as string).toLowerCase().trim() : null; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore Improper typing in library, additional args should be optional
bd4da37f237d7bd33583d21b4ed8b910dd7d71cb
2023-01-19 22:08:39
Jacob Fletcher
fix: creates backup of latest version after restoring draft #1873
false
creates backup of latest version after restoring draft #1873
fix
diff --git a/src/collections/operations/restoreVersion.ts b/src/collections/operations/restoreVersion.ts index 58d04958315..c3d061302c4 100644 --- a/src/collections/operations/restoreVersion.ts +++ b/src/collections/operations/restoreVersion.ts @@ -9,6 +9,7 @@ import { Where } from '../../types'; import sanitizeInternalFields from '../../utilities/sanitizeInternalFields'; import { afterChange } from '../../fields/hooks/afterChange'; import { afterRead } from '../../fields/hooks/afterRead'; +import { getLatestCollectionVersion } from '../../versions/getLatestCollectionVersion'; export type Arguments = { collection: Collection @@ -23,6 +24,7 @@ export type Arguments = { async function restoreVersion<T extends TypeWithID = any>(args: Arguments): Promise<T> { const { + collection, collection: { Model, config: collectionConfig, @@ -99,10 +101,11 @@ async function restoreVersion<T extends TypeWithID = any>(args: Arguments): Prom // fetch previousDoc // ///////////////////////////////////// - const previousDoc = await payload.findByID({ - collection: collectionConfig.slug, + const prevDocWithLocales = await getLatestCollectionVersion({ + payload, + collection, id: parentDocID, - depth, + query, }); // ///////////////////////////////////// @@ -123,6 +126,22 @@ async function restoreVersion<T extends TypeWithID = any>(args: Arguments): Prom result = JSON.parse(result); result = sanitizeInternalFields(result); + // ///////////////////////////////////// + // Save `previousDoc` as a version after restoring + // ///////////////////////////////////// + + const prevVersion = { ...prevDocWithLocales }; + + delete prevVersion.id; + + await VersionModel.create({ + parent: parentDocID, + version: prevVersion, + autosave: false, + createdAt: prevVersion.createdAt, + updatedAt: new Date().toISOString(), + }); + // ///////////////////////////////////// // afterRead - Fields // ///////////////////////////////////// @@ -156,7 +175,7 @@ async function restoreVersion<T extends TypeWithID = any>(args: Arguments): Prom result = await afterChange({ data: result, doc: result, - previousDoc, + previousDoc: prevDocWithLocales, entityConfig: collectionConfig, operation: 'update', req, @@ -172,7 +191,7 @@ async function restoreVersion<T extends TypeWithID = any>(args: Arguments): Prom result = await hook({ doc: result, req, - previousDoc, + previousDoc: prevDocWithLocales, operation: 'update', }) || result; }, Promise.resolve()); diff --git a/src/versions/getLatestCollectionVersion.ts b/src/versions/getLatestCollectionVersion.ts index 0560ed88003..f58640678c6 100644 --- a/src/versions/getLatestCollectionVersion.ts +++ b/src/versions/getLatestCollectionVersion.ts @@ -1,6 +1,7 @@ import { Document } from '../types'; import { Payload } from '../payload'; import { Collection, TypeWithID } from '../collections/config/types'; +import sanitizeInternalFields from '../utilities/sanitizeInternalFields'; type Args = { payload: Payload @@ -29,13 +30,16 @@ export const getLatestCollectionVersion = async <T extends TypeWithID = any>({ lean, }); } - const collection = await Model.findOne(query, {}, { lean }) as Document; + let collection = await Model.findOne(query, {}, { lean }) as Document; version = await version; if (!version || version.updatedAt < collection.updatedAt) { + collection.id = collection._id; + collection = sanitizeInternalFields(collection); return collection; } return { ...version.version, + id, updatedAt: version.updatedAt, createdAt: version.createdAt, }; diff --git a/test/versions/int.spec.ts b/test/versions/int.spec.ts index d7689797e13..6205ff89995 100644 --- a/test/versions/int.spec.ts +++ b/test/versions/int.spec.ts @@ -47,7 +47,7 @@ describe('Versions', () => { describe('Collections - Local', () => { describe('Create', () => { - it('should allow a new version to be created', async () => { + it('should allow a new version to be created and updated', async () => { const autosavePost = await payload.create({ collection, data: { @@ -56,10 +56,10 @@ describe('Versions', () => { }, }); - const updatedTitle = 'Here is an updated post title in EN'; - collectionLocalPostID = autosavePost.id; + const updatedTitle = 'Here is an updated post title in EN'; + const updatedPost: { title: string _status?: string @@ -71,15 +71,15 @@ describe('Versions', () => { }, }); + expect(updatedPost.title).toBe(updatedTitle); + expect(updatedPost._status).toStrictEqual('draft'); + const versions = await payload.findVersions({ collection, }); collectionLocalVersionID = versions.docs[0].id; - expect(updatedPost.title).toBe(updatedTitle); - expect(updatedPost._status).toStrictEqual('draft'); - expect(collectionLocalVersionID).toBeDefined(); }); @@ -99,6 +99,7 @@ describe('Versions', () => { description: 'description 2', }, }); + const finalDescription = 'final description'; const secondUpdate = await payload.update({ @@ -187,20 +188,21 @@ describe('Versions', () => { collection, }); - const restore = await payload.restoreVersion({ + // restore to latest version + const restoredVersion = await payload.restoreVersion({ collection, id: versions.docs[1].id, }); - expect(restore.title).toBeDefined(); + expect(restoredVersion.title).toBeDefined(); - const restoredPost = await payload.findByID({ + const latestDraft = await payload.findByID({ collection, id: collectionLocalPostID, draft: true, }); - expect(restoredPost.title).toBe(versions.docs[1].version.title); + expect(latestDraft.title).toBe(versions.docs[1].version.title); }); });
59631c78794661568a4deb8b1b8954690b9498ed
2022-11-22 19:43:41
Jarrod Flesch
chore: adds preview button to versions test configs
false
adds preview button to versions test configs
chore
diff --git a/test/versions/globals/Autosave.ts b/test/versions/globals/Autosave.ts index 9d6e59421ff..82ae6dbba95 100644 --- a/test/versions/globals/Autosave.ts +++ b/test/versions/globals/Autosave.ts @@ -3,6 +3,7 @@ import { GlobalConfig } from '../../../src/globals/config/types'; const AutosaveGlobal: GlobalConfig = { slug: 'autosave-global', label: 'Autosave Global', + preview: () => 'https://payloadcms.com', versions: { max: 20, drafts: { diff --git a/test/versions/globals/Draft.ts b/test/versions/globals/Draft.ts index 251333c54db..5a5a6949071 100644 --- a/test/versions/globals/Draft.ts +++ b/test/versions/globals/Draft.ts @@ -3,6 +3,7 @@ import { GlobalConfig } from '../../../src/globals/config/types'; const DraftGlobal: GlobalConfig = { slug: 'draft-global', label: 'Draft Global', + preview: () => 'https://payloadcms.com', versions: { max: 20, drafts: true,
b6d85f6efcfe067d927177b803a04d1ee463ab66
2024-07-08 02:27:59
Paul
feat(ui): support nested tabs, groups, collapsibles and rows in where filters in list view (#7044)
false
support nested tabs, groups, collapsibles and rows in where filters in list view (#7044)
feat
diff --git a/packages/ui/src/elements/WhereBuilder/index.tsx b/packages/ui/src/elements/WhereBuilder/index.tsx index 84ba5ccaf05..1a5ecb999c5 100644 --- a/packages/ui/src/elements/WhereBuilder/index.tsx +++ b/packages/ui/src/elements/WhereBuilder/index.tsx @@ -30,11 +30,11 @@ export const WhereBuilder: React.FC<WhereBuilderProps> = (props) => { const { i18n, t } = useTranslation() const { code: currentLocale } = useLocale() - const [reducedFields, setReducedColumns] = useState(() => reduceFieldMap(fieldMap, i18n)) + const [reducedFields, setReducedColumns] = useState(() => reduceFieldMap({ fieldMap, i18n })) useEffect(() => { - setReducedColumns(reduceFieldMap(fieldMap, i18n, undefined, undefined, currentLocale)) - }, [fieldMap, i18n, currentLocale]) + setReducedColumns(reduceFieldMap({ fieldMap, i18n })) + }, [fieldMap, i18n]) const { searchParams } = useSearchParams() const { handleWhereChange } = useListQuery() diff --git a/packages/ui/src/elements/WhereBuilder/reduceFieldMap.tsx b/packages/ui/src/elements/WhereBuilder/reduceFieldMap.tsx index 57a09c0ea0b..f2d499e7f56 100644 --- a/packages/ui/src/elements/WhereBuilder/reduceFieldMap.tsx +++ b/packages/ui/src/elements/WhereBuilder/reduceFieldMap.tsx @@ -1,38 +1,113 @@ 'use client' +import type { ClientTranslationKeys, I18nClient } from '@payloadcms/translations' + +import { getTranslation } from '@payloadcms/translations'; + import type { FieldMap } from '../../utilities/buildComponentMap.js' import { createNestedClientFieldPath } from '../../forms/Form/createNestedFieldPath.js' import { combineLabel } from '../FieldSelect/index.js' import fieldTypes from './field-types.js' -export const reduceFieldMap = ( - fieldMap: FieldMap, - i18n, - labelPrefix?: string, - pathPrefix?: string, - locale?: string, -) => { +export type ReduceFieldMapArgs = { + fieldMap: FieldMap + i18n: I18nClient + labelPrefix?: string + pathPrefix?: string +} + +/** + * Reduces a field map to a flat array of fields with labels and values. + * Used in the WhereBuilder component to render the fields in the dropdown. + */ +export const reduceFieldMap = ({ fieldMap, i18n, labelPrefix, pathPrefix }: ReduceFieldMapArgs) => { return fieldMap.reduce((reduced, field) => { if (field.disableListFilter) return reduced if (field.type === 'tabs' && 'tabs' in field.fieldComponentProps) { const tabs = field.fieldComponentProps.tabs tabs.forEach((tab) => { - if (tab.name && typeof tab.label === 'string' && tab.fieldMap) { - reduced.push(...reduceFieldMap(tab.fieldMap, i18n, tab.label, tab.name)) + if (typeof tab.label !== 'boolean') { + const localizedTabLabel = getTranslation(tab.label, i18n) + const labelWithPrefix = labelPrefix + ? labelPrefix + ' > ' + localizedTabLabel + : localizedTabLabel + + // Make sure we handle nested tabs + const tabPathPrefix = tab.name + ? pathPrefix + ? pathPrefix + '.' + tab.name + : tab.name + : pathPrefix + + if (typeof localizedTabLabel === 'string') { + reduced.push( + ...reduceFieldMap({ + fieldMap: tab.fieldMap, + i18n, + labelPrefix: labelWithPrefix, + pathPrefix: tabPathPrefix, + }), + ) + } } }) return reduced } + // Rows cant have labels, so we need to handle them differently + if (field.type === 'row' && 'fieldMap' in field.fieldComponentProps) { + reduced.push( + ...reduceFieldMap({ + fieldMap: field.fieldComponentProps.fieldMap, + i18n, + labelPrefix, + pathPrefix, + }), + ) + return reduced + } + + if (field.type === 'collapsible' && 'fieldMap' in field.fieldComponentProps) { + const localizedTabLabel = getTranslation(field.fieldComponentProps.label, i18n) + const labelWithPrefix = labelPrefix + ? labelPrefix + ' > ' + localizedTabLabel + : localizedTabLabel + + reduced.push( + ...reduceFieldMap({ + fieldMap: field.fieldComponentProps.fieldMap, + i18n, + labelPrefix: labelWithPrefix, + pathPrefix, + }), + ) + return reduced + } + if (field.type === 'group' && 'fieldMap' in field.fieldComponentProps) { + const translatedLabel = getTranslation(field.fieldComponentProps.label, i18n) + + const labelWithPrefix = labelPrefix + ? translatedLabel + ? labelPrefix + ' > ' + translatedLabel + : labelPrefix + : translatedLabel + + // Make sure we handle deeply nested groups + const pathWithPrefix = field.name + ? pathPrefix + ? pathPrefix + '.' + field.name + : field.name + : pathPrefix + reduced.push( - ...reduceFieldMap( - field.fieldComponentProps.fieldMap, + ...reduceFieldMap({ + fieldMap: field.fieldComponentProps.fieldMap, i18n, - field.fieldComponentProps.label as string, - field.name, - ), + labelPrefix: labelWithPrefix, + pathPrefix: pathWithPrefix, + }), ) return reduced } @@ -42,18 +117,16 @@ export const reduceFieldMap = ( const operators = fieldTypes[field.type].operators.reduce((acc, operator) => { if (!operatorKeys.has(operator.value)) { operatorKeys.add(operator.value) + const operatorKey = `operators:${operator.label}` as ClientTranslationKeys acc.push({ ...operator, - label: i18n.t(`operators:${operator.label}`), + label: i18n.t(operatorKey), }) } return acc }, []) - const localizedLabel = - locale && typeof field.fieldComponentProps.label === 'object' - ? field.fieldComponentProps.label[locale] - : field.fieldComponentProps.label + const localizedLabel = getTranslation(field.fieldComponentProps.label, i18n) const formattedLabel = labelPrefix ? combineLabel({ diff --git a/test/admin/e2e/2/e2e.spec.ts b/test/admin/e2e/2/e2e.spec.ts index e2d60cb9b3d..15e777e44ba 100644 --- a/test/admin/e2e/2/e2e.spec.ts +++ b/test/admin/e2e/2/e2e.spec.ts @@ -738,7 +738,8 @@ describe('admin2', () => { await page.locator('.where-builder__add-first-filter').click() await page.locator('.condition__field .rs__control').click() const options = page.locator('.rs__option') - await expect(options.locator('text=Title')).toHaveText('Title') + + await expect(options.locator('text=Tab 1 > Title')).toHaveText('Tab 1 > Title') // list columns await expect(page.locator('#heading-title .sort-column__label')).toHaveText('Title')
6355d732be38abb9c55c5be4eeb0281c558e9621
2023-08-01 21:00:23
Elliot DeNolf
chore: drop pg database when PAYLOAD_DROP_DATABASE
false
drop pg database when PAYLOAD_DROP_DATABASE
chore
diff --git a/packages/db-postgres/package.json b/packages/db-postgres/package.json index 035bb1c4191..f9351d4b859 100644 --- a/packages/db-postgres/package.json +++ b/packages/db-postgres/package.json @@ -14,7 +14,8 @@ }, "dependencies": { "drizzle-orm": "^0.27.2", - "pg": "^8.11.1" + "pg": "^8.11.1", + "pgtools": "^1.0.0" }, "devDependencies": { "@types/pg": "^8.10.2", diff --git a/packages/db-postgres/src/connect.ts b/packages/db-postgres/src/connect.ts index be4a241a5bf..54bed85a960 100644 --- a/packages/db-postgres/src/connect.ts +++ b/packages/db-postgres/src/connect.ts @@ -1,7 +1,7 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ import type { Connect } from 'payload/dist/database/types'; import { drizzle, NodePgDatabase } from 'drizzle-orm/node-postgres'; -import { Client, Pool } from 'pg'; +import { Client, ClientConfig, Pool, PoolConfig } from 'pg'; +import { dropdb } from 'pgtools'; import type { PostgresAdapter } from '.'; @@ -12,20 +12,38 @@ export const connect: Connect = async function connect( let db: NodePgDatabase<Record<string, never>>; try { + let config: string | ClientConfig | PoolConfig; if ('pool' in this && this.pool !== false) { const pool = new Pool(this.pool); db = drizzle(pool); + config = this.pool; } if ('client' in this && this.client !== false) { const client = new Client(this.client); await client.connect(); db = drizzle(client); + config = this.client; } if (process.env.PAYLOAD_DROP_DATABASE === 'true') { this.payload.logger.info('---- DROPPING DATABASE ----'); - // NEED TO DROP DATABASE HERE + + // Get database name from config + let databaseName: string | undefined; + if (typeof config === 'string') { + databaseName = config.split('/').pop() || ''; + } else { + databaseName = config.database; + } + + if (!databaseName) { + throw new Error( + 'Cannot drop database. Database name not found in config.', + ); + } + + await dropdb(config, databaseName); this.payload.logger.info('---- DROPPED DATABASE ----'); } } catch (err) { diff --git a/packages/db-postgres/yarn.lock b/packages/db-postgres/yarn.lock index e93d93449c3..60d2909e205 100644 --- a/packages/db-postgres/yarn.lock +++ b/packages/db-postgres/yarn.lock @@ -1873,6 +1873,11 @@ [email protected]: resolved "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz#69fbc4d6ccbe383f9736934ae34c3f8290f1bf41" integrity sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw== +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA== + ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" @@ -2157,6 +2162,11 @@ camel-case@^4.1.2: pascal-case "^3.1.2" tslib "^2.0.3" +camelcase@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" + integrity sha512-4nhGqUkc4BqbBBB4Q6zLuD7lzzrHYrjKGeYaEji/3tFR5VdJu9v+LilhGIVe8wxEJPPOeWo7eg8dwY13TZ1BNg== + caniuse-api@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz#5e4d90e2274961d46291997df599e3ed008ee4c0" @@ -2247,6 +2257,15 @@ cli-color@^2.0.2: memoizee "^0.4.15" timers-ext "^0.1.7" +cliui@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" + integrity sha512-0yayqDxWQbqk3ojkYqUKqaAQ6AfNKeKWRNA8kR0WXzAsdHpP4BIaOmMAG87JGuO6qcobyW4GjxHd9PmhEd+T9w== + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + wrap-ansi "^2.0.0" + clone-deep@^4.0.1: version "4.0.1" resolved "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" @@ -2261,6 +2280,11 @@ clsx@^1.1.1: resolved "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12" integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg== +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA== + color-convert@^1.9.0: version "1.9.3" resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -2668,6 +2692,11 @@ debug@^3.2.6: dependencies: ms "^2.1.1" +decamelize@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== + decompress-response@^6.0.0: version "6.0.0" resolved "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc" @@ -2904,7 +2933,7 @@ envinfo@^7.7.3: resolved "https://registry.npmjs.org/envinfo/-/envinfo-7.10.0.tgz#55146e3909cc5fe63c22da63fb15b05aeac35b13" integrity sha512-ZtUjZO6l5mwTHvc1L9+1q5p/R3wTopcfqMW8r5t8SJSKqeVI/LtajORwRFEKpEFuekjD0VBjwu1HMxL4UalIRw== -error-ex@^1.3.1: +error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.2" resolved "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== @@ -3183,6 +3212,14 @@ [email protected], find-up@^4.0.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-up@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + integrity sha512-jvElSjyuo4EMQGoTwo1uJU5pQMwTW5lS1x05zzfJuTIyLR3zwO27LYrxNg+dlvKpGOuGy/MzBdXh80g0ve5+HA== + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + find-up@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" @@ -3270,6 +3307,11 @@ functions-have-names@^1.2.3: resolved "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== +get-caller-file@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== + get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.0, get-intrinsic@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz#d295644fed4505fc9cde952c37ee12b477a83d82" @@ -3479,6 +3521,11 @@ hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.1: dependencies: react-is "^16.7.0" +hosted-git-info@^2.1.4: + version "2.8.9" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" + integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== + html-entities@^2.1.0: version "2.4.0" resolved "https://registry.npmjs.org/html-entities/-/html-entities-2.4.0.tgz#edd0cee70402584c8c76cc2c0556db09d1f45061" @@ -3635,6 +3682,11 @@ interpret@^2.2.0: resolved "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== +invert-kv@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + integrity sha512-xgs2NH9AE66ucSq4cNG1nhSFghr5l6tdL15Pk+jl46bmmBapgoaY/AacXyaDznAqmGL99TiLSQgO/XazFSKYeQ== + ip@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz#4cf4ab182fee2314c75ede1276f8c80b479936da" @@ -3723,6 +3775,13 @@ is-extglob@^2.1.1: resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw== + dependencies: + number-is-nan "^1.0.0" + is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" @@ -3820,6 +3879,11 @@ is-typed-array@^1.1.10: dependencies: which-typed-array "^1.1.11" +is-utf8@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + integrity sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q== + is-weakmap@^2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz#5008b59bdc43b698201d18f62b37b2ca243e8cf2" @@ -4021,6 +4085,13 @@ klona@^2.0.4, klona@^2.0.5: resolved "https://registry.npmjs.org/klona/-/klona-2.0.6.tgz#85bffbf819c03b2f53270412420a4555ef882e22" integrity sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA== +lcid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + integrity sha512-YiGkH6EnGrDGqLMITnGjXtGmNtjoXw9SVUzcaos8RBi7Ps0VBylkq+vOcY9QE5poLasPCR849ucFUkl0UzUyOw== + dependencies: + invert-kv "^1.0.0" + lilconfig@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52" @@ -4031,6 +4102,17 @@ lines-and-columns@^1.1.6: resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== +load-json-file@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + integrity sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A== + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + pinkie-promise "^2.0.0" + strip-bom "^2.0.0" + loader-runner@^4.2.0: version "4.3.0" resolved "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" @@ -4060,6 +4142,11 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +lodash.assign@^4.1.0, lodash.assign@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" + integrity sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw== + lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" @@ -4428,6 +4515,16 @@ nodemailer@^6.9.0: resolved "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.4.tgz#93bd4a60eb0be6fa088a0483340551ebabfd2abf" integrity sha512-CXjQvrQZV4+6X5wP6ZIgdehJamI63MFoYFGGPtHudWym9qaEHDNdPzaj5bfMCvxG1vhAileSWW90q7nL0N36mA== +normalize-package-data@^2.3.2: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" @@ -4445,6 +4542,11 @@ nth-check@^2.0.1: dependencies: boolbase "^1.0.0" +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ== + object-assign@^4.0.1, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -4524,6 +4626,13 @@ opener@^1.5.2: resolved "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598" integrity sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A== +os-locale@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" + integrity sha512-PRT7ZORmwu2MEFt4/fv3Q+mEfN4zetKxufQrkShY2oGvUms9r8otu5HfdyIFHkYXjO7laNsoVGmM2MANfuTA8g== + dependencies: + lcid "^1.0.0" + p-limit@^2.0.0, p-limit@^2.2.0: version "2.3.0" resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -4570,6 +4679,13 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ== + dependencies: + error-ex "^1.2.0" + parse-json@^5.0.0: version "5.2.0" resolved "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" @@ -4642,6 +4758,13 @@ path-browserify@^1.0.1: resolved "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + integrity sha512-yTltuKuhtNeFJKa1PiRzfLAU5182q1y4Eb4XCJ3PBqyzEDkAZRzBrKKBct682ls9reBVHf9udYLN5Nd+K1B9BQ== + dependencies: + pinkie-promise "^2.0.0" + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" @@ -4679,6 +4802,15 @@ path-to-regexp@^1.7.0: dependencies: isarray "0.0.1" +path-type@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + integrity sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg== + dependencies: + graceful-fs "^4.1.2" + pify "^2.0.0" + pinkie-promise "^2.0.0" + path-type@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" @@ -4817,6 +4949,11 @@ pg-cloudflare@^1.1.1: resolved "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz#e6d5833015b170e23ae819e8c5d7eaedb472ca98" integrity sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q== +pg-connection-string@^2.5.0, pg-connection-string@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.6.2.tgz#713d82053de4e2bd166fab70cd4f26ad36aab475" + integrity sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA== + pg-connection-string@^2.6.1: version "2.6.1" resolved "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.1.tgz#78c23c21a35dd116f48e12e23c0965e8d9e2cbfb" @@ -4881,6 +5018,21 @@ pg@^8.11.1: optionalDependencies: pg-cloudflare "^1.1.1" +pg@^8.9.0: + version "8.11.2" + resolved "https://registry.yarnpkg.com/pg/-/pg-8.11.2.tgz#1a23f6de7bfb65ba56e4dd15df96668d319900c4" + integrity sha512-l4rmVeV8qTIrrPrIR3kZQqBgSN93331s9i6wiUiLOSk0Q7PmUxZD/m1rQI622l3NfqBby9Ar5PABfS/SulfieQ== + dependencies: + buffer-writer "2.0.0" + packet-reader "1.0.0" + pg-connection-string "^2.6.2" + pg-pool "^3.6.1" + pg-protocol "^1.6.0" + pg-types "^2.1.0" + pgpass "1.x" + optionalDependencies: + pg-cloudflare "^1.1.1" + [email protected]: version "1.0.5" resolved "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz#9b873e4a564bb10fa7a7dbd55312728d422a223d" @@ -4888,6 +5040,15 @@ [email protected]: dependencies: split2 "^4.1.0" +pgtools@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pgtools/-/pgtools-1.0.0.tgz#a538f4a67fc55e195ee50c760138455dac66939a" + integrity sha512-vjpsfGE9CaGxhIOjP0fiHWBU+MH2e2PiaD0193sFrhy1/7hK5lOqGEcxTqGLWL8rPSDdmqLSg6iGeni56G/2xg== + dependencies: + pg "^8.9.0" + pg-connection-string "^2.5.0" + yargs "^5.0.0" + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -4898,6 +5059,23 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3: resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + integrity sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw== + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + integrity sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg== + pino-abstract-transport@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-1.0.0.tgz#cc0d6955fffcadb91b7b49ef220a6cc111d48bb3" @@ -5830,6 +6008,23 @@ react@^18.2.0: dependencies: loose-envify "^1.1.0" +read-pkg-up@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + integrity sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A== + dependencies: + find-up "^1.0.0" + read-pkg "^1.0.0" + +read-pkg@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + integrity sha512-7BGwRHqt4s/uVbuyoeejRn4YmFnYZiFl4AuaeXHlgZf3sONF0SOGlxs2Pw8g6hCKupo08RafIO5YXFNOKTfwsQ== + dependencies: + load-json-file "^1.0.0" + normalize-package-data "^2.3.2" + path-type "^1.0.0" + readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: version "3.6.2" resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" @@ -5901,11 +6096,21 @@ renderkid@^3.0.0: lodash "^4.17.21" strip-ansi "^6.0.1" +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== + require-from-string@^2.0.2: version "2.0.2" resolved "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== +require-main-filename@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug== + resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" @@ -5933,7 +6138,7 @@ resolve-pkg-maps@^1.0.0: resolved "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz#616b3dc2c57056b5588c31cdf4b3d64db133720f" integrity sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw== -resolve@^1.19.0, resolve@^1.9.0: +resolve@^1.10.0, resolve@^1.19.0, resolve@^1.9.0: version "1.22.2" resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== @@ -6036,6 +6241,11 @@ secure-json-parse@^2.4.0: resolved "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz#5a5f9cd6ae47df23dba3151edd06855d47e09862" integrity sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw== +"semver@2 || 3 || 4 || 5": + version "5.7.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" + integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== + semver@^7.3.5, semver@^7.3.8: version "7.5.4" resolved "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" @@ -6079,6 +6289,11 @@ [email protected]: parseurl "~1.3.3" send "0.18.0" +set-blocking@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== + [email protected]: version "1.2.0" resolved "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" @@ -6267,6 +6482,32 @@ sparse-bitfield@^3.0.3: dependencies: memory-pager "^1.0.2" +spdx-correct@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.2.0.tgz#4f5ab0668f0059e34f9c00dce331784a12de4e9c" + integrity sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" + integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== + +spdx-expression-parse@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.13" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz#7189a474c46f8d47c7b0da4b987bb45e908bd2d5" + integrity sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w== + split2@^4.0.0, split2@^4.1.0: version "4.2.0" resolved "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4" @@ -6301,6 +6542,15 @@ streamsearch@^1.1.0: resolved "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== +string-width@^1.0.1, string-width@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw== + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + string_decoder@^1.1.1, string_decoder@^1.3.0: version "1.3.0" resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -6308,6 +6558,13 @@ string_decoder@^1.1.1, string_decoder@^1.3.0: dependencies: safe-buffer "~5.2.0" +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg== + dependencies: + ansi-regex "^2.0.0" + strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -6315,6 +6572,13 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" +strip-bom@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + integrity sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g== + dependencies: + is-utf8 "^0.2.0" + strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" @@ -6659,6 +6923,14 @@ uuid@^8.3.2: resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== +validate-npm-package-license@^3.0.1: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + value-equal@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c" @@ -6846,6 +7118,11 @@ which-collection@^1.0.1: is-weakmap "^2.0.1" is-weakset "^2.0.1" +which-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" + integrity sha512-F6+WgncZi/mJDrammbTuHe1q0R5hOXv/mBaiNA2TCNT/LTHusX0V+CJnj9XT8ki5ln2UZyyddDgHfCzyrOH7MQ== + which-typed-array@^1.1.11, which-typed-array@^1.1.9: version "1.1.11" resolved "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz#99d691f23c72aab6768680805a271b69761ed61a" @@ -6869,6 +7146,19 @@ wildcard@^2.0.0: resolved "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz#5ab10d02487198954836b6349f74fff961e10f67" integrity sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ== +window-size@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075" + integrity sha512-UD7d8HFA2+PZsbKyaOCEy8gMh1oDtHgJh1LfgjQ4zVXmYjAT/kvz3PueITKuqDiIXQe7yzpPnxX3lNc+AhQMyw== + +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha512-vAaEaDM946gbNpH5pLVNR+vX2ht6n0Bt3GXwVB1AuAqZosOvHNF3P7wDnh8KLkSqgUh0uh77le7Owgoz+Z9XBw== + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + wrappy@1: version "1.0.2" resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" @@ -6892,6 +7182,11 @@ xtend@^4.0.0: resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== +y18n@^3.2.1: + version "3.2.2" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.2.tgz#85c901bd6470ce71fc4bb723ad209b70f7f28696" + integrity sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ== + yallist@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" @@ -6901,3 +7196,31 @@ yaml@^1.10.0: version "1.10.2" resolved "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== + +yargs-parser@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-3.2.0.tgz#5081355d19d9d0c8c5d81ada908cb4e6d186664f" + integrity sha512-eANlJIqYwhwS/asi4ybKxkeJYUIjNMZXL36C/KICV5jyudUZWp+/lEfBHM0PuJcQjBfs00HwqePEQjtLJd+Kyw== + dependencies: + camelcase "^3.0.0" + lodash.assign "^4.1.0" + +yargs@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-5.0.0.tgz#3355144977d05757dbb86d6e38ec056123b3a66e" + integrity sha512-krgVLGNhMWUVY1EJkM/bgbvn3yCIRrsZp6KaeX8hx8ztT+jBtX7/flTQcSHe5089xIDQRUsEr2mzlZVNe/7P5w== + dependencies: + cliui "^3.2.0" + decamelize "^1.1.1" + get-caller-file "^1.0.1" + lodash.assign "^4.2.0" + os-locale "^1.4.0" + read-pkg-up "^1.0.1" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^1.0.2" + which-module "^1.0.0" + window-size "^0.2.0" + y18n "^3.2.1" + yargs-parser "^3.2.0"
f5cf7c0ca7a02830725521f8f0ca788fe38616b5
2024-03-02 02:24:47
James
chore: begins flattening admin ui pages
false
begins flattening admin ui pages
chore
diff --git a/app/(payload)/page.tsx b/app/(payload)/admin/[...segments]/page.tsx similarity index 66% rename from app/(payload)/page.tsx rename to app/(payload)/admin/[...segments]/page.tsx index 21306b5638c..369917cfb27 100644 --- a/app/(payload)/page.tsx +++ b/app/(payload)/admin/[...segments]/page.tsx @@ -1,8 +1,14 @@ /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ +import config from '@payload-config' /* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ import { RootPage } from '@payloadcms/next/pages/Root/index' -import config from '@payload-config' -const Page = () => RootPage({ config }) +type Args = { + params: { + segments: string[] + } +} + +const Page = ({ params }: Args) => RootPage({ config, params }) export default Page diff --git a/app/(payload)/layout.tsx b/app/(payload)/layout.tsx index 1cc0981e209..6701de3a557 100644 --- a/app/(payload)/layout.tsx +++ b/app/(payload)/layout.tsx @@ -1,11 +1,13 @@ /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ +import configPromise from '@payload-config' +import { RootLayout } from '@payloadcms/next/layouts/Root/index' /* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ import React from 'react' -import { RootLayout } from '@payloadcms/next/layouts/Root/index' -import configPromise from '@payload-config' -const Layout = async ({ children }: { children: React.ReactNode }) => ( - <RootLayout config={configPromise}>{children}</RootLayout> -) +type Args = { + children: React.ReactNode +} + +const Layout = ({ children }: Args) => <RootLayout config={configPromise}>{children}</RootLayout> export default Layout diff --git a/app/(payload)/admin/(dashboard)/account/page.tsx b/app/(payload)/old/(dashboard)/account/page.tsx similarity index 100% rename from app/(payload)/admin/(dashboard)/account/page.tsx rename to app/(payload)/old/(dashboard)/account/page.tsx diff --git a/app/(payload)/admin/(dashboard)/collections/[collection]/[...segments]/layout.tsx b/app/(payload)/old/(dashboard)/collections/[collection]/[...segments]/layout.tsx similarity index 100% rename from app/(payload)/admin/(dashboard)/collections/[collection]/[...segments]/layout.tsx rename to app/(payload)/old/(dashboard)/collections/[collection]/[...segments]/layout.tsx diff --git a/app/(payload)/admin/(dashboard)/collections/[collection]/[...segments]/page.tsx b/app/(payload)/old/(dashboard)/collections/[collection]/[...segments]/page.tsx similarity index 100% rename from app/(payload)/admin/(dashboard)/collections/[collection]/[...segments]/page.tsx rename to app/(payload)/old/(dashboard)/collections/[collection]/[...segments]/page.tsx diff --git a/app/(payload)/admin/(dashboard)/collections/[collection]/page.tsx b/app/(payload)/old/(dashboard)/collections/[collection]/page.tsx similarity index 100% rename from app/(payload)/admin/(dashboard)/collections/[collection]/page.tsx rename to app/(payload)/old/(dashboard)/collections/[collection]/page.tsx diff --git a/app/(payload)/admin/(dashboard)/globals/[global]/[[...segments]]/page.tsx b/app/(payload)/old/(dashboard)/globals/[global]/[[...segments]]/page.tsx similarity index 100% rename from app/(payload)/admin/(dashboard)/globals/[global]/[[...segments]]/page.tsx rename to app/(payload)/old/(dashboard)/globals/[global]/[[...segments]]/page.tsx diff --git a/app/(payload)/admin/(dashboard)/globals/[global]/layout.tsx b/app/(payload)/old/(dashboard)/globals/[global]/layout.tsx similarity index 100% rename from app/(payload)/admin/(dashboard)/globals/[global]/layout.tsx rename to app/(payload)/old/(dashboard)/globals/[global]/layout.tsx diff --git a/app/(payload)/admin/(dashboard)/layout.tsx b/app/(payload)/old/(dashboard)/layout.tsx similarity index 100% rename from app/(payload)/admin/(dashboard)/layout.tsx rename to app/(payload)/old/(dashboard)/layout.tsx diff --git a/app/(payload)/admin/(dashboard)/page.tsx b/app/(payload)/old/(dashboard)/page.tsx similarity index 100% rename from app/(payload)/admin/(dashboard)/page.tsx rename to app/(payload)/old/(dashboard)/page.tsx diff --git a/app/(payload)/admin/create-first-user/page.tsx b/app/(payload)/old/create-first-user/page.tsx similarity index 100% rename from app/(payload)/admin/create-first-user/page.tsx rename to app/(payload)/old/create-first-user/page.tsx diff --git a/app/(payload)/admin/forgot/page.tsx b/app/(payload)/old/forgot/page.tsx similarity index 100% rename from app/(payload)/admin/forgot/page.tsx rename to app/(payload)/old/forgot/page.tsx diff --git a/app/(payload)/admin/login/page.tsx b/app/(payload)/old/login/page.tsx similarity index 100% rename from app/(payload)/admin/login/page.tsx rename to app/(payload)/old/login/page.tsx diff --git a/app/(payload)/admin/logout-inactivity/page.tsx b/app/(payload)/old/logout-inactivity/page.tsx similarity index 100% rename from app/(payload)/admin/logout-inactivity/page.tsx rename to app/(payload)/old/logout-inactivity/page.tsx diff --git a/app/(payload)/admin/logout/page.tsx b/app/(payload)/old/logout/page.tsx similarity index 100% rename from app/(payload)/admin/logout/page.tsx rename to app/(payload)/old/logout/page.tsx diff --git a/app/(payload)/admin/reset/[token]/page.tsx b/app/(payload)/old/reset/[token]/page.tsx similarity index 100% rename from app/(payload)/admin/reset/[token]/page.tsx rename to app/(payload)/old/reset/[token]/page.tsx diff --git a/app/(payload)/admin/unauthorized/page.tsx b/app/(payload)/old/unauthorized/page.tsx similarity index 100% rename from app/(payload)/admin/unauthorized/page.tsx rename to app/(payload)/old/unauthorized/page.tsx diff --git a/app/(payload)/admin/verify/[token]/page.tsx b/app/(payload)/old/verify/[token]/page.tsx similarity index 100% rename from app/(payload)/admin/verify/[token]/page.tsx rename to app/(payload)/old/verify/[token]/page.tsx diff --git a/packages/next/src/pages/Login/index.tsx b/packages/next/src/pages/Login/index.tsx index 4e36c595db3..ad3327e0e13 100644 --- a/packages/next/src/pages/Login/index.tsx +++ b/packages/next/src/pages/Login/index.tsx @@ -5,8 +5,9 @@ import { Logo, MinimalTemplate } from '@payloadcms/ui' import { redirect } from 'next/navigation' import React, { Fragment } from 'react' +import type { InitPageResult } from '../../utilities/initPage' + import { getNextI18n } from '../../utilities/getNextI18n' -import { initPage } from '../../utilities/initPage' import { meta } from '../../utilities/meta' import { LoginForm } from './LoginForm' import './index.scss' @@ -33,10 +34,10 @@ export const generateMetadata = async ({ } export const Login: React.FC<{ - config: Promise<SanitizedConfig> + page: InitPageResult searchParams: { [key: string]: string | string[] | undefined } -}> = async ({ config: configPromise, searchParams }) => { - const { req } = await initPage({ config: configPromise, route: '/login', searchParams }) +}> = ({ page, searchParams }) => { + const { req } = page const { payload: { config }, diff --git a/packages/next/src/pages/Root/index.tsx b/packages/next/src/pages/Root/index.tsx index e3c228164a9..f1d08c7d552 100644 --- a/packages/next/src/pages/Root/index.tsx +++ b/packages/next/src/pages/Root/index.tsx @@ -1,8 +1,45 @@ import type { SanitizedConfig } from 'payload/types' -import { redirect } from 'next/navigation' +import React from 'react' -export const RootPage = async ({ config: configPromise }: { config: Promise<SanitizedConfig> }) => { +import { initPage } from '../../utilities/initPage' +import { Login } from '../Login' + +type Args = { + config: Promise<SanitizedConfig> + params: { + [key: string]: string[] + } + searchParams: { + [key: string]: string | string[] + } +} + +const views = { + login: Login, +} + +export const RootPage = async ({ config: configPromise, params, searchParams }: Args) => { const config = await configPromise - return redirect(config.routes.admin || '/admin') + const route = `${config.routes.admin}/${params.segments.join('/')}` + const page = await initPage({ config, route }) + + const [segmentOne, segmentTwo] = params.segments + + // Catch any single-segment routes: + // /create-first-user + // /forgot + // /login + // /logout + // /logout-inactivity + // /unauthorized + // /verify + + if (params.segments.length === 1 && views[segmentOne]) { + const View = views[segmentOne] + + return <View page={page} searchParams={searchParams} /> + } + + return null } diff --git a/packages/next/src/utilities/initPage.ts b/packages/next/src/utilities/initPage.ts index d634c7b4ad2..f5fcacb423c 100644 --- a/packages/next/src/utilities/initPage.ts +++ b/packages/next/src/utilities/initPage.ts @@ -19,15 +19,7 @@ import qs from 'qs' import { auth } from './auth' import { getRequestLanguage } from './getRequestLanguage' -export const initPage = async ({ - collectionSlug, - config: configPromise, - globalSlug, - localeParam, - redirectUnauthenticatedUser = false, - route, - searchParams, -}: { +type Args = { collectionSlug?: string config: Promise<SanitizedConfig> | SanitizedConfig globalSlug?: string @@ -35,13 +27,25 @@ export const initPage = async ({ redirectUnauthenticatedUser?: boolean route?: string searchParams?: { [key: string]: string | string[] | undefined } -}): Promise<{ +} + +export type InitPageResult = { collectionConfig?: SanitizedCollectionConfig globalConfig?: SanitizedGlobalConfig locale: Locale permissions: Permissions req: PayloadRequest -}> => { +} + +export const initPage = async ({ + collectionSlug, + config: configPromise, + globalSlug, + localeParam, + redirectUnauthenticatedUser = false, + route, + searchParams, +}: Args): Promise<InitPageResult> => { const headers = getHeaders() const { cookies, permissions, user } = await auth({
f5191dc7c8210bef468c1467f346bc2b72383ae6
2022-03-30 01:08:22
James
chore: more consistently passes validation args
false
more consistently passes validation args
chore
diff --git a/src/admin/components/forms/Form/buildStateFromSchema.ts b/src/admin/components/forms/Form/buildStateFromSchema.ts index 66a69c8b5f9..e1ed9c01e2c 100644 --- a/src/admin/components/forms/Form/buildStateFromSchema.ts +++ b/src/admin/components/forms/Form/buildStateFromSchema.ts @@ -39,7 +39,6 @@ const buildStateFromSchema = async (args: Args): Promise<Fields> => { const { fieldSchema, data: fullData = {}, - siblingData = {}, user, id, operation, @@ -48,7 +47,7 @@ const buildStateFromSchema = async (args: Args): Promise<Fields> => { if (fieldSchema) { const validationPromises = []; - const structureFieldState = (field, passesCondition, data = {}) => { + const structureFieldState = (field, passesCondition, data = {}, siblingData = {}) => { const value = typeof data?.[field.name] !== 'undefined' ? data[field.name] : field.defaultValue; const fieldState = { @@ -156,7 +155,7 @@ const buildStateFromSchema = async (args: Args): Promise<Fields> => { return { ...state, - [`${path}${field.name}`]: structureFieldState(field, passesCondition, data), + [`${path}${field.name}`]: structureFieldState(field, passesCondition, fullData, data), }; } @@ -173,7 +172,7 @@ const buildStateFromSchema = async (args: Args): Promise<Fields> => { // Handle normal fields return { ...state, - [`${path}${namedField.name}`]: structureFieldState(field, passesCondition, data), + [`${path}${namedField.name}`]: structureFieldState(field, passesCondition, fullData, data), }; } diff --git a/src/admin/components/forms/field-types/Array/Array.tsx b/src/admin/components/forms/field-types/Array/Array.tsx index 047cafabb84..d80f81bba1a 100644 --- a/src/admin/components/forms/field-types/Array/Array.tsx +++ b/src/admin/components/forms/field-types/Array/Array.tsx @@ -1,6 +1,7 @@ import React, { useCallback, useEffect, useReducer, useState } from 'react'; import { DragDropContext, Droppable } from 'react-beautiful-dnd'; +import { useAuth } from '@payloadcms/config-provider'; import withCondition from '../../withCondition'; import Button from '../../../elements/Button'; import DraggableSection from '../../DraggableSection'; @@ -14,6 +15,9 @@ import Banner from '../../../elements/Banner'; import FieldDescription from '../../FieldDescription'; import { Props } from './types'; +import { useDocumentInfo } from '../../../utilities/DocumentInfo'; +import { useOperation } from '../../../utilities/OperationProvider'; + import './index.scss'; const baseClass = 'field-type array'; @@ -49,6 +53,9 @@ const ArrayFieldType: React.FC<Props> = (props) => { const [rows, dispatchRows] = useReducer(reducer, []); const formContext = useForm(); + const { user } = useAuth(); + const { id } = useDocumentInfo(); + const operation = useOperation(); const { dispatchFields } = formContext; @@ -74,11 +81,11 @@ const ArrayFieldType: React.FC<Props> = (props) => { }); const addRow = useCallback(async (rowIndex) => { - const subFieldState = await buildStateFromSchema({ fieldSchema: fields }); + const subFieldState = await buildStateFromSchema({ fieldSchema: fields, operation, id, user }); dispatchFields({ type: 'ADD_ROW', rowIndex, subFieldState, path }); dispatchRows({ type: 'ADD', rowIndex }); setValue(value as number + 1); - }, [dispatchRows, dispatchFields, fields, path, setValue, value]); + }, [dispatchRows, dispatchFields, fields, path, setValue, value, operation, id, user]); const removeRow = useCallback((rowIndex) => { dispatchRows({ type: 'REMOVE', rowIndex }); diff --git a/src/admin/components/forms/field-types/Blocks/Blocks.tsx b/src/admin/components/forms/field-types/Blocks/Blocks.tsx index ac5605a1a94..ece8f20fe9a 100644 --- a/src/admin/components/forms/field-types/Blocks/Blocks.tsx +++ b/src/admin/components/forms/field-types/Blocks/Blocks.tsx @@ -1,6 +1,7 @@ import React, { useCallback, useEffect, useReducer, useState } from 'react'; import { DragDropContext, Droppable } from 'react-beautiful-dnd'; +import { useAuth } from '@payloadcms/config-provider'; import { usePreferences } from '../../../utilities/Preferences'; import withCondition from '../../withCondition'; import Button from '../../../elements/Button'; @@ -18,6 +19,7 @@ import Banner from '../../../elements/Banner'; import FieldDescription from '../../FieldDescription'; import { Props } from './types'; import { DocumentPreferences } from '../../../../../preferences/types'; +import { useOperation } from '../../../utilities/OperationProvider'; import './index.scss'; @@ -55,6 +57,9 @@ const Blocks: React.FC<Props> = (props) => { const { getPreference, setPreference } = usePreferences(); const [rows, dispatchRows] = useReducer(reducer, []); const formContext = useForm(); + const { user } = useAuth(); + const { id } = useDocumentInfo(); + const operation = useOperation(); const { dispatchFields } = formContext; const memoizedValidate = useCallback((value, options) => { @@ -79,12 +84,12 @@ const Blocks: React.FC<Props> = (props) => { const addRow = useCallback(async (rowIndex, blockType) => { const block = blocks.find((potentialBlock) => potentialBlock.slug === blockType); - const subFieldState = await buildStateFromSchema({ fieldSchema: block.fields }); + const subFieldState = await buildStateFromSchema({ fieldSchema: block.fields, operation, id, user }); dispatchFields({ type: 'ADD_ROW', rowIndex, subFieldState, path, blockType }); dispatchRows({ type: 'ADD', rowIndex, blockType }); setValue(value as number + 1); - }, [path, setValue, value, blocks, dispatchFields]); + }, [path, setValue, value, blocks, dispatchFields, operation, id, user]); const removeRow = useCallback((rowIndex) => { dispatchRows({ type: 'REMOVE', rowIndex }); @@ -97,8 +102,8 @@ const Blocks: React.FC<Props> = (props) => { dispatchFields({ type: 'MOVE_ROW', moveFromIndex, moveToIndex, path }); }, [dispatchRows, dispatchFields, path]); - const setCollapse = useCallback(async (id: string, collapsed: boolean) => { - dispatchRows({ type: 'SET_COLLAPSE', id, collapsed }); + const setCollapse = useCallback(async (rowID: string, collapsed: boolean) => { + dispatchRows({ type: 'SET_COLLAPSE', rowID, collapsed }); if (preferencesKey) { const preferences: DocumentPreferences = await getPreference(preferencesKey); @@ -108,9 +113,9 @@ const Blocks: React.FC<Props> = (props) => { || []; if (!collapsed) { - newCollapsedState = newCollapsedState.filter((existingID) => existingID !== id); + newCollapsedState = newCollapsedState.filter((existingID) => existingID !== rowID); } else { - newCollapsedState.push(id); + newCollapsedState.push(rowID); } setPreference(preferencesKey, { diff --git a/src/admin/components/forms/field-types/RichText/elements/upload/Element/EditModal/index.tsx b/src/admin/components/forms/field-types/RichText/elements/upload/Element/EditModal/index.tsx index d2145b313cc..68efb21beae 100644 --- a/src/admin/components/forms/field-types/RichText/elements/upload/Element/EditModal/index.tsx +++ b/src/admin/components/forms/field-types/RichText/elements/upload/Element/EditModal/index.tsx @@ -2,6 +2,7 @@ import React, { useCallback, useEffect, useState } from 'react'; import { Transforms, Element } from 'slate'; import { ReactEditor, useSlateStatic } from 'slate-react'; import { Modal } from '@faceless-ui/modal'; +import { useAuth } from '@payloadcms/config-provider'; import { SanitizedCollectionConfig } from '../../../../../../../../../collections/config/types'; import buildStateFromSchema from '../../../../../../Form/buildStateFromSchema'; import MinimalTemplate from '../../../../../../../templates/Minimal'; @@ -29,6 +30,7 @@ type Props = { export const EditModal: React.FC<Props> = ({ slug, closeModal, relatedCollectionConfig, fieldSchema, element }) => { const editor = useSlateStatic(); const [initialState, setInitialState] = useState({}); + const { user } = useAuth(); const handleUpdateEditData = useCallback((fields) => { const newNode = { @@ -47,12 +49,12 @@ export const EditModal: React.FC<Props> = ({ slug, closeModal, relatedCollection useEffect(() => { const awaitInitialState = async () => { - const state = await buildStateFromSchema({ fieldSchema, data: element?.fields }); + const state = await buildStateFromSchema({ fieldSchema, data: element?.fields, user, operation: 'update' }); setInitialState(state); }; awaitInitialState(); - }, [fieldSchema, element.fields]); + }, [fieldSchema, element.fields, user]); return ( <Modal diff --git a/src/admin/components/views/Account/index.tsx b/src/admin/components/views/Account/index.tsx index 8fb2c7192ed..c09ee446f5c 100644 --- a/src/admin/components/views/Account/index.tsx +++ b/src/admin/components/views/Account/index.tsx @@ -9,6 +9,7 @@ import DefaultAccount from './Default'; import buildStateFromSchema from '../../forms/Form/buildStateFromSchema'; import RenderCustomComponent from '../../utilities/RenderCustomComponent'; import { NegativeFieldGutterProvider } from '../../forms/FieldTypeGutter/context'; +import { useDocumentInfo } from '../../utilities/DocumentInfo'; const AccountView: React.FC = () => { const { state: locationState } = useLocation<{ data: unknown }>(); @@ -16,6 +17,8 @@ const AccountView: React.FC = () => { const { setStepNav } = useStepNav(); const { user, permissions } = useAuth(); const [initialState, setInitialState] = useState({}); + const { id } = useDocumentInfo(); + const { serverURL, routes: { api }, @@ -61,12 +64,12 @@ const AccountView: React.FC = () => { useEffect(() => { const awaitInitialState = async () => { - const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender }); + const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender, operation: 'update', id, user }); setInitialState(state); }; awaitInitialState(); - }, [dataToRender, fields]); + }, [dataToRender, fields, id, user]); return ( <NegativeFieldGutterProvider allow> diff --git a/src/admin/components/views/Global/index.tsx b/src/admin/components/views/Global/index.tsx index 69b189d2b79..42087cf2f41 100644 --- a/src/admin/components/views/Global/index.tsx +++ b/src/admin/components/views/Global/index.tsx @@ -17,7 +17,7 @@ const GlobalView: React.FC<IndexProps> = (props) => { const { state: locationState } = useLocation<{data?: Record<string, unknown>}>(); const locale = useLocale(); const { setStepNav } = useStepNav(); - const { permissions } = useAuth(); + const { permissions, user } = useAuth(); const [initialState, setInitialState] = useState({}); const { getVersions } = useDocumentInfo(); @@ -45,9 +45,9 @@ const GlobalView: React.FC<IndexProps> = (props) => { const onSave = useCallback(async (json) => { getVersions(); - const state = await buildStateFromSchema({ fieldSchema: fields, data: json.result }); + const state = await buildStateFromSchema({ fieldSchema: fields, data: json.result, operation: 'update', user }); setInitialState(state); - }, [getVersions, fields]); + }, [getVersions, fields, user]); const [{ data, isLoading }] = usePayloadAPI( `${serverURL}${api}/globals/${slug}`, @@ -66,12 +66,12 @@ const GlobalView: React.FC<IndexProps> = (props) => { useEffect(() => { const awaitInitialState = async () => { - const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender }); + const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender, user, operation: 'update' }); setInitialState(state); }; awaitInitialState(); - }, [dataToRender, fields]); + }, [dataToRender, fields, user]); const globalPermissions = permissions?.globals?.[slug]; diff --git a/src/admin/components/views/collections/Edit/index.tsx b/src/admin/components/views/collections/Edit/index.tsx index 6f07ea6d56f..9de096fd5bb 100644 --- a/src/admin/components/views/collections/Edit/index.tsx +++ b/src/admin/components/views/collections/Edit/index.tsx @@ -42,7 +42,7 @@ const EditView: React.FC<IndexProps> = (props) => { const history = useHistory(); const { setStepNav } = useStepNav(); const [initialState, setInitialState] = useState({}); - const { permissions } = useAuth(); + const { permissions, user } = useAuth(); const { getVersions } = useDocumentInfo(); const onSave = useCallback(async (json: any) => { @@ -50,10 +50,10 @@ const EditView: React.FC<IndexProps> = (props) => { if (!isEditing) { history.push(`${admin}/collections/${collection.slug}/${json?.doc?.id}`); } else { - const state = await buildStateFromSchema({ fieldSchema: collection.fields, data: json.doc }); + const state = await buildStateFromSchema({ fieldSchema: collection.fields, data: json.doc, user, id, operation: 'update' }); setInitialState(state); } - }, [admin, collection, history, isEditing, getVersions]); + }, [admin, collection, history, isEditing, getVersions, user, id]); const [{ data, isLoading, isError }] = usePayloadAPI( (isEditing ? `${serverURL}${api}/${slug}/${id}` : null), @@ -97,12 +97,12 @@ const EditView: React.FC<IndexProps> = (props) => { useEffect(() => { const awaitInitialState = async () => { - const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender }); + const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender, user, operation: isEditing ? 'update' : 'create', id }); setInitialState(state); }; awaitInitialState(); - }, [dataToRender, fields]); + }, [dataToRender, fields, isEditing, id, user]); if (isError) { return (
988755f202e40ca9434de68f5a4b7dd788ff76de
2023-07-18 06:22:45
Elliot DeNolf
fix: fallback domain email format
false
fallback domain email format
fix
diff --git a/src/email.ts b/src/email.ts index f133805c410..50a464210a3 100644 --- a/src/email.ts +++ b/src/email.ts @@ -49,7 +49,7 @@ export const payloadCloudEmail = (args: PayloadCloudEmailOptions): EmailTranspor const fromName = config.email?.fromName || 'Payload CMS' const fromAddress = - config.email?.fromAddress || `cms${customDomains.length ? customDomains[0] : defaultDomain}` + config.email?.fromAddress || `cms@${customDomains.length ? customDomains[0] : defaultDomain}` const existingTransport = config.email && 'transport' in config.email && config.email?.transport
6ec982022eb9a91be4f66df7c15d629f6f0dc688
2024-08-20 23:05:06
Tylan Davis
fix(ui): text clipping on document header title with Segoe UI font (#7774)
false
text clipping on document header title with Segoe UI font (#7774)
fix
diff --git a/packages/next/src/elements/DocumentHeader/index.scss b/packages/next/src/elements/DocumentHeader/index.scss index f5b097b7156..fc5d2118ecf 100644 --- a/packages/next/src/elements/DocumentHeader/index.scss +++ b/packages/next/src/elements/DocumentHeader/index.scss @@ -27,7 +27,7 @@ overflow: hidden; text-overflow: ellipsis; margin: 0; - padding-bottom: base(0.2); + padding-bottom: base(0.4); line-height: 1; vertical-align: top; }
96e0f55c614468295d1e3f53010e57d3f48cd125
2024-03-13 00:21:40
Dan Ribbens
chore(release): v3.0.0-alpha.48 [skip ci]
false
v3.0.0-alpha.48 [skip ci]
chore
diff --git a/package.json b/package.json index 7cd05b8c535..159619e09ed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload-monorepo", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "private": true, "type": "module", "workspaces:": [ diff --git a/packages/db-mongodb/package.json b/packages/db-mongodb/package.json index 89184007323..9113471a710 100644 --- a/packages/db-mongodb/package.json +++ b/packages/db-mongodb/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/db-mongodb", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "description": "The officially supported MongoDB database adapter for Payload - Update 2", "repository": "https://github.com/payloadcms/payload", "license": "MIT", diff --git a/packages/db-postgres/package.json b/packages/db-postgres/package.json index 07b6ff33ec9..1947de59bd8 100644 --- a/packages/db-postgres/package.json +++ b/packages/db-postgres/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/db-postgres", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "description": "The officially supported Postgres database adapter for Payload", "repository": "https://github.com/payloadcms/payload", "license": "MIT", diff --git a/packages/graphql/package.json b/packages/graphql/package.json index 303107735fa..0f3bcb33ebd 100644 --- a/packages/graphql/package.json +++ b/packages/graphql/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/graphql", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "main": "./src/index.ts", "types": "./src/index.d.ts", "type": "module", diff --git a/packages/next/package.json b/packages/next/package.json index 9fb798b0005..38e5d7c607b 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/next", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "main": "./src/index.ts", "types": "./src/index.d.ts", "type": "module", diff --git a/packages/payload/package.json b/packages/payload/package.json index de2eae74565..16da5b5e3af 100644 --- a/packages/payload/package.json +++ b/packages/payload/package.json @@ -1,6 +1,6 @@ { "name": "payload", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "description": "Node, React and MongoDB Headless CMS and Application Framework", "license": "MIT", "main": "./src/index.js", diff --git a/packages/plugin-cloud-storage/package.json b/packages/plugin-cloud-storage/package.json index eae9735e01d..76b0d3a4b36 100644 --- a/packages/plugin-cloud-storage/package.json +++ b/packages/plugin-cloud-storage/package.json @@ -1,7 +1,7 @@ { "name": "@payloadcms/plugin-cloud-storage", "description": "The official cloud storage plugin for Payload CMS", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "main": "dist/index.js", "types": "dist/index.d.ts", "type": "module", diff --git a/packages/plugin-cloud/package.json b/packages/plugin-cloud/package.json index c66a62a14c9..d9098c19264 100644 --- a/packages/plugin-cloud/package.json +++ b/packages/plugin-cloud/package.json @@ -1,7 +1,7 @@ { "name": "@payloadcms/plugin-cloud", "description": "The official Payload Cloud plugin", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "main": "dist/index.js", "types": "dist/index.d.ts", "license": "MIT", diff --git a/packages/plugin-nested-docs/package.json b/packages/plugin-nested-docs/package.json index 3da7b2b8b9c..a73351f8eeb 100644 --- a/packages/plugin-nested-docs/package.json +++ b/packages/plugin-nested-docs/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-nested-docs", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "description": "The official Nested Docs plugin for Payload", "repository": "https://github.com/payloadcms/payload", "license": "MIT", diff --git a/packages/plugin-redirects/package.json b/packages/plugin-redirects/package.json index b36d3e249c2..34ec2a96c7a 100644 --- a/packages/plugin-redirects/package.json +++ b/packages/plugin-redirects/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-redirects", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "homepage:": "https://payloadcms.com", "repository": "[email protected]:payloadcms/plugin-redirects.git", "description": "Redirects plugin for Payload", diff --git a/packages/plugin-search/package.json b/packages/plugin-search/package.json index 45c1dcaa324..822d80be4ab 100644 --- a/packages/plugin-search/package.json +++ b/packages/plugin-search/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-search", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "homepage:": "https://payloadcms.com", "repository": "[email protected]:payloadcms/plugin-search.git", "description": "Search plugin for Payload", diff --git a/packages/plugin-seo/package.json b/packages/plugin-seo/package.json index 19b3993fd12..5c656d97081 100644 --- a/packages/plugin-seo/package.json +++ b/packages/plugin-seo/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/plugin-seo", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "homepage:": "https://payloadcms.com", "repository": "[email protected]:payloadcms/plugin-seo.git", "description": "SEO plugin for Payload", diff --git a/packages/richtext-lexical/package.json b/packages/richtext-lexical/package.json index bc8e518a516..811719999c2 100644 --- a/packages/richtext-lexical/package.json +++ b/packages/richtext-lexical/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/richtext-lexical", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "description": "The officially supported Lexical richtext adapter for Payload", "repository": "https://github.com/payloadcms/payload", "license": "MIT", diff --git a/packages/richtext-slate/package.json b/packages/richtext-slate/package.json index dca7dc55adb..161457c1a0a 100644 --- a/packages/richtext-slate/package.json +++ b/packages/richtext-slate/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/richtext-slate", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "description": "The officially supported Slate richtext adapter for Payload", "repository": "https://github.com/payloadcms/payload", "license": "MIT", diff --git a/packages/translations/package.json b/packages/translations/package.json index f523d476801..d5fdc83cade 100644 --- a/packages/translations/package.json +++ b/packages/translations/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/translations", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "main": "./dist/exports/index.ts", "types": "./dist/types.d.ts", "type": "module", diff --git a/packages/ui/package.json b/packages/ui/package.json index b1adef18042..d8e45be67f2 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@payloadcms/ui", - "version": "3.0.0-alpha.47", + "version": "3.0.0-alpha.48", "main": "./src/index.ts", "types": "./dist/index.d.ts", "type": "module",
8313cf34a6dd4f1deab8ada753bd4a2f59499009
2024-04-04 03:33:10
Jacob Fletcher
test(admin): passing custom css
false
passing custom css
test
diff --git a/app/(payload)/custom.scss b/app/(payload)/custom.scss index e69de29bb2d..ddfc972f495 100644 --- a/app/(payload)/custom.scss +++ b/app/(payload)/custom.scss @@ -0,0 +1,8 @@ +#custom-css { + font-family: monospace; + background-image: url('/placeholder.png'); +} + +#custom-css::after { + content: 'custom-css'; +} diff --git a/test/admin/e2e.spec.ts b/test/admin/e2e.spec.ts index edf66206689..03da84468f3 100644 --- a/test/admin/e2e.spec.ts +++ b/test/admin/e2e.spec.ts @@ -643,6 +643,16 @@ describe('admin', () => { }) }) + describe('Custom CSS', () => { + test('should see custom css in admin UI', async () => { + await page.goto(postsUrl.admin) + await page.waitForURL(postsUrl.admin) + await openNav(page) + const navControls = page.locator('#custom-css') + await expect(navControls).toHaveCSS('font-family', 'monospace') + }) + }) + describe('list view', () => { const tableRowLocator = 'table > tbody > tr' @@ -1182,15 +1192,6 @@ describe('admin', () => { }) }) - describe('custom css', () => { - test('should see custom css in admin UI', async () => { - await page.goto(postsUrl.admin) - await openNav(page) - const navControls = page.locator('#custom-css') - await expect(navControls).toHaveCSS('font-family', 'monospace') - }) - }) - // TODO: Troubleshoot flaky suite describe('sorting', () => { beforeEach(async () => { diff --git a/test/admin/styles.scss b/test/admin/styles.scss deleted file mode 100644 index ddfc972f495..00000000000 --- a/test/admin/styles.scss +++ /dev/null @@ -1,8 +0,0 @@ -#custom-css { - font-family: monospace; - background-image: url('/placeholder.png'); -} - -#custom-css::after { - content: 'custom-css'; -} diff --git a/test/helpers.ts b/test/helpers.ts index 8a4b1fa2ae1..e1f809257d1 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -103,7 +103,6 @@ export async function openNav(page: Page): Promise<void> { if (await page.locator('.template-default.template-default--nav-open').isVisible()) return // playwright: get first element with .nav-toggler which is VISIBLE (not hidden), could be 2 elements with .nav-toggler on mobile and desktop but only one is visible await page.locator('.nav-toggler >> visible=true').click() - await expect(page.locator('.template-default.template-default--nav-open')).toBeVisible() }
f9e5573c1e15213b2190e864951286d4d4399e83
2024-07-26 21:09:39
James Mikrut
feat: adds keepAfterRead to plugin-relationship-objectid (#7388)
false
adds keepAfterRead to plugin-relationship-objectid (#7388)
feat
diff --git a/packages/plugin-relationship-object-ids/README.md b/packages/plugin-relationship-object-ids/README.md index c21931e3dc2..a0fc9fe3fbe 100644 --- a/packages/plugin-relationship-object-ids/README.md +++ b/packages/plugin-relationship-object-ids/README.md @@ -8,6 +8,8 @@ Minimum required version of Payload: `1.9.5` It injects a `beforeChange` field hook into each `relationship` and `upload` field, which converts string-based IDs to `ObjectID`s immediately prior to storage. +By default, it also injects an `afterRead` field hook into the above fields, which ensures that the values are re-formatted back to strings after having been read from the database. + #### Usage Simply import and install the plugin to make it work: @@ -20,7 +22,11 @@ export default buildConfig({ // your config here plugins: [ // Call the plugin within your `plugins` array - relationshipsAsObjectID(), + relationshipsAsObjectID({ + // Optionally keep relationship values as ObjectID + // when they are retrieved from the database. + keepAfterRead: true, + }), ], }) ``` diff --git a/packages/plugin-relationship-object-ids/src/hooks/afterRead.ts b/packages/plugin-relationship-object-ids/src/hooks/afterRead.ts new file mode 100644 index 00000000000..e9cc5fd3797 --- /dev/null +++ b/packages/plugin-relationship-object-ids/src/hooks/afterRead.ts @@ -0,0 +1,101 @@ +import type { CollectionConfig, Config, FieldHook, RelationshipField, UploadField } from 'payload' + +import mongoose from 'mongoose' +import { fieldAffectsData } from 'payload/shared' + +const convertValue = ({ + relatedCollection, + value, +}: { + relatedCollection: CollectionConfig + value: number | string +}): mongoose.Types.ObjectId | number | string => { + const customIDField = relatedCollection.fields.find( + (field) => fieldAffectsData(field) && field.name === 'id', + ) + + if (!customIDField && mongoose.Types.ObjectId.isValid(value)) { + return value.toString() + } + + return value +} + +interface RelationObject { + relationTo: string + value: number | string +} + +function isValidRelationObject(value: unknown): value is RelationObject { + return typeof value === 'object' && value !== null && 'relationTo' in value && 'value' in value +} + +interface Args { + config: Config + field: RelationshipField | UploadField +} + +export const getAfterReadHook = + ({ config, field }: Args): FieldHook => + ({ value }) => { + let relatedCollection: CollectionConfig | undefined + + const hasManyRelations = typeof field.relationTo !== 'string' + + if (!hasManyRelations) { + relatedCollection = config.collections?.find(({ slug }) => slug === field.relationTo) + } + + if (Array.isArray(value)) { + return value.map((val) => { + // Handle has many + if (relatedCollection && val) { + return convertValue({ + relatedCollection, + value: val, + }) + } + + // Handle has many - polymorphic + if (isValidRelationObject(val)) { + const relatedCollectionForSingleValue = config.collections?.find( + ({ slug }) => slug === val.relationTo, + ) + + if (relatedCollectionForSingleValue) { + return { + relationTo: val.relationTo, + value: convertValue({ + relatedCollection: relatedCollectionForSingleValue, + value: val.value, + }), + } + } + } + + return val + }) + } + + // Handle has one - polymorphic + if (isValidRelationObject(value)) { + relatedCollection = config.collections?.find(({ slug }) => slug === value.relationTo) + + if (relatedCollection) { + return { + relationTo: value.relationTo, + value: convertValue({ relatedCollection, value: value.value }), + } + } + } + + // Handle has one + if (relatedCollection && value) { + return convertValue({ + relatedCollection, + value, + }) + } + + return value + } diff --git a/packages/plugin-relationship-object-ids/src/index.ts b/packages/plugin-relationship-object-ids/src/index.ts index 4a3bc4b8a12..c35e06701d1 100644 --- a/packages/plugin-relationship-object-ids/src/index.ts +++ b/packages/plugin-relationship-object-ids/src/index.ts @@ -1,14 +1,28 @@ -import type { Config, Field } from 'payload' +import type { Config, Field, FieldHook } from 'payload' +import { getAfterReadHook } from './hooks/afterRead.js' import { getBeforeChangeHook } from './hooks/beforeChange.js' -const traverseFields = ({ config, fields }: { config: Config; fields: Field[] }): Field[] => { +interface TraverseFieldsArgs { + config: Config + fields: Field[] + keepAfterRead: boolean +} + +const traverseFields = ({ config, fields, keepAfterRead }: TraverseFieldsArgs): Field[] => { return fields.map((field) => { if (field.type === 'relationship' || field.type === 'upload') { + const afterRead: FieldHook[] = [...(field.hooks?.afterRead || [])] + + if (!keepAfterRead) { + afterRead.unshift(getAfterReadHook({ config, field })) + } + return { ...field, hooks: { ...(field.hooks || {}), + afterRead, beforeChange: [ ...(field.hooks?.beforeChange || []), getBeforeChangeHook({ config, field }), @@ -20,7 +34,7 @@ const traverseFields = ({ config, fields }: { config: Config; fields: Field[] }) if ('fields' in field) { return { ...field, - fields: traverseFields({ config, fields: field.fields }), + fields: traverseFields({ config, fields: field.fields, keepAfterRead }), } } @@ -30,7 +44,7 @@ const traverseFields = ({ config, fields }: { config: Config; fields: Field[] }) tabs: field.tabs.map((tab) => { return { ...tab, - fields: traverseFields({ config, fields: tab.fields }), + fields: traverseFields({ config, fields: tab.fields, keepAfterRead }), } }), } @@ -42,7 +56,7 @@ const traverseFields = ({ config, fields }: { config: Config; fields: Field[] }) blocks: field.blocks.map((block) => { return { ...block, - fields: traverseFields({ config, fields: block.fields }), + fields: traverseFields({ config, fields: block.fields, keepAfterRead }), } }), } @@ -52,9 +66,19 @@ const traverseFields = ({ config, fields }: { config: Config; fields: Field[] }) }) } +interface Args { + /* + If you want to keep ObjectIDs as ObjectIDs after read, you can enable this flag. + By default, all relationship ObjectIDs are stringified within the AfterRead hook. + */ + keepAfterRead?: boolean +} + export const relationshipsAsObjectID = - (/** Possible args in the future */) => + (args?: Args) => (config: Config): Config => { + const keepAfterRead = typeof args?.keepAfterRead === 'boolean' ? args.keepAfterRead : false + return { ...config, collections: (config.collections || []).map((collection) => { @@ -63,6 +87,7 @@ export const relationshipsAsObjectID = fields: traverseFields({ config, fields: collection.fields, + keepAfterRead, }), } }), @@ -72,6 +97,7 @@ export const relationshipsAsObjectID = fields: traverseFields({ config, fields: global.fields, + keepAfterRead, }), } }),
fbc2064a104a6ab38ba7c55fb0364a3a4a208afb
2023-11-02 02:56:07
Jacob Fletcher
chore: deflakes e2e tests (#3970)
false
deflakes e2e tests (#3970)
chore
diff --git a/test/_community/e2e.spec.ts b/test/_community/e2e.spec.ts index affdf4b9621..3834f912aff 100644 --- a/test/_community/e2e.spec.ts +++ b/test/_community/e2e.spec.ts @@ -6,10 +6,10 @@ import { AdminUrlUtil } from '../helpers/adminUrlUtil' import { initPayloadE2E } from '../helpers/configHelpers' const { beforeAll, describe } = test -let url: AdminUrlUtil describe('Admin Panel', () => { let page: Page + let url: AdminUrlUtil beforeAll(async ({ browser }) => { const { serverURL } = await initPayloadE2E(__dirname) diff --git a/test/auth/e2e.spec.ts b/test/auth/e2e.spec.ts index 49e5a015b8b..e338c1e9ad9 100644 --- a/test/auth/e2e.spec.ts +++ b/test/auth/e2e.spec.ts @@ -16,10 +16,10 @@ import { slug } from './shared' */ const { beforeAll, describe } = test -let url: AdminUrlUtil describe('auth', () => { let page: Page + let url: AdminUrlUtil beforeAll(async ({ browser }) => { const { serverURL } = await initPayloadE2E(__dirname) diff --git a/test/live-preview/e2e.spec.ts b/test/live-preview/e2e.spec.ts index 7f1cfe33865..28f17fcaac5 100644 --- a/test/live-preview/e2e.spec.ts +++ b/test/live-preview/e2e.spec.ts @@ -9,29 +9,29 @@ import { mobileBreakpoint } from './config' import { startLivePreviewDemo } from './startLivePreviewDemo' const { beforeAll, describe } = test -let url: AdminUrlUtil -let serverURL: string - -const goToDoc = async (page: Page) => { - await page.goto(url.list) - const linkToDoc = page.locator('tbody tr:first-child .cell-id a').first() - expect(linkToDoc).toBeTruthy() - await linkToDoc.click() -} - -const goToCollectionPreview = async (page: Page): Promise<void> => { - await goToDoc(page) - await page.goto(`${page.url()}/preview`) -} - -const goToGlobalPreview = async (page: Page, slug: string): Promise<void> => { - const global = new AdminUrlUtil(serverURL, slug) - const previewURL = `${global.global(slug)}/preview` - await page.goto(previewURL) -} describe('Live Preview', () => { let page: Page + let serverURL: string + let url: AdminUrlUtil + + const goToDoc = async (page: Page) => { + await page.goto(url.list) + const linkToDoc = page.locator('tbody tr:first-child .cell-id a').first() + expect(linkToDoc).toBeTruthy() + await linkToDoc.click() + } + + const goToCollectionPreview = async (page: Page): Promise<void> => { + await goToDoc(page) + await page.goto(`${page.url()}/preview`) + } + + const goToGlobalPreview = async (page: Page, slug: string): Promise<void> => { + const global = new AdminUrlUtil(serverURL, slug) + const previewURL = `${global.global(slug)}/preview` + await page.goto(previewURL) + } beforeAll(async ({ browser }) => { const { serverURL: incomingServerURL, payload } = await initPayloadE2E(__dirname) diff --git a/test/versions/e2e.spec.ts b/test/versions/e2e.spec.ts index 2072313138e..6d3298af08d 100644 --- a/test/versions/e2e.spec.ts +++ b/test/versions/e2e.spec.ts @@ -36,11 +36,11 @@ import { autosaveSlug, draftGlobalSlug, draftSlug, titleToDelete } from './share const { beforeAll, describe } = test -let page: Page -let url: AdminUrlUtil -let serverURL: string - describe('versions', () => { + let page: Page + let url: AdminUrlUtil + let serverURL: string + beforeAll(async ({ browser }) => { const config = await initPayloadE2E(__dirname) serverURL = config.serverURL
9c53a625035324b3d639aa5fb9039de56e4cff71
2025-03-12 02:51:23
Alessio Gravili
chore(deps): bump next.js from 15.2.1 to 15.2.2 in monorepo (#11636)
false
bump next.js from 15.2.1 to 15.2.2 in monorepo (#11636)
chore
diff --git a/package.json b/package.json index 2a940c4197e..16c87f15fcb 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "devDependencies": { "@jest/globals": "29.7.0", "@libsql/client": "0.14.0", - "@next/bundle-analyzer": "15.2.1", + "@next/bundle-analyzer": "15.2.2", "@payloadcms/db-postgres": "workspace:*", "@payloadcms/eslint-config": "workspace:*", "@payloadcms/eslint-plugin": "workspace:*", @@ -154,7 +154,7 @@ "lint-staged": "15.2.7", "minimist": "1.2.8", "mongodb-memory-server": "^10", - "next": "15.2.1", + "next": "15.2.2", "open": "^10.1.0", "p-limit": "^5.0.0", "playwright": "1.50.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index deb010214f1..34c466420e4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,8 +26,8 @@ importers: specifier: 0.14.0 version: 0.14.0([email protected])([email protected]) '@next/bundle-analyzer': - specifier: 15.2.1 - version: 15.2.1([email protected]) + specifier: 15.2.2 + version: 15.2.2([email protected]) '@payloadcms/db-postgres': specifier: workspace:* version: link:packages/db-postgres @@ -45,7 +45,7 @@ importers: version: 1.50.0 '@sentry/nextjs': specifier: ^8.33.1 - version: 8.37.1(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@swc/[email protected](@swc/[email protected]))) + version: 8.37.1(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@swc/[email protected](@swc/[email protected]))) '@sentry/node': specifier: ^8.33.1 version: 8.37.1 @@ -134,8 +134,8 @@ importers: specifier: ^10 version: 10.1.3(@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected])))([email protected]) next: - specifier: 15.2.1 - version: 15.2.1(@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) + specifier: 15.2.2 + version: 15.2.2(@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) open: specifier: ^10.1.0 version: 10.1.0 @@ -1138,7 +1138,7 @@ importers: dependencies: '@sentry/nextjs': specifier: ^8.33.1 - version: 8.37.1(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@swc/[email protected](@swc/[email protected]))) + version: 8.37.1(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@swc/[email protected](@swc/[email protected]))) '@sentry/types': specifier: ^8.33.1 version: 8.37.1 @@ -1494,7 +1494,7 @@ importers: version: link:../plugin-cloud-storage uploadthing: specifier: 7.3.0 - version: 7.3.0([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])) + version: 7.3.0([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])) devDependencies: payload: specifier: workspace:* @@ -1674,8 +1674,8 @@ importers: specifier: 1.2.0 version: 1.2.0 '@next/env': - specifier: 15.2.1 - version: 15.2.1 + specifier: 15.2.2 + version: 15.2.2 '@payloadcms/admin-bar': specifier: workspace:* version: link:../packages/admin-bar @@ -1780,7 +1780,7 @@ importers: version: link:../packages/ui '@sentry/nextjs': specifier: ^8.33.1 - version: 8.37.1(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@swc/[email protected](@swc/[email protected]))) + version: 8.37.1(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@swc/[email protected](@swc/[email protected]))) '@sentry/react': specifier: ^7.77.0 version: 7.119.2([email protected]) @@ -1836,8 +1836,8 @@ importers: specifier: 8.9.5 version: 8.9.5(@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected])))([email protected]) next: - specifier: 15.2.1 - version: 15.2.1(@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) + specifier: 15.2.2 + version: 15.2.2(@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) nodemailer: specifier: 6.9.16 version: 6.9.16 @@ -4157,14 +4157,14 @@ packages: '@neondatabase/[email protected]': resolution: {integrity: sha512-siFas6gItqv6wD/pZnvdu34wEqgG3nSE6zWZdq5j2DEsa+VvX8i/5HXJOo06qrw5axPXn+lGCxeR+NLaSPIXug==} - '@next/[email protected]': - resolution: {integrity: sha512-RSegG5zFEy+Pp771fvXu+LmNMmf6kuCSuliXAiLFogLz+QUNw9mUZ0U9fxA/2mngHRUmANsSCGv7l0RkyXjnxg==} + '@next/[email protected]': + resolution: {integrity: sha512-bkVsvZwX/t4ou4cTLs5q7VM0MMIHHI0wgaYVFpK1lNJM+U9//tq9meCxUU8+Cc8uCaw9LbmAztHtFQ+rz8pb8A==} '@next/[email protected]': resolution: {integrity: sha512-eMgJu1RBXxxqqnuRJQh5RozhskoNUDHBFybvi+Z+yK9qzKeG7dadhv/Vp1YooSZmCnegf7JxWuapV77necLZNA==} - '@next/[email protected]': - resolution: {integrity: sha512-JmY0qvnPuS2NCWOz2bbby3Pe0VzdAQ7XpEB6uLIHmtXNfAsAO0KLQLkuAoc42Bxbo3/jMC3dcn9cdf+piCcG2Q==} + '@next/[email protected]': + resolution: {integrity: sha512-yWgopCfA9XDR8ZH3taB5nRKtKJ1Q5fYsTOuYkzIIoS8TJ0UAUKAGF73JnGszbjk2ufAQDj6mDdgsJAFx5CLtYQ==} '@next/[email protected]': resolution: {integrity: sha512-3cCrXBybsqe94UxD6DBQCYCCiP9YohBMgZ5IzzPYHmPzj8oqNlhBii5b6o1HDDaRHdz2pVnSsAROCtrczy8O0g==} @@ -4175,8 +4175,8 @@ packages: cpu: [arm64] os: [darwin] - '@next/[email protected]': - resolution: {integrity: sha512-aWXT+5KEREoy3K5AKtiKwioeblmOvFFjd+F3dVleLvvLiQ/mD//jOOuUcx5hzcO9ISSw4lrqtUPntTpK32uXXQ==} + '@next/[email protected]': + resolution: {integrity: sha512-HNBRnz+bkZ+KfyOExpUxTMR0Ow8nkkcE6IlsdEa9W/rI7gefud19+Sn1xYKwB9pdCdxIP1lPru/ZfjfA+iT8pw==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -4187,8 +4187,8 @@ packages: cpu: [x64] os: [darwin] - '@next/[email protected]': - resolution: {integrity: sha512-E/w8ervu4fcG5SkLhvn1NE/2POuDCDEy5gFbfhmnYXkyONZR68qbUlJlZwuN82o7BrBVAw+tkR8nTIjGiMW1jQ==} + '@next/[email protected]': + resolution: {integrity: sha512-mJOUwp7al63tDpLpEFpKwwg5jwvtL1lhRW2fI1Aog0nYCPAhxbJsaZKdoVyPZCy8MYf/iQVNDuk/+i29iLCzIA==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -4199,8 +4199,8 @@ packages: cpu: [arm64] os: [linux] - '@next/[email protected]': - resolution: {integrity: sha512-gXDX5lIboebbjhiMT6kFgu4svQyjoSed6dHyjx5uZsjlvTwOAnZpn13w9XDaIMFFHw7K8CpBK7HfDKw0VZvUXQ==} + '@next/[email protected]': + resolution: {integrity: sha512-5ZZ0Zwy3SgMr7MfWtRE7cQWVssfOvxYfD9O7XHM7KM4nrf5EOeqwq67ZXDgo86LVmffgsu5tPO57EeFKRnrfSQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -4211,8 +4211,8 @@ packages: cpu: [arm64] os: [linux] - '@next/[email protected]': - resolution: {integrity: sha512-3v0pF/adKZkBWfUffmB/ROa+QcNTrnmYG4/SS+r52HPwAK479XcWoES2I+7F7lcbqc7mTeVXrIvb4h6rR/iDKg==} + '@next/[email protected]': + resolution: {integrity: sha512-cgKWBuFMLlJ4TWcFHl1KOaVVUAF8vy4qEvX5KsNd0Yj5mhu989QFCq1WjuaEbv/tO1ZpsQI6h/0YR8bLwEi+nA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -4223,8 +4223,8 @@ packages: cpu: [x64] os: [linux] - '@next/[email protected]': - resolution: {integrity: sha512-RbsVq2iB6KFJRZ2cHrU67jLVLKeuOIhnQB05ygu5fCNgg8oTewxweJE8XlLV+Ii6Y6u4EHwETdUiRNXIAfpBww==} + '@next/[email protected]': + resolution: {integrity: sha512-c3kWSOSsVL8rcNBBfOq1+/j2PKs2nsMwJUV4icUxRgGBwUOfppeh7YhN5s79enBQFU+8xRgVatFkhHU1QW7yUA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -4235,8 +4235,8 @@ packages: cpu: [x64] os: [linux] - '@next/[email protected]': - resolution: {integrity: sha512-QHsMLAyAIu6/fWjHmkN/F78EFPKmhQlyX5C8pRIS2RwVA7z+t9cTb0IaYWC3EHLOTjsU7MNQW+n2xGXr11QPpg==} + '@next/[email protected]': + resolution: {integrity: sha512-PXTW9PLTxdNlVYgPJ0equojcq1kNu5NtwcNjRjHAB+/sdoKZ+X8FBu70fdJFadkxFIGekQTyRvPMFF+SOJaQjw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -4247,8 +4247,8 @@ packages: cpu: [arm64] os: [win32] - '@next/[email protected]': - resolution: {integrity: sha512-Gk42XZXo1cE89i3hPLa/9KZ8OuupTjkDmhLaMKFohjf9brOeZVEa3BQy1J9s9TWUqPhgAEbwv6B2+ciGfe54Vw==} + '@next/[email protected]': + resolution: {integrity: sha512-nG644Es5llSGEcTaXhnGWR/aThM/hIaz0jx4MDg4gWC8GfTCp8eDBWZ77CVuv2ha/uL9Ce+nPTfYkSLG67/sHg==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -4259,8 +4259,8 @@ packages: cpu: [x64] os: [win32] - '@next/[email protected]': - resolution: {integrity: sha512-YjqXCl8QGhVlMR8uBftWk0iTmvtntr41PhG1kvzGp0sUP/5ehTM+cwx25hKE54J0CRnHYjSGjSH3gkHEaHIN9g==} + '@next/[email protected]': + resolution: {integrity: sha512-52nWy65S/R6/kejz3jpvHAjZDPKIbEQu4x9jDBzmB9jJfuOy5rspjKu4u77+fI4M/WzLXrrQd57hlFGzz1ubcQ==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -8368,8 +8368,8 @@ packages: sass: optional: true - [email protected]: - resolution: {integrity: sha512-zxbsdQv3OqWXybK5tMkPCBKyhIz63RstJ+NvlfkaLMc/m5MwXgz2e92k+hSKcyBpyADhMk2C31RIiaDjUZae7g==} + [email protected]: + resolution: {integrity: sha512-dgp8Kcx5XZRjMw2KNwBtUzhngRaURPioxoNIVl5BOyJbhi9CUgEtKDO7fx5wh8Z8vOVX1nYZ9meawJoRrlASYA==} engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0} hasBin: true peerDependencies: @@ -13112,7 +13112,7 @@ snapshots: dependencies: '@types/pg': 8.11.6 - '@next/[email protected]([email protected])': + '@next/[email protected]([email protected])': dependencies: webpack-bundle-analyzer: 4.10.1([email protected]) transitivePeerDependencies: @@ -13121,7 +13121,7 @@ snapshots: '@next/[email protected]': {} - '@next/[email protected]': {} + '@next/[email protected]': {} '@next/[email protected]': dependencies: @@ -13130,49 +13130,49 @@ snapshots: '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true '@next/[email protected]': optional: true - '@next/[email protected]': + '@next/[email protected]': optional: true '@nicolo-ribaudo/[email protected]': @@ -13675,7 +13675,7 @@ snapshots: '@sentry/utils': 7.119.2 localforage: 1.10.0 - '@sentry/[email protected](@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@swc/[email protected](@swc/[email protected])))': + '@sentry/[email protected](@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@swc/[email protected](@swc/[email protected])))': dependencies: '@opentelemetry/api': 1.9.0 '@opentelemetry/instrumentation-http': 0.53.0(@opentelemetry/[email protected]) @@ -13691,7 +13691,7 @@ snapshots: '@sentry/vercel-edge': 8.37.1 '@sentry/webpack-plugin': 2.22.6([email protected](@swc/[email protected](@swc/[email protected]))) chalk: 3.0.0 - next: 15.2.1(@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) + next: 15.2.2(@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) resolve: 1.22.8 rollup: 3.29.5 stacktrace-parser: 0.1.10 @@ -18334,9 +18334,9 @@ snapshots: - '@babel/core' - babel-plugin-macros - [email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]): + [email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]): dependencies: - '@next/env': 15.2.1 + '@next/env': 15.2.2 '@swc/counter': 0.1.3 '@swc/helpers': 0.5.15 busboy: 1.6.0 @@ -18346,14 +18346,14 @@ snapshots: react-dom: 19.0.0([email protected]) styled-jsx: 5.1.6(@babel/[email protected])([email protected])([email protected]) optionalDependencies: - '@next/swc-darwin-arm64': 15.2.1 - '@next/swc-darwin-x64': 15.2.1 - '@next/swc-linux-arm64-gnu': 15.2.1 - '@next/swc-linux-arm64-musl': 15.2.1 - '@next/swc-linux-x64-gnu': 15.2.1 - '@next/swc-linux-x64-musl': 15.2.1 - '@next/swc-win32-arm64-msvc': 15.2.1 - '@next/swc-win32-x64-msvc': 15.2.1 + '@next/swc-darwin-arm64': 15.2.2 + '@next/swc-darwin-x64': 15.2.2 + '@next/swc-linux-arm64-gnu': 15.2.2 + '@next/swc-linux-arm64-musl': 15.2.2 + '@next/swc-linux-x64-gnu': 15.2.2 + '@next/swc-linux-x64-musl': 15.2.2 + '@next/swc-win32-arm64-msvc': 15.2.2 + '@next/swc-win32-x64-msvc': 15.2.2 '@opentelemetry/api': 1.9.0 '@playwright/test': 1.50.0 babel-plugin-react-compiler: 19.0.0-beta-714736e-20250131 @@ -20019,14 +20019,14 @@ snapshots: escalade: 3.2.0 picocolors: 1.1.1 - [email protected]([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])): + [email protected]([email protected](@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])): dependencies: '@effect/platform': 0.69.8([email protected]) '@uploadthing/mime-types': 0.3.2 '@uploadthing/shared': 7.1.1 effect: 3.10.3 optionalDependencies: - next: 15.2.1(@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) + next: 15.2.2(@opentelemetry/[email protected])(@playwright/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) [email protected]: dependencies: diff --git a/test/package.json b/test/package.json index 9a41018d754..74a4fe8c4e9 100644 --- a/test/package.json +++ b/test/package.json @@ -24,7 +24,7 @@ "devDependencies": { "@aws-sdk/client-s3": "^3.614.0", "@date-fns/tz": "1.2.0", - "@next/env": "15.2.1", + "@next/env": "15.2.2", "@payloadcms/admin-bar": "workspace:*", "@payloadcms/db-mongodb": "workspace:*", "@payloadcms/db-postgres": "workspace:*", @@ -78,7 +78,7 @@ "jest": "29.7.0", "jwt-decode": "4.0.0", "mongoose": "8.9.5", - "next": "15.2.1", + "next": "15.2.2", "nodemailer": "6.9.16", "payload": "workspace:*", "qs-esm": "7.0.2",