authhero 0.196.0 → 0.197.0
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/authhero.cjs +49 -49
- package/dist/authhero.d.ts +48 -0
- package/dist/authhero.mjs +5052 -4962
- package/package.json +3 -3
package/dist/authhero.d.ts
CHANGED
|
@@ -14543,6 +14543,35 @@ export declare function parseUserId(user_id: string): {
|
|
|
14543
14543
|
connection: string;
|
|
14544
14544
|
id: string;
|
|
14545
14545
|
};
|
|
14546
|
+
export interface CacheItem<T = any> {
|
|
14547
|
+
value: T;
|
|
14548
|
+
expiresAt?: Date;
|
|
14549
|
+
}
|
|
14550
|
+
export interface CacheAdapter {
|
|
14551
|
+
/**
|
|
14552
|
+
* Get a value from the cache
|
|
14553
|
+
* @param key The cache key
|
|
14554
|
+
* @returns The cached value or null if not found or expired
|
|
14555
|
+
*/
|
|
14556
|
+
get<T = any>(key: string): Promise<T | null>;
|
|
14557
|
+
/**
|
|
14558
|
+
* Set a value in the cache
|
|
14559
|
+
* @param key The cache key
|
|
14560
|
+
* @param value The value to cache
|
|
14561
|
+
* @param ttlSeconds Time to live in seconds (optional)
|
|
14562
|
+
*/
|
|
14563
|
+
set<T = any>(key: string, value: T, ttlSeconds?: number): Promise<void>;
|
|
14564
|
+
/**
|
|
14565
|
+
* Delete a value from the cache
|
|
14566
|
+
* @param key The cache key
|
|
14567
|
+
* @returns True if the key existed and was deleted, false otherwise
|
|
14568
|
+
*/
|
|
14569
|
+
delete(key: string): Promise<boolean>;
|
|
14570
|
+
/**
|
|
14571
|
+
* Clear all items from the cache
|
|
14572
|
+
*/
|
|
14573
|
+
clear(): Promise<void>;
|
|
14574
|
+
}
|
|
14546
14575
|
export interface ListCodesResponse extends Totals {
|
|
14547
14576
|
codes: Code[];
|
|
14548
14577
|
}
|
|
@@ -14742,6 +14771,7 @@ export interface UserRolesAdapter {
|
|
|
14742
14771
|
export interface DataAdapters {
|
|
14743
14772
|
applications: ApplicationsAdapter;
|
|
14744
14773
|
branding: BrandingAdapter;
|
|
14774
|
+
cache?: CacheAdapter;
|
|
14745
14775
|
clients: ClientsAdapter;
|
|
14746
14776
|
codes: CodesAdapter;
|
|
14747
14777
|
connections: ConnectionsAdapter;
|
|
@@ -15179,6 +15209,24 @@ export interface MainTenantAdapterConfig {
|
|
|
15179
15209
|
mainTenantId?: string;
|
|
15180
15210
|
mainClientId?: string;
|
|
15181
15211
|
}
|
|
15212
|
+
export interface InMemoryCacheConfig {
|
|
15213
|
+
/**
|
|
15214
|
+
* Default TTL in seconds for cache entries (optional)
|
|
15215
|
+
*/
|
|
15216
|
+
defaultTtlSeconds?: number;
|
|
15217
|
+
/**
|
|
15218
|
+
* Maximum number of entries in the cache (optional, for basic LRU behavior)
|
|
15219
|
+
*/
|
|
15220
|
+
maxEntries?: number;
|
|
15221
|
+
/**
|
|
15222
|
+
* Interval in milliseconds for cleanup of expired entries (default: 60000ms = 1 minute)
|
|
15223
|
+
*/
|
|
15224
|
+
cleanupIntervalMs?: number;
|
|
15225
|
+
}
|
|
15226
|
+
/**
|
|
15227
|
+
* Create an in-memory cache adapter
|
|
15228
|
+
*/
|
|
15229
|
+
export declare function createInMemoryCache(config?: InMemoryCacheConfig): CacheAdapter;
|
|
15182
15230
|
/**
|
|
15183
15231
|
* Helper function to wrap data adapters with main tenant fallback functionality.
|
|
15184
15232
|
* This should be used when initializing the AuthHero application to enable
|