@redocly/cli 0.0.0-snapshot.1785230554 → 0.0.0-snapshot.1785244920

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +15 -0
  2. package/THIRD_PARTY_NOTICES +2 -1
  3. package/lib/chunks/{OX5JLHET.js → 2TLLJTMW.js} +11 -7
  4. package/lib/chunks/{A6JSOHCP.js → 33L3PA3A.js} +7 -3
  5. package/lib/chunks/{CUWLBJXP.js → 34BWH3JM.js} +5 -1
  6. package/lib/chunks/{ZCF2YWSB.js → 3CBCJ5DL.js} +11 -7
  7. package/lib/chunks/{Z3EJWJEX.js → 4U73KS2P.js} +75 -5
  8. package/lib/chunks/{Y6DTFCLS.js → 7COZBK76.js} +4 -0
  9. package/lib/chunks/{TS33ZDKX.js → 7J52NJGJ.js} +6 -2
  10. package/lib/chunks/{AIT3U3JT.js → AVTQDJLQ.js} +5 -1
  11. package/lib/chunks/BJPV227M.js +885 -0
  12. package/lib/chunks/{UV3RHVRI.js → CJNTHBNO.js} +10 -6
  13. package/lib/chunks/{RMTDGHBP.js → D7VQZUMB.js} +23 -7
  14. package/lib/chunks/{QCELG3VF.js → DVFATG7K.js} +14 -10
  15. package/lib/chunks/{N55G56UJ.js → FWLST3FS.js} +13 -9
  16. package/lib/chunks/{PAZIZVGW.js → G7NJ4MRM.js} +11 -3
  17. package/lib/chunks/H5ENEHWI.js +20 -0
  18. package/lib/chunks/{Z2I5YXYN.js → HRYOF224.js} +5 -1
  19. package/lib/chunks/{VXIQEZPR.js → HXIHIVQ5.js} +1111 -465
  20. package/lib/chunks/{PALJTNKL.js → IDXKDJQS.js} +11 -7
  21. package/lib/chunks/{4FB5ZIPP.js → JPNXFCZJ.js} +6 -2
  22. package/lib/chunks/{R3N3E2X6.js → KCRMMKKK.js} +11 -3
  23. package/lib/chunks/{UQJWXLNC.js → L6R6EBNZ.js} +6 -2
  24. package/lib/chunks/{XHPY6UJF.js → LJH34AHG.js} +5 -1
  25. package/lib/chunks/NEZUIX4U.js +215777 -0
  26. package/lib/chunks/{VUDTNFRL.js → OD6H2RSI.js} +7 -3
  27. package/lib/chunks/{FO6BDVGE.js → OY3F7DFL.js} +6 -2
  28. package/lib/chunks/{XB6C62FW.js → QRC5ADSZ.js} +5 -1
  29. package/lib/chunks/{ICPYP2LP.js → QVWJKMKN.js} +5 -1
  30. package/lib/chunks/R5XDCRI3.js +18 -0
  31. package/lib/chunks/{MVYT2TYI.js → REFFQ5TY.js} +10 -6
  32. package/lib/chunks/{ZK3QRKL5.js → TWBSRL2M.js} +6 -2
  33. package/lib/chunks/{OEBTCJXO.js → VDSSC4ZQ.js} +6 -2
  34. package/lib/chunks/{64PJUTGH.js → X4HWZFPQ.js} +5 -1
  35. package/lib/chunks/{W7G5WVPB.js → X5N4DTSB.js} +7 -3
  36. package/lib/chunks/{UUU33DK3.js → XDVFCBV7.js} +5 -1
  37. package/lib/chunks/{JR2DXWZO.js → XIMZMWPI.js} +66 -62
  38. package/lib/chunks/{5ILQMFXK.js → YDPUXTSG.js} +4 -0
  39. package/lib/index.js +258 -28
  40. package/package.json +1 -1
  41. package/lib/chunks/HV6PGCEU.js +0 -16
