@tracearr/shared 2.2.0-beta.1 → 2.2.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automations/__tests__/actions.test.d.ts +2 -0
- package/dist/automations/__tests__/actions.test.d.ts.map +1 -0
- package/dist/automations/__tests__/actions.test.js +68 -0
- package/dist/automations/__tests__/actions.test.js.map +1 -0
- package/dist/automations/__tests__/conditions.test.d.ts +2 -0
- package/dist/automations/__tests__/conditions.test.d.ts.map +1 -0
- package/dist/automations/__tests__/conditions.test.js +55 -0
- package/dist/automations/__tests__/conditions.test.js.map +1 -0
- package/dist/automations/__tests__/definition.test.d.ts +2 -0
- package/dist/automations/__tests__/definition.test.d.ts.map +1 -0
- package/dist/automations/__tests__/definition.test.js +376 -0
- package/dist/automations/__tests__/definition.test.js.map +1 -0
- package/dist/automations/__tests__/share.test.d.ts +2 -0
- package/dist/automations/__tests__/share.test.d.ts.map +1 -0
- package/dist/automations/__tests__/share.test.js +98 -0
- package/dist/automations/__tests__/share.test.js.map +1 -0
- package/dist/automations/__tests__/templates.test.d.ts +2 -0
- package/dist/automations/__tests__/templates.test.d.ts.map +1 -0
- package/dist/automations/__tests__/templates.test.js +278 -0
- package/dist/automations/__tests__/templates.test.js.map +1 -0
- package/dist/automations/__tests__/triggers.test.d.ts +2 -0
- package/dist/automations/__tests__/triggers.test.d.ts.map +1 -0
- package/dist/automations/__tests__/triggers.test.js +42 -0
- package/dist/automations/__tests__/triggers.test.js.map +1 -0
- package/dist/automations/actions.d.ts +783 -0
- package/dist/automations/actions.d.ts.map +1 -0
- package/dist/automations/actions.js +97 -0
- package/dist/automations/actions.js.map +1 -0
- package/dist/automations/conditions.d.ts +459 -0
- package/dist/automations/conditions.d.ts.map +1 -0
- package/dist/automations/conditions.js +460 -0
- package/dist/automations/conditions.js.map +1 -0
- package/dist/automations/definition.d.ts +1389 -0
- package/dist/automations/definition.d.ts.map +1 -0
- package/dist/automations/definition.js +215 -0
- package/dist/automations/definition.js.map +1 -0
- package/dist/automations/dryRun.d.ts +413 -0
- package/dist/automations/dryRun.d.ts.map +1 -0
- package/dist/automations/dryRun.js +9 -0
- package/dist/automations/dryRun.js.map +1 -0
- package/dist/automations/index.d.ts +8 -0
- package/dist/automations/index.d.ts.map +1 -0
- package/dist/automations/index.js +8 -0
- package/dist/automations/index.js.map +1 -0
- package/dist/automations/share.d.ts +27 -0
- package/dist/automations/share.d.ts.map +1 -0
- package/dist/automations/share.js +119 -0
- package/dist/automations/share.js.map +1 -0
- package/dist/automations/templates.d.ts +1304 -0
- package/dist/automations/templates.d.ts.map +1 -0
- package/dist/automations/templates.js +525 -0
- package/dist/automations/templates.js.map +1 -0
- package/dist/automations/triggers.d.ts +141 -0
- package/dist/automations/triggers.d.ts.map +1 -0
- package/dist/automations/triggers.js +172 -0
- package/dist/automations/triggers.js.map +1 -0
- package/dist/constants.d.ts +22 -40
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +25 -56
- package/dist/constants.js.map +1 -1
- package/dist/destinations.d.ts +21 -22
- package/dist/destinations.d.ts.map +1 -1
- package/dist/destinations.js +13 -2
- package/dist/destinations.js.map +1 -1
- package/dist/index.d.ts +10 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -9
- package/dist/index.js.map +1 -1
- package/dist/listQuery.d.ts +41 -0
- package/dist/listQuery.d.ts.map +1 -0
- package/dist/listQuery.js +33 -0
- package/dist/listQuery.js.map +1 -0
- package/dist/schemas.d.ts +152 -832
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +90 -287
- package/dist/schemas.js.map +1 -1
- package/dist/types.d.ts +67 -137
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/violations.d.ts +2 -1
- package/dist/violations.d.ts.map +1 -1
- package/dist/violations.js +7 -0
- package/dist/violations.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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C;IAC5B,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,UAAU,CAAC;IACpB,wEAAwE;IACxE,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,WAAW,aAAc,SAAQ,oBAAoB;IACzD,0DAA0D;IAC1D,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,yFAAyF;IACzF,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAClC,gFAAgF;IAChF,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { listDateBoundSchema, listSortSchema } from '../listQuery.js';
|
|
3
|
+
import { booleanStringSchema, crossServerEnforcementRefinement, hasAtMostOneScope, paginationSchema, scopeAllowsCrossServerEnforcement, scopeRefinement, uuidSchema, violationSeveritySchema, } from '../schemas.js';
|
|
4
|
+
import { ACTIONS, automationActionsSchema } from './actions.js';
|
|
5
|
+
import { CONDITION_FIELDS, automationConditionsSchema } from './conditions.js';
|
|
6
|
+
import { NOTIFICATION_ONLY_TRIGGERS, TRIGGERS, TRIGGER_GROUPS, contextOf, contextSupplies, triggerNodeSchema, variablesFor, } from './triggers.js';
|
|
7
|
+
export const AUTOMATION_KINDS = ['policy', 'notification'];
|
|
8
|
+
// 'error' belongs to a run that failed before its terminal write; a bookkeeping failure
|
|
9
|
+
// after that write notes itself in steps rather than demoting the row.
|
|
10
|
+
export const RUN_OUTCOMES = ['completed', 'stopped_by_condition', 'error'];
|
|
11
|
+
/** Days a completed run survives when its automation names no retention of its own. */
|
|
12
|
+
export const RETENTION_DEFAULTS = {
|
|
13
|
+
policy: 365,
|
|
14
|
+
notification: 30,
|
|
15
|
+
};
|
|
16
|
+
/** The automations column, and what a name has to fit into. */
|
|
17
|
+
export const AUTOMATION_NAME_MAX = 100;
|
|
18
|
+
/** The note beside the name, capped the same way the column is. */
|
|
19
|
+
export const AUTOMATION_DESCRIPTION_MAX = 500;
|
|
20
|
+
const automationFieldsSchema = z.strictObject({
|
|
21
|
+
name: z.string().trim().min(1).max(AUTOMATION_NAME_MAX),
|
|
22
|
+
description: z.string().max(AUTOMATION_DESCRIPTION_MAX).nullable().optional(),
|
|
23
|
+
kind: z.enum(AUTOMATION_KINDS),
|
|
24
|
+
severity: violationSeveritySchema.nullable(),
|
|
25
|
+
triggers: z.array(triggerNodeSchema),
|
|
26
|
+
conditions: automationConditionsSchema,
|
|
27
|
+
actions: automationActionsSchema,
|
|
28
|
+
serverId: uuidSchema.nullable().optional(),
|
|
29
|
+
serverUserId: uuidSchema.nullable().optional(),
|
|
30
|
+
userId: uuidSchema.nullable().optional(),
|
|
31
|
+
enforceAcrossServers: z.boolean().optional(),
|
|
32
|
+
cooldownMinutes: z.number().int().min(0).nullable().optional(),
|
|
33
|
+
retentionDays: z.number().int().min(1).max(3650).nullable().optional(),
|
|
34
|
+
isActive: z.boolean().optional(),
|
|
35
|
+
});
|
|
36
|
+
const VAR_RE = /\{\{\s*([a-zA-Z][\w.]*)\s*\}\}/g;
|
|
37
|
+
function valueMatches(descriptor, operator, value) {
|
|
38
|
+
if (operator === 'in' || operator === 'not_in')
|
|
39
|
+
return Array.isArray(value);
|
|
40
|
+
switch (descriptor.valueType) {
|
|
41
|
+
case 'number':
|
|
42
|
+
return typeof value === 'number';
|
|
43
|
+
case 'boolean':
|
|
44
|
+
return typeof value === 'boolean';
|
|
45
|
+
// `in`/`not_in` returned above; what is left on a list field is one of its options.
|
|
46
|
+
case 'multiSelect':
|
|
47
|
+
return typeof value === 'string';
|
|
48
|
+
default:
|
|
49
|
+
return typeof value === 'string';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Everything a definition has to satisfy beyond the node schemas: what the triggers
|
|
54
|
+
* can supply is what the conditions, actions and message variables may name.
|
|
55
|
+
*/
|
|
56
|
+
function definitionRefinements(def, ctx) {
|
|
57
|
+
const { triggers } = def;
|
|
58
|
+
const enabled = triggers.filter((trigger) => trigger.enabled);
|
|
59
|
+
if (enabled.length === 0) {
|
|
60
|
+
ctx.addIssue({
|
|
61
|
+
code: 'custom',
|
|
62
|
+
path: ['triggers'],
|
|
63
|
+
message: 'At least one enabled trigger is required',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const context = contextOf(triggers);
|
|
67
|
+
if (def.kind === 'policy' &&
|
|
68
|
+
enabled.some((trigger) => !contextSupplies(TRIGGERS[trigger.type].context, 'account'))) {
|
|
69
|
+
ctx.addIssue({
|
|
70
|
+
code: 'custom',
|
|
71
|
+
path: ['triggers'],
|
|
72
|
+
message: 'A policy needs a stream or account trigger: violations are about a user',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
// A session context supplies an account, so the rule above would let a policy sit on a new device.
|
|
76
|
+
if (def.kind === 'policy' &&
|
|
77
|
+
enabled.some((trigger) => NOTIFICATION_ONLY_TRIGGERS.includes(trigger.type))) {
|
|
78
|
+
ctx.addIssue({
|
|
79
|
+
code: 'custom',
|
|
80
|
+
path: ['triggers'],
|
|
81
|
+
message: 'New device and trust score changed can only send: neither is something a person did wrong',
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
// A trust action one hop from the writer that fired the trigger walks the score down on every run.
|
|
85
|
+
const watchesTrust = enabled.some((trigger) => trigger.type === 'account.trust_changed');
|
|
86
|
+
const checkGroups = (groups, path) => {
|
|
87
|
+
groups.forEach((group, groupIndex) => group.conditions.forEach((condition, conditionIndex) => {
|
|
88
|
+
const descriptor = CONDITION_FIELDS[condition.field];
|
|
89
|
+
const at = [...path, groupIndex, 'conditions', conditionIndex];
|
|
90
|
+
if (condition.enabled !== false &&
|
|
91
|
+
context !== null &&
|
|
92
|
+
!contextSupplies(context, descriptor.requires)) {
|
|
93
|
+
ctx.addIssue({
|
|
94
|
+
code: 'custom',
|
|
95
|
+
path: [...at, 'field'],
|
|
96
|
+
message: `${condition.field} is not available for every enabled trigger`,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (!descriptor.operators.includes(condition.operator)) {
|
|
100
|
+
ctx.addIssue({
|
|
101
|
+
code: 'custom',
|
|
102
|
+
path: [...at, 'operator'],
|
|
103
|
+
message: `${condition.operator} is not valid for ${condition.field}`,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (!valueMatches(descriptor, condition.operator, condition.value)) {
|
|
107
|
+
ctx.addIssue({
|
|
108
|
+
code: 'custom',
|
|
109
|
+
path: [...at, 'value'],
|
|
110
|
+
message: `value does not fit ${condition.field}`,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}));
|
|
114
|
+
};
|
|
115
|
+
checkGroups(def.conditions.groups, ['conditions', 'groups']);
|
|
116
|
+
const vars = new Set(variablesFor(triggers));
|
|
117
|
+
const checkAction = (action, path) => {
|
|
118
|
+
if (action.enabled !== false) {
|
|
119
|
+
const need = ACTIONS[action.type].requires;
|
|
120
|
+
if (context !== null && !contextSupplies(context, need)) {
|
|
121
|
+
ctx.addIssue({
|
|
122
|
+
code: 'custom',
|
|
123
|
+
path: [...path, 'type'],
|
|
124
|
+
message: `${action.type} needs a ${need} trigger`,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (watchesTrust && action.type === 'trust') {
|
|
128
|
+
ctx.addIssue({
|
|
129
|
+
code: 'custom',
|
|
130
|
+
path: [...path, 'type'],
|
|
131
|
+
message: 'An automation that watches trust cannot also change it',
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (action.type !== 'send')
|
|
136
|
+
return;
|
|
137
|
+
for (const field of ['title', 'body']) {
|
|
138
|
+
for (const match of (action[field] ?? '').matchAll(VAR_RE)) {
|
|
139
|
+
const name = match[1] ?? '';
|
|
140
|
+
if (!vars.has(name)) {
|
|
141
|
+
ctx.addIssue({
|
|
142
|
+
code: 'custom',
|
|
143
|
+
path: [...path, field],
|
|
144
|
+
message: `{{${name}}} is not available for every enabled trigger`,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
def.actions.actions.forEach((action, index) => {
|
|
151
|
+
const path = ['actions', 'actions', index];
|
|
152
|
+
checkAction(action, path);
|
|
153
|
+
if (action.type === 'if' && action.enabled !== false) {
|
|
154
|
+
checkGroups(action.conditions.groups, [...path, 'conditions', 'groups']);
|
|
155
|
+
action.then.forEach((leaf, leafIndex) => checkAction(leaf, [...path, 'then', leafIndex]));
|
|
156
|
+
action.else.forEach((leaf, leafIndex) => checkAction(leaf, [...path, 'else', leafIndex]));
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
export const automationDefinitionSchema = automationFieldsSchema.superRefine(definitionRefinements);
|
|
161
|
+
export const createAutomationSchema = automationDefinitionSchema
|
|
162
|
+
.refine(hasAtMostOneScope, scopeRefinement)
|
|
163
|
+
.refine(scopeAllowsCrossServerEnforcement, crossServerEnforcementRefinement);
|
|
164
|
+
export const updateAutomationSchema = automationFieldsSchema
|
|
165
|
+
.partial()
|
|
166
|
+
.refine(hasAtMostOneScope, scopeRefinement)
|
|
167
|
+
.refine(scopeAllowsCrossServerEnforcement, crossServerEnforcementRefinement);
|
|
168
|
+
export const AUTOMATION_SORT_FIELDS = [
|
|
169
|
+
'name',
|
|
170
|
+
'createdAt',
|
|
171
|
+
'updatedAt',
|
|
172
|
+
'kind',
|
|
173
|
+
'isActive',
|
|
174
|
+
];
|
|
175
|
+
/** The three ways a template arrives; a row no template wrote is the fourth answer. */
|
|
176
|
+
const TEMPLATE_SOURCES = ['builtin', 'import', 'local'];
|
|
177
|
+
export const AUTOMATION_SOURCES = [...TEMPLATE_SOURCES, 'own'];
|
|
178
|
+
export const automationListQuerySchema = paginationSchema
|
|
179
|
+
.extend({
|
|
180
|
+
kind: z.enum(AUTOMATION_KINDS).optional(),
|
|
181
|
+
enabled: booleanStringSchema.optional(),
|
|
182
|
+
search: z.string().trim().min(1).max(100).optional(),
|
|
183
|
+
source: z.enum(AUTOMATION_SOURCES).optional(),
|
|
184
|
+
serverId: uuidSchema.optional(),
|
|
185
|
+
trigger: z.enum(TRIGGER_GROUPS).optional(),
|
|
186
|
+
severity: violationSeveritySchema.optional(),
|
|
187
|
+
})
|
|
188
|
+
.extend(listSortSchema(AUTOMATION_SORT_FIELDS).shape);
|
|
189
|
+
export const RUN_SORT_FIELDS = ['startedAt', 'finishedAt', 'outcome'];
|
|
190
|
+
/** What a page of runs and a count of them filter on, so neither can drift. */
|
|
191
|
+
export const runCountsQuerySchema = z.object({
|
|
192
|
+
kind: z.enum(AUTOMATION_KINDS).optional(),
|
|
193
|
+
outcome: z.enum(RUN_OUTCOMES).optional(),
|
|
194
|
+
automationId: uuidSchema.optional(),
|
|
195
|
+
// Calendar days against the run's start, resolved to half-open UTC bounds.
|
|
196
|
+
startDate: listDateBoundSchema,
|
|
197
|
+
endDate: listDateBoundSchema,
|
|
198
|
+
});
|
|
199
|
+
export const runListQuerySchema = paginationSchema
|
|
200
|
+
.extend(runCountsQuerySchema.shape)
|
|
201
|
+
.extend(listSortSchema(RUN_SORT_FIELDS).shape);
|
|
202
|
+
export const NEAR_MISS_REASONS = [
|
|
203
|
+
'cooldown_active',
|
|
204
|
+
'edge_replayed',
|
|
205
|
+
'gate_blocked',
|
|
206
|
+
'trigger_filter_failed',
|
|
207
|
+
];
|
|
208
|
+
/** One entry of the capped ring: a trigger matched but the pipeline recorded no run. */
|
|
209
|
+
export const nearMissEntrySchema = z.object({
|
|
210
|
+
reason: z.enum(NEAR_MISS_REASONS),
|
|
211
|
+
at: z.iso.datetime(),
|
|
212
|
+
subjectKey: z.string(),
|
|
213
|
+
trigger: z.string(),
|
|
214
|
+
});
|
|
215
|
+
//# sourceMappingURL=definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/automations/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EACL,mBAAmB,EACnB,gCAAgC,EAChC,iBAAiB,EACjB,gBAAgB,EAChB,iCAAiC,EACjC,eAAe,EACf,UAAU,EACV,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EACL,0BAA0B,EAC1B,QAAQ,EACR,cAAc,EACd,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,YAAY,GACb,MAAM,eAAe,CAAC;AAavB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAU,CAAC;AAGpE,wFAAwF;AACxF,uEAAuE;AACvE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAAW,EAAE,sBAAsB,EAAE,OAA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IAC9B,OAAO,EAAE,mBAAmB;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB;KAC/C,MAAM,CAAC,oBAAoB,CAAC,KAAK,CAAC;KAClC,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC;AASjD,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,iBAAiB;IACjB,eAAe;IACf,cAAc;IACd,uBAAuB;CACf,CAAC;AAGX,wFAAwF;AACxF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC;IACjC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IACpB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ConditionEvidence } from './definition.js';
|
|
3
|
+
import type { TriggerType } from './triggers.js';
|
|
4
|
+
export declare const dryRunRequestSchema: z.ZodObject<{
|
|
5
|
+
definition: z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
kind: z.ZodEnum<{
|
|
9
|
+
policy: "policy";
|
|
10
|
+
notification: "notification";
|
|
11
|
+
}>;
|
|
12
|
+
severity: z.ZodNullable<z.ZodEnum<{
|
|
13
|
+
low: "low";
|
|
14
|
+
warning: "warning";
|
|
15
|
+
high: "high";
|
|
16
|
+
}>>;
|
|
17
|
+
triggers: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
18
|
+
type: z.ZodEnum<{
|
|
19
|
+
"session.started": "session.started";
|
|
20
|
+
"session.stopped": "session.stopped";
|
|
21
|
+
"session.transcode_changed": "session.transcode_changed";
|
|
22
|
+
"session.paused": "session.paused";
|
|
23
|
+
"account.new_device": "account.new_device";
|
|
24
|
+
"account.trust_changed": "account.trust_changed";
|
|
25
|
+
"media.added": "media.added";
|
|
26
|
+
"media.upgraded": "media.upgraded";
|
|
27
|
+
"server.down": "server.down";
|
|
28
|
+
"server.up": "server.up";
|
|
29
|
+
"plugin.update_available": "plugin.update_available";
|
|
30
|
+
"server.update_available": "server.update_available";
|
|
31
|
+
"tracearr.update_available": "tracearr.update_available";
|
|
32
|
+
}>;
|
|
33
|
+
id: z.ZodUUID;
|
|
34
|
+
enabled: z.ZodBoolean;
|
|
35
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
36
|
+
type: z.ZodLiteral<"session.held_for">;
|
|
37
|
+
params: z.ZodObject<{
|
|
38
|
+
minutes: z.ZodNumber;
|
|
39
|
+
measure: z.ZodEnum<{
|
|
40
|
+
current: "current";
|
|
41
|
+
total: "total";
|
|
42
|
+
}>;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
id: z.ZodUUID;
|
|
45
|
+
enabled: z.ZodBoolean;
|
|
46
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
47
|
+
type: z.ZodLiteral<"account.inactive_for">;
|
|
48
|
+
params: z.ZodObject<{
|
|
49
|
+
days: z.ZodNumber;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
id: z.ZodUUID;
|
|
52
|
+
enabled: z.ZodBoolean;
|
|
53
|
+
}, z.core.$strict>], "type">>;
|
|
54
|
+
conditions: z.ZodObject<{
|
|
55
|
+
groups: z.ZodArray<z.ZodObject<{
|
|
56
|
+
match: z.ZodOptional<z.ZodEnum<{
|
|
57
|
+
any: "any";
|
|
58
|
+
all: "all";
|
|
59
|
+
}>>;
|
|
60
|
+
conditions: z.ZodArray<z.ZodObject<{
|
|
61
|
+
field: z.ZodUnion<readonly [z.ZodEnum<{
|
|
62
|
+
concurrent_streams: "concurrent_streams";
|
|
63
|
+
active_session_distance_km: "active_session_distance_km";
|
|
64
|
+
travel_speed_kmh: "travel_speed_kmh";
|
|
65
|
+
unique_ips_in_window: "unique_ips_in_window";
|
|
66
|
+
unique_devices_in_window: "unique_devices_in_window";
|
|
67
|
+
inactive_days: "inactive_days";
|
|
68
|
+
current_pause_minutes: "current_pause_minutes";
|
|
69
|
+
total_pause_minutes: "total_pause_minutes";
|
|
70
|
+
}>, z.ZodEnum<{
|
|
71
|
+
source_resolution: "source_resolution";
|
|
72
|
+
output_resolution: "output_resolution";
|
|
73
|
+
is_transcoding: "is_transcoding";
|
|
74
|
+
is_transcode_downgrade: "is_transcode_downgrade";
|
|
75
|
+
source_bitrate_mbps: "source_bitrate_mbps";
|
|
76
|
+
}>, z.ZodEnum<{
|
|
77
|
+
user_id: "user_id";
|
|
78
|
+
trust_score: "trust_score";
|
|
79
|
+
account_age_days: "account_age_days";
|
|
80
|
+
}>, z.ZodEnum<{
|
|
81
|
+
device_type: "device_type";
|
|
82
|
+
client_name: "client_name";
|
|
83
|
+
platform: "platform";
|
|
84
|
+
}>, z.ZodEnum<{
|
|
85
|
+
is_local_network: "is_local_network";
|
|
86
|
+
country: "country";
|
|
87
|
+
ip_in_range: "ip_in_range";
|
|
88
|
+
}>, z.ZodEnum<{
|
|
89
|
+
server_id: "server_id";
|
|
90
|
+
media_type: "media_type";
|
|
91
|
+
}>, z.ZodEnum<{
|
|
92
|
+
library_item_type: "library_item_type";
|
|
93
|
+
library_name: "library_name";
|
|
94
|
+
resolution_after: "resolution_after";
|
|
95
|
+
dynamic_range_after: "dynamic_range_after";
|
|
96
|
+
video_codec_after: "video_codec_after";
|
|
97
|
+
audio_channels_after: "audio_channels_after";
|
|
98
|
+
file_size_after: "file_size_after";
|
|
99
|
+
}>]>;
|
|
100
|
+
operator: z.ZodUnion<readonly [z.ZodEnum<{
|
|
101
|
+
eq: "eq";
|
|
102
|
+
neq: "neq";
|
|
103
|
+
gt: "gt";
|
|
104
|
+
gte: "gte";
|
|
105
|
+
lt: "lt";
|
|
106
|
+
lte: "lte";
|
|
107
|
+
}>, z.ZodEnum<{
|
|
108
|
+
in: "in";
|
|
109
|
+
not_in: "not_in";
|
|
110
|
+
}>, z.ZodEnum<{
|
|
111
|
+
contains: "contains";
|
|
112
|
+
not_contains: "not_contains";
|
|
113
|
+
}>]>;
|
|
114
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>;
|
|
115
|
+
params: z.ZodOptional<z.ZodObject<{
|
|
116
|
+
window_hours: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
exclude_same_device: z.ZodOptional<z.ZodBoolean>;
|
|
118
|
+
exclude_same_ip: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
count_device_types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
120
|
+
unknown: "unknown";
|
|
121
|
+
mobile: "mobile";
|
|
122
|
+
tablet: "tablet";
|
|
123
|
+
tv: "tv";
|
|
124
|
+
desktop: "desktop";
|
|
125
|
+
browser: "browser";
|
|
126
|
+
}>>>;
|
|
127
|
+
}, z.core.$strip>>;
|
|
128
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
129
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
130
|
+
}, z.core.$strip>>;
|
|
131
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
132
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
133
|
+
}, z.core.$strip>>;
|
|
134
|
+
}, z.core.$strip>;
|
|
135
|
+
actions: z.ZodObject<{
|
|
136
|
+
actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
137
|
+
type: z.ZodLiteral<"send">;
|
|
138
|
+
to: z.ZodArray<z.ZodUUID>;
|
|
139
|
+
cooldown_minutes: z.ZodOptional<z.ZodNumber>;
|
|
140
|
+
title: z.ZodOptional<z.ZodString>;
|
|
141
|
+
body: z.ZodOptional<z.ZodString>;
|
|
142
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
143
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
145
|
+
type: z.ZodLiteral<"trust">;
|
|
146
|
+
mode: z.ZodEnum<{
|
|
147
|
+
set: "set";
|
|
148
|
+
adjust: "adjust";
|
|
149
|
+
reset: "reset";
|
|
150
|
+
}>;
|
|
151
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
152
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
153
|
+
cooldown_minutes: z.ZodOptional<z.ZodNumber>;
|
|
154
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
155
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
156
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
157
|
+
type: z.ZodLiteral<"kill_stream">;
|
|
158
|
+
delay_seconds: z.ZodOptional<z.ZodNumber>;
|
|
159
|
+
cooldown_minutes: z.ZodOptional<z.ZodNumber>;
|
|
160
|
+
message: z.ZodOptional<z.ZodString>;
|
|
161
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
162
|
+
triggering: "triggering";
|
|
163
|
+
oldest: "oldest";
|
|
164
|
+
newest: "newest";
|
|
165
|
+
all_except_one: "all_except_one";
|
|
166
|
+
all_user: "all_user";
|
|
167
|
+
}>>;
|
|
168
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
169
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
170
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
171
|
+
type: z.ZodLiteral<"message_client">;
|
|
172
|
+
message: z.ZodString;
|
|
173
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
174
|
+
triggering: "triggering";
|
|
175
|
+
oldest: "oldest";
|
|
176
|
+
newest: "newest";
|
|
177
|
+
all_except_one: "all_except_one";
|
|
178
|
+
all_user: "all_user";
|
|
179
|
+
}>>;
|
|
180
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
181
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
182
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
183
|
+
type: z.ZodLiteral<"if">;
|
|
184
|
+
conditions: z.ZodObject<{
|
|
185
|
+
groups: z.ZodArray<z.ZodObject<{
|
|
186
|
+
match: z.ZodOptional<z.ZodEnum<{
|
|
187
|
+
any: "any";
|
|
188
|
+
all: "all";
|
|
189
|
+
}>>;
|
|
190
|
+
conditions: z.ZodArray<z.ZodObject<{
|
|
191
|
+
field: z.ZodUnion<readonly [z.ZodEnum<{
|
|
192
|
+
concurrent_streams: "concurrent_streams";
|
|
193
|
+
active_session_distance_km: "active_session_distance_km";
|
|
194
|
+
travel_speed_kmh: "travel_speed_kmh";
|
|
195
|
+
unique_ips_in_window: "unique_ips_in_window";
|
|
196
|
+
unique_devices_in_window: "unique_devices_in_window";
|
|
197
|
+
inactive_days: "inactive_days";
|
|
198
|
+
current_pause_minutes: "current_pause_minutes";
|
|
199
|
+
total_pause_minutes: "total_pause_minutes";
|
|
200
|
+
}>, z.ZodEnum<{
|
|
201
|
+
source_resolution: "source_resolution";
|
|
202
|
+
output_resolution: "output_resolution";
|
|
203
|
+
is_transcoding: "is_transcoding";
|
|
204
|
+
is_transcode_downgrade: "is_transcode_downgrade";
|
|
205
|
+
source_bitrate_mbps: "source_bitrate_mbps";
|
|
206
|
+
}>, z.ZodEnum<{
|
|
207
|
+
user_id: "user_id";
|
|
208
|
+
trust_score: "trust_score";
|
|
209
|
+
account_age_days: "account_age_days";
|
|
210
|
+
}>, z.ZodEnum<{
|
|
211
|
+
device_type: "device_type";
|
|
212
|
+
client_name: "client_name";
|
|
213
|
+
platform: "platform";
|
|
214
|
+
}>, z.ZodEnum<{
|
|
215
|
+
is_local_network: "is_local_network";
|
|
216
|
+
country: "country";
|
|
217
|
+
ip_in_range: "ip_in_range";
|
|
218
|
+
}>, z.ZodEnum<{
|
|
219
|
+
server_id: "server_id";
|
|
220
|
+
media_type: "media_type";
|
|
221
|
+
}>, z.ZodEnum<{
|
|
222
|
+
library_item_type: "library_item_type";
|
|
223
|
+
library_name: "library_name";
|
|
224
|
+
resolution_after: "resolution_after";
|
|
225
|
+
dynamic_range_after: "dynamic_range_after";
|
|
226
|
+
video_codec_after: "video_codec_after";
|
|
227
|
+
audio_channels_after: "audio_channels_after";
|
|
228
|
+
file_size_after: "file_size_after";
|
|
229
|
+
}>]>;
|
|
230
|
+
operator: z.ZodUnion<readonly [z.ZodEnum<{
|
|
231
|
+
eq: "eq";
|
|
232
|
+
neq: "neq";
|
|
233
|
+
gt: "gt";
|
|
234
|
+
gte: "gte";
|
|
235
|
+
lt: "lt";
|
|
236
|
+
lte: "lte";
|
|
237
|
+
}>, z.ZodEnum<{
|
|
238
|
+
in: "in";
|
|
239
|
+
not_in: "not_in";
|
|
240
|
+
}>, z.ZodEnum<{
|
|
241
|
+
contains: "contains";
|
|
242
|
+
not_contains: "not_contains";
|
|
243
|
+
}>]>;
|
|
244
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>;
|
|
245
|
+
params: z.ZodOptional<z.ZodObject<{
|
|
246
|
+
window_hours: z.ZodOptional<z.ZodNumber>;
|
|
247
|
+
exclude_same_device: z.ZodOptional<z.ZodBoolean>;
|
|
248
|
+
exclude_same_ip: z.ZodOptional<z.ZodBoolean>;
|
|
249
|
+
count_device_types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
250
|
+
unknown: "unknown";
|
|
251
|
+
mobile: "mobile";
|
|
252
|
+
tablet: "tablet";
|
|
253
|
+
tv: "tv";
|
|
254
|
+
desktop: "desktop";
|
|
255
|
+
browser: "browser";
|
|
256
|
+
}>>>;
|
|
257
|
+
}, z.core.$strip>>;
|
|
258
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
259
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
260
|
+
}, z.core.$strip>>;
|
|
261
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
262
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
263
|
+
}, z.core.$strip>>;
|
|
264
|
+
}, z.core.$strip>;
|
|
265
|
+
then: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
266
|
+
type: z.ZodLiteral<"send">;
|
|
267
|
+
to: z.ZodArray<z.ZodUUID>;
|
|
268
|
+
cooldown_minutes: z.ZodOptional<z.ZodNumber>;
|
|
269
|
+
title: z.ZodOptional<z.ZodString>;
|
|
270
|
+
body: z.ZodOptional<z.ZodString>;
|
|
271
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
272
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
273
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
274
|
+
type: z.ZodLiteral<"trust">;
|
|
275
|
+
mode: z.ZodEnum<{
|
|
276
|
+
set: "set";
|
|
277
|
+
adjust: "adjust";
|
|
278
|
+
reset: "reset";
|
|
279
|
+
}>;
|
|
280
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
281
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
282
|
+
cooldown_minutes: z.ZodOptional<z.ZodNumber>;
|
|
283
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
284
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
285
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
286
|
+
type: z.ZodLiteral<"kill_stream">;
|
|
287
|
+
delay_seconds: z.ZodOptional<z.ZodNumber>;
|
|
288
|
+
cooldown_minutes: z.ZodOptional<z.ZodNumber>;
|
|
289
|
+
message: z.ZodOptional<z.ZodString>;
|
|
290
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
291
|
+
triggering: "triggering";
|
|
292
|
+
oldest: "oldest";
|
|
293
|
+
newest: "newest";
|
|
294
|
+
all_except_one: "all_except_one";
|
|
295
|
+
all_user: "all_user";
|
|
296
|
+
}>>;
|
|
297
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
298
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
299
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
300
|
+
type: z.ZodLiteral<"message_client">;
|
|
301
|
+
message: z.ZodString;
|
|
302
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
303
|
+
triggering: "triggering";
|
|
304
|
+
oldest: "oldest";
|
|
305
|
+
newest: "newest";
|
|
306
|
+
all_except_one: "all_except_one";
|
|
307
|
+
all_user: "all_user";
|
|
308
|
+
}>>;
|
|
309
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
310
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
311
|
+
}, z.core.$strip>], "type">>;
|
|
312
|
+
else: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
313
|
+
type: z.ZodLiteral<"send">;
|
|
314
|
+
to: z.ZodArray<z.ZodUUID>;
|
|
315
|
+
cooldown_minutes: z.ZodOptional<z.ZodNumber>;
|
|
316
|
+
title: z.ZodOptional<z.ZodString>;
|
|
317
|
+
body: z.ZodOptional<z.ZodString>;
|
|
318
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
319
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
320
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
321
|
+
type: z.ZodLiteral<"trust">;
|
|
322
|
+
mode: z.ZodEnum<{
|
|
323
|
+
set: "set";
|
|
324
|
+
adjust: "adjust";
|
|
325
|
+
reset: "reset";
|
|
326
|
+
}>;
|
|
327
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
328
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
329
|
+
cooldown_minutes: z.ZodOptional<z.ZodNumber>;
|
|
330
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
331
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
332
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
333
|
+
type: z.ZodLiteral<"kill_stream">;
|
|
334
|
+
delay_seconds: z.ZodOptional<z.ZodNumber>;
|
|
335
|
+
cooldown_minutes: z.ZodOptional<z.ZodNumber>;
|
|
336
|
+
message: z.ZodOptional<z.ZodString>;
|
|
337
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
338
|
+
triggering: "triggering";
|
|
339
|
+
oldest: "oldest";
|
|
340
|
+
newest: "newest";
|
|
341
|
+
all_except_one: "all_except_one";
|
|
342
|
+
all_user: "all_user";
|
|
343
|
+
}>>;
|
|
344
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
345
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
346
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
347
|
+
type: z.ZodLiteral<"message_client">;
|
|
348
|
+
message: z.ZodString;
|
|
349
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
350
|
+
triggering: "triggering";
|
|
351
|
+
oldest: "oldest";
|
|
352
|
+
newest: "newest";
|
|
353
|
+
all_except_one: "all_except_one";
|
|
354
|
+
all_user: "all_user";
|
|
355
|
+
}>>;
|
|
356
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
357
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
358
|
+
}, z.core.$strip>], "type">>;
|
|
359
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
360
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
361
|
+
}, z.core.$strict>], "type">>;
|
|
362
|
+
}, z.core.$strip>;
|
|
363
|
+
serverId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
364
|
+
serverUserId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
365
|
+
userId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
366
|
+
enforceAcrossServers: z.ZodOptional<z.ZodBoolean>;
|
|
367
|
+
cooldownMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
368
|
+
retentionDays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
369
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
370
|
+
}, z.core.$strict>;
|
|
371
|
+
sample: z.ZodOptional<z.ZodObject<{
|
|
372
|
+
sessionId: z.ZodUUID;
|
|
373
|
+
}, z.core.$strip>>;
|
|
374
|
+
}, z.core.$strip>;
|
|
375
|
+
export type DryRunRequest = z.infer<typeof dryRunRequestSchema>;
|
|
376
|
+
/** The session a sample was evaluated against, named for display. */
|
|
377
|
+
export interface DryRunSubject {
|
|
378
|
+
sessionId: string;
|
|
379
|
+
user: {
|
|
380
|
+
id: string;
|
|
381
|
+
name: string;
|
|
382
|
+
};
|
|
383
|
+
server: {
|
|
384
|
+
id: string;
|
|
385
|
+
name: string;
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
export interface DryRunCondition {
|
|
389
|
+
nodeId: string;
|
|
390
|
+
passed: boolean;
|
|
391
|
+
evidence: ConditionEvidence;
|
|
392
|
+
}
|
|
393
|
+
export interface DryRunAction {
|
|
394
|
+
nodeId: string;
|
|
395
|
+
wouldRun: boolean;
|
|
396
|
+
/** Why the node stays put: disabled, conditions unmet, or a branch not taken. */
|
|
397
|
+
reason?: string;
|
|
398
|
+
/** `if` nodes only: the branch its conditions pick against this subject. */
|
|
399
|
+
branch?: 'then' | 'else';
|
|
400
|
+
}
|
|
401
|
+
export interface DryRunSample {
|
|
402
|
+
subject: DryRunSubject;
|
|
403
|
+
/** The enabled session triggers that would reach this subject. */
|
|
404
|
+
triggers: TriggerType[];
|
|
405
|
+
conditions: DryRunCondition[];
|
|
406
|
+
actions: DryRunAction[];
|
|
407
|
+
wouldRun: boolean;
|
|
408
|
+
summary: string;
|
|
409
|
+
}
|
|
410
|
+
export interface DryRunResponse {
|
|
411
|
+
samples: DryRunSample[];
|
|
412
|
+
}
|
|
413
|
+
//# sourceMappingURL=dryRun.d.ts.map
|