@plyaz/types 1.27.11 → 1.27.12
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.
|
@@ -512,3 +512,60 @@ 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
|
+
}
|
package/package.json
CHANGED