@descope/nextjs-sdk 0.0.0-alpha.1
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/LICENSE +21 -0
- package/README.md +493 -0
- package/dist/cjs/client/index.js +52 -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 +97 -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/logger.js +28 -0
- package/dist/cjs/server/logger.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 +62 -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/client/dts/src/client/index.d.ts +12 -0
- package/dist/client/dts/src/index.d.ts +1 -0
- package/dist/client/dts/src/server/authMiddleware.d.ts +12 -0
- package/dist/client/dts/src/server/constants.d.ts +9 -0
- package/dist/client/dts/src/server/index.d.ts +3 -0
- package/dist/client/dts/src/server/sdk.d.ts +10 -0
- package/dist/client/dts/src/server/session.d.ts +6 -0
- package/dist/client/dts/src/server/utils.d.ts +1 -0
- package/dist/client/dts/src/shared/AuthProvider.d.ts +3 -0
- package/dist/client/dts/src/shared/DescopeFlows.d.ts +130 -0
- package/dist/client/dts/src/shared/DescopeWidgets.d.ts +72 -0
- package/dist/client/dts/src/shared/constants.d.ts +4 -0
- package/dist/client/dts/src/shared/index.d.ts +3 -0
- package/dist/client/dts/src/types.d.ts +1 -0
- package/dist/client/index.d.ts +12 -0
- package/dist/client/index.js +14 -0
- package/dist/client/index.js.map +1 -0
- package/dist/dts/src/client/index.d.ts +12 -0
- package/dist/dts/src/index.d.ts +1 -0
- package/dist/dts/src/server/authMiddleware.d.ts +12 -0
- package/dist/dts/src/server/constants.d.ts +9 -0
- package/dist/dts/src/server/index.d.ts +3 -0
- package/dist/dts/src/server/sdk.d.ts +10 -0
- package/dist/dts/src/server/session.d.ts +6 -0
- package/dist/dts/src/server/utils.d.ts +1 -0
- package/dist/dts/src/shared/AuthProvider.d.ts +3 -0
- package/dist/dts/src/shared/DescopeFlows.d.ts +130 -0
- package/dist/dts/src/shared/DescopeWidgets.d.ts +72 -0
- package/dist/dts/src/shared/constants.d.ts +4 -0
- package/dist/dts/src/shared/index.d.ts +3 -0
- package/dist/dts/src/types.d.ts +1 -0
- package/dist/esm/client/index.js +3 -0
- package/dist/esm/client/index.js.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/server/authMiddleware.js +95 -0
- package/dist/esm/server/authMiddleware.js.map +1 -0
- package/dist/esm/server/constants.js +12 -0
- package/dist/esm/server/constants.js.map +1 -0
- package/dist/esm/server/index.js +4 -0
- package/dist/esm/server/index.js.map +1 -0
- package/dist/esm/server/logger.js +25 -0
- package/dist/esm/server/logger.js.map +1 -0
- package/dist/esm/server/sdk.js +26 -0
- package/dist/esm/server/sdk.js.map +1 -0
- package/dist/esm/server/session.js +59 -0
- package/dist/esm/server/session.js.map +1 -0
- package/dist/esm/server/utils.js +22 -0
- package/dist/esm/server/utils.js.map +1 -0
- package/dist/esm/shared/AuthProvider.js +13 -0
- package/dist/esm/shared/AuthProvider.js.map +1 -0
- package/dist/esm/shared/DescopeFlows.js +45 -0
- package/dist/esm/shared/DescopeFlows.js.map +1 -0
- package/dist/esm/shared/DescopeWidgets.js +20 -0
- package/dist/esm/shared/DescopeWidgets.js.map +1 -0
- package/dist/esm/shared/constants.js +8 -0
- package/dist/esm/shared/constants.js.map +1 -0
- package/dist/index.d.ts +212 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/server/authMiddleware.js +98 -0
- package/dist/server/authMiddleware.js.map +1 -0
- package/dist/server/constants.js +12 -0
- package/dist/server/constants.js.map +1 -0
- package/dist/server/dts/src/client/index.d.ts +12 -0
- package/dist/server/dts/src/index.d.ts +1 -0
- package/dist/server/dts/src/server/authMiddleware.d.ts +12 -0
- package/dist/server/dts/src/server/constants.d.ts +9 -0
- package/dist/server/dts/src/server/index.d.ts +3 -0
- package/dist/server/dts/src/server/sdk.d.ts +10 -0
- package/dist/server/dts/src/server/session.d.ts +6 -0
- package/dist/server/dts/src/server/utils.d.ts +1 -0
- package/dist/server/dts/src/shared/AuthProvider.d.ts +3 -0
- package/dist/server/dts/src/shared/DescopeFlows.d.ts +130 -0
- package/dist/server/dts/src/shared/DescopeWidgets.d.ts +72 -0
- package/dist/server/dts/src/shared/constants.d.ts +4 -0
- package/dist/server/dts/src/shared/index.d.ts +3 -0
- package/dist/server/dts/src/types.d.ts +1 -0
- package/dist/server/index.d.ts +32 -0
- package/dist/server/index.js +4 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/sdk.js +27 -0
- package/dist/server/sdk.js.map +1 -0
- package/dist/server/session.js +32 -0
- package/dist/server/session.js.map +1 -0
- package/dist/server/utils.js +22 -0
- package/dist/server/utils.js.map +1 -0
- package/dist/shared/AuthProvider.js +19 -0
- package/dist/shared/AuthProvider.js.map +1 -0
- package/dist/shared/DescopeFlows.js +53 -0
- package/dist/shared/DescopeFlows.js.map +1 -0
- package/dist/shared/DescopeWidgets.js +35 -0
- package/dist/shared/DescopeWidgets.js.map +1 -0
- package/dist/shared/constants.js +8 -0
- package/dist/shared/constants.js.map +1 -0
- package/dist/types/client/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/server/authMiddleware.d.ts +12 -0
- package/dist/types/server/constants.d.ts +9 -0
- package/dist/types/server/index.d.ts +3 -0
- package/dist/types/server/logger.d.ts +25 -0
- package/dist/types/server/sdk.d.ts +9 -0
- package/dist/types/server/session.d.ts +10 -0
- package/dist/types/server/utils.d.ts +1 -0
- package/dist/types/shared/AuthProvider.d.ts +3 -0
- package/dist/types/shared/DescopeFlows.d.ts +141 -0
- package/dist/types/shared/DescopeWidgets.d.ts +54 -0
- package/dist/types/shared/constants.d.ts +4 -0
- package/dist/types/shared/index.d.ts +3 -0
- package/dist/types/types.d.ts +1 -0
- package/package.json +152 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type * as _1 from '@descope/react-sdk/node_modules/@types/react';
|
|
3
|
+
import type * as _2 from '@descope/react-sdk/node_modules/@descope/web-component/dist';
|
|
4
|
+
type AdditionalProps = {
|
|
5
|
+
redirectAfterSuccess?: string;
|
|
6
|
+
redirectAfterError?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const Descope: _1.ComponentType<
|
|
9
|
+
{
|
|
10
|
+
flowId: string;
|
|
11
|
+
onSuccess?: (
|
|
12
|
+
e: CustomEvent<import('@descope/core-js-sdk').JWTResponse>
|
|
13
|
+
) => void;
|
|
14
|
+
onError?: (
|
|
15
|
+
e: CustomEvent<{
|
|
16
|
+
errorCode: string;
|
|
17
|
+
errorDescription: string;
|
|
18
|
+
errorMessage?: string;
|
|
19
|
+
retryAfter?: string;
|
|
20
|
+
}>
|
|
21
|
+
) => void;
|
|
22
|
+
onReady?: (e: CustomEvent<{}>) => void;
|
|
23
|
+
logger?: Partial<any>;
|
|
24
|
+
tenant?: string;
|
|
25
|
+
theme?: _2.ThemeOptions;
|
|
26
|
+
locale?: string;
|
|
27
|
+
autoFocus?: _2.AutoFocusOptions;
|
|
28
|
+
validateOnBlur?: boolean;
|
|
29
|
+
restartOnError?: boolean;
|
|
30
|
+
debug?: boolean;
|
|
31
|
+
telemetryKey?: string;
|
|
32
|
+
redirectUrl?: string;
|
|
33
|
+
errorTransformer?: (error: { text: string; type: string }) => string;
|
|
34
|
+
form?: Record<string, any>;
|
|
35
|
+
client?: Record<string, any>;
|
|
36
|
+
styleId?: string;
|
|
37
|
+
} & _1.RefAttributes<HTMLElement> &
|
|
38
|
+
AdditionalProps
|
|
39
|
+
>;
|
|
40
|
+
export declare const SignInFlow: _1.ComponentType<
|
|
41
|
+
{
|
|
42
|
+
form?: Record<string, any>;
|
|
43
|
+
onSuccess?: (
|
|
44
|
+
e: CustomEvent<import('@descope/core-js-sdk').JWTResponse>
|
|
45
|
+
) => void;
|
|
46
|
+
onError?: (
|
|
47
|
+
e: CustomEvent<{
|
|
48
|
+
errorCode: string;
|
|
49
|
+
errorDescription: string;
|
|
50
|
+
errorMessage?: string;
|
|
51
|
+
retryAfter?: string;
|
|
52
|
+
}>
|
|
53
|
+
) => void;
|
|
54
|
+
onReady?: (e: CustomEvent<{}>) => void;
|
|
55
|
+
logger?: Partial<any>;
|
|
56
|
+
tenant?: string;
|
|
57
|
+
theme?: _2.ThemeOptions;
|
|
58
|
+
locale?: string;
|
|
59
|
+
autoFocus?: _2.AutoFocusOptions;
|
|
60
|
+
validateOnBlur?: boolean;
|
|
61
|
+
restartOnError?: boolean;
|
|
62
|
+
debug?: boolean;
|
|
63
|
+
telemetryKey?: string;
|
|
64
|
+
redirectUrl?: string;
|
|
65
|
+
errorTransformer?: (error: { text: string; type: string }) => string;
|
|
66
|
+
client?: Record<string, any>;
|
|
67
|
+
styleId?: string;
|
|
68
|
+
} & AdditionalProps
|
|
69
|
+
>;
|
|
70
|
+
export declare const SignUpFlow: _1.ComponentType<
|
|
71
|
+
{
|
|
72
|
+
form?: Record<string, any>;
|
|
73
|
+
onSuccess?: (
|
|
74
|
+
e: CustomEvent<import('@descope/core-js-sdk').JWTResponse>
|
|
75
|
+
) => void;
|
|
76
|
+
onError?: (
|
|
77
|
+
e: CustomEvent<{
|
|
78
|
+
errorCode: string;
|
|
79
|
+
errorDescription: string;
|
|
80
|
+
errorMessage?: string;
|
|
81
|
+
retryAfter?: string;
|
|
82
|
+
}>
|
|
83
|
+
) => void;
|
|
84
|
+
onReady?: (e: CustomEvent<{}>) => void;
|
|
85
|
+
logger?: Partial<any>;
|
|
86
|
+
tenant?: string;
|
|
87
|
+
theme?: _2.ThemeOptions;
|
|
88
|
+
locale?: string;
|
|
89
|
+
autoFocus?: _2.AutoFocusOptions;
|
|
90
|
+
validateOnBlur?: boolean;
|
|
91
|
+
restartOnError?: boolean;
|
|
92
|
+
debug?: boolean;
|
|
93
|
+
telemetryKey?: string;
|
|
94
|
+
redirectUrl?: string;
|
|
95
|
+
errorTransformer?: (error: { text: string; type: string }) => string;
|
|
96
|
+
client?: Record<string, any>;
|
|
97
|
+
styleId?: string;
|
|
98
|
+
} & AdditionalProps
|
|
99
|
+
>;
|
|
100
|
+
export declare const SignUpOrInFlow: _1.ComponentType<
|
|
101
|
+
{
|
|
102
|
+
form?: Record<string, any>;
|
|
103
|
+
onSuccess?: (
|
|
104
|
+
e: CustomEvent<import('@descope/core-js-sdk').JWTResponse>
|
|
105
|
+
) => void;
|
|
106
|
+
onError?: (
|
|
107
|
+
e: CustomEvent<{
|
|
108
|
+
errorCode: string;
|
|
109
|
+
errorDescription: string;
|
|
110
|
+
errorMessage?: string;
|
|
111
|
+
retryAfter?: string;
|
|
112
|
+
}>
|
|
113
|
+
) => void;
|
|
114
|
+
onReady?: (e: CustomEvent<{}>) => void;
|
|
115
|
+
logger?: Partial<any>;
|
|
116
|
+
tenant?: string;
|
|
117
|
+
theme?: _2.ThemeOptions;
|
|
118
|
+
locale?: string;
|
|
119
|
+
autoFocus?: _2.AutoFocusOptions;
|
|
120
|
+
validateOnBlur?: boolean;
|
|
121
|
+
restartOnError?: boolean;
|
|
122
|
+
debug?: boolean;
|
|
123
|
+
telemetryKey?: string;
|
|
124
|
+
redirectUrl?: string;
|
|
125
|
+
errorTransformer?: (error: { text: string; type: string }) => string;
|
|
126
|
+
client?: Record<string, any>;
|
|
127
|
+
styleId?: string;
|
|
128
|
+
} & AdditionalProps
|
|
129
|
+
>;
|
|
130
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type * as _1 from '@descope/react-sdk/node_modules/@types/react';
|
|
3
|
+
export declare const UserManagement: _1.ComponentType<
|
|
4
|
+
{
|
|
5
|
+
logger?: Partial<any>;
|
|
6
|
+
tenant: string;
|
|
7
|
+
widgetId: string;
|
|
8
|
+
theme?: import('@descope/web-component').ThemeOptions;
|
|
9
|
+
debug?: boolean;
|
|
10
|
+
styleId?: string;
|
|
11
|
+
} & _1.RefAttributes<HTMLElement>
|
|
12
|
+
>;
|
|
13
|
+
export declare const RoleManagement: _1.ComponentType<
|
|
14
|
+
{
|
|
15
|
+
logger?: Partial<any>;
|
|
16
|
+
tenant: string;
|
|
17
|
+
widgetId: string;
|
|
18
|
+
theme?: import('@descope/web-component').ThemeOptions;
|
|
19
|
+
debug?: boolean;
|
|
20
|
+
styleId?: string;
|
|
21
|
+
} & _1.RefAttributes<HTMLElement>
|
|
22
|
+
>;
|
|
23
|
+
export declare const AccessKeyManagement: _1.ComponentType<
|
|
24
|
+
{
|
|
25
|
+
logger?: Partial<any>;
|
|
26
|
+
tenant: string;
|
|
27
|
+
widgetId: string;
|
|
28
|
+
theme?: import('@descope/web-component').ThemeOptions;
|
|
29
|
+
debug?: boolean;
|
|
30
|
+
styleId?: string;
|
|
31
|
+
} & _1.RefAttributes<HTMLElement>
|
|
32
|
+
>;
|
|
33
|
+
export declare const AuditManagement: _1.ComponentType<
|
|
34
|
+
{
|
|
35
|
+
logger?: Partial<any>;
|
|
36
|
+
tenant: string;
|
|
37
|
+
widgetId: string;
|
|
38
|
+
theme?: import('@descope/web-component').ThemeOptions;
|
|
39
|
+
debug?: boolean;
|
|
40
|
+
styleId?: string;
|
|
41
|
+
} & _1.RefAttributes<HTMLElement>
|
|
42
|
+
>;
|
|
43
|
+
export declare const UserProfile: _1.ComponentType<
|
|
44
|
+
Omit<
|
|
45
|
+
{
|
|
46
|
+
logger?: Partial<any>;
|
|
47
|
+
tenant: string;
|
|
48
|
+
widgetId: string;
|
|
49
|
+
theme?: import('@descope/web-component').ThemeOptions;
|
|
50
|
+
debug?: boolean;
|
|
51
|
+
styleId?: string;
|
|
52
|
+
},
|
|
53
|
+
'tenant'
|
|
54
|
+
> & {
|
|
55
|
+
onLogout?: (e: CustomEvent<any>) => void;
|
|
56
|
+
} & _1.RefAttributes<HTMLElement>
|
|
57
|
+
>;
|
|
58
|
+
export declare const ApplicationsPortal: _1.ComponentType<
|
|
59
|
+
Omit<
|
|
60
|
+
{
|
|
61
|
+
logger?: Partial<any>;
|
|
62
|
+
tenant: string;
|
|
63
|
+
widgetId: string;
|
|
64
|
+
theme?: import('@descope/web-component').ThemeOptions;
|
|
65
|
+
debug?: boolean;
|
|
66
|
+
styleId?: string;
|
|
67
|
+
},
|
|
68
|
+
'tenant'
|
|
69
|
+
> & {
|
|
70
|
+
onLogout?: (e: CustomEvent<any>) => void;
|
|
71
|
+
} & _1.RefAttributes<HTMLElement>
|
|
72
|
+
>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TempType = {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import descopeSdk, { AuthenticationInfo } from '@descope/node-sdk';
|
|
3
|
+
import { NextApiRequest } from 'next';
|
|
4
|
+
|
|
5
|
+
type MiddlewareOptions = {
|
|
6
|
+
projectId?: string;
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
redirectUrl?: string;
|
|
9
|
+
publicRoutes?: string[];
|
|
10
|
+
privateRoutes?: string[];
|
|
11
|
+
};
|
|
12
|
+
declare const createAuthMiddleware: (
|
|
13
|
+
options?: MiddlewareOptions
|
|
14
|
+
) => (req: NextRequest) => Promise<NextResponse<unknown>>;
|
|
15
|
+
|
|
16
|
+
declare const session: () => AuthenticationInfo | undefined;
|
|
17
|
+
declare const getSession: (
|
|
18
|
+
req: NextApiRequest
|
|
19
|
+
) => AuthenticationInfo | undefined;
|
|
20
|
+
|
|
21
|
+
type Sdk = ReturnType<typeof descopeSdk>;
|
|
22
|
+
type CreateSdkParams = Omit<Parameters<typeof descopeSdk>[0], 'projectId'> & {
|
|
23
|
+
projectId?: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
declare const createSdk: (config?: CreateSdkParams) => Sdk;
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
createAuthMiddleware as authMiddleware,
|
|
29
|
+
createSdk,
|
|
30
|
+
getSession,
|
|
31
|
+
session
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import descopeSdk from '@descope/node-sdk';
|
|
2
|
+
import { baseHeaders } from './constants.js';
|
|
3
|
+
|
|
4
|
+
let globalSdk;
|
|
5
|
+
const createSdk = (config) =>
|
|
6
|
+
descopeSdk({
|
|
7
|
+
...config,
|
|
8
|
+
projectId: config?.projectId || process.env.DESCOPE_PROJECT_ID,
|
|
9
|
+
managementKey: config?.managementKey || process.env.DESCOPE_MANAGEMENT_KEY,
|
|
10
|
+
baseUrl: config?.baseUrl || process.env.DESCOPE_BASE_URL,
|
|
11
|
+
baseHeaders: {
|
|
12
|
+
...config?.baseHeaders,
|
|
13
|
+
...baseHeaders
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const getGlobalSdk = (config) => {
|
|
17
|
+
if (!globalSdk) {
|
|
18
|
+
if (!config?.projectId && !process.env.DESCOPE_PROJECT_ID) {
|
|
19
|
+
throw new Error('Descope project ID is required to create the SDK');
|
|
20
|
+
}
|
|
21
|
+
globalSdk = createSdk(config);
|
|
22
|
+
}
|
|
23
|
+
return globalSdk;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { createSdk, getGlobalSdk };
|
|
27
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../src/server/sdk.ts"],"sourcesContent":["import descopeSdk from '@descope/node-sdk';\nimport { baseHeaders } from './constants';\n\ntype Sdk = ReturnType<typeof descopeSdk>;\ntype CreateSdkParams = Omit<Parameters<typeof descopeSdk>[0], 'projectId'> & {\n\tprojectId?: string | undefined;\n};\n\nlet globalSdk: Sdk;\n\nexport const createSdk = (config?: CreateSdkParams): Sdk =>\n\tdescopeSdk({\n\t\t...config,\n\t\tprojectId: config?.projectId || process.env.DESCOPE_PROJECT_ID,\n\t\tmanagementKey: config?.managementKey || process.env.DESCOPE_MANAGEMENT_KEY,\n\t\tbaseUrl: config?.baseUrl || process.env.DESCOPE_BASE_URL,\n\t\tbaseHeaders: {\n\t\t\t...config?.baseHeaders,\n\t\t\t...baseHeaders\n\t\t}\n\t});\n\nexport const getGlobalSdk = (\n\tconfig?: Pick<CreateSdkParams, 'projectId' | 'baseUrl'>\n): Sdk => {\n\tif (!globalSdk) {\n\t\tif (!config?.projectId && !process.env.DESCOPE_PROJECT_ID) {\n\t\t\tthrow new Error('Descope project ID is required to create the SDK');\n\t\t}\n\t\tglobalSdk = createSdk(config);\n\t}\n\n\treturn globalSdk;\n};\n"],"names":[],"mappings":";;;AAQA,IAAI,SAAc;AAEL,MAAA,SAAS,GAAG,CAAC,MAAwB,KACjD,UAAU,CAAC;AACV,IAAA,GAAG,MAAM;IACT,SAAS,EAAE,MAAM,EAAE,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB;IAC9D,aAAa,EAAE,MAAM,EAAE,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAsB;IAC1E,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB;AACxD,IAAA,WAAW,EAAE;QACZ,GAAG,MAAM,EAAE,WAAW;AACtB,QAAA,GAAG;AACH;AACD,CAAA;AAEW,MAAA,YAAY,GAAG,CAC3B,MAAuD,KAC/C;IACR,IAAI,CAAC,SAAS,EAAE;AACf,QAAA,IAAI,CAAC,MAAM,EAAE,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;AAC1D,YAAA,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC;;AAEpE,QAAA,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC;;AAG9B,IAAA,OAAO,SAAS;AACjB;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { headers } from 'next/headers.js';
|
|
2
|
+
import { DESCOPE_SESSION_HEADER } from './constants.js';
|
|
3
|
+
|
|
4
|
+
const extractSession = (descopeSession) => {
|
|
5
|
+
if (!descopeSession) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
const authInfo = JSON.parse(
|
|
10
|
+
Buffer.from(descopeSession, 'base64').toString()
|
|
11
|
+
);
|
|
12
|
+
return authInfo;
|
|
13
|
+
} catch (err) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
// returns the session token if it exists in the headers
|
|
18
|
+
// This function require middleware
|
|
19
|
+
const session = () => {
|
|
20
|
+
// from Next.js 15, headers() returns a Promise
|
|
21
|
+
// It can still be used synchronously to facilitate migration
|
|
22
|
+
const reqHeaders = headers();
|
|
23
|
+
const sessionHeader = reqHeaders.get(DESCOPE_SESSION_HEADER);
|
|
24
|
+
return extractSession(sessionHeader);
|
|
25
|
+
};
|
|
26
|
+
// returns the session token if it exists in the request headers
|
|
27
|
+
// This function require middleware
|
|
28
|
+
const getSession = (req) =>
|
|
29
|
+
extractSession(req.headers[DESCOPE_SESSION_HEADER.toLowerCase()]);
|
|
30
|
+
|
|
31
|
+
export { getSession, session };
|
|
32
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sources":["../../src/server/session.ts"],"sourcesContent":["import { AuthenticationInfo } from '@descope/node-sdk';\nimport { NextApiRequest } from 'next';\nimport { headers } from 'next/headers';\nimport { DESCOPE_SESSION_HEADER } from './constants';\n\n// This type is declared to allow simpler migration to Next.15\n// It will be removed in the future\ntype HeaderTypes = Awaited<ReturnType<typeof headers>>;\n\nconst extractSession = (\n\tdescopeSession?: string\n): AuthenticationInfo | undefined => {\n\tif (!descopeSession) {\n\t\treturn undefined;\n\t}\n\ttry {\n\t\tconst authInfo = JSON.parse(\n\t\t\tBuffer.from(descopeSession, 'base64').toString()\n\t\t) as AuthenticationInfo;\n\t\treturn authInfo;\n\t} catch (err) {\n\t\treturn undefined;\n\t}\n};\n// returns the session token if it exists in the headers\n// This function require middleware\nexport const session = (): AuthenticationInfo | undefined => {\n\t// from Next.js 15, headers() returns a Promise\n\t// It can still be used synchronously to facilitate migration\n\tconst reqHeaders = headers() as never as HeaderTypes;\n\tconst sessionHeader = reqHeaders.get(DESCOPE_SESSION_HEADER);\n\treturn extractSession(sessionHeader);\n};\n\n// returns the session token if it exists in the request headers\n// This function require middleware\nexport const getSession = (\n\treq: NextApiRequest\n): AuthenticationInfo | undefined =>\n\textractSession(req.headers[DESCOPE_SESSION_HEADER.toLowerCase()] as string);\n"],"names":[],"mappings":";;;AASA,MAAM,cAAc,GAAG,CACtB,cAAuB,KACY;IACnC,IAAI,CAAC,cAAc,EAAE;AACpB,QAAA,OAAO,SAAS;;AAEjB,IAAA,IAAI;AACH,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAC1B,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAC1B;AACvB,QAAA,OAAO,QAAQ;;IACd,OAAO,GAAG,EAAE;AACb,QAAA,OAAO,SAAS;;AAElB,CAAC;AACD;AACA;AACO,MAAM,OAAO,GAAG,MAAqC;;;AAG3D,IAAA,MAAM,UAAU,GAAG,OAAO,EAA0B;IACpD,MAAM,aAAa,GAAG,UAAU,CAAC,GAAG,CAAC,sBAAsB,CAAC;AAC5D,IAAA,OAAO,cAAc,CAAC,aAAa,CAAC;AACrC;AAEA;AACA;MACa,UAAU,GAAG,CACzB,GAAmB,KAEnB,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC,WAAW,EAAE,CAAW;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* eslint-disable import/prefer-default-export */
|
|
2
|
+
/*
|
|
3
|
+
Merges multiple search params into one.
|
|
4
|
+
It will override according to the order of the search params
|
|
5
|
+
Examples:
|
|
6
|
+
- mergeSearchParams('?a=1', '?b=2') => 'a=1&b=2'
|
|
7
|
+
- mergeSearchParams('?a=1', '?a=2') => 'a=2'
|
|
8
|
+
- mergeSearchParams('?a=1', '?a=2', '?b=3') => 'a=2&b=3'
|
|
9
|
+
*/
|
|
10
|
+
const mergeSearchParams = (...searchParams) => {
|
|
11
|
+
const res = searchParams.reduce((acc, curr) => {
|
|
12
|
+
const currParams = new URLSearchParams(curr);
|
|
13
|
+
currParams.forEach((value, key) => {
|
|
14
|
+
acc.set(key, value);
|
|
15
|
+
});
|
|
16
|
+
return acc;
|
|
17
|
+
}, new URLSearchParams());
|
|
18
|
+
return res.toString();
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { mergeSearchParams };
|
|
22
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/server/utils.ts"],"sourcesContent":["/* eslint-disable import/prefer-default-export */\n\n/*\nMerges multiple search params into one.\nIt will override according to the order of the search params\nExamples:\n - mergeSearchParams('?a=1', '?b=2') => 'a=1&b=2'\n - mergeSearchParams('?a=1', '?a=2') => 'a=2'\n - mergeSearchParams('?a=1', '?a=2', '?b=3') => 'a=2&b=3'\n*/\nexport const mergeSearchParams = (...searchParams: string[]): string => {\n\tconst res = searchParams.reduce((acc, curr) => {\n\t\tconst currParams = new URLSearchParams(curr);\n\t\tcurrParams.forEach((value, key) => {\n\t\t\tacc.set(key, value);\n\t\t});\n\t\treturn acc;\n\t}, new URLSearchParams());\n\n\treturn res.toString();\n};\n"],"names":[],"mappings":"AAAA;AAEA;;;;;;;AAOE;MACW,iBAAiB,GAAG,CAAC,GAAG,YAAsB,KAAY;IACtE,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,KAAI;AAC7C,QAAA,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC;QAC5C,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,KAAI;AACjC,YAAA,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;AACpB,SAAC,CAAC;AACF,QAAA,OAAO,GAAG;AACX,KAAC,EAAE,IAAI,eAAe,EAAE,CAAC;AAEzB,IAAA,OAAO,GAAG,CAAC,QAAQ,EAAE;AACtB;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
baseHeaders,
|
|
4
|
+
AuthProvider as AuthProvider$1
|
|
5
|
+
} from '@descope/react-sdk';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { baseHeaders as baseHeaders$1 } from './constants.js';
|
|
8
|
+
|
|
9
|
+
// Override baseHeaders
|
|
10
|
+
Object.assign(baseHeaders, baseHeaders$1);
|
|
11
|
+
const AuthProvider = ({ ...props }) =>
|
|
12
|
+
// by default we use sessionTokenViaCookie, so middleware will work out of the box
|
|
13
|
+
React.createElement(AuthProvider$1, {
|
|
14
|
+
sessionTokenViaCookie: true,
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export { AuthProvider as default };
|
|
19
|
+
//# sourceMappingURL=AuthProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthProvider.js","sources":["../../src/shared/AuthProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tAuthProvider as AuthProviderComp,\n\tbaseHeaders\n} from '@descope/react-sdk';\nimport React from 'react';\nimport { baseHeaders as nextBaseHeaders } from './constants';\n\n// Override baseHeaders\nObject.assign(baseHeaders, nextBaseHeaders);\n\nconst AuthProvider: typeof AuthProviderComp = ({ ...props }) => (\n\t// by default we use sessionTokenViaCookie, so middleware will work out of the box\n\t<AuthProviderComp sessionTokenViaCookie {...props} />\n);\n\nexport default AuthProvider;\n"],"names":[],"mappings":";;;;;AASA;AACA;AAEM;AACL;AACA;;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import dynamic from 'next/dynamic.js';
|
|
4
|
+
import { useRouter } from 'next/navigation.js';
|
|
5
|
+
import { baseHeaders } from './constants.js';
|
|
6
|
+
|
|
7
|
+
// Generalized function to dynamically import components from @descope/react-sdk
|
|
8
|
+
// Dynamic is needed because the Descope components has a side effect us
|
|
9
|
+
// and NextJS will load the page on the server even if it is a client side only page
|
|
10
|
+
const dynamicDescopeComponent = (componentName) =>
|
|
11
|
+
dynamic(
|
|
12
|
+
async () => {
|
|
13
|
+
const DescopeComponents = await import('@descope/react-sdk');
|
|
14
|
+
// Override baseHeaders
|
|
15
|
+
Object.assign(DescopeComponents.baseHeaders, baseHeaders);
|
|
16
|
+
const Component = DescopeComponents[componentName];
|
|
17
|
+
return ({
|
|
18
|
+
redirectAfterSuccess = '',
|
|
19
|
+
redirectAfterError = '',
|
|
20
|
+
...props
|
|
21
|
+
}) => {
|
|
22
|
+
const router = useRouter();
|
|
23
|
+
const modifiedProps = { ...props };
|
|
24
|
+
if (redirectAfterSuccess) {
|
|
25
|
+
modifiedProps.onSuccess = (...args) => {
|
|
26
|
+
if (props.onSuccess) {
|
|
27
|
+
props.onSuccess(...args);
|
|
28
|
+
}
|
|
29
|
+
router.push(redirectAfterSuccess);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
if (redirectAfterError) {
|
|
33
|
+
modifiedProps.onError = (...args) => {
|
|
34
|
+
if (props.onError) {
|
|
35
|
+
props.onError(...args);
|
|
36
|
+
}
|
|
37
|
+
router.push(redirectAfterError);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return React.createElement(Component, { ...modifiedProps });
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
ssr: false
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
const Descope = dynamicDescopeComponent('Descope');
|
|
48
|
+
const SignInFlow = dynamicDescopeComponent('SignInFlow');
|
|
49
|
+
const SignUpFlow = dynamicDescopeComponent('SignUpFlow');
|
|
50
|
+
const SignUpOrInFlow = dynamicDescopeComponent('SignUpOrInFlow');
|
|
51
|
+
|
|
52
|
+
export { Descope, SignInFlow, SignUpFlow, SignUpOrInFlow };
|
|
53
|
+
//# sourceMappingURL=DescopeFlows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DescopeFlows.js","sources":["../../src/shared/DescopeFlows.tsx"],"sourcesContent":["'use client';\n\n// workaround for TS issue https://github.com/microsoft/TypeScript/issues/42873\n// eslint-disable-next-line\nimport type * as _1 from '@descope/react-sdk/node_modules/@types/react';\n// eslint-disable-next-line\nimport type * as _2 from '@descope/react-sdk/node_modules/@descope/web-component/dist';\n\nimport React, { ComponentType, ComponentProps } from 'react';\nimport dynamic from 'next/dynamic';\nimport { useRouter } from 'next/navigation';\nimport {\n\tDescope as DescopeWC,\n\tSignInFlow as SignInFlowWC,\n\tSignUpFlow as SignUpFlowWC,\n\tSignUpOrInFlow as SignUpOrInFlowWC\n} from '@descope/react-sdk';\nimport { baseHeaders as nextBaseHeaders } from './constants';\n\ntype DescopeWCProps = ComponentProps<typeof DescopeWC>;\ntype SignInFlowProps = ComponentProps<typeof SignInFlowWC>;\ntype SignUpFlowProps = ComponentProps<typeof SignUpFlowWC>;\ntype SignUpOrInFlowProps = ComponentProps<typeof SignUpOrInFlowWC>;\n\ntype AdditionalProps = {\n\tredirectAfterSuccess?: string;\n\tredirectAfterError?: string;\n};\n\ntype DynamicComponentProps = {\n\tonSuccess?: (...args: any[]) => void;\n\tonError?: (...args: any[]) => void;\n};\n\n// Generalized function to dynamically import components from @descope/react-sdk\n// Dynamic is needed because the Descope components has a side effect us\n// and NextJS will load the page on the server even if it is a client side only page\nconst dynamicDescopeComponent = <\n\tT extends ComponentType<DynamicComponentProps>\n>(\n\tcomponentName: string\n) =>\n\tdynamic<ComponentProps<T> & AdditionalProps>(\n\t\tasync () => {\n\t\t\tconst DescopeComponents = await import('@descope/react-sdk');\n\n\t\t\t// Override baseHeaders\n\t\t\tObject.assign(DescopeComponents.baseHeaders, nextBaseHeaders);\n\n\t\t\tconst Component = DescopeComponents[componentName];\n\t\t\treturn ({\n\t\t\t\tredirectAfterSuccess = '',\n\t\t\t\tredirectAfterError = '',\n\t\t\t\t...props\n\t\t\t}: ComponentProps<T> & AdditionalProps) => {\n\t\t\t\tconst router = useRouter();\n\t\t\t\tconst modifiedProps = { ...props };\n\n\t\t\t\tif (redirectAfterSuccess) {\n\t\t\t\t\tmodifiedProps.onSuccess = (...args) => {\n\t\t\t\t\t\tif (props.onSuccess) {\n\t\t\t\t\t\t\tprops.onSuccess(...args);\n\t\t\t\t\t\t}\n\t\t\t\t\t\trouter.push(redirectAfterSuccess);\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (redirectAfterError) {\n\t\t\t\t\tmodifiedProps.onError = (...args) => {\n\t\t\t\t\t\tif (props.onError) {\n\t\t\t\t\t\t\tprops.onError(...args);\n\t\t\t\t\t\t}\n\t\t\t\t\t\trouter.push(redirectAfterError);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn <Component {...modifiedProps} />;\n\t\t\t};\n\t\t},\n\t\t{\n\t\t\tssr: false\n\t\t}\n\t);\n\nexport const Descope =\n\tdynamicDescopeComponent<React.ComponentType<DescopeWCProps>>('Descope');\nexport const SignInFlow =\n\tdynamicDescopeComponent<React.ComponentType<SignInFlowProps>>('SignInFlow');\nexport const SignUpFlow =\n\tdynamicDescopeComponent<React.ComponentType<SignUpFlowProps>>('SignUpFlow');\nexport const SignUpOrInFlow =\n\tdynamicDescopeComponent<React.ComponentType<SignUpOrInFlowProps>>(\n\t\t'SignUpOrInFlow'\n\t);\n"],"names":[],"mappings":";;;;;;AAkCA;AACA;AACA;AACA;AAOG;;;AAKA;AACA;AAKC;AACA;;AAGC;AACC;AACC;;AAED;AACD;;;AAIA;AACC;AACC;;AAED;AACD;;AAED;AACD;AACD;AAEC;AACA;;;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import dynamic from 'next/dynamic.js';
|
|
3
|
+
import {
|
|
4
|
+
UserManagement as UserManagement$1,
|
|
5
|
+
RoleManagement as RoleManagement$1,
|
|
6
|
+
AccessKeyManagement as AccessKeyManagement$1,
|
|
7
|
+
AuditManagement as AuditManagement$1,
|
|
8
|
+
UserProfile as UserProfile$1,
|
|
9
|
+
ApplicationsPortal as ApplicationsPortal$1
|
|
10
|
+
} from '@descope/react-sdk';
|
|
11
|
+
|
|
12
|
+
// a helper function to dynamically load the components
|
|
13
|
+
// This function prevents Next.js from trying to server-side render these components
|
|
14
|
+
// Update the helper function to use generics for preserving component prop types
|
|
15
|
+
const dynamicWidgetComponent = (Component) =>
|
|
16
|
+
dynamic(() => Promise.resolve(Component), {
|
|
17
|
+
ssr: false // Disable server-side rendering for this component
|
|
18
|
+
});
|
|
19
|
+
// Use the helper function to create dynamically loaded components
|
|
20
|
+
const UserManagement = dynamicWidgetComponent(UserManagement$1);
|
|
21
|
+
const RoleManagement = dynamicWidgetComponent(RoleManagement$1);
|
|
22
|
+
const AccessKeyManagement = dynamicWidgetComponent(AccessKeyManagement$1);
|
|
23
|
+
const AuditManagement = dynamicWidgetComponent(AuditManagement$1);
|
|
24
|
+
const UserProfile = dynamicWidgetComponent(UserProfile$1);
|
|
25
|
+
const ApplicationsPortal = dynamicWidgetComponent(ApplicationsPortal$1);
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
AccessKeyManagement,
|
|
29
|
+
ApplicationsPortal,
|
|
30
|
+
AuditManagement,
|
|
31
|
+
RoleManagement,
|
|
32
|
+
UserManagement,
|
|
33
|
+
UserProfile
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=DescopeWidgets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DescopeWidgets.js","sources":["../../src/shared/DescopeWidgets.tsx"],"sourcesContent":["'use client';\n\n// eslint-disable-next-line\nimport type * as _1 from '@descope/react-sdk/node_modules/@types/react';\n\nimport { ComponentType } from 'react';\nimport dynamic from 'next/dynamic';\nimport {\n\tUserManagement as UserManagementWC,\n\tRoleManagement as RoleManagementWC,\n\tAccessKeyManagement as AccessKeyManagementWC,\n\tAuditManagement as AuditManagementWC,\n\tUserProfile as UserProfileWc,\n\tApplicationsPortal as ApplicationsPortalWc\n} from '@descope/react-sdk';\n\n// a helper function to dynamically load the components\n// This function prevents Next.js from trying to server-side render these components\n// Update the helper function to use generics for preserving component prop types\nconst dynamicWidgetComponent = <P extends {}>(Component: ComponentType<P>) =>\n\tdynamic<P>(() => Promise.resolve(Component), {\n\t\tssr: false // Disable server-side rendering for this component\n\t});\n\n// Use the helper function to create dynamically loaded components\nexport const UserManagement = dynamicWidgetComponent(UserManagementWC);\nexport const RoleManagement = dynamicWidgetComponent(RoleManagementWC);\nexport const AccessKeyManagement = dynamicWidgetComponent(\n\tAccessKeyManagementWC\n);\nexport const AuditManagement = dynamicWidgetComponent(AuditManagementWC);\nexport const UserProfile = dynamicWidgetComponent(UserProfileWc);\nexport const ApplicationsPortal = dynamicWidgetComponent(ApplicationsPortalWc);\n"],"names":[],"mappings":";;;;AAgBA;AACA;AACA;AACA;;AAGE;AAEF;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../src/shared/constants.ts"],"sourcesContent":["// Replaced in build time\ndeclare const BUILD_VERSION: string;\n\n// eslint-disable-next-line import/prefer-default-export\nexport const baseHeaders = {\n\t'x-descope-sdk-name': 'nextjs',\n\t'x-descope-sdk-version': BUILD_VERSION\n};\n"],"names":[],"mappings":"AAGA;AACa,MAAA,WAAW,GAAG;AAC1B,IAAA,oBAAoB,EAAE,QAAQ;AAC9B,IAAA,uBAAuB,EAAE;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDescope, useSession, useUser, getSessionToken, getRefreshToken, isSessionTokenExpired, isRefreshTokenExpired, getJwtPermissions, getJwtRoles, getCurrentTenant, refresh } from '@descope/react-sdk';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './shared';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import { LogLevel } from '../types';
|
|
3
|
+
type MiddlewareOptions = {
|
|
4
|
+
projectId?: string;
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
redirectUrl?: string;
|
|
7
|
+
publicRoutes?: string[];
|
|
8
|
+
privateRoutes?: string[];
|
|
9
|
+
logLevel?: LogLevel;
|
|
10
|
+
};
|
|
11
|
+
declare const createAuthMiddleware: (options?: MiddlewareOptions) => (req: NextRequest) => Promise<NextResponse<unknown>>;
|
|
12
|
+
export default createAuthMiddleware;
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LogLevel } from '../types';
|
|
2
|
+
declare const logger: {
|
|
3
|
+
debug: {
|
|
4
|
+
(...data: any[]): void;
|
|
5
|
+
(message?: any, ...optionalParams: any[]): void;
|
|
6
|
+
};
|
|
7
|
+
info: {
|
|
8
|
+
(...data: any[]): void;
|
|
9
|
+
(message?: any, ...optionalParams: any[]): void;
|
|
10
|
+
};
|
|
11
|
+
log: {
|
|
12
|
+
(...data: any[]): void;
|
|
13
|
+
(message?: any, ...optionalParams: any[]): void;
|
|
14
|
+
};
|
|
15
|
+
warn: {
|
|
16
|
+
(...data: any[]): void;
|
|
17
|
+
(message?: any, ...optionalParams: any[]): void;
|
|
18
|
+
};
|
|
19
|
+
error: {
|
|
20
|
+
(...data: any[]): void;
|
|
21
|
+
(message?: any, ...optionalParams: any[]): void;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const setLogger: (level?: LogLevel) => void;
|
|
25
|
+
export { logger };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import descopeSdk from '@descope/node-sdk';
|
|
2
|
+
type Sdk = ReturnType<typeof descopeSdk>;
|
|
3
|
+
type CreateServerSdkParams = Omit<Parameters<typeof descopeSdk>[0], 'projectId'> & {
|
|
4
|
+
projectId?: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
type CreateSdkParams = Pick<CreateServerSdkParams, 'projectId' | 'baseUrl'>;
|
|
7
|
+
export declare const createSdk: (config?: CreateServerSdkParams) => Sdk;
|
|
8
|
+
export declare const getGlobalSdk: (config?: CreateSdkParams) => Sdk;
|
|
9
|
+
export type { CreateSdkParams };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AuthenticationInfo } from '@descope/node-sdk';
|
|
2
|
+
import { NextApiRequest } from 'next';
|
|
3
|
+
import { CreateSdkParams } from './sdk';
|
|
4
|
+
import { LogLevel } from '../types';
|
|
5
|
+
type SessionConfig = CreateSdkParams & {
|
|
6
|
+
logLevel?: LogLevel;
|
|
7
|
+
};
|
|
8
|
+
export declare const session: (config?: SessionConfig) => Promise<AuthenticationInfo | undefined>;
|
|
9
|
+
export declare const getSession: (req: NextApiRequest, config?: SessionConfig) => Promise<AuthenticationInfo | undefined>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mergeSearchParams: (...searchParams: string[]) => string;
|