package/README.md CHANGED
@@ -139,6 +139,21 @@ Respect is Redocly's community-edition product. Looking for something more? We a
139
139
 
140
140
  Learn more about [Respect](https://redocly.com/respect) and [get started with API contract testing](https://redocly.com/docs/respect/get-started).
141
141
 
142
+ ### Generate a TypeScript client
143
+
144
+ > ⚠️ **Experimental** — flags, output, and configuration may change in any minor release until declared stable.
145
+
146
+ Turn an OpenAPI description (3.0/3.1/3.2 or Swagger 2.0) into a typed TypeScript client with the `generate-client` command.
147
+ The emitted client has zero runtime dependencies and runs in browsers, Node, Bun, Deno, and edge runtimes.
148
+
149
+ ```sh
150
+ redocly generate-client openapi.yaml --output src/client.ts
151
+ ```
152
+
153
+ Inline types plus a typed client instance and one async function per operation, with auth, opt-in abort-aware retries, middleware, and typed Server-Sent Events.
154
+ The same command can also emit Zod schemas, TanStack Query / SWR hooks, MSW mocks, and more via `--generators`.
155
+ For detailed information, read the [ `generate-client` docs](./docs/@v2/commands/generate-client.md).
156
+
142
157
  ### Transform an OpenAPI description
143
158
 
144
159
  If your OpenAPI description isn't everything you hoped it would be, enhance it with the Redocly [decorators](https://redocly.com/docs/cli/decorators) feature.
@@ -229,6 +229,7 @@ Packages:
229
229
  @opentelemetry/semantic-conventions@1.41.1 — copyright owner or entity authorized by
230
230
  better-ajv-errors@2.0.3 — Copyright 2018 Atlassian Pty Ltd
231
231
  jsonpath-rfc9535@1.3.0 — copyright owner or entity authorized by
232
+ typescript@6.0.2 — copyright owner or entity authorized by the copyright owner that is granting the License.
232
233
  yaml-ast-parser@0.0.43
233
234
 
234
235
  License text:
@@ -690,7 +691,7 @@ Packages:
690
691
  mobx@6.12.3 — Copyright (c) 2015 Michel Weststrate
691
692
  ms@2.1.3
692
693
  object-assign@4.1.1
693
- openapi-sampler@1.7.1 — Copyright (c) 2017 Roman Hotsiy <gotsijroman@gmail.com>
694
+ openapi-sampler@1.7.4 — Copyright (c) 2017 Roman Hotsiy <gotsijroman@gmail.com>
694
695
  outdent@0.8.0 — Copyright (c) 2016 Andrew Bradley
695
696
  perfect-scrollbar@1.5.6 — Copyright (c) 2012-2019 Hyunje Jun, MDBootstrap.com and other contributors
696
697
  picomatch@4.0.4 — Copyright (c) 2017-present, Jon Schlinkert.
@@ -1,8 +1,12 @@
1
1
  import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
2
4
  const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
3
7
  import {
4
8
  selectTrafficParser
5
- } from "./OEBTCJXO.js";
9
+ } from "./VDSSC4ZQ.js";
6
10
  import {
7
11
  getPathWithoutTrailingSlash,
8
12
  isJsonMime,
@@ -12,14 +16,14 @@ import {
12
16
  normalizeFsPath,
13
17
  normalizeServerPrefix,
14
18
  resolvePathForServer
15
- } from "./PAZIZVGW.js";
19
+ } from "./G7NJ4MRM.js";
16
20
  import {
17
21
  OPENAPI3_METHOD_NAMES,
18
22
  Spinner
19
- } from "./64PJUTGH.js";
23
+ } from "./X4HWZFPQ.js";
20
24
  import {
21
25
  exitWithError
22
- } from "./CUWLBJXP.js";
26
+ } from "./34BWH3JM.js";
23
27
  import {
24
28
  createConfig,
25
29
  isPlainObject,
@@ -28,9 +32,9 @@ import {
28
32
  parseYaml,
29
33
  pluralize,
30
34
  stringifyYaml
31
- } from "./Z3EJWJEX.js";
32
- import "./Z2I5YXYN.js";
33
- import "./5ILQMFXK.js";
35
+ } from "./4U73KS2P.js";
36
+ import "./HRYOF224.js";
37
+ import "./YDPUXTSG.js";
34
38
 
