@hey-api/openapi-ts 0.78.1 → 0.78.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,348 @@
1
- import { P as PluginHandler, a as Plugin, S as StringCase, U as UserConfig, C as Client, I as IR } from './types.d-DtZlpeRE.js';
2
- export { h as Client, D as DefinePlugin, L as LegacyIR, O as OpenApi, b as OpenApiMetaObject, c as OpenApiOperationObject, d as OpenApiParameterObject, e as OpenApiRequestBodyObject, f as OpenApiResponseObject, g as OpenApiSchemaObject } from './types.d-DtZlpeRE.js';
1
+ import { C as Comments, I as ImportExportItemObject, t as tsNodeToString, s as stringToTsNodes, P as PluginHandler, a as Plugin, S as StringCase, U as UserConfig, b as Client, c as IR } from './types.d-CaH9PF-K.js';
2
+ export { j as Client, D as DefinePlugin, E as ExpressionTransformer, L as LegacyIR, O as OpenApi, d as OpenApiMetaObject, e as OpenApiOperationObject, f as OpenApiParameterObject, g as OpenApiRequestBodyObject, h as OpenApiResponseObject, i as OpenApiSchemaObject } from './types.d-CaH9PF-K.js';
3
+ import * as ts from 'typescript';
4
+ import ts__default from 'typescript';
3
5
  import 'node:fs';
