@walkeros/cli 3.4.0 → 3.4.1
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 +19 -0
- package/dist/cli.js +458 -231
- package/dist/index.d.ts +26 -1
- package/dist/index.js +106 -6
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -30,6 +30,67 @@ var init_client_context = __esm({
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
+
// src/core/api-error.ts
|
|
34
|
+
function throwApiError(error48, fallbackMessage) {
|
|
35
|
+
if (error48 && typeof error48 === "object" && "error" in error48 && typeof error48.error === "object") {
|
|
36
|
+
const inner = error48.error;
|
|
37
|
+
const message = inner.message || fallbackMessage;
|
|
38
|
+
const code = inner.code;
|
|
39
|
+
const details = inner.details?.errors;
|
|
40
|
+
const options = { code, details };
|
|
41
|
+
if (code === "CLIENT_OUTDATED") {
|
|
42
|
+
options.minVersion = inner.minVersion;
|
|
43
|
+
options.clientVersion = inner.clientVersion;
|
|
44
|
+
options.client = inner.client;
|
|
45
|
+
options.upgrade = inner.upgrade;
|
|
46
|
+
options.docs = inner.docs;
|
|
47
|
+
}
|
|
48
|
+
throw new ApiError(message, options);
|
|
49
|
+
}
|
|
50
|
+
throw new ApiError(fallbackMessage);
|
|
51
|
+
}
|
|
52
|
+
function handleCliError(err) {
|
|
53
|
+
if (err instanceof ApiError && err.code === "CLIENT_OUTDATED") {
|
|
54
|
+
console.error(`
|
|
55
|
+
${err.message}
|
|
56
|
+
`);
|
|
57
|
+
if (err.upgrade) console.error(` Upgrade: ${err.upgrade}`);
|
|
58
|
+
if (err.docs) console.error(` Docs: ${err.docs}
|
|
59
|
+
`);
|
|
60
|
+
process.exit(2);
|
|
61
|
+
}
|
|
62
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
63
|
+
console.error(message);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
var ApiError;
|
|
67
|
+
var init_api_error = __esm({
|
|
68
|
+
"src/core/api-error.ts"() {
|
|
69
|
+
"use strict";
|
|
70
|
+
ApiError = class extends Error {
|
|
71
|
+
code;
|
|
72
|
+
details;
|
|
73
|
+
// Populated only for CLIENT_OUTDATED responses (HTTP 426).
|
|
74
|
+
minVersion;
|
|
75
|
+
clientVersion;
|
|
76
|
+
client;
|
|
77
|
+
upgrade;
|
|
78
|
+
docs;
|
|
79
|
+
constructor(message, options) {
|
|
80
|
+
super(message);
|
|
81
|
+
this.name = "ApiError";
|
|
82
|
+
this.code = options?.code;
|
|
83
|
+
this.details = options?.details;
|
|
84
|
+
this.minVersion = options?.minVersion;
|
|
85
|
+
this.clientVersion = options?.clientVersion;
|
|
86
|
+
this.client = options?.client;
|
|
87
|
+
this.upgrade = options?.upgrade;
|
|
88
|
+
this.docs = options?.docs;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
33
94
|
// ../core/dist/index.mjs
|
|
34
95
|
function x(e3) {
|
|
35
96
|
return { _meta: { hops: 0, path: [e3] } };
|
|
@@ -283,11 +344,24 @@ function Se(e3, t, n3) {
|
|
|
283
344
|
}
|
|
284
345
|
};
|
|
285
346
|
}
|
|
286
|
-
function De(e3, t, n3) {
|
|
287
|
-
return function(...
|
|
288
|
-
let
|
|
289
|
-
const
|
|
290
|
-
|
|
347
|
+
function De(e3, t, n3, o2) {
|
|
348
|
+
return function(...r2) {
|
|
349
|
+
let i2;
|
|
350
|
+
const s2 = "pre" + t, a2 = "post" + t, c3 = n3[s2], u4 = n3[a2], f2 = (e4, t2) => {
|
|
351
|
+
o2 ? o2.warn(e4, { error: t2 }) : console.warn(e4, t2);
|
|
352
|
+
};
|
|
353
|
+
if (c3) try {
|
|
354
|
+
i2 = c3({ fn: e3 }, ...r2);
|
|
355
|
+
} catch (t2) {
|
|
356
|
+
f2(`Hook ${String(s2)} failed, falling back to original function`, t2), i2 = e3(...r2);
|
|
357
|
+
}
|
|
358
|
+
else i2 = e3(...r2);
|
|
359
|
+
if (u4) try {
|
|
360
|
+
i2 = u4({ fn: e3, result: i2 }, ...r2);
|
|
361
|
+
} catch (e4) {
|
|
362
|
+
f2(`Hook ${String(a2)} failed, keeping original result`, e4);
|
|
363
|
+
}
|
|
364
|
+
return i2;
|
|
291
365
|
};
|
|
292
366
|
}
|
|
293
367
|
function Xe(e3) {
|
|
@@ -15560,7 +15634,7 @@ function nt(e3, n3, i2) {
|
|
|
15560
15634
|
function it2(e3) {
|
|
15561
15635
|
return external_exports.toJSONSchema(e3, { target: "draft-7" });
|
|
15562
15636
|
}
|
|
15563
|
-
var e2, n, i, r, a, s, c2, l, d, p, u2, m, b, f, g, h, v, S2, y, w, k, C2, x2, j, E2, R2, P2, J,
|
|
15637
|
+
var e2, n, i, r, a, s, c2, l, d, p, u2, m, b, f, g, h, v, S2, y, w, k, C2, x2, j, E2, R2, P2, J, I2, O, D2, z3, q2, U2, W, B2, A2, $, V, H2, F2, G, _2, K, Q2, X, Y, Z, ee, ne2, ie, te, oe, re, ae, se, ce, le, de, pe, ue, me, be2, fe, ge, he2, ve2, Se2, ye, we2, ke, Ce, xe, je2, Ee, Re, Pe, Je, Ie, Oe, De2, Ne, Me, Te, Le, ze, qe, Ue, We, Be, Ae, $e, Ve, He, Fe, Ge, _e, Ke, Qe2, Xe2, Ye2, Ze, en, nn, tn, on, rn, an, sn, cn, ln, dn, pn, un, mn, bn, fn, gn, hn, vn, Sn, yn, wn, kn, Cn, xn, jn, En, Rn, Pn, Jn, In, On, Dn, Nn, Mn, Tn, Ln, zn, qn, Un, Wn, Bn, An, $n, Vn, Hn, Fn, Gn, _n, Kn, Qn, Xn, Yn, Zn, ei, ni, ii, ti, oi, ri, ai, si, ci, li, di, pi, ui, mi, bi, fi, gi, hi, vi, Si, yi, wi, ki, Ci, xi, ji, Ii, Oi, Di, Ni, Mi, Ti, Li, zi, Ui, Wi, Bi, Ai, ot;
|
|
15564
15638
|
var init_dev = __esm({
|
|
15565
15639
|
"../core/dist/dev.mjs"() {
|
|
15566
15640
|
"use strict";
|
|
@@ -15571,7 +15645,7 @@ var init_dev = __esm({
|
|
|
15571
15645
|
for (var t in i2) e2(n3, t, { get: i2[t], enumerable: true });
|
|
15572
15646
|
};
|
|
15573
15647
|
i = {};
|
|
15574
|
-
n(i, { BaseContextConfig: () => q2, BatchConfig: () => U2, CacheRuleSchema: () => $e, CacheSchema: () => Ve, CacheSchemas: () => Ae, ClickIdEntrySchema: () => Ai, CodeSchema: () => Ui, CollectorSchemas: () => hn, ConsentSchema: () => Q2, ContractActionsSchema: () => yi, ContractSchema: () => Ci, ContractSchemaEntry: () => Si, Counter: () => d, DeepPartialEventSchema: () => oe, DestinationReferenceSchema: () => hi, DestinationSchemas: () => Me, DestinationsMapConfig: () => A2, EntitiesSchema: () => ne2, EntitySchema: () => ee, EventSchema: () => ie, FlowConfigSchema: () => ji, FlowSchemas: () => ii, FlowSettingsSchema: () => xi, GenericEnvConfig: () => D2, GenericSettingsConfig: () =>
|
|
15648
|
+
n(i, { BaseContextConfig: () => q2, BatchConfig: () => U2, CacheRuleSchema: () => $e, CacheSchema: () => Ve, CacheSchemas: () => Ae, ClickIdEntrySchema: () => Ai, CodeSchema: () => Ui, CollectorSchemas: () => hn, ConsentSchema: () => Q2, ContractActionsSchema: () => yi, ContractSchema: () => Ci, ContractSchemaEntry: () => Si, Counter: () => d, DeepPartialEventSchema: () => oe, DestinationReferenceSchema: () => hi, DestinationSchemas: () => Me, DestinationsMapConfig: () => A2, EntitiesSchema: () => ne2, EntitySchema: () => ee, EventSchema: () => ie, FlowConfigSchema: () => ji, FlowSchemas: () => ii, FlowSettingsSchema: () => xi, GenericEnvConfig: () => D2, GenericSettingsConfig: () => O, HandlersConfig: () => j, HintSchema: () => Wi, HintsSchema: () => Bi, IdConfig: () => P2, Identifier: () => c2, InitConfig: () => J, LoopSchema: () => ge, MapSchema: () => ve2, MappingResultSchema: () => xe, MappingSchemas: () => me, MatchExpressionSchema: () => qe, MatcherSchemas: () => Te, NextRuleSchema: () => Be, OptionalPrimitiveValue: () => m, OrderedPropertiesSchema: () => _2, PartialEventSchema: () => te, PolicySchema: () => ye, PrimaryConfig: () => I2, PrimitiveSchema: () => ti, PrimitiveValue: () => u2, ProcessingControlConfig: () => W, PropertiesSchema: () => G, PropertySchema: () => F2, PropertyTypeSchema: () => H2, QueueConfig: () => R2, RequiredBoolean: () => s, RequiredNumber: () => a, RequiredString: () => r, RoutableNextSchema: () => We, RuleSchema: () => we2, RulesSchema: () => ke, RuntimeInstanceConfig: () => z3, SetSchema: () => he2, SourceReferenceSchema: () => fi, SourceSchema: () => Z, SourceSchemas: () => Dn, SourceTypeSchema: () => K, SourcesMapConfig: () => B2, StoreReferenceSchema: () => vi, StoreSchemas: () => Xn, TaggingVersion: () => p, Timestamp: () => l, TransformerReferenceSchema: () => gi, TransformerSchemas: () => Fn, UserSchema: () => X, UtilitySchemas: () => b, ValueConfigSchema: () => Se2, ValueSchema: () => be2, ValuesSchema: () => fe, VerboseConfig: () => E2, VersionSchema: () => Y, WalkerOSSchemas: () => $, configJsonSchema: () => Ii, consentJsonSchema: () => ue, contractEntryJsonSchema: () => Li, contractJsonSchema: () => zi, createArraySchema: () => Zi, createConsentConfig: () => L, createDataTransformationConfig: () => N2, createEnumSchema: () => et2, createMappingRulesConfig: () => M2, createObjectSchema: () => Xi, createPolicyConfig: () => T2, createTupleSchema: () => nt, destinationReferenceJsonSchema: () => Ni, entityJsonSchema: () => de, eventJsonSchema: () => re, loopJsonSchema: () => Re, mapJsonSchema: () => Je, orderedPropertiesJsonSchema: () => le, parseConfig: () => Ei, parseSettings: () => Pi, partialEventJsonSchema: () => ae, policyJsonSchema: () => Ie, propertiesJsonSchema: () => ce, ruleJsonSchema: () => Oe, rulesJsonSchema: () => De2, safeParseConfig: () => Ri, safeParseSettings: () => Ji, setJsonSchema: () => Pe, settingsJsonSchema: () => Oi, sourceReferenceJsonSchema: () => Di, sourceTypeJsonSchema: () => pe, storeReferenceJsonSchema: () => Ti, transformerReferenceJsonSchema: () => Mi, userJsonSchema: () => se, validateFlowConfig: () => $i, valueConfigJsonSchema: () => Ee, valueJsonSchema: () => je2, z: () => external_exports, zodToSchema: () => it2 });
|
|
15575
15649
|
r = external_exports.string();
|
|
15576
15650
|
a = external_exports.number();
|
|
15577
15651
|
s = external_exports.boolean();
|
|
@@ -15598,8 +15672,8 @@ var init_dev = __esm({
|
|
|
15598
15672
|
R2 = external_exports.object({ queue: external_exports.boolean().describe("Whether to queue events when consent is not granted").optional() }).partial();
|
|
15599
15673
|
P2 = external_exports.object({}).partial();
|
|
15600
15674
|
J = 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();
|
|
15601
|
-
|
|
15602
|
-
|
|
15675
|
+
I2 = external_exports.object({ primary: external_exports.boolean().describe("Mark as primary (only one can be primary)").optional() }).partial();
|
|
15676
|
+
O = external_exports.object({ settings: external_exports.any().optional().describe("Implementation-specific configuration") }).partial();
|
|
15603
15677
|
D2 = external_exports.object({ env: external_exports.any().optional().describe("Environment dependencies (platform-specific)") }).partial();
|
|
15604
15678
|
z3 = external_exports.object({ type: external_exports.string().optional().describe("Instance type identifier"), config: external_exports.unknown().describe("Instance configuration") }).partial();
|
|
15605
15679
|
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();
|
|
@@ -15632,7 +15706,7 @@ var init_dev = __esm({
|
|
|
15632
15706
|
pe = o(K);
|
|
15633
15707
|
ue = o(Q2);
|
|
15634
15708
|
me = {};
|
|
15635
|
-
n(me, { ConfigSchema: () => Ce, LoopSchema: () => ge, MapSchema: () => ve2, PolicySchema: () => ye, ResultSchema: () => xe, RuleSchema: () => we2, RulesSchema: () => ke, SetSchema: () => he2, ValueConfigSchema: () => Se2, ValueSchema: () => be2, ValuesSchema: () => fe, configJsonSchema: () => Ne, loopJsonSchema: () => Re, mapJsonSchema: () => Je, policyJsonSchema: () =>
|
|
15709
|
+
n(me, { ConfigSchema: () => Ce, LoopSchema: () => ge, MapSchema: () => ve2, PolicySchema: () => ye, ResultSchema: () => xe, RuleSchema: () => we2, RulesSchema: () => ke, SetSchema: () => he2, ValueConfigSchema: () => Se2, ValueSchema: () => be2, ValuesSchema: () => fe, configJsonSchema: () => Ne, loopJsonSchema: () => Re, mapJsonSchema: () => Je, policyJsonSchema: () => Ie, ruleJsonSchema: () => Oe, rulesJsonSchema: () => De2, setJsonSchema: () => Pe, valueConfigJsonSchema: () => Ee, valueJsonSchema: () => je2 });
|
|
15636
15710
|
be2 = 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(be2).describe("Array of values")])).meta({ id: "MappingValue", title: "Mapping.Value", description: "Polymorphic transform primitive used in every mapping field. A string path, constant, operator object (map/loop/set/condition/consent), or array of values." });
|
|
15637
15711
|
fe = external_exports.array(be2).describe("Array of transformation values");
|
|
15638
15712
|
ge = external_exports.lazy(() => external_exports.tuple([be2, be2]).describe("Loop transformation: [source, transform] tuple for array processing"));
|
|
@@ -15649,8 +15723,8 @@ var init_dev = __esm({
|
|
|
15649
15723
|
Re = o(ge);
|
|
15650
15724
|
Pe = o(he2);
|
|
15651
15725
|
Je = o(ve2);
|
|
15652
|
-
|
|
15653
|
-
|
|
15726
|
+
Ie = o(ye);
|
|
15727
|
+
Oe = o(we2);
|
|
15654
15728
|
De2 = o(ke);
|
|
15655
15729
|
Ne = o(Ce);
|
|
15656
15730
|
Me = {};
|
|
@@ -15693,7 +15767,7 @@ var init_dev = __esm({
|
|
|
15693
15767
|
fn = o(nn);
|
|
15694
15768
|
gn = o(cn);
|
|
15695
15769
|
hn = {};
|
|
15696
|
-
n(hn, { CommandTypeSchema: () => vn, ConfigSchema: () => Sn, DestinationsSchema: () => xn, InitConfigSchema: () => wn, InstanceSchema: () => jn, PushContextSchema: () => kn, SessionDataSchema: () => yn, SourcesSchema: () => Cn, commandTypeJsonSchema: () => En, configJsonSchema: () => Rn, initConfigJsonSchema: () => Jn, instanceJsonSchema: () =>
|
|
15770
|
+
n(hn, { CommandTypeSchema: () => vn, ConfigSchema: () => Sn, DestinationsSchema: () => xn, InitConfigSchema: () => wn, InstanceSchema: () => jn, PushContextSchema: () => kn, SessionDataSchema: () => yn, SourcesSchema: () => Cn, commandTypeJsonSchema: () => En, configJsonSchema: () => Rn, initConfigJsonSchema: () => Jn, instanceJsonSchema: () => On, pushContextJsonSchema: () => In, sessionDataJsonSchema: () => Pn });
|
|
15697
15771
|
vn = 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");
|
|
15698
15772
|
Sn = 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"), 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)") }).describe("Core collector configuration");
|
|
15699
15773
|
yn = 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: c2.describe("Session identifier").optional(), start: l.describe("Session start timestamp").optional(), marketing: external_exports.literal(true).optional().describe("Marketing attribution flag"), updated: l.describe("Last update timestamp").optional(), isNew: external_exports.boolean().describe("Whether this is a new session").optional(), device: c2.describe("Device identifier").optional(), count: d.describe("Event count in session").optional(), runs: d.describe("Number of runs").optional() })).describe("Session state and tracking data");
|
|
@@ -15706,8 +15780,8 @@ var init_dev = __esm({
|
|
|
15706
15780
|
Rn = o(Sn);
|
|
15707
15781
|
Pn = o(yn);
|
|
15708
15782
|
Jn = o(wn);
|
|
15709
|
-
|
|
15710
|
-
|
|
15783
|
+
In = o(kn);
|
|
15784
|
+
On = o(jn);
|
|
15711
15785
|
Dn = {};
|
|
15712
15786
|
n(Dn, { BaseEnvSchema: () => Nn, ConfigSchema: () => Mn, InitSchema: () => zn, InitSourceSchema: () => qn, InitSourcesSchema: () => Un, InstanceSchema: () => Ln, PartialConfigSchema: () => Tn, baseEnvJsonSchema: () => Wn, configJsonSchema: () => Bn, initSourceJsonSchema: () => Vn, initSourcesJsonSchema: () => Hn, instanceJsonSchema: () => $n, partialConfigJsonSchema: () => An });
|
|
15713
15787
|
Nn = 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");
|
|
@@ -15736,7 +15810,7 @@ var init_dev = __esm({
|
|
|
15736
15810
|
ei = o(Yn);
|
|
15737
15811
|
ni = o(Zn);
|
|
15738
15812
|
ii = {};
|
|
15739
|
-
n(ii, { BundleSchema: () => li, ConfigSchema: () => ji, ContractActionsSchema: () => yi, ContractEntrySchema: () => ki, ContractEventsSchema: () => wi, ContractSchema: () => Ci, ContractSchemaEntry: () => Si, DefinitionsSchema: () => ri, DestinationReferenceSchema: () => hi, InlineCodeSchema: () => ui, OverridesSchema: () => ci, PackagesSchema: () => si, PrimitiveSchema: () => ti, ServerSchema: () => pi, SettingsSchema: () => xi, SourceReferenceSchema: () => fi, StepExampleSchema: () => mi, StepExamplesSchema: () => bi, StoreReferenceSchema: () => vi, TransformerReferenceSchema: () => gi, VariablesSchema: () => oi, WebSchema: () => di, configJsonSchema: () =>
|
|
15813
|
+
n(ii, { BundleSchema: () => li, ConfigSchema: () => ji, ContractActionsSchema: () => yi, ContractEntrySchema: () => ki, ContractEventsSchema: () => wi, ContractSchema: () => Ci, ContractSchemaEntry: () => Si, DefinitionsSchema: () => ri, DestinationReferenceSchema: () => hi, InlineCodeSchema: () => ui, OverridesSchema: () => ci, PackagesSchema: () => si, PrimitiveSchema: () => ti, ServerSchema: () => pi, SettingsSchema: () => xi, SourceReferenceSchema: () => fi, StepExampleSchema: () => mi, StepExamplesSchema: () => bi, StoreReferenceSchema: () => vi, TransformerReferenceSchema: () => gi, VariablesSchema: () => oi, WebSchema: () => di, configJsonSchema: () => Ii, contractEntryJsonSchema: () => Li, contractJsonSchema: () => zi, destinationReferenceJsonSchema: () => Ni, parseConfig: () => Ei, parseSettings: () => Pi, safeParseConfig: () => Ri, safeParseSettings: () => Ji, settingsJsonSchema: () => Oi, sourceReferenceJsonSchema: () => Di, storeReferenceJsonSchema: () => Ti, transformerReferenceJsonSchema: () => Mi });
|
|
15740
15814
|
ti = external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]).describe("Primitive value: string, number, or boolean");
|
|
15741
15815
|
oi = external_exports.record(external_exports.string(), ti).describe("Variables for interpolation");
|
|
15742
15816
|
ri = external_exports.record(external_exports.string(), external_exports.unknown()).describe("Reusable configuration definitions");
|
|
@@ -15747,7 +15821,7 @@ var init_dev = __esm({
|
|
|
15747
15821
|
di = 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");
|
|
15748
15822
|
pi = external_exports.object({}).passthrough().describe("Server platform configuration (reserved for future options)");
|
|
15749
15823
|
ui = 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");
|
|
15750
|
-
mi = 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");
|
|
15824
|
+
mi = external_exports.object({ title: external_exports.string().optional().describe("Human-readable title (overrides default heading)"), description: external_exports.string().optional().describe("Human-readable description"), public: external_exports.boolean().optional().describe("Whether this example is shown in docs/UI/MCP default output (default: true). Set false for test-only fixtures."), 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");
|
|
15751
15825
|
bi = external_exports.record(external_exports.string(), mi).describe("Named step examples for testing and documentation");
|
|
15752
15826
|
fi = 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(), ui]).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: oi.optional().describe("Source-level variables (highest priority in cascade)"), definitions: ri.optional().describe("Source-level definitions (highest priority in cascade)"), next: We.optional().describe("Pre-collector transformer chain. String, string[], or NextRule[] for conditional routing based on ingest data."), before: We.optional().describe("Pre-source transformer chain (consent-exempt). Handles transport-level preprocessing."), examples: bi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ve.optional().describe("Cache configuration for this source (match \u2192 key \u2192 ttl rules)") }).describe("Source package reference with configuration");
|
|
15753
15827
|
gi = 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(), ui]).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: We.optional().describe("Pre-transformer chain. Runs before this transformer push function."), next: We.optional().describe("Next transformer in chain. String, string[], or NextRule[] for conditional routing."), variables: oi.optional().describe("Transformer-level variables (highest priority in cascade)"), definitions: ri.optional().describe("Transformer-level definitions (highest priority in cascade)"), examples: bi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ve.optional().describe("Cache configuration for this transformer (match \u2192 key \u2192 ttl rules)") }).describe("Transformer package reference with configuration");
|
|
@@ -15763,8 +15837,8 @@ var init_dev = __esm({
|
|
|
15763
15837
|
return (n3 || i2) && !(n3 && i2);
|
|
15764
15838
|
}, { message: 'Exactly one of "web" or "server" must be present' }).describe("Single flow settings for one deployment target");
|
|
15765
15839
|
ji = 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: oi.optional().describe("Shared variables for interpolation across all flows (use $var.name syntax)"), definitions: ri.optional().describe("Reusable configuration definitions (use $def.name syntax)"), flows: external_exports.record(external_exports.string(), xi).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: Ci.optional().describe("Named contracts with extends inheritance and dot-path references") }).describe("walkerOS flow configuration (walkeros.config.json)");
|
|
15766
|
-
|
|
15767
|
-
|
|
15840
|
+
Ii = external_exports.toJSONSchema(ji, { target: "draft-7" });
|
|
15841
|
+
Oi = o(xi);
|
|
15768
15842
|
Di = o(fi);
|
|
15769
15843
|
Ni = o(hi);
|
|
15770
15844
|
Mi = o(gi);
|
|
@@ -18227,6 +18301,293 @@ var init_utils3 = __esm({
|
|
|
18227
18301
|
}
|
|
18228
18302
|
});
|
|
18229
18303
|
|
|
18304
|
+
// src/commands/flows/index.ts
|
|
18305
|
+
async function listFlows(options = {}) {
|
|
18306
|
+
const id = options.projectId ?? requireProjectId();
|
|
18307
|
+
const client = createApiClient();
|
|
18308
|
+
const { data, error: error48 } = await client.GET("/api/projects/{projectId}/flows", {
|
|
18309
|
+
params: {
|
|
18310
|
+
path: { projectId: id },
|
|
18311
|
+
query: {
|
|
18312
|
+
sort: options.sort,
|
|
18313
|
+
order: options.order,
|
|
18314
|
+
include_deleted: options.includeDeleted ? "true" : void 0
|
|
18315
|
+
}
|
|
18316
|
+
}
|
|
18317
|
+
});
|
|
18318
|
+
if (error48) throwApiError(error48, "Failed to list flows");
|
|
18319
|
+
return data;
|
|
18320
|
+
}
|
|
18321
|
+
async function getFlow(options) {
|
|
18322
|
+
const id = options.projectId ?? requireProjectId();
|
|
18323
|
+
const client = createApiClient();
|
|
18324
|
+
const { data, error: error48 } = await client.GET(
|
|
18325
|
+
"/api/projects/{projectId}/flows/{flowId}",
|
|
18326
|
+
{
|
|
18327
|
+
params: {
|
|
18328
|
+
path: { projectId: id, flowId: options.flowId },
|
|
18329
|
+
query: options.fields ? { fields: options.fields.join(",") } : {}
|
|
18330
|
+
}
|
|
18331
|
+
}
|
|
18332
|
+
);
|
|
18333
|
+
if (error48) throwApiError(error48, "Failed to get flow");
|
|
18334
|
+
return data;
|
|
18335
|
+
}
|
|
18336
|
+
async function createFlow(options) {
|
|
18337
|
+
const id = options.projectId ?? requireProjectId();
|
|
18338
|
+
const client = createApiClient();
|
|
18339
|
+
const { data, error: error48 } = await client.POST("/api/projects/{projectId}/flows", {
|
|
18340
|
+
params: { path: { projectId: id } },
|
|
18341
|
+
// Config is user-provided JSON; server validates the full schema
|
|
18342
|
+
body: { name: options.name, config: options.content }
|
|
18343
|
+
});
|
|
18344
|
+
if (error48) throwApiError(error48, "Failed to create flow");
|
|
18345
|
+
return data;
|
|
18346
|
+
}
|
|
18347
|
+
async function updateFlow(options) {
|
|
18348
|
+
const id = options.projectId ?? requireProjectId();
|
|
18349
|
+
const client = createApiClient();
|
|
18350
|
+
const body = {};
|
|
18351
|
+
if (options.name !== void 0) body.name = options.name;
|
|
18352
|
+
if (options.content !== void 0) body.config = options.content;
|
|
18353
|
+
const { data, error: error48 } = await client.PATCH(
|
|
18354
|
+
"/api/projects/{projectId}/flows/{flowId}",
|
|
18355
|
+
{
|
|
18356
|
+
params: { path: { projectId: id, flowId: options.flowId } },
|
|
18357
|
+
// Dynamically constructed body; server validates the full schema
|
|
18358
|
+
body,
|
|
18359
|
+
...options.mergePatch && {
|
|
18360
|
+
headers: { "Content-Type": "application/merge-patch+json" }
|
|
18361
|
+
}
|
|
18362
|
+
}
|
|
18363
|
+
);
|
|
18364
|
+
if (error48) throwApiError(error48, "Failed to update flow");
|
|
18365
|
+
return data;
|
|
18366
|
+
}
|
|
18367
|
+
async function deleteFlow(options) {
|
|
18368
|
+
const id = options.projectId ?? requireProjectId();
|
|
18369
|
+
const client = createApiClient();
|
|
18370
|
+
const { data, error: error48 } = await client.DELETE(
|
|
18371
|
+
"/api/projects/{projectId}/flows/{flowId}",
|
|
18372
|
+
{
|
|
18373
|
+
params: { path: { projectId: id, flowId: options.flowId } }
|
|
18374
|
+
}
|
|
18375
|
+
);
|
|
18376
|
+
if (error48) throwApiError(error48, "Failed to delete flow");
|
|
18377
|
+
return data ?? { success: true };
|
|
18378
|
+
}
|
|
18379
|
+
async function duplicateFlow(options) {
|
|
18380
|
+
const id = options.projectId ?? requireProjectId();
|
|
18381
|
+
const client = createApiClient();
|
|
18382
|
+
const { data, error: error48 } = await client.POST(
|
|
18383
|
+
"/api/projects/{projectId}/flows/{flowId}/duplicate",
|
|
18384
|
+
{
|
|
18385
|
+
params: { path: { projectId: id, flowId: options.flowId } },
|
|
18386
|
+
body: { name: options.name }
|
|
18387
|
+
}
|
|
18388
|
+
);
|
|
18389
|
+
if (error48) throwApiError(error48, "Failed to duplicate flow");
|
|
18390
|
+
return data;
|
|
18391
|
+
}
|
|
18392
|
+
async function handleResult2(fn2, options) {
|
|
18393
|
+
try {
|
|
18394
|
+
const result = await fn2();
|
|
18395
|
+
await writeResult(JSON.stringify(result, null, 2), options);
|
|
18396
|
+
} catch (error48) {
|
|
18397
|
+
handleCliError(error48);
|
|
18398
|
+
}
|
|
18399
|
+
}
|
|
18400
|
+
async function listFlowsCommand(options) {
|
|
18401
|
+
await handleResult2(
|
|
18402
|
+
() => listFlows({
|
|
18403
|
+
projectId: options.project,
|
|
18404
|
+
sort: options.sort,
|
|
18405
|
+
order: options.order,
|
|
18406
|
+
includeDeleted: options.includeDeleted
|
|
18407
|
+
}),
|
|
18408
|
+
options
|
|
18409
|
+
);
|
|
18410
|
+
}
|
|
18411
|
+
async function getFlowCommand(flowId, options) {
|
|
18412
|
+
await handleResult2(
|
|
18413
|
+
() => getFlow({ flowId, projectId: options.project }),
|
|
18414
|
+
options
|
|
18415
|
+
);
|
|
18416
|
+
}
|
|
18417
|
+
async function createFlowCommand(name, options) {
|
|
18418
|
+
const content = options.content ? JSON.parse(options.content) : JSON.parse(await readFlowStdin());
|
|
18419
|
+
await handleResult2(
|
|
18420
|
+
() => createFlow({ name, content, projectId: options.project }),
|
|
18421
|
+
options
|
|
18422
|
+
);
|
|
18423
|
+
}
|
|
18424
|
+
async function updateFlowCommand(flowId, options) {
|
|
18425
|
+
const content = options.content ? JSON.parse(options.content) : void 0;
|
|
18426
|
+
await handleResult2(
|
|
18427
|
+
() => updateFlow({
|
|
18428
|
+
flowId,
|
|
18429
|
+
name: options.name,
|
|
18430
|
+
content,
|
|
18431
|
+
projectId: options.project
|
|
18432
|
+
}),
|
|
18433
|
+
options
|
|
18434
|
+
);
|
|
18435
|
+
}
|
|
18436
|
+
async function deleteFlowCommand(flowId, options) {
|
|
18437
|
+
await handleResult2(
|
|
18438
|
+
() => deleteFlow({ flowId, projectId: options.project }),
|
|
18439
|
+
options
|
|
18440
|
+
);
|
|
18441
|
+
}
|
|
18442
|
+
async function duplicateFlowCommand(flowId, options) {
|
|
18443
|
+
await handleResult2(
|
|
18444
|
+
() => duplicateFlow({ flowId, name: options.name, projectId: options.project }),
|
|
18445
|
+
options
|
|
18446
|
+
);
|
|
18447
|
+
}
|
|
18448
|
+
async function readFlowStdin() {
|
|
18449
|
+
if (!isStdinPiped()) {
|
|
18450
|
+
throw new Error("Content required: use --content or pipe via stdin");
|
|
18451
|
+
}
|
|
18452
|
+
return readStdin();
|
|
18453
|
+
}
|
|
18454
|
+
var init_flows = __esm({
|
|
18455
|
+
"src/commands/flows/index.ts"() {
|
|
18456
|
+
"use strict";
|
|
18457
|
+
init_api_client();
|
|
18458
|
+
init_api_error();
|
|
18459
|
+
init_auth();
|
|
18460
|
+
init_output();
|
|
18461
|
+
init_stdin();
|
|
18462
|
+
}
|
|
18463
|
+
});
|
|
18464
|
+
|
|
18465
|
+
// src/commands/previews/index.ts
|
|
18466
|
+
var previews_exports = {};
|
|
18467
|
+
__export(previews_exports, {
|
|
18468
|
+
createPreview: () => createPreview,
|
|
18469
|
+
deletePreview: () => deletePreview,
|
|
18470
|
+
getPreview: () => getPreview,
|
|
18471
|
+
listPreviews: () => listPreviews
|
|
18472
|
+
});
|
|
18473
|
+
async function listPreviews(options) {
|
|
18474
|
+
const pid = options.projectId ?? requireProjectId();
|
|
18475
|
+
const response = await apiFetch(
|
|
18476
|
+
`/api/projects/${pid}/flows/${options.flowId}/previews`
|
|
18477
|
+
);
|
|
18478
|
+
if (!response.ok) {
|
|
18479
|
+
const body = await response.json().catch(() => ({}));
|
|
18480
|
+
throwApiError(body, "Failed to list previews");
|
|
18481
|
+
}
|
|
18482
|
+
return response.json();
|
|
18483
|
+
}
|
|
18484
|
+
async function getPreview(options) {
|
|
18485
|
+
const pid = options.projectId ?? requireProjectId();
|
|
18486
|
+
const response = await apiFetch(
|
|
18487
|
+
`/api/projects/${pid}/flows/${options.flowId}/previews/${options.previewId}`
|
|
18488
|
+
);
|
|
18489
|
+
if (!response.ok) {
|
|
18490
|
+
const body = await response.json().catch(() => ({}));
|
|
18491
|
+
throwApiError(body, "Failed to get preview");
|
|
18492
|
+
}
|
|
18493
|
+
return response.json();
|
|
18494
|
+
}
|
|
18495
|
+
async function createPreview(options) {
|
|
18496
|
+
const pid = options.projectId ?? requireProjectId();
|
|
18497
|
+
let settingsId = options.flowSettingsId;
|
|
18498
|
+
if (!settingsId) {
|
|
18499
|
+
if (!options.flowName) {
|
|
18500
|
+
throw new Error("Either flowName or flowSettingsId is required");
|
|
18501
|
+
}
|
|
18502
|
+
const flow = await getFlow({ projectId: pid, flowId: options.flowId });
|
|
18503
|
+
const settings = flow.settings;
|
|
18504
|
+
const match = settings?.find((s2) => s2.name === options.flowName);
|
|
18505
|
+
if (!match) {
|
|
18506
|
+
throw new Error(
|
|
18507
|
+
`Flow settings named "${options.flowName}" not found on flow ${options.flowId}`
|
|
18508
|
+
);
|
|
18509
|
+
}
|
|
18510
|
+
settingsId = match.id;
|
|
18511
|
+
}
|
|
18512
|
+
const response = await apiFetch(
|
|
18513
|
+
`/api/projects/${pid}/flows/${options.flowId}/previews`,
|
|
18514
|
+
{
|
|
18515
|
+
method: "POST",
|
|
18516
|
+
headers: { "Content-Type": "application/json" },
|
|
18517
|
+
body: JSON.stringify({ flowSettingsId: settingsId })
|
|
18518
|
+
}
|
|
18519
|
+
);
|
|
18520
|
+
if (!response.ok) {
|
|
18521
|
+
const body = await response.json().catch(() => ({}));
|
|
18522
|
+
throwApiError(body, "Failed to create preview");
|
|
18523
|
+
}
|
|
18524
|
+
return response.json();
|
|
18525
|
+
}
|
|
18526
|
+
async function deletePreview(options) {
|
|
18527
|
+
const pid = options.projectId ?? requireProjectId();
|
|
18528
|
+
const response = await apiFetch(
|
|
18529
|
+
`/api/projects/${pid}/flows/${options.flowId}/previews/${options.previewId}`,
|
|
18530
|
+
{ method: "DELETE" }
|
|
18531
|
+
);
|
|
18532
|
+
if (!response.ok) {
|
|
18533
|
+
const body = await response.json().catch(() => ({}));
|
|
18534
|
+
throwApiError(body, "Failed to delete preview");
|
|
18535
|
+
}
|
|
18536
|
+
if (response.status === 204) return null;
|
|
18537
|
+
return response.json().catch(() => null);
|
|
18538
|
+
}
|
|
18539
|
+
var init_previews = __esm({
|
|
18540
|
+
"src/commands/previews/index.ts"() {
|
|
18541
|
+
"use strict";
|
|
18542
|
+
init_auth();
|
|
18543
|
+
init_http();
|
|
18544
|
+
init_api_error();
|
|
18545
|
+
init_flows();
|
|
18546
|
+
}
|
|
18547
|
+
});
|
|
18548
|
+
|
|
18549
|
+
// src/commands/previews/output.ts
|
|
18550
|
+
var output_exports = {};
|
|
18551
|
+
__export(output_exports, {
|
|
18552
|
+
formatPreviewCreated: () => formatPreviewCreated,
|
|
18553
|
+
printPreviewCreated: () => printPreviewCreated
|
|
18554
|
+
});
|
|
18555
|
+
function formatPreviewCreated(preview, options) {
|
|
18556
|
+
let stdoutLast;
|
|
18557
|
+
let deactivationUrl = null;
|
|
18558
|
+
if (options.url) {
|
|
18559
|
+
const u4 = new URL(options.url);
|
|
18560
|
+
u4.searchParams.set("elbPreview", preview.token);
|
|
18561
|
+
stdoutLast = u4.toString();
|
|
18562
|
+
const off = new URL(options.url);
|
|
18563
|
+
off.searchParams.set("elbPreview", "off");
|
|
18564
|
+
deactivationUrl = off.toString();
|
|
18565
|
+
} else {
|
|
18566
|
+
stdoutLast = preview.activationUrl;
|
|
18567
|
+
}
|
|
18568
|
+
const lines = [
|
|
18569
|
+
`Preview created (${preview.id})`,
|
|
18570
|
+
` Token: ${preview.token}`,
|
|
18571
|
+
` Created by: ${preview.createdBy}`,
|
|
18572
|
+
` Bundle URL: ${preview.bundleUrl}`,
|
|
18573
|
+
"",
|
|
18574
|
+
options.url ? ` Activate: ${stdoutLast}` : ` Activate: Append ${stdoutLast} to any URL on your site`,
|
|
18575
|
+
deactivationUrl ? ` Deactivate: ${deactivationUrl}` : ` Deactivate: Append ?elbPreview=off to any URL on your site`,
|
|
18576
|
+
""
|
|
18577
|
+
];
|
|
18578
|
+
return { stdoutLast, stderr: lines.join("\n") };
|
|
18579
|
+
}
|
|
18580
|
+
function printPreviewCreated(preview, options) {
|
|
18581
|
+
const { stdoutLast, stderr } = formatPreviewCreated(preview, options);
|
|
18582
|
+
process.stderr.write(stderr + "\n");
|
|
18583
|
+
process.stdout.write(stdoutLast + "\n");
|
|
18584
|
+
}
|
|
18585
|
+
var init_output2 = __esm({
|
|
18586
|
+
"src/commands/previews/output.ts"() {
|
|
18587
|
+
"use strict";
|
|
18588
|
+
}
|
|
18589
|
+
});
|
|
18590
|
+
|
|
18230
18591
|
// src/cli.ts
|
|
18231
18592
|
import { Command } from "commander";
|
|
18232
18593
|
|
|
@@ -18255,61 +18616,7 @@ var VERSION = JSON.parse(findPackageJson()).version;
|
|
|
18255
18616
|
|
|
18256
18617
|
// src/cli.ts
|
|
18257
18618
|
init_client_context();
|
|
18258
|
-
|
|
18259
|
-
// src/core/api-error.ts
|
|
18260
|
-
var ApiError = class extends Error {
|
|
18261
|
-
code;
|
|
18262
|
-
details;
|
|
18263
|
-
// Populated only for CLIENT_OUTDATED responses (HTTP 426).
|
|
18264
|
-
minVersion;
|
|
18265
|
-
clientVersion;
|
|
18266
|
-
client;
|
|
18267
|
-
upgrade;
|
|
18268
|
-
docs;
|
|
18269
|
-
constructor(message, options) {
|
|
18270
|
-
super(message);
|
|
18271
|
-
this.name = "ApiError";
|
|
18272
|
-
this.code = options?.code;
|
|
18273
|
-
this.details = options?.details;
|
|
18274
|
-
this.minVersion = options?.minVersion;
|
|
18275
|
-
this.clientVersion = options?.clientVersion;
|
|
18276
|
-
this.client = options?.client;
|
|
18277
|
-
this.upgrade = options?.upgrade;
|
|
18278
|
-
this.docs = options?.docs;
|
|
18279
|
-
}
|
|
18280
|
-
};
|
|
18281
|
-
function throwApiError(error48, fallbackMessage) {
|
|
18282
|
-
if (error48 && typeof error48 === "object" && "error" in error48 && typeof error48.error === "object") {
|
|
18283
|
-
const inner = error48.error;
|
|
18284
|
-
const message = inner.message || fallbackMessage;
|
|
18285
|
-
const code = inner.code;
|
|
18286
|
-
const details = inner.details?.errors;
|
|
18287
|
-
const options = { code, details };
|
|
18288
|
-
if (code === "CLIENT_OUTDATED") {
|
|
18289
|
-
options.minVersion = inner.minVersion;
|
|
18290
|
-
options.clientVersion = inner.clientVersion;
|
|
18291
|
-
options.client = inner.client;
|
|
18292
|
-
options.upgrade = inner.upgrade;
|
|
18293
|
-
options.docs = inner.docs;
|
|
18294
|
-
}
|
|
18295
|
-
throw new ApiError(message, options);
|
|
18296
|
-
}
|
|
18297
|
-
throw new ApiError(fallbackMessage);
|
|
18298
|
-
}
|
|
18299
|
-
function handleCliError(err) {
|
|
18300
|
-
if (err instanceof ApiError && err.code === "CLIENT_OUTDATED") {
|
|
18301
|
-
console.error(`
|
|
18302
|
-
${err.message}
|
|
18303
|
-
`);
|
|
18304
|
-
if (err.upgrade) console.error(` Upgrade: ${err.upgrade}`);
|
|
18305
|
-
if (err.docs) console.error(` Docs: ${err.docs}
|
|
18306
|
-
`);
|
|
18307
|
-
process.exit(2);
|
|
18308
|
-
}
|
|
18309
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
18310
|
-
console.error(message);
|
|
18311
|
-
process.exit(1);
|
|
18312
|
-
}
|
|
18619
|
+
init_api_error();
|
|
18313
18620
|
|
|
18314
18621
|
// src/core/banner.ts
|
|
18315
18622
|
import chalk from "chalk";
|
|
@@ -18374,7 +18681,7 @@ async function ne3(e3, n3, t) {
|
|
|
18374
18681
|
if (n3.init && !n3.config.init) {
|
|
18375
18682
|
const o2 = n3.type || "unknown", s2 = e3.logger.scope(`transformer:${o2}`), r2 = { collector: e3, logger: s2, id: t, ingest: x(t), config: n3.config, env: se2(n3.config.env) };
|
|
18376
18683
|
s2.debug("init");
|
|
18377
|
-
const i2 = await De(n3.init, "TransformerInit", e3.hooks)(r2);
|
|
18684
|
+
const i2 = await De(n3.init, "TransformerInit", e3.hooks, e3.logger)(r2);
|
|
18378
18685
|
if (false === i2) return false;
|
|
18379
18686
|
n3.config = { ...i2 || n3.config, env: i2?.env || n3.config.env, init: true }, s2.debug("init done");
|
|
18380
18687
|
}
|
|
@@ -18383,7 +18690,7 @@ async function ne3(e3, n3, t) {
|
|
|
18383
18690
|
async function te3(e3, n3, t, o2, s2, r2) {
|
|
18384
18691
|
const i2 = n3.type || "unknown", a2 = e3.logger.scope(`transformer:${i2}`), c3 = { collector: e3, logger: a2, id: t, ingest: s2, config: n3.config, env: { ...se2(n3.config.env), ...r2 ? { respond: r2 } : {} } };
|
|
18385
18692
|
a2.debug("push", { event: o2.name });
|
|
18386
|
-
const u4 = await De(n3.push, "TransformerPush", e3.hooks)(o2, c3);
|
|
18693
|
+
const u4 = await De(n3.push, "TransformerPush", e3.hooks, e3.logger)(o2, c3);
|
|
18387
18694
|
return a2.debug("push done"), u4;
|
|
18388
18695
|
}
|
|
18389
18696
|
async function oe2(e3, n3, t, o2, s2, r2, i2) {
|
|
@@ -21411,6 +21718,7 @@ async function logoutCommand(options) {
|
|
|
21411
21718
|
|
|
21412
21719
|
// src/commands/auth/index.ts
|
|
21413
21720
|
init_api_client();
|
|
21721
|
+
init_api_error();
|
|
21414
21722
|
init_cli_logger();
|
|
21415
21723
|
init_output();
|
|
21416
21724
|
async function whoami() {
|
|
@@ -21438,6 +21746,7 @@ async function whoamiCommand(options) {
|
|
|
21438
21746
|
|
|
21439
21747
|
// src/commands/projects/index.ts
|
|
21440
21748
|
init_api_client();
|
|
21749
|
+
init_api_error();
|
|
21441
21750
|
init_auth();
|
|
21442
21751
|
init_output();
|
|
21443
21752
|
async function listProjects() {
|
|
@@ -21525,168 +21834,18 @@ async function deleteProjectCommand(projectId, options) {
|
|
|
21525
21834
|
);
|
|
21526
21835
|
}
|
|
21527
21836
|
|
|
21528
|
-
// src/
|
|
21529
|
-
|
|
21530
|
-
init_auth();
|
|
21531
|
-
init_output();
|
|
21532
|
-
init_stdin();
|
|
21533
|
-
async function listFlows(options = {}) {
|
|
21534
|
-
const id = options.projectId ?? requireProjectId();
|
|
21535
|
-
const client = createApiClient();
|
|
21536
|
-
const { data, error: error48 } = await client.GET("/api/projects/{projectId}/flows", {
|
|
21537
|
-
params: {
|
|
21538
|
-
path: { projectId: id },
|
|
21539
|
-
query: {
|
|
21540
|
-
sort: options.sort,
|
|
21541
|
-
order: options.order,
|
|
21542
|
-
include_deleted: options.includeDeleted ? "true" : void 0
|
|
21543
|
-
}
|
|
21544
|
-
}
|
|
21545
|
-
});
|
|
21546
|
-
if (error48) throwApiError(error48, "Failed to list flows");
|
|
21547
|
-
return data;
|
|
21548
|
-
}
|
|
21549
|
-
async function getFlow(options) {
|
|
21550
|
-
const id = options.projectId ?? requireProjectId();
|
|
21551
|
-
const client = createApiClient();
|
|
21552
|
-
const { data, error: error48 } = await client.GET(
|
|
21553
|
-
"/api/projects/{projectId}/flows/{flowId}",
|
|
21554
|
-
{
|
|
21555
|
-
params: {
|
|
21556
|
-
path: { projectId: id, flowId: options.flowId },
|
|
21557
|
-
query: options.fields ? { fields: options.fields.join(",") } : {}
|
|
21558
|
-
}
|
|
21559
|
-
}
|
|
21560
|
-
);
|
|
21561
|
-
if (error48) throwApiError(error48, "Failed to get flow");
|
|
21562
|
-
return data;
|
|
21563
|
-
}
|
|
21564
|
-
async function createFlow(options) {
|
|
21565
|
-
const id = options.projectId ?? requireProjectId();
|
|
21566
|
-
const client = createApiClient();
|
|
21567
|
-
const { data, error: error48 } = await client.POST("/api/projects/{projectId}/flows", {
|
|
21568
|
-
params: { path: { projectId: id } },
|
|
21569
|
-
// Config is user-provided JSON; server validates the full schema
|
|
21570
|
-
body: { name: options.name, config: options.content }
|
|
21571
|
-
});
|
|
21572
|
-
if (error48) throwApiError(error48, "Failed to create flow");
|
|
21573
|
-
return data;
|
|
21574
|
-
}
|
|
21575
|
-
async function updateFlow(options) {
|
|
21576
|
-
const id = options.projectId ?? requireProjectId();
|
|
21577
|
-
const client = createApiClient();
|
|
21578
|
-
const body = {};
|
|
21579
|
-
if (options.name !== void 0) body.name = options.name;
|
|
21580
|
-
if (options.content !== void 0) body.config = options.content;
|
|
21581
|
-
const { data, error: error48 } = await client.PATCH(
|
|
21582
|
-
"/api/projects/{projectId}/flows/{flowId}",
|
|
21583
|
-
{
|
|
21584
|
-
params: { path: { projectId: id, flowId: options.flowId } },
|
|
21585
|
-
// Dynamically constructed body; server validates the full schema
|
|
21586
|
-
body,
|
|
21587
|
-
...options.mergePatch && {
|
|
21588
|
-
headers: { "Content-Type": "application/merge-patch+json" }
|
|
21589
|
-
}
|
|
21590
|
-
}
|
|
21591
|
-
);
|
|
21592
|
-
if (error48) throwApiError(error48, "Failed to update flow");
|
|
21593
|
-
return data;
|
|
21594
|
-
}
|
|
21595
|
-
async function deleteFlow(options) {
|
|
21596
|
-
const id = options.projectId ?? requireProjectId();
|
|
21597
|
-
const client = createApiClient();
|
|
21598
|
-
const { data, error: error48 } = await client.DELETE(
|
|
21599
|
-
"/api/projects/{projectId}/flows/{flowId}",
|
|
21600
|
-
{
|
|
21601
|
-
params: { path: { projectId: id, flowId: options.flowId } }
|
|
21602
|
-
}
|
|
21603
|
-
);
|
|
21604
|
-
if (error48) throwApiError(error48, "Failed to delete flow");
|
|
21605
|
-
return data ?? { success: true };
|
|
21606
|
-
}
|
|
21607
|
-
async function duplicateFlow(options) {
|
|
21608
|
-
const id = options.projectId ?? requireProjectId();
|
|
21609
|
-
const client = createApiClient();
|
|
21610
|
-
const { data, error: error48 } = await client.POST(
|
|
21611
|
-
"/api/projects/{projectId}/flows/{flowId}/duplicate",
|
|
21612
|
-
{
|
|
21613
|
-
params: { path: { projectId: id, flowId: options.flowId } },
|
|
21614
|
-
body: { name: options.name }
|
|
21615
|
-
}
|
|
21616
|
-
);
|
|
21617
|
-
if (error48) throwApiError(error48, "Failed to duplicate flow");
|
|
21618
|
-
return data;
|
|
21619
|
-
}
|
|
21620
|
-
async function handleResult2(fn2, options) {
|
|
21621
|
-
try {
|
|
21622
|
-
const result = await fn2();
|
|
21623
|
-
await writeResult(JSON.stringify(result, null, 2), options);
|
|
21624
|
-
} catch (error48) {
|
|
21625
|
-
handleCliError(error48);
|
|
21626
|
-
}
|
|
21627
|
-
}
|
|
21628
|
-
async function listFlowsCommand(options) {
|
|
21629
|
-
await handleResult2(
|
|
21630
|
-
() => listFlows({
|
|
21631
|
-
projectId: options.project,
|
|
21632
|
-
sort: options.sort,
|
|
21633
|
-
order: options.order,
|
|
21634
|
-
includeDeleted: options.includeDeleted
|
|
21635
|
-
}),
|
|
21636
|
-
options
|
|
21637
|
-
);
|
|
21638
|
-
}
|
|
21639
|
-
async function getFlowCommand(flowId, options) {
|
|
21640
|
-
await handleResult2(
|
|
21641
|
-
() => getFlow({ flowId, projectId: options.project }),
|
|
21642
|
-
options
|
|
21643
|
-
);
|
|
21644
|
-
}
|
|
21645
|
-
async function createFlowCommand(name, options) {
|
|
21646
|
-
const content = options.content ? JSON.parse(options.content) : JSON.parse(await readFlowStdin());
|
|
21647
|
-
await handleResult2(
|
|
21648
|
-
() => createFlow({ name, content, projectId: options.project }),
|
|
21649
|
-
options
|
|
21650
|
-
);
|
|
21651
|
-
}
|
|
21652
|
-
async function updateFlowCommand(flowId, options) {
|
|
21653
|
-
const content = options.content ? JSON.parse(options.content) : void 0;
|
|
21654
|
-
await handleResult2(
|
|
21655
|
-
() => updateFlow({
|
|
21656
|
-
flowId,
|
|
21657
|
-
name: options.name,
|
|
21658
|
-
content,
|
|
21659
|
-
projectId: options.project
|
|
21660
|
-
}),
|
|
21661
|
-
options
|
|
21662
|
-
);
|
|
21663
|
-
}
|
|
21664
|
-
async function deleteFlowCommand(flowId, options) {
|
|
21665
|
-
await handleResult2(
|
|
21666
|
-
() => deleteFlow({ flowId, projectId: options.project }),
|
|
21667
|
-
options
|
|
21668
|
-
);
|
|
21669
|
-
}
|
|
21670
|
-
async function duplicateFlowCommand(flowId, options) {
|
|
21671
|
-
await handleResult2(
|
|
21672
|
-
() => duplicateFlow({ flowId, name: options.name, projectId: options.project }),
|
|
21673
|
-
options
|
|
21674
|
-
);
|
|
21675
|
-
}
|
|
21676
|
-
async function readFlowStdin() {
|
|
21677
|
-
if (!isStdinPiped()) {
|
|
21678
|
-
throw new Error("Content required: use --content or pipe via stdin");
|
|
21679
|
-
}
|
|
21680
|
-
return readStdin();
|
|
21681
|
-
}
|
|
21837
|
+
// src/cli.ts
|
|
21838
|
+
init_flows();
|
|
21682
21839
|
|
|
21683
21840
|
// src/commands/deploy/index.ts
|
|
21684
21841
|
init_api_client();
|
|
21685
21842
|
init_auth();
|
|
21686
21843
|
init_http();
|
|
21844
|
+
init_api_error();
|
|
21687
21845
|
init_sse();
|
|
21688
21846
|
init_cli_logger();
|
|
21689
21847
|
init_output();
|
|
21848
|
+
init_flows();
|
|
21690
21849
|
async function resolveSettingsId(options) {
|
|
21691
21850
|
const flow = await getFlow({
|
|
21692
21851
|
flowId: options.flowId,
|
|
@@ -21873,6 +22032,7 @@ async function deployCommand(flowId, options) {
|
|
|
21873
22032
|
init_dist();
|
|
21874
22033
|
init_auth();
|
|
21875
22034
|
init_http();
|
|
22035
|
+
init_api_error();
|
|
21876
22036
|
init_cli_logger();
|
|
21877
22037
|
init_output();
|
|
21878
22038
|
init_loader();
|
|
@@ -22032,8 +22192,9 @@ async function createDeployCommand(config2, options) {
|
|
|
22032
22192
|
// src/commands/feedback/index.ts
|
|
22033
22193
|
init_config_file();
|
|
22034
22194
|
init_http();
|
|
22035
|
-
|
|
22195
|
+
init_api_error();
|
|
22036
22196
|
init_cli_logger();
|
|
22197
|
+
import { createInterface } from "readline";
|
|
22037
22198
|
async function feedback(text, options) {
|
|
22038
22199
|
const config2 = readConfig();
|
|
22039
22200
|
const anonymous = options?.anonymous ?? config2?.anonymousFeedback ?? true;
|
|
@@ -22103,6 +22264,7 @@ function promptUser(question) {
|
|
|
22103
22264
|
}
|
|
22104
22265
|
|
|
22105
22266
|
// src/cli.ts
|
|
22267
|
+
init_output();
|
|
22106
22268
|
setClientContext({ type: "cli", version: VERSION });
|
|
22107
22269
|
process.on("uncaughtException", handleCliError);
|
|
22108
22270
|
process.on("unhandledRejection", handleCliError);
|
|
@@ -22264,6 +22426,71 @@ deployCmd.command("status <id-or-slug>").description("Get deployment details by
|
|
|
22264
22426
|
deployCmd.command("delete <id-or-slug>").description("Delete a deployment").option("--project <id>", "project ID").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (idOrSlug, options) => {
|
|
22265
22427
|
await deleteDeploymentCommand(idOrSlug, options);
|
|
22266
22428
|
});
|
|
22429
|
+
var previewsCmd = program.command("previews").description("Manage preview bundles for testing flow changes on live sites");
|
|
22430
|
+
previewsCmd.command("list <flowId>").description("List previews for a flow").option("--project <projectId>", "Project ID (overrides default)").action(async (flowId, options) => {
|
|
22431
|
+
try {
|
|
22432
|
+
const { listPreviews: listPreviews2 } = await Promise.resolve().then(() => (init_previews(), previews_exports));
|
|
22433
|
+
const result = await listPreviews2({
|
|
22434
|
+
projectId: options.project,
|
|
22435
|
+
flowId
|
|
22436
|
+
});
|
|
22437
|
+
await writeResult(JSON.stringify(result.previews, null, 2), {});
|
|
22438
|
+
} catch (err) {
|
|
22439
|
+
handleCliError(err);
|
|
22440
|
+
}
|
|
22441
|
+
});
|
|
22442
|
+
previewsCmd.command("get <flowId> <previewId>").description("Get preview details").option("--project <projectId>", "Project ID (overrides default)").action(async (flowId, previewId, options) => {
|
|
22443
|
+
try {
|
|
22444
|
+
const { getPreview: getPreview2 } = await Promise.resolve().then(() => (init_previews(), previews_exports));
|
|
22445
|
+
const result = await getPreview2({
|
|
22446
|
+
projectId: options.project,
|
|
22447
|
+
flowId,
|
|
22448
|
+
previewId
|
|
22449
|
+
});
|
|
22450
|
+
await writeResult(JSON.stringify(result, null, 2), {});
|
|
22451
|
+
} catch (err) {
|
|
22452
|
+
handleCliError(err);
|
|
22453
|
+
}
|
|
22454
|
+
});
|
|
22455
|
+
previewsCmd.command("create <flowId>").description("Create a preview bundle for a flow settings entry").option("-f, --flow <name>", "Flow settings name (resolved to ID)").option("-s, --settings-id <id>", "Flow settings ID (alternative to --flow)").option("-u, --url <url>", "Site URL to construct activation URL").option("--project <projectId>", "Project ID (overrides default)").action(async (flowId, options) => {
|
|
22456
|
+
try {
|
|
22457
|
+
if (options.url) {
|
|
22458
|
+
try {
|
|
22459
|
+
new URL(options.url);
|
|
22460
|
+
} catch {
|
|
22461
|
+
throw new Error(`Invalid --url value: ${options.url}`);
|
|
22462
|
+
}
|
|
22463
|
+
}
|
|
22464
|
+
const { createPreview: createPreview2 } = await Promise.resolve().then(() => (init_previews(), previews_exports));
|
|
22465
|
+
const { printPreviewCreated: printPreviewCreated2 } = await Promise.resolve().then(() => (init_output2(), output_exports));
|
|
22466
|
+
const preview = await createPreview2({
|
|
22467
|
+
projectId: options.project,
|
|
22468
|
+
flowId,
|
|
22469
|
+
flowName: options.flow,
|
|
22470
|
+
flowSettingsId: options.settingsId
|
|
22471
|
+
});
|
|
22472
|
+
printPreviewCreated2(preview, { url: options.url });
|
|
22473
|
+
} catch (err) {
|
|
22474
|
+
handleCliError(err);
|
|
22475
|
+
}
|
|
22476
|
+
});
|
|
22477
|
+
previewsCmd.command("delete <flowId> <previewId>").description("Delete a preview").option("-y, --yes", "Skip confirmation prompt").option("--project <projectId>", "Project ID (overrides default)").action(async (flowId, previewId, options) => {
|
|
22478
|
+
try {
|
|
22479
|
+
if (!options.yes) {
|
|
22480
|
+
throw new Error("Confirmation required. Use --yes to skip.");
|
|
22481
|
+
}
|
|
22482
|
+
const { deletePreview: deletePreview2 } = await Promise.resolve().then(() => (init_previews(), previews_exports));
|
|
22483
|
+
await deletePreview2({
|
|
22484
|
+
projectId: options.project,
|
|
22485
|
+
flowId,
|
|
22486
|
+
previewId
|
|
22487
|
+
});
|
|
22488
|
+
process.stderr.write(`Deleted ${previewId}
|
|
22489
|
+
`);
|
|
22490
|
+
} catch (err) {
|
|
22491
|
+
handleCliError(err);
|
|
22492
|
+
}
|
|
22493
|
+
});
|
|
22267
22494
|
program.command("run [file]").description("Run a walkerOS flow").option("-f, --flow <name>", "flow name for multi-flow configs").option("--flow-id <id>", "API flow ID (enables heartbeat, polling, secrets)").option("--project <id>", "project ID (defaults to WALKEROS_PROJECT_ID)").option("-p, --port <number>", "port to listen on (default: 8080)", parseInt).option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (file2, options) => {
|
|
22268
22495
|
await runCommand({
|
|
22269
22496
|
config: file2 || process.env.BUNDLE,
|