Bump ts-rest

This commit is contained in:
jeffvli 2023-06-03 03:51:44 -07:00
parent f58552be84
commit 5295c69f46
6 changed files with 19 additions and 12 deletions

14
package-lock.json generated
View file

@ -25,7 +25,7 @@
"@mantine/utils": "^6.0.13", "@mantine/utils": "^6.0.13",
"@tanstack/react-query": "^4.29.5", "@tanstack/react-query": "^4.29.5",
"@tanstack/react-query-devtools": "^4.29.6", "@tanstack/react-query-devtools": "^4.29.6",
"@ts-rest/core": "^3.22.0", "@ts-rest/core": "^3.23.0",
"axios": "^1.4.0", "axios": "^1.4.0",
"cmdk": "^0.2.0", "cmdk": "^0.2.0",
"dayjs": "^1.11.6", "dayjs": "^1.11.6",
@ -3094,9 +3094,9 @@
} }
}, },
"node_modules/@ts-rest/core": { "node_modules/@ts-rest/core": {
"version": "3.22.0", "version": "3.23.0",
"resolved": "https://registry.npmjs.org/@ts-rest/core/-/core-3.22.0.tgz", "resolved": "https://registry.npmjs.org/@ts-rest/core/-/core-3.23.0.tgz",
"integrity": "sha512-65FhsjhdQntITzUwB2M8CTz8bdODwNmVHMBIQiXTZrkmzxA0YiyrShotkDrorSNH9IspU+qavb82ZVlU9ZdWnQ==", "integrity": "sha512-2vJwa682m9yS/xQPvPxZBluJfIZwNkt2HY9ER3UtGnu8Dijw+8iymSyIyjRLpFFWUyRnVp9IqrEi/d84bkNFIw==",
"peerDependencies": { "peerDependencies": {
"zod": "^3.0.0" "zod": "^3.0.0"
}, },
@ -25728,9 +25728,9 @@
"dev": true "dev": true
}, },
"@ts-rest/core": { "@ts-rest/core": {
"version": "3.22.0", "version": "3.23.0",
"resolved": "https://registry.npmjs.org/@ts-rest/core/-/core-3.22.0.tgz", "resolved": "https://registry.npmjs.org/@ts-rest/core/-/core-3.23.0.tgz",
"integrity": "sha512-65FhsjhdQntITzUwB2M8CTz8bdODwNmVHMBIQiXTZrkmzxA0YiyrShotkDrorSNH9IspU+qavb82ZVlU9ZdWnQ==", "integrity": "sha512-2vJwa682m9yS/xQPvPxZBluJfIZwNkt2HY9ER3UtGnu8Dijw+8iymSyIyjRLpFFWUyRnVp9IqrEi/d84bkNFIw==",
"requires": {} "requires": {}
}, },
"@tsconfig/node10": { "@tsconfig/node10": {

View file

@ -263,7 +263,7 @@
"@mantine/utils": "^6.0.13", "@mantine/utils": "^6.0.13",
"@tanstack/react-query": "^4.29.5", "@tanstack/react-query": "^4.29.5",
"@tanstack/react-query-devtools": "^4.29.6", "@tanstack/react-query-devtools": "^4.29.6",
"@ts-rest/core": "^3.22.0", "@ts-rest/core": "^3.23.0",
"axios": "^1.4.0", "axios": "^1.4.0",
"cmdk": "^0.2.0", "cmdk": "^0.2.0",
"dayjs": "^1.11.6", "dayjs": "^1.11.6",

View file

@ -23,6 +23,9 @@ export const contract = c.router({
}, },
authenticate: { authenticate: {
body: jfType._parameters.authenticate, body: jfType._parameters.authenticate,
headers: z.object({
'X-Emby-Authorization': z.string(),
}),
method: 'POST', method: 'POST',
path: 'users/authenticatebyname', path: 'users/authenticatebyname',
responses: { responses: {
@ -324,6 +327,7 @@ export const jfApiClient = (args: {
}); });
return { return {
body: result.data, body: result.data,
headers: result.headers as any,
status: result.status, status: result.status,
}; };
} catch (e: Error | AxiosError | any) { } catch (e: Error | AxiosError | any) {
@ -331,7 +335,8 @@ export const jfApiClient = (args: {
const error = e as AxiosError; const error = e as AxiosError;
const response = error.response as AxiosResponse; const response = error.response as AxiosResponse;
return { return {
body: response.data, body: response?.data,
headers: response?.headers as any,
status: response.status, status: response.status,
}; };
} }

View file

@ -71,7 +71,7 @@ const authenticate = async (
Username: body.username, Username: body.username,
}, },
headers: { 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}"`,
}, },
}); });

View file

@ -266,6 +266,7 @@ export const ndApiClient = (args: {
}); });
return { return {
body: { data: result.data, headers: result.headers }, body: { data: result.data, headers: result.headers },
headers: result.headers as any,
status: result.status, status: result.status,
}; };
} catch (e: Error | AxiosError | any) { } catch (e: Error | AxiosError | any) {
@ -274,6 +275,7 @@ export const ndApiClient = (args: {
const response = error.response as AxiosResponse; const response = error.response as AxiosResponse;
return { return {
body: { data: response.data, headers: response.headers }, body: { data: response.data, headers: response.headers },
headers: response.headers as any,
status: response.status, status: response.status,
}; };
} }

View file

@ -178,6 +178,7 @@ export const ssApiClient = (args: {
return { return {
body: result.data['subsonic-response'], body: result.data['subsonic-response'],
headers: result.headers as any,
status: result.status, status: result.status,
}; };
} catch (e: Error | AxiosError | any) { } catch (e: Error | AxiosError | any) {
@ -187,10 +188,9 @@ export const ssApiClient = (args: {
const error = e as AxiosError; const error = e as AxiosError;
const response = error.response as AxiosResponse; const response = error.response as AxiosResponse;
console.log(response, 'response');
return { return {
body: response?.data, body: response?.data,
headers: response.headers as any,
status: response?.status, status: response?.status,
}; };
} }