35
39
  // src/commands/generate-spec/index.ts
36
40
  import { mkdir, writeFile } from "node:fs/promises";
@@ -1,16 +1,20 @@
1
1
  import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
2
4
  const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
3
7
  import {
4
8
  require_execAsync
5
- } from "./AIT3U3JT.js";
9
+ } from "./AVTQDJLQ.js";
6
10
  import {
7
11
  esm_exports,
8
12
  init_esm
9
- } from "./XHPY6UJF.js";
13
+ } from "./LJH34AHG.js";
10
14
  import {
11
15
  __commonJS,
12
16
  __toCommonJS
13
- } from "./5ILQMFXK.js";
17
+ } from "./YDPUXTSG.js";
14
18
 
15
19
  // ../../node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-darwin.js
16
20
  var require_getMachineId_darwin = __commonJS({
@@ -1,8 +1,12 @@
1
1
  import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
2
4
  const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
3
7
  import {
4
8
  HandledError
5
- } from "./Z3EJWJEX.js";
9
+ } from "./4U73KS2P.js";
6
10
 
7
11
  // src/utils/error.ts
8
12
  var AbortFlowError = class extends Error {
@@ -1,27 +1,31 @@
1
1
  import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
2
4
  const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
3
7
  import {
4
8
  selectTrafficParser
5
- } from "./OEBTCJXO.js";
9
+ } from "./VDSSC4ZQ.js";
6
10
  import {
7
11
  ValidationSession,
8
12
  loadOpenApiIndex,
9
13
  parseCsv,
10
14
  renderReport
11
- } from "./RMTDGHBP.js";
15
+ } from "./D7VQZUMB.js";
12
16
  import {
13
17
  listFilesRecursively,
14
18
  normalizeFsPath
15
- } from "./PAZIZVGW.js";
19
+ } from "./G7NJ4MRM.js";
16
20
  import {
17
21
  AbortFlowError,
18
22
  exitWithError
19
- } from "./CUWLBJXP.js";
23
+ } from "./34BWH3JM.js";
20
24
  import {
21
25
  logger
22
- } from "./Z3EJWJEX.js";
23
- import "./Z2I5YXYN.js";
24
- import "./5ILQMFXK.js";
26
+ } from "./4U73KS2P.js";
27
+ import "./HRYOF224.js";
28
+ import "./YDPUXTSG.js";
25
29
 
26
30
  // src/commands/drift/index.ts
27
31
  import { mkdir, writeFile } from "node:fs/promises";
@@ -1,16 +1,20 @@
1
1
  import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
2
4
  const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
3
7
  import {
4
8
  initRules,
5
9
  isDefined,
6
10
  require_graphql
7
- } from "./Z2I5YXYN.js";
11
+ } from "./HRYOF224.js";
8
12
  import {
9
13
  __commonJS,
10
14
  __export,
11
15
  __require,
12
16
  __toESM
13
- } from "./5ILQMFXK.js";
17
+ } from "./YDPUXTSG.js";
14
18
 
15
19
  // ../../node_modules/pluralize/pluralize.js
