@fern-api/go-dynamic-snippets 0.0.14 → 0.0.16

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.
Files changed (69) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +18 -10
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
  3. package/cjs/DynamicSnippetsGenerator.d.cts +7 -5
  4. package/cjs/{DynamicSnippetsGeneratorContext-lz2pTZw3.d.cts → DynamicSnippetsGeneratorContext-BusKoNq4.d.cts} +12 -2
  5. package/cjs/EndpointSnippetGenerator.cjs +19 -11
  6. package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
  7. package/cjs/EndpointSnippetGenerator.d.cts +15 -4
  8. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +18 -10
  9. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
  10. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
  11. package/cjs/context/DynamicTypeInstantiationMapper.cjs +19 -11
  12. package/cjs/context/DynamicTypeInstantiationMapper.cjs.map +1 -0
  13. package/cjs/context/DynamicTypeInstantiationMapper.d.cts +1 -1
  14. package/cjs/context/DynamicTypeMapper.cjs +18 -10
  15. package/cjs/context/DynamicTypeMapper.cjs.map +1 -0
  16. package/cjs/context/DynamicTypeMapper.d.cts +1 -1
  17. package/cjs/context/FilePropertyMapper.cjs +18 -10
  18. package/cjs/context/FilePropertyMapper.cjs.map +1 -0
  19. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  20. package/cjs/index.cjs +24 -28
  21. package/cjs/index.cjs.map +1 -0
  22. package/cjs/index.d.cts +2 -1
  23. package/esm/DynamicSnippetsGenerator.d.ts +7 -5
  24. package/esm/DynamicSnippetsGenerator.js +2 -1
  25. package/esm/DynamicSnippetsGenerator.js.map +1 -0
  26. package/esm/{DynamicSnippetsGeneratorContext-lz2pTZw3.d.ts → DynamicSnippetsGeneratorContext-BusKoNq4.d.ts} +12 -2
  27. package/esm/EndpointSnippetGenerator.d.ts +15 -4
  28. package/esm/EndpointSnippetGenerator.js +2 -1
  29. package/esm/EndpointSnippetGenerator.js.map +1 -0
  30. package/esm/chunk-2YRGTA73.js +2 -0
  31. package/esm/chunk-2YRGTA73.js.map +1 -0
  32. package/esm/chunk-BI26DLZ5.js +2 -0
  33. package/esm/chunk-BI26DLZ5.js.map +1 -0
  34. package/esm/chunk-D6NMQKNQ.js +2 -0
  35. package/esm/chunk-D6NMQKNQ.js.map +1 -0
  36. package/esm/chunk-FD44EP2P.js +2 -0
  37. package/esm/chunk-FD44EP2P.js.map +1 -0
  38. package/esm/chunk-GUJUKQKZ.js +37 -0
  39. package/esm/chunk-GUJUKQKZ.js.map +1 -0
  40. package/esm/chunk-Q6YO7G6Y.js +2 -0
  41. package/esm/chunk-Q6YO7G6Y.js.map +1 -0
  42. package/esm/chunk-UZEM7EUP.js +2 -0
  43. package/esm/chunk-UZEM7EUP.js.map +1 -0
  44. package/esm/chunk-VCNL2JWU.js +2 -0
  45. package/esm/chunk-VCNL2JWU.js.map +1 -0
  46. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
  47. package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
  48. package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
  49. package/esm/context/DynamicTypeInstantiationMapper.d.ts +1 -1
  50. package/esm/context/DynamicTypeInstantiationMapper.js +2 -1
  51. package/esm/context/DynamicTypeInstantiationMapper.js.map +1 -0
  52. package/esm/context/DynamicTypeMapper.d.ts +1 -1
  53. package/esm/context/DynamicTypeMapper.js +2 -1
  54. package/esm/context/DynamicTypeMapper.js.map +1 -0
  55. package/esm/context/FilePropertyMapper.d.ts +1 -1
  56. package/esm/context/FilePropertyMapper.js +2 -1
  57. package/esm/context/FilePropertyMapper.js.map +1 -0
  58. package/esm/index.d.ts +2 -1
  59. package/esm/index.js +2 -13
  60. package/esm/index.js.map +1 -0
  61. package/package.json +1 -1
  62. package/esm/chunk-5HP3T45N.js +0 -1
  63. package/esm/chunk-D3UUM672.js +0 -1
  64. package/esm/chunk-I3VUX77R.js +0 -1
  65. package/esm/chunk-J745U74Q.js +0 -1
  66. package/esm/chunk-SS6XZXHU.js +0 -1
  67. package/esm/chunk-TUE3DOHS.js +0 -29
  68. package/esm/chunk-X7QP3WH3.js +0 -1
  69. package/esm/chunk-YAGEU3HO.js +0 -1
package/cjs/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { DynamicSnippetsGenerator } from './DynamicSnippetsGenerator.cjs';
2
2
  import '@fern-api/browser-compatible-base-generator';
3
3
  import '@fern-api/dynamic-ir-sdk';
4
- import './DynamicSnippetsGeneratorContext-lz2pTZw3.cjs';
4
+ import './DynamicSnippetsGeneratorContext-BusKoNq4.cjs';
5
5
  import '@fern-api/go-ast';
6
+ import './EndpointSnippetGenerator.cjs';
@@ -1,17 +1,19 @@
1
- import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, AbstractFormatter } from '@fern-api/browser-compatible-base-generator';
1
+ import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, AbstractFormatter, Options } from '@fern-api/browser-compatible-base-generator';
2
2
  import { FernIr } from '@fern-api/dynamic-ir-sdk';
3
- import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-lz2pTZw3.js';
3
+ import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-BusKoNq4.js';
4
+ import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.js';
4
5
  import '@fern-api/go-ast';
5
6
 
6
- declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, FernIr.dynamic.EndpointSnippetRequest, FernIr.dynamic.EndpointSnippetResponse> {
7
+ declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, EndpointSnippetGenerator> {
7
8
  private formatter;
8
9
  constructor({ ir, config, formatter }: {
9
10
  ir: FernIr.dynamic.DynamicIntermediateRepresentation;
10
11
  config: FernGeneratorExec.GeneratorConfig;
11
12
  formatter?: AbstractFormatter;
12
13
  });
13
- generate(request: FernIr.dynamic.EndpointSnippetRequest): Promise<FernIr.dynamic.EndpointSnippetResponse>;
14
- generateSync(request: FernIr.dynamic.EndpointSnippetRequest): FernIr.dynamic.EndpointSnippetResponse;
14
+ generate(request: FernIr.dynamic.EndpointSnippetRequest, options?: Options): Promise<FernIr.dynamic.EndpointSnippetResponse>;
15
+ generateSync(request: FernIr.dynamic.EndpointSnippetRequest, options?: Options): FernIr.dynamic.EndpointSnippetResponse;
16
+ protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator;
15
17
  }
16
18
 
17
19
  export { DynamicSnippetsGenerator };
@@ -1 +1,2 @@
1
- import{a}from"./chunk-YAGEU3HO.js";import"./chunk-X7QP3WH3.js";import"./chunk-5HP3T45N.js";import"./chunk-SS6XZXHU.js";import"./chunk-J745U74Q.js";import"./chunk-D3UUM672.js";import"./chunk-I3VUX77R.js";import"./chunk-TUE3DOHS.js";export{a as DynamicSnippetsGenerator};
1
+ import{a}from"./chunk-BI26DLZ5.js";import"./chunk-D6NMQKNQ.js";import"./chunk-UZEM7EUP.js";import"./chunk-FD44EP2P.js";import"./chunk-VCNL2JWU.js";import"./chunk-Q6YO7G6Y.js";import"./chunk-2YRGTA73.js";import"./chunk-GUJUKQKZ.js";export{a as DynamicSnippetsGenerator};
2
+ //# sourceMappingURL=DynamicSnippetsGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -16,15 +16,18 @@ declare class DynamicTypeInstantiationMapper {
16
16
  context: DynamicSnippetsGeneratorContext;
17
17
  });
18
18
  convert(args: DynamicTypeInstantiationMapper.Args): go.TypeInstantiation;
19
+ convertToPointerIfPossible(args: DynamicTypeInstantiationMapper.Args): go.TypeInstantiation;
19
20
  private convertList;
20
21
  private convertMap;
21
22
  private convertNamed;
23
+ private convertAlias;
24
+ private convertLiteralValue;
22
25
  private convertDiscriminatedUnion;
23
26
  private getBaseFields;
24
27
  private convertObject;
25
28
  private convertEnum;
26
29
  private getEnumValueName;
27
- private convertUndicriminatedUnion;
30
+ private convertUndiscriminatedUnion;
28
31
  private findMatchingUndiscriminatedUnionType;
29
32
  private getUndiscriminatedUnionFieldName;
30
33
  private getUndiscriminatedUnionFieldNameForList;
@@ -37,6 +40,7 @@ declare class DynamicTypeInstantiationMapper {
37
40
  private convertPrimitive;
38
41
  private getValueAsNumber;
39
42
  private getValueAsBoolean;
43
+ private normalizeDateTimeString;
40
44
  }
41
45
 
42
46
  declare namespace DynamicTypeMapper {
@@ -86,14 +90,19 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
86
90
  config: FernGeneratorExec.GeneratorConfig;
87
91
  });
88
92
  clone(): DynamicSnippetsGeneratorContext;
93
+ isOptional(typeReference: FernIr.dynamic.TypeReference): boolean;
89
94
  getMethodName(name: FernIr.Name): string;
95
+ getTestMethodName(endpoint: FernIr.dynamic.Endpoint): string;
90
96
  getTypeName(name: FernIr.Name): string;
91
- getImportPath(fernFilepath: FernIr.FernFilepath): string;
97
+ getImportPath(fernFilepath: FernIr.dynamic.FernFilepath): string;
98
+ getImportPathForRequest(fernFilepath: FernIr.dynamic.FernFilepath): string;
92
99
  getContextTypeReference(): go.TypeReference;
93
100
  getContextTodoFunctionInvocation(): go.FuncInvocation;
94
101
  getIoReaderTypeReference(): go.TypeReference;
102
+ getTestingTypeReference(): go.TypeReference;
95
103
  getNewStringsReaderFunctionInvocation(s: string): go.FuncInvocation;
96
104
  getClientConstructorName(): string;
105
+ getClientName(): string;
97
106
  getClientImportPath(): string;
98
107
  getOptionImportPath(): string;
99
108
  getGoTypeReferenceFromDeclaration({ declaration }: {
@@ -101,6 +110,7 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
101
110
  }): go.TypeReference;
102
111
  getEnvironmentTypeReferenceFromID(environmentID: string): go.TypeReference | undefined;
103
112
  private getEnvironmentTypeReference;
113
+ static chainMethods(baseFunc: go.FuncInvocation, ...methods: Omit<go.MethodInvocation.Args, "on">[]): go.MethodInvocation;
104
114
  }
105
115
 
106
116
  export { DynamicSnippetsGeneratorContext as D, type FilePropertyInfo as F, DynamicTypeInstantiationMapper as a, DynamicTypeMapper as b, FilePropertyMapper as c };
@@ -1,6 +1,6 @@
1
- import { AbstractFormatter } from '@fern-api/browser-compatible-base-generator';
1
+ import { AbstractFormatter, Options } from '@fern-api/browser-compatible-base-generator';
2
2
  import { FernIr } from '@fern-api/dynamic-ir-sdk';
3
- import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-lz2pTZw3.js';
3
+ import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-BusKoNq4.js';
4
4
  import '@fern-api/go-ast';
5
5
 
6
6
  declare class EndpointSnippetGenerator {
@@ -10,19 +10,28 @@ declare class EndpointSnippetGenerator {
10
10
  context: DynamicSnippetsGeneratorContext;
11
11
  formatter?: AbstractFormatter;
12
12
  });
