@fern-api/go-dynamic-snippets 0.0.17 → 0.0.19

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 (67) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +6 -6
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
  3. package/cjs/DynamicSnippetsGenerator.d.cts +3 -2
  4. package/cjs/{DynamicSnippetsGeneratorContext-D8VcLYKk.d.cts → DynamicSnippetsGeneratorContext-X0Mtg6YW.d.cts} +1 -0
  5. package/cjs/EndpointSnippetGenerator.cjs +4 -4
  6. package/cjs/EndpointSnippetGenerator.cjs.map +1 -1
  7. package/cjs/EndpointSnippetGenerator.d.cts +7 -2
  8. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +8 -8
  9. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -1
  10. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
  11. package/cjs/context/DynamicTypeInstantiationMapper.cjs +1 -1
  12. package/cjs/context/DynamicTypeInstantiationMapper.cjs.map +1 -1
  13. package/cjs/context/DynamicTypeInstantiationMapper.d.cts +1 -1
  14. package/cjs/context/DynamicTypeMapper.cjs +4 -4
  15. package/cjs/context/DynamicTypeMapper.cjs.map +1 -1
  16. package/cjs/context/DynamicTypeMapper.d.cts +1 -1
  17. package/cjs/context/FilePropertyMapper.cjs +7 -7
  18. package/cjs/context/FilePropertyMapper.cjs.map +1 -1
  19. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  20. package/cjs/index.cjs +6 -6
  21. package/cjs/index.cjs.map +1 -1
  22. package/cjs/index.d.cts +1 -1
  23. package/esm/DynamicSnippetsGenerator.d.ts +3 -2
  24. package/esm/DynamicSnippetsGenerator.js +1 -1
  25. package/esm/{DynamicSnippetsGeneratorContext-D8VcLYKk.d.ts → DynamicSnippetsGeneratorContext-X0Mtg6YW.d.ts} +1 -0
  26. package/esm/EndpointSnippetGenerator.d.ts +7 -2
  27. package/esm/EndpointSnippetGenerator.js +1 -1
  28. package/esm/{chunk-ZNTXZ3YV.js → chunk-5X6DU53C.js} +2 -2
  29. package/esm/chunk-EUHLPBOB.js +2 -0
  30. package/esm/chunk-EUHLPBOB.js.map +1 -0
  31. package/esm/chunk-FVPD7ODP.js +2 -0
  32. package/esm/chunk-FVPD7ODP.js.map +1 -0
  33. package/esm/chunk-KGXOPYBU.js +2 -0
  34. package/esm/chunk-KGXOPYBU.js.map +1 -0
  35. package/esm/chunk-NY6N4HP7.js +2 -0
  36. package/esm/chunk-NY6N4HP7.js.map +1 -0
  37. package/esm/chunk-S5R5YTLQ.js +2 -0
  38. package/esm/chunk-S5R5YTLQ.js.map +1 -0
  39. package/esm/chunk-T2DJJZPN.js +2 -0
  40. package/esm/chunk-T2DJJZPN.js.map +1 -0
  41. package/esm/{chunk-JHIUGKJ4.js → chunk-VY2BNRW5.js} +9 -9
  42. package/esm/chunk-VY2BNRW5.js.map +1 -0
  43. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
  44. package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
  45. package/esm/context/DynamicTypeInstantiationMapper.d.ts +1 -1
  46. package/esm/context/DynamicTypeInstantiationMapper.js +1 -1
  47. package/esm/context/DynamicTypeMapper.d.ts +1 -1
  48. package/esm/context/DynamicTypeMapper.js +1 -1
  49. package/esm/context/FilePropertyMapper.d.ts +1 -1
  50. package/esm/context/FilePropertyMapper.js +1 -1
  51. package/esm/index.d.ts +1 -1
  52. package/esm/index.js +1 -1
  53. package/package.json +1 -1
  54. package/esm/chunk-ADZ6FCNI.js +0 -2
  55. package/esm/chunk-ADZ6FCNI.js.map +0 -1
  56. package/esm/chunk-FTDA4363.js +0 -2
  57. package/esm/chunk-FTDA4363.js.map +0 -1
  58. package/esm/chunk-GDQPUUAY.js +0 -2
  59. package/esm/chunk-GDQPUUAY.js.map +0 -1
  60. package/esm/chunk-JHIUGKJ4.js.map +0 -1
  61. package/esm/chunk-PZ73VBNX.js +0 -2
  62. package/esm/chunk-PZ73VBNX.js.map +0 -1
  63. package/esm/chunk-SVPRIX53.js +0 -2
  64. package/esm/chunk-SVPRIX53.js.map +0 -1
  65. package/esm/chunk-VTPICU2V.js +0 -2
  66. package/esm/chunk-VTPICU2V.js.map +0 -1
  67. /package/esm/{chunk-ZNTXZ3YV.js.map → chunk-5X6DU53C.js.map} +0 -0
@@ -1,4 +1,4 @@
1
1
  import '@fern-api/browser-compatible-base-generator';
2
2
  import '@fern-api/dynamic-ir-sdk';
3
3
  import '@fern-api/go-ast';
4
- export { D as DynamicSnippetsGeneratorContext } from '../DynamicSnippetsGeneratorContext-D8VcLYKk.js';
4
+ export { D as DynamicSnippetsGeneratorContext } from '../DynamicSnippetsGeneratorContext-X0Mtg6YW.js';
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-PZ73VBNX.js";import"../chunk-VTPICU2V.js";import"../chunk-FTDA4363.js";import"../chunk-ZNTXZ3YV.js";import"../chunk-SVPRIX53.js";import"../chunk-JHIUGKJ4.js";export{a as DynamicSnippetsGeneratorContext};
1
+ import{a}from"../chunk-T2DJJZPN.js";import"../chunk-NY6N4HP7.js";import"../chunk-EUHLPBOB.js";import"../chunk-5X6DU53C.js";import"../chunk-FVPD7ODP.js";import"../chunk-VY2BNRW5.js";export{a as DynamicSnippetsGeneratorContext};
2
2
  //# sourceMappingURL=DynamicSnippetsGeneratorContext.js.map
