@redocly/client-generator 0.3.7 → 0.4.0
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 +32 -54
- package/eject-assets/AGENTS.md +137 -0
- package/eject-assets/generators/cli/docs.ts +224 -0
- package/eject-assets/generators/cli/engine-source.ts +21 -0
- package/eject-assets/generators/cli/index.ts +90 -0
- package/eject-assets/generators/cli/render.ts +348 -0
- package/eject-assets/generators/go/client.ts +57 -0
- package/eject-assets/generators/go/descriptor.ts +41 -0
- package/eject-assets/generators/go/index.ts +336 -0
- package/eject-assets/generators/go/models.ts +179 -0
- package/eject-assets/generators/go/naming.ts +49 -0
- package/eject-assets/generators/go/operations.ts +296 -0
- package/eject-assets/generators/go/pagination.ts +194 -0
- package/eject-assets/generators/go/types.ts +60 -0
- package/eject-assets/generators/mock/faker.ts +214 -0
- package/eject-assets/generators/mock/index.ts +35 -0
- package/eject-assets/generators/mock/render.ts +282 -0
- package/eject-assets/generators/mock/sample.ts +316 -0
- package/eject-assets/generators/mock/values.ts +63 -0
- package/eject-assets/generators/php/client.ts +63 -0
- package/eject-assets/generators/php/descriptor.ts +58 -0
- package/eject-assets/generators/php/index.ts +237 -0
- package/eject-assets/generators/php/models.ts +275 -0
- package/eject-assets/generators/php/naming.ts +51 -0
- package/eject-assets/generators/php/operations.ts +232 -0
- package/eject-assets/generators/php/pagination.ts +133 -0
- package/eject-assets/generators/php/types.ts +148 -0
- package/eject-assets/generators/python/client.ts +123 -0
- package/eject-assets/generators/python/descriptor.ts +52 -0
- package/eject-assets/generators/python/index.ts +251 -0
- package/eject-assets/generators/python/models.ts +242 -0
- package/eject-assets/generators/python/naming.ts +46 -0
- package/eject-assets/generators/python/operations.ts +147 -0
- package/eject-assets/generators/python/pagination.ts +128 -0
- package/eject-assets/generators/python/types.ts +54 -0
- package/eject-assets/generators/swr/index.ts +37 -0
- package/eject-assets/generators/swr/render.ts +78 -0
- package/eject-assets/generators/tanstack-query/index.ts +48 -0
- package/eject-assets/generators/tanstack-query/render.ts +346 -0
- package/eject-assets/generators/transformers/index.ts +46 -0
- package/eject-assets/generators/transformers/render.ts +506 -0
- package/eject-assets/generators/typescript/banner.ts +35 -0
- package/eject-assets/generators/typescript/client.ts +254 -0
- package/eject-assets/generators/typescript/descriptor.ts +137 -0
- package/eject-assets/generators/typescript/index.ts +101 -0
- package/eject-assets/generators/typescript/inline-runtime.ts +135 -0
- package/eject-assets/generators/typescript/operation-signature.ts +62 -0
- package/eject-assets/generators/typescript/operation-types.ts +17 -0
- package/eject-assets/generators/typescript/operations.ts +524 -0
- package/eject-assets/generators/typescript/response-headers.ts +74 -0
- package/eject-assets/generators/typescript/type-guards.ts +159 -0
- package/eject-assets/generators/typescript/types.ts +172 -0
- package/eject-assets/generators/zod/index.ts +32 -0
- package/eject-assets/generators/zod/schemas.ts +456 -0
- package/eject-assets/skills/cli-generator/SKILL.md +121 -0
- package/eject-assets/skills/client-generators/SKILL.md +142 -0
- package/eject-assets/skills/go-generator/SKILL.md +96 -0
- package/eject-assets/skills/mock-generator/SKILL.md +50 -0
- package/eject-assets/skills/php-generator/SKILL.md +112 -0
- package/eject-assets/skills/python-generator/SKILL.md +110 -0
- package/eject-assets/skills/swr-generator/SKILL.md +50 -0
- package/eject-assets/skills/tanstack-query-generator/SKILL.md +55 -0
- package/eject-assets/skills/transformers-generator/SKILL.md +47 -0
- package/eject-assets/skills/typescript-generator/SKILL.md +95 -0
- package/eject-assets/skills/zod-generator/SKILL.md +54 -0
- package/lib/authoring/index.d.ts +11 -0
- package/lib/authoring/index.d.ts.map +1 -0
- package/lib/authoring/index.js +42 -0
- package/lib/authoring/index.js.map +1 -0
- package/lib/authoring/naming.d.ts +34 -0
- package/lib/authoring/naming.d.ts.map +1 -0
- package/lib/authoring/naming.js +104 -0
- package/lib/authoring/naming.js.map +1 -0
- package/lib/authoring/operation.d.ts +47 -0
- package/lib/authoring/operation.d.ts.map +1 -0
- package/lib/authoring/operation.js +86 -0
- package/lib/authoring/operation.js.map +1 -0
- package/lib/authoring/options.d.ts +9 -0
- package/lib/authoring/options.d.ts.map +1 -0
- package/lib/authoring/options.js +5 -0
- package/lib/authoring/options.js.map +1 -0
- package/lib/authoring/pagination.d.ts +19 -0
- package/lib/authoring/pagination.d.ts.map +1 -0
- package/lib/authoring/pagination.js +45 -0
- package/lib/authoring/pagination.js.map +1 -0
- package/lib/authoring/printer.d.ts +16 -0
- package/lib/authoring/printer.d.ts.map +1 -0
- package/lib/authoring/printer.js +36 -0
- package/lib/authoring/printer.js.map +1 -0
- package/lib/authoring/reference-page.d.ts +31 -0
- package/lib/authoring/reference-page.d.ts.map +1 -0
- package/lib/authoring/reference-page.js +160 -0
- package/lib/authoring/reference-page.js.map +1 -0
- package/lib/authoring/schema.d.ts +51 -0
- package/lib/authoring/schema.d.ts.map +1 -0
- package/lib/authoring/schema.js +190 -0
- package/lib/authoring/schema.js.map +1 -0
- package/lib/cli-contract.d.ts +126 -0
- package/lib/cli-contract.d.ts.map +1 -0
- package/lib/cli-contract.js +25 -0
- package/lib/cli-contract.js.map +1 -0
- package/lib/{emitters/wrapper-support.d.ts → contracts/typescript.d.ts} +13 -24
- package/lib/contracts/typescript.d.ts.map +1 -0
- package/lib/contracts/typescript.js +87 -0
- package/lib/contracts/typescript.js.map +1 -0
- package/lib/generate.d.ts +10 -10
- package/lib/generate.d.ts.map +1 -1
- package/lib/generate.js +25 -106
- package/lib/generate.js.map +1 -1
- package/lib/generators/cli/docs.d.ts +19 -0
- package/lib/generators/cli/docs.d.ts.map +1 -0
- package/lib/generators/cli/docs.js +187 -0
- package/lib/generators/cli/docs.js.map +1 -0
- package/lib/generators/cli/engine-source.d.ts +5 -0
- package/lib/generators/cli/engine-source.d.ts.map +1 -0
- package/lib/generators/cli/engine-source.js +12 -0
- package/lib/generators/cli/engine-source.js.map +1 -0
- package/lib/generators/cli/index.d.ts +18 -0
- package/lib/generators/cli/index.d.ts.map +1 -0
- package/lib/generators/cli/index.js +67 -0
- package/lib/generators/cli/index.js.map +1 -0
- package/lib/generators/cli/render.d.ts +39 -0
- package/lib/generators/cli/render.d.ts.map +1 -0
- package/lib/generators/cli/render.js +281 -0
- package/lib/generators/cli/render.js.map +1 -0
- package/lib/generators/cli/runtime/cli.d.ts +42 -0
- package/lib/generators/cli/runtime/cli.d.ts.map +1 -0
- package/lib/generators/cli/runtime/cli.js +582 -0
- package/lib/generators/cli/runtime/cli.js.map +1 -0
- package/lib/generators/compatibility.d.ts +10 -0
- package/lib/generators/compatibility.d.ts.map +1 -0
- package/lib/generators/compatibility.js +45 -0
- package/lib/generators/compatibility.js.map +1 -0
- package/lib/generators/go/client.d.ts +5 -0
- package/lib/generators/go/client.d.ts.map +1 -0
- package/lib/generators/go/client.js +34 -0
- package/lib/generators/go/client.js.map +1 -0
- package/lib/generators/go/descriptor.d.ts +6 -0
- package/lib/generators/go/descriptor.d.ts.map +1 -0
- package/lib/generators/go/descriptor.js +26 -0
- package/lib/generators/go/descriptor.js.map +1 -0
- package/lib/generators/go/index.d.ts +14 -0
- package/lib/generators/go/index.d.ts.map +1 -0
- package/lib/generators/go/index.js +240 -0
- package/lib/generators/go/index.js.map +1 -0
- package/lib/generators/go/models.d.ts +4 -0
- package/lib/generators/go/models.d.ts.map +1 -0
- package/lib/generators/go/models.js +125 -0
- package/lib/generators/go/models.js.map +1 -0
- package/lib/generators/go/naming.d.ts +15 -0
- package/lib/generators/go/naming.d.ts.map +1 -0
- package/lib/generators/go/naming.js +36 -0
- package/lib/generators/go/naming.js.map +1 -0
- package/lib/generators/go/operations.d.ts +16 -0
- package/lib/generators/go/operations.d.ts.map +1 -0
- package/lib/generators/go/operations.js +200 -0
- package/lib/generators/go/operations.js.map +1 -0
- package/lib/generators/go/pagination.d.ts +5 -0
- package/lib/generators/go/pagination.d.ts.map +1 -0
- package/lib/generators/go/pagination.js +93 -0
- package/lib/generators/go/pagination.js.map +1 -0
- package/lib/generators/go/types.d.ts +4 -0
- package/lib/generators/go/types.d.ts.map +1 -0
- package/lib/generators/go/types.js +48 -0
- package/lib/generators/go/types.js.map +1 -0
- package/lib/generators/index.d.ts +2 -3
- package/lib/generators/index.d.ts.map +1 -1
- package/lib/generators/index.js +31 -53
- package/lib/generators/index.js.map +1 -1
- package/lib/generators/meta.d.ts +13 -0
- package/lib/generators/meta.d.ts.map +1 -0
- package/lib/generators/meta.js +157 -0
- package/lib/generators/meta.js.map +1 -0
- package/lib/{emitters → generators/mock}/faker.d.ts +4 -5
- package/lib/generators/mock/faker.d.ts.map +1 -0
- package/lib/generators/mock/faker.js +180 -0
- package/lib/generators/mock/faker.js.map +1 -0
- package/lib/generators/{mock.d.ts → mock/index.d.ts} +2 -2
- package/lib/generators/mock/index.d.ts.map +1 -0
- package/lib/generators/{mock.js → mock/index.js} +8 -8
- package/lib/generators/mock/index.js.map +1 -0
- package/lib/{emitters/mock.d.ts → generators/mock/render.d.ts} +2 -3
- package/lib/generators/mock/render.d.ts.map +1 -0
- package/lib/generators/mock/render.js +228 -0
- package/lib/generators/mock/render.js.map +1 -0
- package/lib/{emitters → generators/mock}/sample.d.ts +1 -2
- package/lib/generators/mock/sample.d.ts.map +1 -0
- package/lib/generators/mock/sample.js.map +1 -0
- package/lib/generators/mock/values.d.ts +33 -0
- package/lib/generators/mock/values.d.ts.map +1 -0
- package/lib/generators/mock/values.js +46 -0
- package/lib/generators/mock/values.js.map +1 -0
- package/lib/generators/options.d.ts +7 -0
- package/lib/generators/options.d.ts.map +1 -0
- package/lib/generators/options.js +74 -0
- package/lib/generators/options.js.map +1 -0
- package/lib/generators/php/client.d.ts +5 -0
- package/lib/generators/php/client.d.ts.map +1 -0
- package/lib/generators/php/client.js +38 -0
- package/lib/generators/php/client.js.map +1 -0
- package/lib/generators/php/descriptor.d.ts +7 -0
- package/lib/generators/php/descriptor.d.ts.map +1 -0
- package/lib/generators/php/descriptor.js +42 -0
- package/lib/generators/php/descriptor.js.map +1 -0
- package/lib/generators/php/index.d.ts +14 -0
- package/lib/generators/php/index.d.ts.map +1 -0
- package/lib/generators/php/index.js +166 -0
- package/lib/generators/php/index.js.map +1 -0
- package/lib/generators/php/models.d.ts +8 -0
- package/lib/generators/php/models.d.ts.map +1 -0
- package/lib/generators/php/models.js +200 -0
- package/lib/generators/php/models.js.map +1 -0
- package/lib/generators/php/naming.d.ts +16 -0
- package/lib/generators/php/naming.d.ts.map +1 -0
- package/lib/generators/php/naming.js +31 -0
- package/lib/generators/php/naming.js.map +1 -0
- package/lib/generators/php/operations.d.ts +21 -0
- package/lib/generators/php/operations.d.ts.map +1 -0
- package/lib/generators/php/operations.js +156 -0
- package/lib/generators/php/operations.js.map +1 -0
- package/lib/generators/php/pagination.d.ts +5 -0
- package/lib/generators/php/pagination.d.ts.map +1 -0
- package/lib/generators/php/pagination.js +68 -0
- package/lib/generators/php/pagination.js.map +1 -0
- package/lib/generators/php/types.d.ts +27 -0
- package/lib/generators/php/types.d.ts.map +1 -0
- package/lib/generators/php/types.js +128 -0
- package/lib/generators/php/types.js.map +1 -0
- package/lib/generators/python/client.d.ts +6 -0
- package/lib/generators/python/client.d.ts.map +1 -0
- package/lib/generators/python/client.js +80 -0
- package/lib/generators/python/client.js.map +1 -0
- package/lib/generators/python/descriptor.d.ts +9 -0
- package/lib/generators/python/descriptor.d.ts.map +1 -0
- package/lib/generators/python/descriptor.js +38 -0
- package/lib/generators/python/descriptor.js.map +1 -0
- package/lib/generators/python/index.d.ts +15 -0
- package/lib/generators/python/index.d.ts.map +1 -0
- package/lib/generators/python/index.js +197 -0
- package/lib/generators/python/index.js.map +1 -0
- package/lib/generators/python/models.d.ts +31 -0
- package/lib/generators/python/models.d.ts.map +1 -0
- package/lib/generators/python/models.js +203 -0
- package/lib/generators/python/models.js.map +1 -0
- package/lib/generators/python/naming.d.ts +22 -0
- package/lib/generators/python/naming.d.ts.map +1 -0
- package/lib/generators/python/naming.js +28 -0
- package/lib/generators/python/naming.js.map +1 -0
- package/lib/generators/python/operations.d.ts +4 -0
- package/lib/generators/python/operations.d.ts.map +1 -0
- package/lib/generators/python/operations.js +108 -0
- package/lib/generators/python/operations.js.map +1 -0
- package/lib/generators/python/pagination.d.ts +5 -0
- package/lib/generators/python/pagination.d.ts.map +1 -0
- package/lib/generators/python/pagination.js +95 -0
- package/lib/generators/python/pagination.js.map +1 -0
- package/lib/generators/python/types.d.ts +4 -0
- package/lib/generators/python/types.d.ts.map +1 -0
- package/lib/generators/python/types.js +45 -0
- package/lib/generators/python/types.js.map +1 -0
- package/lib/generators/resolve.d.ts.map +1 -1
- package/lib/generators/resolve.js +92 -13
- package/lib/generators/resolve.js.map +1 -1
- package/lib/generators/{swr.d.ts → swr/index.d.ts} +3 -3
- package/lib/generators/swr/index.d.ts.map +1 -0
- package/lib/generators/{swr.js → swr/index.js} +7 -10
- package/lib/generators/swr/index.js.map +1 -0
- package/lib/{emitters/swr.d.ts → generators/swr/render.d.ts} +2 -4
- package/lib/generators/swr/render.d.ts.map +1 -0
- package/lib/generators/swr/render.js +57 -0
- package/lib/generators/swr/render.js.map +1 -0
- package/lib/generators/{tanstack-query.d.ts → tanstack-query/index.d.ts} +3 -3
- package/lib/generators/tanstack-query/index.d.ts.map +1 -0
- package/lib/generators/{tanstack-query.js → tanstack-query/index.js} +11 -10
- package/lib/generators/tanstack-query/index.js.map +1 -0
- package/lib/{emitters/tanstack-query.d.ts → generators/tanstack-query/render.d.ts} +6 -5
- package/lib/generators/tanstack-query/render.d.ts.map +1 -0
- package/lib/{emitters/tanstack-query.js → generators/tanstack-query/render.js} +33 -21
- package/lib/generators/tanstack-query/render.js.map +1 -0
- package/lib/generators/{transformers.d.ts → transformers/index.d.ts} +2 -2
- package/lib/generators/transformers/index.d.ts.map +1 -0
- package/lib/generators/{transformers.js → transformers/index.js} +11 -8
- package/lib/generators/transformers/index.js.map +1 -0
- package/lib/{emitters/transformers.d.ts → generators/transformers/render.d.ts} +2 -2
- package/lib/generators/transformers/render.d.ts.map +1 -0
- package/lib/{emitters/transformers.js → generators/transformers/render.js} +125 -165
- package/lib/generators/transformers/render.js.map +1 -0
- package/lib/generators/types.d.ts +190 -12
- package/lib/generators/types.d.ts.map +1 -1
- package/lib/generators/typescript/banner.d.ts +12 -0
- package/lib/generators/typescript/banner.d.ts.map +1 -0
- package/lib/{emitters/emit-options.js → generators/typescript/banner.js} +2 -3
- package/lib/generators/typescript/banner.js.map +1 -0
- package/lib/generators/typescript/client.d.ts +25 -0
- package/lib/generators/typescript/client.d.ts.map +1 -0
- package/lib/generators/typescript/client.js +207 -0
- package/lib/generators/typescript/client.js.map +1 -0
- package/lib/generators/typescript/descriptor.d.ts +11 -0
- package/lib/generators/typescript/descriptor.d.ts.map +1 -0
- package/lib/generators/typescript/descriptor.js +97 -0
- package/lib/generators/typescript/descriptor.js.map +1 -0
- package/lib/generators/typescript/index.d.ts +20 -0
- package/lib/generators/typescript/index.d.ts.map +1 -0
- package/lib/generators/typescript/index.js +80 -0
- package/lib/generators/typescript/index.js.map +1 -0
- package/lib/generators/typescript/inline-runtime.d.ts +21 -0
- package/lib/generators/typescript/inline-runtime.d.ts.map +1 -0
- package/lib/generators/typescript/inline-runtime.js +114 -0
- package/lib/generators/typescript/inline-runtime.js.map +1 -0
- package/lib/generators/typescript/operation-signature.d.ts +23 -0
- package/lib/generators/typescript/operation-signature.d.ts.map +1 -0
- package/lib/generators/typescript/operation-signature.js +41 -0
- package/lib/generators/typescript/operation-signature.js.map +1 -0
- package/lib/generators/typescript/operation-types.d.ts +9 -0
- package/lib/generators/typescript/operation-types.d.ts.map +1 -0
- package/lib/generators/typescript/operation-types.js +11 -0
- package/lib/generators/typescript/operation-types.js.map +1 -0
- package/lib/generators/typescript/operations.d.ts +60 -0
- package/lib/generators/typescript/operations.d.ts.map +1 -0
- package/lib/generators/typescript/operations.js +386 -0
- package/lib/generators/typescript/operations.js.map +1 -0
- package/lib/generators/typescript/response-headers.d.ts +12 -0
- package/lib/generators/typescript/response-headers.d.ts.map +1 -0
- package/lib/generators/typescript/response-headers.js +40 -0
- package/lib/generators/typescript/response-headers.js.map +1 -0
- package/lib/generators/typescript/runtime/auth.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/auth.js.map +1 -0
- package/lib/{runtime → generators/typescript/runtime}/create-client.d.ts +7 -2
- package/lib/generators/typescript/runtime/create-client.d.ts.map +1 -0
- package/lib/{runtime → generators/typescript/runtime}/create-client.js +84 -30
- package/lib/generators/typescript/runtime/create-client.js.map +1 -0
- package/lib/generators/typescript/runtime/errors.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/errors.js.map +1 -0
- package/lib/generators/typescript/runtime/index.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/index.js.map +1 -0
- package/lib/generators/typescript/runtime/multipart.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/multipart.js.map +1 -0
- package/lib/{runtime → generators/typescript/runtime}/paginate.d.ts +2 -2
- package/lib/generators/typescript/runtime/paginate.d.ts.map +1 -0
- package/lib/{runtime → generators/typescript/runtime}/paginate.js +12 -12
- package/lib/generators/typescript/runtime/paginate.js.map +1 -0
- package/lib/generators/typescript/runtime/parse.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/parse.js.map +1 -0
- package/lib/generators/typescript/runtime/retry.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/retry.js.map +1 -0
- package/lib/generators/typescript/runtime/send.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/send.js.map +1 -0
- package/lib/generators/typescript/runtime/setup.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/setup.js.map +1 -0
- package/lib/generators/typescript/runtime/sse.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/sse.js.map +1 -0
- package/lib/{runtime → generators/typescript/runtime}/types.d.ts +17 -95
- package/lib/generators/typescript/runtime/types.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/types.js.map +1 -0
- package/lib/generators/typescript/runtime/url.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/url.js.map +1 -0
- package/lib/generators/typescript/type-guards.d.ts +4 -0
- package/lib/generators/typescript/type-guards.d.ts.map +1 -0
- package/lib/{emitters → generators/typescript}/type-guards.js +18 -52
- package/lib/generators/typescript/type-guards.js.map +1 -0
- package/lib/generators/typescript/types.d.ts +8 -0
- package/lib/generators/typescript/types.d.ts.map +1 -0
- package/lib/generators/typescript/types.js +132 -0
- package/lib/generators/typescript/types.js.map +1 -0
- package/lib/generators/{zod.d.ts → zod/index.d.ts} +2 -2
- package/lib/generators/zod/index.d.ts.map +1 -0
- package/lib/generators/{zod.js → zod/index.js} +5 -7
- package/lib/generators/zod/index.js.map +1 -0
- package/lib/{emitters/zod.d.ts → generators/zod/schemas.d.ts} +4 -5
- package/lib/generators/zod/schemas.d.ts.map +1 -0
- package/lib/{emitters/zod.js → generators/zod/schemas.js} +118 -154
- package/lib/generators/zod/schemas.js.map +1 -0
- package/lib/index.d.ts +8 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +18 -11
- package/lib/index.js.map +1 -1
- package/lib/intermediate-representation/build.d.ts +8 -1
- package/lib/intermediate-representation/build.d.ts.map +1 -1
- package/lib/intermediate-representation/build.js +59 -4
- package/lib/intermediate-representation/build.js.map +1 -1
- package/lib/intermediate-representation/model.d.ts +26 -1
- package/lib/intermediate-representation/model.d.ts.map +1 -1
- package/lib/intermediate-representation/model.js.map +1 -1
- package/lib/intermediate-representation/sanitize-identifiers.d.ts +1 -10
- package/lib/intermediate-representation/sanitize-identifiers.d.ts.map +1 -1
- package/lib/intermediate-representation/sanitize-identifiers.js +37 -38
- package/lib/intermediate-representation/sanitize-identifiers.js.map +1 -1
- package/lib/{emitters/pagination.d.ts → pagination.d.ts} +39 -15
- package/lib/pagination.d.ts.map +1 -0
- package/lib/{emitters/pagination.js → pagination.js} +13 -52
- package/lib/pagination.js.map +1 -0
- package/lib/pipeline.d.ts +17 -0
- package/lib/pipeline.d.ts.map +1 -0
- package/lib/pipeline.js +244 -0
- package/lib/pipeline.js.map +1 -0
- package/lib/plugin.d.ts +4 -4
- package/lib/plugin.d.ts.map +1 -1
- package/lib/plugin.js +12 -9
- package/lib/plugin.js.map +1 -1
- package/lib/printers/go.d.ts +33 -0
- package/lib/printers/go.d.ts.map +1 -0
- package/lib/printers/go.js +209 -0
- package/lib/printers/go.js.map +1 -0
- package/lib/printers/index.d.ts +5 -0
- package/lib/printers/index.d.ts.map +1 -0
- package/lib/printers/index.js +9 -0
- package/lib/printers/index.js.map +1 -0
- package/lib/printers/php.d.ts +21 -0
- package/lib/printers/php.d.ts.map +1 -0
- package/lib/printers/php.js +68 -0
- package/lib/printers/php.js.map +1 -0
- package/lib/printers/python.d.ts +31 -0
- package/lib/printers/python.d.ts.map +1 -0
- package/lib/printers/python.js +101 -0
- package/lib/printers/python.js.map +1 -0
- package/lib/printers/typescript.d.ts +82 -0
- package/lib/printers/typescript.d.ts.map +1 -0
- package/lib/printers/typescript.js +268 -0
- package/lib/printers/typescript.js.map +1 -0
- package/lib/reserved-names.d.ts +8 -0
- package/lib/reserved-names.d.ts.map +1 -0
- package/lib/{emitters/reserved-names.js → reserved-names.js} +16 -27
- package/lib/reserved-names.js.map +1 -0
- package/lib/runtime-contract.d.ts +62 -2
- package/lib/runtime-contract.d.ts.map +1 -1
- package/lib/runtime-contract.js +3 -3
- package/lib/runtime-contract.js.map +1 -1
- package/lib/runtime-sources/go.d.ts +2 -0
- package/lib/runtime-sources/go.d.ts.map +1 -0
- package/lib/runtime-sources/go.js +3 -0
- package/lib/runtime-sources/go.js.map +1 -0
- package/lib/runtime-sources/php.d.ts +2 -0
- package/lib/runtime-sources/php.d.ts.map +1 -0
- package/lib/runtime-sources/php.js +3 -0
- package/lib/runtime-sources/php.js.map +1 -0
- package/lib/runtime-sources/python.d.ts +12 -0
- package/lib/runtime-sources/python.d.ts.map +1 -0
- package/lib/runtime-sources/python.js +12 -0
- package/lib/runtime-sources/python.js.map +1 -0
- package/lib/runtime-sources/typescript.d.ts +36 -0
- package/lib/runtime-sources/typescript.d.ts.map +1 -0
- package/lib/runtime-sources/typescript.js +152 -0
- package/lib/runtime-sources/typescript.js.map +1 -0
- package/lib/runtime-sources.d.ts +5 -0
- package/lib/runtime-sources.d.ts.map +1 -0
- package/lib/runtime-sources.js +10 -0
- package/lib/runtime-sources.js.map +1 -0
- package/lib/setup-bake.d.ts.map +1 -0
- package/lib/{emitters/setup-bake.js → setup-bake.js} +11 -2
- package/lib/setup-bake.js.map +1 -0
- package/lib/types.d.ts +38 -8
- package/lib/types.d.ts.map +1 -1
- package/package.json +40 -4
- package/lib/emitters/auth.d.ts +0 -14
- package/lib/emitters/auth.d.ts.map +0 -1
- package/lib/emitters/auth.js +0 -30
- package/lib/emitters/auth.js.map +0 -1
- package/lib/emitters/client-assembly.d.ts +0 -15
- package/lib/emitters/client-assembly.d.ts.map +0 -1
- package/lib/emitters/client-assembly.js +0 -358
- package/lib/emitters/client-assembly.js.map +0 -1
- package/lib/emitters/descriptor.d.ts +0 -22
- package/lib/emitters/descriptor.d.ts.map +0 -1
- package/lib/emitters/descriptor.js +0 -199
- package/lib/emitters/descriptor.js.map +0 -1
- package/lib/emitters/emit-options.d.ts +0 -67
- package/lib/emitters/emit-options.d.ts.map +0 -1
- package/lib/emitters/emit-options.js.map +0 -1
- package/lib/emitters/faker.d.ts.map +0 -1
- package/lib/emitters/faker.js +0 -221
- package/lib/emitters/faker.js.map +0 -1
- package/lib/emitters/identifier.d.ts +0 -34
- package/lib/emitters/identifier.d.ts.map +0 -1
- package/lib/emitters/identifier.js +0 -104
- package/lib/emitters/identifier.js.map +0 -1
- package/lib/emitters/inline-runtime.d.ts +0 -11
- package/lib/emitters/inline-runtime.d.ts.map +0 -1
- package/lib/emitters/inline-runtime.js +0 -99
- package/lib/emitters/inline-runtime.js.map +0 -1
- package/lib/emitters/jsdoc.d.ts +0 -9
- package/lib/emitters/jsdoc.d.ts.map +0 -1
- package/lib/emitters/jsdoc.js +0 -83
- package/lib/emitters/jsdoc.js.map +0 -1
- package/lib/emitters/mock.d.ts.map +0 -1
- package/lib/emitters/mock.js +0 -265
- package/lib/emitters/mock.js.map +0 -1
- package/lib/emitters/operation-aliases.d.ts +0 -27
- package/lib/emitters/operation-aliases.d.ts.map +0 -1
- package/lib/emitters/operation-aliases.js +0 -150
- package/lib/emitters/operation-aliases.js.map +0 -1
- package/lib/emitters/operation-signature.d.ts +0 -24
- package/lib/emitters/operation-signature.d.ts.map +0 -1
- package/lib/emitters/operation-signature.js +0 -42
- package/lib/emitters/operation-signature.js.map +0 -1
- package/lib/emitters/operation-types.d.ts +0 -32
- package/lib/emitters/operation-types.d.ts.map +0 -1
- package/lib/emitters/operation-types.js +0 -117
- package/lib/emitters/operation-types.js.map +0 -1
- package/lib/emitters/operations.d.ts +0 -41
- package/lib/emitters/operations.d.ts.map +0 -1
- package/lib/emitters/operations.js +0 -35
- package/lib/emitters/operations.js.map +0 -1
- package/lib/emitters/pagination.d.ts.map +0 -1
- package/lib/emitters/pagination.js.map +0 -1
- package/lib/emitters/reserved-names.d.ts +0 -5
- package/lib/emitters/reserved-names.d.ts.map +0 -1
- package/lib/emitters/reserved-names.js.map +0 -1
- package/lib/emitters/response-headers.d.ts +0 -14
- package/lib/emitters/response-headers.d.ts.map +0 -1
- package/lib/emitters/response-headers.js +0 -91
- package/lib/emitters/response-headers.js.map +0 -1
- package/lib/emitters/runtime-sources.d.ts +0 -16
- package/lib/emitters/runtime-sources.d.ts.map +0 -1
- package/lib/emitters/runtime-sources.js +0 -16
- package/lib/emitters/runtime-sources.js.map +0 -1
- package/lib/emitters/sample.d.ts.map +0 -1
- package/lib/emitters/sample.js.map +0 -1
- package/lib/emitters/setup-bake.d.ts.map +0 -1
- package/lib/emitters/setup-bake.js.map +0 -1
- package/lib/emitters/sse.d.ts +0 -10
- package/lib/emitters/sse.d.ts.map +0 -1
- package/lib/emitters/sse.js +0 -46
- package/lib/emitters/sse.js.map +0 -1
- package/lib/emitters/support.d.ts +0 -18
- package/lib/emitters/support.d.ts.map +0 -1
- package/lib/emitters/support.js +0 -37
- package/lib/emitters/support.js.map +0 -1
- package/lib/emitters/swr.d.ts.map +0 -1
- package/lib/emitters/swr.js +0 -88
- package/lib/emitters/swr.js.map +0 -1
- package/lib/emitters/tanstack-query.d.ts.map +0 -1
- package/lib/emitters/tanstack-query.js.map +0 -1
- package/lib/emitters/transformers.d.ts.map +0 -1
- package/lib/emitters/transformers.js.map +0 -1
- package/lib/emitters/ts.d.ts +0 -42
- package/lib/emitters/ts.d.ts.map +0 -1
- package/lib/emitters/ts.js +0 -116
- package/lib/emitters/ts.js.map +0 -1
- package/lib/emitters/type-guards.d.ts +0 -21
- package/lib/emitters/type-guards.d.ts.map +0 -1
- package/lib/emitters/type-guards.js.map +0 -1
- package/lib/emitters/types.d.ts +0 -15
- package/lib/emitters/types.d.ts.map +0 -1
- package/lib/emitters/types.js +0 -125
- package/lib/emitters/types.js.map +0 -1
- package/lib/emitters/wrapper-support.d.ts.map +0 -1
- package/lib/emitters/wrapper-support.js +0 -127
- package/lib/emitters/wrapper-support.js.map +0 -1
- package/lib/emitters/zod.d.ts.map +0 -1
- package/lib/emitters/zod.js.map +0 -1
- package/lib/generators/anchor.d.ts +0 -9
- package/lib/generators/anchor.d.ts.map +0 -1
- package/lib/generators/anchor.js +0 -10
- package/lib/generators/anchor.js.map +0 -1
- package/lib/generators/mock.d.ts.map +0 -1
- package/lib/generators/mock.js.map +0 -1
- package/lib/generators/sdk.d.ts +0 -12
- package/lib/generators/sdk.d.ts.map +0 -1
- package/lib/generators/sdk.js +0 -26
- package/lib/generators/sdk.js.map +0 -1
- package/lib/generators/swr.d.ts.map +0 -1
- package/lib/generators/swr.js.map +0 -1
- package/lib/generators/tanstack-query.d.ts.map +0 -1
- package/lib/generators/tanstack-query.js.map +0 -1
- package/lib/generators/transformers.d.ts.map +0 -1
- package/lib/generators/transformers.js.map +0 -1
- package/lib/generators/zod.d.ts.map +0 -1
- package/lib/generators/zod.js.map +0 -1
- package/lib/runtime/auth.d.ts.map +0 -1
- package/lib/runtime/auth.js.map +0 -1
- package/lib/runtime/create-client.d.ts.map +0 -1
- package/lib/runtime/create-client.js.map +0 -1
- package/lib/runtime/errors.d.ts.map +0 -1
- package/lib/runtime/errors.js.map +0 -1
- package/lib/runtime/index.d.ts.map +0 -1
- package/lib/runtime/index.js.map +0 -1
- package/lib/runtime/multipart.d.ts.map +0 -1
- package/lib/runtime/multipart.js.map +0 -1
- package/lib/runtime/paginate.d.ts.map +0 -1
- package/lib/runtime/paginate.js.map +0 -1
- package/lib/runtime/parse.d.ts.map +0 -1
- package/lib/runtime/parse.js.map +0 -1
- package/lib/runtime/retry.d.ts.map +0 -1
- package/lib/runtime/retry.js.map +0 -1
- package/lib/runtime/send.d.ts.map +0 -1
- package/lib/runtime/send.js.map +0 -1
- package/lib/runtime/setup.d.ts.map +0 -1
- package/lib/runtime/setup.js.map +0 -1
- package/lib/runtime/sse.d.ts.map +0 -1
- package/lib/runtime/sse.js.map +0 -1
- package/lib/runtime/types.d.ts.map +0 -1
- package/lib/runtime/types.js.map +0 -1
- package/lib/runtime/url.d.ts.map +0 -1
- package/lib/runtime/url.js.map +0 -1
- /package/lib/{emitters → generators/mock}/sample.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/auth.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/auth.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/errors.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/errors.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/index.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/index.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/multipart.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/multipart.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/parse.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/parse.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/retry.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/retry.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/send.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/send.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/setup.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/setup.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/sse.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/sse.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/types.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/url.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/url.js +0 -0
- /package/lib/{emitters/setup-bake.d.ts → setup-bake.d.ts} +0 -0
|
@@ -1,7 +1,84 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
|
|
1
|
+
import type { DateType } from '../authoring/options.js';
|
|
2
|
+
import type { ApiModel, OperationModel } from '../intermediate-representation/model.js';
|
|
3
|
+
import type { ModelPagination } from '../pagination.js';
|
|
4
|
+
export type { DateType } from '../authoring/options.js';
|
|
5
|
+
/** Error-handling shape of the generated client: throw on non-2xx, or return a result union. */
|
|
6
|
+
export type ErrorMode = 'throw' | 'result';
|
|
7
|
+
/**
|
|
8
|
+
* How an operation's inputs are passed to the generated call.
|
|
9
|
+
* - `'flat'` (default): path params spread as positional args, then the
|
|
10
|
+
* `params`/`body`/`headers` slots — one exported sugar arrow per operation.
|
|
11
|
+
* - `'grouped'`: the client methods' own shape — a single `args` object bundling
|
|
12
|
+
* every input; the sugar is a plain destructure of the client. The per-call
|
|
13
|
+
* `init: RequestOptions` stays a separate trailing argument in both styles.
|
|
14
|
+
*/
|
|
15
|
+
export type ArgsStyle = 'flat' | 'grouped';
|
|
16
|
+
export type EmitOptions = {
|
|
17
|
+
/**
|
|
18
|
+
* Override the server URL baked into the generated client config. When omitted,
|
|
19
|
+
* the value is derived from `servers[0].url` in the source OpenAPI description.
|
|
20
|
+
*/
|
|
21
|
+
serverUrl?: string;
|
|
22
|
+
/**
|
|
23
|
+
* How operation inputs are passed to each call. Defaults to `'flat'`;
|
|
24
|
+
* `'grouped'` bundles inputs into a single `args` object.
|
|
25
|
+
*/
|
|
26
|
+
argsStyle?: ArgsStyle;
|
|
27
|
+
/** Error-handling shape of the generated client. Defaults to `'throw'`. */
|
|
28
|
+
errorMode?: 'throw' | 'result';
|
|
29
|
+
/**
|
|
30
|
+
* How `format: date-time`/`date` string fields are typed. `'string'` (default)
|
|
31
|
+
* keeps the ISO wire shape; `'Date'` emits a `Date` reference. Opt-in — pair with
|
|
32
|
+
* the `transformers` generator so the runtime value matches the type.
|
|
33
|
+
*/
|
|
34
|
+
dateType?: DateType;
|
|
35
|
+
/**
|
|
36
|
+
* How the `mock` generator produces data. `'static'` (default) inlines deterministic
|
|
37
|
+
* literals (zero-dep, contract-faithful); `'faker'` emits `@faker-js/faker` calls for
|
|
38
|
+
* realistic data — reproducible when `mockSeed` is set. Only the mock module is affected.
|
|
39
|
+
*/
|
|
40
|
+
mockData?: 'static' | 'faker';
|
|
41
|
+
/** Seed for faker-mode mocks: emits a top-level `faker.seed(<n>)` so runs reproduce. */
|
|
42
|
+
mockSeed?: number;
|
|
43
|
+
/** Leading element for every tanstack-query key — namespaces the cache when several
|
|
44
|
+
* generated APIs share one QueryClient (operationIds may collide across APIs). */
|
|
45
|
+
queryKeyPrefix?: string;
|
|
46
|
+
/**
|
|
47
|
+
* A pre-baked publisher setup block (from `bakeSetup`) merged into the client's config
|
|
48
|
+
* via `mergeSetup`. Absent when no `--setup` is given.
|
|
49
|
+
*/
|
|
50
|
+
setup?: string;
|
|
51
|
+
/** Runtime distribution: `'inline'` (default) embeds the runtime in the generated
|
|
52
|
+
* file; `'module'` writes it as real files in a `runtime/` folder beside the client. */
|
|
53
|
+
runtime?: 'inline' | 'module';
|
|
54
|
+
/**
|
|
55
|
+
* Extension used in generated relative import specifiers (the split entry's schemas
|
|
56
|
+
* re-export and each satellite's sdk import). `'js'` (default) is the tsc/bundler
|
|
57
|
+
* convention; `'ts'` targets runtimes that resolve specifiers literally, like Node's
|
|
58
|
+
* built-in type stripping (`node client.ts`).
|
|
59
|
+
*/
|
|
60
|
+
importExt?: 'js' | 'ts';
|
|
61
|
+
/**
|
|
62
|
+
* Package clause of the `go` generator's output. Defaults to `client` — a generated
|
|
63
|
+
* file usually lands in a package the consumer already owns, so the name is theirs
|
|
64
|
+
* to choose. An invalid Go package name fails generation.
|
|
65
|
+
*/
|
|
66
|
+
goPackage?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Auto-pagination RESOLVED by the pipeline (fit-verified, one answer per run),
|
|
69
|
+
* resolved together with each operation's `x-redoclyPagination` extension. Verified
|
|
70
|
+
* statically: an explicit rule that doesn't fit its operation fails generation.
|
|
71
|
+
*/
|
|
72
|
+
pagination?: ModelPagination;
|
|
73
|
+
/**
|
|
74
|
+
* Also write the reference documentation for what each selected generator emits: one
|
|
75
|
+
* Markdown page per generator that implements the `docs` hook. One switch for the whole
|
|
76
|
+
* run, so a new documented language never needs a new flag.
|
|
77
|
+
*/
|
|
78
|
+
docs?: boolean;
|
|
79
|
+
/** Emit YAML front matter carrying the title above each documentation page. */
|
|
80
|
+
docsFrontmatter?: boolean;
|
|
81
|
+
};
|
|
5
82
|
/**
|
|
6
83
|
* How the generated client is partitioned across files.
|
|
7
84
|
*
|
|
@@ -16,16 +93,73 @@ export type GeneratedFile = {
|
|
|
16
93
|
content: string;
|
|
17
94
|
};
|
|
18
95
|
/** The first-party generators the registry knows. */
|
|
19
|
-
export type GeneratorName = '
|
|
96
|
+
export type GeneratorName = 'typescript' | 'zod' | 'tanstack-query' | 'tanstack-query-vue' | 'tanstack-query-svelte' | 'tanstack-query-solid' | 'swr' | 'transformers' | 'mock' | 'cli' | 'python' | 'go' | 'php';
|
|
97
|
+
/**
|
|
98
|
+
* One option a generator accepts: a scalar, a closed set of values, or a list of scalars.
|
|
99
|
+
* Config values are scalars and lists of scalars, so the schema vocabulary stops there —
|
|
100
|
+
* nothing a `redocly.yaml` block can express is missing.
|
|
101
|
+
*/
|
|
102
|
+
export type GeneratorOptionSchema = {
|
|
103
|
+
default?: unknown;
|
|
104
|
+
description?: string;
|
|
105
|
+
} & ({
|
|
106
|
+
type: 'string' | 'number' | 'boolean';
|
|
107
|
+
} | {
|
|
108
|
+
type: 'array';
|
|
109
|
+
items: {
|
|
110
|
+
type: 'string' | 'number' | 'boolean';
|
|
111
|
+
};
|
|
112
|
+
} | {
|
|
113
|
+
enum: Array<string | number | boolean>;
|
|
114
|
+
});
|
|
115
|
+
/** The options a generator declares, as the JSON Schema subset the config layer validates. */
|
|
116
|
+
export type GeneratorOptionsSchema = {
|
|
117
|
+
type: 'object';
|
|
118
|
+
properties: Record<string, GeneratorOptionSchema>;
|
|
119
|
+
required?: string[];
|
|
120
|
+
/** Unknown keys are rejected unless this is `true` — a typo'd option is a config bug. */
|
|
121
|
+
additionalProperties?: boolean;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* The `--output` anchor, parsed once by the pipeline: the full `path`, its `dir`,
|
|
125
|
+
* the `stem` (base name without the final extension), and the `ext` (with the dot).
|
|
126
|
+
* Generators derive sibling-file names from these instead of re-parsing the path.
|
|
127
|
+
*/
|
|
128
|
+
export type OutputAnchor = {
|
|
129
|
+
path: string;
|
|
130
|
+
dir: string;
|
|
131
|
+
stem: string;
|
|
132
|
+
ext: string;
|
|
133
|
+
};
|
|
20
134
|
/** Everything a generator needs to produce its files. */
|
|
21
135
|
export type GeneratorInput = {
|
|
22
136
|
model: ApiModel;
|
|
23
|
-
/** The `--output` anchor
|
|
24
|
-
|
|
137
|
+
/** The `--output` anchor, parsed (see `OutputAnchor`). */
|
|
138
|
+
output: OutputAnchor;
|
|
139
|
+
/**
|
|
140
|
+
* The generated-by banner lines, free of comment markers — each generator prepends
|
|
141
|
+
* them in its own comment syntax, so every emitted file says the same thing.
|
|
142
|
+
*/
|
|
143
|
+
banner: string[];
|
|
144
|
+
/**
|
|
145
|
+
* Pagination resolved ONCE by the pipeline — per-op config > `x-redoclyPagination` >
|
|
146
|
+
* convention, fit-verified, pointers resolved — keyed by operation name. Generators
|
|
147
|
+
* read this instead of re-resolving, so two of them cannot disagree about whether an
|
|
148
|
+
* operation paginates.
|
|
149
|
+
*/
|
|
150
|
+
pagination?: ModelPagination;
|
|
25
151
|
/** File partitioning the generator should honor. */
|
|
26
152
|
outputMode: OutputMode;
|
|
27
153
|
/** Emit options — serverUrl, runtime, and the generator knobs (dateType, mockData, …); see `EmitOptions`. */
|
|
28
154
|
emit: EmitOptions;
|
|
155
|
+
/** Every generator name in the run — lets a generator adapt to co-selection (cli wires zod validation when `zod` is selected). */
|
|
156
|
+
selected?: string[];
|
|
157
|
+
/**
|
|
158
|
+
* This generator's own options from `client.options.<name>`, already validated against
|
|
159
|
+
* the schema it declares with defaults applied — a generator reads them without re-checking.
|
|
160
|
+
* Empty when the generator declares no options.
|
|
161
|
+
*/
|
|
162
|
+
options?: Record<string, unknown>;
|
|
29
163
|
};
|
|
30
164
|
/**
|
|
31
165
|
* A Generator turns the IR + options into a set of files. Each lives behind a
|
|
@@ -33,25 +167,62 @@ export type GeneratorInput = {
|
|
|
33
167
|
* through the plugin API (see `CustomGenerator`).
|
|
34
168
|
*/
|
|
35
169
|
export type Generator = (input: GeneratorInput) => GeneratedFile[];
|
|
170
|
+
/** One idiomatic call snippet for an operation, rendered for docs (`x-codeSamples`). */
|
|
171
|
+
export type CodeSample = {
|
|
172
|
+
lang: string;
|
|
173
|
+
label?: string;
|
|
174
|
+
source: string;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* What a `sample` hook receives besides the operation. `outputPath` is the `--output`
|
|
178
|
+
* anchor: a snippet has to import the module this run actually writes, and each language
|
|
179
|
+
* derives that name from the anchor its own way (`openapi.client.ts` becomes
|
|
180
|
+
* `openapi_client.py`), so a hardcoded module name is wrong for most stems.
|
|
181
|
+
*/
|
|
182
|
+
export type SampleContext = {
|
|
183
|
+
model: ApiModel;
|
|
184
|
+
emit: EmitOptions;
|
|
185
|
+
outputPath: string;
|
|
186
|
+
/** The run's resolved pagination (see `GeneratorInput.pagination`). */
|
|
187
|
+
pagination?: ModelPagination;
|
|
188
|
+
};
|
|
36
189
|
/**
|
|
37
190
|
* A generator plus its declared compatibility contract. `validateGenerators`
|
|
38
191
|
* checks these *before* anything is emitted, so an incompatible selection fails
|
|
39
192
|
* fast with an actionable message instead of producing a client that won't compile.
|
|
40
193
|
*
|
|
41
194
|
* - `requires`: other generators that must also be selected (e.g. `tanstack-query`
|
|
42
|
-
* imports the
|
|
43
|
-
* - `errorModes` / `dateTypes
|
|
195
|
+
* imports the client's operation functions, so it requires `typescript`).
|
|
196
|
+
* - `errorModes` / `dateTypes`: the subset this generator supports;
|
|
44
197
|
* `undefined` means "all". (`tanstack-query` wraps throw-mode functions, so it
|
|
45
|
-
* supports only `throw` mode; `transformers` only type-checks when the
|
|
198
|
+
* supports only `throw` mode; `transformers` only type-checks when the client types
|
|
46
199
|
* date fields as `Date`, so it supports only `dateType: 'Date'`.)
|
|
47
200
|
*/
|
|
48
201
|
export type GeneratorDescriptor = {
|
|
49
202
|
run: Generator;
|
|
203
|
+
/** The options this generator accepts, validated before `run` (see `GeneratorOptionsSchema`). */
|
|
204
|
+
options?: GeneratorOptionsSchema;
|
|
205
|
+
/** Optional: one idiomatic call snippet per operation for docs (`x-codeSamples`);
|
|
206
|
+
* collected into an overlay when `codeSamples` is enabled. Return undefined to skip. */
|
|
207
|
+
sample?: (operation: OperationModel, ctx: SampleContext) => CodeSample | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* Optional: the reference documentation for what `run` emits — a Markdown page per
|
|
210
|
+
* generated artifact, returned like `run`'s files. Called only when `client.docs` (or
|
|
211
|
+
* `--docs`) is on, so documentation is one switch for the whole run instead of a
|
|
212
|
+
* generator name per language. A generator documents ITSELF: nothing else knows its
|
|
213
|
+
* call syntax, and ejecting the generator takes its page with it.
|
|
214
|
+
*/
|
|
215
|
+
docs?: Generator;
|
|
50
216
|
requires?: string[];
|
|
51
217
|
errorModes?: ErrorMode[];
|
|
52
218
|
dateTypes?: DateType[];
|
|
53
|
-
/**
|
|
54
|
-
|
|
219
|
+
/**
|
|
220
|
+
* Options this generator does not apply, mapped to the reason it doesn't. Setting
|
|
221
|
+
* one explicitly warns instead of being silently dropped — a global option
|
|
222
|
+
* (`outputMode`, `runtime`, …) may be meaningful for one selected generator and
|
|
223
|
+
* meaningless for another, so this informs rather than rejects.
|
|
224
|
+
*/
|
|
225
|
+
notApplicable?: Partial<Record<keyof EmitOptions | 'outputMode', string>>;
|
|
55
226
|
};
|
|
56
227
|
/**
|
|
57
228
|
* A user-authored generator (the public, experimental plugin contract): a `GeneratorDescriptor`
|
|
@@ -62,5 +233,12 @@ export type GeneratorDescriptor = {
|
|
|
62
233
|
export type CustomGenerator = GeneratorDescriptor & {
|
|
63
234
|
/** Unique name, used in `generators` selection, `requires`, and collision detection. */
|
|
64
235
|
name: string;
|
|
236
|
+
/**
|
|
237
|
+
* The `@redocly/client-generator` version range this module was written against —
|
|
238
|
+
* `^1.2.0`, `~1.2.0`, `>=1.2.0`, or an exact version. A CLI outside the range is
|
|
239
|
+
* rejected at resolve time with the fix path; omitting it accepts the generator as
|
|
240
|
+
* current (friction-free hand authoring). Ejected generators carry it automatically.
|
|
241
|
+
*/
|
|
242
|
+
requiresGenerator?: string;
|
|
65
243
|
};
|
|
66
244
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/generators/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/generators/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,KAAK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,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;CAC3E,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG;IAClD,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ApiModel } from '@redocly/client-generator';
|
|
2
|
+
/** The generated-by banner prepended to every emitted module. */
|
|
3
|
+
export declare const HEADER = "// Generated by @redocly/client-generator \u2014 do not edit by hand.\n// Source: OpenAPI description. Re-run `redocly generate-client` to update.";
|
|
4
|
+
/**
|
|
5
|
+
* Assemble file content from a header banner and a printed body: the leading
|
|
6
|
+
* `// Generated by …` comment and the `/** title */` block are structural
|
|
7
|
+
* banners (not part of the printed AST), prepended with blank-line separation.
|
|
8
|
+
* Trailing newline mirrors a hand-authored file.
|
|
9
|
+
*/
|
|
10
|
+
export declare function banner(sections: string[]): string;
|
|
11
|
+
export declare function renderTitleComment(model: ApiModel): string;
|
|
12
|
+
//# sourceMappingURL=banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../src/generators/typescript/banner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAG1D,iEAAiE;AACjE,eAAO,MAAM,MAAM,uJAC2D,CAAC;AAE/E;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAEjD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAa1D"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { splitLines } from '
|
|
2
|
-
import { escapeJsDoc } from './ts.js';
|
|
1
|
+
import { escapeJsDoc, splitLines } from '@redocly/client-generator/printers/typescript';
|
|
3
2
|
/** The generated-by banner prepended to every emitted module. */
|
|
4
3
|
export const HEADER = `// Generated by @redocly/client-generator — do not edit by hand.
|
|
5
4
|
// Source: OpenAPI description. Re-run \`redocly generate-client\` to update.`;
|
|
@@ -26,4 +25,4 @@ export function renderTitleComment(model) {
|
|
|
26
25
|
lines.push(' */');
|
|
27
26
|
return lines.join('\n');
|
|
28
27
|
}
|
|
29
|
-
//# sourceMappingURL=
|
|
28
|
+
//# sourceMappingURL=banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.js","sourceRoot":"","sources":["../../../src/generators/typescript/banner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAExF,iEAAiE;AACjE,MAAM,CAAC,MAAM,MAAM,GAAG;8EACwD,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,QAAkB;IACvC,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAe;IAChD,8EAA8E;IAC9E,gFAAgF;IAChF,8EAA8E;IAC9E,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,MAAM,WAAW,CAAC,GAAG,KAAK,CAAC,KAAK,MAAM,KAAK,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC;IACjF,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;QACtB,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;YAC9D,kFAAkF;YAClF,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ApiModel, type EmitOptions } from '@redocly/client-generator';
|
|
2
|
+
import { type InlineRuntimeNeeds } from './inline-runtime.ts';
|
|
3
|
+
export declare function emitClientSingleFile(model: ApiModel, options?: EmitOptions): string;
|
|
4
|
+
/** Which optional runtime capabilities this API needs (drives both distribution modes). */
|
|
5
|
+
export declare function runtimeNeeds(model: ApiModel, options: EmitOptions): InlineRuntimeNeeds;
|
|
6
|
+
/**
|
|
7
|
+
* `runtime: 'module'`: the runtime files written into `runtime/` beside the client —
|
|
8
|
+
* the raw per-needs modules plus the generated factory, each under the standard banner.
|
|
9
|
+
*/
|
|
10
|
+
export declare function emitRuntimeFiles(model: ApiModel, options: EmitOptions): Array<{
|
|
11
|
+
name: string;
|
|
12
|
+
content: string;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* `split` mode: the same client with the schema types + type guards carved out into a
|
|
16
|
+
* sibling `<stem>.schemas.ts`. The entry file re-exports the schemas module
|
|
17
|
+
* (`export *`) and type-imports exactly the schema names its own code references, so
|
|
18
|
+
* both files hold under `noUnusedLocals`. `schemas` is absent when the document
|
|
19
|
+
* declares no schema statements (the entry is then self-contained).
|
|
20
|
+
*/
|
|
21
|
+
export declare function emitClientSplit(model: ApiModel, options: EmitOptions, stem: string): {
|
|
22
|
+
entry: string;
|
|
23
|
+
schemas?: string;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/generators/typescript/client.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,WAAW,EAEjB,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,qBAAqB,CAAC;AAW7B,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAEvF;AAED,2FAA2F;AAC3F,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,GAAG,kBAAkB,CAWtF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,WAAW,GACnB,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAK1C;AAqBD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,GACX;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAErC"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// Client assembly, shared by both output modes. The generated file embeds the
|
|
2
|
+
// assembled runtime sources (./inline-runtime.ts). Single-file layout:
|
|
3
|
+
// schema types → type guards → `<Op>*` aliases → Ops → OPERATIONS → embedded
|
|
4
|
+
// runtime → (baked setup) → client instance → sugar — the embedded types are
|
|
5
|
+
// already exported in place, so no re-exports. Split mode moves the schema types +
|
|
6
|
+
// guards into a sibling `<stem>.schemas.ts` the entry re-exports (`emitClientSplit`).
|
|
7
|
+
// Text templates throughout — no `typescript` at generate time.
|
|
8
|
+
import { allOperations, } from '@redocly/client-generator';
|
|
9
|
+
import { codeString } from '@redocly/client-generator/printers/typescript';
|
|
10
|
+
import { banner, HEADER, renderTitleComment } from "./banner.js";
|
|
11
|
+
import { packageIdents, renderDescriptors } from "./descriptor.js";
|
|
12
|
+
import { assembleInlineRuntime, runtimeModuleFiles, } from "./inline-runtime.js";
|
|
13
|
+
import { isTypedMultipart } from "./operation-types.js";
|
|
14
|
+
import { collectEntrySchemaRefs, renderAliases, renderOpsType, } from "./operations.js";
|
|
15
|
+
import { renderTypeGuards } from "./type-guards.js";
|
|
16
|
+
import { renderTypeAliases } from "./types.js";
|
|
17
|
+
export function emitClientSingleFile(model, options = {}) {
|
|
18
|
+
return emitClient(model, options).entry;
|
|
19
|
+
}
|
|
20
|
+
/** Which optional runtime capabilities this API needs (drives both distribution modes). */
|
|
21
|
+
export function runtimeNeeds(model, options) {
|
|
22
|
+
const ops = allOperations(model.services);
|
|
23
|
+
return {
|
|
24
|
+
multipart: ops.some((op) => op.requestBody && isTypedMultipart(op.requestBody)),
|
|
25
|
+
// Auth sugar needs schemes; `resolveAuth` fires when a descriptor carries
|
|
26
|
+
// `security` — a valid spec implies the former, but embed on either.
|
|
27
|
+
auth: model.securitySchemes.length > 0 || ops.some((op) => op.security.length > 0),
|
|
28
|
+
sse: ops.some((op) => op.sse !== undefined),
|
|
29
|
+
setup: !!options.setup,
|
|
30
|
+
paginate: (options.pagination ?? new Map()).size > 0,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* `runtime: 'module'`: the runtime files written into `runtime/` beside the client —
|
|
35
|
+
* the raw per-needs modules plus the generated factory, each under the standard banner.
|
|
36
|
+
*/
|
|
37
|
+
export function emitRuntimeFiles(model, options) {
|
|
38
|
+
if (options.runtime !== 'module')
|
|
39
|
+
return [];
|
|
40
|
+
return runtimeModuleFiles(runtimeNeeds(model, options), options.importExt ?? 'js').map(({ name, content }) => ({ name, content: `${HEADER}\n\n${content.trim()}\n` }));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The module-mode replacement for the embedded block: the entry imports what its own
|
|
44
|
+
* code references and re-exports the factory's public surface (the same names the
|
|
45
|
+
* inline embed leaves in module scope).
|
|
46
|
+
*/
|
|
47
|
+
function runtimeImports(options, ctx, hasOps) {
|
|
48
|
+
const ext = options.importExt ?? 'js';
|
|
49
|
+
const typeNames = [
|
|
50
|
+
'OperationDescriptor',
|
|
51
|
+
...(options.setup ? ['ClientConfig', 'Middleware'] : []),
|
|
52
|
+
...(ctx.errorMode === 'result' && hasOps ? ['Result'] : []),
|
|
53
|
+
].sort();
|
|
54
|
+
return [
|
|
55
|
+
`import { createClient${options.setup ? ', mergeSetup' : ''} } from './runtime/factory.${ext}';`,
|
|
56
|
+
`import type { ${typeNames.join(', ')} } from './runtime/types.${ext}';`,
|
|
57
|
+
`export * from './runtime/factory.${ext}';`,
|
|
58
|
+
].join('\n');
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* `split` mode: the same client with the schema types + type guards carved out into a
|
|
62
|
+
* sibling `<stem>.schemas.ts`. The entry file re-exports the schemas module
|
|
63
|
+
* (`export *`) and type-imports exactly the schema names its own code references, so
|
|
64
|
+
* both files hold under `noUnusedLocals`. `schemas` is absent when the document
|
|
65
|
+
* declares no schema statements (the entry is then self-contained).
|
|
66
|
+
*/
|
|
67
|
+
export function emitClientSplit(model, options, stem) {
|
|
68
|
+
return emitClient(model, options, stem);
|
|
69
|
+
}
|
|
70
|
+
/** The shared assembly; `splitStem` (when given) selects the two-file split layout. */
|
|
71
|
+
function emitClient(model, options, splitStem) {
|
|
72
|
+
const ops = allOperations(model.services);
|
|
73
|
+
const idents = packageIdents(model);
|
|
74
|
+
// Resolved (and VERIFIED) up front: an explicit rule that doesn't fit throws here,
|
|
75
|
+
// before any statement is built — one aggregated error for the whole model.
|
|
76
|
+
const pagination = options.pagination ?? new Map();
|
|
77
|
+
const ctx = {
|
|
78
|
+
argsStyle: options.argsStyle ?? 'grouped',
|
|
79
|
+
errorMode: options.errorMode ?? 'throw',
|
|
80
|
+
dateType: options.dateType ?? 'string',
|
|
81
|
+
schemaNames: new Set(model.schemas.map((s) => s.name)),
|
|
82
|
+
schemas: model.schemas,
|
|
83
|
+
pagination,
|
|
84
|
+
};
|
|
85
|
+
const wiring = ops.length > 0
|
|
86
|
+
? [
|
|
87
|
+
renderOpsType(model, idents, ctx),
|
|
88
|
+
renderDescriptors(model, idents, ctx.dateType, pagination, ctx.argsStyle),
|
|
89
|
+
]
|
|
90
|
+
: // A spec with no operations still gets the uniform wiring shape.
|
|
91
|
+
[
|
|
92
|
+
'export type Ops = Record<string, never>;',
|
|
93
|
+
'export const OPERATIONS = {} as const satisfies Record<string, OperationDescriptor>;',
|
|
94
|
+
];
|
|
95
|
+
const runtimeSection = options.runtime === 'module'
|
|
96
|
+
? runtimeImports(options, ctx, ops.length > 0)
|
|
97
|
+
: assembleInlineRuntime(runtimeNeeds(model, options));
|
|
98
|
+
const schemaSection = [
|
|
99
|
+
renderTypeAliases(model.schemas, ctx.dateType),
|
|
100
|
+
renderTypeGuards(model.schemas),
|
|
101
|
+
]
|
|
102
|
+
.filter((section) => section.length > 0)
|
|
103
|
+
.join('\n\n');
|
|
104
|
+
const bodySection = [...ops.map((op) => renderAliases(op, ctx)), ...wiring]
|
|
105
|
+
.filter((section) => section.length > 0)
|
|
106
|
+
.join('\n\n');
|
|
107
|
+
const sugar = sugarSection(ops, idents);
|
|
108
|
+
// Layout puts the reader's OWN API first (types → aliases → Ops → OPERATIONS) and the
|
|
109
|
+
// machinery after it. The runtime block sits between the descriptors and the `client`
|
|
110
|
+
// initializer — after it for readability, before `client` so every declaration the
|
|
111
|
+
// module-init call chain touches (hoisted functions AND any future top-level const)
|
|
112
|
+
// is already evaluated.
|
|
113
|
+
const moduleMode = options.runtime === 'module';
|
|
114
|
+
if (splitStem === undefined) {
|
|
115
|
+
return {
|
|
116
|
+
entry: banner([
|
|
117
|
+
HEADER,
|
|
118
|
+
renderTitleComment(model),
|
|
119
|
+
...(moduleMode ? [runtimeSection] : []),
|
|
120
|
+
[schemaSection, bodySection].filter((section) => section.length > 0).join('\n\n'),
|
|
121
|
+
...(moduleMode ? [] : [runtimeSection]),
|
|
122
|
+
clientSection(options, ctx, model),
|
|
123
|
+
sugar,
|
|
124
|
+
]),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const hasSchemas = schemaSection.length > 0;
|
|
128
|
+
return {
|
|
129
|
+
entry: banner([
|
|
130
|
+
HEADER,
|
|
131
|
+
renderTitleComment(model),
|
|
132
|
+
...(moduleMode ? [runtimeSection] : []),
|
|
133
|
+
hasSchemas
|
|
134
|
+
? schemaLinks(model, ctx, `./${splitStem}.schemas.${options.importExt ?? 'js'}`)
|
|
135
|
+
: '',
|
|
136
|
+
bodySection,
|
|
137
|
+
...(moduleMode ? [] : [runtimeSection]),
|
|
138
|
+
clientSection(options, ctx, model),
|
|
139
|
+
sugar,
|
|
140
|
+
]),
|
|
141
|
+
schemas: hasSchemas ? banner([HEADER, renderTitleComment(model), schemaSection]) : undefined,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The entry ⇄ schemas linkage of the split layout: a type-only import of exactly the
|
|
146
|
+
* schema names the entry's own code references (derived from the IR — the same
|
|
147
|
+
* sources the alias/Ops renderers type), plus the public `export *` re-export.
|
|
148
|
+
*/
|
|
149
|
+
function schemaLinks(model, ctx, specifier) {
|
|
150
|
+
const names = collectEntrySchemaRefs(model, ctx);
|
|
151
|
+
const importLine = names.length > 0 ? `import type { ${names.join(', ')} } from '${specifier}';\n` : '';
|
|
152
|
+
return `${importLine}export * from '${specifier}';`;
|
|
153
|
+
}
|
|
154
|
+
/** The (optional) baked setup + the default `client` instance. */
|
|
155
|
+
function clientSection(options, ctx, model) {
|
|
156
|
+
const serverUrl = options.serverUrl ?? model.serverUrl;
|
|
157
|
+
const fields = [
|
|
158
|
+
// Always baked when the document declares one: the runtime's fallback is a
|
|
159
|
+
// relative URL, which Node's fetch rejects.
|
|
160
|
+
...(serverUrl !== undefined ? [`serverUrl: ${codeString(serverUrl)}`] : []),
|
|
161
|
+
...(ctx.errorMode === 'result' ? ['errorMode: "result"'] : []),
|
|
162
|
+
// The runtime converts a merged call to the namespaced shape, so it has to know
|
|
163
|
+
// which style this module's types promise.
|
|
164
|
+
...(ctx.argsStyle === 'flat' ? ['argsStyle: "flat"'] : []),
|
|
165
|
+
// Client identification for API-owner telemetry; the runtime sends it only
|
|
166
|
+
// outside browsers, and `configure({ clientHeader: false })` disables it.
|
|
167
|
+
'clientHeader: "redocly-client-generator"',
|
|
168
|
+
];
|
|
169
|
+
const config = fields.length > 0 ? `{ ${fields.join(', ')} }` : '{}';
|
|
170
|
+
// Precedence, lowest → highest: spec defaults → baked publisher setup → app `configure()`.
|
|
171
|
+
// The inner merge flattens the setup into a ClientConfig; the outer layers it OVER the
|
|
172
|
+
// spec defaults (mergeSetup's second argument wins per-field; middleware composes).
|
|
173
|
+
const configArg = options.setup
|
|
174
|
+
? `mergeSetup({ config: ${config} }, mergeSetup(__redoclySetup, {}))`
|
|
175
|
+
: config;
|
|
176
|
+
// The trailing type args narrow `ctx.operation` to the spec's literal unions.
|
|
177
|
+
// `OperationTag` mirrors the descriptor block's gate: derived only when some
|
|
178
|
+
// operation is tagged (it would otherwise be `never`); zero-ops specs have no
|
|
179
|
+
// derived unions at all, so they keep the string defaults.
|
|
180
|
+
const ops = allOperations(model.services);
|
|
181
|
+
const hasTags = ops.some((op) => op.tags.length > 0);
|
|
182
|
+
const typeArgs = ops.length > 0
|
|
183
|
+
? `<Ops, OperationId, OperationPath, ${hasTags ? 'OperationTag' : 'string'}>`
|
|
184
|
+
: '<Ops>';
|
|
185
|
+
const client = `export const client = createClient${typeArgs}(OPERATIONS, ${configArg});`;
|
|
186
|
+
if (!options.setup)
|
|
187
|
+
return client;
|
|
188
|
+
return ('// ─── Baked-in setup (--setup) ───\n' +
|
|
189
|
+
`const __redoclySetup: { config?: ClientConfig; middleware?: Middleware[] } = ${options.setup};\n` +
|
|
190
|
+
client);
|
|
191
|
+
}
|
|
192
|
+
/** Core destructure + per-scheme auth setters + per-operation call sugar. */
|
|
193
|
+
function sugarSection(ops, idents) {
|
|
194
|
+
// Credentials go through `configure({ auth })` or `client.auth.*` — one way per act.
|
|
195
|
+
// Per-scheme setters used to be exported here too, which gave the same act three
|
|
196
|
+
// spellings and a name per scheme that operation names then had to avoid.
|
|
197
|
+
const lines = ['export const { configure, use } = client;'];
|
|
198
|
+
if (ops.length === 0)
|
|
199
|
+
return lines.join('\n');
|
|
200
|
+
// Bindings, never wrappers: `updateOrder` IS `client.updateOrder`, so importing the name
|
|
201
|
+
// and reaching through the instance cannot disagree about the arguments. `argsStyle`
|
|
202
|
+
// shapes the method itself, which is why one binding serves both styles.
|
|
203
|
+
const names = ops.map((op) => idents.get(op.name)).join(', ');
|
|
204
|
+
lines.push(`export const { ${names} } = client;`);
|
|
205
|
+
return lines.join('\n');
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/generators/typescript/client.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,uEAAuE;AACvE,6EAA6E;AAC7E,6EAA6E;AAC7E,mFAAmF;AACnF,sFAAsF;AACtF,gEAAgE;AAEhE,OAAO,EACL,aAAa,GAId,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAE3E,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EACL,qBAAqB,EAErB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,sBAAsB,EAEtB,aAAa,EACb,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,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C,KAAK,KAAK;QAClG,MAAM,CACP,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,SAAS,YAAY,CAAC,GAAqB,EAAE,MAA2B;IACtE,qFAAqF;IACrF,iFAAiF;IACjF,0EAA0E;IAC1E,MAAM,KAAK,GAAG,CAAC,2CAA2C,CAAC,CAAC;IAC5D,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9C,yFAAyF;IACzF,qFAAqF;IACrF,yEAAyE;IACzE,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,KAAK,CAAC,IAAI,CAAC,kBAAkB,KAAK,cAAc,CAAC,CAAC;IAClD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ApiModel, type ArgsStyle, type DateType, type ModelPagination } from '@redocly/client-generator';
|
|
2
|
+
/**
|
|
3
|
+
* Operation-name → emitted-identifier plan. The full reserved set (wiring + imported
|
|
4
|
+
* bindings, computed from the model FIRST) is seeded before any operation
|
|
5
|
+
* is sanitized, so collisions rename the operation (`configure` → `configure_2`)
|
|
6
|
+
* deterministically regardless of document order.
|
|
7
|
+
*/
|
|
8
|
+
export declare function packageIdents(model: ApiModel): Map<string, string>;
|
|
9
|
+
/** `export const OPERATIONS = {…} as const satisfies …` + the derived unions. */
|
|
10
|
+
export declare function renderDescriptors(model: ApiModel, idents: Map<string, string>, dateType: DateType, pagination?: ModelPagination, argsStyle?: ArgsStyle): string;
|
|
11
|
+
//# sourceMappingURL=descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../../../src/generators/typescript/descriptor.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,eAAe,EAMrB,MAAM,2BAA2B,CAAC;AAQnC;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAKlE;AAyDD,iFAAiF;AACjF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3B,QAAQ,EAAE,QAAQ,EAClB,UAAU,CAAC,EAAE,eAAe,EAC5B,SAAS,GAAE,SAAqB,GAC/B,MAAM,CAiCR"}
|