16
20
  var require_pluralize = __commonJS({
@@ -28378,6 +28382,7 @@ var createConfigRoot = (nodeTypes) => ({
28378
28382
  ...ConfigGovernance.properties,
28379
28383
  apis: "ConfigApis",
28380
28384
  // Override apis with internal format
28385
+ client: "Client",
28381
28386
  telemetry: { enum: ["on", "off"] },
28382
28387
  resolve: {
28383
28388
  properties: {
@@ -28397,8 +28402,10 @@ var createConfigApisProperties = (nodeTypes) => ({
28397
28402
  ...nodeTypes["rootRedoclyConfigSchema.apis_additionalProperties"],
28398
28403
  properties: {
28399
28404
  ...nodeTypes["rootRedoclyConfigSchema.apis_additionalProperties"]?.properties,
28400
- ...omit(ConfigGovernance.properties, ["plugins"])
28405
+ ...omit(ConfigGovernance.properties, ["plugins"]),
28401
28406
  // plugins are not allowed in apis
28407
+ client: "Client",
28408
+ clientOutput: { type: "string" }
28402
28409
  }
28403
28410
  });
28404
28411
  var ConfigHTTP = {
@@ -28411,6 +28418,41 @@ var ConfigHTTP = {
28411
28418
  }
28412
28419
  }
28413
28420
  };
28421
+ var Client = {
28422
+ properties: {
28423
+ generators: { type: "array", items: { type: "string" } },
28424
+ argsStyle: { enum: ["flat", "grouped"] },
28425
+ serverUrl: { type: "string" },
28426
+ outputMode: { enum: ["single", "split"] },
28427
+ runtime: { enum: ["inline", "package"] },
28428
+ importExt: { enum: ["js", "ts"] },
28429
+ errorMode: { enum: ["throw", "result"] },
28430
+ dateType: { enum: ["string", "Date"] },
28431
+ mockData: { enum: ["static", "faker"] },
28432
+ mockSeed: { type: "number" },
28433
+ queryKeyPrefix: { type: "string" },
28434
+ setup: { type: "string" },
28435
+ pagination: "ClientPagination"
28436
+ }
28437
+ };
28438
+ var ClientPaginationRule = {
28439
+ properties: {
28440
+ style: { enum: ["cursor", "offset", "page", "link"] },
28441
+ cursorParam: { type: "string" },
28442
+ nextCursor: { type: "string" },
28443
+ hasMore: { type: "string" },
28444
+ offsetParam: { type: "string" },
28445
+ limitParam: { type: "string" },
28446
+ items: { type: "string" }
28447
+ }
28448
+ };
28449
+ var ClientPagination = {
28450
+ properties: {
28451
+ ...ClientPaginationRule.properties,
28452
+ exclude: { type: "array", items: { type: "string" } },
28453
+ operations: mapOf("ClientPaginationRule")
28454
+ }
28455
+ };
28414
28456
  var Rules = {
28415
28457
  properties: {},
28416
28458
  description: "The rules configuration blocks set up linting rules and their severity. You can configure built-in rules, add configurable rules, and rules from plugins.",
@@ -28761,6 +28803,9 @@ var CoreConfigTypes = {
28761
28803
  ConfigApis,
28762
28804
  ConfigGovernance,
28763
28805
  ConfigHTTP,
28806
+ Client,
28807
+ ClientPagination,
28808
+ ClientPaginationRule,
28764
28809
  Where,
28765
28810
  BuiltinRule,
28766
28811
  CustomRule,
@@ -38192,6 +38237,30 @@ async function loadPluginModule(absolutePluginPath) {
38192
38237
  }
38193
38238
 
38194
38239
  // ../core/lib/config/config-resolvers.js
38240
+ function mergeClientBlocks(base, overrides) {
38241
+ const merged = { ...base, ...overrides };
38242
+ const basePagination = base.pagination;
38243
+ const overridePagination = overrides.pagination;
38244
+ if (isPlainObject(basePagination) && isPlainObject(overridePagination)) {
38245
+ const pagination = { ...basePagination, ...overridePagination };
38246
+ if (basePagination.operations || overridePagination.operations) {
38247
+ pagination.operations = {
38248
+ ...isPlainObject(basePagination.operations) ? basePagination.operations : {},
38249
+ ...isPlainObject(overridePagination.operations) ? overridePagination.operations : {}
38250
+ };
38251
+ }
38252
+ if (Array.isArray(basePagination.exclude) || Array.isArray(overridePagination.exclude)) {
38253
+ pagination.exclude = [
38254
+ .../* @__PURE__ */ new Set([
38255
+ ...Array.isArray(basePagination.exclude) ? basePagination.exclude : [],
38256
+ ...Array.isArray(overridePagination.exclude) ? overridePagination.exclude : []
38257
+ ])
38258
+ ];
38259
+ }
38260
+ merged.pagination = pagination;
38261
+ }
38262
+ return merged;
38263
+ }
38195
38264
  async function resolveConfig({ rawConfigDocument, configPath, externalRefResolver, customExtends }) {
38196
38265
  const config = rawConfigDocument === void 0 ? DEFAULT_CONFIG : rawConfigDocument.parsed;
38197
38266
  if (customExtends !== void 0 && isPlainObject(config)) {
@@ -38225,7 +38294,8 @@ async function resolveConfig({ rawConfigDocument, configPath, externalRefResolve
38225
38294
  if (bundledConfig.apis) {
38226
38295
  bundledConfig.apis = Object.fromEntries(Object.entries(bundledConfig.apis).map(([key, apiConfig]) => {
38227
38296
  const mergedConfig = mergeExtends([bundledConfig, apiConfig]);
38228
- return [key, { ...apiConfig, ...mergedConfig }];
38297
+ const client = isPlainObject(bundledConfig.client) && isPlainObject(apiConfig.client) ? { client: mergeClientBlocks(bundledConfig.client, apiConfig.client) } : {};
38298
+ return [key, { ...apiConfig, ...mergedConfig, ...client }];
38229
38299
  }));
38230
38300
  }
38231
38301
  const pluginPaths = pluginsOrPaths.length ? pluginsOrPaths.map((p2) => isPluginResolveInfo(p2) && p2.isModule ? p2.rawPath : p2.absolutePath && path8.relative(rootConfigDir, p2.absolutePath)).filter(isDefined) : void 0;
@@ -39163,7 +39233,7 @@ async function lintFromString(opts) {
39163
39233
  async function lintDocument(opts) {
39164
39234
  const { document, customTypes, externalRefResolver, config } = opts;
39165
39235
  if (isGraphqlRef(document.source.absoluteRef)) {
39166
- const { lintGraphqlDocument } = await import("./ZK3QRKL5.js");
39236
+ const { lintGraphqlDocument } = await import("./TWBSRL2M.js");
39167
39237
  return lintGraphqlDocument({ document, config });
39168
39238
  }
39169
39239
  const specVersion = detectSpec(document.parsed);
@@ -1,5 +1,9 @@
1
1
  import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
2
4
  const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
3
7
 
4
8
  // src/utils/constants.ts
5
9
  var OTEL_URL = "https://otel.cloud.redocly.com";
@@ -1,14 +1,18 @@
1
1
  import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
2
4
  const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
3
7
  import {
4
8
  esm_exports,
5
9
  init_esm
6
- } from "./XHPY6UJF.js";
10
+ } from "./LJH34AHG.js";
7
11
  import {
8
12
  __commonJS,
9
13
  __require,
10
14
  __toCommonJS
11
- } from "./5ILQMFXK.js";
15
+ } from "./YDPUXTSG.js";
12
16
 
13
17
  // ../../node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-linux.js
14
18
  var require_getMachineId_linux = __commonJS({
@@ -1,9 +1,13 @@
1
1
  import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
2
4
  const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
3
7
  import {
4
8
  __commonJS,
5
9
  __require
6
- } from "./5ILQMFXK.js";
10
+ } from "./YDPUXTSG.js";
7
11
 
8
12
  // ../../node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/execAsync.js
9
13
  var require_execAsync = __commonJS({