4
- import 'typescript';
6
+
7
+ type AccessLevel = 'private' | 'protected' | 'public';
8
+ type FunctionParameter = {
9
+ accessLevel?: AccessLevel;
10
+ default?: any;
11
+ isReadOnly?: boolean;
12
+ isRequired?: boolean;
13
+ name: string;
14
+ type?: any | ts__default.TypeNode;
15
+ } | {
16
+ destructure: ReadonlyArray<FunctionParameter>;
17
+ type?: any | ts__default.TypeNode;
18
+ };
19
+ interface FunctionTypeParameter {
20
+ default?: any;
21
+ extends?: string | ts__default.TypeNode;
22
+ name: string | ts__default.Identifier;
23
+ }
24
+ type SyntaxKindKeyword = 'any' | 'async' | 'boolean' | 'export' | 'never' | 'number' | 'private' | 'protected' | 'public' | 'readonly' | 'static' | 'string' | 'undefined' | 'unknown' | 'void';
25
+ type ObjectValue = {
26
+ assertion?: 'any' | ts__default.TypeNode;
27
+ comments?: Comments;
28
+ spread: string;
29
+ } | {
30
+ comments?: Comments;
31
+ isValueAccess?: boolean;
32
+ key: string;
33
+ shorthand?: boolean;
34
+ value: any;
35
+ };
36
+
37
+ type ImportExportItem = ImportExportItemObject | string;
38
+
39
+ type Property = {
40
+ comment?: Comments;
41
+ isReadOnly?: boolean;
42
+ isRequired?: boolean;
43
+ name: string | ts__default.PropertyName;
44
+ type: any | ts__default.TypeNode;
45
+ };
46
+
47
+ declare const compiler: {
48
+ anonymousFunction: ({ async, comment, multiLine, parameters, returnType, statements, types, }: {
49
+ async?: boolean;
50
+ comment?: Comments;
51
+ multiLine?: boolean;
52
+ parameters?: FunctionParameter[];
53
+ returnType?: string | ts.TypeNode;
54
+ statements?: ts.Statement[];
55
+ types?: FunctionTypeParameter[];
56
+ }) => ts.FunctionExpression;
57
+ arrayLiteralExpression: <T>({ elements, multiLine, }: {
58
+ elements: T[];
59
+ multiLine?: boolean;
60
+ }) => ts.ArrayLiteralExpression;
61
+ arrowFunction: ({ async, comment, multiLine, parameters, returnType, statements, types, }: {
62
+ async?: boolean;
63
+ comment?: Comments;
64
+ multiLine?: boolean;
65
+ parameters?: ReadonlyArray<FunctionParameter>;
66
+ returnType?: string | ts.TypeNode;
67
+ statements?: ts.Statement[] | ts.Expression;
68
+ types?: FunctionTypeParameter[];
69
+ }) => ts.ArrowFunction;
70
+ asExpression: ({ expression, type, }: {
71
+ expression: ts.Expression;
72
+ type: ts.TypeNode;
73
+ }) => ts.AsExpression;
74
+ assignment: ({ left, right, }: {
75
+ left: ts.Expression;
76
+ right: ts.Expression;
77
+ }) => ts.AssignmentExpression<ts.EqualsToken>;
78
+ awaitExpression: ({ expression, }: {
79
+ expression: ts.Expression;
80
+ }) => ts.AwaitExpression;
81
+ binaryExpression: ({ left, operator, right, }: {
82
+ left: ts.Expression;
83
+ operator?: "=" | "===" | "in" | "??";
84
+ right: ts.Expression | string;
85
+ }) => ts.BinaryExpression;
86
+ block: ({ multiLine, statements, }: {
87
+ multiLine?: boolean;
88
+ statements: Array<ts.Statement>;
89
+ }) => ts.Block;
90
+ callExpression: ({ functionName, parameters, types, }: {
91
+ functionName: string | ts.PropertyAccessExpression | ts.PropertyAccessChain | ts.ElementAccessExpression | ts.Expression;
92
+ parameters?: Array<string | ts.Expression | undefined>;
93
+ types?: ReadonlyArray<ts.TypeNode>;
94
+ }) => ts.CallExpression;
95
+ classDeclaration: ({ decorator, exportClass, extendedClasses, name, nodes, }: {
96
+ decorator?: {
97
+ args: any[];
98
+ name: string;
99
+ };
100
+ exportClass?: boolean;
101
+ extendedClasses?: ReadonlyArray<string>;
102
+ name: string;
103
+ nodes: ReadonlyArray<ts.ClassElement>;
104
+ }) => ts.ClassDeclaration;
105
+ conditionalExpression: ({ condition, whenFalse, whenTrue, }: {
106
+ condition: ts.Expression;
107
+ whenFalse: ts.Expression;
108
+ whenTrue: ts.Expression;
109
+ }) => ts.ConditionalExpression;
110
+ constVariable: ({ assertion, comment, destructure, exportConst, expression, name, typeName, }: {
111
+ assertion?: "const" | ts.TypeNode;
112
+ comment?: Comments;
113
+ destructure?: boolean;
114
+ exportConst?: boolean;
115
+ expression: ts.Expression;
116
+ name: string;
117
+ typeName?: string | ts.IndexedAccessTypeNode | ts.TypeNode;
118
+ }) => ts.VariableStatement;
119
+ constructorDeclaration: ({ accessLevel, comment, multiLine, parameters, statements, }: {
120
+ accessLevel?: AccessLevel;
121
+ comment?: Comments;
122
+ multiLine?: boolean;
123
+ parameters?: FunctionParameter[];
124
+ statements?: ts.Statement[];
125
+ }) => ts.ConstructorDeclaration;
126
+ enumDeclaration: <T extends Record<string, any> | Array<ObjectValue>>({ comments: enumMemberComments, leadingComment: comments, name, obj, }: {
127
+ comments?: Record<string | number, Comments>;
128
+ leadingComment?: Comments;
129
+ name: string;
130
+ obj: T;
131
+ }) => ts.EnumDeclaration;
132
+ exportAllDeclaration: ({ module, }: {
133
+ module: string;
134
+ }) => ts.ExportDeclaration;
135
+ exportNamedDeclaration: ({ exports, module, }: {
136
+ exports: Array<ImportExportItem> | ImportExportItem;
137
+ module: string;
138
+ }) => ts.ExportDeclaration;
139
+ expressionToStatement: ({ expression, }: {
140
+ expression: ts.Expression;
141
+ }) => ts.ExpressionStatement;
142
+ forOfStatement: ({ awaitModifier, expression, initializer, statement, }: {
143
+ awaitModifier?: ts.AwaitKeyword;
144
+ expression: ts.Expression;
145
+ initializer: ts.ForInitializer;
146
+ statement: ts.Statement;
147
+ }) => ts.ForOfStatement;
148
+ functionTypeNode: ({ parameters, returnType, typeParameters, }: {
149
+ parameters?: ts.ParameterDeclaration[];
150
+ returnType: ts.TypeNode;
151
+ typeParameters?: ts.TypeParameterDeclaration[];
152
+ }) => ts.FunctionTypeNode;
153
+ identifier: ({ text }: {
154
+ text: string;
155
+ }) => ts.Identifier;
156
+ ifStatement: ({ elseStatement, expression, thenStatement, }: {
157
+ elseStatement?: ts.Statement;
158
+ expression: ts.Expression;
159
+ thenStatement: ts.Statement;
160
+ }) => ts.IfStatement;
161
+ indexedAccessTypeNode: ({ indexType, objectType, }: {
162
+ indexType: ts.TypeNode;
163
+ objectType: ts.TypeNode;
164
+ }) => ts.IndexedAccessTypeNode;
165
+ isTsNode: (node: any) => node is ts.Expression;
166
+ keywordTypeNode: ({ keyword, }: {
167
+ keyword: Extract<SyntaxKindKeyword, "any" | "boolean" | "never" | "number" | "string" | "undefined" | "unknown" | "void">;
168
+ }) => ts.KeywordTypeNode<ts.SyntaxKind.VoidKeyword | ts.SyntaxKind.AnyKeyword | ts.SyntaxKind.BooleanKeyword | ts.SyntaxKind.NeverKeyword | ts.SyntaxKind.NumberKeyword | ts.SyntaxKind.StringKeyword | ts.SyntaxKind.UndefinedKeyword | ts.SyntaxKind.UnknownKeyword>;
169
+ literalTypeNode: ({ literal, }: {
170
+ literal: ts.LiteralTypeNode["literal"];
171
+ }) => ts.LiteralTypeNode;
172
+ mappedTypeNode: ({ members, nameType, questionToken, readonlyToken, type, typeParameter, }: {
173
+ members?: ts.NodeArray<ts.TypeElement>;
174
+ nameType?: ts.TypeNode;
175
+ questionToken?: ts.QuestionToken | ts.PlusToken | ts.MinusToken;
176
+ readonlyToken?: ts.ReadonlyKeyword | ts.PlusToken | ts.MinusToken;
177
+ type?: ts.TypeNode;
178
+ typeParameter: ts.TypeParameterDeclaration;
179
+ }) => ts.MappedTypeNode;
180
+ methodDeclaration: ({ accessLevel, comment, isStatic, multiLine, name, parameters, returnType, statements, types, }: {
181
+ accessLevel?: AccessLevel;
182
+ comment?: Comments;
183
+ isStatic?: boolean;
184
+ multiLine?: boolean;
185
+ name: string;
186
+ parameters?: ReadonlyArray<FunctionParameter>;
187
+ returnType?: string | ts.TypeNode;
188
+ statements?: ts.Statement[];
189
+ types?: FunctionTypeParameter[];
190
+ }) => ts.MethodDeclaration;
191
+ namedImportDeclarations: ({ imports, module, }: {
192
+ imports: Array<ImportExportItem> | ImportExportItem;
193
+ module: string;
194
+ }) => ts.ImportDeclaration;
195
+ namespaceDeclaration: ({ name, statements, }: {
196
+ name: string;
197
+ statements: Array<ts.Statement>;
198
+ }) => ts.ModuleDeclaration;
199
+ newExpression: ({ argumentsArray, expression, typeArguments, }: {
200
+ argumentsArray?: Array<ts.Expression>;
201
+ expression: ts.Expression;
202
+ typeArguments?: Array<ts.TypeNode>;
203
+ }) => ts.NewExpression;
204
+ nodeToString: typeof tsNodeToString;
205
+ null: () => ts.NullLiteral;
206
+ objectExpression: <T extends Record<string, any> | Array<ObjectValue>>({ comments, identifiers, multiLine, obj, shorthand, unescape, }: {
207
+ comments?: Comments;
208
+ identifiers?: string[];
209
+ multiLine?: boolean;
210
+ obj: T;
211
+ shorthand?: boolean;
212
+ unescape?: boolean;
213
+ }) => ts.ObjectLiteralExpression;
214
+ ots: {
215
+ boolean: (value: boolean) => ts.TrueLiteral | ts.FalseLiteral;
216
+ export: ({ alias, asType, name }: ImportExportItemObject) => ts.ExportSpecifier;
217
+ import: ({ alias, asType, name }: ImportExportItemObject) => ts.ImportSpecifier;
218
+ number: (value: number) => ts.NumericLiteral | ts.PrefixUnaryExpression;
219
+ string: (value: string, unescape?: boolean) => ts.Identifier | ts.StringLiteral;
220
+ };
221
+ parameterDeclaration: ({ initializer, modifiers, name, required, type, }: {
222
+ initializer?: ts.Expression;
223
+ modifiers?: ReadonlyArray<ts.ModifierLike>;
224
+ name: string | ts.BindingName;
225
+ required?: boolean;
226
+ type?: ts.TypeNode;
227
+ }) => ts.ParameterDeclaration;
228
+ propertyAccessExpression: ({ expression, isOptional, name, }: {
229
+ expression: string | ts.Expression;
230
+ isOptional?: boolean;
231
+ name: string | number | ts.MemberName;
232
+ }) => ts.PropertyAccessChain | ts.PropertyAccessExpression | ts.ElementAccessExpression;
233
+ propertyAccessExpressions: ({ expressions, }: {
234
+ expressions: Array<string | ts.Expression | ts.MemberName>;
235
+ }) => ts.PropertyAccessExpression;
236
+ propertyAssignment: ({ initializer, name, }: {
237
+ initializer: ts.Expression;
238
+ name: string | ts.PropertyName;
239
+ }) => ts.PropertyAssignment;
240
+ propertyDeclaration: ({ initializer, modifier, name, type, }: {
241
+ initializer?: ts.Expression;
242
+ modifier?: AccessLevel | "async" | "export" | "readonly" | "static";
243
+ name: string | ts.PropertyName;
244
+ type?: ts.TypeNode;
245
+ }) => ts.PropertyDeclaration;
246
+ regularExpressionLiteral: ({ flags, text, }: {
247
+ flags?: ReadonlyArray<"g" | "i" | "m" | "s" | "u" | "y">;
248
+ text: string;
249
+ }) => ts.RegularExpressionLiteral;
250
+ returnFunctionCall: ({ args, name, types, }: {
251
+ args: any[];
252
+ name: string | ts.Expression;
253
+ types?: ReadonlyArray<string | ts.StringLiteral>;
254
+ }) => ts.ReturnStatement;
255
+ returnStatement: ({ expression, }: {
256
+ expression?: ts.Expression;
257
+ }) => ts.ReturnStatement;
258
+ returnVariable: ({ expression, }: {
259
+ expression: string | ts.Expression;
260
+ }) => ts.ReturnStatement;
261
+ safeAccessExpression: (path: string[]) => ts.Expression;
262
+ stringLiteral: ({ isSingleQuote, text, }: {
263
+ isSingleQuote?: boolean;
264
+ text: string;
265
+ }) => ts.StringLiteral;
266
+ stringToTsNodes: typeof stringToTsNodes;
267
+ templateLiteralType: ({ value, }: {
268
+ value: ReadonlyArray<string | ts.TypeNode>;
269
+ }) => ts.TemplateLiteralTypeNode;
270
+ this: () => ts.ThisExpression;
271
+ transformArrayMap: ({ path, transformExpression, }: {
272
+ path: string[];
273
+ transformExpression: ts.Expression;
274
+ }) => ts.IfStatement;
275
+ transformArrayMutation: ({ path, transformerName, }: {
276
+ path: string[];
277
+ transformerName: string;
278
+ }) => ts.Statement;
279
+ transformDateMutation: ({ path, }: {
280
+ path: string[];
281
+ }) => ts.Statement;
282
+ transformFunctionMutation: ({ path, transformerName, }: {
283
+ path: string[];
284
+ transformerName: string;
285
+ }) => ts.IfStatement[];
286
+ transformNewDate: ({ parameterName, }: {
287
+ parameterName: string;
288
+ }) => ts.NewExpression;
289
+ typeAliasDeclaration: ({ comment, exportType, name, type, typeParameters, }: {
290
+ comment?: Comments;
291
+ exportType?: boolean;
292
+ name: string;
293
+ type: string | ts.TypeNode;
294
+ typeParameters?: FunctionTypeParameter[];
295
+ }) => ts.TypeAliasDeclaration;
296
+ typeArrayNode: (types: (any | ts.TypeNode)[] | ts.TypeNode | string, isNullable?: boolean) => ts.TypeNode;
297
+ typeInterfaceNode: ({ indexKey, indexProperty, isNullable, properties, useLegacyResolution, }: {
298
+ indexKey?: string;
299
+ indexProperty?: Property;
300
+ isNullable?: boolean;
301
+ properties: Property[];
302
+ useLegacyResolution: boolean;
303
+ }) => ts.TypeNode;
304
+ typeIntersectionNode: ({ isNullable, types, }: {
305
+ isNullable?: boolean;
306
+ types: (any | ts.TypeNode)[];
307
+ }) => ts.TypeNode;
308
+ typeNode: (base: any | ts.TypeNode, args?: (any | ts.TypeNode)[]) => ts.TypeNode;
309
+ typeOfExpression: ({ text }: {
310
+ text: string;
311
+ }) => ts.TypeOfExpression;
312
+ typeOperatorNode: ({ operator, type, }: {
313
+ operator: "keyof" | "readonly" | "unique";
314
+ type: ts.TypeNode;
315
+ }) => ts.TypeOperatorNode;
316
+ typeParameterDeclaration: ({ constraint, defaultType, modifiers, name, }: {
317
+ constraint?: ts.TypeNode;
318
+ defaultType?: ts.TypeNode;
319
+ modifiers?: Array<ts.Modifier>;
320
+ name: string | ts.Identifier;
321
+ }) => ts.TypeParameterDeclaration;
322
+ typeParenthesizedNode: ({ type, }: {
323
+ type: ts.TypeNode;
324
+ }) => ts.ParenthesizedTypeNode;
325
+ typeRecordNode: (keys: (any | ts.TypeNode)[], values: (any | ts.TypeNode)[], isNullable?: boolean, useLegacyResolution?: boolean) => ts.TypeNode;
326
+ typeReferenceNode: ({ typeArguments, typeName, }: {
327
+ typeArguments?: ts.TypeNode[];
328
+ typeName: string | ts.EntityName;
329
+ }) => ts.TypeReferenceNode;
330
+ typeTupleNode: ({ isNullable, types, }: {
331
+ isNullable?: boolean;
332
+ types: Array<any | ts.TypeNode>;
333
+ }) => ts.TypeNode;
334
+ typeUnionNode: ({ isNullable, types, }: {
335
+ isNullable?: boolean;
336
+ types: (any | ts.TypeNode)[];
337
+ }) => ts.TypeNode;
338
+ valueToExpression: <T = unknown>({ identifiers, isValueAccess, shorthand, unescape, value, }: {
339
+ identifiers?: string[];
340
+ isValueAccess?: boolean;
341
+ shorthand?: boolean;
342
+ unescape?: boolean;
343
+ value: T;
344
+ }) => ts.Expression | undefined;
345
+ };
5
346
 
