@attestry/sdk 0.6.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 +190 -0
- package/README.md +1269 -0
- package/dist/client.d.ts +58 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +74 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +43 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors.d.ts +16 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +41 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/lines-parser.d.ts +50 -0
- package/dist/lines-parser.d.ts.map +1 -0
- package/dist/lines-parser.js +211 -0
- package/dist/lines-parser.js.map +1 -0
- package/dist/ndjson-parser.d.ts +57 -0
- package/dist/ndjson-parser.d.ts.map +1 -0
- package/dist/ndjson-parser.js +245 -0
- package/dist/ndjson-parser.js.map +1 -0
- package/dist/resources/abac-policies.d.ts +1034 -0
- package/dist/resources/abac-policies.d.ts.map +1 -0
- package/dist/resources/abac-policies.js +1519 -0
- package/dist/resources/abac-policies.js.map +1 -0
- package/dist/resources/audit-log.d.ts +588 -0
- package/dist/resources/audit-log.d.ts.map +1 -0
- package/dist/resources/audit-log.js +629 -0
- package/dist/resources/audit-log.js.map +1 -0
- package/dist/resources/batch.d.ts +845 -0
- package/dist/resources/batch.d.ts.map +1 -0
- package/dist/resources/batch.js +1074 -0
- package/dist/resources/batch.js.map +1 -0
- package/dist/resources/chat.d.ts +151 -0
- package/dist/resources/chat.d.ts.map +1 -0
- package/dist/resources/chat.js +124 -0
- package/dist/resources/chat.js.map +1 -0
- package/dist/resources/check.d.ts +348 -0
- package/dist/resources/check.d.ts.map +1 -0
- package/dist/resources/check.js +543 -0
- package/dist/resources/check.js.map +1 -0
- package/dist/resources/compliance-check.d.ts +330 -0
- package/dist/resources/compliance-check.d.ts.map +1 -0
- package/dist/resources/compliance-check.js +402 -0
- package/dist/resources/compliance-check.js.map +1 -0
- package/dist/resources/decisions.d.ts +1208 -0
- package/dist/resources/decisions.d.ts.map +1 -0
- package/dist/resources/decisions.js +1362 -0
- package/dist/resources/decisions.js.map +1 -0
- package/dist/resources/evidence-pack.d.ts +1080 -0
- package/dist/resources/evidence-pack.d.ts.map +1 -0
- package/dist/resources/evidence-pack.js +1789 -0
- package/dist/resources/evidence-pack.js.map +1 -0
- package/dist/resources/gate.d.ts +613 -0
- package/dist/resources/gate.d.ts.map +1 -0
- package/dist/resources/gate.js +737 -0
- package/dist/resources/gate.js.map +1 -0
- package/dist/resources/incidents.d.ts +136 -0
- package/dist/resources/incidents.d.ts.map +1 -0
- package/dist/resources/incidents.js +229 -0
- package/dist/resources/incidents.js.map +1 -0
- package/dist/resources/regulatory-changes.d.ts +307 -0
- package/dist/resources/regulatory-changes.d.ts.map +1 -0
- package/dist/resources/regulatory-changes.js +365 -0
- package/dist/resources/regulatory-changes.js.map +1 -0
- package/dist/resources/safe-input-read.d.ts +21 -0
- package/dist/resources/safe-input-read.d.ts.map +1 -0
- package/dist/resources/safe-input-read.js +57 -0
- package/dist/resources/safe-input-read.js.map +1 -0
- package/dist/resources/ship-gate.d.ts +475 -0
- package/dist/resources/ship-gate.d.ts.map +1 -0
- package/dist/resources/ship-gate.js +727 -0
- package/dist/resources/ship-gate.js.map +1 -0
- package/dist/resources/vision.d.ts +540 -0
- package/dist/resources/vision.d.ts.map +1 -0
- package/dist/resources/vision.js +1036 -0
- package/dist/resources/vision.js.map +1 -0
- package/dist/retry.d.ts +103 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +224 -0
- package/dist/retry.js.map +1 -0
- package/dist/sse-parser.d.ts +64 -0
- package/dist/sse-parser.d.ts.map +1 -0
- package/dist/sse-parser.js +271 -0
- package/dist/sse-parser.js.map +1 -0
- package/dist/transport.d.ts +142 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +455 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import type { AttestryClient } from "../client.js";
|
|
2
|
+
import type { RequestOptions } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Per-system framework-coverage breakdown. Source-of-truth at
|
|
5
|
+
* kernel `src/app/api/v1/compliance-check/route.ts:155-161`.
|
|
6
|
+
*
|
|
7
|
+
* Computed at handler-time, NOT a Drizzle column. The route iterates
|
|
8
|
+
* target systems, reads each system's `riskClassifications` jsonb
|
|
9
|
+
* (`applicableFrameworks: string[]`), aggregates assessed frameworks
|
|
10
|
+
* across that system's assessment rows, and emits these three fields.
|
|
11
|
+
*
|
|
12
|
+
* `coveragePct` is `Math.round((assessed.size / applicable.length) * 100)`
|
|
13
|
+
* when `applicable.length > 0`, else `0`. Defensively-typed
|
|
14
|
+
* `coveragePct: number` (NOT clamped 0-100 in the type — `assessed`
|
|
15
|
+
* can in theory exceed `applicable` if a system was assessed against
|
|
16
|
+
* frameworks NOT in its applicable list; the kernel doesn't filter,
|
|
17
|
+
* so the percentage could exceed 100). Consumers may want to apply
|
|
18
|
+
* their own clamping.
|
|
19
|
+
*/
|
|
20
|
+
export interface ComplianceCheckFrameworkCoverage {
|
|
21
|
+
/**
|
|
22
|
+
* Frameworks the system is required to comply with — read from
|
|
23
|
+
* the system's `riskClassifications.applicableFrameworks` jsonb
|
|
24
|
+
* field. Open string array — kernel does not enforce a closed
|
|
25
|
+
* enum. Order is preserved from the source array (kernel does
|
|
26
|
+
* NOT re-sort).
|
|
27
|
+
*/
|
|
28
|
+
applicable: string[];
|
|
29
|
+
/**
|
|
30
|
+
* Distinct frameworks the system has been assessed against —
|
|
31
|
+
* computed as the deduped union of `assessment.frameworks: string[]`
|
|
32
|
+
* across all assessment rows (NOT just completed assessments;
|
|
33
|
+
* kernel includes every status). Order is the iteration order of
|
|
34
|
+
* the deduplication `Set` — JS spec preserves insertion order.
|
|
35
|
+
* Open string array (no closed enum).
|
|
36
|
+
*/
|
|
37
|
+
assessed: string[];
|
|
38
|
+
/**
|
|
39
|
+
* Integer percentage 0..100 (typically — see note below).
|
|
40
|
+
* `Math.round((assessed.size / applicable.length) * 100)` when
|
|
41
|
+
* `applicable.length > 0`, else `0`.
|
|
42
|
+
*
|
|
43
|
+
* Edge cases consumers should be aware of:
|
|
44
|
+
* - `applicable: []` always yields `coveragePct: 0` regardless
|
|
45
|
+
* of how many `assessed` frameworks exist.
|
|
46
|
+
* - If `assessed.size > applicable.length` (a system assessed
|
|
47
|
+
* against frameworks outside its applicable list), the
|
|
48
|
+
* percentage exceeds 100. Kernel does NOT filter
|
|
49
|
+
* `assessed` to `applicable`-only — faithful courier.
|
|
50
|
+
*/
|
|
51
|
+
coveragePct: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Wire shape for a single per-system compliance result. Source-of-truth
|
|
55
|
+
* at kernel `src/app/api/v1/compliance-check/route.ts:150-164`.
|
|
56
|
+
*
|
|
57
|
+
* Synthesized at handler-time, NOT a Drizzle row. The route iterates
|
|
58
|
+
* target systems, queries assessments + attestations + risk
|
|
59
|
+
* classifications, and emits these 7 fields. There is no row-to-wire
|
|
60
|
+
* mapper module (unlike `auditLog.export`'s `rowToWireJson`); the
|
|
61
|
+
* literal object shape lives inline in the route's `results.push({...})`
|
|
62
|
+
* call. The drift pin in `sdk-drift.test.ts` reads the route source
|
|
63
|
+
* and asserts the literal property names match this interface.
|
|
64
|
+
*
|
|
65
|
+
* **`compliant` field — implicit threshold of 70**:
|
|
66
|
+
* `compliant === activeAttestations > 0 && (overallScore === null || overallScore >= 70)`.
|
|
67
|
+
* Two qualifying clauses:
|
|
68
|
+
* 1. `activeAttestations > 0` — must have at least one currently
|
|
69
|
+
* active (non-expired) attestation.
|
|
70
|
+
* 2. `overallScore === null` (no scored assessment yet — counts as
|
|
71
|
+
* NOT-FAILING) **OR** `overallScore >= 70`.
|
|
72
|
+
*
|
|
73
|
+
* The 70 threshold is a kernel-side business policy. The SDK does NOT
|
|
74
|
+
* re-derive — faithful courier. Consumers wanting a different bar can
|
|
75
|
+
* apply it post-hoc via the `score` field.
|
|
76
|
+
*/
|
|
77
|
+
export interface ComplianceCheckResult {
|
|
78
|
+
/** UUID. */
|
|
79
|
+
systemId: string;
|
|
80
|
+
/** From `aiSystems.name`. */
|
|
81
|
+
systemName: string;
|
|
82
|
+
/**
|
|
83
|
+
* Compound boolean — see "implicit threshold of 70" note above.
|
|
84
|
+
* `false` when `activeAttestations === 0`, OR when there's a
|
|
85
|
+
* scored assessment with `overallScore < 70`. `true` otherwise.
|
|
86
|
+
*/
|
|
87
|
+
compliant: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Numeric overall score from the LATEST `completed` assessment's
|
|
90
|
+
* `scores.overallScore` jsonb field, IF that field is a `number`.
|
|
91
|
+
* `null` when:
|
|
92
|
+
* - No completed assessment exists for this system, OR
|
|
93
|
+
* - The latest completed assessment's `scores.overallScore` is
|
|
94
|
+
* missing or non-numeric (kernel typeguards `typeof === "number"`).
|
|
95
|
+
* Range is unbounded — kernel does not clamp 0..100.
|
|
96
|
+
*/
|
|
97
|
+
score: number | null;
|
|
98
|
+
/** See `ComplianceCheckFrameworkCoverage`. */
|
|
99
|
+
frameworkCoverage: ComplianceCheckFrameworkCoverage;
|
|
100
|
+
/**
|
|
101
|
+
* Count of currently-active attestation rows — defined as
|
|
102
|
+
* `attestations.status === "active"` AND
|
|
103
|
+
* (`attestations.expiresAt === null` OR `attestations.expiresAt > now`).
|
|
104
|
+
* Non-negative integer.
|
|
105
|
+
*/
|
|
106
|
+
activeAttestations: number;
|
|
107
|
+
/**
|
|
108
|
+
* ISO-8601 from the LATEST `completed` assessment's `completedAt`,
|
|
109
|
+
* or `null` if no completed assessment exists. The kernel sorts
|
|
110
|
+
* completed assessments DESC by `completedAt` and takes the first.
|
|
111
|
+
*/
|
|
112
|
+
lastAssessedAt: string | null;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Top-level wire shape returned by `complianceCheck.check()`.
|
|
116
|
+
* Source-of-truth at kernel `src/app/api/v1/compliance-check/route.ts:167-170`.
|
|
117
|
+
*
|
|
118
|
+
* `systems` cardinality:
|
|
119
|
+
* - **systemId path**: exactly 1 system on 200 (kernel returns 404
|
|
120
|
+
* if not found). Never empty.
|
|
121
|
+
* - **orgName path**: 0..100 systems (kernel hardcodes `.limit(100)`
|
|
122
|
+
* at route.ts:107). Empty array is a valid 200 response (org has
|
|
123
|
+
* no systems). **Truncation past 100 is silent** — see JSDoc on
|
|
124
|
+
* `check()`.
|
|
125
|
+
*
|
|
126
|
+
* `checkedAt` is server-generated at handler end via
|
|
127
|
+
* `new Date().toISOString()` — uniquely identifies the snapshot.
|
|
128
|
+
* Consumers may use it as a freshness marker.
|
|
129
|
+
*/
|
|
130
|
+
export interface ComplianceCheckResponse {
|
|
131
|
+
systems: ComplianceCheckResult[];
|
|
132
|
+
/** ISO-8601, server-generated at handler end. */
|
|
133
|
+
checkedAt: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Mutually-exclusive input shapes — modeled as a TypeScript
|
|
137
|
+
* discriminated union so TS-typed callers cannot pass both at compile
|
|
138
|
+
* time (the `?: never` exclusion on each branch makes "both" a type
|
|
139
|
+
* error). Runtime guard rejects "both" too, for JS callers and
|
|
140
|
+
* `as any` casts.
|
|
141
|
+
*
|
|
142
|
+
* **The kernel is NOT strict XOR** — when both are provided, kernel
|
|
143
|
+
* silently uses `systemId` and ignores `orgName` (route.ts:80-87).
|
|
144
|
+
* The SDK is **stricter** than the kernel — rejects "both" with a
|
|
145
|
+
* clear `TypeError`. This protects consumers from silent
|
|
146
|
+
* shadow-of-orgName bugs (D3 / invariant candidate #46).
|
|
147
|
+
*
|
|
148
|
+
* **Input properties must be enumerable** (faithful courier). The
|
|
149
|
+
* runtime XOR check uses `Object.hasOwn` which returns `true` for
|
|
150
|
+
* non-enumerable own properties as well as enumerable ones. So an
|
|
151
|
+
* input constructed via `Object.defineProperty(obj, "orgName", {
|
|
152
|
+
* value: "x", enumerable: false })` would be runtime-rejected as
|
|
153
|
+
* "both provided" even when TS treats it as the systemId-only
|
|
154
|
+
* branch. This is contrived (typical literal-object input is always
|
|
155
|
+
* enumerable; class field initializers emit enumerable own
|
|
156
|
+
* properties); the SDK does not defend against it. Hostile-review
|
|
157
|
+
* LOW #6.
|
|
158
|
+
*/
|
|
159
|
+
export type ComplianceCheckInput = {
|
|
160
|
+
/** UUID of the system to check (kernel validates format). */
|
|
161
|
+
systemId: string;
|
|
162
|
+
/** TS-only exclusion — must be undefined when systemId is set. */
|
|
163
|
+
orgName?: never;
|
|
164
|
+
} | {
|
|
165
|
+
/** TS-only exclusion — must be undefined when orgName is set. */
|
|
166
|
+
systemId?: never;
|
|
167
|
+
/**
|
|
168
|
+
* Open-string org name to look up. Kernel resolves to an org
|
|
169
|
+
* row by exact name match. The org MUST be the same as the API
|
|
170
|
+
* key's org — cross-org returns 403. Returns up to 100 systems
|
|
171
|
+
* (kernel hardcodes `.limit(100)`).
|
|
172
|
+
*/
|
|
173
|
+
orgName: string;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* ComplianceCheck resource — sibling to `IncidentsResource`,
|
|
177
|
+
* `DecisionsResource`, `ChatResource`, `AuditLogResource`,
|
|
178
|
+
* `RegulatoryChangesResource`. Today wraps a single endpoint
|
|
179
|
+
* (`check`); the class is the landing pad for future compliance-check
|
|
180
|
+
* methods if the kernel adds them (resource-class-per-kernel-resource
|
|
181
|
+
* convention, invariant candidate #43).
|
|
182
|
+
*/
|
|
183
|
+
export declare class ComplianceCheckResource {
|
|
184
|
+
private readonly client;
|
|
185
|
+
constructor(client: AttestryClient);
|
|
186
|
+
/**
|
|
187
|
+
* Return a per-system compliance summary for either a single system
|
|
188
|
+
* (by UUID) or every system in an org (by org name, capped at 100).
|
|
189
|
+
* Returns `Promise<ComplianceCheckResponse>` — sync JSON, no
|
|
190
|
+
* pagination, no streaming.
|
|
191
|
+
*
|
|
192
|
+
* **Input mode — XOR with kernel quirk** (read carefully): exactly
|
|
193
|
+
* one of `systemId` OR `orgName` must be provided. The kernel is
|
|
194
|
+
* NOT strictly XOR — when both are provided, kernel silently picks
|
|
195
|
+
* `systemId` and ignores `orgName`. The SDK is **stricter** than
|
|
196
|
+
* the kernel and synchronously throws `TypeError` when both are
|
|
197
|
+
* provided. This is a deliberate D3 deviation: the kernel's
|
|
198
|
+
* silent-pick is a quirk that future maintenance could change at
|
|
199
|
+
* any time, and surfacing the conflict at the SDK boundary makes
|
|
200
|
+
* consumer code stable across kernel revisions.
|
|
201
|
+
*
|
|
202
|
+
* **Multi-permission UNION auth scope**: kernel uses
|
|
203
|
+
* `requireApiKeyWithPermission(req, READ_SYSTEMS, READ_ASSESSMENTS)`
|
|
204
|
+
* which is OR semantics (`Array.some()` at
|
|
205
|
+
* `permissions.ts:53-55`). A key with EITHER permission (or `ADMIN`,
|
|
206
|
+
* or null/empty permissions for backwards-compat) succeeds.
|
|
207
|
+
* **HTTP 401** for no/invalid API key, **HTTP 403** for an
|
|
208
|
+
* authenticated key that has NEITHER required permission. Pin
|
|
209
|
+
* BOTH branches separately. **Distinct from `auditLog.export`** in
|
|
210
|
+
* the auth MODEL — that route is ADMIN-only dual-auth — but NOT in
|
|
211
|
+
* the status surface: `auditLog.export` also returns 401 vs 403
|
|
212
|
+
* distinctly (corrected session-22 hostile review #2; the prior
|
|
213
|
+
* "ADMIN-only 401-for-both" framing of invariant #42 was wrong).
|
|
214
|
+
* First SDK route to exercise multi-arg
|
|
215
|
+
* `requireApiKeyWithPermission` — invariant candidate #45.
|
|
216
|
+
*
|
|
217
|
+
* **Asymmetric cross-org error codes** (read carefully):
|
|
218
|
+
* cross-org `systemId` returns **404** (kernel collapses to
|
|
219
|
+
* "System not found" at route.ts:76 — mirror of
|
|
220
|
+
* `decisions.retrieve`); cross-org `orgName` returns **403**
|
|
221
|
+
* ("Access denied" at route.ts:95). Consumers writing defensive
|
|
222
|
+
* error-handling logic must distinguish: a 404 on systemId path
|
|
223
|
+
* may be "not your org" OR "genuine missing UUID"; a 403 on
|
|
224
|
+
* orgName path is unambiguously "the org exists but you don't
|
|
225
|
+
* own it". Invariant candidate #47.
|
|
226
|
+
*
|
|
227
|
+
* **Silent `.limit(100)` on orgName path** (read carefully): if
|
|
228
|
+
* the org has more than 100 systems, the response is silently
|
|
229
|
+
* truncated to the first 100 — NO `total` field, NO `hasMore`
|
|
230
|
+
* cursor, NO warning. The SDK does NOT mask this (faithful
|
|
231
|
+
* courier — kernel decided 100 is enough). Consumers managing
|
|
232
|
+
* >100-system orgs should switch to systemId-per-row.
|
|
233
|
+
*
|
|
234
|
+
* **`compliant` field — implicit threshold of 70**:
|
|
235
|
+
* `compliant === activeAttestations > 0 && (overallScore === null || overallScore >= 70)`.
|
|
236
|
+
* Documented in detail on `ComplianceCheckResult.compliant` —
|
|
237
|
+
* consumers wanting a different bar can apply it post-hoc via
|
|
238
|
+
* the `score` field.
|
|
239
|
+
*
|
|
240
|
+
* Errors (kernel firing precedence: rate-limit → auth → input
|
|
241
|
+
* validation, so a request with multiple problems surfaces only the
|
|
242
|
+
* highest-precedence one. Hostile-review LOW #8):
|
|
243
|
+
* - `AttestryAPIError` (status 429) — rate limit FIRES FIRST
|
|
244
|
+
* (auto-retried by default — invariant #18; per-IP rate-limit
|
|
245
|
+
* key `v1-compliance-check:${ip}`). A flooded IP gets 429 even
|
|
246
|
+
* for unauthenticated or malformed requests.
|
|
247
|
+
* - `AttestryAPIError` (status 401) — no API key OR invalid key
|
|
248
|
+
* (the `requireApiKey` branch). Fires AFTER rate-limit but
|
|
249
|
+
* BEFORE input validation.
|
|
250
|
+
* - `AttestryAPIError` (status 403) — authenticated key has
|
|
251
|
+
* NEITHER `READ_SYSTEMS` nor `READ_ASSESSMENTS` (the
|
|
252
|
+
* permission-check branch); OR cross-org orgName ("Access
|
|
253
|
+
* denied"). Distinguish via the response body's `error`
|
|
254
|
+
* message.
|
|
255
|
+
* - `AttestryAPIError` (status 400) — invalid systemId UUID
|
|
256
|
+
* format (kernel's `isValidUuid` rejection). Fires AFTER auth.
|
|
257
|
+
* The SDK does NOT pre-validate UUID format (D2: kernel is the
|
|
258
|
+
* authority). The "neither systemId nor orgName" 400 is
|
|
259
|
+
* UNREACHABLE through the SDK — pre-rejected as `TypeError`.
|
|
260
|
+
* - `AttestryAPIError` (status 404) — systemId not found OR
|
|
261
|
+
* systemId belongs to a different org (kernel collapses
|
|
262
|
+
* cross-org systemId to 404); OR orgName not found.
|
|
263
|
+
* - `AttestryAPIError` (status 500) — internal kernel error
|
|
264
|
+
* (scrubbed message via `internalErrorResponse`).
|
|
265
|
+
* - `AttestryError` ("request aborted by caller") — caller-supplied
|
|
266
|
+
* `options.signal` fired (pre-aborted or mid-flight).
|
|
267
|
+
* - `AttestryError` (P2 hardening) — kernel response failed
|
|
268
|
+
* SDK-side shape validation (not an object, missing `systems`
|
|
269
|
+
* array, missing `checkedAt` string).
|
|
270
|
+
* - `AttestryAPIError` (P3 hardening) — kernel response had a
|
|
271
|
+
* wrong Content-Type (transport-level guard before body parsing).
|
|
272
|
+
* - `TypeError` (synchronous, no fetch issued) — input failed
|
|
273
|
+
* SDK-side validation (null / array / non-object input,
|
|
274
|
+
* neither systemId nor orgName provided, both provided, empty
|
|
275
|
+
* string, non-string, lone surrogates).
|
|
276
|
+
*
|
|
277
|
+
* **Notably ABSENT**:
|
|
278
|
+
* - **No 422** — no Zod schema; no closed enums in input.
|
|
279
|
+
* - **No 413** — no body size limit (no body — GET).
|
|
280
|
+
* - **No 402** — read-only, doesn't count against decisionsPerMonth quota.
|
|
281
|
+
*
|
|
282
|
+
* **SDK-side validation** (synchronous `TypeError`, no fetch
|
|
283
|
+
* issued):
|
|
284
|
+
* - `input` itself: required; must be a non-null, non-array
|
|
285
|
+
* object.
|
|
286
|
+
* - `input.systemId` XOR `input.orgName`: exactly one must be
|
|
287
|
+
* provided. Both = `TypeError` (stricter than kernel — D3).
|
|
288
|
+
* Neither = `TypeError`.
|
|
289
|
+
* - `input.systemId` (when provided): non-empty string.
|
|
290
|
+
* Lone-surrogate guard via `assertEncodableQueryString`
|
|
291
|
+
* (carry-forward invariant #32). UUID format NOT pre-validated
|
|
292
|
+
* (D2 — kernel is the authority).
|
|
293
|
+
* - `input.orgName` (when provided): non-empty string.
|
|
294
|
+
* Lone-surrogate guard.
|
|
295
|
+
*
|
|
296
|
+
* **Response-shape validation** (P2 hardening):
|
|
297
|
+
* - Rejects with `AttestryError` if the kernel response isn't a
|
|
298
|
+
* non-null, non-array object.
|
|
299
|
+
* - Rejects if `response.systems` isn't an array.
|
|
300
|
+
* - Rejects if `response.checkedAt` isn't a string.
|
|
301
|
+
* - Per-row shape (the 7-field `ComplianceCheckResult`) is
|
|
302
|
+
* faithful-courier — NOT validated (P4 candidate).
|
|
303
|
+
*
|
|
304
|
+
* **Transport-shape validation** (P3 hardening):
|
|
305
|
+
* - Rejects with `AttestryAPIError` if the kernel responds with
|
|
306
|
+
* a non-`application/json` Content-Type — protects against
|
|
307
|
+
* proxy-injected HTML 200 pages parsing into junk consumer
|
|
308
|
+
* state.
|
|
309
|
+
*
|
|
310
|
+
* @example Compliance check by system UUID
|
|
311
|
+
* ```ts
|
|
312
|
+
* const result = await client.complianceCheck.check({
|
|
313
|
+
* systemId: "11111111-1111-1111-1111-111111111111",
|
|
314
|
+
* });
|
|
315
|
+
* for (const system of result.systems) {
|
|
316
|
+
* console.log(system.systemName, system.compliant, system.score);
|
|
317
|
+
* }
|
|
318
|
+
* ```
|
|
319
|
+
*
|
|
320
|
+
* @example Compliance check by org name (capped at 100 systems)
|
|
321
|
+
* ```ts
|
|
322
|
+
* const result = await client.complianceCheck.check({
|
|
323
|
+
* orgName: "Acme Corp",
|
|
324
|
+
* });
|
|
325
|
+
* console.log(`${result.systems.length} systems checked at ${result.checkedAt}`);
|
|
326
|
+
* ```
|
|
327
|
+
*/
|
|
328
|
+
check(input: ComplianceCheckInput, options?: RequestOptions): Promise<ComplianceCheckResponse>;
|
|
329
|
+
}
|
|
330
|
+
//# sourceMappingURL=compliance-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compliance-check.d.ts","sourceRoot":"","sources":["../../src/resources/compliance-check.ts"],"names":[],"mappings":"AAyDA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAuBlD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,gCAAgC;IAC/C;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;;;;;;OAYG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,qBAAqB;IACpC,YAAY;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;;;OAQG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,8CAA8C;IAC9C,iBAAiB,EAAE,gCAAgC,CAAC;IACpD;;;;;OAKG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IACE,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB,GACD;IACE,iEAAiE;IACjE,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEN;;;;;;;GAOG;AACH,qBAAa,uBAAuB;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6IG;IACH,KAAK,CACH,KAAK,EAAE,oBAAoB,EAC3B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,uBAAuB,CAAC;CAuIpC"}
|