@solidrt/flux-types 0.0.27 → 0.0.28

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/modules/fs.d.ts CHANGED
@@ -16,6 +16,8 @@ declare module "flux:fs" {
16
16
  text(): Promise<string>
17
17
  /** Read the whole file as raw bytes. */
18
18
  bytes(): Promise<Uint8Array>
19
+ /** Read the whole file as an ArrayBuffer. */
20
+ arrayBuffer(): Promise<ArrayBuffer>
19
21
  /** Read and parse the file as JSON. */
20
22
  json(): Promise<any>
21
23
  /** Resolve to whether the file exists. */
@@ -40,6 +42,11 @@ declare module "flux:fs" {
40
42
  entries(): Promise<DirEntry[]>
41
43
  /** Resolve to whether the directory exists. */
42
44
  exists(): Promise<boolean>
45
+ /**
46
+ * Create the directory, including any missing parents. Succeeds if it
47
+ * already exists.
48
+ */
49
+ create(): Promise<void>
43
50
  }
44
51
 
45
52
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidrt/flux-types",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "license": "MIT",
5
5
  "author": "Antoine van Wel",
6
6
  "types": "index.d.ts",
@@ -1,6 +1,6 @@
1
1
  // The Fetch API cluster (Headers, Request, Response, fetch). A deliberate subset
2
2
  // of the WHATWG Fetch standard: flux provides exactly these members and no more
3
- // (no Blob, FormData, ReadableStream, arrayBuffer(), clone(), AbortSignal, ...).
3
+ // (no Blob, FormData, ReadableStream, clone(), AbortSignal, ...).
4
4
  // Grouped in one file because the four share BodyInit/HeadersInit and reference
5
5
  // each other.
6
6
 
@@ -44,6 +44,28 @@ interface RequestInit {
44
44
  body?: BodyInit | null
45
45
  /** Request headers. */
46
46
  headers?: HeadersInit
47
+ /**
48
+ * Disk-cache policy, explicit and per call. flux never caches by default
49
+ * (like Node/Bun/Deno), and server cache headers (`cache-control`,
50
+ * `expires`, `etag`) are ignored entirely: the caller decides.
51
+ *
52
+ * - `"force-cache"`: serve from disk if stored, otherwise fetch and store.
53
+ * No freshness, no TTL: the entry lives until evicted by the size cap or
54
+ * overwritten by `"reload"`. Use for assets (images, audio, fonts);
55
+ * versioned URLs are the normal way to handle updatable assets.
56
+ * - `"reload"`: fetch fresh and overwrite the stored entry.
57
+ * - `"default"`, `"no-store"`, `"no-cache"`: accepted, plain network
58
+ * request (all equivalent to omitting the option here; there is no
59
+ * freshness model to modulate).
60
+ *
61
+ * Only GET requests with 2xx responses are cached, keyed by URL; on other
62
+ * methods the option is ignored. Unknown values throw.
63
+ *
64
+ * Cached fetches queue on a small per-host concurrency limit so asset
65
+ * floods stay polite; disk hits and plain (uncached) fetches are never
66
+ * throttled.
67
+ */
68
+ cache?: "force-cache" | "reload" | "default" | "no-store" | "no-cache"
47
69
  }
48
70
 
49
71
  /**
@@ -62,6 +84,8 @@ interface Request {
62
84
  text(): Promise<string>
63
85
  /** Read the whole body as raw bytes. */
64
86
  bytes(): Promise<Uint8Array>
87
+ /** Read the whole body as an ArrayBuffer. */
88
+ arrayBuffer(): Promise<ArrayBuffer>
65
89
  /** Read and parse the whole body as JSON. */
66
90
  json(): Promise<any>
67
91
  }
@@ -93,6 +117,8 @@ interface Response {
93
117
  text(): Promise<string>
94
118
  /** Read the whole body as raw bytes. */
95
119
  bytes(): Promise<Uint8Array>
120
+ /** Read the whole body as an ArrayBuffer. */
121
+ arrayBuffer(): Promise<ArrayBuffer>
96
122
  /** Read and parse the whole body as JSON. */
97
123
  json(): Promise<any>
98
124
  }
@@ -7,15 +7,15 @@
7
7
  * {@link clearTimeout}.
8
8
  */
9
9
  declare function setTimeout(callback: () => void, ms: number): number
10
- /** Cancel a pending timeout. Throws on an unknown id. */
11
- declare function clearTimeout(id: number): void
10
+ /** Cancel a pending timeout. Unknown or missing ids are ignored. */
11
+ declare function clearTimeout(id?: number): void
12
12
  /**
13
13
  * Run `callback` every `ms` milliseconds. Returns a timer id for
14
14
  * {@link clearInterval}.
15
15
  */
16
16
  declare function setInterval(callback: () => void, ms: number): number
17
- /** Cancel a running interval. Throws on an unknown id. */
18
- declare function clearInterval(id: number): void
17
+ /** Cancel a running interval. Unknown or missing ids are ignored. */
18
+ declare function clearInterval(id?: number): void
19
19
  /**
20
20
  * Queue `callback` to run as a microtask: after the current job finishes, before
21
21
  * any timer fires.