@usejourney/cli 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/dist/index.js +27 -8
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -567,6 +567,9 @@ async function runCommand(opts) {
567
567
  });
568
568
  if (subCache) ctx.subJourneyCache = subCache;
569
569
  if (opts.cacheTtlMs !== void 0) ctx.subJourneyCacheTtlMs = opts.cacheTtlMs;
570
+ if (opts.timeoutMs !== void 0) {
571
+ ctx.defaultTimeoutMs = opts.timeoutMs === 0 ? null : opts.timeoutMs;
572
+ }
570
573
  const results = await runAllRegistered(ctx);
571
574
  printResults(results);
572
575
  const cacheDir = join5(opts.projectDir, ".journey", "cache");
@@ -722,6 +725,9 @@ async function runJourneyFile(opts) {
722
725
  if (opts.subJourneyCacheTtlMs !== void 0) {
723
726
  ctx.subJourneyCacheTtlMs = opts.subJourneyCacheTtlMs;
724
727
  }
728
+ if (opts.timeoutMs !== void 0) {
729
+ ctx.defaultTimeoutMs = opts.timeoutMs === 0 ? null : opts.timeoutMs;
730
+ }
725
731
  const unpatchConsole = logger ? patchConsole(logger) : () => {
726
732
  };
727
733
  let results;
@@ -1334,7 +1340,7 @@ async function proxyRequest(body) {
1334
1340
  durationMs: Date.now() - started
1335
1341
  };
1336
1342
  }
