@proofline/sdk 5.11.0 → 5.11.2
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 +21 -9
- package/dist/schema.d.ts +32 -0
- package/dist/transport.js +4 -2
- package/openapi.public.json +16 -0
- 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) ||
|
|
@@ -205,7 +202,9 @@ function terminal(review) {
|
|
|
205
202
|
return "INCOMPLETE";
|
|
206
203
|
if (review.assessments.length === 0) {
|
|
207
204
|
const code = codeAssessment(review);
|
|
208
|
-
return code?.status === "COMPLETED" &&
|
|
205
|
+
return code?.status === "COMPLETED" &&
|
|
206
|
+
!code.incompleteness_kind &&
|
|
207
|
+
!code.reason_codes?.length
|
|
209
208
|
? "COMPLETED"
|
|
210
209
|
: "INCOMPLETE";
|
|
211
210
|
}
|
|
@@ -233,7 +232,8 @@ function codeAssessment(review) {
|
|
|
233
232
|
!["PENDING", "RUNNING", "COMPLETED", "INCOMPLETE", "EXCLUDED"].includes(code.status) ||
|
|
234
233
|
(code.incompleteness_kind !== null &&
|
|
235
234
|
code.incompleteness_kind !== undefined &&
|
|
236
|
-
typeof code.incompleteness_kind !== "string")
|
|
235
|
+
typeof code.incompleteness_kind !== "string") ||
|
|
236
|
+
!optionalTexts(code.reason_codes))
|
|
237
237
|
return null;
|
|
238
238
|
if ((typeof review.head_commit_sha === "string" &&
|
|
239
239
|
review.head_commit_sha.toLowerCase() !==
|
|
@@ -245,6 +245,12 @@ function codeAssessment(review) {
|
|
|
245
245
|
return null;
|
|
246
246
|
return code;
|
|
247
247
|
}
|
|
248
|
+
function optionalTexts(value) {
|
|
249
|
+
return (value === undefined ||
|
|
250
|
+
value === null ||
|
|
251
|
+
(Array.isArray(value) &&
|
|
252
|
+
value.every((item) => typeof item === "string")));
|
|
253
|
+
}
|
|
248
254
|
function assessmentReasons(assessment) {
|
|
249
255
|
const reasons = [...(assessment.reason_codes ?? [])];
|
|
250
256
|
if (assessment.incompleteness_kind)
|
|
@@ -285,13 +291,19 @@ function outcome(status, reviewUrl, review, reason) {
|
|
|
285
291
|
})),
|
|
286
292
|
}));
|
|
287
293
|
const code = review && codeAssessment(review);
|
|
288
|
-
if (code &&
|
|
294
|
+
if (code &&
|
|
295
|
+
(code.status !== "COMPLETED" ||
|
|
296
|
+
code.incompleteness_kind ||
|
|
297
|
+
code.reason_codes?.length)) {
|
|
298
|
+
const reasons = [...(code.reason_codes ?? [])];
|
|
299
|
+
if (code.incompleteness_kind)
|
|
300
|
+
reasons.push(code.incompleteness_kind);
|
|
289
301
|
gaps.push({
|
|
290
302
|
assessmentId: code.id,
|
|
291
303
|
status: code.status,
|
|
292
304
|
incompletenessKind: code.incompleteness_kind ?? null,
|
|
293
|
-
reasonCodes:
|
|
294
|
-
?
|
|
305
|
+
reasonCodes: reasons.length
|
|
306
|
+
? reasons
|
|
295
307
|
: ["CODE_ASSESSMENT_STATE_UNAVAILABLE"],
|
|
296
308
|
releaseEvidenceGap: null,
|
|
297
309
|
checks: [],
|
package/dist/schema.d.ts
CHANGED
|
@@ -4307,16 +4307,32 @@ export interface operations {
|
|
|
4307
4307
|
* findings, FAILED/INCOMPLETE/STOPPED execution, or an earlier reviewed commit.
|
|
4308
4308
|
*/
|
|
4309
4309
|
attention?: string | null;
|
|
4310
|
+
/**
|
|
4311
|
+
* @description `mine` for the caller's own pull requests, or a GitHub user ID. `mine`
|
|
4312
|
+
* needs a person's sign-in or token.
|
|
4313
|
+
*/
|
|
4310
4314
|
author?: string | null;
|
|
4311
4315
|
cursor?: string | null;
|
|
4312
4316
|
environment?: string | null;
|
|
4317
|
+
/**
|
|
4318
|
+
* @description `present` lists reviews with at least one finding; `none` lists reviews
|
|
4319
|
+
* with no finding.
|
|
4320
|
+
*/
|
|
4313
4321
|
findings?: string | null;
|
|
4322
|
+
/**
|
|
4323
|
+
* @description One review kind: `PULL_REQUEST`, `DEPLOYMENT`, `PATCH`, `COMMIT`,
|
|
4324
|
+
* `FILES`, `MERGE_GROUP` or `REVISION_SCAN`.
|
|
4325
|
+
*/
|
|
4314
4326
|
kind?: string | null;
|
|
4315
4327
|
limit?: number | null;
|
|
4316
4328
|
/** @description Qualifiers, quoted values, AND/OR, groups and minus exclusions. */
|
|
4317
4329
|
query?: string | null;
|
|
4318
4330
|
repository?: string | null;
|
|
4319
4331
|
search?: string | null;
|
|
4332
|
+
/**
|
|
4333
|
+
* @description One review status: `PENDING`, `RUNNING`, `COMPLETED`, `INCOMPLETE`,
|
|
4334
|
+
* `FAILED`, `SUPERSEDED`, `STOPPED` or `EXCLUDED`.
|
|
4335
|
+
*/
|
|
4320
4336
|
status?: string | null;
|
|
4321
4337
|
};
|
|
4322
4338
|
header?: never;
|
|
@@ -4385,16 +4401,32 @@ export interface operations {
|
|
|
4385
4401
|
* findings, FAILED/INCOMPLETE/STOPPED execution, or an earlier reviewed commit.
|
|
4386
4402
|
*/
|
|
4387
4403
|
attention?: string | null;
|
|
4404
|
+
/**
|
|
4405
|
+
* @description `mine` for the caller's own pull requests, or a GitHub user ID. `mine`
|
|
4406
|
+
* needs a person's sign-in or token.
|
|
4407
|
+
*/
|
|
4388
4408
|
author?: string | null;
|
|
4389
4409
|
cursor?: string | null;
|
|
4390
4410
|
environment?: string | null;
|
|
4411
|
+
/**
|
|
4412
|
+
* @description `present` lists reviews with at least one finding; `none` lists reviews
|
|
4413
|
+
* with no finding.
|
|
4414
|
+
*/
|
|
4391
4415
|
findings?: string | null;
|
|
4416
|
+
/**
|
|
4417
|
+
* @description One review kind: `PULL_REQUEST`, `DEPLOYMENT`, `PATCH`, `COMMIT`,
|
|
4418
|
+
* `FILES`, `MERGE_GROUP` or `REVISION_SCAN`.
|
|
4419
|
+
*/
|
|
4392
4420
|
kind?: string | null;
|
|
4393
4421
|
limit?: number | null;
|
|
4394
4422
|
/** @description Qualifiers, quoted values, AND/OR, groups and minus exclusions. */
|
|
4395
4423
|
query?: string | null;
|
|
4396
4424
|
repository?: string | null;
|
|
4397
4425
|
search?: string | null;
|
|
4426
|
+
/**
|
|
4427
|
+
* @description One review status: `PENDING`, `RUNNING`, `COMPLETED`, `INCOMPLETE`,
|
|
4428
|
+
* `FAILED`, `SUPERSEDED`, `STOPPED` or `EXCLUDED`.
|
|
4429
|
+
*/
|
|
4398
4430
|
status?: string | null;
|
|
4399
4431
|
};
|
|
4400
4432
|
header?: never;
|
package/dist/transport.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const VERSION = "5.11.
|
|
1
|
+
const VERSION = "5.11.2";
|
|
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
|
@@ -7305,9 +7305,11 @@
|
|
|
7305
7305
|
"style": "form"
|
|
7306
7306
|
},
|
|
7307
7307
|
{
|
|
7308
|
+
"description": "`mine` for the caller's own pull requests, or a GitHub user ID. `mine`\n needs a person's sign-in or token.",
|
|
7308
7309
|
"in": "query",
|
|
7309
7310
|
"name": "author",
|
|
7310
7311
|
"schema": {
|
|
7312
|
+
"description": "`mine` for the caller's own pull requests, or a GitHub user ID. `mine`\n needs a person's sign-in or token.",
|
|
7311
7313
|
"type": [
|
|
7312
7314
|
"string",
|
|
7313
7315
|
"null"
|
|
@@ -7339,9 +7341,11 @@
|
|
|
7339
7341
|
"style": "form"
|
|
7340
7342
|
},
|
|
7341
7343
|
{
|
|
7344
|
+
"description": "`present` lists reviews with at least one finding; `none` lists reviews\n with no finding.",
|
|
7342
7345
|
"in": "query",
|
|
7343
7346
|
"name": "findings",
|
|
7344
7347
|
"schema": {
|
|
7348
|
+
"description": "`present` lists reviews with at least one finding; `none` lists reviews\n with no finding.",
|
|
7345
7349
|
"type": [
|
|
7346
7350
|
"string",
|
|
7347
7351
|
"null"
|
|
@@ -7350,9 +7354,11 @@
|
|
|
7350
7354
|
"style": "form"
|
|
7351
7355
|
},
|
|
7352
7356
|
{
|
|
7357
|
+
"description": "One review kind: `PULL_REQUEST`, `DEPLOYMENT`, `PATCH`, `COMMIT`,\n `FILES`, `MERGE_GROUP` or `REVISION_SCAN`.",
|
|
7353
7358
|
"in": "query",
|
|
7354
7359
|
"name": "kind",
|
|
7355
7360
|
"schema": {
|
|
7361
|
+
"description": "One review kind: `PULL_REQUEST`, `DEPLOYMENT`, `PATCH`, `COMMIT`,\n `FILES`, `MERGE_GROUP` or `REVISION_SCAN`.",
|
|
7356
7362
|
"type": [
|
|
7357
7363
|
"string",
|
|
7358
7364
|
"null"
|
|
@@ -7409,9 +7415,11 @@
|
|
|
7409
7415
|
"style": "form"
|
|
7410
7416
|
},
|
|
7411
7417
|
{
|
|
7418
|
+
"description": "One review status: `PENDING`, `RUNNING`, `COMPLETED`, `INCOMPLETE`,\n `FAILED`, `SUPERSEDED`, `STOPPED` or `EXCLUDED`.",
|
|
7412
7419
|
"in": "query",
|
|
7413
7420
|
"name": "status",
|
|
7414
7421
|
"schema": {
|
|
7422
|
+
"description": "One review status: `PENDING`, `RUNNING`, `COMPLETED`, `INCOMPLETE`,\n `FAILED`, `SUPERSEDED`, `STOPPED` or `EXCLUDED`.",
|
|
7415
7423
|
"type": [
|
|
7416
7424
|
"string",
|
|
7417
7425
|
"null"
|
|
@@ -7569,9 +7577,11 @@
|
|
|
7569
7577
|
"style": "form"
|
|
7570
7578
|
},
|
|
7571
7579
|
{
|
|
7580
|
+
"description": "`mine` for the caller's own pull requests, or a GitHub user ID. `mine`\n needs a person's sign-in or token.",
|
|
7572
7581
|
"in": "query",
|
|
7573
7582
|
"name": "author",
|
|
7574
7583
|
"schema": {
|
|
7584
|
+
"description": "`mine` for the caller's own pull requests, or a GitHub user ID. `mine`\n needs a person's sign-in or token.",
|
|
7575
7585
|
"type": [
|
|
7576
7586
|
"string",
|
|
7577
7587
|
"null"
|
|
@@ -7603,9 +7613,11 @@
|
|
|
7603
7613
|
"style": "form"
|
|
7604
7614
|
},
|
|
7605
7615
|
{
|
|
7616
|
+
"description": "`present` lists reviews with at least one finding; `none` lists reviews\n with no finding.",
|
|
7606
7617
|
"in": "query",
|
|
7607
7618
|
"name": "findings",
|
|
7608
7619
|
"schema": {
|
|
7620
|
+
"description": "`present` lists reviews with at least one finding; `none` lists reviews\n with no finding.",
|
|
7609
7621
|
"type": [
|
|
7610
7622
|
"string",
|
|
7611
7623
|
"null"
|
|
@@ -7614,9 +7626,11 @@
|
|
|
7614
7626
|
"style": "form"
|
|
7615
7627
|
},
|
|
7616
7628
|
{
|
|
7629
|
+
"description": "One review kind: `PULL_REQUEST`, `DEPLOYMENT`, `PATCH`, `COMMIT`,\n `FILES`, `MERGE_GROUP` or `REVISION_SCAN`.",
|
|
7617
7630
|
"in": "query",
|
|
7618
7631
|
"name": "kind",
|
|
7619
7632
|
"schema": {
|
|
7633
|
+
"description": "One review kind: `PULL_REQUEST`, `DEPLOYMENT`, `PATCH`, `COMMIT`,\n `FILES`, `MERGE_GROUP` or `REVISION_SCAN`.",
|
|
7620
7634
|
"type": [
|
|
7621
7635
|
"string",
|
|
7622
7636
|
"null"
|
|
@@ -7673,9 +7687,11 @@
|
|
|
7673
7687
|
"style": "form"
|
|
7674
7688
|
},
|
|
7675
7689
|
{
|
|
7690
|
+
"description": "One review status: `PENDING`, `RUNNING`, `COMPLETED`, `INCOMPLETE`,\n `FAILED`, `SUPERSEDED`, `STOPPED` or `EXCLUDED`.",
|
|
7676
7691
|
"in": "query",
|
|
7677
7692
|
"name": "status",
|
|
7678
7693
|
"schema": {
|
|
7694
|
+
"description": "One review status: `PENDING`, `RUNNING`, `COMPLETED`, `INCOMPLETE`,\n `FAILED`, `SUPERSEDED`, `STOPPED` or `EXCLUDED`.",
|
|
7679
7695
|
"type": [
|
|
7680
7696
|
"string",
|
|
7681
7697
|
"null"
|