@hey-api/openapi-ts 0.94.2 → 0.94.4
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/nuxt/utils.ts +6 -1
- package/dist/index.d.mts +515 -323
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{init-C6327prb.mjs → init-B4xCXgH4.mjs} +472 -163
- package/dist/init-B4xCXgH4.mjs.map +1 -0
- package/dist/internal.d.mts +1 -1
- package/dist/internal.mjs +1 -1
- package/dist/run.mjs +3 -3
- package/dist/{src-CdNoenvJ.mjs → src-B7Bwskcz.mjs} +5 -6
- package/dist/src-B7Bwskcz.mjs.map +1 -0
- package/dist/{types-CR-cSsLu.d.mts → types-DAEl4_a4.d.mts} +5 -12
- package/dist/types-DAEl4_a4.d.mts.map +1 -0
- package/package.json +5 -5
- package/dist/init-C6327prb.mjs.map +0 -1
- package/dist/src-CdNoenvJ.mjs.map +0 -1
- package/dist/types-CR-cSsLu.d.mts.map +0 -1
|
@@ -149,6 +149,7 @@ function getOutput(userConfig) {
|
|
|
149
149
|
},
|
|
150
150
|
format: null,
|
|
151
151
|
lint: null,
|
|
152
|
+
module: {},
|
|
152
153
|
path: "",
|
|
153
154
|
postProcess: [],
|
|
154
155
|
preferExportAll: false
|
|
@@ -162,13 +163,25 @@ function getOutput(userConfig) {
|
|
|
162
163
|
string: (name) => ({ name })
|
|
163
164
|
},
|
|
164
165
|
value: fields.fileName
|
|
166
|
+
}),
|
|
167
|
+
module: valueToObject({
|
|
168
|
+
defaultValue: {
|
|
169
|
+
extension: fields.importFileExtension,
|
|
170
|
+
resolve: fields.resolveModuleName
|
|
171
|
+
},
|
|
172
|
+
mappers: { object: (moduleFields) => ({
|
|
173
|
+
...moduleFields,
|
|
174
|
+
extension: fields.importFileExtension ?? moduleFields.extension,
|
|
175
|
+
resolve: fields.resolveModuleName ?? moduleFields.resolve
|
|
176
|
+
}) },
|
|
177
|
+
value: fields.module
|
|
165
178
|
})
|
|
166
179
|
}) },
|
|
167
180
|
value: userOutput
|
|
168
181
|
});
|
|
169
182
|
output.tsConfig = loadTsConfig(findTsConfigPath(__dirname$1, output.tsConfigPath));
|
|
170
|
-
if (output.
|
|
171
|
-
if (output.
|
|
183
|
+
if (output.module.extension === void 0 && (output.tsConfig?.compilerOptions?.moduleResolution === "nodenext" || output.tsConfig?.compilerOptions?.moduleResolution === "NodeNext" || output.tsConfig?.compilerOptions?.moduleResolution === "node16" || output.tsConfig?.compilerOptions?.moduleResolution === "Node16" || output.tsConfig?.compilerOptions?.module === "nodenext" || output.tsConfig?.compilerOptions?.module === "NodeNext" || output.tsConfig?.compilerOptions?.module === "node16" || output.tsConfig?.compilerOptions?.module === "Node16")) output.module.extension = ".js";
|
|
184
|
+
if (output.module.extension && !output.module.extension.startsWith(".")) output.module.extension = `.${output.module.extension}`;
|
|
172
185
|
output.postProcess = normalizePostProcess(userOutput.postProcess ?? legacyPostProcess);
|
|
173
186
|
output.source = resolveSource(output);
|
|
174
187
|
return output;
|
|
@@ -287,7 +300,7 @@ function resolveHttpRequests(config, context) {
|
|
|
287
300
|
|
|
288
301
|
//#endregion
|
|
289
302
|
//#region src/plugins/@angular/common/httpRequests/resolve.ts
|
|
290
|
-
function resolvePath$
|
|
303
|
+
function resolvePath$3(plugin) {
|
|
291
304
|
if (plugin.config.httpRequests.nesting === "id") return OperationPath.id();
|
|
292
305
|
if (plugin.config.httpRequests.nesting === "operationId") return OperationPath.fromOperationId({
|
|
293
306
|
delimiters: plugin.config.httpRequests.nestingDelimiters,
|
|
@@ -296,17 +309,17 @@ function resolvePath$2(plugin) {
|
|
|
296
309
|
return plugin.config.httpRequests.nesting;
|
|
297
310
|
}
|
|
298
311
|
function resolveHttpRequestsStrategy(plugin) {
|
|
299
|
-
if (plugin.config.httpRequests.strategy === "flat") return OperationStrategy.flat({ path: (operation) => [resolvePath$
|
|
312
|
+
if (plugin.config.httpRequests.strategy === "flat") return OperationStrategy.flat({ path: (operation) => [resolvePath$3(plugin)(operation).join(".")] });
|
|
300
313
|
if (plugin.config.httpRequests.strategy === "single") {
|
|
301
314
|
const root = plugin.config.httpRequests.containerName;
|
|
302
315
|
return OperationStrategy.single({
|
|
303
|
-
path: resolvePath$
|
|
316
|
+
path: resolvePath$3(plugin),
|
|
304
317
|
root: typeof root.name === "string" ? root.name : root.name?.("") ?? ""
|
|
305
318
|
});
|
|
306
319
|
}
|
|
307
320
|
if (plugin.config.httpRequests.strategy === "byTags") return OperationStrategy.byTags({
|
|
308
321
|
fallback: plugin.config.httpRequests.strategyDefaultTag,
|
|
309
|
-
path: resolvePath$
|
|
322
|
+
path: resolvePath$3(plugin)
|
|
310
323
|
});
|
|
311
324
|
return plugin.config.httpRequests.strategy;
|
|
312
325
|
}
|
|
@@ -370,7 +383,7 @@ function resolveHttpResources(config, context) {
|
|
|
370
383
|
|
|
371
384
|
//#endregion
|
|
372
385
|
//#region src/plugins/@angular/common/httpResources/resolve.ts
|
|
373
|
-
function resolvePath$
|
|
386
|
+
function resolvePath$2(plugin) {
|
|
374
387
|
if (plugin.config.httpResources.nesting === "id") return OperationPath.id();
|
|
375
388
|
if (plugin.config.httpResources.nesting === "operationId") return OperationPath.fromOperationId({
|
|
376
389
|
delimiters: plugin.config.httpResources.nestingDelimiters,
|
|
@@ -379,17 +392,17 @@ function resolvePath$1(plugin) {
|
|
|
379
392
|
return plugin.config.httpResources.nesting;
|
|
380
393
|
}
|
|
381
394
|
function resolveHttpResourcesStrategy(plugin) {
|
|
382
|
-
if (plugin.config.httpResources.strategy === "flat") return OperationStrategy.flat({ path: (operation) => [resolvePath$
|
|
395
|
+
if (plugin.config.httpResources.strategy === "flat") return OperationStrategy.flat({ path: (operation) => [resolvePath$2(plugin)(operation).join(".")] });
|
|
383
396
|
if (plugin.config.httpResources.strategy === "single") {
|
|
384
397
|
const root = plugin.config.httpResources.containerName;
|
|
385
398
|
return OperationStrategy.single({
|
|
386
|
-
path: resolvePath$
|
|
399
|
+
path: resolvePath$2(plugin),
|
|
387
400
|
root: typeof root.name === "string" ? root.name : root.name?.("") ?? ""
|
|
388
401
|
});
|
|
389
402
|
}
|
|
390
403
|
if (plugin.config.httpResources.strategy === "byTags") return OperationStrategy.byTags({
|
|
391
404
|
fallback: plugin.config.httpResources.strategyDefaultTag,
|
|
392
|
-
path: resolvePath$
|
|
405
|
+
path: resolvePath$2(plugin)
|
|
393
406
|
});
|
|
394
407
|
return plugin.config.httpResources.strategy;
|
|
395
408
|
}
|
|
@@ -3932,7 +3945,7 @@ var TypeQueryTsDsl = class extends Mixed$1 {
|
|
|
3932
3945
|
_expr;
|
|
3933
3946
|
constructor(expr) {
|
|
3934
3947
|
super();
|
|
3935
|
-
this._expr = expr;
|
|
3948
|
+
this._expr = ref(expr);
|
|
3936
3949
|
}
|
|
3937
3950
|
analyze(ctx) {
|
|
3938
3951
|
super.analyze(ctx);
|
|
@@ -4088,28 +4101,21 @@ var TypeScriptRenderer = class TypeScriptRenderer {
|
|
|
4088
4101
|
*/
|
|
4089
4102
|
_header;
|
|
4090
4103
|
/**
|
|
4091
|
-
*
|
|
4104
|
+
* Options for module specifier resolution.
|
|
4092
4105
|
*
|
|
4093
4106
|
* @private
|
|
4094
4107
|
*/
|
|
4095
|
-
|
|
4108
|
+
_module;
|
|
4096
4109
|
/**
|
|
4097
|
-
*
|
|
4098
|
-
*
|
|
4099
|
-
* @private
|
|
4100
|
-
*/
|
|
4101
|
-
_preferFileExtension;
|
|
4102
|
-
/**
|
|
4103
|
-
* Optional function to transform module specifiers.
|
|
4110
|
+
* Whether `export * from 'module'` should be used when possible instead of named exports.
|
|
4104
4111
|
*
|
|
4105
4112
|
* @private
|
|
4106
4113
|
*/
|
|
4107
|
-
|
|
4114
|
+
_preferExportAll;
|
|
4108
4115
|
constructor(args = {}) {
|
|
4109
4116
|
this._header = args.header;
|
|
4117
|
+
this._module = args.module;
|
|
4110
4118
|
this._preferExportAll = args.preferExportAll ?? false;
|
|
4111
|
-
this._preferFileExtension = args.preferFileExtension ?? "";
|
|
4112
|
-
this._resolveModuleName = args.resolveModuleName;
|
|
4113
4119
|
}
|
|
4114
4120
|
render(ctx) {
|
|
4115
4121
|
const header = typeof this._header === "function" ? this._header(ctx) : this._header;
|
|
@@ -4168,10 +4174,10 @@ var TypeScriptRenderer = class TypeScriptRenderer {
|
|
|
4168
4174
|
const sortKey = moduleSortKey({
|
|
4169
4175
|
file: ctx.file,
|
|
4170
4176
|
fromFile: exp.from,
|
|
4171
|
-
preferFileExtension: this.
|
|
4177
|
+
preferFileExtension: this._module?.extension || "",
|
|
4172
4178
|
root: ctx.project.root
|
|
4173
4179
|
});
|
|
4174
|
-
const modulePath = this.
|
|
4180
|
+
const modulePath = this._module?.resolve?.(sortKey[2], ctx) ?? sortKey[2];
|
|
4175
4181
|
const [groupIndex] = sortKey;
|
|
4176
4182
|
if (!groups.has(groupIndex)) groups.set(groupIndex, /* @__PURE__ */ new Map());
|
|
4177
4183
|
const moduleMap = groups.get(groupIndex);
|
|
@@ -4212,10 +4218,10 @@ var TypeScriptRenderer = class TypeScriptRenderer {
|
|
|
4212
4218
|
const sortKey = moduleSortKey({
|
|
4213
4219
|
file: ctx.file,
|
|
4214
4220
|
fromFile: imp.from,
|
|
4215
|
-
preferFileExtension: this.
|
|
4221
|
+
preferFileExtension: this._module?.extension || "",
|
|
4216
4222
|
root: ctx.project.root
|
|
4217
4223
|
});
|
|
4218
|
-
const modulePath = this.
|
|
4224
|
+
const modulePath = this._module?.resolve?.(sortKey[2], ctx) ?? sortKey[2];
|
|
4219
4225
|
const [groupIndex] = sortKey;
|
|
4220
4226
|
if (!groups.has(groupIndex)) groups.set(groupIndex, /* @__PURE__ */ new Map());
|
|
4221
4227
|
const moduleMap = groups.get(groupIndex);
|
|
@@ -4747,7 +4753,7 @@ function operationStatements({ isRequiredOptions, opParameters, operation, plugi
|
|
|
4747
4753
|
|
|
4748
4754
|
//#endregion
|
|
4749
4755
|
//#region src/plugins/@hey-api/sdk/v1/node.ts
|
|
4750
|
-
const source$
|
|
4756
|
+
const source$2 = globalThis.Symbol("@hey-api/sdk");
|
|
4751
4757
|
function isInstance(plugin) {
|
|
4752
4758
|
const config = plugin.config.operations;
|
|
4753
4759
|
return config.container === "class" && config.methods === "instance" && config.strategy !== "flat";
|
|
@@ -4756,7 +4762,7 @@ function attachComment$1(args) {
|
|
|
4756
4762
|
const { node, operation, plugin } = args;
|
|
4757
4763
|
return node.$if(plugin.config.comments && createOperationComment(operation), (n, v) => n.doc(v));
|
|
4758
4764
|
}
|
|
4759
|
-
function createShellMeta(node) {
|
|
4765
|
+
function createShellMeta$1(node) {
|
|
4760
4766
|
return {
|
|
4761
4767
|
category: "utility",
|
|
4762
4768
|
resource: "class",
|
|
@@ -4777,7 +4783,7 @@ function createFnSymbol(plugin, item) {
|
|
|
4777
4783
|
} });
|
|
4778
4784
|
}
|
|
4779
4785
|
function childToNode(resource, plugin) {
|
|
4780
|
-
const refChild = plugin.referenceSymbol(createShellMeta(resource));
|
|
4786
|
+
const refChild = plugin.referenceSymbol(createShellMeta$1(resource));
|
|
4781
4787
|
const memberNameStr = toCase(refChild.name, plugin.config.operations.methodName.casing ?? "camelCase");
|
|
4782
4788
|
const memberName = plugin.symbol(memberNameStr);
|
|
4783
4789
|
if (isInstance(plugin)) {
|
|
@@ -4787,10 +4793,10 @@ function childToNode(resource, plugin) {
|
|
|
4787
4793
|
if (plugin.isSymbolRegistered(refChild.id)) return [$.field(memberName, (f) => f.static().assign($(refChild)))];
|
|
4788
4794
|
return [$.getter(memberName, (g) => g.public().static().do($.return(refChild)))];
|
|
4789
4795
|
}
|
|
4790
|
-
function createShell(plugin) {
|
|
4796
|
+
function createShell$1(plugin) {
|
|
4791
4797
|
const isAngularClient = getClientPlugin(getTypedConfig(plugin)).name === "@hey-api/client-angular";
|
|
4792
4798
|
return { define: (node) => {
|
|
4793
|
-
const symbol = plugin.symbol(applyNaming(node.name, node.isRoot ? plugin.config.operations.containerName : plugin.config.operations.segmentName), { meta: createShellMeta(node) });
|
|
4799
|
+
const symbol = plugin.symbol(applyNaming(node.name, node.isRoot ? plugin.config.operations.containerName : plugin.config.operations.segmentName), { meta: createShellMeta$1(node) });
|
|
4794
4800
|
const c = $.class(symbol).export().$if(isInstance(plugin), (c) => c.extends(plugin.referenceSymbol({
|
|
4795
4801
|
category: "utility",
|
|
4796
4802
|
resource: "class",
|
|
@@ -4883,10 +4889,10 @@ function implementFn(args) {
|
|
|
4883
4889
|
role: "response"
|
|
4884
4890
|
}), (t, s) => t.extends(s).default(s), (t) => t.default("undefined"))), (m) => m.generic("ThrowOnError", (t) => t.extends("boolean").default(("throwOnError" in client.config ? client.config.throwOnError : false) ?? false))).params(...opParameters.parameters).do(...statements);
|
|
4885
4891
|
}
|
|
4886
|
-
function toNode$
|
|
4892
|
+
function toNode$2(model, plugin) {
|
|
4887
4893
|
if (model.virtual) {
|
|
4888
4894
|
const nodes = [];
|
|
4889
|
-
for (const item of model.itemsFrom(source$
|
|
4895
|
+
for (const item of model.itemsFrom(source$2)) {
|
|
4890
4896
|
const { operation } = item.data;
|
|
4891
4897
|
let node = $.const(createFnSymbol(plugin, item)).export().assign(implementFn({
|
|
4892
4898
|
node: $.func(),
|
|
@@ -4909,7 +4915,7 @@ function toNode$1(model, plugin) {
|
|
|
4909
4915
|
const shell = model.shell.define(model);
|
|
4910
4916
|
const node = shell.node;
|
|
4911
4917
|
let index = 0;
|
|
4912
|
-
for (const item of model.itemsFrom(source$
|
|
4918
|
+
for (const item of model.itemsFrom(source$2)) {
|
|
4913
4919
|
const { operation } = item.data;
|
|
4914
4920
|
if (node["~dsl"] === "VarTsDsl") {} else {
|
|
4915
4921
|
if (index > 0 || node.hasBody) node.newline();
|
|
@@ -4975,7 +4981,7 @@ function hasOperationSse({ operation }) {
|
|
|
4975
4981
|
|
|
4976
4982
|
//#endregion
|
|
4977
4983
|
//#region src/plugins/@angular/common/shared/node.ts
|
|
4978
|
-
const source = globalThis.Symbol("@angular/common");
|
|
4984
|
+
const source$1 = globalThis.Symbol("@angular/common");
|
|
4979
4985
|
function attachComment(args) {
|
|
4980
4986
|
const { node, operation, plugin } = args;
|
|
4981
4987
|
return node.$if(plugin.config.comments && createOperationComment(operation), (n, v) => n.doc(v));
|
|
@@ -5121,7 +5127,7 @@ function implementHttpResourceFn(args) {
|
|
|
5121
5127
|
function toHttpRequestNode(model, plugin) {
|
|
5122
5128
|
if (model.virtual) {
|
|
5123
5129
|
const nodes = [];
|
|
5124
|
-
for (const item of model.itemsFrom(source)) {
|
|
5130
|
+
for (const item of model.itemsFrom(source$1)) {
|
|
5125
5131
|
const { operation } = item.data;
|
|
5126
5132
|
let node = $.const(createHttpRequestFnSymbol(plugin, item)).export().assign(implementHttpRequestFn({
|
|
5127
5133
|
node: $.func(),
|
|
@@ -5142,7 +5148,7 @@ function toHttpRequestNode(model, plugin) {
|
|
|
5142
5148
|
const shell = model.shell.define(model);
|
|
5143
5149
|
const node = shell.node;
|
|
5144
5150
|
let index = 0;
|
|
5145
|
-
for (const item of model.itemsFrom(source)) {
|
|
5151
|
+
for (const item of model.itemsFrom(source$1)) {
|
|
5146
5152
|
const { operation } = item.data;
|
|
5147
5153
|
if (index > 0 || node.hasBody) node.newline();
|
|
5148
5154
|
node.do(implementHttpRequestFn({
|
|
@@ -5169,7 +5175,7 @@ function toHttpRequestNode(model, plugin) {
|
|
|
5169
5175
|
function toHttpResourceNode(model, plugin) {
|
|
5170
5176
|
if (model.virtual) {
|
|
5171
5177
|
const nodes = [];
|
|
5172
|
-
for (const item of model.itemsFrom(source)) {
|
|
5178
|
+
for (const item of model.itemsFrom(source$1)) {
|
|
5173
5179
|
const { operation } = item.data;
|
|
5174
5180
|
let node = $.const(createHttpResourceFnSymbol(plugin, item)).export().assign(implementHttpResourceFn({
|
|
5175
5181
|
node: $.func(),
|
|
@@ -5190,7 +5196,7 @@ function toHttpResourceNode(model, plugin) {
|
|
|
5190
5196
|
const shell = model.shell.define(model);
|
|
5191
5197
|
const node = shell.node;
|
|
5192
5198
|
let index = 0;
|
|
5193
|
-
for (const item of model.itemsFrom(source)) {
|
|
5199
|
+
for (const item of model.itemsFrom(source$1)) {
|
|
5194
5200
|
const { operation } = item.data;
|
|
5195
5201
|
if (index > 0 || node.hasBody) node.newline();
|
|
5196
5202
|
node.do(implementHttpResourceFn({
|
|
@@ -5217,7 +5223,7 @@ function toHttpResourceNode(model, plugin) {
|
|
|
5217
5223
|
|
|
5218
5224
|
//#endregion
|
|
5219
5225
|
//#region src/plugins/@angular/common/plugin.ts
|
|
5220
|
-
const handler$
|
|
5226
|
+
const handler$13 = ({ plugin }) => {
|
|
5221
5227
|
plugin.symbol("HttpRequest", {
|
|
5222
5228
|
external: "@angular/common/http",
|
|
5223
5229
|
kind: "type",
|
|
@@ -5259,7 +5265,7 @@ const handler$12 = ({ plugin }) => {
|
|
|
5259
5265
|
path,
|
|
5260
5266
|
shell
|
|
5261
5267
|
})),
|
|
5262
|
-
source
|
|
5268
|
+
source: source$1
|
|
5263
5269
|
});
|
|
5264
5270
|
}, { order: "declarations" });
|
|
5265
5271
|
}
|
|
@@ -5273,7 +5279,7 @@ const handler$12 = ({ plugin }) => {
|
|
|
5273
5279
|
path,
|
|
5274
5280
|
shell
|
|
5275
5281
|
})),
|
|
5276
|
-
source
|
|
5282
|
+
source: source$1
|
|
5277
5283
|
});
|
|
5278
5284
|
}, { order: "declarations" });
|
|
5279
5285
|
}
|
|
@@ -5297,13 +5303,13 @@ const handler$12 = ({ plugin }) => {
|
|
|
5297
5303
|
|
|
5298
5304
|
//#endregion
|
|
5299
5305
|
//#region src/plugins/@angular/common/config.ts
|
|
5300
|
-
const defaultConfig$
|
|
5306
|
+
const defaultConfig$26 = {
|
|
5301
5307
|
config: {
|
|
5302
5308
|
comments: true,
|
|
5303
5309
|
includeInEntry: false
|
|
5304
5310
|
},
|
|
5305
5311
|
dependencies: ["@hey-api/client-angular", "@hey-api/sdk"],
|
|
5306
|
-
handler: handler$
|
|
5312
|
+
handler: handler$13,
|
|
5307
5313
|
name: "@angular/common",
|
|
5308
5314
|
resolveConfig: (plugin, context) => {
|
|
5309
5315
|
plugin.config.httpRequests = resolveHttpRequests(plugin.config, context);
|
|
@@ -5313,7 +5319,7 @@ const defaultConfig$25 = {
|
|
|
5313
5319
|
/**
|
|
5314
5320
|
* Type helper for `@angular/common` plugin, returns {@link Plugin.Config} object
|
|
5315
5321
|
*/
|
|
5316
|
-
const defineConfig$
|
|
5322
|
+
const defineConfig$26 = definePluginConfig(defaultConfig$26);
|
|
5317
5323
|
|
|
5318
5324
|
//#endregion
|
|
5319
5325
|
//#region src/plugins/@faker-js/faker/api.ts
|
|
@@ -5324,7 +5330,7 @@ var Api$4 = class {
|
|
|
5324
5330
|
|
|
5325
5331
|
//#endregion
|
|
5326
5332
|
//#region src/plugins/@faker-js/faker/config.ts
|
|
5327
|
-
const defaultConfig$
|
|
5333
|
+
const defaultConfig$25 = {
|
|
5328
5334
|
api: new Api$4(),
|
|
5329
5335
|
config: {
|
|
5330
5336
|
case: "camelCase",
|
|
@@ -5348,7 +5354,7 @@ const defaultConfig$24 = {
|
|
|
5348
5354
|
/**
|
|
5349
5355
|
* Type helper for Faker plugin, returns {@link Plugin.Config} object
|
|
5350
5356
|
*/
|
|
5351
|
-
const defineConfig$
|
|
5357
|
+
const defineConfig$25 = definePluginConfig(defaultConfig$25);
|
|
5352
5358
|
|
|
5353
5359
|
//#endregion
|
|
5354
5360
|
//#region src/plugins/@hey-api/client-core/config.ts
|
|
@@ -5419,7 +5425,7 @@ function renameFile({ filePath, project, renamed }) {
|
|
|
5419
5425
|
renamed.set(name, renamedName);
|
|
5420
5426
|
}
|
|
5421
5427
|
}
|
|
5422
|
-
function replaceImports({ filePath, header,
|
|
5428
|
+
function replaceImports({ filePath, header, module, renamed }) {
|
|
5423
5429
|
let content = fs.readFileSync(filePath, "utf8");
|
|
5424
5430
|
if (isEnvironment("development")) {
|
|
5425
5431
|
content = content.replace(/from\s+['"]\.\.\/\.\.\/client-core\/bundle\//g, "from '../core/");
|
|
@@ -5430,7 +5436,7 @@ function replaceImports({ filePath, header, meta, renamed }) {
|
|
|
5430
5436
|
const extension = path.extname(importPath);
|
|
5431
5437
|
const fileName = path.basename(importPath, extension);
|
|
5432
5438
|
const importDir = path.dirname(importPath);
|
|
5433
|
-
const replacedName = (renamed.get(fileName) ?? fileName) + (
|
|
5439
|
+
const replacedName = (renamed.get(fileName) ?? fileName) + (module.extension ? module.extension : extension);
|
|
5434
5440
|
return match.slice(0, importIndex) + [importDir, replacedName].filter(Boolean).join("/") + match.slice(importIndex + importPath.length);
|
|
5435
5441
|
});
|
|
5436
5442
|
content = `${header ?? ""}${content}`;
|
|
@@ -5439,7 +5445,7 @@ function replaceImports({ filePath, header, meta, renamed }) {
|
|
|
5439
5445
|
/**
|
|
5440
5446
|
* Creates a `client` folder containing the same modules as the client package.
|
|
5441
5447
|
*/
|
|
5442
|
-
function generateClientBundle({ header,
|
|
5448
|
+
function generateClientBundle({ header, module, outputPath, plugin, project }) {
|
|
5443
5449
|
const renamed = /* @__PURE__ */ new Map();
|
|
5444
5450
|
const headerPrefix = outputHeaderToPrefix({
|
|
5445
5451
|
defaultValue: ["// This file is auto-generated by @hey-api/openapi-ts"],
|
|
@@ -5472,14 +5478,14 @@ function generateClientBundle({ header, meta, outputPath, plugin, project }) {
|
|
|
5472
5478
|
for (const file of coreFiles) replaceImports({
|
|
5473
5479
|
filePath: path.resolve(coreOutputPath, file),
|
|
5474
5480
|
header: headerPrefix,
|
|
5475
|
-
|
|
5481
|
+
module,
|
|
5476
5482
|
renamed
|
|
5477
5483
|
});
|
|
5478
5484
|
const clientFiles = fs.readdirSync(clientOutputPath);
|
|
5479
5485
|
for (const file of clientFiles) replaceImports({
|
|
5480
5486
|
filePath: path.resolve(clientOutputPath, file),
|
|
5481
5487
|
header: headerPrefix,
|
|
5482
|
-
|
|
5488
|
+
module,
|
|
5483
5489
|
renamed
|
|
5484
5490
|
});
|
|
5485
5491
|
return renamed;
|
|
@@ -5579,7 +5585,7 @@ const clientPluginHandler = ({ plugin }) => {
|
|
|
5579
5585
|
|
|
5580
5586
|
//#endregion
|
|
5581
5587
|
//#region src/plugins/@hey-api/client-angular/config.ts
|
|
5582
|
-
const defaultConfig$
|
|
5588
|
+
const defaultConfig$24 = {
|
|
5583
5589
|
...clientDefaultMeta,
|
|
5584
5590
|
config: {
|
|
5585
5591
|
...clientDefaultConfig,
|
|
@@ -5591,11 +5597,11 @@ const defaultConfig$23 = {
|
|
|
5591
5597
|
/**
|
|
5592
5598
|
* Type helper for `@hey-api/client-angular` plugin, returns {@link Plugin.Config} object
|
|
5593
5599
|
*/
|
|
5594
|
-
const defineConfig$
|
|
5600
|
+
const defineConfig$24 = definePluginConfig(defaultConfig$24);
|
|
5595
5601
|
|
|
5596
5602
|
//#endregion
|
|
5597
5603
|
//#region src/plugins/@hey-api/client-axios/config.ts
|
|
5598
|
-
const defaultConfig$
|
|
5604
|
+
const defaultConfig$23 = {
|
|
5599
5605
|
...clientDefaultMeta,
|
|
5600
5606
|
config: {
|
|
5601
5607
|
...clientDefaultConfig,
|
|
@@ -5607,11 +5613,11 @@ const defaultConfig$22 = {
|
|
|
5607
5613
|
/**
|
|
5608
5614
|
* Type helper for `@hey-api/client-axios` plugin, returns {@link Plugin.Config} object
|
|
5609
5615
|
*/
|
|
5610
|
-
const defineConfig$
|
|
5616
|
+
const defineConfig$23 = definePluginConfig(defaultConfig$23);
|
|
5611
5617
|
|
|
5612
5618
|
//#endregion
|
|
5613
5619
|
//#region src/plugins/@hey-api/client-fetch/config.ts
|
|
5614
|
-
const defaultConfig$
|
|
5620
|
+
const defaultConfig$22 = {
|
|
5615
5621
|
...clientDefaultMeta,
|
|
5616
5622
|
config: {
|
|
5617
5623
|
...clientDefaultConfig,
|
|
@@ -5623,11 +5629,11 @@ const defaultConfig$21 = {
|
|
|
5623
5629
|
/**
|
|
5624
5630
|
* Type helper for `@hey-api/client-fetch` plugin, returns {@link Plugin.Config} object
|
|
5625
5631
|
*/
|
|
5626
|
-
const defineConfig$
|
|
5632
|
+
const defineConfig$22 = definePluginConfig(defaultConfig$22);
|
|
5627
5633
|
|
|
5628
5634
|
//#endregion
|
|
5629
5635
|
//#region src/plugins/@hey-api/client-ky/config.ts
|
|
5630
|
-
const defaultConfig$
|
|
5636
|
+
const defaultConfig$21 = {
|
|
5631
5637
|
...clientDefaultMeta,
|
|
5632
5638
|
config: {
|
|
5633
5639
|
...clientDefaultConfig,
|
|
@@ -5639,11 +5645,11 @@ const defaultConfig$20 = {
|
|
|
5639
5645
|
/**
|
|
5640
5646
|
* Type helper for `@hey-api/client-ky` plugin, returns {@link Plugin.Config} object
|
|
5641
5647
|
*/
|
|
5642
|
-
const defineConfig$
|
|
5648
|
+
const defineConfig$21 = definePluginConfig(defaultConfig$21);
|
|
5643
5649
|
|
|
5644
5650
|
//#endregion
|
|
5645
5651
|
//#region src/plugins/@hey-api/client-next/config.ts
|
|
5646
|
-
const defaultConfig$
|
|
5652
|
+
const defaultConfig$20 = {
|
|
5647
5653
|
...clientDefaultMeta,
|
|
5648
5654
|
config: {
|
|
5649
5655
|
...clientDefaultConfig,
|
|
@@ -5655,11 +5661,11 @@ const defaultConfig$19 = {
|
|
|
5655
5661
|
/**
|
|
5656
5662
|
* Type helper for `@hey-api/client-next` plugin, returns {@link Plugin.Config} object
|
|
5657
5663
|
*/
|
|
5658
|
-
const defineConfig$
|
|
5664
|
+
const defineConfig$20 = definePluginConfig(defaultConfig$20);
|
|
5659
5665
|
|
|
5660
5666
|
//#endregion
|
|
5661
5667
|
//#region src/plugins/@hey-api/client-nuxt/config.ts
|
|
5662
|
-
const defaultConfig$
|
|
5668
|
+
const defaultConfig$19 = {
|
|
5663
5669
|
...clientDefaultMeta,
|
|
5664
5670
|
config: clientDefaultConfig,
|
|
5665
5671
|
handler: clientPluginHandler,
|
|
@@ -5668,11 +5674,11 @@ const defaultConfig$18 = {
|
|
|
5668
5674
|
/**
|
|
5669
5675
|
* Type helper for `@hey-api/client-nuxt` plugin, returns {@link Plugin.Config} object
|
|
5670
5676
|
*/
|
|
5671
|
-
const defineConfig$
|
|
5677
|
+
const defineConfig$19 = definePluginConfig(defaultConfig$19);
|
|
5672
5678
|
|
|
5673
5679
|
//#endregion
|
|
5674
5680
|
//#region src/plugins/@hey-api/client-ofetch/config.ts
|
|
5675
|
-
const defaultConfig$
|
|
5681
|
+
const defaultConfig$18 = {
|
|
5676
5682
|
...clientDefaultMeta,
|
|
5677
5683
|
config: {
|
|
5678
5684
|
...clientDefaultConfig,
|
|
@@ -5684,7 +5690,7 @@ const defaultConfig$17 = {
|
|
|
5684
5690
|
/**
|
|
5685
5691
|
* Type helper for `@hey-api/client-ofetch` plugin, returns {@link Plugin.Config} object
|
|
5686
5692
|
*/
|
|
5687
|
-
const defineConfig$
|
|
5693
|
+
const defineConfig$18 = definePluginConfig(defaultConfig$18);
|
|
5688
5694
|
|
|
5689
5695
|
//#endregion
|
|
5690
5696
|
//#region src/plugins/@hey-api/schemas/plugin.ts
|
|
@@ -5915,7 +5921,7 @@ const schemasV3_1_X = ({ context, plugin }) => {
|
|
|
5915
5921
|
plugin.node(statement);
|
|
5916
5922
|
}
|
|
5917
5923
|
};
|
|
5918
|
-
const handler$
|
|
5924
|
+
const handler$12 = ({ plugin }) => {
|
|
5919
5925
|
if ("swagger" in plugin.context.spec) {
|
|
5920
5926
|
schemasV2_0_X({
|
|
5921
5927
|
context: plugin.context,
|
|
@@ -5942,19 +5948,19 @@ const handler$11 = ({ plugin }) => {
|
|
|
5942
5948
|
|
|
5943
5949
|
//#endregion
|
|
5944
5950
|
//#region src/plugins/@hey-api/schemas/config.ts
|
|
5945
|
-
const defaultConfig$
|
|
5951
|
+
const defaultConfig$17 = {
|
|
5946
5952
|
config: {
|
|
5947
5953
|
includeInEntry: false,
|
|
5948
5954
|
nameBuilder: (name) => `${name}Schema`,
|
|
5949
5955
|
type: "json"
|
|
5950
5956
|
},
|
|
5951
|
-
handler: handler$
|
|
5957
|
+
handler: handler$12,
|
|
5952
5958
|
name: "@hey-api/schemas"
|
|
5953
5959
|
};
|
|
5954
5960
|
/**
|
|
5955
5961
|
* Type helper for `@hey-api/schemas` plugin, returns {@link Plugin.Config} object
|
|
5956
5962
|
*/
|
|
5957
|
-
const defineConfig$
|
|
5963
|
+
const defineConfig$17 = definePluginConfig(defaultConfig$17);
|
|
5958
5964
|
|
|
5959
5965
|
//#endregion
|
|
5960
5966
|
//#region src/plugins/@hey-api/sdk/examples/config.ts
|
|
@@ -6003,9 +6009,9 @@ function resolveOperations(config, context) {
|
|
|
6003
6009
|
replacement: ["operations: { nesting: \"operationId\" }", "operations: { nesting: \"id\" }"]
|
|
6004
6010
|
});
|
|
6005
6011
|
const legacy = mapLegacyToConfig(config);
|
|
6006
|
-
return normalizeConfig(config.operations, legacy, context);
|
|
6012
|
+
return normalizeConfig$1(config.operations, legacy, context);
|
|
6007
6013
|
}
|
|
6008
|
-
function normalizeConfig(input, legacy, context) {
|
|
6014
|
+
function normalizeConfig$1(input, legacy, context) {
|
|
6009
6015
|
if (!input || typeof input === "string" || typeof input === "function") input = { strategy: input };
|
|
6010
6016
|
const strategy = legacy.strategy ?? input.strategy ?? "flat";
|
|
6011
6017
|
const methods = strategy === "single" ? "instance" : "static";
|
|
@@ -6106,7 +6112,7 @@ function mapLegacyToConfig(config) {
|
|
|
6106
6112
|
|
|
6107
6113
|
//#endregion
|
|
6108
6114
|
//#region src/plugins/@hey-api/sdk/operations/resolve.ts
|
|
6109
|
-
function resolvePath(plugin) {
|
|
6115
|
+
function resolvePath$1(plugin) {
|
|
6110
6116
|
if (plugin.config.operations.nesting === "id") return OperationPath.id();
|
|
6111
6117
|
if (plugin.config.operations.nesting === "operationId") return OperationPath.fromOperationId({
|
|
6112
6118
|
delimiters: plugin.config.operations.nestingDelimiters,
|
|
@@ -6114,18 +6120,18 @@ function resolvePath(plugin) {
|
|
|
6114
6120
|
});
|
|
6115
6121
|
return plugin.config.operations.nesting;
|
|
6116
6122
|
}
|
|
6117
|
-
function resolveStrategy(plugin) {
|
|
6118
|
-
if (plugin.config.operations.strategy === "flat") return OperationStrategy.flat({ path: (operation) => [resolvePath(plugin)(operation).join(".")] });
|
|
6123
|
+
function resolveStrategy$1(plugin) {
|
|
6124
|
+
if (plugin.config.operations.strategy === "flat") return OperationStrategy.flat({ path: (operation) => [resolvePath$1(plugin)(operation).join(".")] });
|
|
6119
6125
|
if (plugin.config.operations.strategy === "single") {
|
|
6120
6126
|
const root = plugin.config.operations.containerName;
|
|
6121
6127
|
return OperationStrategy.single({
|
|
6122
|
-
path: resolvePath(plugin),
|
|
6128
|
+
path: resolvePath$1(plugin),
|
|
6123
6129
|
root: typeof root.name === "string" ? root.name : root.name?.("") ?? ""
|
|
6124
6130
|
});
|
|
6125
6131
|
}
|
|
6126
6132
|
if (plugin.config.operations.strategy === "byTags") return OperationStrategy.byTags({
|
|
6127
6133
|
fallback: plugin.config.operations.strategyDefaultTag,
|
|
6128
|
-
path: resolvePath(plugin)
|
|
6134
|
+
path: resolvePath$1(plugin)
|
|
6129
6135
|
});
|
|
6130
6136
|
return plugin.config.operations.strategy;
|
|
6131
6137
|
}
|
|
@@ -6168,7 +6174,7 @@ const createTypeOptions = ({ plugin }) => {
|
|
|
6168
6174
|
|
|
6169
6175
|
//#endregion
|
|
6170
6176
|
//#region src/plugins/@hey-api/sdk/v1/plugin.ts
|
|
6171
|
-
const handlerV1$
|
|
6177
|
+
const handlerV1$3 = ({ plugin }) => {
|
|
6172
6178
|
const clientModule = clientFolderAbsolutePath(getTypedConfig(plugin));
|
|
6173
6179
|
const client = getClientPlugin(getTypedConfig(plugin));
|
|
6174
6180
|
const isAngularClient = client.name === "@hey-api/client-angular";
|
|
@@ -6215,8 +6221,8 @@ const handlerV1$2 = ({ plugin }) => {
|
|
|
6215
6221
|
});
|
|
6216
6222
|
createTypeOptions({ plugin });
|
|
6217
6223
|
const structure = new StructureModel();
|
|
6218
|
-
const shell = createShell(plugin);
|
|
6219
|
-
const strategy = resolveStrategy(plugin);
|
|
6224
|
+
const shell = createShell$1(plugin);
|
|
6225
|
+
const strategy = resolveStrategy$1(plugin);
|
|
6220
6226
|
plugin.forEach("operation", (event) => {
|
|
6221
6227
|
structure.insert({
|
|
6222
6228
|
data: {
|
|
@@ -6228,13 +6234,13 @@ const handlerV1$2 = ({ plugin }) => {
|
|
|
6228
6234
|
path,
|
|
6229
6235
|
shell
|
|
6230
6236
|
})),
|
|
6231
|
-
source: source$
|
|
6237
|
+
source: source$2
|
|
6232
6238
|
});
|
|
6233
6239
|
}, { order: "declarations" });
|
|
6234
6240
|
const allDependencies = [];
|
|
6235
6241
|
const allNodes = [];
|
|
6236
6242
|
for (const node of structure.walk()) {
|
|
6237
|
-
const { dependencies, nodes } = toNode$
|
|
6243
|
+
const { dependencies, nodes } = toNode$2(node, plugin);
|
|
6238
6244
|
allDependencies.push(...dependencies ?? []);
|
|
6239
6245
|
allNodes.push(...nodes);
|
|
6240
6246
|
}
|
|
@@ -6246,13 +6252,13 @@ const handlerV1$2 = ({ plugin }) => {
|
|
|
6246
6252
|
|
|
6247
6253
|
//#endregion
|
|
6248
6254
|
//#region src/plugins/@hey-api/sdk/plugin.ts
|
|
6249
|
-
const handler$
|
|
6255
|
+
const handler$11 = (args) => handlerV1$3(args);
|
|
6250
6256
|
|
|
6251
6257
|
//#endregion
|
|
6252
6258
|
//#region src/plugins/@hey-api/sdk/config.ts
|
|
6253
6259
|
const transformerInferWarn = "You set `transformer: true` but no transformer plugin was found in your plugins. Add a transformer plugin like `@hey-api/transformers` to enable this feature. The transformer option has been disabled.";
|
|
6254
|
-
const validatorInferWarn = "You set `validator: true` but no validator plugin was found in your plugins. Add a validator plugin like `zod` to enable this feature. The validator option has been disabled.";
|
|
6255
|
-
const defaultConfig$
|
|
6260
|
+
const validatorInferWarn$1 = "You set `validator: true` but no validator plugin was found in your plugins. Add a validator plugin like `zod` to enable this feature. The validator option has been disabled.";
|
|
6261
|
+
const defaultConfig$16 = {
|
|
6256
6262
|
config: {
|
|
6257
6263
|
auth: true,
|
|
6258
6264
|
client: true,
|
|
@@ -6265,7 +6271,7 @@ const defaultConfig$15 = {
|
|
|
6265
6271
|
response: "body"
|
|
6266
6272
|
},
|
|
6267
6273
|
dependencies: ["@hey-api/typescript"],
|
|
6268
|
-
handler: handler$
|
|
6274
|
+
handler: handler$11,
|
|
6269
6275
|
name: "@hey-api/sdk",
|
|
6270
6276
|
resolveConfig: (plugin, context) => {
|
|
6271
6277
|
if (plugin.config.client) {
|
|
@@ -6289,7 +6295,7 @@ const defaultConfig$15 = {
|
|
|
6289
6295
|
plugin.config.validator.request = context.pluginByTag("validator");
|
|
6290
6296
|
plugin.dependencies.add(plugin.config.validator.request);
|
|
6291
6297
|
} catch {
|
|
6292
|
-
log.warn(validatorInferWarn);
|
|
6298
|
+
log.warn(validatorInferWarn$1);
|
|
6293
6299
|
plugin.config.validator.request = false;
|
|
6294
6300
|
}
|
|
6295
6301
|
else plugin.dependencies.add(plugin.config.validator.request);
|
|
@@ -6298,7 +6304,7 @@ const defaultConfig$15 = {
|
|
|
6298
6304
|
plugin.config.validator.response = context.pluginByTag("validator");
|
|
6299
6305
|
plugin.dependencies.add(plugin.config.validator.response);
|
|
6300
6306
|
} catch {
|
|
6301
|
-
log.warn(validatorInferWarn);
|
|
6307
|
+
log.warn(validatorInferWarn$1);
|
|
6302
6308
|
plugin.config.validator.response = false;
|
|
6303
6309
|
}
|
|
6304
6310
|
else plugin.dependencies.add(plugin.config.validator.response);
|
|
@@ -6310,7 +6316,7 @@ const defaultConfig$15 = {
|
|
|
6310
6316
|
/**
|
|
6311
6317
|
* Type helper for `@hey-api/sdk` plugin, returns {@link Plugin.Config} object
|
|
6312
6318
|
*/
|
|
6313
|
-
const defineConfig$
|
|
6319
|
+
const defineConfig$16 = definePluginConfig(defaultConfig$16);
|
|
6314
6320
|
|
|
6315
6321
|
//#endregion
|
|
6316
6322
|
//#region src/plugins/@hey-api/transformers/expressions.ts
|
|
@@ -6332,8 +6338,10 @@ const dateExpressions = ({ dataExpression, schema }) => {
|
|
|
6332
6338
|
//#region src/plugins/@hey-api/transformers/plugin.ts
|
|
6333
6339
|
const dataVariableName = "data";
|
|
6334
6340
|
const buildingSymbols = /* @__PURE__ */ new Set();
|
|
6335
|
-
|
|
6336
|
-
|
|
6341
|
+
function isNodeReturnStatement(node) {
|
|
6342
|
+
return node["~dsl"] === "ReturnTsDsl";
|
|
6343
|
+
}
|
|
6344
|
+
function schemaResponseTransformerNodes({ plugin, schema }) {
|
|
6337
6345
|
const nodes = processSchemaType({
|
|
6338
6346
|
dataExpression: $(dataVariableName),
|
|
6339
6347
|
plugin,
|
|
@@ -6344,8 +6352,8 @@ const schemaResponseTransformerNodes = ({ plugin, schema }) => {
|
|
|
6344
6352
|
if (!isNodeReturnStatement(last)) nodes.push($.return(dataVariableName));
|
|
6345
6353
|
}
|
|
6346
6354
|
return nodes;
|
|
6347
|
-
}
|
|
6348
|
-
|
|
6355
|
+
}
|
|
6356
|
+
function processSchemaType({ dataExpression, plugin, schema }) {
|
|
6349
6357
|
if (schema.$ref) {
|
|
6350
6358
|
const query = {
|
|
6351
6359
|
category: "transform",
|
|
@@ -6450,15 +6458,17 @@ const processSchemaType = ({ dataExpression, plugin, schema }) => {
|
|
|
6450
6458
|
}
|
|
6451
6459
|
for (const transformer of plugin.config.transformers) {
|
|
6452
6460
|
const t = transformer({
|
|
6461
|
+
$,
|
|
6453
6462
|
config: plugin.config,
|
|
6454
6463
|
dataExpression,
|
|
6464
|
+
plugin,
|
|
6455
6465
|
schema
|
|
6456
6466
|
});
|
|
6457
6467
|
if (t) return t;
|
|
6458
6468
|
}
|
|
6459
6469
|
return [];
|
|
6460
|
-
}
|
|
6461
|
-
const handler$
|
|
6470
|
+
}
|
|
6471
|
+
const handler$10 = ({ plugin }) => {
|
|
6462
6472
|
plugin.forEach("operation", ({ operation }) => {
|
|
6463
6473
|
const { response } = operationResponsesMap(operation);
|
|
6464
6474
|
if (!response) return;
|
|
@@ -6503,7 +6513,7 @@ const handler$9 = ({ plugin }) => {
|
|
|
6503
6513
|
|
|
6504
6514
|
//#endregion
|
|
6505
6515
|
//#region src/plugins/@hey-api/transformers/config.ts
|
|
6506
|
-
const defaultConfig$
|
|
6516
|
+
const defaultConfig$15 = {
|
|
6507
6517
|
config: {
|
|
6508
6518
|
bigInt: true,
|
|
6509
6519
|
dates: true,
|
|
@@ -6512,7 +6522,7 @@ const defaultConfig$14 = {
|
|
|
6512
6522
|
typeTransformers: []
|
|
6513
6523
|
},
|
|
6514
6524
|
dependencies: ["@hey-api/typescript"],
|
|
6515
|
-
handler: handler$
|
|
6525
|
+
handler: handler$10,
|
|
6516
6526
|
name: "@hey-api/transformers",
|
|
6517
6527
|
resolveConfig: (plugin) => {
|
|
6518
6528
|
if (!plugin.config.transformers) plugin.config.transformers = [];
|
|
@@ -6524,7 +6534,7 @@ const defaultConfig$14 = {
|
|
|
6524
6534
|
/**
|
|
6525
6535
|
* Type helper for `@hey-api/transformers`, returns {@link Plugin.Config} object
|
|
6526
6536
|
*/
|
|
6527
|
-
const defineConfig$
|
|
6537
|
+
const defineConfig$15 = definePluginConfig(defaultConfig$15);
|
|
6528
6538
|
|
|
6529
6539
|
//#endregion
|
|
6530
6540
|
//#region src/plugins/shared/utils/schema.ts
|
|
@@ -7266,7 +7276,11 @@ function createVisitor$4(config) {
|
|
|
7266
7276
|
}
|
|
7267
7277
|
const transformersPlugin = ctx.plugin.getPlugin("@hey-api/transformers");
|
|
7268
7278
|
if (transformersPlugin?.config.typeTransformers) for (const typeTransformer of transformersPlugin.config.typeTransformers) {
|
|
7269
|
-
const typeNode = typeTransformer({
|
|
7279
|
+
const typeNode = typeTransformer({
|
|
7280
|
+
$,
|
|
7281
|
+
plugin: transformersPlugin,
|
|
7282
|
+
schema
|
|
7283
|
+
});
|
|
7270
7284
|
if (typeNode) return {
|
|
7271
7285
|
meta: defaultMeta$2(schema),
|
|
7272
7286
|
type: typeNode
|
|
@@ -7763,7 +7777,7 @@ function webhookToType({ operation, path, plugin, tags }) {
|
|
|
7763
7777
|
|
|
7764
7778
|
//#endregion
|
|
7765
7779
|
//#region src/plugins/@hey-api/typescript/v1/plugin.ts
|
|
7766
|
-
const handlerV1$
|
|
7780
|
+
const handlerV1$2 = ({ plugin }) => {
|
|
7767
7781
|
const nodeClientIndex = plugin.node(null);
|
|
7768
7782
|
const nodeWebhooksIndex = plugin.node(null);
|
|
7769
7783
|
const servers = [];
|
|
@@ -7855,11 +7869,11 @@ const handlerV1$1 = ({ plugin }) => {
|
|
|
7855
7869
|
|
|
7856
7870
|
//#endregion
|
|
7857
7871
|
//#region src/plugins/@hey-api/typescript/plugin.ts
|
|
7858
|
-
const handler$
|
|
7872
|
+
const handler$9 = (args) => handlerV1$2(args);
|
|
7859
7873
|
|
|
7860
7874
|
//#endregion
|
|
7861
7875
|
//#region src/plugins/@hey-api/typescript/config.ts
|
|
7862
|
-
const defaultConfig$
|
|
7876
|
+
const defaultConfig$14 = {
|
|
7863
7877
|
api: new Api$3(),
|
|
7864
7878
|
config: {
|
|
7865
7879
|
case: "PascalCase",
|
|
@@ -7867,7 +7881,7 @@ const defaultConfig$13 = {
|
|
|
7867
7881
|
includeInEntry: true,
|
|
7868
7882
|
topType: "unknown"
|
|
7869
7883
|
},
|
|
7870
|
-
handler: handler$
|
|
7884
|
+
handler: handler$9,
|
|
7871
7885
|
name: "@hey-api/typescript",
|
|
7872
7886
|
resolveConfig: (plugin, context) => {
|
|
7873
7887
|
plugin.config.definitions = context.valueToObject({
|
|
@@ -7946,7 +7960,7 @@ const defaultConfig$13 = {
|
|
|
7946
7960
|
/**
|
|
7947
7961
|
* Type helper for `@hey-api/typescript` plugin, returns {@link Plugin.Config} object
|
|
7948
7962
|
*/
|
|
7949
|
-
const defineConfig$
|
|
7963
|
+
const defineConfig$14 = definePluginConfig(defaultConfig$14);
|
|
7950
7964
|
|
|
7951
7965
|
//#endregion
|
|
7952
7966
|
//#region src/plugins/@pinia/colada/meta.ts
|
|
@@ -8234,18 +8248,18 @@ const handlerV0 = ({ plugin }) => {
|
|
|
8234
8248
|
|
|
8235
8249
|
//#endregion
|
|
8236
8250
|
//#region src/plugins/@pinia/colada/plugin.ts
|
|
8237
|
-
const handler$
|
|
8251
|
+
const handler$8 = (args) => handlerV0(args);
|
|
8238
8252
|
|
|
8239
8253
|
//#endregion
|
|
8240
8254
|
//#region src/plugins/@pinia/colada/config.ts
|
|
8241
|
-
const defaultConfig$
|
|
8255
|
+
const defaultConfig$13 = {
|
|
8242
8256
|
config: {
|
|
8243
8257
|
case: "camelCase",
|
|
8244
8258
|
comments: true,
|
|
8245
8259
|
includeInEntry: false
|
|
8246
8260
|
},
|
|
8247
8261
|
dependencies: ["@hey-api/typescript", "@hey-api/sdk"],
|
|
8248
|
-
handler: handler$
|
|
8262
|
+
handler: handler$8,
|
|
8249
8263
|
name: "@pinia/colada",
|
|
8250
8264
|
resolveConfig: (plugin, context) => {
|
|
8251
8265
|
plugin.config.mutationOptions = context.valueToObject({
|
|
@@ -8281,7 +8295,7 @@ const defaultConfig$12 = {
|
|
|
8281
8295
|
/**
|
|
8282
8296
|
* Type helper for `@pinia/colada` plugin, returns {@link Plugin.Config} object
|
|
8283
8297
|
*/
|
|
8284
|
-
const defineConfig$
|
|
8298
|
+
const defineConfig$13 = definePluginConfig(defaultConfig$13);
|
|
8285
8299
|
|
|
8286
8300
|
//#endregion
|
|
8287
8301
|
//#region src/plugins/@tanstack/query-core/shared/useType.ts
|
|
@@ -8716,18 +8730,18 @@ const handlerV5 = ({ plugin }) => {
|
|
|
8716
8730
|
|
|
8717
8731
|
//#endregion
|
|
8718
8732
|
//#region src/plugins/@tanstack/query-core/plugin.ts
|
|
8719
|
-
const handler$
|
|
8733
|
+
const handler$7 = (args) => handlerV5(args);
|
|
8720
8734
|
|
|
8721
8735
|
//#endregion
|
|
8722
8736
|
//#region src/plugins/@tanstack/angular-query-experimental/config.ts
|
|
8723
|
-
const defaultConfig$
|
|
8737
|
+
const defaultConfig$12 = {
|
|
8724
8738
|
config: {
|
|
8725
8739
|
case: "camelCase",
|
|
8726
8740
|
comments: true,
|
|
8727
8741
|
includeInEntry: false
|
|
8728
8742
|
},
|
|
8729
8743
|
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
8730
|
-
handler: handler$
|
|
8744
|
+
handler: handler$7,
|
|
8731
8745
|
name: "@tanstack/angular-query-experimental",
|
|
8732
8746
|
resolveConfig: (plugin, context) => {
|
|
8733
8747
|
plugin.config.infiniteQueryKeys = context.valueToObject({
|
|
@@ -8784,18 +8798,18 @@ const defaultConfig$11 = {
|
|
|
8784
8798
|
/**
|
|
8785
8799
|
* Type helper for `@tanstack/angular-query-experimental` plugin, returns {@link Plugin.Config} object
|
|
8786
8800
|
*/
|
|
8787
|
-
const defineConfig$
|
|
8801
|
+
const defineConfig$12 = definePluginConfig(defaultConfig$12);
|
|
8788
8802
|
|
|
8789
8803
|
//#endregion
|
|
8790
8804
|
//#region src/plugins/@tanstack/preact-query/config.ts
|
|
8791
|
-
const defaultConfig$
|
|
8805
|
+
const defaultConfig$11 = {
|
|
8792
8806
|
config: {
|
|
8793
8807
|
case: "camelCase",
|
|
8794
8808
|
comments: true,
|
|
8795
8809
|
includeInEntry: false
|
|
8796
8810
|
},
|
|
8797
8811
|
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
8798
|
-
handler: handler$
|
|
8812
|
+
handler: handler$7,
|
|
8799
8813
|
name: "@tanstack/preact-query",
|
|
8800
8814
|
resolveConfig: (plugin, context) => {
|
|
8801
8815
|
plugin.config.infiniteQueryKeys = context.valueToObject({
|
|
@@ -8910,18 +8924,18 @@ const defaultConfig$10 = {
|
|
|
8910
8924
|
/**
|
|
8911
8925
|
* Type helper for `@tanstack/preact-query` plugin, returns {@link Plugin.Config} object
|
|
8912
8926
|
*/
|
|
8913
|
-
const defineConfig$
|
|
8927
|
+
const defineConfig$11 = definePluginConfig(defaultConfig$11);
|
|
8914
8928
|
|
|
8915
8929
|
//#endregion
|
|
8916
8930
|
//#region src/plugins/@tanstack/react-query/config.ts
|
|
8917
|
-
const defaultConfig$
|
|
8931
|
+
const defaultConfig$10 = {
|
|
8918
8932
|
config: {
|
|
8919
8933
|
case: "camelCase",
|
|
8920
8934
|
comments: true,
|
|
8921
8935
|
includeInEntry: false
|
|
8922
8936
|
},
|
|
8923
8937
|
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
8924
|
-
handler: handler$
|
|
8938
|
+
handler: handler$7,
|
|
8925
8939
|
name: "@tanstack/react-query",
|
|
8926
8940
|
resolveConfig: (plugin, context) => {
|
|
8927
8941
|
plugin.config.infiniteQueryKeys = context.valueToObject({
|
|
@@ -9036,18 +9050,18 @@ const defaultConfig$9 = {
|
|
|
9036
9050
|
/**
|
|
9037
9051
|
* Type helper for `@tanstack/react-query` plugin, returns {@link Plugin.Config} object
|
|
9038
9052
|
*/
|
|
9039
|
-
const defineConfig$
|
|
9053
|
+
const defineConfig$10 = definePluginConfig(defaultConfig$10);
|
|
9040
9054
|
|
|
9041
9055
|
//#endregion
|
|
9042
9056
|
//#region src/plugins/@tanstack/solid-query/config.ts
|
|
9043
|
-
const defaultConfig$
|
|
9057
|
+
const defaultConfig$9 = {
|
|
9044
9058
|
config: {
|
|
9045
9059
|
case: "camelCase",
|
|
9046
9060
|
comments: true,
|
|
9047
9061
|
includeInEntry: false
|
|
9048
9062
|
},
|
|
9049
9063
|
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
9050
|
-
handler: handler$
|
|
9064
|
+
handler: handler$7,
|
|
9051
9065
|
name: "@tanstack/solid-query",
|
|
9052
9066
|
resolveConfig: (plugin, context) => {
|
|
9053
9067
|
plugin.config.infiniteQueryKeys = context.valueToObject({
|
|
@@ -9104,18 +9118,18 @@ const defaultConfig$8 = {
|
|
|
9104
9118
|
/**
|
|
9105
9119
|
* Type helper for `@tanstack/solid-query` plugin, returns {@link Plugin.Config} object
|
|
9106
9120
|
*/
|
|
9107
|
-
const defineConfig$
|
|
9121
|
+
const defineConfig$9 = definePluginConfig(defaultConfig$9);
|
|
9108
9122
|
|
|
9109
9123
|
//#endregion
|
|
9110
9124
|
//#region src/plugins/@tanstack/svelte-query/config.ts
|
|
9111
|
-
const defaultConfig$
|
|
9125
|
+
const defaultConfig$8 = {
|
|
9112
9126
|
config: {
|
|
9113
9127
|
case: "camelCase",
|
|
9114
9128
|
comments: true,
|
|
9115
9129
|
includeInEntry: false
|
|
9116
9130
|
},
|
|
9117
9131
|
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
9118
|
-
handler: handler$
|
|
9132
|
+
handler: handler$7,
|
|
9119
9133
|
name: "@tanstack/svelte-query",
|
|
9120
9134
|
resolveConfig: (plugin, context) => {
|
|
9121
9135
|
plugin.config.infiniteQueryKeys = context.valueToObject({
|
|
@@ -9172,18 +9186,18 @@ const defaultConfig$7 = {
|
|
|
9172
9186
|
/**
|
|
9173
9187
|
* Type helper for `@tanstack/svelte-query` plugin, returns {@link Plugin.Config} object
|
|
9174
9188
|
*/
|
|
9175
|
-
const defineConfig$
|
|
9189
|
+
const defineConfig$8 = definePluginConfig(defaultConfig$8);
|
|
9176
9190
|
|
|
9177
9191
|
//#endregion
|
|
9178
9192
|
//#region src/plugins/@tanstack/vue-query/config.ts
|
|
9179
|
-
const defaultConfig$
|
|
9193
|
+
const defaultConfig$7 = {
|
|
9180
9194
|
config: {
|
|
9181
9195
|
case: "camelCase",
|
|
9182
9196
|
comments: true,
|
|
9183
9197
|
includeInEntry: false
|
|
9184
9198
|
},
|
|
9185
9199
|
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
9186
|
-
handler: handler$
|
|
9200
|
+
handler: handler$7,
|
|
9187
9201
|
name: "@tanstack/vue-query",
|
|
9188
9202
|
resolveConfig: (plugin, context) => {
|
|
9189
9203
|
plugin.config.infiniteQueryKeys = context.valueToObject({
|
|
@@ -9240,7 +9254,7 @@ const defaultConfig$6 = {
|
|
|
9240
9254
|
/**
|
|
9241
9255
|
* Type helper for `@tanstack/vue-query` plugin, returns {@link Plugin.Config} object
|
|
9242
9256
|
*/
|
|
9243
|
-
const defineConfig$
|
|
9257
|
+
const defineConfig$7 = definePluginConfig(defaultConfig$7);
|
|
9244
9258
|
|
|
9245
9259
|
//#endregion
|
|
9246
9260
|
//#region src/plugins/arktype/v2/api.ts
|
|
@@ -9655,11 +9669,11 @@ const handlerV2$1 = ({ plugin }) => {
|
|
|
9655
9669
|
|
|
9656
9670
|
//#endregion
|
|
9657
9671
|
//#region src/plugins/arktype/plugin.ts
|
|
9658
|
-
const handler$
|
|
9672
|
+
const handler$6 = (args) => handlerV2$1(args);
|
|
9659
9673
|
|
|
9660
9674
|
//#endregion
|
|
9661
9675
|
//#region src/plugins/arktype/config.ts
|
|
9662
|
-
const defaultConfig$
|
|
9676
|
+
const defaultConfig$6 = {
|
|
9663
9677
|
api: new Api$2(),
|
|
9664
9678
|
config: {
|
|
9665
9679
|
case: "PascalCase",
|
|
@@ -9667,7 +9681,7 @@ const defaultConfig$5 = {
|
|
|
9667
9681
|
includeInEntry: false,
|
|
9668
9682
|
metadata: false
|
|
9669
9683
|
},
|
|
9670
|
-
handler: handler$
|
|
9684
|
+
handler: handler$6,
|
|
9671
9685
|
name: "arktype",
|
|
9672
9686
|
resolveConfig: (plugin, context) => {
|
|
9673
9687
|
plugin.config.types = context.valueToObject({
|
|
@@ -9838,7 +9852,7 @@ const defaultConfig$5 = {
|
|
|
9838
9852
|
/**
|
|
9839
9853
|
* Type helper for Arktype plugin, returns {@link Plugin.Config} object
|
|
9840
9854
|
*/
|
|
9841
|
-
const defineConfig$
|
|
9855
|
+
const defineConfig$6 = definePluginConfig(defaultConfig$6);
|
|
9842
9856
|
|
|
9843
9857
|
//#endregion
|
|
9844
9858
|
//#region src/plugins/fastify/plugin.ts
|
|
@@ -9901,7 +9915,7 @@ const operationToRouteHandler = ({ operation, plugin }) => {
|
|
|
9901
9915
|
type: $.type(symbolRouteHandler, (t) => t.generic(type))
|
|
9902
9916
|
};
|
|
9903
9917
|
};
|
|
9904
|
-
const handler$
|
|
9918
|
+
const handler$5 = ({ plugin }) => {
|
|
9905
9919
|
plugin.symbol("RouteHandler", {
|
|
9906
9920
|
external: "fastify",
|
|
9907
9921
|
kind: "type",
|
|
@@ -9926,16 +9940,16 @@ const handler$4 = ({ plugin }) => {
|
|
|
9926
9940
|
|
|
9927
9941
|
//#endregion
|
|
9928
9942
|
//#region src/plugins/fastify/config.ts
|
|
9929
|
-
const defaultConfig$
|
|
9943
|
+
const defaultConfig$5 = {
|
|
9930
9944
|
config: { includeInEntry: false },
|
|
9931
9945
|
dependencies: ["@hey-api/typescript"],
|
|
9932
|
-
handler: handler$
|
|
9946
|
+
handler: handler$5,
|
|
9933
9947
|
name: "fastify"
|
|
9934
9948
|
};
|
|
9935
9949
|
/**
|
|
9936
9950
|
* Type helper for `fastify` plugin, returns {@link Plugin.Config} object
|
|
9937
9951
|
*/
|
|
9938
|
-
const defineConfig$
|
|
9952
|
+
const defineConfig$5 = definePluginConfig(defaultConfig$5);
|
|
9939
9953
|
|
|
9940
9954
|
//#endregion
|
|
9941
9955
|
//#region src/plugins/nestjs/plugin.ts
|
|
@@ -9990,7 +10004,7 @@ const emitTypeAlias = ({ methods, plugin, typeName }) => {
|
|
|
9990
10004
|
for (const method of methods) type.prop(method.name, (p) => p.type(method.type));
|
|
9991
10005
|
plugin.node($.type.alias(symbol).export().type(type));
|
|
9992
10006
|
};
|
|
9993
|
-
const handler$
|
|
10007
|
+
const handler$4 = ({ plugin }) => {
|
|
9994
10008
|
const operationsByTag = /* @__PURE__ */ new Map();
|
|
9995
10009
|
plugin.forEach("operation", ({ operation, tags }) => {
|
|
9996
10010
|
const tag = tags?.[0] ?? "default";
|
|
@@ -10010,15 +10024,309 @@ const handler$3 = ({ plugin }) => {
|
|
|
10010
10024
|
|
|
10011
10025
|
//#endregion
|
|
10012
10026
|
//#region src/plugins/nestjs/config.ts
|
|
10013
|
-
const defaultConfig$
|
|
10027
|
+
const defaultConfig$4 = {
|
|
10014
10028
|
config: { includeInEntry: false },
|
|
10015
10029
|
dependencies: ["@hey-api/typescript"],
|
|
10016
|
-
handler: handler$
|
|
10030
|
+
handler: handler$4,
|
|
10017
10031
|
name: "nestjs"
|
|
10018
10032
|
};
|
|
10019
10033
|
/**
|
|
10020
10034
|
* Type helper for `nestjs` plugin, returns {@link Plugin.Config} object
|
|
10021
10035
|
*/
|
|
10036
|
+
const defineConfig$4 = definePluginConfig(defaultConfig$4);
|
|
10037
|
+
|
|
10038
|
+
//#endregion
|
|
10039
|
+
//#region src/plugins/orpc/contracts/config.ts
|
|
10040
|
+
function resolveContracts(config, context) {
|
|
10041
|
+
return normalizeConfig(config.contracts, context);
|
|
10042
|
+
}
|
|
10043
|
+
function normalizeConfig(input, context) {
|
|
10044
|
+
if (!input || typeof input === "string" || typeof input === "function") input = { strategy: input };
|
|
10045
|
+
const strategy = input.strategy ?? "single";
|
|
10046
|
+
return context.valueToObject({
|
|
10047
|
+
defaultValue: {
|
|
10048
|
+
container: "object",
|
|
10049
|
+
nesting: "operationId",
|
|
10050
|
+
nestingDelimiters: /[./]/,
|
|
10051
|
+
strategy,
|
|
10052
|
+
strategyDefaultTag: "default"
|
|
10053
|
+
},
|
|
10054
|
+
mappers: { object(value) {
|
|
10055
|
+
value.containerName = context.valueToObject({
|
|
10056
|
+
defaultValue: strategy === "single" ? {
|
|
10057
|
+
casing: "camelCase",
|
|
10058
|
+
name: "contract"
|
|
10059
|
+
} : { casing: "camelCase" },
|
|
10060
|
+
mappers: {
|
|
10061
|
+
function: (name) => ({ name }),
|
|
10062
|
+
string: (name) => ({ name })
|
|
10063
|
+
},
|
|
10064
|
+
value: value.containerName
|
|
10065
|
+
});
|
|
10066
|
+
value.contractName = context.valueToObject({
|
|
10067
|
+
defaultValue: { casing: "camelCase" },
|
|
10068
|
+
mappers: {
|
|
10069
|
+
function: (name) => ({ name }),
|
|
10070
|
+
string: (name) => ({ name })
|
|
10071
|
+
},
|
|
10072
|
+
value: value.contractName
|
|
10073
|
+
});
|
|
10074
|
+
value.segmentName = context.valueToObject({
|
|
10075
|
+
defaultValue: { casing: "camelCase" },
|
|
10076
|
+
mappers: {
|
|
10077
|
+
function: (name) => ({ name }),
|
|
10078
|
+
string: (name) => ({ name })
|
|
10079
|
+
},
|
|
10080
|
+
value: value.segmentName
|
|
10081
|
+
});
|
|
10082
|
+
return value;
|
|
10083
|
+
} },
|
|
10084
|
+
value: input
|
|
10085
|
+
});
|
|
10086
|
+
}
|
|
10087
|
+
|
|
10088
|
+
//#endregion
|
|
10089
|
+
//#region src/plugins/orpc/shared/operation.ts
|
|
10090
|
+
function hasInput(operation) {
|
|
10091
|
+
const hasPathParams = Boolean(operation.parameters?.path && Object.keys(operation.parameters.path).length > 0);
|
|
10092
|
+
const hasQueryParams = Boolean(operation.parameters?.query && Object.keys(operation.parameters.query).length > 0);
|
|
10093
|
+
const hasHeaderParams = Boolean(operation.parameters?.header && Object.keys(operation.parameters.header).length > 0);
|
|
10094
|
+
const hasBody = Boolean(operation.body);
|
|
10095
|
+
return hasPathParams || hasQueryParams || hasHeaderParams || hasBody;
|
|
10096
|
+
}
|
|
10097
|
+
function getSuccessResponse(operation) {
|
|
10098
|
+
if (operation.responses) for (const [statusCode, response] of Object.entries(operation.responses)) {
|
|
10099
|
+
const statusCodeNumber = Number.parseInt(statusCode, 10);
|
|
10100
|
+
if (statusCodeNumber >= 200 && statusCodeNumber <= 399 && response?.mediaType && response?.schema) return {
|
|
10101
|
+
hasOutput: true,
|
|
10102
|
+
statusCode: statusCodeNumber
|
|
10103
|
+
};
|
|
10104
|
+
}
|
|
10105
|
+
return {
|
|
10106
|
+
hasOutput: false,
|
|
10107
|
+
statusCode: void 0
|
|
10108
|
+
};
|
|
10109
|
+
}
|
|
10110
|
+
function getTags(operation, defaultTag) {
|
|
10111
|
+
return operation.tags && operation.tags.length > 0 ? [...operation.tags] : [defaultTag];
|
|
10112
|
+
}
|
|
10113
|
+
|
|
10114
|
+
//#endregion
|
|
10115
|
+
//#region src/plugins/orpc/contracts/node.ts
|
|
10116
|
+
const source = globalThis.Symbol("orpc");
|
|
10117
|
+
function createShellMeta(node) {
|
|
10118
|
+
return {
|
|
10119
|
+
category: "contract",
|
|
10120
|
+
resource: "container",
|
|
10121
|
+
resourceId: node.getPath().join("."),
|
|
10122
|
+
tool: "orpc"
|
|
10123
|
+
};
|
|
10124
|
+
}
|
|
10125
|
+
function createContractSymbol(plugin, item) {
|
|
10126
|
+
const { operation, path, tags } = item.data;
|
|
10127
|
+
const name = item.location[item.location.length - 1];
|
|
10128
|
+
return plugin.symbol(applyNaming(name, plugin.config.contracts.contractName), { meta: {
|
|
10129
|
+
category: "contract",
|
|
10130
|
+
path,
|
|
10131
|
+
resource: "operation",
|
|
10132
|
+
resourceId: operation.id,
|
|
10133
|
+
role: "contract",
|
|
10134
|
+
tags,
|
|
10135
|
+
tool: plugin.name
|
|
10136
|
+
} });
|
|
10137
|
+
}
|
|
10138
|
+
function createContractExpression(plugin, operation, baseSymbol) {
|
|
10139
|
+
const successResponse = getSuccessResponse(operation);
|
|
10140
|
+
const tags = getTags(operation, plugin.config.contracts.strategyDefaultTag);
|
|
10141
|
+
let expression = $(baseSymbol).attr("route").call($.object().$if(operation.deprecated, (o, v) => o.prop("deprecated", $.literal(v))).$if(operation.description, (o, v) => o.prop("description", $.literal(v))).prop("method", $.literal(operation.method.toUpperCase())).$if(operation.operationId, (o, v) => o.prop("operationId", $.literal(v))).prop("path", $.literal(operation.path)).$if(successResponse.hasOutput && successResponse.statusCode !== 200 && successResponse.statusCode, (o, v) => o.prop("successStatus", $.literal(v))).$if(operation.summary, (o, v) => o.prop("summary", $.literal(v))).$if(tags.length > 0 && tags, (o, v) => o.prop("tags", $.fromValue(v))));
|
|
10142
|
+
if (hasInput(operation) && plugin.config.validator.input) expression = expression.attr("input").call(plugin.referenceSymbol({
|
|
10143
|
+
category: "schema",
|
|
10144
|
+
resource: "operation",
|
|
10145
|
+
resourceId: operation.id,
|
|
10146
|
+
role: "data",
|
|
10147
|
+
tool: plugin.config.validator.input
|
|
10148
|
+
}));
|
|
10149
|
+
if (successResponse.hasOutput && plugin.config.validator.output) expression = expression.attr("output").call(plugin.referenceSymbol({
|
|
10150
|
+
category: "schema",
|
|
10151
|
+
resource: "operation",
|
|
10152
|
+
resourceId: operation.id,
|
|
10153
|
+
role: "responses",
|
|
10154
|
+
tool: plugin.config.validator.output
|
|
10155
|
+
}));
|
|
10156
|
+
return expression;
|
|
10157
|
+
}
|
|
10158
|
+
function buildContainerObject(node, plugin, symbols) {
|
|
10159
|
+
const obj = $.object();
|
|
10160
|
+
for (const item of node.itemsFrom(source)) {
|
|
10161
|
+
const { operation } = item.data;
|
|
10162
|
+
const contractSymbol = symbols.get(operation.id);
|
|
10163
|
+
const name = item.location[item.location.length - 1];
|
|
10164
|
+
const propName = applyNaming(name, plugin.config.contracts.contractName);
|
|
10165
|
+
obj.prop(propName, contractSymbol);
|
|
10166
|
+
}
|
|
10167
|
+
for (const child of node.children.values()) if (child.shell) {
|
|
10168
|
+
const childSymbol = child.shell.define(child).node.symbol;
|
|
10169
|
+
if (childSymbol) {
|
|
10170
|
+
const propName = applyNaming(child.name, plugin.config.contracts.segmentName);
|
|
10171
|
+
obj.prop(propName, childSymbol);
|
|
10172
|
+
}
|
|
10173
|
+
}
|
|
10174
|
+
return obj;
|
|
10175
|
+
}
|
|
10176
|
+
function createShell(plugin) {
|
|
10177
|
+
const cache = /* @__PURE__ */ new Map();
|
|
10178
|
+
return { define: (node) => {
|
|
10179
|
+
const resourceId = node.getPath().join(".");
|
|
10180
|
+
const cached = cache.get(resourceId);
|
|
10181
|
+
if (cached) return {
|
|
10182
|
+
dependencies: [],
|
|
10183
|
+
node: cached
|
|
10184
|
+
};
|
|
10185
|
+
const symbol = plugin.symbol(applyNaming(node.name, node.isRoot ? plugin.config.contracts.containerName : plugin.config.contracts.segmentName), { meta: createShellMeta(node) });
|
|
10186
|
+
const o = $.const(symbol).export().assign($.object());
|
|
10187
|
+
cache.set(resourceId, o);
|
|
10188
|
+
return {
|
|
10189
|
+
dependencies: [],
|
|
10190
|
+
node: o
|
|
10191
|
+
};
|
|
10192
|
+
} };
|
|
10193
|
+
}
|
|
10194
|
+
function toNode$1(model, plugin, baseSymbol) {
|
|
10195
|
+
if (model.virtual) {
|
|
10196
|
+
const nodes = [];
|
|
10197
|
+
const symbols = /* @__PURE__ */ new Map();
|
|
10198
|
+
for (const item of model.itemsFrom(source)) {
|
|
10199
|
+
const { operation } = item.data;
|
|
10200
|
+
const contractSymbol = createContractSymbol(plugin, item);
|
|
10201
|
+
const expression = createContractExpression(plugin, operation, baseSymbol);
|
|
10202
|
+
const node = $.const(contractSymbol).export().$if(createOperationComment(operation), (n, v) => n.doc(v)).assign(expression);
|
|
10203
|
+
nodes.push(node);
|
|
10204
|
+
symbols.set(operation.id, contractSymbol);
|
|
10205
|
+
}
|
|
10206
|
+
return {
|
|
10207
|
+
nodes,
|
|
10208
|
+
symbols
|
|
10209
|
+
};
|
|
10210
|
+
}
|
|
10211
|
+
if (!model.shell) return { nodes: [] };
|
|
10212
|
+
const nodes = [];
|
|
10213
|
+
const symbols = /* @__PURE__ */ new Map();
|
|
10214
|
+
for (const item of model.itemsFrom(source)) {
|
|
10215
|
+
const { operation } = item.data;
|
|
10216
|
+
const contractSymbol = createContractSymbol(plugin, item);
|
|
10217
|
+
const expression = createContractExpression(plugin, operation, baseSymbol);
|
|
10218
|
+
const node = $.const(contractSymbol).export().$if(createOperationComment(operation), (n, v) => n.doc(v)).assign(expression);
|
|
10219
|
+
nodes.push(node);
|
|
10220
|
+
symbols.set(operation.id, contractSymbol);
|
|
10221
|
+
}
|
|
10222
|
+
const containerSymbol = model.shell.define(model).node.symbol;
|
|
10223
|
+
const obj = buildContainerObject(model, plugin, symbols);
|
|
10224
|
+
const containerNode = $.const(containerSymbol).export().assign(obj.pretty());
|
|
10225
|
+
nodes.push(containerNode);
|
|
10226
|
+
return {
|
|
10227
|
+
nodes,
|
|
10228
|
+
symbols
|
|
10229
|
+
};
|
|
10230
|
+
}
|
|
10231
|
+
|
|
10232
|
+
//#endregion
|
|
10233
|
+
//#region src/plugins/orpc/contracts/resolve.ts
|
|
10234
|
+
function resolvePath(plugin) {
|
|
10235
|
+
if (plugin.config.contracts.nesting === "id") return OperationPath.id();
|
|
10236
|
+
if (plugin.config.contracts.nesting === "operationId") return OperationPath.fromOperationId({
|
|
10237
|
+
delimiters: plugin.config.contracts.nestingDelimiters,
|
|
10238
|
+
fallback: OperationPath.id()
|
|
10239
|
+
});
|
|
10240
|
+
return plugin.config.contracts.nesting;
|
|
10241
|
+
}
|
|
10242
|
+
function resolveStrategy(plugin) {
|
|
10243
|
+
if (plugin.config.contracts.strategy === "flat") return OperationStrategy.flat({ path: (operation) => [resolvePath(plugin)(operation).join(".")] });
|
|
10244
|
+
if (plugin.config.contracts.strategy === "single") {
|
|
10245
|
+
const root = plugin.config.contracts.containerName;
|
|
10246
|
+
return OperationStrategy.single({
|
|
10247
|
+
path: resolvePath(plugin),
|
|
10248
|
+
root: typeof root.name === "string" ? root.name : root.name?.("") ?? ""
|
|
10249
|
+
});
|
|
10250
|
+
}
|
|
10251
|
+
if (plugin.config.contracts.strategy === "byTags") return OperationStrategy.byTags({
|
|
10252
|
+
fallback: plugin.config.contracts.strategyDefaultTag,
|
|
10253
|
+
path: resolvePath(plugin)
|
|
10254
|
+
});
|
|
10255
|
+
return plugin.config.contracts.strategy;
|
|
10256
|
+
}
|
|
10257
|
+
|
|
10258
|
+
//#endregion
|
|
10259
|
+
//#region src/plugins/orpc/v1/plugin.ts
|
|
10260
|
+
const handlerV1$1 = ({ plugin }) => {
|
|
10261
|
+
const oc = plugin.symbol("oc", { external: "@orpc/contract" });
|
|
10262
|
+
const baseSymbol = plugin.symbol("base");
|
|
10263
|
+
const baseNode = $.const(baseSymbol).export().assign($(oc).attr("$route").call($.object().prop("inputStructure", $.literal("detailed"))));
|
|
10264
|
+
plugin.node(baseNode);
|
|
10265
|
+
const structure = new StructureModel();
|
|
10266
|
+
const shell = createShell(plugin);
|
|
10267
|
+
const strategy = resolveStrategy(plugin);
|
|
10268
|
+
plugin.forEach("operation", (event) => {
|
|
10269
|
+
structure.insert({
|
|
10270
|
+
data: {
|
|
10271
|
+
operation: event.operation,
|
|
10272
|
+
path: event._path,
|
|
10273
|
+
tags: event.tags
|
|
10274
|
+
},
|
|
10275
|
+
locations: strategy(event.operation).map((path) => ({
|
|
10276
|
+
path,
|
|
10277
|
+
shell
|
|
10278
|
+
})),
|
|
10279
|
+
source
|
|
10280
|
+
});
|
|
10281
|
+
}, { order: "declarations" });
|
|
10282
|
+
const allNodes = [];
|
|
10283
|
+
for (const node of structure.walk()) {
|
|
10284
|
+
const { nodes } = toNode$1(node, plugin, baseSymbol);
|
|
10285
|
+
allNodes.push(...nodes);
|
|
10286
|
+
}
|
|
10287
|
+
for (const node of allNodes) plugin.node(node);
|
|
10288
|
+
};
|
|
10289
|
+
|
|
10290
|
+
//#endregion
|
|
10291
|
+
//#region src/plugins/orpc/plugin.ts
|
|
10292
|
+
const handler$3 = (args) => handlerV1$1(args);
|
|
10293
|
+
|
|
10294
|
+
//#endregion
|
|
10295
|
+
//#region src/plugins/orpc/config.ts
|
|
10296
|
+
const validatorInferWarn = "You set `validator: true` but no validator plugin was found in your plugins. Add a validator plugin like `zod` to enable this feature. The validator option has been disabled.";
|
|
10297
|
+
const defaultConfig$3 = {
|
|
10298
|
+
config: { includeInEntry: false },
|
|
10299
|
+
handler: handler$3,
|
|
10300
|
+
name: "orpc",
|
|
10301
|
+
resolveConfig: (plugin, context) => {
|
|
10302
|
+
if (typeof plugin.config.validator !== "object") plugin.config.validator = {
|
|
10303
|
+
input: plugin.config.validator,
|
|
10304
|
+
output: plugin.config.validator
|
|
10305
|
+
};
|
|
10306
|
+
if (plugin.config.validator.input || plugin.config.validator.input === void 0) if (typeof plugin.config.validator.input === "boolean" || plugin.config.validator.input === void 0) try {
|
|
10307
|
+
plugin.config.validator.input = context.pluginByTag("validator");
|
|
10308
|
+
plugin.dependencies.add(plugin.config.validator.input);
|
|
10309
|
+
} catch {
|
|
10310
|
+
if (plugin.config.validator.input !== void 0) log.warn(validatorInferWarn);
|
|
10311
|
+
plugin.config.validator.input = false;
|
|
10312
|
+
}
|
|
10313
|
+
else plugin.dependencies.add(plugin.config.validator.input);
|
|
10314
|
+
else plugin.config.validator.input = false;
|
|
10315
|
+
if (plugin.config.validator.output || plugin.config.validator.output === void 0) if (typeof plugin.config.validator.output === "boolean" || plugin.config.validator.output === void 0) try {
|
|
10316
|
+
plugin.config.validator.output = context.pluginByTag("validator");
|
|
10317
|
+
plugin.dependencies.add(plugin.config.validator.output);
|
|
10318
|
+
} catch {
|
|
10319
|
+
if (plugin.config.validator.output !== void 0) log.warn(validatorInferWarn);
|
|
10320
|
+
plugin.config.validator.output = false;
|
|
10321
|
+
}
|
|
10322
|
+
else plugin.dependencies.add(plugin.config.validator.output);
|
|
10323
|
+
else plugin.config.validator.output = false;
|
|
10324
|
+
plugin.config.contracts = resolveContracts(plugin.config, context);
|
|
10325
|
+
}
|
|
10326
|
+
};
|
|
10327
|
+
/**
|
|
10328
|
+
* Type helper for oRPC plugin, returns {@link Plugin.Config} object
|
|
10329
|
+
*/
|
|
10022
10330
|
const defineConfig$3 = definePluginConfig(defaultConfig$3);
|
|
10023
10331
|
|
|
10024
10332
|
//#endregion
|
|
@@ -15705,29 +16013,30 @@ const defineConfig = definePluginConfig(defaultConfig);
|
|
|
15705
16013
|
//#endregion
|
|
15706
16014
|
//#region src/plugins/config.ts
|
|
15707
16015
|
const defaultPluginConfigs = {
|
|
15708
|
-
"@angular/common": defaultConfig$
|
|
15709
|
-
"@faker-js/faker": defaultConfig$
|
|
15710
|
-
"@hey-api/client-angular": defaultConfig$
|
|
15711
|
-
"@hey-api/client-axios": defaultConfig$
|
|
15712
|
-
"@hey-api/client-fetch": defaultConfig$
|
|
15713
|
-
"@hey-api/client-ky": defaultConfig$
|
|
15714
|
-
"@hey-api/client-next": defaultConfig$
|
|
15715
|
-
"@hey-api/client-nuxt": defaultConfig$
|
|
15716
|
-
"@hey-api/client-ofetch": defaultConfig$
|
|
15717
|
-
"@hey-api/schemas": defaultConfig$
|
|
15718
|
-
"@hey-api/sdk": defaultConfig$
|
|
15719
|
-
"@hey-api/transformers": defaultConfig$
|
|
15720
|
-
"@hey-api/typescript": defaultConfig$
|
|
15721
|
-
"@pinia/colada": defaultConfig$
|
|
15722
|
-
"@tanstack/angular-query-experimental": defaultConfig$
|
|
15723
|
-
"@tanstack/preact-query": defaultConfig$
|
|
15724
|
-
"@tanstack/react-query": defaultConfig$
|
|
15725
|
-
"@tanstack/solid-query": defaultConfig$
|
|
15726
|
-
"@tanstack/svelte-query": defaultConfig$
|
|
15727
|
-
"@tanstack/vue-query": defaultConfig$
|
|
15728
|
-
arktype: defaultConfig$
|
|
15729
|
-
fastify: defaultConfig$
|
|
15730
|
-
nestjs: defaultConfig$
|
|
16016
|
+
"@angular/common": defaultConfig$26,
|
|
16017
|
+
"@faker-js/faker": defaultConfig$25,
|
|
16018
|
+
"@hey-api/client-angular": defaultConfig$24,
|
|
16019
|
+
"@hey-api/client-axios": defaultConfig$23,
|
|
16020
|
+
"@hey-api/client-fetch": defaultConfig$22,
|
|
16021
|
+
"@hey-api/client-ky": defaultConfig$21,
|
|
16022
|
+
"@hey-api/client-next": defaultConfig$20,
|
|
16023
|
+
"@hey-api/client-nuxt": defaultConfig$19,
|
|
16024
|
+
"@hey-api/client-ofetch": defaultConfig$18,
|
|
16025
|
+
"@hey-api/schemas": defaultConfig$17,
|
|
16026
|
+
"@hey-api/sdk": defaultConfig$16,
|
|
16027
|
+
"@hey-api/transformers": defaultConfig$15,
|
|
16028
|
+
"@hey-api/typescript": defaultConfig$14,
|
|
16029
|
+
"@pinia/colada": defaultConfig$13,
|
|
16030
|
+
"@tanstack/angular-query-experimental": defaultConfig$12,
|
|
16031
|
+
"@tanstack/preact-query": defaultConfig$11,
|
|
16032
|
+
"@tanstack/react-query": defaultConfig$10,
|
|
16033
|
+
"@tanstack/solid-query": defaultConfig$9,
|
|
16034
|
+
"@tanstack/svelte-query": defaultConfig$8,
|
|
16035
|
+
"@tanstack/vue-query": defaultConfig$7,
|
|
16036
|
+
arktype: defaultConfig$6,
|
|
16037
|
+
fastify: defaultConfig$5,
|
|
16038
|
+
nestjs: defaultConfig$4,
|
|
16039
|
+
orpc: defaultConfig$3,
|
|
15731
16040
|
swr: defaultConfig$2,
|
|
15732
16041
|
valibot: defaultConfig$1,
|
|
15733
16042
|
zod: defaultConfig
|
|
@@ -15912,4 +16221,4 @@ async function resolveJobs({ logger, userConfigs }) {
|
|
|
15912
16221
|
|
|
15913
16222
|
//#endregion
|
|
15914
16223
|
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 };
|
|
15915
|
-
//# sourceMappingURL=init-
|
|
16224
|
+
//# sourceMappingURL=init-B4xCXgH4.mjs.map
|