@descope/nextjs-sdk 0.3.37 → 0.4.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 +2 -2
- package/dist/cjs/client/index.js +48 -0
- package/dist/cjs/client/index.js.map +1 -0
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/server/authMiddleware.js +87 -0
- package/dist/cjs/server/authMiddleware.js.map +1 -0
- package/dist/cjs/server/constants.js +16 -0
- package/dist/cjs/server/constants.js.map +1 -0
- package/dist/cjs/server/index.js +13 -0
- package/dist/cjs/server/index.js.map +1 -0
- package/dist/cjs/server/sdk.js +29 -0
- package/dist/cjs/server/sdk.js.map +1 -0
- package/dist/cjs/server/session.js +31 -0
- package/dist/cjs/server/session.js.map +1 -0
- package/dist/cjs/server/utils.js +24 -0
- package/dist/cjs/server/utils.js.map +1 -0
- package/dist/cjs/shared/AuthProvider.js +15 -0
- package/dist/cjs/shared/AuthProvider.js.map +1 -0
- package/dist/cjs/shared/DescopeFlows.js +50 -0
- package/dist/cjs/shared/DescopeFlows.js.map +1 -0
- package/dist/cjs/shared/DescopeWidgets.js +27 -0
- package/dist/cjs/shared/DescopeWidgets.js.map +1 -0
- package/dist/cjs/shared/constants.js +10 -0
- package/dist/cjs/shared/constants.js.map +1 -0
- package/dist/esm/server/authMiddleware.js.map +1 -0
- package/dist/{server → esm/server}/constants.js +1 -1
- package/dist/esm/server/constants.js.map +1 -0
- package/dist/esm/server/sdk.js.map +1 -0
- package/dist/{server → esm/server}/session.js +2 -4
- package/dist/esm/server/session.js.map +1 -0
- package/dist/esm/server/utils.js.map +1 -0
- package/dist/esm/shared/AuthProvider.js.map +1 -0
- package/dist/esm/shared/DescopeFlows.js.map +1 -0
- package/dist/esm/shared/DescopeWidgets.js.map +1 -0
- package/dist/{shared → esm/shared}/constants.js +1 -1
- package/dist/esm/shared/constants.js.map +1 -0
- package/dist/{client/dts/src → types}/server/session.d.ts +1 -1
- package/dist/{client/dts/src → types}/shared/DescopeFlows.d.ts +8 -0
- package/package.json +28 -24
- package/dist/client/index.d.ts +0 -1
- package/dist/dts/src/client/index.d.ts +0 -1
- package/dist/dts/src/index.d.ts +0 -1
- package/dist/dts/src/server/authMiddleware.d.ts +0 -10
- package/dist/dts/src/server/constants.d.ts +0 -9
- package/dist/dts/src/server/index.d.ts +0 -3
- package/dist/dts/src/server/sdk.d.ts +0 -8
- package/dist/dts/src/server/session.d.ts +0 -4
- package/dist/dts/src/server/utils.d.ts +0 -1
- package/dist/dts/src/shared/AuthProvider.d.ts +0 -3
- package/dist/dts/src/shared/DescopeFlows.d.ts +0 -117
- package/dist/dts/src/shared/DescopeWidgets.d.ts +0 -54
- package/dist/dts/src/shared/constants.d.ts +0 -4
- package/dist/dts/src/shared/index.d.ts +0 -3
- package/dist/dts/src/types.d.ts +0 -1
- package/dist/index.d.ts +0 -177
- package/dist/server/authMiddleware.js.map +0 -1
- package/dist/server/constants.js.map +0 -1
- package/dist/server/dts/src/client/index.d.ts +0 -1
- package/dist/server/dts/src/index.d.ts +0 -1
- package/dist/server/dts/src/server/authMiddleware.d.ts +0 -10
- package/dist/server/dts/src/server/constants.d.ts +0 -9
- package/dist/server/dts/src/server/index.d.ts +0 -3
- package/dist/server/dts/src/server/sdk.d.ts +0 -8
- package/dist/server/dts/src/server/session.d.ts +0 -4
- package/dist/server/dts/src/server/utils.d.ts +0 -1
- package/dist/server/dts/src/shared/AuthProvider.d.ts +0 -3
- package/dist/server/dts/src/shared/DescopeFlows.d.ts +0 -117
- package/dist/server/dts/src/shared/DescopeWidgets.d.ts +0 -54
- package/dist/server/dts/src/shared/constants.d.ts +0 -4
- package/dist/server/dts/src/shared/index.d.ts +0 -3
- package/dist/server/dts/src/types.d.ts +0 -1
- package/dist/server/index.d.ts +0 -23
- package/dist/server/sdk.js.map +0 -1
- package/dist/server/session.js.map +0 -1
- package/dist/server/utils.js.map +0 -1
- package/dist/shared/AuthProvider.js.map +0 -1
- package/dist/shared/DescopeFlows.js.map +0 -1
- package/dist/shared/DescopeWidgets.js.map +0 -1
- package/dist/shared/constants.js.map +0 -1
- /package/dist/{client → esm/client}/index.js +0 -0
- /package/dist/{client → esm/client}/index.js.map +0 -0
- /package/dist/{index.js → esm/index.js} +0 -0
- /package/dist/{index.js.map → esm/index.js.map} +0 -0
- /package/dist/{server → esm/server}/authMiddleware.js +0 -0
- /package/dist/{server → esm/server}/index.js +0 -0
- /package/dist/{server → esm/server}/index.js.map +0 -0
- /package/dist/{server → esm/server}/sdk.js +0 -0
- /package/dist/{server → esm/server}/utils.js +0 -0
- /package/dist/{shared → esm/shared}/AuthProvider.js +0 -0
- /package/dist/{shared → esm/shared}/DescopeFlows.js +0 -0
- /package/dist/{shared → esm/shared}/DescopeWidgets.js +0 -0
- /package/dist/{client/dts/src → types}/client/index.d.ts +0 -0
- /package/dist/{client/dts/src → types}/index.d.ts +0 -0
- /package/dist/{client/dts/src → types}/server/authMiddleware.d.ts +0 -0
- /package/dist/{client/dts/src → types}/server/constants.d.ts +0 -0
- /package/dist/{client/dts/src → types}/server/index.d.ts +0 -0
- /package/dist/{client/dts/src → types}/server/sdk.d.ts +0 -0
- /package/dist/{client/dts/src → types}/server/utils.d.ts +0 -0
- /package/dist/{client/dts/src → types}/shared/AuthProvider.d.ts +0 -0
- /package/dist/{client/dts/src → types}/shared/DescopeWidgets.d.ts +0 -0
- /package/dist/{client/dts/src → types}/shared/constants.d.ts +0 -0
- /package/dist/{client/dts/src → types}/shared/index.d.ts +0 -0
- /package/dist/{client/dts/src → types}/types.d.ts +0 -0
|
@@ -32,8 +32,11 @@ export declare const Descope: React.ComponentType<{
|
|
|
32
32
|
form?: Record<string, any>;
|
|
33
33
|
client?: Record<string, any>;
|
|
34
34
|
styleId?: string;
|
|
35
|
+
onScreenUpdate?: (screenName: string, context: Record<string, any>, next: (interactionId: string, form: Record<string, any>) => Promise<unknown>, ref: HTMLElement) => boolean | Promise<boolean>;
|
|
36
|
+
children?: _1.ReactNode;
|
|
35
37
|
} & _1.RefAttributes<HTMLElement> & AdditionalProps>;
|
|
36
38
|
export declare const SignInFlow: React.ComponentType<{
|
|
39
|
+
children?: _1.ReactNode;
|
|
37
40
|
form?: Record<string, any>;
|
|
38
41
|
onSuccess?: (e: CustomEvent<import("@descope/core-js-sdk").JWTResponse>) => void;
|
|
39
42
|
onError?: (e: CustomEvent<{
|
|
@@ -59,8 +62,10 @@ export declare const SignInFlow: React.ComponentType<{
|
|
|
59
62
|
}) => string;
|
|
60
63
|
client?: Record<string, any>;
|
|
61
64
|
styleId?: string;
|
|
65
|
+
onScreenUpdate?: (screenName: string, context: Record<string, any>, next: (interactionId: string, form: Record<string, any>) => Promise<unknown>, ref: HTMLElement) => boolean | Promise<boolean>;
|
|
62
66
|
} & AdditionalProps>;
|
|
63
67
|
export declare const SignUpFlow: React.ComponentType<{
|
|
68
|
+
children?: _1.ReactNode;
|
|
64
69
|
form?: Record<string, any>;
|
|
65
70
|
onSuccess?: (e: CustomEvent<import("@descope/core-js-sdk").JWTResponse>) => void;
|
|
66
71
|
onError?: (e: CustomEvent<{
|
|
@@ -86,8 +91,10 @@ export declare const SignUpFlow: React.ComponentType<{
|
|
|
86
91
|
}) => string;
|
|
87
92
|
client?: Record<string, any>;
|
|
88
93
|
styleId?: string;
|
|
94
|
+
onScreenUpdate?: (screenName: string, context: Record<string, any>, next: (interactionId: string, form: Record<string, any>) => Promise<unknown>, ref: HTMLElement) => boolean | Promise<boolean>;
|
|
89
95
|
} & AdditionalProps>;
|
|
90
96
|
export declare const SignUpOrInFlow: React.ComponentType<{
|
|
97
|
+
children?: _1.ReactNode;
|
|
91
98
|
form?: Record<string, any>;
|
|
92
99
|
onSuccess?: (e: CustomEvent<import("@descope/core-js-sdk").JWTResponse>) => void;
|
|
93
100
|
onError?: (e: CustomEvent<{
|
|
@@ -113,5 +120,6 @@ export declare const SignUpOrInFlow: React.ComponentType<{
|
|
|
113
120
|
}) => string;
|
|
114
121
|
client?: Record<string, any>;
|
|
115
122
|
styleId?: string;
|
|
123
|
+
onScreenUpdate?: (screenName: string, context: Record<string, any>, next: (interactionId: string, form: Record<string, any>) => Promise<unknown>, ref: HTMLElement) => boolean | Promise<boolean>;
|
|
116
124
|
} & AdditionalProps>;
|
|
117
125
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descope/nextjs-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Descope NextJS SDK",
|
|
5
5
|
"author": "Descope Team <info@descope.com>",
|
|
6
6
|
"homepage": "https://github.com/descope/descope-js",
|
|
@@ -17,39 +17,42 @@
|
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
19
|
"import": {
|
|
20
|
-
"types": "./dist/index.d.ts",
|
|
21
|
-
"default": "./dist/index.js"
|
|
22
|
-
}
|
|
20
|
+
"types": "./dist/types/index.d.ts",
|
|
21
|
+
"default": "./dist/esm/index.js"
|
|
22
|
+
},
|
|
23
|
+
"require": "./dist/cjs/index.js"
|
|
23
24
|
},
|
|
24
25
|
"./client": {
|
|
25
26
|
"import": {
|
|
26
|
-
"types": "./dist/client/index.d.ts",
|
|
27
|
-
"default": "./dist/client/index.js"
|
|
28
|
-
}
|
|
27
|
+
"types": "./dist/types/client/index.d.ts",
|
|
28
|
+
"default": "./dist/esm/client/index.js"
|
|
29
|
+
},
|
|
30
|
+
"require": "./dist/cjs/client/index.js"
|
|
29
31
|
},
|
|
30
32
|
"./server": {
|
|
31
33
|
"import": {
|
|
32
|
-
"types": "./dist/server/index.d.ts",
|
|
33
|
-
"default": "./dist/server/index.js"
|
|
34
|
-
}
|
|
34
|
+
"types": "./dist/types/server/index.d.ts",
|
|
35
|
+
"default": "./dist/esm/server/index.js"
|
|
36
|
+
},
|
|
37
|
+
"require": "./dist/cjs/server/index.js"
|
|
35
38
|
}
|
|
36
39
|
},
|
|
37
40
|
"typesVersions": {
|
|
38
41
|
"*": {
|
|
39
42
|
"*": [
|
|
40
|
-
"dist/index.d.ts"
|
|
43
|
+
"dist/types/index.d.ts"
|
|
41
44
|
],
|
|
42
45
|
"client": [
|
|
43
|
-
"dist/client/index.d.ts"
|
|
46
|
+
"dist/types/client/index.d.ts"
|
|
44
47
|
],
|
|
45
48
|
"server": [
|
|
46
|
-
"dist/server/index.d.ts"
|
|
49
|
+
"dist/types/server/index.d.ts"
|
|
47
50
|
]
|
|
48
51
|
}
|
|
49
52
|
},
|
|
50
|
-
"main": "dist/index.js",
|
|
51
|
-
"module": "dist/index.mjs",
|
|
52
|
-
"types": "dist/index.d.ts",
|
|
53
|
+
"main": "./dist/cjs/index.js",
|
|
54
|
+
"module": "./dist/esm/index.mjs",
|
|
55
|
+
"types": "./dist/types/index.d.ts",
|
|
53
56
|
"files": [
|
|
54
57
|
"dist/**/*"
|
|
55
58
|
],
|
|
@@ -61,9 +64,9 @@
|
|
|
61
64
|
},
|
|
62
65
|
"dependencies": {
|
|
63
66
|
"@descope/node-sdk": "1.6.13",
|
|
64
|
-
"@descope/
|
|
65
|
-
"@descope/
|
|
66
|
-
"@descope/
|
|
67
|
+
"@descope/react-sdk": "2.4.0",
|
|
68
|
+
"@descope/core-js-sdk": "2.34.0",
|
|
69
|
+
"@descope/web-component": "3.34.0"
|
|
67
70
|
},
|
|
68
71
|
"devDependencies": {
|
|
69
72
|
"@babel/core": "7.26.0",
|
|
@@ -71,7 +74,7 @@
|
|
|
71
74
|
"@babel/preset-react": "7.26.3",
|
|
72
75
|
"@babel/preset-typescript": "7.26.0",
|
|
73
76
|
"@open-wc/rollup-plugin-html": "^1.2.5",
|
|
74
|
-
"@rollup/plugin-commonjs": "^
|
|
77
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
|
75
78
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
76
79
|
"@rollup/plugin-alias": "5.1.1",
|
|
77
80
|
"@rollup/plugin-replace": "^5.0.5",
|
|
@@ -98,7 +101,7 @@
|
|
|
98
101
|
"eslint-plugin-prefer-arrow": "1.2.3",
|
|
99
102
|
"eslint-plugin-prettier": "4.2.1",
|
|
100
103
|
"eslint-plugin-promise": "6.6.0",
|
|
101
|
-
"eslint-plugin-react": "7.
|
|
104
|
+
"eslint-plugin-react": "7.37.4",
|
|
102
105
|
"eslint-plugin-react-hooks": "4.6.2",
|
|
103
106
|
"eslint-plugin-testing-library": "5.11.1",
|
|
104
107
|
"git-format-staged": "^3.0.0",
|
|
@@ -108,15 +111,16 @@
|
|
|
108
111
|
"jest-fetch-mock": "^3.0.3",
|
|
109
112
|
"lint-staged": "^13.3.0",
|
|
110
113
|
"msw": "^2.1.7",
|
|
111
|
-
"next": "
|
|
112
|
-
"rollup": "^
|
|
114
|
+
"next": "15.1.7",
|
|
115
|
+
"rollup": "^4.0.0",
|
|
113
116
|
"rollup-plugin-auto-external": "^2.0.0",
|
|
114
117
|
"rollup-plugin-browsersync": "^1.0.0",
|
|
115
118
|
"rollup-plugin-define": "^1.0.1",
|
|
116
119
|
"rollup-plugin-delete": "^2.0.0",
|
|
117
120
|
"rollup-plugin-dotenv": "^0.5.0",
|
|
118
|
-
"rollup-plugin-dts": "^
|
|
121
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
119
122
|
"rollup-plugin-livereload": "^2.0.5",
|
|
123
|
+
"rollup-plugin-no-emit": "1.2.1",
|
|
120
124
|
"rollup-plugin-preserve-directives": "^0.4.0",
|
|
121
125
|
"rollup-plugin-serve": "^2.0.3",
|
|
122
126
|
"rollup-plugin-swc3": "^0.12.0",
|
package/dist/client/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { getJwtPermissions, getJwtRoles, getRefreshToken, getSessionToken, isRefreshTokenExpired, isSessionTokenExpired, refresh, useDescope, useSession, useUser } from '@descope/react-sdk';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useDescope, useSession, useUser, getSessionToken, getRefreshToken, isSessionTokenExpired, isRefreshTokenExpired, getJwtPermissions, getJwtRoles, refresh } from '@descope/react-sdk';
|
package/dist/dts/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './shared';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
-
type MiddlewareOptions = {
|
|
3
|
-
projectId?: string;
|
|
4
|
-
baseUrl?: string;
|
|
5
|
-
redirectUrl?: string;
|
|
6
|
-
publicRoutes?: string[];
|
|
7
|
-
privateRoutes?: string[];
|
|
8
|
-
};
|
|
9
|
-
declare const createAuthMiddleware: (options?: MiddlewareOptions) => (req: NextRequest) => Promise<NextResponse<unknown>>;
|
|
10
|
-
export default createAuthMiddleware;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const DESCOPE_SESSION_HEADER = "x-descope-session";
|
|
2
|
-
export declare const baseHeaders: {
|
|
3
|
-
'x-descope-sdk-name': string;
|
|
4
|
-
'x-descope-sdk-version': string;
|
|
5
|
-
};
|
|
6
|
-
export declare const DEFAULT_PUBLIC_ROUTES: {
|
|
7
|
-
signIn: string;
|
|
8
|
-
signUp: string;
|
|
9
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import descopeSdk from '@descope/node-sdk';
|
|
2
|
-
type Sdk = ReturnType<typeof descopeSdk>;
|
|
3
|
-
type CreateSdkParams = Omit<Parameters<typeof descopeSdk>[0], 'projectId'> & {
|
|
4
|
-
projectId?: string | undefined;
|
|
5
|
-
};
|
|
6
|
-
export declare const createSdk: (config?: CreateSdkParams) => Sdk;
|
|
7
|
-
export declare const getGlobalSdk: (config?: Pick<CreateSdkParams, 'projectId' | 'baseUrl'>) => Sdk;
|
|
8
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const mergeSearchParams: (...searchParams: string[]) => string;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import type * as _1 from '@descope/react-sdk/node_modules/@types/react';
|
|
2
|
-
import type * as _2 from '@descope/react-sdk/node_modules/@descope/web-component/dist';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
type AdditionalProps = {
|
|
5
|
-
redirectAfterSuccess?: string;
|
|
6
|
-
redirectAfterError?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const Descope: React.ComponentType<{
|
|
9
|
-
flowId: string;
|
|
10
|
-
onSuccess?: (e: CustomEvent<import("@descope/core-js-sdk").JWTResponse>) => void;
|
|
11
|
-
onError?: (e: CustomEvent<{
|
|
12
|
-
errorCode: string;
|
|
13
|
-
errorDescription: string;
|
|
14
|
-
errorMessage?: string;
|
|
15
|
-
retryAfter?: string;
|
|
16
|
-
}>) => void;
|
|
17
|
-
onReady?: (e: CustomEvent<{}>) => void;
|
|
18
|
-
logger?: Partial<any>;
|
|
19
|
-
tenant?: string;
|
|
20
|
-
theme?: _2.ThemeOptions;
|
|
21
|
-
locale?: string;
|
|
22
|
-
autoFocus?: _2.AutoFocusOptions;
|
|
23
|
-
validateOnBlur?: boolean;
|
|
24
|
-
restartOnError?: boolean;
|
|
25
|
-
debug?: boolean;
|
|
26
|
-
telemetryKey?: string;
|
|
27
|
-
redirectUrl?: string;
|
|
28
|
-
errorTransformer?: (error: {
|
|
29
|
-
text: string;
|
|
30
|
-
type: string;
|
|
31
|
-
}) => string;
|
|
32
|
-
form?: Record<string, any>;
|
|
33
|
-
client?: Record<string, any>;
|
|
34
|
-
styleId?: string;
|
|
35
|
-
} & _1.RefAttributes<HTMLElement> & AdditionalProps>;
|
|
36
|
-
export declare const SignInFlow: React.ComponentType<{
|
|
37
|
-
form?: Record<string, any>;
|
|
38
|
-
onSuccess?: (e: CustomEvent<import("@descope/core-js-sdk").JWTResponse>) => void;
|
|
39
|
-
onError?: (e: CustomEvent<{
|
|
40
|
-
errorCode: string;
|
|
41
|
-
errorDescription: string;
|
|
42
|
-
errorMessage?: string;
|
|
43
|
-
retryAfter?: string;
|
|
44
|
-
}>) => void;
|
|
45
|
-
onReady?: (e: CustomEvent<{}>) => void;
|
|
46
|
-
logger?: Partial<any>;
|
|
47
|
-
tenant?: string;
|
|
48
|
-
theme?: _2.ThemeOptions;
|
|
49
|
-
locale?: string;
|
|
50
|
-
autoFocus?: _2.AutoFocusOptions;
|
|
51
|
-
validateOnBlur?: boolean;
|
|
52
|
-
restartOnError?: boolean;
|
|
53
|
-
debug?: boolean;
|
|
54
|
-
telemetryKey?: string;
|
|
55
|
-
redirectUrl?: string;
|
|
56
|
-
errorTransformer?: (error: {
|
|
57
|
-
text: string;
|
|
58
|
-
type: string;
|
|
59
|
-
}) => string;
|
|
60
|
-
client?: Record<string, any>;
|
|
61
|
-
styleId?: string;
|
|
62
|
-
} & AdditionalProps>;
|
|
63
|
-
export declare const SignUpFlow: React.ComponentType<{
|
|
64
|
-
form?: Record<string, any>;
|
|
65
|
-
onSuccess?: (e: CustomEvent<import("@descope/core-js-sdk").JWTResponse>) => void;
|
|
66
|
-
onError?: (e: CustomEvent<{
|
|
67
|
-
errorCode: string;
|
|
68
|
-
errorDescription: string;
|
|
69
|
-
errorMessage?: string;
|
|
70
|
-
retryAfter?: string;
|
|
71
|
-
}>) => void;
|
|
72
|
-
onReady?: (e: CustomEvent<{}>) => void;
|
|
73
|
-
logger?: Partial<any>;
|
|
74
|
-
tenant?: string;
|
|
75
|
-
theme?: _2.ThemeOptions;
|
|
76
|
-
locale?: string;
|
|
77
|
-
autoFocus?: _2.AutoFocusOptions;
|
|
78
|
-
validateOnBlur?: boolean;
|
|
79
|
-
restartOnError?: boolean;
|
|
80
|
-
debug?: boolean;
|
|
81
|
-
telemetryKey?: string;
|
|
82
|
-
redirectUrl?: string;
|
|
83
|
-
errorTransformer?: (error: {
|
|
84
|
-
text: string;
|
|
85
|
-
type: string;
|
|
86
|
-
}) => string;
|
|
87
|
-
client?: Record<string, any>;
|
|
88
|
-
styleId?: string;
|
|
89
|
-
} & AdditionalProps>;
|
|
90
|
-
export declare const SignUpOrInFlow: React.ComponentType<{
|
|
91
|
-
form?: Record<string, any>;
|
|
92
|
-
onSuccess?: (e: CustomEvent<import("@descope/core-js-sdk").JWTResponse>) => void;
|
|
93
|
-
onError?: (e: CustomEvent<{
|
|
94
|
-
errorCode: string;
|
|
95
|
-
errorDescription: string;
|
|
96
|
-
errorMessage?: string;
|
|
97
|
-
retryAfter?: string;
|
|
98
|
-
}>) => void;
|
|
99
|
-
onReady?: (e: CustomEvent<{}>) => void;
|
|
100
|
-
logger?: Partial<any>;
|
|
101
|
-
tenant?: string;
|
|
102
|
-
theme?: _2.ThemeOptions;
|
|
103
|
-
locale?: string;
|
|
104
|
-
autoFocus?: _2.AutoFocusOptions;
|
|
105
|
-
validateOnBlur?: boolean;
|
|
106
|
-
restartOnError?: boolean;
|
|
107
|
-
debug?: boolean;
|
|
108
|
-
telemetryKey?: string;
|
|
109
|
-
redirectUrl?: string;
|
|
110
|
-
errorTransformer?: (error: {
|
|
111
|
-
text: string;
|
|
112
|
-
type: string;
|
|
113
|
-
}) => string;
|
|
114
|
-
client?: Record<string, any>;
|
|
115
|
-
styleId?: string;
|
|
116
|
-
} & AdditionalProps>;
|
|
117
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type * as _1 from '@descope/react-sdk/node_modules/@types/react';
|
|
2
|
-
import { ComponentType } from 'react';
|
|
3
|
-
export declare const UserManagement: ComponentType<{
|
|
4
|
-
logger?: Partial<any>;
|
|
5
|
-
tenant: string;
|
|
6
|
-
widgetId: string;
|
|
7
|
-
theme?: import("@descope/web-component").ThemeOptions;
|
|
8
|
-
debug?: boolean;
|
|
9
|
-
styleId?: string;
|
|
10
|
-
} & _1.RefAttributes<HTMLElement>>;
|
|
11
|
-
export declare const RoleManagement: ComponentType<{
|
|
12
|
-
logger?: Partial<any>;
|
|
13
|
-
tenant: string;
|
|
14
|
-
widgetId: string;
|
|
15
|
-
theme?: import("@descope/web-component").ThemeOptions;
|
|
16
|
-
debug?: boolean;
|
|
17
|
-
styleId?: string;
|
|
18
|
-
} & _1.RefAttributes<HTMLElement>>;
|
|
19
|
-
export declare const AccessKeyManagement: ComponentType<{
|
|
20
|
-
logger?: Partial<any>;
|
|
21
|
-
tenant: string;
|
|
22
|
-
widgetId: string;
|
|
23
|
-
theme?: import("@descope/web-component").ThemeOptions;
|
|
24
|
-
debug?: boolean;
|
|
25
|
-
styleId?: string;
|
|
26
|
-
} & _1.RefAttributes<HTMLElement>>;
|
|
27
|
-
export declare const AuditManagement: ComponentType<{
|
|
28
|
-
logger?: Partial<any>;
|
|
29
|
-
tenant: string;
|
|
30
|
-
widgetId: string;
|
|
31
|
-
theme?: import("@descope/web-component").ThemeOptions;
|
|
32
|
-
debug?: boolean;
|
|
33
|
-
styleId?: string;
|
|
34
|
-
} & _1.RefAttributes<HTMLElement>>;
|
|
35
|
-
export declare const UserProfile: ComponentType<Omit<{
|
|
36
|
-
logger?: Partial<any>;
|
|
37
|
-
tenant: string;
|
|
38
|
-
widgetId: string;
|
|
39
|
-
theme?: import("@descope/web-component").ThemeOptions;
|
|
40
|
-
debug?: boolean;
|
|
41
|
-
styleId?: string;
|
|
42
|
-
}, "tenant"> & {
|
|
43
|
-
onLogout?: (e: CustomEvent<any>) => void;
|
|
44
|
-
} & _1.RefAttributes<HTMLElement>>;
|
|
45
|
-
export declare const ApplicationsPortal: ComponentType<Omit<{
|
|
46
|
-
logger?: Partial<any>;
|
|
47
|
-
tenant: string;
|
|
48
|
-
widgetId: string;
|
|
49
|
-
theme?: import("@descope/web-component").ThemeOptions;
|
|
50
|
-
debug?: boolean;
|
|
51
|
-
styleId?: string;
|
|
52
|
-
}, "tenant"> & {
|
|
53
|
-
onLogout?: (e: CustomEvent<any>) => void;
|
|
54
|
-
} & _1.RefAttributes<HTMLElement>>;
|
package/dist/dts/src/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type TempType = {};
|
package/dist/index.d.ts
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { AuthProvider as AuthProvider$1 } from '@descope/react-sdk';
|
|
2
|
-
import * as _descope_core_js_sdk from '@descope/core-js-sdk';
|
|
3
|
-
import * as _1 from '@descope/react-sdk/node_modules/@types/react';
|
|
4
|
-
import * as _2 from '@descope/react-sdk/node_modules/@descope/web-component/dist';
|
|
5
|
-
import React, { ComponentType } from 'react';
|
|
6
|
-
import * as _descope_web_component from '@descope/web-component';
|
|
7
|
-
|
|
8
|
-
declare const AuthProvider: typeof AuthProvider$1;
|
|
9
|
-
|
|
10
|
-
type AdditionalProps = {
|
|
11
|
-
redirectAfterSuccess?: string;
|
|
12
|
-
redirectAfterError?: string;
|
|
13
|
-
};
|
|
14
|
-
declare const Descope: React.ComponentType<{
|
|
15
|
-
flowId: string;
|
|
16
|
-
onSuccess?: (e: CustomEvent<_descope_core_js_sdk.JWTResponse>) => void;
|
|
17
|
-
onError?: (e: CustomEvent<{
|
|
18
|
-
errorCode: string;
|
|
19
|
-
errorDescription: string;
|
|
20
|
-
errorMessage?: string;
|
|
21
|
-
retryAfter?: string;
|
|
22
|
-
}>) => void;
|
|
23
|
-
onReady?: (e: CustomEvent<{}>) => void;
|
|
24
|
-
logger?: Partial<any>;
|
|
25
|
-
tenant?: string;
|
|
26
|
-
theme?: _2.ThemeOptions;
|
|
27
|
-
locale?: string;
|
|
28
|
-
autoFocus?: _2.AutoFocusOptions;
|
|
29
|
-
validateOnBlur?: boolean;
|
|
30
|
-
restartOnError?: boolean;
|
|
31
|
-
debug?: boolean;
|
|
32
|
-
telemetryKey?: string;
|
|
33
|
-
redirectUrl?: string;
|
|
34
|
-
errorTransformer?: (error: {
|
|
35
|
-
text: string;
|
|
36
|
-
type: string;
|
|
37
|
-
}) => string;
|
|
38
|
-
form?: Record<string, any>;
|
|
39
|
-
client?: Record<string, any>;
|
|
40
|
-
styleId?: string;
|
|
41
|
-
} & _1.RefAttributes<HTMLElement> & AdditionalProps>;
|
|
42
|
-
declare const SignInFlow: React.ComponentType<{
|
|
43
|
-
form?: Record<string, any>;
|
|
44
|
-
onSuccess?: (e: CustomEvent<_descope_core_js_sdk.JWTResponse>) => void;
|
|
45
|
-
onError?: (e: CustomEvent<{
|
|
46
|
-
errorCode: string;
|
|
47
|
-
errorDescription: string;
|
|
48
|
-
errorMessage?: string;
|
|
49
|
-
retryAfter?: string;
|
|
50
|
-
}>) => void;
|
|
51
|
-
onReady?: (e: CustomEvent<{}>) => void;
|
|
52
|
-
logger?: Partial<any>;
|
|
53
|
-
tenant?: string;
|
|
54
|
-
theme?: _2.ThemeOptions;
|
|
55
|
-
locale?: string;
|
|
56
|
-
autoFocus?: _2.AutoFocusOptions;
|
|
57
|
-
validateOnBlur?: boolean;
|
|
58
|
-
restartOnError?: boolean;
|
|
59
|
-
debug?: boolean;
|
|
60
|
-
telemetryKey?: string;
|
|
61
|
-
redirectUrl?: string;
|
|
62
|
-
errorTransformer?: (error: {
|
|
63
|
-
text: string;
|
|
64
|
-
type: string;
|
|
65
|
-
}) => string;
|
|
66
|
-
client?: Record<string, any>;
|
|
67
|
-
styleId?: string;
|
|
68
|
-
} & AdditionalProps>;
|
|
69
|
-
declare const SignUpFlow: React.ComponentType<{
|
|
70
|
-
form?: Record<string, any>;
|
|
71
|
-
onSuccess?: (e: CustomEvent<_descope_core_js_sdk.JWTResponse>) => void;
|
|
72
|
-
onError?: (e: CustomEvent<{
|
|
73
|
-
errorCode: string;
|
|
74
|
-
errorDescription: string;
|
|
75
|
-
errorMessage?: string;
|
|
76
|
-
retryAfter?: string;
|
|
77
|
-
}>) => void;
|
|
78
|
-
onReady?: (e: CustomEvent<{}>) => void;
|
|
79
|
-
logger?: Partial<any>;
|
|
80
|
-
tenant?: string;
|
|
81
|
-
theme?: _2.ThemeOptions;
|
|
82
|
-
locale?: string;
|
|
83
|
-
autoFocus?: _2.AutoFocusOptions;
|
|
84
|
-
validateOnBlur?: boolean;
|
|
85
|
-
restartOnError?: boolean;
|
|
86
|
-
debug?: boolean;
|
|
87
|
-
telemetryKey?: string;
|
|
88
|
-
redirectUrl?: string;
|
|
89
|
-
errorTransformer?: (error: {
|
|
90
|
-
text: string;
|
|
91
|
-
type: string;
|
|
92
|
-
}) => string;
|
|
93
|
-
client?: Record<string, any>;
|
|
94
|
-
styleId?: string;
|
|
95
|
-
} & AdditionalProps>;
|
|
96
|
-
declare const SignUpOrInFlow: React.ComponentType<{
|
|
97
|
-
form?: Record<string, any>;
|
|
98
|
-
onSuccess?: (e: CustomEvent<_descope_core_js_sdk.JWTResponse>) => void;
|
|
99
|
-
onError?: (e: CustomEvent<{
|
|
100
|
-
errorCode: string;
|
|
101
|
-
errorDescription: string;
|
|
102
|
-
errorMessage?: string;
|
|
103
|
-
retryAfter?: string;
|
|
104
|
-
}>) => void;
|
|
105
|
-
onReady?: (e: CustomEvent<{}>) => void;
|
|
106
|
-
logger?: Partial<any>;
|
|
107
|
-
tenant?: string;
|
|
108
|
-
theme?: _2.ThemeOptions;
|
|
109
|
-
locale?: string;
|
|
110
|
-
autoFocus?: _2.AutoFocusOptions;
|
|
111
|
-
validateOnBlur?: boolean;
|
|
112
|
-
restartOnError?: boolean;
|
|
113
|
-
debug?: boolean;
|
|
114
|
-
telemetryKey?: string;
|
|
115
|
-
redirectUrl?: string;
|
|
116
|
-
errorTransformer?: (error: {
|
|
117
|
-
text: string;
|
|
118
|
-
type: string;
|
|
119
|
-
}) => string;
|
|
120
|
-
client?: Record<string, any>;
|
|
121
|
-
styleId?: string;
|
|
122
|
-
} & AdditionalProps>;
|
|
123
|
-
|
|
124
|
-
declare const UserManagement: ComponentType<{
|
|
125
|
-
logger?: Partial<any>;
|
|
126
|
-
tenant: string;
|
|
127
|
-
widgetId: string;
|
|
128
|
-
theme?: _descope_web_component.ThemeOptions;
|
|
129
|
-
debug?: boolean;
|
|
130
|
-
styleId?: string;
|
|
131
|
-
} & _1.RefAttributes<HTMLElement>>;
|
|
132
|
-
declare const RoleManagement: ComponentType<{
|
|
133
|
-
logger?: Partial<any>;
|
|
134
|
-
tenant: string;
|
|
135
|
-
widgetId: string;
|
|
136
|
-
theme?: _descope_web_component.ThemeOptions;
|
|
137
|
-
debug?: boolean;
|
|
138
|
-
styleId?: string;
|
|
139
|
-
} & _1.RefAttributes<HTMLElement>>;
|
|
140
|
-
declare const AccessKeyManagement: ComponentType<{
|
|
141
|
-
logger?: Partial<any>;
|
|
142
|
-
tenant: string;
|
|
143
|
-
widgetId: string;
|
|
144
|
-
theme?: _descope_web_component.ThemeOptions;
|
|
145
|
-
debug?: boolean;
|
|
146
|
-
styleId?: string;
|
|
147
|
-
} & _1.RefAttributes<HTMLElement>>;
|
|
148
|
-
declare const AuditManagement: ComponentType<{
|
|
149
|
-
logger?: Partial<any>;
|
|
150
|
-
tenant: string;
|
|
151
|
-
widgetId: string;
|
|
152
|
-
theme?: _descope_web_component.ThemeOptions;
|
|
153
|
-
debug?: boolean;
|
|
154
|
-
styleId?: string;
|
|
155
|
-
} & _1.RefAttributes<HTMLElement>>;
|
|
156
|
-
declare const UserProfile: ComponentType<Omit<{
|
|
157
|
-
logger?: Partial<any>;
|
|
158
|
-
tenant: string;
|
|
159
|
-
widgetId: string;
|
|
160
|
-
theme?: _descope_web_component.ThemeOptions;
|
|
161
|
-
debug?: boolean;
|
|
162
|
-
styleId?: string;
|
|
163
|
-
}, "tenant"> & {
|
|
164
|
-
onLogout?: (e: CustomEvent<any>) => void;
|
|
165
|
-
} & _1.RefAttributes<HTMLElement>>;
|
|
166
|
-
declare const ApplicationsPortal: ComponentType<Omit<{
|
|
167
|
-
logger?: Partial<any>;
|
|
168
|
-
tenant: string;
|
|
169
|
-
widgetId: string;
|
|
170
|
-
theme?: _descope_web_component.ThemeOptions;
|
|
171
|
-
debug?: boolean;
|
|
172
|
-
styleId?: string;
|
|
173
|
-
}, "tenant"> & {
|
|
174
|
-
onLogout?: (e: CustomEvent<any>) => void;
|
|
175
|
-
} & _1.RefAttributes<HTMLElement>>;
|
|
176
|
-
|
|
177
|
-
export { AccessKeyManagement, ApplicationsPortal, AuditManagement, AuthProvider, Descope, RoleManagement, SignInFlow, SignUpFlow, SignUpOrInFlow, UserManagement, UserProfile };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authMiddleware.js","sources":["../../src/server/authMiddleware.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { NextRequest, NextResponse } from 'next/server';\nimport descopeSdk from '@descope/node-sdk';\nimport type { AuthenticationInfo } from '@descope/node-sdk';\nimport { DEFAULT_PUBLIC_ROUTES, DESCOPE_SESSION_HEADER } from './constants';\nimport { getGlobalSdk } from './sdk';\nimport { mergeSearchParams } from './utils';\n\ntype MiddlewareOptions = {\n\t// The Descope project ID to use for authentication\n\t// Defaults to process.env.DESCOPE_PROJECT_ID\n\tprojectId?: string;\n\n\t// The base URL to use for authentication\n\t// Defaults to process.env.DESCOPE_BASE_URL\n\tbaseUrl?: string;\n\n\t// The URL to redirect to if the user is not authenticated\n\t// Defaults to process.env.SIGN_IN_ROUTE or '/sign-in' if not provided\n\t// NOTE: In case it contains query parameters that exist in the original URL, they will override the original query parameters. e.g. if the original URL is /page?param1=1¶m2=2 and the redirect URL is /sign-in?param1=3, the final redirect URL will be /sign-in?param1=3¶m2=2\n\tredirectUrl?: string;\n\n\t// An array of public routes that do not require authentication\n\t// In addition to the default public routes:\n\t// - process.env.SIGN_IN_ROUTE or /sign-in if not provided\n\t// - process.env.SIGN_UP_ROUTE or /sign-up if not provided\n\tpublicRoutes?: string[];\n\n\t// An array of private routes that require authentication\n\t// If privateRoutes is defined, routes not listed in this array will default to public routes\n\tprivateRoutes?: string[];\n};\n\nconst getSessionJwt = (req: NextRequest): string | undefined => {\n\tlet jwt = req.headers?.get('Authorization')?.split(' ')[1];\n\tif (jwt) {\n\t\treturn jwt;\n\t}\n\n\tjwt = req.cookies?.get(descopeSdk.SessionTokenCookieName)?.value;\n\tif (jwt) {\n\t\treturn jwt;\n\t}\n\treturn undefined;\n};\n\nconst isPublicRoute = (req: NextRequest, options: MiddlewareOptions) => {\n\t// Ensure publicRoutes and privateRoutes are arrays, defaulting to empty arrays if not defined\n\tconst publicRoutes = options.publicRoutes || [];\n\tconst privateRoutes = options.privateRoutes || [];\n\n\tconst isDefaultPublicRoute = Object.values(DEFAULT_PUBLIC_ROUTES).includes(\n\t\treq.nextUrl.pathname\n\t);\n\n\tif (publicRoutes.length > 0) {\n\t\tif (privateRoutes.length > 0) {\n\t\t\tconsole.warn(\n\t\t\t\t'Both publicRoutes and privateRoutes are defined. Ignoring privateRoutes.'\n\t\t\t);\n\t\t}\n\t\treturn isDefaultPublicRoute || publicRoutes.includes(req.nextUrl.pathname);\n\t}\n\n\tif (privateRoutes.length > 0) {\n\t\treturn (\n\t\t\tisDefaultPublicRoute || !privateRoutes.includes(req.nextUrl.pathname)\n\t\t);\n\t}\n\n\t// If no routes are provided, all routes are private\n\treturn isDefaultPublicRoute;\n};\n\nconst addSessionToHeadersIfExists = (\n\theaders: Headers,\n\tsession: AuthenticationInfo | undefined\n): Headers => {\n\tif (session) {\n\t\tconst requestHeaders = new Headers(headers);\n\t\trequestHeaders.set(\n\t\t\tDESCOPE_SESSION_HEADER,\n\t\t\tBuffer.from(JSON.stringify(session)).toString('base64')\n\t\t);\n\t\treturn requestHeaders;\n\t}\n\treturn headers;\n};\n\n// returns a Middleware that checks if the user is authenticated\n// if the user is not authenticated, it redirects to the redirectUrl\n// if the user is authenticated, it adds the session to the headers\nconst createAuthMiddleware =\n\t(options: MiddlewareOptions = {}) =>\n\tasync (req: NextRequest) => {\n\t\tconsole.debug('Auth middleware starts');\n\n\t\tconst jwt = getSessionJwt(req);\n\n\t\t// check if the user is authenticated\n\t\tlet session: AuthenticationInfo | undefined;\n\t\ttry {\n\t\t\tsession = await getGlobalSdk({\n\t\t\t\tprojectId: options.projectId,\n\t\t\t\tbaseUrl: options.baseUrl\n\t\t\t}).validateJwt(jwt);\n\t\t} catch (err) {\n\t\t\tconsole.debug('Auth middleware, Failed to validate JWT', err);\n\t\t\tif (!isPublicRoute(req, options)) {\n\t\t\t\tconst redirectUrl = options.redirectUrl || DEFAULT_PUBLIC_ROUTES.signIn;\n\t\t\t\tconst url = req.nextUrl.clone();\n\t\t\t\t// Create a URL object for redirectUrl. 'http://example.com' is just a placeholder.\n\t\t\t\tconst parsedRedirectUrl = new URL(redirectUrl, 'http://example.com');\n\t\t\t\turl.pathname = parsedRedirectUrl.pathname;\n\n\t\t\t\tconst searchParams = mergeSearchParams(\n\t\t\t\t\turl.search,\n\t\t\t\t\tparsedRedirectUrl.search\n\t\t\t\t);\n\t\t\t\tif (searchParams) {\n\t\t\t\t\turl.search = searchParams;\n\t\t\t\t}\n\t\t\t\tconsole.debug(`Auth middleware, Redirecting to ${redirectUrl}`);\n\t\t\t\treturn NextResponse.redirect(url);\n\t\t\t}\n\t\t}\n\n\t\tconsole.debug('Auth middleware finishes');\n\t\t// add the session to the request, if it exists\n\t\tconst headers = addSessionToHeadersIfExists(req.headers, session);\n\t\treturn NextResponse.next({\n\t\t\trequest: {\n\t\t\t\theaders\n\t\t\t}\n\t\t});\n\t};\n\nexport default createAuthMiddleware;\n"],"names":[],"mappings":";;;;;;AAAA;AAiCA,MAAM,aAAa,GAAG,CAAC,GAAgB,KAAwB;AAC9D,IAAA,IAAI,GAAG,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,eAAe,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,IAAI,GAAG,EAAE;AACR,QAAA,OAAO,GAAG,CAAC;KACX;AAED,IAAA,GAAG,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,sBAAsB,CAAC,EAAE,KAAK,CAAC;IACjE,IAAI,GAAG,EAAE;AACR,QAAA,OAAO,GAAG,CAAC;KACX;AACD,IAAA,OAAO,SAAS,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,GAAgB,EAAE,OAA0B,KAAI;;AAEtE,IAAA,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC;AAChD,IAAA,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;AAElD,IAAA,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,QAAQ,CACzE,GAAG,CAAC,OAAO,CAAC,QAAQ,CACpB,CAAC;AAEF,IAAA,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;AAC5B,QAAA,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;AAC7B,YAAA,OAAO,CAAC,IAAI,CACX,0EAA0E,CAC1E,CAAC;SACF;AACD,QAAA,OAAO,oBAAoB,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;KAC3E;AAED,IAAA,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;AAC7B,QAAA,QACC,oBAAoB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,EACpE;KACF;;AAGD,IAAA,OAAO,oBAAoB,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAG,CACnC,OAAgB,EAChB,OAAuC,KAC3B;IACZ,IAAI,OAAO,EAAE;AACZ,QAAA,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5C,cAAc,CAAC,GAAG,CACjB,sBAAsB,EACtB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACvD,CAAC;AACF,QAAA,OAAO,cAAc,CAAC;KACtB;AACD,IAAA,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAEF;AACA;AACA;AACA,MAAM,oBAAoB,GACzB,CAAC,OAAA,GAA6B,EAAE,KAChC,OAAO,GAAgB,KAAI;AAC1B,IAAA,OAAO,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAExC,IAAA,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;;AAG/B,IAAA,IAAI,OAAuC,CAAC;AAC5C,IAAA,IAAI;QACH,OAAO,GAAG,MAAM,YAAY,CAAC;YAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;AACxB,SAAA,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;KACpB;IAAC,OAAO,GAAG,EAAE;AACb,QAAA,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,GAAG,CAAC,CAAC;QAC9D,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE;YACjC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,qBAAqB,CAAC,MAAM,CAAC;YACxE,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;;YAEhC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;AACrE,YAAA,GAAG,CAAC,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC;AAE1C,YAAA,MAAM,YAAY,GAAG,iBAAiB,CACrC,GAAG,CAAC,MAAM,EACV,iBAAiB,CAAC,MAAM,CACxB,CAAC;YACF,IAAI,YAAY,EAAE;AACjB,gBAAA,GAAG,CAAC,MAAM,GAAG,YAAY,CAAC;aAC1B;AACD,YAAA,OAAO,CAAC,KAAK,CAAC,mCAAmC,WAAW,CAAA,CAAE,CAAC,CAAC;AAChE,YAAA,OAAO,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;SAClC;KACD;AAED,IAAA,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;;IAE1C,MAAM,OAAO,GAAG,2BAA2B,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClE,OAAO,YAAY,CAAC,IAAI,CAAC;AACxB,QAAA,OAAO,EAAE;YACR,OAAO;AACP,SAAA;AACD,KAAA,CAAC,CAAC;AACJ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../src/server/constants.ts"],"sourcesContent":["// Replaced in build time\ndeclare const BUILD_VERSION: string;\n\nexport const DESCOPE_SESSION_HEADER = 'x-descope-session';\n\nexport const baseHeaders = {\n\t'x-descope-sdk-name': 'nextjs',\n\t'x-descope-sdk-version': BUILD_VERSION\n};\n\nexport const DEFAULT_PUBLIC_ROUTES = {\n\tsignIn: process.env.SIGN_IN_ROUTE || '/sign-in',\n\tsignUp: process.env.SIGN_UP_ROUTE || '/sign-up'\n};\n"],"names":[],"mappings":"AAGO,MAAM,sBAAsB,GAAG,oBAAoB;AAE7C,MAAA,WAAW,GAAG;AAC1B,IAAA,oBAAoB,EAAE,QAAQ;AAC9B,IAAA,uBAAuB,EAAE,QAAa;EACrC;AAEW,MAAA,qBAAqB,GAAG;AACpC,IAAA,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,UAAU;AAC/C,IAAA,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,UAAU;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useDescope, useSession, useUser, getSessionToken, getRefreshToken, isSessionTokenExpired, isRefreshTokenExpired, getJwtPermissions, getJwtRoles, refresh } from '@descope/react-sdk';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './shared';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
-
type MiddlewareOptions = {
|
|
3
|
-
projectId?: string;
|
|
4
|
-
baseUrl?: string;
|
|
5
|
-
redirectUrl?: string;
|
|
6
|
-
publicRoutes?: string[];
|
|
7
|
-
privateRoutes?: string[];
|
|
8
|
-
};
|
|
9
|
-
declare const createAuthMiddleware: (options?: MiddlewareOptions) => (req: NextRequest) => Promise<NextResponse<unknown>>;
|
|
10
|
-
export default createAuthMiddleware;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const DESCOPE_SESSION_HEADER = "x-descope-session";
|
|
2
|
-
export declare const baseHeaders: {
|
|
3
|
-
'x-descope-sdk-name': string;
|
|
4
|
-
'x-descope-sdk-version': string;
|
|
5
|
-
};
|
|
6
|
-
export declare const DEFAULT_PUBLIC_ROUTES: {
|
|
7
|
-
signIn: string;
|
|
8
|
-
signUp: string;
|
|
9
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import descopeSdk from '@descope/node-sdk';
|
|
2
|
-
type Sdk = ReturnType<typeof descopeSdk>;
|
|
3
|
-
type CreateSdkParams = Omit<Parameters<typeof descopeSdk>[0], 'projectId'> & {
|
|
4
|
-
projectId?: string | undefined;
|
|
5
|
-
};
|
|
6
|
-
export declare const createSdk: (config?: CreateSdkParams) => Sdk;
|
|
7
|
-
export declare const getGlobalSdk: (config?: Pick<CreateSdkParams, 'projectId' | 'baseUrl'>) => Sdk;
|
|
8
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const mergeSearchParams: (...searchParams: string[]) => string;
|