From bbdfb13b9d07f17ae9bd2b0a9f146b9e330eb121 Mon Sep 17 00:00:00 2001 From: Alican Erdurmaz Date: Fri, 31 May 2024 11:52:17 +0300 Subject: [PATCH 1/5] fix(nextjs-appwrite): auth flow (#396) * fix(nextjs-appwrite): auth flow * fix(nextjs-appwrite): ignore file name * fix(nextjs-appwrite): onError --- .../plugins/data-provider-appwrite/extend.js | 10 ++--- .../data-provider-appwrite/package.json | 20 ++++----- ...th-provider.ts => auth-provider.client.ts} | 44 ++++++++++--------- .../auth-provider/auth-provider.server.ts | 26 +++++------ .../src/providers/auth-provider/index.ts | 2 +- .../src/providers/data-provider/index.ts | 34 ++------------ .../src/utils/appwrite/client.ts | 17 +++++++ .../src/utils/appwrite/server.ts | 20 +++++++++ .../src/{utility => utils}/constants.ts | 2 +- .../src/{utility => utils}/normalize.ts | 0 refine-nextjs/prompt.js | 2 +- 11 files changed, 95 insertions(+), 82 deletions(-) rename refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/{auth-provider.ts => auth-provider.client.ts} (68%) create mode 100644 refine-nextjs/plugins/data-provider-appwrite/src/utils/appwrite/client.ts create mode 100644 refine-nextjs/plugins/data-provider-appwrite/src/utils/appwrite/server.ts rename refine-nextjs/plugins/data-provider-appwrite/src/{utility => utils}/constants.ts (68%) rename refine-nextjs/plugins/data-provider-appwrite/src/{utility => utils}/normalize.ts (100%) diff --git a/refine-nextjs/plugins/data-provider-appwrite/extend.js b/refine-nextjs/plugins/data-provider-appwrite/extend.js index 6f53d905..ec6964d9 100644 --- a/refine-nextjs/plugins/data-provider-appwrite/extend.js +++ b/refine-nextjs/plugins/data-provider-appwrite/extend.js @@ -2,13 +2,13 @@ const base = { _app: { import: [], localImport: [ - 'import { authProvider } from "@providers/auth-provider";', - 'import { dataProvider, liveProvider } from "@providers/data-provider";', + 'import { authProviderClient } from "@providers/auth-provider";', + 'import { appwriteDataProvider, appwriteLiveProvider } from "@providers/data-provider";', ], refineProps: [ - `dataProvider={dataProvider}`, - `liveProvider={liveProvider}`, - `authProvider={authProvider}`, + "dataProvider={appwriteDataProvider}", + "liveProvider={appwriteLiveProvider}", + "authProvider={authProviderClient}", ], refineOptions: [`liveMode: "auto",`], refineAntdImports: [], diff --git a/refine-nextjs/plugins/data-provider-appwrite/package.json b/refine-nextjs/plugins/data-provider-appwrite/package.json index 0811c763..c4d6761f 100644 --- a/refine-nextjs/plugins/data-provider-appwrite/package.json +++ b/refine-nextjs/plugins/data-provider-appwrite/package.json @@ -1,12 +1,12 @@ { - "dependencies": { - "@refinedev/appwrite": "^6.4.6", - "uuid": "^9.0.0", - "js-cookie": "^3.0.5" - }, - "devDependencies": { - "@types/uuid": "^9.0.2", - "@types/js-cookie": "^3.0.6" - } + "dependencies": { + "@refinedev/appwrite": "^6.4.6", + "uuid": "^9.0.0", + "js-cookie": "^3.0.5", + "node-appwrite": "^13.0.0" + }, + "devDependencies": { + "@types/uuid": "^9.0.2", + "@types/js-cookie": "^3.0.6" + } } - diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.ts b/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.client.ts similarity index 68% rename from refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.ts rename to refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.client.ts index c443bc61..375a65f7 100644 --- a/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.ts +++ b/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.client.ts @@ -1,20 +1,24 @@ "use client"; -import { account, appwriteClient } from "@providers/data-provider"; import { AppwriteException } from "@refinedev/appwrite"; -import { AuthBindings } from "@refinedev/core"; -import { APPWRITE_TOKEN_KEY } from "@utility/constants"; +import { AuthProvider } from "@refinedev/core"; +import { appwriteAccount, appwriteClient } from "@utils/appwrite/client"; +import { APPWRITE_JWT_KEY } from "@utils/constants"; import Cookies from "js-cookie"; import { v4 as uuidv4 } from "uuid"; -export const authProvider: AuthBindings = { +export const authProviderClient: AuthProvider = { login: async ({ email, password }) => { try { - await account.createEmailSession(email, password); - const { jwt } = await account.createJWT(); + Cookies.remove(APPWRITE_JWT_KEY, { path: "/" }); + appwriteClient.setJWT(""); + + await appwriteAccount.createEmailSession(email, password); + const { jwt } = await appwriteAccount.createJWT(); + appwriteClient.setJWT(jwt); if (jwt) { - Cookies.set(APPWRITE_TOKEN_KEY, jwt, { + Cookies.set(APPWRITE_JWT_KEY, jwt, { expires: 30, // 30 days path: "/", }); @@ -37,14 +41,10 @@ export const authProvider: AuthBindings = { }, logout: async () => { try { - await account.deleteSession("current"); - } catch (error: any) { - return { - success: false, - error, - }; - } - Cookies.remove(APPWRITE_TOKEN_KEY, { path: "/" }); + await appwriteAccount.deleteSessions(); + } catch (error) {} + + Cookies.remove(APPWRITE_JWT_KEY, { path: "/" }); appwriteClient.setJWT(""); return { success: true, @@ -53,7 +53,7 @@ export const authProvider: AuthBindings = { }, register: async ({ email, password }) => { try { - await account.create(uuidv4(), email, password); + await appwriteAccount.create(uuidv4(), email, password); return { success: true, redirectTo: "/login", @@ -69,18 +69,20 @@ export const authProvider: AuthBindings = { }; } }, - onError: async (error) => { - console.error(error); + onError: async (error: AppwriteException) => { + if (error.code === 401) { + return { logout: true, redirectTo: "/login", error }; + } return { error }; }, check: async () => { - const appwriteJWT = Cookies.get(APPWRITE_TOKEN_KEY); + const appwriteJWT = Cookies.get(APPWRITE_JWT_KEY); if (appwriteJWT) { appwriteClient.setJWT(appwriteJWT); } try { - const session = await account.get(); + const session = await appwriteAccount.get(); if (session) { return { @@ -108,7 +110,7 @@ export const authProvider: AuthBindings = { }, getPermissions: async () => null, getIdentity: async () => { - const user = await account.get(); + const user = await appwriteAccount.get(); if (user) { return user; diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.server.ts b/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.server.ts index b786f6dc..16ef466b 100644 --- a/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.server.ts +++ b/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.server.ts @@ -1,22 +1,22 @@ -import { AuthBindings } from "@refinedev/core"; -import { APPWRITE_TOKEN_KEY } from "@utility/constants"; -import { cookies } from "next/headers"; +import { AuthProvider } from "@refinedev/core"; +import { getSessionClient } from "@utils/appwrite/server"; -export const authProviderServer: Pick = { +export const authProviderServer: Pick = { check: async () => { - const cookieStore = cookies(); - const auth = cookieStore.get(APPWRITE_TOKEN_KEY); + try { + const client = await getSessionClient(); + await client.account.get(); - if (auth) { return { authenticated: true, }; + } catch (error: any) { + return { + authenticated: false, + logout: true, + redirectTo: "/login", + error, + }; } - - return { - authenticated: false, - logout: true, - redirectTo: "/login", - }; }, }; diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/index.ts b/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/index.ts index b7f6d9fe..36ccb9da 100644 --- a/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/index.ts +++ b/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/index.ts @@ -1,2 +1,2 @@ -export * from './auth-provider' +export * from './auth-provider.client' export * from './auth-provider.server' diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/providers/data-provider/index.ts b/refine-nextjs/plugins/data-provider-appwrite/src/providers/data-provider/index.ts index dcfec38d..7d9aaf09 100644 --- a/refine-nextjs/plugins/data-provider-appwrite/src/providers/data-provider/index.ts +++ b/refine-nextjs/plugins/data-provider-appwrite/src/providers/data-provider/index.ts @@ -1,38 +1,12 @@ "use client"; -import { - Account, - Appwrite, - dataProvider as appwriteDataProvider, - liveProvider as appwriteLiveProvider, - Storage, -} from "@refinedev/appwrite"; -import { - APPWRITE_PROJECT, - APPWRITE_TOKEN_KEY, - APPWRITE_URL, -} from "@utility/constants"; -import Cookies from "js-cookie"; +import { dataProvider, liveProvider } from "@refinedev/appwrite"; +import { appwriteClient } from "@utils/appwrite/client"; -const appwriteClient = new Appwrite(); - -appwriteClient.setEndpoint(APPWRITE_URL).setProject(APPWRITE_PROJECT); - -// for client side authentication -const appwriteJWT = Cookies.get(APPWRITE_TOKEN_KEY); -if (appwriteJWT) { - appwriteClient.setJWT(appwriteJWT); -} - -const account = new Account(appwriteClient); -const storage = new Storage(appwriteClient); - -export { appwriteClient, account, storage }; - -export const dataProvider = appwriteDataProvider(appwriteClient, { +export const appwriteDataProvider = dataProvider(appwriteClient, { databaseId: "database", }); -export const liveProvider = appwriteLiveProvider(appwriteClient, { +export const appwriteLiveProvider = liveProvider(appwriteClient, { databaseId: "database", }); diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/utils/appwrite/client.ts b/refine-nextjs/plugins/data-provider-appwrite/src/utils/appwrite/client.ts new file mode 100644 index 00000000..72fce887 --- /dev/null +++ b/refine-nextjs/plugins/data-provider-appwrite/src/utils/appwrite/client.ts @@ -0,0 +1,17 @@ +'use client' + +import { Account, Appwrite, Storage } from '@refinedev/appwrite' +import { APPWRITE_JWT_KEY, APPWRITE_PROJECT, APPWRITE_URL } from '@utils/constants' +import Cookies from 'js-cookie' + +export const appwriteClient = new Appwrite() + +const appwriteJWT = Cookies.get(APPWRITE_JWT_KEY) +if (appwriteJWT) { + appwriteClient.setJWT(appwriteJWT) +} + +appwriteClient.setEndpoint(APPWRITE_URL).setProject(APPWRITE_PROJECT) + +export const appwriteAccount = new Account(appwriteClient) +export const appwriteStorage = new Storage(appwriteClient) diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/utils/appwrite/server.ts b/refine-nextjs/plugins/data-provider-appwrite/src/utils/appwrite/server.ts new file mode 100644 index 00000000..ddc20593 --- /dev/null +++ b/refine-nextjs/plugins/data-provider-appwrite/src/utils/appwrite/server.ts @@ -0,0 +1,20 @@ +import { Client, Account } from 'node-appwrite' +import { cookies } from 'next/headers' +import { APPWRITE_JWT_KEY, APPWRITE_PROJECT, APPWRITE_URL } from '@utils/constants' + +export const getSessionClient = async () => { + const client = new Client().setEndpoint(APPWRITE_URL).setProject(APPWRITE_PROJECT) + + const session = cookies().get(APPWRITE_JWT_KEY) + if (!session || !session.value) { + throw new Error('No session') + } + + client.setJWT(session.value) + + return { + get account() { + return new Account(client) + }, + } +} diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/utility/constants.ts b/refine-nextjs/plugins/data-provider-appwrite/src/utils/constants.ts similarity index 68% rename from refine-nextjs/plugins/data-provider-appwrite/src/utility/constants.ts rename to refine-nextjs/plugins/data-provider-appwrite/src/utils/constants.ts index 3046b430..8be31586 100644 --- a/refine-nextjs/plugins/data-provider-appwrite/src/utility/constants.ts +++ b/refine-nextjs/plugins/data-provider-appwrite/src/utils/constants.ts @@ -1,3 +1,3 @@ export const APPWRITE_URL = "https://refine.appwrite.org/v1"; export const APPWRITE_PROJECT = "61c4368b4e349"; -export const APPWRITE_TOKEN_KEY = "appwrite-jwt"; +export const APPWRITE_JWT_KEY = "appwrite-jwt"; diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/utility/normalize.ts b/refine-nextjs/plugins/data-provider-appwrite/src/utils/normalize.ts similarity index 100% rename from refine-nextjs/plugins/data-provider-appwrite/src/utility/normalize.ts rename to refine-nextjs/plugins/data-provider-appwrite/src/utils/normalize.ts diff --git a/refine-nextjs/prompt.js b/refine-nextjs/prompt.js index 106edeed..bc19573c 100644 --- a/refine-nextjs/prompt.js +++ b/refine-nextjs/prompt.js @@ -186,7 +186,7 @@ module.exports = { when: function (answers) { return answers["ui-framework"] !== "antd"; }, - pattern: ["src/utility/normalize.ts"], + pattern: ["src/utils/normalize.ts"], }, { plugin: ["_base"], From 63c345db36083cfd8e353d2e2ba9d3cd0e732484 Mon Sep 17 00:00:00 2001 From: Alican Erdurmaz Date: Fri, 31 May 2024 11:53:37 +0300 Subject: [PATCH 2/5] fix(nextjs-strapi-v4): auth flow (#397) --- .../auth-provider/auth-provider.server.ts | 47 ++++++++++++++----- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.server.ts b/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.server.ts index 03deb9a9..5b35f0ac 100644 --- a/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.server.ts +++ b/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.server.ts @@ -1,22 +1,47 @@ -import { AuthBindings } from "@refinedev/core"; -import { TOKEN_KEY } from "@utility/constants"; +import { AuthProvider } from "@refinedev/core"; +import { API_URL, TOKEN_KEY } from "@utility/constants"; import { cookies } from "next/headers"; -export const authProviderServer: Pick = { +export const authProviderServer: Pick = { check: async () => { const cookieStore = cookies(); - const auth = cookieStore.get(TOKEN_KEY); + const token = cookieStore.get(TOKEN_KEY); + const url = new URL("/api/users/me", API_URL); - if (auth) { + if (!token) { return { - authenticated: true, + authenticated: false, + redirectTo: "/login", }; } - return { - authenticated: false, - logout: true, - redirectTo: "/login", - }; + try { + const response = await fetch(url.href, { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token.value}`, + }, + cache: "no-cache", + }); + const data = await response.json(); + if (data.error || !response.ok) { + return { + authenticated: false, + redirectTo: "/login", + error: data.error, + }; + } + + return { + authenticated: true, + }; + } catch (error) { + return { + authenticated: false, + redirectTo: "/login", + error: error, + }; + } }, }; From 0318f96d2fec49ebfd86b225d7210f72f5ab618a Mon Sep 17 00:00:00 2001 From: Alican Erdurmaz Date: Fri, 31 May 2024 11:55:06 +0300 Subject: [PATCH 3/5] fix(nextjs): unfreeze next version (#398) * fix(nextjs): un-freeze next version * fix(nextjs): un-freeze eslint-config-next version --- refine-nextjs/template/_package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/refine-nextjs/template/_package.json b/refine-nextjs/template/_package.json index 74a48d36..ca8854da 100644 --- a/refine-nextjs/template/_package.json +++ b/refine-nextjs/template/_package.json @@ -18,7 +18,7 @@ "@refinedev/devtools": "^1.1.32", "@refinedev/nextjs-router": "^6.0.0", "@refinedev/kbar": "^1.3.6", - "next": "14.1.0", + "next": "^14.1.0", "react": "^18.0.0", "react-dom": "^18.0.0" }, @@ -30,7 +30,7 @@ "typescript": "^4.7.4", "cross-env": "^7.0.3", "eslint": "^8", - "eslint-config-next": "14.1.0" + "eslint-config-next": "^14.1.0" <%_ if (typeof projectId !== 'undefined' && projectId !== '') { _%> }, "refine": { From a9c6adc0df49698e4aa18326e9ca6648a72a8e4d Mon Sep 17 00:00:00 2001 From: Alican Erdurmaz Date: Fri, 31 May 2024 11:56:19 +0300 Subject: [PATCH 4/5] chore: update typescript to v5 (#399) * chore: update typescript to v5 * fix: nextjs not working on ts5 * fix: nextjs not working on ts5 --- refine-nextjs/template/_package.json | 8 ++++---- refine-remix/template/_package.json | 2 +- refine-vite/template/_package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/refine-nextjs/template/_package.json b/refine-nextjs/template/_package.json index ca8854da..fdf94608 100644 --- a/refine-nextjs/template/_package.json +++ b/refine-nextjs/template/_package.json @@ -9,7 +9,7 @@ "dev": "cross-env NODE_OPTIONS=--max_old_space_size=4096 refine dev", "build": "refine build", "start": "refine start", - "lint": "eslint '**/*.{js,jsx,ts,tsx}'", + "lint": "next lint", "refine": "refine" }, "dependencies": { @@ -25,9 +25,9 @@ "devDependencies": { "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", - "@types/node": "^18.0.0", - "@typescript-eslint/parser": "5.48.0", - "typescript": "^4.7.4", + "@types/node": "^18.16.2", + "@typescript-eslint/parser": "^6.21.0", + "typescript": "^5.4.2", "cross-env": "^7.0.3", "eslint": "^8", "eslint-config-next": "^14.1.0" diff --git a/refine-remix/template/_package.json b/refine-remix/template/_package.json index a12a61f5..97807e65 100644 --- a/refine-remix/template/_package.json +++ b/refine-remix/template/_package.json @@ -28,7 +28,7 @@ "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "eslint": "^8.24.0", - "typescript": "^4.7.4" + "typescript": "^5.4.2" <%_ if (typeof projectId !== 'undefined' && projectId !== '') { _%> }, "refine": { diff --git a/refine-vite/template/_package.json b/refine-vite/template/_package.json index 54df6ee4..cd901141 100644 --- a/refine-vite/template/_package.json +++ b/refine-vite/template/_package.json @@ -22,7 +22,7 @@ "eslint": "^8.38.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.3.4", - "typescript": "^4.7.4", + "typescript": "^5.4.2", "vite": "^4.3.1" }, "scripts": { From 3f2f447d60819fbd9033e6d9fc8adfdf141d4ebb Mon Sep 17 00:00:00 2001 From: Alican Erdurmaz Date: Fri, 31 May 2024 12:34:56 +0300 Subject: [PATCH 5/5] chore: useImport type rule (#400) * chore: useImport type rule * fix: single type imports --- .../plugins/_base/src/components/layout/index.tsx | 2 +- .../plugins/antd-example/src/app/blog-posts/page.tsx | 2 +- .../plugins/antd-example/src/app/categories/page.tsx | 2 +- .../plugins/antd/src/contexts/color-mode/index.tsx | 2 +- .../auth-provider-auth0/src/app/_refine_context.tsx | 4 ++-- .../plugins/auth-provider-auth0/src/app/layout.tsx | 2 +- .../providers/auth-provider/auth-provider.server.ts | 4 ++-- .../src/providers/auth-provider/auth-provider.ts | 4 ++-- .../auth-provider-google/src/app/_refine_context.tsx | 4 ++-- .../plugins/auth-provider-google/src/app/layout.tsx | 2 +- .../auth-provider-keycloak/src/app/_refine_context.tsx | 4 ++-- .../plugins/auth-provider-keycloak/src/app/layout.tsx | 2 +- .../providers/auth-provider/auth-provider.client.ts | 2 +- .../providers/auth-provider/auth-provider.server.ts | 2 +- .../providers/auth-provider/auth-provider.server.ts | 2 +- .../src/providers/auth-provider/auth-provider.ts | 4 ++-- .../src/utils/supabase/middleware.ts | 4 ++-- .../plugins/mui-example/src/app/blog-posts/page.tsx | 2 +- .../plugins/mui-example/src/app/categories/page.tsx | 2 +- .../plugins/mui/src/contexts/color-mode/index.tsx | 2 +- .../plugins/_base/app/components/layout/index.tsx | 2 +- .../app/routes/_layout.blog-posts._index.tsx | 2 +- .../app/routes/_layout.categories._index.tsx | 2 +- .../plugins/auth-provider-auth0/app/routes/_auth.tsx | 2 +- .../plugins/auth-provider-custom/app/authProvider.ts | 4 ++-- .../plugins/auth-provider-google/app/routes/_auth.tsx | 2 +- .../auth-provider-keycloak/app/routes/_auth.tsx | 2 +- .../plugins/data-provider-appwrite/app/authProvider.ts | 4 ++-- .../data-provider-strapi-v4/app/authProvider.ts | 4 ++-- .../app/routes/_layout.blog-posts._index.tsx | 4 ++-- .../app/routes/_layout.categories._index.tsx | 2 +- .../app/routes/_layout.blog-posts._index.tsx | 2 +- .../app/routes/_layout.categories._index.tsx | 2 +- .../plugins/mui/app/components/header/index.tsx | 2 +- .../plugins/_base/src/components/layout/index.tsx | 2 +- .../plugins/antd-example/src/pages/blog-posts/list.tsx | 2 +- .../plugins/antd-example/src/pages/categories/list.tsx | 2 +- .../plugins/antd/src/contexts/color-mode/index.tsx | 2 +- .../plugins/auth-provider-custom/src/authProvider.ts | 10 +++++----- refine-vite/plugins/auth-provider-keycloak/extend.js | 4 ++-- .../plugins/data-provider-appwrite/src/authProvider.ts | 4 ++-- .../plugins/data-provider-custom-json-rest/extend.js | 6 +++--- .../data-provider-strapi-v4/src/authProvider.ts | 4 ++-- .../headless-example/src/pages/blog-posts/list.tsx | 4 ++-- .../headless-example/src/pages/categories/list.tsx | 2 +- .../plugins/mui-example/src/pages/blog-posts/list.tsx | 2 +- .../plugins/mui-example/src/pages/categories/list.tsx | 2 +- 47 files changed, 68 insertions(+), 68 deletions(-) diff --git a/refine-nextjs/plugins/_base/src/components/layout/index.tsx b/refine-nextjs/plugins/_base/src/components/layout/index.tsx index 05ad6124..8ee3d58d 100644 --- a/refine-nextjs/plugins/_base/src/components/layout/index.tsx +++ b/refine-nextjs/plugins/_base/src/components/layout/index.tsx @@ -1,6 +1,6 @@ "use client"; -import { PropsWithChildren } from "react"; +import type { PropsWithChildren } from "react"; import { Breadcrumb } from "../breadcrumb"; import { Menu } from "../menu"; diff --git a/refine-nextjs/plugins/antd-example/src/app/blog-posts/page.tsx b/refine-nextjs/plugins/antd-example/src/app/blog-posts/page.tsx index 6dcec56e..c0e1e35e 100644 --- a/refine-nextjs/plugins/antd-example/src/app/blog-posts/page.tsx +++ b/refine-nextjs/plugins/antd-example/src/app/blog-posts/page.tsx @@ -9,7 +9,7 @@ import { ShowButton, useTable, } from "@refinedev/antd"; -import { BaseRecord, useMany } from "@refinedev/core"; +import { type BaseRecord, useMany } from "@refinedev/core"; import { Space, Table } from "antd"; import React from "react"; diff --git a/refine-nextjs/plugins/antd-example/src/app/categories/page.tsx b/refine-nextjs/plugins/antd-example/src/app/categories/page.tsx index 32cf1487..425a2767 100644 --- a/refine-nextjs/plugins/antd-example/src/app/categories/page.tsx +++ b/refine-nextjs/plugins/antd-example/src/app/categories/page.tsx @@ -7,7 +7,7 @@ import { ShowButton, useTable, } from "@refinedev/antd"; -import { BaseRecord } from "@refinedev/core"; +import type { BaseRecord } from "@refinedev/core"; import { Space, Table } from "antd"; import React from "react"; <%_ if (answers["data-provider"] === "data-provider-hasura") { _%> diff --git a/refine-nextjs/plugins/antd/src/contexts/color-mode/index.tsx b/refine-nextjs/plugins/antd/src/contexts/color-mode/index.tsx index f443703a..a5e11eeb 100644 --- a/refine-nextjs/plugins/antd/src/contexts/color-mode/index.tsx +++ b/refine-nextjs/plugins/antd/src/contexts/color-mode/index.tsx @@ -1,7 +1,7 @@ 'use client' import React, { - PropsWithChildren, + type PropsWithChildren, createContext, useEffect, useState, diff --git a/refine-nextjs/plugins/auth-provider-auth0/src/app/_refine_context.tsx b/refine-nextjs/plugins/auth-provider-auth0/src/app/_refine_context.tsx index 39f8c4bc..b002c009 100644 --- a/refine-nextjs/plugins/auth-provider-auth0/src/app/_refine_context.tsx +++ b/refine-nextjs/plugins/auth-provider-auth0/src/app/_refine_context.tsx @@ -1,7 +1,7 @@ 'use client' import React from "react"; -import { Refine, GitHubBanner, AuthBindings, <%- (_app.refineImports || []).join("\n,") _%> } from '@refinedev/core'; +import { Refine, GitHubBanner, type AuthProvider, <%- (_app.refineImports || []).join("\n,") _%> } from '@refinedev/core'; import { RefineKbar, RefineKbarProvider } from "@refinedev/kbar"; import { SessionProvider, useSession, signOut, signIn } from "next-auth/react"; import { usePathname } from 'next/navigation' @@ -59,7 +59,7 @@ const App = (props: React.PropsWithChildren) => { return loading...; } - const authProvider: AuthBindings = { + const authProvider: AuthProvider = { login: async () => { signIn("auth0", { callbackUrl: to ? to.toString() : "/", diff --git a/refine-nextjs/plugins/auth-provider-auth0/src/app/layout.tsx b/refine-nextjs/plugins/auth-provider-auth0/src/app/layout.tsx index 2c0a6234..bd14dc59 100644 --- a/refine-nextjs/plugins/auth-provider-auth0/src/app/layout.tsx +++ b/refine-nextjs/plugins/auth-provider-auth0/src/app/layout.tsx @@ -1,4 +1,4 @@ -import { Metadata } from "next"; +import type { Metadata } from "next"; <%- (_app.nextjsImport || []).join("\n") _%> import React, { Suspense } from "react"; import { RefineContext } from "./_refine_context"; diff --git a/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.server.ts b/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.server.ts index b44a5b3a..cec4515e 100644 --- a/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.server.ts +++ b/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.server.ts @@ -1,7 +1,7 @@ -import { AuthBindings } from "@refinedev/core"; +import type { AuthProvider } from "@refinedev/core"; import { cookies } from "next/headers"; -export const authProviderServer: Pick = { +export const authProviderServer: Pick = { check: async () => { const cookieStore = cookies(); const auth = cookieStore.get("auth"); diff --git a/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.ts b/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.ts index 2a10c84b..66a9603c 100644 --- a/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.ts +++ b/refine-nextjs/plugins/auth-provider-custom/src/providers/auth-provider/auth-provider.ts @@ -1,6 +1,6 @@ "use client"; -import { AuthBindings } from "@refinedev/core"; +import type { AuthProvider } from "@refinedev/core"; import Cookies from "js-cookie"; const mockUsers = [ @@ -18,7 +18,7 @@ const mockUsers = [ }, ]; -export const authProvider: AuthBindings = { +export const authProvider: AuthProvider = { login: async ({ email, username, password, remember }) => { // Suppose we actually send a request to the back end here. const user = mockUsers[0]; diff --git a/refine-nextjs/plugins/auth-provider-google/src/app/_refine_context.tsx b/refine-nextjs/plugins/auth-provider-google/src/app/_refine_context.tsx index 42f584bb..916c7dae 100644 --- a/refine-nextjs/plugins/auth-provider-google/src/app/_refine_context.tsx +++ b/refine-nextjs/plugins/auth-provider-google/src/app/_refine_context.tsx @@ -1,7 +1,7 @@ 'use client' import React from "react"; -import { Refine, GitHubBanner, AuthBindings, <%- (_app.refineImports || []).join("\n,") _%> } from '@refinedev/core'; +import { Refine, GitHubBanner, type AuthProvider, <%- (_app.refineImports || []).join("\n,") _%> } from '@refinedev/core'; import { RefineKbar, RefineKbarProvider } from "@refinedev/kbar"; import { SessionProvider, useSession, signOut, signIn } from "next-auth/react"; import { usePathname } from 'next/navigation' @@ -59,7 +59,7 @@ const App = (props: React.PropsWithChildren) => { return loading...; } - const authProvider: AuthBindings = { + const authProvider: AuthProvider = { login: async () => { signIn("google", { callbackUrl: to ? to.toString() : "/", diff --git a/refine-nextjs/plugins/auth-provider-google/src/app/layout.tsx b/refine-nextjs/plugins/auth-provider-google/src/app/layout.tsx index 2c0a6234..bd14dc59 100644 --- a/refine-nextjs/plugins/auth-provider-google/src/app/layout.tsx +++ b/refine-nextjs/plugins/auth-provider-google/src/app/layout.tsx @@ -1,4 +1,4 @@ -import { Metadata } from "next"; +import type { Metadata } from "next"; <%- (_app.nextjsImport || []).join("\n") _%> import React, { Suspense } from "react"; import { RefineContext } from "./_refine_context"; diff --git a/refine-nextjs/plugins/auth-provider-keycloak/src/app/_refine_context.tsx b/refine-nextjs/plugins/auth-provider-keycloak/src/app/_refine_context.tsx index 0661a4d8..8224ce76 100644 --- a/refine-nextjs/plugins/auth-provider-keycloak/src/app/_refine_context.tsx +++ b/refine-nextjs/plugins/auth-provider-keycloak/src/app/_refine_context.tsx @@ -1,7 +1,7 @@ 'use client' import React from "react"; -import { Refine, GitHubBanner, AuthBindings, <%- (_app.refineImports || []).join("\n,") _%> } from '@refinedev/core'; +import { Refine, GitHubBanner, type AuthProvider, <%- (_app.refineImports || []).join("\n,") _%> } from '@refinedev/core'; import { RefineKbar, RefineKbarProvider } from "@refinedev/kbar"; import { SessionProvider, useSession, signOut, signIn } from "next-auth/react"; import { usePathname } from 'next/navigation' @@ -59,7 +59,7 @@ const App = (props: React.PropsWithChildren) => { return loading...; } - const authProvider: AuthBindings = { + const authProvider: AuthProvider = { login: async () => { signIn("keycloak", { callbackUrl: to ? to.toString() : "/", diff --git a/refine-nextjs/plugins/auth-provider-keycloak/src/app/layout.tsx b/refine-nextjs/plugins/auth-provider-keycloak/src/app/layout.tsx index 2c0a6234..bd14dc59 100644 --- a/refine-nextjs/plugins/auth-provider-keycloak/src/app/layout.tsx +++ b/refine-nextjs/plugins/auth-provider-keycloak/src/app/layout.tsx @@ -1,4 +1,4 @@ -import { Metadata } from "next"; +import type { Metadata } from "next"; <%- (_app.nextjsImport || []).join("\n") _%> import React, { Suspense } from "react"; import { RefineContext } from "./_refine_context"; diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.client.ts b/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.client.ts index 375a65f7..2c77579c 100644 --- a/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.client.ts +++ b/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.client.ts @@ -1,7 +1,7 @@ "use client"; import { AppwriteException } from "@refinedev/appwrite"; -import { AuthProvider } from "@refinedev/core"; +import type { AuthProvider } from "@refinedev/core"; import { appwriteAccount, appwriteClient } from "@utils/appwrite/client"; import { APPWRITE_JWT_KEY } from "@utils/constants"; import Cookies from "js-cookie"; diff --git a/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.server.ts b/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.server.ts index 16ef466b..f52a6c31 100644 --- a/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.server.ts +++ b/refine-nextjs/plugins/data-provider-appwrite/src/providers/auth-provider/auth-provider.server.ts @@ -1,4 +1,4 @@ -import { AuthProvider } from "@refinedev/core"; +import type { AuthProvider } from "@refinedev/core"; import { getSessionClient } from "@utils/appwrite/server"; export const authProviderServer: Pick = { diff --git a/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.server.ts b/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.server.ts index 5b35f0ac..8fcaee25 100644 --- a/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.server.ts +++ b/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.server.ts @@ -1,4 +1,4 @@ -import { AuthProvider } from "@refinedev/core"; +import type { AuthProvider } from "@refinedev/core"; import { API_URL, TOKEN_KEY } from "@utility/constants"; import { cookies } from "next/headers"; diff --git a/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.ts b/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.ts index e62dde32..3c4115c9 100644 --- a/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.ts +++ b/refine-nextjs/plugins/data-provider-strapi-v4/src/providers/auth-provider/auth-provider.ts @@ -1,6 +1,6 @@ "use client"; -import { AuthBindings } from "@refinedev/core"; +import type { AuthProvider } from "@refinedev/core"; import { AuthHelper } from "@refinedev/strapi-v4"; import { axiosInstance } from "@utility/axios-instance"; import { API_URL, TOKEN_KEY } from "@utility/constants"; @@ -8,7 +8,7 @@ import Cookies from "js-cookie"; const strapiAuthHelper = AuthHelper(API_URL + "/api"); -export const authProvider: AuthBindings = { +export const authProvider: AuthProvider = { login: async ({ email, password }) => { const { data, status } = await strapiAuthHelper.login(email, password); if (status === 200) { diff --git a/refine-nextjs/plugins/data-provider-supabase/src/utils/supabase/middleware.ts b/refine-nextjs/plugins/data-provider-supabase/src/utils/supabase/middleware.ts index 0329db12..974688d8 100644 --- a/refine-nextjs/plugins/data-provider-supabase/src/utils/supabase/middleware.ts +++ b/refine-nextjs/plugins/data-provider-supabase/src/utils/supabase/middleware.ts @@ -1,5 +1,5 @@ -import { CookieOptions, createServerClient } from "@supabase/ssr"; -import { NextRequest, NextResponse } from "next/server"; +import { type CookieOptions, createServerClient } from "@supabase/ssr"; +import { type NextRequest, NextResponse } from "next/server"; import { SUPABASE_KEY, SUPABASE_URL } from "./constants"; export async function updateSession(request: NextRequest) { diff --git a/refine-nextjs/plugins/mui-example/src/app/blog-posts/page.tsx b/refine-nextjs/plugins/mui-example/src/app/blog-posts/page.tsx index c4750648..2e525c01 100644 --- a/refine-nextjs/plugins/mui-example/src/app/blog-posts/page.tsx +++ b/refine-nextjs/plugins/mui-example/src/app/blog-posts/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { DataGrid, GridColDef } from "@mui/x-data-grid"; +import { DataGrid, type GridColDef } from "@mui/x-data-grid"; import { useMany } from "@refinedev/core"; import { DateField, diff --git a/refine-nextjs/plugins/mui-example/src/app/categories/page.tsx b/refine-nextjs/plugins/mui-example/src/app/categories/page.tsx index 67502a57..d8e74b7d 100644 --- a/refine-nextjs/plugins/mui-example/src/app/categories/page.tsx +++ b/refine-nextjs/plugins/mui-example/src/app/categories/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { DataGrid, GridColDef } from "@mui/x-data-grid"; +import { DataGrid, type GridColDef } from "@mui/x-data-grid"; import { DeleteButton, EditButton, diff --git a/refine-nextjs/plugins/mui/src/contexts/color-mode/index.tsx b/refine-nextjs/plugins/mui/src/contexts/color-mode/index.tsx index 5af24aa0..7cc61aba 100644 --- a/refine-nextjs/plugins/mui/src/contexts/color-mode/index.tsx +++ b/refine-nextjs/plugins/mui/src/contexts/color-mode/index.tsx @@ -1,7 +1,7 @@ 'use client' import React, { - PropsWithChildren, + type PropsWithChildren, createContext, useEffect, useState, diff --git a/refine-remix/plugins/_base/app/components/layout/index.tsx b/refine-remix/plugins/_base/app/components/layout/index.tsx index a0d73d76..bae0f7f2 100644 --- a/refine-remix/plugins/_base/app/components/layout/index.tsx +++ b/refine-remix/plugins/_base/app/components/layout/index.tsx @@ -1,4 +1,4 @@ -import { PropsWithChildren } from "react"; +import type { PropsWithChildren } from "react"; import { Breadcrumb } from "../breadcrumb"; import { Menu } from "../menu"; 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 index 11f11a31..6d659205 100644 --- 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 @@ -7,7 +7,7 @@ import { ShowButton, useTable, } from "@refinedev/antd"; -import { BaseRecord, useMany } from "@refinedev/core"; +import { type BaseRecord, useMany } from "@refinedev/core"; import { Space, Table } from "antd"; import React from "react"; <%_ if (answers["data-provider"] === "data-provider-hasura") { _%> 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 index 3feb021b..5308f64d 100644 --- a/refine-remix/plugins/antd-example/app/routes/_layout.categories._index.tsx +++ b/refine-remix/plugins/antd-example/app/routes/_layout.categories._index.tsx @@ -5,7 +5,7 @@ import { ShowButton, useTable, } from "@refinedev/antd"; -import { BaseRecord } from "@refinedev/core"; +import type { BaseRecord } from "@refinedev/core"; import { Space, Table } from "antd"; import React from "react"; <%_ if (answers["data-provider"] === "data-provider-hasura") { _%> diff --git a/refine-remix/plugins/auth-provider-auth0/app/routes/_auth.tsx b/refine-remix/plugins/auth-provider-auth0/app/routes/_auth.tsx index 2002e5a0..084ef629 100644 --- a/refine-remix/plugins/auth-provider-auth0/app/routes/_auth.tsx +++ b/refine-remix/plugins/auth-provider-auth0/app/routes/_auth.tsx @@ -1,5 +1,5 @@ import { Outlet } from "@remix-run/react"; -import { LoaderFunctionArgs, redirect } from "@remix-run/node"; +import { type LoaderFunctionArgs, redirect } from "@remix-run/node"; import { authenticator } from "~/utils/auth.server"; export default function AuthLayout() { diff --git a/refine-remix/plugins/auth-provider-custom/app/authProvider.ts b/refine-remix/plugins/auth-provider-custom/app/authProvider.ts index d886a440..9681b80a 100644 --- a/refine-remix/plugins/auth-provider-custom/app/authProvider.ts +++ b/refine-remix/plugins/auth-provider-custom/app/authProvider.ts @@ -1,4 +1,4 @@ -import type { AuthBindings } from "@refinedev/core"; +import type { AuthProvider } from "@refinedev/core"; import * as cookie from "cookie"; import Cookies from "js-cookie"; @@ -25,7 +25,7 @@ const mockUsers = [ const COOKIE_NAME = "user"; -export const authProvider: AuthBindings = { +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); diff --git a/refine-remix/plugins/auth-provider-google/app/routes/_auth.tsx b/refine-remix/plugins/auth-provider-google/app/routes/_auth.tsx index 2002e5a0..084ef629 100644 --- a/refine-remix/plugins/auth-provider-google/app/routes/_auth.tsx +++ b/refine-remix/plugins/auth-provider-google/app/routes/_auth.tsx @@ -1,5 +1,5 @@ import { Outlet } from "@remix-run/react"; -import { LoaderFunctionArgs, redirect } from "@remix-run/node"; +import { type LoaderFunctionArgs, redirect } from "@remix-run/node"; import { authenticator } from "~/utils/auth.server"; export default function AuthLayout() { diff --git a/refine-remix/plugins/auth-provider-keycloak/app/routes/_auth.tsx b/refine-remix/plugins/auth-provider-keycloak/app/routes/_auth.tsx index 2002e5a0..084ef629 100644 --- a/refine-remix/plugins/auth-provider-keycloak/app/routes/_auth.tsx +++ b/refine-remix/plugins/auth-provider-keycloak/app/routes/_auth.tsx @@ -1,5 +1,5 @@ import { Outlet } from "@remix-run/react"; -import { LoaderFunctionArgs, redirect } from "@remix-run/node"; +import { type LoaderFunctionArgs, redirect } from "@remix-run/node"; import { authenticator } from "~/utils/auth.server"; export default function AuthLayout() { diff --git a/refine-remix/plugins/data-provider-appwrite/app/authProvider.ts b/refine-remix/plugins/data-provider-appwrite/app/authProvider.ts index 5e3dcdaf..e674c7e3 100644 --- a/refine-remix/plugins/data-provider-appwrite/app/authProvider.ts +++ b/refine-remix/plugins/data-provider-appwrite/app/authProvider.ts @@ -1,11 +1,11 @@ import { AppwriteException } from "@refinedev/appwrite"; -import { AuthBindings } from "@refinedev/core"; +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: AuthBindings = { +export const authProvider: AuthProvider = { login: async ({ email, password }) => { try { await account.createEmailSession(email, password); diff --git a/refine-remix/plugins/data-provider-strapi-v4/app/authProvider.ts b/refine-remix/plugins/data-provider-strapi-v4/app/authProvider.ts index 0a1abb0f..383d9f92 100644 --- a/refine-remix/plugins/data-provider-strapi-v4/app/authProvider.ts +++ b/refine-remix/plugins/data-provider-strapi-v4/app/authProvider.ts @@ -1,4 +1,4 @@ -import type { AuthBindings } from "@refinedev/core"; +import type { AuthProvider } from "@refinedev/core"; import { AuthHelper } from "@refinedev/strapi-v4"; import axios from "axios"; import * as cookie from "cookie"; @@ -16,7 +16,7 @@ axiosInstance.interceptors.request.use((config) => { return config; }); -export const authProvider: AuthBindings = { +export const authProvider: AuthProvider = { login: async ({ email, password }) => { const { data, status } = await strapiAuthHelper.login(email, password); if (status === 200) { 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 index f609d8b5..fb549b35 100644 --- 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 @@ -1,10 +1,10 @@ import { - GetManyResponse, + type GetManyResponse, useMany, useNavigation, } from "@refinedev/core"; import { useTable } from "@refinedev/react-table"; -import { ColumnDef, flexRender } from "@tanstack/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"; diff --git a/refine-remix/plugins/headless-example/app/routes/_layout.categories._index.tsx b/refine-remix/plugins/headless-example/app/routes/_layout.categories._index.tsx index b110fd7c..dd541e4e 100644 --- a/refine-remix/plugins/headless-example/app/routes/_layout.categories._index.tsx +++ b/refine-remix/plugins/headless-example/app/routes/_layout.categories._index.tsx @@ -1,6 +1,6 @@ import { useNavigation } from "@refinedev/core"; import { useTable } from "@refinedev/react-table"; -import { ColumnDef, flexRender } from "@tanstack/react-table"; +import { type ColumnDef, flexRender } from "@tanstack/react-table"; import React from "react"; <%_ if (answers["data-provider"] === "data-provider-hasura") { _%> import { CATEGORIES_QUERY } from "../queries/categories"; diff --git a/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts._index.tsx b/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts._index.tsx index dc479e1c..ecfff4e4 100644 --- a/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts._index.tsx +++ b/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts._index.tsx @@ -1,4 +1,4 @@ -import { DataGrid, GridColDef } from "@mui/x-data-grid"; +import { DataGrid, type GridColDef } from "@mui/x-data-grid"; import { useMany } from "@refinedev/core"; import { DateField, diff --git a/refine-remix/plugins/mui-example/app/routes/_layout.categories._index.tsx b/refine-remix/plugins/mui-example/app/routes/_layout.categories._index.tsx index f5ad80e3..d283ba4d 100644 --- a/refine-remix/plugins/mui-example/app/routes/_layout.categories._index.tsx +++ b/refine-remix/plugins/mui-example/app/routes/_layout.categories._index.tsx @@ -1,4 +1,4 @@ -import { DataGrid, GridColDef } from "@mui/x-data-grid"; +import { DataGrid, type GridColDef } from "@mui/x-data-grid"; import { DeleteButton, EditButton, diff --git a/refine-remix/plugins/mui/app/components/header/index.tsx b/refine-remix/plugins/mui/app/components/header/index.tsx index 03b493c7..26fe5512 100644 --- a/refine-remix/plugins/mui/app/components/header/index.tsx +++ b/refine-remix/plugins/mui/app/components/header/index.tsx @@ -7,7 +7,7 @@ import Stack from "@mui/material/Stack"; import Toolbar from "@mui/material/Toolbar"; import Typography from "@mui/material/Typography"; import { useGetIdentity } from "@refinedev/core"; -import { HamburgerMenu, RefineThemedLayoutV2HeaderProps } from "@refinedev/mui"; +import { HamburgerMenu, type RefineThemedLayoutV2HeaderProps } from "@refinedev/mui"; import React, { useContext } from "react"; import { ColorModeContext } from "~/contexts/ColorModeContext"; diff --git a/refine-vite/plugins/_base/src/components/layout/index.tsx b/refine-vite/plugins/_base/src/components/layout/index.tsx index a0d73d76..bae0f7f2 100644 --- a/refine-vite/plugins/_base/src/components/layout/index.tsx +++ b/refine-vite/plugins/_base/src/components/layout/index.tsx @@ -1,4 +1,4 @@ -import { PropsWithChildren } from "react"; +import type { PropsWithChildren } from "react"; import { Breadcrumb } from "../breadcrumb"; import { Menu } from "../menu"; diff --git a/refine-vite/plugins/antd-example/src/pages/blog-posts/list.tsx b/refine-vite/plugins/antd-example/src/pages/blog-posts/list.tsx index 9e1c7260..067d9288 100644 --- a/refine-vite/plugins/antd-example/src/pages/blog-posts/list.tsx +++ b/refine-vite/plugins/antd-example/src/pages/blog-posts/list.tsx @@ -7,7 +7,7 @@ import { ShowButton, useTable, } from "@refinedev/antd"; -import { BaseRecord, useMany } from "@refinedev/core"; +import { type BaseRecord, useMany } from "@refinedev/core"; import { Space, Table } from "antd"; import React from "react"; <%_ if (answers["data-provider"] === "data-provider-hasura") { _%> diff --git a/refine-vite/plugins/antd-example/src/pages/categories/list.tsx b/refine-vite/plugins/antd-example/src/pages/categories/list.tsx index 16b735c7..5de08981 100644 --- a/refine-vite/plugins/antd-example/src/pages/categories/list.tsx +++ b/refine-vite/plugins/antd-example/src/pages/categories/list.tsx @@ -5,7 +5,7 @@ import { ShowButton, useTable, } from "@refinedev/antd"; -import { BaseRecord } from "@refinedev/core"; +import type { BaseRecord } from "@refinedev/core"; import { Space, Table } from "antd"; import React from "react"; <%_ if (answers["data-provider"] === "data-provider-hasura") { _%> diff --git a/refine-vite/plugins/antd/src/contexts/color-mode/index.tsx b/refine-vite/plugins/antd/src/contexts/color-mode/index.tsx index a87c318b..c34cdbd0 100644 --- a/refine-vite/plugins/antd/src/contexts/color-mode/index.tsx +++ b/refine-vite/plugins/antd/src/contexts/color-mode/index.tsx @@ -1,4 +1,4 @@ -import { PropsWithChildren, createContext, useEffect, useState } from "react"; +import { type PropsWithChildren, createContext, useEffect, useState } from "react"; import { ConfigProvider, theme } from "antd"; import { RefineThemes } from "@refinedev/antd"; diff --git a/refine-vite/plugins/auth-provider-custom/src/authProvider.ts b/refine-vite/plugins/auth-provider-custom/src/authProvider.ts index f5581e2a..08359f9f 100644 --- a/refine-vite/plugins/auth-provider-custom/src/authProvider.ts +++ b/refine-vite/plugins/auth-provider-custom/src/authProvider.ts @@ -1,8 +1,8 @@ -import { AuthBindings } from "@refinedev/core"; +import type { AuthProvider } from "@refinedev/core"; export const TOKEN_KEY = "refine-auth"; -export const authProvider: AuthBindings = { +export const authProvider: AuthProvider = { login: async ({ username, email, password }) => { if ((username || email) && password) { localStorage.setItem(TOKEN_KEY, username); @@ -24,20 +24,20 @@ export const authProvider: AuthBindings = { localStorage.removeItem(TOKEN_KEY); return { success: true, - redirectTo: "/login" + redirectTo: "/login", }; }, check: async () => { const token = localStorage.getItem(TOKEN_KEY); if (token) { return { - authenticated: true + authenticated: true, }; } return { authenticated: false, - redirectTo: "/login" + redirectTo: "/login", }; }, getPermissions: async () => null, diff --git a/refine-vite/plugins/auth-provider-keycloak/extend.js b/refine-vite/plugins/auth-provider-keycloak/extend.js index 39a8d3cd..353add69 100644 --- a/refine-vite/plugins/auth-provider-keycloak/extend.js +++ b/refine-vite/plugins/auth-provider-keycloak/extend.js @@ -1,6 +1,6 @@ const base = { _app: { - refineImports: [`Authenticated`, `AuthBindings`], + refineImports: [`Authenticated`, `AuthProvider`], import: [ `import axios from "axios";`, `import { useKeycloak } from "@react-keycloak/web";`, @@ -14,7 +14,7 @@ const base = { } `, ` - const authProvider: AuthBindings = { + const authProvider: AuthProvider = { login: async () => { const urlSearchParams = new URLSearchParams(window.location.search); const { to } = Object.fromEntries(urlSearchParams.entries()); diff --git a/refine-vite/plugins/data-provider-appwrite/src/authProvider.ts b/refine-vite/plugins/data-provider-appwrite/src/authProvider.ts index 01ffba18..2f616657 100644 --- a/refine-vite/plugins/data-provider-appwrite/src/authProvider.ts +++ b/refine-vite/plugins/data-provider-appwrite/src/authProvider.ts @@ -1,9 +1,9 @@ import { AppwriteException } from "@refinedev/appwrite"; -import { AuthBindings } from "@refinedev/core"; +import type { AuthProvider } from "@refinedev/core"; import { v4 as uuidv4 } from "uuid"; import { account } from "./utility"; -export const authProvider: AuthBindings = { +export const authProvider: AuthProvider = { login: async ({ email, password }) => { try { await account.createEmailSession(email, password); diff --git a/refine-vite/plugins/data-provider-custom-json-rest/extend.js b/refine-vite/plugins/data-provider-custom-json-rest/extend.js index d381bed1..cc872277 100644 --- a/refine-vite/plugins/data-provider-custom-json-rest/extend.js +++ b/refine-vite/plugins/data-provider-custom-json-rest/extend.js @@ -1,9 +1,9 @@ const base = { _app: { - import: [ - `import dataProvider from "@refinedev/simple-rest";`, + import: [`import dataProvider from "@refinedev/simple-rest";`], + refineProps: [ + `dataProvider={dataProvider("https://api.fake-rest.refine.dev")}`, ], - refineProps: [`dataProvider={dataProvider("https://api.fake-rest.refine.dev")}`], }, }; diff --git a/refine-vite/plugins/data-provider-strapi-v4/src/authProvider.ts b/refine-vite/plugins/data-provider-strapi-v4/src/authProvider.ts index 87109e6e..10bb1a56 100644 --- a/refine-vite/plugins/data-provider-strapi-v4/src/authProvider.ts +++ b/refine-vite/plugins/data-provider-strapi-v4/src/authProvider.ts @@ -1,4 +1,4 @@ -import { AuthBindings } from "@refinedev/core"; +import type { AuthProvider } from "@refinedev/core"; import { AuthHelper } from "@refinedev/strapi-v4"; import axios from "axios"; import { API_URL, TOKEN_KEY } from "./constants"; @@ -6,7 +6,7 @@ import { API_URL, TOKEN_KEY } from "./constants"; export const axiosInstance = axios.create(); const strapiAuthHelper = AuthHelper(API_URL + "/api"); -export const authProvider: AuthBindings = { +export const authProvider: AuthProvider = { login: async ({ email, password }) => { const { data, status } = await strapiAuthHelper.login(email, password); if (status === 200) { diff --git a/refine-vite/plugins/headless-example/src/pages/blog-posts/list.tsx b/refine-vite/plugins/headless-example/src/pages/blog-posts/list.tsx index 01ff37f3..6f3c3ef3 100644 --- a/refine-vite/plugins/headless-example/src/pages/blog-posts/list.tsx +++ b/refine-vite/plugins/headless-example/src/pages/blog-posts/list.tsx @@ -1,10 +1,10 @@ import { - GetManyResponse, + type GetManyResponse, useMany, useNavigation, } from "@refinedev/core"; import { useTable } from "@refinedev/react-table"; -import { ColumnDef, flexRender } from "@tanstack/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' diff --git a/refine-vite/plugins/headless-example/src/pages/categories/list.tsx b/refine-vite/plugins/headless-example/src/pages/categories/list.tsx index 3732180a..50296be9 100644 --- a/refine-vite/plugins/headless-example/src/pages/categories/list.tsx +++ b/refine-vite/plugins/headless-example/src/pages/categories/list.tsx @@ -1,6 +1,6 @@ import { useNavigation } from "@refinedev/core"; import { useTable } from "@refinedev/react-table"; -import { ColumnDef, flexRender } from "@tanstack/react-table"; +import { type ColumnDef, flexRender } from "@tanstack/react-table"; import React from "react"; <%_ if (answers["data-provider"] === "data-provider-hasura") { _%> import { CATEGORIES_QUERY } from './queries' diff --git a/refine-vite/plugins/mui-example/src/pages/blog-posts/list.tsx b/refine-vite/plugins/mui-example/src/pages/blog-posts/list.tsx index 1160a457..226a5e2d 100644 --- a/refine-vite/plugins/mui-example/src/pages/blog-posts/list.tsx +++ b/refine-vite/plugins/mui-example/src/pages/blog-posts/list.tsx @@ -1,4 +1,4 @@ -import { DataGrid, GridColDef } from "@mui/x-data-grid"; +import { DataGrid, type GridColDef } from "@mui/x-data-grid"; import { useMany } from "@refinedev/core"; import { DateField, diff --git a/refine-vite/plugins/mui-example/src/pages/categories/list.tsx b/refine-vite/plugins/mui-example/src/pages/categories/list.tsx index 829c60d7..845b7106 100644 --- a/refine-vite/plugins/mui-example/src/pages/categories/list.tsx +++ b/refine-vite/plugins/mui-example/src/pages/categories/list.tsx @@ -1,4 +1,4 @@ -import { DataGrid, GridColDef } from "@mui/x-data-grid"; +import { DataGrid, type GridColDef } from "@mui/x-data-grid"; import { DeleteButton, EditButton,