@vritti/api-sdk 0.2.4 → 0.2.6

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/index.d.ts CHANGED
@@ -1,107 +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, InjectionToken, Logger, HttpException, HttpStatus, ExceptionFilter, ArgumentsHost, ModuleMetadata, Type, LoggerService as LoggerService$1, NestInterceptor, CallHandler, NestModule, MiddlewareConsumer, NestMiddleware } from '@nestjs/common';
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, JwtModuleOptions, JwtSignOptions } from '@nestjs/jwt';
6
- import { FastifyRequest, FastifyReply } from 'fastify';
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
- interface TenantInfo {
16
- id: string;
17
- subdomain: string;
18
- type: 'SHARED' | 'DEDICATED';
19
- status: string;
20
- schemaName?: string;
21
- databaseName?: string;
22
- databaseHost?: string;
23
- databasePort?: number;
24
- databaseUsername?: string;
25
- databasePassword?: string;
26
- databaseSslMode?: string;
27
- connectionPoolSize?: number;
28
- }
29
-
30
- declare module 'fastify' {
31
- interface FastifyRequest {
32
- sessionInfo?: {
33
- userId: string;
34
- sessionId: string;
35
- sessionType: string;
36
- };
37
- tenant?: TenantInfo;
38
- cookies?: Record<string, string>;
39
- }
40
- }
41
-
42
- declare class AuthConfigModule {
43
- static forRootAsync(): DynamicModule;
44
- }
45
-
46
- declare const AccessToken: (...dataOrPipes: unknown[]) => ParameterDecorator;
47
-
48
- declare const CookieDomain: (...dataOrPipes: unknown[]) => ParameterDecorator;
49
-
50
- declare const Onboarding: () => _nestjs_common.CustomDecorator<string>;
51
-
52
- declare const Public: () => _nestjs_common.CustomDecorator<string>;
53
-
54
- declare const RefreshCookieOptions: (...dataOrPipes: unknown[]) => ParameterDecorator;
55
-
56
- declare const RefreshTokenCookie: (...dataOrPipes: unknown[]) => ParameterDecorator;
57
-
58
- declare const RESET_KEY = "isReset";
59
- declare const Reset: () => _nestjs_common.CustomDecorator<string>;
60
-
61
- interface SessionInfo {
62
- userId: string;
63
- sessionId: string;
64
- sessionType: string;
65
- }
66
- declare const SessionData: (...dataOrPipes: unknown[]) => ParameterDecorator;
67
-
68
- 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';
69
18
 
70
19
  declare class RequestService {
71
20
  private readonly request;
72
- constructor(request: FastifyRequest);
73
- getTenantIdentifier(): string | null;
21
+ private readonly config;
22
+ constructor(request: FastifyRequest, config: AuthConfig);
74
23
  getAccessToken(): string | null;
75
24
  getRefreshToken(): string | null;
76
25
  getHeader(key: string): string | string[] | undefined;
26
+ getHostname(): string;
77
27
  getAllHeaders(): FastifyRequest['headers'];
78
28
  }
79
29
 
80
- declare class VrittiAuthGuard implements CanActivate {
81
- private readonly reflector;
82
- readonly _configService: ConfigService;
83
- private readonly jwtService;
84
- private readonly requestService;
85
- private readonly logger;
86
- constructor(reflector: Reflector, _configService: ConfigService, jwtService: JwtService, requestService: RequestService);
87
- canActivate(context: ExecutionContext): Promise<boolean>;
88
- private validateAccessToken;
89
- private validateRefreshTokenBinding;
90
- private handleSseAuth;
91
- private validateCsrf;
92
- }
93
-
94
- 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>;
95
32
  type TokenExpiryString = `${number}${'s' | 'm' | 'h' | 'd' | 'w' | 'y'}`;
96
33
  interface TokenExpiry {
97
34
  access: TokenExpiryString;
98
35
  refresh: TokenExpiryString;
99
36
  }
100
- declare const getTokenExpiry: (configService: ConfigService) => TokenExpiry;
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
+ }
101
81
  declare enum TokenType {
102
82
  ACCESS = "access",
103
83
  REFRESH = "refresh"
104
84
  }
