@walkeros/cli 3.2.0 → 3.3.0-next-1776098542393
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 +98 -0
- package/dist/cli.js +879 -863
- package/dist/examples/flow-complete.json +167 -65
- package/dist/examples/flow-order-complete.json +11 -9
- package/dist/examples/flow-selfhost-test.json +6 -4
- package/dist/examples/flow-simple.json +11 -9
- package/dist/examples/flow.json +16 -14
- package/dist/examples/server-collect.json +14 -12
- package/dist/examples/web-serve.json +20 -15
- package/dist/index.d.ts +115 -4
- package/dist/index.js +611 -447
- package/dist/index.js.map +1 -1
- package/examples/flow-complete.json +167 -65
- package/examples/flow-order-complete.json +11 -9
- package/examples/flow-selfhost-test.json +6 -4
- package/examples/flow-simple.json +11 -9
- package/examples/flow.json +16 -14
- package/examples/server-collect.json +14 -12
- package/examples/web-serve.json +20 -15
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ function $constructor(name, initializer3, params) {
|
|
|
17
17
|
Object.defineProperty(inst, "_zod", {
|
|
18
18
|
value: {
|
|
19
19
|
def,
|
|
20
|
-
constr:
|
|
20
|
+
constr: _3,
|
|
21
21
|
traits: /* @__PURE__ */ new Set()
|
|
22
22
|
},
|
|
23
23
|
enumerable: false
|
|
@@ -28,7 +28,7 @@ function $constructor(name, initializer3, params) {
|
|
|
28
28
|
}
|
|
29
29
|
inst._zod.traits.add(name);
|
|
30
30
|
initializer3(inst, def);
|
|
31
|
-
const proto =
|
|
31
|
+
const proto = _3.prototype;
|
|
32
32
|
const keys = Object.keys(proto);
|
|
33
33
|
for (let i2 = 0; i2 < keys.length; i2++) {
|
|
34
34
|
const k2 = keys[i2];
|
|
@@ -41,7 +41,7 @@ function $constructor(name, initializer3, params) {
|
|
|
41
41
|
class Definition extends Parent {
|
|
42
42
|
}
|
|
43
43
|
Object.defineProperty(Definition, "name", { value: name });
|
|
44
|
-
function
|
|
44
|
+
function _3(def) {
|
|
45
45
|
var _a2;
|
|
46
46
|
const inst = params?.Parent ? new Definition() : this;
|
|
47
47
|
init(inst, def);
|
|
@@ -51,16 +51,16 @@ function $constructor(name, initializer3, params) {
|
|
|
51
51
|
}
|
|
52
52
|
return inst;
|
|
53
53
|
}
|
|
54
|
-
Object.defineProperty(
|
|
55
|
-
Object.defineProperty(
|
|
54
|
+
Object.defineProperty(_3, "init", { value: init });
|
|
55
|
+
Object.defineProperty(_3, Symbol.hasInstance, {
|
|
56
56
|
value: (inst) => {
|
|
57
57
|
if (params?.Parent && inst instanceof params.Parent)
|
|
58
58
|
return true;
|
|
59
59
|
return inst?._zod?.traits?.has(name);
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
Object.defineProperty(
|
|
63
|
-
return
|
|
62
|
+
Object.defineProperty(_3, "name", { value: name });
|
|
63
|
+
return _3;
|
|
64
64
|
}
|
|
65
65
|
function config(newConfig) {
|
|
66
66
|
if (newConfig)
|
|
@@ -167,17 +167,17 @@ function assertIs(_arg) {
|
|
|
167
167
|
function assertNever(_x) {
|
|
168
168
|
throw new Error("Unexpected value in exhaustive check");
|
|
169
169
|
}
|
|
170
|
-
function assert(
|
|
170
|
+
function assert(_3) {
|
|
171
171
|
}
|
|
172
172
|
function getEnumValues(entries) {
|
|
173
173
|
const numericValues = Object.values(entries).filter((v2) => typeof v2 === "number");
|
|
174
|
-
const values = Object.entries(entries).filter(([k2,
|
|
174
|
+
const values = Object.entries(entries).filter(([k2, _3]) => numericValues.indexOf(+k2) === -1).map(([_3, v2]) => v2);
|
|
175
175
|
return values;
|
|
176
176
|
}
|
|
177
177
|
function joinValues(array2, separator = "|") {
|
|
178
178
|
return array2.map((val) => stringifyPrimitive(val)).join(separator);
|
|
179
179
|
}
|
|
180
|
-
function jsonStringifyReplacer(
|
|
180
|
+
function jsonStringifyReplacer(_3, value) {
|
|
181
181
|
if (typeof value === "bigint")
|
|
182
182
|
return value.toString();
|
|
183
183
|
return value;
|
|
@@ -262,10 +262,10 @@ function mergeDefs(...defs) {
|
|
|
262
262
|
function cloneDef(schema) {
|
|
263
263
|
return mergeDefs(schema._zod.def);
|
|
264
264
|
}
|
|
265
|
-
function getElementAtPath(obj,
|
|
266
|
-
if (!
|
|
265
|
+
function getElementAtPath(obj, path18) {
|
|
266
|
+
if (!path18)
|
|
267
267
|
return obj;
|
|
268
|
-
return
|
|
268
|
+
return path18.reduce((acc, key) => acc?.[key], obj);
|
|
269
269
|
}
|
|
270
270
|
function promiseAllObject(promisesObj) {
|
|
271
271
|
const keys = Object.keys(promisesObj);
|
|
@@ -355,31 +355,31 @@ function normalizeParams(_params) {
|
|
|
355
355
|
function createTransparentProxy(getter) {
|
|
356
356
|
let target;
|
|
357
357
|
return new Proxy({}, {
|
|
358
|
-
get(
|
|
358
|
+
get(_3, prop, receiver) {
|
|
359
359
|
target ?? (target = getter());
|
|
360
360
|
return Reflect.get(target, prop, receiver);
|
|
361
361
|
},
|
|
362
|
-
set(
|
|
362
|
+
set(_3, prop, value, receiver) {
|
|
363
363
|
target ?? (target = getter());
|
|
364
364
|
return Reflect.set(target, prop, value, receiver);
|
|
365
365
|
},
|
|
366
|
-
has(
|
|
366
|
+
has(_3, prop) {
|
|
367
367
|
target ?? (target = getter());
|
|
368
368
|
return Reflect.has(target, prop);
|
|
369
369
|
},
|
|
370
|
-
deleteProperty(
|
|
370
|
+
deleteProperty(_3, prop) {
|
|
371
371
|
target ?? (target = getter());
|
|
372
372
|
return Reflect.deleteProperty(target, prop);
|
|
373
373
|
},
|
|
374
|
-
ownKeys(
|
|
374
|
+
ownKeys(_3) {
|
|
375
375
|
target ?? (target = getter());
|
|
376
376
|
return Reflect.ownKeys(target);
|
|
377
377
|
},
|
|
378
|
-
getOwnPropertyDescriptor(
|
|
378
|
+
getOwnPropertyDescriptor(_3, prop) {
|
|
379
379
|
target ?? (target = getter());
|
|
380
380
|
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
381
381
|
},
|
|
382
|
-
defineProperty(
|
|
382
|
+
defineProperty(_3, prop, descriptor) {
|
|
383
383
|
target ?? (target = getter());
|
|
384
384
|
return Reflect.defineProperty(target, prop, descriptor);
|
|
385
385
|
}
|
|
@@ -577,11 +577,11 @@ function aborted(x3, startIndex = 0) {
|
|
|
577
577
|
}
|
|
578
578
|
return false;
|
|
579
579
|
}
|
|
580
|
-
function prefixIssues(
|
|
580
|
+
function prefixIssues(path18, issues) {
|
|
581
581
|
return issues.map((iss) => {
|
|
582
582
|
var _a2;
|
|
583
583
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
584
|
-
iss.path.unshift(
|
|
584
|
+
iss.path.unshift(path18);
|
|
585
585
|
return iss;
|
|
586
586
|
});
|
|
587
587
|
}
|
|
@@ -651,7 +651,7 @@ function issue(...args) {
|
|
|
651
651
|
return { ...iss };
|
|
652
652
|
}
|
|
653
653
|
function cleanEnum(obj) {
|
|
654
|
-
return Object.entries(obj).filter(([k2,
|
|
654
|
+
return Object.entries(obj).filter(([k2, _3]) => {
|
|
655
655
|
return Number.isNaN(Number.parseInt(k2, 10));
|
|
656
656
|
}).map((el) => el[1]);
|
|
657
657
|
}
|
|
@@ -707,7 +707,7 @@ var init_util = __esm({
|
|
|
707
707
|
const F3 = Function;
|
|
708
708
|
new F3("");
|
|
709
709
|
return true;
|
|
710
|
-
} catch (
|
|
710
|
+
} catch (_3) {
|
|
711
711
|
return false;
|
|
712
712
|
}
|
|
713
713
|
});
|
|
@@ -824,7 +824,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
|
|
|
824
824
|
}
|
|
825
825
|
function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
826
826
|
const result = { errors: [] };
|
|
827
|
-
const processError = (error49,
|
|
827
|
+
const processError = (error49, path18 = []) => {
|
|
828
828
|
var _a2, _b;
|
|
829
829
|
for (const issue2 of error49.issues) {
|
|
830
830
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -834,7 +834,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
834
834
|
} else if (issue2.code === "invalid_element") {
|
|
835
835
|
processError({ issues: issue2.issues }, issue2.path);
|
|
836
836
|
} else {
|
|
837
|
-
const fullpath = [...
|
|
837
|
+
const fullpath = [...path18, ...issue2.path];
|
|
838
838
|
if (fullpath.length === 0) {
|
|
839
839
|
result.errors.push(mapper(issue2));
|
|
840
840
|
continue;
|
|
@@ -866,8 +866,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
866
866
|
}
|
|
867
867
|
function toDotPath(_path) {
|
|
868
868
|
const segs = [];
|
|
869
|
-
const
|
|
870
|
-
for (const seg of
|
|
869
|
+
const path18 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
870
|
+
for (const seg of path18) {
|
|
871
871
|
if (typeof seg === "number")
|
|
872
872
|
segs.push(`[${seg}]`);
|
|
873
873
|
else if (typeof seg === "symbol")
|
|
@@ -2195,13 +2195,13 @@ var init_schemas = __esm({
|
|
|
2195
2195
|
continue;
|
|
2196
2196
|
}
|
|
2197
2197
|
const currLen = payload.issues.length;
|
|
2198
|
-
const
|
|
2199
|
-
if (
|
|
2198
|
+
const _3 = ch._zod.check(payload);
|
|
2199
|
+
if (_3 instanceof Promise && ctx?.async === false) {
|
|
2200
2200
|
throw new $ZodAsyncError();
|
|
2201
2201
|
}
|
|
2202
|
-
if (asyncResult ||
|
|
2202
|
+
if (asyncResult || _3 instanceof Promise) {
|
|
2203
2203
|
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
2204
|
-
await
|
|
2204
|
+
await _3;
|
|
2205
2205
|
const nextLen = payload.issues.length;
|
|
2206
2206
|
if (nextLen === currLen)
|
|
2207
2207
|
return;
|
|
@@ -2263,7 +2263,7 @@ var init_schemas = __esm({
|
|
|
2263
2263
|
try {
|
|
2264
2264
|
const r2 = safeParse(inst, value);
|
|
2265
2265
|
return r2.success ? { value: r2.data } : { issues: r2.error?.issues };
|
|
2266
|
-
} catch (
|
|
2266
|
+
} catch (_3) {
|
|
2267
2267
|
return safeParseAsync(inst, value).then((r2) => r2.success ? { value: r2.data } : { issues: r2.error?.issues });
|
|
2268
2268
|
}
|
|
2269
2269
|
},
|
|
@@ -2274,11 +2274,11 @@ var init_schemas = __esm({
|
|
|
2274
2274
|
$ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
2275
2275
|
$ZodType.init(inst, def);
|
|
2276
2276
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
|
|
2277
|
-
inst._zod.parse = (payload,
|
|
2277
|
+
inst._zod.parse = (payload, _3) => {
|
|
2278
2278
|
if (def.coerce)
|
|
2279
2279
|
try {
|
|
2280
2280
|
payload.value = String(payload.value);
|
|
2281
|
-
} catch (
|
|
2281
|
+
} catch (_4) {
|
|
2282
2282
|
}
|
|
2283
2283
|
if (typeof payload.value === "string")
|
|
2284
2284
|
return payload;
|
|
@@ -2363,7 +2363,7 @@ var init_schemas = __esm({
|
|
|
2363
2363
|
payload.value = trimmed;
|
|
2364
2364
|
}
|
|
2365
2365
|
return;
|
|
2366
|
-
} catch (
|
|
2366
|
+
} catch (_3) {
|
|
2367
2367
|
payload.issues.push({
|
|
2368
2368
|
code: "invalid_format",
|
|
2369
2369
|
format: "url",
|
|
@@ -2549,7 +2549,7 @@ var init_schemas = __esm({
|
|
|
2549
2549
|
if (def.coerce)
|
|
2550
2550
|
try {
|
|
2551
2551
|
payload.value = Number(payload.value);
|
|
2552
|
-
} catch (
|
|
2552
|
+
} catch (_3) {
|
|
2553
2553
|
}
|
|
2554
2554
|
const input = payload.value;
|
|
2555
2555
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
|
|
@@ -2577,7 +2577,7 @@ var init_schemas = __esm({
|
|
|
2577
2577
|
if (def.coerce)
|
|
2578
2578
|
try {
|
|
2579
2579
|
payload.value = Boolean(payload.value);
|
|
2580
|
-
} catch (
|
|
2580
|
+
} catch (_3) {
|
|
2581
2581
|
}
|
|
2582
2582
|
const input = payload.value;
|
|
2583
2583
|
if (typeof input === "boolean")
|
|
@@ -2598,7 +2598,7 @@ var init_schemas = __esm({
|
|
|
2598
2598
|
if (def.coerce)
|
|
2599
2599
|
try {
|
|
2600
2600
|
payload.value = BigInt(payload.value);
|
|
2601
|
-
} catch (
|
|
2601
|
+
} catch (_3) {
|
|
2602
2602
|
}
|
|
2603
2603
|
if (typeof payload.value === "bigint")
|
|
2604
2604
|
return payload;
|
|
@@ -3761,7 +3761,7 @@ var init_schemas = __esm({
|
|
|
3761
3761
|
$ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
3762
3762
|
$ZodCheck.init(inst, def);
|
|
3763
3763
|
$ZodType.init(inst, def);
|
|
3764
|
-
inst._zod.parse = (payload,
|
|
3764
|
+
inst._zod.parse = (payload, _3) => {
|
|
3765
3765
|
return payload;
|
|
3766
3766
|
};
|
|
3767
3767
|
inst._zod.check = (payload) => {
|
|
@@ -11219,7 +11219,7 @@ function toJSONSchema(input, params) {
|
|
|
11219
11219
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
11220
11220
|
const defs = {};
|
|
11221
11221
|
for (const entry of registry2._idmap.entries()) {
|
|
11222
|
-
const [
|
|
11222
|
+
const [_3, schema] = entry;
|
|
11223
11223
|
process2(schema, ctx2);
|
|
11224
11224
|
}
|
|
11225
11225
|
const schemas = {};
|
|
@@ -11847,7 +11847,7 @@ var init_json_schema_generator = __esm({
|
|
|
11847
11847
|
}
|
|
11848
11848
|
extractDefs(this.ctx, schema);
|
|
11849
11849
|
const result = finalize(this.ctx, schema);
|
|
11850
|
-
const { "~standard":
|
|
11850
|
+
const { "~standard": _3, ...plainResult } = result;
|
|
11851
11851
|
return plainResult;
|
|
11852
11852
|
}
|
|
11853
11853
|
};
|
|
@@ -13631,13 +13631,13 @@ function resolveRef(ref, ctx) {
|
|
|
13631
13631
|
if (!ref.startsWith("#")) {
|
|
13632
13632
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
13633
13633
|
}
|
|
13634
|
-
const
|
|
13635
|
-
if (
|
|
13634
|
+
const path18 = ref.slice(1).split("/").filter(Boolean);
|
|
13635
|
+
if (path18.length === 0) {
|
|
13636
13636
|
return ctx.rootSchema;
|
|
13637
13637
|
}
|
|
13638
13638
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
13639
|
-
if (
|
|
13640
|
-
const key =
|
|
13639
|
+
if (path18[0] === defsKey) {
|
|
13640
|
+
const key = path18[1];
|
|
13641
13641
|
if (!key || !ctx.defs[key]) {
|
|
13642
13642
|
throw new Error(`Reference not found: ${ref}`);
|
|
13643
13643
|
}
|
|
@@ -14420,7 +14420,7 @@ function N(e3) {
|
|
|
14420
14420
|
const t2 = {};
|
|
14421
14421
|
void 0 === e4.tagging && void 0 === n5.tagging || (t2.tagging = n5.tagging ?? e4.tagging);
|
|
14422
14422
|
void 0 === e4.description && void 0 === n5.description || (t2.description = n5.description ?? e4.description);
|
|
14423
|
-
for (const i3 of
|
|
14423
|
+
for (const i3 of $) {
|
|
14424
14424
|
const o3 = e4[i3], r3 = n5[i3];
|
|
14425
14425
|
o3 && r3 ? t2[i3] = A(o3, r3) : (o3 || r3) && (t2[i3] = { ...o3 || r3 });
|
|
14426
14426
|
}
|
|
@@ -14461,7 +14461,7 @@ function N(e3) {
|
|
|
14461
14461
|
const e4 = {};
|
|
14462
14462
|
for (const [n5, t2] of Object.entries(s2.events)) {
|
|
14463
14463
|
e4[n5] = {};
|
|
14464
|
-
for (const [i3, o3] of Object.entries(t2)) e4[n5][i3] =
|
|
14464
|
+
for (const [i3, o3] of Object.entries(t2)) e4[n5][i3] = R(o3);
|
|
14465
14465
|
}
|
|
14466
14466
|
s2.events = e4;
|
|
14467
14467
|
}
|
|
@@ -14474,16 +14474,16 @@ function A(e3, n4) {
|
|
|
14474
14474
|
const t = { ...e3 };
|
|
14475
14475
|
for (const i2 of Object.keys(n4)) {
|
|
14476
14476
|
const o2 = e3[i2], r2 = n4[i2];
|
|
14477
|
-
"required" === i2 && Array.isArray(o2) && Array.isArray(r2) ? t[i2] = [.../* @__PURE__ */ new Set([...o2, ...r2])] :
|
|
14477
|
+
"required" === i2 && Array.isArray(o2) && Array.isArray(r2) ? t[i2] = [.../* @__PURE__ */ new Set([...o2, ...r2])] : D(o2) && D(r2) ? t[i2] = A(o2, r2) : t[i2] = r2;
|
|
14478
14478
|
}
|
|
14479
14479
|
return t;
|
|
14480
14480
|
}
|
|
14481
|
-
function
|
|
14481
|
+
function R(e3) {
|
|
14482
14482
|
const n4 = {};
|
|
14483
|
-
for (const [t, i2] of Object.entries(e3))
|
|
14483
|
+
for (const [t, i2] of Object.entries(e3)) P.has(t) || (null === i2 || "object" != typeof i2 || Array.isArray(i2) ? n4[t] = i2 : n4[t] = R(i2));
|
|
14484
14484
|
return n4;
|
|
14485
14485
|
}
|
|
14486
|
-
function
|
|
14486
|
+
function D(e3) {
|
|
14487
14487
|
return "object" == typeof e3 && null !== e3 && !Array.isArray(e3);
|
|
14488
14488
|
}
|
|
14489
14489
|
function I(...e3) {
|
|
@@ -14496,7 +14496,7 @@ function z2(...e3) {
|
|
|
14496
14496
|
for (const t of e3) t && Object.assign(n4, t);
|
|
14497
14497
|
return n4;
|
|
14498
14498
|
}
|
|
14499
|
-
function
|
|
14499
|
+
function _(e3, n4, t) {
|
|
14500
14500
|
const i2 = n4.split(".");
|
|
14501
14501
|
let o2 = e3;
|
|
14502
14502
|
for (let e4 = 0; e4 < i2.length; e4++) {
|
|
@@ -14514,21 +14514,21 @@ function T(e3, n4, t) {
|
|
|
14514
14514
|
}
|
|
14515
14515
|
return o2;
|
|
14516
14516
|
}
|
|
14517
|
-
function
|
|
14517
|
+
function T(e3, n4, t, i2, o2) {
|
|
14518
14518
|
if ("string" == typeof e3) {
|
|
14519
14519
|
const r2 = e3.match(/^\$def\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.(.+))?$/);
|
|
14520
14520
|
if (r2) {
|
|
14521
14521
|
const e4 = r2[1], s3 = r2[2];
|
|
14522
14522
|
void 0 === t[e4] && C(`Definition "${e4}" not found`);
|
|
14523
|
-
let a3 =
|
|
14524
|
-
return s3 && (a3 =
|
|
14523
|
+
let a3 = T(t[e4], n4, t, i2, o2);
|
|
14524
|
+
return s3 && (a3 = _(a3, s3, `$def.${e4}`)), a3;
|
|
14525
14525
|
}
|
|
14526
14526
|
const s2 = e3.match(/^\$contract\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.(.+))?$/);
|
|
14527
14527
|
if (s2 && o2) {
|
|
14528
14528
|
const e4 = s2[1], n5 = s2[2];
|
|
14529
14529
|
e4 in o2 || C(`Contract "${e4}" not found`);
|
|
14530
14530
|
let t2 = o2[e4];
|
|
14531
|
-
return n5 && (t2 =
|
|
14531
|
+
return n5 && (t2 = _(t2, n5, `$contract.${e4}`)), t2;
|
|
14532
14532
|
}
|
|
14533
14533
|
let a2 = e3.replace(/\$var\.([a-zA-Z_][a-zA-Z0-9_]*)/g, (e4, t2) => {
|
|
14534
14534
|
if (void 0 !== n4[t2]) return String(n4[t2]);
|
|
@@ -14536,24 +14536,24 @@ function q(e3, n4, t, i2, o2) {
|
|
|
14536
14536
|
});
|
|
14537
14537
|
return a2 = a2.replace(/\$env\.([a-zA-Z_][a-zA-Z0-9_]*)(?::([^"}\s]*))?/g, (e4, n5, t2) => i2?.deferred ? void 0 !== t2 ? `${M}${n5}:${t2}` : `${M}${n5}` : "undefined" != typeof process && void 0 !== process.env?.[n5] ? process.env[n5] : void 0 !== t2 ? t2 : void C(`Environment variable "${n5}" not found and no default provided`)), a2;
|
|
14538
14538
|
}
|
|
14539
|
-
if (Array.isArray(e3)) return e3.map((e4) =>
|
|
14539
|
+
if (Array.isArray(e3)) return e3.map((e4) => T(e4, n4, t, i2, o2));
|
|
14540
14540
|
if (null !== e3 && "object" == typeof e3) {
|
|
14541
14541
|
const r2 = {};
|
|
14542
|
-
for (const [s2, a2] of Object.entries(e3)) r2[s2] =
|
|
14542
|
+
for (const [s2, a2] of Object.entries(e3)) r2[s2] = T(a2, n4, t, i2, o2);
|
|
14543
14543
|
return r2;
|
|
14544
14544
|
}
|
|
14545
14545
|
return e3;
|
|
14546
14546
|
}
|
|
14547
|
-
function
|
|
14547
|
+
function q(e3) {
|
|
14548
14548
|
const n4 = e3.startsWith("@"), t = e3.replace("@", "").replace(/[/-]/g, "_").split("_").filter((e4) => e4.length > 0).map((e4, n5) => 0 === n5 ? e4 : e4.charAt(0).toUpperCase() + e4.slice(1)).join("");
|
|
14549
14549
|
return n4 ? "_" + t : t;
|
|
14550
14550
|
}
|
|
14551
|
-
function
|
|
14551
|
+
function L(e3, n4, t) {
|
|
14552
14552
|
if (n4) return n4;
|
|
14553
14553
|
if (!e3 || !t) return;
|
|
14554
|
-
return t[e3] ?
|
|
14554
|
+
return t[e3] ? q(e3) : void 0;
|
|
14555
14555
|
}
|
|
14556
|
-
function
|
|
14556
|
+
function U(e3, n4, t) {
|
|
14557
14557
|
const i2 = Object.keys(e3.flows);
|
|
14558
14558
|
n4 || (1 === i2.length ? n4 = i2[0] : C(`Multiple flows found (${i2.join(", ")}). Please specify a flow.`));
|
|
14559
14559
|
const o2 = e3.flows[n4];
|
|
@@ -14562,37 +14562,37 @@ function W(e3, n4, t) {
|
|
|
14562
14562
|
let s2;
|
|
14563
14563
|
if (e3.contract) {
|
|
14564
14564
|
const n5 = I(e3.variables, o2.variables), i3 = z2(e3.definitions, o2.definitions);
|
|
14565
|
-
s2 = N(
|
|
14565
|
+
s2 = N(T(e3.contract, n5, i3, t));
|
|
14566
14566
|
}
|
|
14567
14567
|
if (r2.sources) for (const [n5, i3] of Object.entries(r2.sources)) {
|
|
14568
|
-
const a2 = I(e3.variables, o2.variables, i3.variables), c2 = z2(e3.definitions, o2.definitions, i3.definitions), l3 =
|
|
14568
|
+
const a2 = I(e3.variables, o2.variables, i3.variables), c2 = z2(e3.definitions, o2.definitions, i3.definitions), l3 = T(i3.config, a2, c2, t, s2), d3 = T(i3.env, a2, c2, t, s2), p2 = L(i3.package, i3.code, r2.bundle?.packages), u3 = "string" == typeof i3.code || "object" == typeof i3.code ? i3.code : void 0, f2 = p2 || u3;
|
|
14569
14569
|
r2.sources[n5] = { package: i3.package, config: l3, env: d3, primary: i3.primary, variables: i3.variables, definitions: i3.definitions, before: i3.before, next: i3.next, cache: i3.cache, code: f2 };
|
|
14570
14570
|
}
|
|
14571
14571
|
if (r2.destinations) for (const [n5, i3] of Object.entries(r2.destinations)) {
|
|
14572
|
-
const a2 = I(e3.variables, o2.variables, i3.variables), c2 = z2(e3.definitions, o2.definitions, i3.definitions), l3 =
|
|
14572
|
+
const a2 = I(e3.variables, o2.variables, i3.variables), c2 = z2(e3.definitions, o2.definitions, i3.definitions), l3 = T(i3.config, a2, c2, t, s2), d3 = T(i3.env, a2, c2, t, s2), p2 = L(i3.package, i3.code, r2.bundle?.packages), u3 = "string" == typeof i3.code || "object" == typeof i3.code ? i3.code : void 0, f2 = p2 || u3;
|
|
14573
14573
|
r2.destinations[n5] = { package: i3.package, config: l3, env: d3, variables: i3.variables, definitions: i3.definitions, before: i3.before, next: i3.next, cache: i3.cache, code: f2 };
|
|
14574
14574
|
}
|
|
14575
14575
|
if (r2.stores) for (const [n5, i3] of Object.entries(r2.stores)) {
|
|
14576
|
-
const a2 = I(e3.variables, o2.variables, i3.variables), c2 = z2(e3.definitions, o2.definitions, i3.definitions), l3 =
|
|
14576
|
+
const a2 = I(e3.variables, o2.variables, i3.variables), c2 = z2(e3.definitions, o2.definitions, i3.definitions), l3 = T(i3.config, a2, c2, t, s2), d3 = T(i3.env, a2, c2, t, s2), p2 = L(i3.package, i3.code, r2.bundle?.packages), u3 = "string" == typeof i3.code || "object" == typeof i3.code ? i3.code : void 0, f2 = p2 || u3;
|
|
14577
14577
|
r2.stores[n5] = { package: i3.package, config: l3, env: d3, variables: i3.variables, definitions: i3.definitions, code: f2 };
|
|
14578
14578
|
}
|
|
14579
14579
|
if (r2.transformers) for (const [n5, i3] of Object.entries(r2.transformers)) {
|
|
14580
|
-
const a2 = I(e3.variables, o2.variables, i3.variables), c2 = z2(e3.definitions, o2.definitions, i3.definitions), l3 =
|
|
14580
|
+
const a2 = I(e3.variables, o2.variables, i3.variables), c2 = z2(e3.definitions, o2.definitions, i3.definitions), l3 = T(i3.config, a2, c2, t, s2), d3 = T(i3.env, a2, c2, t, s2), p2 = L(i3.package, i3.code, r2.bundle?.packages), u3 = "string" == typeof i3.code || "object" == typeof i3.code ? i3.code : void 0, f2 = p2 || u3;
|
|
14581
14581
|
r2.transformers[n5] = { package: i3.package, config: l3, env: d3, variables: i3.variables, definitions: i3.definitions, before: i3.before, next: i3.next, cache: i3.cache, code: f2 };
|
|
14582
14582
|
}
|
|
14583
14583
|
if (r2.collector) {
|
|
14584
|
-
const n5 = I(e3.variables, o2.variables), i3 = z2(e3.definitions, o2.definitions), a2 =
|
|
14584
|
+
const n5 = I(e3.variables, o2.variables), i3 = z2(e3.definitions, o2.definitions), a2 = T(r2.collector, n5, i3, t, s2);
|
|
14585
14585
|
r2.collector = a2;
|
|
14586
14586
|
}
|
|
14587
14587
|
return r2;
|
|
14588
14588
|
}
|
|
14589
|
-
function
|
|
14589
|
+
function J(e3) {
|
|
14590
14590
|
return void 0 !== e3.web ? "web" : void 0 !== e3.server ? "server" : void C("Settings must have web or server key");
|
|
14591
14591
|
}
|
|
14592
14592
|
function F(e3) {
|
|
14593
14593
|
return Array.isArray(e3);
|
|
14594
14594
|
}
|
|
14595
|
-
function
|
|
14595
|
+
function K(e3) {
|
|
14596
14596
|
return void 0 !== e3;
|
|
14597
14597
|
}
|
|
14598
14598
|
function Y(e3) {
|
|
@@ -14613,35 +14613,38 @@ function ie(e3, n4 = "", t) {
|
|
|
14613
14613
|
}
|
|
14614
14614
|
if (o2 = o2 instanceof Object ? o2[n5] : void 0, void 0 === o2) break;
|
|
14615
14615
|
}
|
|
14616
|
-
return
|
|
14616
|
+
return K(o2) ? o2 : t;
|
|
14617
|
+
}
|
|
14618
|
+
function ge(e3, n4, t = "draft-7") {
|
|
14619
|
+
return external_exports.toJSONSchema(e3, { target: t });
|
|
14617
14620
|
}
|
|
14618
|
-
function
|
|
14621
|
+
function ke(e3) {
|
|
14619
14622
|
return { message: e3.message, name: e3.name, stack: e3.stack, cause: e3.cause };
|
|
14620
14623
|
}
|
|
14621
|
-
function
|
|
14624
|
+
function je(e3, n4) {
|
|
14622
14625
|
let t, i2 = {};
|
|
14623
|
-
return e3 instanceof Error ? (t = e3.message, i2.error =
|
|
14626
|
+
return e3 instanceof Error ? (t = e3.message, i2.error = ke(e3)) : t = e3, void 0 !== n4 && (n4 instanceof Error ? i2.error = ke(n4) : "object" == typeof n4 && null !== n4 ? (i2 = { ...i2, ...n4 }, "error" in i2 && i2.error instanceof Error && (i2.error = ke(i2.error))) : i2.value = n4), { message: t, context: i2 };
|
|
14624
14627
|
}
|
|
14625
|
-
function
|
|
14626
|
-
return
|
|
14628
|
+
function xe(e3 = {}) {
|
|
14629
|
+
return Ee({ level: void 0 !== e3.level ? (function(e4) {
|
|
14627
14630
|
return "string" == typeof e4 ? d[e4] : e4;
|
|
14628
14631
|
})(e3.level) : 0, handler: e3.handler, jsonHandler: e3.jsonHandler, scope: [] });
|
|
14629
14632
|
}
|
|
14630
|
-
function
|
|
14633
|
+
function Ee(e3) {
|
|
14631
14634
|
const { level: n4, handler: t, jsonHandler: i2, scope: o2 } = e3, r2 = (e4, i3, r3) => {
|
|
14632
14635
|
if (e4 <= n4) {
|
|
14633
|
-
const n5 =
|
|
14634
|
-
t ? t(e4, n5.message, n5.context, o2,
|
|
14636
|
+
const n5 = je(i3, r3);
|
|
14637
|
+
t ? t(e4, n5.message, n5.context, o2, Se) : Se(e4, n5.message, n5.context, o2);
|
|
14635
14638
|
}
|
|
14636
14639
|
};
|
|
14637
14640
|
return { error: (e4, n5) => r2(0, e4, n5), warn: (e4, n5) => r2(1, e4, n5), info: (e4, n5) => r2(2, e4, n5), debug: (e4, n5) => r2(3, e4, n5), throw: (e4, n5) => {
|
|
14638
|
-
const i3 =
|
|
14639
|
-
throw t ? t(0, i3.message, i3.context, o2,
|
|
14641
|
+
const i3 = je(e4, n5);
|
|
14642
|
+
throw t ? t(0, i3.message, i3.context, o2, Se) : Se(0, i3.message, i3.context, o2), new Error(i3.message);
|
|
14640
14643
|
}, json: (e4) => {
|
|
14641
14644
|
i2 ? i2(e4) : console.log(JSON.stringify(e4, null, 2));
|
|
14642
|
-
}, scope: (e4) =>
|
|
14645
|
+
}, scope: (e4) => Ee({ level: n4, handler: t, jsonHandler: i2, scope: [...o2, e4] }) };
|
|
14643
14646
|
}
|
|
14644
|
-
function
|
|
14647
|
+
function Ne(e3, n4, t) {
|
|
14645
14648
|
return async function(...i2) {
|
|
14646
14649
|
try {
|
|
14647
14650
|
return await e3(...i2);
|
|
@@ -14653,26 +14656,26 @@ function xe(e3, n4, t) {
|
|
|
14653
14656
|
}
|
|
14654
14657
|
};
|
|
14655
14658
|
}
|
|
14656
|
-
function
|
|
14659
|
+
function Be(e3, n4, t) {
|
|
14657
14660
|
return function(...i2) {
|
|
14658
14661
|
let o2;
|
|
14659
14662
|
const r2 = "post" + n4, s2 = t["pre" + n4], a2 = t[r2];
|
|
14660
14663
|
return o2 = s2 ? s2({ fn: e3 }, ...i2) : e3(...i2), a2 && (o2 = a2({ fn: e3, result: o2 }, ...i2)), o2;
|
|
14661
14664
|
};
|
|
14662
14665
|
}
|
|
14663
|
-
function
|
|
14666
|
+
function nn(e3) {
|
|
14664
14667
|
return "string" == typeof e3 || Array.isArray(e3) && e3.every((e4) => "string" == typeof e4) ? e3 : void 0;
|
|
14665
14668
|
}
|
|
14666
|
-
async function
|
|
14669
|
+
async function tn(e3, n4) {
|
|
14667
14670
|
const t = n4?.version || "latest", i2 = n4?.timeout || 1e4, o2 = new AbortController(), r2 = setTimeout(() => o2.abort(), i2), s2 = o2.signal;
|
|
14668
14671
|
try {
|
|
14669
14672
|
let i3, o3;
|
|
14670
14673
|
if (n4?.baseUrl) {
|
|
14671
14674
|
const r3 = encodeURIComponent(e3), a2 = `${n4.baseUrl}/api/packages/${r3}`;
|
|
14672
|
-
i3 = await
|
|
14675
|
+
i3 = await on(`${a2}?version=${t}&path=package.json`, s2), o3 = await on(`${a2}?version=${t}&path=dist/walkerOS.json`, s2);
|
|
14673
14676
|
} else {
|
|
14674
14677
|
const n5 = `https://cdn.jsdelivr.net/npm/${e3}@${t}`;
|
|
14675
|
-
i3 = await
|
|
14678
|
+
i3 = await on(`${n5}/package.json`, s2), o3 = await on(`${n5}/dist/walkerOS.json`, s2);
|
|
14676
14679
|
}
|
|
14677
14680
|
return (function(e4, n5, t2, i4) {
|
|
14678
14681
|
const o4 = i4.$meta || {}, r3 = i4.schemas || {}, s3 = i4.examples || {}, a2 = i4.hints, c2 = a2 ? Object.keys(a2) : [], l3 = [], d3 = s3.step || {};
|
|
@@ -14680,30 +14683,30 @@ async function Ge(e3, n4) {
|
|
|
14680
14683
|
const t3 = n6, i5 = { name: e5 };
|
|
14681
14684
|
"string" == typeof t3?.description && (i5.description = t3.description), l3.push(i5);
|
|
14682
14685
|
}
|
|
14683
|
-
const
|
|
14684
|
-
return { packageName: e4, version: "string" == typeof t2.version ? t2.version : n5, description: "string" == typeof t2.description ? t2.description : void 0, type: "string" == typeof o4.type ? o4.type : void 0, platform:
|
|
14686
|
+
const p2 = "string" == typeof o4.docs ? o4.docs : void 0, u3 = "string" == typeof o4.source ? o4.source : void 0;
|
|
14687
|
+
return { packageName: e4, version: "string" == typeof t2.version ? t2.version : n5, description: "string" == typeof t2.description ? t2.description : void 0, type: "string" == typeof o4.type ? o4.type : void 0, platform: nn(o4.platform), schemas: r3, examples: s3, ...p2 ? { docs: p2 } : {}, ...u3 ? { source: u3 } : {}, ...a2 && Object.keys(a2).length > 0 ? { hints: a2 } : {}, hintKeys: c2, exampleSummaries: l3 };
|
|
14685
14688
|
})(e3, t, i3, o3);
|
|
14686
14689
|
} finally {
|
|
14687
14690
|
clearTimeout(r2);
|
|
14688
14691
|
}
|
|
14689
14692
|
}
|
|
14690
|
-
async function
|
|
14693
|
+
async function on(e3, n4) {
|
|
14691
14694
|
const t = await fetch(e3, { signal: n4 });
|
|
14692
14695
|
if (!t.ok) throw new Error(`Failed to fetch ${e3} (HTTP ${t.status})`);
|
|
14693
14696
|
return await t.json();
|
|
14694
14697
|
}
|
|
14695
|
-
async function
|
|
14696
|
-
const t = await
|
|
14698
|
+
async function rn(e3, n4) {
|
|
14699
|
+
const t = await tn(e3, n4);
|
|
14697
14700
|
return { packageName: t.packageName, version: t.version, type: t.type, platform: t.platform, schemas: t.schemas, examples: t.examples, ...t.hints ? { hints: t.hints } : {} };
|
|
14698
14701
|
}
|
|
14699
|
-
function
|
|
14702
|
+
function ln(e3) {
|
|
14700
14703
|
if ("*" === e3) return () => true;
|
|
14701
14704
|
if ("and" in e3) {
|
|
14702
|
-
const n4 = e3.and.map(
|
|
14705
|
+
const n4 = e3.and.map(ln);
|
|
14703
14706
|
return (e4) => n4.every((n5) => n5(e4));
|
|
14704
14707
|
}
|
|
14705
14708
|
if ("or" in e3) {
|
|
14706
|
-
const n4 = e3.or.map(
|
|
14709
|
+
const n4 = e3.or.map(ln);
|
|
14707
14710
|
return (e4) => n4.some((n5) => n5(e4));
|
|
14708
14711
|
}
|
|
14709
14712
|
return (function(e4) {
|
|
@@ -14739,39 +14742,36 @@ function tn(e3) {
|
|
|
14739
14742
|
};
|
|
14740
14743
|
})(e3);
|
|
14741
14744
|
}
|
|
14742
|
-
function
|
|
14745
|
+
function dn(e3) {
|
|
14743
14746
|
return Array.isArray(e3) && e3.length > 0 && "object" == typeof e3[0] && null !== e3[0] && "match" in e3[0];
|
|
14744
14747
|
}
|
|
14745
|
-
function
|
|
14748
|
+
function pn(e3) {
|
|
14746
14749
|
if (null != e3) {
|
|
14747
14750
|
if ("string" == typeof e3) return { type: "static", value: e3 };
|
|
14748
14751
|
if (Array.isArray(e3)) {
|
|
14749
14752
|
if (0 === e3.length) return;
|
|
14750
|
-
if (
|
|
14751
|
-
return { type: "routes", routes: e3.map((e4) => ({ match:
|
|
14753
|
+
if (dn(e3)) {
|
|
14754
|
+
return { type: "routes", routes: e3.map((e4) => ({ match: ln(e4.match), next: pn(e4.next) })) };
|
|
14752
14755
|
}
|
|
14753
14756
|
return { type: "chain", value: e3 };
|
|
14754
14757
|
}
|
|
14755
14758
|
}
|
|
14756
14759
|
}
|
|
14757
|
-
function
|
|
14760
|
+
function un(e3, n4 = {}) {
|
|
14758
14761
|
if (e3) {
|
|
14759
14762
|
if ("static" === e3.type) return e3.value;
|
|
14760
14763
|
if ("chain" === e3.type) return e3.value;
|
|
14761
|
-
for (const t of e3.routes) if (t.match(n4)) return
|
|
14764
|
+
for (const t of e3.routes) if (t.match(n4)) return un(t.next, n4);
|
|
14762
14765
|
}
|
|
14763
14766
|
}
|
|
14764
|
-
function
|
|
14765
|
-
return external_exports.toJSONSchema(e3, { target: t });
|
|
14766
|
-
}
|
|
14767
|
-
function vi(e3, n4) {
|
|
14767
|
+
function Ei(e3, n4) {
|
|
14768
14768
|
const t = { ingest: e3 ?? {} };
|
|
14769
14769
|
return void 0 !== n4 && (t.event = n4), t;
|
|
14770
14770
|
}
|
|
14771
|
-
function
|
|
14772
|
-
return { full: e3.full ?? false, storeId: e3.store, rules: e3.rules.map((e4) => ({ match:
|
|
14771
|
+
function Oi(e3) {
|
|
14772
|
+
return { full: e3.full ?? false, storeId: e3.store, rules: e3.rules.map((e4) => ({ match: ln(e4.match), key: e4.key, ttl: e4.ttl, update: e4.update })) };
|
|
14773
14773
|
}
|
|
14774
|
-
function
|
|
14774
|
+
function Ci(e3, n4, t, i2) {
|
|
14775
14775
|
const o2 = e3.rules.find((e4) => e4.match(t));
|
|
14776
14776
|
if (!o2) return null;
|
|
14777
14777
|
const r2 = o2.key.map((e4) => String(ie(t, e4) ?? ""));
|
|
@@ -14779,10 +14779,10 @@ function wi(e3, n4, t, i2) {
|
|
|
14779
14779
|
const s2 = `${i2}:${r2.join(":")}`, a2 = n4.get(s2);
|
|
14780
14780
|
return void 0 !== a2 ? { status: "HIT", key: s2, value: a2, rule: o2 } : { status: "MISS", key: s2, rule: o2 };
|
|
14781
14781
|
}
|
|
14782
|
-
function
|
|
14782
|
+
function $i(e3, n4, t, i2) {
|
|
14783
14783
|
e3.set(n4, t, 1e3 * i2);
|
|
14784
14784
|
}
|
|
14785
|
-
var e, n, l, d, P,
|
|
14785
|
+
var e, n, l, d, $, P, M, me, Se, fn, bn, gn, mn, hn, vn, yn, wn, kn, jn, Sn, xn, En, On, Cn, $n, Pn, Nn, An, Rn, Dn, In, zn, Mn, _n, Tn, qn, Ln, Un, Jn, Wn, Bn, Hn, Fn, Vn, Gn, Kn, Zn, Qn, Xn, Yn, et, nt, tt, it, ot, rt, st, at, ct, lt, dt, pt, ut, ft, bt, gt, mt, ht, vt, yt, wt, kt, jt, St, xt, Et, Ot, Ct, $t, Pt, Nt, At, Rt, Dt, It, zt, Mt, _t, Tt, qt, Lt, Ut, Jt, Wt, Bt, Ht, Ft, Vt, Gt, Kt, Zt, Qt, Xt, Yt, ei, ni, ti, ii, oi, ri, si, ai, ci, li, di, pi, ui, fi, bi, gi, mi, hi, yi, wi, ki, ji;
|
|
14786
14786
|
var init_dist = __esm({
|
|
14787
14787
|
"../core/dist/index.mjs"() {
|
|
14788
14788
|
"use strict";
|
|
@@ -14795,132 +14795,136 @@ var init_dist = __esm({
|
|
|
14795
14795
|
l = {};
|
|
14796
14796
|
n(l, { Level: () => d });
|
|
14797
14797
|
d = ((e3) => (e3[e3.ERROR = 0] = "ERROR", e3[e3.WARN = 1] = "WARN", e3[e3.INFO = 2] = "INFO", e3[e3.DEBUG = 3] = "DEBUG", e3))(d || {});
|
|
14798
|
-
|
|
14799
|
-
|
|
14798
|
+
$ = ["globals", "context", "custom", "user", "consent"];
|
|
14799
|
+
P = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
|
|
14800
14800
|
M = "__WALKEROS_ENV:";
|
|
14801
|
-
|
|
14801
|
+
me = external_exports.object({ param: external_exports.string().describe("Lowercase URL parameter name. Match is case-insensitive on lookup."), platform: external_exports.string().describe("Canonical platform identifier (lowercase, kebab-case).") });
|
|
14802
|
+
Se = (e3, n4, t, i2) => {
|
|
14802
14803
|
const o2 = `${d[e3]}${i2.length > 0 ? ` [${i2.join(":")}]` : ""}`, r2 = Object.keys(t).length > 0, s2 = 0 === e3 ? console.error : 1 === e3 ? console.warn : console.log;
|
|
14803
14804
|
r2 ? s2(o2, n4, t) : s2(o2, n4);
|
|
14804
14805
|
};
|
|
14805
|
-
|
|
14806
|
-
|
|
14807
|
-
|
|
14808
|
-
|
|
14809
|
-
|
|
14810
|
-
|
|
14811
|
-
|
|
14812
|
-
|
|
14813
|
-
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
|
|
14821
|
-
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14838
|
-
|
|
14839
|
-
|
|
14840
|
-
n(
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
14846
|
-
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
|
|
14850
|
-
|
|
14851
|
-
|
|
14852
|
-
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
14856
|
-
|
|
14857
|
-
|
|
14858
|
-
|
|
14859
|
-
|
|
14860
|
-
|
|
14861
|
-
|
|
14862
|
-
|
|
14863
|
-
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
|
|
14868
|
-
|
|
14869
|
-
|
|
14870
|
-
|
|
14871
|
-
|
|
14872
|
-
|
|
14873
|
-
|
|
14874
|
-
|
|
14875
|
-
n(
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14889
|
-
|
|
14890
|
-
|
|
14891
|
-
|
|
14892
|
-
|
|
14893
|
-
|
|
14894
|
-
|
|
14895
|
-
|
|
14896
|
-
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
|
|
14906
|
-
|
|
14907
|
-
|
|
14908
|
-
|
|
14909
|
-
|
|
14910
|
-
|
|
14911
|
-
|
|
14912
|
-
|
|
14913
|
-
|
|
14914
|
-
|
|
14806
|
+
bn = external_exports.string();
|
|
14807
|
+
gn = external_exports.number();
|
|
14808
|
+
mn = (external_exports.boolean(), external_exports.string().min(1));
|
|
14809
|
+
hn = external_exports.number().int().positive();
|
|
14810
|
+
vn = external_exports.number().int().nonnegative();
|
|
14811
|
+
yn = external_exports.number().describe("Tagging version number");
|
|
14812
|
+
wn = (external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]).optional(), external_exports.enum(["local", "session", "cookie"]).describe("Storage mechanism: local, session, or cookie"));
|
|
14813
|
+
kn = external_exports.object({ Local: external_exports.literal("local"), Session: external_exports.literal("session"), Cookie: external_exports.literal("cookie") }).describe("Storage type constants for type-safe references");
|
|
14814
|
+
jn = external_exports.any().describe("Error handler function: (error, state?) => void");
|
|
14815
|
+
Sn = external_exports.any().describe("Log handler function: (message, verbose?) => void");
|
|
14816
|
+
xn = external_exports.object({ Error: jn.describe("Error handler function"), Log: Sn.describe("Log handler function") }).describe("Handler interface with error and log functions");
|
|
14817
|
+
En = (ge(wn), ge(kn), ge(jn), ge(Sn), ge(xn), external_exports.object({ onError: jn.optional().describe("Error handler function: (error, state?) => void"), onLog: Sn.optional().describe("Log handler function: (message, verbose?) => void") }).partial(), external_exports.object({ verbose: external_exports.boolean().describe("Enable verbose logging for debugging").optional() }).partial(), external_exports.object({ queue: external_exports.boolean().describe("Whether to queue events when consent is not granted").optional() }).partial(), external_exports.object({}).partial(), external_exports.object({ init: external_exports.boolean().describe("Whether to initialize immediately").optional(), loadScript: external_exports.boolean().describe("Whether to load external script (for web destinations)").optional() }).partial(), external_exports.object({ primary: external_exports.boolean().describe("Mark as primary (only one can be primary)").optional() }).partial(), external_exports.object({ settings: external_exports.any().optional().describe("Implementation-specific configuration") }).partial(), external_exports.object({ env: external_exports.any().optional().describe("Environment dependencies (platform-specific)") }).partial(), external_exports.object({ type: external_exports.string().optional().describe("Instance type identifier"), config: external_exports.unknown().describe("Instance configuration") }).partial(), external_exports.object({ collector: external_exports.unknown().describe("Collector instance (runtime object)"), config: external_exports.unknown().describe("Configuration"), env: external_exports.unknown().describe("Environment dependencies") }).partial(), external_exports.object({ batch: external_exports.number().optional().describe("Batch size: bundle N events for batch processing"), batched: external_exports.unknown().optional().describe("Batch of events to be processed") }).partial(), external_exports.object({ ignore: external_exports.boolean().describe("Set to true to skip processing").optional(), condition: external_exports.string().optional().describe("Condition function: return true to process") }).partial(), external_exports.object({ sources: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of source instances") }).partial(), external_exports.object({ destinations: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of destination instances") }).partial(), external_exports.lazy(() => external_exports.union([external_exports.boolean(), external_exports.string(), external_exports.number(), external_exports.record(external_exports.string(), On)])));
|
|
14818
|
+
On = external_exports.lazy(() => external_exports.union([En, external_exports.array(En)]));
|
|
14819
|
+
Cn = external_exports.record(external_exports.string(), On.optional()).describe("Flexible property collection with optional values");
|
|
14820
|
+
$n = external_exports.record(external_exports.string(), external_exports.tuple([On, external_exports.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control");
|
|
14821
|
+
Pn = external_exports.union([external_exports.enum(["web", "server", "app", "other"]), external_exports.string()]).describe("Source type: web, server, app, other, or custom");
|
|
14822
|
+
Nn = external_exports.record(external_exports.string(), external_exports.boolean()).describe("Consent requirement mapping (group name \u2192 state)");
|
|
14823
|
+
An = Cn.and(external_exports.object({ id: external_exports.string().optional().describe("User identifier"), device: external_exports.string().optional().describe("Device identifier"), session: external_exports.string().optional().describe("Session identifier"), hash: external_exports.string().optional().describe("Hashed identifier"), address: external_exports.string().optional().describe("User address"), email: external_exports.string().email().optional().describe("User email address"), phone: external_exports.string().optional().describe("User phone number"), userAgent: external_exports.string().optional().describe("Browser user agent string"), browser: external_exports.string().optional().describe("Browser name"), browserVersion: external_exports.string().optional().describe("Browser version"), deviceType: external_exports.string().optional().describe("Device type (mobile, desktop, tablet)"), os: external_exports.string().optional().describe("Operating system"), osVersion: external_exports.string().optional().describe("Operating system version"), screenSize: external_exports.string().optional().describe("Screen dimensions"), language: external_exports.string().optional().describe("User language"), country: external_exports.string().optional().describe("User country"), region: external_exports.string().optional().describe("User region/state"), city: external_exports.string().optional().describe("User city"), zip: external_exports.string().optional().describe("User postal code"), timezone: external_exports.string().optional().describe("User timezone"), ip: external_exports.string().optional().describe("User IP address"), internal: external_exports.boolean().optional().describe("Internal user flag (employee, test user)") })).describe("User identification and properties");
|
|
14824
|
+
Rn = Cn.and(external_exports.object({ source: bn.describe('Walker implementation version (e.g., "2.0.0")'), tagging: yn })).describe("Walker version information");
|
|
14825
|
+
Dn = Cn.and(external_exports.object({ type: Pn.describe("Source type identifier"), id: bn.describe("Source identifier (typically URL on web)"), previous_id: bn.describe("Previous source identifier (typically referrer on web)") })).describe("Event source information");
|
|
14826
|
+
In = external_exports.lazy(() => external_exports.object({ entity: external_exports.string().describe("Entity name"), data: Cn.describe("Entity-specific properties"), nested: external_exports.array(In).describe("Nested child entities"), context: $n.describe("Entity context data") })).describe("Nested entity structure with recursive nesting support");
|
|
14827
|
+
zn = external_exports.array(In).describe("Array of nested entities");
|
|
14828
|
+
Mn = external_exports.object({ name: external_exports.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: Cn.describe("Event-specific properties"), context: $n.describe("Ordered context properties with priorities"), globals: Cn.describe("Global properties shared across events"), custom: Cn.describe("Custom implementation-specific properties"), user: An.describe("User identification and attributes"), nested: zn.describe("Related nested entities"), consent: Nn.describe("Consent states at event time"), id: mn.describe("Unique event identifier (timestamp-based)"), trigger: bn.describe("Event trigger identifier"), entity: bn.describe("Parsed entity from event name"), action: bn.describe("Parsed action from event name"), timestamp: hn.describe("Unix timestamp in milliseconds since epoch"), timing: gn.describe("Event processing timing information"), group: bn.describe("Event grouping identifier"), count: vn.describe("Event count in session"), version: Rn.describe("Walker version information"), source: Dn.describe("Event source information") }).describe("Complete walkerOS event structure");
|
|
14829
|
+
_n = Mn.partial().describe("Partial event structure with all fields optional");
|
|
14830
|
+
Tn = (Mn.partial().describe("Partial event structure with all top-level fields optional"), ge(Mn), ge(_n), ge(An), ge(Cn), ge($n), ge(In), ge(Pn), ge(Nn), external_exports.lazy(() => external_exports.union([external_exports.string().describe('String value or property path (e.g., "data.id")'), external_exports.number().describe("Numeric value"), external_exports.boolean().describe("Boolean value"), external_exports.lazy(() => fn), external_exports.array(Tn).describe("Array of values")])));
|
|
14831
|
+
qn = external_exports.array(Tn).describe("Array of transformation values");
|
|
14832
|
+
Ln = external_exports.lazy(() => external_exports.tuple([Tn, Tn]).describe("Loop transformation: [source, transform] tuple for array processing"));
|
|
14833
|
+
Un = external_exports.lazy(() => external_exports.array(Tn).describe("Set: Array of values for selection or combination"));
|
|
14834
|
+
Jn = external_exports.lazy(() => external_exports.record(external_exports.string(), Tn).describe("Map: Object mapping keys to transformation values"));
|
|
14835
|
+
Wn = fn = external_exports.object({ key: external_exports.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]).optional().describe("Static primitive value"), fn: external_exports.string().optional().describe("Custom transformation function as string (serialized)"), map: Jn.optional().describe("Object mapping: transform event data to structured output"), loop: Ln.optional().describe("Loop transformation: [source, transform] for array processing"), set: Un.optional().describe("Set of values: combine or select from multiple values"), consent: Nn.optional().describe("Required consent states to include this value"), condition: external_exports.string().optional().describe("Condition function as string: return true to include value"), validate: external_exports.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" }).describe("Value transformation configuration with multiple strategies");
|
|
14836
|
+
Bn = external_exports.record(external_exports.string(), Tn).describe("Policy rules for event pre-processing (key \u2192 value mapping)");
|
|
14837
|
+
Hn = external_exports.object({ batch: external_exports.number().optional().describe("Batch size: bundle N events for batch processing"), condition: external_exports.string().optional().describe("Condition function as string: return true to process event"), consent: Nn.optional().describe("Required consent states to process this event"), settings: external_exports.any().optional().describe("Destination-specific settings for this event mapping"), data: external_exports.union([Tn, qn]).optional().describe("Data transformation rules for event"), ignore: external_exports.boolean().optional().describe("Set to true to skip processing this event"), name: external_exports.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), policy: Bn.optional().describe("Event-level policy overrides (applied after config-level policy)") }).describe("Mapping rule for specific entity-action combination");
|
|
14838
|
+
Fn = external_exports.record(external_exports.string(), external_exports.record(external_exports.string(), external_exports.union([Hn, external_exports.array(Hn)])).optional()).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*).');
|
|
14839
|
+
Vn = external_exports.object({ consent: Nn.optional().describe("Required consent states to process any events"), data: external_exports.union([Tn, qn]).optional().describe("Global data transformation applied to all events"), mapping: Fn.optional().describe("Entity-action specific mapping rules"), policy: Bn.optional().describe("Pre-processing policy rules applied before mapping") }).describe("Shared mapping configuration for sources and destinations");
|
|
14840
|
+
Gn = (external_exports.object({ eventMapping: Hn.optional().describe("Resolved mapping rule for event"), mappingKey: external_exports.string().optional().describe('Mapping key used (e.g., "product.view")') }).describe("Mapping resolution result"), ge(Tn), ge(Wn), ge(Ln), ge(Un), ge(Jn), ge(Bn), ge(Hn), ge(Fn), ge(Vn), {});
|
|
14841
|
+
n(Gn, { BatchSchema: () => it, ConfigSchema: () => Kn, ContextSchema: () => Xn, DLQSchema: () => ut, DataSchema: () => ot, DestinationPolicySchema: () => Qn, DestinationsSchema: () => ct, InitDestinationsSchema: () => at, InitSchema: () => st, InstanceSchema: () => rt, PartialConfigSchema: () => Zn, PushBatchContextSchema: () => et, PushContextSchema: () => Yn, PushEventSchema: () => nt, PushEventsSchema: () => tt, PushResultSchema: () => dt, RefSchema: () => lt, ResultSchema: () => pt, batchJsonSchema: () => ht, configJsonSchema: () => ft, contextJsonSchema: () => gt, instanceJsonSchema: () => vt, partialConfigJsonSchema: () => bt, pushContextJsonSchema: () => mt, resultJsonSchema: () => yt });
|
|
14842
|
+
Kn = external_exports.object({ consent: Nn.optional().describe("Required consent states to send events to this destination"), settings: external_exports.any().describe("Implementation-specific configuration").optional(), data: external_exports.union([Tn, qn]).optional().describe("Global data transformation applied to all events for this destination"), env: external_exports.any().describe("Environment dependencies (platform-specific)").optional(), id: mn.describe("Destination instance identifier (defaults to destination key)").optional(), init: external_exports.boolean().describe("Whether to initialize immediately").optional(), loadScript: external_exports.boolean().describe("Whether to load external script (for web destinations)").optional(), mapping: Fn.optional().describe("Entity-action specific mapping rules for this destination"), policy: Bn.optional().describe("Pre-processing policy rules applied before event mapping"), queue: external_exports.boolean().describe("Whether to queue events when consent is not granted").optional(), require: external_exports.array(external_exports.string()).optional().describe('Defer destination initialization until these collector events fire (e.g., ["consent"])'), logger: external_exports.object({ level: external_exports.union([external_exports.number(), external_exports.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: external_exports.any().optional().describe("Custom log handler function") }).optional().describe("Logger configuration (level, handler) to override the collector defaults"), onError: jn.optional(), onLog: Sn.optional() }).describe("Destination configuration");
|
|
14843
|
+
Zn = Kn.partial().describe("Partial destination configuration with all fields optional");
|
|
14844
|
+
Qn = Bn.describe("Destination policy rules for event pre-processing");
|
|
14845
|
+
Xn = external_exports.object({ collector: external_exports.unknown().describe("Collector instance (runtime object)"), config: Kn.describe("Destination configuration"), data: external_exports.union([external_exports.unknown(), external_exports.array(external_exports.unknown())]).optional().describe("Transformed event data"), env: external_exports.unknown().describe("Environment dependencies") }).describe("Destination context for init and push functions");
|
|
14846
|
+
Yn = Xn.extend({ mapping: Hn.optional().describe("Resolved mapping rule for this specific event") }).describe("Push context with event-specific mapping");
|
|
14847
|
+
et = Yn.describe("Batch push context with event-specific mapping");
|
|
14848
|
+
nt = external_exports.object({ event: Mn.describe("The event to process"), mapping: Hn.optional().describe("Mapping rule for this event") }).describe("Event with optional mapping for batch processing");
|
|
14849
|
+
tt = external_exports.array(nt).describe("Array of events with mappings");
|
|
14850
|
+
it = external_exports.object({ key: external_exports.string().describe('Batch key (usually mapping key like "product.view")'), events: external_exports.array(Mn).describe("Array of events in batch"), data: external_exports.array(external_exports.union([external_exports.unknown(), external_exports.array(external_exports.unknown())]).optional()).describe("Transformed data for each event"), mapping: Hn.optional().describe("Shared mapping rule for batch") }).describe("Batch of events grouped by mapping key");
|
|
14851
|
+
ot = external_exports.union([external_exports.unknown(), external_exports.array(external_exports.unknown())]).optional().describe("Transformed event data (Property, undefined, or array)");
|
|
14852
|
+
rt = external_exports.object({ config: Kn.describe("Destination configuration"), queue: external_exports.array(Mn).optional().describe("Queued events awaiting consent"), dlq: external_exports.array(external_exports.tuple([Mn, external_exports.unknown()])).optional().describe("Dead letter queue (failed events with errors)"), type: external_exports.string().optional().describe("Destination type identifier"), env: external_exports.unknown().optional().describe("Environment dependencies"), init: external_exports.unknown().optional().describe("Initialization function"), push: external_exports.unknown().describe("Push function for single events"), pushBatch: external_exports.unknown().optional().describe("Batch push function"), on: external_exports.unknown().optional().describe("Event lifecycle hook function") }).describe("Destination instance (runtime object with functions)");
|
|
14853
|
+
st = external_exports.object({ code: rt.describe("Destination instance with implementation"), config: Zn.optional().describe("Partial configuration overrides"), env: external_exports.unknown().optional().describe("Partial environment overrides") }).describe("Destination initialization configuration");
|
|
14854
|
+
at = external_exports.record(external_exports.string(), st).describe("Map of destination IDs to initialization configurations");
|
|
14855
|
+
ct = external_exports.record(external_exports.string(), rt).describe("Map of destination IDs to runtime instances");
|
|
14856
|
+
lt = external_exports.object({ type: external_exports.string().describe('Destination type ("gtag", "meta", "bigquery")'), data: external_exports.unknown().optional().describe("Response from push()"), error: external_exports.unknown().optional().describe("Error if failed") }).describe("Destination reference with type and response data");
|
|
14857
|
+
dt = external_exports.object({ queue: external_exports.array(Mn).optional().describe("Events queued (awaiting consent)"), error: external_exports.unknown().optional().describe("Error if push failed") }).describe("Push operation result");
|
|
14858
|
+
pt = external_exports.object({ ok: external_exports.boolean().describe("True if nothing failed"), event: external_exports.unknown().optional().describe("The processed event"), done: external_exports.record(external_exports.string(), lt).optional().describe("Destinations that processed successfully"), queued: external_exports.record(external_exports.string(), lt).optional().describe("Destinations that queued events"), failed: external_exports.record(external_exports.string(), lt).optional().describe("Destinations that failed to process") }).describe("Push result with destination outcomes");
|
|
14859
|
+
ut = external_exports.array(external_exports.tuple([Mn, external_exports.unknown()])).describe("Dead letter queue: [(event, error), ...]");
|
|
14860
|
+
ft = ge(Kn);
|
|
14861
|
+
bt = ge(Zn);
|
|
14862
|
+
gt = ge(Xn);
|
|
14863
|
+
mt = ge(Yn);
|
|
14864
|
+
ht = ge(it);
|
|
14865
|
+
vt = ge(rt);
|
|
14866
|
+
yt = ge(pt);
|
|
14867
|
+
wt = external_exports.union([external_exports.enum(["action", "config", "consent", "context", "destination", "elb", "globals", "hook", "init", "link", "run", "user", "walker"]), external_exports.string()]).describe("Collector command type: standard commands or custom string for extensions");
|
|
14868
|
+
kt = external_exports.object({ run: external_exports.boolean().describe("Whether to run collector automatically on initialization").optional(), tagging: yn, globalsStatic: Cn.describe("Static global properties that persist across collector runs"), sessionStatic: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Static session data that persists across collector runs"), verbose: external_exports.boolean().describe("Enable verbose logging for debugging"), onError: jn.optional(), onLog: Sn.optional() }).describe("Core collector configuration");
|
|
14869
|
+
jt = Cn.and(external_exports.object({ isStart: external_exports.boolean().describe("Whether this is a new session start"), storage: external_exports.boolean().describe("Whether storage is available"), id: mn.describe("Session identifier").optional(), start: hn.describe("Session start timestamp").optional(), marketing: external_exports.literal(true).optional().describe("Marketing attribution flag"), updated: hn.describe("Last update timestamp").optional(), isNew: external_exports.boolean().describe("Whether this is a new session").optional(), device: mn.describe("Device identifier").optional(), count: vn.describe("Event count in session").optional(), runs: vn.describe("Number of runs").optional() })).describe("Session state and tracking data");
|
|
14870
|
+
St = kt.partial().extend({ consent: Nn.optional().describe("Initial consent state"), user: An.optional().describe("Initial user data"), globals: Cn.optional().describe("Initial global properties"), sources: external_exports.unknown().optional().describe("Source configurations"), destinations: external_exports.unknown().optional().describe("Destination configurations"), custom: Cn.optional().describe("Initial custom implementation-specific properties") }).describe("Collector initialization configuration with initial state");
|
|
14871
|
+
xt = external_exports.object({ mapping: Vn.optional().describe("Source-level mapping configuration") }).describe("Push context with optional source mapping");
|
|
14872
|
+
Et = external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of source IDs to source instances");
|
|
14873
|
+
Ot = external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of destination IDs to destination instances");
|
|
14874
|
+
Ct = external_exports.object({ push: external_exports.unknown().describe("Push function for processing events"), command: external_exports.unknown().describe("Command function for walker commands"), allowed: external_exports.boolean().describe("Whether event processing is allowed"), config: kt.describe("Current collector configuration"), consent: Nn.describe("Current consent state"), count: external_exports.number().describe("Event count (increments with each event)"), custom: Cn.describe("Custom implementation-specific properties"), sources: Et.describe("Registered source instances"), destinations: Ot.describe("Registered destination instances"), globals: Cn.describe("Current global properties"), group: external_exports.string().describe("Event grouping identifier"), hooks: external_exports.unknown().describe("Lifecycle hook functions"), on: external_exports.unknown().describe("Event lifecycle configuration"), queue: external_exports.array(Mn).describe("Queued events awaiting processing"), round: external_exports.number().describe("Collector run count (increments with each run)"), session: external_exports.union([jt]).describe("Current session state"), timing: external_exports.number().describe("Event processing timing information"), user: An.describe("Current user data"), version: external_exports.string().describe("Walker implementation version") }).describe("Collector instance with state and methods");
|
|
14875
|
+
$t = (ge(wt), ge(kt), ge(jt), ge(St), ge(xt), ge(Ct), {});
|
|
14876
|
+
n($t, { BaseEnvSchema: () => Pt, ConfigSchema: () => Nt, InitSchema: () => Dt, InitSourceSchema: () => It, InitSourcesSchema: () => zt, InstanceSchema: () => Rt, PartialConfigSchema: () => At, baseEnvJsonSchema: () => Mt, configJsonSchema: () => _t, initSourceJsonSchema: () => Lt, initSourcesJsonSchema: () => Ut, instanceJsonSchema: () => qt, partialConfigJsonSchema: () => Tt });
|
|
14877
|
+
Pt = external_exports.object({ push: external_exports.unknown().describe("Collector push function"), command: external_exports.unknown().describe("Collector command function"), sources: external_exports.unknown().optional().describe("Map of registered source instances"), elb: external_exports.unknown().describe("Public API function (alias for collector.push)") }).catchall(external_exports.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this");
|
|
14878
|
+
Nt = Vn.extend({ settings: external_exports.any().describe("Implementation-specific configuration").optional(), env: Pt.optional().describe("Environment dependencies (platform-specific)"), id: mn.describe("Source identifier (defaults to source key)").optional(), onError: jn.optional(), primary: external_exports.boolean().describe("Mark as primary (only one can be primary)").optional(), require: external_exports.array(external_exports.string()).optional().describe('Defer source initialization until these collector events fire (e.g., ["consent"])'), logger: external_exports.object({ level: external_exports.union([external_exports.number(), external_exports.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: external_exports.any().optional().describe("Custom log handler function") }).optional().describe("Logger configuration (level, handler) to override the collector defaults"), ingest: external_exports.union([Tn, qn]).optional().describe("Ingest metadata extraction mapping. Extracts values from raw request objects (Express req, Lambda event) using mapping syntax.") }).describe("Source configuration with mapping and environment");
|
|
14879
|
+
At = Nt.partial().describe("Partial source configuration with all fields optional");
|
|
14880
|
+
Rt = external_exports.object({ type: external_exports.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Nt.describe("Current source configuration"), push: external_exports.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"), destroy: external_exports.any().optional().describe("Cleanup function called when source is removed"), on: external_exports.unknown().optional().describe("Lifecycle hook function for event types") }).describe("Source instance with push handler and lifecycle methods");
|
|
14881
|
+
Dt = external_exports.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>");
|
|
14882
|
+
It = external_exports.object({ code: Dt.describe("Source initialization function"), config: At.optional().describe("Partial configuration overrides"), env: Pt.partial().optional().describe("Partial environment overrides"), primary: external_exports.boolean().optional().describe("Mark as primary source (only one can be primary)") }).describe("Source initialization configuration");
|
|
14883
|
+
zt = external_exports.record(external_exports.string(), It).describe("Map of source IDs to initialization configurations");
|
|
14884
|
+
Mt = ge(Pt);
|
|
14885
|
+
_t = ge(Nt);
|
|
14886
|
+
Tt = ge(At);
|
|
14887
|
+
qt = ge(Rt);
|
|
14888
|
+
Lt = ge(It);
|
|
14889
|
+
Ut = ge(zt);
|
|
14890
|
+
Jt = external_exports.enum(["eq", "contains", "prefix", "suffix", "regex", "gt", "lt", "exists"]);
|
|
14891
|
+
Wt = external_exports.object({ key: external_exports.string(), operator: Jt, value: external_exports.string(), not: external_exports.boolean().optional() });
|
|
14892
|
+
Bt = external_exports.union([Wt, external_exports.object({ and: external_exports.array(external_exports.lazy(() => Bt)) }), external_exports.object({ or: external_exports.array(external_exports.lazy(() => Bt)) })]);
|
|
14893
|
+
Ht = external_exports.union([Bt, external_exports.literal("*")]);
|
|
14894
|
+
Ft = external_exports.union([external_exports.string(), external_exports.array(external_exports.string()), external_exports.array(external_exports.object({ match: Ht, next: external_exports.lazy(() => Ft) }))]);
|
|
14895
|
+
Vt = (external_exports.object({ match: Ht, next: external_exports.lazy(() => Ft) }), external_exports.object({ match: external_exports.union([Bt, external_exports.literal("*")]).describe("Match expression or wildcard to determine when this rule applies"), key: external_exports.array(external_exports.string()).min(1).describe("Dot-path fields used to build the cache key"), ttl: external_exports.number().positive().describe("Time-to-live in seconds for cached entries"), update: external_exports.record(external_exports.string(), Tn).optional().describe("Response mutations applied on cache hit (key \u2192 Value mapping)") }));
|
|
14896
|
+
Gt = external_exports.object({ full: external_exports.boolean().optional().describe("Stop flow on cache HIT (default: false). When true, skip remaining steps and return cached value."), store: external_exports.string().optional().describe("Store ID for persistent caching (references a configured store)"), rules: external_exports.array(Vt).min(1).describe("Cache rules \u2014 at least one required") });
|
|
14897
|
+
Kt = external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]).describe("Primitive value: string, number, or boolean");
|
|
14898
|
+
Zt = external_exports.record(external_exports.string(), Kt).describe("Variables for interpolation");
|
|
14899
|
+
Qt = external_exports.record(external_exports.string(), external_exports.unknown()).describe("Reusable configuration definitions");
|
|
14900
|
+
Xt = /^(@[a-z0-9\-~][a-z0-9\-._~]*\/)?[a-z0-9\-~][a-z0-9\-._~]*$/;
|
|
14901
|
+
Yt = external_exports.record(external_exports.string().regex(Xt, "Invalid npm package name"), external_exports.object({ version: external_exports.string().optional(), imports: external_exports.array(external_exports.string()).optional(), path: external_exports.string().optional() })).describe("NPM packages to bundle");
|
|
14902
|
+
ei = external_exports.record(external_exports.string().regex(Xt, "Invalid npm package name"), external_exports.string().min(1, "Override version cannot be empty")).describe("Transitive dependency version overrides");
|
|
14903
|
+
ni = external_exports.object({ packages: Yt.optional().describe("NPM packages to bundle"), overrides: ei.optional().describe("Transitive dependency overrides") }).strict().describe("Bundle configuration (packages + overrides)");
|
|
14904
|
+
ti = external_exports.object({ windowCollector: external_exports.string().default("collector").optional().describe('Window property name for the collector instance (default: "collector")'), windowElb: external_exports.string().default("elb").optional().describe('Window property name for the elb command queue (default: "elb")') }).describe("Web platform configuration");
|
|
14905
|
+
ii = external_exports.object({}).passthrough().describe("Server platform configuration (reserved for future options)");
|
|
14906
|
+
oi = external_exports.object({ push: external_exports.string().min(1, "Push function cannot be empty").describe('JavaScript function for processing events. Must start with "$code:" prefix. Example: "$code:(event) => { console.log(event); }"'), type: external_exports.string().optional().describe("Optional type identifier for the inline instance"), init: external_exports.string().optional().describe("Optional initialization function. Use $code: prefix for inline JavaScript.") }).describe("Inline code for custom sources/transformers/destinations");
|
|
14907
|
+
ri = external_exports.object({ description: external_exports.string().optional().describe("Human-readable description"), in: external_exports.unknown().optional().describe("Input to the step"), trigger: external_exports.object({ type: external_exports.string().optional().describe("Trigger mechanism (e.g., click, POST, load)"), options: external_exports.unknown().optional().describe("Mechanism-specific options") }).optional().describe("Source trigger metadata"), mapping: external_exports.unknown().optional().describe("Mapping configuration"), out: external_exports.unknown().optional().describe("Expected output from the step"), command: external_exports.enum(["config", "consent", "user", "run"]).optional().describe("Invoke elb('walker <command>', in) instead of pushing in as an event") }).describe("Named example with input/output pair");
|
|
14908
|
+
si = external_exports.record(external_exports.string(), ri).describe("Named step examples for testing and documentation");
|
|
14909
|
+
ai = external_exports.object({ package: external_exports.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: external_exports.union([external_exports.string(), oi]).optional().describe('Either a named export string (e.g., "sourceExpress") or an inline code object with push function'), config: external_exports.unknown().optional().describe("Source-specific configuration object"), env: external_exports.unknown().optional().describe("Source environment configuration"), primary: external_exports.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."), variables: Zt.optional().describe("Source-level variables (highest priority in cascade)"), definitions: Qt.optional().describe("Source-level definitions (highest priority in cascade)"), next: Ft.optional().describe("Pre-collector transformer chain. String, string[], or NextRule[] for conditional routing based on ingest data."), before: Ft.optional().describe("Pre-source transformer chain (consent-exempt). Handles transport-level preprocessing."), examples: si.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Gt.optional().describe("Cache configuration for this source (match \u2192 key \u2192 ttl rules)") }).describe("Source package reference with configuration");
|
|
14910
|
+
ci = external_exports.object({ package: external_exports.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'), code: external_exports.union([external_exports.string(), oi]).optional().describe('Either a named export string (e.g., "transformerEnricher") or an inline code object with push function'), config: external_exports.unknown().optional().describe("Transformer-specific configuration object"), env: external_exports.unknown().optional().describe("Transformer environment configuration"), before: Ft.optional().describe("Pre-transformer chain. Runs before this transformer push function."), next: Ft.optional().describe("Next transformer in chain. String, string[], or NextRule[] for conditional routing."), variables: Zt.optional().describe("Transformer-level variables (highest priority in cascade)"), definitions: Qt.optional().describe("Transformer-level definitions (highest priority in cascade)"), examples: si.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Gt.optional().describe("Cache configuration for this transformer (match \u2192 key \u2192 ttl rules)") }).describe("Transformer package reference with configuration");
|
|
14911
|
+
li = external_exports.object({ package: external_exports.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: external_exports.union([external_exports.string(), oi]).optional().describe('Either a named export string (e.g., "destinationAnalytics") or an inline code object with push function'), config: external_exports.unknown().optional().describe("Destination-specific configuration object"), env: external_exports.unknown().optional().describe("Destination environment configuration"), variables: Zt.optional().describe("Destination-level variables (highest priority in cascade)"), definitions: Qt.optional().describe("Destination-level definitions (highest priority in cascade)"), before: Ft.optional().describe("Post-collector transformer chain. String, string[], or NextRule[] for conditional routing."), next: Ft.optional().describe("Post-push transformer chain. Push response available at context.ingest._response."), examples: si.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Gt.optional().describe("Cache configuration for this destination (match \u2192 key \u2192 ttl rules)") }).describe("Destination package reference with configuration");
|
|
14912
|
+
di = external_exports.object({ package: external_exports.string().min(1, "Package name cannot be empty").optional().describe("Store package specifier with optional version"), code: external_exports.union([external_exports.string(), oi]).optional().describe("Named export string or inline code definition"), config: external_exports.unknown().optional().describe("Store-specific configuration object"), env: external_exports.unknown().optional().describe("Store environment configuration"), variables: Zt.optional().describe("Store-level variables (highest priority in cascade)"), definitions: Qt.optional().describe("Store-level definitions (highest priority in cascade)"), examples: si.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).describe("Store package reference with configuration");
|
|
14913
|
+
pi = external_exports.record(external_exports.string(), external_exports.unknown()).describe("JSON Schema object for event validation with description/examples annotations");
|
|
14914
|
+
ui = external_exports.record(external_exports.string(), pi).describe("Action-level contract entries");
|
|
14915
|
+
fi = external_exports.record(external_exports.string(), ui).describe("Entity-action event schemas");
|
|
14916
|
+
bi = external_exports.object({ extends: external_exports.string().optional().describe("Inherit from another named contract"), tagging: external_exports.number().int().min(0).optional().describe("Contract version number"), description: external_exports.string().optional().describe("Human-readable description"), globals: pi.optional().describe("JSON Schema for event.globals"), context: pi.optional().describe("JSON Schema for event.context"), custom: pi.optional().describe("JSON Schema for event.custom"), user: pi.optional().describe("JSON Schema for event.user"), consent: pi.optional().describe("JSON Schema for event.consent"), events: fi.optional().describe("Entity-action event schemas") }).describe("Named contract entry with optional sections and events");
|
|
14917
|
+
gi = external_exports.record(external_exports.string(), bi).describe("Named contracts with optional extends inheritance");
|
|
14918
|
+
mi = external_exports.object({ web: ti.optional().describe("Web platform configuration (browser-based tracking). Mutually exclusive with server."), server: ii.optional().describe("Server platform configuration (Node.js). Mutually exclusive with web."), sources: external_exports.record(external_exports.string(), ai).optional().describe("Source configurations (data capture) keyed by unique identifier"), destinations: external_exports.record(external_exports.string(), li).optional().describe("Destination configurations (data output) keyed by unique identifier"), transformers: external_exports.record(external_exports.string(), ci).optional().describe("Transformer configurations (event transformation) keyed by unique identifier"), stores: external_exports.record(external_exports.string(), di).optional().describe("Store configurations (key-value storage) keyed by unique identifier"), collector: external_exports.unknown().optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"), bundle: ni.optional().describe("Build-time configuration (packages + overrides)"), packages: external_exports.unknown().optional().refine((e3) => void 0 === e3, { message: "`packages` must live under `bundle.packages`. Move your packages block to `flow.<name>.bundle.packages`. This is a breaking change \u2014 see CHANGELOG migration guide." }).describe("Legacy top-level packages (moved to bundle.packages)"), variables: Zt.optional().describe("Flow-level variables (override Config.variables, overridden by source/destination variables)"), definitions: Qt.optional().describe("Flow-level definitions (extend Config.definitions, overridden by source/destination definitions)") }).refine((e3) => {
|
|
14915
14919
|
const n4 = void 0 !== e3.web, t = void 0 !== e3.server;
|
|
14916
14920
|
return (n4 || t) && !(n4 && t);
|
|
14917
14921
|
}, { message: 'Exactly one of "web" or "server" must be present' }).describe("Single flow settings for one deployment target");
|
|
14918
|
-
|
|
14919
|
-
external_exports.toJSONSchema(
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14922
|
+
hi = external_exports.object({ $schema: external_exports.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v2.json")'), include: external_exports.array(external_exports.string()).optional().describe("Folders to include in the bundle output"), variables: Zt.optional().describe("Shared variables for interpolation across all flows (use $var.name syntax)"), definitions: Qt.optional().describe("Reusable configuration definitions (use $def.name syntax)"), flows: external_exports.record(external_exports.string(), mi).refine((e3) => Object.keys(e3).length > 0, { message: "At least one flow is required" }).describe("Named flow configurations (e.g., production, staging, development)") }).extend({ version: external_exports.literal(3).describe("Configuration schema version"), contract: gi.optional().describe("Named contracts with extends inheritance and dot-path references") }).describe("walkerOS flow configuration (walkeros.config.json)");
|
|
14923
|
+
external_exports.toJSONSchema(hi, { target: "draft-7" }), ge(mi), ge(ai), ge(li), ge(ci), ge(di), ge(bi), ge(gi);
|
|
14924
|
+
yi = external_exports.object({ lang: external_exports.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: external_exports.string().describe("Code snippet") });
|
|
14925
|
+
wi = external_exports.object({ text: external_exports.string().describe("Short actionable hint text focused on walkerOS usage"), code: external_exports.array(yi).optional().describe("Optional code snippets") });
|
|
14926
|
+
ki = (external_exports.record(external_exports.string(), wi).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples"), /* @__PURE__ */ new Set(["env", "onError", "onLog", "primary"]));
|
|
14927
|
+
ji = { source: $t.configJsonSchema, destination: Gn.configJsonSchema };
|
|
14924
14928
|
}
|
|
14925
14929
|
});
|
|
14926
14930
|
|
|
@@ -14934,7 +14938,7 @@ function createCLILogger(options = {}) {
|
|
|
14934
14938
|
stderr = false
|
|
14935
14939
|
} = options;
|
|
14936
14940
|
const out = stderr ? console.error : console.log;
|
|
14937
|
-
return
|
|
14941
|
+
return xe({
|
|
14938
14942
|
// Let handler control visibility — pass everything through
|
|
14939
14943
|
level: d.DEBUG,
|
|
14940
14944
|
handler: (level, message, _context, scope) => {
|
|
@@ -15121,17 +15125,17 @@ function mergeAuthHeaders(token, headers) {
|
|
|
15121
15125
|
if (token) normalized.Authorization = `Bearer ${token}`;
|
|
15122
15126
|
return normalized;
|
|
15123
15127
|
}
|
|
15124
|
-
async function apiFetch(
|
|
15128
|
+
async function apiFetch(path18, init) {
|
|
15125
15129
|
const baseUrl = resolveAppUrl();
|
|
15126
15130
|
const token = resolveToken()?.token;
|
|
15127
|
-
return fetch(`${baseUrl}${
|
|
15131
|
+
return fetch(`${baseUrl}${path18}`, {
|
|
15128
15132
|
...init,
|
|
15129
15133
|
headers: mergeAuthHeaders(token, init?.headers)
|
|
15130
15134
|
});
|
|
15131
15135
|
}
|
|
15132
|
-
async function publicFetch(
|
|
15136
|
+
async function publicFetch(path18, init) {
|
|
15133
15137
|
const baseUrl = resolveAppUrl();
|
|
15134
|
-
return fetch(`${baseUrl}${
|
|
15138
|
+
return fetch(`${baseUrl}${path18}`, init);
|
|
15135
15139
|
}
|
|
15136
15140
|
var init_http = __esm({
|
|
15137
15141
|
"src/core/http.ts"() {
|
|
@@ -15230,37 +15234,16 @@ var init_utils = __esm({
|
|
|
15230
15234
|
});
|
|
15231
15235
|
|
|
15232
15236
|
// src/core/asset-resolver.ts
|
|
15233
|
-
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
15234
|
-
import { existsSync as existsSync2 } from "fs";
|
|
15235
15237
|
import path4 from "path";
|
|
15236
|
-
function getAssetDir() {
|
|
15237
|
-
if (cachedAssetDir) return cachedAssetDir;
|
|
15238
|
-
const currentFile = fileURLToPath2(import.meta.url);
|
|
15239
|
-
let dir = path4.dirname(currentFile);
|
|
15240
|
-
while (dir !== path4.dirname(dir)) {
|
|
15241
|
-
if (existsSync2(path4.join(dir, "examples"))) {
|
|
15242
|
-
cachedAssetDir = dir;
|
|
15243
|
-
return dir;
|
|
15244
|
-
}
|
|
15245
|
-
dir = path4.dirname(dir);
|
|
15246
|
-
}
|
|
15247
|
-
cachedAssetDir = path4.dirname(currentFile);
|
|
15248
|
-
return cachedAssetDir;
|
|
15249
|
-
}
|
|
15250
15238
|
function resolveAsset(assetPath, assetType, baseDir) {
|
|
15251
15239
|
if (isUrl(assetPath)) {
|
|
15252
15240
|
return assetPath;
|
|
15253
15241
|
}
|
|
15254
|
-
if (!assetPath.includes("/") && !assetPath.includes("\\")) {
|
|
15255
|
-
const assetDir = getAssetDir();
|
|
15256
|
-
return path4.join(assetDir, "examples", assetPath);
|
|
15257
|
-
}
|
|
15258
15242
|
if (path4.isAbsolute(assetPath)) {
|
|
15259
15243
|
return assetPath;
|
|
15260
15244
|
}
|
|
15261
15245
|
return path4.resolve(baseDir || process.cwd(), assetPath);
|
|
15262
15246
|
}
|
|
15263
|
-
var cachedAssetDir;
|
|
15264
15247
|
var init_asset_resolver = __esm({
|
|
15265
15248
|
"src/core/asset-resolver.ts"() {
|
|
15266
15249
|
"use strict";
|
|
@@ -15511,22 +15494,22 @@ function z3(e3) {
|
|
|
15511
15494
|
function L2(e3) {
|
|
15512
15495
|
return external_exports.object({ policy: e3.optional().describe("Pre-processing policy rules") }).partial();
|
|
15513
15496
|
}
|
|
15514
|
-
function
|
|
15497
|
+
function M2(e3) {
|
|
15515
15498
|
return external_exports.object({ consent: e3.optional().describe("Required consent states") }).partial();
|
|
15516
15499
|
}
|
|
15517
|
-
function
|
|
15518
|
-
return
|
|
15500
|
+
function fi2(e3) {
|
|
15501
|
+
return gi2.parse(e3);
|
|
15519
15502
|
}
|
|
15520
|
-
function
|
|
15521
|
-
return
|
|
15503
|
+
function hi2(e3) {
|
|
15504
|
+
return gi2.safeParse(e3);
|
|
15522
15505
|
}
|
|
15523
|
-
function
|
|
15524
|
-
return
|
|
15506
|
+
function vi(e3) {
|
|
15507
|
+
return bi2.parse(e3);
|
|
15525
15508
|
}
|
|
15526
|
-
function
|
|
15527
|
-
return
|
|
15509
|
+
function Si(e3) {
|
|
15510
|
+
return bi2.safeParse(e3);
|
|
15528
15511
|
}
|
|
15529
|
-
function
|
|
15512
|
+
function Oi2(e3) {
|
|
15530
15513
|
let n4;
|
|
15531
15514
|
try {
|
|
15532
15515
|
n4 = JSON.parse(e3);
|
|
@@ -15535,7 +15518,7 @@ function Ri(e3) {
|
|
|
15535
15518
|
if (e4 instanceof SyntaxError) {
|
|
15536
15519
|
const i4 = e4.message.match(/position\s+(\d+)/);
|
|
15537
15520
|
if (i4) {
|
|
15538
|
-
return
|
|
15521
|
+
return Ni(n6, parseInt(i4[1], 10));
|
|
15539
15522
|
}
|
|
15540
15523
|
const t3 = e4.message.match(/line\s+(\d+)\s+column\s+(\d+)/);
|
|
15541
15524
|
if (t3) return { line: parseInt(t3[1], 10), column: parseInt(t3[2], 10) };
|
|
@@ -15544,33 +15527,33 @@ function Ri(e3) {
|
|
|
15544
15527
|
})(n5, e3);
|
|
15545
15528
|
return { valid: false, errors: [{ message: n5 instanceof Error ? n5.message : "Invalid JSON", severity: "error", line: i3, column: t2 }], warnings: [] };
|
|
15546
15529
|
}
|
|
15547
|
-
const i2 = [], t = [], o2 =
|
|
15530
|
+
const i2 = [], t = [], o2 = gi2.safeParse(n4);
|
|
15548
15531
|
if (!o2.success) for (const n5 of o2.error.issues) {
|
|
15549
|
-
const t2 = n5.path.join("."), o3 =
|
|
15532
|
+
const t2 = n5.path.join("."), o3 = Li(e3, n5.path);
|
|
15550
15533
|
i2.push({ message: n5.message, severity: "error", path: t2 || "root", ...o3 });
|
|
15551
15534
|
}
|
|
15552
15535
|
const r2 = (function(e4) {
|
|
15553
|
-
if (!(
|
|
15536
|
+
if (!(Mi(e4) && "version" in e4 && "flows" in e4 && Mi(e4.flows))) return;
|
|
15554
15537
|
const n5 = {}, i3 = {}, t2 = [], o3 = [], r3 = [], a2 = [], s2 = [];
|
|
15555
15538
|
let c2;
|
|
15556
|
-
|
|
15557
|
-
if (!
|
|
15539
|
+
qi(n5, e4.variables), Ui(i3, e4.definitions), (function(e5, n6) {
|
|
15540
|
+
if (!Mi(n6)) return;
|
|
15558
15541
|
for (const [, i4] of Object.entries(n6)) {
|
|
15559
|
-
if (!
|
|
15542
|
+
if (!Mi(i4)) continue;
|
|
15560
15543
|
const n7 = i4.events;
|
|
15561
|
-
if (
|
|
15562
|
-
if (!
|
|
15544
|
+
if (Mi(n7)) for (const [i5, t3] of Object.entries(n7)) {
|
|
15545
|
+
if (!Mi(t3)) continue;
|
|
15563
15546
|
const n8 = e5.find((e6) => e6.entity === i5), o4 = Object.keys(t3);
|
|
15564
15547
|
if (n8) for (const e6 of o4) n8.actions.includes(e6) || n8.actions.push(e6);
|
|
15565
15548
|
else e5.push({ entity: i5, actions: o4 });
|
|
15566
15549
|
}
|
|
15567
15550
|
}
|
|
15568
15551
|
})(s2, e4.contract);
|
|
15569
|
-
for (const s3 of Object.values(e4.flows)) if (
|
|
15570
|
-
c2 || ("web" in s3 ? c2 = "web" : "server" in s3 && (c2 = "server")),
|
|
15552
|
+
for (const s3 of Object.values(e4.flows)) if (Mi(s3)) {
|
|
15553
|
+
c2 || ("web" in s3 ? c2 = "web" : "server" in s3 && (c2 = "server")), qi(n5, s3.variables), Ui(i3, s3.definitions);
|
|
15571
15554
|
for (const e5 of ["sources", "destinations", "transformers"]) {
|
|
15572
15555
|
const l4 = "sources" === e5 ? "source" : "destinations" === e5 ? "destination" : "transformer", d3 = "sources" === e5 ? t2 : "destinations" === e5 ? o3 : r3;
|
|
15573
|
-
if (
|
|
15556
|
+
if (Mi(s3[e5])) for (const [t3, o4] of Object.entries(s3[e5])) d3.push(t3), Mi(o4) && (qi(n5, o4.variables), Ui(i3, o4.definitions), "string" == typeof o4.package && a2.push({ package: o4.package, shortName: t3, type: l4, platform: c2 || "web" }));
|
|
15574
15557
|
}
|
|
15575
15558
|
}
|
|
15576
15559
|
const l3 = { variables: n5, definitions: i3, stepNames: { sources: t2, destinations: o3, transformers: r3 } };
|
|
@@ -15586,7 +15569,7 @@ function Ri(e3) {
|
|
|
15586
15569
|
const t2 = /\$var\.(\w+)/g;
|
|
15587
15570
|
let o3;
|
|
15588
15571
|
for (; null !== (o3 = t2.exec(e4)); ) if (!(o3[1] in n6.variables)) {
|
|
15589
|
-
const t3 =
|
|
15572
|
+
const t3 = zi(e4, o3.index, o3[0].length);
|
|
15590
15573
|
i3.push({ message: `Unknown variable "$var.${o3[1]}". Defined: ${Object.keys(n6.variables).join(", ") || "none"}`, severity: "warning", path: `$var.${o3[1]}`, ...t3 });
|
|
15591
15574
|
}
|
|
15592
15575
|
}
|
|
@@ -15594,7 +15577,7 @@ function Ri(e3) {
|
|
|
15594
15577
|
const t2 = /\$def\.(\w+)/g;
|
|
15595
15578
|
let o3;
|
|
15596
15579
|
for (; null !== (o3 = t2.exec(e4)); ) if (!(o3[1] in n6.definitions)) {
|
|
15597
|
-
const t3 =
|
|
15580
|
+
const t3 = zi(e4, o3.index, o3[0].length);
|
|
15598
15581
|
i3.push({ message: `Unknown definition "$def.${o3[1]}". Defined: ${Object.keys(n6.definitions).join(", ") || "none"}`, severity: "warning", path: `$def.${o3[1]}`, ...t3 });
|
|
15599
15582
|
}
|
|
15600
15583
|
}
|
|
@@ -15604,75 +15587,75 @@ function Ri(e3) {
|
|
|
15604
15587
|
}
|
|
15605
15588
|
return { valid: 0 === i2.length, errors: i2, warnings: t, context: r2 };
|
|
15606
15589
|
}
|
|
15607
|
-
function
|
|
15590
|
+
function Ni(e3, n4) {
|
|
15608
15591
|
let i2 = 1, t = 1;
|
|
15609
15592
|
for (let o2 = 0; o2 < n4 && o2 < e3.length; o2++) "\n" === e3[o2] ? (i2++, t = 1) : t++;
|
|
15610
15593
|
return { line: i2, column: t };
|
|
15611
15594
|
}
|
|
15612
|
-
function
|
|
15613
|
-
const t =
|
|
15595
|
+
function zi(e3, n4, i2) {
|
|
15596
|
+
const t = Ni(e3, n4), o2 = Ni(e3, n4 + i2);
|
|
15614
15597
|
return { line: t.line, column: t.column, endLine: o2.line, endColumn: o2.column };
|
|
15615
15598
|
}
|
|
15616
|
-
function
|
|
15599
|
+
function Li(e3, n4) {
|
|
15617
15600
|
if (0 === n4.length) return { line: 1, column: 1 };
|
|
15618
15601
|
const i2 = n4[n4.length - 1];
|
|
15619
15602
|
if ("string" == typeof i2) {
|
|
15620
15603
|
const n5 = `"${i2}"`, t = e3.lastIndexOf(n5);
|
|
15621
|
-
if (-1 !== t) return
|
|
15604
|
+
if (-1 !== t) return Ni(e3, t);
|
|
15622
15605
|
}
|
|
15623
15606
|
return { line: 1, column: 1 };
|
|
15624
15607
|
}
|
|
15625
|
-
function
|
|
15608
|
+
function Mi(e3) {
|
|
15626
15609
|
return "object" == typeof e3 && null !== e3 && !Array.isArray(e3);
|
|
15627
15610
|
}
|
|
15628
|
-
function
|
|
15611
|
+
function Ti(e3) {
|
|
15629
15612
|
return "string" == typeof e3 || "number" == typeof e3 || "boolean" == typeof e3;
|
|
15630
15613
|
}
|
|
15631
|
-
function Li(e3, n4) {
|
|
15632
|
-
if (Ni(n4)) for (const [i2, t] of Object.entries(n4)) zi(t) && (e3[i2] = t);
|
|
15633
|
-
}
|
|
15634
15614
|
function qi(e3, n4) {
|
|
15635
|
-
if (
|
|
15615
|
+
if (Mi(n4)) for (const [i2, t] of Object.entries(n4)) Ti(t) && (e3[i2] = t);
|
|
15616
|
+
}
|
|
15617
|
+
function Ui(e3, n4) {
|
|
15618
|
+
if (Mi(n4)) for (const [i2, t] of Object.entries(n4)) e3[i2] = t;
|
|
15636
15619
|
}
|
|
15637
|
-
function
|
|
15620
|
+
function Bi(e3, n4) {
|
|
15638
15621
|
const i2 = [], t = {};
|
|
15639
15622
|
for (const [n5, o3] of Object.entries(e3)) {
|
|
15640
15623
|
o3.required && i2.push(n5);
|
|
15641
15624
|
const e4 = { type: o3.type };
|
|
15642
15625
|
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) {
|
|
15643
15626
|
const n6 = {};
|
|
15644
|
-
for (const [e5, i3] of Object.entries(o3.properties)) n6[e5] =
|
|
15627
|
+
for (const [e5, i3] of Object.entries(o3.properties)) n6[e5] = Wi(i3);
|
|
15645
15628
|
e4.properties = n6;
|
|
15646
15629
|
}
|
|
15647
|
-
"array" === o3.type && o3.items && (e4.items =
|
|
15630
|
+
"array" === o3.type && o3.items && (e4.items = Wi(o3.items)), t[n5] = e4;
|
|
15648
15631
|
}
|
|
15649
15632
|
const o2 = { type: "object", properties: t };
|
|
15650
15633
|
return n4 && (o2.title = n4), i2.length > 0 && (o2.required = i2), o2;
|
|
15651
15634
|
}
|
|
15652
|
-
function
|
|
15635
|
+
function Wi(e3) {
|
|
15653
15636
|
const n4 = { type: e3.type };
|
|
15654
15637
|
if (e3.description && (n4.description = e3.description), e3.pattern && (n4.pattern = e3.pattern), void 0 !== e3.minLength && (n4.minLength = e3.minLength), void 0 !== e3.maxLength && (n4.maxLength = e3.maxLength), void 0 !== e3.minimum && (n4.minimum = e3.minimum), void 0 !== e3.maximum && (n4.maximum = e3.maximum), e3.enum && (n4.enum = [...e3.enum]), void 0 !== e3.default && (n4.default = e3.default), "object" === e3.type && e3.properties) {
|
|
15655
15638
|
const i2 = {};
|
|
15656
|
-
for (const [n5, t] of Object.entries(e3.properties)) i2[n5] =
|
|
15639
|
+
for (const [n5, t] of Object.entries(e3.properties)) i2[n5] = Wi(t);
|
|
15657
15640
|
n4.properties = i2;
|
|
15658
15641
|
}
|
|
15659
|
-
return "array" === e3.type && e3.items && (n4.items =
|
|
15642
|
+
return "array" === e3.type && e3.items && (n4.items = Wi(e3.items)), n4;
|
|
15660
15643
|
}
|
|
15661
|
-
function
|
|
15662
|
-
const i2 = { type: "array", items:
|
|
15644
|
+
function Ai(e3, n4) {
|
|
15645
|
+
const i2 = { type: "array", items: Wi(e3) };
|
|
15663
15646
|
return void 0 !== n4?.minItems && (i2.minItems = n4.minItems), void 0 !== n4?.maxItems && (i2.maxItems = n4.maxItems), n4?.description && (i2.description = n4.description), n4?.title && (i2.title = n4.title), i2;
|
|
15664
15647
|
}
|
|
15665
|
-
function
|
|
15648
|
+
function $i2(e3, n4 = "string", i2) {
|
|
15666
15649
|
const t = { type: n4, enum: [...e3] };
|
|
15667
15650
|
return i2?.description && (t.description = i2.description), i2?.title && (t.title = i2.title), t;
|
|
15668
15651
|
}
|
|
15669
|
-
function
|
|
15670
|
-
return
|
|
15652
|
+
function Vi(e3, n4, i2) {
|
|
15653
|
+
return Ai({ type: "object" }, { minItems: 2, maxItems: 2, description: i2 || "Tuple with exactly 2 elements [source, transform]" });
|
|
15671
15654
|
}
|
|
15672
|
-
function
|
|
15655
|
+
function Hi(e3) {
|
|
15673
15656
|
return external_exports.toJSONSchema(e3, { target: "draft-7" });
|
|
15674
15657
|
}
|
|
15675
|
-
var e2, n2, i, r, a, s, c, l2, d2, p, u, m, b,
|
|
15658
|
+
var e2, n2, i, r, a, s, c, l2, d2, p, u, m, b, g, f, h, v, S, y, w, k, x2, C2, j, E, J2, P2, R2, I2, D2, O, T2, q2, U2, B, W, A2, $2, V, H, F2, G, _2, Q, K2, X, Y2, Z, ee, ne, ie2, te, oe, re, ae, se, ce, le, de, pe, ue, me2, be, ge2, fe, he, ve, Se2, ye, we, ke2, xe2, Ce, je2, Ee2, Je, Pe, Re, Ie, De, Oe, Ne2, ze, Le, Me, Te, qe, Ue, Be2, We, Ae, $e, Ve, He, Fe, Ge, _e, Qe, Ke, Xe, Ye, Ze, en, nn2, tn2, on2, rn2, an, sn, cn, ln2, dn2, pn2, un2, mn2, bn2, gn2, fn2, hn2, vn2, Sn2, yn2, wn2, kn2, xn2, Cn2, jn2, En2, Jn2, Pn2, Rn2, In2, Dn2, On2, Nn2, zn2, Ln2, Mn2, Tn2, qn2, Un2, Bn2, Wn2, An2, $n2, Vn2, Hn2, Fn2, Gn2, _n2, Qn2, Kn2, Xn2, Yn2, Zn2, ei2, ni2, ii2, ti2, oi2, ri2, ai2, si2, ci2, li2, di2, pi2, ui2, mi2, bi2, gi2, yi2, wi2, ki2, xi, Ci2, ji2, Ei2, Ji, Ri, Ii, Di, Gi;
|
|
15676
15659
|
var init_dev = __esm({
|
|
15677
15660
|
"../core/dist/dev.mjs"() {
|
|
15678
15661
|
"use strict";
|
|
@@ -15683,7 +15666,7 @@ var init_dev = __esm({
|
|
|
15683
15666
|
for (var t in i2) e2(n4, t, { get: i2[t], enumerable: true });
|
|
15684
15667
|
};
|
|
15685
15668
|
i = {};
|
|
15686
|
-
n2(i, { BaseContextConfig: () =>
|
|
15669
|
+
n2(i, { BaseContextConfig: () => q2, BatchConfig: () => U2, CacheRuleSchema: () => Hn2, CacheSchema: () => Fn2, CacheSchemas: () => Vn2, CodeSchema: () => Ri, CollectorSchemas: () => sn, ConsentSchema: () => K2, ContractActionsSchema: () => di2, ContractSchema: () => mi2, ContractSchemaEntry: () => li2, Counter: () => d2, DeepPartialEventSchema: () => oe, DestinationReferenceSchema: () => si2, DestinationSchemas: () => ze, DestinationsMapConfig: () => A2, EntitiesSchema: () => ne, EntitySchema: () => ee, EventSchema: () => ie2, FlowConfigSchema: () => gi2, FlowSchemas: () => Mn2, FlowSettingsSchema: () => bi2, GenericEnvConfig: () => O, GenericSettingsConfig: () => D2, HandlersConfig: () => j, HintSchema: () => Ii, HintsSchema: () => Di, IdConfig: () => P2, Identifier: () => c, InitConfig: () => R2, LoopSchema: () => fe, MapSchema: () => ve, MappingResultSchema: () => Ce, MappingSchemas: () => me2, MatchExpressionSchema: () => Bn2, MatcherSchemas: () => Tn2, NextRuleSchema: () => $n2, OptionalPrimitiveValue: () => m, OrderedPropertiesSchema: () => _2, PartialEventSchema: () => te, PolicySchema: () => ye, PrimaryConfig: () => I2, PrimitiveSchema: () => Gn2, PrimitiveValue: () => u, ProcessingControlConfig: () => B, PropertiesSchema: () => G, PropertySchema: () => F2, PropertyTypeSchema: () => H, QueueConfig: () => J2, RequiredBoolean: () => s, RequiredNumber: () => a, RequiredString: () => r, RoutableNextSchema: () => An2, RuleSchema: () => we, RulesSchema: () => ke2, RuntimeInstanceConfig: () => T2, SetSchema: () => he, SourceReferenceSchema: () => ri2, SourceSchema: () => Z, SourceSchemas: () => kn2, SourceTypeSchema: () => Q, SourcesMapConfig: () => W, StoreReferenceSchema: () => ci2, TaggingVersion: () => p, Timestamp: () => l2, TransformerReferenceSchema: () => ai2, UserSchema: () => X, UtilitySchemas: () => b, ValueConfigSchema: () => Se2, ValueSchema: () => be, ValuesSchema: () => ge2, VerboseConfig: () => E, VersionSchema: () => Y2, WalkerOSSchemas: () => $2, configJsonSchema: () => yi2, consentJsonSchema: () => ue, contractEntryJsonSchema: () => Ei2, contractJsonSchema: () => Ji, createArraySchema: () => Ai, createConsentConfig: () => M2, createDataTransformationConfig: () => N2, createEnumSchema: () => $i2, createMappingRulesConfig: () => z3, createObjectSchema: () => Bi, createPolicyConfig: () => L2, createTupleSchema: () => Vi, destinationReferenceJsonSchema: () => xi, entityJsonSchema: () => de, eventJsonSchema: () => re, loopJsonSchema: () => Je, mapJsonSchema: () => Re, orderedPropertiesJsonSchema: () => le, parseConfig: () => fi2, parseSettings: () => vi, partialEventJsonSchema: () => ae, policyJsonSchema: () => Ie, propertiesJsonSchema: () => ce, ruleJsonSchema: () => De, rulesJsonSchema: () => Oe, safeParseConfig: () => hi2, safeParseSettings: () => Si, setJsonSchema: () => Pe, settingsJsonSchema: () => wi2, sourceReferenceJsonSchema: () => ki2, sourceTypeJsonSchema: () => pe, storeReferenceJsonSchema: () => ji2, transformerReferenceJsonSchema: () => Ci2, userJsonSchema: () => se, validateFlowConfig: () => Oi2, valueConfigJsonSchema: () => Ee2, valueJsonSchema: () => je2, z: () => external_exports, zodToSchema: () => Hi });
|
|
15687
15670
|
r = external_exports.string();
|
|
15688
15671
|
a = external_exports.number();
|
|
15689
15672
|
s = external_exports.boolean();
|
|
@@ -15694,14 +15677,14 @@ var init_dev = __esm({
|
|
|
15694
15677
|
u = external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]);
|
|
15695
15678
|
m = u.optional();
|
|
15696
15679
|
b = {};
|
|
15697
|
-
n2(b, { ErrorHandlerSchema: () => h, HandlerSchema: () => S, LogHandlerSchema: () => v, StorageSchema: () =>
|
|
15698
|
-
|
|
15699
|
-
|
|
15680
|
+
n2(b, { ErrorHandlerSchema: () => h, HandlerSchema: () => S, LogHandlerSchema: () => v, StorageSchema: () => f, StorageTypeSchema: () => g, errorHandlerJsonSchema: () => k, handlerJsonSchema: () => C2, logHandlerJsonSchema: () => x2, storageJsonSchema: () => w, storageTypeJsonSchema: () => y });
|
|
15681
|
+
g = external_exports.enum(["local", "session", "cookie"]).describe("Storage mechanism: local, session, or cookie");
|
|
15682
|
+
f = external_exports.object({ Local: external_exports.literal("local"), Session: external_exports.literal("session"), Cookie: external_exports.literal("cookie") }).describe("Storage type constants for type-safe references");
|
|
15700
15683
|
h = external_exports.any().describe("Error handler function: (error, state?) => void");
|
|
15701
15684
|
v = external_exports.any().describe("Log handler function: (message, verbose?) => void");
|
|
15702
15685
|
S = external_exports.object({ Error: h.describe("Error handler function"), Log: v.describe("Log handler function") }).describe("Handler interface with error and log functions");
|
|
15703
|
-
y = o(
|
|
15704
|
-
w = o(
|
|
15686
|
+
y = o(g);
|
|
15687
|
+
w = o(f);
|
|
15705
15688
|
k = o(h);
|
|
15706
15689
|
x2 = o(v);
|
|
15707
15690
|
C2 = o(S);
|
|
@@ -15710,168 +15693,171 @@ var init_dev = __esm({
|
|
|
15710
15693
|
J2 = external_exports.object({ queue: external_exports.boolean().describe("Whether to queue events when consent is not granted").optional() }).partial();
|
|
15711
15694
|
P2 = external_exports.object({}).partial();
|
|
15712
15695
|
R2 = external_exports.object({ init: external_exports.boolean().describe("Whether to initialize immediately").optional(), loadScript: external_exports.boolean().describe("Whether to load external script (for web destinations)").optional() }).partial();
|
|
15713
|
-
|
|
15714
|
-
|
|
15696
|
+
I2 = external_exports.object({ primary: external_exports.boolean().describe("Mark as primary (only one can be primary)").optional() }).partial();
|
|
15697
|
+
D2 = external_exports.object({ settings: external_exports.any().optional().describe("Implementation-specific configuration") }).partial();
|
|
15715
15698
|
O = external_exports.object({ env: external_exports.any().optional().describe("Environment dependencies (platform-specific)") }).partial();
|
|
15716
|
-
|
|
15717
|
-
|
|
15699
|
+
T2 = external_exports.object({ type: external_exports.string().optional().describe("Instance type identifier"), config: external_exports.unknown().describe("Instance configuration") }).partial();
|
|
15700
|
+
q2 = external_exports.object({ collector: external_exports.unknown().describe("Collector instance (runtime object)"), config: external_exports.unknown().describe("Configuration"), env: external_exports.unknown().describe("Environment dependencies") }).partial();
|
|
15718
15701
|
U2 = external_exports.object({ batch: external_exports.number().optional().describe("Batch size: bundle N events for batch processing"), batched: external_exports.unknown().optional().describe("Batch of events to be processed") }).partial();
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
n2(
|
|
15702
|
+
B = external_exports.object({ ignore: external_exports.boolean().describe("Set to true to skip processing").optional(), condition: external_exports.string().optional().describe("Condition function: return true to process") }).partial();
|
|
15703
|
+
W = external_exports.object({ sources: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of source instances") }).partial();
|
|
15704
|
+
A2 = external_exports.object({ destinations: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of destination instances") }).partial();
|
|
15705
|
+
$2 = {};
|
|
15706
|
+
n2($2, { ConsentSchema: () => K2, DeepPartialEventSchema: () => oe, EntitiesSchema: () => ne, EntitySchema: () => ee, EventSchema: () => ie2, OrderedPropertiesSchema: () => _2, PartialEventSchema: () => te, PropertiesSchema: () => G, PropertySchema: () => F2, PropertyTypeSchema: () => H, SourceSchema: () => Z, SourceTypeSchema: () => Q, UserSchema: () => X, VersionSchema: () => Y2, consentJsonSchema: () => ue, entityJsonSchema: () => de, eventJsonSchema: () => re, orderedPropertiesJsonSchema: () => le, partialEventJsonSchema: () => ae, propertiesJsonSchema: () => ce, sourceTypeJsonSchema: () => pe, userJsonSchema: () => se });
|
|
15724
15707
|
H = external_exports.lazy(() => external_exports.union([external_exports.boolean(), external_exports.string(), external_exports.number(), external_exports.record(external_exports.string(), F2)]));
|
|
15725
15708
|
F2 = external_exports.lazy(() => external_exports.union([H, external_exports.array(H)]));
|
|
15726
15709
|
G = external_exports.record(external_exports.string(), F2.optional()).describe("Flexible property collection with optional values");
|
|
15727
|
-
|
|
15710
|
+
_2 = external_exports.record(external_exports.string(), external_exports.tuple([F2, external_exports.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control");
|
|
15728
15711
|
Q = external_exports.union([external_exports.enum(["web", "server", "app", "other"]), external_exports.string()]).describe("Source type: web, server, app, other, or custom");
|
|
15729
|
-
|
|
15712
|
+
K2 = external_exports.record(external_exports.string(), external_exports.boolean()).describe("Consent requirement mapping (group name \u2192 state)");
|
|
15730
15713
|
X = G.and(external_exports.object({ id: external_exports.string().optional().describe("User identifier"), device: external_exports.string().optional().describe("Device identifier"), session: external_exports.string().optional().describe("Session identifier"), hash: external_exports.string().optional().describe("Hashed identifier"), address: external_exports.string().optional().describe("User address"), email: external_exports.string().email().optional().describe("User email address"), phone: external_exports.string().optional().describe("User phone number"), userAgent: external_exports.string().optional().describe("Browser user agent string"), browser: external_exports.string().optional().describe("Browser name"), browserVersion: external_exports.string().optional().describe("Browser version"), deviceType: external_exports.string().optional().describe("Device type (mobile, desktop, tablet)"), os: external_exports.string().optional().describe("Operating system"), osVersion: external_exports.string().optional().describe("Operating system version"), screenSize: external_exports.string().optional().describe("Screen dimensions"), language: external_exports.string().optional().describe("User language"), country: external_exports.string().optional().describe("User country"), region: external_exports.string().optional().describe("User region/state"), city: external_exports.string().optional().describe("User city"), zip: external_exports.string().optional().describe("User postal code"), timezone: external_exports.string().optional().describe("User timezone"), ip: external_exports.string().optional().describe("User IP address"), internal: external_exports.boolean().optional().describe("Internal user flag (employee, test user)") })).describe("User identification and properties");
|
|
15731
15714
|
Y2 = G.and(external_exports.object({ source: r.describe('Walker implementation version (e.g., "2.0.0")'), tagging: p })).describe("Walker version information");
|
|
15732
|
-
|
|
15733
|
-
ee = external_exports.lazy(() => external_exports.object({ entity: external_exports.string().describe("Entity name"), data: G.describe("Entity-specific properties"), nested: external_exports.array(ee).describe("Nested child entities"), context:
|
|
15715
|
+
Z = G.and(external_exports.object({ type: Q.describe("Source type identifier"), id: r.describe("Source identifier (typically URL on web)"), previous_id: r.describe("Previous source identifier (typically referrer on web)") })).describe("Event source information");
|
|
15716
|
+
ee = external_exports.lazy(() => external_exports.object({ entity: external_exports.string().describe("Entity name"), data: G.describe("Entity-specific properties"), nested: external_exports.array(ee).describe("Nested child entities"), context: _2.describe("Entity context data") })).describe("Nested entity structure with recursive nesting support");
|
|
15734
15717
|
ne = external_exports.array(ee).describe("Array of nested entities");
|
|
15735
|
-
ie2 = external_exports.object({ name: external_exports.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: G.describe("Event-specific properties"), context:
|
|
15718
|
+
ie2 = external_exports.object({ name: external_exports.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: G.describe("Event-specific properties"), context: _2.describe("Ordered context properties with priorities"), globals: G.describe("Global properties shared across events"), custom: G.describe("Custom implementation-specific properties"), user: X.describe("User identification and attributes"), nested: ne.describe("Related nested entities"), consent: K2.describe("Consent states at event time"), id: c.describe("Unique event identifier (timestamp-based)"), trigger: r.describe("Event trigger identifier"), entity: r.describe("Parsed entity from event name"), action: r.describe("Parsed action from event name"), timestamp: l2.describe("Unix timestamp in milliseconds since epoch"), timing: a.describe("Event processing timing information"), group: r.describe("Event grouping identifier"), count: d2.describe("Event count in session"), version: Y2.describe("Walker version information"), source: Z.describe("Event source information") }).describe("Complete walkerOS event structure");
|
|
15736
15719
|
te = ie2.partial().describe("Partial event structure with all fields optional");
|
|
15737
15720
|
oe = ie2.partial().describe("Partial event structure with all top-level fields optional");
|
|
15738
15721
|
re = o(ie2);
|
|
15739
15722
|
ae = o(te);
|
|
15740
15723
|
se = o(X);
|
|
15741
15724
|
ce = o(G);
|
|
15742
|
-
le = o(
|
|
15725
|
+
le = o(_2);
|
|
15743
15726
|
de = o(ee);
|
|
15744
15727
|
pe = o(Q);
|
|
15745
|
-
ue = o(
|
|
15728
|
+
ue = o(K2);
|
|
15746
15729
|
me2 = {};
|
|
15747
|
-
n2(me2, { ConfigSchema: () => xe2, LoopSchema: () =>
|
|
15730
|
+
n2(me2, { ConfigSchema: () => xe2, LoopSchema: () => fe, MapSchema: () => ve, PolicySchema: () => ye, ResultSchema: () => Ce, RuleSchema: () => we, RulesSchema: () => ke2, SetSchema: () => he, ValueConfigSchema: () => Se2, ValueSchema: () => be, ValuesSchema: () => ge2, configJsonSchema: () => Ne2, loopJsonSchema: () => Je, mapJsonSchema: () => Re, policyJsonSchema: () => Ie, ruleJsonSchema: () => De, rulesJsonSchema: () => Oe, setJsonSchema: () => Pe, valueConfigJsonSchema: () => Ee2, valueJsonSchema: () => je2 });
|
|
15748
15731
|
be = external_exports.lazy(() => external_exports.union([external_exports.string().describe('String value or property path (e.g., "data.id")'), external_exports.number().describe("Numeric value"), external_exports.boolean().describe("Boolean value"), external_exports.lazy(() => V), external_exports.array(be).describe("Array of values")]));
|
|
15749
|
-
|
|
15750
|
-
|
|
15751
|
-
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
|
|
15755
|
-
we = external_exports.object({ batch: external_exports.number().optional().describe("Batch size: bundle N events for batch processing"), condition: external_exports.string().optional().describe("Condition function as string: return true to process event"), consent:
|
|
15756
|
-
|
|
15757
|
-
xe2 = external_exports.object({ consent:
|
|
15732
|
+
ge2 = external_exports.array(be).describe("Array of transformation values");
|
|
15733
|
+
fe = external_exports.lazy(() => external_exports.tuple([be, be]).describe("Loop transformation: [source, transform] tuple for array processing"));
|
|
15734
|
+
he = external_exports.lazy(() => external_exports.array(be).describe("Set: Array of values for selection or combination"));
|
|
15735
|
+
ve = external_exports.lazy(() => external_exports.record(external_exports.string(), be).describe("Map: Object mapping keys to transformation values"));
|
|
15736
|
+
Se2 = V = external_exports.object({ key: external_exports.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]).optional().describe("Static primitive value"), fn: external_exports.string().optional().describe("Custom transformation function as string (serialized)"), map: ve.optional().describe("Object mapping: transform event data to structured output"), loop: fe.optional().describe("Loop transformation: [source, transform] for array processing"), set: he.optional().describe("Set of values: combine or select from multiple values"), consent: K2.optional().describe("Required consent states to include this value"), condition: external_exports.string().optional().describe("Condition function as string: return true to include value"), validate: external_exports.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" }).describe("Value transformation configuration with multiple strategies");
|
|
15737
|
+
ye = external_exports.record(external_exports.string(), be).describe("Policy rules for event pre-processing (key \u2192 value mapping)");
|
|
15738
|
+
we = external_exports.object({ batch: external_exports.number().optional().describe("Batch size: bundle N events for batch processing"), condition: external_exports.string().optional().describe("Condition function as string: return true to process event"), consent: K2.optional().describe("Required consent states to process this event"), settings: external_exports.any().optional().describe("Destination-specific settings for this event mapping"), data: external_exports.union([be, ge2]).optional().describe("Data transformation rules for event"), ignore: external_exports.boolean().optional().describe("Set to true to skip processing this event"), name: external_exports.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), policy: ye.optional().describe("Event-level policy overrides (applied after config-level policy)") }).describe("Mapping rule for specific entity-action combination");
|
|
15739
|
+
ke2 = external_exports.record(external_exports.string(), external_exports.record(external_exports.string(), external_exports.union([we, external_exports.array(we)])).optional()).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*).');
|
|
15740
|
+
xe2 = external_exports.object({ consent: K2.optional().describe("Required consent states to process any events"), data: external_exports.union([be, ge2]).optional().describe("Global data transformation applied to all events"), mapping: ke2.optional().describe("Entity-action specific mapping rules"), policy: ye.optional().describe("Pre-processing policy rules applied before mapping") }).describe("Shared mapping configuration for sources and destinations");
|
|
15758
15741
|
Ce = external_exports.object({ eventMapping: we.optional().describe("Resolved mapping rule for event"), mappingKey: external_exports.string().optional().describe('Mapping key used (e.g., "product.view")') }).describe("Mapping resolution result");
|
|
15759
|
-
|
|
15760
|
-
|
|
15761
|
-
Je = o(
|
|
15762
|
-
Pe = o(
|
|
15763
|
-
Re = o(
|
|
15764
|
-
|
|
15765
|
-
|
|
15766
|
-
Oe = o(
|
|
15767
|
-
|
|
15742
|
+
je2 = o(be);
|
|
15743
|
+
Ee2 = o(Se2);
|
|
15744
|
+
Je = o(fe);
|
|
15745
|
+
Pe = o(he);
|
|
15746
|
+
Re = o(ve);
|
|
15747
|
+
Ie = o(ye);
|
|
15748
|
+
De = o(we);
|
|
15749
|
+
Oe = o(ke2);
|
|
15750
|
+
Ne2 = o(xe2);
|
|
15768
15751
|
ze = {};
|
|
15769
|
-
n2(ze, { BatchSchema: () =>
|
|
15770
|
-
Le = external_exports.object({ consent:
|
|
15771
|
-
|
|
15772
|
-
|
|
15773
|
-
|
|
15774
|
-
Ue =
|
|
15775
|
-
|
|
15776
|
-
|
|
15777
|
-
|
|
15778
|
-
|
|
15752
|
+
n2(ze, { BatchSchema: () => $e, ConfigSchema: () => Le, ContextSchema: () => qe, DLQSchema: () => Ye, DataSchema: () => Ve, DestinationPolicySchema: () => Te, DestinationsSchema: () => _e, InitDestinationsSchema: () => Ge, InitSchema: () => Fe, InstanceSchema: () => He, PartialConfigSchema: () => Me, PushBatchContextSchema: () => Be2, PushContextSchema: () => Ue, PushEventSchema: () => We, PushEventsSchema: () => Ae, PushResultSchema: () => Ke, RefSchema: () => Qe, ResultSchema: () => Xe, batchJsonSchema: () => on2, configJsonSchema: () => Ze, contextJsonSchema: () => nn2, instanceJsonSchema: () => rn2, partialConfigJsonSchema: () => en, pushContextJsonSchema: () => tn2, resultJsonSchema: () => an });
|
|
15753
|
+
Le = external_exports.object({ consent: K2.optional().describe("Required consent states to send events to this destination"), settings: external_exports.any().describe("Implementation-specific configuration").optional(), data: external_exports.union([be, ge2]).optional().describe("Global data transformation applied to all events for this destination"), env: external_exports.any().describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Destination instance identifier (defaults to destination key)").optional(), init: external_exports.boolean().describe("Whether to initialize immediately").optional(), loadScript: external_exports.boolean().describe("Whether to load external script (for web destinations)").optional(), mapping: ke2.optional().describe("Entity-action specific mapping rules for this destination"), policy: ye.optional().describe("Pre-processing policy rules applied before event mapping"), queue: external_exports.boolean().describe("Whether to queue events when consent is not granted").optional(), require: external_exports.array(external_exports.string()).optional().describe('Defer destination initialization until these collector events fire (e.g., ["consent"])'), logger: external_exports.object({ level: external_exports.union([external_exports.number(), external_exports.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: external_exports.any().optional().describe("Custom log handler function") }).optional().describe("Logger configuration (level, handler) to override the collector defaults"), onError: h.optional(), onLog: v.optional() }).describe("Destination configuration");
|
|
15754
|
+
Me = Le.partial().describe("Partial destination configuration with all fields optional");
|
|
15755
|
+
Te = ye.describe("Destination policy rules for event pre-processing");
|
|
15756
|
+
qe = external_exports.object({ collector: external_exports.unknown().describe("Collector instance (runtime object)"), config: Le.describe("Destination configuration"), data: external_exports.union([external_exports.unknown(), external_exports.array(external_exports.unknown())]).optional().describe("Transformed event data"), env: external_exports.unknown().describe("Environment dependencies") }).describe("Destination context for init and push functions");
|
|
15757
|
+
Ue = qe.extend({ mapping: we.optional().describe("Resolved mapping rule for this specific event") }).describe("Push context with event-specific mapping");
|
|
15758
|
+
Be2 = Ue.describe("Batch push context with event-specific mapping");
|
|
15759
|
+
We = external_exports.object({ event: ie2.describe("The event to process"), mapping: we.optional().describe("Mapping rule for this event") }).describe("Event with optional mapping for batch processing");
|
|
15760
|
+
Ae = external_exports.array(We).describe("Array of events with mappings");
|
|
15761
|
+
$e = external_exports.object({ key: external_exports.string().describe('Batch key (usually mapping key like "product.view")'), events: external_exports.array(ie2).describe("Array of events in batch"), data: external_exports.array(external_exports.union([external_exports.unknown(), external_exports.array(external_exports.unknown())]).optional()).describe("Transformed data for each event"), mapping: we.optional().describe("Shared mapping rule for batch") }).describe("Batch of events grouped by mapping key");
|
|
15779
15762
|
Ve = external_exports.union([external_exports.unknown(), external_exports.array(external_exports.unknown())]).optional().describe("Transformed event data (Property, undefined, or array)");
|
|
15780
15763
|
He = external_exports.object({ config: Le.describe("Destination configuration"), queue: external_exports.array(ie2).optional().describe("Queued events awaiting consent"), dlq: external_exports.array(external_exports.tuple([ie2, external_exports.unknown()])).optional().describe("Dead letter queue (failed events with errors)"), type: external_exports.string().optional().describe("Destination type identifier"), env: external_exports.unknown().optional().describe("Environment dependencies"), init: external_exports.unknown().optional().describe("Initialization function"), push: external_exports.unknown().describe("Push function for single events"), pushBatch: external_exports.unknown().optional().describe("Batch push function"), on: external_exports.unknown().optional().describe("Event lifecycle hook function") }).describe("Destination instance (runtime object with functions)");
|
|
15781
|
-
Fe = external_exports.object({ code: He.describe("Destination instance with implementation"), config:
|
|
15782
|
-
|
|
15764
|
+
Fe = external_exports.object({ code: He.describe("Destination instance with implementation"), config: Me.optional().describe("Partial configuration overrides"), env: external_exports.unknown().optional().describe("Partial environment overrides") }).describe("Destination initialization configuration");
|
|
15765
|
+
Ge = external_exports.record(external_exports.string(), Fe).describe("Map of destination IDs to initialization configurations");
|
|
15783
15766
|
_e = external_exports.record(external_exports.string(), He).describe("Map of destination IDs to runtime instances");
|
|
15784
|
-
|
|
15767
|
+
Qe = external_exports.object({ type: external_exports.string().describe('Destination type ("gtag", "meta", "bigquery")'), data: external_exports.unknown().optional().describe("Response from push()"), error: external_exports.unknown().optional().describe("Error if failed") }).describe("Destination reference with type and response data");
|
|
15785
15768
|
Ke = external_exports.object({ queue: external_exports.array(ie2).optional().describe("Events queued (awaiting consent)"), error: external_exports.unknown().optional().describe("Error if push failed") }).describe("Push operation result");
|
|
15786
|
-
|
|
15769
|
+
Xe = external_exports.object({ ok: external_exports.boolean().describe("True if nothing failed"), event: external_exports.unknown().optional().describe("The processed event"), done: external_exports.record(external_exports.string(), Qe).optional().describe("Destinations that processed successfully"), queued: external_exports.record(external_exports.string(), Qe).optional().describe("Destinations that queued events"), failed: external_exports.record(external_exports.string(), Qe).optional().describe("Destinations that failed to process") }).describe("Push result with destination outcomes");
|
|
15787
15770
|
Ye = external_exports.array(external_exports.tuple([ie2, external_exports.unknown()])).describe("Dead letter queue: [(event, error), ...]");
|
|
15788
|
-
|
|
15789
|
-
en = o(
|
|
15790
|
-
|
|
15771
|
+
Ze = o(Le);
|
|
15772
|
+
en = o(Me);
|
|
15773
|
+
nn2 = o(qe);
|
|
15791
15774
|
tn2 = o(Ue);
|
|
15792
|
-
on2 = o(
|
|
15775
|
+
on2 = o($e);
|
|
15793
15776
|
rn2 = o(He);
|
|
15794
|
-
an = o(
|
|
15795
|
-
|
|
15796
|
-
n2(
|
|
15797
|
-
|
|
15777
|
+
an = o(Xe);
|
|
15778
|
+
sn = {};
|
|
15779
|
+
n2(sn, { CommandTypeSchema: () => cn, ConfigSchema: () => ln2, DestinationsSchema: () => bn2, InitConfigSchema: () => pn2, InstanceSchema: () => gn2, PushContextSchema: () => un2, SessionDataSchema: () => dn2, SourcesSchema: () => mn2, commandTypeJsonSchema: () => fn2, configJsonSchema: () => hn2, initConfigJsonSchema: () => Sn2, instanceJsonSchema: () => wn2, pushContextJsonSchema: () => yn2, sessionDataJsonSchema: () => vn2 });
|
|
15780
|
+
cn = external_exports.union([external_exports.enum(["action", "config", "consent", "context", "destination", "elb", "globals", "hook", "init", "link", "run", "user", "walker"]), external_exports.string()]).describe("Collector command type: standard commands or custom string for extensions");
|
|
15798
15781
|
ln2 = external_exports.object({ run: external_exports.boolean().describe("Whether to run collector automatically on initialization").optional(), tagging: p, globalsStatic: G.describe("Static global properties that persist across collector runs"), sessionStatic: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Static session data that persists across collector runs"), verbose: external_exports.boolean().describe("Enable verbose logging for debugging"), onError: h.optional(), onLog: v.optional() }).describe("Core collector configuration");
|
|
15799
15782
|
dn2 = G.and(external_exports.object({ isStart: external_exports.boolean().describe("Whether this is a new session start"), storage: external_exports.boolean().describe("Whether storage is available"), id: c.describe("Session identifier").optional(), start: l2.describe("Session start timestamp").optional(), marketing: external_exports.literal(true).optional().describe("Marketing attribution flag"), updated: l2.describe("Last update timestamp").optional(), isNew: external_exports.boolean().describe("Whether this is a new session").optional(), device: c.describe("Device identifier").optional(), count: d2.describe("Event count in session").optional(), runs: d2.describe("Number of runs").optional() })).describe("Session state and tracking data");
|
|
15800
|
-
pn2 = ln2.partial().extend({ consent:
|
|
15783
|
+
pn2 = ln2.partial().extend({ consent: K2.optional().describe("Initial consent state"), user: X.optional().describe("Initial user data"), globals: G.optional().describe("Initial global properties"), sources: external_exports.unknown().optional().describe("Source configurations"), destinations: external_exports.unknown().optional().describe("Destination configurations"), custom: G.optional().describe("Initial custom implementation-specific properties") }).describe("Collector initialization configuration with initial state");
|
|
15801
15784
|
un2 = external_exports.object({ mapping: xe2.optional().describe("Source-level mapping configuration") }).describe("Push context with optional source mapping");
|
|
15802
15785
|
mn2 = external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of source IDs to source instances");
|
|
15803
15786
|
bn2 = external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of destination IDs to destination instances");
|
|
15804
|
-
|
|
15805
|
-
|
|
15787
|
+
gn2 = external_exports.object({ push: external_exports.unknown().describe("Push function for processing events"), command: external_exports.unknown().describe("Command function for walker commands"), allowed: external_exports.boolean().describe("Whether event processing is allowed"), config: ln2.describe("Current collector configuration"), consent: K2.describe("Current consent state"), count: external_exports.number().describe("Event count (increments with each event)"), custom: G.describe("Custom implementation-specific properties"), sources: mn2.describe("Registered source instances"), destinations: bn2.describe("Registered destination instances"), globals: G.describe("Current global properties"), group: external_exports.string().describe("Event grouping identifier"), hooks: external_exports.unknown().describe("Lifecycle hook functions"), on: external_exports.unknown().describe("Event lifecycle configuration"), queue: external_exports.array(ie2).describe("Queued events awaiting processing"), round: external_exports.number().describe("Collector run count (increments with each run)"), session: external_exports.union([dn2]).describe("Current session state"), timing: external_exports.number().describe("Event processing timing information"), user: X.describe("Current user data"), version: external_exports.string().describe("Walker implementation version") }).describe("Collector instance with state and methods");
|
|
15788
|
+
fn2 = o(cn);
|
|
15806
15789
|
hn2 = o(ln2);
|
|
15807
15790
|
vn2 = o(dn2);
|
|
15808
15791
|
Sn2 = o(pn2);
|
|
15809
15792
|
yn2 = o(un2);
|
|
15810
|
-
wn2 = o(
|
|
15793
|
+
wn2 = o(gn2);
|
|
15811
15794
|
kn2 = {};
|
|
15812
|
-
n2(kn2, { BaseEnvSchema: () => xn2, ConfigSchema: () => Cn2, InitSchema: () => Jn2, InitSourceSchema: () => Pn2, InitSourcesSchema: () => Rn2, InstanceSchema: () => En2, PartialConfigSchema: () => jn2, baseEnvJsonSchema: () =>
|
|
15795
|
+
n2(kn2, { BaseEnvSchema: () => xn2, ConfigSchema: () => Cn2, InitSchema: () => Jn2, InitSourceSchema: () => Pn2, InitSourcesSchema: () => Rn2, InstanceSchema: () => En2, PartialConfigSchema: () => jn2, baseEnvJsonSchema: () => In2, configJsonSchema: () => Dn2, initSourceJsonSchema: () => zn2, initSourcesJsonSchema: () => Ln2, instanceJsonSchema: () => Nn2, partialConfigJsonSchema: () => On2 });
|
|
15813
15796
|
xn2 = external_exports.object({ push: external_exports.unknown().describe("Collector push function"), command: external_exports.unknown().describe("Collector command function"), sources: external_exports.unknown().optional().describe("Map of registered source instances"), elb: external_exports.unknown().describe("Public API function (alias for collector.push)") }).catchall(external_exports.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this");
|
|
15814
|
-
Cn2 = xe2.extend({ settings: external_exports.any().describe("Implementation-specific configuration").optional(), env: xn2.optional().describe("Environment dependencies (platform-specific)"), id: c.describe("Source identifier (defaults to source key)").optional(), onError: h.optional(), primary: external_exports.boolean().describe("Mark as primary (only one can be primary)").optional(), require: external_exports.array(external_exports.string()).optional().describe('Defer source initialization until these collector events fire (e.g., ["consent"])'), logger: external_exports.object({ level: external_exports.union([external_exports.number(), external_exports.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: external_exports.any().optional().describe("Custom log handler function") }).optional().describe("Logger configuration (level, handler) to override the collector defaults"), ingest: external_exports.union([be,
|
|
15797
|
+
Cn2 = xe2.extend({ settings: external_exports.any().describe("Implementation-specific configuration").optional(), env: xn2.optional().describe("Environment dependencies (platform-specific)"), id: c.describe("Source identifier (defaults to source key)").optional(), onError: h.optional(), primary: external_exports.boolean().describe("Mark as primary (only one can be primary)").optional(), require: external_exports.array(external_exports.string()).optional().describe('Defer source initialization until these collector events fire (e.g., ["consent"])'), logger: external_exports.object({ level: external_exports.union([external_exports.number(), external_exports.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: external_exports.any().optional().describe("Custom log handler function") }).optional().describe("Logger configuration (level, handler) to override the collector defaults"), ingest: external_exports.union([be, ge2]).optional().describe("Ingest metadata extraction mapping. Extracts values from raw request objects (Express req, Lambda event) using mapping syntax.") }).describe("Source configuration with mapping and environment");
|
|
15815
15798
|
jn2 = Cn2.partial().describe("Partial source configuration with all fields optional");
|
|
15816
15799
|
En2 = external_exports.object({ type: external_exports.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Cn2.describe("Current source configuration"), push: external_exports.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"), destroy: external_exports.any().optional().describe("Cleanup function called when source is removed"), on: external_exports.unknown().optional().describe("Lifecycle hook function for event types") }).describe("Source instance with push handler and lifecycle methods");
|
|
15817
15800
|
Jn2 = external_exports.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>");
|
|
15818
15801
|
Pn2 = external_exports.object({ code: Jn2.describe("Source initialization function"), config: jn2.optional().describe("Partial configuration overrides"), env: xn2.partial().optional().describe("Partial environment overrides"), primary: external_exports.boolean().optional().describe("Mark as primary source (only one can be primary)") }).describe("Source initialization configuration");
|
|
15819
15802
|
Rn2 = external_exports.record(external_exports.string(), Pn2).describe("Map of source IDs to initialization configurations");
|
|
15820
|
-
|
|
15821
|
-
|
|
15803
|
+
In2 = o(xn2);
|
|
15804
|
+
Dn2 = o(Cn2);
|
|
15822
15805
|
On2 = o(jn2);
|
|
15823
15806
|
Nn2 = o(En2);
|
|
15824
15807
|
zn2 = o(Pn2);
|
|
15825
15808
|
Ln2 = o(Rn2);
|
|
15826
|
-
qn2 = {};
|
|
15827
|
-
n2(qn2, { ConfigSchema: () => ui, ContractActionsSchema: () => si2, ContractEntrySchema: () => li2, ContractEventsSchema: () => ci2, ContractSchema: () => di2, ContractSchemaEntry: () => ai2, DefinitionsSchema: () => Qn2, DestinationReferenceSchema: () => oi2, InlineCodeSchema: () => Zn2, PackagesSchema: () => Kn2, PrimitiveSchema: () => Gn2, ServerSchema: () => Yn2, SettingsSchema: () => pi2, SourceReferenceSchema: () => ii2, StepExampleSchema: () => ei2, StepExamplesSchema: () => ni2, StoreReferenceSchema: () => ri2, TransformerReferenceSchema: () => ti2, VariablesSchema: () => _n2, WebSchema: () => Xn2, configJsonSchema: () => hi, contractEntryJsonSchema: () => xi, contractJsonSchema: () => Ci, destinationReferenceJsonSchema: () => yi2, parseConfig: () => mi, parseSettings: () => fi2, safeParseConfig: () => bi2, safeParseSettings: () => gi2, settingsJsonSchema: () => vi2, sourceReferenceJsonSchema: () => Si, storeReferenceJsonSchema: () => ki2, transformerReferenceJsonSchema: () => wi2 });
|
|
15828
15809
|
Mn2 = {};
|
|
15829
|
-
n2(Mn2, {
|
|
15830
|
-
Tn2 =
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15810
|
+
n2(Mn2, { BundleSchema: () => Zn2, ConfigSchema: () => gi2, ContractActionsSchema: () => di2, ContractEntrySchema: () => ui2, ContractEventsSchema: () => pi2, ContractSchema: () => mi2, ContractSchemaEntry: () => li2, DefinitionsSchema: () => Qn2, DestinationReferenceSchema: () => si2, InlineCodeSchema: () => ii2, OverridesSchema: () => Yn2, PackagesSchema: () => Xn2, PrimitiveSchema: () => Gn2, ServerSchema: () => ni2, SettingsSchema: () => bi2, SourceReferenceSchema: () => ri2, StepExampleSchema: () => ti2, StepExamplesSchema: () => oi2, StoreReferenceSchema: () => ci2, TransformerReferenceSchema: () => ai2, VariablesSchema: () => _n2, WebSchema: () => ei2, configJsonSchema: () => yi2, contractEntryJsonSchema: () => Ei2, contractJsonSchema: () => Ji, destinationReferenceJsonSchema: () => xi, parseConfig: () => fi2, parseSettings: () => vi, safeParseConfig: () => hi2, safeParseSettings: () => Si, settingsJsonSchema: () => wi2, sourceReferenceJsonSchema: () => ki2, storeReferenceJsonSchema: () => ji2, transformerReferenceJsonSchema: () => Ci2 });
|
|
15811
|
+
Tn2 = {};
|
|
15812
|
+
n2(Tn2, { MatchExpressionSchema: () => Bn2, NextRuleSchema: () => $n2, RoutableNextSchema: () => An2 });
|
|
15813
|
+
qn2 = external_exports.enum(["eq", "contains", "prefix", "suffix", "regex", "gt", "lt", "exists"]);
|
|
15814
|
+
Un2 = external_exports.object({ key: external_exports.string(), operator: qn2, value: external_exports.string(), not: external_exports.boolean().optional() });
|
|
15815
|
+
Bn2 = external_exports.union([Un2, external_exports.object({ and: external_exports.array(external_exports.lazy(() => Bn2)) }), external_exports.object({ or: external_exports.array(external_exports.lazy(() => Bn2)) })]);
|
|
15816
|
+
Wn2 = external_exports.union([Bn2, external_exports.literal("*")]);
|
|
15817
|
+
An2 = external_exports.union([external_exports.string(), external_exports.array(external_exports.string()), external_exports.array(external_exports.object({ match: Wn2, next: external_exports.lazy(() => An2) }))]);
|
|
15818
|
+
$n2 = external_exports.object({ match: Wn2, next: external_exports.lazy(() => An2) });
|
|
15836
15819
|
Vn2 = {};
|
|
15837
15820
|
n2(Vn2, { CacheRuleSchema: () => Hn2, CacheSchema: () => Fn2 });
|
|
15838
|
-
Hn2 = external_exports.object({ match: external_exports.union([
|
|
15821
|
+
Hn2 = external_exports.object({ match: external_exports.union([Bn2, external_exports.literal("*")]).describe("Match expression or wildcard to determine when this rule applies"), key: external_exports.array(external_exports.string()).min(1).describe("Dot-path fields used to build the cache key"), ttl: external_exports.number().positive().describe("Time-to-live in seconds for cached entries"), update: external_exports.record(external_exports.string(), be).optional().describe("Response mutations applied on cache hit (key \u2192 Value mapping)") });
|
|
15839
15822
|
Fn2 = external_exports.object({ full: external_exports.boolean().optional().describe("Stop flow on cache HIT (default: false). When true, skip remaining steps and return cached value."), store: external_exports.string().optional().describe("Store ID for persistent caching (references a configured store)"), rules: external_exports.array(Hn2).min(1).describe("Cache rules \u2014 at least one required") });
|
|
15840
15823
|
Gn2 = external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]).describe("Primitive value: string, number, or boolean");
|
|
15841
15824
|
_n2 = external_exports.record(external_exports.string(), Gn2).describe("Variables for interpolation");
|
|
15842
15825
|
Qn2 = external_exports.record(external_exports.string(), external_exports.unknown()).describe("Reusable configuration definitions");
|
|
15843
|
-
Kn2 =
|
|
15844
|
-
Xn2 = external_exports.
|
|
15845
|
-
Yn2 = external_exports.
|
|
15846
|
-
Zn2 = external_exports.object({
|
|
15847
|
-
ei2 = external_exports.object({
|
|
15848
|
-
ni2 = external_exports.
|
|
15849
|
-
ii2 = external_exports.object({
|
|
15850
|
-
ti2 = external_exports.object({
|
|
15851
|
-
oi2 = external_exports.
|
|
15852
|
-
ri2 = external_exports.object({ package: external_exports.string().min(1, "Package name cannot be empty").optional().describe(
|
|
15853
|
-
ai2 = external_exports.
|
|
15854
|
-
si2 = external_exports.
|
|
15855
|
-
ci2 = external_exports.
|
|
15856
|
-
li2 = external_exports.
|
|
15857
|
-
di2 = external_exports.record(external_exports.string(), li2).describe("
|
|
15858
|
-
pi2 = external_exports.
|
|
15826
|
+
Kn2 = /^(@[a-z0-9\-~][a-z0-9\-._~]*\/)?[a-z0-9\-~][a-z0-9\-._~]*$/;
|
|
15827
|
+
Xn2 = external_exports.record(external_exports.string().regex(Kn2, "Invalid npm package name"), external_exports.object({ version: external_exports.string().optional(), imports: external_exports.array(external_exports.string()).optional(), path: external_exports.string().optional() })).describe("NPM packages to bundle");
|
|
15828
|
+
Yn2 = external_exports.record(external_exports.string().regex(Kn2, "Invalid npm package name"), external_exports.string().min(1, "Override version cannot be empty")).describe("Transitive dependency version overrides");
|
|
15829
|
+
Zn2 = external_exports.object({ packages: Xn2.optional().describe("NPM packages to bundle"), overrides: Yn2.optional().describe("Transitive dependency overrides") }).strict().describe("Bundle configuration (packages + overrides)");
|
|
15830
|
+
ei2 = external_exports.object({ windowCollector: external_exports.string().default("collector").optional().describe('Window property name for the collector instance (default: "collector")'), windowElb: external_exports.string().default("elb").optional().describe('Window property name for the elb command queue (default: "elb")') }).describe("Web platform configuration");
|
|
15831
|
+
ni2 = external_exports.object({}).passthrough().describe("Server platform configuration (reserved for future options)");
|
|
15832
|
+
ii2 = external_exports.object({ push: external_exports.string().min(1, "Push function cannot be empty").describe('JavaScript function for processing events. Must start with "$code:" prefix. Example: "$code:(event) => { console.log(event); }"'), type: external_exports.string().optional().describe("Optional type identifier for the inline instance"), init: external_exports.string().optional().describe("Optional initialization function. Use $code: prefix for inline JavaScript.") }).describe("Inline code for custom sources/transformers/destinations");
|
|
15833
|
+
ti2 = external_exports.object({ description: external_exports.string().optional().describe("Human-readable description"), in: external_exports.unknown().optional().describe("Input to the step"), trigger: external_exports.object({ type: external_exports.string().optional().describe("Trigger mechanism (e.g., click, POST, load)"), options: external_exports.unknown().optional().describe("Mechanism-specific options") }).optional().describe("Source trigger metadata"), mapping: external_exports.unknown().optional().describe("Mapping configuration"), out: external_exports.unknown().optional().describe("Expected output from the step"), command: external_exports.enum(["config", "consent", "user", "run"]).optional().describe("Invoke elb('walker <command>', in) instead of pushing in as an event") }).describe("Named example with input/output pair");
|
|
15834
|
+
oi2 = external_exports.record(external_exports.string(), ti2).describe("Named step examples for testing and documentation");
|
|
15835
|
+
ri2 = external_exports.object({ package: external_exports.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: external_exports.union([external_exports.string(), ii2]).optional().describe('Either a named export string (e.g., "sourceExpress") or an inline code object with push function'), config: external_exports.unknown().optional().describe("Source-specific configuration object"), env: external_exports.unknown().optional().describe("Source environment configuration"), primary: external_exports.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."), variables: _n2.optional().describe("Source-level variables (highest priority in cascade)"), definitions: Qn2.optional().describe("Source-level definitions (highest priority in cascade)"), next: An2.optional().describe("Pre-collector transformer chain. String, string[], or NextRule[] for conditional routing based on ingest data."), before: An2.optional().describe("Pre-source transformer chain (consent-exempt). Handles transport-level preprocessing."), examples: oi2.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Fn2.optional().describe("Cache configuration for this source (match \u2192 key \u2192 ttl rules)") }).describe("Source package reference with configuration");
|
|
15836
|
+
ai2 = external_exports.object({ package: external_exports.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'), code: external_exports.union([external_exports.string(), ii2]).optional().describe('Either a named export string (e.g., "transformerEnricher") or an inline code object with push function'), config: external_exports.unknown().optional().describe("Transformer-specific configuration object"), env: external_exports.unknown().optional().describe("Transformer environment configuration"), before: An2.optional().describe("Pre-transformer chain. Runs before this transformer push function."), next: An2.optional().describe("Next transformer in chain. String, string[], or NextRule[] for conditional routing."), variables: _n2.optional().describe("Transformer-level variables (highest priority in cascade)"), definitions: Qn2.optional().describe("Transformer-level definitions (highest priority in cascade)"), examples: oi2.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Fn2.optional().describe("Cache configuration for this transformer (match \u2192 key \u2192 ttl rules)") }).describe("Transformer package reference with configuration");
|
|
15837
|
+
si2 = external_exports.object({ package: external_exports.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: external_exports.union([external_exports.string(), ii2]).optional().describe('Either a named export string (e.g., "destinationAnalytics") or an inline code object with push function'), config: external_exports.unknown().optional().describe("Destination-specific configuration object"), env: external_exports.unknown().optional().describe("Destination environment configuration"), variables: _n2.optional().describe("Destination-level variables (highest priority in cascade)"), definitions: Qn2.optional().describe("Destination-level definitions (highest priority in cascade)"), before: An2.optional().describe("Post-collector transformer chain. String, string[], or NextRule[] for conditional routing."), next: An2.optional().describe("Post-push transformer chain. Push response available at context.ingest._response."), examples: oi2.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Fn2.optional().describe("Cache configuration for this destination (match \u2192 key \u2192 ttl rules)") }).describe("Destination package reference with configuration");
|
|
15838
|
+
ci2 = external_exports.object({ package: external_exports.string().min(1, "Package name cannot be empty").optional().describe("Store package specifier with optional version"), code: external_exports.union([external_exports.string(), ii2]).optional().describe("Named export string or inline code definition"), config: external_exports.unknown().optional().describe("Store-specific configuration object"), env: external_exports.unknown().optional().describe("Store environment configuration"), variables: _n2.optional().describe("Store-level variables (highest priority in cascade)"), definitions: Qn2.optional().describe("Store-level definitions (highest priority in cascade)"), examples: oi2.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).describe("Store package reference with configuration");
|
|
15839
|
+
li2 = external_exports.record(external_exports.string(), external_exports.unknown()).describe("JSON Schema object for event validation with description/examples annotations");
|
|
15840
|
+
di2 = external_exports.record(external_exports.string(), li2).describe("Action-level contract entries");
|
|
15841
|
+
pi2 = external_exports.record(external_exports.string(), di2).describe("Entity-action event schemas");
|
|
15842
|
+
ui2 = external_exports.object({ extends: external_exports.string().optional().describe("Inherit from another named contract"), tagging: external_exports.number().int().min(0).optional().describe("Contract version number"), description: external_exports.string().optional().describe("Human-readable description"), globals: li2.optional().describe("JSON Schema for event.globals"), context: li2.optional().describe("JSON Schema for event.context"), custom: li2.optional().describe("JSON Schema for event.custom"), user: li2.optional().describe("JSON Schema for event.user"), consent: li2.optional().describe("JSON Schema for event.consent"), events: pi2.optional().describe("Entity-action event schemas") }).describe("Named contract entry with optional sections and events");
|
|
15843
|
+
mi2 = external_exports.record(external_exports.string(), ui2).describe("Named contracts with optional extends inheritance");
|
|
15844
|
+
bi2 = external_exports.object({ web: ei2.optional().describe("Web platform configuration (browser-based tracking). Mutually exclusive with server."), server: ni2.optional().describe("Server platform configuration (Node.js). Mutually exclusive with web."), sources: external_exports.record(external_exports.string(), ri2).optional().describe("Source configurations (data capture) keyed by unique identifier"), destinations: external_exports.record(external_exports.string(), si2).optional().describe("Destination configurations (data output) keyed by unique identifier"), transformers: external_exports.record(external_exports.string(), ai2).optional().describe("Transformer configurations (event transformation) keyed by unique identifier"), stores: external_exports.record(external_exports.string(), ci2).optional().describe("Store configurations (key-value storage) keyed by unique identifier"), collector: external_exports.unknown().optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"), bundle: Zn2.optional().describe("Build-time configuration (packages + overrides)"), packages: external_exports.unknown().optional().refine((e3) => void 0 === e3, { message: "`packages` must live under `bundle.packages`. Move your packages block to `flow.<name>.bundle.packages`. This is a breaking change \u2014 see CHANGELOG migration guide." }).describe("Legacy top-level packages (moved to bundle.packages)"), variables: _n2.optional().describe("Flow-level variables (override Config.variables, overridden by source/destination variables)"), definitions: Qn2.optional().describe("Flow-level definitions (extend Config.definitions, overridden by source/destination definitions)") }).refine((e3) => {
|
|
15859
15845
|
const n4 = void 0 !== e3.web, i2 = void 0 !== e3.server;
|
|
15860
15846
|
return (n4 || i2) && !(n4 && i2);
|
|
15861
15847
|
}, { message: 'Exactly one of "web" or "server" must be present' }).describe("Single flow settings for one deployment target");
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
Si = o(ii2);
|
|
15866
|
-
yi2 = o(oi2);
|
|
15867
|
-
wi2 = o(ti2);
|
|
15848
|
+
gi2 = external_exports.object({ $schema: external_exports.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v2.json")'), include: external_exports.array(external_exports.string()).optional().describe("Folders to include in the bundle output"), variables: _n2.optional().describe("Shared variables for interpolation across all flows (use $var.name syntax)"), definitions: Qn2.optional().describe("Reusable configuration definitions (use $def.name syntax)"), flows: external_exports.record(external_exports.string(), bi2).refine((e3) => Object.keys(e3).length > 0, { message: "At least one flow is required" }).describe("Named flow configurations (e.g., production, staging, development)") }).extend({ version: external_exports.literal(3).describe("Configuration schema version"), contract: mi2.optional().describe("Named contracts with extends inheritance and dot-path references") }).describe("walkerOS flow configuration (walkeros.config.json)");
|
|
15849
|
+
yi2 = external_exports.toJSONSchema(gi2, { target: "draft-7" });
|
|
15850
|
+
wi2 = o(bi2);
|
|
15868
15851
|
ki2 = o(ri2);
|
|
15869
|
-
xi = o(
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
|
|
15874
|
-
|
|
15852
|
+
xi = o(si2);
|
|
15853
|
+
Ci2 = o(ai2);
|
|
15854
|
+
ji2 = o(ci2);
|
|
15855
|
+
Ei2 = o(ui2);
|
|
15856
|
+
Ji = o(mi2);
|
|
15857
|
+
Ri = external_exports.object({ lang: external_exports.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: external_exports.string().describe("Code snippet") });
|
|
15858
|
+
Ii = external_exports.object({ text: external_exports.string().describe("Short actionable hint text focused on walkerOS usage"), code: external_exports.array(Ri).optional().describe("Optional code snippets") });
|
|
15859
|
+
Di = external_exports.record(external_exports.string(), Ii).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
|
|
15860
|
+
Gi = { source: kn2.configJsonSchema, destination: ze.configJsonSchema };
|
|
15875
15861
|
}
|
|
15876
15862
|
});
|
|
15877
15863
|
|
|
@@ -15969,29 +15955,6 @@ var init_event_validation = __esm({
|
|
|
15969
15955
|
});
|
|
15970
15956
|
|
|
15971
15957
|
// src/core/package-path.ts
|
|
15972
|
-
import fs6 from "fs";
|
|
15973
|
-
import path7 from "path";
|
|
15974
|
-
function resolvePackageImportPath(packageName, packages, configDir, subpath) {
|
|
15975
|
-
const entry = packages?.[packageName];
|
|
15976
|
-
if (entry?.path) {
|
|
15977
|
-
const resolved = path7.isAbsolute(entry.path) ? entry.path : path7.resolve(configDir, entry.path);
|
|
15978
|
-
if (!subpath) return resolved;
|
|
15979
|
-
try {
|
|
15980
|
-
const pkgJson = JSON.parse(
|
|
15981
|
-
fs6.readFileSync(path7.join(resolved, "package.json"), "utf8")
|
|
15982
|
-
);
|
|
15983
|
-
const exportKey = `.${subpath.startsWith("/") ? subpath : `/${subpath}`}`;
|
|
15984
|
-
const exp = pkgJson.exports?.[exportKey];
|
|
15985
|
-
if (exp) {
|
|
15986
|
-
const target = typeof exp === "string" ? exp : exp.import || exp.require || exp.default;
|
|
15987
|
-
if (target) return path7.join(resolved, target);
|
|
15988
|
-
}
|
|
15989
|
-
} catch {
|
|
15990
|
-
}
|
|
15991
|
-
return path7.join(resolved, subpath.replace(/^\//, ""));
|
|
15992
|
-
}
|
|
15993
|
-
return subpath ? `${packageName}${subpath}` : packageName;
|
|
15994
|
-
}
|
|
15995
15958
|
var init_package_path = __esm({
|
|
15996
15959
|
"src/core/package-path.ts"() {
|
|
15997
15960
|
"use strict";
|
|
@@ -16024,8 +15987,8 @@ function validateFlowConfig(data) {
|
|
|
16024
15987
|
const result = safeParseConfig(data);
|
|
16025
15988
|
if (!result.success) {
|
|
16026
15989
|
const errors = result.error.issues.map((issue2) => {
|
|
16027
|
-
const
|
|
16028
|
-
return ` - ${
|
|
15990
|
+
const path18 = issue2.path.length > 0 ? issue2.path.map(String).join(".") : "root";
|
|
15991
|
+
return ` - ${path18}: ${issue2.message}`;
|
|
16029
15992
|
}).join("\n");
|
|
16030
15993
|
throw new Error(`Invalid configuration:
|
|
16031
15994
|
${errors}`);
|
|
@@ -16081,36 +16044,38 @@ var init_build_defaults = __esm({
|
|
|
16081
16044
|
});
|
|
16082
16045
|
|
|
16083
16046
|
// src/config/loader.ts
|
|
16084
|
-
import
|
|
16085
|
-
import
|
|
16047
|
+
import path7 from "path";
|
|
16048
|
+
import fs6 from "fs-extra";
|
|
16086
16049
|
function loadBundleConfig(rawConfig, options) {
|
|
16087
16050
|
const config2 = validateFlowConfig(rawConfig);
|
|
16088
16051
|
const availableFlows = getAvailableFlows(config2);
|
|
16089
16052
|
const flowName = resolveFlow(config2, options.flowName, availableFlows);
|
|
16090
|
-
let flowSettings =
|
|
16091
|
-
const platform =
|
|
16053
|
+
let flowSettings = U(config2, flowName, { deferred: true });
|
|
16054
|
+
const platform = J(flowSettings);
|
|
16092
16055
|
if (!platform) {
|
|
16093
16056
|
throw new Error(
|
|
16094
16057
|
`Invalid configuration: flow "${flowName}" must have a "web" or "server" key.`
|
|
16095
16058
|
);
|
|
16096
16059
|
}
|
|
16097
16060
|
if (platform === "web") {
|
|
16098
|
-
flowSettings =
|
|
16061
|
+
flowSettings = U(config2, flowName);
|
|
16099
16062
|
}
|
|
16100
16063
|
const buildDefaults = getBuildDefaults(platform);
|
|
16101
|
-
const packages = flowSettings.packages || {};
|
|
16064
|
+
const packages = flowSettings.bundle?.packages || {};
|
|
16065
|
+
const overrides = flowSettings.bundle?.overrides || {};
|
|
16102
16066
|
const output = options.buildOverrides?.output || getDefaultOutput(platform);
|
|
16103
|
-
const configDir = isUrl(options.configPath) ? process.cwd() :
|
|
16067
|
+
const configDir = isUrl(options.configPath) ? process.cwd() : path7.dirname(options.configPath);
|
|
16104
16068
|
let includes = config2.include;
|
|
16105
16069
|
if (!includes) {
|
|
16106
|
-
const defaultIncludePath =
|
|
16107
|
-
if (
|
|
16070
|
+
const defaultIncludePath = path7.resolve(configDir, DEFAULT_INCLUDE_FOLDER);
|
|
16071
|
+
if (fs6.pathExistsSync(defaultIncludePath)) {
|
|
16108
16072
|
includes = [DEFAULT_INCLUDE_FOLDER];
|
|
16109
16073
|
}
|
|
16110
16074
|
}
|
|
16111
16075
|
const buildOptions = {
|
|
16112
16076
|
...buildDefaults,
|
|
16113
16077
|
packages,
|
|
16078
|
+
overrides,
|
|
16114
16079
|
output,
|
|
16115
16080
|
include: includes,
|
|
16116
16081
|
configDir,
|
|
@@ -16282,12 +16247,12 @@ var init_cache_utils = __esm({
|
|
|
16282
16247
|
|
|
16283
16248
|
// src/commands/bundle/package-manager.ts
|
|
16284
16249
|
import pacote from "pacote";
|
|
16285
|
-
import
|
|
16286
|
-
import
|
|
16250
|
+
import path8 from "path";
|
|
16251
|
+
import fs7 from "fs-extra";
|
|
16287
16252
|
import semver2 from "semver";
|
|
16288
16253
|
async function withTimeout(promise2, ms, errorMessage) {
|
|
16289
16254
|
let timer;
|
|
16290
|
-
const timeout = new Promise((
|
|
16255
|
+
const timeout = new Promise((_3, reject) => {
|
|
16291
16256
|
timer = setTimeout(() => reject(new Error(errorMessage)), ms);
|
|
16292
16257
|
});
|
|
16293
16258
|
try {
|
|
@@ -16297,11 +16262,34 @@ async function withTimeout(promise2, ms, errorMessage) {
|
|
|
16297
16262
|
}
|
|
16298
16263
|
}
|
|
16299
16264
|
function getPackageDirectory(baseDir, packageName) {
|
|
16300
|
-
return
|
|
16265
|
+
return path8.join(baseDir, "node_modules", packageName);
|
|
16301
16266
|
}
|
|
16302
|
-
async function collectAllSpecs(packages, logger, configDir) {
|
|
16267
|
+
async function collectAllSpecs(packages, logger, configDir, overrides = {}) {
|
|
16303
16268
|
const allSpecs = /* @__PURE__ */ new Map();
|
|
16304
16269
|
const visited = /* @__PURE__ */ new Set();
|
|
16270
|
+
const directLocalNames = new Set(
|
|
16271
|
+
packages.filter((p2) => p2.path).map((p2) => p2.name)
|
|
16272
|
+
);
|
|
16273
|
+
for (const overrideName of Object.keys(overrides)) {
|
|
16274
|
+
if (directLocalNames.has(overrideName)) {
|
|
16275
|
+
logger.warn(
|
|
16276
|
+
`Override for ${overrideName} ignored \u2014 direct package is a local path`
|
|
16277
|
+
);
|
|
16278
|
+
}
|
|
16279
|
+
}
|
|
16280
|
+
const substituteDep = (depName, depSpec, source, from, optional2) => {
|
|
16281
|
+
const overrideSpec = overrides[depName];
|
|
16282
|
+
if (overrideSpec) {
|
|
16283
|
+
return {
|
|
16284
|
+
name: depName,
|
|
16285
|
+
spec: overrideSpec,
|
|
16286
|
+
source: "override",
|
|
16287
|
+
from: `override (was ${depSpec} from ${from})`,
|
|
16288
|
+
optional: optional2
|
|
16289
|
+
};
|
|
16290
|
+
}
|
|
16291
|
+
return { name: depName, spec: depSpec, source, from, optional: optional2 };
|
|
16292
|
+
};
|
|
16305
16293
|
const queue = packages.map((pkg) => ({
|
|
16306
16294
|
name: pkg.name,
|
|
16307
16295
|
spec: pkg.version,
|
|
@@ -16324,22 +16312,18 @@ async function collectAllSpecs(packages, logger, configDir) {
|
|
|
16324
16312
|
localPath: item.localPath
|
|
16325
16313
|
});
|
|
16326
16314
|
if (item.localPath) {
|
|
16327
|
-
const resolvedPath =
|
|
16328
|
-
const candidatePath =
|
|
16329
|
-
const hasPkgJson = await
|
|
16315
|
+
const resolvedPath = path8.isAbsolute(item.localPath) ? item.localPath : path8.resolve(configDir || process.cwd(), item.localPath);
|
|
16316
|
+
const candidatePath = path8.join(resolvedPath, "package.json");
|
|
16317
|
+
const hasPkgJson = await fs7.pathExists(candidatePath);
|
|
16330
16318
|
if (hasPkgJson) {
|
|
16331
16319
|
try {
|
|
16332
|
-
const pkgJson = await
|
|
16320
|
+
const pkgJson = await fs7.readJson(candidatePath);
|
|
16333
16321
|
const deps2 = pkgJson.dependencies || {};
|
|
16334
16322
|
for (const [depName, depSpec] of Object.entries(deps2)) {
|
|
16335
16323
|
if (typeof depSpec === "string") {
|
|
16336
|
-
queue.push(
|
|
16337
|
-
name
|
|
16338
|
-
|
|
16339
|
-
source: "dependency",
|
|
16340
|
-
from: item.name,
|
|
16341
|
-
optional: false
|
|
16342
|
-
});
|
|
16324
|
+
queue.push(
|
|
16325
|
+
substituteDep(depName, depSpec, "dependency", item.name, false)
|
|
16326
|
+
);
|
|
16343
16327
|
}
|
|
16344
16328
|
}
|
|
16345
16329
|
const peerDeps2 = pkgJson.peerDependencies || {};
|
|
@@ -16347,13 +16331,15 @@ async function collectAllSpecs(packages, logger, configDir) {
|
|
|
16347
16331
|
for (const [depName, depSpec] of Object.entries(peerDeps2)) {
|
|
16348
16332
|
if (typeof depSpec === "string") {
|
|
16349
16333
|
const isOptional = peerMeta2[depName]?.optional === true;
|
|
16350
|
-
queue.push(
|
|
16351
|
-
|
|
16352
|
-
|
|
16353
|
-
|
|
16354
|
-
|
|
16355
|
-
|
|
16356
|
-
|
|
16334
|
+
queue.push(
|
|
16335
|
+
substituteDep(
|
|
16336
|
+
depName,
|
|
16337
|
+
depSpec,
|
|
16338
|
+
"peerDependency",
|
|
16339
|
+
item.name,
|
|
16340
|
+
isOptional
|
|
16341
|
+
)
|
|
16342
|
+
);
|
|
16357
16343
|
}
|
|
16358
16344
|
}
|
|
16359
16345
|
} catch (error48) {
|
|
@@ -16381,13 +16367,9 @@ async function collectAllSpecs(packages, logger, configDir) {
|
|
|
16381
16367
|
const deps = m2.dependencies || {};
|
|
16382
16368
|
for (const [depName, depSpec] of Object.entries(deps)) {
|
|
16383
16369
|
if (typeof depSpec === "string") {
|
|
16384
|
-
queue.push(
|
|
16385
|
-
name
|
|
16386
|
-
|
|
16387
|
-
source: "dependency",
|
|
16388
|
-
from: item.name,
|
|
16389
|
-
optional: false
|
|
16390
|
-
});
|
|
16370
|
+
queue.push(
|
|
16371
|
+
substituteDep(depName, depSpec, "dependency", item.name, false)
|
|
16372
|
+
);
|
|
16391
16373
|
}
|
|
16392
16374
|
}
|
|
16393
16375
|
const peerDeps = m2.peerDependencies || {};
|
|
@@ -16395,13 +16377,15 @@ async function collectAllSpecs(packages, logger, configDir) {
|
|
|
16395
16377
|
for (const [depName, depSpec] of Object.entries(peerDeps)) {
|
|
16396
16378
|
if (typeof depSpec === "string") {
|
|
16397
16379
|
const isOptional = peerMeta[depName]?.optional === true;
|
|
16398
|
-
queue.push(
|
|
16399
|
-
|
|
16400
|
-
|
|
16401
|
-
|
|
16402
|
-
|
|
16403
|
-
|
|
16404
|
-
|
|
16380
|
+
queue.push(
|
|
16381
|
+
substituteDep(
|
|
16382
|
+
depName,
|
|
16383
|
+
depSpec,
|
|
16384
|
+
"peerDependency",
|
|
16385
|
+
item.name,
|
|
16386
|
+
isOptional
|
|
16387
|
+
)
|
|
16388
|
+
);
|
|
16405
16389
|
}
|
|
16406
16390
|
}
|
|
16407
16391
|
}
|
|
@@ -16487,14 +16471,19 @@ function resolveVersionConflicts(allSpecs, logger) {
|
|
|
16487
16471
|
}
|
|
16488
16472
|
return resolved;
|
|
16489
16473
|
}
|
|
16490
|
-
async function downloadPackages(packages, targetDir, logger, useCache = true, configDir, tmpDir) {
|
|
16474
|
+
async function downloadPackages(packages, targetDir, logger, useCache = true, configDir, tmpDir, overrides = {}) {
|
|
16491
16475
|
const packagePaths = /* @__PURE__ */ new Map();
|
|
16492
16476
|
const userSpecifiedPackages = new Set(packages.map((p2) => p2.name));
|
|
16493
16477
|
validateNoDuplicatePackages(packages);
|
|
16494
16478
|
logger.debug("Resolving dependencies");
|
|
16495
|
-
const allSpecs = await collectAllSpecs(
|
|
16479
|
+
const allSpecs = await collectAllSpecs(
|
|
16480
|
+
packages,
|
|
16481
|
+
logger,
|
|
16482
|
+
configDir,
|
|
16483
|
+
overrides
|
|
16484
|
+
);
|
|
16496
16485
|
const resolved = resolveVersionConflicts(allSpecs, logger);
|
|
16497
|
-
await
|
|
16486
|
+
await fs7.ensureDir(targetDir);
|
|
16498
16487
|
const localPackageMap = /* @__PURE__ */ new Map();
|
|
16499
16488
|
for (const pkg of packages) {
|
|
16500
16489
|
if (pkg.path) localPackageMap.set(pkg.name, pkg.path);
|
|
@@ -16523,8 +16512,8 @@ async function downloadPackages(packages, targetDir, logger, useCache = true, co
|
|
|
16523
16512
|
logger.debug(`Downloading ${packageSpec} (cached)`);
|
|
16524
16513
|
}
|
|
16525
16514
|
try {
|
|
16526
|
-
await
|
|
16527
|
-
await
|
|
16515
|
+
await fs7.ensureDir(path8.dirname(packageDir));
|
|
16516
|
+
await fs7.copy(cachedPath, packageDir);
|
|
16528
16517
|
packagePaths.set(name, packageDir);
|
|
16529
16518
|
continue;
|
|
16530
16519
|
} catch {
|
|
@@ -16532,7 +16521,7 @@ async function downloadPackages(packages, targetDir, logger, useCache = true, co
|
|
|
16532
16521
|
}
|
|
16533
16522
|
}
|
|
16534
16523
|
try {
|
|
16535
|
-
await
|
|
16524
|
+
await fs7.ensureDir(path8.dirname(packageDir));
|
|
16536
16525
|
const cacheDir = process.env.NPM_CACHE_DIR || getTmpPath(tmpDir, "cache", "npm");
|
|
16537
16526
|
await withTimeout(
|
|
16538
16527
|
pacote.extract(packageSpec, packageDir, {
|
|
@@ -16547,8 +16536,8 @@ async function downloadPackages(packages, targetDir, logger, useCache = true, co
|
|
|
16547
16536
|
}
|
|
16548
16537
|
if (useCache) {
|
|
16549
16538
|
try {
|
|
16550
|
-
await
|
|
16551
|
-
await
|
|
16539
|
+
await fs7.ensureDir(path8.dirname(cachedPath));
|
|
16540
|
+
await fs7.copy(packageDir, cachedPath);
|
|
16552
16541
|
} catch {
|
|
16553
16542
|
}
|
|
16554
16543
|
}
|
|
@@ -16562,11 +16551,11 @@ async function downloadPackages(packages, targetDir, logger, useCache = true, co
|
|
|
16562
16551
|
async function getCachedPackagePath(pkg, tmpDir) {
|
|
16563
16552
|
const cacheDir = getTmpPath(tmpDir, "cache", "packages");
|
|
16564
16553
|
const cacheKey = await getPackageCacheKey(pkg.name, pkg.version);
|
|
16565
|
-
return
|
|
16554
|
+
return path8.join(cacheDir, cacheKey);
|
|
16566
16555
|
}
|
|
16567
16556
|
async function isPackageCached(pkg, tmpDir) {
|
|
16568
16557
|
const cachedPath = await getCachedPackagePath(pkg, tmpDir);
|
|
16569
|
-
return
|
|
16558
|
+
return fs7.pathExists(cachedPath);
|
|
16570
16559
|
}
|
|
16571
16560
|
function validateNoDuplicatePackages(packages) {
|
|
16572
16561
|
const packageMap = /* @__PURE__ */ new Map();
|
|
@@ -16605,60 +16594,61 @@ var init_package_manager = __esm({
|
|
|
16605
16594
|
};
|
|
16606
16595
|
SOURCE_PRIORITY = {
|
|
16607
16596
|
direct: 0,
|
|
16608
|
-
|
|
16609
|
-
|
|
16597
|
+
override: 1,
|
|
16598
|
+
dependency: 2,
|
|
16599
|
+
peerDependency: 3
|
|
16610
16600
|
};
|
|
16611
16601
|
}
|
|
16612
16602
|
});
|
|
16613
16603
|
|
|
16614
16604
|
// src/core/build-cache.ts
|
|
16615
|
-
import
|
|
16616
|
-
import
|
|
16605
|
+
import fs8 from "fs-extra";
|
|
16606
|
+
import path9 from "path";
|
|
16617
16607
|
async function getBuildCachePath(configContent, tmpDir) {
|
|
16618
16608
|
const cacheDir = getTmpPath(tmpDir, "cache", "builds");
|
|
16619
16609
|
const cacheKey = await getFlowSettingsCacheKey(configContent);
|
|
16620
|
-
return
|
|
16610
|
+
return path9.join(cacheDir, `${cacheKey}.js`);
|
|
16621
16611
|
}
|
|
16622
16612
|
async function isBuildCached(configContent, tmpDir) {
|
|
16623
16613
|
const cachePath = await getBuildCachePath(configContent, tmpDir);
|
|
16624
|
-
return
|
|
16614
|
+
return fs8.pathExists(cachePath);
|
|
16625
16615
|
}
|
|
16626
16616
|
async function cacheBuild(configContent, buildOutput, tmpDir) {
|
|
16627
16617
|
const cachePath = await getBuildCachePath(configContent, tmpDir);
|
|
16628
|
-
await
|
|
16629
|
-
await
|
|
16618
|
+
await fs8.ensureDir(path9.dirname(cachePath));
|
|
16619
|
+
await fs8.writeFile(cachePath, buildOutput, "utf-8");
|
|
16630
16620
|
}
|
|
16631
16621
|
async function getCachedBuild(configContent, tmpDir) {
|
|
16632
16622
|
const cachePath = await getBuildCachePath(configContent, tmpDir);
|
|
16633
|
-
if (await
|
|
16634
|
-
return await
|
|
16623
|
+
if (await fs8.pathExists(cachePath)) {
|
|
16624
|
+
return await fs8.readFile(cachePath, "utf-8");
|
|
16635
16625
|
}
|
|
16636
16626
|
return null;
|
|
16637
16627
|
}
|
|
16638
16628
|
async function getCodeCachePath(codeContent, tmpDir) {
|
|
16639
16629
|
const cacheDir = getTmpPath(tmpDir, "cache", "code");
|
|
16640
16630
|
const cacheKey = await u2(codeContent, 12);
|
|
16641
|
-
return
|
|
16631
|
+
return path9.join(cacheDir, `${cacheKey}.js`);
|
|
16642
16632
|
}
|
|
16643
16633
|
async function cacheCode(codeContent, codeOutput, tmpDir) {
|
|
16644
16634
|
const cachePath = await getCodeCachePath(codeContent, tmpDir);
|
|
16645
|
-
await
|
|
16646
|
-
await
|
|
16635
|
+
await fs8.ensureDir(path9.dirname(cachePath));
|
|
16636
|
+
await fs8.writeFile(cachePath, codeOutput, "utf-8");
|
|
16647
16637
|
}
|
|
16648
16638
|
async function getCachedCode(codeContent, tmpDir) {
|
|
16649
16639
|
const cachePath = await getCodeCachePath(codeContent, tmpDir);
|
|
16650
|
-
if (await
|
|
16651
|
-
return
|
|
16640
|
+
if (await fs8.pathExists(cachePath)) {
|
|
16641
|
+
return fs8.readFile(cachePath, "utf-8");
|
|
16652
16642
|
}
|
|
16653
16643
|
return null;
|
|
16654
16644
|
}
|
|
16655
16645
|
async function ensureCodeOnDisk(codeContent, compiledCode, tmpDir) {
|
|
16656
16646
|
const cacheDir = getTmpPath(tmpDir, "cache", "code");
|
|
16657
16647
|
const cacheKey = await u2(codeContent, 12);
|
|
16658
|
-
const cachePath =
|
|
16659
|
-
if (!await
|
|
16660
|
-
await
|
|
16661
|
-
await
|
|
16648
|
+
const cachePath = path9.join(cacheDir, `${cacheKey}.mjs`);
|
|
16649
|
+
if (!await fs8.pathExists(cachePath)) {
|
|
16650
|
+
await fs8.ensureDir(path9.dirname(cachePath));
|
|
16651
|
+
await fs8.writeFile(cachePath, compiledCode, "utf-8");
|
|
16662
16652
|
}
|
|
16663
16653
|
return cachePath;
|
|
16664
16654
|
}
|
|
@@ -16675,8 +16665,8 @@ var init_build_cache = __esm({
|
|
|
16675
16665
|
import crypto from "crypto";
|
|
16676
16666
|
import esbuild from "esbuild";
|
|
16677
16667
|
import { builtinModules } from "module";
|
|
16678
|
-
import
|
|
16679
|
-
import
|
|
16668
|
+
import path10 from "path";
|
|
16669
|
+
import fs9 from "fs-extra";
|
|
16680
16670
|
function isInlineCode(code) {
|
|
16681
16671
|
return code !== null && typeof code === "object" && !Array.isArray(code) && "push" in code;
|
|
16682
16672
|
}
|
|
@@ -16728,18 +16718,18 @@ function generateInlineCode(inline, config2, env, chain, chainPropertyName, isDe
|
|
|
16728
16718
|
}
|
|
16729
16719
|
async function copyIncludes(includes, sourceDir, outputDir, logger) {
|
|
16730
16720
|
for (const include of includes) {
|
|
16731
|
-
const sourcePath =
|
|
16732
|
-
const folderName =
|
|
16733
|
-
const destPath =
|
|
16734
|
-
const resolvedOutput =
|
|
16735
|
-
const resolvedSource =
|
|
16736
|
-
if (resolvedSource === resolvedOutput || resolvedOutput.startsWith(resolvedSource +
|
|
16721
|
+
const sourcePath = path10.resolve(sourceDir, include);
|
|
16722
|
+
const folderName = path10.basename(include);
|
|
16723
|
+
const destPath = path10.join(outputDir, folderName);
|
|
16724
|
+
const resolvedOutput = path10.resolve(outputDir);
|
|
16725
|
+
const resolvedSource = path10.resolve(sourcePath);
|
|
16726
|
+
if (resolvedSource === resolvedOutput || resolvedOutput.startsWith(resolvedSource + path10.sep) || resolvedSource.startsWith(resolvedOutput + path10.sep)) {
|
|
16737
16727
|
throw new Error(
|
|
16738
16728
|
`Circular include detected: "${include}" resolves to "${resolvedSource}" which overlaps with output directory "${resolvedOutput}"`
|
|
16739
16729
|
);
|
|
16740
16730
|
}
|
|
16741
|
-
if (await
|
|
16742
|
-
await
|
|
16731
|
+
if (await fs9.pathExists(sourcePath)) {
|
|
16732
|
+
await fs9.copy(sourcePath, destPath);
|
|
16743
16733
|
logger.debug(`Copied ${include} to output`);
|
|
16744
16734
|
} else {
|
|
16745
16735
|
logger.warn(`Include folder not found: ${include}`);
|
|
@@ -16810,14 +16800,14 @@ async function bundleCore(flowSettings, buildOptions, logger, showStats = false)
|
|
|
16810
16800
|
const cachedBuild = await getCachedBuild(configContent, CACHE_DIR);
|
|
16811
16801
|
if (cachedBuild) {
|
|
16812
16802
|
logger.debug("Using cached build");
|
|
16813
|
-
const outputPath =
|
|
16814
|
-
await
|
|
16815
|
-
await
|
|
16816
|
-
const stats = await
|
|
16803
|
+
const outputPath = path10.resolve(buildOptions.output);
|
|
16804
|
+
await fs9.ensureDir(path10.dirname(outputPath));
|
|
16805
|
+
await fs9.writeFile(outputPath, cachedBuild);
|
|
16806
|
+
const stats = await fs9.stat(outputPath);
|
|
16817
16807
|
const sizeKB = (stats.size / 1024).toFixed(1);
|
|
16818
16808
|
logger.info(`Output: ${outputPath} (${sizeKB} KB, cached)`);
|
|
16819
16809
|
if (showStats) {
|
|
16820
|
-
const stats2 = await
|
|
16810
|
+
const stats2 = await fs9.stat(outputPath);
|
|
16821
16811
|
const packageStats = Object.entries(buildOptions.packages).map(
|
|
16822
16812
|
([name, pkg]) => ({
|
|
16823
16813
|
name: `${name}@${pkg.version || "latest"}`,
|
|
@@ -16840,7 +16830,7 @@ async function bundleCore(flowSettings, buildOptions, logger, showStats = false)
|
|
|
16840
16830
|
}
|
|
16841
16831
|
}
|
|
16842
16832
|
try {
|
|
16843
|
-
await
|
|
16833
|
+
await fs9.ensureDir(TEMP_DIR);
|
|
16844
16834
|
const hasSourcesOrDests = Object.keys(
|
|
16845
16835
|
flowSettings.sources || {}
|
|
16846
16836
|
).length > 0 || Object.keys(
|
|
@@ -16853,14 +16843,19 @@ async function bundleCore(flowSettings, buildOptions, logger, showStats = false)
|
|
|
16853
16843
|
for (const pkg of stepPackages) {
|
|
16854
16844
|
const isLocalPath = pkg.startsWith(".") || pkg.startsWith("/");
|
|
16855
16845
|
if (isLocalPath) {
|
|
16856
|
-
const varName =
|
|
16846
|
+
const varName = q(pkg);
|
|
16857
16847
|
if (!buildOptions.packages[varName]) {
|
|
16858
16848
|
buildOptions.packages[varName] = {
|
|
16859
16849
|
path: pkg,
|
|
16860
16850
|
imports: [`default as ${varName}`]
|
|
16861
16851
|
};
|
|
16862
16852
|
}
|
|
16863
|
-
for (const section of [
|
|
16853
|
+
for (const section of [
|
|
16854
|
+
"sources",
|
|
16855
|
+
"destinations",
|
|
16856
|
+
"transformers",
|
|
16857
|
+
"stores"
|
|
16858
|
+
]) {
|
|
16864
16859
|
const steps = flowSettings[section];
|
|
16865
16860
|
if (!steps) continue;
|
|
16866
16861
|
for (const step of Object.values(steps)) {
|
|
@@ -16890,12 +16885,13 @@ async function bundleCore(flowSettings, buildOptions, logger, showStats = false)
|
|
|
16890
16885
|
buildOptions.cache,
|
|
16891
16886
|
buildOptions.configDir,
|
|
16892
16887
|
// For resolving relative local paths
|
|
16893
|
-
CACHE_DIR
|
|
16888
|
+
CACHE_DIR,
|
|
16889
|
+
buildOptions.overrides
|
|
16894
16890
|
);
|
|
16895
16891
|
for (const [pkgName, pkgPath] of packagePaths.entries()) {
|
|
16896
16892
|
if (pkgName.startsWith("@walkeros/")) {
|
|
16897
|
-
const pkgJsonPath =
|
|
16898
|
-
const pkgJson = await
|
|
16893
|
+
const pkgJsonPath = path10.join(pkgPath, "package.json");
|
|
16894
|
+
const pkgJson = await fs9.readJSON(pkgJsonPath);
|
|
16899
16895
|
if (!pkgJson.exports && pkgJson.module) {
|
|
16900
16896
|
pkgJson.exports = {
|
|
16901
16897
|
".": {
|
|
@@ -16903,12 +16899,12 @@ async function bundleCore(flowSettings, buildOptions, logger, showStats = false)
|
|
|
16903
16899
|
require: pkgJson.main
|
|
16904
16900
|
}
|
|
16905
16901
|
};
|
|
16906
|
-
await
|
|
16902
|
+
await fs9.writeJSON(pkgJsonPath, pkgJson, { spaces: 2 });
|
|
16907
16903
|
}
|
|
16908
16904
|
}
|
|
16909
16905
|
}
|
|
16910
|
-
const packageJsonPath =
|
|
16911
|
-
await
|
|
16906
|
+
const packageJsonPath = path10.join(TEMP_DIR, "package.json");
|
|
16907
|
+
await fs9.writeFile(
|
|
16912
16908
|
packageJsonPath,
|
|
16913
16909
|
JSON.stringify({ type: "module" }, null, 2)
|
|
16914
16910
|
);
|
|
@@ -16918,8 +16914,8 @@ async function bundleCore(flowSettings, buildOptions, logger, showStats = false)
|
|
|
16918
16914
|
buildOptions,
|
|
16919
16915
|
packagePaths
|
|
16920
16916
|
);
|
|
16921
|
-
const outputPath =
|
|
16922
|
-
await
|
|
16917
|
+
const outputPath = path10.resolve(buildOptions.output);
|
|
16918
|
+
await fs9.ensureDir(path10.dirname(outputPath));
|
|
16923
16919
|
let compiledCode = null;
|
|
16924
16920
|
if (buildOptions.cache !== false) {
|
|
16925
16921
|
compiledCode = await getCachedCode(codeEntry, CACHE_DIR);
|
|
@@ -16930,8 +16926,8 @@ async function bundleCore(flowSettings, buildOptions, logger, showStats = false)
|
|
|
16930
16926
|
logger.debug(
|
|
16931
16927
|
`Running esbuild (target: ${buildOptions.target || "es2018"}, format: ${buildOptions.format})`
|
|
16932
16928
|
);
|
|
16933
|
-
const entryPath =
|
|
16934
|
-
await
|
|
16929
|
+
const entryPath = path10.join(TEMP_DIR, "entry.js");
|
|
16930
|
+
await fs9.writeFile(entryPath, codeEntry);
|
|
16935
16931
|
const esbuildOptions = createEsbuildOptions(
|
|
16936
16932
|
{ ...buildOptions, minify: false },
|
|
16937
16933
|
entryPath,
|
|
@@ -16950,7 +16946,7 @@ async function bundleCore(flowSettings, buildOptions, logger, showStats = false)
|
|
|
16950
16946
|
} finally {
|
|
16951
16947
|
await esbuild.stop();
|
|
16952
16948
|
}
|
|
16953
|
-
compiledCode = await
|
|
16949
|
+
compiledCode = await fs9.readFile(outputPath, "utf-8");
|
|
16954
16950
|
if (buildOptions.cache !== false) {
|
|
16955
16951
|
await cacheCode(codeEntry, compiledCode, CACHE_DIR);
|
|
16956
16952
|
}
|
|
@@ -16967,14 +16963,14 @@ export { __configData };`;
|
|
|
16967
16963
|
` : "";
|
|
16968
16964
|
const esmOutput = `${banner}${compiledCode}
|
|
16969
16965
|
${dataDeclaration}`;
|
|
16970
|
-
await
|
|
16966
|
+
await fs9.writeFile(outputPath, esmOutput);
|
|
16971
16967
|
} else {
|
|
16972
16968
|
const stage2Entry = (buildOptions.platform || "node") === "browser" ? generateWebEntry(stage1Path, dataPayload, {
|
|
16973
16969
|
windowCollector: buildOptions.windowCollector,
|
|
16974
16970
|
windowElb: buildOptions.windowElb
|
|
16975
16971
|
}) : generateServerEntry(stage1Path, dataPayload);
|
|
16976
|
-
const stage2EntryPath =
|
|
16977
|
-
await
|
|
16972
|
+
const stage2EntryPath = path10.join(TEMP_DIR, "stage2.mjs");
|
|
16973
|
+
await fs9.writeFile(stage2EntryPath, stage2Entry);
|
|
16978
16974
|
const stage2Options = {
|
|
16979
16975
|
entryPoints: [stage2EntryPath],
|
|
16980
16976
|
bundle: true,
|
|
@@ -17011,13 +17007,13 @@ ${dataDeclaration}`;
|
|
|
17011
17007
|
await esbuild.stop();
|
|
17012
17008
|
}
|
|
17013
17009
|
}
|
|
17014
|
-
const outputStats = await
|
|
17010
|
+
const outputStats = await fs9.stat(outputPath);
|
|
17015
17011
|
const sizeKB = (outputStats.size / 1024).toFixed(1);
|
|
17016
17012
|
const buildTime = ((Date.now() - bundleStartTime) / 1e3).toFixed(1);
|
|
17017
17013
|
logger.info(`Output: ${outputPath} (${sizeKB} KB, ${buildTime}s)`);
|
|
17018
17014
|
if (buildOptions.cache !== false) {
|
|
17019
17015
|
const configContent = generateCacheKeyContent(flowSettings, buildOptions);
|
|
17020
|
-
const buildOutput = await
|
|
17016
|
+
const buildOutput = await fs9.readFile(outputPath, "utf-8");
|
|
17021
17017
|
await cacheBuild(configContent, buildOutput, CACHE_DIR);
|
|
17022
17018
|
logger.debug("Build cached for future use");
|
|
17023
17019
|
}
|
|
@@ -17031,7 +17027,7 @@ ${dataDeclaration}`;
|
|
|
17031
17027
|
);
|
|
17032
17028
|
}
|
|
17033
17029
|
if (buildOptions.include && buildOptions.include.length > 0) {
|
|
17034
|
-
const outputDir =
|
|
17030
|
+
const outputDir = path10.dirname(outputPath);
|
|
17035
17031
|
await copyIncludes(
|
|
17036
17032
|
buildOptions.include,
|
|
17037
17033
|
buildOptions.configDir || process.cwd(),
|
|
@@ -17044,13 +17040,13 @@ ${dataDeclaration}`;
|
|
|
17044
17040
|
throw error48;
|
|
17045
17041
|
} finally {
|
|
17046
17042
|
if (!buildOptions.tempDir) {
|
|
17047
|
-
|
|
17043
|
+
fs9.remove(TEMP_DIR).catch(() => {
|
|
17048
17044
|
});
|
|
17049
17045
|
}
|
|
17050
17046
|
}
|
|
17051
17047
|
}
|
|
17052
17048
|
async function collectBundleStats(outputPath, packages, startTime, entryContent) {
|
|
17053
|
-
const stats = await
|
|
17049
|
+
const stats = await fs9.stat(outputPath);
|
|
17054
17050
|
const totalSize = stats.size;
|
|
17055
17051
|
const buildTime = Date.now() - startTime;
|
|
17056
17052
|
const packageStats = Object.entries(packages).map(([name, pkg]) => {
|
|
@@ -17233,9 +17229,8 @@ function detectExplicitCodeImports(flowSettings) {
|
|
|
17233
17229
|
}
|
|
17234
17230
|
return explicitCodeImports;
|
|
17235
17231
|
}
|
|
17236
|
-
function generateImportStatements(packages, destinationPackages, sourcePackages, transformerPackages, storePackages, explicitCodeImports) {
|
|
17232
|
+
async function generateImportStatements(packages, destinationPackages, sourcePackages, transformerPackages, storePackages, explicitCodeImports, packagePaths) {
|
|
17237
17233
|
const importStatements = [];
|
|
17238
|
-
const examplesMappings = [];
|
|
17239
17234
|
const usedPackages = /* @__PURE__ */ new Set([
|
|
17240
17235
|
...destinationPackages,
|
|
17241
17236
|
...sourcePackages,
|
|
@@ -17247,7 +17242,7 @@ function generateImportStatements(packages, destinationPackages, sourcePackages,
|
|
|
17247
17242
|
const hasExplicitCode = explicitCodeImports.has(packageName);
|
|
17248
17243
|
const namedImportsToGenerate = [];
|
|
17249
17244
|
if (isUsedByDestOrSource && !hasExplicitCode) {
|
|
17250
|
-
const varName =
|
|
17245
|
+
const varName = q(packageName);
|
|
17251
17246
|
importStatements.push(`import ${varName} from '${packageName}';`);
|
|
17252
17247
|
}
|
|
17253
17248
|
if (hasExplicitCode) {
|
|
@@ -17270,21 +17265,6 @@ function generateImportStatements(packages, destinationPackages, sourcePackages,
|
|
|
17270
17265
|
}
|
|
17271
17266
|
}
|
|
17272
17267
|
}
|
|
17273
|
-
const examplesImport = uniqueImports.find(
|
|
17274
|
-
(imp) => imp.includes("examples as ")
|
|
17275
|
-
);
|
|
17276
|
-
if (examplesImport) {
|
|
17277
|
-
const examplesVarName = examplesImport.split(" as ")[1];
|
|
17278
|
-
const destinationMatch = packageName.match(
|
|
17279
|
-
/@walkeros\/web-destination-(.+)$/
|
|
17280
|
-
);
|
|
17281
|
-
if (destinationMatch) {
|
|
17282
|
-
const destinationName = destinationMatch[1];
|
|
17283
|
-
examplesMappings.push(
|
|
17284
|
-
` ${destinationName}: typeof ${examplesVarName} !== 'undefined' ? ${examplesVarName} : undefined`
|
|
17285
|
-
);
|
|
17286
|
-
}
|
|
17287
|
-
}
|
|
17288
17268
|
}
|
|
17289
17269
|
if (packageName === "@walkeros/collector" && !namedImportsToGenerate.includes("startFlow")) {
|
|
17290
17270
|
namedImportsToGenerate.push("startFlow");
|
|
@@ -17294,25 +17274,43 @@ function generateImportStatements(packages, destinationPackages, sourcePackages,
|
|
|
17294
17274
|
importStatements.push(`import { ${importList} } from '${packageName}';`);
|
|
17295
17275
|
}
|
|
17296
17276
|
}
|
|
17297
|
-
|
|
17277
|
+
const devExportEntries = [];
|
|
17278
|
+
for (const packageName of usedPackages) {
|
|
17279
|
+
const localPath = packagePaths.get(packageName);
|
|
17280
|
+
if (!localPath) continue;
|
|
17281
|
+
try {
|
|
17282
|
+
const pkgJsonPath = path10.join(localPath, "package.json");
|
|
17283
|
+
const pkgJson = await fs9.readJSON(pkgJsonPath);
|
|
17284
|
+
const exports = pkgJson.exports;
|
|
17285
|
+
if (exports && typeof exports === "object" && "./dev" in exports) {
|
|
17286
|
+
const varName = `__dev_${q(packageName)}`;
|
|
17287
|
+
importStatements.push(
|
|
17288
|
+
`import * as ${varName} from '${packageName}/dev';`
|
|
17289
|
+
);
|
|
17290
|
+
devExportEntries.push(`'${packageName}': ${varName}`);
|
|
17291
|
+
}
|
|
17292
|
+
} catch {
|
|
17293
|
+
}
|
|
17294
|
+
}
|
|
17295
|
+
return { importStatements, devExportEntries };
|
|
17298
17296
|
}
|
|
17299
17297
|
function validateComponentNames(components, section) {
|
|
17300
17298
|
for (const name of Object.keys(components)) {
|
|
17301
17299
|
if (!VALID_JS_IDENTIFIER.test(name)) {
|
|
17302
17300
|
throw new Error(
|
|
17303
|
-
`Invalid ${section} name "${name}": must be a valid JavaScript identifier (use camelCase, e.g., "${name.replace(/-([a-z])/g, (
|
|
17301
|
+
`Invalid ${section} name "${name}": must be a valid JavaScript identifier (use camelCase, e.g., "${name.replace(/-([a-z])/g, (_3, c2) => c2.toUpperCase())}")`
|
|
17304
17302
|
);
|
|
17305
17303
|
}
|
|
17306
17304
|
}
|
|
17307
17305
|
}
|
|
17308
17306
|
function validateStoreReferences(flowSettings, storeIds) {
|
|
17309
17307
|
const refs = [];
|
|
17310
|
-
function collectRefs(obj,
|
|
17308
|
+
function collectRefs(obj, path18) {
|
|
17311
17309
|
if (typeof obj === "string" && obj.startsWith("$store:")) {
|
|
17312
|
-
refs.push({ ref: obj.slice(7), location:
|
|
17310
|
+
refs.push({ ref: obj.slice(7), location: path18 });
|
|
17313
17311
|
} else if (obj && typeof obj === "object") {
|
|
17314
17312
|
for (const [key, val] of Object.entries(obj)) {
|
|
17315
|
-
collectRefs(val, `${
|
|
17313
|
+
collectRefs(val, `${path18}.${key}`);
|
|
17316
17314
|
}
|
|
17317
17315
|
}
|
|
17318
17316
|
}
|
|
@@ -17357,13 +17355,14 @@ async function createEntryPoint(flowSettings, buildOptions, packagePaths) {
|
|
|
17357
17355
|
validateComponentNames(flowWithSections.transformers, "transformers");
|
|
17358
17356
|
if (flowWithSections.stores)
|
|
17359
17357
|
validateComponentNames(flowWithSections.stores, "stores");
|
|
17360
|
-
const { importStatements } = generateImportStatements(
|
|
17358
|
+
const { importStatements, devExportEntries } = await generateImportStatements(
|
|
17361
17359
|
buildOptions.packages,
|
|
17362
17360
|
destinationPackages,
|
|
17363
17361
|
sourcePackages,
|
|
17364
17362
|
transformerPackages,
|
|
17365
17363
|
storePackages,
|
|
17366
|
-
explicitCodeImports
|
|
17364
|
+
explicitCodeImports,
|
|
17365
|
+
packagePaths
|
|
17367
17366
|
);
|
|
17368
17367
|
const importsCode = importStatements.join("\n");
|
|
17369
17368
|
const hasFlow = Object.values(flowSettings.sources || {}).some(
|
|
@@ -17387,9 +17386,14 @@ ${userCode}` : userCode,
|
|
|
17387
17386
|
codeConfigObject,
|
|
17388
17387
|
buildOptions.code || ""
|
|
17389
17388
|
);
|
|
17389
|
+
const devExportsBlock = devExportEntries.length > 0 ? `
|
|
17390
|
+
export const __devExports = {
|
|
17391
|
+
${devExportEntries.join(",\n ")},
|
|
17392
|
+
};` : "";
|
|
17393
|
+
const fullModule = wireConfigModule + devExportsBlock;
|
|
17390
17394
|
const codeEntry = importsCode ? `${importsCode}
|
|
17391
17395
|
|
|
17392
|
-
${
|
|
17396
|
+
${fullModule}` : fullModule;
|
|
17393
17397
|
return { codeEntry, dataPayload, hasFlow: true };
|
|
17394
17398
|
}
|
|
17395
17399
|
function createBuildError(buildError, code) {
|
|
@@ -17429,7 +17433,7 @@ function buildSplitConfigObject(flowSettings, explicitCodeImports) {
|
|
|
17429
17433
|
if (step.code && typeof step.code === "string" && step.package && explicitCodeImports.has(step.package)) {
|
|
17430
17434
|
return step.code;
|
|
17431
17435
|
}
|
|
17432
|
-
return
|
|
17436
|
+
return q(step.package);
|
|
17433
17437
|
}
|
|
17434
17438
|
function getStepProps(step) {
|
|
17435
17439
|
const props = {};
|
|
@@ -17716,12 +17720,12 @@ var init_bundler = __esm({
|
|
|
17716
17720
|
});
|
|
17717
17721
|
|
|
17718
17722
|
// src/commands/bundle/upload.ts
|
|
17719
|
-
import
|
|
17723
|
+
import fs10 from "fs-extra";
|
|
17720
17724
|
function sanitizeUrl(url2) {
|
|
17721
17725
|
return url2.split("?")[0];
|
|
17722
17726
|
}
|
|
17723
17727
|
async function uploadBundleToUrl(filePath, url2, timeoutMs = 3e4) {
|
|
17724
|
-
const bundleContent = await
|
|
17728
|
+
const bundleContent = await fs10.readFile(filePath);
|
|
17725
17729
|
const doUpload = async (attempt) => {
|
|
17726
17730
|
const response = await fetch(url2, {
|
|
17727
17731
|
method: "PUT",
|
|
@@ -17800,8 +17804,8 @@ var init_api_client = __esm({
|
|
|
17800
17804
|
});
|
|
17801
17805
|
|
|
17802
17806
|
// src/commands/bundle/dockerfile.ts
|
|
17803
|
-
import
|
|
17804
|
-
import
|
|
17807
|
+
import path11 from "path";
|
|
17808
|
+
import fs11 from "fs-extra";
|
|
17805
17809
|
function buildDockerfileContent(platform, includedFolders) {
|
|
17806
17810
|
const bundleFile = platform === "web" ? "walker.js" : "bundle.mjs";
|
|
17807
17811
|
const lines = [
|
|
@@ -17811,21 +17815,21 @@ function buildDockerfileContent(platform, includedFolders) {
|
|
|
17811
17815
|
`COPY ${bundleFile} /app/flow/${bundleFile}`
|
|
17812
17816
|
];
|
|
17813
17817
|
for (const folder of includedFolders) {
|
|
17814
|
-
const name =
|
|
17818
|
+
const name = path11.basename(folder);
|
|
17815
17819
|
lines.push(`COPY ${name}/ /app/flow/${name}/`);
|
|
17816
17820
|
}
|
|
17817
17821
|
lines.push("", `ENV BUNDLE=/app/flow/${bundleFile}`, "", "EXPOSE 8080", "");
|
|
17818
17822
|
return lines.join("\n");
|
|
17819
17823
|
}
|
|
17820
17824
|
async function generateDockerfile(outputDir, platform, logger, customFile, includedFolders) {
|
|
17821
|
-
const destPath =
|
|
17822
|
-
if (customFile && await
|
|
17823
|
-
await
|
|
17825
|
+
const destPath = path11.join(outputDir, "Dockerfile");
|
|
17826
|
+
if (customFile && await fs11.pathExists(customFile)) {
|
|
17827
|
+
await fs11.copy(customFile, destPath);
|
|
17824
17828
|
logger.info(`Dockerfile: ${destPath} (copied from ${customFile})`);
|
|
17825
17829
|
return;
|
|
17826
17830
|
}
|
|
17827
17831
|
const dockerfile = buildDockerfileContent(platform, includedFolders || []);
|
|
17828
|
-
await
|
|
17832
|
+
await fs11.writeFile(destPath, dockerfile);
|
|
17829
17833
|
logger.info(`Dockerfile: ${destPath}`);
|
|
17830
17834
|
}
|
|
17831
17835
|
var init_dockerfile = __esm({
|
|
@@ -17835,14 +17839,14 @@ var init_dockerfile = __esm({
|
|
|
17835
17839
|
});
|
|
17836
17840
|
|
|
17837
17841
|
// src/commands/bundle/index.ts
|
|
17838
|
-
import
|
|
17839
|
-
import
|
|
17842
|
+
import path12 from "path";
|
|
17843
|
+
import fs12 from "fs-extra";
|
|
17840
17844
|
function resolveOutputPath(output, buildOptions) {
|
|
17841
|
-
const resolved =
|
|
17842
|
-
const ext =
|
|
17843
|
-
if (output.endsWith("/") || output.endsWith(
|
|
17845
|
+
const resolved = path12.resolve(output);
|
|
17846
|
+
const ext = path12.extname(resolved);
|
|
17847
|
+
if (output.endsWith("/") || output.endsWith(path12.sep) || !ext) {
|
|
17844
17848
|
const filename = buildOptions.platform === "browser" ? "walker.js" : "bundle.mjs";
|
|
17845
|
-
return
|
|
17849
|
+
return path12.join(resolved, filename);
|
|
17846
17850
|
}
|
|
17847
17851
|
return resolved;
|
|
17848
17852
|
}
|
|
@@ -17872,7 +17876,7 @@ async function bundleCommand(options) {
|
|
|
17872
17876
|
} catch {
|
|
17873
17877
|
throw new Error("Invalid JSON received on stdin");
|
|
17874
17878
|
}
|
|
17875
|
-
configPath =
|
|
17879
|
+
configPath = path12.resolve(process.cwd(), "stdin.config.json");
|
|
17876
17880
|
} else {
|
|
17877
17881
|
const file2 = options.config || "bundle.config.json";
|
|
17878
17882
|
configPath = resolveAsset(file2, "config");
|
|
@@ -17926,19 +17930,25 @@ async function bundleCommand(options) {
|
|
|
17926
17930
|
if (uploadUrl) {
|
|
17927
17931
|
await uploadBundleToUrl(buildOptions.output, uploadUrl);
|
|
17928
17932
|
logger.info(`Uploaded to: ${sanitizeUrl(uploadUrl)}`);
|
|
17929
|
-
await
|
|
17933
|
+
await fs12.remove(buildOptions.output);
|
|
17930
17934
|
}
|
|
17931
17935
|
if (!options.json && !options.all && options.stats && stats) {
|
|
17932
17936
|
displayStats(stats, logger);
|
|
17933
17937
|
}
|
|
17934
17938
|
if (writingToStdout && !options.json) {
|
|
17935
|
-
const bundleContent = await
|
|
17939
|
+
const bundleContent = await fs12.readFile(buildOptions.output);
|
|
17936
17940
|
await writeResult(bundleContent, {});
|
|
17941
|
+
if (process.stdout.isTTY) {
|
|
17942
|
+
const defaultPath = buildOptions.platform === "browser" ? "./dist/walker.js" : "./dist/bundle.mjs";
|
|
17943
|
+
logger.info(
|
|
17944
|
+
`Bundle written to stdout. Use -o ${defaultPath} to write to file.`
|
|
17945
|
+
);
|
|
17946
|
+
}
|
|
17937
17947
|
}
|
|
17938
17948
|
if (options.dockerfile && options.output) {
|
|
17939
|
-
const platform =
|
|
17949
|
+
const platform = J(flowSettings);
|
|
17940
17950
|
if (platform) {
|
|
17941
|
-
const outputDir =
|
|
17951
|
+
const outputDir = path12.dirname(buildOptions.output);
|
|
17942
17952
|
const customFile = typeof options.dockerfile === "string" ? options.dockerfile : void 0;
|
|
17943
17953
|
await generateDockerfile(
|
|
17944
17954
|
outputDir,
|
|
@@ -18009,7 +18019,7 @@ Build Summary: ${successCount}/${results.length} succeeded`
|
|
|
18009
18019
|
}
|
|
18010
18020
|
async function bundle(configOrPath, options = {}) {
|
|
18011
18021
|
let rawConfig;
|
|
18012
|
-
let configPath =
|
|
18022
|
+
let configPath = path12.resolve(process.cwd(), "walkeros.config.json");
|
|
18013
18023
|
if (typeof configOrPath === "string") {
|
|
18014
18024
|
configPath = resolveAsset(configOrPath, "config");
|
|
18015
18025
|
rawConfig = await loadJsonConfig(configPath);
|
|
@@ -18048,45 +18058,6 @@ var init_bundle = __esm({
|
|
|
18048
18058
|
}
|
|
18049
18059
|
});
|
|
18050
18060
|
|
|
18051
|
-
// src/commands/push/env-loader.ts
|
|
18052
|
-
var env_loader_exports = {};
|
|
18053
|
-
__export(env_loader_exports, {
|
|
18054
|
-
loadDestinationEnvs: () => loadDestinationEnvs
|
|
18055
|
-
});
|
|
18056
|
-
async function loadDestinationEnvs(destinations, packages, configDir) {
|
|
18057
|
-
const envs = {};
|
|
18058
|
-
const resolveDir = configDir || process.cwd();
|
|
18059
|
-
for (const [destKey, destConfig] of Object.entries(destinations)) {
|
|
18060
|
-
const typedConfig = destConfig;
|
|
18061
|
-
if (!typedConfig.package) {
|
|
18062
|
-
continue;
|
|
18063
|
-
}
|
|
18064
|
-
try {
|
|
18065
|
-
const packageName = typedConfig.package;
|
|
18066
|
-
const isDemoPackage = packageName.includes("-demo");
|
|
18067
|
-
const importPath = isDemoPackage ? resolvePackageImportPath(packageName, packages, resolveDir) : resolvePackageImportPath(packageName, packages, resolveDir, "/dev");
|
|
18068
|
-
const module = await import(importPath);
|
|
18069
|
-
const examplesModule = module.examples || module.default?.examples;
|
|
18070
|
-
const envModule = examplesModule?.env;
|
|
18071
|
-
if (envModule?.push) {
|
|
18072
|
-
envs[destKey] = {
|
|
18073
|
-
init: envModule.init,
|
|
18074
|
-
push: envModule.push,
|
|
18075
|
-
simulation: envModule.simulation || []
|
|
18076
|
-
};
|
|
18077
|
-
}
|
|
18078
|
-
} catch {
|
|
18079
|
-
}
|
|
18080
|
-
}
|
|
18081
|
-
return envs;
|
|
18082
|
-
}
|
|
18083
|
-
var init_env_loader = __esm({
|
|
18084
|
-
"src/commands/push/env-loader.ts"() {
|
|
18085
|
-
"use strict";
|
|
18086
|
-
init_package_path();
|
|
18087
|
-
}
|
|
18088
|
-
});
|
|
18089
|
-
|
|
18090
18061
|
// src/runtime/cache.ts
|
|
18091
18062
|
var cache_exports = {};
|
|
18092
18063
|
__export(cache_exports, {
|
|
@@ -18095,7 +18066,7 @@ __export(cache_exports, {
|
|
|
18095
18066
|
writeCache: () => writeCache
|
|
18096
18067
|
});
|
|
18097
18068
|
import {
|
|
18098
|
-
existsSync as
|
|
18069
|
+
existsSync as existsSync3,
|
|
18099
18070
|
mkdirSync as mkdirSync3,
|
|
18100
18071
|
copyFileSync,
|
|
18101
18072
|
writeFileSync as writeFileSync3,
|
|
@@ -18113,7 +18084,7 @@ function readCache(cacheDir) {
|
|
|
18113
18084
|
try {
|
|
18114
18085
|
const metaPath = join3(cacheDir, "meta.json");
|
|
18115
18086
|
const bundlePath = join3(cacheDir, "bundle.mjs");
|
|
18116
|
-
if (!
|
|
18087
|
+
if (!existsSync3(metaPath) || !existsSync3(bundlePath)) return null;
|
|
18117
18088
|
const meta3 = JSON.parse(readFileSync3(metaPath, "utf-8"));
|
|
18118
18089
|
return { bundlePath, version: meta3.version };
|
|
18119
18090
|
} catch {
|
|
@@ -18123,7 +18094,7 @@ function readCache(cacheDir) {
|
|
|
18123
18094
|
function readCacheConfig(cacheDir) {
|
|
18124
18095
|
try {
|
|
18125
18096
|
const configPath = join3(cacheDir, "config.json");
|
|
18126
|
-
if (!
|
|
18097
|
+
if (!existsSync3(configPath)) return null;
|
|
18127
18098
|
return readFileSync3(configPath, "utf-8");
|
|
18128
18099
|
} catch {
|
|
18129
18100
|
return null;
|
|
@@ -18141,15 +18112,15 @@ __export(utils_exports, {
|
|
|
18141
18112
|
isPreBuiltConfig: () => isPreBuiltConfig,
|
|
18142
18113
|
prepareBundleForRun: () => prepareBundleForRun
|
|
18143
18114
|
});
|
|
18144
|
-
import
|
|
18145
|
-
import
|
|
18115
|
+
import path16 from "path";
|
|
18116
|
+
import fs15 from "fs-extra";
|
|
18146
18117
|
async function prepareBundleForRun(configPath, options) {
|
|
18147
18118
|
const tempDir = getTmpPath(
|
|
18148
18119
|
void 0,
|
|
18149
18120
|
`run-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
|
|
18150
18121
|
);
|
|
18151
|
-
await
|
|
18152
|
-
const tempPath =
|
|
18122
|
+
await fs15.ensureDir(tempDir);
|
|
18123
|
+
const tempPath = path16.join(tempDir, "bundle.mjs");
|
|
18153
18124
|
await bundle(configPath, {
|
|
18154
18125
|
cache: true,
|
|
18155
18126
|
verbose: options.verbose,
|
|
@@ -18164,7 +18135,7 @@ async function prepareBundleForRun(configPath, options) {
|
|
|
18164
18135
|
return {
|
|
18165
18136
|
bundlePath: tempPath,
|
|
18166
18137
|
cleanup: async () => {
|
|
18167
|
-
await
|
|
18138
|
+
await fs15.remove(tempDir);
|
|
18168
18139
|
}
|
|
18169
18140
|
};
|
|
18170
18141
|
}
|
|
@@ -18221,8 +18192,8 @@ init_bundle();
|
|
|
18221
18192
|
|
|
18222
18193
|
// src/commands/push/index.ts
|
|
18223
18194
|
init_dist();
|
|
18224
|
-
import
|
|
18225
|
-
import
|
|
18195
|
+
import path15 from "path";
|
|
18196
|
+
import fs14 from "fs-extra";
|
|
18226
18197
|
|
|
18227
18198
|
// ../collector/dist/index.mjs
|
|
18228
18199
|
init_dist();
|
|
@@ -18237,18 +18208,18 @@ init_dist();
|
|
|
18237
18208
|
init_dist();
|
|
18238
18209
|
init_dist();
|
|
18239
18210
|
init_dist();
|
|
18240
|
-
function
|
|
18211
|
+
function X2(e3, n4) {
|
|
18241
18212
|
return e3.storeId && n4.stores[e3.storeId] ? n4.stores[e3.storeId] : n4.stores.__cache;
|
|
18242
18213
|
}
|
|
18243
|
-
function
|
|
18214
|
+
function Y3(e3) {
|
|
18244
18215
|
const n4 = {};
|
|
18245
18216
|
for (const [t, o2] of Object.entries(e3)) {
|
|
18246
18217
|
const e4 = o2.config?.next;
|
|
18247
|
-
e4 && !
|
|
18218
|
+
e4 && !dn(e4) ? n4[t] = { next: e4 } : n4[t] = {};
|
|
18248
18219
|
}
|
|
18249
18220
|
return n4;
|
|
18250
18221
|
}
|
|
18251
|
-
function
|
|
18222
|
+
function ee2(e3, n4 = {}) {
|
|
18252
18223
|
if (!e3) return [];
|
|
18253
18224
|
if (Array.isArray(e3)) return e3;
|
|
18254
18225
|
const t = [], o2 = /* @__PURE__ */ new Set();
|
|
@@ -18264,23 +18235,23 @@ function Z3(e3, n4 = {}) {
|
|
|
18264
18235
|
}
|
|
18265
18236
|
return t;
|
|
18266
18237
|
}
|
|
18267
|
-
async function
|
|
18238
|
+
async function ne3(e3, n4, t) {
|
|
18268
18239
|
if (n4.init && !n4.config.init) {
|
|
18269
|
-
const o2 = n4.type || "unknown", s2 = e3.logger.scope(`transformer:${o2}`), r2 = { collector: e3, logger: s2, id: t, ingest: x(t), config: n4.config, env:
|
|
18240
|
+
const o2 = n4.type || "unknown", s2 = e3.logger.scope(`transformer:${o2}`), r2 = { collector: e3, logger: s2, id: t, ingest: x(t), config: n4.config, env: se2(n4.config.env) };
|
|
18270
18241
|
s2.debug("init");
|
|
18271
|
-
const i2 = await
|
|
18242
|
+
const i2 = await Be(n4.init, "TransformerInit", e3.hooks)(r2);
|
|
18272
18243
|
if (false === i2) return false;
|
|
18273
18244
|
n4.config = { ...i2 || n4.config, env: i2?.env || n4.config.env, init: true }, s2.debug("init done");
|
|
18274
18245
|
}
|
|
18275
18246
|
return true;
|
|
18276
18247
|
}
|
|
18277
|
-
async function
|
|
18278
|
-
const i2 = n4.type || "unknown", a2 = e3.logger.scope(`transformer:${i2}`), c2 = { collector: e3, logger: a2, id: t, ingest: s2, config: n4.config, env: { ...
|
|
18248
|
+
async function te3(e3, n4, t, o2, s2, r2) {
|
|
18249
|
+
const i2 = n4.type || "unknown", a2 = e3.logger.scope(`transformer:${i2}`), c2 = { collector: e3, logger: a2, id: t, ingest: s2, config: n4.config, env: { ...se2(n4.config.env), ...r2 ? { respond: r2 } : {} } };
|
|
18279
18250
|
a2.debug("push", { event: o2.name });
|
|
18280
|
-
const u3 = await
|
|
18251
|
+
const u3 = await Be(n4.push, "TransformerPush", e3.hooks)(o2, c2);
|
|
18281
18252
|
return a2.debug("push done"), u3;
|
|
18282
18253
|
}
|
|
18283
|
-
async function
|
|
18254
|
+
async function oe2(e3, n4, t, o2, s2, r2, i2) {
|
|
18284
18255
|
i2 && s2?._meta && (s2._meta.chainPath = i2);
|
|
18285
18256
|
let a2 = o2, c2 = r2;
|
|
18286
18257
|
for (const o3 of t) {
|
|
@@ -18291,7 +18262,7 @@ async function te3(e3, n4, t, o2, s2, r2, i2) {
|
|
|
18291
18262
|
}
|
|
18292
18263
|
if (s2 && s2._meta && s2._meta.path.length > 256) return e3.logger.error(`Max path length exceeded at ${o3}`), { event: null, respond: c2 };
|
|
18293
18264
|
s2 && s2._meta && (s2._meta.hops++, s2._meta.path.push(o3));
|
|
18294
|
-
if (!await
|
|
18265
|
+
if (!await Ne(ne3)(e3, r3, o3)) return e3.logger.error(`Transformer init failed: ${o3}`), { event: null, respond: c2 };
|
|
18295
18266
|
if (i2 && void 0 !== r3.config?.chainMocks?.[i2]) {
|
|
18296
18267
|
const n5 = r3.config.chainMocks[i2];
|
|
18297
18268
|
e3.logger.scope(`transformer:${r3.type || "unknown"}`).debug("chainMock", { chain: i2 }), a2 = n5;
|
|
@@ -18302,10 +18273,10 @@ async function te3(e3, n4, t, o2, s2, r2, i2) {
|
|
|
18302
18273
|
continue;
|
|
18303
18274
|
}
|
|
18304
18275
|
if (r3.config?.disabled) continue;
|
|
18305
|
-
const u3 = r3.config?.cache, f2 = u3 ?
|
|
18276
|
+
const u3 = r3.config?.cache, f2 = u3 ? Oi(u3) : void 0, l3 = f2 ? X2(f2, e3) : void 0;
|
|
18306
18277
|
let d3;
|
|
18307
18278
|
if (f2 && l3) {
|
|
18308
|
-
const e4 =
|
|
18279
|
+
const e4 = Ei(s2, a2), n5 = Ci(f2, l3, e4, `t:${o3}`);
|
|
18309
18280
|
if ("HIT" === n5?.status && n5.value) {
|
|
18310
18281
|
if (a2 = n5.value, f2.full) return { event: a2, respond: c2 };
|
|
18311
18282
|
continue;
|
|
@@ -18314,31 +18285,31 @@ async function te3(e3, n4, t, o2, s2, r2, i2) {
|
|
|
18314
18285
|
}
|
|
18315
18286
|
const g2 = r3.config.before;
|
|
18316
18287
|
if (g2) {
|
|
18317
|
-
const t2 =
|
|
18288
|
+
const t2 = ee2("string" == typeof g2 || Array.isArray(g2) && !dn(g2) ? g2 : un(pn(g2), Ei(s2, a2)) || void 0, Y3(n4));
|
|
18318
18289
|
if (t2.length > 0) {
|
|
18319
|
-
const o4 = await
|
|
18290
|
+
const o4 = await oe2(e3, n4, t2, a2, s2, c2, i2);
|
|
18320
18291
|
if (null === o4.event) return { event: null, respond: o4.respond ?? c2 };
|
|
18321
18292
|
o4.respond && (c2 = o4.respond), a2 = Array.isArray(o4.event) ? o4.event[0] : o4.event;
|
|
18322
18293
|
}
|
|
18323
18294
|
}
|
|
18324
|
-
const p2 = await
|
|
18295
|
+
const p2 = await Ne(te3, (n5) => (e3.logger.scope(`transformer:${r3.type || "unknown"}`).error("Push failed", { error: n5 }), false))(e3, r3, o3, a2, s2, c2);
|
|
18325
18296
|
if (false === p2) return { event: null, respond: c2 };
|
|
18326
18297
|
if (Array.isArray(p2)) {
|
|
18327
18298
|
const r4 = t.slice(t.indexOf(o3) + 1), u4 = await Promise.all(p2.map(async (t2) => {
|
|
18328
18299
|
const o4 = t2.event || a2, u5 = s2 ? { ...s2, _meta: { ...s2._meta, path: [...s2._meta.path] } } : x("unknown");
|
|
18329
18300
|
if (t2.next) {
|
|
18330
18301
|
let s3 = t2.next;
|
|
18331
|
-
if (
|
|
18332
|
-
const e4 =
|
|
18333
|
-
s3 =
|
|
18302
|
+
if (dn(t2.next)) {
|
|
18303
|
+
const e4 = pn(t2.next);
|
|
18304
|
+
s3 = un(e4, Ei(u5, o4));
|
|
18334
18305
|
}
|
|
18335
18306
|
if (s3) {
|
|
18336
|
-
const t3 =
|
|
18337
|
-
if (t3.length > 0) return
|
|
18307
|
+
const t3 = ee2(s3, Y3(n4));
|
|
18308
|
+
if (t3.length > 0) return oe2(e3, n4, t3, o4, u5, c2, i2);
|
|
18338
18309
|
}
|
|
18339
18310
|
return { event: o4, respond: c2 };
|
|
18340
18311
|
}
|
|
18341
|
-
return r4.length > 0 ?
|
|
18312
|
+
return r4.length > 0 ? oe2(e3, n4, r4, o4, u5, c2, i2) : { event: o4, respond: c2 };
|
|
18342
18313
|
}));
|
|
18343
18314
|
let f3 = c2;
|
|
18344
18315
|
const l4 = [];
|
|
@@ -18353,41 +18324,41 @@ async function te3(e3, n4, t, o2, s2, r2, i2) {
|
|
|
18353
18324
|
const { event: t2, respond: o4, next: r4 } = p2;
|
|
18354
18325
|
if (o4 && (c2 = o4), r4) {
|
|
18355
18326
|
let o5 = r4;
|
|
18356
|
-
if (
|
|
18357
|
-
const e4 =
|
|
18358
|
-
if (o5 =
|
|
18327
|
+
if (dn(r4)) {
|
|
18328
|
+
const e4 = pn(r4);
|
|
18329
|
+
if (o5 = un(e4, Ei(s2, a2)), !o5) {
|
|
18359
18330
|
t2 && (a2 = t2);
|
|
18360
18331
|
continue;
|
|
18361
18332
|
}
|
|
18362
18333
|
}
|
|
18363
|
-
const u4 =
|
|
18364
|
-
return u4.length > 0 ?
|
|
18334
|
+
const u4 = ee2(o5, Y3(n4));
|
|
18335
|
+
return u4.length > 0 ? oe2(e3, n4, u4, t2 || a2, s2, c2, i2) : (e3.logger.warn(`Branch target not found: ${JSON.stringify(r4)}`), { event: null, respond: c2 });
|
|
18365
18336
|
}
|
|
18366
18337
|
t2 && (a2 = t2);
|
|
18367
18338
|
}
|
|
18368
|
-
if (d3 && l3 &&
|
|
18369
|
-
const t2 = r3.config.next, o4 =
|
|
18339
|
+
if (d3 && l3 && $i(l3, d3.key, a2, d3.ttl), (!p2 || "object" == typeof p2 && !p2.next) && r3.config.next && dn(r3.config.next)) {
|
|
18340
|
+
const t2 = r3.config.next, o4 = pn(t2), u4 = un(o4, Ei(s2, a2));
|
|
18370
18341
|
if (u4) {
|
|
18371
|
-
const t3 =
|
|
18372
|
-
if (t3.length > 0) return
|
|
18342
|
+
const t3 = ee2(u4, Y3(n4));
|
|
18343
|
+
if (t3.length > 0) return oe2(e3, n4, t3, a2, s2, c2, i2);
|
|
18373
18344
|
}
|
|
18374
18345
|
return { event: a2, respond: c2 };
|
|
18375
18346
|
}
|
|
18376
18347
|
}
|
|
18377
18348
|
return { event: a2, respond: c2 };
|
|
18378
18349
|
}
|
|
18379
|
-
function
|
|
18350
|
+
function se2(e3) {
|
|
18380
18351
|
return e3 && Y(e3) ? e3 : {};
|
|
18381
18352
|
}
|
|
18382
|
-
function
|
|
18353
|
+
function Ge2(e3) {
|
|
18383
18354
|
if (null === e3 || "object" != typeof e3) return e3;
|
|
18384
|
-
if (Array.isArray(e3)) return e3.map(
|
|
18355
|
+
if (Array.isArray(e3)) return e3.map(Ge2);
|
|
18385
18356
|
const n4 = {};
|
|
18386
|
-
for (const [t, o2] of Object.entries(e3)) n4[t] = "function" == typeof o2 ? o2 :
|
|
18357
|
+
for (const [t, o2] of Object.entries(e3)) n4[t] = "function" == typeof o2 ? o2 : Ge2(o2);
|
|
18387
18358
|
return n4;
|
|
18388
18359
|
}
|
|
18389
|
-
function
|
|
18390
|
-
const n4 = [], { simulation: t, ...o2 } = e3, s2 =
|
|
18360
|
+
function Ne3(e3) {
|
|
18361
|
+
const n4 = [], { simulation: t, ...o2 } = e3, s2 = Ge2(o2);
|
|
18391
18362
|
for (const e4 of t) {
|
|
18392
18363
|
const t2 = e4.startsWith("call:") ? e4.slice(5) : e4, o3 = t2.split(".");
|
|
18393
18364
|
let r2 = s2;
|
|
@@ -18584,12 +18555,9 @@ function applyOverrides(config2, overrides) {
|
|
|
18584
18555
|
}
|
|
18585
18556
|
}
|
|
18586
18557
|
|
|
18587
|
-
// src/commands/push/index.ts
|
|
18588
|
-
init_package_path();
|
|
18589
|
-
|
|
18590
18558
|
// src/commands/push/flow-context.ts
|
|
18591
18559
|
init_utils2();
|
|
18592
|
-
import
|
|
18560
|
+
import path13 from "path";
|
|
18593
18561
|
import { pathToFileURL } from "url";
|
|
18594
18562
|
import { JSDOM, VirtualConsole } from "jsdom";
|
|
18595
18563
|
|
|
@@ -18679,7 +18647,15 @@ function installTimerInterception(options = {}) {
|
|
|
18679
18647
|
|
|
18680
18648
|
// src/commands/push/flow-context.ts
|
|
18681
18649
|
async function withFlowContext(options, fn3) {
|
|
18682
|
-
const {
|
|
18650
|
+
const {
|
|
18651
|
+
esmPath,
|
|
18652
|
+
platform,
|
|
18653
|
+
logger,
|
|
18654
|
+
snapshotCode,
|
|
18655
|
+
timeout,
|
|
18656
|
+
networkCalls,
|
|
18657
|
+
asyncDrain
|
|
18658
|
+
} = options;
|
|
18683
18659
|
const startTime = Date.now();
|
|
18684
18660
|
const g2 = global;
|
|
18685
18661
|
let savedWindow, savedDocument, savedNavigator;
|
|
@@ -18726,7 +18702,7 @@ async function withFlowContext(options, fn3) {
|
|
|
18726
18702
|
vm.runInThisContext(snapshotCode);
|
|
18727
18703
|
}
|
|
18728
18704
|
}
|
|
18729
|
-
const fileUrl = pathToFileURL(
|
|
18705
|
+
const fileUrl = pathToFileURL(path13.resolve(esmPath)).href;
|
|
18730
18706
|
const module = await import(`${fileUrl}?t=${Date.now()}`);
|
|
18731
18707
|
const { wireConfig, startFlow } = module;
|
|
18732
18708
|
if (typeof wireConfig !== "function" || typeof startFlow !== "function") {
|
|
@@ -18737,14 +18713,15 @@ async function withFlowContext(options, fn3) {
|
|
|
18737
18713
|
const flowModule = {
|
|
18738
18714
|
wireConfig,
|
|
18739
18715
|
startFlow,
|
|
18740
|
-
__configData: module.__configData
|
|
18716
|
+
__configData: module.__configData,
|
|
18717
|
+
__devExports: module.__devExports
|
|
18741
18718
|
};
|
|
18742
18719
|
if (timerControl) {
|
|
18743
18720
|
const result = await fn3(flowModule);
|
|
18744
18721
|
await timerControl.flush(asyncDrain?.timeout ?? 5e3);
|
|
18745
18722
|
return result;
|
|
18746
18723
|
} else if (timeout) {
|
|
18747
|
-
const timeoutPromise = new Promise((
|
|
18724
|
+
const timeoutPromise = new Promise((_3, reject) => {
|
|
18748
18725
|
setTimeout(
|
|
18749
18726
|
() => reject(new Error(`Push timeout after ${timeout}ms`)),
|
|
18750
18727
|
timeout
|
|
@@ -18826,50 +18803,40 @@ init_cli_logger();
|
|
|
18826
18803
|
init_tmp();
|
|
18827
18804
|
init_config();
|
|
18828
18805
|
init_bundler();
|
|
18829
|
-
import
|
|
18830
|
-
import
|
|
18831
|
-
async function prepareFlow(
|
|
18806
|
+
import path14 from "path";
|
|
18807
|
+
import fs13 from "fs-extra";
|
|
18808
|
+
async function prepareFlow(input) {
|
|
18832
18809
|
const logger = createCLILogger({
|
|
18833
|
-
silent:
|
|
18834
|
-
verbose:
|
|
18810
|
+
silent: input.silent,
|
|
18811
|
+
verbose: input.verbose
|
|
18835
18812
|
});
|
|
18836
18813
|
logger.debug("Loading flow configuration");
|
|
18837
|
-
const { flowSettings, buildOptions } =
|
|
18838
|
-
|
|
18839
|
-
|
|
18840
|
-
|
|
18841
|
-
|
|
18842
|
-
}
|
|
18843
|
-
);
|
|
18844
|
-
const platform = L(flowSettings);
|
|
18845
|
-
const configDir = buildOptions.configDir || process.cwd();
|
|
18814
|
+
const { flowSettings, buildOptions } = loadBundleConfig(input.config, {
|
|
18815
|
+
configPath: process.cwd(),
|
|
18816
|
+
flowName: input.flow
|
|
18817
|
+
});
|
|
18818
|
+
const platform = J(flowSettings);
|
|
18846
18819
|
const overrides = buildOverrides(
|
|
18847
|
-
{ simulate:
|
|
18820
|
+
{ simulate: input.simulate, mock: input.mock },
|
|
18848
18821
|
flowSettings
|
|
18849
18822
|
);
|
|
18850
|
-
if (
|
|
18851
|
-
|
|
18852
|
-
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
|
|
18856
|
-
|
|
18857
|
-
for (const [destId, env] of Object.entries(envs)) {
|
|
18858
|
-
if (overrides.destinations[destId] && env.push) {
|
|
18859
|
-
overrides.destinations[destId].env = env.push;
|
|
18860
|
-
if (env.simulation && env.simulation.length > 0) {
|
|
18861
|
-
overrides.destinations[destId].simulation = env.simulation;
|
|
18862
|
-
}
|
|
18823
|
+
if (input.mode === "prebuilt") {
|
|
18824
|
+
return {
|
|
18825
|
+
bundlePath: input.bundlePath,
|
|
18826
|
+
platform,
|
|
18827
|
+
overrides,
|
|
18828
|
+
flowSettings,
|
|
18829
|
+
cleanup: async () => {
|
|
18863
18830
|
}
|
|
18864
|
-
}
|
|
18831
|
+
};
|
|
18865
18832
|
}
|
|
18866
18833
|
logger.debug("Bundling flow configuration");
|
|
18867
18834
|
const tempDir = getTmpPath(
|
|
18868
18835
|
void 0,
|
|
18869
18836
|
`push-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
|
|
18870
18837
|
);
|
|
18871
|
-
await
|
|
18872
|
-
const bundlePath =
|
|
18838
|
+
await fs13.ensureDir(tempDir);
|
|
18839
|
+
const bundlePath = path14.join(tempDir, "bundle.mjs");
|
|
18873
18840
|
const pushBuildOptions = {
|
|
18874
18841
|
...buildOptions,
|
|
18875
18842
|
output: bundlePath,
|
|
@@ -18885,9 +18852,8 @@ async function prepareFlow(options) {
|
|
|
18885
18852
|
platform,
|
|
18886
18853
|
overrides,
|
|
18887
18854
|
flowSettings,
|
|
18888
|
-
configDir,
|
|
18889
18855
|
cleanup: async () => {
|
|
18890
|
-
await
|
|
18856
|
+
await fs13.remove(tempDir).catch(() => {
|
|
18891
18857
|
});
|
|
18892
18858
|
}
|
|
18893
18859
|
};
|
|
@@ -18898,15 +18864,15 @@ init_dev();
|
|
|
18898
18864
|
function resolveBeforeChain(before, transformers, ingest, event) {
|
|
18899
18865
|
if (!before) return [];
|
|
18900
18866
|
const next = before;
|
|
18901
|
-
if (
|
|
18902
|
-
const compiled =
|
|
18903
|
-
const resolved =
|
|
18867
|
+
if (dn(next)) {
|
|
18868
|
+
const compiled = pn(next);
|
|
18869
|
+
const resolved = un(compiled, Ei(ingest, event));
|
|
18904
18870
|
if (!resolved) return [];
|
|
18905
|
-
return
|
|
18871
|
+
return ee2(resolved, Y3(transformers));
|
|
18906
18872
|
}
|
|
18907
|
-
return
|
|
18873
|
+
return ee2(
|
|
18908
18874
|
next,
|
|
18909
|
-
|
|
18875
|
+
Y3(transformers)
|
|
18910
18876
|
);
|
|
18911
18877
|
}
|
|
18912
18878
|
async function pushCore(inputPath, event, options = {}) {
|
|
@@ -18967,7 +18933,7 @@ async function pushCore(inputPath, event, options = {}) {
|
|
|
18967
18933
|
};
|
|
18968
18934
|
} finally {
|
|
18969
18935
|
if (tempDir) {
|
|
18970
|
-
await
|
|
18936
|
+
await fs14.remove(tempDir).catch(() => {
|
|
18971
18937
|
});
|
|
18972
18938
|
}
|
|
18973
18939
|
}
|
|
@@ -19106,36 +19072,16 @@ async function executeConfigPush(options, validatedEvent, logger, setTempDir, sn
|
|
|
19106
19072
|
flowName: options.flow,
|
|
19107
19073
|
logger
|
|
19108
19074
|
});
|
|
19109
|
-
const platform =
|
|
19110
|
-
const overrides = buildOverrides(
|
|
19111
|
-
{ mock: options.mock },
|
|
19112
|
-
flowSettings
|
|
19113
|
-
);
|
|
19114
|
-
if (overrides.destinations) {
|
|
19115
|
-
const { loadDestinationEnvs: loadDestinationEnvs2 } = await Promise.resolve().then(() => (init_env_loader(), env_loader_exports));
|
|
19116
|
-
const configDir = buildOptions.configDir || process.cwd();
|
|
19117
|
-
const envs = await loadDestinationEnvs2(
|
|
19118
|
-
flowSettings.destinations ?? {},
|
|
19119
|
-
flowSettings.packages,
|
|
19120
|
-
configDir
|
|
19121
|
-
);
|
|
19122
|
-
for (const [destId, env] of Object.entries(envs)) {
|
|
19123
|
-
if (overrides.destinations[destId] && env.push) {
|
|
19124
|
-
overrides.destinations[destId].env = env.push;
|
|
19125
|
-
if (env.simulation && env.simulation.length > 0) {
|
|
19126
|
-
overrides.destinations[destId].simulation = env.simulation;
|
|
19127
|
-
}
|
|
19128
|
-
}
|
|
19129
|
-
}
|
|
19130
|
-
}
|
|
19075
|
+
const platform = J(flowSettings);
|
|
19076
|
+
const overrides = buildOverrides({ mock: options.mock }, flowSettings);
|
|
19131
19077
|
logger.debug("Bundling flow configuration");
|
|
19132
19078
|
const tempDir = getTmpPath(
|
|
19133
19079
|
void 0,
|
|
19134
19080
|
`push-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
|
|
19135
19081
|
);
|
|
19136
19082
|
setTempDir(tempDir);
|
|
19137
|
-
await
|
|
19138
|
-
const tempPath =
|
|
19083
|
+
await fs14.ensureDir(tempDir);
|
|
19084
|
+
const tempPath = path15.join(tempDir, "bundle.mjs");
|
|
19139
19085
|
const pushBuildOptions = {
|
|
19140
19086
|
...buildOptions,
|
|
19141
19087
|
output: tempPath,
|
|
@@ -19165,9 +19111,9 @@ async function executeBundlePush(bundleContent, platform, validatedEvent, logger
|
|
|
19165
19111
|
`push-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
|
|
19166
19112
|
);
|
|
19167
19113
|
setTempDir(tempDir);
|
|
19168
|
-
await
|
|
19169
|
-
const tempPath =
|
|
19170
|
-
await
|
|
19114
|
+
await fs14.ensureDir(tempDir);
|
|
19115
|
+
const tempPath = path15.join(tempDir, "bundle.mjs");
|
|
19116
|
+
await fs14.writeFile(tempPath, bundleContent, "utf8");
|
|
19171
19117
|
logger.debug(`Bundle written to: ${tempPath}`);
|
|
19172
19118
|
logger.debug(
|
|
19173
19119
|
`Executing in ${platform} environment (${platform === "web" ? "JSDOM" : "Node.js"})`
|
|
@@ -19186,7 +19132,15 @@ async function executeDestinationPush(esmPath, event, logger, platform, override
|
|
|
19186
19132
|
const startTime = Date.now();
|
|
19187
19133
|
const networkCalls = [];
|
|
19188
19134
|
return withFlowContext(
|
|
19189
|
-
{
|
|
19135
|
+
{
|
|
19136
|
+
esmPath,
|
|
19137
|
+
platform,
|
|
19138
|
+
logger,
|
|
19139
|
+
snapshotCode,
|
|
19140
|
+
timeout,
|
|
19141
|
+
networkCalls,
|
|
19142
|
+
asyncDrain: { timeout: 5e3 }
|
|
19143
|
+
},
|
|
19190
19144
|
async (module) => {
|
|
19191
19145
|
const config2 = module.wireConfig(module.__configData ?? void 0);
|
|
19192
19146
|
applyOverrides(config2, overrides || {});
|
|
@@ -19206,15 +19160,31 @@ async function executeDestinationPush(esmPath, event, logger, platform, override
|
|
|
19206
19160
|
}
|
|
19207
19161
|
);
|
|
19208
19162
|
}
|
|
19209
|
-
async function simulateSource(
|
|
19163
|
+
async function simulateSource(configOrPath, input, options) {
|
|
19210
19164
|
const startTime = Date.now();
|
|
19211
|
-
|
|
19212
|
-
|
|
19165
|
+
let config2;
|
|
19166
|
+
if (typeof configOrPath === "string") {
|
|
19167
|
+
config2 = await loadJsonConfig(configOrPath);
|
|
19168
|
+
} else {
|
|
19169
|
+
config2 = configOrPath;
|
|
19170
|
+
}
|
|
19171
|
+
const prepareInput = options.bundlePath ? {
|
|
19172
|
+
mode: "prebuilt",
|
|
19173
|
+
bundlePath: options.bundlePath,
|
|
19174
|
+
config: config2,
|
|
19213
19175
|
flow: options.flow,
|
|
19214
19176
|
simulate: ["source." + options.sourceId],
|
|
19215
19177
|
silent: options.silent,
|
|
19216
19178
|
verbose: options.verbose
|
|
19217
|
-
}
|
|
19179
|
+
} : {
|
|
19180
|
+
mode: "build",
|
|
19181
|
+
config: config2,
|
|
19182
|
+
flow: options.flow,
|
|
19183
|
+
simulate: ["source." + options.sourceId],
|
|
19184
|
+
silent: options.silent,
|
|
19185
|
+
verbose: options.verbose
|
|
19186
|
+
};
|
|
19187
|
+
const prepared = await prepareFlow(prepareInput);
|
|
19218
19188
|
try {
|
|
19219
19189
|
const logger = createCLILogger({
|
|
19220
19190
|
silent: options.silent,
|
|
@@ -19222,22 +19192,7 @@ async function simulateSource(configPath, input, options) {
|
|
|
19222
19192
|
});
|
|
19223
19193
|
const sourceConfig = (prepared.flowSettings.sources ?? {})[options.sourceId];
|
|
19224
19194
|
if (!sourceConfig?.package) {
|
|
19225
|
-
throw new Error(
|
|
19226
|
-
`Source "${options.sourceId}" has no package defined`
|
|
19227
|
-
);
|
|
19228
|
-
}
|
|
19229
|
-
const devPath = resolvePackageImportPath(
|
|
19230
|
-
sourceConfig.package,
|
|
19231
|
-
prepared.flowSettings.packages,
|
|
19232
|
-
prepared.configDir,
|
|
19233
|
-
"/dev"
|
|
19234
|
-
);
|
|
19235
|
-
const devModule = await import(devPath);
|
|
19236
|
-
const createTrigger = devModule.examples?.createTrigger || devModule.default?.examples?.createTrigger;
|
|
19237
|
-
if (!createTrigger) {
|
|
19238
|
-
throw new Error(
|
|
19239
|
-
`Source package "${sourceConfig.package}" has no createTrigger in /dev export`
|
|
19240
|
-
);
|
|
19195
|
+
throw new Error(`Source "${options.sourceId}" has no package defined`);
|
|
19241
19196
|
}
|
|
19242
19197
|
let snapshotCode;
|
|
19243
19198
|
if (options.snapshot) {
|
|
@@ -19256,17 +19211,26 @@ async function simulateSource(configPath, input, options) {
|
|
|
19256
19211
|
networkCalls
|
|
19257
19212
|
},
|
|
19258
19213
|
async (module) => {
|
|
19259
|
-
const
|
|
19260
|
-
|
|
19214
|
+
const devExports = module.__devExports?.[sourceConfig.package];
|
|
19215
|
+
const createTrigger = devExports?.examples?.createTrigger;
|
|
19216
|
+
if (!createTrigger) {
|
|
19217
|
+
throw new Error(
|
|
19218
|
+
`Source package "${sourceConfig.package}" has no createTrigger in /dev export`
|
|
19219
|
+
);
|
|
19220
|
+
}
|
|
19221
|
+
const flowConfig = module.wireConfig(module.__configData ?? void 0);
|
|
19222
|
+
applyOverrides(flowConfig, prepared.overrides);
|
|
19261
19223
|
const captured = [];
|
|
19262
|
-
|
|
19263
|
-
...
|
|
19224
|
+
flowConfig.hooks = {
|
|
19225
|
+
...flowConfig.hooks || {},
|
|
19264
19226
|
prePush: ({ fn: fn3 }, event) => {
|
|
19265
19227
|
captured.push({ event, timestamp: Date.now() });
|
|
19266
19228
|
return { ok: true };
|
|
19267
19229
|
}
|
|
19268
19230
|
};
|
|
19269
|
-
const instance = await createTrigger(
|
|
19231
|
+
const instance = await createTrigger(flowConfig, {
|
|
19232
|
+
sourceId: options.sourceId
|
|
19233
|
+
});
|
|
19270
19234
|
const { trigger } = instance;
|
|
19271
19235
|
logger.info("Simulating source");
|
|
19272
19236
|
const inputRecord = input ?? {};
|
|
@@ -19294,7 +19258,7 @@ async function simulateSource(configPath, input, options) {
|
|
|
19294
19258
|
await prepared.cleanup();
|
|
19295
19259
|
}
|
|
19296
19260
|
}
|
|
19297
|
-
async function simulateTransformer(
|
|
19261
|
+
async function simulateTransformer(configOrPath, event, options) {
|
|
19298
19262
|
const startTime = Date.now();
|
|
19299
19263
|
const parsed = i.PartialEventSchema.safeParse(event);
|
|
19300
19264
|
if (!parsed.success) {
|
|
@@ -19304,14 +19268,31 @@ async function simulateTransformer(configPath, event, options) {
|
|
|
19304
19268
|
error: parsed.error.message
|
|
19305
19269
|
};
|
|
19306
19270
|
}
|
|
19307
|
-
|
|
19308
|
-
|
|
19271
|
+
let config2;
|
|
19272
|
+
if (typeof configOrPath === "string") {
|
|
19273
|
+
config2 = await loadJsonConfig(configOrPath);
|
|
19274
|
+
} else {
|
|
19275
|
+
config2 = configOrPath;
|
|
19276
|
+
}
|
|
19277
|
+
const prepareInput = options.bundlePath ? {
|
|
19278
|
+
mode: "prebuilt",
|
|
19279
|
+
bundlePath: options.bundlePath,
|
|
19280
|
+
config: config2,
|
|
19309
19281
|
flow: options.flow,
|
|
19310
19282
|
simulate: ["transformer." + options.transformerId],
|
|
19311
19283
|
mock: options.mock,
|
|
19312
19284
|
silent: options.silent,
|
|
19313
19285
|
verbose: options.verbose
|
|
19314
|
-
}
|
|
19286
|
+
} : {
|
|
19287
|
+
mode: "build",
|
|
19288
|
+
config: config2,
|
|
19289
|
+
flow: options.flow,
|
|
19290
|
+
simulate: ["transformer." + options.transformerId],
|
|
19291
|
+
mock: options.mock,
|
|
19292
|
+
silent: options.silent,
|
|
19293
|
+
verbose: options.verbose
|
|
19294
|
+
};
|
|
19295
|
+
const prepared = await prepareFlow(prepareInput);
|
|
19315
19296
|
try {
|
|
19316
19297
|
const logger = createCLILogger({
|
|
19317
19298
|
silent: options.silent,
|
|
@@ -19334,11 +19315,11 @@ async function simulateTransformer(configPath, event, options) {
|
|
|
19334
19315
|
networkCalls
|
|
19335
19316
|
},
|
|
19336
19317
|
async (module) => {
|
|
19337
|
-
const
|
|
19338
|
-
applyOverrides(
|
|
19339
|
-
if (
|
|
19340
|
-
if (
|
|
19341
|
-
const result = await module.startFlow(
|
|
19318
|
+
const flowConfig = module.wireConfig(module.__configData ?? void 0);
|
|
19319
|
+
applyOverrides(flowConfig, prepared.overrides);
|
|
19320
|
+
if (flowConfig.sources) flowConfig.sources = {};
|
|
19321
|
+
if (flowConfig.destinations) flowConfig.destinations = {};
|
|
19322
|
+
const result = await module.startFlow(flowConfig);
|
|
19342
19323
|
if (!result?.collector)
|
|
19343
19324
|
throw new Error("Invalid bundle: collector not available");
|
|
19344
19325
|
const collector = result.collector;
|
|
@@ -19348,7 +19329,7 @@ async function simulateTransformer(configPath, event, options) {
|
|
|
19348
19329
|
`Transformer "${options.transformerId}" not found in collector. Available: ${Object.keys(collector.transformers || {}).join(", ") || "none"}`
|
|
19349
19330
|
);
|
|
19350
19331
|
}
|
|
19351
|
-
const initialized = await
|
|
19332
|
+
const initialized = await ne3(
|
|
19352
19333
|
collector,
|
|
19353
19334
|
transformer,
|
|
19354
19335
|
options.transformerId
|
|
@@ -19373,7 +19354,7 @@ async function simulateTransformer(configPath, event, options) {
|
|
|
19373
19354
|
processedEvent
|
|
19374
19355
|
);
|
|
19375
19356
|
if (beforeChainIds.length > 0) {
|
|
19376
|
-
const beforeResult = await
|
|
19357
|
+
const beforeResult = await oe2(
|
|
19377
19358
|
collector,
|
|
19378
19359
|
collector.transformers,
|
|
19379
19360
|
beforeChainIds,
|
|
@@ -19394,7 +19375,7 @@ async function simulateTransformer(configPath, event, options) {
|
|
|
19394
19375
|
processedEvent = Array.isArray(beforeResult) ? beforeResult[0] : beforeResult;
|
|
19395
19376
|
}
|
|
19396
19377
|
}
|
|
19397
|
-
const pushResult = await
|
|
19378
|
+
const pushResult = await te3(
|
|
19398
19379
|
collector,
|
|
19399
19380
|
transformer,
|
|
19400
19381
|
options.transformerId,
|
|
@@ -19434,7 +19415,7 @@ async function simulateTransformer(configPath, event, options) {
|
|
|
19434
19415
|
await prepared.cleanup();
|
|
19435
19416
|
}
|
|
19436
19417
|
}
|
|
19437
|
-
async function simulateDestination(
|
|
19418
|
+
async function simulateDestination(configOrPath, event, options) {
|
|
19438
19419
|
const startTime = Date.now();
|
|
19439
19420
|
const parsed = i.PartialEventSchema.safeParse(event);
|
|
19440
19421
|
if (!parsed.success) {
|
|
@@ -19444,14 +19425,31 @@ async function simulateDestination(configPath, event, options) {
|
|
|
19444
19425
|
error: parsed.error.message
|
|
19445
19426
|
};
|
|
19446
19427
|
}
|
|
19447
|
-
|
|
19448
|
-
|
|
19428
|
+
let config2;
|
|
19429
|
+
if (typeof configOrPath === "string") {
|
|
19430
|
+
config2 = await loadJsonConfig(configOrPath);
|
|
19431
|
+
} else {
|
|
19432
|
+
config2 = configOrPath;
|
|
19433
|
+
}
|
|
19434
|
+
const prepareInput = options.bundlePath ? {
|
|
19435
|
+
mode: "prebuilt",
|
|
19436
|
+
bundlePath: options.bundlePath,
|
|
19437
|
+
config: config2,
|
|
19449
19438
|
flow: options.flow,
|
|
19450
19439
|
simulate: ["destination." + options.destinationId],
|
|
19451
19440
|
mock: options.mock,
|
|
19452
19441
|
silent: options.silent,
|
|
19453
19442
|
verbose: options.verbose
|
|
19454
|
-
}
|
|
19443
|
+
} : {
|
|
19444
|
+
mode: "build",
|
|
19445
|
+
config: config2,
|
|
19446
|
+
flow: options.flow,
|
|
19447
|
+
simulate: ["destination." + options.destinationId],
|
|
19448
|
+
mock: options.mock,
|
|
19449
|
+
silent: options.silent,
|
|
19450
|
+
verbose: options.verbose
|
|
19451
|
+
};
|
|
19452
|
+
const prepared = await prepareFlow(prepareInput);
|
|
19455
19453
|
try {
|
|
19456
19454
|
const logger = createCLILogger({
|
|
19457
19455
|
silent: options.silent,
|
|
@@ -19473,25 +19471,32 @@ async function simulateDestination(configPath, event, options) {
|
|
|
19473
19471
|
networkCalls
|
|
19474
19472
|
},
|
|
19475
19473
|
async (module) => {
|
|
19476
|
-
const
|
|
19477
|
-
applyOverrides(
|
|
19478
|
-
const
|
|
19474
|
+
const flowConfig = module.wireConfig(module.__configData ?? void 0);
|
|
19475
|
+
applyOverrides(flowConfig, prepared.overrides);
|
|
19476
|
+
const destPkg = (prepared.flowSettings.destinations ?? {})[options.destinationId];
|
|
19479
19477
|
let trackedCalls = [];
|
|
19480
|
-
if (
|
|
19481
|
-
const
|
|
19482
|
-
const
|
|
19483
|
-
if (
|
|
19484
|
-
const
|
|
19485
|
-
|
|
19486
|
-
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
|
|
19478
|
+
if (destPkg?.package) {
|
|
19479
|
+
const devExports = module.__devExports?.[destPkg.package];
|
|
19480
|
+
const devEnv = devExports?.examples?.env;
|
|
19481
|
+
if (devEnv?.push) {
|
|
19482
|
+
const destinations = flowConfig.destinations;
|
|
19483
|
+
const destConfig = destinations[options.destinationId]?.config;
|
|
19484
|
+
if (destConfig) {
|
|
19485
|
+
destConfig.env = devEnv.push;
|
|
19486
|
+
}
|
|
19487
|
+
if (devEnv.simulation?.length) {
|
|
19488
|
+
const combined = {
|
|
19489
|
+
...devEnv.push,
|
|
19490
|
+
simulation: devEnv.simulation
|
|
19491
|
+
};
|
|
19492
|
+
const { wrappedEnv, calls } = Ne3(combined);
|
|
19493
|
+
if (destConfig) destConfig.env = wrappedEnv;
|
|
19494
|
+
trackedCalls = calls;
|
|
19495
|
+
}
|
|
19491
19496
|
}
|
|
19492
19497
|
}
|
|
19493
|
-
if (
|
|
19494
|
-
const result = await module.startFlow(
|
|
19498
|
+
if (flowConfig.sources) flowConfig.sources = {};
|
|
19499
|
+
const result = await module.startFlow(flowConfig);
|
|
19495
19500
|
if (!result?.collector)
|
|
19496
19501
|
throw new Error("Invalid bundle: collector not available");
|
|
19497
19502
|
const collector = result.collector;
|
|
@@ -19531,17 +19536,17 @@ init_core3();
|
|
|
19531
19536
|
init_tmp();
|
|
19532
19537
|
init_config_file();
|
|
19533
19538
|
init_auth();
|
|
19534
|
-
import
|
|
19539
|
+
import path17 from "path";
|
|
19535
19540
|
import { writeFileSync as writeFileSync5 } from "fs";
|
|
19536
19541
|
import { homedir as homedir2 } from "os";
|
|
19537
19542
|
import { join as join4 } from "path";
|
|
19538
19543
|
|
|
19539
19544
|
// src/runtime/resolve-bundle.ts
|
|
19540
19545
|
init_stdin();
|
|
19541
|
-
import { existsSync as
|
|
19546
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
19542
19547
|
import { dirname as dirname2 } from "path";
|
|
19543
19548
|
function getDefaultWritePath() {
|
|
19544
|
-
if (
|
|
19549
|
+
if (existsSync2("/app/flow")) return "/app/flow/bundle.mjs";
|
|
19545
19550
|
return "/tmp/walkeros-bundle.mjs";
|
|
19546
19551
|
}
|
|
19547
19552
|
function isUrl2(value) {
|
|
@@ -19549,7 +19554,7 @@ function isUrl2(value) {
|
|
|
19549
19554
|
}
|
|
19550
19555
|
function writeBundleToDisk(writePath, content) {
|
|
19551
19556
|
const dir = dirname2(writePath);
|
|
19552
|
-
if (!
|
|
19557
|
+
if (!existsSync2(dir)) {
|
|
19553
19558
|
mkdirSync2(dir, { recursive: true });
|
|
19554
19559
|
}
|
|
19555
19560
|
writeFileSync2(writePath, content, "utf-8");
|
|
@@ -19575,16 +19580,16 @@ async function readBundleFromStdin(writePath) {
|
|
|
19575
19580
|
}
|
|
19576
19581
|
async function resolveBundle(bundleEnv) {
|
|
19577
19582
|
const writePath = getDefaultWritePath();
|
|
19578
|
-
if (!isUrl2(bundleEnv) &&
|
|
19583
|
+
if (!isUrl2(bundleEnv) && existsSync2(bundleEnv)) {
|
|
19579
19584
|
return { path: bundleEnv, source: "file" };
|
|
19580
19585
|
}
|
|
19581
19586
|
if (isUrl2(bundleEnv)) {
|
|
19582
|
-
const
|
|
19583
|
-
return { path:
|
|
19587
|
+
const path18 = await fetchBundle(bundleEnv, writePath);
|
|
19588
|
+
return { path: path18, source: "url" };
|
|
19584
19589
|
}
|
|
19585
19590
|
if (isStdinPiped()) {
|
|
19586
|
-
const
|
|
19587
|
-
return { path:
|
|
19591
|
+
const path18 = await readBundleFromStdin(writePath);
|
|
19592
|
+
return { path: path18, source: "stdin" };
|
|
19588
19593
|
}
|
|
19589
19594
|
return { path: bundleEnv, source: "file" };
|
|
19590
19595
|
}
|
|
@@ -19630,7 +19635,7 @@ init_cache();
|
|
|
19630
19635
|
|
|
19631
19636
|
// src/commands/run/validators.ts
|
|
19632
19637
|
init_asset_resolver();
|
|
19633
|
-
import { existsSync as
|
|
19638
|
+
import { existsSync as existsSync4 } from "fs";
|
|
19634
19639
|
|
|
19635
19640
|
// src/schemas/primitives.ts
|
|
19636
19641
|
init_dev();
|
|
@@ -19724,7 +19729,7 @@ var PushInputSchema = external_exports.object(PushInputShape);
|
|
|
19724
19729
|
// src/commands/run/validators.ts
|
|
19725
19730
|
function validateFlowFile(filePath) {
|
|
19726
19731
|
const absolutePath = resolveAsset(filePath, "bundle");
|
|
19727
|
-
if (!
|
|
19732
|
+
if (!existsSync4(absolutePath)) {
|
|
19728
19733
|
throw new Error(
|
|
19729
19734
|
`Flow file not found: ${filePath}
|
|
19730
19735
|
Resolved path: ${absolutePath}
|
|
@@ -19750,7 +19755,7 @@ init_utils3();
|
|
|
19750
19755
|
// src/commands/run/pipeline.ts
|
|
19751
19756
|
init_tmp();
|
|
19752
19757
|
import { writeFileSync as writeFileSync4 } from "fs";
|
|
19753
|
-
import
|
|
19758
|
+
import fs16 from "fs-extra";
|
|
19754
19759
|
|
|
19755
19760
|
// src/runtime/health-server.ts
|
|
19756
19761
|
import http from "http";
|
|
@@ -20146,7 +20151,7 @@ async function runPipeline(options) {
|
|
|
20146
20151
|
await currentBundleCleanup().catch(() => {
|
|
20147
20152
|
});
|
|
20148
20153
|
if (currentConfigPath)
|
|
20149
|
-
await
|
|
20154
|
+
await fs16.remove(currentConfigPath).catch(() => {
|
|
20150
20155
|
});
|
|
20151
20156
|
currentBundleCleanup = newBundleResult.cleanup;
|
|
20152
20157
|
currentConfigPath = tmpConfigPath;
|
|
@@ -20173,7 +20178,7 @@ async function runPipeline(options) {
|
|
|
20173
20178
|
await healthServer.close();
|
|
20174
20179
|
if (currentBundleCleanup) await currentBundleCleanup().catch(() => {
|
|
20175
20180
|
});
|
|
20176
|
-
if (currentConfigPath) await
|
|
20181
|
+
if (currentConfigPath) await fs16.remove(currentConfigPath).catch(() => {
|
|
20177
20182
|
});
|
|
20178
20183
|
logger.info("Shutdown complete");
|
|
20179
20184
|
clearTimeout(forceTimer);
|
|
@@ -20323,7 +20328,7 @@ async function resolveBundlePath(configInput, apiConfig, logger) {
|
|
|
20323
20328
|
logger.info(`Bundle: ${resolved.path}`);
|
|
20324
20329
|
}
|
|
20325
20330
|
if (isPreBuiltConfig(resolved.path)) {
|
|
20326
|
-
return
|
|
20331
|
+
return path17.resolve(resolved.path);
|
|
20327
20332
|
}
|
|
20328
20333
|
const flowFile = validateFlowFile(resolved.path);
|
|
20329
20334
|
logger.debug("Building flow bundle");
|
|
@@ -20389,7 +20394,7 @@ async function resolveBundlePath(configInput, apiConfig, logger) {
|
|
|
20389
20394
|
}
|
|
20390
20395
|
const defaultFile = "server-collect.mjs";
|
|
20391
20396
|
logger.debug(`No config specified, using default: ${defaultFile}`);
|
|
20392
|
-
return
|
|
20397
|
+
return path17.resolve(defaultFile);
|
|
20393
20398
|
}
|
|
20394
20399
|
|
|
20395
20400
|
// src/commands/validate/index.ts
|
|
@@ -20623,18 +20628,29 @@ function validateFlow(input, options = {}) {
|
|
|
20623
20628
|
}
|
|
20624
20629
|
}
|
|
20625
20630
|
}
|
|
20626
|
-
|
|
20627
|
-
if (
|
|
20628
|
-
for (const [
|
|
20629
|
-
|
|
20630
|
-
|
|
20631
|
-
|
|
20632
|
-
|
|
20633
|
-
|
|
20634
|
-
|
|
20631
|
+
let totalPackageCount = 0;
|
|
20632
|
+
if (flows && typeof flows === "object") {
|
|
20633
|
+
for (const [flowName, flowValue] of Object.entries(
|
|
20634
|
+
flows
|
|
20635
|
+
)) {
|
|
20636
|
+
const flow = flowValue;
|
|
20637
|
+
const packages = flow.bundle?.packages;
|
|
20638
|
+
if (packages && typeof packages === "object") {
|
|
20639
|
+
for (const [pkgName, pkgConfig] of Object.entries(packages)) {
|
|
20640
|
+
if (!pkgConfig.version && !pkgConfig.path) {
|
|
20641
|
+
warnings.push({
|
|
20642
|
+
path: `flows.${flowName}.bundle.packages.${pkgName}`,
|
|
20643
|
+
message: `Package "${pkgName}" has no version specified`,
|
|
20644
|
+
suggestion: "Consider specifying a version for reproducible builds"
|
|
20645
|
+
});
|
|
20646
|
+
}
|
|
20647
|
+
}
|
|
20648
|
+
totalPackageCount += Object.keys(packages).length;
|
|
20635
20649
|
}
|
|
20636
20650
|
}
|
|
20637
|
-
|
|
20651
|
+
}
|
|
20652
|
+
if (totalPackageCount > 0) {
|
|
20653
|
+
details.packageCount = totalPackageCount;
|
|
20638
20654
|
}
|
|
20639
20655
|
if (coreResult.context) {
|
|
20640
20656
|
details.context = coreResult.context;
|
|
@@ -20749,10 +20765,10 @@ function buildConnectionGraph(config2) {
|
|
|
20749
20765
|
function checkCompatibility(conn, errors, warnings) {
|
|
20750
20766
|
const fromOuts = Object.entries(conn.from.examples).filter(([, ex]) => ex.out !== void 0 && ex.out !== false).map(([name, ex]) => ({ name, value: ex.out }));
|
|
20751
20767
|
const toIns = Object.entries(conn.to.examples).filter(([, ex]) => ex.in !== void 0).map(([name, ex]) => ({ name, value: ex.in }));
|
|
20752
|
-
const
|
|
20768
|
+
const path18 = `${conn.from.type}.${conn.from.name} \u2192 ${conn.to.type}.${conn.to.name}`;
|
|
20753
20769
|
if (fromOuts.length === 0 || toIns.length === 0) {
|
|
20754
20770
|
warnings.push({
|
|
20755
|
-
path:
|
|
20771
|
+
path: path18,
|
|
20756
20772
|
message: "Cannot check compatibility: missing out or in examples",
|
|
20757
20773
|
suggestion: "Add out examples to the source step or in examples to the target step"
|
|
20758
20774
|
});
|
|
@@ -20770,7 +20786,7 @@ function checkCompatibility(conn, errors, warnings) {
|
|
|
20770
20786
|
}
|
|
20771
20787
|
if (!hasMatch) {
|
|
20772
20788
|
errors.push({
|
|
20773
|
-
path:
|
|
20789
|
+
path: path18,
|
|
20774
20790
|
message: "No compatible out/in pair found between connected steps",
|
|
20775
20791
|
code: "INCOMPATIBLE_EXAMPLES"
|
|
20776
20792
|
});
|
|
@@ -20866,13 +20882,13 @@ function validateMapping(input) {
|
|
|
20866
20882
|
init_dist();
|
|
20867
20883
|
import Ajv from "ajv";
|
|
20868
20884
|
var SECTIONS = ["destinations", "sources", "transformers"];
|
|
20869
|
-
function resolveEntry(
|
|
20885
|
+
function resolveEntry(path18, flowConfig) {
|
|
20870
20886
|
const flows = flowConfig.flows;
|
|
20871
20887
|
if (!flows || typeof flows !== "object") return "No flows found in config";
|
|
20872
20888
|
const flowName = Object.keys(flows)[0];
|
|
20873
20889
|
const flow = flows[flowName];
|
|
20874
20890
|
if (!flow) return `Flow "${flowName}" is empty`;
|
|
20875
|
-
const parts =
|
|
20891
|
+
const parts = path18.split(".");
|
|
20876
20892
|
if (parts.length === 2) {
|
|
20877
20893
|
const [section, key] = parts;
|
|
20878
20894
|
if (!SECTIONS.includes(section)) {
|
|
@@ -20909,15 +20925,15 @@ function resolveEntry(path19, flowConfig) {
|
|
|
20909
20925
|
}
|
|
20910
20926
|
return { section: matches[0].section, key, entry: matches[0].entry };
|
|
20911
20927
|
}
|
|
20912
|
-
return `Invalid path "${
|
|
20928
|
+
return `Invalid path "${path18}". Use "section.key" or just "key"`;
|
|
20913
20929
|
}
|
|
20914
|
-
async function validateEntry(
|
|
20915
|
-
const resolved = resolveEntry(
|
|
20930
|
+
async function validateEntry(path18, flowConfig) {
|
|
20931
|
+
const resolved = resolveEntry(path18, flowConfig);
|
|
20916
20932
|
if (typeof resolved === "string") {
|
|
20917
20933
|
return {
|
|
20918
20934
|
valid: false,
|
|
20919
20935
|
type: "entry",
|
|
20920
|
-
errors: [{ path:
|
|
20936
|
+
errors: [{ path: path18, message: resolved, code: "ENTRY_VALIDATION" }],
|
|
20921
20937
|
warnings: [],
|
|
20922
20938
|
details: {}
|
|
20923
20939
|
};
|
|
@@ -20940,7 +20956,7 @@ async function validateEntry(path19, flowConfig) {
|
|
|
20940
20956
|
}
|
|
20941
20957
|
let schemas;
|
|
20942
20958
|
try {
|
|
20943
|
-
const info = await
|
|
20959
|
+
const info = await rn(packageName);
|
|
20944
20960
|
schemas = info.schemas;
|
|
20945
20961
|
} catch (error48) {
|
|
20946
20962
|
return {
|
|
@@ -20948,7 +20964,7 @@ async function validateEntry(path19, flowConfig) {
|
|
|
20948
20964
|
type: "entry",
|
|
20949
20965
|
errors: [
|
|
20950
20966
|
{
|
|
20951
|
-
path:
|
|
20967
|
+
path: path18,
|
|
20952
20968
|
message: error48 instanceof Error ? error48.message : "Unknown error",
|
|
20953
20969
|
code: "ENTRY_VALIDATION"
|
|
20954
20970
|
}
|
|
@@ -21111,21 +21127,21 @@ async function validateCommand(options) {
|
|
|
21111
21127
|
// src/commands/cache.ts
|
|
21112
21128
|
init_tmp();
|
|
21113
21129
|
init_cli_logger();
|
|
21114
|
-
import
|
|
21130
|
+
import fs17 from "fs-extra";
|
|
21115
21131
|
function registerCacheCommand(program2) {
|
|
21116
21132
|
const cache = program2.command("cache").description("Manage the CLI cache");
|
|
21117
21133
|
cache.command("clear").description("Clear all cached packages and builds").option("--packages", "Clear only package cache").option("--builds", "Clear only build cache").option("--tmp-dir <dir>", "Custom temp directory").option("--silent", "Suppress output").action(async (options) => {
|
|
21118
21134
|
const logger = createCLILogger({ silent: options.silent });
|
|
21119
21135
|
const tmpDir = options.tmpDir;
|
|
21120
21136
|
if (options.packages) {
|
|
21121
|
-
await
|
|
21137
|
+
await fs17.remove(getTmpPath(tmpDir, "cache", "packages"));
|
|
21122
21138
|
logger.info("Package cache cleared");
|
|
21123
21139
|
} else if (options.builds) {
|
|
21124
|
-
await
|
|
21140
|
+
await fs17.remove(getTmpPath(tmpDir, "cache", "builds"));
|
|
21125
21141
|
logger.info("Build cache cleared");
|
|
21126
21142
|
} else {
|
|
21127
21143
|
const cacheDir = getTmpPath(tmpDir, "cache");
|
|
21128
|
-
await
|
|
21144
|
+
await fs17.remove(cacheDir);
|
|
21129
21145
|
logger.info(`Cache cleared: ${cacheDir}`);
|
|
21130
21146
|
}
|
|
21131
21147
|
});
|
|
@@ -21142,8 +21158,8 @@ function registerCacheCommand(program2) {
|
|
|
21142
21158
|
});
|
|
21143
21159
|
}
|
|
21144
21160
|
async function countEntries(dir) {
|
|
21145
|
-
if (!await
|
|
21146
|
-
const entries = await
|
|
21161
|
+
if (!await fs17.pathExists(dir)) return 0;
|
|
21162
|
+
const entries = await fs17.readdir(dir);
|
|
21147
21163
|
return entries.length;
|
|
21148
21164
|
}
|
|
21149
21165
|
|
|
@@ -21875,7 +21891,7 @@ async function createDeployCommand(config2, options) {
|
|
|
21875
21891
|
const result2 = await loadFlowConfig(config2, {
|
|
21876
21892
|
flowName: options.flow
|
|
21877
21893
|
});
|
|
21878
|
-
type =
|
|
21894
|
+
type = J(result2.flowSettings);
|
|
21879
21895
|
}
|
|
21880
21896
|
const deployment = await createDeployment({
|
|
21881
21897
|
type,
|