@blackasteroid/kuma-cli 1.0.1 → 1.2.0
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/dist/index.js +922 -193
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3218,11 +3218,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3218
3218
|
*/
|
|
3219
3219
|
_getOutputContext(contextOptions) {
|
|
3220
3220
|
contextOptions = contextOptions || {};
|
|
3221
|
-
const
|
|
3221
|
+
const error3 = !!contextOptions.error;
|
|
3222
3222
|
let baseWrite;
|
|
3223
3223
|
let hasColors;
|
|
3224
3224
|
let helpWidth;
|
|
3225
|
-
if (
|
|
3225
|
+
if (error3) {
|
|
3226
3226
|
baseWrite = (str) => this._outputConfiguration.writeErr(str);
|
|
3227
3227
|
hasColors = this._outputConfiguration.getErrHasColors();
|
|
3228
3228
|
helpWidth = this._outputConfiguration.getErrHelpWidth();
|
|
@@ -3235,7 +3235,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3235
3235
|
if (!hasColors) str = this._outputConfiguration.stripColor(str);
|
|
3236
3236
|
return baseWrite(str);
|
|
3237
3237
|
};
|
|
3238
|
-
return { error:
|
|
3238
|
+
return { error: error3, write, hasColors, helpWidth };
|
|
3239
3239
|
}
|
|
3240
3240
|
/**
|
|
3241
3241
|
* Output help information for this command.
|
|
@@ -4805,13 +4805,13 @@ var require_prompt = __commonJS({
|
|
|
4805
4805
|
}
|
|
4806
4806
|
let result = this.state.error || await this.validate(this.value, this.state);
|
|
4807
4807
|
if (result !== true) {
|
|
4808
|
-
let
|
|
4808
|
+
let error3 = "\n" + this.symbols.pointer + " ";
|
|
4809
4809
|
if (typeof result === "string") {
|
|
4810
|
-
|
|
4810
|
+
error3 += result.trim();
|
|
4811
4811
|
} else {
|
|
4812
|
-
|
|
4812
|
+
error3 += "Invalid input";
|
|
4813
4813
|
}
|
|
4814
|
-
this.state.error = "\n" + this.styles.danger(
|
|
4814
|
+
this.state.error = "\n" + this.styles.danger(error3);
|
|
4815
4815
|
this.state.submitted = false;
|
|
4816
4816
|
await this.render();
|
|
4817
4817
|
await this.alert();
|
|
@@ -7184,11 +7184,11 @@ var require_interpolate = __commonJS({
|
|
|
7184
7184
|
state.keys = keys;
|
|
7185
7185
|
state.output = "";
|
|
7186
7186
|
let validate = async (value2, state2, item, index2) => {
|
|
7187
|
-
let
|
|
7188
|
-
if (
|
|
7187
|
+
let error3 = await isValid(value2, state2, item, index2);
|
|
7188
|
+
if (error3 === false) {
|
|
7189
7189
|
return "Invalid field " + item.name;
|
|
7190
7190
|
}
|
|
7191
|
-
return
|
|
7191
|
+
return error3;
|
|
7192
7192
|
};
|
|
7193
7193
|
for (let token of tabstops) {
|
|
7194
7194
|
let value2 = token.value;
|
|
@@ -7206,9 +7206,9 @@ var require_interpolate = __commonJS({
|
|
|
7206
7206
|
let field = item.field || {};
|
|
7207
7207
|
let message = field.message || token.inner;
|
|
7208
7208
|
if (submitted) {
|
|
7209
|
-
let
|
|
7210
|
-
if (
|
|
7211
|
-
state.invalid.set(key,
|
|
7209
|
+
let error3 = await validate(state.values[key], state, item, index);
|
|
7210
|
+
if (error3 && typeof error3 === "string" || error3 === false) {
|
|
7211
|
+
state.invalid.set(key, error3);
|
|
7212
7212
|
continue;
|
|
7213
7213
|
}
|
|
7214
7214
|
state.invalid.delete(key);
|
|
@@ -7394,7 +7394,7 @@ var require_snippet = __commonJS({
|
|
|
7394
7394
|
let prompt3 = [prefix, message, separator].filter(Boolean).join(" ");
|
|
7395
7395
|
this.state.prompt = prompt3;
|
|
7396
7396
|
let header = await this.header();
|
|
7397
|
-
let
|
|
7397
|
+
let error3 = await this.error() || "";
|
|
7398
7398
|
let hint = await this.hint() || "";
|
|
7399
7399
|
let body = submitted ? "" : await this.interpolate(this.state);
|
|
7400
7400
|
let key = this.state.key = keys[index] || "";
|
|
@@ -7403,7 +7403,7 @@ var require_snippet = __commonJS({
|
|
|
7403
7403
|
if (input) prompt3 += " " + input;
|
|
7404
7404
|
if (hint && !input && this.state.completed === 0) prompt3 += " " + hint;
|
|
7405
7405
|
this.clear(size);
|
|
7406
|
-
let lines = [header, prompt3, body, footer,
|
|
7406
|
+
let lines = [header, prompt3, body, footer, error3.trim()];
|
|
7407
7407
|
this.write(lines.filter(Boolean).join(newline));
|
|
7408
7408
|
this.restore();
|
|
7409
7409
|
}
|
|
@@ -8175,9 +8175,9 @@ var require_XMLHttpRequest = __commonJS({
|
|
|
8175
8175
|
throw new Error("XMLHttpRequest: Only GET method is supported");
|
|
8176
8176
|
}
|
|
8177
8177
|
if (settings.async) {
|
|
8178
|
-
fs3.readFile(unescape(url2.pathname), function(
|
|
8179
|
-
if (
|
|
8180
|
-
self.handleError(
|
|
8178
|
+
fs3.readFile(unescape(url2.pathname), function(error3, data2) {
|
|
8179
|
+
if (error3) {
|
|
8180
|
+
self.handleError(error3, error3.errno || -1);
|
|
8181
8181
|
} else {
|
|
8182
8182
|
self.status = 200;
|
|
8183
8183
|
self.responseText = data2.toString("utf8");
|
|
@@ -8290,14 +8290,14 @@ var require_XMLHttpRequest = __commonJS({
|
|
|
8290
8290
|
self.responseText = self.response.toString("utf8");
|
|
8291
8291
|
}
|
|
8292
8292
|
});
|
|
8293
|
-
response.on("error", function(
|
|
8294
|
-
self.handleError(
|
|
8293
|
+
response.on("error", function(error3) {
|
|
8294
|
+
self.handleError(error3);
|
|
8295
8295
|
});
|
|
8296
8296
|
};
|
|
8297
|
-
var errorHandler = function(
|
|
8298
|
-
if (request.reusedSocket &&
|
|
8297
|
+
var errorHandler = function(error3) {
|
|
8298
|
+
if (request.reusedSocket && error3.code === "ECONNRESET")
|
|
8299
8299
|
return doRequest(options, responseHandler).on("error", errorHandler);
|
|
8300
|
-
self.handleError(
|
|
8300
|
+
self.handleError(error3);
|
|
8301
8301
|
};
|
|
8302
8302
|
request = doRequest(options, responseHandler).on("error", errorHandler);
|
|
8303
8303
|
if (opts.autoUnref) {
|
|
@@ -8338,10 +8338,10 @@ var require_XMLHttpRequest = __commonJS({
|
|
|
8338
8338
|
}
|
|
8339
8339
|
}
|
|
8340
8340
|
};
|
|
8341
|
-
this.handleError = function(
|
|
8341
|
+
this.handleError = function(error3, status) {
|
|
8342
8342
|
this.status = status || 0;
|
|
8343
|
-
this.statusText =
|
|
8344
|
-
this.responseText =
|
|
8343
|
+
this.statusText = error3;
|
|
8344
|
+
this.responseText = error3.stack;
|
|
8345
8345
|
errorFlag = true;
|
|
8346
8346
|
setState(this.DONE);
|
|
8347
8347
|
};
|
|
@@ -8851,14 +8851,14 @@ var require_browser = __commonJS({
|
|
|
8851
8851
|
} else {
|
|
8852
8852
|
exports2.storage.removeItem("debug");
|
|
8853
8853
|
}
|
|
8854
|
-
} catch (
|
|
8854
|
+
} catch (error3) {
|
|
8855
8855
|
}
|
|
8856
8856
|
}
|
|
8857
8857
|
function load() {
|
|
8858
8858
|
let r;
|
|
8859
8859
|
try {
|
|
8860
8860
|
r = exports2.storage.getItem("debug") || exports2.storage.getItem("DEBUG");
|
|
8861
|
-
} catch (
|
|
8861
|
+
} catch (error3) {
|
|
8862
8862
|
}
|
|
8863
8863
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
8864
8864
|
r = process.env.DEBUG;
|
|
@@ -8868,7 +8868,7 @@ var require_browser = __commonJS({
|
|
|
8868
8868
|
function localstorage() {
|
|
8869
8869
|
try {
|
|
8870
8870
|
return localStorage;
|
|
8871
|
-
} catch (
|
|
8871
|
+
} catch (error3) {
|
|
8872
8872
|
}
|
|
8873
8873
|
}
|
|
8874
8874
|
module2.exports = require_common()(exports2);
|
|
@@ -8876,8 +8876,8 @@ var require_browser = __commonJS({
|
|
|
8876
8876
|
formatters.j = function(v) {
|
|
8877
8877
|
try {
|
|
8878
8878
|
return JSON.stringify(v);
|
|
8879
|
-
} catch (
|
|
8880
|
-
return "[UnexpectedJSONParseError]: " +
|
|
8879
|
+
} catch (error3) {
|
|
8880
|
+
return "[UnexpectedJSONParseError]: " + error3.message;
|
|
8881
8881
|
}
|
|
8882
8882
|
};
|
|
8883
8883
|
}
|
|
@@ -9098,7 +9098,7 @@ var require_node = __commonJS({
|
|
|
9098
9098
|
221
|
|
9099
9099
|
];
|
|
9100
9100
|
}
|
|
9101
|
-
} catch (
|
|
9101
|
+
} catch (error3) {
|
|
9102
9102
|
}
|
|
9103
9103
|
exports2.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
9104
9104
|
return /^debug_/i.test(key);
|
|
@@ -10077,26 +10077,26 @@ var require_receiver = __commonJS({
|
|
|
10077
10077
|
}
|
|
10078
10078
|
const buf = this.consume(2);
|
|
10079
10079
|
if ((buf[0] & 48) !== 0) {
|
|
10080
|
-
const
|
|
10080
|
+
const error3 = this.createError(
|
|
10081
10081
|
RangeError,
|
|
10082
10082
|
"RSV2 and RSV3 must be clear",
|
|
10083
10083
|
true,
|
|
10084
10084
|
1002,
|
|
10085
10085
|
"WS_ERR_UNEXPECTED_RSV_2_3"
|
|
10086
10086
|
);
|
|
10087
|
-
cb(
|
|
10087
|
+
cb(error3);
|
|
10088
10088
|
return;
|
|
10089
10089
|
}
|
|
10090
10090
|
const compressed = (buf[0] & 64) === 64;
|
|
10091
10091
|
if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
|
|
10092
|
-
const
|
|
10092
|
+
const error3 = this.createError(
|
|
10093
10093
|
RangeError,
|
|
10094
10094
|
"RSV1 must be clear",
|
|
10095
10095
|
true,
|
|
10096
10096
|
1002,
|
|
10097
10097
|
"WS_ERR_UNEXPECTED_RSV_1"
|
|
10098
10098
|
);
|
|
10099
|
-
cb(
|
|
10099
|
+
cb(error3);
|
|
10100
10100
|
return;
|
|
10101
10101
|
}
|
|
10102
10102
|
this._fin = (buf[0] & 128) === 128;
|
|
@@ -10104,109 +10104,109 @@ var require_receiver = __commonJS({
|
|
|
10104
10104
|
this._payloadLength = buf[1] & 127;
|
|
10105
10105
|
if (this._opcode === 0) {
|
|
10106
10106
|
if (compressed) {
|
|
10107
|
-
const
|
|
10107
|
+
const error3 = this.createError(
|
|
10108
10108
|
RangeError,
|
|
10109
10109
|
"RSV1 must be clear",
|
|
10110
10110
|
true,
|
|
10111
10111
|
1002,
|
|
10112
10112
|
"WS_ERR_UNEXPECTED_RSV_1"
|
|
10113
10113
|
);
|
|
10114
|
-
cb(
|
|
10114
|
+
cb(error3);
|
|
10115
10115
|
return;
|
|
10116
10116
|
}
|
|
10117
10117
|
if (!this._fragmented) {
|
|
10118
|
-
const
|
|
10118
|
+
const error3 = this.createError(
|
|
10119
10119
|
RangeError,
|
|
10120
10120
|
"invalid opcode 0",
|
|
10121
10121
|
true,
|
|
10122
10122
|
1002,
|
|
10123
10123
|
"WS_ERR_INVALID_OPCODE"
|
|
10124
10124
|
);
|
|
10125
|
-
cb(
|
|
10125
|
+
cb(error3);
|
|
10126
10126
|
return;
|
|
10127
10127
|
}
|
|
10128
10128
|
this._opcode = this._fragmented;
|
|
10129
10129
|
} else if (this._opcode === 1 || this._opcode === 2) {
|
|
10130
10130
|
if (this._fragmented) {
|
|
10131
|
-
const
|
|
10131
|
+
const error3 = this.createError(
|
|
10132
10132
|
RangeError,
|
|
10133
10133
|
`invalid opcode ${this._opcode}`,
|
|
10134
10134
|
true,
|
|
10135
10135
|
1002,
|
|
10136
10136
|
"WS_ERR_INVALID_OPCODE"
|
|
10137
10137
|
);
|
|
10138
|
-
cb(
|
|
10138
|
+
cb(error3);
|
|
10139
10139
|
return;
|
|
10140
10140
|
}
|
|
10141
10141
|
this._compressed = compressed;
|
|
10142
10142
|
} else if (this._opcode > 7 && this._opcode < 11) {
|
|
10143
10143
|
if (!this._fin) {
|
|
10144
|
-
const
|
|
10144
|
+
const error3 = this.createError(
|
|
10145
10145
|
RangeError,
|
|
10146
10146
|
"FIN must be set",
|
|
10147
10147
|
true,
|
|
10148
10148
|
1002,
|
|
10149
10149
|
"WS_ERR_EXPECTED_FIN"
|
|
10150
10150
|
);
|
|
10151
|
-
cb(
|
|
10151
|
+
cb(error3);
|
|
10152
10152
|
return;
|
|
10153
10153
|
}
|
|
10154
10154
|
if (compressed) {
|
|
10155
|
-
const
|
|
10155
|
+
const error3 = this.createError(
|
|
10156
10156
|
RangeError,
|
|
10157
10157
|
"RSV1 must be clear",
|
|
10158
10158
|
true,
|
|
10159
10159
|
1002,
|
|
10160
10160
|
"WS_ERR_UNEXPECTED_RSV_1"
|
|
10161
10161
|
);
|
|
10162
|
-
cb(
|
|
10162
|
+
cb(error3);
|
|
10163
10163
|
return;
|
|
10164
10164
|
}
|
|
10165
10165
|
if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
|
|
10166
|
-
const
|
|
10166
|
+
const error3 = this.createError(
|
|
10167
10167
|
RangeError,
|
|
10168
10168
|
`invalid payload length ${this._payloadLength}`,
|
|
10169
10169
|
true,
|
|
10170
10170
|
1002,
|
|
10171
10171
|
"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"
|
|
10172
10172
|
);
|
|
10173
|
-
cb(
|
|
10173
|
+
cb(error3);
|
|
10174
10174
|
return;
|
|
10175
10175
|
}
|
|
10176
10176
|
} else {
|
|
10177
|
-
const
|
|
10177
|
+
const error3 = this.createError(
|
|
10178
10178
|
RangeError,
|
|
10179
10179
|
`invalid opcode ${this._opcode}`,
|
|
10180
10180
|
true,
|
|
10181
10181
|
1002,
|
|
10182
10182
|
"WS_ERR_INVALID_OPCODE"
|
|
10183
10183
|
);
|
|
10184
|
-
cb(
|
|
10184
|
+
cb(error3);
|
|
10185
10185
|
return;
|
|
10186
10186
|
}
|
|
10187
10187
|
if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
|
|
10188
10188
|
this._masked = (buf[1] & 128) === 128;
|
|
10189
10189
|
if (this._isServer) {
|
|
10190
10190
|
if (!this._masked) {
|
|
10191
|
-
const
|
|
10191
|
+
const error3 = this.createError(
|
|
10192
10192
|
RangeError,
|
|
10193
10193
|
"MASK must be set",
|
|
10194
10194
|
true,
|
|
10195
10195
|
1002,
|
|
10196
10196
|
"WS_ERR_EXPECTED_MASK"
|
|
10197
10197
|
);
|
|
10198
|
-
cb(
|
|
10198
|
+
cb(error3);
|
|
10199
10199
|
return;
|
|
10200
10200
|
}
|
|
10201
10201
|
} else if (this._masked) {
|
|
10202
|
-
const
|
|
10202
|
+
const error3 = this.createError(
|
|
10203
10203
|
RangeError,
|
|
10204
10204
|
"MASK must be clear",
|
|
10205
10205
|
true,
|
|
10206
10206
|
1002,
|
|
10207
10207
|
"WS_ERR_UNEXPECTED_MASK"
|
|
10208
10208
|
);
|
|
10209
|
-
cb(
|
|
10209
|
+
cb(error3);
|
|
10210
10210
|
return;
|
|
10211
10211
|
}
|
|
10212
10212
|
if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
|
|
@@ -10241,14 +10241,14 @@ var require_receiver = __commonJS({
|
|
|
10241
10241
|
const buf = this.consume(8);
|
|
10242
10242
|
const num = buf.readUInt32BE(0);
|
|
10243
10243
|
if (num > Math.pow(2, 53 - 32) - 1) {
|
|
10244
|
-
const
|
|
10244
|
+
const error3 = this.createError(
|
|
10245
10245
|
RangeError,
|
|
10246
10246
|
"Unsupported WebSocket frame: payload length > 2^53 - 1",
|
|
10247
10247
|
false,
|
|
10248
10248
|
1009,
|
|
10249
10249
|
"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"
|
|
10250
10250
|
);
|
|
10251
|
-
cb(
|
|
10251
|
+
cb(error3);
|
|
10252
10252
|
return;
|
|
10253
10253
|
}
|
|
10254
10254
|
this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
@@ -10264,14 +10264,14 @@ var require_receiver = __commonJS({
|
|
|
10264
10264
|
if (this._payloadLength && this._opcode < 8) {
|
|
10265
10265
|
this._totalPayloadLength += this._payloadLength;
|
|
10266
10266
|
if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
|
|
10267
|
-
const
|
|
10267
|
+
const error3 = this.createError(
|
|
10268
10268
|
RangeError,
|
|
10269
10269
|
"Max payload size exceeded",
|
|
10270
10270
|
false,
|
|
10271
10271
|
1009,
|
|
10272
10272
|
"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
|
|
10273
10273
|
);
|
|
10274
|
-
cb(
|
|
10274
|
+
cb(error3);
|
|
10275
10275
|
return;
|
|
10276
10276
|
}
|
|
10277
10277
|
}
|
|
@@ -10338,14 +10338,14 @@ var require_receiver = __commonJS({
|
|
|
10338
10338
|
if (buf.length) {
|
|
10339
10339
|
this._messageLength += buf.length;
|
|
10340
10340
|
if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
|
|
10341
|
-
const
|
|
10341
|
+
const error3 = this.createError(
|
|
10342
10342
|
RangeError,
|
|
10343
10343
|
"Max payload size exceeded",
|
|
10344
10344
|
false,
|
|
10345
10345
|
1009,
|
|
10346
10346
|
"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
|
|
10347
10347
|
);
|
|
10348
|
-
cb(
|
|
10348
|
+
cb(error3);
|
|
10349
10349
|
return;
|
|
10350
10350
|
}
|
|
10351
10351
|
this._fragments.push(buf);
|
|
@@ -10396,14 +10396,14 @@ var require_receiver = __commonJS({
|
|
|
10396
10396
|
} else {
|
|
10397
10397
|
const buf = concat(fragments, messageLength);
|
|
10398
10398
|
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
10399
|
-
const
|
|
10399
|
+
const error3 = this.createError(
|
|
10400
10400
|
Error,
|
|
10401
10401
|
"invalid UTF-8 sequence",
|
|
10402
10402
|
true,
|
|
10403
10403
|
1007,
|
|
10404
10404
|
"WS_ERR_INVALID_UTF8"
|
|
10405
10405
|
);
|
|
10406
|
-
cb(
|
|
10406
|
+
cb(error3);
|
|
10407
10407
|
return;
|
|
10408
10408
|
}
|
|
10409
10409
|
if (this._state === INFLATING || this._allowSynchronousEvents) {
|
|
@@ -10435,14 +10435,14 @@ var require_receiver = __commonJS({
|
|
|
10435
10435
|
} else {
|
|
10436
10436
|
const code = data.readUInt16BE(0);
|
|
10437
10437
|
if (!isValidStatusCode(code)) {
|
|
10438
|
-
const
|
|
10438
|
+
const error3 = this.createError(
|
|
10439
10439
|
RangeError,
|
|
10440
10440
|
`invalid status code ${code}`,
|
|
10441
10441
|
true,
|
|
10442
10442
|
1002,
|
|
10443
10443
|
"WS_ERR_INVALID_CLOSE_CODE"
|
|
10444
10444
|
);
|
|
10445
|
-
cb(
|
|
10445
|
+
cb(error3);
|
|
10446
10446
|
return;
|
|
10447
10447
|
}
|
|
10448
10448
|
const buf = new FastBuffer(
|
|
@@ -10451,14 +10451,14 @@ var require_receiver = __commonJS({
|
|
|
10451
10451
|
data.length - 2
|
|
10452
10452
|
);
|
|
10453
10453
|
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
10454
|
-
const
|
|
10454
|
+
const error3 = this.createError(
|
|
10455
10455
|
Error,
|
|
10456
10456
|
"invalid UTF-8 sequence",
|
|
10457
10457
|
true,
|
|
10458
10458
|
1007,
|
|
10459
10459
|
"WS_ERR_INVALID_UTF8"
|
|
10460
10460
|
);
|
|
10461
|
-
cb(
|
|
10461
|
+
cb(error3);
|
|
10462
10462
|
return;
|
|
10463
10463
|
}
|
|
10464
10464
|
this._loop = false;
|
|
@@ -11167,10 +11167,10 @@ var require_event_target = __commonJS({
|
|
|
11167
11167
|
callListener(handler, this, event);
|
|
11168
11168
|
};
|
|
11169
11169
|
} else if (type === "error") {
|
|
11170
|
-
wrapper = function onError(
|
|
11170
|
+
wrapper = function onError(error3) {
|
|
11171
11171
|
const event = new ErrorEvent("error", {
|
|
11172
|
-
error:
|
|
11173
|
-
message:
|
|
11172
|
+
error: error3,
|
|
11173
|
+
message: error3.message
|
|
11174
11174
|
});
|
|
11175
11175
|
event[kTarget] = this;
|
|
11176
11176
|
callListener(handler, this, event);
|
|
@@ -12295,7 +12295,7 @@ var require_stream = __commonJS({
|
|
|
12295
12295
|
const data = !isBinary2 && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
12296
12296
|
if (!duplex.push(data)) ws.pause();
|
|
12297
12297
|
});
|
|
12298
|
-
ws.once("error", function
|
|
12298
|
+
ws.once("error", function error3(err) {
|
|
12299
12299
|
if (duplex.destroyed) return;
|
|
12300
12300
|
terminateOnDestroy = false;
|
|
12301
12301
|
duplex.destroy(err);
|
|
@@ -12311,7 +12311,7 @@ var require_stream = __commonJS({
|
|
|
12311
12311
|
return;
|
|
12312
12312
|
}
|
|
12313
12313
|
let called = false;
|
|
12314
|
-
ws.once("error", function
|
|
12314
|
+
ws.once("error", function error3(err2) {
|
|
12315
12315
|
called = true;
|
|
12316
12316
|
callback(err2);
|
|
12317
12317
|
});
|
|
@@ -13233,9 +13233,9 @@ var require_codegen = __commonJS({
|
|
|
13233
13233
|
}
|
|
13234
13234
|
};
|
|
13235
13235
|
var Throw = class extends Node {
|
|
13236
|
-
constructor(
|
|
13236
|
+
constructor(error3) {
|
|
13237
13237
|
super();
|
|
13238
|
-
this.error =
|
|
13238
|
+
this.error = error3;
|
|
13239
13239
|
}
|
|
13240
13240
|
render({ _n }) {
|
|
13241
13241
|
return `throw ${this.error};` + _n;
|
|
@@ -13472,9 +13472,9 @@ var require_codegen = __commonJS({
|
|
|
13472
13472
|
}
|
|
13473
13473
|
};
|
|
13474
13474
|
var Catch = class extends BlockNode {
|
|
13475
|
-
constructor(
|
|
13475
|
+
constructor(error3) {
|
|
13476
13476
|
super();
|
|
13477
|
-
this.error =
|
|
13477
|
+
this.error = error3;
|
|
13478
13478
|
}
|
|
13479
13479
|
render(opts) {
|
|
13480
13480
|
return `catch(${this.error})` + super.render(opts);
|
|
@@ -13665,9 +13665,9 @@ var require_codegen = __commonJS({
|
|
|
13665
13665
|
this._blockNode(node);
|
|
13666
13666
|
this.code(tryBody);
|
|
13667
13667
|
if (catchCode) {
|
|
13668
|
-
const
|
|
13669
|
-
this._currNode = node.catch = new Catch(
|
|
13670
|
-
catchCode(
|
|
13668
|
+
const error3 = this.name("e");
|
|
13669
|
+
this._currNode = node.catch = new Catch(error3);
|
|
13670
|
+
catchCode(error3);
|
|
13671
13671
|
}
|
|
13672
13672
|
if (finallyCode) {
|
|
13673
13673
|
this._currNode = node.finally = new Finally();
|
|
@@ -13676,8 +13676,8 @@ var require_codegen = __commonJS({
|
|
|
13676
13676
|
return this._endBlockNode(Catch, Finally);
|
|
13677
13677
|
}
|
|
13678
13678
|
// `throw` statement
|
|
13679
|
-
throw(
|
|
13680
|
-
return this._leafNode(new Throw(
|
|
13679
|
+
throw(error3) {
|
|
13680
|
+
return this._leafNode(new Throw(error3));
|
|
13681
13681
|
}
|
|
13682
13682
|
// start self-balancing block
|
|
13683
13683
|
block(body, nodeCount) {
|
|
@@ -14033,10 +14033,10 @@ var require_errors = __commonJS({
|
|
|
14033
14033
|
exports2.keyword$DataError = {
|
|
14034
14034
|
message: ({ keyword, schemaType }) => schemaType ? (0, codegen_1.str)`"${keyword}" keyword must be ${schemaType} ($data)` : (0, codegen_1.str)`"${keyword}" keyword is invalid ($data)`
|
|
14035
14035
|
};
|
|
14036
|
-
function reportError(cxt,
|
|
14036
|
+
function reportError(cxt, error3 = exports2.keywordError, errorPaths, overrideAllErrors) {
|
|
14037
14037
|
const { it } = cxt;
|
|
14038
14038
|
const { gen, compositeRule, allErrors } = it;
|
|
14039
|
-
const errObj = errorObjectCode(cxt,
|
|
14039
|
+
const errObj = errorObjectCode(cxt, error3, errorPaths);
|
|
14040
14040
|
if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : compositeRule || allErrors) {
|
|
14041
14041
|
addError(gen, errObj);
|
|
14042
14042
|
} else {
|
|
@@ -14044,10 +14044,10 @@ var require_errors = __commonJS({
|
|
|
14044
14044
|
}
|
|
14045
14045
|
}
|
|
14046
14046
|
exports2.reportError = reportError;
|
|
14047
|
-
function reportExtraError(cxt,
|
|
14047
|
+
function reportExtraError(cxt, error3 = exports2.keywordError, errorPaths) {
|
|
14048
14048
|
const { it } = cxt;
|
|
14049
14049
|
const { gen, compositeRule, allErrors } = it;
|
|
14050
|
-
const errObj = errorObjectCode(cxt,
|
|
14050
|
+
const errObj = errorObjectCode(cxt, error3, errorPaths);
|
|
14051
14051
|
addError(gen, errObj);
|
|
14052
14052
|
if (!(compositeRule || allErrors)) {
|
|
14053
14053
|
returnErrors(it, names_1.default.vErrors);
|
|
@@ -14098,19 +14098,19 @@ var require_errors = __commonJS({
|
|
|
14098
14098
|
schema: new codegen_1.Name("schema"),
|
|
14099
14099
|
parentSchema: new codegen_1.Name("parentSchema")
|
|
14100
14100
|
};
|
|
14101
|
-
function errorObjectCode(cxt,
|
|
14101
|
+
function errorObjectCode(cxt, error3, errorPaths) {
|
|
14102
14102
|
const { createErrors } = cxt.it;
|
|
14103
14103
|
if (createErrors === false)
|
|
14104
14104
|
return (0, codegen_1._)`{}`;
|
|
14105
|
-
return errorObject(cxt,
|
|
14105
|
+
return errorObject(cxt, error3, errorPaths);
|
|
14106
14106
|
}
|
|
14107
|
-
function errorObject(cxt,
|
|
14107
|
+
function errorObject(cxt, error3, errorPaths = {}) {
|
|
14108
14108
|
const { gen, it } = cxt;
|
|
14109
14109
|
const keyValues = [
|
|
14110
14110
|
errorInstancePath(it, errorPaths),
|
|
14111
14111
|
errorSchemaPath(cxt, errorPaths)
|
|
14112
14112
|
];
|
|
14113
|
-
extraErrorProps(cxt,
|
|
14113
|
+
extraErrorProps(cxt, error3, keyValues);
|
|
14114
14114
|
return gen.object(...keyValues);
|
|
14115
14115
|
}
|
|
14116
14116
|
function errorInstancePath({ errorPath }, { instancePath }) {
|
|
@@ -17378,7 +17378,7 @@ var require_limitNumber = __commonJS({
|
|
|
17378
17378
|
exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
|
|
17379
17379
|
exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }
|
|
17380
17380
|
};
|
|
17381
|
-
var
|
|
17381
|
+
var error3 = {
|
|
17382
17382
|
message: ({ keyword, schemaCode }) => (0, codegen_1.str)`must be ${KWDs[keyword].okStr} ${schemaCode}`,
|
|
17383
17383
|
params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
|
|
17384
17384
|
};
|
|
@@ -17387,7 +17387,7 @@ var require_limitNumber = __commonJS({
|
|
|
17387
17387
|
type: "number",
|
|
17388
17388
|
schemaType: "number",
|
|
17389
17389
|
$data: true,
|
|
17390
|
-
error:
|
|
17390
|
+
error: error3,
|
|
17391
17391
|
code(cxt) {
|
|
17392
17392
|
const { keyword, data, schemaCode } = cxt;
|
|
17393
17393
|
cxt.fail$data((0, codegen_1._)`${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`);
|
|
@@ -17403,7 +17403,7 @@ var require_multipleOf = __commonJS({
|
|
|
17403
17403
|
"use strict";
|
|
17404
17404
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
17405
17405
|
var codegen_1 = require_codegen();
|
|
17406
|
-
var
|
|
17406
|
+
var error3 = {
|
|
17407
17407
|
message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`,
|
|
17408
17408
|
params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}`
|
|
17409
17409
|
};
|
|
@@ -17412,7 +17412,7 @@ var require_multipleOf = __commonJS({
|
|
|
17412
17412
|
type: "number",
|
|
17413
17413
|
schemaType: "number",
|
|
17414
17414
|
$data: true,
|
|
17415
|
-
error:
|
|
17415
|
+
error: error3,
|
|
17416
17416
|
code(cxt) {
|
|
17417
17417
|
const { gen, data, schemaCode, it } = cxt;
|
|
17418
17418
|
const prec = it.opts.multipleOfPrecision;
|
|
@@ -17459,7 +17459,7 @@ var require_limitLength = __commonJS({
|
|
|
17459
17459
|
var codegen_1 = require_codegen();
|
|
17460
17460
|
var util_1 = require_util();
|
|
17461
17461
|
var ucs2length_1 = require_ucs2length();
|
|
17462
|
-
var
|
|
17462
|
+
var error3 = {
|
|
17463
17463
|
message({ keyword, schemaCode }) {
|
|
17464
17464
|
const comp = keyword === "maxLength" ? "more" : "fewer";
|
|
17465
17465
|
return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} characters`;
|
|
@@ -17471,7 +17471,7 @@ var require_limitLength = __commonJS({
|
|
|
17471
17471
|
type: "string",
|
|
17472
17472
|
schemaType: "number",
|
|
17473
17473
|
$data: true,
|
|
17474
|
-
error:
|
|
17474
|
+
error: error3,
|
|
17475
17475
|
code(cxt) {
|
|
17476
17476
|
const { keyword, data, schemaCode, it } = cxt;
|
|
17477
17477
|
const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT;
|
|
@@ -17491,7 +17491,7 @@ var require_pattern = __commonJS({
|
|
|
17491
17491
|
var code_1 = require_code2();
|
|
17492
17492
|
var util_1 = require_util();
|
|
17493
17493
|
var codegen_1 = require_codegen();
|
|
17494
|
-
var
|
|
17494
|
+
var error3 = {
|
|
17495
17495
|
message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
|
|
17496
17496
|
params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`
|
|
17497
17497
|
};
|
|
@@ -17500,7 +17500,7 @@ var require_pattern = __commonJS({
|
|
|
17500
17500
|
type: "string",
|
|
17501
17501
|
schemaType: "string",
|
|
17502
17502
|
$data: true,
|
|
17503
|
-
error:
|
|
17503
|
+
error: error3,
|
|
17504
17504
|
code(cxt) {
|
|
17505
17505
|
const { gen, data, $data, schema, schemaCode, it } = cxt;
|
|
17506
17506
|
const u = it.opts.unicodeRegExp ? "u" : "";
|
|
@@ -17526,7 +17526,7 @@ var require_limitProperties = __commonJS({
|
|
|
17526
17526
|
"use strict";
|
|
17527
17527
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
17528
17528
|
var codegen_1 = require_codegen();
|
|
17529
|
-
var
|
|
17529
|
+
var error3 = {
|
|
17530
17530
|
message({ keyword, schemaCode }) {
|
|
17531
17531
|
const comp = keyword === "maxProperties" ? "more" : "fewer";
|
|
17532
17532
|
return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} properties`;
|
|
@@ -17538,7 +17538,7 @@ var require_limitProperties = __commonJS({
|
|
|
17538
17538
|
type: "object",
|
|
17539
17539
|
schemaType: "number",
|
|
17540
17540
|
$data: true,
|
|
17541
|
-
error:
|
|
17541
|
+
error: error3,
|
|
17542
17542
|
code(cxt) {
|
|
17543
17543
|
const { keyword, data, schemaCode } = cxt;
|
|
17544
17544
|
const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT;
|
|
@@ -17557,7 +17557,7 @@ var require_required = __commonJS({
|
|
|
17557
17557
|
var code_1 = require_code2();
|
|
17558
17558
|
var codegen_1 = require_codegen();
|
|
17559
17559
|
var util_1 = require_util();
|
|
17560
|
-
var
|
|
17560
|
+
var error3 = {
|
|
17561
17561
|
message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
|
|
17562
17562
|
params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
|
|
17563
17563
|
};
|
|
@@ -17566,7 +17566,7 @@ var require_required = __commonJS({
|
|
|
17566
17566
|
type: "object",
|
|
17567
17567
|
schemaType: "array",
|
|
17568
17568
|
$data: true,
|
|
17569
|
-
error:
|
|
17569
|
+
error: error3,
|
|
17570
17570
|
code(cxt) {
|
|
17571
17571
|
const { gen, schema, schemaCode, data, $data, it } = cxt;
|
|
17572
17572
|
const { opts } = it;
|
|
@@ -17637,7 +17637,7 @@ var require_limitItems = __commonJS({
|
|
|
17637
17637
|
"use strict";
|
|
17638
17638
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
17639
17639
|
var codegen_1 = require_codegen();
|
|
17640
|
-
var
|
|
17640
|
+
var error3 = {
|
|
17641
17641
|
message({ keyword, schemaCode }) {
|
|
17642
17642
|
const comp = keyword === "maxItems" ? "more" : "fewer";
|
|
17643
17643
|
return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} items`;
|
|
@@ -17649,7 +17649,7 @@ var require_limitItems = __commonJS({
|
|
|
17649
17649
|
type: "array",
|
|
17650
17650
|
schemaType: "number",
|
|
17651
17651
|
$data: true,
|
|
17652
|
-
error:
|
|
17652
|
+
error: error3,
|
|
17653
17653
|
code(cxt) {
|
|
17654
17654
|
const { keyword, data, schemaCode } = cxt;
|
|
17655
17655
|
const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT;
|
|
@@ -17680,7 +17680,7 @@ var require_uniqueItems = __commonJS({
|
|
|
17680
17680
|
var codegen_1 = require_codegen();
|
|
17681
17681
|
var util_1 = require_util();
|
|
17682
17682
|
var equal_1 = require_equal();
|
|
17683
|
-
var
|
|
17683
|
+
var error3 = {
|
|
17684
17684
|
message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
|
|
17685
17685
|
params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`
|
|
17686
17686
|
};
|
|
@@ -17689,7 +17689,7 @@ var require_uniqueItems = __commonJS({
|
|
|
17689
17689
|
type: "array",
|
|
17690
17690
|
schemaType: "boolean",
|
|
17691
17691
|
$data: true,
|
|
17692
|
-
error:
|
|
17692
|
+
error: error3,
|
|
17693
17693
|
code(cxt) {
|
|
17694
17694
|
const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt;
|
|
17695
17695
|
if (!$data && !schema)
|
|
@@ -17746,14 +17746,14 @@ var require_const = __commonJS({
|
|
|
17746
17746
|
var codegen_1 = require_codegen();
|
|
17747
17747
|
var util_1 = require_util();
|
|
17748
17748
|
var equal_1 = require_equal();
|
|
17749
|
-
var
|
|
17749
|
+
var error3 = {
|
|
17750
17750
|
message: "must be equal to constant",
|
|
17751
17751
|
params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}`
|
|
17752
17752
|
};
|
|
17753
17753
|
var def = {
|
|
17754
17754
|
keyword: "const",
|
|
17755
17755
|
$data: true,
|
|
17756
|
-
error:
|
|
17756
|
+
error: error3,
|
|
17757
17757
|
code(cxt) {
|
|
17758
17758
|
const { gen, data, $data, schemaCode, schema } = cxt;
|
|
17759
17759
|
if ($data || schema && typeof schema == "object") {
|
|
@@ -17775,7 +17775,7 @@ var require_enum = __commonJS({
|
|
|
17775
17775
|
var codegen_1 = require_codegen();
|
|
17776
17776
|
var util_1 = require_util();
|
|
17777
17777
|
var equal_1 = require_equal();
|
|
17778
|
-
var
|
|
17778
|
+
var error3 = {
|
|
17779
17779
|
message: "must be equal to one of the allowed values",
|
|
17780
17780
|
params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}`
|
|
17781
17781
|
};
|
|
@@ -17783,7 +17783,7 @@ var require_enum = __commonJS({
|
|
|
17783
17783
|
keyword: "enum",
|
|
17784
17784
|
schemaType: "array",
|
|
17785
17785
|
$data: true,
|
|
17786
|
-
error:
|
|
17786
|
+
error: error3,
|
|
17787
17787
|
code(cxt) {
|
|
17788
17788
|
const { gen, data, $data, schema, schemaCode, it } = cxt;
|
|
17789
17789
|
if (!$data && schema.length === 0)
|
|
@@ -17862,7 +17862,7 @@ var require_additionalItems = __commonJS({
|
|
|
17862
17862
|
exports2.validateAdditionalItems = void 0;
|
|
17863
17863
|
var codegen_1 = require_codegen();
|
|
17864
17864
|
var util_1 = require_util();
|
|
17865
|
-
var
|
|
17865
|
+
var error3 = {
|
|
17866
17866
|
message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
|
|
17867
17867
|
params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
|
|
17868
17868
|
};
|
|
@@ -17871,7 +17871,7 @@ var require_additionalItems = __commonJS({
|
|
|
17871
17871
|
type: "array",
|
|
17872
17872
|
schemaType: ["boolean", "object"],
|
|
17873
17873
|
before: "uniqueItems",
|
|
17874
|
-
error:
|
|
17874
|
+
error: error3,
|
|
17875
17875
|
code(cxt) {
|
|
17876
17876
|
const { parentSchema, it } = cxt;
|
|
17877
17877
|
const { items } = parentSchema;
|
|
@@ -17990,7 +17990,7 @@ var require_items2020 = __commonJS({
|
|
|
17990
17990
|
var util_1 = require_util();
|
|
17991
17991
|
var code_1 = require_code2();
|
|
17992
17992
|
var additionalItems_1 = require_additionalItems();
|
|
17993
|
-
var
|
|
17993
|
+
var error3 = {
|
|
17994
17994
|
message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
|
|
17995
17995
|
params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
|
|
17996
17996
|
};
|
|
@@ -17999,7 +17999,7 @@ var require_items2020 = __commonJS({
|
|
|
17999
17999
|
type: "array",
|
|
18000
18000
|
schemaType: ["object", "boolean"],
|
|
18001
18001
|
before: "uniqueItems",
|
|
18002
|
-
error:
|
|
18002
|
+
error: error3,
|
|
18003
18003
|
code(cxt) {
|
|
18004
18004
|
const { schema, parentSchema, it } = cxt;
|
|
18005
18005
|
const { prefixItems } = parentSchema;
|
|
@@ -18023,7 +18023,7 @@ var require_contains = __commonJS({
|
|
|
18023
18023
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18024
18024
|
var codegen_1 = require_codegen();
|
|
18025
18025
|
var util_1 = require_util();
|
|
18026
|
-
var
|
|
18026
|
+
var error3 = {
|
|
18027
18027
|
message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`,
|
|
18028
18028
|
params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
|
|
18029
18029
|
};
|
|
@@ -18033,7 +18033,7 @@ var require_contains = __commonJS({
|
|
|
18033
18033
|
schemaType: ["object", "boolean"],
|
|
18034
18034
|
before: "uniqueItems",
|
|
18035
18035
|
trackErrors: true,
|
|
18036
|
-
error:
|
|
18036
|
+
error: error3,
|
|
18037
18037
|
code(cxt) {
|
|
18038
18038
|
const { gen, schema, parentSchema, data, it } = cxt;
|
|
18039
18039
|
let min;
|
|
@@ -18211,7 +18211,7 @@ var require_propertyNames = __commonJS({
|
|
|
18211
18211
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18212
18212
|
var codegen_1 = require_codegen();
|
|
18213
18213
|
var util_1 = require_util();
|
|
18214
|
-
var
|
|
18214
|
+
var error3 = {
|
|
18215
18215
|
message: "property name must be valid",
|
|
18216
18216
|
params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
|
|
18217
18217
|
};
|
|
@@ -18219,7 +18219,7 @@ var require_propertyNames = __commonJS({
|
|
|
18219
18219
|
keyword: "propertyNames",
|
|
18220
18220
|
type: "object",
|
|
18221
18221
|
schemaType: ["object", "boolean"],
|
|
18222
|
-
error:
|
|
18222
|
+
error: error3,
|
|
18223
18223
|
code(cxt) {
|
|
18224
18224
|
const { gen, schema, data, it } = cxt;
|
|
18225
18225
|
if ((0, util_1.alwaysValidSchema)(it, schema))
|
|
@@ -18256,7 +18256,7 @@ var require_additionalProperties = __commonJS({
|
|
|
18256
18256
|
var codegen_1 = require_codegen();
|
|
18257
18257
|
var names_1 = require_names();
|
|
18258
18258
|
var util_1 = require_util();
|
|
18259
|
-
var
|
|
18259
|
+
var error3 = {
|
|
18260
18260
|
message: "must NOT have additional properties",
|
|
18261
18261
|
params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
|
|
18262
18262
|
};
|
|
@@ -18266,7 +18266,7 @@ var require_additionalProperties = __commonJS({
|
|
|
18266
18266
|
schemaType: ["boolean", "object"],
|
|
18267
18267
|
allowUndefined: true,
|
|
18268
18268
|
trackErrors: true,
|
|
18269
|
-
error:
|
|
18269
|
+
error: error3,
|
|
18270
18270
|
code(cxt) {
|
|
18271
18271
|
const { gen, schema, parentSchema, data, errsCount, it } = cxt;
|
|
18272
18272
|
if (!errsCount)
|
|
@@ -18540,7 +18540,7 @@ var require_oneOf = __commonJS({
|
|
|
18540
18540
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18541
18541
|
var codegen_1 = require_codegen();
|
|
18542
18542
|
var util_1 = require_util();
|
|
18543
|
-
var
|
|
18543
|
+
var error3 = {
|
|
18544
18544
|
message: "must match exactly one schema in oneOf",
|
|
18545
18545
|
params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
|
|
18546
18546
|
};
|
|
@@ -18548,7 +18548,7 @@ var require_oneOf = __commonJS({
|
|
|
18548
18548
|
keyword: "oneOf",
|
|
18549
18549
|
schemaType: "array",
|
|
18550
18550
|
trackErrors: true,
|
|
18551
|
-
error:
|
|
18551
|
+
error: error3,
|
|
18552
18552
|
code(cxt) {
|
|
18553
18553
|
const { gen, schema, parentSchema, it } = cxt;
|
|
18554
18554
|
if (!Array.isArray(schema))
|
|
@@ -18625,7 +18625,7 @@ var require_if = __commonJS({
|
|
|
18625
18625
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18626
18626
|
var codegen_1 = require_codegen();
|
|
18627
18627
|
var util_1 = require_util();
|
|
18628
|
-
var
|
|
18628
|
+
var error3 = {
|
|
18629
18629
|
message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
|
|
18630
18630
|
params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
|
|
18631
18631
|
};
|
|
@@ -18633,7 +18633,7 @@ var require_if = __commonJS({
|
|
|
18633
18633
|
keyword: "if",
|
|
18634
18634
|
schemaType: ["object", "boolean"],
|
|
18635
18635
|
trackErrors: true,
|
|
18636
|
-
error:
|
|
18636
|
+
error: error3,
|
|
18637
18637
|
code(cxt) {
|
|
18638
18638
|
const { gen, parentSchema, it } = cxt;
|
|
18639
18639
|
if (parentSchema.then === void 0 && parentSchema.else === void 0) {
|
|
@@ -18958,7 +18958,7 @@ var require_unevaluatedProperties = __commonJS({
|
|
|
18958
18958
|
var codegen_1 = require_codegen();
|
|
18959
18959
|
var util_1 = require_util();
|
|
18960
18960
|
var names_1 = require_names();
|
|
18961
|
-
var
|
|
18961
|
+
var error3 = {
|
|
18962
18962
|
message: "must NOT have unevaluated properties",
|
|
18963
18963
|
params: ({ params }) => (0, codegen_1._)`{unevaluatedProperty: ${params.unevaluatedProperty}}`
|
|
18964
18964
|
};
|
|
@@ -18967,7 +18967,7 @@ var require_unevaluatedProperties = __commonJS({
|
|
|
18967
18967
|
type: "object",
|
|
18968
18968
|
schemaType: ["boolean", "object"],
|
|
18969
18969
|
trackErrors: true,
|
|
18970
|
-
error:
|
|
18970
|
+
error: error3,
|
|
18971
18971
|
code(cxt) {
|
|
18972
18972
|
const { gen, schema, data, errsCount, it } = cxt;
|
|
18973
18973
|
if (!errsCount)
|
|
@@ -19023,7 +19023,7 @@ var require_unevaluatedItems = __commonJS({
|
|
|
19023
19023
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19024
19024
|
var codegen_1 = require_codegen();
|
|
19025
19025
|
var util_1 = require_util();
|
|
19026
|
-
var
|
|
19026
|
+
var error3 = {
|
|
19027
19027
|
message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
|
|
19028
19028
|
params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
|
|
19029
19029
|
};
|
|
@@ -19031,7 +19031,7 @@ var require_unevaluatedItems = __commonJS({
|
|
|
19031
19031
|
keyword: "unevaluatedItems",
|
|
19032
19032
|
type: "array",
|
|
19033
19033
|
schemaType: ["boolean", "object"],
|
|
19034
|
-
error:
|
|
19034
|
+
error: error3,
|
|
19035
19035
|
code(cxt) {
|
|
19036
19036
|
const { gen, schema, data, it } = cxt;
|
|
19037
19037
|
const items = it.items || 0;
|
|
@@ -19078,7 +19078,7 @@ var require_format = __commonJS({
|
|
|
19078
19078
|
"use strict";
|
|
19079
19079
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19080
19080
|
var codegen_1 = require_codegen();
|
|
19081
|
-
var
|
|
19081
|
+
var error3 = {
|
|
19082
19082
|
message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`,
|
|
19083
19083
|
params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`
|
|
19084
19084
|
};
|
|
@@ -19087,7 +19087,7 @@ var require_format = __commonJS({
|
|
|
19087
19087
|
type: ["number", "string"],
|
|
19088
19088
|
schemaType: "string",
|
|
19089
19089
|
$data: true,
|
|
19090
|
-
error:
|
|
19090
|
+
error: error3,
|
|
19091
19091
|
code(cxt, ruleType) {
|
|
19092
19092
|
const { gen, data, $data, schema, schemaCode, it } = cxt;
|
|
19093
19093
|
const { opts, errSchemaPath, schemaEnv, self } = it;
|
|
@@ -19248,7 +19248,7 @@ var require_discriminator = __commonJS({
|
|
|
19248
19248
|
var compile_1 = require_compile();
|
|
19249
19249
|
var ref_error_1 = require_ref_error();
|
|
19250
19250
|
var util_1 = require_util();
|
|
19251
|
-
var
|
|
19251
|
+
var error3 = {
|
|
19252
19252
|
message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`,
|
|
19253
19253
|
params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`
|
|
19254
19254
|
};
|
|
@@ -19256,7 +19256,7 @@ var require_discriminator = __commonJS({
|
|
|
19256
19256
|
keyword: "discriminator",
|
|
19257
19257
|
type: "object",
|
|
19258
19258
|
schemaType: "object",
|
|
19259
|
-
error:
|
|
19259
|
+
error: error3,
|
|
19260
19260
|
code(cxt) {
|
|
19261
19261
|
const { gen, data, schema, parentSchema, it } = cxt;
|
|
19262
19262
|
const { oneOf } = parentSchema;
|
|
@@ -20287,7 +20287,7 @@ var require_limit = __commonJS({
|
|
|
20287
20287
|
formatExclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
|
|
20288
20288
|
formatExclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }
|
|
20289
20289
|
};
|
|
20290
|
-
var
|
|
20290
|
+
var error3 = {
|
|
20291
20291
|
message: ({ keyword, schemaCode }) => (0, codegen_1.str)`should be ${KWDs[keyword].okStr} ${schemaCode}`,
|
|
20292
20292
|
params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
|
|
20293
20293
|
};
|
|
@@ -20296,7 +20296,7 @@ var require_limit = __commonJS({
|
|
|
20296
20296
|
type: "string",
|
|
20297
20297
|
schemaType: "string",
|
|
20298
20298
|
$data: true,
|
|
20299
|
-
error:
|
|
20299
|
+
error: error3,
|
|
20300
20300
|
code(cxt) {
|
|
20301
20301
|
const { gen, data, schemaCode, keyword, it } = cxt;
|
|
20302
20302
|
const { opts, self } = it;
|
|
@@ -25921,11 +25921,11 @@ var SocketWithUpgrade = class extends SocketWithoutUpgrade {
|
|
|
25921
25921
|
transport = null;
|
|
25922
25922
|
}
|
|
25923
25923
|
const onerror = (err) => {
|
|
25924
|
-
const
|
|
25925
|
-
|
|
25924
|
+
const error3 = new Error("probe error: " + err);
|
|
25925
|
+
error3.transport = transport.name;
|
|
25926
25926
|
freezeTransport();
|
|
25927
25927
|
debug6('probe transport "%s" failed because of error: %s', name, err);
|
|
25928
|
-
this.emitReserved("upgradeError",
|
|
25928
|
+
this.emitReserved("upgradeError", error3);
|
|
25929
25929
|
};
|
|
25930
25930
|
function onTransportClose() {
|
|
25931
25931
|
onerror("transport closed");
|
|
@@ -27696,6 +27696,8 @@ var KumaClient = class {
|
|
|
27696
27696
|
this.uptimeCache = {};
|
|
27697
27697
|
// BUG-02 fix: buffer statusPageList pushed by Kuma during afterLogin
|
|
27698
27698
|
this.statusPageCache = null;
|
|
27699
|
+
// Buffer notificationList pushed by Kuma during afterLogin
|
|
27700
|
+
this.notificationCache = null;
|
|
27699
27701
|
this.url = url2;
|
|
27700
27702
|
this.socket = lookup(url2, {
|
|
27701
27703
|
transports: ["websocket"],
|
|
@@ -27719,6 +27721,9 @@ var KumaClient = class {
|
|
|
27719
27721
|
this.socket.on("statusPageList", (data) => {
|
|
27720
27722
|
this.statusPageCache = data;
|
|
27721
27723
|
});
|
|
27724
|
+
this.socket.on("notificationList", (data) => {
|
|
27725
|
+
this.notificationCache = Array.isArray(data) ? data : [];
|
|
27726
|
+
});
|
|
27722
27727
|
}
|
|
27723
27728
|
/**
|
|
27724
27729
|
* Wait for a server-pushed event (not a callback response).
|
|
@@ -27803,10 +27808,16 @@ var KumaClient = class {
|
|
|
27803
27808
|
// BUG-01 fix: addMonitor uses callback, not a separate event
|
|
27804
27809
|
// BUG-03 fix: include required fields accepted_statuscodes, maxretries, retryInterval
|
|
27805
27810
|
async addMonitor(monitor) {
|
|
27811
|
+
const autoToken = monitor.type === "push" && !monitor.pushToken ? Array.from(crypto.getRandomValues(new Uint8Array(24))).map((b) => b.toString(16).padStart(2, "0")).join("") : void 0;
|
|
27806
27812
|
const payload = {
|
|
27807
27813
|
accepted_statuscodes: ["200-299"],
|
|
27808
27814
|
maxretries: 1,
|
|
27809
27815
|
retryInterval: 60,
|
|
27816
|
+
conditions: [],
|
|
27817
|
+
rabbitmqNodes: [],
|
|
27818
|
+
kafkaProducerBrokers: [],
|
|
27819
|
+
kafkaProducerSaslOptions: { mechanism: "none" },
|
|
27820
|
+
...autoToken ? { pushToken: autoToken } : {},
|
|
27810
27821
|
...monitor
|
|
27811
27822
|
};
|
|
27812
27823
|
return new Promise((resolve, reject) => {
|
|
@@ -27823,7 +27834,11 @@ var KumaClient = class {
|
|
|
27823
27834
|
reject(new Error(result.msg ?? "Failed to add monitor"));
|
|
27824
27835
|
return;
|
|
27825
27836
|
}
|
|
27826
|
-
resolve({
|
|
27837
|
+
resolve({
|
|
27838
|
+
id: result.monitorID,
|
|
27839
|
+
// Return the token we generated so the caller has it immediately
|
|
27840
|
+
pushToken: payload.pushToken
|
|
27841
|
+
});
|
|
27827
27842
|
}
|
|
27828
27843
|
);
|
|
27829
27844
|
});
|
|
@@ -27963,6 +27978,193 @@ var KumaClient = class {
|
|
|
27963
27978
|
});
|
|
27964
27979
|
});
|
|
27965
27980
|
}
|
|
27981
|
+
// ---------------------------------------------------------------------------
|
|
27982
|
+
// Tags
|
|
27983
|
+
// ---------------------------------------------------------------------------
|
|
27984
|
+
/** Get all tags defined in Kuma. Callback-based event. */
|
|
27985
|
+
async getTags() {
|
|
27986
|
+
return new Promise((resolve, reject) => {
|
|
27987
|
+
const timer = setTimeout(() => reject(new Error("getTags timeout")), 1e4);
|
|
27988
|
+
this.socket.emit(
|
|
27989
|
+
"getTags",
|
|
27990
|
+
(result) => {
|
|
27991
|
+
clearTimeout(timer);
|
|
27992
|
+
if (!result.ok) {
|
|
27993
|
+
reject(new Error(result.msg ?? "Failed to fetch tags"));
|
|
27994
|
+
return;
|
|
27995
|
+
}
|
|
27996
|
+
resolve(result.tags ?? []);
|
|
27997
|
+
}
|
|
27998
|
+
);
|
|
27999
|
+
});
|
|
28000
|
+
}
|
|
28001
|
+
/**
|
|
28002
|
+
* Add a tag to a monitor.
|
|
28003
|
+
* socket.emit("addMonitorTag", tagID, monitorID, value, callback)
|
|
28004
|
+
* value is a user-defined label string (can be empty "").
|
|
28005
|
+
*/
|
|
28006
|
+
async addMonitorTag(tagId, monitorId, value2 = "") {
|
|
28007
|
+
return new Promise((resolve, reject) => {
|
|
28008
|
+
const timer = setTimeout(() => reject(new Error("addMonitorTag timeout")), 1e4);
|
|
28009
|
+
this.socket.emit(
|
|
28010
|
+
"addMonitorTag",
|
|
28011
|
+
tagId,
|
|
28012
|
+
monitorId,
|
|
28013
|
+
value2,
|
|
28014
|
+
(result) => {
|
|
28015
|
+
clearTimeout(timer);
|
|
28016
|
+
if (!result.ok) {
|
|
28017
|
+
reject(new Error(result.msg ?? "Failed to add tag to monitor"));
|
|
28018
|
+
return;
|
|
28019
|
+
}
|
|
28020
|
+
resolve();
|
|
28021
|
+
}
|
|
28022
|
+
);
|
|
28023
|
+
});
|
|
28024
|
+
}
|
|
28025
|
+
// ---------------------------------------------------------------------------
|
|
28026
|
+
// Notifications
|
|
28027
|
+
// ---------------------------------------------------------------------------
|
|
28028
|
+
/**
|
|
28029
|
+
* Return the notification list pushed by Kuma after login.
|
|
28030
|
+
* Falls back to a short waitFor if the push hasn't arrived yet.
|
|
28031
|
+
*/
|
|
28032
|
+
async getNotificationList() {
|
|
28033
|
+
if (this.notificationCache !== null) {
|
|
28034
|
+
return this.notificationCache;
|
|
28035
|
+
}
|
|
28036
|
+
return new Promise((resolve) => {
|
|
28037
|
+
const timer = setTimeout(() => resolve([]), 5e3);
|
|
28038
|
+
this.socket.once("notificationList", (data) => {
|
|
28039
|
+
clearTimeout(timer);
|
|
28040
|
+
const list = Array.isArray(data) ? data : [];
|
|
28041
|
+
this.notificationCache = list;
|
|
28042
|
+
resolve(list);
|
|
28043
|
+
});
|
|
28044
|
+
});
|
|
28045
|
+
}
|
|
28046
|
+
/**
|
|
28047
|
+
* Create a new notification channel, or update one if id is provided.
|
|
28048
|
+
* Returns the id of the created/updated notification.
|
|
28049
|
+
*
|
|
28050
|
+
* Server event: addNotification(notification, id|null, callback)
|
|
28051
|
+
* callback: { ok: boolean, id?: number, msg?: string }
|
|
28052
|
+
*/
|
|
28053
|
+
async addNotification(payload, id = null) {
|
|
28054
|
+
return new Promise((resolve, reject) => {
|
|
28055
|
+
const timer = setTimeout(
|
|
28056
|
+
() => reject(new Error("addNotification timeout")),
|
|
28057
|
+
1e4
|
|
28058
|
+
);
|
|
28059
|
+
this.socket.emit(
|
|
28060
|
+
"addNotification",
|
|
28061
|
+
payload,
|
|
28062
|
+
id,
|
|
28063
|
+
(result) => {
|
|
28064
|
+
clearTimeout(timer);
|
|
28065
|
+
if (!result.ok) {
|
|
28066
|
+
reject(new Error(result.msg ?? "Failed to create notification"));
|
|
28067
|
+
return;
|
|
28068
|
+
}
|
|
28069
|
+
resolve(result.id);
|
|
28070
|
+
}
|
|
28071
|
+
);
|
|
28072
|
+
});
|
|
28073
|
+
}
|
|
28074
|
+
/**
|
|
28075
|
+
* Delete a notification channel by id.
|
|
28076
|
+
*/
|
|
28077
|
+
async deleteNotification(id) {
|
|
28078
|
+
return new Promise((resolve, reject) => {
|
|
28079
|
+
const timer = setTimeout(
|
|
28080
|
+
() => reject(new Error("deleteNotification timeout")),
|
|
28081
|
+
1e4
|
|
28082
|
+
);
|
|
28083
|
+
this.socket.emit(
|
|
28084
|
+
"deleteNotification",
|
|
28085
|
+
id,
|
|
28086
|
+
(result) => {
|
|
28087
|
+
clearTimeout(timer);
|
|
28088
|
+
if (!result.ok) {
|
|
28089
|
+
reject(new Error(result.msg ?? "Failed to delete notification"));
|
|
28090
|
+
return;
|
|
28091
|
+
}
|
|
28092
|
+
resolve();
|
|
28093
|
+
}
|
|
28094
|
+
);
|
|
28095
|
+
});
|
|
28096
|
+
}
|
|
28097
|
+
/**
|
|
28098
|
+
* Assign a notification to a monitor.
|
|
28099
|
+
* Uses addMonitorTag-style approach: sends the notificationIDList via
|
|
28100
|
+
* the `editMonitor` event with the full monitor object + updated notificationIDList.
|
|
28101
|
+
* `notificationIDList` is { [notifId]: true } — Kuma's internal format.
|
|
28102
|
+
*/
|
|
28103
|
+
async setMonitorNotification(monitorId, notificationId, enabled, monitorMap) {
|
|
28104
|
+
const existing = monitorMap[String(monitorId)];
|
|
28105
|
+
if (!existing) {
|
|
28106
|
+
throw new Error(`Monitor ${monitorId} not found`);
|
|
28107
|
+
}
|
|
28108
|
+
const notifIdList = {};
|
|
28109
|
+
notifIdList[String(notificationId)] = enabled;
|
|
28110
|
+
return new Promise((resolve, reject) => {
|
|
28111
|
+
const timer = setTimeout(
|
|
28112
|
+
() => reject(new Error("setMonitorNotification timeout")),
|
|
28113
|
+
1e4
|
|
28114
|
+
);
|
|
28115
|
+
this.socket.emit(
|
|
28116
|
+
"editMonitor",
|
|
28117
|
+
{ ...existing, id: monitorId, notificationIDList: notifIdList },
|
|
28118
|
+
(result) => {
|
|
28119
|
+
clearTimeout(timer);
|
|
28120
|
+
if (!result.ok) {
|
|
28121
|
+
reject(new Error(result.msg ?? "Failed to update monitor notification"));
|
|
28122
|
+
return;
|
|
28123
|
+
}
|
|
28124
|
+
resolve();
|
|
28125
|
+
}
|
|
28126
|
+
);
|
|
28127
|
+
});
|
|
28128
|
+
}
|
|
28129
|
+
// ---------------------------------------------------------------------------
|
|
28130
|
+
// Bulk operations
|
|
28131
|
+
// ---------------------------------------------------------------------------
|
|
28132
|
+
/**
|
|
28133
|
+
* Pause all monitors matching a filter function.
|
|
28134
|
+
* Returns a list of { id, name, ok, error? } results.
|
|
28135
|
+
*/
|
|
28136
|
+
async bulkPause(filter) {
|
|
28137
|
+
const monitorMap = await this.getMonitorList();
|
|
28138
|
+
const targets = Object.values(monitorMap).filter(filter);
|
|
28139
|
+
const results = [];
|
|
28140
|
+
for (const m of targets) {
|
|
28141
|
+
try {
|
|
28142
|
+
await this.pauseMonitor(m.id);
|
|
28143
|
+
results.push({ id: m.id, name: m.name, ok: true });
|
|
28144
|
+
} catch (e) {
|
|
28145
|
+
results.push({ id: m.id, name: m.name, ok: false, error: e.message });
|
|
28146
|
+
}
|
|
28147
|
+
}
|
|
28148
|
+
return results;
|
|
28149
|
+
}
|
|
28150
|
+
/**
|
|
28151
|
+
* Resume all monitors matching a filter function.
|
|
28152
|
+
* Returns a list of { id, name, ok, error? } results.
|
|
28153
|
+
*/
|
|
28154
|
+
async bulkResume(filter) {
|
|
28155
|
+
const monitorMap = await this.getMonitorList();
|
|
28156
|
+
const targets = Object.values(monitorMap).filter(filter);
|
|
28157
|
+
const results = [];
|
|
28158
|
+
for (const m of targets) {
|
|
28159
|
+
try {
|
|
28160
|
+
await this.resumeMonitor(m.id);
|
|
28161
|
+
results.push({ id: m.id, name: m.name, ok: true });
|
|
28162
|
+
} catch (e) {
|
|
28163
|
+
results.push({ id: m.id, name: m.name, ok: false, error: e.message });
|
|
28164
|
+
}
|
|
28165
|
+
}
|
|
28166
|
+
return results;
|
|
28167
|
+
}
|
|
27966
28168
|
disconnect() {
|
|
27967
28169
|
this.socket.disconnect();
|
|
27968
28170
|
}
|
|
@@ -28328,8 +28530,8 @@ var attemptifySync = (fn, options) => {
|
|
|
28328
28530
|
return function attemptified(...args) {
|
|
28329
28531
|
try {
|
|
28330
28532
|
return fn.apply(void 0, args);
|
|
28331
|
-
} catch (
|
|
28332
|
-
return onError(
|
|
28533
|
+
} catch (error3) {
|
|
28534
|
+
return onError(error3);
|
|
28333
28535
|
}
|
|
28334
28536
|
};
|
|
28335
28537
|
};
|
|
@@ -28346,11 +28548,11 @@ var retryifyAsync = (fn, options) => {
|
|
|
28346
28548
|
const interval = options2.interval ?? RETRY_INTERVAL;
|
|
28347
28549
|
const timestamp = Date.now() + timeout;
|
|
28348
28550
|
return function attempt(...args) {
|
|
28349
|
-
return fn.apply(void 0, args).catch((
|
|
28350
|
-
if (!isRetriable(
|
|
28351
|
-
throw
|
|
28551
|
+
return fn.apply(void 0, args).catch((error3) => {
|
|
28552
|
+
if (!isRetriable(error3))
|
|
28553
|
+
throw error3;
|
|
28352
28554
|
if (Date.now() >= timestamp)
|
|
28353
|
-
throw
|
|
28555
|
+
throw error3;
|
|
28354
28556
|
const delay = Math.round(interval * Math.random());
|
|
28355
28557
|
if (delay > 0) {
|
|
28356
28558
|
const delayPromise = new Promise((resolve) => setTimeout(resolve, delay));
|
|
@@ -28374,11 +28576,11 @@ var retryifySync = (fn, options) => {
|
|
|
28374
28576
|
while (true) {
|
|
28375
28577
|
try {
|
|
28376
28578
|
return fn.apply(void 0, args);
|
|
28377
|
-
} catch (
|
|
28378
|
-
if (!isRetriable(
|
|
28379
|
-
throw
|
|
28579
|
+
} catch (error3) {
|
|
28580
|
+
if (!isRetriable(error3))
|
|
28581
|
+
throw error3;
|
|
28380
28582
|
if (Date.now() >= timestamp)
|
|
28381
|
-
throw
|
|
28583
|
+
throw error3;
|
|
28382
28584
|
continue;
|
|
28383
28585
|
}
|
|
28384
28586
|
}
|
|
@@ -28393,33 +28595,33 @@ var import_node_process2 = __toESM(require("process"), 1);
|
|
|
28393
28595
|
// node_modules/stubborn-fs/dist/handlers.js
|
|
28394
28596
|
var Handlers = {
|
|
28395
28597
|
/* API */
|
|
28396
|
-
isChangeErrorOk: (
|
|
28397
|
-
if (!Handlers.isNodeError(
|
|
28598
|
+
isChangeErrorOk: (error3) => {
|
|
28599
|
+
if (!Handlers.isNodeError(error3))
|
|
28398
28600
|
return false;
|
|
28399
|
-
const { code } =
|
|
28601
|
+
const { code } = error3;
|
|
28400
28602
|
if (code === "ENOSYS")
|
|
28401
28603
|
return true;
|
|
28402
28604
|
if (!IS_USER_ROOT && (code === "EINVAL" || code === "EPERM"))
|
|
28403
28605
|
return true;
|
|
28404
28606
|
return false;
|
|
28405
28607
|
},
|
|
28406
|
-
isNodeError: (
|
|
28407
|
-
return
|
|
28608
|
+
isNodeError: (error3) => {
|
|
28609
|
+
return error3 instanceof Error;
|
|
28408
28610
|
},
|
|
28409
|
-
isRetriableError: (
|
|
28410
|
-
if (!Handlers.isNodeError(
|
|
28611
|
+
isRetriableError: (error3) => {
|
|
28612
|
+
if (!Handlers.isNodeError(error3))
|
|
28411
28613
|
return false;
|
|
28412
|
-
const { code } =
|
|
28614
|
+
const { code } = error3;
|
|
28413
28615
|
if (code === "EMFILE" || code === "ENFILE" || code === "EAGAIN" || code === "EBUSY" || code === "EACCESS" || code === "EACCES" || code === "EACCS" || code === "EPERM")
|
|
28414
28616
|
return true;
|
|
28415
28617
|
return false;
|
|
28416
28618
|
},
|
|
28417
|
-
onChangeError: (
|
|
28418
|
-
if (!Handlers.isNodeError(
|
|
28419
|
-
throw
|
|
28420
|
-
if (Handlers.isChangeErrorOk(
|
|
28619
|
+
onChangeError: (error3) => {
|
|
28620
|
+
if (!Handlers.isNodeError(error3))
|
|
28621
|
+
throw error3;
|
|
28622
|
+
if (Handlers.isChangeErrorOk(error3))
|
|
28421
28623
|
return;
|
|
28422
|
-
throw
|
|
28624
|
+
throw error3;
|
|
28423
28625
|
}
|
|
28424
28626
|
};
|
|
28425
28627
|
var handlers_default = Handlers;
|
|
@@ -28686,11 +28888,11 @@ function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
|
|
|
28686
28888
|
}
|
|
28687
28889
|
try {
|
|
28688
28890
|
dist_default.retry.renameSync(retryOptions)(tempPath, filePath);
|
|
28689
|
-
} catch (
|
|
28690
|
-
if (!isException(
|
|
28691
|
-
throw
|
|
28692
|
-
if (
|
|
28693
|
-
throw
|
|
28891
|
+
} catch (error3) {
|
|
28892
|
+
if (!isException(error3))
|
|
28893
|
+
throw error3;
|
|
28894
|
+
if (error3.code !== "ENAMETOOLONG")
|
|
28895
|
+
throw error3;
|
|
28694
28896
|
dist_default.retry.renameSync(retryOptions)(tempPath, temp_default.truncate(filePath));
|
|
28695
28897
|
}
|
|
28696
28898
|
tempDisposer();
|
|
@@ -29088,13 +29290,13 @@ var Conf = class {
|
|
|
29088
29290
|
return Object.assign(createPlainObject(), deserializedData);
|
|
29089
29291
|
};
|
|
29090
29292
|
return parseStore(dataString);
|
|
29091
|
-
} catch (
|
|
29092
|
-
if (
|
|
29293
|
+
} catch (error3) {
|
|
29294
|
+
if (error3?.code === "ENOENT") {
|
|
29093
29295
|
this._ensureDirectory();
|
|
29094
29296
|
return createPlainObject();
|
|
29095
29297
|
}
|
|
29096
29298
|
if (this.#options.clearInvalidConfig) {
|
|
29097
|
-
const errorInstance =
|
|
29299
|
+
const errorInstance = error3;
|
|
29098
29300
|
if (errorInstance.name === "SyntaxError") {
|
|
29099
29301
|
return createPlainObject();
|
|
29100
29302
|
}
|
|
@@ -29105,7 +29307,7 @@ var Conf = class {
|
|
|
29105
29307
|
return createPlainObject();
|
|
29106
29308
|
}
|
|
29107
29309
|
}
|
|
29108
|
-
throw
|
|
29310
|
+
throw error3;
|
|
29109
29311
|
}
|
|
29110
29312
|
}
|
|
29111
29313
|
set store(value2) {
|
|
@@ -29269,12 +29471,12 @@ var Conf = class {
|
|
|
29269
29471
|
} else {
|
|
29270
29472
|
try {
|
|
29271
29473
|
writeFileSync(this.path, data, { mode: this.#options.configFileMode });
|
|
29272
|
-
} catch (
|
|
29273
|
-
if (
|
|
29474
|
+
} catch (error3) {
|
|
29475
|
+
if (error3?.code === "EXDEV") {
|
|
29274
29476
|
import_node_fs3.default.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
|
|
29275
29477
|
return;
|
|
29276
29478
|
}
|
|
29277
|
-
throw
|
|
29479
|
+
throw error3;
|
|
29278
29480
|
}
|
|
29279
29481
|
}
|
|
29280
29482
|
}
|
|
@@ -29328,9 +29530,9 @@ var Conf = class {
|
|
|
29328
29530
|
this._set(MIGRATION_KEY, version);
|
|
29329
29531
|
previousMigratedVersion = version;
|
|
29330
29532
|
storeBackup = structuredClone(this.store);
|
|
29331
|
-
} catch (
|
|
29533
|
+
} catch (error3) {
|
|
29332
29534
|
this.store = storeBackup;
|
|
29333
|
-
const errorMessage =
|
|
29535
|
+
const errorMessage = error3 instanceof Error ? error3.message : String(error3);
|
|
29334
29536
|
throw new Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${errorMessage}`);
|
|
29335
29537
|
}
|
|
29336
29538
|
}
|
|
@@ -30095,9 +30297,9 @@ function isJsonMode(opts) {
|
|
|
30095
30297
|
const env3 = process.env["KUMA_JSON"];
|
|
30096
30298
|
return env3 === "1" || env3 === "true" || env3 === "yes";
|
|
30097
30299
|
}
|
|
30098
|
-
function jsonOut(data) {
|
|
30300
|
+
function jsonOut(data, exitCode = 0) {
|
|
30099
30301
|
console.log(JSON.stringify({ ok: true, data }, null, 2));
|
|
30100
|
-
process.exit(
|
|
30302
|
+
process.exit(exitCode);
|
|
30101
30303
|
}
|
|
30102
30304
|
function jsonError(message, code = 1) {
|
|
30103
30305
|
console.log(JSON.stringify({ ok: false, error: message, code }, null, 2));
|
|
@@ -30230,6 +30432,12 @@ ${source_default.dim("Examples:")}
|
|
|
30230
30432
|
// src/commands/monitors.ts
|
|
30231
30433
|
var import_enquirer2 = __toESM(require_enquirer());
|
|
30232
30434
|
var { prompt: prompt2 } = import_enquirer2.default;
|
|
30435
|
+
function collect(val, prev) {
|
|
30436
|
+
return [...prev, val];
|
|
30437
|
+
}
|
|
30438
|
+
function collectInt(val, prev) {
|
|
30439
|
+
return [...prev, parseInt(val, 10)];
|
|
30440
|
+
}
|
|
30233
30441
|
var MONITOR_TYPES = [
|
|
30234
30442
|
"http",
|
|
30235
30443
|
"tcp",
|
|
@@ -30404,6 +30612,90 @@ ${source_default.dim("Examples:")}
|
|
|
30404
30612
|
}
|
|
30405
30613
|
}
|
|
30406
30614
|
);
|
|
30615
|
+
monitors.command("create").description("Create a monitor non-interactively \u2014 designed for CI/CD pipelines").requiredOption("--name <name>", "Monitor display name").requiredOption("--type <type>", "Monitor type: http, tcp, ping, dns, push, ...").option("--url <url>", "URL or hostname to monitor").option("--interval <seconds>", "Check interval in seconds (default: 60)", "60").option("--tag <tag>", "Assign a tag by name (repeatable \u2014 must already exist in Kuma)", collect, []).option("--notification-id <id>", "Assign a notification channel by ID (repeatable)", collectInt, []).option("--json", "Output as JSON ({ ok, data }) \u2014 prints monitor ID and pushToken to stdout").addHelpText(
|
|
30616
|
+
"after",
|
|
30617
|
+
`
|
|
30618
|
+
${source_default.dim("Examples:")}
|
|
30619
|
+
${source_default.cyan('kuma monitors create --type http --name "habitu.ar" --url https://habitu.ar')}
|
|
30620
|
+
${source_default.cyan('kuma monitors create --type http --name "My API" --url https://api.example.com --tag Production --tag BlackAsteroid')}
|
|
30621
|
+
${source_default.cyan(`kuma monitors create --type push --name "GH Runner" --json | jq '.data.pushToken'`)}
|
|
30622
|
+
${source_default.cyan('kuma monitors create --type tcp --name "DB" --url db.host:5432 --interval 30 --notification-id 1')}
|
|
30623
|
+
|
|
30624
|
+
${source_default.dim("Full pipeline (deploy \u2192 monitor \u2192 heartbeat):")}
|
|
30625
|
+
${source_default.cyan('RESULT=$(kuma monitors create --type push --name "runner" --json)')}
|
|
30626
|
+
${source_default.cyan("PUSH_TOKEN=$(echo $RESULT | jq -r '.data.pushToken')")}
|
|
30627
|
+
${source_default.cyan('kuma heartbeat send $PUSH_TOKEN --msg "Alive"')}
|
|
30628
|
+
`
|
|
30629
|
+
).action(async (opts) => {
|
|
30630
|
+
const config = getConfig();
|
|
30631
|
+
if (!config) requireAuth(opts);
|
|
30632
|
+
const json = isJsonMode(opts);
|
|
30633
|
+
const interval = parseInt(opts.interval ?? "60", 10);
|
|
30634
|
+
if (["http", "keyword", "tcp", "ping", "dns"].includes(opts.type) && !opts.url) {
|
|
30635
|
+
handleError(new Error(`--url is required for monitor type "${opts.type}"`), opts);
|
|
30636
|
+
}
|
|
30637
|
+
try {
|
|
30638
|
+
const client = await createAuthenticatedClient(config.url, config.token);
|
|
30639
|
+
const result = await client.addMonitor({
|
|
30640
|
+
name: opts.name,
|
|
30641
|
+
type: opts.type,
|
|
30642
|
+
url: opts.url,
|
|
30643
|
+
interval
|
|
30644
|
+
});
|
|
30645
|
+
const monitorId = result.id;
|
|
30646
|
+
let pushToken = result.pushToken ?? null;
|
|
30647
|
+
const tagWarnings = [];
|
|
30648
|
+
if (opts.tag.length > 0) {
|
|
30649
|
+
const allTags = await client.getTags();
|
|
30650
|
+
const tagMap = new Map(allTags.map((t) => [t.name.toLowerCase(), t]));
|
|
30651
|
+
for (const tagName of opts.tag) {
|
|
30652
|
+
const found = tagMap.get(tagName.toLowerCase());
|
|
30653
|
+
if (!found) {
|
|
30654
|
+
const warn2 = `Tag "${tagName}" not found \u2014 skipping. Create it in the Kuma UI first.`;
|
|
30655
|
+
tagWarnings.push(warn2);
|
|
30656
|
+
if (!json) {
|
|
30657
|
+
console.warn(source_default.yellow(`\u26A0\uFE0F ${warn2}`));
|
|
30658
|
+
}
|
|
30659
|
+
continue;
|
|
30660
|
+
}
|
|
30661
|
+
await client.addMonitorTag(found.id, monitorId);
|
|
30662
|
+
}
|
|
30663
|
+
}
|
|
30664
|
+
if (opts.notificationId.length > 0) {
|
|
30665
|
+
const monitorMap = await client.getMonitorList();
|
|
30666
|
+
for (const notifId of opts.notificationId) {
|
|
30667
|
+
await client.setMonitorNotification(monitorId, notifId, true, monitorMap);
|
|
30668
|
+
}
|
|
30669
|
+
}
|
|
30670
|
+
client.disconnect();
|
|
30671
|
+
if (json) {
|
|
30672
|
+
const data = {
|
|
30673
|
+
id: monitorId,
|
|
30674
|
+
name: opts.name,
|
|
30675
|
+
type: opts.type,
|
|
30676
|
+
url: opts.url ?? null,
|
|
30677
|
+
interval
|
|
30678
|
+
};
|
|
30679
|
+
if (pushToken) data.pushToken = pushToken;
|
|
30680
|
+
if (tagWarnings.length > 0) data.warnings = tagWarnings;
|
|
30681
|
+
jsonOut(data, tagWarnings.length > 0 ? 1 : 0);
|
|
30682
|
+
}
|
|
30683
|
+
success(`Monitor "${opts.name}" created (ID: ${monitorId})`);
|
|
30684
|
+
if (pushToken) {
|
|
30685
|
+
console.log(` Push token: ${source_default.cyan(pushToken)}`);
|
|
30686
|
+
console.log(` Push URL: ${source_default.dim(`${config.url}/api/push/${pushToken}`)}`);
|
|
30687
|
+
}
|
|
30688
|
+
if (opts.tag.length > 0) {
|
|
30689
|
+
const applied = opts.tag.filter((t) => !tagWarnings.some((w) => w.includes(t)));
|
|
30690
|
+
if (applied.length > 0) console.log(` Tags: ${applied.join(", ")}`);
|
|
30691
|
+
}
|
|
30692
|
+
if (tagWarnings.length > 0) {
|
|
30693
|
+
process.exit(1);
|
|
30694
|
+
}
|
|
30695
|
+
} catch (err) {
|
|
30696
|
+
handleError(err, opts);
|
|
30697
|
+
}
|
|
30698
|
+
});
|
|
30407
30699
|
monitors.command("update <id>").description("Update the name, URL, interval, or active state of a monitor").option("--name <name>", "Set a new display name").option("--url <url>", "Set a new URL or hostname").option("--interval <seconds>", "Set a new check interval (seconds)").option("--active", "Resume the monitor (mark as active)").option("--no-active", "Pause the monitor (mark as inactive)").option("--json", "Output as JSON ({ ok, data })").addHelpText(
|
|
30408
30700
|
"after",
|
|
30409
30701
|
`
|
|
@@ -30575,31 +30867,209 @@ ${source_default.dim("Examples:")}
|
|
|
30575
30867
|
handleError(err, opts);
|
|
30576
30868
|
}
|
|
30577
30869
|
});
|
|
30870
|
+
monitors.command("bulk-pause").description("Pause all monitors matching a tag or status filter").option("--tag <tag>", "Pause all monitors with this tag").option("--status <status>", "Pause all monitors with this status: up, down, pending, maintenance").option("--dry-run", "Preview which monitors would be paused without pausing them").option("--json", "Output as JSON ({ ok, data })").addHelpText(
|
|
30871
|
+
"after",
|
|
30872
|
+
`
|
|
30873
|
+
${source_default.dim("Examples:")}
|
|
30874
|
+
${source_default.cyan("kuma monitors bulk-pause --tag Production")} Pause all Production monitors
|
|
30875
|
+
${source_default.cyan("kuma monitors bulk-pause --tag Production --dry-run")} Preview without pausing
|
|
30876
|
+
${source_default.cyan("kuma monitors bulk-pause --tag Production --json")} Machine-readable results
|
|
30877
|
+
|
|
30878
|
+
${source_default.dim("CI/CD usage:")}
|
|
30879
|
+
${source_default.cyan("kuma monitors bulk-pause --tag Production && ./deploy.sh && kuma monitors bulk-resume --tag Production")}
|
|
30880
|
+
`
|
|
30881
|
+
).action(async (opts) => {
|
|
30882
|
+
const config = getConfig();
|
|
30883
|
+
if (!config) requireAuth(opts);
|
|
30884
|
+
const json = isJsonMode(opts);
|
|
30885
|
+
if (!opts.tag && !opts.status) {
|
|
30886
|
+
handleError(new Error("At least one of --tag or --status is required"), opts);
|
|
30887
|
+
}
|
|
30888
|
+
const STATUS_MAP = { down: 0, up: 1, pending: 2, maintenance: 3 };
|
|
30889
|
+
try {
|
|
30890
|
+
const client = await createAuthenticatedClient(config.url, config.token);
|
|
30891
|
+
const monitorMap = await client.getMonitorList();
|
|
30892
|
+
const all = Object.values(monitorMap);
|
|
30893
|
+
let targets = all;
|
|
30894
|
+
if (opts.tag) {
|
|
30895
|
+
const tagName = opts.tag.toLowerCase();
|
|
30896
|
+
targets = targets.filter(
|
|
30897
|
+
(m) => Array.isArray(m.tags) && m.tags.some((t) => t.name.toLowerCase() === tagName)
|
|
30898
|
+
);
|
|
30899
|
+
}
|
|
30900
|
+
if (opts.status) {
|
|
30901
|
+
const statusNum = STATUS_MAP[opts.status.toLowerCase()];
|
|
30902
|
+
if (statusNum === void 0) {
|
|
30903
|
+
client.disconnect();
|
|
30904
|
+
handleError(new Error(`Invalid status "${opts.status}". Valid: up, down, pending, maintenance`), opts);
|
|
30905
|
+
}
|
|
30906
|
+
targets = targets.filter((m) => m.heartbeat?.status === statusNum);
|
|
30907
|
+
}
|
|
30908
|
+
if (targets.length === 0) {
|
|
30909
|
+
client.disconnect();
|
|
30910
|
+
if (json) jsonOut({ affected: 0, results: [] });
|
|
30911
|
+
console.log("No monitors matched the given filters.");
|
|
30912
|
+
return;
|
|
30913
|
+
}
|
|
30914
|
+
if (opts.dryRun) {
|
|
30915
|
+
client.disconnect();
|
|
30916
|
+
const preview = targets.map((m) => ({ id: m.id, name: m.name }));
|
|
30917
|
+
if (json) jsonOut({ dryRun: true, affected: targets.length, monitors: preview });
|
|
30918
|
+
console.log(source_default.yellow(`Dry run \u2014 would pause ${targets.length} monitor(s):`));
|
|
30919
|
+
preview.forEach((m) => console.log(` ${source_default.dim(String(m.id).padStart(4))} ${m.name}`));
|
|
30920
|
+
return;
|
|
30921
|
+
}
|
|
30922
|
+
const results = await client.bulkPause((m) => targets.some((t) => t.id === m.id));
|
|
30923
|
+
client.disconnect();
|
|
30924
|
+
const failed = results.filter((r) => !r.ok);
|
|
30925
|
+
if (json) {
|
|
30926
|
+
jsonOut({ affected: results.length, failed: failed.length, results });
|
|
30927
|
+
}
|
|
30928
|
+
console.log(`Paused ${results.length - failed.length}/${results.length} monitor(s)`);
|
|
30929
|
+
if (failed.length > 0) {
|
|
30930
|
+
failed.forEach((r) => error(` Monitor ${r.id} (${r.name}): ${r.error}`));
|
|
30931
|
+
process.exit(1);
|
|
30932
|
+
}
|
|
30933
|
+
} catch (err) {
|
|
30934
|
+
handleError(err, opts);
|
|
30935
|
+
}
|
|
30936
|
+
});
|
|
30937
|
+
monitors.command("bulk-resume").description("Resume all monitors matching a tag or status filter").option("--tag <tag>", "Resume all monitors with this tag").option("--status <status>", "Resume all monitors with this status: up, down, pending, maintenance").option("--dry-run", "Preview which monitors would be resumed without resuming them").option("--json", "Output as JSON ({ ok, data })").addHelpText(
|
|
30938
|
+
"after",
|
|
30939
|
+
`
|
|
30940
|
+
${source_default.dim("Examples:")}
|
|
30941
|
+
${source_default.cyan("kuma monitors bulk-resume --tag Production")}
|
|
30942
|
+
${source_default.cyan("kuma monitors bulk-resume --tag Production --dry-run")}
|
|
30943
|
+
${source_default.cyan("kuma monitors bulk-resume --tag Production --json")}
|
|
30944
|
+
`
|
|
30945
|
+
).action(async (opts) => {
|
|
30946
|
+
const config = getConfig();
|
|
30947
|
+
if (!config) requireAuth(opts);
|
|
30948
|
+
const json = isJsonMode(opts);
|
|
30949
|
+
if (!opts.tag && !opts.status) {
|
|
30950
|
+
handleError(new Error("At least one of --tag or --status is required"), opts);
|
|
30951
|
+
}
|
|
30952
|
+
const STATUS_MAP = { down: 0, up: 1, pending: 2, maintenance: 3 };
|
|
30953
|
+
try {
|
|
30954
|
+
const client = await createAuthenticatedClient(config.url, config.token);
|
|
30955
|
+
const monitorMap = await client.getMonitorList();
|
|
30956
|
+
const all = Object.values(monitorMap);
|
|
30957
|
+
let targets = all;
|
|
30958
|
+
if (opts.tag) {
|
|
30959
|
+
const tagName = opts.tag.toLowerCase();
|
|
30960
|
+
targets = targets.filter(
|
|
30961
|
+
(m) => Array.isArray(m.tags) && m.tags.some((t) => t.name.toLowerCase() === tagName)
|
|
30962
|
+
);
|
|
30963
|
+
}
|
|
30964
|
+
if (opts.status) {
|
|
30965
|
+
const statusNum = STATUS_MAP[opts.status.toLowerCase()];
|
|
30966
|
+
if (statusNum === void 0) {
|
|
30967
|
+
client.disconnect();
|
|
30968
|
+
handleError(new Error(`Invalid status "${opts.status}". Valid: up, down, pending, maintenance`), opts);
|
|
30969
|
+
}
|
|
30970
|
+
targets = targets.filter((m) => m.heartbeat?.status === statusNum);
|
|
30971
|
+
}
|
|
30972
|
+
if (targets.length === 0) {
|
|
30973
|
+
client.disconnect();
|
|
30974
|
+
if (json) jsonOut({ affected: 0, results: [] });
|
|
30975
|
+
console.log("No monitors matched the given filters.");
|
|
30976
|
+
return;
|
|
30977
|
+
}
|
|
30978
|
+
if (opts.dryRun) {
|
|
30979
|
+
client.disconnect();
|
|
30980
|
+
const preview = targets.map((m) => ({ id: m.id, name: m.name }));
|
|
30981
|
+
if (json) jsonOut({ dryRun: true, affected: targets.length, monitors: preview });
|
|
30982
|
+
console.log(source_default.yellow(`Dry run \u2014 would resume ${targets.length} monitor(s):`));
|
|
30983
|
+
preview.forEach((m) => console.log(` ${source_default.dim(String(m.id).padStart(4))} ${m.name}`));
|
|
30984
|
+
return;
|
|
30985
|
+
}
|
|
30986
|
+
const results = await client.bulkResume((m) => targets.some((t) => t.id === m.id));
|
|
30987
|
+
client.disconnect();
|
|
30988
|
+
const failed = results.filter((r) => !r.ok);
|
|
30989
|
+
if (json) {
|
|
30990
|
+
jsonOut({ affected: results.length, failed: failed.length, results });
|
|
30991
|
+
}
|
|
30992
|
+
console.log(`Resumed ${results.length - failed.length}/${results.length} monitor(s)`);
|
|
30993
|
+
if (failed.length > 0) {
|
|
30994
|
+
failed.forEach((r) => error(` Monitor ${r.id} (${r.name}): ${r.error}`));
|
|
30995
|
+
process.exit(1);
|
|
30996
|
+
}
|
|
30997
|
+
} catch (err) {
|
|
30998
|
+
handleError(err, opts);
|
|
30999
|
+
}
|
|
31000
|
+
});
|
|
31001
|
+
monitors.command("set-notification <id>").description("Assign or remove a notification channel from a monitor").requiredOption("--notification-id <nid>", "ID of the notification channel to assign").option("--remove", "Remove the notification instead of assigning it").option("--json", "Output as JSON ({ ok, data })").addHelpText(
|
|
31002
|
+
"after",
|
|
31003
|
+
`
|
|
31004
|
+
${source_default.dim("Examples:")}
|
|
31005
|
+
${source_default.cyan("kuma monitors set-notification 42 --notification-id 3")}
|
|
31006
|
+
${source_default.cyan("kuma monitors set-notification 42 --notification-id 3 --remove")}
|
|
31007
|
+
${source_default.cyan("kuma monitors set-notification 42 --notification-id 3 --json")}
|
|
31008
|
+
|
|
31009
|
+
${source_default.dim("Bulk assign via pipe:")}
|
|
31010
|
+
${source_default.cyan("kuma monitors list --tag Production --json | jq '.data[].id' | xargs -I{} kuma monitors set-notification {} --notification-id 3")}
|
|
31011
|
+
`
|
|
31012
|
+
).action(async (id, opts) => {
|
|
31013
|
+
const config = getConfig();
|
|
31014
|
+
if (!config) requireAuth(opts);
|
|
31015
|
+
const json = isJsonMode(opts);
|
|
31016
|
+
const monitorId = parseInt(id, 10);
|
|
31017
|
+
const notifId = parseInt(opts.notificationId, 10);
|
|
31018
|
+
if (isNaN(monitorId)) {
|
|
31019
|
+
handleError(new Error(`Invalid monitor ID: ${id}`), opts);
|
|
31020
|
+
}
|
|
31021
|
+
if (isNaN(notifId)) {
|
|
31022
|
+
handleError(new Error(`Invalid notification ID: ${opts.notificationId}`), opts);
|
|
31023
|
+
}
|
|
31024
|
+
try {
|
|
31025
|
+
const client = await createAuthenticatedClient(config.url, config.token);
|
|
31026
|
+
const monitorMap = await client.getMonitorList();
|
|
31027
|
+
await client.setMonitorNotification(
|
|
31028
|
+
monitorId,
|
|
31029
|
+
notifId,
|
|
31030
|
+
!opts.remove,
|
|
31031
|
+
monitorMap
|
|
31032
|
+
);
|
|
31033
|
+
client.disconnect();
|
|
31034
|
+
const action = opts.remove ? "removed from" : "assigned to";
|
|
31035
|
+
if (json) {
|
|
31036
|
+
jsonOut({ monitorId, notificationId: notifId, action: opts.remove ? "removed" : "assigned" });
|
|
31037
|
+
}
|
|
31038
|
+
success(`Notification ${notifId} ${action} monitor ${monitorId}`);
|
|
31039
|
+
} catch (err) {
|
|
31040
|
+
handleError(err, opts);
|
|
31041
|
+
}
|
|
31042
|
+
});
|
|
30578
31043
|
}
|
|
30579
31044
|
|
|
30580
31045
|
// src/commands/heartbeat.ts
|
|
30581
31046
|
function heartbeatCommand(program3) {
|
|
30582
|
-
program3.command("heartbeat
|
|
31047
|
+
const hb = program3.command("heartbeat").description("View heartbeat history or send push heartbeats to monitors").addHelpText(
|
|
31048
|
+
"after",
|
|
31049
|
+
`
|
|
31050
|
+
${source_default.dim("Subcommands:")}
|
|
31051
|
+
${source_default.cyan("heartbeat view <monitor-id>")} View recent heartbeats for a monitor
|
|
31052
|
+
${source_default.cyan("heartbeat send <push-token>")} Send a push heartbeat (for scripts / GitHub Actions)
|
|
31053
|
+
|
|
31054
|
+
${source_default.dim("Run")} ${source_default.cyan("kuma heartbeat <subcommand> --help")} ${source_default.dim("for examples.")}
|
|
31055
|
+
`
|
|
31056
|
+
);
|
|
31057
|
+
hb.command("view <monitor-id>").description("View recent heartbeats (check results) for a monitor").option("--limit <n>", "Maximum number of heartbeats to display (default: 20)", "20").option("--json", "Output as JSON ({ ok, data })").addHelpText(
|
|
30583
31058
|
"after",
|
|
30584
31059
|
`
|
|
30585
31060
|
${source_default.dim("Examples:")}
|
|
30586
|
-
${source_default.cyan("kuma heartbeat 42")}
|
|
30587
|
-
${source_default.cyan("kuma heartbeat 42 --limit 50")}
|
|
30588
|
-
${source_default.cyan("kuma heartbeat 42 --json")}
|
|
30589
|
-
${source_default.cyan("kuma heartbeat 42 --json | jq '.data[] | select(.status == 0)'")}
|
|
31061
|
+
${source_default.cyan("kuma heartbeat view 42")}
|
|
31062
|
+
${source_default.cyan("kuma heartbeat view 42 --limit 50")}
|
|
31063
|
+
${source_default.cyan("kuma heartbeat view 42 --json")}
|
|
31064
|
+
${source_default.cyan("kuma heartbeat view 42 --json | jq '.data[] | select(.status == 0)'")}
|
|
30590
31065
|
`
|
|
30591
31066
|
).action(async (monitorId, opts) => {
|
|
30592
31067
|
const config = getConfig();
|
|
30593
31068
|
if (!config) requireAuth(opts);
|
|
30594
31069
|
const json = isJsonMode(opts);
|
|
30595
31070
|
try {
|
|
30596
|
-
const client = await createAuthenticatedClient(
|
|
30597
|
-
|
|
30598
|
-
config.token
|
|
30599
|
-
);
|
|
30600
|
-
const heartbeats = await client.getHeartbeatList(
|
|
30601
|
-
parseInt(monitorId, 10)
|
|
30602
|
-
);
|
|
31071
|
+
const client = await createAuthenticatedClient(config.url, config.token);
|
|
31072
|
+
const heartbeats = await client.getHeartbeatList(parseInt(monitorId, 10));
|
|
30603
31073
|
client.disconnect();
|
|
30604
31074
|
const limit = parseInt(opts.limit ?? "20", 10);
|
|
30605
31075
|
const recent = heartbeats.slice(-limit).reverse();
|
|
@@ -30611,12 +31081,12 @@ ${source_default.dim("Examples:")}
|
|
|
30611
31081
|
return;
|
|
30612
31082
|
}
|
|
30613
31083
|
const table = createTable(["Time", "Status", "Ping", "Message"]);
|
|
30614
|
-
recent.forEach((
|
|
31084
|
+
recent.forEach((hb2) => {
|
|
30615
31085
|
table.push([
|
|
30616
|
-
formatDate(
|
|
30617
|
-
statusLabel(
|
|
30618
|
-
formatPing(
|
|
30619
|
-
|
|
31086
|
+
formatDate(hb2.time),
|
|
31087
|
+
statusLabel(hb2.status),
|
|
31088
|
+
formatPing(hb2.ping),
|
|
31089
|
+
hb2.msg ?? "\u2014"
|
|
30620
31090
|
]);
|
|
30621
31091
|
});
|
|
30622
31092
|
console.log(table.toString());
|
|
@@ -30626,6 +31096,81 @@ Showing last ${recent.length} heartbeat(s)`);
|
|
|
30626
31096
|
handleError(err, opts);
|
|
30627
31097
|
}
|
|
30628
31098
|
});
|
|
31099
|
+
hb.command("send <push-token>").description("Send a push heartbeat to a Kuma push monitor (for scripts and GitHub Actions)").option("--status <status>", "Heartbeat status: up, down, maintenance (default: up)").option("--msg <message>", "Optional status message").option("--ping <ms>", "Optional response time in milliseconds").option("--url <url>", "Kuma base URL (defaults to saved login URL)").option("--json", "Output as JSON ({ ok, data })").addHelpText(
|
|
31100
|
+
"after",
|
|
31101
|
+
`
|
|
31102
|
+
${source_default.dim("Examples:")}
|
|
31103
|
+
${source_default.cyan("kuma heartbeat send abc123")}
|
|
31104
|
+
${source_default.cyan('kuma heartbeat send abc123 --status down --msg "Job failed"')}
|
|
31105
|
+
${source_default.cyan('kuma heartbeat send abc123 --msg "Deploy complete" --ping 42')}
|
|
31106
|
+
${source_default.cyan("kuma heartbeat send abc123 --json")}
|
|
31107
|
+
|
|
31108
|
+
${source_default.dim("GitHub Actions usage:")}
|
|
31109
|
+
${source_default.cyan("- name: Heartbeat")}
|
|
31110
|
+
${source_default.cyan(" if: always()")}
|
|
31111
|
+
${source_default.cyan(" run: kuma heartbeat send ${{ secrets.RUNNER_PUSH_TOKEN }} --status ${{ job.status == 'success' && 'up' || 'down' }}")}
|
|
31112
|
+
|
|
31113
|
+
${source_default.dim("Finding your push token:")}
|
|
31114
|
+
Create a "Push" monitor in Kuma UI. The push URL is:
|
|
31115
|
+
https://kuma.example.com/api/push/<token>
|
|
31116
|
+
Use only the <token> part.
|
|
31117
|
+
|
|
31118
|
+
Or get it from CLI: kuma monitors create --type push --name "my-runner" --json | jq '.data.pushToken'
|
|
31119
|
+
`
|
|
31120
|
+
).action(async (pushToken, opts) => {
|
|
31121
|
+
const json = isJsonMode(opts);
|
|
31122
|
+
const VALID_STATUSES = ["up", "down", "maintenance"];
|
|
31123
|
+
const statusKey = (opts.status ?? "up").toLowerCase();
|
|
31124
|
+
if (!VALID_STATUSES.includes(statusKey)) {
|
|
31125
|
+
const msg = `Invalid status "${opts.status}". Valid: up, down, maintenance`;
|
|
31126
|
+
if (json) jsonError(msg, EXIT_CODES.GENERAL);
|
|
31127
|
+
console.error(source_default.red(`\u274C ${msg}`));
|
|
31128
|
+
process.exit(EXIT_CODES.GENERAL);
|
|
31129
|
+
}
|
|
31130
|
+
let baseUrl = opts.url;
|
|
31131
|
+
if (!baseUrl) {
|
|
31132
|
+
const config = getConfig();
|
|
31133
|
+
if (!config) {
|
|
31134
|
+
const msg = "No --url specified and not logged in. Run: kuma login <url> or pass --url";
|
|
31135
|
+
if (json) jsonError(msg, EXIT_CODES.AUTH);
|
|
31136
|
+
console.error(source_default.red(`\u274C ${msg}`));
|
|
31137
|
+
process.exit(EXIT_CODES.AUTH);
|
|
31138
|
+
}
|
|
31139
|
+
baseUrl = config.url;
|
|
31140
|
+
}
|
|
31141
|
+
const pushUrl = new URL(`${baseUrl.replace(/\/$/, "")}/api/push/${pushToken}`);
|
|
31142
|
+
pushUrl.searchParams.set("status", statusKey);
|
|
31143
|
+
if (opts.msg) pushUrl.searchParams.set("msg", opts.msg);
|
|
31144
|
+
if (opts.ping) pushUrl.searchParams.set("ping", opts.ping);
|
|
31145
|
+
try {
|
|
31146
|
+
const res = await fetch(pushUrl.toString(), {
|
|
31147
|
+
signal: AbortSignal.timeout(1e4)
|
|
31148
|
+
});
|
|
31149
|
+
if (!res.ok) {
|
|
31150
|
+
const body = await res.text().catch(() => "");
|
|
31151
|
+
const msg = `Push failed (HTTP ${res.status}): ${body || res.statusText}`;
|
|
31152
|
+
if (json) jsonError(msg, EXIT_CODES.GENERAL);
|
|
31153
|
+
console.error(source_default.red(`\u274C ${msg}`));
|
|
31154
|
+
process.exit(EXIT_CODES.GENERAL);
|
|
31155
|
+
}
|
|
31156
|
+
const data = await res.json().catch(() => ({ ok: true }));
|
|
31157
|
+
if (data.ok === false) {
|
|
31158
|
+
const msg = data.msg ?? "Kuma rejected the push heartbeat";
|
|
31159
|
+
if (json) jsonError(msg, EXIT_CODES.GENERAL);
|
|
31160
|
+
console.error(source_default.red(`\u274C ${msg}`));
|
|
31161
|
+
process.exit(EXIT_CODES.GENERAL);
|
|
31162
|
+
}
|
|
31163
|
+
if (json) {
|
|
31164
|
+
jsonOut({ pushToken, status: statusKey, msg: opts.msg ?? null });
|
|
31165
|
+
}
|
|
31166
|
+
success(`Push heartbeat sent (${statusKey}${opts.msg ? ` \u2014 ${opts.msg}` : ""})`);
|
|
31167
|
+
} catch (e) {
|
|
31168
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
31169
|
+
if (json) jsonError(msg, EXIT_CODES.CONNECTION);
|
|
31170
|
+
console.error(source_default.red(`\u274C ${msg}`));
|
|
31171
|
+
process.exit(EXIT_CODES.CONNECTION);
|
|
31172
|
+
}
|
|
31173
|
+
});
|
|
30629
31174
|
}
|
|
30630
31175
|
|
|
30631
31176
|
// src/commands/status-pages.ts
|
|
@@ -30811,6 +31356,189 @@ ${source_default.bold(`Upgrading kuma-cli`)} ${source_default.dim(`v${current}`)
|
|
|
30811
31356
|
});
|
|
30812
31357
|
}
|
|
30813
31358
|
|
|
31359
|
+
// src/commands/notifications.ts
|
|
31360
|
+
function notificationsCommand(program3) {
|
|
31361
|
+
const notifications = program3.command("notifications").description("Manage notification channels (Discord, Telegram, webhook, ...)").addHelpText(
|
|
31362
|
+
"after",
|
|
31363
|
+
`
|
|
31364
|
+
${source_default.dim("Subcommands:")}
|
|
31365
|
+
${source_default.cyan("notifications list")} List all notification channels
|
|
31366
|
+
${source_default.cyan("notifications create --type discord ...")} Create a new notification channel
|
|
31367
|
+
${source_default.cyan("notifications delete <id>")} Delete a notification channel
|
|
31368
|
+
|
|
31369
|
+
${source_default.dim("Run")} ${source_default.cyan("kuma notifications <subcommand> --help")} ${source_default.dim("for examples.")}
|
|
31370
|
+
`
|
|
31371
|
+
);
|
|
31372
|
+
notifications.command("list").description("List all configured notification channels with their IDs and types").option("--json", "Output as JSON ({ ok, data })").addHelpText(
|
|
31373
|
+
"after",
|
|
31374
|
+
`
|
|
31375
|
+
${source_default.dim("Examples:")}
|
|
31376
|
+
${source_default.cyan("kuma notifications list")}
|
|
31377
|
+
${source_default.cyan("kuma notifications list --json")}
|
|
31378
|
+
${source_default.cyan("kuma notifications list --json | jq '.data[] | {id, name}'")}
|
|
31379
|
+
`
|
|
31380
|
+
).action(async (opts) => {
|
|
31381
|
+
const config = getConfig();
|
|
31382
|
+
if (!config) requireAuth(opts);
|
|
31383
|
+
const json = isJsonMode(opts);
|
|
31384
|
+
try {
|
|
31385
|
+
const client = await createAuthenticatedClient(config.url, config.token);
|
|
31386
|
+
const list = await client.getNotificationList();
|
|
31387
|
+
client.disconnect();
|
|
31388
|
+
if (json) {
|
|
31389
|
+
const enriched = list.map((n) => {
|
|
31390
|
+
try {
|
|
31391
|
+
const parsed = JSON.parse(n.config);
|
|
31392
|
+
return { ...n, config: parsed };
|
|
31393
|
+
} catch {
|
|
31394
|
+
return n;
|
|
31395
|
+
}
|
|
31396
|
+
});
|
|
31397
|
+
jsonOut(enriched);
|
|
31398
|
+
}
|
|
31399
|
+
if (list.length === 0) {
|
|
31400
|
+
console.log("No notification channels configured.");
|
|
31401
|
+
return;
|
|
31402
|
+
}
|
|
31403
|
+
const table = createTable(["ID", "Name", "Type", "Default", "Active"]);
|
|
31404
|
+
list.forEach((n) => {
|
|
31405
|
+
let type = "\u2014";
|
|
31406
|
+
try {
|
|
31407
|
+
const parsed = JSON.parse(n.config);
|
|
31408
|
+
type = parsed.type ?? "\u2014";
|
|
31409
|
+
} catch {
|
|
31410
|
+
}
|
|
31411
|
+
table.push([
|
|
31412
|
+
String(n.id),
|
|
31413
|
+
n.name,
|
|
31414
|
+
type,
|
|
31415
|
+
n.isDefault ? source_default.green("Yes") : source_default.gray("No"),
|
|
31416
|
+
n.active ? source_default.green("Yes") : source_default.red("No")
|
|
31417
|
+
]);
|
|
31418
|
+
});
|
|
31419
|
+
console.log(table.toString());
|
|
31420
|
+
console.log(`
|
|
31421
|
+
${list.length} notification channel(s)`);
|
|
31422
|
+
} catch (err) {
|
|
31423
|
+
handleError(err, opts);
|
|
31424
|
+
}
|
|
31425
|
+
});
|
|
31426
|
+
notifications.command("create").description("Create a new notification channel").requiredOption("--type <type>", "Notification type: discord, telegram, slack, webhook, ...").requiredOption("--name <name>", "Friendly name for this notification channel").option("--discord-webhook <url>", "Discord webhook URL (required for --type discord)").option("--discord-username <name>", "Discord bot display name (optional)").option("--telegram-token <token>", "Telegram bot token (required for --type telegram)").option("--telegram-chat-id <id>", "Telegram chat ID (required for --type telegram)").option("--slack-webhook <url>", "Slack webhook URL (required for --type slack)").option("--webhook-url <url>", "Webhook URL (required for --type webhook)").option("--webhook-content-type <type>", "Webhook content type (default: application/json)", "application/json").option("--default", "Enable this notification by default on all new monitors").option("--apply-existing", "Apply this notification to all existing monitors immediately").option("--json", "Output as JSON ({ ok, data })").addHelpText(
|
|
31427
|
+
"after",
|
|
31428
|
+
`
|
|
31429
|
+
${source_default.dim("Examples:")}
|
|
31430
|
+
${source_default.cyan('kuma notifications create --type discord --name "Alerts" --discord-webhook https://discord.com/api/webhooks/...')}
|
|
31431
|
+
${source_default.cyan('kuma notifications create --type telegram --name "TG" --telegram-token 123:ABC --telegram-chat-id -100...')}
|
|
31432
|
+
${source_default.cyan('kuma notifications create --type webhook --name "My Hook" --webhook-url https://example.com/hook')}
|
|
31433
|
+
${source_default.cyan('kuma notifications create --type discord --name "Default" --discord-webhook $URL --default --apply-existing')}
|
|
31434
|
+
|
|
31435
|
+
${source_default.dim("Supported types:")}
|
|
31436
|
+
discord, telegram, slack, webhook, gotify, ntfy, pushover, matrix, mattermost, teams ...
|
|
31437
|
+
(full list at https://uptime.kuma.pet/docs)
|
|
31438
|
+
`
|
|
31439
|
+
).action(async (opts) => {
|
|
31440
|
+
const config = getConfig();
|
|
31441
|
+
if (!config) requireAuth(opts);
|
|
31442
|
+
const json = isJsonMode(opts);
|
|
31443
|
+
const payload = {
|
|
31444
|
+
name: opts.name,
|
|
31445
|
+
type: opts.type,
|
|
31446
|
+
isDefault: opts.default ?? false,
|
|
31447
|
+
active: true,
|
|
31448
|
+
applyExisting: opts.applyExisting ?? false
|
|
31449
|
+
};
|
|
31450
|
+
switch (opts.type.toLowerCase()) {
|
|
31451
|
+
case "discord":
|
|
31452
|
+
if (!opts.discordWebhook) {
|
|
31453
|
+
handleError(new Error("--discord-webhook is required for --type discord"), opts);
|
|
31454
|
+
}
|
|
31455
|
+
payload.discordWebhookUrl = opts.discordWebhook;
|
|
31456
|
+
if (opts.discordUsername) payload.discordUsername = opts.discordUsername;
|
|
31457
|
+
break;
|
|
31458
|
+
case "telegram":
|
|
31459
|
+
if (!opts.telegramToken || !opts.telegramChatId) {
|
|
31460
|
+
handleError(new Error("--telegram-token and --telegram-chat-id are required for --type telegram"), opts);
|
|
31461
|
+
}
|
|
31462
|
+
payload.telegramBotToken = opts.telegramToken;
|
|
31463
|
+
payload.telegramChatID = opts.telegramChatId;
|
|
31464
|
+
break;
|
|
31465
|
+
case "slack":
|
|
31466
|
+
if (!opts.slackWebhook) {
|
|
31467
|
+
handleError(new Error("--slack-webhook is required for --type slack"), opts);
|
|
31468
|
+
}
|
|
31469
|
+
payload.slackwebhookURL = opts.slackWebhook;
|
|
31470
|
+
break;
|
|
31471
|
+
case "webhook":
|
|
31472
|
+
if (!opts.webhookUrl) {
|
|
31473
|
+
handleError(new Error("--webhook-url is required for --type webhook"), opts);
|
|
31474
|
+
}
|
|
31475
|
+
payload.webhookURL = opts.webhookUrl;
|
|
31476
|
+
payload.webhookContentType = opts.webhookContentType ?? "application/json";
|
|
31477
|
+
break;
|
|
31478
|
+
default:
|
|
31479
|
+
if (!json) {
|
|
31480
|
+
console.log(source_default.yellow(
|
|
31481
|
+
`\u26A0\uFE0F Type "${opts.type}" may require additional fields not exposed as flags.
|
|
31482
|
+
The notification will be created but may need manual config in the UI.`
|
|
31483
|
+
));
|
|
31484
|
+
}
|
|
31485
|
+
}
|
|
31486
|
+
try {
|
|
31487
|
+
const client = await createAuthenticatedClient(config.url, config.token);
|
|
31488
|
+
const id = await client.addNotification(payload);
|
|
31489
|
+
client.disconnect();
|
|
31490
|
+
if (json) {
|
|
31491
|
+
jsonOut({ id, name: opts.name, type: opts.type });
|
|
31492
|
+
}
|
|
31493
|
+
success(`Notification "${opts.name}" created (ID: ${id})`);
|
|
31494
|
+
} catch (err) {
|
|
31495
|
+
handleError(err, opts);
|
|
31496
|
+
}
|
|
31497
|
+
});
|
|
31498
|
+
notifications.command("delete <id>").description("Permanently delete a notification channel").option("--force", "Skip the confirmation prompt").option("--json", "Output as JSON ({ ok, data })").addHelpText(
|
|
31499
|
+
"after",
|
|
31500
|
+
`
|
|
31501
|
+
${source_default.dim("Examples:")}
|
|
31502
|
+
${source_default.cyan("kuma notifications delete 3")}
|
|
31503
|
+
${source_default.cyan("kuma notifications delete 3 --force")}
|
|
31504
|
+
${source_default.cyan("kuma notifications delete 3 --json")}
|
|
31505
|
+
`
|
|
31506
|
+
).action(async (id, opts) => {
|
|
31507
|
+
const config = getConfig();
|
|
31508
|
+
if (!config) requireAuth(opts);
|
|
31509
|
+
const json = isJsonMode(opts);
|
|
31510
|
+
const notifId = parseInt(id, 10);
|
|
31511
|
+
if (isNaN(notifId)) {
|
|
31512
|
+
handleError(new Error(`Invalid notification ID: ${id}`), opts);
|
|
31513
|
+
}
|
|
31514
|
+
if (!opts.force && !json) {
|
|
31515
|
+
const enquirer3 = await Promise.resolve().then(() => __toESM(require_enquirer()));
|
|
31516
|
+
const { prompt: prompt3 } = enquirer3.default;
|
|
31517
|
+
const { confirm } = await prompt3({
|
|
31518
|
+
type: "confirm",
|
|
31519
|
+
name: "confirm",
|
|
31520
|
+
message: `Delete notification ${id}?`,
|
|
31521
|
+
initial: false
|
|
31522
|
+
});
|
|
31523
|
+
if (!confirm) {
|
|
31524
|
+
console.log("Aborted.");
|
|
31525
|
+
return;
|
|
31526
|
+
}
|
|
31527
|
+
}
|
|
31528
|
+
try {
|
|
31529
|
+
const client = await createAuthenticatedClient(config.url, config.token);
|
|
31530
|
+
await client.deleteNotification(notifId);
|
|
31531
|
+
client.disconnect();
|
|
31532
|
+
if (json) {
|
|
31533
|
+
jsonOut({ id: notifId, deleted: true });
|
|
31534
|
+
}
|
|
31535
|
+
success(`Notification ${id} deleted`);
|
|
31536
|
+
} catch (err) {
|
|
31537
|
+
handleError(err, opts);
|
|
31538
|
+
}
|
|
31539
|
+
});
|
|
31540
|
+
}
|
|
31541
|
+
|
|
30814
31542
|
// src/index.ts
|
|
30815
31543
|
var program2 = new Command();
|
|
30816
31544
|
program2.name("kuma").description("Manage Uptime Kuma monitors, heartbeats, and status pages from your terminal.").version("0.1.0").addHelpText(
|
|
@@ -30826,7 +31554,7 @@ ${source_default.bold("Quick Start:")}
|
|
|
30826
31554
|
${source_default.cyan("kuma login https://kuma.example.com")} Authenticate (saves session)
|
|
30827
31555
|
${source_default.cyan("kuma monitors list")} List all monitors + status
|
|
30828
31556
|
${source_default.cyan('kuma monitors add --name "My API" --type http --url https://api.example.com')}
|
|
30829
|
-
${source_default.cyan("kuma heartbeat 42")}
|
|
31557
|
+
${source_default.cyan("kuma heartbeat view 42")} View recent heartbeats for monitor 42
|
|
30830
31558
|
${source_default.cyan("kuma logout")} Clear saved session
|
|
30831
31559
|
|
|
30832
31560
|
${source_default.bold("JSON / scripting mode:")}
|
|
@@ -30881,6 +31609,7 @@ monitorsCommand(program2);
|
|
|
30881
31609
|
heartbeatCommand(program2);
|
|
30882
31610
|
statusPagesCommand(program2);
|
|
30883
31611
|
upgradeCommand(program2);
|
|
31612
|
+
notificationsCommand(program2);
|
|
30884
31613
|
program2.parse(process.argv);
|
|
30885
31614
|
/*! Bundled license information:
|
|
30886
31615
|
|