Update deps and Zammad version (6.4.1)

This commit is contained in:
Darren Clarke 2025-01-15 14:15:02 +01:00
parent 07ee819520
commit 9e5ea2fc41
40 changed files with 973 additions and 849 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@link-stack/bridge-frontend",
"version": "2.3.4",
"version": "2.4.0b1",
"type": "module",
"scripts": {
"dev": "next dev",
@ -17,10 +17,10 @@
"@mui/icons-material": "^6",
"@mui/material": "^6",
"@mui/material-nextjs": "^6",
"@mui/x-license": "^7.23.2",
"@mui/x-license": "^7.23.6",
"@link-stack/bridge-common": "*",
"@link-stack/bridge-ui": "*",
"next": "15.1.0",
"next": "15.1.4",
"next-auth": "^4.24.11",
"react": "19.0.0",
"react-dom": "19.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "@link-stack/bridge-migrations",
"version": "2.3.4",
"version": "2.4.0b1",
"type": "module",
"scripts": {
"migrate:up:all": "tsx migrate.ts up:all",

View file

@ -1,6 +1,6 @@
{
"name": "@link-stack/bridge-whatsapp",
"version": "2.3.4",
"version": "2.4.0b1",
"main": "build/main/index.js",
"author": "Darren Clarke <darren@redaranj.com>",
"license": "AGPL-3.0-or-later",
@ -11,16 +11,16 @@
"@hapipal/toys": "^4.0.0",
"@whiskeysockets/baileys": "^6.7.9",
"hapi-pino": "^12.1.0",
"link-preview-js": "^3.0.12"
"link-preview-js": "^3.0.13"
},
"devDependencies": {
"@link-stack/eslint-config": "*",
"@link-stack/jest-config": "*",
"@link-stack/typescript-config": "*",
"@types/node": "*",
"dotenv-cli": "^7.4.4",
"dotenv-cli": "^8.0.0",
"tsx": "^4.19.2",
"typescript": "^5.7.2"
"typescript": "^5.7.3"
},
"scripts": {
"build": "tsc -p tsconfig.json",

View file

@ -1,6 +1,6 @@
{
"name": "@link-stack/bridge-worker",
"version": "2.3.4",
"version": "2.4.0b1",
"type": "module",
"main": "build/main/index.js",
"author": "Darren Clarke <darren@redaranj.com>",
@ -16,14 +16,14 @@
"@link-stack/signal-api": "*",
"fluent-ffmpeg": "^2.1.3",
"graphile-worker": "^0.16.6",
"remeda": "^2.17.4",
"twilio": "^5.4.0"
"remeda": "^2.19.1",
"twilio": "^5.4.2"
},
"devDependencies": {
"@types/fluent-ffmpeg": "^2.1.27",
"dotenv-cli": "^7.4.4",
"dotenv-cli": "^8.0.0",
"@link-stack/eslint-config": "*",
"@link-stack/typescript-config": "*",
"typescript": "^5.7.2"
"typescript": "^5.7.3"
}
}

View file

@ -22,9 +22,9 @@ const getVisualization = async (visualizationID: string) => {
);
const hit = hits[0];
const visualization = {
id: hit._id.split(":")[1],
title: hit._source.visualization.title,
description: hit._source.visualization.description,
id: hit?._id.split(":")[1],
title: hit?._source?.visualization.title,
description: hit?._source?.visualization.description,
url: `/app/visualize?security_tenant=global#/edit/${
hit._id.split(":")[1]
}?embed=true`,

View file

@ -10,27 +10,29 @@ const userMetadataIndexName = "user_metadata";
const baseURL = `https://${process.env.OPENSEARCH_USERNAME}:${process.env.OPENSEARCH_PASSWORD}@${process.env.OPENSEARCH_URL}`;
const createClient = () => new Client({
node: baseURL,
auth: {
username: process.env.OPENSEARCH_USERNAME!,
password: process.env.OPENSEARCH_PASSWORD!,
},
ssl: {
rejectUnauthorized: false,
},
});
const createClient = () =>
new Client({
node: baseURL,
auth: {
username: process.env.OPENSEARCH_USERNAME!,
password: process.env.OPENSEARCH_PASSWORD!,
},
ssl: {
rejectUnauthorized: false,
},
});
const createUserClient = (username: string, password: string) => new Client({
node: baseURL,
auth: {
username,
password,
},
ssl: {
rejectUnauthorized: false,
},
});
const createUserClient = (username: string, password: string) =>
new Client({
node: baseURL,
auth: {
username,
password,
},
ssl: {
rejectUnauthorized: false,
},
});
export const checkAuth = async (username: string, password: string) => {
const client = createUserClient(username, password);
@ -115,7 +117,7 @@ export const getUserMetadata = async (username: string) => {
await client.create({
id: username,
index: userMetadataIndexName,
body: { username, savedSearches: [] }
body: { username, savedSearches: [] },
});
res = await client.get({
@ -132,7 +134,7 @@ export const saveUserMetadata = async (username: string, metadata: any) => {
await client.update({
id: username,
index: userMetadataIndexName,
body: { doc: { username, ...metadata } }
body: { doc: { username, ...metadata } },
});
};
@ -181,7 +183,7 @@ const getIndexPattern: any = async (index: string) => {
sort: ["updated_at:desc"],
});
if (res.body.hits.total.value === 0) {
if (res?.body?.hits?.total?.valueOf() === 0) {
// eslint-disable-next-line no-use-before-define
return createCurrentUserIndexPattern(index);
}
@ -226,7 +228,7 @@ interface createUserVisualizationProps {
}
export const createUserVisualization = async (
props: createUserVisualizationProps
props: createUserVisualizationProps,
) => {
const { email, query, visualizationID, title, description } = props;
const userIndex = await getCurrentUserIndex(email);
@ -279,7 +281,7 @@ interface updateVisualizationProps {
}
export const updateUserVisualization = async (
props: updateVisualizationProps
props: updateVisualizationProps,
) => {
const { email, id, query, title, description } = props;
const userIndex = await getCurrentUserIndex(email);
@ -469,10 +471,18 @@ export const performQuery = async (searchQuery: any, limit: number) => {
const results = hits.map((hit: any) => ({
...hit._source,
id: hit._id,
incident: Array.isArray(hit._source.incident) ? hit._source.incident.join(", ") : hit._source.incident,
technology: Array.isArray(hit._source.technology) ? hit._source.technology.join(", ") : hit._source.technology,
targeted_group: Array.isArray(hit._source.targeted_group) ? hit._source.targeted_group.join(", ") : hit._source.targeted_group,
country: Array.isArray(hit._source.country) ? hit._source.country.join(", ") : hit._source.country,
incident: Array.isArray(hit._source.incident)
? hit._source.incident.join(", ")
: hit._source.incident,
technology: Array.isArray(hit._source.technology)
? hit._source.technology.join(", ")
: hit._source.technology,
targeted_group: Array.isArray(hit._source.targeted_group)
? hit._source.targeted_group.join(", ")
: hit._source.targeted_group,
country: Array.isArray(hit._source.country)
? hit._source.country.join(", ")
: hit._source.country,
}));
return results;
@ -570,7 +580,6 @@ export const getTemplates = async (limit: number) => {
},
};
const rawResponse = await client.search({
index: globalIndex,
size: limit,

View file

@ -1,6 +1,6 @@
{
"name": "@link-stack/leafcutter",
"version": "2.3.4",
"version": "2.4.0b1",
"scripts": {
"dev": "next dev -p 3001",
"login": "aws sso login --sso-session cdr",
@ -22,12 +22,12 @@
"@mui/icons-material": "^6",
"@mui/material": "^6",
"@mui/material-nextjs": "^6",
"@mui/x-date-pickers-pro": "^7.23.2",
"@opensearch-project/opensearch": "^2.13.0",
"@mui/x-date-pickers-pro": "^7.23.6",
"@opensearch-project/opensearch": "^3.1.0",
"date-fns": "^4.1.0",
"http-proxy-middleware": "^3.0.3",
"material-ui-popup-state": "^5.3.1",
"next": "15.1.0",
"material-ui-popup-state": "^5.3.3",
"next": "15.1.4",
"next-auth": "^4.24.11",
"react": "19.0.0",
"react-cookie": "^7.2.2",
@ -36,14 +36,14 @@
"react-iframe": "^1.8.5",
"react-polyglot": "^0.7.2",
"sharp": "^0.33.5",
"uuid": "^11.0.3"
"uuid": "^11.0.5"
},
"devDependencies": {
"@types/node": "^22.10.2",
"@types/react": "19.0.1",
"@types/node": "^22.10.6",
"@types/react": "19.0.7",
"@types/uuid": "^10.0.0",
"@link-stack/eslint-config": "*",
"@link-stack/typescript-config": "*",
"typescript": "5.7.2"
"typescript": "5.7.3"
}
}

View file

@ -36,6 +36,9 @@ const fetchUser = async (email: string) => {
const getUserRoles = async (email: string) => {
try {
const user = await fetchUser(email);
if (!user) {
return [];
}
const allRoles = await fetchRoles();
const roles = user.role_ids.map((roleID: number) => {
const role = allRoles[roleID];

View file

@ -14,9 +14,6 @@ const rewriteURL = (
const destinationURL = `${destinationBaseURL}/${path}`;
console.log(`Rewriting ${request.url} to ${destinationURL}`);
const requestHeaders = new Headers(request.headers);
for (const [key, value] of requestHeaders.entries()) {
console.log(`${key}: ${value}`);
}
requestHeaders.delete("x-forwarded-user");
requestHeaders.delete("x-forwarded-roles");
@ -46,6 +43,7 @@ const checkRewrites = async (request: NextRequestWithAuth) => {
"/graphql",
"/cable",
];
const isSetupMode = process.env.SETUP_MODE === "true";
const { token } = request.nextauth;
const email = token?.email?.toLowerCase() ?? "unknown";
const roles = (token?.roles as string[]) ?? [];
@ -66,7 +64,7 @@ const checkRewrites = async (request: NextRequestWithAuth) => {
} else if (zammadPaths.some((p) => request.nextUrl.pathname.startsWith(p))) {
return rewriteURL(request, linkBaseURL, zammadURL, headers);
} else if (request.nextUrl.pathname.startsWith("/api/v1")) {
if (email && email !== "unknown") {
if ((email && email !== "unknown") || isSetupMode) {
return NextResponse.next();
} else {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });

View file

@ -1,6 +1,6 @@
{
"name": "@link-stack/link",
"version": "2.3.4",
"version": "2.4.0b1",
"type": "module",
"scripts": {
"dev": "next dev",
@ -24,14 +24,14 @@
"@mui/icons-material": "^6",
"@mui/material": "^6",
"@mui/material-nextjs": "^6",
"@mui/x-data-grid-pro": "^7.23.2",
"@mui/x-date-pickers": "^7.23.2",
"@mui/x-date-pickers-pro": "^7.23.2",
"@mui/x-license": "^7.23.2",
"@mui/x-data-grid-pro": "^7.23.6",
"@mui/x-date-pickers": "^7.23.6",
"@mui/x-date-pickers-pro": "^7.23.6",
"@mui/x-license": "^7.23.6",
"date-fns": "^4.1.0",
"graphql-request": "^7.1.2",
"mui-chips-input": "^4.0.1",
"next": "15.1.0",
"next": "15.1.4",
"next-auth": "^4.24.11",
"react": "19.0.0",
"react-cookie": "^7.2.2",
@ -42,8 +42,8 @@
},
"devDependencies": {
"@link-stack/eslint-config": "*",
"@types/node": "^22.10.2",
"@types/react": "19.0.1",
"@types/node": "^22.10.6",
"@types/react": "19.0.7",
"@types/uuid": "^10.0.0"
}
}