@plyaz/types 1.27.11 → 1.27.13

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.
@@ -890,7 +890,7 @@ export declare const OAUTH_PROVIDERS: {
890
890
  /**
891
891
  * Type for OAuth provider names
892
892
  */
893
- export type OAuthProvider = typeof OAUTH_PROVIDERS[keyof typeof OAUTH_PROVIDERS];
893
+ export type OAuthProvider = (typeof OAUTH_PROVIDERS)[keyof typeof OAUTH_PROVIDERS];
894
894
  /**
895
895
  * OAuth provider configuration interface
896
896
  */
@@ -2,4 +2,4 @@
2
2
  * Core Init Types
3
3
  * Service registry and initialization type definitions
4
4
  */
5
- export type { CoreDomainServiceInstance, CoreServiceInitConfig, CoreServiceCreateOptions, CoreInitializableDomainService, CoreServiceEntry, CoreServiceRegistryConfig, CoreExtractServiceConfig, CoreExtractServiceInstance, CoreFeatureFlagInitConfig, CoreErrorHandlerInitConfig, CoreCacheConfig, CoreObservabilityConfig, CoreStorageConfig, CoreNotificationConfig, CoreInitOptionsBase, CoreServicesResultBase, } from './types';
5
+ export type { CoreDomainServiceInstance, CoreServiceInitConfig, CoreServiceCreateOptions, CoreInitializableDomainService, CoreServiceEntry, CoreServiceRegistryConfig, CoreExtractServiceConfig, CoreExtractServiceInstance, CoreFeatureFlagInitConfig, CoreErrorHandlerInitConfig, CoreCacheConfig, CoreStorageConfig, CoreNotificationConfig, CoreObservabilityConfig, CoreInitOptionsBase, CoreServicesResultBase, } from './types';
@@ -12,9 +12,9 @@ import type { RootStoreSlice } from '../../store';
12
12
  import type { CoreAppEnvironment, CoreAppContext, CoreRuntimeEnvironment, CoreServiceRuntime } from '../modules';
13
13
  import type { CoreDbServiceConfig } from '../services';
14
14
  import type { CoreInjectedServices } from '../domain';
15
- import type { MonitoringObservabilityAdapter, MonitoringAdapterWithPriority } from '../../observability';
16
15
  import type { StorageServiceConfig } from '../../storage';
17
16
  import type { NotificationServiceConfig } from '../../notifications';
17
+ import type { MonitoringObservabilityAdapter, MonitoringAdapterWithPriority } from '../../observability';
18
18
  /**
19
19
  * Storage service configuration for Core initialization.
20
20
  * Uses the StorageServiceConfig from @plyaz/storage.
@@ -512,3 +512,117 @@ export interface CoreDbServiceConfig {
512
512
  */
513
513
  encryption?: DBEncryptionConfig;
514
514
  }
