@walkeros/cli 3.1.0 → 3.1.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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @walkeros/cli
2
2
 
3
+ ## 3.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - a5d98d2: Fix inline JSON config support in detectInput for MCP tools
8
+ (flow_simulate, flow_push)
9
+ - @walkeros/core@3.1.1
10
+ - @walkeros/server-core@3.1.1
11
+
3
12
  ## 3.1.0
4
13
 
5
14
  ### Minor Changes
package/dist/cli.js CHANGED
@@ -15468,6 +15468,10 @@ async function loadContent(inputPath) {
15468
15468
  }
15469
15469
  return response.text();
15470
15470
  }
15471
+ const trimmed = inputPath.trim();
15472
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
15473
+ return trimmed;
15474
+ }
15471
15475
  return fs4.readFile(inputPath, "utf8");
15472
15476
  }
15473
15477
  var init_input_detector = __esm({
@@ -18348,7 +18352,7 @@ function rn3(n4, e4) {
18348
18352
  }, () => J3({ ok: false }))(), "Push", n4.hooks);
18349
18353
  }
18350
18354
  async function un3(n4) {
18351
- const e4 = U({ globalsStatic: {}, sessionStatic: {}, tagging: 0, run: true }, n4, { merge: false, extend: false }), t2 = { level: n4.logger?.level, handler: n4.logger?.handler }, o2 = ge(t2), s3 = { ...e4.globalsStatic, ...n4.globals }, a2 = { allowed: false, config: e4, consent: n4.consent || {}, count: 0, custom: n4.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s3, group: "", hooks: {}, logger: o2, on: {}, queue: [], round: 0, session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {} }, timing: Date.now(), user: n4.user || {}, version: "3.0.2", sources: {}, pending: { sources: {}, destinations: {} }, push: void 0, command: void 0 };
18355
+ const e4 = U({ globalsStatic: {}, sessionStatic: {}, tagging: 0, run: true }, n4, { merge: false, extend: false }), t2 = { level: n4.logger?.level, handler: n4.logger?.handler }, o2 = ge(t2), s3 = { ...e4.globalsStatic, ...n4.globals }, a2 = { allowed: false, config: e4, consent: n4.consent || {}, count: 0, custom: n4.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s3, group: "", hooks: {}, logger: o2, on: {}, queue: [], round: 0, session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {} }, timing: Date.now(), user: n4.user || {}, version: "3.1.0", sources: {}, pending: { sources: {}, destinations: {} }, push: void 0, command: void 0 };
18352
18356
  a2.push = rn3(a2, (n5) => ({ timing: Math.round((Date.now() - a2.timing) / 10) / 100, source: { type: "collector", id: "", previous_id: "" }, ...n5 })), a2.command = (function(n5, e5) {
18353
18357
  return Re(async (t3, o3, s4) => await ke(async () => await e5(n5, t3, o3, s4), () => J3({ ok: false }))(), "Command", n5.hooks);
18354
18358
  })(a2, Y3);
