From ddcbee64ed59c597e878458dadfa9ea34062f9fd Mon Sep 17 00:00:00 2001 From: Daniel Rivers Date: Wed, 15 May 2024 12:59:23 +0100 Subject: [PATCH] chore: add release-it --- .release-it.json | 16 +++ CHANGELOG.md | 197 ++++++++++++++++++++++++++---- lib/sdk/utilities/token-claims.ts | 6 +- package.json | 7 +- 4 files changed, 198 insertions(+), 28 deletions(-) create mode 100644 .release-it.json diff --git a/.release-it.json b/.release-it.json new file mode 100644 index 0000000..f841b13 --- /dev/null +++ b/.release-it.json @@ -0,0 +1,16 @@ +{ + "git": { + "requireBranch": "main", + "commitMessage": "chore: release v${version}" + }, + "hooks": { + "before:init": ["git pull", "pnpm run lint"], + "after:bump": "npx auto-changelog -p && npm run build" + }, + "github": { + "release": true + }, + "npm": { + "publish": true + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 769c544..2cc61db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,40 +1,193 @@ -# Changelog +### Changelog -## b6bda8a4ff4564a6ae8fd8e180f3b57d2eaa5eb6...main +All notable changes to this project will be documented in this file. Dates are displayed in UTC. -[compare changes](https://github.com/kinde-oss/kinde-typescript-sdk/compare/b6bda8a4ff4564a6ae8fd8e180f3b57d2eaa5eb6...main) +Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -### 🩹 Fixes +#### [2.9.0](https://github.com/kinde-oss/kinde-typescript-sdk/compare/4.6.2...2.9.0) -- Ts-lint errors ([93088de](https://github.com/kinde-oss/kinde-typescript-sdk/commit/93088de)) -- Exclude openid from client credentials flow ([eb33856](https://github.com/kinde-oss/kinde-typescript-sdk/commit/eb33856)) +- bug: prevent expiry exception when reading id token claims [`#61`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/61) +- fix: logout redirect is not required [`#60`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/60) +- feat: verify JWTs before accessing and storing [`#46`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/46) +- feat: expose refreshTokens method [`#56`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/56) +- feat: TS enhancements [`#53`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/53) +- fix: ts-lint errors [`#51`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/51) +- bug: exclude openid from client credentials flow [`#52`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/52) +- feat: validate client secrets [`#49`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/49) +- fix: generateRandomString returning double length [`#50`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/50) +- fix: no openid scope crash [`#48`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/48) +- feat: update API spec [`c1dbc27`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/c1dbc27885b8d0d0be5d87fab78ecba8f3e9c869) +- chore: bump version and update API spec [`a863827`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/a86382740ba42675709c08e13a5ed256627f9e5f) +- chore: prettier fix [`6cc94ab`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/6cc94ab21cd37baf9915dc14d72e8cf0b9cea3f1) -### ❤️ Contributors +### [4.6.2](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.9.0...4.6.2) -- Daniel Rivers ([@DanielRivers](https://github.com/DanielRivers)) -- Leo Chen ([@coel](https://github.com/coel)) +> 24 January 2024 -## a15b184fa88ad7a839779044cbe24f437e3fa5b6...2.7.0 +#### [v2.9.0](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.8.0...v2.9.0) -[compare changes](https://github.com/kinde-oss/kinde-typescript-sdk/compare/a15b184fa88ad7a839779044cbe24f437e3fa5b6...2.7.0) +> 17 April 2024 -### 🚀 Enhancements +- feat: verify JWTs before accessing and storing [`#46`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/46) +- chore: bump version and update API spec [`a863827`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/a86382740ba42675709c08e13a5ed256627f9e5f) +- feat: cache JWKS across requests [`fa5530f`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/fa5530f64a1dc35f45a4f2a0249840e43d8d7d77) +- allow reading expired id tokens [`fbe22fb`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/fbe22fb8fce4b07504f5580cc1ce79ececdad493) -- Validate client secrets ([08f89c1](https://github.com/kinde-oss/kinde-typescript-sdk/commit/08f89c1)) +#### [v2.8.0](https://github.com/kinde-oss/kinde-typescript-sdk/compare/2.7.2...v2.8.0) -### 🩹 Fixes +> 20 March 2024 -- Ensure that openid is always passed to the API ([32abdf7](https://github.com/kinde-oss/kinde-typescript-sdk/commit/32abdf7)) -- GenerateRandomString returning double length ([85e9e3e](https://github.com/kinde-oss/kinde-typescript-sdk/commit/85e9e3e)) +- feat: expose refreshTokens method [`#56`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/56) +- feat: TS enhancements [`#53`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/53) +- feat: update API spec [`c1dbc27`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/c1dbc27885b8d0d0be5d87fab78ecba8f3e9c869) +- chore: prettier fix [`6cc94ab`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/6cc94ab21cd37baf9915dc14d72e8cf0b9cea3f1) +- fix: build [`882696d`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/882696d5458b9e9c548d98bc5f3be8a215c57bfb) -### ✅ Tests +#### [2.7.2](https://github.com/kinde-oss/kinde-typescript-sdk/compare/2.7.1...2.7.2) -- Update tests ([3c29168](https://github.com/kinde-oss/kinde-typescript-sdk/commit/3c29168)) +> 11 March 2024 -### ❤️ Contributors +- fix: ts-lint errors [`#51`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/51) +- bug: exclude openid from client credentials flow [`#52`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/52) +- chore: release v2.7.2 [`52e5bba`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/52e5bba6c14b072e41ffa6c71d4829719e8eb599) +- update tests [`1f24555`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/1f245553fe9a33fdfa6de812b4b6ef66bd631987) +- update tests [`22dc250`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/22dc25097877008df4f69d353a7e340c7328ae57) -- Daniel Rivers ([@DanielRivers](http://github.com/DanielRivers)) +#### [2.7.1](https://github.com/kinde-oss/kinde-typescript-sdk/compare/2.7.0...2.7.1) -## 2.7.0...2.7.0 +> 7 March 2024 -[compare changes](https://github.com/kinde-oss/kinde-typescript-sdk/compare/2.7.0...2.7.0) +- chore: add changelog [`ddbb6b6`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/ddbb6b6a7c2ebba9d7f442491e344470821fb485) +- chore: release v2.7.1 [`b6bda8a`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/b6bda8a4ff4564a6ae8fd8e180f3b57d2eaa5eb6) + +#### [2.7.0](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.6.2...2.7.0) + +> 7 March 2024 + +- feat: validate client secrets [`#49`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/49) +- fix: generateRandomString returning double length [`#50`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/50) +- fix: no openid scope crash [`#48`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/48) +- test: update tests [`3c29168`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/3c29168d9ead4b8d20515197b1009ffc1d5c0d18) +- fix: odd random string lengths [`ebc51a0`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/ebc51a08617403ada3f2ab5a391a959d8ff79ef2) +- fix: ensure that openid is always passed to the API [`32abdf7`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/32abdf72168cc77be195d7993495f63db447e8e9) + +#### [v2.6.2](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.6.1...v2.6.2) + +> 11 March 2024 + +- feat: more explicit flow state error [`#45`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/45) +- test: update tests [`20d0ecd`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/20d0ecd35f813cd5160c1acf36d4de30fc01ad93) +- chore: bump version [`a15b184`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/a15b184fa88ad7a839779044cbe24f437e3fa5b6) +- fix: unit test [`7b94f95`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/7b94f95809dbcb3394b03ba56df8926bc9cb6bb8) + +#### [v2.6.1](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.6.0...v2.6.1) + +> 24 January 2024 + +- feat: support multiple audiences [`#44`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/44) +- chore: update audience type to be string array [`8712dcc`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/8712dcc24caf230f25593edb4f6f466a26c0ba0b) +- fix: searchParams variable [`c8c034d`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/c8c034da24056aefec1a8973ee1362dce69b20f7) +- chore: bump version [`44dee54`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/44dee54d59d3872cdd48af87b91242513a77ba33) + +#### [v2.6.0](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.5.2...v2.6.0) + +> 16 January 2024 + +- Use state if existing in session [`#43`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/43) +- chore: make it use the prettier config that is there [`943f759`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/943f759927a390edd3b0a7397119fca4d01feb54) +- chore: increase version [`e71146d`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/e71146d59369c666f6908f5b0fe45e8c629ec3bf) + +#### [v2.5.2](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.5.1...v2.5.2) + +> 12 January 2024 + +- Update to latest management API spec [`4a73c0d`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/4a73c0debd39a55c8abcb1c18fbbf15b1ecb6961) + +#### [v2.5.1](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.5.0...v2.5.1) + +> 12 January 2024 + +- Add OpenAPI generator [`#35`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/35) +- Handle case where both `refresh_token` and `access_token` have expired [`#42`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/42) +- Introduce generator, remove and ignore generated files, add generator step [`d997a4d`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/d997a4d0316dcaf2d176e91356372daa7f9d1fa3) +- Clean generated files, add files used by OpenAPI, ignore generated files [`3b41808`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/3b41808e1350afba915d1ba91525f17b372efbf2) +- test: wrote tests to verify changes introduced to token-utils [`428e124`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/428e1241f6cacd435bbbf61db5d3359576a98035) + +#### [v2.5.0](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.4.0...v2.5.0) + +> 23 December 2023 + +- exposing all management apis as a single object [`#38`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/38) +- chore: exposing all management apis as a single object [`416684c`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/416684c3fe8e5f064b09eb764a354d1d29d2f76c) +- chore: bump version [`0239214`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/0239214067fb170336a8b845e4a89f1b6bc9c7aa) + +#### [v2.4.0](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.3.2...v2.4.0) + +> 7 December 2023 + +- Change tsconfig target to es5 [`#36`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/36) +- chore: bump version [`1fa754d`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/1fa754d8436feaeb75ba2a0f98c7cc9c8938fc39) + +#### [v2.3.2](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.3.1...v2.3.2) + +> 30 November 2023 + +- Allow `createKindeBrowserClient` with custom `SessionManager` [`#33`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/33) +- chore: bump version [`12c9db7`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/12c9db7d166734a5a3ff2cc608d58170987638ca) + +#### [v2.3.1](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.3.0...v2.3.1) + +> 30 November 2023 + +- fix: don't store the decoded payload and decode when needed [`#32`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/32) +- chore: bump version [`75d395c`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/75d395c6eb65fa512edcd92fa35dfe774b9bda2c) + +#### [v2.3.0](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.2.0...v2.3.0) + +> 17 November 2023 + +- fix: prevent trying to decode refresh token [`#31`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/31) +- feat: include auth url params in payload [`#29`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/29) +- Bugfix/id token expiry logout [`#26`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/26) +- fix: ensured that `build-test-ci.yml` workflow runs pre/post scripts [`#28`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/28) +- Bump @babel/traverse from 7.21.5 to 7.23.2 [`#24`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/24) +- feat: created github action for building SDK and running tests [`#23`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/23) +- feat: append post_login_redirect_url to search params [`#21`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/21) +- Update README to Kinde OSS SDK template [`#19`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/19) +- generated from latest API spec and bump version [`165743b`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/165743b630f3093c307671e56d4f88f52aafa563) +- Update README to Kinde OSS Template [`7d70ba0`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/7d70ba07b640fbf9a2f8e2b36c0d843308355111) +- fix: ensured that all server utilities preliminarily refresh tokens [`2f877bd`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/2f877bd0d4efaaa915b51e3462289bfaae3d7f5c) + +#### [v2.2.0](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.1.0...v2.2.0) + +> 21 September 2023 + +- feat: handle being used as an ES module in Node.js [`61b4aca`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/61b4acab114ac94a5ad24ef8dc397e78c2d6e11d) + +#### [v2.1.0](https://github.com/kinde-oss/kinde-typescript-sdk/compare/v2.0.0...v2.1.0) + +> 14 September 2023 + +- feat: add conditional types to createKindeServerClient to select the type of options and client [`28a3695`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/28a36954eb38e1a83691124bba3d598981f21746) + +#### v2.0.0 + +> 12 September 2023 + +- fix: avoid forcing login [`#16`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/16) +- updated README post migration to async methods [`#15`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/15) +- feat: migrate codebase to async functions [`#13`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/13) +- update: API updates [`#11`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/11) +- ensured that `getFlag` throws error when `defaultValue === undefined` [`#10`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/10) +- bugfix/random string and pollyfills [`#9`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/9) +- Feature/sdk header override [`#8`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/8) +- Feature/feedback 6 [`#7`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/7) +- Feature/feedback 5 [`#6`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/6) +- Feature/feedback 4 refresh tokens update [`#5`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/5) +- Feature/feedback 3 [`#4`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/4) +- Feature/feedback 2 [`#3`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/3) +- Feature/feedback 1 [`#2`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/2) +- feature/initial implementation [`#1`](https://github.com/kinde-oss/kinde-typescript-sdk/pull/1) +- update: regenerate API from updated spec [`695416a`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/695416a4aaaf2b55d971b92b6255197362d89820) +- added files generated by openapi-generator for endpoints and models [`71a76e8`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/71a76e88d578022dd9d46282094351211a1baa7d) +- completed jest setup for unit-test coverage [`05a2134`](https://github.com/kinde-oss/kinde-typescript-sdk/commit/05a21347e0dfd4659d14d9abd8f33f7f0c43f7cc) diff --git a/lib/sdk/utilities/token-claims.ts b/lib/sdk/utilities/token-claims.ts index e003300..c1b97d5 100644 --- a/lib/sdk/utilities/token-claims.ts +++ b/lib/sdk/utilities/token-claims.ts @@ -18,7 +18,11 @@ export const getClaimValue = async ( ): Promise => { const token = (await sessionManager.getSessionItem(`${type}`)) as string; const key = await validationDetails.keyProvider(); - const decodedToken = await jwtVerify(token, key, type === 'id_token' ? { currentDate: new Date(0) } : {}); + const decodedToken = await jwtVerify( + token, + key, + type === 'id_token' ? { currentDate: new Date(0) } : {} + ); const tokenPayload: Record = decodedToken.payload; return tokenPayload[claim] ?? null; }; diff --git a/package.json b/package.json index 389213b..f2b2779 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,9 @@ "build": "npm run generate && tsc && tsc -p tsconfig.cjs.json", "postbuild": "node sdk-version.js clean && ncp ./package-cjs.json ./dist-cjs/package.json && ncp ./package-esm.json ./dist/package.json", "prebuild": "node sdk-version.js && rimraf dist dist-cjs lib/models lib/apis", - "lint": "eslint .", - "lint:fix": "eslint --fix .", - "prettier": "prettier . --check", + "lint": "eslint . && prettier . --check", + "lint:fix": "eslint --fix . && prettier . --check", "test": "jest --passWithNoTests", - "prettier:fix": "prettier . --write", - "format": "pnpm run prettier:fix && pnpm run lint:fix", "lint-staged": "lint-staged", "husky": "husky install", "generate": "npx @openapitools/openapi-generator-cli generate -i ./kinde-mgmt-api-specs.yaml -c ./generator-config.yaml -g typescript-fetch -o ./lib --additional-properties=importFileExtension=.js"