@jupiterone/jupiterone-mcp 2.6.1 → 2.7.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.
Files changed (148) hide show
  1. package/README.md +122 -72
  2. package/dist/client/graphql/mutations.d.ts +16 -0
  3. package/dist/client/graphql/mutations.d.ts.map +1 -1
  4. package/dist/client/graphql/mutations.js +126 -1
  5. package/dist/client/graphql/mutations.js.map +1 -1
  6. package/dist/client/graphql/queries.d.ts +27 -2
  7. package/dist/client/graphql/queries.d.ts.map +1 -1
  8. package/dist/client/graphql/queries.js +96 -4
  9. package/dist/client/graphql/queries.js.map +1 -1
  10. package/dist/client/jupiterone-client.d.ts +30 -0
  11. package/dist/client/jupiterone-client.d.ts.map +1 -1
  12. package/dist/client/jupiterone-client.js +60 -0
  13. package/dist/client/jupiterone-client.js.map +1 -1
  14. package/dist/client/services/compliance-service.d.ts +48 -1
  15. package/dist/client/services/compliance-service.d.ts.map +1 -1
  16. package/dist/client/services/compliance-service.js +292 -0
  17. package/dist/client/services/compliance-service.js.map +1 -1
  18. package/dist/client/services/j1ql-service.d.ts +10 -2
  19. package/dist/client/services/j1ql-service.d.ts.map +1 -1
  20. package/dist/client/services/j1ql-service.js +11 -3
  21. package/dist/client/services/j1ql-service.js.map +1 -1
  22. package/dist/client/services/rule-service.d.ts +3 -1
  23. package/dist/client/services/rule-service.d.ts.map +1 -1
  24. package/dist/client/services/rule-service.js +7 -5
  25. package/dist/client/services/rule-service.js.map +1 -1
  26. package/dist/generated/description-map.d.ts.map +1 -1
  27. package/dist/generated/description-map.js +741 -59
  28. package/dist/generated/description-map.js.map +1 -1
  29. package/dist/server/mcp-server.d.ts.map +1 -1
  30. package/dist/server/mcp-server.js +42 -3
  31. package/dist/server/mcp-server.js.map +1 -1
  32. package/dist/server/skills.d.ts +25 -0
  33. package/dist/server/skills.d.ts.map +1 -0
  34. package/dist/server/skills.js +115 -0
  35. package/dist/server/skills.js.map +1 -0
  36. package/dist/server/tools/compliance/attestations.d.ts.map +1 -1
  37. package/dist/server/tools/compliance/attestations.js +20 -37
  38. package/dist/server/tools/compliance/attestations.js.map +1 -1
  39. package/dist/server/tools/compliance/authoring.d.ts +3 -0
  40. package/dist/server/tools/compliance/authoring.d.ts.map +1 -0
  41. package/dist/server/tools/compliance/authoring.js +773 -0
  42. package/dist/server/tools/compliance/authoring.js.map +1 -0
  43. package/dist/server/tools/compliance/controls.d.ts.map +1 -1
  44. package/dist/server/tools/compliance/controls.js +193 -19
  45. package/dist/server/tools/compliance/controls.js.map +1 -1
  46. package/dist/server/tools/compliance/exemptions.d.ts +3 -0
  47. package/dist/server/tools/compliance/exemptions.d.ts.map +1 -0
  48. package/dist/server/tools/compliance/exemptions.js +287 -0
  49. package/dist/server/tools/compliance/exemptions.js.map +1 -0
  50. package/dist/server/tools/compliance/framework.d.ts +3 -0
  51. package/dist/server/tools/compliance/framework.d.ts.map +1 -0
  52. package/dist/server/tools/compliance/framework.js +445 -0
  53. package/dist/server/tools/compliance/framework.js.map +1 -0
  54. package/dist/server/tools/compliance/graph.d.ts +56 -0
  55. package/dist/server/tools/compliance/graph.d.ts.map +1 -0
  56. package/dist/server/tools/compliance/graph.js +115 -0
  57. package/dist/server/tools/compliance/graph.js.map +1 -0
  58. package/dist/server/tools/compliance/index.d.ts +2 -16
  59. package/dist/server/tools/compliance/index.d.ts.map +1 -1
  60. package/dist/server/tools/compliance/index.js +45 -15
  61. package/dist/server/tools/compliance/index.js.map +1 -1
  62. package/dist/server/tools/compliance/requirements.d.ts +3 -0
  63. package/dist/server/tools/compliance/requirements.d.ts.map +1 -0
  64. package/dist/server/tools/compliance/requirements.js +243 -0
  65. package/dist/server/tools/compliance/requirements.js.map +1 -0
  66. package/dist/server/tools/compliance/schemas.d.ts +409 -8
  67. package/dist/server/tools/compliance/schemas.d.ts.map +1 -1
  68. package/dist/server/tools/compliance/schemas.js +337 -7
  69. package/dist/server/tools/compliance/schemas.js.map +1 -1
  70. package/dist/server/tools/compliance/shared.d.ts +103 -1
  71. package/dist/server/tools/compliance/shared.d.ts.map +1 -1
  72. package/dist/server/tools/compliance/shared.js +235 -1
  73. package/dist/server/tools/compliance/shared.js.map +1 -1
  74. package/dist/server/tools/compliance/summary.d.ts +2 -8
  75. package/dist/server/tools/compliance/summary.d.ts.map +1 -1
  76. package/dist/server/tools/compliance/summary.js +149 -87
  77. package/dist/server/tools/compliance/summary.js.map +1 -1
  78. package/dist/server/tools/compliance/tests.d.ts +3 -0
  79. package/dist/server/tools/compliance/tests.d.ts.map +1 -0
  80. package/dist/server/tools/compliance/tests.js +463 -0
  81. package/dist/server/tools/compliance/tests.js.map +1 -0
  82. package/dist/server/tools/compliance/transitions.d.ts +6 -0
  83. package/dist/server/tools/compliance/transitions.d.ts.map +1 -0
  84. package/dist/server/tools/compliance/transitions.js +659 -0
  85. package/dist/server/tools/compliance/transitions.js.map +1 -0
  86. package/dist/server/tools/dashboards.d.ts.map +1 -1
  87. package/dist/server/tools/dashboards.js +16 -4
  88. package/dist/server/tools/dashboards.js.map +1 -1
  89. package/dist/server/tools/errors.d.ts +11 -1
  90. package/dist/server/tools/errors.d.ts.map +1 -1
  91. package/dist/server/tools/errors.js +16 -1
  92. package/dist/server/tools/errors.js.map +1 -1
  93. package/dist/server/tools/integrations.d.ts.map +1 -1
  94. package/dist/server/tools/integrations.js +48 -51
  95. package/dist/server/tools/integrations.js.map +1 -1
  96. package/dist/server/tools/reference.d.ts +1 -1
  97. package/dist/server/tools/reference.d.ts.map +1 -1
  98. package/dist/server/tools/reference.js +1 -0
  99. package/dist/server/tools/reference.js.map +1 -1
  100. package/dist/server/tools/result.d.ts +3 -2
  101. package/dist/server/tools/result.d.ts.map +1 -1
  102. package/dist/server/tools/result.js +3 -2
  103. package/dist/server/tools/result.js.map +1 -1
  104. package/dist/server/tools/rules.d.ts.map +1 -1
  105. package/dist/server/tools/rules.js +19 -21
  106. package/dist/server/tools/rules.js.map +1 -1
  107. package/dist/server/tools/types.d.ts +2 -0
  108. package/dist/server/tools/types.d.ts.map +1 -1
  109. package/dist/server/tools/types.js.map +1 -1
  110. package/dist/server/tools/usage.d.ts +21 -7
  111. package/dist/server/tools/usage.d.ts.map +1 -1
  112. package/dist/server/tools/usage.js +490 -8
  113. package/dist/server/tools/usage.js.map +1 -1
  114. package/dist/server/tools/value-probe.d.ts +1 -1
  115. package/dist/server/tools/value-probe.d.ts.map +1 -1
  116. package/dist/server/tools/value-probe.js +126 -1
  117. package/dist/server/tools/value-probe.js.map +1 -1
  118. package/dist/server/tools/widget-config-lint.d.ts +5 -3
  119. package/dist/server/tools/widget-config-lint.d.ts.map +1 -1
  120. package/dist/server/tools/widget-config-lint.js +74 -71
  121. package/dist/server/tools/widget-config-lint.js.map +1 -1
  122. package/dist/server/tools/widget-percentage.d.ts +63 -0
  123. package/dist/server/tools/widget-percentage.d.ts.map +1 -0
  124. package/dist/server/tools/widget-percentage.js +115 -0
  125. package/dist/server/tools/widget-percentage.js.map +1 -0
  126. package/dist/server/tools/widget-preflight.d.ts +8 -1
  127. package/dist/server/tools/widget-preflight.d.ts.map +1 -1
  128. package/dist/server/tools/widget-preflight.js +36 -5
  129. package/dist/server/tools/widget-preflight.js.map +1 -1
  130. package/dist/server/tools/widget-render-contract.d.ts.map +1 -1
  131. package/dist/server/tools/widget-render-contract.js +21 -9
  132. package/dist/server/tools/widget-render-contract.js.map +1 -1
  133. package/dist/types/jupiterone.d.ts +179 -0
  134. package/dist/types/jupiterone.d.ts.map +1 -1
  135. package/dist/utils/dashboard-variables.d.ts +8 -0
  136. package/dist/utils/dashboard-variables.d.ts.map +1 -0
  137. package/dist/utils/dashboard-variables.js +54 -0
  138. package/dist/utils/dashboard-variables.js.map +1 -0
  139. package/dist/utils/j1ql-filters.d.ts +15 -0
  140. package/dist/utils/j1ql-filters.d.ts.map +1 -1
  141. package/dist/utils/j1ql-filters.js +37 -16
  142. package/dist/utils/j1ql-filters.js.map +1 -1
  143. package/dist/utils/j1ql-validator.d.ts +1 -0
  144. package/dist/utils/j1ql-validator.d.ts.map +1 -1
  145. package/dist/utils/j1ql-validator.js +260 -19
  146. package/dist/utils/j1ql-validator.js.map +1 -1
  147. package/node_modules/dtrace-provider/build/Makefile +1 -1
  148. package/package.json +3 -3
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.lintWidgetConfig = lintWidgetConfig;
4
4
  exports.widgetConfigErrorResponse = widgetConfigErrorResponse;
