@plyaz/types 1.19.3 → 1.19.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.cjs +29 -0
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.js +29 -0
- package/dist/api/index.js.map +1 -1
- package/dist/core/auth/types.d.ts +1 -1
- package/dist/core/domain/index.d.ts +5 -0
- package/dist/core/domain/types.d.ts +123 -0
- package/dist/core/events/enums.d.ts +25 -1
- package/dist/core/events/index.d.ts +3 -3
- package/dist/core/events/payloads.d.ts +80 -1
- package/dist/core/featureFlag/types.d.ts +37 -17
- package/dist/core/frontend/featureFlags.d.ts +106 -0
- package/dist/core/frontend/index.d.ts +6 -0
- package/dist/core/frontend/types.d.ts +318 -0
- package/dist/core/index.d.ts +6 -2
- package/dist/core/init/index.d.ts +5 -0
- package/dist/core/init/types.d.ts +347 -0
- package/dist/core/modules.d.ts +19 -3
- package/dist/core/services/index.d.ts +5 -0
- package/dist/core/{services.d.ts → services/types.d.ts} +74 -6
- package/dist/errors/codes.d.ts +3 -0
- package/dist/errors/index.cjs +29 -0
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +29 -0
- package/dist/errors/index.js.map +1 -1
- package/dist/errors/middleware.d.ts +105 -0
- package/dist/errors/store.d.ts +140 -0
- package/dist/examples/index.d.ts +1 -1
- package/dist/examples/types.d.ts +64 -0
- package/dist/features/feature-flag/dto.types.d.ts +67 -0
- package/dist/features/feature-flag/index.d.ts +3 -0
- package/dist/features/feature-flag/service.types.d.ts +184 -0
- package/dist/features/feature-flag/store.types.d.ts +166 -0
- package/dist/features/feature-flag/types.d.ts +16 -4
- package/dist/globals.d.ts +23 -0
- package/dist/index.cjs +49 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +49 -1
- package/dist/index.js.map +1 -1
- package/dist/store/index.cjs +13 -0
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.js +11 -0
- package/dist/store/index.js.map +1 -1
- package/dist/store/keys.d.ts +23 -0
- package/dist/store/types.d.ts +62 -71
- package/dist/testing/features/feature-flags/types.d.ts +3 -3
- package/package.json +6 -3
package/dist/core/modules.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { DatabaseServiceInterface } from '../db/databaseService';
|
|
8
8
|
import type { HttpMethod } from '../api/config/types';
|
|
9
|
+
import type { Type, DynamicModule, ForwardReference, InjectionToken, OptionalFactoryDependency, ModuleMetadata } from '@nestjs/common';
|
|
9
10
|
export type { HttpMethod };
|
|
10
11
|
/**
|
|
11
12
|
* Core services available to modules
|
|
@@ -352,14 +353,29 @@ export interface CoreNestJsModuleOptions {
|
|
|
352
353
|
isGlobal?: boolean;
|
|
353
354
|
}
|
|
354
355
|
/**
|
|
355
|
-
* Async options for NestJS CoreModule
|
|
356
|
+
* Async options for NestJS CoreModule (adapters/nestjs.ts pattern)
|
|
357
|
+
* Uses NestJS-specific types for proper DI integration.
|
|
356
358
|
*/
|
|
357
359
|
export interface CoreNestJsModuleAsyncOptions {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
+
/** Modules to import for dependency resolution */
|
|
361
|
+
imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
362
|
+
/** Tokens to inject into the factory */
|
|
363
|
+
inject?: Array<InjectionToken | OptionalFactoryDependency>;
|
|
364
|
+
/** Factory function to create module options */
|
|
360
365
|
useFactory: (...args: unknown[]) => CoreNestJsModuleOptions | Promise<CoreNestJsModuleOptions>;
|
|
366
|
+
/** Whether to make Core services globally available */
|
|
361
367
|
isGlobal?: boolean;
|
|
362
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* Async options for NestJS CoreModule (init/nestjs pattern)
|
|
371
|
+
* Extends ModuleMetadata for full NestJS integration.
|
|
372
|
+
*/
|
|
373
|
+
export interface CoreNestJsCoreModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
|
374
|
+
/** Factory function to create init options */
|
|
375
|
+
useFactory: (...args: unknown[]) => CoreInitOptions | Promise<CoreInitOptions>;
|
|
376
|
+
/** Tokens to inject into the factory */
|
|
377
|
+
inject?: Array<Type<unknown> | string | symbol>;
|
|
378
|
+
}
|
|
363
379
|
/**
|
|
364
380
|
* Application context type
|
|
365
381
|
*
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Core Services Types
|
|
3
|
+
* Type definitions for @plyaz/core services
|
|
4
4
|
*/
|
|
5
|
+
import type { DrizzleConfig, SupabaseConfig, SqlConfig, SoftDeleteConfig, DBCacheConfig, AuditConfig, DBEncryptionConfig } from '../../db';
|
|
5
6
|
import type { ReactNode } from 'react';
|
|
6
|
-
import type { ApiClientOptions } from '
|
|
7
|
+
import type { ApiClientOptions } from '../../api/client';
|
|
8
|
+
/**
|
|
9
|
+
|
|
7
10
|
/**
|
|
8
11
|
* Environment configuration for API client initialization
|
|
9
12
|
*
|
|
@@ -77,7 +80,7 @@ import type { ApiClientOptions } from '../api/client';
|
|
|
77
80
|
* @see ServiceOptions from @plyaz/types/api - For per-request configuration overrides
|
|
78
81
|
* @since 1.1.0
|
|
79
82
|
*/
|
|
80
|
-
export interface
|
|
83
|
+
export interface CoreApiEnvironmentConfig {
|
|
81
84
|
/**
|
|
82
85
|
* Environment name - determines which default configuration to apply
|
|
83
86
|
*
|
|
@@ -333,7 +336,7 @@ export interface ApiEnvironmentConfig {
|
|
|
333
336
|
* @see {@link ApiClientOptions} from @plyaz/types/api - Full API configuration options
|
|
334
337
|
* @since 1.1.0
|
|
335
338
|
*/
|
|
336
|
-
export interface
|
|
339
|
+
export interface CoreApiProviderProps {
|
|
337
340
|
/**
|
|
338
341
|
* React children to render after successful initialization
|
|
339
342
|
*
|
|
@@ -349,7 +352,7 @@ export interface ApiProviderProps {
|
|
|
349
352
|
*
|
|
350
353
|
* @see {@link ApiEnvironmentConfig} - Full configuration options
|
|
351
354
|
*/
|
|
352
|
-
envConfig:
|
|
355
|
+
envConfig: CoreApiEnvironmentConfig;
|
|
353
356
|
/**
|
|
354
357
|
* API configuration
|
|
355
358
|
*
|
|
@@ -444,3 +447,68 @@ export interface ApiProviderProps {
|
|
|
444
447
|
*/
|
|
445
448
|
onError?: (error: Error) => void;
|
|
446
449
|
}
|
|
450
|
+
/**
|
|
451
|
+
* Configuration options for DbService initialization
|
|
452
|
+
*
|
|
453
|
+
* Uses types from @plyaz/types/db for consistency across packages.
|
|
454
|
+
*/
|
|
455
|
+
export interface CoreDbServiceConfig {
|
|
456
|
+
/**
|
|
457
|
+
* Database adapter type
|
|
458
|
+
* - 'drizzle': Direct PostgreSQL connection (recommended for performance)
|
|
459
|
+
* - 'supabase': Supabase REST API (RLS enforced)
|
|
460
|
+
* - 'sql': Raw SQL adapter
|
|
461
|
+
* @default 'drizzle'
|
|
462
|
+
*/
|
|
463
|
+
adapter?: 'drizzle' | 'supabase' | 'sql';
|
|
464
|
+
/** Drizzle adapter configuration (required when adapter='drizzle') */
|
|
465
|
+
drizzle?: DrizzleConfig;
|
|
466
|
+
/** Supabase adapter configuration (required when adapter='supabase') */
|
|
467
|
+
supabase?: SupabaseConfig;
|
|
468
|
+
/** SQL adapter configuration (required when adapter='sql') */
|
|
469
|
+
sql?: SqlConfig;
|
|
470
|
+
/**
|
|
471
|
+
* Additional named adapters for multi-database support
|
|
472
|
+
* Allows using different adapters for specific queries or repositories
|
|
473
|
+
* @example
|
|
474
|
+
* ```typescript
|
|
475
|
+
* adapters: {
|
|
476
|
+
* analytics: {
|
|
477
|
+
* adapter: 'sql',
|
|
478
|
+
* sql: { connectionString: process.env.ANALYTICS_DB_URL }
|
|
479
|
+
* },
|
|
480
|
+
* cache: {
|
|
481
|
+
* adapter: 'drizzle',
|
|
482
|
+
* drizzle: { connectionString: process.env.CACHE_DB_URL }
|
|
483
|
+
* }
|
|
484
|
+
* }
|
|
485
|
+
* // Usage:
|
|
486
|
+
* await db.query('SELECT * FROM events', { adapter: 'analytics' });
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
adapters?: Record<string, {
|
|
490
|
+
adapter: 'drizzle' | 'supabase' | 'sql';
|
|
491
|
+
drizzle?: DrizzleConfig;
|
|
492
|
+
supabase?: SupabaseConfig;
|
|
493
|
+
sql?: SqlConfig;
|
|
494
|
+
}>;
|
|
495
|
+
/** Soft delete extension configuration */
|
|
496
|
+
softDelete?: SoftDeleteConfig;
|
|
497
|
+
/** Cache extension configuration */
|
|
498
|
+
cache?: DBCacheConfig;
|
|
499
|
+
/** Audit extension configuration */
|
|
500
|
+
audit?: AuditConfig;
|
|
501
|
+
/**
|
|
502
|
+
* Encryption extension configuration
|
|
503
|
+
* Requires ENCRYPTION_KEY env var or explicit key in config (32 bytes for AES-256)
|
|
504
|
+
* @example
|
|
505
|
+
* ```typescript
|
|
506
|
+
* encryption: {
|
|
507
|
+
* enabled: true,
|
|
508
|
+
* key: process.env.ENCRYPTION_KEY!,
|
|
509
|
+
* fields: DEFAULT_ENCRYPTION_FIELDS
|
|
510
|
+
* }
|
|
511
|
+
* ```
|
|
512
|
+
*/
|
|
513
|
+
encryption?: DBEncryptionConfig;
|
|
514
|
+
}
|
package/dist/errors/codes.d.ts
CHANGED
|
@@ -295,6 +295,9 @@ export declare const ERROR_CODES: {
|
|
|
295
295
|
readonly ERROR_SYSTEM_NOT_INITIALIZED: "error.system.not.initialized";
|
|
296
296
|
readonly EVENT_FACTORY_NOT_REGISTERED: "error.event.factory.not.registered";
|
|
297
297
|
readonly DATABASE_ERROR: "error.database";
|
|
298
|
+
readonly UNCAUGHT_EXCEPTION: "error.uncaught.exception";
|
|
299
|
+
readonly UNHANDLED_REJECTION: "error.unhandled.rejection";
|
|
300
|
+
readonly RUNTIME_ERROR: "error.runtime";
|
|
298
301
|
readonly DB_ACCESS_DENIED: "db.access_denied";
|
|
299
302
|
readonly DB_CONFIG_REQUIRED: "db.config_required";
|
|
300
303
|
readonly DB_CONNECT_FAILED: "db.connect_failed";
|
package/dist/errors/index.cjs
CHANGED
|
@@ -733,6 +733,10 @@ var ERROR_CODES = {
|
|
|
733
733
|
ERROR_SYSTEM_NOT_INITIALIZED: "error.system.not.initialized",
|
|
734
734
|
EVENT_FACTORY_NOT_REGISTERED: "error.event.factory.not.registered",
|
|
735
735
|
DATABASE_ERROR: "error.database",
|
|
736
|
+
// Global Error Handler
|
|
737
|
+
UNCAUGHT_EXCEPTION: "error.uncaught.exception",
|
|
738
|
+
UNHANDLED_REJECTION: "error.unhandled.rejection",
|
|
739
|
+
RUNTIME_ERROR: "error.runtime",
|
|
736
740
|
// ===== Database Errors =====
|
|
737
741
|
// Connection & Configuration
|
|
738
742
|
DB_ACCESS_DENIED: "db.access_denied",
|
|
@@ -3873,6 +3877,31 @@ var ERROR_DEFINITIONS = {
|
|
|
3873
3877
|
retryable: false,
|
|
3874
3878
|
userMessage: "errors.database"
|
|
3875
3879
|
},
|
|
3880
|
+
// Global Error Handler
|
|
3881
|
+
[ERROR_CODES.UNCAUGHT_EXCEPTION]: {
|
|
3882
|
+
code: ERROR_CODES.UNCAUGHT_EXCEPTION,
|
|
3883
|
+
status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
3884
|
+
category: ERROR_CATEGORY.System,
|
|
3885
|
+
severity: ERROR_SEVERITY.Critical,
|
|
3886
|
+
retryable: false,
|
|
3887
|
+
userMessage: "errors.uncaught.exception"
|
|
3888
|
+
},
|
|
3889
|
+
[ERROR_CODES.UNHANDLED_REJECTION]: {
|
|
3890
|
+
code: ERROR_CODES.UNHANDLED_REJECTION,
|
|
3891
|
+
status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
3892
|
+
category: ERROR_CATEGORY.System,
|
|
3893
|
+
severity: ERROR_SEVERITY.Critical,
|
|
3894
|
+
retryable: false,
|
|
3895
|
+
userMessage: "errors.unhandled.rejection"
|
|
3896
|
+
},
|
|
3897
|
+
[ERROR_CODES.RUNTIME_ERROR]: {
|
|
3898
|
+
code: ERROR_CODES.RUNTIME_ERROR,
|
|
3899
|
+
status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
3900
|
+
category: ERROR_CATEGORY.System,
|
|
3901
|
+
severity: ERROR_SEVERITY.High,
|
|
3902
|
+
retryable: false,
|
|
3903
|
+
userMessage: "errors.runtime"
|
|
3904
|
+
},
|
|
3876
3905
|
// ===== Database Error Definitions =====
|
|
3877
3906
|
// Connection & Configuration
|
|
3878
3907
|
[ERROR_CODES.DB_ACCESS_DENIED]: {
|