@usejourney/core 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.
package/dist/index.d.ts CHANGED
@@ -400,7 +400,16 @@ interface HttpContext {
400
400
  subJourneyCache?: SubJourneyCache;
401
401
  /** Default TTL (ms) for sub-journey cache writes; per-call `cacheTtlMs` overrides. */
402
402
  subJourneyCacheTtlMs?: number;
403
+ /**
404
+ * Run-wide default request timeout (ms). Tri-state: `undefined` falls back
405
+ * to `DEFAULT_REQUEST_TIMEOUT_MS`; a number sets a custom default; `null`
406
+ * explicitly disables the default (no timeout). A step's own
407
+ * `timeoutMs` always overrides this.
408
+ */
409
+ defaultTimeoutMs?: number | null;
403
410
  }
411
+ /** Fallback request timeout (ms) when neither a step nor `HttpContext.defaultTimeoutMs` set one. */
412
+ declare const DEFAULT_REQUEST_TIMEOUT_MS = 60000;
404
413
  interface RequestSpec {
405
414
  method: HttpMethod;
406
415
  url: string;
@@ -697,4 +706,4 @@ type FetchResponse = Awaited<ReturnType<typeof globalThis.fetch>>;
697
706
  */
698
707
  declare function fetch$1(input: FetchInput, init?: FetchInit): Promise<FetchResponse>;
699
708
 
700
- export { AssertionError, type BuildRequestOptions, type CacheEntry, type CacheMode, type ConsoleLoggerOptions, DiskSubJourneyCache, type Endpoint, type EndpointDescriptor, type EndpointRef, type EntryJourneyOptions, type EnvValues, type Expectation, type GroupEndEvent, type GroupStartEvent, type HttpContext, type HttpMethod, type HttpResponse, type InvokeJourneyOptions, type JourneyConfig, JourneyConfigSchema, type JourneyDef, type JourneyHandle, type JourneyLogger, type JourneyOptions, type JourneyResult, type K6JourneyOptions, type LoadedConfig, type LogEvent, MemorySubJourneyCache, type PipelineNode, type PlannedNode, type RequestLog, type RequestSpec, type ResponseLog, type ResponseOf, type ReusableJourneyOptions, type RunEndEvent, type RunMeta, type RunPlannedEvent, type RunRecord, type RunStartEvent, type RunSummary, SECRET_HEADERS, type StepDef, type StepEndEvent, type StepOptions, type StepResult, type StepStartEvent, type SubJourneyCache, type SubJourneyCallDef, buildRequest, clearActiveEnvironment, clearRegistry, collectPipeline, collectSubPipeline, createConsoleLogger, createSubJourneyCache, describeError, env, execute, expect, fetch$1 as fetch, formatOpaqueBody, getCurrentCtx, getRegisteredJourneys, invokeJourney, isEndpointRef, isTextualContentType, journey, listEnvironments, listRuns, loadConfig, loadEnvironment, loggerFromEnv, maskHeaders, output, planJourney, pruneRuns, readRun, resolveBaseUrl, resolveConfigPaths, resolveUrl, runAllRegistered, runJourney, setActiveEnvironment, step, subJourneyCacheKey, tryEnv, writeRun };
709
+ export { AssertionError, type BuildRequestOptions, type CacheEntry, type CacheMode, type ConsoleLoggerOptions, DEFAULT_REQUEST_TIMEOUT_MS, DiskSubJourneyCache, type Endpoint, type EndpointDescriptor, type EndpointRef, type EntryJourneyOptions, type EnvValues, type Expectation, type GroupEndEvent, type GroupStartEvent, type HttpContext, type HttpMethod, type HttpResponse, type InvokeJourneyOptions, type JourneyConfig, JourneyConfigSchema, type JourneyDef, type JourneyHandle, type JourneyLogger, type JourneyOptions, type JourneyResult, type K6JourneyOptions, type LoadedConfig, type LogEvent, MemorySubJourneyCache, type PipelineNode, type PlannedNode, type RequestLog, type RequestSpec, type ResponseLog, type ResponseOf, type ReusableJourneyOptions, type RunEndEvent, type RunMeta, type RunPlannedEvent, type RunRecord, type RunStartEvent, type RunSummary, SECRET_HEADERS, type StepDef, type StepEndEvent, type StepOptions, type StepResult, type StepStartEvent, type SubJourneyCache, type SubJourneyCallDef, buildRequest, clearActiveEnvironment, clearRegistry, collectPipeline, collectSubPipeline, createConsoleLogger, createSubJourneyCache, describeError, env, execute, expect, fetch$1 as fetch, formatOpaqueBody, getCurrentCtx, getRegisteredJourneys, invokeJourney, isEndpointRef, isTextualContentType, journey, listEnvironments, listRuns, loadConfig, loadEnvironment, loggerFromEnv, maskHeaders, output, planJourney, pruneRuns, readRun, resolveBaseUrl, resolveConfigPaths, resolveUrl, runAllRegistered, runJourney, setActiveEnvironment, step, subJourneyCacheKey, tryEnv, writeRun };
package/dist/index.js CHANGED
@@ -392,6 +392,7 @@ function loggerFromEnv(env2 = process.env) {
392
392
  }
393
393
 
394
394
  // src/http.ts
395
+ var DEFAULT_REQUEST_TIMEOUT_MS = 6e4;
395
396
  function resolveUrl(endpoint, ctx, params, query) {
396
397
  const base = isEndpointRef(endpoint) ? ctx.baseUrl : endpoint.baseUrl ?? ctx.baseUrl;
397
398
  if (!base) {
@@ -436,7 +437,8 @@ function buildRequest(opts, ctx) {
436
437
  }
437
438
  const spec = { method: opts.endpoint.method, url, headers };
438
439
  if (hasBody) spec.body = opts.body;
439
- if (opts.timeoutMs !== void 0) spec.timeoutMs = opts.timeoutMs;
440
+ const resolvedTimeout = opts.timeoutMs !== void 0 ? opts.timeoutMs : ctx.defaultTimeoutMs === null ? void 0 : ctx.defaultTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
441
+ if (resolvedTimeout !== void 0) spec.timeoutMs = resolvedTimeout;
440
442
  return spec;
441
443
  }
442
444
  function lower(h) {
@@ -1189,6 +1191,7 @@ function bodyForLog(body) {
1189
1191
  import { z as z2 } from "zod";
1190
1192
  export {
1191
1193
  AssertionError,
1194
+ DEFAULT_REQUEST_TIMEOUT_MS,
1192
1195
  DiskSubJourneyCache,
1193
1196
  JourneyConfigSchema,
1194
1197
  MemorySubJourneyCache,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usejourney/core",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",