5
+ const dashboard_variables_js_1 = require("../../utils/dashboard-variables.js");
6
+ const widget_percentage_js_1 = require("./widget-percentage.js");
5
7
  const widget_render_contract_js_1 = require("./widget-render-contract.js");
6
8
  /** Dashboards the agent creates get a UUID; JupiterOne's managed boards carry slug ids. */
7
9
  const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
@@ -10,53 +12,45 @@ function trendEnabled(settings) {
10
12
  return false;
11
13
  return Object.values(settings).some((perChart) => perChart?.trendDataIsEnabled === true);
12
14
  }
13
- /** Chart types whose settings carry the percentage-calculation keys. */
14
- const PERCENTAGE_CHART_TYPES = ['number', 'line'];
15
15
  /**
16
- * The percentage block this widget's renderer will actually read, when percentage mode is on.
16
+ * The total was left to the default, and the two settings draw different numbers.
17
17
  *
18
- * Keyed on the widget's own chart type, not scanned across all of them: the renderer reads
19
- * `settings[type]`, so `settings.number.showAsPercentage` on a `bar` widget is dead configuration
20
- * and blocking a legitimate bar chart over it would be a lint causing the failure it exists to stop.
18
+ * Unset divides by every query, numerator included; this server taught the opposite from 2.2.0 to
19
+ * 2.6.1, so the natural numerator-plus-population pair it recommended drew 43.8% where 78.0% was
20
+ * meant (j1dev, 2026-10-29; see widget-percentage.ts). Blocking because neither reading can be
21
+ * inferred from the queries: a population pair needs `false`, a partition pair (`Patched` +
22
+ * `Unpatched`) needs `true`. The message leads with no query names — its first 200 characters
23
+ * become the telemetry `errorMessage`.
21
24
  */