85
+ interface JwtClaims {
86
+ exp: number;
87
+ iat: number;
88
+ }
105
89
  interface AccessTokenPayload {
106
90
  sessionType: string;
107
91
  tokenType: TokenType.ACCESS;
@@ -109,21 +93,77 @@ interface AccessTokenPayload {
109
93
  sessionId: string;
110
94
  refreshTokenHash: string;
111
95
  }
96
+ type DecodedAccessToken = AccessTokenPayload & JwtClaims;
112
97
  interface RefreshTokenPayload {
113
98
  sessionType: string;
114
99
  tokenType: TokenType.REFRESH;
115
100
  userId: string;
116
101
  sessionId: string;
117
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;
118
154
 
119
- declare class JwtAuthService {
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 {
120
161
  private readonly jwtService;
121
- readonly configService: ConfigService;
162
+ private readonly config;
122
163
  private readonly logger;
123
- private readonly tokenExpiry;
124
- constructor(jwtService: JwtService, configService: ConfigService);
125
- generateAccessToken(userId: string, sessionId: string, sessionType: string, refreshToken: string): string;
126
- 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;
127
167
  sign(payload: object, options?: JwtSignOptions): string;
128
168
  verify(token: string, expectedType: TokenType): {
129
169
  userId: string;
@@ -133,6 +173,22 @@ declare class JwtAuthService {
133
173
  };
134
174
  getExpiryTime(type: TokenType): Date;
135
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;
136
192
  }
137
193
 
138
194
  declare function hashToken(token: string): string;
@@ -179,116 +235,32 @@ declare class RedisCacheProvider implements ICacheProvider, OnModuleInit, OnModu
179
235
  getMemoryInfo(): Promise<string>;
180
236
  }
181
237
 
182
- interface CookieConfig {
183
- refreshCookieName: string;
184
- refreshCookieMaxAge: number;
185
- refreshCookiePath: string;
186
- refreshCookieSecure: boolean;
187
- refreshCookieSameSite: 'strict' | 'lax' | 'none';
188
- refreshCookieDomain?: string;
189
- }
190
- interface CookieSerializeOptions {
191
- httpOnly: boolean;
192
- secure: boolean;
193
- sameSite: 'strict' | 'lax' | 'none';
194
- path: string;
195
- maxAge: number;
196
- domain: string;
197
- }
198
- interface JwtConfig {
199
- accessTokenExpiry: string;
200
- refreshTokenExpiry: string;
201
- onboardingTokenExpiry: string;
202
- }
203
- interface GuardConfig {
204
- tenantHeaderName: string;
205
- authHeaderName: string;
206
- tokenPrefix: string;
207
- }
208
- interface ApiSdkConfig {
209
- cookie?: Partial<CookieConfig>;
210
- jwt?: Partial<JwtConfig>;
211
- guard?: Partial<GuardConfig>;
212
- }
213
- interface FullConfig {
214
- cookie: CookieConfig;
215
- jwt: JwtConfig;
216
- guard: GuardConfig;
217
- }
218
- declare function defineConfig(config: ApiSdkConfig): ApiSdkConfig;
219
- declare function configureApiSdk(userConfig: ApiSdkConfig): void;
220
- declare function getConfig(): FullConfig;
221
- declare function resetConfig(): void;
222
- declare function getRefreshCookieOptions(): Omit<CookieSerializeOptions, 'domain'> & {
223
- domain?: string;
224
- };
225
- declare function getRefreshCookieOptionsForHost(hostname: string): CookieSerializeOptions;
226
- declare function getJwtExpiry(): {
227
- access: string;
228
- refresh: string;
229
- onboarding: string;
230
- };
231
-
232
- type SchemaRegistry = {};
233
- type RegisteredSchema = SchemaRegistry extends {
234
- schema: infer S;
235
- } ? S : Record<string, unknown>;
236
- type TypedDrizzleClient = NodePgDatabase<RegisteredSchema>;
237
-
238
- interface PrimaryDbConfig {
239
- host: string;
240
- port?: number;
241
- username: string;
242
- password: string;
243
- database: string;
244
- schema?: string;
245
- sslMode?: 'require' | 'prefer' | 'disable' | 'no-verify';
246
- }
247
- interface DatabaseModuleOptions {
248
- primaryDb: PrimaryDbConfig;
249
- drizzleSchema: RegisteredSchema;
250
- drizzleRelations?: Record<string, any>;
251
- connectionCacheTTL?: number;
252
- maxConnections?: number;
253
- encryptionKey?: string;
254
- }
255
-
256
- declare class DatabaseModule {
257
- static forServer(options: {
258
- useFactory: (...args: unknown[]) => Promise<DatabaseModuleOptions> | DatabaseModuleOptions;
259
- inject?: InjectionToken[];
260
- }): DynamicModule;
261
- static forMicroservice(options: {
262
- useFactory: (...args: unknown[]) => Promise<DatabaseModuleOptions> | DatabaseModuleOptions;
263
- inject?: InjectionToken[];
264
- }): DynamicModule;
265
- private static createDynamicModule;
266
- }
267
-
268
- declare const Tenant: (...dataOrPipes: unknown[]) => ParameterDecorator;
238
+ declare const DATA_TABLE_VIEWS_TABLE: unique symbol;
269
239
 
270
- declare class SelectOptionsQueryDto {
271
- search?: string;
272
- limit?: number;
273
- offset?: number;
274
- values?: string;
275
- excludeIds?: string;
276
- valueKey?: string;
277
- labelKey?: string;
278
- descriptionKey?: string;
279
- groupIdKey?: string;
240
+ interface DataTableModuleOptions {
241
+ tableViews: PgTable;
280
242
  }
281
-
282
- declare class SuccessResponseDto {
283
- success: boolean;
284
- message: string;
243
+ declare class DataTableModule {
244
+ static forRoot(options: DataTableModuleOptions): DynamicModule;
285
245
  }
286
246
 
287
- 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
+ };
288
260
  interface FilterCondition {
289
261
  field: string;
290
262
  operator: FilterOperator;
291
- value: string | number;
263
+ value: string | number | string[];
292
264
  }
293
265
  interface SortCondition {
294
266
  field: string;
@@ -314,32 +286,108 @@ interface TableViewState {
314
286
  density: DensityType;
315
287
  filterOrder: string[];
316
288
  filterVisibility: Record<string, boolean>;
317
- search?: SearchState | null;
318
- pagination?: {
289
+ search: SearchState | null;
290
+ pagination: {
319
291
  limit: number;
320
292
  offset: number;
321
293
  };
322
294
  }
323
295
 
324
- declare class TableResponseDto<T> {
325
- result: T[];
326
- count: number;
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;
327
312
  state: TableViewState;
328
- activeViewId: string | null;
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;
329
323
  }
330
324
 
331
- type FieldDefinition = {
332
- column: Column;
333
- type: 'string' | 'number' | 'boolean';
334
- } | {
335
- expression: (value: string | number) => SQL;
336
- type: 'string' | 'number' | 'boolean';
337
- };
338
- type FieldMap = Record<string, FieldDefinition>;
339
- declare class FilterProcessor {
340
- static buildWhere(filters: FilterCondition[] | undefined, fieldMap: FieldMap): SQL | undefined;
341
- static buildSearch(search: SearchState | null | undefined, fieldMap: FieldMap): SQL | undefined;
342
- static buildOrderBy(sort: SortCondition[] | undefined, fieldMap: FieldMap): SQL[];
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';
385
+ }
386
+ interface DatabaseModuleOptions {
387
+ primaryDb: PrimaryDbConfig;
388
+ drizzleRelations?: Record<string, any>;
389
+ maxConnections?: number;
390
+ applyRlsContext?: (client: PoolClient, ctx: unknown) => Promise<void>;
343
391
  }
344
392
 
345
393
  declare class PrimaryDatabaseService implements OnModuleInit, OnModuleDestroy {
@@ -347,18 +395,15 @@ declare class PrimaryDatabaseService implements OnModuleInit, OnModuleDestroy {
347
395
  private readonly logger;
348
396
  private pool;
349
397
  private db;
350
- private readonly tenantConfigCache;
351
- private readonly cacheTTL;
398
+ private readonly rlsAls;
399
+ private readonly txAls;
352
400
  constructor(options: DatabaseModuleOptions);
353
401
  onModuleInit(): Promise<void>;
354
402
  private initializeDrizzleClient;
355
- getTenantInfo(tenantIdentifier: string): Promise<TenantInfo | null>;
356
- private cacheInfo;
357
- clearTenantCache(tenantIdentifier: string): void;
358
- clearAllCaches(): void;
359
403
  get drizzleClient(): TypedDrizzleClient;
360
- get schema(): typeof this$1.options.drizzleSchema;
361
- private decrypt;
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>;
362
407
  onModuleDestroy(): Promise<void>;
363
408
  }
364
409
 
@@ -366,6 +411,7 @@ interface SelectQueryOption {
366
411
  value: string | number | boolean;
367
412
  label: string;
368
413
  description?: string;
414
+ additionals?: Record<string, string | number | boolean | null>;
369
415
  groupId?: string | number;
370
416
  }
371
417
  interface SelectQueryGroup {
@@ -387,20 +433,25 @@ interface FindForSelectConfig {
387
433
  value: string;
388
434
  label: string;
389
435
  description?: string;
390
- groupId?: string;
436
+ additionalKeys?: string | string[];
437
+ additionalExpressions?: Record<string, SQL>;
438
+ groupIdKey?: string;
391
439
  search?: string;
392
440
  limit?: number;
393
441
  offset?: number;
394
442
  where?: Record<string, unknown>;
443
+ orderByKey?: string;
444
+ orderDirection?: 'asc' | 'desc';
395
445
  orderBy?: Record<string, 'asc' | 'desc'>;
396
446
  groups?: SelectQueryGroup[];
397
447
  values?: string | (string | number | boolean)[];
398
448
  excludeIds?: string | (string | number | boolean)[];
399
449
  groupTable?: PgTable;
400
450
  groupLabelKey?: string;
401
- groupIdKey?: string;
451
+ groupTableIdKey?: string;
402
452
  joins?: FindForSelectJoin[];
403
453
  conditions?: SQL[];
454
+ distinct?: boolean;
404
455
  }
405
456
 
406
457
  type RelationsWhereFilter = Record<string, unknown>;
@@ -423,11 +474,15 @@ declare abstract class PrimaryBaseRepository<TTable extends PgTable, TInsert = I
423
474
  protected readonly database: PrimaryDatabaseService;
424
475
  protected readonly table: TTable;
425
476
  protected readonly logger: Logger;
477
+ protected readonly sequence?: PgSequence;
426
478
  private readonly tableName;
427
479
  protected get db(): TypedDrizzleClient;
428
480
  protected get model(): TypedRelationalQueryBuilder<TSelect>;
429
- constructor(database: PrimaryDatabaseService, table: TTable);
430
- create(data: TInsert): Promise<TSelect>;
481
+ constructor(database: PrimaryDatabaseService, table: TTable, options?: {
482
+ sequence?: PgSequence;
483
+ });
484
+ protected nextSequenceValue(sequence?: PgSequence): Promise<number>;
485
+ create(data: TInsert, tx?: TypedDrizzleClient): Promise<TSelect>;
431
486
  findById(id: string): Promise<TSelect | undefined>;
432
487
  findOne(where: RelationsWhereFilter): Promise<TSelect | undefined>;
433
488
  findMany(options?: {
@@ -445,88 +500,185 @@ declare abstract class PrimaryBaseRepository<TTable extends PgTable, TInsert = I
445
500
  offset?: number;
446
501
  leftJoin?: {
447
502
  table: PgTable;
448
- on: SQL;
503
+ on: SQL | undefined;
449
504
  };
505
+ leftJoins?: {
506
+ table: PgTable;
507
+ on: SQL | undefined;
508
+ }[];
509
+ groupBy?: (PgColumn | SQL)[];
450
510
  }): Promise<{
451
511
  result: TResult[];
452
512
  count: number;
453
513
  }>;
454
- update(id: string, data: Partial<TInsert>): Promise<TSelect>;
455
- updateMany(where: SQL, data: Partial<TInsert>): Promise<{
514
+ update(id: string, data: Partial<TInsert>, tx?: TypedDrizzleClient): Promise<TSelect>;
515
+ updateMany(where: SQL, data: Partial<TInsert>, tx?: TypedDrizzleClient): Promise<{
456
516
  count: number;
457
517
  }>;
458
- delete(id: string): Promise<TSelect>;
459
- deleteMany(where: SQL): Promise<{
518
+ delete(id: string, tx?: TypedDrizzleClient): Promise<TSelect>;
519
+ deleteMany(where: SQL, tx?: TypedDrizzleClient): Promise<{
460
520
  count: number;
461
521
  }>;
462
522
  count(where?: SQL): Promise<number>;
463
523
  exists(where: SQL): Promise<boolean>;
524
+ transaction<T>(callback: (tx: TypedDrizzleClient) => Promise<T>): Promise<T>;
464
525
  findForSelect(config: FindForSelectConfig): Promise<SelectQueryResult>;
465
526
  }
466
527
 
467
- declare class TenantContextService {
468
- private tenantInfo;
469
- setTenant(tenantInfo: TenantInfo): void;
470
- getTenant(): TenantInfo;
471
- hasTenant(): boolean;
472
- clearTenant(): void;
473
- getTenantIdSafe(): string | null;
474
- getTenantSubdomainSafe(): string | null;
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[]>;
475
532
  }
476
533
 
477
- declare class TenantDatabaseService implements OnModuleDestroy {
478
- private readonly options;
479
- private readonly tenantContext;
534
+ declare class DataTableViewsService {
535
+ private readonly dataTableViewsRepository;
536
+ private readonly cacheService;
537
+ private readonly configService;
480
538
  private readonly logger;
481
- private readonly clients;
482
- private readonly clientLastUsed;
483
- private cleanupInterval?;
484
- constructor(options: DatabaseModuleOptions, tenantContext: TenantContextService);
485
- get drizzleClient(): TypedDrizzleClient;
486
- get schema(): Record<string, unknown>;
487
- private getDbClient;
488
- private createDbClientSync;
489
- private buildTenantDbUrl;
490
- private buildCacheKey;
491
- private startConnectionCleaner;
492
- private cleanupIdleConnections;
493
- getPoolStats(): {
494
- activeConnections: number;
495
- tenants: string[];
496
- };
497
- private maskPassword;
498
- onModuleDestroy(): Promise<void>;
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>;
499
552
  }
500
553
 
501
- type ExtractTableName<TTable extends PgTable> = TTable['_']['name'];
502
- declare abstract class TenantBaseRepository<TTable extends PgTable, TInsert = InferInsertModel<TTable>, TSelect = InferSelectModel<TTable>> {
503
- protected readonly database: TenantDatabaseService;
504
- protected readonly table: TTable;
505
- protected readonly logger: Logger;
506
- private readonly tableName;
507
- protected get db(): TypedDrizzleClient;
508
- protected get model(): TypedDrizzleClient['query'][ExtractTableName<TTable> & keyof TypedDrizzleClient['query']];
509
- constructor(database: TenantDatabaseService, table: TTable);
510
- create(data: TInsert): Promise<TSelect>;
511
- findById(id: string): Promise<TSelect | null>;
512
- findOne(where: SQL): Promise<TSelect | null>;
513
- findMany(options?: {
514
- where?: SQL;
515
- orderBy?: SQL;
516
- limit?: number;
517
- offset?: number;
518
- }): Promise<TSelect[]>;
519
- update(id: string, data: Partial<TInsert>): Promise<TSelect>;
520
- updateMany(where: SQL, data: Partial<TInsert>): Promise<{
521
- count: number;
522
- }>;
523
- delete(id: string): Promise<TSelect>;
524
- deleteMany(where: SQL): Promise<{
525
- count: number;
526
- }>;
527
- count(where?: SQL): Promise<number>;
528
- exists(where: SQL): Promise<boolean>;
529
- findForSelect(config: FindForSelectConfig): Promise<SelectQueryResult>;
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;
530
682
  }
531
683
 
532
684
  declare class EmailModule {
@@ -543,6 +695,20 @@ declare class EmailService {
543
695
  sendPasswordResetEmail(email: string, otp: string, expiresAt: Date, displayName?: string): Promise<void>;
544
696
  sendEmailChangeNotification(oldEmail: string, newEmail: string, revertToken: string, revertExpiresAt: Date, displayName?: string): Promise<void>;
545
697
  sendEmailRevertConfirmation(email: string, displayName?: string): Promise<void>;
698
+ sendInviteEmail(params: {
699
+ to: string;
700
+ name: string;
701
+ inviteUrl: string;
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>;
546
712
  verifyConnection(): Promise<boolean>;
547
713
  private sendEmail;
548
714
  }
@@ -651,6 +817,14 @@ declare class HttpExceptionFilter implements ExceptionFilter {
651
817
  catch(exception: unknown, host: ArgumentsHost): void;
652
818
  private isHttpException;
653
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;
654
828
  }
655
829
 
656
830
  type LogLevel = 'error' | 'warn' | 'log' | 'debug' | 'verbose';
@@ -682,11 +856,11 @@ interface LoggerModuleOptions {
682
856
  interface LoggerOptionsFactory {
683
857
  createLoggerOptions(): Promise<LoggerModuleOptions> | LoggerModuleOptions;
684
858
  }
685
- interface LoggerModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
859
+ interface LoggerModuleAsyncOptions<T extends unknown[] = unknown[]> extends Pick<ModuleMetadata, 'imports'> {
686
860
  useExisting?: Type<LoggerOptionsFactory>;
687
861
  useClass?: Type<LoggerOptionsFactory>;
688
- useFactory?: (...args: unknown[]) => Promise<LoggerModuleOptions> | LoggerModuleOptions;
689
- inject?: unknown[];
862
+ useFactory?: (...args: [...T]) => Promise<LoggerModuleOptions> | LoggerModuleOptions;
863
+ inject?: InjectionToken[];
690
864
  }
691
865
  interface CorrelationContext {
692
866
  correlationId: string;
@@ -739,7 +913,7 @@ declare class HttpLoggerInterceptor implements NestInterceptor {
739
913
  declare const LOGGER_MODULE_OPTIONS: unique symbol;
740
914
  declare class LoggerModule implements NestModule {
741
915
  static forRoot(options?: LoggerModuleOptions): DynamicModule;
742
- static forRootAsync(options: LoggerModuleAsyncOptions): DynamicModule;
916
+ static forRootAsync<T extends unknown[] = unknown[]>(options: LoggerModuleAsyncOptions<T>): DynamicModule;
743
917
  configure(_consumer: MiddlewareConsumer): void;
744
918
  private static createAsyncProviders;
745
919
  private static createAsyncOptionsProvider;
@@ -765,126 +939,86 @@ declare const DEFAULT_CORRELATION_HEADER = "x-correlation-id";
765
939
  declare function generateCorrelationId(): string;
766
940
  declare function addCorrelationIdToResponse(reply: FastifyReply, correlationId: string, headerName?: string): void;
767
941
 
768
- declare class RootModule {
769
- }
770
-
771
- declare function extractCountryFromPhone(phone: string): string | undefined;
772
- declare function normalizePhoneNumber(phone: string): string;
773
-
774
- 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;
775
945
 
776
- declare const DATA_TABLE_VIEWS_TABLE: unique symbol;
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;
777
965
 
778
- interface DataTableModuleOptions {
779
- tableViews: PgTable;
966
+ type ContextResolverFn = (sessionInfo: VrittiSessionInfo) => Promise<NatsHeaders>;
967
+ interface NatsServiceConfig {
968
+ name: string;
780
969
  }
781
- declare class DataTableModule {
782
- static forRoot(options: DataTableModuleOptions): DynamicModule;
970
+ interface NatsModuleBaseOptions {
971
+ natsUrl?: string;
972
+ services: NatsServiceConfig[];
783
973
  }
784
-
785
- declare function dataTableViewsColumns(): {
786
- id: drizzle_orm.HasDefault<drizzle_orm.IsPrimaryKey<drizzle_orm_pg_core.PgUUIDBuilder>>;
787
- userId: drizzle_orm.NotNull<drizzle_orm_pg_core.PgUUIDBuilder>;
788
- tableSlug: drizzle_orm.NotNull<drizzle_orm_pg_core.PgVarcharBuilder<[string, ...string[]]>>;
789
- name: drizzle_orm.NotNull<drizzle_orm_pg_core.PgVarcharBuilder<[string, ...string[]]>>;
790
- state: drizzle_orm.$Type<drizzle_orm.NotNull<drizzle_orm_pg_core.PgJsonbBuilder>, TableViewState>;
791
- isShared: drizzle_orm.HasDefault<drizzle_orm.NotNull<drizzle_orm_pg_core.PgBooleanBuilder>>;
792
- createdAt: drizzle_orm.HasDefault<drizzle_orm.NotNull<drizzle_orm_pg_core.PgTimestampBuilder>>;
793
- updatedAt: drizzle_orm.HasDefault<drizzle_orm_pg_core.PgTimestampBuilder>;
794
- };
795
- declare function dataTableViewsIndexes(table: any): drizzle_orm_pg_core.IndexBuilder[];
796
- interface DataTableViewRecord {
797
- id: string;
798
- userId: string;
799
- tableSlug: string;
800
- name: string;
801
- state: TableViewState;
802
- isShared: boolean;
803
- createdAt: Date;
804
- updatedAt: Date | null | undefined;
974
+ interface NatsRootModuleOptions extends NatsModuleBaseOptions {
975
+ contextResolver: ContextResolverFn;
805
976
  }
806
- interface NewDataTableViewRecord {
807
- userId: string;
808
- tableSlug: string;
809
- name: string;
810
- state: TableViewState;
811
- isShared?: boolean;
977
+ interface NatsMicroserviceModuleOptions extends NatsModuleBaseOptions {
812
978
  }
813
-
814
- declare class DataTableViewDto {
815
- id: string;
816
- name: string | null;
817
- tableSlug: string;
818
- state: TableViewState;
819
- isShared: boolean;
820
- isOwn: boolean;
821
- createdAt: Date;
822
- updatedAt: Date | null;
823
- static from(view: DataTableViewRecord, userId: string): DataTableViewDto;
979
+ interface NatsRootModuleAsyncOptions {
980
+ imports?: ModuleMetadata['imports'];
981
+ inject?: InjectionToken[];
982
+ useFactory: (...args: any[]) => Promise<NatsRootModuleOptions> | NatsRootModuleOptions;
824
983
  }
825
-
826
- declare class CreateDataTableViewDto {
827
- name: string;
828
- tableSlug: string;
829
- state: TableViewState;
830
- isShared?: boolean;
984
+ interface NatsMicroserviceModuleAsyncOptions {
985
+ imports?: ModuleMetadata['imports'];
986
+ inject?: InjectionToken[];
987
+ useFactory: (...args: any[]) => Promise<NatsMicroserviceModuleOptions> | NatsMicroserviceModuleOptions;
831
988
  }
832
989
 
833
- declare class UpdateDataTableViewDto {
834
- state: TableViewState;
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;
835
997
  }
836
998
 
837
- declare class DataTableViewsRepository extends PrimaryBaseRepository<PgTable, NewDataTableViewRecord, DataTableViewRecord> {
838
- constructor(database: PrimaryDatabaseService, table: PgTable);
839
- findPersonalViewsBySlug(userId: string, tableSlug: string): Promise<DataTableViewRecord[]>;
840
- findSharedViewsBySlug(tableSlug: string): Promise<DataTableViewRecord[]>;
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>;
841
1006
  }
842
1007
 
843
- declare class DataTableViewsService {
844
- private readonly dataTableViewsRepository;
845
- private readonly cacheService;
846
- private readonly configService;
847
- private readonly logger;
848
- constructor(dataTableViewsRepository: DataTableViewsRepository, cacheService: CacheService, configService: ConfigService);
849
- private personalViewsKey;
850
- private sharedViewsKey;
851
- private get viewsTtl();
852
- private getOrCachePersonalViews;
853
- private getOrCacheSharedViews;
854
- private invalidateViewsCache;
855
- findViews(userId: string, tableSlug: string): Promise<DataTableViewDto[]>;
856
- createView(userId: string, dto: CreateDataTableViewDto): Promise<DataTableViewDto>;
857
- updateView(userId: string, id: string, dto: UpdateDataTableViewDto): Promise<DataTableViewDto>;
858
- toggleShareView(userId: string, id: string, isShared: boolean): Promise<DataTableViewDto>;
859
- renameView(userId: string, id: string, name: string): Promise<DataTableViewDto>;
860
- 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>;
861
1012
  }
862
1013
 
863
- declare class UpsertDataTableStateDto {
864
- tableSlug: string;
865
- state: TableViewState;
866
- activeViewId?: string | null;
1014
+ declare class RootModule {
867
1015
  }
868
1016
 
869
- declare class DataTableStateService {
870
- private readonly cacheService;
871
- private readonly configService;
872
- private readonly logger;
873
- constructor(cacheService: CacheService, configService: ConfigService);
874
- private get stateTtl();
875
- upsertCurrentState(userId: string, dto: UpsertDataTableStateDto): Promise<void>;
876
- getCurrentState(userId: string, tableSlug: string): Promise<{
877
- state: TableViewState;
878
- activeViewId: string | null;
879
- }>;
880
- }
1017
+ declare function gcd(a: number, b: number): number;
881
1018
 
882
- declare class RenameDataTableViewDto {
883
- name: string;
884
- }
1019
+ declare function extractCountryFromPhone(phone: string): string | undefined;
1020
+ declare function normalizePhoneNumber(phone: string): string;
885
1021
 
886
- declare class ToggleShareDataTableViewDto {
887
- isShared: boolean;
888
- }
1022
+ declare function parseExpiryToMs(expiry: string): number;
889
1023
 
890
- export { AccessToken, type AccessTokenPayload, type ApiErrorResponse, type ApiSdkConfig, AuthConfigModule, BadGatewayException, BadRequestException, CACHE_PROVIDER, CacheModule, CacheService, type ColumnPinning, ConflictException, type CookieConfig, CookieDomain, type CookieSerializeOptions, type CorrelationContext, CorrelationIdMiddleware, CreateDataTableViewDto, DATA_TABLE_VIEWS_TABLE, DEFAULT_CORRELATION_HEADER, DataTableModule, type DataTableModuleOptions, DataTableStateService, DataTableViewDto, type DataTableViewRecord, DataTableViewsService, DatabaseModule, type DatabaseModuleOptions, type DensityType, EmailModule, EmailService, type FieldDefinition, type FieldError, type FieldMap, type FilterCondition, type FilterOperator, FilterProcessor, type FindForSelectConfig, type FindForSelectJoin, ForbiddenException, GoneException, type GuardConfig, HttpExceptionFilter, HttpLoggerInterceptor, type HttpLoggerOptions, HttpProblemException, type ICacheProvider, InternalServerErrorException, JwtAuthService, type JwtConfig, LOGGER_MODULE_OPTIONS, type LogFormat, type LogLevel, type LogMetadata, LoggerModule, type LoggerModuleAsyncOptions, type LoggerModuleOptions, type LoggerOptionsFactory, LoggerService, MethodNotAllowedException, type NewDataTableViewRecord, NotAcceptableException, NotFoundException, NotImplementedException, Onboarding, PayloadTooLargeException, PrimaryBaseRepository, PrimaryDatabaseService, type PrimaryDbConfig, type ProblemDetails, type ProblemOptions, Public, RESET_KEY, RedisCacheProvider, RefreshCookieOptions, RefreshTokenCookie, type RefreshTokenPayload, type RegisteredSchema, RenameDataTableViewDto, RequestTimeoutException, Reset, RootModule, SKIP_CSRF_KEY, SelectOptionsQueryDto, type SelectQueryGroup, type SelectQueryOption, type SelectQueryResult, ServiceUnavailableException, SessionData, type SessionInfo, SkipCsrf, type SortCondition, SuccessResponseDto, TableResponseDto, type TableViewState, Tenant, TenantBaseRepository, TenantContextService, TenantDatabaseService, type TenantInfo, ToggleShareDataTableViewDto, type TokenExpiry, TokenType, TooManyRequestsException, type TypedDrizzleClient, UnauthorizedException, UnprocessableEntityException, UnsupportedMediaTypeException, UpdateDataTableViewDto, UpsertDataTableStateDto, UserId, ValidationException, VrittiAuthGuard, addCorrelationIdToResponse, configureApiSdk, correlationStorage, dataTableViewsColumns, dataTableViewsIndexes, defineConfig, extractCountryFromPhone, generateCorrelationId, getConfig, getCorrelationContext, getHttpStatusTitle, getJwtExpiry, getRefreshCookieOptions, getRefreshCookieOptionsForHost, getTokenExpiry, hashToken, jwtConfigFactory, normalizePhoneNumber, parseExpiryToMs, resetConfig, runWithCorrelationContext, updateCorrelationContext, verifyTokenHash };
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 };