@sungen/driver-api 3.1.2-beta.120 → 3.1.2-beta.121
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/package.json +2 -2
- package/src/api-harness.ts +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sungen/driver-api",
|
|
3
|
-
"version": "3.1.2-beta.
|
|
3
|
+
"version": "3.1.2-beta.121",
|
|
4
4
|
"description": "Sungen API capability — the @api annotation, API catalog, OpenAPI import + `sungen api import`, and the specs/api.ts runtime template. Plugs into @sun-asterisk/sungen via the capability SPI.",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "eqe team (engineer & quality) — Sun Asterisk",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@sun-asterisk/sungen": "3.1.2-beta.
|
|
16
|
+
"@sun-asterisk/sungen": "3.1.2-beta.121",
|
|
17
17
|
"commander": "^14.0.2",
|
|
18
18
|
"yaml": "^2.8.2"
|
|
19
19
|
},
|
package/src/api-harness.ts
CHANGED
|
@@ -30,9 +30,10 @@ interface ApiGateInput {
|
|
|
30
30
|
cwd: string;
|
|
31
31
|
screenName: string; // catalog-resolution id, e.g. `api/<area>`
|
|
32
32
|
threshold: number; // required businessDepth for the focus (from core)
|
|
33
|
+
businessCriticalMethods?: string[]; // end-user override (qa/context.md) — default POST/PUT/PATCH/DELETE
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
const
|
|
36
|
+
const DEFAULT_CRITICAL = ['POST', 'PUT', 'PATCH', 'DELETE'];
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* The API viewpoint catalog (display + the project-override seam). The gate computes coverage from
|
|
@@ -60,6 +61,9 @@ export function apiViewpoints(): Catalog {
|
|
|
60
61
|
*/
|
|
61
62
|
export function apiGateProvider(input: ApiGateInput): { gate: GateResult; depth: DepthResult } {
|
|
62
63
|
const { scenarios, focus, cwd, screenName, threshold } = input;
|
|
64
|
+
// Business-critical (depth-required) HTTP methods — end-user customizable via qa/context.md
|
|
65
|
+
// (`business_critical_methods: …`), e.g. to mark GET on a read-sensitive resource as critical.
|
|
66
|
+
const criticalMethods = (input.businessCriticalMethods?.length ? input.businessCriticalMethods : DEFAULT_CRITICAL).map((m) => m.toUpperCase());
|
|
63
67
|
const apiScenarios = scenarios.filter((s) => (s.apiRefs ?? []).length);
|
|
64
68
|
|
|
65
69
|
// Resolve each referenced endpoint's HTTP method (best-effort; unresolved → the verification
|
|
@@ -71,7 +75,7 @@ export function apiGateProvider(input: ApiGateInput): { gate: GateResult; depth:
|
|
|
71
75
|
try { methodOf.set(name, resolveApi(name, screenName, cwd).method); } catch { /* unresolved */ }
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
|
-
const isMutating = (name: string) =>
|
|
78
|
+
const isMutating = (name: string) => criticalMethods.includes((methodOf.get(name) ?? '').toUpperCase());
|
|
75
79
|
|
|
76
80
|
// ── Coverage: must-cover viewpoints per resolved endpoint ──────────────────────────────────
|
|
77
81
|
// read (GET/HEAD): {contract}; mutating: {contract, error}. (auth/idempotency/side-effect are
|