@nifrajs/cli 1.11.0 → 1.12.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/README.md +8 -1
- package/dist/check.d.ts +1 -1
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +19 -0
- package/dist/check.js.map +1 -1
- package/dist/cli.js +4 -4
- package/dist/doctor.d.ts +17 -0
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +146 -10
- package/dist/doctor.js.map +1 -1
- package/dist/levels-tool.d.ts.map +1 -1
- package/dist/levels-tool.js +11 -8
- package/dist/levels-tool.js.map +1 -1
- package/dist/mcp-http.js +1 -1
- package/docs/llms-full.txt +106 -3
- package/docs/types.json +479 -11
- package/package.json +9 -8
- package/src/check.ts +20 -0
- package/src/cli.ts +4 -4
- package/src/doctor.ts +179 -11
- package/src/levels-tool.ts +17 -7
- package/src/mcp-http.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"levels-tool.d.ts","sourceRoot":"","sources":["../src/levels-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAiBH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAA;IACpB,6FAA6F;IAC7F,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CACpC;AAED,MAAM,WAAW,wBAAwB;IACvC,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,uBAAuB,EAAE,CAAA;CACpD;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,iGAAiG;AACjG,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,
|
|
1
|
+
{"version":3,"file":"levels-tool.d.ts","sourceRoot":"","sources":["../src/levels-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAiBH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAA;IACpB,6FAA6F;IAC7F,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CACpC;AAED,MAAM,WAAW,wBAAwB;IACvC,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,uBAAuB,EAAE,CAAA;CACpD;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,iGAAiG;AACjG,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CAwInC;AAqBD,2FAA2F;AAC3F,wBAAsB,SAAS,CAC7B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,oBAAoB,GAAG;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GACtF,OAAO,CAAC,OAAO,CAAC,CAkBlB"}
|
package/dist/levels-tool.js
CHANGED
|
@@ -14,8 +14,8 @@ import { existsSync } from "node:fs";
|
|
|
14
14
|
import { resolve } from "node:path";
|
|
15
15
|
import { evaluateRouteAssurance } from "@nifrajs/core/assurance";
|
|
16
16
|
import { snapshotCapabilities } from "@nifrajs/core/capabilities";
|
|
17
|
-
import { runContractInvariants } from "@nifrajs/core/invariants";
|
|
18
17
|
import { buildNifraManifest, parseNifraManifest } from "@nifrajs/core/manifest";
|
|
18
|
+
import { runAdversarialContract } from "@nifrajs/testing";
|
|
19
19
|
import { loadAssuranceConfig } from "./assure.js";
|
|
20
20
|
import { collectCapabilityProjectReport, diffCapabilitySnapshots, parseCapabilityLockfile, } from "./capabilities-tool.js";
|
|
21
21
|
import { collectCheckResult } from "./check.js";
|
|
@@ -124,16 +124,19 @@ export async function collectVerificationLevels(cwd, options = {}) {
|
|
|
124
124
|
l4Reasons.push("no isolated invariant executor configured — add `invariants.executor` in nifra.assurance.ts");
|
|
125
125
|
}
|
|
126
126
|
else {
|
|
127
|
-
const invariants = await
|
|
127
|
+
const invariants = await runAdversarialContract(config.source, {
|
|
128
128
|
seed: options.seed ?? 1,
|
|
129
|
-
|
|
129
|
+
runtimes: [{ name: "isolated", fetch: config.invariants.executor }],
|
|
130
|
+
expectedValidationStatuses: [400, 422],
|
|
131
|
+
requireCoverage: true,
|
|
130
132
|
});
|
|
131
|
-
if (!invariants.ok)
|
|
132
|
-
l4Reasons.push(...invariants.
|
|
133
|
-
if (invariants.skipped.length > 0) {
|
|
134
|
-
l4Reasons.push(...invariants.skipped
|
|
133
|
+
if (!invariants.ok) {
|
|
134
|
+
l4Reasons.push(...invariants.failures
|
|
135
135
|
.slice(0, 5)
|
|
136
|
-
.map((
|
|
136
|
+
.map((failure) => `${failure.runtime}: ${failure.id} - ${failure.message} (replay seed ${failure.replay.seed})`));
|
|
137
|
+
l4Reasons.push(...invariants.gaps
|
|
138
|
+
.slice(0, Math.max(0, 5 - l4Reasons.length))
|
|
139
|
+
.map((gap) => `${gap.route ?? "contract"}${gap.target ? ` ${gap.target}` : ""}: ${gap.message}`));
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
142
|
statuses.push({
|
package/dist/levels-tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"levels-tool.js","sourceRoot":"","sources":["../src/levels-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAoC,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACnG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"levels-tool.js","sourceRoot":"","sources":["../src/levels-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAoC,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACnG,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC/E,OAAO,EAAwB,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EACL,8BAA8B,EAC9B,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAsB1D,iGAAiG;AACjG,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,GAAW,EACX,UAAgC,EAAE;IAElC,MAAM,QAAQ,GAAsE,EAAE,CAAA;IAEtF,uCAAuC;IACvC,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC,G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AAG,IAAI,CAAC,CAAA;IAC5B,OAAO,MAAM,CAAC,QAAQ,IAAI,GAAG,CAAA;AAC/B,CAAC"}
|
package/dist/mcp-http.js
CHANGED
|
@@ -19,7 +19,7 @@ import { loadTypesCorpus } from "./types-search.js";
|
|
|
19
19
|
// tool factory + the transport core from one entry: `import { respondMcpHttp, docsTools } from "@nifrajs/cli/mcp"`.
|
|
20
20
|
export { docsTools } from "./mcp-docs-tools.js";
|
|
21
21
|
// Kept in lockstep with packages/cli/package.json by check:publish's version-consistency gate.
|
|
22
|
-
const VERSION = "1.
|
|
22
|
+
const VERSION = "1.12.0";
|
|
23
23
|
const SERVER_INFO = { name: "nifra-docs", version: VERSION };
|
|
24
24
|
const DOCS_HEALTH = "nifra docs MCP — POST JSON-RPC 2.0 here (methods: initialize, tools/list, tools/call). Tools: nifra_docs, nifra_example.";
|
|
25
25
|
/** The two project-independent tools, reading the package's bundled corpus from disk (CLI use). */
|
package/docs/llms-full.txt
CHANGED
|
@@ -4759,9 +4759,16 @@ nifra assure [--config <file>] [--json] Gate reflected routes against enforcem
|
|
|
4759
4759
|
nifra capabilities check [--json] Gate effect provenance + the reviewed capability lockfile.
|
|
4760
4760
|
nifra manifest emit [--sign <key-ref>] Emit the hash-verified route trust artifact after assurance.
|
|
4761
4761
|
nifra manifest diff <before> <after> Block promotion on contract/governance regressions.
|
|
4762
|
-
nifra doctor [--json] [--auto-fix] Catch undeclared
|
|
4762
|
+
nifra doctor [--json] [--auto-fix] Catch undeclared imports and duplicate Nifra/React installs.
|
|
4763
4763
|
```
|
|
4764
4764
|
|
|
4765
|
+
## `nifra doctor` - dependency health
|
|
4766
|
+
|
|
4767
|
+
Doctor diffs source imports against declared dependencies, then resolves identity-sensitive
|
|
4768
|
+
dependencies from every workspace package. More than one physical `@nifrajs/*`, `react`, or
|
|
4769
|
+
`react-dom` copy fails even when versions match; module identity is path-based. Doctor reports
|
|
4770
|
+
paths/importers and never deletes installations.
|
|
4771
|
+
|
|
4765
4772
|
## `nifra assure` — the route-enforcement gate
|
|
4766
4773
|
|
|
4767
4774
|
Create `nifra.assurance.ts` with a default `defineAssuranceConfig({ source, policy })` export, then run
|
|
@@ -5202,6 +5209,10 @@ done-gate, or `nifra mcp` to give the agent live project tools.
|
|
|
5202
5209
|
|
|
5203
5210
|
Portable, versioned event contracts — a typed, transport-agnostic event envelope validated by any Standard Schema.
|
|
5204
5211
|
|
|
5212
|
+
An envelope may carry the bounded `@nifrajs/core/causality` context for its exact event id. Creation
|
|
5213
|
+
and parsing reject mismatched nodes and unknown fields, so arbitrary payloads cannot hitchhike in the
|
|
5214
|
+
lineage metadata.
|
|
5215
|
+
|
|
5205
5216
|
See the [nifra docs](https://github.com/nifrajs/nifra#readme).
|
|
5206
5217
|
|
|
5207
5218
|
## @nifrajs/i18n
|
|
@@ -5599,10 +5610,38 @@ const app = server()
|
|
|
5599
5610
|
(`error` for 5xx, `ok` otherwise).
|
|
5600
5611
|
- **Exposes `c.trace`** (`{ traceId, spanId, parentSpanId?, sampled, traceparent }`) — spread
|
|
5601
5612
|
`traceHeaders(c.trace)` into any downstream `fetch`/`ctx.api` call to continue the trace.
|
|
5613
|
+
- **Exposes `c.causality`** - a bounded, payload-free request node that survives durable command,
|
|
5614
|
+
event, workflow, projection, and repair seams. `traceHeaders(c.trace, c.causality)` forwards both
|
|
5615
|
+
conventions to a trusted downstream service.
|
|
5602
5616
|
- **Exposes `c.observation`** — integrations can start correctly-parented child observations or
|
|
5603
5617
|
attach an adapter without rebuilding request lifecycle state.
|
|
5604
5618
|
- `responseHeader: true` also sets `traceparent` on the response (browser/client correlation).
|
|
5605
5619
|
|
|
5620
|
+
## Durable causality and trust
|
|
5621
|
+
|
|
5622
|
+
Pass a durable recorder to append the request root before the handler runs. An explicitly configured
|
|
5623
|
+
recorder is correctness evidence, so its failure fails the request closed:
|
|
5624
|
+
|
|
5625
|
+
```ts
|
|
5626
|
+
app.use(tracing({
|
|
5627
|
+
exporter,
|
|
5628
|
+
causality: {
|
|
5629
|
+
recorder: durableGraphStore,
|
|
5630
|
+
acceptInbound: (request) => verifyInternalServiceCredential(request),
|
|
5631
|
+
},
|
|
5632
|
+
}))
|
|
5633
|
+
```
|
|
5634
|
+
|
|
5635
|
+
Inbound causality headers are **not trusted by default**. This prevents an internet client from
|
|
5636
|
+
injecting fake parents into another execution timeline. Supply `acceptInbound` only at an authenticated
|
|
5637
|
+
service-to-service boundary; a false, thrown, or rejected decision starts a fresh graph. W3C
|
|
5638
|
+
`traceparent` remains normal observability context, but a fresh durable execution id includes the
|
|
5639
|
+
server-generated span id and is not copied from the untrusted header.
|
|
5640
|
+
|
|
5641
|
+
Use `causalitySpanLink(context)` when durable work opens a later observation. It creates a real OTel
|
|
5642
|
+
link to the nearest observed causal ancestor and drops invalid/unanchored contexts rather than
|
|
5643
|
+
inventing trace identity.
|
|
5644
|
+
|
|
5606
5645
|
## Adapters
|
|
5607
5646
|
|
|
5608
5647
|
Implement `ObservationAdapter` to send spans wherever you collect them. `SpanExporter` remains as a
|
|
@@ -5866,6 +5905,66 @@ const report = await assertAdversarialContract(app, {
|
|
|
5866
5905
|
request for each declared response schema, so use an isolated test app/database—never point the
|
|
5867
5906
|
laboratory at production.
|
|
5868
5907
|
|
|
5908
|
+
`nifra levels` L4 uses this same deep engine through the explicitly configured isolated executor;
|
|
5909
|
+
the older core invariant runner remains only as a compatibility export.
|
|
5910
|
+
|
|
5911
|
+
## Durable failure laboratory
|
|
5912
|
+
|
|
5913
|
+
`createFailureLab` injects replayable failures at named seams in a disposable test adapter. It
|
|
5914
|
+
supports crash-after-commit, duplicate delivery, event reordering, virtual delay, budget expiry,
|
|
5915
|
+
lost provider replies, and checkpoint contention. It never sleeps and its evidence records only
|
|
5916
|
+
the schedule tokens - not requests, events, provider results, error messages, or stacks.
|
|
5917
|
+
|
|
5918
|
+
```ts
|
|
5919
|
+
import { FailureInjectedError, runFailureScenario } from "@nifrajs/testing"
|
|
5920
|
+
|
|
5921
|
+
let committed = false
|
|
5922
|
+
const report = await runFailureScenario({
|
|
5923
|
+
name: "outbox-crash-after-commit",
|
|
5924
|
+
execute(lab) {
|
|
5925
|
+
committed = true // the real disposable transaction committed
|
|
5926
|
+
lab.checkpoint("outbox.after_commit")
|
|
5927
|
+
},
|
|
5928
|
+
verify: ({ error }) => committed && error instanceof FailureInjectedError,
|
|
5929
|
+
}, {
|
|
5930
|
+
seed: 73,
|
|
5931
|
+
schedule: [{ kind: "crash", point: "outbox.after_commit" }],
|
|
5932
|
+
})
|
|
5933
|
+
|
|
5934
|
+
expect(report.ok).toBe(true)
|
|
5935
|
+
// Re-run with report.replay.seed + report.replay.schedule.
|
|
5936
|
+
```
|
|
5937
|
+
|
|
5938
|
+
Use `lab.deliveries()` around a relay batch, `lab.provider()` around a provider call,
|
|
5939
|
+
`lab.remaining()` before a deadline-bound hop, and `lab.checkpointContended()` at a projection CAS.
|
|
5940
|
+
The laboratory is a test port: production code does not import it and pays no hot-path cost.
|
|
5941
|
+
|
|
5942
|
+
## Adapter certification
|
|
5943
|
+
|
|
5944
|
+
`@nifrajs/testing/certification` turns an adapter interface into portable, hash-verifiable evidence.
|
|
5945
|
+
Built-in profiles cover storage (including optional paging/signing/copy-move), cache, jobs, Node/Deno-
|
|
5946
|
+
style runtimes, and durable event delivery. Every check receives a fresh adapter, capability status is
|
|
5947
|
+
explicit, and failures retain only the error class - never provider messages or credentials.
|
|
5948
|
+
|
|
5949
|
+
```ts
|
|
5950
|
+
import {
|
|
5951
|
+
certifyAdapter,
|
|
5952
|
+
storageAdapterCertificationProfile,
|
|
5953
|
+
verifyAdapterCertification,
|
|
5954
|
+
} from "@nifrajs/testing/certification"
|
|
5955
|
+
|
|
5956
|
+
const report = await certifyAdapter({
|
|
5957
|
+
profile: storageAdapterCertificationProfile({ paging: true, presign: true, move: true }),
|
|
5958
|
+
adapterId: "s3-production-shape",
|
|
5959
|
+
createAdapter: () => createDisposableS3Adapter(),
|
|
5960
|
+
})
|
|
5961
|
+
|
|
5962
|
+
if (!report.ok || !(await verifyAdapterCertification(report))) throw new Error("adapter uncertified")
|
|
5963
|
+
```
|
|
5964
|
+
|
|
5965
|
+
Run profiles only against disposable namespaces. The certification module is structural and
|
|
5966
|
+
dependency-free, so adapter packages keep it in test/CI and acquire no production runtime dependency.
|
|
5967
|
+
|
|
5869
5968
|
## Stateful sessions
|
|
5870
5969
|
|
|
5871
5970
|
[`@nifrajs/client`](../client)'s **`testClient`** is already the typed, no-network in-process request
|
|
@@ -5895,6 +5994,10 @@ that every call carries and captures cookies via a shared jar.
|
|
|
5895
5994
|
|
|
5896
5995
|
- `assertAdversarialContract(app, options?)` → green report or throws `AdversarialContractError`.
|
|
5897
5996
|
- `runAdversarialContract(app, options?)` → structured `{ ok, results, failures, gaps, seed }` report.
|
|
5997
|
+
- `createFailureLab(options)` → deterministic controller for isolated durable adapters.
|
|
5998
|
+
- `runFailureScenario(scenario, options)` → token-only `{ ok, replay, evidence, error? }` report.
|
|
5999
|
+
- `certifyAdapter({ profile, adapterId, createAdapter })` → capability matrix + SHA-256 evidence.
|
|
6000
|
+
- `verifyAdapterCertification(report)` → recompute and verify portable certification evidence.
|
|
5898
6001
|
- `testSession<App>(app, { origin?, cookies? })` → `{ client: Treaty<App>, cookies: CookieJar }`.
|
|
5899
6002
|
- `cookieJar()` → `CookieJar` — `header()` · `applyTo(headers)` · `store(response)` · `set` · `get` · `clear` · `size`.
|
|
5900
6003
|
Honours removal (`Max-Age=0` / past `Expires`); other cookie attributes are ignored (in-process, same-origin).
|
|
@@ -6311,7 +6414,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
|
|
|
6311
6414
|
|
|
6312
6415
|
## @nifrajs/otel
|
|
6313
6416
|
|
|
6314
|
-
`ActiveObservation`, `AttributeValue`, `combineObservationAdapters`, `consoleSpanExporter`, `createObservationLifecycle`, `EndObservation`, `formatTraceparent`, `generateSpanId`, `generateTraceId`, `NifraSpan`, `ObservationAdapter`, `ObservationClock`, `ObservationContext`, `ObservationLifecycle`, `ObservationLifecycleOptions`, `ObservationParent`, `ParsedTraceparent`, `parseTraceparent`, `SpanExporter`, `SpanStatus`, `StartObservation`, `TraceContext`, `traceHeaders`, `tracing`, `TracingOptions`
|
|
6417
|
+
`ActiveObservation`, `AttributeValue`, `causalitySpanLink`, `combineObservationAdapters`, `consoleSpanExporter`, `createObservationLifecycle`, `EndObservation`, `formatTraceparent`, `generateSpanId`, `generateTraceId`, `NifraSpan`, `ObservationAdapter`, `ObservationClock`, `ObservationContext`, `ObservationLifecycle`, `ObservationLifecycleOptions`, `ObservationLink`, `ObservationParent`, `ParsedTraceparent`, `parseTraceparent`, `SpanExporter`, `SpanStatus`, `StartObservation`, `TraceContext`, `traceHeaders`, `tracing`, `TracingOptions`
|
|
6315
6418
|
|
|
6316
6419
|
## @nifrajs/prompt
|
|
6317
6420
|
|
|
@@ -6331,7 +6434,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
|
|
|
6331
6434
|
|
|
6332
6435
|
## @nifrajs/testing
|
|
6333
6436
|
|
|
6334
|
-
`AdversarialContractError`, `AdversarialContractOptions`, `AdversarialContractReport`, `AdversarialContractResult`, `AppLike`, `assertAdversarialContract`, `assertIncidentReplays`, `CapturedRequest`, `CapturedRequestInput`, `captureIncident`, `CaptureIncidentOptions`, `ContractCaseContext`, `ContractCaseKind`, `ContractCoverageGap`, `ContractCoverageGapCode`, `ContractReplay`, `ContractRuntime`, `ContractTarget`, `ContractTestApp`, `ContractWitness`, `cookieJar`, `CookieJar`, `generateRegressionTest`, `GenerateRegressionTestOptions`, `IncidentCapsule`, `IncidentReplayError`, `IncidentReplayResult`, `redactForEmission`, `replayIncident`, `ReplayIncidentOptions`, `runAdversarialContract`, `shapeOf`, `testSession`, `TestSession`, `TestSessionOptions`
|
|
6437
|
+
`AdapterCertificationError`, `AdapterCertificationProfile`, `AdapterCertificationReport`, `AdversarialContractError`, `AdversarialContractOptions`, `AdversarialContractReport`, `AdversarialContractResult`, `AppLike`, `assertAdapterCertification`, `assertAdversarialContract`, `assertIncidentReplays`, `cacheStoreCertificationProfile`, `CapturedRequest`, `CapturedRequestInput`, `captureIncident`, `CaptureIncidentOptions`, `CertifiableCacheEntry`, `CertifiableCacheStore`, `CertifiableDomainEvent`, `CertifiableEventDeliveryAdapter`, `CertifiableEventRecord`, `CertifiableJobStore`, `CertifiableRuntimeAdapter`, `CertifiableRuntimeServer`, `CertifiableStorageAdapter`, `CertificationCapabilityEvidence`, `CertificationCheck`, `CertificationCheckEvidence`, `certifyAdapter`, `ContractCaseContext`, `ContractCaseKind`, `ContractCoverageGap`, `ContractCoverageGapCode`, `ContractReplay`, `ContractRuntime`, `ContractTarget`, `ContractTestApp`, `ContractWitness`, `cookieJar`, `CookieJar`, `createFailureLab`, `defineCertificationProfile`, `eventDeliveryCertificationProfile`, `FailureDirective`, `FailureEvidence`, `FailureInjectedError`, `FailureKind`, `FailureLab`, `FailureLabOptions`, `FailureReplay`, `FailureScenario`, `FailureScenarioReport`, `generateRegressionTest`, `GenerateRegressionTestOptions`, `IncidentCapsule`, `IncidentReplayError`, `IncidentReplayResult`, `jobStoreCertificationProfile`, `redactForEmission`, `replayIncident`, `ReplayIncidentOptions`, `runAdversarialContract`, `runFailureScenario`, `runtimeAdapterCertificationProfile`, `shapeOf`, `storageAdapterCertificationProfile`, `testSession`, `TestSession`, `TestSessionOptions`, `verifyAdapterCertification`
|
|
6335
6438
|
|
|
6336
6439
|
## @nifrajs/uploads
|
|
6337
6440
|
|