Skip to content

Commit 8cd073e

Browse files
feat: dynamically inferred core types (#995)
## Summary of change This PR adds support for inferring the querier request body and response body types based on the path entered. It uses the core driver interface spec file to achieve this. There is a script that generates the updated schema and can be run with the following command, whenever necessary (i.e. whenever the API spec is updated): ```sh npm run build-core-types ``` ## Related issues ## Test Plan All tests should pass ## Documentation changes (If relevant, please create a PR in our [docs repo](https://github.com/supertokens/docs), or create a checklist here highlighting the necessary changes) ## Checklist for important updates - [x] Changelog has been updated - [ ] `coreDriverInterfaceSupported.json` file has been updated (if needed) - Along with the associated array in `lib/ts/version.ts` - [ ] `frontendDriverInterfaceSupported.json` file has been updated (if needed) - [x] Changes to the version if needed - In `package.json` - In `package-lock.json` - In `lib/ts/version.ts` - [x] Had run `npm run build-pretty` - [x] Had installed and ran the pre-commit hook - [ ] If new thirdparty provider is added, - [ ] update switch statement in `recipe/thirdparty/providers/configUtils.ts` file, `createProvider` function. - [ ] add an icon on the user management dashboard. - [x] Issue this PR against the latest non released version branch. - To know which one it is, run find the latest released tag (`git tag`) in the format `vX.Y.Z`, and then find the latest branch (`git branch --all`) whose `X.Y` is greater than the latest released tag. - If no such branch exists, then create one from the latest released branch. - [ ] If have added a new web framework, update the `add-ts-no-check.js` file to include that - [ ] If added a new recipe / api interface, then make sure that the implementation of it uses NON arrow functions only (like `someFunc: function () {..}`). - [ ] If added a new recipe, then make sure to expose it inside the recipe folder present in the root of this repo. We also need to expose its types. - [ ] If added a new entry point, then make sure that it is importable by adding it to the `exports` in `package.json`
1 parent 19e875d commit 8cd073e

File tree

157 files changed

+13425
-1389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+13425
-1389
lines changed

.github/workflows/tests-pass-check-pr.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/website-test.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ jobs:
3838
fdi-version: ${{ fromJSON(needs.define-versions.outputs.fdiVersions) }}
3939

4040
steps:
41+
- name: Setup ENVs
42+
id: envs
43+
run: |
44+
APP_SERVER_LOG_DIR=${{ github.workspace }}/logs
45+
echo "APP_SERVER_LOG_DIR=$APP_SERVER_LOG_DIR" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
46+
47+
mkdir -p $APP_SERVER_LOG_DIR
48+
4149
- uses: actions/checkout@v4
4250
with:
4351
path: supertokens-node
@@ -69,12 +77,13 @@ jobs:
6977
run: |
7078
npm i
7179
72-
NODE_PORT=8080 node . &> app-server.log &
73-
NODE_PORT=8082 node . &> app-server-cross-domain.log &
80+
NODE_PORT=8080 node . &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server.log &
81+
NODE_PORT=8082 node . &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server-cross-domain.log &
7482
7583
- uses: supertokens/website-testing-action@main
7684
with:
7785
version: ${{ steps.versions.outputs.frontendVersionXy }}
7886
node-sdk-version: ${{ steps.versions.outputs.nodeTag }}
7987
path: supertokens-website
8088
check-name-suffix: "[Node=${{ matrix.node-version }}][FDI=${{ matrix.fdi-version }}]"
89+
app-server-logs: ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Fixes broken workflows (Example Tests, AWS Edge function compatibility)
1515
- Sets up workflow to run auth-react tests
1616
- Updates test-servers to work with updated tests
17+
- Fixes wrong types types from `string` to `number` on `createdAt`, `expiresAt` and `timeout` from the WebAuthn recipe
18+
- Fixed `email` property by making it optional on `getGeneratedOptions` recipe implementation method
19+
20+
## [23.0.0] - 2025-06-10
21+
22+
- The `getConsentRequest`, `acceptConsentRequest`, `rejectConsentRequest`, `acceptLoginRequest`, `rejectLoginRequest` and `introspectToken` can now possibly return an `ErrorOAuth2`.
23+
- The `/oauth/introspect` can now possibly return an `ErrorAuth2`.
24+
- The `User` class now has a `fromApi` function to normalize the user object returned from the API.
25+
- Refactors querier to use dynamic request body and response body types inference.
26+
- Refactor internal network calls made with querier to use the new dynamic types.
1727

1828
## [22.1.0] - 2025-04-04
1929

lib/build/core/paths.d.ts

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/core/paths.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/core/types.d.ts

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/core/types.js

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/customFramework.d.ts

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/customFramework.js

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/framework/custom/framework.js

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)