@hey-api/openapi-ts 0.93.0 → 0.94.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 +13 -12
- package/dist/clients/angular/client.ts +5 -3
- package/dist/clients/axios/client.ts +4 -1
- package/dist/clients/core/bodySerializer.ts +6 -8
- package/dist/clients/core/params.ts +1 -1
- package/dist/clients/fetch/client.ts +5 -3
- package/dist/clients/ky/client.ts +5 -3
- package/dist/clients/next/client.ts +5 -3
- package/dist/clients/nuxt/client.ts +4 -1
- package/dist/clients/nuxt/utils.ts +4 -0
- package/dist/clients/ofetch/client.ts +5 -3
- package/dist/index.d.mts +889 -266
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{init-BVQKw3ZX.mjs → init-PHWYaLgi.mjs} +372 -111
- package/dist/init-PHWYaLgi.mjs.map +1 -0
- package/dist/internal.mjs +1 -1
- package/dist/run.mjs +5 -5
- package/dist/run.mjs.map +1 -1
- package/dist/{src-BD5OAshH.mjs → src-1D7PrOtb.mjs} +2 -2
- package/dist/{src-BD5OAshH.mjs.map → src-1D7PrOtb.mjs.map} +1 -1
- package/package.json +4 -4
- package/dist/init-BVQKw3ZX.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { StructureModel, detectInteractiveSession, fromRef, isNode, isRef, isSymbol, loadConfigFile, log, nodeBrand, ref, refs } from "@hey-api/codegen-core";
|
|
3
|
-
import { ConfigError, OperationPath, OperationStrategy, applyNaming, childContext, createOperationKey, createSchemaProcessor, createSchemaWalker, deduplicateSchema, definePluginConfig, dependencyFactory, ensureDirSync, escapeComment, findTsConfigPath, getInput, getLogs, getParser, hasOperationDataRequired, hasParameterGroupObjectRequired, loadTsConfig, mappers, operationPagination, operationResponsesMap, parseUrl, pathToJsonPointer, pathToName, refToName, resolveSource, satisfies, statusCodeToGroup, toCase, valueToObject } from "@hey-api/shared";
|
|
3
|
+
import { ConfigError, OperationPath, OperationStrategy, applyNaming, childContext, createOperationKey, createSchemaProcessor, createSchemaWalker, deduplicateSchema, definePluginConfig, dependencyFactory, ensureDirSync, escapeComment, findTsConfigPath, getInput, getLogs, getParser, hasOperationDataRequired, hasParameterGroupObjectRequired, loadTsConfig, mappers, operationPagination, operationResponsesMap, outputHeaderToPrefix, parseUrl, pathToJsonPointer, pathToName, refToName, resolveSource, satisfies, statusCodeToGroup, toCase, valueToObject } from "@hey-api/shared";
|
|
4
4
|
import colors from "ansi-colors";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
@@ -723,24 +723,51 @@ const regexp = {
|
|
|
723
723
|
//#region src/ts-dsl/utils/keywords.ts
|
|
724
724
|
const browserGlobals = [
|
|
725
725
|
"document",
|
|
726
|
+
"fetch",
|
|
726
727
|
"history",
|
|
727
728
|
"location",
|
|
728
729
|
"navigator",
|
|
729
|
-
"window"
|
|
730
|
+
"window",
|
|
731
|
+
"AbortController",
|
|
732
|
+
"AbortSignal",
|
|
733
|
+
"Blob",
|
|
734
|
+
"CustomEvent",
|
|
735
|
+
"Event",
|
|
736
|
+
"EventTarget",
|
|
737
|
+
"File",
|
|
738
|
+
"FileList",
|
|
739
|
+
"FileReader",
|
|
740
|
+
"FormData",
|
|
741
|
+
"Headers",
|
|
742
|
+
"Request",
|
|
743
|
+
"Response",
|
|
744
|
+
"TextDecoder",
|
|
745
|
+
"TextEncoder",
|
|
746
|
+
"URL",
|
|
747
|
+
"URLSearchParams"
|
|
730
748
|
];
|
|
731
749
|
const javaScriptGlobals = [
|
|
732
750
|
"console",
|
|
733
751
|
"Array",
|
|
752
|
+
"ArrayBuffer",
|
|
753
|
+
"BigInt",
|
|
754
|
+
"Boolean",
|
|
755
|
+
"DataView",
|
|
734
756
|
"Date",
|
|
735
757
|
"Error",
|
|
736
758
|
"Function",
|
|
737
759
|
"JSON",
|
|
738
760
|
"Map",
|
|
739
761
|
"Math",
|
|
762
|
+
"Number",
|
|
740
763
|
"Object",
|
|
741
764
|
"Promise",
|
|
765
|
+
"Proxy",
|
|
766
|
+
"Reflect",
|
|
742
767
|
"RegExp",
|
|
743
768
|
"Set",
|
|
769
|
+
"String",
|
|
770
|
+
"Symbol",
|
|
744
771
|
"WeakMap",
|
|
745
772
|
"WeakSet"
|
|
746
773
|
];
|
|
@@ -797,8 +824,13 @@ const javaScriptKeywords = [
|
|
|
797
824
|
"yield"
|
|
798
825
|
];
|
|
799
826
|
const nodeGlobals = [
|
|
827
|
+
"__dirname",
|
|
828
|
+
"__filename",
|
|
829
|
+
"exports",
|
|
800
830
|
"global",
|
|
831
|
+
"module",
|
|
801
832
|
"process",
|
|
833
|
+
"require",
|
|
802
834
|
"Buffer"
|
|
803
835
|
];
|
|
804
836
|
const typeScriptKeywords = [
|
|
@@ -887,21 +919,26 @@ const safePropName = (name) => {
|
|
|
887
919
|
if (regexp.typeScriptIdentifier.test(name)) return new IdTsDsl(name);
|
|
888
920
|
return new LiteralTsDsl(name);
|
|
889
921
|
};
|
|
922
|
+
const validTypeScriptChar = /^[\u200c\u200d\p{ID_Continue}]$/u;
|
|
890
923
|
const safeName = (name, reserved$1) => {
|
|
891
924
|
let sanitized = "";
|
|
892
925
|
let index;
|
|
893
926
|
const first = name[0] ?? "";
|
|
894
927
|
regexp.illegalStartCharacters.lastIndex = 0;
|
|
895
|
-
if (regexp.illegalStartCharacters.test(first)) {
|
|
928
|
+
if (regexp.illegalStartCharacters.test(first)) if (validTypeScriptChar.test(first)) {
|
|
896
929
|
sanitized += "_";
|
|
897
930
|
index = 0;
|
|
898
931
|
} else {
|
|
932
|
+
sanitized += "_";
|
|
933
|
+
index = 1;
|
|
934
|
+
}
|
|
935
|
+
else {
|
|
899
936
|
sanitized += first;
|
|
900
937
|
index = 1;
|
|
901
938
|
}
|
|
902
939
|
while (index < name.length) {
|
|
903
940
|
const char = name[index] ?? "";
|
|
904
|
-
sanitized +=
|
|
941
|
+
sanitized += validTypeScriptChar.test(char) ? char : "_";
|
|
905
942
|
index += 1;
|
|
906
943
|
}
|
|
907
944
|
if (reserved$1["~values"].has(sanitized)) sanitized = `${sanitized}_`;
|
|
@@ -4401,7 +4438,7 @@ function getSignatureParameters({ operation }) {
|
|
|
4401
4438
|
const property = properties[originalName];
|
|
4402
4439
|
const name = conflicts.has(originalName) ? `${location}_${originalName}` : originalName;
|
|
4403
4440
|
const signatureParameter = {
|
|
4404
|
-
isRequired:
|
|
4441
|
+
isRequired: operation.body.schema.required?.includes(originalName) ?? false,
|
|
4405
4442
|
name,
|
|
4406
4443
|
schema: property
|
|
4407
4444
|
};
|
|
@@ -5241,7 +5278,7 @@ const handler$11 = ({ plugin }) => {
|
|
|
5241
5278
|
|
|
5242
5279
|
//#endregion
|
|
5243
5280
|
//#region src/plugins/@angular/common/config.ts
|
|
5244
|
-
const defaultConfig$
|
|
5281
|
+
const defaultConfig$24 = {
|
|
5245
5282
|
config: {
|
|
5246
5283
|
comments: true,
|
|
5247
5284
|
includeInEntry: false
|
|
@@ -5257,7 +5294,7 @@ const defaultConfig$23 = {
|
|
|
5257
5294
|
/**
|
|
5258
5295
|
* Type helper for `@angular/common` plugin, returns {@link Plugin.Config} object
|
|
5259
5296
|
*/
|
|
5260
|
-
const defineConfig$
|
|
5297
|
+
const defineConfig$24 = definePluginConfig(defaultConfig$24);
|
|
5261
5298
|
|
|
5262
5299
|
//#endregion
|
|
5263
5300
|
//#region src/plugins/@faker-js/faker/api.ts
|
|
@@ -5268,7 +5305,7 @@ var Api$4 = class {
|
|
|
5268
5305
|
|
|
5269
5306
|
//#endregion
|
|
5270
5307
|
//#region src/plugins/@faker-js/faker/config.ts
|
|
5271
|
-
const defaultConfig$
|
|
5308
|
+
const defaultConfig$23 = {
|
|
5272
5309
|
api: new Api$4(),
|
|
5273
5310
|
config: {
|
|
5274
5311
|
case: "camelCase",
|
|
@@ -5292,7 +5329,7 @@ const defaultConfig$22 = {
|
|
|
5292
5329
|
/**
|
|
5293
5330
|
* Type helper for Faker plugin, returns {@link Plugin.Config} object
|
|
5294
5331
|
*/
|
|
5295
|
-
const defineConfig$
|
|
5332
|
+
const defineConfig$23 = definePluginConfig(defaultConfig$23);
|
|
5296
5333
|
|
|
5297
5334
|
//#endregion
|
|
5298
5335
|
//#region src/plugins/@hey-api/client-core/config.ts
|
|
@@ -5311,13 +5348,10 @@ const clientDefaultMeta = {
|
|
|
5311
5348
|
const __filename = fileURLToPath(import.meta.url);
|
|
5312
5349
|
const __dirname = path.dirname(__filename);
|
|
5313
5350
|
/**
|
|
5314
|
-
* Dev mode:
|
|
5351
|
+
* Dev mode: determined by OPENAPI_TS_DEV_MODE environment variable
|
|
5315
5352
|
*/
|
|
5316
5353
|
function isDevMode() {
|
|
5317
|
-
|
|
5318
|
-
const srcIndex = normalized.lastIndexOf("src");
|
|
5319
|
-
const distIndex = normalized.lastIndexOf("dist");
|
|
5320
|
-
return srcIndex !== -1 && srcIndex > distIndex && srcIndex === normalized.length - 2 && normalized[srcIndex + 1] === "generate";
|
|
5354
|
+
return process.env.OPENAPI_TS_DEV_MODE === "true" || process.env.OPENAPI_TS_DEV_MODE === "1";
|
|
5321
5355
|
}
|
|
5322
5356
|
/**
|
|
5323
5357
|
* Returns paths to client bundle files based on execution context
|
|
@@ -5337,16 +5371,6 @@ function getClientBundlePaths(pluginName) {
|
|
|
5337
5371
|
};
|
|
5338
5372
|
}
|
|
5339
5373
|
/**
|
|
5340
|
-
* Converts an {@link OutputHeader} value to a string prefix for file content.
|
|
5341
|
-
* Returns an empty string when the header is null, undefined, or a function
|
|
5342
|
-
* (functions require a render context which is not available for bundled files).
|
|
5343
|
-
*/
|
|
5344
|
-
function outputHeaderToPrefix(header) {
|
|
5345
|
-
if (header == null || typeof header === "function") return "";
|
|
5346
|
-
const content = (typeof header === "string" ? header.split(/\r?\n/) : header.flatMap((line) => line.split(/\r?\n/))).join("\n");
|
|
5347
|
-
return content ? `${content}\n\n` : "";
|
|
5348
|
-
}
|
|
5349
|
-
/**
|
|
5350
5374
|
* Returns absolute path to the client folder. This is hard-coded for now.
|
|
5351
5375
|
*/
|
|
5352
5376
|
function clientFolderAbsolutePath(config) {
|
|
@@ -5405,7 +5429,7 @@ function replaceImports({ filePath, header, isDevMode: isDevMode$1, meta, rename
|
|
|
5405
5429
|
function generateClientBundle({ header, meta, outputPath, plugin, project }) {
|
|
5406
5430
|
const renamed = /* @__PURE__ */ new Map();
|
|
5407
5431
|
const devMode = isDevMode();
|
|
5408
|
-
const headerPrefix = outputHeaderToPrefix(header);
|
|
5432
|
+
const headerPrefix = outputHeaderToPrefix(header, project);
|
|
5409
5433
|
if (plugin.name.startsWith("@hey-api/client-")) {
|
|
5410
5434
|
const { clientPath, corePath } = getClientBundlePaths(plugin.name);
|
|
5411
5435
|
const coreOutputPath = path.resolve(outputPath, "core");
|
|
@@ -5541,7 +5565,7 @@ const clientPluginHandler = ({ plugin }) => {
|
|
|
5541
5565
|
|
|
5542
5566
|
//#endregion
|
|
5543
5567
|
//#region src/plugins/@hey-api/client-angular/config.ts
|
|
5544
|
-
const defaultConfig$
|
|
5568
|
+
const defaultConfig$22 = {
|
|
5545
5569
|
...clientDefaultMeta,
|
|
5546
5570
|
config: {
|
|
5547
5571
|
...clientDefaultConfig,
|
|
@@ -5553,11 +5577,11 @@ const defaultConfig$21 = {
|
|
|
5553
5577
|
/**
|
|
5554
5578
|
* Type helper for `@hey-api/client-angular` plugin, returns {@link Plugin.Config} object
|
|
5555
5579
|
*/
|
|
5556
|
-
const defineConfig$
|
|
5580
|
+
const defineConfig$22 = definePluginConfig(defaultConfig$22);
|
|
5557
5581
|
|
|
5558
5582
|
//#endregion
|
|
5559
5583
|
//#region src/plugins/@hey-api/client-axios/config.ts
|
|
5560
|
-
const defaultConfig$
|
|
5584
|
+
const defaultConfig$21 = {
|
|
5561
5585
|
...clientDefaultMeta,
|
|
5562
5586
|
config: {
|
|
5563
5587
|
...clientDefaultConfig,
|
|
@@ -5569,11 +5593,11 @@ const defaultConfig$20 = {
|
|
|
5569
5593
|
/**
|
|
5570
5594
|
* Type helper for `@hey-api/client-axios` plugin, returns {@link Plugin.Config} object
|
|
5571
5595
|
*/
|
|
5572
|
-
const defineConfig$
|
|
5596
|
+
const defineConfig$21 = definePluginConfig(defaultConfig$21);
|
|
5573
5597
|
|
|
5574
5598
|
//#endregion
|
|
5575
5599
|
//#region src/plugins/@hey-api/client-fetch/config.ts
|
|
5576
|
-
const defaultConfig$
|
|
5600
|
+
const defaultConfig$20 = {
|
|
5577
5601
|
...clientDefaultMeta,
|
|
5578
5602
|
config: {
|
|
5579
5603
|
...clientDefaultConfig,
|
|
@@ -5585,11 +5609,11 @@ const defaultConfig$19 = {
|
|
|
5585
5609
|
/**
|
|
5586
5610
|
* Type helper for `@hey-api/client-fetch` plugin, returns {@link Plugin.Config} object
|
|
5587
5611
|
*/
|
|
5588
|
-
const defineConfig$
|
|
5612
|
+
const defineConfig$20 = definePluginConfig(defaultConfig$20);
|
|
5589
5613
|
|
|
5590
5614
|
//#endregion
|
|
5591
5615
|
//#region src/plugins/@hey-api/client-ky/config.ts
|
|
5592
|
-
const defaultConfig$
|
|
5616
|
+
const defaultConfig$19 = {
|
|
5593
5617
|
...clientDefaultMeta,
|
|
5594
5618
|
config: {
|
|
5595
5619
|
...clientDefaultConfig,
|
|
@@ -5601,11 +5625,11 @@ const defaultConfig$18 = {
|
|
|
5601
5625
|
/**
|
|
5602
5626
|
* Type helper for `@hey-api/client-ky` plugin, returns {@link Plugin.Config} object
|
|
5603
5627
|
*/
|
|
5604
|
-
const defineConfig$
|
|
5628
|
+
const defineConfig$19 = definePluginConfig(defaultConfig$19);
|
|
5605
5629
|
|
|
5606
5630
|
//#endregion
|
|
5607
5631
|
//#region src/plugins/@hey-api/client-next/config.ts
|
|
5608
|
-
const defaultConfig$
|
|
5632
|
+
const defaultConfig$18 = {
|
|
5609
5633
|
...clientDefaultMeta,
|
|
5610
5634
|
config: {
|
|
5611
5635
|
...clientDefaultConfig,
|
|
@@ -5617,11 +5641,11 @@ const defaultConfig$17 = {
|
|
|
5617
5641
|
/**
|
|
5618
5642
|
* Type helper for `@hey-api/client-next` plugin, returns {@link Plugin.Config} object
|
|
5619
5643
|
*/
|
|
5620
|
-
const defineConfig$
|
|
5644
|
+
const defineConfig$18 = definePluginConfig(defaultConfig$18);
|
|
5621
5645
|
|
|
5622
5646
|
//#endregion
|
|
5623
5647
|
//#region src/plugins/@hey-api/client-nuxt/config.ts
|
|
5624
|
-
const defaultConfig$
|
|
5648
|
+
const defaultConfig$17 = {
|
|
5625
5649
|
...clientDefaultMeta,
|
|
5626
5650
|
config: clientDefaultConfig,
|
|
5627
5651
|
handler: clientPluginHandler,
|
|
@@ -5630,11 +5654,11 @@ const defaultConfig$16 = {
|
|
|
5630
5654
|
/**
|
|
5631
5655
|
* Type helper for `@hey-api/client-nuxt` plugin, returns {@link Plugin.Config} object
|
|
5632
5656
|
*/
|
|
5633
|
-
const defineConfig$
|
|
5657
|
+
const defineConfig$17 = definePluginConfig(defaultConfig$17);
|
|
5634
5658
|
|
|
5635
5659
|
//#endregion
|
|
5636
5660
|
//#region src/plugins/@hey-api/client-ofetch/config.ts
|
|
5637
|
-
const defaultConfig$
|
|
5661
|
+
const defaultConfig$16 = {
|
|
5638
5662
|
...clientDefaultMeta,
|
|
5639
5663
|
config: {
|
|
5640
5664
|
...clientDefaultConfig,
|
|
@@ -5646,7 +5670,7 @@ const defaultConfig$15 = {
|
|
|
5646
5670
|
/**
|
|
5647
5671
|
* Type helper for `@hey-api/client-ofetch` plugin, returns {@link Plugin.Config} object
|
|
5648
5672
|
*/
|
|
5649
|
-
const defineConfig$
|
|
5673
|
+
const defineConfig$16 = definePluginConfig(defaultConfig$16);
|
|
5650
5674
|
|
|
5651
5675
|
//#endregion
|
|
5652
5676
|
//#region src/plugins/@hey-api/schemas/plugin.ts
|
|
@@ -5904,7 +5928,7 @@ const handler$10 = ({ plugin }) => {
|
|
|
5904
5928
|
|
|
5905
5929
|
//#endregion
|
|
5906
5930
|
//#region src/plugins/@hey-api/schemas/config.ts
|
|
5907
|
-
const defaultConfig$
|
|
5931
|
+
const defaultConfig$15 = {
|
|
5908
5932
|
config: {
|
|
5909
5933
|
includeInEntry: false,
|
|
5910
5934
|
nameBuilder: (name) => `${name}Schema`,
|
|
@@ -5916,7 +5940,7 @@ const defaultConfig$14 = {
|
|
|
5916
5940
|
/**
|
|
5917
5941
|
* Type helper for `@hey-api/schemas` plugin, returns {@link Plugin.Config} object
|
|
5918
5942
|
*/
|
|
5919
|
-
const defineConfig$
|
|
5943
|
+
const defineConfig$15 = definePluginConfig(defaultConfig$15);
|
|
5920
5944
|
|
|
5921
5945
|
//#endregion
|
|
5922
5946
|
//#region src/plugins/@hey-api/sdk/examples/config.ts
|
|
@@ -6212,7 +6236,7 @@ const handler$9 = (args) => handlerV1$2(args);
|
|
|
6212
6236
|
|
|
6213
6237
|
//#endregion
|
|
6214
6238
|
//#region src/plugins/@hey-api/sdk/config.ts
|
|
6215
|
-
const defaultConfig$
|
|
6239
|
+
const defaultConfig$14 = {
|
|
6216
6240
|
config: {
|
|
6217
6241
|
auth: true,
|
|
6218
6242
|
client: true,
|
|
@@ -6255,7 +6279,7 @@ const defaultConfig$13 = {
|
|
|
6255
6279
|
/**
|
|
6256
6280
|
* Type helper for `@hey-api/sdk` plugin, returns {@link Plugin.Config} object
|
|
6257
6281
|
*/
|
|
6258
|
-
const defineConfig$
|
|
6282
|
+
const defineConfig$14 = definePluginConfig(defaultConfig$14);
|
|
6259
6283
|
|
|
6260
6284
|
//#endregion
|
|
6261
6285
|
//#region src/plugins/@hey-api/transformers/expressions.ts
|
|
@@ -6439,7 +6463,7 @@ const handler$8 = ({ plugin }) => {
|
|
|
6439
6463
|
|
|
6440
6464
|
//#endregion
|
|
6441
6465
|
//#region src/plugins/@hey-api/transformers/config.ts
|
|
6442
|
-
const defaultConfig$
|
|
6466
|
+
const defaultConfig$13 = {
|
|
6443
6467
|
config: {
|
|
6444
6468
|
bigInt: true,
|
|
6445
6469
|
dates: true,
|
|
@@ -6460,7 +6484,7 @@ const defaultConfig$12 = {
|
|
|
6460
6484
|
/**
|
|
6461
6485
|
* Type helper for `@hey-api/transformers`, returns {@link Plugin.Config} object
|
|
6462
6486
|
*/
|
|
6463
|
-
const defineConfig$
|
|
6487
|
+
const defineConfig$13 = definePluginConfig(defaultConfig$13);
|
|
6464
6488
|
|
|
6465
6489
|
//#endregion
|
|
6466
6490
|
//#region src/plugins/@hey-api/typescript/shared/clientOptions.ts
|
|
@@ -6571,7 +6595,7 @@ const exportType = ({ plugin, schema, state, type }) => {
|
|
|
6571
6595
|
tags: fromRef(state.tags),
|
|
6572
6596
|
tool: "typescript"
|
|
6573
6597
|
} });
|
|
6574
|
-
const node$1 = $.type.alias(symbol$1).export().$if(plugin.config.comments && createSchemaComment(schema), (t, v) => t.doc(v)).type($.type(
|
|
6598
|
+
const node$1 = $.type.alias(symbol$1).export().$if(plugin.config.comments && createSchemaComment(schema), (t, v) => t.doc(v)).type($.type(symbolObject).idx($.type(symbolObject).typeofType().keyof()).typeofType());
|
|
6575
6599
|
plugin.node(node$1);
|
|
6576
6600
|
return;
|
|
6577
6601
|
} else if (plugin.config.enums.mode === "typescript" || plugin.config.enums.mode === "typescript-const") {
|
|
@@ -6905,9 +6929,10 @@ function objectToAst$4({ plugin, schema, state }) {
|
|
|
6905
6929
|
const addPropsObj = addPropsRaw !== false && addPropsRaw ? addPropsRaw : void 0;
|
|
6906
6930
|
if (hasPatterns || !!addPropsObj && (addPropsObj.type !== "never" || !indexSchemas.length)) {
|
|
6907
6931
|
const addProps = addPropsObj;
|
|
6908
|
-
if (addProps && addProps.type !== "never") indexSchemas.
|
|
6932
|
+
if (addProps && addProps.type !== "never") if (addProps.type === "unknown") indexSchemas = [addProps, ...schema.patternProperties ? Object.values(schema.patternProperties) : []];
|
|
6933
|
+
else indexSchemas.unshift(addProps);
|
|
6909
6934
|
else if (!hasPatterns && !indexSchemas.length && addProps && addProps.type === "never") indexSchemas = [addProps];
|
|
6910
|
-
if (hasOptionalProperties) indexSchemas.push({ type: "undefined" });
|
|
6935
|
+
if (hasOptionalProperties && addProps?.type !== "unknown") indexSchemas.push({ type: "undefined" });
|
|
6911
6936
|
const type = indexSchemas.length === 1 ? irSchemaToAst$1({
|
|
6912
6937
|
plugin,
|
|
6913
6938
|
schema: indexSchemas[0],
|
|
@@ -7234,7 +7259,7 @@ const handler$7 = (args) => handlerV1$1(args);
|
|
|
7234
7259
|
|
|
7235
7260
|
//#endregion
|
|
7236
7261
|
//#region src/plugins/@hey-api/typescript/config.ts
|
|
7237
|
-
const defaultConfig$
|
|
7262
|
+
const defaultConfig$12 = {
|
|
7238
7263
|
api: new Api$3(),
|
|
7239
7264
|
config: {
|
|
7240
7265
|
case: "PascalCase",
|
|
@@ -7321,7 +7346,7 @@ const defaultConfig$11 = {
|
|
|
7321
7346
|
/**
|
|
7322
7347
|
* Type helper for `@hey-api/typescript` plugin, returns {@link Plugin.Config} object
|
|
7323
7348
|
*/
|
|
7324
|
-
const defineConfig$
|
|
7349
|
+
const defineConfig$12 = definePluginConfig(defaultConfig$12);
|
|
7325
7350
|
|
|
7326
7351
|
//#endregion
|
|
7327
7352
|
//#region src/plugins/@pinia/colada/meta.ts
|
|
@@ -7539,7 +7564,13 @@ const createQueryOptions$1 = ({ operation, plugin }) => {
|
|
|
7539
7564
|
tool: plugin.name
|
|
7540
7565
|
} });
|
|
7541
7566
|
const symbolDefineQueryOptions = plugin.external(`${plugin.name}.defineQueryOptions`);
|
|
7542
|
-
const statement = $.const(symbolQueryOptionsFn).export().$if(plugin.config.comments && createOperationComment(operation), (c, v) => c.doc(v)).assign($(symbolDefineQueryOptions).call($.func().param(optionsParamName$2, (p) => p.required(isRequiredOptions).type(typeData)).do($.return(queryOpts)))
|
|
7567
|
+
const statement = $.const(symbolQueryOptionsFn).export().$if(plugin.config.comments && createOperationComment(operation), (c, v) => c.doc(v)).assign($(symbolDefineQueryOptions).call($.func().param(optionsParamName$2, (p) => p.required(isRequiredOptions).type(typeData)).do($.return(queryOpts))).generics(typeData, useTypeResponse$1({
|
|
7568
|
+
operation,
|
|
7569
|
+
plugin
|
|
7570
|
+
}), useTypeError$1({
|
|
7571
|
+
operation,
|
|
7572
|
+
plugin
|
|
7573
|
+
})));
|
|
7543
7574
|
plugin.node(statement);
|
|
7544
7575
|
};
|
|
7545
7576
|
|
|
@@ -7607,7 +7638,7 @@ const handler$6 = (args) => handlerV0(args);
|
|
|
7607
7638
|
|
|
7608
7639
|
//#endregion
|
|
7609
7640
|
//#region src/plugins/@pinia/colada/config.ts
|
|
7610
|
-
const defaultConfig$
|
|
7641
|
+
const defaultConfig$11 = {
|
|
7611
7642
|
config: {
|
|
7612
7643
|
case: "camelCase",
|
|
7613
7644
|
comments: true,
|
|
@@ -7650,7 +7681,7 @@ const defaultConfig$10 = {
|
|
|
7650
7681
|
/**
|
|
7651
7682
|
* Type helper for `@pinia/colada` plugin, returns {@link Plugin.Config} object
|
|
7652
7683
|
*/
|
|
7653
|
-
const defineConfig$
|
|
7684
|
+
const defineConfig$11 = definePluginConfig(defaultConfig$11);
|
|
7654
7685
|
|
|
7655
7686
|
//#endregion
|
|
7656
7687
|
//#region src/plugins/@tanstack/query-core/shared/useType.ts
|
|
@@ -7846,6 +7877,7 @@ const createInfiniteQueryOptions = ({ operation, plugin }) => {
|
|
|
7846
7877
|
//#endregion
|
|
7847
7878
|
//#region src/plugins/@tanstack/query-core/v5/mutationOptions.ts
|
|
7848
7879
|
const createMutationOptions = ({ operation, plugin }) => {
|
|
7880
|
+
if (hasOperationSse({ operation })) return;
|
|
7849
7881
|
const symbolMutationOptionsType = plugin.external(`${plugin.name}.MutationOptions`);
|
|
7850
7882
|
const typeData = useTypeData({
|
|
7851
7883
|
operation,
|
|
@@ -7875,7 +7907,7 @@ const createMutationOptions = ({ operation, plugin }) => {
|
|
|
7875
7907
|
role: "mutationOptions",
|
|
7876
7908
|
tool: plugin.name
|
|
7877
7909
|
} });
|
|
7878
|
-
const statement = $.const(symbolMutationOptions).export().$if(plugin.config.comments && createOperationComment(operation), (c, v) => c.doc(v)).assign($.func().param("options", (p) => p.optional().type($.type("Partial").generic(typeData))).returns(mutationType).do($.const(mutationOptionsFn).type(mutationType).assign($.object().pretty().prop("mutationFn", $.func().async().param(fnOptions$1).do(...statements)).$if(handleMeta(plugin, operation, "mutationOptions"), (c, v) => c.prop("meta", v))), $(mutationOptionsFn).return()));
|
|
7910
|
+
const statement = $.const(symbolMutationOptions).export(plugin.config.mutationOptions.exported).$if(plugin.config.comments && createOperationComment(operation), (c, v) => c.doc(v)).assign($.func().param("options", (p) => p.optional().type($.type("Partial").generic(typeData))).returns(mutationType).do($.const(mutationOptionsFn).type(mutationType).assign($.object().pretty().prop("mutationFn", $.func().async().param(fnOptions$1).do(...statements)).$if(handleMeta(plugin, operation, "mutationOptions"), (c, v) => c.prop("meta", v))), $(mutationOptionsFn).return()));
|
|
7879
7911
|
plugin.node(statement);
|
|
7880
7912
|
};
|
|
7881
7913
|
|
|
@@ -7935,6 +7967,38 @@ const createQueryOptions = ({ operation, plugin }) => {
|
|
|
7935
7967
|
plugin.node(statement);
|
|
7936
7968
|
};
|
|
7937
7969
|
|
|
7970
|
+
//#endregion
|
|
7971
|
+
//#region src/plugins/@tanstack/query-core/v5/useMutation.ts
|
|
7972
|
+
const mutationOptionsParamName = "mutationOptions";
|
|
7973
|
+
const createUseMutation = ({ operation, plugin }) => {
|
|
7974
|
+
if (!("useMutation" in plugin.config)) return;
|
|
7975
|
+
const symbolUseMutationFn = plugin.symbol(applyNaming(operation.id, plugin.config.useMutation));
|
|
7976
|
+
const symbolUseMutation = plugin.external(`${plugin.name}.useMutation`);
|
|
7977
|
+
const typeData = useTypeData({
|
|
7978
|
+
operation,
|
|
7979
|
+
plugin
|
|
7980
|
+
});
|
|
7981
|
+
const symbolMutationOptionsType = plugin.external(`${plugin.name}.MutationOptions`);
|
|
7982
|
+
const mutationType = $.type(symbolMutationOptionsType).generic(useTypeResponse({
|
|
7983
|
+
operation,
|
|
7984
|
+
plugin
|
|
7985
|
+
})).generic(useTypeError({
|
|
7986
|
+
operation,
|
|
7987
|
+
plugin
|
|
7988
|
+
})).generic(typeData);
|
|
7989
|
+
const symbolMutationOptionsFn = plugin.referenceSymbol({
|
|
7990
|
+
category: "hook",
|
|
7991
|
+
resource: "operation",
|
|
7992
|
+
resourceId: operation.id,
|
|
7993
|
+
role: "mutationOptions",
|
|
7994
|
+
tool: plugin.name
|
|
7995
|
+
});
|
|
7996
|
+
const func = $.func().param(mutationOptionsParamName, (p) => p.optional().type($.type("Partial").generic($.type("Omit", (t) => t.generics(mutationType, $.type.literal("mutationFn"))))));
|
|
7997
|
+
func.do($(symbolUseMutation).call($.object().spread($(symbolMutationOptionsFn).call()).spread(mutationOptionsParamName)).return());
|
|
7998
|
+
const statement = $.const(symbolUseMutationFn).export().$if(plugin.config.comments && createOperationComment(operation), (c, v) => c.doc(v)).assign(func);
|
|
7999
|
+
plugin.node(statement);
|
|
8000
|
+
};
|
|
8001
|
+
|
|
7938
8002
|
//#endregion
|
|
7939
8003
|
//#region src/plugins/@tanstack/query-core/v5/useQuery.ts
|
|
7940
8004
|
const optionsParamName = "options";
|
|
@@ -8004,6 +8068,13 @@ const handlerV5 = ({ plugin }) => {
|
|
|
8004
8068
|
resource: `${plugin.name}.queryOptions`
|
|
8005
8069
|
}
|
|
8006
8070
|
});
|
|
8071
|
+
plugin.symbol("useMutation", {
|
|
8072
|
+
external: plugin.name,
|
|
8073
|
+
meta: {
|
|
8074
|
+
category: "external",
|
|
8075
|
+
resource: `${plugin.name}.useMutation`
|
|
8076
|
+
}
|
|
8077
|
+
});
|
|
8007
8078
|
plugin.symbol("useQuery", {
|
|
8008
8079
|
external: plugin.name,
|
|
8009
8080
|
meta: {
|
|
@@ -8039,6 +8110,10 @@ const handlerV5 = ({ plugin }) => {
|
|
|
8039
8110
|
operation,
|
|
8040
8111
|
plugin
|
|
8041
8112
|
});
|
|
8113
|
+
if ("useMutation" in plugin.config && plugin.config.useMutation.enabled) createUseMutation({
|
|
8114
|
+
operation,
|
|
8115
|
+
plugin
|
|
8116
|
+
});
|
|
8042
8117
|
}
|
|
8043
8118
|
}, { order: "declarations" });
|
|
8044
8119
|
};
|
|
@@ -8049,7 +8124,7 @@ const handler$5 = (args) => handlerV5(args);
|
|
|
8049
8124
|
|
|
8050
8125
|
//#endregion
|
|
8051
8126
|
//#region src/plugins/@tanstack/angular-query-experimental/config.ts
|
|
8052
|
-
const defaultConfig$
|
|
8127
|
+
const defaultConfig$10 = {
|
|
8053
8128
|
config: {
|
|
8054
8129
|
case: "camelCase",
|
|
8055
8130
|
comments: true,
|
|
@@ -8082,6 +8157,7 @@ const defaultConfig$9 = {
|
|
|
8082
8157
|
defaultValue: {
|
|
8083
8158
|
case: plugin.config.case ?? "camelCase",
|
|
8084
8159
|
enabled: true,
|
|
8160
|
+
exported: true,
|
|
8085
8161
|
name: "{{name}}Mutation"
|
|
8086
8162
|
},
|
|
8087
8163
|
mappers,
|
|
@@ -8112,6 +8188,132 @@ const defaultConfig$9 = {
|
|
|
8112
8188
|
/**
|
|
8113
8189
|
* Type helper for `@tanstack/angular-query-experimental` plugin, returns {@link Plugin.Config} object
|
|
8114
8190
|
*/
|
|
8191
|
+
const defineConfig$10 = definePluginConfig(defaultConfig$10);
|
|
8192
|
+
|
|
8193
|
+
//#endregion
|
|
8194
|
+
//#region src/plugins/@tanstack/preact-query/config.ts
|
|
8195
|
+
const defaultConfig$9 = {
|
|
8196
|
+
config: {
|
|
8197
|
+
case: "camelCase",
|
|
8198
|
+
comments: true,
|
|
8199
|
+
includeInEntry: false
|
|
8200
|
+
},
|
|
8201
|
+
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
8202
|
+
handler: handler$5,
|
|
8203
|
+
name: "@tanstack/preact-query",
|
|
8204
|
+
resolveConfig: (plugin, context) => {
|
|
8205
|
+
plugin.config.infiniteQueryKeys = context.valueToObject({
|
|
8206
|
+
defaultValue: {
|
|
8207
|
+
case: plugin.config.case ?? "camelCase",
|
|
8208
|
+
enabled: true,
|
|
8209
|
+
name: "{{name}}InfiniteQueryKey",
|
|
8210
|
+
tags: false
|
|
8211
|
+
},
|
|
8212
|
+
mappers,
|
|
8213
|
+
value: plugin.config.infiniteQueryKeys
|
|
8214
|
+
});
|
|
8215
|
+
plugin.config.infiniteQueryOptions = context.valueToObject({
|
|
8216
|
+
defaultValue: {
|
|
8217
|
+
case: plugin.config.case ?? "camelCase",
|
|
8218
|
+
enabled: true,
|
|
8219
|
+
name: "{{name}}InfiniteOptions"
|
|
8220
|
+
},
|
|
8221
|
+
mappers,
|
|
8222
|
+
value: plugin.config.infiniteQueryOptions
|
|
8223
|
+
});
|
|
8224
|
+
plugin.config.mutationOptions = context.valueToObject({
|
|
8225
|
+
defaultValue: {
|
|
8226
|
+
case: plugin.config.case ?? "camelCase",
|
|
8227
|
+
enabled: true,
|
|
8228
|
+
exported: true,
|
|
8229
|
+
name: "{{name}}Mutation"
|
|
8230
|
+
},
|
|
8231
|
+
mappers,
|
|
8232
|
+
value: plugin.config.mutationOptions
|
|
8233
|
+
});
|
|
8234
|
+
plugin.config.queryKeys = context.valueToObject({
|
|
8235
|
+
defaultValue: {
|
|
8236
|
+
case: plugin.config.case ?? "camelCase",
|
|
8237
|
+
enabled: true,
|
|
8238
|
+
name: "{{name}}QueryKey",
|
|
8239
|
+
tags: false
|
|
8240
|
+
},
|
|
8241
|
+
mappers,
|
|
8242
|
+
value: plugin.config.queryKeys
|
|
8243
|
+
});
|
|
8244
|
+
plugin.config.queryOptions = context.valueToObject({
|
|
8245
|
+
defaultValue: {
|
|
8246
|
+
case: plugin.config.case ?? "camelCase",
|
|
8247
|
+
enabled: true,
|
|
8248
|
+
exported: true,
|
|
8249
|
+
name: "{{name}}Options"
|
|
8250
|
+
},
|
|
8251
|
+
mappers,
|
|
8252
|
+
value: plugin.config.queryOptions
|
|
8253
|
+
});
|
|
8254
|
+
plugin.config.useMutation = context.valueToObject({
|
|
8255
|
+
defaultValue: {
|
|
8256
|
+
case: plugin.config.case ?? "camelCase",
|
|
8257
|
+
enabled: false,
|
|
8258
|
+
name: "use{{name}}Mutation"
|
|
8259
|
+
},
|
|
8260
|
+
mappers: {
|
|
8261
|
+
boolean: (enabled) => ({ enabled }),
|
|
8262
|
+
function: (name) => ({
|
|
8263
|
+
enabled: true,
|
|
8264
|
+
name
|
|
8265
|
+
}),
|
|
8266
|
+
object: (fields) => ({
|
|
8267
|
+
enabled: true,
|
|
8268
|
+
...fields
|
|
8269
|
+
}),
|
|
8270
|
+
string: (name) => ({
|
|
8271
|
+
enabled: true,
|
|
8272
|
+
name
|
|
8273
|
+
})
|
|
8274
|
+
},
|
|
8275
|
+
value: plugin.config.useMutation
|
|
8276
|
+
});
|
|
8277
|
+
plugin.config.useQuery = context.valueToObject({
|
|
8278
|
+
defaultValue: {
|
|
8279
|
+
case: plugin.config.case ?? "camelCase",
|
|
8280
|
+
enabled: false,
|
|
8281
|
+
name: "use{{name}}Query"
|
|
8282
|
+
},
|
|
8283
|
+
mappers: {
|
|
8284
|
+
boolean: (enabled) => ({ enabled }),
|
|
8285
|
+
function: (name) => ({
|
|
8286
|
+
enabled: true,
|
|
8287
|
+
name
|
|
8288
|
+
}),
|
|
8289
|
+
object: (fields) => ({
|
|
8290
|
+
enabled: true,
|
|
8291
|
+
...fields
|
|
8292
|
+
}),
|
|
8293
|
+
string: (name) => ({
|
|
8294
|
+
enabled: true,
|
|
8295
|
+
name
|
|
8296
|
+
})
|
|
8297
|
+
},
|
|
8298
|
+
value: plugin.config.useQuery
|
|
8299
|
+
});
|
|
8300
|
+
if (plugin.config.useMutation.enabled) {
|
|
8301
|
+
if (!plugin.config.mutationOptions.enabled) {
|
|
8302
|
+
plugin.config.mutationOptions.enabled = true;
|
|
8303
|
+
plugin.config.mutationOptions.exported = false;
|
|
8304
|
+
}
|
|
8305
|
+
}
|
|
8306
|
+
if (plugin.config.useQuery.enabled) {
|
|
8307
|
+
if (!plugin.config.queryOptions.enabled) {
|
|
8308
|
+
plugin.config.queryOptions.enabled = true;
|
|
8309
|
+
plugin.config.queryOptions.exported = false;
|
|
8310
|
+
}
|
|
8311
|
+
}
|
|
8312
|
+
}
|
|
8313
|
+
};
|
|
8314
|
+
/**
|
|
8315
|
+
* Type helper for `@tanstack/preact-query` plugin, returns {@link Plugin.Config} object
|
|
8316
|
+
*/
|
|
8115
8317
|
const defineConfig$9 = definePluginConfig(defaultConfig$9);
|
|
8116
8318
|
|
|
8117
8319
|
//#endregion
|
|
@@ -8149,6 +8351,7 @@ const defaultConfig$8 = {
|
|
|
8149
8351
|
defaultValue: {
|
|
8150
8352
|
case: plugin.config.case ?? "camelCase",
|
|
8151
8353
|
enabled: true,
|
|
8354
|
+
exported: true,
|
|
8152
8355
|
name: "{{name}}Mutation"
|
|
8153
8356
|
},
|
|
8154
8357
|
mappers,
|
|
@@ -8174,6 +8377,29 @@ const defaultConfig$8 = {
|
|
|
8174
8377
|
mappers,
|
|
8175
8378
|
value: plugin.config.queryOptions
|
|
8176
8379
|
});
|
|
8380
|
+
plugin.config.useMutation = context.valueToObject({
|
|
8381
|
+
defaultValue: {
|
|
8382
|
+
case: plugin.config.case ?? "camelCase",
|
|
8383
|
+
enabled: false,
|
|
8384
|
+
name: "use{{name}}Mutation"
|
|
8385
|
+
},
|
|
8386
|
+
mappers: {
|
|
8387
|
+
boolean: (enabled) => ({ enabled }),
|
|
8388
|
+
function: (name) => ({
|
|
8389
|
+
enabled: true,
|
|
8390
|
+
name
|
|
8391
|
+
}),
|
|
8392
|
+
object: (fields) => ({
|
|
8393
|
+
enabled: true,
|
|
8394
|
+
...fields
|
|
8395
|
+
}),
|
|
8396
|
+
string: (name) => ({
|
|
8397
|
+
enabled: true,
|
|
8398
|
+
name
|
|
8399
|
+
})
|
|
8400
|
+
},
|
|
8401
|
+
value: plugin.config.useMutation
|
|
8402
|
+
});
|
|
8177
8403
|
plugin.config.useQuery = context.valueToObject({
|
|
8178
8404
|
defaultValue: {
|
|
8179
8405
|
case: plugin.config.case ?? "camelCase",
|
|
@@ -8197,6 +8423,12 @@ const defaultConfig$8 = {
|
|
|
8197
8423
|
},
|
|
8198
8424
|
value: plugin.config.useQuery
|
|
8199
8425
|
});
|
|
8426
|
+
if (plugin.config.useMutation.enabled) {
|
|
8427
|
+
if (!plugin.config.mutationOptions.enabled) {
|
|
8428
|
+
plugin.config.mutationOptions.enabled = true;
|
|
8429
|
+
plugin.config.mutationOptions.exported = false;
|
|
8430
|
+
}
|
|
8431
|
+
}
|
|
8200
8432
|
if (plugin.config.useQuery.enabled) {
|
|
8201
8433
|
if (!plugin.config.queryOptions.enabled) {
|
|
8202
8434
|
plugin.config.queryOptions.enabled = true;
|
|
@@ -8245,6 +8477,7 @@ const defaultConfig$7 = {
|
|
|
8245
8477
|
defaultValue: {
|
|
8246
8478
|
case: plugin.config.case ?? "camelCase",
|
|
8247
8479
|
enabled: true,
|
|
8480
|
+
exported: true,
|
|
8248
8481
|
name: "{{name}}Mutation"
|
|
8249
8482
|
},
|
|
8250
8483
|
mappers,
|
|
@@ -8312,6 +8545,7 @@ const defaultConfig$6 = {
|
|
|
8312
8545
|
defaultValue: {
|
|
8313
8546
|
case: plugin.config.case ?? "camelCase",
|
|
8314
8547
|
enabled: true,
|
|
8548
|
+
exported: true,
|
|
8315
8549
|
name: "{{name}}Mutation"
|
|
8316
8550
|
},
|
|
8317
8551
|
mappers,
|
|
@@ -8379,6 +8613,7 @@ const defaultConfig$5 = {
|
|
|
8379
8613
|
defaultValue: {
|
|
8380
8614
|
case: plugin.config.case ?? "camelCase",
|
|
8381
8615
|
enabled: true,
|
|
8616
|
+
exported: true,
|
|
8382
8617
|
name: "{{name}}Mutation"
|
|
8383
8618
|
},
|
|
8384
8619
|
mappers,
|
|
@@ -10117,7 +10352,8 @@ function patternNode$3(ctx$1) {
|
|
|
10117
10352
|
const { schema, symbols } = ctx$1;
|
|
10118
10353
|
const { v } = symbols;
|
|
10119
10354
|
if (!schema.pattern) return;
|
|
10120
|
-
|
|
10355
|
+
const flags = /\\[pP]\{/.test(schema.pattern) ? "u" : void 0;
|
|
10356
|
+
return $(v).attr(identifiers$1.actions.regex).call($.regexp(schema.pattern, flags));
|
|
10121
10357
|
}
|
|
10122
10358
|
function stringResolver$3(ctx$1) {
|
|
10123
10359
|
const constNode$8 = ctx$1.nodes.const(ctx$1);
|
|
@@ -10365,14 +10601,21 @@ function createVisitor$3(config) {
|
|
|
10365
10601
|
};
|
|
10366
10602
|
},
|
|
10367
10603
|
postProcess(result, schema, ctx$1) {
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10604
|
+
const metadata = ctx$1.plugin.config.metadata;
|
|
10605
|
+
if (!metadata) return result;
|
|
10606
|
+
const node = $.object();
|
|
10607
|
+
if (typeof metadata === "function") metadata({
|
|
10608
|
+
$,
|
|
10609
|
+
node,
|
|
10610
|
+
schema
|
|
10611
|
+
});
|
|
10612
|
+
else if (schema.description) node.prop("description", $.literal(schema.description));
|
|
10613
|
+
if (node.isEmpty) return result;
|
|
10614
|
+
const metadataExpr = $(ctx$1.plugin.external("valibot.v")).attr(identifiers$1.actions.metadata).call(node);
|
|
10615
|
+
return {
|
|
10616
|
+
meta: result.meta,
|
|
10617
|
+
pipes: [...result.pipes, metadataExpr]
|
|
10618
|
+
};
|
|
10376
10619
|
},
|
|
10377
10620
|
reference($ref, schema, ctx$1) {
|
|
10378
10621
|
const v = ctx$1.plugin.external("valibot.v");
|
|
@@ -10487,10 +10730,10 @@ function createVisitor$3(config) {
|
|
|
10487
10730
|
//#region src/plugins/valibot/v1/processor.ts
|
|
10488
10731
|
function createProcessor$3(plugin) {
|
|
10489
10732
|
const processor = createSchemaProcessor();
|
|
10490
|
-
const
|
|
10733
|
+
const extractorHooks = [plugin.config["~hooks"]?.schemas?.shouldExtract, plugin.context.config.parser.hooks.schemas?.shouldExtract];
|
|
10491
10734
|
function extractor(ctx$1) {
|
|
10492
10735
|
if (processor.hasEmitted(ctx$1.path)) return ctx$1.schema;
|
|
10493
|
-
for (const hook of
|
|
10736
|
+
for (const hook of extractorHooks) if (hook?.(ctx$1)) {
|
|
10494
10737
|
process$1({
|
|
10495
10738
|
namingAnchor: processor.context.anchor,
|
|
10496
10739
|
tags: processor.context.tags,
|
|
@@ -11342,11 +11585,11 @@ function numberToNode$2({ plugin, schema, state }) {
|
|
|
11342
11585
|
//#endregion
|
|
11343
11586
|
//#region src/plugins/zod/mini/toAst/object.ts
|
|
11344
11587
|
function additionalPropertiesNode$2(ctx$1) {
|
|
11345
|
-
const { schema, walk, walkerCtx } = ctx$1;
|
|
11588
|
+
const { applyModifiers, schema, walk, walkerCtx } = ctx$1;
|
|
11346
11589
|
if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length > 0) return;
|
|
11347
11590
|
const additionalResult = walk(schema.additionalProperties, childContext(walkerCtx, "additionalProperties"));
|
|
11348
11591
|
if (additionalResult.hasLazyExpression) ctx$1.utils.ast.hasLazyExpression = true;
|
|
11349
|
-
return additionalResult.expression
|
|
11592
|
+
return applyModifiers(additionalResult, {}).expression;
|
|
11350
11593
|
}
|
|
11351
11594
|
function baseNode$9(ctx$1) {
|
|
11352
11595
|
const { nodes, symbols } = ctx$1;
|
|
@@ -11451,7 +11694,8 @@ function patternNode$2(ctx$1) {
|
|
|
11451
11694
|
const { schema, symbols } = ctx$1;
|
|
11452
11695
|
const { z } = symbols;
|
|
11453
11696
|
if (!schema.pattern) return;
|
|
11454
|
-
|
|
11697
|
+
const flags = /\\[pP]\{/.test(schema.pattern) ? "u" : void 0;
|
|
11698
|
+
return $(z).attr(identifiers.regex).call($.regexp(schema.pattern, flags));
|
|
11455
11699
|
}
|
|
11456
11700
|
function stringResolver$2(ctx$1) {
|
|
11457
11701
|
const constNode$8 = ctx$1.nodes.const(ctx$1);
|
|
@@ -11704,14 +11948,21 @@ function createVisitor$2(config) {
|
|
|
11704
11948
|
};
|
|
11705
11949
|
},
|
|
11706
11950
|
postProcess(result, schema, ctx$1) {
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
11951
|
+
const metadata = ctx$1.plugin.config.metadata;
|
|
11952
|
+
if (!metadata) return result;
|
|
11953
|
+
const node = $.object();
|
|
11954
|
+
if (typeof metadata === "function") metadata({
|
|
11955
|
+
$,
|
|
11956
|
+
node,
|
|
11957
|
+
schema
|
|
11958
|
+
});
|
|
11959
|
+
else if (schema.description) node.pretty().prop("description", $.literal(schema.description));
|
|
11960
|
+
if (node.isEmpty) return result;
|
|
11961
|
+
const z = ctx$1.plugin.external("zod.z");
|
|
11962
|
+
return {
|
|
11963
|
+
...result,
|
|
11964
|
+
expression: { expression: result.expression.expression.attr(identifiers.register).call($(z).attr(identifiers.globalRegistry), node) }
|
|
11965
|
+
};
|
|
11715
11966
|
},
|
|
11716
11967
|
reference($ref, schema, ctx$1) {
|
|
11717
11968
|
const z = ctx$1.plugin.external("zod.z");
|
|
@@ -12203,11 +12454,11 @@ function numberToNode$1({ plugin, schema, state }) {
|
|
|
12203
12454
|
//#endregion
|
|
12204
12455
|
//#region src/plugins/zod/v3/toAst/object.ts
|
|
12205
12456
|
function additionalPropertiesNode$1(ctx$1) {
|
|
12206
|
-
const { schema, walk, walkerCtx } = ctx$1;
|
|
12457
|
+
const { applyModifiers, schema, walk, walkerCtx } = ctx$1;
|
|
12207
12458
|
if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length > 0) return;
|
|
12208
12459
|
const additionalResult = walk(schema.additionalProperties, childContext(walkerCtx, "additionalProperties"));
|
|
12209
12460
|
if (additionalResult.hasLazyExpression) ctx$1.utils.ast.hasLazyExpression = true;
|
|
12210
|
-
return additionalResult.expression
|
|
12461
|
+
return applyModifiers(additionalResult, {}).expression;
|
|
12211
12462
|
}
|
|
12212
12463
|
function baseNode$5(ctx$1) {
|
|
12213
12464
|
const { nodes, symbols } = ctx$1;
|
|
@@ -12308,7 +12559,8 @@ function minLengthNode$1(ctx$1) {
|
|
|
12308
12559
|
function patternNode$1(ctx$1) {
|
|
12309
12560
|
const { chain, schema } = ctx$1;
|
|
12310
12561
|
if (!schema.pattern) return;
|
|
12311
|
-
|
|
12562
|
+
const flags = /\\[pP]\{/.test(schema.pattern) ? "u" : void 0;
|
|
12563
|
+
return chain.current.attr(identifiers.regex).call($.regexp(schema.pattern, flags));
|
|
12312
12564
|
}
|
|
12313
12565
|
function stringResolver$1(ctx$1) {
|
|
12314
12566
|
const constNode$8 = ctx$1.nodes.const(ctx$1);
|
|
@@ -13067,11 +13319,11 @@ function numberToNode({ plugin, schema, state }) {
|
|
|
13067
13319
|
//#endregion
|
|
13068
13320
|
//#region src/plugins/zod/v4/toAst/object.ts
|
|
13069
13321
|
function additionalPropertiesNode(ctx$1) {
|
|
13070
|
-
const { schema, walk, walkerCtx } = ctx$1;
|
|
13322
|
+
const { applyModifiers, schema, walk, walkerCtx } = ctx$1;
|
|
13071
13323
|
if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length > 0) return;
|
|
13072
13324
|
const additionalResult = walk(schema.additionalProperties, childContext(walkerCtx, "additionalProperties"));
|
|
13073
13325
|
if (additionalResult.hasLazyExpression) ctx$1.utils.ast.hasLazyExpression = true;
|
|
13074
|
-
return additionalResult.expression
|
|
13326
|
+
return applyModifiers(additionalResult, {}).expression;
|
|
13075
13327
|
}
|
|
13076
13328
|
function baseNode$1(ctx$1) {
|
|
13077
13329
|
const { nodes, symbols } = ctx$1;
|
|
@@ -13172,7 +13424,8 @@ function minLengthNode(ctx$1) {
|
|
|
13172
13424
|
function patternNode(ctx$1) {
|
|
13173
13425
|
const { chain, schema } = ctx$1;
|
|
13174
13426
|
if (!schema.pattern) return;
|
|
13175
|
-
|
|
13427
|
+
const flags = /\\[pP]\{/.test(schema.pattern) ? "u" : void 0;
|
|
13428
|
+
return chain.current.attr(identifiers.regex).call($.regexp(schema.pattern, flags));
|
|
13176
13429
|
}
|
|
13177
13430
|
function stringResolver(ctx$1) {
|
|
13178
13431
|
const constNode$8 = ctx$1.nodes.const(ctx$1);
|
|
@@ -13425,14 +13678,21 @@ function createVisitor(config) {
|
|
|
13425
13678
|
};
|
|
13426
13679
|
},
|
|
13427
13680
|
postProcess(result, schema, ctx$1) {
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13681
|
+
const metadata = ctx$1.plugin.config.metadata;
|
|
13682
|
+
if (!metadata) return result;
|
|
13683
|
+
const node = $.object();
|
|
13684
|
+
if (typeof metadata === "function") metadata({
|
|
13685
|
+
$,
|
|
13686
|
+
node,
|
|
13687
|
+
schema
|
|
13688
|
+
});
|
|
13689
|
+
else if (schema.description) node.pretty().prop("description", $.literal(schema.description));
|
|
13690
|
+
if (node.isEmpty) return result;
|
|
13691
|
+
const z = ctx$1.plugin.external("zod.z");
|
|
13692
|
+
return {
|
|
13693
|
+
...result,
|
|
13694
|
+
expression: { expression: result.expression.expression.attr(identifiers.register).call($(z).attr(identifiers.globalRegistry), node) }
|
|
13695
|
+
};
|
|
13436
13696
|
},
|
|
13437
13697
|
reference($ref, schema, ctx$1) {
|
|
13438
13698
|
const z = ctx$1.plugin.external("zod.z");
|
|
@@ -13913,21 +14173,22 @@ const defineConfig = definePluginConfig(defaultConfig);
|
|
|
13913
14173
|
//#endregion
|
|
13914
14174
|
//#region src/plugins/config.ts
|
|
13915
14175
|
const defaultPluginConfigs = {
|
|
13916
|
-
"@angular/common": defaultConfig$
|
|
13917
|
-
"@faker-js/faker": defaultConfig$
|
|
13918
|
-
"@hey-api/client-angular": defaultConfig$
|
|
13919
|
-
"@hey-api/client-axios": defaultConfig$
|
|
13920
|
-
"@hey-api/client-fetch": defaultConfig$
|
|
13921
|
-
"@hey-api/client-ky": defaultConfig$
|
|
13922
|
-
"@hey-api/client-next": defaultConfig$
|
|
13923
|
-
"@hey-api/client-nuxt": defaultConfig$
|
|
13924
|
-
"@hey-api/client-ofetch": defaultConfig$
|
|
13925
|
-
"@hey-api/schemas": defaultConfig$
|
|
13926
|
-
"@hey-api/sdk": defaultConfig$
|
|
13927
|
-
"@hey-api/transformers": defaultConfig$
|
|
13928
|
-
"@hey-api/typescript": defaultConfig$
|
|
13929
|
-
"@pinia/colada": defaultConfig$
|
|
13930
|
-
"@tanstack/angular-query-experimental": defaultConfig$
|
|
14176
|
+
"@angular/common": defaultConfig$24,
|
|
14177
|
+
"@faker-js/faker": defaultConfig$23,
|
|
14178
|
+
"@hey-api/client-angular": defaultConfig$22,
|
|
14179
|
+
"@hey-api/client-axios": defaultConfig$21,
|
|
14180
|
+
"@hey-api/client-fetch": defaultConfig$20,
|
|
14181
|
+
"@hey-api/client-ky": defaultConfig$19,
|
|
14182
|
+
"@hey-api/client-next": defaultConfig$18,
|
|
14183
|
+
"@hey-api/client-nuxt": defaultConfig$17,
|
|
14184
|
+
"@hey-api/client-ofetch": defaultConfig$16,
|
|
14185
|
+
"@hey-api/schemas": defaultConfig$15,
|
|
14186
|
+
"@hey-api/sdk": defaultConfig$14,
|
|
14187
|
+
"@hey-api/transformers": defaultConfig$13,
|
|
14188
|
+
"@hey-api/typescript": defaultConfig$12,
|
|
14189
|
+
"@pinia/colada": defaultConfig$11,
|
|
14190
|
+
"@tanstack/angular-query-experimental": defaultConfig$10,
|
|
14191
|
+
"@tanstack/preact-query": defaultConfig$9,
|
|
13931
14192
|
"@tanstack/react-query": defaultConfig$8,
|
|
13932
14193
|
"@tanstack/solid-query": defaultConfig$7,
|
|
13933
14194
|
"@tanstack/svelte-query": defaultConfig$6,
|
|
@@ -13971,12 +14232,12 @@ function getPluginsConfig({ dependencies, userPlugins, userPluginsConfig }) {
|
|
|
13971
14232
|
pluginByTag: (tag, props = {}) => {
|
|
13972
14233
|
const { defaultPlugin: defaultPlugin$1, errorMessage } = props;
|
|
13973
14234
|
for (const userPlugin$1 of userPlugins) {
|
|
13974
|
-
const defaultConfig$
|
|
13975
|
-
if (defaultConfig$
|
|
14235
|
+
const defaultConfig$25 = defaultPluginConfigs[userPlugin$1] || userPluginsConfig[userPlugin$1];
|
|
14236
|
+
if (defaultConfig$25 && defaultConfig$25.tags?.includes(tag) && userPlugin$1 !== name) return userPlugin$1;
|
|
13976
14237
|
}
|
|
13977
14238
|
if (defaultPlugin$1) {
|
|
13978
|
-
const defaultConfig$
|
|
13979
|
-
if (defaultConfig$
|
|
14239
|
+
const defaultConfig$25 = defaultPluginConfigs[defaultPlugin$1] || userPluginsConfig[defaultPlugin$1];
|
|
14240
|
+
if (defaultConfig$25 && defaultConfig$25.tags?.includes(tag) && defaultPlugin$1 !== name) return defaultPlugin$1;
|
|
13980
14241
|
}
|
|
13981
14242
|
throw new Error(errorMessage || `missing plugin - no plugin with tag "${tag}" found`);
|
|
13982
14243
|
},
|
|
@@ -14118,4 +14379,4 @@ async function resolveJobs({ logger, userConfigs }) {
|
|
|
14118
14379
|
|
|
14119
14380
|
//#endregion
|
|
14120
14381
|
export { postProcessors as _, clientDefaultConfig as a, TypeScriptRenderer as c, reserved as d, keywords as f, getTypedConfig as g, getClientPlugin as h, generateClientBundle as i, TsDslContext as l, TsDsl as m, defaultPlugins as n, clientDefaultMeta as o, regexp as p, clientPluginHandler as r, $ as s, resolveJobs as t, ctx as u };
|
|
14121
|
-
//# sourceMappingURL=init-
|
|
14382
|
+
//# sourceMappingURL=init-PHWYaLgi.mjs.map
|