13
- generateSnippet({ endpoint, request }: {
13
+ generateSnippet({ endpoint, request, options }: {
14
14
  endpoint: FernIr.dynamic.Endpoint;
15
15
  request: FernIr.dynamic.EndpointSnippetRequest;
16
+ options?: Options;
16
17
  }): Promise<string>;
17
- generateSnippetSync({ endpoint, request }: {
18
+ generateSnippetSync({ endpoint, request, options }: {
18
19
  endpoint: FernIr.dynamic.Endpoint;
19
20
  request: FernIr.dynamic.EndpointSnippetRequest;
21
+ options?: Options;
20
22
  }): string;
23
+ private generateWiremockTest;
21
24
  private buildCodeBlock;
25
+ private buildWiremockTestCodeBlock;
22
26
  private constructClient;
27
+ private constructWiremockTestClient;
28
+ private writeMethodInvocation;
23
29
  private callMethod;
24
30
  private getConstructorArgs;
31
+ private getWiremockTestConstructorArgs;
25
32
  private getConstructorAuthArg;
33
+ private addError;
34
+ private addWarning;
26
35
  private getConstructorBasicAuthArg;
27
36
  private getConstructorBaseUrlArg;
28
37
  private getBaseUrlArg;
@@ -45,6 +54,8 @@ declare class EndpointSnippetGenerator {
45
54
  private getPathParameters;
46
55
  private getMethod;
47
56
  private getRootClientFuncInvocation;
57
+ private buildWiremockTestSetup;
58
+ private callClientMethodAndAssert;
48
59
  }
49
60
 
50
61
  export { EndpointSnippetGenerator };
@@ -1 +1,2 @@
1
- import{a}from"./chunk-X7QP3WH3.js";import"./chunk-J745U74Q.js";import"./chunk-TUE3DOHS.js";export{a as EndpointSnippetGenerator};
1
+ import{a}from"./chunk-D6NMQKNQ.js";import"./chunk-VCNL2JWU.js";import"./chunk-GUJUKQKZ.js";export{a as EndpointSnippetGenerator};
2
+ //# sourceMappingURL=EndpointSnippetGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ import{e as p,f as s,g as y,h as l,j as o}from"./chunk-GUJUKQKZ.js";s();y();var c=class{constructor({context:t}){p(this,"context");this.context=t}getFilePropertyInfo({body:t,value:n}){var a;let e={fileFields:[],bodyPropertyFields:[]},i=(a=this.context.getRecord(n))!=null?a:{};for(let r of t.properties)switch(r.type){case"file":e.fileFields.push({name:this.context.getTypeName(r.name),value:this.getSingleFileProperty({property:r,record:i})});break;case"fileArray":e.fileFields.push({name:this.context.getTypeName(r.name),value:this.getArrayFileProperty({property:r,record:i})});break;case"bodyProperty":e.bodyPropertyFields.push({name:this.context.getTypeName(r.name.name),value:this.getBodyProperty({property:r,record:i})});break;default:l(r)}return e}getSingleFileProperty({property:t,record:n}){let e=this.context.getSingleFileValue({property:t,record:n})||"";return o.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(e))}getArrayFileProperty({property:t,record:n}){let e=this.context.getFileArrayValues({property:t,record:n});return e==null?o.TypeInstantiation.nop():o.TypeInstantiation.slice({valueType:o.Type.reference(this.context.getIoReaderTypeReference()),values:e.map(i=>o.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(i)))})}getBodyProperty({property:t,record:n}){let e=n[t.name.wireValue];return e==null?o.TypeInstantiation.nop():this.context.dynamicTypeInstantiationMapper.convert({typeReference:t.typeReference,value:e})}};export{c as a};
2
+ //# sourceMappingURL=chunk-2YRGTA73.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/FilePropertyMapper.ts"],"sourcesContent":["import { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { go } from \"@fern-api/go-ast\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./DynamicSnippetsGeneratorContext\";\n\nexport interface FilePropertyInfo {\n fileFields: go.StructField[];\n bodyPropertyFields: go.StructField[];\n}\n\nexport class FilePropertyMapper {\n private context: DynamicSnippetsGeneratorContext;\n\n constructor({ context }: { context: DynamicSnippetsGeneratorContext }) {\n this.context = context;\n }\n\n public getFilePropertyInfo({\n body,\n value\n }: {\n body: FernIr.dynamic.FileUploadRequestBody;\n value: unknown;\n }): FilePropertyInfo {\n const result: FilePropertyInfo = {\n fileFields: [],\n bodyPropertyFields: []\n };\n const record = this.context.getRecord(value) ?? {};\n for (const property of body.properties) {\n switch (property.type) {\n case \"file\":\n result.fileFields.push({\n name: this.context.getTypeName(property.name),\n value: this.getSingleFileProperty({ property, record })\n });\n break;\n case \"fileArray\":\n result.fileFields.push({\n name: this.context.getTypeName(property.name),\n value: this.getArrayFileProperty({ property, record })\n });\n break;\n case \"bodyProperty\":\n result.bodyPropertyFields.push({\n name: this.context.getTypeName(property.name.name),\n value: this.getBodyProperty({ property, record })\n });\n break;\n default:\n assertNever(property);\n }\n }\n return result;\n }\n\n private getSingleFileProperty({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.File_;\n record: Record<string, unknown>;\n }): go.TypeInstantiation {\n // fix(williammcadams): always return a string reader even if no example was provided\n const fileValue = this.context.getSingleFileValue({ property, record }) || \"\";\n return go.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(fileValue));\n }\n\n private getArrayFileProperty({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.FileArray;\n record: Record<string, unknown>;\n }): go.TypeInstantiation {\n const fileValues = this.context.getFileArrayValues({ property, record });\n if (fileValues == null) {\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.slice({\n valueType: go.Type.reference(this.context.getIoReaderTypeReference()),\n values: fileValues.map((value) =>\n go.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(value))\n )\n });\n }\n\n private getBodyProperty({\n property,\n record\n }: {\n property: FernIr.dynamic.NamedParameter;\n record: Record<string, unknown>;\n }): go.TypeInstantiation {\n const bodyPropertyValue = record[property.name.wireValue];\n if (bodyPropertyValue == null) {\n return go.TypeInstantiation.nop();\n }\n return this.context.dynamicTypeInstantiationMapper.convert({\n typeReference: property.typeReference,\n value: bodyPropertyValue\n });\n }\n}\n"],"mappings":"oEAAAA,IAAAC,IAWO,IAAMC,EAAN,KAAyB,CAG5B,YAAY,CAAE,QAAAC,CAAQ,EAAiD,CAFvEC,EAAA,KAAQ,WAGJ,KAAK,QAAUD,CACnB,CAEO,oBAAoB,CACvB,KAAAE,EACA,MAAAC,CACJ,EAGqB,CAxBzB,IAAAC,EAyBQ,IAAMC,EAA2B,CAC7B,WAAY,CAAC,EACb,mBAAoB,CAAC,CACzB,EACMC,GAASF,EAAA,KAAK,QAAQ,UAAUD,CAAK,IAA5B,KAAAC,EAAiC,CAAC,EACjD,QAAWG,KAAYL,EAAK,WACxB,OAAQK,EAAS,KAAM,CACnB,IAAK,OACDF,EAAO,WAAW,KAAK,CACnB,KAAM,KAAK,QAAQ,YAAYE,EAAS,IAAI,EAC5C,MAAO,KAAK,sBAAsB,CAAE,SAAAA,EAAU,OAAAD,CAAO,CAAC,CAC1D,CAAC,EACD,MACJ,IAAK,YACDD,EAAO,WAAW,KAAK,CACnB,KAAM,KAAK,QAAQ,YAAYE,EAAS,IAAI,EAC5C,MAAO,KAAK,qBAAqB,CAAE,SAAAA,EAAU,OAAAD,CAAO,CAAC,CACzD,CAAC,EACD,MACJ,IAAK,eACDD,EAAO,mBAAmB,KAAK,CAC3B,KAAM,KAAK,QAAQ,YAAYE,EAAS,KAAK,IAAI,EACjD,MAAO,KAAK,gBAAgB,CAAE,SAAAA,EAAU,OAAAD,CAAO,CAAC,CACpD,CAAC,EACD,MACJ,QACIE,EAAYD,CAAQ,CAC5B,CAEJ,OAAOF,CACX,CAEQ,sBAAsB,CAC1B,SAAAE,EACA,OAAAD,CACJ,EAGyB,CAErB,IAAMG,EAAY,KAAK,QAAQ,mBAAmB,CAAE,SAAAF,EAAU,OAAAD,CAAO,CAAC,GAAK,GAC3E,OAAOI,EAAG,kBAAkB,UAAU,KAAK,QAAQ,sCAAsCD,CAAS,CAAC,CACvG,CAEQ,qBAAqB,CACzB,SAAAF,EACA,OAAAD,CACJ,EAGyB,CACrB,IAAMK,EAAa,KAAK,QAAQ,mBAAmB,CAAE,SAAAJ,EAAU,OAAAD,CAAO,CAAC,EACvE,OAAIK,GAAc,KACPD,EAAG,kBAAkB,IAAI,EAE7BA,EAAG,kBAAkB,MAAM,CAC9B,UAAWA,EAAG,KAAK,UAAU,KAAK,QAAQ,yBAAyB,CAAC,EACpE,OAAQC,EAAW,IAAKR,GACpBO,EAAG,kBAAkB,UAAU,KAAK,QAAQ,sCAAsCP,CAAK,CAAC,CAC5F,CACJ,CAAC,CACL,CAEQ,gBAAgB,CACpB,SAAAI,EACA,OAAAD,CACJ,EAGyB,CACrB,IAAMM,EAAoBN,EAAOC,EAAS,KAAK,SAAS,EACxD,OAAIK,GAAqB,KACdF,EAAG,kBAAkB,IAAI,EAE7B,KAAK,QAAQ,+BAA+B,QAAQ,CACvD,cAAeH,EAAS,cACxB,MAAOK,CACX,CAAC,CACL,CACJ","names":["init_process","init_buffer","FilePropertyMapper","context","__publicField","body","value","_a","result","record","property","assertNever","fileValue","go_exports","fileValues","bodyPropertyValue"]}
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-D6NMQKNQ.js";import{a as i}from"./chunk-UZEM7EUP.js";import{a as p}from"./chunk-VCNL2JWU.js";import{e as r,f as n,g as o}from"./chunk-GUJUKQKZ.js";n();o();var s=class extends p{constructor({ir:e,config:t,formatter:m}){super(new i({ir:e,config:t}));r(this,"formatter");this.formatter=m}async generate(e,t){return super.generate(e,t)}generateSync(e,t){return super.generateSync(e,t)}createSnippetGenerator(e){return new a({context:e,formatter:this.formatter})}};export{s as a};
2
+ //# sourceMappingURL=chunk-BI26DLZ5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/DynamicSnippetsGenerator.ts"],"sourcesContent":["import {\n AbstractDynamicSnippetsGenerator,\n AbstractFormatter,\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 private formatter: AbstractFormatter | undefined;\n\n constructor({\n ir,\n config,\n formatter\n }: {\n ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n config: FernGeneratorExec.GeneratorConfig;\n formatter?: AbstractFormatter;\n }) {\n super(new DynamicSnippetsGeneratorContext({ ir, config }));\n this.formatter = formatter;\n }\n\n public 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 generateSync(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options?: Options\n ): FernIr.dynamic.EndpointSnippetResponse {\n return super.generateSync(request, options);\n }\n\n protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator {\n return new EndpointSnippetGenerator({ context, formatter: this.formatter });\n }\n}\n"],"mappings":"yKAAAA,IAAAC,IAUO,IAAMC,EAAN,cAAuCC,CAG5C,CAGE,YAAY,CACR,GAAAC,EACA,OAAAC,EACA,UAAAC,CACJ,EAIG,CACC,MAAM,IAAIC,EAAgC,CAAE,GAAAH,EAAI,OAAAC,CAAO,CAAC,CAAC,EAX7DG,EAAA,KAAQ,aAYJ,KAAK,UAAYF,CACrB,CAEA,MAAa,SACTG,EACAC,EAC+C,CAC/C,OAAO,MAAM,SAASD,EAASC,CAAO,CAC1C,CAEO,aACHD,EACAC,EACsC,CACtC,OAAO,MAAM,aAAaD,EAASC,CAAO,CAC9C,CAEU,uBAAuBC,EAAoE,CACjG,OAAO,IAAIC,EAAyB,CAAE,QAAAD,EAAS,UAAW,KAAK,SAAU,CAAC,CAC9E,CACJ","names":["init_process","init_buffer","DynamicSnippetsGenerator","AbstractDynamicSnippetsGenerator","ir","config","formatter","DynamicSnippetsGeneratorContext","__publicField","request","options","context","EndpointSnippetGenerator"]}
@@ -0,0 +1,2 @@
1
+ import{b as p,d}from"./chunk-VCNL2JWU.js";import{e as A,f as R,g as N,h as m,j as n}from"./chunk-GUJUKQKZ.js";R();N();var b="example",k="fern",T="do",I="client",l=n.TypeInstantiation,C="WireMockBaseURL",w="WireMockClient",x=class{constructor({context:e,formatter:t}){A(this,"context");A(this,"formatter");this.context=e,this.formatter=t}async generateSnippet({endpoint:e,request:t,options:r}){var s,a,c;return((a=(s=r==null?void 0:r.config)==null?void 0:s.outputWiremockTests)!=null?a:!1)?this.generateWiremockTest({endpoint:e,snippet:t}):await this.buildCodeBlock({endpoint:e,snippet:t}).toStringAsync({packageName:b,importPath:k,rootImportPath:this.context.rootImportPath,customConfig:(c=this.context.customConfig)!=null?c:{},formatter:this.formatter})}generateSnippetSync({endpoint:e,request:t,options:r}){var s,a,c;return((a=(s=r==null?void 0:r.config)==null?void 0:s.outputWiremockTests)!=null?a:!1)?this.generateWiremockTest({endpoint:e,snippet:t}):this.buildCodeBlock({endpoint:e,snippet:t}).toString({packageName:b,importPath:k,rootImportPath:this.context.rootImportPath,customConfig:(c=this.context.customConfig)!=null?c:{},formatter:this.formatter})}generateWiremockTest({endpoint:e,snippet:t}){var o;return this.buildWiremockTestCodeBlock({endpoint:e,snippet:t}).toString({packageName:"wiremock",importPath:k,rootImportPath:this.context.rootImportPath,customConfig:(o=this.context.customConfig)!=null?o:{},formatter:this.formatter})}buildCodeBlock({endpoint:e,snippet:t}){return n.codeblock(r=>{r.writeNode(n.func({name:T,parameters:[],return_:[],body:n.codeblock(o=>{o.writeNode(this.constructClient({endpoint:e,snippet:t})),o.writeLine(),o.writeNode(this.callMethod({endpoint:e,snippet:t}))})})),r.writeNewLineIfLastLineNot()})}buildWiremockTestCodeBlock({endpoint:e,snippet:t}){return n.codeblock(r=>{r.writeNode(n.func({name:"Test"+this.context.getTestMethodName(e)+"WithWireMock",parameters:[n.parameter({name:"t",type:n.Type.pointer(n.Type.reference(this.context.getTestingTypeReference()))})],return_:[],body:n.codeblock(o=>{for(let i of this.buildWiremockTestSetup({endpoint:e}))o.writeNode(i),o.writeLine();o.writeLine(),o.writeNode(this.constructWiremockTestClient({endpoint:e,snippet:t})),o.writeLine(),o.writeNode(this.callClientMethodAndAssert({endpoint:e,snippet:t}))})})),r.writeNewLineIfLastLineNot()})}constructClient({endpoint:e,snippet:t}){return n.codeblock(r=>{r.write(`${I} := `),r.writeNode(this.getRootClientFuncInvocation(this.getConstructorArgs({endpoint:e,snippet:t})))})}constructWiremockTestClient({endpoint:e,snippet:t}){return n.codeblock(r=>{r.write(`${I} := `),r.writeNode(this.getRootClientFuncInvocation(this.getWiremockTestConstructorArgs()))})}writeMethodInvocation({writer:e,endpoint:t,snippet:r}){let{otherArgs:o,requestArg:i}=this.getMethodArgs({endpoint:t,snippet:r});if(i!=null)if(i instanceof n.TypeInstantiation&&n.TypeInstantiation.isNop(i))e.writeNode(n.invokeMethod({on:n.codeblock(I),method:this.getMethod({endpoint:t}),arguments_:[this.context.getContextTodoFunctionInvocation(),...o,n.codeblock("nil")]}));else{e.write("request := "),e.writeNode(i),e.writeLine();let s=n.codeblock("request");e.writeNode(n.invokeMethod({on:n.codeblock(I),method:this.getMethod({endpoint:t}),arguments_:[this.context.getContextTodoFunctionInvocation(),...o,s]}))}else e.writeNode(n.invokeMethod({on:n.codeblock(I),method:this.getMethod({endpoint:t}),arguments_:[this.context.getContextTodoFunctionInvocation(),...o]}))}callMethod({endpoint:e,snippet:t}){return n.codeblock(r=>{this.writeMethodInvocation({writer:r,endpoint:e,snippet:t})})}getConstructorArgs({endpoint:e,snippet:t}){let r=[],o=this.getConstructorBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});return o!=null&&r.push(o),e.auth!=null&&(t.auth!=null?r.push(this.getConstructorAuthArg({auth:e.auth,values:t.auth})):this.context.errors.add({severity:p.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(d.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),r}getWiremockTestConstructorArgs(){return[n.codeblock(e=>{e.writeNode(n.invokeFunc({func:n.typeReference({name:"WithBaseURL",importPath:this.context.getOptionImportPath()}),arguments_:[n.codeblock(C)]}))})]}getConstructorAuthArg({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),l.nop();switch(e.type){case"basic":return t.type==="basic"?this.getConstructorBasicAuthArg({auth:e,values:t}):l.nop();case"bearer":return t.type==="bearer"?this.getConstructorBearerAuthArg({auth:e,values:t}):l.nop();case"header":return t.type==="header"?this.getConstructorHeaderAuthArg({auth:e,values:t}):l.nop();case"oauth":return this.addWarning("The Go SDK doesn't support OAuth client credentials yet"),l.nop();case"inferred":return this.addWarning("The Go SDK Generator does not support Inferred auth scheme yet"),l.nop();default:m(e)}}addError(e){this.context.errors.add({severity:p.Critical,message:e})}addWarning(e){this.context.errors.add({severity:p.Warning,message:e})}getConstructorBasicAuthArg({auth:e,values:t}){return n.codeblock(r=>{r.writeNode(n.invokeFunc({func:n.typeReference({name:"WithBasicAuth",importPath:this.context.getOptionImportPath()}),arguments_:[n.TypeInstantiation.string(t.username),n.TypeInstantiation.string(t.password)]}))})}getConstructorBaseUrlArg({baseUrl:e,environment:t}){let r=this.getBaseUrlArg({baseUrl:e,environment:t});if(r!=null)return n.codeblock(o=>{o.writeNode(n.invokeFunc({func:n.typeReference({name:"WithBaseURL",importPath:this.context.getOptionImportPath()}),arguments_:[r]}))})}getBaseUrlArg({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:p.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return n.TypeInstantiation.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);if(r==null){this.context.errors.add({severity:p.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return n.TypeInstantiation.reference(r)}this.context.isMultiEnvironmentValues(t)&&this.context.errors.add({severity:p.Warning,message:"The Go SDK doesn't support a multi-environment client option yet; use the baseUrl option instead"})}}getConstructorBearerAuthArg({auth:e,values:t}){return n.codeblock(r=>{r.writeNode(n.invokeFunc({func:n.typeReference({name:`With${e.token.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[n.TypeInstantiation.string(t.token)]}))})}getConstructorHeaderAuthArg({auth:e,values:t}){return n.codeblock(r=>{r.writeNode(n.invokeFunc({func:n.typeReference({name:`With${e.header.name.name.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.header.typeReference,value:t.value})]}))})}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let o of e){let i=this.getConstructorHeaderArg({header:o,value:t.value});i!=null&&r.push(i)}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.typeReference,value:t});if(!n.TypeInstantiation.isNop(r))return n.codeblock(o=>{o.writeNode(n.invokeFunc({func:n.typeReference({name:`With${e.name.name.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[r]}))})}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:m(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var s,a;let r=[];this.context.errors.scope(d.PathParameters);let o=[...(s=this.context.ir.pathParameters)!=null?s:[],...(a=e.pathParameters)!=null?a:[]];o.length>0&&r.push(...this.getPathParameters({namedParameters:o,snippet:t}).map(c=>c.value)),this.context.errors.unscope(),this.context.errors.scope(d.RequestBody);let i=e.body!=null?this.getBodyRequestArg({body:e.body,value:t.requestBody}):void 0;return this.context.errors.unscope(),{otherArgs:r,requestArg:i}}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.value,value:t});default:m(e)}}getBytesBodyRequestArg({value:e}){return typeof e!="string"?(this.context.errors.add({severity:p.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),n.TypeInstantiation.nop()):n.TypeInstantiation.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){var h,g,y,f,u,P;let r=[],{inlinePathParameters:o,inlineFileProperties:i}={inlinePathParameters:(g=(h=this.context.customConfig)==null?void 0:h.inlinePathParameters)!=null?g:!0,inlineFileProperties:(f=(y=this.context.customConfig)==null?void 0:y.inlineFileProperties)!=null?f:!0};this.context.errors.scope(d.PathParameters);let s=[],a=[...(u=this.context.ir.pathParameters)!=null?u:[],...(P=e.pathParameters)!=null?P:[]];a.length>0&&s.push(...this.getPathParameters({namedParameters:a,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(d.RequestBody);let c=this.getFilePropertyInfo({request:e,snippet:t});this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:o})||r.push(...s.map(v=>v.value)),i||r.push(...c.fileFields.map(v=>v.value));let F=this.context.needsRequestParameter({request:e,inlinePathParameters:o,inlineFileProperties:i})?this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:o})?s:[],filePropertyInfo:c}):void 0;return{otherArgs:r,requestArg:F}}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:o}){var h,g,y,f;this.context.errors.scope(d.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:(h=e.queryParameters)!=null?h:[],values:(g=t.queryParameters)!=null?g:{}}).map(u=>({name:u.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(u)}));this.context.errors.unscope(),this.context.errors.scope(d.Headers);let c=this.context.associateByWireValue({parameters:(y=e.headers)!=null?y:[],values:(f=t.headers)!=null?f:{}}).map(u=>({name:u.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(u)}));this.context.errors.unscope(),this.context.errors.scope(d.RequestBody);let F=e.body!=null?this.getInlinedRequestBodyStructFields({body:e.body,value:t.requestBody,filePropertyInfo:o}):[];return this.context.errors.unscope(),n.TypeInstantiation.structPointer({typeReference:n.typeReference({name:this.context.getMethodName(e.declaration.name),importPath:this.context.getImportPathForRequest(e.declaration.fernFilepath)}),fields:[...r,...s,...c,...F]})}getInlinedRequestBodyStructFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyStructFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyStructField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyStructFields({filePropertyInfo:r});default:m(e)}}getFileUploadRequestBodyStructFields({filePropertyInfo:e}){var t;return(t=this.context.customConfig)!=null&&t.inlineFileProperties?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyStructField({body:e,value:t}){return{name:this.context.getTypeName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeInstantiation({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeInstantiation({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.value,value:t});default:m(e)}}getInlinedRequestBodyPropertyStructFields({parameters:e,value:t}){var i;let r=[],o=this.context.associateByWireValue({parameters:e,values:(i=this.context.getRecord(t))!=null?i:{}});for(let s of o)r.push({name:this.context.getTypeName(s.name.name),value:this.context.dynamicTypeInstantiationMapper.convert(s)});return r}getPathParameters({namedParameters:e,snippet:t}){var i;let r=[],o=this.context.associateByWireValue({parameters:e,values:(i=t.pathParameters)!=null?i:{}});for(let s of o)r.push({name:this.context.getTypeName(s.name.name),value:this.context.dynamicTypeInstantiationMapper.convertToPointerIfPossible(s)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getMethodName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getRootClientFuncInvocation(e){return n.invokeFunc({func:n.typeReference({name:this.context.getClientConstructorName(),importPath:this.context.getClientImportPath()}),arguments_:e})}buildWiremockTestSetup({endpoint:e,errorCase:t}){let r="stub";return[]}callClientMethodAndAssert({endpoint:e,snippet:t}){return n.codeblock(r=>{this.writeMethodInvocation({writer:r,endpoint:e,snippet:t}),r.writeLine(),r.writeLine(),r.write("ok, countErr := "),r.writeNode(n.invokeMethod({on:n.codeblock(w),method:"Verify",arguments_:[n.invokeMethod({on:n.codeblock("stub"),method:"Request",arguments_:[],multiline:!1}),n.codeblock("1")],multiline:!1})),r.writeLine(),r.writeNode(n.invokeFunc({func:n.typeReference({name:"NoError",importPath:"github.com/stretchr/testify/require"}),arguments_:[n.codeblock("t"),n.codeblock("countErr"),n.TypeInstantiation.string("Failed to verify WireMock request was matched")],multiline:!1})),r.writeLine(),r.writeNode(n.invokeFunc({func:n.typeReference({name:"True",importPath:"github.com/stretchr/testify/require"}),arguments_:[n.codeblock("t"),n.codeblock("ok"),n.TypeInstantiation.string("WireMock request was not matched")],multiline:!1})),r.writeLine()})}};export{x as a};
2
+ //# sourceMappingURL=chunk-D6NMQKNQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/EndpointSnippetGenerator.ts"],"sourcesContent":["import { AbstractFormatter, Options, Scope, Severity } from \"@fern-api/browser-compatible-base-generator\";\nimport { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { go } from \"@fern-api/go-ast\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./context/DynamicSnippetsGeneratorContext\";\nimport { FilePropertyInfo } from \"./context/FilePropertyMapper\";\n\nconst SNIPPET_PACKAGE_NAME = \"example\";\nconst SNIPPET_IMPORT_PATH = \"fern\";\nconst SNIPPET_FUNC_NAME = \"do\";\nconst CLIENT_VAR_NAME = \"client\";\nconst TypeInst = go.TypeInstantiation;\nconst WIREMOCK_BASE_URL = \"WireMockBaseURL\";\nconst WIREMOCK_CLIENT_VAR_NAME = \"WireMockClient\";\n\nexport class EndpointSnippetGenerator {\n private context: DynamicSnippetsGeneratorContext;\n private formatter: AbstractFormatter | undefined;\n\n constructor({ context, formatter }: { context: DynamicSnippetsGeneratorContext; formatter?: AbstractFormatter }) {\n this.context = context;\n this.formatter = formatter;\n }\n\n public async generateSnippet({\n endpoint,\n request,\n options\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n options?: Options;\n }): Promise<string> {\n const outputWiremockTests =\n (options?.config as { outputWiremockTests?: boolean })?.outputWiremockTests ?? false;\n if (outputWiremockTests) {\n return this.generateWiremockTest({ endpoint, snippet: request });\n }\n const code = this.buildCodeBlock({ endpoint, snippet: request });\n return await code.toStringAsync({\n packageName: SNIPPET_PACKAGE_NAME,\n importPath: SNIPPET_IMPORT_PATH,\n rootImportPath: this.context.rootImportPath,\n customConfig: this.context.customConfig ?? {},\n formatter: this.formatter\n });\n }\n\n public generateSnippetSync({\n endpoint,\n request,\n options\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n options?: Options;\n }): string {\n const outputWiremockTests =\n (options?.config as { outputWiremockTests?: boolean })?.outputWiremockTests ?? false;\n if (outputWiremockTests) {\n return this.generateWiremockTest({ endpoint, snippet: request });\n }\n const code = this.buildCodeBlock({ endpoint, snippet: request });\n return code.toString({\n packageName: SNIPPET_PACKAGE_NAME,\n importPath: SNIPPET_IMPORT_PATH,\n rootImportPath: this.context.rootImportPath,\n customConfig: this.context.customConfig ?? {},\n formatter: this.formatter\n });\n }\n\n private generateWiremockTest({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): string {\n const code = this.buildWiremockTestCodeBlock({ endpoint, snippet });\n return code.toString({\n packageName: \"wiremock\",\n importPath: SNIPPET_IMPORT_PATH,\n rootImportPath: this.context.rootImportPath,\n customConfig: this.context.customConfig ?? {},\n formatter: this.formatter\n });\n }\n\n private buildCodeBlock({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): go.AstNode {\n return go.codeblock((writer) => {\n writer.writeNode(\n go.func({\n name: SNIPPET_FUNC_NAME,\n parameters: [],\n return_: [],\n body: go.codeblock((writer) => {\n writer.writeNode(this.constructClient({ endpoint, snippet }));\n writer.writeLine();\n writer.writeNode(this.callMethod({ endpoint, snippet }));\n })\n })\n );\n writer.writeNewLineIfLastLineNot();\n });\n }\n\n private buildWiremockTestCodeBlock({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): go.AstNode {\n return go.codeblock((writer) => {\n writer.writeNode(\n go.func({\n name: \"Test\" + this.context.getTestMethodName(endpoint) + \"WithWireMock\",\n parameters: [\n go.parameter({\n name: \"t\",\n type: go.Type.pointer(go.Type.reference(this.context.getTestingTypeReference()))\n })\n ],\n return_: [],\n body: go.codeblock((writer) => {\n for (const node of this.buildWiremockTestSetup({ endpoint })) {\n writer.writeNode(node);\n writer.writeLine();\n }\n writer.writeLine();\n writer.writeNode(this.constructWiremockTestClient({ endpoint, snippet }));\n writer.writeLine();\n writer.writeNode(this.callClientMethodAndAssert({ endpoint, snippet }));\n })\n })\n );\n // Not including error case for now until I can figure out why its not matching the wiremock stub\n // writer.writeLine();\n // writer.writeNode(\n // go.func({\n // name: \"Test\" + this.context.getMethodName(endpoint.declaration.name) + \"Error\" + \"WithWireMock\",\n // parameters: [\n // go.parameter({\n // name: \"t\",\n // type: go.Type.pointer(go.Type.reference(this.context.getTestingTypeReference()))\n // })\n // ],\n // return_: [],\n // body: go.codeblock((writer) => {\n // for (const node of this.buildWiremockTestSetup({ endpoint, errorCase: true })) {\n // writer.writeNode(node);\n // writer.writeLine();\n // }\n // writer.writeLine();\n // writer.writeNode(this.constructWiremockTestClient({ endpoint, snippet }));\n // writer.writeLine();\n // writer.writeNode(this.callClientMethodAndAssert({ endpoint, snippet }));\n // })\n // })\n // );\n writer.writeNewLineIfLastLineNot();\n });\n }\n\n private constructClient({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): go.CodeBlock {\n return go.codeblock((writer) => {\n writer.write(`${CLIENT_VAR_NAME} := `);\n writer.writeNode(this.getRootClientFuncInvocation(this.getConstructorArgs({ endpoint, snippet })));\n });\n }\n\n private constructWiremockTestClient({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): go.CodeBlock {\n return go.codeblock((writer) => {\n writer.write(`${CLIENT_VAR_NAME} := `);\n writer.writeNode(this.getRootClientFuncInvocation(this.getWiremockTestConstructorArgs()));\n });\n }\n\n private writeMethodInvocation({\n writer,\n endpoint,\n snippet\n }: {\n writer: go.Writer;\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): void {\n const { otherArgs, requestArg } = this.getMethodArgs({ endpoint, snippet });\n\n if (requestArg != null) {\n if (requestArg instanceof go.TypeInstantiation && go.TypeInstantiation.isNop(requestArg)) {\n writer.writeNode(\n go.invokeMethod({\n on: go.codeblock(CLIENT_VAR_NAME),\n method: this.getMethod({ endpoint }),\n arguments_: [this.context.getContextTodoFunctionInvocation(), ...otherArgs, go.codeblock(\"nil\")]\n })\n );\n } else {\n writer.write(\"request := \");\n writer.writeNode(requestArg);\n writer.writeLine();\n\n const requestRef = go.codeblock(\"request\");\n writer.writeNode(\n go.invokeMethod({\n on: go.codeblock(CLIENT_VAR_NAME),\n method: this.getMethod({ endpoint }),\n arguments_: [this.context.getContextTodoFunctionInvocation(), ...otherArgs, requestRef]\n })\n );\n }\n } else {\n writer.writeNode(\n go.invokeMethod({\n on: go.codeblock(CLIENT_VAR_NAME),\n method: this.getMethod({ endpoint }),\n arguments_: [this.context.getContextTodoFunctionInvocation(), ...otherArgs]\n })\n );\n }\n }\n\n private callMethod({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): go.CodeBlock {\n return go.codeblock((writer) => {\n this.writeMethodInvocation({ writer, endpoint, snippet });\n });\n }\n\n private getConstructorArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): go.AstNode[] {\n const args: go.AstNode[] = [];\n const baseUrlArg = this.getConstructorBaseUrlArg({\n baseUrl: snippet.baseURL,\n environment: snippet.environment\n });\n if (baseUrlArg != null) {\n args.push(baseUrlArg);\n }\n if (endpoint.auth != null) {\n if (snippet.auth != null) {\n args.push(this.getConstructorAuthArg({ auth: endpoint.auth, values: snippet.auth }));\n } else {\n this.context.errors.add({\n severity: Severity.Warning,\n message: `Auth with ${endpoint.auth.type} configuration is required for this endpoint`\n });\n }\n }\n this.context.errors.scope(Scope.Headers);\n if (this.context.ir.headers != null && snippet.headers != null) {\n args.push(...this.getConstructorHeaderArgs({ headers: this.context.ir.headers, values: snippet.headers }));\n }\n this.context.errors.unscope();\n return args;\n }\n\n private getWiremockTestConstructorArgs(): go.AstNode[] {\n return [\n go.codeblock((writer) => {\n writer.writeNode(\n go.invokeFunc({\n func: go.typeReference({\n name: \"WithBaseURL\",\n importPath: this.context.getOptionImportPath()\n }),\n arguments_: [go.codeblock(WIREMOCK_BASE_URL)]\n })\n );\n })\n ];\n }\n\n private getConstructorAuthArg({\n auth,\n values\n }: {\n auth: FernIr.dynamic.Auth;\n values: FernIr.dynamic.AuthValues;\n }): go.AstNode {\n if (values.type !== auth.type) {\n this.addError(this.context.newAuthMismatchError({ auth, values }).message);\n return TypeInst.nop();\n }\n switch (auth.type) {\n case \"basic\":\n return values.type === \"basic\" ? this.getConstructorBasicAuthArg({ auth, values }) : TypeInst.nop();\n case \"bearer\":\n return values.type === \"bearer\" ? this.getConstructorBearerAuthArg({ auth, values }) : TypeInst.nop();\n case \"header\":\n return values.type === \"header\" ? this.getConstructorHeaderAuthArg({ auth, values }) : TypeInst.nop();\n case \"oauth\":\n this.addWarning(\"The Go SDK doesn't support OAuth client credentials yet\");\n return TypeInst.nop();\n case \"inferred\":\n this.addWarning(\"The Go SDK Generator does not support Inferred auth scheme yet\");\n return TypeInst.nop();\n default:\n assertNever(auth);\n }\n }\n\n private addError(message: string): void {\n this.context.errors.add({ severity: Severity.Critical, message });\n }\n\n private addWarning(message: string): void {\n this.context.errors.add({ severity: Severity.Warning, message });\n }\n\n private getConstructorBasicAuthArg({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BasicAuth;\n values: FernIr.dynamic.BasicAuthValues;\n }): go.AstNode {\n return go.codeblock((writer) => {\n writer.writeNode(\n go.invokeFunc({\n func: go.typeReference({\n name: \"WithBasicAuth\",\n importPath: this.context.getOptionImportPath()\n }),\n arguments_: [\n go.TypeInstantiation.string(values.username),\n go.TypeInstantiation.string(values.password)\n ]\n })\n );\n });\n }\n\n private getConstructorBaseUrlArg({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): go.AstNode | undefined {\n const baseUrlArg = this.getBaseUrlArg({ baseUrl, environment });\n if (baseUrlArg == null) {\n return undefined;\n }\n return go.codeblock((writer) => {\n writer.writeNode(\n go.invokeFunc({\n func: go.typeReference({\n name: \"WithBaseURL\",\n importPath: this.context.getOptionImportPath()\n }),\n arguments_: [baseUrlArg]\n })\n );\n });\n }\n\n private getBaseUrlArg({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): go.AstNode | undefined {\n if (baseUrl != null && environment != null) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: \"Cannot specify both baseUrl and environment options\"\n });\n return undefined;\n }\n if (baseUrl != null) {\n return go.TypeInstantiation.string(baseUrl);\n }\n if (environment != null) {\n if (this.context.isSingleEnvironmentID(environment)) {\n const typeReference = this.context.getEnvironmentTypeReferenceFromID(environment);\n if (typeReference == null) {\n this.context.errors.add({\n severity: Severity.Warning,\n message: `Environment ${JSON.stringify(environment)} was not found`\n });\n return undefined;\n }\n return go.TypeInstantiation.reference(typeReference);\n }\n if (this.context.isMultiEnvironmentValues(environment)) {\n this.context.errors.add({\n severity: Severity.Warning,\n message:\n \"The Go SDK doesn't support a multi-environment client option yet; use the baseUrl option instead\"\n });\n }\n }\n return undefined;\n }\n\n private getConstructorBearerAuthArg({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BearerAuth;\n values: FernIr.dynamic.BearerAuthValues;\n }): go.AstNode {\n return go.codeblock((writer) => {\n writer.writeNode(\n go.invokeFunc({\n func: go.typeReference({\n name: `With${auth.token.pascalCase.unsafeName}`,\n importPath: this.context.getOptionImportPath()\n }),\n arguments_: [go.TypeInstantiation.string(values.token)]\n })\n );\n });\n }\n\n private getConstructorHeaderAuthArg({\n auth,\n values\n }: {\n auth: FernIr.dynamic.HeaderAuth;\n values: FernIr.dynamic.HeaderAuthValues;\n }): go.AstNode {\n return go.codeblock((writer) => {\n writer.writeNode(\n go.invokeFunc({\n func: go.typeReference({\n name: `With${auth.header.name.name.pascalCase.unsafeName}`,\n importPath: this.context.getOptionImportPath()\n }),\n arguments_: [\n this.context.dynamicTypeInstantiationMapper.convert({\n typeReference: auth.header.typeReference,\n value: values.value\n })\n ]\n })\n );\n });\n }\n\n private getConstructorHeaderArgs({\n headers,\n values\n }: {\n headers: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): go.AstNode[] {\n const args: go.AstNode[] = [];\n for (const header of headers) {\n const arg = this.getConstructorHeaderArg({ header, value: values.value });\n if (arg != null) {\n args.push(arg);\n }\n }\n return args;\n }\n\n private getConstructorHeaderArg({\n header,\n value\n }: {\n header: FernIr.dynamic.NamedParameter;\n value: unknown;\n }): go.AstNode | undefined {\n const typeInstantiation = this.context.dynamicTypeInstantiationMapper.convert({\n typeReference: header.typeReference,\n value\n });\n if (go.TypeInstantiation.isNop(typeInstantiation)) {\n // Literal header values (e.g. \"X-API-Version\") should not be included in the\n // client constructor.\n return undefined;\n }\n return go.codeblock((writer) => {\n writer.writeNode(\n go.invokeFunc({\n func: go.typeReference({\n name: `With${header.name.name.pascalCase.unsafeName}`,\n importPath: this.context.getOptionImportPath()\n }),\n arguments_: [typeInstantiation]\n })\n );\n });\n }\n\n private getMethodArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): { otherArgs: go.AstNode[]; requestArg: go.AstNode | undefined } {\n switch (endpoint.request.type) {\n case \"inlined\":\n return this.getMethodArgsForInlinedRequest({ request: endpoint.request, snippet });\n case \"body\":\n return this.getMethodArgsForBodyRequest({ request: endpoint.request, snippet });\n default:\n assertNever(endpoint.request);\n }\n }\n\n private getMethodArgsForBodyRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.BodyRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): { otherArgs: go.AstNode[]; requestArg: go.AstNode | undefined } {\n const otherArgs: go.AstNode[] = [];\n\n this.context.errors.scope(Scope.PathParameters);\n const pathParameters = [...(this.context.ir.pathParameters ?? []), ...(request.pathParameters ?? [])];\n if (pathParameters.length > 0) {\n otherArgs.push(\n ...this.getPathParameters({ namedParameters: pathParameters, snippet }).map((field) => field.value)\n );\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n const requestArg: go.AstNode | undefined =\n request.body != null\n ? this.getBodyRequestArg({ body: request.body, value: snippet.requestBody })\n : undefined;\n this.context.errors.unscope();\n\n return { otherArgs, requestArg };\n }\n\n private getBodyRequestArg({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBodyType;\n value: unknown;\n }): go.TypeInstantiation {\n switch (body.type) {\n case \"bytes\": {\n return this.getBytesBodyRequestArg({ value });\n }\n case \"typeReference\":\n return this.context.dynamicTypeInstantiationMapper.convert({ typeReference: body.value, value });\n default:\n assertNever(body);\n }\n }\n\n private getBytesBodyRequestArg({ value }: { value: unknown }): go.TypeInstantiation {\n if (typeof value !== \"string\") {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected bytes value to be a string, got ${typeof value}`\n });\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.bytes(value as string);\n }\n\n private getMethodArgsForInlinedRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): { otherArgs: go.AstNode[]; requestArg: go.AstNode | undefined } {\n const otherArgs: go.AstNode[] = [];\n\n const { inlinePathParameters, inlineFileProperties } = {\n inlinePathParameters: this.context.customConfig?.inlinePathParameters ?? true,\n inlineFileProperties: this.context.customConfig?.inlineFileProperties ?? true\n };\n\n this.context.errors.scope(Scope.PathParameters);\n const pathParameterFields: go.StructField[] = [];\n const pathParameters = [...(this.context.ir.pathParameters ?? []), ...(request.pathParameters ?? [])];\n if (pathParameters.length > 0) {\n pathParameterFields.push(\n ...this.getPathParameters({\n namedParameters: pathParameters,\n snippet\n })\n );\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n const filePropertyInfo = this.getFilePropertyInfo({ request, snippet });\n this.context.errors.unscope();\n\n if (!this.context.includePathParametersInWrappedRequest({ request, inlinePathParameters })) {\n otherArgs.push(...pathParameterFields.map((field) => field.value));\n }\n\n if (!inlineFileProperties) {\n otherArgs.push(...filePropertyInfo.fileFields.map((field) => field.value));\n }\n\n const requestArg: go.AstNode | undefined = this.context.needsRequestParameter({\n request,\n inlinePathParameters,\n inlineFileProperties\n })\n ? this.getInlinedRequestArg({\n request,\n snippet,\n pathParameterFields: this.context.includePathParametersInWrappedRequest({\n request,\n inlinePathParameters\n })\n ? pathParameterFields\n : [],\n filePropertyInfo\n })\n : undefined;\n return { otherArgs, requestArg };\n }\n\n private getFilePropertyInfo({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): FilePropertyInfo {\n if (request.body == null || !this.context.isFileUploadRequestBody(request.body)) {\n return {\n fileFields: [],\n bodyPropertyFields: []\n };\n }\n return this.context.filePropertyMapper.getFilePropertyInfo({\n body: request.body,\n value: snippet.requestBody\n });\n }\n\n private getInlinedRequestArg({\n request,\n snippet,\n pathParameterFields,\n filePropertyInfo\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n pathParameterFields: go.StructField[];\n filePropertyInfo: FilePropertyInfo;\n }): go.TypeInstantiation {\n this.context.errors.scope(Scope.QueryParameters);\n const queryParameters = this.context.associateQueryParametersByWireValue({\n parameters: request.queryParameters ?? [],\n values: snippet.queryParameters ?? {}\n });\n const queryParameterFields = queryParameters.map((queryParameter) => ({\n name: queryParameter.name.name.pascalCase.unsafeName,\n value: this.context.dynamicTypeInstantiationMapper.convert(queryParameter)\n }));\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.Headers);\n const headers = this.context.associateByWireValue({\n parameters: request.headers ?? [],\n values: snippet.headers ?? {}\n });\n const headerFields = headers.map((header) => ({\n name: header.name.name.pascalCase.unsafeName,\n value: this.context.dynamicTypeInstantiationMapper.convert(header)\n }));\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n const requestBodyFields =\n request.body != null\n ? this.getInlinedRequestBodyStructFields({\n body: request.body,\n value: snippet.requestBody,\n filePropertyInfo\n })\n : [];\n this.context.errors.unscope();\n\n return go.TypeInstantiation.structPointer({\n typeReference: go.typeReference({\n name: this.context.getMethodName(request.declaration.name),\n importPath: this.context.getImportPathForRequest(request.declaration.fernFilepath)\n }),\n fields: [...pathParameterFields, ...queryParameterFields, ...headerFields, ...requestBodyFields]\n });\n }\n\n private getInlinedRequestBodyStructFields({\n body,\n value,\n filePropertyInfo\n }: {\n body: FernIr.dynamic.InlinedRequestBody;\n value: unknown;\n filePropertyInfo: FilePropertyInfo;\n }): go.StructField[] {\n switch (body.type) {\n case \"properties\":\n return this.getInlinedRequestBodyPropertyStructFields({ parameters: body.value, value });\n case \"referenced\":\n return [this.getReferencedRequestBodyPropertyStructField({ body, value })];\n case \"fileUpload\":\n return this.getFileUploadRequestBodyStructFields({ filePropertyInfo });\n default:\n assertNever(body);\n }\n }\n\n private getFileUploadRequestBodyStructFields({\n filePropertyInfo\n }: {\n filePropertyInfo: FilePropertyInfo;\n }): go.StructField[] {\n if (this.context.customConfig?.inlineFileProperties) {\n return [...filePropertyInfo.fileFields, ...filePropertyInfo.bodyPropertyFields];\n }\n return filePropertyInfo.bodyPropertyFields;\n }\n\n private getReferencedRequestBodyPropertyStructField({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBody;\n value: unknown;\n }): go.StructField {\n return {\n name: this.context.getTypeName(body.bodyKey),\n value: this.getReferencedRequestBodyPropertyTypeInstantiation({ body: body.bodyType, value })\n };\n }\n\n private getReferencedRequestBodyPropertyTypeInstantiation({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBodyType;\n value: unknown;\n }): go.TypeInstantiation {\n switch (body.type) {\n case \"bytes\":\n return this.getBytesBodyRequestArg({ value });\n case \"typeReference\":\n return this.context.dynamicTypeInstantiationMapper.convert({ typeReference: body.value, value });\n default:\n assertNever(body);\n }\n }\n\n private getInlinedRequestBodyPropertyStructFields({\n parameters,\n value\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n value: unknown;\n }): go.StructField[] {\n const fields: go.StructField[] = [];\n\n const bodyProperties = this.context.associateByWireValue({\n parameters,\n values: this.context.getRecord(value) ?? {}\n });\n for (const parameter of bodyProperties) {\n fields.push({\n name: this.context.getTypeName(parameter.name.name),\n value: this.context.dynamicTypeInstantiationMapper.convert(parameter)\n });\n }\n\n return fields;\n }\n\n private getPathParameters({\n namedParameters,\n snippet\n }: {\n namedParameters: FernIr.dynamic.NamedParameter[];\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): go.StructField[] {\n const args: go.StructField[] = [];\n\n const pathParameters = this.context.associateByWireValue({\n parameters: namedParameters,\n values: snippet.pathParameters ?? {}\n });\n for (const parameter of pathParameters) {\n args.push({\n name: this.context.getTypeName(parameter.name.name),\n value: this.context.dynamicTypeInstantiationMapper.convertToPointerIfPossible(parameter)\n });\n }\n\n return args;\n }\n\n private getMethod({ endpoint }: { endpoint: FernIr.dynamic.Endpoint }): string {\n if (endpoint.declaration.fernFilepath.allParts.length > 0) {\n return `${endpoint.declaration.fernFilepath.allParts\n .map((val) => this.context.getMethodName(val))\n .join(\".\")}.${this.context.getMethodName(endpoint.declaration.name)}`;\n }\n return this.context.getMethodName(endpoint.declaration.name);\n }\n\n private getRootClientFuncInvocation(arguments_: go.AstNode[]): go.FuncInvocation {\n return go.invokeFunc({\n func: go.typeReference({\n name: this.context.getClientConstructorName(),\n importPath: this.context.getClientImportPath()\n }),\n arguments_\n });\n }\n\n private buildWiremockTestSetup({\n endpoint,\n errorCase\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n errorCase?: boolean;\n }): go.AstNode[] {\n const ENDPOINT_STUB_NAME = \"stub\";\n const usedSharedMainTest = true;\n return [\n ...(!usedSharedMainTest\n ? [\n // Initialize context\n go.codeblock((writer) => {\n writer.write(\"ctx := \");\n writer.writeNode(\n go.invokeFunc({\n func: go.typeReference({\n name: \"Background\",\n importPath: \"context\"\n }),\n arguments_: [],\n multiline: false\n })\n );\n }),\n\n // Start WireMock container\n go.codeblock((writer) => {\n writer.write(`container, containerErr := `);\n writer.writeNode(\n go.invokeFunc({\n func: go.typeReference({\n name: \"RunContainerAndStopOnCleanup\",\n importPath: \"github.com/wiremock/wiremock-testcontainers-go\"\n }),\n arguments_: [\n go.codeblock(\"ctx\"),\n go.codeblock(\"t\"),\n go.invokeFunc({\n func: go.typeReference({\n name: \"WithImage\",\n importPath: \"github.com/wiremock/wiremock-testcontainers-go\"\n }),\n arguments_: [\n go.TypeInstantiation.string(\"docker.io/wiremock/wiremock:3.9.1\")\n ],\n multiline: false\n })\n ],\n multiline: true\n })\n );\n }),\n\n // Check for container error\n go.codeblock((writer) => {\n writer.write(\"if containerErr != nil {\");\n writer.writeLine();\n writer.write(\" t.Fatal(containerErr)\");\n writer.writeLine();\n writer.write(\"}\");\n }),\n\n // Get WireMock URL from container\n go.codeblock((writer) => {\n writer.write(`${WIREMOCK_BASE_URL}, endpointErr := `);\n writer.writeNode(\n go.invokeMethod({\n on: go.codeblock(\"container\"),\n method: \"Endpoint\",\n arguments_: [go.codeblock(\"ctx\"), go.TypeInstantiation.string(\"\")],\n multiline: false\n })\n );\n }),\n\n go.invokeFunc({\n func: go.typeReference({\n name: \"NoError\",\n importPath: \"github.com/stretchr/testify/require\"\n }),\n arguments_: [\n go.codeblock(\"t\"),\n go.codeblock(\"endpointErr\"),\n go.TypeInstantiation.string(\"Failed to get WireMock container endpoint\")\n ],\n multiline: false\n }),\n\n go.codeblock((writer) => {\n writer.write(`${WIREMOCK_BASE_URL} = \"http://\" + ${WIREMOCK_BASE_URL}`);\n }),\n\n // Get WireMock client from container\n go.codeblock((writer) => {\n writer.write(`${WIREMOCK_CLIENT_VAR_NAME} := `);\n writer.writeNode(\n go.selector({\n on: go.codeblock(\"container\"),\n selector: go.codeblock(\"Client\")\n })\n );\n })\n ]\n : [])\n ];\n }\n\n private callClientMethodAndAssert({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): go.CodeBlock {\n return go.codeblock((writer) => {\n // IMPORTANT: currently not capturing the response/error values since its not trivial to determine\n // the number of return values for the method using the dynamic ir\n\n // Call the method and capture response and error\n // writer.write(\"_, invocationErr := \");\n this.writeMethodInvocation({ writer, endpoint, snippet });\n writer.writeLine();\n writer.writeLine();\n\n // Verify WireMock request was matched\n writer.write(\"ok, countErr := \");\n writer.writeNode(\n go.invokeMethod({\n on: go.codeblock(WIREMOCK_CLIENT_VAR_NAME),\n method: \"Verify\",\n arguments_: [\n go.invokeMethod({\n on: go.codeblock(\"stub\"),\n method: \"Request\",\n arguments_: [],\n multiline: false\n }),\n go.codeblock(\"1\")\n ],\n multiline: false\n })\n );\n writer.writeLine();\n\n writer.writeNode(\n go.invokeFunc({\n func: go.typeReference({\n name: \"NoError\",\n importPath: \"github.com/stretchr/testify/require\"\n }),\n arguments_: [\n go.codeblock(\"t\"),\n go.codeblock(\"countErr\"),\n go.TypeInstantiation.string(\"Failed to verify WireMock request was matched\")\n ],\n multiline: false\n })\n );\n writer.writeLine();\n\n writer.writeNode(\n go.invokeFunc({\n func: go.typeReference({\n name: \"True\",\n importPath: \"github.com/stretchr/testify/require\"\n }),\n arguments_: [\n go.codeblock(\"t\"),\n go.codeblock(\"ok\"),\n go.TypeInstantiation.string(\"WireMock request was not matched\")\n ],\n multiline: false\n })\n );\n writer.writeLine();\n\n // IMPORTANT: currently not asserting that the call succeeded since its not trivial to determine\n // the number of return values for the method using the dynamic ir\n\n // Verify the call succeeded (may not assert this at all and only assert the WireMock request was matched)\n // Since we don't necessarily have valid response bodies in our WireMock stubs (so type casting will fail)\n // writer.writeNode(\n // go.invokeFunc({\n // func: go.typeReference({\n // name: \"NoError\",\n // importPath: \"github.com/stretchr/testify/require\"\n // }),\n // arguments_: [\n // go.codeblock(\"t\"),\n // go.codeblock(\"invocationErr\"),\n // go.TypeInstantiation.string(`${this.getMethod({ endpoint })} call should succeed with WireMock`)\n // ],\n // multiline: false\n // })\n // );\n // writer.writeLine();\n });\n }\n}\n"],"mappings":"8GAAAA,IAAAC,IAQA,IAAMC,EAAuB,UACvBC,EAAsB,OACtBC,EAAoB,KACpBC,EAAkB,SAClBC,EAAWC,EAAG,kBACdC,EAAoB,kBACpBC,EAA2B,iBAEpBC,EAAN,KAA+B,CAIlC,YAAY,CAAE,QAAAC,EAAS,UAAAC,CAAU,EAAgF,CAHjHC,EAAA,KAAQ,WACRA,EAAA,KAAQ,aAGJ,KAAK,QAAUF,EACf,KAAK,UAAYC,CACrB,CAEA,MAAa,gBAAgB,CACzB,SAAAE,EACA,QAAAC,EACA,QAAAC,CACJ,EAIoB,CAjCxB,IAAAC,EAAAC,EAAAC,EAoCQ,QADKD,GAAAD,EAAAD,GAAA,YAAAA,EAAS,SAAT,YAAAC,EAAuD,sBAAvD,KAAAC,EAA8E,IAExE,KAAK,qBAAq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AG,cAAc,CACnB,KAAM,UACN,WAAY,qCAChB,CAAC,EACD,WAAY,CACRA,EAAG,UAAU,GAAG,EAChBA,EAAG,UAAU,UAAU,EACvBA,EAAG,kBAAkB,OAAO,+CAA+C,CAC/E,EACA,UAAW,EACf,CAAC,CACL,EACAc,EAAO,UAAU,EAEjBA,EAAO,UACHd,EAAG,WAAW,CACV,KAAMA,EAAG,cAAc,CACnB,KAAM,OACN,WAAY,qCAChB,CAAC,EACD,WAAY,CACRA,EAAG,UAAU,GAAG,EAChBA,EAAG,UAAU,IAAI,EACjBA,EAAG,kBAAkB,OAAO,kCAAkC,CAClE,EACA,UAAW,EACf,CAAC,CACL,EACAc,EAAO,UAAU,CAsBrB,CAAC,CACL,CACJ","names":["init_process","init_buffer","SNIPPET_PACKAGE_NAME","SNIPPET_IMPORT_PATH","SNIPPET_FUNC_NAME","CLIENT_VAR_NAME","TypeInst","go_exports","WIREMOCK_BASE_URL","WIREMOCK_CLIENT_VAR_NAME","EndpointSnippetGenerator","context","formatter","__publicField","endpoint","request","options","_a","_b","_c","snippet","writer","node","otherArgs","requestArg","requestRef","args","baseUrlArg","Severity","Scope","auth","values","assertNever","message","baseUrl","environment","typeReference","headers","header","arg","value","typeInstantiation","pathParameters","field","body","_d","_e","_f","inlinePathParameters","inlineFileProperties","pathParameterFields","filePropertyInfo","queryParameterFields","queryParameter","headerFields","requestBodyFields","parameters","fields","bodyProperties","parameter","namedParameters","val","arguments_","errorCase","ENDPOINT_STUB_NAME"]}
@@ -0,0 +1,2 @@
1
+ import{b as c}from"./chunk-VCNL2JWU.js";import{e as p,f as l,g as d,h as s,j as i}from"./chunk-GUJUKQKZ.js";l();d();var y=class{constructor({context:e}){p(this,"context");this.context=e}convert(e){if(e.value===null&&!this.context.isNullable(e.typeReference)&&this.context.errors.add({severity:c.Critical,message:"Expected non-null value, but got null"}),e.value==null)return i.TypeInstantiation.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value});case"literal":return i.TypeInstantiation.nop();case"map":return this.convertMap({map:e.typeReference,value:e.value});case"named":{let n=this.context.resolveNamedType({typeId:e.typeReference.value});return n==null?i.TypeInstantiation.nop():this.convertNamed({named:n,value:e.value,as:e.as})}case"nullable":return i.TypeInstantiation.optional(this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as}));case"optional":return i.TypeInstantiation.optional(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});case"set":return this.convertList({list:e.typeReference.value,value:e.value});case"unknown":return this.convertUnknown({value:e.value});default:s(e.typeReference)}}convertToPointerIfPossible(e){let n=this.convert(e);switch(e.typeReference.type){case"named":{let r=this.context.resolveNamedType({typeId:e.typeReference.value});return(r==null?void 0:r.type)==="enum"?i.TypeInstantiation.reference(i.invokeMethod({on:n,method:"Ptr",arguments_:[]})):n}default:return n}}convertList({list:e,value:n}){return Array.isArray(n)?i.TypeInstantiation.slice({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:n.map((r,t)=>{this.context.errors.scope({index:t});try{return this.convert({typeReference:e,value:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:c.Critical,message:`Expected array but got: ${typeof n}`}),i.TypeInstantiation.nop())}convertMap({map:e,value:n}){return typeof n!="object"||n==null?(this.context.errors.add({severity:c.Critical,message:`Expected object but got: ${n==null?"null":typeof n}`}),i.TypeInstantiation.nop()):i.TypeInstantiation.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(n).map(([r,t])=>{this.context.errors.scope(r);try{return{key:this.convert({typeReference:e.key,value:r,as:"key"}),value:this.convert({typeReference:e.value,value:t})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:n,as:r}){switch(e.type){case"alias":return this.convertAlias({aliasType:e,value:n,as:r});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:n});case"enum":return this.convertEnum({enum_:e,value:n});case"object":return this.convertObject({object_:e,value:n});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:n});default:s(e)}}convertAlias({aliasType:e,value:n,as:r}){switch(e.typeReference.type){case"literal":return i.TypeInstantiation.reference(i.invokeFunc({func:i.typeReference({name:this.context.getTypeName(e.declaration.name),importPath:this.context.getImportPath(e.declaration.fernFilepath)}),arguments_:[this.convertLiteralValue(e.typeReference.value)]}));default:return this.convert({typeReference:e.typeReference,value:n,as:r})}}convertLiteralValue(e){switch(e.type){case"boolean":return i.TypeInstantiation.bool(e.value);case"string":return i.TypeInstantiation.string(e.value);default:s(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:n}){let r=this.context.getGoTypeReferenceFromDeclaration({declaration:e.declaration}),t=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:n});if(t==null)return i.TypeInstantiation.nop();let a=t.singleDiscriminatedUnionType,o=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:a});switch(a.type){case"samePropertiesAsObject":{let u=this.context.resolveNamedType({typeId:a.typeId});return u==null?i.TypeInstantiation.nop():i.TypeInstantiation.structPointer({typeReference:r,fields:[{name:this.context.getTypeName(a.discriminantValue.name),value:this.convertNamed({named:u,value:t.value})},...o]})}case"singleProperty":{let u=this.context.getRecord(t.value);if(u==null)return i.TypeInstantiation.nop();try{return this.context.errors.scope(a.discriminantValue.wireValue),i.TypeInstantiation.structPointer({typeReference:r,fields:[{name:this.context.getTypeName(a.discriminantValue.name),value:this.convert({typeReference:a.typeReference,value:u[a.discriminantValue.wireValue]})},...o]})}finally{this.context.errors.unscope()}}case"noProperties":return i.TypeInstantiation.structPointer({typeReference:r,fields:[{name:this.context.getTypeName(t.discriminantValue.name),value:i.TypeInstantiation.string(a.discriminantValue.wireValue)},...o]});default:s(a)}}getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:n}){var t,a;return this.context.associateByWireValue({parameters:(t=n.properties)!=null?t:[],values:(a=this.context.getRecord(e.value))!=null?a:{},ignoreMissingParameters:!0}).map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getTypeName(o.name.name),value:this.convert(o)}}finally{this.context.errors.unscope()}})}convertObject({object_:e,value:n}){var t;let r=this.context.associateByWireValue({parameters:e.properties,values:(t=this.context.getRecord(n))!=null?t:{}});return i.TypeInstantiation.structPointer({typeReference:i.typeReference({name:this.context.getTypeName(e.declaration.name),importPath:this.context.getImportPath(e.declaration.fernFilepath)}),fields:r.map(a=>{this.context.errors.scope(a.name.wireValue);try{return{name:this.context.getTypeName(a.name.name),value:this.convert(a)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:e,value:n}){let r=this.getEnumValueName({enum_:e,value:n});return r==null?i.TypeInstantiation.nop():i.TypeInstantiation.enum(i.typeReference({name:r,importPath:this.context.getImportPath(e.declaration.fernFilepath)}))}getEnumValueName({enum_:e,value:n}){if(typeof n!="string"){this.context.errors.add({severity:c.Critical,message:`Expected enum value string, got: ${typeof n}`});return}let r=e.values.find(t=>t.wireValue===n);if(r==null){this.context.errors.add({severity:c.Critical,message:`An enum value named "${n}" does not exist in this context`});return}return`${this.context.getTypeName(e.declaration.name)}${this.context.getTypeName(r.name)}`}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:n}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:n});if(r==null)return i.TypeInstantiation.nop();let t=this.getUndiscriminatedUnionFieldName({typeReference:r.valueTypeReference});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.structPointer({typeReference:this.context.getGoTypeReferenceFromDeclaration({declaration:e.declaration}),fields:[{name:t,value:r.typeInstantiation}]})}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:n}){for(let r of e.types)try{let t=this.convert({typeReference:r,value:n});return{valueTypeReference:r,typeInstantiation:t}}catch(t){continue}this.context.errors.add({severity:c.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof n}" value`})}getUndiscriminatedUnionFieldName({typeReference:e}){switch(e.type){case"list":return this.getUndiscriminatedUnionFieldNameForList({list:e});case"literal":return this.getUndiscriminatedUnionFieldNameForLiteral({literal:e.value});case"map":return this.getUndiscriminatedUnionFieldNameForMap({map:e});case"named":{let n=this.context.resolveNamedType({typeId:e.value});return n==null?void 0:this.context.getTypeName(n.declaration.name)}case"optional":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"nullable":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"primitive":return this.getUndiscriminatedUnionFieldNameForPrimitive({primitive:e.value});case"set":return this.getUndiscriminatedUnionFieldNameForSet({set:e});case"unknown":return"Unknown";default:s(e)}}getUndiscriminatedUnionFieldNameForList({list:e}){let n=this.getUndiscriminatedUnionFieldName({typeReference:e});if(n!=null)return`${n}List`}getUndiscriminatedUnionFieldNameForMap({map:e}){let n=this.getUndiscriminatedUnionFieldName({typeReference:e.key});if(n==null)return;let r=this.getUndiscriminatedUnionFieldName({typeReference:e.value});if(r!=null)return`${n}${r}Map`}getUndiscriminatedUnionFieldNameForOptional({typeReference:e}){let n=this.getUndiscriminatedUnionFieldName({typeReference:e});if(n!=null)return`${n}Optional`}getUndiscriminatedUnionFieldNameForSet({set:e}){let n=this.getUndiscriminatedUnionFieldName({typeReference:e});if(n!=null)return`${n}Set`}getUndiscriminatedUnionFieldNameForLiteral({literal:e}){switch(e.type){case"boolean":return e.value?"TrueLiteral":"FalseLiteral";case"string":return`${e.value}StringLiteral`;default:s(e)}}getUndiscriminatedUnionFieldNameForPrimitive({primitive:e}){switch(e){case"INTEGER":case"UINT":return"Integer";case"LONG":case"UINT_64":return"Long";case"FLOAT":case"DOUBLE":return"Double";case"BOOLEAN":return"Boolean";case"BIG_INTEGER":case"STRING":return"String";case"UUID":return"Uuid";case"DATE":return"Date";case"DATE_TIME":return"DateTime";case"BASE_64":return"Base64";default:s(e)}}convertUnknown({value:e}){return i.TypeInstantiation.any(e)}convertPrimitive({primitive:e,value:n,as:r}){switch(e){case"INTEGER":case"UINT":{let t=this.getValueAsNumber({value:n,as:r});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.int(t)}case"LONG":case"UINT_64":{let t=this.getValueAsNumber({value:n,as:r});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.int64(t)}case"FLOAT":case"DOUBLE":{let t=this.getValueAsNumber({value:n,as:r});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.float64(t)}case"BOOLEAN":{let t=this.getValueAsBoolean({value:n,as:r});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.bool(t)}case"STRING":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.string(t)}case"DATE":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.date(t)}case"DATE_TIME":{let t=this.context.getValueAsString({value:n});if(t==null)return i.TypeInstantiation.nop();let a=this.normalizeDateTimeString(t);return i.TypeInstantiation.dateTime(a)}case"UUID":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.uuid(t)}case"BASE_64":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.bytes(t)}case"BIG_INTEGER":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.string(t)}default:s(e)}}getValueAsNumber({value:e,as:n}){let r=n==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:e,as:n}){let r=n==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:r})}normalizeDateTimeString(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e}T00:00:00Z`:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(e)?`${e}Z`:e}};export{y as a};
2
+ //# sourceMappingURL=chunk-FD44EP2P.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/DynamicTypeInstantiationMapper.ts"],"sourcesContent":["import { DiscriminatedUnionTypeInstance, Severity } from \"@fern-api/browser-compatible-base-generator\";\nimport { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { go } from \"@fern-api/go-ast\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./DynamicSnippetsGeneratorContext\";\n\nexport declare namespace DynamicTypeInstantiationMapper {\n interface Args {\n typeReference: FernIr.dynamic.TypeReference;\n value: unknown;\n as?: ConvertedAs;\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 DynamicTypeInstantiationMapper {\n private context: DynamicSnippetsGeneratorContext;\n\n constructor({ context }: { context: DynamicSnippetsGeneratorContext }) {\n this.context = context;\n }\n\n public convert(args: DynamicTypeInstantiationMapper.Args): go.TypeInstantiation {\n // eslint-disable-next-line eqeqeq\n if (args.value === null && !this.context.isNullable(args.typeReference)) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: \"Expected non-null value, but got null\"\n });\n }\n if (args.value == null) {\n return go.TypeInstantiation.nop();\n }\n switch (args.typeReference.type) {\n case \"list\":\n return this.convertList({ list: args.typeReference.value, value: args.value });\n case \"literal\":\n return go.TypeInstantiation.nop();\n case \"map\":\n return this.convertMap({ map: args.typeReference, value: args.value });\n case \"named\": {\n const named = this.context.resolveNamedType({ typeId: args.typeReference.value });\n if (named == null) {\n return go.TypeInstantiation.nop();\n }\n return this.convertNamed({ named, value: args.value, as: args.as });\n }\n case \"nullable\":\n return go.TypeInstantiation.optional(\n this.convert({ typeReference: args.typeReference.value, value: args.value, as: args.as })\n );\n case \"optional\":\n return go.TypeInstantiation.optional(\n this.convert({ typeReference: args.typeReference.value, value: args.value, as: args.as })\n );\n case \"primitive\":\n return this.convertPrimitive({ primitive: args.typeReference.value, value: args.value, as: args.as });\n case \"set\":\n return this.convertList({ list: args.typeReference.value, value: args.value });\n case \"unknown\":\n return this.convertUnknown({ value: args.value });\n default:\n assertNever(args.typeReference);\n }\n }\n\n public convertToPointerIfPossible(args: DynamicTypeInstantiationMapper.Args): go.TypeInstantiation {\n const converted = this.convert(args);\n switch (args.typeReference.type) {\n case \"named\": {\n const named = this.context.resolveNamedType({ typeId: args.typeReference.value });\n if (named?.type === \"enum\") {\n return go.TypeInstantiation.reference(\n go.invokeMethod({\n on: converted,\n method: \"Ptr\",\n arguments_: []\n })\n );\n }\n return converted;\n }\n default:\n return converted;\n }\n }\n\n private convertList({ list, value }: { list: FernIr.dynamic.TypeReference; value: unknown }): go.TypeInstantiation {\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 go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.slice({\n valueType: this.context.dynamicTypeMapper.convert({ typeReference: list }),\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 convertMap({ map, value }: { map: FernIr.dynamic.MapType; value: unknown }): go.TypeInstantiation {\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 go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.map({\n keyType: this.context.dynamicTypeMapper.convert({ typeReference: map.key }),\n valueType: 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 }: {\n named: FernIr.dynamic.NamedType;\n value: unknown;\n as?: DynamicTypeInstantiationMapper.ConvertedAs;\n }): go.TypeInstantiation {\n switch (named.type) {\n case \"alias\":\n return this.convertAlias({\n aliasType: named,\n value,\n as\n });\n case \"discriminatedUnion\":\n return this.convertDiscriminatedUnion({\n discriminatedUnion: named,\n value\n });\n case \"enum\":\n return this.convertEnum({ enum_: named, value });\n case \"object\":\n return this.convertObject({ object_: named, value });\n case \"undiscriminatedUnion\":\n return this.convertUndiscriminatedUnion({ undiscriminatedUnion: named, value });\n default:\n assertNever(named);\n }\n }\n\n private convertAlias({\n aliasType,\n value,\n as\n }: {\n aliasType: FernIr.dynamic.NamedType.Alias;\n value: unknown;\n as?: DynamicTypeInstantiationMapper.ConvertedAs;\n }): go.TypeInstantiation {\n switch (aliasType.typeReference.type) {\n case \"literal\":\n return go.TypeInstantiation.reference(\n go.invokeFunc({\n func: go.typeReference({\n name: this.context.getTypeName(aliasType.declaration.name),\n importPath: this.context.getImportPath(aliasType.declaration.fernFilepath)\n }),\n arguments_: [this.convertLiteralValue(aliasType.typeReference.value)]\n })\n );\n default:\n return this.convert({ typeReference: aliasType.typeReference, value, as });\n }\n }\n\n private convertLiteralValue(literal: FernIr.dynamic.LiteralType): go.TypeInstantiation {\n switch (literal.type) {\n case \"boolean\":\n return go.TypeInstantiation.bool(literal.value);\n case \"string\":\n return go.TypeInstantiation.string(literal.value);\n default:\n assertNever(literal);\n }\n }\n\n private convertDiscriminatedUnion({\n discriminatedUnion,\n value\n }: {\n discriminatedUnion: FernIr.dynamic.DiscriminatedUnionType;\n value: unknown;\n }): go.TypeInstantiation {\n const structTypeReference = this.context.getGoTypeReferenceFromDeclaration({\n declaration: discriminatedUnion.declaration\n });\n const discriminatedUnionTypeInstance = this.context.resolveDiscriminatedUnionTypeInstance({\n discriminatedUnion,\n value\n });\n if (discriminatedUnionTypeInstance == null) {\n return go.TypeInstantiation.nop();\n }\n const unionVariant = discriminatedUnionTypeInstance.singleDiscriminatedUnionType;\n const baseFields = this.getBaseFields({\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 go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.structPointer({\n typeReference: structTypeReference,\n fields: [\n {\n name: this.context.getTypeName(unionVariant.discriminantValue.name),\n value: this.convertNamed({ named, value: discriminatedUnionTypeInstance.value })\n },\n ...baseFields\n ]\n });\n }\n case \"singleProperty\": {\n const record = this.context.getRecord(discriminatedUnionTypeInstance.value);\n if (record == null) {\n return go.TypeInstantiation.nop();\n }\n try {\n this.context.errors.scope(unionVariant.discriminantValue.wireValue);\n return go.TypeInstantiation.structPointer({\n typeReference: structTypeReference,\n fields: [\n {\n name: this.context.getTypeName(unionVariant.discriminantValue.name),\n value: this.convert({\n typeReference: unionVariant.typeReference,\n value: record[unionVariant.discriminantValue.wireValue]\n })\n },\n ...baseFields\n ]\n });\n } finally {\n this.context.errors.unscope();\n }\n }\n case \"noProperties\":\n return go.TypeInstantiation.structPointer({\n typeReference: structTypeReference,\n fields: [\n {\n // Unions with no properties require the discriminant property to be set.\n name: this.context.getTypeName(discriminatedUnionTypeInstance.discriminantValue.name),\n value: go.TypeInstantiation.string(unionVariant.discriminantValue.wireValue)\n },\n ...baseFields\n ]\n });\n default:\n assertNever(unionVariant);\n }\n }\n\n private getBaseFields({\n discriminatedUnionTypeInstance,\n singleDiscriminatedUnionType\n }: {\n discriminatedUnionTypeInstance: DiscriminatedUnionTypeInstance;\n singleDiscriminatedUnionType: FernIr.dynamic.SingleDiscriminatedUnionType;\n }): go.StructField[] {\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.getTypeName(property.name.name),\n value: this.convert(property)\n };\n } finally {\n this.context.errors.unscope();\n }\n });\n }\n\n private convertObject({\n object_,\n value\n }: {\n object_: FernIr.dynamic.ObjectType;\n value: unknown;\n }): go.TypeInstantiation {\n const properties = this.context.associateByWireValue({\n parameters: object_.properties,\n values: this.context.getRecord(value) ?? {}\n });\n return go.TypeInstantiation.structPointer({\n typeReference: go.typeReference({\n name: this.context.getTypeName(object_.declaration.name),\n importPath: this.context.getImportPath(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.getTypeName(property.name.name),\n value: this.convert(property)\n };\n } finally {\n this.context.errors.unscope();\n }\n })\n });\n }\n\n private convertEnum({ enum_, value }: { enum_: FernIr.dynamic.EnumType; value: unknown }): go.TypeInstantiation {\n const name = this.getEnumValueName({ enum_, value });\n if (name == null) {\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.enum(\n go.typeReference({\n name,\n importPath: this.context.getImportPath(enum_.declaration.fernFilepath)\n })\n );\n }\n\n private getEnumValueName({ enum_, value }: { enum_: FernIr.dynamic.EnumType; value: unknown }): string | undefined {\n if (typeof value !== \"string\") {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected enum value string, got: ${typeof value}`\n });\n return undefined;\n }\n const enumValue = enum_.values.find((v) => v.wireValue === value);\n if (enumValue == null) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `An enum value named \"${value}\" does not exist in this context`\n });\n return undefined;\n }\n return `${this.context.getTypeName(enum_.declaration.name)}${this.context.getTypeName(enumValue.name)}`;\n }\n\n private convertUndiscriminatedUnion({\n undiscriminatedUnion,\n value\n }: {\n undiscriminatedUnion: FernIr.dynamic.UndiscriminatedUnionType;\n value: unknown;\n }): go.TypeInstantiation {\n const result = this.findMatchingUndiscriminatedUnionType({\n undiscriminatedUnion,\n value\n });\n if (result == null) {\n return go.TypeInstantiation.nop();\n }\n const fieldName = this.getUndiscriminatedUnionFieldName({ typeReference: result.valueTypeReference });\n if (fieldName == null) {\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.structPointer({\n typeReference: this.context.getGoTypeReferenceFromDeclaration({\n declaration: undiscriminatedUnion.declaration\n }),\n fields: [\n {\n name: fieldName,\n value: result.typeInstantiation\n }\n ]\n });\n }\n\n private findMatchingUndiscriminatedUnionType({\n undiscriminatedUnion,\n value\n }: {\n undiscriminatedUnion: FernIr.dynamic.UndiscriminatedUnionType;\n value: unknown;\n }): { valueTypeReference: FernIr.dynamic.TypeReference; typeInstantiation: go.TypeInstantiation } | undefined {\n for (const typeReference of undiscriminatedUnion.types) {\n try {\n const typeInstantiation = this.convert({ typeReference, value });\n return { valueTypeReference: typeReference, typeInstantiation };\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 getUndiscriminatedUnionFieldName({\n typeReference\n }: {\n typeReference: FernIr.dynamic.TypeReference;\n }): string | undefined {\n switch (typeReference.type) {\n case \"list\":\n return this.getUndiscriminatedUnionFieldNameForList({ list: typeReference });\n case \"literal\":\n return this.getUndiscriminatedUnionFieldNameForLiteral({ literal: typeReference.value });\n case \"map\":\n return this.getUndiscriminatedUnionFieldNameForMap({ map: typeReference });\n case \"named\": {\n const named = this.context.resolveNamedType({ typeId: typeReference.value });\n if (named == null) {\n return undefined;\n }\n return this.context.getTypeName(named.declaration.name);\n }\n case \"optional\":\n return this.getUndiscriminatedUnionFieldNameForOptional({ typeReference });\n case \"nullable\":\n return this.getUndiscriminatedUnionFieldNameForOptional({ typeReference });\n case \"primitive\":\n return this.getUndiscriminatedUnionFieldNameForPrimitive({ primitive: typeReference.value });\n case \"set\":\n return this.getUndiscriminatedUnionFieldNameForSet({ set: typeReference });\n case \"unknown\":\n return \"Unknown\";\n default:\n assertNever(typeReference);\n }\n }\n\n private getUndiscriminatedUnionFieldNameForList({\n list\n }: {\n list: FernIr.dynamic.TypeReference.List;\n }): string | undefined {\n const fieldName = this.getUndiscriminatedUnionFieldName({ typeReference: list });\n if (fieldName == null) {\n return undefined;\n }\n return `${fieldName}List`;\n }\n\n private getUndiscriminatedUnionFieldNameForMap({ map }: { map: FernIr.dynamic.MapType }): string | undefined {\n const keyFieldName = this.getUndiscriminatedUnionFieldName({ typeReference: map.key });\n if (keyFieldName == null) {\n return undefined;\n }\n const valueFieldName = this.getUndiscriminatedUnionFieldName({ typeReference: map.value });\n if (valueFieldName == null) {\n return undefined;\n }\n return `${keyFieldName}${valueFieldName}Map`;\n }\n\n private getUndiscriminatedUnionFieldNameForOptional({\n typeReference\n }: {\n typeReference: FernIr.dynamic.TypeReference.Optional | FernIr.dynamic.TypeReference.Nullable;\n }): string | undefined {\n const fieldName = this.getUndiscriminatedUnionFieldName({ typeReference });\n if (fieldName == null) {\n return undefined;\n }\n return `${fieldName}Optional`;\n }\n\n private getUndiscriminatedUnionFieldNameForSet({\n set\n }: {\n set: FernIr.dynamic.TypeReference.Set;\n }): string | undefined {\n const fieldName = this.getUndiscriminatedUnionFieldName({ typeReference: set });\n if (fieldName == null) {\n return undefined;\n }\n return `${fieldName}Set`;\n }\n\n private getUndiscriminatedUnionFieldNameForLiteral({\n literal\n }: {\n literal: FernIr.dynamic.LiteralType;\n }): string | undefined {\n switch (literal.type) {\n case \"boolean\":\n if (literal.value) {\n return \"TrueLiteral\";\n }\n return \"FalseLiteral\";\n case \"string\":\n return `${literal.value}StringLiteral`;\n default:\n assertNever(literal);\n }\n }\n\n private getUndiscriminatedUnionFieldNameForPrimitive({\n primitive\n }: {\n primitive: FernIr.dynamic.PrimitiveTypeV1;\n }): string {\n switch (primitive) {\n case \"INTEGER\":\n case \"UINT\":\n return \"Integer\";\n case \"LONG\":\n case \"UINT_64\":\n return \"Long\";\n case \"FLOAT\":\n case \"DOUBLE\":\n return \"Double\";\n case \"BOOLEAN\":\n return \"Boolean\";\n case \"BIG_INTEGER\":\n case \"STRING\":\n return \"String\";\n case \"UUID\":\n return \"Uuid\";\n case \"DATE\":\n return \"Date\";\n case \"DATE_TIME\":\n return \"DateTime\";\n case \"BASE_64\":\n return \"Base64\";\n default:\n assertNever(primitive);\n }\n }\n\n private convertUnknown({ value }: { value: unknown }): go.TypeInstantiation {\n return go.TypeInstantiation.any(value);\n }\n\n private convertPrimitive({\n primitive,\n value,\n as\n }: {\n primitive: FernIr.dynamic.PrimitiveTypeV1;\n value: unknown;\n as?: DynamicTypeInstantiationMapper.ConvertedAs;\n }): go.TypeInstantiation {\n switch (primitive) {\n case \"INTEGER\":\n case \"UINT\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.int(num);\n }\n case \"LONG\":\n case \"UINT_64\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.int64(num);\n }\n case \"FLOAT\":\n case \"DOUBLE\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.float64(num);\n }\n case \"BOOLEAN\": {\n const bool = this.getValueAsBoolean({ value, as });\n if (bool == null) {\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.bool(bool);\n }\n case \"STRING\": {\n const str = this.context.getValueAsString({ value });\n if (str == null) {\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.string(str);\n }\n case \"DATE\": {\n const date = this.context.getValueAsString({ value });\n if (date == null) {\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.date(date);\n }\n case \"DATE_TIME\": {\n const dateTime = this.context.getValueAsString({ value });\n if (dateTime == null) {\n return go.TypeInstantiation.nop();\n }\n const normalizedDateTime = this.normalizeDateTimeString(dateTime);\n return go.TypeInstantiation.dateTime(normalizedDateTime);\n }\n case \"UUID\": {\n const uuid = this.context.getValueAsString({ value });\n if (uuid == null) {\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.uuid(uuid);\n }\n case \"BASE_64\": {\n const base64 = this.context.getValueAsString({ value });\n if (base64 == null) {\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.bytes(base64);\n }\n case \"BIG_INTEGER\": {\n const bigInt = this.context.getValueAsString({ value });\n if (bigInt == null) {\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.string(bigInt);\n }\n default:\n assertNever(primitive);\n }\n }\n\n private getValueAsNumber({\n value,\n as\n }: {\n value: unknown;\n as?: DynamicTypeInstantiationMapper.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?: DynamicTypeInstantiationMapper.ConvertedAs;\n }): boolean | undefined {\n const bool =\n as === \"key\" ? (typeof value === \"string\" ? value === \"true\" : value === \"false\" ? false : value) : value;\n return this.context.getValueAsBoolean({ value: bool });\n }\n\n private normalizeDateTimeString(dateTime: string): string {\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(dateTime)) {\n return `${dateTime}T00:00:00Z`;\n }\n if (/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$/.test(dateTime)) {\n return `${dateTime}Z`;\n }\n return dateTime;\n }\n}\n"],"mappings":"4GAAAA,IAAAC,IAmBO,IAAMC,EAAN,KAAqC,CAGxC,YAAY,CAAE,QAAAC,CAAQ,EAAiD,CAFvEC,EAAA,KAAQ,WAGJ,KAAK,QAAUD,CACnB,CAEO,QAAQE,EAAiE,CAQ5E,GANIA,EAAK,QAAU,MAAQ,CAAC,KAAK,QAAQ,WAAWA,EAAK,aAAa,GAClE,KAAK,QAAQ,OAAO,IAAI,CACpB,SAAUC,EAAS,SACnB,QAAS,uCACb,CAAC,EAEDD,EAAK,OAAS,KACd,OAAOE,EAAG,kBAAkB,IAAI,EAEpC,OAAQF,EAAK,cAAc,KAAM,CAC7B,IAAK,OACD,OAAO,KAAK,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AkB,OAAO8C,CAAM,CAC7C,CACA,QACI5C,EAAYmC,CAAS,CAC7B,CACJ,CAEQ,iBAAiB,CACrB,MAAAhC,EACA,GAAAK,CACJ,EAGuB,CACnB,IAAM4B,EAAM5B,IAAO,OAAS,OAAOL,GAAU,SAAW,OAAOA,CAAK,EAAaA,EACjF,OAAO,KAAK,QAAQ,iBAAiB,CAAE,MAAOiC,CAAI,CAAC,CACvD,CAEQ,kBAAkB,CACtB,MAAAjC,EACA,GAAAK,CACJ,EAGwB,CACpB,IAAM6B,EACF7B,IAAO,MAAS,OAAOL,GAAU,SAAWA,IAAU,OAASA,IAAU,QAAU,GAAQA,EAASA,EACxG,OAAO,KAAK,QAAQ,kBAAkB,CAAE,MAAOkC,CAAK,CAAC,CACzD,CAEQ,wBAAwBG,EAA0B,CACtD,MAAI,sBAAsB,KAAKA,CAAQ,EAC5B,GAAGA,CAAQ,aAElB,wCAAwC,KAAKA,CAAQ,EAC9C,GAAGA,CAAQ,IAEfA,CACX,CACJ","names":["init_process","init_buffer","DynamicTypeInstantiationMapper","context","__publicField","args","Severity","go_exports","named","assertNever","converted","list","value","v","index","map","key","as","aliasType","literal","discriminatedUnion","structTypeReference","discriminatedUnionTypeInstance","unionVariant","baseFields","record","singleDiscriminatedUnionType","_a","_b","property","object_","properties","enum_","name","enumValue","undiscriminatedUnion","result","fieldName","typeReference","typeInstantiation","e","keyFieldName","valueFieldName","set","primitive","num","bool","str","date","dateTime","normalizedDateTime","uuid","base64","bigInt"]}