@fern-api/csharp-dynamic-snippets 0.0.5 → 0.0.6
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/cjs/DynamicSnippetsGenerator.cjs +14 -14
- package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
- package/cjs/DynamicSnippetsGenerator.d.cts +5 -3
- package/cjs/{DynamicSnippetsGeneratorContext-DQDI25Nx.d.cts → DynamicSnippetsGeneratorContext-DhvOZIoP.d.cts} +127 -85
- package/cjs/EndpointSnippetGenerator.cjs +20 -20
- package/cjs/EndpointSnippetGenerator.cjs.map +1 -1
- package/cjs/EndpointSnippetGenerator.d.cts +10 -4
- package/cjs/context/DynamicLiteralMapper.cjs +2 -0
- package/cjs/context/DynamicLiteralMapper.cjs.map +1 -0
- package/cjs/context/DynamicLiteralMapper.d.cts +7 -0
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +20 -20
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -1
- package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +3 -2
- package/cjs/context/DynamicTypeMapper.cjs +1 -1
- package/cjs/context/DynamicTypeMapper.cjs.map +1 -1
- package/cjs/context/DynamicTypeMapper.d.cts +3 -2
- package/cjs/context/FilePropertyMapper.cjs +15 -15
- package/cjs/context/FilePropertyMapper.cjs.map +1 -1
- package/cjs/context/FilePropertyMapper.d.cts +3 -2
- package/cjs/index.cjs +14 -14
- package/cjs/index.cjs.map +1 -1
- package/cjs/index.d.cts +3 -2
- package/esm/DynamicSnippetsGenerator.d.ts +5 -3
- package/esm/DynamicSnippetsGenerator.js +1 -1
- package/esm/{DynamicSnippetsGeneratorContext-DQDI25Nx.d.ts → DynamicSnippetsGeneratorContext-DhvOZIoP.d.ts} +127 -85
- package/esm/EndpointSnippetGenerator.d.ts +10 -4
- package/esm/EndpointSnippetGenerator.js +1 -1
- package/esm/chunk-A53BGSGD.js +2 -0
- package/esm/chunk-A53BGSGD.js.map +1 -0
- package/esm/chunk-LWJEMG53.js +2 -0
- package/esm/chunk-LWJEMG53.js.map +1 -0
- package/esm/chunk-PRAGN765.js +2 -0
- package/esm/chunk-PRAGN765.js.map +1 -0
- package/esm/chunk-QALVTPA5.js +33 -0
- package/esm/chunk-QALVTPA5.js.map +1 -0
- package/esm/chunk-TOOGWICF.js +2 -0
- package/esm/chunk-TOOGWICF.js.map +1 -0
- package/esm/chunk-TVSKLWL4.js +2 -0
- package/esm/chunk-TVSKLWL4.js.map +1 -0
- package/esm/chunk-WP3GAWOR.js +2 -0
- package/esm/chunk-WP3GAWOR.js.map +1 -0
- package/esm/chunk-ZEEJAJ4K.js +15 -0
- package/esm/chunk-ZEEJAJ4K.js.map +1 -0
- package/esm/context/DynamicLiteralMapper.d.ts +7 -0
- package/esm/context/DynamicLiteralMapper.js +2 -0
- package/esm/context/DynamicSnippetsGeneratorContext.d.ts +3 -2
- package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
- package/esm/context/DynamicTypeMapper.d.ts +3 -2
- package/esm/context/DynamicTypeMapper.js +1 -1
- package/esm/context/FilePropertyMapper.d.ts +3 -2
- package/esm/context/FilePropertyMapper.js +1 -1
- package/esm/index.d.ts +3 -2
- package/esm/index.js +1 -1
- package/package.json +1 -1
- package/cjs/context/DynamicTypeLiteralMapper.cjs +0 -2
- package/cjs/context/DynamicTypeLiteralMapper.cjs.map +0 -1
- package/cjs/context/DynamicTypeLiteralMapper.d.cts +0 -6
- package/esm/chunk-4O5TI5LE.js +0 -15
- package/esm/chunk-4O5TI5LE.js.map +0 -1
- package/esm/chunk-7QB2DXDM.js +0 -33
- package/esm/chunk-7QB2DXDM.js.map +0 -1
- package/esm/chunk-CQ47NT5H.js +0 -2
- package/esm/chunk-CQ47NT5H.js.map +0 -1
- package/esm/chunk-GZ2J5EKE.js +0 -2
- package/esm/chunk-GZ2J5EKE.js.map +0 -1
- package/esm/chunk-JXQ2W4OZ.js +0 -2
- package/esm/chunk-JXQ2W4OZ.js.map +0 -1
- package/esm/chunk-PRGD7S35.js +0 -2
- package/esm/chunk-PRGD7S35.js.map +0 -1
- package/esm/chunk-U2GJA4AT.js +0 -2
- package/esm/chunk-U2GJA4AT.js.map +0 -1
- package/esm/chunk-WMO2ROQ4.js +0 -2
- package/esm/chunk-WMO2ROQ4.js.map +0 -1
- package/esm/context/DynamicTypeLiteralMapper.d.ts +0 -6
- package/esm/context/DynamicTypeLiteralMapper.js +0 -2
- /package/esm/context/{DynamicTypeLiteralMapper.js.map → DynamicLiteralMapper.js.map} +0 -0
package/cjs/index.d.cts
CHANGED
|
@@ -2,8 +2,9 @@ export { Config } from './Config.cjs';
|
|
|
2
2
|
export { DynamicSnippetsGenerator } from './DynamicSnippetsGenerator.cjs';
|
|
3
3
|
import '@fern-api/browser-compatible-base-generator';
|
|
4
4
|
import '@fern-api/dynamic-ir-sdk';
|
|
5
|
-
import './DynamicSnippetsGeneratorContext-
|
|
5
|
+
import './DynamicSnippetsGeneratorContext-DhvOZIoP.cjs';
|
|
6
|
+
import '@fern-api/csharp-codegen/lib/ast';
|
|
7
|
+
import '@fern-api/csharp-codegen/lib/ast/types/Type';
|
|
6
8
|
import '@fern-api/csharp-codegen/lib/context/model-navigator';
|
|
7
|
-
import '@fern-api/csharp-codegen/lib/context/extern';
|
|
8
9
|
import '@fern-api/csharp-codegen';
|
|
9
10
|
import './EndpointSnippetGenerator.cjs';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, Options } from '@fern-api/browser-compatible-base-generator';
|
|
1
|
+
import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, Options, AbstractAstNode } from '@fern-api/browser-compatible-base-generator';
|
|
2
2
|
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
|
-
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-
|
|
3
|
+
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-DhvOZIoP.js';
|
|
4
4
|
import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.js';
|
|
5
|
+
import '@fern-api/csharp-codegen/lib/ast';
|
|
6
|
+
import '@fern-api/csharp-codegen/lib/ast/types/Type';
|
|
5
7
|
import '@fern-api/csharp-codegen/lib/context/model-navigator';
|
|
6
|
-
import '@fern-api/csharp-codegen/lib/context/extern';
|
|
7
8
|
import '@fern-api/csharp-codegen';
|
|
8
9
|
|
|
9
10
|
declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, EndpointSnippetGenerator> {
|
|
@@ -15,6 +16,7 @@ declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<
|
|
|
15
16
|
precalculate(requests: FernIr.dynamic.EndpointSnippetRequest[]): void;
|
|
16
17
|
generate(request: FernIr.dynamic.EndpointSnippetRequest, options?: Options): Promise<FernIr.dynamic.EndpointSnippetResponse>;
|
|
17
18
|
generateSync(request: FernIr.dynamic.EndpointSnippetRequest, options?: Options): FernIr.dynamic.EndpointSnippetResponse;
|
|
19
|
+
generateSnippetAst(request: FernIr.dynamic.EndpointSnippetRequest): Promise<AbstractAstNode>;
|
|
18
20
|
protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator;
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-A53BGSGD.js";import"./chunk-ZEEJAJ4K.js";import"./chunk-TOOGWICF.js";import"./chunk-LWJEMG53.js";import"./chunk-PRAGN765.js";import"./chunk-TVSKLWL4.js";import"./chunk-WP3GAWOR.js";import"./chunk-QALVTPA5.js";export{a as DynamicSnippetsGenerator};
|
|
2
2
|
//# sourceMappingURL=DynamicSnippetsGenerator.js.map
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import * as _fern_api_csharp_codegen_lib_ast from '@fern-api/csharp-codegen/lib/ast';
|
|
2
|
+
import * as _fern_api_csharp_codegen_lib_ast_types_Type from '@fern-api/csharp-codegen/lib/ast/types/Type';
|
|
1
3
|
import * as _fern_api_csharp_codegen_lib_context_model_navigator from '@fern-api/csharp-codegen/lib/context/model-navigator';
|
|
2
|
-
import * as _fern_api_csharp_codegen_lib_context_extern from '@fern-api/csharp-codegen/lib/context/extern';
|
|
3
4
|
import * as _fern_api_csharp_codegen from '@fern-api/csharp-codegen';
|
|
4
5
|
import { WithGeneration, ast, Generation } from '@fern-api/csharp-codegen';
|
|
5
6
|
import { AbstractDynamicSnippetsGeneratorContext, FernGeneratorExec, Options } from '@fern-api/browser-compatible-base-generator';
|
|
6
7
|
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
7
8
|
|
|
8
|
-
declare namespace
|
|
9
|
+
declare namespace DynamicLiteralMapper {
|
|
9
10
|
interface Args {
|
|
10
11
|
typeReference: FernIr.dynamic.TypeReference;
|
|
11
12
|
value: unknown;
|
|
@@ -14,12 +15,12 @@ declare namespace DynamicTypeLiteralMapper {
|
|
|
14
15
|
}
|
|
15
16
|
type ConvertedAs = "key";
|
|
16
17
|
}
|
|
17
|
-
declare class
|
|
18
|
+
declare class DynamicLiteralMapper extends WithGeneration {
|
|
18
19
|
private context;
|
|
19
20
|
constructor({ context }: {
|
|
20
21
|
context: DynamicSnippetsGeneratorContext;
|
|
21
22
|
});
|
|
22
|
-
convert(args:
|
|
23
|
+
convert(args: DynamicLiteralMapper.Args): ast.Literal;
|
|
23
24
|
private convertList;
|
|
24
25
|
private convertLiteral;
|
|
25
26
|
private convertSet;
|
|
@@ -78,7 +79,7 @@ declare class FilePropertyMapper extends WithGeneration {
|
|
|
78
79
|
declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGeneratorContext {
|
|
79
80
|
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
80
81
|
dynamicTypeMapper: DynamicTypeMapper;
|
|
81
|
-
|
|
82
|
+
dynamicLiteralMapper: DynamicLiteralMapper;
|
|
82
83
|
filePropertyMapper: FilePropertyMapper;
|
|
83
84
|
readonly generation: Generation;
|
|
84
85
|
get namespaces(): {
|
|
@@ -95,7 +96,6 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
|
|
|
95
96
|
implicit: Set<string>;
|
|
96
97
|
};
|
|
97
98
|
get registry(): _fern_api_csharp_codegen.NameRegistry;
|
|
98
|
-
get extern(): _fern_api_csharp_codegen_lib_context_extern.Extern;
|
|
99
99
|
get settings(): {
|
|
100
100
|
namespace: string;
|
|
101
101
|
readOnlyMemoryTypes: string[];
|
|
@@ -192,7 +192,14 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
|
|
|
192
192
|
idempotentOptions: string;
|
|
193
193
|
};
|
|
194
194
|
};
|
|
195
|
-
get
|
|
195
|
+
get model(): _fern_api_csharp_codegen_lib_context_model_navigator.ModelNavigator;
|
|
196
|
+
get format(): {
|
|
197
|
+
private: (name: string) => string;
|
|
198
|
+
};
|
|
199
|
+
get csharp(): _fern_api_csharp_codegen.CSharp;
|
|
200
|
+
get Types(): {
|
|
201
|
+
Arbitrary: (name: string) => _fern_api_csharp_codegen_lib_ast_types_Type.Primitive.AribitraryType;
|
|
202
|
+
HttpMethodExtensions: ast.ClassReference;
|
|
196
203
|
FormRequest: ast.ClassReference;
|
|
197
204
|
ClientOptions: ast.ClassReference;
|
|
198
205
|
RawClient: ast.ClassReference;
|
|
@@ -238,140 +245,175 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
|
|
|
238
245
|
CustomPagerClass: (itemType: ast.Type | ast.ClassReference) => ast.ClassReference;
|
|
239
246
|
Pager: (itemType: ast.Type | ast.ClassReference) => ast.ClassReference;
|
|
240
247
|
OffsetPager: ({ requestType, requestOptionsType, responseType, offsetType, stepType, itemType }: {
|
|
241
|
-
requestType: ast.Type
|
|
242
|
-
requestOptionsType: ast.Type
|
|
243
|
-
responseType: ast.Type
|
|
244
|
-
offsetType: ast.Type
|
|
245
|
-
stepType: ast.Type
|
|
246
|
-
itemType: ast.Type
|
|
248
|
+
requestType: ast.Type;
|
|
249
|
+
requestOptionsType: ast.Type;
|
|
250
|
+
responseType: ast.Type;
|
|
251
|
+
offsetType: ast.Type;
|
|
252
|
+
stepType: ast.Type;
|
|
253
|
+
itemType: ast.Type;
|
|
247
254
|
}) => ast.ClassReference;
|
|
248
255
|
CursorPager: ({ requestType, requestOptionsType, responseType, cursorType, itemType }: {
|
|
249
|
-
requestType: ast.Type
|
|
250
|
-
requestOptionsType: ast.Type
|
|
251
|
-
responseType: ast.Type
|
|
252
|
-
cursorType: ast.Type
|
|
253
|
-
itemType: ast.Type
|
|
256
|
+
requestType: ast.Type;
|
|
257
|
+
requestOptionsType: ast.Type;
|
|
258
|
+
responseType: ast.Type;
|
|
259
|
+
cursorType: ast.Type;
|
|
260
|
+
itemType: ast.Type;
|
|
254
261
|
}) => ast.ClassReference;
|
|
255
262
|
CollectionItemSerializer: (itemType: ast.ClassReference, serializer: ast.ClassReference) => ast.ClassReference;
|
|
256
263
|
OneOfSerializer: (oneof: ast.Type | ast.ClassReference) => ast.ClassReference;
|
|
257
264
|
AdditionalProperties: (genericType?: ast.Type | ast.ClassReference) => ast.ClassReference;
|
|
258
265
|
ReadOnlyAdditionalProperties: (genericType?: ast.Type | ast.ClassReference) => ast.ClassReference;
|
|
259
266
|
};
|
|
260
|
-
get model(): _fern_api_csharp_codegen_lib_context_model_navigator.ModelNavigator;
|
|
261
|
-
get csharp(): _fern_api_csharp_codegen.CSharp;
|
|
262
267
|
get System(): {
|
|
263
|
-
Action: (typeParameters?:
|
|
264
|
-
Func: (typeParameters?:
|
|
265
|
-
DateOnly:
|
|
266
|
-
DateTime:
|
|
267
|
-
Enum:
|
|
268
|
-
Exception:
|
|
269
|
-
ReadOnlyMemory: (type: ast.Type
|
|
270
|
-
Serializable:
|
|
271
|
-
String:
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
268
|
+
Action: (typeParameters?: ast.Type[]) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
269
|
+
Func: (typeParameters?: ast.Type[], returnType?: ast.Type) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
270
|
+
DateOnly: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
271
|
+
DateTime: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
272
|
+
Enum: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
273
|
+
Exception: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
274
|
+
ReadOnlyMemory: (type: ast.Type) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
275
|
+
Serializable: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
276
|
+
String: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
277
|
+
Type: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
278
|
+
TimeSpan: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
279
|
+
Uri: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
280
|
+
UriBuilder: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
275
281
|
Runtime: {
|
|
276
282
|
Serialization: {
|
|
277
|
-
EnumMember:
|
|
283
|
+
EnumMember: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
278
284
|
};
|
|
279
285
|
};
|
|
280
286
|
Collections: {
|
|
281
287
|
Generic: {
|
|
282
|
-
IAsyncEnumerable: (elementType?: ast.
|
|
283
|
-
IEnumerable: (elementType?: ast.
|
|
284
|
-
KeyValuePair: (keyType?: ast.
|
|
285
|
-
List: (elementType?: ast.
|
|
286
|
-
HashSet: (elementType?: ast.
|
|
287
|
-
Dictionary: (keyType?: ast.
|
|
288
|
-
IDictionary: (keyType: ast.Type
|
|
288
|
+
IAsyncEnumerable: (elementType?: ast.Type) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
289
|
+
IEnumerable: (elementType?: ast.Type) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
290
|
+
KeyValuePair: (keyType?: ast.Type, valueType?: ast.Type) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
291
|
+
List: (elementType?: ast.Type) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
292
|
+
HashSet: (elementType?: ast.Type) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
293
|
+
Dictionary: (keyType?: ast.Type, valueType?: ast.Type) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
294
|
+
IDictionary: (keyType: ast.Type, valueType: ast.Type) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
289
295
|
};
|
|
290
296
|
Linq: {
|
|
291
|
-
Enumerable:
|
|
297
|
+
Enumerable: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
292
298
|
};
|
|
293
299
|
};
|
|
294
300
|
Globalization: {
|
|
295
|
-
DateTimeStyles:
|
|
301
|
+
DateTimeStyles: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
296
302
|
};
|
|
297
303
|
Linq: {
|
|
298
|
-
Enumerable:
|
|
304
|
+
Enumerable: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
299
305
|
};
|
|
300
306
|
Net: {
|
|
301
307
|
Http: {
|
|
302
|
-
HttpClient:
|
|
303
|
-
HttpMethod:
|
|
304
|
-
HttpResponseHeaders:
|
|
308
|
+
HttpClient: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
309
|
+
HttpMethod: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
310
|
+
HttpResponseHeaders: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
305
311
|
};
|
|
306
312
|
ServerSentEvents: {
|
|
307
|
-
SseEvent:
|
|
308
|
-
SseParser:
|
|
313
|
+
SseEvent: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
314
|
+
SseParser: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
309
315
|
};
|
|
310
316
|
WebSockets: {
|
|
311
|
-
ClientWebSocketOptions:
|
|
317
|
+
ClientWebSocketOptions: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
312
318
|
};
|
|
313
319
|
};
|
|
314
320
|
IO: {
|
|
315
|
-
MemoryStream:
|
|
316
|
-
Stream:
|
|
317
|
-
StreamReader:
|
|
321
|
+
MemoryStream: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
322
|
+
Stream: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
323
|
+
StreamReader: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
318
324
|
};
|
|
319
325
|
Text: {
|
|
320
|
-
Encoding:
|
|
321
|
-
Encoding_UTF8:
|
|
326
|
+
Encoding: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
327
|
+
Encoding_UTF8: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
322
328
|
Json: {
|
|
323
|
-
JsonElement:
|
|
324
|
-
JsonDocument:
|
|
325
|
-
JsonException:
|
|
326
|
-
Utf8JsonReader:
|
|
327
|
-
JsonSerializerOptions:
|
|
328
|
-
JsonSerializer:
|
|
329
|
-
Utf8JsonWriter:
|
|
329
|
+
JsonElement: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
330
|
+
JsonDocument: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
331
|
+
JsonException: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
332
|
+
Utf8JsonReader: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
333
|
+
JsonSerializerOptions: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
334
|
+
JsonSerializer: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
335
|
+
Utf8JsonWriter: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
330
336
|
Nodes: {
|
|
331
|
-
JsonNode:
|
|
332
|
-
JsonObject:
|
|
337
|
+
JsonNode: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
338
|
+
JsonObject: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
333
339
|
};
|
|
334
340
|
Serialization: {
|
|
335
|
-
IJsonOnDeserialized:
|
|
336
|
-
IJsonOnSerializing:
|
|
337
|
-
JsonOnDeserializedAttribute:
|
|
338
|
-
JsonExtensionData:
|
|
339
|
-
JsonConverter: (typeToConvert?: ast.
|
|
340
|
-
JsonIgnore:
|
|
341
|
-
JsonPropertyName:
|
|
341
|
+
IJsonOnDeserialized: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
342
|
+
IJsonOnSerializing: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
343
|
+
JsonOnDeserializedAttribute: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
344
|
+
JsonExtensionData: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
345
|
+
JsonConverter: (typeToConvert?: ast.Type) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
346
|
+
JsonIgnore: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
347
|
+
JsonPropertyName: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
342
348
|
};
|
|
343
349
|
};
|
|
344
350
|
};
|
|
345
351
|
Threading: {
|
|
346
|
-
CancellationToken:
|
|
352
|
+
CancellationToken: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
347
353
|
Tasks: {
|
|
348
|
-
Task: (ofType?: ast.
|
|
354
|
+
Task: (ofType?: ast.Type) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
349
355
|
};
|
|
350
356
|
};
|
|
351
357
|
};
|
|
352
358
|
get NUnit(): {
|
|
353
359
|
Framework: {
|
|
354
|
-
TestFixture:
|
|
355
|
-
Test:
|
|
356
|
-
OneTimeTearDown:
|
|
357
|
-
OneTimeSetUp:
|
|
358
|
-
SetUpFixture:
|
|
360
|
+
TestFixture: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
361
|
+
Test: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
362
|
+
OneTimeTearDown: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
363
|
+
OneTimeSetUp: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
364
|
+
SetUpFixture: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
359
365
|
};
|
|
360
366
|
};
|
|
361
367
|
get OneOf(): {
|
|
362
|
-
OneOf: (generics?: ast.
|
|
363
|
-
OneOfBase: (generics?: ast.
|
|
368
|
+
OneOf: (generics?: ast.Type[]) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
369
|
+
OneOfBase: (generics?: ast.Type[]) => _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
364
370
|
};
|
|
365
371
|
get Google(): {
|
|
366
372
|
Protobuf: {
|
|
367
373
|
WellKnownTypes: {
|
|
368
|
-
Struct:
|
|
369
|
-
Value:
|
|
370
|
-
ListValue:
|
|
371
|
-
Timestamp:
|
|
374
|
+
Struct: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
375
|
+
Value: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
376
|
+
ListValue: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
377
|
+
Timestamp: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
372
378
|
};
|
|
373
379
|
};
|
|
374
380
|
};
|
|
381
|
+
get WireMock(): {
|
|
382
|
+
Server: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
383
|
+
WireMockServerSettings: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
384
|
+
WireMockConsoleLogger: _fern_api_csharp_codegen_lib_ast.ClassReference;
|
|
385
|
+
};
|
|
386
|
+
get Primitive(): {
|
|
387
|
+
string: _fern_api_csharp_codegen_lib_ast_types_Type.Primitive.String;
|
|
388
|
+
boolean: _fern_api_csharp_codegen_lib_ast_types_Type.Primitive.Boolean;
|
|
389
|
+
integer: _fern_api_csharp_codegen_lib_ast_types_Type.Primitive.Integer;
|
|
390
|
+
long: _fern_api_csharp_codegen_lib_ast_types_Type.Primitive.Long;
|
|
391
|
+
uint: _fern_api_csharp_codegen_lib_ast_types_Type.Primitive.Uint;
|
|
392
|
+
ulong: _fern_api_csharp_codegen_lib_ast_types_Type.Primitive.ULong;
|
|
393
|
+
float: _fern_api_csharp_codegen_lib_ast_types_Type.Primitive.Float;
|
|
394
|
+
double: _fern_api_csharp_codegen_lib_ast_types_Type.Primitive.Double;
|
|
395
|
+
object: _fern_api_csharp_codegen_lib_ast_types_Type.Primitive.Object;
|
|
396
|
+
};
|
|
397
|
+
get Value(): {
|
|
398
|
+
binary: _fern_api_csharp_codegen_lib_ast_types_Type.Value.Binary;
|
|
399
|
+
dateOnly: _fern_api_csharp_codegen_lib_ast_types_Type.Value.DateOnly;
|
|
400
|
+
dateTime: _fern_api_csharp_codegen_lib_ast_types_Type.Value.DateTime;
|
|
401
|
+
uuid: _fern_api_csharp_codegen_lib_ast_types_Type.Value.Uuid;
|
|
402
|
+
stringEnum: (value: ast.ClassReference) => _fern_api_csharp_codegen_lib_ast_types_Type.Value.StringEnum;
|
|
403
|
+
};
|
|
404
|
+
get Collection(): {
|
|
405
|
+
array: (value: ast.Type) => _fern_api_csharp_codegen_lib_ast_types_Type.Collection.Array;
|
|
406
|
+
listType: (value: ast.Type) => _fern_api_csharp_codegen_lib_ast_types_Type.Collection.ListType;
|
|
407
|
+
list: (value: ast.Type) => _fern_api_csharp_codegen_lib_ast_types_Type.Collection.List;
|
|
408
|
+
set: (value: ast.Type) => _fern_api_csharp_codegen_lib_ast_types_Type.Collection.Set;
|
|
409
|
+
map: (keyType: ast.Type, valueType: ast.Type, options?: {
|
|
410
|
+
dontSimplify?: boolean;
|
|
411
|
+
}) => _fern_api_csharp_codegen_lib_ast_types_Type.Collection.Map;
|
|
412
|
+
idictionary: (keyType: ast.Type, valueType: ast.Type, options?: {
|
|
413
|
+
dontSimplify?: boolean;
|
|
414
|
+
}) => _fern_api_csharp_codegen_lib_ast_types_Type.Collection.IDictionary;
|
|
415
|
+
keyValuePair: (keyType: ast.Type, valueType: ast.Type) => _fern_api_csharp_codegen_lib_ast_types_Type.Collection.KeyValuePair;
|
|
416
|
+
};
|
|
375
417
|
constructor({ ir, config, options, generation }: {
|
|
376
418
|
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
377
419
|
config: FernGeneratorExec.GeneratorConfig;
|
|
@@ -379,7 +421,7 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
|
|
|
379
421
|
generation?: Generation;
|
|
380
422
|
});
|
|
381
423
|
clone(): DynamicSnippetsGeneratorContext;
|
|
382
|
-
getFileParameterForString(str: string): ast.
|
|
424
|
+
getFileParameterForString(str: string): ast.Literal;
|
|
383
425
|
getMemoryStreamForString(str: string): ast.ClassInstantiation;
|
|
384
426
|
getClassName(name: FernIr.Name): string;
|
|
385
427
|
getParameterName(name: FernIr.Name): string;
|
|
@@ -392,4 +434,4 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
|
|
|
392
434
|
precalculate(requests: Partial<FernIr.dynamic.EndpointSnippetRequest>[]): void;
|
|
393
435
|
}
|
|
394
436
|
|
|
395
|
-
export { DynamicSnippetsGeneratorContext as D, type FilePropertyInfo as F,
|
|
437
|
+
export { DynamicSnippetsGeneratorContext as D, type FilePropertyInfo as F, DynamicLiteralMapper as a, DynamicTypeMapper as b, FilePropertyMapper as c };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Options } from '@fern-api/browser-compatible-base-generator';
|
|
2
|
-
import { WithGeneration } from '@fern-api/csharp-codegen';
|
|
2
|
+
import { WithGeneration, ast } from '@fern-api/csharp-codegen';
|
|
3
3
|
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
4
|
-
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-
|
|
4
|
+
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-DhvOZIoP.js';
|
|
5
|
+
import '@fern-api/csharp-codegen/lib/ast';
|
|
6
|
+
import '@fern-api/csharp-codegen/lib/ast/types/Type';
|
|
5
7
|
import '@fern-api/csharp-codegen/lib/context/model-navigator';
|
|
6
|
-
import '@fern-api/csharp-codegen/lib/context/extern';
|
|
7
8
|
|
|
8
9
|
declare class EndpointSnippetGenerator extends WithGeneration {
|
|
9
10
|
private context;
|
|
@@ -20,6 +21,11 @@ declare class EndpointSnippetGenerator extends WithGeneration {
|
|
|
20
21
|
request: FernIr.dynamic.EndpointSnippetRequest;
|
|
21
22
|
options: Options;
|
|
22
23
|
}): string;
|
|
24
|
+
generateSnippetAst({ endpoint, request, options }: {
|
|
25
|
+
endpoint: FernIr.dynamic.Endpoint;
|
|
26
|
+
request: FernIr.dynamic.EndpointSnippetRequest;
|
|
27
|
+
options?: Options;
|
|
28
|
+
}): Promise<ast.AstNode>;
|
|
23
29
|
private buildCodeBlock;
|
|
24
30
|
private buildFullCodeBlock;
|
|
25
31
|
private constructClient;
|
|
@@ -44,7 +50,7 @@ declare class EndpointSnippetGenerator extends WithGeneration {
|
|
|
44
50
|
private getInlinedRequestBodyPropertyConstructorFields;
|
|
45
51
|
private getFileUploadRequestBodyConstructorFields;
|
|
46
52
|
private getReferencedRequestBodyPropertyConstructorField;
|
|
47
|
-
private
|
|
53
|
+
private getReferencedRequestBodyPropertyLiteral;
|
|
48
54
|
private getMethodArgsForBodyRequest;
|
|
49
55
|
private getBodyRequestArg;
|
|
50
56
|
private getBytesBodyRequestArg;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-ZEEJAJ4K.js";import"./chunk-PRAGN765.js";import"./chunk-QALVTPA5.js";export{a as EndpointSnippetGenerator};
|
|
2
2
|
//# sourceMappingURL=EndpointSnippetGenerator.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as p}from"./chunk-ZEEJAJ4K.js";import{a as r}from"./chunk-TOOGWICF.js";import{a as t}from"./chunk-PRAGN765.js";var i=class extends t{constructor({ir:e,config:n,options:o={}}){super(new r({ir:e,config:n,options:o}))}precalculate(e){this.context.precalculate(e)}async generate(e,n={}){return super.generate(e,n)}generateSync(e,n={}){return super.generateSync(e,n)}async generateSnippetAst(e){return super.generateSnippetAst(e)}createSnippetGenerator(e){return new p({context:e})}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-A53BGSGD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/DynamicSnippetsGenerator.ts"],"sourcesContent":["import {\n AbstractAstNode,\n AbstractDynamicSnippetsGenerator,\n FernGeneratorExec,\n Options\n} from \"@fern-api/browser-compatible-base-generator\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { DynamicSnippetsGeneratorContext } from \"./context/DynamicSnippetsGeneratorContext\";\nimport { EndpointSnippetGenerator } from \"./EndpointSnippetGenerator\";\n\nexport class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<\n DynamicSnippetsGeneratorContext,\n EndpointSnippetGenerator\n> {\n constructor({\n ir,\n config,\n options = {}\n }: {\n ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n config: FernGeneratorExec.GeneratorConfig;\n options?: Options;\n }) {\n super(new DynamicSnippetsGeneratorContext({ ir, config, options }));\n }\n\n public precalculate(requests: FernIr.dynamic.EndpointSnippetRequest[]): void {\n this.context.precalculate(requests);\n }\n\n public override async generate(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): Promise<FernIr.dynamic.EndpointSnippetResponse> {\n return super.generate(request, options);\n }\n\n public override generateSync(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): FernIr.dynamic.EndpointSnippetResponse {\n return super.generateSync(request, options);\n }\n\n public override async generateSnippetAst(request: FernIr.dynamic.EndpointSnippetRequest): Promise<AbstractAstNode> {\n return super.generateSnippetAst(request);\n }\n\n protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator {\n return new EndpointSnippetGenerator({ context });\n }\n}\n"],"mappings":"wHAUO,IAAMA,EAAN,cAAuCC,CAG5C,CACE,YAAY,CACR,GAAAC,EACA,OAAAC,EACA,QAAAC,EAAU,CAAC,CACf,EAIG,CACC,MAAM,IAAIC,EAAgC,CAAE,GAAAH,EAAI,OAAAC,EAAQ,QAAAC,CAAQ,CAAC,CAAC,CACtE,CAEO,aAAaE,EAAyD,CACzE,KAAK,QAAQ,aAAaA,CAAQ,CACtC,CAEA,MAAsB,SAClBC,EACAH,EAAmB,CAAC,EAC2B,CAC/C,OAAO,MAAM,SAASG,EAASH,CAAO,CAC1C,CAEgB,aACZG,EACAH,EAAmB,CAAC,EACkB,CACtC,OAAO,MAAM,aAAaG,EAASH,CAAO,CAC9C,CAEA,MAAsB,mBAAmBG,EAA0E,CAC/G,OAAO,MAAM,mBAAmBA,CAAO,CAC3C,CAEU,uBAAuBC,EAAoE,CACjG,OAAO,IAAIC,EAAyB,CAAE,QAAAD,CAAQ,CAAC,CACnD,CACJ","names":["DynamicSnippetsGenerator","AbstractDynamicSnippetsGenerator","ir","config","options","DynamicSnippetsGeneratorContext","requests","request","context","EndpointSnippetGenerator"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as a}from"./chunk-PRAGN765.js";import{e as u,f as c,k as p}from"./chunk-QALVTPA5.js";var h=class extends p{constructor({context:e}){super(e.generation);u(this,"context");this.context=e}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.csharp.Literal.null():(this.context.errors.add({severity:a.Critical,message:"Expected non-null value, but got null"}),this.csharp.Literal.nop());if(e.value===void 0&&!e.fallbackToDefault)return this.csharp.Literal.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,fallbackToDefault:e.fallbackToDefault});case"literal":return this.convertLiteral({literal:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value,fallbackToDefault:e.fallbackToDefault});case"named":{let r=this.context.resolveNamedType({typeId:e.typeReference.value});return r==null?this.csharp.Literal.nop():this.convertNamed({named:r,value:e.value,as:e.as,fallbackToDefault:e.fallbackToDefault})}case"nullable":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as,fallbackToDefault:e.fallbackToDefault});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,fallbackToDefault:e.fallbackToDefault});case"unknown":return this.convertUnknown({value:e.value,fallbackToDefault:e.fallbackToDefault});default:c(e.typeReference)}}convertList({list:e,value:r,fallbackToDefault:i}){return Array.isArray(r)?this.csharp.Literal.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e,unboxOptionals:!0}),values:r.map((t,n)=>{this.context.errors.scope({index:n});try{return this.convert({typeReference:e,value:t})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:a.Critical,message:`Expected array but got: ${typeof r}`}),this.csharp.Literal.nop())}convertLiteral({literal:e,value:r,fallbackToDefault:i}){switch(e.type){case"boolean":{let t=this.context.getValueAsBoolean({value:r});return t==null?this.csharp.Literal.nop():this.csharp.Literal.boolean(t)}case"string":{let t=this.context.getValueAsString({value:r});return t==null?i?this.Primitive.string.getDeterminsticDefault(i):this.csharp.Literal.nop():this.csharp.Literal.string(t)}default:c(e)}}convertSet({set:e,value:r,fallbackToDefault:i}){return Array.isArray(r)?this.csharp.Literal.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e,unboxOptionals:!0}),values:r.map((t,n)=>{this.context.errors.scope({index:n});try{return this.convert({typeReference:e,value:t})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:a.Critical,message:`Expected array but got: ${typeof r}`}),this.csharp.Literal.nop())}convertMap({map:e,value:r,fallbackToDefault:i}){return typeof r!="object"||r==null?(this.context.errors.add({severity:a.Critical,message:`Expected object but got: ${r==null?"null":typeof r}`}),this.csharp.Literal.nop()):this.csharp.Literal.dictionary({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:e.value.type==="unknown"?this.context.dynamicTypeMapper.convert({typeReference:e.value}).asOptional():this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(r).map(([t,n])=>{this.context.errors.scope(t);try{return{key:this.convert({typeReference:e.key,value:t,as:"key"}),value:this.convert({typeReference:e.value,value:n})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:r,as:i,fallbackToDefault:t}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:r,as:i,fallbackToDefault:t});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertDiscriminatedUnion({discriminatedUnion:e,value:r,fallbackToDefault:t}):this.convertUnknown({value:r,fallbackToDefault:t});case"enum":return this.getEnumValue(e,r);case"object":return this.convertObject({object_:e,value:r,fallbackToDefault:t});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:r,fallbackToDefault:t});default:c(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:r,fallbackToDefault:i}){let t=this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}),n=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r});if(n==null)return this.csharp.Literal.nop();let s=n.singleDiscriminatedUnionType,o=this.getBaseProperties({discriminatedUnionTypeInstance:n,singleDiscriminatedUnionType:s});switch(s.type){case"samePropertiesAsObject":{let l=this.context.resolveNamedType({typeId:s.typeId});return l==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:t,baseProperties:o,arguments_:[this.convertNamed({named:l,value:n.value})]})}case"singleProperty":{if(this.context.getRecord(n.value)==null)return this.csharp.Literal.nop();try{let m=["Value","Type"].includes(s.discriminantValue.name.pascalCase.safeName)?`${s.discriminantValue.name.pascalCase.safeName}Inner`:s.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(s.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:t,baseProperties:o,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:m,enclosingType:t}),arguments_:[this.convert({typeReference:s.typeReference,value:s.discriminantValue.wireValue})]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:t,baseProperties:o,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:n.discriminantValue,enclosingType:t}),arguments_:[]})]});default:c(s)}}getBaseProperties({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:r}){var t,n;return this.context.associateByWireValue({parameters:(t=r.properties)!=null?t:[],values:(n=this.context.getRecord(e.value))!=null?n:{},ignoreMissingParameters:!0}).map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getPropertyName(s.name.name),assignment:this.convert(s)}}finally{this.context.errors.unscope()}})}instantiateUnionWithBaseProperties({classReference:e,arguments_:r,baseProperties:i}){let t=this.csharp.instantiateClass({classReference:e,arguments_:r,multiline:!0});return i.length===0?this.csharp.Literal.reference(t):this.csharp.Literal.reference(this.csharp.codeblock(n=>{n.write(t," "),n.pushScope();for(let s of i)n.write(s.name," = ",s.assignment,",");n.popScope(!1)}))}getEnumValue(e,r){if(typeof r!="string")return this.context.errors.add({severity:a.Critical,message:`Expected enum value string, got: ${typeof r}`}),this.csharp.Literal.nop();let i=e.values.find(s=>s.wireValue===r);if(i==null)return this.context.errors.add({severity:a.Critical,message:`An enum value named "${r}" does not exist in this context`}),this.csharp.Literal.nop();let t=this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}),n=t.registerField(this.model.getPropertyNameFor(i),i);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:t,value:n}))}convertObject({object_:e,value:r,fallbackToDefault:i}){var n;let t=this.context.associateByWireValue({parameters:e.properties,values:(n=this.context.getRecord(r))!=null?n:{}});return this.csharp.Literal.class_({reference:this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}),fields:t.map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getClassName(s.name.name),value:this.convert(s)}}finally{this.context.errors.unscope()}})})}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:r,fallbackToDefault:i}){let t=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:r});return t==null?this.csharp.Literal.nop():t.typeLiteral}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:r}){for(let i of e.types)try{let t=this.convert({typeReference:i,value:r});return{valueTypeReference:i,typeLiteral:t}}catch(t){continue}this.context.errors.add({severity:a.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof r}" value`})}convertUnknown({value:e,fallbackToDefault:r}){return this.csharp.Literal.unknown(e)}convertPrimitive({primitive:e,value:r,as:i,fallbackToDefault:t}){switch(e){case"INTEGER":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.integer.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.integer(n)}case"LONG":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.long.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.long(n)}case"UINT":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.uint.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.uint(n)}case"UINT_64":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.ulong.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.ulong(n)}case"FLOAT":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.float.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.float(n)}case"DOUBLE":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.double.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.double(n)}case"BOOLEAN":{let n=this.getValueAsBoolean({value:r,as:i});return n==null?t?this.Primitive.boolean.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.boolean(n)}case"STRING":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Primitive.string.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.string(n)}case"DATE":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Value.dateOnly.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.date(n)}case"DATE_TIME":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Value.dateTime.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.datetime(n)}case"UUID":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Primitive.string.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.string(n)}case"BASE_64":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Primitive.string.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.string(n)}case"BIG_INTEGER":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Primitive.string.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.string(n)}default:c(e)}}getValueAsNumber({value:e,as:r}){let i=r==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:i})}getValueAsBoolean({value:e,as:r}){let i=r==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:i})}};export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-LWJEMG53.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/context/DynamicLiteralMapper.ts"],"sourcesContent":["import { DiscriminatedUnionTypeInstance, NamedArgument, Severity } from \"@fern-api/browser-compatible-base-generator\";\nimport { assertNever } from \"@fern-api/core-utils\";\nimport { ast, WithGeneration } from \"@fern-api/csharp-codegen\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { DynamicSnippetsGeneratorContext } from \"./DynamicSnippetsGeneratorContext\";\n\nexport declare namespace DynamicLiteralMapper {\n interface Args {\n typeReference: FernIr.dynamic.TypeReference;\n value: unknown;\n as?: ConvertedAs;\n fallbackToDefault?: string;\n }\n\n // Identifies what the type is being converted as, which sometimes influences how\n // the type is instantiated.\n type ConvertedAs = \"key\";\n}\n\nexport class DynamicLiteralMapper extends WithGeneration {\n private context: DynamicSnippetsGeneratorContext;\n\n constructor({ context }: { context: DynamicSnippetsGeneratorContext }) {\n super(context.generation);\n this.context = context;\n }\n\n public convert(args: DynamicLiteralMapper.Args): ast.Literal {\n // eslint-disable-next-line eqeqeq\n if (args.value === null) {\n if (this.context.isNullable(args.typeReference)) {\n return this.csharp.Literal.null();\n }\n this.context.errors.add({\n severity: Severity.Critical,\n message: \"Expected non-null value, but got null\"\n });\n return this.csharp.Literal.nop();\n }\n if (args.value === undefined && !args.fallbackToDefault) {\n return this.csharp.Literal.nop();\n }\n switch (args.typeReference.type) {\n case \"list\":\n return this.convertList({\n list: args.typeReference.value,\n value: args.value,\n fallbackToDefault: args.fallbackToDefault\n });\n case \"literal\":\n return this.convertLiteral({\n literal: args.typeReference.value,\n value: args.value\n });\n case \"map\":\n return this.convertMap({\n map: args.typeReference,\n value: args.value,\n fallbackToDefault: args.fallbackToDefault\n });\n case \"named\": {\n const named = this.context.resolveNamedType({ typeId: args.typeReference.value });\n if (named == null) {\n return this.csharp.Literal.nop();\n }\n return this.convertNamed({\n named,\n value: args.value,\n as: args.as,\n fallbackToDefault: args.fallbackToDefault\n });\n }\n case \"nullable\":\n return this.convert({\n typeReference: args.typeReference.value,\n value: args.value,\n as: args.as\n });\n case \"optional\":\n return this.convert({\n typeReference: args.typeReference.value,\n value: args.value,\n as: args.as\n });\n case \"primitive\":\n return this.convertPrimitive({\n primitive: args.typeReference.value,\n value: args.value,\n as: args.as,\n fallbackToDefault: args.fallbackToDefault\n });\n case \"set\":\n return this.convertSet({\n set: args.typeReference.value,\n value: args.value,\n fallbackToDefault: args.fallbackToDefault\n });\n case \"unknown\":\n return this.convertUnknown({ value: args.value, fallbackToDefault: args.fallbackToDefault });\n default:\n assertNever(args.typeReference);\n }\n }\n\n private convertList({\n list,\n value,\n fallbackToDefault\n }: {\n list: FernIr.dynamic.TypeReference;\n value: unknown;\n fallbackToDefault?: string;\n }): ast.Literal {\n if (!Array.isArray(value)) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected array but got: ${typeof value}`\n });\n return this.csharp.Literal.nop();\n }\n return this.csharp.Literal.list({\n valueType: this.context.dynamicTypeMapper.convert({ typeReference: list, unboxOptionals: true }),\n values: value.map((v, index) => {\n this.context.errors.scope({ index });\n try {\n return this.convert({ typeReference: list, value: v });\n } finally {\n this.context.errors.unscope();\n }\n })\n });\n }\n\n private convertLiteral({\n literal,\n value,\n fallbackToDefault\n }: {\n literal: FernIr.dynamic.LiteralType;\n value: unknown;\n fallbackToDefault?: string;\n }): ast.Literal {\n switch (literal.type) {\n case \"boolean\": {\n const bool = this.context.getValueAsBoolean({ value });\n if (bool == null) {\n return this.csharp.Literal.nop();\n }\n return this.csharp.Literal.boolean(bool);\n }\n case \"string\": {\n const str = this.context.getValueAsString({ value });\n if (str == null) {\n return fallbackToDefault\n ? this.Primitive.string.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.string(str);\n }\n default:\n assertNever(literal);\n }\n }\n\n private convertSet({\n set,\n value,\n fallbackToDefault\n }: {\n set: FernIr.dynamic.TypeReference;\n value: unknown;\n fallbackToDefault?: string;\n }): ast.Literal {\n if (!Array.isArray(value)) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected array but got: ${typeof value}`\n });\n return this.csharp.Literal.nop();\n }\n return this.csharp.Literal.set({\n valueType: this.context.dynamicTypeMapper.convert({ typeReference: set, unboxOptionals: true }),\n values: value.map((v, index) => {\n this.context.errors.scope({ index });\n try {\n return this.convert({ typeReference: set, value: v });\n } finally {\n this.context.errors.unscope();\n }\n })\n });\n }\n\n private convertMap({\n map,\n value,\n fallbackToDefault\n }: {\n map: FernIr.dynamic.MapType;\n value: unknown;\n fallbackToDefault?: string;\n }): ast.Literal {\n if (typeof value !== \"object\" || value == null) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected object but got: ${value == null ? \"null\" : typeof value}`\n });\n return this.csharp.Literal.nop();\n }\n return this.csharp.Literal.dictionary({\n keyType: this.context.dynamicTypeMapper.convert({ typeReference: map.key }),\n valueType:\n map.value.type === \"unknown\"\n ? this.context.dynamicTypeMapper.convert({ typeReference: map.value }).asOptional()\n : this.context.dynamicTypeMapper.convert({ typeReference: map.value }),\n entries: Object.entries(value).map(([key, value]) => {\n this.context.errors.scope(key);\n try {\n return {\n key: this.convert({ typeReference: map.key, value: key, as: \"key\" }),\n value: this.convert({ typeReference: map.value, value })\n };\n } finally {\n this.context.errors.unscope();\n }\n })\n });\n }\n\n private convertNamed({\n named,\n value,\n as,\n fallbackToDefault\n }: {\n named: FernIr.dynamic.NamedType;\n value: unknown;\n as?: DynamicLiteralMapper.ConvertedAs;\n fallbackToDefault?: string;\n }): ast.Literal {\n switch (named.type) {\n case \"alias\":\n return this.convert({ typeReference: named.typeReference, value, as, fallbackToDefault });\n case \"discriminatedUnion\":\n if (this.settings.shouldGeneratedDiscriminatedUnions) {\n return this.convertDiscriminatedUnion({ discriminatedUnion: named, value, fallbackToDefault });\n }\n return this.convertUnknown({ value, fallbackToDefault });\n case \"enum\":\n return this.getEnumValue(named, value);\n case \"object\":\n return this.convertObject({ object_: named, value, fallbackToDefault });\n case \"undiscriminatedUnion\":\n return this.convertUndiscriminatedUnion({ undiscriminatedUnion: named, value, fallbackToDefault });\n default:\n assertNever(named);\n }\n }\n\n private convertDiscriminatedUnion({\n discriminatedUnion,\n value,\n fallbackToDefault\n }: {\n discriminatedUnion: FernIr.dynamic.DiscriminatedUnionType;\n value: unknown;\n fallbackToDefault?: string;\n }): ast.Literal {\n const classReference = this.csharp.classReference({\n origin: discriminatedUnion.declaration,\n namespace: this.context.getNamespace(discriminatedUnion.declaration.fernFilepath)\n });\n const discriminatedUnionTypeInstance = this.context.resolveDiscriminatedUnionTypeInstance({\n discriminatedUnion,\n value\n });\n if (discriminatedUnionTypeInstance == null) {\n return this.csharp.Literal.nop();\n }\n const unionVariant = discriminatedUnionTypeInstance.singleDiscriminatedUnionType;\n const baseProperties = this.getBaseProperties({\n discriminatedUnionTypeInstance,\n singleDiscriminatedUnionType: unionVariant\n });\n switch (unionVariant.type) {\n case \"samePropertiesAsObject\": {\n const named = this.context.resolveNamedType({\n typeId: unionVariant.typeId\n });\n if (named == null) {\n return this.csharp.Literal.nop();\n }\n return this.instantiateUnionWithBaseProperties({\n classReference,\n baseProperties,\n arguments_: [this.convertNamed({ named, value: discriminatedUnionTypeInstance.value })]\n });\n }\n case \"singleProperty\": {\n const record = this.context.getRecord(discriminatedUnionTypeInstance.value);\n if (record == null) {\n return this.csharp.Literal.nop();\n }\n try {\n const innerClassName = [\"Value\", \"Type\"].includes(\n unionVariant.discriminantValue.name.pascalCase.safeName\n )\n ? `${unionVariant.discriminantValue.name.pascalCase.safeName}Inner`\n : unionVariant.discriminantValue.name.pascalCase.safeName;\n\n this.context.errors.scope(unionVariant.discriminantValue.wireValue);\n return this.instantiateUnionWithBaseProperties({\n classReference,\n baseProperties,\n arguments_: [\n this.csharp.instantiateClass({\n classReference: this.csharp.classReference({\n // origin: discriminatedUnionTypeInstance.discriminantValue,\n name: innerClassName,\n enclosingType: classReference\n }),\n arguments_: [\n this.convert({\n typeReference: unionVariant.typeReference,\n value: unionVariant.discriminantValue.wireValue\n })\n ]\n })\n ]\n });\n } finally {\n this.context.errors.unscope();\n }\n }\n case \"noProperties\":\n return this.instantiateUnionWithBaseProperties({\n classReference,\n baseProperties,\n arguments_: [\n // Unions with no properties require the discriminant property to be set.\n this.csharp.instantiateClass({\n classReference: this.csharp.classReference({\n origin: discriminatedUnionTypeInstance.discriminantValue,\n enclosingType: classReference\n }),\n arguments_: []\n })\n ]\n });\n default:\n assertNever(unionVariant);\n }\n }\n\n private getBaseProperties({\n discriminatedUnionTypeInstance,\n singleDiscriminatedUnionType\n }: {\n discriminatedUnionTypeInstance: DiscriminatedUnionTypeInstance;\n singleDiscriminatedUnionType: FernIr.dynamic.SingleDiscriminatedUnionType;\n }): NamedArgument[] {\n const properties = this.context.associateByWireValue({\n parameters: singleDiscriminatedUnionType.properties ?? [],\n values: this.context.getRecord(discriminatedUnionTypeInstance.value) ?? {},\n\n // We're only selecting the base properties here. The rest of the properties\n // are handled by the union variant.\n ignoreMissingParameters: true\n });\n return properties.map((property) => {\n this.context.errors.scope(property.name.wireValue);\n try {\n return {\n name: this.context.getPropertyName(property.name.name),\n assignment: this.convert(property)\n };\n } finally {\n this.context.errors.unscope();\n }\n });\n }\n\n private instantiateUnionWithBaseProperties({\n classReference,\n arguments_,\n baseProperties\n }: {\n classReference: ast.ClassReference;\n arguments_: ast.AstNode[];\n baseProperties: NamedArgument[];\n }): ast.Literal {\n const instantiation = this.csharp.instantiateClass({\n classReference,\n arguments_,\n multiline: true\n });\n if (baseProperties.length === 0) {\n return this.csharp.Literal.reference(instantiation);\n }\n return this.csharp.Literal.reference(\n this.csharp.codeblock((writer) => {\n writer.write(instantiation, \" \");\n writer.pushScope();\n for (const baseProperty of baseProperties) {\n writer.write(baseProperty.name, \" = \", baseProperty.assignment, \",\");\n }\n writer.popScope(false);\n })\n );\n }\n\n private getEnumValue(enum_: FernIr.dynamic.EnumType, wireValue: unknown): ast.Literal {\n if (typeof wireValue !== \"string\") {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected enum value string, got: ${typeof wireValue}`\n });\n return this.csharp.Literal.nop();\n }\n const enumValue = enum_.values.find((v) => v.wireValue === wireValue);\n if (enumValue == null) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `An enum value named \"${wireValue}\" does not exist in this context`\n });\n return this.csharp.Literal.nop();\n }\n const reference = this.csharp.classReference({\n origin: enum_.declaration,\n namespace: this.context.getNamespace(enum_.declaration.fernFilepath)\n });\n\n const valueName = reference.registerField(this.model.getPropertyNameFor(enumValue), enumValue);\n\n return this.csharp.Literal.reference(\n this.csharp.enumInstantiation({\n reference,\n value: valueName\n })\n );\n }\n\n private convertObject({\n object_,\n value,\n fallbackToDefault\n }: {\n object_: FernIr.dynamic.ObjectType;\n value: unknown;\n fallbackToDefault?: string;\n }): ast.Literal {\n const properties = this.context.associateByWireValue({\n parameters: object_.properties,\n values: this.context.getRecord(value) ?? {}\n });\n\n return this.csharp.Literal.class_({\n reference: this.csharp.classReference({\n origin: object_.declaration,\n namespace: this.context.getNamespace(object_.declaration.fernFilepath)\n }),\n fields: properties.map((property) => {\n this.context.errors.scope(property.name.wireValue);\n try {\n return {\n name: this.context.getClassName(property.name.name),\n value: this.convert(property)\n };\n } finally {\n this.context.errors.unscope();\n }\n })\n });\n }\n\n private convertUndiscriminatedUnion({\n undiscriminatedUnion,\n value,\n fallbackToDefault\n }: {\n undiscriminatedUnion: FernIr.dynamic.UndiscriminatedUnionType;\n value: unknown;\n fallbackToDefault?: string;\n }): ast.Literal {\n const result = this.findMatchingUndiscriminatedUnionType({\n undiscriminatedUnion,\n value\n });\n if (result == null) {\n return this.csharp.Literal.nop();\n }\n return result.typeLiteral;\n }\n\n private findMatchingUndiscriminatedUnionType({\n undiscriminatedUnion,\n value\n }: {\n undiscriminatedUnion: FernIr.dynamic.UndiscriminatedUnionType;\n value: unknown;\n }): { valueTypeReference: FernIr.dynamic.TypeReference; typeLiteral: ast.Literal } | undefined {\n for (const typeReference of undiscriminatedUnion.types) {\n try {\n const typeLiteral = this.convert({ typeReference, value });\n return { valueTypeReference: typeReference, typeLiteral };\n } catch (e) {\n continue;\n }\n }\n this.context.errors.add({\n severity: Severity.Critical,\n message: `None of the types in the undiscriminated union matched the given \"${typeof value}\" value`\n });\n return undefined;\n }\n\n private convertUnknown({ value, fallbackToDefault }: { value: unknown; fallbackToDefault?: string }): ast.Literal {\n return this.csharp.Literal.unknown(value);\n }\n\n private convertPrimitive({\n primitive,\n value,\n as,\n fallbackToDefault\n }: {\n primitive: FernIr.dynamic.PrimitiveTypeV1;\n value: unknown;\n as?: DynamicLiteralMapper.ConvertedAs;\n fallbackToDefault?: string;\n }): ast.Literal {\n switch (primitive) {\n case \"INTEGER\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return fallbackToDefault\n ? this.Primitive.integer.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.integer(num);\n }\n case \"LONG\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return fallbackToDefault\n ? this.Primitive.long.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.long(num);\n }\n case \"UINT\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return fallbackToDefault\n ? this.Primitive.uint.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.uint(num);\n }\n case \"UINT_64\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return fallbackToDefault\n ? this.Primitive.ulong.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.ulong(num);\n }\n case \"FLOAT\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return fallbackToDefault\n ? this.Primitive.float.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.float(num);\n }\n case \"DOUBLE\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return fallbackToDefault\n ? this.Primitive.double.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.double(num);\n }\n case \"BOOLEAN\": {\n const bool = this.getValueAsBoolean({ value, as });\n if (bool == null) {\n return fallbackToDefault\n ? this.Primitive.boolean.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.boolean(bool);\n }\n case \"STRING\": {\n const str = this.context.getValueAsString({ value });\n if (str == null) {\n return fallbackToDefault\n ? this.Primitive.string.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.string(str);\n }\n case \"DATE\": {\n const date = this.context.getValueAsString({ value });\n if (date == null) {\n return fallbackToDefault\n ? this.Value.dateOnly.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.date(date);\n }\n case \"DATE_TIME\": {\n const dateTime = this.context.getValueAsString({ value });\n if (dateTime == null) {\n return fallbackToDefault\n ? this.Value.dateTime.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.datetime(dateTime);\n }\n case \"UUID\": {\n const uuid = this.context.getValueAsString({ value });\n if (uuid == null) {\n return fallbackToDefault\n ? this.Primitive.string.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.string(uuid);\n }\n case \"BASE_64\": {\n const base64 = this.context.getValueAsString({ value });\n if (base64 == null) {\n return fallbackToDefault\n ? this.Primitive.string.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.string(base64);\n }\n case \"BIG_INTEGER\": {\n const bigInt = this.context.getValueAsString({ value });\n if (bigInt == null) {\n return fallbackToDefault\n ? this.Primitive.string.getDeterminsticDefault(fallbackToDefault)\n : this.csharp.Literal.nop();\n }\n return this.csharp.Literal.string(bigInt);\n }\n default:\n assertNever(primitive);\n }\n }\n\n private getValueAsNumber({\n value,\n as\n }: {\n value: unknown;\n as?: DynamicLiteralMapper.ConvertedAs;\n }): number | undefined {\n const num = as === \"key\" ? (typeof value === \"string\" ? Number(value) : value) : value;\n return this.context.getValueAsNumber({ value: num });\n }\n\n private getValueAsBoolean({\n value,\n as\n }: {\n value: unknown;\n as?: DynamicLiteralMapper.ConvertedAs;\n }): boolean | undefined {\n const bool =\n as === \"key\" ? (typeof value === \"string\" ? value === \"true\" : value === \"false\" ? false : value) : value;\n return this.context.getVal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,KAAK,OAAO,QAAQ,OAAOwC,CAAI,CAC1C,CACA,IAAK,UAAW,CACZ,IAAMC,EAAS,KAAK,QAAQ,iBAAiB,CAAE,MAAA1C,CAAM,CAAC,EACtD,OAAI0C,GAAU,KACHzC,EACD,KAAK,UAAU,OAAO,uBAAuBA,CAAiB,EAC9D,KAAK,OAAO,QAAQ,IAAI,EAE3B,KAAK,OAAO,QAAQ,OAAOyC,CAAM,CAC5C,CACA,IAAK,cAAe,CAChB,IAAMC,EAAS,KAAK,QAAQ,iBAAiB,CAAE,MAAA3C,CAAM,CAAC,EACtD,OAAI2C,GAAU,KACH1C,EACD,KAAK,UAAU,OAAO,uBAAuBA,CAAiB,EAC9D,KAAK,OAAO,QAAQ,IAAI,EAE3B,KAAK,OAAO,QAAQ,OAAO0C,CAAM,CAC5C,CACA,QACI7C,EAAYuC,CAAS,CAC7B,CACJ,CAEQ,iBAAiB,CACrB,MAAArC,EACA,GAAAU,CACJ,EAGuB,CACnB,IAAM4B,EAAM5B,IAAO,OAAS,OAAOV,GAAU,SAAW,OAAOA,CAAK,EAAaA,EACjF,OAAO,KAAK,QAAQ,iBAAiB,CAAE,MAAOsC,CAAI,CAAC,CACvD,CAEQ,kBAAkB,CACtB,MAAAtC,EACA,GAAAU,CACJ,EAGwB,CACpB,IAAML,EACFK,IAAO,MAAS,OAAOV,GAAU,SAAWA,IAAU,OAASA,IAAU,QAAU,GAAQA,EAASA,EACxG,OAAO,KAAK,QAAQ,kBAAkB,CAAE,MAAOK,CAAK,CAAC,CACzD,CACJ","names":["DynamicLiteralMapper","WithGeneration","context","__publicField","args","Severity","named","assertNever","list","value","fallbackToDefault","v","index","literal","bool","str","set","map","key","as","discriminatedUnion","classReference","discriminatedUnionTypeInstance","unionVariant","baseProperties","innerClassName","singleDiscriminatedUnionType","_a","_b","property","arguments_","instantiation","writer","baseProperty","enum_","wireValue","enumValue","reference","valueName","object_","properties","undiscriminatedUnion","result","typeReference","typeLiteral","e","primitive","num","date","dateTime","uuid","base64","bigInt"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as E,b as w,c as x,d as T,e as p,f as d,g as m}from"./chunk-QALVTPA5.js";var c=class{constructor(){p(this,"reporter");p(this,"snippet");p(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){this.shouldUpdate({snippet:r,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=r)}getResponseOrThrow({endpoint:e}){var r;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(r=this.err)!=null?r:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:r}){var t,n;return this.reporter==null||this.reporter.size()>0&&r.size()===0?!0:e.length>((n=(t=this.snippet)==null?void 0:t.length)!=null?n:0)}};var y=class{constructor(e){p(this,"context");this.context=e}async generate(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new c;for(let i of t){let s=this.context.clone(),l=this.createSnippetGenerator(s);try{let a=await l.generateSnippet({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:a,errors:void 0};n.update({context:s,snippet:a})}catch(a){n.err==null&&(n.err=a)}}return n.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n;for(let i of t){let s=this.context.clone(),l=this.createSnippetGenerator(s);try{return await l.generateSnippetAst({endpoint:i,request:e,options:r})}catch(a){n=a}}throw n!=null?n:new Error(`Failed to generate snippet AST for endpoint: ${e.endpoint.method} ${e.endpoint.path}`)}generateSync(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new c;for(let i of t){let s=this.context.clone(),l=this.createSnippetGenerator(s);try{let a=l.generateSnippetSync({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:a,errors:void 0};n.update({context:s,snippet:a})}catch(a){n.err==null&&(n.err=a)}}return n.getResponseOrThrow({endpoint:e.endpoint})}};var o={Critical:"CRITICAL",Warning:"WARNING"},f=class u{constructor(){p(this,"errors");p(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(w(E({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new u;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};var h=class{constructor(){p(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let t=e.match(this.REFERENCE_REGEX);if(!(t==null||t[1]==null||t[2]==null))return{method:t[1],path:t[2]}}};var g=class{constructor({ir:e,config:r,options:t={}}){p(this,"config");p(this,"options");p(this,"errors");p(this,"_ir");p(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.options=t,this.errors=new f,this.httpEndpointReferenceParser=new h}associateQueryParametersByWireValue({parameters:e,values:r}){let t=[];for(let[n,i]of Object.entries(r)){this.errors.scope(n);try{let s=e.find(a=>a.name.wireValue===n);if(s==null)throw this.newParameterNotRecognizedError(n);let l=this.isListTypeReference(s.typeReference)&&!Array.isArray(i)?[i]:i;t.push({name:s.name,typeReference:s.typeReference,value:l})}finally{this.errors.unscope()}}return t}associateByWireValueOrDefault({parameters:e,values:r}){let t=[];for(let n of e){this.errors.scope(n.name.wireValue);try{let i=r[n.name.wireValue];if(i==null)if(n.typeReference.type==="primitive"&&n.typeReference.value==="STRING")i=`<${n.name.wireValue}>`;else{this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n.name.wireValue).message});continue}t.push({name:n.name,typeReference:n.typeReference,value:i})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let n=[];for(let[i,s]of Object.entries(r)){this.errors.scope(i);try{let l=e.find(a=>a.name.wireValue===i);if(l==null){if(t)continue;this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(i).message});continue}n.push({name:l.name,typeReference:l.typeReference,value:s})}finally{this.errors.unscope()}}return n}getExampleObjectProperties({parameters:e,snippetObject:r}){let t=typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{},n=[];for(let i of e){let s=t[i.name.wireValue];s==null?i.typeReference.type==="nullable"&&n.push({name:i.name,typeReference:i.typeReference,value:null}):n.push({name:i.name,typeReference:i.typeReference,value:s})}return n}getSingleFileValue({property:e,record:r}){let t=r[e.wireValue];if(t!=null){if(typeof t!="string"){this.errors.add({severity:o.Critical,message:`Expected file value to be a string, got ${typeof t}`});return}return t}}getFileArrayValues({property:e,record:r}){let t=r[e.wireValue];if(t==null)return;if(!Array.isArray(t)){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof t}`});return}let n=[];for(let i of t){if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}n.push(i)}return n}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:o.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:o.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let t=this.getRecord(r);if(t==null)return;let n=e.discriminant.wireValue,i=t[n];if(i==null){this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n).message});return}if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let s=e.types[i];if(s==null){this.errors.add({severity:o.Critical,message:`No type found for discriminant value "${i}"`});return}let R=t,{[n]:l}=R,a=T(R,[x(n)]);return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:a}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocation(e){let r=[];for(let t of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:t,parsedEndpoint:e})&&r.push(t);return r}resolveEndpointLocationOrThrow(e){let r=this.resolveEndpointLocation(e);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:t}){var n;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:t}):!((n=e.metadata)!=null&&n.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var t,n;return r&&((n=(t=e.metadata)==null?void 0:t.includePathParameters)!=null?n:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:d(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}case"multipleBaseUrls":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}default:d(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let t=r.environments[0];if(t==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let n=new Set(m(t.urls));for(let i of m(e))n.has(i)&&n.delete(i);return n.size>0?(this.errors.add({severity:o.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${m(t.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:d(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:d(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:d(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};var v;(function(u){u.Concise="concise",u.Full="full"})(v||(v={}));var P={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};export{y as a,o as b,g as c,v as d,P as e};
|
|
2
|
+
//# sourceMappingURL=chunk-PRAGN765.js.map
|