@vritti/api-sdk 0.2.5 → 0.2.7
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/dist/decimal.cjs +37 -0
- package/dist/decimal.cjs.map +1 -0
- package/dist/decimal.d.cts +4 -0
- package/dist/decimal.d.ts +4 -0
- package/dist/decimal.js +6 -0
- package/dist/decimal.js.map +1 -0
- package/dist/drizzle-orm.d.cts +0 -1
- package/dist/drizzle-orm.d.ts +0 -1
- package/dist/index.cjs +5191 -3996
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +515 -346
- package/dist/index.d.ts +515 -346
- package/dist/index.js +5688 -4502
- package/dist/index.js.map +1 -1
- package/dist/lodash.cjs +37 -0
- package/dist/lodash.cjs.map +1 -0
- package/dist/lodash.d.cts +1 -0
- package/dist/lodash.d.ts +1 -0
- package/dist/lodash.js +6 -0
- package/dist/lodash.js.map +1 -0
- package/dist/money.cjs +346 -0
- package/dist/money.cjs.map +1 -0
- package/dist/money.d.cts +222 -0
- package/dist/money.d.ts +222 -0
- package/dist/money.js +318 -0
- package/dist/money.js.map +1 -0
- package/dist/xlsx.cjs.map +1 -1
- package/dist/xlsx.js.map +1 -1
- package/package.json +47 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
+
import { FastifyRequest, FastifyReply, VrittiSessionInfo } from 'fastify';
|
|
1
2
|
import * as _nestjs_common from '@nestjs/common';
|
|
2
|
-
import { DynamicModule, CanActivate, ExecutionContext, OnModuleInit, OnModuleDestroy,
|
|
3
|
-
import { ConfigService } from '@nestjs/config';
|
|
3
|
+
import { InjectionToken, DynamicModule, CanActivate, ExecutionContext, OnModuleInit, OnModuleDestroy, Logger, HttpException, HttpStatus, ExceptionFilter, ArgumentsHost, ModuleMetadata, Type, LoggerService as LoggerService$1, NestInterceptor, CallHandler, NestModule, MiddlewareConsumer, NestMiddleware } from '@nestjs/common';
|
|
4
4
|
import { Reflector } from '@nestjs/core';
|
|
5
|
-
import { JwtService,
|
|
6
|
-
import {
|
|
7
|
-
import { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
|
8
|
-
import * as drizzle_orm from 'drizzle-orm';
|
|
9
|
-
import { Column, SQL, InferInsertModel, InferSelectModel } from 'drizzle-orm';
|
|
5
|
+
import { JwtService, JwtSignOptions } from '@nestjs/jwt';
|
|
6
|
+
import { ConfigService } from '@nestjs/config';
|
|
10
7
|
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
11
|
-
import { PgTable } from 'drizzle-orm/pg-core';
|
|
8
|
+
import { PgTable, PgSequence, PgColumn } from 'drizzle-orm/pg-core';
|
|
9
|
+
import { SQL, InferInsertModel, InferSelectModel, Column } from 'drizzle-orm';
|
|
10
|
+
import { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
|
11
|
+
import { PoolClient } from 'pg';
|
|
12
|
+
import { ValidationOptions } from 'class-validator';
|
|
12
13
|
import { Observable } from 'rxjs';
|
|
13
14
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
sessionInfo?: {
|
|
18
|
-
userId: string;
|
|
19
|
-
sessionId: string;
|
|
20
|
-
sessionType: string;
|
|
21
|
-
};
|
|
22
|
-
cookies?: Record<string, string>;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
declare class AuthConfigModule {
|
|
27
|
-
static forRootAsync(): DynamicModule;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
declare const AccessToken: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
31
|
-
|
|
32
|
-
declare const CookieDomain: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
33
|
-
|
|
34
|
-
declare const Public: () => _nestjs_common.CustomDecorator<string>;
|
|
35
|
-
|
|
36
|
-
declare const RefreshCookieOptions: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
37
|
-
|
|
38
|
-
declare const RefreshTokenCookie: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
39
|
-
|
|
40
|
-
declare const REQUIRE_SESSION_KEY = "requiredSessionTypes";
|
|
41
|
-
declare const RequireSession: (...types: string[]) => _nestjs_common.CustomDecorator<string>;
|
|
42
|
-
|
|
43
|
-
declare const Subdomain: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
44
|
-
|
|
45
|
-
interface SessionInfo {
|
|
46
|
-
userId: string;
|
|
47
|
-
sessionId: string;
|
|
48
|
-
sessionType: string;
|
|
49
|
-
}
|
|
50
|
-
declare const SessionData: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
51
|
-
|
|
52
|
-
declare const UserId: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
15
|
+
export { Currency, CurrencyCode, SUPPORTED_CURRENCIES, majorToMinor, minorToMajor } from './money.js';
|
|
16
|
+
import { ClientProxy } from '@nestjs/microservices';
|
|
17
|
+
import 'dinero.js/bigint';
|
|
53
18
|
|
|
54
19
|
declare class RequestService {
|
|
55
20
|
private readonly request;
|
|
56
|
-
|
|
57
|
-
|
|
21
|
+
private readonly config;
|
|
22
|
+
constructor(request: FastifyRequest, config: AuthConfig);
|
|
58
23
|
getAccessToken(): string | null;
|
|
59
24
|
getRefreshToken(): string | null;
|
|
60
25
|
getHeader(key: string): string | string[] | undefined;
|
|
26
|
+
getHostname(): string;
|
|
61
27
|
getAllHeaders(): FastifyRequest['headers'];
|
|
62
28
|
}
|
|
63
29
|
|
|
64
|
-
declare
|
|
65
|
-
|
|
66
|
-
readonly _configService: ConfigService;
|
|
67
|
-
private readonly jwtService;
|
|
68
|
-
private readonly requestService;
|
|
69
|
-
private readonly logger;
|
|
70
|
-
constructor(reflector: Reflector, _configService: ConfigService, jwtService: JwtService, requestService: RequestService);
|
|
71
|
-
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
72
|
-
private validateAccessToken;
|
|
73
|
-
private validateRefreshTokenBinding;
|
|
74
|
-
private handleSseAuth;
|
|
75
|
-
private validateCsrf;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
declare const jwtConfigFactory: (configService: ConfigService) => JwtModuleOptions;
|
|
30
|
+
declare const AUTH_CONFIG: unique symbol;
|
|
31
|
+
type OnAuthenticatedCallback = (requestService: RequestService, sessionInfo: NonNullable<FastifyRequest['sessionInfo']>) => void | Promise<void>;
|
|
79
32
|
type TokenExpiryString = `${number}${'s' | 'm' | 'h' | 'd' | 'w' | 'y'}`;
|
|
80
33
|
interface TokenExpiry {
|
|
81
34
|
access: TokenExpiryString;
|
|
82
35
|
refresh: TokenExpiryString;
|
|
83
36
|
}
|
|
84
|
-
|
|
37
|
+
interface CookieConfig {
|
|
38
|
+
refreshCookieName: string;
|
|
39
|
+
refreshCookieMaxAge: number;
|
|
40
|
+
refreshCookiePath: string;
|
|
41
|
+
refreshCookieSecure: boolean;
|
|
42
|
+
refreshCookieSameSite: 'strict' | 'lax' | 'none';
|
|
43
|
+
refreshCookieDomain?: string;
|
|
44
|
+
}
|
|
45
|
+
interface GuardConfig {
|
|
46
|
+
authHeaderName: string;
|
|
47
|
+
tokenPrefix: string;
|
|
48
|
+
csrfExemptSessionTypes?: string[];
|
|
49
|
+
refreshTokenBindingExemptSessionTypes?: string[];
|
|
50
|
+
onAuthenticated?: OnAuthenticatedCallback;
|
|
51
|
+
}
|
|
52
|
+
interface AuthConfig {
|
|
53
|
+
tokenExpiry: TokenExpiry;
|
|
54
|
+
cookie: CookieConfig;
|
|
55
|
+
guard: GuardConfig;
|
|
56
|
+
}
|
|
57
|
+
declare const AUTH_CONFIG_DEFAULTS: {
|
|
58
|
+
cookie: {
|
|
59
|
+
refreshCookieName: string;
|
|
60
|
+
refreshCookieMaxAge: number;
|
|
61
|
+
refreshCookiePath: string;
|
|
62
|
+
refreshCookieSecure: boolean;
|
|
63
|
+
refreshCookieSameSite: "strict";
|
|
64
|
+
refreshCookieDomain: string;
|
|
65
|
+
};
|
|
66
|
+
guard: {
|
|
67
|
+
authHeaderName: string;
|
|
68
|
+
tokenPrefix: string;
|
|
69
|
+
csrfExemptSessionTypes: never[];
|
|
70
|
+
refreshTokenBindingExemptSessionTypes: never[];
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
interface CookieSerializeOptions {
|
|
74
|
+
httpOnly: boolean;
|
|
75
|
+
secure: boolean;
|
|
76
|
+
sameSite: 'strict' | 'lax' | 'none';
|
|
77
|
+
path: string;
|
|
78
|
+
maxAge: number;
|
|
79
|
+
domain: string;
|
|
80
|
+
}
|
|
85
81
|
declare enum TokenType {
|
|
86
82
|
ACCESS = "access",
|
|
87
83
|
REFRESH = "refresh"
|
|
88
84
|
}
|
|
85
|
+
interface JwtClaims {
|
|
86
|
+
exp: number;
|
|
87
|
+
iat: number;
|
|
88
|
+
}
|
|
89
89
|
interface AccessTokenPayload {
|
|
90
90
|
sessionType: string;
|
|
91
91
|
tokenType: TokenType.ACCESS;
|
|
@@ -93,21 +93,77 @@ interface AccessTokenPayload {
|
|
|
93
93
|
sessionId: string;
|
|
94
94
|
refreshTokenHash: string;
|
|
95
95
|
}
|
|
96
|
+
type DecodedAccessToken = AccessTokenPayload & JwtClaims;
|
|
96
97
|
interface RefreshTokenPayload {
|
|
97
98
|
sessionType: string;
|
|
98
99
|
tokenType: TokenType.REFRESH;
|
|
99
100
|
userId: string;
|
|
100
101
|
sessionId: string;
|
|
101
102
|
}
|
|
103
|
+
type DecodedRefreshToken = RefreshTokenPayload & JwtClaims;
|
|
104
|
+
|
|
105
|
+
declare module 'fastify' {
|
|
106
|
+
interface VrittiSessionInfo {
|
|
107
|
+
userId: string;
|
|
108
|
+
sessionId: string;
|
|
109
|
+
sessionType: string;
|
|
110
|
+
}
|
|
111
|
+
interface FastifyRequest {
|
|
112
|
+
sessionInfo?: VrittiSessionInfo;
|
|
113
|
+
authConfig?: AuthConfig;
|
|
114
|
+
cookies?: Record<string, string>;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface AuthConfigInput {
|
|
119
|
+
tokenExpiry: TokenExpiry;
|
|
120
|
+
cookie?: Partial<CookieConfig>;
|
|
121
|
+
guard?: Partial<GuardConfig>;
|
|
122
|
+
}
|
|
123
|
+
interface AuthConfigModuleOptions<T extends unknown[] = unknown[]> {
|
|
124
|
+
useFactory: (...args: [...T]) => AuthConfigInput | Promise<AuthConfigInput>;
|
|
125
|
+
inject?: InjectionToken[];
|
|
126
|
+
}
|
|
127
|
+
declare class AuthConfigModule {
|
|
128
|
+
static forRootAsync<T extends unknown[] = unknown[]>(options: AuthConfigModuleOptions<T>): DynamicModule;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
declare const AccessToken: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
132
|
+
|
|
133
|
+
declare const CookieDomain: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
134
|
+
|
|
135
|
+
declare const CookieName: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
136
|
+
|
|
137
|
+
declare const Hostname: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
138
|
+
|
|
139
|
+
declare const Public: () => _nestjs_common.CustomDecorator<string>;
|
|
140
|
+
|
|
141
|
+
declare const RefreshCookieOptions: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
142
|
+
|
|
143
|
+
declare const RefreshTokenCookie: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
144
|
+
|
|
145
|
+
declare const REQUIRE_SESSION_KEY = "requiredSessionTypes";
|
|
146
|
+
declare const RequireSession: (...types: string[]) => _nestjs_common.CustomDecorator<string>;
|
|
147
|
+
|
|
148
|
+
interface SessionInfo$1 {
|
|
149
|
+
userId: string;
|
|
150
|
+
sessionId: string;
|
|
151
|
+
sessionType: string;
|
|
152
|
+
}
|
|
153
|
+
declare const SessionData: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
102
154
|
|
|
103
|
-
declare
|
|
155
|
+
declare const Subdomain: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
156
|
+
|
|
157
|
+
declare const UserId: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
158
|
+
|
|
159
|
+
type SessionInfo = NonNullable<FastifyRequest['sessionInfo']>;
|
|
160
|
+
declare class TokenService {
|
|
104
161
|
private readonly jwtService;
|
|
105
|
-
readonly
|
|
162
|
+
private readonly config;
|
|
106
163
|
private readonly logger;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
generateRefreshToken(userId: string, sessionId: string, sessionType: string): string;
|
|
164
|
+
constructor(jwtService: JwtService, config: AuthConfig);
|
|
165
|
+
generateAccessToken(sessionInfo: SessionInfo, refreshToken: string): string;
|
|
166
|
+
generateRefreshToken(sessionInfo: SessionInfo): string;
|
|
111
167
|
sign(payload: object, options?: JwtSignOptions): string;
|
|
112
168
|
verify(token: string, expectedType: TokenType): {
|
|
113
169
|
userId: string;
|
|
@@ -117,6 +173,22 @@ declare class JwtAuthService {
|
|
|
117
173
|
};
|
|
118
174
|
getExpiryTime(type: TokenType): Date;
|
|
119
175
|
getExpiryInSeconds(type: TokenType): number;
|
|
176
|
+
validateAccessToken(token: string): DecodedAccessToken;
|
|
177
|
+
validateRefreshToken(token: string): DecodedRefreshToken;
|
|
178
|
+
validateTokenBinding(accessToken: DecodedAccessToken, refreshToken: string): void;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare class VrittiAuthGuard implements CanActivate {
|
|
182
|
+
private readonly reflector;
|
|
183
|
+
private readonly requestService;
|
|
184
|
+
private readonly tokenService;
|
|
185
|
+
private readonly config;
|
|
186
|
+
private readonly logger;
|
|
187
|
+
constructor(reflector: Reflector, requestService: RequestService, tokenService: TokenService, config: AuthConfig);
|
|
188
|
+
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
189
|
+
private handleHttpAuth;
|
|
190
|
+
private handleSseAuth;
|
|
191
|
+
private validateCsrf;
|
|
120
192
|
}
|
|
121
193
|
|
|
122
194
|
declare function hashToken(token: string): string;
|
|
@@ -163,157 +235,32 @@ declare class RedisCacheProvider implements ICacheProvider, OnModuleInit, OnModu
|
|
|
163
235
|
getMemoryInfo(): Promise<string>;
|
|
164
236
|
}
|
|
165
237
|
|
|
166
|
-
|
|
167
|
-
refreshCookieName: string;
|
|
168
|
-
refreshCookieMaxAge: number;
|
|
169
|
-
refreshCookiePath: string;
|
|
170
|
-
refreshCookieSecure: boolean;
|
|
171
|
-
refreshCookieSameSite: 'strict' | 'lax' | 'none';
|
|
172
|
-
refreshCookieDomain?: string;
|
|
173
|
-
}
|
|
174
|
-
interface CookieSerializeOptions {
|
|
175
|
-
httpOnly: boolean;
|
|
176
|
-
secure: boolean;
|
|
177
|
-
sameSite: 'strict' | 'lax' | 'none';
|
|
178
|
-
path: string;
|
|
179
|
-
maxAge: number;
|
|
180
|
-
domain: string;
|
|
181
|
-
}
|
|
182
|
-
interface JwtConfig {
|
|
183
|
-
accessTokenExpiry: string;
|
|
184
|
-
refreshTokenExpiry: string;
|
|
185
|
-
onboardingTokenExpiry: string;
|
|
186
|
-
}
|
|
187
|
-
interface GuardConfig {
|
|
188
|
-
tenantHeaderName: string;
|
|
189
|
-
authHeaderName: string;
|
|
190
|
-
tokenPrefix: string;
|
|
191
|
-
defaultSessionTypes: string[];
|
|
192
|
-
}
|
|
193
|
-
interface ApiSdkConfig {
|
|
194
|
-
cookie?: Partial<CookieConfig>;
|
|
195
|
-
jwt?: Partial<JwtConfig>;
|
|
196
|
-
guard?: Partial<GuardConfig>;
|
|
197
|
-
}
|
|
198
|
-
interface FullConfig {
|
|
199
|
-
cookie: CookieConfig;
|
|
200
|
-
jwt: JwtConfig;
|
|
201
|
-
guard: GuardConfig;
|
|
202
|
-
}
|
|
203
|
-
declare function defineConfig(config: ApiSdkConfig): ApiSdkConfig;
|
|
204
|
-
declare function configureApiSdk(userConfig: ApiSdkConfig): void;
|
|
205
|
-
declare function getConfig(): FullConfig;
|
|
206
|
-
declare function resetConfig(): void;
|
|
207
|
-
declare function getRefreshCookieOptions(): Omit<CookieSerializeOptions, 'domain'> & {
|
|
208
|
-
domain?: string;
|
|
209
|
-
};
|
|
210
|
-
declare function getRefreshCookieOptionsForHost(hostname: string): CookieSerializeOptions;
|
|
211
|
-
declare function getJwtExpiry(): {
|
|
212
|
-
access: string;
|
|
213
|
-
refresh: string;
|
|
214
|
-
onboarding: string;
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
type SchemaRegistry = {};
|
|
218
|
-
type RegisteredSchema = SchemaRegistry extends {
|
|
219
|
-
schema: infer S;
|
|
220
|
-
} ? S : Record<string, unknown>;
|
|
221
|
-
type TypedDrizzleClient = NodePgDatabase<RegisteredSchema>;
|
|
222
|
-
|
|
223
|
-
interface PrimaryDbConfig {
|
|
224
|
-
host: string;
|
|
225
|
-
port?: number;
|
|
226
|
-
username: string;
|
|
227
|
-
password: string;
|
|
228
|
-
database: string;
|
|
229
|
-
schema?: string;
|
|
230
|
-
sslMode?: 'require' | 'prefer' | 'disable' | 'no-verify';
|
|
231
|
-
}
|
|
232
|
-
interface DatabaseModuleOptions {
|
|
233
|
-
primaryDb: PrimaryDbConfig;
|
|
234
|
-
drizzleSchema: RegisteredSchema;
|
|
235
|
-
drizzleRelations?: Record<string, any>;
|
|
236
|
-
maxConnections?: number;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
declare class DatabaseModule {
|
|
240
|
-
static forServer(options: {
|
|
241
|
-
useFactory: (...args: unknown[]) => Promise<DatabaseModuleOptions> | DatabaseModuleOptions;
|
|
242
|
-
inject?: InjectionToken[];
|
|
243
|
-
}): DynamicModule;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
interface UploadedFileResult {
|
|
247
|
-
buffer: Buffer;
|
|
248
|
-
filename: string;
|
|
249
|
-
mimetype: string;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Extracts a single uploaded file from a Fastify multipart request.
|
|
253
|
-
*
|
|
254
|
-
* Requires `@fastify/multipart` to be registered on the Fastify instance.
|
|
255
|
-
* Throws `BadRequestException` if no file is present in the request.
|
|
256
|
-
*
|
|
257
|
-
* @example
|
|
258
|
-
* ```typescript
|
|
259
|
-
* @Post('upload')
|
|
260
|
-
* @ApiConsumes('multipart/form-data')
|
|
261
|
-
* async upload(@UploadedFile() file: UploadedFileResult) {
|
|
262
|
-
* // file.buffer, file.filename, file.mimetype
|
|
263
|
-
* }
|
|
264
|
-
* ```
|
|
265
|
-
*/
|
|
266
|
-
declare const UploadedFile: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
267
|
-
|
|
268
|
-
declare class CreateResponseDto<T> {
|
|
269
|
-
success: boolean;
|
|
270
|
-
message: string;
|
|
271
|
-
data: T;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
declare class ValidatedRowDto {
|
|
275
|
-
index: number;
|
|
276
|
-
data: Record<string, string>;
|
|
277
|
-
valid: boolean;
|
|
278
|
-
errors: string[];
|
|
279
|
-
}
|
|
280
|
-
declare class ImportSummaryDto {
|
|
281
|
-
total: number;
|
|
282
|
-
valid: number;
|
|
283
|
-
invalid: number;
|
|
284
|
-
}
|
|
285
|
-
declare class ImportResponseDto {
|
|
286
|
-
success: boolean;
|
|
287
|
-
message: string;
|
|
288
|
-
created?: number;
|
|
289
|
-
updated?: number;
|
|
290
|
-
skipped?: number;
|
|
291
|
-
rows?: ValidatedRowDto[];
|
|
292
|
-
summary?: ImportSummaryDto;
|
|
293
|
-
}
|
|
238
|
+
declare const DATA_TABLE_VIEWS_TABLE: unique symbol;
|
|
294
239
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
limit?: number;
|
|
298
|
-
offset?: number;
|
|
299
|
-
values?: string;
|
|
300
|
-
excludeIds?: string;
|
|
301
|
-
valueKey?: string;
|
|
302
|
-
labelKey?: string;
|
|
303
|
-
descriptionKey?: string;
|
|
304
|
-
groupIdKey?: string;
|
|
240
|
+
interface DataTableModuleOptions {
|
|
241
|
+
tableViews: PgTable;
|
|
305
242
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
success: boolean;
|
|
309
|
-
message: string;
|
|
243
|
+
declare class DataTableModule {
|
|
244
|
+
static forRoot(options: DataTableModuleOptions): DynamicModule;
|
|
310
245
|
}
|
|
311
246
|
|
|
312
|
-
type FilterOperator = 'equals' | 'notEquals' | 'contains' | 'notContains' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
247
|
+
type FilterOperator = 'equals' | 'notEquals' | 'contains' | 'notContains' | 'gt' | 'gte' | 'lt' | 'lte' | 'isAnyOf' | 'isNotAnyOf';
|
|
248
|
+
declare const FilterOperators: {
|
|
249
|
+
readonly EQUALS: "equals";
|
|
250
|
+
readonly NOT_EQUALS: "notEquals";
|
|
251
|
+
readonly CONTAINS: "contains";
|
|
252
|
+
readonly NOT_CONTAINS: "notContains";
|
|
253
|
+
readonly GT: "gt";
|
|
254
|
+
readonly GTE: "gte";
|
|
255
|
+
readonly LT: "lt";
|
|
256
|
+
readonly LTE: "lte";
|
|
257
|
+
readonly IS_ANY_OF: "isAnyOf";
|
|
258
|
+
readonly IS_NOT_ANY_OF: "isNotAnyOf";
|
|
259
|
+
};
|
|
313
260
|
interface FilterCondition {
|
|
314
261
|
field: string;
|
|
315
262
|
operator: FilterOperator;
|
|
316
|
-
value: string | number;
|
|
263
|
+
value: string | number | string[];
|
|
317
264
|
}
|
|
318
265
|
interface SortCondition {
|
|
319
266
|
field: string;
|
|
@@ -339,32 +286,108 @@ interface TableViewState {
|
|
|
339
286
|
density: DensityType;
|
|
340
287
|
filterOrder: string[];
|
|
341
288
|
filterVisibility: Record<string, boolean>;
|
|
342
|
-
search
|
|
343
|
-
pagination
|
|
289
|
+
search: SearchState | null;
|
|
290
|
+
pagination: {
|
|
344
291
|
limit: number;
|
|
345
292
|
offset: number;
|
|
346
293
|
};
|
|
347
294
|
}
|
|
348
295
|
|
|
349
|
-
declare
|
|
350
|
-
|
|
351
|
-
|
|
296
|
+
declare function dataTableViewsColumns(): {
|
|
297
|
+
id: drizzle_orm_pg_core.SetHasDefault<drizzle_orm_pg_core.SetIsPrimaryKey<drizzle_orm_pg_core.PgUUIDBuilder>>;
|
|
298
|
+
userId: drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgUUIDBuilder>;
|
|
299
|
+
tableSlug: drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgVarcharBuilder<[string, ...string[]]>>;
|
|
300
|
+
name: drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgVarcharBuilder<[string, ...string[]]>>;
|
|
301
|
+
state: drizzle_orm_pg_core.Set$Type<drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgJsonbBuilder>, TableViewState>;
|
|
302
|
+
isShared: drizzle_orm_pg_core.SetHasDefault<drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgBooleanBuilder>>;
|
|
303
|
+
createdAt: drizzle_orm_pg_core.SetHasDefault<drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgTimestampBuilder>>;
|
|
304
|
+
updatedAt: drizzle_orm_pg_core.SetHasDefault<drizzle_orm_pg_core.PgTimestampBuilder>;
|
|
305
|
+
};
|
|
306
|
+
declare function dataTableViewsIndexes(table: any): drizzle_orm_pg_core.IndexBuilder[];
|
|
307
|
+
interface DataTableViewRecord {
|
|
308
|
+
id: string;
|
|
309
|
+
userId: string;
|
|
310
|
+
tableSlug: string;
|
|
311
|
+
name: string;
|
|
352
312
|
state: TableViewState;
|
|
353
|
-
|
|
313
|
+
isShared: boolean;
|
|
314
|
+
createdAt: Date;
|
|
315
|
+
updatedAt: Date | null | undefined;
|
|
316
|
+
}
|
|
317
|
+
interface NewDataTableViewRecord {
|
|
318
|
+
userId: string;
|
|
319
|
+
tableSlug: string;
|
|
320
|
+
name: string;
|
|
321
|
+
state: TableViewState;
|
|
322
|
+
isShared?: boolean;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
declare class UpsertDataTableStateDto {
|
|
326
|
+
tableSlug: string;
|
|
327
|
+
state: TableViewState;
|
|
328
|
+
activeViewId?: string | null;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
declare class DataTableStateService {
|
|
332
|
+
private readonly cacheService;
|
|
333
|
+
private readonly configService;
|
|
334
|
+
private readonly logger;
|
|
335
|
+
constructor(cacheService: CacheService, configService: ConfigService);
|
|
336
|
+
private get stateTtl();
|
|
337
|
+
upsertCurrentState(userId: string, dto: UpsertDataTableStateDto): Promise<void>;
|
|
338
|
+
getCurrentState(userId: string, tableSlug: string): Promise<{
|
|
339
|
+
state: TableViewState;
|
|
340
|
+
activeViewId: string | null;
|
|
341
|
+
}>;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
declare class DataTableViewDto {
|
|
345
|
+
id: string;
|
|
346
|
+
name: string | null;
|
|
347
|
+
tableSlug: string;
|
|
348
|
+
state: TableViewState;
|
|
349
|
+
isShared: boolean;
|
|
350
|
+
isOwn: boolean;
|
|
351
|
+
createdAt: Date;
|
|
352
|
+
updatedAt: Date | null;
|
|
353
|
+
static from(view: DataTableViewRecord, userId: string): DataTableViewDto;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
declare class CreateDataTableViewDto {
|
|
357
|
+
name: string;
|
|
358
|
+
tableSlug: string;
|
|
359
|
+
state: TableViewState;
|
|
360
|
+
isShared?: boolean;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
declare class RenameDataTableViewDto {
|
|
364
|
+
name: string;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
declare class ToggleShareDataTableViewDto {
|
|
368
|
+
isShared: boolean;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
declare class UpdateDataTableViewDto {
|
|
372
|
+
state: TableViewState;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
type TypedDrizzleClient = NodePgDatabase;
|
|
376
|
+
|
|
377
|
+
interface PrimaryDbConfig {
|
|
378
|
+
host: string;
|
|
379
|
+
port?: number;
|
|
380
|
+
username: string;
|
|
381
|
+
password: string;
|
|
382
|
+
database: string;
|
|
383
|
+
schema?: string;
|
|
384
|
+
sslMode?: 'require' | 'prefer' | 'disable' | 'no-verify';
|
|
354
385
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
expression: (value: string | number) => SQL;
|
|
361
|
-
type: 'string' | 'number' | 'boolean';
|
|
362
|
-
};
|
|
363
|
-
type FieldMap = Record<string, FieldDefinition>;
|
|
364
|
-
declare class FilterProcessor {
|
|
365
|
-
static buildWhere(filters: FilterCondition[] | undefined, fieldMap: FieldMap): SQL | undefined;
|
|
366
|
-
static buildSearch(search: SearchState | null | undefined, fieldMap: FieldMap): SQL | undefined;
|
|
367
|
-
static buildOrderBy(sort: SortCondition[] | undefined, fieldMap: FieldMap): SQL[];
|
|
386
|
+
interface DatabaseModuleOptions {
|
|
387
|
+
primaryDb: PrimaryDbConfig;
|
|
388
|
+
drizzleRelations?: Record<string, any>;
|
|
389
|
+
maxConnections?: number;
|
|
390
|
+
applyRlsContext?: (client: PoolClient, ctx: unknown) => Promise<void>;
|
|
368
391
|
}
|
|
369
392
|
|
|
370
393
|
declare class PrimaryDatabaseService implements OnModuleInit, OnModuleDestroy {
|
|
@@ -372,11 +395,15 @@ declare class PrimaryDatabaseService implements OnModuleInit, OnModuleDestroy {
|
|
|
372
395
|
private readonly logger;
|
|
373
396
|
private pool;
|
|
374
397
|
private db;
|
|
398
|
+
private readonly rlsAls;
|
|
399
|
+
private readonly txAls;
|
|
375
400
|
constructor(options: DatabaseModuleOptions);
|
|
376
401
|
onModuleInit(): Promise<void>;
|
|
377
402
|
private initializeDrizzleClient;
|
|
378
403
|
get drizzleClient(): TypedDrizzleClient;
|
|
379
|
-
|
|
404
|
+
runWithRlsContext<T>(rls: unknown, fn: () => Promise<T>): Promise<T>;
|
|
405
|
+
runInTransaction<T>(fn: () => Promise<T>): Promise<T>;
|
|
406
|
+
runWithPinnedConnection<T>(fn: () => Promise<T>): Promise<T>;
|
|
380
407
|
onModuleDestroy(): Promise<void>;
|
|
381
408
|
}
|
|
382
409
|
|
|
@@ -384,6 +411,7 @@ interface SelectQueryOption {
|
|
|
384
411
|
value: string | number | boolean;
|
|
385
412
|
label: string;
|
|
386
413
|
description?: string;
|
|
414
|
+
additionals?: Record<string, string | number | boolean | null>;
|
|
387
415
|
groupId?: string | number;
|
|
388
416
|
}
|
|
389
417
|
interface SelectQueryGroup {
|
|
@@ -405,18 +433,22 @@ interface FindForSelectConfig {
|
|
|
405
433
|
value: string;
|
|
406
434
|
label: string;
|
|
407
435
|
description?: string;
|
|
408
|
-
|
|
436
|
+
additionalKeys?: string | string[];
|
|
437
|
+
additionalExpressions?: Record<string, SQL>;
|
|
438
|
+
groupIdKey?: string;
|
|
409
439
|
search?: string;
|
|
410
440
|
limit?: number;
|
|
411
441
|
offset?: number;
|
|
412
442
|
where?: Record<string, unknown>;
|
|
443
|
+
orderByKey?: string;
|
|
444
|
+
orderDirection?: 'asc' | 'desc';
|
|
413
445
|
orderBy?: Record<string, 'asc' | 'desc'>;
|
|
414
446
|
groups?: SelectQueryGroup[];
|
|
415
447
|
values?: string | (string | number | boolean)[];
|
|
416
448
|
excludeIds?: string | (string | number | boolean)[];
|
|
417
449
|
groupTable?: PgTable;
|
|
418
450
|
groupLabelKey?: string;
|
|
419
|
-
|
|
451
|
+
groupTableIdKey?: string;
|
|
420
452
|
joins?: FindForSelectJoin[];
|
|
421
453
|
conditions?: SQL[];
|
|
422
454
|
distinct?: boolean;
|
|
@@ -442,10 +474,14 @@ declare abstract class PrimaryBaseRepository<TTable extends PgTable, TInsert = I
|
|
|
442
474
|
protected readonly database: PrimaryDatabaseService;
|
|
443
475
|
protected readonly table: TTable;
|
|
444
476
|
protected readonly logger: Logger;
|
|
477
|
+
protected readonly sequence?: PgSequence;
|
|
445
478
|
private readonly tableName;
|
|
446
479
|
protected get db(): TypedDrizzleClient;
|
|
447
480
|
protected get model(): TypedRelationalQueryBuilder<TSelect>;
|
|
448
|
-
constructor(database: PrimaryDatabaseService, table: TTable
|
|
481
|
+
constructor(database: PrimaryDatabaseService, table: TTable, options?: {
|
|
482
|
+
sequence?: PgSequence;
|
|
483
|
+
});
|
|
484
|
+
protected nextSequenceValue(sequence?: PgSequence): Promise<number>;
|
|
449
485
|
create(data: TInsert, tx?: TypedDrizzleClient): Promise<TSelect>;
|
|
450
486
|
findById(id: string): Promise<TSelect | undefined>;
|
|
451
487
|
findOne(where: RelationsWhereFilter): Promise<TSelect | undefined>;
|
|
@@ -470,7 +506,7 @@ declare abstract class PrimaryBaseRepository<TTable extends PgTable, TInsert = I
|
|
|
470
506
|
table: PgTable;
|
|
471
507
|
on: SQL | undefined;
|
|
472
508
|
}[];
|
|
473
|
-
groupBy?: (
|
|
509
|
+
groupBy?: (PgColumn | SQL)[];
|
|
474
510
|
}): Promise<{
|
|
475
511
|
result: TResult[];
|
|
476
512
|
count: number;
|
|
@@ -489,6 +525,162 @@ declare abstract class PrimaryBaseRepository<TTable extends PgTable, TInsert = I
|
|
|
489
525
|
findForSelect(config: FindForSelectConfig): Promise<SelectQueryResult>;
|
|
490
526
|
}
|
|
491
527
|
|
|
528
|
+
declare class DataTableViewsRepository extends PrimaryBaseRepository<PgTable, NewDataTableViewRecord, DataTableViewRecord> {
|
|
529
|
+
constructor(database: PrimaryDatabaseService, table: PgTable);
|
|
530
|
+
findPersonalViewsBySlug(userId: string, tableSlug: string): Promise<DataTableViewRecord[]>;
|
|
531
|
+
findSharedViewsBySlug(tableSlug: string): Promise<DataTableViewRecord[]>;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
declare class DataTableViewsService {
|
|
535
|
+
private readonly dataTableViewsRepository;
|
|
536
|
+
private readonly cacheService;
|
|
537
|
+
private readonly configService;
|
|
538
|
+
private readonly logger;
|
|
539
|
+
constructor(dataTableViewsRepository: DataTableViewsRepository, cacheService: CacheService, configService: ConfigService);
|
|
540
|
+
private personalViewsKey;
|
|
541
|
+
private sharedViewsKey;
|
|
542
|
+
private get viewsTtl();
|
|
543
|
+
private getOrCachePersonalViews;
|
|
544
|
+
private getOrCacheSharedViews;
|
|
545
|
+
private invalidateViewsCache;
|
|
546
|
+
findViews(userId: string, tableSlug: string): Promise<DataTableViewDto[]>;
|
|
547
|
+
createView(userId: string, dto: CreateDataTableViewDto): Promise<DataTableViewDto>;
|
|
548
|
+
updateView(userId: string, id: string, dto: UpdateDataTableViewDto): Promise<DataTableViewDto>;
|
|
549
|
+
toggleShareView(userId: string, id: string, isShared: boolean): Promise<DataTableViewDto>;
|
|
550
|
+
renameView(userId: string, id: string, name: string): Promise<DataTableViewDto>;
|
|
551
|
+
deleteView(userId: string, id: string): Promise<DataTableViewDto>;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
declare class DatabaseModule {
|
|
555
|
+
static forServer<T extends unknown[] = unknown[]>(options: {
|
|
556
|
+
useFactory: (...args: [...T]) => Promise<DatabaseModuleOptions> | DatabaseModuleOptions;
|
|
557
|
+
inject?: InjectionToken[];
|
|
558
|
+
}): DynamicModule;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
declare class CreateResponseDto<T> {
|
|
562
|
+
success: boolean;
|
|
563
|
+
message: string;
|
|
564
|
+
data: T;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
declare class ValidatedRowDto {
|
|
568
|
+
index: number;
|
|
569
|
+
data: Record<string, string>;
|
|
570
|
+
valid: boolean;
|
|
571
|
+
errors: string[];
|
|
572
|
+
}
|
|
573
|
+
declare class ImportSummaryDto {
|
|
574
|
+
total: number;
|
|
575
|
+
valid: number;
|
|
576
|
+
invalid: number;
|
|
577
|
+
}
|
|
578
|
+
declare class ImportResponseDto {
|
|
579
|
+
success: boolean;
|
|
580
|
+
message: string;
|
|
581
|
+
created?: number;
|
|
582
|
+
updated?: number;
|
|
583
|
+
skipped?: number;
|
|
584
|
+
rows?: ValidatedRowDto[];
|
|
585
|
+
summary?: ImportSummaryDto;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
declare class SelectOptionsQueryDto {
|
|
589
|
+
search?: string;
|
|
590
|
+
limit?: number;
|
|
591
|
+
offset?: number;
|
|
592
|
+
values?: string;
|
|
593
|
+
excludeIds?: string;
|
|
594
|
+
valueKey?: string;
|
|
595
|
+
labelKey?: string;
|
|
596
|
+
descriptionKey?: string;
|
|
597
|
+
additionalKeys?: string;
|
|
598
|
+
groupIdKey?: string;
|
|
599
|
+
orderByKey?: string;
|
|
600
|
+
orderDirection?: 'asc' | 'desc';
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
declare class SuccessResponseDto {
|
|
604
|
+
success: boolean;
|
|
605
|
+
message: string;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
declare class TableResponseDto<T> {
|
|
609
|
+
result: T[];
|
|
610
|
+
count: number;
|
|
611
|
+
state: TableViewState;
|
|
612
|
+
activeViewId: string | null;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
type FieldDefinition = {
|
|
616
|
+
column: Column;
|
|
617
|
+
type: 'string' | 'number' | 'boolean';
|
|
618
|
+
} | {
|
|
619
|
+
expression: (value: string | number, operator: FilterOperator) => SQL;
|
|
620
|
+
type: 'string' | 'number' | 'boolean';
|
|
621
|
+
};
|
|
622
|
+
type FieldMap = Record<string, FieldDefinition>;
|
|
623
|
+
declare class FilterProcessor {
|
|
624
|
+
static buildWhere(filters: FilterCondition[] | undefined, fieldMap: FieldMap): SQL | undefined;
|
|
625
|
+
static buildSearch(search: SearchState | null | undefined, fieldMap: FieldMap): SQL | undefined;
|
|
626
|
+
static buildOrderBy(sort: SortCondition[] | undefined, fieldMap: FieldMap): SQL[];
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
declare function IsCurrency(validationOptions?: ValidationOptions): PropertyDecorator;
|
|
630
|
+
|
|
631
|
+
declare function IsCurrencyCode(validationOptions?: ValidationOptions): PropertyDecorator;
|
|
632
|
+
|
|
633
|
+
declare function IsDateTime(validationOptions?: ValidationOptions): PropertyDecorator;
|
|
634
|
+
|
|
635
|
+
interface UploadedFileResult {
|
|
636
|
+
buffer: Buffer;
|
|
637
|
+
filename: string;
|
|
638
|
+
mimetype: string;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Extracts a single uploaded file from a Fastify multipart request.
|
|
642
|
+
* Pass an optional field name to match a specific form key.
|
|
643
|
+
*
|
|
644
|
+
* Requires `@fastify/multipart` to be registered on the Fastify instance.
|
|
645
|
+
* Throws `BadRequestException` if no file is present in the request.
|
|
646
|
+
*
|
|
647
|
+
* @example
|
|
648
|
+
* ```typescript
|
|
649
|
+
* @Post('upload')
|
|
650
|
+
* @ApiConsumes('multipart/form-data')
|
|
651
|
+
* async upload(
|
|
652
|
+
* @UploadedFile() file: UploadedFileResult, // grabs first file
|
|
653
|
+
* @UploadedFile('avatar') avatar: UploadedFileResult, // grabs file with key "avatar"
|
|
654
|
+
* ) {}
|
|
655
|
+
* ```
|
|
656
|
+
*/
|
|
657
|
+
declare const UploadedFile: (...dataOrPipes: (string | _nestjs_common.PipeTransform<any, any> | _nestjs_common.Type<_nestjs_common.PipeTransform<any, any>> | undefined)[]) => ParameterDecorator;
|
|
658
|
+
/**
|
|
659
|
+
* Extracts multiple uploaded files from a Fastify multipart request.
|
|
660
|
+
* Pass an optional field name to match only files under a specific form key.
|
|
661
|
+
*
|
|
662
|
+
* Requires `@fastify/multipart` to be registered on the Fastify instance.
|
|
663
|
+
* Throws `BadRequestException` if no files are present in the request.
|
|
664
|
+
*
|
|
665
|
+
* @example
|
|
666
|
+
* ```typescript
|
|
667
|
+
* @Post('upload')
|
|
668
|
+
* @ApiConsumes('multipart/form-data')
|
|
669
|
+
* async upload(
|
|
670
|
+
* @UploadedFiles() files: UploadedFileResult[], // grabs all files
|
|
671
|
+
* @UploadedFiles('documents') docs: UploadedFileResult[], // grabs files with key "documents"
|
|
672
|
+
* ) {}
|
|
673
|
+
* ```
|
|
674
|
+
*/
|
|
675
|
+
declare const UploadedFiles: (...dataOrPipes: (string | _nestjs_common.PipeTransform<any, any> | _nestjs_common.Type<_nestjs_common.PipeTransform<any, any>> | undefined)[]) => ParameterDecorator;
|
|
676
|
+
|
|
677
|
+
declare class CurrencyAmountDto {
|
|
678
|
+
currency: string;
|
|
679
|
+
value: string;
|
|
680
|
+
static from(minor: bigint, currencyCode: string): CurrencyAmountDto;
|
|
681
|
+
static from(minor: bigint | null | undefined, currencyCode: string): CurrencyAmountDto | null;
|
|
682
|
+
}
|
|
683
|
+
|
|
492
684
|
declare class EmailModule {
|
|
493
685
|
}
|
|
494
686
|
|
|
@@ -508,6 +700,15 @@ declare class EmailService {
|
|
|
508
700
|
name: string;
|
|
509
701
|
inviteUrl: string;
|
|
510
702
|
}): Promise<void>;
|
|
703
|
+
sendTransactionalEmail(params: {
|
|
704
|
+
to: {
|
|
705
|
+
email: string;
|
|
706
|
+
name?: string;
|
|
707
|
+
};
|
|
708
|
+
subject: string;
|
|
709
|
+
htmlContent: string;
|
|
710
|
+
textContent: string;
|
|
711
|
+
}): Promise<void>;
|
|
511
712
|
verifyConnection(): Promise<boolean>;
|
|
512
713
|
private sendEmail;
|
|
513
714
|
}
|
|
@@ -616,6 +817,14 @@ declare class HttpExceptionFilter implements ExceptionFilter {
|
|
|
616
817
|
catch(exception: unknown, host: ArgumentsHost): void;
|
|
617
818
|
private isHttpException;
|
|
618
819
|
private isAxiosError;
|
|
820
|
+
private isProblemLikeObject;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
declare class RpcProblemExceptionFilter {
|
|
824
|
+
private readonly logger;
|
|
825
|
+
catch(exception: unknown, _host: ArgumentsHost): Observable<never>;
|
|
826
|
+
private toProblemPayload;
|
|
827
|
+
private isHttpException;
|
|
619
828
|
}
|
|
620
829
|
|
|
621
830
|
type LogLevel = 'error' | 'warn' | 'log' | 'debug' | 'verbose';
|
|
@@ -647,11 +856,11 @@ interface LoggerModuleOptions {
|
|
|
647
856
|
interface LoggerOptionsFactory {
|
|
648
857
|
createLoggerOptions(): Promise<LoggerModuleOptions> | LoggerModuleOptions;
|
|
649
858
|
}
|
|
650
|
-
interface LoggerModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
|
859
|
+
interface LoggerModuleAsyncOptions<T extends unknown[] = unknown[]> extends Pick<ModuleMetadata, 'imports'> {
|
|
651
860
|
useExisting?: Type<LoggerOptionsFactory>;
|
|
652
861
|
useClass?: Type<LoggerOptionsFactory>;
|
|
653
|
-
useFactory?: (...args:
|
|
654
|
-
inject?:
|
|
862
|
+
useFactory?: (...args: [...T]) => Promise<LoggerModuleOptions> | LoggerModuleOptions;
|
|
863
|
+
inject?: InjectionToken[];
|
|
655
864
|
}
|
|
656
865
|
interface CorrelationContext {
|
|
657
866
|
correlationId: string;
|
|
@@ -704,7 +913,7 @@ declare class HttpLoggerInterceptor implements NestInterceptor {
|
|
|
704
913
|
declare const LOGGER_MODULE_OPTIONS: unique symbol;
|
|
705
914
|
declare class LoggerModule implements NestModule {
|
|
706
915
|
static forRoot(options?: LoggerModuleOptions): DynamicModule;
|
|
707
|
-
static forRootAsync(options: LoggerModuleAsyncOptions): DynamicModule;
|
|
916
|
+
static forRootAsync<T extends unknown[] = unknown[]>(options: LoggerModuleAsyncOptions<T>): DynamicModule;
|
|
708
917
|
configure(_consumer: MiddlewareConsumer): void;
|
|
709
918
|
private static createAsyncProviders;
|
|
710
919
|
private static createAsyncOptionsProvider;
|
|
@@ -730,126 +939,86 @@ declare const DEFAULT_CORRELATION_HEADER = "x-correlation-id";
|
|
|
730
939
|
declare function generateCorrelationId(): string;
|
|
731
940
|
declare function addCorrelationIdToResponse(reply: FastifyReply, correlationId: string, headerName?: string): void;
|
|
732
941
|
|
|
733
|
-
declare
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
declare function extractCountryFromPhone(phone: string): string | undefined;
|
|
737
|
-
declare function normalizePhoneNumber(phone: string): string;
|
|
738
|
-
|
|
739
|
-
declare function parseExpiryToMs(expiry: string): number;
|
|
942
|
+
declare const RpcNatsHeaders: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
943
|
+
declare const RpcBuId: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
944
|
+
declare const RpcBuCurrencyCode: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
740
945
|
|
|
741
|
-
|
|
946
|
+
interface NatsHeaders {
|
|
947
|
+
orgId: string;
|
|
948
|
+
userId: string;
|
|
949
|
+
buId: string;
|
|
950
|
+
buTimezone: string;
|
|
951
|
+
buCurrencyCode: string;
|
|
952
|
+
buAncestorIds: string[];
|
|
953
|
+
buDescendantIds: string[];
|
|
954
|
+
}
|
|
955
|
+
declare const NATS_HEADER_KEYS: {
|
|
956
|
+
readonly ORG_ID: "x-org-id";
|
|
957
|
+
readonly USER_ID: "x-user-id";
|
|
958
|
+
readonly BU_ID: "x-bu-id";
|
|
959
|
+
readonly BU_TIMEZONE: "x-bu-timezone";
|
|
960
|
+
readonly BU_CURRENCY_CODE: "x-bu-currency-code";
|
|
961
|
+
readonly BU_ANCESTOR_IDS: "x-bu-ancestor-ids";
|
|
962
|
+
readonly BU_DESCENDANT_IDS: "x-bu-descendant-ids";
|
|
963
|
+
};
|
|
964
|
+
declare function parseNatsHeaders(headers: unknown): NatsHeaders | null;
|
|
742
965
|
|
|
743
|
-
|
|
744
|
-
|
|
966
|
+
type ContextResolverFn = (sessionInfo: VrittiSessionInfo) => Promise<NatsHeaders>;
|
|
967
|
+
interface NatsServiceConfig {
|
|
968
|
+
name: string;
|
|
745
969
|
}
|
|
746
|
-
|
|
747
|
-
|
|
970
|
+
interface NatsModuleBaseOptions {
|
|
971
|
+
natsUrl?: string;
|
|
972
|
+
services: NatsServiceConfig[];
|
|
748
973
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
id: drizzle_orm.HasDefault<drizzle_orm.IsPrimaryKey<drizzle_orm_pg_core.PgUUIDBuilder>>;
|
|
752
|
-
userId: drizzle_orm.NotNull<drizzle_orm_pg_core.PgUUIDBuilder>;
|
|
753
|
-
tableSlug: drizzle_orm.NotNull<drizzle_orm_pg_core.PgVarcharBuilder<[string, ...string[]]>>;
|
|
754
|
-
name: drizzle_orm.NotNull<drizzle_orm_pg_core.PgVarcharBuilder<[string, ...string[]]>>;
|
|
755
|
-
state: drizzle_orm.$Type<drizzle_orm.NotNull<drizzle_orm_pg_core.PgJsonbBuilder>, TableViewState>;
|
|
756
|
-
isShared: drizzle_orm.HasDefault<drizzle_orm.NotNull<drizzle_orm_pg_core.PgBooleanBuilder>>;
|
|
757
|
-
createdAt: drizzle_orm.HasDefault<drizzle_orm.NotNull<drizzle_orm_pg_core.PgTimestampBuilder>>;
|
|
758
|
-
updatedAt: drizzle_orm.HasDefault<drizzle_orm_pg_core.PgTimestampBuilder>;
|
|
759
|
-
};
|
|
760
|
-
declare function dataTableViewsIndexes(table: any): drizzle_orm_pg_core.IndexBuilder[];
|
|
761
|
-
interface DataTableViewRecord {
|
|
762
|
-
id: string;
|
|
763
|
-
userId: string;
|
|
764
|
-
tableSlug: string;
|
|
765
|
-
name: string;
|
|
766
|
-
state: TableViewState;
|
|
767
|
-
isShared: boolean;
|
|
768
|
-
createdAt: Date;
|
|
769
|
-
updatedAt: Date | null | undefined;
|
|
974
|
+
interface NatsRootModuleOptions extends NatsModuleBaseOptions {
|
|
975
|
+
contextResolver: ContextResolverFn;
|
|
770
976
|
}
|
|
771
|
-
interface
|
|
772
|
-
userId: string;
|
|
773
|
-
tableSlug: string;
|
|
774
|
-
name: string;
|
|
775
|
-
state: TableViewState;
|
|
776
|
-
isShared?: boolean;
|
|
977
|
+
interface NatsMicroserviceModuleOptions extends NatsModuleBaseOptions {
|
|
777
978
|
}
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
tableSlug: string;
|
|
783
|
-
state: TableViewState;
|
|
784
|
-
isShared: boolean;
|
|
785
|
-
isOwn: boolean;
|
|
786
|
-
createdAt: Date;
|
|
787
|
-
updatedAt: Date | null;
|
|
788
|
-
static from(view: DataTableViewRecord, userId: string): DataTableViewDto;
|
|
979
|
+
interface NatsRootModuleAsyncOptions {
|
|
980
|
+
imports?: ModuleMetadata['imports'];
|
|
981
|
+
inject?: InjectionToken[];
|
|
982
|
+
useFactory: (...args: any[]) => Promise<NatsRootModuleOptions> | NatsRootModuleOptions;
|
|
789
983
|
}
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
state: TableViewState;
|
|
795
|
-
isShared?: boolean;
|
|
984
|
+
interface NatsMicroserviceModuleAsyncOptions {
|
|
985
|
+
imports?: ModuleMetadata['imports'];
|
|
986
|
+
inject?: InjectionToken[];
|
|
987
|
+
useFactory: (...args: any[]) => Promise<NatsMicroserviceModuleOptions> | NatsMicroserviceModuleOptions;
|
|
796
988
|
}
|
|
797
989
|
|
|
798
|
-
declare class
|
|
799
|
-
|
|
990
|
+
declare class NatsClientModule implements OnModuleDestroy {
|
|
991
|
+
private static readonly logger;
|
|
992
|
+
private static allClients;
|
|
993
|
+
onModuleDestroy(): Promise<void>;
|
|
994
|
+
private static buildClients;
|
|
995
|
+
static forRoot(asyncOptions: NatsRootModuleAsyncOptions): DynamicModule;
|
|
996
|
+
static forMicroservice(asyncOptions: NatsMicroserviceModuleAsyncOptions): DynamicModule;
|
|
800
997
|
}
|
|
801
998
|
|
|
802
|
-
declare class
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
999
|
+
declare class NatsClientService {
|
|
1000
|
+
private readonly request;
|
|
1001
|
+
private readonly contextResolver;
|
|
1002
|
+
private readonly clients;
|
|
1003
|
+
private cachedContext;
|
|
1004
|
+
constructor(request: FastifyRequest, contextResolver: ContextResolverFn, clients: Map<string, ClientProxy>);
|
|
1005
|
+
send<T>(service: string, cmd: string, data?: object): Promise<T>;
|
|
806
1006
|
}
|
|
807
1007
|
|
|
808
|
-
declare class
|
|
809
|
-
private readonly
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
private readonly logger;
|
|
813
|
-
constructor(dataTableViewsRepository: DataTableViewsRepository, cacheService: CacheService, configService: ConfigService);
|
|
814
|
-
private personalViewsKey;
|
|
815
|
-
private sharedViewsKey;
|
|
816
|
-
private get viewsTtl();
|
|
817
|
-
private getOrCachePersonalViews;
|
|
818
|
-
private getOrCacheSharedViews;
|
|
819
|
-
private invalidateViewsCache;
|
|
820
|
-
findViews(userId: string, tableSlug: string): Promise<DataTableViewDto[]>;
|
|
821
|
-
createView(userId: string, dto: CreateDataTableViewDto): Promise<DataTableViewDto>;
|
|
822
|
-
updateView(userId: string, id: string, dto: UpdateDataTableViewDto): Promise<DataTableViewDto>;
|
|
823
|
-
toggleShareView(userId: string, id: string, isShared: boolean): Promise<DataTableViewDto>;
|
|
824
|
-
renameView(userId: string, id: string, name: string): Promise<DataTableViewDto>;
|
|
825
|
-
deleteView(userId: string, id: string): Promise<DataTableViewDto>;
|
|
1008
|
+
declare class NatsMicroserviceClientService {
|
|
1009
|
+
private readonly clients;
|
|
1010
|
+
constructor(clients: Map<string, ClientProxy>);
|
|
1011
|
+
send<T>(service: string, cmd: string, natsHeaders: NatsHeaders, data?: object): Promise<T>;
|
|
826
1012
|
}
|
|
827
1013
|
|
|
828
|
-
declare class
|
|
829
|
-
tableSlug: string;
|
|
830
|
-
state: TableViewState;
|
|
831
|
-
activeViewId?: string | null;
|
|
1014
|
+
declare class RootModule {
|
|
832
1015
|
}
|
|
833
1016
|
|
|
834
|
-
declare
|
|
835
|
-
private readonly cacheService;
|
|
836
|
-
private readonly configService;
|
|
837
|
-
private readonly logger;
|
|
838
|
-
constructor(cacheService: CacheService, configService: ConfigService);
|
|
839
|
-
private get stateTtl();
|
|
840
|
-
upsertCurrentState(userId: string, dto: UpsertDataTableStateDto): Promise<void>;
|
|
841
|
-
getCurrentState(userId: string, tableSlug: string): Promise<{
|
|
842
|
-
state: TableViewState;
|
|
843
|
-
activeViewId: string | null;
|
|
844
|
-
}>;
|
|
845
|
-
}
|
|
1017
|
+
declare function gcd(a: number, b: number): number;
|
|
846
1018
|
|
|
847
|
-
declare
|
|
848
|
-
|
|
849
|
-
}
|
|
1019
|
+
declare function extractCountryFromPhone(phone: string): string | undefined;
|
|
1020
|
+
declare function normalizePhoneNumber(phone: string): string;
|
|
850
1021
|
|
|
851
|
-
declare
|
|
852
|
-
isShared: boolean;
|
|
853
|
-
}
|
|
1022
|
+
declare function parseExpiryToMs(expiry: string): number;
|
|
854
1023
|
|
|
855
|
-
export { AccessToken, type AccessTokenPayload, type ApiErrorResponse, type
|
|
1024
|
+
export { AUTH_CONFIG, AUTH_CONFIG_DEFAULTS, AccessToken, type AccessTokenPayload, type ApiErrorResponse, type AuthConfig, AuthConfigModule, BadGatewayException, BadRequestException, CACHE_PROVIDER, CacheModule, CacheService, type ColumnPinning, ConflictException, type ContextResolverFn, type CookieConfig, CookieDomain, CookieName, type CookieSerializeOptions, type CorrelationContext, CorrelationIdMiddleware, CreateDataTableViewDto, CreateResponseDto, CurrencyAmountDto, DATA_TABLE_VIEWS_TABLE, DEFAULT_CORRELATION_HEADER, DataTableModule, type DataTableModuleOptions, DataTableStateService, DataTableViewDto, type DataTableViewRecord, DataTableViewsService, DatabaseModule, type DatabaseModuleOptions, type DecodedAccessToken, type DecodedRefreshToken, type DensityType, EmailModule, EmailService, type FieldDefinition, type FieldError, type FieldMap, type FilterCondition, type FilterOperator, FilterOperators, FilterProcessor, type FindForSelectConfig, type FindForSelectJoin, ForbiddenException, GoneException, type GuardConfig, Hostname, HttpExceptionFilter, HttpLoggerInterceptor, type HttpLoggerOptions, HttpProblemException, type ICacheProvider, ImportResponseDto, ImportSummaryDto, InternalServerErrorException, IsCurrency, IsCurrencyCode, IsDateTime, LOGGER_MODULE_OPTIONS, type LogFormat, type LogLevel, type LogMetadata, LoggerModule, type LoggerModuleAsyncOptions, type LoggerModuleOptions, type LoggerOptionsFactory, LoggerService, MethodNotAllowedException, NATS_HEADER_KEYS, NatsClientModule, NatsClientService, type NatsHeaders, NatsMicroserviceClientService, type NatsMicroserviceModuleAsyncOptions, type NatsRootModuleAsyncOptions, type NatsServiceConfig, type NewDataTableViewRecord, NotAcceptableException, NotFoundException, NotImplementedException, type OnAuthenticatedCallback, PayloadTooLargeException, PrimaryBaseRepository, PrimaryDatabaseService, type PrimaryDbConfig, type ProblemDetails, type ProblemOptions, Public, REQUIRE_SESSION_KEY, RedisCacheProvider, RefreshCookieOptions, RefreshTokenCookie, type RefreshTokenPayload, RenameDataTableViewDto, RequestTimeoutException, RequireSession, RootModule, RpcBuCurrencyCode, RpcBuId, RpcNatsHeaders, RpcProblemExceptionFilter, SKIP_CSRF_KEY, type SearchState, SelectOptionsQueryDto, type SelectQueryGroup, type SelectQueryOption, type SelectQueryResult, ServiceUnavailableException, SessionData, type SessionInfo$1 as SessionInfo, SkipCsrf, type SortCondition, Subdomain, SuccessResponseDto, TableResponseDto, type TableViewState, ToggleShareDataTableViewDto, type TokenExpiry, type TokenExpiryString, TokenService, TokenType, TooManyRequestsException, type TypedDrizzleClient, UnauthorizedException, UnprocessableEntityException, UnsupportedMediaTypeException, UpdateDataTableViewDto, UploadedFile, type UploadedFileResult, UploadedFiles, UpsertDataTableStateDto, UserId, ValidatedRowDto, ValidationException, VrittiAuthGuard, addCorrelationIdToResponse, correlationStorage, dataTableViewsColumns, dataTableViewsIndexes, extractCountryFromPhone, gcd, generateCorrelationId, getCorrelationContext, getHttpStatusTitle, hashToken, normalizePhoneNumber, parseExpiryToMs, parseNatsHeaders, runWithCorrelationContext, updateCorrelationContext, verifyTokenHash };
|