@n8n/telemetry 1.4.0 → 1.6.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/build.tsbuildinfo +1 -1
- package/dist/events/instance-ai.d.ts +254 -0
- package/dist/events/instance-ai.js +142 -0
- package/dist/events/instance-ai.js.map +1 -1
- package/dist/events/instance.d.ts +0 -10
- package/dist/events/instance.js +0 -12
- package/dist/events/instance.js.map +1 -1
- package/dist/events/mcp.d.ts +40 -0
- package/dist/events/mcp.js +33 -0
- package/dist/events/mcp.js.map +1 -1
- package/dist/events/workflow-reviews.d.ts +79 -0
- package/dist/events/workflow-reviews.js +71 -0
- package/dist/events/workflow-reviews.js.map +1 -0
- package/dist/events/workflow.d.ts +16 -0
- package/dist/events/workflow.js +25 -0
- package/dist/events/workflow.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/redaction.d.ts +7 -0
- package/dist/redaction.js +59 -0
- package/dist/redaction.js.map +1 -0
- package/dist/telemetry-events.d.ts +387 -10
- package/dist/telemetry-events.js +4 -0
- package/dist/telemetry-events.js.map +1 -1
- package/package.json +7 -6
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const WORKFLOW_REVIEWS_TELEMETRY: {
|
|
3
|
+
readonly USER_REQUESTED_WORKFLOW_REVIEW: {
|
|
4
|
+
readonly name: "User requested workflow review";
|
|
5
|
+
readonly description: "A workflow was submitted for review, opening a review request. Fires once per opened review, not on a later re-pin.";
|
|
6
|
+
readonly properties: z.ZodObject<{
|
|
7
|
+
user_id: z.ZodString;
|
|
8
|
+
workflow_review_request_id: z.ZodString;
|
|
9
|
+
project_id: z.ZodString;
|
|
10
|
+
workflow_id: z.ZodString;
|
|
11
|
+
workflow_version_id: z.ZodString;
|
|
12
|
+
reviewer_count: z.ZodNumber;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
} & import("../define").TelemetryEventInput & {
|
|
15
|
+
readonly getValidationError: (properties: unknown) => string | null;
|
|
16
|
+
};
|
|
17
|
+
readonly USER_UPDATED_WORKFLOW_VERSION_UNDER_REVIEW: {
|
|
18
|
+
readonly name: "User updated workflow version under review";
|
|
19
|
+
readonly description: "An open review was re-pinned to another version of the workflow it covers. Fires only on a real re-pin, not on a rename or a description edit.";
|
|
20
|
+
readonly properties: z.ZodObject<{
|
|
21
|
+
user_id: z.ZodString;
|
|
22
|
+
workflow_review_request_id: z.ZodString;
|
|
23
|
+
workflow_id: z.ZodString;
|
|
24
|
+
workflow_version_id: z.ZodString;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
} & import("../define").TelemetryEventInput & {
|
|
27
|
+
readonly getValidationError: (properties: unknown) => string | null;
|
|
28
|
+
};
|
|
29
|
+
readonly USER_DECIDED_WORKFLOW_REVIEW: {
|
|
30
|
+
readonly name: "User decided workflow review";
|
|
31
|
+
readonly description: "A user approved a review or requested changes on it. Fires once per decision, so a review can appear several times.";
|
|
32
|
+
readonly properties: z.ZodObject<{
|
|
33
|
+
user_id: z.ZodString;
|
|
34
|
+
workflow_review_request_id: z.ZodString;
|
|
35
|
+
workflow_id: z.ZodString;
|
|
36
|
+
workflow_version_id: z.ZodNullable<z.ZodString>;
|
|
37
|
+
decision: z.ZodEnum<{
|
|
38
|
+
approved: "approved";
|
|
39
|
+
changes_requested: "changes_requested";
|
|
40
|
+
}>;
|
|
41
|
+
decided_via: z.ZodEnum<{
|
|
42
|
+
"admin-override": "admin-override";
|
|
43
|
+
"assigned-reviewer": "assigned-reviewer";
|
|
44
|
+
}>;
|
|
45
|
+
review_created_at: z.ZodString;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
} & import("../define").TelemetryEventInput & {
|
|
48
|
+
readonly getValidationError: (properties: unknown) => string | null;
|
|
49
|
+
};
|
|
50
|
+
readonly WORKFLOW_REVIEW_CLOSED: {
|
|
51
|
+
readonly name: "Workflow review closed";
|
|
52
|
+
readonly description: "An open review was closed without a decision because no reviewable workflow was left on it. No user performs it.";
|
|
53
|
+
readonly properties: z.ZodObject<{
|
|
54
|
+
workflow_review_request_id: z.ZodString;
|
|
55
|
+
cause_trigger: z.ZodEnum<{
|
|
56
|
+
unknown: "unknown";
|
|
57
|
+
"workflow-archived": "workflow-archived";
|
|
58
|
+
"workflow-deleted": "workflow-deleted";
|
|
59
|
+
"workflow-moved": "workflow-moved";
|
|
60
|
+
}>;
|
|
61
|
+
cause_actor_kind: z.ZodEnum<{
|
|
62
|
+
system: "system";
|
|
63
|
+
user: "user";
|
|
64
|
+
}>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
} & import("../define").TelemetryEventInput & {
|
|
67
|
+
readonly getValidationError: (properties: unknown) => string | null;
|
|
68
|
+
};
|
|
69
|
+
readonly USER_COMMENTED_ON_WORKFLOW_REVIEW: {
|
|
70
|
+
readonly name: "User commented on workflow review";
|
|
71
|
+
readonly description: "A comment was posted on an open review.";
|
|
72
|
+
readonly properties: z.ZodObject<{
|
|
73
|
+
user_id: z.ZodString;
|
|
74
|
+
workflow_review_request_id: z.ZodString;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
} & import("../define").TelemetryEventInput & {
|
|
77
|
+
readonly getValidationError: (properties: unknown) => string | null;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WORKFLOW_REVIEWS_TELEMETRY = void 0;
|
|
4
|
+
const v4_1 = require("zod/v4");
|
|
5
|
+
const define_1 = require("../define");
|
|
6
|
+
exports.WORKFLOW_REVIEWS_TELEMETRY = (0, define_1.defineTelemetryEvents)({
|
|
7
|
+
USER_REQUESTED_WORKFLOW_REVIEW: {
|
|
8
|
+
name: 'User requested workflow review',
|
|
9
|
+
description: 'A workflow was submitted for review, opening a review request. Fires once per opened review, not on a later re-pin.',
|
|
10
|
+
properties: v4_1.z.object({
|
|
11
|
+
user_id: v4_1.z.string(),
|
|
12
|
+
workflow_review_request_id: v4_1.z.string(),
|
|
13
|
+
project_id: v4_1.z.string().describe('Owning project when the review opened'),
|
|
14
|
+
workflow_id: v4_1.z.string(),
|
|
15
|
+
workflow_version_id: v4_1.z.string(),
|
|
16
|
+
reviewer_count: v4_1.z
|
|
17
|
+
.number()
|
|
18
|
+
.describe('Reviewers assigned when the review opened, not everyone eligible to review'),
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
USER_UPDATED_WORKFLOW_VERSION_UNDER_REVIEW: {
|
|
22
|
+
name: 'User updated workflow version under review',
|
|
23
|
+
description: 'An open review was re-pinned to another version of the workflow it covers. Fires only on a real re-pin, not on a rename or a description edit.',
|
|
24
|
+
properties: v4_1.z.object({
|
|
25
|
+
user_id: v4_1.z.string(),
|
|
26
|
+
workflow_review_request_id: v4_1.z.string(),
|
|
27
|
+
workflow_id: v4_1.z.string(),
|
|
28
|
+
workflow_version_id: v4_1.z.string().describe('The newly pinned version, not the previous one'),
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
USER_DECIDED_WORKFLOW_REVIEW: {
|
|
32
|
+
name: 'User decided workflow review',
|
|
33
|
+
description: 'A user approved a review or requested changes on it. Fires once per decision, so a review can appear several times.',
|
|
34
|
+
properties: v4_1.z.object({
|
|
35
|
+
user_id: v4_1.z.string(),
|
|
36
|
+
workflow_review_request_id: v4_1.z.string(),
|
|
37
|
+
workflow_id: v4_1.z.string(),
|
|
38
|
+
workflow_version_id: v4_1.z
|
|
39
|
+
.string()
|
|
40
|
+
.nullable()
|
|
41
|
+
.describe('Null when the pinned version was pruned before the decision'),
|
|
42
|
+
decision: v4_1.z.enum(['approved', 'changes_requested']),
|
|
43
|
+
decided_via: v4_1.z
|
|
44
|
+
.enum(['assigned-reviewer', 'admin-override'])
|
|
45
|
+
.describe("'assigned-reviewer' = the decider was assigned to this review; 'admin-override' = they decided through an instance or project admin role. Assignment wins when both apply"),
|
|
46
|
+
review_created_at: v4_1.z.string().describe('When the review was opened, ISO 8601'),
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
WORKFLOW_REVIEW_CLOSED: {
|
|
50
|
+
name: 'Workflow review closed',
|
|
51
|
+
description: 'An open review was closed without a decision because no reviewable workflow was left on it. No user performs it.',
|
|
52
|
+
properties: v4_1.z.object({
|
|
53
|
+
workflow_review_request_id: v4_1.z.string(),
|
|
54
|
+
cause_trigger: v4_1.z
|
|
55
|
+
.enum(['workflow-archived', 'workflow-moved', 'workflow-deleted', 'unknown'])
|
|
56
|
+
.describe('What left the review without a reviewable workflow. "unknown" means the trigger went unrecorded and the review was swept up later, not that nothing triggered it'),
|
|
57
|
+
cause_actor_kind: v4_1.z
|
|
58
|
+
.enum(['user', 'system'])
|
|
59
|
+
.describe('Who caused the trigger, not who closed the review. "system" means no actor was recorded, not that automation acted'),
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
USER_COMMENTED_ON_WORKFLOW_REVIEW: {
|
|
63
|
+
name: 'User commented on workflow review',
|
|
64
|
+
description: 'A comment was posted on an open review.',
|
|
65
|
+
properties: v4_1.z.object({
|
|
66
|
+
user_id: v4_1.z.string(),
|
|
67
|
+
workflow_review_request_id: v4_1.z.string(),
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=workflow-reviews.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-reviews.js","sourceRoot":"","sources":["../../src/events/workflow-reviews.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAE3B,sCAAkD;AAErC,QAAA,0BAA0B,GAAG,IAAA,8BAAqB,EAAC;IAC/D,8BAA8B,EAAE;QAC/B,IAAI,EAAE,gCAAgC;QACtC,WAAW,EACV,qHAAqH;QACtH,UAAU,EAAE,MAAC,CAAC,MAAM,CAAC;YACpB,OAAO,EAA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MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;SAC9E,CAAC;KACF;IACD,sBAAsB,EAAE;QACvB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACV,kHAAkH;QACnH,UAAU,EAAE,MAAC,CAAC,MAAM,CAAC;YACpB,0BAA0B,EAAE,MAAC,CAAC,MAAM,EAAE;YACtC,aAAa,EAAE,MAAC;iBACd,IAAI,CAAC,CAAC,mBAAmB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,SAAS,CAAC,CAAC;iBAC5E,QAAQ,CACR,kKAAkK,CAClK;YACF,gBAAgB,EAAE,MAAC;iBACjB,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;iBACxB,QAAQ,CACR,oHAAoH,CACpH;SACF,CAAC;KACF;IACD,iCAAiC,EAAE;QAClC,IAAI,EAAE,mCAAmC;QACzC,WAAW,EAAE,yCAAyC;QACtD,UAAU,EAAE,MAAC,CAAC,MAAM,CAAC;YACpB,OAAO,EAAE,MAAC,CAAC,MAAM,EAAE;YACnB,0BAA0B,EAAE,MAAC,CAAC,MAAM,EAAE;SACtC,CAAC;KACF;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const WORKFLOW_TELEMETRY: {
|
|
3
|
+
readonly NODE_IDS_HEALED: {
|
|
4
|
+
readonly name: "Workflow node ids healed";
|
|
5
|
+
readonly description: "A published version about to be activated carried duplicate or missing node ids, so a corrected system-authored version was published in its place. `superseded` means the corrected version lost against a concurrent publish or unpublish and was discarded.";
|
|
6
|
+
readonly properties: z.ZodObject<{
|
|
7
|
+
workflow_id: z.ZodString;
|
|
8
|
+
filled_count: z.ZodNumber;
|
|
9
|
+
reassigned_count: z.ZodNumber;
|
|
10
|
+
dropped_count: z.ZodNumber;
|
|
11
|
+
superseded: z.ZodBoolean;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
} & import("../define").TelemetryEventInput & {
|
|
14
|
+
readonly getValidationError: (properties: unknown) => string | null;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WORKFLOW_TELEMETRY = void 0;
|
|
4
|
+
const v4_1 = require("zod/v4");
|
|
5
|
+
const define_1 = require("../define");
|
|
6
|
+
exports.WORKFLOW_TELEMETRY = (0, define_1.defineTelemetryEvents)({
|
|
7
|
+
NODE_IDS_HEALED: {
|
|
8
|
+
name: 'Workflow node ids healed',
|
|
9
|
+
description: 'A published version about to be activated carried duplicate or missing node ids, so a corrected system-authored version was published in its place. `superseded` means the corrected version lost against a concurrent publish or unpublish and was discarded.',
|
|
10
|
+
properties: v4_1.z.object({
|
|
11
|
+
workflow_id: v4_1.z.string(),
|
|
12
|
+
filled_count: v4_1.z.number().describe('Nodes that had no id and received a fresh one'),
|
|
13
|
+
reassigned_count: v4_1.z
|
|
14
|
+
.number()
|
|
15
|
+
.describe('Nodes that shared their id with another node and received a fresh one'),
|
|
16
|
+
dropped_count: v4_1.z
|
|
17
|
+
.number()
|
|
18
|
+
.describe('Exact same-name duplicates removed in favor of their last occurrence'),
|
|
19
|
+
superseded: v4_1.z
|
|
20
|
+
.boolean()
|
|
21
|
+
.describe('Whether the corrected version lost the publish race and was discarded'),
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../src/events/workflow.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAE3B,sCAAkD;AAErC,QAAA,kBAAkB,GAAG,IAAA,8BAAqB,EAAC;IACvD,eAAe,EAAE;QAChB,IAAI,EAAE,0BAA0B;QAChC,WAAW,EACV,gQAAgQ;QACjQ,UAAU,EAAE,MAAC,CAAC,MAAM,CAAC;YACpB,WAAW,EAAE,MAAC,CAAC,MAAM,EAAE;YACvB,YAAY,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;YAClF,gBAAgB,EAAE,MAAC;iBACjB,MAAM,EAAE;iBACR,QAAQ,CAAC,uEAAuE,CAAC;YACnF,aAAa,EAAE,MAAC;iBACd,MAAM,EAAE;iBACR,QAAQ,CAAC,sEAAsE,CAAC;YAClF,UAAU,EAAE,MAAC;iBACX,OAAO,EAAE;iBACT,QAAQ,CAAC,uEAAuE,CAAC;SACnF,CAAC;KACF;CACD,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ export type { TelemetryCatalogEntry, TelemetryCatalogProperty } from './catalog'
|
|
|
3
3
|
export { POSTHOG_EVENTS_BLACKLIST } from './constants';
|
|
4
4
|
export { defineTelemetryEvents } from './define';
|
|
5
5
|
export type { InferTelemetryProps, TelemetryEventDef, TelemetryEventInput, TelemetryEventRegistry, } from './define';
|
|
6
|
+
export { redactTelemetryProperties, redactTelemetryText } from './redaction';
|
|
7
|
+
export type { TelemetryTextOptions } from './redaction';
|
|
6
8
|
export { collectDuplicateNames, validateEntrySchemas } from './registry-checks';
|
|
7
9
|
export { TELEMETRY_EVENT } from './telemetry-events';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TELEMETRY_EVENT = exports.validateEntrySchemas = exports.collectDuplicateNames = exports.defineTelemetryEvents = exports.POSTHOG_EVENTS_BLACKLIST = exports.formatCatalog = exports.buildCatalog = void 0;
|
|
3
|
+
exports.TELEMETRY_EVENT = exports.validateEntrySchemas = exports.collectDuplicateNames = exports.redactTelemetryText = exports.redactTelemetryProperties = exports.defineTelemetryEvents = exports.POSTHOG_EVENTS_BLACKLIST = exports.formatCatalog = exports.buildCatalog = void 0;
|
|
4
4
|
var catalog_1 = require("./catalog");
|
|
5
5
|
Object.defineProperty(exports, "buildCatalog", { enumerable: true, get: function () { return catalog_1.buildCatalog; } });
|
|
6
6
|
Object.defineProperty(exports, "formatCatalog", { enumerable: true, get: function () { return catalog_1.formatCatalog; } });
|
|
@@ -8,6 +8,9 @@ var constants_1 = require("./constants");
|
|
|
8
8
|
Object.defineProperty(exports, "POSTHOG_EVENTS_BLACKLIST", { enumerable: true, get: function () { return constants_1.POSTHOG_EVENTS_BLACKLIST; } });
|
|
9
9
|
var define_1 = require("./define");
|
|
10
10
|
Object.defineProperty(exports, "defineTelemetryEvents", { enumerable: true, get: function () { return define_1.defineTelemetryEvents; } });
|
|
11
|
+
var redaction_1 = require("./redaction");
|
|
12
|
+
Object.defineProperty(exports, "redactTelemetryProperties", { enumerable: true, get: function () { return redaction_1.redactTelemetryProperties; } });
|
|
13
|
+
Object.defineProperty(exports, "redactTelemetryText", { enumerable: true, get: function () { return redaction_1.redactTelemetryText; } });
|
|
11
14
|
var registry_checks_1 = require("./registry-checks");
|
|
12
15
|
Object.defineProperty(exports, "collectDuplicateNames", { enumerable: true, get: function () { return registry_checks_1.collectDuplicateNames; } });
|
|
13
16
|
Object.defineProperty(exports, "validateEntrySchemas", { enumerable: true, get: function () { return registry_checks_1.validateEntrySchemas; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAwD;AAA/C,uGAAA,YAAY,OAAA;AAAE,wGAAA,aAAa,OAAA;AAEpC,yCAAuD;AAA9C,qHAAA,wBAAwB,OAAA;AACjC,mCAAiD;AAAxC,+GAAA,qBAAqB,OAAA;AAO9B,qDAAgF;AAAvE,wHAAA,qBAAqB,OAAA;AAAE,uHAAA,oBAAoB,OAAA;AACpD,uDAAqD;AAA5C,mHAAA,eAAe,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAwD;AAA/C,uGAAA,YAAY,OAAA;AAAE,wGAAA,aAAa,OAAA;AAEpC,yCAAuD;AAA9C,qHAAA,wBAAwB,OAAA;AACjC,mCAAiD;AAAxC,+GAAA,qBAAqB,OAAA;AAO9B,yCAA6E;AAApE,sHAAA,yBAAyB,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAEvD,qDAAgF;AAAvE,wHAAA,qBAAqB,OAAA;AAAE,uHAAA,oBAAoB,OAAA;AACpD,uDAAqD;AAA5C,mHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type TelemetryValue = string | number | boolean | object | null | undefined;
|
|
2
|
+
export interface TelemetryTextOptions {
|
|
3
|
+
maxLength?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function redactTelemetryText(value: string, opts?: TelemetryTextOptions): string;
|
|
6
|
+
export declare function redactTelemetryProperties<T extends Record<string, TelemetryValue>>(properties: T): Record<string, TelemetryValue>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.redactTelemetryText = redactTelemetryText;
|
|
4
|
+
exports.redactTelemetryProperties = redactTelemetryProperties;
|
|
5
|
+
const pii_patterns_1 = require("@n8n/utils/redaction/pii-patterns");
|
|
6
|
+
const redact_text_1 = require("@n8n/utils/redaction/redact-text");
|
|
7
|
+
const TELEMETRY_REDACTION_OPTIONS = {
|
|
8
|
+
secrets: true,
|
|
9
|
+
detect: pii_patterns_1.SUPPORTED_PII_CATEGORIES,
|
|
10
|
+
preserveUrlStructure: true,
|
|
11
|
+
};
|
|
12
|
+
const MAX_TELEMETRY_TEXT_LENGTH = 8_000;
|
|
13
|
+
const IDENTIFIER_KEY_PATTERN = /(?:^|_)(?:id|ids|hash)$/;
|
|
14
|
+
const SECRET_KEY_PATTERN = /(?:^|_)(?:password|passwd|pwd|secret|token|api_?key|apikey|access_?token|refresh_?token|id_?token|session_?token|auth_?token|authorization|cookie|private_?key)$/i;
|
|
15
|
+
function toSnakeCase(key) {
|
|
16
|
+
return key.replace(/([a-z0-9])([A-Z])/g, '$1_$2').replace(/-/g, '_');
|
|
17
|
+
}
|
|
18
|
+
const MAX_PROPERTY_DEPTH = 5;
|
|
19
|
+
const OVER_DEPTH_MARKER = '[REDACTED_DEPTH]';
|
|
20
|
+
function redactTelemetryText(value, opts = {}) {
|
|
21
|
+
const maxLength = opts.maxLength ?? MAX_TELEMETRY_TEXT_LENGTH;
|
|
22
|
+
const redacted = (0, redact_text_1.redactText)(value, TELEMETRY_REDACTION_OPTIONS).text;
|
|
23
|
+
return redacted.length > maxLength ? `${redacted.slice(0, maxLength)}...` : redacted;
|
|
24
|
+
}
|
|
25
|
+
function isNonNullObject(value) {
|
|
26
|
+
return value !== null && typeof value === 'object';
|
|
27
|
+
}
|
|
28
|
+
function redactPropertyValue(key, value, depth) {
|
|
29
|
+
if (SECRET_KEY_PATTERN.test(toSnakeCase(key)) &&
|
|
30
|
+
(typeof value === 'string' || isNonNullObject(value))) {
|
|
31
|
+
return redact_text_1.DEFAULT_PLACEHOLDER;
|
|
32
|
+
}
|
|
33
|
+
if (typeof value === 'string') {
|
|
34
|
+
return IDENTIFIER_KEY_PATTERN.test(key) ? value : redactTelemetryText(value);
|
|
35
|
+
}
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
if (depth >= MAX_PROPERTY_DEPTH)
|
|
38
|
+
return OVER_DEPTH_MARKER;
|
|
39
|
+
return value.map((entry) => redactPropertyValue(key, entry, depth + 1));
|
|
40
|
+
}
|
|
41
|
+
if (isNonNullObject(value)) {
|
|
42
|
+
if (depth >= MAX_PROPERTY_DEPTH)
|
|
43
|
+
return OVER_DEPTH_MARKER;
|
|
44
|
+
const redacted = {};
|
|
45
|
+
for (const [nestedKey, nestedValue] of Object.entries(value)) {
|
|
46
|
+
redacted[nestedKey] = redactPropertyValue(nestedKey, nestedValue, depth + 1);
|
|
47
|
+
}
|
|
48
|
+
return redacted;
|
|
49
|
+
}
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
function redactTelemetryProperties(properties) {
|
|
53
|
+
const redacted = {};
|
|
54
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
55
|
+
redacted[key] = redactPropertyValue(key, value, 0);
|
|
56
|
+
}
|
|
57
|
+
return redacted;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=redaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redaction.js","sourceRoot":"","sources":["../src/redaction.ts"],"names":[],"mappings":";;;;AAAA,oEAA6E;AAC7E,kEAAmF;AAenF,MAAM,2BAA2B,GAAqB;IACrD,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,uCAAwB;IAChC,oBAAoB,EAAE,IAAI;CAC1B,CAAC;AAQF,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAOxC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AAczD,MAAM,kBAAkB,GACvB,mKAAmK,CAAC;AAMrK,SAAS,WAAW,CAAC,GAAW;IAC/B,OAAO,GAAG,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACtE,CAAC;AAMD,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAe7C,6BAAoC,KAAa,EAAE,IAAI,GAAyB,EAAE;IACjF,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,yBAAyB,CAAC;IAC9D,MAAM,QAAQ,GAAG,IAAA,wBAAU,EAAC,KAAK,EAAE,2BAA2B,CAAC,CAAC,IAAI,CAAC;IAErE,OAAO,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,QAA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