deepline 0.3.293 → 0.3.295
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/bundling-sources/sdk/src/compat.ts +35 -7
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +269 -267
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +3 -4
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +14 -1
- package/dist/cli/auth-EDTRERZP.mjs +31 -0
- package/dist/cli/auth-TDHKB277.js +31 -0
- package/dist/cli/billing-ELIDPILY.js +1749 -0
- package/dist/cli/billing-EXGXJVAU.mjs +1749 -0
- package/dist/cli/chunk-2S5Y3TZP.js +5688 -0
- package/dist/cli/chunk-3KC45UVF.js +150 -0
- package/dist/cli/chunk-3XX5TEA4.js +15 -0
- package/dist/cli/chunk-4MBOJQPL.mjs +0 -0
- package/dist/cli/chunk-4NEFYBF7.js +2240 -0
- package/dist/cli/chunk-5JLQPVNX.js +3056 -0
- package/dist/cli/chunk-5KDKFHZI.js +1269 -0
- package/dist/cli/chunk-6A3TJUWC.js +76 -0
- package/dist/cli/chunk-6O5YZOVN.mjs +890 -0
- package/dist/cli/chunk-7P5AA3SN.js +344 -0
- package/dist/cli/chunk-AYHLUHE5.js +52 -0
- package/dist/cli/chunk-CBVIJSHF.mjs +560 -0
- package/dist/cli/chunk-CFVVCN4A.js +735 -0
- package/dist/cli/chunk-COGTRVWW.js +30 -0
- package/dist/cli/chunk-D4AZUZO4.js +190 -0
- package/dist/cli/chunk-DLIRSHV6.mjs +28 -0
- package/dist/cli/chunk-EACVZI6N.mjs +1995 -0
- package/dist/cli/chunk-EDWJY6T4.mjs +3056 -0
- package/dist/cli/chunk-EXMLR72R.mjs +0 -0
- package/dist/cli/chunk-F35VOIQL.js +890 -0
- package/dist/cli/chunk-GAMFK2ZP.mjs +148 -0
- package/dist/cli/chunk-GHRQQPW2.mjs +2240 -0
- package/dist/cli/chunk-GONRLVV3.js +3440 -0
- package/dist/cli/chunk-GVUJJJ5G.mjs +76 -0
- package/dist/cli/chunk-H7HIDGZ7.mjs +150 -0
- package/dist/cli/chunk-HUZXWOSK.mjs +503 -0
- package/dist/cli/chunk-I5YZLGMG.js +1 -0
- package/dist/cli/chunk-ITOFSXIU.mjs +15 -0
- package/dist/cli/chunk-J5NA2TTX.js +503 -0
- package/dist/cli/chunk-JCS5TPNY.mjs +3440 -0
- package/dist/cli/chunk-JNNOCMQY.js +47 -0
- package/dist/cli/chunk-KRD6H754.mjs +30 -0
- package/dist/cli/chunk-LA46MMTL.js +560 -0
- package/dist/cli/chunk-LDWT7RJK.mjs +190 -0
- package/dist/cli/chunk-M2V26OR5.js +499 -0
- package/dist/cli/chunk-MIMASXO4.mjs +389 -0
- package/dist/cli/chunk-MROPCKW2.mjs +190 -0
- package/dist/cli/chunk-NXDRDJ4K.js +389 -0
- package/dist/cli/chunk-NXGCO4JB.mjs +344 -0
- package/dist/cli/chunk-OG64RBAC.js +6 -0
- package/dist/cli/chunk-OQYEC4GL.mjs +34 -0
- package/dist/cli/chunk-OWJZUE3Y.mjs +103 -0
- package/dist/cli/chunk-SDK3ZA2C.js +103 -0
- package/dist/cli/chunk-SFLARO4Y.mjs +47 -0
- package/dist/cli/chunk-SVIIIYIQ.js +923 -0
- package/dist/cli/chunk-TAC3JIFE.mjs +354 -0
- package/dist/cli/chunk-U3PI7HBM.js +34 -0
- package/dist/cli/chunk-UFS752TU.mjs +52 -0
- package/dist/cli/chunk-UI37DQE7.mjs +499 -0
- package/dist/cli/chunk-UNEMDKXN.js +1 -0
- package/dist/cli/chunk-WB6Z2Q44.mjs +1622 -0
- package/dist/cli/chunk-WJYPBHTE.js +148 -0
- package/dist/cli/chunk-WOHBA5PV.js +354 -0
- package/dist/cli/chunk-WQICC2B3.js +190 -0
- package/dist/cli/chunk-WZYKRD7T.mjs +6 -0
- package/dist/cli/chunk-XL2FO6CW.mjs +5688 -0
- package/dist/cli/chunk-XNYIZMNQ.js +28 -0
- package/dist/cli/chunk-XRK2TZT5.js +1995 -0
- package/dist/cli/chunk-YJYPL5OK.mjs +1269 -0
- package/dist/cli/chunk-YWNDYCXR.mjs +735 -0
- package/dist/cli/chunk-YWWAF7KZ.mjs +923 -0
- package/dist/cli/chunk-ZDO3TO3M.js +1622 -0
- package/dist/cli/client-4JVOYVC5.js +20 -0
- package/dist/cli/client-EEN2IJN2.mjs +20 -0
- package/dist/cli/csv-BOHBEP2I.mjs +585 -0
- package/dist/cli/csv-S5NYRUEX.js +585 -0
- package/dist/cli/db-CLODWCOB.mjs +486 -0
- package/dist/cli/db-F6PKFOOV.js +486 -0
- package/dist/cli/executions-5TQAKLJU.js +28 -0
- package/dist/cli/executions-MAKW6QOY.mjs +28 -0
- package/dist/cli/feedback-GV4QJFEN.js +107 -0
- package/dist/cli/feedback-XY24TW7H.mjs +107 -0
- package/dist/cli/getting-started.js +18 -76
- package/dist/cli/getting-started.mjs +10 -37
- package/dist/cli/git-6S2C22T5.js +23 -0
- package/dist/cli/git-OZLBD5HH.mjs +23 -0
- package/dist/cli/index.js +291 -54294
- package/dist/cli/index.mjs +209 -54352
- package/dist/cli/legacy-noops-LLCGDPQE.js +157 -0
- package/dist/cli/legacy-noops-TYH3TW2D.mjs +157 -0
- package/dist/cli/monitors-CABMB4DW.js +3251 -0
- package/dist/cli/monitors-TTD55HMK.mjs +3251 -0
- package/dist/cli/org-MSF3RG76.js +849 -0
- package/dist/cli/org-SFJ77MWY.mjs +849 -0
- package/dist/cli/play-NXHJSCKL.mjs +18439 -0
- package/dist/cli/play-OKSFNNO4.js +18439 -0
- package/dist/cli/providers-QC2ERERL.js +95 -0
- package/dist/cli/providers-TIIAZEUA.mjs +95 -0
- package/dist/cli/proxy-env-EBANZHPV.js +161 -0
- package/dist/cli/proxy-env-M4ZHXHRL.mjs +161 -0
- package/dist/cli/quickstart-ICANHLMI.js +69 -0
- package/dist/cli/quickstart-KWUOP3FI.mjs +69 -0
- package/dist/cli/search-U5H2FDOO.mjs +18 -0
- package/dist/cli/search-XQRQOLWS.js +18 -0
- package/dist/cli/secrets-3J6YTWFA.mjs +400 -0
- package/dist/cli/secrets-YNMNZNOM.js +400 -0
- package/dist/cli/sessions-CLEES4L6.mjs +15 -0
- package/dist/cli/sessions-J6VR47FG.js +15 -0
- package/dist/cli/settings-EEKZMTY4.js +846 -0
- package/dist/cli/settings-UVLOQZRH.mjs +846 -0
- package/dist/cli/setup-DLMDXPGJ.mjs +1257 -0
- package/dist/cli/setup-HC4Q7QM4.js +1257 -0
- package/dist/cli/skills-33PHFBSB.mjs +28 -0
- package/dist/cli/skills-LFRY3KPX.js +28 -0
- package/dist/cli/tools-3COEPKML.mjs +2955 -0
- package/dist/cli/tools-QXEVCN45.js +2955 -0
- package/dist/cli/update-LSAC4FF5.mjs +28 -0
- package/dist/cli/update-NXHSPYXA.js +28 -0
- package/dist/cli/workflow-7S44OECF.mjs +1936 -0
- package/dist/cli/workflow-QPZWYSZE.js +1936 -0
- package/dist/helpers.js +6 -32
- package/dist/helpers.mjs +2 -0
- package/dist/index.js +1972 -12825
- package/dist/index.mjs +1910 -12672
- package/dist/install-integrity.json +110 -0
- package/dist/monitor-fleet-contract.js +31 -730
- package/dist/monitor-fleet-contract.mjs +18 -667
- package/dist/monitor-input-contract.js +10 -390
- package/dist/monitor-input-contract.mjs +7 -348
- package/dist/plays/bundle-play-file.mjs +13 -5178
- package/dist/plays/csv-data-input.js +5 -3132
- package/dist/plays/csv-data-input.mjs +5 -3105
- package/dist/plays/run-request.js +56 -664
- package/dist/plays/run-request.mjs +30 -588
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +5 -212
- package/dist/release.mjs +5 -185
- package/package.json +1 -1
|
@@ -1,392 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./cli/chunk-UNEMDKXN.js');
|
|
29
2
|
|
|
30
|
-
// src/monitor-input-contract.ts
|
|
31
|
-
var monitor_input_contract_exports = {};
|
|
32
|
-
__export(monitor_input_contract_exports, {
|
|
33
|
-
lintMonitorBatchInput: () => lintMonitorBatchInput,
|
|
34
|
-
lintMonitorSpecTemplate: () => lintMonitorSpecTemplate,
|
|
35
|
-
renderMonitorSpecTemplate: () => renderMonitorSpecTemplate
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(monitor_input_contract_exports);
|
|
38
3
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
function json(value, path, issues) {
|
|
49
|
-
if (value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value)) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
if (Array.isArray(value)) {
|
|
53
|
-
value.forEach((child, index) => json(child, `${path}.${index}`, issues));
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const object = record(value);
|
|
57
|
-
if (!object) {
|
|
58
|
-
issues.push({
|
|
59
|
-
severity: "error",
|
|
60
|
-
code: "invalid_monitor_json_value",
|
|
61
|
-
path,
|
|
62
|
-
message: "Monitor values must be JSON values."
|
|
63
|
-
});
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
for (const [key, child] of Object.entries(object)) {
|
|
67
|
-
json(child, `${path}.${key}`, issues);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function monitorSpec(value, path, issues) {
|
|
71
|
-
const input = record(value);
|
|
72
|
-
if (!input) {
|
|
73
|
-
issues.push({
|
|
74
|
-
severity: "error",
|
|
75
|
-
code: "invalid_monitor_spec",
|
|
76
|
-
path,
|
|
77
|
-
message: "A monitor must be a JSON object."
|
|
78
|
-
});
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
const allowed = /* @__PURE__ */ new Set(["key", "tool", "name", "payload"]);
|
|
82
|
-
for (const key2 of Object.keys(input)) {
|
|
83
|
-
if (!allowed.has(key2)) {
|
|
84
|
-
if (key2 === "controls") {
|
|
85
|
-
issues.push({
|
|
86
|
-
severity: "error",
|
|
87
|
-
code: "CONTROLS_NOT_SUPPORTED",
|
|
88
|
-
path: authoredMonitorFieldPath(path, "controls"),
|
|
89
|
-
message: "Operational controls are managed by Deepline and cannot be authored in Batch or Fleet JSON.",
|
|
90
|
-
suggestion: "Remove controls. Bind downstream automation in a Play with sqlListeners."
|
|
91
|
-
});
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
if (key2 === "play") {
|
|
95
|
-
issues.push({
|
|
96
|
-
severity: "error",
|
|
97
|
-
code: "PLAY_BINDING_NOT_IN_MONITOR_SPEC",
|
|
98
|
-
path: authoredMonitorFieldPath(path, "play"),
|
|
99
|
-
message: "A monitor does not own Play bindings.",
|
|
100
|
-
suggestion: "Declare sqlListeners in the Play, or run: deepline plays bootstrap monitor-triggered --out on-event.play.ts"
|
|
101
|
-
});
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
issues.push({
|
|
105
|
-
severity: "error",
|
|
106
|
-
code: "unknown_monitor_field",
|
|
107
|
-
path: `${path}.${key2}`,
|
|
108
|
-
message: `Monitor definitions do not accept '${key2}'.`
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
const key = typeof input.key === "string" ? input.key.trim() : "";
|
|
113
|
-
const tool = typeof input.tool === "string" ? input.tool.trim() : "";
|
|
114
|
-
const name = input.name === void 0 ? void 0 : typeof input.name === "string" && input.name.trim() ? input.name.trim() : null;
|
|
115
|
-
const payload = record(input.payload);
|
|
116
|
-
if (!key) {
|
|
117
|
-
issues.push({
|
|
118
|
-
severity: "error",
|
|
119
|
-
code: "invalid_monitor_key",
|
|
120
|
-
path: `${path}.key`,
|
|
121
|
-
message: "Monitor key must be a non-empty string."
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
if (!tool) {
|
|
125
|
-
issues.push({
|
|
126
|
-
severity: "error",
|
|
127
|
-
code: "invalid_monitor_tool",
|
|
128
|
-
path: `${path}.tool`,
|
|
129
|
-
message: "Monitor tool must be a non-empty literal string."
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
if (name === null) {
|
|
133
|
-
issues.push({
|
|
134
|
-
severity: "error",
|
|
135
|
-
code: "invalid_monitor_name",
|
|
136
|
-
path: `${path}.name`,
|
|
137
|
-
message: "Monitor name must be a non-empty string when supplied."
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
if (!payload) {
|
|
141
|
-
issues.push({
|
|
142
|
-
severity: "error",
|
|
143
|
-
code: "invalid_monitor_payload",
|
|
144
|
-
path: `${path}.payload`,
|
|
145
|
-
message: "Monitor payload must be an object."
|
|
146
|
-
});
|
|
147
|
-
} else {
|
|
148
|
-
json(payload, `${path}.payload`, issues);
|
|
149
|
-
}
|
|
150
|
-
if (!key || !tool || !payload || name === null) {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
return {
|
|
154
|
-
key,
|
|
155
|
-
tool,
|
|
156
|
-
...name ? { name } : {},
|
|
157
|
-
payload
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
function issueOrder(left, right) {
|
|
161
|
-
return left.path.localeCompare(right.path) || left.severity.localeCompare(right.severity) || left.code.localeCompare(right.code);
|
|
162
|
-
}
|
|
163
|
-
function lintMonitorBatchInput(value) {
|
|
164
|
-
const issues = [];
|
|
165
|
-
const versionlessEnvelope = !Array.isArray(value) && (() => {
|
|
166
|
-
const candidate = record(value);
|
|
167
|
-
return candidate !== null && Object.keys(candidate).length === 1 && Object.prototype.hasOwnProperty.call(candidate, "monitors");
|
|
168
|
-
})();
|
|
169
|
-
const legacy = Array.isArray(value) || versionlessEnvelope;
|
|
170
|
-
const input = legacy ? null : record(value);
|
|
171
|
-
let monitors = Array.isArray(value) ? value : versionlessEnvelope ? (() => {
|
|
172
|
-
const candidate = record(value)?.monitors;
|
|
173
|
-
return Array.isArray(candidate) ? candidate : null;
|
|
174
|
-
})() : null;
|
|
175
|
-
if (Array.isArray(value)) {
|
|
176
|
-
issues.push({
|
|
177
|
-
severity: "warning",
|
|
178
|
-
code: "deprecated_batch_array",
|
|
179
|
-
path: "",
|
|
180
|
-
message: "Bare monitor arrays are supported for compatibility.",
|
|
181
|
-
suggestion: 'Wrap the list in {"version":1,"kind":"batch","monitors":[...]}.'
|
|
182
|
-
});
|
|
183
|
-
} else if (versionlessEnvelope) {
|
|
184
|
-
issues.push({
|
|
185
|
-
severity: "warning",
|
|
186
|
-
code: "deprecated_batch_missing_envelope_fields",
|
|
187
|
-
path: "",
|
|
188
|
-
message: "Versionless monitor envelopes are supported for compatibility.",
|
|
189
|
-
suggestion: 'Add "version": 1 and "kind": "batch".'
|
|
190
|
-
});
|
|
191
|
-
if (!monitors) {
|
|
192
|
-
issues.push({
|
|
193
|
-
severity: "error",
|
|
194
|
-
code: "invalid_batch_monitors",
|
|
195
|
-
path: "monitors",
|
|
196
|
-
message: "Batch monitors must be an array."
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
} else if (!input) {
|
|
200
|
-
issues.push({
|
|
201
|
-
severity: "error",
|
|
202
|
-
code: "invalid_batch",
|
|
203
|
-
path: "",
|
|
204
|
-
message: "Batch input must be an object or a legacy array."
|
|
205
|
-
});
|
|
206
|
-
} else {
|
|
207
|
-
for (const key of Object.keys(input)) {
|
|
208
|
-
if (!["version", "kind", "monitors"].includes(key)) {
|
|
209
|
-
issues.push({
|
|
210
|
-
severity: "error",
|
|
211
|
-
code: key === "source" || key === "monitor" ? "batch_fleet_shape_mixup" : "unknown_batch_field",
|
|
212
|
-
path: key,
|
|
213
|
-
message: `Batch input does not accept '${key}'.`
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
if (input.version !== 1) {
|
|
218
|
-
issues.push({
|
|
219
|
-
severity: "error",
|
|
220
|
-
code: "unsupported_batch_version",
|
|
221
|
-
path: "version",
|
|
222
|
-
message: "Batch input version must be 1."
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
if (input.kind !== "batch") {
|
|
226
|
-
issues.push({
|
|
227
|
-
severity: "error",
|
|
228
|
-
code: "invalid_batch_kind",
|
|
229
|
-
path: "kind",
|
|
230
|
-
message: 'Batch input kind must be "batch".'
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
monitors = Array.isArray(input.monitors) ? input.monitors : null;
|
|
234
|
-
if (!monitors) {
|
|
235
|
-
issues.push({
|
|
236
|
-
severity: "error",
|
|
237
|
-
code: "invalid_batch_monitors",
|
|
238
|
-
path: "monitors",
|
|
239
|
-
message: "Batch monitors must be an array."
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
if (!monitors || monitors.length === 0) {
|
|
244
|
-
if (monitors?.length === 0) {
|
|
245
|
-
issues.push({
|
|
246
|
-
severity: "error",
|
|
247
|
-
code: "empty_batch",
|
|
248
|
-
path: "monitors",
|
|
249
|
-
message: "A Batch needs at least one monitor."
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
return { issues: issues.sort(issueOrder) };
|
|
253
|
-
}
|
|
254
|
-
const normalized = monitors.map(
|
|
255
|
-
(item, index) => monitorSpec(item, `monitors.${index}`, issues)
|
|
256
|
-
);
|
|
257
|
-
const seen = /* @__PURE__ */ new Map();
|
|
258
|
-
normalized.forEach((item, index) => {
|
|
259
|
-
if (!item) return;
|
|
260
|
-
const first = seen.get(item.key);
|
|
261
|
-
if (first !== void 0) {
|
|
262
|
-
for (const position of [first, index]) {
|
|
263
|
-
issues.push({
|
|
264
|
-
severity: "error",
|
|
265
|
-
code: "duplicate_monitor_key",
|
|
266
|
-
path: `monitors.${position}.key`,
|
|
267
|
-
message: `Duplicate monitor key '${item.key}'.`
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
} else {
|
|
271
|
-
seen.set(item.key, index);
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
const ordered = issues.sort(issueOrder);
|
|
275
|
-
return ordered.some((issue) => issue.severity === "error") ? { issues: ordered } : {
|
|
276
|
-
normalized: {
|
|
277
|
-
version: 1,
|
|
278
|
-
kind: "batch",
|
|
279
|
-
monitors: normalized
|
|
280
|
-
},
|
|
281
|
-
issues: ordered
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
function validateHandlebars(value, path, issues) {
|
|
285
|
-
if (!value.includes("{{")) return;
|
|
286
|
-
try {
|
|
287
|
-
import_handlebars.default.parse(value);
|
|
288
|
-
} catch (error) {
|
|
289
|
-
issues.push({
|
|
290
|
-
severity: "error",
|
|
291
|
-
code: "invalid_handlebars_template",
|
|
292
|
-
path,
|
|
293
|
-
message: error instanceof Error ? error.message : "Invalid Handlebars template."
|
|
294
|
-
});
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
const expressions = value.match(/{{[\s\S]*?}}/g) ?? [];
|
|
298
|
-
if (expressions.some(
|
|
299
|
-
(expression) => !/^{{\s*[A-Za-z_][A-Za-z0-9_]*\s*}}$/.test(expression)
|
|
300
|
-
)) {
|
|
301
|
-
issues.push({
|
|
302
|
-
severity: "error",
|
|
303
|
-
code: "unsupported_handlebars_expression",
|
|
304
|
-
path,
|
|
305
|
-
message: "Fleet templates allow only direct source-row fields such as {{domain}}; helpers, blocks, partials, paths, and prototype access are disabled."
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
function walkTemplates(value, path, issues) {
|
|
310
|
-
if (typeof value === "string") return validateHandlebars(value, path, issues);
|
|
311
|
-
if (Array.isArray(value)) {
|
|
312
|
-
value.forEach(
|
|
313
|
-
(item, index) => walkTemplates(item, `${path}.${index}`, issues)
|
|
314
|
-
);
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
const input = record(value);
|
|
318
|
-
if (!input) return;
|
|
319
|
-
for (const [key, child] of Object.entries(input)) {
|
|
320
|
-
walkTemplates(child, `${path}.${key}`, issues);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
function lintMonitorSpecTemplate(value, path = "monitor") {
|
|
324
|
-
const issues = [];
|
|
325
|
-
const normalized = monitorSpec(value, path, issues);
|
|
326
|
-
const input = record(value);
|
|
327
|
-
if (input && typeof input.tool === "string" && input.tool.includes("{{")) {
|
|
328
|
-
issues.push({
|
|
329
|
-
severity: "error",
|
|
330
|
-
code: "templated_monitor_tool",
|
|
331
|
-
path: `${path}.tool`,
|
|
332
|
-
message: "Fleet monitor tool must be literal; only key, name, and payload may be templated."
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
if (input) {
|
|
336
|
-
for (const field of ["key", "name", "payload"]) {
|
|
337
|
-
if (input[field] !== void 0)
|
|
338
|
-
walkTemplates(input[field], `${path}.${field}`, issues);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
const ordered = issues.sort(issueOrder);
|
|
342
|
-
return ordered.some((issue) => issue.severity === "error") ? { issues: ordered } : { normalized, issues: ordered };
|
|
343
|
-
}
|
|
344
|
-
function renderValue(value, row) {
|
|
345
|
-
if (typeof value === "string" && value.includes("{{")) {
|
|
346
|
-
const context = Object.assign(/* @__PURE__ */ Object.create(null), row);
|
|
347
|
-
return import_handlebars.default.compile(value, {
|
|
348
|
-
noEscape: true,
|
|
349
|
-
strict: true,
|
|
350
|
-
knownHelpersOnly: true,
|
|
351
|
-
preventIndent: true
|
|
352
|
-
})(context, {
|
|
353
|
-
allowProtoMethodsByDefault: false,
|
|
354
|
-
allowProtoPropertiesByDefault: false,
|
|
355
|
-
helpers: /* @__PURE__ */ Object.create(null),
|
|
356
|
-
partials: /* @__PURE__ */ Object.create(null)
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
if (Array.isArray(value)) return value.map((item) => renderValue(item, row));
|
|
360
|
-
const input = record(value);
|
|
361
|
-
if (!input) return value;
|
|
362
|
-
return Object.fromEntries(
|
|
363
|
-
Object.entries(input).map(([key, item]) => [key, renderValue(item, row)])
|
|
364
|
-
);
|
|
365
|
-
}
|
|
366
|
-
function renderMonitorSpecTemplate(template, row) {
|
|
367
|
-
const lint = lintMonitorSpecTemplate(template);
|
|
368
|
-
if (!lint.normalized) return { issues: lint.issues };
|
|
369
|
-
try {
|
|
370
|
-
const rendered = renderValue(lint.normalized, row);
|
|
371
|
-
const issues = [];
|
|
372
|
-
const spec = monitorSpec(rendered, "monitor", issues);
|
|
373
|
-
return spec ? { spec, issues: issues.sort(issueOrder) } : { issues: issues.sort(issueOrder) };
|
|
374
|
-
} catch (error) {
|
|
375
|
-
return {
|
|
376
|
-
issues: [
|
|
377
|
-
{
|
|
378
|
-
severity: "error",
|
|
379
|
-
code: "monitor_template_render_failed",
|
|
380
|
-
path: "monitor",
|
|
381
|
-
message: error instanceof Error ? error.message : "Fleet template rendering failed."
|
|
382
|
-
}
|
|
383
|
-
]
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
388
|
-
0 && (module.exports = {
|
|
389
|
-
lintMonitorBatchInput,
|
|
390
|
-
lintMonitorSpecTemplate,
|
|
391
|
-
renderMonitorSpecTemplate
|
|
392
|
-
});
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWOHBA5PVjs = require('./cli/chunk-WOHBA5PV.js');
|
|
7
|
+
require('./cli/chunk-COGTRVWW.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.lintMonitorBatchInput = _chunkWOHBA5PVjs.lintMonitorBatchInput; exports.lintMonitorSpecTemplate = _chunkWOHBA5PVjs.lintMonitorSpecTemplate; exports.renderMonitorSpecTemplate = _chunkWOHBA5PVjs.renderMonitorSpecTemplate;
|