@jonit-dev/night-watch-cli 1.8.16 → 1.8.17
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/cli.js +137 -4
- package/dist/web/assets/index-C4M4_2S3.js +447 -0
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9132,7 +9132,11 @@ var init_schema = __esm({
|
|
|
9132
9132
|
"auto_merge_completed",
|
|
9133
9133
|
"doctor_failed",
|
|
9134
9134
|
"telemetry_enabled",
|
|
9135
|
-
"telemetry_disabled"
|
|
9135
|
+
"telemetry_disabled",
|
|
9136
|
+
"web_app_opened",
|
|
9137
|
+
"web_route_viewed",
|
|
9138
|
+
"web_ui_action",
|
|
9139
|
+
"web_api_action"
|
|
9136
9140
|
];
|
|
9137
9141
|
TELEMETRY_ERROR_CATEGORIES = [
|
|
9138
9142
|
"config",
|
|
@@ -9167,6 +9171,13 @@ function sanitizeString(value) {
|
|
|
9167
9171
|
}
|
|
9168
9172
|
return trimmed;
|
|
9169
9173
|
}
|
|
9174
|
+
function sanitizeAllowedWebString(key, value) {
|
|
9175
|
+
const sanitized = sanitizeString(value);
|
|
9176
|
+
if (!sanitized) {
|
|
9177
|
+
return void 0;
|
|
9178
|
+
}
|
|
9179
|
+
return WEB_ALLOWED_VALUES[key].includes(sanitized) ? sanitized : void 0;
|
|
9180
|
+
}
|
|
9170
9181
|
function sanitizeBoolean(value) {
|
|
9171
9182
|
return typeof value === "boolean" ? value : void 0;
|
|
9172
9183
|
}
|
|
@@ -9211,6 +9222,12 @@ function sanitizeTelemetryEvent(eventName, properties = {}) {
|
|
|
9211
9222
|
sanitized[key] = value;
|
|
9212
9223
|
}
|
|
9213
9224
|
}
|
|
9225
|
+
for (const key of WEB_STRING_PROPERTIES) {
|
|
9226
|
+
const value = sanitizeAllowedWebString(key, properties[key]);
|
|
9227
|
+
if (value !== void 0) {
|
|
9228
|
+
sanitized[key] = value;
|
|
9229
|
+
}
|
|
9230
|
+
}
|
|
9214
9231
|
for (const key of BOOLEAN_PROPERTIES) {
|
|
9215
9232
|
const value = sanitizeBoolean(properties[key]);
|
|
9216
9233
|
if (value !== void 0) {
|
|
@@ -9228,20 +9245,112 @@ function sanitizeTelemetryEvent(eventName, properties = {}) {
|
|
|
9228
9245
|
}
|
|
9229
9246
|
return { eventName, properties: sanitized };
|
|
9230
9247
|
}
|
|
9231
|
-
var STRING_PROPERTIES, BOOLEAN_PROPERTIES, INTEGER_PROPERTIES, SAFE_STRING_PATTERN;
|
|
9248
|
+
var STRING_PROPERTIES, WEB_STRING_PROPERTIES, BOOLEAN_PROPERTIES, INTEGER_PROPERTIES, SAFE_STRING_PATTERN, WEB_ALLOWED_VALUES;
|
|
9232
9249
|
var init_sanitizer = __esm({
|
|
9233
9250
|
"../core/dist/telemetry/sanitizer.js"() {
|
|
9234
9251
|
"use strict";
|
|
9235
9252
|
init_schema();
|
|
9236
9253
|
STRING_PROPERTIES = ["cliVersion", "command", "jobType", "provider", "platform"];
|
|
9237
|
-
|
|
9254
|
+
WEB_STRING_PROPERTIES = [
|
|
9255
|
+
"routeName",
|
|
9256
|
+
"uiArea",
|
|
9257
|
+
"action",
|
|
9258
|
+
"resource",
|
|
9259
|
+
"result",
|
|
9260
|
+
"statusCategory"
|
|
9261
|
+
];
|
|
9262
|
+
BOOLEAN_PROPERTIES = ["success", "failure", "boardMode", "enabled", "globalMode"];
|
|
9238
9263
|
INTEGER_PROPERTIES = [
|
|
9239
9264
|
"durationMs",
|
|
9240
9265
|
"exitCode",
|
|
9241
9266
|
"nodeMajorVersion",
|
|
9242
|
-
"registeredProjectCount"
|
|
9267
|
+
"registeredProjectCount",
|
|
9268
|
+
"projectCount",
|
|
9269
|
+
"selectedProjectIndex",
|
|
9270
|
+
"itemCount",
|
|
9271
|
+
"columnCount",
|
|
9272
|
+
"pendingCount",
|
|
9273
|
+
"runningCount"
|
|
9243
9274
|
];
|
|
9244
9275
|
SAFE_STRING_PATTERN = /^[a-zA-Z0-9_.:-]{1,80}$/;
|
|
9276
|
+
WEB_ALLOWED_VALUES = {
|
|
9277
|
+
routeName: [
|
|
9278
|
+
"dashboard",
|
|
9279
|
+
"analytics",
|
|
9280
|
+
"prs",
|
|
9281
|
+
"board",
|
|
9282
|
+
"scheduling",
|
|
9283
|
+
"logs",
|
|
9284
|
+
"roadmap",
|
|
9285
|
+
"settings",
|
|
9286
|
+
"unknown"
|
|
9287
|
+
],
|
|
9288
|
+
uiArea: [
|
|
9289
|
+
"app",
|
|
9290
|
+
"navigation",
|
|
9291
|
+
"dashboard",
|
|
9292
|
+
"project_selector",
|
|
9293
|
+
"jobs",
|
|
9294
|
+
"schedules",
|
|
9295
|
+
"settings",
|
|
9296
|
+
"feedback",
|
|
9297
|
+
"logs",
|
|
9298
|
+
"queue",
|
|
9299
|
+
"board",
|
|
9300
|
+
"roadmap",
|
|
9301
|
+
"prs"
|
|
9302
|
+
],
|
|
9303
|
+
action: [
|
|
9304
|
+
"open",
|
|
9305
|
+
"view",
|
|
9306
|
+
"refresh",
|
|
9307
|
+
"select",
|
|
9308
|
+
"trigger",
|
|
9309
|
+
"pause",
|
|
9310
|
+
"resume",
|
|
9311
|
+
"cancel",
|
|
9312
|
+
"clear",
|
|
9313
|
+
"save",
|
|
9314
|
+
"toggle",
|
|
9315
|
+
"create",
|
|
9316
|
+
"move",
|
|
9317
|
+
"close",
|
|
9318
|
+
"filter",
|
|
9319
|
+
"follow",
|
|
9320
|
+
"unfollow",
|
|
9321
|
+
"retry",
|
|
9322
|
+
"remove"
|
|
9323
|
+
],
|
|
9324
|
+
resource: [
|
|
9325
|
+
"app",
|
|
9326
|
+
"route",
|
|
9327
|
+
"project",
|
|
9328
|
+
"dashboard",
|
|
9329
|
+
"job",
|
|
9330
|
+
"schedule",
|
|
9331
|
+
"settings",
|
|
9332
|
+
"feedback",
|
|
9333
|
+
"augmentation",
|
|
9334
|
+
"logs",
|
|
9335
|
+
"queue",
|
|
9336
|
+
"board_issue",
|
|
9337
|
+
"roadmap",
|
|
9338
|
+
"prs",
|
|
9339
|
+
"config",
|
|
9340
|
+
"cron",
|
|
9341
|
+
"lock"
|
|
9342
|
+
],
|
|
9343
|
+
result: ["success", "failure", "accepted", "rejected", "partial", "unknown"],
|
|
9344
|
+
statusCategory: [
|
|
9345
|
+
"success",
|
|
9346
|
+
"failure",
|
|
9347
|
+
"warning",
|
|
9348
|
+
"empty",
|
|
9349
|
+
"disabled",
|
|
9350
|
+
"not_configured",
|
|
9351
|
+
"unknown"
|
|
9352
|
+
]
|
|
9353
|
+
};
|
|
9245
9354
|
}
|
|
9246
9355
|
});
|
|
9247
9356
|
|
|
@@ -20067,6 +20176,28 @@ function createQueueRoutes(deps) {
|
|
|
20067
20176
|
return router;
|
|
20068
20177
|
}
|
|
20069
20178
|
|
|
20179
|
+
// ../server/dist/routes/telemetry.routes.js
|
|
20180
|
+
init_dist();
|
|
20181
|
+
import { Router as Router12 } from "express";
|
|
20182
|
+
function readProperties(value) {
|
|
20183
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
20184
|
+
return {};
|
|
20185
|
+
}
|
|
20186
|
+
return value;
|
|
20187
|
+
}
|
|
20188
|
+
function createTelemetryRoutes() {
|
|
20189
|
+
const router = Router12();
|
|
20190
|
+
router.post("/web", (req, res) => {
|
|
20191
|
+
const body = req.body;
|
|
20192
|
+
const eventName = typeof body?.eventName === "string" ? body.eventName : "";
|
|
20193
|
+
const properties = readProperties(body?.properties);
|
|
20194
|
+
void trackTelemetryEvent(eventName, properties).catch(() => {
|
|
20195
|
+
});
|
|
20196
|
+
res.status(202).json({ accepted: true });
|
|
20197
|
+
});
|
|
20198
|
+
return router;
|
|
20199
|
+
}
|
|
20200
|
+
|
|
20070
20201
|
// ../server/dist/index.js
|
|
20071
20202
|
var __filename4 = fileURLToPath5(import.meta.url);
|
|
20072
20203
|
var __dirname4 = dirname13(__filename4);
|
|
@@ -20144,6 +20275,7 @@ function createApp(projectDir) {
|
|
|
20144
20275
|
app.use("/api/queue", createQueueRoutes({ getConfig: () => config }));
|
|
20145
20276
|
app.use("/api/feedback", createFeedbackRoutes({ projectDir }));
|
|
20146
20277
|
app.use("/api/global-notifications", createGlobalNotificationsRoutes());
|
|
20278
|
+
app.use("/api/telemetry", createTelemetryRoutes());
|
|
20147
20279
|
app.get("/api/prs", async (_req, res) => {
|
|
20148
20280
|
try {
|
|
20149
20281
|
res.json(await collectPrInfo(projectDir, config.branchPatterns));
|
|
@@ -20235,6 +20367,7 @@ function createGlobalApp() {
|
|
|
20235
20367
|
});
|
|
20236
20368
|
app.use("/api/queue", createGlobalQueueRoutes());
|
|
20237
20369
|
app.use("/api/global-notifications", createGlobalNotificationsRoutes());
|
|
20370
|
+
app.use("/api/telemetry", createTelemetryRoutes());
|
|
20238
20371
|
app.use("/api/projects/:projectId", resolveProject, createProjectRouter());
|
|
20239
20372
|
setupStaticFiles(app);
|
|
20240
20373
|
app.use(errorHandler);
|