@micheldever/fetch-debug 0.0.0-stage → 1.1.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/LICENSE +21 -0
- package/README.md +257 -2
- package/dist/client/attach.d.ts +58 -0
- package/dist/console/console.d.ts +51 -0
- package/dist/core/matcher.d.ts +28 -0
- package/dist/core/override.d.ts +72 -0
- package/dist/core/registry.d.ts +38 -0
- package/dist/core/response.d.ts +51 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +983 -0
- package/dist/storage/storage.d.ts +27 -0
- package/package.json +54 -4
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FetchDebugOverride } from '../core/override.js';
|
|
2
|
+
import { StorageEntity } from '@micheldever/storage';
|
|
3
|
+
/**
|
|
4
|
+
* Loads persisted overrides from storage.
|
|
5
|
+
*
|
|
6
|
+
* Resolves to an empty array when no storage is supplied, when the key is
|
|
7
|
+
* missing, or when the stored payload is not recognised. Read failures are
|
|
8
|
+
* reported to `onError` and resolve to an empty array; parse failures are
|
|
9
|
+
* swallowed and also resolve to an empty array.
|
|
10
|
+
* @param storage The storage entity to read from. When omitted, no read is attempted.
|
|
11
|
+
* @param key The logical storage key holding the override payload.
|
|
12
|
+
* @param onError Called once when the storage read fails.
|
|
13
|
+
* @returns The hydrated overrides, or an empty array when none are available.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hydrateFetchDebugOverrides(storage?: StorageEntity, key?: string, onError?: (error: unknown) => void): Promise<FetchDebugOverride[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Persists overrides to storage as a versioned payload.
|
|
18
|
+
*
|
|
19
|
+
* Storage failures are swallowed: a write failure is reported to `onError` and
|
|
20
|
+
* resolves to `false` so the caller can keep the in-memory state.
|
|
21
|
+
* @param overrides The overrides to persist.
|
|
22
|
+
* @param storage The storage entity to write to. When omitted, no write is attempted.
|
|
23
|
+
* @param key The logical storage key for the override payload.
|
|
24
|
+
* @param onError Called once when the storage write fails.
|
|
25
|
+
* @returns `true` when the payload was written, otherwise `false`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function persistFetchDebugOverrides(overrides: readonly FetchDebugOverride[], storage?: StorageEntity, key?: string, onError?: (error: unknown) => void): Promise<boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micheldever/fetch-debug",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Deterministic response overrides for @micheldever/fetch",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist/**/*"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "vite build --mode lib",
|
|
19
|
+
"clean": "rimraf \"./dist\"",
|
|
20
|
+
"lint:fix": "npm run lint -- --fix",
|
|
21
|
+
"lint": "eslint \"./{**/,}*.{json,ts}\" --cache",
|
|
22
|
+
"prepack": "npm run clean && npm run build",
|
|
23
|
+
"prepare": "husky",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"tsc:verify": "tsrs --fast"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@commitlint/cli": "21.2.4",
|
|
29
|
+
"@commitlint/config-conventional": "21.2.4",
|
|
30
|
+
"@micheldever/eslint-config": "2.3.3",
|
|
31
|
+
"@micheldever/fetch": "2.2.2",
|
|
32
|
+
"@micheldever/storage": "2.1.0",
|
|
33
|
+
"@types/node": "26.6.6",
|
|
34
|
+
"@typescript/native": "npm:typescript@7.0.2",
|
|
35
|
+
"eslint": "10.15.0",
|
|
36
|
+
"husky": "9.1.7",
|
|
37
|
+
"jiti": "2.7.0",
|
|
38
|
+
"lint-staged": "17.6.1",
|
|
39
|
+
"npm-check-updates": "23.1.1",
|
|
40
|
+
"rimraf": "6.1.4",
|
|
41
|
+
"tsrs": "0.25.0-ts7.1.0-beta",
|
|
42
|
+
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
43
|
+
"vite": "8.3.8",
|
|
44
|
+
"vite-plugin-dts": "5.1.2",
|
|
45
|
+
"vitest": "5.1.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@micheldever/fetch": "^2.2.0",
|
|
49
|
+
"@micheldever/storage": "^2.0.0"
|
|
50
|
+
},
|
|
51
|
+
"peerDependenciesMeta": {
|
|
52
|
+
"@micheldever/storage": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|