@ctrl/plex 2.0.0 → 2.1.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/dist/src/alert.js CHANGED
@@ -8,6 +8,7 @@ export class AlertListener {
8
8
  async run() {
9
9
  const url = this.server.url(this.key, true).toString().replace('http', 'ws');
10
10
  this._ws = new WebSocket(url);
11
+ // eslint-disable-next-line @typescript-eslint/ban-types
11
12
  this._ws.on('message', (buffer) => {
12
13
  try {
13
14
  const data = JSON.parse(buffer.toString());
@@ -1,7 +1,7 @@
1
1
  export declare const PROJECT = "PlexAPI";
2
2
  export declare const VERSION = "3.3.0";
3
3
  export declare const TIMEOUT = 30000;
4
- export declare const X_PLEX_CONTAINER_SIZE: 100;
4
+ export declare const X_PLEX_CONTAINER_SIZE = 100;
5
5
  export declare const X_PLEX_ENABLE_FAST_CONNECT: false;
6
6
  export declare const X_PLEX_PROVIDES = "controller";
7
7
  export declare const X_PLEX_PLATFORM: string;
@@ -357,7 +357,7 @@ export declare abstract class LibrarySection<SectionVideoType = VideoType> exten
357
357
  * Returns a list of playlists from this library section.
358
358
  */
359
359
  playlists(): Promise<Playlist[]>;
360
- collections(args?: Record<string, number | string | boolean>): Promise<Array<Collections<SectionVideoType>>>;
360
+ collections(args?: Record<string, number | string | boolean>): Promise<Collections<SectionVideoType>[]>;
361
361
  /**
362
362
  * Returns a list of available Folders for this library section.
363
363
  */
@@ -234,9 +234,7 @@ export class MyPlexResource {
234
234
  this._loadData(data);
235
235
  }
236
236
  async connect(ssl = null, timeout) {
237
- const connections = [...this.connections].sort((a, b) => {
238
- return Number(b.local) - Number(a.local);
239
- });
237
+ const connections = [...this.connections].sort((a, b) => Number(b.local) - Number(a.local));
240
238
  const ownedOrUnownedNonLocal = (connection) => {
241
239
  if (this.owned || (!this.owned && !connection.local)) {
242
240
  return true;
@@ -179,6 +179,7 @@ export class PlexServer {
179
179
  * you're likley to recieve an authentication error calling this.
180
180
  */
181
181
  myPlexAccount() {
182
+ // eslint-disable-next-line logical-assignment-operators
182
183
  if (!this._myPlexAccount) {
183
184
  this._myPlexAccount = new MyPlexAccount(this.baseurl, undefined, undefined, this.token, this.timeout, this);
184
185
  }
@@ -198,6 +199,7 @@ export class PlexServer {
198
199
  }
199
200
  for (const server of response.MediaContainer.Server) {
200
201
  let { port } = server;
202
+ // eslint-disable-next-line logical-assignment-operators
201
203
  if (!port) {
202
204
  // TODO: print warning about doing weird port stuff
203
205
  port = Number(ports?.[server.machineIdentifier]);
@@ -55,6 +55,7 @@ export class Settings extends PlexObject {
55
55
  }
56
56
  _loadData(data) {
57
57
  this._data = data;
58
+ // eslint-disable-next-line logical-assignment-operators
58
59
  this._settings = this._settings ?? {};
59
60
  for (const elem of data) {
60
61
  const id = lowerFirst(elem.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrl/plex",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "plex api client in typescript",
5
5
  "author": "Scott Cooper <scttcper@gmail.com>",
6
6
  "publishConfig": {
@@ -20,8 +20,12 @@
20
20
  "typescript"
21
21
  ],
22
22
  "scripts": {
23
- "lint": "eslint --ext .ts .",
24
- "lint:fix": "eslint --fix --ext .ts .",
23
+ "lint": "pnpm run '/^(lint:biome|lint:eslint)$/'",
24
+ "lint:biome": "biome check .",
25
+ "lint:eslint": "eslint --ext .ts,.tsx .",
26
+ "lint:fix": "pnpm run '/^(lint:biome|lint:eslint):fix$/'",
27
+ "lint:eslint:fix": "eslint --ext .ts,.tsx . --fix",
28
+ "lint:biome:fix": "biome check . --apply",
25
29
  "prepare": "npm run build",
26
30
  "build": "tsc",
27
31
  "build:docs": "typedoc",
@@ -37,12 +41,13 @@
37
41
  "@ctrl/mac-address": "^3.0.3",
38
42
  "got": "^13.0.0",
39
43
  "p-any": "^4.0.0",
40
- "type-fest": "^4.15.0",
44
+ "type-fest": "^4.16.0",
41
45
  "ws": "^8.16.0",
42
46
  "xml2js": "^0.6.2"
43
47
  },
44
48
  "devDependencies": {
45
- "@ctrl/eslint-config": "4.0.14",
49
+ "@biomejs/biome": "1.7.1",
50
+ "@ctrl/eslint-config-biome": "2.6.5",
46
51
  "@sindresorhus/tsconfig": "5.0.0",
47
52
  "@types/lodash": "4.17.0",
48
53
  "@types/micromatch": "4.0.7",
@@ -50,8 +55,9 @@
50
55
  "@types/ws": "8.5.10",
51
56
  "@types/xml2js": "0.4.14",
52
57
  "@types/yargs": "17.0.32",
53
- "@vitest/coverage-v8": "^1.5.0",
58
+ "@vitest/coverage-v8": "1.5.0",
54
59
  "delay": "6.0.0",
60
+ "eslint": "8.57.0",
55
61
  "execa": "8.0.1",
56
62
  "glob": "10.3.12",
57
63
  "globby": "14.0.1",
@@ -71,6 +77,6 @@
71
77
  ]
72
78
  },
73
79
  "engines": {
74
- "node": ">=16.10"
80
+ "node": ">=18"
75
81
  }
76
82
  }