@proofline/sdk 5.10.0 → 5.11.1
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 +1 -1
- package/dist/index.js +18 -8
- package/dist/schema.d.ts +48 -0
- package/dist/transport.js +4 -2
- package/openapi.public.json +75 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ This repository is the published distribution of the Proofline TypeScript SDK. T
|
|
|
21
21
|
|
|
22
22
|
## Errors and refusals
|
|
23
23
|
|
|
24
|
-
A refused request throws `ProoflineError` with the server problem's `status`, `type`, `title` and `detail`. When a review request creates nothing, the error also carries `refusal`, whose `reason` names the setting to change, such as `NO_LINKED_ENVIRONMENT` or `ENVIRONMENT_NOT_READY`, and `repositoryName`. A refusal that does not match the public contract keeps its status, `title` and `detail` with the type `urn:proofline:sdk:invalid-response` and no `refusal`. The token is redacted from every text field, and `String(error)`, `inspect(error)` and `JSON.stringify(error)` show only the status.
|
|
24
|
+
A refused request throws `ProoflineError` with the server problem's `status`, `type`, `title` and `detail`. When a review request creates nothing, the error also carries `refusal`, whose `reason` names the setting to change, such as `NO_LINKED_ENVIRONMENT` or `ENVIRONMENT_NOT_READY`, and `repositoryName`. A refusal that does not match the public contract keeps its status, `title` and `detail` with the type `urn:proofline:sdk:invalid-response` and no `refusal`. Any other status, such as the 402 a review request answers when credits cannot pay, is a plain problem with no `refusal`. The token is redacted from every text field, and `String(error)`, `inspect(error)` and `JSON.stringify(error)` show only the status.
|
|
25
25
|
|
|
26
26
|
```typescript
|
|
27
27
|
import { ProoflineError } from "@proofline/sdk";
|
package/dist/index.js
CHANGED
|
@@ -165,10 +165,7 @@ function validateReview(value, reviewId) {
|
|
|
165
165
|
typeof assessment[field] !== "string")
|
|
166
166
|
throw protocol("an assessment gap is malformed");
|
|
167
167
|
}
|
|
168
|
-
if (assessment.reason_codes
|
|
169
|
-
assessment.reason_codes !== null &&
|
|
170
|
-
(!Array.isArray(assessment.reason_codes) ||
|
|
171
|
-
!assessment.reason_codes.every((reason) => typeof reason === "string")))
|
|
168
|
+
if (!optionalTexts(assessment.reason_codes))
|
|
172
169
|
throw protocol("an assessment reason code is malformed");
|
|
173
170
|
for (const check of assessment.checks.families) {
|
|
174
171
|
if (!isObject(check) ||
|
|
@@ -233,7 +230,8 @@ function codeAssessment(review) {
|
|
|
233
230
|
!["PENDING", "RUNNING", "COMPLETED", "INCOMPLETE", "EXCLUDED"].includes(code.status) ||
|
|
234
231
|
(code.incompleteness_kind !== null &&
|
|
235
232
|
code.incompleteness_kind !== undefined &&
|
|
236
|
-
typeof code.incompleteness_kind !== "string")
|
|
233
|
+
typeof code.incompleteness_kind !== "string") ||
|
|
234
|
+
!optionalTexts(code.reason_codes))
|
|
237
235
|
return null;
|
|
238
236
|
if ((typeof review.head_commit_sha === "string" &&
|
|
239
237
|
review.head_commit_sha.toLowerCase() !==
|
|
@@ -245,6 +243,12 @@ function codeAssessment(review) {
|
|
|
245
243
|
return null;
|
|
246
244
|
return code;
|
|
247
245
|
}
|
|
246
|
+
function optionalTexts(value) {
|
|
247
|
+
return (value === undefined ||
|
|
248
|
+
value === null ||
|
|
249
|
+
(Array.isArray(value) &&
|
|
250
|
+
value.every((item) => typeof item === "string")));
|
|
251
|
+
}
|
|
248
252
|
function assessmentReasons(assessment) {
|
|
249
253
|
const reasons = [...(assessment.reason_codes ?? [])];
|
|
250
254
|
if (assessment.incompleteness_kind)
|
|
@@ -285,13 +289,19 @@ function outcome(status, reviewUrl, review, reason) {
|
|
|
285
289
|
})),
|
|
286
290
|
}));
|
|
287
291
|
const code = review && codeAssessment(review);
|
|
288
|
-
if (code &&
|
|
292
|
+
if (code &&
|
|
293
|
+
(code.status !== "COMPLETED" ||
|
|
294
|
+
code.incompleteness_kind ||
|
|
295
|
+
code.reason_codes?.length)) {
|
|
296
|
+
const reasons = [...(code.reason_codes ?? [])];
|
|
297
|
+
if (code.incompleteness_kind)
|
|
298
|
+
reasons.push(code.incompleteness_kind);
|
|
289
299
|
gaps.push({
|
|
290
300
|
assessmentId: code.id,
|
|
291
301
|
status: code.status,
|
|
292
302
|
incompletenessKind: code.incompleteness_kind ?? null,
|
|
293
|
-
reasonCodes:
|
|
294
|
-
?
|
|
303
|
+
reasonCodes: reasons.length
|
|
304
|
+
? reasons
|
|
295
305
|
: ["CODE_ASSESSMENT_STATE_UNAVAILABLE"],
|
|
296
306
|
releaseEvidenceGap: null,
|
|
297
307
|
checks: [],
|
package/dist/schema.d.ts
CHANGED
|
@@ -1485,6 +1485,12 @@ export interface components {
|
|
|
1485
1485
|
* than the reviews list and a single review.
|
|
1486
1486
|
*/
|
|
1487
1487
|
incomplete_causes?: components["schemas"]["IncompleteCause"][];
|
|
1488
|
+
/**
|
|
1489
|
+
* @description The supported findings of each environment investigation this review
|
|
1490
|
+
* published, by assessment in recorded order, including those the
|
|
1491
|
+
* pull-request Check left off its list. Absent when there are none.
|
|
1492
|
+
*/
|
|
1493
|
+
investigation_findings?: components["schemas"]["ReviewInvestigationFinding"][];
|
|
1488
1494
|
/** @description Present and true when this run is a Deep Review. */
|
|
1489
1495
|
is_deep_review?: boolean;
|
|
1490
1496
|
/**
|
|
@@ -2777,6 +2783,48 @@ export interface components {
|
|
|
2777
2783
|
*/
|
|
2778
2784
|
repositories: components["schemas"]["FilterChoice"][];
|
|
2779
2785
|
};
|
|
2786
|
+
/**
|
|
2787
|
+
* @description One environment evidence record a finding cites, as Proofline verified
|
|
2788
|
+
* it.
|
|
2789
|
+
*/
|
|
2790
|
+
ReviewInvestigationCitation: {
|
|
2791
|
+
/**
|
|
2792
|
+
* Format: uuid
|
|
2793
|
+
* @description The evidence collection that holds the record.
|
|
2794
|
+
*/
|
|
2795
|
+
collection_id: string;
|
|
2796
|
+
/** @description The record's stored digest. */
|
|
2797
|
+
digest: string;
|
|
2798
|
+
/**
|
|
2799
|
+
* Format: uuid
|
|
2800
|
+
* @description The record's ID.
|
|
2801
|
+
*/
|
|
2802
|
+
record_id: string;
|
|
2803
|
+
/** @description The table that holds the record. */
|
|
2804
|
+
table: string;
|
|
2805
|
+
};
|
|
2806
|
+
/** @description One supported finding of an environment investigation. */
|
|
2807
|
+
ReviewInvestigationFinding: {
|
|
2808
|
+
/**
|
|
2809
|
+
* @description What the finding is about: `secrets`, `configuration`, `iam`,
|
|
2810
|
+
* `network`, `capacity` or `other`.
|
|
2811
|
+
*/
|
|
2812
|
+
area: string;
|
|
2813
|
+
/**
|
|
2814
|
+
* Format: uuid
|
|
2815
|
+
* @description The environment assessment whose investigation recorded the finding.
|
|
2816
|
+
*/
|
|
2817
|
+
assessment_id: string;
|
|
2818
|
+
/**
|
|
2819
|
+
* @description The evidence records the finding cites, each verified, in the order
|
|
2820
|
+
* the finding cites them.
|
|
2821
|
+
*/
|
|
2822
|
+
citations: components["schemas"]["ReviewInvestigationCitation"][];
|
|
2823
|
+
/** @description Model text with protected values withheld. Render it as plain text. */
|
|
2824
|
+
detail: string;
|
|
2825
|
+
/** @description Model text with protected values withheld. Render it as plain text. */
|
|
2826
|
+
title: string;
|
|
2827
|
+
};
|
|
2780
2828
|
ReviewOpenItems: {
|
|
2781
2829
|
/**
|
|
2782
2830
|
* Format: uint64
|
package/dist/transport.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const VERSION = "5.
|
|
1
|
+
const VERSION = "5.11.1";
|
|
2
2
|
const MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
|
|
3
3
|
const MAX_RETRIES = 3;
|
|
4
4
|
const MAX_RETRY_SECONDS = 60;
|
|
@@ -210,7 +210,9 @@ function problem(status, value, token) {
|
|
|
210
210
|
: // Logged internal errors omit detail; the problem itself still arrived.
|
|
211
211
|
`the server returned the problem "${title}" without a detail`;
|
|
212
212
|
const fields = title === undefined ? {} : { title };
|
|
213
|
-
|
|
213
|
+
// The contract types a refusal only as a review request's 400. The 402 a
|
|
214
|
+
// credit refusal answers is undocumented, so it stays a plain problem.
|
|
215
|
+
if (status !== 400 || !("refusal" in body))
|
|
214
216
|
return new ProoflineError(status, type, detail, fields);
|
|
215
217
|
const view = refusal(body.refusal);
|
|
216
218
|
if (view === undefined ||
|
package/openapi.public.json
CHANGED
|
@@ -1851,6 +1851,13 @@
|
|
|
1851
1851
|
},
|
|
1852
1852
|
"type": "array"
|
|
1853
1853
|
},
|
|
1854
|
+
"investigation_findings": {
|
|
1855
|
+
"description": "The supported findings of each environment investigation this review\n published, by assessment in recorded order, including those the\n pull-request Check left off its list. Absent when there are none.",
|
|
1856
|
+
"items": {
|
|
1857
|
+
"$ref": "#/components/schemas/ReviewInvestigationFinding"
|
|
1858
|
+
},
|
|
1859
|
+
"type": "array"
|
|
1860
|
+
},
|
|
1854
1861
|
"is_deep_review": {
|
|
1855
1862
|
"description": "Present and true when this run is a Deep Review.",
|
|
1856
1863
|
"type": "boolean"
|
|
@@ -4529,6 +4536,73 @@
|
|
|
4529
4536
|
],
|
|
4530
4537
|
"type": "object"
|
|
4531
4538
|
},
|
|
4539
|
+
"ReviewInvestigationCitation": {
|
|
4540
|
+
"description": "One environment evidence record a finding cites, as Proofline verified\n it.",
|
|
4541
|
+
"properties": {
|
|
4542
|
+
"collection_id": {
|
|
4543
|
+
"description": "The evidence collection that holds the record.",
|
|
4544
|
+
"format": "uuid",
|
|
4545
|
+
"type": "string"
|
|
4546
|
+
},
|
|
4547
|
+
"digest": {
|
|
4548
|
+
"description": "The record's stored digest.",
|
|
4549
|
+
"type": "string"
|
|
4550
|
+
},
|
|
4551
|
+
"record_id": {
|
|
4552
|
+
"description": "The record's ID.",
|
|
4553
|
+
"format": "uuid",
|
|
4554
|
+
"type": "string"
|
|
4555
|
+
},
|
|
4556
|
+
"table": {
|
|
4557
|
+
"description": "The table that holds the record.",
|
|
4558
|
+
"type": "string"
|
|
4559
|
+
}
|
|
4560
|
+
},
|
|
4561
|
+
"required": [
|
|
4562
|
+
"collection_id",
|
|
4563
|
+
"table",
|
|
4564
|
+
"record_id",
|
|
4565
|
+
"digest"
|
|
4566
|
+
],
|
|
4567
|
+
"type": "object"
|
|
4568
|
+
},
|
|
4569
|
+
"ReviewInvestigationFinding": {
|
|
4570
|
+
"description": "One supported finding of an environment investigation.",
|
|
4571
|
+
"properties": {
|
|
4572
|
+
"area": {
|
|
4573
|
+
"description": "What the finding is about: `secrets`, `configuration`, `iam`,\n `network`, `capacity` or `other`.",
|
|
4574
|
+
"type": "string"
|
|
4575
|
+
},
|
|
4576
|
+
"assessment_id": {
|
|
4577
|
+
"description": "The environment assessment whose investigation recorded the finding.",
|
|
4578
|
+
"format": "uuid",
|
|
4579
|
+
"type": "string"
|
|
4580
|
+
},
|
|
4581
|
+
"citations": {
|
|
4582
|
+
"description": "The evidence records the finding cites, each verified, in the order\n the finding cites them.",
|
|
4583
|
+
"items": {
|
|
4584
|
+
"$ref": "#/components/schemas/ReviewInvestigationCitation"
|
|
4585
|
+
},
|
|
4586
|
+
"type": "array"
|
|
4587
|
+
},
|
|
4588
|
+
"detail": {
|
|
4589
|
+
"description": "Model text with protected values withheld. Render it as plain text.",
|
|
4590
|
+
"type": "string"
|
|
4591
|
+
},
|
|
4592
|
+
"title": {
|
|
4593
|
+
"description": "Model text with protected values withheld. Render it as plain text.",
|
|
4594
|
+
"type": "string"
|
|
4595
|
+
}
|
|
4596
|
+
},
|
|
4597
|
+
"required": [
|
|
4598
|
+
"assessment_id",
|
|
4599
|
+
"area",
|
|
4600
|
+
"title",
|
|
4601
|
+
"detail",
|
|
4602
|
+
"citations"
|
|
4603
|
+
],
|
|
4604
|
+
"type": "object"
|
|
4605
|
+
},
|
|
4532
4606
|
"ReviewOpenItems": {
|
|
4533
4607
|
"properties": {
|
|
4534
4608
|
"accepted_risk_count": {
|
|
@@ -6157,7 +6231,7 @@
|
|
|
6157
6231
|
},
|
|
6158
6232
|
"info": {
|
|
6159
6233
|
"title": "Proofline Review API",
|
|
6160
|
-
"version": "5.
|
|
6234
|
+
"version": "5.11.0"
|
|
6161
6235
|
},
|
|
6162
6236
|
"openapi": "3.1.0",
|
|
6163
6237
|
"paths": {
|