@kubb/plugin-client 5.12.0-canary.20261109T125041 → 5.12.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/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/docs/options.md +24 -0
- package/package.json +5 -5
- package/src/plugin.ts +2 -1
- package/src/types.ts +13 -1
package/dist/index.d.cts
CHANGED
|
@@ -243,6 +243,18 @@ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K>
|
|
|
243
243
|
* ```
|
|
244
244
|
*/
|
|
245
245
|
type Options = DistributiveOmit<Options$1, 'sdk' | 'returnType' | 'baseURL' | 'override'> & {
|
|
246
|
+
/**
|
|
247
|
+
* Shape of the value a generated operation resolves to. `'full'` and `'data'` import `withUnwrap` or `unwrapResult`
|
|
248
|
+
* and their types from your `importPath` module, so that module must export them.
|
|
249
|
+
*
|
|
250
|
+
* @default 'plain'
|
|
251
|
+
* @example
|
|
252
|
+
* ```ts
|
|
253
|
+
* pluginClient({ importPath: '../../client', returnType: 'full' })
|
|
254
|
+
* // await getPetById({ path: { petId: 1 } }).unwrap()
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
returnType?: ReturnTypeOption;
|
|
246
258
|
/**
|
|
247
259
|
* Applies different options to operations that match a pattern.
|
|
248
260
|
* `sdk`, `returnType`, and `baseURL` are not available, because this plugin generates standalone operations and your client module owns the base URL.
|
package/dist/index.d.ts
CHANGED
|
@@ -243,6 +243,18 @@ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K>
|
|
|
243
243
|
* ```
|
|
244
244
|
*/
|
|
245
245
|
type Options = DistributiveOmit<Options$1, 'sdk' | 'returnType' | 'baseURL' | 'override'> & {
|
|
246
|
+
/**
|
|
247
|
+
* Shape of the value a generated operation resolves to. `'full'` and `'data'` import `withUnwrap` or `unwrapResult`
|
|
248
|
+
* and their types from your `importPath` module, so that module must export them.
|
|
249
|
+
*
|
|
250
|
+
* @default 'plain'
|
|
251
|
+
* @example
|
|
252
|
+
* ```ts
|
|
253
|
+
* pluginClient({ importPath: '../../client', returnType: 'full' })
|
|
254
|
+
* // await getPetById({ path: { petId: 1 } }).unwrap()
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
returnType?: ReturnTypeOption;
|
|
246
258
|
/**
|
|
247
259
|
* Applies different options to operations that match a pattern.
|
|
248
260
|
* `sdk`, `returnType`, and `baseURL` are not available, because this plugin generates standalone operations and your client module owns the base URL.
|
package/dist/index.js
CHANGED
|
@@ -191,7 +191,7 @@ function getRequestGroupOptionality(node) {
|
|
|
191
191
|
hasRequiredPath,
|
|
192
192
|
hasRequiredQuery,
|
|
193
193
|
hasRequiredHeader,
|
|
194
|
-
isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !groups.body
|
|
194
|
+
isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !(groups.body && node.requestBody?.required === true)
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
197
|
function buildOperationComments(node, options = {}) {
|
|
@@ -482,7 +482,7 @@ var compatibility = {
|
|
|
482
482
|
"node": ">=22.22"
|
|
483
483
|
};
|
|
484
484
|
// package.json
|
|
485
|
-
var version = "5.12.0
|
|
485
|
+
var version = "5.12.0";
|
|
486
486
|
// ../../internals/client/src/builders/validatorOptions.ts
|
|
487
487
|
/**
|
|
488
488
|
* Returns `true` when any direction of the validator uses zod (used for dependency checks).
|
|
@@ -1344,7 +1344,7 @@ const pluginClient = defineExtension({
|
|
|
1344
1344
|
const { output = {
|
|
1345
1345
|
path: "clients",
|
|
1346
1346
|
barrel: { type: "named" }
|
|
1347
|
-
}, exclude = [], include, override = [], importPath, throwOnErrorDefault = true, validator = false, group, resolver: userResolver } = options;
|
|
1347
|
+
}, exclude = [], include, override = [], importPath, throwOnErrorDefault = true, validator = false, returnType = "plain", group, resolver: userResolver } = options;
|
|
1348
1348
|
const resolver = userResolver ? Resolver.merge(resolverClient, userResolver) : resolverClient;
|
|
1349
1349
|
setResolver(resolver);
|
|
1350
1350
|
setMacros([...defaultMacros, ...options.macros ?? []]);
|
|
@@ -1359,7 +1359,7 @@ const pluginClient = defineExtension({
|
|
|
1359
1359
|
baseURL: void 0,
|
|
1360
1360
|
throwOnErrorDefault,
|
|
1361
1361
|
validator,
|
|
1362
|
-
returnType
|
|
1362
|
+
returnType,
|
|
1363
1363
|
sdk: void 0,
|
|
1364
1364
|
resolver
|
|
1365
1365
|
};
|