anilink-api-wrapper 2.3.0 → 3.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/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  [![CodeQL](https://github.com/RLAlpha49/AniLink/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/RLAlpha49/AniLink/actions/workflows/codeql.yml)
12
12
  [![Documentation](https://img.shields.io/website?url=https%3A%2F%2Fanilink.alpha49.com%2F&label=docs)](https://anilink.alpha49.com/)
13
13
 
14
- A typed TypeScript wrapper for the [AniList GraphQL API](https://docs.anilist.co/) and the [MyAnimeList REST API](https://myanimelist.net/apiconfig/references/api/v2). One class, two isolated provider surfaces, normalized errors, retries, and a generated operation reference.
14
+ A typed TypeScript wrapper for the [AniList GraphQL API](https://docs.anilist.co/) and the [MyAnimeList REST API](https://myanimelist.net/apiconfig/references/api/v2). One class exposes two isolated provider namespaces. Every operation with inputs takes a single typed params object plus an optional trailing options object. Normalized errors, retries, pacing, and caching work identically on both. Import the root package for both providers, or scope imports to one provider with the `anilink-api-wrapper/anilist` and `anilink-api-wrapper/mal` subpaths.
15
15
 
16
16
  ## Quickstart
17
17
 
@@ -19,44 +19,58 @@ A typed TypeScript wrapper for the [AniList GraphQL API](https://docs.anilist.co
19
19
  npm install anilink-api-wrapper
20
20
  ```
21
21
 
22
- Requires Node.js >= 22; the package is ESM-only (`import` syntax only, no CommonJS `require`).
22
+ Requires Node.js 22 or later. The package is ESM-only, so use `import` syntax, not CommonJS `require`.
23
23
 
24
24
  ```typescript
25
25
  import { AniLink } from "anilink-api-wrapper";
26
26
 
27
- // AniList (GraphQL) — public queries need no token
27
+ // AniList (GraphQL) needs no token for public queries
28
28
  const aniLink = new AniLink();
29
29
  const anime = await aniLink.anilist.query.media({ id: 21, type: "ANIME" });
30
30
 
31
- // MyAnimeList (REST) — isolated credential slot
31
+ // MyAnimeList (REST) has its own credential slot
32
32
  const client = new AniLink({ mal: { accessToken: "mal-token" } });
33
- const malAnime = await client.mal.anime.get(21, { fields: ["id", "title", "main_picture"] });
33
+ const malAnime = await client.mal.anime.get(
34
+ { id: 21 },
35
+ { fields: ["id", "title", "main_picture"] }
36
+ );
34
37
  ```
35
38
 
36
39
  ## What you can do
37
40
 
38
- | Provider | Namespace | Capabilities |
39
- | --------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
40
- | **AniList** | `aniLink.anilist` | Queries, page queries, mutations, pagination helpers, `custom()`, data helpers, and the `crossLink` AniList↔MAL id mapping |
41
- | **MyAnimeList** | `aniLink.mal` | `anime.get`, `manga.get`, and `user.me` REST reads with field selection, the `seasonal`, `ranking`, and `suggestions` discovery reads, paginated `user.animeList`/`user.mangaList` user-list reads, plus `anime`/`manga` `updateMyListStatus` and `deleteFromList` list-status writes |
41
+ ### AniList (`aniLink.anilist`)
42
42
 
43
- Both surfaces share one transport layer (timeouts, retries, pacing, circuit breaker, hooks) while keeping credentials and transport settings isolated per provider slot.
43
+ - **Queries and mutations.** 25 typed queries (`user`, `media`, `character`, `staff`, `studio`, `review`, `thread`, and more) and 29 typed mutations covering list entries, activities, replies, reviews, threads, and favourites.
44
+ - **Page queries.** 18 paginated reads under `query.page` (`medias`, `characters`, `airingSchedules`, `notifications`, and more). Each returns its items plus `PageInfo`.
45
+ - **Custom documents.** `custom()` and `customPage()` send your own GraphQL documents with the same validation, transport, and caching as the built-in operations.
46
+ - **Pagination.** `paginate`, `paginatePages`, and `paginateChunks` walk multi-page results, stopping at the server-reported last page.
47
+ - **Data helpers.** `fuzzyDate` builds `FuzzyDateInput` objects for list-entry mutations, `fuzzyDateInt` builds the `YYYYMMDD` integers that query filters take, `flattenMediaListCollection` flattens list collections, `crossLink` builds AniList-to-MAL id maps from `idMal`, and `mapExternalIds` maps ids in either direction through [ARM](https://arm.haglund.dev/).
48
+ - **Watchers.** `watch.notifications` and `watch.activity` poll AniList and yield new items as async generators.
49
+
50
+ ### MyAnimeList (`aniLink.mal`)
51
+
52
+ - **Reads.** `anime.get`, `manga.get`, `user.me`, `user.get`, `anime.search`, `manga.search`, `seasonal`, `anime.ranking`, `manga.ranking`, `suggestions`, `user.animeList`, `user.mangaList`, and the `forum.boards`, `forum.topics`, and `forum.topic` forum reads. The `fields` option selects the response shape.
53
+ - **Writes.** `updateMyListStatus` and `deleteFromList` on both `anime` and `manga`.
54
+ - **Pagination.** `paginate` and `paginatePages` walk the paginated list endpoints.
55
+
56
+ Both namespaces share one transport layer, which handles timeouts, retries, pacing, circuit breaking, hooks, automatic token refresh, and an opt-in response cache. Each provider slot has its own credentials and transport settings.
44
57
 
45
58
  ## Documentation
46
59
 
47
- | Surface | Start here |
48
- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
49
- | **Guides** | [Introduction](https://anilink.alpha49.com/introduction) · [Getting started](https://anilink.alpha49.com/getting-started) · [Provider configuration](https://anilink.alpha49.com/provider-configuration) · [Per-request options](https://anilink.alpha49.com/per-request-options) · [Error handling](https://anilink.alpha49.com/error-handling) · [Retries & resilience](https://anilink.alpha49.com/retries-and-resilience) · [Cancellation & timeouts](https://anilink.alpha49.com/cancellation-and-timeouts) · [Observability](https://anilink.alpha49.com/observability) · [Recipes](https://anilink.alpha49.com/recipes) · [TypeScript patterns](https://anilink.alpha49.com/typescript-patterns) · [Troubleshooting](https://anilink.alpha49.com/troubleshooting) |
50
- | **AniList guides** | [Authentication](https://anilink.alpha49.com/guides/anilist/authentication) · [Client configuration](https://anilink.alpha49.com/guides/anilist/configuration) · [Querying](https://anilink.alpha49.com/guides/anilist/querying) · [Page queries](https://anilink.alpha49.com/guides/anilist/page-queries) · [Pagination](https://anilink.alpha49.com/guides/anilist/pagination) · [Mutations](https://anilink.alpha49.com/guides/anilist/mutations) · [Custom queries](https://anilink.alpha49.com/guides/anilist/custom-queries) · [Helpers](https://anilink.alpha49.com/guides/anilist/helpers) |
51
- | **MAL guides** | [Authentication](https://anilink.alpha49.com/guides/mal/authentication) · [Client configuration](https://anilink.alpha49.com/guides/mal/configuration) · [Operations](https://anilink.alpha49.com/guides/mal/operations) |
52
- | **Operation reference** | [Overview](https://anilink.alpha49.com/operations/) · [AniList catalog](https://anilink.alpha49.com/operations/anilist) · [MAL catalog](https://anilink.alpha49.com/operations/mal) |
53
- | **API reference (TypeDoc)** | [AniLink](https://anilink.alpha49.com/classes/AniLink.AniLink.html) — full generated reference at the [docs root](https://anilink.alpha49.com/) |
60
+ | Docs | Start here |
61
+ | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
62
+ | **Guides** | [Introduction](https://anilink.alpha49.com/introduction) · [Getting started](https://anilink.alpha49.com/getting-started) · [Provider configuration](https://anilink.alpha49.com/provider-configuration) · [Per-request options](https://anilink.alpha49.com/per-request-options) · [Error handling](https://anilink.alpha49.com/error-handling) · [Retries & resilience](https://anilink.alpha49.com/retries-and-resilience) · [Cancellation & timeouts](https://anilink.alpha49.com/cancellation-and-timeouts) · [Observability](https://anilink.alpha49.com/observability) · [Recipes](https://anilink.alpha49.com/recipes) · [TypeScript patterns](https://anilink.alpha49.com/typescript-patterns) · [Troubleshooting](https://anilink.alpha49.com/troubleshooting) · [Response cache](https://anilink.alpha49.com/response-cache) |
63
+ | **AniList guides** | [Authentication](https://anilink.alpha49.com/guides/anilist/authentication) · [Client configuration](https://anilink.alpha49.com/guides/anilist/configuration) · [Querying](https://anilink.alpha49.com/guides/anilist/querying) · [Page queries](https://anilink.alpha49.com/guides/anilist/page-queries) · [Pagination](https://anilink.alpha49.com/guides/anilist/pagination) · [Mutations](https://anilink.alpha49.com/guides/anilist/mutations) · [Custom queries](https://anilink.alpha49.com/guides/anilist/custom-queries) · [Field selection](https://anilink.alpha49.com/guides/anilist/field-selection) · [Helpers](https://anilink.alpha49.com/guides/anilist/helpers) · [Watchers](https://anilink.alpha49.com/guides/anilist/watchers) · [Complete examples](https://anilink.alpha49.com/guides/anilist/complete-examples) |
64
+ | **MAL guides** | [Authentication](https://anilink.alpha49.com/guides/mal/authentication) · [Client configuration](https://anilink.alpha49.com/guides/mal/configuration) · [Operations](https://anilink.alpha49.com/guides/mal/operations) · [Pagination](https://anilink.alpha49.com/guides/mal/pagination) · [Complete examples](https://anilink.alpha49.com/guides/mal/complete-examples) |
65
+ | **Operation reference** | [Overview](https://anilink.alpha49.com/operations/) · [AniList catalog](https://anilink.alpha49.com/operations/anilist) · [MAL catalog](https://anilink.alpha49.com/operations/mal) |
66
+ | **API reference (TypeDoc)** | [AniLink](https://anilink.alpha49.com/classes/AniLink.AniLink.html) class; the full generated reference is at the [docs root](https://anilink.alpha49.com/) |
54
67
 
55
68
  ## Development
56
69
 
57
70
  ```bash
58
71
  npm install # install dependencies
59
72
  npm run check # typecheck, lint, tests, format, JSDoc, api-compare, build
73
+ npm run check:fast # typecheck, lint, and tests only
60
74
  npm run docs:generate # TypeDoc + operation reference + guides site into docs/
61
75
  npm run docs:dev # serve the guides site locally
62
76
  ```