@ctrl/plex 3.4.0 → 3.5.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/README.md CHANGED
@@ -105,7 +105,8 @@ npm run test-cleanup
105
105
  get a claim token from https://www.plex.tv/claim/
106
106
  export PLEX_CLAIM_TOKEN=claim-token
107
107
 
108
- ```
108
+ start plex container for testing
109
+ ```console
109
110
  docker run -d \
110
111
  --name=plex \
111
112
  --net=host \
@@ -132,7 +133,12 @@ docker run -d \
132
133
  lscr.io/linuxserver/plex:latest
133
134
  ```
134
135
 
135
- bootstrap media
136
+ Pull latest plex container if needed
137
+ ```console
138
+ docker pull lscr.io/linuxserver/plex:latest
136
139
  ```
137
- NODE_OPTIONS="--loader ts-node/esm" node scripts/bootstraptest.ts --no-docker --server-name=orbstack`
140
+
141
+ bootstrap plex server with test media
142
+ ```console
143
+ NODE_OPTIONS="--loader ts-node/esm" node scripts/bootstraptest.ts --no-docker --server-name=orbstack --password=$PLEX_PASSWORD --username=$PLEX_USERNAME
138
144
  ```
@@ -1,6 +1,6 @@
1
1
  import WebSocket from 'ws';
