@djangocfg/monitor 2.1.217 → 2.1.219
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 +30 -0
- package/dist/client.cjs +425 -4
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +50 -1
- package/dist/client.d.ts +50 -1
- package/dist/client.mjs +444 -2
- package/dist/client.mjs.map +1 -1
- package/dist/index.cjs +354 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +373 -1
- package/dist/index.mjs.map +1 -1
- package/dist/server.cjs +354 -3
- package/dist/server.cjs.map +1 -1
- package/dist/server.mjs +373 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +3 -2
- package/src/client/MonitorProvider.tsx +2 -0
- package/src/client/index.ts +5 -1
- package/src/client/window.ts +117 -0
- package/src/.claude/.sidecar/activity.jsonl +0 -1
- package/src/.claude/.sidecar/map_cache.json +0 -38
- package/src/.claude/.sidecar/usage.json +0 -5
- package/src/.claude/project-map.md +0 -29
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,258 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
|
|
28
|
+
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
|
|
29
|
+
var require_retry_operation = __commonJS({
|
|
30
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
|
|
31
|
+
function RetryOperation(timeouts, options) {
|
|
32
|
+
if (typeof options === "boolean") {
|
|
33
|
+
options = { forever: options };
|
|
34
|
+
}
|
|
35
|
+
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
36
|
+
this._timeouts = timeouts;
|
|
37
|
+
this._options = options || {};
|
|
38
|
+
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
39
|
+
this._fn = null;
|
|
40
|
+
this._errors = [];
|
|
41
|
+
this._attempts = 1;
|
|
42
|
+
this._operationTimeout = null;
|
|
43
|
+
this._operationTimeoutCb = null;
|
|
44
|
+
this._timeout = null;
|
|
45
|
+
this._operationStart = null;
|
|
46
|
+
this._timer = null;
|
|
47
|
+
if (this._options.forever) {
|
|
48
|
+
this._cachedTimeouts = this._timeouts.slice(0);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
__name(RetryOperation, "RetryOperation");
|
|
52
|
+
module.exports = RetryOperation;
|
|
53
|
+
RetryOperation.prototype.reset = function() {
|
|
54
|
+
this._attempts = 1;
|
|
55
|
+
this._timeouts = this._originalTimeouts.slice(0);
|
|
56
|
+
};
|
|
57
|
+
RetryOperation.prototype.stop = function() {
|
|
58
|
+
if (this._timeout) {
|
|
59
|
+
clearTimeout(this._timeout);
|
|
60
|
+
}
|
|
61
|
+
if (this._timer) {
|
|
62
|
+
clearTimeout(this._timer);
|
|
63
|
+
}
|
|
64
|
+
this._timeouts = [];
|
|
65
|
+
this._cachedTimeouts = null;
|
|
66
|
+
};
|
|
67
|
+
RetryOperation.prototype.retry = function(err) {
|
|
68
|
+
if (this._timeout) {
|
|
69
|
+
clearTimeout(this._timeout);
|
|
70
|
+
}
|
|
71
|
+
if (!err) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
75
|
+
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
76
|
+
this._errors.push(err);
|
|
77
|
+
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
this._errors.push(err);
|
|
81
|
+
var timeout = this._timeouts.shift();
|
|
82
|
+
if (timeout === void 0) {
|
|
83
|
+
if (this._cachedTimeouts) {
|
|
84
|
+
this._errors.splice(0, this._errors.length - 1);
|
|
85
|
+
timeout = this._cachedTimeouts.slice(-1);
|
|
86
|
+
} else {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
var self = this;
|
|
91
|
+
this._timer = setTimeout(function() {
|
|
92
|
+
self._attempts++;
|
|
93
|
+
if (self._operationTimeoutCb) {
|
|
94
|
+
self._timeout = setTimeout(function() {
|
|
95
|
+
self._operationTimeoutCb(self._attempts);
|
|
96
|
+
}, self._operationTimeout);
|
|
97
|
+
if (self._options.unref) {
|
|
98
|
+
self._timeout.unref();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
self._fn(self._attempts);
|
|
102
|
+
}, timeout);
|
|
103
|
+
if (this._options.unref) {
|
|
104
|
+
this._timer.unref();
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
107
|
+
};
|
|
108
|
+
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
109
|
+
this._fn = fn;
|
|
110
|
+
if (timeoutOps) {
|
|
111
|
+
if (timeoutOps.timeout) {
|
|
112
|
+
this._operationTimeout = timeoutOps.timeout;
|
|
113
|
+
}
|
|
114
|
+
if (timeoutOps.cb) {
|
|
115
|
+
this._operationTimeoutCb = timeoutOps.cb;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
var self = this;
|
|
119
|
+
if (this._operationTimeoutCb) {
|
|
120
|
+
this._timeout = setTimeout(function() {
|
|
121
|
+
self._operationTimeoutCb();
|
|
122
|
+
}, self._operationTimeout);
|
|
123
|
+
}
|
|
124
|
+
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
125
|
+
this._fn(this._attempts);
|
|
126
|
+
};
|
|
127
|
+
RetryOperation.prototype.try = function(fn) {
|
|
128
|
+
console.log("Using RetryOperation.try() is deprecated");
|
|
129
|
+
this.attempt(fn);
|
|
130
|
+
};
|
|
131
|
+
RetryOperation.prototype.start = function(fn) {
|
|
132
|
+
console.log("Using RetryOperation.start() is deprecated");
|
|
133
|
+
this.attempt(fn);
|
|
134
|
+
};
|
|
135
|
+
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
136
|
+
RetryOperation.prototype.errors = function() {
|
|
137
|
+
return this._errors;
|
|
138
|
+
};
|
|
139
|
+
RetryOperation.prototype.attempts = function() {
|
|
140
|
+
return this._attempts;
|
|
141
|
+
};
|
|
142
|
+
RetryOperation.prototype.mainError = function() {
|
|
143
|
+
if (this._errors.length === 0) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
var counts = {};
|
|
147
|
+
var mainError = null;
|
|
148
|
+
var mainErrorCount = 0;
|
|
149
|
+
for (var i = 0; i < this._errors.length; i++) {
|
|
150
|
+
var error = this._errors[i];
|
|
151
|
+
var message = error.message;
|
|
152
|
+
var count = (counts[message] || 0) + 1;
|
|
153
|
+
counts[message] = count;
|
|
154
|
+
if (count >= mainErrorCount) {
|
|
155
|
+
mainError = error;
|
|
156
|
+
mainErrorCount = count;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return mainError;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js
|
|
165
|
+
var require_retry = __commonJS({
|
|
166
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports) {
|
|
167
|
+
var RetryOperation = require_retry_operation();
|
|
168
|
+
exports.operation = function(options) {
|
|
169
|
+
var timeouts = exports.timeouts(options);
|
|
170
|
+
return new RetryOperation(timeouts, {
|
|
171
|
+
forever: options && (options.forever || options.retries === Infinity),
|
|
172
|
+
unref: options && options.unref,
|
|
173
|
+
maxRetryTime: options && options.maxRetryTime
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
exports.timeouts = function(options) {
|
|
177
|
+
if (options instanceof Array) {
|
|
178
|
+
return [].concat(options);
|
|
179
|
+
}
|
|
180
|
+
var opts = {
|
|
181
|
+
retries: 10,
|
|
182
|
+
factor: 2,
|
|
183
|
+
minTimeout: 1 * 1e3,
|
|
184
|
+
maxTimeout: Infinity,
|
|
185
|
+
randomize: false
|
|
186
|
+
};
|
|
187
|
+
for (var key in options) {
|
|
188
|
+
opts[key] = options[key];
|
|
189
|
+
}
|
|
190
|
+
if (opts.minTimeout > opts.maxTimeout) {
|
|
191
|
+
throw new Error("minTimeout is greater than maxTimeout");
|
|
192
|
+
}
|
|
193
|
+
var timeouts = [];
|
|
194
|
+
for (var i = 0; i < opts.retries; i++) {
|
|
195
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
196
|
+
}
|
|
197
|
+
if (options && options.forever && !timeouts.length) {
|
|
198
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
199
|
+
}
|
|
200
|
+
timeouts.sort(function(a, b) {
|
|
201
|
+
return a - b;
|
|
202
|
+
});
|
|
203
|
+
return timeouts;
|
|
204
|
+
};
|
|
205
|
+
exports.createTimeout = function(attempt, opts) {
|
|
206
|
+
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
207
|
+
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
208
|
+
timeout = Math.min(timeout, opts.maxTimeout);
|
|
209
|
+
return timeout;
|
|
210
|
+
};
|
|
211
|
+
exports.wrap = function(obj, options, methods) {
|
|
212
|
+
if (options instanceof Array) {
|
|
213
|
+
methods = options;
|
|
214
|
+
options = null;
|
|
215
|
+
}
|
|
216
|
+
if (!methods) {
|
|
217
|
+
methods = [];
|
|
218
|
+
for (var key in obj) {
|
|
219
|
+
if (typeof obj[key] === "function") {
|
|
220
|
+
methods.push(key);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
for (var i = 0; i < methods.length; i++) {
|
|
225
|
+
var method = methods[i];
|
|
226
|
+
var original = obj[method];
|
|
227
|
+
obj[method] = (/* @__PURE__ */ __name(function retryWrapper(original2) {
|
|
228
|
+
var op = exports.operation(options);
|
|
229
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
230
|
+
var callback = args.pop();
|
|
231
|
+
args.push(function(err) {
|
|
232
|
+
if (op.retry(err)) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (err) {
|
|
236
|
+
arguments[0] = op.mainError();
|
|
237
|
+
}
|
|
238
|
+
callback.apply(this, arguments);
|
|
239
|
+
});
|
|
240
|
+
op.attempt(function() {
|
|
241
|
+
original2.apply(obj, args);
|
|
242
|
+
});
|
|
243
|
+
}, "retryWrapper")).bind(obj, original);
|
|
244
|
+
obj[method].options = options;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js
|
|
251
|
+
var require_retry2 = __commonJS({
|
|
252
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports, module) {
|
|
253
|
+
module.exports = require_retry();
|
|
254
|
+
}
|
|
255
|
+
});
|
|
3
256
|
|
|
4
257
|
// src/_api/generated/cfg_monitor/monitor/client.ts
|
|
5
258
|
var _Monitor = class _Monitor {
|
|
@@ -316,8 +569,127 @@ __name(_APILogger, "APILogger");
|
|
|
316
569
|
var APILogger = _APILogger;
|
|
317
570
|
var defaultLogger = new APILogger();
|
|
318
571
|
|
|
572
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
573
|
+
var import_retry = __toESM(require_retry2(), 1);
|
|
574
|
+
|
|
575
|
+
// ../../node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js
|
|
576
|
+
var objectToString = Object.prototype.toString;
|
|
577
|
+
var isError = /* @__PURE__ */ __name((value) => objectToString.call(value) === "[object Error]", "isError");
|
|
578
|
+
var errorMessages = /* @__PURE__ */ new Set([
|
|
579
|
+
"network error",
|
|
580
|
+
// Chrome
|
|
581
|
+
"Failed to fetch",
|
|
582
|
+
// Chrome
|
|
583
|
+
"NetworkError when attempting to fetch resource.",
|
|
584
|
+
// Firefox
|
|
585
|
+
"The Internet connection appears to be offline.",
|
|
586
|
+
// Safari 16
|
|
587
|
+
"Network request failed",
|
|
588
|
+
// `cross-fetch`
|
|
589
|
+
"fetch failed",
|
|
590
|
+
// Undici (Node.js)
|
|
591
|
+
"terminated",
|
|
592
|
+
// Undici (Node.js)
|
|
593
|
+
" A network error occurred.",
|
|
594
|
+
// Bun (WebKit)
|
|
595
|
+
"Network connection lost"
|
|
596
|
+
// Cloudflare Workers (fetch)
|
|
597
|
+
]);
|
|
598
|
+
function isNetworkError(error) {
|
|
599
|
+
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
600
|
+
if (!isValid) {
|
|
601
|
+
return false;
|
|
602
|
+
}
|
|
603
|
+
const { message, stack } = error;
|
|
604
|
+
if (message === "Load failed") {
|
|
605
|
+
return stack === void 0 || "__sentry_captured__" in error;
|
|
606
|
+
}
|
|
607
|
+
if (message.startsWith("error sending request for url")) {
|
|
608
|
+
return true;
|
|
609
|
+
}
|
|
610
|
+
return errorMessages.has(message);
|
|
611
|
+
}
|
|
612
|
+
__name(isNetworkError, "isNetworkError");
|
|
613
|
+
|
|
614
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
615
|
+
var _AbortError = class _AbortError extends Error {
|
|
616
|
+
constructor(message) {
|
|
617
|
+
super();
|
|
618
|
+
if (message instanceof Error) {
|
|
619
|
+
this.originalError = message;
|
|
620
|
+
({ message } = message);
|
|
621
|
+
} else {
|
|
622
|
+
this.originalError = new Error(message);
|
|
623
|
+
this.originalError.stack = this.stack;
|
|
624
|
+
}
|
|
625
|
+
this.name = "AbortError";
|
|
626
|
+
this.message = message;
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
__name(_AbortError, "AbortError");
|
|
630
|
+
var AbortError = _AbortError;
|
|
631
|
+
var decorateErrorWithCounts = /* @__PURE__ */ __name((error, attemptNumber, options) => {
|
|
632
|
+
const retriesLeft = options.retries - (attemptNumber - 1);
|
|
633
|
+
error.attemptNumber = attemptNumber;
|
|
634
|
+
error.retriesLeft = retriesLeft;
|
|
635
|
+
return error;
|
|
636
|
+
}, "decorateErrorWithCounts");
|
|
637
|
+
async function pRetry(input, options) {
|
|
638
|
+
return new Promise((resolve, reject) => {
|
|
639
|
+
options = { ...options };
|
|
640
|
+
options.onFailedAttempt ?? (options.onFailedAttempt = () => {
|
|
641
|
+
});
|
|
642
|
+
options.shouldRetry ?? (options.shouldRetry = () => true);
|
|
643
|
+
options.retries ?? (options.retries = 10);
|
|
644
|
+
const operation = import_retry.default.operation(options);
|
|
645
|
+
const abortHandler = /* @__PURE__ */ __name(() => {
|
|
646
|
+
operation.stop();
|
|
647
|
+
reject(options.signal?.reason);
|
|
648
|
+
}, "abortHandler");
|
|
649
|
+
if (options.signal && !options.signal.aborted) {
|
|
650
|
+
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
651
|
+
}
|
|
652
|
+
const cleanUp = /* @__PURE__ */ __name(() => {
|
|
653
|
+
options.signal?.removeEventListener("abort", abortHandler);
|
|
654
|
+
operation.stop();
|
|
655
|
+
}, "cleanUp");
|
|
656
|
+
operation.attempt(async (attemptNumber) => {
|
|
657
|
+
try {
|
|
658
|
+
const result = await input(attemptNumber);
|
|
659
|
+
cleanUp();
|
|
660
|
+
resolve(result);
|
|
661
|
+
} catch (error) {
|
|
662
|
+
try {
|
|
663
|
+
if (!(error instanceof Error)) {
|
|
664
|
+
throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
|
|
665
|
+
}
|
|
666
|
+
if (error instanceof AbortError) {
|
|
667
|
+
throw error.originalError;
|
|
668
|
+
}
|
|
669
|
+
if (error instanceof TypeError && !isNetworkError(error)) {
|
|
670
|
+
throw error;
|
|
671
|
+
}
|
|
672
|
+
decorateErrorWithCounts(error, attemptNumber, options);
|
|
673
|
+
if (!await options.shouldRetry(error)) {
|
|
674
|
+
operation.stop();
|
|
675
|
+
reject(error);
|
|
676
|
+
}
|
|
677
|
+
await options.onFailedAttempt(error);
|
|
678
|
+
if (!operation.retry(error)) {
|
|
679
|
+
throw operation.mainError();
|
|
680
|
+
}
|
|
681
|
+
} catch (finalError) {
|
|
682
|
+
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
683
|
+
cleanUp();
|
|
684
|
+
reject(finalError);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
});
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
__name(pRetry, "pRetry");
|
|
691
|
+
|
|
319
692
|
// src/_api/generated/cfg_monitor/retry.ts
|
|
320
|
-
import pRetry, { AbortError } from "p-retry";
|
|
321
693
|
var DEFAULT_RETRY_CONFIG = {
|
|
322
694
|
retries: 3,
|
|
323
695
|
factor: 2,
|