@autofleet/zehut 4.3.4 → 4.3.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/lib/chunk-Cl8Af3a2.js +1 -0
- package/lib/index.cjs +1 -2
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +253 -247
- package/lib/index.d.ts +251 -247
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/package.json +9 -8
package/lib/index.d.cts
CHANGED
|
@@ -1,308 +1,314 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Handler, Request } from
|
|
5
|
-
import
|
|
6
|
-
import { LoggerInstanceManager } from '@autofleet/logger';
|
|
7
|
-
import * as outbreak from '@autofleet/outbreak';
|
|
8
|
-
import { newTrace as newTrace$1 } from '@autofleet/outbreak';
|
|
9
|
-
export { outbreak };
|
|
1
|
+
import { LoggerInstanceManager } from "@autofleet/logger";
|
|
2
|
+
import * as outbreak from "@autofleet/outbreak";
|
|
3
|
+
import { newTrace as newTrace$1 } from "@autofleet/outbreak";
|
|
4
|
+
import { Handler, NextFunction, Request, Response } from "express";
|
|
5
|
+
import { FastifyPluginCallback } from "fastify";
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
//#region rolldown:runtime
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/user/ApiUser.d.ts
|
|
10
|
+
type AccountType = "client" | "user" | "service" | "driver";
|
|
12
11
|
interface EntityPermissions {
|
|
13
|
-
|
|
12
|
+
[key: string]: string[];
|
|
14
13
|
}
|
|
15
14
|
declare const CONTEXTS_IDS_HEADER = "x-af-context-ids";
|
|
16
15
|
interface UserPayload {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
businessModels: EntityPermissions;
|
|
17
|
+
fleets: EntityPermissions;
|
|
18
|
+
demandSources: EntityPermissions;
|
|
19
|
+
businessAccounts?: EntityPermissions;
|
|
20
|
+
accountType?: AccountType;
|
|
21
|
+
contexts?: EntityPermissions;
|
|
22
|
+
createdAt?: string;
|
|
24
23
|
}
|
|
25
24
|
interface PartialUserPayload {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
businessModels?: EntityPermissions;
|
|
26
|
+
fleets?: EntityPermissions;
|
|
27
|
+
demandSources?: EntityPermissions;
|
|
28
|
+
vehicles?: EntityPermissions;
|
|
29
|
+
drivers?: EntityPermissions;
|
|
30
|
+
businessAccounts?: EntityPermissions;
|
|
32
31
|
}
|
|
33
32
|
declare class ApiUser {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
33
|
+
id?: string | undefined;
|
|
34
|
+
accountType?: AccountType | undefined;
|
|
35
|
+
contextIds?: string[] | undefined;
|
|
36
|
+
private privatePermissions;
|
|
37
|
+
private readonly privateElevatedPermissionsHash;
|
|
38
|
+
private privatePermissionsLegacy;
|
|
39
|
+
private readonly appPermission;
|
|
40
|
+
readonly emptyUser: boolean;
|
|
41
|
+
constructor(id?: string | undefined, accountType?: AccountType | undefined, elevatedPermissions?: PartialUserPayload, contextIds?: string[] | undefined);
|
|
42
|
+
getUserPermissions(): Promise<UserPayload>;
|
|
43
|
+
useCustomPermissionLoader(customPermissionLoader: (userId: string) => UserPayload | PromiseLike<UserPayload>): Promise<UserPayload>;
|
|
44
|
+
get businessModels(): string[];
|
|
45
|
+
get fleets(): string[];
|
|
46
|
+
get demandSources(): string[];
|
|
47
|
+
private getUserProperty;
|
|
48
|
+
get elevatedPermissions(): UserPayload;
|
|
49
|
+
get permissions(): UserPayload | undefined;
|
|
50
|
+
elevatePermissions(addedPermissions: PartialUserPayload): (() => void) & {
|
|
51
|
+
[Symbol.dispose]: () => void;
|
|
52
|
+
};
|
|
53
|
+
getUserPermissionsLegacy(): Promise<unknown>;
|
|
54
|
+
get permissionsLegacy(): any;
|
|
55
|
+
getUserAppPermissions(appId: string, clientSecret: string): Promise<UserPayload | undefined>;
|
|
57
56
|
}
|
|
58
|
-
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/user/common.d.ts
|
|
59
59
|
type CustomPermissionLoader = (userId: string) => Promise<UserPayload>;
|
|
60
60
|
interface AuthFromUserIdHeaderOptions {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
eagerLoadUserPermissions?: boolean;
|
|
62
|
+
eagerLoadUserPermissionsLegacy?: boolean;
|
|
63
|
+
customPermissionLoader?: CustomPermissionLoader;
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/user/index.d.ts
|
|
67
|
+
declare module "express-serve-static-core" {
|
|
68
|
+
interface Request {
|
|
69
|
+
user: ApiUser;
|
|
70
|
+
}
|
|
70
71
|
}
|
|
71
|
-
|
|
72
|
+
type Asyncify<T extends (...a: any[]) => any> = (...a: Parameters<T>) => Promise<Awaited<ReturnType<T>>>;
|
|
73
|
+
declare const middleware: (options?: AuthFromUserIdHeaderOptions) => Asyncify<Handler>;
|
|
72
74
|
declare const middlewareWithDecode: (options?: {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}) => Handler
|
|
75
|
+
eagerLoadUserPermissions?: boolean;
|
|
76
|
+
eagerLoadUserPermissionsLegacy?: boolean;
|
|
77
|
+
returnErrorIfNoToken?: boolean;
|
|
78
|
+
}) => Asyncify<Handler>;
|
|
77
79
|
declare const appMiddleware: (options: {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}) => Handler
|
|
81
|
-
declare const eagerLoadPermissionsMiddleware: Handler
|
|
80
|
+
appId: string;
|
|
81
|
+
clientSecret: string;
|
|
82
|
+
}) => Asyncify<Handler>;
|
|
83
|
+
declare const eagerLoadPermissionsMiddleware: Asyncify<Handler>;
|
|
82
84
|
declare const getDecodedBearer: (req: Request) => any;
|
|
83
85
|
declare const createOrSetRabbitTrace: (trace: ReturnType<typeof newTrace$1> | undefined, userId: string | undefined) => Promise<void>;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/user/fastify.d.ts
|
|
88
|
+
declare module "fastify" {
|
|
89
|
+
interface FastifyRequest {
|
|
90
|
+
user?: ApiUser;
|
|
91
|
+
}
|
|
89
92
|
}
|
|
90
93
|
declare const authFromUserIdHeaderPlugin: FastifyPluginCallback<AuthFromUserIdHeaderOptions>;
|
|
91
|
-
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/check-permission.d.ts
|
|
92
96
|
declare const getUser: () => ApiUser | undefined;
|
|
93
|
-
declare const isUserExist: () => string;
|
|
97
|
+
declare const isUserExist: () => string | undefined;
|
|
94
98
|
declare const checkFleetPermission: (fleetId: string) => boolean;
|
|
95
99
|
declare const checkBusinessModelPermission: (businessModelId: string) => boolean;
|
|
96
100
|
declare const checkDemandSourcePermission: (demandSourceId: string) => boolean;
|
|
97
|
-
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/errors.d.ts
|
|
98
103
|
declare class UnauthorizedAccessError extends Error {
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
user: ApiUser | null;
|
|
105
|
+
constructor(user?: ApiUser | null, message?: string);
|
|
101
106
|
}
|
|
102
|
-
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/secret-getter.d.ts
|
|
103
109
|
declare const getRefreshTokenSecret: (token?: string) => string;
|
|
104
110
|
declare const getTokenSecret: (token?: string) => string;
|
|
105
|
-
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/authorization.d.ts
|
|
106
113
|
declare const AUTHORIZATION_METHODS: {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
NONE: string;
|
|
115
|
+
BASIC: string;
|
|
116
|
+
JWT: string;
|
|
110
117
|
};
|
|
111
118
|
declare const getAuthorizationHeader: (authorizationSettings: {
|
|
112
|
-
|
|
119
|
+
method: string;
|
|
113
120
|
} | undefined) => string | undefined;
|
|
114
|
-
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/permissions/SDK/consts.d.ts
|
|
115
123
|
declare const PERMISSIONS_EVALUATION_OPERATORS: {
|
|
116
|
-
|
|
117
|
-
|
|
124
|
+
AND: string;
|
|
125
|
+
OR: string;
|
|
118
126
|
};
|
|
119
127
|
declare const PERMISSION_ERROR_TYPES: {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
USER_NOT_FOUND: string;
|
|
129
|
+
INSUFFICIENT_PERMISSIONS: string;
|
|
130
|
+
VALIDATION_ERROR: string;
|
|
131
|
+
API_ERROR: string;
|
|
132
|
+
NO_REQUIRED_PERMISSIONS: string;
|
|
133
|
+
UNAUTHORIZED: string;
|
|
134
|
+
BAD_REQUEST: string;
|
|
135
|
+
INTERNAL_ERROR: string;
|
|
128
136
|
};
|
|
129
|
-
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/permissions/SDK/errors.d.ts
|
|
130
139
|
type PermissionErrorType = typeof PERMISSION_ERROR_TYPES[keyof typeof PERMISSION_ERROR_TYPES];
|
|
131
|
-
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/permissions/SDK/types.d.ts
|
|
132
142
|
type Logger = {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
143
|
+
debug: (message: string, meta?: unknown) => void;
|
|
144
|
+
info: (message: string, meta?: unknown) => void;
|
|
145
|
+
warn: (message: string, meta?: unknown) => void;
|
|
146
|
+
error: (message: string, meta?: unknown) => void;
|
|
137
147
|
};
|
|
138
148
|
/**
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
149
|
+
* The operator to use when evaluating permissions
|
|
150
|
+
* - AND: All required permissions must be present
|
|
151
|
+
* - OR: At least one required permission must be present
|
|
152
|
+
*/
|
|
143
153
|
type PermissionsEvaluationOperator = typeof PERMISSIONS_EVALUATION_OPERATORS[keyof typeof PERMISSIONS_EVALUATION_OPERATORS];
|
|
144
154
|
/**
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
155
|
+
* Options for evaluating permissions
|
|
156
|
+
* - requireAll: If true, all contexts must have the required permissions for the user to be considered authorized (default: true)
|
|
157
|
+
* - timeout: Optional - timeout in milliseconds for the permissions evaluation (default: 10 seconds)
|
|
158
|
+
* - enforce: Optional - If true, the permissions evaluation will throw an error if the user does not have the required permissions (default: false)
|
|
159
|
+
* - permissionsEvaluationOperator: Optional - If set, the permissions evaluation will use this operator to evaluate the permissions (default: AND)
|
|
160
|
+
*/
|
|
151
161
|
type EvaluatePermissionsOpts = {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
162
|
+
requireAll?: boolean;
|
|
163
|
+
timeout?: number;
|
|
164
|
+
enforce?: boolean;
|
|
165
|
+
permissionsEvaluationOperator?: PermissionsEvaluationOperator;
|
|
156
166
|
};
|
|
157
167
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
168
|
+
* Parameters for evaluating permissions for a user across multiple contexts
|
|
169
|
+
* - requiredPermissions: The required permissions to check against the user
|
|
170
|
+
* - contextIds: The context IDs to check the permissions against
|
|
171
|
+
* - logger: logger instance for logging
|
|
172
|
+
* - options: Options for evaluating permissions {@link EvaluatePermissionsOpts}
|
|
173
|
+
* - userId: The user id, if not provided, we will get the user from the current context
|
|
174
|
+
*/
|
|
165
175
|
type EvaluatePermissionsParams = {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
176
|
+
requiredPermissions: string[];
|
|
177
|
+
contextIds: string[];
|
|
178
|
+
logger?: Logger;
|
|
179
|
+
options: EvaluatePermissionsOpts;
|
|
180
|
+
userId?: string;
|
|
171
181
|
};
|
|
172
182
|
/**
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
183
|
+
* Parameters for resolving permissions for a user across multiple contexts
|
|
184
|
+
* - user: The user for whom permissions are being resolved
|
|
185
|
+
* - contextIds: The list of context IDs to resolve permissions for
|
|
186
|
+
* - requiredPermissions: The list of permissions to check for each context
|
|
187
|
+
* - options: Options for evaluating permissions {@link EvaluatePermissionsOpts}
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* The permissions evaluation result for a specific context
|
|
192
|
+
* - permissions: The full list of permissions the user has in the context
|
|
193
|
+
* - hasRequiredPermissions: Whether the user has the required permissions in the context
|
|
176
194
|
*/
|
|
177
195
|
type PermissionsEvaluation = {
|
|
178
|
-
|
|
179
|
-
|
|
196
|
+
permissions: string[];
|
|
197
|
+
hasRequiredPermissions: boolean;
|
|
180
198
|
};
|
|
181
199
|
/**
|
|
182
|
-
|
|
183
|
-
|
|
200
|
+
* A mapping of context IDs to their corresponding permissions evaluation results
|
|
201
|
+
*/
|
|
184
202
|
type PermissionsEvaluationByContextId = Record<string, PermissionsEvaluation>;
|
|
185
203
|
/**
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
204
|
+
* A mapping of context IDs to the list of permissions the user has in that context
|
|
205
|
+
* - isAuthorized: Whether the user has the required permissions in any of the contexts
|
|
206
|
+
* - userId: The ID of the user
|
|
207
|
+
* - resolvedPermissions: The detailed permissions evaluation results by context ID
|
|
208
|
+
* - requiredPermissions: The list of permissions that were required for the evaluation
|
|
209
|
+
* - contextIds: The list of context IDs that were evaluated
|
|
210
|
+
* - error: Optional error type if the evaluation failed
|
|
211
|
+
* - message: Optional error message if the evaluation failed
|
|
212
|
+
*/
|
|
195
213
|
type PermissionCheckResult = {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
214
|
+
isAuthorized: boolean;
|
|
215
|
+
userId?: string;
|
|
216
|
+
resolvedPermissions: PermissionsEvaluationByContextId;
|
|
217
|
+
requiredPermissions: string[];
|
|
218
|
+
contextIds: string[];
|
|
219
|
+
error?: PermissionErrorType;
|
|
220
|
+
message?: string;
|
|
203
221
|
};
|
|
204
|
-
|
|
222
|
+
/**
|
|
223
|
+
* A mapping of context IDs to the list of the effective permissions the user has in that context
|
|
224
|
+
*/
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/permissions/SDK/evaluatePermissions.d.ts
|
|
227
|
+
/**
|
|
228
|
+
* Main SDK function to evaluate user permissions
|
|
229
|
+
* Checks both cached and API-resolved permissions to determine access
|
|
230
|
+
* @param params - {@link EvaluatePermissionsParams}
|
|
231
|
+
* @returns {@link PermissionCheckResult} Detailed permission check result with access status and context
|
|
232
|
+
*/
|
|
233
|
+
declare const evaluatePermissions: ({
|
|
234
|
+
requiredPermissions,
|
|
235
|
+
contextIds,
|
|
236
|
+
logger,
|
|
237
|
+
userId,
|
|
238
|
+
options: {
|
|
239
|
+
requireAll,
|
|
240
|
+
permissionsEvaluationOperator,
|
|
241
|
+
timeout
|
|
242
|
+
}
|
|
243
|
+
}: EvaluatePermissionsParams) => Promise<PermissionCheckResult>;
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/permissions/middleware/requirePermissions.d.ts
|
|
205
246
|
interface RequirePermissionsOptions extends EvaluatePermissionsOpts {
|
|
206
|
-
|
|
247
|
+
logger?: LoggerInstanceManager;
|
|
207
248
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
declare const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
};
|
|
219
|
-
middlewares: {
|
|
220
|
-
requirePermissions: (requiredPermissions: string[], options?: RequirePermissionsOptions) => (req: express.Request, res: express.Response, next: express.NextFunction) => Promise<void | express.Response<any, Record<string, any>>>;
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
declare const permissions_middlewares: typeof middlewares;
|
|
225
|
-
declare const permissions_sdk: typeof sdk;
|
|
226
|
-
declare namespace permissions {
|
|
227
|
-
export { _default$1 as default, permissions_middlewares as middlewares, permissions_sdk as sdk };
|
|
249
|
+
/**
|
|
250
|
+
* Express middleware that requires specific permissions for route access
|
|
251
|
+
*
|
|
252
|
+
* @param requiredPermissions - Array of permissions required to access the route
|
|
253
|
+
* @param options - Configuration options for permission checking
|
|
254
|
+
* @returns Express middleware function
|
|
255
|
+
*/
|
|
256
|
+
declare const requirePermissions: (requiredPermissions: string[], options?: RequirePermissionsOptions) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
257
|
+
declare namespace index_d_exports {
|
|
258
|
+
export { _default as default, middlewares, sdk };
|
|
228
259
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
260
|
+
interface SdkExports {
|
|
261
|
+
evaluatePermissions: typeof evaluatePermissions;
|
|
262
|
+
}
|
|
263
|
+
interface MiddlewareExports {
|
|
264
|
+
requirePermissions: typeof requirePermissions;
|
|
265
|
+
}
|
|
266
|
+
interface PermissionsModule {
|
|
267
|
+
sdk: SdkExports;
|
|
268
|
+
middlewares: MiddlewareExports;
|
|
269
|
+
}
|
|
270
|
+
declare const sdk: SdkExports;
|
|
271
|
+
declare const middlewares: MiddlewareExports;
|
|
272
|
+
declare const _default: PermissionsModule;
|
|
273
|
+
//#endregion
|
|
274
|
+
//#region src/index.d.ts
|
|
275
|
+
declare const getCurrentPayload: typeof outbreak.getCurrentContext;
|
|
236
276
|
type OutbreakOptions = Parameters<typeof outbreak.default>[0];
|
|
237
|
-
type LoggerWithContextMiddleware = Partial<Pick<LoggerInstanceManager,
|
|
238
|
-
declare const enableTracing: ({
|
|
239
|
-
|
|
240
|
-
|
|
277
|
+
type LoggerWithContextMiddleware = Partial<Pick<LoggerInstanceManager, "addContextMiddleware">>;
|
|
278
|
+
declare const enableTracing: ({
|
|
279
|
+
outbreakOptions,
|
|
280
|
+
logger
|
|
281
|
+
}?: {
|
|
282
|
+
outbreakOptions?: OutbreakOptions;
|
|
283
|
+
logger?: LoggerWithContextMiddleware;
|
|
241
284
|
}) => void;
|
|
242
|
-
declare const traceTypes:
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
eagerLoadUserPermissionsLegacy?: boolean;
|
|
273
|
-
returnErrorIfNoToken?: boolean;
|
|
274
|
-
}) => express.Handler;
|
|
275
|
-
eagerLoadPermissionsMiddleware: express.Handler;
|
|
276
|
-
getCurrentPayload: () => {
|
|
277
|
-
type: "httpRequest" | "webSocket" | "rabbit" | "bull";
|
|
278
|
-
readonly id: crypto.UUID;
|
|
279
|
-
readonly context: Map<string, unknown>;
|
|
280
|
-
readonly nonHeaderContext: Map<string, unknown>;
|
|
281
|
-
} | Record<string, never>;
|
|
282
|
-
getDecodedBearer: (req: express.Request) => any;
|
|
283
|
-
checkFleetPermission: (fleetId: string) => boolean;
|
|
284
|
-
checkBusinessModelPermission: (businessModelId: string) => boolean;
|
|
285
|
-
checkDemandSourcePermission: (demandSourceId: string) => boolean;
|
|
286
|
-
isUserExist: () => string;
|
|
287
|
-
getUser: () => ApiUser | undefined;
|
|
288
|
-
UnauthorizedAccessError: typeof UnauthorizedAccessError;
|
|
289
|
-
appMiddleware: (options: {
|
|
290
|
-
appId: string;
|
|
291
|
-
clientSecret: string;
|
|
292
|
-
}) => express.Handler;
|
|
293
|
-
createOrSetRabbitTrace: (trace: ReturnType<typeof outbreak.newTrace> | undefined, userId: string | undefined) => Promise<void>;
|
|
294
|
-
outbreak: typeof outbreak;
|
|
295
|
-
AUTHORIZATION_METHODS: {
|
|
296
|
-
NONE: string;
|
|
297
|
-
BASIC: string;
|
|
298
|
-
JWT: string;
|
|
299
|
-
};
|
|
300
|
-
getAuthorizationHeader: (authorizationSettings: {
|
|
301
|
-
method: string;
|
|
302
|
-
} | undefined) => string | undefined;
|
|
303
|
-
CONTEXTS_IDS_HEADER: string;
|
|
304
|
-
authFromUserIdHeaderPlugin: fastify.FastifyPluginCallback<AuthFromUserIdHeaderOptions>;
|
|
305
|
-
permissions: typeof permissions;
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
export { AUTHORIZATION_METHODS, CONTEXTS_IDS_HEADER, UnauthorizedAccessError, ApiUser as User, type UserPayload, appMiddleware, authFromUserIdHeaderPlugin, checkBusinessModelPermission, checkDemandSourcePermission, checkFleetPermission, createOrSetRabbitTrace, _default as default, eagerLoadPermissionsMiddleware, enableTracing, getAuthorizationHeader, getCurrentPayload, getDecodedBearer, getRefreshTokenSecret, getTokenSecret, getUser, isUserExist, middleware, middlewareWithDecode, newTrace, permissions, traceTypes };
|
|
285
|
+
declare const traceTypes: typeof outbreak.traceTypes;
|
|
286
|
+
declare const newTrace: typeof outbreak.newTrace;
|
|
287
|
+
interface Default {
|
|
288
|
+
traceTypes: typeof outbreak.traceTypes;
|
|
289
|
+
newTrace: typeof outbreak.newTrace;
|
|
290
|
+
User: typeof ApiUser;
|
|
291
|
+
middleware: typeof middleware;
|
|
292
|
+
middlewareWithDecode: typeof middlewareWithDecode;
|
|
293
|
+
eagerLoadPermissionsMiddleware: typeof eagerLoadPermissionsMiddleware;
|
|
294
|
+
getCurrentPayload: typeof outbreak.getCurrentContext;
|
|
295
|
+
getDecodedBearer: typeof getDecodedBearer;
|
|
296
|
+
checkFleetPermission: typeof checkFleetPermission;
|
|
297
|
+
checkBusinessModelPermission: typeof checkBusinessModelPermission;
|
|
298
|
+
checkDemandSourcePermission: typeof checkDemandSourcePermission;
|
|
299
|
+
isUserExist: typeof isUserExist;
|
|
300
|
+
getUser: typeof getUser;
|
|
301
|
+
UnauthorizedAccessError: typeof UnauthorizedAccessError;
|
|
302
|
+
appMiddleware: typeof appMiddleware;
|
|
303
|
+
createOrSetRabbitTrace: typeof createOrSetRabbitTrace;
|
|
304
|
+
outbreak: typeof outbreak;
|
|
305
|
+
AUTHORIZATION_METHODS: typeof AUTHORIZATION_METHODS;
|
|
306
|
+
getAuthorizationHeader: typeof getAuthorizationHeader;
|
|
307
|
+
CONTEXTS_IDS_HEADER: typeof CONTEXTS_IDS_HEADER;
|
|
308
|
+
authFromUserIdHeaderPlugin: typeof authFromUserIdHeaderPlugin;
|
|
309
|
+
permissions: typeof index_d_exports;
|
|
310
|
+
}
|
|
311
|
+
declare const zehutDefault: Default;
|
|
312
|
+
//#endregion
|
|
313
|
+
export { AUTHORIZATION_METHODS, CONTEXTS_IDS_HEADER, UnauthorizedAccessError, ApiUser as User, type UserPayload, appMiddleware, authFromUserIdHeaderPlugin, checkBusinessModelPermission, checkDemandSourcePermission, checkFleetPermission, createOrSetRabbitTrace, zehutDefault as default, eagerLoadPermissionsMiddleware, enableTracing, getAuthorizationHeader, getCurrentPayload, getDecodedBearer, getRefreshTokenSecret, getTokenSecret, getUser, isUserExist, middleware, middlewareWithDecode, newTrace, outbreak, index_d_exports as permissions, traceTypes };
|
|
314
|
+
//# sourceMappingURL=index.d.cts.map
|