Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor custom framework utils to reuse them #933

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8830a25
Add init util methods for custom framework support
deepjyoti30-st Oct 2, 2024
daa0cb6
Add some more changes for the custom framework re-usability
deepjyoti30-st Oct 2, 2024
6bd7319
Expose custom framework
deepjyoti30-st Oct 2, 2024
0d4506f
Update changelog and bump version
deepjyoti30-st Oct 2, 2024
433d041
Add a fix for accessing SessionRecipe
deepjyoti30-st Oct 2, 2024
f80df58
Add init tests for the custom framework implementation
deepjyoti30-st Oct 3, 2024
61c5053
Update some variable names to match the custom framework definition
deepjyoti30-st Oct 3, 2024
57078ac
Add more tests for custom framework regarding withSession
deepjyoti30-st Oct 3, 2024
c015bad
Add tests for getSessionForSSR
deepjyoti30-st Oct 3, 2024
f2e5322
Fix mochar related config and command
deepjyoti30-st Oct 3, 2024
3cdc077
Add init changes to re-use functionality from custom framework in next
deepjyoti30-st Oct 3, 2024
e7d812b
Fix export name for customframework and version
deepjyoti30-st Oct 3, 2024
6e241d9
Add support for re-using duplicated code in nextjs from customframework
deepjyoti30-st Oct 3, 2024
a363f75
Reuse even more code from customframework into next.js
deepjyoti30-st Oct 3, 2024
db4a657
Reuse a customError handler in next
deepjyoti30-st Oct 3, 2024
40fb2d7
Update customFramework to handle JWT verification manually
deepjyoti30-st Oct 3, 2024
0bf1533
Use internal functions for jwt parsing
deepjyoti30-st Oct 4, 2024
9f6e7f3
Add a fix for accessing nextjs cookie extractor
deepjyoti30-st Oct 4, 2024
c9fee10
Reuse an util function for getting JWK's
deepjyoti30-st Oct 4, 2024
2d18d33
Reuse more functionality from custom framework in next
deepjyoti30-st Oct 4, 2024
564d9c0
Add a comment about acceptin jwks as a parameter for getSessionForSSR
deepjyoti30-st Oct 4, 2024
f22b3e2
several fixes and refactoring
rishabhpoddar Oct 4, 2024
892c05b
Fix custom framework related tests
deepjyoti30-st Oct 7, 2024
1d6e679
Add/fix tests for next js
deepjyoti30-st Oct 7, 2024
57be23d
Add test for session refresh in next
deepjyoti30-st Oct 7, 2024
bc8fa9a
Add test for core being down and error handler called in next
deepjyoti30-st Oct 7, 2024
8deff18
Add detail of breaking change in changelog
deepjyoti30-st Oct 7, 2024
75c4e28
Adds migration guide for using updated next.js handler function
deepjyoti30-st Oct 7, 2024
1502a59
Merge branch '21.0' into feat/refactor-custom-framework-utils-to-reus…
deepjyoti30-st Oct 7, 2024
31003c7
Merge branch '21.0' into feat/refactor-custom-framework-utils-to-reus…
rishabhpoddar Oct 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added a way to run CI on unmerged PRs
rishabhpoddar marked this conversation as resolved.
Show resolved Hide resolved
- Added support for FDIs: 3.1 and 4.0. Required by: auth-react >=0.49.0 and web-js>=0.15.0
- The `networkInterceptor` now also gets a new `params` prop in the request config.
- Adds `customFramework` util functions to minimize code required in custom frameworks like remix, astro etc.
- Replicates `fastify` types based on requirement for the SDK instead of using the original module.

### Breaking change
Expand Down Expand Up @@ -50,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- This means that we removed `override.openIdFeature` from the Session recipe configuration
- Removed `getJWKS` from the OpenId recipe, as it is already exposed by the JWT recipe
- We now automatically initialize the OpenId and JWT recipes even if you do not use the Session recipe
- `getAppDirRequestHandler` for `nextjs` will no longer accept a Response object.

### Migration

Expand Down Expand Up @@ -140,6 +142,25 @@ SuperTokens.init({
});
```

#### Using updated `getAppDirRequestHandler` for next.js

Before:

```ts
import { getAppDirRequestHandler } from "supertokens-node/nextjs";
import { NextResponse } from "next/server";

const handleCall = getAppDirRequestHandler(NextResponse);
```

After:

```ts
import { getAppDirRequestHandler } from "supertokens-node/nextjs";

const handleCall = getAppDirRequestHandler();
```

## [20.1.3] - 2024-09-30

- Replaces `psl` with `tldts` to avoid `punycode` deprecation warning.
Expand Down
11 changes: 11 additions & 0 deletions custom/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export * from "../lib/build/customFramework";
/**
* 'export *' does not re-export a default.
* import CustomFramework from "supertokens-node/custom";
* the above import statement won't be possible unless either
* - user add "esModuleInterop": true in their tsconfig.json file
* - we do the following change:
*/

import * as _default from "../lib/build/customFramework";
export default _default;
6 changes: 6 additions & 0 deletions custom/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
exports.__esModule = true;
__export(require("../lib/build/customFramework"));
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { getAppDirRequestHandler } from "supertokens-node/nextjs";
import { NextRequest, NextResponse } from "next/server";
import { NextRequest } from "next/server";
import supertokens from "supertokens-node";
import { backendConfig } from "../../../../config/backendConfig";

supertokens.init(backendConfig());

const handleCall = getAppDirRequestHandler(NextResponse);
const handleCall = getAppDirRequestHandler();

export async function GET(request: NextRequest) {
const res = await handleCall(request);
Expand Down
60 changes: 60 additions & 0 deletions lib/build/customFramework.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

208 changes: 208 additions & 0 deletions lib/build/customFramework.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 5 additions & 10 deletions lib/build/nextjs.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading