From 0b1816acd70f0bd8cdf6952496d17c4788910ec3 Mon Sep 17 00:00:00 2001 From: JohnAlbin Date: Mon, 26 Feb 2024 20:52:26 +0800 Subject: [PATCH] feat(next-drupal-query): drop next-drupal-query Fixes #708 --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .github/ISSUE_TEMPLATE/feature_request.yml | 2 +- .github/ISSUE_TEMPLATE/question.yml | 2 +- .github/workflows/next-drupal-query.yml | 17 - CONTRIBUTING.md | 10 +- examples/example-query/.env.example | 6 - examples/example-query/.eslintrc.json | 4 - examples/example-query/.gitignore | 39 -- examples/example-query/CHANGELOG.md | 69 --- examples/example-query/README.md | 7 - examples/example-query/components/article.tsx | 65 --- .../components/card--featured.tsx | 53 --- examples/example-query/components/card.tsx | 31 -- .../example-query/components/landing-page.tsx | 15 - examples/example-query/components/layout.tsx | 28 -- .../example-query/components/media--image.tsx | 23 - .../example-query/components/menu--main.tsx | 22 - examples/example-query/components/page.tsx | 25 - .../components/preview-alert.tsx | 28 -- .../components/section--card.tsx | 10 - .../components/section--columns.tsx | 27 -- .../components/section--image.tsx | 10 - .../components/section--text.tsx | 13 - .../example-query/components/sections.tsx | 40 -- examples/example-query/lib/drupal.ts | 9 - examples/example-query/lib/utils.ts | 12 - examples/example-query/next-env.d.ts | 5 - examples/example-query/next.config.js | 8 - examples/example-query/package.json | 32 -- examples/example-query/pages/[...slug].tsx | 86 ---- examples/example-query/pages/_app.tsx | 7 - .../example-query/pages/api/exit-preview.ts | 7 - examples/example-query/pages/api/preview.ts | 10 - .../example-query/pages/api/revalidate.ts | 29 -- examples/example-query/pages/index.tsx | 74 --- examples/example-query/postcss.config.js | 8 - examples/example-query/public/favicon.ico | Bin 15086 -> 0 bytes examples/example-query/public/robots.txt | 2 - examples/example-query/queries/index.ts | 38 -- .../queries/list--articles--published.ts | 40 -- .../queries/list--articles--related.ts | 59 --- .../example-query/queries/media--image.ts | 23 - examples/example-query/queries/menu.ts | 46 -- .../queries/node--article--teaser.ts | 29 -- .../example-query/queries/node--article.ts | 66 --- .../queries/node--landing_page.ts | 54 --- examples/example-query/queries/node--page.ts | 45 -- .../example-query/queries/paragraph--card.ts | 18 - .../queries/paragraph--columns.ts | 19 - .../example-query/queries/paragraph--image.ts | 16 - .../example-query/queries/paragraph--text.ts | 15 - examples/example-query/styles/globals.css | 3 - examples/example-query/tailwind.config.js | 14 - examples/example-query/tsconfig.json | 26 - examples/example-query/types/drupal/base.ts | 31 -- examples/example-query/types/drupal/field.ts | 14 - examples/example-query/types/drupal/index.ts | 6 - examples/example-query/types/drupal/media.ts | 15 - examples/example-query/types/drupal/node.ts | 39 -- .../example-query/types/drupal/paragraph.ts | 49 -- examples/example-query/types/drupal/user.ts | 13 - examples/example-query/types/index.ts | 88 ---- package.json | 2 +- packages/next-drupal-query/.npmignore | 3 - packages/next-drupal-query/CHANGELOG.md | 63 --- packages/next-drupal-query/README.md | 3 - packages/next-drupal-query/jest.config.cjs | 29 -- packages/next-drupal-query/jest.setup.ts | 1 - packages/next-drupal-query/package.json | 60 --- packages/next-drupal-query/src/index.ts | 450 ------------------ .../tests/__snapshots__/index.test.ts.snap | 83 ---- .../next-drupal-query/tests/index.test.ts | 111 ----- .../tests/queries/data-only.ts | 20 - .../tests/queries/data-with-formatter.ts | 35 -- .../tests/queries/data-with-opts.ts | 23 - .../tests/queries/data-with-placeholder.ts | 25 - .../tests/queries/formatter-only.ts | 16 - .../next-drupal-query/tests/queries/index.ts | 25 - .../tests/queries/node--article.ts | 37 -- .../tests/queries/params-nested.ts | 6 - .../tests/queries/params-only.ts | 6 - .../tests/queries/params-with-opts.ts | 10 - .../tests/queries/placeholder-only.ts | 10 - .../tests/queries/placeholder-with-opts.ts | 15 - packages/next-drupal-query/tsup.config.ts | 14 - yarn.lock | 33 +- 86 files changed, 9 insertions(+), 2674 deletions(-) delete mode 100644 .github/workflows/next-drupal-query.yml delete mode 100644 examples/example-query/.env.example delete mode 100644 examples/example-query/.eslintrc.json delete mode 100644 examples/example-query/.gitignore delete mode 100644 examples/example-query/CHANGELOG.md delete mode 100644 examples/example-query/README.md delete mode 100644 examples/example-query/components/article.tsx delete mode 100644 examples/example-query/components/card--featured.tsx delete mode 100644 examples/example-query/components/card.tsx delete mode 100644 examples/example-query/components/landing-page.tsx delete mode 100644 examples/example-query/components/layout.tsx delete mode 100644 examples/example-query/components/media--image.tsx delete mode 100644 examples/example-query/components/menu--main.tsx delete mode 100644 examples/example-query/components/page.tsx delete mode 100644 examples/example-query/components/preview-alert.tsx delete mode 100644 examples/example-query/components/section--card.tsx delete mode 100644 examples/example-query/components/section--columns.tsx delete mode 100644 examples/example-query/components/section--image.tsx delete mode 100644 examples/example-query/components/section--text.tsx delete mode 100644 examples/example-query/components/sections.tsx delete mode 100644 examples/example-query/lib/drupal.ts delete mode 100644 examples/example-query/lib/utils.ts delete mode 100644 examples/example-query/next-env.d.ts delete mode 100644 examples/example-query/next.config.js delete mode 100644 examples/example-query/package.json delete mode 100644 examples/example-query/pages/[...slug].tsx delete mode 100644 examples/example-query/pages/_app.tsx delete mode 100644 examples/example-query/pages/api/exit-preview.ts delete mode 100644 examples/example-query/pages/api/preview.ts delete mode 100644 examples/example-query/pages/api/revalidate.ts delete mode 100644 examples/example-query/pages/index.tsx delete mode 100644 examples/example-query/postcss.config.js delete mode 100644 examples/example-query/public/favicon.ico delete mode 100644 examples/example-query/public/robots.txt delete mode 100644 examples/example-query/queries/index.ts delete mode 100644 examples/example-query/queries/list--articles--published.ts delete mode 100644 examples/example-query/queries/list--articles--related.ts delete mode 100644 examples/example-query/queries/media--image.ts delete mode 100644 examples/example-query/queries/menu.ts delete mode 100644 examples/example-query/queries/node--article--teaser.ts delete mode 100644 examples/example-query/queries/node--article.ts delete mode 100644 examples/example-query/queries/node--landing_page.ts delete mode 100644 examples/example-query/queries/node--page.ts delete mode 100644 examples/example-query/queries/paragraph--card.ts delete mode 100644 examples/example-query/queries/paragraph--columns.ts delete mode 100644 examples/example-query/queries/paragraph--image.ts delete mode 100644 examples/example-query/queries/paragraph--text.ts delete mode 100644 examples/example-query/styles/globals.css delete mode 100644 examples/example-query/tailwind.config.js delete mode 100644 examples/example-query/tsconfig.json delete mode 100644 examples/example-query/types/drupal/base.ts delete mode 100644 examples/example-query/types/drupal/field.ts delete mode 100644 examples/example-query/types/drupal/index.ts delete mode 100644 examples/example-query/types/drupal/media.ts delete mode 100644 examples/example-query/types/drupal/node.ts delete mode 100644 examples/example-query/types/drupal/paragraph.ts delete mode 100644 examples/example-query/types/drupal/user.ts delete mode 100644 examples/example-query/types/index.ts delete mode 100644 packages/next-drupal-query/.npmignore delete mode 100644 packages/next-drupal-query/CHANGELOG.md delete mode 100644 packages/next-drupal-query/README.md delete mode 100644 packages/next-drupal-query/jest.config.cjs delete mode 100644 packages/next-drupal-query/jest.setup.ts delete mode 100644 packages/next-drupal-query/package.json delete mode 100644 packages/next-drupal-query/src/index.ts delete mode 100644 packages/next-drupal-query/tests/__snapshots__/index.test.ts.snap delete mode 100644 packages/next-drupal-query/tests/index.test.ts delete mode 100644 packages/next-drupal-query/tests/queries/data-only.ts delete mode 100644 packages/next-drupal-query/tests/queries/data-with-formatter.ts delete mode 100644 packages/next-drupal-query/tests/queries/data-with-opts.ts delete mode 100644 packages/next-drupal-query/tests/queries/data-with-placeholder.ts delete mode 100644 packages/next-drupal-query/tests/queries/formatter-only.ts delete mode 100644 packages/next-drupal-query/tests/queries/index.ts delete mode 100644 packages/next-drupal-query/tests/queries/node--article.ts delete mode 100644 packages/next-drupal-query/tests/queries/params-nested.ts delete mode 100644 packages/next-drupal-query/tests/queries/params-only.ts delete mode 100644 packages/next-drupal-query/tests/queries/params-with-opts.ts delete mode 100644 packages/next-drupal-query/tests/queries/placeholder-only.ts delete mode 100644 packages/next-drupal-query/tests/queries/placeholder-with-opts.ts delete mode 100644 packages/next-drupal-query/tsup.config.ts diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 1f6919b7..9b447389 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -28,7 +28,7 @@ body: - example-custom-serializer - example-graphql - example-marketing - - example-query + - example-router-migration - example-search-api - example-umami - example-webform diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index c46c0d8e..f02bd619 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -23,7 +23,7 @@ body: - example-custom-serializer - example-graphql - example-marketing - - example-query + - example-router-migration - example-search-api - example-umami - example-webform diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml index 91634117..5ff543ca 100644 --- a/.github/ISSUE_TEMPLATE/question.yml +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -23,7 +23,7 @@ body: - example-custom-serializer - example-graphql - example-marketing - - example-query + - example-router-migration - example-search-api - example-umami - example-webform diff --git a/.github/workflows/next-drupal-query.yml b/.github/workflows/next-drupal-query.yml deleted file mode 100644 index 00499fbc..00000000 --- a/.github/workflows/next-drupal-query.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: next-drupal-query -on: - push: - branches: - - main - pull_request: - types: [opened, synchronize, edited] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Install modules - run: yarn - - name: Run tests - run: yarn workspace next-drupal-query test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 424233dc..e2174ebf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -58,14 +58,6 @@ We use `jest` for testing the `next-drupal` package. yarn test packages/next-drupal ``` -### `next-drupal-query` - -We use `jest` for testing the `next-drupal-query` package. - -``` -yarn test packages/next-drupal -``` - ### `next` We use `phpunit` for testing the `next` module. @@ -76,7 +68,7 @@ yarn test:next ## Linting -### `next-drupal` and `next-drupal-query` +### `next-drupal` ``` yarn lint diff --git a/examples/example-query/.env.example b/examples/example-query/.env.example deleted file mode 100644 index 952a38a0..00000000 --- a/examples/example-query/.env.example +++ /dev/null @@ -1,6 +0,0 @@ -# See https://next-drupal.org/docs/environment-variables -NEXT_PUBLIC_DRUPAL_BASE_URL=https://dev.next-drupal.org -NEXT_IMAGE_DOMAIN=dev.next-drupal.org - -# Required for Preview Mode -DRUPAL_PREVIEW_SECRET=secret \ No newline at end of file diff --git a/examples/example-query/.eslintrc.json b/examples/example-query/.eslintrc.json deleted file mode 100644 index abd5579b..00000000 --- a/examples/example-query/.eslintrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "next", - "root": true -} diff --git a/examples/example-query/.gitignore b/examples/example-query/.gitignore deleted file mode 100644 index 6686735a..00000000 --- a/examples/example-query/.gitignore +++ /dev/null @@ -1,39 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js -.yarn/install-state.gz - -# build/test artifacts -/.turbo -/coverage -/cypress/screenshots -/cypress/videos - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# local env files -.env*.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts diff --git a/examples/example-query/CHANGELOG.md b/examples/example-query/CHANGELOG.md deleted file mode 100644 index d13a9090..00000000 --- a/examples/example-query/CHANGELOG.md +++ /dev/null @@ -1,69 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.4.0](https://github.com/chapter-three/next-drupal/compare/example-query@0.3.2...example-query@0.4.0) (2022-12-06) - -**Note:** Version bump only for package example-query - - - - - -## [0.3.2](https://github.com/chapter-three/next-drupal/compare/example-query@0.3.1...example-query@0.3.2) (2022-12-06) - -**Note:** Version bump only for package example-query - - - - - -## [0.3.1](https://github.com/chapter-three/next-drupal/compare/example-query@0.3.0...example-query@0.3.1) (2022-09-07) - - -### Bug Fixes - -* **example-query:** use context for fetching content ([99bf2b6](https://github.com/chapter-three/next-drupal/commit/99bf2b6afaf55d5955d03971d186b7da42ce8f35)) - - - - - -# [0.3.0](https://github.com/chapter-three/next-drupal/compare/example-query@0.2.1...example-query@0.3.0) (2022-08-11) - - -### Features - -* **example-query:** add example query with opts ([73b671e](https://github.com/chapter-three/next-drupal/commit/73b671eea6afae1328caf61379f4ae60529b40f8)) - - - - - -## [0.2.1](https://github.com/chapter-three/next-drupal/compare/example-query@0.2.0...example-query@0.2.1) (2022-08-09) - -**Note:** Version bump only for package example-query - - - - - -# [0.2.0](https://github.com/chapter-three/next-drupal/compare/example-query@0.1.0...example-query@0.2.0) (2022-08-09) - - -### Features - -* **example-query:** add example for nested queries ([9e28c2a](https://github.com/chapter-three/next-drupal/commit/9e28c2aac149505d84c7d24617c51dc2af052b0c)) -* **example-query:** update example to use formatters ([7e29ecb](https://github.com/chapter-three/next-drupal/commit/7e29ecb1e43171f3f8628e8126c55c73c96966be)) - - - - - -# 0.1.0 (2022-07-29) - - -### Features - -* add example-query ([1c1aa34](https://github.com/chapter-three/next-drupal/commit/1c1aa34237dad490ab5314f74c3b8ea120bcd361)) diff --git a/examples/example-query/README.md b/examples/example-query/README.md deleted file mode 100644 index 3d52f54e..00000000 --- a/examples/example-query/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# example-query - -Intentionally blank page - @shadcn - -## License - -Licensed under the [MIT license](https://github.com/chapter-three/next-drupal/blob/master/LICENSE). diff --git a/examples/example-query/components/article.tsx b/examples/example-query/components/article.tsx deleted file mode 100644 index 23acfec1..00000000 --- a/examples/example-query/components/article.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import Head from "next/head" -import Image from "next/image" -import Link from "next/link" - -import { Article } from "types" - -interface ArticleProps { - article: Article -} - -export function Article({ article, ...props }: ArticleProps) { - return ( - <> - - {article.title} - -
-

