faros-airbyte-common 0.23.39 → 0.23.41
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/azure-devops/azure-devops.d.ts +22 -3
- package/lib/azure-devops/azure-devops.js +254 -42
- package/lib/azure-devops/azure-devops.js.map +1 -1
- package/lib/azure-devops/index.d.ts +2 -0
- package/lib/azure-devops/index.js +2 -0
- package/lib/azure-devops/index.js.map +1 -1
- package/lib/azure-devops/metrics.d.ts +69 -0
- package/lib/azure-devops/metrics.js +219 -0
- package/lib/azure-devops/metrics.js.map +1 -0
- package/lib/azure-devops/retry.d.ts +12 -0
- package/lib/azure-devops/retry.js +91 -0
- package/lib/azure-devops/retry.js.map +1 -0
- package/lib/azure-devops/types.d.ts +2 -0
- package/lib/claude/types.d.ts +17 -0
- package/lib/common/https-agent.d.ts +4 -0
- package/lib/common/https-agent.js +10 -1
- package/lib/common/https-agent.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AzureDevOpsMetrics = void 0;
|
|
4
|
+
const CALL_TYPES = [
|
|
5
|
+
'wiql',
|
|
6
|
+
'getWorkItems',
|
|
7
|
+
'getUpdates',
|
|
8
|
+
'getComments',
|
|
9
|
+
'epicCache',
|
|
10
|
+
'users',
|
|
11
|
+
'other',
|
|
12
|
+
];
|
|
13
|
+
const PHASES = [
|
|
14
|
+
'wiql_query',
|
|
15
|
+
'work_item_fetch',
|
|
16
|
+
'history',
|
|
17
|
+
'comments',
|
|
18
|
+
'epic_cache_build',
|
|
19
|
+
'users',
|
|
20
|
+
];
|
|
21
|
+
class AzureDevOpsMetrics {
|
|
22
|
+
constructor(logger, slowCallThresholdMs = 30_000) {
|
|
23
|
+
this.logger = logger;
|
|
24
|
+
this.slowCallThresholdMs = slowCallThresholdMs;
|
|
25
|
+
this.active = new Set();
|
|
26
|
+
this.reset();
|
|
27
|
+
}
|
|
28
|
+
reset(context = {}) {
|
|
29
|
+
this.stopProgress();
|
|
30
|
+
this.callLatencies = Object.fromEntries(CALL_TYPES.map((type) => [type, new LatencyStats()]));
|
|
31
|
+
this.batchLatencies = undefined;
|
|
32
|
+
this.phaseElapsedMs = Object.fromEntries(PHASES.map((phase) => [phase, 0]));
|
|
33
|
+
this.retriesByCause = {};
|
|
34
|
+
this.timeoutCount = 0;
|
|
35
|
+
this.itemsEmitted = 0;
|
|
36
|
+
this.itemsSkipped = 0;
|
|
37
|
+
this.batches = 0;
|
|
38
|
+
this.projects = new Set();
|
|
39
|
+
this.context = context;
|
|
40
|
+
this.startedAt = Date.now();
|
|
41
|
+
}
|
|
42
|
+
setContext(context) {
|
|
43
|
+
this.context = { ...this.context, ...context };
|
|
44
|
+
}
|
|
45
|
+
track(kind, name, context) {
|
|
46
|
+
const operation = { kind, name, context, startedAt: Date.now() };
|
|
47
|
+
this.active.add(operation);
|
|
48
|
+
if (!this.progressTimer) {
|
|
49
|
+
this.progressTimer = setInterval(() => {
|
|
50
|
+
// One bounded message per minute, even with many concurrent calls.
|
|
51
|
+
const operations = [...this.active];
|
|
52
|
+
this.logger.info(`Azure DevOps progress ${JSON.stringify({
|
|
53
|
+
active_calls: operations.filter(({ kind }) => kind === 'call').length,
|
|
54
|
+
active_phases: operations.filter(({ kind }) => kind === 'phase')
|
|
55
|
+
.length,
|
|
56
|
+
oldest_operations: operations.slice(0, 10).map((operation) => ({
|
|
57
|
+
kind: operation.kind,
|
|
58
|
+
name: operation.name,
|
|
59
|
+
...operation.context,
|
|
60
|
+
elapsed_ms: Date.now() - operation.startedAt,
|
|
61
|
+
})),
|
|
62
|
+
})}`);
|
|
63
|
+
}, 60_000);
|
|
64
|
+
this.progressTimer.unref();
|
|
65
|
+
}
|
|
66
|
+
return () => {
|
|
67
|
+
this.active.delete(operation);
|
|
68
|
+
if (!this.active.size)
|
|
69
|
+
this.stopProgress();
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
stopProgress() {
|
|
73
|
+
clearInterval(this.progressTimer);
|
|
74
|
+
this.progressTimer = undefined;
|
|
75
|
+
this.active.clear();
|
|
76
|
+
}
|
|
77
|
+
beginPhase(name, context = {}) {
|
|
78
|
+
const startedAt = Date.now();
|
|
79
|
+
const finish = this.track('phase', name, context);
|
|
80
|
+
return () => {
|
|
81
|
+
finish();
|
|
82
|
+
this.addPhaseElapsed(name, Date.now() - startedAt);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
async timed(type, fn, context = {}) {
|
|
86
|
+
const startedAt = Date.now();
|
|
87
|
+
const finish = this.track('call', type, context);
|
|
88
|
+
try {
|
|
89
|
+
return await fn();
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
finish();
|
|
93
|
+
this.recordCallElapsed(type, Date.now() - startedAt, context);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
recordCallElapsed(type, elapsedMs, context = {}) {
|
|
97
|
+
this.callLatencies[type].add(elapsedMs);
|
|
98
|
+
this.batchLatencies?.add(elapsedMs);
|
|
99
|
+
if (elapsedMs >= this.slowCallThresholdMs) {
|
|
100
|
+
this.logger.warn(`Slow Azure DevOps ${type} call took ${elapsedMs} ms ` +
|
|
101
|
+
`(threshold ${this.slowCallThresholdMs} ms) ${JSON.stringify(context)}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async phase(name, fn, context = {}) {
|
|
105
|
+
const finish = this.beginPhase(name, context);
|
|
106
|
+
try {
|
|
107
|
+
return await fn();
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
finish();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
addPhaseElapsed(name, elapsedMs) {
|
|
114
|
+
this.phaseElapsedMs[name] = (this.phaseElapsedMs[name] ?? 0) + elapsedMs;
|
|
115
|
+
}
|
|
116
|
+
recordFailure(cause) {
|
|
117
|
+
if (cause === 'ETIMEDOUT' ||
|
|
118
|
+
cause === 'ESOCKETTIMEDOUT' ||
|
|
119
|
+
cause === 'request_timeout') {
|
|
120
|
+
this.timeoutCount++;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
recordRetry(cause) {
|
|
124
|
+
this.retriesByCause[cause] = (this.retriesByCause[cause] ?? 0) + 1;
|
|
125
|
+
}
|
|
126
|
+
recordBatch(project, emitted, skipped) {
|
|
127
|
+
this.projects.add(project);
|
|
128
|
+
this.batches++;
|
|
129
|
+
this.itemsEmitted += emitted;
|
|
130
|
+
this.itemsSkipped += skipped;
|
|
131
|
+
}
|
|
132
|
+
recordProject(project) {
|
|
133
|
+
this.projects.add(project);
|
|
134
|
+
}
|
|
135
|
+
// Work-item batches are sequential; keep only the current batch accumulator.
|
|
136
|
+
capture() {
|
|
137
|
+
this.batchLatencies = new LatencyStats();
|
|
138
|
+
return {
|
|
139
|
+
latencies: this.batchLatencies,
|
|
140
|
+
calls: Object.fromEntries(CALL_TYPES.map((type) => [type, this.callLatencies[type].count])),
|
|
141
|
+
retries: Object.values(this.retriesByCause).reduce((sum, count) => sum + count, 0),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
batchSummarySince(capture) {
|
|
145
|
+
const calls = {};
|
|
146
|
+
for (const type of CALL_TYPES) {
|
|
147
|
+
const count = this.callLatencies[type].count - capture.calls[type];
|
|
148
|
+
if (count)
|
|
149
|
+
calls[type] = count;
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
calls,
|
|
153
|
+
retries: Object.values(this.retriesByCause).reduce((sum, count) => sum + count, 0) - capture.retries,
|
|
154
|
+
max_call_latency_ms: capture.latencies.max,
|
|
155
|
+
p95_call_latency_ms: capture.latencies.p95(),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
summary() {
|
|
159
|
+
const calls = Object.fromEntries(CALL_TYPES.map((type) => {
|
|
160
|
+
const latencies = this.callLatencies[type];
|
|
161
|
+
return [
|
|
162
|
+
type,
|
|
163
|
+
{
|
|
164
|
+
count: latencies.count,
|
|
165
|
+
max_ms: latencies.max,
|
|
166
|
+
p95_ms: latencies.p95(),
|
|
167
|
+
},
|
|
168
|
+
];
|
|
169
|
+
}));
|
|
170
|
+
const retries = Object.values(this.retriesByCause).reduce((sum, count) => sum + count, 0);
|
|
171
|
+
return {
|
|
172
|
+
elapsed_ms: Date.now() - this.startedAt,
|
|
173
|
+
phases: this.phaseElapsedMs,
|
|
174
|
+
calls,
|
|
175
|
+
retries: { total: retries, by_cause: this.retriesByCause },
|
|
176
|
+
timeouts: this.timeoutCount,
|
|
177
|
+
items_emitted: this.itemsEmitted,
|
|
178
|
+
items_skipped: this.itemsSkipped,
|
|
179
|
+
batches: this.batches,
|
|
180
|
+
projects: this.projects.size,
|
|
181
|
+
mode: this.context.mode ?? 'full',
|
|
182
|
+
bucket: {
|
|
183
|
+
id: this.context.bucketId ?? 1,
|
|
184
|
+
total: this.context.bucketTotal ?? 1,
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.AzureDevOpsMetrics = AzureDevOpsMetrics;
|
|
190
|
+
// Sixteen logarithmic buckets per power of two, covering safe integer ms.
|
|
191
|
+
// p95 is a bucket upper bound (at most ~4.43% + 1 ms above the exact value).
|
|
192
|
+
// Storage is fixed regardless of sync size; counts and maxima remain exact.
|
|
193
|
+
class LatencyStats {
|
|
194
|
+
constructor() {
|
|
195
|
+
this.buckets = new Array(850).fill(0);
|
|
196
|
+
this.count = 0;
|
|
197
|
+
this.max = 0;
|
|
198
|
+
}
|
|
199
|
+
add(elapsedMs) {
|
|
200
|
+
const ms = Math.max(0, elapsedMs);
|
|
201
|
+
const index = ms === 0 ? 0 : Math.ceil(Math.log2(Math.max(1, ms)) * 16) + 1;
|
|
202
|
+
this.buckets[Math.min(index, this.buckets.length - 1)]++;
|
|
203
|
+
this.count++;
|
|
204
|
+
this.max = Math.max(this.max, ms);
|
|
205
|
+
}
|
|
206
|
+
p95() {
|
|
207
|
+
const rank = Math.ceil(this.count * 0.95);
|
|
208
|
+
let count = 0;
|
|
209
|
+
for (let index = 0; index < this.buckets.length; index++) {
|
|
210
|
+
count += this.buckets[index];
|
|
211
|
+
if (count >= rank) {
|
|
212
|
+
const upper = index === 0 ? 0 : Math.ceil(2 ** ((index - 1) / 16));
|
|
213
|
+
return Math.min(this.max, upper);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return this.max;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/azure-devops/metrics.ts"],"names":[],"mappings":";;;AAWA,MAAM,UAAU,GAAuC;IACrD,MAAM;IACN,cAAc;IACd,YAAY;IACZ,aAAa;IACb,WAAW;IACX,OAAO;IACP,OAAO;CACR,CAAC;AACF,MAAM,MAAM,GAAG;IACb,YAAY;IACZ,iBAAiB;IACjB,SAAS;IACT,UAAU;IACV,kBAAkB;IAClB,OAAO;CACR,CAAC;AA0BF,MAAa,kBAAkB;IAoB7B,YACmB,MAAqB,EACrB,sBAAsB,MAAM;QAD5B,WAAM,GAAN,MAAM,CAAe;QACrB,wBAAmB,GAAnB,mBAAmB,CAAS;QArB9B,WAAM,GAAG,IAAI,GAAG,EAK7B,CAAC;QAkBH,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED,KAAK,CAAC,UAAkC,EAAE;QACxC,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,WAAW,CACrC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,YAAY,EAAE,CAAC,CAAC,CACR,CAAC;QAC/C,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAChC,IAAI,CAAC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C,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC5E,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACzD,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,GAAG;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;QAC1C,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YACzD,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;gBAClB,MAAM,KAAK,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBACnE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface RetryOptions {
|
|
2
|
+
readonly maxRetries: number;
|
|
3
|
+
readonly operation?: string;
|
|
4
|
+
readonly baseDelayMs?: number;
|
|
5
|
+
readonly maxDelayMs?: number;
|
|
6
|
+
readonly random?: () => number;
|
|
7
|
+
readonly sleep?: (milliseconds: number) => Promise<void>;
|
|
8
|
+
readonly onRetry?: (cause: string, delayMs: number) => void;
|
|
9
|
+
readonly onFailure?: (cause?: string) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function retryCause(error: any): string | undefined;
|
|
12
|
+
export declare function withRetry<T>(fn: () => Promise<T>, options: RetryOptions): Promise<T>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.retryCause = retryCause;
|
|
7
|
+
exports.withRetry = withRetry;
|
|
8
|
+
const faros_js_client_1 = require("faros-js-client");
|
|
9
|
+
const verror_1 = __importDefault(require("verror"));
|
|
10
|
+
const DEFAULT_BASE_DELAY_MS = 1_000;
|
|
11
|
+
const DEFAULT_MAX_DELAY_MS = 60_000;
|
|
12
|
+
const RETRYABLE_CODES = new Set([
|
|
13
|
+
'ECONNRESET',
|
|
14
|
+
'ECONNREFUSED',
|
|
15
|
+
'ETIMEDOUT',
|
|
16
|
+
'ESOCKETTIMEDOUT',
|
|
17
|
+
'ENOTFOUND',
|
|
18
|
+
'ENOBUFS',
|
|
19
|
+
'EAI_AGAIN',
|
|
20
|
+
'EHOSTUNREACH',
|
|
21
|
+
'EPIPE',
|
|
22
|
+
]);
|
|
23
|
+
function statusCode(error) {
|
|
24
|
+
const value = error?.statusCode ??
|
|
25
|
+
error?.status ??
|
|
26
|
+
error?.response?.statusCode ??
|
|
27
|
+
error?.response?.status;
|
|
28
|
+
const parsed = Number(value);
|
|
29
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
30
|
+
}
|
|
31
|
+
function errorCode(error) {
|
|
32
|
+
return (error?.code ?? error?.cause?.code)?.toUpperCase();
|
|
33
|
+
}
|
|
34
|
+
function retryCause(error) {
|
|
35
|
+
const status = statusCode(error);
|
|
36
|
+
if (status === 408 || status === 429 || (status >= 500 && status <= 599)) {
|
|
37
|
+
return `http_${status}`;
|
|
38
|
+
}
|
|
39
|
+
const code = errorCode(error);
|
|
40
|
+
if (RETRYABLE_CODES.has(code)) {
|
|
41
|
+
return code;
|
|
42
|
+
}
|
|
43
|
+
if (/request timeout/i.test(error?.message ?? error?.cause?.message ?? '')) {
|
|
44
|
+
return 'request_timeout';
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
function retryAfterMs(error) {
|
|
49
|
+
const headers = error?.responseHeaders ?? error?.response?.headers ?? error?.headers;
|
|
50
|
+
const value = headers?.['retry-after'] ?? headers?.['Retry-After'];
|
|
51
|
+
if (value == null) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const header = Array.isArray(value) ? value[0] : value;
|
|
55
|
+
const seconds = Number(header);
|
|
56
|
+
if (Number.isFinite(seconds)) {
|
|
57
|
+
return Math.max(0, seconds * 1_000);
|
|
58
|
+
}
|
|
59
|
+
const date = Date.parse(String(header));
|
|
60
|
+
return Number.isFinite(date) ? Math.max(0, date - Date.now()) : undefined;
|
|
61
|
+
}
|
|
62
|
+
async function withRetry(fn, options) {
|
|
63
|
+
const maxRetries = Number.isFinite(options.maxRetries)
|
|
64
|
+
? Math.max(0, Math.floor(options.maxRetries))
|
|
65
|
+
: 0;
|
|
66
|
+
const baseDelayMs = options.baseDelayMs ?? DEFAULT_BASE_DELAY_MS;
|
|
67
|
+
const maxDelayMs = options.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;
|
|
68
|
+
const random = options.random ?? Math.random;
|
|
69
|
+
const sleep = options.sleep ?? faros_js_client_1.Utils.sleep;
|
|
70
|
+
const operation = options.operation ?? 'Azure DevOps request';
|
|
71
|
+
for (let attempt = 1;; attempt++) {
|
|
72
|
+
try {
|
|
73
|
+
return await fn();
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
const cause = retryCause(error);
|
|
77
|
+
options.onFailure?.(cause);
|
|
78
|
+
if (!cause) {
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
if (attempt > maxRetries) {
|
|
82
|
+
throw new verror_1.default(error, `${operation} failed after ${attempt} attempts`);
|
|
83
|
+
}
|
|
84
|
+
const jitter = Math.floor(random() * Math.min(maxDelayMs, baseDelayMs * 2 ** (attempt - 1)));
|
|
85
|
+
const delayMs = Math.max(jitter, retryAfterMs(error) ?? 0);
|
|
86
|
+
options.onRetry?.(cause, delayMs);
|
|
87
|
+
await sleep(delayMs);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/azure-devops/retry.ts"],"names":[],"mappings":";;;;;AA2CA,gCAeC;AAoBD,8BAqCC;AAnHD,qDAAsC;AACtC,oDAA4B;AAE5B,MAAM,qBAAqB,GAAG,KAAK,CAAC;AACpC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAEpC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,YAAY;IACZ,cAAc;IACd,WAAW;IACX,iBAAiB;IACjB,WAAW;IACX,SAAS;IACT,WAAW;IACX,cAAc;IACd,OAAO;CACR,CAAC,CAAC;AAaH,SAAS,UAAU,CAAC,KAAU;IAC5B,MAAM,KAAK,GACT,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,QAAQ,EAAE,UAAU;QAC3B,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC;IAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAED,SAAS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AC,KAAK,CAAC,CAAC;YAChC,OAAO,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC;YAC3B,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,KAAK,CAAC;YACd,CAAC;YACD,IAAI,OAAO,GAAG,UAAU,EAAE,CAAC;gBACzB,MAAM,IAAI,gBAAM,CACd,KAAK,EACL,GAAG,SAAS,iBAAiB,OAAO,WAAW,CAChD,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CACvB,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAClE,CAAC;YACF,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YAC3D,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAClC,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -36,6 +36,8 @@ export interface AzureDevOpsConfig extends RoundRobinConfig {
|
|
|
36
36
|
readonly page_size?: number;
|
|
37
37
|
readonly max_retries?: number;
|
|
38
38
|
readonly request_timeout?: number;
|
|
39
|
+
readonly concurrency_limit?: number;
|
|
40
|
+
readonly slow_call_threshold_ms?: number;
|
|
39
41
|
readonly fetch_work_item_comments?: boolean;
|
|
40
42
|
/** PEM-formatted CA certificate for self-signed certificates or internal CAs */
|
|
41
43
|
readonly ca_certificate?: string;
|
package/lib/claude/types.d.ts
CHANGED
|
@@ -175,6 +175,8 @@ export interface SpendLimitSource {
|
|
|
175
175
|
seat_tier?: string;
|
|
176
176
|
rbac_group_id?: string;
|
|
177
177
|
user_id?: string;
|
|
178
|
+
service?: string;
|
|
179
|
+
workspace_id?: string;
|
|
178
180
|
}
|
|
179
181
|
export interface EffectiveSpendLimitItem {
|
|
180
182
|
scope: {
|
|
@@ -193,6 +195,21 @@ export interface SpendLimitRecord extends EffectiveSpendLimitItem {
|
|
|
193
195
|
user_id: string;
|
|
194
196
|
observed_at: string;
|
|
195
197
|
}
|
|
198
|
+
export interface SpendLimitItem {
|
|
199
|
+
type: 'spend_limit';
|
|
200
|
+
id: string;
|
|
201
|
+
scope: SpendLimitSource;
|
|
202
|
+
amount: string | null;
|
|
203
|
+
currency: string;
|
|
204
|
+
period: string;
|
|
205
|
+
is_enabled: boolean;
|
|
206
|
+
created_at: string;
|
|
207
|
+
updated_at: string;
|
|
208
|
+
}
|
|
209
|
+
export interface ConfiguredSpendLimitRecord extends SpendLimitItem {
|
|
210
|
+
observed_at: string;
|
|
211
|
+
period_to_date_spend?: string | null;
|
|
212
|
+
}
|
|
196
213
|
export interface RbacGroupItem {
|
|
197
214
|
type: 'rbac_group';
|
|
198
215
|
id: string;
|
|
@@ -21,6 +21,10 @@ export interface HttpsAgentOptions {
|
|
|
21
21
|
keepAlive?: boolean;
|
|
22
22
|
/** Timeout in milliseconds */
|
|
23
23
|
timeout?: number;
|
|
24
|
+
/** Maximum number of concurrent sockets */
|
|
25
|
+
maxSockets?: number;
|
|
26
|
+
/** Maximum number of idle keep-alive sockets */
|
|
27
|
+
maxFreeSockets?: number;
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
30
|
* Creates an https.Agent with optional custom CA certificate support.
|
|
@@ -38,6 +38,12 @@ function createHttpsAgent(options = {}) {
|
|
|
38
38
|
if (options.timeout !== undefined) {
|
|
39
39
|
agentOptions.timeout = options.timeout;
|
|
40
40
|
}
|
|
41
|
+
if (options.maxSockets !== undefined) {
|
|
42
|
+
agentOptions.maxSockets = options.maxSockets;
|
|
43
|
+
}
|
|
44
|
+
if (options.maxFreeSockets !== undefined) {
|
|
45
|
+
agentOptions.maxFreeSockets = options.maxFreeSockets;
|
|
46
|
+
}
|
|
41
47
|
// Custom CA certificate takes precedence
|
|
42
48
|
if (options.ca) {
|
|
43
49
|
agentOptions.ca = options.ca;
|
|
@@ -87,7 +93,10 @@ function createHttpsAgentFromConfig(config, additionalOptions) {
|
|
|
87
93
|
function writeCACertToTempFile(caCertificate) {
|
|
88
94
|
const tempDir = node_os_1.default.tmpdir();
|
|
89
95
|
const tempFilePath = node_path_1.default.join(tempDir, `ca-cert-${Date.now()}.pem`);
|
|
90
|
-
node_fs_1.default.writeFileSync(tempFilePath, caCertificate, {
|
|
96
|
+
node_fs_1.default.writeFileSync(tempFilePath, caCertificate, {
|
|
97
|
+
encoding: 'utf8',
|
|
98
|
+
mode: 0o600,
|
|
99
|
+
});
|
|
91
100
|
return tempFilePath;
|
|
92
101
|
}
|
|
93
102
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"https-agent.js","sourceRoot":"","sources":["../../src/common/https-agent.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"https-agent.js","sourceRoot":"","sources":["../../src/common/https-agent.ts"],"names":[],"mappings":";;;;;AAsDA,4CAwBC;AAeD,gEASC;AAoBD,sDAQC;AAOD,8CAQC;AAjJD,sDAAyB;AACzB,4DAA+B;AAC/B,sDAAyB;AACzB,0DAA6B;AA+B7B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,gBAAgB,CAAC,UAA6B,EAAE;IAC9D,MAAM,YAAY,GAAuB;QACvC,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI;KACrC,CAAC;IAEF,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAClC,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACzC,CAAC;IACD,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACrC,YAAY,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAC/C,CAAC;IACD,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QACz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