@jupiterone/jupiterone-mcp 2.7.0 → 2.8.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/README.md +6 -4
- package/dist/client/graphql/mutations.d.ts +1 -0
- package/dist/client/graphql/mutations.d.ts.map +1 -1
- package/dist/client/graphql/mutations.js +18 -1
- package/dist/client/graphql/mutations.js.map +1 -1
- package/dist/client/graphql/queries.d.ts +1 -1
- package/dist/client/graphql/queries.d.ts.map +1 -1
- package/dist/client/graphql/queries.js +8 -0
- package/dist/client/graphql/queries.js.map +1 -1
- package/dist/client/jupiterone-client.d.ts +1 -0
- package/dist/client/jupiterone-client.d.ts.map +1 -1
- package/dist/client/jupiterone-client.js +3 -0
- package/dist/client/jupiterone-client.js.map +1 -1
- package/dist/client/services/rule-service.d.ts +11 -1
- package/dist/client/services/rule-service.d.ts.map +1 -1
- package/dist/client/services/rule-service.js +17 -0
- package/dist/client/services/rule-service.js.map +1 -1
- package/dist/generated/description-map.d.ts.map +1 -1
- package/dist/generated/description-map.js +152 -12
- package/dist/generated/description-map.js.map +1 -1
- package/dist/server/mcp-server.js +1 -1
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/tools/reference.d.ts +1 -1
- package/dist/server/tools/reference.d.ts.map +1 -1
- package/dist/server/tools/reference.js +1 -0
- package/dist/server/tools/reference.js.map +1 -1
- package/dist/server/tools/rule-preview-checks.d.ts +95 -0
- package/dist/server/tools/rule-preview-checks.d.ts.map +1 -0
- package/dist/server/tools/rule-preview-checks.js +380 -0
- package/dist/server/tools/rule-preview-checks.js.map +1 -0
- package/dist/server/tools/rule-preview.d.ts +105 -0
- package/dist/server/tools/rule-preview.d.ts.map +1 -0
- package/dist/server/tools/rule-preview.js +507 -0
- package/dist/server/tools/rule-preview.js.map +1 -0
- package/dist/server/tools/rules.d.ts +1 -1
- package/dist/server/tools/rules.d.ts.map +1 -1
- package/dist/server/tools/rules.js +245 -30
- package/dist/server/tools/rules.js.map +1 -1
- package/dist/server/tools/usage.d.ts +1 -1
- package/dist/server/tools/usage.d.ts.map +1 -1
- package/dist/server/tools/usage.js +46 -1
- package/dist/server/tools/usage.js.map +1 -1
- package/dist/server/tools/value-probe.d.ts.map +1 -1
- package/dist/server/tools/value-probe.js +33 -9
- package/dist/server/tools/value-probe.js.map +1 -1
- package/dist/types/jupiterone.d.ts +34 -5
- package/dist/types/jupiterone.d.ts.map +1 -1
- package/node_modules/dtrace-provider/build/Makefile +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { JupiterOneClient } from '../../client/jupiterone-client.js';
|
|
2
|
+
import type { Action, RuleActionQueryData } from '../../types/jupiterone.js';
|
|
3
|
+
import { type PreviewWarning, type SlackEnvelope, type UndefinedRead } from './rule-preview-checks.js';
|
|
4
|
+
import type { ToolResult } from './types.js';
|
|
5
|
+
/** Rows kept per query: the rules editor's sample size (web-app `MAX_SAMPLE_RESULTS`). */
|
|
6
|
+
export declare const PREVIEW_SAMPLE_ROWS = 10;
|
|
7
|
+
/**
|
|
8
|
+
* How long the rule's queries may run, measured from request start. The remote aborts at 55 s; a
|
|
9
|
+
* render took under half a second on j1dev (2026-10-30), so the renders get what is left. The poll
|
|
10
|
+
* count alone does not bound the wait (each poll's fetch adds to its 1 s sleep), so the sample is
|
|
11
|
+
* also raced against this deadline.
|
|
12
|
+
*/
|
|
13
|
+
export declare const PREVIEW_SAMPLE_BUDGET_MS = 35000;
|
|
14
|
+
/** How long reading a saved rule may take, from request start, before nothing is previewed. */
|
|
15
|
+
export declare const PREVIEW_LOOKUP_BUDGET_MS = 20000;
|
|
16
|
+
/**
|
|
17
|
+
* When the renders must be done, from request start: before the remote's 55 s abort, which would
|
|
18
|
+
* discard every action that did render. A render still running then is reported as failed.
|
|
19
|
+
*/
|
|
20
|
+
export declare const PREVIEW_RENDER_BUDGET_MS = 50000;
|
|
21
|
+
/**
|
|
22
|
+
* The action types rule-service defines (`ActionType`, src/services/actions/types.ts). Telemetry
|
|
23
|
+
* counts a draft's other `type` strings as `other`: a draft may carry any text there.
|
|
24
|
+
*/
|
|
25
|
+
export declare const KNOWN_ACTION_TYPES: ReadonlySet<string>;
|
|
26
|
+
/** A rule query. rule-service does not require a name, and reads a nameless one back as null. */
|
|
27
|
+
export interface PreviewQuery {
|
|
28
|
+
name: string | null;
|
|
29
|
+
query: string;
|
|
30
|
+
includeDeleted?: boolean | null;
|
|
31
|
+
}
|
|
32
|
+
export interface PreviewRule {
|
|
33
|
+
ruleId?: string;
|
|
34
|
+
/** For the Slack envelope; undefined when a draft does not give it. */
|
|
35
|
+
name?: string;
|
|
36
|
+
description?: string | null;
|
|
37
|
+
queries: PreviewQuery[];
|
|
38
|
+
operations: {
|
|
39
|
+
actions?: Action[] | null;
|
|
40
|
+
}[];
|
|
41
|
+
templates: Record<string, string>;
|
|
42
|
+
/** Rows to render against in place of a query's results, by query name; the query is not run. */
|
|
43
|
+
fixtures?: Record<string, unknown[]>;
|
|
44
|
+
/** How many sampled rows each FOR_EACH_ITEM's nested actions render for. */
|
|
45
|
+
loopRows?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface QuerySample {
|
|
48
|
+
name: string | null;
|
|
49
|
+
status: 'ok' | 'empty' | 'failed' | 'timed_out';
|
|
50
|
+
total: number | null;
|
|
51
|
+
sampledRows: number;
|
|
52
|
+
/** `total` is the query engine's estimate: 30000 for `FIND User`'s 42110 rows on j1dev. */
|
|
53
|
+
estimate?: boolean;
|
|
54
|
+
/** The rows came from the caller's `fixtures`, not the query. */
|
|
55
|
+
fixture?: boolean;
|
|
56
|
+
error?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface ActionPreview {
|
|
59
|
+
path: string;
|
|
60
|
+
type: string | null;
|
|
61
|
+
status: 'rendered' | 'render_failed' | 'loop' | 'not_run' | 'skipped' | 'not_previewable';
|
|
62
|
+
rendered?: Action;
|
|
63
|
+
messages?: string[];
|
|
64
|
+
unresolvedPaths?: string[];
|
|
65
|
+
undefinedReads?: UndefinedRead[];
|
|
66
|
+
warnings?: PreviewWarning[];
|
|
67
|
+
envelope?: SlackEnvelope;
|
|
68
|
+
error?: string;
|
|
69
|
+
iterations?: number | null;
|
|
70
|
+
estimate?: boolean;
|
|
71
|
+
itemRef?: string;
|
|
72
|
+
itemBound?: boolean;
|
|
73
|
+
/** Which sampled row a nested loop action rendered for. */
|
|
74
|
+
row?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Sample every query in parallel and build the `queries` render context from the results. A query
|
|
78
|
+
* with fixture rows is not run: a field test pulled other employees' records into the transcript
|
|
79
|
+
* to reach a branch, and an account where no entity reaches one cannot test it at all.
|
|
80
|
+
*/
|
|
81
|
+
export declare function sampleRuleQueries(client: JupiterOneClient, queries: PreviewQuery[], deadlineAt: number, fixtures?: Record<string, unknown[]>): Promise<{
|
|
82
|
+
samples: QuerySample[];
|
|
83
|
+
queryData: RuleActionQueryData;
|
|
84
|
+
}>;
|
|
85
|
+
/**
|
|
86
|
+
* The fields of `source` whose template rendered to nothing. rule-service reports expression
|
|
87
|
+
* errors in `messages`, but a reference to a missing path renders the text `undefined` (or drops
|
|
88
|
+
* a whole-field value) and says nothing (j1dev, 2026-10-30).
|
|
89
|
+
*/
|
|
90
|
+
export declare function unresolvedPaths(source: unknown, rendered: unknown, path?: string, skip?: (template: string) => boolean): string[];
|
|
91
|
+
/** Render every action of every operation, in rule order. */
|
|
92
|
+
export declare function renderRuleActions(client: JupiterOneClient, rule: PreviewRule, queryData: RuleActionQueryData, samples: QuerySample[], renderDeadlineAt: number): Promise<ActionPreview[]>;
|
|
93
|
+
/**
|
|
94
|
+
* An isError result whose first block is fixed text and counts, and whose second carries the names
|
|
95
|
+
* the caller chose. The chokepoint copies the first block into telemetry as `errorMessage`, so query
|
|
96
|
+
* names, fixture keys and the errors that quote them go in the second, which the agent still reads
|
|
97
|
+
* (PR #61 review).
|
|
98
|
+
*/
|
|
99
|
+
export declare function refusalWithDetail(lead: string, detail: string, structuredContent: Record<string, unknown>): ToolResult;
|
|
100
|
+
/**
|
|
101
|
+
* Preview a rule's actions: sample its queries, then render each action against the sample.
|
|
102
|
+
* Both steps are bounded from `startedAt`, the request's start.
|
|
103
|
+
*/
|
|
104
|
+
export declare function previewRule(client: JupiterOneClient, rule: PreviewRule, startedAt: number): Promise<ToolResult>;
|
|
105
|
+
//# sourceMappingURL=rule-preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-preview.d.ts","sourceRoot":"","sources":["../../../src/server/tools/rule-preview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAG1E,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAG7E,OAAO,EAKL,KAAK,cAAc,EAEnB,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C,+FAA+F;AAC/F,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C;;;GAGG;AACH,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAwB/C;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAqBjD,CAAC;AAEH,iGAAiG;AACjG,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,C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1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KNOWN_ACTION_TYPES = exports.PREVIEW_RENDER_BUDGET_MS = exports.PREVIEW_LOOKUP_BUDGET_MS = exports.PREVIEW_SAMPLE_BUDGET_MS = exports.PREVIEW_SAMPLE_ROWS = void 0;
|
|
4
|
+
exports.sampleRuleQueries = sampleRuleQueries;
|
|
5
|
+
exports.unresolvedPaths = unresolvedPaths;
|
|
6
|
+
exports.renderRuleActions = renderRuleActions;
|
|
7
|
+
exports.refusalWithDetail = refusalWithDetail;
|
|
8
|
+
exports.previewRule = previewRule;
|
|
9
|
+
const j1ql_service_js_1 = require("../../client/services/j1ql-service.js");
|
|
10
|
+
const sanitize_error_js_1 = require("../../client/sanitize-error.js");
|
|
11
|
+
const shared_js_1 = require("./compliance/shared.js");
|
|
12
|
+
const errors_js_1 = require("./errors.js");
|
|
13
|
+
const rule_preview_checks_js_1 = require("./rule-preview-checks.js");
|
|
14
|
+
const result_js_1 = require("./result.js");
|
|
15
|
+
/** Rows kept per query: the rules editor's sample size (web-app `MAX_SAMPLE_RESULTS`). */
|
|
16
|
+
exports.PREVIEW_SAMPLE_ROWS = 10;
|
|
17
|
+
/**
|
|
18
|
+
* How long the rule's queries may run, measured from request start. The remote aborts at 55 s; a
|
|
19
|
+
* render took under half a second on j1dev (2026-10-30), so the renders get what is left. The poll
|
|
20
|
+
* count alone does not bound the wait (each poll's fetch adds to its 1 s sleep), so the sample is
|
|
21
|
+
* also raced against this deadline.
|
|
22
|
+
*/
|
|
23
|
+
exports.PREVIEW_SAMPLE_BUDGET_MS = 35_000;
|
|
24
|
+
/** How long reading a saved rule may take, from request start, before nothing is previewed. */
|
|
25
|
+
exports.PREVIEW_LOOKUP_BUDGET_MS = 20_000;
|
|
26
|
+
/**
|
|
27
|
+
* When the renders must be done, from request start: before the remote's 55 s abort, which would
|
|
28
|
+
* discard every action that did render. A render still running then is reported as failed.
|
|
29
|
+
*/
|
|
30
|
+
exports.PREVIEW_RENDER_BUDGET_MS = 50_000;
|
|
31
|
+
/**
|
|
32
|
+
* Action types rule-service will not render. It throws a bare Error for them, which the gateway
|
|
33
|
+
* masks as "Internal server error" (j1dev, 2026-10-30), so they are never sent.
|
|
34
|
+
*/
|
|
35
|
+
const UNRENDERABLE_TYPES = new Set(['JUPITERONE_QUERY', 'FOR_EACH_ITEM']);
|
|
36
|
+
/**
|
|
37
|
+
* A loop over one query's rows, the form the rules editor offers for `items`: `queries.<name>`
|
|
38
|
+
* with a plain name, or bracketed (`queries['open-findings']`) for any other.
|
|
39
|
+
*/
|
|
40
|
+
const LOOP_OVER_QUERY = /^\s*\{\{\s*queries(?:\.(\w+)|\[\s*'([^']+)'\s*\]|\[\s*"([^"]+)"\s*\])\.data\s*\}\}\s*$/;
|
|
41
|
+
/**
|
|
42
|
+
* `queries.open-findings.data`: JEXL reads the `-` as subtraction, so `items` is not a list and the
|
|
43
|
+
* loop fails when the rule runs, though the name looks like a query's (PR #61 review).
|
|
44
|
+
*/
|
|
45
|
+
const LOOP_OVER_HYPHENATED = /^\s*\{\{\s*queries\.(\w+(?:-\w+)+)\.data\s*\}\}\s*$/;
|
|
46
|
+
/** rule-service's refusal of a preview to a caller without rule create or update permission. */
|
|
47
|
+
const PREVIEW_PERMISSION_REFUSAL = /cannot preview actions/;
|
|
48
|
+
/**
|
|
49
|
+
* The action types rule-service defines (`ActionType`, src/services/actions/types.ts). Telemetry
|
|
50
|
+
* counts a draft's other `type` strings as `other`: a draft may carry any text there.
|
|
51
|
+
*/
|
|
52
|
+
exports.KNOWN_ACTION_TYPES = new Set([
|
|
53
|
+
'ADD_AWS_RESOURCE_TAGS',
|
|
54
|
+
'ADD_S3_BUCKET_TAG',
|
|
55
|
+
'CREATE_ALERT',
|
|
56
|
+
'CREATE_JIRA_TICKET',
|
|
57
|
+
'CREATE_SERVICE_NOW_INCIDENT',
|
|
58
|
+
'FOR_EACH_ITEM',
|
|
59
|
+
'GOOGLE_BIGQUERY_TABLE',
|
|
60
|
+
'JUPITERONE_QUERY',
|
|
61
|
+
'PUBLISH_SNS_MESSAGE',
|
|
62
|
+
'SEND_EMAIL',
|
|
63
|
+
'SEND_SLACK_MESSAGE',
|
|
64
|
+
'SEND_SQS_MESSAGE',
|
|
65
|
+
'REFLEX_SEND_SQS_MESSAGE',
|
|
66
|
+
'SEND_TO_S3',
|
|
67
|
+
'SET_PROPERTY',
|
|
68
|
+
'TAG_ENTITIES',
|
|
69
|
+
'TINES_WEBHOOK',
|
|
70
|
+
'WEBHOOK',
|
|
71
|
+
'CUMULATIVE_ALERTS_EMAIL_REPORT',
|
|
72
|
+
'DAILY_ALERT_EMAIL_REPORT',
|
|
73
|
+
]);
|
|
74
|
+
/**
|
|
75
|
+
* Run one query and keep its first rows, as the rules editor does. An access denial is rethrown
|
|
76
|
+
* so the chokepoint frames it; any other failure is reported against the query. A query still
|
|
77
|
+
* running at the deadline is reported as timed out; it keeps running server-side.
|
|
78
|
+
*/
|
|
79
|
+
async function sampleQuery(client, query, deadlineAt) {
|
|
80
|
+
const settled = await (0, shared_js_1.withDeadline)(runSample(client, query, deadlineAt), deadlineAt);
|
|
81
|
+
if (settled !== shared_js_1.DEADLINE_PASSED)
|
|
82
|
+
return settled;
|
|
83
|
+
return {
|
|
84
|
+
sample: { name: query.name, status: 'timed_out', total: null, sampledRows: 0 },
|
|
85
|
+
data: [],
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
async function runSample(client, query, deadlineAt) {
|
|
89
|
+
const empty = { name: query.name, total: null, sampledRows: 0 };
|
|
90
|
+
try {
|
|
91
|
+
const result = await client.executeJ1qlQuery({
|
|
92
|
+
query: query.query,
|
|
93
|
+
flags: query.includeDeleted ? { includeDeleted: true } : undefined,
|
|
94
|
+
maxPollAttempts: Math.max(1, Math.floor((deadlineAt - Date.now()) / 1000)),
|
|
95
|
+
});
|
|
96
|
+
const rows = result?.data;
|
|
97
|
+
if (rows === undefined) {
|
|
98
|
+
throw new Error('Invalid response structure from JupiterOne API: the query returned no data');
|
|
99
|
+
}
|
|
100
|
+
const data = Array.isArray(rows) ? rows.slice(0, exports.PREVIEW_SAMPLE_ROWS) : (rows ?? []);
|
|
101
|
+
const totalCount = result.totalCount;
|
|
102
|
+
const total = typeof totalCount === 'number' ? totalCount : Array.isArray(rows) ? rows.length : null;
|
|
103
|
+
const sampledRows = Array.isArray(data) ? data.length : 0;
|
|
104
|
+
const estimate = result.estimate === true;
|
|
105
|
+
const status = total === 0 ? 'empty' : 'ok';
|
|
106
|
+
return {
|
|
107
|
+
sample: { name: query.name, status, total, sampledRows, ...(estimate ? { estimate } : {}) },
|
|
108
|
+
data,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
if ((0, errors_js_1.accessDeniedStatus)(error) !== null)
|
|
113
|
+
throw error;
|
|
114
|
+
if (error instanceof j1ql_service_js_1.J1qlQueryTimeoutError) {
|
|
115
|
+
return { sample: { ...empty, status: 'timed_out' }, data: [] };
|
|
116
|
+
}
|
|
117
|
+
const message = (0, sanitize_error_js_1.sanitizeGraphQLError)(error).message;
|
|
118
|
+
return { sample: { ...empty, status: 'failed', error: message }, data: [] };
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/** A query answered from the caller's fixture rows: nothing runs, and every row is kept. */
|
|
122
|
+
function fixtureSample(name, rows) {
|
|
123
|
+
const total = rows.length;
|
|
124
|
+
const status = total === 0 ? 'empty' : 'ok';
|
|
125
|
+
return { sample: { name, status, total, sampledRows: total, fixture: true }, data: rows };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Sample every query in parallel and build the `queries` render context from the results. A query
|
|
129
|
+
* with fixture rows is not run: a field test pulled other employees' records into the transcript
|
|
130
|
+
* to reach a branch, and an account where no entity reaches one cannot test it at all.
|
|
131
|
+
*/
|
|
132
|
+
async function sampleRuleQueries(client, queries, deadlineAt, fixtures = {}) {
|
|
133
|
+
const sampled = await Promise.all(queries.map((query) => {
|
|
134
|
+
// An own key only: `constructor` or `toString` would otherwise find Object's own members.
|
|
135
|
+
const name = String(query.name);
|
|
136
|
+
return Object.hasOwn(fixtures, name)
|
|
137
|
+
? fixtureSample(query.name, fixtures[name])
|
|
138
|
+
: sampleQuery(client, query, deadlineAt);
|
|
139
|
+
}));
|
|
140
|
+
// No prototype: a query named `__proto__` must stay a key, or JSON drops its data.
|
|
141
|
+
const queryData = {
|
|
142
|
+
queries: Object.create(null),
|
|
143
|
+
};
|
|
144
|
+
for (const { sample, data } of sampled) {
|
|
145
|
+
// `total` is what a live evaluation reads; the editor sends `totalCount` alongside it.
|
|
146
|
+
// A nameless query is keyed "null", as `queries[name]` keys it in the live evaluator.
|
|
147
|
+
queryData.queries[String(sample.name)] = {
|
|
148
|
+
data,
|
|
149
|
+
total: sample.total,
|
|
150
|
+
totalCount: sample.total,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return { samples: sampled.map(({ sample }) => sample), queryData };
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The fields of `source` whose template rendered to nothing. rule-service reports expression
|
|
157
|
+
* errors in `messages`, but a reference to a missing path renders the text `undefined` (or drops
|
|
158
|
+
* a whole-field value) and says nothing (j1dev, 2026-10-30).
|
|
159
|
+
*/
|
|
160
|
+
function unresolvedPaths(source, rendered, path = '', skip) {
|
|
161
|
+
if (typeof source === 'string') {
|
|
162
|
+
if (!source.includes('{{') || skip?.(source))
|
|
163
|
+
return [];
|
|
164
|
+
const missing = rendered === undefined || rendered === null;
|
|
165
|
+
const printedUndefined = typeof rendered === 'string' &&
|
|
166
|
+
rendered.includes('undefined') &&
|
|
167
|
+
!source.includes('undefined');
|
|
168
|
+
return missing || printedUndefined ? [path] : [];
|
|
169
|
+
}
|
|
170
|
+
if (Array.isArray(source)) {
|
|
171
|
+
const target = Array.isArray(rendered) ? rendered : [];
|
|
172
|
+
return source.flatMap((entry, i) => unresolvedPaths(entry, target[i], `${path}[${i}]`, skip));
|
|
173
|
+
}
|
|
174
|
+
if (source !== null && typeof source === 'object') {
|
|
175
|
+
const target = (rendered !== null && typeof rendered === 'object' ? rendered : {});
|
|
176
|
+
return Object.entries(source).flatMap(([key, value]) => unresolvedPaths(value, target[key], path ? `${path}.${key}` : key, skip));
|
|
177
|
+
}
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Whether a template string reads a query a JUPITERONE_QUERY action adds at run time, which the
|
|
182
|
+
* preview has no data for (`queries.<name>` or `queries['<name>']`).
|
|
183
|
+
*/
|
|
184
|
+
function readsRuntimeQuery(names) {
|
|
185
|
+
if (names.size === 0)
|
|
186
|
+
return undefined;
|
|
187
|
+
const escaped = [...names].map((name) => name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
|
|
188
|
+
const pattern = new RegExp(`\\{\\{[^}]*queries(?:\\.(?:${escaped.join('|')})\\b|\\[\\s*['"](?:${escaped.join('|')})['"])`);
|
|
189
|
+
return (template) => pattern.test(template);
|
|
190
|
+
}
|
|
191
|
+
/** Whether a template string reads the loop variable `name`, e.g. `{{result.entity.name}}`. */
|
|
192
|
+
function readsVariable(name) {
|
|
193
|
+
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
194
|
+
const pattern = new RegExp(`\\{\\{[^}]*(?<![\\w.])${escaped}\\b`);
|
|
195
|
+
return (template) => pattern.test(template);
|
|
196
|
+
}
|
|
197
|
+
async function previewLeaf(client, action, path, context, loop) {
|
|
198
|
+
const base = { path, type: typeof action.type === 'string' ? action.type : null };
|
|
199
|
+
if (UNRENDERABLE_TYPES.has(action.type))
|
|
200
|
+
return { ...base, status: 'not_previewable' };
|
|
201
|
+
const bound = loop !== undefined && loop.item !== undefined;
|
|
202
|
+
const queryData = bound ? { ...context.queryData, [loop.itemRef]: loop.item } : context.queryData;
|
|
203
|
+
// With no row bound, the loop variable renders `undefined` in a template that is correct, as
|
|
204
|
+
// does a query only a JUPITERONE_QUERY action fills.
|
|
205
|
+
const skips = [
|
|
206
|
+
loop !== undefined && !bound ? readsVariable(loop.itemRef) : undefined,
|
|
207
|
+
readsRuntimeQuery(context.runtimeQueries),
|
|
208
|
+
].filter((check) => check !== undefined);
|
|
209
|
+
const skip = skips.length > 0 ? (template) => skips.some((check) => check(template)) : undefined;
|
|
210
|
+
try {
|
|
211
|
+
const settled = await (0, shared_js_1.withDeadline)(client.renderRuleAction({ action, queryData, templates: context.templates }), context.renderDeadlineAt);
|
|
212
|
+
if (settled === shared_js_1.DEADLINE_PASSED) {
|
|
213
|
+
return {
|
|
214
|
+
...base,
|
|
215
|
+
status: 'render_failed',
|
|
216
|
+
error: 'The render did not finish before the preview had to answer; preview again.',
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
const result = settled;
|
|
220
|
+
const reads = (0, rule_preview_checks_js_1.undefinedReads)(action, {
|
|
221
|
+
queryData: context.queryData,
|
|
222
|
+
templates: context.templates,
|
|
223
|
+
samples: context.samples,
|
|
224
|
+
runtimeQueries: context.runtimeQueries,
|
|
225
|
+
...(loop ? { loopRef: loop.itemRef } : {}),
|
|
226
|
+
...(bound ? { loop: { itemRef: loop.itemRef, item: loop.item } } : {}),
|
|
227
|
+
});
|
|
228
|
+
const loopWarning = loop ? (0, rule_preview_checks_js_1.loopTemplateWarning)(action, loop.itemRef) : null;
|
|
229
|
+
const slack = action.type === 'SEND_SLACK_MESSAGE' ? (0, rule_preview_checks_js_1.slackEnvelope)(result.action, context.identity) : null;
|
|
230
|
+
const warnings = [
|
|
231
|
+
...(0, rule_preview_checks_js_1.renderedActionWarnings)(action, result.action, result.messages),
|
|
232
|
+
...(slack?.warnings ?? []),
|
|
233
|
+
...(loopWarning ? [loopWarning] : []),
|
|
234
|
+
];
|
|
235
|
+
return {
|
|
236
|
+
...base,
|
|
237
|
+
status: 'rendered',
|
|
238
|
+
rendered: result.action,
|
|
239
|
+
...(slack ? { envelope: slack.envelope } : {}),
|
|
240
|
+
messages: result.messages,
|
|
241
|
+
unresolvedPaths: unresolvedPaths(action, result.action, '', skip),
|
|
242
|
+
...(reads.length > 0 ? { undefinedReads: reads } : {}),
|
|
243
|
+
...(warnings.length > 0 ? { warnings } : {}),
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
if ((0, errors_js_1.accessDeniedStatus)(error) !== null)
|
|
248
|
+
throw error;
|
|
249
|
+
const sanitized = (0, sanitize_error_js_1.sanitizeGraphQLError)(error);
|
|
250
|
+
// The refusal may not carry a FORBIDDEN code or match the access-denied text, and read as a
|
|
251
|
+
// template failure on every action; raise it as the permission denial it is.
|
|
252
|
+
if (PREVIEW_PERMISSION_REFUSAL.test(sanitized.message)) {
|
|
253
|
+
throw new sanitize_error_js_1.JupiterOneApiError(sanitized.message, sanitized.statusCode, 'FORBIDDEN');
|
|
254
|
+
}
|
|
255
|
+
return { ...base, status: 'render_failed', error: sanitized.message };
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* A FOR_EACH_ITEM and its nested actions. The live evaluator renders each nested action once per
|
|
260
|
+
* item with `{[itemRef ?? 'item']: row}` beside the query data (rule-service
|
|
261
|
+
* forEachItemAction), so each one renders here for the first sampled row. It never runs a
|
|
262
|
+
* nested CREATE_ALERT, and runs nothing when there are no items.
|
|
263
|
+
*/
|
|
264
|
+
/**
|
|
265
|
+
* What makes a loop impossible to preview, or null. The draft schema checks only top-level actions,
|
|
266
|
+
* so a loop's `itemRef` and nested `actions` arrive unchecked; a malformed one is reported against
|
|
267
|
+
* the loop instead of crashing the whole preview (PR #61 review).
|
|
268
|
+
*/
|
|
269
|
+
function loopDefect(loop) {
|
|
270
|
+
if (typeof loop.items !== 'string' && !Array.isArray(loop.items)) {
|
|
271
|
+
return ('`items` must be a template string naming the list to loop over, such as ' +
|
|
272
|
+
'`{{queries.query0.data}}`, or a list.');
|
|
273
|
+
}
|
|
274
|
+
const hyphenated = typeof loop.items === 'string' && LOOP_OVER_HYPHENATED.exec(loop.items)?.[1];
|
|
275
|
+
if (hyphenated) {
|
|
276
|
+
return (`\`items\` reads \`queries.${hyphenated}.data\`, which the template engine reads as a ` +
|
|
277
|
+
`subtraction, so the loop fails when the rule runs. Write \`{{queries['${hyphenated}'].data}}\`.`);
|
|
278
|
+
}
|
|
279
|
+
if (loop.itemRef != null && typeof loop.itemRef !== 'string') {
|
|
280
|
+
return '`itemRef` must be a string: the name the nested actions read each item by.';
|
|
281
|
+
}
|
|
282
|
+
if (loop.actions != null && !Array.isArray(loop.actions)) {
|
|
283
|
+
return '`actions` must be a list of the actions to run for each item.';
|
|
284
|
+
}
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
/** One nested action of a loop, for one bound row. */
|
|
288
|
+
function previewNested(client, action, nestedPath, context, loop) {
|
|
289
|
+
const { binding, row } = loop;
|
|
290
|
+
const marks = { itemRef: binding.itemRef, row };
|
|
291
|
+
if (action === null || typeof action !== 'object' || Array.isArray(action)) {
|
|
292
|
+
const error = "Not an action: each entry in a loop's `actions` is an object with a `type`.";
|
|
293
|
+
return Promise.resolve({
|
|
294
|
+
path: nestedPath,
|
|
295
|
+
type: null,
|
|
296
|
+
status: 'render_failed',
|
|
297
|
+
error,
|
|
298
|
+
...marks,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
const nested = action;
|
|
302
|
+
const type = typeof nested.type === 'string' ? nested.type : null;
|
|
303
|
+
if (nested.type === 'CREATE_ALERT') {
|
|
304
|
+
return Promise.resolve({ path: nestedPath, type, status: 'skipped', ...marks });
|
|
305
|
+
}
|
|
306
|
+
if (loop.iterations === 0) {
|
|
307
|
+
return Promise.resolve({ path: nestedPath, type, status: 'not_run', ...marks });
|
|
308
|
+
}
|
|
309
|
+
return previewLeaf(client, nested, nestedPath, context, binding).then((preview) => ({
|
|
310
|
+
...preview,
|
|
311
|
+
...marks,
|
|
312
|
+
itemBound: binding.item !== undefined,
|
|
313
|
+
}));
|
|
314
|
+
}
|
|
315
|
+
function previewLoop(client, loop, path, context) {
|
|
316
|
+
const defect = loopDefect(loop);
|
|
317
|
+
if (defect) {
|
|
318
|
+
return [
|
|
319
|
+
Promise.resolve({ path, type: 'FOR_EACH_ITEM', status: 'render_failed', error: defect }),
|
|
320
|
+
];
|
|
321
|
+
}
|
|
322
|
+
const itemRef = loop.itemRef ?? 'item';
|
|
323
|
+
const match = typeof loop.items === 'string' ? LOOP_OVER_QUERY.exec(loop.items) : null;
|
|
324
|
+
const named = match ? (match[1] ?? match[2] ?? match[3]) : undefined;
|
|
325
|
+
// A query a JUPITERONE_QUERY action fills has no rows here: the loop renders unbound.
|
|
326
|
+
const source = named !== undefined && !context.runtimeQueries.has(named) ? named : undefined;
|
|
327
|
+
const sampled = source === undefined ? undefined : context.queryData.queries[source];
|
|
328
|
+
if (source !== undefined && sampled === undefined) {
|
|
329
|
+
const error = `\`items\` reads query \`${source}\`, which this rule does not have, so the loop has ` +
|
|
330
|
+
'nothing to iterate and fails when the rule runs.';
|
|
331
|
+
return [Promise.resolve({ path, type: 'FOR_EACH_ITEM', status: 'render_failed', error })];
|
|
332
|
+
}
|
|
333
|
+
// A literal list is the items itself (rule-service accepts `items` as a string or a list).
|
|
334
|
+
const literal = Array.isArray(loop.items) ? loop.items : undefined;
|
|
335
|
+
const rows = literal ?? (Array.isArray(sampled?.data) ? sampled.data : undefined);
|
|
336
|
+
const iterations = literal ? literal.length : sampled && rows ? sampled.total : null;
|
|
337
|
+
const loopEntry = {
|
|
338
|
+
path,
|
|
339
|
+
type: 'FOR_EACH_ITEM',
|
|
340
|
+
status: 'loop',
|
|
341
|
+
iterations,
|
|
342
|
+
...(source !== undefined && context.estimated.has(source) ? { estimate: true } : {}),
|
|
343
|
+
itemRef,
|
|
344
|
+
};
|
|
345
|
+
// One binding per sampled row up to loopRows; a loop with no row to bind renders once, unbound.
|
|
346
|
+
const bindings = rows && rows.length > 0
|
|
347
|
+
? rows.slice(0, context.loopRows).map((item) => ({ itemRef, item }))
|
|
348
|
+
: [{ itemRef }];
|
|
349
|
+
const actions = loop.actions ?? [];
|
|
350
|
+
const nested = bindings.flatMap((binding, row) => actions.map((action, k) => previewNested(client, action, `${path}.actions[${k}]`, context, { binding, row, iterations })));
|
|
351
|
+
return [Promise.resolve(loopEntry), ...nested];
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* The rule's name and description as given, and whether a run raises an alert: a top-level
|
|
355
|
+
* CREATE_ALERT, at the level a plain SET_PROPERTY on `alertLevel` beside it sets.
|
|
356
|
+
*/
|
|
357
|
+
function ruleIdentity(rule) {
|
|
358
|
+
const alerting = rule.operations.filter((op) => (op.actions ?? []).some((action) => action.type === 'CREATE_ALERT'));
|
|
359
|
+
const level = alerting
|
|
360
|
+
.flatMap((op) => op.actions ?? [])
|
|
361
|
+
.find((action) => action.type === 'SET_PROPERTY' &&
|
|
362
|
+
action.targetProperty === 'alertLevel' &&
|
|
363
|
+
typeof action.targetValue === 'string' &&
|
|
364
|
+
!action.targetValue.includes('{{'))?.targetValue;
|
|
365
|
+
return {
|
|
366
|
+
...(rule.name !== undefined ? { name: rule.name } : {}),
|
|
367
|
+
...(rule.description !== undefined ? { description: rule.description } : {}),
|
|
368
|
+
raisesAlert: alerting.length > 0,
|
|
369
|
+
...(level ? { alertLevel: level } : {}),
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
/** The query names JUPITERONE_QUERY actions register (`action.name`), loops included. */
|
|
373
|
+
function runtimeQueryNames(rule) {
|
|
374
|
+
const names = new Set();
|
|
375
|
+
const visit = (actions) => {
|
|
376
|
+
if (!Array.isArray(actions))
|
|
377
|
+
return;
|
|
378
|
+
for (const action of actions) {
|
|
379
|
+
if (action?.type === 'JUPITERONE_QUERY' && typeof action.name === 'string') {
|
|
380
|
+
names.add(action.name);
|
|
381
|
+
}
|
|
382
|
+
if (action?.type === 'FOR_EACH_ITEM')
|
|
383
|
+
visit(action.actions);
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
for (const operation of rule.operations)
|
|
387
|
+
visit(operation.actions);
|
|
388
|
+
return names;
|
|
389
|
+
}
|
|
390
|
+
/** Render every action of every operation, in rule order. */
|
|
391
|
+
async function renderRuleActions(client, rule, queryData, samples, renderDeadlineAt) {
|
|
392
|
+
const estimated = new Set(samples.filter((s) => s.estimate).map((s) => String(s.name)));
|
|
393
|
+
const context = {
|
|
394
|
+
queryData,
|
|
395
|
+
templates: rule.templates,
|
|
396
|
+
estimated,
|
|
397
|
+
samples: new Map(samples.map((s) => [String(s.name), s])),
|
|
398
|
+
identity: ruleIdentity(rule),
|
|
399
|
+
runtimeQueries: runtimeQueryNames(rule),
|
|
400
|
+
loopRows: rule.loopRows ?? 1,
|
|
401
|
+
renderDeadlineAt,
|
|
402
|
+
};
|
|
403
|
+
const jobs = rule.operations.flatMap((operation, i) => (operation.actions ?? []).flatMap((action, j) => {
|
|
404
|
+
const path = `operations[${i}].actions[${j}]`;
|
|
405
|
+
return action.type === 'FOR_EACH_ITEM'
|
|
406
|
+
? previewLoop(client, action, path, context)
|
|
407
|
+
: [previewLeaf(client, action, path, context)];
|
|
408
|
+
}));
|
|
409
|
+
return Promise.all(jobs);
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* What the agent must not misread in a rendered preview: empty queries, cut-down lists, and
|
|
413
|
+
* totals the query engine only estimated.
|
|
414
|
+
*/
|
|
415
|
+
function sampleNotes(samples) {
|
|
416
|
+
return samples.flatMap((sample) => {
|
|
417
|
+
if (sample.status === 'empty') {
|
|
418
|
+
return [
|
|
419
|
+
`${sample.name} returned 0 results — actions using {{queries.${sample.name}.*}} render ` +
|
|
420
|
+
'empty, and a condition on its total being above 0 does not fire.',
|
|
421
|
+
];
|
|
422
|
+
}
|
|
423
|
+
if (sample.estimate) {
|
|
424
|
+
return [
|
|
425
|
+
`${sample.name}'s total (${sample.total}) is an estimate, so it, ` +
|
|
426
|
+
`{{queries.${sample.name}.total}} and any loop over its rows may differ from what the ` +
|
|
427
|
+
'rule sees when it runs. For an exact count, run the query with ' +
|
|
428
|
+
'`RETURN count(<alias>) AS value`. Lists built from its data show the first ' +
|
|
429
|
+
`${sample.sampledRows} rows.`,
|
|
430
|
+
];
|
|
431
|
+
}
|
|
432
|
+
if (sample.total !== null && sample.total > sample.sampledRows) {
|
|
433
|
+
return [
|
|
434
|
+
`Lists built from queries.${sample.name}.data show the first ${sample.sampledRows} of ` +
|
|
435
|
+
`${sample.total} rows; when the rule runs they hold all ${sample.total}.`,
|
|
436
|
+
];
|
|
437
|
+
}
|
|
438
|
+
return [];
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* An isError result whose first block is fixed text and counts, and whose second carries the names
|
|
443
|
+
* the caller chose. The chokepoint copies the first block into telemetry as `errorMessage`, so query
|
|
444
|
+
* names, fixture keys and the errors that quote them go in the second, which the agent still reads
|
|
445
|
+
* (PR #61 review).
|
|
446
|
+
*/
|
|
447
|
+
function refusalWithDetail(lead, detail, structuredContent) {
|
|
448
|
+
return {
|
|
449
|
+
content: [
|
|
450
|
+
{ type: 'text', text: lead },
|
|
451
|
+
{ type: 'text', text: detail },
|
|
452
|
+
],
|
|
453
|
+
isError: true,
|
|
454
|
+
structuredContent,
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
/** The refusal for a preview whose queries did not all return a sample: nothing is rendered. */
|
|
458
|
+
function queryFailedResult(rule, samples) {
|
|
459
|
+
const failed = samples.filter((s) => s.status === 'failed' || s.status === 'timed_out');
|
|
460
|
+
const running = failed.filter((s) => s.status === 'timed_out').length;
|
|
461
|
+
const lines = failed.map((s) => s.status === 'timed_out'
|
|
462
|
+
? `- \`${s.name}\` was still running when the preview stopped waiting. It keeps running ` +
|
|
463
|
+
'server-side, and an identical query within 5 minutes re-attaches to it: repeat this call.'
|
|
464
|
+
: `- \`${s.name}\` failed: ${s.error}. Fix it, test it with \`execute-j1ql-query\`, and ` +
|
|
465
|
+
'preview again.');
|
|
466
|
+
return refusalWithDetail(`Actions not previewed — ${failed.length} of ${samples.length} queries returned no sample ` +
|
|
467
|
+
`(${failed.length - running} failed, ${running} still running), and actions rendered ` +
|
|
468
|
+
'without their data would mislead.', lines.join('\n'), { outcome: 'query_failed', ...(rule.ruleId ? { ruleId: rule.ruleId } : {}), queries: samples });
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* The refusal for a preview in which no action rendered: an upstream failure, never a success
|
|
472
|
+
* envelope full of `render_failed` entries.
|
|
473
|
+
*/
|
|
474
|
+
function renderFailedResult(rule, samples, actions) {
|
|
475
|
+
const failures = actions.filter((a) => a.status === 'render_failed');
|
|
476
|
+
return refusalWithDetail(`Actions not previewed — every one of the ${failures.length} renders failed.`, `\`${failures[0]?.path}\` failed: ${failures[0]?.error}. Check its templates against ` +
|
|
477
|
+
'get-reference topic rule-templates and preview again; `actions` lists every failure.', {
|
|
478
|
+
outcome: 'render_failed',
|
|
479
|
+
...(rule.ruleId ? { ruleId: rule.ruleId } : {}),
|
|
480
|
+
queries: samples,
|
|
481
|
+
actions,
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Preview a rule's actions: sample its queries, then render each action against the sample.
|
|
486
|
+
* Both steps are bounded from `startedAt`, the request's start.
|
|
487
|
+
*/
|
|
488
|
+
async function previewRule(client, rule, startedAt) {
|
|
489
|
+
const { samples, queryData } = await sampleRuleQueries(client, rule.queries, startedAt + exports.PREVIEW_SAMPLE_BUDGET_MS, rule.fixtures);
|
|
490
|
+
if (samples.some((s) => s.status === 'failed' || s.status === 'timed_out')) {
|
|
491
|
+
return queryFailedResult(rule, samples);
|
|
492
|
+
}
|
|
493
|
+
const actions = await renderRuleActions(client, rule, queryData, samples, startedAt + exports.PREVIEW_RENDER_BUDGET_MS);
|
|
494
|
+
const attempted = actions.filter((a) => a.status === 'rendered' || a.status === 'render_failed');
|
|
495
|
+
if (attempted.length > 0 && attempted.every((a) => a.status === 'render_failed')) {
|
|
496
|
+
return renderFailedResult(rule, samples, actions);
|
|
497
|
+
}
|
|
498
|
+
const notes = sampleNotes(samples);
|
|
499
|
+
return (0, result_js_1.structuredResult)({
|
|
500
|
+
outcome: 'rendered',
|
|
501
|
+
...(rule.ruleId ? { ruleId: rule.ruleId } : {}),
|
|
502
|
+
queries: samples,
|
|
503
|
+
actions,
|
|
504
|
+
...(notes.length > 0 ? { notes } : {}),
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
//# sourceMappingURL=rule-preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-preview.js","sourceRoot":"","sources":["../../../src/server/tools/rule-preview.ts"],"names":[],"mappings":";;;AAqOA,8CA6BC;AAOD,0CA6BC;AA+PD,8CA2BC;AAuCD,8CAaC;AAiDD,kCAiCC;AArsBD,2EAA8E;AAC9E,sEAA0F;AAE1F,sDAAuE;AACvE,2CAAiD;AACjD,qEASkC;AAClC,2CAA+C;AAG/C,0FAA0F;AAC7E,QAAA,mBAAmB,GAAG,EAAE,CAAC;AAEtC;;;;;GAKG;AACU,QAAA,wBAAwB,GAAG,MAAM,CAAC;AAE/C,+FAA+F;AAClF,QAAA,wBAAwB,GAAG,MAAM,CAAC;AAE/C;;;GAGG;AACU,QAAA,wBAAwB,GAAG,MAAM,CAAC;AAE/C;;;GAGG;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC,CAAC;AAE1E;;;GAGG;AACH,MAAM,eAAe,GACnB,wFAAwF,CAAC;AAE3F;;;GAGG;AACH,MAAM,oBAAoB,GAAG,qDAAqD,CAAC;AAEnF,gGAAgG;AAChG,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AAE5D;;;GAGG;AACU,QAAA,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IAC7D,uBAAuB;IACvB,mBAAmB;IACnB,cAAc;IACd,oBAAoB;IACpB,6BAA6B;IAC7B,eAAe;I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