@walkeros/cli 4.0.1-next-1778230564486 → 4.0.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/dist/index.js CHANGED
@@ -1927,22 +1927,29 @@ function validateReference(type, name, ref) {
1927
1927
  throw new Error(`${type} "${name}": Must specify either package or code.`);
1928
1928
  }
1929
1929
  }
1930
- function generateInlineCode(inline, config, env, chain, chainPropertyName, isDestination) {
1930
+ function generateInlineCode(inline, config, env, chains, isDestination) {
1931
1931
  const pushFn = inline.push.replace("$code:", "");
1932
1932
  const initFn = inline.init ? inline.init.replace("$code:", "") : void 0;
1933
1933
  const typeLine = inline.type ? `type: '${inline.type}',` : "";
1934
- const chainLine = chain && chainPropertyName ? `${chainPropertyName}: ${JSON.stringify(chain)},` : "";
1934
+ const chainLines = [];
1935
+ if (chains?.before !== void 0) {
1936
+ chainLines.push(`before: ${JSON.stringify(chains.before)}`);
1937
+ }
1938
+ if (chains?.next !== void 0) {
1939
+ chainLines.push(`next: ${JSON.stringify(chains.next)}`);
1940
+ }
1941
+ const chainBlock = chainLines.length ? `,
1942
+ ${chainLines.join(",\n ")}` : "";
1935
1943
  if (isDestination) {
1936
1944
  return `{
1937
1945
  code: {
1938
1946
  ${typeLine}
1939
- config: ${JSON.stringify(config || {})},
1947
+ config: ${processConfigValue(config || {})},
1940
1948
  ${initFn ? `init: ${initFn},` : ""}
1941
1949
  push: ${pushFn}
1942
1950
  },
1943
- config: ${JSON.stringify(config || {})},
1944
- env: ${JSON.stringify(env || {})}${chain ? `,
1945
- ${chainLine.slice(0, -1)}` : ""}
1951
+ config: ${processConfigValue(config || {})},
1952
+ env: ${processConfigValue(env || {})}${chainBlock}
1946
1953
  }`;
1947
1954
  }
1948
1955
  return `{
@@ -1952,9 +1959,8 @@ function generateInlineCode(inline, config, env, chain, chainPropertyName, isDes
1952
1959
  ${initFn ? `init: ${initFn},` : ""}
1953
1960
  push: ${pushFn}
1954
1961
  }),
1955
- config: ${JSON.stringify(config || {})},
1956
- env: ${JSON.stringify(env || {})}${chain ? `,
1957
- ${chainLine.slice(0, -1)}` : ""}
1962
+ config: ${processConfigValue(config || {})},
1963
+ env: ${processConfigValue(env || {})}${chainBlock}
1958
1964
  }`;
1959
1965
  }
1960
1966
  async function copyIncludes(includes, sourceDir, outputDir, logger) {
@@ -2790,13 +2796,13 @@ function buildSplitConfigObject(flowSettings, explicitCodeImports) {
2790
2796
  });
2791
2797
  const sourcesEntries = Object.entries(sources).filter(([, source]) => source.package || hasCodeReference(source.code)).map(([key, source]) => {
2792
2798
  if (isInlineCode(source.code)) {
2793
- return ` ${key}: ${generateInlineCode(source.code, source.config || {}, source.env, source.next, "next")}`;
2799
+ return ` ${key}: ${generateInlineCode(source.code, source.config || {}, source.env, { next: source.next })}`;
2794
2800
  }
2795
2801
  return buildSplitStepEntry("sources", key, source);
2796
2802
  });
2797
2803
  const destinationsEntries = Object.entries(destinations).filter(([, dest]) => dest.package || hasCodeReference(dest.code)).map(([key, dest]) => {
2798
2804
  if (isInlineCode(dest.code)) {
2799
- return ` ${key}: ${generateInlineCode(dest.code, dest.config || {}, dest.env, dest.before, "before", true)}`;
2805
+ return ` ${key}: ${generateInlineCode(dest.code, dest.config || {}, dest.env, { before: dest.before, next: dest.next }, true)}`;
2800
2806
  }
2801
2807
  return buildSplitStepEntry("destinations", key, dest);
2802
2808
  });
@@ -2804,7 +2810,7 @@ function buildSplitConfigObject(flowSettings, explicitCodeImports) {
2804
2810
  ([, transformer]) => transformer.package || hasCodeReference(transformer.code)
2805
2811
  ).map(([key, transformer]) => {
2806
2812
  if (isInlineCode(transformer.code)) {
2807
- return ` ${key}: ${generateInlineCode(transformer.code, transformer.config || {}, transformer.env, transformer.next, "next")}`;
2813
+ return ` ${key}: ${generateInlineCode(transformer.code, transformer.config || {}, transformer.env, { before: transformer.before, next: transformer.next })}`;
2808
2814
  }
2809
2815
  return buildSplitStepEntry("transformers", key, transformer);
2810
2816
  });
@@ -6370,7 +6376,7 @@ function validateMapping(input) {
6370
6376
  // src/commands/validate/validators/entry.ts
6371
6377
  import Ajv from "ajv";
6372
6378
  import { fetchPackageSchema } from "@walkeros/core";
6373
- var CLIENT_HEADER = "walkeros-cli/4.0.1-next-1778230564486";
6379
+ var CLIENT_HEADER = "walkeros-cli/4.0.1";
6374
6380
  var SECTIONS = ["destinations", "sources", "transformers"];
6375
6381
  function resolveEntry(path20, flowConfig) {
6376
6382
  const flows = flowConfig.flows;