@kubb/adapter-oas 5.8.4 → 5.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1194,8 +1194,8 @@ type AdapterOasOptions = {
1194
1194
  */
1195
1195
  validate?: boolean;
1196
1196
  /**
1197
- * Preferred media type when an operation defines several. Defaults to the
1198
- * first JSON-compatible media type found in the spec.
1197
+ * Media type to keep for request bodies and responses. Omit to keep every
1198
+ * media type an operation declares.
1199
1199
  */
1200
1200
  contentType?: ContentType;
1201
1201
  /**
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ var compatibility = {
11
11
  };
12
12
  //#endregion
13
13
  //#region package.json
14
- var version = "5.8.4";
14
+ var version = "5.9.1";
15
15
  //#endregion
16
16
  //#region src/constants.ts
17
17
  /**
@@ -38,6 +38,7 @@ const SCHEMA_REF_PREFIX = "#/components/schemas/";
38
38
  /**
39
39
  * HTTP methods that count as operations on an OpenAPI path item. Other keys
40
40
  * (`parameters`, `summary`, `$ref`, vendor extensions) are skipped when iterating operations.
41
+ * `query` is the OpenAPI 3.2 field for the HTTP QUERY method (RFC 10008).
41
42
  */
42
43
  const SUPPORTED_METHODS = /* @__PURE__ */ new Set([
43
44
  "get",
@@ -47,7 +48,8 @@ const SUPPORTED_METHODS = /* @__PURE__ */ new Set([
47
48
  "options",
48
49
  "head",
49
50
  "patch",
50
- "trace"
51
+ "trace",
52
+ "query"
51
53
  ]);
52
54
  /**
53
55
  * Set of JSON Schema keywords that prevent a schema fragment from being inlined during `allOf` flattening.
@@ -261,74 +263,34 @@ function getErrorMessage(value) {
261
263
  }
262
264
  //#endregion
263
265
  //#region ../../internals/utils/src/runtime.ts
266
+ const isBun = typeof Bun !== "undefined";
267
+ const isDeno = "Deno" in globalThis;
264
268
  /**
265
- * Detects the JavaScript runtime executing the current process and exposes its name and version.
269
+ * The JavaScript runtime executing the current process: its name, version and whether it is Bun.
266
270
  *
267
- * Prefer the shared {@link runtime} instance over constructing your own.
271
+ * @example
272
+ * ```ts
273
+ * runtime.name // 'bun' when run with `bun kubb`, 'node' otherwise
274
+ * ```
268
275
  */
269
- var Runtime = class {
270
- /**
271
- * `true` when the current process is running under Bun.
272
- *
273
- * Detection keys off the global `Bun` object rather than `process.versions`,
274
- * because Bun polyfills `process.versions.node` for Node compatibility and would
275
- * otherwise look like Node.
276
- *
277
- * @example
278
- * ```ts
279
- * if (runtime.isBun) {
280
- * await Bun.write(path, data)
281
- * }
282
- * ```
283
- */
284
- get isBun() {
285
- return typeof Bun !== "undefined";
286
- }
287
- /**
288
- * `true` when the current process is running under Deno.
289
- */
290
- get isDeno() {
291
- return typeof globalThis.Deno !== "undefined";
292
- }
293
- /**
294
- * `true` when the current process is running under Node.
295
- *
296
- * Bun and Deno are excluded first so a polyfilled `process` does not register as Node.
297
- */
298
- get isNode() {
299
- return !this.isBun && !this.isDeno && typeof process !== "undefined" && process.versions?.node != null;
300
- }
301
- /**
302
- * Name of the runtime executing the current process.
303
- *
304
- * @example
305
- * ```ts
306
- * runtime.name // 'bun' when run with `bun kubb`, 'node' otherwise
307
- * ```
308
- */
309
- get name() {
310
- if (this.isBun) return "bun";
311
- if (this.isDeno) return "deno";
312
- return "node";
313
- }
314
- /**
315
- * Version of the active runtime, or an empty string when it cannot be read.
316
- *
317
- * @example
318
- * ```ts
319
- * runtime.version // '1.3.11' under Bun, '22.22.2' under Node
320
- * ```
321
- */
322
- get version() {
323
- if (this.isBun) return process.versions.bun ?? "";
324
- if (this.isDeno) return globalThis.Deno?.version?.deno ?? "";
325
- return process.versions?.node ?? "";
326
- }
276
+ const runtime = {
277
+ isBun,
278
+ ...detect()
327
279
  };
328
- /**
329
- * Shared {@link Runtime} instance describing the JavaScript runtime executing the current process.
330
- */
331
- const runtime = new Runtime();
280
+ function detect() {
281
+ if (isBun) return {
282
+ name: "bun",
283
+ version: process.versions.bun ?? ""
284
+ };
285
+ if (isDeno) return {
286
+ name: "deno",
287
+ version: globalThis.Deno?.version?.deno ?? ""
288
+ };
289
+ return {
290
+ name: "node",
291
+ version: process.versions?.node ?? ""
292
+ };
293
+ }
332
294
  //#endregion
333
295
  //#region ../../internals/utils/src/fs.ts
334
296
  /**
@@ -2090,7 +2052,7 @@ function createSchemaParser(ctx) {
2090
2052
  for (const rule of schemaRules) if (rule.match(context)) return rule.convert(context);
2091
2053
  return createNode(context, { type: options.emptySchemaType });
2092
2054
  }
2093
- return { parseSchema };
2055
+ return parseSchema;
2094
2056
  }
2095
2057
  //#endregion
2096
2058
  //#region src/promoteEnums.ts
@@ -2359,7 +2321,8 @@ const adapterOas = defineExtension({
2359
2321
  meta: {
2360
2322
  name: "oas",
2361
2323
  version,
2362
- compatibility
2324
+ compatibility,
2325
+ issues: "https://github.com/kubb-labs/kubb/issues"
2363
2326
  },
2364
2327
  setup: ({ validate = true, contentType, server, discriminator = "preserve", enums = "inline", dateType = DEFAULT_PARSER_OPTIONS.dateType, integerType = DEFAULT_PARSER_OPTIONS.integerType, unknownType = DEFAULT_PARSER_OPTIONS.unknownType, enumSuffix = DEFAULT_PARSER_OPTIONS.enumSuffix, emptySchemaType = unknownType || DEFAULT_PARSER_OPTIONS.emptySchemaType }) => ({
2365
2328
  validate,
@@ -2376,8 +2339,7 @@ const adapterOas = defineExtension({
2376
2339
  build({ validate, contentType, server, discriminator, enums, ...parserOptions }) {
2377
2340
  let parsedDocument = null;
2378
2341
  const inputCache = /* @__PURE__ */ new WeakMap();
2379
- function parseInput({ document, refs, schemas, parser }) {
2380
- const { parseSchema } = parser;
2342
+ function parseInput({ document, refs, schemas, parseSchema }) {
2381
2343
  const parsedByName = /* @__PURE__ */ new Map();
2382
2344
  const refAliasMap = /* @__PURE__ */ new Map();
2383
2345
  const enumNames = [];
@@ -2465,7 +2427,7 @@ const adapterOas = defineExtension({
2465
2427
  document,
2466
2428
  refs,
2467
2429
  schemas,
2468
- parser: createSchemaParser({
2430
+ parseSchema: createSchemaParser({
2469
2431
  document,
2470
2432
  refs,
2471
2433
  renames,