22
- function percentageSettings(chartType, settings) {
23
- if (!chartType || !PERCENTAGE_CHART_TYPES.includes(chartType))
24
- return null;
25
- if (!settings || typeof settings !== 'object')
26
- return null;
27
- const perChart = settings[chartType];
28
- if (!perChart || typeof perChart !== 'object')
29
- return null;
30
- const percentage = perChart;
31
- return percentage.showAsPercentage === true ? percentage : null;
32
- }
33
- /** SEVERAL numerator queries are comma-joined into the single `numeratorQueryName` string. */
34
- function numeratorNames(value) {
35
- if (typeof value !== 'string')
36
- return [];
37
- return value
38
- .split(',')
39
- .map((name) => name.trim())
40
- .filter((name) => name !== '');
41
- }
42
- /**
43
- * Every query on the widget is a numerator, so there is nothing left to divide by.
44
- *
45
- * Advisory, not blocking: what the renderer does with a zero denominator was never measured, and
46
- * the two neighbouring cases behave differently enough (a missing numerator draws a flat 0%) that
47
- * guessing this one would be asserting a measurement nobody took.
48
- */
49
- function totalEmptyFinding(numerators) {
50
- return {
51
- code: 'percentage-total-empty',
52
- blocking: false,
53
- message: 'This widget shows a percentage and `numeratorQueryName` names every query on it ' +
54
- `(${numerators.map((name) => `\`${name}\``).join(', ')}), so the total it divides by is ` +
55
- 'empty. The figure is the sum of the named queries divided by the sum of the ones it does ' +
56
- 'not name. Either leave the query that counts the population out of `numeratorQueryName`, ' +
57
- 'or set `includeNumeratorInTotal: true` to divide by all of them together.',
58
- };
59
- }
25
+ const TOTAL_UNSPECIFIED = {
26
+ code: 'percentage-total-unspecified',
27
+ blocking: true,
28
+ message: 'This widget shows a percentage but does not set `includeNumeratorInTotal`, and the two ' +
29
+ 'settings draw different numbers. Left unset, JupiterOne divides by every query, numerator ' +
30
+ 'included: a numerator of 40 beside a query counting all 100 draws 28.6%, not 40%. Set ' +
31
+ '`includeNumeratorInTotal: false` when the other queries count the whole population, or ' +
32
+ '`true` when the queries split it between them (`Patched` + `Unpatched`). A widget built in the ' +
33
+ 'UI with "Include numerator queries in total" ticked stores no key and divides by every query ' +
34
+ 'today, so `true` keeps what it draws.',
35
+ };
36
+ /** Every query is a numerator and the total counts them all, so the figure is always 100%. */
37
+ const TOTAL_IS_NUMERATOR = {
38
+ code: 'percentage-total-is-numerator',
39
+ blocking: true,
40
+ message: 'This widget shows a percentage and `numeratorQueryName` names every query on it. JupiterOne ' +
41
+ 'divides the named queries by every query, so the widget draws 100% whatever the data, or 0% ' +
42
+ 'when every query counts nothing. Add a query that counts the population, leave it out of ' +
43
+ '`numeratorQueryName`, and set `includeNumeratorInTotal: false`.',
44
+ };
45
+ /** Every query is a numerator and `false` excludes them all from the total, so it draws 0%. */
46
+ const TOTAL_EMPTY = {
47
+ code: 'percentage-total-empty',
48
+ blocking: true,
49
+ message: 'This widget shows a percentage with `includeNumeratorInTotal: false`, and ' +
50
+ '`numeratorQueryName` names every query on it, so nothing is left to divide by and the widget ' +
51
+ 'draws 0% whatever the data. Add a query that counts the population and leave it out of ' +
52
+ '`numeratorQueryName`.',
53
+ };
60
54
  /**
61
55
  * Percentage mode on a LINE chart correlates its queries positionally.
62
56
  *
@@ -93,27 +87,26 @@ function linePercentageFindings(queries) {
93
87
  /**
94
88
  * What percentage mode needs that this widget does not have.
95
89
  *
96
- * A percentage widget is a ratio between its queries: the numerator is the SUM of the queries named
97
- * in `numeratorQueryName`, the total is the sum of the others — or of all of them under
98
- * `includeNumeratorInTotal`. Every failure below produces a number that renders, which is why they
99
- * are worth a finding at all: a numerator summing nothing draws a flat 0%, and every row count and
100
- * every column check calls that widget healthy.
90
+ * JupiterOne draws the sum of the queries named in `numeratorQueryName` divided by the sum of every
91
+ * query, numerator included, unless `includeNumeratorInTotal` is `false`, which divides by the
92
+ * queries it does not name. Every failure below still draws a number, which is why each is worth a
93
+ * finding: no row count or column check can tell it from a correct one.
101
94
  *
102
- * A name matching no query BLOCKS: the ratio is provably wrong and the fix is a spelling. An empty
103
- * `numeratorQueryName`, too few queries to divide, an empty total, and a percentage line chart
104
- * missing its shared axis are advisory — nothing is *named* wrong, and a caller mid-build may know
95
+ * Blocking: a name matching no query, a total left unspecified, and every query named as a
96
+ * numerator — each draws a number that is provably not the one asked for, or one of two numbers
97
+ * with nothing to say which the caller meant. Advisory: no numerator named, too few queries to
98
+ * divide, and a percentage line chart missing its shared axis — a caller mid-build may know
105
99
  * something this does not.
106
100
  */
107
101
  function percentageFindings(input) {
108
- const percentage = percentageSettings(input?.type, input?.config?.settings);
102
+ const percentage = (0, widget_percentage_js_1.percentageSettings)(input?.type, input?.config?.settings);
109
103
  if (!percentage)
110
104
  return [];
111
105
  const queries = input?.config?.queries ?? [];
112
106
  const queryNames = queries
113
107
  .map((queryObj) => queryObj?.name)
114
108
  .filter((name) => typeof name === 'string' && name !== '');
115
- const numerators = numeratorNames(percentage.numeratorQueryName);
116
- const unmatched = numerators.filter((name) => !queryNames.includes(name));
109
+ const unmatched = (0, widget_percentage_js_1.unmatchedNumerators)(percentage.numeratorQueryName, queryNames);
117
110
  if (unmatched.length > 0) {
118
111
  return [
119
112
  {
@@ -122,13 +115,18 @@ function percentageFindings(input) {
122
115
  message: `This widget shows a percentage and \`numeratorQueryName\` names ` +
