@igxjs/node-components 1.0.4 → 1.0.5
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/index.d.ts +25 -14
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import 'express-session';
|
|
2
|
-
import '@types/express';
|
|
3
2
|
|
|
4
3
|
import { AxiosError } from 'axios';
|
|
5
4
|
import { RedisClientType } from '@redis/client';
|
|
6
|
-
import { Application, RequestHandler, Request, Response, NextFunction, Router } from '
|
|
5
|
+
import { Application, RequestHandler, Request, Response, NextFunction, Router } from 'express';
|
|
7
6
|
|
|
8
7
|
// Session Configuration
|
|
9
8
|
export interface SessionConfig {
|
|
@@ -95,7 +94,7 @@ export class SessionManager {
|
|
|
95
94
|
app: Application,
|
|
96
95
|
updateUser: (user: SessionUser | undefined) => any
|
|
97
96
|
): Promise<void>;
|
|
98
|
-
|
|
97
|
+
|
|
99
98
|
/**
|
|
100
99
|
* Resource protection middleware
|
|
101
100
|
* @param isDebugging Debugging flag (default: false)
|
|
@@ -103,26 +102,26 @@ export class SessionManager {
|
|
|
103
102
|
* @returns Returns express Request Handler
|
|
104
103
|
*/
|
|
105
104
|
authenticate(isDebugging?: boolean, redirectUrl?: string): RequestHandler;
|
|
106
|
-
|
|
105
|
+
|
|
107
106
|
/**
|
|
108
107
|
* SSO callback for successful login
|
|
109
108
|
* @param initUser Initialize user object function
|
|
110
109
|
* @returns Returns express Request Handler
|
|
111
110
|
*/
|
|
112
111
|
callback(initUser: (user: SessionUser) => SessionUser): RequestHandler;
|
|
113
|
-
|
|
112
|
+
|
|
114
113
|
/**
|
|
115
114
|
* Get Identity Providers
|
|
116
115
|
* @returns Returns express Request Handler
|
|
117
116
|
*/
|
|
118
117
|
identityProviders(): RequestHandler;
|
|
119
|
-
|
|
118
|
+
|
|
120
119
|
/**
|
|
121
120
|
* Application logout (NOT SSO)
|
|
122
121
|
* @returns Returns express Request Handler
|
|
123
122
|
*/
|
|
124
123
|
logout(): RequestHandler;
|
|
125
|
-
|
|
124
|
+
|
|
126
125
|
/**
|
|
127
126
|
* Refresh user session
|
|
128
127
|
* @param initUser Initialize user object function
|
|
@@ -134,9 +133,9 @@ export class SessionManager {
|
|
|
134
133
|
// Custom Error class
|
|
135
134
|
export class CustomError extends Error {
|
|
136
135
|
code: number;
|
|
137
|
-
object;
|
|
136
|
+
data: object;
|
|
138
137
|
error: object;
|
|
139
|
-
|
|
138
|
+
|
|
140
139
|
/**
|
|
141
140
|
* Construct a custom error
|
|
142
141
|
* @param code Error code
|
|
@@ -152,7 +151,7 @@ export class FlexRouter {
|
|
|
152
151
|
context: string;
|
|
153
152
|
router: Router;
|
|
154
153
|
handlers: RequestHandler[];
|
|
155
|
-
|
|
154
|
+
|
|
156
155
|
/**
|
|
157
156
|
* Constructor
|
|
158
157
|
* @param context Context path
|
|
@@ -160,7 +159,7 @@ export class FlexRouter {
|
|
|
160
159
|
* @param handlers Request handlers (optional)
|
|
161
160
|
*/
|
|
162
161
|
constructor(context: string, router: Router, handlers?: RequestHandler[]);
|
|
163
|
-
|
|
162
|
+
|
|
164
163
|
/**
|
|
165
164
|
* Mount router to Express app
|
|
166
165
|
* @param app Express application
|
|
@@ -178,19 +177,19 @@ export class RedisManager {
|
|
|
178
177
|
* @returns Returns true if Redis server is connected
|
|
179
178
|
*/
|
|
180
179
|
connect(redisUrl: string, certPath: string): Promise<boolean>;
|
|
181
|
-
|
|
180
|
+
|
|
182
181
|
/**
|
|
183
182
|
* Get Redis client
|
|
184
183
|
* @returns Returns Redis client instance
|
|
185
184
|
*/
|
|
186
185
|
getClient(): RedisClientType;
|
|
187
|
-
|
|
186
|
+
|
|
188
187
|
/**
|
|
189
188
|
* Determine if the Redis server is connected
|
|
190
189
|
* @returns Returns true if Redis server is connected
|
|
191
190
|
*/
|
|
192
191
|
isConnected(): Promise<boolean>;
|
|
193
|
-
|
|
192
|
+
|
|
194
193
|
/**
|
|
195
194
|
* Disconnect from Redis
|
|
196
195
|
* @returns Returns nothing
|
|
@@ -268,6 +267,18 @@ export function httpErrorHandler(
|
|
|
268
267
|
next: NextFunction
|
|
269
268
|
): void;
|
|
270
269
|
|
|
270
|
+
/**
|
|
271
|
+
* HTTP not found handler middleware
|
|
272
|
+
* @param req Express Request
|
|
273
|
+
* @param res Express Response
|
|
274
|
+
* @param next Next function
|
|
275
|
+
*/
|
|
276
|
+
export function httpNotFoundHandler(
|
|
277
|
+
req: Request,
|
|
278
|
+
res: Response,
|
|
279
|
+
next: NextFunction
|
|
280
|
+
): void;
|
|
281
|
+
|
|
271
282
|
declare global {
|
|
272
283
|
namespace Express {
|
|
273
284
|
export interface Request {
|