@@ -1,4 +1,4 @@
1
1
  import '@fern-api/dynamic-ir-sdk';
2
2
  import '@fern-api/go-ast';
3
- export { a as DynamicTypeInstantiationMapper } from '../DynamicSnippetsGeneratorContext-D8VcLYKk.js';
3
+ export { a as DynamicTypeInstantiationMapper } from '../DynamicSnippetsGeneratorContext-X0Mtg6YW.js';
4
4
  import '@fern-api/browser-compatible-base-generator';
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-VTPICU2V.js";import"../chunk-FTDA4363.js";import"../chunk-JHIUGKJ4.js";export{a as DynamicTypeInstantiationMapper};
1
+ import{a}from"../chunk-NY6N4HP7.js";import"../chunk-EUHLPBOB.js";import"../chunk-VY2BNRW5.js";export{a as DynamicTypeInstantiationMapper};
2
2
  //# sourceMappingURL=DynamicTypeInstantiationMapper.js.map
@@ -1,4 +1,4 @@
1
1
  import '@fern-api/dynamic-ir-sdk';
2
2
  import '@fern-api/go-ast';
3
- export { b as DynamicTypeMapper } from '../DynamicSnippetsGeneratorContext-D8VcLYKk.js';
3
+ export { b as DynamicTypeMapper } from '../DynamicSnippetsGeneratorContext-X0Mtg6YW.js';
4
4
  import '@fern-api/browser-compatible-base-generator';
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-ZNTXZ3YV.js";import"../chunk-JHIUGKJ4.js";export{a as DynamicTypeMapper};
1
+ import{a}from"../chunk-5X6DU53C.js";import"../chunk-VY2BNRW5.js";export{a as DynamicTypeMapper};
2
2
  //# sourceMappingURL=DynamicTypeMapper.js.map
@@ -1,4 +1,4 @@
1
1
  import '@fern-api/dynamic-ir-sdk';
2
2
  import '@fern-api/go-ast';
3
- export { F as FilePropertyInfo, c as FilePropertyMapper } from '../DynamicSnippetsGeneratorContext-D8VcLYKk.js';
3
+ export { F as FilePropertyInfo, c as FilePropertyMapper } from '../DynamicSnippetsGeneratorContext-X0Mtg6YW.js';
4
4
  import '@fern-api/browser-compatible-base-generator';
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-SVPRIX53.js";import"../chunk-JHIUGKJ4.js";export{a as FilePropertyMapper};
1
+ import{a}from"../chunk-FVPD7ODP.js";import"../chunk-VY2BNRW5.js";export{a as FilePropertyMapper};
2
2
  //# sourceMappingURL=FilePropertyMapper.js.map
package/esm/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { DynamicSnippetsGenerator } from './DynamicSnippetsGenerator.js';
2
2
  import '@fern-api/browser-compatible-base-generator';
3
3
  import '@fern-api/dynamic-ir-sdk';
4
- import './DynamicSnippetsGeneratorContext-D8VcLYKk.js';
4
+ import './DynamicSnippetsGeneratorContext-X0Mtg6YW.js';
5
5
  import '@fern-api/go-ast';
6
6
  import './EndpointSnippetGenerator.js';
