diff --git a/.github/workflows/test-local.yaml b/.github/workflows/test-local.yaml index c993ba2ce..18ea351e3 100644 --- a/.github/workflows/test-local.yaml +++ b/.github/workflows/test-local.yaml @@ -119,61 +119,3 @@ jobs: CYPRESS_DATA_PROVIDER: ${{ matrix.data_provider }} CYPRESS_UI_FRAMEWORK: ${{ matrix.ui_framework }} CYPRESS_AUTH_PROVIDER: ${{ steps.build_step.outputs.auth_provider }} - remix: - runs-on: ubuntu-latest - name: remix - concurrency: - group: ${{ github.ref }}-e2e-local-remix-${{ matrix.data_provider }}-${{ matrix.ui_framework }} - cancel-in-progress: true - strategy: - fail-fast: false - matrix: - data_provider: - [ - custom-json-rest, - strapi-v4, - nestjsx-crud, - airtable, - supabase, - appwrite, - hasura, - ] - ui_framework: [tailwindcss, antd, mui, no] - steps: - - name: Checkout - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install - run: npm install - - name: Build Examples - id: build_step - run: node ./.github/workflows/build-template.js - env: - FRAMEWORK: remix - DATA_PROVIDER: ${{ matrix.data_provider }} - UI_FRAMEWORK: ${{ matrix.ui_framework }} - - name: Install Deps - run: | - cd ${{ steps.build_step.outputs.project_path }} - npm install - npm run build - HOST=0.0.0.0 npm run start & - - name: Run Cypress on local - uses: cypress-io/github-action@v6 - with: - install: false - record: true - start: "npm ls" - wait-on: "http://0.0.0.0:3000" - group: e2e-local-remix-${{ matrix.data_provider }}-${{ matrix.ui_framework }}-${{ steps.build_step.outputs.auth_provider }} - env: - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - CYPRESS_USER_AGENT: ${{ secrets.CI_USER_AGENT }} - CYPRESS_FRAMEWORK: remix - CYPRESS_DATA_PROVIDER: ${{ matrix.data_provider }} - CYPRESS_UI_FRAMEWORK: ${{ matrix.ui_framework }} - CYPRESS_AUTH_PROVIDER: ${{ steps.build_step.outputs.auth_provider }} diff --git a/.github/workflows/test-remote.yaml b/.github/workflows/test-remote.yaml index 1b8c0db04..c33920ece 100644 --- a/.github/workflows/test-remote.yaml +++ b/.github/workflows/test-remote.yaml @@ -121,61 +121,3 @@ jobs: CYPRESS_DATA_PROVIDER: ${{ matrix.data_provider }} CYPRESS_UI_FRAMEWORK: ${{ matrix.ui_framework }} CYPRESS_AUTH_PROVIDER: ${{ steps.download_step.outputs.auth_provider }} - refine-remix: - runs-on: ubuntu-latest - name: Remix - concurrency: - group: ${{ github.ref }}-e2e-remote-remix-${{ matrix.data_provider }}-${{ matrix.ui_framework }} - cancel-in-progress: true - strategy: - fail-fast: false - matrix: - data_provider: - [ - custom-json-rest, - strapi-v4, - nestjsx-crud, - airtable, - supabase, - appwrite, - hasura, - ] - ui_framework: [tailwindcss, antd, mui, no] - steps: - - name: Checkout - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install - run: npm install - - name: Download Example - id: download_step - run: node ./.github/workflows/build-remote.js - env: - FRAMEWORK: remix - CI_USER_AGENT: ${{ secrets.CI_USER_AGENT }} - DATA_PROVIDER: ${{ matrix.data_provider }} - UI_FRAMEWORK: ${{ matrix.ui_framework }} - - name: Install & Build Deps - run: | - cd ${{ steps.download_step.outputs.project_path }} - npm install - npm run build - HOST=0.0.0.0 npm run start & - - name: Run Cypress on local - uses: cypress-io/github-action@v6 - with: - install: false - record: true - start: "npm ls" - wait-on: "http://localhost:3000" - group: e2e-remote-remix-${{ matrix.data_provider }}-${{ matrix.ui_framework }}-${{ steps.download_step.outputs.auth_provider }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - CYPRESS_USER_AGENT: ${{ secrets.CI_USER_AGENT }} - CYPRESS_FRAMEWORK: remix - CYPRESS_DATA_PROVIDER: ${{ matrix.data_provider }} - CYPRESS_UI_FRAMEWORK: ${{ matrix.ui_framework }} - CYPRESS_AUTH_PROVIDER: ${{ steps.download_step.outputs.auth_provider }} diff --git a/cypress/e2e/build-test.cy.js b/cypress/e2e/build-test.cy.js index c87966225..e3def8655 100644 --- a/cypress/e2e/build-test.cy.js +++ b/cypress/e2e/build-test.cy.js @@ -11,15 +11,6 @@ const shouldSkip = () => { return true; } - if ( - Cypress.env("FRAMEWORK") === "remix" && - Cypress.env("UI_FRAMEWORK") === "antd" - ) { - cy.log("Remix with Antd has known issues, skipping."); - - return true; - } - return false; }; @@ -120,11 +111,8 @@ describe("build test", () => { cy.contains("Blog Posts", { matchCase: false }).should("exist"); // document title check - // ignore remix and nextjs - if ( - Cypress.env("FRAMEWORK") !== "remix" && - Cypress.env("FRAMEWORK") !== "nextjs" - ) { + // ignore nextjs + if (Cypress.env("FRAMEWORK") !== "nextjs") { cy.title().should("eq", "Blog posts | Refine"); } diff --git a/presets.js b/presets.js index e2a34c3fe..d05bf4178 100644 --- a/presets.js +++ b/presets.js @@ -39,18 +39,6 @@ module.exports = { "headless-example": "no", }, }, - { - name: "refine-headless-remix", - type: "refine-remix", - answers: { - "ui-framework": "no", - "data-provider": "data-provider-custom-json-rest", - "auth-provider": "none", - "antd-example": "no", - "mui-example": "no", - "headless-example": "no", - }, - }, { name: "refine-antd-nextjs", type: "refine-nextjs", @@ -124,17 +112,5 @@ module.exports = { "headless-example": "no", }, }, - { - name: "remix-tailwindcss", - type: "refine-remix", - answers: { - "ui-framework": "tailwindcss", - "data-provider": "data-provider-custom-json-rest", - "auth-provider": "none", - "antd-example": "no", - "mui-example": "no", - "headless-example": "no", - }, - }, ], }; diff --git a/refine-remix/plugins/_base/app/components/app-icon/index.tsx b/refine-remix/plugins/_base/app/components/app-icon/index.tsx deleted file mode 100644 index 7c6d8b375..000000000 --- a/refine-remix/plugins/_base/app/components/app-icon/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from "react"; - -export const AppIcon: React.FC = () => { - return ( - <%_ if (selectedSvg) { _%> - <%- selectedSvg %> - <%_ } _%> - ) -} \ No newline at end of file diff --git a/refine-remix/plugins/_base/app/components/breadcrumb/index.tsx b/refine-remix/plugins/_base/app/components/breadcrumb/index.tsx deleted file mode 100644 index 18420f1eb..000000000 --- a/refine-remix/plugins/_base/app/components/breadcrumb/index.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { useBreadcrumb } from "@refinedev/core"; -import { Link } from "@remix-run/react"; - -export const Breadcrumb = () => { - const { breadcrumbs } = useBreadcrumb(); - - return ( - - ); -}; diff --git a/refine-remix/plugins/_base/app/components/layout/index.tsx b/refine-remix/plugins/_base/app/components/layout/index.tsx deleted file mode 100644 index bae0f7f2c..000000000 --- a/refine-remix/plugins/_base/app/components/layout/index.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import type { PropsWithChildren } from "react"; -import { Breadcrumb } from "../breadcrumb"; -import { Menu } from "../menu"; - -export const Layout: React.FC = ({ children }) => { - return ( -
- -
- -
{children}
-
-
- ); -}; diff --git a/refine-remix/plugins/_base/app/components/menu/index.tsx b/refine-remix/plugins/_base/app/components/menu/index.tsx deleted file mode 100644 index 482a5c12c..000000000 --- a/refine-remix/plugins/_base/app/components/menu/index.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { - <%_ if (_app.isAuthProviderCheck || _app.isNextAuthCheck) { _%> - useLogout, - <%_ } _%> - useMenu -} from "@refinedev/core"; -import { NavLink } from "@remix-run/react"; - -export const Menu = () => { - <%_ if (_app.isAuthProviderCheck || _app.isNextAuthCheck) { _%> - const { mutate: logout } = useLogout(); - <%_ } _%> - const { menuItems } = useMenu(); - - return ( - - ); -}; diff --git a/refine-remix/plugins/_base/app/global.css b/refine-remix/plugins/_base/app/global.css deleted file mode 100644 index 7d0bec252..000000000 --- a/refine-remix/plugins/_base/app/global.css +++ /dev/null @@ -1,88 +0,0 @@ -body { - margin: 0px; -} - -table { - border-spacing: 0; - border: 1px solid black; -} - -table th, -td { - margin: 0; - padding: 0.5rem; - border-bottom: 1px solid black; - border-right: 1px solid black; -} - -table tr:last-child td { - border-bottom: 0; -} - -table th, -td { - margin: 0; - padding: 0.5rem; - border-bottom: 1px solid black; - border-right: 1px solid black; -} - -table th:last-child, -td:last-child { - border-right: 0; -} - -.layout { - display: flex; - gap: 16px; -} - -@media screen and (max-width: 751px) { - .layout { - display: block; - } -} - -.layout .content { - display: flex; - flex-direction: column; - flex-grow: 1; -} - -.breadcrumb { - display: flex; - gap: 24px; - list-style-type: "/ "; - padding: 8px 16px; - border-bottom: 1px solid lightgray; -} - -.breadcrumb a { - color: blue; - text-decoration: none; -} - -.menu { - flex-shrink: 0; - padding: 8px 16px; - border-right: 1px solid lightgray; -} - -.menu a { - color: black; -} - -.menu .active { - font-weight: bold; -} - -@media screen and (max-width: 751px) { - .menu { - border-right: none; - border-bottom: 1px solid lightgray; - } -} - -.menu ul { - padding-left: 16px; -} diff --git a/refine-remix/plugins/_base/extend.js b/refine-remix/plugins/_base/extend.js deleted file mode 100644 index b309951f9..000000000 --- a/refine-remix/plugins/_base/extend.js +++ /dev/null @@ -1,225 +0,0 @@ -const base = { - _app: { - isNextAuthCheck: false, - isAuthProviderCheck: false, - hasRoutes: true, - loader: [], - authPageProps: [], - localImport: [], - refineAntdImports: [], - refineMuiImports: [], - styleImport: [], - }, - selectedTheme: "Blue", - selectedTitle: undefined, - selectedSvg: undefined, - isGraphQL: false, - blogPostCategoryFieldName: "category", - blogPostCategoryTableField: `"category"`, - blogPostCategoryIdFormField: `["category", "id"]`, - blogPostStatusOptions: [], - blogPostStatusDefaultValue: `"draft"`, -}; - -module.exports = { - extend(answers) { - const dataProvider = answers["data-provider"]; - const authProvider = answers["auth-provider"]; - const uiFramework = answers["ui-framework"]; - const isHeadless = - uiFramework === "no" || uiFramework === "tailwindcss"; - - // ## isNextAuthCheck - if ( - authProvider === "auth-provider-auth0" || - authProvider === "auth-provider-google" || - authProvider === "auth-provider-keycloak" - ) { - base._app.isNextAuthCheck = true; - } - // ## isNextAuthCheck - - // ## isAuthProviderCheck - if ( - authProvider === "auth-provider-custom" || - dataProvider === "data-provider-supabase" || - dataProvider === "data-provider-strapi-v4" || - dataProvider === "data-provider-appwrite" - ) { - base._app.isAuthProviderCheck = true; - } - // ## isAuthProviderCheck - - // ## authPageProps - let defaultValuePropsName = "initialValues"; - let defaultValues = `email: "demo@refine.dev", password: "demodemo"`; - // change supabase login credentials - if (dataProvider === "data-provider-supabase") { - defaultValues = `email: "info@refine.dev", password: "refine-supabase"`; - } - - // mui - if (uiFramework === "mui") { - defaultValuePropsName = "defaultValues"; - } - - base._app.authPageProps = [ - `formProps={{ ${defaultValuePropsName}:{ ${defaultValues} } }}`, - ]; - - // update for headless - if (isHeadless) { - base._app.authPageProps = [ - ` - renderContent={(content) => ( -
-

- ${defaultValues - .replace(/"/g, "") - .replace(/,/g, "
")} -

- {content} -
- )} - `, - ]; - } - - // ## hasRoutes - if ( - ["headless-example", "antd-example", "mui-example"].every( - (item) => answers[item] === "no", - ) - ) { - base._app.hasRoutes = false; - } - - // ## selected theme - const themeFromAnswers = answers["theme"]; - if (themeFromAnswers) { - base.selectedTheme = themeFromAnswers; - } - // ## selected title - const titleFromAnswers = answers["title"]; - if (titleFromAnswers) { - base.selectedTitle = titleFromAnswers; - } - // ## selected svg - const svgFromAnswers = answers["svg"]; - if (svgFromAnswers) { - base.selectedSvg = svgFromAnswers; - } - - if (!isHeadless && (answers["title"] || answers["svg"])) { - base._app.localImport.push( - 'import { AppIcon } from "@components/app-icon";', - ); - } - - if (isHeadless) { - base._app.localImport.push(`import styles from "~/global.css";`); - base._app.styleImport.push('{ rel: "stylesheet", href: styles }'); - } - - // ## isGraphQL - if ( - ["data-provider-hasura", "data-provider-nestjs-query"].includes( - dataProvider, - ) - ) { - base.isGraphQL = true; - } - - // ## blogPostCategoryFieldName - if (dataProvider === "data-provider-supabase") { - base.blogPostCategoryFieldName = "categories"; - } else { - base.blogPostCategoryFieldName = "category"; - } - - // ## blogPostCategoryIdFormField - if (dataProvider === "data-provider-hasura") { - base.blogPostCategoryIdFormField = `"category_id"`; - } else if (dataProvider === "data-provider-nestjs-query") { - base.blogPostCategoryIdFormField = `"categoryId"`; - } else if (dataProvider === "data-provider-supabase") { - base.blogPostCategoryIdFormField = `"categoryId"`; - } else if (dataProvider === "data-provider-appwrite") { - base.blogPostCategoryIdFormField = `"category"`; - } else { - if (uiFramework === "mui" || isHeadless) { - base.blogPostCategoryIdFormField = `"category.id"`; - } else { - base.blogPostCategoryIdFormField = `["category", "id"]`; - } - } - - // ## blogPostCategoryTableField - if (base.isGraphQL || dataProvider === "data-provider-appwrite") { - if (isHeadless) { - base.blogPostCategoryTableField = `"category.title"`; - } - if (uiFramework === "antd") { - base.blogPostCategoryTableField = `['category', 'title']`; - } - if (uiFramework === "mui") { - base.blogPostCategoryTableField = `"category"`; - } - } else { - if (dataProvider === "data-provider-supabase") { - base.blogPostCategoryTableField = `"categories"`; - } else { - base.blogPostCategoryTableField = `"category"`; - } - } - - // ## blogPostStatusOptions - if (dataProvider === "data-provider-nestjs-query") { - base.blogPostStatusOptions = JSON.stringify([ - { value: "DRAFT", label: "Draft" }, - { value: "PUBLISHED", label: "Published" }, - { value: "REJECTED", label: "Rejected" }, - ]); - } else { - base.blogPostStatusOptions = JSON.stringify([ - { value: "draft", label: "Draft" }, - { value: "published", label: "Published" }, - { value: "rejected", label: "Rejected" }, - ]); - } - if (isHeadless || uiFramework === "mui") { - base.blogPostStatusOptions = JSON.parse(base.blogPostStatusOptions); - } - - // ## blogPostStatusDefaultValue - if (dataProvider === "data-provider-nestjs-query") { - base.blogPostStatusDefaultValue = `"DRAFT"`; - } else { - base.blogPostStatusDefaultValue = `"draft"`; - } - - // ## Refine options.title - if (!isHeadless && (answers["title"] || answers["svg"])) { - if (!base._app.refineOptions) { - base._app.refineOptions = []; - } - const textLine = answers["title"] - ? `text: "${answers["title"]}",` - : ""; - const iconLine = answers["svg"] ? `icon: ,` : ""; - const template = `title: { ${textLine} ${iconLine} },`; - - base._app.refineOptions.push(template); - } - - return base; - }, -}; diff --git a/refine-remix/plugins/antd-example/app/routes/_index.tsx b/refine-remix/plugins/antd-example/app/routes/_index.tsx deleted file mode 100644 index b8f4a59ed..000000000 --- a/refine-remix/plugins/antd-example/app/routes/_index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { NavigateToResource } from "@refinedev/remix-router"; - -/** - * Since we don't have any routes for the index page, we're redirecting the user to the first resource. - * - * This can also be done using the `loader` function and `redirect`. - */ -export default function Index() { - <%_ if (answers["data-provider"] === 'data-provider-strapi-v4') { _%> - return ; - <%_ } else { _%> - return ; - <%_ } _%> -} diff --git a/refine-remix/plugins/antd-example/app/routes/_layout.$.tsx b/refine-remix/plugins/antd-example/app/routes/_layout.$.tsx deleted file mode 100644 index 1549b00cc..000000000 --- a/refine-remix/plugins/antd-example/app/routes/_layout.$.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { ErrorComponent } from "@refinedev/antd"; - -/** - * We're using a splat route to catch all routes that don't match any other route and render the `ErrorComponent` as 404 page. - */ -export default function Index() { - return ; -} diff --git a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts._index.tsx b/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts._index.tsx deleted file mode 100644 index 1446a4fc4..000000000 --- a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts._index.tsx +++ /dev/null @@ -1,121 +0,0 @@ -import { - DateField, - DeleteButton, - EditButton, - List, - MarkdownField, - ShowButton, - useTable, -} from "@refinedev/antd"; -import { type BaseRecord, useMany } from "@refinedev/core"; -import { Space, Table } from "antd"; -import React from "react"; -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> -import { BLOG_POSTS_QUERY } from "../queries/blog-posts"; -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - import { POSTS_LIST_QUERY } from "../queries/blog-posts"; -<%_ } _%> - -export default function BlogPostList() { - const { tableProps } = useTable({ - syncWithLocation: true, -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - meta: { - fields: BLOG_POSTS_QUERY, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-strapi-v4") { _%> - meta: { - populate: ['category'], - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - meta: { - gqlQuery: POSTS_LIST_QUERY, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-supabase") { _%> - meta: { - select: '*, categories(id,title)', - }, -<%_ } _%> - }); - -<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%> - const { data: categoryData, isLoading: categoryIsLoading } = useMany({ - resource: "categories", - ids: tableProps?.dataSource?.map((item) => item?.<%- blogPostCategoryFieldName %>?.id).filter(Boolean) ?? [], - queryOptions: { - enabled: !!tableProps?.dataSource, - }, - }); -<%_ } _%> - - return ( - - - - - { - if (!value) return '-' - return - }} - /> - } - title={"Category"} - <%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%> - render={(value) => - categoryIsLoading ? ( - <>Loading... - ) : ( - categoryData?.data?.find( - (item) => item.id === value?.id, - )?.title - ) - } - <%_ } _%> - /> - - - dataIndex={["created_at"]} -<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%> - dataIndex={["$createdAt"]} -<%_ } else { _%> - dataIndex={["createdAt"]} -<%_ } _%> - title={"Created at"} - render={(value: any) => } - /> - ( - - - - - - )} - /> -
-
- ); -}; diff --git a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.create.tsx b/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.create.tsx deleted file mode 100644 index 99c806f6a..000000000 --- a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.create.tsx +++ /dev/null @@ -1,94 +0,0 @@ -import { Create, useForm, useSelect } from "@refinedev/antd"; -import { Form, Input, Select } from "antd"; -import React from "react"; -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - import { BLOG_POSTS_QUERY, BLOG_POSTS_CATEGORIES_SELECT_QUERY } from "../queries/blog-posts"; -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - import { POST_CREATE_MUTATION, CATEGORIES_SELECT_QUERY } from "../queries/blog-posts"; -<%_ } _%> - -export default function BlogPostCreate() { - const { formProps, saveButtonProps } = useForm({ -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - meta: { - fields: BLOG_POSTS_QUERY, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - meta: { - gqlMutation: POST_CREATE_MUTATION, - }, -<%_ } _%> - }); - - const { selectProps: categorySelectProps } = useSelect({ - resource: "categories", -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - meta: { - fields: BLOG_POSTS_CATEGORIES_SELECT_QUERY, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - meta: { - gqlQuery: CATEGORIES_SELECT_QUERY, - }, -<%_ } _%> - }); - - return ( - -
- - - - - - - } - rules={[ - { - required: true, - }, - ]} - > - } - options={<%- blogPostStatusOptions %>} - style={{ width: 120 }} - /> - -
-
- ); -}; diff --git a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.edit.$id.tsx b/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.edit.$id.tsx deleted file mode 100644 index a2db323d1..000000000 --- a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.edit.$id.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import { Edit, useForm, useSelect } from "@refinedev/antd"; -import { Form, Input, Select } from "antd"; -import React from "react"; -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - import { BLOG_POSTS_QUERY, BLOG_POSTS_CATEGORIES_SELECT_QUERY } from "../queries/blog-posts"; -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - import { POST_EDIT_MUTATION, CATEGORIES_SELECT_QUERY } from "../queries/blog-posts"; -<%_ } _%> - -export default function BlogPostEdit() { - const { formProps, saveButtonProps, queryResult } = useForm({ -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - meta: { - fields: BLOG_POSTS_QUERY, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-strapi-v4") { _%> - meta: { - populate: ['category'], - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - meta: { - gqlMutation: POST_EDIT_MUTATION, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-supabase") { _%> - meta: { - select: '*, categories(id,title)', - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%> - queryOptions: { - select: ({ data }) => { - return { - data: { - ...data, - category: data.category.$id, - }, - }; - }, - }, -<%_ } _%> - }); - - const blogPostsData = queryResult?.data?.data; - - const { selectProps: categorySelectProps } = useSelect({ - resource: "categories", -<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%> - defaultValue: blogPostsData?.<%- blogPostCategoryFieldName %>, -<%_ } else { _%> - defaultValue: blogPostsData?.<%- blogPostCategoryFieldName %>?.id, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - meta: { - fields: BLOG_POSTS_CATEGORIES_SELECT_QUERY, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - meta: { - gqlQuery: CATEGORIES_SELECT_QUERY, - }, -<%_ } _%> - }); - - return ( - -
- - - - - - - } - rules={[ - { - required: true, - }, - ]} - > - } - options={<%- blogPostStatusOptions %>} - style={{ width: 120 }} - /> - -
-
- ); -}; diff --git a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.show.$id.tsx b/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.show.$id.tsx deleted file mode 100644 index 06bffa7d0..000000000 --- a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.show.$id.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import { - DateField, - MarkdownField, - NumberField, - Show, - TextField, -} from "@refinedev/antd"; -import { useOne, useShow } from "@refinedev/core"; -import { Typography } from "antd"; -import React from "react"; -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - import { BLOG_POSTS_QUERY } from "../queries/blog-posts"; -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - import { POST_SHOW_QUERY } from "../queries/blog-posts"; -<%_ } _%> - -const { Title } = Typography; - -export default function BlogPostShow() { - const { queryResult } = useShow({ -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - meta: { - fields: BLOG_POSTS_QUERY, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-strapi-v4") { _%> - meta: { - populate: ['category'], - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - meta: { - gqlQuery: POST_SHOW_QUERY, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-supabase") { _%> - meta: { - select: '*, categories(id,title)', - }, -<%_ } _%> - }); - const { data, isLoading } = queryResult; - - const record = data?.data; - -<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%> - const { data: categoryData, isLoading: categoryIsLoading } = useOne({ - resource: "categories", - id: record?.<%- blogPostCategoryFieldName %>?.id || "", - queryOptions: { - enabled: !!record, - }, - }); -<%_ } _%> - - return ( - - {"ID"} - - {"Title"} - - {"Content"} - - {"Category"} -<%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%> - ?.title} /> -<%_ } else { _%> - Loading... - ) : ( - <>{categoryData?.data?.title} - )} /> -<%_ } _%> - {"Status"} - - {"CreatedAt"} -<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%> - -<%_ } else if (answers["data-provider"] === "data-provider-hasura") { _%> - -<%_ } else { _%> - -<%_ } _%> - - ); -}; diff --git a/refine-remix/plugins/antd-example/app/routes/_layout.categories._index.tsx b/refine-remix/plugins/antd-example/app/routes/_layout.categories._index.tsx deleted file mode 100644 index 5308f64db..000000000 --- a/refine-remix/plugins/antd-example/app/routes/_layout.categories._index.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { - DeleteButton, - EditButton, - List, - ShowButton, - useTable, -} from "@refinedev/antd"; -import type { BaseRecord } from "@refinedev/core"; -import { Space, Table } from "antd"; -import React from "react"; -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - import { CATEGORIES_QUERY } from "../queries/categories"; -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - import { CATEGORIES_LIST_QUERY } from "../queries/categories"; -<%_ } _%> - -export default function CategoryList() { - const { tableProps } = useTable({ - syncWithLocation: true, -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - meta: { - fields: CATEGORIES_QUERY, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - meta: { - gqlQuery: CATEGORIES_LIST_QUERY, - }, -<%_ } _%> - }); - - return ( - - - - - ( - - - - - - )} - /> -
-
- ); -}; diff --git a/refine-remix/plugins/antd-example/app/routes/_layout.categories.create.tsx b/refine-remix/plugins/antd-example/app/routes/_layout.categories.create.tsx deleted file mode 100644 index 570986c01..000000000 --- a/refine-remix/plugins/antd-example/app/routes/_layout.categories.create.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { Create, useForm } from "@refinedev/antd"; -import { Form, Input } from "antd"; -import React from "react"; -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - import { CATEGORIES_QUERY } from "../queries/categories"; -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - import { CATEGORY_CREATE_MUTATION } from "../queries/categories"; -<%_ } _%> - -export default function CategoryCreate() { - const { formProps, saveButtonProps } = useForm({ -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - meta: { - fields: CATEGORIES_QUERY, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - meta: { - gqlMutation: CATEGORY_CREATE_MUTATION, - }, -<%_ } _%> - }); - - return ( - -
- - - -
-
- ); -}; diff --git a/refine-remix/plugins/antd-example/app/routes/_layout.categories.edit.$id.tsx b/refine-remix/plugins/antd-example/app/routes/_layout.categories.edit.$id.tsx deleted file mode 100644 index 05ce7b592..000000000 --- a/refine-remix/plugins/antd-example/app/routes/_layout.categories.edit.$id.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { Edit, useForm } from "@refinedev/antd"; -import { Form, Input } from "antd"; -import React from "react"; -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - import { CATEGORIES_QUERY } from "../queries/categories"; -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - import { CATEGORY_EDIT_MUTATION } from "../queries/categories"; -<%_ } _%> - -export default function CategoryEdit() { - const { formProps, saveButtonProps } = useForm({ -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - meta: { - fields: CATEGORIES_QUERY, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - meta: { - gqlMutation: CATEGORY_EDIT_MUTATION, - }, -<%_ } _%> - }); - - return ( - -
- - - -
-
- ); -}; diff --git a/refine-remix/plugins/antd-example/app/routes/_layout.categories.show.$id.tsx b/refine-remix/plugins/antd-example/app/routes/_layout.categories.show.$id.tsx deleted file mode 100644 index 7abddffda..000000000 --- a/refine-remix/plugins/antd-example/app/routes/_layout.categories.show.$id.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { NumberField, Show, TextField } from "@refinedev/antd"; -import { useShow } from "@refinedev/core"; -import { Typography } from "antd"; -import React from "react"; -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - import { CATEGORIES_QUERY } from "../queries/categories"; -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - import { CATEGORY_SHOW_QUERY } from "../queries/categories"; -<%_ } _%> - -const { Title } = Typography; - -export default function CategoryShow() { - const { queryResult } = useShow({ -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - meta: { - fields: CATEGORIES_QUERY, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - meta: { - gqlQuery: CATEGORY_SHOW_QUERY, - }, -<%_ } _%> - }); - const { data, isLoading } = queryResult; - - const record = data?.data; - - return ( - - {"ID"} - - {"Title"} - - - ); -}; diff --git a/refine-remix/plugins/antd-example/app/routes/_layout.tsx b/refine-remix/plugins/antd-example/app/routes/_layout.tsx deleted file mode 100644 index 241350a9c..000000000 --- a/refine-remix/plugins/antd-example/app/routes/_layout.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { ThemedLayoutV2, ThemedSiderV2 } from "@refinedev/antd"; -import { Outlet } from "@remix-run/react"; -import { Header } from "~/components/header"; -<%_ if (_app.isAuthProviderCheck) { _%> - import type { LoaderFunctionArgs } from "@remix-run/node"; - import { redirect } from "@remix-run/node"; - import { authProvider } from "~/authProvider"; -<%_ } _%> - -<%_ if (_app.isNextAuthCheck) { _%> - import type { LoaderFunctionArgs } from "@remix-run/node"; - import { redirect } from "@remix-run/node"; - import { authenticator } from "~/utils/auth.server"; -<%_ } _%> - -export default function BaseLayout() { - return ( -
} - Sider={(props) => } - > - - - ); -} - - -<%_ if (_app.isAuthProviderCheck) { _%> - /** - * We're checking if the current session is authenticated. - * If not, we're redirecting the user to the login page. - * This is applied for all routes that are nested under this layout (_protected). - */ - export async function loader({ request }: LoaderFunctionArgs) { - const { authenticated, redirectTo } = await authProvider.check(request); - - if (!authenticated) { - throw redirect(redirectTo ?? "/login"); - } - - return {}; - } -<%_ } _%> - -<%_ if (_app.isNextAuthCheck) { _%> -/** - * We're checking if the current session is authenticated. - * If not, we're redirecting the user to the login page. - * This is applied for all routes that are nested under this layout (_protected). - */ -export const loader = async ({ request }: LoaderFunctionArgs) => { - const session = await authenticator.isAuthenticated(request); - const pathname = new URL(request.url).pathname; - - let to = ``; - // ignore only `/` routes - if (pathname !== "/") { - to = `?to=${pathname}`; - } - - if (!session) { - return redirect(`/login${to}`); - } - - return {}; -}; -<%_ } _%> \ No newline at end of file diff --git a/refine-remix/plugins/antd/app/components/header/index.tsx b/refine-remix/plugins/antd/app/components/header/index.tsx deleted file mode 100644 index ff9d7b75d..000000000 --- a/refine-remix/plugins/antd/app/components/header/index.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { ColorModeContext } from "@contexts"; -import type { RefineThemedLayoutV2HeaderProps } from "@refinedev/antd"; -import { useGetIdentity } from "@refinedev/core"; -import { - Avatar, - Layout as AntdLayout, - Space, - Switch, - theme, - Typography, -} from "antd"; -import React, { useContext } from "react"; - -const { Text } = Typography; -const { useToken } = theme; - -type IUser = { - id: number; - name: string; - avatar: string; -}; - -export const Header: React.FC = ({ - sticky, -}) => { - const { token } = useToken(); - const { data: user } = useGetIdentity(); - const { mode, setMode } = useContext(ColorModeContext); - - const headerStyles: React.CSSProperties = { - backgroundColor: token.colorBgElevated, - display: "flex", - justifyContent: "flex-end", - alignItems: "center", - padding: "0px 24px", - height: "64px", - }; - - if (sticky) { - headerStyles.position = "sticky"; - headerStyles.top = 0; - headerStyles.zIndex = 1; - } - - return ( - - - - setMode(mode === "light" ? "dark" : "light") - } - defaultChecked={mode === "dark"} - /> - {(user?.name || user?.avatar) && ( - - {user?.name && {user.name}} - {user?.avatar && ( - - )} - - )} - - - ); -}; diff --git a/refine-remix/plugins/antd/app/contexts/index.tsx b/refine-remix/plugins/antd/app/contexts/index.tsx deleted file mode 100644 index 42a3979d9..000000000 --- a/refine-remix/plugins/antd/app/contexts/index.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import React from "react"; -import { RefineThemes } from "@refinedev/antd"; -import { ConfigProvider, theme } from "antd"; - -type ColorModeContextType = { - mode: string; - setMode: (mode: string) => void; -}; - -export const ColorModeContext = React.createContext( - {} as ColorModeContextType, -); - -export const ColorModeContextProvider: React.FC = ({ - children, -}) => { - const [mode, setMode] = React.useState("light"); - - const setColorMode = () => { - if (mode === "light") { - setMode("dark"); - } else { - setMode("light"); - } - }; - - const { darkAlgorithm, defaultAlgorithm } = theme; - - return ( - - , - algorithm: - mode === "light" ? defaultAlgorithm : darkAlgorithm, - }} - > - {children} - - - ); -}; diff --git a/refine-remix/plugins/antd/extend.js b/refine-remix/plugins/antd/extend.js deleted file mode 100644 index 36e787878..000000000 --- a/refine-remix/plugins/antd/extend.js +++ /dev/null @@ -1,22 +0,0 @@ -const base = { - _app: { - refineProps: ["notificationProvider={useNotificationProvider}"], - import: [ - `import { App as AntdApp } from "antd"`, - 'import resetStyle from "@refinedev/antd/dist/reset.css";', - ], - refineAntdImports: ["useNotificationProvider"], - styleImport: ['{ rel: "stylesheet", href: resetStyle }'], - wrapper: [ - [``, ``], - [``, ``], - ], - localImport: [`import { ColorModeContextProvider } from "@contexts";`], - }, -}; - -module.exports = { - extend() { - return base; - }, -}; diff --git a/refine-remix/plugins/antd/meta.json b/refine-remix/plugins/antd/meta.json deleted file mode 100644 index cf09020d0..000000000 --- a/refine-remix/plugins/antd/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Ant Design", - "url": "https://refine.dev/docs/ui-frameworks/antd/tutorial/" -} diff --git a/refine-remix/plugins/antd/package.json b/refine-remix/plugins/antd/package.json deleted file mode 100644 index 167139382..000000000 --- a/refine-remix/plugins/antd/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "dependencies": { - "@refinedev/antd": "^5.37.4", - "antd": "^5.0.5", - "@ant-design/icons": "^5.0.1" - } -} diff --git a/refine-remix/plugins/auth-provider-auth0/app/routes/_auth.login.tsx b/refine-remix/plugins/auth-provider-auth0/app/routes/_auth.login.tsx deleted file mode 100644 index 1fd08fb5f..000000000 --- a/refine-remix/plugins/auth-provider-auth0/app/routes/_auth.login.tsx +++ /dev/null @@ -1,128 +0,0 @@ -<%_ if (answers["ui-framework"] === "antd") { _%> -import { ThemedTitleV2 } from "@refinedev/antd"; -import { Button, Typography, Layout, Space } from "antd"; -<%_ } _%> -<%_ if (answers["ui-framework"] === 'mui') { _%> -import Box from "@mui/material/Box"; -import Button from "@mui/material/Button"; -import Container from "@mui/material/Container"; -import Typography from "@mui/material/Typography"; -import { ThemedTitleV2 } from "@refinedev/mui"; -<%_ } _%> - -export default function Login() { - <%_ if (answers["ui-framework"] === "antd") { _%> - return ( - - - - -
- - -
- - - Powered by - Auth0 - Auth0 - -
-
- ); - <%_ } _%> - - <%_ if (answers["ui-framework"] === 'mui') { _%> - return ( - - - - -
- -
- - - Powered by - Auth0 - Auth0 - -
-
- ); - <%_ } _%> - - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - return( -
-
- -
-

Powered by - Auth0 - Auth0

-
- ); - <%_ } _%> -} diff --git a/refine-remix/plugins/auth-provider-auth0/app/routes/_auth.tsx b/refine-remix/plugins/auth-provider-auth0/app/routes/_auth.tsx deleted file mode 100644 index 084ef6291..000000000 --- a/refine-remix/plugins/auth-provider-auth0/app/routes/_auth.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import { type LoaderFunctionArgs, redirect } from "@remix-run/node"; -import { authenticator } from "~/utils/auth.server"; - -export default function AuthLayout() { - // no layout is applied for the auth routes - return ; -} - -export const loader = async ({ request }: LoaderFunctionArgs) => { - const session = await authenticator.isAuthenticated(request); - - if (session) { - return redirect(`/`); - } - - return {}; -}; diff --git a/refine-remix/plugins/auth-provider-auth0/app/routes/_layout.tsx b/refine-remix/plugins/auth-provider-auth0/app/routes/_layout.tsx deleted file mode 100644 index 1dd67cf89..000000000 --- a/refine-remix/plugins/auth-provider-auth0/app/routes/_layout.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import type { LoaderFunctionArgs } from "@remix-run/node"; -import { redirect } from "@remix-run/node"; -<%_ if (answers["ui-framework"] === 'antd') { _%> -import { - ThemedLayoutV2, - ThemedSiderV2, -} from "@refinedev/antd"; - <%_ } _%> - <%_ if (answers["ui-framework"] === 'mui') { _%> -import { - ThemedLayoutV2, -} from "@refinedev/mui"; - <%_ } _%> - -import { Header } from "@components/header"; -import { authenticator } from "~/utils/auth.server"; -<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> -import { Layout } from "~/components/layout"; -<%_ } _%> - - -export default function BaseLayout() { - return ( - <> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - - - - <%_ } else { _%> -
} - <%_ if (answers["ui-framework"] === 'antd') { _%> - Sider={(props) => } - <%_ } _%> - > - - - <%_ } _%> - - ); -} - -/** - * We're checking if the current session is authenticated. - * If not, we're redirecting the user to the login page. - * This is applied for all routes that are nested under this layout (_protected). - */ -export const loader = async ({ request }: LoaderFunctionArgs) => { - const session = await authenticator.isAuthenticated(request); - const pathname = new URL(request.url).pathname; - - let to = ``; - // ignore only `/` routes - if (pathname !== "/") { - to = `?to=${pathname}`; - } - - if (!session) { - return redirect(`/login${to}`); - } - - return {}; -}; - - diff --git a/refine-remix/plugins/auth-provider-auth0/app/routes/auth.auth0._index.tsx b/refine-remix/plugins/auth-provider-auth0/app/routes/auth.auth0._index.tsx deleted file mode 100644 index d6b33a157..000000000 --- a/refine-remix/plugins/auth-provider-auth0/app/routes/auth.auth0._index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import type { LoaderFunctionArgs, ActionArgs } from "@remix-run/node"; -import { authenticator } from "~/utils/auth.server"; - -export const action = async ({ request }: ActionArgs) => { - await authenticator.authenticate("auth0", request, { - failureRedirect: "/login", - }); -}; - -export const loader = async ({ request }: LoaderFunctionArgs) => { - await authenticator.authenticate("auth0", request, { - failureRedirect: "/login", - }); -}; diff --git a/refine-remix/plugins/auth-provider-auth0/app/routes/auth.auth0.callback.tsx b/refine-remix/plugins/auth-provider-auth0/app/routes/auth.auth0.callback.tsx deleted file mode 100644 index aefd7c0a0..000000000 --- a/refine-remix/plugins/auth-provider-auth0/app/routes/auth.auth0.callback.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import type { LoaderFunctionArgs } from "@remix-run/node"; - -import { authenticator } from "~/utils/auth.server"; - -export const loader = ({ request }: LoaderFunctionArgs) => { - return authenticator.authenticate("auth0", request, { - failureRedirect: "/login", - successRedirect: "http://localhost:3000/", - }); -}; diff --git a/refine-remix/plugins/auth-provider-auth0/app/routes/auth.logout.tsx b/refine-remix/plugins/auth-provider-auth0/app/routes/auth.logout.tsx deleted file mode 100644 index f488a38a2..000000000 --- a/refine-remix/plugins/auth-provider-auth0/app/routes/auth.logout.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import type { LoaderFunctionArgs } from "@remix-run/node"; - -import { redirect } from "@remix-run/node"; - -import { destroySession, getSession } from "~/services/session.server"; - -export const loader = async ({ request }: LoaderFunctionArgs) => { - const session = await getSession(request.headers.get("Cookie")); - return redirect(`/`, { - headers: { - "Set-Cookie": await destroySession(session), - }, - }); -}; diff --git a/refine-remix/plugins/auth-provider-auth0/app/services/session.server.ts b/refine-remix/plugins/auth-provider-auth0/app/services/session.server.ts deleted file mode 100644 index f091e5733..000000000 --- a/refine-remix/plugins/auth-provider-auth0/app/services/session.server.ts +++ /dev/null @@ -1,17 +0,0 @@ -// app/services/session.server.ts -import { createCookieSessionStorage } from "@remix-run/node"; - -// export the whole sessionStorage object -export const sessionStorage = createCookieSessionStorage({ - cookie: { - name: "_session", // use any name you want here - sameSite: "lax", // this helps with CSRF - path: "/", // remember to add this so the cookie will work in all routes - httpOnly: true, // for security reasons, make this cookie http only - secrets: ["s3cr3t"], // replace this with an actual secret - secure: process.env.NODE_ENV === "production", // enable this in prod only - }, -}); - -// you can also export the methods individually for your own usage -export const { getSession, commitSession, destroySession } = sessionStorage; diff --git a/refine-remix/plugins/auth-provider-auth0/app/utils/auth.server.ts b/refine-remix/plugins/auth-provider-auth0/app/utils/auth.server.ts deleted file mode 100644 index 2540513bd..000000000 --- a/refine-remix/plugins/auth-provider-auth0/app/utils/auth.server.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Authenticator } from "remix-auth"; -import { Auth0Strategy } from "remix-auth-auth0"; - -import { sessionStorage } from "~/services/session.server"; - -// Create an instance of the authenticator, pass a generic with what your -// strategies will return and will be stored in the session -export const authenticator = new Authenticator<{}>(sessionStorage); - -const auth0Strategy = new Auth0Strategy( - { - // !!! Should be stored in .env file. - callbackURL: "http://localhost:3000/auth/auth0/callback", - clientID: "AcinJvjWp1Dr41gPcJeQ20r5vcsteks4", - clientSecret: - "y3pj2KaTiNgING-5e8_JYmX_bIQSwvkp_XgDcA75sEPSSB2zmi0n-3UoTfH0pOTP", - domain: "dev-y38p834gjptooc4g.us.auth0.com", - }, - async ({ accessToken, extraParams, profile, refreshToken }) => { - const { id, displayName, photos } = profile; - return Promise.resolve({ - id, - name: displayName, - avatar: photos?.[0]?.value, - }); - }, -); - -authenticator.use(auth0Strategy); diff --git a/refine-remix/plugins/auth-provider-auth0/extend.js b/refine-remix/plugins/auth-provider-auth0/extend.js deleted file mode 100644 index e5fd87749..000000000 --- a/refine-remix/plugins/auth-provider-auth0/extend.js +++ /dev/null @@ -1,72 +0,0 @@ -const base = { - _app: { - localImport: [ - `import type { LoaderFunctionArgs } from "@remix-run/node";`, - `import { json } from "@remix-run/node";`, - `import { authenticator } from "~/utils/auth.server";`, - ], - refineProps: ["authProvider={authProvider}"], - refineImports: [`AuthBindings`], - refineAntdImports: [], - refineMuiImports: [], - loader: [ - `export const loader = async ({ request }: LoaderFunctionArgs) => { - const profile = await authenticator.isAuthenticated(request); - const to = new URL(request.url).searchParams.get("to"); - return json({ profile, to }); - };`, - ], - inner: [ - ` - const { profile, to } = useLoaderData(); - const authProvider: AuthBindings = { - login: async ({ providerName }) => { - if (providerName) {`, - "window.location.href = `/auth/${providerName} ? to = ${to}`;", - `return { - success: true, - }; - } - - return { - success: true, - redirectTo: "/", - }; - }, - logout: async () => { - window.location.href = "/auth/logout"; - return { - success: true, - }; - }, - onError: async (error) => { - console.error(error); - return { - error, - }; - }, - check: async () => { - return { - authenticated: !!profile, - }; - }, - getPermissions: async () => { - return null; - }, - getIdentity: async () => { - if (profile) { - return profile; - } - - return null; - }, - };`, - ], - }, -}; - -module.exports = { - extend() { - return base; - }, -}; diff --git a/refine-remix/plugins/auth-provider-auth0/meta.json b/refine-remix/plugins/auth-provider-auth0/meta.json deleted file mode 100644 index 3e4d4d11f..000000000 --- a/refine-remix/plugins/auth-provider-auth0/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Custom Auth Provider", - "url": "https://refine.dev/docs/core/providers/auth-provider/" -} diff --git a/refine-remix/plugins/auth-provider-auth0/package.json b/refine-remix/plugins/auth-provider-auth0/package.json deleted file mode 100644 index f1f83e9f7..000000000 --- a/refine-remix/plugins/auth-provider-auth0/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "remix-auth": "^3.4.0", - "remix-auth-auth0": "^1.7.0" - } -} \ No newline at end of file diff --git a/refine-remix/plugins/auth-provider-custom/app/authProvider.ts b/refine-remix/plugins/auth-provider-custom/app/authProvider.ts deleted file mode 100644 index 9681b80a9..000000000 --- a/refine-remix/plugins/auth-provider-custom/app/authProvider.ts +++ /dev/null @@ -1,103 +0,0 @@ -import type { AuthProvider } from "@refinedev/core"; -import * as cookie from "cookie"; -import Cookies from "js-cookie"; - -const mockUsers = [ - { - name: "John Doe", - email: "admin@refine.dev", - roles: ["admin"], - avatar: "https://i.pravatar.cc/150?img=1", - }, - { - name: "Jane Doe", - email: "editor@refine.dev", - roles: ["editor"], - avatar: "https://i.pravatar.cc/150?img=1", - }, - { - name: "John Doe", - email: "demo@refine.dev", - roles: ["admin"], - avatar: "https://i.pravatar.cc/150?img=1", - }, -]; - -const COOKIE_NAME = "user"; - -export const authProvider: AuthProvider = { - login: async ({ email }) => { - // Suppose we actually send a request to the back end here. - const user = mockUsers.find((item) => item.email === email); - - if (user) { - Cookies.set(COOKIE_NAME, JSON.stringify(user)); - return { - success: true, - redirectTo: "/", - }; - } - - return { - success: false, - error: { - message: "Login failed", - name: "Invalid email or password", - }, - }; - }, - logout: async () => { - Cookies.remove(COOKIE_NAME); - - return { - success: true, - redirectTo: "/login", - }; - }, - onError: async (error) => { - console.error(error); - return { error }; - }, - check: async (request) => { - let user = undefined; - if (request) { - const hasCookie = request.headers.get("Cookie"); - if (hasCookie) { - const parsedCookie = cookie.parse( - request.headers.get("Cookie"), - ); - user = parsedCookie[COOKIE_NAME]; - } - } else { - const parsedCookie = Cookies.get(COOKIE_NAME); - user = parsedCookie ? JSON.parse(parsedCookie) : undefined; - } - - const { pathname } = new URL(request.url); - - if (!user) { - return { - authenticated: false, - error: { - message: "Check failed", - name: "Unauthenticated", - }, - logout: true, - redirectTo: `/login?to=${pathname}`, - }; - } - - return { - authenticated: true, - }; - }, - getPermissions: async () => null, - getIdentity: async () => { - const parsedCookie = Cookies.get(COOKIE_NAME); - if (parsedCookie) { - const user = parsedCookie ? JSON.parse(parsedCookie) : undefined; - return user; - } - return null; - }, -}; diff --git a/refine-remix/plugins/auth-provider-custom/app/routes/_auth.forgot-password.tsx b/refine-remix/plugins/auth-provider-custom/app/routes/_auth.forgot-password.tsx deleted file mode 100644 index 488681418..000000000 --- a/refine-remix/plugins/auth-provider-custom/app/routes/_auth.forgot-password.tsx +++ /dev/null @@ -1,21 +0,0 @@ -<%_ if (answers["ui-framework"] === 'antd') { _%> -import { - AuthPage, -} from "@refinedev/antd"; -<%_ } _%> -<%_ if (answers["ui-framework"] === 'mui') { _%> -import { - AuthPage, -} from "@refinedev/mui"; -<%_ } _%> -<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - import { AuthPage } from "@refinedev/core"; -<%_ } _%> - -export default function ForgotPassword() { - return ( - - ); -} diff --git a/refine-remix/plugins/auth-provider-custom/app/routes/_auth.login.tsx b/refine-remix/plugins/auth-provider-custom/app/routes/_auth.login.tsx deleted file mode 100644 index c189d77ad..000000000 --- a/refine-remix/plugins/auth-provider-custom/app/routes/_auth.login.tsx +++ /dev/null @@ -1,22 +0,0 @@ -<%_ if (answers["ui-framework"] === 'antd') { _%> -import { - AuthPage, -} from "@refinedev/antd"; -<%_ } _%> -<%_ if (answers["ui-framework"] === 'mui') { _%> -import { - AuthPage, -} from "@refinedev/mui"; -<%_ } _%> -<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - import { AuthPage } from "@refinedev/core"; -<%_ } _%> - -export default function Login() { - return ( - - /> - ); -} diff --git a/refine-remix/plugins/auth-provider-custom/app/routes/_auth.register.tsx b/refine-remix/plugins/auth-provider-custom/app/routes/_auth.register.tsx deleted file mode 100644 index 05b1325fb..000000000 --- a/refine-remix/plugins/auth-provider-custom/app/routes/_auth.register.tsx +++ /dev/null @@ -1,21 +0,0 @@ -<%_ if (answers["ui-framework"] === 'antd') { _%> -import { - AuthPage, -} from "@refinedev/antd"; -<%_ } _%> -<%_ if (answers["ui-framework"] === 'mui') { _%> -import { - AuthPage, -} from "@refinedev/mui"; -<%_ } _%> -<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - import { AuthPage } from "@refinedev/core"; -<%_ } _%> - -export default function Register() { - return ( - - ); -} diff --git a/refine-remix/plugins/auth-provider-custom/app/routes/_auth.tsx b/refine-remix/plugins/auth-provider-custom/app/routes/_auth.tsx deleted file mode 100644 index b02d21f92..000000000 --- a/refine-remix/plugins/auth-provider-custom/app/routes/_auth.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import { redirect } from "@remix-run/node"; -import type { LoaderFunctionArgs } from "@remix-run/node"; - -import { authProvider } from "~/authProvider"; - -export default function AuthLayout() { - // no layout is applied for the auth routes - return ; -} - -/** - * If the current session is authenticated, we're redirecting the user to the home page. - * Alternatively, we could also use the `Authenticated` component inside the `AuthLayout` to handle the redirect. - * But, server-side redirects are more performant. - */ -export async function loader({ request }: LoaderFunctionArgs) { - const { authenticated, redirectTo } = await authProvider.check(request); - - if (authenticated) { - throw redirect(redirectTo ?? "/"); - } - - return {}; -} diff --git a/refine-remix/plugins/auth-provider-custom/app/routes/_layout.tsx b/refine-remix/plugins/auth-provider-custom/app/routes/_layout.tsx deleted file mode 100644 index b94cb4fe0..000000000 --- a/refine-remix/plugins/auth-provider-custom/app/routes/_layout.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import type { LoaderFunctionArgs } from "@remix-run/node"; -import { redirect } from "@remix-run/node"; -<%_ if (answers["ui-framework"] === 'antd') { _%> -import { - ThemedLayoutV2, - ThemedSiderV2, -} from "@refinedev/antd"; - <%_ } _%> - <%_ if (answers["ui-framework"] === 'mui') { _%> -import { - ThemedLayoutV2, -} from "@refinedev/mui"; - <%_ } _%> - -import { Header } from "@components/header"; -import { authProvider } from "~/authProvider"; -<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> -import { Layout } from "~/components/layout"; -<%_ } _%> - -export default function BaseLayout() { - return ( - <> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - - - - <%_ } else { _%> -
} - <%_ if (answers["ui-framework"] === 'antd') { _%> - Sider={(props) => } - <%_ } _%> - > - - - <%_ } _%> - - ); -} - -/** - * We're checking if the current session is authenticated. - * If not, we're redirecting the user to the login page. - * This is applied for all routes that are nested under this layout (_protected). - */ -export async function loader({ request }: LoaderFunctionArgs) { - const { authenticated, redirectTo } = await authProvider.check(request); - - if (!authenticated) { - throw redirect(redirectTo ?? "/login"); - } - - return {}; -} \ No newline at end of file diff --git a/refine-remix/plugins/auth-provider-custom/extend.js b/refine-remix/plugins/auth-provider-custom/extend.js deleted file mode 100644 index ecb37cfee..000000000 --- a/refine-remix/plugins/auth-provider-custom/extend.js +++ /dev/null @@ -1,14 +0,0 @@ -const base = { - _app: { - localImport: ['import { authProvider } from "~/authProvider";'], - refineProps: ["authProvider={authProvider}"], - refineAntdImports: [], - refineMuiImports: [], - }, -}; - -module.exports = { - extend() { - return base; - }, -}; diff --git a/refine-remix/plugins/auth-provider-custom/meta.json b/refine-remix/plugins/auth-provider-custom/meta.json deleted file mode 100644 index 3e4d4d11f..000000000 --- a/refine-remix/plugins/auth-provider-custom/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Custom Auth Provider", - "url": "https://refine.dev/docs/core/providers/auth-provider/" -} diff --git a/refine-remix/plugins/auth-provider-custom/package.json b/refine-remix/plugins/auth-provider-custom/package.json deleted file mode 100644 index 2168150f9..000000000 --- a/refine-remix/plugins/auth-provider-custom/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "dependencies": { - "cookie": "^0.5.0", - "js-cookie": "^3.0.1" - }, - "devDependencies": { - "@types/js-cookie": "^3.0.2" - } -} \ No newline at end of file diff --git a/refine-remix/plugins/auth-provider-google/app/routes/_auth.login.tsx b/refine-remix/plugins/auth-provider-google/app/routes/_auth.login.tsx deleted file mode 100644 index 0194ba4d4..000000000 --- a/refine-remix/plugins/auth-provider-google/app/routes/_auth.login.tsx +++ /dev/null @@ -1,128 +0,0 @@ -<%_ if (answers["ui-framework"] === "antd") { _%> -import { ThemedTitleV2 } from "@refinedev/antd"; -import { Button, Typography, Layout, Space } from "antd"; -<%_ } _%> -<%_ if (answers["ui-framework"] === 'mui') { _%> -import Box from "@mui/material/Box"; -import Button from "@mui/material/Button"; -import Container from "@mui/material/Container"; -import Typography from "@mui/material/Typography"; -import { ThemedTitleV2 } from "@refinedev/mui"; -<%_ } _%> -export default function Login() { - <%_ if (answers["ui-framework"] === "antd") { _%> - return ( - - - - -
- - -
- - - Powered by - Google - Google - -
-
- ); - <%_ } _%> - - <%_ if (answers["ui-framework"] === 'mui') { _%> - return ( - - - - -
- -
- - - Powered by - Google - Google - -
-
- ); - <%_ } _%> - - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - return( -
-
- -
-

- Powered by - Google - Google -

-
- ); - <%_ } _%> -} diff --git a/refine-remix/plugins/auth-provider-google/app/routes/_auth.tsx b/refine-remix/plugins/auth-provider-google/app/routes/_auth.tsx deleted file mode 100644 index 084ef6291..000000000 --- a/refine-remix/plugins/auth-provider-google/app/routes/_auth.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import { type LoaderFunctionArgs, redirect } from "@remix-run/node"; -import { authenticator } from "~/utils/auth.server"; - -export default function AuthLayout() { - // no layout is applied for the auth routes - return ; -} - -export const loader = async ({ request }: LoaderFunctionArgs) => { - const session = await authenticator.isAuthenticated(request); - - if (session) { - return redirect(`/`); - } - - return {}; -}; diff --git a/refine-remix/plugins/auth-provider-google/app/routes/_layout.tsx b/refine-remix/plugins/auth-provider-google/app/routes/_layout.tsx deleted file mode 100644 index 959b43485..000000000 --- a/refine-remix/plugins/auth-provider-google/app/routes/_layout.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import type { LoaderFunctionArgs } from "@remix-run/node"; -import { redirect } from "@remix-run/node"; -<%_ if (answers["ui-framework"] === 'antd') { _%> -import { - ThemedLayoutV2, - ThemedSiderV2, -} from "@refinedev/antd"; -<%_ } _%> -<%_ if (answers["ui-framework"] === 'mui') { _%> -import { - ThemedLayoutV2, -} from "@refinedev/mui"; -<%_ } _%> - -import { Header } from "@components/header"; -import { authenticator } from "~/utils/auth.server"; -<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> -import { Layout } from "~/components/layout"; -<%_ } _%> - -export default function BaseLayout() { - return ( - <> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - - - - <%_ } else { _%> -
} - <%_ if (answers["ui-framework"] === 'antd') { _%> - Sider={(props) => } - <%_ } _%> - > - - - <%_ } _%> - - ); -} - -/** - * We're checking if the current session is authenticated. - * If not, we're redirecting the user to the login page. - * This is applied for all routes that are nested under this layout (_protected). - */ -export const loader = async ({ request }: LoaderFunctionArgs) => { - const session = await authenticator.isAuthenticated(request); - const pathname = new URL(request.url).pathname; - - let to = ``; - // ignore only `/` routes - if (pathname !== "/") { - to = `?to=${pathname}`; - } - - if (!session) { - return redirect(`/login${to}`); - } - - return {}; -}; diff --git a/refine-remix/plugins/auth-provider-google/app/routes/auth.google._index.tsx b/refine-remix/plugins/auth-provider-google/app/routes/auth.google._index.tsx deleted file mode 100644 index 283f38287..000000000 --- a/refine-remix/plugins/auth-provider-google/app/routes/auth.google._index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import type { LoaderFunctionArgs, ActionArgs } from "@remix-run/node"; -import { authenticator } from "~/utils/auth.server"; - -export const action = async ({ request }: ActionArgs) => { - await authenticator.authenticate("google", request, { - failureRedirect: "/login", - }); -}; - -export const loader = async ({ request }: LoaderFunctionArgs) => { - await authenticator.authenticate("google", request, { - failureRedirect: "/login", - }); -}; diff --git a/refine-remix/plugins/auth-provider-google/app/routes/auth.google.callback.tsx b/refine-remix/plugins/auth-provider-google/app/routes/auth.google.callback.tsx deleted file mode 100644 index 29466a971..000000000 --- a/refine-remix/plugins/auth-provider-google/app/routes/auth.google.callback.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import type { LoaderFunctionArgs } from "@remix-run/node"; - -import { authenticator } from "~/utils/auth.server"; - -export const loader = ({ request }: LoaderFunctionArgs) => { - return authenticator.authenticate("google", request, { - failureRedirect: "/login", - successRedirect: "http://localhost:3000/", - }); -}; diff --git a/refine-remix/plugins/auth-provider-google/app/routes/auth.logout.tsx b/refine-remix/plugins/auth-provider-google/app/routes/auth.logout.tsx deleted file mode 100644 index f488a38a2..000000000 --- a/refine-remix/plugins/auth-provider-google/app/routes/auth.logout.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import type { LoaderFunctionArgs } from "@remix-run/node"; - -import { redirect } from "@remix-run/node"; - -import { destroySession, getSession } from "~/services/session.server"; - -export const loader = async ({ request }: LoaderFunctionArgs) => { - const session = await getSession(request.headers.get("Cookie")); - return redirect(`/`, { - headers: { - "Set-Cookie": await destroySession(session), - }, - }); -}; diff --git a/refine-remix/plugins/auth-provider-google/app/services/session.server.ts b/refine-remix/plugins/auth-provider-google/app/services/session.server.ts deleted file mode 100644 index f091e5733..000000000 --- a/refine-remix/plugins/auth-provider-google/app/services/session.server.ts +++ /dev/null @@ -1,17 +0,0 @@ -// app/services/session.server.ts -import { createCookieSessionStorage } from "@remix-run/node"; - -// export the whole sessionStorage object -export const sessionStorage = createCookieSessionStorage({ - cookie: { - name: "_session", // use any name you want here - sameSite: "lax", // this helps with CSRF - path: "/", // remember to add this so the cookie will work in all routes - httpOnly: true, // for security reasons, make this cookie http only - secrets: ["s3cr3t"], // replace this with an actual secret - secure: process.env.NODE_ENV === "production", // enable this in prod only - }, -}); - -// you can also export the methods individually for your own usage -export const { getSession, commitSession, destroySession } = sessionStorage; diff --git a/refine-remix/plugins/auth-provider-google/app/utils/auth.server.ts b/refine-remix/plugins/auth-provider-google/app/utils/auth.server.ts deleted file mode 100644 index e00ace167..000000000 --- a/refine-remix/plugins/auth-provider-google/app/utils/auth.server.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Authenticator } from "remix-auth"; -import { GoogleStrategy } from "remix-auth-google"; - -import { sessionStorage } from "~/services/session.server"; - -// Create an instance of the authenticator, pass a generic with what your -// strategies will return and will be stored in the session -export const authenticator = new Authenticator<{}>(sessionStorage); - -const googleStrategy = new GoogleStrategy( - { - // !!! Should be stored in .env file. - callbackURL: "http://localhost:3000/auth/google/callback", - clientID: `1041339102270-e1fpe2b6v6u1didfndh7jkjmpcashs4f.apps.googleusercontent.com`, - clientSecret: `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`, - }, - async ({ accessToken, extraParams, profile, refreshToken, context }) => { - const { id, displayName, photos } = profile; - return Promise.resolve({ - id, - name: displayName, - avatar: photos?.[0]?.value, - }); - }, -); - -authenticator.use(googleStrategy); diff --git a/refine-remix/plugins/auth-provider-google/extend.js b/refine-remix/plugins/auth-provider-google/extend.js deleted file mode 100644 index e5fd87749..000000000 --- a/refine-remix/plugins/auth-provider-google/extend.js +++ /dev/null @@ -1,72 +0,0 @@ -const base = { - _app: { - localImport: [ - `import type { LoaderFunctionArgs } from "@remix-run/node";`, - `import { json } from "@remix-run/node";`, - `import { authenticator } from "~/utils/auth.server";`, - ], - refineProps: ["authProvider={authProvider}"], - refineImports: [`AuthBindings`], - refineAntdImports: [], - refineMuiImports: [], - loader: [ - `export const loader = async ({ request }: LoaderFunctionArgs) => { - const profile = await authenticator.isAuthenticated(request); - const to = new URL(request.url).searchParams.get("to"); - return json({ profile, to }); - };`, - ], - inner: [ - ` - const { profile, to } = useLoaderData(); - const authProvider: AuthBindings = { - login: async ({ providerName }) => { - if (providerName) {`, - "window.location.href = `/auth/${providerName} ? to = ${to}`;", - `return { - success: true, - }; - } - - return { - success: true, - redirectTo: "/", - }; - }, - logout: async () => { - window.location.href = "/auth/logout"; - return { - success: true, - }; - }, - onError: async (error) => { - console.error(error); - return { - error, - }; - }, - check: async () => { - return { - authenticated: !!profile, - }; - }, - getPermissions: async () => { - return null; - }, - getIdentity: async () => { - if (profile) { - return profile; - } - - return null; - }, - };`, - ], - }, -}; - -module.exports = { - extend() { - return base; - }, -}; diff --git a/refine-remix/plugins/auth-provider-google/meta.json b/refine-remix/plugins/auth-provider-google/meta.json deleted file mode 100644 index 3e4d4d11f..000000000 --- a/refine-remix/plugins/auth-provider-google/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Custom Auth Provider", - "url": "https://refine.dev/docs/core/providers/auth-provider/" -} diff --git a/refine-remix/plugins/auth-provider-google/package.json b/refine-remix/plugins/auth-provider-google/package.json deleted file mode 100644 index b3ad32d90..000000000 --- a/refine-remix/plugins/auth-provider-google/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "remix-auth": "^3.4.0", - "remix-auth-google": "^1.2.0" - } -} \ No newline at end of file diff --git a/refine-remix/plugins/auth-provider-keycloak/app/routes/_auth.login.tsx b/refine-remix/plugins/auth-provider-keycloak/app/routes/_auth.login.tsx deleted file mode 100644 index 3667fe8d9..000000000 --- a/refine-remix/plugins/auth-provider-keycloak/app/routes/_auth.login.tsx +++ /dev/null @@ -1,130 +0,0 @@ -<%_ if (answers["ui-framework"] === "antd") { _%> -import { ThemedTitleV2 } from "@refinedev/antd"; -import { Button, Typography, Layout, Space } from "antd"; -<%_ } _%> -<%_ if (answers["ui-framework"] === 'mui') { _%> -import Box from "@mui/material/Box"; -import Button from "@mui/material/Button"; -import Container from "@mui/material/Container"; -import Typography from "@mui/material/Typography"; -import { ThemedTitleV2 } from "@refinedev/mui"; -<%_ } _%> - -export default function Login() { - <%_ if (answers["ui-framework"] === "antd") { _%> - return ( - - - - -
- - -
- - - Powered by - Keycloak - Keycloak - -
-
- ); - <%_ } _%> - - <%_ if (answers["ui-framework"] === 'mui') { _%> - return ( - - - - -
- -
- - - Powered by - Keycloak - Keycloak - -
-
- ); - <%_ } _%> - - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - return( -
-
- -
-

- Powered by - Keycloak - Keycloak -

-
- ); - <%_ } _%> -} diff --git a/refine-remix/plugins/auth-provider-keycloak/app/routes/_auth.tsx b/refine-remix/plugins/auth-provider-keycloak/app/routes/_auth.tsx deleted file mode 100644 index 084ef6291..000000000 --- a/refine-remix/plugins/auth-provider-keycloak/app/routes/_auth.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import { type LoaderFunctionArgs, redirect } from "@remix-run/node"; -import { authenticator } from "~/utils/auth.server"; - -export default function AuthLayout() { - // no layout is applied for the auth routes - return ; -} - -export const loader = async ({ request }: LoaderFunctionArgs) => { - const session = await authenticator.isAuthenticated(request); - - if (session) { - return redirect(`/`); - } - - return {}; -}; diff --git a/refine-remix/plugins/auth-provider-keycloak/app/routes/_layout.tsx b/refine-remix/plugins/auth-provider-keycloak/app/routes/_layout.tsx deleted file mode 100644 index 959b43485..000000000 --- a/refine-remix/plugins/auth-provider-keycloak/app/routes/_layout.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import type { LoaderFunctionArgs } from "@remix-run/node"; -import { redirect } from "@remix-run/node"; -<%_ if (answers["ui-framework"] === 'antd') { _%> -import { - ThemedLayoutV2, - ThemedSiderV2, -} from "@refinedev/antd"; -<%_ } _%> -<%_ if (answers["ui-framework"] === 'mui') { _%> -import { - ThemedLayoutV2, -} from "@refinedev/mui"; -<%_ } _%> - -import { Header } from "@components/header"; -import { authenticator } from "~/utils/auth.server"; -<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> -import { Layout } from "~/components/layout"; -<%_ } _%> - -export default function BaseLayout() { - return ( - <> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - - - - <%_ } else { _%> -
} - <%_ if (answers["ui-framework"] === 'antd') { _%> - Sider={(props) => } - <%_ } _%> - > - - - <%_ } _%> - - ); -} - -/** - * We're checking if the current session is authenticated. - * If not, we're redirecting the user to the login page. - * This is applied for all routes that are nested under this layout (_protected). - */ -export const loader = async ({ request }: LoaderFunctionArgs) => { - const session = await authenticator.isAuthenticated(request); - const pathname = new URL(request.url).pathname; - - let to = ``; - // ignore only `/` routes - if (pathname !== "/") { - to = `?to=${pathname}`; - } - - if (!session) { - return redirect(`/login${to}`); - } - - return {}; -}; diff --git a/refine-remix/plugins/auth-provider-keycloak/app/routes/auth.keycloak._index.tsx b/refine-remix/plugins/auth-provider-keycloak/app/routes/auth.keycloak._index.tsx deleted file mode 100644 index 099c1b203..000000000 --- a/refine-remix/plugins/auth-provider-keycloak/app/routes/auth.keycloak._index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import type { LoaderFunctionArgs, ActionArgs } from "@remix-run/node"; -import { authenticator } from "~/utils/auth.server"; - -export const action = async ({ request }: ActionArgs) => { - await authenticator.authenticate("keycloak", request, { - failureRedirect: "/login", - }); -}; - -export const loader = async ({ request }: LoaderFunctionArgs) => { - await authenticator.authenticate("keycloak", request, { - failureRedirect: "/login", - }); -}; diff --git a/refine-remix/plugins/auth-provider-keycloak/app/routes/auth.keycloak.callback.tsx b/refine-remix/plugins/auth-provider-keycloak/app/routes/auth.keycloak.callback.tsx deleted file mode 100644 index 3d8872102..000000000 --- a/refine-remix/plugins/auth-provider-keycloak/app/routes/auth.keycloak.callback.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import type { LoaderFunctionArgs } from "@remix-run/node"; - -import { authenticator } from "~/utils/auth.server"; - -export const loader = ({ request }: LoaderFunctionArgs) => { - return authenticator.authenticate("keycloak", request, { - failureRedirect: "/login", - successRedirect: "http://localhost:3000/", - }); -}; diff --git a/refine-remix/plugins/auth-provider-keycloak/app/routes/auth.logout.tsx b/refine-remix/plugins/auth-provider-keycloak/app/routes/auth.logout.tsx deleted file mode 100644 index f488a38a2..000000000 --- a/refine-remix/plugins/auth-provider-keycloak/app/routes/auth.logout.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import type { LoaderFunctionArgs } from "@remix-run/node"; - -import { redirect } from "@remix-run/node"; - -import { destroySession, getSession } from "~/services/session.server"; - -export const loader = async ({ request }: LoaderFunctionArgs) => { - const session = await getSession(request.headers.get("Cookie")); - return redirect(`/`, { - headers: { - "Set-Cookie": await destroySession(session), - }, - }); -}; diff --git a/refine-remix/plugins/auth-provider-keycloak/app/services/session.server.ts b/refine-remix/plugins/auth-provider-keycloak/app/services/session.server.ts deleted file mode 100644 index f091e5733..000000000 --- a/refine-remix/plugins/auth-provider-keycloak/app/services/session.server.ts +++ /dev/null @@ -1,17 +0,0 @@ -// app/services/session.server.ts -import { createCookieSessionStorage } from "@remix-run/node"; - -// export the whole sessionStorage object -export const sessionStorage = createCookieSessionStorage({ - cookie: { - name: "_session", // use any name you want here - sameSite: "lax", // this helps with CSRF - path: "/", // remember to add this so the cookie will work in all routes - httpOnly: true, // for security reasons, make this cookie http only - secrets: ["s3cr3t"], // replace this with an actual secret - secure: process.env.NODE_ENV === "production", // enable this in prod only - }, -}); - -// you can also export the methods individually for your own usage -export const { getSession, commitSession, destroySession } = sessionStorage; diff --git a/refine-remix/plugins/auth-provider-keycloak/app/utils/auth.server.ts b/refine-remix/plugins/auth-provider-keycloak/app/utils/auth.server.ts deleted file mode 100644 index ab545caa6..000000000 --- a/refine-remix/plugins/auth-provider-keycloak/app/utils/auth.server.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Authenticator } from "remix-auth"; -import { KeycloakStrategy } from "remix-auth-keycloak"; - -import { sessionStorage } from "~/services/session.server"; - -// Create an instance of the authenticator, pass a generic with what your -// strategies will return and will be stored in the session -export const authenticator = new Authenticator<{}>(sessionStorage); - -const keycloakStrategy = new KeycloakStrategy( - { - // !!! Should be stored in .env file. - useSSL: true, - domain: "lemur-0.cloud-iam.com/auth", - realm: "refine", - clientID: "refine-demo", - clientSecret: "refine", - callbackURL: "http://localhost:3000/auth/keycloak/callback", - }, - async ({ accessToken, extraParams, profile, refreshToken, context }) => { - const { id, displayName, photos } = profile; - return Promise.resolve({ - id, - name: displayName, - avatar: `https://faces-img.xcdn.link/thumb-lorem-face-6312_thumb.jpg`, - }); - }, -); - -authenticator.use(keycloakStrategy); diff --git a/refine-remix/plugins/auth-provider-keycloak/extend.js b/refine-remix/plugins/auth-provider-keycloak/extend.js deleted file mode 100644 index e5fd87749..000000000 --- a/refine-remix/plugins/auth-provider-keycloak/extend.js +++ /dev/null @@ -1,72 +0,0 @@ -const base = { - _app: { - localImport: [ - `import type { LoaderFunctionArgs } from "@remix-run/node";`, - `import { json } from "@remix-run/node";`, - `import { authenticator } from "~/utils/auth.server";`, - ], - refineProps: ["authProvider={authProvider}"], - refineImports: [`AuthBindings`], - refineAntdImports: [], - refineMuiImports: [], - loader: [ - `export const loader = async ({ request }: LoaderFunctionArgs) => { - const profile = await authenticator.isAuthenticated(request); - const to = new URL(request.url).searchParams.get("to"); - return json({ profile, to }); - };`, - ], - inner: [ - ` - const { profile, to } = useLoaderData(); - const authProvider: AuthBindings = { - login: async ({ providerName }) => { - if (providerName) {`, - "window.location.href = `/auth/${providerName} ? to = ${to}`;", - `return { - success: true, - }; - } - - return { - success: true, - redirectTo: "/", - }; - }, - logout: async () => { - window.location.href = "/auth/logout"; - return { - success: true, - }; - }, - onError: async (error) => { - console.error(error); - return { - error, - }; - }, - check: async () => { - return { - authenticated: !!profile, - }; - }, - getPermissions: async () => { - return null; - }, - getIdentity: async () => { - if (profile) { - return profile; - } - - return null; - }, - };`, - ], - }, -}; - -module.exports = { - extend() { - return base; - }, -}; diff --git a/refine-remix/plugins/auth-provider-keycloak/meta.json b/refine-remix/plugins/auth-provider-keycloak/meta.json deleted file mode 100644 index 3e4d4d11f..000000000 --- a/refine-remix/plugins/auth-provider-keycloak/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Custom Auth Provider", - "url": "https://refine.dev/docs/core/providers/auth-provider/" -} diff --git a/refine-remix/plugins/auth-provider-keycloak/package.json b/refine-remix/plugins/auth-provider-keycloak/package.json deleted file mode 100644 index 59dbba840..000000000 --- a/refine-remix/plugins/auth-provider-keycloak/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "remix-auth": "^3.4.0", - "remix-auth-keycloak": "^1.2.0" - } -} \ No newline at end of file diff --git a/refine-remix/plugins/data-provider-airtable/extend.js b/refine-remix/plugins/data-provider-airtable/extend.js deleted file mode 100644 index 51f4f25c8..000000000 --- a/refine-remix/plugins/data-provider-airtable/extend.js +++ /dev/null @@ -1,16 +0,0 @@ -const base = { - _app: { - import: [`import dataProvider from "@refinedev/airtable";`], - afterImport: [ - `const API_TOKEN = "patI3quNRP17TNsjK.d59600d5955939ed02110fb1107036ff4482496004f020f5bf031f55789cd321";`, - `const BASE_ID = "appKYl1H4k9g73sBT";`, - "", - ], - refineProps: ["dataProvider={dataProvider(API_TOKEN, BASE_ID)}"], - }, -}; -module.exports = { - extend() { - return base; - }, -}; diff --git a/refine-remix/plugins/data-provider-airtable/meta.json b/refine-remix/plugins/data-provider-airtable/meta.json deleted file mode 100644 index 4d265d44b..000000000 --- a/refine-remix/plugins/data-provider-airtable/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Airtable Data Provider", - "url": "https://refine.dev/docs/core/providers/auth-provider/" -} diff --git a/refine-remix/plugins/data-provider-airtable/package.json b/refine-remix/plugins/data-provider-airtable/package.json deleted file mode 100644 index 8eec56d7a..000000000 --- a/refine-remix/plugins/data-provider-airtable/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "@refinedev/airtable": "^4.4.6" - } -} \ No newline at end of file diff --git a/refine-remix/plugins/data-provider-appwrite/app/authProvider.ts b/refine-remix/plugins/data-provider-appwrite/app/authProvider.ts deleted file mode 100644 index e674c7e32..000000000 --- a/refine-remix/plugins/data-provider-appwrite/app/authProvider.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { AppwriteException } from "@refinedev/appwrite"; -import type { AuthProvider } from "@refinedev/core"; -import * as cookie from "cookie"; -import Cookies from "js-cookie"; -import { v4 as uuidv4 } from "uuid"; -import { account, appwriteClient, TOKEN_KEY } from "./utility"; - -export const authProvider: AuthProvider = { - login: async ({ email, password }) => { - try { - await account.createEmailSession(email, password); - - const { jwt } = await account.createJWT(); - - if (jwt) { - Cookies.set(TOKEN_KEY, jwt); - } - - return { - success: true, - redirectTo: "/", - }; - } catch (error) { - const { type, message, code } = error as AppwriteException; - return { - success: false, - error: { - message, - name: `${code} - ${type}`, - }, - }; - } - }, - logout: async () => { - try { - await account.deleteSession("current"); - } catch (error: any) { - return { - success: false, - error, - }; - } - Cookies.remove(TOKEN_KEY); - appwriteClient.setJWT(""); - - return { - success: true, - redirectTo: "/login", - }; - }, - register: async ({ email, password }) => { - try { - await account.create(uuidv4(), email, password); - return { - success: true, - redirectTo: "/login", - }; - } catch (error) { - const { type, message, code } = error as AppwriteException; - return { - success: false, - error: { - message, - name: `${code} - ${type}`, - }, - }; - } - }, - onError: async (error) => { - console.error(error); - return { error }; - }, - check: async (request) => { - // for server side authentication - let token = undefined; - const hasCookie = request.headers.get("Cookie"); - if (hasCookie) { - const parsedCookie = cookie.parse(request.headers.get("Cookie")); - token = parsedCookie[TOKEN_KEY]; - } else { - const parsedCookie = Cookies.get(TOKEN_KEY); - token = parsedCookie ? JSON.parse(parsedCookie) : undefined; - } - - if (token) { - appwriteClient.setJWT(token); - } - - const { pathname } = new URL(request.url); - const query = - pathname === "/" ? "" : `?to=${encodeURIComponent(pathname)}`; - - try { - const session = await account.get(); - - if (session) { - return { - authenticated: true, - }; - } - } catch (error: any) { - return { - authenticated: false, - error: error, - logout: true, - redirectTo: `/login${query}`, - }; - } - - return { - authenticated: false, - error: { - message: "Check failed", - name: "Unauthenticated", - }, - logout: true, - redirectTo: `/login${query}`, - }; - }, - getPermissions: async () => null, - getIdentity: async () => { - const user = await account.get(); - - if (user) { - return user; - } - - return null; - }, -}; diff --git a/refine-remix/plugins/data-provider-appwrite/app/routes/_auth.forgot-password.tsx b/refine-remix/plugins/data-provider-appwrite/app/routes/_auth.forgot-password.tsx deleted file mode 100644 index 5bba63ad7..000000000 --- a/refine-remix/plugins/data-provider-appwrite/app/routes/_auth.forgot-password.tsx +++ /dev/null @@ -1,16 +0,0 @@ -<%_ if (answers["ui-framework"] === 'antd') { _%> - import { AuthPage } from "@refinedev/antd"; - <%_ } _%> - <%_ if (answers["ui-framework"] === 'mui') { _%> - import { AuthPage } from "@refinedev/mui"; - <%_ } _%> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - import { AuthPage } from "@refinedev/core"; -<%_ } _%> - -export default function ForgotPassword() { - return ( - - ); -} diff --git a/refine-remix/plugins/data-provider-appwrite/app/routes/_auth.login.tsx b/refine-remix/plugins/data-provider-appwrite/app/routes/_auth.login.tsx deleted file mode 100644 index c3e642d5c..000000000 --- a/refine-remix/plugins/data-provider-appwrite/app/routes/_auth.login.tsx +++ /dev/null @@ -1,18 +0,0 @@ -<%_ if (answers["ui-framework"] === 'antd') { _%> - import { AuthPage } from "@refinedev/antd"; - <%_ } _%> - <%_ if (answers["ui-framework"] === 'mui') { _%> - import { AuthPage } from "@refinedev/mui"; - <%_ } _%> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - import { AuthPage } from "@refinedev/core"; -<%_ } _%> - -export default function Login() { - return ( - - /> - ); -} diff --git a/refine-remix/plugins/data-provider-appwrite/app/routes/_auth.register.tsx b/refine-remix/plugins/data-provider-appwrite/app/routes/_auth.register.tsx deleted file mode 100644 index b8d4de56b..000000000 --- a/refine-remix/plugins/data-provider-appwrite/app/routes/_auth.register.tsx +++ /dev/null @@ -1,16 +0,0 @@ -<%_ if (answers["ui-framework"] === 'antd') { _%> - import { AuthPage } from "@refinedev/antd"; - <%_ } _%> - <%_ if (answers["ui-framework"] === 'mui') { _%> - import { AuthPage } from "@refinedev/mui"; - <%_ } _%> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - import { AuthPage } from "@refinedev/core"; -<%_ } _%> - -export default function Register() { - return ( - - ); -} diff --git a/refine-remix/plugins/data-provider-appwrite/app/routes/_auth.tsx b/refine-remix/plugins/data-provider-appwrite/app/routes/_auth.tsx deleted file mode 100644 index b02d21f92..000000000 --- a/refine-remix/plugins/data-provider-appwrite/app/routes/_auth.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import { redirect } from "@remix-run/node"; -import type { LoaderFunctionArgs } from "@remix-run/node"; - -import { authProvider } from "~/authProvider"; - -export default function AuthLayout() { - // no layout is applied for the auth routes - return ; -} - -/** - * If the current session is authenticated, we're redirecting the user to the home page. - * Alternatively, we could also use the `Authenticated` component inside the `AuthLayout` to handle the redirect. - * But, server-side redirects are more performant. - */ -export async function loader({ request }: LoaderFunctionArgs) { - const { authenticated, redirectTo } = await authProvider.check(request); - - if (authenticated) { - throw redirect(redirectTo ?? "/"); - } - - return {}; -} diff --git a/refine-remix/plugins/data-provider-appwrite/app/routes/_layout.tsx b/refine-remix/plugins/data-provider-appwrite/app/routes/_layout.tsx deleted file mode 100644 index e7b3f99ae..000000000 --- a/refine-remix/plugins/data-provider-appwrite/app/routes/_layout.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import type { LoaderFunctionArgs } from "@remix-run/node"; -import { redirect } from "@remix-run/node"; -<%_ if (answers["ui-framework"] === 'antd') { _%> -import { - ThemedLayoutV2, - ThemedSiderV2, -} from "@refinedev/antd"; -<%_ } _%> -<%_ if (answers["ui-framework"] === 'mui') { _%> -import { - ThemedLayoutV2, -} from "@refinedev/mui"; -<%_ } _%> - -import { Header } from "@components/header"; -import { authProvider } from "~/authProvider"; -<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> -import { Layout } from "~/components/layout"; -<%_ } _%> - -export default function BaseLayout() { - return ( - <> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - - - - <%_ } else { _%> -
} - <%_ if (answers["ui-framework"] === 'antd') { _%> - Sider={(props) => } - <%_ } _%> - > - - - <%_ } _%> - - ); -} - -/** - * We're checking if the current session is authenticated. - * If not, we're redirecting the user to the login page. - * This is applied for all routes that are nested under this layout (_protected). - */ -export async function loader({ request }: LoaderFunctionArgs) { - const { authenticated, redirectTo } = await authProvider.check(request); - - if (!authenticated) { - throw redirect(redirectTo ?? "/login"); - } - - return {}; -} \ No newline at end of file diff --git a/refine-remix/plugins/data-provider-appwrite/app/utility/appwriteClient.ts b/refine-remix/plugins/data-provider-appwrite/app/utility/appwriteClient.ts deleted file mode 100644 index 9fb270c5a..000000000 --- a/refine-remix/plugins/data-provider-appwrite/app/utility/appwriteClient.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Account, Appwrite, Storage } from "@refinedev/appwrite"; - -const APPWRITE_URL = "https://cloud.appwrite.io/v1"; -const APPWRITE_PROJECT = "6697687d002cbd31ba6b"; -const TOKEN_KEY = "appwrite-token"; - -const appwriteClient = new Appwrite(); - -appwriteClient.setEndpoint(APPWRITE_URL).setProject(APPWRITE_PROJECT); -const account = new Account(appwriteClient); -const storage = new Storage(appwriteClient); - -export { appwriteClient, account, storage, TOKEN_KEY }; diff --git a/refine-remix/plugins/data-provider-appwrite/app/utility/index.ts b/refine-remix/plugins/data-provider-appwrite/app/utility/index.ts deleted file mode 100644 index b4f6465b1..000000000 --- a/refine-remix/plugins/data-provider-appwrite/app/utility/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./appwriteClient"; -<%_ if (answers["ui-framework"] === "antd") { _%> -export * from "./normalize"; -<%_ } _%> diff --git a/refine-remix/plugins/data-provider-appwrite/app/utility/normalize.ts b/refine-remix/plugins/data-provider-appwrite/app/utility/normalize.ts deleted file mode 100644 index 038790ea5..000000000 --- a/refine-remix/plugins/data-provider-appwrite/app/utility/normalize.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { UploadFile } from "antd"; - -interface UploadResponse { - url: string; -} -interface EventArgs { - file: UploadFile; - fileList: Array>; -} - -export const normalizeFile = (event: EventArgs) => { - const { fileList } = event; - - return fileList.map((item) => { - const { uid, name, type, size, response, percent, status } = item; - - return { - uid, - name, - url: item.url || response?.url, - type, - size, - percent, - status, - }; - }); -}; \ No newline at end of file diff --git a/refine-remix/plugins/data-provider-appwrite/extend.js b/refine-remix/plugins/data-provider-appwrite/extend.js deleted file mode 100644 index ad251e8d7..000000000 --- a/refine-remix/plugins/data-provider-appwrite/extend.js +++ /dev/null @@ -1,28 +0,0 @@ -const base = { - _app: { - import: [ - `import { dataProvider, liveProvider } from "@refinedev/appwrite";`, - ], - localImport: [ - `import { authProvider } from "~/authProvider";`, - `import { appwriteClient } from "~/utility";`, - ], - refineProps: [ - `dataProvider={dataProvider(appwriteClient, { - databaseId: "default", - })}`, - `liveProvider={liveProvider(appwriteClient, { - databaseId: "default", - })}`, - `authProvider={authProvider}`, - ], - refineOptions: [`liveMode: "auto",`], - refineAntdImports: [], - refineMuiImports: [], - }, -}; -module.exports = { - extend() { - return base; - }, -}; diff --git a/refine-remix/plugins/data-provider-appwrite/meta.json b/refine-remix/plugins/data-provider-appwrite/meta.json deleted file mode 100644 index fa561e69f..000000000 --- a/refine-remix/plugins/data-provider-appwrite/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Appwrite Data Provider", - "url": "https://refine.dev/docs/core/providers/data-provider/#overview" -} diff --git a/refine-remix/plugins/data-provider-appwrite/package.json b/refine-remix/plugins/data-provider-appwrite/package.json deleted file mode 100644 index 591aff18c..000000000 --- a/refine-remix/plugins/data-provider-appwrite/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "dependencies": { - "@refinedev/appwrite": "^6.4.6", - "cookie": "^0.5.0", - "js-cookie": "^3.0.1", - "@refinedev/kbar": "^1.3.6", - "uuid": "^9.0.0" - }, - "devDependencies": { - "@types/js-cookie": "^3.0.2", - "@types/uuid": "^9.0.2" - } -} diff --git a/refine-remix/plugins/data-provider-custom-json-rest/extend.js b/refine-remix/plugins/data-provider-custom-json-rest/extend.js deleted file mode 100644 index 02f53b8d4..000000000 --- a/refine-remix/plugins/data-provider-custom-json-rest/extend.js +++ /dev/null @@ -1,16 +0,0 @@ -const base = { - _app: { - import: [`import dataProvider from "@refinedev/simple-rest";`], - afterImport: [ - `const API_URL = "https://api.fake-rest.refine.dev";`, - "", - ], - refineProps: ["dataProvider={dataProvider(API_URL)}"], - }, -}; - -module.exports = { - extend() { - return base; - }, -}; diff --git a/refine-remix/plugins/data-provider-custom-json-rest/meta.json b/refine-remix/plugins/data-provider-custom-json-rest/meta.json deleted file mode 100644 index 29d70e045..000000000 --- a/refine-remix/plugins/data-provider-custom-json-rest/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "REST Data Provider", - "url": "https://refine.dev/docs/core/providers/data-provider/#overview" -} diff --git a/refine-remix/plugins/data-provider-custom-json-rest/package.json b/refine-remix/plugins/data-provider-custom-json-rest/package.json deleted file mode 100644 index a67b037a4..000000000 --- a/refine-remix/plugins/data-provider-custom-json-rest/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "@refinedev/simple-rest": "^5.0.1" - } -} diff --git a/refine-remix/plugins/data-provider-graphql/extend.js b/refine-remix/plugins/data-provider-graphql/extend.js deleted file mode 100644 index dc6d2fa35..000000000 --- a/refine-remix/plugins/data-provider-graphql/extend.js +++ /dev/null @@ -1,20 +0,0 @@ -const base = { - _app: { - import: [ - `import dataProvider, { GraphQLClient } from "@refinedev/graphql";`, - ], - afterImport: [ - `const API_URL = "https://your-graphql-url/graphql";`, - "", - `const client = new GraphQLClient(API_URL);`, - `const gqlDataProvider = dataProvider(client);`, - "", - ], - refineProps: ["dataProvider={gqlDataProvider}"], - }, -}; -module.exports = { - extend() { - return base; - }, -}; diff --git a/refine-remix/plugins/data-provider-graphql/meta.json b/refine-remix/plugins/data-provider-graphql/meta.json deleted file mode 100644 index adbc228e9..000000000 --- a/refine-remix/plugins/data-provider-graphql/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "GraphQL Data Provider", - "url": "https://refine.dev/docs/core/providers/data-provider/#overview" -} diff --git a/refine-remix/plugins/data-provider-graphql/package.json b/refine-remix/plugins/data-provider-graphql/package.json deleted file mode 100644 index 626c3cc35..000000000 --- a/refine-remix/plugins/data-provider-graphql/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "dependencies": { - "@refinedev/graphql": "^6.4.8", - "graphql": "^15.5.3", - "graphql-request": "^5.2.0" - } -} \ No newline at end of file diff --git a/refine-remix/plugins/data-provider-hasura/app/queries/blog-posts.ts b/refine-remix/plugins/data-provider-hasura/app/queries/blog-posts.ts deleted file mode 100644 index 76bfc8400..000000000 --- a/refine-remix/plugins/data-provider-hasura/app/queries/blog-posts.ts +++ /dev/null @@ -1,13 +0,0 @@ -export const BLOG_POSTS_QUERY = [ - "id", - "title", - "status", - "created_at", - "category_id", - "content", - { - category: ["id", "title"], - }, -]; - -export const BLOG_POSTS_CATEGORIES_SELECT_QUERY = ["id", "title"]; diff --git a/refine-remix/plugins/data-provider-hasura/app/queries/categories.ts b/refine-remix/plugins/data-provider-hasura/app/queries/categories.ts deleted file mode 100644 index 9a6a5ccd8..000000000 --- a/refine-remix/plugins/data-provider-hasura/app/queries/categories.ts +++ /dev/null @@ -1 +0,0 @@ -export const CATEGORIES_QUERY = ["id", "title"]; diff --git a/refine-remix/plugins/data-provider-hasura/extend.js b/refine-remix/plugins/data-provider-hasura/extend.js deleted file mode 100644 index 2afb9ba6c..000000000 --- a/refine-remix/plugins/data-provider-hasura/extend.js +++ /dev/null @@ -1,23 +0,0 @@ -const base = { - _app: { - import: [ - `import dataProvider, { GraphQLClient } from "@refinedev/hasura";`, - ], - afterImport: [ - "", - `const API_URL = "https://flowing-mammal-24.hasura.app/v1/graphql";`, - "", - `const client = new GraphQLClient(API_URL, { - headers: { - "x-hasura-role": "public", - }, - });`, - ], - refineProps: [`dataProvider={dataProvider(client)}`], - }, -}; -module.exports = { - extend() { - return base; - }, -}; diff --git a/refine-remix/plugins/data-provider-hasura/meta.json b/refine-remix/plugins/data-provider-hasura/meta.json deleted file mode 100644 index c101db484..000000000 --- a/refine-remix/plugins/data-provider-hasura/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Hasura Data Provider", - "url": "https://refine.dev/docs/core/providers/data-provider/#overview" -} diff --git a/refine-remix/plugins/data-provider-hasura/package.json b/refine-remix/plugins/data-provider-hasura/package.json deleted file mode 100644 index b6e7b2f09..000000000 --- a/refine-remix/plugins/data-provider-hasura/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "dependencies": { - "@refinedev/hasura": "^6.4.12", - "graphql": "^15.6.1", - "graphql-request": "^5.2.0", - "graphql-tag": "^2.12.6" - } -} diff --git a/refine-remix/plugins/data-provider-medusa/extend.js b/refine-remix/plugins/data-provider-medusa/extend.js deleted file mode 100644 index f8267892c..000000000 --- a/refine-remix/plugins/data-provider-medusa/extend.js +++ /dev/null @@ -1,23 +0,0 @@ -const base = { - _app: { - import: [ - `import dataProvider, { authProvider } from "@refinedev/medusa";`, - ], - afterImport: [ - `const API_URL = "https://your-medusa-url";`, - "", - `const medusaDataProvider = dataProvider(API_URL);`, - `const medusaAuthProvider = authProvider(API_URL);`, - "", - ], - refineProps: [ - "authProvider={medusaAuthProvider}", - "dataProvider={medusaDataProvider}", - ], - }, -}; -module.exports = { - extend() { - return base; - }, -}; diff --git a/refine-remix/plugins/data-provider-medusa/package.json b/refine-remix/plugins/data-provider-medusa/package.json deleted file mode 100644 index bfc50b17c..000000000 --- a/refine-remix/plugins/data-provider-medusa/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "@refinedev/medusa": "^3.0.1" - } -} diff --git a/refine-remix/plugins/data-provider-nestjs-query/app/queries/blog-posts.ts b/refine-remix/plugins/data-provider-nestjs-query/app/queries/blog-posts.ts deleted file mode 100644 index 3e77249eb..000000000 --- a/refine-remix/plugins/data-provider-nestjs-query/app/queries/blog-posts.ts +++ /dev/null @@ -1,85 +0,0 @@ -import gql from "graphql-tag"; - -export const POST_CREATE_MUTATION = gql` - mutation PostCreate($input: CreateOneBlogPostInput!) { - createOneBlogPost(input: $input) { - id - title - status - categoryId - category { - id - title - } - content - } - } -`; - -export const POST_EDIT_MUTATION = gql` - mutation PostEdit($input: UpdateOneBlogPostInput!) { - updateOneBlogPost(input: $input) { - id - title - status - categoryId - category { - id - title - } - content - } - } -`; - -export const POSTS_LIST_QUERY = gql` - query BlogPostsList( - $paging: OffsetPaging! - $filter: BlogPostFilter - $sorting: [BlogPostSort!]! - ) { - blogPosts(paging: $paging, filter: $filter, sorting: $sorting) { - nodes { - id - title - categoryId - category { - id - title - } - status - content - createdAt - } - totalCount - } - } -`; - -export const POST_SHOW_QUERY = gql` - query PostShow($id: ID!) { - blogPost(id: $id) { - id - title - status - categoryId - category { - id - title - } - content - createdAt - } - } -`; - -export const CATEGORIES_SELECT_QUERY = gql` - query CategoriesSelect($filter: CategoryFilter!) { - categories(filter: $filter) { - nodes { - id - title - } - } - } -`; diff --git a/refine-remix/plugins/data-provider-nestjs-query/app/queries/categories.ts b/refine-remix/plugins/data-provider-nestjs-query/app/queries/categories.ts deleted file mode 100644 index 8e4e6e0b1..000000000 --- a/refine-remix/plugins/data-provider-nestjs-query/app/queries/categories.ts +++ /dev/null @@ -1,45 +0,0 @@ -import gql from "graphql-tag"; - -export const CATEGORY_CREATE_MUTATION = gql` - mutation CategoryCreate($input: CreateOneCategoryInput!) { - createOneCategory(input: $input) { - id - title - } - } -`; - -export const CATEGORY_EDIT_MUTATION = gql` - mutation CategoryEdit($input: UpdateOneCategoryInput!) { - updateOneCategory(input: $input) { - id - title - } - } -`; - -export const CATEGORIES_LIST_QUERY = gql` - query CategoriesList( - $paging: OffsetPaging! - $filter: CategoryFilter - $sorting: [CategorySort!]! - ) { - categories(paging: $paging, filter: $filter, sorting: $sorting) { - nodes { - id - title - createdAt - } - totalCount - } - } -`; -export const CATEGORY_SHOW_QUERY = gql` - query CategoryShow($id: ID!) { - category(id: $id) { - id - title - createdAt - } - } -`; diff --git a/refine-remix/plugins/data-provider-nestjs-query/extend.js b/refine-remix/plugins/data-provider-nestjs-query/extend.js deleted file mode 100644 index 5dc3cb9c5..000000000 --- a/refine-remix/plugins/data-provider-nestjs-query/extend.js +++ /dev/null @@ -1,26 +0,0 @@ -const base = { - _app: { - import: [ - `import dataProvider, { GraphQLClient, liveProvider } from "@refinedev/nestjs-query";`, - `import { createClient } from "graphql-ws";`, - ], - afterImport: [ - "", - `const API_URL = "https://api.nestjs-query.refine.dev/graphql";`, - `const WS_URL = "wss://api.nestjs-query.refine.dev/graphql";`, - "", - `const gqlClient = new GraphQLClient(API_URL);`, - "", - ], - refineProps: [ - `dataProvider={dataProvider(gqlClient)}`, - `liveProvider={typeof window !== "undefined" ? liveProvider(createClient({ url: WS_URL })) : undefined}`, - ], - refineOptions: [`liveMode: "auto",`], - }, -}; -module.exports = { - extend() { - return base; - }, -}; diff --git a/refine-remix/plugins/data-provider-nestjs-query/meta.json b/refine-remix/plugins/data-provider-nestjs-query/meta.json deleted file mode 100644 index 22a1fda3b..000000000 --- a/refine-remix/plugins/data-provider-nestjs-query/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "NestJS Query Data Provider", - "url": "https://refine.dev/docs/core/providers/data-provider/#overview" -} diff --git a/refine-remix/plugins/data-provider-nestjs-query/package.json b/refine-remix/plugins/data-provider-nestjs-query/package.json deleted file mode 100644 index 6506d516e..000000000 --- a/refine-remix/plugins/data-provider-nestjs-query/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "scripts": { - "codegen": "graphql-codegen" - }, - "dependencies": { - "@refinedev/nestjs-query": "^1.1.1", - "graphql-tag": "^2.12.6", - "graphql-ws": "^5.9.1" - }, - "devDependencies": { - "@graphql-codegen/cli": "^5.0.0", - "@graphql-codegen/typescript": "^4.0.1", - "@graphql-codegen/typescript-operations": "^4.0.1", - "@graphql-codegen/import-types-preset": "^3.0.0" - } -} diff --git a/refine-remix/plugins/data-provider-nestjsx-crud/extend.js b/refine-remix/plugins/data-provider-nestjsx-crud/extend.js deleted file mode 100644 index 84535bb87..000000000 --- a/refine-remix/plugins/data-provider-nestjsx-crud/extend.js +++ /dev/null @@ -1,13 +0,0 @@ -const base = { - _app: { - import: ['import dataProvider from "@refinedev/nestjsx-crud";'], - afterImport: [`const API_URL = "https://api.nestjsx-crud.refine.dev";`], - refineProps: ["dataProvider={dataProvider(API_URL)}"], - }, -}; - -module.exports = { - extend() { - return base; - }, -}; diff --git a/refine-remix/plugins/data-provider-nestjsx-crud/meta.json b/refine-remix/plugins/data-provider-nestjsx-crud/meta.json deleted file mode 100644 index fe3a53616..000000000 --- a/refine-remix/plugins/data-provider-nestjsx-crud/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "NestJS Data Provider", - "url": "https://refine.dev/docs/core/providers/data-provider/#overview" -} diff --git a/refine-remix/plugins/data-provider-nestjsx-crud/package.json b/refine-remix/plugins/data-provider-nestjsx-crud/package.json deleted file mode 100644 index 6b3f6355a..000000000 --- a/refine-remix/plugins/data-provider-nestjsx-crud/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "@refinedev/nestjsx-crud": "^5.0.1" - } -} diff --git a/refine-remix/plugins/data-provider-strapi-v4/app/authProvider.ts b/refine-remix/plugins/data-provider-strapi-v4/app/authProvider.ts deleted file mode 100644 index 383d9f92a..000000000 --- a/refine-remix/plugins/data-provider-strapi-v4/app/authProvider.ts +++ /dev/null @@ -1,102 +0,0 @@ -import type { AuthProvider } from "@refinedev/core"; -import { AuthHelper } from "@refinedev/strapi-v4"; -import axios from "axios"; -import * as cookie from "cookie"; -import Cookies from "js-cookie"; -import { API_URL, TOKEN_KEY } from "~/constants"; - -export const axiosInstance = axios.create(); -const strapiAuthHelper = AuthHelper(API_URL + "/api"); - -axiosInstance.interceptors.request.use((config) => { - const token = Cookies.get(TOKEN_KEY); - if (token && config.headers) { - config.headers["Authorization"] = `Bearer ${token}`; - } - return config; -}); - -export const authProvider: AuthProvider = { - login: async ({ email, password }) => { - const { data, status } = await strapiAuthHelper.login(email, password); - if (status === 200) { - Cookies.set(TOKEN_KEY, data.jwt); - - // set header axios instance - axiosInstance.defaults.headers.common = { - Authorization: `Bearer ${data.jwt}`, - }; - - return { - success: true, - redirectTo: "/", - }; - } - return { - success: false, - }; - }, - logout: async () => { - Cookies.remove(TOKEN_KEY); - return { - success: true, - redirectTo: "/login", - }; - }, - onError: async (error) => { - console.error(error); - return { error }; - }, - check: async (request) => { - let token = undefined; - if (request) { - const hasCookie = request.headers.get("Cookie"); - if (hasCookie) { - const parsedCookie = cookie.parse( - request.headers.get("Cookie"), - ); - token = parsedCookie[TOKEN_KEY]; - } - } else { - const parsedCookie = Cookies.get(TOKEN_KEY); - token = parsedCookie ? JSON.parse(parsedCookie) : undefined; - } - - if (token) { - axiosInstance.defaults.headers.common = { - Authorization: `Bearer ${token}`, - }; - return { - authenticated: true, - }; - } - - const { pathname } = new URL(request.url); - - return { - authenticated: false, - error: { - message: "Check failed", - name: "Unauthenticated", - }, - logout: true, - redirectTo: `/login?to=${pathname}`, - }; - }, - getPermissions: async () => null, - getIdentity: async () => { - const token = Cookies.get(TOKEN_KEY); - if (!token) return null; - const { data, status } = await strapiAuthHelper.me(token); - if (status === 200) { - const { id, username, email } = data; - return { - id, - name: username, - email, - }; - } - - return null; - }, -}; diff --git a/refine-remix/plugins/data-provider-strapi-v4/app/constants.ts b/refine-remix/plugins/data-provider-strapi-v4/app/constants.ts deleted file mode 100644 index eed20ac6a..000000000 --- a/refine-remix/plugins/data-provider-strapi-v4/app/constants.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const API_URL = "https://api.strapi-v4.refine.dev"; -export const TOKEN_KEY = "strapi-jwt-token"; diff --git a/refine-remix/plugins/data-provider-strapi-v4/app/routes/_auth.forgot-password.tsx b/refine-remix/plugins/data-provider-strapi-v4/app/routes/_auth.forgot-password.tsx deleted file mode 100644 index 444b0b0ed..000000000 --- a/refine-remix/plugins/data-provider-strapi-v4/app/routes/_auth.forgot-password.tsx +++ /dev/null @@ -1,15 +0,0 @@ -<%_ if (answers["ui-framework"] === 'antd') { _%> - import { AuthPage } from "@refinedev/antd"; - <%_ } _%> - <%_ if (answers["ui-framework"] === 'mui') { _%> - import { AuthPage } from "@refinedev/mui"; - <%_ } _%> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - import { AuthPage } from "@refinedev/core"; -<%_ } _%> - -export default function ForgotPassword() { - return ( - - ); -} diff --git a/refine-remix/plugins/data-provider-strapi-v4/app/routes/_auth.login.tsx b/refine-remix/plugins/data-provider-strapi-v4/app/routes/_auth.login.tsx deleted file mode 100644 index 8676c0da5..000000000 --- a/refine-remix/plugins/data-provider-strapi-v4/app/routes/_auth.login.tsx +++ /dev/null @@ -1,18 +0,0 @@ -<%_ if (answers["ui-framework"] === 'antd') { _%> - import { AuthPage } from "@refinedev/antd"; - <%_ } _%> - <%_ if (answers["ui-framework"] === 'mui') { _%> - import { AuthPage } from "@refinedev/mui"; - <%_ } _%> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - import { AuthPage } from "@refinedev/core"; -<%_ } _%> - -export default function Login() { - return ( - - /> - ); -} diff --git a/refine-remix/plugins/data-provider-strapi-v4/app/routes/_auth.register.tsx b/refine-remix/plugins/data-provider-strapi-v4/app/routes/_auth.register.tsx deleted file mode 100644 index 9e7554799..000000000 --- a/refine-remix/plugins/data-provider-strapi-v4/app/routes/_auth.register.tsx +++ /dev/null @@ -1,15 +0,0 @@ -<%_ if (answers["ui-framework"] === 'antd') { _%> - import { AuthPage } from "@refinedev/antd"; - <%_ } _%> - <%_ if (answers["ui-framework"] === 'mui') { _%> - import { AuthPage } from "@refinedev/mui"; - <%_ } _%> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - import { AuthPage } from "@refinedev/core"; -<%_ } _%> - -export default function Register() { - return ( - - ); -} diff --git a/refine-remix/plugins/data-provider-strapi-v4/app/routes/_auth.tsx b/refine-remix/plugins/data-provider-strapi-v4/app/routes/_auth.tsx deleted file mode 100644 index b02d21f92..000000000 --- a/refine-remix/plugins/data-provider-strapi-v4/app/routes/_auth.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import { redirect } from "@remix-run/node"; -import type { LoaderFunctionArgs } from "@remix-run/node"; - -import { authProvider } from "~/authProvider"; - -export default function AuthLayout() { - // no layout is applied for the auth routes - return ; -} - -/** - * If the current session is authenticated, we're redirecting the user to the home page. - * Alternatively, we could also use the `Authenticated` component inside the `AuthLayout` to handle the redirect. - * But, server-side redirects are more performant. - */ -export async function loader({ request }: LoaderFunctionArgs) { - const { authenticated, redirectTo } = await authProvider.check(request); - - if (authenticated) { - throw redirect(redirectTo ?? "/"); - } - - return {}; -} diff --git a/refine-remix/plugins/data-provider-strapi-v4/app/routes/_layout.tsx b/refine-remix/plugins/data-provider-strapi-v4/app/routes/_layout.tsx deleted file mode 100644 index e7b3f99ae..000000000 --- a/refine-remix/plugins/data-provider-strapi-v4/app/routes/_layout.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import type { LoaderFunctionArgs } from "@remix-run/node"; -import { redirect } from "@remix-run/node"; -<%_ if (answers["ui-framework"] === 'antd') { _%> -import { - ThemedLayoutV2, - ThemedSiderV2, -} from "@refinedev/antd"; -<%_ } _%> -<%_ if (answers["ui-framework"] === 'mui') { _%> -import { - ThemedLayoutV2, -} from "@refinedev/mui"; -<%_ } _%> - -import { Header } from "@components/header"; -import { authProvider } from "~/authProvider"; -<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> -import { Layout } from "~/components/layout"; -<%_ } _%> - -export default function BaseLayout() { - return ( - <> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - - - - <%_ } else { _%> -
} - <%_ if (answers["ui-framework"] === 'antd') { _%> - Sider={(props) => } - <%_ } _%> - > - - - <%_ } _%> - - ); -} - -/** - * We're checking if the current session is authenticated. - * If not, we're redirecting the user to the login page. - * This is applied for all routes that are nested under this layout (_protected). - */ -export async function loader({ request }: LoaderFunctionArgs) { - const { authenticated, redirectTo } = await authProvider.check(request); - - if (!authenticated) { - throw redirect(redirectTo ?? "/login"); - } - - return {}; -} \ No newline at end of file diff --git a/refine-remix/plugins/data-provider-strapi-v4/app/session.server.ts b/refine-remix/plugins/data-provider-strapi-v4/app/session.server.ts deleted file mode 100644 index 6bcbb5798..000000000 --- a/refine-remix/plugins/data-provider-strapi-v4/app/session.server.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { createCookieSessionStorage, redirect } from "@remix-run/node"; -import { authProvider } from "./authProvider"; - -type LoginForm = { - username: string; - password: string; -}; - -// normally you want this to be env variable -const sessionSecret = "SUPER_SECRET_SESSION"; //process.env.SESSION_SECRET; -if (!sessionSecret) { - throw new Error("SESSION_SECRET must be set"); -} - -const storage = createCookieSessionStorage({ - cookie: { - name: "RJ_session", - // normally you want this to be `secure: true` - // but that doesn't work on localhost for Safari - // https://web.dev/when-to-use-local-https/ - secure: process.env.NODE_ENV === "production", - secrets: [sessionSecret], - sameSite: "lax", - path: "/", - maxAge: 60 * 60 * 24 * 30, - httpOnly: true, - }, -}); - -export async function login({ username, password }: LoginForm) { - try { - const user = await authProvider.login({ username, password }); - if (user) { - return { user }; - } - } catch (error) { - return error; - } -} - -export async function requireUserId( - request: Request, - redirectTo: string = new URL(request.url).pathname, -) { - try { - const user = await authProvider.checkAuth?.({ request, storage }); - return user; - } catch (error) { - const searchParams = new URLSearchParams([["to", redirectTo]]); - throw redirect(`/login?${searchParams}`); - } -} - -export async function createUserSession(user: object, redirectTo: string) { - const session = await storage.getSession(); - session.set("user", { ...user }); - return redirect(redirectTo, { - headers: { - "Set-Cookie": await storage.commitSession(session), - }, - }); -} - -export async function logout(request: Request) { - const session = await storage.getSession(request.headers.get("Cookie")); - return redirect("/login", { - headers: { - "Set-Cookie": await storage.destroySession(session), - }, - }); -} diff --git a/refine-remix/plugins/data-provider-strapi-v4/extend.js b/refine-remix/plugins/data-provider-strapi-v4/extend.js deleted file mode 100644 index 6717a7593..000000000 --- a/refine-remix/plugins/data-provider-strapi-v4/extend.js +++ /dev/null @@ -1,28 +0,0 @@ -const base = { - _app: { - import: [`import { DataProvider } from "@refinedev/strapi-v4";`], - localImport: [ - `import { authProvider, axiosInstance } from "~/authProvider";`, - `import { API_URL } from "~/constants";`, - ], - refineProps: [ - "authProvider={authProvider}", - "dataProvider={DataProvider(API_URL + `/api`, axiosInstance)}", - ], - refineAntdImports: [], - refineMuiImports: [], - }, -}; -module.exports = { - extend(answers) { - if (answers["ui-framework"] === "antd") { - base._app.refineAntdImports.push("AuthPage"); - } - - if (answers["ui-framework"] === "mui") { - base._app.refineMuiImports.push("AuthPage"); - } - - return base; - }, -}; diff --git a/refine-remix/plugins/data-provider-strapi-v4/meta.json b/refine-remix/plugins/data-provider-strapi-v4/meta.json deleted file mode 100644 index 907bb7010..000000000 --- a/refine-remix/plugins/data-provider-strapi-v4/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Strapi v4 Data Provider", - "url": "https://refine.dev/docs/core/providers/data-provider/#overview" -} diff --git a/refine-remix/plugins/data-provider-strapi-v4/package.json b/refine-remix/plugins/data-provider-strapi-v4/package.json deleted file mode 100644 index af767b401..000000000 --- a/refine-remix/plugins/data-provider-strapi-v4/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "dependencies": { - "@refinedev/strapi-v4": "^6.0.1", - "axios": "^1.6.2", - "cookie": "^0.5.0", - "js-cookie": "^3.0.1" - }, - "devDependencies": { - "@types/js-cookie": "^3.0.2" - } -} \ No newline at end of file diff --git a/refine-remix/plugins/data-provider-supabase/app/authProvider.ts b/refine-remix/plugins/data-provider-supabase/app/authProvider.ts deleted file mode 100644 index 2953fcd06..000000000 --- a/refine-remix/plugins/data-provider-supabase/app/authProvider.ts +++ /dev/null @@ -1,150 +0,0 @@ -import type { AuthBindings } from "@refinedev/core"; -import Cookies from "js-cookie"; -import * as cookie from "cookie"; - -import { supabaseClient } from "~/utility"; -import { TOKEN_KEY } from "~/constants"; - -export const authProvider: AuthBindings = { - login: async ({ email, password }) => { - const { data, error } = await supabaseClient.auth.signInWithPassword({ - email, - password, - }); - - if (error) { - return { - success: false, - error, - }; - } - - if (data?.session) { - Cookies.set(TOKEN_KEY, data.session.access_token); - return { - success: true, - redirectTo: "/", - }; - } - - // for third-party login - return { - success: true, - }; - }, - logout: async () => { - const { error } = await supabaseClient.auth.signOut(); - - if (error) { - return { - success: false, - error: { - message: error.message, - name: "LogoutError", - }, - }; - } - - Cookies.remove(TOKEN_KEY); - return { - success: true, - redirectTo: "/login", - }; - }, - register: async ({ email, password }) => { - try { - const { data, error } = await supabaseClient.auth.signUp({ - email, - password, - }); - - if (error) { - return { - success: false, - error, - }; - } - - if (data) { - return { - success: true, - redirectTo: "/", - }; - } - } catch (error: any) { - return { - success: false, - error, - }; - } - - return { - success: false, - error: { - message: "Register failed", - name: "Invalid email or password", - }, - }; - }, - onError: async (error) => { - console.error(error); - return { error }; - }, - check: async (request) => { - let token = undefined; - if (request) { - const hasCookie = request.headers.get("Cookie"); - if (hasCookie) { - const parsedCookie = cookie.parse( - request.headers.get("Cookie"), - ); - token = parsedCookie[TOKEN_KEY]; - } - } else { - const parsedCookie = Cookies.get(TOKEN_KEY); - token = parsedCookie ? JSON.parse(parsedCookie) : undefined; - } - - const { data } = await supabaseClient.auth.getUser(token); - const { user } = data; - - if (user) { - return { - authenticated: true, - }; - } - - const { pathname } = new URL(request.url); - - return { - authenticated: false, - error: { - message: "Check failed", - name: "Unauthenticated", - }, - logout: true, - redirectTo: `/login?to=${pathname}`, - }; - }, - getPermissions: async () => { - const user = await supabaseClient.auth.getUser(); - - if (user) { - return user.data.user?.role; - } - - return null; - }, - getIdentity: async () => { - const { data } = await supabaseClient.auth.getUser(); - - if (data?.user) { - return { - ...data.user, - name: data.user.email, - }; - } - - return null; - }, -}; diff --git a/refine-remix/plugins/data-provider-supabase/app/constants.ts b/refine-remix/plugins/data-provider-supabase/app/constants.ts deleted file mode 100644 index b5bebb6bb..000000000 --- a/refine-remix/plugins/data-provider-supabase/app/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const TOKEN_KEY = "supabase-token"; diff --git a/refine-remix/plugins/data-provider-supabase/app/routes/_auth.forgot-password.tsx b/refine-remix/plugins/data-provider-supabase/app/routes/_auth.forgot-password.tsx deleted file mode 100644 index 444b0b0ed..000000000 --- a/refine-remix/plugins/data-provider-supabase/app/routes/_auth.forgot-password.tsx +++ /dev/null @@ -1,15 +0,0 @@ -<%_ if (answers["ui-framework"] === 'antd') { _%> - import { AuthPage } from "@refinedev/antd"; - <%_ } _%> - <%_ if (answers["ui-framework"] === 'mui') { _%> - import { AuthPage } from "@refinedev/mui"; - <%_ } _%> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - import { AuthPage } from "@refinedev/core"; -<%_ } _%> - -export default function ForgotPassword() { - return ( - - ); -} diff --git a/refine-remix/plugins/data-provider-supabase/app/routes/_auth.login.tsx b/refine-remix/plugins/data-provider-supabase/app/routes/_auth.login.tsx deleted file mode 100644 index 8676c0da5..000000000 --- a/refine-remix/plugins/data-provider-supabase/app/routes/_auth.login.tsx +++ /dev/null @@ -1,18 +0,0 @@ -<%_ if (answers["ui-framework"] === 'antd') { _%> - import { AuthPage } from "@refinedev/antd"; - <%_ } _%> - <%_ if (answers["ui-framework"] === 'mui') { _%> - import { AuthPage } from "@refinedev/mui"; - <%_ } _%> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - import { AuthPage } from "@refinedev/core"; -<%_ } _%> - -export default function Login() { - return ( - - /> - ); -} diff --git a/refine-remix/plugins/data-provider-supabase/app/routes/_auth.register.tsx b/refine-remix/plugins/data-provider-supabase/app/routes/_auth.register.tsx deleted file mode 100644 index 9e7554799..000000000 --- a/refine-remix/plugins/data-provider-supabase/app/routes/_auth.register.tsx +++ /dev/null @@ -1,15 +0,0 @@ -<%_ if (answers["ui-framework"] === 'antd') { _%> - import { AuthPage } from "@refinedev/antd"; - <%_ } _%> - <%_ if (answers["ui-framework"] === 'mui') { _%> - import { AuthPage } from "@refinedev/mui"; - <%_ } _%> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - import { AuthPage } from "@refinedev/core"; -<%_ } _%> - -export default function Register() { - return ( - - ); -} diff --git a/refine-remix/plugins/data-provider-supabase/app/routes/_auth.tsx b/refine-remix/plugins/data-provider-supabase/app/routes/_auth.tsx deleted file mode 100644 index b02d21f92..000000000 --- a/refine-remix/plugins/data-provider-supabase/app/routes/_auth.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import { redirect } from "@remix-run/node"; -import type { LoaderFunctionArgs } from "@remix-run/node"; - -import { authProvider } from "~/authProvider"; - -export default function AuthLayout() { - // no layout is applied for the auth routes - return ; -} - -/** - * If the current session is authenticated, we're redirecting the user to the home page. - * Alternatively, we could also use the `Authenticated` component inside the `AuthLayout` to handle the redirect. - * But, server-side redirects are more performant. - */ -export async function loader({ request }: LoaderFunctionArgs) { - const { authenticated, redirectTo } = await authProvider.check(request); - - if (authenticated) { - throw redirect(redirectTo ?? "/"); - } - - return {}; -} diff --git a/refine-remix/plugins/data-provider-supabase/app/routes/_layout.tsx b/refine-remix/plugins/data-provider-supabase/app/routes/_layout.tsx deleted file mode 100644 index e7b3f99ae..000000000 --- a/refine-remix/plugins/data-provider-supabase/app/routes/_layout.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { Outlet } from "@remix-run/react"; -import type { LoaderFunctionArgs } from "@remix-run/node"; -import { redirect } from "@remix-run/node"; -<%_ if (answers["ui-framework"] === 'antd') { _%> -import { - ThemedLayoutV2, - ThemedSiderV2, -} from "@refinedev/antd"; -<%_ } _%> -<%_ if (answers["ui-framework"] === 'mui') { _%> -import { - ThemedLayoutV2, -} from "@refinedev/mui"; -<%_ } _%> - -import { Header } from "@components/header"; -import { authProvider } from "~/authProvider"; -<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> -import { Layout } from "~/components/layout"; -<%_ } _%> - -export default function BaseLayout() { - return ( - <> - <%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%> - - - - <%_ } else { _%> -
} - <%_ if (answers["ui-framework"] === 'antd') { _%> - Sider={(props) => } - <%_ } _%> - > - - - <%_ } _%> - - ); -} - -/** - * We're checking if the current session is authenticated. - * If not, we're redirecting the user to the login page. - * This is applied for all routes that are nested under this layout (_protected). - */ -export async function loader({ request }: LoaderFunctionArgs) { - const { authenticated, redirectTo } = await authProvider.check(request); - - if (!authenticated) { - throw redirect(redirectTo ?? "/login"); - } - - return {}; -} \ No newline at end of file diff --git a/refine-remix/plugins/data-provider-supabase/app/utility/index.ts b/refine-remix/plugins/data-provider-supabase/app/utility/index.ts deleted file mode 100644 index 1a2159651..000000000 --- a/refine-remix/plugins/data-provider-supabase/app/utility/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./supabaseClient"; diff --git a/refine-remix/plugins/data-provider-supabase/app/utility/supabaseClient.ts b/refine-remix/plugins/data-provider-supabase/app/utility/supabaseClient.ts deleted file mode 100644 index 4368fd9f1..000000000 --- a/refine-remix/plugins/data-provider-supabase/app/utility/supabaseClient.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { createClient } from "@refinedev/supabase"; - -const SUPABASE_URL = "https://iwdfzvfqbtokqetmbmbp.supabase.co"; -const SUPABASE_KEY = - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYzMDU2NzAxMCwiZXhwIjoxOTQ2MTQzMDEwfQ._gr6kXGkQBi9BM9dx5vKaNKYj_DJN1xlkarprGpM_fU"; - -export const supabaseClient = createClient(SUPABASE_URL, SUPABASE_KEY, { - db: { - schema: "public", - }, - auth: { - persistSession: true, - }, -}); \ No newline at end of file diff --git a/refine-remix/plugins/data-provider-supabase/extend.js b/refine-remix/plugins/data-provider-supabase/extend.js deleted file mode 100644 index be819e229..000000000 --- a/refine-remix/plugins/data-provider-supabase/extend.js +++ /dev/null @@ -1,28 +0,0 @@ -const base = { - _app: { - import: [`import { dataProvider } from "@refinedev/supabase";`], - localImport: [ - `import { authProvider } from "~/authProvider";`, - `import { supabaseClient } from "~/utility";`, - ], - refineAntdImports: [], - refineMuiImports: [], - refineProps: [ - "dataProvider={dataProvider(supabaseClient)}", - "authProvider={authProvider}", - ], - }, -}; -module.exports = { - extend(answers) { - if (answers["ui-framework"] === "antd") { - base._app.refineAntdImports.push("AuthPage"); - } - - if (answers["ui-framework"] === "mui") { - base._app.refineMuiImports.push("AuthPage"); - } - - return base; - }, -}; diff --git a/refine-remix/plugins/data-provider-supabase/meta.json b/refine-remix/plugins/data-provider-supabase/meta.json deleted file mode 100644 index 804c4711d..000000000 --- a/refine-remix/plugins/data-provider-supabase/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Supabase Data Provider", - "url": "https://refine.dev/docs/core/providers/data-provider/#overview" -} diff --git a/refine-remix/plugins/data-provider-supabase/package.json b/refine-remix/plugins/data-provider-supabase/package.json deleted file mode 100644 index c9459387f..000000000 --- a/refine-remix/plugins/data-provider-supabase/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dependencies": { - "@refinedev/supabase": "^5.7.4", - "cookie": "^0.5.0", - "js-cookie": "^3.0.1" - }, - "devDependencies": { - "@types/js-cookie": "^3.0.2" - } -} \ No newline at end of file diff --git a/refine-remix/plugins/headless-example/app/routes/_index.tsx b/refine-remix/plugins/headless-example/app/routes/_index.tsx deleted file mode 100644 index b8f4a59ed..000000000 --- a/refine-remix/plugins/headless-example/app/routes/_index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { NavigateToResource } from "@refinedev/remix-router"; - -/** - * Since we don't have any routes for the index page, we're redirecting the user to the first resource. - * - * This can also be done using the `loader` function and `redirect`. - */ -export default function Index() { - <%_ if (answers["data-provider"] === 'data-provider-strapi-v4') { _%> - return ; - <%_ } else { _%> - return ; - <%_ } _%> -} diff --git a/refine-remix/plugins/headless-example/app/routes/_layout.$.tsx b/refine-remix/plugins/headless-example/app/routes/_layout.$.tsx deleted file mode 100644 index ee93e5023..000000000 --- a/refine-remix/plugins/headless-example/app/routes/_layout.$.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { ErrorComponent } from "@refinedev/core"; - -/** - * We're using a splat route to catch all routes that don't match any other route and render the `ErrorComponent` as 404 page. - */ -export default function Index() { - return ; -} diff --git a/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts._index.tsx b/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts._index.tsx deleted file mode 100644 index 7748f75f1..000000000 --- a/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts._index.tsx +++ /dev/null @@ -1,282 +0,0 @@ -import { - type GetManyResponse, - useMany, - useNavigation, -} from "@refinedev/core"; -import { useTable } from "@refinedev/react-table"; -import { type ColumnDef, flexRender } from "@tanstack/react-table"; -import React from "react"; -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> -import { BLOG_POSTS_QUERY } from "../queries/blog-posts"; -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - import { POSTS_LIST_QUERY } from "../queries/blog-posts"; -<%_ } _%> - - -export default function BlogPostList() { - const columns = React.useMemo[]>( - () => [ - { - id: "id", - accessorKey: "id", - header: "ID", - }, - { - id: "title", - accessorKey: "title", - header: "Title", - }, - { - id: "content", - accessorKey: "content", - header: "Content", - }, - { - id: "category", - header: "Category", - accessorKey: <%- blogPostCategoryTableField %>, - <%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%> - cell: function render({ getValue, table }) { - const meta = table.options.meta as { - categoryData: GetManyResponse; - }; - - try { - const category = meta.categoryData?.data?.find( - (item) => item.id == getValue()?.id, - ); - - return category?.title ?? "Loading..."; - } catch (error) { - return null; - } - }, - <%_ } _%> - }, - { - id: "status", - accessorKey: "status", - header: "Status", - }, - { - id: "createdAt", -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - accessorKey: "created_at", -<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%> - accessorKey: "$createdAt", -<%_ } else { _%> - accessorKey: "createdAt", -<%_ } _%> - header: "Created At", - cell: function render({ getValue }) { - return new Date(getValue()).toLocaleString(undefined, { - timeZone: "UTC", - }); - }, - }, - { - id: "actions", - accessorKey: "id", - header: "Actions", - cell: function render({ getValue }) { - return ( -
- - -
- ); - }, - }, - ], - [], - ); - - const { edit, show, create } = useNavigation(); - - const { - getHeaderGroups, - getRowModel, - setOptions, - refineCore: { - tableQueryResult: { data: tableData }, - }, - getState, - setPageIndex, - getCanPreviousPage, - getPageCount, - getCanNextPage, - nextPage, - previousPage, - setPageSize, - } = useTable({ - columns, -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - refineCoreProps: { - meta: { - fields: BLOG_POSTS_QUERY, - }, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-strapi-v4") { _%> - refineCoreProps: { - meta: { - populate: ['category'], - }, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - refineCoreProps: { - meta: { - gqlQuery: POSTS_LIST_QUERY, - }, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-supabase") { _%> - refineCoreProps: { - meta: { - select: '*, categories(id,title)', - }, - }, -<%_ } _%> - }); - -<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%> - const { data: categoryData } = useMany({ - resource: "categories", - ids: tableData?.data?.map((item) => item?.<%- blogPostCategoryFieldName %>?.id).filter(Boolean) ?? [], - queryOptions: { - enabled: !!tableData?.data, - }, - }); - - setOptions((prev) => ({ - ...prev, - meta: { - ...prev.meta, - categoryData, - }, - })); -<%_ } _%> - - return ( -
-
-

{"List"}

- -
-
- - - {getHeaderGroups().map((headerGroup) => ( - - {headerGroup.headers.map((header) => ( - - ))} - - ))} - - - {getRowModel().rows.map((row) => ( - - {row.getVisibleCells().map((cell) => ( - - ))} - - ))} - -
- {!header.isPlaceholder && - flexRender( - header.column.columnDef.header, - header.getContext(), - )} -
- {flexRender( - cell.column.columnDef.cell, - cell.getContext(), - )} -
-
-
- - - - - - - {" "} - {getState().pagination.pageIndex + 1} / {getPageCount()}{" "} - - - - | {"Go"}:{" "} - { - const page = e.target.value - ? Number(e.target.value) - 1 - : 0; - setPageIndex(page); - }} - /> - {" "} - -
-
- ); -}; diff --git a/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts.create.tsx b/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts.create.tsx deleted file mode 100644 index 48bb253b6..000000000 --- a/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts.create.tsx +++ /dev/null @@ -1,143 +0,0 @@ -import { useNavigation, useSelect } from "@refinedev/core"; -import { useForm } from "@refinedev/react-hook-form"; -import React from "react"; -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - import { BLOG_POSTS_QUERY, BLOG_POSTS_CATEGORIES_SELECT_QUERY } from "../queries/blog-posts"; -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - import { POST_CREATE_MUTATION, CATEGORIES_SELECT_QUERY } from "../queries/blog-posts"; -<%_ } _%> - - -export default function BlogPostCreate() { - const { list } = useNavigation(); - - const { - refineCore: { onFinish }, - register, - handleSubmit, - formState: { errors }, - } = useForm({ -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - refineCoreProps: { - meta: { - fields: BLOG_POSTS_QUERY, - }, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - refineCoreProps: { - meta: { - gqlMutation: POST_CREATE_MUTATION, - }, - }, -<%_ } _%> - }); - - const { options: categoryOptions } = useSelect({ - resource: "categories", -<%_ if (answers["data-provider"] === "data-provider-hasura") { _%> - meta: { - fields: BLOG_POSTS_CATEGORIES_SELECT_QUERY, - }, -<%_ } _%> -<%_ if (answers["data-provider"] === "data-provider-nestjs-query") { _%> - meta: { - gqlQuery: CATEGORIES_SELECT_QUERY, - }, -<%_ } _%> - }); - - return ( -
-
-

Create

-
- -
-
-
-
- -