515
+ /**
516
+ * Core's DbService instance interface
517
+ * Returned by Core.db and DbService.getInstance()
518
+ */
519
+ export interface CoreDbServiceInstance {
520
+ /** Get the underlying database instance */
521
+ getDatabase(): CoreDatabaseInstance | undefined;
522
+ /** Execute a raw SQL query */
523
+ query<T = unknown>(sql: string, params?: unknown[]): Promise<T[]>;
524
+ /** Begin a transaction */
525
+ transaction<T>(fn: (tx: unknown) => Promise<T>): Promise<T>;
526
+ }
527
+ /** Core's database instance interface (from @plyaz/db) */
528
+ export interface CoreDatabaseInstance {
529
+ /** Close the database connection */
530
+ close?(): Promise<unknown>;
531
+ }
532
+ /**
533
+ * Core's CacheService instance interface
534
+ * Returned by Core.cache and CacheService.getInstance()
535
+ */
536
+ export interface CoreCacheServiceInstance {
537
+ /** Get the cache manager instance */
538
+ getCacheManager(): CoreCacheManagerInstance;
539
+ }
540
+ /**
541
+ * Core's CacheManager instance interface
542
+ * The actual cache operations interface
543
+ */
544
+ export interface CoreCacheManagerInstance {
545
+ /** Get a value from cache */
546
+ get<T>(key: string): Promise<T | null>;
547
+ /** Set a value in cache with optional TTL */
548
+ set<T>(key: string, value: T, ttl?: number): Promise<void>;
549
+ /** Delete a value from cache */
550
+ delete(key: string): Promise<void>;
551
+ /** Clear all cached values */
552
+ clear(): Promise<void>;
553
+ /** Check if key exists in cache */
554
+ has(key: string): Promise<boolean>;
555
+ }
556
+ /**
557
+ * Core's StorageService instance interface
558
+ * Returned by Core.storage and StorageService.getInstance()
559
+ */
560
+ export interface CoreStorageServiceInstance {
561
+ /** Close/cleanup the storage service */
562
+ close(): Promise<void>;
563
+ }
564
+ /**
565
+ * Core's NotificationService instance interface
566
+ * Returned by Core.notifications - wraps the actual @plyaz/notifications service
567
+ */
568
+ export interface CoreNotificationServiceInstance {
569
+ /** Close/cleanup the notification service */
570
+ close(): Promise<void>;
571
+ }
572
+ /**
573
+ * DbService class interface (static methods)
574
+ * Describes the DbService class, not an instance
575
+ */
576
+ export interface CoreDbServiceClass {
577
+ initialize(config: CoreDbServiceConfig): Promise<CoreDbServiceInstance>;
578
+ getInstance(): CoreDbServiceInstance;
579
+ createInstance?(config: CoreDbServiceConfig): Promise<CoreDbServiceInstance>;
580
+ reset?(): void;
581
+ }
582
+ /**
583
+ * CacheService class interface (static methods)
584
+ * Describes the CacheService class, not an instance
585
+ * Note: config uses unknown to avoid circular imports with init/types.ts
586
+ */
587
+ export interface CoreCacheServiceClass {
588
+ initialize(config: unknown): Promise<void>;
589
+ getInstance(): CoreCacheServiceInstance;
590
+ reset?(): void;
591
+ }
592
+ /**
593
+ * StorageService class interface (static methods)
594
+ * Describes the StorageService class, not an instance
595
+ * Note: config uses unknown to avoid circular imports with init/types.ts
596
+ */
597
+ export interface CoreStorageServiceClass {
598
+ initialize(config: unknown): Promise<void>;
599
+ getInstance(): CoreStorageServiceInstance;
600
+ createInstance?(config: unknown): Promise<CoreStorageServiceInstance>;
601
+ reset?(): Promise<void>;
602
+ }
603
+ /**
604
+ * NotificationService class interface (static methods)
605
+ * Describes the NotificationService class, not an instance
606
+ * Note: config uses unknown to avoid circular imports with init/types.ts
607
+ */
608
+ export interface CoreNotificationServiceClass {
609
+ initialize(config: unknown): Promise<void>;
610
+ getInstance(): CoreNotificationServiceInstance;
611
+ createInstance?(config: unknown): Promise<CoreNotificationServiceInstance>;
612
+ reset?(): Promise<void>;
613
+ }
614
+ /**
615
+ * ServerErrorMiddleware module interface
616
+ * Describes the exports from @plyaz/errors/middleware/backend
617
+ */
618
+ export interface CoreServerErrorMiddlewareModule {
619
+ createErrorStore(config: {
620
+ packageName: string;
621
+ serviceName?: string;
622
+ }): unknown;
623
+ createHttpErrorHandler(config: unknown): unknown;
624
+ createNestJsExceptionFilter(config: unknown): unknown;
625
+ withErrorHandler<T extends (...args: unknown[]) => unknown>(handler: T, config?: unknown): T;
626
+ createNextApiErrorHandler(config: unknown): unknown;
627
+ handleNodeError(error: unknown, req: unknown, res: unknown, config?: unknown): void;
628
+ }