@walkeros/cli 4.0.0 → 4.0.1-next-1778068549946
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/CHANGELOG.md +50 -0
- package/README.md +68 -9
- package/dist/cli.js +1155 -979
- package/dist/examples/README.md +3 -3
- package/dist/examples/flow-complete.json +4 -6
- package/dist/examples/flow-complete.md +8 -10
- package/dist/examples/index.js +4 -6
- package/dist/examples/index.js.map +1 -1
- package/dist/index.d.ts +6 -21
- package/dist/index.js +69 -27
- package/dist/index.js.map +1 -1
- package/examples/README.md +3 -3
- package/examples/flow-complete.json +4 -6
- package/examples/flow-complete.md +8 -10
- package/package.json +7 -7
package/dist/cli.js
CHANGED
|
@@ -92,291 +92,311 @@ var init_api_error = __esm({
|
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
// ../core/dist/index.mjs
|
|
95
|
-
function
|
|
95
|
+
function $(e3) {
|
|
96
96
|
return { _meta: { hops: 0, path: [e3] } };
|
|
97
97
|
}
|
|
98
98
|
function O(e3) {
|
|
99
99
|
throw new Error(String(e3));
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function _(e3) {
|
|
102
102
|
const t3 = {}, n4 = /* @__PURE__ */ new Set();
|
|
103
|
-
function o2
|
|
104
|
-
if (t3[
|
|
105
|
-
n4.has(
|
|
106
|
-
const i2 = e3[
|
|
107
|
-
i2 || O(`Contract "${
|
|
108
|
-
let
|
|
103
|
+
function r3(o2) {
|
|
104
|
+
if (t3[o2]) return t3[o2];
|
|
105
|
+
n4.has(o2) && O(`Circular extends chain detected: ${[...n4, o2].join(" \u2192 ")}`);
|
|
106
|
+
const i2 = e3[o2];
|
|
107
|
+
i2 || O(`Contract "${o2}" not found`), n4.add(o2);
|
|
108
|
+
let a3 = {};
|
|
109
109
|
if (i2.extends) {
|
|
110
|
-
|
|
110
|
+
a3 = (function(e4, t4) {
|
|
111
111
|
const n5 = {};
|
|
112
112
|
void 0 === e4.description && void 0 === t4.description || (n5.description = t4.description ?? e4.description);
|
|
113
|
-
for (const
|
|
114
|
-
const
|
|
115
|
-
|
|
113
|
+
for (const r4 of A) {
|
|
114
|
+
const o3 = e4[r4], i3 = t4[r4];
|
|
115
|
+
o3 && i3 ? n5[r4] = E(o3, i3) : (o3 || i3) && (n5[r4] = { ...o3 || i3 });
|
|
116
116
|
}
|
|
117
117
|
if (e4.events || t4.events) {
|
|
118
|
-
const
|
|
119
|
-
for (const n6 of
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
for (const e5 of
|
|
123
|
-
const t5 =
|
|
124
|
-
|
|
118
|
+
const r4 = {}, o3 = /* @__PURE__ */ new Set([...Object.keys(e4.events || {}), ...Object.keys(t4.events || {})]);
|
|
119
|
+
for (const n6 of o3) {
|
|
120
|
+
const o4 = e4.events?.[n6] || {}, i3 = t4.events?.[n6] || {}, a4 = /* @__PURE__ */ new Set([...Object.keys(o4), ...Object.keys(i3)]);
|
|
121
|
+
r4[n6] = {};
|
|
122
|
+
for (const e5 of a4) {
|
|
123
|
+
const t5 = o4[e5], a5 = i3[e5];
|
|
124
|
+
r4[n6][e5] = t5 && a5 ? E(t5, a5) : { ...t5 || a5 };
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
n5.events =
|
|
127
|
+
n5.events = r4;
|
|
128
128
|
}
|
|
129
129
|
return n5;
|
|
130
|
-
})(
|
|
131
|
-
} else
|
|
132
|
-
if (delete
|
|
130
|
+
})(r3(i2.extends), i2);
|
|
131
|
+
} else a3 = { ...i2 };
|
|
132
|
+
if (delete a3.extends, a3.events && (a3.events = (function(e4) {
|
|
133
133
|
const t4 = {};
|
|
134
134
|
for (const n5 of Object.keys(e4)) if ("*" !== n5) {
|
|
135
135
|
t4[n5] = {};
|
|
136
|
-
for (const
|
|
137
|
-
let
|
|
136
|
+
for (const r4 of Object.keys(e4[n5] || {})) {
|
|
137
|
+
let o3 = {};
|
|
138
138
|
const i3 = e4["*"]?.["*"];
|
|
139
|
-
i3 && (
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
const c3 = e4[n5]?.[
|
|
145
|
-
c3 && (
|
|
139
|
+
i3 && (o3 = E(o3, i3));
|
|
140
|
+
const a4 = e4["*"]?.[r4];
|
|
141
|
+
a4 && "*" !== r4 && (o3 = E(o3, a4));
|
|
142
|
+
const s5 = e4[n5]?.["*"];
|
|
143
|
+
s5 && "*" !== r4 && (o3 = E(o3, s5));
|
|
144
|
+
const c3 = e4[n5]?.[r4];
|
|
145
|
+
c3 && (o3 = E(o3, c3)), t4[n5][r4] = o3;
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
e4["*"] && (t4["*"] = { ...e4["*"] });
|
|
149
149
|
return t4;
|
|
150
|
-
})(
|
|
150
|
+
})(a3.events)), a3.events) {
|
|
151
151
|
const e4 = {};
|
|
152
|
-
for (const [t4, n5] of Object.entries(
|
|
152
|
+
for (const [t4, n5] of Object.entries(a3.events)) {
|
|
153
153
|
e4[t4] = {};
|
|
154
|
-
for (const [
|
|
154
|
+
for (const [r4, o3] of Object.entries(n5)) e4[t4][r4] = N(o3);
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
a3.events = e4;
|
|
157
157
|
}
|
|
158
|
-
return n4.delete(
|
|
158
|
+
return n4.delete(o2), t3[o2] = a3, a3;
|
|
159
159
|
}
|
|
160
|
-
for (const t4 of Object.keys(e3))
|
|
160
|
+
for (const t4 of Object.keys(e3)) r3(t4);
|
|
161
161
|
return t3;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function E(e3, t3) {
|
|
164
164
|
const n4 = { ...e3 };
|
|
165
|
-
for (const
|
|
166
|
-
const
|
|
167
|
-
"required" ===
|
|
165
|
+
for (const r3 of Object.keys(t3)) {
|
|
166
|
+
const o2 = e3[r3], i2 = t3[r3];
|
|
167
|
+
"required" === r3 && Array.isArray(o2) && Array.isArray(i2) ? n4[r3] = [.../* @__PURE__ */ new Set([...o2, ...i2])] : C(o2) && C(i2) ? n4[r3] = E(o2, i2) : n4[r3] = i2;
|
|
168
168
|
}
|
|
169
169
|
return n4;
|
|
170
170
|
}
|
|
171
171
|
function N(e3) {
|
|
172
172
|
const t3 = {};
|
|
173
|
-
for (const [n4,
|
|
173
|
+
for (const [n4, r3] of Object.entries(e3)) S.has(n4) || (null === r3 || "object" != typeof r3 || Array.isArray(r3) ? t3[n4] = r3 : t3[n4] = N(r3));
|
|
174
174
|
return t3;
|
|
175
175
|
}
|
|
176
176
|
function C(e3) {
|
|
177
177
|
return "object" == typeof e3 && null !== e3 && !Array.isArray(e3);
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function W(...e3) {
|
|
180
180
|
const t3 = {};
|
|
181
181
|
for (const n4 of e3) n4 && Object.assign(t3, n4);
|
|
182
182
|
return t3;
|
|
183
183
|
}
|
|
184
|
-
function U(
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
return t3
|
|
184
|
+
function U(e3, t3, n4) {
|
|
185
|
+
const r3 = `$flow.${e3}${t3 ? `.${t3}` : ""}`;
|
|
186
|
+
if ("unknown-flow" === n4) return `${r3} cannot resolve: flow "${e3}" does not exist in this config.`;
|
|
187
|
+
return `${r3} is empty. Set ${t3 ? `flows.${e3}.config.${t3}` : `flows.${e3}.config`}, or run \`walkeros deploy ${e3}\` first.`;
|
|
188
188
|
}
|
|
189
189
|
function D(e3, t3, n4) {
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
for (let e4 = 0; e4 < o2.length; e4++) {
|
|
198
|
-
const i2 = o2[e4];
|
|
199
|
-
if (null == r3 || "object" != typeof r3) {
|
|
200
|
-
const r4 = o2.slice(0, e4).join(".");
|
|
201
|
-
O(`Path "${t3}" not found in "${n4}": "${i2}" does not exist${r4 ? ` in "${r4}"` : ""}`);
|
|
190
|
+
const r3 = t3.split(".");
|
|
191
|
+
let o2 = e3;
|
|
192
|
+
for (let e4 = 0; e4 < r3.length; e4++) {
|
|
193
|
+
const i2 = r3[e4];
|
|
194
|
+
if (null == o2 || "object" != typeof o2) {
|
|
195
|
+
const o3 = r3.slice(0, e4).join(".");
|
|
196
|
+
O(`Path "${t3}" not found in "${n4}": "${i2}" does not exist${o3 ? ` in "${o3}"` : ""}`);
|
|
202
197
|
}
|
|
203
|
-
const
|
|
204
|
-
if (!(i2 in
|
|
205
|
-
const
|
|
206
|
-
O(`Path "${t3}" not found in "${n4}": "${i2}" does not exist${
|
|
198
|
+
const a3 = o2;
|
|
199
|
+
if (!(i2 in a3)) {
|
|
200
|
+
const o3 = r3.slice(0, e4).join(".");
|
|
201
|
+
O(`Path "${t3}" not found in "${n4}": "${i2}" does not exist${o3 ? ` in "${o3}"` : ""}`);
|
|
207
202
|
}
|
|
208
|
-
|
|
203
|
+
o2 = a3[i2];
|
|
209
204
|
}
|
|
210
|
-
return
|
|
205
|
+
return o2;
|
|
211
206
|
}
|
|
212
|
-
function
|
|
207
|
+
function L(e3, t3, n4, r3, o2, i2) {
|
|
213
208
|
if ("string" == typeof e3) {
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
216
|
-
const e4 =
|
|
217
|
-
void 0 ===
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
209
|
+
const a3 = e3.match(z);
|
|
210
|
+
if (a3) {
|
|
211
|
+
const e4 = a3[1].split("."), s6 = e4[0], c4 = e4.slice(1).join(".");
|
|
212
|
+
void 0 === t3[s6] && O(`Variable "${s6}" not found`);
|
|
213
|
+
const l3 = i2 ?? /* @__PURE__ */ new Set();
|
|
214
|
+
if (l3.has(s6)) {
|
|
215
|
+
O(`Cyclic $var reference: ${[...l3, s6].join(" -> ")}`);
|
|
216
|
+
}
|
|
217
|
+
let u3;
|
|
218
|
+
l3.add(s6);
|
|
219
|
+
try {
|
|
220
|
+
u3 = L(t3[s6], t3, n4, r3, o2, l3);
|
|
221
|
+
} finally {
|
|
222
|
+
l3.delete(s6);
|
|
223
|
+
}
|
|
224
|
+
return c4 && (u3 = D(u3, c4, `$var.${s6}`)), u3;
|
|
225
|
+
}
|
|
226
|
+
const s5 = e3.match(R);
|
|
227
|
+
if (s5 && r3) {
|
|
228
|
+
const e4 = s5[1], t4 = s5[2];
|
|
224
229
|
e4 in r3 || O(`Contract "${e4}" not found`);
|
|
225
230
|
let n5 = r3[e4];
|
|
226
|
-
return t4 && (n5 =
|
|
231
|
+
return t4 && (n5 = D(n5, t4, `$contract.${e4}`)), n5;
|
|
227
232
|
}
|
|
228
|
-
const c3 = e3.match(
|
|
233
|
+
const c3 = e3.match(T);
|
|
229
234
|
if (c3) {
|
|
230
|
-
const t4 = c3[1],
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
if (!
|
|
234
|
-
if (
|
|
235
|
+
const t4 = c3[1], r4 = c3[2], i3 = false === n4?.strictFlowRefs;
|
|
236
|
+
o2 || O(`$flow.${t4}${r4 ? `.${r4}` : ""} cannot be resolved without a flow resolver`);
|
|
237
|
+
const a4 = o2(t4);
|
|
238
|
+
if (!a4) {
|
|
239
|
+
if (i3) return n4?.onWarning?.(U(t4, r4, "unknown-flow")), e3;
|
|
235
240
|
O(`Flow "${t4}" not found in $flow.${t4}`);
|
|
236
241
|
}
|
|
237
|
-
let
|
|
238
|
-
if (
|
|
242
|
+
let s6 = a4;
|
|
243
|
+
if (r4) if (i3) {
|
|
239
244
|
try {
|
|
240
|
-
|
|
245
|
+
s6 = D(s6, r4, `$flow.${t4}`);
|
|
241
246
|
} catch {
|
|
242
|
-
return
|
|
247
|
+
return n4?.onWarning?.(U(t4, r4, "missing-key")), e3;
|
|
243
248
|
}
|
|
244
|
-
if (null ==
|
|
245
|
-
} else
|
|
246
|
-
return
|
|
247
|
-
}
|
|
248
|
-
let l2 = e3.replace(P, (e4,
|
|
249
|
-
|
|
250
|
-
O(`Variable "${
|
|
249
|
+
if (null == s6 || "" === s6) return n4?.onWarning?.(U(t4, r4, "missing-key")), e3;
|
|
250
|
+
} else s6 = D(s6, r4, `$flow.${t4}`);
|
|
251
|
+
return s6;
|
|
252
|
+
}
|
|
253
|
+
let l2 = e3.replace(P, (e4, a4) => {
|
|
254
|
+
const s6 = a4.split("."), c4 = s6[0], l3 = s6.slice(1).join(".");
|
|
255
|
+
void 0 === t3[c4] && O(`Variable "${c4}" not found`);
|
|
256
|
+
const u3 = i2 ?? /* @__PURE__ */ new Set();
|
|
257
|
+
if (u3.has(c4)) {
|
|
258
|
+
O(`Cyclic $var reference: ${[...u3, c4].join(" -> ")}`);
|
|
259
|
+
}
|
|
260
|
+
let f2;
|
|
261
|
+
u3.add(c4);
|
|
262
|
+
try {
|
|
263
|
+
f2 = L(t3[c4], t3, n4, r3, o2, u3);
|
|
264
|
+
} finally {
|
|
265
|
+
u3.delete(c4);
|
|
266
|
+
}
|
|
267
|
+
if (l3 && (f2 = D(f2, l3, `$var.${c4}`)), null === f2 || "string" != typeof f2 && "number" != typeof f2 && "boolean" != typeof f2) {
|
|
268
|
+
O(`Variable "${a4}" resolves to non-scalar (${Array.isArray(f2) ? "array" : typeof f2}) and cannot be inlined into a string. Use it as a whole-string reference: "$var.${a4}"`);
|
|
269
|
+
}
|
|
270
|
+
return String(f2);
|
|
251
271
|
});
|
|
252
|
-
return l2 = l2.replace(
|
|
272
|
+
return l2 = l2.replace(M, (e4, t4, r4) => n4?.deferred ? void 0 !== r4 ? `${F}${t4}:${r4}` : `${F}${t4}` : "undefined" != typeof process && void 0 !== process.env?.[t4] ? process.env[t4] : void 0 !== r4 ? r4 : void O(`Environment variable "${t4}" not found and no default provided`)), l2;
|
|
253
273
|
}
|
|
254
|
-
if (Array.isArray(e3)) return e3.map((e4) =>
|
|
274
|
+
if (Array.isArray(e3)) return e3.map((e4) => L(e4, t3, n4, r3, o2, i2));
|
|
255
275
|
if (null !== e3 && "object" == typeof e3) {
|
|
256
|
-
const
|
|
257
|
-
for (const [
|
|
258
|
-
return
|
|
276
|
+
const a3 = {};
|
|
277
|
+
for (const [s5, c3] of Object.entries(e3)) a3[s5] = L(c3, t3, n4, r3, o2, i2);
|
|
278
|
+
return a3;
|
|
259
279
|
}
|
|
260
280
|
return e3;
|
|
261
281
|
}
|
|
262
|
-
function
|
|
282
|
+
function V(e3) {
|
|
263
283
|
const t3 = e3.startsWith("@"), n4 = e3.replace("@", "").replace(/[/-]/g, "_").split("_").filter((e4) => e4.length > 0).map((e4, t4) => 0 === t4 ? e4 : e4.charAt(0).toUpperCase() + e4.slice(1)).join("");
|
|
264
284
|
return t3 ? "_" + n4 : n4;
|
|
265
285
|
}
|
|
266
|
-
function
|
|
286
|
+
function B(e3, t3, n4) {
|
|
267
287
|
if (t3) return t3;
|
|
268
288
|
if (!e3 || !n4) return;
|
|
269
|
-
return n4[e3] ?
|
|
270
|
-
}
|
|
271
|
-
function
|
|
272
|
-
const
|
|
273
|
-
if (
|
|
274
|
-
const
|
|
275
|
-
if (
|
|
276
|
-
if (
|
|
289
|
+
return n4[e3] ? V(e3) : void 0;
|
|
290
|
+
}
|
|
291
|
+
function K(e3, t3, n4) {
|
|
292
|
+
const r3 = /* @__PURE__ */ new Map(), o2 = /* @__PURE__ */ new Set(), i2 = [], a3 = (t4) => {
|
|
293
|
+
if (r3.has(t4)) return r3.get(t4);
|
|
294
|
+
const s6 = e3.flows[t4];
|
|
295
|
+
if (s6) {
|
|
296
|
+
if (o2.has(t4)) {
|
|
277
297
|
O(`Cyclic $flow reference: ${[...i2, t4].join(" -> ")}`);
|
|
278
298
|
}
|
|
279
|
-
|
|
299
|
+
o2.add(t4), i2.push(t4);
|
|
280
300
|
try {
|
|
281
|
-
const
|
|
282
|
-
return
|
|
301
|
+
const o3 = W(e3.variables, s6.variables), i3 = L(s6.config ?? {}, o3, n4, void 0, a3);
|
|
302
|
+
return r3.set(t4, i3), i3;
|
|
283
303
|
} finally {
|
|
284
|
-
|
|
304
|
+
o2.delete(t4), i2.pop();
|
|
285
305
|
}
|
|
286
306
|
}
|
|
287
|
-
},
|
|
288
|
-
t3 || (1 ===
|
|
307
|
+
}, s5 = Object.keys(e3.flows);
|
|
308
|
+
t3 || (1 === s5.length ? t3 = s5[0] : O(`Multiple flows found (${s5.join(", ")}). Please specify a flow.`));
|
|
289
309
|
const c3 = e3.flows[t3];
|
|
290
|
-
c3 || O(`Flow "${t3}" not found. Available: ${
|
|
310
|
+
c3 || O(`Flow "${t3}" not found. Available: ${s5.join(", ")}`), o2.add(t3), i2.push(t3);
|
|
291
311
|
try {
|
|
292
|
-
return (function(e4, t4, n5,
|
|
293
|
-
const
|
|
312
|
+
return (function(e4, t4, n5, r4) {
|
|
313
|
+
const o3 = JSON.parse(JSON.stringify(t4));
|
|
294
314
|
let i3;
|
|
295
315
|
if (e4.contract) {
|
|
296
|
-
const
|
|
297
|
-
i3 =
|
|
316
|
+
const o4 = W(e4.variables, t4.variables);
|
|
317
|
+
i3 = _(L(e4.contract, o4, n5, void 0, r4));
|
|
298
318
|
}
|
|
299
|
-
if (
|
|
300
|
-
const
|
|
301
|
-
|
|
319
|
+
if (o3.config) {
|
|
320
|
+
const a4 = W(e4.variables, t4.variables);
|
|
321
|
+
o3.config = L(o3.config, a4, n5, i3, r4);
|
|
302
322
|
}
|
|
303
|
-
if (
|
|
304
|
-
const c4 =
|
|
305
|
-
|
|
323
|
+
if (o3.sources) for (const [a4, s6] of Object.entries(o3.sources)) {
|
|
324
|
+
const c4 = W(e4.variables, t4.variables, s6.variables), l2 = L(s6.config, c4, n5, i3, r4), u3 = L(s6.env, c4, n5, i3, r4), f2 = B(s6.package, s6.code, o3.config?.bundle?.packages), p2 = "string" == typeof s6.code || "object" == typeof s6.code ? s6.code : void 0, d2 = f2 || p2;
|
|
325
|
+
o3.sources[a4] = { package: s6.package, config: l2, env: u3, primary: s6.primary, variables: s6.variables, before: s6.before, next: s6.next, cache: s6.cache, code: d2 };
|
|
306
326
|
}
|
|
307
|
-
if (
|
|
308
|
-
const c4 =
|
|
309
|
-
|
|
327
|
+
if (o3.destinations) for (const [a4, s6] of Object.entries(o3.destinations)) {
|
|
328
|
+
const c4 = W(e4.variables, t4.variables, s6.variables), l2 = L(s6.config, c4, n5, i3, r4), u3 = L(s6.env, c4, n5, i3, r4), f2 = B(s6.package, s6.code, o3.config?.bundle?.packages), p2 = "string" == typeof s6.code || "object" == typeof s6.code ? s6.code : void 0, d2 = f2 || p2;
|
|
329
|
+
o3.destinations[a4] = { package: s6.package, config: l2, env: u3, variables: s6.variables, before: s6.before, next: s6.next, cache: s6.cache, code: d2 };
|
|
310
330
|
}
|
|
311
|
-
if (
|
|
312
|
-
const c4 =
|
|
313
|
-
|
|
331
|
+
if (o3.stores) for (const [a4, s6] of Object.entries(o3.stores)) {
|
|
332
|
+
const c4 = W(e4.variables, t4.variables, s6.variables), l2 = L(s6.config, c4, n5, i3, r4), u3 = L(s6.env, c4, n5, i3, r4), f2 = B(s6.package, s6.code, o3.config?.bundle?.packages), p2 = "string" == typeof s6.code || "object" == typeof s6.code ? s6.code : void 0, d2 = f2 || p2;
|
|
333
|
+
o3.stores[a4] = { package: s6.package, config: l2, env: u3, variables: s6.variables, code: d2 };
|
|
314
334
|
}
|
|
315
|
-
if (
|
|
316
|
-
const c4 =
|
|
317
|
-
|
|
335
|
+
if (o3.transformers) for (const [a4, s6] of Object.entries(o3.transformers)) {
|
|
336
|
+
const c4 = W(e4.variables, t4.variables, s6.variables), l2 = L(s6.config, c4, n5, i3, r4), u3 = L(s6.env, c4, n5, i3, r4), f2 = B(s6.package, s6.code, o3.config?.bundle?.packages), p2 = "string" == typeof s6.code || "object" == typeof s6.code ? s6.code : void 0, d2 = f2 || p2;
|
|
337
|
+
o3.transformers[a4] = { package: s6.package, config: l2, env: u3, variables: s6.variables, before: s6.before, next: s6.next, cache: s6.cache, code: d2 };
|
|
318
338
|
}
|
|
319
|
-
if (
|
|
320
|
-
const
|
|
321
|
-
|
|
339
|
+
if (o3.collector) {
|
|
340
|
+
const a4 = W(e4.variables, t4.variables), s6 = L(o3.collector, a4, n5, i3, r4);
|
|
341
|
+
o3.collector = s6;
|
|
322
342
|
}
|
|
323
|
-
return
|
|
324
|
-
})(e3, c3, n4,
|
|
343
|
+
return o3;
|
|
344
|
+
})(e3, c3, n4, a3);
|
|
325
345
|
} finally {
|
|
326
|
-
|
|
346
|
+
o2.delete(t3), i2.pop();
|
|
327
347
|
}
|
|
328
348
|
}
|
|
329
|
-
function
|
|
349
|
+
function q(e3) {
|
|
330
350
|
const t3 = e3.config?.platform;
|
|
331
351
|
if ("web" === t3 || "server" === t3) return t3;
|
|
332
352
|
O('Flow must have config.platform set to "web" or "server"');
|
|
333
353
|
}
|
|
334
|
-
function
|
|
335
|
-
n4 = { ...
|
|
336
|
-
const
|
|
337
|
-
const i2 = e3[
|
|
338
|
-
return n4.merge && Array.isArray(i2) && Array.isArray(
|
|
354
|
+
function X(e3, t3 = {}, n4 = {}) {
|
|
355
|
+
n4 = { ...J, ...n4 };
|
|
356
|
+
const r3 = Object.entries(t3).reduce((t4, [r4, o2]) => {
|
|
357
|
+
const i2 = e3[r4];
|
|
358
|
+
return n4.merge && Array.isArray(i2) && Array.isArray(o2) ? t4[r4] = o2.reduce((e4, t5) => e4.includes(t5) ? e4 : [...e4, t5], [...i2]) : (n4.extend || r4 in e3) && (t4[r4] = o2), t4;
|
|
339
359
|
}, {});
|
|
340
|
-
return n4.shallow ? { ...e3, ...
|
|
360
|
+
return n4.shallow ? { ...e3, ...r3 } : (Object.assign(e3, r3), e3);
|
|
341
361
|
}
|
|
342
|
-
function
|
|
362
|
+
function Q(e3) {
|
|
343
363
|
return Array.isArray(e3);
|
|
344
364
|
}
|
|
345
|
-
function
|
|
365
|
+
function Y(e3) {
|
|
346
366
|
return "boolean" == typeof e3;
|
|
347
367
|
}
|
|
348
|
-
function
|
|
368
|
+
function te(e3) {
|
|
349
369
|
return void 0 !== e3;
|
|
350
370
|
}
|
|
351
371
|
function re(e3) {
|
|
352
372
|
return "function" == typeof e3;
|
|
353
373
|
}
|
|
354
|
-
function
|
|
374
|
+
function oe(e3) {
|
|
355
375
|
return "number" == typeof e3 && !Number.isNaN(e3);
|
|
356
376
|
}
|
|
357
|
-
function
|
|
358
|
-
return "object" == typeof e3 && null !== e3 && !
|
|
377
|
+
function ie(e3) {
|
|
378
|
+
return "object" == typeof e3 && null !== e3 && !Q(e3) && "[object Object]" === Object.prototype.toString.call(e3);
|
|
359
379
|
}
|
|
360
380
|
function ae(e3, t3) {
|
|
361
381
|
return typeof e3 == typeof t3;
|
|
362
382
|
}
|
|
363
|
-
function
|
|
383
|
+
function se(e3) {
|
|
364
384
|
return "string" == typeof e3;
|
|
365
385
|
}
|
|
366
|
-
function
|
|
386
|
+
function ce(e3, t3 = /* @__PURE__ */ new WeakMap()) {
|
|
367
387
|
if ("object" != typeof e3 || null === e3) return e3;
|
|
368
388
|
if (t3.has(e3)) return t3.get(e3);
|
|
369
389
|
const n4 = Object.prototype.toString.call(e3);
|
|
370
390
|
if ("[object Object]" === n4) {
|
|
371
391
|
const n5 = {};
|
|
372
392
|
t3.set(e3, n5);
|
|
373
|
-
for (const
|
|
393
|
+
for (const r3 in e3) Object.prototype.hasOwnProperty.call(e3, r3) && (n5[r3] = ce(e3[r3], t3));
|
|
374
394
|
return n5;
|
|
375
395
|
}
|
|
376
396
|
if ("[object Array]" === n4) {
|
|
377
397
|
const n5 = [];
|
|
378
398
|
return t3.set(e3, n5), e3.forEach((e4) => {
|
|
379
|
-
n5.push(
|
|
399
|
+
n5.push(ce(e4, t3));
|
|
380
400
|
}), n5;
|
|
381
401
|
}
|
|
382
402
|
if ("[object Date]" === n4) return new Date(e3.getTime());
|
|
@@ -386,127 +406,127 @@ function le(e3, t3 = /* @__PURE__ */ new WeakMap()) {
|
|
|
386
406
|
}
|
|
387
407
|
return e3;
|
|
388
408
|
}
|
|
389
|
-
function
|
|
390
|
-
const
|
|
391
|
-
let
|
|
392
|
-
for (let e4 = 0; e4 <
|
|
393
|
-
const t4 =
|
|
394
|
-
if ("*" === t4 &&
|
|
395
|
-
const t5 =
|
|
396
|
-
for (const e5 of
|
|
397
|
-
const
|
|
398
|
-
i2.push(
|
|
409
|
+
function le(e3, t3 = "", n4) {
|
|
410
|
+
const r3 = t3.split(".");
|
|
411
|
+
let o2 = e3;
|
|
412
|
+
for (let e4 = 0; e4 < r3.length; e4++) {
|
|
413
|
+
const t4 = r3[e4];
|
|
414
|
+
if ("*" === t4 && Q(o2)) {
|
|
415
|
+
const t5 = r3.slice(e4 + 1).join("."), i2 = [];
|
|
416
|
+
for (const e5 of o2) {
|
|
417
|
+
const r4 = le(e5, t5, n4);
|
|
418
|
+
i2.push(r4);
|
|
399
419
|
}
|
|
400
420
|
return i2;
|
|
401
421
|
}
|
|
402
|
-
if (
|
|
422
|
+
if (o2 = o2 instanceof Object ? o2[t4] : void 0, void 0 === o2) break;
|
|
403
423
|
}
|
|
404
|
-
return
|
|
424
|
+
return te(o2) ? o2 : n4;
|
|
405
425
|
}
|
|
406
426
|
function ue(e3, t3, n4) {
|
|
407
|
-
if (!
|
|
408
|
-
const
|
|
409
|
-
let i2 =
|
|
410
|
-
for (let e4 = 0; e4 <
|
|
411
|
-
const t4 =
|
|
412
|
-
e4 ===
|
|
427
|
+
if (!ie(e3)) return e3;
|
|
428
|
+
const r3 = ce(e3), o2 = t3.split(".");
|
|
429
|
+
let i2 = r3;
|
|
430
|
+
for (let e4 = 0; e4 < o2.length; e4++) {
|
|
431
|
+
const t4 = o2[e4];
|
|
432
|
+
e4 === o2.length - 1 ? i2[t4] = n4 : (t4 in i2 && "object" == typeof i2[t4] && null !== i2[t4] || (i2[t4] = {}), i2 = i2[t4]);
|
|
413
433
|
}
|
|
414
|
-
return
|
|
434
|
+
return r3;
|
|
415
435
|
}
|
|
416
|
-
function
|
|
417
|
-
const n4 = {},
|
|
418
|
-
for (const t4 of
|
|
419
|
-
const
|
|
420
|
-
if (!
|
|
421
|
-
const
|
|
422
|
-
if (
|
|
423
|
-
if (void 0 ===
|
|
424
|
-
const
|
|
425
|
-
n4[`${t4}_${e4}`] =
|
|
436
|
+
function pe(e3, t3) {
|
|
437
|
+
const n4 = {}, r3 = t3.includes("all") ? Object.keys(fe) : t3;
|
|
438
|
+
for (const t4 of r3) {
|
|
439
|
+
const r4 = fe[t4];
|
|
440
|
+
if (!r4) continue;
|
|
441
|
+
const o2 = r4(e3);
|
|
442
|
+
if (ie(o2)) for (const [e4, r5] of Object.entries(o2)) {
|
|
443
|
+
if (void 0 === r5) continue;
|
|
444
|
+
const o3 = "context" === t4 && Array.isArray(r5) ? r5[0] : r5;
|
|
445
|
+
n4[`${t4}_${e4}`] = o3;
|
|
426
446
|
}
|
|
427
447
|
}
|
|
428
448
|
return n4;
|
|
429
449
|
}
|
|
430
|
-
function
|
|
431
|
-
const
|
|
450
|
+
function me(e3, t3 = {}, n4 = {}) {
|
|
451
|
+
const r3 = { ...t3, ...n4 }, o2 = {};
|
|
432
452
|
let i2 = !e3 || 0 === Object.keys(e3).length;
|
|
433
|
-
return Object.keys(
|
|
434
|
-
|
|
435
|
-
}), !!i2 &&
|
|
453
|
+
return Object.keys(r3).forEach((t4) => {
|
|
454
|
+
r3[t4] && (o2[t4] = true, e3 && e3[t4] && (i2 = true));
|
|
455
|
+
}), !!i2 && o2;
|
|
436
456
|
}
|
|
437
|
-
function
|
|
457
|
+
function be() {
|
|
438
458
|
let e3 = "";
|
|
439
459
|
for (let t3 = 0; t3 < 16; t3++) e3 += (16 * Math.random() | 0).toString(16);
|
|
440
460
|
return e3;
|
|
441
461
|
}
|
|
442
462
|
function ve(e3 = {}) {
|
|
443
|
-
const t3 = e3.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n4 =
|
|
463
|
+
const t3 = e3.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n4 = X({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" } }], consent: { functional: true }, id: e3.id || be(), trigger: "test", entity: "entity", action: "action", timestamp: t3, timing: 3.14, source: { type: "collector", schema: "4" } }, e3, { merge: false });
|
|
444
464
|
if (e3.name) {
|
|
445
|
-
const [t4,
|
|
446
|
-
t4 &&
|
|
465
|
+
const [t4, r3] = e3.name.split(" ") ?? [];
|
|
466
|
+
t4 && r3 && (n4.entity = t4, n4.action = r3);
|
|
447
467
|
}
|
|
448
468
|
return n4;
|
|
449
469
|
}
|
|
450
|
-
function
|
|
451
|
-
const n4 = t3.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0),
|
|
452
|
-
return ve({ ...{ "cart view": { data: { currency: "EUR", value: 2 *
|
|
470
|
+
function he(e3 = "entity action", t3 = {}) {
|
|
471
|
+
const n4 = t3.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), r3 = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, o2 = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
|
|
472
|
+
return ve({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r3.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r3.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r3.data.price + o2.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r3, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...o2, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r3, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...o2, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...r3, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r3, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r3.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n4, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e3], ...t3, name: e3 });
|
|
453
473
|
}
|
|
454
|
-
function
|
|
474
|
+
function we(e3 = 6, t3) {
|
|
455
475
|
if (t3) {
|
|
456
476
|
const n5 = t3.length;
|
|
457
|
-
let
|
|
458
|
-
for (let
|
|
459
|
-
return
|
|
477
|
+
let r3 = "";
|
|
478
|
+
for (let o2 = 0; o2 < e3; o2++) r3 += t3[Math.random() * n5 | 0];
|
|
479
|
+
return r3;
|
|
460
480
|
}
|
|
461
481
|
let n4 = "";
|
|
462
482
|
for (let t4 = 36; n4.length < e3; ) n4 += (Math.random() * t4 | 0).toString(t4);
|
|
463
483
|
return n4;
|
|
464
484
|
}
|
|
465
|
-
function
|
|
466
|
-
let
|
|
467
|
-
return (...
|
|
485
|
+
function ke(e3, t3 = 1e3, n4 = false) {
|
|
486
|
+
let r3, o2 = null, i2 = false;
|
|
487
|
+
return (...a3) => new Promise((s5) => {
|
|
468
488
|
const c3 = n4 && !i2;
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}, t3), c3 && (i2 = true,
|
|
489
|
+
o2 && clearTimeout(o2), o2 = setTimeout(() => {
|
|
490
|
+
o2 = null, n4 && !i2 || (r3 = e3(...a3), s5(r3));
|
|
491
|
+
}, t3), c3 && (i2 = true, r3 = e3(...a3), s5(r3));
|
|
472
492
|
});
|
|
473
493
|
}
|
|
474
|
-
function
|
|
494
|
+
function Oe(e3) {
|
|
475
495
|
return { message: e3.message, name: e3.name, stack: e3.stack, cause: e3.cause };
|
|
476
496
|
}
|
|
477
497
|
function Ae(e3, t3) {
|
|
478
|
-
let n4,
|
|
479
|
-
return e3 instanceof Error ? (n4 = e3.message,
|
|
498
|
+
let n4, r3 = {};
|
|
499
|
+
return e3 instanceof Error ? (n4 = e3.message, r3.error = Oe(e3)) : n4 = e3, void 0 !== t3 && (t3 instanceof Error ? r3.error = Oe(t3) : "object" == typeof t3 && null !== t3 ? (r3 = { ...r3, ...t3 }, "error" in r3 && r3.error instanceof Error && (r3.error = Oe(r3.error))) : r3.value = t3), { message: n4, context: r3 };
|
|
480
500
|
}
|
|
481
501
|
function _e(e3 = {}) {
|
|
482
|
-
return
|
|
502
|
+
return Ee({ level: void 0 !== e3.level ? (function(e4) {
|
|
483
503
|
return "string" == typeof e4 ? c[e4] : e4;
|
|
484
504
|
})(e3.level) : 0, handler: e3.handler, jsonHandler: e3.jsonHandler, scope: [] });
|
|
485
505
|
}
|
|
486
|
-
function
|
|
487
|
-
const { level: t3, handler: n4, jsonHandler:
|
|
506
|
+
function Ee(e3) {
|
|
507
|
+
const { level: t3, handler: n4, jsonHandler: r3, scope: o2 } = e3, i2 = (e4, r4, i3) => {
|
|
488
508
|
if (e4 <= t3) {
|
|
489
|
-
const t4 = Ae(
|
|
490
|
-
n4 ? n4(e4, t4.message, t4.context,
|
|
509
|
+
const t4 = Ae(r4, i3);
|
|
510
|
+
n4 ? n4(e4, t4.message, t4.context, o2, Se) : Se(e4, t4.message, t4.context, o2);
|
|
491
511
|
}
|
|
492
512
|
};
|
|
493
513
|
return { error: (e4, t4) => i2(0, e4, t4), warn: (e4, t4) => i2(1, e4, t4), info: (e4, t4) => i2(2, e4, t4), debug: (e4, t4) => i2(3, e4, t4), throw: (e4, t4) => {
|
|
494
|
-
const
|
|
495
|
-
throw n4 ? n4(0,
|
|
514
|
+
const r4 = Ae(e4, t4);
|
|
515
|
+
throw n4 ? n4(0, r4.message, r4.context, o2, Se) : Se(0, r4.message, r4.context, o2), new Error(r4.message);
|
|
496
516
|
}, json: (e4) => {
|
|
497
|
-
|
|
498
|
-
}, scope: (e4) =>
|
|
517
|
+
r3 ? r3(e4) : console.log(JSON.stringify(e4, null, 2));
|
|
518
|
+
}, scope: (e4) => Ee({ level: t3, handler: n4, jsonHandler: r3, scope: [...o2, e4] }) };
|
|
499
519
|
}
|
|
500
|
-
function
|
|
501
|
-
return
|
|
520
|
+
function Ne(e3) {
|
|
521
|
+
return Y(e3) || se(e3) || oe(e3) || !te(e3) || Q(e3) && e3.every(Ne) || ie(e3) && Object.values(e3).every(Ne);
|
|
502
522
|
}
|
|
503
|
-
function
|
|
504
|
-
return
|
|
523
|
+
function ze(e3) {
|
|
524
|
+
return Ne(e3) ? e3 : void 0;
|
|
505
525
|
}
|
|
506
|
-
function
|
|
507
|
-
return function(...
|
|
526
|
+
function Pe(e3, t3, n4) {
|
|
527
|
+
return function(...r3) {
|
|
508
528
|
try {
|
|
509
|
-
return e3(...
|
|
529
|
+
return e3(...r3);
|
|
510
530
|
} catch (e4) {
|
|
511
531
|
if (!t3) return;
|
|
512
532
|
return t3(e4);
|
|
@@ -515,10 +535,10 @@ function Re(e3, t3, n4) {
|
|
|
515
535
|
}
|
|
516
536
|
};
|
|
517
537
|
}
|
|
518
|
-
function
|
|
519
|
-
return async function(...
|
|
538
|
+
function Me(e3, t3, n4) {
|
|
539
|
+
return async function(...r3) {
|
|
520
540
|
try {
|
|
521
|
-
return await e3(...
|
|
541
|
+
return await e3(...r3);
|
|
522
542
|
} catch (e4) {
|
|
523
543
|
if (!t3) return;
|
|
524
544
|
return await t3(e4);
|
|
@@ -527,142 +547,142 @@ function Te(e3, t3, n4) {
|
|
|
527
547
|
}
|
|
528
548
|
};
|
|
529
549
|
}
|
|
530
|
-
async function
|
|
531
|
-
const [
|
|
532
|
-
if (!t3 || !
|
|
533
|
-
let i2,
|
|
550
|
+
async function Re(e3, t3, n4) {
|
|
551
|
+
const [r3, o2] = (e3.name || "").split(" ");
|
|
552
|
+
if (!t3 || !r3 || !o2) return {};
|
|
553
|
+
let i2, a3 = "", s5 = r3, c3 = o2;
|
|
534
554
|
const l2 = (t4) => {
|
|
535
555
|
if (!t4) return;
|
|
536
|
-
return (
|
|
556
|
+
return (Q(t4) ? t4 : [t4]).find((t5) => {
|
|
537
557
|
if (!t5.condition) return true;
|
|
538
558
|
if (!n4) return Boolean(t5.condition(e3, void 0));
|
|
539
|
-
const
|
|
540
|
-
return Boolean(t5.condition(e3,
|
|
559
|
+
const r4 = { event: e3, mapping: t5, collector: n4, logger: n4.logger, consent: ie(e3) && e3.consent || n4.consent };
|
|
560
|
+
return Boolean(t5.condition(e3, r4));
|
|
541
561
|
});
|
|
542
562
|
};
|
|
543
|
-
t3[
|
|
544
|
-
const
|
|
545
|
-
return
|
|
563
|
+
t3[s5] || (s5 = "*");
|
|
564
|
+
const u3 = t3[s5];
|
|
565
|
+
return u3 && (u3[c3] || (c3 = "*"), i2 = l2(u3[c3])), i2 || (s5 = "*", c3 = "*", i2 = l2(t3[s5]?.[c3])), i2 && (a3 = `${s5} ${c3}`), { eventMapping: i2, mappingKey: a3 };
|
|
546
566
|
}
|
|
547
|
-
async function
|
|
548
|
-
if (!
|
|
549
|
-
const
|
|
567
|
+
async function Te(e3, t3 = {}, n4 = {}) {
|
|
568
|
+
if (!te(e3)) return;
|
|
569
|
+
const r3 = ie(e3) && e3.consent || n4.consent || n4.collector?.consent, o2 = n4.event ?? (ie(e3) ? e3 : {});
|
|
550
570
|
if (!n4.collector) throw new Error("getMappingValue: context.collector is required");
|
|
551
|
-
const i2 = { event:
|
|
552
|
-
for (const t4 of
|
|
553
|
-
const n5 = await
|
|
554
|
-
if (
|
|
571
|
+
const i2 = { event: o2, mapping: t3, collector: n4.collector, logger: n4.collector.logger, consent: r3 }, a3 = Q(t3) ? t3 : [t3];
|
|
572
|
+
for (const t4 of a3) {
|
|
573
|
+
const n5 = await Me(Ie)(e3, t4, { ...i2, mapping: t4 });
|
|
574
|
+
if (te(n5)) return n5;
|
|
555
575
|
}
|
|
556
576
|
}
|
|
557
|
-
async function
|
|
558
|
-
return (
|
|
559
|
-
const
|
|
560
|
-
if (
|
|
561
|
-
const i2 =
|
|
577
|
+
async function Ie(e3, t3, n4) {
|
|
578
|
+
return (Q(t3) ? t3 : [t3]).reduce(async (t4, r3) => {
|
|
579
|
+
const o2 = await t4;
|
|
580
|
+
if (o2) return o2;
|
|
581
|
+
const i2 = se(r3) ? { key: r3 } : r3;
|
|
562
582
|
if (!Object.keys(i2).length) return;
|
|
563
|
-
const { condition:
|
|
564
|
-
if (
|
|
565
|
-
if (
|
|
566
|
-
let y2 =
|
|
567
|
-
if (c3 && (y2 = await
|
|
568
|
-
const [t5, n5] =
|
|
569
|
-
|
|
570
|
-
} else
|
|
571
|
-
const
|
|
572
|
-
return
|
|
573
|
-
}, Promise.resolve({})) : p2 && (y2 = await Promise.all(p2.map((t5) =>
|
|
574
|
-
d2 && !await
|
|
575
|
-
const b2 =
|
|
576
|
-
return
|
|
583
|
+
const { condition: a3, consent: s5, fn: c3, key: l2, loop: u3, map: f2, set: p2, validate: d2, value: m2 } = i2, g2 = { ...n4, mapping: r3 };
|
|
584
|
+
if (a3 && !await Me(a3)(e3, g2)) return;
|
|
585
|
+
if (s5 && !me(s5, g2.consent)) return m2;
|
|
586
|
+
let y2 = te(m2) ? m2 : e3;
|
|
587
|
+
if (c3 && (y2 = await Me(c3)(e3, g2)), l2 && (y2 = le(e3, l2, m2)), u3) {
|
|
588
|
+
const [t5, n5] = u3, r4 = "this" === t5 ? [e3] : await Te(e3, t5, g2);
|
|
589
|
+
Q(r4) && (y2 = (await Promise.all(r4.map((e4) => Te(e4, n5, g2)))).filter(te));
|
|
590
|
+
} else f2 ? y2 = await Object.entries(f2).reduce(async (t5, [n5, r4]) => {
|
|
591
|
+
const o3 = await t5, i3 = await Te(e3, r4, g2);
|
|
592
|
+
return te(i3) && (o3[n5] = i3), o3;
|
|
593
|
+
}, Promise.resolve({})) : p2 && (y2 = await Promise.all(p2.map((t5) => Ie(e3, t5, g2))));
|
|
594
|
+
d2 && !await Me(d2)(y2, g2) && (y2 = void 0);
|
|
595
|
+
const b2 = ze(y2);
|
|
596
|
+
return te(b2) ? b2 : ze(m2);
|
|
577
597
|
}, Promise.resolve(void 0));
|
|
578
598
|
}
|
|
579
|
-
async function
|
|
580
|
-
t3.policy && await Promise.all(Object.entries(t3.policy).map(async ([t4,
|
|
581
|
-
const
|
|
582
|
-
e3 = ue(e3, t4,
|
|
599
|
+
async function Ze(e3, t3, n4) {
|
|
600
|
+
t3.policy && await Promise.all(Object.entries(t3.policy).map(async ([t4, r4]) => {
|
|
601
|
+
const o3 = await Te(e3, r4, { collector: n4, event: e3 });
|
|
602
|
+
e3 = ue(e3, t4, o3);
|
|
583
603
|
}));
|
|
584
|
-
const { eventMapping:
|
|
585
|
-
|
|
586
|
-
const
|
|
587
|
-
e3 = ue(e3, t4,
|
|
604
|
+
const { eventMapping: r3, mappingKey: o2 } = await Re(e3, t3.mapping, n4);
|
|
605
|
+
r3?.policy && await Promise.all(Object.entries(r3.policy).map(async ([t4, r4]) => {
|
|
606
|
+
const o3 = await Te(e3, r4, { collector: n4, event: e3 });
|
|
607
|
+
e3 = ue(e3, t4, o3);
|
|
588
608
|
}));
|
|
589
|
-
let i2 = t3.data && await
|
|
590
|
-
const
|
|
591
|
-
if (
|
|
592
|
-
if (
|
|
593
|
-
if (
|
|
594
|
-
const t4 =
|
|
595
|
-
i2 =
|
|
609
|
+
let i2 = t3.data && await Te(e3, t3.data, { collector: n4, event: e3 });
|
|
610
|
+
const a3 = Boolean(r3?.silent);
|
|
611
|
+
if (r3) {
|
|
612
|
+
if (r3.ignore) return { event: e3, data: i2, mapping: r3, mappingKey: o2, ignore: true, silent: a3 };
|
|
613
|
+
if (r3.name && (e3.name = r3.name), r3.data) {
|
|
614
|
+
const t4 = r3.data && await Te(e3, r3.data, { collector: n4, event: e3 });
|
|
615
|
+
i2 = ie(i2) && ie(t4) ? X(i2, t4) : t4;
|
|
596
616
|
}
|
|
597
617
|
}
|
|
598
|
-
const
|
|
599
|
-
if (
|
|
600
|
-
const t4 =
|
|
601
|
-
Object.keys(t4).length > 0 && (i2 =
|
|
618
|
+
const s5 = r3?.include ?? t3.include;
|
|
619
|
+
if (s5 && s5.length > 0) {
|
|
620
|
+
const t4 = pe(e3, s5);
|
|
621
|
+
Object.keys(t4).length > 0 && (i2 = ie(i2) ? X(t4, i2) : i2 ?? t4);
|
|
602
622
|
}
|
|
603
|
-
return { event: e3, data: i2, mapping:
|
|
623
|
+
return { event: e3, data: i2, mapping: r3, mappingKey: o2, ignore: false, silent: a3 };
|
|
604
624
|
}
|
|
605
|
-
function
|
|
625
|
+
function Ve(e3) {
|
|
606
626
|
return void 0 === e3 || ae(e3, "") ? e3 : JSON.stringify(e3);
|
|
607
627
|
}
|
|
608
|
-
function
|
|
609
|
-
return
|
|
628
|
+
function Be(e3 = {}) {
|
|
629
|
+
return X({ "Content-Type": "application/json; charset=utf-8" }, e3);
|
|
610
630
|
}
|
|
611
|
-
function Je(e3, t3, n4,
|
|
612
|
-
return function(...
|
|
631
|
+
function Je(e3, t3, n4, r3) {
|
|
632
|
+
return function(...o2) {
|
|
613
633
|
let i2;
|
|
614
|
-
const
|
|
615
|
-
|
|
634
|
+
const a3 = "pre" + t3, s5 = "post" + t3, c3 = n4[a3], l2 = n4[s5], u3 = (e4, t4) => {
|
|
635
|
+
r3 ? r3.warn(e4, { error: t4 }) : console.warn(e4, t4);
|
|
616
636
|
};
|
|
617
637
|
if (c3) try {
|
|
618
|
-
i2 = c3({ fn: e3 }, ...
|
|
638
|
+
i2 = c3({ fn: e3 }, ...o2);
|
|
619
639
|
} catch (t4) {
|
|
620
|
-
|
|
640
|
+
u3(`Hook ${String(a3)} failed, falling back to original function`, t4), i2 = e3(...o2);
|
|
621
641
|
}
|
|
622
|
-
else i2 = e3(...
|
|
642
|
+
else i2 = e3(...o2);
|
|
623
643
|
if (l2) try {
|
|
624
|
-
i2 = l2({ fn: e3, result: i2 }, ...
|
|
644
|
+
i2 = l2({ fn: e3, result: i2 }, ...o2);
|
|
625
645
|
} catch (e4) {
|
|
626
|
-
|
|
646
|
+
u3(`Hook ${String(s5)} failed, keeping original result`, e4);
|
|
627
647
|
}
|
|
628
648
|
return i2;
|
|
629
649
|
};
|
|
630
650
|
}
|
|
631
|
-
function
|
|
651
|
+
function at(e3) {
|
|
632
652
|
return "string" == typeof e3 || Array.isArray(e3) && e3.every((e4) => "string" == typeof e4) ? e3 : void 0;
|
|
633
653
|
}
|
|
634
|
-
async function
|
|
635
|
-
const n4 = t3?.version || "latest",
|
|
654
|
+
async function st(e3, t3) {
|
|
655
|
+
const n4 = t3?.version || "latest", r3 = t3?.timeout || 1e4, o2 = new AbortController(), i2 = setTimeout(() => o2.abort(), r3), a3 = o2.signal, s5 = t3?.client ? { "X-Walkeros-Client": t3.client } : void 0;
|
|
636
656
|
try {
|
|
637
657
|
if (t3?.baseUrl) {
|
|
638
|
-
const
|
|
639
|
-
if (!
|
|
658
|
+
const r5 = `${t3.baseUrl}/api/packages/${encodeURIComponent(e3)}?version=${encodeURIComponent(n4)}&expand=all`, o4 = await fetch(r5, { signal: a3, ...s5 && { headers: s5 } });
|
|
659
|
+
if (!o4.ok) throw new Error(`Failed to fetch ${r5} (HTTP ${o4.status})`);
|
|
640
660
|
return (function(e4, t4, n5) {
|
|
641
|
-
const
|
|
642
|
-
return { packageName: n5.package || e4, version: "string" == typeof n5.version ? n5.version : t4, ...void 0 !== n5.description && { description: n5.description }, ...void 0 !== n5.type && { type: n5.type }, ...void 0 !== c3 && { platform: c3 }, schemas:
|
|
643
|
-
})(e3, n4, await
|
|
644
|
-
}
|
|
645
|
-
const
|
|
646
|
-
return (function(e4, t4, n5,
|
|
647
|
-
const
|
|
648
|
-
for (const [e5, t5] of Object.entries(
|
|
649
|
-
const n6 = t5,
|
|
650
|
-
"string" == typeof n6?.description && (
|
|
651
|
-
}
|
|
652
|
-
const
|
|
653
|
-
return { packageName: e4, version: "string" == typeof n5.version ? n5.version : t4, description: "string" == typeof n5.description ? n5.description : void 0, type: "string" == typeof
|
|
654
|
-
})(e3, n4,
|
|
661
|
+
const r6 = n5.schemas || {}, o5 = n5.examples || {}, i3 = n5.hints, a4 = n5.hintKeys ?? (i3 ? Object.keys(i3) : []), s6 = n5.exampleSummaries ?? [], c3 = n5.platform;
|
|
662
|
+
return { packageName: n5.package || e4, version: "string" == typeof n5.version ? n5.version : t4, ...void 0 !== n5.description && { description: n5.description }, ...void 0 !== n5.type && { type: n5.type }, ...void 0 !== c3 && { platform: c3 }, schemas: r6, examples: o5, ...void 0 !== n5.docs && { docs: n5.docs }, ...void 0 !== n5.source && { source: n5.source }, ...i3 && Object.keys(i3).length > 0 ? { hints: i3 } : {}, hintKeys: a4, exampleSummaries: s6 };
|
|
663
|
+
})(e3, n4, await o4.json());
|
|
664
|
+
}
|
|
665
|
+
const r4 = `https://cdn.jsdelivr.net/npm/${e3}@${n4}`, o3 = await ct(`${r4}/package.json`, a3, s5);
|
|
666
|
+
return (function(e4, t4, n5, r5) {
|
|
667
|
+
const o4 = r5.$meta || {}, i3 = r5.schemas || {}, a4 = r5.examples || {}, s6 = r5.hints, c3 = s6 ? Object.keys(s6) : [], l2 = [], u3 = a4.step || {};
|
|
668
|
+
for (const [e5, t5] of Object.entries(u3)) {
|
|
669
|
+
const n6 = t5, r6 = { name: e5 };
|
|
670
|
+
"string" == typeof n6?.description && (r6.description = n6.description), l2.push(r6);
|
|
671
|
+
}
|
|
672
|
+
const f2 = "string" == typeof o4.docs ? o4.docs : void 0, p2 = "string" == typeof o4.source ? o4.source : void 0;
|
|
673
|
+
return { packageName: e4, version: "string" == typeof n5.version ? n5.version : t4, description: "string" == typeof n5.description ? n5.description : void 0, type: "string" == typeof o4.type ? o4.type : void 0, platform: at(o4.platform), schemas: i3, examples: a4, ...f2 ? { docs: f2 } : {}, ...p2 ? { source: p2 } : {}, ...s6 && Object.keys(s6).length > 0 ? { hints: s6 } : {}, hintKeys: c3, exampleSummaries: l2 };
|
|
674
|
+
})(e3, n4, o3, await ct(`${r4}/dist/walkerOS.json`, a3, s5));
|
|
655
675
|
} finally {
|
|
656
676
|
clearTimeout(i2);
|
|
657
677
|
}
|
|
658
678
|
}
|
|
659
679
|
async function ct(e3, t3, n4) {
|
|
660
|
-
const
|
|
661
|
-
if (!
|
|
662
|
-
return await
|
|
680
|
+
const r3 = await fetch(e3, { signal: t3, ...n4 && { headers: n4 } });
|
|
681
|
+
if (!r3.ok) throw new Error(`Failed to fetch ${e3} (HTTP ${r3.status})`);
|
|
682
|
+
return await r3.json();
|
|
663
683
|
}
|
|
664
684
|
async function lt(e3, t3) {
|
|
665
|
-
const n4 = await
|
|
685
|
+
const n4 = await st(e3, t3);
|
|
666
686
|
return { packageName: n4.packageName, version: n4.version, type: n4.type, platform: n4.platform, schemas: n4.schemas, examples: n4.examples, ...n4.hints ? { hints: n4.hints } : {} };
|
|
667
687
|
}
|
|
668
688
|
function dt(e3) {
|
|
@@ -676,7 +696,7 @@ function dt(e3) {
|
|
|
676
696
|
return (e4) => t3.some((t4) => t4(e4));
|
|
677
697
|
}
|
|
678
698
|
return (function(e4) {
|
|
679
|
-
const { key: t3, operator: n4, value:
|
|
699
|
+
const { key: t3, operator: n4, value: r3, not: o2 } = e4, i2 = (function(e5, t4) {
|
|
680
700
|
switch (e5) {
|
|
681
701
|
case "eq":
|
|
682
702
|
return (e6) => String(e6 ?? "") === t4;
|
|
@@ -701,10 +721,10 @@ function dt(e3) {
|
|
|
701
721
|
case "exists":
|
|
702
722
|
return (e6) => null != e6;
|
|
703
723
|
}
|
|
704
|
-
})(n4,
|
|
724
|
+
})(n4, r3);
|
|
705
725
|
return (e5) => {
|
|
706
|
-
const n5 =
|
|
707
|
-
return
|
|
726
|
+
const n5 = le(e5, t3), r4 = i2(n5);
|
|
727
|
+
return o2 ? !r4 : r4;
|
|
708
728
|
};
|
|
709
729
|
})(e3);
|
|
710
730
|
}
|
|
@@ -734,69 +754,69 @@ function bt(e3, t3) {
|
|
|
734
754
|
const n4 = { ingest: e3 ?? {} };
|
|
735
755
|
return void 0 !== t3 && (n4.event = t3), n4;
|
|
736
756
|
}
|
|
737
|
-
function
|
|
757
|
+
function vt(e3) {
|
|
738
758
|
return { full: e3.full ?? false, storeId: e3.store, rules: e3.rules.map((e4) => ({ match: dt(e4.match), key: e4.key, ttl: e4.ttl, update: e4.update })) };
|
|
739
759
|
}
|
|
740
|
-
function
|
|
741
|
-
const
|
|
742
|
-
if (!
|
|
743
|
-
const i2 =
|
|
760
|
+
function ht(e3, t3, n4, r3) {
|
|
761
|
+
const o2 = e3.rules.find((e4) => e4.match(n4));
|
|
762
|
+
if (!o2) return null;
|
|
763
|
+
const i2 = o2.key.map((e4) => String(le(n4, e4) ?? ""));
|
|
744
764
|
if (i2.every((e4) => "" === e4)) return null;
|
|
745
|
-
const
|
|
746
|
-
return void 0 !==
|
|
765
|
+
const a3 = `${r3}:${i2.join(":")}`, s5 = t3.get(a3);
|
|
766
|
+
return void 0 !== s5 ? { status: "HIT", key: a3, value: s5, rule: o2 } : { status: "MISS", key: a3, rule: o2 };
|
|
747
767
|
}
|
|
748
|
-
function wt(e3, t3, n4,
|
|
749
|
-
e3.set(t3, n4, 1e3 *
|
|
768
|
+
function wt(e3, t3, n4, r3) {
|
|
769
|
+
e3.set(t3, n4, 1e3 * r3);
|
|
750
770
|
}
|
|
751
|
-
async function jt(e3, t3, n4,
|
|
771
|
+
async function jt(e3, t3, n4, r3) {
|
|
752
772
|
if (!t3) return e3;
|
|
753
|
-
let
|
|
773
|
+
let o2 = e3;
|
|
754
774
|
for (const [e4, i2] of Object.entries(t3)) {
|
|
755
|
-
|
|
775
|
+
o2 = ue(o2, e4, await Te(n4, i2, { collector: r3 }));
|
|
756
776
|
}
|
|
757
|
-
return
|
|
777
|
+
return o2;
|
|
758
778
|
}
|
|
759
|
-
var e,
|
|
779
|
+
var e, s, c, A, S, z, P, M, R, T, F, J, fe, Se;
|
|
760
780
|
var init_dist = __esm({
|
|
761
781
|
"../core/dist/index.mjs"() {
|
|
762
782
|
"use strict";
|
|
763
783
|
e = Object.defineProperty;
|
|
764
|
-
|
|
784
|
+
s = {};
|
|
765
785
|
((t3, n4) => {
|
|
766
|
-
for (var
|
|
767
|
-
})(
|
|
786
|
+
for (var r3 in n4) e(t3, r3, { get: n4[r3], enumerable: true });
|
|
787
|
+
})(s, { Level: () => c });
|
|
768
788
|
c = ((e3) => (e3[e3.ERROR = 0] = "ERROR", e3[e3.WARN = 1] = "WARN", e3[e3.INFO = 2] = "INFO", e3[e3.DEBUG = 3] = "DEBUG", e3))(c || {});
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
const
|
|
781
|
-
i2 ?
|
|
789
|
+
A = ["globals", "context", "custom", "user", "consent"];
|
|
790
|
+
S = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
|
|
791
|
+
z = /^\$var\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)$/;
|
|
792
|
+
P = /\$var\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)/g;
|
|
793
|
+
M = /\$env\.([a-zA-Z_][a-zA-Z0-9_]*)(?::([^"}\s]*))?/g;
|
|
794
|
+
R = /^\$contract\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.(.+))?$/;
|
|
795
|
+
T = /^\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?$/;
|
|
796
|
+
F = "__WALKEROS_ENV:";
|
|
797
|
+
J = { merge: true, shallow: true, extend: true };
|
|
798
|
+
fe = { data: (e3) => e3.data, globals: (e3) => e3.globals, context: (e3) => e3.context, user: (e3) => e3.user, source: (e3) => e3.source, event: (e3) => ({ entity: e3.entity, action: e3.action, id: e3.id, timestamp: e3.timestamp, name: e3.name, trigger: e3.trigger, timing: e3.timing }) };
|
|
799
|
+
Se = (e3, t3, n4, r3) => {
|
|
800
|
+
const o2 = `${c[e3]}${r3.length > 0 ? ` [${r3.join(":")}]` : ""}`, i2 = Object.keys(n4).length > 0, a3 = 0 === e3 ? console.error : 1 === e3 ? console.warn : console.log;
|
|
801
|
+
i2 ? a3(o2, t3, n4) : a3(o2, t3);
|
|
782
802
|
};
|
|
783
803
|
}
|
|
784
804
|
});
|
|
785
805
|
|
|
786
806
|
// ../server/core/dist/index.mjs
|
|
787
807
|
import * as r from "http";
|
|
788
|
-
import * as
|
|
808
|
+
import * as s3 from "https";
|
|
789
809
|
import { createHash as n2 } from "crypto";
|
|
790
|
-
function
|
|
791
|
-
const i2 =
|
|
810
|
+
function a(a3, n4, u3 = {}) {
|
|
811
|
+
const i2 = Be(u3.headers), c3 = Ve(n4), d2 = u3.method || "POST", m2 = u3.timeout || 5e3;
|
|
792
812
|
return new Promise((t3) => {
|
|
793
|
-
const e3 = new URL(
|
|
813
|
+
const e3 = new URL(a3), n5 = "https:" === e3.protocol ? s3 : r, u4 = { method: d2, headers: i2 }, p2 = n5.request(e3, u4, (e4) => {
|
|
794
814
|
const r3 = [];
|
|
795
815
|
e4.on("data", (t4) => {
|
|
796
816
|
r3.push(t4);
|
|
797
817
|
}), e4.on("end", () => {
|
|
798
|
-
const
|
|
799
|
-
t3({ ok:
|
|
818
|
+
const s5 = !!(e4.statusCode && e4.statusCode >= 200 && e4.statusCode < 300), a4 = Buffer.concat(r3).toString(), n6 = Pe(JSON.parse, () => a4)(a4);
|
|
819
|
+
t3({ ok: s5, data: n6, error: s5 ? void 0 : `${e4.statusCode} ${e4.statusMessage}` });
|
|
800
820
|
});
|
|
801
821
|
});
|
|
802
822
|
p2.on("error", (e4) => {
|
|
@@ -1398,204 +1418,190 @@ var init_sse = __esm({
|
|
|
1398
1418
|
|
|
1399
1419
|
// ../core/dist/dev.mjs
|
|
1400
1420
|
import { z as n3 } from "zod";
|
|
1401
|
-
import { z as
|
|
1402
|
-
function o(e3,
|
|
1403
|
-
return n3.toJSONSchema(e3, { target:
|
|
1421
|
+
import { z as Li } from "zod";
|
|
1422
|
+
function o(e3, t3, i2 = "draft-7") {
|
|
1423
|
+
return n3.toJSONSchema(e3, { target: i2 });
|
|
1404
1424
|
}
|
|
1405
|
-
function
|
|
1406
|
-
return n3.object({ data: n3.union([e3,
|
|
1425
|
+
function R2(e3, t3) {
|
|
1426
|
+
return n3.object({ data: n3.union([e3, t3]).optional().describe("Data transformation rules") }).partial();
|
|
1407
1427
|
}
|
|
1408
|
-
function
|
|
1428
|
+
function M2(e3) {
|
|
1409
1429
|
return n3.object({ mapping: e3.optional().describe("Event mapping rules") }).partial();
|
|
1410
1430
|
}
|
|
1411
|
-
function
|
|
1431
|
+
function T2(e3) {
|
|
1412
1432
|
return n3.object({ policy: e3.optional().describe("Pre-processing policy rules") }).partial();
|
|
1413
1433
|
}
|
|
1414
|
-
function
|
|
1434
|
+
function F2(e3) {
|
|
1415
1435
|
return n3.object({ consent: e3.optional().describe("Required consent states") }).partial();
|
|
1416
1436
|
}
|
|
1417
|
-
function
|
|
1418
|
-
return
|
|
1437
|
+
function Ci(e3) {
|
|
1438
|
+
return ki.parse(e3);
|
|
1419
1439
|
}
|
|
1420
|
-
function
|
|
1421
|
-
return
|
|
1440
|
+
function xi(e3) {
|
|
1441
|
+
return ki.safeParse(e3);
|
|
1422
1442
|
}
|
|
1423
|
-
function
|
|
1424
|
-
return
|
|
1443
|
+
function Pi(e3) {
|
|
1444
|
+
return wi.parse(e3);
|
|
1425
1445
|
}
|
|
1426
|
-
function
|
|
1427
|
-
return
|
|
1446
|
+
function Di(e3) {
|
|
1447
|
+
return wi.safeParse(e3);
|
|
1428
1448
|
}
|
|
1429
|
-
function
|
|
1430
|
-
let
|
|
1449
|
+
function Bi(e3) {
|
|
1450
|
+
let t3;
|
|
1431
1451
|
try {
|
|
1432
|
-
|
|
1433
|
-
} catch (
|
|
1434
|
-
const { line:
|
|
1452
|
+
t3 = JSON.parse(e3);
|
|
1453
|
+
} catch (t4) {
|
|
1454
|
+
const { line: i3, column: n5 } = (function(e4, t5) {
|
|
1435
1455
|
if (e4 instanceof SyntaxError) {
|
|
1436
|
-
const
|
|
1437
|
-
if (
|
|
1438
|
-
return
|
|
1456
|
+
const i4 = e4.message.match(/position\s+(\d+)/);
|
|
1457
|
+
if (i4) {
|
|
1458
|
+
return Hi(t5, parseInt(i4[1], 10));
|
|
1439
1459
|
}
|
|
1440
1460
|
const n6 = e4.message.match(/line\s+(\d+)\s+column\s+(\d+)/);
|
|
1441
1461
|
if (n6) return { line: parseInt(n6[1], 10), column: parseInt(n6[2], 10) };
|
|
1442
1462
|
}
|
|
1443
1463
|
return { line: 1, column: 1 };
|
|
1444
|
-
})(
|
|
1445
|
-
return { valid: false, errors: [{ message:
|
|
1464
|
+
})(t4, e3);
|
|
1465
|
+
return { valid: false, errors: [{ message: t4 instanceof Error ? t4.message : "Invalid JSON", severity: "error", line: i3, column: n5 }], warnings: [] };
|
|
1446
1466
|
}
|
|
1447
|
-
const
|
|
1448
|
-
if (!o2.success) for (const
|
|
1449
|
-
const n5 =
|
|
1450
|
-
|
|
1467
|
+
const i2 = [], n4 = [], o2 = ki.safeParse(t3);
|
|
1468
|
+
if (!o2.success) for (const t4 of o2.error.issues) {
|
|
1469
|
+
const n5 = t4.path.join("."), o3 = Ai(e3, t4.path);
|
|
1470
|
+
i2.push({ message: t4.message, severity: "error", path: n5 || "root", ...o3 });
|
|
1451
1471
|
}
|
|
1452
1472
|
const r3 = (function(e4) {
|
|
1453
|
-
if (!(
|
|
1454
|
-
const
|
|
1455
|
-
let
|
|
1456
|
-
|
|
1457
|
-
if (
|
|
1458
|
-
for (const [,
|
|
1459
|
-
if (
|
|
1460
|
-
const
|
|
1461
|
-
if (
|
|
1462
|
-
if (
|
|
1463
|
-
const
|
|
1464
|
-
if (
|
|
1465
|
-
else e5.push({ entity:
|
|
1473
|
+
if (!($i(e4) && "version" in e4 && "flows" in e4 && $i(e4.flows))) return;
|
|
1474
|
+
const t4 = {}, i3 = [], n5 = [], o3 = [], r4 = [], a3 = [];
|
|
1475
|
+
let s5;
|
|
1476
|
+
Vi(t4, e4.variables), (function(e5, t5) {
|
|
1477
|
+
if (!$i(t5)) return;
|
|
1478
|
+
for (const [, i4] of Object.entries(t5)) {
|
|
1479
|
+
if (!$i(i4)) continue;
|
|
1480
|
+
const t6 = i4.events;
|
|
1481
|
+
if ($i(t6)) for (const [i5, n6] of Object.entries(t6)) {
|
|
1482
|
+
if (!$i(n6)) continue;
|
|
1483
|
+
const t7 = e5.find((e6) => e6.entity === i5), o4 = Object.keys(n6);
|
|
1484
|
+
if (t7) for (const e6 of o4) t7.actions.includes(e6) || t7.actions.push(e6);
|
|
1485
|
+
else e5.push({ entity: i5, actions: o4 });
|
|
1466
1486
|
}
|
|
1467
1487
|
}
|
|
1468
|
-
})(
|
|
1469
|
-
for (const
|
|
1470
|
-
if (!
|
|
1471
|
-
const e5 =
|
|
1472
|
-
|
|
1488
|
+
})(a3, e4.contract);
|
|
1489
|
+
for (const a4 of Object.values(e4.flows)) if ($i(a4)) {
|
|
1490
|
+
if (!s5) {
|
|
1491
|
+
const e5 = a4.config;
|
|
1492
|
+
!$i(e5) || "web" !== e5.platform && "server" !== e5.platform || (s5 = e5.platform);
|
|
1473
1493
|
}
|
|
1474
|
-
|
|
1494
|
+
Vi(t4, a4.variables);
|
|
1475
1495
|
for (const e5 of ["sources", "destinations", "transformers"]) {
|
|
1476
|
-
const
|
|
1477
|
-
if (
|
|
1496
|
+
const c4 = "sources" === e5 ? "source" : "destinations" === e5 ? "destination" : "transformer", l2 = "sources" === e5 ? i3 : "destinations" === e5 ? n5 : o3;
|
|
1497
|
+
if ($i(a4[e5])) for (const [i4, n6] of Object.entries(a4[e5])) l2.push(i4), $i(n6) && (Vi(t4, n6.variables), "string" == typeof n6.package && r4.push({ package: n6.package, shortName: i4, type: c4, platform: s5 || "web" }));
|
|
1478
1498
|
}
|
|
1479
1499
|
}
|
|
1480
|
-
const
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
return
|
|
1485
|
-
})(
|
|
1500
|
+
const c3 = { variables: t4, stepNames: { sources: i3, destinations: n5, transformers: o3 } };
|
|
1501
|
+
s5 && (c3.platform = s5);
|
|
1502
|
+
r4.length > 0 && (c3.packages = r4);
|
|
1503
|
+
a3.length > 0 && (c3.contract = a3);
|
|
1504
|
+
return c3;
|
|
1505
|
+
})(t3);
|
|
1486
1506
|
if (r3) {
|
|
1487
|
-
const
|
|
1488
|
-
const
|
|
1489
|
-
if (
|
|
1507
|
+
const t4 = (function(e4, t5) {
|
|
1508
|
+
const i3 = [];
|
|
1509
|
+
if (t5.variables) {
|
|
1490
1510
|
const n5 = /\$var\.(\w+)/g;
|
|
1491
1511
|
let o3;
|
|
1492
|
-
for (; null !== (o3 = n5.exec(e4)); ) if (!(o3[1] in
|
|
1493
|
-
const n6 =
|
|
1494
|
-
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
if (i4.definitions) {
|
|
1498
|
-
const n5 = /\$def\.(\w+)/g;
|
|
1499
|
-
let o3;
|
|
1500
|
-
for (; null !== (o3 = n5.exec(e4)); ) if (!(o3[1] in i4.definitions)) {
|
|
1501
|
-
const n6 = At(e4, o3.index, o3[0].length);
|
|
1502
|
-
t4.push({ message: `Unknown definition "$def.${o3[1]}". Defined: ${Object.keys(i4.definitions).join(", ") || "none"}`, severity: "warning", path: `$def.${o3[1]}`, ...n6 });
|
|
1512
|
+
for (; null !== (o3 = n5.exec(e4)); ) if (!(o3[1] in t5.variables)) {
|
|
1513
|
+
const n6 = Ui(e4, o3.index, o3[0].length);
|
|
1514
|
+
i3.push({ message: `Unknown variable "$var.${o3[1]}". Defined: ${Object.keys(t5.variables).join(", ") || "none"}`, severity: "warning", path: `$var.${o3[1]}`, ...n6 });
|
|
1503
1515
|
}
|
|
1504
1516
|
}
|
|
1505
|
-
return
|
|
1517
|
+
return i3;
|
|
1506
1518
|
})(e3, r3);
|
|
1507
|
-
n4.push(...
|
|
1519
|
+
n4.push(...t4);
|
|
1508
1520
|
}
|
|
1509
|
-
return { valid: 0 ===
|
|
1521
|
+
return { valid: 0 === i2.length, errors: i2, warnings: n4, context: r3 };
|
|
1510
1522
|
}
|
|
1511
|
-
function
|
|
1512
|
-
let
|
|
1513
|
-
for (let o2 = 0; o2 <
|
|
1514
|
-
return { line:
|
|
1523
|
+
function Hi(e3, t3) {
|
|
1524
|
+
let i2 = 1, n4 = 1;
|
|
1525
|
+
for (let o2 = 0; o2 < t3 && o2 < e3.length; o2++) "\n" === e3[o2] ? (i2++, n4 = 1) : n4++;
|
|
1526
|
+
return { line: i2, column: n4 };
|
|
1515
1527
|
}
|
|
1516
|
-
function
|
|
1517
|
-
const n4 =
|
|
1528
|
+
function Ui(e3, t3, i2) {
|
|
1529
|
+
const n4 = Hi(e3, t3), o2 = Hi(e3, t3 + i2);
|
|
1518
1530
|
return { line: n4.line, column: n4.column, endLine: o2.line, endColumn: o2.column };
|
|
1519
1531
|
}
|
|
1520
|
-
function
|
|
1521
|
-
if (0 ===
|
|
1522
|
-
const
|
|
1523
|
-
if ("string" == typeof
|
|
1524
|
-
const
|
|
1525
|
-
if (-1 !== n4) return
|
|
1532
|
+
function Ai(e3, t3) {
|
|
1533
|
+
if (0 === t3.length) return { line: 1, column: 1 };
|
|
1534
|
+
const i2 = t3[t3.length - 1];
|
|
1535
|
+
if ("string" == typeof i2) {
|
|
1536
|
+
const t4 = `"${i2}"`, n4 = e3.lastIndexOf(t4);
|
|
1537
|
+
if (-1 !== n4) return Hi(e3, n4);
|
|
1526
1538
|
}
|
|
1527
1539
|
return { line: 1, column: 1 };
|
|
1528
1540
|
}
|
|
1529
|
-
function
|
|
1541
|
+
function $i(e3) {
|
|
1530
1542
|
return "object" == typeof e3 && null !== e3 && !Array.isArray(e3);
|
|
1531
1543
|
}
|
|
1532
|
-
function
|
|
1533
|
-
|
|
1534
|
-
}
|
|
1535
|
-
function Qt(e3, i2) {
|
|
1536
|
-
if (Gt(i2)) for (const [t3, n4] of Object.entries(i2)) Kt(n4) && (e3[t3] = n4);
|
|
1537
|
-
}
|
|
1538
|
-
function _t(e3, i2) {
|
|
1539
|
-
if (Gt(i2)) for (const [t3, n4] of Object.entries(i2)) e3[t3] = n4;
|
|
1544
|
+
function Vi(e3, t3) {
|
|
1545
|
+
if ($i(t3)) for (const [i2, n4] of Object.entries(t3)) e3[i2] = n4;
|
|
1540
1546
|
}
|
|
1541
|
-
function
|
|
1542
|
-
const
|
|
1543
|
-
for (const [
|
|
1544
|
-
o3.required &&
|
|
1547
|
+
function Gi(e3, t3) {
|
|
1548
|
+
const i2 = [], n4 = {};
|
|
1549
|
+
for (const [t4, o3] of Object.entries(e3)) {
|
|
1550
|
+
o3.required && i2.push(t4);
|
|
1545
1551
|
const e4 = { type: o3.type };
|
|
1546
1552
|
if (o3.description && (e4.description = o3.description), o3.pattern && (e4.pattern = o3.pattern), void 0 !== o3.minLength && (e4.minLength = o3.minLength), void 0 !== o3.maxLength && (e4.maxLength = o3.maxLength), void 0 !== o3.minimum && (e4.minimum = o3.minimum), void 0 !== o3.maximum && (e4.maximum = o3.maximum), o3.enum && (e4.enum = [...o3.enum]), void 0 !== o3.default && (e4.default = o3.default), "object" === o3.type && o3.properties) {
|
|
1547
|
-
const
|
|
1548
|
-
for (const [e5,
|
|
1549
|
-
e4.properties =
|
|
1553
|
+
const t5 = {};
|
|
1554
|
+
for (const [e5, i3] of Object.entries(o3.properties)) t5[e5] = Ki(i3);
|
|
1555
|
+
e4.properties = t5;
|
|
1550
1556
|
}
|
|
1551
|
-
"array" === o3.type && o3.items && (e4.items =
|
|
1557
|
+
"array" === o3.type && o3.items && (e4.items = Ki(o3.items)), n4[t4] = e4;
|
|
1552
1558
|
}
|
|
1553
1559
|
const o2 = { type: "object", properties: n4 };
|
|
1554
|
-
return
|
|
1560
|
+
return t3 && (o2.title = t3), i2.length > 0 && (o2.required = i2), o2;
|
|
1555
1561
|
}
|
|
1556
|
-
function
|
|
1557
|
-
const
|
|
1558
|
-
if (e3.description && (
|
|
1559
|
-
const
|
|
1560
|
-
for (const [
|
|
1561
|
-
|
|
1562
|
+
function Ki(e3) {
|
|
1563
|
+
const t3 = { type: e3.type };
|
|
1564
|
+
if (e3.description && (t3.description = e3.description), e3.pattern && (t3.pattern = e3.pattern), void 0 !== e3.minLength && (t3.minLength = e3.minLength), void 0 !== e3.maxLength && (t3.maxLength = e3.maxLength), void 0 !== e3.minimum && (t3.minimum = e3.minimum), void 0 !== e3.maximum && (t3.maximum = e3.maximum), e3.enum && (t3.enum = [...e3.enum]), void 0 !== e3.default && (t3.default = e3.default), "object" === e3.type && e3.properties) {
|
|
1565
|
+
const i2 = {};
|
|
1566
|
+
for (const [t4, n4] of Object.entries(e3.properties)) i2[t4] = Ki(n4);
|
|
1567
|
+
t3.properties = i2;
|
|
1562
1568
|
}
|
|
1563
|
-
return "array" === e3.type && e3.items && (
|
|
1569
|
+
return "array" === e3.type && e3.items && (t3.items = Ki(e3.items)), t3;
|
|
1564
1570
|
}
|
|
1565
|
-
function
|
|
1566
|
-
const
|
|
1567
|
-
return void 0 !==
|
|
1571
|
+
function Qi(e3, t3) {
|
|
1572
|
+
const i2 = { type: "array", items: Ki(e3) };
|
|
1573
|
+
return void 0 !== t3?.minItems && (i2.minItems = t3.minItems), void 0 !== t3?.maxItems && (i2.maxItems = t3.maxItems), t3?.description && (i2.description = t3.description), t3?.title && (i2.title = t3.title), i2;
|
|
1568
1574
|
}
|
|
1569
|
-
function
|
|
1570
|
-
const n4 = { type:
|
|
1571
|
-
return
|
|
1575
|
+
function _i(e3, t3 = "string", i2) {
|
|
1576
|
+
const n4 = { type: t3, enum: [...e3] };
|
|
1577
|
+
return i2?.description && (n4.description = i2.description), i2?.title && (n4.title = i2.title), n4;
|
|
1572
1578
|
}
|
|
1573
|
-
function
|
|
1574
|
-
return
|
|
1579
|
+
function Xi(e3, t3, i2) {
|
|
1580
|
+
return Qi({ type: "object" }, { minItems: 2, maxItems: 2, description: i2 || "Tuple with exactly 2 elements [source, transform]" });
|
|
1575
1581
|
}
|
|
1576
|
-
function
|
|
1582
|
+
function Yi(e3) {
|
|
1577
1583
|
return n3.toJSONSchema(e3, { target: "draft-7" });
|
|
1578
1584
|
}
|
|
1579
|
-
var e2,
|
|
1585
|
+
var e2, t2, i, r2, a2, s4, c2, l, d, p, u2, m, f, g, b, h, S2, v, y, w, k, C2, x, P2, D2, E2, j, I, J2, O2, L2, N2, z2, W2, q2, B2, H, U2, A2, $2, V2, G, K2, Q2, _2, X3, Y3, Z2, ee2, te3, ie3, ne2, oe3, re3, ae3, se3, ce3, le3, de2, pe3, ue3, me3, fe3, ge2, be3, he3, Se3, ve3, ye2, we2, ke3, Ce, xe, Pe2, De2, Ee2, je, Ie2, Je2, Oe2, Re3, Me2, Te2, Fe, Le, Ne3, ze2, We, qe2, Be3, He, Ue2, Ae3, $e, Ve2, Ge2, Ke, Qe, _e2, Xe, Ye, Ze2, et, tt, it, nt, ot, rt, at2, st2, ct2, lt2, dt2, pt, ut, mt2, ft, gt2, bt2, ht2, St, vt2, yt2, wt2, kt, Ct, xt, Pt, Dt, Et, jt2, It, Jt, Ot, Rt, Mt, Tt, Ft, Lt, Nt, zt, Wt, qt, Bt, Ht, Ut, At, $t, Vt, Gt, Kt, Qt, _t, Xt, Yt, Zt, ei, ti, ii, ni, oi, ri, ai, si, ci, li, di, pi, ui, mi, fi, gi, bi, hi, Si, vi, yi, wi, ki, Ei, ji, Ii, Ji, Oi, Ri, Mi, Ti, Fi, Ni, zi, Wi, qi, en;
|
|
1580
1586
|
var init_dev = __esm({
|
|
1581
1587
|
"../core/dist/dev.mjs"() {
|
|
1582
1588
|
"use strict";
|
|
1583
1589
|
e2 = Object.defineProperty;
|
|
1584
|
-
|
|
1585
|
-
for (var n4 in
|
|
1590
|
+
t2 = (t3, i2) => {
|
|
1591
|
+
for (var n4 in i2) e2(t3, n4, { get: i2[n4], enumerable: true });
|
|
1586
1592
|
};
|
|
1587
|
-
|
|
1588
|
-
i
|
|
1593
|
+
i = {};
|
|
1594
|
+
t2(i, { BaseContextConfig: () => N2, BatchConfig: () => z2, CacheRuleSchema: () => Be3, CacheSchema: () => He, CacheSchemas: () => qe2, ClickIdEntrySchema: () => qi, CodeSchema: () => Ni, CollectorSchemas: () => bt2, ConsentSchema: () => Q2, ContractActionsSchema: () => bi, ContractRuleSchema: () => Si, ContractSchema: () => vi, ContractSchemaEntry: () => gi, Counter: () => d, DeepPartialEventSchema: () => ie3, DestinationSchemas: () => Re3, DestinationsMapConfig: () => B2, EntitiesSchema: () => Z2, EntitySchema: () => Y3, EventSchema: () => ee2, FlowBundlePackageSchema: () => ri, FlowBundleSchema: () => ai, FlowCodeSchema: () => si, FlowConfigSchema: () => yi, FlowDestinationSchema: () => mi, FlowJsonSchema: () => ki, FlowSchema: () => wi, FlowSchemas: () => ti, FlowSourceSchema: () => pi, FlowStoreSchema: () => fi, FlowTransformerSchema: () => ui, GenericEnvConfig: () => O2, GenericSettingsConfig: () => J2, HandlersConfig: () => x, HintSchema: () => zi, HintsSchema: () => Wi, IdConfig: () => E2, Identifier: () => c2, InitConfig: () => j, LoggerConfigSchema: () => Ae3, LoggerHandlerSchema: () => Ue2, LoopSchema: () => fe3, MapSchema: () => be3, MappingResultSchema: () => ke3, MappingSchemas: () => pe3, MatchExpressionSchema: () => Le, MatcherSchemas: () => Me2, NextRuleSchema: () => We, OptionalPrimitiveValue: () => u2, OrderedPropertiesSchema: () => G, PartialEventSchema: () => te3, PolicySchema: () => Se3, PrimaryConfig: () => I, PrimitiveValue: () => p, ProcessingControlConfig: () => W2, PropertiesSchema: () => V2, PropertySchema: () => $2, PropertyTypeSchema: () => A2, QueueConfig: () => D2, RequiredBoolean: () => s4, RequiredNumber: () => a2, RequiredString: () => r2, RoutableNextSchema: () => ze2, RuleSchema: () => ve3, RulesSchema: () => ye2, RuntimeInstanceConfig: () => L2, SetSchema: () => ge2, SourceSchema: () => X3, SourceSchemas: () => Ot, SourceTypeSchema: () => K2, SourcesMapConfig: () => q2, StoreSchemas: () => _t, Timestamp: () => l, TransformerSchemas: () => $t, UserSchema: () => _2, UtilitySchemas: () => m, ValueConfigSchema: () => he3, ValueSchema: () => ue3, ValuesSchema: () => me3, VerboseConfig: () => P2, WalkerOSSchemas: () => H, configJsonSchema: () => Ei, consentJsonSchema: () => de2, contractJsonSchema: () => Fi, contractRuleJsonSchema: () => Ti, createArraySchema: () => Qi, createConsentConfig: () => F2, createDataTransformationConfig: () => R2, createEnumSchema: () => _i, createMappingRulesConfig: () => M2, createObjectSchema: () => Gi, createPolicyConfig: () => T2, createTupleSchema: () => Xi, destinationJsonSchema: () => Oi, entityJsonSchema: () => ce3, eventJsonSchema: () => ne2, flowConfigJsonSchema: () => Ii, flowJsonSchema: () => ji, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee2, orderedPropertiesJsonSchema: () => se3, parseConfig: () => Ci, parseFlow: () => Pi, partialEventJsonSchema: () => oe3, policyJsonSchema: () => je, propertiesJsonSchema: () => ae3, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Je2, safeParseConfig: () => xi, safeParseFlow: () => Di, setJsonSchema: () => De2, sourceJsonSchema: () => Ji, sourceTypeJsonSchema: () => le3, storeJsonSchema: () => Mi, transformerJsonSchema: () => Ri, userJsonSchema: () => re3, validateFlowConfig: () => Bi, valueConfigJsonSchema: () => xe, valueJsonSchema: () => Ce, z: () => n3, zodToSchema: () => Yi });
|
|
1589
1595
|
r2 = n3.string();
|
|
1590
|
-
|
|
1591
|
-
|
|
1596
|
+
a2 = n3.number();
|
|
1597
|
+
s4 = n3.boolean();
|
|
1592
1598
|
c2 = n3.string().min(1);
|
|
1593
1599
|
l = n3.number().int().positive();
|
|
1594
1600
|
d = n3.number().int().nonnegative();
|
|
1595
1601
|
p = n3.union([n3.string(), n3.number(), n3.boolean()]);
|
|
1596
1602
|
u2 = p.optional();
|
|
1597
1603
|
m = {};
|
|
1598
|
-
|
|
1604
|
+
t2(m, { ErrorHandlerSchema: () => b, HandlerSchema: () => S2, LogHandlerSchema: () => h, StorageSchema: () => g, StorageTypeSchema: () => f, errorHandlerJsonSchema: () => w, handlerJsonSchema: () => C2, logHandlerJsonSchema: () => k, storageJsonSchema: () => y, storageTypeJsonSchema: () => v });
|
|
1599
1605
|
f = n3.enum(["local", "session", "cookie"]).meta({ id: "StorageType", title: "Storage.Type", description: "Storage mechanism: local, session, or cookie." }).describe("Storage mechanism: local, session, or cookie");
|
|
1600
1606
|
g = n3.object({ Local: n3.literal("local"), Session: n3.literal("session"), Cookie: n3.literal("cookie") }).meta({ id: "StorageConstants", title: "Storage", description: "Storage type constants for type-safe references." }).describe("Storage type constants for type-safe references");
|
|
1601
1607
|
b = n3.unknown().meta({ id: "ErrorHandler", title: "Error.Handler", description: "Error handler function: (error, state?) => void." }).describe("Error handler function: (error, state?) => void");
|
|
@@ -1604,7 +1610,7 @@ var init_dev = __esm({
|
|
|
1604
1610
|
v = o(f);
|
|
1605
1611
|
y = o(g);
|
|
1606
1612
|
w = o(b);
|
|
1607
|
-
|
|
1613
|
+
k = o(h);
|
|
1608
1614
|
C2 = o(S2);
|
|
1609
1615
|
x = n3.object({ onError: b.optional().describe("Error handler function: (error, state?) => void"), onLog: h.optional().describe("Log handler function: (message, verbose?) => void") }).partial();
|
|
1610
1616
|
P2 = n3.object({ verbose: n3.boolean().describe("Enable verbose logging for debugging").optional() }).partial();
|
|
@@ -1617,177 +1623,175 @@ var init_dev = __esm({
|
|
|
1617
1623
|
L2 = n3.object({ type: n3.string().optional().describe("Instance type identifier"), config: n3.unknown().describe("Instance configuration") }).partial();
|
|
1618
1624
|
N2 = n3.object({ collector: n3.unknown().describe("Collector instance (runtime object)"), config: n3.unknown().describe("Configuration"), env: n3.unknown().describe("Environment dependencies") }).partial();
|
|
1619
1625
|
z2 = n3.object({ batch: n3.number().optional().describe("Batch size: bundle N events for batch processing"), batched: n3.unknown().optional().describe("Batch of events to be processed") }).partial();
|
|
1620
|
-
|
|
1626
|
+
W2 = n3.object({ ignore: n3.boolean().describe("Set to true to skip processing").optional(), condition: n3.string().optional().describe("Condition function: return true to process") }).partial();
|
|
1621
1627
|
q2 = n3.object({ sources: n3.record(n3.string(), n3.unknown()).describe("Map of source instances") }).partial();
|
|
1622
1628
|
B2 = n3.object({ destinations: n3.record(n3.string(), n3.unknown()).describe("Map of destination instances") }).partial();
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
V2 = n3.record(n3.string(),
|
|
1628
|
-
|
|
1629
|
+
H = {};
|
|
1630
|
+
t2(H, { ConsentSchema: () => Q2, DeepPartialEventSchema: () => ie3, EntitiesSchema: () => Z2, EntitySchema: () => Y3, EventSchema: () => ee2, OrderedPropertiesSchema: () => G, PartialEventSchema: () => te3, PropertiesSchema: () => V2, PropertySchema: () => $2, PropertyTypeSchema: () => A2, SourceSchema: () => X3, SourceTypeSchema: () => K2, UserSchema: () => _2, consentJsonSchema: () => de2, entityJsonSchema: () => ce3, eventJsonSchema: () => ne2, orderedPropertiesJsonSchema: () => se3, partialEventJsonSchema: () => oe3, propertiesJsonSchema: () => ae3, sourceTypeJsonSchema: () => le3, userJsonSchema: () => re3 });
|
|
1631
|
+
A2 = n3.lazy(() => n3.union([n3.boolean(), n3.string(), n3.number(), n3.record(n3.string(), $2)])).meta({ id: "WalkerOSPropertyType", title: "WalkerOS.PropertyType", description: "Base property value types (boolean, string, number, or nested Property record)." });
|
|
1632
|
+
$2 = n3.lazy(() => n3.union([A2, n3.array(A2)])).meta({ id: "WalkerOSProperty", title: "WalkerOS.Property", description: "PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays." });
|
|
1633
|
+
V2 = n3.record(n3.string(), $2.optional()).meta({ id: "WalkerOSProperties", title: "WalkerOS.Properties", description: "Flexible property collection with optional values." }).describe("Flexible property collection with optional values");
|
|
1634
|
+
G = n3.record(n3.string(), n3.tuple([$2, n3.number()]).optional()).meta({ id: "WalkerOSOrderedProperties", title: "WalkerOS.OrderedProperties", description: "Ordered properties with [value, order] tuples for priority control." }).describe("Ordered properties with [value, order] tuples for priority control");
|
|
1629
1635
|
K2 = n3.union([n3.enum(["web", "server", "app", "other"]), n3.string()]).meta({ id: "WalkerOSSourceType", title: "WalkerOS.SourceType", description: "Source type identifier. Standard: web, server, app, other. Extensible to custom strings." }).describe("Source type: web, server, app, other, or custom");
|
|
1630
|
-
|
|
1636
|
+
Q2 = n3.record(n3.string(), n3.boolean()).meta({ id: "WalkerOSConsent", title: "WalkerOS.Consent", description: "Consent state mapping. Keys are consent groups (e.g. marketing, functional), values are booleans for granted/denied." }).describe("Consent requirement mapping (group name to state)");
|
|
1631
1637
|
_2 = V2.and(n3.object({ id: n3.string().optional().describe("User identifier"), device: n3.string().optional().describe("Device identifier"), session: n3.string().optional().describe("Session identifier"), hash: n3.string().optional().describe("Hashed identifier"), address: n3.string().optional().describe("User address"), email: n3.string().email().optional().describe("User email address"), phone: n3.string().optional().describe("User phone number"), userAgent: n3.string().optional().describe("Browser user agent string"), browser: n3.string().optional().describe("Browser name"), browserVersion: n3.string().optional().describe("Browser version"), deviceType: n3.string().optional().describe("Device type (mobile, desktop, tablet)"), os: n3.string().optional().describe("Operating system"), osVersion: n3.string().optional().describe("Operating system version"), screenSize: n3.string().optional().describe("Screen dimensions"), language: n3.string().optional().describe("User language"), country: n3.string().optional().describe("User country"), region: n3.string().optional().describe("User region/state"), city: n3.string().optional().describe("User city"), zip: n3.string().optional().describe("User postal code"), timezone: n3.string().optional().describe("User timezone"), ip: n3.string().optional().describe("User IP address"), internal: n3.boolean().optional().describe("Internal user flag (employee, test user)") })).meta({ id: "WalkerOSUser", title: "WalkerOS.User", description: "User identification and attributes." }).describe("User identification and properties");
|
|
1632
1638
|
X3 = V2.and(n3.object({ type: n3.string().describe("Source kind (browser, dataLayer, gtag, ...)"), platform: n3.string().optional().describe("Runtime platform (web, server, app, ios, android, terminal, ...)"), version: n3.string().optional().describe("Deployment version of the source emitter"), schema: n3.string().optional().describe('Event model spec version (collector defaults to "4")'), count: n3.number().int().nonnegative().optional().describe("Emission sequence per run"), trace: n3.string().optional().describe("W3C traceparent full string"), url: n3.string().optional(), referrer: n3.string().optional(), tool: n3.string().optional(), command: n3.string().optional() })).meta({ id: "WalkerOSSource", title: "WalkerOS.Source", description: "Event source information (origin of the event)." }).describe("Event source information");
|
|
1633
|
-
Y3 = n3.lazy(() => n3.object({ entity: n3.string().describe("Entity name"), data: V2.describe("Entity-specific properties"), nested: n3.array(Y3).optional().describe("Nested child entities"), context:
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1639
|
+
Y3 = n3.lazy(() => n3.object({ entity: n3.string().describe("Entity name"), data: V2.describe("Entity-specific properties"), nested: n3.array(Y3).optional().describe("Nested child entities"), context: G.optional().describe("Entity context data") })).meta({ id: "WalkerOSEntity", title: "WalkerOS.Entity", description: "Nested entity structure with recursive nesting support." }).describe("Nested entity structure with recursive nesting support");
|
|
1640
|
+
Z2 = n3.array(Y3).meta({ id: "WalkerOSEntities", title: "WalkerOS.Entities", description: "Array of nested entities." }).describe("Array of nested entities");
|
|
1641
|
+
ee2 = n3.object({ name: n3.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: V2.describe("Event-specific properties"), context: G.describe("Ordered context properties with priorities"), globals: V2.describe("Global properties shared across events"), custom: V2.describe("Custom implementation-specific properties"), user: _2.describe("User identification and attributes"), nested: Z2.describe("Related nested entities"), consent: Q2.describe("Consent states at event time"), id: c2.describe("W3C span_id, 16 lowercase hex characters"), trigger: r2.describe("Event trigger identifier"), entity: r2.describe("Parsed entity from event name"), action: r2.describe("Parsed action from event name"), timestamp: l.describe("Unix timestamp in milliseconds since epoch"), timing: a2.describe("Event processing timing information"), source: X3.describe("Event source information") }).meta({ id: "WalkerOSEvent", title: "WalkerOS.Event", description: "Complete walkerOS event structure." }).describe("Complete walkerOS event structure");
|
|
1642
|
+
te3 = ee2.partial().meta({ id: "WalkerOSPartialEvent", title: "WalkerOS.PartialEvent", description: "Partial event structure with all fields optional." }).describe("Partial event structure with all fields optional");
|
|
1643
|
+
ie3 = ee2.partial().meta({ id: "WalkerOSDeepPartialEvent", title: "WalkerOS.DeepPartialEvent", description: "Partial event structure with all top-level fields optional." }).describe("Partial event structure with all top-level fields optional");
|
|
1644
|
+
ne2 = o(ee2);
|
|
1645
|
+
oe3 = o(te3);
|
|
1640
1646
|
re3 = o(_2);
|
|
1641
1647
|
ae3 = o(V2);
|
|
1642
|
-
se3 = o(
|
|
1648
|
+
se3 = o(G);
|
|
1643
1649
|
ce3 = o(Y3);
|
|
1644
1650
|
le3 = o(K2);
|
|
1645
|
-
|
|
1651
|
+
de2 = o(Q2);
|
|
1646
1652
|
pe3 = {};
|
|
1647
|
-
|
|
1648
|
-
ue3 = n3.lazy(() => n3.union([n3.string().describe('String value or property path (e.g., "data.id")'), n3.number().describe("Numeric value"), n3.boolean().describe("Boolean value"), n3.lazy(() =>
|
|
1649
|
-
|
|
1653
|
+
t2(pe3, { ConfigSchema: () => we2, LoopSchema: () => fe3, MapSchema: () => be3, PolicySchema: () => Se3, ResultSchema: () => ke3, RuleSchema: () => ve3, RulesSchema: () => ye2, SetSchema: () => ge2, ValueConfigSchema: () => he3, ValueSchema: () => ue3, ValuesSchema: () => me3, configJsonSchema: () => Oe2, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee2, policyJsonSchema: () => je, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Je2, setJsonSchema: () => De2, valueConfigJsonSchema: () => xe, valueJsonSchema: () => Ce });
|
|
1654
|
+
ue3 = n3.lazy(() => n3.union([n3.string().describe('String value or property path (e.g., "data.id")'), n3.number().describe("Numeric value"), n3.boolean().describe("Boolean value"), n3.lazy(() => U2), n3.array(ue3).describe("Array of values")])).meta({ id: "MappingValue", title: "Mapping.Value", description: "Polymorphic transform primitive used in every mapping field. A string path, constant, operator object (map/loop/set/condition/consent), or array of values." });
|
|
1655
|
+
me3 = n3.array(ue3).meta({ id: "MappingValues", title: "Mapping.Values", description: "Array of transformation values." }).describe("Array of transformation values");
|
|
1650
1656
|
fe3 = n3.lazy(() => n3.tuple([ue3, ue3]).describe("Loop transformation: [source, transform] tuple for array processing")).meta({ id: "MappingLoop", title: "Mapping.Loop", description: "Loop tuple [source, transform] for iterating and transforming arrays." });
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
he3 =
|
|
1657
|
+
ge2 = n3.lazy(() => n3.array(ue3).describe("Set: Array of values for selection or combination")).meta({ id: "MappingSet", title: "Mapping.Set", description: "Set: array of values for selection or combination." });
|
|
1658
|
+
be3 = n3.lazy(() => n3.record(n3.string(), ue3).describe("Map: Object mapping keys to transformation values")).meta({ id: "MappingMap", title: "Mapping.Map", description: "Map: object mapping keys to transformation values." });
|
|
1659
|
+
he3 = U2 = n3.object({ key: n3.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: n3.union([n3.string(), n3.number(), n3.boolean()]).optional().describe("Static primitive value"), fn: n3.string().optional().describe("Custom transformation function as string (serialized)"), map: be3.optional().describe("Object mapping: transform event data to structured output"), loop: fe3.optional().describe("Loop transformation: [source, transform] for array processing"), set: ge2.optional().describe("Set of values: combine or select from multiple values"), consent: Q2.optional().describe("Required consent states to include this value"), condition: n3.string().optional().describe("Condition function as string: return true to include value"), validate: n3.string().optional().describe("Validation function as string: return true if value is valid") }).refine((e3) => Object.keys(e3).length > 0, { message: "ValueConfig must have at least one property" }).meta({ id: "MappingValueConfig", title: "Mapping.ValueConfig", description: "Object-form value transformation with map/loop/set/condition/consent etc." }).describe("Value transformation configuration with multiple strategies");
|
|
1654
1660
|
Se3 = n3.record(n3.string(), ue3).meta({ id: "MappingPolicy", title: "Mapping.Policy", description: "Policy rules for event pre-processing (key \u2192 value transformation)." }).describe("Policy rules for event pre-processing (key \u2192 value mapping)");
|
|
1655
|
-
ve3 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([ue3,
|
|
1661
|
+
ve3 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([ue3, me3]).optional().describe("Data transformation rules for event"), settings: n3.any().optional().describe("Destination-specific settings for this event mapping"), condition: n3.string().optional().describe("Condition function as string: return true to process event"), consent: Q2.optional().describe("Required consent states to process this event"), policy: Se3.optional().describe("Event-level policy overrides (applied after config-level policy)"), batch: n3.number().optional().describe("Batch size: bundle N events for batch processing"), include: n3.array(n3.string()).optional().describe('Event sections (e.g. ["context", "globals"]) flattened into context.data'), ignore: n3.boolean().optional().describe("Skip the event entirely. No push, no side effects. Use for suppression."), silent: n3.boolean().optional().describe("Run side effects (settings.identify, ...) but suppress the destination default push call.") }).meta({ id: "MappingRule", title: "Mapping.Rule", description: "Configuration for transforming a single event at one stage of the flow (source or destination)." }).describe("Mapping rule for specific entity-action combination");
|
|
1656
1662
|
ye2 = n3.record(n3.string(), n3.record(n3.string(), n3.union([ve3, n3.array(ve3)])).optional()).meta({ id: "MappingRules", title: "Mapping.Rules", description: 'Event mapping rules tree: entity \u2192 action \u2192 Rule (or Rule[]). Use "*" as wildcard for entity or action.' }).describe('Event mapping rules: entity \u2192 action \u2192 Rule. Keys match event name split by space. Use "*" as wildcard for entity or action. Priority: exact > entity wildcard > action wildcard > global wildcard (*\u2192*).');
|
|
1657
|
-
we2 = n3.object({ consent:
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
De2 = o(
|
|
1663
|
-
Ee2 = o(
|
|
1664
|
-
|
|
1663
|
+
we2 = n3.object({ consent: Q2.optional().describe("Required consent states to process any events"), data: n3.union([ue3, me3]).optional().describe("Global data transformation applied to all events"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), mapping: ye2.optional().describe("Entity-action specific mapping rules"), policy: Se3.optional().describe("Pre-processing policy rules applied before mapping") }).meta({ id: "MappingConfig", title: "Mapping.Config", description: "Shared mapping configuration (consent, data, include, mapping, policy)." }).describe("Shared mapping configuration for sources and destinations");
|
|
1664
|
+
ke3 = n3.object({ eventMapping: ve3.optional().describe("Resolved mapping rule for event"), mappingKey: n3.string().optional().describe('Mapping key used (e.g., "product.view")') }).meta({ id: "MappingResult", title: "Mapping.Result", description: "Mapping resolution result (matched rule + key)." }).describe("Mapping resolution result");
|
|
1665
|
+
Ce = o(ue3);
|
|
1666
|
+
xe = o(he3);
|
|
1667
|
+
Pe2 = o(fe3);
|
|
1668
|
+
De2 = o(ge2);
|
|
1669
|
+
Ee2 = o(be3);
|
|
1670
|
+
je = o(Se3);
|
|
1665
1671
|
Ie2 = o(ve3);
|
|
1666
1672
|
Je2 = o(ye2);
|
|
1667
|
-
|
|
1668
|
-
Fe = {};
|
|
1669
|
-
i(Fe, { BatchSchema: () => Ze, ConfigSchema: () => Ae3, ContextSchema: () => Ke2, DLQSchema: () => ci, DataSchema: () => ei, DestinationPolicySchema: () => Ge2, DestinationsSchema: () => oi, InitDestinationsSchema: () => ni, InitSchema: () => ti, InstanceSchema: () => ii, PartialConfigSchema: () => Ve2, PushBatchContextSchema: () => _e2, PushContextSchema: () => Qe, PushEventSchema: () => Xe, PushEventsSchema: () => Ye, PushResultSchema: () => ai, RefSchema: () => ri, ResultSchema: () => si, batchJsonSchema: () => mi, configJsonSchema: () => li, contextJsonSchema: () => pi, instanceJsonSchema: () => fi, partialConfigJsonSchema: () => di, pushContextJsonSchema: () => ui, resultJsonSchema: () => gi });
|
|
1673
|
+
Oe2 = o(we2);
|
|
1670
1674
|
Re3 = {};
|
|
1671
|
-
|
|
1672
|
-
Me2 =
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
+
t2(Re3, { BatchSchema: () => Ze2, ConfigSchema: () => $e, ContextSchema: () => Ke, DLQSchema: () => ct2, DataSchema: () => et, DestinationPolicySchema: () => Ge2, DestinationsSchema: () => ot, InitDestinationsSchema: () => nt, InitSchema: () => it, InstanceSchema: () => tt, PartialConfigSchema: () => Ve2, PushBatchContextSchema: () => _e2, PushContextSchema: () => Qe, PushEventSchema: () => Xe, PushEventsSchema: () => Ye, PushResultSchema: () => at2, RefSchema: () => rt, ResultSchema: () => st2, batchJsonSchema: () => mt2, configJsonSchema: () => lt2, contextJsonSchema: () => pt, instanceJsonSchema: () => ft, partialConfigJsonSchema: () => dt2, pushContextJsonSchema: () => ut, resultJsonSchema: () => gt2 });
|
|
1676
|
+
Me2 = {};
|
|
1677
|
+
t2(Me2, { MatchExpressionSchema: () => Le, NextRuleSchema: () => We, RoutableNextSchema: () => ze2 });
|
|
1678
|
+
Te2 = n3.enum(["eq", "contains", "prefix", "suffix", "regex", "gt", "lt", "exists"]).meta({ id: "MatcherOperator", title: "Matcher.Operator", description: "Supported operators for a match condition." });
|
|
1679
|
+
Fe = n3.object({ key: n3.string(), operator: Te2, value: n3.string(), not: n3.boolean().optional() }).meta({ id: "MatcherCondition", title: "Matcher.Condition", description: "Single match condition (key, operator, value, optional not)." });
|
|
1680
|
+
Le = n3.union([Fe, n3.object({ and: n3.array(n3.lazy(() => Le)) }), n3.object({ or: n3.array(n3.lazy(() => Le)) })]).meta({ id: "MatcherExpression", title: "Matcher.Expression", description: "Boolean expression tree of match conditions (leaf, and, or)." });
|
|
1675
1681
|
Ne3 = n3.union([Le, n3.literal("*")]);
|
|
1676
1682
|
ze2 = n3.union([n3.string(), n3.array(n3.string()), n3.array(n3.object({ match: Ne3, next: n3.lazy(() => ze2) }))]).meta({ id: "MatcherNext", title: "Matcher.Next", description: "Routable next target: ID, ID list, or list of {match, next} rules." });
|
|
1677
|
-
|
|
1683
|
+
We = n3.object({ match: Ne3, next: n3.lazy(() => ze2) }).meta({ id: "MatcherNextRule", title: "Matcher.NextRule", description: "Single routing rule pairing a match expression with a next target." });
|
|
1678
1684
|
qe2 = {};
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
Ve2 =
|
|
1685
|
+
t2(qe2, { CacheRuleSchema: () => Be3, CacheSchema: () => He });
|
|
1686
|
+
Be3 = n3.object({ match: n3.union([Le, n3.literal("*")]).describe("Match expression or wildcard to determine when this rule applies"), key: n3.array(n3.string()).min(1).describe("Dot-path fields used to build the cache key"), ttl: n3.number().positive().describe("Time-to-live in seconds for cached entries"), update: n3.record(n3.string(), ue3).optional().describe("Response mutations applied on cache hit (key \u2192 Value mapping)") }).meta({ id: "CacheRule", title: "Cache.Rule", description: "Single caching rule: when it applies (match), what keys it keys off, TTL, and optional response mutations on hit." });
|
|
1687
|
+
He = n3.object({ full: n3.boolean().optional().describe("Stop flow on cache HIT (default: false). When true, skip remaining steps and return cached value."), store: n3.string().optional().describe("Store ID for persistent caching (references a configured store)"), rules: n3.array(Be3).min(1).describe("Cache rules \u2014 at least one required") }).meta({ id: "CacheConfig", title: "Cache.Config", description: "Top-level cache configuration for a pipeline step (destination / transformer / source ref)." });
|
|
1688
|
+
Ue2 = n3.any().meta({ id: "LoggerHandler", title: "Logger.Handler", description: "Custom log handler function (level, ...args) => void" });
|
|
1689
|
+
Ae3 = n3.object({ level: n3.union([n3.number(), n3.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: Ue2.optional().describe("Custom log handler function") }).meta({ id: "LoggerConfig", title: "Logger.Config", description: "Logger configuration (level, handler) to override the collector defaults" });
|
|
1690
|
+
$e = n3.object({ consent: Q2.optional().describe("Required consent states to send events to this destination"), settings: n3.any().meta({ id: "DestinationSettings", title: "Destination.Settings", description: "Implementation-specific configuration (destination-defined shape)." }).describe("Implementation-specific configuration").optional(), data: n3.union([ue3, me3]).optional().describe("Global data transformation applied to all events for this destination"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), env: n3.any().meta({ id: "DestinationEnv", title: "Destination.Env", description: "Environment dependencies (destination-defined shape) \u2014 platform, SDK, or mock hook." }).describe("Environment dependencies (platform-specific)").optional(), id: c2.describe("Destination instance identifier (defaults to destination key)").optional(), init: n3.boolean().describe("Whether to initialize immediately").optional(), loadScript: n3.boolean().describe("Whether to load external script (for web destinations)").optional(), mapping: ye2.optional().describe("Entity-action specific mapping rules for this destination"), policy: Se3.optional().describe("Pre-processing policy rules applied before event mapping"), queue: n3.boolean().describe("Whether to queue events when consent is not granted").optional(), require: n3.array(n3.string()).optional().describe('Defer destination initialization until these collector events fire (e.g., ["consent"])'), logger: Ae3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)"), before: ze2.optional().describe("Post-collector transformer chain applied before this destination receives the event"), next: ze2.optional().describe("Post-push transformer chain. Runs after destination push completes; push response is available at ingest._response"), cache: He.optional().describe("Cache configuration for deduplication; skip push on cache HIT"), disabled: n3.boolean().describe("Completely skip this destination (no init, no push, no queue)").optional(), mock: n3.unknown().meta({ id: "DestinationMock", title: "Destination.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Dev/testing only.") }).meta({ id: "DestinationConfig", title: "Destination.Config", description: "Destination configuration: consent, settings, data, env, mapping rules, policy, queue, logger, before/next chains, cache." }).describe("Destination configuration");
|
|
1691
|
+
Ve2 = $e.partial().meta({ id: "DestinationPartialConfig", title: "Destination.PartialConfig", description: "Partial destination configuration with all fields optional." }).describe("Partial destination configuration with all fields optional");
|
|
1686
1692
|
Ge2 = Se3.describe("Destination policy rules for event pre-processing");
|
|
1687
|
-
|
|
1688
|
-
Qe =
|
|
1693
|
+
Ke = n3.object({ collector: n3.unknown().meta({ id: "DestinationContextCollector", title: "Collector.Instance", description: "Collector instance handed to the destination (runtime object)." }).describe("Collector instance (runtime object)"), config: $e.describe("Destination configuration"), data: n3.union([n3.unknown(), n3.array(n3.unknown())]).optional().describe("Transformed event data"), env: n3.unknown().meta({ id: "DestinationContextEnv", title: "Destination.Env", description: "Environment dependencies (destination-defined shape)." }).describe("Environment dependencies") }).meta({ id: "DestinationContext", title: "Destination.Context", description: "Destination context passed to init and push functions." }).describe("Destination context for init and push functions");
|
|
1694
|
+
Qe = Ke.extend({ mapping: ve3.optional().describe("Resolved mapping rule for this specific event") }).meta({ id: "DestinationPushContext", title: "Destination.PushContext", description: "Destination context for push() with the resolved event mapping rule." }).describe("Push context with event-specific mapping");
|
|
1689
1695
|
_e2 = Qe.describe("Batch push context with event-specific mapping");
|
|
1690
|
-
Xe = n3.object({ event:
|
|
1696
|
+
Xe = n3.object({ event: ee2.describe("The event to process"), mapping: ve3.optional().describe("Mapping rule for this event") }).meta({ id: "DestinationPushEvent", title: "Destination.PushEvent", description: "Single event paired with its resolved mapping rule (batch element)." }).describe("Event with optional mapping for batch processing");
|
|
1691
1697
|
Ye = n3.array(Xe).meta({ id: "DestinationPushEvents", title: "Destination.PushEvents", description: "Array of events with mappings (batch input)." }).describe("Array of events with mappings");
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
Ut = n3.object({ param: n3.string().describe("Lowercase URL parameter name. Match is case-insensitive on lookup."), platform: n3.string().describe("Canonical platform identifier (lowercase, kebab-case).") });
|
|
1790
|
-
rn = { source: Oi.configJsonSchema, destination: Fe.configJsonSchema };
|
|
1698
|
+
Ze2 = n3.object({ key: n3.string().describe('Batch key (usually mapping key like "product.view")'), events: n3.array(ee2).describe("Array of events in batch"), data: n3.array(n3.union([n3.unknown(), n3.array(n3.unknown())]).optional()).describe("Transformed data for each event"), mapping: ve3.optional().describe("Shared mapping rule for batch") }).meta({ id: "DestinationBatch", title: "Destination.Batch", description: "Batch of events grouped by mapping key for batch delivery." }).describe("Batch of events grouped by mapping key");
|
|
1699
|
+
et = n3.union([n3.unknown(), n3.array(n3.unknown())]).meta({ id: "DestinationData", title: "Destination.Data", description: "Transformed event data delivered to the destination (Property, undefined, or array)." }).optional().describe("Transformed event data (Property, undefined, or array)");
|
|
1700
|
+
tt = n3.object({ config: $e.describe("Destination configuration"), queue: n3.array(ee2).optional().describe("Queued events awaiting consent"), dlq: n3.array(n3.tuple([ee2, n3.unknown()])).optional().describe("Dead letter queue (failed events with errors)"), type: n3.string().optional().describe("Destination type identifier"), env: n3.unknown().optional().describe("Environment dependencies"), init: n3.unknown().optional().describe("Initialization function"), push: n3.unknown().describe("Push function for single events"), pushBatch: n3.unknown().optional().describe("Batch push function"), on: n3.unknown().optional().describe("Event lifecycle hook function") }).meta({ id: "DestinationInstance", title: "Destination.Instance", description: "Destination instance (runtime object with init/push/pushBatch/on)." }).describe("Destination instance (runtime object with functions)");
|
|
1701
|
+
it = n3.object({ code: tt.describe("Destination instance with implementation"), config: Ve2.optional().describe("Partial configuration overrides"), env: n3.unknown().optional().describe("Partial environment overrides") }).meta({ id: "DestinationInit", title: "Destination.Init", description: "Destination initialization bundle (instance code + config + env)." }).describe("Destination initialization configuration");
|
|
1702
|
+
nt = n3.record(n3.string(), it).meta({ id: "DestinationInitDestinations", title: "Destination.InitDestinations", description: "Map of destination IDs to initialization configurations." }).describe("Map of destination IDs to initialization configurations");
|
|
1703
|
+
ot = n3.record(n3.string(), tt).meta({ id: "DestinationDestinations", title: "Destination.Destinations", description: "Map of destination IDs to runtime destination instances." }).describe("Map of destination IDs to runtime instances");
|
|
1704
|
+
rt = n3.object({ type: n3.string().describe('Destination type ("gtag", "meta", "bigquery")'), data: n3.unknown().optional().describe("Response from push()"), error: n3.unknown().optional().describe("Error if failed") }).meta({ id: "DestinationRef", title: "Destination.Ref", description: "Reference to a destination outcome (type + response data or error)." }).describe("Destination reference with type and response data");
|
|
1705
|
+
at2 = n3.object({ queue: n3.array(ee2).optional().describe("Events queued (awaiting consent)"), error: n3.unknown().optional().describe("Error if push failed") }).meta({ id: "DestinationPushResult", title: "Destination.PushResult", description: "Result of a single destination push (queued events, optional error)." }).describe("Push operation result");
|
|
1706
|
+
st2 = n3.object({ ok: n3.boolean().describe("True if nothing failed"), event: n3.unknown().optional().describe("The processed event"), done: n3.record(n3.string(), rt).optional().describe("Destinations that processed successfully"), queued: n3.record(n3.string(), rt).optional().describe("Destinations that queued events"), failed: n3.record(n3.string(), rt).optional().describe("Destinations that failed to process") }).meta({ id: "DestinationResult", title: "Destination.Result", description: "Overall push result aggregated across all destinations (done/queued/failed maps)." }).describe("Push result with destination outcomes");
|
|
1707
|
+
ct2 = n3.array(n3.tuple([ee2, n3.unknown()])).meta({ id: "DestinationDLQ", title: "Destination.DLQ", description: "Dead-letter queue: list of [event, error] tuples." }).describe("Dead letter queue: [(event, error), ...]");
|
|
1708
|
+
lt2 = o($e);
|
|
1709
|
+
dt2 = o(Ve2);
|
|
1710
|
+
pt = o(Ke);
|
|
1711
|
+
ut = o(Qe);
|
|
1712
|
+
mt2 = o(Ze2);
|
|
1713
|
+
ft = o(tt);
|
|
1714
|
+
gt2 = o(st2);
|
|
1715
|
+
bt2 = {};
|
|
1716
|
+
t2(bt2, { CommandTypeSchema: () => ht2, ConfigSchema: () => St, DestinationsSchema: () => Ct, InitConfigSchema: () => yt2, InstanceSchema: () => xt, PushContextSchema: () => wt2, SessionDataSchema: () => vt2, SourcesSchema: () => kt, commandTypeJsonSchema: () => Pt, configJsonSchema: () => Dt, initConfigJsonSchema: () => jt2, instanceJsonSchema: () => Jt, pushContextJsonSchema: () => It, sessionDataJsonSchema: () => Et });
|
|
1717
|
+
ht2 = n3.union([n3.enum(["action", "config", "consent", "context", "destination", "elb", "globals", "hook", "init", "link", "run", "user", "walker"]), n3.string()]).meta({ id: "CollectorCommandType", title: "Collector.CommandType", description: "Collector command type identifier (standard or extension string)." }).describe("Collector command type: standard commands or custom string for extensions");
|
|
1718
|
+
St = n3.object({ run: n3.boolean().describe("Whether to run collector automatically on initialization").optional(), globalsStatic: V2.describe("Static global properties that persist across collector runs"), sessionStatic: n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSessionStatic", title: "Collector.SessionStatic", description: "Static session data that persists across collector runs." }).describe("Static session data that persists across collector runs"), logger: Ae3.optional().describe("Logger configuration (level, handler)") }).meta({ id: "CollectorConfig", title: "Collector.Config", description: "Core collector configuration (globals/session statics, logger)." }).describe("Core collector configuration");
|
|
1719
|
+
vt2 = V2.and(n3.object({ isStart: n3.boolean().describe("Whether this is a new session start"), storage: n3.boolean().describe("Whether storage is available"), id: c2.describe("Session identifier").optional(), start: l.describe("Session start timestamp").optional(), marketing: n3.literal(true).optional().describe("Marketing attribution flag"), updated: l.describe("Last update timestamp").optional(), isNew: n3.boolean().describe("Whether this is a new session").optional(), device: c2.describe("Device identifier").optional(), count: d.describe("Event count in session").optional(), runs: d.describe("Number of runs").optional() })).meta({ id: "CollectorSessionData", title: "Collector.SessionData", description: "Session state and tracking data." }).describe("Session state and tracking data");
|
|
1720
|
+
yt2 = St.partial().extend({ consent: Q2.optional().describe("Initial consent state"), user: _2.optional().describe("Initial user data"), globals: V2.optional().describe("Initial global properties"), sources: n3.unknown().meta({ id: "CollectorInitSources", title: "Source.InitSources", description: "Source configurations map (id \u2192 InitSource)." }).optional().describe("Source configurations"), destinations: n3.unknown().meta({ id: "CollectorInitDestinations", title: "Destination.InitDestinations", description: "Destination configurations map (id \u2192 Init)." }).optional().describe("Destination configurations"), transformers: n3.unknown().meta({ id: "CollectorInitTransformers", title: "Transformer.Configs", description: "Transformer configurations map (id \u2192 Config)." }).optional().describe("Transformer configurations"), stores: n3.unknown().meta({ id: "CollectorInitStores", title: "Store.Configs", description: "Store configurations map (id \u2192 Config)." }).optional().describe("Store configurations"), custom: V2.optional().describe("Initial custom implementation-specific properties"), hooks: n3.unknown().meta({ id: "CollectorHooks", title: "Collector.Hooks", description: "Pipeline observation hooks." }).optional().describe("Pipeline observation hooks") }).meta({ id: "CollectorInitConfig", title: "Collector.InitConfig", description: "Collector initialization configuration with initial state (consent, user, globals, components, hooks)." }).describe("Collector initialization configuration with initial state");
|
|
1721
|
+
wt2 = n3.object({ mapping: we2.optional().describe("Source-level mapping configuration") }).meta({ id: "CollectorPushContext", title: "Collector.PushContext", description: "Push context with optional source-level mapping." }).describe("Push context with optional source mapping");
|
|
1722
|
+
kt = n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSources", title: "Collector.Sources", description: "Map of source IDs to runtime source instances." }).describe("Map of source IDs to source instances");
|
|
1723
|
+
Ct = n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorDestinations", title: "Collector.Destinations", description: "Map of destination IDs to runtime destination instances." }).describe("Map of destination IDs to destination instances");
|
|
1724
|
+
xt = n3.object({ push: n3.unknown().describe("Push function for processing events"), command: n3.unknown().describe("Command function for walker commands"), allowed: n3.boolean().describe("Whether event processing is allowed"), config: St.describe("Current collector configuration"), consent: Q2.describe("Current consent state"), custom: V2.describe("Custom implementation-specific properties"), sources: kt.describe("Registered source instances"), destinations: Ct.describe("Registered destination instances"), globals: V2.describe("Current global properties"), hooks: n3.unknown().describe("Lifecycle hook functions"), on: n3.unknown().describe("Event lifecycle configuration"), queue: n3.array(ee2).describe("Queued events awaiting processing"), round: n3.number().describe("Collector run count (increments with each run)"), session: n3.union([vt2]).describe("Current session state"), timing: n3.number().describe("Event processing timing information"), user: _2.describe("Current user data") }).meta({ id: "CollectorInstance", title: "Collector.Instance", description: "Collector instance (runtime object with push/command + full state and component maps)." }).describe("Collector instance with state and methods");
|
|
1725
|
+
Pt = o(ht2);
|
|
1726
|
+
Dt = o(St);
|
|
1727
|
+
Et = o(vt2);
|
|
1728
|
+
jt2 = o(yt2);
|
|
1729
|
+
It = o(wt2);
|
|
1730
|
+
Jt = o(xt);
|
|
1731
|
+
Ot = {};
|
|
1732
|
+
t2(Ot, { BaseEnvSchema: () => Rt, ConfigSchema: () => Mt, InitSchema: () => Lt, InitSourceSchema: () => Nt, InitSourcesSchema: () => zt, InstanceSchema: () => Ft, PartialConfigSchema: () => Tt, baseEnvJsonSchema: () => Wt, configJsonSchema: () => qt, initSourceJsonSchema: () => Ut, initSourcesJsonSchema: () => At, instanceJsonSchema: () => Ht, partialConfigJsonSchema: () => Bt });
|
|
1733
|
+
Rt = n3.object({ push: n3.unknown().meta({ id: "SourcePushFn", title: "Source.PushFn", description: "Collector push function passed to the source via dependency injection." }).describe("Collector push function"), command: n3.unknown().meta({ id: "SourceCommandFn", title: "Source.CommandFn", description: "Collector command function passed to the source." }).describe("Collector command function"), sources: n3.unknown().optional().describe("Map of registered source instances"), elb: n3.unknown().meta({ id: "ElbFn", title: "Elb.Fn", description: "Public `elb(...)` API function alias for collector.push." }).describe("Public API function (alias for collector.push)") }).catchall(n3.unknown()).meta({ id: "SourceBaseEnv", title: "Source.BaseEnv", description: "Base environment for source dependency injection; platform-specific sources extend this." }).describe("Base environment for dependency injection - platform-specific sources extend this");
|
|
1734
|
+
Mt = we2.extend({ settings: n3.any().meta({ id: "SourceSettings", title: "Source.Settings", description: "Implementation-specific configuration (source-defined shape)." }).describe("Implementation-specific configuration").optional(), env: Rt.optional().describe("Environment dependencies (platform-specific)"), id: c2.describe("Source identifier (defaults to source key)").optional(), primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional(), require: n3.array(n3.string()).optional().describe('Defer source initialization until these collector events fire (e.g., ["consent"])'), logger: Ae3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)"), ingest: n3.union([ue3, me3]).optional().describe("Ingest metadata extraction mapping. Extracts values from raw request objects (Express req, Lambda event) using mapping syntax."), disabled: n3.boolean().describe("Completely skip this source (no init, no event capture)").optional() }).meta({ id: "SourceConfig", title: "Source.Config", description: "Source configuration with mapping, environment, and lifecycle hooks." }).describe("Source configuration with mapping and environment");
|
|
1735
|
+
Tt = Mt.partial().meta({ id: "SourcePartialConfig", title: "Source.PartialConfig", description: "Partial source configuration with all fields optional." }).describe("Partial source configuration with all fields optional");
|
|
1736
|
+
Ft = n3.object({ type: n3.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Mt.describe("Current source configuration"), push: n3.any().meta({ id: "SourceInstancePushFn", title: "Source.PushFn", description: "Push function \u2014 THE HANDLER (flexible signature for platform compatibility)." }).describe("Push function - THE HANDLER (flexible signature for platform compatibility)"), destroy: n3.any().meta({ id: "SourceDestroyFn", title: "Source.DestroyFn", description: "Cleanup function called when the source is removed." }).optional().describe("Cleanup function called when source is removed"), on: n3.unknown().optional().describe("Lifecycle hook function for event types") }).meta({ id: "SourceInstance", title: "Source.Instance", description: "Source instance (runtime object with push handler and lifecycle methods)." }).describe("Source instance with push handler and lifecycle methods");
|
|
1737
|
+
Lt = n3.any().meta({ id: "SourceInit", title: "Source.Init", description: "Source initialization function: (config, env) => Instance | Promise<Instance>." }).describe("Source initialization function: (config, env) => Instance | Promise<Instance>");
|
|
1738
|
+
Nt = n3.object({ code: Lt.describe("Source initialization function"), config: Tt.optional().describe("Partial configuration overrides"), env: Rt.partial().optional().describe("Partial environment overrides"), primary: n3.boolean().optional().describe("Mark as primary source (only one can be primary)") }).meta({ id: "SourceInitSource", title: "Source.InitSource", description: "Source initialization bundle (init function + config + env + primary flag)." }).describe("Source initialization configuration");
|
|
1739
|
+
zt = n3.record(n3.string(), Nt).meta({ id: "SourceInitSources", title: "Source.InitSources", description: "Map of source IDs to initialization configurations." }).describe("Map of source IDs to initialization configurations");
|
|
1740
|
+
Wt = o(Rt);
|
|
1741
|
+
qt = o(Mt);
|
|
1742
|
+
Bt = o(Tt);
|
|
1743
|
+
Ht = o(Ft);
|
|
1744
|
+
Ut = o(Nt);
|
|
1745
|
+
At = o(zt);
|
|
1746
|
+
$t = {};
|
|
1747
|
+
t2($t, { ConfigSchema: () => Vt, PartialConfigSchema: () => Gt, configJsonSchema: () => Kt, partialConfigJsonSchema: () => Qt });
|
|
1748
|
+
Vt = n3.object({ settings: n3.any().meta({ id: "TransformerSettings", title: "Transformer.Settings", description: "Implementation-specific configuration (transformer-defined shape)." }).describe("Implementation-specific configuration").optional(), env: n3.any().meta({ id: "TransformerEnv", title: "Transformer.Env", description: "Environment dependencies (transformer-defined shape)." }).describe("Environment dependencies (platform-specific)").optional(), id: c2.describe("Transformer instance identifier (defaults to transformer key)").optional(), logger: Ae3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), before: ze2.optional().describe("Pre-transformer chain that runs before this transformer pushes"), next: ze2.optional().describe("Graph wiring to the next transformer in the chain"), cache: He.optional().describe("Step-level cache configuration for this transformer"), init: n3.boolean().describe("Whether to initialize immediately").optional(), disabled: n3.boolean().describe("Completely skip this transformer in chains").optional(), mock: n3.unknown().meta({ id: "TransformerMock", title: "Transformer.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Global mock for all chains. Dev/testing only."), chainMocks: n3.record(n3.string(), n3.unknown().meta({ id: "TransformerChainMock", title: "Transformer.ChainMock", description: "Chain-path-specific mock value. Dev/testing only." })).optional().describe("Path-specific mock values keyed by chain path. Takes precedence over global mock. Dev/testing only.") }).meta({ id: "TransformerConfig", title: "Transformer.Config", description: "Transformer configuration (settings, env, chain wiring, cache, mocks)." }).describe("Transformer configuration");
|
|
1749
|
+
Gt = Vt.partial().meta({ id: "TransformerPartialConfig", title: "Transformer.PartialConfig", description: "Partial transformer configuration with all fields optional." }).describe("Partial transformer configuration with all fields optional");
|
|
1750
|
+
Kt = o(Vt);
|
|
1751
|
+
Qt = o(Gt);
|
|
1752
|
+
_t = {};
|
|
1753
|
+
t2(_t, { ConfigSchema: () => Xt, PartialConfigSchema: () => Yt, configJsonSchema: () => Zt, partialConfigJsonSchema: () => ei });
|
|
1754
|
+
Xt = n3.object({ settings: n3.unknown().meta({ id: "StoreSettings", title: "Store.Settings", description: "Implementation-specific configuration (store-defined shape)." }).describe("Implementation-specific configuration").optional(), env: n3.unknown().meta({ id: "StoreEnv", title: "Store.Env", description: "Environment dependencies (store-defined shape)." }).describe("Environment dependencies (platform-specific)").optional(), id: c2.describe("Store instance identifier (defaults to store key)").optional(), logger: Ae3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)") }).meta({ id: "StoreConfig", title: "Store.Config", description: "Store configuration (settings, env, logger) \u2014 key-value infrastructure component." }).describe("Store configuration");
|
|
1755
|
+
Yt = Xt.partial().meta({ id: "StorePartialConfig", title: "Store.PartialConfig", description: "Partial store configuration with all fields optional." }).describe("Partial store configuration with all fields optional");
|
|
1756
|
+
Zt = o(Xt);
|
|
1757
|
+
ei = o(Yt);
|
|
1758
|
+
ti = {};
|
|
1759
|
+
t2(ti, { BundlePackageSchema: () => ri, BundleSchema: () => ai, CodeSchema: () => si, ConfigSchema: () => yi, ContractActionsSchema: () => bi, ContractEventsSchema: () => hi, ContractRuleSchema: () => Si, ContractSchema: () => vi, ContractSchemaEntry: () => gi, DestinationSchema: () => mi, FlowSchema: () => wi, JsonSchema: () => ki, SettingsSchema: () => ni, SourceSchema: () => pi, StepExampleSchema: () => li, StepExamplesSchema: () => di, StoreSchema: () => fi, TransformerSchema: () => ui, TriggerDescriptorSchema: () => ci, VariablesSchema: () => ii, configJsonSchema: () => Ei, contractJsonSchema: () => Fi, contractRuleJsonSchema: () => Ti, destinationJsonSchema: () => Oi, flowConfigJsonSchema: () => Ii, flowJsonSchema: () => ji, parseConfig: () => Ci, parseFlow: () => Pi, safeParseConfig: () => xi, safeParseFlow: () => Di, sourceJsonSchema: () => Ji, storeJsonSchema: () => Mi, transformerJsonSchema: () => Ri });
|
|
1760
|
+
ii = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowVariables", title: "Flow.Variables", description: "Reusable values referenced via $var.name (with optional deep paths). Whole-string refs preserve native type; inline interpolation requires scalars." });
|
|
1761
|
+
ni = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowSettings", title: "Flow.Settings", description: "Free-form key-value settings consumed by the platform runtime." }).describe("Free-form platform settings bag");
|
|
1762
|
+
oi = /^(@[a-z0-9\-~][a-z0-9\-._~]*\/)?[a-z0-9\-~][a-z0-9\-._~]*$/;
|
|
1763
|
+
ri = n3.object({ version: n3.string().optional(), imports: n3.array(n3.string()).optional(), path: n3.string().optional() }).meta({ id: "FlowBundlePackage", title: "Flow.BundlePackage", description: "Per-package bundle spec (version / imports / local path)." });
|
|
1764
|
+
ai = n3.object({ packages: n3.record(n3.string().regex(oi, "Invalid npm package name"), ri).optional().describe("NPM packages to bundle, keyed by package name"), overrides: n3.record(n3.string().regex(oi, "Invalid npm package name"), n3.string().min(1, "Override version cannot be empty")).optional().describe("Transitive dependency version pins") }).strict().meta({ id: "FlowBundle", title: "Flow.Bundle", description: "Bundle configuration (packages + overrides)." }).describe("Bundle configuration (packages + overrides)");
|
|
1765
|
+
si = n3.object({ push: n3.string().min(1, "Push function cannot be empty").describe('JavaScript function for processing events. Must start with "$code:" prefix.'), type: n3.string().optional().describe("Optional type identifier for the inline instance"), init: n3.string().optional().describe("Optional initialization function. Use $code: prefix for inline JavaScript.") }).meta({ id: "FlowCode", title: "Flow.Code", description: "Inline code block for custom sources / transformers / destinations / stores." }).describe("Inline code for custom components");
|
|
1766
|
+
ci = n3.object({ type: n3.string().optional().describe("Trigger mechanism (e.g., click, POST, load)"), options: n3.unknown().optional().describe("Mechanism-specific options") }).meta({ id: "TriggerDescriptor", title: "Trigger.Descriptor", description: "Source trigger metadata (mechanism + options) used by step examples." });
|
|
1767
|
+
li = n3.object({ title: n3.string().optional().describe("Human-readable title (overrides default heading)"), description: n3.string().optional().describe("Human-readable description"), public: n3.boolean().optional().describe("Whether this example is shown in docs/UI/MCP default output (default: true). Set false for test-only fixtures."), in: n3.unknown().optional().describe("Input to the step"), trigger: ci.optional().describe("Source trigger metadata"), mapping: n3.unknown().optional().describe("Mapping configuration"), out: n3.unknown().optional().describe("Expected output from the step"), command: n3.enum(["config", "consent", "user", "run"]).optional().describe("Invoke elb('walker <command>', in) instead of pushing in as an event") }).meta({ id: "FlowStepExample", title: "Flow.StepExample", description: "Named example with input/output pair used for step testing." }).describe("Named example with input/output pair");
|
|
1768
|
+
di = n3.record(n3.string(), li).meta({ id: "FlowStepExamples", title: "Flow.StepExamples", description: "Named step examples keyed by scenario name." }).describe("Named step examples for testing and documentation");
|
|
1769
|
+
pi = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-source-browser@2.0.0")'), code: n3.union([n3.string(), si]).optional().describe('Either a named export string (e.g., "sourceExpress") or an inline code object with push function'), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowSourceConfig", title: "Source.Config", description: "Source-specific configuration object (Source.Config)." }).optional().describe("Source-specific configuration object"), env: n3.unknown().meta({ id: "FlowSourceEnv", title: "Source.BaseEnv", description: "Source environment configuration (Source.BaseEnv overrides)." }).optional().describe("Source environment configuration"), primary: n3.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."), variables: ii.optional().describe("Source-level variables (highest priority in cascade)"), next: ze2.optional().describe("Pre-collector transformer chain. String, string[], or NextRule[] for conditional routing based on ingest data."), before: ze2.optional().describe("Pre-source transformer chain (consent-exempt). Handles transport-level preprocessing."), examples: di.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: He.optional().describe("Cache configuration for this source (match \u2192 key \u2192 ttl rules)") }).meta({ id: "FlowSource", title: "Flow.Source", description: "Source package reference with configuration, env, chains, and examples." }).describe("Source package reference with configuration");
|
|
1770
|
+
ui = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'), code: n3.union([n3.string(), si]).optional().describe('Either a named export string (e.g., "transformerEnricher") or an inline code object with push function'), config: n3.unknown().meta({ id: "FlowTransformerConfig", title: "Transformer.Config", description: "Transformer-specific configuration object." }).optional().describe("Transformer-specific configuration object"), env: n3.unknown().meta({ id: "FlowTransformerEnv", title: "Transformer.Env", description: "Transformer environment configuration." }).optional().describe("Transformer environment configuration"), before: ze2.optional().describe("Pre-transformer chain. Runs before this transformer push function."), next: ze2.optional().describe("Next transformer in chain. String, string[], or NextRule[] for conditional routing."), variables: ii.optional().describe("Transformer-level variables (highest priority in cascade)"), examples: di.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: He.optional().describe("Cache configuration for this transformer (match \u2192 key \u2192 ttl rules)") }).meta({ id: "FlowTransformer", title: "Flow.Transformer", description: "Transformer package reference with configuration, env, chains, and cache." }).describe("Transformer package reference with configuration");
|
|
1771
|
+
mi = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-destination-gtag@2.0.0")'), code: n3.union([n3.string(), si]).optional().describe('Either a named export string (e.g., "destinationAnalytics") or an inline code object with push function'), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowDestinationConfig", title: "Destination.Config", description: "Destination-specific configuration object." }).optional().describe("Destination-specific configuration object"), env: n3.unknown().meta({ id: "FlowDestinationEnv", title: "Destination.Env", description: "Destination environment configuration." }).optional().describe("Destination environment configuration"), variables: ii.optional().describe("Destination-level variables (highest priority in cascade)"), before: ze2.optional().describe("Post-collector transformer chain. String, string[], or NextRule[] for conditional routing."), next: ze2.optional().describe("Post-push transformer chain. Push response available at context.ingest._response."), examples: di.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: He.optional().describe("Cache configuration for this destination (match \u2192 key \u2192 ttl rules)") }).meta({ id: "FlowDestination", title: "Flow.Destination", description: "Destination package reference with configuration, env, chains, and cache." }).describe("Destination package reference with configuration");
|
|
1772
|
+
fi = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe("Store package specifier with optional version"), code: n3.union([n3.string(), si]).optional().describe("Named export string or inline code definition"), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowStoreConfig", title: "Store.Config", description: "Store-specific configuration object." }).optional().describe("Store-specific configuration object"), env: n3.unknown().meta({ id: "FlowStoreEnv", title: "Store.Env", description: "Store environment configuration." }).optional().describe("Store environment configuration"), variables: ii.optional().describe("Store-level variables (highest priority in cascade)"), examples: di.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).meta({ id: "FlowStore", title: "Flow.Store", description: "Store package reference with configuration, env, and examples." }).describe("Store package reference with configuration");
|
|
1773
|
+
gi = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowContractSchemaEntry", title: "Flow.ContractSchemaEntry", description: "JSON Schema object for event validation with description/examples annotations." }).describe("JSON Schema object for event validation with description/examples annotations");
|
|
1774
|
+
bi = n3.record(n3.string(), gi).meta({ id: "FlowContractActions", title: "Flow.ContractActions", description: "Action-level contract entries keyed by action name." }).describe("Action-level contract entries");
|
|
1775
|
+
hi = n3.record(n3.string(), bi).meta({ id: "FlowContractEvents", title: "Flow.ContractEvents", description: "Entity-action event schemas (entity \u2192 action \u2192 schema)." }).describe("Entity-action event schemas");
|
|
1776
|
+
Si = n3.object({ extends: n3.string().optional().describe("Inherit from another named contract"), tagging: n3.number().optional().describe("Tagging level (used by validators / runtime tagging policy)"), description: n3.string().optional().describe("Human-readable description"), globals: gi.optional().describe("JSON Schema for event.globals"), context: gi.optional().describe("JSON Schema for event.context"), custom: gi.optional().describe("JSON Schema for event.custom"), user: gi.optional().describe("JSON Schema for event.user"), consent: gi.optional().describe("JSON Schema for event.consent"), events: hi.optional().describe("Entity-action event schemas") }).meta({ id: "FlowContractRule", title: "Flow.ContractRule", description: "Named contract rule with optional sections (globals/context/custom/user/consent) and event schemas." }).describe("Named contract rule with optional sections and events");
|
|
1777
|
+
vi = n3.record(n3.string(), Si).meta({ id: "FlowContract", title: "Flow.Contract", description: "Named contracts map with optional extends inheritance." }).describe("Named contracts with optional extends inheritance");
|
|
1778
|
+
yi = n3.object({ platform: n3.enum(["web", "server"]).describe("Platform identity for this flow. Drives bundle target/format."), url: n3.string().min(1).optional().describe("Public URL where this flow is reachable (for cross-flow $flow.X.url references)."), settings: ni.optional().describe("Free-form key-value settings consumed by the platform runtime."), bundle: ai.optional().describe("Bundle configuration: NPM packages, transitive dependency overrides.") }).meta({ id: "FlowConfig", title: "Flow.Config", description: "Per-flow configuration block: platform identity, optional public URL, settings, bundle." }).describe("Per-flow configuration block");
|
|
1779
|
+
wi = n3.object({ config: yi.optional().describe("Per-flow configuration: platform, url, settings, bundle."), sources: n3.record(n3.string(), pi).optional().describe("Source configurations (data capture) keyed by unique identifier"), destinations: n3.record(n3.string(), mi).optional().describe("Destination configurations (data output) keyed by unique identifier"), transformers: n3.record(n3.string(), ui).optional().describe("Transformer configurations (event transformation) keyed by unique identifier"), stores: n3.record(n3.string(), fi).optional().describe("Store configurations (key-value storage) keyed by unique identifier"), collector: n3.unknown().meta({ id: "FlowCollector", title: "Collector.InitConfig", description: "Collector configuration for event processing (Collector.InitConfig)." }).optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"), variables: ii.optional().describe("Flow-level variables (override root variables, overridden by source/destination variables)") }).meta({ id: "Flow", title: "Flow", description: "Single flow definition (one deployment target): config, sources, destinations, transformers, stores, collector." }).describe("Single flow definition for one deployment target");
|
|
1780
|
+
ki = n3.object({ version: n3.literal(4).describe("Configuration schema version (v4, current)."), $schema: n3.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v4.json")'), include: n3.array(n3.string()).optional().describe("Folders to include in the bundle output"), variables: ii.optional().describe("Shared variables for interpolation across all flows (use $var.name syntax, deep paths supported)"), contract: vi.optional().describe("Named contracts with extends inheritance and dot-path references"), flows: n3.record(n3.string(), wi).refine((e3) => Object.keys(e3).length > 0, { message: "At least one flow is required" }).describe("Named flow configurations (e.g., production, staging, development)") }).meta({ id: "FlowJson", title: "Flow.Json", description: "walkerOS root configuration (walkeros.config.json) v4: version, variables, contract, named flows." }).describe("walkerOS root configuration (walkeros.config.json)");
|
|
1781
|
+
Ei = n3.toJSONSchema(ki, { target: "draft-7" });
|
|
1782
|
+
ji = o(wi);
|
|
1783
|
+
Ii = o(yi);
|
|
1784
|
+
Ji = o(pi);
|
|
1785
|
+
Oi = o(mi);
|
|
1786
|
+
Ri = o(ui);
|
|
1787
|
+
Mi = o(fi);
|
|
1788
|
+
Ti = o(Si);
|
|
1789
|
+
Fi = o(vi);
|
|
1790
|
+
Ni = Li.object({ lang: Li.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: Li.string().describe("Code snippet") });
|
|
1791
|
+
zi = Li.object({ text: Li.string().describe("Short actionable hint text focused on walkerOS usage"), code: Li.array(Ni).optional().describe("Optional code snippets") });
|
|
1792
|
+
Wi = Li.record(Li.string(), zi).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
|
|
1793
|
+
qi = n3.object({ param: n3.string().describe("Lowercase URL parameter name. Match is case-insensitive on lookup."), platform: n3.string().describe("Canonical platform identifier (lowercase, kebab-case).") });
|
|
1794
|
+
en = { source: Ot.configJsonSchema, destination: Re3.configJsonSchema };
|
|
1791
1795
|
}
|
|
1792
1796
|
});
|
|
1793
1797
|
|
|
@@ -1880,7 +1884,7 @@ var init_event_validation = __esm({
|
|
|
1880
1884
|
"src/core/event-validation.ts"() {
|
|
1881
1885
|
"use strict";
|
|
1882
1886
|
init_dev();
|
|
1883
|
-
({ PartialEventSchema } =
|
|
1887
|
+
({ PartialEventSchema } = i);
|
|
1884
1888
|
}
|
|
1885
1889
|
});
|
|
1886
1890
|
|
|
@@ -1891,6 +1895,49 @@ var init_package_path = __esm({
|
|
|
1891
1895
|
}
|
|
1892
1896
|
});
|
|
1893
1897
|
|
|
1898
|
+
// src/core/import-specifier.ts
|
|
1899
|
+
var toFileImportSpecifier;
|
|
1900
|
+
var init_import_specifier = __esm({
|
|
1901
|
+
"src/core/import-specifier.ts"() {
|
|
1902
|
+
"use strict";
|
|
1903
|
+
toFileImportSpecifier = (absPath) => absPath.replace(/\\/g, "/");
|
|
1904
|
+
}
|
|
1905
|
+
});
|
|
1906
|
+
|
|
1907
|
+
// src/core/parse-component-ref.ts
|
|
1908
|
+
function isAllowedPrefix(value, allowed) {
|
|
1909
|
+
return allowed.includes(value);
|
|
1910
|
+
}
|
|
1911
|
+
function parseComponentRef(input, options) {
|
|
1912
|
+
const { allowed, messages = {} } = options;
|
|
1913
|
+
const allowedList = allowed.join(" | ");
|
|
1914
|
+
const parts = input.split(".");
|
|
1915
|
+
if (parts.length < 2) {
|
|
1916
|
+
const msg = messages.invalidFormat ? messages.invalidFormat(input) : `Invalid target "${input}". Expected <kind>.<name> where kind is ${allowedList}.`;
|
|
1917
|
+
throw new Error(msg);
|
|
1918
|
+
}
|
|
1919
|
+
const prefix = parts[0];
|
|
1920
|
+
const name = parts[1];
|
|
1921
|
+
if (!name) {
|
|
1922
|
+
const msg = messages.missingName ? messages.missingName(input, prefix) : `Invalid target "${input}". Missing name after "${prefix}."`;
|
|
1923
|
+
throw new Error(msg);
|
|
1924
|
+
}
|
|
1925
|
+
if (!isAllowedPrefix(prefix, allowed)) {
|
|
1926
|
+
const msg = messages.invalidPrefix ? messages.invalidPrefix(prefix) : `Invalid kind "${prefix}". Expected ${allowedList}.`;
|
|
1927
|
+
throw new Error(msg);
|
|
1928
|
+
}
|
|
1929
|
+
return {
|
|
1930
|
+
prefix,
|
|
1931
|
+
name,
|
|
1932
|
+
rest: parts.slice(2)
|
|
1933
|
+
};
|
|
1934
|
+
}
|
|
1935
|
+
var init_parse_component_ref = __esm({
|
|
1936
|
+
"src/core/parse-component-ref.ts"() {
|
|
1937
|
+
"use strict";
|
|
1938
|
+
}
|
|
1939
|
+
});
|
|
1940
|
+
|
|
1894
1941
|
// src/core/index.ts
|
|
1895
1942
|
var init_core = __esm({
|
|
1896
1943
|
"src/core/index.ts"() {
|
|
@@ -1909,6 +1956,8 @@ var init_core = __esm({
|
|
|
1909
1956
|
init_sse();
|
|
1910
1957
|
init_event_validation();
|
|
1911
1958
|
init_package_path();
|
|
1959
|
+
init_import_specifier();
|
|
1960
|
+
init_parse_component_ref();
|
|
1912
1961
|
}
|
|
1913
1962
|
});
|
|
1914
1963
|
|
|
@@ -1939,7 +1988,7 @@ var init_validators = __esm({
|
|
|
1939
1988
|
"use strict";
|
|
1940
1989
|
init_dist();
|
|
1941
1990
|
init_dev();
|
|
1942
|
-
({ safeParseConfig } =
|
|
1991
|
+
({ safeParseConfig } = i);
|
|
1943
1992
|
}
|
|
1944
1993
|
});
|
|
1945
1994
|
|
|
@@ -1986,15 +2035,15 @@ function loadBundleConfig(rawConfig, options) {
|
|
|
1986
2035
|
const config = validateFlowConfig(rawConfig);
|
|
1987
2036
|
const availableFlows = getAvailableFlows(config);
|
|
1988
2037
|
const flowName = resolveFlow(config, options.flowName, availableFlows);
|
|
1989
|
-
let flowSettings =
|
|
1990
|
-
const platform =
|
|
2038
|
+
let flowSettings = K(config, flowName, { deferred: true });
|
|
2039
|
+
const platform = q(flowSettings);
|
|
1991
2040
|
if (!platform) {
|
|
1992
2041
|
throw new Error(
|
|
1993
2042
|
`Invalid configuration: flow "${flowName}" must have config.platform set to "web" or "server".`
|
|
1994
2043
|
);
|
|
1995
2044
|
}
|
|
1996
2045
|
if (platform === "web") {
|
|
1997
|
-
flowSettings =
|
|
2046
|
+
flowSettings = K(config, flowName);
|
|
1998
2047
|
}
|
|
1999
2048
|
const buildDefaults = getBuildDefaults(platform);
|
|
2000
2049
|
const packages = flowSettings.config?.bundle?.packages || {};
|
|
@@ -2324,7 +2373,7 @@ function resolveVersionConflicts(allSpecs, logger) {
|
|
|
2324
2373
|
const topLevel = /* @__PURE__ */ new Map();
|
|
2325
2374
|
const nested = [];
|
|
2326
2375
|
for (const [name, specs] of allSpecs) {
|
|
2327
|
-
const localSpec = specs.find((
|
|
2376
|
+
const localSpec = specs.find((s5) => s5.localPath);
|
|
2328
2377
|
if (localSpec) {
|
|
2329
2378
|
topLevel.set(name, {
|
|
2330
2379
|
name,
|
|
@@ -2333,13 +2382,13 @@ function resolveVersionConflicts(allSpecs, logger) {
|
|
|
2333
2382
|
});
|
|
2334
2383
|
continue;
|
|
2335
2384
|
}
|
|
2336
|
-
const nonPeerSpecs = specs.filter((
|
|
2337
|
-
const peerSpecs = specs.filter((
|
|
2385
|
+
const nonPeerSpecs = specs.filter((s5) => s5.source !== "peerDependency");
|
|
2386
|
+
const peerSpecs = specs.filter((s5) => s5.source === "peerDependency");
|
|
2338
2387
|
let activeSpecs;
|
|
2339
2388
|
if (nonPeerSpecs.length > 0) {
|
|
2340
2389
|
activeSpecs = nonPeerSpecs;
|
|
2341
2390
|
} else {
|
|
2342
|
-
const requiredPeers = peerSpecs.filter((
|
|
2391
|
+
const requiredPeers = peerSpecs.filter((s5) => !s5.optional);
|
|
2343
2392
|
if (requiredPeers.length === 0) {
|
|
2344
2393
|
logger.debug(`Skipping optional peer dependency: ${name}`);
|
|
2345
2394
|
continue;
|
|
@@ -2347,10 +2396,10 @@ function resolveVersionConflicts(allSpecs, logger) {
|
|
|
2347
2396
|
activeSpecs = requiredPeers;
|
|
2348
2397
|
}
|
|
2349
2398
|
activeSpecs.sort(
|
|
2350
|
-
(
|
|
2399
|
+
(a3, b2) => SOURCE_PRIORITY[a3.source] - SOURCE_PRIORITY[b2.source]
|
|
2351
2400
|
);
|
|
2352
|
-
const directSpecs = activeSpecs.filter((
|
|
2353
|
-
const directExact = directSpecs.find((
|
|
2401
|
+
const directSpecs = activeSpecs.filter((s5) => s5.source === "direct");
|
|
2402
|
+
const directExact = directSpecs.find((s5) => semver2.valid(s5.spec) !== null);
|
|
2354
2403
|
let chosenVersion;
|
|
2355
2404
|
const alreadyNested = /* @__PURE__ */ new Set();
|
|
2356
2405
|
if (directExact) {
|
|
@@ -2358,14 +2407,14 @@ function resolveVersionConflicts(allSpecs, logger) {
|
|
|
2358
2407
|
} else if (directSpecs.length > 0) {
|
|
2359
2408
|
chosenVersion = directSpecs[0].spec;
|
|
2360
2409
|
} else {
|
|
2361
|
-
const exactVersions = activeSpecs.filter((
|
|
2410
|
+
const exactVersions = activeSpecs.filter((s5) => semver2.valid(s5.spec) !== null).map((s5) => s5.spec);
|
|
2362
2411
|
const uniqueExact = [...new Set(exactVersions)];
|
|
2363
2412
|
if (uniqueExact.length > 1) {
|
|
2364
2413
|
const sorted = [...uniqueExact].sort(semver2.rcompare);
|
|
2365
2414
|
chosenVersion = sorted[0];
|
|
2366
2415
|
for (let i2 = 1; i2 < sorted.length; i2++) {
|
|
2367
2416
|
const loserVersion = sorted[i2];
|
|
2368
|
-
const consumers = activeSpecs.filter((
|
|
2417
|
+
const consumers = activeSpecs.filter((s5) => s5.spec === loserVersion).map((s5) => s5.from);
|
|
2369
2418
|
nested.push({ name, version: loserVersion, consumers });
|
|
2370
2419
|
alreadyNested.add(loserVersion);
|
|
2371
2420
|
}
|
|
@@ -2801,7 +2850,7 @@ async function bundleCore(flowSettings, buildOptions, logger, showStats = false)
|
|
|
2801
2850
|
for (const pkg of stepPackages) {
|
|
2802
2851
|
const isLocalPath = pkg.startsWith(".") || pkg.startsWith("/");
|
|
2803
2852
|
if (isLocalPath) {
|
|
2804
|
-
const varName =
|
|
2853
|
+
const varName = V(pkg);
|
|
2805
2854
|
if (!buildOptions.packages[varName]) {
|
|
2806
2855
|
buildOptions.packages[varName] = {
|
|
2807
2856
|
path: pkg,
|
|
@@ -3189,7 +3238,7 @@ async function generateImportStatements(packages, destinationPackages, sourcePac
|
|
|
3189
3238
|
const hasExplicitCode = explicitCodeImports.has(packageName);
|
|
3190
3239
|
const namedImportsToGenerate = [];
|
|
3191
3240
|
if (isUsedByDestOrSource && !hasExplicitCode) {
|
|
3192
|
-
const varName =
|
|
3241
|
+
const varName = V(packageName);
|
|
3193
3242
|
importStatements.push(`import ${varName} from '${packageName}';`);
|
|
3194
3243
|
}
|
|
3195
3244
|
if (hasExplicitCode) {
|
|
@@ -3231,7 +3280,7 @@ async function generateImportStatements(packages, destinationPackages, sourcePac
|
|
|
3231
3280
|
const pkgJson = await fs9.readJSON(pkgJsonPath);
|
|
3232
3281
|
const exports = pkgJson.exports;
|
|
3233
3282
|
if (exports && typeof exports === "object" && "./dev" in exports) {
|
|
3234
|
-
const varName = `__dev_${
|
|
3283
|
+
const varName = `__dev_${V(packageName)}`;
|
|
3235
3284
|
importStatements.push(
|
|
3236
3285
|
`import * as ${varName} from '${packageName}/dev';`
|
|
3237
3286
|
);
|
|
@@ -3312,7 +3361,7 @@ async function createEntryPoint(flowSettings, buildOptions, packagePaths) {
|
|
|
3312
3361
|
);
|
|
3313
3362
|
const importsCode = importStatements.join("\n");
|
|
3314
3363
|
const hasFlow = Object.values(flowSettings.sources || {}).some(
|
|
3315
|
-
(
|
|
3364
|
+
(s5) => s5.package || hasCodeReference(s5.code)
|
|
3316
3365
|
) || Object.values(flowSettings.destinations || {}).some(
|
|
3317
3366
|
(d2) => d2.package || hasCodeReference(d2.code)
|
|
3318
3367
|
);
|
|
@@ -3378,7 +3427,7 @@ function buildSplitConfigObject(flowSettings, explicitCodeImports) {
|
|
|
3378
3427
|
if (step.code && typeof step.code === "string" && step.package && explicitCodeImports.has(step.package)) {
|
|
3379
3428
|
return step.code;
|
|
3380
3429
|
}
|
|
3381
|
-
return
|
|
3430
|
+
return V(step.package);
|
|
3382
3431
|
}
|
|
3383
3432
|
function getStepProps(step) {
|
|
3384
3433
|
const props = {};
|
|
@@ -3514,7 +3563,8 @@ ${userCode}
|
|
|
3514
3563
|
export { startFlow };`;
|
|
3515
3564
|
}
|
|
3516
3565
|
function generateServerEntry(stage1Path, dataPayload) {
|
|
3517
|
-
|
|
3566
|
+
const stage1Specifier = toFileImportSpecifier(stage1Path);
|
|
3567
|
+
return `import { startFlow, wireConfig } from '${stage1Specifier}';
|
|
3518
3568
|
|
|
3519
3569
|
const __configData = ${dataPayload};
|
|
3520
3570
|
|
|
@@ -3563,7 +3613,8 @@ function generateWebEntry(stage1Path, dataPayload, options = {}) {
|
|
|
3563
3613
|
env.document = env.document ?? (typeof document !== 'undefined' ? document : undefined);
|
|
3564
3614
|
}
|
|
3565
3615
|
}` : "";
|
|
3566
|
-
|
|
3616
|
+
const stage1Specifier = toFileImportSpecifier(stage1Path);
|
|
3617
|
+
return `import { startFlow, wireConfig } from '${stage1Specifier}';
|
|
3567
3618
|
|
|
3568
3619
|
const __configData = ${dataPayload};
|
|
3569
3620
|
|
|
@@ -3586,7 +3637,7 @@ function serializeWithCode(value, indent) {
|
|
|
3586
3637
|
if (value.startsWith("$code:")) {
|
|
3587
3638
|
return value.slice(6);
|
|
3588
3639
|
}
|
|
3589
|
-
const esc =
|
|
3640
|
+
const esc = F.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3590
3641
|
const markerRe = new RegExp(
|
|
3591
3642
|
esc + "([a-zA-Z_][a-zA-Z0-9_]*)(?::((?:(?!" + esc + `)[^\\s"'])*))?`,
|
|
3592
3643
|
"g"
|
|
@@ -3631,7 +3682,7 @@ ${spaces}]`;
|
|
|
3631
3682
|
const entries = Object.entries(value);
|
|
3632
3683
|
if (entries.length === 0) return "{}";
|
|
3633
3684
|
const props = entries.map(
|
|
3634
|
-
([
|
|
3685
|
+
([k2, v2]) => `${nextSpaces}${JSON.stringify(k2)}: ${serializeWithCode(v2, indent + 1)}`
|
|
3635
3686
|
);
|
|
3636
3687
|
return `{
|
|
3637
3688
|
${props.join(",\n")}
|
|
@@ -3647,6 +3698,7 @@ var init_bundler = __esm({
|
|
|
3647
3698
|
init_config_classifier();
|
|
3648
3699
|
init_package_manager();
|
|
3649
3700
|
init_tmp();
|
|
3701
|
+
init_import_specifier();
|
|
3650
3702
|
init_build_cache();
|
|
3651
3703
|
VALID_JS_IDENTIFIER = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
|
|
3652
3704
|
}
|
|
@@ -3907,7 +3959,7 @@ async function bundleCommand(options) {
|
|
|
3907
3959
|
}
|
|
3908
3960
|
}
|
|
3909
3961
|
if (options.dockerfile && options.output) {
|
|
3910
|
-
const platform =
|
|
3962
|
+
const platform = q(flowSettings);
|
|
3911
3963
|
if (platform) {
|
|
3912
3964
|
const outputDir = path12.dirname(buildOptions.output);
|
|
3913
3965
|
const customFile = typeof options.dockerfile === "string" ? options.dockerfile : void 0;
|
|
@@ -4449,7 +4501,7 @@ async function createPreview(options) {
|
|
|
4449
4501
|
}
|
|
4450
4502
|
const flow = await getFlow({ projectId: pid, flowId: options.flowId });
|
|
4451
4503
|
const settings = flow.settings;
|
|
4452
|
-
const match = settings?.find((
|
|
4504
|
+
const match = settings?.find((s5) => s5.name === options.flowName);
|
|
4453
4505
|
if (!match) {
|
|
4454
4506
|
throw new Error(
|
|
4455
4507
|
`Flow settings named "${options.flowName}" not found on flow ${options.flowId}`
|
|
@@ -4592,11 +4644,11 @@ init_dist();
|
|
|
4592
4644
|
init_dist();
|
|
4593
4645
|
var n = { Action: "action", Actions: "actions", Config: "config", Consent: "consent", Context: "context", Custom: "custom", Destination: "destination", Elb: "elb", Globals: "globals", Hook: "hook", Init: "init", Link: "link", On: "on", Prefix: "data-elb", Ready: "ready", Run: "run", Session: "session", Shutdown: "shutdown", User: "user", Walker: "walker" };
|
|
4594
4646
|
var t = { Commands: n, Utils: { Storage: { Cookie: "cookie", Local: "local", Session: "session" } } };
|
|
4595
|
-
function
|
|
4647
|
+
function s2(e3, n4) {
|
|
4596
4648
|
const t3 = {};
|
|
4597
4649
|
return Object.entries(n4).forEach(([e4, n5]) => {
|
|
4598
4650
|
t3[e4] = !!n5;
|
|
4599
|
-
}), e3.consent =
|
|
4651
|
+
}), e3.consent = X(e3.consent, t3), { update: t3 };
|
|
4600
4652
|
}
|
|
4601
4653
|
function X2(e3, n4) {
|
|
4602
4654
|
return e3.storeId && n4.stores[e3.storeId] ? n4.stores[e3.storeId] : n4.stores.__cache;
|
|
@@ -4609,44 +4661,44 @@ function Y2(e3) {
|
|
|
4609
4661
|
}
|
|
4610
4662
|
return n4;
|
|
4611
4663
|
}
|
|
4612
|
-
function
|
|
4664
|
+
function Z(e3, n4) {
|
|
4613
4665
|
const t3 = e3.config || {}, o2 = e3[n4];
|
|
4614
4666
|
return void 0 !== o2 ? { config: { ...t3, [n4]: o2 }, chainValue: o2 } : { config: t3, chainValue: void 0 };
|
|
4615
4667
|
}
|
|
4616
|
-
function
|
|
4668
|
+
function ee(e3, n4 = {}) {
|
|
4617
4669
|
if (!e3) return [];
|
|
4618
4670
|
if (Array.isArray(e3)) return e3;
|
|
4619
4671
|
const t3 = [], o2 = /* @__PURE__ */ new Set();
|
|
4620
|
-
let
|
|
4621
|
-
for (;
|
|
4622
|
-
o2.add(
|
|
4623
|
-
const e4 = n4[
|
|
4672
|
+
let s5 = e3;
|
|
4673
|
+
for (; s5 && n4[s5] && !o2.has(s5); ) {
|
|
4674
|
+
o2.add(s5), t3.push(s5);
|
|
4675
|
+
const e4 = n4[s5].next;
|
|
4624
4676
|
if (Array.isArray(e4)) {
|
|
4625
4677
|
t3.push(...e4);
|
|
4626
4678
|
break;
|
|
4627
4679
|
}
|
|
4628
|
-
|
|
4680
|
+
s5 = e4;
|
|
4629
4681
|
}
|
|
4630
4682
|
return t3;
|
|
4631
4683
|
}
|
|
4632
|
-
async function
|
|
4684
|
+
async function ne(e3, n4, t3) {
|
|
4633
4685
|
if (n4.init && !n4.config.init) {
|
|
4634
|
-
const o2 = n4.type || "unknown",
|
|
4635
|
-
|
|
4636
|
-
const
|
|
4637
|
-
if (false ===
|
|
4638
|
-
n4.config = { ...
|
|
4686
|
+
const o2 = n4.type || "unknown", s5 = e3.logger.scope(`transformer:${o2}`), r3 = { collector: e3, logger: s5, id: t3, ingest: $(t3), config: n4.config, env: se2(n4.config.env) };
|
|
4687
|
+
s5.debug("init");
|
|
4688
|
+
const a3 = await Je(n4.init, "TransformerInit", e3.hooks, e3.logger)(r3);
|
|
4689
|
+
if (false === a3) return false;
|
|
4690
|
+
n4.config = { ...a3 || n4.config, env: a3?.env || n4.config.env, init: true }, s5.debug("init done");
|
|
4639
4691
|
}
|
|
4640
4692
|
return true;
|
|
4641
4693
|
}
|
|
4642
|
-
async function
|
|
4643
|
-
const
|
|
4694
|
+
async function te2(e3, n4, t3, o2, s5, r3) {
|
|
4695
|
+
const a3 = n4.type || "unknown", i2 = e3.logger.scope(`transformer:${a3}`), c3 = { collector: e3, logger: i2, id: t3, ingest: s5, config: n4.config, env: { ...se2(n4.config.env), ...r3 ? { respond: r3 } : {} } };
|
|
4644
4696
|
i2.debug("push", { event: o2.name });
|
|
4645
4697
|
const u3 = await Je(n4.push, "TransformerPush", e3.hooks, e3.logger)(o2, c3);
|
|
4646
4698
|
return i2.debug("push done"), u3;
|
|
4647
4699
|
}
|
|
4648
|
-
async function
|
|
4649
|
-
|
|
4700
|
+
async function oe2(e3, n4, t3, o2, s5, r3, a3) {
|
|
4701
|
+
a3 && s5?._meta && (s5._meta.chainPath = a3);
|
|
4650
4702
|
let i2 = o2, c3 = r3;
|
|
4651
4703
|
for (const o3 of t3) {
|
|
4652
4704
|
const r4 = n4[o3];
|
|
@@ -4654,12 +4706,12 @@ async function oe(e3, n4, t3, o2, s4, r3, a4) {
|
|
|
4654
4706
|
e3.logger.warn(`Transformer not found: ${o3}`);
|
|
4655
4707
|
continue;
|
|
4656
4708
|
}
|
|
4657
|
-
if (
|
|
4658
|
-
|
|
4659
|
-
if (!await
|
|
4660
|
-
if (
|
|
4661
|
-
const n5 = r4.config.chainMocks[
|
|
4662
|
-
e3.logger.scope(`transformer:${r4.type || "unknown"}`).debug("chainMock", { chain:
|
|
4709
|
+
if (s5 && s5._meta && s5._meta.path.length > 256) return e3.logger.error(`Max path length exceeded at ${o3}`), { event: null, respond: c3 };
|
|
4710
|
+
s5 && s5._meta && (s5._meta.hops++, s5._meta.path.push(o3));
|
|
4711
|
+
if (!await Me(ne)(e3, r4, o3)) return e3.logger.error(`Transformer init failed: ${o3}`), { event: null, respond: c3 };
|
|
4712
|
+
if (a3 && void 0 !== r4.config?.chainMocks?.[a3]) {
|
|
4713
|
+
const n5 = r4.config.chainMocks[a3];
|
|
4714
|
+
e3.logger.scope(`transformer:${r4.type || "unknown"}`).debug("chainMock", { chain: a3 }), i2 = n5;
|
|
4663
4715
|
continue;
|
|
4664
4716
|
}
|
|
4665
4717
|
if (void 0 !== r4.config?.mock) {
|
|
@@ -4667,10 +4719,10 @@ async function oe(e3, n4, t3, o2, s4, r3, a4) {
|
|
|
4667
4719
|
continue;
|
|
4668
4720
|
}
|
|
4669
4721
|
if (r4.config?.disabled) continue;
|
|
4670
|
-
const u3 = r4.config?.cache, f2 = u3 ?
|
|
4722
|
+
const u3 = r4.config?.cache, f2 = u3 ? vt(u3) : void 0, l2 = f2 ? X2(f2, e3) : void 0;
|
|
4671
4723
|
let d2;
|
|
4672
4724
|
if (f2 && l2) {
|
|
4673
|
-
const e4 = bt(
|
|
4725
|
+
const e4 = bt(s5, i2), n5 = ht(f2, l2, e4, `t:${o3}`);
|
|
4674
4726
|
if ("HIT" === n5?.status && n5.value) {
|
|
4675
4727
|
if (i2 = n5.value, f2.full) return { event: i2, respond: c3 };
|
|
4676
4728
|
continue;
|
|
@@ -4679,31 +4731,31 @@ async function oe(e3, n4, t3, o2, s4, r3, a4) {
|
|
|
4679
4731
|
}
|
|
4680
4732
|
const g2 = r4.config.before;
|
|
4681
4733
|
if (g2) {
|
|
4682
|
-
const t4 =
|
|
4734
|
+
const t4 = ee("string" == typeof g2 || Array.isArray(g2) && !mt(g2) ? g2 : yt(gt(g2), bt(s5, i2)) || void 0, Y2(n4));
|
|
4683
4735
|
if (t4.length > 0) {
|
|
4684
|
-
const o4 = await
|
|
4736
|
+
const o4 = await oe2(e3, n4, t4, i2, s5, c3, a3);
|
|
4685
4737
|
if (null === o4.event) return { event: null, respond: o4.respond ?? c3 };
|
|
4686
4738
|
o4.respond && (c3 = o4.respond), i2 = Array.isArray(o4.event) ? o4.event[0] : o4.event;
|
|
4687
4739
|
}
|
|
4688
4740
|
}
|
|
4689
|
-
const m2 = await
|
|
4741
|
+
const m2 = await Me(te2, (n5) => (e3.logger.scope(`transformer:${r4.type || "unknown"}`).error("Push failed", { error: n5 }), false))(e3, r4, o3, i2, s5, c3);
|
|
4690
4742
|
if (false === m2) return { event: null, respond: c3 };
|
|
4691
4743
|
if (Array.isArray(m2)) {
|
|
4692
4744
|
const r5 = t3.slice(t3.indexOf(o3) + 1), u4 = await Promise.all(m2.map(async (t4) => {
|
|
4693
|
-
const o4 = t4.event || i2, u5 =
|
|
4745
|
+
const o4 = t4.event || i2, u5 = s5 ? { ...s5, _meta: { ...s5._meta, path: [...s5._meta.path] } } : $("unknown");
|
|
4694
4746
|
if (t4.next) {
|
|
4695
|
-
let
|
|
4747
|
+
let s6 = t4.next;
|
|
4696
4748
|
if (mt(t4.next)) {
|
|
4697
4749
|
const e4 = gt(t4.next);
|
|
4698
|
-
|
|
4750
|
+
s6 = yt(e4, bt(u5, o4));
|
|
4699
4751
|
}
|
|
4700
|
-
if (
|
|
4701
|
-
const t5 =
|
|
4702
|
-
if (t5.length > 0) return
|
|
4752
|
+
if (s6) {
|
|
4753
|
+
const t5 = ee(s6, Y2(n4));
|
|
4754
|
+
if (t5.length > 0) return oe2(e3, n4, t5, o4, u5, c3, a3);
|
|
4703
4755
|
}
|
|
4704
4756
|
return { event: o4, respond: c3 };
|
|
4705
4757
|
}
|
|
4706
|
-
return r5.length > 0 ?
|
|
4758
|
+
return r5.length > 0 ? oe2(e3, n4, r5, o4, u5, c3, a3) : { event: o4, respond: c3 };
|
|
4707
4759
|
}));
|
|
4708
4760
|
let f3 = c3;
|
|
4709
4761
|
const l3 = [];
|
|
@@ -4720,21 +4772,21 @@ async function oe(e3, n4, t3, o2, s4, r3, a4) {
|
|
|
4720
4772
|
let o5 = r5;
|
|
4721
4773
|
if (mt(r5)) {
|
|
4722
4774
|
const e4 = gt(r5);
|
|
4723
|
-
if (o5 = yt(e4, bt(
|
|
4775
|
+
if (o5 = yt(e4, bt(s5, i2)), !o5) {
|
|
4724
4776
|
t4 && (i2 = t4);
|
|
4725
4777
|
continue;
|
|
4726
4778
|
}
|
|
4727
4779
|
}
|
|
4728
|
-
const u4 =
|
|
4729
|
-
return u4.length > 0 ?
|
|
4780
|
+
const u4 = ee(o5, Y2(n4));
|
|
4781
|
+
return u4.length > 0 ? oe2(e3, n4, u4, t4 || i2, s5, c3, a3) : (e3.logger.warn(`Branch target not found: ${JSON.stringify(r5)}`), { event: null, respond: c3 });
|
|
4730
4782
|
}
|
|
4731
4783
|
t4 && (i2 = t4);
|
|
4732
4784
|
}
|
|
4733
4785
|
if (d2 && l2 && wt(l2, d2.key, i2, d2.ttl), (!m2 || "object" == typeof m2 && !m2.next) && r4.config.next && mt(r4.config.next)) {
|
|
4734
|
-
const t4 = r4.config.next, o4 = gt(t4), u4 = yt(o4, bt(
|
|
4786
|
+
const t4 = r4.config.next, o4 = gt(t4), u4 = yt(o4, bt(s5, i2));
|
|
4735
4787
|
if (u4) {
|
|
4736
|
-
const t5 =
|
|
4737
|
-
if (t5.length > 0) return
|
|
4788
|
+
const t5 = ee(u4, Y2(n4));
|
|
4789
|
+
if (t5.length > 0) return oe2(e3, n4, t5, i2, s5, c3, a3);
|
|
4738
4790
|
}
|
|
4739
4791
|
return { event: i2, respond: c3 };
|
|
4740
4792
|
}
|
|
@@ -4742,63 +4794,63 @@ async function oe(e3, n4, t3, o2, s4, r3, a4) {
|
|
|
4742
4794
|
return { event: i2, respond: c3 };
|
|
4743
4795
|
}
|
|
4744
4796
|
function se2(e3) {
|
|
4745
|
-
return e3 &&
|
|
4797
|
+
return e3 && ie(e3) ? e3 : {};
|
|
4746
4798
|
}
|
|
4747
4799
|
async function re2(e3, n4, t3) {
|
|
4748
|
-
const { code: o2, config:
|
|
4749
|
-
let f2, l2 =
|
|
4750
|
-
const d2 = u3 ?
|
|
4751
|
-
let r4,
|
|
4752
|
-
const i3 = h2 ?? (p2 ?
|
|
4800
|
+
const { code: o2, config: s5 = {}, env: r3 = {}, primary: a3, next: i2, before: c3, cache: u3 } = t3;
|
|
4801
|
+
let f2, l2 = $(n4);
|
|
4802
|
+
const d2 = u3 ? vt({ ...u3, full: u3.full ?? true }) : void 0, g2 = gt(i2), m2 = !(Array.isArray(i2) && mt(i2)) && g2 ? ee(yt(g2), Y2(e3.transformers)) : void 0, p2 = gt(c3), h2 = !(Array.isArray(c3) && mt(c3)) && p2 ? ee(yt(p2), Y2(e3.transformers)) : void 0, y2 = e3.logger.scope("source").scope(n4), b2 = { push: async (t4, o3 = {}) => {
|
|
4803
|
+
let r4, a4 = t4;
|
|
4804
|
+
const i3 = h2 ?? (p2 ? ee(yt(p2, bt(l2)), Y2(e3.transformers)) : []);
|
|
4753
4805
|
if (i3.length > 0 && e3.transformers && Object.keys(e3.transformers).length > 0) {
|
|
4754
|
-
const t5 = await
|
|
4806
|
+
const t5 = await oe2(e3, e3.transformers, i3, a4, l2, f2, `source.${n4}.before`);
|
|
4755
4807
|
if (null === t5.event) return { ok: true };
|
|
4756
|
-
t5.respond && (f2 = t5.respond),
|
|
4808
|
+
t5.respond && (f2 = t5.respond), a4 = Array.isArray(t5.event) ? t5.event[0] : t5.event;
|
|
4757
4809
|
}
|
|
4758
4810
|
if (d2) {
|
|
4759
4811
|
const t5 = X2(d2, e3);
|
|
4760
4812
|
if (t5) {
|
|
4761
|
-
const o4 = bt(l2),
|
|
4762
|
-
if (
|
|
4763
|
-
if ("HIT" ===
|
|
4764
|
-
let n5 =
|
|
4765
|
-
return
|
|
4813
|
+
const o4 = bt(l2), s6 = ht(d2, t5, o4, `s:${n4}`);
|
|
4814
|
+
if (s6) {
|
|
4815
|
+
if ("HIT" === s6.status && void 0 !== s6.value && d2.full) {
|
|
4816
|
+
let n5 = s6.value;
|
|
4817
|
+
return s6.rule.update && (n5 = await jt(n5, s6.rule.update, { ...o4, cache: { status: "HIT" } }, e3)), f2?.(n5), { ok: true };
|
|
4766
4818
|
}
|
|
4767
|
-
if ("MISS" ===
|
|
4768
|
-
const n5 = f2,
|
|
4819
|
+
if ("MISS" === s6.status && d2.full && f2) {
|
|
4820
|
+
const n5 = f2, a5 = s6.rule.update, i4 = { ...o4, cache: { status: "MISS" } }, c5 = s6.key, u5 = s6.rule.ttl;
|
|
4769
4821
|
f2 = (o5) => {
|
|
4770
|
-
wt(t5, c5, o5, u5),
|
|
4771
|
-
const t6 = await jt(o5,
|
|
4822
|
+
wt(t5, c5, o5, u5), a5 ? r4 = (async () => {
|
|
4823
|
+
const t6 = await jt(o5, a5, i4, e3);
|
|
4772
4824
|
n5(t6);
|
|
4773
4825
|
})() : n5(o5);
|
|
4774
4826
|
};
|
|
4775
4827
|
}
|
|
4776
|
-
"MISS" !==
|
|
4828
|
+
"MISS" !== s6.status || d2.full || wt(t5, s6.key, true, s6.rule.ttl);
|
|
4777
4829
|
}
|
|
4778
4830
|
}
|
|
4779
4831
|
}
|
|
4780
|
-
const c4 = m2 ?? (g2 ?
|
|
4832
|
+
const c4 = m2 ?? (g2 ? ee(yt(g2, bt(l2)), Y2(e3.transformers)) : []), u4 = await e3.push(a4, { ...o3, id: n4, ingest: l2, respond: f2, mapping: s5, preChain: c4 });
|
|
4781
4833
|
return r4 && await r4, u4;
|
|
4782
|
-
}, command: e3.command, sources: e3.sources, elb: e3.sources.elb.push, logger: y2, ...r3 }, v2 = { collector: e3, logger: y2, id: n4, config:
|
|
4783
|
-
if (!
|
|
4784
|
-
const o3 = await
|
|
4834
|
+
}, command: e3.command, sources: e3.sources, elb: e3.sources.elb.push, logger: y2, ...r3 }, v2 = { collector: e3, logger: y2, id: n4, config: s5, env: b2, setIngest: async (t4) => {
|
|
4835
|
+
if (!s5.ingest) return void (l2 = $(n4));
|
|
4836
|
+
const o3 = await Te(t4, s5.ingest, { collector: e3 }), r4 = $(n4);
|
|
4785
4837
|
l2 = { ...r4, ...o3, _meta: r4._meta };
|
|
4786
4838
|
}, setRespond: (e4) => {
|
|
4787
4839
|
f2 = e4;
|
|
4788
|
-
} },
|
|
4789
|
-
if (!
|
|
4790
|
-
const w2 =
|
|
4791
|
-
return b2.logger = C3,
|
|
4840
|
+
} }, k2 = await Me(o2)(v2);
|
|
4841
|
+
if (!k2) return;
|
|
4842
|
+
const w2 = k2.type || "unknown", C3 = e3.logger.scope(w2).scope(n4);
|
|
4843
|
+
return b2.logger = C3, a3 && (k2.config = { ...k2.config, primary: a3 }), k2;
|
|
4792
4844
|
}
|
|
4793
4845
|
async function ae2(e3, n4 = {}) {
|
|
4794
4846
|
const t3 = {};
|
|
4795
|
-
for (const [o2,
|
|
4796
|
-
const { config: n5 = {} } =
|
|
4847
|
+
for (const [o2, s5] of Object.entries(n4)) {
|
|
4848
|
+
const { config: n5 = {} } = s5;
|
|
4797
4849
|
if (n5.require && n5.require.length > 0) {
|
|
4798
|
-
e3.pending.sources[o2] =
|
|
4850
|
+
e3.pending.sources[o2] = s5;
|
|
4799
4851
|
continue;
|
|
4800
4852
|
}
|
|
4801
|
-
const r3 = await re2(e3, o2,
|
|
4853
|
+
const r3 = await re2(e3, o2, s5);
|
|
4802
4854
|
r3 && (t3[o2] = r3);
|
|
4803
4855
|
}
|
|
4804
4856
|
return t3;
|
|
@@ -4807,36 +4859,36 @@ function ie2(e3, n4) {
|
|
|
4807
4859
|
return { collector: e3, logger: e3.logger.scope("on").scope(String(n4)) };
|
|
4808
4860
|
}
|
|
4809
4861
|
async function ce2(e3, n4, t3) {
|
|
4810
|
-
const o2 = e3.on,
|
|
4862
|
+
const o2 = e3.on, s5 = o2[n4] || [], r3 = Q(t3) ? t3 : [t3];
|
|
4811
4863
|
r3.forEach((e4) => {
|
|
4812
|
-
|
|
4813
|
-
}), o2[n4] =
|
|
4864
|
+
s5.push(e4);
|
|
4865
|
+
}), o2[n4] = s5, fe2(e3, n4, r3);
|
|
4814
4866
|
}
|
|
4815
|
-
function ue2(e3, n4, t3, o2,
|
|
4867
|
+
function ue2(e3, n4, t3, o2, s5) {
|
|
4816
4868
|
if (!n4.on) return;
|
|
4817
|
-
const r3 = n4.type || "unknown",
|
|
4818
|
-
|
|
4869
|
+
const r3 = n4.type || "unknown", a3 = e3.logger.scope(r3).scope("on").scope(o2), i2 = { collector: e3, logger: a3, id: t3, config: n4.config, data: s5, env: ke2(n4.env, n4.config.env) };
|
|
4870
|
+
Pe(n4.on)(o2, i2);
|
|
4819
4871
|
}
|
|
4820
|
-
function fe2(e3, n4, o2,
|
|
4872
|
+
function fe2(e3, n4, o2, s5) {
|
|
4821
4873
|
let r3;
|
|
4822
4874
|
switch (n4) {
|
|
4823
4875
|
case t.Commands.Consent:
|
|
4824
|
-
r3 =
|
|
4876
|
+
r3 = s5 || e3.consent;
|
|
4825
4877
|
break;
|
|
4826
4878
|
case t.Commands.Session:
|
|
4827
4879
|
r3 = e3.session;
|
|
4828
4880
|
break;
|
|
4829
4881
|
case t.Commands.User:
|
|
4830
|
-
r3 =
|
|
4882
|
+
r3 = s5 || e3.user;
|
|
4831
4883
|
break;
|
|
4832
4884
|
case t.Commands.Custom:
|
|
4833
|
-
r3 =
|
|
4885
|
+
r3 = s5 || e3.custom;
|
|
4834
4886
|
break;
|
|
4835
4887
|
case t.Commands.Globals:
|
|
4836
|
-
r3 =
|
|
4888
|
+
r3 = s5 || e3.globals;
|
|
4837
4889
|
break;
|
|
4838
4890
|
case t.Commands.Config:
|
|
4839
|
-
r3 =
|
|
4891
|
+
r3 = s5 || e3.config;
|
|
4840
4892
|
break;
|
|
4841
4893
|
case t.Commands.Ready:
|
|
4842
4894
|
case t.Commands.Run:
|
|
@@ -4846,20 +4898,20 @@ function fe2(e3, n4, o2, s4) {
|
|
|
4846
4898
|
if (o2.length) switch (n4) {
|
|
4847
4899
|
case t.Commands.Consent:
|
|
4848
4900
|
!(function(e4, n5, o3) {
|
|
4849
|
-
const
|
|
4901
|
+
const s6 = o3 || e4.consent, r4 = ie2(e4, t.Commands.Consent);
|
|
4850
4902
|
n5.forEach((e5) => {
|
|
4851
|
-
Object.keys(
|
|
4852
|
-
|
|
4903
|
+
Object.keys(s6).filter((n6) => n6 in e5).forEach((n6) => {
|
|
4904
|
+
Pe(e5[n6])(s6, r4);
|
|
4853
4905
|
});
|
|
4854
4906
|
});
|
|
4855
|
-
})(e3, o2,
|
|
4907
|
+
})(e3, o2, s5);
|
|
4856
4908
|
break;
|
|
4857
4909
|
case t.Commands.Ready:
|
|
4858
4910
|
!(function(e4, n5) {
|
|
4859
4911
|
if (!e4.allowed) return;
|
|
4860
4912
|
const o3 = ie2(e4, t.Commands.Ready);
|
|
4861
4913
|
n5.forEach((e5) => {
|
|
4862
|
-
|
|
4914
|
+
Pe(e5)(void 0, o3);
|
|
4863
4915
|
});
|
|
4864
4916
|
})(e3, o2);
|
|
4865
4917
|
break;
|
|
@@ -4868,7 +4920,7 @@ function fe2(e3, n4, o2, s4) {
|
|
|
4868
4920
|
if (!e4.allowed) return;
|
|
4869
4921
|
const o3 = ie2(e4, t.Commands.Run);
|
|
4870
4922
|
n5.forEach((e5) => {
|
|
4871
|
-
|
|
4923
|
+
Pe(e5)(void 0, o3);
|
|
4872
4924
|
});
|
|
4873
4925
|
})(e3, o2);
|
|
4874
4926
|
break;
|
|
@@ -4877,39 +4929,39 @@ function fe2(e3, n4, o2, s4) {
|
|
|
4877
4929
|
if (!e4.session) return;
|
|
4878
4930
|
const o3 = ie2(e4, t.Commands.Session);
|
|
4879
4931
|
n5.forEach((n6) => {
|
|
4880
|
-
|
|
4932
|
+
Pe(n6)(e4.session, o3);
|
|
4881
4933
|
});
|
|
4882
4934
|
})(e3, o2);
|
|
4883
4935
|
break;
|
|
4884
4936
|
default: {
|
|
4885
4937
|
const t3 = ie2(e3, n4);
|
|
4886
4938
|
o2.forEach((e4) => {
|
|
4887
|
-
"function" == typeof e4 &&
|
|
4939
|
+
"function" == typeof e4 && Pe(e4)(r3, t3);
|
|
4888
4940
|
});
|
|
4889
4941
|
break;
|
|
4890
4942
|
}
|
|
4891
4943
|
}
|
|
4892
4944
|
}
|
|
4893
|
-
async function le2(e3, n4, o2,
|
|
4894
|
-
let r3,
|
|
4895
|
-
switch (o2 || (
|
|
4945
|
+
async function le2(e3, n4, o2, s5) {
|
|
4946
|
+
let r3, a3 = o2 || [];
|
|
4947
|
+
switch (o2 || (a3 = e3.on[n4] || []), n4) {
|
|
4896
4948
|
case t.Commands.Consent:
|
|
4897
|
-
r3 =
|
|
4949
|
+
r3 = s5 || e3.consent;
|
|
4898
4950
|
break;
|
|
4899
4951
|
case t.Commands.Session:
|
|
4900
4952
|
r3 = e3.session;
|
|
4901
4953
|
break;
|
|
4902
4954
|
case t.Commands.User:
|
|
4903
|
-
r3 =
|
|
4955
|
+
r3 = s5 || e3.user;
|
|
4904
4956
|
break;
|
|
4905
4957
|
case t.Commands.Custom:
|
|
4906
|
-
r3 =
|
|
4958
|
+
r3 = s5 || e3.custom;
|
|
4907
4959
|
break;
|
|
4908
4960
|
case t.Commands.Globals:
|
|
4909
|
-
r3 =
|
|
4961
|
+
r3 = s5 || e3.globals;
|
|
4910
4962
|
break;
|
|
4911
4963
|
case t.Commands.Config:
|
|
4912
|
-
r3 =
|
|
4964
|
+
r3 = s5 || e3.config;
|
|
4913
4965
|
break;
|
|
4914
4966
|
case t.Commands.Ready:
|
|
4915
4967
|
case t.Commands.Run:
|
|
@@ -4918,7 +4970,7 @@ async function le2(e3, n4, o2, s4) {
|
|
|
4918
4970
|
}
|
|
4919
4971
|
let i2 = false;
|
|
4920
4972
|
for (const t3 of Object.values(e3.sources)) if (t3.on) {
|
|
4921
|
-
false === await
|
|
4973
|
+
false === await Me(t3.on)(n4, r3) && (i2 = true);
|
|
4922
4974
|
}
|
|
4923
4975
|
return Object.entries(e3.destinations).forEach(([t3, o3]) => {
|
|
4924
4976
|
if (o3.on) {
|
|
@@ -4928,139 +4980,139 @@ async function le2(e3, n4, o2, s4) {
|
|
|
4928
4980
|
}), (Object.keys(e3.pending.sources).length > 0 || Object.keys(e3.pending.destinations).length > 0) && await (async function(e4, n5) {
|
|
4929
4981
|
for (const [t3, o3] of Object.entries(e4.pending.sources)) {
|
|
4930
4982
|
if (!e4.pending.sources[t3] || e4.sources[t3]) continue;
|
|
4931
|
-
const
|
|
4932
|
-
if (!
|
|
4933
|
-
const r4 =
|
|
4983
|
+
const s6 = o3.config?.require;
|
|
4984
|
+
if (!s6) continue;
|
|
4985
|
+
const r4 = s6.indexOf(n5);
|
|
4934
4986
|
if (-1 === r4) continue;
|
|
4935
|
-
if (
|
|
4987
|
+
if (s6.splice(r4, 1), s6.length > 0) continue;
|
|
4936
4988
|
delete e4.pending.sources[t3];
|
|
4937
|
-
const
|
|
4938
|
-
|
|
4989
|
+
const a4 = await re2(e4, t3, o3);
|
|
4990
|
+
a4 && (e4.sources[t3] = a4);
|
|
4939
4991
|
}
|
|
4940
4992
|
for (const [t3, o3] of Object.entries(e4.pending.destinations)) {
|
|
4941
4993
|
if (!e4.pending.destinations[t3] || e4.destinations[t3]) continue;
|
|
4942
|
-
const
|
|
4943
|
-
if (!
|
|
4944
|
-
const r4 =
|
|
4994
|
+
const s6 = o3.config?.require;
|
|
4995
|
+
if (!s6) continue;
|
|
4996
|
+
const r4 = s6.indexOf(n5);
|
|
4945
4997
|
if (-1 === r4) continue;
|
|
4946
|
-
if (
|
|
4998
|
+
if (s6.splice(r4, 1), s6.length > 0) continue;
|
|
4947
4999
|
delete e4.pending.destinations[t3];
|
|
4948
|
-
const
|
|
4949
|
-
false !==
|
|
5000
|
+
const a4 = be2(o3);
|
|
5001
|
+
false !== a4.config.queue && (a4.queuePush = [...e4.queue]), e4.destinations[t3] = a4;
|
|
4950
5002
|
}
|
|
4951
|
-
})(e3, n4), fe2(e3, n4,
|
|
5003
|
+
})(e3, n4), fe2(e3, n4, a3, s5), !i2;
|
|
4952
5004
|
}
|
|
4953
|
-
function
|
|
5005
|
+
function de(e3, n4, t3, o2) {
|
|
4954
5006
|
if (!e3) return [];
|
|
4955
5007
|
if (n4) {
|
|
4956
5008
|
const e4 = yt(n4, bt(o2));
|
|
4957
|
-
return e4 ?
|
|
5009
|
+
return e4 ? ee(e4, Y2(t3)) : [];
|
|
4958
5010
|
}
|
|
4959
|
-
return
|
|
5011
|
+
return ee(e3, Y2(t3));
|
|
4960
5012
|
}
|
|
4961
|
-
async function
|
|
4962
|
-
const { code: o2, config:
|
|
5013
|
+
async function ge(e3, n4, t3) {
|
|
5014
|
+
const { code: o2, config: s5 = {}, env: r3 = {}, before: a3, next: i2, cache: c3 } = n4;
|
|
4963
5015
|
if (!re(o2.push)) return ye({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
|
|
4964
|
-
const u3 = t3 ||
|
|
4965
|
-
let f2 =
|
|
5016
|
+
const u3 = t3 || s5 || { init: false };
|
|
5017
|
+
let f2 = a3 ? { ...u3, before: a3 } : { ...u3 };
|
|
4966
5018
|
i2 && (f2 = { ...f2, next: i2 }), c3 && (f2 = { ...f2, cache: c3 });
|
|
4967
|
-
const l2 = { ...o2, config: f2, env:
|
|
5019
|
+
const l2 = { ...o2, config: f2, env: ke2(o2.env, r3) };
|
|
4968
5020
|
let d2 = l2.config.id;
|
|
4969
5021
|
if (!d2) do {
|
|
4970
|
-
d2 =
|
|
5022
|
+
d2 = we(5, "abcdefghijklmnopqrstuvwxyz");
|
|
4971
5023
|
} while (e3.destinations[d2]);
|
|
4972
|
-
return e3.destinations[d2] = l2, false !== l2.config.queue && (l2.queuePush = [...e3.queue]),
|
|
5024
|
+
return e3.destinations[d2] = l2, false !== l2.config.queue && (l2.queuePush = [...e3.queue]), me2(e3, void 0, {}, { [d2]: l2 });
|
|
4973
5025
|
}
|
|
4974
|
-
async function
|
|
4975
|
-
const { allowed:
|
|
4976
|
-
if (!
|
|
5026
|
+
async function me2(e3, n4, t3 = {}, o2) {
|
|
5027
|
+
const { allowed: s5, consent: r3, globals: a3, user: p2 } = e3;
|
|
5028
|
+
if (!s5) return ye({ ok: false });
|
|
4977
5029
|
n4 && (e3.queue.push(n4), e3.status.in++), o2 || (o2 = e3.destinations);
|
|
4978
|
-
const h2 = await Promise.all(Object.entries(o2 || {}).map(async ([o3,
|
|
4979
|
-
if (
|
|
4980
|
-
let h3 = (
|
|
4981
|
-
|
|
4982
|
-
const b3 = t3.ingest ? { ...t3.ingest, _meta: { ...t3.ingest._meta, path: [...t3.ingest._meta.path] } } :
|
|
4983
|
-
if (!h3.length && !
|
|
4984
|
-
if (!h3.length &&
|
|
4985
|
-
const n5 = await
|
|
4986
|
-
return { id: o3, destination:
|
|
4987
|
-
}
|
|
4988
|
-
const v3 = [],
|
|
4989
|
-
const n5 =
|
|
5030
|
+
const h2 = await Promise.all(Object.entries(o2 || {}).map(async ([o3, s6]) => {
|
|
5031
|
+
if (s6.config.disabled) return { id: o3, destination: s6, skipped: true };
|
|
5032
|
+
let h3 = (s6.queuePush || []).map((e4) => ({ ...e4, consent: r3 }));
|
|
5033
|
+
s6.queuePush = [], n4 && h3.push(ce(n4));
|
|
5034
|
+
const b3 = t3.ingest ? { ...t3.ingest, _meta: { ...t3.ingest._meta, path: [...t3.ingest._meta.path] } } : $("unknown");
|
|
5035
|
+
if (!h3.length && !s6.queueOn?.length) return { id: o3, destination: s6, skipped: true };
|
|
5036
|
+
if (!h3.length && s6.queueOn?.length) {
|
|
5037
|
+
const n5 = await Me(pe2)(e3, s6, o3);
|
|
5038
|
+
return { id: o3, destination: s6, skipped: !n5 };
|
|
5039
|
+
}
|
|
5040
|
+
const v3 = [], k3 = h3.filter((e4) => {
|
|
5041
|
+
const n5 = me(s6.config.consent, r3, e4.consent);
|
|
4990
5042
|
return !n5 || (e4.consent = n5, v3.push(e4), false);
|
|
4991
5043
|
});
|
|
4992
|
-
if (
|
|
4993
|
-
if (!await
|
|
5044
|
+
if (s6.queuePush.push(...k3), !v3.length) return { id: o3, destination: s6, queue: h3 };
|
|
5045
|
+
if (!await Me(pe2)(e3, s6, o3)) return { id: o3, destination: s6, queue: h3 };
|
|
4994
5046
|
let C3, O3;
|
|
4995
|
-
|
|
4996
|
-
const x2 =
|
|
5047
|
+
s6.dlq || (s6.dlq = []);
|
|
5048
|
+
const x2 = s6.config.before, A3 = de(x2, x2 && mt(x2) ? gt(x2) : void 0, e3.transformers, b3), q3 = s6.config.next, S3 = q3 && mt(q3) ? gt(q3) : void 0, D3 = s6.config?.cache, $3 = D3 ? vt(D3) : void 0, _3 = $3 ? X2($3, e3) : void 0;
|
|
4997
5049
|
let I2 = 0;
|
|
4998
5050
|
return await Promise.all(v3.map(async (n5) => {
|
|
4999
5051
|
let r4;
|
|
5000
|
-
if (n5.globals =
|
|
5001
|
-
const e4 = bt(b3, n5), t4 =
|
|
5052
|
+
if (n5.globals = X(a3, n5.globals), n5.user = X(p2, n5.user), $3?.full && _3) {
|
|
5053
|
+
const e4 = bt(b3, n5), t4 = ht($3, _3, e4, `d:${o3}`);
|
|
5002
5054
|
if ("HIT" === t4?.status) return n5;
|
|
5003
5055
|
"MISS" === t4?.status && (r4 = { key: t4.key, ttl: t4.rule.ttl });
|
|
5004
5056
|
}
|
|
5005
5057
|
let u3 = n5, f2 = t3.respond;
|
|
5006
5058
|
if (A3.length > 0 && e3.transformers && Object.keys(e3.transformers).length > 0) {
|
|
5007
|
-
const
|
|
5008
|
-
if (null ===
|
|
5009
|
-
|
|
5059
|
+
const s7 = await oe2(e3, e3.transformers, A3, n5, b3, t3.respond, `destination.${o3}.before`);
|
|
5060
|
+
if (null === s7.event) return n5;
|
|
5061
|
+
s7.respond && (f2 = s7.respond), u3 = Array.isArray(s7.event) ? s7.event[0] : s7.event;
|
|
5010
5062
|
}
|
|
5011
|
-
if ($
|
|
5012
|
-
const e4 = bt(b3, u3), t4 =
|
|
5063
|
+
if ($3 && !$3.full && _3) {
|
|
5064
|
+
const e4 = bt(b3, u3), t4 = ht($3, _3, e4, `d:${o3}`);
|
|
5013
5065
|
if ("HIT" === t4?.status) return n5;
|
|
5014
5066
|
"MISS" === t4?.status && (r4 = { key: t4.key, ttl: t4.rule.ttl });
|
|
5015
5067
|
}
|
|
5016
5068
|
const g2 = Date.now();
|
|
5017
5069
|
let m2 = false;
|
|
5018
|
-
const h4 = await
|
|
5019
|
-
const t4 =
|
|
5020
|
-
e3.logger.scope(t4).error("Push failed", { error: n6, event: u3.name }), C3 = n6, m2 = true,
|
|
5021
|
-
})(e3,
|
|
5022
|
-
if (I2 += Date.now() - g2, r4 && _3 && void 0 ===
|
|
5070
|
+
const h4 = await Me(he2, (n6) => {
|
|
5071
|
+
const t4 = s6.type || "unknown";
|
|
5072
|
+
e3.logger.scope(t4).error("Push failed", { error: n6, event: u3.name }), C3 = n6, m2 = true, s6.dlq.push([u3, n6]);
|
|
5073
|
+
})(e3, s6, o3, u3, b3, f2);
|
|
5074
|
+
if (I2 += Date.now() - g2, r4 && _3 && void 0 === s6.config.mock && wt(_3, r4.key, h4 ?? true, r4.ttl), void 0 !== h4 && (O3 = h4), !m2 && q3) {
|
|
5023
5075
|
void 0 !== h4 && (b3._response = h4);
|
|
5024
|
-
const n6 =
|
|
5076
|
+
const n6 = de(q3, S3, e3.transformers, b3);
|
|
5025
5077
|
if (n6.length > 0 && e3.transformers && Object.keys(e3.transformers).length > 0) {
|
|
5026
|
-
const t4 = await
|
|
5078
|
+
const t4 = await oe2(e3, e3.transformers, n6, u3, b3, f2, `destination.${o3}.next`);
|
|
5027
5079
|
t4.respond && (f2 = t4.respond);
|
|
5028
5080
|
}
|
|
5029
5081
|
}
|
|
5030
5082
|
return n5;
|
|
5031
|
-
})), { id: o3, destination:
|
|
5032
|
-
})), b2 = {}, v2 = {},
|
|
5083
|
+
})), { id: o3, destination: s6, error: C3, response: O3, totalDuration: I2 };
|
|
5084
|
+
})), b2 = {}, v2 = {}, k2 = {};
|
|
5033
5085
|
for (const n5 of h2) {
|
|
5034
5086
|
if (n5.skipped) continue;
|
|
5035
5087
|
const t4 = { type: n5.destination.type || "unknown", data: n5.response };
|
|
5036
5088
|
e3.status.destinations[n5.id] || (e3.status.destinations[n5.id] = { count: 0, failed: 0, duration: 0 });
|
|
5037
|
-
const o3 = e3.status.destinations[n5.id],
|
|
5038
|
-
n5.error ? (t4.error = n5.error,
|
|
5089
|
+
const o3 = e3.status.destinations[n5.id], s6 = Date.now();
|
|
5090
|
+
n5.error ? (t4.error = n5.error, k2[n5.id] = t4, o3.failed++, o3.lastAt = s6, o3.duration += n5.totalDuration || 0, e3.status.failed++) : n5.queue && n5.queue.length ? v2[n5.id] = t4 : (b2[n5.id] = t4, o3.count++, o3.lastAt = s6, o3.duration += n5.totalDuration || 0, e3.status.out++);
|
|
5039
5091
|
}
|
|
5040
|
-
return ye({ event: n4, ...Object.keys(b2).length && { done: b2 }, ...Object.keys(v2).length && { queued: v2 }, ...Object.keys(
|
|
5092
|
+
return ye({ event: n4, ...Object.keys(b2).length && { done: b2 }, ...Object.keys(v2).length && { queued: v2 }, ...Object.keys(k2).length && { failed: k2 } });
|
|
5041
5093
|
}
|
|
5042
5094
|
async function pe2(e3, n4, t3) {
|
|
5043
5095
|
if (n4.init && !n4.config.init) {
|
|
5044
|
-
const o2 = n4.type || "unknown",
|
|
5045
|
-
|
|
5046
|
-
const
|
|
5047
|
-
if (false ===
|
|
5048
|
-
if (n4.config = { ...
|
|
5096
|
+
const o2 = n4.type || "unknown", s5 = e3.logger.scope(o2), r3 = { collector: e3, logger: s5, id: t3, config: n4.config, env: ke2(n4.env, n4.config.env) };
|
|
5097
|
+
s5.debug("init");
|
|
5098
|
+
const a3 = await Je(n4.init, "DestinationInit", e3.hooks, e3.logger)(r3);
|
|
5099
|
+
if (false === a3) return a3;
|
|
5100
|
+
if (n4.config = { ...a3 || n4.config, init: true }, n4.queueOn?.length) {
|
|
5049
5101
|
const o3 = n4.queueOn;
|
|
5050
5102
|
n4.queueOn = [];
|
|
5051
|
-
for (const { type:
|
|
5103
|
+
for (const { type: s6, data: r4 } of o3) ue2(e3, n4, t3, s6, r4);
|
|
5052
5104
|
}
|
|
5053
|
-
|
|
5105
|
+
s5.debug("init done");
|
|
5054
5106
|
}
|
|
5055
5107
|
return true;
|
|
5056
5108
|
}
|
|
5057
|
-
async function he2(e3, n4, t3, o2,
|
|
5058
|
-
const { config:
|
|
5109
|
+
async function he2(e3, n4, t3, o2, s5, r3) {
|
|
5110
|
+
const { config: a3 } = n4, i2 = await Ze(o2, a3, e3);
|
|
5059
5111
|
if (i2.ignore) return false;
|
|
5060
|
-
const c3 = n4.type || "unknown", u3 = e3.logger.scope(c3), f2 = { collector: e3, logger: u3, id: t3, config:
|
|
5061
|
-
if (void 0 !==
|
|
5112
|
+
const c3 = n4.type || "unknown", u3 = e3.logger.scope(c3), f2 = { collector: e3, logger: u3, id: t3, config: a3, data: i2.data, rule: i2.mapping, ingest: s5, env: { ...ke2(n4.env, a3.env), ...r3 ? { respond: r3 } : {} } };
|
|
5113
|
+
if (void 0 !== a3.mock) return u3.debug("mock", { event: i2.event.name }), a3.mock;
|
|
5062
5114
|
const l2 = i2.mapping, d2 = i2.mappingKey || "* *";
|
|
5063
|
-
if (!l2?.batch || !n4.pushBatch || void 0 !==
|
|
5115
|
+
if (!l2?.batch || !n4.pushBatch || void 0 !== a3.mock) {
|
|
5064
5116
|
u3.debug("push", { event: i2.event.name });
|
|
5065
5117
|
const t4 = await Je(n4.push, "DestinationPush", e3.hooks, e3.logger)(i2.event, f2);
|
|
5066
5118
|
return u3.debug("push done"), t4;
|
|
@@ -5068,75 +5120,75 @@ async function he2(e3, n4, t3, o2, s4, r3) {
|
|
|
5068
5120
|
{
|
|
5069
5121
|
if (n4.batches = n4.batches || {}, !n4.batches[d2]) {
|
|
5070
5122
|
const o4 = { key: d2, events: [], data: [] };
|
|
5071
|
-
n4.batches[d2] = { batched: o4, batchFn:
|
|
5072
|
-
const o5 = n4.batches[d2].batched, i3 = { collector: e3, logger: u3, id: t3, config:
|
|
5123
|
+
n4.batches[d2] = { batched: o4, batchFn: ke(() => {
|
|
5124
|
+
const o5 = n4.batches[d2].batched, i3 = { collector: e3, logger: u3, id: t3, config: a3, data: void 0, rule: l2, ingest: s5, env: { ...ke2(n4.env, a3.env), ...r3 ? { respond: r3 } : {} } };
|
|
5073
5125
|
u3.debug("push batch", { events: o5.events.length }), Je(n4.pushBatch, "DestinationPushBatch", e3.hooks, e3.logger)(o5, i3), u3.debug("push batch done"), o5.events = [], o5.data = [];
|
|
5074
5126
|
}, l2.batch) };
|
|
5075
5127
|
}
|
|
5076
5128
|
const o3 = n4.batches[d2];
|
|
5077
|
-
o3.batched.events.push(i2.event),
|
|
5129
|
+
o3.batched.events.push(i2.event), te(i2.data) && o3.batched.data.push(i2.data), o3.batchFn();
|
|
5078
5130
|
}
|
|
5079
5131
|
return true;
|
|
5080
5132
|
}
|
|
5081
5133
|
function ye(e3) {
|
|
5082
5134
|
return { ok: !e3?.failed, ...e3 };
|
|
5083
5135
|
}
|
|
5084
|
-
function
|
|
5085
|
-
const { code: n4, config: t3 = {}, env: o2 = {}, cache:
|
|
5086
|
-
|
|
5087
|
-
const c3 =
|
|
5136
|
+
function be2(e3) {
|
|
5137
|
+
const { code: n4, config: t3 = {}, env: o2 = {}, cache: s5 } = e3, { config: r3 } = Z(e3, "before"), { config: a3 } = Z({ ...e3, config: r3 }, "next"), i2 = { ...n4.config, ...t3, ...a3 };
|
|
5138
|
+
s5 && (i2.cache = s5);
|
|
5139
|
+
const c3 = ke2(n4.env, o2);
|
|
5088
5140
|
return { ...n4, config: i2, env: c3 };
|
|
5089
5141
|
}
|
|
5090
5142
|
async function ve2(e3, n4 = {}) {
|
|
5091
5143
|
const t3 = {};
|
|
5092
|
-
for (const [o2,
|
|
5144
|
+
for (const [o2, s5] of Object.entries(n4)) s5.config?.require?.length ? e3.pending.destinations[o2] = s5 : t3[o2] = be2(s5);
|
|
5093
5145
|
return t3;
|
|
5094
5146
|
}
|
|
5095
|
-
function
|
|
5096
|
-
return e3 || n4 ? n4 ? e3 &&
|
|
5147
|
+
function ke2(e3, n4) {
|
|
5148
|
+
return e3 || n4 ? n4 ? e3 && ie(e3) && ie(n4) ? { ...e3, ...n4 } : n4 : e3 : {};
|
|
5097
5149
|
}
|
|
5098
5150
|
async function Ae2(e3, n4, t3) {
|
|
5099
5151
|
const o2 = Object.entries(e3).map(async ([e4, o3]) => {
|
|
5100
|
-
const
|
|
5101
|
-
if (!
|
|
5102
|
-
const r3 = o3.type || "unknown",
|
|
5152
|
+
const s5 = o3.destroy;
|
|
5153
|
+
if (!s5) return;
|
|
5154
|
+
const r3 = o3.type || "unknown", a3 = t3.scope(r3), i2 = { id: e4, config: o3.config, env: o3.env ?? {}, logger: a3 };
|
|
5103
5155
|
try {
|
|
5104
|
-
await Promise.race([
|
|
5156
|
+
await Promise.race([s5(i2), new Promise((t4, o4) => setTimeout(() => o4(new Error(`${n4} '${e4}' destroy timed out`)), 5e3))]);
|
|
5105
5157
|
} catch (t4) {
|
|
5106
|
-
|
|
5158
|
+
a3.error(`${n4} '${e4}' destroy failed: ${t4}`);
|
|
5107
5159
|
}
|
|
5108
5160
|
});
|
|
5109
5161
|
await Promise.allSettled(o2);
|
|
5110
5162
|
}
|
|
5111
5163
|
async function qe(e3, n4, o2, r3) {
|
|
5112
|
-
let
|
|
5164
|
+
let a3, i2, c3 = false;
|
|
5113
5165
|
switch (n4) {
|
|
5114
5166
|
case t.Commands.Config:
|
|
5115
|
-
|
|
5167
|
+
ie(o2) && (X(e3.config, o2, { shallow: false }), i2 = o2, c3 = true);
|
|
5116
5168
|
break;
|
|
5117
5169
|
case t.Commands.Consent:
|
|
5118
|
-
if (
|
|
5119
|
-
const { update: n5 } =
|
|
5170
|
+
if (ie(o2)) {
|
|
5171
|
+
const { update: n5 } = s2(e3, o2);
|
|
5120
5172
|
i2 = n5, c3 = true;
|
|
5121
5173
|
}
|
|
5122
5174
|
break;
|
|
5123
5175
|
case t.Commands.Custom:
|
|
5124
|
-
|
|
5176
|
+
ie(o2) && (e3.custom = X(e3.custom, o2), i2 = o2, c3 = true);
|
|
5125
5177
|
break;
|
|
5126
5178
|
case t.Commands.Destination:
|
|
5127
|
-
|
|
5179
|
+
ie(o2) && ("code" in o2 && ie(o2.code) ? a3 = await ge(e3, o2, r3) : re(o2.push) && (a3 = await ge(e3, { code: o2 }, r3)));
|
|
5128
5180
|
break;
|
|
5129
5181
|
case t.Commands.Globals:
|
|
5130
|
-
|
|
5182
|
+
ie(o2) && (e3.globals = X(e3.globals, o2), i2 = o2, c3 = true);
|
|
5131
5183
|
break;
|
|
5132
5184
|
case t.Commands.On:
|
|
5133
|
-
|
|
5185
|
+
se(o2) && await ce2(e3, o2, r3);
|
|
5134
5186
|
break;
|
|
5135
5187
|
case t.Commands.Ready:
|
|
5136
5188
|
c3 = true;
|
|
5137
5189
|
break;
|
|
5138
5190
|
case t.Commands.Run:
|
|
5139
|
-
|
|
5191
|
+
a3 = await De(e3, o2), c3 = true;
|
|
5140
5192
|
break;
|
|
5141
5193
|
case t.Commands.Session:
|
|
5142
5194
|
c3 = true;
|
|
@@ -5148,89 +5200,89 @@ async function qe(e3, n4, o2, r3) {
|
|
|
5148
5200
|
})(e3);
|
|
5149
5201
|
break;
|
|
5150
5202
|
case t.Commands.User:
|
|
5151
|
-
|
|
5203
|
+
ie(o2) && (X(e3.user, o2, { shallow: false }), i2 = o2, c3 = true);
|
|
5152
5204
|
}
|
|
5153
|
-
return c3 && (await le2(e3, n4, void 0, i2),
|
|
5205
|
+
return c3 && (await le2(e3, n4, void 0, i2), a3 = await me2(e3)), a3 || ye({ ok: true });
|
|
5154
5206
|
}
|
|
5155
5207
|
function Se2(e3, n4) {
|
|
5156
5208
|
if (!n4.name) throw new Error("Event name is required");
|
|
5157
5209
|
const [t3, o2] = n4.name.split(" ");
|
|
5158
5210
|
if (!t3 || !o2) throw new Error("Event name is invalid");
|
|
5159
|
-
const { timestamp:
|
|
5160
|
-
return { name: r3, data:
|
|
5211
|
+
const { timestamp: s5 = Date.now(), name: r3 = `${t3} ${o2}`, data: a3 = {}, context: i2 = {}, globals: c3 = e3.globals, custom: u3 = {}, user: f2 = e3.user, nested: l2 = [], consent: d2 = e3.consent, id: g2 = be(), trigger: m2 = "", entity: p2 = t3, action: h2 = o2, timing: y2 = 0, source: b2 = { type: "collector", schema: "4" } } = n4;
|
|
5212
|
+
return { name: r3, data: a3, context: i2, globals: c3, custom: u3, user: f2, nested: l2, consent: d2, id: g2, trigger: m2, entity: p2, action: h2, timestamp: s5, timing: y2, source: b2 };
|
|
5161
5213
|
}
|
|
5162
5214
|
async function De(e3, n4) {
|
|
5163
|
-
e3.allowed = true, e3.timing = Date.now(), n4 && (n4.consent && (e3.consent =
|
|
5215
|
+
e3.allowed = true, e3.timing = Date.now(), n4 && (n4.consent && (e3.consent = X(e3.consent, n4.consent)), n4.user && (e3.user = X(e3.user, n4.user)), n4.globals && (e3.globals = X(e3.config.globalsStatic || {}, n4.globals)), n4.custom && (e3.custom = X(e3.custom, n4.custom))), Object.values(e3.destinations).forEach((e4) => {
|
|
5164
5216
|
e4.queuePush = [];
|
|
5165
5217
|
}), e3.queue = [], e3.round++;
|
|
5166
|
-
return await
|
|
5218
|
+
return await me2(e3);
|
|
5167
5219
|
}
|
|
5168
5220
|
function Re2(e3, n4) {
|
|
5169
|
-
return Je(async (t3, o2 = {}) => await
|
|
5170
|
-
const
|
|
5221
|
+
return Je(async (t3, o2 = {}) => await Me(async () => {
|
|
5222
|
+
const s5 = Date.now(), { id: r3, ingest: a3, respond: i2, mapping: c3, preChain: u3, include: f2, exclude: l2 } = o2;
|
|
5171
5223
|
let d2 = i2, g2 = t3;
|
|
5172
5224
|
const m2 = f2 || l2 ? (function(e4, n5, t4) {
|
|
5173
5225
|
let o3 = e4;
|
|
5174
5226
|
return n5 && (o3 = Object.fromEntries(Object.entries(o3).filter(([e5]) => n5.includes(e5)))), t4 && (o3 = Object.fromEntries(Object.entries(o3).filter(([e5]) => !t4.includes(e5)))), o3;
|
|
5175
|
-
})(e3.destinations, f2, l2) : void 0, p2 =
|
|
5227
|
+
})(e3.destinations, f2, l2) : void 0, p2 = a3 ?? $(r3 || "unknown");
|
|
5176
5228
|
if (c3) {
|
|
5177
|
-
const n5 = await
|
|
5229
|
+
const n5 = await Ze(g2, c3, e3);
|
|
5178
5230
|
if (n5.ignore) return ye({ ok: true });
|
|
5179
5231
|
if (c3.consent) {
|
|
5180
|
-
if (!
|
|
5232
|
+
if (!me(c3.consent, e3.consent, n5.event.consent)) return ye({ ok: true });
|
|
5181
5233
|
}
|
|
5182
5234
|
g2 = n5.event;
|
|
5183
5235
|
}
|
|
5184
5236
|
if (u3?.length && e3.transformers && Object.keys(e3.transformers).length > 0) {
|
|
5185
|
-
const t4 = await
|
|
5237
|
+
const t4 = await oe2(e3, e3.transformers, u3, g2, p2, d2, r3 ? `source.${r3}.next` : void 0);
|
|
5186
5238
|
if (null === t4.event) return ye({ ok: true });
|
|
5187
5239
|
if (t4.respond && (d2 = t4.respond), Array.isArray(t4.event)) {
|
|
5188
5240
|
const o3 = await Promise.all(t4.event.map(async (t5) => {
|
|
5189
|
-
const o4 = n4(t5),
|
|
5190
|
-
return
|
|
5241
|
+
const o4 = n4(t5), s6 = Se2(e3, o4);
|
|
5242
|
+
return me2(e3, s6, { id: r3, ingest: p2, respond: d2 }, m2);
|
|
5191
5243
|
}));
|
|
5192
5244
|
if (r3) {
|
|
5193
5245
|
e3.status.sources[r3] || (e3.status.sources[r3] = { count: 0, duration: 0 });
|
|
5194
5246
|
const n5 = e3.status.sources[r3];
|
|
5195
|
-
n5.count += t4.event.length, n5.lastAt = Date.now(), n5.duration += Date.now() -
|
|
5247
|
+
n5.count += t4.event.length, n5.lastAt = Date.now(), n5.duration += Date.now() - s5;
|
|
5196
5248
|
}
|
|
5197
5249
|
return o3[0] ?? ye({ ok: true });
|
|
5198
5250
|
}
|
|
5199
5251
|
g2 = t4.event;
|
|
5200
5252
|
}
|
|
5201
|
-
const h2 = n4(g2), y2 = Se2(e3, h2), b2 = await
|
|
5253
|
+
const h2 = n4(g2), y2 = Se2(e3, h2), b2 = await me2(e3, y2, { id: r3, ingest: p2, respond: d2 }, m2);
|
|
5202
5254
|
if (r3) {
|
|
5203
5255
|
e3.status.sources[r3] || (e3.status.sources[r3] = { count: 0, duration: 0 });
|
|
5204
5256
|
const n5 = e3.status.sources[r3];
|
|
5205
|
-
n5.count++, n5.lastAt = Date.now(), n5.duration += Date.now() -
|
|
5257
|
+
n5.count++, n5.lastAt = Date.now(), n5.duration += Date.now() - s5;
|
|
5206
5258
|
}
|
|
5207
5259
|
return b2;
|
|
5208
5260
|
}, () => ye({ ok: false }))(), "Push", e3.hooks, e3.logger);
|
|
5209
5261
|
}
|
|
5210
5262
|
async function Ge(e3) {
|
|
5211
|
-
const n4 =
|
|
5212
|
-
i2.push = Re2(i2, (e4) => ({ timing: Math.round((Date.now() - i2.timing) / 10) / 100, source: { type: "collector", schema: "4", version: "4.0.
|
|
5213
|
-
return Je(async (t4, o3,
|
|
5263
|
+
const n4 = X({ globalsStatic: {}, sessionStatic: {}, run: true }, e3, { merge: false, extend: false }), t3 = { level: e3.logger?.level, handler: e3.logger?.handler }, o2 = _e(t3), s5 = { ...n4.globalsStatic, ...e3.globals }, i2 = { allowed: false, config: n4, consent: e3.consent || {}, custom: e3.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s5, hooks: e3.hooks || {}, logger: o2, on: {}, queue: [], round: 0, session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {} }, timing: Date.now(), user: e3.user || {}, sources: {}, pending: { sources: {}, destinations: {} }, push: void 0, command: void 0 };
|
|
5264
|
+
i2.push = Re2(i2, (e4) => ({ timing: Math.round((Date.now() - i2.timing) / 10) / 100, source: { type: "collector", schema: "4", version: "4.0.1-next-1778068549946" }, ...e4 })), i2.command = (function(e4, n5) {
|
|
5265
|
+
return Je(async (t4, o3, s6) => await Me(async () => await n5(e4, t4, o3, s6), () => ye({ ok: false }))(), "Command", e4.hooks, e4.logger);
|
|
5214
5266
|
})(i2, qe);
|
|
5215
5267
|
const c3 = e3.stores || {};
|
|
5216
5268
|
if (i2.stores = await (async function(e4, n5 = {}) {
|
|
5217
5269
|
const t4 = {};
|
|
5218
|
-
for (const [o3,
|
|
5219
|
-
const { code: n6, config: r3 = {}, env:
|
|
5270
|
+
for (const [o3, s6] of Object.entries(n5)) {
|
|
5271
|
+
const { code: n6, config: r3 = {}, env: a3 = {} } = s6, i3 = e4.logger.scope("store").scope(o3), c4 = { collector: e4, logger: i3, id: o3, config: r3, env: a3 }, u3 = await n6(c4), f2 = u3.get, l2 = u3.set, d2 = u3.delete;
|
|
5220
5272
|
u3.get = Je(f2, "StoreGet", e4.hooks, e4.logger), u3.set = Je(l2, "StoreSet", e4.hooks, e4.logger), u3.delete = Je(d2, "StoreDelete", e4.hooks, e4.logger), t4[o3] = u3;
|
|
5221
5273
|
}
|
|
5222
5274
|
return t4;
|
|
5223
5275
|
})(i2, c3), (function(e4, n5, t4) {
|
|
5224
5276
|
const o3 = /* @__PURE__ */ new Map();
|
|
5225
|
-
for (const [t5,
|
|
5277
|
+
for (const [t5, s7] of Object.entries(e4)) n5[t5] && o3.set(s7, n5[t5]);
|
|
5226
5278
|
if (0 !== o3.size) {
|
|
5227
|
-
for (const e5 of [t4.transformers, t4.destinations, t4.sources]) if (e5) for (const n6 of Object.values(e5))
|
|
5279
|
+
for (const e5 of [t4.transformers, t4.destinations, t4.sources]) if (e5) for (const n6 of Object.values(e5)) s6(n6.env);
|
|
5228
5280
|
}
|
|
5229
|
-
function
|
|
5281
|
+
function s6(e5) {
|
|
5230
5282
|
if (e5) {
|
|
5231
5283
|
for (const [n6, t5] of Object.entries(e5)) if ("object" == typeof t5 && null !== t5) {
|
|
5232
|
-
const
|
|
5233
|
-
|
|
5284
|
+
const s7 = o3.get(t5);
|
|
5285
|
+
s7 && (e5[n6] = s7);
|
|
5234
5286
|
}
|
|
5235
5287
|
}
|
|
5236
5288
|
}
|
|
@@ -5250,8 +5302,8 @@ async function Ge(e3) {
|
|
|
5250
5302
|
}
|
|
5251
5303
|
return i2.destinations = await ve2(i2, e3.destinations || {}), i2.transformers = await (async function(e4, n5 = {}) {
|
|
5252
5304
|
const t4 = {};
|
|
5253
|
-
for (const [o3,
|
|
5254
|
-
const { code: n6, env: r3 = {} } =
|
|
5305
|
+
for (const [o3, s6] of Object.entries(n5)) {
|
|
5306
|
+
const { code: n6, env: r3 = {} } = s6, { config: a3 } = Z(s6, "before"), { config: i3 } = Z({ ...s6, config: a3 }, "next"), c4 = Object.keys(r3).length > 0 ? { ...i3, env: r3 } : i3, { cache: u3 } = s6, f2 = u3 ? { ...c4, cache: u3 } : c4, l2 = e4.logger.scope("transformer").scope(o3), d2 = { collector: e4, logger: l2, id: o3, ingest: $(o3), config: f2, env: r3 }, g2 = await n6(d2);
|
|
5255
5307
|
t4[o3] = g2;
|
|
5256
5308
|
}
|
|
5257
5309
|
return t4;
|
|
@@ -5259,10 +5311,10 @@ async function Ge(e3) {
|
|
|
5259
5311
|
}
|
|
5260
5312
|
async function Ne2(e3) {
|
|
5261
5313
|
e3 = e3 || {};
|
|
5262
|
-
const n4 = await Ge(e3), t3 = (o2 = n4, { type: "elb", config: {}, push: async (e4, n5, t4,
|
|
5314
|
+
const n4 = await Ge(e3), t3 = (o2 = n4, { type: "elb", config: {}, push: async (e4, n5, t4, s6, r4, a4) => {
|
|
5263
5315
|
if ("string" == typeof e4 && e4.startsWith("walker ")) {
|
|
5264
|
-
const
|
|
5265
|
-
return o2.command(
|
|
5316
|
+
const s7 = e4.replace("walker ", "");
|
|
5317
|
+
return o2.command(s7, n5, t4);
|
|
5266
5318
|
}
|
|
5267
5319
|
let i3;
|
|
5268
5320
|
if ("string" == typeof e4) i3 = { name: e4 }, n5 && "object" == typeof n5 && !Array.isArray(n5) && (i3.data = n5);
|
|
@@ -5270,14 +5322,14 @@ async function Ne2(e3) {
|
|
|
5270
5322
|
if (!e4 || "object" != typeof e4) return ye({ ok: false });
|
|
5271
5323
|
i3 = e4, n5 && "object" == typeof n5 && !Array.isArray(n5) && (i3.data = { ...i3.data || {}, ...n5 });
|
|
5272
5324
|
}
|
|
5273
|
-
return
|
|
5325
|
+
return s6 && "object" == typeof s6 && (i3.context = s6), r4 && Array.isArray(r4) && (i3.nested = r4), a4 && "object" == typeof a4 && (i3.custom = a4), o2.push(i3);
|
|
5274
5326
|
} });
|
|
5275
5327
|
var o2;
|
|
5276
5328
|
n4.sources.elb = t3;
|
|
5277
|
-
const
|
|
5278
|
-
Object.assign(n4.sources,
|
|
5279
|
-
const { consent: r3, user:
|
|
5280
|
-
r3 && await n4.command("consent", r3),
|
|
5329
|
+
const s5 = await ae2(n4, e3.sources || {});
|
|
5330
|
+
Object.assign(n4.sources, s5);
|
|
5331
|
+
const { consent: r3, user: a3, globals: i2, custom: c3 } = e3;
|
|
5332
|
+
r3 && await n4.command("consent", r3), a3 && await n4.command("user", a3), i2 && Object.assign(n4.globals, i2), c3 && Object.assign(n4.custom, c3), n4.config.run && await n4.command("run");
|
|
5281
5333
|
let u3 = t3.push;
|
|
5282
5334
|
const f2 = Object.values(n4.sources).filter((e4) => "elb" !== e4.type), l2 = f2.find((e4) => e4.config.primary);
|
|
5283
5335
|
return l2 ? u3 = l2.push : f2.length > 0 && (u3 = f2[0].push), { collector: n4, elb: u3 };
|
|
@@ -5289,20 +5341,20 @@ function Ue(e3) {
|
|
|
5289
5341
|
for (const [t3, o2] of Object.entries(e3)) n4[t3] = "function" == typeof o2 ? o2 : Ue(o2);
|
|
5290
5342
|
return n4;
|
|
5291
5343
|
}
|
|
5292
|
-
function
|
|
5293
|
-
const n4 = [], { simulation: t3, ...o2 } = e3,
|
|
5344
|
+
function Be2(e3) {
|
|
5345
|
+
const n4 = [], { simulation: t3, ...o2 } = e3, s5 = Ue(o2);
|
|
5294
5346
|
for (const e4 of t3) {
|
|
5295
5347
|
const t4 = e4.startsWith("call:") ? e4.slice(5) : e4, o3 = t4.split(".");
|
|
5296
|
-
let r3 =
|
|
5348
|
+
let r3 = s5;
|
|
5297
5349
|
for (let e5 = 0; e5 < o3.length - 1 && null != r3[o3[e5]]; e5++) r3 = r3[o3[e5]];
|
|
5298
|
-
const
|
|
5299
|
-
if (null == r3 || !(
|
|
5300
|
-
const i2 = r3[
|
|
5301
|
-
"function" == typeof i2 && (r3[
|
|
5350
|
+
const a3 = o3[o3.length - 1];
|
|
5351
|
+
if (null == r3 || !(a3 in r3)) continue;
|
|
5352
|
+
const i2 = r3[a3];
|
|
5353
|
+
"function" == typeof i2 && (r3[a3] = function(...e5) {
|
|
5302
5354
|
return n4.push({ fn: t4, args: e5, ts: Date.now() }), i2.apply(this, e5);
|
|
5303
5355
|
});
|
|
5304
5356
|
}
|
|
5305
|
-
return { wrappedEnv:
|
|
5357
|
+
return { wrappedEnv: s5, calls: n4 };
|
|
5306
5358
|
}
|
|
5307
5359
|
|
|
5308
5360
|
// ../server/destinations/api/dist/index.mjs
|
|
@@ -5323,15 +5375,15 @@ var simulation = ["sendServer"];
|
|
|
5323
5375
|
var step_exports = {};
|
|
5324
5376
|
__export2(step_exports, { customHeaders: () => customHeaders, customTransform: () => customTransform, fullEvent: () => fullEvent });
|
|
5325
5377
|
var URL2 = "https://api.example.com/events";
|
|
5326
|
-
var fullEvent = { title: "Forward event data", description: "A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.", in:
|
|
5327
|
-
var customHeaders = { title: "Custom headers", description: "A form submission is sent to the API with custom request headers such as an API key for authentication.", in:
|
|
5328
|
-
var customTransform = { title: "Custom payload", description: "An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.", in:
|
|
5329
|
-
var destinationAPI = { type: "api", config: {}, env: { sendServer:
|
|
5378
|
+
var fullEvent = { title: "Forward event data", description: "A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.", in: he("page view", { timestamp: 1700000800, data: { title: "Docs", url: "https://example.com/docs" }, source: { type: "express", platform: "server" } }), mapping: { data: "data" }, out: [["sendServer", URL2, JSON.stringify({ title: "Docs", url: "https://example.com/docs" }), { headers: void 0, method: void 0, timeout: void 0 }]] };
|
|
5379
|
+
var customHeaders = { title: "Custom headers", description: "A form submission is sent to the API with custom request headers such as an API key for authentication.", in: he("form submit", { timestamp: 1700000801, data: { type: "contact", email: "user@example.com" }, source: { type: "express", platform: "server" } }), mapping: { data: "data" }, out: [["sendServer", URL2, JSON.stringify({ type: "contact", email: "user@example.com" }), { headers: { "X-API-Key": "YOUR_API_KEY" }, method: void 0, timeout: void 0 }]] };
|
|
5380
|
+
var customTransform = { title: "Custom payload", description: "An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.", in: he("order complete", { timestamp: 1700000802, data: { id: "ORD-500", total: 199.99, currency: "USD" }, user: { id: "buyer-42" }, source: { type: "express", platform: "server" } }), mapping: { data: { map: { order_id: "data.id", amount: "data.total", currency: "data.currency", customer_id: "user.id", event_type: "name" } } }, out: [["sendServer", URL2, JSON.stringify({ order_id: "ORD-500", amount: 199.99, currency: "USD", customer_id: "buyer-42", event_type: "order complete" }), { headers: void 0, method: void 0, timeout: void 0 }]] };
|
|
5381
|
+
var destinationAPI = { type: "api", config: {}, env: { sendServer: a }, async push(event, { config, rule, data, env, logger }) {
|
|
5330
5382
|
const { settings } = config, { url, headers, method, transform, timeout } = settings || {};
|
|
5331
5383
|
if (!url) return;
|
|
5332
|
-
const eventData =
|
|
5384
|
+
const eventData = te(data) ? data : event, body = transform ? transform(eventData, config, rule) : JSON.stringify(eventData);
|
|
5333
5385
|
logger?.debug("API destination sending request", { url, method: method || "POST", eventName: event.name });
|
|
5334
|
-
const sendServerFn = env?.sendServer ||
|
|
5386
|
+
const sendServerFn = env?.sendServer || a, response = await sendServerFn(url, body, { headers, method, timeout });
|
|
5335
5387
|
logger?.debug("API destination response", { ok: response?.ok });
|
|
5336
5388
|
} };
|
|
5337
5389
|
|
|
@@ -5535,6 +5587,8 @@ init_utils();
|
|
|
5535
5587
|
init_bundler();
|
|
5536
5588
|
|
|
5537
5589
|
// src/commands/push/overrides.ts
|
|
5590
|
+
init_parse_component_ref();
|
|
5591
|
+
var STEP_KINDS = ["source", "destination", "transformer"];
|
|
5538
5592
|
function buildOverrides(flags, flowConfig) {
|
|
5539
5593
|
const simulateFlags = flags.simulate ?? [];
|
|
5540
5594
|
const mockFlags = flags.mock ?? [];
|
|
@@ -5629,32 +5683,22 @@ function buildOverrides(flags, flowConfig) {
|
|
|
5629
5683
|
return overrides;
|
|
5630
5684
|
}
|
|
5631
5685
|
function parseStep(step) {
|
|
5632
|
-
const
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
`Invalid step format: "${
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
);
|
|
5643
|
-
}
|
|
5644
|
-
const name = parts[1];
|
|
5645
|
-
if (!name) {
|
|
5646
|
-
throw new Error(
|
|
5647
|
-
`Invalid step format: "${step}". Missing name after "${prefix}."`
|
|
5648
|
-
);
|
|
5649
|
-
}
|
|
5650
|
-
if (parts.length >= 4) {
|
|
5651
|
-
const chainType = parts[2];
|
|
5686
|
+
const { prefix, name, rest } = parseComponentRef(step, {
|
|
5687
|
+
allowed: STEP_KINDS,
|
|
5688
|
+
messages: {
|
|
5689
|
+
invalidFormat: (input) => `Invalid step format: "${input}". Expected "source.NAME" or "destination.NAME"`,
|
|
5690
|
+
invalidPrefix: (p2) => `Unsupported step type: "${p2}". Use "source", "destination", or "transformer"`,
|
|
5691
|
+
missingName: (input, p2) => `Invalid step format: "${input}". Missing name after "${p2}."`
|
|
5692
|
+
}
|
|
5693
|
+
});
|
|
5694
|
+
if (rest.length >= 2) {
|
|
5695
|
+
const chainType = rest[0];
|
|
5652
5696
|
if (chainType !== "before" && chainType !== "next") {
|
|
5653
5697
|
throw new Error(
|
|
5654
5698
|
`Invalid chain type: "${chainType}". Use "before" or "next"`
|
|
5655
5699
|
);
|
|
5656
5700
|
}
|
|
5657
|
-
const transformerId =
|
|
5701
|
+
const transformerId = rest[1];
|
|
5658
5702
|
if (!transformerId) {
|
|
5659
5703
|
throw new Error(
|
|
5660
5704
|
`Invalid step format: "${step}". Missing transformer name after "${chainType}."`
|
|
@@ -5662,7 +5706,7 @@ function parseStep(step) {
|
|
|
5662
5706
|
}
|
|
5663
5707
|
return { type: prefix, name, chainType, transformerId };
|
|
5664
5708
|
}
|
|
5665
|
-
if (
|
|
5709
|
+
if (rest.length === 1) {
|
|
5666
5710
|
throw new Error(
|
|
5667
5711
|
`Invalid step format: "${step}". Specify a transformer: "${step}.TRANSFORMER_NAME"`
|
|
5668
5712
|
);
|
|
@@ -5777,7 +5821,7 @@ function installTimerInterception(options = {}) {
|
|
|
5777
5821
|
let iterations = 0;
|
|
5778
5822
|
while (iterations < maxIterations) {
|
|
5779
5823
|
await drainMicrotasks();
|
|
5780
|
-
const ready = Array.from(pending.values()).filter((t3) => !t3.cleared).sort((
|
|
5824
|
+
const ready = Array.from(pending.values()).filter((t3) => !t3.cleared).sort((a3, b2) => a3.delay - b2.delay);
|
|
5781
5825
|
if (ready.length === 0) break;
|
|
5782
5826
|
for (const timer of ready) {
|
|
5783
5827
|
if (timer.cleared) continue;
|
|
@@ -5836,7 +5880,7 @@ function startDrainPump(pending, options = {}) {
|
|
|
5836
5880
|
return;
|
|
5837
5881
|
}
|
|
5838
5882
|
iterations += 1;
|
|
5839
|
-
const snapshot = [...pending.values()].filter((t3) => !t3.cleared).sort((
|
|
5883
|
+
const snapshot = [...pending.values()].filter((t3) => !t3.cleared).sort((a3, b2) => a3.delay - b2.delay);
|
|
5840
5884
|
for (const timer of snapshot) {
|
|
5841
5885
|
pending.delete(timer.id);
|
|
5842
5886
|
try {
|
|
@@ -5988,13 +6032,13 @@ function applyNetworkPolyfills(dom, networkCalls) {
|
|
|
5988
6032
|
const headers = {};
|
|
5989
6033
|
if (init2?.headers) {
|
|
5990
6034
|
if (init2.headers instanceof Headers) {
|
|
5991
|
-
init2.headers.forEach((v2,
|
|
5992
|
-
headers[
|
|
6035
|
+
init2.headers.forEach((v2, k2) => {
|
|
6036
|
+
headers[k2] = v2;
|
|
5993
6037
|
});
|
|
5994
6038
|
} else if (typeof init2.headers === "object") {
|
|
5995
6039
|
Object.entries(init2.headers).forEach(
|
|
5996
|
-
([
|
|
5997
|
-
headers[
|
|
6040
|
+
([k2, v2]) => {
|
|
6041
|
+
headers[k2] = v2;
|
|
5998
6042
|
}
|
|
5999
6043
|
);
|
|
6000
6044
|
}
|
|
@@ -6037,7 +6081,7 @@ async function prepareFlow(input) {
|
|
|
6037
6081
|
configPath: process.cwd(),
|
|
6038
6082
|
flowName: input.flow
|
|
6039
6083
|
});
|
|
6040
|
-
const platform =
|
|
6084
|
+
const platform = q(flowSettings);
|
|
6041
6085
|
const overrides = buildOverrides(
|
|
6042
6086
|
{ simulate: input.simulate, mock: input.mock },
|
|
6043
6087
|
flowSettings
|
|
@@ -6229,9 +6273,9 @@ function resolveBeforeChain(before, transformers, ingest, event) {
|
|
|
6229
6273
|
const compiled = gt(next);
|
|
6230
6274
|
const resolved = yt(compiled, bt(ingest, event));
|
|
6231
6275
|
if (!resolved) return [];
|
|
6232
|
-
return
|
|
6276
|
+
return ee(resolved, Y2(transformers));
|
|
6233
6277
|
}
|
|
6234
|
-
return
|
|
6278
|
+
return ee(
|
|
6235
6279
|
next,
|
|
6236
6280
|
Y2(transformers)
|
|
6237
6281
|
);
|
|
@@ -6333,7 +6377,7 @@ async function push(configOrPath, event, options = {}) {
|
|
|
6333
6377
|
"push() currently only supports config file paths. Config object support will be added in a future version. Please provide a path to a configuration file."
|
|
6334
6378
|
);
|
|
6335
6379
|
}
|
|
6336
|
-
const parsed =
|
|
6380
|
+
const parsed = i.PartialEventSchema.safeParse(event);
|
|
6337
6381
|
if (!parsed.success) {
|
|
6338
6382
|
return {
|
|
6339
6383
|
success: false,
|
|
@@ -6357,7 +6401,7 @@ async function executeConfigPush(options, validatedEvent, logger, setTempDir, sn
|
|
|
6357
6401
|
flowName: options.flow,
|
|
6358
6402
|
logger
|
|
6359
6403
|
});
|
|
6360
|
-
const platform =
|
|
6404
|
+
const platform = q(flowSettings);
|
|
6361
6405
|
const overrides = buildOverrides({ mock: options.mock }, flowSettings);
|
|
6362
6406
|
logger.debug("Bundling flow configuration");
|
|
6363
6407
|
const tempDir = getTmpPath(
|
|
@@ -6550,7 +6594,7 @@ async function simulateSource(configOrPath, input, options) {
|
|
|
6550
6594
|
}
|
|
6551
6595
|
async function simulateTransformer(configOrPath, event, options) {
|
|
6552
6596
|
const startTime = Date.now();
|
|
6553
|
-
const parsed =
|
|
6597
|
+
const parsed = i.PartialEventSchema.safeParse(event);
|
|
6554
6598
|
if (!parsed.success) {
|
|
6555
6599
|
return {
|
|
6556
6600
|
success: false,
|
|
@@ -6619,7 +6663,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
6619
6663
|
`Transformer "${options.transformerId}" not found in collector. Available: ${Object.keys(collector.transformers || {}).join(", ") || "none"}`
|
|
6620
6664
|
);
|
|
6621
6665
|
}
|
|
6622
|
-
const initialized = await
|
|
6666
|
+
const initialized = await ne(
|
|
6623
6667
|
collector,
|
|
6624
6668
|
transformer,
|
|
6625
6669
|
options.transformerId
|
|
@@ -6630,7 +6674,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
6630
6674
|
);
|
|
6631
6675
|
}
|
|
6632
6676
|
const inputEvent = event;
|
|
6633
|
-
const ingest =
|
|
6677
|
+
const ingest = $(options.transformerId);
|
|
6634
6678
|
const captured = [];
|
|
6635
6679
|
captured.push({ event: { ...inputEvent }, timestamp: Date.now() });
|
|
6636
6680
|
logger.info(`Simulating transformer: ${options.transformerId}`);
|
|
@@ -6644,7 +6688,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
6644
6688
|
processedEvent
|
|
6645
6689
|
);
|
|
6646
6690
|
if (beforeChainIds.length > 0) {
|
|
6647
|
-
const beforeResult = await
|
|
6691
|
+
const beforeResult = await oe2(
|
|
6648
6692
|
collector,
|
|
6649
6693
|
collector.transformers,
|
|
6650
6694
|
beforeChainIds,
|
|
@@ -6665,7 +6709,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
6665
6709
|
processedEvent = Array.isArray(beforeResult) ? beforeResult[0] : beforeResult;
|
|
6666
6710
|
}
|
|
6667
6711
|
}
|
|
6668
|
-
const pushResult = await
|
|
6712
|
+
const pushResult = await te2(
|
|
6669
6713
|
collector,
|
|
6670
6714
|
transformer,
|
|
6671
6715
|
options.transformerId,
|
|
@@ -6707,7 +6751,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
6707
6751
|
}
|
|
6708
6752
|
async function simulateDestination(configOrPath, event, options) {
|
|
6709
6753
|
const startTime = Date.now();
|
|
6710
|
-
const parsed =
|
|
6754
|
+
const parsed = i.PartialEventSchema.safeParse(event);
|
|
6711
6755
|
if (!parsed.success) {
|
|
6712
6756
|
return {
|
|
6713
6757
|
success: false,
|
|
@@ -6779,7 +6823,7 @@ async function simulateDestination(configOrPath, event, options) {
|
|
|
6779
6823
|
...devEnv.push,
|
|
6780
6824
|
simulation: devEnv.simulation
|
|
6781
6825
|
};
|
|
6782
|
-
const { wrappedEnv, calls } =
|
|
6826
|
+
const { wrappedEnv, calls } = Be2(combined);
|
|
6783
6827
|
if (destConfig) destConfig.env = wrappedEnv;
|
|
6784
6828
|
trackedCalls = calls;
|
|
6785
6829
|
}
|
|
@@ -7715,6 +7759,126 @@ async function resolveBundlePath(configInput, apiConfig, logger) {
|
|
|
7715
7759
|
return path17.resolve(defaultFile);
|
|
7716
7760
|
}
|
|
7717
7761
|
|
|
7762
|
+
// src/commands/setup/index.ts
|
|
7763
|
+
init_loader();
|
|
7764
|
+
init_cli_logger();
|
|
7765
|
+
init_output();
|
|
7766
|
+
|
|
7767
|
+
// src/commands/setup/resolve.ts
|
|
7768
|
+
init_parse_component_ref();
|
|
7769
|
+
var VALID_KINDS = ["source", "destination", "store"];
|
|
7770
|
+
function getBucket(flow, kind) {
|
|
7771
|
+
switch (kind) {
|
|
7772
|
+
case "source":
|
|
7773
|
+
return flow.sources;
|
|
7774
|
+
case "destination":
|
|
7775
|
+
return flow.destinations;
|
|
7776
|
+
case "store":
|
|
7777
|
+
return flow.stores;
|
|
7778
|
+
}
|
|
7779
|
+
}
|
|
7780
|
+
function pluralLabel(kind) {
|
|
7781
|
+
switch (kind) {
|
|
7782
|
+
case "source":
|
|
7783
|
+
return "sources";
|
|
7784
|
+
case "destination":
|
|
7785
|
+
return "destinations";
|
|
7786
|
+
case "store":
|
|
7787
|
+
return "stores";
|
|
7788
|
+
}
|
|
7789
|
+
}
|
|
7790
|
+
function resolveComponent(flow, target) {
|
|
7791
|
+
const { prefix, name: id } = parseComponentRef(target, {
|
|
7792
|
+
allowed: VALID_KINDS
|
|
7793
|
+
});
|
|
7794
|
+
const kind = prefix;
|
|
7795
|
+
const bucket = getBucket(flow, kind);
|
|
7796
|
+
const def = bucket?.[id];
|
|
7797
|
+
if (!def) {
|
|
7798
|
+
const available = Object.keys(bucket ?? {}).join(", ") || "(none)";
|
|
7799
|
+
throw new Error(
|
|
7800
|
+
`${kind} "${id}" not found in flow. Available ${pluralLabel(kind)}: ${available}`
|
|
7801
|
+
);
|
|
7802
|
+
}
|
|
7803
|
+
if (!def.package) {
|
|
7804
|
+
throw new Error(`${kind}.${id} has no "package", cannot resolve setup.`);
|
|
7805
|
+
}
|
|
7806
|
+
return {
|
|
7807
|
+
kind,
|
|
7808
|
+
id,
|
|
7809
|
+
packageName: def.package,
|
|
7810
|
+
config: def.config ?? {},
|
|
7811
|
+
env: def.env ?? {}
|
|
7812
|
+
};
|
|
7813
|
+
}
|
|
7814
|
+
|
|
7815
|
+
// src/commands/setup/index.ts
|
|
7816
|
+
function readSetupField(config) {
|
|
7817
|
+
if (config === null || typeof config !== "object") return void 0;
|
|
7818
|
+
if (!("setup" in config)) return void 0;
|
|
7819
|
+
const value = config.setup;
|
|
7820
|
+
if (typeof value === "boolean") return value;
|
|
7821
|
+
if (value !== null && typeof value === "object") return value;
|
|
7822
|
+
return void 0;
|
|
7823
|
+
}
|
|
7824
|
+
function isComponentDefault(value) {
|
|
7825
|
+
return value !== null && typeof value === "object";
|
|
7826
|
+
}
|
|
7827
|
+
function isSetupFn(value) {
|
|
7828
|
+
return typeof value === "function";
|
|
7829
|
+
}
|
|
7830
|
+
async function setupCommand(opts) {
|
|
7831
|
+
const startTime = Date.now();
|
|
7832
|
+
const baseLogger = opts.logger ?? createCLILogger({
|
|
7833
|
+
verbose: opts.verbose,
|
|
7834
|
+
silent: opts.silent,
|
|
7835
|
+
json: opts.json
|
|
7836
|
+
});
|
|
7837
|
+
const { flowSettings } = await loadFlowConfig(opts.config ?? "./flow.json", {
|
|
7838
|
+
flowName: opts.flow
|
|
7839
|
+
});
|
|
7840
|
+
const component = resolveComponent(flowSettings, opts.target);
|
|
7841
|
+
const scoped = baseLogger.scope(component.kind).scope(component.id);
|
|
7842
|
+
scoped.info(`setup: starting ${component.kind}.${component.id}`);
|
|
7843
|
+
const mod = await import(component.packageName);
|
|
7844
|
+
const code = mod.default;
|
|
7845
|
+
if (!isComponentDefault(code)) {
|
|
7846
|
+
throw new Error(
|
|
7847
|
+
`Package ${component.packageName} has no default export. walkerOS components are expected to use 'export default'.`
|
|
7848
|
+
);
|
|
7849
|
+
}
|
|
7850
|
+
const setupFn = code.setup;
|
|
7851
|
+
if (!isSetupFn(setupFn)) {
|
|
7852
|
+
scoped.info(
|
|
7853
|
+
`setup: skipped ${component.kind}.${component.id} (no setup function)`
|
|
7854
|
+
);
|
|
7855
|
+
return;
|
|
7856
|
+
}
|
|
7857
|
+
const setupConfig = readSetupField(component.config);
|
|
7858
|
+
if (setupConfig === false || setupConfig === void 0) {
|
|
7859
|
+
const reason = setupConfig === false ? "false" : "unset";
|
|
7860
|
+
scoped.info(
|
|
7861
|
+
`setup: skipped ${component.kind}.${component.id} (config.setup is ${reason})`
|
|
7862
|
+
);
|
|
7863
|
+
return;
|
|
7864
|
+
}
|
|
7865
|
+
const result = await setupFn({
|
|
7866
|
+
id: component.id,
|
|
7867
|
+
config: component.config,
|
|
7868
|
+
env: component.env,
|
|
7869
|
+
logger: scoped
|
|
7870
|
+
});
|
|
7871
|
+
if (opts.json) {
|
|
7872
|
+
const envelope = createSuccessOutput(
|
|
7873
|
+
{ result: result ?? null },
|
|
7874
|
+
Date.now() - startTime
|
|
7875
|
+
);
|
|
7876
|
+
await writeResult(JSON.stringify(envelope, null, 2) + "\n", {});
|
|
7877
|
+
return;
|
|
7878
|
+
}
|
|
7879
|
+
scoped.info(`setup: ok ${component.kind}.${component.id}`);
|
|
7880
|
+
}
|
|
7881
|
+
|
|
7718
7882
|
// src/commands/validate/index.ts
|
|
7719
7883
|
init_cli_logger();
|
|
7720
7884
|
init_core();
|
|
@@ -7881,11 +8045,11 @@ function validateEvent2(input) {
|
|
|
7881
8045
|
// src/commands/validate/validators/flow.ts
|
|
7882
8046
|
init_dist();
|
|
7883
8047
|
init_dev();
|
|
7884
|
-
var { validateFlowConfig: validateFlowConfig2 } =
|
|
8048
|
+
var { validateFlowConfig: validateFlowConfig2 } = i;
|
|
7885
8049
|
function isFlowJson(value) {
|
|
7886
|
-
if (!
|
|
8050
|
+
if (!ie(value)) return false;
|
|
7887
8051
|
if (!("version" in value) || !("flows" in value)) return false;
|
|
7888
|
-
return
|
|
8052
|
+
return ie(value.flows);
|
|
7889
8053
|
}
|
|
7890
8054
|
function validateFlow(input, options = {}) {
|
|
7891
8055
|
const errors = [];
|
|
@@ -7916,9 +8080,9 @@ function validateFlow(input, options = {}) {
|
|
|
7916
8080
|
message: issue.message
|
|
7917
8081
|
});
|
|
7918
8082
|
}
|
|
7919
|
-
const config =
|
|
8083
|
+
const config = ie(input) ? input : {};
|
|
7920
8084
|
const flowsValue = config.flows;
|
|
7921
|
-
const flows =
|
|
8085
|
+
const flows = ie(flowsValue) ? flowsValue : void 0;
|
|
7922
8086
|
if (flows && Object.keys(flows).length === 0) {
|
|
7923
8087
|
errors.push({
|
|
7924
8088
|
path: "flows",
|
|
@@ -7945,15 +8109,15 @@ function validateFlow(input, options = {}) {
|
|
|
7945
8109
|
let totalPackageCount = 0;
|
|
7946
8110
|
if (flows) {
|
|
7947
8111
|
for (const [flowName, flowValue] of Object.entries(flows)) {
|
|
7948
|
-
if (!
|
|
8112
|
+
if (!ie(flowValue)) continue;
|
|
7949
8113
|
const flowConfig = flowValue.config;
|
|
7950
|
-
if (!
|
|
8114
|
+
if (!ie(flowConfig)) continue;
|
|
7951
8115
|
const bundle2 = flowConfig.bundle;
|
|
7952
|
-
if (!
|
|
8116
|
+
if (!ie(bundle2)) continue;
|
|
7953
8117
|
const packages = bundle2.packages;
|
|
7954
|
-
if (!
|
|
8118
|
+
if (!ie(packages)) continue;
|
|
7955
8119
|
for (const [pkgName, pkgConfigValue] of Object.entries(packages)) {
|
|
7956
|
-
if (!
|
|
8120
|
+
if (!ie(pkgConfigValue)) continue;
|
|
7957
8121
|
if (!pkgConfigValue.version && !pkgConfigValue.path) {
|
|
7958
8122
|
warnings.push({
|
|
7959
8123
|
path: `flows.${flowName}.config.bundle.packages.${pkgName}`,
|
|
@@ -7996,9 +8160,9 @@ function validateFlow(input, options = {}) {
|
|
|
7996
8160
|
for (const [destName, dest] of Object.entries(
|
|
7997
8161
|
flowSettings.destinations || {}
|
|
7998
8162
|
)) {
|
|
7999
|
-
if (!
|
|
8163
|
+
if (!ie(dest.config)) continue;
|
|
8000
8164
|
const mapping = dest.config.mapping;
|
|
8001
|
-
if (!
|
|
8165
|
+
if (!ie(mapping)) continue;
|
|
8002
8166
|
for (const key of Object.keys(mapping)) {
|
|
8003
8167
|
if (key.includes(".") && !key.includes(" ")) {
|
|
8004
8168
|
const parts = key.split(".");
|
|
@@ -8017,7 +8181,7 @@ function validateFlow(input, options = {}) {
|
|
|
8017
8181
|
const flowsToResolve = options.flow ? options.flow in flowsMap ? [options.flow] : [] : Object.keys(flowsMap);
|
|
8018
8182
|
for (const name of flowsToResolve) {
|
|
8019
8183
|
try {
|
|
8020
|
-
|
|
8184
|
+
K(input, name, {
|
|
8021
8185
|
deferred: true,
|
|
8022
8186
|
// don't fail on missing $env when validating
|
|
8023
8187
|
strictFlowRefs: false,
|
|
@@ -8134,14 +8298,14 @@ function checkCompatibility(conn, errors, warnings) {
|
|
|
8134
8298
|
});
|
|
8135
8299
|
}
|
|
8136
8300
|
}
|
|
8137
|
-
function isStructurallyCompatible(
|
|
8138
|
-
if (typeof
|
|
8139
|
-
if (
|
|
8140
|
-
if (Array.isArray(
|
|
8141
|
-
if (typeof
|
|
8142
|
-
const keysA = Object.keys(
|
|
8301
|
+
function isStructurallyCompatible(a3, b2) {
|
|
8302
|
+
if (typeof a3 !== typeof b2) return false;
|
|
8303
|
+
if (a3 === null || b2 === null) return a3 === b2;
|
|
8304
|
+
if (Array.isArray(a3) && Array.isArray(b2)) return true;
|
|
8305
|
+
if (typeof a3 === "object" && typeof b2 === "object") {
|
|
8306
|
+
const keysA = Object.keys(a3);
|
|
8143
8307
|
const keysB = Object.keys(b2);
|
|
8144
|
-
const shared = keysA.filter((
|
|
8308
|
+
const shared = keysA.filter((k2) => keysB.includes(k2));
|
|
8145
8309
|
return shared.length >= Math.min(keysA.length, keysB.length) * 0.5;
|
|
8146
8310
|
}
|
|
8147
8311
|
return true;
|
|
@@ -8232,7 +8396,7 @@ function validateMapping(input) {
|
|
|
8232
8396
|
// src/commands/validate/validators/entry.ts
|
|
8233
8397
|
init_dist();
|
|
8234
8398
|
import Ajv from "ajv";
|
|
8235
|
-
var CLIENT_HEADER = "walkeros-cli/4.0.
|
|
8399
|
+
var CLIENT_HEADER = "walkeros-cli/4.0.1-next-1778068549946";
|
|
8236
8400
|
var SECTIONS = ["destinations", "sources", "transformers"];
|
|
8237
8401
|
function resolveEntry(path18, flowConfig) {
|
|
8238
8402
|
const flows = flowConfig.flows;
|
|
@@ -9171,7 +9335,7 @@ async function createDeployCommand(config, options) {
|
|
|
9171
9335
|
const result2 = await loadFlowConfig(config, {
|
|
9172
9336
|
flowName: options.flow
|
|
9173
9337
|
});
|
|
9174
|
-
type =
|
|
9338
|
+
type = q(result2.flowSettings);
|
|
9175
9339
|
}
|
|
9176
9340
|
const deployment = await createDeployment({
|
|
9177
9341
|
type,
|
|
@@ -9416,6 +9580,18 @@ program.command("push [file]").description("Push an event through the flow with
|
|
|
9416
9580
|
snapshot: options.snapshot
|
|
9417
9581
|
});
|
|
9418
9582
|
});
|
|
9583
|
+
program.command("setup <target>").description(
|
|
9584
|
+
"Run the setup function for one component. Target format: source.NAME | destination.NAME | store.NAME."
|
|
9585
|
+
).option("-c, --config <path>", "flow config file", "./flow.json").option("-f, --flow <name>", "flow name for multi-flow configs").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (target, options) => {
|
|
9586
|
+
await setupCommand({
|
|
9587
|
+
target,
|
|
9588
|
+
config: options.config,
|
|
9589
|
+
flow: options.flow,
|
|
9590
|
+
json: options.json,
|
|
9591
|
+
verbose: options.verbose,
|
|
9592
|
+
silent: options.silent
|
|
9593
|
+
});
|
|
9594
|
+
});
|
|
9419
9595
|
program.command("validate [input]").description(
|
|
9420
9596
|
"Validate flow configuration (schema, references, cross-step examples)"
|
|
9421
9597
|
).option(
|
|
@@ -9629,7 +9805,7 @@ program.hook("postAction", async () => {
|
|
|
9629
9805
|
process.on("exit", () => {
|
|
9630
9806
|
if (telemetryEmitted) return;
|
|
9631
9807
|
const argvTail = process.argv.slice(2);
|
|
9632
|
-
const argvCmd = cmdPath || argvTail.find((
|
|
9808
|
+
const argvCmd = cmdPath || argvTail.find((a3) => !a3.startsWith("-")) || (argvTail.some((a3) => a3 === "--version" || a3 === "-V") ? "--version" : "") || (argvTail.some((a3) => a3 === "--help" || a3 === "-h") ? "--help" : "");
|
|
9633
9809
|
void emitter.send(
|
|
9634
9810
|
"cmd invoke",
|
|
9635
9811
|
{ command: argvCmd, outcome: "success" },
|