@redocly/client-generator 0.0.0-snapshot.1784554531
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 +506 -0
- package/lib/config-file.d.ts +8 -0
- package/lib/config-file.d.ts.map +1 -0
- package/lib/config-file.js +32 -0
- package/lib/config-file.js.map +1 -0
- package/lib/config.d.ts +63 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +2 -0
- package/lib/config.js.map +1 -0
- package/lib/emitters/auth.d.ts +14 -0
- package/lib/emitters/auth.d.ts.map +1 -0
- package/lib/emitters/auth.js +30 -0
- package/lib/emitters/auth.js.map +1 -0
- package/lib/emitters/client-assembly.d.ts +15 -0
- package/lib/emitters/client-assembly.d.ts.map +1 -0
- package/lib/emitters/client-assembly.js +299 -0
- package/lib/emitters/client-assembly.js.map +1 -0
- package/lib/emitters/descriptor.d.ts +22 -0
- package/lib/emitters/descriptor.d.ts.map +1 -0
- package/lib/emitters/descriptor.js +207 -0
- package/lib/emitters/descriptor.js.map +1 -0
- package/lib/emitters/emit-options.d.ts +71 -0
- package/lib/emitters/emit-options.d.ts.map +1 -0
- package/lib/emitters/emit-options.js +28 -0
- package/lib/emitters/emit-options.js.map +1 -0
- package/lib/emitters/faker.d.ts +11 -0
- package/lib/emitters/faker.d.ts.map +1 -0
- package/lib/emitters/faker.js +204 -0
- package/lib/emitters/faker.js.map +1 -0
- package/lib/emitters/identifier.d.ts +28 -0
- package/lib/emitters/identifier.d.ts.map +1 -0
- package/lib/emitters/identifier.js +94 -0
- package/lib/emitters/identifier.js.map +1 -0
- package/lib/emitters/inline-runtime.d.ts +11 -0
- package/lib/emitters/inline-runtime.d.ts.map +1 -0
- package/lib/emitters/inline-runtime.js +97 -0
- package/lib/emitters/inline-runtime.js.map +1 -0
- package/lib/emitters/jsdoc.d.ts +9 -0
- package/lib/emitters/jsdoc.d.ts.map +1 -0
- package/lib/emitters/jsdoc.js +83 -0
- package/lib/emitters/jsdoc.js.map +1 -0
- package/lib/emitters/mock.d.ts +22 -0
- package/lib/emitters/mock.d.ts.map +1 -0
- package/lib/emitters/mock.js +243 -0
- package/lib/emitters/mock.js.map +1 -0
- package/lib/emitters/operation-aliases.d.ts +27 -0
- package/lib/emitters/operation-aliases.d.ts.map +1 -0
- package/lib/emitters/operation-aliases.js +138 -0
- package/lib/emitters/operation-aliases.js.map +1 -0
- package/lib/emitters/operation-signature.d.ts +23 -0
- package/lib/emitters/operation-signature.d.ts.map +1 -0
- package/lib/emitters/operation-signature.js +34 -0
- package/lib/emitters/operation-signature.js.map +1 -0
- package/lib/emitters/operation-types.d.ts +32 -0
- package/lib/emitters/operation-types.d.ts.map +1 -0
- package/lib/emitters/operation-types.js +117 -0
- package/lib/emitters/operation-types.js.map +1 -0
- package/lib/emitters/operations.d.ts +39 -0
- package/lib/emitters/operations.d.ts.map +1 -0
- package/lib/emitters/operations.js +33 -0
- package/lib/emitters/operations.js.map +1 -0
- package/lib/emitters/pagination.d.ts +69 -0
- package/lib/emitters/pagination.d.ts.map +1 -0
- package/lib/emitters/pagination.js +223 -0
- package/lib/emitters/pagination.js.map +1 -0
- package/lib/emitters/runtime-sources.d.ts +16 -0
- package/lib/emitters/runtime-sources.d.ts.map +1 -0
- package/lib/emitters/runtime-sources.js +16 -0
- package/lib/emitters/runtime-sources.js.map +1 -0
- package/lib/emitters/sample.d.ts +27 -0
- package/lib/emitters/sample.d.ts.map +1 -0
- package/lib/emitters/sample.js +161 -0
- package/lib/emitters/sample.js.map +1 -0
- package/lib/emitters/setup-bake.d.ts +15 -0
- package/lib/emitters/setup-bake.d.ts.map +1 -0
- package/lib/emitters/setup-bake.js +65 -0
- package/lib/emitters/setup-bake.js.map +1 -0
- package/lib/emitters/sse.d.ts +10 -0
- package/lib/emitters/sse.d.ts.map +1 -0
- package/lib/emitters/sse.js +46 -0
- package/lib/emitters/sse.js.map +1 -0
- package/lib/emitters/support.d.ts +13 -0
- package/lib/emitters/support.d.ts.map +1 -0
- package/lib/emitters/support.js +21 -0
- package/lib/emitters/support.js.map +1 -0
- package/lib/emitters/swr.d.ts +10 -0
- package/lib/emitters/swr.d.ts.map +1 -0
- package/lib/emitters/swr.js +88 -0
- package/lib/emitters/swr.js.map +1 -0
- package/lib/emitters/tanstack-query.d.ts +11 -0
- package/lib/emitters/tanstack-query.d.ts.map +1 -0
- package/lib/emitters/tanstack-query.js +68 -0
- package/lib/emitters/tanstack-query.js.map +1 -0
- package/lib/emitters/transformers.d.ts +11 -0
- package/lib/emitters/transformers.d.ts.map +1 -0
- package/lib/emitters/transformers.js +334 -0
- package/lib/emitters/transformers.js.map +1 -0
- package/lib/emitters/ts.d.ts +40 -0
- package/lib/emitters/ts.d.ts.map +1 -0
- package/lib/emitters/ts.js +104 -0
- package/lib/emitters/ts.js.map +1 -0
- package/lib/emitters/type-guards.d.ts +21 -0
- package/lib/emitters/type-guards.d.ts.map +1 -0
- package/lib/emitters/type-guards.js +183 -0
- package/lib/emitters/type-guards.js.map +1 -0
- package/lib/emitters/types.d.ts +23 -0
- package/lib/emitters/types.d.ts.map +1 -0
- package/lib/emitters/types.js +127 -0
- package/lib/emitters/types.js.map +1 -0
- package/lib/emitters/wrapper-support.d.ts +40 -0
- package/lib/emitters/wrapper-support.d.ts.map +1 -0
- package/lib/emitters/wrapper-support.js +112 -0
- package/lib/emitters/wrapper-support.js.map +1 -0
- package/lib/emitters/zod.d.ts +13 -0
- package/lib/emitters/zod.d.ts.map +1 -0
- package/lib/emitters/zod.js +344 -0
- package/lib/emitters/zod.js.map +1 -0
- package/lib/errors.d.ts +4 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +7 -0
- package/lib/errors.js.map +1 -0
- package/lib/generators/anchor.d.ts +9 -0
- package/lib/generators/anchor.d.ts.map +1 -0
- package/lib/generators/anchor.js +10 -0
- package/lib/generators/anchor.js.map +1 -0
- package/lib/generators/index.d.ts +15 -0
- package/lib/generators/index.d.ts.map +1 -0
- package/lib/generators/index.js +62 -0
- package/lib/generators/index.js.map +1 -0
- package/lib/generators/mock.d.ts +9 -0
- package/lib/generators/mock.d.ts.map +1 -0
- package/lib/generators/mock.js +23 -0
- package/lib/generators/mock.js.map +1 -0
- package/lib/generators/resolve.d.ts +19 -0
- package/lib/generators/resolve.d.ts.map +1 -0
- package/lib/generators/resolve.js +68 -0
- package/lib/generators/resolve.js.map +1 -0
- package/lib/generators/sdk.d.ts +12 -0
- package/lib/generators/sdk.d.ts.map +1 -0
- package/lib/generators/sdk.js +26 -0
- package/lib/generators/sdk.js.map +1 -0
- package/lib/generators/swr.d.ts +15 -0
- package/lib/generators/swr.d.ts.map +1 -0
- package/lib/generators/swr.js +27 -0
- package/lib/generators/swr.js.map +1 -0
- package/lib/generators/tanstack-query.d.ts +17 -0
- package/lib/generators/tanstack-query.d.ts.map +1 -0
- package/lib/generators/tanstack-query.js +30 -0
- package/lib/generators/tanstack-query.js.map +1 -0
- package/lib/generators/transformers.d.ts +19 -0
- package/lib/generators/transformers.d.ts.map +1 -0
- package/lib/generators/transformers.js +28 -0
- package/lib/generators/transformers.js.map +1 -0
- package/lib/generators/types.d.ts +66 -0
- package/lib/generators/types.d.ts.map +1 -0
- package/lib/generators/types.js +2 -0
- package/lib/generators/types.js.map +1 -0
- package/lib/generators/zod.d.ts +14 -0
- package/lib/generators/zod.d.ts.map +1 -0
- package/lib/generators/zod.js +23 -0
- package/lib/generators/zod.js.map +1 -0
- package/lib/index.d.ts +29 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +119 -0
- package/lib/index.js.map +1 -0
- package/lib/intermediate-representation/build.d.ts +4 -0
- package/lib/intermediate-representation/build.d.ts.map +1 -0
- package/lib/intermediate-representation/build.js +761 -0
- package/lib/intermediate-representation/build.js.map +1 -0
- package/lib/intermediate-representation/model.d.ts +275 -0
- package/lib/intermediate-representation/model.d.ts.map +1 -0
- package/lib/intermediate-representation/model.js +5 -0
- package/lib/intermediate-representation/model.js.map +1 -0
- package/lib/intermediate-representation/normalize-swagger2.d.ts +10 -0
- package/lib/intermediate-representation/normalize-swagger2.d.ts.map +1 -0
- package/lib/intermediate-representation/normalize-swagger2.js +210 -0
- package/lib/intermediate-representation/normalize-swagger2.js.map +1 -0
- package/lib/intermediate-representation/sanitize-identifiers.d.ts +30 -0
- package/lib/intermediate-representation/sanitize-identifiers.d.ts.map +1 -0
- package/lib/intermediate-representation/sanitize-identifiers.js +153 -0
- package/lib/intermediate-representation/sanitize-identifiers.js.map +1 -0
- package/lib/loader.d.ts +4 -0
- package/lib/loader.d.ts.map +1 -0
- package/lib/loader.js +14 -0
- package/lib/loader.js.map +1 -0
- package/lib/plugin.d.ts +19 -0
- package/lib/plugin.d.ts.map +1 -0
- package/lib/plugin.js +41 -0
- package/lib/plugin.js.map +1 -0
- package/lib/runtime/auth.d.ts +15 -0
- package/lib/runtime/auth.d.ts.map +1 -0
- package/lib/runtime/auth.js +67 -0
- package/lib/runtime/auth.js.map +1 -0
- package/lib/runtime/create-client.d.ts +35 -0
- package/lib/runtime/create-client.d.ts.map +1 -0
- package/lib/runtime/create-client.js +215 -0
- package/lib/runtime/create-client.js.map +1 -0
- package/lib/runtime/errors.d.ts +11 -0
- package/lib/runtime/errors.d.ts.map +1 -0
- package/lib/runtime/errors.js +25 -0
- package/lib/runtime/errors.js.map +1 -0
- package/lib/runtime/index.d.ts +14 -0
- package/lib/runtime/index.d.ts.map +1 -0
- package/lib/runtime/index.js +24 -0
- package/lib/runtime/index.js.map +1 -0
- package/lib/runtime/multipart.d.ts +9 -0
- package/lib/runtime/multipart.d.ts.map +1 -0
- package/lib/runtime/multipart.js +31 -0
- package/lib/runtime/multipart.js.map +1 -0
- package/lib/runtime/paginate.d.ts +36 -0
- package/lib/runtime/paginate.d.ts.map +1 -0
- package/lib/runtime/paginate.js +99 -0
- package/lib/runtime/paginate.js.map +1 -0
- package/lib/runtime/parse.d.ts +9 -0
- package/lib/runtime/parse.d.ts.map +1 -0
- package/lib/runtime/parse.js +37 -0
- package/lib/runtime/parse.js.map +1 -0
- package/lib/runtime/retry.d.ts +15 -0
- package/lib/runtime/retry.d.ts.map +1 -0
- package/lib/runtime/retry.js +51 -0
- package/lib/runtime/retry.js.map +1 -0
- package/lib/runtime/send.d.ts +31 -0
- package/lib/runtime/send.d.ts.map +1 -0
- package/lib/runtime/send.js +138 -0
- package/lib/runtime/send.js.map +1 -0
- package/lib/runtime/setup.d.ts +11 -0
- package/lib/runtime/setup.d.ts.map +1 -0
- package/lib/runtime/setup.js +13 -0
- package/lib/runtime/setup.js.map +1 -0
- package/lib/runtime/sse.d.ts +21 -0
- package/lib/runtime/sse.d.ts.map +1 -0
- package/lib/runtime/sse.js +163 -0
- package/lib/runtime/sse.js.map +1 -0
- package/lib/runtime/types.d.ts +232 -0
- package/lib/runtime/types.d.ts.map +1 -0
- package/lib/runtime/types.js +9 -0
- package/lib/runtime/types.js.map +1 -0
- package/lib/runtime/url.d.ts +25 -0
- package/lib/runtime/url.d.ts.map +1 -0
- package/lib/runtime/url.js +97 -0
- package/lib/runtime/url.js.map +1 -0
- package/lib/runtime-contract.d.ts +27 -0
- package/lib/runtime-contract.d.ts.map +1 -0
- package/lib/runtime-contract.js +14 -0
- package/lib/runtime-contract.js.map +1 -0
- package/lib/types.d.ts +118 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Resolves a `generators` selection (a mix of built-in names, inline custom generators, and import
|
|
2
|
+
// specifiers) into a registry keyed by name plus the ordered list of names to run. This is the only
|
|
3
|
+
// async, side-effecting step in the generator pipeline: a specifier that is neither a built-in nor an
|
|
4
|
+
// already-registered custom name is dynamically `import()`ed (a standard Node ESM dynamic import), its
|
|
5
|
+
// default (or `generator`) export validated, and registered under its declared name. Built-ins are
|
|
6
|
+
// seeded fresh per call (see `builtinGenerators`), so registration never mutates the built-in table.
|
|
7
|
+
import { isPlainObject } from '@redocly/openapi-core';
|
|
8
|
+
import { isAbsolute, resolve as resolvePath } from 'node:path';
|
|
9
|
+
import { pathToFileURL } from 'node:url';
|
|
10
|
+
import { NotSupportedError } from '../errors.js';
|
|
11
|
+
import { builtinGenerators } from './index.js';
|
|
12
|
+
/**
|
|
13
|
+
* Build the run list + registry for a `generators` selection. Each entry is, in order of preference,
|
|
14
|
+
* a built-in name, an already-registered custom name, or an import specifier (path or package).
|
|
15
|
+
*/
|
|
16
|
+
export async function resolveGenerators(entries, options = {}) {
|
|
17
|
+
const registry = builtinGenerators();
|
|
18
|
+
for (const custom of options.customGenerators ?? [])
|
|
19
|
+
register(registry, custom);
|
|
20
|
+
const selected = [];
|
|
21
|
+
for (const entry of entries) {
|
|
22
|
+
if (registry.has(entry)) {
|
|
23
|
+
selected.push(entry);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const custom = await importGenerator(entry, options.configDir ?? process.cwd());
|
|
27
|
+
register(registry, custom);
|
|
28
|
+
selected.push(custom.name);
|
|
29
|
+
}
|
|
30
|
+
return { selected, registry };
|
|
31
|
+
}
|
|
32
|
+
/** Validate a custom generator and add it under its name, rejecting collisions. */
|
|
33
|
+
function register(registry, custom) {
|
|
34
|
+
if (!isPlainObject(custom) ||
|
|
35
|
+
typeof custom.name !== 'string' ||
|
|
36
|
+
custom.name === '' ||
|
|
37
|
+
typeof custom.run !== 'function') {
|
|
38
|
+
throw new NotSupportedError('Invalid custom generator: expected an object with a non-empty string `name` and a `run` function (build one with `defineGenerator`).');
|
|
39
|
+
}
|
|
40
|
+
if (registry.has(custom.name)) {
|
|
41
|
+
throw new NotSupportedError(`Generator name "${custom.name}" collides with an existing generator. Rename the custom generator.`);
|
|
42
|
+
}
|
|
43
|
+
registry.set(custom.name, {
|
|
44
|
+
run: custom.run,
|
|
45
|
+
requires: custom.requires,
|
|
46
|
+
errorModes: custom.errorModes,
|
|
47
|
+
dateTypes: custom.dateTypes,
|
|
48
|
+
runtimes: custom.runtimes,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/** Dynamically import a generator from a path (resolved against `configDir`) or package specifier. */
|
|
52
|
+
async function importGenerator(specifier, configDir) {
|
|
53
|
+
const isPath = specifier.startsWith('.') || isAbsolute(specifier);
|
|
54
|
+
const target = isPath ? pathToFileURL(resolvePath(configDir, specifier)).href : specifier;
|
|
55
|
+
let module;
|
|
56
|
+
try {
|
|
57
|
+
module = (await import(target));
|
|
58
|
+
}
|
|
59
|
+
catch (cause) {
|
|
60
|
+
throw new NotSupportedError(`Could not load generator "${specifier}": ${cause.message}`);
|
|
61
|
+
}
|
|
62
|
+
const generator = module.default ?? module.generator;
|
|
63
|
+
if (generator === undefined) {
|
|
64
|
+
throw new NotSupportedError(`Generator module "${specifier}" must export a generator (a default export or a \`generator\` export built with \`defineGenerator\`).`);
|
|
65
|
+
}
|
|
66
|
+
return generator;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/generators/resolve.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,oGAAoG;AACpG,sGAAsG;AACtG,uGAAuG;AACvG,mGAAmG;AACnG,qGAAqG;AAErG,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAiB/C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAAiB,EACjB,UAA0B,EAAE;IAE5B,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAC;IACrC,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,gBAA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AE,MAAM,CAAC,SAAS;QAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B,CAAC,CAAC;AACL,CAAC;AAED,sGAAsG;AACtG,KAAK,UAAU,eAAe,CAAC,SAAiB,EAAE,SAAiB;IACjE,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC;IAClE,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,WAAW,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1F,IAAI,MAA+B,CAAC;IACpC,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,CAA4B,CAAC;IAC7D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,iBAAiB,CACzB,6BAA6B,SAAS,MAAO,KAAe,CAAC,OAAO,EAAE,CACvE,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,SAAS,CAAC;IACrD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,iBAAiB,CACzB,qBAAqB,SAAS,wGAAwG,CACvI,CAAC;IACJ,CAAC;IACD,OAAO,SAA4B,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Generator } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The default generator: the full typed client (model types + runtime + endpoints).
|
|
4
|
+
* Other generators (zod, framework hooks) emit *additional* files alongside.
|
|
5
|
+
*
|
|
6
|
+
* `single` mode writes the whole client to the `--output` path. `split` mode derives
|
|
7
|
+
* two sibling files from that anchor — `<stem>.schemas.ts` (model types, enums,
|
|
8
|
+
* const-objects, type guards; skipped when the document declares no schemas) and
|
|
9
|
+
* `<stem>.ts` (everything else, which `export *`s the schemas module).
|
|
10
|
+
*/
|
|
11
|
+
export declare const sdkGenerator: Generator;
|
|
12
|
+
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/generators/sdk.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,SAY1B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { emitClientSingleFile, emitClientSplit } from '../emitters/client-assembly.js';
|
|
3
|
+
import { anchor } from './anchor.js';
|
|
4
|
+
/**
|
|
5
|
+
* The default generator: the full typed client (model types + runtime + endpoints).
|
|
6
|
+
* Other generators (zod, framework hooks) emit *additional* files alongside.
|
|
7
|
+
*
|
|
8
|
+
* `single` mode writes the whole client to the `--output` path. `split` mode derives
|
|
9
|
+
* two sibling files from that anchor — `<stem>.schemas.ts` (model types, enums,
|
|
10
|
+
* const-objects, type guards; skipped when the document declares no schemas) and
|
|
11
|
+
* `<stem>.ts` (everything else, which `export *`s the schemas module).
|
|
12
|
+
*/
|
|
13
|
+
export const sdkGenerator = ({ model, outputPath, outputMode, emit }) => {
|
|
14
|
+
if (outputMode === 'split') {
|
|
15
|
+
const { dir, stem } = anchor(outputPath);
|
|
16
|
+
const { entry, schemas } = emitClientSplit(model, emit, stem);
|
|
17
|
+
return [
|
|
18
|
+
...(schemas === undefined
|
|
19
|
+
? []
|
|
20
|
+
: [{ path: join(dir, `${stem}.schemas.ts`), content: schemas }]),
|
|
21
|
+
{ path: outputPath, content: entry },
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
return [{ path: outputPath, content: emitClientSingleFile(model, emit) }];
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/generators/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAc,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;IACjF,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QACzC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9D,OAAO;YACL,GAAG,CAAC,OAAO,KAAK,SAAS;gBACvB,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,aAAa,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YAClE,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE;SACrC,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,oBAAoB,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5E,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Generator } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The swr generator: a standalone `<stem>.swr.ts` module of SWR hooks wrapping the
|
|
4
|
+
* sdk operation functions — `<op>Key` + `use<Op>` (`useSWR`) per query (GET/HEAD),
|
|
5
|
+
* `use<Op>` (`useSWRMutation`) per mutation. It imports the operation functions +
|
|
6
|
+
* their `<Op>Variables` types from the sdk entry (`./<stem>.js`), so it requires the
|
|
7
|
+
* `sdk` generator and targets its throw-mode operation functions. `swr`/`swr/mutation`
|
|
8
|
+
* are the consumer's peer; the sdk client stays dependency-free.
|
|
9
|
+
*
|
|
10
|
+
* Output-mode-agnostic: `./<stem>.js` resolves to the single-file client or the
|
|
11
|
+
* multi-file barrel at the output anchor either way. Emits nothing when there are
|
|
12
|
+
* no operations.
|
|
13
|
+
*/
|
|
14
|
+
export declare const swrGenerator: Generator;
|
|
15
|
+
//# sourceMappingURL=swr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swr.d.ts","sourceRoot":"","sources":["../../src/generators/swr.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,EAAE,SAQ1B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { HEADER } from '../emitters/emit-options.js';
|
|
3
|
+
import { renderSwrModule } from '../emitters/swr.js';
|
|
4
|
+
import { anchor } from './anchor.js';
|
|
5
|
+
/**
|
|
6
|
+
* The swr generator: a standalone `<stem>.swr.ts` module of SWR hooks wrapping the
|
|
7
|
+
* sdk operation functions — `<op>Key` + `use<Op>` (`useSWR`) per query (GET/HEAD),
|
|
8
|
+
* `use<Op>` (`useSWRMutation`) per mutation. It imports the operation functions +
|
|
9
|
+
* their `<Op>Variables` types from the sdk entry (`./<stem>.js`), so it requires the
|
|
10
|
+
* `sdk` generator and targets its throw-mode operation functions. `swr`/`swr/mutation`
|
|
11
|
+
* are the consumer's peer; the sdk client stays dependency-free.
|
|
12
|
+
*
|
|
13
|
+
* Output-mode-agnostic: `./<stem>.js` resolves to the single-file client or the
|
|
14
|
+
* multi-file barrel at the output anchor either way. Emits nothing when there are
|
|
15
|
+
* no operations.
|
|
16
|
+
*/
|
|
17
|
+
export const swrGenerator = ({ model, outputPath, emit }) => {
|
|
18
|
+
const { dir, stem } = anchor(outputPath);
|
|
19
|
+
const content = renderSwrModule(model, {
|
|
20
|
+
argsStyle: emit.argsStyle ?? 'flat',
|
|
21
|
+
sdkModule: `./${stem}.js`,
|
|
22
|
+
});
|
|
23
|
+
if (content === '')
|
|
24
|
+
return [];
|
|
25
|
+
return [{ path: join(dir, `${stem}.swr.ts`), content: `${HEADER}\n\n${content}` }];
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=swr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swr.js","sourceRoot":"","sources":["../../src/generators/swr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,YAAY,GAAc,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;IACrE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,EAAE;QACrC,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,MAAM;QACnC,SAAS,EAAE,KAAK,IAAI,KAAK;KAC1B,CAAC,CAAC;IACH,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,OAAO,OAAO,EAAE,EAAE,CAAC,CAAC;AACrF,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Generator } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The tanstack-query generator: a standalone `<stem>.tanstack.ts` module of
|
|
4
|
+
* TanStack Query v5 factories that wrap the sdk operation functions —
|
|
5
|
+
* `<op>QueryKey`/`<op>Options` per query (GET/HEAD), `<op>Mutation` per mutation.
|
|
6
|
+
* It imports the operation functions + their `<Op>Variables` types from the sdk
|
|
7
|
+
* entry (`./<stem>.js`), so it requires the `sdk` generator and targets its
|
|
8
|
+
* throw-mode operation functions. The framework-agnostic `queryOptions` helper is
|
|
9
|
+
* imported from `@tanstack/${queryFramework}-query` (`react` default; the body is
|
|
10
|
+
* byte-identical across frameworks — `@tanstack/<framework>-query` is the consumer's peer).
|
|
11
|
+
*
|
|
12
|
+
* Output-mode-agnostic: `./<stem>.js` resolves to the single-file client or the
|
|
13
|
+
* multi-file barrel at the output anchor either way. Emits nothing when there are
|
|
14
|
+
* no operations.
|
|
15
|
+
*/
|
|
16
|
+
export declare const tanstackQueryGenerator: Generator;
|
|
17
|
+
//# sourceMappingURL=tanstack-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tanstack-query.d.ts","sourceRoot":"","sources":["../../src/generators/tanstack-query.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,EAAE,SASpC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { HEADER } from '../emitters/emit-options.js';
|
|
3
|
+
import { renderTanstackModule } from '../emitters/tanstack-query.js';
|
|
4
|
+
import { anchor } from './anchor.js';
|
|
5
|
+
/**
|
|
6
|
+
* The tanstack-query generator: a standalone `<stem>.tanstack.ts` module of
|
|
7
|
+
* TanStack Query v5 factories that wrap the sdk operation functions —
|
|
8
|
+
* `<op>QueryKey`/`<op>Options` per query (GET/HEAD), `<op>Mutation` per mutation.
|
|
9
|
+
* It imports the operation functions + their `<Op>Variables` types from the sdk
|
|
10
|
+
* entry (`./<stem>.js`), so it requires the `sdk` generator and targets its
|
|
11
|
+
* throw-mode operation functions. The framework-agnostic `queryOptions` helper is
|
|
12
|
+
* imported from `@tanstack/${queryFramework}-query` (`react` default; the body is
|
|
13
|
+
* byte-identical across frameworks — `@tanstack/<framework>-query` is the consumer's peer).
|
|
14
|
+
*
|
|
15
|
+
* Output-mode-agnostic: `./<stem>.js` resolves to the single-file client or the
|
|
16
|
+
* multi-file barrel at the output anchor either way. Emits nothing when there are
|
|
17
|
+
* no operations.
|
|
18
|
+
*/
|
|
19
|
+
export const tanstackQueryGenerator = ({ model, outputPath, emit }) => {
|
|
20
|
+
const { dir, stem } = anchor(outputPath);
|
|
21
|
+
const content = renderTanstackModule(model, {
|
|
22
|
+
argsStyle: emit.argsStyle ?? 'flat',
|
|
23
|
+
sdkModule: `./${stem}.js`,
|
|
24
|
+
framework: emit.queryFramework ?? 'react',
|
|
25
|
+
});
|
|
26
|
+
if (content === '')
|
|
27
|
+
return [];
|
|
28
|
+
return [{ path: join(dir, `${stem}.tanstack.ts`), content: `${HEADER}\n\n${content}` }];
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=tanstack-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tanstack-query.js","sourceRoot":"","sources":["../../src/generators/tanstack-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAc,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;IAC/E,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,oBAAoB,CAAC,KAAK,EAAE;QAC1C,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,MAAM;QACnC,SAAS,EAAE,KAAK,IAAI,KAAK;QACzB,SAAS,EAAE,IAAI,CAAC,cAAc,IAAI,OAAO;KAC1C,CAAC,CAAC;IACH,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,cAAc,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,OAAO,OAAO,EAAE,EAAE,CAAC,CAAC;AAC1F,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Generator } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The transformers generator: a standalone `<stem>.transformers.ts` module of
|
|
4
|
+
* `transform<Name>(data: <Name>): <Name>` functions, one per IR named schema
|
|
5
|
+
* that (recursively) carries a `date-time`/`date` field. Each walks the value
|
|
6
|
+
* and rewrites wire ISO strings to `new Date(...)` in place, so the runtime
|
|
7
|
+
* value matches the sdk's `--date-type Date` types — pair the two.
|
|
8
|
+
*
|
|
9
|
+
* Standalone — the consumer pipes responses through it
|
|
10
|
+
* (`transformPet(await getPet(id))`); the sdk client itself stays zero-dep
|
|
11
|
+
* (Date is a web standard). The transformers import only the schema TYPES from
|
|
12
|
+
* the sdk entry (`./<stem>.js`) and call each other as siblings.
|
|
13
|
+
*
|
|
14
|
+
* Output-mode-agnostic: it reads only `model.schemas` and emits a single module
|
|
15
|
+
* beside the client regardless of how the sdk partitions its files. Emits
|
|
16
|
+
* nothing when no schema has a date field (nothing to transform).
|
|
17
|
+
*/
|
|
18
|
+
export declare const transformersGenerator: Generator;
|
|
19
|
+
//# sourceMappingURL=transformers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformers.d.ts","sourceRoot":"","sources":["../../src/generators/transformers.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAKnC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { HEADER } from '../emitters/emit-options.js';
|
|
3
|
+
import { renderTransformersModule } from '../emitters/transformers.js';
|
|
4
|
+
import { anchor } from './anchor.js';
|
|
5
|
+
/**
|
|
6
|
+
* The transformers generator: a standalone `<stem>.transformers.ts` module of
|
|
7
|
+
* `transform<Name>(data: <Name>): <Name>` functions, one per IR named schema
|
|
8
|
+
* that (recursively) carries a `date-time`/`date` field. Each walks the value
|
|
9
|
+
* and rewrites wire ISO strings to `new Date(...)` in place, so the runtime
|
|
10
|
+
* value matches the sdk's `--date-type Date` types — pair the two.
|
|
11
|
+
*
|
|
12
|
+
* Standalone — the consumer pipes responses through it
|
|
13
|
+
* (`transformPet(await getPet(id))`); the sdk client itself stays zero-dep
|
|
14
|
+
* (Date is a web standard). The transformers import only the schema TYPES from
|
|
15
|
+
* the sdk entry (`./<stem>.js`) and call each other as siblings.
|
|
16
|
+
*
|
|
17
|
+
* Output-mode-agnostic: it reads only `model.schemas` and emits a single module
|
|
18
|
+
* beside the client regardless of how the sdk partitions its files. Emits
|
|
19
|
+
* nothing when no schema has a date field (nothing to transform).
|
|
20
|
+
*/
|
|
21
|
+
export const transformersGenerator = ({ model, outputPath }) => {
|
|
22
|
+
const { dir, stem } = anchor(outputPath);
|
|
23
|
+
const content = renderTransformersModule(model, { sdkModule: `./${stem}.js` });
|
|
24
|
+
if (content === '')
|
|
25
|
+
return [];
|
|
26
|
+
return [{ path: join(dir, `${stem}.transformers.ts`), content: `${HEADER}\n\n${content}` }];
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=transformers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformers.js","sourceRoot":"","sources":["../../src/generators/transformers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAc,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE;IACxE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,wBAAwB,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC;IAC/E,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,kBAAkB,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,OAAO,OAAO,EAAE,EAAE,CAAC,CAAC;AAC9F,CAAC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { EmitOptions } from '../emitters/emit-options.js';
|
|
2
|
+
import type { ErrorMode } from '../emitters/operations.js';
|
|
3
|
+
import type { DateType } from '../emitters/types.js';
|
|
4
|
+
import type { ApiModel } from '../intermediate-representation/model.js';
|
|
5
|
+
/**
|
|
6
|
+
* How the generated client is partitioned across files.
|
|
7
|
+
*
|
|
8
|
+
* - `single` (default): one self-contained file.
|
|
9
|
+
* - `split`: schema types + guards in a sibling `<stem>.schemas.ts`; everything
|
|
10
|
+
* else in the entry file, which re-exports the schemas module.
|
|
11
|
+
*/
|
|
12
|
+
export type OutputMode = 'single' | 'split';
|
|
13
|
+
/** A single file the generator will write to disk. */
|
|
14
|
+
export type GeneratedFile = {
|
|
15
|
+
path: string;
|
|
16
|
+
content: string;
|
|
17
|
+
};
|
|
18
|
+
/** The first-party generators the registry knows. */
|
|
19
|
+
export type GeneratorName = 'sdk' | 'zod' | 'tanstack-query' | 'swr' | 'transformers' | 'mock';
|
|
20
|
+
/** Everything a generator needs to produce its files. */
|
|
21
|
+
export type GeneratorInput = {
|
|
22
|
+
model: ApiModel;
|
|
23
|
+
/** The `--output` anchor path. */
|
|
24
|
+
outputPath: string;
|
|
25
|
+
/** File partitioning the generator should honor. */
|
|
26
|
+
outputMode: OutputMode;
|
|
27
|
+
/** Emit options — serverUrl, runtime, and the generator knobs (dateType, mockData, queryFramework, …); see `EmitOptions`. */
|
|
28
|
+
emit: EmitOptions;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* A Generator turns the IR + options into a set of files. Each lives behind a
|
|
32
|
+
* name in the registry — the built-ins, plus custom generators registered
|
|
33
|
+
* through the plugin API (see `CustomGenerator`).
|
|
34
|
+
*/
|
|
35
|
+
export type Generator = (input: GeneratorInput) => GeneratedFile[];
|
|
36
|
+
/**
|
|
37
|
+
* A generator plus its declared compatibility contract. `validateGenerators`
|
|
38
|
+
* checks these *before* anything is emitted, so an incompatible selection fails
|
|
39
|
+
* fast with an actionable message instead of producing a client that won't compile.
|
|
40
|
+
*
|
|
41
|
+
* - `requires`: other generators that must also be selected (e.g. `tanstack-query`
|
|
42
|
+
* imports the sdk's operation functions, so it requires `sdk`).
|
|
43
|
+
* - `errorModes` / `dateTypes` / `runtimes`: the subset this generator supports;
|
|
44
|
+
* `undefined` means "all". (`tanstack-query` wraps throw-mode functions, so it
|
|
45
|
+
* supports only `throw` mode; `transformers` only type-checks when the sdk types
|
|
46
|
+
* date fields as `Date`, so it supports only `dateType: 'Date'`.)
|
|
47
|
+
*/
|
|
48
|
+
export type GeneratorDescriptor = {
|
|
49
|
+
run: Generator;
|
|
50
|
+
requires?: string[];
|
|
51
|
+
errorModes?: ErrorMode[];
|
|
52
|
+
dateTypes?: DateType[];
|
|
53
|
+
/** Runtime modes this generator supports; absent = compatible with both. */
|
|
54
|
+
runtimes?: ('inline' | 'package')[];
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* A user-authored generator (the public, experimental plugin contract): a `GeneratorDescriptor`
|
|
58
|
+
* plus a unique `name` used to select it in `generators`, to satisfy other generators' `requires`,
|
|
59
|
+
* and to detect collisions. Authors build one via `defineGenerator` from the
|
|
60
|
+
* `@redocly/client-generator` entry; the resolver registers it under `name`.
|
|
61
|
+
*/
|
|
62
|
+
export type CustomGenerator = GeneratorDescriptor & {
|
|
63
|
+
/** Unique name, used in `generators` selection, `requires`, and collision detection. */
|
|
64
|
+
name: string;
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/generators/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE5C,sDAAsD;AACtD,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,KAAK,GAAG,gBAAgB,GAAG,KAAK,GAAG,cAAc,GAAG,MAAM,CAAC;AAE/F,yDAAyD;AACzD,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,QAAQ,CAAC;IAChB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,UAAU,EAAE,UAAU,CAAC;IACvB,6HAA6H;IAC7H,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,aAAa,EAAE,CAAC;AAEnE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,SAAS,CAAC;IAGf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,CAAC,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAC;CACrC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG;IAClD,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/generators/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Generator } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The zod generator: a standalone `<stem>.zod.ts` module of Zod schemas (one
|
|
4
|
+
* `export const <Name>Schema` per IR named schema), plus runtime validation for
|
|
5
|
+
* the client — the `operationSchemas` request/response map and the `zodValidation`
|
|
6
|
+
* middleware (`use(zodValidation())`). The sdk client stays dependency-free —
|
|
7
|
+
* zod is the consumer's peer, and the module imports nothing from the client.
|
|
8
|
+
*
|
|
9
|
+
* Output-mode-agnostic: emits a single module beside the client regardless of
|
|
10
|
+
* how the sdk partitions its files. Emits nothing when the model has neither
|
|
11
|
+
* named schemas nor JSON operation bodies.
|
|
12
|
+
*/
|
|
13
|
+
export declare const zodGenerator: Generator;
|
|
14
|
+
//# sourceMappingURL=zod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../src/generators/zod.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,EAAE,SAK1B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { HEADER } from '../emitters/emit-options.js';
|
|
3
|
+
import { renderZodModule } from '../emitters/zod.js';
|
|
4
|
+
import { anchor } from './anchor.js';
|
|
5
|
+
/**
|
|
6
|
+
* The zod generator: a standalone `<stem>.zod.ts` module of Zod schemas (one
|
|
7
|
+
* `export const <Name>Schema` per IR named schema), plus runtime validation for
|
|
8
|
+
* the client — the `operationSchemas` request/response map and the `zodValidation`
|
|
9
|
+
* middleware (`use(zodValidation())`). The sdk client stays dependency-free —
|
|
10
|
+
* zod is the consumer's peer, and the module imports nothing from the client.
|
|
11
|
+
*
|
|
12
|
+
* Output-mode-agnostic: emits a single module beside the client regardless of
|
|
13
|
+
* how the sdk partitions its files. Emits nothing when the model has neither
|
|
14
|
+
* named schemas nor JSON operation bodies.
|
|
15
|
+
*/
|
|
16
|
+
export const zodGenerator = ({ model, outputPath }) => {
|
|
17
|
+
const content = renderZodModule(model);
|
|
18
|
+
if (content === '')
|
|
19
|
+
return [];
|
|
20
|
+
const { dir, stem } = anchor(outputPath);
|
|
21
|
+
return [{ path: join(dir, `${stem}.zod.ts`), content: `${HEADER}\n\n${content}` }];
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=zod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.js","sourceRoot":"","sources":["../../src/generators/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,YAAY,GAAc,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE;IAC/D,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACvC,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC9B,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IACzC,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,OAAO,OAAO,EAAE,EAAE,CAAC,CAAC;AACrF,CAAC,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { EmitOptions } from './emitters/emit-options.js';
|
|
2
|
+
import type { GeneratedFile, GeneratorDescriptor, OutputMode } from './generators/types.js';
|
|
3
|
+
import type { ApiModel } from './intermediate-representation/model.js';
|
|
4
|
+
import type { GenerateClientOptions, GenerateClientResult } from './types.js';
|
|
5
|
+
export { NotSupportedError } from './errors.js';
|
|
6
|
+
export { defineClientSetup } from './runtime-contract.js';
|
|
7
|
+
export type { ClientSetup, ClientSetupConfig, Middleware, OperationContext, RequestContext, RetryConfig, RetryContext, RetryStrategy, } from './runtime-contract.js';
|
|
8
|
+
export { ApiError, createClient, mergeSetup } from './runtime/index.js';
|
|
9
|
+
export type { ApiErrorLike, AuthCredentials, Client, ClientConfig, ClientCore, OperationDescriptor, OpsShape, ParamSpec, ParseAs, QueryValue, RequestOptions, Result, SecuritySpec, ServerSentEvent, SseOptions, TokenProvider, } from './runtime/index.js';
|
|
10
|
+
export type { Config } from './config.js';
|
|
11
|
+
export type { PaginationConfig, PaginationRule, PaginationStyle } from './emitters/pagination.js';
|
|
12
|
+
export type { GenerateClientOptions, GenerateClientResult, LoadResult } from './types.js';
|
|
13
|
+
export { mergeConfig } from './config-file.js';
|
|
14
|
+
export * from './plugin.js';
|
|
15
|
+
/**
|
|
16
|
+
* Validate the generator selection (see `validateGenerators`), then run each
|
|
17
|
+
* configured generator against the IR and concatenate their files. Throws on a
|
|
18
|
+
* duplicate output path so two generators can't silently clobber each other.
|
|
19
|
+
*/
|
|
20
|
+
export declare function collectGeneratedFiles(model: ApiModel, options: {
|
|
21
|
+
outputPath: string;
|
|
22
|
+
outputMode: OutputMode;
|
|
23
|
+
emit: EmitOptions;
|
|
24
|
+
generators: string[];
|
|
25
|
+
/** The resolved registry (built-ins + custom). Defaults to the built-ins. */
|
|
26
|
+
registry?: Map<string, GeneratorDescriptor>;
|
|
27
|
+
}): GeneratedFile[];
|
|
28
|
+
export declare function generateClient(options: GenerateClientOptions): Promise<GenerateClientResult>;
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAK9D,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAGvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE9E,OAAO,EAAE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
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
|
+
import { bakeSetup } from './emitters/setup-bake.js';
|
|
4
|
+
import { NotSupportedError } from './errors.js';
|
|
5
|
+
import { builtinGenerators, validateGenerators } from './generators/index.js';
|
|
6
|
+
import { resolveGenerators } from './generators/resolve.js';
|
|
7
|
+
import { buildApiModel } from './intermediate-representation/build.js';
|
|
8
|
+
import { normalizeSwagger2 } from './intermediate-representation/normalize-swagger2.js';
|
|
9
|
+
import { loadSpec } from './loader.js';
|
|
10
|
+
export { NotSupportedError } from './errors.js';
|
|
11
|
+
export { defineClientSetup } from './runtime-contract.js';
|
|
12
|
+
// The app-facing client runtime (package-mode clients import these from the package root).
|
|
13
|
+
// The setup-contract names above (Middleware, OperationContext, RequestContext, RetryConfig,
|
|
14
|
+
// RetryContext, RetryStrategy) are re-exports of the same runtime types — one definition,
|
|
15
|
+
// two entry points; the rest of the runtime's type surface is re-exported here.
|
|
16
|
+
export { ApiError, createClient, mergeSetup } from './runtime/index.js';
|
|
17
|
+
export { mergeConfig } from './config-file.js';
|
|
18
|
+
// The custom-generator plugin API + codegen toolkit + IR types (also re-exports the shared
|
|
19
|
+
// `Generator`/`GeneratedFile`/`OutputMode`/`ArgsStyle` types).
|
|
20
|
+
export * from './plugin.js';
|
|
21
|
+
/**
|
|
22
|
+
* Validate the generator selection (see `validateGenerators`), then run each
|
|
23
|
+
* configured generator against the IR and concatenate their files. Throws on a
|
|
24
|
+
* duplicate output path so two generators can't silently clobber each other.
|
|
25
|
+
*/
|
|
26
|
+
export function collectGeneratedFiles(model, options) {
|
|
27
|
+
const registry = options.registry ?? builtinGenerators();
|
|
28
|
+
// Fail fast on an incompatible selection (missing prerequisite, unsupported
|
|
29
|
+
// error-mode/date-type/runtime) before producing any file.
|
|
30
|
+
validateGenerators(options.generators, options.emit, registry);
|
|
31
|
+
const files = [];
|
|
32
|
+
const seen = new Set();
|
|
33
|
+
for (const name of options.generators) {
|
|
34
|
+
const generator = registry.get(name);
|
|
35
|
+
for (const file of generator.run({
|
|
36
|
+
model,
|
|
37
|
+
outputPath: options.outputPath,
|
|
38
|
+
outputMode: options.outputMode,
|
|
39
|
+
emit: options.emit,
|
|
40
|
+
})) {
|
|
41
|
+
if (seen.has(file.path)) {
|
|
42
|
+
throw new Error(`Generator conflict: ${file.path} already emitted by an earlier generator`);
|
|
43
|
+
}
|
|
44
|
+
seen.add(file.path);
|
|
45
|
+
files.push(file);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return files;
|
|
49
|
+
}
|
|
50
|
+
export async function generateClient(options) {
|
|
51
|
+
// A path segment that is literally "undefined"/"null" is the telltale of an
|
|
52
|
+
// interpolation bug in the caller (`\`${dir}/client.ts\`` with `dir` unset) — reject
|
|
53
|
+
// it instead of silently creating an `undefined/` directory.
|
|
54
|
+
if (options.output.split(/[\\/]/).some((segment) => segment === 'undefined' || segment === 'null')) {
|
|
55
|
+
throw new Error(`output path "${options.output}" contains a literal "undefined" or "null" segment — this looks like an interpolation bug in the caller`);
|
|
56
|
+
}
|
|
57
|
+
// Setup is a LOCAL module (its code is baked into the generated client) — reject
|
|
58
|
+
// URL-ish specifiers upfront, before any spec loading, instead of failing later as
|
|
59
|
+
// an unreadable file path. Two+ letter scheme, so Windows drive paths don't match.
|
|
60
|
+
if (options.setup && /^[a-z][a-z0-9+.-]+:/i.test(options.setup)) {
|
|
61
|
+
throw new NotSupportedError(`setup must be a local file path — remote setup modules are not supported (got: ${options.setup})`);
|
|
62
|
+
}
|
|
63
|
+
const outputPath = resolve(options.output);
|
|
64
|
+
const { document, version } = await loadSpec(options.api, options.config);
|
|
65
|
+
const normalized = version === 'oas2'
|
|
66
|
+
? normalizeSwagger2(document)
|
|
67
|
+
: document;
|
|
68
|
+
const model = buildApiModel(normalized);
|
|
69
|
+
// A publisher `--setup` module is read, validated, and transformed into the neutral setup
|
|
70
|
+
// expression baked into the client. Applied across all output modes by the emitter.
|
|
71
|
+
let setupBlock;
|
|
72
|
+
if (options.setup) {
|
|
73
|
+
// Resolve a relative setup path against the cwd, consistent with `output` above.
|
|
74
|
+
// The CLI pre-resolves it (relative to cwd, like --output) and a config-file
|
|
75
|
+
// `setup` is pre-resolved against the config dir, so both arrive absolute here.
|
|
76
|
+
const setupPath = resolve(options.setup);
|
|
77
|
+
setupBlock = bakeSetup(await readFile(setupPath, 'utf-8'));
|
|
78
|
+
}
|
|
79
|
+
// Resolve the selection into a registry: built-in names pass through, inline `customGenerators`
|
|
80
|
+
// register, and any other entry is imported as a plugin specifier (path/package).
|
|
81
|
+
// An empty list (e.g. `generators: []` in config, or no `--generator` flags) means
|
|
82
|
+
// "unspecified" — fall back to the default sdk client rather than emitting nothing.
|
|
83
|
+
const requested = options.generators?.length ? options.generators : ['sdk'];
|
|
84
|
+
const { selected, registry } = await resolveGenerators(requested, {
|
|
85
|
+
customGenerators: options.customGenerators,
|
|
86
|
+
configDir: options.configDir,
|
|
87
|
+
});
|
|
88
|
+
const files = collectGeneratedFiles(model, {
|
|
89
|
+
outputPath,
|
|
90
|
+
outputMode: options.outputMode ?? 'single',
|
|
91
|
+
emit: {
|
|
92
|
+
serverUrl: options.serverUrl,
|
|
93
|
+
enumStyle: options.enumStyle,
|
|
94
|
+
argsStyle: options.argsStyle,
|
|
95
|
+
errorMode: options.errorMode,
|
|
96
|
+
dateType: options.dateType,
|
|
97
|
+
queryFramework: options.queryFramework,
|
|
98
|
+
mockData: options.mockData,
|
|
99
|
+
mockSeed: options.mockSeed,
|
|
100
|
+
setup: setupBlock,
|
|
101
|
+
runtime: options.runtime,
|
|
102
|
+
pagination: options.pagination,
|
|
103
|
+
},
|
|
104
|
+
generators: selected,
|
|
105
|
+
registry,
|
|
106
|
+
});
|
|
107
|
+
const written = [];
|
|
108
|
+
for (const file of files) {
|
|
109
|
+
await mkdir(dirname(file.path), { recursive: true });
|
|
110
|
+
await writeFile(file.path, file.content, 'utf-8');
|
|
111
|
+
written.push({ path: file.path, bytes: Buffer.byteLength(file.content, 'utf-8') });
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
outputPath,
|
|
115
|
+
bytes: written.reduce((sum, file) => sum + file.bytes, 0),
|
|
116
|
+
files: written,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAW1D,2FAA2F;AAC3F,6FAA6F;AAC7F,0FAA0F;AAC1F,gFAAgF;AAChF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAuBxE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,2FAA2F;AAC3F,+DAA+D;AAC/D,cAAc,aAAa,CAAC;AA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