package/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-GDQPUUAY.js";import"./chunk-ADZ6FCNI.js";import"./chunk-PZ73VBNX.js";import"./chunk-VTPICU2V.js";import"./chunk-FTDA4363.js";import"./chunk-ZNTXZ3YV.js";import"./chunk-SVPRIX53.js";import{f as e,g as r}from"./chunk-JHIUGKJ4.js";e();r();export{n as DynamicSnippetsGenerator};
1
+ import{a as n}from"./chunk-KGXOPYBU.js";import"./chunk-S5R5YTLQ.js";import"./chunk-T2DJJZPN.js";import"./chunk-NY6N4HP7.js";import"./chunk-EUHLPBOB.js";import"./chunk-5X6DU53C.js";import"./chunk-FVPD7ODP.js";import{f as e,g as r}from"./chunk-VY2BNRW5.js";e();r();export{n as DynamicSnippetsGenerator};
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fern-api/go-dynamic-snippets",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",
@@ -1,2 +0,0 @@
1
- import{b as p,d}from"./chunk-FTDA4363.js";import{e as A,f as R,g as N,h as m,j as n}from"./chunk-JHIUGKJ4.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-ADZ6FCNI.js.map
@@ -1 +0,0 @@
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,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pB,EACA,UAAW,EACf,CAAC,CACL,EACAc,EAAO,UAAU,EAEjBA,EAAO,UACHd,EAAG,WAAW,CACV,KAAMA,EAAG,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"]}
@@ -1,2 +0,0 @@
1
- import{a as P,b as T,c as S,d as b,e as a,f as p,g as l,h,i as R}from"./chunk-JHIUGKJ4.js";p();l();p();l();var y=class{constructor(){a(this,"reporter");a(this,"snippet");a(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){this.shouldUpdate({snippet:r,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=r)}getResponseOrThrow({endpoint:e}){var r;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(r=this.err)!=null?r:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:r}){var t,n;return this.reporter==null||this.reporter.size()>0&&r.size()===0?!0:e.length>((n=(t=this.snippet)==null?void 0:t.length)!=null?n:0)}};var E=class{constructor(e){a(this,"context");this.context=e}async generate(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new y;for(let i of t){let s=this.context.clone(),d=this.createSnippetGenerator(s);try{let u=await d.generateSnippet({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:u,errors:void 0};n.update({context:s,snippet:u})}catch(u){n.err==null&&(n.err=u)}}return n.getResponseOrThrow({endpoint:e.endpoint})}generateSync(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new y;for(let i of t){let s=this.context.clone(),d=this.createSnippetGenerator(s);try{let u=d.generateSnippetSync({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:u,errors:void 0};n.update({context:s,snippet:u})}catch(u){n.err==null&&(n.err=u)}}return n.getResponseOrThrow({endpoint:e.endpoint})}};p();l();var o={Critical:"CRITICAL",Warning:"WARNING"},v=class m{constructor(){a(this,"errors");a(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(T(P({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new m;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};p();l();p();l();p();l();var g=class{constructor(){a(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let t=e.match(this.REFERENCE_REGEX);if(!(t==null||t[1]==null||t[2]==null))return{method:t[1],path:t[2]}}};var w=class{constructor({ir:e,config:r,options:t={}}){a(this,"config");a(this,"options");a(this,"errors");a(this,"_ir");a(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.options=t,this.errors=new v,this.httpEndpointReferenceParser=new g}associateQueryParametersByWireValue({parameters:e,values:r}){let t=[];for(let[n,i]of Object.entries(r)){this.errors.scope(n);try{let s=e.find(u=>u.name.wireValue===n);if(s==null)throw this.newParameterNotRecognizedError(n);let d=this.isListTypeReference(s.typeReference)&&!Array.isArray(i)?[i]:i;t.push({name:s.name,typeReference:s.typeReference,value:d})}finally{this.errors.unscope()}}return t}associateByWireValueOrDefault({parameters:e,values:r}){let t=[];for(let n of e){this.errors.scope(n.name.wireValue);try{let i=r[n.name.wireValue];if(i==null)if(n.typeReference.type==="primitive"&&n.typeReference.value==="STRING")i=`<${n.name.wireValue}>`;else{this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n.name.wireValue).message});continue}t.push({name:n.name,typeReference:n.typeReference,value:i})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let n=[];for(let[i,s]of Object.entries(r)){this.errors.scope(i);try{let d=e.find(u=>u.name.wireValue===i);if(d==null){if(t)continue;this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(i).message});continue}n.push({name:d.name,typeReference:d.typeReference,value:s})}finally{this.errors.unscope()}}return n}getExampleObjectProperties({parameters:e,snippetObject:r}){let t=typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{},n=[];for(let i of e){let s=t[i.name.wireValue];s==null?i.typeReference.type==="nullable"&&n.push({name:i.name,typeReference:i.typeReference,value:null}):n.push({name:i.name,typeReference:i.typeReference,value:s})}return n}getSingleFileValue({property:e,record:r}){let t=r[e.wireValue];if(t!=null){if(typeof t!="string"){this.errors.add({severity:o.Critical,message:`Expected file value to be a string, got ${typeof t}`});return}return t}}getFileArrayValues({property:e,record:r}){let t=r[e.wireValue];if(t==null)return;if(!Array.isArray(t)){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof t}`});return}let n=[];for(let i of t){if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}n.push(i)}return n}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:o.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:o.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let t=this.getRecord(r);if(t==null)return;let n=e.discriminant.wireValue,i=t[n];if(i==null){this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n).message});return}if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let s=e.types[i];if(s==null){this.errors.add({severity:o.Critical,message:`No type found for discriminant value "${i}"`});return}let x=t,{[n]:d}=x,u=b(x,[S(n)]);return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:u}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocation(e){let r=[];for(let t of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:t,parsedEndpoint:e})&&r.push(t);return r}resolveEndpointLocationOrThrow(e){let r=this.resolveEndpointLocation(e);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:t}){var n;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:t}):!((n=e.metadata)!=null&&n.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var t,n;return r&&((n=(t=e.metadata)==null?void 0:t.includePathParameters)!=null?n:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:h(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}case"multipleBaseUrls":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}default:h(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let t=r.environments[0];if(t==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let n=new Set(R(t.urls));for(let i of R(e))n.has(i)&&n.delete(i);return n.size>0?(this.errors.add({severity:o.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${R(t.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:h(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:h(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:h(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};p();l();var A={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();l();export{E as a,o as b,w as c,A as d};
2
- //# sourceMappingURL=chunk-FTDA4363.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../browser-compatible-base/src/dynamic-snippets/AbstractDynamicSnippetsGenerator.ts","../../../../browser-compatible-base/src/dynamic-snippets/Result.ts","../../../../browser-compatible-base/src/dynamic-snippets/ErrorReporter.ts","../../../../browser-compatible-base/src/dynamic-snippets/AbstractDynamicSnippetsGeneratorContext.ts","../../../../../packages/cli/fern-definition/schema/src/index.ts","../../../../../packages/cli/fern-definition/schema/src/utils/HttpEndpointReferenceParser.ts","../../../../browser-compatible-base/src/dynamic-snippets/Scope.ts","../../../../browser-compatible-base/src/dynamic-snippets/index.ts"],"sourcesContent":["import { FernIr } from \"@fern-api/dynamic-ir-sdk\";\n\nimport { AbstractDynamicSnippetsGeneratorContext } from \"./AbstractDynamicSnippetsGeneratorContext\";\nimport { AbstractEndpointSnippetGenerator } from \"./AbstractEndpointSnippetGenerator\";\nimport { Options } from \"./Options\";\nimport { Result } from \"./Result\";\n\nexport abstract class AbstractDynamicSnippetsGenerator<\n Context extends AbstractDynamicSnippetsGeneratorContext,\n EndpointSnippetGenerator extends AbstractEndpointSnippetGenerator<Context>\n> {\n public constructor(public readonly context: Context) {}\n\n protected abstract createSnippetGenerator(context: Context): EndpointSnippetGenerator;\n\n public async generate(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): Promise<FernIr.dynamic.EndpointSnippetResponse> {\n const endpoints = this.context.resolveEndpointLocationOrThrow(request.endpoint);\n if (endpoints.length === 0) {\n throw new Error(`No endpoints found that match \"${request.endpoint.method} ${request.endpoint.path}\"`);\n }\n const result = new Result();\n for (const endpoint of endpoints) {\n const context = this.context.clone() as Context;\n const snippetGenerator = this.createSnippetGenerator(context);\n try {\n const snippet = await snippetGenerator.generateSnippet({ endpoint, request, options });\n if (context.errors.empty()) {\n return {\n snippet,\n errors: undefined\n };\n }\n result.update({ context, snippet });\n } catch (error) {\n if (result.err == null) {\n result.err = error as Error;\n }\n }\n }\n return result.getResponseOrThrow({ endpoint: request.endpoint });\n }\n\n public generateSync(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): FernIr.dynamic.EndpointSnippetResponse {\n const endpoints = this.context.resolveEndpointLocationOrThrow(request.endpoint);\n if (endpoints.length === 0) {\n throw new Error(`No endpoints found that match \"${request.endpoint.method} ${request.endpoint.path}\"`);\n }\n const result = new Result();\n for (const endpoint of endpoints) {\n const context = this.context.clone() as Context;\n const snippetGenerator = this.createSnippetGenerator(context);\n try {\n const snippet = snippetGenerator.generateSnippetSync({ endpoint, request, options });\n if (context.errors.empty()) {\n return {\n snippet,\n errors: undefined\n };\n }\n result.update({ context, snippet });\n } catch (error) {\n if (result.err == null) {\n result.err = error as Error;\n }\n }\n }\n return result.getResponseOrThrow({ endpoint: request.endpoint });\n }\n}\n","import { FernIr } from \"@fern-api/dynamic-ir-sdk\";\n\nimport { AbstractDynamicSnippetsGeneratorContext } from \"./AbstractDynamicSnippetsGeneratorContext\";\nimport { ErrorReporter } from \"./ErrorReporter\";\n\nexport class Result {\n public reporter: ErrorReporter | undefined;\n public snippet: string | undefined;\n public err: Error | undefined;\n\n constructor() {\n this.snippet = undefined;\n this.reporter = undefined;\n this.err = undefined;\n }\n\n public update({ context, snippet }: { context: AbstractDynamicSnippetsGeneratorContext; snippet: string }): void {\n if (this.shouldUpdate({ snippet, reporter: context.errors })) {\n this.reporter = context.errors.clone();\n this.snippet = snippet;\n }\n }\n\n public getResponseOrThrow({\n endpoint\n }: {\n endpoint: FernIr.dynamic.EndpointLocation;\n }): FernIr.dynamic.EndpointSnippetResponse {\n if (this.snippet != null && this.reporter != null) {\n return {\n snippet: this.snippet,\n errors: this.reporter.toDynamicSnippetErrors()\n };\n }\n throw this.err ?? new Error(`Failed to generate snippet for endpoint \"${endpoint.method} ${endpoint.path}\"`);\n }\n\n private shouldUpdate({ snippet, reporter }: { snippet: string; reporter: ErrorReporter }): boolean {\n if (this.reporter == null || (this.reporter.size() > 0 && reporter.size() === 0)) {\n return true;\n }\n return snippet.length > (this.snippet?.length ?? 0);\n }\n}\n","export const Severity = {\n Critical: \"CRITICAL\",\n Warning: \"WARNING\"\n} as const;\n\nexport declare namespace ErrorReporter {\n type Path = readonly PathItem[];\n\n type PathItem = string | ArrayPathItem;\n\n type Severity = (typeof Severity)[keyof typeof Severity];\n\n interface ArrayPathItem {\n index: number;\n }\n\n interface Error {\n path?: Path;\n severity: Severity;\n message: string;\n }\n}\n\ninterface Error_ {\n severity: \"CRITICAL\" | \"WARNING\";\n path: string[] | undefined;\n message: string;\n}\n\nexport class ErrorReporter {\n private errors: ErrorReporter.Error[];\n private path: ErrorReporter.PathItem[];\n\n constructor() {\n this.errors = [];\n this.path = [];\n }\n\n public add(err: Omit<ErrorReporter.Error, \"path\">): void {\n this.errors.push({\n ...err,\n path: [...this.path]\n });\n }\n\n public scope(path: ErrorReporter.PathItem): void {\n this.path.push(path);\n }\n\n public unscope(): void {\n this.path.pop();\n }\n\n public getBySeverity(severity: ErrorReporter.Severity): ErrorReporter.Error[] {\n return this.errors.filter((err) => err.severity === severity);\n }\n\n public empty(): boolean {\n return this.errors.length === 0;\n }\n\n public size(): number {\n return this.errors.length;\n }\n\n public clone(): ErrorReporter {\n const clone = new ErrorReporter();\n clone.errors = [...this.errors];\n clone.path = [...this.path];\n return clone;\n }\n\n public reset(): void {\n this.errors = [];\n this.path = [];\n }\n\n public toDynamicSnippetErrors(): Error_[] {\n return this.errors.map((err) => ({\n severity: err.severity,\n path: err.path != null ? this.pathToStringArray(err.path) : undefined,\n message: err.message\n }));\n }\n\n private pathToStringArray(path: ErrorReporter.Path): string[] {\n const result: string[] = [];\n for (const item of path) {\n if (typeof item === \"string\") {\n result.push(item);\n continue;\n }\n result[result.length - 1] += `[${item.index}]`;\n }\n return result;\n }\n}\n","import { assertNever, keys } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { HttpEndpointReferenceParser } from \"@fern-api/fern-definition-schema\";\n\nimport { FernGeneratorExec } from \"../GeneratorNotificationService\";\nimport { DiscriminatedUnionTypeInstance } from \"./DiscriminatedUnionTypeInstance\";\nimport { ErrorReporter, Severity } from \"./ErrorReporter\";\nimport { Options } from \"./Options\";\nimport { TypeInstance } from \"./TypeInstance\";\n\nexport abstract class AbstractDynamicSnippetsGeneratorContext {\n public config: FernGeneratorExec.GeneratorConfig;\n public options: Options;\n public errors: ErrorReporter;\n\n private _ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n private httpEndpointReferenceParser: HttpEndpointReferenceParser;\n\n constructor({\n ir,\n config,\n options = {}\n }: {\n ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n config: FernGeneratorExec.GeneratorConfig;\n options?: Options;\n }) {\n this._ir = ir;\n this.config = config;\n this.options = options;\n this.errors = new ErrorReporter();\n this.httpEndpointReferenceParser = new HttpEndpointReferenceParser();\n }\n\n public abstract clone(): AbstractDynamicSnippetsGeneratorContext;\n\n public associateQueryParametersByWireValue({\n parameters,\n values\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): TypeInstance[] {\n const instances: TypeInstance[] = [];\n for (const [key, value] of Object.entries(values)) {\n this.errors.scope(key);\n try {\n const parameter = parameters.find((param) => param.name.wireValue === key);\n if (parameter == null) {\n throw this.newParameterNotRecognizedError(key);\n }\n // If this query parameter supports allow-multiple, the user-provided values\n // must be wrapped in an array.\n const typeInstanceValue =\n this.isListTypeReference(parameter.typeReference) && !Array.isArray(value) ? [value] : value;\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value: typeInstanceValue\n });\n } finally {\n this.errors.unscope();\n }\n }\n return instances;\n }\n\n public associateByWireValueOrDefault({\n parameters,\n values\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): TypeInstance[] {\n const instances: TypeInstance[] = [];\n for (const parameter of parameters) {\n this.errors.scope(parameter.name.wireValue);\n try {\n let value = values[parameter.name.wireValue];\n\n if (value == null) {\n if (parameter.typeReference.type === \"primitive\" && parameter.typeReference.value === \"STRING\") {\n // synthesize a parameter value for string parameters that are missing data\n value = `<${parameter.name.wireValue}>`;\n } else {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newParameterNotRecognizedError(parameter.name.wireValue).message\n });\n continue;\n }\n }\n\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value\n });\n } finally {\n this.errors.unscope();\n }\n }\n\n return instances;\n }\n\n public associateByWireValue({\n parameters,\n values,\n ignoreMissingParameters\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n ignoreMissingParameters?: boolean;\n }): TypeInstance[] {\n const instances: TypeInstance[] = [];\n for (const [key, value] of Object.entries(values)) {\n this.errors.scope(key);\n try {\n const parameter = parameters.find((param) => param.name.wireValue === key);\n if (parameter == null) {\n if (ignoreMissingParameters) {\n // Required for request payloads that include more information than\n // just the target parameters (e.g. union base properties).\n continue;\n }\n this.errors.add({\n severity: Severity.Critical,\n message: this.newParameterNotRecognizedError(key).message\n });\n continue;\n }\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value\n });\n } finally {\n this.errors.unscope();\n }\n }\n return instances;\n }\n\n /**\n * Similar to `associateByWireValue` but it builds TypeInstance objects by iterating over schema parameters rather\n * than snippet values. Skips non-nullable parameters that are missing from the snippet object.\n */\n public getExampleObjectProperties({\n parameters,\n snippetObject\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n snippetObject: unknown;\n }): TypeInstance[] {\n const objectRecord = (\n typeof snippetObject === \"object\" && snippetObject !== null && !Array.isArray(snippetObject)\n ? snippetObject\n : {}\n ) as Record<string, unknown>;\n const instances: TypeInstance[] = [];\n for (const parameter of parameters) {\n const value = objectRecord[parameter.name.wireValue];\n if (value == null) {\n if (parameter.typeReference.type === \"nullable\") {\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value: null\n });\n }\n } else {\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value\n });\n }\n }\n return instances;\n }\n\n public getSingleFileValue({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.File_;\n record: Record<string, unknown>;\n }): string | undefined {\n const fileValue = record[property.wireValue];\n if (fileValue == null) {\n return undefined;\n }\n if (typeof fileValue !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected file value to be a string, got ${typeof fileValue}`\n });\n return undefined;\n }\n return fileValue;\n }\n\n public getFileArrayValues({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.FileArray;\n record: Record<string, unknown>;\n }): string[] | undefined {\n const fileArrayValue = record[property.wireValue];\n if (fileArrayValue == null) {\n return undefined;\n }\n if (!Array.isArray(fileArrayValue)) {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected file array value to be an array of strings, got ${typeof fileArrayValue}`\n });\n return undefined;\n }\n const stringValues: string[] = [];\n for (const value of fileArrayValue) {\n if (typeof value !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected file array value to be an array of strings, got ${typeof value}`\n });\n return undefined;\n }\n stringValues.push(value);\n }\n return stringValues;\n }\n\n public getRecord(value: unknown): Record<string, unknown> | undefined {\n if (typeof value !== \"object\" || Array.isArray(value)) {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected object with key, value pairs but got: ${\n Array.isArray(value) ? \"array\" : typeof value\n }`\n });\n return undefined;\n }\n if (value == null) {\n return {};\n }\n return value as Record<string, unknown>;\n }\n\n public resolveNamedType({ typeId }: { typeId: FernIr.dynamic.TypeId }): FernIr.dynamic.NamedType | undefined {\n const namedType = this._ir.types[typeId];\n if (namedType == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: `Type identified by \"${typeId}\" could not be found`\n });\n return undefined;\n }\n return namedType;\n }\n\n public resolveDiscriminatedUnionTypeInstance({\n discriminatedUnion,\n value\n }: {\n discriminatedUnion: FernIr.dynamic.DiscriminatedUnionType;\n value: unknown;\n }): DiscriminatedUnionTypeInstance | undefined {\n const record = this.getRecord(value);\n if (record == null) {\n return undefined;\n }\n\n const discriminantFieldName = discriminatedUnion.discriminant.wireValue;\n const discriminantValue = record[discriminantFieldName];\n if (discriminantValue == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newParameterNotRecognizedError(discriminantFieldName).message\n });\n return undefined;\n }\n if (typeof discriminantValue !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected discriminant value to be a string but got: ${typeof discriminantValue}`\n });\n return undefined;\n }\n\n const singleDiscriminatedUnionType = discriminatedUnion.types[discriminantValue];\n if (singleDiscriminatedUnionType == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: `No type found for discriminant value \"${discriminantValue}\"`\n });\n return undefined;\n }\n\n // Remove the discriminant from the record so that the value is valid for the type.\n const { [discriminantFieldName]: _, ...filtered } = record;\n\n return {\n singleDiscriminatedUnionType,\n discriminantValue: singleDiscriminatedUnionType.discriminantValue,\n value: filtered\n };\n }\n\n public resolveEndpointOrThrow(rawEndpoint: string): FernIr.dynamic.Endpoint[] {\n const parsedEndpoint = this.httpEndpointReferenceParser.tryParse(rawEndpoint);\n if (parsedEndpoint == null) {\n throw new Error(`Failed to parse endpoint reference \"${rawEndpoint}\"`);\n }\n return this.resolveEndpointLocationOrThrow(parsedEndpoint);\n }\n\n public resolveEndpointLocation(location: FernIr.dynamic.EndpointLocation): FernIr.dynamic.Endpoint[] {\n const endpoints: FernIr.dynamic.Endpoint[] = [];\n for (const endpoint of Object.values(this._ir.endpoints)) {\n if (this.parsedEndpointMatches({ endpoint, parsedEndpoint: location })) {\n endpoints.push(endpoint);\n }\n }\n\n return endpoints;\n }\n\n public resolveEndpointLocationOrThrow(location: FernIr.dynamic.EndpointLocation): FernIr.dynamic.Endpoint[] {\n const endpoints = this.resolveEndpointLocation(location);\n if (endpoints.length === 0) {\n throw new Error(`Failed to find endpoint identified by \"${location.method} ${location.path}\"`);\n }\n return endpoints;\n }\n\n public needsRequestParameter({\n request,\n inlinePathParameters,\n inlineFileProperties\n }: {\n request: FernIr.dynamic.InlinedRequest;\n inlinePathParameters: boolean;\n inlineFileProperties: boolean;\n }): boolean {\n if (this.includePathParametersInWrappedRequest({ request, inlinePathParameters })) {\n return true;\n }\n if (request.queryParameters != null && request.queryParameters.length > 0) {\n return true;\n }\n if (request.headers != null && request.headers.length > 0) {\n return true;\n }\n if (request.body != null) {\n return this.includeRequestBodyInWrappedRequest({ body: request.body, inlineFileProperties });\n }\n if (request.metadata?.onlyPathParameters) {\n return false;\n }\n return true;\n }\n\n public includePathParametersInWrappedRequest({\n request,\n inlinePathParameters\n }: {\n request: FernIr.dynamic.InlinedRequest;\n inlinePathParameters: boolean;\n }): boolean {\n return inlinePathParameters && (request.metadata?.includePathParameters ?? false);\n }\n\n public isFileUploadRequestBody(\n body: FernIr.dynamic.InlinedRequestBody\n ): body is FernIr.dynamic.InlinedRequestBody.FileUpload {\n switch (body.type) {\n case \"fileUpload\":\n return true;\n case \"properties\":\n case \"referenced\":\n return false;\n default:\n assertNever(body);\n }\n }\n\n public resolveEnvironmentName(environmentID: string): FernIr.Name | undefined {\n if (this._ir.environments == null) {\n return undefined;\n }\n const environments = this._ir.environments.environments;\n switch (environments.type) {\n case \"singleBaseUrl\": {\n const environment = environments.environments.find((env) => env.id === environmentID);\n if (environment == null) {\n return undefined;\n }\n return environment.name;\n }\n case \"multipleBaseUrls\": {\n const environment = environments.environments.find((env) => env.id === environmentID);\n if (environment == null) {\n return undefined;\n }\n return environment.name;\n }\n default:\n assertNever(environments);\n }\n }\n\n public isSingleEnvironmentID(\n environment: FernIr.dynamic.EnvironmentValues\n ): environment is FernIr.dynamic.EnvironmentId {\n return typeof environment === \"string\";\n }\n\n public isMultiEnvironmentValues(\n environment: FernIr.dynamic.EnvironmentValues\n ): environment is FernIr.dynamic.MultipleEnvironmentUrlValues {\n return typeof environment === \"object\";\n }\n\n public validateMultiEnvironmentUrlValues(\n multiEnvironmentUrlValues: FernIr.dynamic.MultipleEnvironmentUrlValues\n ): boolean {\n if (this._ir.environments == null) {\n this.errors.add({\n severity: Severity.Critical,\n message:\n \"Multiple environments are not supported for single base URL environments; use the baseUrl option instead\"\n });\n return false;\n }\n const environments = this._ir.environments.environments;\n switch (environments.type) {\n case \"singleBaseUrl\": {\n this.errors.add({\n severity: Severity.Critical,\n message:\n \"Multiple environments are not supported for single base URL environments; use the baseUrl option instead\"\n });\n return false;\n }\n case \"multipleBaseUrls\": {\n const firstEnvironment = environments.environments[0];\n if (firstEnvironment == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: \"Multiple environments are not supported; use the baseUrl option instead\"\n });\n return false;\n }\n const expectedKeys = new Set(keys(firstEnvironment.urls));\n for (const key of keys(multiEnvironmentUrlValues)) {\n if (expectedKeys.has(key)) {\n expectedKeys.delete(key);\n }\n }\n if (expectedKeys.size > 0) {\n this.errors.add({\n severity: Severity.Critical,\n message: `The provided environments are invalid; got: [${Object.keys(multiEnvironmentUrlValues).join(\", \")}], expected: [${keys(firstEnvironment.urls).join(\", \")}]`\n });\n return false;\n }\n return true;\n }\n }\n }\n\n public getValueAsNumber({ value }: { value: unknown }): number | undefined {\n if (typeof value !== \"number\") {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newTypeMismatchError({ expected: \"number\", value }).message\n });\n return undefined;\n }\n return value;\n }\n\n public getValueAsBoolean({ value }: { value: unknown }): boolean | undefined {\n if (typeof value !== \"boolean\") {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newTypeMismatchError({ expected: \"boolean\", value }).message\n });\n return undefined;\n }\n return value;\n }\n\n public getValueAsString({ value }: { value: unknown }): string | undefined {\n if (typeof value !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newTypeMismatchError({ expected: \"string\", value }).message\n });\n return undefined;\n }\n return value;\n }\n\n public isOptional(typeReference: FernIr.dynamic.TypeReference): boolean {\n switch (typeReference.type) {\n case \"nullable\":\n return this.isOptional(typeReference.value);\n case \"optional\":\n return true;\n case \"named\": {\n const resolvedType = this.resolveNamedType({ typeId: typeReference.value });\n if (resolvedType == null) {\n return false;\n }\n if (resolvedType.type === \"alias\") {\n return this.isNullable(resolvedType.typeReference);\n }\n return false;\n }\n }\n return false;\n }\n\n public isNullable(typeReference: FernIr.dynamic.TypeReference): boolean {\n switch (typeReference.type) {\n case \"nullable\":\n return true;\n case \"optional\":\n return this.isNullable(typeReference.value);\n case \"named\": {\n const resolvedType = this.resolveNamedType({ typeId: typeReference.value });\n if (resolvedType == null) {\n return false;\n }\n if (resolvedType.type === \"alias\") {\n return this.isNullable(resolvedType.typeReference);\n }\n return false;\n }\n }\n return false;\n }\n\n public newAuthMismatchError({\n auth,\n values\n }: {\n auth: FernIr.dynamic.Auth;\n values: FernIr.dynamic.AuthValues;\n }): Error {\n return new Error(`Expected auth type ${auth.type}, got ${values.type}`);\n }\n\n public newParameterNotRecognizedError(parameterName: string): Error {\n return new Error(`\"${parameterName}\" is not a recognized parameter for this endpoint`);\n }\n\n public newTypeMismatchError({ expected, value }: { expected: string; value: unknown }): Error {\n return new Error(`Expected ${expected}, got ${typeof value}`);\n }\n\n private includeRequestBodyInWrappedRequest({\n body,\n inlineFileProperties\n }: {\n body: FernIr.dynamic.InlinedRequestBody;\n inlineFileProperties: boolean;\n }): boolean {\n switch (body.type) {\n case \"properties\":\n case \"referenced\":\n return true;\n case \"fileUpload\":\n return this.includeFileUploadBodyInWrappedRequest({ fileUpload: body, inlineFileProperties });\n default:\n assertNever(body);\n }\n }\n\n private includeFileUploadBodyInWrappedRequest({\n fileUpload,\n inlineFileProperties\n }: {\n fileUpload: FernIr.dynamic.FileUploadRequestBody;\n inlineFileProperties: boolean;\n }): boolean {\n return (\n this.fileUploadHasBodyProperties({ fileUpload }) ||\n (inlineFileProperties && this.fileUploadHasFileProperties({ fileUpload }))\n );\n }\n\n private fileUploadHasBodyProperties({ fileUpload }: { fileUpload: FernIr.dynamic.FileUploadRequestBody }): boolean {\n return fileUpload.properties.some((property) => {\n switch (property.type) {\n case \"file\":\n case \"fileArray\":\n return false;\n case \"bodyProperty\":\n return true;\n default:\n assertNever(property);\n }\n });\n }\n\n private fileUploadHasFileProperties({ fileUpload }: { fileUpload: FernIr.dynamic.FileUploadRequestBody }): boolean {\n return fileUpload.properties.some((property) => {\n switch (property.type) {\n case \"file\":\n case \"fileArray\":\n return true;\n case \"bodyProperty\":\n return false;\n default:\n assertNever(property);\n }\n });\n }\n\n private isListTypeReference(typeReference: FernIr.dynamic.TypeReference): boolean {\n if (typeReference.type === \"optional\") {\n return this.isListTypeReference(typeReference.value);\n }\n return typeReference.type === \"list\" || typeReference.type === \"set\";\n }\n\n private parsedEndpointMatches({\n endpoint,\n parsedEndpoint\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n parsedEndpoint: HttpEndpointReferenceParser.Parsed;\n }): boolean {\n return endpoint.location.method === parsedEndpoint.method && endpoint.location.path === parsedEndpoint.path;\n }\n}\n","export { EXAMPLE_REFERENCE_PREFIX, YAML_SCHEMA_VERSION } from \"./constants\";\nexport { type NodePath, type NodePathItem } from \"./NodePath\";\nexport * as RawSchemas from \"./schemas\";\nexport { type DefinitionFileSchema, type PackageMarkerFileSchema, type RootApiFileSchema } from \"./schemas\";\nexport * from \"./utils/auth\";\nexport * from \"./utils/generics\";\nexport { getRequestBody } from \"./utils/getRequestBody\";\nexport { getResponseBodyType } from \"./utils/getResponseBodyType\";\nexport { HttpEndpointReferenceParser } from \"./utils/HttpEndpointReferenceParser\";\nexport { isInlineRequestBody } from \"./utils/isInlineRequestBody\";\nexport { isOpenApiSourceSchema } from \"./utils/isOpenApiSourceSchema\";\nexport { isRawProtobufSourceSchema } from \"./utils/isRawProtobufSourceSchema\";\nexport { isRawTextType } from \"./utils/isRawTextType\";\nexport { type BytesRequest, parseBytesRequest } from \"./utils/parseBytesRequest\";\nexport { parseFileUploadRequest, type RawFileUploadRequest } from \"./utils/parseFileUploadRequest\";\nexport { parseRawBytesType, type RawBytesType } from \"./utils/parseRawBytesType\";\nexport { parseRawFileType, type RawFileType } from \"./utils/parseRawFileType\";\nexport { parseRawTextType, type RawTextType } from \"./utils/parseRawTextType\";\nexport { RawPrimitiveType } from \"./utils/RawPrimitiveType\";\nexport { recursivelyVisitRawTypeReference } from \"./utils/recursivelyVisitRawTypeReference\";\nexport { visitExampleCodeSampleSchema } from \"./utils/visitExampleCodeSampleSchema\";\nexport { type ExampleResponseSchemaVisitor, visitExampleResponseSchema } from \"./utils/visitExampleResponseSchema\";\nexport { isAnyAuthSchemes, isSingleAuthScheme, type RawApiAuthVisitor, visitRawApiAuth } from \"./utils/visitRawApiAuth\";\nexport {\n type AuthSchemeDeclarationVisitor,\n isHeaderAuthScheme,\n visitRawAuthSchemeDeclaration\n} from \"./utils/visitRawAuthSchemeDeclaration\";\nexport {\n isRawMultipleBaseUrlsEnvironment,\n isRawSingleBaseUrlEnvironment,\n visitRawEnvironmentDeclaration\n} from \"./utils/visitRawEnvironmentDeclaration\";\nexport {\n isVariablePathParameter,\n type PathParameterDeclarationVisitor,\n visitRawPathParameter\n} from \"./utils/visitRawPathParameter\";\nexport {\n isRawAliasDefinition,\n isRawDiscriminatedUnionDefinition,\n isRawEnumDefinition,\n isRawObjectDefinition,\n isRawUndiscriminatedUnionDefinition,\n type RawTypeDeclarationVisitor,\n visitRawTypeDeclaration\n} from \"./utils/visitRawTypeDeclaration\";\nexport { FernContainerRegex, visitRawTypeReference } from \"./utils/visitRawTypeReference\";\n","export declare namespace HttpEndpointReferenceParser {\n interface Parsed {\n path: string;\n method: Method;\n }\n\n type Method = \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\" | \"HEAD\";\n\n export type ValidationResult = Valid | Invalid;\n\n interface Valid {\n type: \"valid\";\n }\n\n interface Invalid {\n type: \"invalid\";\n }\n}\n\n/**\n * Parses an HTTP endpoint reference like `POST /users/get`\n */\nexport class HttpEndpointReferenceParser {\n //eslint-disable-next-line\n private REFERENCE_REGEX = /^(GET|POST|PUT|DELETE|PATCH|HEAD)\\s(\\/\\S*)$/;\n\n public validate(reference: string): HttpEndpointReferenceParser.ValidationResult {\n const validFormat = this.REFERENCE_REGEX.test(reference);\n if (!validFormat) {\n return { type: \"invalid\" };\n }\n return { type: \"valid\" };\n }\n\n public tryParse(reference: string): HttpEndpointReferenceParser.Parsed | undefined {\n const validationResponse = this.validate(reference);\n if (validationResponse.type === \"invalid\") {\n return undefined;\n }\n const match = reference.match(this.REFERENCE_REGEX);\n if (match == null || match[1] == null || match[2] == null) {\n return undefined;\n }\n return {\n method: match[1] as HttpEndpointReferenceParser.Method,\n path: match[2]\n };\n }\n}\n","export const Scope = {\n PathParameters: \"pathParameters\",\n QueryParameters: \"queryParameters\",\n Headers: \"headers\",\n RequestBody: \"requestBody\"\n} as const;\n\nexport type Scope = (typeof Scope)[keyof typeof Scope];\n","export { AbstractDynamicSnippetsGenerator } from \"./AbstractDynamicSnippetsGenerator\";\nexport { AbstractDynamicSnippetsGeneratorContext } from \"./AbstractDynamicSnippetsGeneratorContext\";\nexport { type DiscriminatedUnionTypeInstance } from \"./DiscriminatedUnionTypeInstance\";\nexport { ErrorReporter, Severity } from \"./ErrorReporter\";\nexport { type Options, Style } from \"./Options\";\nexport { Result } from \"./Result\";\nexport { Scope } from \"./Scope\";\nexport { type TypeInstance } from \"./TypeInstance\";\nexport { DynamicSnippetsTestRunner } from \"./test-utils/DynamicSnippetsTestRunner\";\n"],"mappings":"2FAKAA,IAAAC,ICAAC,IAAAC,IAAM,IAAOC,EAAP,KAAa,CAKf,aAAA,CAJOC,EAAA,iBACAA,EAAA,gBACAA,EAAA,YAGH,KAAK,QAAU,OACf,KAAK,SAAW,OAChB,KAAK,IAAM,MACf,CAEO,OAAO,CAAE,QAAAC,EAAS,QAAAC,CAAO,EAAyE,CACj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ChB,gBAAiB,kBACjB,QAAS,UACT,YAAa,eCJjBC,IAAAC","names":["init_process","init_buffer","init_process","init_buffer","Result","__publicField","context","snippet","endpoint","_a","reporter","_b","AbstractDynamicSnippetsGenerator","context","__publicField","request","options","endpoints","result","Result","endpoint","snippetGenerator","snippet","error","init_process","init_buffer","Severity","ErrorReporter","_ErrorReporter","__publicField","err","__spreadProps","__spreadValues","path","severity","clone","result","item","init_process","init_buffer","init_process","init_buffer","init_process","init_buffer","HttpEndpointReferenceParser","__publicField","reference","match","AbstractDynamicSnippetsGeneratorContext","ir","config","options","__publicField","ErrorReporter","HttpEndpointReferenceParser","parameters","values","instances","key","value","parameter","param","typeInstanceValue","Severity","ignoreMissingParameters","snippetObject","objectRecord","property","record","fileValue","fileArrayValue","stringValues","typeId","namedType","discriminatedUnion","discriminantFieldName","discriminantValue","singleDiscriminatedUnionType","_a","_","filtered","__objRest","__restKey","rawEndpoint","parsedEndpoint","location","endpoints","endpoint","request","inlinePathParameters","inlineFileProperties","_b","body","assertNever","environmentID","environments","environment","env","multiEnvironmentUrlValues","firstEnvironment","expectedKeys","keys","typeReference","resolvedType","auth","parameterName","expected","fileUpload","init_process","init_buffer","Scope","init_process","init_buffer"]}
@@ -1,2 +0,0 @@
1
- import{a}from"./chunk-ADZ6FCNI.js";import{a as i}from"./chunk-PZ73VBNX.js";import{a as p}from"./chunk-FTDA4363.js";import{e as r,f as n,g as o}from"./chunk-JHIUGKJ4.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-GDQPUUAY.js.map
@@ -1 +0,0 @@
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"]}