@yadsh/dsh-qa-integrations 0.10.1 → 0.10.3
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/lib/broker.js +83 -0
- package/lib/broker.js.map +1 -1
- package/lib/client/operator-controls.js +4 -1
- package/lib/client/operator-controls.js.map +1 -1
- package/lib/client/provider-card.js +4 -7
- package/lib/client/provider-card.js.map +1 -1
- package/lib/client.js +2283 -2284
- package/lib/client.js.map +1 -1
- package/lib/errors.js +7 -0
- package/lib/errors.js.map +1 -1
- package/lib/providers/bitrix24/transport.js +10 -3
- package/lib/providers/bitrix24/transport.js.map +1 -1
- package/lib/providers/kernel/errors.js +4 -1
- package/lib/providers/kernel/errors.js.map +1 -1
- package/lib/providers/kernel/read-policy.js +112 -13
- package/lib/providers/kernel/read-policy.js.map +1 -1
- package/lib/providers/teamcity/transport.js +6 -1
- package/lib/providers/teamcity/transport.js.map +1 -1
- package/lib/providers/testit/transport.js +6 -1
- package/lib/providers/testit/transport.js.map +1 -1
- package/lib/providers/weblate/transport.js +6 -1
- package/lib/providers/weblate/transport.js.map +1 -1
- package/lib/types/broker.d.ts +40 -0
- package/lib/types/client/operator-controls.d.ts +12 -0
- package/lib/types/errors.d.ts +21 -0
- package/lib/types/providers/kernel/errors.d.ts +5 -3
- package/lib/types/providers/kernel/read-policy.d.ts +62 -6
- package/locale/en.json +6 -0
- package/package.json +4 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IntegrationError, type TransportBudget } from "../../errors.js";
|
|
1
|
+
import { IntegrationError, type TransportBudget, type TransportDiagnostics } from "../../errors.js";
|
|
2
2
|
export declare const RETRY_CAP_MS = 2000;
|
|
3
3
|
export declare const BACKOFF_BASE_MS = 250;
|
|
4
4
|
/** Upstream codes that mean "the TLS handshake did not succeed". */
|
|
@@ -15,9 +15,43 @@ export interface BoundedText {
|
|
|
15
15
|
}
|
|
16
16
|
export declare function numberFrom(value: string | null): number | undefined;
|
|
17
17
|
export declare function looksBinary(contentType: string | null, bytes: Uint8Array): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether an unreadable JSON body is a sign-in page. Either half answers it: the
|
|
20
|
+
* media type the gateway declared, or the document's own opening. An upstream
|
|
21
|
+
* that moved its login behind the API path answers 200 with HTML, and that is a
|
|
22
|
+
* refused credential, not a malformed one.
|
|
23
|
+
*/
|
|
24
|
+
export declare function looksLikeSignInPage(contentType: string | null, text: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether an answer is a redirect rather than data.
|
|
27
|
+
*
|
|
28
|
+
* Every transport of this package refuses to follow one — the credential must
|
|
29
|
+
* not travel to another origin — so a 3xx is always an answer this deployment
|
|
30
|
+
* read itself, never an address it was told to try.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isRedirectStatus(status: number): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* What a redirect means here: an upstream that no longer accepts the stored
|
|
35
|
+
* credential sends its caller to the sign-in page instead of answering. Folding
|
|
36
|
+
* it into `ProviderUnavailable` is what made an expired key read as an outage —
|
|
37
|
+
* one phrase for a dead token and a host that is down, no action in either.
|
|
38
|
+
*/
|
|
39
|
+
export declare function credentialRedirectFailure(label: string): IntegrationError;
|
|
40
|
+
/**
|
|
41
|
+
* The same refusal for the upstream that answers with a login page and calls it
|
|
42
|
+
* 200: the credential is spent either way, and the operator's action is one.
|
|
43
|
+
*/
|
|
44
|
+
export declare function credentialPageFailure(label: string): IntegrationError;
|
|
18
45
|
export declare function sleep(ms: number): Promise<void>;
|
|
19
46
|
/** The first upstream error code in a fetch failure chain, if any. */
|
|
20
47
|
export declare function causeCode(error: unknown): string;
|
|
48
|
+
/**
|
|
49
|
+
* The class of a transport failure, as a log may name it: the upstream code
|
|
50
|
+
* where there is one (`ECONNREFUSED`, `UND_ERR_SOCKET`), the error's own name
|
|
51
|
+
* otherwise. A short token, and nothing a header value or a message could
|
|
52
|
+
* smuggle into a log line.
|
|
53
|
+
*/
|
|
54
|
+
export declare function errorClassOf(error: unknown): string;
|
|
21
55
|
export declare function backoff(response: Response, attempt: number): number;
|
|
22
56
|
export declare function retryDelay(attempt: number): number;
|
|
23
57
|
/**
|
|
@@ -42,7 +76,9 @@ export declare function readBoundedText(response: Response, maxBytes: number, la
|
|
|
42
76
|
* classification are the shared policy; a transport only supplies the label it
|
|
43
77
|
* answers with, so the same limit cannot mean "narrow the request" in one
|
|
44
78
|
* provider and "try again later" in another, and no transport can quietly skip
|
|
45
|
-
* either of them.
|
|
79
|
+
* either of them. An unreadable body that is a sign-in page is the refused
|
|
80
|
+
* credential the status fold would have named, had the upstream answered with a
|
|
81
|
+
* status for it.
|
|
46
82
|
*/
|
|
47
83
|
export declare function readBoundedJson<T>(response: Response, maxBytes: number, label: string, signal: AbortSignal): Promise<T>;
|
|
48
84
|
/**
|
|
@@ -75,6 +111,21 @@ export declare const RESEND_AFTER_EVERY_FAULT: TransportRetriable;
|
|
|
75
111
|
* asked for and what it cost.
|
|
76
112
|
*/
|
|
77
113
|
export declare function withTransportBudget(error: IntegrationError, budget: TransportBudget): IntegrationError;
|
|
114
|
+
/**
|
|
115
|
+
* Write what the upstream answer looked like onto the failure that carries it
|
|
116
|
+
* out, beside the budget that answer cost. The broker reports the refusal and
|
|
117
|
+
* knows the provider and the operation; only the loop ever held the response,
|
|
118
|
+
* and only the loop ever saw a fetch that raised. Facts about the shape of the
|
|
119
|
+
* answer — a status, a media type, a transport error class — and nothing of its
|
|
120
|
+
* content.
|
|
121
|
+
*/
|
|
122
|
+
export declare function withTransportDiagnostics(error: IntegrationError, facts: TransportDiagnostics): IntegrationError;
|
|
123
|
+
/**
|
|
124
|
+
* What an answer that arrived left for a log to say about it. Exported for the
|
|
125
|
+
* transports with a loop of their own, so a refusal reads alike whichever of
|
|
126
|
+
* them produced it.
|
|
127
|
+
*/
|
|
128
|
+
export declare function answerDiagnostics(response: Response): TransportDiagnostics;
|
|
78
129
|
/**
|
|
79
130
|
* How a provider folds transport outcomes into its own safe domain errors:
|
|
80
131
|
* each transport keeps the wording, the shared loop keeps the mechanics.
|
|
@@ -90,7 +141,11 @@ export interface FetchRetryPolicy {
|
|
|
90
141
|
* DEADLINE_IS_THE_BUDGET} unless the provider names its choice.
|
|
91
142
|
*/
|
|
92
143
|
readonly retriable?: TransportRetriable;
|
|
93
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* Fold a non-2xx answer into the provider's safe domain error. A redirect
|
|
146
|
+
* reaches it too: the loop refuses to follow one, so the answer the provider
|
|
147
|
+
* sees is the one the upstream gave the credential.
|
|
148
|
+
*/
|
|
94
149
|
readonly statusFailure: (response: Response) => IntegrationError;
|
|
95
150
|
}
|
|
96
151
|
/**
|
|
@@ -110,9 +165,10 @@ export type ResponseRead<T> = (response: Response, signal: AbortSignal) => Promi
|
|
|
110
165
|
* retried by this loop unless its status says the upstream fault may be gone on
|
|
111
166
|
* a later try, and what `read` refuses on its own (a body over the cap, a body
|
|
112
167
|
* that is not JSON) stays the domain error it named. Whatever the loop hands
|
|
113
|
-
* back from a transport give-up carries the budget it spent
|
|
114
|
-
*
|
|
115
|
-
*
|
|
168
|
+
* back from a transport give-up carries the budget it spent and the shape of the
|
|
169
|
+
* answer it met — a status, a media type, the class of the failure — because the
|
|
170
|
+
* party reporting that failure to the operator knows the call and none of the
|
|
171
|
+
* arithmetic or the exchange behind it.
|
|
116
172
|
*/
|
|
117
173
|
export declare function fetchWithRetries<T>(fetcher: typeof fetch, target: string, policy: FetchRetryPolicy, read: ResponseRead<T>): Promise<T>;
|
|
118
174
|
//# sourceMappingURL=read-policy.d.ts.map
|
package/locale/en.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yadsh/dsh-qa-integrations",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "Principal-scoped, encrypted user integrations for DSH QA Surface",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,12 +36,14 @@
|
|
|
36
36
|
"types": "./lib/types/types.d.ts",
|
|
37
37
|
"default": "./lib/types.js"
|
|
38
38
|
},
|
|
39
|
+
"./locale/en.json": "./locale/en.json",
|
|
39
40
|
"./package.json": "./package.json"
|
|
40
41
|
},
|
|
41
42
|
"files": [
|
|
42
43
|
"lib/**/*.js",
|
|
43
44
|
"lib/**/*.js.map",
|
|
44
45
|
"lib/**/*.d.ts",
|
|
46
|
+
"locale/*.json",
|
|
45
47
|
"cordis.patch.yml",
|
|
46
48
|
"compatibility.json",
|
|
47
49
|
"README.md",
|
|
@@ -89,7 +91,7 @@
|
|
|
89
91
|
"zod": "^4.4.3",
|
|
90
92
|
"@yadsh/dsh-plugin-kit": "^0.5.0",
|
|
91
93
|
"@yadsh/dsh-plugin-log": "^0.4.1",
|
|
92
|
-
"@yadsh/dsh-qa-surface": "^0.15.
|
|
94
|
+
"@yadsh/dsh-qa-surface": "^0.15.7"
|
|
93
95
|
},
|
|
94
96
|
"peerDependencies": {
|
|
95
97
|
"@deepseek-ai/cordis": "^4.0.4",
|