kizunajs 2.0.0-beta.2 → 2.0.0-beta.3

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?color=blue&label=npm)](https://www.npmjs.com/package/kizunajs)
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.3)
8
8
  ![license](https://img.shields.io/badge/license-MIT-blue)
9
9
 
10
10
  [Documentation](https://kizunajs.com)
@@ -1,7 +1,7 @@
1
- const require_cache = require("./cache-BgohRj0i.cjs");
2
- const require_error_response = require("./error-response-C8Ragjcd.cjs");
1
+ const require_cache = require("./cache-CBeqj4jU.cjs");
2
+ const require_error_response = require("./error-response-Dn5Ci5UP.cjs");
3
3
  const require_plugin = require("./plugin.cjs");
4
- const require_schemas = require("./schemas-C56no6bv.cjs");
4
+ const require_schemas = require("./schemas-CMu98wp_.cjs");
5
5
  let zod = require("zod");
6
6
  //#region src/tags.ts
7
7
  const isTagSet = (value) => typeof value === "object" && value !== null && "__brand" in value && value.__brand === "TagSet";
@@ -1,7 +1,7 @@
1
- import { $ as allowedMethodsForPath, A as streamSchemas, B as resolveResponseCache, C as assertValidStreams, F as isSuccessStatus, H as resolveResponseEtag, I as isZodSchema, N as isJsonMediaType, O as streamContentType, P as isStreamResponse, Q as parsePath, S as EVENT_STREAM_MEDIA_TYPE, V as resolveResponseContentType, c as isCompiledJob, et as flattenRoutes, f as toJobResponse, ft as ROUTES_TAG, h as dueSchedules, i as deprecationHeaders, it as resolveCoercionPlans, lt as HANDLER, n as cacheHeaders, nt as isRouteDefinition, rt as validateRequest, s as flattenJobs, tt as formatValidationError, u as jobAt, w as encodeStreamBody, z as resolveResponseBody } from "./cache-CLN5y0Xp.mjs";
2
- import { T as resolveBaseType, c as isBinarySchema, o as findCoercedSchemaPath, p as isVoidSchema, t as ProblemDetailsSchema, w as readObjectShape } from "./error-response-C839d8By.mjs";
1
+ import { $ as allowedMethodsForPath, A as streamSchemas, B as resolveResponseCache, C as assertValidStreams, F as isSuccessStatus, H as resolveResponseEtag, I as isZodSchema, N as isJsonMediaType, O as streamContentType, P as isStreamResponse, Q as parsePath, S as EVENT_STREAM_MEDIA_TYPE, V as resolveResponseContentType, c as isCompiledJob, et as flattenRoutes, f as toJobResponse, ft as ROUTES_TAG, h as dueSchedules, i as deprecationHeaders, it as resolveCoercionPlans, lt as HANDLER, n as cacheHeaders, nt as isRouteDefinition, rt as validateRequest, s as flattenJobs, tt as formatValidationError, u as jobAt, w as encodeStreamBody, z as resolveResponseBody } from "./cache-mysim62l.mjs";
2
+ import { T as resolveBaseType, c as isBinarySchema, o as findCoercedSchemaPath, p as isVoidSchema, t as ProblemDetailsSchema, w as readObjectShape } from "./error-response-rsiMhmJP.mjs";
3
3
  import { PLUGIN_ROUTES_META_KEY, PLUGIN_SERVERS_META_KEY, pluginRouteTree } from "./plugin.mjs";
4
- import { c as authenticationChallenge, f as resolveSecurityRequirements } from "./schemas-CJQcc97N.mjs";
4
+ import { c as authenticationChallenge, f as resolveSecurityRequirements } from "./schemas-BNhOeOTR.mjs";
5
5
  import { z } from "zod";
6
6
  //#region src/tags.ts
7
7
  const isTagSet = (value) => typeof value === "object" && value !== null && "__brand" in value && value.__brand === "TagSet";
package/dist/adapter.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_cache = require("./cache-BgohRj0i.cjs");
3
- const require_adapter = require("./adapter-DDR_yo9L.cjs");
2
+ const require_cache = require("./cache-CBeqj4jU.cjs");
3
+ const require_adapter = require("./adapter-B-4BBluY.cjs");
4
4
  const require_plugin = require("./plugin.cjs");
5
- const require_schemas = require("./schemas-C56no6bv.cjs");
5
+ const require_schemas = require("./schemas-CMu98wp_.cjs");
6
6
  exports.API_META = require_adapter.API_META;
7
7
  exports.AUTO_GUARD_BRAND = require_cache.AUTO_GUARD_BRAND;
8
8
  exports.AUTO_RESPONSES_BRAND = require_cache.AUTO_RESPONSES_BRAND;
package/dist/adapter.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as allowedMethodsForPath, P as isStreamResponse, Q as parsePath, Z as buildPath, at as AUTO_GUARD_BRAND, c as isCompiledJob, et as flattenRoutes, ft as ROUTES_TAG, nt as isRouteDefinition, rt as validateRequest, s as flattenJobs, st as AUTO_RESPONSES_BRAND, tt as formatValidationError, u as jobAt, ut as HANDLER_CONTEXT_BRAND, w as encodeStreamBody } from "./cache-CLN5y0Xp.mjs";
2
- import { A as routerFromRoutes, C as headersToObject, D as jobRunnerFrom, E as jobRoutes, F as pluginRouterOf, G as requiresDenial, H as matchRoute, I as pluginRoutesOf, J as createJobTransport, K as withPermissions, L as resolvePluginServers, M as runRoute, N as warnUnsupportedJobOptions, O as parseFetchBody, P as pluginExportsOf, Q as ResponseError, R as isRawResponse, S as guardDenyFor, T as jobRouter, U as sortFlattenedRoutes, W as insufficientScope, X as createJobRunner, Y as JobInputError, Z as jobFnAt, _ as createAdapter, a as HANDLER_ARG_KEYS, at as problemDetails, b as extractCredential, c as ROUTER_META, d as SCHEMES_META, f as adapterContextOf, g as contractOf, h as boundJobKeys, i as GUARD_SCHEMA_META, j as runHandler, k as renderJsonResult, l as RUN_ROUTE_KEY, m as bearerChallenge, mt as tagRoutes, n as DISPATCH_ROUTE_KEY, o as JOBS_META, p as assembleApi, q as JobDispatchError, r as GUARDS_META, s as REQUEST_CONTEXT_META, t as API_META, u as ResponseValidationError, v as dispatchHandler, vt as isTagSet, w as isGuardDenial, x as getHeaderValue, y as dispatchRoute, z as rawResponse } from "./adapter-CZW-unqX.mjs";
1
+ import { $ as allowedMethodsForPath, P as isStreamResponse, Q as parsePath, Z as buildPath, at as AUTO_GUARD_BRAND, c as isCompiledJob, et as flattenRoutes, ft as ROUTES_TAG, nt as isRouteDefinition, rt as validateRequest, s as flattenJobs, st as AUTO_RESPONSES_BRAND, tt as formatValidationError, u as jobAt, ut as HANDLER_CONTEXT_BRAND, w as encodeStreamBody } from "./cache-mysim62l.mjs";
2
+ import { A as routerFromRoutes, C as headersToObject, D as jobRunnerFrom, E as jobRoutes, F as pluginRouterOf, G as requiresDenial, H as matchRoute, I as pluginRoutesOf, J as createJobTransport, K as withPermissions, L as resolvePluginServers, M as runRoute, N as warnUnsupportedJobOptions, O as parseFetchBody, P as pluginExportsOf, Q as ResponseError, R as isRawResponse, S as guardDenyFor, T as jobRouter, U as sortFlattenedRoutes, W as insufficientScope, X as createJobRunner, Y as JobInputError, Z as jobFnAt, _ as createAdapter, a as HANDLER_ARG_KEYS, at as problemDetails, b as extractCredential, c as ROUTER_META, d as SCHEMES_META, f as adapterContextOf, g as contractOf, h as boundJobKeys, i as GUARD_SCHEMA_META, j as runHandler, k as renderJsonResult, l as RUN_ROUTE_KEY, m as bearerChallenge, mt as tagRoutes, n as DISPATCH_ROUTE_KEY, o as JOBS_META, p as assembleApi, q as JobDispatchError, r as GUARDS_META, s as REQUEST_CONTEXT_META, t as API_META, u as ResponseValidationError, v as dispatchHandler, vt as isTagSet, w as isGuardDenial, x as getHeaderValue, y as dispatchRoute, z as rawResponse } from "./adapter-McMjeB0U.mjs";
3
3
  import { createPlugin, pluginRouteTree } from "./plugin.mjs";
4
- import { c as authenticationChallenge, f as resolveSecurityRequirements } from "./schemas-CJQcc97N.mjs";
4
+ import { c as authenticationChallenge, f as resolveSecurityRequirements } from "./schemas-BNhOeOTR.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_TAG, RUN_ROUTE_KEY, ResponseError, ResponseValidationError, SCHEMES_META, adapterContextOf, allowedMethodsForPath, assembleApi, authenticationChallenge, bearerChallenge, boundJobKeys, buildPath, contractOf, createAdapter, createJobRunner, createJobTransport, createPlugin, dispatchHandler, dispatchRoute, encodeStreamBody, extractCredential, flattenJobs, flattenRoutes, formatValidationError, getHeaderValue, guardDenyFor, headersToObject, insufficientScope, isCompiledJob, isGuardDenial, isRawResponse, isRouteDefinition, isStreamResponse, isTagSet, jobAt, jobFnAt, jobRouter, jobRoutes, jobRunnerFrom, matchRoute, parseFetchBody, parsePath, pluginExportsOf, pluginRouteTree, pluginRouterOf, pluginRoutesOf, problemDetails, rawResponse, renderJsonResult, requiresDenial, resolvePluginServers, resolveSecurityRequirements, routerFromRoutes, runHandler, runRoute, sortFlattenedRoutes, tagRoutes, validateRequest, warnUnsupportedJobOptions, withPermissions };
@@ -1,4 +1,4 @@
1
- const require_error_response = require("./error-response-C8Ragjcd.cjs");
1
+ const require_error_response = require("./error-response-Dn5Ci5UP.cjs");
2
2
  let zod = require("zod");
3
3
  //#region src/types.ts
4
4
  const METHODS = [
@@ -1,4 +1,4 @@
1
- import { T as resolveBaseType, a as WRAPPER_TYPES, c as isBinarySchema, m as readDef, t as ProblemDetailsSchema, w as readObjectShape } from "./error-response-C839d8By.mjs";
1
+ import { T as resolveBaseType, a as WRAPPER_TYPES, c as isBinarySchema, m as readDef, t as ProblemDetailsSchema, w as readObjectShape } from "./error-response-rsiMhmJP.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/types.ts
4
4
  const METHODS = [
@@ -59,23 +59,30 @@ const resolveBaseType = (schema) => {
59
59
  return def.type ?? "";
60
60
  };
61
61
  /**
62
- * Removes optional/nullable/default wrappers, returning the inner schema and
63
- * whether any were present.
62
+ * Removes optional/nullable/default wrappers, returning the inner schema,
63
+ * whether the key may be absent, and whether the value may be null. A
64
+ * `z.string().nullable()` field is required, so it reports `optional: false`.
64
65
  */
65
66
  const unwrapOptionalWrappers = (schema) => {
66
67
  let current = schema;
67
68
  let optional = false;
69
+ let nullable = false;
68
70
  while (true) {
69
71
  const def = readDef(current);
70
- if (def.type !== "optional" && def.type !== "nullable" && def.type !== "default" && def.type !== "nullish") break;
71
- optional = true;
72
+ if (def.type === "optional" || def.type === "default") optional = true;
73
+ else if (def.type === "nullable") nullable = true;
74
+ else if (def.type === "nullish") {
75
+ optional = true;
76
+ nullable = true;
77
+ } else break;
72
78
  const next = def.innerType;
73
79
  if (!next) break;
74
80
  current = next;
75
81
  }
76
82
  return {
77
83
  inner: current,
78
- optional
84
+ optional,
85
+ nullable
79
86
  };
80
87
  };
81
88
  /**
@@ -59,23 +59,30 @@ const resolveBaseType = (schema) => {
59
59
  return def.type ?? "";
60
60
  };
61
61
  /**
62
- * Removes optional/nullable/default wrappers, returning the inner schema and
63
- * whether any were present.
62
+ * Removes optional/nullable/default wrappers, returning the inner schema,
63
+ * whether the key may be absent, and whether the value may be null. A
64
+ * `z.string().nullable()` field is required, so it reports `optional: false`.
64
65
  */
65
66
  const unwrapOptionalWrappers = (schema) => {
66
67
  let current = schema;
67
68
  let optional = false;
69
+ let nullable = false;
68
70
  while (true) {
69
71
  const def = readDef(current);
70
- if (def.type !== "optional" && def.type !== "nullable" && def.type !== "default" && def.type !== "nullish") break;
71
- optional = true;
72
+ if (def.type === "optional" || def.type === "default") optional = true;
73
+ else if (def.type === "nullable") nullable = true;
74
+ else if (def.type === "nullish") {
75
+ optional = true;
76
+ nullable = true;
77
+ } else break;
72
78
  const next = def.innerType;
73
79
  if (!next) break;
74
80
  current = next;
75
81
  }
76
82
  return {
77
83
  inner: current,
78
- optional
84
+ optional,
85
+ nullable
79
86
  };
80
87
  };
81
88
  /**
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_cache = require("./cache-BgohRj0i.cjs");
3
- const require_error_response = require("./error-response-C8Ragjcd.cjs");
2
+ const require_cache = require("./cache-CBeqj4jU.cjs");
3
+ const require_error_response = require("./error-response-Dn5Ci5UP.cjs");
4
4
  //#region src/tool-name.ts
5
5
  /**
6
6
  * Set by the MCP specification.
@@ -55,12 +55,14 @@ declare const isIntegerSchema: (schema: z.core.$ZodType) => boolean;
55
55
  */
56
56
  declare const readObjectShape: (schema: z.core.$ZodType) => Record<string, z.core.$ZodType> | undefined;
57
57
  /**
58
- * Removes optional/nullable/default wrappers, returning the inner schema and
59
- * whether any were present.
58
+ * Removes optional/nullable/default wrappers, returning the inner schema,
59
+ * whether the key may be absent, and whether the value may be null. A
60
+ * `z.string().nullable()` field is required, so it reports `optional: false`.
60
61
  */
61
62
  declare const unwrapOptionalWrappers: (schema: z.core.$ZodType) => {
62
63
  inner: z.core.$ZodType;
63
64
  optional: boolean;
65
+ nullable: boolean;
64
66
  };
65
67
  interface DiscriminatedUnion {
66
68
  discriminator: string;
@@ -55,12 +55,14 @@ declare const isIntegerSchema: (schema: z.core.$ZodType) => boolean;
55
55
  */
56
56
  declare const readObjectShape: (schema: z.core.$ZodType) => Record<string, z.core.$ZodType> | undefined;
57
57
  /**
58
- * Removes optional/nullable/default wrappers, returning the inner schema and
59
- * whether any were present.
58
+ * Removes optional/nullable/default wrappers, returning the inner schema,
59
+ * whether the key may be absent, and whether the value may be null. A
60
+ * `z.string().nullable()` field is required, so it reports `optional: false`.
60
61
  */
61
62
  declare const unwrapOptionalWrappers: (schema: z.core.$ZodType) => {
62
63
  inner: z.core.$ZodType;
63
64
  optional: boolean;
65
+ nullable: boolean;
64
66
  };
65
67
  interface DiscriminatedUnion {
66
68
  discriminator: string;
@@ -1,5 +1,5 @@
1
- import { A as streamSchemas, B as resolveResponseCache, D as soleStreamResponse, E as routeStreams, F as isSuccessStatus, G as sanitizeFieldName, H as resolveResponseEtag, I as isZodSchema, J as statusToCamelCase, K as sanitizeIdentifier, L as localTypeName, M as isHintPrefix, N as isJsonMediaType, O as streamContentType, P as isStreamResponse, Q as parsePath, R as mergeHeaderFields, S as EVENT_STREAM_MEDIA_TYPE, T as isNamedStream, U as resolveResponseHeaders, V as resolveResponseContentType, W as resolveResponseStream, X as toPascalCase, Y as toCamelCase, c as isCompiledJob, et as flattenRoutes, i as deprecationHeaders, j as streamStatuses, k as streamMode, n as cacheHeaders, q as shortTypeName, s as flattenJobs, u as jobAt, z as resolveResponseBody } from "./cache-CLN5y0Xp.mjs";
2
- import { C as readMetaId, E as unwrapOptionalWrappers, S as readMetaExamples, _ 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 readObjectShape, x as readMetaDescription, y as readDiscriminatorStringLiteral } from "./error-response-C839d8By.mjs";
1
+ import { A as streamSchemas, B as resolveResponseCache, D as soleStreamResponse, E as routeStreams, F as isSuccessStatus, G as sanitizeFieldName, H as resolveResponseEtag, I as isZodSchema, J as statusToCamelCase, K as sanitizeIdentifier, L as localTypeName, M as isHintPrefix, N as isJsonMediaType, O as streamContentType, P as isStreamResponse, Q as parsePath, R as mergeHeaderFields, S as EVENT_STREAM_MEDIA_TYPE, T as isNamedStream, U as resolveResponseHeaders, V as resolveResponseContentType, W as resolveResponseStream, X as toPascalCase, Y as toCamelCase, c as isCompiledJob, et as flattenRoutes, i as deprecationHeaders, j as streamStatuses, k as streamMode, n as cacheHeaders, q as shortTypeName, s as flattenJobs, u as jobAt, z as resolveResponseBody } from "./cache-mysim62l.mjs";
2
+ import { C as readMetaId, E as unwrapOptionalWrappers, S as readMetaExamples, _ 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 readObjectShape, x as readMetaDescription, y as readDiscriminatorStringLiteral } from "./error-response-rsiMhmJP.mjs";
3
3
  //#region src/tool-name.ts
4
4
  /**
5
5
  * Set by the MCP specification.
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_cache = require("./cache-BgohRj0i.cjs");
3
- const require_error_response = require("./error-response-C8Ragjcd.cjs");
4
- const require_adapter = require("./adapter-DDR_yo9L.cjs");
2
+ const require_cache = require("./cache-CBeqj4jU.cjs");
3
+ const require_error_response = require("./error-response-Dn5Ci5UP.cjs");
4
+ const require_adapter = require("./adapter-B-4BBluY.cjs");
5
5
  const require_plugin = require("./plugin.cjs");
6
- const require_schemas = require("./schemas-C56no6bv.cjs");
6
+ const require_schemas = require("./schemas-CMu98wp_.cjs");
7
7
  let zod = require("zod");
8
8
  //#region src/coded-issue.ts
9
9
  /**
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { D as soleStreamResponse, E as routeStreams, I as isZodSchema, O as streamContentType, P as isStreamResponse, Q as parsePath, S as EVENT_STREAM_MEDIA_TYPE, T as isNamedStream, Z as buildPath, _ as nextRun, at as AUTO_GUARD_BRAND, b as scheduleExpression, c as isCompiledJob, ct as DECLARATION, d as jobClaims, dt as METHODS, et as flattenRoutes, g as firesBetween, h as dueSchedules, j as streamStatuses, k as streamMode, l as isJobDefinition, lt as HANDLER, m as cron, nt as isRouteDefinition, o as buildJobs, ot as AUTO_GUARD_WRITTEN_BRAND, p as assertValidSchedule, r as assertValidDeprecationDates, s as flattenJobs, st as AUTO_RESPONSES_BRAND, t as assertValidCache, u as jobAt, ut as HANDLER_CONTEXT_BRAND, v as nextRuns, x as scheduleTimezone, y as parseCron, z as resolveResponseBody } from "./cache-CLN5y0Xp.mjs";
2
- import { n as isProblemDetails, r as createModel, t as ProblemDetailsSchema, w as readObjectShape } from "./error-response-C839d8By.mjs";
3
- import { $ as DispatchFailedSchema, A as routerFromRoutes, B as assertNoPathCollisions, J as createJobTransport, N as warnUnsupportedJobOptions, Q as ResponseError, V as routeClaims, X as createJobRunner, Y as JobInputError, Z as jobFnAt, _t as createTags, at as problemDetails, ct as getStatusText, dt as isPermissions, et as DispatchResultSchema, ft as isRoles, gt as toolEvents, ht as expandStreamTools, it as failedJobs, lt as createPermissions, mt as tagRoutes, nt as dispatchSucceeded, o as JOBS_META, ot as problemFromBody, p as assembleApi, pt as permissionNames, q as JobDispatchError, rt as dueJobs, st as STATUS_TITLES, tt as dispatchDueJobs, ut as createRoles, x as getHeaderValue } from "./adapter-CZW-unqX.mjs";
1
+ import { D as soleStreamResponse, E as routeStreams, I as isZodSchema, O as streamContentType, P as isStreamResponse, Q as parsePath, S as EVENT_STREAM_MEDIA_TYPE, T as isNamedStream, Z as buildPath, _ as nextRun, at as AUTO_GUARD_BRAND, b as scheduleExpression, c as isCompiledJob, ct as DECLARATION, d as jobClaims, dt as METHODS, et as flattenRoutes, g as firesBetween, h as dueSchedules, j as streamStatuses, k as streamMode, l as isJobDefinition, lt as HANDLER, m as cron, nt as isRouteDefinition, o as buildJobs, ot as AUTO_GUARD_WRITTEN_BRAND, p as assertValidSchedule, r as assertValidDeprecationDates, s as flattenJobs, st as AUTO_RESPONSES_BRAND, t as assertValidCache, u as jobAt, ut as HANDLER_CONTEXT_BRAND, v as nextRuns, x as scheduleTimezone, y as parseCron, z as resolveResponseBody } from "./cache-mysim62l.mjs";
2
+ import { n as isProblemDetails, r as createModel, t as ProblemDetailsSchema, w as readObjectShape } from "./error-response-rsiMhmJP.mjs";
3
+ import { $ as DispatchFailedSchema, A as routerFromRoutes, B as assertNoPathCollisions, J as createJobTransport, N as warnUnsupportedJobOptions, Q as ResponseError, V as routeClaims, X as createJobRunner, Y as JobInputError, Z as jobFnAt, _t as createTags, at as problemDetails, ct as getStatusText, dt as isPermissions, et as DispatchResultSchema, ft as isRoles, gt as toolEvents, ht as expandStreamTools, it as failedJobs, lt as createPermissions, mt as tagRoutes, nt as dispatchSucceeded, o as JOBS_META, ot as problemFromBody, p as assembleApi, pt as permissionNames, q as JobDispatchError, rt as dueJobs, st as STATUS_TITLES, tt as dispatchDueJobs, ut as createRoles, x as getHeaderValue } from "./adapter-McMjeB0U.mjs";
4
4
  import { createPlugin, pluginRouteTree, pluginsBySlug } from "./plugin.mjs";
5
- import { a as buildProtectedResourceMetadata, c as authenticationChallenge, d as isSecurityScheme, f as resolveSecurityRequirements, i as assertCanonicalResourceUri, l as authorizationServerIssuer, s as isValidationError, u as declaredScopes } from "./schemas-CJQcc97N.mjs";
5
+ import { a as buildProtectedResourceMetadata, c as authenticationChallenge, d as isSecurityScheme, f as resolveSecurityRequirements, i as assertCanonicalResourceUri, l as authorizationServerIssuer, s as isValidationError, u as declaredScopes } from "./schemas-BNhOeOTR.mjs";
6
6
  import { z } from "zod";
7
7
  //#region src/coded-issue.ts
8
8
  /**
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_cache = require("./cache-BgohRj0i.cjs");
3
- const require_adapter = require("./adapter-DDR_yo9L.cjs");
2
+ const require_cache = require("./cache-CBeqj4jU.cjs");
3
+ const require_adapter = require("./adapter-B-4BBluY.cjs");
4
4
  //#region src/start-jobs.ts
5
5
  /**
6
6
  * The dedupe key an occurrence gets. Every instance ticking the same minute
@@ -1,5 +1,5 @@
1
- import { _ as nextRun, b as scheduleExpression, s as flattenJobs, x as scheduleTimezone } from "./cache-CLN5y0Xp.mjs";
2
- import { D as jobRunnerFrom, Z as jobFnAt, h as boundJobKeys, o as JOBS_META } from "./adapter-CZW-unqX.mjs";
1
+ import { _ as nextRun, b as scheduleExpression, s as flattenJobs, x as scheduleTimezone } from "./cache-mysim62l.mjs";
2
+ import { D as jobRunnerFrom, Z as jobFnAt, h as boundJobKeys, o as JOBS_META } from "./adapter-McMjeB0U.mjs";
3
3
  //#region src/start-jobs.ts
4
4
  /**
5
5
  * The dedupe key an occurrence gets. Every instance ticking the same minute
@@ -1,4 +1,4 @@
1
- import { r as createModel, t as ProblemDetailsSchema } from "./error-response-C839d8By.mjs";
1
+ import { r as createModel, t as ProblemDetailsSchema } from "./error-response-rsiMhmJP.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/security-scheme.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- const require_error_response = require("./error-response-C8Ragjcd.cjs");
1
+ const require_error_response = require("./error-response-Dn5Ci5UP.cjs");
2
2
  let zod = require("zod");
3
3
  //#region src/security-scheme.ts
4
4
  /**
package/dist/schemas.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_error_response = require("./error-response-C8Ragjcd.cjs");
3
- const require_schemas = require("./schemas-C56no6bv.cjs");
2
+ const require_error_response = require("./error-response-Dn5Ci5UP.cjs");
3
+ const require_schemas = require("./schemas-CMu98wp_.cjs");
4
4
  exports.BinarySchema = require_schemas.BinarySchema;
5
5
  exports.FileSchema = require_schemas.FileSchema;
6
6
  exports.ProblemDetailsSchema = require_error_response.ProblemDetailsSchema;
package/dist/schemas.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as ProblemDetailsSchema } from "./error-response-C839d8By.mjs";
2
- import { n as FileSchema, o as ValidationErrorSchema, r as ProtectedResourceMetadataSchema, t as BinarySchema } from "./schemas-CJQcc97N.mjs";
1
+ import { t as ProblemDetailsSchema } from "./error-response-rsiMhmJP.mjs";
2
+ import { n as FileSchema, o as ValidationErrorSchema, r as ProtectedResourceMetadataSchema, t as BinarySchema } from "./schemas-BNhOeOTR.mjs";
3
3
  export { BinarySchema, FileSchema, ProblemDetailsSchema, ProtectedResourceMetadataSchema, ValidationErrorSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kizunajs",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.3",
4
4
  "description": "Route declaration, validation, and the adapter API for Kizuna.js",
5
5
  "keywords": [
6
6
  "kizunajs",
@@ -94,16 +94,22 @@ export const resolveBaseType = (schema: z.core.$ZodType): string => {
94
94
  };
95
95
 
96
96
  /**
97
- * Removes optional/nullable/default wrappers, returning the inner schema and
98
- * whether any were present.
97
+ * Removes optional/nullable/default wrappers, returning the inner schema,
98
+ * whether the key may be absent, and whether the value may be null. A
99
+ * `z.string().nullable()` field is required, so it reports `optional: false`.
99
100
  */
100
- export const unwrapOptionalWrappers = (schema: z.core.$ZodType): { inner: z.core.$ZodType; optional: boolean } => {
101
+ export const unwrapOptionalWrappers = (schema: z.core.$ZodType): { inner: z.core.$ZodType; optional: boolean; nullable: boolean } => {
101
102
  let current = schema;
102
103
  let optional = false;
104
+ let nullable = false;
103
105
  while (true) {
104
106
  const def = readDef(current);
105
- if (def.type !== 'optional' && def.type !== 'nullable' && def.type !== 'default' && def.type !== 'nullish') break;
106
- optional = true;
107
+ if (def.type === 'optional' || def.type === 'default') optional = true;
108
+ else if (def.type === 'nullable') nullable = true;
109
+ else if (def.type === 'nullish') {
110
+ optional = true;
111
+ nullable = true;
112
+ } else break;
107
113
  const next = def.innerType;
108
114
  if (!next) break;
109
115
  current = next;
@@ -111,6 +117,7 @@ export const unwrapOptionalWrappers = (schema: z.core.$ZodType): { inner: z.core
111
117
  return {
112
118
  inner: current,
113
119
  optional,
120
+ nullable,
114
121
  };
115
122
  };
116
123