123
116
  `${unmatched.map((name) => `\`${name}\``).join(', ')}, which no query on it is called. ` +
124
117
  `Its queries are named ${queryNames.map((name) => `\`${name}\``).join(', ') || '(none)'}. ` +
125
- 'The numerator is the sum of the queries it names, so an unmatched name sums to nothing ' +
126
- 'and the widget renders a flat 0% that every row count reports as healthy. Match the ' +
127
- 'name exactly — several numerator queries are comma-joined into that one string.',
118
+ 'The renderer drops a name that matches no query from the numerator, and when none ' +
119
+ 'matches it draws the plain sum of every query with a % sign — a number that is not a ' +
120
+ 'percentage of anything. Match the name exactly — several numerator queries are ' +
121
+ 'comma-joined into that one string.',
128
122
  },
129
123
  ];
130
124
  }
125
+ const numerators = (0, widget_percentage_js_1.resolveNumerators)(percentage.numeratorQueryName, queryNames);
131
126
  if (numerators.length === 0 || queries.length < 2) {
127
+ const drawn = numerators.length === 0
128
+ ? 'the plain sum of its queries with a % sign'
129
+ : '100% or 0% whatever the data';
132
130
  const shortfall = numerators.length === 0
133
131
  ? 'names no numerator query'
134
132
  : `carries ${queries.length === 1 ? 'only one query' : 'no queries'}`;
@@ -136,18 +134,20 @@ function percentageFindings(input) {
136
134
  {
137
135
  code: 'percentage-without-total',
138
136
  blocking: false,
139
- message: `This widget shows a percentage but ${shortfall}. The figure is the sum of the queries ` +
140
- 'named in `numeratorQueryName` divided by the sum of the others — or by all of them, ' +
141
- 'with `includeNumeratorInTotal` — so it needs a named numerator and something to divide ' +
142
- 'by. As configured the ratio is the query against itself, or against nothing. Add the ' +
143
- 'query that counts the population, or drop `showAsPercentage` and show the count.',
137
+ message: `This widget shows a percentage but ${shortfall}, so it draws ${drawn}. JupiterOne ` +
138
+ 'divides the queries named in `numeratorQueryName` by every query, or by the ones it ' +
139
+ 'does not name when `includeNumeratorInTotal` is `false`, so it needs a named numerator ' +
140
+ 'and a query to divide by. Add the query that counts the population, or drop ' +
141
+ '`showAsPercentage` and show the count.',
144
142
  },
145
143
  ];
146
144
  }
147
145
  const findings = [];
146
+ if (typeof percentage.includeNumeratorInTotal !== 'boolean')
147
+ findings.push(TOTAL_UNSPECIFIED);
148
148
  const everyQueryNamed = queries.every((queryObj) => typeof queryObj?.name === 'string' && numerators.includes(queryObj.name));
149
- if (everyQueryNamed && percentage.includeNumeratorInTotal !== true) {
150
- findings.push(totalEmptyFinding(numerators));
149
+ if (everyQueryNamed) {
150
+ findings.push(percentage.includeNumeratorInTotal === false ? TOTAL_EMPTY : TOTAL_IS_NUMERATOR);
151
151
  }
152
152
  if (input?.type === 'line')
153
153
  findings.push(...linePercentageFindings(queries));
@@ -224,8 +224,10 @@ function managedBoardFinding(dashboardId, operation) {
224
224
  *
225
225
  * Returns findings in severity order — every blocking finding precedes the advisory ones, so the
226
226
  * rejection's `lintCode` names the first real reason. A finding blocks only where the widget is
227
- * verified to draw nothing (`managed-board`, `markdown-without-text`, `unsupported-chart-type`) or
228
- * to draw a number that is provably not the one asked for (`percentage-numerator-unmatched`).
227
+ * verified to draw nothing (`managed-board`, `markdown-without-text`, `unsupported-chart-type`), to
228
+ * draw a number that is provably not the one asked for (`percentage-numerator-unmatched`,
229
+ * `percentage-total-is-numerator`, `percentage-total-empty`), or to draw one of two numbers with
230
+ * nothing to say which was meant (`percentage-total-unspecified`).
229
231
  */
230
232
  async function lintWidgetConfig(client, dashboardId, input, operation) {
231
233
  const findings = [];
@@ -253,13 +255,14 @@ async function lintWidgetConfig(client, dashboardId, input, operation) {
253
255
  findings.push(...percentageFindings(input));
254
256
  if (trendEnabled(input?.config?.settings)) {
255
257
  const queries = input?.config?.queries ?? [];
256
- if (queries.some((queryObj) => queryObj?.query?.includes('{{'))) {
258
+ if (queries.some((queryObj) => queryObj?.query && (0, dashboard_variables_js_1.hasDashboardVariable)(queryObj.query))) {
257
259
  findings.push({
258
260
  code: 'trend-with-parameters',
259
261
  blocking: false,
260
- message: 'This widget enables trend collection and its query uses a `{{parameter}}`. Query ' +
261
- 'variables are not supported in trend widgets, so the trend will not collect. Either ' +
262
- 'drop `trendDataIsEnabled` or replace the parameter with a literal.',
262
+ message: 'This widget enables trend collection and its query uses a dashboard variable ' +
263
+ '(`${name}` or `{{name}}`). Query variables are not supported in trend widgets, so the ' +
264
+ 'trend will not collect. Either drop `trendDataIsEnabled` or replace the variable with ' +
265
+ 'a literal.',
263
266
  });
264
267
  }
265
268
  findings.push({
@@ -1 +1 @@
1
- {"version":3,"file":"widget-config-lint.js","sourceRoot":"","sources":["../../../src/server/tools/widget-config-lint.ts"],"names":[],"mappings":";;AA+RA,4CAwDC;AASD,8DAWC;AAxWD,2EAAkE;AAwBlE,2FAA2F;AAC3F,MAAM,IAAI,GAAG,iEAAiE,CAAC;AAM/E,SAAS,YAAY,CAAC,QAAiB;IACrC,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5D,OAAO,MAAM,CAAC,MAAM,CAAC,QAA0B,CAAC,CAAC,IAAI,CACnD,CAAC,QAAQ,EAA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AAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,sBAAsB;YAC5B,QAAQ,EAAE,KAAK;YACf,OAAO,EACL,uFAAuF;gBACvF,uFAAuF;SAC1F,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,yBAAyB,CACvC,SAA8B,EAC9B,QAA+B;IAE/B,MAAM,OAAO,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,CAAC;IACrF,MAAM,IAAI,GAAG,GAAG,OAAO,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACvF,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACjC,OAAO,EAAE,IAAI;QACb,iBAAiB,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;KAClD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Percentage mode as JupiterOne draws it, shared by the config lint and the post-write preflight.
3
+ *
4
+ * Mirrors web-app's number widget — `parseNumberWidgetSettings.ts`, `resolveNumeratorQueryNames.ts`
5
+ * and `computeNumberValue.ts` under `artifacts/app/src/views/insights/dashboards/components/widgets/
6
+ * number/utils/` — because this server taught the opposite of it from 2.2.0 to 2.6.1. An unset
7
+ * `includeNumeratorInTotal` is TRUE there: the denominator is every query, numerator included, and
8
+ * only an explicit `false` divides by the queries the numerator does not name. The UI stores the key
9
+ * only as `false`, so an unset key is also what a widget built with the box ticked looks like.
10
+ *
11
+ * Measured on j1dev, 2026-10-29: 145 encrypted of 186 S3 buckets drew 43.807% with the key unset
12
+ * (145 ÷ 331) and 77.957% with it `false` (145 ÷ 186).
13
+ */
14
+ /** Chart types whose settings carry the percentage-calculation keys. */
15
+ export declare const PERCENTAGE_CHART_TYPES: readonly string[];
16
+ export interface PercentageSettings {
17
+ showAsPercentage?: unknown;
18
+ numeratorQueryName?: unknown;
19
+ includeNumeratorInTotal?: unknown;
20
+ invertPercentage?: unknown;
21
+ }
22
+ /**
23
+ * The percentage block this widget's renderer will actually read, when percentage mode is on.
24
+ *
25
+ * Keyed on the widget's own chart type, not scanned across all of them: the renderer reads
26
+ * `settings[type]`, so `settings.number.showAsPercentage` on a `bar` widget is dead configuration
27
+ * and blocking a legitimate bar chart over it would be a lint causing the failure it exists to stop.
28
+ */
29
+ export declare function percentageSettings(chartType: string | undefined, settings: unknown): PercentageSettings | null;
30
+ /**
31
+ * The query names the numerator resolves to, in the widget's query order.
32
+ *
33
+ * Exact match first, so a query name that itself contains a comma is never split; only a value
34
+ * matching no query is split on commas, and parts naming no query are dropped.
35
+ */
36
+ export declare function resolveNumerators(stored: unknown, queryNames: string[]): string[];
37
+ /** Parts of `numeratorQueryName` that name no query — dropped silently by the renderer. */
38
+ export declare function unmatchedNumerators(stored: unknown, queryNames: string[]): string[];
39
+ /** Sum of the `value` column across one query's rows, as the number widget sums it. */
40
+ export declare function sumValueColumn(rows: unknown[]): number;
41
+ export interface QuerySum {
42
+ name: string;
43
+ sum: number;
44
+ }
45
+ export interface RenderedPercentage {
46
+ numerator: number;
47
+ total: number;
48
+ /** The percent the widget draws, before its own decimal rounding. */
49
+ value: number;
50
+ /** Whether the total counts the numerator queries too — the unset default. */
51
+ totalIncludesNumerator: boolean;
52
+ /** `invertPercentage`: the widget draws 100 minus the ratio of `numerator` to `total`. */
53
+ inverted: boolean;
54
+ }
55
+ /**
56
+ * The figure a percentage number widget draws from these per-query sums.
57
+ *
58
+ * Null when no numerator resolves: the renderer then draws the plain sum of every query with a `%`
59
+ * sign, which is not a ratio of anything. A zero total draws 0, and `invertPercentage` applies
60
+ * after that guard, so a zero total never draws 100.
61
+ */
62
+ export declare function renderedPercentage(settings: PercentageSettings, sums: QuerySum[]): RenderedPercentage | null;
63
+ //# sourceMappingURL=widget-percentage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-percentage.d.ts","sourceRoot":"","sources":["../../../src/server/tools/widget-percentage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,wEAAwE;AACxE,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAAuB,CAAC;AAE5E,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,QAAQ,EAAE,OAAO,GAChB,kBAAkB,GAAG,IAAI,CAO3B;AAUD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAKjF;AAED,2FAA2F;AAC3F,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAGnF;AAYD,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAKtD;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,sBAAsB,EAAE,OAAO,CAAC;IAChC,0FAA0F;IAC1F,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,kBAAkB,EAC5B,IAAI,EAAE,QAAQ,EAAE,GACf,kBAAkB,GAAG,IAAI,CA2B3B"}
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ /**
3
+ * Percentage mode as JupiterOne draws it, shared by the config lint and the post-write preflight.
4
+ *
5
+ * Mirrors web-app's number widget — `parseNumberWidgetSettings.ts`, `resolveNumeratorQueryNames.ts`
6
+ * and `computeNumberValue.ts` under `artifacts/app/src/views/insights/dashboards/components/widgets/
7
+ * number/utils/` — because this server taught the opposite of it from 2.2.0 to 2.6.1. An unset
8
+ * `includeNumeratorInTotal` is TRUE there: the denominator is every query, numerator included, and
9
+ * only an explicit `false` divides by the queries the numerator does not name. The UI stores the key
10
+ * only as `false`, so an unset key is also what a widget built with the box ticked looks like.
11
+ *
12
+ * Measured on j1dev, 2026-10-29: 145 encrypted of 186 S3 buckets drew 43.807% with the key unset
13
+ * (145 ÷ 331) and 77.957% with it `false` (145 ÷ 186).
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.PERCENTAGE_CHART_TYPES = void 0;
17
+ exports.percentageSettings = percentageSettings;
18
+ exports.resolveNumerators = resolveNumerators;
19
+ exports.unmatchedNumerators = unmatchedNumerators;
20
+ exports.sumValueColumn = sumValueColumn;
21
+ exports.renderedPercentage = renderedPercentage;
22
+ /** Chart types whose settings carry the percentage-calculation keys. */
23
+ exports.PERCENTAGE_CHART_TYPES = ['number', 'line'];
24
+ /**
25
+ * The percentage block this widget's renderer will actually read, when percentage mode is on.
26
+ *
27
+ * Keyed on the widget's own chart type, not scanned across all of them: the renderer reads
28
+ * `settings[type]`, so `settings.number.showAsPercentage` on a `bar` widget is dead configuration
29
+ * and blocking a legitimate bar chart over it would be a lint causing the failure it exists to stop.
30
+ */
31
+ function percentageSettings(chartType, settings) {
32
+ if (!chartType || !exports.PERCENTAGE_CHART_TYPES.includes(chartType))
33
+ return null;
34
+ if (!settings || typeof settings !== 'object')
35
+ return null;
36
+ const perChart = settings[chartType];
37
+ if (!perChart || typeof perChart !== 'object')
38
+ return null;
39
+ const percentage = perChart;
40
+ return percentage.showAsPercentage === true ? percentage : null;
41
+ }
42
+ /** SEVERAL numerator queries are comma-joined into the single `numeratorQueryName` string. */
43
+ function numeratorParts(stored) {
44
+ return stored
45
+ .split(',')
46
+ .map((name) => name.trim())
47
+ .filter((name) => name !== '');
48
+ }
49
+ /**
50
+ * The query names the numerator resolves to, in the widget's query order.
51
+ *
52
+ * Exact match first, so a query name that itself contains a comma is never split; only a value
53
+ * matching no query is split on commas, and parts naming no query are dropped.
54
+ */
55
+ function resolveNumerators(stored, queryNames) {
56
+ if (typeof stored !== 'string' || stored === '')
57
+ return [];
58
+ if (queryNames.includes(stored))
59
+ return [stored];
60
+ const selected = new Set(numeratorParts(stored).filter((name) => queryNames.includes(name)));
61
+ return queryNames.filter((name) => selected.has(name));
62
+ }
63
+ /** Parts of `numeratorQueryName` that name no query — dropped silently by the renderer. */
64
+ function unmatchedNumerators(stored, queryNames) {
65
+ if (typeof stored !== 'string' || stored === '' || queryNames.includes(stored))
66
+ return [];
67
+ return numeratorParts(stored).filter((name) => !queryNames.includes(name));
68
+ }
69
+ /** The renderer's cell reading: finite numbers and numeric strings count, anything else is 0. */
70
+ function cellNumber(value) {
71
+ if (typeof value === 'number' && Number.isFinite(value))
72
+ return value;
73
+ if (typeof value === 'string' && value !== '') {
74
+ const parsed = Number(value);
75
+ return Number.isFinite(parsed) ? parsed : 0;
76
+ }
77
+ return 0;
78
+ }
79
+ /** Sum of the `value` column across one query's rows, as the number widget sums it. */
80
+ function sumValueColumn(rows) {
81
+ return rows.reduce((total, row) => total + cellNumber(row?.value), 0);
82
+ }
83
+ /**
84
+ * The figure a percentage number widget draws from these per-query sums.
85
+ *
86
+ * Null when no numerator resolves: the renderer then draws the plain sum of every query with a `%`
87
+ * sign, which is not a ratio of anything. A zero total draws 0, and `invertPercentage` applies
88
+ * after that guard, so a zero total never draws 100.
89
+ */
90
+ function renderedPercentage(settings, sums) {
91
+ const names = resolveNumerators(settings.numeratorQueryName, sums.map((entry) => entry.name));
92
+ if (names.length === 0)
93
+ return null;
94
+ const numeratorSums = names
95
+ .map((name) => sums.find((entry) => entry.name === name))
96
+ .filter((entry) => entry !== undefined);
97
+ const numeratorNames = new Set(names);
98
+ const numerator = numeratorSums.reduce((total, entry) => total + entry.sum, 0);
99
+ const totalIncludesNumerator = settings.includeNumeratorInTotal !== false;
100
+ const total = sums
101
+ .filter((entry) => totalIncludesNumerator || !numeratorNames.has(entry.name))
102
+ .reduce((sum, entry) => sum + entry.sum, 0);
103
+ const inverted = settings.invertPercentage === true;
104
+ if (total === 0)
105
+ return { numerator, total, value: 0, totalIncludesNumerator, inverted };
106
+ const ratio = (numerator / total) * 100;
107
+ return {
108
+ numerator,
109
+ total,
110
+ value: inverted ? 100 - ratio : ratio,
111
+ totalIncludesNumerator,
112
+ inverted,
113
+ };
114
+ }
115
+ //# sourceMappingURL=widget-percentage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-percentage.js","sourceRoot":"","sources":["../../../src/server/tools/widget-percentage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAmBH,gDAUC;AAgBD,8CAKC;AAGD,kDAGC;AAaD,wCAKC;AAyBD,gDA8BC;AA/HD,wEAAwE;AAC3D,QAAA,sBAAsB,GAAsB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAS5E;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAChC,SAA6B,EAC7B,QAAiB;IAEjB,IAAI,CAAC,SAAS,IAAI,CAAC,8BAAsB,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3E,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3D,MAAM,QAAQ,GAAI,QAAo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AAC,IAAI,KAAK,IAAI,CAAC,CAAC;SACxD,MAAM,CAAC,CAAC,KAAK,EAAqB,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;IAC7D,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC/E,MAAM,sBAAsB,GAAG,QAAQ,CAAC,uBAAuB,KAAK,KAAK,CAAC;IAC1E,MAAM,KAAK,GAAG,IAAI;SACf,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,sBAAsB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAC5E,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAE9C,MAAM,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,KAAK,IAAI,CAAC;IACpD,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,sBAAsB,EAAE,QAAQ,EAAE,CAAC;IACzF,MAAM,KAAK,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC;IACxC,OAAO;QACL,SAAS;QACT,KAAK;QACL,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK;QACrC,sBAAsB;QACtB,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import type { JupiterOneClient } from '../../client/jupiterone-client.js';
2
2
  import type { Query } from '../../types/jupiterone.js';
3
3
  import { type LiteralDiagnosis } from './value-probe.js';
4
+ import { type RenderedPercentage } from './widget-percentage.js';
4
5
  /**
5
6
  * What a widget will actually draw, reported alongside the created widget.
6
7
  *
@@ -49,6 +50,12 @@ export interface WidgetRenderPreflight {
49
50
  * rest. Present only when a literal has something to say.
50
51
  */
51
52
  diagnosis?: LiteralDiagnosis[];
53
+ /**
54
+ * The figure a percentage `number` widget draws from the rows just returned, computed the way
55
+ * the renderer computes it. Two settings draw different numbers from the same queries, so the
56
+ * caller checks this against the figure it meant before calling the widget right.
57
+ */
58
+ percentage?: RenderedPercentage;
52
59
  /** One sentence for the caller to act on or relay. */
53
60
  note?: string;
54
61
  }
@@ -59,5 +66,5 @@ export interface WidgetRenderPreflight {
59
66
  * created, so advisory work must never turn a successful create into a failure. A skipped preflight
60
67
  * says so rather than claiming the widget is fine.
61
68
  */
62
- export declare function runRenderPreflight(client: JupiterOneClient, chartType: string | undefined, queries: Query[] | undefined, noResultMessage: string | undefined): Promise<WidgetRenderPreflight>;
69
+ export declare function runRenderPreflight(client: JupiterOneClient, chartType: string | undefined, queries: Query[] | undefined, noResultMessage: string | undefined, settings?: unknown): Promise<WidgetRenderPreflight>;
63
70
  //# sourceMappingURL=widget-preflight.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"widget-preflight.d.ts","sourceRoot":"","sources":["../../../src/server/tools/widget-preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAOvD,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAwB1B;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;;;;;O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;IACxB,6FAA6F;IAC7F,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B;;;;OAIG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAsJD;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,OAAO,EAAE,KAAK,EAAE,GAAG,SAAS,EAC5B,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,QAAQ,CAAC,EAAE,OAAO,GACjB,OAAO,CAAC,qBAAqB,CAAC,CA6HhC"}
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runRenderPreflight = runRenderPreflight;
4
+ const dashboard_variables_js_1 = require("../../utils/dashboard-variables.js");
4
5
  const widget_render_contract_js_1 = require("./widget-render-contract.js");
5
6
  const value_probe_js_1 = require("./value-probe.js");
7
+ const widget_percentage_js_1 = require("./widget-percentage.js");
6
8
  /**
7
9
  * Poll budget for a preflight query, in attempts × 1s. Deliberately far below the executor's
8
10
  * `DEFAULT_MAX_POLL_ATTEMPTS` (45, sized against the remote's 55s request deadline): this is
@@ -73,6 +75,20 @@ function rendersOnlyZero(chartType, rows) {
73
75
  return false;
74
76
  return rows.every((row) => measures.every((column) => row?.[column] === 0));
75
77
  }
78
+ /**
79
+ * What a percentage number widget draws, said plainly: the only check the agent can make against
80
+ * the figure it meant. Line percentages are bucketed by `x`, so they get no single figure.
81
+ */
82
+ function percentageNote(percentage) {
83
+ const ratio = `${percentage.numerator} ÷ ${percentage.total}`;
84
+ // Inverted, the figure is the complement: printing it beside the operands alone would read as
85
+ // their ratio, the confidently wrong number this note exists to prevent.
86
+ const operands = percentage.inverted ? `100 − ${ratio}` : ratio;
87
+ const total = percentage.totalIncludesNumerator
88
+ ? ', the total counting the numerator queries too'
89
+ : '';
90
+ return `This widget draws ${percentage.value.toFixed(1)}% (${operands}${total}).`;
91
+ }
76
92
  /** The result rows, when the envelope carries an array of them. */
77
93
  function resultRows(result) {
78
94
  const data = result?.data;
@@ -137,7 +153,7 @@ function buildNote(rowsReturned, noResultMessage, missingRecommended, diagnosis,
137
153
  * created, so advisory work must never turn a successful create into a failure. A skipped preflight
138
154
  * says so rather than claiming the widget is fine.
139
155
  */
140
- async function runRenderPreflight(client, chartType, queries, noResultMessage) {
156
+ async function runRenderPreflight(client, chartType, queries, noResultMessage, settings) {
141
157
  const startedAt = Date.now();
142
158
  const skip = (reason) => ({
143
159
  status: 'skipped',
@@ -149,14 +165,18 @@ async function runRenderPreflight(client, chartType, queries, noResultMessage) {
149
165
  const runnable = (queries ?? []).filter((queryObj) => queryObj?.query);
150
166
  if (runnable.length === 0)
151
167
  return skip('no-queries');
152
- // Substituted at render time from the dashboard's parameters, so the stored form proves nothing.
153
- if (runnable.some((queryObj) => queryObj.query.includes('{{')))
168
+ // Substituted at render time from the dashboard's parameters, so the stored form proves nothing,
169
+ // and run without them the backend refuses it (`Variable "x" was not provided`).
170
+ if (runnable.some((queryObj) => (0, dashboard_variables_js_1.hasDashboardVariable)(queryObj.query))) {
154
171
  return skip('parameterized');
172
+ }
155
173
  // Rows are SUMMED, not minimised. A multi-query widget draws one series per query, so it renders
156
174
  // as long as any query returns something — several live j1dev boards pair a populated series with
157
175
  // an empty one deliberately. Taking the minimum called those widgets blank.
158
176
  let rowsReturned = 0;
159
177
  const allRows = [];
178
+ // Kept per query because a percentage divides one query's sum by others'; `allRows` loses that.
179
+ const querySums = [];
160
180
  try {
161
181
  for (const [index, queryObj] of runnable.entries()) {
162
182
  const elapsed = Date.now() - startedAt;
@@ -171,7 +191,9 @@ async function runRenderPreflight(client, chartType, queries, noResultMessage) {
171
191
  const rows = rowCount(result);
172
192
  if (rows === null)
173
193
  return skip('no-result-payload');
174
- allRows.push(...resultRows(result));
194
+ const queryRows = resultRows(result);
195
+ allRows.push(...queryRows);
196
+ querySums.push({ name: queryObj.name, sum: (0, widget_percentage_js_1.sumValueColumn)(queryRows) });
175
197
  rowsReturned += rows;
176
198
  }
177
199
  }
@@ -223,6 +245,14 @@ async function runRenderPreflight(client, chartType, queries, noResultMessage) {
223
245
  diagnosis.push(split);
224
246
  }
225
247
  const emptyColumns = emptyRequiredColumns(chartType, allRows);
248
+ const percentageMode = chartType === 'number' ? (0, widget_percentage_js_1.percentageSettings)(chartType, settings) : null;
249
+ const percentage = percentageMode ? (0, widget_percentage_js_1.renderedPercentage)(percentageMode, querySums) : null;
250
+ const note = [
251
+ percentage ? percentageNote(percentage) : undefined,
252
+ buildNote(rowsReturned, noResultMessage, missingRecommended, diagnosis, emptyColumns),
253
+ ]
254
+ .filter((part) => part !== undefined)
255
+ .join(' ');
226
256
  return {
227
257
  status: 'probed',
228
258
  rowsReturned,
@@ -232,7 +262,8 @@ async function runRenderPreflight(client, chartType, queries, noResultMessage) {
232
262
  ...(emptyColumns.length > 0 ? { emptyColumns } : {}),
233
263
  ...(missingRecommended.length > 0 ? { missingRecommended } : {}),
234
264
  ...(diagnosis.length > 0 ? { diagnosis } : {}),
235
- note: buildNote(rowsReturned, noResultMessage, missingRecommended, diagnosis, emptyColumns),
265
+ ...(percentage ? { percentage } : {}),
266
+ ...(note ? { note } : {}),
236
267
  };
237
268
  }
238
269
  //# sourceMappingURL=widget-preflight.js.map