@@ -18567,25 +18571,20 @@ async function executeSimulation(event, inputPath, platformOverride, options = {
18567
18571
  const tempDir = getTmpPath();
18568
18572
  try {
18569
18573
  await fs12.ensureDir(tempDir);
18570
- const detected = await detectInput(inputPath, platformOverride);
18574
+ const { flowSettings } = await loadFlowConfig(inputPath, {
18575
+ flowName: options.flow
18576
+ });
18571
18577
  if (!isObject2(event) || !("name" in event) || typeof event.name !== "string") {
18572
18578
  throw new Error(
18573
18579
  'Event must be an object with a "name" property of type string'
18574
18580
  );
18575
18581
  }
18576
18582
  const typedEvent = event;
18577
- if (detected.type !== "config") {
18578
- throw new Error(
18579
- `Input "${inputPath}" is not valid JSON config. simulate only accepts Flow.Config config files.`
18580
- );
18581
- }
18582
18583
  return await executeConfigSimulation(
18583
- detected.content,
18584
- inputPath,
18584
+ flowSettings,
18585
18585
  typedEvent,
18586
18586
  tempDir,
18587
18587
  startTime,
18588
- options.flow,
18589
18588
  options.step
18590
18589
  );
18591
18590
  } catch (error48) {
@@ -18602,22 +18601,21 @@ async function executeSimulation(event, inputPath, platformOverride, options = {
18602
18601
  }
18603
18602
  }
18604
18603
  }
18605
- function parseStepTarget(stepTarget, flowConfig) {
18604
+ function parseStepTarget(stepTarget, flowSettings) {
18606
18605
  if (stepTarget) {
18607
18606
  const dotIndex = stepTarget.indexOf(".");
18608
18607
  if (dotIndex > -1) {
18609
18608
  const type = stepTarget.substring(0, dotIndex);
18610
18609
  const name = stepTarget.substring(dotIndex + 1);
18611
- const section = flowConfig[type + "s"];
18610
+ const section = type === "destination" ? flowSettings.destinations : flowSettings.transformers;
18612
18611
  if (!section?.[name]) {
18613
18612
  throw new Error(`Step "${stepTarget}" not found in flow config`);
18614
18613
  }
18615
18614
  return { type, name, config: section[name] };
18616
18615
  }
18617
18616
  }
18618
- const destinations = flowConfig.destinations;
18619
- if (destinations) {
18620
- const [name, config2] = Object.entries(destinations)[0];
18617
+ if (flowSettings.destinations) {
18618
+ const [name, config2] = Object.entries(flowSettings.destinations)[0];
18621
18619
  return {
18622
18620
  type: "destination",
18623
18621
  name,
@@ -18626,14 +18624,8 @@ function parseStepTarget(stepTarget, flowConfig) {
18626
18624
  }
18627
18625
  throw new Error("No destination found in flow config");
18628
18626
  }
18629
- async function executeConfigSimulation(_content, configPath, typedEvent, tempDir, startTime, flowName, stepTarget) {
18630
- const { flowSettings } = await loadFlowConfig(configPath, {
18631
- flowName
18632
- });
18633
- const step = parseStepTarget(
18634
- stepTarget,
18635
- flowSettings
18636
- );
18627
+ async function executeConfigSimulation(flowSettings, typedEvent, tempDir, startTime, stepTarget) {
18628
+ const step = parseStepTarget(stepTarget, flowSettings);
18637
18629
  if (step.type === "destination") {
18638
18630
  const packageName = step.config.package;
18639
18631
  if (!packageName) {
package/dist/index.js CHANGED
@@ -514,6 +514,10 @@ async function loadContent(inputPath) {
514
514
  }
515
515
  return response.text();
516
516
  }
517
+ const trimmed = inputPath.trim();
518
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
519
+ return trimmed;
520
+ }
517
521
  return fs4.readFile(inputPath, "utf8");
518
522
  }
519
523
  var init_input_detector = __esm({
@@ -3000,7 +3004,7 @@ function rn(n, e2) {
3000
3004
  }, () => J({ ok: false }))(), "Push", n.hooks);
3001
3005
  }
3002
3006
  async function un(n) {
3003
- const e2 = r({ globalsStatic: {}, sessionStatic: {}, tagging: 0, run: true }, n, { merge: false, extend: false }), t2 = { level: n.logger?.level, handler: n.logger?.handler }, o2 = i(t2), s2 = { ...e2.globalsStatic, ...n.globals }, a2 = { allowed: false, config: e2, consent: n.consent || {}, count: 0, custom: n.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s2, group: "", hooks: {}, logger: o2, on: {}, queue: [], round: 0, session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {} }, timing: Date.now(), user: n.user || {}, version: "3.0.2", sources: {}, pending: { sources: {}, destinations: {} }, push: void 0, command: void 0 };
3007
+ const e2 = r({ globalsStatic: {}, sessionStatic: {}, tagging: 0, run: true }, n, { merge: false, extend: false }), t2 = { level: n.logger?.level, handler: n.logger?.handler }, o2 = i(t2), s2 = { ...e2.globalsStatic, ...n.globals }, a2 = { allowed: false, config: e2, consent: n.consent || {}, count: 0, custom: n.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s2, group: "", hooks: {}, logger: o2, on: {}, queue: [], round: 0, session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {} }, timing: Date.now(), user: n.user || {}, version: "3.1.0", sources: {}, pending: { sources: {}, destinations: {} }, push: void 0, command: void 0 };
3004
3008
  a2.push = rn(a2, (n2) => ({ timing: Math.round((Date.now() - a2.timing) / 10) / 100, source: { type: "collector", id: "", previous_id: "" }, ...n2 })), a2.command = (function(n2, e3) {
3005
3009
  return an(async (t3, o3, s3) => await cn(async () => await e3(n2, t3, o3, s3), () => J({ ok: false }))(), "Command", n2.hooks);
3006
3010
  })(a2, Y);
@@ -3219,25 +3223,20 @@ async function executeSimulation(event, inputPath, platformOverride, options = {
3219
3223
  const tempDir = getTmpPath();
3220
3224
  try {
3221
3225
  await fs12.ensureDir(tempDir);
3222
- const detected = await detectInput(inputPath, platformOverride);
3226
+ const { flowSettings } = await loadFlowConfig(inputPath, {
3227
+ flowName: options.flow
3228
+ });
3223
3229
  if (!isObject(event) || !("name" in event) || typeof event.name !== "string") {
3224
3230
  throw new Error(
3225
3231
  'Event must be an object with a "name" property of type string'
3226
3232
  );
3227
3233
  }
3228
3234
  const typedEvent = event;
3229
- if (detected.type !== "config") {
3230
- throw new Error(
3231
- `Input "${inputPath}" is not valid JSON config. simulate only accepts Flow.Config config files.`
3232
- );
3233
- }
3234
3235
  return await executeConfigSimulation(
3235
- detected.content,
3236
- inputPath,
3236
+ flowSettings,
3237
3237
  typedEvent,
3238
3238
  tempDir,
3239
3239
  startTime,
3240
- options.flow,
3241
3240
  options.step
3242
3241
  );
3243
3242
  } catch (error) {
@@ -3254,22 +3253,21 @@ async function executeSimulation(event, inputPath, platformOverride, options = {
3254
3253
  }
3255
3254
  }
3256
3255
  }
3257
- function parseStepTarget(stepTarget, flowConfig) {
3256
+ function parseStepTarget(stepTarget, flowSettings) {
3258
3257
  if (stepTarget) {
3259
3258
  const dotIndex = stepTarget.indexOf(".");
3260
3259
  if (dotIndex > -1) {
3261
3260
  const type = stepTarget.substring(0, dotIndex);
3262
3261
  const name = stepTarget.substring(dotIndex + 1);
3263
- const section = flowConfig[type + "s"];
3262
+ const section = type === "destination" ? flowSettings.destinations : flowSettings.transformers;
3264
3263
  if (!section?.[name]) {
3265
3264
  throw new Error(`Step "${stepTarget}" not found in flow config`);
3266
3265
  }
3267
3266
  return { type, name, config: section[name] };
3268
3267
  }
3269
3268
  }
3270
- const destinations = flowConfig.destinations;
3271
- if (destinations) {
3272
- const [name, config] = Object.entries(destinations)[0];
3269
+ if (flowSettings.destinations) {
3270
+ const [name, config] = Object.entries(flowSettings.destinations)[0];
3273
3271
  return {
3274
3272
  type: "destination",
3275
3273
  name,
@@ -3278,14 +3276,8 @@ function parseStepTarget(stepTarget, flowConfig) {
3278
3276
  }
3279
3277
  throw new Error("No destination found in flow config");
3280
3278
  }
3281
- async function executeConfigSimulation(_content, configPath, typedEvent, tempDir, startTime, flowName, stepTarget) {
3282
- const { flowSettings } = await loadFlowConfig(configPath, {
3283
- flowName
3284
- });
3285
- const step = parseStepTarget(
3286
- stepTarget,
3287
- flowSettings
3288
- );
3279
+ async function executeConfigSimulation(flowSettings, typedEvent, tempDir, startTime, stepTarget) {
3280
+ const step = parseStepTarget(stepTarget, flowSettings);
3289
3281
  if (step.type === "destination") {
3290
3282
  const packageName = step.config.package;
3291
3283
  if (!packageName) {