@jellyfin/sdk 0.0.0-unstable.202510281351 → 0.0.0-unstable.202510281540
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 +18 -3
- package/README.md +6 -8
- 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,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.13.0] - 2025-10-28
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
* Ensure `Authorization` header is sent for all requests ([#948](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/948)).
|
|
15
|
+
|
|
16
|
+
### Deprecated
|
|
17
|
+
|
|
18
|
+
* Deprecate authentication helper methods in `Api` class ([#949](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/948)).
|
|
19
|
+
Updating the `accessToken` is now handled transparently in `getUserApi` and `getSessionApi`. If you need to handle
|
|
20
|
+
authentication manually, then you should manually create `UserApi` and `SessionApi` instances.
|
|
21
|
+
|
|
10
22
|
## [0.12.0] - 2025-10-21
|
|
11
23
|
|
|
12
24
|
### Security
|
|
13
25
|
|
|
14
|
-
* Bumped axios peer dependency version ([#939](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/939)).
|
|
26
|
+
* Bumped axios peer dependency version ([#939](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/939)).
|
|
27
|
+
Note that this axios vulnerability only affected applications running in node.js.
|
|
15
28
|
|
|
16
29
|
### Added
|
|
17
30
|
|
|
@@ -81,7 +94,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
81
94
|
* API classes are no longer exposed via getters.
|
|
82
95
|
Instead you need to call a function passing the `Api` instance as a parameter.
|
|
83
96
|
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
|
|
97
|
+
While I do feel this is a slightly worse developer experience, it was a necessary change to support tree-shaking
|
|
98
|
+
([#149](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/149)).
|
|
85
99
|
* `BaseItemKind` is now included in the generated client.
|
|
86
100
|
Imports will need updated ([#187](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/187)).
|
|
87
101
|
|
|
@@ -106,7 +120,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
106
120
|
|
|
107
121
|
## [0.1.0] - 2021-09-19
|
|
108
122
|
|
|
109
|
-
[unreleased]: https://github.com/jellyfin/jellyfin-sdk-typescript/compare/v0.
|
|
123
|
+
[unreleased]: https://github.com/jellyfin/jellyfin-sdk-typescript/compare/v0.13.0...HEAD
|
|
124
|
+
[0.13.0]: https://github.com/jellyfin/jellyfin-sdk-typescript/compare/v0.12.0...v0.13.0
|
|
110
125
|
[0.12.0]: https://github.com/jellyfin/jellyfin-sdk-typescript/compare/v0.11.0...v0.12.0
|
|
111
126
|
[0.11.0]: https://github.com/jellyfin/jellyfin-sdk-typescript/compare/v0.10.0...v0.11.0
|
|
112
127
|
[0.10.0]: https://github.com/jellyfin/jellyfin-sdk-typescript/compare/v0.9.0...v0.10.0
|
package/README.md
CHANGED
|
@@ -35,6 +35,7 @@ yarn add @jellyfin/sdk
|
|
|
35
35
|
|
|
36
36
|
| SDK Version | Jellyfin Version |
|
|
37
37
|
|:-:|:-:|
|
|
38
|
+
| 0.13.0 | 10.11.x |
|
|
38
39
|
| 0.12.0 | 10.11.x |
|
|
39
40
|
| 0.11.0 | 10.10.x |
|
|
40
41
|
| 0.10.0 | 10.9.x |
|
|
@@ -92,10 +93,8 @@ console.log('Info =>', info.data);
|
|
|
92
93
|
const users = await getUserApi(api).getPublicUsers();
|
|
93
94
|
console.log('Users =>', users.data);
|
|
94
95
|
|
|
95
|
-
//
|
|
96
|
-
|
|
97
|
-
// cumbersome to use.
|
|
98
|
-
const auth = await api.authenticateUserByName('demo', '');
|
|
96
|
+
// Login with a username and password.
|
|
97
|
+
const auth = await getUserApi(this).authenticateUserByName({ authenticateUserByName: { Username: 'demo', Pw: '' } });
|
|
99
98
|
console.log('Auth =>', auth.data);
|
|
100
99
|
|
|
101
100
|
// Authentication state is stored internally in the Api class, so now
|
|
@@ -103,12 +102,11 @@ console.log('Auth =>', auth.data);
|
|
|
103
102
|
const libraries = await getLibraryApi(api).getMediaFolders();
|
|
104
103
|
console.log('Libraries =>', libraries.data);
|
|
105
104
|
|
|
106
|
-
//
|
|
107
|
-
|
|
108
|
-
await api.logout();
|
|
105
|
+
// Logout the current user.
|
|
106
|
+
await getSessionApi(api).reportSessionEnded();
|
|
109
107
|
```
|
|
110
108
|
|
|
111
|
-
##
|
|
109
|
+
## Significant Changes
|
|
112
110
|
|
|
113
111
|
[See the CHANGELOG](./CHANGELOG.md)
|
|
114
112
|
|
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.202510281540+commit.c32eac527c345a6f2db38c23d99cf8f1ff311e33",
|
|
4
4
|
"description": "A TypeScript SDK for Jellyfin.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jellyfin"
|