@jellyfin/sdk 0.0.0-unstable.202510281351 → 0.0.0-unstable.202510281431
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -2
- package/lib/api.d.ts +4 -2
- package/lib/api.js +6 -11
- package/lib/utils/api/session-api.js +16 -1
- package/lib/utils/api/user-api.js +26 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,11 +7,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
* Ensure `Authorization` header is sent for all requests ([#948](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/948)).
|
|
13
|
+
|
|
14
|
+
### Deprecated
|
|
15
|
+
|
|
16
|
+
* Deprecate authentication helper methods in `Api` class ([#949](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/948)).
|
|
17
|
+
Updating the `accessToken` is now handled transparently in `getUserApi` and `getSessionApi`. If you need to handle
|
|
18
|
+
authentication manually, then you should manually create `UserApi` and `SessionApi` instances.
|
|
19
|
+
|
|
10
20
|
## [0.12.0] - 2025-10-21
|
|
11
21
|
|
|
12
22
|
### Security
|
|
13
23
|
|
|
14
|
-
* Bumped axios peer dependency version ([#939](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/939)).
|
|
24
|
+
* Bumped axios peer dependency version ([#939](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/939)).
|
|
25
|
+
Note that this axios vulnerability only affected applications running in node.js.
|
|
15
26
|
|
|
16
27
|
### Added
|
|
17
28
|
|
|
@@ -81,7 +92,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
81
92
|
* API classes are no longer exposed via getters.
|
|
82
93
|
Instead you need to call a function passing the `Api` instance as a parameter.
|
|
83
94
|
For example: `getSystemApi(api)`.
|
|
84
|
-
While I do feel this is a slightly worse developer experience, it was a necessary change to support tree-shaking
|
|
95
|
+
While I do feel this is a slightly worse developer experience, it was a necessary change to support tree-shaking
|
|
96
|
+
([#149](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/149)).
|
|
85
97
|
* `BaseItemKind` is now included in the generated client.
|
|
86
98
|
Imports will need updated ([#187](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/187)).
|
|
87
99
|
|
package/lib/api.d.ts
CHANGED
|
@@ -19,7 +19,8 @@ export declare class Api {
|
|
|
19
19
|
constructor(basePath: string, clientInfo: ClientInfo, deviceInfo: DeviceInfo, accessToken?: string, axiosInstance?: AxiosInstance);
|
|
20
20
|
get configuration(): Configuration;
|
|
21
21
|
/**
|
|
22
|
-
* Convenience method for authenticating a user by name
|
|
22
|
+
* Convenience method for authenticating a user by name.
|
|
23
|
+
* @deprecated Use `getUserApi().authenticateUserByName()` instead.
|
|
23
24
|
* @param username The username.
|
|
24
25
|
* @param password The user password if required.
|
|
25
26
|
*/
|
|
@@ -32,7 +33,8 @@ export declare class Api {
|
|
|
32
33
|
*/
|
|
33
34
|
getUri(url: string, params?: object): string;
|
|
34
35
|
/**
|
|
35
|
-
* Convenience method for logging out
|
|
36
|
+
* Convenience method for logging out.
|
|
37
|
+
* @deprecated Use `getSessionApi().reportSessionEnded()` instead.
|
|
36
38
|
*/
|
|
37
39
|
logout(): Promise<AxiosResponse<never> | AxiosResponse<void>>;
|
|
38
40
|
get authorizationHeader(): string;
|
package/lib/api.js
CHANGED
|
@@ -27,18 +27,15 @@ class Api {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* Convenience method for authenticating a user by name
|
|
30
|
+
* Convenience method for authenticating a user by name.
|
|
31
|
+
* @deprecated Use `getUserApi().authenticateUserByName()` instead.
|
|
31
32
|
* @param username The username.
|
|
32
33
|
* @param password The user password if required.
|
|
33
34
|
*/
|
|
34
35
|
authenticateUserByName(username, password) {
|
|
35
36
|
return getUserApi(this).authenticateUserByName(
|
|
36
37
|
// The axios client does some strange wrapping of the param object
|
|
37
|
-
{ authenticateUserByName: { Username: username, Pw: password } })
|
|
38
|
-
// Update the current token and configuration object
|
|
39
|
-
this.accessToken = response.data.AccessToken || '';
|
|
40
|
-
return response;
|
|
41
|
-
});
|
|
38
|
+
{ authenticateUserByName: { Username: username, Pw: password } });
|
|
42
39
|
}
|
|
43
40
|
/**
|
|
44
41
|
* Gets a full URI for a relative URL to the Jellyfin server for a given SDK Api instance.
|
|
@@ -54,13 +51,11 @@ class Api {
|
|
|
54
51
|
});
|
|
55
52
|
}
|
|
56
53
|
/**
|
|
57
|
-
* Convenience method for logging out
|
|
54
|
+
* Convenience method for logging out.
|
|
55
|
+
* @deprecated Use `getSessionApi().reportSessionEnded()` instead.
|
|
58
56
|
*/
|
|
59
57
|
logout() {
|
|
60
|
-
return getSessionApi(this).reportSessionEnded()
|
|
61
|
-
this.accessToken = '';
|
|
62
|
-
return response;
|
|
63
|
-
});
|
|
58
|
+
return getSessionApi(this).reportSessionEnded();
|
|
64
59
|
}
|
|
65
60
|
get authorizationHeader() {
|
|
66
61
|
return getAuthorizationHeader(this.clientInfo, this.deviceInfo, this.accessToken);
|
|
@@ -5,8 +5,23 @@ import { SessionApi } from '../../generated-client/api/session-api.js';
|
|
|
5
5
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
6
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
7
7
|
*/
|
|
8
|
+
/** An augmented SessionApi that updates the state of the access token in the Api instance. */
|
|
9
|
+
class AugmentedSessionApi extends SessionApi {
|
|
10
|
+
constructor(api) {
|
|
11
|
+
super(api.configuration, undefined, api.axiosInstance);
|
|
12
|
+
this.api = api;
|
|
13
|
+
}
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
15
|
+
reportSessionEnded(options) {
|
|
16
|
+
return super.reportSessionEnded(options)
|
|
17
|
+
.then(response => {
|
|
18
|
+
this.api.accessToken = '';
|
|
19
|
+
return response;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
8
23
|
function getSessionApi(api) {
|
|
9
|
-
return new
|
|
24
|
+
return new AugmentedSessionApi(api);
|
|
10
25
|
}
|
|
11
26
|
|
|
12
27
|
export { getSessionApi };
|
|
@@ -5,8 +5,33 @@ import { UserApi } from '../../generated-client/api/user-api.js';
|
|
|
5
5
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
6
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
7
7
|
*/
|
|
8
|
+
/** An augmented UserApi that updates the state of the access token in the Api instance. */
|
|
9
|
+
class AugmentedUserApi extends UserApi {
|
|
10
|
+
constructor(api) {
|
|
11
|
+
super(api.configuration, undefined, api.axiosInstance);
|
|
12
|
+
this.api = api;
|
|
13
|
+
}
|
|
14
|
+
authenticateUserByName(requestParameters, options
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
16
|
+
) {
|
|
17
|
+
return super.authenticateUserByName(requestParameters, options)
|
|
18
|
+
.then(response => {
|
|
19
|
+
this.api.accessToken = response.data.AccessToken || '';
|
|
20
|
+
return response;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
authenticateWithQuickConnect(requestParameters, options
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
25
|
+
) {
|
|
26
|
+
return super.authenticateWithQuickConnect(requestParameters, options)
|
|
27
|
+
.then(response => {
|
|
28
|
+
this.api.accessToken = response.data.AccessToken || '';
|
|
29
|
+
return response;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
8
33
|
function getUserApi(api) {
|
|
9
|
-
return new
|
|
34
|
+
return new AugmentedUserApi(api);
|
|
10
35
|
}
|
|
11
36
|
|
|
12
37
|
export { getUserApi };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jellyfin/sdk",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.202510281431+commit.cee2d235547bdd73ae23661cce21c10aa20eaca0",
|
|
4
4
|
"description": "A TypeScript SDK for Jellyfin.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jellyfin"
|