chore(deps): batch dependency updates, pnpm v11 migration, and fix integration cache
Batch-update dependencies from 17 open renovate PRs: - @modelcontextprotocol/sdk 1.26→1.29, tiptap 3.25→3.26, ioredis 5.11.0→5.11.1 - mysql2 3.22.4→3.22.5, sql.js ^1.12→^1.14, @types/react 19.2.16→19.2.17 - oxlint ^1.67→^1.68, oxfmt ^0.53→^0.54, concurrently ^9→^10, mantine-contextmenu ^7→^9 - postcss ^8.4→^8.5.10 (security), @fec/remark-a11y-emoji ^3→^4 Migrate docs Tailwind CSS v3 → v4: - Replace tailwindcss v3 + autoprefixer with tailwindcss v4 + @tailwindcss/postcss - Convert config from tailwind.config.js to CSS @theme block - Update PostCSS plugin in docusaurus.config.ts Upgrade GitHub Actions: - configure-pages v5→v6, upload-pages-artifact v4→v5, deploy-pages v4→v5 - EndBug/add-and-commit v9→v10, git-auto-commit-action v5→v7 Migrate pnpm v10 → v11 (unblocks #5679): - Move package.json#pnpm config to pnpm-workspace.yaml - Convert onlyBuiltDependencies/ignoredBuiltDependencies to allowBuilds map - Migrate .npmrc settings (nodeLinker, strictPeerDependencies, engineStrict) - Update packageManager to pnpm@11.5.2 Fix proxmox-api undici type incompatibility: - Cast fetch parameter to resolve type mismatch between bundled undici versions Fix integration cache not invalidating after create/update/delete: - Add utils.integration.all.invalidate() to all mutation onSuccess handlers - Previously only Next.js server cache was revalidated, not client tRPC cache
This commit is contained in:
21 files changed
+1472
-1512
No files matched your search
@@ -55,7 +55,8 @@ export class ProxmoxIntegration extends Integration implements IClusterHealthMon
|
||||
host: this.url("/").host,
|
||||
tokenID: `${this.getSecretValue("username")}@${this.getSecretValue("realm")}!${this.getSecretValue("tokenId")}`,
|
||||
tokenSecret: this.getSecretValue("apiKey"),
|
||||
fetch: fetchAsync,
|
||||
// proxmox-api bundles its own undici types which are incompatible with the project's undici version
|
||||
fetch: fetchAsync as any,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import proxmoxApi from "proxmox-api";
|
||||
import type { fetch as undiciFetch } from "undici";
|
||||
import { Response } from "undici";
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
@@ -9,48 +8,32 @@ import { ProxmoxApiErrorHandler } from "../proxmox-error-handler";
|
||||
|
||||
describe("ProxmoxApiErrorHandler handleError should handle the provided error accordingly", () => {
|
||||
test.each([400, 401, 500])("should handle %s error", async (statusCode) => {
|
||||
// Arrange
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
const mockedFetch: typeof undiciFetch = async () => {
|
||||
return Promise.resolve(createFakeResponse(statusCode));
|
||||
};
|
||||
const mockedFetch = async () => Promise.resolve(createFakeResponse(statusCode));
|
||||
|
||||
// Act
|
||||
const result = await runWithAsync(mockedFetch);
|
||||
|
||||
// Assert
|
||||
expect(result).toBeInstanceOf(IntegrationResponseError);
|
||||
const error = result as unknown as IntegrationResponseError;
|
||||
expect(error.cause.statusCode).toBe(statusCode);
|
||||
});
|
||||
test("should handle other non successful status codes", async () => {
|
||||
// Arrange
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
const mockedFetch: typeof undiciFetch = async () => {
|
||||
return Promise.resolve(createFakeResponse(404));
|
||||
};
|
||||
const mockedFetch = async () => Promise.resolve(createFakeResponse(404));
|
||||
|
||||
// Act
|
||||
const result = await runWithAsync(mockedFetch);
|
||||
|
||||
// Assert
|
||||
expect(result).toBeInstanceOf(IntegrationResponseError);
|
||||
const error = result as unknown as IntegrationResponseError;
|
||||
expect(error.cause.statusCode).toBe(404);
|
||||
});
|
||||
test("should handle request error", async () => {
|
||||
// Arrange
|
||||
const mockedFetch: typeof undiciFetch = () => {
|
||||
const mockedFetch = () => {
|
||||
const errorWithCode = new Error("Inner error") as Error & { code: string };
|
||||
errorWithCode.code = "ECONNREFUSED";
|
||||
throw new TypeError("Outer error", { cause: errorWithCode });
|
||||
};
|
||||
|
||||
// Act
|
||||
const result = await runWithAsync(mockedFetch);
|
||||
|
||||
// Assert
|
||||
// In the end in should have the structure IntegrationRequestError -> RequestError -> TypeError -> Error (with code)
|
||||
expect(result).toBeInstanceOf(IntegrationRequestError);
|
||||
const error = result as unknown as IntegrationRequestError;
|
||||
expect(error.cause.cause).toBeInstanceOf(TypeError);
|
||||
@@ -65,13 +48,11 @@ describe("ProxmoxApiErrorHandler handleError should handle the provided error ac
|
||||
const createFakeResponse = (statusCode: number) => {
|
||||
return new Response(JSON.stringify({ data: {} }), {
|
||||
status: statusCode,
|
||||
// It expects a content-type and valid json response
|
||||
// https://github.com/UrielCh/proxmox-api/blob/master/api/src/ProxmoxEngine.ts#L258
|
||||
headers: { "content-type": "application/json;charset=UTF-8" },
|
||||
});
|
||||
};
|
||||
|
||||
const runWithAsync = async (mockedFetch: typeof undiciFetch) => {
|
||||
const runWithAsync = async (mockedFetch: (...args: any[]) => any) => {
|
||||
const integration = { id: "test", name: "test", url: "http://proxmox.example.com" };
|
||||
const client = createProxmoxClient(mockedFetch);
|
||||
const handler = new ProxmoxApiErrorHandler();
|
||||
@@ -79,11 +60,11 @@ const runWithAsync = async (mockedFetch: typeof undiciFetch) => {
|
||||
return await client.nodes.$get().catch((error) => handler.handleError(error, integration));
|
||||
};
|
||||
|
||||
const createProxmoxClient = (fetch: typeof undiciFetch) => {
|
||||
const createProxmoxClient = (fetch: (...args: any[]) => any) => {
|
||||
return proxmoxApi({
|
||||
host: "proxmox.example.com",
|
||||
tokenID: "username@realm!tokenId",
|
||||
tokenSecret: crypto.randomUUID(),
|
||||
fetch,
|
||||
fetch: fetch as any,
|
||||
});
|
||||
};
|
||||
Reference in new issue
Block a user