@hkdigital/lib-sveltekit 0.1.68 → 0.1.70
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/classes/cache/CacheStorage.js__ +45 -0
- package/dist/classes/cache/MemoryResponseCache.d.ts +19 -0
- package/dist/classes/cache/MemoryResponseCache.js +53 -0
- package/dist/classes/cache/PersistentResponseCache.d.ts +46 -0
- package/dist/classes/cache/PersistentResponseCache.js +165 -0
- package/dist/classes/cache/index.d.ts +3 -0
- package/dist/classes/cache/index.js +5 -0
- package/dist/classes/cache/typedef.d.ts +50 -0
- package/dist/classes/cache/typedef.js +25 -0
- package/dist/util/http/caching.d.ts +28 -0
- package/dist/util/http/caching.js +251 -0
- package/dist/util/http/headers.d.ts +33 -4
- package/dist/util/http/headers.js +57 -27
- package/dist/util/http/http-request.d.ts +93 -115
- package/dist/util/http/http-request.js +329 -262
- package/dist/util/http/json-request.d.ts +65 -45
- package/dist/util/http/json-request.js +188 -138
- package/dist/util/http/response.d.ts +91 -22
- package/dist/util/http/response.js +229 -176
- package/dist/util/http/typedef.d.ts +184 -0
- package/dist/util/http/typedef.js +93 -0
- package/dist/widgets/game-box/GameBox.svelte +2 -2
- package/package.json +1 -1
@@ -0,0 +1,93 @@
|
|
1
|
+
/**
|
2
|
+
* @typedef {Object} HttpRequestOptions
|
3
|
+
* @property {string|URL} url URL string or URL object for the request
|
4
|
+
* @property {string} [method] HTTP method to use (GET, POST, etc.)
|
5
|
+
*
|
6
|
+
* @property {Object|URLSearchParams} [urlSearchParams]
|
7
|
+
* Parameters to add to the URL
|
8
|
+
*
|
9
|
+
* @property {*} [body] Request body (for POST, PUT, etc.)
|
10
|
+
* @property {Object} [headers] HTTP headers as name-value pairs
|
11
|
+
* @property {boolean} [withCredentials] Whether to include credentials
|
12
|
+
* @property {number} [timeoutMs] Request timeout in milliseconds
|
13
|
+
* @property {Function} [requestHandler] Handler for abort/timeout control
|
14
|
+
* @property {string} [mode] CORS mode ('cors', 'no-cors', 'same-origin')
|
15
|
+
* @property {string} [cache] Cache mode ('default', 'no-cache', etc.)
|
16
|
+
* @property {string} [redirect] Redirect mode ('follow', 'error', 'manual')
|
17
|
+
* @property {string} [referrerPolicy] Referrer policy
|
18
|
+
* @property {boolean} [cacheEnabled] Enable or disabled automatic caching
|
19
|
+
*/
|
20
|
+
|
21
|
+
/**
|
22
|
+
* @typedef {Object} RequestHandlerParams
|
23
|
+
*
|
24
|
+
* @property {AbortController} controller
|
25
|
+
* The AbortController instance for this request
|
26
|
+
*
|
27
|
+
* @property {(reason?: Error) => void} abort Function to abort the request
|
28
|
+
* @property {(delayMs: number) => void} timeout Function to set a timeout
|
29
|
+
*/
|
30
|
+
|
31
|
+
/**
|
32
|
+
* @callback RequestHandler
|
33
|
+
* @param {RequestHandlerParams} params Parameters for controlling the request
|
34
|
+
* @returns {void}
|
35
|
+
*/
|
36
|
+
|
37
|
+
/**
|
38
|
+
* @typedef {Object} JsonGetOptions
|
39
|
+
* @property {string|URL} url URL string or URL object for the request
|
40
|
+
*
|
41
|
+
* @property {Object|URLSearchParams} [urlSearchParams]
|
42
|
+
* Parameters to add to the URL
|
43
|
+
*
|
44
|
+
* @property {Object} [headers] HTTP headers as name-value pairs
|
45
|
+
* @property {boolean} [withCredentials] Whether to include credentials
|
46
|
+
* @property {number} [timeoutMs] Request timeout in milliseconds
|
47
|
+
* @property {RequestHandler} [requestHandler] Handler for abort/timeout control
|
48
|
+
* @property {string} [mode] CORS mode ('cors', 'no-cors', 'same-origin')
|
49
|
+
* @property {string} [cache] Cache mode ('default', 'no-cache', etc.)
|
50
|
+
* @property {string} [redirect] Redirect mode ('follow', 'error', 'manual')
|
51
|
+
* @property {string} [referrerPolicy] Referrer policy
|
52
|
+
* @property {boolean} [cacheEnabled] Enable or disabled automatic caching
|
53
|
+
*/
|
54
|
+
|
55
|
+
/**
|
56
|
+
* @typedef {Object} JsonPostOptions
|
57
|
+
* @property {string|URL} url URL string or URL object for the request
|
58
|
+
* @property {*} body Request body (will be sent as JSON)
|
59
|
+
*
|
60
|
+
* @property {Object|URLSearchParams} [urlSearchParams]
|
61
|
+
* Parameters to add to the URL
|
62
|
+
*
|
63
|
+
* @property {Object} [headers] HTTP headers as name-value pairs
|
64
|
+
* @property {boolean} [withCredentials] Whether to include credentials
|
65
|
+
* @property {number} [timeoutMs] Request timeout in milliseconds
|
66
|
+
* @property {RequestHandler} [requestHandler] Handler for abort/timeout control
|
67
|
+
* @property {string} [mode] CORS mode ('cors', 'no-cors', 'same-origin')
|
68
|
+
* @property {string} [cache] Cache mode ('default', 'no-cache', etc.)
|
69
|
+
* @property {string} [redirect] Redirect mode ('follow', 'error', 'manual')
|
70
|
+
* @property {string} [referrerPolicy] Referrer policy
|
71
|
+
* @property {boolean} [cacheEnabled] Enable or disabled automatic caching
|
72
|
+
*/
|
73
|
+
|
74
|
+
/**
|
75
|
+
* @typedef {Object} StaleInfo
|
76
|
+
* @property {boolean} isStale Whether the response contains stale data
|
77
|
+
*
|
78
|
+
* @property {Promise<Response>|null} fresh
|
79
|
+
* Promise that resolves to fresh data (if available)
|
80
|
+
*
|
81
|
+
* @property {number} timestamp When the response was originally cached
|
82
|
+
* @property {number|null} expires When the response expires
|
83
|
+
*/
|
84
|
+
|
85
|
+
/**
|
86
|
+
* @typedef {Response} ResponseWithStale
|
87
|
+
* @property {boolean} isStale Whether this response contains stale data
|
88
|
+
*
|
89
|
+
* @property {Promise<Response>|null} fresh
|
90
|
+
* Promise for fresh data if this is stale
|
91
|
+
*/
|
92
|
+
|
93
|
+
export {};
|
@@ -6,8 +6,8 @@
|
|
6
6
|
getGameWidthOnPortrait
|
7
7
|
} from './gamebox.util.js';
|
8
8
|
|
9
|
-
|
10
|
-
import { enableContainerScaling } from '@hkdigital/lib-sveltekit/util/design-system/index.js';
|
9
|
+
import { enableContainerScaling } from '../../util/design-system/index.js';
|
10
|
+
// import { enableContainerScaling } from '@hkdigital/lib-sveltekit/util/design-system/index.js';
|
11
11
|
|
12
12
|
/**
|
13
13
|
* @typedef {{
|