@vscode/telemetry-extractor 1.9.5

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.
Files changed (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +29 -0
  3. package/SECURITY.md +41 -0
  4. package/documentation/comment-code-annotations.md +197 -0
  5. package/documentation/typescript-code-annotations.md +187 -0
  6. package/documentation/using-the-tool.md +106 -0
  7. package/out/cli-help.js +30 -0
  8. package/out/cli-help.js.map +1 -0
  9. package/out/cli-options.js +52 -0
  10. package/out/cli-options.js.map +1 -0
  11. package/out/extractor.js +83 -0
  12. package/out/extractor.js.map +1 -0
  13. package/out/index.js +10 -0
  14. package/out/index.js.map +1 -0
  15. package/out/lib/common-properties.js +32 -0
  16. package/out/lib/common-properties.js.map +1 -0
  17. package/out/lib/debug-patch.js +17 -0
  18. package/out/lib/debug-patch.js.map +1 -0
  19. package/out/lib/declarations.js +121 -0
  20. package/out/lib/declarations.js.map +1 -0
  21. package/out/lib/events.js +55 -0
  22. package/out/lib/events.js.map +1 -0
  23. package/out/lib/file-writer.js +77 -0
  24. package/out/lib/file-writer.js.map +1 -0
  25. package/out/lib/fragments.js +21 -0
  26. package/out/lib/fragments.js.map +1 -0
  27. package/out/lib/keywords.js +11 -0
  28. package/out/lib/keywords.js.map +1 -0
  29. package/out/lib/logger.js +10 -0
  30. package/out/lib/logger.js.map +1 -0
  31. package/out/lib/object-converter.js +107 -0
  32. package/out/lib/object-converter.js.map +1 -0
  33. package/out/lib/operations.js +118 -0
  34. package/out/lib/operations.js.map +1 -0
  35. package/out/lib/parser.js +191 -0
  36. package/out/lib/parser.js.map +1 -0
  37. package/out/lib/save-declarations.js +94 -0
  38. package/out/lib/save-declarations.js.map +1 -0
  39. package/out/lib/source-spec.js +77 -0
  40. package/out/lib/source-spec.js.map +1 -0
  41. package/out/lib/telemetry-interfaces.js +3 -0
  42. package/out/lib/telemetry-interfaces.js.map +1 -0
  43. package/out/lib/ts-parser.js +219 -0
  44. package/out/lib/ts-parser.js.map +1 -0
  45. package/package.json +39 -0
  46. package/src/cli-help.ts +29 -0
  47. package/src/cli-options.ts +31 -0
  48. package/src/extractor.ts +57 -0
  49. package/src/index.ts +4 -0
  50. package/src/lib/common-properties.ts +41 -0
  51. package/src/lib/debug-patch.ts +13 -0
  52. package/src/lib/declarations.ts +131 -0
  53. package/src/lib/events.ts +56 -0
  54. package/src/lib/file-writer.ts +54 -0
  55. package/src/lib/fragments.ts +24 -0
  56. package/src/lib/keywords.ts +7 -0
  57. package/src/lib/logger.ts +5 -0
  58. package/src/lib/object-converter.ts +85 -0
  59. package/src/lib/operations.ts +89 -0
  60. package/src/lib/parser.ts +184 -0
  61. package/src/lib/save-declarations.ts +71 -0
  62. package/src/lib/source-spec.ts +67 -0
  63. package/src/lib/telemetry-interfaces.ts +40 -0
  64. package/src/lib/ts-parser.ts +206 -0
  65. package/tsconfig.json +67 -0
  66. package/vscode-telemetry-extractor.d.ts +72 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-options.js","sourceRoot":"","sources":["../src/cli-options.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuC;AACvC,kCAAkC;AAClC,0EAAgD;AAChD,2CAA6B;AAE7B,SAAS,kBAAkB,CAAC,OAA2C;IACnE,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1B,IAAI,OAAO,CAAC,SAAS,EAAE;QACnB,OAAO,CAAC,SAAS,GAAI,OAAO,CAAC,SAAsB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;KACtF;IACD,IAAI,OAAO,CAAC,SAAS,EAAE;QACnB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;KAC5D;IAED,OAAO,OAAO,CAAC;AAC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yBAAiB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
6
+ }) : (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ o[k2] = m[k];
9
+ }));
10
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
11
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
12
+ }) : function(o, v) {
13
+ o["default"] = v;
14
+ });
15
+ var __importStar = (this && this.__importStar) || function (mod) {
16
+ if (mod && mod.__esModule) return mod;
17
+ var result = {};
18
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
19
+ __setModuleDefault(result, mod);
20
+ return result;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ // Copyright (c) Microsoft Corporation.
24
+ // Licensed under the MIT license.
25
+ const cli_options_1 = require("./cli-options");
26
+ const path = __importStar(require("path"));
27
+ const process_1 = require("process");
28
+ const save_declarations_1 = require("./lib/save-declarations");
29
+ const source_spec_1 = require("./lib/source-spec");
30
+ const logger_1 = require("./lib/logger");
31
+ if (cli_options_1.options.config) {
32
+ const sourceSpecs = (0, source_spec_1.convertConfigToSourceSpecs)(cli_options_1.options.config);
33
+ (0, save_declarations_1.extractAndResolveDeclarations)(sourceSpecs).then((declarations) => {
34
+ if (cli_options_1.options.outputDir) {
35
+ (0, save_declarations_1.writeToFile)(cli_options_1.options.outputDir, declarations, 'config-resolved', !cli_options_1.options.silent);
36
+ }
37
+ else {
38
+ console.log(JSON.stringify(declarations));
39
+ }
40
+ });
41
+ }
42
+ else if (cli_options_1.options.help || !cli_options_1.options.sourceDir) {
43
+ require('./cli-help');
44
+ }
45
+ else {
46
+ const parserOptions = {
47
+ eventPrefix: cli_options_1.options.eventPrefix,
48
+ applyEndpoints: cli_options_1.options.applyEndpoints,
49
+ patchDebugEvents: false,
50
+ lowerCaseEvents: false,
51
+ silenceOutput: cli_options_1.options.silenceOutput,
52
+ verbose: cli_options_1.options.verbose
53
+ };
54
+ (0, logger_1.logMessage)('....running.', parserOptions.silenceOutput);
55
+ const sourceSpec = {
56
+ sourceDirs: resolveDirectories(cli_options_1.options.sourceDir),
57
+ excludedDirs: cli_options_1.options.excludedDir ? resolveDirectories(cli_options_1.options.excludedDir) : [],
58
+ parserOptions: parserOptions
59
+ };
60
+ (0, save_declarations_1.extractAndResolveDeclarations)([sourceSpec]).then((declarations) => {
61
+ if (cli_options_1.options.outputDir) {
62
+ (0, save_declarations_1.writeToFile)(cli_options_1.options.outputDir, declarations, 'declarations-resolved', !cli_options_1.options.silent);
63
+ }
64
+ else {
65
+ console.log(JSON.stringify(declarations));
66
+ }
67
+ });
68
+ }
69
+ // Resolves an array of paths
70
+ function resolveDirectories(dirs, workingDir) {
71
+ if (workingDir) {
72
+ if (path.isAbsolute(workingDir)) {
73
+ return dirs.map(s => path.resolve(workingDir, s));
74
+ }
75
+ else {
76
+ return dirs.map(s => path.resolve((0, process_1.cwd)(), workingDir, s));
77
+ }
78
+ }
79
+ else {
80
+ return dirs.map(s => path.resolve((0, process_1.cwd)(), s));
81
+ }
82
+ }
83
+ //# sourceMappingURL=extractor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractor.js","sourceRoot":"","sources":["../src/extractor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,uCAAuC;AACvC,kCAAkC;AAClC,+CAAwC;AACxC,2CAA6B;AAC7B,qCAA8B;AAC9B,+DAAqF;AACrF,mDAA0F;AAC1F,yCAA0C;AAE1C,IAAI,qBAAO,CAAC,MAAM,EAAE;IAChB,MAAM,WAAW,GAAG,IAAA,wCAA0B,EAAC,qB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Y,EAAE,uBAAuB,EAAE,CAAC,qBAAO,CAAC,MAAM,CAAC,CAAC;SAC1F;aAAM;YACH,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;SAC7C;IACL,CAAC,CAAC,CAAC;CACN;AAED,6BAA6B;AAC7B,SAAS,kBAAkB,CAAC,IAAc,EAAE,UAAmB;IAC3D,IAAI,UAAU,EAAE;QACZ,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;YAC7B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;SACrD;aAAM;YACH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAA,aAAG,GAAE,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;SAC5D;KACJ;SAAM;QACH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAA,aAAG,GAAE,EAAE,CAAC,CAAC,CAAC,CAAC;KAChD;AACL,CAAC"}
package/out/index.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertConfigToSourceSpecs = exports.extractAndResolveDeclarations = void 0;
4
+ // Copyright (c) Microsoft Corporation.
5
+ // Licensed under the MIT license.
6
+ var save_declarations_1 = require("./lib/save-declarations");
7
+ Object.defineProperty(exports, "extractAndResolveDeclarations", { enumerable: true, get: function () { return save_declarations_1.extractAndResolveDeclarations; } });
8
+ var source_spec_1 = require("./lib/source-spec");
9
+ Object.defineProperty(exports, "convertConfigToSourceSpecs", { enumerable: true, get: function () { return source_spec_1.convertConfigToSourceSpecs; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,kCAAkC;AAClC,6DAAwE;AAA/D,kIAAA,6BAA6B,OAAA;AACtC,iDAA2E;AAAlE,yHAAA,0BAA0B,OAAA"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Property = exports.CommonProperties = void 0;
4
+ class CommonProperties {
5
+ properties;
6
+ constructor() {
7
+ this.properties = [];
8
+ }
9
+ }
10
+ exports.CommonProperties = CommonProperties;
11
+ class Property {
12
+ name;
13
+ classification;
14
+ purpose;
15
+ endPoint;
16
+ isMeasurement;
17
+ expiration;
18
+ owner;
19
+ comment;
20
+ constructor(name, classification, purpose, expiration, owner, comment, endpoint, isMeasurement) {
21
+ this.name = name;
22
+ this.classification = classification;
23
+ this.purpose = purpose;
24
+ this.endPoint = endpoint;
25
+ this.isMeasurement = isMeasurement;
26
+ this.expiration = expiration;
27
+ this.owner = owner;
28
+ this.comment = comment;
29
+ }
30
+ }
31
+ exports.Property = Property;
32
+ //# sourceMappingURL=common-properties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-properties.js","sourceRoot":"","sources":["../../src/lib/common-properties.ts"],"names":[],"mappings":";;;AAIA,MAAa,gBAAgB;IAClB,UAAU,CAAkB;IACnC;QACI,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACzB,CAAC;CACJ;AALD,4CAKC;AAED,MAAa,QAAQ;IACV,IAAI,CAAS;IACb,cAAc,CAAS;IACvB,OAAO,CAAS;IAChB,QAAQ,CAAU;IAClB,aAAa,CAAW;IACxB,UAAU,CAAU;IACpB,KAAK,CAAU;IACf,OAAO,CAAU;IAExB,YACI,IAAY,EACZ,cAAsB,EACtB,OAAe,EACf,UAAmB,EACnB,KAAc,EACd,OAAgB,EAChB,QAAiB,EACjB,aAAuB;QAEvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;CACJ;AA7BD,4BA6BC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.patchDebugEvents = void 0;
4
+ // Copyright (c) Microsoft Corporation.
5
+ // Licensed under the MIT license.
6
+ const events_1 = require("./events");
7
+ const common_properties_1 = require("./common-properties");
8
+ function patchDebugEvents(currentEvents, eventPrefix) {
9
+ const debugProtocolErrorResponse = new events_1.Event(eventPrefix + 'debugProtocolErrorResponse');
10
+ debugProtocolErrorResponse.properties.push(new common_properties_1.Property('error', 'CallstackOrException', 'PerformanceAndHealth'));
11
+ const optin = new events_1.Event(eventPrefix + 'optinstatus');
12
+ optin.properties.push(new common_properties_1.Property('optin', 'SystemMetaData', 'BusinessInsight', undefined, undefined, undefined, undefined, true));
13
+ currentEvents.dataPoints.push(debugProtocolErrorResponse);
14
+ currentEvents.dataPoints.push(optin);
15
+ }
16
+ exports.patchDebugEvents = patchDebugEvents;
17
+ //# sourceMappingURL=debug-patch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-patch.js","sourceRoot":"","sources":["../../src/lib/debug-patch.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,kCAAkC;AAClC,qCAAyC;AACzC,2DAA+C;AAE/C,SAAgB,gBAAgB,CAAC,aAAqB,EAAE,WAAmB;IACvE,MAAM,0BAA0B,GAAG,IAAI,cAAK,CAAC,WAAW,GAAG,4BAA4B,CAAC,CAAC;IACzF,0BAA0B,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,4BAAQ,CAAC,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAClH,MAAM,KAAK,GAAG,IAAI,cAAK,CAAC,WAAW,GAAG,aAAa,CAAC,CAAC;IACrD,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,4BAAQ,CAAC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACpI,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IAC1D,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC;AAPD,4CAOC"}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveDeclarations = void 0;
4
+ const events_1 = require("./events");
5
+ const common_properties_1 = require("./common-properties");
6
+ function resolveIncludes(target, fragments) {
7
+ const notResolved = [];
8
+ const usedFragments = [];
9
+ for (const item of target.dataPoints) {
10
+ for (let i = 0; i < item.properties.length; i++) {
11
+ const property = item.properties[i];
12
+ if (property instanceof events_1.Include) {
13
+ // Removes the current include from the array since we have filled it in
14
+ item.properties = item.properties.filter((val) => {
15
+ return val != property;
16
+ });
17
+ for (let reference of property.includeNames) {
18
+ reference = reference.substring(2, reference.length - 1);
19
+ const fragment = fragments.dataPoints.find((f) => {
20
+ return f.name === reference;
21
+ });
22
+ if (fragment) {
23
+ item.properties = item.properties.concat(fragment.properties);
24
+ usedFragments.push(fragment.name);
25
+ }
26
+ else {
27
+ notResolved.push(reference);
28
+ }
29
+ // This is an inefficient solution, but since adding and removing from the array
30
+ // messes up the iteration we just restart it until we can get through the whole loop without any includes
31
+ i = 0;
32
+ }
33
+ }
34
+ }
35
+ }
36
+ return { target, notResolved, usedFragments };
37
+ }
38
+ function resolveInlines(target, fragments) {
39
+ const notResolved = [];
40
+ const usedFragments = [];
41
+ for (const item of target.dataPoints) {
42
+ for (let i = 0; i < item.properties.length; i++) {
43
+ const property = item.properties[i];
44
+ if (property instanceof events_1.Inline) {
45
+ // Removes the current inline from the array since we are resolving it
46
+ item.properties = item.properties.filter((val) => {
47
+ return val !== property;
48
+ });
49
+ for (let reference of property.inlines) {
50
+ // Gets rid of the ${}
51
+ reference = reference.substring(2, reference.length - 1);
52
+ const fragment = fragments.dataPoints.find((f) => {
53
+ return f.name === reference;
54
+ });
55
+ if (fragment) {
56
+ usedFragments.push(fragment.name);
57
+ fragment.properties.forEach((prop) => {
58
+ if (prop instanceof common_properties_1.Property) {
59
+ // We create the new property in the format inlineName.propName keeping the rest the same
60
+ let currentProp = new common_properties_1.Property(`${property.inlineName}.${prop.name}`, prop.classification, prop.purpose, prop.expiration, prop.owner, prop.comment);
61
+ if (prop.endPoint) {
62
+ currentProp.endPoint = prop.endPoint;
63
+ }
64
+ if (prop.isMeasurement) {
65
+ currentProp.isMeasurement = prop.isMeasurement;
66
+ }
67
+ item.properties.push(currentProp);
68
+ }
69
+ });
70
+ }
71
+ else {
72
+ notResolved.push(reference);
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ return { target, notResolved, usedFragments };
79
+ }
80
+ function resolveDeclarations(declarations, verbose) {
81
+ let notResolved = [];
82
+ let usedFragments = [];
83
+ if (verbose) {
84
+ const fragmentsResolveInlines = resolveInlines(declarations.fragments, declarations.fragments);
85
+ const eventsResolveInlines = resolveInlines(declarations.events, declarations.fragments);
86
+ const fragmentsResolveIncludes = resolveIncludes(declarations.fragments, declarations.fragments);
87
+ const eventsResolveIncludes = resolveIncludes(declarations.events, declarations.fragments);
88
+ notResolved = notResolved.concat(fragmentsResolveIncludes.notResolved);
89
+ notResolved = notResolved.concat(fragmentsResolveInlines.notResolved);
90
+ notResolved = notResolved.concat(eventsResolveIncludes.notResolved);
91
+ notResolved = notResolved.concat(eventsResolveInlines.notResolved);
92
+ // Remove duplicates
93
+ notResolved = [...new Set(notResolved)];
94
+ usedFragments = usedFragments.concat(fragmentsResolveIncludes.usedFragments);
95
+ usedFragments = usedFragments.concat(fragmentsResolveInlines.usedFragments);
96
+ usedFragments = usedFragments.concat(eventsResolveIncludes.usedFragments);
97
+ usedFragments = usedFragments.concat(eventsResolveInlines.usedFragments);
98
+ // Remove duplicates
99
+ const usedFragmentsSet = new Set(usedFragments);
100
+ const allFragments = declarations.fragments.dataPoints.map(f => f.name);
101
+ // The Symmetric difference of a set
102
+ let unusedFragments = [...new Set(allFragments.filter(x => !usedFragmentsSet.has(x)))];
103
+ notResolved = notResolved.length > 0 ? notResolved : ['None'];
104
+ unusedFragments = unusedFragments.length > 0 ? unusedFragments : ['None'];
105
+ console.log(`Unresolved References: ${notResolved}`);
106
+ console.log(`Unused Fragments: ${unusedFragments}`);
107
+ declarations.fragments = fragmentsResolveInlines.target;
108
+ declarations.events = eventsResolveInlines.target;
109
+ declarations.fragments = fragmentsResolveIncludes.target;
110
+ declarations.events = eventsResolveIncludes.target;
111
+ }
112
+ else {
113
+ declarations.fragments = resolveInlines(declarations.fragments, declarations.fragments).target;
114
+ declarations.events = resolveInlines(declarations.events, declarations.fragments).target;
115
+ declarations.fragments = resolveIncludes(declarations.fragments, declarations.fragments).target;
116
+ declarations.events = resolveIncludes(declarations.events, declarations.fragments).target;
117
+ }
118
+ return { events: declarations.events, commonProperties: declarations.commonProperties, fragments: declarations.fragments };
119
+ }
120
+ exports.resolveDeclarations = resolveDeclarations;
121
+ //# sourceMappingURL=declarations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declarations.js","sourceRoot":"","sources":["../../src/lib/declarations.ts"],"names":[],"mappings":";;;AAGA,qCAAmD;AACnD,2DAAiE;AAcjE,SAAS,eAAe,CAAC,MAA0B,EAAE,SAAoB;IACrE,MAAM,WAAW,GAAkB,EAAE,CAAC;IACtC,MAAM,aAAa,GAAkB,EAAE,CAAC;IACxC,KAAK,MAAM,IAAI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uBAAuB,CAAC,MAAM,CAAC;QACxD,YAAY,CAAC,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC;QAClD,YAAY,CAAC,SAAS,GAAG,wBAAwB,CAAC,MAAM,CAAC;QACzD,YAAY,CAAC,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC;KACtD;SAAM;QACH,YAAY,CAAC,SAAS,GAAG,cAAc,CAAC,YAAY,CAAC,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;QAC/F,YAAY,CAAC,MAAM,GAAG,cAAc,CAAC,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;QACzF,YAAY,CAAC,SAAS,GAAG,eAAe,CAAC,YAAY,CAAC,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;QAChG,YAAY,CAAC,MAAM,GAAG,eAAe,CAAC,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;KAC7F;IACD,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,EAAE,SAAS,EAAE,YAAY,CAAC,SAAS,EAAE,CAAC;AAC/H,CAAC;AAtCD,kDAsCC"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WildcardEntry = exports.Wildcard = exports.Inline = exports.Include = exports.Event = exports.Events = void 0;
4
+ class Events {
5
+ dataPoints;
6
+ constructor() {
7
+ this.dataPoints = [];
8
+ }
9
+ }
10
+ exports.Events = Events;
11
+ class Event {
12
+ name;
13
+ // It gets a little more complicated here as events can have a bunch of different things
14
+ properties;
15
+ constructor(name) {
16
+ this.name = name;
17
+ this.properties = [];
18
+ }
19
+ }
20
+ exports.Event = Event;
21
+ class Include {
22
+ includeNames;
23
+ constructor(includeNames) {
24
+ this.includeNames = includeNames;
25
+ }
26
+ }
27
+ exports.Include = Include;
28
+ class Inline {
29
+ inlineName;
30
+ inlines;
31
+ constructor(name, inlines) {
32
+ this.inlineName = name;
33
+ this.inlines = inlines;
34
+ }
35
+ }
36
+ exports.Inline = Inline;
37
+ class Wildcard {
38
+ entries;
39
+ constructor() {
40
+ this.entries = [];
41
+ }
42
+ }
43
+ exports.Wildcard = Wildcard;
44
+ class WildcardEntry {
45
+ prefix;
46
+ classification;
47
+ endpoint;
48
+ constructor(prefix, classification, endPoint) {
49
+ this.prefix = prefix;
50
+ this.classification = classification;
51
+ this.endpoint = endPoint;
52
+ }
53
+ }
54
+ exports.WildcardEntry = WildcardEntry;
55
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/lib/events.ts"],"names":[],"mappings":";;;AAMA,MAAa,MAAM;IACR,UAAU,CAAe;IAChC;QACI,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACzB,CAAC;CACJ;AALD,wBAKC;AAED,MAAa,KAAK;IACP,IAAI,CAAS;IACpB,wFAAwF;IACjF,UAAU,CAAgD;IACjE,YAAa,IAAY;QACrB,IAAI,CAAC,IAAI,GAAI,IAAI,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACzB,CAAC;CACJ;AARD,sBAQC;AAED,MAAa,OAAO;IACT,YAAY,CAAgB;IACnC,YAAa,YAA2B;QACpC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;CACJ;AALD,0BAKC;AAED,MAAa,MAAM;IACR,UAAU,CAAS;IACnB,OAAO,CAAgB;IAC9B,YAAa,IAAY,EAAE,OAAsB;QAC7C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;CACJ;AAPD,wBAOC;AAED,MAAa,QAAQ;IACV,OAAO,CAAuB;IACrC;QACI,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;CACJ;AALD,4BAKC;AAED,MAAa,aAAa;IACf,MAAM,CAAS;IACf,cAAc,CAA4C;IAC1D,QAAQ,CAAqB;IACpC,YAAa,MAAc,EAAE,cAAyD,EAAE,QAA6B;QACjH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ;AATD,sCASC"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.writeFile = void 0;
23
+ // Copyright (c) Microsoft Corporation.
24
+ // Licensed under the MIT license.
25
+ const fs = __importStar(require("fs"));
26
+ const path = __importStar(require("path"));
27
+ /**
28
+ * @param {string} outputFile
29
+ * @param {string} contents
30
+ * @returns {Promise}
31
+ */
32
+ async function writeFile(outputFile, contents) {
33
+ const directory = path.dirname(outputFile);
34
+ return mkdirp(directory).then((dir) => {
35
+ return new Promise((resolve, reject) => {
36
+ fs.writeFile(outputFile, contents, { encoding: 'utf8' }, (err) => {
37
+ if (err) {
38
+ reject(err);
39
+ }
40
+ else {
41
+ resolve();
42
+ }
43
+ });
44
+ });
45
+ });
46
+ }
47
+ exports.writeFile = writeFile;
48
+ // copied from https://github.com/Microsoft/vscode/blob/master/src/main.js#L139
49
+ async function mkdirp(dir) {
50
+ return mkdir(dir)
51
+ .then(null, function (err) {
52
+ if (err && err.code === 'ENOENT') {
53
+ var parent = path.dirname(dir);
54
+ if (parent !== dir) { // if not arrived at root
55
+ return mkdirp(parent)
56
+ .then(function () {
57
+ return mkdir(dir);
58
+ });
59
+ }
60
+ }
61
+ throw err;
62
+ });
63
+ }
64
+ // copied from https://github.com/Microsoft/vscode/blob/master/src/main.js#L155
65
+ async function mkdir(dir) {
66
+ return new Promise(function (resolve, reject) {
67
+ fs.mkdir(dir, function (err) {
68
+ if (err && err.code !== 'EEXIST') {
69
+ reject(err);
70
+ }
71
+ else {
72
+ resolve(dir);
73
+ }
74
+ });
75
+ });
76
+ }
77
+ //# sourceMappingURL=file-writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-writer.js","sourceRoot":"","sources":["../../src/lib/file-writer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuC;AACvC,kCAAkC;AAClC,uCAAyB;AACzB,2CAA6B;AAE7B;;;;GAIG;AACI,KAAK,UAAU,SAAS,CAAC,UAAkB,EAAE,QAAgB;IAChE,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,GAAW,EAAE,EAAE;QAC1C,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,GAAQ,EAAE,EAAE;gBAClE,IAAI,GAAG,EAAE;oBACL,MAAM,CAAC,GAAG,CAAC,CAAC;iBACf;qBAAM;oBACH,OAAO,EAAE,CAAC;iBACb;YACL,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC;AAbD,8BAaC;AAED,+EAA+E;AAC/E,KAAK,UAAU,MAAM,CAAC,GAAW;IAC7B,OAAO,KAAK,CAAC,GAAG,CAAC;SACZ,IAAI,CAAC,IAAI,EAAE,UAAU,GAAQ;QAC1B,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;YAC9B,IAAI,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,MAAM,KAAK,GAAG,EAAE,EAAE,yBAAyB;gBAC3C,OAAO,MAAM,CAAC,MAAM,CAAC;qBAChB,IAAI,CAAC;oBACF,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;gBACtB,CAAC,CAAC,CAAC;aACV;SACJ;QACD,MAAM,GAAG,CAAC;IACd,CAAC,CAAC,CAAC;AACX,CAAC;AAED,+EAA+E;AAC/E,KAAK,UAAU,KAAK,CAAC,GAAW;IAC5B,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM;QACxC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,UAAU,GAAQ;YAC5B,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC9B,MAAM,CAAC,GAAG,CAAC,CAAC;aACf;iBAAM;gBACH,OAAO,CAAC,GAAG,CAAC,CAAC;aAChB;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Fragment = exports.Fragments = void 0;
4
+ // Fragments are retrieved as an object of objects of objects. So this just makes it easier to see the structure.
5
+ class Fragments {
6
+ dataPoints;
7
+ constructor() {
8
+ this.dataPoints = [];
9
+ }
10
+ }
11
+ exports.Fragments = Fragments;
12
+ class Fragment {
13
+ name;
14
+ properties;
15
+ constructor(name) {
16
+ this.name = name;
17
+ this.properties = [];
18
+ }
19
+ }
20
+ exports.Fragment = Fragment;
21
+ //# sourceMappingURL=fragments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragments.js","sourceRoot":"","sources":["../../src/lib/fragments.ts"],"names":[],"mappings":";;;AAOA,iHAAiH;AACjH,MAAa,SAAS;IACX,UAAU,CAAkB;IACnC;QACI,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACzB,CAAC;CACJ;AALD,8BAKC;AAED,MAAa,QAAQ;IACV,IAAI,CAAS;IACb,UAAU,CAAkD;IACnE,YAAa,IAAY;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IAEzB,CAAC;CACJ;AARD,4BAQC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.classification = exports.prefix = exports.include = exports.inline = exports.wildcard = void 0;
4
+ // Copyright (c) Microsoft Corporation.
5
+ // Licensed under the MIT license.
6
+ exports.wildcard = '${wildcard}';
7
+ exports.inline = '${inline}';
8
+ exports.include = '${include}';
9
+ exports.prefix = '${prefix}';
10
+ exports.classification = '${classification}';
11
+ //# sourceMappingURL=keywords.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keywords.js","sourceRoot":"","sources":["../../src/lib/keywords.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,kCAAkC;AACrB,QAAA,QAAQ,GAAG,aAAa,CAAC;AACzB,QAAA,MAAM,GAAG,WAAW,CAAC;AACrB,QAAA,OAAO,GAAG,YAAY,CAAC;AACvB,QAAA,MAAM,GAAG,WAAW,CAAC;AACrB,QAAA,cAAc,GAAG,mBAAmB,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logMessage = void 0;
4
+ function logMessage(msg, silenceOutput = false) {
5
+ if (!silenceOutput) {
6
+ console.log(msg);
7
+ }
8
+ }
9
+ exports.logMessage = logMessage;
10
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":";;;AAAA,SAAgB,UAAU,CAAC,GAAW,EAAE,aAAa,GAAG,KAAK;IACzD,IAAI,CAAC,aAAa,EAAE;QAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACpB;AACL,CAAC;AAJD,gCAIC"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.transformOutput = void 0;
23
+ const events_1 = require("./events");
24
+ const keywords = __importStar(require("./keywords"));
25
+ // Converts the declarations array to an object format for easy readability.
26
+ async function transformOutput(output) {
27
+ const newEvents = Object.create(null);
28
+ const oldEvents = output.events.dataPoints;
29
+ for (const event of oldEvents) {
30
+ newEvents[event.name] = Object.create(null);
31
+ //We know there won't be anymore includes or inlines because we have resolved them
32
+ for (const property of event.properties) {
33
+ if (property instanceof events_1.Wildcard) {
34
+ newEvents[event.name][keywords.wildcard] = newEvents[event.name][keywords.wildcard] ? newEvents[event.name][keywords.wildcard] : [];
35
+ for (const entry of property.entries) {
36
+ const found = newEvents[event.name][keywords.wildcard].find((e) => {
37
+ return e[keywords.prefix] === entry.prefix.toLowerCase();
38
+ });
39
+ if (found)
40
+ continue;
41
+ const newEntry = Object.create(null);
42
+ newEntry[keywords.prefix] = entry.prefix.toLowerCase();
43
+ if (entry.endpoint) {
44
+ newEntry[keywords.classification] = { classification: entry.classification.classification, purpose: entry.classification.purpose, endPoint: "none" };
45
+ }
46
+ else {
47
+ newEntry[keywords.classification] = entry.classification;
48
+ }
49
+ newEvents[event.name][keywords.wildcard].push(newEntry);
50
+ }
51
+ }
52
+ else {
53
+ // Handles the case where the comments can be inconsistent
54
+ // We want to ensure that if isMeasurement is ever flagged it gets propogated
55
+ if (newEvents[event.name][propetyNameChanger(property.name)]) {
56
+ if (property.isMeasurement)
57
+ newEvents[event.name][propetyNameChanger(property.name)]['isMeasurement'] = property.isMeasurement;
58
+ continue;
59
+ }
60
+ newEvents[event.name][propetyNameChanger(property.name)] = { classification: property.classification, purpose: property.purpose };
61
+ if (property.expiration) {
62
+ newEvents[event.name][propetyNameChanger(property.name)]['expiration'] = property.expiration;
63
+ }
64
+ if (property.owner) {
65
+ newEvents[event.name][propetyNameChanger(property.name)]['owner'] = property.owner;
66
+ }
67
+ if (property.comment) {
68
+ newEvents[event.name][propetyNameChanger(property.name)]['comment'] = property.comment;
69
+ }
70
+ if (property.endPoint) {
71
+ newEvents[event.name][propetyNameChanger(property.name)]['endPoint'] = property.endPoint;
72
+ }
73
+ if (property.isMeasurement) {
74
+ newEvents[event.name][propetyNameChanger(property.name)]['isMeasurement'] = property.isMeasurement;
75
+ }
76
+ }
77
+ }
78
+ }
79
+ const newCommonProperties = Object.create(null);
80
+ const oldCommonProperties = output.commonProperties.properties;
81
+ for (const property of oldCommonProperties) {
82
+ // Handles the case where the comments can be incosistent
83
+ // We want to ensure that if isMeasurement is ever flagged it gets propogated
84
+ if (newCommonProperties[propetyNameChanger(property.name)]) {
85
+ if (property.isMeasurement)
86
+ newCommonProperties[propetyNameChanger(property.name)]['isMeasurement'] = property.isMeasurement;
87
+ continue;
88
+ }
89
+ newCommonProperties[propetyNameChanger(property.name)] = { classification: property.classification, purpose: property.purpose };
90
+ if (property.endPoint) {
91
+ newCommonProperties[propetyNameChanger(property.name)]['endPoint'] = property.endPoint;
92
+ }
93
+ if (property.isMeasurement) {
94
+ newCommonProperties[propetyNameChanger(property.name)]['isMeasurement'] = property.isMeasurement;
95
+ }
96
+ }
97
+ return { events: newEvents, commonProperties: newCommonProperties };
98
+ }
99
+ exports.transformOutput = transformOutput;
100
+ function propetyNameChanger(name) {
101
+ name = name.toLowerCase();
102
+ if (name.includes('<number>')) {
103
+ name = name.replace('<number>', '<NUMBER>');
104
+ }
105
+ return name;
106
+ }
107
+ //# sourceMappingURL=object-converter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-converter.js","sourceRoot":"","sources":["../../src/lib/object-converter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIA,qCAAoC;AACpC,qDAAuC;AAEvC,4EAA4E;AAErE,KAAK,UAAU,eAAe,CAAC,MAA6B;IAC/D,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;IAC3C,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE;QAC3B,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC5C,kFAAkF;QAClF,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,UAAwC,EAAE;YACnE,IAAI,QAAQ,YAAY,iBAAQ,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