@hey-api/openapi-python 0.0.23
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/LICENSE.md +21 -0
- package/README.md +411 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +18 -0
- package/dist/chunk-z9aeyW2b.mjs +15 -0
- package/dist/clients/httpx/__init__.py +3 -0
- package/dist/clients/httpx/client.py +128 -0
- package/dist/index.d.mts +172 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/plugins-BDUY2dP5.d.mts +2941 -0
- package/dist/plugins-BDUY2dP5.d.mts.map +1 -0
- package/dist/plugins.d.mts +2 -0
- package/dist/plugins.mjs +15 -0
- package/dist/plugins.mjs.map +1 -0
- package/dist/run.d.mts +1 -0
- package/dist/run.mjs +55 -0
- package/dist/run.mjs.map +1 -0
- package/dist/src-DaXm5pxY.mjs +6771 -0
- package/dist/src-DaXm5pxY.mjs.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,2941 @@
|
|
|
1
|
+
import { AnalysisContext, BindingKind, File, FromRef, Language, Node as Node$1, NodeName, NodeNameSanitizer, NodeRelationship, NodeScope, ProjectMeta, Ref, Symbol } from "@hey-api/codegen-core";
|
|
2
|
+
import { Casing, DefinePlugin, FeatureToggle, IR, NameTransformer, NamingConfig, NamingOptions, NamingRule, OperationPathStrategy, OperationsStrategy, Plugin, PluginInstance, SchemaVisitorContext, SchemaWithType, Walker } from "@hey-api/shared";
|
|
3
|
+
import { AnyString, MaybeArray, MaybeFunc } from "@hey-api/types";
|
|
4
|
+
import { LinguistLanguages } from "@hey-api/spec-types";
|
|
5
|
+
|
|
6
|
+
//#region src/plugins/@hey-api/client-httpx/types.d.ts
|
|
7
|
+
type UserConfig$2 = Plugin.Name<'@hey-api/client-httpx'> & {
|
|
8
|
+
/**
|
|
9
|
+
* Set a default base URL when creating the client? You can set `baseUrl`
|
|
10
|
+
* to a string which will be used as the base URL. If your input defines
|
|
11
|
+
* server(s), you can set `baseUrl` to a number to pick a specific server
|
|
12
|
+
* to use as the base URL. You can disable setting the base URL by setting
|
|
13
|
+
* `baseUrl` to `false`. By default, `baseUrl` is `true` and it will try to
|
|
14
|
+
* use the first defined server value. If there's none, we won't set a
|
|
15
|
+
* base URL.
|
|
16
|
+
*
|
|
17
|
+
* If the matched URL contains template literals, it will be ignored.
|
|
18
|
+
*
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
baseUrl?: string | number | boolean;
|
|
22
|
+
};
|
|
23
|
+
type Config$2 = Plugin.Name<'@hey-api/client-httpx'> & {
|
|
24
|
+
baseUrl: string | number | boolean;
|
|
25
|
+
};
|
|
26
|
+
type HeyApiClientHttpxPlugin = DefinePlugin<UserConfig$2, Config$2>;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/plugins/types.d.ts
|
|
29
|
+
type PluginClientNames = '@hey-api/client-aiohttp' | '@hey-api/client-httpx' | '@hey-api/client-requests' | '@hey-api/client-urllib3';
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/py-compiler/nodes/kinds.d.ts
|
|
32
|
+
declare enum PyNodeKind {
|
|
33
|
+
Assignment = "Assignment",
|
|
34
|
+
AsyncExpression = "AsyncExpression",
|
|
35
|
+
AugmentedAssignment = "AugmentedAssignment",
|
|
36
|
+
AwaitExpression = "AwaitExpression",
|
|
37
|
+
BinaryExpression = "BinaryExpression",
|
|
38
|
+
Block = "Block",
|
|
39
|
+
BreakStatement = "BreakStatement",
|
|
40
|
+
CallExpression = "CallExpression",
|
|
41
|
+
ClassDeclaration = "ClassDeclaration",
|
|
42
|
+
Comment = "Comment",
|
|
43
|
+
ContinueStatement = "ContinueStatement",
|
|
44
|
+
DictComprehension = "DictComprehension",
|
|
45
|
+
DictExpression = "DictExpression",
|
|
46
|
+
EmptyStatement = "EmptyStatement",
|
|
47
|
+
ExceptClause = "ExceptClause",
|
|
48
|
+
ExpressionStatement = "ExpressionStatement",
|
|
49
|
+
FStringExpression = "FStringExpression",
|
|
50
|
+
ForStatement = "ForStatement",
|
|
51
|
+
FunctionDeclaration = "FunctionDeclaration",
|
|
52
|
+
FunctionParameter = "FunctionParameter",
|
|
53
|
+
GeneratorExpression = "GeneratorExpression",
|
|
54
|
+
Identifier = "Identifier",
|
|
55
|
+
IfStatement = "IfStatement",
|
|
56
|
+
ImportStatement = "ImportStatement",
|
|
57
|
+
KeywordArgument = "KeywordArgument",
|
|
58
|
+
LambdaExpression = "LambdaExpression",
|
|
59
|
+
ListComprehension = "ListComprehension",
|
|
60
|
+
ListExpression = "ListExpression",
|
|
61
|
+
Literal = "Literal",
|
|
62
|
+
MemberExpression = "MemberExpression",
|
|
63
|
+
RStringExpression = "RStringExpression",
|
|
64
|
+
RaiseStatement = "RaiseStatement",
|
|
65
|
+
ReturnStatement = "ReturnStatement",
|
|
66
|
+
SetComprehension = "SetComprehension",
|
|
67
|
+
SetExpression = "SetExpression",
|
|
68
|
+
SourceFile = "SourceFile",
|
|
69
|
+
SubscriptExpression = "SubscriptExpression",
|
|
70
|
+
SubscriptSlice = "SubscriptSlice",
|
|
71
|
+
TryStatement = "TryStatement",
|
|
72
|
+
TupleExpression = "TupleExpression",
|
|
73
|
+
WhileStatement = "WhileStatement",
|
|
74
|
+
WithItem = "WithItem",
|
|
75
|
+
WithStatement = "WithStatement",
|
|
76
|
+
YieldExpression = "YieldExpression",
|
|
77
|
+
YieldFromExpression = "YieldFromExpression"
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/py-compiler/nodes/statements/block.d.ts
|
|
81
|
+
interface PyBlock extends PyNodeBase {
|
|
82
|
+
kind: PyNodeKind.Block;
|
|
83
|
+
statements: ReadonlyArray<PyStatement>;
|
|
84
|
+
}
|
|
85
|
+
declare function createBlock(statements: ReadonlyArray<PyStatement>, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyBlock;
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/py-compiler/nodes/declarations/class.d.ts
|
|
88
|
+
interface PyClassDeclaration extends PyNodeBase {
|
|
89
|
+
baseClasses?: ReadonlyArray<PyNode>;
|
|
90
|
+
body: PyBlock;
|
|
91
|
+
decorators?: ReadonlyArray<PyExpression>;
|
|
92
|
+
docstring?: string;
|
|
93
|
+
kind: PyNodeKind.ClassDeclaration;
|
|
94
|
+
name: string;
|
|
95
|
+
}
|
|
96
|
+
declare function createClassDeclaration(name: string, body: ReadonlyArray<PyStatement>, decorators?: ReadonlyArray<PyExpression>, baseClasses?: ReadonlyArray<PyNode>, docstring?: string, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyClassDeclaration;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/py-compiler/nodes/declarations/function-parameter.d.ts
|
|
99
|
+
interface PyFunctionParameter extends PyNodeBase {
|
|
100
|
+
defaultValue?: PyExpression;
|
|
101
|
+
kind: PyNodeKind.FunctionParameter;
|
|
102
|
+
name: string;
|
|
103
|
+
type?: PyExpression;
|
|
104
|
+
}
|
|
105
|
+
declare function createFunctionParameter(name: string, type?: PyExpression, defaultValue?: PyExpression, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyFunctionParameter;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/py-compiler/nodes/declarations/function.d.ts
|
|
108
|
+
interface PyFunctionDeclaration extends PyNodeBase {
|
|
109
|
+
body: PyBlock;
|
|
110
|
+
decorators?: ReadonlyArray<PyExpression>;
|
|
111
|
+
docstring?: string;
|
|
112
|
+
kind: PyNodeKind.FunctionDeclaration;
|
|
113
|
+
modifiers?: ReadonlyArray<PyExpression>;
|
|
114
|
+
name: string;
|
|
115
|
+
parameters: ReadonlyArray<PyFunctionParameter>;
|
|
116
|
+
returnType?: PyExpression;
|
|
117
|
+
}
|
|
118
|
+
declare function createFunctionDeclaration(name: string, parameters: ReadonlyArray<PyFunctionParameter>, returnType: PyExpression | undefined, body: ReadonlyArray<PyStatement>, decorators?: ReadonlyArray<PyExpression>, docstring?: string, modifiers?: ReadonlyArray<PyExpression>, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyFunctionDeclaration;
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/py-compiler/nodes/statements/assignment.d.ts
|
|
121
|
+
interface PyAssignment extends PyNodeBase {
|
|
122
|
+
kind: PyNodeKind.Assignment;
|
|
123
|
+
target: PyExpression;
|
|
124
|
+
type?: PyExpression;
|
|
125
|
+
value?: PyExpression;
|
|
126
|
+
}
|
|
127
|
+
declare function createAssignment(target: PyExpression, type?: PyExpression, value?: PyExpression, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyAssignment;
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/py-compiler/nodes/statements/augmented-assignment.d.ts
|
|
130
|
+
type PyAugmentedOperator = '+=' | '-=' | '*=' | '/=' | '//=' | '%=' | '**=' | '&=' | '|=' | '^=' | '>>=' | '<<=';
|
|
131
|
+
interface PyAugmentedAssignment extends PyNodeBase {
|
|
132
|
+
kind: PyNodeKind.AugmentedAssignment;
|
|
133
|
+
operator: PyAugmentedOperator;
|
|
134
|
+
target: PyExpression;
|
|
135
|
+
value: PyExpression;
|
|
136
|
+
}
|
|
137
|
+
declare function createAugmentedAssignment(target: PyExpression, operator: PyAugmentedOperator, value: PyExpression): PyAugmentedAssignment;
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/py-compiler/nodes/statements/break.d.ts
|
|
140
|
+
interface PyBreakStatement extends PyNodeBase {
|
|
141
|
+
kind: PyNodeKind.BreakStatement;
|
|
142
|
+
}
|
|
143
|
+
declare function createBreakStatement(): PyBreakStatement;
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/py-compiler/nodes/statements/continue.d.ts
|
|
146
|
+
interface PyContinueStatement extends PyNodeBase {
|
|
147
|
+
kind: PyNodeKind.ContinueStatement;
|
|
148
|
+
}
|
|
149
|
+
declare function createContinueStatement(): PyContinueStatement;
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/py-compiler/nodes/statements/empty.d.ts
|
|
152
|
+
interface PyEmptyStatement extends PyNodeBase {
|
|
153
|
+
kind: PyNodeKind.EmptyStatement;
|
|
154
|
+
}
|
|
155
|
+
declare function createEmptyStatement(): PyEmptyStatement;
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/py-compiler/nodes/statements/expression.d.ts
|
|
158
|
+
interface PyExpressionStatement extends PyNodeBase {
|
|
159
|
+
expression: PyExpression;
|
|
160
|
+
kind: PyNodeKind.ExpressionStatement;
|
|
161
|
+
}
|
|
162
|
+
declare function createExpressionStatement(expression: PyExpression): PyExpressionStatement;
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/py-compiler/nodes/statements/for.d.ts
|
|
165
|
+
interface PyForStatement extends PyNodeBase {
|
|
166
|
+
body: PyBlock;
|
|
167
|
+
elseBlock?: PyBlock;
|
|
168
|
+
iterable: PyExpression;
|
|
169
|
+
kind: PyNodeKind.ForStatement;
|
|
170
|
+
target: PyExpression;
|
|
171
|
+
}
|
|
172
|
+
declare function createForStatement(target: PyExpression, iterable: PyExpression, body: ReadonlyArray<PyStatement>, elseBlock?: ReadonlyArray<PyStatement>): PyForStatement;
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/py-compiler/nodes/statements/if.d.ts
|
|
175
|
+
interface PyIfStatement extends PyNodeBase {
|
|
176
|
+
condition: PyExpression;
|
|
177
|
+
elseBlock?: PyBlock | PyIfStatement;
|
|
178
|
+
kind: PyNodeKind.IfStatement;
|
|
179
|
+
thenBlock: PyBlock;
|
|
180
|
+
}
|
|
181
|
+
declare function createIfStatement(condition: PyExpression, thenBlock: ReadonlyArray<PyStatement>, elseBlock?: ReadonlyArray<PyStatement> | PyIfStatement, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyIfStatement;
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/py-compiler/nodes/statements/import.d.ts
|
|
184
|
+
interface PyImportStatement extends PyNodeBase {
|
|
185
|
+
isFrom: boolean;
|
|
186
|
+
kind: PyNodeKind.ImportStatement;
|
|
187
|
+
module: string;
|
|
188
|
+
names?: ReadonlyArray<{
|
|
189
|
+
alias?: string;
|
|
190
|
+
name: string;
|
|
191
|
+
}>;
|
|
192
|
+
}
|
|
193
|
+
declare function createImportStatement(module: string, names?: ReadonlyArray<{
|
|
194
|
+
alias?: string;
|
|
195
|
+
name: string;
|
|
196
|
+
}>, isFrom?: boolean): PyImportStatement;
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/py-compiler/nodes/statements/raise.d.ts
|
|
199
|
+
interface PyRaiseStatement extends PyNodeBase {
|
|
200
|
+
expression?: PyExpression;
|
|
201
|
+
kind: PyNodeKind.RaiseStatement;
|
|
202
|
+
}
|
|
203
|
+
declare function createRaiseStatement(expression?: PyExpression): PyRaiseStatement;
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/py-compiler/nodes/statements/return.d.ts
|
|
206
|
+
interface PyReturnStatement extends PyNodeBase {
|
|
207
|
+
expression?: PyExpression;
|
|
208
|
+
kind: PyNodeKind.ReturnStatement;
|
|
209
|
+
}
|
|
210
|
+
declare function createReturnStatement(expression?: PyExpression): PyReturnStatement;
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/py-compiler/nodes/expressions/identifier.d.ts
|
|
213
|
+
interface PyIdentifier extends PyNodeBase {
|
|
214
|
+
kind: PyNodeKind.Identifier;
|
|
215
|
+
name: string;
|
|
216
|
+
}
|
|
217
|
+
declare function createIdentifier(name: string, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyIdentifier;
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/py-compiler/nodes/statements/except.d.ts
|
|
220
|
+
interface PyExceptClause extends PyNodeBase {
|
|
221
|
+
block: PyBlock;
|
|
222
|
+
exceptionName?: PyIdentifier;
|
|
223
|
+
exceptionType?: PyExpression;
|
|
224
|
+
kind: PyNodeKind.ExceptClause;
|
|
225
|
+
}
|
|
226
|
+
declare function createExceptClause(block: ReadonlyArray<PyStatement>, exceptionType?: PyExpression, exceptionName?: PyIdentifier): PyExceptClause;
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/py-compiler/nodes/statements/try.d.ts
|
|
229
|
+
interface PyTryStatement extends PyNodeBase {
|
|
230
|
+
elseBlock?: PyBlock;
|
|
231
|
+
exceptClauses?: ReadonlyArray<PyExceptClause>;
|
|
232
|
+
finallyBlock?: PyBlock;
|
|
233
|
+
kind: PyNodeKind.TryStatement;
|
|
234
|
+
tryBlock: PyBlock;
|
|
235
|
+
}
|
|
236
|
+
declare function createTryStatement(tryBlock: ReadonlyArray<PyStatement>, exceptClauses?: ReadonlyArray<PyExceptClause>, elseBlock?: ReadonlyArray<PyStatement>, finallyBlock?: ReadonlyArray<PyStatement>): PyTryStatement;
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/py-compiler/nodes/statements/while.d.ts
|
|
239
|
+
interface PyWhileStatement extends PyNodeBase {
|
|
240
|
+
body: PyBlock;
|
|
241
|
+
condition: PyExpression;
|
|
242
|
+
elseBlock?: PyBlock;
|
|
243
|
+
kind: PyNodeKind.WhileStatement;
|
|
244
|
+
}
|
|
245
|
+
declare function createWhileStatement(condition: PyExpression, body: ReadonlyArray<PyStatement>, elseBlock?: ReadonlyArray<PyStatement>): PyWhileStatement;
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/py-compiler/nodes/statements/with-item.d.ts
|
|
248
|
+
interface PyWithItem extends PyNodeBase {
|
|
249
|
+
alias?: PyExpression;
|
|
250
|
+
contextExpr: PyExpression;
|
|
251
|
+
kind: PyNodeKind.WithItem;
|
|
252
|
+
}
|
|
253
|
+
declare function createWithItem(contextExpr: PyExpression, alias?: PyExpression, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyWithItem;
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/py-compiler/nodes/statements/with.d.ts
|
|
256
|
+
interface PyWithStatement extends PyNodeBase {
|
|
257
|
+
body: PyBlock;
|
|
258
|
+
items: ReadonlyArray<PyWithItem>;
|
|
259
|
+
kind: PyNodeKind.WithStatement;
|
|
260
|
+
modifiers?: ReadonlyArray<PyExpression>;
|
|
261
|
+
}
|
|
262
|
+
declare function createWithStatement(items: ReadonlyArray<PyWithItem>, body: ReadonlyArray<PyStatement>, modifiers?: ReadonlyArray<PyExpression>, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyWithStatement;
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/py-compiler/nodes/structure/comment.d.ts
|
|
265
|
+
interface PyComment extends PyNodeBase {
|
|
266
|
+
kind: PyNodeKind.Comment;
|
|
267
|
+
text: string;
|
|
268
|
+
}
|
|
269
|
+
declare function createComment(text: string): PyComment;
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region src/py-compiler/nodes/statement.d.ts
|
|
272
|
+
type PyStatement = PyAssignment | PyAugmentedAssignment | PyBreakStatement | PyClassDeclaration | PyComment | PyContinueStatement | PyEmptyStatement | PyExpressionStatement | PyForStatement | PyFunctionDeclaration | PyFunctionParameter | PyIfStatement | PyImportStatement | PyRaiseStatement | PyReturnStatement | PyTryStatement | PyWhileStatement | PyWithStatement;
|
|
273
|
+
//#endregion
|
|
274
|
+
//#region src/py-compiler/nodes/structure/source-file.d.ts
|
|
275
|
+
interface PySourceFile extends PyNodeBase {
|
|
276
|
+
docstring?: string;
|
|
277
|
+
kind: PyNodeKind.SourceFile;
|
|
278
|
+
statements: ReadonlyArray<PyNode>;
|
|
279
|
+
}
|
|
280
|
+
declare function createSourceFile(statements: ReadonlyArray<PyNode>, docstring?: string, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PySourceFile;
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/py-compiler/nodes/base.d.ts
|
|
283
|
+
interface PyNodeBase {
|
|
284
|
+
kind: PyNodeKind;
|
|
285
|
+
leadingComments?: ReadonlyArray<string>;
|
|
286
|
+
trailingComments?: ReadonlyArray<string>;
|
|
287
|
+
}
|
|
288
|
+
type PyNode = PyBlock | PyExpression | PySourceFile | PyStatement;
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/py-compiler/nodes/expressions/comprehensions/dict.d.ts
|
|
291
|
+
interface PyDictComprehension extends PyComprehensionNode {
|
|
292
|
+
key: PyExpression;
|
|
293
|
+
kind: PyNodeKind.DictComprehension;
|
|
294
|
+
value: PyExpression;
|
|
295
|
+
}
|
|
296
|
+
declare function createDictComprehension(key: PyExpression, value: PyExpression, target: PyExpression, iterable: PyExpression, ifs?: ReadonlyArray<PyExpression>, isAsync?: boolean): PyDictComprehension;
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/py-compiler/nodes/expressions/comprehensions/list.d.ts
|
|
299
|
+
interface PyListComprehension extends PyComprehensionNode {
|
|
300
|
+
element: PyExpression;
|
|
301
|
+
kind: PyNodeKind.ListComprehension;
|
|
302
|
+
}
|
|
303
|
+
declare function createListComprehension(element: PyExpression, target: PyExpression, iterable: PyExpression, ifs?: ReadonlyArray<PyExpression>, isAsync?: boolean): PyListComprehension;
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/py-compiler/nodes/expressions/comprehensions/set.d.ts
|
|
306
|
+
interface PySetComprehension extends PyComprehensionNode {
|
|
307
|
+
element: PyExpression;
|
|
308
|
+
kind: PyNodeKind.SetComprehension;
|
|
309
|
+
}
|
|
310
|
+
declare function createSetComprehension(element: PyExpression, target: PyExpression, iterable: PyExpression, ifs?: ReadonlyArray<PyExpression>, isAsync?: boolean): PySetComprehension;
|
|
311
|
+
//#endregion
|
|
312
|
+
//#region src/py-compiler/nodes/comprehension.d.ts
|
|
313
|
+
type PyComprehension = PyDictComprehension | PyListComprehension | PySetComprehension;
|
|
314
|
+
interface PyComprehensionNode extends PyNodeBase {
|
|
315
|
+
ifs?: ReadonlyArray<PyExpression>;
|
|
316
|
+
isAsync?: boolean;
|
|
317
|
+
iterable: PyExpression;
|
|
318
|
+
target: PyExpression;
|
|
319
|
+
}
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region src/py-compiler/nodes/expressions/async.d.ts
|
|
322
|
+
interface PyAsyncExpression extends PyNodeBase {
|
|
323
|
+
expression: PyExpression;
|
|
324
|
+
kind: PyNodeKind.AsyncExpression;
|
|
325
|
+
}
|
|
326
|
+
declare function createAsyncExpression(expression: PyExpression): PyAsyncExpression;
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region src/py-compiler/nodes/expressions/await.d.ts
|
|
329
|
+
interface PyAwaitExpression extends PyNodeBase {
|
|
330
|
+
expression: PyExpression;
|
|
331
|
+
kind: PyNodeKind.AwaitExpression;
|
|
332
|
+
}
|
|
333
|
+
declare function createAwaitExpression(expression: PyExpression): PyAwaitExpression;
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/py-compiler/nodes/expressions/binary.d.ts
|
|
336
|
+
type PyBinaryOperator = '+' | '-' | '*' | '/' | '//' | '%' | '**' | '==' | '!=' | '>' | '>=' | '<' | '<=' | 'is' | 'is not' | 'in' | 'not in' | 'and' | 'or' | '|' | '&' | '^' | '<<' | '>>';
|
|
337
|
+
interface PyBinaryExpression extends PyNodeBase {
|
|
338
|
+
kind: PyNodeKind.BinaryExpression;
|
|
339
|
+
left: PyExpression;
|
|
340
|
+
operator: PyBinaryOperator;
|
|
341
|
+
right: PyExpression;
|
|
342
|
+
}
|
|
343
|
+
declare function createBinaryExpression(left: PyExpression, operator: PyBinaryOperator, right: PyExpression, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyBinaryExpression;
|
|
344
|
+
//#endregion
|
|
345
|
+
//#region src/py-compiler/nodes/expressions/call.d.ts
|
|
346
|
+
interface PyCallExpression extends PyNodeBase {
|
|
347
|
+
args: ReadonlyArray<PyExpression>;
|
|
348
|
+
callee: PyExpression;
|
|
349
|
+
kind: PyNodeKind.CallExpression;
|
|
350
|
+
}
|
|
351
|
+
declare function createCallExpression(callee: PyExpression, args: ReadonlyArray<PyExpression>, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyCallExpression;
|
|
352
|
+
//#endregion
|
|
353
|
+
//#region src/py-compiler/nodes/expressions/dict.d.ts
|
|
354
|
+
interface PyDictExpression extends PyNodeBase {
|
|
355
|
+
entries: ReadonlyArray<{
|
|
356
|
+
key: PyExpression;
|
|
357
|
+
value: PyExpression;
|
|
358
|
+
}>;
|
|
359
|
+
kind: PyNodeKind.DictExpression;
|
|
360
|
+
}
|
|
361
|
+
declare function createDictExpression(entries: ReadonlyArray<{
|
|
362
|
+
key: PyExpression;
|
|
363
|
+
value: PyExpression;
|
|
364
|
+
}>): PyDictExpression;
|
|
365
|
+
//#endregion
|
|
366
|
+
//#region src/py-compiler/nodes/expressions/f-string.d.ts
|
|
367
|
+
interface PyFStringExpression extends PyNodeBase {
|
|
368
|
+
kind: PyNodeKind.FStringExpression;
|
|
369
|
+
parts: Array<string | PyExpression>;
|
|
370
|
+
}
|
|
371
|
+
declare function createFStringExpression(parts: Array<string | PyExpression>, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyFStringExpression;
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/py-compiler/nodes/expressions/generator.d.ts
|
|
374
|
+
interface PyGeneratorExpression extends PyNodeBase {
|
|
375
|
+
element: PyExpression;
|
|
376
|
+
ifs?: ReadonlyArray<PyExpression>;
|
|
377
|
+
isAsync?: boolean;
|
|
378
|
+
iterable: PyExpression;
|
|
379
|
+
kind: PyNodeKind.GeneratorExpression;
|
|
380
|
+
target: PyExpression;
|
|
381
|
+
}
|
|
382
|
+
declare function createGeneratorExpression(element: PyExpression, target: PyExpression, iterable: PyExpression, ifs?: ReadonlyArray<PyExpression>, isAsync?: boolean, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyGeneratorExpression;
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region src/py-compiler/nodes/expressions/keyword-arg.d.ts
|
|
385
|
+
interface PyKeywordArgument extends PyNodeBase {
|
|
386
|
+
kind: PyNodeKind.KeywordArgument;
|
|
387
|
+
name: string;
|
|
388
|
+
value: PyExpression;
|
|
389
|
+
}
|
|
390
|
+
declare function createKeywordArgument(name: string, value: PyExpression, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyKeywordArgument;
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/py-compiler/nodes/expressions/lambda.d.ts
|
|
393
|
+
interface PyLambdaExpression extends PyNodeBase {
|
|
394
|
+
expression: PyExpression;
|
|
395
|
+
kind: PyNodeKind.LambdaExpression;
|
|
396
|
+
parameters: ReadonlyArray<PyFunctionParameter>;
|
|
397
|
+
}
|
|
398
|
+
declare function createLambdaExpression(parameters: ReadonlyArray<PyFunctionParameter>, expression: PyExpression): PyLambdaExpression;
|
|
399
|
+
//#endregion
|
|
400
|
+
//#region src/py-compiler/nodes/expressions/list.d.ts
|
|
401
|
+
interface PyListExpression extends PyNodeBase {
|
|
402
|
+
elements: ReadonlyArray<PyNode>;
|
|
403
|
+
kind: PyNodeKind.ListExpression;
|
|
404
|
+
}
|
|
405
|
+
declare function createListExpression(elements: ReadonlyArray<PyNode>): PyListExpression;
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/py-compiler/nodes/expressions/literal.d.ts
|
|
408
|
+
type PyLiteralValue = string | number | boolean | null;
|
|
409
|
+
interface PyLiteral extends PyNodeBase {
|
|
410
|
+
kind: PyNodeKind.Literal;
|
|
411
|
+
value: PyLiteralValue;
|
|
412
|
+
}
|
|
413
|
+
declare function createLiteral(value: PyLiteralValue, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyLiteral;
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/py-compiler/nodes/expressions/member.d.ts
|
|
416
|
+
interface PyMemberExpression extends PyNodeBase {
|
|
417
|
+
kind: PyNodeKind.MemberExpression;
|
|
418
|
+
member: PyIdentifier;
|
|
419
|
+
object: PyExpression;
|
|
420
|
+
}
|
|
421
|
+
declare function createMemberExpression(object: PyExpression, member: PyIdentifier, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyMemberExpression;
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region src/py-compiler/nodes/expressions/r-string.d.ts
|
|
424
|
+
interface PyRStringExpression extends PyNodeBase {
|
|
425
|
+
kind: PyNodeKind.RStringExpression;
|
|
426
|
+
value: string;
|
|
427
|
+
}
|
|
428
|
+
declare function createRStringExpression(value: string, leadingComments?: ReadonlyArray<string>, trailingComments?: ReadonlyArray<string>): PyRStringExpression;
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/py-compiler/nodes/expressions/set.d.ts
|
|
431
|
+
interface PySetExpression extends PyNodeBase {
|
|
432
|
+
elements: ReadonlyArray<PyExpression>;
|
|
433
|
+
kind: PyNodeKind.SetExpression;
|
|
434
|
+
}
|
|
435
|
+
declare function createSetExpression(elements: ReadonlyArray<PyExpression>): PySetExpression;
|
|
436
|
+
//#endregion
|
|
437
|
+
//#region src/py-compiler/nodes/expressions/subscript.d.ts
|
|
438
|
+
interface PySubscriptExpression extends PyNodeBase {
|
|
439
|
+
kind: PyNodeKind.SubscriptExpression;
|
|
440
|
+
slice: PyExpression;
|
|
441
|
+
value: PyExpression;
|
|
442
|
+
}
|
|
443
|
+
declare function createSubscriptExpression(value: PyExpression, slice: PyExpression): PySubscriptExpression;
|
|
444
|
+
//#endregion
|
|
445
|
+
//#region src/py-compiler/nodes/expressions/subscript-slice.d.ts
|
|
446
|
+
interface PySubscriptSlice extends PyNodeBase {
|
|
447
|
+
elements: ReadonlyArray<PyExpression>;
|
|
448
|
+
kind: PyNodeKind.SubscriptSlice;
|
|
449
|
+
}
|
|
450
|
+
declare function createSubscriptSlice(elements: ReadonlyArray<PyExpression>): PySubscriptSlice;
|
|
451
|
+
//#endregion
|
|
452
|
+
//#region src/py-compiler/nodes/expressions/tuple.d.ts
|
|
453
|
+
interface PyTupleExpression extends PyNodeBase {
|
|
454
|
+
elements: ReadonlyArray<PyExpression>;
|
|
455
|
+
kind: PyNodeKind.TupleExpression;
|
|
456
|
+
}
|
|
457
|
+
declare function createTupleExpression(elements: ReadonlyArray<PyExpression>): PyTupleExpression;
|
|
458
|
+
//#endregion
|
|
459
|
+
//#region src/py-compiler/nodes/expressions/yield.d.ts
|
|
460
|
+
interface PyYieldExpression extends PyNodeBase {
|
|
461
|
+
kind: PyNodeKind.YieldExpression;
|
|
462
|
+
value?: PyExpression;
|
|
463
|
+
}
|
|
464
|
+
declare function createYieldExpression(value?: PyExpression): PyYieldExpression;
|
|
465
|
+
//#endregion
|
|
466
|
+
//#region src/py-compiler/nodes/expressions/yield-from.d.ts
|
|
467
|
+
interface PyYieldFromExpression extends PyNodeBase {
|
|
468
|
+
expression: PyExpression;
|
|
469
|
+
kind: PyNodeKind.YieldFromExpression;
|
|
470
|
+
}
|
|
471
|
+
declare function createYieldFromExpression(expression: PyExpression): PyYieldFromExpression;
|
|
472
|
+
//#endregion
|
|
473
|
+
//#region src/py-compiler/nodes/expression.d.ts
|
|
474
|
+
type PyExpression = PyAsyncExpression | PyAwaitExpression | PyBinaryExpression | PyCallExpression | PyComprehension | PyDictExpression | PyFStringExpression | PyGeneratorExpression | PyIdentifier | PyKeywordArgument | PyLambdaExpression | PyListExpression | PyLiteral | PyMemberExpression | PyRStringExpression | PySetExpression | PySubscriptExpression | PySubscriptSlice | PyTupleExpression | PyYieldExpression | PyYieldFromExpression;
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/py-compiler/printer.d.ts
|
|
477
|
+
type QuoteStyle = 'single' | 'double';
|
|
478
|
+
type QuoteFallback = 'avoid-escape' | 'escape';
|
|
479
|
+
interface PyPrinterOptions {
|
|
480
|
+
/**
|
|
481
|
+
* Number of spaces per indentation level.
|
|
482
|
+
*
|
|
483
|
+
* @default 4
|
|
484
|
+
*/
|
|
485
|
+
indentSize?: number;
|
|
486
|
+
/**
|
|
487
|
+
* How to handle strings that contain the preferred quote character.
|
|
488
|
+
* - `'avoid-escape'`: switch to the alternative quote style to avoid
|
|
489
|
+
* escaping, unless the string contains both quote characters
|
|
490
|
+
* - `'escape'`: always use the preferred quote style, escaping conflicts
|
|
491
|
+
* with a backslash
|
|
492
|
+
*
|
|
493
|
+
* @default 'avoid-escape'
|
|
494
|
+
*/
|
|
495
|
+
quoteConflict?: QuoteFallback;
|
|
496
|
+
/**
|
|
497
|
+
* Preferred string quote character.
|
|
498
|
+
*
|
|
499
|
+
* @default 'double'
|
|
500
|
+
*/
|
|
501
|
+
quoteStyle?: QuoteStyle;
|
|
502
|
+
}
|
|
503
|
+
declare function createPrinter(options?: PyPrinterOptions): {
|
|
504
|
+
printFile: (node: PyNode) => string;
|
|
505
|
+
};
|
|
506
|
+
declare function printAst(node: PyNode): string;
|
|
507
|
+
//#endregion
|
|
508
|
+
//#region src/py-compiler/index.d.ts
|
|
509
|
+
declare namespace py {
|
|
510
|
+
type Node = PyNode;
|
|
511
|
+
type NodeBase = PyNodeBase;
|
|
512
|
+
type NodeKind = PyNodeKind;
|
|
513
|
+
type Expression = PyExpression;
|
|
514
|
+
type Statement = PyStatement;
|
|
515
|
+
type SourceFile = PySourceFile;
|
|
516
|
+
type Comment = PyComment;
|
|
517
|
+
type ClassDeclaration = PyClassDeclaration;
|
|
518
|
+
type FunctionDeclaration = PyFunctionDeclaration;
|
|
519
|
+
type FunctionParameter = PyFunctionParameter;
|
|
520
|
+
type Assignment = PyAssignment;
|
|
521
|
+
type AugmentedAssignment = PyAugmentedAssignment;
|
|
522
|
+
type AugmentedOperator = PyAugmentedOperator;
|
|
523
|
+
type Block = PyBlock;
|
|
524
|
+
type BreakStatement = PyBreakStatement;
|
|
525
|
+
type ContinueStatement = PyContinueStatement;
|
|
526
|
+
type EmptyStatement = PyEmptyStatement;
|
|
527
|
+
type ExceptClause = PyExceptClause;
|
|
528
|
+
type ExpressionStatement = PyExpressionStatement;
|
|
529
|
+
type ForStatement = PyForStatement;
|
|
530
|
+
type IfStatement = PyIfStatement;
|
|
531
|
+
type ImportStatement = PyImportStatement;
|
|
532
|
+
type RaiseStatement = PyRaiseStatement;
|
|
533
|
+
type ReturnStatement = PyReturnStatement;
|
|
534
|
+
type TryStatement = PyTryStatement;
|
|
535
|
+
type WhileStatement = PyWhileStatement;
|
|
536
|
+
type WithItem = PyWithItem;
|
|
537
|
+
type WithStatement = PyWithStatement;
|
|
538
|
+
type AsyncExpression = PyAsyncExpression;
|
|
539
|
+
type AwaitExpression = PyAwaitExpression;
|
|
540
|
+
type BinaryExpression = PyBinaryExpression;
|
|
541
|
+
type BinaryOperator = PyBinaryOperator;
|
|
542
|
+
type CallExpression = PyCallExpression;
|
|
543
|
+
type DictExpression = PyDictExpression;
|
|
544
|
+
type FStringExpression = PyFStringExpression;
|
|
545
|
+
type GeneratorExpression = PyGeneratorExpression;
|
|
546
|
+
type Identifier = PyIdentifier;
|
|
547
|
+
type KeywordArgument = PyKeywordArgument;
|
|
548
|
+
type LambdaExpression = PyLambdaExpression;
|
|
549
|
+
type ListExpression = PyListExpression;
|
|
550
|
+
type Literal = PyLiteral;
|
|
551
|
+
type MemberExpression = PyMemberExpression;
|
|
552
|
+
type RStringExpression = PyRStringExpression;
|
|
553
|
+
type SetExpression = PySetExpression;
|
|
554
|
+
type SubscriptExpression = PySubscriptExpression;
|
|
555
|
+
type SubscriptSlice = PySubscriptSlice;
|
|
556
|
+
type TupleExpression = PyTupleExpression;
|
|
557
|
+
type YieldExpression = PyYieldExpression;
|
|
558
|
+
type YieldFromExpression = PyYieldFromExpression;
|
|
559
|
+
type Comprehension = PyComprehension;
|
|
560
|
+
type ComprehensionNode = PyComprehensionNode;
|
|
561
|
+
type DictComprehension = PyDictComprehension;
|
|
562
|
+
type ListComprehension = PyListComprehension;
|
|
563
|
+
type SetComprehension = PySetComprehension;
|
|
564
|
+
type PrinterOptions = PyPrinterOptions;
|
|
565
|
+
type LiteralValue = PyLiteralValue;
|
|
566
|
+
}
|
|
567
|
+
declare const py: {
|
|
568
|
+
readonly PyNodeKind: typeof PyNodeKind;
|
|
569
|
+
readonly createPrinter: typeof createPrinter;
|
|
570
|
+
readonly factory: {
|
|
571
|
+
createAssignment: typeof createAssignment;
|
|
572
|
+
createAsyncExpression: typeof createAsyncExpression;
|
|
573
|
+
createAugmentedAssignment: typeof createAugmentedAssignment;
|
|
574
|
+
createAwaitExpression: typeof createAwaitExpression;
|
|
575
|
+
createBinaryExpression: typeof createBinaryExpression;
|
|
576
|
+
createBlock: typeof createBlock;
|
|
577
|
+
createBreakStatement: typeof createBreakStatement;
|
|
578
|
+
createCallExpression: typeof createCallExpression;
|
|
579
|
+
createClassDeclaration: typeof createClassDeclaration;
|
|
580
|
+
createComment: typeof createComment;
|
|
581
|
+
createContinueStatement: typeof createContinueStatement;
|
|
582
|
+
createDictComprehension: typeof createDictComprehension;
|
|
583
|
+
createDictExpression: typeof createDictExpression;
|
|
584
|
+
createEmptyStatement: typeof createEmptyStatement;
|
|
585
|
+
createExceptClause: typeof createExceptClause;
|
|
586
|
+
createExpressionStatement: typeof createExpressionStatement;
|
|
587
|
+
createFStringExpression: typeof createFStringExpression;
|
|
588
|
+
createForStatement: typeof createForStatement;
|
|
589
|
+
createFunctionDeclaration: typeof createFunctionDeclaration;
|
|
590
|
+
createFunctionParameter: typeof createFunctionParameter;
|
|
591
|
+
createGeneratorExpression: typeof createGeneratorExpression;
|
|
592
|
+
createIdentifier: typeof createIdentifier;
|
|
593
|
+
createIfStatement: typeof createIfStatement;
|
|
594
|
+
createImportStatement: typeof createImportStatement;
|
|
595
|
+
createKeywordArgument: typeof createKeywordArgument;
|
|
596
|
+
createLambdaExpression: typeof createLambdaExpression;
|
|
597
|
+
createListComprehension: typeof createListComprehension;
|
|
598
|
+
createListExpression: typeof createListExpression;
|
|
599
|
+
createLiteral: typeof createLiteral;
|
|
600
|
+
createMemberExpression: typeof createMemberExpression;
|
|
601
|
+
createRStringExpression: typeof createRStringExpression;
|
|
602
|
+
createRaiseStatement: typeof createRaiseStatement;
|
|
603
|
+
createReturnStatement: typeof createReturnStatement;
|
|
604
|
+
createSetComprehension: typeof createSetComprehension;
|
|
605
|
+
createSetExpression: typeof createSetExpression;
|
|
606
|
+
createSourceFile: typeof createSourceFile;
|
|
607
|
+
createSubscriptExpression: typeof createSubscriptExpression;
|
|
608
|
+
createSubscriptSlice: typeof createSubscriptSlice;
|
|
609
|
+
createTryStatement: typeof createTryStatement;
|
|
610
|
+
createTupleExpression: typeof createTupleExpression;
|
|
611
|
+
createWhileStatement: typeof createWhileStatement;
|
|
612
|
+
createWithItem: typeof createWithItem;
|
|
613
|
+
createWithStatement: typeof createWithStatement;
|
|
614
|
+
createYieldExpression: typeof createYieldExpression;
|
|
615
|
+
createYieldFromExpression: typeof createYieldFromExpression;
|
|
616
|
+
};
|
|
617
|
+
readonly printAst: typeof printAst;
|
|
618
|
+
};
|
|
619
|
+
//#endregion
|
|
620
|
+
//#region src/py-dsl/mixins/args.d.ts
|
|
621
|
+
type Arg = NodeName | MaybePyDsl<py.Expression>;
|
|
622
|
+
interface ArgsMethods extends Node$1 {
|
|
623
|
+
/** Renders the arguments into an array of `Expression`s. */
|
|
624
|
+
$args(): ReadonlyArray<py.Expression>;
|
|
625
|
+
/** Adds a single expression argument. */
|
|
626
|
+
arg(arg: Arg | undefined): this;
|
|
627
|
+
/** Adds one or more expression arguments. */
|
|
628
|
+
args(...args: ReadonlyArray<Arg | undefined>): this;
|
|
629
|
+
}
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region src/py-dsl/expr/call.d.ts
|
|
632
|
+
type CallArgs = ReadonlyArray<CallCallee | undefined>;
|
|
633
|
+
type CallCallee = NodeName | MaybePyDsl<py.Expression>;
|
|
634
|
+
type CallCtor = (callee: CallCallee, ...args: CallArgs) => CallPyDsl;
|
|
635
|
+
declare const Mixed$36: MixinCtor<MixinCtor<abstract new () => PyDsl<PyCallExpression, "python">, ExprMethods>, ArgsMethods>;
|
|
636
|
+
declare class CallPyDsl extends Mixed$36 {
|
|
637
|
+
readonly '~dsl' = "CallPyDsl";
|
|
638
|
+
protected _callee: Ref<CallCallee>;
|
|
639
|
+
constructor(callee: CallCallee, ...args: CallArgs);
|
|
640
|
+
analyze(ctx: AnalysisContext): void;
|
|
641
|
+
/** Returns true when all required builder calls are present. */
|
|
642
|
+
get isValid(): boolean;
|
|
643
|
+
toAst(): PyCallExpression;
|
|
644
|
+
$validate(): asserts this is this & {
|
|
645
|
+
_callee: MaybePyDsl<py.Expression>;
|
|
646
|
+
};
|
|
647
|
+
private missingRequiredCalls;
|
|
648
|
+
}
|
|
649
|
+
//#endregion
|
|
650
|
+
//#region src/py-dsl/utils/context.d.ts
|
|
651
|
+
type NodeChain = ReadonlyArray<PyDsl>;
|
|
652
|
+
interface AccessOptions {
|
|
653
|
+
/** The access context. */
|
|
654
|
+
context?: 'example';
|
|
655
|
+
/** Enable debug mode. */
|
|
656
|
+
debug?: boolean;
|
|
657
|
+
/** Transform function for each node in the access chain. */
|
|
658
|
+
transform?: (node: PyDsl, index: number, chain: NodeChain) => PyDsl;
|
|
659
|
+
}
|
|
660
|
+
interface ExampleOptions {
|
|
661
|
+
/** Import kind for the root node. */
|
|
662
|
+
importKind?: BindingKind;
|
|
663
|
+
/** Import name for the root node. */
|
|
664
|
+
importName?: string;
|
|
665
|
+
/** Setup to run before calling the example. */
|
|
666
|
+
importSetup?: MaybeFunc<(ctx: DollarPyDsl & {
|
|
667
|
+
/** The imported expression. */node: PyDsl<py.Expression>;
|
|
668
|
+
}) => PyDsl<py.Expression>>;
|
|
669
|
+
/** Module to import from. */
|
|
670
|
+
moduleName?: string;
|
|
671
|
+
/** Example request payload. */
|
|
672
|
+
payload?: MaybeFunc<(ctx: DollarPyDsl) => CallArgs | CallArgs[number]>;
|
|
673
|
+
/** Variable name for setup node. */
|
|
674
|
+
setupName?: string;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Fold a structural chain to an access chain by removing
|
|
678
|
+
* non-accessor nodes.
|
|
679
|
+
*/
|
|
680
|
+
declare class PyDslContext {}
|
|
681
|
+
//#endregion
|
|
682
|
+
//#region src/py-dsl/base.d.ts
|
|
683
|
+
declare abstract class PyDsl<T extends py.Node = py.Node, L extends Language = 'python'> implements Node$1<T, L> {
|
|
684
|
+
analyze(_: AnalysisContext): void;
|
|
685
|
+
clone(): this;
|
|
686
|
+
exported?: boolean;
|
|
687
|
+
file?: File;
|
|
688
|
+
get name(): Node$1['name'];
|
|
689
|
+
readonly nameSanitizer?: NodeNameSanitizer;
|
|
690
|
+
language: L;
|
|
691
|
+
meta: Required<ProjectMeta>[L];
|
|
692
|
+
parent?: Node$1;
|
|
693
|
+
root: boolean;
|
|
694
|
+
scope?: NodeScope;
|
|
695
|
+
structuralChildren?: Map<PyDsl, NodeRelationship>;
|
|
696
|
+
structuralParents?: Map<PyDsl, NodeRelationship>;
|
|
697
|
+
symbol?: Symbol;
|
|
698
|
+
toAst(): T;
|
|
699
|
+
readonly '~brand' = "heyapi.node";
|
|
700
|
+
/** Branding property to identify the DSL class at runtime. */
|
|
701
|
+
abstract readonly '~dsl': AnyString;
|
|
702
|
+
/** Conditionally applies a callback to this builder. */
|
|
703
|
+
$if<T extends PyDsl, V, R extends PyDsl = T>(this: T, value: V, ifTrue: (self: T, v: Exclude<V, false | null | undefined>) => R | void, ifFalse?: (self: T, v: Extract<V, false | null | undefined>) => R | void): R | T;
|
|
704
|
+
$if<T extends PyDsl, V, R extends PyDsl = T>(this: T, value: V, ifTrue: (v: Exclude<V, false | null | undefined>) => R | void, ifFalse?: (v: Extract<V, false | null | undefined>) => R | void): R | T;
|
|
705
|
+
$if<T extends PyDsl, V, R extends PyDsl = T>(this: T, value: V, ifTrue: () => R | void, ifFalse?: () => R | void): R | T;
|
|
706
|
+
/** Access patterns for this node. */
|
|
707
|
+
toAccessNode?(node: this, options: AccessOptions, ctx: {
|
|
708
|
+
/** The full chain. */chain: ReadonlyArray<PyDsl>; /** Position in the chain (0 = root). */
|
|
709
|
+
index: number; /** Is this the leaf node? */
|
|
710
|
+
isLeaf: boolean; /** Is this the root node? */
|
|
711
|
+
isRoot: boolean; /** Total length of the chain. */
|
|
712
|
+
length: number;
|
|
713
|
+
}): PyDsl | undefined;
|
|
714
|
+
protected $maybeId<T extends string | py.Expression>(expr: T): T extends string ? py.Identifier : T;
|
|
715
|
+
protected $name(name: Ref<NodeName>): string;
|
|
716
|
+
protected $node<I>(value: I): NodeOfMaybe<I>;
|
|
717
|
+
private _name?;
|
|
718
|
+
/** Unwraps nested nodes into raw Python AST. */
|
|
719
|
+
private unwrap;
|
|
720
|
+
}
|
|
721
|
+
type NodeOfMaybe<I> = undefined extends I ? NodeOf<NonNullable<FromRef<I>>> | undefined : NodeOf<FromRef<I>>;
|
|
722
|
+
type NodeOf<I> = I extends ReadonlyArray<infer U> ? ReadonlyArray<U extends PyDsl<infer N> ? N : U> : I extends string ? py.Expression : I extends PyDsl<infer N> ? N : I extends py.Node ? I : never;
|
|
723
|
+
type MaybePyDsl<T> = [T] extends [PyDsl<infer U>] ? U | PyDsl<U> : [T] extends [py.Node] ? T | PyDsl<T> : never;
|
|
724
|
+
//#endregion
|
|
725
|
+
//#region src/py-dsl/mixins/types.d.ts
|
|
726
|
+
type BaseCtor<T extends py.Node> = abstract new (...args: Array<any>) => PyDsl<T>;
|
|
727
|
+
type DropFirst<T extends Array<any>> = T extends [any, ...infer Rest] ? Rest : never;
|
|
728
|
+
type MixinCtor<T extends BaseCtor<any>, K> = abstract new (...args: Array<any>) => InstanceType<T> & K;
|
|
729
|
+
//#endregion
|
|
730
|
+
//#region src/py-dsl/expr/attr.d.ts
|
|
731
|
+
type AttrLeft = NodeName | MaybePyDsl<py.Expression>;
|
|
732
|
+
type AttrCtor = (left: AttrLeft, right: NodeName) => AttrPyDsl;
|
|
733
|
+
declare const Mixed$35: MixinCtor<abstract new () => PyDsl<PyMemberExpression, "python">, ExprMethods>;
|
|
734
|
+
declare class AttrPyDsl extends Mixed$35 {
|
|
735
|
+
readonly '~dsl' = "AttrPyDsl";
|
|
736
|
+
protected left: Ref<AttrLeft>;
|
|
737
|
+
constructor(left: AttrLeft, right: NodeName);
|
|
738
|
+
analyze(ctx: AnalysisContext): void;
|
|
739
|
+
/** Returns true when all required builder calls are present. */
|
|
740
|
+
get isValid(): boolean;
|
|
741
|
+
toAst(): PyMemberExpression;
|
|
742
|
+
$validate(): asserts this is this & {
|
|
743
|
+
left: MaybePyDsl<py.Expression>;
|
|
744
|
+
};
|
|
745
|
+
private missingRequiredCalls;
|
|
746
|
+
}
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region src/py-dsl/expr/binary.d.ts
|
|
749
|
+
type BinaryCtor = (left: MaybePyDsl<py.Expression>, op: PyBinaryOperator, right: MaybePyDsl<py.Expression>) => BinaryPyDsl;
|
|
750
|
+
declare const Mixed$34: abstract new () => PyDsl<PyBinaryExpression, "python">;
|
|
751
|
+
declare class BinaryPyDsl extends Mixed$34 {
|
|
752
|
+
readonly '~dsl' = "BinaryPyDsl";
|
|
753
|
+
protected _left?: Ref<MaybePyDsl<py.Expression>>;
|
|
754
|
+
protected _op?: PyBinaryOperator;
|
|
755
|
+
protected _right?: Ref<MaybePyDsl<py.Expression>>;
|
|
756
|
+
constructor(left: MaybePyDsl<py.Expression>, op: PyBinaryOperator, right: MaybePyDsl<py.Expression>);
|
|
757
|
+
analyze(ctx: AnalysisContext): void;
|
|
758
|
+
/** Returns true when all required builder calls are present. */
|
|
759
|
+
get isValid(): boolean;
|
|
760
|
+
and(right: MaybePyDsl<py.Expression>): this;
|
|
761
|
+
div(right: MaybePyDsl<py.Expression>): this;
|
|
762
|
+
eq(right: MaybePyDsl<py.Expression>): this;
|
|
763
|
+
floordiv(right: MaybePyDsl<py.Expression>): this;
|
|
764
|
+
gt(right: MaybePyDsl<py.Expression>): this;
|
|
765
|
+
gte(right: MaybePyDsl<py.Expression>): this;
|
|
766
|
+
in_(right: MaybePyDsl<py.Expression>): this;
|
|
767
|
+
is(right: MaybePyDsl<py.Expression>): this;
|
|
768
|
+
isNot(right: MaybePyDsl<py.Expression>): this;
|
|
769
|
+
lt(right: MaybePyDsl<py.Expression>): this;
|
|
770
|
+
lte(right: MaybePyDsl<py.Expression>): this;
|
|
771
|
+
minus(right: MaybePyDsl<py.Expression>): this;
|
|
772
|
+
mod(right: MaybePyDsl<py.Expression>): this;
|
|
773
|
+
neq(right: MaybePyDsl<py.Expression>): this;
|
|
774
|
+
notIn(right: MaybePyDsl<py.Expression>): this;
|
|
775
|
+
or(right: MaybePyDsl<py.Expression>): this;
|
|
776
|
+
plus(right: MaybePyDsl<py.Expression>): this;
|
|
777
|
+
pow(right: MaybePyDsl<py.Expression>): this;
|
|
778
|
+
times(right: MaybePyDsl<py.Expression>): this;
|
|
779
|
+
toAst(): PyBinaryExpression;
|
|
780
|
+
$validate(): asserts this is this & {
|
|
781
|
+
_left: MaybePyDsl<py.Expression>;
|
|
782
|
+
_op: PyBinaryOperator;
|
|
783
|
+
_right: MaybePyDsl<py.Expression>;
|
|
784
|
+
};
|
|
785
|
+
private missingRequiredCalls;
|
|
786
|
+
private opAndExpr;
|
|
787
|
+
}
|
|
788
|
+
//#endregion
|
|
789
|
+
//#region src/py-dsl/mixins/layout.d.ts
|
|
790
|
+
interface LayoutMethods extends Node$1 {
|
|
791
|
+
/** Computes whether output should be multiline based on layout setting and element count. */
|
|
792
|
+
$multiline(count: number): boolean;
|
|
793
|
+
/** Sets automatic line output with optional threshold (default: 3). */
|
|
794
|
+
auto(threshold?: number): this;
|
|
795
|
+
/** Sets single line output. */
|
|
796
|
+
inline(): this;
|
|
797
|
+
/** Sets multi line output. */
|
|
798
|
+
pretty(): this;
|
|
799
|
+
}
|
|
800
|
+
//#endregion
|
|
801
|
+
//#region src/py-dsl/expr/subscript.d.ts
|
|
802
|
+
type SubscriptExpr = NodeName | MaybePyDsl<py.Expression>;
|
|
803
|
+
type SubscriptCtor = (value: SubscriptExpr, ...slices: Array<SubscriptExpr>) => SubscriptPyDsl;
|
|
804
|
+
declare const Mixed$33: MixinCtor<abstract new () => PyDsl<PySubscriptExpression, "python">, LayoutMethods>;
|
|
805
|
+
declare class SubscriptPyDsl extends Mixed$33 {
|
|
806
|
+
readonly '~dsl' = "SubscriptPyDsl";
|
|
807
|
+
protected _slices: Array<Ref<SubscriptExpr>>;
|
|
808
|
+
protected _value: Ref<SubscriptExpr>;
|
|
809
|
+
constructor(value: SubscriptExpr, ...slices: Array<SubscriptExpr>);
|
|
810
|
+
analyze(ctx: AnalysisContext): void;
|
|
811
|
+
toAst(): PySubscriptExpression;
|
|
812
|
+
}
|
|
813
|
+
//#endregion
|
|
814
|
+
//#region src/py-dsl/expr/tuple.d.ts
|
|
815
|
+
type TupleElement = NodeName | MaybePyDsl<py.Expression>;
|
|
816
|
+
type TupleCtor = (...elements: Array<TupleElement>) => TuplePyDsl;
|
|
817
|
+
declare const Mixed$32: MixinCtor<abstract new () => PyDsl<PyTupleExpression, "python">, LayoutMethods>;
|
|
818
|
+
declare class TuplePyDsl extends Mixed$32 {
|
|
819
|
+
readonly '~dsl' = "TuplePyDsl";
|
|
820
|
+
protected _elements: Array<Ref<TupleElement>>;
|
|
821
|
+
constructor(...elements: Array<TupleElement>);
|
|
822
|
+
analyze(ctx: AnalysisContext): void;
|
|
823
|
+
element(expr: TupleElement): this;
|
|
824
|
+
elements(...exprs: ReadonlyArray<TupleElement>): this;
|
|
825
|
+
toAst(): PyTupleExpression;
|
|
826
|
+
}
|
|
827
|
+
//#endregion
|
|
828
|
+
//#region src/py-dsl/stmt/return.d.ts
|
|
829
|
+
type ReturnExpr = NodeName | MaybePyDsl<py.Expression>;
|
|
830
|
+
type ReturnCtor = (expr?: ReturnExpr) => ReturnPyDsl;
|
|
831
|
+
declare const Mixed$31: abstract new () => PyDsl<PyReturnStatement, "python">;
|
|
832
|
+
declare class ReturnPyDsl extends Mixed$31 {
|
|
833
|
+
readonly '~dsl' = "ReturnPyDsl";
|
|
834
|
+
protected _returnExpr?: Ref<ReturnExpr>;
|
|
835
|
+
constructor(expr?: ReturnExpr);
|
|
836
|
+
analyze(ctx: AnalysisContext): void;
|
|
837
|
+
toAst(): PyReturnStatement;
|
|
838
|
+
}
|
|
839
|
+
//#endregion
|
|
840
|
+
//#region src/py-dsl/utils/factories.d.ts
|
|
841
|
+
type Ctor = (...args: Array<any>) => any;
|
|
842
|
+
type Factory<T extends Ctor> = {
|
|
843
|
+
(...args: Parameters<T>): ReturnType<T>; /** Sets the implementation of this factory. */
|
|
844
|
+
set(fn: T): void;
|
|
845
|
+
};
|
|
846
|
+
declare const f: {
|
|
847
|
+
/** Factory for creating property access expressions (e.g., `obj.foo`). */attr: Factory<AttrCtor>; /** Factory for creating binary expressions (e.g., `a + b`). */
|
|
848
|
+
binary: Factory<BinaryCtor>; /** Factory for creating function or method call expressions (e.g., `fn(arg)`). */
|
|
849
|
+
call: Factory<CallCtor>; /** Factory for creating expression nodes. */
|
|
850
|
+
expr: Factory<ExprCtor>; /** Factory for creating return statements. */
|
|
851
|
+
return: Factory<ReturnCtor>; /** Factory for creating slice expressions. */
|
|
852
|
+
slice: Factory<SubscriptCtor>; /** Factory for creating tuple expressions. */
|
|
853
|
+
tuple: Factory<TupleCtor>;
|
|
854
|
+
};
|
|
855
|
+
//#endregion
|
|
856
|
+
//#region src/py-dsl/mixins/expr.d.ts
|
|
857
|
+
interface ExprMethods extends Node$1 {
|
|
858
|
+
/** Accesses a property on the current expression (e.g., `this.foo`). */
|
|
859
|
+
attr(...args: DropFirst<Parameters<typeof f.attr>>): ReturnType<typeof f.attr>;
|
|
860
|
+
/** Calls the current expression (e.g., `fn(arg1, arg2)`). */
|
|
861
|
+
call(...args: DropFirst<Parameters<typeof f.call>>): ReturnType<typeof f.call>;
|
|
862
|
+
/** Produces a `return` statement returning the current expression. */
|
|
863
|
+
return(): ReturnType<typeof f.return>;
|
|
864
|
+
/** Produces a subscript/slice expression (e.g., `expr[args]`). */
|
|
865
|
+
slice(...args: DropFirst<Parameters<typeof f.slice>>): ReturnType<typeof f.slice>;
|
|
866
|
+
}
|
|
867
|
+
//#endregion
|
|
868
|
+
//#region src/py-dsl/expr/expr.d.ts
|
|
869
|
+
type ExprId = NodeName | MaybePyDsl<py.Expression>;
|
|
870
|
+
type ExprCtor = (id: ExprId) => ExprPyDsl;
|
|
871
|
+
declare const Mixed$30: MixinCtor<abstract new () => PyDsl<PyExpression, "python">, ExprMethods>;
|
|
872
|
+
declare class ExprPyDsl extends Mixed$30 {
|
|
873
|
+
readonly '~dsl' = "ExprPyDsl";
|
|
874
|
+
protected _exprInput: Ref<ExprId>;
|
|
875
|
+
constructor(id: ExprId);
|
|
876
|
+
analyze(ctx: AnalysisContext): void;
|
|
877
|
+
toAst(): PyExpression;
|
|
878
|
+
}
|
|
879
|
+
//#endregion
|
|
880
|
+
//#region src/py-dsl/layout/doc.d.ts
|
|
881
|
+
type DocMaybeLazy<T> = ((ctx: PyDslContext) => T) | T;
|
|
882
|
+
type DocFn = (d: DocPyDsl) => void;
|
|
883
|
+
type DocLines = DocMaybeLazy<MaybeArray<string>>;
|
|
884
|
+
declare class DocPyDsl extends PyDsl<py.Comment> {
|
|
885
|
+
readonly '~dsl' = "DocPyDsl";
|
|
886
|
+
protected _lines: Array<DocLines>;
|
|
887
|
+
constructor(lines?: DocLines, fn?: DocFn);
|
|
888
|
+
analyze(ctx: AnalysisContext): void;
|
|
889
|
+
add(lines: DocLines): this;
|
|
890
|
+
resolve(): string | undefined;
|
|
891
|
+
toAst(): PyComment;
|
|
892
|
+
}
|
|
893
|
+
//#endregion
|
|
894
|
+
//#region src/py-dsl/layout/hint.d.ts
|
|
895
|
+
type HintMaybeLazy<T> = ((ctx: PyDslContext) => T) | T;
|
|
896
|
+
type HintFn = (d: HintPyDsl) => void;
|
|
897
|
+
type HintLines = HintMaybeLazy<MaybeArray<string>>;
|
|
898
|
+
declare class HintPyDsl extends PyDsl<py.Comment> {
|
|
899
|
+
readonly '~dsl' = "HintPyDsl";
|
|
900
|
+
protected _lines: Array<HintLines>;
|
|
901
|
+
constructor(lines?: HintLines, fn?: HintFn);
|
|
902
|
+
analyze(ctx: AnalysisContext): void;
|
|
903
|
+
add(lines: HintLines): this;
|
|
904
|
+
apply<T extends py.Node>(node: T): T;
|
|
905
|
+
toAst(): PyComment;
|
|
906
|
+
private _resolveLines;
|
|
907
|
+
}
|
|
908
|
+
//#endregion
|
|
909
|
+
//#region src/py-dsl/mixins/do.d.ts
|
|
910
|
+
type DoExpr = MaybePyDsl<py.Expression | py.Statement>;
|
|
911
|
+
interface DoMethods extends Node$1 {
|
|
912
|
+
/** Renders the collected `.do()` calls into an array of `py.Statement` nodes. */
|
|
913
|
+
$do(): ReadonlyArray<py.Statement>;
|
|
914
|
+
_do: Array<DoExpr>;
|
|
915
|
+
/** Adds one or more expressions/statements to the body. */
|
|
916
|
+
do(...items: ReadonlyArray<DoExpr>): this;
|
|
917
|
+
}
|
|
918
|
+
//#endregion
|
|
919
|
+
//#region src/py-dsl/stmt/if.d.ts
|
|
920
|
+
type IfCondition = string | MaybePyDsl<py.Expression>;
|
|
921
|
+
declare const Mixed$29: MixinCtor<abstract new () => PyDsl<PyIfStatement, "python">, DoMethods>;
|
|
922
|
+
declare class IfPyDsl extends Mixed$29 {
|
|
923
|
+
readonly '~dsl' = "IfPyDsl";
|
|
924
|
+
protected _condition?: IfCondition;
|
|
925
|
+
protected _else?: Array<DoExpr>;
|
|
926
|
+
constructor(condition?: IfCondition);
|
|
927
|
+
analyze(ctx: AnalysisContext): void;
|
|
928
|
+
/** Returns true when all required builder calls are present. */
|
|
929
|
+
get isValid(): boolean;
|
|
930
|
+
condition(condition: IfCondition): this;
|
|
931
|
+
otherwise(...items: Array<DoExpr>): this;
|
|
932
|
+
toAst(): PyIfStatement;
|
|
933
|
+
$validate(): asserts this is this & {
|
|
934
|
+
_condition: IfCondition;
|
|
935
|
+
};
|
|
936
|
+
private missingRequiredCalls;
|
|
937
|
+
}
|
|
938
|
+
//#endregion
|
|
939
|
+
//#region src/py-dsl/utils/r-string.d.ts
|
|
940
|
+
declare class RString {
|
|
941
|
+
readonly value: string;
|
|
942
|
+
readonly '~brand': "RString";
|
|
943
|
+
constructor(value: string);
|
|
944
|
+
}
|
|
945
|
+
//#endregion
|
|
946
|
+
//#region src/py-dsl/expr/kwarg.d.ts
|
|
947
|
+
type KwargValue = string | number | boolean | null | RString | MaybePyDsl<py.Expression>;
|
|
948
|
+
declare const Mixed$28: abstract new () => PyDsl<PyKeywordArgument, "python">;
|
|
949
|
+
declare class KwargPyDsl extends Mixed$28 {
|
|
950
|
+
readonly '~dsl' = "KwargPyDsl";
|
|
951
|
+
protected _value: KwargValue;
|
|
952
|
+
constructor(name: NodeName, value: KwargValue);
|
|
953
|
+
get key(): string;
|
|
954
|
+
toAst(): PyKeywordArgument;
|
|
955
|
+
private $valueToNode;
|
|
956
|
+
}
|
|
957
|
+
//#endregion
|
|
958
|
+
//#region src/py-dsl/utils/lazy.d.ts
|
|
959
|
+
type LazyThunk<T extends py.Node> = (ctx: PyDslContext) => PyDsl<T>;
|
|
960
|
+
declare class LazyPyDsl<T extends py.Node = py.Node> extends PyDsl<T> {
|
|
961
|
+
readonly '~dsl' = "LazyPyDsl";
|
|
962
|
+
private _thunk;
|
|
963
|
+
private _result?;
|
|
964
|
+
constructor(thunk: LazyThunk<T>);
|
|
965
|
+
analyze(ctx: AnalysisContext): void;
|
|
966
|
+
toResult(): PyDsl<T>;
|
|
967
|
+
toAst(): T;
|
|
968
|
+
}
|
|
969
|
+
//#endregion
|
|
970
|
+
//#region src/py-dsl/decl/param.d.ts
|
|
971
|
+
type ParamDefaultValue = NodeName | py.Expression | undefined;
|
|
972
|
+
type ParamFn = (p: ParamPyDsl) => void;
|
|
973
|
+
type ParamName = NodeName | ParamFn;
|
|
974
|
+
type ParamType = NodeName | PyDsl<py.Expression> | undefined;
|
|
975
|
+
type ParamCtor = (name: ParamName, fn?: ParamFn) => ParamPyDsl;
|
|
976
|
+
declare class ParamPyDsl extends PyDsl<py.FunctionParameter> {
|
|
977
|
+
readonly '~dsl' = "ParamPyDsl";
|
|
978
|
+
protected _defaultValue?: Ref<ParamDefaultValue>;
|
|
979
|
+
protected _type?: Ref<ParamType>;
|
|
980
|
+
constructor(name: ParamName, fn?: ParamFn);
|
|
981
|
+
analyze(ctx: AnalysisContext): void;
|
|
982
|
+
/** Sets the parameter default value. */
|
|
983
|
+
default(value: ParamDefaultValue): this;
|
|
984
|
+
get isValid(): boolean;
|
|
985
|
+
/** Sets the parameter type. */
|
|
986
|
+
type(type: ParamType): this;
|
|
987
|
+
toAst(): PyFunctionParameter;
|
|
988
|
+
$validate(): asserts this;
|
|
989
|
+
private missingRequiredCalls;
|
|
990
|
+
}
|
|
991
|
+
//#endregion
|
|
992
|
+
//#region src/py-dsl/mixins/modifiers.d.ts
|
|
993
|
+
type Modifiers = {
|
|
994
|
+
/**
|
|
995
|
+
* Checks if specified modifier is present.
|
|
996
|
+
*
|
|
997
|
+
* @param modifier - The modifier to check.
|
|
998
|
+
* @returns True if modifier is present, false otherwise.
|
|
999
|
+
*/
|
|
1000
|
+
hasModifier(modifier: Modifier): boolean;
|
|
1001
|
+
modifiers: Array<py.Expression>;
|
|
1002
|
+
};
|
|
1003
|
+
type Modifier = 'async';
|
|
1004
|
+
interface AsyncMethods extends Modifiers {
|
|
1005
|
+
/**
|
|
1006
|
+
* Adds an `async` keyword modifier if condition is true.
|
|
1007
|
+
*
|
|
1008
|
+
* @param condition - Whether to add modifier (default: true).
|
|
1009
|
+
* @returns The target object for chaining.
|
|
1010
|
+
*/
|
|
1011
|
+
async(condition?: boolean): this;
|
|
1012
|
+
}
|
|
1013
|
+
interface ExportMethods extends Modifiers {
|
|
1014
|
+
/**
|
|
1015
|
+
* Adds the `export` keyword modifier if the condition is true.
|
|
1016
|
+
*
|
|
1017
|
+
* @param condition - Whether to add the modifier (default: true).
|
|
1018
|
+
* @returns The target object for chaining.
|
|
1019
|
+
*/
|
|
1020
|
+
export(condition?: boolean): this;
|
|
1021
|
+
}
|
|
1022
|
+
//#endregion
|
|
1023
|
+
//#region src/py-dsl/mixins/doc.d.ts
|
|
1024
|
+
interface DocMethods extends Node$1 {
|
|
1025
|
+
$docs(): string | undefined;
|
|
1026
|
+
doc(lines?: DocLines, fn?: DocFn): this;
|
|
1027
|
+
}
|
|
1028
|
+
//#endregion
|
|
1029
|
+
//#region src/py-dsl/mixins/decorator.d.ts
|
|
1030
|
+
type DecoratorArg = MaybePyDsl<py.Expression>;
|
|
1031
|
+
type DecoratorName = NodeName | MaybePyDsl<py.Expression>;
|
|
1032
|
+
interface DecoratorMethods extends Node {
|
|
1033
|
+
$decorators(): ReadonlyArray<py.Expression>;
|
|
1034
|
+
decorator(name: DecoratorName, ...args: ReadonlyArray<DecoratorArg>): this;
|
|
1035
|
+
}
|
|
1036
|
+
//#endregion
|
|
1037
|
+
//#region src/py-dsl/utils/name.d.ts
|
|
1038
|
+
declare function safeRuntimeName(name: string): string;
|
|
1039
|
+
declare function safeKeywordName(name: string): string;
|
|
1040
|
+
//#endregion
|
|
1041
|
+
//#region src/py-dsl/decl/class.d.ts
|
|
1042
|
+
type ClassBody = Array<PyDsl<py.Statement>>;
|
|
1043
|
+
declare const Mixed$27: MixinCtor<MixinCtor<MixinCtor<MixinCtor<abstract new () => PyDsl<PyClassDeclaration, "python">, LayoutMethods>, ExportMethods>, DocMethods>, DecoratorMethods>;
|
|
1044
|
+
declare class ClassPyDsl extends Mixed$27 {
|
|
1045
|
+
readonly '~dsl' = "ClassPyDsl";
|
|
1046
|
+
readonly nameSanitizer: typeof safeRuntimeName;
|
|
1047
|
+
protected baseClasses: Array<Ref<NodeName | SubscriptExpr>>;
|
|
1048
|
+
protected body: ClassBody;
|
|
1049
|
+
constructor(name: NodeName);
|
|
1050
|
+
analyze(ctx: AnalysisContext): void;
|
|
1051
|
+
/** Returns true when all required builder calls are present. */
|
|
1052
|
+
get isValid(): boolean;
|
|
1053
|
+
/** Returns true if the class has any members. */
|
|
1054
|
+
get hasBody(): boolean;
|
|
1055
|
+
/** Adds one or more class members (fields, methods, etc.). */
|
|
1056
|
+
do(...items: ClassBody): this;
|
|
1057
|
+
/** Records base classes to extend from. */
|
|
1058
|
+
extends(...baseClass: ReadonlyArray<NodeName | SubscriptExpr>): this;
|
|
1059
|
+
/** Inserts an empty line between members for formatting. */
|
|
1060
|
+
newline(): this;
|
|
1061
|
+
toAst(): PyClassDeclaration;
|
|
1062
|
+
$validate(): asserts this;
|
|
1063
|
+
private missingRequiredCalls;
|
|
1064
|
+
}
|
|
1065
|
+
//#endregion
|
|
1066
|
+
//#region src/py-dsl/decl/enum.d.ts
|
|
1067
|
+
type EnumMember = {
|
|
1068
|
+
name: NodeName;
|
|
1069
|
+
value: number | string | boolean;
|
|
1070
|
+
};
|
|
1071
|
+
declare const Mixed$26: MixinCtor<MixinCtor<MixinCtor<MixinCtor<abstract new () => PyDsl<PyClassDeclaration, "python">, LayoutMethods>, ExportMethods>, DocMethods>, DecoratorMethods>;
|
|
1072
|
+
declare class EnumPyDsl extends Mixed$26 {
|
|
1073
|
+
readonly '~dsl' = "EnumPyDsl";
|
|
1074
|
+
readonly nameSanitizer: typeof safeRuntimeName;
|
|
1075
|
+
private _decision?;
|
|
1076
|
+
private _members;
|
|
1077
|
+
constructor(name: NodeName);
|
|
1078
|
+
members(...members: ReadonlyArray<EnumMember>): this;
|
|
1079
|
+
analyze(ctx: AnalysisContext): void;
|
|
1080
|
+
/** Returns true when all required builder calls are present. */
|
|
1081
|
+
get isValid(): boolean;
|
|
1082
|
+
toAst(): PyClassDeclaration;
|
|
1083
|
+
$validate(): asserts this;
|
|
1084
|
+
private missingRequiredCalls;
|
|
1085
|
+
}
|
|
1086
|
+
//#endregion
|
|
1087
|
+
//#region src/py-dsl/mixins/value.d.ts
|
|
1088
|
+
type ValueExpr = NodeName | MaybePyDsl<py.Expression>;
|
|
1089
|
+
interface ValueMethods extends Node$1 {
|
|
1090
|
+
$value(): py.Expression | undefined;
|
|
1091
|
+
/** Sets the initializer expression (e.g., `= expr`). */
|
|
1092
|
+
assign(expr: ValueExpr): this;
|
|
1093
|
+
}
|
|
1094
|
+
//#endregion
|
|
1095
|
+
//#region src/py-dsl/decl/field.d.ts
|
|
1096
|
+
declare const Mixed$25: MixinCtor<abstract new () => PyDsl<PyAssignment, "python">, ValueMethods>;
|
|
1097
|
+
type FieldType = NodeName | MaybePyDsl<py.Expression>;
|
|
1098
|
+
declare class FieldPyDsl extends Mixed$25 {
|
|
1099
|
+
readonly '~dsl' = "FieldPyDsl";
|
|
1100
|
+
readonly nameSanitizer: typeof safeKeywordName;
|
|
1101
|
+
protected _type?: Ref<FieldType>;
|
|
1102
|
+
constructor(name?: NodeName);
|
|
1103
|
+
analyze(ctx: AnalysisContext): void;
|
|
1104
|
+
/** Returns true when all required builder calls are present. */
|
|
1105
|
+
get isValid(): boolean;
|
|
1106
|
+
/** Sets the type annotation for the field. */
|
|
1107
|
+
type(type: FieldType): this;
|
|
1108
|
+
toAst(): PyAssignment;
|
|
1109
|
+
$validate(): asserts this;
|
|
1110
|
+
protected $_type(): py.Expression | undefined;
|
|
1111
|
+
private missingRequiredCalls;
|
|
1112
|
+
}
|
|
1113
|
+
//#endregion
|
|
1114
|
+
//#region src/py-dsl/mixins/returns.d.ts
|
|
1115
|
+
interface ReturnsMethods extends Node$1 {
|
|
1116
|
+
$returns(): py.Expression | undefined;
|
|
1117
|
+
returns(type: NodeName | py.Expression): this;
|
|
1118
|
+
}
|
|
1119
|
+
//#endregion
|
|
1120
|
+
//#region src/py-dsl/mixins/param.d.ts
|
|
1121
|
+
interface ParamMethods extends Node$1 {
|
|
1122
|
+
/** Renders the parameters into an array of `FunctionParameter`s. */
|
|
1123
|
+
$params(): ReadonlyArray<py.FunctionParameter>;
|
|
1124
|
+
/** Adds a parameter. */
|
|
1125
|
+
param(...args: Parameters<ParamCtor>): this;
|
|
1126
|
+
/** Adds multiple parameters. */
|
|
1127
|
+
params(...params: ReadonlyArray<MaybePyDsl<py.FunctionParameter>>): this;
|
|
1128
|
+
}
|
|
1129
|
+
//#endregion
|
|
1130
|
+
//#region src/py-dsl/decl/func.d.ts
|
|
1131
|
+
declare const Mixed$24: MixinCtor<MixinCtor<MixinCtor<MixinCtor<MixinCtor<MixinCtor<MixinCtor<MixinCtor<abstract new () => PyDsl<PyFunctionDeclaration, "python">, ReturnsMethods>, ParamMethods>, LayoutMethods>, ExportMethods>, DoMethods>, DocMethods>, DecoratorMethods>, AsyncMethods>;
|
|
1132
|
+
declare class FuncPyDsl extends Mixed$24 {
|
|
1133
|
+
readonly '~dsl' = "FuncPyDsl";
|
|
1134
|
+
readonly nameSanitizer: typeof safeRuntimeName;
|
|
1135
|
+
constructor(name: NodeName, fn?: (f: FuncPyDsl) => void);
|
|
1136
|
+
analyze(ctx: AnalysisContext): void;
|
|
1137
|
+
/** Returns true when all required builder calls are present. */
|
|
1138
|
+
get isValid(): boolean;
|
|
1139
|
+
toAst(): PyFunctionDeclaration;
|
|
1140
|
+
$validate(): asserts this;
|
|
1141
|
+
private missingRequiredCalls;
|
|
1142
|
+
}
|
|
1143
|
+
//#endregion
|
|
1144
|
+
//#region src/py-dsl/decl/method.d.ts
|
|
1145
|
+
declare const Mixed$23: MixinCtor<MixinCtor<MixinCtor<MixinCtor<MixinCtor<MixinCtor<MixinCtor<abstract new () => PyDsl<PyFunctionDeclaration, "python">, ReturnsMethods>, ParamMethods>, LayoutMethods>, DoMethods>, DocMethods>, DecoratorMethods>, AsyncMethods>;
|
|
1146
|
+
declare class MethodPyDsl extends Mixed$23 {
|
|
1147
|
+
readonly '~dsl' = "MethodPyDsl";
|
|
1148
|
+
readonly nameSanitizer: typeof safeKeywordName;
|
|
1149
|
+
constructor(name: NodeName, fn?: (f: MethodPyDsl) => void);
|
|
1150
|
+
analyze(ctx: AnalysisContext): void;
|
|
1151
|
+
/** Returns true when all required builder calls are present. */
|
|
1152
|
+
get isValid(): boolean;
|
|
1153
|
+
toAst(): PyFunctionDeclaration;
|
|
1154
|
+
$validate(): asserts this;
|
|
1155
|
+
private missingRequiredCalls;
|
|
1156
|
+
}
|
|
1157
|
+
//#endregion
|
|
1158
|
+
//#region src/py-dsl/expr/dict.d.ts
|
|
1159
|
+
declare const Mixed$22: MixinCtor<abstract new () => PyDsl<PyDictExpression, "python">, LayoutMethods>;
|
|
1160
|
+
declare class DictPyDsl extends Mixed$22 {
|
|
1161
|
+
readonly '~dsl' = "DictPyDsl";
|
|
1162
|
+
protected _entries: Array<{
|
|
1163
|
+
key: MaybePyDsl<py.Expression>;
|
|
1164
|
+
value: MaybePyDsl<py.Expression>;
|
|
1165
|
+
}>;
|
|
1166
|
+
constructor(...entries: Array<{
|
|
1167
|
+
key: MaybePyDsl<py.Expression>;
|
|
1168
|
+
value: MaybePyDsl<py.Expression>;
|
|
1169
|
+
}>);
|
|
1170
|
+
analyze(ctx: AnalysisContext): void;
|
|
1171
|
+
entry(key: MaybePyDsl<py.Expression>, value: MaybePyDsl<py.Expression>): this;
|
|
1172
|
+
entries(...entries: ReadonlyArray<{
|
|
1173
|
+
key: MaybePyDsl<py.Expression>;
|
|
1174
|
+
value: MaybePyDsl<py.Expression>;
|
|
1175
|
+
}>): this;
|
|
1176
|
+
toAst(): PyDictExpression;
|
|
1177
|
+
}
|
|
1178
|
+
//#endregion
|
|
1179
|
+
//#region src/py-dsl/expr/identifier.d.ts
|
|
1180
|
+
declare const Mixed$21: abstract new () => PyDsl<PyIdentifier, "python">;
|
|
1181
|
+
declare class IdPyDsl extends Mixed$21 {
|
|
1182
|
+
readonly '~dsl' = "IdPyDsl";
|
|
1183
|
+
constructor(name: NodeName);
|
|
1184
|
+
analyze(ctx: AnalysisContext): void;
|
|
1185
|
+
toAst(): PyIdentifier;
|
|
1186
|
+
}
|
|
1187
|
+
//#endregion
|
|
1188
|
+
//#region src/py-dsl/expr/list.d.ts
|
|
1189
|
+
declare const Mixed$20: MixinCtor<abstract new () => PyDsl<PyListExpression, "python">, LayoutMethods>;
|
|
1190
|
+
declare class ListPyDsl extends Mixed$20 {
|
|
1191
|
+
readonly '~dsl' = "ListPyDsl";
|
|
1192
|
+
protected _elements: Array<MaybePyDsl<py.Expression>>;
|
|
1193
|
+
constructor(...elements: Array<MaybePyDsl<py.Expression>>);
|
|
1194
|
+
analyze(ctx: AnalysisContext): void;
|
|
1195
|
+
element(expr: MaybePyDsl<py.Expression>): this;
|
|
1196
|
+
elements(...exprs: ReadonlyArray<MaybePyDsl<py.Expression>>): this;
|
|
1197
|
+
toAst(): PyListExpression;
|
|
1198
|
+
}
|
|
1199
|
+
//#endregion
|
|
1200
|
+
//#region src/py-dsl/expr/literal.d.ts
|
|
1201
|
+
declare const Mixed$19: abstract new () => PyDsl<PyLiteral, "python">;
|
|
1202
|
+
declare class LiteralPyDsl extends Mixed$19 {
|
|
1203
|
+
readonly '~dsl' = "LiteralPyDsl";
|
|
1204
|
+
protected value: py.LiteralValue;
|
|
1205
|
+
constructor(value: py.LiteralValue);
|
|
1206
|
+
analyze(_ctx: AnalysisContext): void;
|
|
1207
|
+
toAst(): PyLiteral;
|
|
1208
|
+
}
|
|
1209
|
+
//#endregion
|
|
1210
|
+
//#region src/py-dsl/expr/set.d.ts
|
|
1211
|
+
declare const Mixed$18: MixinCtor<abstract new () => PyDsl<PySetExpression, "python">, LayoutMethods>;
|
|
1212
|
+
declare class SetPyDsl extends Mixed$18 {
|
|
1213
|
+
readonly '~dsl' = "SetPyDsl";
|
|
1214
|
+
protected _elements: Array<MaybePyDsl<py.Expression>>;
|
|
1215
|
+
constructor(...elements: Array<MaybePyDsl<py.Expression>>);
|
|
1216
|
+
analyze(ctx: AnalysisContext): void;
|
|
1217
|
+
element(expr: MaybePyDsl<py.Expression>): this;
|
|
1218
|
+
elements(...exprs: ReadonlyArray<MaybePyDsl<py.Expression>>): this;
|
|
1219
|
+
toAst(): PySetExpression;
|
|
1220
|
+
}
|
|
1221
|
+
//#endregion
|
|
1222
|
+
//#region src/py-dsl/layout/newline.d.ts
|
|
1223
|
+
declare class NewlinePyDsl extends PyDsl<py.EmptyStatement> {
|
|
1224
|
+
readonly '~dsl' = "NewlinePyDsl";
|
|
1225
|
+
analyze(ctx: AnalysisContext): void;
|
|
1226
|
+
toAst(): PyEmptyStatement;
|
|
1227
|
+
}
|
|
1228
|
+
//#endregion
|
|
1229
|
+
//#region src/py-dsl/stmt/block.d.ts
|
|
1230
|
+
declare const Mixed$17: MixinCtor<MixinCtor<abstract new () => PyDsl<PyBlock, "python">, LayoutMethods>, DoMethods>;
|
|
1231
|
+
declare class BlockPyDsl extends Mixed$17 {
|
|
1232
|
+
readonly '~dsl' = "BlockPyDsl";
|
|
1233
|
+
constructor(...items: Array<DoExpr>);
|
|
1234
|
+
analyze(ctx: AnalysisContext): void;
|
|
1235
|
+
toAst(): PyBlock;
|
|
1236
|
+
}
|
|
1237
|
+
//#endregion
|
|
1238
|
+
//#region src/py-dsl/stmt/break.d.ts
|
|
1239
|
+
declare const Mixed$16: abstract new () => PyDsl<PyBreakStatement, "python">;
|
|
1240
|
+
declare class BreakPyDsl extends Mixed$16 {
|
|
1241
|
+
readonly '~dsl' = "BreakPyDsl";
|
|
1242
|
+
analyze(_ctx: AnalysisContext): void;
|
|
1243
|
+
toAst(): PyBreakStatement;
|
|
1244
|
+
}
|
|
1245
|
+
//#endregion
|
|
1246
|
+
//#region src/py-dsl/stmt/continue.d.ts
|
|
1247
|
+
declare const Mixed$15: abstract new () => PyDsl<PyContinueStatement, "python">;
|
|
1248
|
+
declare class ContinuePyDsl extends Mixed$15 {
|
|
1249
|
+
readonly '~dsl' = "ContinuePyDsl";
|
|
1250
|
+
analyze(_ctx: AnalysisContext): void;
|
|
1251
|
+
toAst(): PyContinueStatement;
|
|
1252
|
+
}
|
|
1253
|
+
//#endregion
|
|
1254
|
+
//#region src/py-dsl/stmt/for.d.ts
|
|
1255
|
+
declare const Mixed$14: abstract new () => PyDsl<PyForStatement, "python">;
|
|
1256
|
+
declare class ForPyDsl extends Mixed$14 {
|
|
1257
|
+
readonly '~dsl' = "ForPyDsl";
|
|
1258
|
+
protected _body?: Array<DoExpr>;
|
|
1259
|
+
protected _else?: Array<DoExpr>;
|
|
1260
|
+
protected _iterable?: MaybePyDsl<py.Expression>;
|
|
1261
|
+
protected _target?: MaybePyDsl<py.Expression>;
|
|
1262
|
+
constructor(target: MaybePyDsl<py.Expression>, iterable: MaybePyDsl<py.Expression>, ...body: Array<DoExpr>);
|
|
1263
|
+
analyze(ctx: AnalysisContext): void;
|
|
1264
|
+
/** Returns true when all required builder calls are present. */
|
|
1265
|
+
get isValid(): boolean;
|
|
1266
|
+
body(...items: Array<DoExpr>): this;
|
|
1267
|
+
else(...items: Array<DoExpr>): this;
|
|
1268
|
+
toAst(): PyForStatement;
|
|
1269
|
+
$validate(): asserts this is this & {
|
|
1270
|
+
_body: Array<DoExpr>;
|
|
1271
|
+
_iterable: MaybePyDsl<py.Expression>;
|
|
1272
|
+
_target: MaybePyDsl<py.Expression>;
|
|
1273
|
+
};
|
|
1274
|
+
private missingRequiredCalls;
|
|
1275
|
+
}
|
|
1276
|
+
//#endregion
|
|
1277
|
+
//#region src/py-dsl/stmt/import.d.ts
|
|
1278
|
+
type ImportName = {
|
|
1279
|
+
alias?: string;
|
|
1280
|
+
name: string;
|
|
1281
|
+
};
|
|
1282
|
+
declare const Mixed$13: abstract new () => PyDsl<PyImportStatement, "python">;
|
|
1283
|
+
declare class ImportPyDsl extends Mixed$13 {
|
|
1284
|
+
readonly '~dsl' = "ImportPyDsl";
|
|
1285
|
+
protected isFrom: boolean;
|
|
1286
|
+
protected module: string;
|
|
1287
|
+
protected names?: ReadonlyArray<ImportName>;
|
|
1288
|
+
constructor(module: string);
|
|
1289
|
+
constructor(module: string, isFrom: boolean);
|
|
1290
|
+
constructor(module: string, names: ReadonlyArray<ImportName>, isFrom: boolean);
|
|
1291
|
+
static from(module: string, names?: ReadonlyArray<ImportName>): ImportPyDsl;
|
|
1292
|
+
static direct(module: string): ImportPyDsl;
|
|
1293
|
+
analyze(_ctx: AnalysisContext): void;
|
|
1294
|
+
toAst(): PyImportStatement;
|
|
1295
|
+
}
|
|
1296
|
+
//#endregion
|
|
1297
|
+
//#region src/py-dsl/stmt/raise.d.ts
|
|
1298
|
+
declare const Mixed$12: abstract new () => PyDsl<PyRaiseStatement, "python">;
|
|
1299
|
+
declare class RaisePyDsl extends Mixed$12 {
|
|
1300
|
+
readonly '~dsl' = "RaisePyDsl";
|
|
1301
|
+
protected _error?: string | MaybePyDsl<py.Expression>;
|
|
1302
|
+
constructor(error?: string | MaybePyDsl<py.Expression>);
|
|
1303
|
+
analyze(ctx: AnalysisContext): void;
|
|
1304
|
+
toAst(): PyRaiseStatement;
|
|
1305
|
+
}
|
|
1306
|
+
//#endregion
|
|
1307
|
+
//#region src/py-dsl/stmt/stmt.d.ts
|
|
1308
|
+
declare const Mixed$11: abstract new () => PyDsl<PyStatement, "python">;
|
|
1309
|
+
declare class StmtPyDsl extends Mixed$11 {
|
|
1310
|
+
readonly '~dsl' = "StmtPyDsl";
|
|
1311
|
+
protected _inner: py.Expression | py.Statement | PyDsl<any>;
|
|
1312
|
+
constructor(inner: py.Expression | py.Statement | PyDsl<any>);
|
|
1313
|
+
analyze(ctx: AnalysisContext): void;
|
|
1314
|
+
toAst(): PyStatement;
|
|
1315
|
+
}
|
|
1316
|
+
//#endregion
|
|
1317
|
+
//#region src/py-dsl/stmt/try.d.ts
|
|
1318
|
+
declare const Mixed$10: abstract new () => PyDsl<PyTryStatement, "python">;
|
|
1319
|
+
type ExceptType = string | MaybePyDsl<py.Expression>;
|
|
1320
|
+
interface ExceptEntry {
|
|
1321
|
+
body: Array<DoExpr>;
|
|
1322
|
+
name?: Ref<NodeName>;
|
|
1323
|
+
types: Array<ExceptType>;
|
|
1324
|
+
}
|
|
1325
|
+
declare class TryPyDsl extends Mixed$10 {
|
|
1326
|
+
readonly '~dsl' = "TryPyDsl";
|
|
1327
|
+
/**
|
|
1328
|
+
* Ordered list of except clauses. We also keep a lookup map
|
|
1329
|
+
* (`_exceptIndex`) keyed by the normalised type key so that
|
|
1330
|
+
* repeated `.except()` calls with the same type set merge their
|
|
1331
|
+
* body statements instead of creating duplicate clauses.
|
|
1332
|
+
*/
|
|
1333
|
+
protected _excepts: Array<ExceptEntry>;
|
|
1334
|
+
protected _exceptIndex: Map<string, number>;
|
|
1335
|
+
protected _finally?: Array<DoExpr>;
|
|
1336
|
+
protected _try?: Array<DoExpr>;
|
|
1337
|
+
constructor(...tryBlock: Array<DoExpr>);
|
|
1338
|
+
analyze(ctx: AnalysisContext): void;
|
|
1339
|
+
/** Returns true when all required builder calls are present. */
|
|
1340
|
+
get isValid(): boolean;
|
|
1341
|
+
/**
|
|
1342
|
+
* Add (or merge into) an except clause.
|
|
1343
|
+
*
|
|
1344
|
+
* ```ts
|
|
1345
|
+
* $.try(...)
|
|
1346
|
+
* .except('ValueError', 'e', body1, body2) // except ValueError as e:
|
|
1347
|
+
* .except(['TypeError', 'KeyError'], 'e', ...) // except (TypeError, KeyError) as e:
|
|
1348
|
+
* .except('ValueError', moreBody) // merges into first clause
|
|
1349
|
+
* ```
|
|
1350
|
+
*
|
|
1351
|
+
* @param types Single exception type or array of types.
|
|
1352
|
+
* @param nameOrBody Either the `as` variable name (`NodeName`) or the
|
|
1353
|
+
* first body expression. If it looks like a `NodeName` (string that
|
|
1354
|
+
* is a valid Python identifier and is *not* a DSL node), it is treated
|
|
1355
|
+
* as the name; pass body items after it.
|
|
1356
|
+
* @param body Remaining body statements.
|
|
1357
|
+
*/
|
|
1358
|
+
except(types: MaybeArray<ExceptType>, nameOrBody?: NodeName | DoExpr, ...body: Array<DoExpr>): this;
|
|
1359
|
+
/** Add a bare `except:` clause (catches everything). */
|
|
1360
|
+
exceptAll(...body: Array<DoExpr>): this;
|
|
1361
|
+
finally(...items: Array<DoExpr>): this;
|
|
1362
|
+
try(...items: Array<DoExpr>): this;
|
|
1363
|
+
toAst(): PyTryStatement;
|
|
1364
|
+
$validate(): asserts this is this & {
|
|
1365
|
+
_try: Array<DoExpr>;
|
|
1366
|
+
};
|
|
1367
|
+
private missingRequiredCalls;
|
|
1368
|
+
/**
|
|
1369
|
+
* Heuristic: a value is a `NodeName` (intended as the `as` variable)
|
|
1370
|
+
* if it is a plain string matching a Python identifier pattern, or a
|
|
1371
|
+
* Symbol.
|
|
1372
|
+
*/
|
|
1373
|
+
private _isNodeName;
|
|
1374
|
+
}
|
|
1375
|
+
//#endregion
|
|
1376
|
+
//#region src/py-dsl/stmt/var.d.ts
|
|
1377
|
+
declare const Mixed$9: MixinCtor<abstract new () => PyDsl<PyAssignment, "python">, ValueMethods>;
|
|
1378
|
+
type VarType = NodeName | MaybePyDsl<py.Expression>;
|
|
1379
|
+
declare class VarPyDsl extends Mixed$9 {
|
|
1380
|
+
readonly '~dsl' = "VarPyDsl";
|
|
1381
|
+
readonly nameSanitizer: typeof safeRuntimeName;
|
|
1382
|
+
protected _type?: Ref<VarType>;
|
|
1383
|
+
constructor(name?: NodeName);
|
|
1384
|
+
analyze(ctx: AnalysisContext): void;
|
|
1385
|
+
/** Returns true when all required builder calls are present. */
|
|
1386
|
+
get isValid(): boolean;
|
|
1387
|
+
/** Sets the type annotation for the variable. */
|
|
1388
|
+
type(type: VarType): this;
|
|
1389
|
+
toAst(): PyAssignment;
|
|
1390
|
+
$validate(): asserts this;
|
|
1391
|
+
protected $_type(): py.Expression | undefined;
|
|
1392
|
+
private missingRequiredCalls;
|
|
1393
|
+
}
|
|
1394
|
+
//#endregion
|
|
1395
|
+
//#region src/py-dsl/stmt/while.d.ts
|
|
1396
|
+
declare const Mixed$8: abstract new () => PyDsl<PyWhileStatement, "python">;
|
|
1397
|
+
declare class WhilePyDsl extends Mixed$8 {
|
|
1398
|
+
readonly '~dsl' = "WhilePyDsl";
|
|
1399
|
+
protected _body?: Array<DoExpr>;
|
|
1400
|
+
protected _condition?: MaybePyDsl<py.Expression>;
|
|
1401
|
+
protected _else?: Array<DoExpr>;
|
|
1402
|
+
constructor(condition: MaybePyDsl<py.Expression>, ...body: Array<DoExpr>);
|
|
1403
|
+
analyze(ctx: AnalysisContext): void;
|
|
1404
|
+
/** Returns true when all required builder calls are present. */
|
|
1405
|
+
get isValid(): boolean;
|
|
1406
|
+
body(...items: Array<DoExpr>): this;
|
|
1407
|
+
else(...items: Array<DoExpr>): this;
|
|
1408
|
+
toAst(): PyWhileStatement;
|
|
1409
|
+
$validate(): asserts this is this & {
|
|
1410
|
+
_body: Array<DoExpr>;
|
|
1411
|
+
_condition: MaybePyDsl<py.Expression>;
|
|
1412
|
+
};
|
|
1413
|
+
private missingRequiredCalls;
|
|
1414
|
+
}
|
|
1415
|
+
//#endregion
|
|
1416
|
+
//#region src/py-dsl/stmt/with.d.ts
|
|
1417
|
+
declare const Mixed$7: abstract new () => PyDsl<PyWithStatement, "python">;
|
|
1418
|
+
type WithItemInput = MaybePyDsl<py.Expression> | {
|
|
1419
|
+
alias?: MaybePyDsl<py.Expression>;
|
|
1420
|
+
context: MaybePyDsl<py.Expression>;
|
|
1421
|
+
};
|
|
1422
|
+
declare class WithPyDsl extends Mixed$7 {
|
|
1423
|
+
readonly '~dsl' = "WithPyDsl";
|
|
1424
|
+
protected _body?: Array<DoExpr>;
|
|
1425
|
+
protected _items: Array<WithItemInput>;
|
|
1426
|
+
protected _modifier?: MaybePyDsl<py.Expression>;
|
|
1427
|
+
constructor(...items: Array<WithItemInput>);
|
|
1428
|
+
analyze(ctx: AnalysisContext): void;
|
|
1429
|
+
/** Returns true when all required builder calls are present. */
|
|
1430
|
+
get isValid(): boolean;
|
|
1431
|
+
body(...items: Array<DoExpr>): this;
|
|
1432
|
+
item(item: WithItemInput): this;
|
|
1433
|
+
modifier(expr: MaybePyDsl<py.Expression>): this;
|
|
1434
|
+
async(): this;
|
|
1435
|
+
toAst(): PyWithStatement;
|
|
1436
|
+
$validate(): asserts this is this & {
|
|
1437
|
+
_body: Array<DoExpr>;
|
|
1438
|
+
};
|
|
1439
|
+
private missingRequiredCalls;
|
|
1440
|
+
}
|
|
1441
|
+
//#endregion
|
|
1442
|
+
//#region src/py-dsl/type/or.d.ts
|
|
1443
|
+
declare const Mixed$6: abstract new () => PyDsl<PyExpression, "python">;
|
|
1444
|
+
type Type$1 = NodeName | MaybePyDsl<py.Expression>;
|
|
1445
|
+
declare class TypeOrPyDsl extends Mixed$6 {
|
|
1446
|
+
readonly '~dsl' = "TypeOrPyDsl";
|
|
1447
|
+
scope: NodeScope;
|
|
1448
|
+
protected _types: Array<Ref<Type$1>>;
|
|
1449
|
+
private _decision?;
|
|
1450
|
+
constructor(...nodes: Array<Type$1>);
|
|
1451
|
+
analyze(ctx: AnalysisContext): void;
|
|
1452
|
+
types(...nodes: Array<Type$1>): this;
|
|
1453
|
+
toAst(): PyExpression;
|
|
1454
|
+
$validate(): asserts this;
|
|
1455
|
+
private $flatten;
|
|
1456
|
+
private $flattenRefs;
|
|
1457
|
+
}
|
|
1458
|
+
//#endregion
|
|
1459
|
+
//#region src/py-dsl/type/tuple.d.ts
|
|
1460
|
+
declare const Mixed$5: abstract new () => PyDsl<PyExpression, "python">;
|
|
1461
|
+
type Type = NodeName | MaybePyDsl<py.Expression>;
|
|
1462
|
+
declare class TypeTuplePyDsl extends Mixed$5 {
|
|
1463
|
+
readonly '~dsl' = "TypeTuplePyDsl";
|
|
1464
|
+
scope: NodeScope;
|
|
1465
|
+
protected _items: Array<Ref<Type>>;
|
|
1466
|
+
private _decision?;
|
|
1467
|
+
constructor(...nodes: Array<Type>);
|
|
1468
|
+
analyze(ctx: AnalysisContext): void;
|
|
1469
|
+
items(...nodes: Array<Type>): this;
|
|
1470
|
+
toAst(): PySubscriptExpression;
|
|
1471
|
+
$validate(): asserts this;
|
|
1472
|
+
private $flatten;
|
|
1473
|
+
private $flattenRefs;
|
|
1474
|
+
}
|
|
1475
|
+
//#endregion
|
|
1476
|
+
//#region src/py-dsl/index.d.ts
|
|
1477
|
+
declare const $$1: ((id: ExprId) => ExprPyDsl) & {
|
|
1478
|
+
/** Creates an array literal expression (e.g., `[1, 2, 3]`). */
|
|
1479
|
+
/** Creates an `as` type assertion expression (e.g., `value as Type`). */
|
|
1480
|
+
/** Creates a property access expression (e.g., `obj.foo`). */
|
|
1481
|
+
attr: (left: AttrLeft, right: NodeName) => AttrPyDsl;
|
|
1482
|
+
/** Creates an await expression (e.g., `await promise`). */
|
|
1483
|
+
/** Creates a binary expression (e.g., `a + b`). */
|
|
1484
|
+
binary: (left: PyExpression | PyDsl<PyExpression, "python">, op: PyBinaryOperator, right: PyExpression | PyDsl<PyExpression, "python">) => BinaryPyDsl; /** Creates a statement block. */
|
|
1485
|
+
block: (...args: ConstructorParameters<typeof BlockPyDsl>) => BlockPyDsl; /** Creates a break statement. */
|
|
1486
|
+
break: () => BreakPyDsl; /** Creates a function or method call expression (e.g., `fn(arg)`). */
|
|
1487
|
+
call: (callee: CallCallee, ...args: (CallCallee | undefined)[]) => CallPyDsl; /** Creates a class declaration or expression. */
|
|
1488
|
+
class: (name: NodeName) => ClassPyDsl; /** Creates a continue statement. */
|
|
1489
|
+
continue: () => ContinuePyDsl;
|
|
1490
|
+
/** Creates a decorator expression (e.g., `@decorator`). */
|
|
1491
|
+
/** Creates a dictionary expression (e.g., `{ 'a': 1 }`). */
|
|
1492
|
+
dict: (...args: ConstructorParameters<typeof DictPyDsl>) => DictPyDsl; /** Creates a Python docstring (`"""..."""`). */
|
|
1493
|
+
doc: (lines?: DocLines | undefined, fn?: DocFn | undefined) => DocPyDsl; /** Creates an enum declaration. */
|
|
1494
|
+
enum: (name: NodeName) => EnumPyDsl; /** Creates a general expression node. */
|
|
1495
|
+
expr: (id: ExprId) => ExprPyDsl; /** Creates a field declaration in a class body. */
|
|
1496
|
+
field: (name?: NodeName | undefined) => FieldPyDsl; /** Creates a for statement (e.g., `for x in items:`). */
|
|
1497
|
+
for: (target: PyExpression | PyDsl<PyExpression, "python">, iterable: PyExpression | PyDsl<PyExpression, "python">, ...body: (PyExpression | PyStatement | PyDsl<PyExpression | PyStatement, "python">)[]) => ForPyDsl;
|
|
1498
|
+
/** Converts a runtime value into a corresponding expression node. */
|
|
1499
|
+
/** Creates a function declaration. */
|
|
1500
|
+
func: {
|
|
1501
|
+
(name: NodeName): FuncPyDsl;
|
|
1502
|
+
(name: NodeName, fn: (f: FuncPyDsl) => void): FuncPyDsl;
|
|
1503
|
+
};
|
|
1504
|
+
/** Creates a getter method declaration. */
|
|
1505
|
+
/** Creates a Python comment (`# ...`). */
|
|
1506
|
+
hint: (lines?: HintLines | undefined, fn?: HintFn | undefined) => HintPyDsl; /** Creates an identifier (e.g., `foo`). */
|
|
1507
|
+
id: (name: NodeName) => IdPyDsl; /** Creates an if statement. */
|
|
1508
|
+
if: (condition?: IfCondition | undefined) => IfPyDsl; /** Creates an import statement. */
|
|
1509
|
+
import: (module: string, names: readonly {
|
|
1510
|
+
alias?: string;
|
|
1511
|
+
name: string;
|
|
1512
|
+
}[], isFrom: boolean) => ImportPyDsl;
|
|
1513
|
+
/** Creates an initialization block or statement. */
|
|
1514
|
+
/** Creates a keyword argument expression (e.g., `name=value`). */
|
|
1515
|
+
kwarg: (name: NodeName, value: KwargValue) => KwargPyDsl; /** Creates a lazy, context-aware node with deferred evaluation. */
|
|
1516
|
+
lazy: <T extends py.Node>(thunk: LazyThunk<T>) => LazyPyDsl<T>; /** Creates a list expression (e.g., `[1, 2, 3]`). */
|
|
1517
|
+
list: (...args: ConstructorParameters<typeof ListPyDsl>) => ListPyDsl; /** Creates a literal value (e.g., string, number, boolean). */
|
|
1518
|
+
literal: (value: PyLiteralValue) => LiteralPyDsl;
|
|
1519
|
+
/** Creates an enum member declaration. */
|
|
1520
|
+
/** Creates a method declaration in a class body. */
|
|
1521
|
+
method: {
|
|
1522
|
+
(name: NodeName): MethodPyDsl;
|
|
1523
|
+
(name: NodeName, fn: (f: MethodPyDsl) => void): MethodPyDsl;
|
|
1524
|
+
};
|
|
1525
|
+
/** Creates a negation expression (`-x`). */
|
|
1526
|
+
/** Creates a new expression (e.g., `new ClassName()`). */
|
|
1527
|
+
/** Creates a newline (for formatting purposes). */
|
|
1528
|
+
newline: () => NewlinePyDsl;
|
|
1529
|
+
/** Creates a logical NOT expression (`!x`). */
|
|
1530
|
+
/** Creates an object literal expression. */
|
|
1531
|
+
/** Creates a parameter declaration for functions or methods. */
|
|
1532
|
+
param: (name: ParamName, fn?: ParamFn | undefined) => ParamPyDsl;
|
|
1533
|
+
/** Creates a pattern for destructuring or matching. */
|
|
1534
|
+
/** Creates a prefix unary expression (e.g., `-x`, `!x`, `~x`). */
|
|
1535
|
+
/** Creates an object literal property (e.g., `{ foo: bar }`). */
|
|
1536
|
+
/** Creates a raise statement. */
|
|
1537
|
+
raise: (error?: string | PyExpression | PyDsl<PyExpression, "python"> | undefined) => RaisePyDsl;
|
|
1538
|
+
/** Creates a regular expression literal (e.g., `/foo/gi`). */
|
|
1539
|
+
/** Creates a return statement. */
|
|
1540
|
+
return: (expr?: ReturnExpr | undefined) => ReturnPyDsl; /** Creates a set expression (e.g., `{1, 2, 3}`). */
|
|
1541
|
+
set: (...args: ConstructorParameters<typeof SetPyDsl>) => SetPyDsl;
|
|
1542
|
+
/** Creates a setter method declaration. */
|
|
1543
|
+
/** Wraps an expression or statement-like value into a `StmtPyDsl`. */
|
|
1544
|
+
stmt: (inner: PyExpression | PyStatement | PyDsl<any, "python">) => StmtPyDsl; /** Creates a subscript expression (e.g., `obj[index]` or `Type[Param]`). */
|
|
1545
|
+
subscript: (value: SubscriptExpr, ...slices: SubscriptExpr[]) => SubscriptPyDsl;
|
|
1546
|
+
/** Creates a template literal expression. */
|
|
1547
|
+
/** Creates a ternary conditional expression (if ? then : else). */
|
|
1548
|
+
/** Creates a syntax token (e.g., `?`, `readonly`, `+`, `-`). */
|
|
1549
|
+
/** Creates a try/except/finally statement. */
|
|
1550
|
+
try: (...args: ConstructorParameters<typeof TryPyDsl>) => TryPyDsl; /** Creates a tuple expression (e.g., `(1, 2, 3)`). */
|
|
1551
|
+
tuple: (...args: ConstructorParameters<typeof TuplePyDsl>) => TuplePyDsl; /** Creates a basic type reference or type expression (e.g., Foo or Foo<T>). */
|
|
1552
|
+
type: {
|
|
1553
|
+
/** Creates a type alias declaration (e.g., `type Foo = Bar`). */
|
|
1554
|
+
/** Creates an intersection type (e.g., `A & B`). */
|
|
1555
|
+
/** Creates a qualified type reference (e.g., Foo.Bar). */
|
|
1556
|
+
/** Creates a basic type reference or type expression (e.g., Foo or Foo<T>). */
|
|
1557
|
+
/** Converts a runtime value into a corresponding type expression node. */
|
|
1558
|
+
/** Creates a function type node (e.g., `(a: string) => number`). */
|
|
1559
|
+
/** Creates an indexed-access type (e.g., `Foo<T>[K]`). */
|
|
1560
|
+
/** Creates a literal type node (e.g., 'foo', 42, or true). */
|
|
1561
|
+
/** Creates a mapped type (e.g., `{ [K in keyof T]: U }`). */
|
|
1562
|
+
/** Creates a type literal node (e.g., { foo: string }). */
|
|
1563
|
+
/** Creates a type operator node (e.g., `readonly T`, `keyof T`, `unique T`). */
|
|
1564
|
+
/** Creates a union type (e.g., `A | B | C`). */
|
|
1565
|
+
or: (...args: ConstructorParameters<typeof TypeOrPyDsl>) => TypeOrPyDsl;
|
|
1566
|
+
/** Creates a type parameter (e.g., `<T>`). */
|
|
1567
|
+
/** Creates a type query node (e.g., `typeof Foo`). */
|
|
1568
|
+
/** Builds a TypeScript template literal *type* (e.g., `${Foo}-${Bar}` as a type). */
|
|
1569
|
+
/** Creates a tuple type (e.g., [A, B, C]). */
|
|
1570
|
+
tuple: (...args: ConstructorParameters<typeof TypeTuplePyDsl>) => TypeTuplePyDsl;
|
|
1571
|
+
};
|
|
1572
|
+
/** Creates a `typeof` expression (e.g., `typeof value`). */
|
|
1573
|
+
/** Creates a variable assignment. */
|
|
1574
|
+
var: (name?: NodeName | undefined) => VarPyDsl; /** Creates a while statement (e.g., `while x:`). */
|
|
1575
|
+
while: (condition: PyExpression | PyDsl<PyExpression, "python">, ...body: (PyExpression | PyStatement | PyDsl<PyExpression | PyStatement, "python">)[]) => WhilePyDsl; /** Creates a with statement (e.g., `with open(f) as file:`). */
|
|
1576
|
+
with: (...args: ConstructorParameters<typeof WithPyDsl>) => WithPyDsl;
|
|
1577
|
+
};
|
|
1578
|
+
type DollarPyDsl = {
|
|
1579
|
+
/**
|
|
1580
|
+
* Entry point to the Python DSL.
|
|
1581
|
+
*
|
|
1582
|
+
* `$` creates a general expression node by default, but also exposes
|
|
1583
|
+
* builders for all other constructs.
|
|
1584
|
+
*
|
|
1585
|
+
* Example:
|
|
1586
|
+
* ```ts
|
|
1587
|
+
* const node = $('console').attr('log').call($.literal('Hello'));
|
|
1588
|
+
* ```
|
|
1589
|
+
*
|
|
1590
|
+
* Returns:
|
|
1591
|
+
* - A new `ExprPyDsl` instance when called directly.
|
|
1592
|
+
* - The `pyDsl` object for constructing more specific nodes.
|
|
1593
|
+
*/
|
|
1594
|
+
$: typeof $$1;
|
|
1595
|
+
};
|
|
1596
|
+
//#endregion
|
|
1597
|
+
//#region src/plugins/@hey-api/sdk/examples.d.ts
|
|
1598
|
+
type UserExamplesConfig = Omit<ExampleOptions, 'payload'> & {
|
|
1599
|
+
/**
|
|
1600
|
+
* Whether this feature is enabled.
|
|
1601
|
+
*
|
|
1602
|
+
* @default true
|
|
1603
|
+
*/
|
|
1604
|
+
enabled?: boolean;
|
|
1605
|
+
/**
|
|
1606
|
+
* The programming language for the generated examples.
|
|
1607
|
+
*
|
|
1608
|
+
* This is used to display the language label in code blocks in
|
|
1609
|
+
* documentation UIs.
|
|
1610
|
+
*
|
|
1611
|
+
* @default 'Python'
|
|
1612
|
+
*/
|
|
1613
|
+
language?: LinguistLanguages;
|
|
1614
|
+
/**
|
|
1615
|
+
* Example request payload.
|
|
1616
|
+
*/
|
|
1617
|
+
payload?: MaybeFunc<(operation: IR.OperationObject, ctx: DollarPyDsl) => CallArgs | CallArgs[number]>;
|
|
1618
|
+
/**
|
|
1619
|
+
* Transform the generated example string.
|
|
1620
|
+
*
|
|
1621
|
+
* @param example The generated example string.
|
|
1622
|
+
* @param operation The operation the example was generated for.
|
|
1623
|
+
* @returns The final example string.
|
|
1624
|
+
*/
|
|
1625
|
+
transform?: (example: string, operation: IR.OperationObject) => string;
|
|
1626
|
+
};
|
|
1627
|
+
type ExamplesConfig = Omit<ExampleOptions, 'payload'> & FeatureToggle & {
|
|
1628
|
+
/**
|
|
1629
|
+
* The programming language for the generated examples.
|
|
1630
|
+
*
|
|
1631
|
+
* This is used to display the language label in code blocks in
|
|
1632
|
+
* documentation UIs.
|
|
1633
|
+
*/
|
|
1634
|
+
language: LinguistLanguages;
|
|
1635
|
+
/**
|
|
1636
|
+
* Example request payload.
|
|
1637
|
+
*/
|
|
1638
|
+
payload?: MaybeFunc<(operation: IR.OperationObject, ctx: DollarPyDsl) => CallArgs | CallArgs[number]>;
|
|
1639
|
+
/**
|
|
1640
|
+
* Transform the generated example string.
|
|
1641
|
+
*
|
|
1642
|
+
* @param example The generated example string.
|
|
1643
|
+
* @param operation The operation the example was generated for.
|
|
1644
|
+
* @returns The final example string.
|
|
1645
|
+
*/
|
|
1646
|
+
transform?: (example: string, operation: IR.OperationObject) => string;
|
|
1647
|
+
};
|
|
1648
|
+
//#endregion
|
|
1649
|
+
//#region src/plugins/@hey-api/sdk/imports.d.ts
|
|
1650
|
+
declare function sdkImports(plugin: PluginInstance): {
|
|
1651
|
+
Client: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1652
|
+
buildClientParams: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1653
|
+
funcTools: {
|
|
1654
|
+
cachedProperty: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1655
|
+
};
|
|
1656
|
+
typing: {
|
|
1657
|
+
Annotated: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1658
|
+
Any: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1659
|
+
Literal: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1660
|
+
NoReturn: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1661
|
+
Optional: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1662
|
+
Tuple: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1663
|
+
TypeAlias: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1664
|
+
Union: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1665
|
+
};
|
|
1666
|
+
};
|
|
1667
|
+
type SdkImports = ReturnType<typeof sdkImports>;
|
|
1668
|
+
//#endregion
|
|
1669
|
+
//#region src/plugins/@hey-api/sdk/operations/types.d.ts
|
|
1670
|
+
interface UserOperationsConfig {
|
|
1671
|
+
/**
|
|
1672
|
+
* Type of container for grouped operations.
|
|
1673
|
+
*
|
|
1674
|
+
* Ignored when `strategy` is `'flat'`.
|
|
1675
|
+
*
|
|
1676
|
+
* - `'class'` - Class with methods
|
|
1677
|
+
*
|
|
1678
|
+
* @default 'class'
|
|
1679
|
+
*/
|
|
1680
|
+
container?: 'class';
|
|
1681
|
+
/**
|
|
1682
|
+
* Customize container names.
|
|
1683
|
+
*
|
|
1684
|
+
* For `'single'` strategy, this sets the root container name.
|
|
1685
|
+
* For `'byTags'` strategy, this transforms tag names.
|
|
1686
|
+
*
|
|
1687
|
+
* @default 'Sdk' for `'single'` strategy
|
|
1688
|
+
*
|
|
1689
|
+
* @example
|
|
1690
|
+
* // Set root name for single strategy
|
|
1691
|
+
* containerName: 'MyApi'
|
|
1692
|
+
*
|
|
1693
|
+
* @example
|
|
1694
|
+
* // Transform tag names with suffix
|
|
1695
|
+
* containerName: '{{name}}Service'
|
|
1696
|
+
*
|
|
1697
|
+
* @example
|
|
1698
|
+
* // With casing
|
|
1699
|
+
* containerName: { name: '{{name}}Service', casing: 'PascalCase' }
|
|
1700
|
+
*/
|
|
1701
|
+
containerName?: NamingRule;
|
|
1702
|
+
/**
|
|
1703
|
+
* Customize method/function names.
|
|
1704
|
+
*
|
|
1705
|
+
* Applied to the final segment of the path (the method name).
|
|
1706
|
+
*/
|
|
1707
|
+
methodName?: NamingRule;
|
|
1708
|
+
/**
|
|
1709
|
+
* How methods are attached to class containers.
|
|
1710
|
+
*
|
|
1711
|
+
* Only applies when `container` is `'class'`.
|
|
1712
|
+
*
|
|
1713
|
+
* - `'instance'` - Instance methods, requires `new ClassName(config)`
|
|
1714
|
+
*
|
|
1715
|
+
* @default 'instance'
|
|
1716
|
+
*/
|
|
1717
|
+
methods?: 'instance';
|
|
1718
|
+
/**
|
|
1719
|
+
* How to derive nesting structure from operations.
|
|
1720
|
+
*
|
|
1721
|
+
* - `'operationId'` - Split operationId by delimiters (e.g., `users.list` → `Users.list()`)
|
|
1722
|
+
* - `'id'` - Use operation id as-is, no nesting
|
|
1723
|
+
* - Custom function for full control
|
|
1724
|
+
*
|
|
1725
|
+
* @default 'operationId'
|
|
1726
|
+
*/
|
|
1727
|
+
nesting?: 'operationId' | 'id' | OperationPathStrategy;
|
|
1728
|
+
/**
|
|
1729
|
+
* Delimiters for splitting operationId.
|
|
1730
|
+
*
|
|
1731
|
+
* Only applies when `nesting` is `'operationId'`.
|
|
1732
|
+
*
|
|
1733
|
+
* @default /[./]/
|
|
1734
|
+
*/
|
|
1735
|
+
nestingDelimiters?: RegExp;
|
|
1736
|
+
/**
|
|
1737
|
+
* Customize nesting segment names.
|
|
1738
|
+
*
|
|
1739
|
+
* Applied to intermediate path segments (not the method name).
|
|
1740
|
+
*/
|
|
1741
|
+
segmentName?: NamingRule;
|
|
1742
|
+
/**
|
|
1743
|
+
* Grouping strategy.
|
|
1744
|
+
*
|
|
1745
|
+
* - `'byTags'` - One container per operation tag
|
|
1746
|
+
* - `'single'` - All operations in one container
|
|
1747
|
+
* - Custom function for full control
|
|
1748
|
+
*
|
|
1749
|
+
* @default 'single'
|
|
1750
|
+
*/
|
|
1751
|
+
strategy?: Exclude<OperationsStrategy, 'flat'>;
|
|
1752
|
+
/**
|
|
1753
|
+
* Default container name for operations without tags.
|
|
1754
|
+
*
|
|
1755
|
+
* Only applies when `strategy` is `'byTags'`.
|
|
1756
|
+
*
|
|
1757
|
+
* @default 'default'
|
|
1758
|
+
*/
|
|
1759
|
+
strategyDefaultTag?: string;
|
|
1760
|
+
}
|
|
1761
|
+
interface OperationsConfig {
|
|
1762
|
+
/**
|
|
1763
|
+
* Type of container for grouped operations.
|
|
1764
|
+
*
|
|
1765
|
+
* Ignored when `strategy` is `'flat'`.
|
|
1766
|
+
*
|
|
1767
|
+
* - `'class'` - Class with methods
|
|
1768
|
+
*/
|
|
1769
|
+
container: 'class';
|
|
1770
|
+
/**
|
|
1771
|
+
* Customize container names.
|
|
1772
|
+
*
|
|
1773
|
+
* For `'single'` strategy, this sets the root container name.
|
|
1774
|
+
* For `'byTags'` strategy, this transforms tag names.
|
|
1775
|
+
*
|
|
1776
|
+
* @default 'Sdk' for `'single'` strategy
|
|
1777
|
+
*
|
|
1778
|
+
* @example
|
|
1779
|
+
* // Set root name for single strategy
|
|
1780
|
+
* containerName: 'MyApi'
|
|
1781
|
+
*
|
|
1782
|
+
* @example
|
|
1783
|
+
* // Transform tag names with suffix
|
|
1784
|
+
* containerName: '{{name}}Service'
|
|
1785
|
+
*
|
|
1786
|
+
* @example
|
|
1787
|
+
* // With casing
|
|
1788
|
+
* containerName: { name: '{{name}}Service', case: 'PascalCase' }
|
|
1789
|
+
*/
|
|
1790
|
+
containerName: NamingConfig;
|
|
1791
|
+
/**
|
|
1792
|
+
* Customize method/function names.
|
|
1793
|
+
*
|
|
1794
|
+
* Applied to the final segment of the path (the method name).
|
|
1795
|
+
*/
|
|
1796
|
+
methodName: NamingConfig;
|
|
1797
|
+
/**
|
|
1798
|
+
* How methods are attached to class containers.
|
|
1799
|
+
*
|
|
1800
|
+
* Only applies when `container` is `'class'`.
|
|
1801
|
+
*
|
|
1802
|
+
* - `'instance'` - Instance methods, requires `new ClassName(config)`
|
|
1803
|
+
*/
|
|
1804
|
+
methods: 'instance';
|
|
1805
|
+
/**
|
|
1806
|
+
* How to derive nesting structure from operations.
|
|
1807
|
+
*
|
|
1808
|
+
* - `'operationId'` - Split operationId by delimiters (e.g., `users.list` → `Users.list()`)
|
|
1809
|
+
* - `'id'` - Use operation id as-is, no nesting
|
|
1810
|
+
* - Custom function for full control
|
|
1811
|
+
*/
|
|
1812
|
+
nesting: 'operationId' | 'id' | OperationPathStrategy;
|
|
1813
|
+
/**
|
|
1814
|
+
* Delimiters for splitting operationId.
|
|
1815
|
+
*
|
|
1816
|
+
* Only applies when `nesting` is `'operationId'`.
|
|
1817
|
+
*/
|
|
1818
|
+
nestingDelimiters: RegExp;
|
|
1819
|
+
/**
|
|
1820
|
+
* Customize nesting segment names.
|
|
1821
|
+
*
|
|
1822
|
+
* Applied to intermediate path segments (not the method name).
|
|
1823
|
+
*/
|
|
1824
|
+
segmentName: NamingConfig;
|
|
1825
|
+
/**
|
|
1826
|
+
* Grouping strategy.
|
|
1827
|
+
*
|
|
1828
|
+
* - `'byTags'` - One container per operation tag
|
|
1829
|
+
* - `'single'` - All operations in one container
|
|
1830
|
+
* - Custom function for full control
|
|
1831
|
+
*/
|
|
1832
|
+
strategy: Exclude<OperationsStrategy, 'flat'>;
|
|
1833
|
+
/**
|
|
1834
|
+
* Default container name for operations without tags.
|
|
1835
|
+
*
|
|
1836
|
+
* Only applies when `strategy` is `'byTags'`.
|
|
1837
|
+
*/
|
|
1838
|
+
strategyDefaultTag: string;
|
|
1839
|
+
}
|
|
1840
|
+
//#endregion
|
|
1841
|
+
//#region src/plugins/@hey-api/sdk/types.d.ts
|
|
1842
|
+
type UserConfig$1 = Plugin.Name<'@hey-api/python-sdk'> & Plugin.Hooks & Plugin.UserComments & Plugin.UserExports & {
|
|
1843
|
+
/**
|
|
1844
|
+
* Use an internal client instance to send HTTP requests? This is useful if
|
|
1845
|
+
* you don't want to manually pass the client to each SDK function.
|
|
1846
|
+
*
|
|
1847
|
+
* You can customize the selected client output through its plugin. You can
|
|
1848
|
+
* also set `client` to `true` to automatically choose the client from your
|
|
1849
|
+
* defined plugins. If we can't detect a client plugin when using `true`, we
|
|
1850
|
+
* will default to `@hey-api/client-httpx`.
|
|
1851
|
+
*
|
|
1852
|
+
* @default true
|
|
1853
|
+
*/
|
|
1854
|
+
client?: PluginClientNames | boolean;
|
|
1855
|
+
/**
|
|
1856
|
+
* Generate code examples for SDK operations and attach them to the
|
|
1857
|
+
* input source (e.g., via `x-codeSamples`).
|
|
1858
|
+
*
|
|
1859
|
+
* Set to `false` to disable example generation entirely, or provide an
|
|
1860
|
+
* object for fine-grained control over the output and post-processing.
|
|
1861
|
+
*
|
|
1862
|
+
* @default false
|
|
1863
|
+
*/
|
|
1864
|
+
examples?: boolean | UserExamplesConfig;
|
|
1865
|
+
/**
|
|
1866
|
+
* Define the structure of generated SDK operations.
|
|
1867
|
+
*
|
|
1868
|
+
* String shorthand:
|
|
1869
|
+
* - `'byTags'` – one container per operation tag
|
|
1870
|
+
* - `'single'` – all operations in a single container
|
|
1871
|
+
* - custom function for full control
|
|
1872
|
+
*
|
|
1873
|
+
* Use the object form for advanced configuration.
|
|
1874
|
+
*
|
|
1875
|
+
* @default 'single'
|
|
1876
|
+
*/
|
|
1877
|
+
operations?: Exclude<OperationsStrategy, 'flat'> | UserOperationsConfig;
|
|
1878
|
+
/**
|
|
1879
|
+
* Define how request parameters are structured in generated SDK methods.
|
|
1880
|
+
*
|
|
1881
|
+
* - `'flat'` merges parameters into a single object.
|
|
1882
|
+
* - `'grouped'` separates parameters by transport layer.
|
|
1883
|
+
*
|
|
1884
|
+
* Use `'flat'` for simpler calls or `'grouped'` for stricter typing and code clarity.
|
|
1885
|
+
*
|
|
1886
|
+
* @default 'grouped'
|
|
1887
|
+
*/
|
|
1888
|
+
paramsStructure?: 'flat' | 'grouped';
|
|
1889
|
+
};
|
|
1890
|
+
type Config$1 = Plugin.Name<'@hey-api/python-sdk'> & Plugin.Hooks & Plugin.Comments & Plugin.Exports & {
|
|
1891
|
+
/**
|
|
1892
|
+
* Use an internal client instance to send HTTP requests? This is useful if
|
|
1893
|
+
* you don't want to manually pass the client to each SDK function.
|
|
1894
|
+
*
|
|
1895
|
+
* You can customize the selected client output through its plugin. You can
|
|
1896
|
+
* also set `client` to `true` to automatically choose the client from your
|
|
1897
|
+
* defined plugins. If we can't detect a client plugin when using `true`, we
|
|
1898
|
+
* will default to `@hey-api/client-httpx`.
|
|
1899
|
+
*
|
|
1900
|
+
* @default true
|
|
1901
|
+
*/
|
|
1902
|
+
client: PluginClientNames | false;
|
|
1903
|
+
/**
|
|
1904
|
+
* Configuration for generating SDK code examples.
|
|
1905
|
+
*/
|
|
1906
|
+
examples: ExamplesConfig;
|
|
1907
|
+
/**
|
|
1908
|
+
* Define the structure of generated SDK operations.
|
|
1909
|
+
*/
|
|
1910
|
+
operations: OperationsConfig;
|
|
1911
|
+
/**
|
|
1912
|
+
* Define how request parameters are structured in generated SDK methods.
|
|
1913
|
+
*
|
|
1914
|
+
* - `'flat'` merges parameters into a single object.
|
|
1915
|
+
* - `'grouped'` separates parameters by transport layer.
|
|
1916
|
+
*
|
|
1917
|
+
* Use `'flat'` for simpler calls or `'grouped'` for stricter typing and code clarity.
|
|
1918
|
+
*
|
|
1919
|
+
* @default 'grouped'
|
|
1920
|
+
*/
|
|
1921
|
+
paramsStructure: 'flat' | 'grouped';
|
|
1922
|
+
};
|
|
1923
|
+
type HeyApiSdkPlugin = DefinePlugin<UserConfig$1, Config$1, never, SdkImports>;
|
|
1924
|
+
//#endregion
|
|
1925
|
+
//#region src/plugins/pydantic/imports.d.ts
|
|
1926
|
+
declare function pydanticImports(plugin: PluginInstance): {
|
|
1927
|
+
datetime: {
|
|
1928
|
+
date: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1929
|
+
datetime: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1930
|
+
time: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1931
|
+
timedelta: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1932
|
+
};
|
|
1933
|
+
enum: {
|
|
1934
|
+
Enum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1935
|
+
IntEnum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1936
|
+
StrEnum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1937
|
+
};
|
|
1938
|
+
typing: {
|
|
1939
|
+
Annotated: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1940
|
+
Any: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1941
|
+
Literal: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1942
|
+
NoReturn: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1943
|
+
Optional: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1944
|
+
Tuple: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1945
|
+
TypeAlias: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1946
|
+
Union: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1947
|
+
};
|
|
1948
|
+
uuid: {
|
|
1949
|
+
UUID: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1950
|
+
};
|
|
1951
|
+
AnyUrl: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1952
|
+
BaseModel: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1953
|
+
ConfigDict: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1954
|
+
EmailStr: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1955
|
+
Field: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1956
|
+
RootModel: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1957
|
+
dataclass: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
1958
|
+
};
|
|
1959
|
+
type PydanticImports = ReturnType<typeof pydanticImports>;
|
|
1960
|
+
//#endregion
|
|
1961
|
+
//#region src/plugins/pydantic/dsl/decl/enum.d.ts
|
|
1962
|
+
declare const Mixed$4: MixinCtor<abstract new () => PyDsl<PyClassDeclaration, "python">, DocMethods>;
|
|
1963
|
+
declare class PydanticEnumDsl extends Mixed$4 {
|
|
1964
|
+
readonly '~dsl' = "PydanticEnumDsl";
|
|
1965
|
+
private _dsl?;
|
|
1966
|
+
private _members;
|
|
1967
|
+
constructor(name: NodeName);
|
|
1968
|
+
members(...members: ReadonlyArray<EnumMember>): this;
|
|
1969
|
+
_build(): ReturnType<typeof $$1.enum>;
|
|
1970
|
+
analyze(ctx: AnalysisContext): void;
|
|
1971
|
+
toAst(): PyClassDeclaration;
|
|
1972
|
+
}
|
|
1973
|
+
//#endregion
|
|
1974
|
+
//#region src/py-dsl/mixins/optional.d.ts
|
|
1975
|
+
interface OptionalMethods extends Node$1 {
|
|
1976
|
+
_optional?: boolean;
|
|
1977
|
+
/** Marks the node as optional when the condition is true. */
|
|
1978
|
+
optional(condition?: boolean): this;
|
|
1979
|
+
/** Marks the node as required when the condition is true. */
|
|
1980
|
+
required(condition?: boolean): this;
|
|
1981
|
+
}
|
|
1982
|
+
//#endregion
|
|
1983
|
+
//#region src/plugins/pydantic/dsl/expr/constraints.d.ts
|
|
1984
|
+
interface PydanticFieldConstraints {
|
|
1985
|
+
description?: string;
|
|
1986
|
+
/** Greater than or equal constraint for numbers. */
|
|
1987
|
+
ge?: number;
|
|
1988
|
+
/** Greater than constraint for numbers. */
|
|
1989
|
+
gt?: number;
|
|
1990
|
+
/** Less than or equal constraint for numbers. */
|
|
1991
|
+
le?: number;
|
|
1992
|
+
/** Less than constraint for numbers. */
|
|
1993
|
+
lt?: number;
|
|
1994
|
+
/** Maximum length constraint for strings/arrays. */
|
|
1995
|
+
max_length?: number;
|
|
1996
|
+
/** Minimum length constraint for strings/arrays. */
|
|
1997
|
+
min_length?: number;
|
|
1998
|
+
/** Multiple of constraint for numbers. */
|
|
1999
|
+
multiple_of?: number;
|
|
2000
|
+
/** Regex pattern constraint for strings. */
|
|
2001
|
+
pattern?: RString;
|
|
2002
|
+
title?: string;
|
|
2003
|
+
}
|
|
2004
|
+
declare class PydanticConstraintsDsl {
|
|
2005
|
+
readonly '~dsl' = "PydanticConstraintsDsl";
|
|
2006
|
+
private _values;
|
|
2007
|
+
get hasValidationConstraints(): boolean;
|
|
2008
|
+
get isEmpty(): boolean;
|
|
2009
|
+
get values(): Readonly<PydanticFieldConstraints>;
|
|
2010
|
+
description(text: string): this;
|
|
2011
|
+
ge(n: number): this;
|
|
2012
|
+
gt(n: number): this;
|
|
2013
|
+
le(n: number): this;
|
|
2014
|
+
lt(n: number): this;
|
|
2015
|
+
maxLength(n: number): this;
|
|
2016
|
+
merge(other: PydanticConstraintsDsl): PydanticConstraintsDsl;
|
|
2017
|
+
minLength(n: number): this;
|
|
2018
|
+
multipleOf(n: number): this;
|
|
2019
|
+
pattern(p: string): this;
|
|
2020
|
+
title(text: string): this;
|
|
2021
|
+
}
|
|
2022
|
+
//#endregion
|
|
2023
|
+
//#region src/plugins/pydantic/dsl/expr/constrained-type.d.ts
|
|
2024
|
+
declare class PydanticConstrainedTypeDsl {
|
|
2025
|
+
readonly '~dsl' = "PydanticConstrainedTypeDsl";
|
|
2026
|
+
readonly constraints: PydanticConstraintsDsl;
|
|
2027
|
+
readonly type: NodeName | MaybePyDsl<py.Expression>;
|
|
2028
|
+
constructor(type: NodeName | MaybePyDsl<py.Expression>, constraints?: PydanticConstraintsDsl);
|
|
2029
|
+
mergeConstraints(constraints: PydanticConstraintsDsl): this;
|
|
2030
|
+
}
|
|
2031
|
+
//#endregion
|
|
2032
|
+
//#region src/plugins/pydantic/dsl/decl/field.d.ts
|
|
2033
|
+
declare const Mixed$3: MixinCtor<abstract new () => PyDsl<PyStatement, "python">, OptionalMethods>;
|
|
2034
|
+
declare class PydanticFieldDsl extends Mixed$3 {
|
|
2035
|
+
readonly '~dsl' = "PydanticFieldDsl";
|
|
2036
|
+
protected plugin: PydanticPlugin['Instance'];
|
|
2037
|
+
private _decision?;
|
|
2038
|
+
private _fieldArgs?;
|
|
2039
|
+
private _pythonName;
|
|
2040
|
+
private _wireName;
|
|
2041
|
+
private _alias?;
|
|
2042
|
+
private _default;
|
|
2043
|
+
private _defaultFactory?;
|
|
2044
|
+
private _deprecated?;
|
|
2045
|
+
private _discriminator?;
|
|
2046
|
+
private _dsl?;
|
|
2047
|
+
private _constrainedType?;
|
|
2048
|
+
private _nullable?;
|
|
2049
|
+
private _unionMembers?;
|
|
2050
|
+
constructor(plugin: PydanticPlugin['Instance'], name: string);
|
|
2051
|
+
get hasAlias(): boolean;
|
|
2052
|
+
alias(name: string): this;
|
|
2053
|
+
default(value: unknown): this;
|
|
2054
|
+
defaultFactory(factory: string): this;
|
|
2055
|
+
deprecated(value: boolean): this;
|
|
2056
|
+
discriminator(field: string): this;
|
|
2057
|
+
metadata(constrainedType: PydanticConstrainedTypeDsl): this;
|
|
2058
|
+
nullable(value: boolean): this;
|
|
2059
|
+
type(constrainedType: PydanticConstrainedTypeDsl | Array<PydanticConstrainedTypeDsl>): this;
|
|
2060
|
+
private _buildUnionVarType;
|
|
2061
|
+
private _constraintsToKwargs;
|
|
2062
|
+
_build(): ReturnType<typeof $$1.field>;
|
|
2063
|
+
analyze(ctx: AnalysisContext): void;
|
|
2064
|
+
toAst(): PyAssignment;
|
|
2065
|
+
}
|
|
2066
|
+
//#endregion
|
|
2067
|
+
//#region src/plugins/pydantic/shared/types.d.ts
|
|
2068
|
+
/** Return type for toType converters. */
|
|
2069
|
+
interface PydanticType {
|
|
2070
|
+
/** Discriminator property name, present when this type is a discriminated union. */
|
|
2071
|
+
discriminator?: string;
|
|
2072
|
+
/** Pre-resolved node. */
|
|
2073
|
+
node?: PydanticNode;
|
|
2074
|
+
type?: ReturnType<typeof $.constrainedType>;
|
|
2075
|
+
/** Per-member constrained types for union fields. Present only on union results. */
|
|
2076
|
+
unionMembers?: Array<ReturnType<typeof $.constrainedType>>;
|
|
2077
|
+
}
|
|
2078
|
+
/** Metadata that flows through schema walking. */
|
|
2079
|
+
interface PydanticMeta {
|
|
2080
|
+
/** Default value from schema. */
|
|
2081
|
+
default?: unknown;
|
|
2082
|
+
/** Whether this or any child contains a forward reference. */
|
|
2083
|
+
hasForwardReference: boolean;
|
|
2084
|
+
/** Does this schema explicitly allow null? */
|
|
2085
|
+
nullable: boolean;
|
|
2086
|
+
/** Is this schema read-only? */
|
|
2087
|
+
readonly: boolean;
|
|
2088
|
+
}
|
|
2089
|
+
/** Result from walking a schema node. */
|
|
2090
|
+
interface PydanticResult extends PydanticType {
|
|
2091
|
+
meta: PydanticMeta;
|
|
2092
|
+
}
|
|
2093
|
+
interface PydanticModelConfig {
|
|
2094
|
+
extra?: 'allow' | 'forbid' | 'ignore';
|
|
2095
|
+
populate_by_name?: boolean;
|
|
2096
|
+
}
|
|
2097
|
+
/** Discriminated union of all finalized schema outputs. */
|
|
2098
|
+
type PydanticNode = {
|
|
2099
|
+
kind: 'alias';
|
|
2100
|
+
type: ReturnType<typeof $.constrainedType>;
|
|
2101
|
+
} | {
|
|
2102
|
+
kind: 'enum';
|
|
2103
|
+
members: Array<EnumMember>;
|
|
2104
|
+
} | {
|
|
2105
|
+
config?: PydanticModelConfig;
|
|
2106
|
+
fields: Array<ReturnType<typeof $.field>>;
|
|
2107
|
+
kind: 'model';
|
|
2108
|
+
} | {
|
|
2109
|
+
discriminator?: string;
|
|
2110
|
+
kind: 'rootModel';
|
|
2111
|
+
type: ReturnType<typeof $.constrainedType>;
|
|
2112
|
+
};
|
|
2113
|
+
//#endregion
|
|
2114
|
+
//#region src/plugins/pydantic/dsl/decl/model.d.ts
|
|
2115
|
+
declare const Mixed$2: MixinCtor<abstract new () => PyDsl<PyClassDeclaration, "python">, DocMethods>;
|
|
2116
|
+
declare class PydanticModelDsl extends Mixed$2 {
|
|
2117
|
+
readonly '~dsl' = "PydanticModelDsl";
|
|
2118
|
+
protected plugin: PydanticPlugin['Instance'];
|
|
2119
|
+
private _bases;
|
|
2120
|
+
private _configKwargs;
|
|
2121
|
+
private _dsl?;
|
|
2122
|
+
private _fields;
|
|
2123
|
+
constructor(plugin: PydanticPlugin['Instance'], name: NodeName);
|
|
2124
|
+
config(options: PydanticModelConfig): this;
|
|
2125
|
+
extends(base: NodeName): this;
|
|
2126
|
+
fields(...fields: ReadonlyArray<PydanticFieldDsl>): this;
|
|
2127
|
+
_build(): ReturnType<typeof $$1.class>;
|
|
2128
|
+
analyze(ctx: AnalysisContext): void;
|
|
2129
|
+
toAst(): PyClassDeclaration;
|
|
2130
|
+
}
|
|
2131
|
+
//#endregion
|
|
2132
|
+
//#region src/plugins/pydantic/dsl/decl/root-model.d.ts
|
|
2133
|
+
declare const Mixed$1: MixinCtor<abstract new () => PyDsl<PyClassDeclaration, "python">, DocMethods>;
|
|
2134
|
+
declare class PydanticRootModelDsl extends Mixed$1 {
|
|
2135
|
+
readonly '~dsl' = "PydanticRootModelDsl";
|
|
2136
|
+
protected plugin: PydanticPlugin['Instance'];
|
|
2137
|
+
private _discriminator?;
|
|
2138
|
+
private _dsl?;
|
|
2139
|
+
private _type?;
|
|
2140
|
+
constructor(plugin: PydanticPlugin['Instance'], name: NodeName);
|
|
2141
|
+
type(constrainedType: PydanticConstrainedTypeDsl): this;
|
|
2142
|
+
discriminator(field: string): this;
|
|
2143
|
+
_build(): ReturnType<typeof $$1.class>;
|
|
2144
|
+
analyze(ctx: AnalysisContext): void;
|
|
2145
|
+
toAst(): PyClassDeclaration;
|
|
2146
|
+
}
|
|
2147
|
+
//#endregion
|
|
2148
|
+
//#region src/plugins/pydantic/dsl/decl/type-alias.d.ts
|
|
2149
|
+
declare const Mixed: abstract new () => PyDsl<PyStatement, "python">;
|
|
2150
|
+
declare class PydanticTypeAliasDsl extends Mixed {
|
|
2151
|
+
readonly '~dsl' = "PydanticTypeAliasDsl";
|
|
2152
|
+
readonly aliased?: PydanticConstrainedTypeDsl;
|
|
2153
|
+
protected plugin: PydanticPlugin['Instance'];
|
|
2154
|
+
private _dsl?;
|
|
2155
|
+
constructor(plugin: PydanticPlugin['Instance'], name: NodeName, aliased?: PydanticConstrainedTypeDsl);
|
|
2156
|
+
_build(): ReturnType<typeof $$1.var>;
|
|
2157
|
+
analyze(ctx: AnalysisContext): void;
|
|
2158
|
+
toAst(): PyAssignment;
|
|
2159
|
+
}
|
|
2160
|
+
//#endregion
|
|
2161
|
+
//#region src/plugins/pydantic/dsl/index.d.ts
|
|
2162
|
+
declare const $: ((plugin: import("@hey-api/shared").PluginInstance<import("@hey-api/shared").Plugin.Types<UserConfig, Config, never, {
|
|
2163
|
+
datetime: {
|
|
2164
|
+
date: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2165
|
+
datetime: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2166
|
+
time: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2167
|
+
timedelta: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2168
|
+
};
|
|
2169
|
+
enum: {
|
|
2170
|
+
Enum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2171
|
+
IntEnum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2172
|
+
StrEnum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2173
|
+
};
|
|
2174
|
+
typing: {
|
|
2175
|
+
Annotated: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2176
|
+
Any: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2177
|
+
Literal: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2178
|
+
NoReturn: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2179
|
+
Optional: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2180
|
+
Tuple: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2181
|
+
TypeAlias: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2182
|
+
Union: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2183
|
+
};
|
|
2184
|
+
uuid: {
|
|
2185
|
+
UUID: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2186
|
+
};
|
|
2187
|
+
AnyUrl: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2188
|
+
BaseModel: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2189
|
+
ConfigDict: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2190
|
+
EmailStr: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2191
|
+
Field: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2192
|
+
RootModel: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2193
|
+
dataclass: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2194
|
+
}>>, name: import("@hey-api/codegen-core").NodeName) => PydanticModelDsl) & {
|
|
2195
|
+
/** Constrained type: a type with attached validation constraints and metadata. */constrainedType: (type: PyExpression | import("@hey-api/codegen-core").NodeName | PyDsl<PyExpression, "python">, constraints?: PydanticConstraintsDsl | undefined) => PydanticConstrainedTypeDsl; /** Constraints bag: validation constraints and field metadata. */
|
|
2196
|
+
constraints: () => PydanticConstraintsDsl; /** Pydantic enum class. */
|
|
2197
|
+
enum: (name: import("@hey-api/codegen-core").NodeName) => PydanticEnumDsl; /** Pydantic field. */
|
|
2198
|
+
field: (plugin: import("@hey-api/shared").PluginInstance<import("@hey-api/shared").Plugin.Types<UserConfig, Config, never, {
|
|
2199
|
+
datetime: {
|
|
2200
|
+
date: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2201
|
+
datetime: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2202
|
+
time: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2203
|
+
timedelta: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2204
|
+
};
|
|
2205
|
+
enum: {
|
|
2206
|
+
Enum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2207
|
+
IntEnum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2208
|
+
StrEnum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2209
|
+
};
|
|
2210
|
+
typing: {
|
|
2211
|
+
Annotated: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2212
|
+
Any: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2213
|
+
Literal: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2214
|
+
NoReturn: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2215
|
+
Optional: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2216
|
+
Tuple: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2217
|
+
TypeAlias: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2218
|
+
Union: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2219
|
+
};
|
|
2220
|
+
uuid: {
|
|
2221
|
+
UUID: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2222
|
+
};
|
|
2223
|
+
AnyUrl: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2224
|
+
BaseModel: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2225
|
+
ConfigDict: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2226
|
+
EmailStr: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2227
|
+
Field: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2228
|
+
RootModel: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2229
|
+
dataclass: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2230
|
+
}>>, name: string) => PydanticFieldDsl; /** Pydantic model class. */
|
|
2231
|
+
model: (plugin: import("@hey-api/shared").PluginInstance<import("@hey-api/shared").Plugin.Types<UserConfig, Config, never, {
|
|
2232
|
+
datetime: {
|
|
2233
|
+
date: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2234
|
+
datetime: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2235
|
+
time: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2236
|
+
timedelta: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2237
|
+
};
|
|
2238
|
+
enum: {
|
|
2239
|
+
Enum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2240
|
+
IntEnum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2241
|
+
StrEnum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2242
|
+
};
|
|
2243
|
+
typing: {
|
|
2244
|
+
Annotated: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2245
|
+
Any: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2246
|
+
Literal: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2247
|
+
NoReturn: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2248
|
+
Optional: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2249
|
+
Tuple: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2250
|
+
TypeAlias: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2251
|
+
Union: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2252
|
+
};
|
|
2253
|
+
uuid: {
|
|
2254
|
+
UUID: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2255
|
+
};
|
|
2256
|
+
AnyUrl: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2257
|
+
BaseModel: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2258
|
+
ConfigDict: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2259
|
+
EmailStr: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2260
|
+
Field: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2261
|
+
RootModel: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2262
|
+
dataclass: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2263
|
+
}>>, name: import("@hey-api/codegen-core").NodeName) => PydanticModelDsl; /** Pydantic RootModel class. */
|
|
2264
|
+
rootModel: (plugin: import("@hey-api/shared").PluginInstance<import("@hey-api/shared").Plugin.Types<UserConfig, Config, never, {
|
|
2265
|
+
datetime: {
|
|
2266
|
+
date: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2267
|
+
datetime: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2268
|
+
time: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2269
|
+
timedelta: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2270
|
+
};
|
|
2271
|
+
enum: {
|
|
2272
|
+
Enum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2273
|
+
IntEnum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2274
|
+
StrEnum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2275
|
+
};
|
|
2276
|
+
typing: {
|
|
2277
|
+
Annotated: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2278
|
+
Any: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2279
|
+
Literal: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2280
|
+
NoReturn: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2281
|
+
Optional: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2282
|
+
Tuple: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2283
|
+
TypeAlias: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2284
|
+
Union: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2285
|
+
};
|
|
2286
|
+
uuid: {
|
|
2287
|
+
UUID: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2288
|
+
};
|
|
2289
|
+
AnyUrl: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2290
|
+
BaseModel: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2291
|
+
ConfigDict: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2292
|
+
EmailStr: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2293
|
+
Field: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2294
|
+
RootModel: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2295
|
+
dataclass: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2296
|
+
}>>, name: import("@hey-api/codegen-core").NodeName) => PydanticRootModelDsl; /** Pydantic type alias. */
|
|
2297
|
+
typeAlias: (plugin: import("@hey-api/shared").PluginInstance<import("@hey-api/shared").Plugin.Types<UserConfig, Config, never, {
|
|
2298
|
+
datetime: {
|
|
2299
|
+
date: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2300
|
+
datetime: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2301
|
+
time: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2302
|
+
timedelta: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2303
|
+
};
|
|
2304
|
+
enum: {
|
|
2305
|
+
Enum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2306
|
+
IntEnum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2307
|
+
StrEnum: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2308
|
+
};
|
|
2309
|
+
typing: {
|
|
2310
|
+
Annotated: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2311
|
+
Any: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2312
|
+
Literal: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2313
|
+
NoReturn: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2314
|
+
Optional: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2315
|
+
Tuple: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2316
|
+
TypeAlias: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2317
|
+
Union: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2318
|
+
};
|
|
2319
|
+
uuid: {
|
|
2320
|
+
UUID: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2321
|
+
};
|
|
2322
|
+
AnyUrl: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2323
|
+
BaseModel: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2324
|
+
ConfigDict: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2325
|
+
EmailStr: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2326
|
+
Field: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2327
|
+
RootModel: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2328
|
+
dataclass: import("@hey-api/codegen-core").Symbol<import("@hey-api/codegen-core").Node<unknown, import("@hey-api/codegen-core").Language>>;
|
|
2329
|
+
}>>, name: import("@hey-api/codegen-core").NodeName, aliased?: PydanticConstrainedTypeDsl | undefined) => PydanticTypeAliasDsl;
|
|
2330
|
+
};
|
|
2331
|
+
//#endregion
|
|
2332
|
+
//#region src/plugins/pydantic/resolvers.d.ts
|
|
2333
|
+
type PydanticResolvers = Plugin.Resolvers<{
|
|
2334
|
+
/**
|
|
2335
|
+
* Resolver for array schemas.
|
|
2336
|
+
*
|
|
2337
|
+
* Allows customization of how array types are rendered.
|
|
2338
|
+
*
|
|
2339
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2340
|
+
*/
|
|
2341
|
+
array?: (ctx: ArrayResolverContext) => PydanticType | undefined;
|
|
2342
|
+
/**
|
|
2343
|
+
* Resolver for boolean schemas.
|
|
2344
|
+
*
|
|
2345
|
+
* Allows customization of how boolean types are rendered.
|
|
2346
|
+
*
|
|
2347
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2348
|
+
*/
|
|
2349
|
+
boolean?: (ctx: BooleanResolverContext) => PydanticType | undefined;
|
|
2350
|
+
/**
|
|
2351
|
+
* Resolver for enum schemas.
|
|
2352
|
+
*
|
|
2353
|
+
* Allows customization of how enum types are rendered.
|
|
2354
|
+
*
|
|
2355
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2356
|
+
*/
|
|
2357
|
+
enum?: (ctx: EnumResolverContext) => PydanticType | undefined;
|
|
2358
|
+
/**
|
|
2359
|
+
* Resolver for intersection schemas.
|
|
2360
|
+
*
|
|
2361
|
+
* Allows customization of how intersection types are rendered.
|
|
2362
|
+
*
|
|
2363
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2364
|
+
*/
|
|
2365
|
+
intersection?: (ctx: IntersectionResolverContext) => PydanticType | undefined;
|
|
2366
|
+
/**
|
|
2367
|
+
* Resolver for never schemas.
|
|
2368
|
+
*
|
|
2369
|
+
* Allows customization of how never types are rendered.
|
|
2370
|
+
*
|
|
2371
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2372
|
+
*/
|
|
2373
|
+
never?: (ctx: NeverResolverContext) => PydanticType | undefined;
|
|
2374
|
+
/**
|
|
2375
|
+
* Resolver for null schemas.
|
|
2376
|
+
*
|
|
2377
|
+
* Allows customization of how null types are rendered.
|
|
2378
|
+
*
|
|
2379
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2380
|
+
*/
|
|
2381
|
+
null?: (ctx: NullResolverContext) => PydanticType | undefined;
|
|
2382
|
+
/**
|
|
2383
|
+
* Resolver for number schemas.
|
|
2384
|
+
*
|
|
2385
|
+
* Allows customization of how number types are rendered.
|
|
2386
|
+
*
|
|
2387
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2388
|
+
*/
|
|
2389
|
+
number?: (ctx: NumberResolverContext) => PydanticType | undefined;
|
|
2390
|
+
/**
|
|
2391
|
+
* Resolver for object schemas.
|
|
2392
|
+
*
|
|
2393
|
+
* Allows customization of how object types are rendered.
|
|
2394
|
+
*
|
|
2395
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2396
|
+
*/
|
|
2397
|
+
object?: (ctx: ObjectResolverContext) => PydanticType | undefined;
|
|
2398
|
+
/**
|
|
2399
|
+
* Resolver for string schemas.
|
|
2400
|
+
*
|
|
2401
|
+
* Allows customization of how string types are rendered.
|
|
2402
|
+
*
|
|
2403
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2404
|
+
*/
|
|
2405
|
+
string?: (ctx: StringResolverContext) => PydanticType | undefined;
|
|
2406
|
+
/**
|
|
2407
|
+
* Resolver for tuple schemas.
|
|
2408
|
+
*
|
|
2409
|
+
* Allows customization of how tuple types are rendered.
|
|
2410
|
+
*
|
|
2411
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2412
|
+
*/
|
|
2413
|
+
tuple?: (ctx: TupleResolverContext) => PydanticType | undefined;
|
|
2414
|
+
/**
|
|
2415
|
+
* Resolver for undefined schemas.
|
|
2416
|
+
*
|
|
2417
|
+
* Allows customization of how undefined types are rendered.
|
|
2418
|
+
*
|
|
2419
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2420
|
+
*/
|
|
2421
|
+
undefined?: (ctx: UndefinedResolverContext) => PydanticType | undefined;
|
|
2422
|
+
/**
|
|
2423
|
+
* Resolver for union schemas.
|
|
2424
|
+
*
|
|
2425
|
+
* Allows customization of how union types are rendered.
|
|
2426
|
+
*
|
|
2427
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2428
|
+
*/
|
|
2429
|
+
union?: (ctx: UnionResolverContext) => PydanticType | undefined;
|
|
2430
|
+
/**
|
|
2431
|
+
* Resolver for unknown schemas.
|
|
2432
|
+
*
|
|
2433
|
+
* Allows customization of how unknown types are rendered.
|
|
2434
|
+
*
|
|
2435
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2436
|
+
*/
|
|
2437
|
+
unknown?: (ctx: UnknownResolverContext) => PydanticType | undefined;
|
|
2438
|
+
/**
|
|
2439
|
+
* Resolver for void schemas.
|
|
2440
|
+
*
|
|
2441
|
+
* Allows customization of how void types are rendered.
|
|
2442
|
+
*
|
|
2443
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
2444
|
+
*/
|
|
2445
|
+
void?: (ctx: VoidResolverContext) => PydanticType | undefined;
|
|
2446
|
+
}>;
|
|
2447
|
+
interface BaseContext extends DollarPyDsl, SchemaVisitorContext<PydanticPlugin['Instance']> {}
|
|
2448
|
+
interface ArrayResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2449
|
+
base: (ctx: ArrayResolverContext) => PydanticType;
|
|
2450
|
+
}> {
|
|
2451
|
+
applyModifiers: (result: PydanticResult, opts?: {
|
|
2452
|
+
optional?: boolean;
|
|
2453
|
+
}) => PydanticResult;
|
|
2454
|
+
childResults: Array<PydanticResult>;
|
|
2455
|
+
schema: SchemaWithType<'array'>;
|
|
2456
|
+
walk: Walker<PydanticResult, PydanticPlugin['Instance']>;
|
|
2457
|
+
}
|
|
2458
|
+
interface BooleanResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2459
|
+
base: (ctx: BooleanResolverContext) => PydanticType;
|
|
2460
|
+
const: (ctx: BooleanResolverContext) => PydanticType | undefined;
|
|
2461
|
+
}> {
|
|
2462
|
+
schema: SchemaWithType<'boolean'>;
|
|
2463
|
+
}
|
|
2464
|
+
interface EnumResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2465
|
+
base: (ctx: EnumResolverContext) => PydanticType;
|
|
2466
|
+
items: (ctx: EnumResolverContext) => {
|
|
2467
|
+
enumMembers: Array<EnumMember>;
|
|
2468
|
+
isNullable: boolean;
|
|
2469
|
+
};
|
|
2470
|
+
}> {
|
|
2471
|
+
schema: SchemaWithType<'enum'>;
|
|
2472
|
+
}
|
|
2473
|
+
interface IntersectionResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2474
|
+
base: (ctx: IntersectionResolverContext) => PydanticType;
|
|
2475
|
+
}> {
|
|
2476
|
+
applyModifiers: (result: PydanticResult, opts?: {
|
|
2477
|
+
optional?: boolean;
|
|
2478
|
+
}) => PydanticResult;
|
|
2479
|
+
childResults: Array<PydanticResult>;
|
|
2480
|
+
parentSchema: IR.SchemaObject;
|
|
2481
|
+
schema: IR.SchemaObject;
|
|
2482
|
+
}
|
|
2483
|
+
interface NeverResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2484
|
+
base: (ctx: NeverResolverContext) => PydanticType;
|
|
2485
|
+
}> {
|
|
2486
|
+
schema: SchemaWithType<'never'>;
|
|
2487
|
+
}
|
|
2488
|
+
interface NullResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2489
|
+
base: (ctx: NullResolverContext) => PydanticType;
|
|
2490
|
+
}> {
|
|
2491
|
+
schema: SchemaWithType<'null'>;
|
|
2492
|
+
}
|
|
2493
|
+
interface NumberResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2494
|
+
base: (ctx: NumberResolverContext) => PydanticType;
|
|
2495
|
+
const: (ctx: NumberResolverContext) => PydanticType | undefined;
|
|
2496
|
+
}> {
|
|
2497
|
+
schema: SchemaWithType<'integer' | 'number'>;
|
|
2498
|
+
}
|
|
2499
|
+
interface ObjectResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2500
|
+
additionalProperties: (ctx: ObjectResolverContext) => PydanticType | null | undefined;
|
|
2501
|
+
base: (ctx: ObjectResolverContext) => PydanticType;
|
|
2502
|
+
fields: (ctx: ObjectResolverContext) => Array<ReturnType<typeof $.field>>;
|
|
2503
|
+
}> {
|
|
2504
|
+
_childResults: Array<PydanticResult>;
|
|
2505
|
+
applyModifiers: (result: PydanticResult, opts: {
|
|
2506
|
+
optional?: boolean;
|
|
2507
|
+
}) => PydanticResult;
|
|
2508
|
+
schema: SchemaWithType<'object'>;
|
|
2509
|
+
walk: Walker<PydanticResult, PydanticPlugin['Instance']>;
|
|
2510
|
+
}
|
|
2511
|
+
interface StringResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2512
|
+
base: (ctx: StringResolverContext) => PydanticType;
|
|
2513
|
+
const: (ctx: StringResolverContext) => PydanticType | undefined;
|
|
2514
|
+
format: (ctx: StringResolverContext) => PydanticType | undefined;
|
|
2515
|
+
}> {
|
|
2516
|
+
schema: SchemaWithType<'string'>;
|
|
2517
|
+
}
|
|
2518
|
+
interface TupleResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2519
|
+
base: (ctx: TupleResolverContext) => PydanticType;
|
|
2520
|
+
const: (ctx: TupleResolverContext) => PydanticType | undefined;
|
|
2521
|
+
}> {
|
|
2522
|
+
applyModifiers: (result: PydanticResult, opts?: {
|
|
2523
|
+
optional?: boolean;
|
|
2524
|
+
}) => PydanticResult;
|
|
2525
|
+
childResults: Array<PydanticResult>;
|
|
2526
|
+
schema: SchemaWithType<'tuple'>;
|
|
2527
|
+
walk: Walker<PydanticResult, PydanticPlugin['Instance']>;
|
|
2528
|
+
}
|
|
2529
|
+
interface UndefinedResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2530
|
+
base: (ctx: UndefinedResolverContext) => PydanticType;
|
|
2531
|
+
}> {
|
|
2532
|
+
schema: SchemaWithType<'undefined'>;
|
|
2533
|
+
}
|
|
2534
|
+
interface UnionResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2535
|
+
base: (ctx: UnionResolverContext) => PydanticType;
|
|
2536
|
+
}> {
|
|
2537
|
+
applyModifiers: (result: PydanticResult, opts?: {
|
|
2538
|
+
optional?: boolean;
|
|
2539
|
+
}) => PydanticResult;
|
|
2540
|
+
childResults: Array<PydanticResult>;
|
|
2541
|
+
parentSchema: IR.SchemaObject;
|
|
2542
|
+
schema: IR.SchemaObject;
|
|
2543
|
+
schemas: ReadonlyArray<IR.SchemaObject>;
|
|
2544
|
+
}
|
|
2545
|
+
interface UnknownResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2546
|
+
base: (ctx: UnknownResolverContext) => PydanticType;
|
|
2547
|
+
}> {
|
|
2548
|
+
schema: SchemaWithType<'unknown'>;
|
|
2549
|
+
}
|
|
2550
|
+
interface VoidResolverContext extends BaseContext, Plugin.ResolverNodes<{
|
|
2551
|
+
base: (ctx: VoidResolverContext) => PydanticType;
|
|
2552
|
+
}> {
|
|
2553
|
+
schema: SchemaWithType<'void'>;
|
|
2554
|
+
}
|
|
2555
|
+
//#endregion
|
|
2556
|
+
//#region src/plugins/pydantic/types.d.ts
|
|
2557
|
+
type UserConfig = Plugin.Name<'pydantic'> & Plugin.Hooks & Plugin.UserComments & Plugin.UserExports & PydanticResolvers & {
|
|
2558
|
+
/**
|
|
2559
|
+
* Casing convention for generated names.
|
|
2560
|
+
*
|
|
2561
|
+
* @default 'PascalCase'
|
|
2562
|
+
*/
|
|
2563
|
+
case?: Casing;
|
|
2564
|
+
/**
|
|
2565
|
+
* Configuration for reusable schema definitions.
|
|
2566
|
+
*
|
|
2567
|
+
* Controls generation of shared Pydantic models that can be referenced
|
|
2568
|
+
* across requests and responses.
|
|
2569
|
+
*
|
|
2570
|
+
* Can be:
|
|
2571
|
+
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
2572
|
+
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
2573
|
+
* - `object`: Full configuration object
|
|
2574
|
+
*
|
|
2575
|
+
* @default true
|
|
2576
|
+
*/
|
|
2577
|
+
definitions?: boolean | NameTransformer | {
|
|
2578
|
+
/**
|
|
2579
|
+
* Casing convention for generated names.
|
|
2580
|
+
*
|
|
2581
|
+
* @default 'PascalCase'
|
|
2582
|
+
*/
|
|
2583
|
+
case?: Casing;
|
|
2584
|
+
/**
|
|
2585
|
+
* Whether this feature is enabled.
|
|
2586
|
+
*
|
|
2587
|
+
* @default true
|
|
2588
|
+
*/
|
|
2589
|
+
enabled?: boolean;
|
|
2590
|
+
/**
|
|
2591
|
+
* Naming pattern for generated names.
|
|
2592
|
+
*
|
|
2593
|
+
* @default '{{name}}'
|
|
2594
|
+
*/
|
|
2595
|
+
name?: NameTransformer;
|
|
2596
|
+
};
|
|
2597
|
+
/**
|
|
2598
|
+
* How to generate enum types.
|
|
2599
|
+
*
|
|
2600
|
+
* - `'enum'`: Generate Python Enum classes (e.g., `class Status(str, Enum): ...`)
|
|
2601
|
+
* - `'literal'`: Generate Literal type hints (e.g., `Literal["pending", "active"]`)
|
|
2602
|
+
*
|
|
2603
|
+
* @default 'enum'
|
|
2604
|
+
*/
|
|
2605
|
+
enums?: 'enum' | 'literal';
|
|
2606
|
+
/**
|
|
2607
|
+
* How to render field constraints.
|
|
2608
|
+
*
|
|
2609
|
+
* - `'field'`: `foo: Optional[int] = Field(default=None, ge=0, le=100)`
|
|
2610
|
+
* - `'annotated'`: `foo: Annotated[Optional[int], Field(ge=0, le=100)] = None`
|
|
2611
|
+
*
|
|
2612
|
+
* @default 'field'
|
|
2613
|
+
*/
|
|
2614
|
+
fieldStyle?: 'annotated' | 'field';
|
|
2615
|
+
/**
|
|
2616
|
+
* Model type to generate.
|
|
2617
|
+
*
|
|
2618
|
+
* - `'BaseModel'`: Pydantic `BaseModel` subclass.
|
|
2619
|
+
* - `'dataclass'`: Pydantic `@dataclass` decorator.
|
|
2620
|
+
*
|
|
2621
|
+
* @default 'BaseModel'
|
|
2622
|
+
*/
|
|
2623
|
+
modelType?: 'BaseModel' | 'dataclass';
|
|
2624
|
+
/**
|
|
2625
|
+
* Configuration for request-specific Pydantic models.
|
|
2626
|
+
*
|
|
2627
|
+
* Controls generation of Pydantic models for request bodies,
|
|
2628
|
+
* query parameters, path parameters, and headers.
|
|
2629
|
+
*
|
|
2630
|
+
* Can be:
|
|
2631
|
+
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
2632
|
+
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
2633
|
+
* - `object`: Full configuration object
|
|
2634
|
+
*
|
|
2635
|
+
* @default true
|
|
2636
|
+
*/
|
|
2637
|
+
requests?: boolean | NameTransformer | {
|
|
2638
|
+
/**
|
|
2639
|
+
* Configuration for request body Pydantic models.
|
|
2640
|
+
*
|
|
2641
|
+
* Can be:
|
|
2642
|
+
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
2643
|
+
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
2644
|
+
* - `object`: Full configuration object
|
|
2645
|
+
*
|
|
2646
|
+
* @default true
|
|
2647
|
+
*/
|
|
2648
|
+
body?: boolean | NameTransformer | {
|
|
2649
|
+
/**
|
|
2650
|
+
* Casing convention for generated names.
|
|
2651
|
+
*
|
|
2652
|
+
* @default 'PascalCase'
|
|
2653
|
+
*/
|
|
2654
|
+
case?: Casing;
|
|
2655
|
+
/**
|
|
2656
|
+
* Whether this feature is enabled.
|
|
2657
|
+
*
|
|
2658
|
+
* @default true
|
|
2659
|
+
*/
|
|
2660
|
+
enabled?: boolean;
|
|
2661
|
+
/**
|
|
2662
|
+
* Naming pattern for generated names.
|
|
2663
|
+
*
|
|
2664
|
+
* @default '{{name}}Body'
|
|
2665
|
+
*/
|
|
2666
|
+
name?: NameTransformer;
|
|
2667
|
+
};
|
|
2668
|
+
/**
|
|
2669
|
+
* Casing convention for generated names.
|
|
2670
|
+
*
|
|
2671
|
+
* @default 'PascalCase'
|
|
2672
|
+
*/
|
|
2673
|
+
case?: Casing;
|
|
2674
|
+
/**
|
|
2675
|
+
* Whether this feature is enabled.
|
|
2676
|
+
*
|
|
2677
|
+
* @default true
|
|
2678
|
+
*/
|
|
2679
|
+
enabled?: boolean;
|
|
2680
|
+
/**
|
|
2681
|
+
* Configuration for request headers Pydantic models.
|
|
2682
|
+
*
|
|
2683
|
+
* Can be:
|
|
2684
|
+
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
2685
|
+
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
2686
|
+
* - `object`: Full configuration object
|
|
2687
|
+
*
|
|
2688
|
+
* @default true
|
|
2689
|
+
*/
|
|
2690
|
+
headers?: boolean | NameTransformer | {
|
|
2691
|
+
/**
|
|
2692
|
+
* Casing convention for generated names.
|
|
2693
|
+
*
|
|
2694
|
+
* @default 'PascalCase'
|
|
2695
|
+
*/
|
|
2696
|
+
case?: Casing;
|
|
2697
|
+
/**
|
|
2698
|
+
* Whether this feature is enabled.
|
|
2699
|
+
*
|
|
2700
|
+
* @default true
|
|
2701
|
+
*/
|
|
2702
|
+
enabled?: boolean;
|
|
2703
|
+
/**
|
|
2704
|
+
* Naming pattern for generated names.
|
|
2705
|
+
*
|
|
2706
|
+
* @default '{{name}}Headers'
|
|
2707
|
+
*/
|
|
2708
|
+
name?: NameTransformer;
|
|
2709
|
+
};
|
|
2710
|
+
/**
|
|
2711
|
+
* Naming pattern for generated names.
|
|
2712
|
+
*
|
|
2713
|
+
* @default '{{name}}Request'
|
|
2714
|
+
*/
|
|
2715
|
+
name?: NameTransformer;
|
|
2716
|
+
/**
|
|
2717
|
+
* Configuration for request path parameters Pydantic models.
|
|
2718
|
+
*
|
|
2719
|
+
* Can be:
|
|
2720
|
+
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
2721
|
+
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
2722
|
+
* - `object`: Full configuration object
|
|
2723
|
+
*
|
|
2724
|
+
* @default true
|
|
2725
|
+
*/
|
|
2726
|
+
path?: boolean | NameTransformer | {
|
|
2727
|
+
/**
|
|
2728
|
+
* Casing convention for generated names.
|
|
2729
|
+
*
|
|
2730
|
+
* @default 'PascalCase'
|
|
2731
|
+
*/
|
|
2732
|
+
case?: Casing;
|
|
2733
|
+
/**
|
|
2734
|
+
* Whether this feature is enabled.
|
|
2735
|
+
*
|
|
2736
|
+
* @default true
|
|
2737
|
+
*/
|
|
2738
|
+
enabled?: boolean;
|
|
2739
|
+
/**
|
|
2740
|
+
* Naming pattern for generated names.
|
|
2741
|
+
*
|
|
2742
|
+
* @default '{{name}}Path'
|
|
2743
|
+
*/
|
|
2744
|
+
name?: NameTransformer;
|
|
2745
|
+
};
|
|
2746
|
+
/**
|
|
2747
|
+
* Configuration for request query parameters Pydantic models.
|
|
2748
|
+
*
|
|
2749
|
+
* Can be:
|
|
2750
|
+
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
2751
|
+
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
2752
|
+
* - `object`: Full configuration object
|
|
2753
|
+
*
|
|
2754
|
+
* @default true
|
|
2755
|
+
*/
|
|
2756
|
+
query?: boolean | NameTransformer | {
|
|
2757
|
+
/**
|
|
2758
|
+
* Casing convention for generated names.
|
|
2759
|
+
*
|
|
2760
|
+
* @default 'PascalCase'
|
|
2761
|
+
*/
|
|
2762
|
+
case?: Casing;
|
|
2763
|
+
/**
|
|
2764
|
+
* Whether this feature is enabled.
|
|
2765
|
+
*
|
|
2766
|
+
* @default true
|
|
2767
|
+
*/
|
|
2768
|
+
enabled?: boolean;
|
|
2769
|
+
/**
|
|
2770
|
+
* Naming pattern for generated names.
|
|
2771
|
+
*
|
|
2772
|
+
* @default '{{name}}Query'
|
|
2773
|
+
*/
|
|
2774
|
+
name?: NameTransformer;
|
|
2775
|
+
};
|
|
2776
|
+
};
|
|
2777
|
+
/**
|
|
2778
|
+
* Configuration for response-specific Pydantic models.
|
|
2779
|
+
*
|
|
2780
|
+
* Controls generation of Pydantic models for response bodies,
|
|
2781
|
+
* error responses, and status codes.
|
|
2782
|
+
*
|
|
2783
|
+
* Can be:
|
|
2784
|
+
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
2785
|
+
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
2786
|
+
* - `object`: Full configuration object
|
|
2787
|
+
*
|
|
2788
|
+
* @default true
|
|
2789
|
+
*/
|
|
2790
|
+
responses?: boolean | NameTransformer | {
|
|
2791
|
+
/**
|
|
2792
|
+
* Casing convention for generated names.
|
|
2793
|
+
*
|
|
2794
|
+
* @default 'PascalCase'
|
|
2795
|
+
*/
|
|
2796
|
+
case?: Casing;
|
|
2797
|
+
/**
|
|
2798
|
+
* Whether this feature is enabled.
|
|
2799
|
+
*
|
|
2800
|
+
* @default true
|
|
2801
|
+
*/
|
|
2802
|
+
enabled?: boolean;
|
|
2803
|
+
/**
|
|
2804
|
+
* Naming pattern for generated names.
|
|
2805
|
+
*
|
|
2806
|
+
* @default '{{name}}Response'
|
|
2807
|
+
*/
|
|
2808
|
+
name?: NameTransformer;
|
|
2809
|
+
};
|
|
2810
|
+
/**
|
|
2811
|
+
* Enable strict mode for Pydantic models?
|
|
2812
|
+
*
|
|
2813
|
+
* When enabled, extra fields not defined in the schema will be rejected.
|
|
2814
|
+
*
|
|
2815
|
+
* This adds `model_config = ConfigDict(extra='forbid')`
|
|
2816
|
+
* to generated models.
|
|
2817
|
+
*
|
|
2818
|
+
* Note: {@link strict} has no effect when `modelType` is `'dataclass'`
|
|
2819
|
+
* as `ConfigDict` is not supported for dataclasses.
|
|
2820
|
+
*
|
|
2821
|
+
* @default false
|
|
2822
|
+
*/
|
|
2823
|
+
strict?: boolean;
|
|
2824
|
+
/**
|
|
2825
|
+
* Configuration for webhook-specific Pydantic models.
|
|
2826
|
+
*
|
|
2827
|
+
* Controls generation of Pydantic models for webhook payloads.
|
|
2828
|
+
*
|
|
2829
|
+
* Can be:
|
|
2830
|
+
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
2831
|
+
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
2832
|
+
* - `object`: Full configuration object
|
|
2833
|
+
*
|
|
2834
|
+
* @default true
|
|
2835
|
+
*/
|
|
2836
|
+
webhooks?: boolean | NameTransformer | {
|
|
2837
|
+
/**
|
|
2838
|
+
* Casing convention for generated names.
|
|
2839
|
+
*
|
|
2840
|
+
* @default 'PascalCase'
|
|
2841
|
+
*/
|
|
2842
|
+
case?: Casing;
|
|
2843
|
+
/**
|
|
2844
|
+
* Whether this feature is enabled.
|
|
2845
|
+
*
|
|
2846
|
+
* @default true
|
|
2847
|
+
*/
|
|
2848
|
+
enabled?: boolean;
|
|
2849
|
+
/**
|
|
2850
|
+
* Naming pattern for generated names.
|
|
2851
|
+
*
|
|
2852
|
+
* @default '{{name}}Webhook'
|
|
2853
|
+
*/
|
|
2854
|
+
name?: NameTransformer;
|
|
2855
|
+
};
|
|
2856
|
+
};
|
|
2857
|
+
type Config = Plugin.Name<'pydantic'> & Plugin.Hooks & Plugin.Comments & Plugin.Exports & PydanticResolvers & {
|
|
2858
|
+
/** Casing convention for generated names. */case: Casing; /** Configuration for reusable schema definitions. */
|
|
2859
|
+
definitions: NamingOptions & FeatureToggle; /** How to generate enum types. */
|
|
2860
|
+
enums: 'enum' | 'literal'; /** How to render field constraints. */
|
|
2861
|
+
fieldStyle: 'annotated' | 'field'; /** Model type to generate. */
|
|
2862
|
+
modelType: 'BaseModel' | 'dataclass'; /** Configuration for request-specific Pydantic models. */
|
|
2863
|
+
requests: NamingOptions & FeatureToggle & {
|
|
2864
|
+
/** Configuration for request body Zod schemas. */body: NamingOptions & FeatureToggle; /** Configuration for request headers Zod schemas. */
|
|
2865
|
+
headers: NamingOptions & FeatureToggle; /** Configuration for request path parameters Zod schemas. */
|
|
2866
|
+
path: NamingOptions & FeatureToggle; /** Configuration for request query parameters Zod schemas. */
|
|
2867
|
+
query: NamingOptions & FeatureToggle;
|
|
2868
|
+
}; /** Configuration for response-specific Pydantic models. */
|
|
2869
|
+
responses: NamingOptions & FeatureToggle; /** Enable strict mode for Pydantic models? */
|
|
2870
|
+
strict: boolean; /** Configuration for webhook-specific Pydantic models. */
|
|
2871
|
+
webhooks: NamingOptions & FeatureToggle;
|
|
2872
|
+
};
|
|
2873
|
+
type PydanticPlugin = DefinePlugin<UserConfig, Config, never, PydanticImports>;
|
|
2874
|
+
declare namespace plugins_d_exports {
|
|
2875
|
+
export { clientHttpx, pydantic, sdk };
|
|
2876
|
+
}
|
|
2877
|
+
declare const clientHttpx: (config?: Omit<UserConfig$2, "name"> | undefined) => import("@hey-api/shared").Plugin.Name<"@hey-api/client-httpx"> & {
|
|
2878
|
+
baseUrl?: string | number | boolean;
|
|
2879
|
+
} & {
|
|
2880
|
+
name: "@hey-api/client-httpx";
|
|
2881
|
+
};
|
|
2882
|
+
declare const sdk: (config?: Omit<UserConfig$1, "name"> | undefined) => import("@hey-api/shared").Plugin.Name<"@hey-api/python-sdk"> & import("@hey-api/shared").Plugin.Hooks & import("@hey-api/shared").UserCommentsOption & import("@hey-api/shared").UserIndexExportOption & {
|
|
2883
|
+
client?: PluginClientNames | boolean;
|
|
2884
|
+
examples?: boolean | UserExamplesConfig;
|
|
2885
|
+
operations?: Exclude<import("@hey-api/shared").OperationsStrategy, "flat"> | UserOperationsConfig;
|
|
2886
|
+
paramsStructure?: "flat" | "grouped";
|
|
2887
|
+
} & {
|
|
2888
|
+
name: "@hey-api/python-sdk";
|
|
2889
|
+
};
|
|
2890
|
+
declare const pydantic: (config?: Omit<UserConfig, "name"> | undefined) => import("@hey-api/shared").Plugin.Name<"pydantic"> & import("@hey-api/shared").Plugin.Hooks & import("@hey-api/shared").UserCommentsOption & import("@hey-api/shared").UserIndexExportOption & PydanticResolvers & {
|
|
2891
|
+
case?: import("@hey-api/shared").Casing;
|
|
2892
|
+
definitions?: boolean | import("@hey-api/shared").NameTransformer | {
|
|
2893
|
+
case?: import("@hey-api/shared").Casing;
|
|
2894
|
+
enabled?: boolean;
|
|
2895
|
+
name?: import("@hey-api/shared").NameTransformer;
|
|
2896
|
+
};
|
|
2897
|
+
enums?: "enum" | "literal";
|
|
2898
|
+
fieldStyle?: "annotated" | "field";
|
|
2899
|
+
modelType?: "BaseModel" | "dataclass";
|
|
2900
|
+
requests?: boolean | import("@hey-api/shared").NameTransformer | {
|
|
2901
|
+
body?: boolean | import("@hey-api/shared").NameTransformer | {
|
|
2902
|
+
case?: import("@hey-api/shared").Casing;
|
|
2903
|
+
enabled?: boolean;
|
|
2904
|
+
name?: import("@hey-api/shared").NameTransformer;
|
|
2905
|
+
};
|
|
2906
|
+
case?: import("@hey-api/shared").Casing;
|
|
2907
|
+
enabled?: boolean;
|
|
2908
|
+
headers?: boolean | import("@hey-api/shared").NameTransformer | {
|
|
2909
|
+
case?: import("@hey-api/shared").Casing;
|
|
2910
|
+
enabled?: boolean;
|
|
2911
|
+
name?: import("@hey-api/shared").NameTransformer;
|
|
2912
|
+
};
|
|
2913
|
+
name?: import("@hey-api/shared").NameTransformer;
|
|
2914
|
+
path?: boolean | import("@hey-api/shared").NameTransformer | {
|
|
2915
|
+
case?: import("@hey-api/shared").Casing;
|
|
2916
|
+
enabled?: boolean;
|
|
2917
|
+
name?: import("@hey-api/shared").NameTransformer;
|
|
2918
|
+
};
|
|
2919
|
+
query?: boolean | import("@hey-api/shared").NameTransformer | {
|
|
2920
|
+
case?: import("@hey-api/shared").Casing;
|
|
2921
|
+
enabled?: boolean;
|
|
2922
|
+
name?: import("@hey-api/shared").NameTransformer;
|
|
2923
|
+
};
|
|
2924
|
+
};
|
|
2925
|
+
responses?: boolean | import("@hey-api/shared").NameTransformer | {
|
|
2926
|
+
case?: import("@hey-api/shared").Casing;
|
|
2927
|
+
enabled?: boolean;
|
|
2928
|
+
name?: import("@hey-api/shared").NameTransformer;
|
|
2929
|
+
};
|
|
2930
|
+
strict?: boolean;
|
|
2931
|
+
webhooks?: boolean | import("@hey-api/shared").NameTransformer | {
|
|
2932
|
+
case?: import("@hey-api/shared").Casing;
|
|
2933
|
+
enabled?: boolean;
|
|
2934
|
+
name?: import("@hey-api/shared").NameTransformer;
|
|
2935
|
+
};
|
|
2936
|
+
} & {
|
|
2937
|
+
name: "pydantic";
|
|
2938
|
+
};
|
|
2939
|
+
//#endregion
|
|
2940
|
+
export { PydanticPlugin as a, HeyApiClientHttpxPlugin as c, sdk as i, plugins_d_exports as n, PydanticResolvers as o, pydantic as r, HeyApiSdkPlugin as s, clientHttpx as t };
|
|
2941
|
+
//# sourceMappingURL=plugins-BDUY2dP5.d.mts.map
|