From e2d1ed99ebe60234333d07cb6d9cbfe440843f8f Mon Sep 17 00:00:00 2001 From: Husky <39809509+Huskydog9988@users.noreply.github.com> Date: Sun, 6 Nov 2022 16:22:38 -0500 Subject: [PATCH 01/10] fix(types): export episodes --- src/trakt/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/trakt/index.ts b/src/trakt/index.ts index 9fe2fcf..44d96ec 100644 --- a/src/trakt/index.ts +++ b/src/trakt/index.ts @@ -8,3 +8,4 @@ export * from './lists'; export * from './networks'; export * from './traktTypes'; export * from './users'; +export * from './episodes'; From e4dc04cb223df9b31582d90a0f751ba6063e4a0a Mon Sep 17 00:00:00 2001 From: Husky <39809509+Huskydog9988@users.noreply.github.com> Date: Sun, 6 Nov 2022 16:33:12 -0500 Subject: [PATCH 02/10] ci: fix Dependabot prs a temp action until Dependabot finally supports pnpm lock files --- .github/workflows/update-lockfile.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/update-lockfile.yml diff --git a/.github/workflows/update-lockfile.yml b/.github/workflows/update-lockfile.yml new file mode 100644 index 0000000..c7c1b72 --- /dev/null +++ b/.github/workflows/update-lockfile.yml @@ -0,0 +1,25 @@ +# https://github.com/dependabot/dependabot-core/issues/1736 +name: Dependabot +on: pull_request_target +permissions: read-all +jobs: + update-lockfile: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + permissions: + pull-requests: write + contents: write + steps: + - uses: pnpm/action-setup@v2 + with: + version: ^7 + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + - run: pnpm i --lockfile-only + - run: | + git config --global user.name github-actions[bot] + git config --global user.email github-actions[bot]@users.noreply.github.com + git add pnpm-lock.yaml + git commit -m "Update pnpm-lock.yaml" + git push From a8879e98ee888a88fb07dbb25417367f1ab7dc6c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 6 Nov 2022 21:35:41 +0000 Subject: [PATCH 03/10] build(deps): bump axios from 0.27.2 to 1.1.3 Bumps [axios](https://github.com/axios/axios) from 0.27.2 to 1.1.3. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v0.27.2...v1.1.3) --- updated-dependencies: - dependency-name: axios dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 08b9ea2..85c6b13 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "test": "nyc mocha -r ts-node/register test/**/*.spec.ts" }, "dependencies": { - "axios": "^0.27.2" + "axios": "^1.1.3" }, "devDependencies": { "@types/chai": "^4.3.3", From d65601790782e4e5df1c17452a4923e0b9c87c82 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 6 Nov 2022 21:36:04 +0000 Subject: [PATCH 04/10] Update pnpm-lock.yaml --- pnpm-lock.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 662c322..5853c13 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,7 +5,7 @@ specifiers: '@types/mocha': ^9.1.1 '@typescript-eslint/eslint-plugin': ^5.33.0 '@typescript-eslint/parser': ^5.33.0 - axios: ^0.27.2 + axios: ^1.1.3 chai: ^4.3.6 eslint: ^8.21.0 eslint-config-prettier: ^8.5.0 @@ -23,7 +23,7 @@ specifiers: typescript: ^4.7.4 dependencies: - axios: 0.27.2 + axios: 1.1.3 devDependencies: '@types/chai': 4.3.3 @@ -646,11 +646,12 @@ packages: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} dev: false - /axios/0.27.2: - resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==} + /axios/1.1.3: + resolution: {integrity: sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==} dependencies: follow-redirects: 1.15.2 form-data: 4.0.0 + proxy-from-env: 1.1.0 transitivePeerDependencies: - debug dev: false @@ -1949,6 +1950,10 @@ packages: fromentries: 1.3.2 dev: true + /proxy-from-env/1.1.0: + resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} + dev: false + /punycode/2.1.1: resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==} engines: {node: '>=6'} From ca112c3faa8900c926f761f947653eb0e251252c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 6 Nov 2022 21:38:20 +0000 Subject: [PATCH 05/10] build(deps-dev): bump @types/mocha from 9.1.1 to 10.0.0 Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 9.1.1 to 10.0.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha) --- updated-dependencies: - dependency-name: "@types/mocha" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 85c6b13..d029445 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ }, "devDependencies": { "@types/chai": "^4.3.3", - "@types/mocha": "^9.1.1", + "@types/mocha": "^10.0.0", "@typescript-eslint/eslint-plugin": "^5.33.0", "@typescript-eslint/parser": "^5.33.0", "chai": "^4.3.6", From 6c5f04bfb8d316fa67f323cc60e38d9774be734e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 6 Nov 2022 21:38:29 +0000 Subject: [PATCH 06/10] build(deps-dev): bump typedoc-plugin-missing-exports Bumps [typedoc-plugin-missing-exports](https://github.com/Gerrit0/typedoc-plugin-missing-exports) from 0.23.0 to 1.0.0. - [Release notes](https://github.com/Gerrit0/typedoc-plugin-missing-exports/releases) - [Changelog](https://github.com/Gerrit0/typedoc-plugin-missing-exports/blob/main/CHANGELOG.md) - [Commits](https://github.com/Gerrit0/typedoc-plugin-missing-exports/compare/v0.23.0...v1.0.0) --- updated-dependencies: - dependency-name: typedoc-plugin-missing-exports dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 85c6b13..aaf96e7 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "typedoc": "^0.23.10", "typedoc-plugin-extras": "^2.3.0", "typedoc-plugin-mdn-links": "^2.0.0", - "typedoc-plugin-missing-exports": "^0.23.0", + "typedoc-plugin-missing-exports": "^1.0.0", "typescript": "^4.7.4" }, "publishConfig": { From 6fe9528e417844ce5dbc85a0818dd179a31ff55b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 6 Nov 2022 21:38:42 +0000 Subject: [PATCH 07/10] Update pnpm-lock.yaml --- pnpm-lock.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5853c13..e29e407 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2,7 +2,7 @@ lockfileVersion: 5.4 specifiers: '@types/chai': ^4.3.3 - '@types/mocha': ^9.1.1 + '@types/mocha': ^10.0.0 '@typescript-eslint/eslint-plugin': ^5.33.0 '@typescript-eslint/parser': ^5.33.0 axios: ^1.1.3 @@ -27,7 +27,7 @@ dependencies: devDependencies: '@types/chai': 4.3.3 - '@types/mocha': 9.1.1 + '@types/mocha': 10.0.0 '@typescript-eslint/eslint-plugin': 5.42.0_ofgjrzjuekeo7s3hdyz2yuzw34 '@typescript-eslint/parser': 5.42.0_rmayb2veg2btbq6mbmnyivgasy chai: 4.3.6 @@ -399,8 +399,8 @@ packages: resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==} dev: true - /@types/mocha/9.1.1: - resolution: {integrity: sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==} + /@types/mocha/10.0.0: + resolution: {integrity: sha512-rADY+HtTOA52l9VZWtgQfn4p+UDVM2eDVkMZT1I6syp0YKxW2F9v+0pbRZLsvskhQv/vMb6ZfCay81GHbz5SHg==} dev: true /@types/node/14.18.33: From fe814c459e1fbcb28c26fdf386c0aa7941dd733e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 6 Nov 2022 21:38:49 +0000 Subject: [PATCH 08/10] Update pnpm-lock.yaml --- pnpm-lock.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5853c13..d026205 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,7 +19,7 @@ specifiers: typedoc: ^0.23.10 typedoc-plugin-extras: ^2.3.0 typedoc-plugin-mdn-links: ^2.0.0 - typedoc-plugin-missing-exports: ^0.23.0 + typedoc-plugin-missing-exports: ^1.0.0 typescript: ^4.7.4 dependencies: @@ -43,7 +43,7 @@ devDependencies: typedoc: 0.23.20_typescript@4.8.4 typedoc-plugin-extras: 2.3.1_typedoc@0.23.20 typedoc-plugin-mdn-links: 2.0.0_typedoc@0.23.20 - typedoc-plugin-missing-exports: 0.23.0_typedoc@0.23.20 + typedoc-plugin-missing-exports: 1.0.0_typedoc@0.23.20 typescript: 4.8.4 packages: @@ -2267,8 +2267,8 @@ packages: typedoc: 0.23.20_typescript@4.8.4 dev: true - /typedoc-plugin-missing-exports/0.23.0_typedoc@0.23.20: - resolution: {integrity: sha512-9smahDSsFRno9ZwoEshQDuIYMHWGB1E6LUud5qMxR2wNZ0T4DlZz0QjoK3HzXtX34mUpTH0dYtt7NQUK4D6B6Q==} + /typedoc-plugin-missing-exports/1.0.0_typedoc@0.23.20: + resolution: {integrity: sha512-7s6znXnuAj1eD9KYPyzVzR1lBF5nwAY8IKccP5sdoO9crG4lpd16RoFpLsh2PccJM+I2NASpr0+/NMka6ThwVA==} peerDependencies: typedoc: 0.22.x || 0.23.x dependencies: From 10fbc4a2f60ed0a604114476dc2495cceb836dee Mon Sep 17 00:00:00 2001 From: Husky <39809509+Huskydog9988@users.noreply.github.com> Date: Sun, 6 Nov 2022 17:02:49 -0500 Subject: [PATCH 09/10] fix(fetch): remove type errors from update --- src/utils/fetch.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/utils/fetch.ts b/src/utils/fetch.ts index 6a35e5f..2650f38 100644 --- a/src/utils/fetch.ts +++ b/src/utils/fetch.ts @@ -1,4 +1,4 @@ -import { AxiosError, AxiosInstance, AxiosRequestHeaders, AxiosResponseHeaders } from 'axios'; +import { AxiosError, AxiosInstance, AxiosResponseHeaders } from 'axios'; import { CommentSortByMedia, ListQueryByType, RecommendedPeriod, ReleasesCountry, UpdatedStartDate } from '../trakt'; import { buildUrl } from './buildUrl'; import { TraktHttpError } from './error'; @@ -95,7 +95,7 @@ export interface ApiResponse { * @remarks * Can be useful for things like cache control, ratelimiting, or general debuging */ - headers: AxiosResponseHeaders; + headers: AxiosResponseHeaders | Partial & { 'set-cookie'?: string[] | undefined }>; /** * Error object in the event of an error @@ -154,14 +154,12 @@ export interface FetchOptions { * @internal */ export async function fetch(client: AxiosInstance, url: string, options?: FetchOptions): Promise> { - const headers: AxiosRequestHeaders = {}; - - if (options !== undefined && options.accessToken !== undefined) - headers['Authorization'] = `Bearer ${options.accessToken}`; - try { const response = await client.get(buildUrl(url, options), { - headers, + headers: + options !== undefined && options.accessToken !== undefined + ? { Authorization: `Bearer ${options.accessToken}` } + : undefined, // parseJson: (text: string) => Bourne.parse(text), }); @@ -170,7 +168,12 @@ export async function fetch(client: AxiosInstance, url: string, options?: Fet headers: response.headers, }; - if (response.headers['X-Pagination-Page'] !== undefined) { + if ( + response.headers['X-Pagination-Page'] !== undefined && + response.headers['X-Pagination-Limit'] !== undefined && + response.headers['X-Pagination-Page-Count'] !== undefined && + response.headers['X-Pagination-Item-Count'] !== undefined + ) { res.pagination = { page: parseInt(response.headers['X-Pagination-Page']), limit: parseInt(response.headers['X-Pagination-Limit']), From 0090fa5ce40f903a391bca534814fe654ce4855c Mon Sep 17 00:00:00 2001 From: Husky <39809509+Huskydog9988@users.noreply.github.com> Date: Sat, 12 Nov 2022 11:09:26 -0800 Subject: [PATCH 10/10] chore: bump version to 0.9.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e36ebff..67fd4a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "better-trakt", - "version": "0.9.0", + "version": "0.9.1", "description": "A Trakt.tv client with native Typescript support and quality of life features", "main": "dist/index.js", "types": "dist/index.d.ts",