fix: Fix linting issues in GitLab integration and OIDC strategy

- Remove unused IntegrationService import in UploadGitLabProjectAvatarTask
- Replace 'any' type with proper types in gitlab.ts and OIDCStrategy.ts
This commit is contained in:
codegen-sh[bot] committed 2025-08-18 21:59:03 +00:00
1 parent 404a5991b3
commit ca66a6b2fa
4 files changed
+28 -15

No files matched your search

+14 -7
View File
@@ -118,9 +118,12 @@ export class GitLab {
// Get the first project the user has access to
// In a real implementation, we would want to let the user select which project to connect
const res = await fetch("https://gitlab.com/api/v4/projects?membership=true&per_page=1", {
headers,
});
const res = await fetch(
"https://gitlab.com/api/v4/projects?membership=true&per_page=1",
{
headers,
}
);
if (res.status !== 200) {
throw new Error(
@@ -168,7 +171,7 @@ export class GitLab {
};
let apiUrl: string;
let resourceSchema: any;
let resourceSchema: z.ZodObject<any>;
let resourceType: UnfurlResourceType;
if (resource.type === "issues") {
@@ -214,7 +217,8 @@ export class GitLab {
state: {
name: data.state,
color: data.state === "opened" ? "#1aaa55" : "#db3b21", // Green for open, red for closed
draft: resourceType === UnfurlResourceType.PR ? data.draft : undefined,
draft:
resourceType === UnfurlResourceType.PR ? data.draft : undefined,
},
createdAt: data.created_at,
} satisfies UnfurlIssueOrPR;
@@ -256,11 +260,14 @@ export class GitLab {
const type = parts[separatorIndex + 1];
const id = parts[separatorIndex + 2];
if (!type || !id || !GitLab.supportedUnfurls.includes(type as UnfurlResourceType)) {
if (
!type ||
!id ||
!GitLab.supportedUnfurls.includes(type as UnfurlResourceType)
) {
return;
}
return { projectPath, type, id };
}
}
@@ -1,4 +1,4 @@
import { IntegrationService, IntegrationType } from "@shared/types";
import { IntegrationType } from "@shared/types";
import BaseTask from "@server/queues/tasks/BaseTask";
import { Integration } from "@server/models";
import { FileOperation } from "@server/models";
@@ -14,13 +14,13 @@ export default class UploadGitLabProjectAvatarTask extends BaseTask<Props> {
const integration = await Integration.findByPk(integrationId, {
rejectOnEmpty: true,
});
try {
const res = await fetch(avatarUrl);
const buffer = await res.buffer();
const name = avatarUrl.split("/").pop() || "avatar";
const contentType = res.headers.get("content-type") || "image/png";
const operation = await FileOperation.createFromBuffer({
buffer,
contentType,
@@ -29,7 +29,7 @@ export default class UploadGitLabProjectAvatarTask extends BaseTask<Props> {
teamId: integration.teamId,
source: "gitlab",
});
await integration.update({
settings: {
...integration.settings,
@@ -48,8 +48,9 @@ export default class UploadGitLabProjectAvatarTask extends BaseTask<Props> {
// If the avatar upload fails, we don't need to fail the entire task
// as it's not critical to the integration's functionality.
// Just log the error and continue.
this.logger.error(`Failed to upload GitLab project avatar: ${err.message}`);
this.logger.error(
`Failed to upload GitLab project avatar: ${err.message}`
);
}
}
}
+3 -2
View File
@@ -1,5 +1,6 @@
import { HttpsProxyAgent } from "https-proxy-agent";
import OAuth2Strategy, { Strategy } from "passport-oauth2";
import { Request } from "express";
export class OIDCStrategy extends Strategy {
constructor(
@@ -14,12 +15,12 @@ export class OIDCStrategy extends Strategy {
}
}
authenticate(req: any, options: any) {
authenticate(req: Request, options: Record<string, unknown>) {
options.originalQuery = req.query;
super.authenticate(req, options);
}
authorizationParams(options: any) {
authorizationParams(options: Record<string, unknown>) {
return {
...options.originalQuery,
...super.authorizationParams?.(options),
@@ -1182,6 +1182,10 @@
"Enabled by {{integrationCreatedBy}}": "Enabled by {{integrationCreatedBy}}",
"Disconnecting will prevent previewing GitHub links from this organization in documents. Are you sure?": "Disconnecting will prevent previewing GitHub links from this organization in documents. Are you sure?",
"The GitHub integration is currently disabled. Please set the associated environment variables and restart the server to enable the integration.": "The GitHub integration is currently disabled. Please set the associated environment variables and restart the server to enable the integration.",
"Whoops, you need to accept the permissions in GitLab to connect {{appName}} to your project. Try again?": "Whoops, you need to accept the permissions in GitLab to connect {{appName}} to your project. Try again?",
"Enable previews of GitLab issues and merge requests in documents by connecting a GitLab project to {appName}.": "Enable previews of GitLab issues and merge requests in documents by connecting a GitLab project to {appName}.",
"Disconnecting will prevent previewing GitLab links from this project in documents. Are you sure?": "Disconnecting will prevent previewing GitLab links from this project in documents. Are you sure?",
"The GitLab integration is currently disabled. Please set the associated environment variables and restart the server to enable the integration.": "The GitLab integration is currently disabled. Please set the associated environment variables and restart the server to enable the integration.",
"Google Analytics": "Google Analytics",
"Add a Google Analytics 4 measurement ID to send document views and analytics from the workspace to your own Google Analytics account.": "Add a Google Analytics 4 measurement ID to send document views and analytics from the workspace to your own Google Analytics account.",
"Measurement ID": "Measurement ID",