@vritti/api-sdk 0.2.1 → 0.2.3

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.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as _nestjs_common from '@nestjs/common';
2
- import { DynamicModule, CanActivate, ExecutionContext, InjectionToken, OnModuleInit, OnModuleDestroy, Logger, HttpException, HttpStatus, ExceptionFilter, ArgumentsHost, ModuleMetadata, Type, LoggerService as LoggerService$1, NestInterceptor, CallHandler, NestModule, MiddlewareConsumer, NestMiddleware } 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
3
  import { ConfigService } from '@nestjs/config';
4
4
  import { Reflector } from '@nestjs/core';
5
5
  import { JwtService, JwtModuleOptions, JwtSignOptions } from '@nestjs/jwt';
6
6
  import { FastifyRequest, FastifyReply } from 'fastify';
7
7
  import { NodePgDatabase } from 'drizzle-orm/node-postgres';
8
- import { InferInsertModel, InferSelectModel, SQL } from 'drizzle-orm';
8
+ import { Column, SQL, InferInsertModel, InferSelectModel } from 'drizzle-orm';
9
9
  import { PgTable } from 'drizzle-orm/pg-core';
10
10
  import { Observable } from 'rxjs';
11
11
  import { AsyncLocalStorage } from 'node:async_hooks';
@@ -43,10 +43,14 @@ declare class AuthConfigModule {
43
43
 
44
44
  declare const AccessToken: (...dataOrPipes: unknown[]) => ParameterDecorator;
45
45
 
46
+ declare const CookieDomain: (...dataOrPipes: unknown[]) => ParameterDecorator;
47
+
46
48
  declare const Onboarding: () => _nestjs_common.CustomDecorator<string>;
47
49
 
48
50
  declare const Public: () => _nestjs_common.CustomDecorator<string>;
49
51
 
52
+ declare const RefreshCookieOptions: (...dataOrPipes: unknown[]) => ParameterDecorator;
53
+
50
54
  declare const RefreshTokenCookie: (...dataOrPipes: unknown[]) => ParameterDecorator;
51
55
 
52
56
  declare const RESET_KEY = "isReset";
@@ -135,6 +139,44 @@ declare function verifyTokenHash(token: string, expectedHash: string): boolean;
135
139
  declare const SKIP_CSRF_KEY = "skipCsrf";
136
140
  declare const SkipCsrf: () => _nestjs_common.CustomDecorator<string>;
137
141
 
142
+ declare class CacheModule {
143
+ }
144
+
145
+ interface ICacheProvider {
146
+ set<T>(key: string, value: T, ttlSeconds: number): Promise<void>;
147
+ get<T>(key: string): Promise<T | null>;
148
+ del(...keys: string[]): Promise<void>;
149
+ scanKeys(pattern: string): Promise<string[]>;
150
+ getMemoryInfo(): Promise<string>;
151
+ }
152
+
153
+ declare class CacheService {
154
+ private readonly provider;
155
+ private readonly logger;
156
+ constructor(provider: ICacheProvider);
157
+ set<T>(key: string, value: T, ttlSeconds: number): Promise<void>;
158
+ get<T>(key: string): Promise<T | null>;
159
+ del(...keys: string[]): Promise<void>;
160
+ scanKeys(pattern: string): Promise<string[]>;
161
+ getMemoryInfo(): Promise<string>;
162
+ }
163
+
164
+ declare const CACHE_PROVIDER: unique symbol;
165
+
166
+ declare class RedisCacheProvider implements ICacheProvider, OnModuleInit, OnModuleDestroy {
167
+ private readonly configService;
168
+ private readonly logger;
169
+ private client;
170
+ constructor(configService: ConfigService);
171
+ onModuleInit(): void;
172
+ onModuleDestroy(): Promise<void>;
173
+ set<T>(key: string, value: T, ttlSeconds: number): Promise<void>;
174
+ get<T>(key: string): Promise<T | null>;
175
+ del(...keys: string[]): Promise<void>;
176
+ scanKeys(pattern: string): Promise<string[]>;
177
+ getMemoryInfo(): Promise<string>;
178
+ }
179
+
138
180
  interface CookieConfig {
139
181
  refreshCookieName: string;
140
182
  refreshCookieMaxAge: number;
@@ -143,6 +185,14 @@ interface CookieConfig {
143
185
  refreshCookieSameSite: 'strict' | 'lax' | 'none';
144
186
  refreshCookieDomain?: string;
145
187
  }
188
+ interface CookieSerializeOptions {
189
+ httpOnly: boolean;
190
+ secure: boolean;
191
+ sameSite: 'strict' | 'lax' | 'none';
192
+ path: string;
193
+ maxAge: number;
194
+ domain: string;
195
+ }
146
196
  interface JwtConfig {
147
197
  accessTokenExpiry: string;
148
198
  refreshTokenExpiry: string;
@@ -167,7 +217,10 @@ declare function defineConfig(config: ApiSdkConfig): ApiSdkConfig;
167
217
  declare function configureApiSdk(userConfig: ApiSdkConfig): void;
168
218
  declare function getConfig(): FullConfig;
169
219
  declare function resetConfig(): void;
170
- declare function getRefreshCookieOptions(): Record<string, unknown>;
220
+ declare function getRefreshCookieOptions(): Omit<CookieSerializeOptions, 'domain'> & {
221
+ domain?: string;
222
+ };
223
+ declare function getRefreshCookieOptionsForHost(hostname: string): CookieSerializeOptions;
171
224
  declare function getJwtExpiry(): {
172
225
  access: string;
173
226
  refresh: string;
@@ -220,9 +273,73 @@ declare class SelectOptionsQueryDto {
220
273
  excludeIds?: string;
221
274
  valueKey?: string;
222
275
  labelKey?: string;
276
+ descriptionKey?: string;
223
277
  groupIdKey?: string;
224
278
  }
225
279
 
280
+ declare class SuccessResponseDto {
281
+ success: boolean;
282
+ message: string;
283
+ }
284
+
285
+ type FilterOperator = 'equals' | 'notEquals' | 'contains' | 'notContains' | 'gt' | 'gte' | 'lt' | 'lte';
286
+ interface FilterCondition {
287
+ field: string;
288
+ operator: FilterOperator;
289
+ value: string | number;
290
+ }
291
+ interface SortCondition {
292
+ field: string;
293
+ direction: 'asc' | 'desc';
294
+ }
295
+ type DensityType = 'compact' | 'normal' | 'comfortable';
296
+ interface ColumnPinning {
297
+ left: string[];
298
+ right: string[];
299
+ }
300
+ interface SearchState {
301
+ columnId: string;
302
+ value: string;
303
+ }
304
+ interface TableViewState {
305
+ filters: FilterCondition[];
306
+ sort: SortCondition[];
307
+ columnVisibility: Record<string, boolean>;
308
+ columnOrder: string[];
309
+ columnSizing: Record<string, number>;
310
+ columnPinning: ColumnPinning;
311
+ lockedColumnSizing: boolean;
312
+ density: DensityType;
313
+ filterOrder: string[];
314
+ filterVisibility: Record<string, boolean>;
315
+ search?: SearchState | null;
316
+ pagination?: {
317
+ limit: number;
318
+ offset: number;
319
+ };
320
+ }
321
+
322
+ declare class TableResponseDto<T> {
323
+ result: T[];
324
+ count: number;
325
+ state: TableViewState;
326
+ activeViewId: string | null;
327
+ }
328
+
329
+ type FieldDefinition = {
330
+ column: Column;
331
+ type: 'string' | 'number' | 'boolean';
332
+ } | {
333
+ expression: (value: string | number) => SQL;
334
+ type: 'string' | 'number' | 'boolean';
335
+ };
336
+ type FieldMap = Record<string, FieldDefinition>;
337
+ declare class FilterProcessor {
338
+ static buildWhere(filters: FilterCondition[] | undefined, fieldMap: FieldMap): SQL | undefined;
339
+ static buildSearch(search: SearchState | null | undefined, fieldMap: FieldMap): SQL | undefined;
340
+ static buildOrderBy(sort: SortCondition[] | undefined, fieldMap: FieldMap): SQL[];
341
+ }
342
+
226
343
  declare class PrimaryDatabaseService implements OnModuleInit, OnModuleDestroy {
227
344
  private readonly options;
228
345
  private readonly logger;
@@ -248,6 +365,7 @@ declare class PrimaryDatabaseService implements OnModuleInit, OnModuleDestroy {
248
365
  interface SelectQueryOption {
249
366
  value: string | number | boolean;
250
367
  label: string;
368
+ description?: string;
251
369
  groupId?: string | number;
252
370
  }
253
371
  interface SelectQueryGroup {
@@ -260,9 +378,15 @@ interface SelectQueryResult {
260
378
  hasMore: boolean;
261
379
  totalCount?: number;
262
380
  }
381
+ interface FindForSelectJoin {
382
+ table: PgTable;
383
+ on: SQL;
384
+ type?: 'left' | 'inner';
385
+ }
263
386
  interface FindForSelectConfig {
264
387
  value: string;
265
388
  label: string;
389
+ description?: string;
266
390
  groupId?: string;
267
391
  search?: string;
268
392
  limit?: number;
@@ -275,6 +399,8 @@ interface FindForSelectConfig {
275
399
  groupTable?: PgTable;
276
400
  groupLabelKey?: string;
277
401
  groupIdKey?: string;
402
+ joins?: FindForSelectJoin[];
403
+ conditions?: SQL[];
278
404
  }
279
405
 
280
406
  type RelationsWhereFilter = Record<string, unknown>;
@@ -310,6 +436,21 @@ declare abstract class PrimaryBaseRepository<TTable extends PgTable, TInsert = I
310
436
  limit?: number;
311
437
  offset?: number;
312
438
  }): Promise<TSelect[]>;
439
+ private buildSelectQuery;
440
+ findAllAndCount<TResult = TSelect>(options?: {
441
+ select?: Record<string, unknown>;
442
+ where?: SQL;
443
+ orderBy?: SQL[];
444
+ limit?: number;
445
+ offset?: number;
446
+ leftJoin?: {
447
+ table: PgTable;
448
+ on: SQL;
449
+ };
450
+ }): Promise<{
451
+ result: TResult[];
452
+ count: number;
453
+ }>;
313
454
  update(id: string, data: Partial<TInsert>): Promise<TSelect>;
314
455
  updateMany(where: SQL, data: Partial<TInsert>): Promise<{
315
456
  count: number;
@@ -508,6 +649,7 @@ declare function getHttpStatusTitle(status: number): string;
508
649
  declare class HttpExceptionFilter implements ExceptionFilter {
509
650
  private readonly logger;
510
651
  catch(exception: unknown, host: ArgumentsHost): void;
652
+ private isAxiosError;
511
653
  }
512
654
 
513
655
  type LogLevel = 'error' | 'warn' | 'log' | 'debug' | 'verbose';
@@ -630,4 +772,4 @@ declare function normalizePhoneNumber(phone: string): string;
630
772
 
631
773
  declare function parseExpiryToMs(expiry: string): number;
632
774
 
633
- export { AccessToken, type AccessTokenPayload, type ApiErrorResponse, type ApiSdkConfig, AuthConfigModule, BadGatewayException, BadRequestException, ConflictException, type CookieConfig, type CorrelationContext, CorrelationIdMiddleware, DEFAULT_CORRELATION_HEADER, DatabaseModule, type DatabaseModuleOptions, EmailModule, EmailService, type FieldError, type FindForSelectConfig, ForbiddenException, GoneException, type GuardConfig, HttpExceptionFilter, HttpLoggerInterceptor, type HttpLoggerOptions, HttpProblemException, InternalServerErrorException, JwtAuthService, type JwtConfig, LOGGER_MODULE_OPTIONS, type LogFormat, type LogLevel, type LogMetadata, LoggerModule, type LoggerModuleAsyncOptions, type LoggerModuleOptions, type LoggerOptionsFactory, LoggerService, MethodNotAllowedException, NotAcceptableException, NotFoundException, NotImplementedException, Onboarding, PayloadTooLargeException, PrimaryBaseRepository, PrimaryDatabaseService, type PrimaryDbConfig, type ProblemDetails, type ProblemOptions, Public, RESET_KEY, RefreshTokenCookie, type RefreshTokenPayload, type RegisteredSchema, RequestTimeoutException, Reset, RootModule, SKIP_CSRF_KEY, SelectOptionsQueryDto, type SelectQueryGroup, type SelectQueryOption, type SelectQueryResult, ServiceUnavailableException, SessionData, type SessionInfo, SkipCsrf, Tenant, TenantBaseRepository, TenantContextService, TenantDatabaseService, type TenantInfo, type TokenExpiry, TokenType, TooManyRequestsException, type TypedDrizzleClient, UnauthorizedException, UnprocessableEntityException, UnsupportedMediaTypeException, UserId, ValidationException, VrittiAuthGuard, addCorrelationIdToResponse, configureApiSdk, correlationStorage, defineConfig, extractCountryFromPhone, generateCorrelationId, getConfig, getCorrelationContext, getHttpStatusTitle, getJwtExpiry, getRefreshCookieOptions, getTokenExpiry, hashToken, jwtConfigFactory, normalizePhoneNumber, parseExpiryToMs, resetConfig, runWithCorrelationContext, updateCorrelationContext, verifyTokenHash };
775
+ 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, DEFAULT_CORRELATION_HEADER, 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, NotAcceptableException, NotFoundException, NotImplementedException, Onboarding, PayloadTooLargeException, PrimaryBaseRepository, PrimaryDatabaseService, type PrimaryDbConfig, type ProblemDetails, type ProblemOptions, Public, RESET_KEY, RedisCacheProvider, RefreshCookieOptions, RefreshTokenCookie, type RefreshTokenPayload, type RegisteredSchema, 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, type TokenExpiry, TokenType, TooManyRequestsException, type TypedDrizzleClient, UnauthorizedException, UnprocessableEntityException, UnsupportedMediaTypeException, UserId, ValidationException, VrittiAuthGuard, addCorrelationIdToResponse, configureApiSdk, correlationStorage, defineConfig, extractCountryFromPhone, generateCorrelationId, getConfig, getCorrelationContext, getHttpStatusTitle, getJwtExpiry, getRefreshCookieOptions, getRefreshCookieOptionsForHost, getTokenExpiry, hashToken, jwtConfigFactory, normalizePhoneNumber, parseExpiryToMs, resetConfig, runWithCorrelationContext, updateCorrelationContext, verifyTokenHash };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as _nestjs_common from '@nestjs/common';
2
- import { DynamicModule, CanActivate, ExecutionContext, InjectionToken, OnModuleInit, OnModuleDestroy, Logger, HttpException, HttpStatus, ExceptionFilter, ArgumentsHost, ModuleMetadata, Type, LoggerService as LoggerService$1, NestInterceptor, CallHandler, NestModule, MiddlewareConsumer, NestMiddleware } 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
3
  import { ConfigService } from '@nestjs/config';
4
4
  import { Reflector } from '@nestjs/core';
5
5
  import { JwtService, JwtModuleOptions, JwtSignOptions } from '@nestjs/jwt';
6
6
  import { FastifyRequest, FastifyReply } from 'fastify';
7
7
  import { NodePgDatabase } from 'drizzle-orm/node-postgres';
8
- import { InferInsertModel, InferSelectModel, SQL } from 'drizzle-orm';
8
+ import { Column, SQL, InferInsertModel, InferSelectModel } from 'drizzle-orm';
9
9
  import { PgTable } from 'drizzle-orm/pg-core';
10
10
  import { Observable } from 'rxjs';
11
11
  import { AsyncLocalStorage } from 'node:async_hooks';
@@ -43,10 +43,14 @@ declare class AuthConfigModule {
43
43
 
44
44
  declare const AccessToken: (...dataOrPipes: unknown[]) => ParameterDecorator;
45
45
 
46
+ declare const CookieDomain: (...dataOrPipes: unknown[]) => ParameterDecorator;
47
+
46
48
  declare const Onboarding: () => _nestjs_common.CustomDecorator<string>;
47
49
 
48
50
  declare const Public: () => _nestjs_common.CustomDecorator<string>;
49
51
 
52
+ declare const RefreshCookieOptions: (...dataOrPipes: unknown[]) => ParameterDecorator;
53
+
50
54
  declare const RefreshTokenCookie: (...dataOrPipes: unknown[]) => ParameterDecorator;
51
55
 
52
56
  declare const RESET_KEY = "isReset";
@@ -135,6 +139,44 @@ declare function verifyTokenHash(token: string, expectedHash: string): boolean;
135
139
  declare const SKIP_CSRF_KEY = "skipCsrf";
136
140
  declare const SkipCsrf: () => _nestjs_common.CustomDecorator<string>;
137
141
 
142
+ declare class CacheModule {
143
+ }
144
+
145
+ interface ICacheProvider {
146
+ set<T>(key: string, value: T, ttlSeconds: number): Promise<void>;
147
+ get<T>(key: string): Promise<T | null>;
148
+ del(...keys: string[]): Promise<void>;
149
+ scanKeys(pattern: string): Promise<string[]>;
150
+ getMemoryInfo(): Promise<string>;
151
+ }
152
+
153
+ declare class CacheService {
154
+ private readonly provider;
155
+ private readonly logger;
156
+ constructor(provider: ICacheProvider);
157
+ set<T>(key: string, value: T, ttlSeconds: number): Promise<void>;
158
+ get<T>(key: string): Promise<T | null>;
159
+ del(...keys: string[]): Promise<void>;
160
+ scanKeys(pattern: string): Promise<string[]>;
161
+ getMemoryInfo(): Promise<string>;
162
+ }
163
+
164
+ declare const CACHE_PROVIDER: unique symbol;
165
+
166
+ declare class RedisCacheProvider implements ICacheProvider, OnModuleInit, OnModuleDestroy {
167
+ private readonly configService;
168
+ private readonly logger;
169
+ private client;
170
+ constructor(configService: ConfigService);
171
+ onModuleInit(): void;
172
+ onModuleDestroy(): Promise<void>;
173
+ set<T>(key: string, value: T, ttlSeconds: number): Promise<void>;
174
+ get<T>(key: string): Promise<T | null>;
175
+ del(...keys: string[]): Promise<void>;
176
+ scanKeys(pattern: string): Promise<string[]>;
177
+ getMemoryInfo(): Promise<string>;
178
+ }
179
+
138
180
  interface CookieConfig {
139
181
  refreshCookieName: string;
140
182
  refreshCookieMaxAge: number;
@@ -143,6 +185,14 @@ interface CookieConfig {
143
185
  refreshCookieSameSite: 'strict' | 'lax' | 'none';
144
186
  refreshCookieDomain?: string;
145
187
  }
188
+ interface CookieSerializeOptions {
189
+ httpOnly: boolean;
190
+ secure: boolean;
191
+ sameSite: 'strict' | 'lax' | 'none';
192
+ path: string;
193
+ maxAge: number;
194
+ domain: string;
195
+ }
146
196
  interface JwtConfig {
147
197
  accessTokenExpiry: string;
148
198
  refreshTokenExpiry: string;
@@ -167,7 +217,10 @@ declare function defineConfig(config: ApiSdkConfig): ApiSdkConfig;
167
217
  declare function configureApiSdk(userConfig: ApiSdkConfig): void;
168
218
  declare function getConfig(): FullConfig;
169
219
  declare function resetConfig(): void;
170
- declare function getRefreshCookieOptions(): Record<string, unknown>;
220
+ declare function getRefreshCookieOptions(): Omit<CookieSerializeOptions, 'domain'> & {
221
+ domain?: string;
222
+ };
223
+ declare function getRefreshCookieOptionsForHost(hostname: string): CookieSerializeOptions;
171
224
  declare function getJwtExpiry(): {
172
225
  access: string;
173
226
  refresh: string;
@@ -220,9 +273,73 @@ declare class SelectOptionsQueryDto {
220
273
  excludeIds?: string;
221
274
  valueKey?: string;
222
275
  labelKey?: string;
276
+ descriptionKey?: string;
223
277
  groupIdKey?: string;
224
278
  }
225
279
 
280
+ declare class SuccessResponseDto {
281
+ success: boolean;
282
+ message: string;
283
+ }
284
+
285
+ type FilterOperator = 'equals' | 'notEquals' | 'contains' | 'notContains' | 'gt' | 'gte' | 'lt' | 'lte';
286
+ interface FilterCondition {
287
+ field: string;
288
+ operator: FilterOperator;
289
+ value: string | number;
290
+ }
291
+ interface SortCondition {
292
+ field: string;
293
+ direction: 'asc' | 'desc';
294
+ }
295
+ type DensityType = 'compact' | 'normal' | 'comfortable';
296
+ interface ColumnPinning {
297
+ left: string[];
298
+ right: string[];
299
+ }
300
+ interface SearchState {
301
+ columnId: string;
302
+ value: string;
303
+ }
304
+ interface TableViewState {
305
+ filters: FilterCondition[];
306
+ sort: SortCondition[];
307
+ columnVisibility: Record<string, boolean>;
308
+ columnOrder: string[];
309
+ columnSizing: Record<string, number>;
310
+ columnPinning: ColumnPinning;
311
+ lockedColumnSizing: boolean;
312
+ density: DensityType;
313
+ filterOrder: string[];
314
+ filterVisibility: Record<string, boolean>;
315
+ search?: SearchState | null;
316
+ pagination?: {
317
+ limit: number;
318
+ offset: number;
319
+ };
320
+ }
321
+
322
+ declare class TableResponseDto<T> {
323
+ result: T[];
324
+ count: number;
325
+ state: TableViewState;
326
+ activeViewId: string | null;
327
+ }
328
+
329
+ type FieldDefinition = {
330
+ column: Column;
331
+ type: 'string' | 'number' | 'boolean';
332
+ } | {
333
+ expression: (value: string | number) => SQL;
334
+ type: 'string' | 'number' | 'boolean';
335
+ };
336
+ type FieldMap = Record<string, FieldDefinition>;
337
+ declare class FilterProcessor {
338
+ static buildWhere(filters: FilterCondition[] | undefined, fieldMap: FieldMap): SQL | undefined;
339
+ static buildSearch(search: SearchState | null | undefined, fieldMap: FieldMap): SQL | undefined;
340
+ static buildOrderBy(sort: SortCondition[] | undefined, fieldMap: FieldMap): SQL[];
341
+ }
342
+
226
343
  declare class PrimaryDatabaseService implements OnModuleInit, OnModuleDestroy {
227
344
  private readonly options;
228
345
  private readonly logger;
@@ -248,6 +365,7 @@ declare class PrimaryDatabaseService implements OnModuleInit, OnModuleDestroy {
248
365
  interface SelectQueryOption {
249
366
  value: string | number | boolean;
250
367
  label: string;
368
+ description?: string;
251
369
  groupId?: string | number;
252
370
  }
253
371
  interface SelectQueryGroup {
@@ -260,9 +378,15 @@ interface SelectQueryResult {
260
378
  hasMore: boolean;
261
379
  totalCount?: number;
262
380
  }
381
+ interface FindForSelectJoin {
382
+ table: PgTable;
383
+ on: SQL;
384
+ type?: 'left' | 'inner';
385
+ }
263
386
  interface FindForSelectConfig {
264
387
  value: string;
265
388
  label: string;
389
+ description?: string;
266
390
  groupId?: string;
267
391
  search?: string;
268
392
  limit?: number;
@@ -275,6 +399,8 @@ interface FindForSelectConfig {
275
399
  groupTable?: PgTable;
276
400
  groupLabelKey?: string;
277
401
  groupIdKey?: string;
402
+ joins?: FindForSelectJoin[];
403
+ conditions?: SQL[];
278
404
  }
279
405
 
280
406
  type RelationsWhereFilter = Record<string, unknown>;
@@ -310,6 +436,21 @@ declare abstract class PrimaryBaseRepository<TTable extends PgTable, TInsert = I
310
436
  limit?: number;
311
437
  offset?: number;
312
438
  }): Promise<TSelect[]>;
439
+ private buildSelectQuery;
440
+ findAllAndCount<TResult = TSelect>(options?: {
441
+ select?: Record<string, unknown>;
442
+ where?: SQL;
443
+ orderBy?: SQL[];
444
+ limit?: number;
445
+ offset?: number;
446
+ leftJoin?: {
447
+ table: PgTable;
448
+ on: SQL;
449
+ };
450
+ }): Promise<{
451
+ result: TResult[];
452
+ count: number;
453
+ }>;
313
454
  update(id: string, data: Partial<TInsert>): Promise<TSelect>;
314
455
  updateMany(where: SQL, data: Partial<TInsert>): Promise<{
315
456
  count: number;
@@ -508,6 +649,7 @@ declare function getHttpStatusTitle(status: number): string;
508
649
  declare class HttpExceptionFilter implements ExceptionFilter {
509
650
  private readonly logger;
510
651
  catch(exception: unknown, host: ArgumentsHost): void;
652
+ private isAxiosError;
511
653
  }
512
654
 
513
655
  type LogLevel = 'error' | 'warn' | 'log' | 'debug' | 'verbose';
@@ -630,4 +772,4 @@ declare function normalizePhoneNumber(phone: string): string;
630
772
 
631
773
  declare function parseExpiryToMs(expiry: string): number;
632
774
 
633
- export { AccessToken, type AccessTokenPayload, type ApiErrorResponse, type ApiSdkConfig, AuthConfigModule, BadGatewayException, BadRequestException, ConflictException, type CookieConfig, type CorrelationContext, CorrelationIdMiddleware, DEFAULT_CORRELATION_HEADER, DatabaseModule, type DatabaseModuleOptions, EmailModule, EmailService, type FieldError, type FindForSelectConfig, ForbiddenException, GoneException, type GuardConfig, HttpExceptionFilter, HttpLoggerInterceptor, type HttpLoggerOptions, HttpProblemException, InternalServerErrorException, JwtAuthService, type JwtConfig, LOGGER_MODULE_OPTIONS, type LogFormat, type LogLevel, type LogMetadata, LoggerModule, type LoggerModuleAsyncOptions, type LoggerModuleOptions, type LoggerOptionsFactory, LoggerService, MethodNotAllowedException, NotAcceptableException, NotFoundException, NotImplementedException, Onboarding, PayloadTooLargeException, PrimaryBaseRepository, PrimaryDatabaseService, type PrimaryDbConfig, type ProblemDetails, type ProblemOptions, Public, RESET_KEY, RefreshTokenCookie, type RefreshTokenPayload, type RegisteredSchema, RequestTimeoutException, Reset, RootModule, SKIP_CSRF_KEY, SelectOptionsQueryDto, type SelectQueryGroup, type SelectQueryOption, type SelectQueryResult, ServiceUnavailableException, SessionData, type SessionInfo, SkipCsrf, Tenant, TenantBaseRepository, TenantContextService, TenantDatabaseService, type TenantInfo, type TokenExpiry, TokenType, TooManyRequestsException, type TypedDrizzleClient, UnauthorizedException, UnprocessableEntityException, UnsupportedMediaTypeException, UserId, ValidationException, VrittiAuthGuard, addCorrelationIdToResponse, configureApiSdk, correlationStorage, defineConfig, extractCountryFromPhone, generateCorrelationId, getConfig, getCorrelationContext, getHttpStatusTitle, getJwtExpiry, getRefreshCookieOptions, getTokenExpiry, hashToken, jwtConfigFactory, normalizePhoneNumber, parseExpiryToMs, resetConfig, runWithCorrelationContext, updateCorrelationContext, verifyTokenHash };
775
+ 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, DEFAULT_CORRELATION_HEADER, 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, NotAcceptableException, NotFoundException, NotImplementedException, Onboarding, PayloadTooLargeException, PrimaryBaseRepository, PrimaryDatabaseService, type PrimaryDbConfig, type ProblemDetails, type ProblemOptions, Public, RESET_KEY, RedisCacheProvider, RefreshCookieOptions, RefreshTokenCookie, type RefreshTokenPayload, type RegisteredSchema, 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, type TokenExpiry, TokenType, TooManyRequestsException, type TypedDrizzleClient, UnauthorizedException, UnprocessableEntityException, UnsupportedMediaTypeException, UserId, ValidationException, VrittiAuthGuard, addCorrelationIdToResponse, configureApiSdk, correlationStorage, defineConfig, extractCountryFromPhone, generateCorrelationId, getConfig, getCorrelationContext, getHttpStatusTitle, getJwtExpiry, getRefreshCookieOptions, getRefreshCookieOptionsForHost, getTokenExpiry, hashToken, jwtConfigFactory, normalizePhoneNumber, parseExpiryToMs, resetConfig, runWithCorrelationContext, updateCorrelationContext, verifyTokenHash };