kizunajs 2.0.0-beta.31 → 2.0.0-beta.32

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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  A spec-driven framework for building fully typed REST APIs in TypeScript, where your route declarations produce the validation, the documentation, the clients, and the AI tools.
6
6
 
7
- [![npm](https://img.shields.io/npm/v/kizunajs/beta?color=blue&label=npm)](https://www.npmjs.com/package/kizunajs/v/2.0.0-beta.31)
7
+ [![npm](https://img.shields.io/npm/v/kizunajs/beta?color=blue&label=npm)](https://www.npmjs.com/package/kizunajs/v/2.0.0-beta.32)
8
8
  ![license](https://img.shields.io/badge/license-MIT-blue)
9
9
 
10
10
  [Documentation](https://kizunajs.com)
@@ -1,6 +1,6 @@
1
1
  const require_plugin = require("./plugin-Dw-yCjTY.cjs");
2
2
  const require_error_response = require("./error-response-DN5Dsf8b.cjs");
3
- const require_plugin_server = require("./plugin-server-tW5ZoOud.cjs");
3
+ const require_plugin_server = require("./plugin-server-6sIGS0RF.cjs");
4
4
  const require_schemas = require("./schemas-Bre1FVHq.cjs");
5
5
  let zod = require("zod");
6
6
  //#region src/tool-definitions.ts
@@ -1631,9 +1631,9 @@ const assembleApi = (contract, parts) => {
1631
1631
  };
1632
1632
  /**
1633
1633
  * The endpoints jobs are served on, in the {@link Routes} shape the request
1634
- * pipeline takes. None when the jobs run in process.
1634
+ * pipeline takes. None in `'long-running'` mode.
1635
1635
  */
1636
- const jobRoutes = (meta) => meta.config?.mode === "in-process" ? {} : {
1636
+ const jobRoutes = (meta) => meta.config?.mode === "long-running" ? {} : {
1637
1637
  [DISPATCH_ROUTE_KEY]: dispatchRoute(meta),
1638
1638
  [RUN_ROUTE_KEY]: runRoute(meta)
1639
1639
  };
@@ -1653,7 +1653,7 @@ const warnUnsupportedJobOptions = (jobs, transport, logger = console) => {
1653
1653
  if (retrying.length === 0) return;
1654
1654
  const named = retrying.map((jobKey) => `"${jobKey}"`).join(", ");
1655
1655
  if (!transport) {
1656
- logger.warn(`[kizuna] ${named} declare \`retry\`, but no transport is configured, so a failed run is not retried. Pass one as \`jobRunner.transport\` in \`kizuna.config.ts\` to make retrying real.`);
1656
+ logger.warn(`[kizuna] ${named} declare \`retry\`, but \`jobRunner.transport\` is \`false\`, so a failed run is not retried. Pass a transport in \`kizuna.config.ts\` to make retrying real.`);
1657
1657
  return;
1658
1658
  }
1659
1659
  if (!transport.supports.retry) logger.warn(`[kizuna] ${named} declare \`retry\`, but the "${transport.name}" transport does not retry, so the count is ignored.`);
@@ -1,6 +1,6 @@
1
1
  import { g as ROUTES_GROUP, n as PLUGIN_SERVERS_META_KEY, o as pluginRouteTree, p as HANDLER, t as PLUGIN_ROUTES_META_KEY } from "./plugin-xxCxibmu.mjs";
2
2
  import { D as resolveBaseType, E as readObjectShape, O as unwrapOptionalWrappers, c as isBinarySchema, m as readDef, o as findCoercedSchemaPath, p as isVoidSchema, t as ProblemDetailsSchema, u as isFileSchema } from "./error-response-D7urgxeq.mjs";
3
- import { A as deriveToolNames, B as streamSchemas, G as isSuccessStatus, I as routeStreams, K as isZodSchema, M as EVENT_STREAM_MEDIA_TYPE, N as assertValidStreams, P as encodeStreamBody, Q as resolveResponseEtag, R as streamContentType, S as dueSchedules, U as isJsonMediaType, W as isStreamResponse, X as resolveResponseCache, Y as resolveResponseBody, Z as resolveResponseContentType, _ as jobAt, c as cacheHeaders, ct as parsePath, dt as formatValidationError, ft as isRouteDefinition, h as isCompiledJob, k as encodeForWire, lt as allowedMethodsForPath, m as flattenJobs, mt as resolveCoercionPlans, pt as validateRequest, u as deprecationHeaders, ut as flattenRoutes, y as toJobResponse } from "./plugin-server-D8XrYDQU.mjs";
3
+ import { A as deriveToolNames, B as streamSchemas, G as isSuccessStatus, I as routeStreams, K as isZodSchema, M as EVENT_STREAM_MEDIA_TYPE, N as assertValidStreams, P as encodeStreamBody, Q as resolveResponseEtag, R as streamContentType, S as dueSchedules, U as isJsonMediaType, W as isStreamResponse, X as resolveResponseCache, Y as resolveResponseBody, Z as resolveResponseContentType, _ as jobAt, c as cacheHeaders, ct as parsePath, dt as formatValidationError, ft as isRouteDefinition, h as isCompiledJob, k as encodeForWire, lt as allowedMethodsForPath, m as flattenJobs, mt as resolveCoercionPlans, pt as validateRequest, u as deprecationHeaders, ut as flattenRoutes, y as toJobResponse } from "./plugin-server-l_eKX28n.mjs";
4
4
  import { l as authenticationChallenge, p as resolveSecurityRequirements } from "./schemas-DBX8DwFb.mjs";
5
5
  import { z } from "zod";
6
6
  //#region src/tool-definitions.ts
@@ -1631,9 +1631,9 @@ const assembleApi = (contract, parts) => {
1631
1631
  };
1632
1632
  /**
1633
1633
  * The endpoints jobs are served on, in the {@link Routes} shape the request
1634
- * pipeline takes. None when the jobs run in process.
1634
+ * pipeline takes. None in `'long-running'` mode.
1635
1635
  */
1636
- const jobRoutes = (meta) => meta.config?.mode === "in-process" ? {} : {
1636
+ const jobRoutes = (meta) => meta.config?.mode === "long-running" ? {} : {
1637
1637
  [DISPATCH_ROUTE_KEY]: dispatchRoute(meta),
1638
1638
  [RUN_ROUTE_KEY]: runRoute(meta)
1639
1639
  };
@@ -1653,7 +1653,7 @@ const warnUnsupportedJobOptions = (jobs, transport, logger = console) => {
1653
1653
  if (retrying.length === 0) return;
1654
1654
  const named = retrying.map((jobKey) => `"${jobKey}"`).join(", ");
1655
1655
  if (!transport) {
1656
- logger.warn(`[kizuna] ${named} declare \`retry\`, but no transport is configured, so a failed run is not retried. Pass one as \`jobRunner.transport\` in \`kizuna.config.ts\` to make retrying real.`);
1656
+ logger.warn(`[kizuna] ${named} declare \`retry\`, but \`jobRunner.transport\` is \`false\`, so a failed run is not retried. Pass a transport in \`kizuna.config.ts\` to make retrying real.`);
1657
1657
  return;
1658
1658
  }
1659
1659
  if (!transport.supports.retry) logger.warn(`[kizuna] ${named} declare \`retry\`, but the "${transport.name}" transport does not retry, so the count is ignored.`);
@@ -1394,8 +1394,8 @@ interface JobFn<Job extends CompiledJob> {
1394
1394
  */
1395
1395
  run: (...args: JobRunArgs<Job>) => Promise<JobHandlerReturn<Job['definition']>>;
1396
1396
  /**
1397
- * Put the job in line and answer without waiting for it. With no transport
1398
- * configured the job runs in this process and is lost on a crash.
1397
+ * Put the job in line and answer without waiting for it. With
1398
+ * `transport: false` the job runs in this process and is lost on a crash.
1399
1399
  */
1400
1400
  queue: (...args: JobQueueArgs<Job>) => Promise<void>;
1401
1401
  }
@@ -1418,7 +1418,7 @@ declare class JobInputError extends Error {
1418
1418
  }
1419
1419
  /**
1420
1420
  * Called for every failed run of a job that no caller awaits: one a worker,
1421
- * `/jobs/dispatch` or `/jobs/run` ran, or one queued without a transport. A
1421
+ * `/jobs/dispatch` or `/jobs/run` ran, or one queued with `transport: false`. A
1422
1422
  * run fails when its handler throws or answers a status of 400 or more, which
1423
1423
  * arrives as a `ResponseError`. Without one, the failure is logged.
1424
1424
  */
@@ -1481,7 +1481,7 @@ type JobsConfig = HttpJobsConfig | InProcessJobsConfig;
1481
1481
  interface HttpJobsConfig {
1482
1482
  /**
1483
1483
  * `'http'` serves `/jobs/dispatch` and `/jobs/run`, guarded by the jobs'
1484
- * identity. `'in-process'` is for a long-running server whose schedules
1484
+ * identity. `'long-running'` is for a long-running server whose schedules
1485
1485
  * `startJobs` ticks, and serves neither.
1486
1486
  */
1487
1487
  mode: 'http';
@@ -1519,7 +1519,7 @@ interface HttpJobsConfig {
1519
1519
  * No job endpoint is served, so the jobs need no identity.
1520
1520
  */
1521
1521
  interface InProcessJobsConfig {
1522
- mode: 'in-process';
1522
+ mode: 'long-running';
1523
1523
  path?: never;
1524
1524
  method?: never;
1525
1525
  windowMs?: never;
@@ -1538,14 +1538,15 @@ type JobRunnerConfig = JobsConfig & JobDeliveryConfig;
1538
1538
  */
1539
1539
  interface JobDeliveryConfig {
1540
1540
  /**
1541
- * Carries a queued job to whatever runs it. Without one, `queue` runs the
1542
- * job in this process and it is lost on a crash.
1541
+ * Carries a queued job to whatever runs it. `false` runs a queued job in
1542
+ * this process, without waiting for it, and loses it on a crash or a
1543
+ * serverless freeze.
1543
1544
  */
1544
- transport?: JobTransport;
1545
+ transport: JobTransport | false;
1545
1546
  /**
1546
1547
  * Reached by every failed run no caller awaits, from a worker,
1547
- * `/jobs/dispatch`, `/jobs/run`, or `queue` without a transport. Called once
1548
- * per attempt.
1548
+ * `/jobs/dispatch`, `/jobs/run`, or `queue` with `transport: false`. Called
1549
+ * once per attempt.
1549
1550
  */
1550
1551
  onError?: JobErrorHandler;
1551
1552
  }
@@ -2491,7 +2492,7 @@ declare const assembleApi: <const R extends Routes>(contract: {
2491
2492
  }, parts: ApiParts) => ApiWithRouter<R>;
2492
2493
  /**
2493
2494
  * The endpoints jobs are served on, in the {@link Routes} shape the request
2494
- * pipeline takes. None when the jobs run in process.
2495
+ * pipeline takes. None in `'long-running'` mode.
2495
2496
  */
2496
2497
  declare const jobRoutes: (meta: JobsMeta) => Routes;
2497
2498
  /**
@@ -1394,8 +1394,8 @@ interface JobFn<Job extends CompiledJob> {
1394
1394
  */
1395
1395
  run: (...args: JobRunArgs<Job>) => Promise<JobHandlerReturn<Job['definition']>>;
1396
1396
  /**
1397
- * Put the job in line and answer without waiting for it. With no transport
1398
- * configured the job runs in this process and is lost on a crash.
1397
+ * Put the job in line and answer without waiting for it. With
1398
+ * `transport: false` the job runs in this process and is lost on a crash.
1399
1399
  */
1400
1400
  queue: (...args: JobQueueArgs<Job>) => Promise<void>;
1401
1401
  }
@@ -1418,7 +1418,7 @@ declare class JobInputError extends Error {
1418
1418
  }
1419
1419
  /**
1420
1420
  * Called for every failed run of a job that no caller awaits: one a worker,
1421
- * `/jobs/dispatch` or `/jobs/run` ran, or one queued without a transport. A
1421
+ * `/jobs/dispatch` or `/jobs/run` ran, or one queued with `transport: false`. A
1422
1422
  * run fails when its handler throws or answers a status of 400 or more, which
1423
1423
  * arrives as a `ResponseError`. Without one, the failure is logged.
1424
1424
  */
@@ -1481,7 +1481,7 @@ type JobsConfig = HttpJobsConfig | InProcessJobsConfig;
1481
1481
  interface HttpJobsConfig {
1482
1482
  /**
1483
1483
  * `'http'` serves `/jobs/dispatch` and `/jobs/run`, guarded by the jobs'
1484
- * identity. `'in-process'` is for a long-running server whose schedules
1484
+ * identity. `'long-running'` is for a long-running server whose schedules
1485
1485
  * `startJobs` ticks, and serves neither.
1486
1486
  */
1487
1487
  mode: 'http';
@@ -1519,7 +1519,7 @@ interface HttpJobsConfig {
1519
1519
  * No job endpoint is served, so the jobs need no identity.
1520
1520
  */
1521
1521
  interface InProcessJobsConfig {
1522
- mode: 'in-process';
1522
+ mode: 'long-running';
1523
1523
  path?: never;
1524
1524
  method?: never;
1525
1525
  windowMs?: never;
@@ -1538,14 +1538,15 @@ type JobRunnerConfig = JobsConfig & JobDeliveryConfig;
1538
1538
  */
1539
1539
  interface JobDeliveryConfig {
1540
1540
  /**
1541
- * Carries a queued job to whatever runs it. Without one, `queue` runs the
1542
- * job in this process and it is lost on a crash.
1541
+ * Carries a queued job to whatever runs it. `false` runs a queued job in
1542
+ * this process, without waiting for it, and loses it on a crash or a
1543
+ * serverless freeze.
1543
1544
  */
1544
- transport?: JobTransport;
1545
+ transport: JobTransport | false;
1545
1546
  /**
1546
1547
  * Reached by every failed run no caller awaits, from a worker,
1547
- * `/jobs/dispatch`, `/jobs/run`, or `queue` without a transport. Called once
1548
- * per attempt.
1548
+ * `/jobs/dispatch`, `/jobs/run`, or `queue` with `transport: false`. Called
1549
+ * once per attempt.
1549
1550
  */
1550
1551
  onError?: JobErrorHandler;
1551
1552
  }
@@ -2491,7 +2492,7 @@ declare const assembleApi: <const R extends Routes>(contract: {
2491
2492
  }, parts: ApiParts) => ApiWithRouter<R>;
2492
2493
  /**
2493
2494
  * The endpoints jobs are served on, in the {@link Routes} shape the request
2494
- * pipeline takes. None when the jobs run in process.
2495
+ * pipeline takes. None in `'long-running'` mode.
2495
2496
  */
2496
2497
  declare const jobRoutes: (meta: JobsMeta) => Routes;
2497
2498
  /**
package/dist/adapter.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_plugin = require("./plugin-Dw-yCjTY.cjs");
3
- const require_plugin_server = require("./plugin-server-tW5ZoOud.cjs");
3
+ const require_plugin_server = require("./plugin-server-6sIGS0RF.cjs");
4
4
  const require_schemas = require("./schemas-Bre1FVHq.cjs");
5
- const require_adapter = require("./adapter-CVPTNiOM.cjs");
5
+ const require_adapter = require("./adapter-BcRUajrL.cjs");
6
6
  exports.API_META = require_adapter.API_META;
7
7
  exports.AUTO_GUARD_BRAND = require_plugin.AUTO_GUARD_BRAND;
8
8
  exports.AUTO_RESPONSES_BRAND = require_plugin.AUTO_RESPONSES_BRAND;
@@ -1,3 +1,3 @@
1
1
  import { A as AutoResponsesBrand, B as ROUTES_GROUP, D as AUTO_RESPONSES_BRAND, I as HANDLER_CONTEXT_BRAND, K as RouteDefinition, L as HandlerContextBrand, T as AUTO_GUARD_BRAND, W as ResponseHeaders, Y as RoutePath, Z as Routes, at as ProblemDetails, c as authenticationChallenge, f as resolveSecurityRequirements, st as problemDetails, z as Method } from "./error-response-YbkRMKno.cjs";
2
- import { $ as jobRouter, $i as buildPath, $n as isCompiledJob, $r as SharedSegmentRoute, A as RenderedResult, Aa as insufficientScope, B as bearerChallenge, Bi as buildToolInputSchema, C as JOBS_META, Ci as ValidationFailure, D as REQUEST_CONTEXT_META, Di as formatValidationError, E as MountedOf, Ei as flattenRoutes, F as RouteMatcher, Fn as CompiledJob, G as dispatchHandler, Gi as toolOptionsOf, Gr as RawResponse, Gt as PluginExportValues, H as callGuard, Hi as selectToolRoutes, Ht as PluginArgs, I as SCHEMES_META, J as extractCredential, Jn as Jobs, K as dispatchRoute, Ki as toolRefusal, Kr as isRawResponse, Kt as PluginExportsOf, L as ServerOptions, Li as ToolDefinition, Ln as FlattenedJob, Lt as ApiPlugins, M as RequestContextRun, Ma as withPermissions, N as RequestPipeline, O as ROUTER_META, Oi as isRouteDefinition, P as ResponseValidationError, Q as isGuardDenial, Qn as flattenJobs, Qr as RouteMatch, R as adapterContextOf, Ri as ToolInputSchema, S as HandlerContextOf, Sr as defineJobTransport, T as MountArgsOf, Ti as allowedMethodsForPath, U as contractOf, Ui as toolInputJsonSchema, Ut as PluginDeclaration, V as boundJobKeys, Vi as describeTool, Vn as JobHandler, W as defineAdapter, Wi as toolJsonSchema, Wn as JobHandlers, Wr as isGroupSet, Wt as PluginDefinition, X as guardDenyFor, Xr as MatchResult, Xt as PluginRoutes, Y as getHeaderValue, Z as headersToObject, Zi as PathSegment, Zr as PathParamsResult, Zt as PluginRoutesOf, _ as GuardDeny, _i as RequestContextValues, a as AdapterRequest, ai as BrandedHandlerContext, an as definePlugin, ar as JobInputError, at as routerFromRoutes, b as HANDLER_ARG_KEYS, bi as Router, br as JobWorkerContext, c as ApiBrand, ct as warnUnsupportedJobOptions, d as DISPATCH_ROUTE_KEY, dr as createJobRunner, dt as groupRoutes, ea as parsePath, ei as isMalformedPath, et as jobRoutes, f as ErrorFormatter, fa as encodeStreamBody, fi as GuardedParamNames, fr as jobFnAt, ft as createApiReference, g as GuardDenialBody, gi as RawInputs, gr as JobTransport, gt as resolvePlugins, h as GuardDenial, hi as HandlersFromRoutes, hr as JobMessage, ht as pluginRoutesOf, i as AdapterDefinition, ir as JobFnByKey, it as renderJsonResult, j as RequestContextMap, ja as requiresDenial, k as RUN_ROUTE_KEY, ka as AccessCheckInput, ki as validateRequest, l as ApiParts, li as GuardParams, lr as JobRunner, lt as ApiRouter, m as GUARD_SCHEMA_META, mr as JobDispatchError, mt as pluginRouterOf, n as API_META, na as EncodeStreamOptions, ni as sharedSegmentRoute, nr as JobErrorHandler, nt as parseBodyText, o as AdapterResult, oi as ContextFromAuth, on as pluginRouteTree, ot as runHandler, p as GUARDS_META, pr as JobDescriptor, pt as pluginExportsOf, q as entriesToObject, qr as rawResponse, r as Adapter, ri as sortFlattenedRoutes, rt as parseFetchBody, s as AnyAdapter, sa as StreamContext, si as FlattenedRoute, st as runRoute, t as ADAPTER_CONTEXT, ti as matchRoute, tn as ResolvedPlugin, tr as jobAt, tt as jobRunnerFrom, u as ApiWithRouter, ur as JobRunnerOptions, ut as ResponseError, v as GuardMap, w as JobsMeta, wi as ValidationStage, x as HandleArgs, xi as RoutesWithHandlerContext, xr as ScheduledJob, y as GuardRun, yi as RouteHandler, yr as JobWorker, yt as isStreamResponse, z as assembleApi, zi as buildToolDefinitions } from "./adapter-Dq2kc8Jc.cjs";
2
+ import { $ as jobRouter, $i as buildPath, $n as isCompiledJob, $r as SharedSegmentRoute, A as RenderedResult, Aa as insufficientScope, B as bearerChallenge, Bi as buildToolInputSchema, C as JOBS_META, Ci as ValidationFailure, D as REQUEST_CONTEXT_META, Di as formatValidationError, E as MountedOf, Ei as flattenRoutes, F as RouteMatcher, Fn as CompiledJob, G as dispatchHandler, Gi as toolOptionsOf, Gr as RawResponse, Gt as PluginExportValues, H as callGuard, Hi as selectToolRoutes, Ht as PluginArgs, I as SCHEMES_META, J as extractCredential, Jn as Jobs, K as dispatchRoute, Ki as toolRefusal, Kr as isRawResponse, Kt as PluginExportsOf, L as ServerOptions, Li as ToolDefinition, Ln as FlattenedJob, Lt as ApiPlugins, M as RequestContextRun, Ma as withPermissions, N as RequestPipeline, O as ROUTER_META, Oi as isRouteDefinition, P as ResponseValidationError, Q as isGuardDenial, Qn as flattenJobs, Qr as RouteMatch, R as adapterContextOf, Ri as ToolInputSchema, S as HandlerContextOf, Sr as defineJobTransport, T as MountArgsOf, Ti as allowedMethodsForPath, U as contractOf, Ui as toolInputJsonSchema, Ut as PluginDeclaration, V as boundJobKeys, Vi as describeTool, Vn as JobHandler, W as defineAdapter, Wi as toolJsonSchema, Wn as JobHandlers, Wr as isGroupSet, Wt as PluginDefinition, X as guardDenyFor, Xr as MatchResult, Xt as PluginRoutes, Y as getHeaderValue, Z as headersToObject, Zi as PathSegment, Zr as PathParamsResult, Zt as PluginRoutesOf, _ as GuardDeny, _i as RequestContextValues, a as AdapterRequest, ai as BrandedHandlerContext, an as definePlugin, ar as JobInputError, at as routerFromRoutes, b as HANDLER_ARG_KEYS, bi as Router, br as JobWorkerContext, c as ApiBrand, ct as warnUnsupportedJobOptions, d as DISPATCH_ROUTE_KEY, dr as createJobRunner, dt as groupRoutes, ea as parsePath, ei as isMalformedPath, et as jobRoutes, f as ErrorFormatter, fa as encodeStreamBody, fi as GuardedParamNames, fr as jobFnAt, ft as createApiReference, g as GuardDenialBody, gi as RawInputs, gr as JobTransport, gt as resolvePlugins, h as GuardDenial, hi as HandlersFromRoutes, hr as JobMessage, ht as pluginRoutesOf, i as AdapterDefinition, ir as JobFnByKey, it as renderJsonResult, j as RequestContextMap, ja as requiresDenial, k as RUN_ROUTE_KEY, ka as AccessCheckInput, ki as validateRequest, l as ApiParts, li as GuardParams, lr as JobRunner, lt as ApiRouter, m as GUARD_SCHEMA_META, mr as JobDispatchError, mt as pluginRouterOf, n as API_META, na as EncodeStreamOptions, ni as sharedSegmentRoute, nr as JobErrorHandler, nt as parseBodyText, o as AdapterResult, oi as ContextFromAuth, on as pluginRouteTree, ot as runHandler, p as GUARDS_META, pr as JobDescriptor, pt as pluginExportsOf, q as entriesToObject, qr as rawResponse, r as Adapter, ri as sortFlattenedRoutes, rt as parseFetchBody, s as AnyAdapter, sa as StreamContext, si as FlattenedRoute, st as runRoute, t as ADAPTER_CONTEXT, ti as matchRoute, tn as ResolvedPlugin, tr as jobAt, tt as jobRunnerFrom, u as ApiWithRouter, ur as JobRunnerOptions, ut as ResponseError, v as GuardMap, w as JobsMeta, wi as ValidationStage, x as HandleArgs, xi as RoutesWithHandlerContext, xr as ScheduledJob, y as GuardRun, yi as RouteHandler, yr as JobWorker, yt as isStreamResponse, z as assembleApi, zi as buildToolDefinitions } from "./adapter-VoxBoXIp.cjs";
3
3
  export { ADAPTER_CONTEXT, API_META, AUTO_GUARD_BRAND, AUTO_RESPONSES_BRAND, AccessCheckInput, Adapter, AdapterDefinition, AdapterRequest, AdapterResult, AnyAdapter, ApiBrand, ApiParts, ApiPlugins, ApiRouter, ApiWithRouter, AutoResponsesBrand, BrandedHandlerContext, CompiledJob, ContextFromAuth, DISPATCH_ROUTE_KEY, EncodeStreamOptions, ErrorFormatter, FlattenedJob, FlattenedRoute, GUARDS_META, GUARD_SCHEMA_META, GuardDenial, GuardDenialBody, GuardDeny, GuardMap, GuardParams, GuardRun, GuardedParamNames, HANDLER_ARG_KEYS, HANDLER_CONTEXT_BRAND, HandleArgs, HandlerContextBrand, HandlerContextOf, HandlersFromRoutes, JOBS_META, JobDescriptor, JobDispatchError, JobErrorHandler, JobFnByKey, JobHandler, JobHandlers, JobInputError, JobMessage, JobRunner, JobRunnerOptions, JobTransport, JobWorker, JobWorkerContext, Jobs, JobsMeta, MatchResult, Method, MountArgsOf, MountedOf, PathParamsResult, PathSegment, PluginArgs, PluginDeclaration, PluginDefinition, PluginExportValues, PluginExportsOf, PluginRoutes, PluginRoutesOf, ProblemDetails, REQUEST_CONTEXT_META, ROUTER_META, ROUTES_GROUP, RUN_ROUTE_KEY, RawInputs, RawResponse, RenderedResult, RequestContextMap, RequestContextRun, RequestContextValues, RequestPipeline, ResolvedPlugin, ResponseError, ResponseHeaders, ResponseValidationError, RouteDefinition, RouteHandler, RouteMatch, RouteMatcher, RoutePath, Router, Routes, RoutesWithHandlerContext, SCHEMES_META, ScheduledJob, ServerOptions, SharedSegmentRoute, StreamContext, ToolDefinition, ToolInputSchema, ValidationFailure, ValidationStage, adapterContextOf, allowedMethodsForPath, assembleApi, authenticationChallenge, bearerChallenge, boundJobKeys, buildPath, buildToolDefinitions, buildToolInputSchema, callGuard, contractOf, createApiReference, createJobRunner, defineAdapter, defineJobTransport, definePlugin, describeTool, dispatchHandler, dispatchRoute, encodeStreamBody, entriesToObject, extractCredential, flattenJobs, flattenRoutes, formatValidationError, getHeaderValue, groupRoutes, guardDenyFor, headersToObject, insufficientScope, isCompiledJob, isGroupSet, isGuardDenial, isMalformedPath, isRawResponse, isRouteDefinition, isStreamResponse, jobAt, jobFnAt, jobRouter, jobRoutes, jobRunnerFrom, matchRoute, parseBodyText, parseFetchBody, parsePath, pluginExportsOf, pluginRouteTree, pluginRouterOf, pluginRoutesOf, problemDetails, rawResponse, renderJsonResult, requiresDenial, resolvePlugins, resolveSecurityRequirements, routerFromRoutes, runHandler, runRoute, selectToolRoutes, sharedSegmentRoute, sortFlattenedRoutes, toolInputJsonSchema, toolJsonSchema, toolOptionsOf, toolRefusal, validateRequest, warnUnsupportedJobOptions, withPermissions };
@@ -1,3 +1,3 @@
1
1
  import { A as AutoResponsesBrand, B as ROUTES_GROUP, D as AUTO_RESPONSES_BRAND, I as HANDLER_CONTEXT_BRAND, K as RouteDefinition, L as HandlerContextBrand, T as AUTO_GUARD_BRAND, W as ResponseHeaders, Y as RoutePath, Z as Routes, at as ProblemDetails, c as authenticationChallenge, f as resolveSecurityRequirements, st as problemDetails, z as Method } from "./error-response-NoOGdh8H.mjs";
2
- import { $ as jobRouter, $i as buildPath, $n as isCompiledJob, $r as SharedSegmentRoute, A as RenderedResult, Aa as insufficientScope, B as bearerChallenge, Bi as buildToolInputSchema, C as JOBS_META, Ci as ValidationFailure, D as REQUEST_CONTEXT_META, Di as formatValidationError, E as MountedOf, Ei as flattenRoutes, F as RouteMatcher, Fn as CompiledJob, G as dispatchHandler, Gi as toolOptionsOf, Gr as RawResponse, Gt as PluginExportValues, H as callGuard, Hi as selectToolRoutes, Ht as PluginArgs, I as SCHEMES_META, J as extractCredential, Jn as Jobs, K as dispatchRoute, Ki as toolRefusal, Kr as isRawResponse, Kt as PluginExportsOf, L as ServerOptions, Li as ToolDefinition, Ln as FlattenedJob, Lt as ApiPlugins, M as RequestContextRun, Ma as withPermissions, N as RequestPipeline, O as ROUTER_META, Oi as isRouteDefinition, P as ResponseValidationError, Q as isGuardDenial, Qn as flattenJobs, Qr as RouteMatch, R as adapterContextOf, Ri as ToolInputSchema, S as HandlerContextOf, Sr as defineJobTransport, T as MountArgsOf, Ti as allowedMethodsForPath, U as contractOf, Ui as toolInputJsonSchema, Ut as PluginDeclaration, V as boundJobKeys, Vi as describeTool, Vn as JobHandler, W as defineAdapter, Wi as toolJsonSchema, Wn as JobHandlers, Wr as isGroupSet, Wt as PluginDefinition, X as guardDenyFor, Xr as MatchResult, Xt as PluginRoutes, Y as getHeaderValue, Z as headersToObject, Zi as PathSegment, Zr as PathParamsResult, Zt as PluginRoutesOf, _ as GuardDeny, _i as RequestContextValues, a as AdapterRequest, ai as BrandedHandlerContext, an as definePlugin, ar as JobInputError, at as routerFromRoutes, b as HANDLER_ARG_KEYS, bi as Router, br as JobWorkerContext, c as ApiBrand, ct as warnUnsupportedJobOptions, d as DISPATCH_ROUTE_KEY, dr as createJobRunner, dt as groupRoutes, ea as parsePath, ei as isMalformedPath, et as jobRoutes, f as ErrorFormatter, fa as encodeStreamBody, fi as GuardedParamNames, fr as jobFnAt, ft as createApiReference, g as GuardDenialBody, gi as RawInputs, gr as JobTransport, gt as resolvePlugins, h as GuardDenial, hi as HandlersFromRoutes, hr as JobMessage, ht as pluginRoutesOf, i as AdapterDefinition, ir as JobFnByKey, it as renderJsonResult, j as RequestContextMap, ja as requiresDenial, k as RUN_ROUTE_KEY, ka as AccessCheckInput, ki as validateRequest, l as ApiParts, li as GuardParams, lr as JobRunner, lt as ApiRouter, m as GUARD_SCHEMA_META, mr as JobDispatchError, mt as pluginRouterOf, n as API_META, na as EncodeStreamOptions, ni as sharedSegmentRoute, nr as JobErrorHandler, nt as parseBodyText, o as AdapterResult, oi as ContextFromAuth, on as pluginRouteTree, ot as runHandler, p as GUARDS_META, pr as JobDescriptor, pt as pluginExportsOf, q as entriesToObject, qr as rawResponse, r as Adapter, ri as sortFlattenedRoutes, rt as parseFetchBody, s as AnyAdapter, sa as StreamContext, si as FlattenedRoute, st as runRoute, t as ADAPTER_CONTEXT, ti as matchRoute, tn as ResolvedPlugin, tr as jobAt, tt as jobRunnerFrom, u as ApiWithRouter, ur as JobRunnerOptions, ut as ResponseError, v as GuardMap, w as JobsMeta, wi as ValidationStage, x as HandleArgs, xi as RoutesWithHandlerContext, xr as ScheduledJob, y as GuardRun, yi as RouteHandler, yr as JobWorker, yt as isStreamResponse, z as assembleApi, zi as buildToolDefinitions } from "./adapter-sWK_DRbU.mjs";
2
+ import { $ as jobRouter, $i as buildPath, $n as isCompiledJob, $r as SharedSegmentRoute, A as RenderedResult, Aa as insufficientScope, B as bearerChallenge, Bi as buildToolInputSchema, C as JOBS_META, Ci as ValidationFailure, D as REQUEST_CONTEXT_META, Di as formatValidationError, E as MountedOf, Ei as flattenRoutes, F as RouteMatcher, Fn as CompiledJob, G as dispatchHandler, Gi as toolOptionsOf, Gr as RawResponse, Gt as PluginExportValues, H as callGuard, Hi as selectToolRoutes, Ht as PluginArgs, I as SCHEMES_META, J as extractCredential, Jn as Jobs, K as dispatchRoute, Ki as toolRefusal, Kr as isRawResponse, Kt as PluginExportsOf, L as ServerOptions, Li as ToolDefinition, Ln as FlattenedJob, Lt as ApiPlugins, M as RequestContextRun, Ma as withPermissions, N as RequestPipeline, O as ROUTER_META, Oi as isRouteDefinition, P as ResponseValidationError, Q as isGuardDenial, Qn as flattenJobs, Qr as RouteMatch, R as adapterContextOf, Ri as ToolInputSchema, S as HandlerContextOf, Sr as defineJobTransport, T as MountArgsOf, Ti as allowedMethodsForPath, U as contractOf, Ui as toolInputJsonSchema, Ut as PluginDeclaration, V as boundJobKeys, Vi as describeTool, Vn as JobHandler, W as defineAdapter, Wi as toolJsonSchema, Wn as JobHandlers, Wr as isGroupSet, Wt as PluginDefinition, X as guardDenyFor, Xr as MatchResult, Xt as PluginRoutes, Y as getHeaderValue, Z as headersToObject, Zi as PathSegment, Zr as PathParamsResult, Zt as PluginRoutesOf, _ as GuardDeny, _i as RequestContextValues, a as AdapterRequest, ai as BrandedHandlerContext, an as definePlugin, ar as JobInputError, at as routerFromRoutes, b as HANDLER_ARG_KEYS, bi as Router, br as JobWorkerContext, c as ApiBrand, ct as warnUnsupportedJobOptions, d as DISPATCH_ROUTE_KEY, dr as createJobRunner, dt as groupRoutes, ea as parsePath, ei as isMalformedPath, et as jobRoutes, f as ErrorFormatter, fa as encodeStreamBody, fi as GuardedParamNames, fr as jobFnAt, ft as createApiReference, g as GuardDenialBody, gi as RawInputs, gr as JobTransport, gt as resolvePlugins, h as GuardDenial, hi as HandlersFromRoutes, hr as JobMessage, ht as pluginRoutesOf, i as AdapterDefinition, ir as JobFnByKey, it as renderJsonResult, j as RequestContextMap, ja as requiresDenial, k as RUN_ROUTE_KEY, ka as AccessCheckInput, ki as validateRequest, l as ApiParts, li as GuardParams, lr as JobRunner, lt as ApiRouter, m as GUARD_SCHEMA_META, mr as JobDispatchError, mt as pluginRouterOf, n as API_META, na as EncodeStreamOptions, ni as sharedSegmentRoute, nr as JobErrorHandler, nt as parseBodyText, o as AdapterResult, oi as ContextFromAuth, on as pluginRouteTree, ot as runHandler, p as GUARDS_META, pr as JobDescriptor, pt as pluginExportsOf, q as entriesToObject, qr as rawResponse, r as Adapter, ri as sortFlattenedRoutes, rt as parseFetchBody, s as AnyAdapter, sa as StreamContext, si as FlattenedRoute, st as runRoute, t as ADAPTER_CONTEXT, ti as matchRoute, tn as ResolvedPlugin, tr as jobAt, tt as jobRunnerFrom, u as ApiWithRouter, ur as JobRunnerOptions, ut as ResponseError, v as GuardMap, w as JobsMeta, wi as ValidationStage, x as HandleArgs, xi as RoutesWithHandlerContext, xr as ScheduledJob, y as GuardRun, yi as RouteHandler, yr as JobWorker, yt as isStreamResponse, z as assembleApi, zi as buildToolDefinitions } from "./adapter-Co19yIKD.mjs";
3
3
  export { ADAPTER_CONTEXT, API_META, AUTO_GUARD_BRAND, AUTO_RESPONSES_BRAND, AccessCheckInput, Adapter, AdapterDefinition, AdapterRequest, AdapterResult, AnyAdapter, ApiBrand, ApiParts, ApiPlugins, ApiRouter, ApiWithRouter, AutoResponsesBrand, BrandedHandlerContext, CompiledJob, ContextFromAuth, DISPATCH_ROUTE_KEY, EncodeStreamOptions, ErrorFormatter, FlattenedJob, FlattenedRoute, GUARDS_META, GUARD_SCHEMA_META, GuardDenial, GuardDenialBody, GuardDeny, GuardMap, GuardParams, GuardRun, GuardedParamNames, HANDLER_ARG_KEYS, HANDLER_CONTEXT_BRAND, HandleArgs, HandlerContextBrand, HandlerContextOf, HandlersFromRoutes, JOBS_META, JobDescriptor, JobDispatchError, JobErrorHandler, JobFnByKey, JobHandler, JobHandlers, JobInputError, JobMessage, JobRunner, JobRunnerOptions, JobTransport, JobWorker, JobWorkerContext, Jobs, JobsMeta, MatchResult, Method, MountArgsOf, MountedOf, PathParamsResult, PathSegment, PluginArgs, PluginDeclaration, PluginDefinition, PluginExportValues, PluginExportsOf, PluginRoutes, PluginRoutesOf, ProblemDetails, REQUEST_CONTEXT_META, ROUTER_META, ROUTES_GROUP, RUN_ROUTE_KEY, RawInputs, RawResponse, RenderedResult, RequestContextMap, RequestContextRun, RequestContextValues, RequestPipeline, ResolvedPlugin, ResponseError, ResponseHeaders, ResponseValidationError, RouteDefinition, RouteHandler, RouteMatch, RouteMatcher, RoutePath, Router, Routes, RoutesWithHandlerContext, SCHEMES_META, ScheduledJob, ServerOptions, SharedSegmentRoute, StreamContext, ToolDefinition, ToolInputSchema, ValidationFailure, ValidationStage, adapterContextOf, allowedMethodsForPath, assembleApi, authenticationChallenge, bearerChallenge, boundJobKeys, buildPath, buildToolDefinitions, buildToolInputSchema, callGuard, contractOf, createApiReference, createJobRunner, defineAdapter, defineJobTransport, definePlugin, describeTool, dispatchHandler, dispatchRoute, encodeStreamBody, entriesToObject, extractCredential, flattenJobs, flattenRoutes, formatValidationError, getHeaderValue, groupRoutes, guardDenyFor, headersToObject, insufficientScope, isCompiledJob, isGroupSet, isGuardDenial, isMalformedPath, isRawResponse, isRouteDefinition, isStreamResponse, jobAt, jobFnAt, jobRouter, jobRoutes, jobRunnerFrom, matchRoute, parseBodyText, parseFetchBody, parsePath, pluginExportsOf, pluginRouteTree, pluginRouterOf, pluginRoutesOf, problemDetails, rawResponse, renderJsonResult, requiresDenial, resolvePlugins, resolveSecurityRequirements, routerFromRoutes, runHandler, runRoute, selectToolRoutes, sharedSegmentRoute, sortFlattenedRoutes, toolInputJsonSchema, toolJsonSchema, toolOptionsOf, toolRefusal, validateRequest, warnUnsupportedJobOptions, withPermissions };
package/dist/adapter.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as definePlugin, d as AUTO_RESPONSES_BRAND, g as ROUTES_GROUP, l as AUTO_GUARD_BRAND, m as HANDLER_CONTEXT_BRAND, o as pluginRouteTree } from "./plugin-xxCxibmu.mjs";
2
- import { P as encodeStreamBody, W as isStreamResponse, _ as jobAt, a as pluginRoutesOf, ct as parsePath, dt as formatValidationError, ft as isRouteDefinition, h as isCompiledJob, i as pluginRouterOf, lt as allowedMethodsForPath, m as flattenJobs, o as resolvePlugins, pt as validateRequest, r as pluginExportsOf, st as buildPath, t as createApiReference, ut as flattenRoutes } from "./plugin-server-D8XrYDQU.mjs";
2
+ import { P as encodeStreamBody, W as isStreamResponse, _ as jobAt, a as pluginRoutesOf, ct as parsePath, dt as formatValidationError, ft as isRouteDefinition, h as isCompiledJob, i as pluginRouterOf, lt as allowedMethodsForPath, m as flattenJobs, o as resolvePlugins, pt as validateRequest, r as pluginExportsOf, st as buildPath, t as createApiReference, ut as flattenRoutes } from "./plugin-server-l_eKX28n.mjs";
3
3
  import { l as authenticationChallenge, p as resolveSecurityRequirements } from "./schemas-DBX8DwFb.mjs";
4
- import { $ as jobFnAt, A as parseBodyText, At as toolOptionsOf, C as getHeaderValue, D as jobRouter, Dt as selectToolRoutes, E as isGuardDenial, Et as describeTool, F as runRoute, G as insufficientScope, H as matchRoute, I as warnUnsupportedJobOptions, J as JobDispatchError, K as requiresDenial, L as isRawResponse, M as renderJsonResult, N as routerFromRoutes, O as jobRoutes, Ot as toolInputJsonSchema, P as runHandler, Q as createJobRunner, R as rawResponse, S as extractCredential, T as headersToObject, Tt as buildToolInputSchema, U as sharedSegmentRoute, V as isMalformedPath, W as sortFlattenedRoutes, X as JobInputError, Y as defineJobTransport, _ as contractOf, a as HANDLER_ARG_KEYS, b as dispatchRoute, bt as groupRoutes, c as ROUTER_META, ct as problemDetails, d as SCHEMES_META, f as adapterContextOf, g as callGuard, h as boundJobKeys, i as GUARD_SCHEMA_META, j as parseFetchBody, jt as toolRefusal, k as jobRunnerFrom, kt as toolJsonSchema, l as RUN_ROUTE_KEY, m as bearerChallenge, n as DISPATCH_ROUTE_KEY, o as JOBS_META, p as assembleApi, q as withPermissions, r as GUARDS_META, s as REQUEST_CONTEXT_META, t as API_META, tt as ResponseError, u as ResponseValidationError, v as defineAdapter, vt as isGroupSet, w as guardDenyFor, wt as buildToolDefinitions, x as entriesToObject, y as dispatchHandler } from "./adapter-BuVQkVVh.mjs";
4
+ import { $ as jobFnAt, A as parseBodyText, At as toolOptionsOf, C as getHeaderValue, D as jobRouter, Dt as selectToolRoutes, E as isGuardDenial, Et as describeTool, F as runRoute, G as insufficientScope, H as matchRoute, I as warnUnsupportedJobOptions, J as JobDispatchError, K as requiresDenial, L as isRawResponse, M as renderJsonResult, N as routerFromRoutes, O as jobRoutes, Ot as toolInputJsonSchema, P as runHandler, Q as createJobRunner, R as rawResponse, S as extractCredential, T as headersToObject, Tt as buildToolInputSchema, U as sharedSegmentRoute, V as isMalformedPath, W as sortFlattenedRoutes, X as JobInputError, Y as defineJobTransport, _ as contractOf, a as HANDLER_ARG_KEYS, b as dispatchRoute, bt as groupRoutes, c as ROUTER_META, ct as problemDetails, d as SCHEMES_META, f as adapterContextOf, g as callGuard, h as boundJobKeys, i as GUARD_SCHEMA_META, j as parseFetchBody, jt as toolRefusal, k as jobRunnerFrom, kt as toolJsonSchema, l as RUN_ROUTE_KEY, m as bearerChallenge, n as DISPATCH_ROUTE_KEY, o as JOBS_META, p as assembleApi, q as withPermissions, r as GUARDS_META, s as REQUEST_CONTEXT_META, t as API_META, tt as ResponseError, u as ResponseValidationError, v as defineAdapter, vt as isGroupSet, w as guardDenyFor, wt as buildToolDefinitions, x as entriesToObject, y as dispatchHandler } from "./adapter-CcVfT9VP.mjs";
5
5
  export { API_META, AUTO_GUARD_BRAND, AUTO_RESPONSES_BRAND, DISPATCH_ROUTE_KEY, GUARDS_META, GUARD_SCHEMA_META, HANDLER_ARG_KEYS, HANDLER_CONTEXT_BRAND, JOBS_META, JobDispatchError, JobInputError, REQUEST_CONTEXT_META, ROUTER_META, ROUTES_GROUP, RUN_ROUTE_KEY, ResponseError, ResponseValidationError, SCHEMES_META, adapterContextOf, allowedMethodsForPath, assembleApi, authenticationChallenge, bearerChallenge, boundJobKeys, buildPath, buildToolDefinitions, buildToolInputSchema, callGuard, contractOf, createApiReference, createJobRunner, defineAdapter, defineJobTransport, definePlugin, describeTool, dispatchHandler, dispatchRoute, encodeStreamBody, entriesToObject, extractCredential, flattenJobs, flattenRoutes, formatValidationError, getHeaderValue, groupRoutes, guardDenyFor, headersToObject, insufficientScope, isCompiledJob, isGroupSet, isGuardDenial, isMalformedPath, isRawResponse, isRouteDefinition, isStreamResponse, jobAt, jobFnAt, jobRouter, jobRoutes, jobRunnerFrom, matchRoute, parseBodyText, parseFetchBody, parsePath, pluginExportsOf, pluginRouteTree, pluginRouterOf, pluginRoutesOf, problemDetails, rawResponse, renderJsonResult, requiresDenial, resolvePlugins, resolveSecurityRequirements, routerFromRoutes, runHandler, runRoute, selectToolRoutes, sharedSegmentRoute, sortFlattenedRoutes, toolInputJsonSchema, toolJsonSchema, toolOptionsOf, toolRefusal, validateRequest, warnUnsupportedJobOptions, withPermissions };
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_error_response = require("./error-response-DN5Dsf8b.cjs");
3
- const require_plugin_server = require("./plugin-server-tW5ZoOud.cjs");
3
+ const require_plugin_server = require("./plugin-server-6sIGS0RF.cjs");
4
4
  //#region src/generator.ts
5
5
  /**
6
6
  * Every route the api serves, the app's and the plugins' under their slugs,
@@ -1,5 +1,5 @@
1
1
  import { K as RouteDefinition, W as ResponseHeaders, Z as Routes, j as CachePolicy } from "./error-response-YbkRMKno.cjs";
2
- import { $n as isCompiledJob, At as sanitizeFieldName, Ct as mergeHeaderFields, Dt as resolveResponseEtag, En as ApiDefinition, Et as resolveResponseContentType, Fn as CompiledJob, Ft as toPascalCase, Jn as Jobs, Ln as FlattenedJob, Mt as shortTypeName, Nt as statusToCamelCase, Ot as resolveResponseHeaders, Pt as toCamelCase, Qn as flattenJobs, St as localTypeName, Tt as resolveResponseCache, _a as streamMode, _t as isHintPrefix, bt as isSuccessStatus, ea as parsePath, ga as streamContentType, ha as soleStreamResponse, jt as sanitizeIdentifier, kt as resolveResponseStream, ma as routeStreams, pa as isNamedStream, ta as EVENT_STREAM_MEDIA_TYPE, tr as jobAt, ua as StreamMode, va as streamSchemas, vt as isJsonMediaType, wn as GeneratedFile, wt as resolveResponseBody, xt as isZodSchema, ya as streamStatuses, yt as isStreamResponse } from "./adapter-Dq2kc8Jc.cjs";
2
+ import { $n as isCompiledJob, At as sanitizeFieldName, Ct as mergeHeaderFields, Dt as resolveResponseEtag, En as ApiDefinition, Et as resolveResponseContentType, Fn as CompiledJob, Ft as toPascalCase, Jn as Jobs, Ln as FlattenedJob, Mt as shortTypeName, Nt as statusToCamelCase, Ot as resolveResponseHeaders, Pt as toCamelCase, Qn as flattenJobs, St as localTypeName, Tt as resolveResponseCache, _a as streamMode, _t as isHintPrefix, bt as isSuccessStatus, ea as parsePath, ga as streamContentType, ha as soleStreamResponse, jt as sanitizeIdentifier, kt as resolveResponseStream, ma as routeStreams, pa as isNamedStream, ta as EVENT_STREAM_MEDIA_TYPE, tr as jobAt, ua as StreamMode, va as streamSchemas, vt as isJsonMediaType, wn as GeneratedFile, wt as resolveResponseBody, xt as isZodSchema, ya as streamStatuses, yt as isStreamResponse } from "./adapter-VoxBoXIp.cjs";
3
3
  import { z } from "zod";
4
4
 
5
5
  //#region src/zod-internals.d.ts
@@ -1,5 +1,5 @@
1
1
  import { K as RouteDefinition, W as ResponseHeaders, Z as Routes, j as CachePolicy } from "./error-response-NoOGdh8H.mjs";
2
- import { $n as isCompiledJob, At as sanitizeFieldName, Ct as mergeHeaderFields, Dt as resolveResponseEtag, En as ApiDefinition, Et as resolveResponseContentType, Fn as CompiledJob, Ft as toPascalCase, Jn as Jobs, Ln as FlattenedJob, Mt as shortTypeName, Nt as statusToCamelCase, Ot as resolveResponseHeaders, Pt as toCamelCase, Qn as flattenJobs, St as localTypeName, Tt as resolveResponseCache, _a as streamMode, _t as isHintPrefix, bt as isSuccessStatus, ea as parsePath, ga as streamContentType, ha as soleStreamResponse, jt as sanitizeIdentifier, kt as resolveResponseStream, ma as routeStreams, pa as isNamedStream, ta as EVENT_STREAM_MEDIA_TYPE, tr as jobAt, ua as StreamMode, va as streamSchemas, vt as isJsonMediaType, wn as GeneratedFile, wt as resolveResponseBody, xt as isZodSchema, ya as streamStatuses, yt as isStreamResponse } from "./adapter-sWK_DRbU.mjs";
2
+ import { $n as isCompiledJob, At as sanitizeFieldName, Ct as mergeHeaderFields, Dt as resolveResponseEtag, En as ApiDefinition, Et as resolveResponseContentType, Fn as CompiledJob, Ft as toPascalCase, Jn as Jobs, Ln as FlattenedJob, Mt as shortTypeName, Nt as statusToCamelCase, Ot as resolveResponseHeaders, Pt as toCamelCase, Qn as flattenJobs, St as localTypeName, Tt as resolveResponseCache, _a as streamMode, _t as isHintPrefix, bt as isSuccessStatus, ea as parsePath, ga as streamContentType, ha as soleStreamResponse, jt as sanitizeIdentifier, kt as resolveResponseStream, ma as routeStreams, pa as isNamedStream, ta as EVENT_STREAM_MEDIA_TYPE, tr as jobAt, ua as StreamMode, va as streamSchemas, vt as isJsonMediaType, wn as GeneratedFile, wt as resolveResponseBody, xt as isZodSchema, ya as streamStatuses, yt as isStreamResponse } from "./adapter-Co19yIKD.mjs";
3
3
  import { z } from "zod";
4
4
 
5
5
  //#region src/zod-internals.d.ts
@@ -1,5 +1,5 @@
1
1
  import { C as readMetaExamples, E as readObjectShape, O as unwrapOptionalWrappers, S as readMetaDescription, T as readModelSchema, _ as readDiscriminatedUnion, b as readMeta, c as isBinarySchema, d as isIntegerSchema, f as isObjectSchema, g as readDeprecation, h as readDefType, i as FILE_PROBE, l as isDiscriminatedUnionSchema, m as readDef, p as isVoidSchema, s as globalRegistrySchemas, u as isFileSchema, v as readDiscriminatorLiteral, w as readMetaId, x as readMetaBrand, y as readDiscriminatorStringLiteral } from "./error-response-D7urgxeq.mjs";
2
- import { $ as resolveResponseHeaders, A as deriveToolNames, B as streamSchemas, F as isNamedStream, G as isSuccessStatus, H as isHintPrefix, I as routeStreams, J as mergeHeaderFields, K as isZodSchema, L as soleStreamResponse, M as EVENT_STREAM_MEDIA_TYPE, Q as resolveResponseEtag, R as streamContentType, U as isJsonMediaType, V as streamStatuses, W as isStreamResponse, X as resolveResponseCache, Y as resolveResponseBody, Z as resolveResponseContentType, _ as jobAt, a as pluginRoutesOf, at as toCamelCase, c as cacheHeaders, ct as parsePath, et as resolveResponseStream, ft as isRouteDefinition, h as isCompiledJob, it as statusToCamelCase, j as toToolName, k as encodeForWire, m as flattenJobs, n as describeIssue, nt as sanitizeIdentifier, ot as toPascalCase, q as localTypeName, rt as shortTypeName, tt as sanitizeFieldName, u as deprecationHeaders, ut as flattenRoutes, z as streamMode } from "./plugin-server-D8XrYDQU.mjs";
2
+ import { $ as resolveResponseHeaders, A as deriveToolNames, B as streamSchemas, F as isNamedStream, G as isSuccessStatus, H as isHintPrefix, I as routeStreams, J as mergeHeaderFields, K as isZodSchema, L as soleStreamResponse, M as EVENT_STREAM_MEDIA_TYPE, Q as resolveResponseEtag, R as streamContentType, U as isJsonMediaType, V as streamStatuses, W as isStreamResponse, X as resolveResponseCache, Y as resolveResponseBody, Z as resolveResponseContentType, _ as jobAt, a as pluginRoutesOf, at as toCamelCase, c as cacheHeaders, ct as parsePath, et as resolveResponseStream, ft as isRouteDefinition, h as isCompiledJob, it as statusToCamelCase, j as toToolName, k as encodeForWire, m as flattenJobs, n as describeIssue, nt as sanitizeIdentifier, ot as toPascalCase, q as localTypeName, rt as shortTypeName, tt as sanitizeFieldName, u as deprecationHeaders, ut as flattenRoutes, z as streamMode } from "./plugin-server-l_eKX28n.mjs";
3
3
  //#region src/generator.ts
4
4
  /**
5
5
  * Every route the api serves, the app's and the plugins' under their slugs,
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_plugin = require("./plugin-Dw-yCjTY.cjs");
3
3
  const require_error_response = require("./error-response-DN5Dsf8b.cjs");
4
- const require_plugin_server = require("./plugin-server-tW5ZoOud.cjs");
4
+ const require_plugin_server = require("./plugin-server-6sIGS0RF.cjs");
5
5
  const require_schemas = require("./schemas-Bre1FVHq.cjs");
6
- const require_adapter = require("./adapter-CVPTNiOM.cjs");
6
+ const require_adapter = require("./adapter-BcRUajrL.cjs");
7
7
  let zod = require("zod");
8
8
  //#region src/group-routes.ts
9
9
  /**
@@ -645,7 +645,7 @@ const defineConfig = (options) => {
645
645
  const api = buildApi(contract, {
646
646
  guards,
647
647
  requestContext: handlersOf(options.requestContext, RESOLVER),
648
- jobTransport: options.jobRunner?.transport,
648
+ jobTransport: options.jobRunner?.transport || void 0,
649
649
  onJobError: options.jobRunner?.onError
650
650
  }, options.adapter);
651
651
  apiReference.bind(api);
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { $ as SecurityRequirement, A as AutoResponsesBrand, B as ROUTES_GROUP, C as isPermissions, D as AUTO_RESPONSES_BRAND, E as AUTO_GUARD_WRITTEN_BRAND, F as HANDLER, G as RouteAuth, H as ResponseContentType, I as HANDLER_CONTEXT_BRAND, J as RouteHiddenToolCheck, K as RouteDefinition, L as HandlerContextBrand, M as DECLARATION, N as DeclarationKind, O as AuthoredRouteDefinition, P as GuardStatus, Q as SchemeNameOf, R as METHODS, S as createRoles, T as AUTO_GUARD_BRAND, U as ResponseDefinition, V as RequiredPermissions, X as RouteToolOptions, Y as RoutePath, Z as Routes, _ as PermissionSet, a as OAuthFlows, at as ProblemDetails, b as RoleNamesOf, ct as problemFromBody, d as isSecurityScheme, et as StreamDefinition, g as PermissionName, h as PermissionCatalog, i as OAuthFlow, it as GuardSchemaCheck, j as CachePolicy, k as AuthoredRoutes, l as authorizationServerIssuer, lt as STATUS_TITLES, m as GrantNamesOf, n as isProblemDetails, nt as GuardBody, o as OpenApiSecuritySchemeObject, ot as StripProblemEnvelope, p as CatalogOf, q as RouteHandlerFunction, r as ContextOf, rt as GuardOutput, s as SecurityScheme, st as problemDetails, tt as StreamResponseDefinition, u as declaredScopes, ut as getStatusText, v as Permissions, w as isRoles, x as Roles, y as RoleDefinition, z as Method } from "./error-response-YbkRMKno.cjs";
2
- import { $i as buildPath, $n as isCompiledJob, $t as PluginSetupContext, Ai as ModelToolCall, An as RequestContextOf, Ar as nextRuns, Ba as CredentialOf, Bn as JobDefinition, Br as GroupPathsOf, Ca as ToolError, Cn as DiffSettings, Cr as JobSchedule, Da as expandStreamTools, Dn as ApiPluginsOf, Dr as dueSchedules, E as MountedOf, Ea as ToolResult, En as ApiDefinition, Er as cron, Fa as BasicConfig, Fi as ToolRunOptions, Fn as CompiledJob, Fr as RequestContextHeaderInputs, Ga as IdentityParamsOf, Gn as JobResponses, Gt as PluginExportValues, Ha as GrantsOf, Hn as JobHandlerArgs, Hr as ResolvedGroup, Ht as PluginArgs, Ia as BasicCredential, Ii as ToolRunResult, In as CompiledJobs, Ir as RequestContextHeaderValues, It as AnyPlugin, Ja as OAuth2Config, Ji as HasPathParams, Jn as Jobs, Jr as RouteBuilder, Jt as PluginList, Ka as IdentityRole, Kn as JobRunnerConfig, Kt as PluginExportsOf, La as BearerConfig, Li as ToolDefinition, Ln as FlattenedJob, Lr as RequestContextSchema, Lt as ApiPlugins, Mi as ToolAnswer, Mn as SchemesOf, Mr as scheduleExpression, Na as ApiKeyConfig, Ni as ToolEventYield, Nn as AuthoredJobDefinition, Nr as scheduleTimezone, Oa as toolEvents, Oi as isRouteDefinition, On as GuardSchemaOf, Or as firesBetween, Pa as ApiKeyCredential, Pi as ToolRunCall, Pn as AuthoredJobs, Pr as RequestContextConfig, Qi as RoutePathParamsCheck, Qn as flattenJobs, Qt as PluginSetup, Ra as BearerCredential, Rn as HttpJobsConfig, Rr as GroupOptions, Sa as ToolCall, Si as ThrowableReturn, Sn as ApiEntry, Sr as defineJobTransport, T as MountArgsOf, Ta as ToolKeys, Tn as apiEntries, Tr as assertValidSchedule, Ua as GuardHoldings, Un as JobHandlerReturn, Ur as createGroups, Ut as PluginDeclaration, Va as CustomConfig, Vn as JobHandler, Vr as GroupSet, Vt as PluginApi, Wa as Identity, Wn as JobHandlers, Wt as PluginDefinition, Xa as RoleOf, Xi as PathParamsCheck, Xn as JobsConfig, Xt as PluginRoutes, Y as getHeaderValue, Ya as OpenIdConnectConfig, Yi as PathParamName, Yn as JobsArg, Yr as RouteWithHandler, Za as RolesOf, Zn as NoJobs, Zt as PluginRoutesOf, _ as GuardDeny, _a as streamMode, _n as ConfiguredRequestContext, _r as JobTransportDefinition, aa as StreamChunk, ai as BrandedHandlerContext, an as definePlugin, ar as JobInputError, ba as StreamWithTools, bn as JobsOfTree, br as JobWorkerContext, ca as StreamMessage, ci as GuardAnswer, cr as JobRunArgs, da as StreamYield, di as GuardSuccess, dn as ConfiguredCodes, dr as createJobRunner, ea as parsePath, en as PluginsBySlug, er as isJobDefinition, fn as ConfiguredGroups, fr as jobFnAt, ga as streamContentType, gn as ConfiguredPlugins, gr as JobTransport, h as GuardDenial, ha as soleStreamResponse, hn as ConfiguredJobs, hr as JobMessage, ia as StreamBodyOf, ii as AuthContextOf, ir as JobFnByKey, ji as StreamTools, jn as RoutesOf, jr as parseCron, kn as JobsOf, kr as nextRun, la as StreamMessageOf, ln as ConfiguredAdapterContext, lr as JobRunner, ma as routeStreams, mi as HandlerReturn, mn as ConfiguredIdentities, mr as JobDispatchError, nr as JobErrorHandler, oa as StreamComment, oi as ContextFromAuth, or as JobQueueArgs, pa as isNamedStream, pi as HandlerArgs, pn as ConfiguredGuardSchema, pr as JobDescriptor, qa as NoCredential, qi as ExtractPathParams, qn as JobVoidReturn, qt as PluginFactory, ra as StreamBody, rr as JobFn, s as AnyAdapter, sa as StreamContext, sr as JobQueueOptions, ta as EVENT_STREAM_MEDIA_TYPE, tr as jobAt, u as ApiWithRouter, ua as StreamMode, ui as GuardReturn, un as ConfiguredAdapterValue, ur as JobRunnerOptions, ut as ResponseError, vi as RouteGuardBrandOf, vn as ConfiguredRequestContextSchemas, vr as JobTransportSupports, wa as ToolEvents, wn as GeneratedFile, wr as ParsedCron, xa as ToolAt, xi as RoutesWithHandlerContext, xn as KizunaConfigShape, xr as ScheduledJob, xt as isZodSchema, ya as streamStatuses, yn as JobFnOf, yr as JobWorker, yt as isStreamResponse, za as Credential, zn as InProcessJobsConfig, zr as GroupPaths } from "./adapter-Dq2kc8Jc.cjs";
2
+ import { $i as buildPath, $n as isCompiledJob, $t as PluginSetupContext, Ai as ModelToolCall, An as RequestContextOf, Ar as nextRuns, Ba as CredentialOf, Bn as JobDefinition, Br as GroupPathsOf, Ca as ToolError, Cn as DiffSettings, Cr as JobSchedule, Da as expandStreamTools, Dn as ApiPluginsOf, Dr as dueSchedules, E as MountedOf, Ea as ToolResult, En as ApiDefinition, Er as cron, Fa as BasicConfig, Fi as ToolRunOptions, Fn as CompiledJob, Fr as RequestContextHeaderInputs, Ga as IdentityParamsOf, Gn as JobResponses, Gt as PluginExportValues, Ha as GrantsOf, Hn as JobHandlerArgs, Hr as ResolvedGroup, Ht as PluginArgs, Ia as BasicCredential, Ii as ToolRunResult, In as CompiledJobs, Ir as RequestContextHeaderValues, It as AnyPlugin, Ja as OAuth2Config, Ji as HasPathParams, Jn as Jobs, Jr as RouteBuilder, Jt as PluginList, Ka as IdentityRole, Kn as JobRunnerConfig, Kt as PluginExportsOf, La as BearerConfig, Li as ToolDefinition, Ln as FlattenedJob, Lr as RequestContextSchema, Lt as ApiPlugins, Mi as ToolAnswer, Mn as SchemesOf, Mr as scheduleExpression, Na as ApiKeyConfig, Ni as ToolEventYield, Nn as AuthoredJobDefinition, Nr as scheduleTimezone, Oa as toolEvents, Oi as isRouteDefinition, On as GuardSchemaOf, Or as firesBetween, Pa as ApiKeyCredential, Pi as ToolRunCall, Pn as AuthoredJobs, Pr as RequestContextConfig, Qi as RoutePathParamsCheck, Qn as flattenJobs, Qt as PluginSetup, Ra as BearerCredential, Rn as HttpJobsConfig, Rr as GroupOptions, Sa as ToolCall, Si as ThrowableReturn, Sn as ApiEntry, Sr as defineJobTransport, T as MountArgsOf, Ta as ToolKeys, Tn as apiEntries, Tr as assertValidSchedule, Ua as GuardHoldings, Un as JobHandlerReturn, Ur as createGroups, Ut as PluginDeclaration, Va as CustomConfig, Vn as JobHandler, Vr as GroupSet, Vt as PluginApi, Wa as Identity, Wn as JobHandlers, Wt as PluginDefinition, Xa as RoleOf, Xi as PathParamsCheck, Xn as JobsConfig, Xt as PluginRoutes, Y as getHeaderValue, Ya as OpenIdConnectConfig, Yi as PathParamName, Yn as JobsArg, Yr as RouteWithHandler, Za as RolesOf, Zn as NoJobs, Zt as PluginRoutesOf, _ as GuardDeny, _a as streamMode, _n as ConfiguredRequestContext, _r as JobTransportDefinition, aa as StreamChunk, ai as BrandedHandlerContext, an as definePlugin, ar as JobInputError, ba as StreamWithTools, bn as JobsOfTree, br as JobWorkerContext, ca as StreamMessage, ci as GuardAnswer, cr as JobRunArgs, da as StreamYield, di as GuardSuccess, dn as ConfiguredCodes, dr as createJobRunner, ea as parsePath, en as PluginsBySlug, er as isJobDefinition, fn as ConfiguredGroups, fr as jobFnAt, ga as streamContentType, gn as ConfiguredPlugins, gr as JobTransport, h as GuardDenial, ha as soleStreamResponse, hn as ConfiguredJobs, hr as JobMessage, ia as StreamBodyOf, ii as AuthContextOf, ir as JobFnByKey, ji as StreamTools, jn as RoutesOf, jr as parseCron, kn as JobsOf, kr as nextRun, la as StreamMessageOf, ln as ConfiguredAdapterContext, lr as JobRunner, ma as routeStreams, mi as HandlerReturn, mn as ConfiguredIdentities, mr as JobDispatchError, nr as JobErrorHandler, oa as StreamComment, oi as ContextFromAuth, or as JobQueueArgs, pa as isNamedStream, pi as HandlerArgs, pn as ConfiguredGuardSchema, pr as JobDescriptor, qa as NoCredential, qi as ExtractPathParams, qn as JobVoidReturn, qt as PluginFactory, ra as StreamBody, rr as JobFn, s as AnyAdapter, sa as StreamContext, sr as JobQueueOptions, ta as EVENT_STREAM_MEDIA_TYPE, tr as jobAt, u as ApiWithRouter, ua as StreamMode, ui as GuardReturn, un as ConfiguredAdapterValue, ur as JobRunnerOptions, ut as ResponseError, vi as RouteGuardBrandOf, vn as ConfiguredRequestContextSchemas, vr as JobTransportSupports, wa as ToolEvents, wn as GeneratedFile, wr as ParsedCron, xa as ToolAt, xi as RoutesWithHandlerContext, xn as KizunaConfigShape, xr as ScheduledJob, xt as isZodSchema, ya as streamStatuses, yn as JobFnOf, yr as JobWorker, yt as isStreamResponse, za as Credential, zn as InProcessJobsConfig, zr as GroupPaths } from "./adapter-VoxBoXIp.cjs";
3
3
  import { a as buildProtectedResourceMetadata, c as ValidationErrorFor, d as isValidationError, i as assertCanonicalResourceUri, n as ProtectedResourceMetadata, o as BuiltinIssueCode, s as ValidationError, t as ProtectedResourceConfig, u as ValidationIssueCode } from "./protected-resource-metadata-B9hMFQ9N.cjs";
4
4
  import { z } from "zod";
5
5
  import { $input, $output } from "zod/v4/core";
@@ -906,9 +906,9 @@ type JobRunnerInput<J extends Jobs> = string extends keyof J ? {
906
906
  jobRunner?: JobRunnerConfig;
907
907
  } : {
908
908
  /**
909
- * How this deployment runs the jobs it declares: over HTTP or in
910
- * process, what carries queued work out of the process, and where a
911
- * failure is reported. The jobs themselves are declared with
909
+ * How this deployment runs the jobs it declares: over HTTP or from a
910
+ * long-running server, what carries queued work out of the process,
911
+ * and where a failure is reported. The jobs themselves are declared with
912
912
  * `k.jobs` and go under `jobs`.
913
913
  */
914
914
  jobRunner: JobRunnerConfig;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { $ as SecurityRequirement, A as AutoResponsesBrand, B as ROUTES_GROUP, C as isPermissions, D as AUTO_RESPONSES_BRAND, E as AUTO_GUARD_WRITTEN_BRAND, F as HANDLER, G as RouteAuth, H as ResponseContentType, I as HANDLER_CONTEXT_BRAND, J as RouteHiddenToolCheck, K as RouteDefinition, L as HandlerContextBrand, M as DECLARATION, N as DeclarationKind, O as AuthoredRouteDefinition, P as GuardStatus, Q as SchemeNameOf, R as METHODS, S as createRoles, T as AUTO_GUARD_BRAND, U as ResponseDefinition, V as RequiredPermissions, X as RouteToolOptions, Y as RoutePath, Z as Routes, _ as PermissionSet, a as OAuthFlows, at as ProblemDetails, b as RoleNamesOf, ct as problemFromBody, d as isSecurityScheme, et as StreamDefinition, g as PermissionName, h as PermissionCatalog, i as OAuthFlow, it as GuardSchemaCheck, j as CachePolicy, k as AuthoredRoutes, l as authorizationServerIssuer, lt as STATUS_TITLES, m as GrantNamesOf, n as isProblemDetails, nt as GuardBody, o as OpenApiSecuritySchemeObject, ot as StripProblemEnvelope, p as CatalogOf, q as RouteHandlerFunction, r as ContextOf, rt as GuardOutput, s as SecurityScheme, st as problemDetails, tt as StreamResponseDefinition, u as declaredScopes, ut as getStatusText, v as Permissions, w as isRoles, x as Roles, y as RoleDefinition, z as Method } from "./error-response-NoOGdh8H.mjs";
2
- import { $i as buildPath, $n as isCompiledJob, $t as PluginSetupContext, Ai as ModelToolCall, An as RequestContextOf, Ar as nextRuns, Ba as CredentialOf, Bn as JobDefinition, Br as GroupPathsOf, Ca as ToolError, Cn as DiffSettings, Cr as JobSchedule, Da as expandStreamTools, Dn as ApiPluginsOf, Dr as dueSchedules, E as MountedOf, Ea as ToolResult, En as ApiDefinition, Er as cron, Fa as BasicConfig, Fi as ToolRunOptions, Fn as CompiledJob, Fr as RequestContextHeaderInputs, Ga as IdentityParamsOf, Gn as JobResponses, Gt as PluginExportValues, Ha as GrantsOf, Hn as JobHandlerArgs, Hr as ResolvedGroup, Ht as PluginArgs, Ia as BasicCredential, Ii as ToolRunResult, In as CompiledJobs, Ir as RequestContextHeaderValues, It as AnyPlugin, Ja as OAuth2Config, Ji as HasPathParams, Jn as Jobs, Jr as RouteBuilder, Jt as PluginList, Ka as IdentityRole, Kn as JobRunnerConfig, Kt as PluginExportsOf, La as BearerConfig, Li as ToolDefinition, Ln as FlattenedJob, Lr as RequestContextSchema, Lt as ApiPlugins, Mi as ToolAnswer, Mn as SchemesOf, Mr as scheduleExpression, Na as ApiKeyConfig, Ni as ToolEventYield, Nn as AuthoredJobDefinition, Nr as scheduleTimezone, Oa as toolEvents, Oi as isRouteDefinition, On as GuardSchemaOf, Or as firesBetween, Pa as ApiKeyCredential, Pi as ToolRunCall, Pn as AuthoredJobs, Pr as RequestContextConfig, Qi as RoutePathParamsCheck, Qn as flattenJobs, Qt as PluginSetup, Ra as BearerCredential, Rn as HttpJobsConfig, Rr as GroupOptions, Sa as ToolCall, Si as ThrowableReturn, Sn as ApiEntry, Sr as defineJobTransport, T as MountArgsOf, Ta as ToolKeys, Tn as apiEntries, Tr as assertValidSchedule, Ua as GuardHoldings, Un as JobHandlerReturn, Ur as createGroups, Ut as PluginDeclaration, Va as CustomConfig, Vn as JobHandler, Vr as GroupSet, Vt as PluginApi, Wa as Identity, Wn as JobHandlers, Wt as PluginDefinition, Xa as RoleOf, Xi as PathParamsCheck, Xn as JobsConfig, Xt as PluginRoutes, Y as getHeaderValue, Ya as OpenIdConnectConfig, Yi as PathParamName, Yn as JobsArg, Yr as RouteWithHandler, Za as RolesOf, Zn as NoJobs, Zt as PluginRoutesOf, _ as GuardDeny, _a as streamMode, _n as ConfiguredRequestContext, _r as JobTransportDefinition, aa as StreamChunk, ai as BrandedHandlerContext, an as definePlugin, ar as JobInputError, ba as StreamWithTools, bn as JobsOfTree, br as JobWorkerContext, ca as StreamMessage, ci as GuardAnswer, cr as JobRunArgs, da as StreamYield, di as GuardSuccess, dn as ConfiguredCodes, dr as createJobRunner, ea as parsePath, en as PluginsBySlug, er as isJobDefinition, fn as ConfiguredGroups, fr as jobFnAt, ga as streamContentType, gn as ConfiguredPlugins, gr as JobTransport, h as GuardDenial, ha as soleStreamResponse, hn as ConfiguredJobs, hr as JobMessage, ia as StreamBodyOf, ii as AuthContextOf, ir as JobFnByKey, ji as StreamTools, jn as RoutesOf, jr as parseCron, kn as JobsOf, kr as nextRun, la as StreamMessageOf, ln as ConfiguredAdapterContext, lr as JobRunner, ma as routeStreams, mi as HandlerReturn, mn as ConfiguredIdentities, mr as JobDispatchError, nr as JobErrorHandler, oa as StreamComment, oi as ContextFromAuth, or as JobQueueArgs, pa as isNamedStream, pi as HandlerArgs, pn as ConfiguredGuardSchema, pr as JobDescriptor, qa as NoCredential, qi as ExtractPathParams, qn as JobVoidReturn, qt as PluginFactory, ra as StreamBody, rr as JobFn, s as AnyAdapter, sa as StreamContext, sr as JobQueueOptions, ta as EVENT_STREAM_MEDIA_TYPE, tr as jobAt, u as ApiWithRouter, ua as StreamMode, ui as GuardReturn, un as ConfiguredAdapterValue, ur as JobRunnerOptions, ut as ResponseError, vi as RouteGuardBrandOf, vn as ConfiguredRequestContextSchemas, vr as JobTransportSupports, wa as ToolEvents, wn as GeneratedFile, wr as ParsedCron, xa as ToolAt, xi as RoutesWithHandlerContext, xn as KizunaConfigShape, xr as ScheduledJob, xt as isZodSchema, ya as streamStatuses, yn as JobFnOf, yr as JobWorker, yt as isStreamResponse, za as Credential, zn as InProcessJobsConfig, zr as GroupPaths } from "./adapter-sWK_DRbU.mjs";
2
+ import { $i as buildPath, $n as isCompiledJob, $t as PluginSetupContext, Ai as ModelToolCall, An as RequestContextOf, Ar as nextRuns, Ba as CredentialOf, Bn as JobDefinition, Br as GroupPathsOf, Ca as ToolError, Cn as DiffSettings, Cr as JobSchedule, Da as expandStreamTools, Dn as ApiPluginsOf, Dr as dueSchedules, E as MountedOf, Ea as ToolResult, En as ApiDefinition, Er as cron, Fa as BasicConfig, Fi as ToolRunOptions, Fn as CompiledJob, Fr as RequestContextHeaderInputs, Ga as IdentityParamsOf, Gn as JobResponses, Gt as PluginExportValues, Ha as GrantsOf, Hn as JobHandlerArgs, Hr as ResolvedGroup, Ht as PluginArgs, Ia as BasicCredential, Ii as ToolRunResult, In as CompiledJobs, Ir as RequestContextHeaderValues, It as AnyPlugin, Ja as OAuth2Config, Ji as HasPathParams, Jn as Jobs, Jr as RouteBuilder, Jt as PluginList, Ka as IdentityRole, Kn as JobRunnerConfig, Kt as PluginExportsOf, La as BearerConfig, Li as ToolDefinition, Ln as FlattenedJob, Lr as RequestContextSchema, Lt as ApiPlugins, Mi as ToolAnswer, Mn as SchemesOf, Mr as scheduleExpression, Na as ApiKeyConfig, Ni as ToolEventYield, Nn as AuthoredJobDefinition, Nr as scheduleTimezone, Oa as toolEvents, Oi as isRouteDefinition, On as GuardSchemaOf, Or as firesBetween, Pa as ApiKeyCredential, Pi as ToolRunCall, Pn as AuthoredJobs, Pr as RequestContextConfig, Qi as RoutePathParamsCheck, Qn as flattenJobs, Qt as PluginSetup, Ra as BearerCredential, Rn as HttpJobsConfig, Rr as GroupOptions, Sa as ToolCall, Si as ThrowableReturn, Sn as ApiEntry, Sr as defineJobTransport, T as MountArgsOf, Ta as ToolKeys, Tn as apiEntries, Tr as assertValidSchedule, Ua as GuardHoldings, Un as JobHandlerReturn, Ur as createGroups, Ut as PluginDeclaration, Va as CustomConfig, Vn as JobHandler, Vr as GroupSet, Vt as PluginApi, Wa as Identity, Wn as JobHandlers, Wt as PluginDefinition, Xa as RoleOf, Xi as PathParamsCheck, Xn as JobsConfig, Xt as PluginRoutes, Y as getHeaderValue, Ya as OpenIdConnectConfig, Yi as PathParamName, Yn as JobsArg, Yr as RouteWithHandler, Za as RolesOf, Zn as NoJobs, Zt as PluginRoutesOf, _ as GuardDeny, _a as streamMode, _n as ConfiguredRequestContext, _r as JobTransportDefinition, aa as StreamChunk, ai as BrandedHandlerContext, an as definePlugin, ar as JobInputError, ba as StreamWithTools, bn as JobsOfTree, br as JobWorkerContext, ca as StreamMessage, ci as GuardAnswer, cr as JobRunArgs, da as StreamYield, di as GuardSuccess, dn as ConfiguredCodes, dr as createJobRunner, ea as parsePath, en as PluginsBySlug, er as isJobDefinition, fn as ConfiguredGroups, fr as jobFnAt, ga as streamContentType, gn as ConfiguredPlugins, gr as JobTransport, h as GuardDenial, ha as soleStreamResponse, hn as ConfiguredJobs, hr as JobMessage, ia as StreamBodyOf, ii as AuthContextOf, ir as JobFnByKey, ji as StreamTools, jn as RoutesOf, jr as parseCron, kn as JobsOf, kr as nextRun, la as StreamMessageOf, ln as ConfiguredAdapterContext, lr as JobRunner, ma as routeStreams, mi as HandlerReturn, mn as ConfiguredIdentities, mr as JobDispatchError, nr as JobErrorHandler, oa as StreamComment, oi as ContextFromAuth, or as JobQueueArgs, pa as isNamedStream, pi as HandlerArgs, pn as ConfiguredGuardSchema, pr as JobDescriptor, qa as NoCredential, qi as ExtractPathParams, qn as JobVoidReturn, qt as PluginFactory, ra as StreamBody, rr as JobFn, s as AnyAdapter, sa as StreamContext, sr as JobQueueOptions, ta as EVENT_STREAM_MEDIA_TYPE, tr as jobAt, u as ApiWithRouter, ua as StreamMode, ui as GuardReturn, un as ConfiguredAdapterValue, ur as JobRunnerOptions, ut as ResponseError, vi as RouteGuardBrandOf, vn as ConfiguredRequestContextSchemas, vr as JobTransportSupports, wa as ToolEvents, wn as GeneratedFile, wr as ParsedCron, xa as ToolAt, xi as RoutesWithHandlerContext, xn as KizunaConfigShape, xr as ScheduledJob, xt as isZodSchema, ya as streamStatuses, yn as JobFnOf, yr as JobWorker, yt as isStreamResponse, za as Credential, zn as InProcessJobsConfig, zr as GroupPaths } from "./adapter-Co19yIKD.mjs";
3
3
  import { a as buildProtectedResourceMetadata, c as ValidationErrorFor, d as isValidationError, i as assertCanonicalResourceUri, n as ProtectedResourceMetadata, o as BuiltinIssueCode, s as ValidationError, t as ProtectedResourceConfig, u as ValidationIssueCode } from "./protected-resource-metadata-CfBVsqIk.mjs";
4
4
  import { z } from "zod";
5
5
  import { $input, $output } from "zod/v4/core";
@@ -906,9 +906,9 @@ type JobRunnerInput<J extends Jobs> = string extends keyof J ? {
906
906
  jobRunner?: JobRunnerConfig;
907
907
  } : {
908
908
  /**
909
- * How this deployment runs the jobs it declares: over HTTP or in
910
- * process, what carries queued work out of the process, and where a
911
- * failure is reported. The jobs themselves are declared with
909
+ * How this deployment runs the jobs it declares: over HTTP or from a
910
+ * long-running server, what carries queued work out of the process,
911
+ * and where a failure is reported. The jobs themselves are declared with
912
912
  * `k.jobs` and go under `jobs`.
913
913
  */
914
914
  jobRunner: JobRunnerConfig;
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { a as definePlugin, c as createRoute, d as AUTO_RESPONSES_BRAND, f as DECLARATION, g as ROUTES_GROUP, h as METHODS, l as AUTO_GUARD_BRAND, m as HANDLER_CONTEXT_BRAND, o as pluginRouteTree, p as HANDLER, u as AUTO_GUARD_WRITTEN_BRAND } from "./plugin-xxCxibmu.mjs";
2
2
  import { E as readObjectShape, m as readDef, n as isProblemDetails, r as createModel, t as ProblemDetailsSchema } from "./error-response-D7urgxeq.mjs";
3
- import { C as firesBetween, D as scheduleExpression, E as parseCron, F as isNamedStream, I as routeStreams, K as isZodSchema, L as soleStreamResponse, M as EVENT_STREAM_MEDIA_TYPE, O as scheduleTimezone, R as streamContentType, S as dueSchedules, T as nextRuns, V as streamStatuses, W as isStreamResponse, Y as resolveResponseBody, _ as jobAt, b as assertValidSchedule, ct as parsePath, f as assertJobRunner, ft as isRouteDefinition, g as isJobDefinition, h as isCompiledJob, l as assertValidDeprecationDates, m as flattenJobs, o as resolvePlugins, p as buildJobs, r as pluginExportsOf, s as assertValidCache, st as buildPath, t as createApiReference, ut as flattenRoutes, v as jobClaims, w as nextRun, x as cron, z as streamMode } from "./plugin-server-D8XrYDQU.mjs";
3
+ import { C as firesBetween, D as scheduleExpression, E as parseCron, F as isNamedStream, I as routeStreams, K as isZodSchema, L as soleStreamResponse, M as EVENT_STREAM_MEDIA_TYPE, O as scheduleTimezone, R as streamContentType, S as dueSchedules, T as nextRuns, V as streamStatuses, W as isStreamResponse, Y as resolveResponseBody, _ as jobAt, b as assertValidSchedule, ct as parsePath, f as assertJobRunner, ft as isRouteDefinition, g as isJobDefinition, h as isCompiledJob, l as assertValidDeprecationDates, m as flattenJobs, o as resolvePlugins, p as buildJobs, r as pluginExportsOf, s as assertValidCache, st as buildPath, t as createApiReference, ut as flattenRoutes, v as jobClaims, w as nextRun, x as cron, z as streamMode } from "./plugin-server-l_eKX28n.mjs";
4
4
  import { a as assertCanonicalResourceUri, c as isValidationError, d as declaredScopes, f as isSecurityScheme, l as authenticationChallenge, o as buildProtectedResourceMetadata, p as resolveSecurityRequirements, u as authorizationServerIssuer } from "./schemas-DBX8DwFb.mjs";
5
- import { $ as jobFnAt, B as routeClaims, C as getHeaderValue, Ct as toolEvents, I as warnUnsupportedJobOptions, J as JobDispatchError, N as routerFromRoutes, Q as createJobRunner, St as streamToolsOf, X as JobInputError, Y as defineJobTransport, _t as createGroups, at as dispatchSucceeded, bt as groupRoutes, ct as problemDetails, dt as getStatusText, ft as createPermissions, gt as permissionNames, ht as isRoles, it as dispatchDueJobs, lt as problemFromBody, mt as isPermissions, nt as DispatchFailedSchema, o as JOBS_META, ot as dueJobs, p as assembleApi, pt as createRoles, rt as DispatchResultSchema, st as failedJobs, tt as ResponseError, ut as STATUS_TITLES, xt as expandStreamTools, yt as assembleRoutes, z as assertNoPathCollisions } from "./adapter-BuVQkVVh.mjs";
5
+ import { $ as jobFnAt, B as routeClaims, C as getHeaderValue, Ct as toolEvents, I as warnUnsupportedJobOptions, J as JobDispatchError, N as routerFromRoutes, Q as createJobRunner, St as streamToolsOf, X as JobInputError, Y as defineJobTransport, _t as createGroups, at as dispatchSucceeded, bt as groupRoutes, ct as problemDetails, dt as getStatusText, ft as createPermissions, gt as permissionNames, ht as isRoles, it as dispatchDueJobs, lt as problemFromBody, mt as isPermissions, nt as DispatchFailedSchema, o as JOBS_META, ot as dueJobs, p as assembleApi, pt as createRoles, rt as DispatchResultSchema, st as failedJobs, tt as ResponseError, ut as STATUS_TITLES, xt as expandStreamTools, yt as assembleRoutes, z as assertNoPathCollisions } from "./adapter-CcVfT9VP.mjs";
6
6
  import { z } from "zod";
7
7
  //#region src/group-routes.ts
8
8
  /**
@@ -644,7 +644,7 @@ const defineConfig = (options) => {
644
644
  const api = buildApi(contract, {
645
645
  guards,
646
646
  requestContext: handlersOf(options.requestContext, RESOLVER),
647
- jobTransport: options.jobRunner?.transport,
647
+ jobTransport: options.jobRunner?.transport || void 0,
648
648
  onJobError: options.jobRunner?.onError
649
649
  }, options.adapter);
650
650
  apiReference.bind(api);
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_plugin_server = require("./plugin-server-tW5ZoOud.cjs");
3
- const require_adapter = require("./adapter-CVPTNiOM.cjs");
2
+ const require_plugin_server = require("./plugin-server-6sIGS0RF.cjs");
3
+ const require_adapter = require("./adapter-BcRUajrL.cjs");
4
4
  //#region src/start-jobs.ts
5
5
  /**
6
6
  * The dedupe key an occurrence gets. Every instance ticking the same minute
@@ -138,7 +138,7 @@ const stripTrailingSlash = (url) => url.endsWith("/") ? url.slice(0, -1) : url;
138
138
  * Tick the dispatch endpoint over the network on an interval, so `pnpm dev`
139
139
  * exercises the same request your platform cron will make in production.
140
140
  *
141
- * Reach for `startJobs` instead when you schedule in-process: it reads each job's
141
+ * Reach for `startJobs` instead on a long-running server: it reads each job's
142
142
  * own schedule rather than ticking on a fixed interval.
143
143
  *
144
144
  * @example
@@ -152,7 +152,7 @@ const stripTrailingSlash = (url) => url.endsWith("/") ? url.slice(0, -1) : url;
152
152
  const startJobsDevRunner = (contract, options) => {
153
153
  const logger = options.logger ?? console;
154
154
  if (process.env.NODE_ENV === "production") logger.warn("[kizuna/schedule] startJobsDevRunner is running with NODE_ENV=production. It ticks on an interval held in memory, so any tick during a restart or deploy is missed silently. Use your platform scheduler in production.");
155
- if (contract.jobsConfig?.mode === "in-process") throw new Error("[kizuna/schedule] startJobsDevRunner ticks the dispatch endpoint, which `mode: 'in-process'` does not serve. Run the schedules in this process with `startJobs` instead.");
155
+ if (contract.jobsConfig?.mode === "long-running") throw new Error("[kizuna/schedule] startJobsDevRunner ticks the dispatch endpoint, which `mode: 'long-running'` does not serve. Run the schedules in this process with `startJobs` instead.");
156
156
  const method = contract.jobsConfig?.method ?? "POST";
157
157
  const path = `${options.basePath ?? ""}${contract.jobsConfig?.path ?? "/jobs"}/dispatch`;
158
158
  const url = `${stripTrailingSlash(options.baseUrl)}${path}`;
@@ -1,4 +1,4 @@
1
- import { En as ApiDefinition, yr as JobWorker } from "./adapter-Dq2kc8Jc.cjs";
1
+ import { En as ApiDefinition, yr as JobWorker } from "./adapter-VoxBoXIp.cjs";
2
2
 
3
3
  //#region src/start-jobs.d.ts
4
4
  interface StartJobsOptions {
@@ -137,7 +137,7 @@ interface JobsDevRunner {
137
137
  * Tick the dispatch endpoint over the network on an interval, so `pnpm dev`
138
138
  * exercises the same request your platform cron will make in production.
139
139
  *
140
- * Reach for `startJobs` instead when you schedule in-process: it reads each job's
140
+ * Reach for `startJobs` instead on a long-running server: it reads each job's
141
141
  * own schedule rather than ticking on a fixed interval.
142
142
  *
143
143
  * @example
@@ -1,4 +1,4 @@
1
- import { En as ApiDefinition, yr as JobWorker } from "./adapter-sWK_DRbU.mjs";
1
+ import { En as ApiDefinition, yr as JobWorker } from "./adapter-Co19yIKD.mjs";
2
2
 
3
3
  //#region src/start-jobs.d.ts
4
4
  interface StartJobsOptions {
@@ -137,7 +137,7 @@ interface JobsDevRunner {
137
137
  * Tick the dispatch endpoint over the network on an interval, so `pnpm dev`
138
138
  * exercises the same request your platform cron will make in production.
139
139
  *
140
- * Reach for `startJobs` instead when you schedule in-process: it reads each job's
140
+ * Reach for `startJobs` instead on a long-running server: it reads each job's
141
141
  * own schedule rather than ticking on a fixed interval.
142
142
  *
143
143
  * @example
@@ -1,5 +1,5 @@
1
- import { D as scheduleExpression, O as scheduleTimezone, m as flattenJobs, w as nextRun } from "./plugin-server-D8XrYDQU.mjs";
2
- import { $ as jobFnAt, Z as attemptJob, et as waitUntil, h as boundJobKeys, k as jobRunnerFrom, o as JOBS_META } from "./adapter-BuVQkVVh.mjs";
1
+ import { D as scheduleExpression, O as scheduleTimezone, m as flattenJobs, w as nextRun } from "./plugin-server-l_eKX28n.mjs";
2
+ import { $ as jobFnAt, Z as attemptJob, et as waitUntil, h as boundJobKeys, k as jobRunnerFrom, o as JOBS_META } from "./adapter-CcVfT9VP.mjs";
3
3
  //#region src/start-jobs.ts
4
4
  /**
5
5
  * The dedupe key an occurrence gets. Every instance ticking the same minute
@@ -137,7 +137,7 @@ const stripTrailingSlash = (url) => url.endsWith("/") ? url.slice(0, -1) : url;
137
137
  * Tick the dispatch endpoint over the network on an interval, so `pnpm dev`
138
138
  * exercises the same request your platform cron will make in production.
139
139
  *
140
- * Reach for `startJobs` instead when you schedule in-process: it reads each job's
140
+ * Reach for `startJobs` instead on a long-running server: it reads each job's
141
141
  * own schedule rather than ticking on a fixed interval.
142
142
  *
143
143
  * @example
@@ -151,7 +151,7 @@ const stripTrailingSlash = (url) => url.endsWith("/") ? url.slice(0, -1) : url;
151
151
  const startJobsDevRunner = (contract, options) => {
152
152
  const logger = options.logger ?? console;
153
153
  if (process.env.NODE_ENV === "production") logger.warn("[kizuna/schedule] startJobsDevRunner is running with NODE_ENV=production. It ticks on an interval held in memory, so any tick during a restart or deploy is missed silently. Use your platform scheduler in production.");
154
- if (contract.jobsConfig?.mode === "in-process") throw new Error("[kizuna/schedule] startJobsDevRunner ticks the dispatch endpoint, which `mode: 'in-process'` does not serve. Run the schedules in this process with `startJobs` instead.");
154
+ if (contract.jobsConfig?.mode === "long-running") throw new Error("[kizuna/schedule] startJobsDevRunner ticks the dispatch endpoint, which `mode: 'long-running'` does not serve. Run the schedules in this process with `startJobs` instead.");
155
155
  const method = contract.jobsConfig?.method ?? "POST";
156
156
  const path = `${options.basePath ?? ""}${contract.jobsConfig?.path ?? "/jobs"}/dispatch`;
157
157
  const url = `${stripTrailingSlash(options.baseUrl)}${path}`;
@@ -1090,13 +1090,14 @@ const isCompiledJob = (value) => {
1090
1090
  const assertJobRunner = (jobs, config) => {
1091
1091
  const flattened = jobs ? flattenJobs(jobs) : [];
1092
1092
  if (flattened.length === 0) return;
1093
- if (config?.mode === void 0) throw new Error("The jobs do not say how they run. Set `jobRunner: { mode: 'http' }` to serve `/jobs/dispatch` and `/jobs/run`, or `jobRunner: { mode: 'in-process' }` when `startJobs` ticks them in this process.");
1094
- if (config.mode === "in-process" || flattened.some(({ job }) => job.identity !== void 0)) return;
1093
+ if (config?.mode === void 0) throw new Error("The jobs do not say how they run. Set `jobRunner: { mode: 'http' }` to serve `/jobs/dispatch` and `/jobs/run`, or `jobRunner: { mode: 'long-running' }` when `startJobs` ticks them in this process.");
1094
+ if (config.transport === void 0) throw new Error("The jobs do not say where queued work goes. Set `jobRunner.transport` to a transport, such as `pgmqTransport({ pool })`, or to `false` to run a queued job in this process and lose it on a crash.");
1095
+ if (config.mode === "long-running" || flattened.some(({ job }) => job.identity !== void 0)) return;
1095
1096
  const base = config.path ?? "/jobs";
1096
- throw new Error(`The jobs declare no identity, so \`${base}/dispatch\` and \`${base}/run\` would let anyone trigger them. Pass an identity to \`k.jobs\`, or set \`jobRunner: { mode: 'in-process' }\` when the jobs run in this process with \`startJobs\`.`);
1097
+ throw new Error(`The jobs declare no identity, so \`${base}/dispatch\` and \`${base}/run\` would let anyone trigger them. Pass an identity to \`k.jobs\`, or set \`jobRunner: { mode: 'long-running' }\` when the jobs run in this process with \`startJobs\`.`);
1097
1098
  };
1098
1099
  const jobClaims = (jobs, config) => {
1099
- if (!jobs || config?.mode === "in-process" || flattenJobs(jobs).length === 0) return [];
1100
+ if (!jobs || config?.mode === "long-running" || flattenJobs(jobs).length === 0) return [];
1100
1101
  const base = config?.path ?? "/jobs";
1101
1102
  return [{
1102
1103
  method: config?.method ?? "POST",
@@ -1090,13 +1090,14 @@ const isCompiledJob = (value) => {
1090
1090
  const assertJobRunner = (jobs, config) => {
1091
1091
  const flattened = jobs ? flattenJobs(jobs) : [];
1092
1092
  if (flattened.length === 0) return;
1093
- if (config?.mode === void 0) throw new Error("The jobs do not say how they run. Set `jobRunner: { mode: 'http' }` to serve `/jobs/dispatch` and `/jobs/run`, or `jobRunner: { mode: 'in-process' }` when `startJobs` ticks them in this process.");
1094
- if (config.mode === "in-process" || flattened.some(({ job }) => job.identity !== void 0)) return;
1093
+ if (config?.mode === void 0) throw new Error("The jobs do not say how they run. Set `jobRunner: { mode: 'http' }` to serve `/jobs/dispatch` and `/jobs/run`, or `jobRunner: { mode: 'long-running' }` when `startJobs` ticks them in this process.");
1094
+ if (config.transport === void 0) throw new Error("The jobs do not say where queued work goes. Set `jobRunner.transport` to a transport, such as `pgmqTransport({ pool })`, or to `false` to run a queued job in this process and lose it on a crash.");
1095
+ if (config.mode === "long-running" || flattened.some(({ job }) => job.identity !== void 0)) return;
1095
1096
  const base = config.path ?? "/jobs";
1096
- throw new Error(`The jobs declare no identity, so \`${base}/dispatch\` and \`${base}/run\` would let anyone trigger them. Pass an identity to \`k.jobs\`, or set \`jobRunner: { mode: 'in-process' }\` when the jobs run in this process with \`startJobs\`.`);
1097
+ throw new Error(`The jobs declare no identity, so \`${base}/dispatch\` and \`${base}/run\` would let anyone trigger them. Pass an identity to \`k.jobs\`, or set \`jobRunner: { mode: 'long-running' }\` when the jobs run in this process with \`startJobs\`.`);
1097
1098
  };
1098
1099
  const jobClaims = (jobs, config) => {
1099
- if (!jobs || config?.mode === "in-process" || flattenJobs(jobs).length === 0) return [];
1100
+ if (!jobs || config?.mode === "long-running" || flattenJobs(jobs).length === 0) return [];
1100
1101
  const base = config?.path ?? "/jobs";
1101
1102
  return [{
1102
1103
  method: config?.method ?? "POST",
package/dist/plugin.d.cts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { Y as RoutePath } from "./error-response-YbkRMKno.cjs";
2
- import { $t as PluginSetupContext, Bt as PLUGIN_SERVERS_META_KEY, Gt as PluginExportValues, Ht as PluginArgs, It as AnyPlugin, Jt as PluginList, Kt as PluginExportsOf, Lt as ApiPlugins, Qt as PluginSetup, Rt as InstallOptions, Ut as PluginDeclaration, Vt as PluginApi, Wt as PluginDefinition, Xt as PluginRoutes, Yt as PluginRouteBuilder, Zt as PluginRoutesOf, an as definePlugin, cn as ApiContext, en as PluginsBySlug, in as SlugOption, nn as RouteAuthSchema, on as pluginRouteTree, qt as PluginFactory, rn as RoutePathSchema, sn as route, tn as ResolvedPlugin, zt as PLUGIN_ROUTES_META_KEY } from "./adapter-Dq2kc8Jc.cjs";
2
+ import { $t as PluginSetupContext, Bt as PLUGIN_SERVERS_META_KEY, Gt as PluginExportValues, Ht as PluginArgs, It as AnyPlugin, Jt as PluginList, Kt as PluginExportsOf, Lt as ApiPlugins, Qt as PluginSetup, Rt as InstallOptions, Ut as PluginDeclaration, Vt as PluginApi, Wt as PluginDefinition, Xt as PluginRoutes, Yt as PluginRouteBuilder, Zt as PluginRoutesOf, an as definePlugin, cn as ApiContext, en as PluginsBySlug, in as SlugOption, nn as RouteAuthSchema, on as pluginRouteTree, qt as PluginFactory, rn as RoutePathSchema, sn as route, tn as ResolvedPlugin, zt as PLUGIN_ROUTES_META_KEY } from "./adapter-VoxBoXIp.cjs";
3
3
  export { AnyPlugin, ApiContext, ApiPlugins, InstallOptions, PLUGIN_ROUTES_META_KEY, PLUGIN_SERVERS_META_KEY, PluginApi, PluginArgs, PluginDeclaration, PluginDefinition, PluginExportValues, PluginExportsOf, PluginFactory, PluginList, PluginRouteBuilder, PluginRoutes, PluginRoutesOf, PluginSetup, PluginSetupContext, PluginsBySlug, ResolvedPlugin, RouteAuthSchema, RoutePath, RoutePathSchema, SlugOption, definePlugin, pluginRouteTree, route };
package/dist/plugin.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { Y as RoutePath } from "./error-response-NoOGdh8H.mjs";
2
- import { $t as PluginSetupContext, Bt as PLUGIN_SERVERS_META_KEY, Gt as PluginExportValues, Ht as PluginArgs, It as AnyPlugin, Jt as PluginList, Kt as PluginExportsOf, Lt as ApiPlugins, Qt as PluginSetup, Rt as InstallOptions, Ut as PluginDeclaration, Vt as PluginApi, Wt as PluginDefinition, Xt as PluginRoutes, Yt as PluginRouteBuilder, Zt as PluginRoutesOf, an as definePlugin, cn as ApiContext, en as PluginsBySlug, in as SlugOption, nn as RouteAuthSchema, on as pluginRouteTree, qt as PluginFactory, rn as RoutePathSchema, sn as route, tn as ResolvedPlugin, zt as PLUGIN_ROUTES_META_KEY } from "./adapter-sWK_DRbU.mjs";
2
+ import { $t as PluginSetupContext, Bt as PLUGIN_SERVERS_META_KEY, Gt as PluginExportValues, Ht as PluginArgs, It as AnyPlugin, Jt as PluginList, Kt as PluginExportsOf, Lt as ApiPlugins, Qt as PluginSetup, Rt as InstallOptions, Ut as PluginDeclaration, Vt as PluginApi, Wt as PluginDefinition, Xt as PluginRoutes, Yt as PluginRouteBuilder, Zt as PluginRoutesOf, an as definePlugin, cn as ApiContext, en as PluginsBySlug, in as SlugOption, nn as RouteAuthSchema, on as pluginRouteTree, qt as PluginFactory, rn as RoutePathSchema, sn as route, tn as ResolvedPlugin, zt as PLUGIN_ROUTES_META_KEY } from "./adapter-Co19yIKD.mjs";
3
3
  export { AnyPlugin, ApiContext, ApiPlugins, InstallOptions, PLUGIN_ROUTES_META_KEY, PLUGIN_SERVERS_META_KEY, PluginApi, PluginArgs, PluginDeclaration, PluginDefinition, PluginExportValues, PluginExportsOf, PluginFactory, PluginList, PluginRouteBuilder, PluginRoutes, PluginRoutesOf, PluginSetup, PluginSetupContext, PluginsBySlug, ResolvedPlugin, RouteAuthSchema, RoutePath, RoutePathSchema, SlugOption, definePlugin, pluginRouteTree, route };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kizunajs",
3
- "version": "2.0.0-beta.31",
3
+ "version": "2.0.0-beta.32",
4
4
  "description": "Route declaration, validation, and the adapter API for Kizuna.js",
5
5
  "keywords": [
6
6
  "kizunajs",
package/src/adapter.ts CHANGED
@@ -386,10 +386,10 @@ export const assembleApi = <const R extends Routes>(
386
386
 
387
387
  /**
388
388
  * The endpoints jobs are served on, in the {@link Routes} shape the request
389
- * pipeline takes. None when the jobs run in process.
389
+ * pipeline takes. None in `'long-running'` mode.
390
390
  */
391
391
  export const jobRoutes = (meta: JobsMeta): Routes =>
392
- meta.config?.mode === 'in-process'
392
+ meta.config?.mode === 'long-running'
393
393
  ? {}
394
394
  : {
395
395
  [DISPATCH_ROUTE_KEY]: dispatchRoute(meta),
@@ -487,8 +487,8 @@ export const warnUnsupportedJobOptions = (
487
487
  const named = retrying.map((jobKey) => `"${jobKey}"`).join(', ');
488
488
  if (!transport) {
489
489
  logger.warn(
490
- `[kizuna] ${named} declare \`retry\`, but no transport is configured, so a failed run is not retried. ` +
491
- 'Pass one as `jobRunner.transport` in `kizuna.config.ts` to make retrying real.'
490
+ `[kizuna] ${named} declare \`retry\`, but \`jobRunner.transport\` is \`false\`, so a failed run is not retried. ` +
491
+ 'Pass a transport in `kizuna.config.ts` to make retrying real.'
492
492
  );
493
493
  return;
494
494
  }
@@ -289,9 +289,9 @@ type JobRunnerInput<J extends Jobs> = string extends keyof J
289
289
  }
290
290
  : {
291
291
  /**
292
- * How this deployment runs the jobs it declares: over HTTP or in
293
- * process, what carries queued work out of the process, and where a
294
- * failure is reported. The jobs themselves are declared with
292
+ * How this deployment runs the jobs it declares: over HTTP or from a
293
+ * long-running server, what carries queued work out of the process,
294
+ * and where a failure is reported. The jobs themselves are declared with
295
295
  * `k.jobs` and go under `jobs`.
296
296
  */
297
297
  jobRunner: JobRunnerConfig;
@@ -469,7 +469,7 @@ export const defineConfig = <
469
469
  {
470
470
  guards,
471
471
  requestContext: handlersOf(options.requestContext as Record<string, unknown> | undefined, RESOLVER),
472
- jobTransport: options.jobRunner?.transport,
472
+ jobTransport: options.jobRunner?.transport || undefined,
473
473
  onJobError: options.jobRunner?.onError,
474
474
  },
475
475
  options.adapter
package/src/job-runner.ts CHANGED
@@ -51,8 +51,8 @@ export interface JobFn<Job extends CompiledJob> {
51
51
  */
52
52
  run: (...args: JobRunArgs<Job>) => Promise<JobHandlerReturn<Job['definition']>>;
53
53
  /**
54
- * Put the job in line and answer without waiting for it. With no transport
55
- * configured the job runs in this process and is lost on a crash.
54
+ * Put the job in line and answer without waiting for it. With
55
+ * `transport: false` the job runs in this process and is lost on a crash.
56
56
  */
57
57
  queue: (...args: JobQueueArgs<Job>) => Promise<void>;
58
58
  }
@@ -86,7 +86,7 @@ export class JobInputError extends Error {
86
86
 
87
87
  /**
88
88
  * Called for every failed run of a job that no caller awaits: one a worker,
89
- * `/jobs/dispatch` or `/jobs/run` ran, or one queued without a transport. A
89
+ * `/jobs/dispatch` or `/jobs/run` ran, or one queued with `transport: false`. A
90
90
  * run fails when its handler throws or answers a status of 400 or more, which
91
91
  * arrives as a `ResponseError`. Without one, the failure is logged.
92
92
  */
@@ -49,7 +49,7 @@ const stripTrailingSlash = (url: string): string => (url.endsWith('/') ? url.sli
49
49
  * Tick the dispatch endpoint over the network on an interval, so `pnpm dev`
50
50
  * exercises the same request your platform cron will make in production.
51
51
  *
52
- * Reach for `startJobs` instead when you schedule in-process: it reads each job's
52
+ * Reach for `startJobs` instead on a long-running server: it reads each job's
53
53
  * own schedule rather than ticking on a fixed interval.
54
54
  *
55
55
  * @example
@@ -70,9 +70,9 @@ export const startJobsDevRunner = (contract: ApiDefinition, options: JobsDevRunn
70
70
  );
71
71
  }
72
72
 
73
- if (contract.jobsConfig?.mode === 'in-process') {
73
+ if (contract.jobsConfig?.mode === 'long-running') {
74
74
  throw new Error(
75
- "[kizuna/schedule] startJobsDevRunner ticks the dispatch endpoint, which `mode: 'in-process'` does not serve. " +
75
+ "[kizuna/schedule] startJobsDevRunner ticks the dispatch endpoint, which `mode: 'long-running'` does not serve. " +
76
76
  'Run the schedules in this process with `startJobs` instead.'
77
77
  );
78
78
  }
package/src/jobs.ts CHANGED
@@ -26,7 +26,7 @@ export type JobsConfig = HttpJobsConfig | InProcessJobsConfig;
26
26
  export interface HttpJobsConfig {
27
27
  /**
28
28
  * `'http'` serves `/jobs/dispatch` and `/jobs/run`, guarded by the jobs'
29
- * identity. `'in-process'` is for a long-running server whose schedules
29
+ * identity. `'long-running'` is for a long-running server whose schedules
30
30
  * `startJobs` ticks, and serves neither.
31
31
  */
32
32
  mode: 'http';
@@ -65,7 +65,7 @@ export interface HttpJobsConfig {
65
65
  * No job endpoint is served, so the jobs need no identity.
66
66
  */
67
67
  export interface InProcessJobsConfig {
68
- mode: 'in-process';
68
+ mode: 'long-running';
69
69
  path?: never;
70
70
  method?: never;
71
71
  windowMs?: never;
@@ -86,14 +86,15 @@ export type JobRunnerConfig = JobsConfig & JobDeliveryConfig;
86
86
  */
87
87
  export interface JobDeliveryConfig {
88
88
  /**
89
- * Carries a queued job to whatever runs it. Without one, `queue` runs the
90
- * job in this process and it is lost on a crash.
89
+ * Carries a queued job to whatever runs it. `false` runs a queued job in
90
+ * this process, without waiting for it, and loses it on a crash or a
91
+ * serverless freeze.
91
92
  */
92
- transport?: JobTransport;
93
+ transport: JobTransport | false;
93
94
  /**
94
95
  * Reached by every failed run no caller awaits, from a worker,
95
- * `/jobs/dispatch`, `/jobs/run`, or `queue` without a transport. Called once
96
- * per attempt.
96
+ * `/jobs/dispatch`, `/jobs/run`, or `queue` with `transport: false`. Called
97
+ * once per attempt.
97
98
  */
98
99
  onError?: JobErrorHandler;
99
100
  }
@@ -439,25 +440,31 @@ export const isCompiledJob = (value: unknown): value is CompiledJob => {
439
440
  * Throw when declared jobs do not say how they run, or when the job endpoints
440
441
  * would be served with no identity guarding them.
441
442
  */
442
- export const assertJobRunner = (jobs: Jobs | undefined, config: JobsConfig | undefined): void => {
443
+ export const assertJobRunner = (jobs: Jobs | undefined, config: JobRunnerConfig | undefined): void => {
443
444
  const flattened = jobs ? flattenJobs(jobs) : [];
444
445
  if (flattened.length === 0) return;
445
446
  if (config?.mode === undefined) {
446
447
  throw new Error(
447
448
  "The jobs do not say how they run. Set `jobRunner: { mode: 'http' }` to serve `/jobs/dispatch` and `/jobs/run`, " +
448
- "or `jobRunner: { mode: 'in-process' }` when `startJobs` ticks them in this process."
449
+ "or `jobRunner: { mode: 'long-running' }` when `startJobs` ticks them in this process."
449
450
  );
450
451
  }
451
- if (config.mode === 'in-process' || flattened.some(({ job }) => job.identity !== undefined)) return;
452
+ if (config.transport === undefined) {
453
+ throw new Error(
454
+ 'The jobs do not say where queued work goes. Set `jobRunner.transport` to a transport, such as `pgmqTransport({ pool })`, ' +
455
+ 'or to `false` to run a queued job in this process and lose it on a crash.'
456
+ );
457
+ }
458
+ if (config.mode === 'long-running' || flattened.some(({ job }) => job.identity !== undefined)) return;
452
459
  const base = config.path ?? DEFAULT_JOBS_PATH;
453
460
  throw new Error(
454
461
  `The jobs declare no identity, so \`${base}/dispatch\` and \`${base}/run\` would let anyone trigger them. ` +
455
- "Pass an identity to `k.jobs`, or set `jobRunner: { mode: 'in-process' }` when the jobs run in this process with `startJobs`."
462
+ "Pass an identity to `k.jobs`, or set `jobRunner: { mode: 'long-running' }` when the jobs run in this process with `startJobs`."
456
463
  );
457
464
  };
458
465
 
459
466
  export const jobClaims = (jobs: Jobs | undefined, config: JobsConfig | undefined): PathClaim[] => {
460
- if (!jobs || config?.mode === 'in-process' || flattenJobs(jobs).length === 0) return [];
467
+ if (!jobs || config?.mode === 'long-running' || flattenJobs(jobs).length === 0) return [];
461
468
  const base = config?.path ?? DEFAULT_JOBS_PATH;
462
469
  return [
463
470
  {