tmdb-kit 1.0.0 → 1.2.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.
Files changed (45) hide show
  1. package/README.md +455 -196
  2. package/dist/cli.js +3823 -0
  3. package/dist/client.d.cts +71 -0
  4. package/dist/client.d.ts +71 -0
  5. package/dist/errors.d.cts +86 -0
  6. package/dist/errors.d.ts +86 -0
  7. package/dist/helpers/cache.d.cts +28 -0
  8. package/dist/helpers/cache.d.ts +28 -0
  9. package/dist/helpers/pagination.d.cts +35 -0
  10. package/dist/helpers/pagination.d.ts +35 -0
  11. package/dist/helpers/retry.d.cts +47 -0
  12. package/dist/helpers/retry.d.ts +47 -0
  13. package/dist/helpers/timeout.d.cts +20 -0
  14. package/dist/helpers/timeout.d.ts +20 -0
  15. package/dist/http.d.cts +80 -0
  16. package/dist/http.d.ts +80 -0
  17. package/dist/index.cjs +1115 -768
  18. package/dist/index.cjs.map +27 -1
  19. package/dist/index.d.cts +13 -783
  20. package/dist/index.d.ts +13 -783
  21. package/dist/index.js +1074 -744
  22. package/dist/index.js.map +27 -1
  23. package/dist/query.d.cts +91 -0
  24. package/dist/query.d.ts +91 -0
  25. package/dist/resources/configuration.d.cts +17 -0
  26. package/dist/resources/configuration.d.ts +17 -0
  27. package/dist/resources/genres.d.cts +13 -0
  28. package/dist/resources/genres.d.ts +13 -0
  29. package/dist/resources/images.d.cts +17 -0
  30. package/dist/resources/images.d.ts +17 -0
  31. package/dist/resources/movies.d.cts +21 -0
  32. package/dist/resources/movies.d.ts +21 -0
  33. package/dist/resources/people.d.cts +14 -0
  34. package/dist/resources/people.d.ts +14 -0
  35. package/dist/resources/search.d.cts +15 -0
  36. package/dist/resources/search.d.ts +15 -0
  37. package/dist/resources/trending.d.cts +23 -0
  38. package/dist/resources/trending.d.ts +23 -0
  39. package/dist/resources/tv.d.cts +30 -0
  40. package/dist/resources/tv.d.ts +30 -0
  41. package/dist/search-guards.d.cts +32 -0
  42. package/dist/search-guards.d.ts +32 -0
  43. package/dist/types.d.cts +550 -0
  44. package/dist/types.d.ts +550 -0
  45. package/package.json +26 -19
package/dist/http.d.ts ADDED
@@ -0,0 +1,80 @@
1
+ import { type QueryDefaults, type QueryParams } from './query.js';
2
+ import type { ImageUrlTransform } from './resources/images.js';
3
+ import type { LanguageCode, RegionCode } from './types.js';
4
+ export type { ImageUrlTransform };
5
+ /**
6
+ * A minimal fetch-like function signature. Any runtime's native `fetch`
7
+ * or a test double conforming to this shape can be used.
8
+ */
9
+ export type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
10
+ export interface TMDBAccessTokenAuth {
11
+ /** TMDB API Read Access Token. Sent as an Authorization Bearer header. */
12
+ accessToken: string;
13
+ apiKey?: never;
14
+ }
15
+ export interface TMDBApiKeyAuth {
16
+ /** Legacy v3 API key. Sent as api_key query parameter. */
17
+ apiKey: string;
18
+ accessToken?: never;
19
+ }
20
+ export type TMDBAuth = TMDBAccessTokenAuth | TMDBApiKeyAuth;
21
+ /** Internal defaults resolved during client construction. */
22
+ export interface TMDBClientDefaults extends QueryDefaults {
23
+ imageBaseUrl: string;
24
+ }
25
+ export interface TMDBImagesOptions {
26
+ /**
27
+ * Default transform applied to every URL produced by the ImagesHelper.
28
+ * Use this to route TMDB image requests through a CDN, image proxy, or
29
+ * to add signed query parameters. Individual calls can still override it
30
+ * via ImagesHelper.url(path, size, { transform }).
31
+ */
32
+ transform?: ImageUrlTransform;
33
+ }
34
+ export type TMDBClientOptions = TMDBAuth & {
35
+ /** Defaults to https://api.themoviedb.org/3. Useful for tests or proxies. */
36
+ baseUrl?: string;
37
+ /** Inject a fetch implementation for tests, custom runtimes, or instrumentation. */
38
+ fetch?: FetchLike;
39
+ /** Default language for endpoints that accept a language query parameter. */
40
+ defaultLanguage?: LanguageCode;
41
+ /** Default region for movie list/search endpoints that accept a region query parameter. */
42
+ defaultRegion?: RegionCode;
43
+ /** Custom image host. Defaults to https://image.tmdb.org/t/p. */
44
+ imageBaseUrl?: string;
45
+ /** Image-helper configuration: host overrides and URL transforms. */
46
+ images?: TMDBImagesOptions;
47
+ /** Additional headers merged into every request before authentication is applied. */
48
+ headers?: HeadersInit;
49
+ };
50
+ /** Per-request overrides applied when making a single API call. */
51
+ export interface TMDBRequestOptions {
52
+ headers?: HeadersInit;
53
+ query?: QueryParams;
54
+ signal?: AbortSignal;
55
+ }
56
+ /**
57
+ * Transport abstraction for making HTTP requests to the TMDB API.
58
+ *
59
+ * The built-in {@link TMDBHttpClient} implements this interface. You can
60
+ * provide a custom implementation via {@link TMDBFactoryOptions.transport}
61
+ * for testing, caching, or instrumentation.
62
+ */
63
+ export interface TMDBTransport {
64
+ readonly defaults: TMDBClientDefaults;
65
+ get<T>(path: string, options?: TMDBRequestOptions): Promise<T>;
66
+ }
67
+ /**
68
+ * Built-in HTTP transport that uses the Fetch API.
69
+ *
70
+ * Handles authentication (API key or access token), URL construction,
71
+ * request headers, and response parsing. Use the factory function
72
+ * {@link createTMDB} instead of instantiating this directly.
73
+ */
74
+ export declare class TMDBHttpClient implements TMDBTransport {
75
+ #private;
76
+ readonly defaults: TMDBClientDefaults;
77
+ readonly imageTransform: ImageUrlTransform | undefined;
78
+ constructor(options: TMDBClientOptions);
79
+ get<T>(path: string, options?: TMDBRequestOptions): Promise<T>;
80
+ }