@playcademy/sdk 0.0.1-beta.8 → 0.0.1
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/README.md +511 -124
- package/dist/core/auth/flows/popup.d.ts +14 -0
- package/dist/core/auth/flows/redirect.d.ts +15 -0
- package/dist/core/auth/flows/unified.d.ts +11 -0
- package/dist/core/auth/login.d.ts +20 -0
- package/dist/core/auth/oauth.d.ts +115 -0
- package/dist/core/auth/utils.d.ts +23 -0
- package/dist/core/cache/cooldown-cache.d.ts +31 -0
- package/dist/core/cache/index.d.ts +14 -0
- package/dist/core/cache/permanent-cache.d.ts +39 -0
- package/dist/core/cache/singleton-cache.d.ts +29 -0
- package/dist/core/cache/ttl-cache.d.ts +54 -0
- package/dist/core/cache/types.d.ts +23 -0
- package/dist/core/client.d.ts +444 -68
- package/dist/core/namespaces/achievements.d.ts +84 -0
- package/dist/core/namespaces/admin.d.ts +385 -0
- package/dist/core/namespaces/auth.d.ts +54 -0
- package/dist/core/namespaces/character.d.ts +205 -0
- package/dist/core/namespaces/credits.d.ts +51 -0
- package/dist/core/namespaces/dev.d.ts +323 -0
- package/dist/core/namespaces/games.d.ts +173 -0
- package/dist/core/namespaces/identity.d.ts +91 -0
- package/dist/core/namespaces/index.d.ts +19 -0
- package/dist/core/namespaces/leaderboard.d.ts +48 -0
- package/dist/core/namespaces/levels.d.ts +90 -0
- package/dist/core/namespaces/maps.d.ts +93 -0
- package/dist/core/namespaces/realtime.client.d.ts +129 -0
- package/dist/core/namespaces/realtime.d.ts +90 -0
- package/dist/core/namespaces/runtime.d.ts +222 -0
- package/dist/core/namespaces/scores.d.ts +55 -0
- package/dist/core/namespaces/shop.d.ts +25 -0
- package/dist/core/namespaces/sprites.d.ts +35 -0
- package/dist/core/namespaces/telemetry.d.ts +28 -0
- package/dist/core/namespaces/timeback.d.ts +111 -0
- package/dist/core/namespaces/users.d.ts +172 -0
- package/dist/core/request.d.ts +1 -1
- package/dist/core/static/identity.d.ts +37 -0
- package/dist/core/static/index.d.ts +3 -0
- package/dist/core/static/init.d.ts +21 -0
- package/dist/core/static/login.d.ts +34 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +2846 -0
- package/dist/messaging.d.ts +544 -0
- package/dist/types.d.ts +168 -8
- package/dist/types.js +748 -0
- package/package.json +18 -11
- package/dist/bus.d.ts +0 -37
- package/dist/runtime.d.ts +0 -7
- package/dist/runtime.js +0 -363
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AuthOptions, AuthResult } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Popup-based OAuth flow implementation.
|
|
4
|
+
* Used primarily for iframe contexts where redirects don't work.
|
|
5
|
+
* With server-first architecture, the server handles token exchange.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Initiates a popup-based OAuth flow.
|
|
9
|
+
* Opens auth URL in popup and waits for server callback message.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Authentication options
|
|
12
|
+
* @returns Promise resolving to the authentication result
|
|
13
|
+
*/
|
|
14
|
+
export declare function initiatePopupFlow(options: AuthOptions): Promise<AuthResult>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AuthOptions, AuthResult } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Redirect-based OAuth flow implementation.
|
|
4
|
+
* Used for standalone applications where traditional OAuth redirects work.
|
|
5
|
+
* With server-first architecture, the server handles token exchange.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Initiates a redirect-based OAuth flow.
|
|
9
|
+
* This will navigate away from the current page to the IdP.
|
|
10
|
+
* The server callback will handle token exchange and redirect back.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Authentication options
|
|
13
|
+
* @returns Promise that never resolves (page navigates away)
|
|
14
|
+
*/
|
|
15
|
+
export declare function initiateRedirectFlow(options: AuthOptions): Promise<AuthResult>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified authentication flow router for server-first architecture.
|
|
3
|
+
* Routes to appropriate flow implementation based on mode.
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthOptions, AuthResult } from '../../../types';
|
|
6
|
+
/**
|
|
7
|
+
* Routes authentication request to the appropriate flow.
|
|
8
|
+
* With server-first architecture, all flows end up at the same
|
|
9
|
+
* server callback which handles token exchange.
|
|
10
|
+
*/
|
|
11
|
+
export declare function initiateUnifiedFlow(options: AuthOptions): Promise<AuthResult>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main login implementation for the Playcademy SDK.
|
|
3
|
+
* Uses server-first architecture where the server handles token exchange.
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthOptions, AuthResult, PlaycademyClient } from '../../types';
|
|
6
|
+
/**
|
|
7
|
+
* Performs OAuth login with the specified provider.
|
|
8
|
+
*
|
|
9
|
+
* With server-first architecture:
|
|
10
|
+
* 1. SDK initiates OAuth flow (popup or redirect)
|
|
11
|
+
* 2. IdP redirects to your server callback URL
|
|
12
|
+
* 3. Your server exchanges code for tokens
|
|
13
|
+
* 4. Your server returns HTML that completes the flow
|
|
14
|
+
* 5. SDK receives the user data via postMessage (popup) or cookie (redirect)
|
|
15
|
+
*
|
|
16
|
+
* @param client - The PlaycademyClient instance
|
|
17
|
+
* @param options - Authentication options including callback URL
|
|
18
|
+
* @returns Promise resolving to the authentication result
|
|
19
|
+
*/
|
|
20
|
+
export declare function login(client: PlaycademyClient, options: AuthOptions): Promise<AuthResult>;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth 2.0 implementation for the Playcademy SDK
|
|
3
|
+
*/
|
|
4
|
+
import type { AuthProviderType } from '../../types';
|
|
5
|
+
/**
|
|
6
|
+
* OAuth provider configuration
|
|
7
|
+
*/
|
|
8
|
+
export interface OAuthConfig {
|
|
9
|
+
authorizationEndpoint: string;
|
|
10
|
+
tokenEndpoint: string;
|
|
11
|
+
clientId: string;
|
|
12
|
+
scope?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* OAuth configuration for different providers
|
|
16
|
+
*/
|
|
17
|
+
export declare const OAUTH_CONFIGS: Record<string, () => Partial<OAuthConfig>>;
|
|
18
|
+
/**
|
|
19
|
+
* OAuth state that needs to be maintained during the flow
|
|
20
|
+
*/
|
|
21
|
+
export interface OAuthState {
|
|
22
|
+
/** Random state parameter for CSRF protection */
|
|
23
|
+
state: string;
|
|
24
|
+
/** PKCE code verifier */
|
|
25
|
+
codeVerifier?: string;
|
|
26
|
+
/** Timestamp when the state was created */
|
|
27
|
+
createdAt: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* OAuth callback parameters from the authorization server
|
|
31
|
+
*/
|
|
32
|
+
export interface OAuthCallbackParams {
|
|
33
|
+
code?: string;
|
|
34
|
+
state?: string;
|
|
35
|
+
error?: string;
|
|
36
|
+
error_description?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Generates a cryptographically secure random state parameter for OAuth.
|
|
40
|
+
* Used to prevent CSRF attacks during the OAuth flow.
|
|
41
|
+
* Can optionally include encoded data like user ID for server-side association.
|
|
42
|
+
*
|
|
43
|
+
* @param data - Optional data to encode (e.g., { playcademy_user_id: "123" })
|
|
44
|
+
* @returns A random state string, optionally with encoded data
|
|
45
|
+
*/
|
|
46
|
+
export declare function generateOAuthState(data?: Record<string, string>): Promise<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Parses an OAuth state parameter to extract CSRF token and any encoded data.
|
|
49
|
+
*
|
|
50
|
+
* @param state - The OAuth state parameter to parse
|
|
51
|
+
* @returns Object containing CSRF token and optional decoded data
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseOAuthState(state: string): {
|
|
54
|
+
csrfToken: string;
|
|
55
|
+
data?: Record<string, string>;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Generates a code verifier for PKCE (Proof Key for Code Exchange).
|
|
59
|
+
*
|
|
60
|
+
* @returns A random code verifier string
|
|
61
|
+
*/
|
|
62
|
+
export declare function generateCodeVerifier(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Generates a code challenge from a code verifier for PKCE.
|
|
65
|
+
*
|
|
66
|
+
* @param verifier - The code verifier
|
|
67
|
+
* @returns Promise resolving to the code challenge
|
|
68
|
+
*/
|
|
69
|
+
export declare function generateCodeChallenge(verifier: string): Promise<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Builds the OAuth authorization URL with all required parameters.
|
|
72
|
+
*
|
|
73
|
+
* @param params - OAuth parameters
|
|
74
|
+
* @returns The complete authorization URL
|
|
75
|
+
*/
|
|
76
|
+
export declare function buildAuthorizationUrl(params: {
|
|
77
|
+
authorizationEndpoint: string;
|
|
78
|
+
clientId: string;
|
|
79
|
+
redirectUri: string;
|
|
80
|
+
state: string;
|
|
81
|
+
codeChallenge?: string;
|
|
82
|
+
scope?: string;
|
|
83
|
+
responseType?: string;
|
|
84
|
+
}): string;
|
|
85
|
+
/**
|
|
86
|
+
* Parses OAuth callback parameters from a URL.
|
|
87
|
+
*
|
|
88
|
+
* @param url - The callback URL
|
|
89
|
+
* @returns The parsed parameters
|
|
90
|
+
*/
|
|
91
|
+
export declare function parseCallbackUrl(url: string): OAuthCallbackParams;
|
|
92
|
+
/**
|
|
93
|
+
* Validates OAuth callback parameters against the expected state.
|
|
94
|
+
*
|
|
95
|
+
* @param params - The callback parameters
|
|
96
|
+
* @param expectedState - The expected state value
|
|
97
|
+
* @returns True if valid, throws otherwise
|
|
98
|
+
*/
|
|
99
|
+
export declare function validateCallbackParams(params: OAuthCallbackParams, expectedState: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Gets the default OAuth configuration for a provider.
|
|
102
|
+
*
|
|
103
|
+
* @param provider - The auth provider
|
|
104
|
+
* @returns The partial OAuth configuration (may not include clientId)
|
|
105
|
+
* @throws Error if provider is unknown
|
|
106
|
+
*/
|
|
107
|
+
export declare function getOAuthConfig(provider: AuthProviderType): Partial<OAuthConfig>;
|
|
108
|
+
/**
|
|
109
|
+
* Gets the redirect URI for OAuth callback.
|
|
110
|
+
*
|
|
111
|
+
* @param customUri - Custom redirect URI provided by the user
|
|
112
|
+
* @param isPopup - Whether this is for a popup flow (only used if no custom URI)
|
|
113
|
+
* @returns The redirect URI
|
|
114
|
+
*/
|
|
115
|
+
export declare function getRedirectUri(customUri?: string, isPopup?: boolean): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opens a popup window with specific dimensions and features.
|
|
3
|
+
*
|
|
4
|
+
* @param url - The URL to open
|
|
5
|
+
* @param name - The window name
|
|
6
|
+
* @returns The opened window or null if blocked
|
|
7
|
+
*/
|
|
8
|
+
export declare function openPopupWindow(url: string, name?: string, width?: number, height?: number): Window | null;
|
|
9
|
+
/**
|
|
10
|
+
* Detects if we're running in an iframe context.
|
|
11
|
+
* Safe to call in any environment (browser or Node.js).
|
|
12
|
+
*
|
|
13
|
+
* @returns True if in iframe, false if standalone or not in browser
|
|
14
|
+
*/
|
|
15
|
+
export declare function isInIframe(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a promise that resolves when a message is received from a window.
|
|
18
|
+
*
|
|
19
|
+
* @param targetWindow - The window to listen for messages from
|
|
20
|
+
* @param timeout - Timeout in milliseconds
|
|
21
|
+
* @returns Promise that resolves with the message data
|
|
22
|
+
*/
|
|
23
|
+
export declare function waitForWindowMessage<T>(targetWindow: Window, timeout?: number): Promise<T>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CooldownCacheConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a cooldown-based cache that prevents rapid repeated calls.
|
|
4
|
+
* Unlike TTL cache, this always fetches fresh data but enforces a minimum
|
|
5
|
+
* time between requests. Cooldown can be configured both at creation time
|
|
6
|
+
* (default) and at runtime (per-call).
|
|
7
|
+
*
|
|
8
|
+
* @param defaultCooldownMs - Default minimum milliseconds between requests
|
|
9
|
+
* @returns Cache instance with get and clear methods
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const cache = createCooldownCache<LevelProgress>(5000) // Default: 5 second cooldown
|
|
14
|
+
*
|
|
15
|
+
* // Use default cooldown
|
|
16
|
+
* const progress1 = await cache.get('user-progress', () => fetchProgress())
|
|
17
|
+
*
|
|
18
|
+
* // Override with custom cooldown for this call
|
|
19
|
+
* const progress2 = await cache.get('user-progress', () => fetchProgress(), { cooldown: 1000 })
|
|
20
|
+
*
|
|
21
|
+
* // Force refresh bypassing cooldown
|
|
22
|
+
* const fresh = await cache.get('user-progress', () => fetchProgress(), { force: true })
|
|
23
|
+
*
|
|
24
|
+
* // Disable cooldown for this call (cooldown: 0)
|
|
25
|
+
* const immediate = await cache.get('user-progress', () => fetchProgress(), { cooldown: 0 })
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function createCooldownCache<T>(defaultCooldownMs: number): {
|
|
29
|
+
get: (key: string, loader: () => Promise<T>, config?: CooldownCacheConfig) => Promise<T>;
|
|
30
|
+
clear: (key?: string) => void;
|
|
31
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache utilities for the Playcademy SDK
|
|
3
|
+
*
|
|
4
|
+
* Available cache types:
|
|
5
|
+
* - TTL Cache: Time-based expiration with management capabilities (e.g., 60 seconds for games list)
|
|
6
|
+
* - Cooldown Cache: Minimum time between requests (e.g., 5 seconds for level progress)
|
|
7
|
+
* - Singleton Cache: Single value, no keys (e.g., THE credits item ID)
|
|
8
|
+
* - Permanent Cache: Multiple values with keys, never expire (e.g., item ID resolutions)
|
|
9
|
+
*/
|
|
10
|
+
export { createTTLCache } from './ttl-cache';
|
|
11
|
+
export type { TTLCacheOptions } from './ttl-cache';
|
|
12
|
+
export { createCooldownCache } from './cooldown-cache';
|
|
13
|
+
export { createSingletonCache } from './singleton-cache';
|
|
14
|
+
export { createPermanentCache } from './permanent-cache';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a permanent KV cache that stores multiple values indefinitely.
|
|
3
|
+
* Values are cached by key until explicitly cleared.
|
|
4
|
+
*
|
|
5
|
+
* This is a key-value cache - it can store many different values accessed by keys.
|
|
6
|
+
* If you only need to cache ONE value total, use SingletonCache instead.
|
|
7
|
+
*
|
|
8
|
+
* @param keyPrefix - Optional prefix for cache keys
|
|
9
|
+
* @returns Cache instance with get, clear, has, and size methods
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Perfect for caching multiple ID resolutions
|
|
14
|
+
* const itemIdCache = createPermanentCache<string>('items')
|
|
15
|
+
*
|
|
16
|
+
* // Cache different item ID resolutions with different keys
|
|
17
|
+
* const swordId = await itemIdCache.get('sword-of-power', async () => {
|
|
18
|
+
* const item = await resolveItem('sword-of-power')
|
|
19
|
+
* return item.id
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* const potionId = await itemIdCache.get('health-potion', async () => {
|
|
23
|
+
* const item = await resolveItem('health-potion')
|
|
24
|
+
* return item.id
|
|
25
|
+
* })
|
|
26
|
+
*
|
|
27
|
+
* // Check if specific item is cached
|
|
28
|
+
* if (itemIdCache.has('sword-of-power')) {
|
|
29
|
+
* // Use cached value
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function createPermanentCache<T>(keyPrefix?: string): {
|
|
34
|
+
get: (key: string, loader: () => Promise<T>) => Promise<T>;
|
|
35
|
+
clear: (key?: string) => void;
|
|
36
|
+
has: (key: string) => boolean;
|
|
37
|
+
size: () => number;
|
|
38
|
+
keys: () => string[];
|
|
39
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a singleton cache that stores a SINGLE value permanently.
|
|
3
|
+
* Once set, the value is cached for the lifetime of the application.
|
|
4
|
+
*
|
|
5
|
+
* This is NOT a key-value cache - it stores exactly one value total.
|
|
6
|
+
* If you need to cache multiple values with keys, use PermanentCache instead.
|
|
7
|
+
*
|
|
8
|
+
* @returns Cache instance with get and clear methods
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Perfect for single values that are resolved once
|
|
13
|
+
* const creditsIdCache = createSingletonCache<string>()
|
|
14
|
+
*
|
|
15
|
+
* // First call fetches and caches THE value
|
|
16
|
+
* const id = await creditsIdCache.get(async () => {
|
|
17
|
+
* const item = await fetchCreditsItem()
|
|
18
|
+
* return item.id
|
|
19
|
+
* })
|
|
20
|
+
*
|
|
21
|
+
* // Subsequent calls return THE cached value (no key needed)
|
|
22
|
+
* const cachedId = await creditsIdCache.get(() => fetchCreditsItem())
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function createSingletonCache<T>(): {
|
|
26
|
+
get: (loader: () => Promise<T>) => Promise<T>;
|
|
27
|
+
clear: () => void;
|
|
28
|
+
has: () => boolean;
|
|
29
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { TTLCacheConfig } from './types';
|
|
2
|
+
export interface TTLCacheOptions {
|
|
3
|
+
/** Default time-to-live in milliseconds */
|
|
4
|
+
ttl: number;
|
|
5
|
+
/** Optional key prefix for debugging */
|
|
6
|
+
keyPrefix?: string;
|
|
7
|
+
/** Optional callback when cache is cleared */
|
|
8
|
+
onClear?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface CachedValue<T> {
|
|
11
|
+
value: T;
|
|
12
|
+
expiresAt: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates a TTL (Time-To-Live) cache for async operations with management capabilities.
|
|
16
|
+
* Caches results for a specified duration and allows force refresh.
|
|
17
|
+
* TTL can be configured both at creation time (default) and at runtime (per-call).
|
|
18
|
+
*
|
|
19
|
+
* @param options - Cache configuration with default TTL
|
|
20
|
+
* @returns Cache instance with get, clear, size, prune, getKeys, and has methods
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const cache = createTTLCache<Game[]>({
|
|
25
|
+
* ttl: 60 * 1000, // Default: 60 seconds
|
|
26
|
+
* keyPrefix: 'games.list'
|
|
27
|
+
* })
|
|
28
|
+
*
|
|
29
|
+
* // Use default TTL
|
|
30
|
+
* const games = await cache.get('all', () => fetchGames())
|
|
31
|
+
*
|
|
32
|
+
* // Override with custom TTL for this call
|
|
33
|
+
* const shortLived = await cache.get('all', () => fetchGames(), { ttl: 5000 })
|
|
34
|
+
*
|
|
35
|
+
* // Force refresh regardless of TTL
|
|
36
|
+
* const fresh = await cache.get('all', () => fetchGames(), { force: true })
|
|
37
|
+
*
|
|
38
|
+
* // Disable caching for this call (ttl: 0)
|
|
39
|
+
* const uncached = await cache.get('all', () => fetchGames(), { ttl: 0 })
|
|
40
|
+
*
|
|
41
|
+
* // Inspect cache
|
|
42
|
+
* const keys = cache.getKeys() // ['all']
|
|
43
|
+
* const hasAll = cache.has('all') // true
|
|
44
|
+
* cache.clear('all') // Clear specific key
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function createTTLCache<T>(options: TTLCacheOptions): {
|
|
48
|
+
get: (key: string, loader: () => Promise<T>, config?: TTLCacheConfig) => Promise<T>;
|
|
49
|
+
clear: (key?: string) => void;
|
|
50
|
+
size: () => number;
|
|
51
|
+
prune: () => void;
|
|
52
|
+
getKeys: () => string[];
|
|
53
|
+
has: (key: string) => boolean;
|
|
54
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache configuration types for runtime customization
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Runtime configuration for TTL cache behavior
|
|
6
|
+
*/
|
|
7
|
+
export interface TTLCacheConfig {
|
|
8
|
+
/** Time-to-live in milliseconds. Set to 0 to disable caching for this call. */
|
|
9
|
+
ttl?: number;
|
|
10
|
+
/** Force refresh, bypassing cache */
|
|
11
|
+
force?: boolean;
|
|
12
|
+
/** Skip cache and fetch fresh data (alias for force) */
|
|
13
|
+
skipCache?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Runtime configuration for cooldown cache behavior
|
|
17
|
+
*/
|
|
18
|
+
export interface CooldownCacheConfig {
|
|
19
|
+
/** Cooldown period in milliseconds. Set to 0 to disable cooldown for this call. */
|
|
20
|
+
cooldown?: number;
|
|
21
|
+
/** Force refresh, bypassing cooldown */
|
|
22
|
+
force?: boolean;
|
|
23
|
+
}
|