6
347
  declare const defaultPaginationKeywords: readonly ["after", "before", "cursor", "offset", "page", "start"];
7
348
 
@@ -53,4 +394,4 @@ declare const createClient: (userConfig?: Configs) => Promise<ReadonlyArray<Clie
53
394
  */
54
395
  declare const defineConfig: (config: Configs) => Promise<UserConfig>;
55
396
 
56
- export { IR, Plugin, UserConfig, clientDefaultConfig, clientDefaultMeta, clientPluginHandler, createClient, defaultPaginationKeywords, defaultPlugins, defineConfig, definePluginConfig, utils };
397
+ export { IR, Plugin, UserConfig, clientDefaultConfig, clientDefaultMeta, clientPluginHandler, compiler, createClient, defaultPaginationKeywords, defaultPlugins, defineConfig, definePluginConfig, utils };
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import {createRequire}from'module';import {b,a,c,q,H,h,v,x as x$1,y,w,I,f,g,F as F$1,E,e,A,o,u,t,d,p as p$1,m as m$1,s,B,C,D,n,z}from'./chunk-4AJU36PO.js';export{k as clientDefaultConfig,l as clientDefaultMeta,r as clientPluginHandler,i as defaultPaginationKeywords,G as defaultPlugins,j as definePluginConfig}from'./chunk-4AJU36PO.js';import x from'ansi-colors';import lr from'color-support';import R from'node:path';import v$1 from'node:fs';import Ct from'typescript';import p from'handlebars';createRequire(import.meta.url);
1
+ import {createRequire}from'module';import {b,a,c,q,H,h,v,x,y,w,I,f,g,F as F$1,E,e,A,o,u,t,d,p as p$1,m as m$1,s,B,C as C$1,D,n,z}from'./chunk-YJGQGZQU.js';export{k as clientDefaultConfig,l as clientDefaultMeta,r as clientPluginHandler,m as compiler,i as defaultPaginationKeywords,G as defaultPlugins,j as definePluginConfig}from'./chunk-YJGQGZQU.js';import C from'ansi-colors';import lr from'color-support';import R from'node:path';import v$1 from'node:fs';import Ct from'typescript';import p from'handlebars';createRequire(import.meta.url);
2
2
  var Se=b((Xr,Ee)=>{Ee.exports=we;we.sync=qt;var ke=a("fs");function bt(e,n){var o=n.pathExt!==void 0?n.pathExt:process.env.PATHEXT;if(!o||(o=o.split(";"),o.indexOf("")!==-1))return true;for(var r=0;r<o.length;r++){var t=o[r].toLowerCase();if(t&&e.substr(-t.length).toLowerCase()===t)return true}return false}function Oe(e,n,o){return !e.isSymbolicLink()&&!e.isFile()?false:bt(n,o)}function we(e,n,o){ke.stat(e,function(r,t){o(r,r?false:Oe(t,e,n));});}function qt(e,n){return Oe(ke.statSync(e),e,n)}});var je=b((Qr,Be)=>{Be.exports=De;De.sync=At;var He=a("fs");function De(e,n,o){He.stat(e,function(r,t){o(r,r?false:Ie(t,n));});}function At(e,n){return Ie(He.statSync(e),n)}function Ie(e,n){return e.isFile()&&Tt(e,n)}function Tt(e,n){var o=e.mode,r=e.uid,t=e.gid,s=n.uid!==void 0?n.uid:process.getuid&&process.getuid(),a=n.gid!==void 0?n.gid:process.getgid&&process.getgid(),i=parseInt("100",8),u=parseInt("010",8),l=parseInt("001",8),c=i|u,f=o&l||o&u&&t===a||o&i&&r===s||o&c&&s===0;return f}});var Ne=b((Yr,$e)=>{a("fs");var _;process.platform==="win32"||global.TESTING_WINDOWS?_=Se():_=je();$e.exports=V;V.sync=kt;function V(e,n,o){if(typeof n=="function"&&(o=n,n={}),!o){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,t){V(e,n||{},function(s,a){s?t(s):r(a);});})}_(e,n||{},function(r,t){r&&(r.code==="EACCES"||n&&n.ignoreErrors)&&(r=null,t=false),o(r,t);});}function kt(e,n){try{return _.sync(e,n||{})}catch(o){if(n&&n.ignoreErrors||o.code==="EACCES")return false;throw o}}});var Ve=b((Zr,Ue)=>{var w=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Fe=a("path"),Ot=w?";":":",_e=Ne(),Le=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Me=(e,n)=>{let o=n.colon||Ot,r=e.match(/\//)||w&&e.match(/\\/)?[""]:[...w?[process.cwd()]:[],...(n.path||process.env.PATH||"").split(o)],t=w?n.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=w?t.split(o):[""];return w&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:r,pathExt:s,pathExtExe:t}},We=(e,n,o)=>{typeof n=="function"&&(o=n,n={}),n||(n={});let{pathEnv:r,pathExt:t,pathExtExe:s}=Me(e,n),a=[],i=l=>new Promise((c,f)=>{if(l===r.length)return n.all&&a.length?c(a):f(Le(e));let d=r[l],A=/^".*"$/.test(d)?d.slice(1,-1):d,q=Fe.join(A,e),k=!A&&/^\.[\\\/]/.test(e)?e.slice(0,2)+q:q;c(u(k,l,0));}),u=(l,c,f)=>new Promise((d,A)=>{if(f===t.length)return d(i(c+1));let q=t[f];_e(l+q,{pathExt:s},(k,H)=>{if(!k&&H)if(n.all)a.push(l+q);else return d(l+q);return d(u(l,c,f+1))});});return o?i(0).then(l=>o(null,l),o):i(0)},wt=(e,n)=>{n=n||{};let{pathEnv:o,pathExt:r,pathExtExe:t}=Me(e,n),s=[];for(let a=0;a<o.length;a++){let i=o[a],u=/^".*"$/.test(i)?i.slice(1,-1):i,l=Fe.join(u,e),c=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let f=0;f<r.length;f++){let d=c+r[f];try{if(_e.sync(d,{pathExt:t}))if(n.all)s.push(d);else return d}catch{}}}if(n.all&&s.length)return s;if(n.nothrow)return null;throw Le(e)};Ue.exports=We;We.sync=wt;});var ze=b((eo,G)=>{var Ge=(e={})=>{let n=e.env||process.env;return (e.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};G.exports=Ge;G.exports.default=Ge;});var Je=b((no,Qe)=>{var Ke=a("path"),Et=Ve(),St=ze();function Xe(e,n){let o=e.options.env||process.env,r=process.cwd(),t=e.options.cwd!=null,s=t&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd);}catch{}let a;try{a=Et.sync(e.command,{path:o[St({env:o})],pathExt:n?Ke.delimiter:void 0});}catch{}finally{s&&process.chdir(r);}return a&&(a=Ke.resolve(t?e.options.cwd:"",a)),a}function Ht(e){return Xe(e)||Xe(e,true)}Qe.exports=Ht;});var Ye=b((to,K)=>{var z=/([()\][%!^"`<>&|;, *?])/g;function Dt(e){return e=e.replace(z,"^$1"),e}function It(e,n){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(z,"^$1"),n&&(e=e.replace(z,"^$1")),e}K.exports.command=Dt;K.exports.argument=It;});var en=b((ro,Ze)=>{Ze.exports=/^#!(.*)/;});var tn=b((oo,nn)=>{var Bt=en();nn.exports=(e="")=>{let n=e.match(Bt);if(!n)return null;let[o,r]=n[0].replace(/#! ?/,"").split(" "),t=o.split("/").pop();return t==="env"?r:r?`${t} ${r}`:t};});var on=b((so,rn)=>{var X=a("fs"),jt=tn();function $t(e){let o=Buffer.alloc(150),r;try{r=X.openSync(e,"r"),X.readSync(r,o,0,150,0),X.closeSync(r);}catch{}return jt(o.toString())}rn.exports=$t;});var un=b((io,ln)=>{var Nt=a("path"),sn=Je(),an=Ye(),Ft=on(),_t=process.platform==="win32",Lt=/\.(?:com|exe)$/i,Mt=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Wt(e){e.file=sn(e);let n=e.file&&Ft(e.file);return n?(e.args.unshift(e.file),e.command=n,sn(e)):e.file}function Ut(e){if(!_t)return e;let n=Wt(e),o=!Lt.test(n);if(e.options.forceShell||o){let r=Mt.test(n);e.command=Nt.normalize(e.command),e.command=an.command(e.command),e.args=e.args.map(s=>an.argument(s,r));let t=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${t}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=true;}return e}function Vt(e,n,o){n&&!Array.isArray(n)&&(o=n,n=null),n=n?n.slice(0):[],o=Object.assign({},o);let r={command:e,args:n,options:o,file:void 0,original:{command:e,args:n}};return o.shell?r:Ut(r)}ln.exports=Vt;});var fn=b((ao,cn)=>{var Q=process.platform==="win32";function J(e,n){return Object.assign(new Error(`${n} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${n} ${e.command}`,path:e.command,spawnargs:e.args})}function Gt(e,n){if(!Q)return;let o=e.emit;e.emit=function(r,t){if(r==="exit"){let s=pn(t,n);if(s)return o.call(e,"error",s)}return o.apply(e,arguments)};}function pn(e,n){return Q&&e===1&&!n.file?J(n.original,"spawn"):null}function zt(e,n){return Q&&e===1&&!n.file?J(n.original,"spawnSync"):null}cn.exports={hookChildProcess:Gt,verifyENOENT:pn,verifyENOENTSync:zt,notFoundError:J};});var gn=b((lo,E)=>{var mn=a("child_process"),Y=un(),Z=fn();function dn(e,n,o){let r=Y(e,n,o),t=mn.spawn(r.command,r.args,r.options);return Z.hookChildProcess(t,r),t}function Kt(e,n,o){let r=Y(e,n,o),t=mn.spawnSync(r.command,r.args,r.options);return t.error=t.error||Z.verifyENOENTSync(t.status,r),t}E.exports=dn;E.exports.spawn=dn;E.exports.sync=Kt;E.exports._parse=Y;E.exports._enoent=Z;});var F=e=>{switch(e){case "legacy/angular":return "AngularHttpRequest";case "legacy/axios":return "AxiosHttpRequest";case "legacy/fetch":return "FetchHttpRequest";case "legacy/node":return "NodeHttpRequest";case "legacy/xhr":return "XHRHttpRequest";default:return ""}};var xe=async(e$1,n$1,o,r)=>{let t=e(),s=d(t),a=r.client({$config:t,...o,httpRequest:F(s.name),models:D(o.models),services:D(o.services)});g(t)&&(n(n$1),v$1.writeFileSync(R.resolve(n$1,`${g(t)}.ts`),a));};var Ce=async(e$1,n,o)=>{let r=e();if(r.exportCore){let t=d(r),s={httpRequest:F(t.name),server:r.base!==void 0?r.base:n.server,version:n.version};if(v$1.rmSync(R.resolve(e$1),{force:true,recursive:true}),v$1.mkdirSync(R.resolve(e$1),{recursive:true}),await v$1.writeFileSync(R.resolve(e$1,"OpenAPI.ts"),o.core.settings({$config:r,...s})),await v$1.writeFileSync(R.resolve(e$1,"ApiError.ts"),o.core.apiError({$config:r,...s})),await v$1.writeFileSync(R.resolve(e$1,"ApiRequestOptions.ts"),o.core.apiRequestOptions({$config:r,...s})),await v$1.writeFileSync(R.resolve(e$1,"ApiResult.ts"),o.core.apiResult({$config:r,...s})),t.name!=="legacy/angular"&&await v$1.writeFileSync(R.resolve(e$1,"CancelablePromise.ts"),o.core.cancelablePromise({$config:r,...s})),await v$1.writeFileSync(R.resolve(e$1,"request.ts"),o.core.request({$config:r,...s})),g(r)&&(await v$1.writeFileSync(R.resolve(e$1,"BaseHttpRequest.ts"),o.core.baseHttpRequest({$config:r,...s})),await v$1.writeFileSync(R.resolve(e$1,`${s.httpRequest}.ts`),o.core.httpRequest({$config:r,...s}))),r.request){let a=R.resolve(process.cwd(),r.request);if(!await v$1.existsSync(a))throw new Error(`Custom request file "${a}" does not exists`);await v$1.copyFileSync(a,R.resolve(e$1,"request.ts"));}}};var be=({files:e$1})=>{let n=e();e$1.index=new s({dir:n.output.path,id:"index",name:"index.ts"}),g(n)&&e$1.index.add(m$1.exportNamedDeclaration({exports:g(n),module:`./${g(n)}`})),n.exportCore&&(e$1.index.add(m$1.exportNamedDeclaration({exports:"ApiError",module:"./core/ApiError"})),n.plugins["@hey-api/sdk"]?.config.response==="response"&&e$1.index.add(m$1.exportNamedDeclaration({exports:{asType:true,name:"ApiResult"},module:"./core/ApiResult"})),g(n)&&e$1.index.add(m$1.exportNamedDeclaration({exports:"BaseHttpRequest",module:"./core/BaseHttpRequest"})),d(n).name!=="legacy/angular"&&e$1.index.add(m$1.exportNamedDeclaration({exports:["CancelablePromise","CancelError"],module:"./core/CancelablePromise"})),e$1.index.add(m$1.exportNamedDeclaration({exports:["OpenAPI",{asType:true,name:"OpenAPIConfig"}],module:"./core/OpenAPI"}))),Object.keys(e$1).sort().forEach(o=>{let r=e$1[o];o==="index"||r.isEmpty()||r.exportFromIndex&&e$1.index.add(m$1.exportAllDeclaration({module:`./${r.nameWithoutExtension()}`}));});};var qe=async({client:e$1,openApi:n,templates:o$1})=>{let r=e(),t$1=n;if(e$1){if(r.plugins["@hey-api/sdk"]?.config.include&&r.plugins["@hey-api/sdk"].config.asClass){let l=new RegExp(r.plugins["@hey-api/sdk"].config.include);e$1.services=e$1.services.filter(c=>l.test(c.name));}if(r.plugins["@hey-api/typescript"]?.config.include){let l=new RegExp(r.plugins["@hey-api/typescript"].config.include);e$1.models=e$1.models.filter(c=>l.test(c.name));}}let s$1=R.resolve(r.output.path);r.output.clean&&o(s$1);let a=u(t(r.output.tsConfigPath)),i=d(r);!f(r)&&"bundle"in i.config&&i.config.bundle&&p$1({outputPath:s$1,plugin:i,tsConfig:a}),await xe(t$1,s$1,e$1,o$1),await Ce(R.resolve(r.output.path,"core"),e$1,o$1);let u$1={};for(let l of r.pluginOrder){let c=r.plugins[l],f=(c.output??"").split("/"),d=R.resolve(r.output.path,...f.slice(0,f.length-1));u$1[c.name]=new s({dir:d,id:`legacy-unused-${c.name}`,name:`${f[f.length-1]}.ts`}),c.handlerLegacy?.({client:e$1,files:u$1,openApi:t$1,plugin:c});}be({files:u$1}),Object.entries(u$1).forEach(([l,c])=>{r.dryRun||(l==="index"?c.write(`
3
3
  `,a):c.write(`
4
4
 
5
5
  `,a));});};var Ae=async({context:e})=>{let n=R.resolve(e.config.output.path);e.config.output.clean&&o(n);let o$1=u(t(e.config.output.tsConfigPath)),r=o$1?.options.moduleResolution===Ct.ModuleResolutionKind.NodeNext,t$1=d(e.config);"bundle"in t$1.config&&t$1.config.bundle&&p$1({outputPath:n,plugin:t$1,tsConfig:o$1});for(let s of e.registerPlugins())await s.run();if(!e.config.dryRun){let s=e.createFile({id:"_index",path:"index"});for(let a of Object.values(e.files))if(a.nameWithoutExtension()!==s.nameWithoutExtension()){if(!a.isEmpty()&&a.exportFromIndex&&e.config.output.indexFile){let u=s.relativePathToFile({context:e,id:a.id});r&&(u.startsWith("./")||u.startsWith("../"))&&(u==="./client"?u="./client/index.js":u=`${u}.js`),s.add(m$1.exportAllDeclaration({module:u}));}a.write(`
6
6
 
7
7
  `,o$1);}e.config.output.indexFile&&s.write(`
8
- `,o$1);}};var Te=({patchOptions:e,spec:n})=>{if(!e)return;let o=n;if("swagger"in o){if(e.version&&o.swagger&&(o.swagger=typeof e.version=="string"?e.version:e.version(o.swagger)),e.meta&&o.info&&e.meta(o.info),e.schemas&&o.definitions)for(let r in e.schemas){let t=o.definitions[r];if(!t||typeof t!="object")continue;let s=e.schemas[r];s(t);}if(e.operations&&o.paths)for(let r in e.operations){let[t,s]=r.split(" ");if(!t||!s)continue;let a=o.paths[s];if(!a)continue;let i=a[t.toLocaleLowerCase()]||a[t.toLocaleUpperCase()];if(!i||typeof i!="object")continue;let u=e.operations[r];u(i);}return}if(e.version&&o.openapi&&(o.openapi=typeof e.version=="string"?e.version:e.version(o.openapi)),e.meta&&o.info&&e.meta(o.info),o.components){if(e.schemas&&o.components.schemas)for(let r in e.schemas){let t=o.components.schemas[r];if(!t||typeof t!="object")continue;let s=e.schemas[r];s(t);}if(e.parameters&&o.components.parameters)for(let r in e.parameters){let t=o.components.parameters[r];if(!t||typeof t!="object")continue;let s=e.parameters[r];s(t);}if(e.requestBodies&&o.components.requestBodies)for(let r in e.requestBodies){let t=o.components.requestBodies[r];if(!t||typeof t!="object")continue;let s=e.requestBodies[r];s(t);}if(e.responses&&o.components.responses)for(let r in e.responses){let t=o.components.responses[r];if(!t||typeof t!="object")continue;let s=e.responses[r];s(t);}}if(e.operations&&o.paths)for(let r in e.operations){let[t,s]=r.split(" ");if(!t||!s)continue;let a=o.paths[s];if(!a)continue;let i=a[t.toLocaleLowerCase()]||a[t.toLocaleUpperCase()];if(!i||typeof i!="object")continue;let u=e.operations[r];u(i);}};var ee=c(gn(),1),Xt={biome:{args:e=>["format","--write",e],command:"biome",name:"Biome (Format)"},prettier:{args:e=>["--ignore-unknown",e,"--write","--ignore-path","./.prettierignore"],command:"prettier",name:"Prettier"}},Qt={biome:{args:e=>["lint","--apply",e],command:"biome",name:"Biome (Lint)"},eslint:{args:e=>[e,"--fix"],command:"eslint",name:"ESLint"},oxlint:{args:e=>["--fix",e],command:"oxlint",name:"oxlint"}},yn=({config:e})=>{if(e.output.format){let n=Xt[e.output.format];console.log(`\u2728 Running ${n.name}`),(0, ee.sync)(n.command,n.args(e.output.path));}if(e.output.lint){let n=Qt[e.output.lint];console.log(`\u2728 Running ${n.name}`),(0, ee.sync)(n.command,n.args(e.output.path));}};var hn=e=>`${e}-end`,ne=e=>`${e}-length`,vn=e=>`${e}-start`,m={clear:()=>{performance.clearMarks(),performance.clearMeasures();},end:e=>performance.mark(hn(e)),getEntriesByName:e=>performance.getEntriesByName(ne(e)),measure:e=>performance.measure(ne(e),vn(e),hn(e)),start:e=>performance.mark(vn(e))},L=class{totalMeasure;constructor({totalMark:n}){this.totalMeasure=m.measure(n);}report({marks:n}){let o=Math.ceil(this.totalMeasure.duration*100)/100,r=this.totalMeasure.name;console.warn(`${r.substring(0,r.length-ne("").length)}: ${o.toFixed(2)}ms`),n.forEach(t=>{try{let s=m.measure(t),a=Math.ceil(s.duration*100)/100,i=Math.ceil(s.duration/this.totalMeasure.duration*100*100)/100;console.warn(`${t}: ${a.toFixed(2)}ms (${i.toFixed(2)}%)`);}catch{}});}};function Rn(e,n){return {...e,config:n,models:e.models.map(o=>Jt(o)),services:Yt(e.operations).map(Zt),types:{}}}var Jt=e=>({...e,$refs:e.$refs.filter((n,o,r)=>B(n,o,r)),enum:e.enum.filter((n,o,r)=>r.findIndex(t=>t.value===n.value)===o),enums:e.enums.filter((n,o,r)=>r.findIndex(t=>t.name===n.name)===o),imports:e.imports.filter((n,o,r)=>B(n,o,r)&&n!==e.name).sort(C)}),Yt=e$1=>{let n=e(),o=new Map;return e$1.forEach(r=>{(r.tags?.length&&(n.plugins["@hey-api/sdk"]?.config.asClass||g(n))?r.tags.filter(B):["Default"]).forEach(s=>{let a={...r,service:tr(s)},i=o.get(a.service)||nr(a);i.$refs=[...i.$refs,...a.$refs],i.imports=[...i.imports,...a.imports],i.operations=[...i.operations,a],o.set(a.service,i);});}),Array.from(o.values())},Zt=e=>{let n={...e};return n.operations=er(n),n.operations.forEach(o=>{n.imports.push(...o.imports);}),n.imports=n.imports.filter(B).sort(C),n},er=e=>{let n=new Map;return e.operations.map(o=>{let r={...o};r.imports.push(...r.parameters.flatMap(i=>i.imports));let t=r.responses.filter(i=>i.responseTypes.includes("success"));r.imports.push(...t.flatMap(i=>i.imports));let s=r.name,a=n.get(s)||0;return a>0&&(r.name=`${s}${a}`),n.set(s,a+1),r})},nr=e=>({$refs:[],imports:[],name:e.service,operations:[]}),tr=e=>q({case:"PascalCase",value:z(e)});var te=e=>e.startsWith("https://get.heyapi.dev"),or=e=>{let n={path:""};if(e.path&&(typeof e.path!="string"||!te(e.path)))return n.path=e.path,n;let[o,r]=e.path.split("?"),s=(r||"").split("&").map(P=>P.split("=")),a=o||"";a.endsWith("/")&&(a=a.slice(0,a.length-1));let[,i]=a.split("://"),[u,l,c]=(i||"").split("/");n.organization=l||e.organization,n.project=c||e.project;let f=[],d="api_key";n.api_key=s.find(([P])=>P===d)?.[1]||e.api_key||process.env.HEY_API_TOKEN,n.api_key&&f.push(`${d}=${n.api_key}`);let A="branch";n.branch=s.find(([P])=>P===A)?.[1]||e.branch,n.branch&&f.push(`${A}=${n.branch}`);let q="commit_sha";n.commit_sha=s.find(([P])=>P===q)?.[1]||e.commit_sha,n.commit_sha&&f.push(`${q}=${n.commit_sha}`);let k="tags";n.tags=s.find(([P])=>P===k)?.[1]?.split(",")||e.tags,n.tags?.length&&f.push(`${k}=${n.tags.join(",")}`);let H="version";if(n.version=s.find(([P])=>P===H)?.[1]||e.version,n.version&&f.push(`${H}=${n.version}`),!n.organization)throw new Error("missing organization - from which Hey API Platform organization do you want to generate your output?");if(!n.project)throw new Error("missing project - from which Hey API Platform project do you want to generate your output?");let oe=f.join("&"),se=u||"get.heyapi.dev",ie=se.startsWith("localhost"),ae=[ie?"http":"https",se].join("://"),le=ie?[ae,"v1","get",n.organization,n.project].join("/"):[ae,n.organization,n.project].join("/");return n.path=oe?`${le}?${oe}`:le,n},Pn=e=>{let n=x.cyan("Generating from");if(typeof e.path=="string"){let o=te(e.path)?`${e.organization??""}/${e.project??""}`:e.path;console.log(`\u23F3 ${n} ${o}`),te(e.path)&&(e.branch&&console.log(`${x.gray("branch:")} ${x.green(e.branch)}`),e.commit_sha&&console.log(`${x.gray("commit:")} ${x.green(e.commit_sha)}`),e.tags?.length&&console.log(`${x.gray("tags:")} ${x.green(e.tags.join(", "))}`),e.version&&console.log(`${x.gray("version:")} ${x.green(e.version)}`));}else console.log(`\u23F3 ${n} raw OpenAPI specification`);},re=async({config:e,templates:n,watch:o})=>{let r=or(e.input),{timeout:t}=e.input.watch,s=o||{headers:new Headers};e.logs.level!=="silent"&&!o&&Pn(r),m.start("spec");let{data:a,error:i,response:u}=await I({fetchOptions:e.input.fetch,inputPath:r.path,timeout:t,watch:s});if(m.end("spec"),i&&!o)throw new Error(`Request failed with status ${u.status}: ${u.statusText}`);let l,c;if(a){if(e.logs.level!=="silent"&&o&&(console.clear(),Pn(r)),m.start("input.patch"),Te({patchOptions:e.parser.patch,spec:a}),m.end("input.patch"),m.start("parser"),e.experimentalParser&&!f(e)&&!g(e)&&(c=F$1({config:e,spec:a})),!c){let f=E({openApi:a});l=Rn(f,e);}if(m.end("parser"),m.start("generator"),c?await Ae({context:c}):l&&await qe({client:l,openApi:a,templates:n}),m.end("generator"),m.start("postprocess"),!e.dryRun&&(yn({config:e}),e.logs.level!=="silent")){let f=process.env.INIT_CWD?`./${R.relative(process.env.INIT_CWD,e.output.path)}`:e.output.path;console.log(`${x.green("\u{1F680} Done!")} Your output is in ${x.cyanBright(f)}`);}m.end("postprocess");}return e.input.watch.enabled&&typeof r.path=="string"&&setTimeout(()=>{re({config:e,templates:n,watch:s});},e.input.watch.interval),c||l};var xn={1:function(e,n,o,r,t){return `import { NgModule} from '@angular/core';
8
+ `,o$1);}};var Te=({patchOptions:e,spec:n})=>{if(!e)return;let o=n;if("swagger"in o){if(e.version&&o.swagger&&(o.swagger=typeof e.version=="string"?e.version:e.version(o.swagger)),e.meta&&o.info&&e.meta(o.info),e.schemas&&o.definitions)for(let r in e.schemas){let t=o.definitions[r];if(!t||typeof t!="object")continue;let s=e.schemas[r];s(t);}if(e.operations&&o.paths)for(let r in e.operations){let[t,s]=r.split(" ");if(!t||!s)continue;let a=o.paths[s];if(!a)continue;let i=a[t.toLocaleLowerCase()]||a[t.toLocaleUpperCase()];if(!i||typeof i!="object")continue;let u=e.operations[r];u(i);}return}if(e.version&&o.openapi&&(o.openapi=typeof e.version=="string"?e.version:e.version(o.openapi)),e.meta&&o.info&&e.meta(o.info),o.components){if(e.schemas&&o.components.schemas)for(let r in e.schemas){let t=o.components.schemas[r];if(!t||typeof t!="object")continue;let s=e.schemas[r];s(t);}if(e.parameters&&o.components.parameters)for(let r in e.parameters){let t=o.components.parameters[r];if(!t||typeof t!="object")continue;let s=e.parameters[r];s(t);}if(e.requestBodies&&o.components.requestBodies)for(let r in e.requestBodies){let t=o.components.requestBodies[r];if(!t||typeof t!="object")continue;let s=e.requestBodies[r];s(t);}if(e.responses&&o.components.responses)for(let r in e.responses){let t=o.components.responses[r];if(!t||typeof t!="object")continue;let s=e.responses[r];s(t);}}if(e.operations&&o.paths)for(let r in e.operations){let[t,s]=r.split(" ");if(!t||!s)continue;let a=o.paths[s];if(!a)continue;let i=a[t.toLocaleLowerCase()]||a[t.toLocaleUpperCase()];if(!i||typeof i!="object")continue;let u=e.operations[r];u(i);}};var ee=c(gn(),1),Xt={biome:{args:e=>["format","--write",e],command:"biome",name:"Biome (Format)"},prettier:{args:e=>["--ignore-unknown",e,"--write","--ignore-path","./.prettierignore"],command:"prettier",name:"Prettier"}},Qt={biome:{args:e=>["lint","--apply",e],command:"biome",name:"Biome (Lint)"},eslint:{args:e=>[e,"--fix"],command:"eslint",name:"ESLint"},oxlint:{args:e=>["--fix",e],command:"oxlint",name:"oxlint"}},yn=({config:e})=>{if(e.output.format){let n=Xt[e.output.format];console.log(`\u2728 Running ${n.name}`),(0, ee.sync)(n.command,n.args(e.output.path));}if(e.output.lint){let n=Qt[e.output.lint];console.log(`\u2728 Running ${n.name}`),(0, ee.sync)(n.command,n.args(e.output.path));}};var hn=e=>`${e}-end`,ne=e=>`${e}-length`,vn=e=>`${e}-start`,m={clear:()=>{performance.clearMarks(),performance.clearMeasures();},end:e=>performance.mark(hn(e)),getEntriesByName:e=>performance.getEntriesByName(ne(e)),measure:e=>performance.measure(ne(e),vn(e),hn(e)),start:e=>performance.mark(vn(e))},L=class{totalMeasure;constructor({totalMark:n}){this.totalMeasure=m.measure(n);}report({marks:n}){let o=Math.ceil(this.totalMeasure.duration*100)/100,r=this.totalMeasure.name;console.warn(`${r.substring(0,r.length-ne("").length)}: ${o.toFixed(2)}ms`),n.forEach(t=>{try{let s=m.measure(t),a=Math.ceil(s.duration*100)/100,i=Math.ceil(s.duration/this.totalMeasure.duration*100*100)/100;console.warn(`${t}: ${a.toFixed(2)}ms (${i.toFixed(2)}%)`);}catch{}});}};function Rn(e,n){return {...e,config:n,models:e.models.map(o=>Jt(o)),services:Yt(e.operations).map(Zt),types:{}}}var Jt=e=>({...e,$refs:e.$refs.filter((n,o,r)=>B(n,o,r)),enum:e.enum.filter((n,o,r)=>r.findIndex(t=>t.value===n.value)===o),enums:e.enums.filter((n,o,r)=>r.findIndex(t=>t.name===n.name)===o),imports:e.imports.filter((n,o,r)=>B(n,o,r)&&n!==e.name).sort(C$1)}),Yt=e$1=>{let n=e(),o=new Map;return e$1.forEach(r=>{(r.tags?.length&&(n.plugins["@hey-api/sdk"]?.config.asClass||g(n))?r.tags.filter(B):["Default"]).forEach(s=>{let a={...r,service:tr(s)},i=o.get(a.service)||nr(a);i.$refs=[...i.$refs,...a.$refs],i.imports=[...i.imports,...a.imports],i.operations=[...i.operations,a],o.set(a.service,i);});}),Array.from(o.values())},Zt=e=>{let n={...e};return n.operations=er(n),n.operations.forEach(o=>{n.imports.push(...o.imports);}),n.imports=n.imports.filter(B).sort(C$1),n},er=e=>{let n=new Map;return e.operations.map(o=>{let r={...o};r.imports.push(...r.parameters.flatMap(i=>i.imports));let t=r.responses.filter(i=>i.responseTypes.includes("success"));r.imports.push(...t.flatMap(i=>i.imports));let s=r.name,a=n.get(s)||0;return a>0&&(r.name=`${s}${a}`),n.set(s,a+1),r})},nr=e=>({$refs:[],imports:[],name:e.service,operations:[]}),tr=e=>q({case:"PascalCase",value:z(e)});var te=e=>e.startsWith("https://get.heyapi.dev"),or=e=>{let n={path:""};if(e.path&&(typeof e.path!="string"||!te(e.path)))return n.path=e.path,n;let[o,r]=e.path.split("?"),s=(r||"").split("&").map(P=>P.split("=")),a=o||"";a.endsWith("/")&&(a=a.slice(0,a.length-1));let[,i]=a.split("://"),[u,l,c]=(i||"").split("/");n.organization=l||e.organization,n.project=c||e.project;let f=[],d="api_key";n.api_key=s.find(([P])=>P===d)?.[1]||e.api_key||process.env.HEY_API_TOKEN,n.api_key&&f.push(`${d}=${n.api_key}`);let A="branch";n.branch=s.find(([P])=>P===A)?.[1]||e.branch,n.branch&&f.push(`${A}=${n.branch}`);let q="commit_sha";n.commit_sha=s.find(([P])=>P===q)?.[1]||e.commit_sha,n.commit_sha&&f.push(`${q}=${n.commit_sha}`);let k="tags";n.tags=s.find(([P])=>P===k)?.[1]?.split(",")||e.tags,n.tags?.length&&f.push(`${k}=${n.tags.join(",")}`);let H="version";if(n.version=s.find(([P])=>P===H)?.[1]||e.version,n.version&&f.push(`${H}=${n.version}`),!n.organization)throw new Error("missing organization - from which Hey API Platform organization do you want to generate your output?");if(!n.project)throw new Error("missing project - from which Hey API Platform project do you want to generate your output?");let oe=f.join("&"),se=u||"get.heyapi.dev",ie=se.startsWith("localhost"),ae=[ie?"http":"https",se].join("://"),le=ie?[ae,"v1","get",n.organization,n.project].join("/"):[ae,n.organization,n.project].join("/");return n.path=oe?`${le}?${oe}`:le,n},Pn=e=>{let n=C.cyan("Generating from");if(typeof e.path=="string"){let o=te(e.path)?`${e.organization??""}/${e.project??""}`:e.path;console.log(`\u23F3 ${n} ${o}`),te(e.path)&&(e.branch&&console.log(`${C.gray("branch:")} ${C.green(e.branch)}`),e.commit_sha&&console.log(`${C.gray("commit:")} ${C.green(e.commit_sha)}`),e.tags?.length&&console.log(`${C.gray("tags:")} ${C.green(e.tags.join(", "))}`),e.version&&console.log(`${C.gray("version:")} ${C.green(e.version)}`));}else console.log(`\u23F3 ${n} raw OpenAPI specification`);},re=async({config:e,templates:n,watch:o})=>{let r=or(e.input),{timeout:t}=e.input.watch,s=o||{headers:new Headers};e.logs.level!=="silent"&&!o&&Pn(r),m.start("spec");let{data:a,error:i,response:u}=await I({fetchOptions:e.input.fetch,inputPath:r.path,timeout:t,watch:s});if(m.end("spec"),i&&!o)throw new Error(`Request failed with status ${u.status}: ${u.statusText}`);let l,c;if(a){if(e.logs.level!=="silent"&&o&&(console.clear(),Pn(r)),m.start("input.patch"),Te({patchOptions:e.parser.patch,spec:a}),m.end("input.patch"),m.start("parser"),e.experimentalParser&&!f(e)&&!g(e)&&(c=F$1({config:e,spec:a})),!c){let f=E({openApi:a});l=Rn(f,e);}if(m.end("parser"),m.start("generator"),c?await Ae({context:c}):l&&await qe({client:l,openApi:a,templates:n}),m.end("generator"),m.start("postprocess"),!e.dryRun&&(yn({config:e}),e.logs.level!=="silent")){let f=process.env.INIT_CWD?`./${R.relative(process.env.INIT_CWD,e.output.path)}`:e.output.path;console.log(`${C.green("\u{1F680} Done!")} Your output is in ${C.cyanBright(f)}`);}m.end("postprocess");}return e.input.watch.enabled&&typeof r.path=="string"&&setTimeout(()=>{re({config:e,templates:n,watch:s});},e.input.watch.interval),c||l};var xn={1:function(e,n,o,r,t){return `import { NgModule} from '@angular/core';
9
9
  import { HttpClientModule } from '@angular/common/http';
10
10
 
11
11
  import { AngularHttpRequest } from './core/AngularHttpRequest';
@@ -1301,5 +1301,5 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
1301
1301
 
1302
1302
  onCancel(() => xhr.abort());
1303
1303
  });
1304
- };`},useData:true};var sr=()=>{p.registerHelper("camelCase",function(e){return q({case:"camelCase",value:e})}),p.registerHelper("equals",function(e,n,o){return e===n?o.fn(this):o.inverse(this)}),p.registerHelper("ifServicesResponse",function(e$1,n){return e().plugins["@hey-api/sdk"]?.config.response===e$1?n.fn(this):n.inverse(this)}),p.registerHelper("ifdef",function(...e){let n=e.pop();return e.every(o=>!o)?n.inverse(this):n.fn(this)}),p.registerHelper("notEquals",function(e,n,o){return e!==n?o.fn(this):o.inverse(this)}),p.registerHelper("transformServiceName",function(e$1){return A({config:e(),name:e$1})});},ct=()=>{sr();let e={client:p.template(xn),core:{apiError:p.template(On),apiRequestOptions:p.template(wn),apiResult:p.template(En),baseHttpRequest:p.template($n),cancelablePromise:p.template(Nn),httpRequest:p.template(tt),request:p.template(ot),settings:p.template(rt)}};return p.registerPartial("functions/base64",p.template(Vn)),p.registerPartial("functions/catchErrorCodes",p.template(Gn)),p.registerPartial("functions/getFormData",p.template(zn)),p.registerPartial("functions/getQueryString",p.template(Kn)),p.registerPartial("functions/getUrl",p.template(Xn)),p.registerPartial("functions/isBlob",p.template(Qn)),p.registerPartial("functions/isFormData",p.template(Jn)),p.registerPartial("functions/isString",p.template(Yn)),p.registerPartial("functions/isStringWithValue",p.template(Zn)),p.registerPartial("functions/isSuccess",p.template(et)),p.registerPartial("functions/resolve",p.template(nt)),p.registerPartial("fetch/getHeaders",p.template(Fn)),p.registerPartial("fetch/getRequestBody",p.template(_n)),p.registerPartial("fetch/getResponseBody",p.template(Ln)),p.registerPartial("fetch/getResponseHeader",p.template(Mn)),p.registerPartial("fetch/request",p.template(Wn)),p.registerPartial("fetch/sendRequest",p.template(Un)),p.registerPartial("xhr/getHeaders",p.template(st)),p.registerPartial("xhr/getRequestBody",p.template(it)),p.registerPartial("xhr/getResponseBody",p.template(at)),p.registerPartial("xhr/getResponseHeader",p.template(lt)),p.registerPartial("xhr/request",p.template(ut)),p.registerPartial("xhr/sendRequest",p.template(pt)),p.registerPartial("axios/getHeaders",p.template(Sn)),p.registerPartial("axios/getRequestBody",p.template(Hn)),p.registerPartial("axios/getResponseBody",p.template(Dn)),p.registerPartial("axios/getResponseHeader",p.template(In)),p.registerPartial("axios/request",p.template(Bn)),p.registerPartial("axios/sendRequest",p.template(jn)),p.registerPartial("angular/getHeaders",p.template(Cn)),p.registerPartial("angular/getRequestBody",p.template(bn)),p.registerPartial("angular/getResponseBody",p.template(qn)),p.registerPartial("angular/getResponseHeader",p.template(An)),p.registerPartial("angular/request",p.template(Tn)),p.registerPartial("angular/sendRequest",p.template(kn)),e};var ir={stringCase:q};x.enabled=lr().hasBasic;var Ai=async e=>{let n=typeof e=="function"?await e():e,o=[];try{m.start("createClient"),m.start("config");for(let i of await H(n))if(o.push(i.config),i.errors.length)throw i.errors[0];m.end("config"),m.start("handlebars");let r=ct();m.end("handlebars");let s=(await Promise.all(o.map(i=>re({config:i,templates:r})))).filter(i=>!!i);m.end("createClient");let a=o[0];return a&&a.logs.level==="debug"&&new L({totalMark:"createClient"}).report({marks:["config","openapi","handlebars","parser","generator","postprocess"]}),s}catch(r){let t=o[0],s=t?t.dryRun:n?.dryRun,a=t?.logs??h(n),i;throw a.level!=="silent"&&a.file&&!s&&(i=v(r,a.path??"")),a.level!=="silent"&&(x$1({error:r,logPath:i}),await y()&&await w(r)),r}},Ti=async e=>typeof e=="function"?await e():e;export{Ai as createClient,Ti as defineConfig,ir as utils};//# sourceMappingURL=index.js.map
1304
+ };`},useData:true};var sr=()=>{p.registerHelper("camelCase",function(e){return q({case:"camelCase",value:e})}),p.registerHelper("equals",function(e,n,o){return e===n?o.fn(this):o.inverse(this)}),p.registerHelper("ifServicesResponse",function(e$1,n){return e().plugins["@hey-api/sdk"]?.config.response===e$1?n.fn(this):n.inverse(this)}),p.registerHelper("ifdef",function(...e){let n=e.pop();return e.every(o=>!o)?n.inverse(this):n.fn(this)}),p.registerHelper("notEquals",function(e,n,o){return e!==n?o.fn(this):o.inverse(this)}),p.registerHelper("transformServiceName",function(e$1){return A({config:e(),name:e$1})});},ct=()=>{sr();let e={client:p.template(xn),core:{apiError:p.template(On),apiRequestOptions:p.template(wn),apiResult:p.template(En),baseHttpRequest:p.template($n),cancelablePromise:p.template(Nn),httpRequest:p.template(tt),request:p.template(ot),settings:p.template(rt)}};return p.registerPartial("functions/base64",p.template(Vn)),p.registerPartial("functions/catchErrorCodes",p.template(Gn)),p.registerPartial("functions/getFormData",p.template(zn)),p.registerPartial("functions/getQueryString",p.template(Kn)),p.registerPartial("functions/getUrl",p.template(Xn)),p.registerPartial("functions/isBlob",p.template(Qn)),p.registerPartial("functions/isFormData",p.template(Jn)),p.registerPartial("functions/isString",p.template(Yn)),p.registerPartial("functions/isStringWithValue",p.template(Zn)),p.registerPartial("functions/isSuccess",p.template(et)),p.registerPartial("functions/resolve",p.template(nt)),p.registerPartial("fetch/getHeaders",p.template(Fn)),p.registerPartial("fetch/getRequestBody",p.template(_n)),p.registerPartial("fetch/getResponseBody",p.template(Ln)),p.registerPartial("fetch/getResponseHeader",p.template(Mn)),p.registerPartial("fetch/request",p.template(Wn)),p.registerPartial("fetch/sendRequest",p.template(Un)),p.registerPartial("xhr/getHeaders",p.template(st)),p.registerPartial("xhr/getRequestBody",p.template(it)),p.registerPartial("xhr/getResponseBody",p.template(at)),p.registerPartial("xhr/getResponseHeader",p.template(lt)),p.registerPartial("xhr/request",p.template(ut)),p.registerPartial("xhr/sendRequest",p.template(pt)),p.registerPartial("axios/getHeaders",p.template(Sn)),p.registerPartial("axios/getRequestBody",p.template(Hn)),p.registerPartial("axios/getResponseBody",p.template(Dn)),p.registerPartial("axios/getResponseHeader",p.template(In)),p.registerPartial("axios/request",p.template(Bn)),p.registerPartial("axios/sendRequest",p.template(jn)),p.registerPartial("angular/getHeaders",p.template(Cn)),p.registerPartial("angular/getRequestBody",p.template(bn)),p.registerPartial("angular/getResponseBody",p.template(qn)),p.registerPartial("angular/getResponseHeader",p.template(An)),p.registerPartial("angular/request",p.template(Tn)),p.registerPartial("angular/sendRequest",p.template(kn)),e};var ir={stringCase:q};C.enabled=lr().hasBasic;var Ai=async e=>{let n=typeof e=="function"?await e():e,o=[];try{m.start("createClient"),m.start("config");for(let i of await H(n))if(o.push(i.config),i.errors.length)throw i.errors[0];m.end("config"),m.start("handlebars");let r=ct();m.end("handlebars");let s=(await Promise.all(o.map(i=>re({config:i,templates:r})))).filter(i=>!!i);m.end("createClient");let a=o[0];return a&&a.logs.level==="debug"&&new L({totalMark:"createClient"}).report({marks:["config","openapi","handlebars","parser","generator","postprocess"]}),s}catch(r){let t=o[0],s=t?t.dryRun:n?.dryRun,a=t?.logs??h(n),i;throw a.level!=="silent"&&a.file&&!s&&(i=v(r,a.path??"")),a.level!=="silent"&&(x({error:r,logPath:i}),await y()&&await w(r)),r}},Ti=async e=>typeof e=="function"?await e():e;export{Ai as createClient,Ti as defineConfig,ir as utils};//# sourceMappingURL=index.js.map
1305
1305
  //# sourceMappingURL=index.js.map