@jellyfin/sdk 0.12.0 → 0.13.0

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 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)). Note that this axios vulnerability only affected applications running in node.js.
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 ([#149](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/149)).
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.12.0...HEAD
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
- // A helper method for authentication has been added to the SDK because
96
- // the default method exposed in the generated Axios client is rather
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
- // A helper method for logging out the current user has been added to the
107
- // SDK so the internal state is updated correctly.
108
- await api.logout();
105
+ // Logout the current user.
106
+ await getSessionApi(api).reportSessionEnded();
109
107
  ```
110
108
 
111
- ## Breaking Changes
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 and updating the internal state.
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 and updating the internal state.
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
@@ -19,24 +19,23 @@ class Api {
19
19
  get configuration() {
20
20
  return new Configuration({
21
21
  basePath: this.basePath,
22
- apiKey: this.authorizationHeader
22
+ baseOptions: {
23
+ headers: {
24
+ [AUTHORIZATION_HEADER]: this.authorizationHeader
25
+ }
26
+ }
23
27
  });
24
28
  }
25
29
  /**
26
- * Convenience method for authenticating a user by name and updating the internal state.
30
+ * Convenience method for authenticating a user by name.
31
+ * @deprecated Use `getUserApi().authenticateUserByName()` instead.
27
32
  * @param username The username.
28
33
  * @param password The user password if required.
29
34
  */
30
35
  authenticateUserByName(username, password) {
31
36
  return getUserApi(this).authenticateUserByName(
32
37
  // The axios client does some strange wrapping of the param object
33
- { authenticateUserByName: { Username: username, Pw: password } },
34
- // The authorization header is required for the request to succeed
35
- { headers: { [AUTHORIZATION_HEADER]: this.authorizationHeader } }).then(response => {
36
- // Update the current token and configuration object
37
- this.accessToken = response.data.AccessToken || '';
38
- return response;
39
- });
38
+ { authenticateUserByName: { Username: username, Pw: password } });
40
39
  }
41
40
  /**
42
41
  * Gets a full URI for a relative URL to the Jellyfin server for a given SDK Api instance.
@@ -52,13 +51,11 @@ class Api {
52
51
  });
53
52
  }
54
53
  /**
55
- * Convenience method for logging out and updating the internal state.
54
+ * Convenience method for logging out.
55
+ * @deprecated Use `getSessionApi().reportSessionEnded()` instead.
56
56
  */
57
57
  logout() {
58
- return getSessionApi(this).reportSessionEnded().then(response => {
59
- this.accessToken = '';
60
- return response;
61
- });
58
+ return getSessionApi(this).reportSessionEnded();
62
59
  }
63
60
  get authorizationHeader() {
64
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 SessionApi(api.configuration, undefined, api.axiosInstance);
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 UserApi(api.configuration, undefined, api.axiosInstance);
34
+ return new AugmentedUserApi(api);
10
35
  }
11
36
 
12
37
  export { getUserApi };
package/lib/versions.d.ts CHANGED
@@ -4,6 +4,6 @@
4
4
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
5
  */
6
6
  /** The current API version of the generated client. */
7
- export declare const API_VERSION = "10.11.0";
7
+ export declare const API_VERSION = "10.11.1";
8
8
  /** The minimum supported server version. */
9
9
  export declare const MINIMUM_VERSION = "10.10.0";
package/lib/versions.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
5
  */
6
6
  /** The current API version of the generated client. */
7
- const API_VERSION = '10.11.0';
7
+ const API_VERSION = '10.11.1';
8
8
  /** The minimum supported server version. */
9
9
  const MINIMUM_VERSION = '10.10.0';
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jellyfin/sdk",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "A TypeScript SDK for Jellyfin.",
5
5
  "keywords": [
6
6
  "jellyfin"
@@ -30,15 +30,16 @@
30
30
  "@rollup/plugin-typescript": "12.1.4",
31
31
  "@stylistic/eslint-plugin": "2.13.0",
32
32
  "@tsconfig/recommended": "1.0.10",
33
- "@typescript-eslint/eslint-plugin": "8.46.1",
34
- "@typescript-eslint/parser": "8.46.1",
33
+ "@types/node": "24.9.1",
34
+ "@typescript-eslint/eslint-plugin": "8.46.2",
35
+ "@typescript-eslint/parser": "8.46.2",
35
36
  "@vitest/coverage-v8": "3.2.4",
36
37
  "@vitest/eslint-plugin": "1.3.23",
37
38
  "eslint": "8.57.1",
38
39
  "eslint-plugin-import": "2.32.0",
39
40
  "glob": "11.0.3",
40
41
  "rimraf": "5.0.10",
41
- "rollup": "4.52.4",
42
+ "rollup": "4.52.5",
42
43
  "typedoc": "0.28.14",
43
44
  "typescript": "5.9.3",
44
45
  "vitest": "3.2.4"