@kubb/plugin-client 5.0.0-beta.27 → 5.0.0-beta.28
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/clients/fetch.cjs +1 -1
- package/dist/clients/fetch.cjs.map +1 -1
- package/dist/clients/fetch.js +1 -1
- package/dist/clients/fetch.js.map +1 -1
- package/dist/index.cjs +72 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +72 -22
- package/dist/index.js.map +1 -1
- package/dist/templates/clients/axios.source.cjs +1 -1
- package/dist/templates/clients/axios.source.js +1 -1
- package/dist/templates/clients/fetch.source.cjs +1 -1
- package/dist/templates/clients/fetch.source.js +1 -1
- package/extension.yaml +14 -14
- package/package.json +6 -6
- package/src/clients/fetch.ts +1 -1
- package/src/components/ClassClient.tsx +1 -1
- package/src/components/Client.tsx +2 -2
- package/src/components/StaticClassClient.tsx +1 -1
- package/src/generators/classClientGenerator.tsx +6 -6
- package/src/generators/clientGenerator.tsx +4 -4
- package/src/generators/groupedClientGenerator.tsx +2 -2
- package/src/generators/operationsGenerator.tsx +2 -2
- package/src/generators/staticClassClientGenerator.tsx +4 -4
package/dist/index.js
CHANGED
|
@@ -676,7 +676,7 @@ function Client({ name, isExportable = true, isIndexable = true, returnType, bas
|
|
|
676
676
|
}) },
|
|
677
677
|
returnType,
|
|
678
678
|
children: [
|
|
679
|
-
isConfigurable ? `const { client: request =
|
|
679
|
+
isConfigurable ? `const { client: request = client, ${isMultipleContentTypes ? `contentType = ${JSON.stringify(contentType)}, ` : ""}...requestConfig } = config` : "",
|
|
680
680
|
/* @__PURE__ */ jsx("br", {}),
|
|
681
681
|
/* @__PURE__ */ jsx("br", {}),
|
|
682
682
|
pathParamsMapping && Object.entries(pathParamsMapping).filter(([originalName, camelCaseName]) => isValidVarName(originalName) && originalName !== camelCaseName).map(([originalName, camelCaseName]) => `const ${originalName} = ${camelCaseName}`).join("\n"),
|
|
@@ -695,7 +695,7 @@ function Client({ name, isExportable = true, isIndexable = true, returnType, bas
|
|
|
695
695
|
/* @__PURE__ */ jsx("br", {}),
|
|
696
696
|
(isFormData || isMultipleContentTypes && hasFormData) && requestName && "const formData = buildFormData(requestData)",
|
|
697
697
|
/* @__PURE__ */ jsx("br", {}),
|
|
698
|
-
isConfigurable ? `const res = await request<${generics.join(", ")}>(${clientParams.toCall()})` : `const res = await
|
|
698
|
+
isConfigurable ? `const res = await request<${generics.join(", ")}>(${clientParams.toCall()})` : `const res = await client<${generics.join(", ")}>(${clientParams.toCall()})`,
|
|
699
699
|
/* @__PURE__ */ jsx("br", {}),
|
|
700
700
|
childrenElement
|
|
701
701
|
]
|
|
@@ -824,7 +824,7 @@ function generateMethod$1({ node, name, tsResolver, zodResolver, baseURL, dataRe
|
|
|
824
824
|
zodResolver
|
|
825
825
|
});
|
|
826
826
|
return `${jsdoc}async ${name}(${paramsSignature}) {\n${[
|
|
827
|
-
`const { client: request =
|
|
827
|
+
`const { client: request = client, ${isMultipleContentTypes ? `contentType = ${JSON.stringify(contentType)}, ` : ""}...requestConfig } = mergeConfig(this.#config, config)`,
|
|
828
828
|
"",
|
|
829
829
|
requestDataLine,
|
|
830
830
|
formDataLine,
|
|
@@ -1031,16 +1031,24 @@ const classClientGenerator = defineGenerator({
|
|
|
1031
1031
|
meta: file.meta,
|
|
1032
1032
|
banner: resolver.resolveBanner(ctx.meta, {
|
|
1033
1033
|
output,
|
|
1034
|
-
config
|
|
1034
|
+
config,
|
|
1035
|
+
file: {
|
|
1036
|
+
path: file.path,
|
|
1037
|
+
baseName: file.baseName
|
|
1038
|
+
}
|
|
1035
1039
|
}),
|
|
1036
1040
|
footer: resolver.resolveFooter(ctx.meta, {
|
|
1037
1041
|
output,
|
|
1038
|
-
config
|
|
1042
|
+
config,
|
|
1043
|
+
file: {
|
|
1044
|
+
path: file.path,
|
|
1045
|
+
baseName: file.baseName
|
|
1046
|
+
}
|
|
1039
1047
|
}),
|
|
1040
1048
|
children: [
|
|
1041
1049
|
importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1042
1050
|
/* @__PURE__ */ jsx(File.Import, {
|
|
1043
|
-
name: "
|
|
1051
|
+
name: "client",
|
|
1044
1052
|
path: importPath
|
|
1045
1053
|
}),
|
|
1046
1054
|
/* @__PURE__ */ jsx(File.Import, {
|
|
@@ -1058,7 +1066,7 @@ const classClientGenerator = defineGenerator({
|
|
|
1058
1066
|
})
|
|
1059
1067
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1060
1068
|
/* @__PURE__ */ jsx(File.Import, {
|
|
1061
|
-
name: ["
|
|
1069
|
+
name: ["client"],
|
|
1062
1070
|
root: file.path,
|
|
1063
1071
|
path: path.resolve(root, ".kubb/client.ts")
|
|
1064
1072
|
}),
|
|
@@ -1134,11 +1142,19 @@ const classClientGenerator = defineGenerator({
|
|
|
1134
1142
|
meta: sdkFile.meta,
|
|
1135
1143
|
banner: resolver.resolveBanner(ctx.meta, {
|
|
1136
1144
|
output,
|
|
1137
|
-
config
|
|
1145
|
+
config,
|
|
1146
|
+
file: {
|
|
1147
|
+
path: sdkFile.path,
|
|
1148
|
+
baseName: sdkFile.baseName
|
|
1149
|
+
}
|
|
1138
1150
|
}),
|
|
1139
1151
|
footer: resolver.resolveFooter(ctx.meta, {
|
|
1140
1152
|
output,
|
|
1141
|
-
config
|
|
1153
|
+
config,
|
|
1154
|
+
file: {
|
|
1155
|
+
path: sdkFile.path,
|
|
1156
|
+
baseName: sdkFile.baseName
|
|
1157
|
+
}
|
|
1142
1158
|
}),
|
|
1143
1159
|
children: [
|
|
1144
1160
|
importPath ? /* @__PURE__ */ jsx(File.Import, {
|
|
@@ -1231,15 +1247,23 @@ const clientGenerator = defineGenerator({
|
|
|
1231
1247
|
meta: meta.file.meta,
|
|
1232
1248
|
banner: resolver.resolveBanner(ctx.meta, {
|
|
1233
1249
|
output,
|
|
1234
|
-
config
|
|
1250
|
+
config,
|
|
1251
|
+
file: {
|
|
1252
|
+
path: meta.file.path,
|
|
1253
|
+
baseName: meta.file.baseName
|
|
1254
|
+
}
|
|
1235
1255
|
}),
|
|
1236
1256
|
footer: resolver.resolveFooter(ctx.meta, {
|
|
1237
1257
|
output,
|
|
1238
|
-
config
|
|
1258
|
+
config,
|
|
1259
|
+
file: {
|
|
1260
|
+
path: meta.file.path,
|
|
1261
|
+
baseName: meta.file.baseName
|
|
1262
|
+
}
|
|
1239
1263
|
}),
|
|
1240
1264
|
children: [
|
|
1241
1265
|
importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Import, {
|
|
1242
|
-
name: "
|
|
1266
|
+
name: "client",
|
|
1243
1267
|
path: importPath
|
|
1244
1268
|
}), /* @__PURE__ */ jsx(File.Import, {
|
|
1245
1269
|
name: [
|
|
@@ -1250,7 +1274,7 @@ const clientGenerator = defineGenerator({
|
|
|
1250
1274
|
path: importPath,
|
|
1251
1275
|
isTypeOnly: true
|
|
1252
1276
|
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Import, {
|
|
1253
|
-
name: ["
|
|
1277
|
+
name: ["client"],
|
|
1254
1278
|
root: meta.file.path,
|
|
1255
1279
|
path: path.resolve(root, ".kubb/client.ts")
|
|
1256
1280
|
}), /* @__PURE__ */ jsx(File.Import, {
|
|
@@ -1365,11 +1389,21 @@ const groupedClientGenerator = defineGenerator({
|
|
|
1365
1389
|
meta: file.meta,
|
|
1366
1390
|
banner: resolver.resolveBanner(ctx.meta, {
|
|
1367
1391
|
output,
|
|
1368
|
-
config
|
|
1392
|
+
config,
|
|
1393
|
+
file: {
|
|
1394
|
+
path: file.path,
|
|
1395
|
+
baseName: file.baseName,
|
|
1396
|
+
isAggregation: true
|
|
1397
|
+
}
|
|
1369
1398
|
}),
|
|
1370
1399
|
footer: resolver.resolveFooter(ctx.meta, {
|
|
1371
1400
|
output,
|
|
1372
|
-
config
|
|
1401
|
+
config,
|
|
1402
|
+
file: {
|
|
1403
|
+
path: file.path,
|
|
1404
|
+
baseName: file.baseName,
|
|
1405
|
+
isAggregation: true
|
|
1406
|
+
}
|
|
1373
1407
|
}),
|
|
1374
1408
|
children: [clients.map((client) => /* @__PURE__ */ jsx(File.Import, {
|
|
1375
1409
|
name: [client.name],
|
|
@@ -1439,11 +1473,19 @@ const operationsGenerator = defineGenerator({
|
|
|
1439
1473
|
meta: file.meta,
|
|
1440
1474
|
banner: resolver.resolveBanner(ctx.meta, {
|
|
1441
1475
|
output,
|
|
1442
|
-
config
|
|
1476
|
+
config,
|
|
1477
|
+
file: {
|
|
1478
|
+
path: file.path,
|
|
1479
|
+
baseName: file.baseName
|
|
1480
|
+
}
|
|
1443
1481
|
}),
|
|
1444
1482
|
footer: resolver.resolveFooter(ctx.meta, {
|
|
1445
1483
|
output,
|
|
1446
|
-
config
|
|
1484
|
+
config,
|
|
1485
|
+
file: {
|
|
1486
|
+
path: file.path,
|
|
1487
|
+
baseName: file.baseName
|
|
1488
|
+
}
|
|
1447
1489
|
}),
|
|
1448
1490
|
children: /* @__PURE__ */ jsx(Operations, {
|
|
1449
1491
|
name,
|
|
@@ -1500,7 +1542,7 @@ function generateMethod({ node, name, tsResolver, zodResolver, baseURL, dataRetu
|
|
|
1500
1542
|
zodResolver
|
|
1501
1543
|
});
|
|
1502
1544
|
return `${jsdoc} static async ${name}(${paramsSignature}) {\n${[
|
|
1503
|
-
`const { client: request =
|
|
1545
|
+
`const { client: request = client, ${isMultipleContentTypes ? `contentType = ${JSON.stringify(contentType)}, ` : ""}...requestConfig } = mergeConfig(this.#config, config)`,
|
|
1504
1546
|
"",
|
|
1505
1547
|
requestDataLine,
|
|
1506
1548
|
formDataLine,
|
|
@@ -1678,16 +1720,24 @@ const staticClassClientGenerator = defineGenerator({
|
|
|
1678
1720
|
meta: file.meta,
|
|
1679
1721
|
banner: resolver.resolveBanner(ctx.meta, {
|
|
1680
1722
|
output,
|
|
1681
|
-
config
|
|
1723
|
+
config,
|
|
1724
|
+
file: {
|
|
1725
|
+
path: file.path,
|
|
1726
|
+
baseName: file.baseName
|
|
1727
|
+
}
|
|
1682
1728
|
}),
|
|
1683
1729
|
footer: resolver.resolveFooter(ctx.meta, {
|
|
1684
1730
|
output,
|
|
1685
|
-
config
|
|
1731
|
+
config,
|
|
1732
|
+
file: {
|
|
1733
|
+
path: file.path,
|
|
1734
|
+
baseName: file.baseName
|
|
1735
|
+
}
|
|
1686
1736
|
}),
|
|
1687
1737
|
children: [
|
|
1688
1738
|
importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1689
1739
|
/* @__PURE__ */ jsx(File.Import, {
|
|
1690
|
-
name: "
|
|
1740
|
+
name: "client",
|
|
1691
1741
|
path: importPath
|
|
1692
1742
|
}),
|
|
1693
1743
|
/* @__PURE__ */ jsx(File.Import, {
|
|
@@ -1705,7 +1755,7 @@ const staticClassClientGenerator = defineGenerator({
|
|
|
1705
1755
|
})
|
|
1706
1756
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1707
1757
|
/* @__PURE__ */ jsx(File.Import, {
|
|
1708
|
-
name: ["
|
|
1758
|
+
name: ["client"],
|
|
1709
1759
|
root: file.path,
|
|
1710
1760
|
path: path.resolve(root, ".kubb/client.ts")
|
|
1711
1761
|
}),
|