From 5295c69f4640557fc601c107a297f7c36964c380 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Sat, 3 Jun 2023 03:51:44 -0700 Subject: [PATCH] Bump ts-rest --- package-lock.json | 14 +++++++------- package.json | 2 +- src/renderer/api/jellyfin/jellyfin-api.ts | 7 ++++++- src/renderer/api/jellyfin/jellyfin-controller.ts | 2 +- src/renderer/api/navidrome/navidrome-api.ts | 2 ++ src/renderer/api/subsonic/subsonic-api.ts | 4 ++-- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index b1ff1101..c6bd2be3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "@mantine/utils": "^6.0.13", "@tanstack/react-query": "^4.29.5", "@tanstack/react-query-devtools": "^4.29.6", - "@ts-rest/core": "^3.22.0", + "@ts-rest/core": "^3.23.0", "axios": "^1.4.0", "cmdk": "^0.2.0", "dayjs": "^1.11.6", @@ -3094,9 +3094,9 @@ } }, "node_modules/@ts-rest/core": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@ts-rest/core/-/core-3.22.0.tgz", - "integrity": "sha512-65FhsjhdQntITzUwB2M8CTz8bdODwNmVHMBIQiXTZrkmzxA0YiyrShotkDrorSNH9IspU+qavb82ZVlU9ZdWnQ==", + "version": "3.23.0", + "resolved": "https://registry.npmjs.org/@ts-rest/core/-/core-3.23.0.tgz", + "integrity": "sha512-2vJwa682m9yS/xQPvPxZBluJfIZwNkt2HY9ER3UtGnu8Dijw+8iymSyIyjRLpFFWUyRnVp9IqrEi/d84bkNFIw==", "peerDependencies": { "zod": "^3.0.0" }, @@ -25728,9 +25728,9 @@ "dev": true }, "@ts-rest/core": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@ts-rest/core/-/core-3.22.0.tgz", - "integrity": "sha512-65FhsjhdQntITzUwB2M8CTz8bdODwNmVHMBIQiXTZrkmzxA0YiyrShotkDrorSNH9IspU+qavb82ZVlU9ZdWnQ==", + "version": "3.23.0", + "resolved": "https://registry.npmjs.org/@ts-rest/core/-/core-3.23.0.tgz", + "integrity": "sha512-2vJwa682m9yS/xQPvPxZBluJfIZwNkt2HY9ER3UtGnu8Dijw+8iymSyIyjRLpFFWUyRnVp9IqrEi/d84bkNFIw==", "requires": {} }, "@tsconfig/node10": { diff --git a/package.json b/package.json index 956567de..de577594 100644 --- a/package.json +++ b/package.json @@ -263,7 +263,7 @@ "@mantine/utils": "^6.0.13", "@tanstack/react-query": "^4.29.5", "@tanstack/react-query-devtools": "^4.29.6", - "@ts-rest/core": "^3.22.0", + "@ts-rest/core": "^3.23.0", "axios": "^1.4.0", "cmdk": "^0.2.0", "dayjs": "^1.11.6", diff --git a/src/renderer/api/jellyfin/jellyfin-api.ts b/src/renderer/api/jellyfin/jellyfin-api.ts index cc6a4cfb..36f7688b 100644 --- a/src/renderer/api/jellyfin/jellyfin-api.ts +++ b/src/renderer/api/jellyfin/jellyfin-api.ts @@ -23,6 +23,9 @@ export const contract = c.router({ }, authenticate: { body: jfType._parameters.authenticate, + headers: z.object({ + 'X-Emby-Authorization': z.string(), + }), method: 'POST', path: 'users/authenticatebyname', responses: { @@ -324,6 +327,7 @@ export const jfApiClient = (args: { }); return { body: result.data, + headers: result.headers as any, status: result.status, }; } catch (e: Error | AxiosError | any) { @@ -331,7 +335,8 @@ export const jfApiClient = (args: { const error = e as AxiosError; const response = error.response as AxiosResponse; return { - body: response.data, + body: response?.data, + headers: response?.headers as any, status: response.status, }; } diff --git a/src/renderer/api/jellyfin/jellyfin-controller.ts b/src/renderer/api/jellyfin/jellyfin-controller.ts index 89ae380c..fac13278 100644 --- a/src/renderer/api/jellyfin/jellyfin-controller.ts +++ b/src/renderer/api/jellyfin/jellyfin-controller.ts @@ -71,7 +71,7 @@ const authenticate = async ( Username: body.username, }, headers: { - 'X-Emby-Authorization': `MediaBrowser Client="Feishin", Device="PC", DeviceId="Feishin", Version="${packageJson.version}"`, + 'x-emby-authorization': `MediaBrowser Client="Feishin", Device="PC", DeviceId="Feishin", Version="${packageJson.version}"`, }, }); diff --git a/src/renderer/api/navidrome/navidrome-api.ts b/src/renderer/api/navidrome/navidrome-api.ts index 0db59de7..9323e0e1 100644 --- a/src/renderer/api/navidrome/navidrome-api.ts +++ b/src/renderer/api/navidrome/navidrome-api.ts @@ -266,6 +266,7 @@ export const ndApiClient = (args: { }); return { body: { data: result.data, headers: result.headers }, + headers: result.headers as any, status: result.status, }; } catch (e: Error | AxiosError | any) { @@ -274,6 +275,7 @@ export const ndApiClient = (args: { const response = error.response as AxiosResponse; return { body: { data: response.data, headers: response.headers }, + headers: response.headers as any, status: response.status, }; } diff --git a/src/renderer/api/subsonic/subsonic-api.ts b/src/renderer/api/subsonic/subsonic-api.ts index 29cf4156..05855161 100644 --- a/src/renderer/api/subsonic/subsonic-api.ts +++ b/src/renderer/api/subsonic/subsonic-api.ts @@ -178,6 +178,7 @@ export const ssApiClient = (args: { return { body: result.data['subsonic-response'], + headers: result.headers as any, status: result.status, }; } catch (e: Error | AxiosError | any) { @@ -187,10 +188,9 @@ export const ssApiClient = (args: { const error = e as AxiosError; const response = error.response as AxiosResponse; - console.log(response, 'response'); - return { body: response?.data, + headers: response.headers as any, status: response?.status, }; }