2
- import { AlertTypes } from './alert.types.js';
3
- import { PlexServer } from './server.js';
2
+ import type { AlertTypes } from './alert.types.js';
3
+ import type { PlexServer } from './server.js';
4
4
  export declare class AlertListener {
5
5
  private readonly server;
6
6
  callback: (data: AlertTypes) => void;
@@ -1,5 +1,5 @@
1
1
  import { URL } from 'url';
2
- import { Player } from './client.types.js';
2
+ import type { Player } from './client.types.js';
3
3
  export interface PlexOptions {
4
4
  /** (:class:`~plexapi.server.PlexServer`): PlexServer this client is connected to (optional). */
5
5
  server?: any;
@@ -1,12 +1,12 @@
1
- import { Class } from 'type-fest';
1
+ import type { Class } from 'type-fest';
2
2
  import { PartialPlexObject } from './base/partialPlexObject.js';
3
3
  import { PlexObject } from './base/plexObject.js';
4
- import { CollectionData, LibraryRootResponse, Location, SectionsDirectory } from './library.types.js';
4
+ import type { CollectionData, LibraryRootResponse, Location, SectionsDirectory } from './library.types.js';
5
5
  import { Playlist } from './playlist.js';
6
- import { Agent, SEARCHTYPES } from './search.js';
7
- import { SearchResult } from './search.types.js';
6
+ import { type Agent, type SEARCHTYPES } from './search.js';
7
+ import type { SearchResult } from './search.types.js';
8
8
  import type { PlexServer } from './server.js';
9
- import { Movie, Show, VideoType } from './video.js';
9
+ import { Movie, Show, type VideoType } from './video.js';
10
10
  export type Section = MovieSection | ShowSection;
11
11
  export declare class Library {
12
12
  private readonly server;
@@ -364,7 +364,7 @@ export declare abstract class LibrarySection<SectionVideoType = VideoType> exten
364
364
  folders(): Promise<Folder[]>;
365
365
  genres(): Promise<FilterChoice[]>;
366
366
  /**
367
- * Returns a list of available {@link FilteringFields} for a specified libtype.
367
+ * Returns a list of available {@link FilteringField} for a specified libtype.
368
368
  * This is the list of options in the custom filter dropdown menu
369
369
  */
370
370
  listFields(libtype?: Libtype): Promise<FilteringField[]>;
@@ -483,7 +483,7 @@ export class LibrarySection extends PlexObject {
483
483
  return fetchItems(this.server, key, undefined, FilterChoice);
484
484
  }
485
485
  /**
486
- * Returns a list of available {@link FilteringFields} for a specified libtype.
486
+ * Returns a list of available {@link FilteringField} for a specified libtype.
487
487
  * This is the list of options in the custom filter dropdown menu
488
488
  */
489
489
  async listFields(libtype = this.type) {
@@ -494,7 +494,7 @@ export class LibrarySection extends PlexObject {
494
494
  const filter = filterTypes.find(f => f.type === libtype);
495
495
  if (!filter) {
496
496
  throw new NotFound(`Unknown libtype "${libtype}" for this library.
497
- Available libtypes: ${filterTypes.join(', ')}`);
497
+ Available libtypes: ${filterTypes.map(f => f.type).join(', ')}`);
498
498
  }
499
499
  return filter;
500
500
  }
@@ -1,4 +1,4 @@
1
- import { ChapterSource, MarkerData, MediaTagData } from './video.types.js';
1
+ import type { ChapterSource, MarkerData, MediaTagData } from './video.types.js';
2
2
  export interface LibraryRootResponse {
3
3
  size: number;
4
4
  allowSync: boolean;
@@ -1,5 +1,5 @@
1
1
  import { PlexObject } from './base/plexObject.js';
2
- import { ChapterData, MarkerData, MediaData, MediaPartData, MediaPartStreamData } from './video.types.js';
2
+ import type { ChapterData, MarkerData, MediaData, MediaPartData, MediaPartStreamData } from './video.types.js';
3
3
  /**
4
4
  * Base class for media tags used for filtering and searching your library
5
5
  * items or navigating the metadata of media items in your library. Tags are
package/dist/src/media.js CHANGED
@@ -186,7 +186,6 @@ class GuidTag extends PlexObject {
186
186
  this.id = data.id;
187
187
  }
188
188
  }
189
- // biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
190
189
  export class Guid extends GuidTag {
191
190
  static { this.TAG = 'Guid'; }
192
191
  }
@@ -235,21 +234,18 @@ class BaseResource extends PlexObject {
235
234
  /**
236
235
  * Represents a single Art object.
237
236
  */
238
- // biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
239
237
  export class Art extends BaseResource {
240
238
  static { this.TAG = 'Art'; }
241
239
  }
242
240
  /**
243
241
  * Represents a single Poster object.
244
242
  */
245
- // biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
246
243
  export class Poster extends BaseResource {
247
244
  static { this.TAG = 'Photo'; }
248
245
  }
249
246
  /**
250
247
  * Represents a single Theme object.
251
248
  */
252
- // biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
253
249
  export class Theme extends BaseResource {
254
250
  static { this.TAG = 'Theme'; }
255
251
  }
@@ -133,7 +133,6 @@ export class MyPlexAccount {
133
133
  this._loadData(data);
134
134
  return this;
135
135
  }
136
- // log('Logging in with token');
137
136
  const data = await this.query(MyPlexAccount.key);
138
137
  this._loadData(data);
139
138
  return this;
@@ -1,8 +1,8 @@
1
1
  import { Playable } from './base/playable.js';
2
2
  import type { Section } from './library.js';
3
- import { PlaylistResponse } from './playlist.types.js';
3
+ import type { PlaylistResponse } from './playlist.types.js';
4
4
  import type { PlexServer } from './server.js';
5
- import { Episode, Movie, VideoType } from './video.js';
5
+ import { Episode, Movie, type VideoType } from './video.js';
6
6
  interface CreateRegularPlaylistOptions {
7
7
  /** True to create a smart playlist */
8
8
  smart?: false;
@@ -1,6 +1,6 @@
1
- import { ValueOf } from 'type-fest';
1
+ import type { ValueOf } from 'type-fest';
2
2
  import { PlexObject } from './base/plexObject.js';
3
- import { MatchSearchResult } from './search.types.js';
3
+ import type { MatchSearchResult } from './search.types.js';
4
4
  export declare class SearchResult extends PlexObject {
5
5
  static TAG: string;
6
6
  guid: string;
@@ -4,7 +4,7 @@ import { Hub, Library } from './library.js';
4
4
  import { Optimized } from './media.js';
5
5
  import { MyPlexAccount } from './myplex.js';
6
6
  import { Agent, SEARCHTYPES } from './search.js';
7
- import { HistoryMetadatum } from './server.types.js';
7
+ import type { HistoryMetadatum } from './server.types.js';
8
8
  import { Settings } from './settings.js';
9
9
  /**
10
10
  * This is the main entry point to interacting with a Plex server. It allows you to
@@ -1,8 +1,8 @@
1
- import { URL } from 'url';
1
+ import type { URL } from 'url';
2
2
  import { Playable } from './base/playable.js';
3
- import { ExtrasData, FullShowData, MovieData, ShowData } from './library.types.js';
3
+ import type { ExtrasData, FullShowData, MovieData, ShowData } from './library.types.js';
4
4
  import { Chapter, Collection, Country, Director, Genre, Guid, Marker, Media, Poster, Producer, Rating, Role, Similar, Writer } from './media.js';
5
- import { ChapterSource, EpisodeMetadata, FullMovieResponse } from './video.types.js';
5
+ import type { ChapterSource, EpisodeMetadata, FullMovieResponse } from './video.types.js';
6
6
  export type VideoType = Movie | Show;
7
7
  declare abstract class Video extends Playable {
8
8
  /** Datetime this item was added to the library. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrl/plex",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "plex api client in typescript",
5
5
  "author": "Scott Cooper <scttcper@gmail.com>",
6
6
  "publishConfig": {
@@ -37,32 +37,32 @@
37
37
  "test-cleanup": "node --loader ts-node/esm scripts/test-cleanup.ts"
38
38
  },
39
39
  "dependencies": {
40
- "@ctrl/mac-address": "^3.0.3",
41
- "ofetch": "^1.3.4",
40
+ "@ctrl/mac-address": "^3.1.0",
41
+ "ofetch": "^1.4.1",
42
42
  "p-any": "^4.0.0",
43
- "type-fest": "^4.24.0",
44
- "ws": "^8.18.0",
43
+ "type-fest": "^4.40.1",
44
+ "ws": "^8.18.2",
45
45
  "xml2js": "^0.6.2"
46
46
  },
47
47
  "devDependencies": {
48
- "@biomejs/biome": "1.8.3",
49
- "@ctrl/eslint-config-biome": "4.1.3",
50
- "@sindresorhus/tsconfig": "6.0.0",
51
- "@types/node": "22.3.0",
52
- "@types/ws": "8.5.12",
48
+ "@biomejs/biome": "1.9.4",
49
+ "@ctrl/eslint-config-biome": "4.4.0",
50
+ "@sindresorhus/tsconfig": "7.0.0",
51
+ "@types/node": "22.15.3",
52
+ "@types/ws": "8.18.1",
53
53
  "@types/xml2js": "0.4.14",
54
54
  "@types/yargs": "17.0.33",
55
- "@vitest/coverage-v8": "2.0.5",
56
- "eslint": "9.9.0",
57
- "execa": "9.3.1",
58
- "globby": "14.0.2",
55
+ "@vitest/coverage-v8": "3.1.2",
56
+ "eslint": "9.26.0",
57
+ "execa": "9.5.2",
58
+ "globby": "14.1.0",
59
59
  "make-dir": "5.0.0",
60
- "ora": "8.0.1",
61
- "p-retry": "6.2.0",
60
+ "ora": "8.2.0",
61
+ "p-retry": "6.2.1",
62
62
  "ts-node": "10.9.2",
63
- "typedoc": "0.26.5",
64
- "typescript": "5.5.4",
65
- "vitest": "2.0.5",
63
+ "typedoc": "0.28.3",
64
+ "typescript": "5.8.3",
65
+ "vitest": "3.1.2",
66
66
  "yargs": "17.7.2"
67
67
  },
68
68
  "release": {
@@ -72,5 +72,6 @@
72
72
  },
73
73
  "engines": {
74
74
  "node": ">=18"
75
- }
75
+ },
76
+ "packageManager": "pnpm@10.10.0"
76
77
  }