1337
- async function route(req, res, projectDir, debug, setProjectDir, cacheFor, cacheTtlMs) {
1343
+ async function route(req, res, projectDir, debug, setProjectDir, cacheFor, cacheTtlMs, timeoutMs) {
1338
1344
  if (req.method === "OPTIONS") {
1339
1345
  res.writeHead(204, {
1340
1346
  "access-control-allow-origin": "*",
@@ -1553,7 +1559,8 @@ async function route(req, res, projectDir, debug, setProjectDir, cacheFor, cache
1553
1559
  ...typeof body.upToStepIdx === "number" ? { upToStepIdx: body.upToStepIdx } : {},
1554
1560
  ...debug ? { debug: true } : {},
1555
1561
  ...subJourneyCache !== void 0 ? { subJourneyCache } : {},
1556
- ...cacheTtlMs !== void 0 ? { subJourneyCacheTtlMs: cacheTtlMs } : {}
1562
+ ...cacheTtlMs !== void 0 ? { subJourneyCacheTtlMs: cacheTtlMs } : {},
1563
+ ...timeoutMs !== void 0 ? { timeoutMs } : {}
1557
1564
  });
1558
1565
  if (body.stream) {
1559
1566
  runPromise.catch((err) => {
@@ -1659,7 +1666,8 @@ async function startServer(opts) {
1659
1666
  opts.debug ?? false,
1660
1667
  setProjectDir,
1661
1668
  cacheFor,
1662
- opts.cacheTtlMs
1669
+ opts.cacheTtlMs,
1670
+ opts.timeoutMs
1663
1671
  );
1664
1672
  });
1665
1673
  await new Promise((resolve7, reject) => {
@@ -1684,7 +1692,8 @@ async function runServe(opts) {
1684
1692
  ...opts.port !== void 0 ? { port: opts.port } : {},
1685
1693
  ...opts.debug !== void 0 ? { debug: opts.debug } : {},
1686
1694
  ...opts.cache !== void 0 ? { cache: opts.cache } : {},
1687
- ...opts.cacheTtlMs !== void 0 ? { cacheTtlMs: opts.cacheTtlMs } : {}
1695
+ ...opts.cacheTtlMs !== void 0 ? { cacheTtlMs: opts.cacheTtlMs } : {},
1696
+ ...opts.timeoutMs !== void 0 ? { timeoutMs: opts.timeoutMs } : {}
1688
1697
  });
1689
1698
  console.log(`Journey API listening at ${srv.url}`);
1690
1699
  console.log(`For the GUI, run: pnpm --filter @usejourney/gui dev`);
@@ -1741,7 +1750,11 @@ function buildProgram() {
1741
1750
  "Sub-journey output cache: off|run|process|disk",
1742
1751
  parseCacheMode,
1743
1752
  "process"
1744
- ).option("--cache-ttl <ms>", "Default sub-journey cache TTL in ms", (v) => parseInt(v, 10)).description("Run one or more journeys (or --all)").action(
1753
+ ).option("--cache-ttl <ms>", "Default sub-journey cache TTL in ms", (v) => parseInt(v, 10)).option(
1754
+ "--timeout <ms>",
1755
+ "Request timeout in ms; 0 disables (default 60000)",
1756
+ (v) => parseInt(v, 10)
1757
+ ).description("Run one or more journeys (or --all)").action(
1745
1758
  (files, options) => handle(
1746
1759
  () => runCommand({
1747
1760
  projectDir: process.cwd(),
@@ -1752,7 +1765,8 @@ function buildProgram() {
1752
1765
  ...options.watch !== void 0 ? { watch: options.watch } : {},
1753
1766
  ...options.insecure !== void 0 ? { insecure: options.insecure } : {},
1754
1767
  ...options.cache !== void 0 ? { cache: options.cache } : {},
1755
- ...options.cacheTtl !== void 0 ? { cacheTtlMs: options.cacheTtl } : {}
1768
+ ...options.cacheTtl !== void 0 ? { cacheTtlMs: options.cacheTtl } : {},
1769
+ ...options.timeout !== void 0 ? { timeoutMs: options.timeout } : {}
1756
1770
  })
1757
1771
  )
1758
1772
  );
@@ -1816,7 +1830,11 @@ function buildProgram() {
1816
1830
  "Sub-journey output cache: off|run|process|disk",
1817
1831
  parseCacheMode,
1818
1832
  "process"
1819
- ).option("--cache-ttl <ms>", "Default sub-journey cache TTL in ms", (v) => parseInt(v, 10)).description("Run the GUI backend API for the current project").action(
1833
+ ).option("--cache-ttl <ms>", "Default sub-journey cache TTL in ms", (v) => parseInt(v, 10)).option(
1834
+ "--timeout <ms>",
1835
+ "Request timeout in ms for journey runs triggered via the API; 0 disables (default 60000)",
1836
+ (v) => parseInt(v, 10)
1837
+ ).description("Run the GUI backend API for the current project").action(
1820
1838
  (options) => {
1821
1839
  const projectDir = options.project ? resolvePath(process.cwd(), options.project) : process.cwd();
1822
1840
  return handle(
@@ -1827,7 +1845,8 @@ function buildProgram() {
1827
1845
  ...options.debug !== void 0 ? { debug: options.debug } : {},
1828
1846
  ...options.insecure !== void 0 ? { insecure: options.insecure } : {},
1829
1847
  ...options.cache !== void 0 ? { cache: options.cache } : {},
1830
- ...options.cacheTtl !== void 0 ? { cacheTtlMs: options.cacheTtl } : {}
1848
+ ...options.cacheTtl !== void 0 ? { cacheTtlMs: options.cacheTtl } : {},
1849
+ ...options.timeout !== void 0 ? { timeoutMs: options.timeout } : {}
1831
1850
  })
1832
1851
  );
1833
1852
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usejourney/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,10 +23,10 @@
23
23
  "commander": "^12.1.0",
24
24
  "tsx": "^4.21.0",
25
25
  "undici": "^8.3.0",
26
- "@usejourney/core": "0.1.3",
27
- "@usejourney/postman-adapter": "^0.1.3",
28
- "@usejourney/k6-adapter": "^0.1.3",
29
- "@usejourney/codegen": "^0.1.3"
26
+ "@usejourney/codegen": "^0.1.4",
27
+ "@usejourney/core": "0.1.4",
28
+ "@usejourney/k6-adapter": "^0.1.4",
29
+ "@usejourney/postman-adapter": "^0.1.4"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/newman": "^5.3.6",