- {article.title} -

-
- {article.author ? ( - - Posted by {article.author} - - ) : null} - {article.date && - {article.date}} -
- {article.image && ( -
- {article.image.alt} -
- )} -
- {article.body && ( -
- )} - {article.relatedArticles?.length ? ( -
-

Related Articles

- {article.relatedArticles.map((article) => ( -
  • - - {article.title} - -
  • - ))} -
    - ) : null} -
    -
    - - ) -} diff --git a/examples/example-query/components/card--featured.tsx b/examples/example-query/components/card--featured.tsx deleted file mode 100644 index b291add6..00000000 --- a/examples/example-query/components/card--featured.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import Image from "next/image" -import Link from "next/link" - -import { CardProps } from "components/card" -import { MediaImage } from "./media--image" - -export interface CardFeaturedProps extends CardProps { - text?: string -} - -export function CardFeatured({ - title: heading, - url, - media, - date, -}: CardFeaturedProps) { - return ( -
    - -
    -
    -

    - {heading} -

    - {date &&

    {date}

    } -
    - - Read more - - -
    - {url && ( - - - Read more - - - )} -
    - ) -} diff --git a/examples/example-query/components/card.tsx b/examples/example-query/components/card.tsx deleted file mode 100644 index 4e65ac81..00000000 --- a/examples/example-query/components/card.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import Link from "next/link" - -import { MediaImage, MediaImageProps } from "./media--image" - -export interface CardProps { - title: string - url?: string - media: MediaImageProps["media"] - date?: string -} - -export function Card({ title: heading, url, media, date }: CardProps) { - return ( -
    - -
    -

    - {heading} -

    - {date && {date}} -
    - {url && ( - - - Read more - - - )} -
    - ) -} diff --git a/examples/example-query/components/landing-page.tsx b/examples/example-query/components/landing-page.tsx deleted file mode 100644 index 7bc11679..00000000 --- a/examples/example-query/components/landing-page.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { LandingPage } from "types" -import { Sections } from "components/sections" - -interface LandingPageProps { - page: LandingPage -} - -export function LandingPage({ page }: LandingPageProps) { - return ( -
    -

    {page.title}

    - -
    - ) -} diff --git a/examples/example-query/components/layout.tsx b/examples/example-query/components/layout.tsx deleted file mode 100644 index 3590a00c..00000000 --- a/examples/example-query/components/layout.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import Link from "next/link" - -import { PreviewAlert } from "components/preview-alert" -import { MenuMain, MenuMainProps } from "components/menu--main" - -export interface LayoutProps { - menu: MenuMainProps["menu"] - children?: React.ReactNode -} - -export function Layout({ menu, children }: LayoutProps) { - return ( - <> - -
    -
    - - - Next.js for Drupal - - - -
    -
    -
    {children}
    - - ) -} diff --git a/examples/example-query/components/media--image.tsx b/examples/example-query/components/media--image.tsx deleted file mode 100644 index 8a4d88bc..00000000 --- a/examples/example-query/components/media--image.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import Image from "next/image" - -import { MediaImage } from "types" - -export interface MediaImageProps { - media: MediaImage -} - -export function MediaImage({ media }: MediaImageProps) { - if (!media?.url) { - return null - } - - return ( - {media.alt} - ) -} diff --git a/examples/example-query/components/menu--main.tsx b/examples/example-query/components/menu--main.tsx deleted file mode 100644 index d160e549..00000000 --- a/examples/example-query/components/menu--main.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import Link from "next/link" -import { MenuLink } from "types" - -export interface MenuMainProps { - menu: MenuLink[] -} - -export function MenuMain({ menu }: MenuMainProps) { - if (!menu?.length) { - return null - } - - return ( -
    - {menu.map((item, index) => ( - - {item.text} - - ))} -
    - ) -} diff --git a/examples/example-query/components/page.tsx b/examples/example-query/components/page.tsx deleted file mode 100644 index eee6e38c..00000000 --- a/examples/example-query/components/page.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import Head from "next/head" -import { Page } from "types" - -interface PageProps { - page: Page -} - -export function Page({ page, ...props }: PageProps) { - return ( - <> - - {page.title} - -
    -

    {page.title}

    - {page.content && ( -
    - )} -
    - - ) -} diff --git a/examples/example-query/components/preview-alert.tsx b/examples/example-query/components/preview-alert.tsx deleted file mode 100644 index 54c38803..00000000 --- a/examples/example-query/components/preview-alert.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import * as React from "react" -import { useRouter } from "next/router" - -export function PreviewAlert() { - const { isPreview } = useRouter() - const [showPreviewAlert, setShowPreviewAlert] = React.useState(false) - - React.useEffect(() => { - setShowPreviewAlert(isPreview && window.top === window.self) - }, [isPreview]) - - if (!showPreviewAlert) { - return null - } - - return ( -
    -

    - This page is a preview.{" "} - {/* eslint-disable @next/next/no-html-link-for-pages */} - - Click here - {" "} - to exit preview mode. -

    -
    - ) -} diff --git a/examples/example-query/components/section--card.tsx b/examples/example-query/components/section--card.tsx deleted file mode 100644 index e48d27fa..00000000 --- a/examples/example-query/components/section--card.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { SectionCard } from "types" -import { Card } from "./card" - -interface SectionCardProps { - section: SectionCard -} - -export function SectionCard({ section }: SectionCardProps) { - return -} diff --git a/examples/example-query/components/section--columns.tsx b/examples/example-query/components/section--columns.tsx deleted file mode 100644 index fe4e83e6..00000000 --- a/examples/example-query/components/section--columns.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { clsx } from "clsx" -import { SectionColumns } from "types" -import { Sections } from "components/sections" - -interface SectionColumnsProps { - section: SectionColumns -} - -export function SectionColumns({ section }: SectionColumnsProps) { - return ( -
    - {section.heading &&

    {section.heading}

    } -
    - {section.sections?.length ? ( - - ) : null} -
    -
    - ) -} diff --git a/examples/example-query/components/section--image.tsx b/examples/example-query/components/section--image.tsx deleted file mode 100644 index 06807a01..00000000 --- a/examples/example-query/components/section--image.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { SectionImage } from "types" -import { MediaImage } from "components/media--image" - -export interface SectionImageProps { - section: SectionImage -} - -export function SectionImage({ section }: SectionImageProps) { - return -} diff --git a/examples/example-query/components/section--text.tsx b/examples/example-query/components/section--text.tsx deleted file mode 100644 index d6b9c443..00000000 --- a/examples/example-query/components/section--text.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { SectionText } from "types" - -interface SectionTextProps { - section: SectionText -} - -export function SectionText({ section }: SectionTextProps) { - if (!section.text) { - return null - } - - return
    -} diff --git a/examples/example-query/components/sections.tsx b/examples/example-query/components/sections.tsx deleted file mode 100644 index 6000f329..00000000 --- a/examples/example-query/components/sections.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { Section, SectionType } from "types" -import { SectionColumns } from "components/section--columns" -import { SectionImage } from "components/section--image" -import { SectionText } from "components/section--text" -import { SectionCard } from "components/section--card" - -type SectionTypes = { - [key in SectionType]: ({ section }) => JSX.Element -} - -const sectionTypes: SectionTypes = { - "section--columns": SectionColumns, - "section--image": SectionImage, - "section--text": SectionText, - "section--card": SectionCard, -} - -interface SectionsProps { - sections: Section[] -} - -export function Sections({ sections }: SectionsProps) { - if (!sections?.length) { - return null - } - - return ( - <> - {sections?.map((section) => { - const SectionComponent = sectionTypes[section?.type] - - if (!SectionComponent) { - return null - } - - return - })} - - ) -} diff --git a/examples/example-query/lib/drupal.ts b/examples/example-query/lib/drupal.ts deleted file mode 100644 index 2320406e..00000000 --- a/examples/example-query/lib/drupal.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { DrupalClient } from "next-drupal" - -export const drupal = new DrupalClient( - process.env.NEXT_PUBLIC_DRUPAL_BASE_URL, - { - previewSecret: process.env.DRUPAL_PREVIEW_SECRET, - frontPage: "/", - } -) diff --git a/examples/example-query/lib/utils.ts b/examples/example-query/lib/utils.ts deleted file mode 100644 index d83a0d73..00000000 --- a/examples/example-query/lib/utils.ts +++ /dev/null @@ -1,12 +0,0 @@ -export function formatDate(input: string): string { - const date = new Date(input) - return date.toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - }) -} - -export function absoluteUrl(input: string) { - return `${process.env.NEXT_PUBLIC_DRUPAL_BASE_URL}${input}` -} diff --git a/examples/example-query/next-env.d.ts b/examples/example-query/next-env.d.ts deleted file mode 100644 index 4f11a03d..00000000 --- a/examples/example-query/next-env.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// -/// - -// NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/examples/example-query/next.config.js b/examples/example-query/next.config.js deleted file mode 100644 index d671944a..00000000 --- a/examples/example-query/next.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('next').NextConfig} */ -const nextConfig = { - images: { - domains: [process.env.NEXT_IMAGE_DOMAIN], - }, -} - -module.exports = nextConfig diff --git a/examples/example-query/package.json b/examples/example-query/package.json deleted file mode 100644 index c32e7256..00000000 --- a/examples/example-query/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "example-query", - "version": "0.4.0", - "private": true, - "license": "MIT", - "scripts": { - "dev": "next dev -p 4848", - "build": "next build", - "preview": "next build && next start -p 4848", - "lint": "next lint" - }, - "dependencies": { - "@tailwindcss/forms": "^0.5.6", - "@tailwindcss/typography": "^0.5.1", - "clsx": "^1.2.1", - "next": "^12.2.3", - "next-drupal": "^1.6.0", - "next-drupal-query": "^0.4.0", - "react": "^17.0.2", - "react-dom": "^17.0.2" - }, - "devDependencies": { - "@babel/core": "^7.12.9", - "@types/node": "^17.0.21", - "@types/react": "^17.0.0", - "autoprefixer": "^10.4.2", - "eslint-config-next": "^12.0.10", - "postcss": "^8.4.5", - "tailwindcss": "^3.0.15", - "typescript": "^5.2.2" - } -} diff --git a/examples/example-query/pages/[...slug].tsx b/examples/example-query/pages/[...slug].tsx deleted file mode 100644 index 63914247..00000000 --- a/examples/example-query/pages/[...slug].tsx +++ /dev/null @@ -1,86 +0,0 @@ -import * as React from "react" -import { GetStaticPathsResult } from "next" - -import { Resource } from "types" -import { drupal } from "lib/drupal" -import { queries } from "queries" -import { Layout, LayoutProps } from "components/layout" -import { Article } from "components/article" -import { LandingPage } from "components/landing-page" -import { Page } from "components/page" - -const RESOURCE_TYPES = [ - "node--article", - "node--page", - "node--landing_page", -] as const - -interface ResourcePageProps { - menu: LayoutProps["menu"] - resource: Resource -} - -export default function ResourcePage({ menu, resource }: ResourcePageProps) { - if (!resource) return null - - return ( - - {resource.type === "page" && } - {resource.type === "article" &&
    } - {resource.type === "landing-page" && } - - ) -} - -export async function getStaticPaths(context): Promise { - return { - paths: await drupal.getStaticPathsFromContext( - Array.from(RESOURCE_TYPES), - context - ), - fallback: "blocking", - } -} - -export async function getStaticProps(context) { - const path = await drupal.translatePathFromContext(context) - - if (!path) { - return { - notFound: true, - } - } - - const type = path.jsonapi.resourceName as (typeof RESOURCE_TYPES)[number] - - if (!RESOURCE_TYPES.includes(type)) { - return { - notFound: true, - } - } - - const resource = await queries.getData(type, { - context, - path, - id: path.entity.uuid, - }) - - if (!resource) { - throw new Error(`Failed to fetch resource: ${path.jsonapi.individual}`) - } - - // If we're not in preview mode and the resource is not published, - // Return page not found. - if (!context.preview && "status" in resource && resource?.status === false) { - return { - notFound: true, - } - } - - return { - props: { - menu: await queries.getData("menu", { name: "main" }), - resource, - }, - } -} diff --git a/examples/example-query/pages/_app.tsx b/examples/example-query/pages/_app.tsx deleted file mode 100644 index 1c9392b0..00000000 --- a/examples/example-query/pages/_app.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { AppProps } from "next/app" - -import "styles/globals.css" - -export default function App({ Component, pageProps }: AppProps) { - return -} diff --git a/examples/example-query/pages/api/exit-preview.ts b/examples/example-query/pages/api/exit-preview.ts deleted file mode 100644 index cf3ba903..00000000 --- a/examples/example-query/pages/api/exit-preview.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { NextApiResponse } from "next" - -export default async function exit(_, response: NextApiResponse) { - response.clearPreviewData() - response.writeHead(307, { Location: "/" }) - response.end() -} diff --git a/examples/example-query/pages/api/preview.ts b/examples/example-query/pages/api/preview.ts deleted file mode 100644 index 9581ed10..00000000 --- a/examples/example-query/pages/api/preview.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { NextApiRequest, NextApiResponse } from "next" - -import { drupal } from "lib/drupal" - -export default async function handler( - request: NextApiRequest, - response: NextApiResponse -) { - return await drupal.preview(request, response) -} diff --git a/examples/example-query/pages/api/revalidate.ts b/examples/example-query/pages/api/revalidate.ts deleted file mode 100644 index c1b462b7..00000000 --- a/examples/example-query/pages/api/revalidate.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { NextApiRequest, NextApiResponse } from "next" - -export default async function handler( - request: NextApiRequest, - response: NextApiResponse -) { - let slug = request.query.slug as string - const secret = request.query.secret as string - - // Validate secret. - if (secret !== process.env.DRUPAL_PREVIEW_SECRET) { - return response.status(401).json({ message: "Invalid secret." }) - } - - // Validate slug. - if (!slug) { - return response.status(400).json({ message: "Invalid slug." }) - } - - try { - await response.revalidate(slug) - - return response.json({}) - } catch (error) { - return response.status(404).json({ - message: error.message, - }) - } -} diff --git a/examples/example-query/pages/index.tsx b/examples/example-query/pages/index.tsx deleted file mode 100644 index 87570e1d..00000000 --- a/examples/example-query/pages/index.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import Head from "next/head" -import { InferGetStaticPropsType } from "next" - -import { queries } from "queries" -import { Layout } from "components/layout" -import { CardFeatured } from "components/card--featured" -import { Card } from "components/card" - -export default function IndexPage({ - menu, - articles, -}: InferGetStaticPropsType) { - const [firstArticle, ...otherArticles] = articles - - return ( - - - Example Query - - -
    -

    Latest Articles.

    - {articles?.length ? ( -
    - -
    - {otherArticles.map((article, index) => ( - - ))} -
    -
    - ) : ( -

    No articles found

    - )} -
    -
    - ) -} - -export async function getStaticProps() { - return { - props: { - menu: await queries.getData("menu", { name: "main" }), - articles: await queries.getData("list--articles--published"), - }, - } -} diff --git a/examples/example-query/postcss.config.js b/examples/example-query/postcss.config.js deleted file mode 100644 index 3fa0a951..00000000 --- a/examples/example-query/postcss.config.js +++ /dev/null @@ -1,8 +0,0 @@ -// If you want to use other PostCSS plugins, see the following: -// https://tailwindcss.com/docs/using-with-preprocessors -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -} diff --git a/examples/example-query/public/favicon.ico b/examples/example-query/public/favicon.ico deleted file mode 100644 index ea2f437d9db6552726693be6cc2943a32dc5a964..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15086 zcmdU$X^c%<7ROI1lv$Z)$~+GtJY$|F!80Yq2f; >NSTKFL46_E}iL5mO)AEZS| zhz??kp>#q_Pa+X9S9!)q#7v>f>h;_1zJ2P{J?EY~6zP?$I_K=Y*ZTkWKIiUX?Ol$O z;bc0!dO3Q{aq`JLhPRsE;xZ>o<~Kd63*DEFk1M;XdugYEZ_Oa-Nh{-%0D^{MKAR3)TR78`8wfiHZP zw^UGo?y4J9e^;e_!*cd3hmYSYR;;*T(V|5?L_wL<$ z@a);MWqJ=*I%S|bJEdBpnlwj0+s2I>%gK``wdqCHu3cM_nVAU|n5l~P2F}l_<kDo{eQU1fr(;a=<7HsJ2X}tEcJ1Wh!-s|o-vjk==X>vm4I3s;pFTC^uUxqj`ki_GM4sUaXDiGB z1M$82Uj9v*H1V}>)TogZ6ciZlZ{NNZe!tdVl`2)FLWK&^XPX}43TK2l_;J;Qe7O1F zym?dn_`_}G%9Zlv%NN6c>(;H3m6c_%YSyeNGiT0}YSpSGgdO1uXSn~M`bQ)!w4bp2 zM~)mR&!0ax+^=4}D(&01k7CT8JzEYQJSbJGR*j}5zyr>3|BGrOYY&6v=6~zfEos`c zX&DZrojG&HaA%G)b?Ve;nGPK~n0}ObC*M#4ylq)H!=3ekwl>EI7{*43fg-In$8Z`Q0?)JKaJE#$(53x?l^4Y2;5_qa=u@U!I#kb9lRMnmBQyS&P7(aji?2E@j## zjr`%B)O^j$pT4G5t5(9C3@I)y7W&6n^-m*zxbqHT;sm98`L}J`RyJ+gWVrKZ=gytJ z<5C*=!#yp(Uya>F=k$yR-MV%2ZId+ew=q3mEWdZ)Zhz*&j~_oaZBM^4ckbLke`(}T z|C#dm75!-RX7}#hQoVZhZ^a+(DbF7)|GRhZO3$7>1G)1))71WU{=gh4rTH8DS;x$u zKR+(_H1fCeH|C(sMMGiRa`ZP39z3v3FMIdy73RY>Kj@mK_J=dvk%ZST+1c5qkGy{U zx|}+7D%5wQIHrEXhYy$c@86rcA3l6Ix*o9kA+L7*qQ%WxETQ!y82nC&L)EHPD^$B% zUiIqLGizbiz|8Y(dIDGP`Y}Uo6I#C~fRzltcsAbkyV5Z+iO}(r@5nz^`~?0;xyP>* zBVOAEPQS}LezcU8u3`m?0g{%YrLZ+zejpZEr&yd_fs z{vXe8#A+Aj;Qds;%lR3RqAbz38P#IPX~naS80-j1fer>-^K`?8s}ki8FWvd|Yv9`X z(Q(vF4ZjY0PVN6)i%8FMoC2=;*1Xp|(slOhy^@?x$-`L;oC4Bg@G2r*c{6aj>tpN5 z;+1;ab`YNRPqdv1BJF0|(Y7mPjDBr*KH?nJp{mhyTG{%LoX}TyR$ZXFSM{dq8& zlzY<1qYP!!(ZBP1WF5anwNUl5s@5`4DMQ&UBSwt)K^KF`@@T3))~IqGD;{QjQmLp-B2x4r?6?WX3a8t6!YfI zbNj$2zJrAR>bk1iE}{Frefx4=OZM#9BQ=Vj99`uI<4xp3H{u#VMAfx2z+gK zKRYnI-veXY>Qu1VpU^X2X8&Ztf(3rqHXST5t@PKMKU8ggsVn=C?59qfHqCc$e#(?7 z=DgFsefz@1o4^7S;WxfnwG^iNnX?$gw1_{)+7Is3sgn>dx_|$^aCXUU8*mRM*j-c$ z1In2_{YQ@;32{vKeik;g4SPYHUs$+sp~0?SzrJrfxp2S)oBlGeU*jBzAO39J3n50y z`48ev#E|mx@}y3kI`P^8OxvFami5E$-o3l9N6C4Ke*O9xABz_+ma}KihK+qOUc~Kd zzz3tSurRuxMT{*!Ki};CvqzzR%pN+wJTYo7$Z9lxVKtS|S~UH`6KyPCe0AnTGP zOG?=#i66TCsWW{X?SAy=QQ_Q^n`aXEV2Aqt=zrKl;+)KrCr@PX;K8M^;gJMB*!%{{ z_;RPw{`74K{mjy(ONDb&?lRmbfp6z)ar+;O&-h0F=EY6|-}XOo`(MUY&UCT|JY>j_ znAqSm_Os_l{}W=*qfl+YjywL)*7T?JtwCp^_{}p$>bx_s99&iH_@lRGEc6|JBjtVT zokYHS`~^Sd`A32rR!1q{@cJ12bJ@bbRw$%5zwP#FJo@PuU zjc3-pqeqX9`j3>w2HRbcXOqu4fzzi?NB=)!#flZOYSk*~+_`hCu@l?-ZhPh=*mJ&& z@s9JVy?ghTEnBw4Ix~%JsW}GroIPg#df>nT88c>#Ig^G@&Lz9CBDQ7hIfKf%80LhG z(X2-T>`U=)-MY0|r=L4_PB@ncUVuHerP_~m;IU)JWc>K?QLdb+mU@4D zAIvA*|69Yi$NbuzrgrxImHB==7+y^KY`-5ZZocQh@7Lp#viAGM9^o0EF@Har4la3= q@!D#Vku3e|`}>XLQ6?(ItsJLFQwlOQrkn9qqnVx?n@?G6u>CIsZs3vt diff --git a/examples/example-query/public/robots.txt b/examples/example-query/public/robots.txt deleted file mode 100644 index 14267e90..00000000 --- a/examples/example-query/public/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Allow: / \ No newline at end of file diff --git a/examples/example-query/queries/index.ts b/examples/example-query/queries/index.ts deleted file mode 100644 index 865bff14..00000000 --- a/examples/example-query/queries/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { createQueries } from "next-drupal-query" - -import * as Menu from "queries/menu" -import * as NodeArticle from "queries/node--article" -import * as NodeArticleTeaser from "queries/node--article--teaser" -import * as NodePage from "queries/node--page" -import * as NodeLandingPage from "queries/node--landing_page" -import * as MediaImage from "queries/media--image" -import * as ParagraphColumns from "queries/paragraph--columns" -import * as ParagraphImage from "queries/paragraph--image" -import * as ParagraphText from "queries/paragraph--text" -import * as ParagraphCard from "queries/paragraph--card" -import * as ListArticlesPublished from "queries/list--articles--published" -import * as ListArticlesRelated from "queries/list--articles--related" - -export const queries = createQueries({ - // Menu - menu: Menu, - - // Content - "node--article": NodeArticle, - "node--article--teaser": NodeArticleTeaser, - "node--page": NodePage, - "node--landing_page": NodeLandingPage, - - // Media. - "media--image": MediaImage, - - // Paragraphs. - "paragraph--columns": ParagraphColumns, - "paragraph--image": ParagraphImage, - "paragraph--text": ParagraphText, - "paragraph--card": ParagraphCard, - - // Collections. - "list--articles--published": ListArticlesPublished, - "list--articles--related": ListArticlesRelated, -}) diff --git a/examples/example-query/queries/list--articles--published.ts b/examples/example-query/queries/list--articles--published.ts deleted file mode 100644 index c3a70678..00000000 --- a/examples/example-query/queries/list--articles--published.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { - QueryData, - QueryParams, - QueryOptsWithPagination, - withPagination, - QueryFormatter, -} from "next-drupal-query" - -import { ArticleTeaser } from "types" -import { DrupalNodeArticle } from "types/drupal" -import { drupal } from "lib/drupal" -import { queries } from "queries" - -type ParamOpts = QueryOptsWithPagination - -export const params: QueryParams = (opts) => { - const params = queries - .getParams("node--article--teaser") - .addFilter("status", "1") - .addSort("created", "DESC") - - return withPagination(params, opts) -} - -export const data: QueryData = async ( - opts -): Promise => { - return await drupal.getResourceCollection( - "node--article", - { - params: params(opts).getQueryObject(), - } - ) -} - -export const formatter: QueryFormatter = ( - nodes -) => { - return nodes.map((node) => queries.formatData("node--article--teaser", node)) -} diff --git a/examples/example-query/queries/list--articles--related.ts b/examples/example-query/queries/list--articles--related.ts deleted file mode 100644 index 8db4be1c..00000000 --- a/examples/example-query/queries/list--articles--related.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { - QueryData, - QueryParams, - QueryOptsWithPagination, - withPagination, - QueryFormatter, - QueryOpts, -} from "next-drupal-query" - -import { ArticleRelated } from "types" -import { DrupalNodeArticle } from "types/drupal" -import { drupal } from "lib/drupal" -import { queries } from "queries" - -type ParamOpts = QueryOptsWithPagination<{ - excludeIds?: string[] -}> - -export const params: QueryParams = (opts) => { - const params = queries - .getParams("node--article") - .addFields("node--article", ["title", "path"]) - .addFilter("status", "1") - .addSort("created", "DESC") - - if (opts.excludeIds) { - params.addFilter("id", opts.excludeIds, "NOT IN") - } - - return withPagination(params, opts) -} - -type DataOpts = QueryOpts<{ - excludeIds?: string[] -}> - -export const data: QueryData = async ( - opts -): Promise => { - return await drupal.getResourceCollectionFromContext( - "node--article", - opts.context, - { - params: params({ excludeIds: opts.excludeIds }).getQueryObject(), - } - ) -} - -export const formatter: QueryFormatter< - DrupalNodeArticle[], - ArticleRelated[] -> = (nodes) => { - return nodes.map((node) => ({ - type: "article", - id: node.id, - title: node.title, - url: node.path.alias, - })) -} diff --git a/examples/example-query/queries/media--image.ts b/examples/example-query/queries/media--image.ts deleted file mode 100644 index 122fb6ea..00000000 --- a/examples/example-query/queries/media--image.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { QueryFormatter } from "next-drupal-query" - -import { MediaImage } from "types" -import { DrupalMediaImage } from "types/drupal" -import { absoluteUrl } from "lib/utils" - -export const formatter: QueryFormatter< - Partial, - MediaImage -> = (media) => { - if (!media?.field_media_image) { - return null - } - - return { - type: "media--image", - id: media.id, - url: absoluteUrl(media.field_media_image.uri?.url), - alt: media.field_media_image.resourceIdObjMeta?.alt || null, - width: media.field_media_image.resourceIdObjMeta?.width || 500, - height: media.field_media_image.resourceIdObjMeta?.height || 500, - } -} diff --git a/examples/example-query/queries/menu.ts b/examples/example-query/queries/menu.ts deleted file mode 100644 index a1fde1ea..00000000 --- a/examples/example-query/queries/menu.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { - QueryData, - QueryFormatter, - QueryOpts, - QueryPlaceholderData, -} from "next-drupal-query" -import { drupal } from "lib/drupal" -import { DrupalMenuLinkContent } from "next-drupal" -import { MenuLink } from "types" - -type ParamOpts = QueryOpts<{ - name: "main" | "footer" -}> - -export const data: QueryData = async ( - opts -): Promise => { - const { items } = await drupal.getMenu(opts.name) - - return items -} - -export const formatter: QueryFormatter = ( - items -) => { - return items.map((item) => ({ - text: item.title, - url: item.url, - })) -} - -export const placeholder: QueryPlaceholderData< - QueryOpts<{ title: string }>, - MenuLink[] -> = async (opts) => { - return [ - { - text: opts.title, - url: "/about", - }, - { - text: "Bar", - url: "/new", - }, - ] -} diff --git a/examples/example-query/queries/node--article--teaser.ts b/examples/example-query/queries/node--article--teaser.ts deleted file mode 100644 index 257cfd3a..00000000 --- a/examples/example-query/queries/node--article--teaser.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { QueryFormatter, QueryParams } from "next-drupal-query" - -import { ArticleTeaser } from "types" -import { DrupalNodeArticle } from "types/drupal" -import { absoluteUrl, formatDate } from "lib/utils" -import { queries } from "queries" - -export const params: QueryParams = () => { - return queries - .getParams() - .addInclude(["field_image"]) - .addFields("node--article", ["title", "path", "created", "field_image"]) -} - -export const formatter: QueryFormatter = ( - node -) => { - return { - type: "article", - id: node.id, - title: node.title, - url: node.path.alias, - date: formatDate(node.created), - image: { - url: absoluteUrl(node.field_image.uri.url), - alt: node.field_image.resourceIdObjMeta.alt, - }, - } -} diff --git a/examples/example-query/queries/node--article.ts b/examples/example-query/queries/node--article.ts deleted file mode 100644 index a3366e48..00000000 --- a/examples/example-query/queries/node--article.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { - QueryData, - QueryFormatter, - QueryOpts, - QueryParams, -} from "next-drupal-query" - -import { Article, ArticleRelated } from "types" -import { DrupalNodeArticle } from "types/drupal" -import { drupal } from "lib/drupal" -import { queries } from "queries" -import { absoluteUrl, formatDate } from "lib/utils" -import { DrupalTranslatedPath } from "next-drupal" - -export const params: QueryParams = () => { - return queries.getParams().addInclude(["field_image", "uid"]) -} - -type DataOpts = QueryOpts<{ - path: DrupalTranslatedPath - id: string -}> - -type NodeArticleData = { - node: DrupalNodeArticle - relatedArticles: ArticleRelated[] -} - -export const data: QueryData = async (opts) => { - return { - node: await drupal.getResourceFromContext( - opts.path, - opts.context, - { - params: params().getQueryObject(), - } - ), - relatedArticles: await queries.getData("list--articles--related", { - context: opts.context, - excludeIds: [opts?.id], - page: 0, - limit: 3, - }), - } -} - -export const formatter: QueryFormatter = ({ - node, - relatedArticles, -}) => { - return { - type: "article", - id: node.id, - title: node.title, - status: node.status, - author: node.uid.display_name, - date: formatDate(node.created), - url: node.path.alias, - image: { - url: absoluteUrl(node.field_image.uri.url), - alt: node.field_image.resourceIdObjMeta.alt, - }, - body: node.body?.processed, - relatedArticles, - } -} diff --git a/examples/example-query/queries/node--landing_page.ts b/examples/example-query/queries/node--landing_page.ts deleted file mode 100644 index 398313a4..00000000 --- a/examples/example-query/queries/node--landing_page.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { - QueryData, - QueryFormatter, - QueryOpts, - QueryParams, -} from "next-drupal-query" -import { DrupalTranslatedPath } from "next-drupal" - -import { LandingPage } from "types" -import { drupal } from "lib/drupal" -import { queries } from "queries" -import { DrupalNodeLandingPage } from "types/drupal" - -export const params: QueryParams = () => { - return queries - .getParams() - .addInclude([ - "field_sections.field_items.field_media.field_media_image", - "field_sections.field_items.field_items.field_media.field_media_image", - "field_sections.field_items.field_items.field_items.field_media.field_media_image", - ]) - .addFields("file--file", ["uri", "resourceIdObjMeta"]) -} - -type DataOpts = QueryOpts<{ - path: DrupalTranslatedPath - id: string -}> - -export const data: QueryData = async ( - opts -) => { - return await drupal.getResourceFromContext( - opts.path, - opts.context, - { - params: params().getQueryObject(), - } - ) -} - -export const formatter: QueryFormatter = ( - node -) => { - return { - id: node.id, - type: "landing-page", - title: node.title, - status: node.status, - sections: node.field_sections.map((paragraph) => - queries.formatData(paragraph.type, paragraph) - ), - } -} diff --git a/examples/example-query/queries/node--page.ts b/examples/example-query/queries/node--page.ts deleted file mode 100644 index 6d4303e5..00000000 --- a/examples/example-query/queries/node--page.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - QueryData, - QueryFormatter, - QueryOpts, - QueryParams, -} from "next-drupal-query" -import { DrupalTranslatedPath } from "next-drupal" - -import { Page } from "types" -import { DrupalNodePage } from "types/drupal" -import { drupal } from "lib/drupal" -import { queries } from "queries" - -export const params: QueryParams = () => { - return queries - .getParams() - .addFields("node--page", ["title", "body", "status"]) -} - -type DataOpts = QueryOpts<{ - path: DrupalTranslatedPath - id: string -}> - -export const data: QueryData = async ( - opts -): Promise => { - return await drupal.getResourceFromContext( - opts.path, - opts.context, - { - params: params().getQueryObject(), - } - ) -} - -export const formatter: QueryFormatter = (node) => { - return { - type: "page", - id: node.id, - status: node.status, - title: node.title, - content: node.body?.processed, - } -} diff --git a/examples/example-query/queries/paragraph--card.ts b/examples/example-query/queries/paragraph--card.ts deleted file mode 100644 index 32d5bb81..00000000 --- a/examples/example-query/queries/paragraph--card.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { QueryFormatter } from "next-drupal-query" - -import { SectionCard } from "types" -import { queries } from "queries" -import { DrupalParagraphCard } from "types/drupal" - -export const formatter: QueryFormatter< - Partial, - SectionCard -> = (paragraph) => { - return { - type: "section--card", - id: paragraph.id, - heading: paragraph.field_heading, - text: paragraph.field_text.processed, - image: queries.formatData("media--image", paragraph.field_media), - } -} diff --git a/examples/example-query/queries/paragraph--columns.ts b/examples/example-query/queries/paragraph--columns.ts deleted file mode 100644 index b9cc5a54..00000000 --- a/examples/example-query/queries/paragraph--columns.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { QueryFormatter } from "next-drupal-query" -import { queries } from "queries" -import { SectionColumns } from "types" -import { DrupalParagraphColumns } from "types/drupal" - -export const formatter: QueryFormatter< - Partial, - SectionColumns -> = (paragraph): SectionColumns => { - return { - type: "section--columns", - id: paragraph.id, - heading: paragraph.field_heading, - columns: paragraph.field_columns, - sections: paragraph.field_items.map((item) => - queries.formatData(item.type, item) - ), - } -} diff --git a/examples/example-query/queries/paragraph--image.ts b/examples/example-query/queries/paragraph--image.ts deleted file mode 100644 index 646db440..00000000 --- a/examples/example-query/queries/paragraph--image.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { QueryFormatter } from "next-drupal-query" - -import { queries } from "queries" -import { SectionImage } from "types" -import { DrupalParagraphImage } from "types/drupal" - -export const formatter: QueryFormatter< - Partial, - SectionImage -> = (paragraph): SectionImage => { - return { - type: "section--image", - id: paragraph.id, - image: queries.formatData("media--image", paragraph.field_media), - } -} diff --git a/examples/example-query/queries/paragraph--text.ts b/examples/example-query/queries/paragraph--text.ts deleted file mode 100644 index 41be29bc..00000000 --- a/examples/example-query/queries/paragraph--text.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { QueryFormatter } from "next-drupal-query" - -import { SectionText } from "types" -import { DrupalParagraphText } from "types/drupal" - -export const formatter: QueryFormatter< - Partial, - SectionText -> = (paragraph) => { - return { - type: "section--text", - id: paragraph.id, - text: paragraph.field_text?.processed, - } -} diff --git a/examples/example-query/styles/globals.css b/examples/example-query/styles/globals.css deleted file mode 100644 index b5c61c95..00000000 --- a/examples/example-query/styles/globals.css +++ /dev/null @@ -1,3 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; diff --git a/examples/example-query/tailwind.config.js b/examples/example-query/tailwind.config.js deleted file mode 100644 index 81060f34..00000000 --- a/examples/example-query/tailwind.config.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - mode: "jit", - content: [ - "./pages/**/*.{js,ts,jsx,tsx}", - "./components/**/*.{js,ts,jsx,tsx}", - ], - theme: { - extend: {}, - }, - variants: { - extend: {}, - }, - plugins: [require("@tailwindcss/typography")], -} diff --git a/examples/example-query/tsconfig.json b/examples/example-query/tsconfig.json deleted file mode 100644 index dc12cc29..00000000 --- a/examples/example-query/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": false, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve", - "baseUrl": "./", - "incremental": true, - "paths": { - "components/*": ["components/*"], - "hooks/*": ["hooks/*"], - "lib/*": ["lib/*"] - } - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] -} diff --git a/examples/example-query/types/drupal/base.ts b/examples/example-query/types/drupal/base.ts deleted file mode 100644 index d992dd9b..00000000 --- a/examples/example-query/types/drupal/base.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { DrupalFileMeta } from "next-drupal" - -/** - * The JsonApiResource shipped in next-drupal allows any field to set on a type. - * - * This is by designed. We want next-drupal to support all field types out of the box - * without having to manually define field.s - * - * In this example, however, we want to demo how a fully-typed system would look like. - * - * Instead of extending JsonApiResource from next-drupal, we define our own. - */ -export interface DrupalJsonApiResource { - id: string - type: string - langcode: string - status: boolean -} - -export interface DrupalFile extends DrupalJsonApiResource { - changed: string - created: string - filename: string - uri: { - value: string - url: string - } - filesize: number - filemime: string - resourceIdObjMeta?: DrupalFileMeta -} diff --git a/examples/example-query/types/drupal/field.ts b/examples/example-query/types/drupal/field.ts deleted file mode 100644 index ca34496f..00000000 --- a/examples/example-query/types/drupal/field.ts +++ /dev/null @@ -1,14 +0,0 @@ -type FieldCardinality = "limited" | "unlimited" - -export interface FieldTextFormatted { - value: string - processed: string - format: string -} - -export type FieldEntityReference< - Types, - Cardinality extends FieldCardinality = "limited", -> = Cardinality extends "unlimited" ? Array> : Partial - -export type FieldList = keyof List diff --git a/examples/example-query/types/drupal/index.ts b/examples/example-query/types/drupal/index.ts deleted file mode 100644 index 9692cf01..00000000 --- a/examples/example-query/types/drupal/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from "./base" -export * from "./field" -export * from "./media" -export * from "./user" -export * from "./node" -export * from "./paragraph" diff --git a/examples/example-query/types/drupal/media.ts b/examples/example-query/types/drupal/media.ts deleted file mode 100644 index 176ab931..00000000 --- a/examples/example-query/types/drupal/media.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { DrupalFile, DrupalJsonApiResource } from "./base" -import { FieldEntityReference } from "./field" - -export interface DrupalMedia extends DrupalJsonApiResource { - drupal_internal__mid: string - drupal_internal__vid: string - changed: string - created: string - name: string -} - -export interface DrupalMediaImage extends DrupalMedia { - type: "media--image" - field_media_image: FieldEntityReference -} diff --git a/examples/example-query/types/drupal/node.ts b/examples/example-query/types/drupal/node.ts deleted file mode 100644 index 7b956b08..00000000 --- a/examples/example-query/types/drupal/node.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { PathAlias } from "next-drupal" - -import { DrupalFile, DrupalJsonApiResource } from "./base" -import { FieldEntityReference, FieldTextFormatted } from "./field" -import { - DrupalParagraphCard, - DrupalParagraphColumns, - DrupalParagraphImage, - DrupalParagraphText, -} from "./paragraph" -import { DrupalUser } from "./user" - -export interface DrupalNode extends DrupalJsonApiResource { - title: string - changed: string - created: string - path?: PathAlias -} - -export interface DrupalNodeArticle extends DrupalNode { - type: "node--article" - body: FieldTextFormatted - field_image: FieldEntityReference - uid: FieldEntityReference -} - -export interface DrupalNodePage extends DrupalNode { - body: FieldTextFormatted -} - -export interface DrupalNodeLandingPage extends DrupalNode { - field_sections: FieldEntityReference< - | DrupalParagraphColumns - | DrupalParagraphCard - | DrupalParagraphImage - | DrupalParagraphText, - "unlimited" - > -} diff --git a/examples/example-query/types/drupal/paragraph.ts b/examples/example-query/types/drupal/paragraph.ts deleted file mode 100644 index 116bb692..00000000 --- a/examples/example-query/types/drupal/paragraph.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { DrupalJsonApiResource } from "./base" -import { FieldEntityReference, FieldList, FieldTextFormatted } from "./field" -import { DrupalMediaImage } from "./media" - -export const fieldColumnTypes = { - "25-75": "25-75", - "50-50": "50-50", - "33-33-33": "33-33-33", - "75-25": "75-25", -} as const - -export type ParagrapTypes = Pick< - | DrupalParagraphColumns - | DrupalParagraphCard - | DrupalParagraphImage - | DrupalParagraphText, - "type" ->["type"] - -export interface DrupalParagraph extends DrupalJsonApiResource { - type: ParagrapTypes -} - -export interface DrupalParagraphColumns extends DrupalParagraph { - type: "paragraph--columns" - field_heading: string - field_columns: FieldList - field_items: FieldEntityReference< - DrupalParagraphCard | DrupalParagraphImage | DrupalParagraphText, - "unlimited" - > -} - -export interface DrupalParagraphCard extends DrupalParagraph { - type: "paragraph--card" - field_heading: string - field_text: FieldTextFormatted - field_media: FieldEntityReference -} - -export interface DrupalParagraphImage extends DrupalParagraph { - type: "paragraph--image" - field_media: FieldEntityReference -} - -export interface DrupalParagraphText extends DrupalParagraph { - type: "paragraph--text" - field_text: FieldTextFormatted -} diff --git a/examples/example-query/types/drupal/user.ts b/examples/example-query/types/drupal/user.ts deleted file mode 100644 index caca9c3f..00000000 --- a/examples/example-query/types/drupal/user.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { PathAlias } from "next-drupal" - -import { DrupalJsonApiResource } from "./base" - -export interface DrupalUser extends DrupalJsonApiResource { - type: "user--user" - display_name: string - name: string - mail: string - created: string - changed: string - path?: PathAlias -} diff --git a/examples/example-query/types/index.ts b/examples/example-query/types/index.ts deleted file mode 100644 index d3845cdb..00000000 --- a/examples/example-query/types/index.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { fieldColumnTypes } from "./drupal" - -export type MenuLink = { - url: string - text: string -} - -export type Resource = LandingPage | Article | Page - -export type Page = { - type: "page" - id: string - title: string - content: string -} - -export type LandingPage = { - type: "landing-page" - id: string - title: string - sections: Section[] -} - -export type Article = { - id: string - type: "article" - status: boolean - url: string - title: string - author: string - date: string - image: { - url: string - alt: string - } - body: string - relatedArticles: ArticleRelated[] -} - -export type ArticleTeaser = Pick< - Article, - "type" | "id" | "title" | "image" | "date" | "url" -> - -export type ArticleRelated = Pick & { - url: string -} - -export type Section = SectionColumns | SectionImage | SectionText | SectionCard - -export type SectionType = Section["type"] - -export type SectionColumns = { - type: "section--columns" - id: string - heading: string - columns: keyof typeof fieldColumnTypes - sections: Section[] -} - -export type SectionImage = { - type: "section--image" - id: string - image: MediaImage -} - -export type SectionText = { - type: "section--text" - id: string - text: string -} - -export type SectionCard = { - type: "section--card" - id: string - heading: string - image: MediaImage - text: string -} - -export type MediaImage = { - type: "media--image" - id: string - url: string - alt: string - width?: number - height?: number -} diff --git a/package.json b/package.json index 3b759524..799951de 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "sync:starters:release": "./scripts/sync-repo.sh canary,main git@github.com:chapter-three/next-drupal- \"starters/*\"", "seed": "NUM_NODES=200 node ./scripts/seed", "cy:open": "turbo run cy:open --parallel", - "test": "yarn workspace next-drupal test && yarn workspace next-drupal-query test", + "test": "yarn workspace next-drupal test", "pretest": "yarn format:check && yarn lint", "test:e2e": "turbo run test:e2e --parallel", "test:e2e:ci": "turbo run test:e2e:ci --parallel" diff --git a/packages/next-drupal-query/.npmignore b/packages/next-drupal-query/.npmignore deleted file mode 100644 index 37c02ed7..00000000 --- a/packages/next-drupal-query/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -/coverage -/CHANGELOG.md -/tests diff --git a/packages/next-drupal-query/CHANGELOG.md b/packages/next-drupal-query/CHANGELOG.md deleted file mode 100644 index 70de4df6..00000000 --- a/packages/next-drupal-query/CHANGELOG.md +++ /dev/null @@ -1,63 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.5.0-alpha.0](https://github.com/chapter-three/next-drupal/compare/next-drupal-query@0.4.0...next-drupal-query@0.5.0-alpha.0) (2024-01-05) - - -### Features - -* **next-drupal:** add Next.js v14 support ([32a5a0a](https://github.com/chapter-three/next-drupal/commit/32a5a0a582c5faa93f8ac1a9633a89c60f5fd627)), closes [#578](https://github.com/chapter-three/next-drupal/issues/578) - - - - - -# [0.4.0](https://github.com/chapter-three/next-drupal/compare/next-drupal-query@0.3.0...next-drupal-query@0.4.0) (2022-12-06) - -**Note:** Version bump only for package next-drupal-query - - - - - -# [0.3.0](https://github.com/chapter-three/next-drupal/compare/next-drupal-query@0.2.1...next-drupal-query@0.3.0) (2022-08-11) - - -### Features - -* **next-drupal-query:** implement placeholder data for queries ([b41a2d6](https://github.com/chapter-three/next-drupal/commit/b41a2d6cc990504be66c44cda92def5eef7bc867)) - - - - - -## [0.2.1](https://github.com/chapter-three/next-drupal/compare/next-drupal-query@0.2.0...next-drupal-query@0.2.1) (2022-08-09) - -**Note:** Version bump only for package next-drupal-query - - - - - -# 0.2.0 (2022-08-09) - - -### Features - -* **@next-drupal/query:** add support for data formatters ([b1bab0d](https://github.com/chapter-three/next-drupal/commit/b1bab0d44bc7899299a6f7321dc75ae699bf54f5)) -* **@next-drupal/query:** update type docs ([3851197](https://github.com/chapter-three/next-drupal/commit/3851197251d8240f7102f8781ce66ee815e3aa5f)) -* add next-drupal-query ([627888e](https://github.com/chapter-three/next-drupal/commit/627888ec06138344893385c7b270f79d29822c1a)) - - - - - -# 0.1.0 (2022-07-29) - - -### Features - -* **next-drupal-query:** update type docs ([3851197](https://github.com/chapter-three/next-drupal/commit/3851197251d8240f7102f8781ce66ee815e3aa5f)) -* add next-drupal-query ([627888e](https://github.com/chapter-three/next-drupal/commit/627888ec06138344893385c7b270f79d29822c1a)) diff --git a/packages/next-drupal-query/README.md b/packages/next-drupal-query/README.md deleted file mode 100644 index 86a02f6d..00000000 --- a/packages/next-drupal-query/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# next-drupal-query - -Intentionally blank page - @shadcn diff --git a/packages/next-drupal-query/jest.config.cjs b/packages/next-drupal-query/jest.config.cjs deleted file mode 100644 index 24a2d4bb..00000000 --- a/packages/next-drupal-query/jest.config.cjs +++ /dev/null @@ -1,29 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: "ts-jest/presets/js-with-ts", - testEnvironment: "node", - setupFiles: ["dotenv/config"], - setupFilesAfterEnv: ["/jest.setup.ts"], - testMatch: ["**/tests/**/*.test.{ts,tsx}"], - transform: { - "^.+\\.tsx?$": [ - "ts-jest", - { - isolatedModules: true, - }, - ], - }, - testLocationInResults: true, - coverageProvider: "v8", - collectCoverage: true, - collectCoverageFrom: ["./src/**"], - coverageReporters: ["lcov", "text", "text-summary"], - coverageThreshold: { - global: { - statements: 84.22, - branches: 64.1, - functions: 70, - lines: 84.22, - }, - }, -} diff --git a/packages/next-drupal-query/jest.setup.ts b/packages/next-drupal-query/jest.setup.ts deleted file mode 100644 index a5ef75aa..00000000 --- a/packages/next-drupal-query/jest.setup.ts +++ /dev/null @@ -1 +0,0 @@ -import "isomorphic-fetch" diff --git a/packages/next-drupal-query/package.json b/packages/next-drupal-query/package.json deleted file mode 100644 index 38307fab..00000000 --- a/packages/next-drupal-query/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "next-drupal-query", - "description": "Query helpers for structuring large Next.js and Drupal projects.", - "version": "0.5.0-alpha.0", - "sideEffects": false, - "source": "src/index.ts", - "type": "module", - "main": "dist/index.cjs", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "exports": { - ".": { - "import": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "require": { - "types": "./dist/index.d.cts", - "default": "./dist/index.cjs" - } - } - }, - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "author": { - "name": "shadcn", - "url": "https://twitter.com/shadcn" - }, - "scripts": { - "prepare": "tsup", - "dev": "tsup --watch", - "test": "jest --verbose" - }, - "keywords": [ - "next.js", - "drupal", - "jsonapi", - "preview" - ], - "bugs": { - "url": "https://github.com/chapter-three/next-drupal/issues" - }, - "homepage": "https://github.com/chapter-three/next-drupal", - "repository": { - "type": "git", - "url": "https://github.com/chapter-three/next-drupal.git", - "directory": "packages/next-drupal-query" - }, - "devDependencies": { - "type-fest": "^4.8.1", - "typescript": "^5.2.2" - }, - "dependencies": { - "deepmerge": "^4.3.1", - "drupal-jsonapi-params": "^2.3.1", - "next": "^12.2.3 || ^13 || ^14" - } -} diff --git a/packages/next-drupal-query/src/index.ts b/packages/next-drupal-query/src/index.ts deleted file mode 100644 index 9c27ee45..00000000 --- a/packages/next-drupal-query/src/index.ts +++ /dev/null @@ -1,450 +0,0 @@ -import deepmerge from "deepmerge" -import { DrupalJsonApiParams } from "drupal-jsonapi-params" -import type { GetServerSidePropsContext, GetStaticPathsContext } from "next" -import type { RequireAllOrNone, ConditionalKeys } from "type-fest" - -// Note: some generic are explicitly not typed here to force definition. - -const paramBuilder = new DrupalJsonApiParams() - -type ViewWithFilters = { - id: string - items?: Items - filters?: Filters - nextPage?: number - opts?: QueryOptsWithPagination -} - -/** - * @template Items The items type for this view. - * @template Filters The filters type for the view. Use `null` for no filters. - * - * @example - * type ViewWithFilters = View - * type ViewWithoutFilters = View - */ -export type View = Filters extends null - ? Omit, "filters"> - : ViewWithFilters - -type QueryOptsPaginated = RequireAllOrNone< - { - page: number - limit: number - }, - "page" | "limit" -> & { - context?: GetServerSidePropsContext -} - -/** - * Use this type helper to define options for query params. - * - * @template Options The type definition for the options. Use null if no additional options. - * - * @example - * type ParamOpts = QueryOpts<{ - * id: string - * }> - * - * export const params: QueryParams = (opts) => {} - */ -export type QueryOpts = Options & { - context?: GetStaticPathsContext | GetServerSidePropsContext -} - -/** - * Use this type helper to define **paginated** options for query params. - * - * @template Options The type definition for the options. Use null if no additional options. - * - * @example - * type ParamOpts = PaginatedQueryParamsOpts<{ type: string }> - * - * export const params: QueryParams = () => {} - */ -export type QueryOptsWithPagination = Options extends null - ? QueryOptsPaginated - : Options & QueryOptsPaginated - -/** - * Use this type helper to define options for query params. - * - * @template Options The type definition for the options. Use null if no additional options. - * - * @example - * - * type ParamOpts = QueryOpts<{ - * sortBy: string - * sortOrder: "ASC" | "DESC" - * }> - * - * export const params: QueryParams = (opts) => { - * return queries.getParams() - * .addFields("node--article", ["title", "path", "status"]) - * .addSort(opts.sortBy, opts.sortOrder) - * } - */ -export type QueryParams = (opts?: Options) => DrupalJsonApiParams - -/** - * Use this type helper to define options and return type for query data. - * - * @template Options The type definition for the options. Use null if no additional options. - * @template Return The return type for the data loader. - * - * @example - * - * type DataOpts = QueryOpts<{ - * id: string - * }> - * - * type DrupalNodeArticle = { - * id: string - * title: string - * field_author: string - * } - * - * export const data: QueryData = async (opts): Promise => { - * return await drupal.getResource("node--article", opts.id) - * } - */ -export type QueryData = (opts?: Options) => Promise - -/** - * Use this type helper to define placeholder data for a query.. - * - * @template Options The type definition for the options. Use null if no additional options. - * @template Return The return type for the placeholder data. - * - * @example - * - * type DataOpts = QueryOpts<{ - * id: string - * }> - * - * type Article = { - * id: string - * title: string - * author: string - * } - * - * export const placeholder: QueryPlaceholderData = async (opts): Promise => { - * return { - * id: opts.id, - * title: faker.lorem.sentence(), - * author: faker.name.fullName() - * } - * } - */ -export type QueryPlaceholderData = ( - opts?: Options -) => Promise - -/** - * Use this type helper to define a query formatter. A formatter takes in input and outputs formatted data. - * - * @template Input The type definition for the input. - * @template Output The type definition for the output. - * - * @example - * - * type DrupalNodeArticle = { - * id: string - * title: string - * field_author: string - * } - * - * type Article = { - * id: string - * title: string - * author: string - * } - * - * // This formatter accepts a `DrupalNodeArticle` and outputs an `Article`. - * export const formatter: QueryFormatter = (node): Article => { - * return { - * id: node.id, - * title: node.title, - * author: node.field_author - * } - * } - */ -export type QueryFormatter = (input: Input) => Output - -type Queries = Record< - keyof Q, - { - params?: (opts: unknown) => DrupalJsonApiParams - data?: (opts: unknown) => unknown - placeholder?: (opts: unknown) => unknown - formatter?: (input) => unknown - } -> - -type QueryTypeOf< - Q extends Queries, - T extends keyof Q, - F extends "params" | "data" | "formatter" | "placeholder", -> = Q[T][F] - -// type QueryId = keyof Q - -type QueryParamsOpts, T extends keyof Q> = Parameters< - QueryTypeOf ->[0] - -type QueryDataOpts, T extends keyof Q> = Parameters< - Q[T]["data"] ->[0] - -type QueryPlaceholderDataOpts< - Q extends Queries, - T extends keyof Q, -> = Parameters[0] - -type QueryFormatterInput, T extends keyof Q> = Parameters< - Q[T]["formatter"] ->[0] - -type QueryDataReturn, T extends keyof Q> = ReturnType< - QueryTypeOf -> - -type QueryPlaceholderDataReturn< - Q extends Queries, - T extends keyof Q, -> = ReturnType> - -type QueryFormatterReturn, T extends keyof Q> = ReturnType< - QueryTypeOf -> - -export function withPagination( - params: DrupalJsonApiParams, - opts: QueryOptsWithPagination -) { - if (!opts) { - return params - } - - if (opts?.context?.query) { - opts = { - ...opts, - ...opts.context.query, - } - } - - if (typeof opts.page !== "undefined" && typeof opts.limit !== "undefined") { - params.addPageLimit(opts.limit).addPageOffset(opts.page * opts.limit) - } - - return params -} - -export function massageRouteQuery(query) { - if (!query) { - return {} - } - - // Remove slug keys from query. - Object.keys(query).forEach((key) => { - if (key.startsWith("slug")) { - delete query[key] - } - }) - - if (query?.page) { - query.page = parseInt(`${query.page}`) - } - - if (query?.limit) { - query.limit = parseInt(`${query.limit}`) - } - - return query -} - -export function createQueries>>(queries: Q) { - const getRawData = async < - T extends ConditionalKeys, - O extends QueryDataOpts, - >( - id: T, - opts: O = null - ): Promise> => { - if (typeof window !== "undefined") { - throw new Error( - "You should not call getQueryData on the client. This is a server-only call." - ) - } - - const query = queries?.[id] - - if (!query) { - throw new Error(`Query with id '${id as string}' not found.`) - } - - if (!query["data"]) { - throw new Error(`No data defined for query with id '${id as string}'.`) - } - - opts = massageRouteQuery(opts) - - if ( - typeof query["defaultOpts"] !== "undefined" && - typeof opts !== "undefined" - ) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - opts = deepmerge(query["defaultOpts"], opts as any) as any - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return (await query["data"](opts as any)) as any - } - - const getPlaceholderData = async < - T extends ConditionalKeys, - O extends QueryPlaceholderDataOpts, - >( - id: T, - opts: O = null - ): Promise> => { - if (typeof window !== "undefined") { - throw new Error( - "You should not call getPlaceholderData on the client. This is a server-only call." - ) - } - - const query = queries?.[id] - - if (!query) { - throw new Error(`Query with id '${id as string}' not found.`) - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return (await query["placeholder"](opts as any)) as any - } - - const formatData = < - T extends ConditionalKeys, - Input extends QueryFormatterInput, - >( - id: T, - input: Input - ): QueryFormatterReturn => { - if (typeof window !== "undefined") { - throw new Error( - "You should not call getQueryData on the client. This is a server-only call." - ) - } - - const query = queries?.[id] - - if (!query) { - throw new Error(`Query with id '${id as string}' not found.`) - } - - if (!query["formatter"]) { - throw new Error( - `No formatter defined for query with id '${id as string}'.` - ) - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return query["formatter"](input) as any - } - - async function getData< - T extends ConditionalKeys, - O extends QueryDataOpts, - >(id: T, opts?: O): Promise> - - async function getData< - T extends ConditionalKeys, - O extends QueryDataOpts, - >(id: T, opts?: O): Promise> - - async function getData< - T extends ConditionalKeys, - O extends QueryPlaceholderDataOpts, - >(id: T, opts?: O): Promise> - - async function getData(id, opts = null) { - const query = queries?.[id] - - if (!query) { - throw new Error(`Query with id '${id as string}' not found.`) - } - - // Try to get the raw data if defined. - if (query["data"]) { - const rawData = await getRawData(id, opts) - - // Format the data using the query formatter. - return query["formatter"] ? formatData(id, rawData) : rawData - } - - // Otherwise fallback to placeholder. - if (query["placeholder"]) { - return await getPlaceholderData(id, opts) - } - - throw new Error(`No data or placeholder defined for query with id '${id}'.`) - } - - return { - getDataIds: >(): T[] => { - const ids = [] - for (const id in queries) { - if (typeof queries[id]["data"] !== "undefined") { - ids.push(id) - } - } - return ids - }, - getIds: (): T[] => { - const ids = [] - for (const id in queries) { - ids.push(id) - } - return ids - }, - getParams: < - T extends ConditionalKeys, - O extends QueryParamsOpts, - >( - id: T = null, - opts: O = null - ) => { - if (typeof window !== "undefined") { - throw new Error( - "You should not call getQueryParams on the client. This is a server-only call." - ) - } - - if (!id) { - return paramBuilder.clear() - } - - const query = queries?.[id] - - if (!query) { - throw new Error(`Query with id '${id as string}' not found.`) - } - - if (!query["params"]) { - throw new Error( - `No params defined for query with id '${id as string}'.` - ) - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return query["params"](opts as any) - }, - getRawData, - getPlaceholderData, - getData, - formatData, - } -} diff --git a/packages/next-drupal-query/tests/__snapshots__/index.test.ts.snap b/packages/next-drupal-query/tests/__snapshots__/index.test.ts.snap deleted file mode 100644 index 5aac1b87..00000000 --- a/packages/next-drupal-query/tests/__snapshots__/index.test.ts.snap +++ /dev/null @@ -1,83 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`formatData it formats data 1`] = ` -{ - "name": "First Last", -} -`; - -exports[`getData it accepts data options 1`] = ` -{ - "author": "shadcn", - "id": "ID", - "title": "Title of Article", - "type": "node--article", -} -`; - -exports[`getData it accepts placeholder options 1`] = ` -{ - "email": "name@example.com", - "name": "shadcn", -} -`; - -exports[`getData it returns data for a query 1`] = ` -{ - "author": "shadcn", - "id": "id", - "title": "Title of Article", - "type": "node--article", -} -`; - -exports[`getData it returns data when both data and placeholder is defined 1`] = ` -{ - "email": "foo@example.com", -} -`; - -exports[`getData it returns formatted data if a formatter is defined 1`] = ` -{ - "email": "foo@example.com", - "name": "First Last", -} -`; - -exports[`getData it returns placeholder data if a query does not define data 1`] = ` -{ - "name": "shadcn", -} -`; - -exports[`getParams it accepts params options 1`] = ` -{ - "fields": { - "resource": "foo,bar", - }, - "filter": {}, - "include": [], - "sort": [], -} -`; - -exports[`getParams it allows params to be nested 1`] = ` -{ - "fields": {}, - "filter": {}, - "include": "field_image,uid", - "page": { - "limit": 10, - }, - "sort": [], -} -`; - -exports[`getParams it returns params for a query 1`] = ` -{ - "fields": {}, - "filter": {}, - "include": "field_image,uid", - "sort": [], -} -`; diff --git a/packages/next-drupal-query/tests/index.test.ts b/packages/next-drupal-query/tests/index.test.ts deleted file mode 100644 index a968ed93..00000000 --- a/packages/next-drupal-query/tests/index.test.ts +++ /dev/null @@ -1,111 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-nocheck - -import { expect } from "@jest/globals" - -import { queries } from "./queries" - -describe("getParams", () => { - test("it returns params for a query", () => { - const params = queries.getParams("params-only") - - expect(params.getQueryObject()).toMatchSnapshot() - }) - - test("it accepts params options", () => { - const params = queries.getParams("params-with-opts", { - fields: ["foo", "bar"], - }) - - expect(params.getQueryObject()).toMatchSnapshot() - }) - - test("it allows params to be nested", () => { - const params = queries.getParams("params-nested") - - expect(params.getQueryObject()).toMatchSnapshot() - }) - - test("it throws an error if query does not exist", () => { - expect(() => queries.getParams("does-not-exist")).toThrow( - "Query with id 'does-not-exist' not found." - ) - }) - - test("it throws an error if query does not define params", () => { - expect(() => queries.getParams("data-only")).toThrow( - "No params defined for query with id 'data-only'." - ) - }) -}) - -describe("getData", () => { - test("it returns data for a query", async () => { - const data = await queries.getData("data-only") - - expect(data).toMatchSnapshot() - }) - - test("it accepts data options", async () => { - const data = await queries.getData("data-with-opts", { id: "ID" }) - - expect(data).toMatchSnapshot() - }) - - test("it throws an error if query does not exist", async () => { - await expect(queries.getData("does-not-exist")).rejects.toThrow( - "Query with id 'does-not-exist' not found." - ) - }) - - test("it throws an error if query does not define data", async () => { - await expect(queries.getData("params-only")).rejects.toThrow( - "No data or placeholder defined for query with id 'params-only'." - ) - }) - - test("it does NOT throw error if a query does not define data but defines a placeholder", async () => { - await expect(queries.getData("placeholder-only")).resolves.not.toThrow() - }) - - test("it returns placeholder data if a query does not define data", async () => { - const data = await queries.getData("placeholder-only") - - expect(data).toMatchSnapshot() - }) - - test("it accepts placeholder options", async () => { - const data = await queries.getData("placeholder-with-opts", { - email: "name@example.com", - }) - - expect(data).toMatchSnapshot() - }) - - test("it returns data when both data and placeholder is defined", async () => { - const data = await queries.getData("data-with-placeholder", { - email: "foo@example.com", - }) - - expect(data).toMatchSnapshot() - }) - - test("it returns formatted data if a formatter is defined", async () => { - const data = await queries.getData("data-with-formatter", { - email: "foo@example.com", - }) - - expect(data).toMatchSnapshot() - }) -}) - -describe("formatData", () => { - test("it formats data", () => { - expect( - queries.formatData("formatter-only", { - firstName: "First", - lastName: "Last", - }) - ).toMatchSnapshot() - }) -}) diff --git a/packages/next-drupal-query/tests/queries/data-only.ts b/packages/next-drupal-query/tests/queries/data-only.ts deleted file mode 100644 index e7a5e24d..00000000 --- a/packages/next-drupal-query/tests/queries/data-only.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { QueryData } from "../../src" - -export type NodeArticle = { - id: string - type: "node--article" - title: string - author: string -} - -export const data: QueryData< - null, - NodeArticle -> = async (): Promise => { - return { - type: "node--article", - id: "id", - title: "Title of Article", - author: "shadcn", - } -} diff --git a/packages/next-drupal-query/tests/queries/data-with-formatter.ts b/packages/next-drupal-query/tests/queries/data-with-formatter.ts deleted file mode 100644 index 39fc6b54..00000000 --- a/packages/next-drupal-query/tests/queries/data-with-formatter.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { QueryData, QueryFormatter, QueryOpts } from "../../src" - -type ParamOpts = QueryOpts<{ - email: string -}> - -type RawUserData = { - firstName: string - lastName: string - email: string -} - -export const data: QueryData = async ( - opts -): Promise => { - return { - firstName: "First", - lastName: "Last", - email: opts?.email || "n/a", - } -} - -type FormattedUserData = { - name: string - email: string -} - -export const formatter: QueryFormatter = ( - input -) => { - return { - name: `${input.firstName} ${input.lastName}`, - email: input.email, - } -} diff --git a/packages/next-drupal-query/tests/queries/data-with-opts.ts b/packages/next-drupal-query/tests/queries/data-with-opts.ts deleted file mode 100644 index 71c32022..00000000 --- a/packages/next-drupal-query/tests/queries/data-with-opts.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { QueryData, QueryOpts } from "../../src" - -export type NodeArticle = { - id: string - type: "node--article" - title: string - author: string -} - -type DataOpts = QueryOpts<{ - id: string -}> - -export const data: QueryData = async ( - opts -): Promise => { - return { - type: "node--article", - id: opts?.id || "2", - title: "Title of Article", - author: "shadcn", - } -} diff --git a/packages/next-drupal-query/tests/queries/data-with-placeholder.ts b/packages/next-drupal-query/tests/queries/data-with-placeholder.ts deleted file mode 100644 index 2f73f9d4..00000000 --- a/packages/next-drupal-query/tests/queries/data-with-placeholder.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { QueryData, QueryOpts, QueryPlaceholderData } from "../../src" - -type ParamOpts = QueryOpts<{ - email: string -}> - -export const data: QueryData = async ( - opts -): Promise<{ - email: string -}> => { - return { - email: opts.email, - } -} - -export const placeholder: QueryPlaceholderData< - ParamOpts, - { name: string; email: string } -> = async (opts) => { - return { - name: "placeholder", - email: opts.email, - } -} diff --git a/packages/next-drupal-query/tests/queries/formatter-only.ts b/packages/next-drupal-query/tests/queries/formatter-only.ts deleted file mode 100644 index bb7f73ee..00000000 --- a/packages/next-drupal-query/tests/queries/formatter-only.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { QueryFormatter } from "../../src" - -type Input = { - firstName: string - lastName: string -} - -type Output = { - name: string -} - -export const formatter: QueryFormatter = (input) => { - return { - name: `${input.firstName} ${input.lastName}`, - } -} diff --git a/packages/next-drupal-query/tests/queries/index.ts b/packages/next-drupal-query/tests/queries/index.ts deleted file mode 100644 index 83f81551..00000000 --- a/packages/next-drupal-query/tests/queries/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -import * as ParamsOnly from "./params-only" -import * as ParamsWithOpts from "./params-with-opts" -import * as ParamsNested from "./params-nested" -import * as DataOnly from "./data-only" -import * as DataWithOpts from "./data-with-opts" -import * as PlaceholderOnly from "./placeholder-only" -import * as PlaceholderWithOpts from "./placeholder-with-opts" -import * as DataWithPlaceholder from "./data-with-placeholder" -import * as FormatterOnly from "./formatter-only" -import * as DataWithFormatter from "./data-with-formatter" - -import { createQueries } from "../../src" - -export const queries = createQueries({ - "params-only": ParamsOnly, - "params-with-opts": ParamsWithOpts, - "params-nested": ParamsNested, - "data-only": DataOnly, - "data-with-opts": DataWithOpts, - "placeholder-only": PlaceholderOnly, - "placeholder-with-opts": PlaceholderWithOpts, - "data-with-placeholder": DataWithPlaceholder, - "formatter-only": FormatterOnly, - "data-with-formatter": DataWithFormatter, -}) diff --git a/packages/next-drupal-query/tests/queries/node--article.ts b/packages/next-drupal-query/tests/queries/node--article.ts deleted file mode 100644 index 9369cb6f..00000000 --- a/packages/next-drupal-query/tests/queries/node--article.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { - QueryData, - QueryOpts, - QueryOptsWithPagination, - QueryParams, -} from "../../src" -import { queries } from "." - -export type NodeArticle = { - id: string - type: "node--article" - title: string - author: string -} - -type ParamOpts = QueryOptsWithPagination<{ - id: number -}> - -export const params: QueryParams = (opts) => { - return queries.getParams().addInclude(["field_image", "uid"]) -} - -type DataOpts = QueryOpts<{ - id: string -}> - -export const data: QueryData = async ( - opts -): Promise => { - return { - type: "node--article", - id: "id", - title: "Title of Article", - author: "shadcn", - } -} diff --git a/packages/next-drupal-query/tests/queries/params-nested.ts b/packages/next-drupal-query/tests/queries/params-nested.ts deleted file mode 100644 index 14605c75..00000000 --- a/packages/next-drupal-query/tests/queries/params-nested.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { QueryParams } from "../../src" -import { queries } from "." - -export const params: QueryParams = () => { - return queries.getParams("params-only").addPageLimit(10) -} diff --git a/packages/next-drupal-query/tests/queries/params-only.ts b/packages/next-drupal-query/tests/queries/params-only.ts deleted file mode 100644 index 1a3a1d2a..00000000 --- a/packages/next-drupal-query/tests/queries/params-only.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { QueryParams } from "../../src" -import { queries } from "." - -export const params: QueryParams = () => { - return queries.getParams().addInclude(["field_image", "uid"]) -} diff --git a/packages/next-drupal-query/tests/queries/params-with-opts.ts b/packages/next-drupal-query/tests/queries/params-with-opts.ts deleted file mode 100644 index 0820ef15..00000000 --- a/packages/next-drupal-query/tests/queries/params-with-opts.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { QueryOpts, QueryParams } from "../../src" -import { queries } from "." - -type ParamOpts = QueryOpts<{ - fields: string[] -}> - -export const params: QueryParams = (opts) => { - return queries.getParams().addFields("resource", opts.fields) -} diff --git a/packages/next-drupal-query/tests/queries/placeholder-only.ts b/packages/next-drupal-query/tests/queries/placeholder-only.ts deleted file mode 100644 index f08ecce5..00000000 --- a/packages/next-drupal-query/tests/queries/placeholder-only.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { QueryPlaceholderData } from "../../src" - -export const placeholder: QueryPlaceholderData< - null, - { name: string } -> = async () => { - return { - name: "shadcn", - } -} diff --git a/packages/next-drupal-query/tests/queries/placeholder-with-opts.ts b/packages/next-drupal-query/tests/queries/placeholder-with-opts.ts deleted file mode 100644 index 132ec502..00000000 --- a/packages/next-drupal-query/tests/queries/placeholder-with-opts.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { QueryOpts, QueryPlaceholderData } from "../../src" - -type ParamOpts = QueryOpts<{ - email: string -}> - -export const placeholder: QueryPlaceholderData< - ParamOpts, - { name: string; email: string } -> = async (opts) => { - return { - name: "shadcn", - email: opts.email, - } -} diff --git a/packages/next-drupal-query/tsup.config.ts b/packages/next-drupal-query/tsup.config.ts deleted file mode 100644 index 2562b07f..00000000 --- a/packages/next-drupal-query/tsup.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { defineConfig } from "tsup" - -export const tsup = defineConfig({ - entry: ["src/index.ts"], - // Enable experimental code splitting support in CommonJS. - // splitting: true, - // Use Rollup for tree shaking. - // treeshake: true, - sourcemap: true, - clean: true, - format: ["esm", "cjs"], - dts: true, - cjsInterop: true, -}) diff --git a/yarn.lock b/yarn.lock index 1a0858ae..e4e8a189 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4441,11 +4441,6 @@ clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== -clsx@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12" - integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg== - cluster-key-slot@^1.1.0: version "1.1.2" resolved "https://registry.yarnpkg.com/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz#88ddaa46906e303b5de30d3153b7d9fe0a0c19ac" @@ -5009,7 +5004,7 @@ deep-is@^0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -deepmerge@^4.2.2, deepmerge@^4.3.1: +deepmerge@^4.2.2: version "4.3.1" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== @@ -5221,7 +5216,7 @@ drupal-jsonapi-params@^1.2.2: dependencies: qs "^6.10.0" -drupal-jsonapi-params@^2.0.0, drupal-jsonapi-params@^2.1.0, drupal-jsonapi-params@^2.3.1: +drupal-jsonapi-params@^2.0.0: version "2.3.1" resolved "https://registry.yarnpkg.com/drupal-jsonapi-params/-/drupal-jsonapi-params-2.3.1.tgz#7e91f9d7aa6b2b0793cf6b51fe19a5ffb9591278" integrity sha512-Isx6dudrFhORCl87OWHHO2LpQIAha5d6n7+/fwngsgcQs4PYeZcmTAA3pKUmvfyyFgCJ0N4fLAJQHyf4jtgiDA== @@ -9412,16 +9407,6 @@ next-auth@^4.22.1: preact-render-to-string "^5.1.19" uuid "^8.3.2" -next-drupal-query@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/next-drupal-query/-/next-drupal-query-0.4.0.tgz#26def174b3449fd5365670c83f23f942cab8d845" - integrity sha512-05kDHr/I0OiwaXLQxhBHEZ1q6xIWYNSnli2TsiAgEtfmDo4K2mqGEnjPDUXzkXvtH/XfJ7y5hG83qydLKghiAA== - dependencies: - deepmerge "^4.2.2" - drupal-jsonapi-params "^2.1.0" - next "^12.2.3 || ^13" - type-fest "^2.17.0" - next-drupal@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/next-drupal/-/next-drupal-1.6.0.tgz#4bc14f73a5dc55763e461da696fc938da2bb6b67" @@ -9484,7 +9469,7 @@ next-seo@^4.23.0: resolved "https://registry.yarnpkg.com/next-seo/-/next-seo-4.29.0.tgz#d281e95ba47914117cc99e9e468599f0547d9b9b" integrity sha512-xmwzcz4uHaYJ8glbuhs6FSBQ7z3irmdPYdJJ5saWm72Uy3o+mPKGaPCXQetTCE6/xxVnpoDV4yFtFlEjUcljSg== -"next@^12.2.0 || ^13", "next@^12.2.3 || ^13": +"next@^12.2.0 || ^13": version "13.5.6" resolved "https://registry.yarnpkg.com/next/-/next-13.5.6.tgz#e964b5853272236c37ce0dd2c68302973cf010b1" integrity sha512-Y2wTcTbO4WwEsVb4A8VSnOsG1I9ok+h74q0ZdxkwM3EODqrs4pasq7O0iUxbcS9VtWMicG7f3+HAj0r1+NtKSw== @@ -9533,7 +9518,7 @@ next@^12.2.3: "@next/swc-win32-ia32-msvc" "12.3.4" "@next/swc-win32-x64-msvc" "12.3.4" -"next@^12.2.3 || ^13 || ^14", "next@^13.4 || ^14", next@^14: +"next@^13.4 || ^14", next@^14: version "14.1.0" resolved "https://registry.yarnpkg.com/next/-/next-14.1.0.tgz#b31c0261ff9caa6b4a17c5af019ed77387174b69" integrity sha512-wlzrsbfeSU48YQBjZhDzOwhWhGsy+uQycR8bHAOt1LY1bn3zZEcDyHQOEoN3aWzQ8LHCAJ1nqrWCc9XF2+O45Q== @@ -12691,21 +12676,11 @@ type-fest@^0.8.0, type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -type-fest@^2.17.0: - version "2.19.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.19.0.tgz#88068015bb33036a598b952e55e9311a60fd3a9b" - integrity sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA== - type-fest@^3.0.0: version "3.13.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-3.13.1.tgz#bb744c1f0678bea7543a2d1ec24e83e68e8c8706" integrity sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g== -type-fest@^4.8.1: - version "4.10.2" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.10.2.tgz#3abdb144d93c5750432aac0d73d3e85fcab45738" - integrity sha512-anpAG63wSpdEbLwOqH8L84urkL6PiVIov3EMmgIhhThevh9aiMQov+6Btx0wldNcvm4wV+e2/Rt1QdDwKHFbHw== - typed-array-buffer@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz#1867c5d83b20fcb5ccf32649e5e2fc7424474ff3"