Update deps
This commit is contained in:
parent
6663e8ed1e
commit
486f989494
33 changed files with 776 additions and 695 deletions
|
|
@ -14,17 +14,17 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@emotion/cache": "^11.11.0",
|
||||
"@emotion/react": "^11.11.3",
|
||||
"@emotion/react": "^11.11.4",
|
||||
"@emotion/server": "^11.11.0",
|
||||
"@emotion/styled": "^11.11.0",
|
||||
"@fontsource/playfair-display": "^5.0.19",
|
||||
"@fontsource/playfair-display": "^5.0.20",
|
||||
"@fontsource/poppins": "^5.0.8",
|
||||
"@fontsource/roboto": "^5.0.8",
|
||||
"@mui/icons-material": "^5",
|
||||
"@mui/lab": "^5.0.0-alpha.165",
|
||||
"@mui/lab": "^5.0.0-alpha.166",
|
||||
"@mui/material": "^5",
|
||||
"@mui/x-data-grid-pro": "^6.19.4",
|
||||
"@mui/x-date-pickers-pro": "^6.19.4",
|
||||
"@mui/x-data-grid-pro": "^6.19.5",
|
||||
"@mui/x-date-pickers-pro": "^6.19.5",
|
||||
"@opensearch-project/opensearch": "^2.5.0",
|
||||
"cryptr": "^6.3.0",
|
||||
"date-fns": "^3.3.1",
|
||||
|
|
@ -32,28 +32,28 @@
|
|||
"leafcutter-common": "*",
|
||||
"material-ui-popup-state": "^5.0.10",
|
||||
"next": "14.1.0",
|
||||
"next-auth": "^4.24.5",
|
||||
"next-auth": "^4.24.6",
|
||||
"next-http-proxy-middleware": "^1.2.6",
|
||||
"nodemailer": "^6.9.9",
|
||||
"nodemailer": "^6.9.10",
|
||||
"react": "18.2.0",
|
||||
"react-cookie": "^7.0.2",
|
||||
"react-cookie": "^7.1.0",
|
||||
"react-cookie-consent": "^9.0.0",
|
||||
"react-dom": "18.2.0",
|
||||
"react-iframe": "^1.8.5",
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-polyglot": "^0.7.2",
|
||||
"sharp": "^0.33.2",
|
||||
"swr": "^2.2.4",
|
||||
"swr": "^2.2.5",
|
||||
"tss-react": "^4.9.4",
|
||||
"uuid": "^9.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.23.9",
|
||||
"@types/node": "^20.11.17",
|
||||
"@types/react": "18.2.55",
|
||||
"@types/node": "^20.11.21",
|
||||
"@types/react": "18.2.60",
|
||||
"@types/uuid": "^9.0.8",
|
||||
"babel-loader": "^9.1.3",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-next": "^14.1.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ const fetchRoles = async () => {
|
|||
const url = `${process.env.ZAMMAD_URL}/api/v1/roles`;
|
||||
const res = await fetch(url, { headers });
|
||||
const roles = await res.json();
|
||||
console.log({ roles });
|
||||
const formattedRoles = roles.reduce((acc: any, role: any) => {
|
||||
acc[role.id] = role.name;
|
||||
return acc;
|
||||
|
|
@ -17,17 +18,25 @@ const fetchRoles = async () => {
|
|||
};
|
||||
|
||||
const fetchUser = async (email: string) => {
|
||||
const url = `${process.env.ZAMMAD_URL}/api/v1/users/search?query=email:${email}&limit=1`;
|
||||
console.log({ email });
|
||||
const url = `${process.env.ZAMMAD_URL}/api/v1/users/search?query=login:${email}&limit=1`;
|
||||
console.log({ url });
|
||||
const res = await fetch(url, { headers });
|
||||
console.log({ res });
|
||||
const users = await res.json();
|
||||
console.log({ users });
|
||||
const user = users?.[0];
|
||||
return user;
|
||||
|
||||
// temp
|
||||
return { role_ids: [1] };
|
||||
};
|
||||
|
||||
const getUserRoles = async (email: string) => {
|
||||
try {
|
||||
const user = await fetchUser(email);
|
||||
console.log({ user });
|
||||
const allRoles = await fetchRoles();
|
||||
console.log({ allRoles });
|
||||
const roles = user.role_ids.map((roleID: number) => {
|
||||
const role = allRoles[roleID];
|
||||
return role ? role.toLowerCase().replace(" ", "_") : null;
|
||||
|
|
@ -42,11 +51,12 @@ const getUserRoles = async (email: string) => {
|
|||
const login = async (email: string, password: string) => {
|
||||
const url = `${process.env.ZAMMAD_URL}/api/v1/users/me`;
|
||||
console.log({ url });
|
||||
const authorization = 'Basic ' + Buffer.from(email + ":" + password).toString('base64');
|
||||
const authorization =
|
||||
"Basic " + Buffer.from(email + ":" + password).toString("base64");
|
||||
const res = await fetch(url, {
|
||||
headers: {
|
||||
authorization
|
||||
}
|
||||
authorization,
|
||||
},
|
||||
});
|
||||
const user = await res.json();
|
||||
console.log({ user });
|
||||
|
|
@ -71,13 +81,13 @@ const handler = NextAuth({
|
|||
}),
|
||||
Apple({
|
||||
clientId: process.env.APPLE_CLIENT_ID,
|
||||
clientSecret: process.env.APPLE_CLIENT_SECRET
|
||||
clientSecret: process.env.APPLE_CLIENT_SECRET,
|
||||
}),
|
||||
Credentials({
|
||||
name: "Zammad",
|
||||
credentials: {
|
||||
email: { label: "Email", type: "text", },
|
||||
password: { label: "Password", type: "password" }
|
||||
email: { label: "Email", type: "text" },
|
||||
password: { label: "Password", type: "password" },
|
||||
},
|
||||
async authorize(credentials, req) {
|
||||
const user = await login(credentials.email, credentials.password);
|
||||
|
|
@ -86,15 +96,19 @@ const handler = NextAuth({
|
|||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
}),
|
||||
],
|
||||
secret: process.env.NEXTAUTH_SECRET,
|
||||
|
||||
callbacks: {
|
||||
signIn: async ({ user, account, profile }) => {
|
||||
const roles = await getUserRoles(user.email) ?? [];
|
||||
return roles.includes("admin") || roles.includes("agent") || process.env.SETUP_MODE === "true";
|
||||
const roles = (await getUserRoles(user.email)) ?? [];
|
||||
return (
|
||||
roles.includes("admin") ||
|
||||
roles.includes("agent") ||
|
||||
process.env.SETUP_MODE === "true"
|
||||
);
|
||||
},
|
||||
session: async ({ session, user, token }) => {
|
||||
// @ts-ignore
|
||||
|
|
@ -105,13 +119,11 @@ const handler = NextAuth({
|
|||
},
|
||||
jwt: async ({ token, user, account, profile, trigger }) => {
|
||||
if (user) {
|
||||
token.roles = await getUserRoles(user.email) ?? [];
|
||||
token.roles = (await getUserRoles(user.email)) ?? [];
|
||||
}
|
||||
return token;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
||||
export { handler as GET, handler as POST };
|
||||
|
|
|
|||
|
|
@ -12,17 +12,17 @@
|
|||
"@chatscope/chat-ui-kit-react": "^1.10.1",
|
||||
"@chatscope/chat-ui-kit-styles": "^1.4.0",
|
||||
"@emotion/cache": "^11.11.0",
|
||||
"@emotion/react": "^11.11.3",
|
||||
"@emotion/react": "^11.11.4",
|
||||
"@emotion/server": "^11.11.0",
|
||||
"@emotion/styled": "^11.11.0",
|
||||
"@fontsource/playfair-display": "^5.0.19",
|
||||
"@fontsource/playfair-display": "^5.0.20",
|
||||
"@fontsource/poppins": "^5.0.8",
|
||||
"@fontsource/roboto": "^5.0.8",
|
||||
"@mui/icons-material": "^5",
|
||||
"@mui/lab": "^5.0.0-alpha.165",
|
||||
"@mui/lab": "^5.0.0-alpha.166",
|
||||
"@mui/material": "^5",
|
||||
"@mui/x-data-grid-pro": "^6.19.4",
|
||||
"@mui/x-date-pickers-pro": "^6.19.4",
|
||||
"@mui/x-data-grid-pro": "^6.19.5",
|
||||
"@mui/x-date-pickers-pro": "^6.19.5",
|
||||
"cryptr": "^6.3.0",
|
||||
"date-fns": "^3.3.1",
|
||||
"graphql-request": "^6.1.0",
|
||||
|
|
@ -30,15 +30,15 @@
|
|||
"material-ui-popup-state": "^5.0.10",
|
||||
"mui-chips-input": "^2.1.4",
|
||||
"next": "14.1.0",
|
||||
"next-auth": "^4.24.5",
|
||||
"ra-data-graphql": "^4.16.10",
|
||||
"ra-i18n-polyglot": "^4.16.10",
|
||||
"ra-input-rich-text": "^4.16.10",
|
||||
"ra-language-english": "^4.16.10",
|
||||
"next-auth": "^4.24.6",
|
||||
"ra-data-graphql": "^4.16.11",
|
||||
"ra-i18n-polyglot": "^4.16.11",
|
||||
"ra-input-rich-text": "^4.16.11",
|
||||
"ra-language-english": "^4.16.11",
|
||||
"ra-postgraphile": "^6.1.2",
|
||||
"react": "18.2.0",
|
||||
"react-admin": "^4.16.10",
|
||||
"react-cookie": "^7.0.2",
|
||||
"react-admin": "^4.16.11",
|
||||
"react-cookie": "^7.1.0",
|
||||
"react-digit-input": "^2.1.0",
|
||||
"react-dom": "18.2.0",
|
||||
"react-iframe": "^1.8.5",
|
||||
|
|
@ -46,17 +46,17 @@
|
|||
"react-qr-code": "^2.0.12",
|
||||
"react-timer-hook": "^3.0.7",
|
||||
"sharp": "^0.33.2",
|
||||
"swr": "^2.2.4",
|
||||
"swr": "^2.2.5",
|
||||
"tss-react": "^4.9.4",
|
||||
"twilio-client": "^1.15.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.23.9",
|
||||
"@types/node": "^20.11.17",
|
||||
"@types/react": "18.2.55",
|
||||
"@types/node": "^20.11.21",
|
||||
"@types/react": "18.2.60",
|
||||
"@types/uuid": "^9.0.8",
|
||||
"babel-loader": "^9.1.3",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-next": "^14.1.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
"hapi-auth-bearer-token": "^8.0.0",
|
||||
"hapi-auth-jwt2": "^10.5.1",
|
||||
"hapi-swagger": "^17.2.1",
|
||||
"joi": "^17.12.1",
|
||||
"joi": "^17.12.2",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"jwks-rsa": "^3.1.0",
|
||||
"long": "^5.2.3",
|
||||
|
|
@ -40,8 +40,8 @@
|
|||
"pg-promise": "^11.5.4",
|
||||
"postgraphile": "4.12.3",
|
||||
"postgraphile-plugin-connection-filter": "^2.3.0",
|
||||
"remeda": "^1.40.2",
|
||||
"twilio": "^4.22.0",
|
||||
"remeda": "^1.44.1",
|
||||
"twilio": "^4.23.0",
|
||||
"typeorm": "^0.3.20",
|
||||
"@whiskeysockets/baileys": "^6.6.0"
|
||||
},
|
||||
|
|
@ -52,13 +52,13 @@
|
|||
"camelcase-keys": "^9.1.3",
|
||||
"eslint-config-link": "*",
|
||||
"jest-config-link": "*",
|
||||
"nodemon": "^3.0.3",
|
||||
"nodemon": "^3.1.0",
|
||||
"pg-monitor": "^2.0.0",
|
||||
"pino-pretty": "^10.3.1",
|
||||
"ts-node": "^10.9.2",
|
||||
"tsc-watch": "^6.0.4",
|
||||
"tsconfig-link": "*",
|
||||
"typedoc": "^0.25.8",
|
||||
"typedoc": "^0.25.9",
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"nodemonConfig": {
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@ const AppPlugin = {
|
|||
name: "App",
|
||||
async register(
|
||||
server: Hapi.Server,
|
||||
options: { config: IAppConfig }
|
||||
options: { config: IAppConfig },
|
||||
): Promise<void> {
|
||||
// declare our **run-time** plugin dependencies
|
||||
// these are runtime only deps, not registration time
|
||||
// ref: https://hapipal.com/best-practices/handling-plugin-dependencies
|
||||
server.dependency(["config", "hapi-pino"]);
|
||||
|
||||
server.validator(Joi);
|
||||
server.validator(Joi as any);
|
||||
await Plugins.register(server, options.config);
|
||||
await Services.register(server);
|
||||
await Routes.register(server);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
"devDependencies": {
|
||||
"@types/jest": "^29.5.12",
|
||||
"pino-pretty": "^10.3.1",
|
||||
"nodemon": "^3.0.3",
|
||||
"nodemon": "^3.1.0",
|
||||
"tsconfig-link": "*",
|
||||
"eslint-config-link": "*",
|
||||
"jest-config-link": "*",
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
"html-to-text": "^9.0.5",
|
||||
"node-fetch": "^3",
|
||||
"pg-promise": "^11.5.4",
|
||||
"remeda": "^1.40.2",
|
||||
"twilio": "^4.22.0"
|
||||
"remeda": "^1.44.1",
|
||||
"twilio": "^4.23.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.23.9",
|
||||
|
|
@ -23,15 +23,15 @@
|
|||
"@babel/preset-typescript": "7.23.3",
|
||||
"@types/fluent-ffmpeg": "^2.1.24",
|
||||
"@types/jest": "^29.5.12",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint": "^8.57.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-circus": "^29.7.0",
|
||||
"jest-junit": "^16.0.0",
|
||||
"nodemon": "^3.0.3",
|
||||
"nodemon": "^3.1.0",
|
||||
"pino-pretty": "^10.3.1",
|
||||
"prettier": "^3.2.5",
|
||||
"ts-node": "^10.9.2",
|
||||
"typedoc": "^0.25.8",
|
||||
"typedoc": "^0.25.9",
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"nodemonConfig": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue