@fern-api/csharp-dynamic-snippets 0.0.6 → 2.11.0

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 (48) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +13 -13
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
  3. package/cjs/DynamicSnippetsGenerator.d.cts +1 -1
  4. package/cjs/{DynamicSnippetsGeneratorContext-DhvOZIoP.d.cts → DynamicSnippetsGeneratorContext-pehoeH_w.d.cts} +9 -0
  5. package/cjs/EndpointSnippetGenerator.cjs.map +1 -1
  6. package/cjs/EndpointSnippetGenerator.d.cts +1 -1
  7. package/cjs/context/DynamicLiteralMapper.cjs +1 -1
  8. package/cjs/context/DynamicLiteralMapper.d.cts +1 -1
  9. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +1 -1
  10. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -1
  11. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
  12. package/cjs/context/DynamicTypeMapper.d.cts +1 -1
  13. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  14. package/cjs/index.cjs +13 -13
  15. package/cjs/index.cjs.map +1 -1
  16. package/cjs/index.d.cts +1 -1
  17. package/esm/DynamicSnippetsGenerator.d.ts +1 -1
  18. package/esm/DynamicSnippetsGenerator.js +1 -1
  19. package/esm/{DynamicSnippetsGeneratorContext-DhvOZIoP.d.ts → DynamicSnippetsGeneratorContext-pehoeH_w.d.ts} +9 -0
  20. package/esm/EndpointSnippetGenerator.d.ts +1 -1
  21. package/esm/EndpointSnippetGenerator.js +1 -1
  22. package/esm/{chunk-LWJEMG53.js → chunk-3XDW3MPR.js} +2 -2
  23. package/esm/{chunk-QALVTPA5.js → chunk-CEB5TOCF.js} +2 -2
  24. package/esm/{chunk-QALVTPA5.js.map → chunk-CEB5TOCF.js.map} +1 -1
  25. package/esm/{chunk-WP3GAWOR.js → chunk-DBQMCX7L.js} +2 -2
  26. package/esm/{chunk-ZEEJAJ4K.js → chunk-EC2FLIE6.js} +2 -2
  27. package/esm/{chunk-TVSKLWL4.js → chunk-EUEE2577.js} +2 -2
  28. package/esm/{chunk-TOOGWICF.js → chunk-GEII674B.js} +2 -2
  29. package/esm/{chunk-A53BGSGD.js → chunk-KFPJC632.js} +2 -2
  30. package/esm/{chunk-PRAGN765.js → chunk-KIW23CQ5.js} +2 -2
  31. package/esm/{chunk-PRAGN765.js.map → chunk-KIW23CQ5.js.map} +1 -1
  32. package/esm/context/DynamicLiteralMapper.d.ts +1 -1
  33. package/esm/context/DynamicLiteralMapper.js +1 -1
  34. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
  35. package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
  36. package/esm/context/DynamicTypeMapper.d.ts +1 -1
  37. package/esm/context/DynamicTypeMapper.js +1 -1
  38. package/esm/context/FilePropertyMapper.d.ts +1 -1
  39. package/esm/context/FilePropertyMapper.js +1 -1
  40. package/esm/index.d.ts +1 -1
  41. package/esm/index.js +1 -1
  42. package/package.json +1 -1
  43. /package/esm/{chunk-LWJEMG53.js.map → chunk-3XDW3MPR.js.map} +0 -0
  44. /package/esm/{chunk-WP3GAWOR.js.map → chunk-DBQMCX7L.js.map} +0 -0
  45. /package/esm/{chunk-ZEEJAJ4K.js.map → chunk-EC2FLIE6.js.map} +0 -0
  46. /package/esm/{chunk-TVSKLWL4.js.map → chunk-EUEE2577.js.map} +0 -0
  47. /package/esm/{chunk-TOOGWICF.js.map → chunk-GEII674B.js.map} +0 -0
  48. /package/esm/{chunk-A53BGSGD.js.map → chunk-KFPJC632.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{e as s,f as l,h as n,k as c}from"./chunk-QALVTPA5.js";var p=class extends c{constructor({context:a}){super(a.generation);s(this,"context");this.context=a}getFilePropertyInfo({body:a,value:i}){var o;let t={fileFields:[],bodyPropertyFields:[]},r=(o=this.context.getRecord(i))!=null?o:{};for(let e of a.properties)switch(e.type){case"file":n.Record.missingKey(r,e.wireValue)&&(r[e.wireValue]="[bytes]"),t.fileFields.push({name:this.context.getPropertyName(e.name),value:this.getSingleFileProperty({property:e,record:r})});break;case"fileArray":n.Record.missingKey(r,e.wireValue)&&(r[e.wireValue]=["[bytes]"]),t.fileFields.push({name:this.context.getPropertyName(e.name),value:this.getArrayFileProperty({property:e,record:r})});break;case"bodyProperty":if(n.Record.missingKey(r,e.name.wireValue))switch(e.typeReference.type){case"optional":break;case"primitive":{switch(e.typeReference.value.toLowerCase()){case"integer":{r[e.name.wireValue]=123;break}case"string":{r[e.name.wireValue]="[string]";break}case"boolean":{r[e.name.wireValue]=!0;break}case"double":{r[e.name.wireValue]=123.456;break}case"float":{r[e.name.wireValue]=123.456;break}case"long":{r[e.name.wireValue]=123456789;break}case"uint":{r[e.name.wireValue]=123;break}case"uint64":{r[e.name.wireValue]=12345;break}case"date":{r[e.name.wireValue]=new Date(2021,1,1);break}case"datetime":{r[e.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{r[e.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{r[e.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{r[e.name.wireValue]="12345678901234567890";break}}break}default:break}t.bodyPropertyFields.push({name:this.context.getPropertyName(e.name.name),value:this.getBodyProperty({property:e,record:r})});break;default:l(e)}return t}getSingleFileProperty({property:a,record:i}){let t=this.context.getSingleFileValue({property:a,record:i});return t==null?this.csharp.Literal.nop():this.context.getFileParameterForString(t)}getArrayFileProperty({property:a,record:i}){let t=this.context.getFileArrayValues({property:a,record:i});return t==null?this.csharp.Literal.nop():this.csharp.Literal.list({valueType:this.Types.FileParameter,values:t.map(r=>this.context.getFileParameterForString(r))})}getBodyProperty({property:a,record:i}){let t=i[a.name.wireValue];return t==null?this.csharp.Literal.nop():this.context.dynamicLiteralMapper.convert({typeReference:a.typeReference,value:t})}};export{p as a};
2
- //# sourceMappingURL=chunk-WP3GAWOR.js.map
1
+ import{e as s,f as l,h as n,k as c}from"./chunk-CEB5TOCF.js";var p=class extends c{constructor({context:a}){super(a.generation);s(this,"context");this.context=a}getFilePropertyInfo({body:a,value:i}){var o;let t={fileFields:[],bodyPropertyFields:[]},r=(o=this.context.getRecord(i))!=null?o:{};for(let e of a.properties)switch(e.type){case"file":n.Record.missingKey(r,e.wireValue)&&(r[e.wireValue]="[bytes]"),t.fileFields.push({name:this.context.getPropertyName(e.name),value:this.getSingleFileProperty({property:e,record:r})});break;case"fileArray":n.Record.missingKey(r,e.wireValue)&&(r[e.wireValue]=["[bytes]"]),t.fileFields.push({name:this.context.getPropertyName(e.name),value:this.getArrayFileProperty({property:e,record:r})});break;case"bodyProperty":if(n.Record.missingKey(r,e.name.wireValue))switch(e.typeReference.type){case"optional":break;case"primitive":{switch(e.typeReference.value.toLowerCase()){case"integer":{r[e.name.wireValue]=123;break}case"string":{r[e.name.wireValue]="[string]";break}case"boolean":{r[e.name.wireValue]=!0;break}case"double":{r[e.name.wireValue]=123.456;break}case"float":{r[e.name.wireValue]=123.456;break}case"long":{r[e.name.wireValue]=123456789;break}case"uint":{r[e.name.wireValue]=123;break}case"uint64":{r[e.name.wireValue]=12345;break}case"date":{r[e.name.wireValue]=new Date(2021,1,1);break}case"datetime":{r[e.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{r[e.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{r[e.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{r[e.name.wireValue]="12345678901234567890";break}}break}default:break}t.bodyPropertyFields.push({name:this.context.getPropertyName(e.name.name),value:this.getBodyProperty({property:e,record:r})});break;default:l(e)}return t}getSingleFileProperty({property:a,record:i}){let t=this.context.getSingleFileValue({property:a,record:i});return t==null?this.csharp.Literal.nop():this.context.getFileParameterForString(t)}getArrayFileProperty({property:a,record:i}){let t=this.context.getFileArrayValues({property:a,record:i});return t==null?this.csharp.Literal.nop():this.csharp.Literal.list({valueType:this.Types.FileParameter,values:t.map(r=>this.context.getFileParameterForString(r))})}getBodyProperty({property:a,record:i}){let t=i[a.name.wireValue];return t==null?this.csharp.Literal.nop():this.context.dynamicLiteralMapper.convert({typeReference:a.typeReference,value:t})}};export{p as a};
2
+ //# sourceMappingURL=chunk-DBQMCX7L.js.map
@@ -1,4 +1,4 @@
1
- import{b as l,d as R,e as i}from"./chunk-PRAGN765.js";import{a as b,b as v,e as w,f as m,h as A,i as F,k as E}from"./chunk-QALVTPA5.js";var Te=typeof global=="object"&&global&&global.Object===Object&&global,k=Te;var Me=typeof self=="object"&&self&&self.Object===Object&&self,Ue=k||Me||Function("return this")(),T=Ue;var We=T.Symbol,d=We;var M=Object.prototype,je=M.hasOwnProperty,De=M.toString,h=d?d.toStringTag:void 0;function Ve(r){var s=je.call(r,h),e=r[h];try{r[h]=void 0;var t=!0}catch(o){}var a=De.call(r);return t&&(s?r[h]=e:delete r[h]),a}var U=Ve;var ze=Object.prototype,He=ze.toString;function Ge(r){return He.call(r)}var W=Ge;var Ze="[object Null]",Je="[object Undefined]",j=d?d.toStringTag:void 0;function Ke(r){return r==null?r===void 0?Je:Ze:j&&j in Object(r)?U(r):W(r)}var D=Ke;function _e(r){return r!=null&&typeof r=="object"}var V=_e;var $e="[object Symbol]";function Ye(r){return typeof r=="symbol"||V(r)&&D(r)==$e}var z=Ye;function Qe(r,s){for(var e=-1,t=r==null?0:r.length,a=Array(t);++e<t;)a[e]=s(r[e],e,r);return a}var H=Qe;var Xe=Array.isArray,G=Xe;var et=1/0,Z=d?d.prototype:void 0,J=Z?Z.toString:void 0;function K(r){if(typeof r=="string")return r;if(G(r))return H(r,K)+"";if(z(r))return J?J.call(r):"";var s=r+"";return s=="0"&&1/r==-et?"-0":s}var _=K;function tt(r){return r==null?"":_(r)}var p=tt;function rt(r,s,e){var t=-1,a=r.length;s<0&&(s=-s>a?0:a+s),e=e>a?a:e,e<0&&(e+=a),a=s>e?0:e-s>>>0,s>>>=0;for(var o=Array(a);++t<a;)o[t]=r[t+s];return o}var $=rt;function at(r,s,e){var t=r.length;return e=e===void 0?t:e,!s&&e>=t?r:$(r,s,e)}var Y=at;var ot="\\ud800-\\udfff",st="\\u0300-\\u036f",nt="\\ufe20-\\ufe2f",ft="\\u20d0-\\u20ff",ut=st+nt+ft,it="\\ufe0e\\ufe0f",dt="\\u200d",lt=RegExp("["+dt+ot+ut+it+"]");function pt(r){return lt.test(r)}var I=pt;function mt(r){return r.split("")}var Q=mt;var X="\\ud800-\\udfff",ct="\\u0300-\\u036f",xt="\\ufe20-\\ufe2f",ht="\\u20d0-\\u20ff",gt=ct+xt+ht,yt="\\ufe0e\\ufe0f",bt="["+X+"]",S="["+gt+"]",P="\\ud83c[\\udffb-\\udfff]",vt="(?:"+S+"|"+P+")",ee="[^"+X+"]",te="(?:\\ud83c[\\udde6-\\uddff]){2}",re="[\\ud800-\\udbff][\\udc00-\\udfff]",Rt="\\u200d",ae=vt+"?",oe="["+yt+"]?",At="(?:"+Rt+"(?:"+[ee,te,re].join("|")+")"+oe+ae+")*",It=oe+ae+At,Ct="(?:"+[ee+S+"?",S,te,re,bt].join("|")+")",Ft=RegExp(P+"(?="+P+")|"+Ct+It,"g");function St(r){return r.match(Ft)||[]}var se=St;function Pt(r){return I(r)?se(r):Q(r)}var ne=Pt;function Bt(r){return function(s){s=p(s);var e=I(s)?ne(s):void 0,t=e?e[0]:s.charAt(0),a=e?Y(e,1).join(""):s.slice(1);return t[r]()+a}}var fe=Bt;var Lt=fe("toUpperCase"),g=Lt;function Ot(r){return g(p(r).toLowerCase())}var ue=Ot;function Nt(r,s,e,t){var a=-1,o=r==null?0:r.length;for(t&&o&&(e=r[++a]);++a<o;)e=s(e,r[a],a,r);return e}var ie=Nt;function qt(r){return function(s){return r==null?void 0:r[s]}}var de=qt;var wt={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Et=de(wt),le=Et;var kt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Tt="\\u0300-\\u036f",Mt="\\ufe20-\\ufe2f",Ut="\\u20d0-\\u20ff",Wt=Tt+Mt+Ut,jt="["+Wt+"]",Dt=RegExp(jt,"g");function Vt(r){return r=p(r),r&&r.replace(kt,le).replace(Dt,"")}var pe=Vt;var zt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Ht(r){return r.match(zt)||[]}var me=Ht;var Gt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Zt(r){return Gt.test(r)}var ce=Zt;var be="\\ud800-\\udfff",Jt="\\u0300-\\u036f",Kt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",$t=Jt+Kt+_t,ve="\\u2700-\\u27bf",Re="a-z\\xdf-\\xf6\\xf8-\\xff",Yt="\\xac\\xb1\\xd7\\xf7",Qt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Xt="\\u2000-\\u206f",er=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ae="A-Z\\xc0-\\xd6\\xd8-\\xde",tr="\\ufe0e\\ufe0f",Ie=Yt+Qt+Xt+er,Ce="['\u2019]",xe="["+Ie+"]",rr="["+$t+"]",Fe="\\d+",ar="["+ve+"]",Se="["+Re+"]",Pe="[^"+be+Ie+Fe+ve+Re+Ae+"]",or="\\ud83c[\\udffb-\\udfff]",sr="(?:"+rr+"|"+or+")",nr="[^"+be+"]",Be="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",x="["+Ae+"]",fr="\\u200d",he="(?:"+Se+"|"+Pe+")",ur="(?:"+x+"|"+Pe+")",ge="(?:"+Ce+"(?:d|ll|m|re|s|t|ve))?",ye="(?:"+Ce+"(?:D|LL|M|RE|S|T|VE))?",Oe=sr+"?",Ne="["+tr+"]?",ir="(?:"+fr+"(?:"+[nr,Be,Le].join("|")+")"+Ne+Oe+")*",dr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",lr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",pr=Ne+Oe+ir,mr="(?:"+[ar,Be,Le].join("|")+")"+pr,cr=RegExp([x+"?"+Se+"+"+ge+"(?="+[xe,x,"$"].join("|")+")",ur+"+"+ye+"(?="+[xe,x+he,"$"].join("|")+")",x+"?"+he+"+"+ge,x+"+"+ye,lr,dr,Fe,mr].join("|"),"g");function xr(r){return r.match(cr)||[]}var qe=xr;function hr(r,s,e){return r=p(r),s=e?void 0:s,s===void 0?ce(r)?qe(r):me(r):r.match(s)||[]}var we=hr;var gr="['\u2019]",yr=RegExp(gr,"g");function br(r){return function(s){return ie(we(pe(s).replace(yr,"")),r,"")}}var Ee=br;var vr=Ee(function(r,s,e){return s=s.toLowerCase(),r+(e?ue(s):s)}),B=vr;var ke=class extends E{constructor({context:e}){super(e.generation);w(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t,options:a}){return this.buildCodeBlock({endpoint:e,snippet:t,options:a}).toString({namespace:"Usage",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map})}generateSnippetSync({endpoint:e,request:t,options:a}){return this.buildCodeBlock({endpoint:e,snippet:t,options:a}).toString({namespace:"Usage",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map})}async generateSnippetAst({endpoint:e,request:t,options:a}){throw new Error("Unsupported")}buildCodeBlock({endpoint:e,snippet:t,options:a}){var f;if(e.examples&&!((f=e.examples)!=null&&f.find(u=>A.DynamicIR.EndpointExample(t)&&u.id===t.id)))throw new Error("Endpoint does not have an example that matches the snippet");let o=this.csharp.codeblock(u=>{u.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),u.newLine(),u.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))}),n=this.getStyle(a);switch(n){case R.Concise:return o;case R.Full:return this.buildFullCodeBlock({body:o,options:a});default:m(n)}}buildFullCodeBlock({body:e,options:t}){var n;let a=this.getConfig(t),o=this.csharp.class_({name:(n=a.fullStyleClassName)!=null?n:"Example",namespace:"Usage",access:F.Access.Public});return o.addNamespaceReference(this.Types.RootClient.namespace),o.addMethod({name:"Do",access:F.Access.Public,isAsync:!0,parameters:[],body:e}),o}constructClient({endpoint:e,snippet:t}){return this.csharp.codeblock(a=>{a.write("var client = "),a.writeNode(this.getRootClientConstructorInvocation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){var n,f;let a=((n=e.response)==null?void 0:n.type)==="streaming"||((f=e.response)==null?void 0:f.type)==="streamParameter",o=this.csharp.invokeMethod({on:this.csharp.codeblock("client"),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t}),async:!0,configureAwait:!0,multiline:!0,isAsyncEnumerable:a});return a?this.csharp.codeblock(u=>{u.write("await foreach (var item in "),u.writeNode(o),u.writeLine(")"),u.pushScope(),u.writeLine("/* consume each item */"),u.popScope()}):o}getConstructorArgs({endpoint:e,snippet:t}){let a=[];e.auth!=null&&(t.auth!=null?a.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:l.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let o=[],n=this.getConstructorBaseUrlArgs({baseUrl:t.baseURL,environment:t.environment});n.length>0&&o.push(...n),this.context.errors.scope(i.Headers);let f=[];return this.context.ir.headers!=null&&t.headers!=null&&f.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),o.length===0?[...a,...f]:[...a,...f,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:o.map(u=>({name:u.name,assignment:u.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:e,environment:t}){let a=this.getBaseUrlArg({baseUrl:e,environment:t});return A.Literal.nop(a)?[]:[{name:this.getBaseUrlOptionName(),assignment:a}]}getBaseUrlArg({baseUrl:e,environment:t}){var a;if(e!=null&&t!=null)return this.context.errors.add({severity:l.Critical,message:"Cannot specify both baseUrl and environment options"}),this.csharp.Literal.nop();if(e!=null)return((a=this.context.ir.environments)==null?void 0:a.environments.type)==="multipleBaseUrls"?(this.context.errors.add({severity:l.Critical,message:"The C# SDK doesn't support a baseUrl when multiple URL environments are configured"}),this.csharp.Literal.nop()):this.csharp.Literal.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let o=this.context.getEnvironmentTypeReferenceFromID(t);return o==null?(this.context.errors.add({severity:l.Warning,message:`Environment ${JSON.stringify(t)} was not found`}),this.csharp.Literal.nop()):this.csharp.Literal.reference(o)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.Environments,arguments_:Object.entries(t).map(([o,n])=>({name:g(B(o)),assignment:this.context.dynamicLiteralMapper.convert({typeReference:{type:"primitive",value:"STRING"},value:n})})),multiline:!0})):this.csharp.Literal.nop()}return this.csharp.Literal.nop()}getConstructorAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getConstructorBasicAuthArg({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getConstructorBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getConstructorHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getConstructorOAuthArgs({auth:e,values:t}):[];case"inferred":return this.addWarning("The C# SDK Generator does not support Inferred auth scheme yet"),[];default:m(e)}}addError(e){this.context.errors.add({severity:l.Critical,message:e})}addWarning(e){this.context.errors.add({severity:l.Warning,message:e})}getConstructorBasicAuthArg({auth:e,values:t}){return[{name:this.context.getParameterName(e.username),assignment:this.csharp.Literal.string(t.username)},{name:this.context.getParameterName(e.password),assignment:this.csharp.Literal.string(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.token),assignment:this.csharp.Literal.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.header.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value,fallbackToDefault:e.header.name.wireValue})}]}getConstructorOAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.clientId),assignment:this.csharp.Literal.string(t.clientId)},{name:this.context.getParameterName(e.clientSecret),assignment:this.csharp.Literal.string(t.clientSecret)}]}getConstructorHeaderArgs({headers:e,values:t}){let a=[];for(let o of e){let n=this.getConstructorHeaderArg({header:o,value:t.value});n!=null&&a.push({name:this.context.getParameterName(o.name.name),assignment:n})}return a}getConstructorHeaderArg({header:e,value:t}){let a=this.context.dynamicLiteralMapper.convert({typeReference:e.typeReference,value:t,fallbackToDefault:e.name.wireValue});if(!A.Literal.nop(a))return a}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)}}getMethodArgsForInlinedRequest({request:e,snippet:t}){var u,y;let a=[];this.context.errors.scope(i.PathParameters);let o=[],n=[...(u=this.context.ir.pathParameters)!=null?u:[],...(y=e.pathParameters)!=null?y:[]];n.length>0&&o.push(...this.getPathParameters({namedParameters:n,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(i.RequestBody);let f=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:this.settings.shouldInlinePathParameters})||a.push(...o.map(C=>C.value)),a.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:this.settings.shouldInlinePathParameters})?o:[],filePropertyInfo:f})),a}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:a,filePropertyInfo:o}){var L,O,N,q;this.context.errors.scope(i.QueryParameters);let f=this.context.associateQueryParametersByWireValue({parameters:(L=e.queryParameters)!=null?L:[],values:(O=t.queryParameters)!=null?O:{}}).map(c=>({name:this.context.getPropertyName(c.name.name),value:this.context.dynamicLiteralMapper.convert(c)}));this.context.errors.unscope(),this.context.errors.scope(i.Headers);let y=this.context.associateByWireValue({parameters:(N=e.headers)!=null?N:[],values:(q=t.headers)!=null?q:{}}).map(c=>({name:this.context.getPropertyName(c.name.name),value:this.context.dynamicLiteralMapper.convert(v(b({},c),{fallbackToDefault:c.name.wireValue}))}));this.context.errors.unscope(),this.context.errors.scope(i.RequestBody);let C=e.body!=null?this.getInlinedRequestBodyConstructorFields({body:e.body,value:t.requestBody,filePropertyInfo:o}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}),fields:[...a,...f,...y,...C]})}getInlinedRequestBodyConstructorFields({body:e,value:t,filePropertyInfo:a}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:a});default:m(e)}}getInlinedRequestBodyPropertyConstructorFields({parameters:e,value:t}){var n;let a=[],o=this.context.associateByWireValue({parameters:e,values:(n=this.context.getRecord(t))!=null?n:{}});for(let f of o)a.push({name:this.context.getPropertyName(f.name.name),value:this.context.dynamicLiteralMapper.convert(v(b({},f),{fallbackToDefault:f.name.wireValue}))});return a}getFileUploadRequestBodyConstructorFields({filePropertyInfo:e}){return[...e.fileFields,...e.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:e,value:t}){return{name:this.context.getPropertyName(e.bodyKey),value:this.getReferencedRequestBodyPropertyLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicLiteralMapper.convert({typeReference:e.value,value:t,fallbackToDefault:JSON.stringify(e.value)});default:m(e)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var n,f;let a=[];this.context.errors.scope(i.PathParameters);let o=[...(n=this.context.ir.pathParameters)!=null?n:[],...(f=e.pathParameters)!=null?f:[]];return o.length>0&&a.push(...this.getPathParameters({namedParameters:o,snippet:t}).map(u=>u.value)),this.context.errors.unscope(),this.context.errors.scope(i.RequestBody),e.body!=null&&a.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),a}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return e.value.type==="optional"&&t==null?this.csharp.Literal.null():this.context.dynamicLiteralMapper.convert({typeReference:e.value,value:t,fallbackToDefault:JSON.stringify(e.value)});default:m(e)}}getBytesBodyRequestArg({value:e}){let t=this.context.getValueAsString({value:e});return t==null&&(this.context.errors.add({severity:l.Critical,message:"The bytes request body must be provided in string format"}),t="[bytes]"),this.csharp.Literal.reference(this.context.getMemoryStreamForString(t))}getRootClientConstructorInvocation(e){return this.csharp.instantiateClass({classReference:this.Types.RootClient,arguments_:e,forceUseConstructor:!0,multiline:!0})}getPathParameters({namedParameters:e,snippet:t}){var n;let a=[],o=this.context.associateByWireValueOrDefault({parameters:e,values:(n=t.pathParameters)!=null?n:{}});for(let f of o)a.push({name:this.context.getPropertyName(f.name.name),value:this.context.dynamicLiteralMapper.convert(v(b({},f),{fallbackToDefault:f.name.wireValue}))});return a}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getClassName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getBaseUrlOptionName(){var e;return((e=this.context.ir.environments)==null?void 0:e.environments.type)==="multipleBaseUrls"?"Environment":"BaseUrl"}getStyle(e){var t,a;return(a=(t=e.style)!=null?t:this.context.options.style)!=null?a:R.Full}getConfig(e){var t,a;return(a=(t=e.config)!=null?t:this.context.options.config)!=null?a:{}}};export{ke as a};
1
+ import{b as l,d as R,e as i}from"./chunk-KIW23CQ5.js";import{a as b,b as v,e as w,f as m,h as A,i as F,k as E}from"./chunk-CEB5TOCF.js";var Te=typeof global=="object"&&global&&global.Object===Object&&global,k=Te;var Me=typeof self=="object"&&self&&self.Object===Object&&self,Ue=k||Me||Function("return this")(),T=Ue;var We=T.Symbol,d=We;var M=Object.prototype,je=M.hasOwnProperty,De=M.toString,h=d?d.toStringTag:void 0;function Ve(r){var s=je.call(r,h),e=r[h];try{r[h]=void 0;var t=!0}catch(o){}var a=De.call(r);return t&&(s?r[h]=e:delete r[h]),a}var U=Ve;var ze=Object.prototype,He=ze.toString;function Ge(r){return He.call(r)}var W=Ge;var Ze="[object Null]",Je="[object Undefined]",j=d?d.toStringTag:void 0;function Ke(r){return r==null?r===void 0?Je:Ze:j&&j in Object(r)?U(r):W(r)}var D=Ke;function _e(r){return r!=null&&typeof r=="object"}var V=_e;var $e="[object Symbol]";function Ye(r){return typeof r=="symbol"||V(r)&&D(r)==$e}var z=Ye;function Qe(r,s){for(var e=-1,t=r==null?0:r.length,a=Array(t);++e<t;)a[e]=s(r[e],e,r);return a}var H=Qe;var Xe=Array.isArray,G=Xe;var et=1/0,Z=d?d.prototype:void 0,J=Z?Z.toString:void 0;function K(r){if(typeof r=="string")return r;if(G(r))return H(r,K)+"";if(z(r))return J?J.call(r):"";var s=r+"";return s=="0"&&1/r==-et?"-0":s}var _=K;function tt(r){return r==null?"":_(r)}var p=tt;function rt(r,s,e){var t=-1,a=r.length;s<0&&(s=-s>a?0:a+s),e=e>a?a:e,e<0&&(e+=a),a=s>e?0:e-s>>>0,s>>>=0;for(var o=Array(a);++t<a;)o[t]=r[t+s];return o}var $=rt;function at(r,s,e){var t=r.length;return e=e===void 0?t:e,!s&&e>=t?r:$(r,s,e)}var Y=at;var ot="\\ud800-\\udfff",st="\\u0300-\\u036f",nt="\\ufe20-\\ufe2f",ft="\\u20d0-\\u20ff",ut=st+nt+ft,it="\\ufe0e\\ufe0f",dt="\\u200d",lt=RegExp("["+dt+ot+ut+it+"]");function pt(r){return lt.test(r)}var I=pt;function mt(r){return r.split("")}var Q=mt;var X="\\ud800-\\udfff",ct="\\u0300-\\u036f",xt="\\ufe20-\\ufe2f",ht="\\u20d0-\\u20ff",gt=ct+xt+ht,yt="\\ufe0e\\ufe0f",bt="["+X+"]",S="["+gt+"]",P="\\ud83c[\\udffb-\\udfff]",vt="(?:"+S+"|"+P+")",ee="[^"+X+"]",te="(?:\\ud83c[\\udde6-\\uddff]){2}",re="[\\ud800-\\udbff][\\udc00-\\udfff]",Rt="\\u200d",ae=vt+"?",oe="["+yt+"]?",At="(?:"+Rt+"(?:"+[ee,te,re].join("|")+")"+oe+ae+")*",It=oe+ae+At,Ct="(?:"+[ee+S+"?",S,te,re,bt].join("|")+")",Ft=RegExp(P+"(?="+P+")|"+Ct+It,"g");function St(r){return r.match(Ft)||[]}var se=St;function Pt(r){return I(r)?se(r):Q(r)}var ne=Pt;function Bt(r){return function(s){s=p(s);var e=I(s)?ne(s):void 0,t=e?e[0]:s.charAt(0),a=e?Y(e,1).join(""):s.slice(1);return t[r]()+a}}var fe=Bt;var Lt=fe("toUpperCase"),g=Lt;function Ot(r){return g(p(r).toLowerCase())}var ue=Ot;function Nt(r,s,e,t){var a=-1,o=r==null?0:r.length;for(t&&o&&(e=r[++a]);++a<o;)e=s(e,r[a],a,r);return e}var ie=Nt;function qt(r){return function(s){return r==null?void 0:r[s]}}var de=qt;var wt={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Et=de(wt),le=Et;var kt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Tt="\\u0300-\\u036f",Mt="\\ufe20-\\ufe2f",Ut="\\u20d0-\\u20ff",Wt=Tt+Mt+Ut,jt="["+Wt+"]",Dt=RegExp(jt,"g");function Vt(r){return r=p(r),r&&r.replace(kt,le).replace(Dt,"")}var pe=Vt;var zt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Ht(r){return r.match(zt)||[]}var me=Ht;var Gt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Zt(r){return Gt.test(r)}var ce=Zt;var be="\\ud800-\\udfff",Jt="\\u0300-\\u036f",Kt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",$t=Jt+Kt+_t,ve="\\u2700-\\u27bf",Re="a-z\\xdf-\\xf6\\xf8-\\xff",Yt="\\xac\\xb1\\xd7\\xf7",Qt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Xt="\\u2000-\\u206f",er=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ae="A-Z\\xc0-\\xd6\\xd8-\\xde",tr="\\ufe0e\\ufe0f",Ie=Yt+Qt+Xt+er,Ce="['\u2019]",xe="["+Ie+"]",rr="["+$t+"]",Fe="\\d+",ar="["+ve+"]",Se="["+Re+"]",Pe="[^"+be+Ie+Fe+ve+Re+Ae+"]",or="\\ud83c[\\udffb-\\udfff]",sr="(?:"+rr+"|"+or+")",nr="[^"+be+"]",Be="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",x="["+Ae+"]",fr="\\u200d",he="(?:"+Se+"|"+Pe+")",ur="(?:"+x+"|"+Pe+")",ge="(?:"+Ce+"(?:d|ll|m|re|s|t|ve))?",ye="(?:"+Ce+"(?:D|LL|M|RE|S|T|VE))?",Oe=sr+"?",Ne="["+tr+"]?",ir="(?:"+fr+"(?:"+[nr,Be,Le].join("|")+")"+Ne+Oe+")*",dr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",lr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",pr=Ne+Oe+ir,mr="(?:"+[ar,Be,Le].join("|")+")"+pr,cr=RegExp([x+"?"+Se+"+"+ge+"(?="+[xe,x,"$"].join("|")+")",ur+"+"+ye+"(?="+[xe,x+he,"$"].join("|")+")",x+"?"+he+"+"+ge,x+"+"+ye,lr,dr,Fe,mr].join("|"),"g");function xr(r){return r.match(cr)||[]}var qe=xr;function hr(r,s,e){return r=p(r),s=e?void 0:s,s===void 0?ce(r)?qe(r):me(r):r.match(s)||[]}var we=hr;var gr="['\u2019]",yr=RegExp(gr,"g");function br(r){return function(s){return ie(we(pe(s).replace(yr,"")),r,"")}}var Ee=br;var vr=Ee(function(r,s,e){return s=s.toLowerCase(),r+(e?ue(s):s)}),B=vr;var ke=class extends E{constructor({context:e}){super(e.generation);w(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t,options:a}){return this.buildCodeBlock({endpoint:e,snippet:t,options:a}).toString({namespace:"Usage",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map})}generateSnippetSync({endpoint:e,request:t,options:a}){return this.buildCodeBlock({endpoint:e,snippet:t,options:a}).toString({namespace:"Usage",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map})}async generateSnippetAst({endpoint:e,request:t,options:a}){throw new Error("Unsupported")}buildCodeBlock({endpoint:e,snippet:t,options:a}){var f;if(e.examples&&!((f=e.examples)!=null&&f.find(u=>A.DynamicIR.EndpointExample(t)&&u.id===t.id)))throw new Error("Endpoint does not have an example that matches the snippet");let o=this.csharp.codeblock(u=>{u.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),u.newLine(),u.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))}),n=this.getStyle(a);switch(n){case R.Concise:return o;case R.Full:return this.buildFullCodeBlock({body:o,options:a});default:m(n)}}buildFullCodeBlock({body:e,options:t}){var n;let a=this.getConfig(t),o=this.csharp.class_({name:(n=a.fullStyleClassName)!=null?n:"Example",namespace:"Usage",access:F.Access.Public});return o.addNamespaceReference(this.Types.RootClient.namespace),o.addMethod({name:"Do",access:F.Access.Public,isAsync:!0,parameters:[],body:e}),o}constructClient({endpoint:e,snippet:t}){return this.csharp.codeblock(a=>{a.write("var client = "),a.writeNode(this.getRootClientConstructorInvocation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){var n,f;let a=((n=e.response)==null?void 0:n.type)==="streaming"||((f=e.response)==null?void 0:f.type)==="streamParameter",o=this.csharp.invokeMethod({on:this.csharp.codeblock("client"),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t}),async:!0,configureAwait:!0,multiline:!0,isAsyncEnumerable:a});return a?this.csharp.codeblock(u=>{u.write("await foreach (var item in "),u.writeNode(o),u.writeLine(")"),u.pushScope(),u.writeLine("/* consume each item */"),u.popScope()}):o}getConstructorArgs({endpoint:e,snippet:t}){let a=[];e.auth!=null&&(t.auth!=null?a.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:l.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let o=[],n=this.getConstructorBaseUrlArgs({baseUrl:t.baseURL,environment:t.environment});n.length>0&&o.push(...n),this.context.errors.scope(i.Headers);let f=[];return this.context.ir.headers!=null&&t.headers!=null&&f.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),o.length===0?[...a,...f]:[...a,...f,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:o.map(u=>({name:u.name,assignment:u.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:e,environment:t}){let a=this.getBaseUrlArg({baseUrl:e,environment:t});return A.Literal.nop(a)?[]:[{name:this.getBaseUrlOptionName(),assignment:a}]}getBaseUrlArg({baseUrl:e,environment:t}){var a;if(e!=null&&t!=null)return this.context.errors.add({severity:l.Critical,message:"Cannot specify both baseUrl and environment options"}),this.csharp.Literal.nop();if(e!=null)return((a=this.context.ir.environments)==null?void 0:a.environments.type)==="multipleBaseUrls"?(this.context.errors.add({severity:l.Critical,message:"The C# SDK doesn't support a baseUrl when multiple URL environments are configured"}),this.csharp.Literal.nop()):this.csharp.Literal.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let o=this.context.getEnvironmentTypeReferenceFromID(t);return o==null?(this.context.errors.add({severity:l.Warning,message:`Environment ${JSON.stringify(t)} was not found`}),this.csharp.Literal.nop()):this.csharp.Literal.reference(o)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.Environments,arguments_:Object.entries(t).map(([o,n])=>({name:g(B(o)),assignment:this.context.dynamicLiteralMapper.convert({typeReference:{type:"primitive",value:"STRING"},value:n})})),multiline:!0})):this.csharp.Literal.nop()}return this.csharp.Literal.nop()}getConstructorAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getConstructorBasicAuthArg({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getConstructorBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getConstructorHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getConstructorOAuthArgs({auth:e,values:t}):[];case"inferred":return this.addWarning("The C# SDK Generator does not support Inferred auth scheme yet"),[];default:m(e)}}addError(e){this.context.errors.add({severity:l.Critical,message:e})}addWarning(e){this.context.errors.add({severity:l.Warning,message:e})}getConstructorBasicAuthArg({auth:e,values:t}){return[{name:this.context.getParameterName(e.username),assignment:this.csharp.Literal.string(t.username)},{name:this.context.getParameterName(e.password),assignment:this.csharp.Literal.string(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.token),assignment:this.csharp.Literal.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.header.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value,fallbackToDefault:e.header.name.wireValue})}]}getConstructorOAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.clientId),assignment:this.csharp.Literal.string(t.clientId)},{name:this.context.getParameterName(e.clientSecret),assignment:this.csharp.Literal.string(t.clientSecret)}]}getConstructorHeaderArgs({headers:e,values:t}){let a=[];for(let o of e){let n=this.getConstructorHeaderArg({header:o,value:t.value});n!=null&&a.push({name:this.context.getParameterName(o.name.name),assignment:n})}return a}getConstructorHeaderArg({header:e,value:t}){let a=this.context.dynamicLiteralMapper.convert({typeReference:e.typeReference,value:t,fallbackToDefault:e.name.wireValue});if(!A.Literal.nop(a))return a}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)}}getMethodArgsForInlinedRequest({request:e,snippet:t}){var u,y;let a=[];this.context.errors.scope(i.PathParameters);let o=[],n=[...(u=this.context.ir.pathParameters)!=null?u:[],...(y=e.pathParameters)!=null?y:[]];n.length>0&&o.push(...this.getPathParameters({namedParameters:n,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(i.RequestBody);let f=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:this.settings.shouldInlinePathParameters})||a.push(...o.map(C=>C.value)),a.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:this.settings.shouldInlinePathParameters})?o:[],filePropertyInfo:f})),a}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:a,filePropertyInfo:o}){var L,O,N,q;this.context.errors.scope(i.QueryParameters);let f=this.context.associateQueryParametersByWireValue({parameters:(L=e.queryParameters)!=null?L:[],values:(O=t.queryParameters)!=null?O:{}}).map(c=>({name:this.context.getPropertyName(c.name.name),value:this.context.dynamicLiteralMapper.convert(c)}));this.context.errors.unscope(),this.context.errors.scope(i.Headers);let y=this.context.associateByWireValue({parameters:(N=e.headers)!=null?N:[],values:(q=t.headers)!=null?q:{}}).map(c=>({name:this.context.getPropertyName(c.name.name),value:this.context.dynamicLiteralMapper.convert(v(b({},c),{fallbackToDefault:c.name.wireValue}))}));this.context.errors.unscope(),this.context.errors.scope(i.RequestBody);let C=e.body!=null?this.getInlinedRequestBodyConstructorFields({body:e.body,value:t.requestBody,filePropertyInfo:o}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}),fields:[...a,...f,...y,...C]})}getInlinedRequestBodyConstructorFields({body:e,value:t,filePropertyInfo:a}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:a});default:m(e)}}getInlinedRequestBodyPropertyConstructorFields({parameters:e,value:t}){var n;let a=[],o=this.context.associateByWireValue({parameters:e,values:(n=this.context.getRecord(t))!=null?n:{}});for(let f of o)a.push({name:this.context.getPropertyName(f.name.name),value:this.context.dynamicLiteralMapper.convert(v(b({},f),{fallbackToDefault:f.name.wireValue}))});return a}getFileUploadRequestBodyConstructorFields({filePropertyInfo:e}){return[...e.fileFields,...e.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:e,value:t}){return{name:this.context.getPropertyName(e.bodyKey),value:this.getReferencedRequestBodyPropertyLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicLiteralMapper.convert({typeReference:e.value,value:t,fallbackToDefault:JSON.stringify(e.value)});default:m(e)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var n,f;let a=[];this.context.errors.scope(i.PathParameters);let o=[...(n=this.context.ir.pathParameters)!=null?n:[],...(f=e.pathParameters)!=null?f:[]];return o.length>0&&a.push(...this.getPathParameters({namedParameters:o,snippet:t}).map(u=>u.value)),this.context.errors.unscope(),this.context.errors.scope(i.RequestBody),e.body!=null&&a.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),a}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return e.value.type==="optional"&&t==null?this.csharp.Literal.null():this.context.dynamicLiteralMapper.convert({typeReference:e.value,value:t,fallbackToDefault:JSON.stringify(e.value)});default:m(e)}}getBytesBodyRequestArg({value:e}){let t=this.context.getValueAsString({value:e});return t==null&&(this.context.errors.add({severity:l.Critical,message:"The bytes request body must be provided in string format"}),t="[bytes]"),this.csharp.Literal.reference(this.context.getMemoryStreamForString(t))}getRootClientConstructorInvocation(e){return this.csharp.instantiateClass({classReference:this.Types.RootClient,arguments_:e,forceUseConstructor:!0,multiline:!0})}getPathParameters({namedParameters:e,snippet:t}){var n;let a=[],o=this.context.associateByWireValueOrDefault({parameters:e,values:(n=t.pathParameters)!=null?n:{}});for(let f of o)a.push({name:this.context.getPropertyName(f.name.name),value:this.context.dynamicLiteralMapper.convert(v(b({},f),{fallbackToDefault:f.name.wireValue}))});return a}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getClassName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getBaseUrlOptionName(){var e;return((e=this.context.ir.environments)==null?void 0:e.environments.type)==="multipleBaseUrls"?"Environment":"BaseUrl"}getStyle(e){var t,a;return(a=(t=e.style)!=null?t:this.context.options.style)!=null?a:R.Full}getConfig(e){var t,a;return(a=(t=e.config)!=null?t:this.context.options.config)!=null?a:{}}};export{ke as a};
2
2
  /*! Bundled license information:
3
3
 
4
4
  lodash-es/lodash.js:
@@ -12,4 +12,4 @@ lodash-es/lodash.js:
12
12
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
13
13
  *)
14
14
  */
15
- //# sourceMappingURL=chunk-ZEEJAJ4K.js.map
15
+ //# sourceMappingURL=chunk-EC2FLIE6.js.map
@@ -1,2 +1,2 @@
1
- import{e as i,f as r,k as n}from"./chunk-QALVTPA5.js";var s=class extends n{constructor({context:e}){super(e.generation);i(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return this.Collection.list(this.convert({typeReference:e.typeReference,unboxOptionals:!0}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return this.Collection.map(this.convert({typeReference:e.typeReference.key}),this.convert({typeReference:e.typeReference.value}));case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?this.convertUnknown():this.convertNamed({named:t})}case"optional":case"nullable":{let t=this.convert({typeReference:e.typeReference.value});return e.unboxOptionals?t.asNonOptional():t.asOptional()}case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return this.Collection.set(this.convert({typeReference:e.typeReference,unboxOptionals:!0}));case"unknown":return this.convertUnknown();default:r(e.typeReference)}}convertToClassReference(e){return this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)})}convertNamed({named:e}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference});case"enum":case"object":return this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}):this.Primitive.object;case"undiscriminatedUnion":return this.OneOf.OneOf(e.types.map(t=>this.convert({typeReference:t})));default:r(e)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return this.Primitive.boolean;case"string":return this.Primitive.string}}convertUnknown(){return this.Primitive.object}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return this.Primitive.integer;case"UINT":return this.Primitive.uint;case"LONG":return this.Primitive.long;case"UINT_64":return this.Primitive.ulong;case"FLOAT":return this.Primitive.float;case"DOUBLE":return this.Primitive.double;case"BOOLEAN":return this.Primitive.boolean;case"STRING":return this.Primitive.string;case"DATE":return this.Value.dateOnly;case"DATE_TIME":return this.Value.dateTime;case"UUID":return this.Primitive.string;case"BASE_64":return this.Primitive.string;case"BIG_INTEGER":return this.Primitive.string;default:r(e)}}};export{s as a};
2
- //# sourceMappingURL=chunk-TVSKLWL4.js.map
1
+ import{e as i,f as r,k as n}from"./chunk-CEB5TOCF.js";var s=class extends n{constructor({context:e}){super(e.generation);i(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return this.Collection.list(this.convert({typeReference:e.typeReference,unboxOptionals:!0}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return this.Collection.map(this.convert({typeReference:e.typeReference.key}),this.convert({typeReference:e.typeReference.value}));case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?this.convertUnknown():this.convertNamed({named:t})}case"optional":case"nullable":{let t=this.convert({typeReference:e.typeReference.value});return e.unboxOptionals?t.asNonOptional():t.asOptional()}case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return this.Collection.set(this.convert({typeReference:e.typeReference,unboxOptionals:!0}));case"unknown":return this.convertUnknown();default:r(e.typeReference)}}convertToClassReference(e){return this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)})}convertNamed({named:e}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference});case"enum":case"object":return this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}):this.Primitive.object;case"undiscriminatedUnion":return this.OneOf.OneOf(e.types.map(t=>this.convert({typeReference:t})));default:r(e)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return this.Primitive.boolean;case"string":return this.Primitive.string}}convertUnknown(){return this.Primitive.object}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return this.Primitive.integer;case"UINT":return this.Primitive.uint;case"LONG":return this.Primitive.long;case"UINT_64":return this.Primitive.ulong;case"FLOAT":return this.Primitive.float;case"DOUBLE":return this.Primitive.double;case"BOOLEAN":return this.Primitive.boolean;case"STRING":return this.Primitive.string;case"DATE":return this.Value.dateOnly;case"DATE_TIME":return this.Value.dateTime;case"UUID":return this.Primitive.string;case"BASE_64":return this.Primitive.string;case"BIG_INTEGER":return this.Primitive.string;default:r(e)}}};export{s as a};
2
+ //# sourceMappingURL=chunk-EUEE2577.js.map
@@ -1,2 +1,2 @@
1
- import{a as c}from"./chunk-LWJEMG53.js";import{c as a}from"./chunk-PRAGN765.js";import{a as p}from"./chunk-TVSKLWL4.js";import{a as m}from"./chunk-WP3GAWOR.js";import{e as r,j as o}from"./chunk-QALVTPA5.js";var l=class g extends a{constructor({ir:e,config:t,options:n,generation:i}){super({ir:e,config:t,options:n});r(this,"ir");r(this,"dynamicTypeMapper");r(this,"dynamicLiteralMapper");r(this,"filePropertyMapper");r(this,"generation");this.ir=e,this.generation=i!=null?i:new o(e,t.workspaceName,t.customConfig!=null?t.customConfig:{},t),this.dynamicTypeMapper=new p({context:this}),this.dynamicLiteralMapper=new c({context:this}),this.filePropertyMapper=new m({context:this})}get namespaces(){return this.generation.namespaces}get registry(){return this.generation.registry}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get csharp(){return this.generation.csharp}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}clone(){return new g({ir:this.ir,config:this.config,options:this.options,generation:this.generation})}getFileParameterForString(e){return this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.FileParameter,arguments_:[],properties:[{name:"Stream",value:this.getMemoryStreamForString(e)}],multiline:!0}))}getMemoryStreamForString(e){return this.System.IO.MemoryStream.new({arguments_:[this.csharp.invokeMethod({on:this.System.Text.Encoding_UTF8,method:"GetBytes",arguments_:[this.csharp.Literal.string(e)]})]})}getClassName(e){return e.pascalCase.safeName}getParameterName(e){return e.camelCase.safeName}getPropertyName(e){return e.pascalCase.safeName}getMethodName(e){return`${e.pascalCase.safeName}Async`}getNamespace(e,t){let n=this.getNamespaceSegments(e);return n=t!=null?[...n,t]:n,[this.namespaces.root,...n].join(".")}getEnvironmentTypeReferenceFromID(e){let t=this.resolveEnvironmentName(e);if(t!=null)return this.getEnvironmentClassReferenceForEnumName(t)}getEnvironmentClassReferenceForEnumName(e){return this.csharp.classReference({name:`${this.generation.Types.Environments.name}.${this.getClassName(e)}`,namespace:this.namespaces.root})}getNamespaceSegments(e){return(this.settings.explicitNamespaces?e.allParts:e.packagePath).map(n=>n.pascalCase.safeName)}precalculate(e){this.generation.initialize(),this.System.Collections.Generic.KeyValuePair(),this.System.Collections.Generic.IEnumerable(),this.System.Collections.Generic.IAsyncEnumerable(),this.System.Collections.Generic.HashSet(),this.System.Collections.Generic.List(),this.System.Collections.Generic.Dictionary(),this.System.Threading.Tasks.Task(),Object.entries(this.ir.types).sort((t,n)=>t[0].length-n[0].length).forEach(([t,n])=>{this.dynamicTypeMapper.convertToClassReference(n)});for(let[t,n]of e.entries())if(this.csharp.classReference({origin:this.model.staticExplicit(`Example${t}`),namespace:"Usage"}),n.endpoint){let i=this.resolveEndpointLocation(n.endpoint);for(let s of i)switch(s.request.type){case"inlined":this.csharp.classReference({origin:s.request.declaration.name,namespace:this.getNamespace(s.request.declaration.fernFilepath)});break;case"body":break}}this.generation.Types.ClientOptions,this.generation.Types.RootClient,this.csharp.freezeClassReferences()}};export{l as a};
2
- //# sourceMappingURL=chunk-TOOGWICF.js.map
1
+ import{a as c}from"./chunk-3XDW3MPR.js";import{c as a}from"./chunk-KIW23CQ5.js";import{a as p}from"./chunk-EUEE2577.js";import{a as m}from"./chunk-DBQMCX7L.js";import{e as r,j as o}from"./chunk-CEB5TOCF.js";var l=class g extends a{constructor({ir:e,config:t,options:n,generation:i}){super({ir:e,config:t,options:n});r(this,"ir");r(this,"dynamicTypeMapper");r(this,"dynamicLiteralMapper");r(this,"filePropertyMapper");r(this,"generation");this.ir=e,this.generation=i!=null?i:new o(e,t.workspaceName,t.customConfig!=null?t.customConfig:{},t),this.dynamicTypeMapper=new p({context:this}),this.dynamicLiteralMapper=new c({context:this}),this.filePropertyMapper=new m({context:this})}get namespaces(){return this.generation.namespaces}get registry(){return this.generation.registry}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get csharp(){return this.generation.csharp}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}clone(){return new g({ir:this.ir,config:this.config,options:this.options,generation:this.generation})}getFileParameterForString(e){return this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.FileParameter,arguments_:[],properties:[{name:"Stream",value:this.getMemoryStreamForString(e)}],multiline:!0}))}getMemoryStreamForString(e){return this.System.IO.MemoryStream.new({arguments_:[this.csharp.invokeMethod({on:this.System.Text.Encoding_UTF8,method:"GetBytes",arguments_:[this.csharp.Literal.string(e)]})]})}getClassName(e){return e.pascalCase.safeName}getParameterName(e){return e.camelCase.safeName}getPropertyName(e){return e.pascalCase.safeName}getMethodName(e){return`${e.pascalCase.safeName}Async`}getNamespace(e,t){let n=this.getNamespaceSegments(e);return n=t!=null?[...n,t]:n,[this.namespaces.root,...n].join(".")}getEnvironmentTypeReferenceFromID(e){let t=this.resolveEnvironmentName(e);if(t!=null)return this.getEnvironmentClassReferenceForEnumName(t)}getEnvironmentClassReferenceForEnumName(e){return this.csharp.classReference({name:`${this.generation.Types.Environments.name}.${this.getClassName(e)}`,namespace:this.namespaces.root})}getNamespaceSegments(e){return(this.settings.explicitNamespaces?e.allParts:e.packagePath).map(n=>n.pascalCase.safeName)}precalculate(e){this.generation.initialize(),this.System.Collections.Generic.KeyValuePair(),this.System.Collections.Generic.IEnumerable(),this.System.Collections.Generic.IAsyncEnumerable(),this.System.Collections.Generic.HashSet(),this.System.Collections.Generic.List(),this.System.Collections.Generic.Dictionary(),this.System.Threading.Tasks.Task(),Object.entries(this.ir.types).sort((t,n)=>t[0].length-n[0].length).forEach(([t,n])=>{this.dynamicTypeMapper.convertToClassReference(n)});for(let[t,n]of e.entries())if(this.csharp.classReference({origin:this.model.staticExplicit(`Example${t}`),namespace:"Usage"}),n.endpoint){let i=this.resolveEndpointLocation(n.endpoint);for(let s of i)switch(s.request.type){case"inlined":this.csharp.classReference({origin:s.request.declaration.name,namespace:this.getNamespace(s.request.declaration.fernFilepath)});break;case"body":break}}this.generation.Types.ClientOptions,this.generation.Types.RootClient,this.csharp.freezeClassReferences()}};export{l as a};
2
+ //# sourceMappingURL=chunk-GEII674B.js.map
@@ -1,2 +1,2 @@
1
- import{a as p}from"./chunk-ZEEJAJ4K.js";import{a as r}from"./chunk-TOOGWICF.js";import{a as t}from"./chunk-PRAGN765.js";var i=class extends t{constructor({ir:e,config:n,options:o={}}){super(new r({ir:e,config:n,options:o}))}precalculate(e){this.context.precalculate(e)}async generate(e,n={}){return super.generate(e,n)}generateSync(e,n={}){return super.generateSync(e,n)}async generateSnippetAst(e){return super.generateSnippetAst(e)}createSnippetGenerator(e){return new p({context:e})}};export{i as a};
2
- //# sourceMappingURL=chunk-A53BGSGD.js.map
1
+ import{a as p}from"./chunk-EC2FLIE6.js";import{a as r}from"./chunk-GEII674B.js";import{a as t}from"./chunk-KIW23CQ5.js";var i=class extends t{constructor({ir:e,config:n,options:o={}}){super(new r({ir:e,config:n,options:o}))}precalculate(e){this.context.precalculate(e)}async generate(e,n={}){return super.generate(e,n)}generateSync(e,n={}){return super.generateSync(e,n)}async generateSnippetAst(e){return super.generateSnippetAst(e)}createSnippetGenerator(e){return new p({context:e})}};export{i as a};
2
+ //# sourceMappingURL=chunk-KFPJC632.js.map
@@ -1,2 +1,2 @@
1
- import{a as E,b as w,c as x,d as T,e as p,f as d,g as m}from"./chunk-QALVTPA5.js";var c=class{constructor(){p(this,"reporter");p(this,"snippet");p(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){this.shouldUpdate({snippet:r,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=r)}getResponseOrThrow({endpoint:e}){var r;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(r=this.err)!=null?r:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:r}){var t,n;return this.reporter==null||this.reporter.size()>0&&r.size()===0?!0:e.length>((n=(t=this.snippet)==null?void 0:t.length)!=null?n:0)}};var y=class{constructor(e){p(this,"context");this.context=e}async generate(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new c;for(let i of t){let s=this.context.clone(),l=this.createSnippetGenerator(s);try{let a=await l.generateSnippet({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:a,errors:void 0};n.update({context:s,snippet:a})}catch(a){n.err==null&&(n.err=a)}}return n.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n;for(let i of t){let s=this.context.clone(),l=this.createSnippetGenerator(s);try{return await l.generateSnippetAst({endpoint:i,request:e,options:r})}catch(a){n=a}}throw n!=null?n:new Error(`Failed to generate snippet AST for endpoint: ${e.endpoint.method} ${e.endpoint.path}`)}generateSync(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new c;for(let i of t){let s=this.context.clone(),l=this.createSnippetGenerator(s);try{let a=l.generateSnippetSync({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:a,errors:void 0};n.update({context:s,snippet:a})}catch(a){n.err==null&&(n.err=a)}}return n.getResponseOrThrow({endpoint:e.endpoint})}};var o={Critical:"CRITICAL",Warning:"WARNING"},f=class u{constructor(){p(this,"errors");p(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(w(E({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new u;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};var h=class{constructor(){p(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let t=e.match(this.REFERENCE_REGEX);if(!(t==null||t[1]==null||t[2]==null))return{method:t[1],path:t[2]}}};var g=class{constructor({ir:e,config:r,options:t={}}){p(this,"config");p(this,"options");p(this,"errors");p(this,"_ir");p(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.options=t,this.errors=new f,this.httpEndpointReferenceParser=new h}associateQueryParametersByWireValue({parameters:e,values:r}){let t=[];for(let[n,i]of Object.entries(r)){this.errors.scope(n);try{let s=e.find(a=>a.name.wireValue===n);if(s==null)throw this.newParameterNotRecognizedError(n);let l=this.isListTypeReference(s.typeReference)&&!Array.isArray(i)?[i]:i;t.push({name:s.name,typeReference:s.typeReference,value:l})}finally{this.errors.unscope()}}return t}associateByWireValueOrDefault({parameters:e,values:r}){let t=[];for(let n of e){this.errors.scope(n.name.wireValue);try{let i=r[n.name.wireValue];if(i==null)if(n.typeReference.type==="primitive"&&n.typeReference.value==="STRING")i=`<${n.name.wireValue}>`;else{this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n.name.wireValue).message});continue}t.push({name:n.name,typeReference:n.typeReference,value:i})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let n=[];for(let[i,s]of Object.entries(r)){this.errors.scope(i);try{let l=e.find(a=>a.name.wireValue===i);if(l==null){if(t)continue;this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(i).message});continue}n.push({name:l.name,typeReference:l.typeReference,value:s})}finally{this.errors.unscope()}}return n}getExampleObjectProperties({parameters:e,snippetObject:r}){let t=typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{},n=[];for(let i of e){let s=t[i.name.wireValue];s==null?i.typeReference.type==="nullable"&&n.push({name:i.name,typeReference:i.typeReference,value:null}):n.push({name:i.name,typeReference:i.typeReference,value:s})}return n}getSingleFileValue({property:e,record:r}){let t=r[e.wireValue];if(t!=null){if(typeof t!="string"){this.errors.add({severity:o.Critical,message:`Expected file value to be a string, got ${typeof t}`});return}return t}}getFileArrayValues({property:e,record:r}){let t=r[e.wireValue];if(t==null)return;if(!Array.isArray(t)){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof t}`});return}let n=[];for(let i of t){if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}n.push(i)}return n}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:o.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:o.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let t=this.getRecord(r);if(t==null)return;let n=e.discriminant.wireValue,i=t[n];if(i==null){this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n).message});return}if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let s=e.types[i];if(s==null){this.errors.add({severity:o.Critical,message:`No type found for discriminant value "${i}"`});return}let R=t,{[n]:l}=R,a=T(R,[x(n)]);return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:a}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocation(e){let r=[];for(let t of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:t,parsedEndpoint:e})&&r.push(t);return r}resolveEndpointLocationOrThrow(e){let r=this.resolveEndpointLocation(e);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:t}){var n;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:t}):!((n=e.metadata)!=null&&n.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var t,n;return r&&((n=(t=e.metadata)==null?void 0:t.includePathParameters)!=null?n:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:d(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}case"multipleBaseUrls":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}default:d(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let t=r.environments[0];if(t==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let n=new Set(m(t.urls));for(let i of m(e))n.has(i)&&n.delete(i);return n.size>0?(this.errors.add({severity:o.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${m(t.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:d(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:d(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:d(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};var v;(function(u){u.Concise="concise",u.Full="full"})(v||(v={}));var P={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};export{y as a,o as b,g as c,v as d,P as e};
2
- //# sourceMappingURL=chunk-PRAGN765.js.map
1
+ import{a as E,b as w,c as x,d as T,e as p,f as d,g as m}from"./chunk-CEB5TOCF.js";var c=class{constructor(){p(this,"reporter");p(this,"snippet");p(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){this.shouldUpdate({snippet:r,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=r)}getResponseOrThrow({endpoint:e}){var r;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(r=this.err)!=null?r:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:r}){var t,n;return this.reporter==null||this.reporter.size()>0&&r.size()===0?!0:e.length>((n=(t=this.snippet)==null?void 0:t.length)!=null?n:0)}};var y=class{constructor(e){p(this,"context");this.context=e}async generate(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new c;for(let i of t){let s=this.context.clone(),l=this.createSnippetGenerator(s);try{let a=await l.generateSnippet({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:a,errors:void 0};n.update({context:s,snippet:a})}catch(a){n.err==null&&(n.err=a)}}return n.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n;for(let i of t){let s=this.context.clone(),l=this.createSnippetGenerator(s);try{return await l.generateSnippetAst({endpoint:i,request:e,options:r})}catch(a){n=a}}throw n!=null?n:new Error(`Failed to generate snippet AST for endpoint: ${e.endpoint.method} ${e.endpoint.path}`)}generateSync(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new c;for(let i of t){let s=this.context.clone(),l=this.createSnippetGenerator(s);try{let a=l.generateSnippetSync({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:a,errors:void 0};n.update({context:s,snippet:a})}catch(a){n.err==null&&(n.err=a)}}return n.getResponseOrThrow({endpoint:e.endpoint})}};var o={Critical:"CRITICAL",Warning:"WARNING"},f=class u{constructor(){p(this,"errors");p(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(w(E({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new u;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};var h=class{constructor(){p(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let t=e.match(this.REFERENCE_REGEX);if(!(t==null||t[1]==null||t[2]==null))return{method:t[1],path:t[2]}}};var g=class{constructor({ir:e,config:r,options:t={}}){p(this,"config");p(this,"options");p(this,"errors");p(this,"_ir");p(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.options=t,this.errors=new f,this.httpEndpointReferenceParser=new h}associateQueryParametersByWireValue({parameters:e,values:r}){let t=[];for(let[n,i]of Object.entries(r)){this.errors.scope(n);try{let s=e.find(a=>a.name.wireValue===n);if(s==null)throw this.newParameterNotRecognizedError(n);let l=this.isListTypeReference(s.typeReference)&&!Array.isArray(i)?[i]:i;t.push({name:s.name,typeReference:s.typeReference,value:l})}finally{this.errors.unscope()}}return t}associateByWireValueOrDefault({parameters:e,values:r}){let t=[];for(let n of e){this.errors.scope(n.name.wireValue);try{let i=r[n.name.wireValue];if(i==null)if(n.typeReference.type==="primitive"&&n.typeReference.value==="STRING")i=`<${n.name.wireValue}>`;else{this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n.name.wireValue).message});continue}t.push({name:n.name,typeReference:n.typeReference,value:i})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let n=[];for(let[i,s]of Object.entries(r)){this.errors.scope(i);try{let l=e.find(a=>a.name.wireValue===i);if(l==null){if(t)continue;this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(i).message});continue}n.push({name:l.name,typeReference:l.typeReference,value:s})}finally{this.errors.unscope()}}return n}getExampleObjectProperties({parameters:e,snippetObject:r}){let t=typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{},n=[];for(let i of e){let s=t[i.name.wireValue];s==null?i.typeReference.type==="nullable"&&n.push({name:i.name,typeReference:i.typeReference,value:null}):n.push({name:i.name,typeReference:i.typeReference,value:s})}return n}getSingleFileValue({property:e,record:r}){let t=r[e.wireValue];if(t!=null){if(typeof t!="string"){this.errors.add({severity:o.Critical,message:`Expected file value to be a string, got ${typeof t}`});return}return t}}getFileArrayValues({property:e,record:r}){let t=r[e.wireValue];if(t==null)return;if(!Array.isArray(t)){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof t}`});return}let n=[];for(let i of t){if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}n.push(i)}return n}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:o.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:o.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let t=this.getRecord(r);if(t==null)return;let n=e.discriminant.wireValue,i=t[n];if(i==null){this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n).message});return}if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let s=e.types[i];if(s==null){this.errors.add({severity:o.Critical,message:`No type found for discriminant value "${i}"`});return}let R=t,{[n]:l}=R,a=T(R,[x(n)]);return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:a}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocation(e){let r=[];for(let t of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:t,parsedEndpoint:e})&&r.push(t);return r}resolveEndpointLocationOrThrow(e){let r=this.resolveEndpointLocation(e);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:t}){var n;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:t}):!((n=e.metadata)!=null&&n.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var t,n;return r&&((n=(t=e.metadata)==null?void 0:t.includePathParameters)!=null?n:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:d(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}case"multipleBaseUrls":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}default:d(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let t=r.environments[0];if(t==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let n=new Set(m(t.urls));for(let i of m(e))n.has(i)&&n.delete(i);return n.size>0?(this.errors.add({severity:o.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${m(t.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:d(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:d(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:d(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};var v;(function(u){u.Concise="concise",u.Full="full"})(v||(v={}));var P={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};export{y as a,o as b,g as c,v as d,P as e};
2
+ //# sourceMappingURL=chunk-KIW23CQ5.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../browser-compatible-base/src/dynamic-snippets/Result.ts","../../../../browser-compatible-base/src/dynamic-snippets/AbstractDynamicSnippetsGenerator.ts","../../../../browser-compatible-base/src/dynamic-snippets/ErrorReporter.ts","../../../../../packages/cli/fern-definition/schema/src/utils/HttpEndpointReferenceParser.ts","../../../../browser-compatible-base/src/dynamic-snippets/AbstractDynamicSnippetsGeneratorContext.ts","../../../../browser-compatible-base/src/dynamic-snippets/Options.ts","../../../../browser-compatible-base/src/dynamic-snippets/Scope.ts"],"sourcesContent":["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","import { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { AbstractAstNode } from \"../ast\";\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 async generateSnippetAst(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): Promise<AbstractAstNode> {\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 let lastError: Error | undefined = undefined;\n for (const endpoint of endpoints) {\n const context = this.context.clone() as Context;\n const snippetGenerator = this.createSnippetGenerator(context);\n try {\n const ast = await snippetGenerator.generateSnippetAst({ endpoint, request, options });\n return ast;\n } catch (error) {\n lastError = error as Error;\n }\n }\n if (lastError != null) {\n throw lastError;\n }\n throw new Error(\n `Failed to generate snippet AST for endpoint: ${request.endpoint.method} ${request.endpoint.path}`\n );\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","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","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","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","import { AbstractFormatter } from \"../ast/AbstractFormatter\";\n\n// Style of the generated snippets.\nexport enum Style {\n // Use a concise style for the snippet (top-level statements).\n Concise = \"concise\",\n\n // Use the full style for the snippet (a `main` function that can be run).\n Full = \"full\"\n}\n\n// Options used to customize the behavior of any dynamic snippets generator\nexport interface Options {\n // Config to use for a specific generator. This is independent of the customConfig\n // used by the generator, and is primarily used in testing environments.\n config?: unknown;\n\n // The formatter to use for the generated snippets.\n formatter?: AbstractFormatter;\n\n // Style of the generated snippets. By default, the executable style is used.\n style?: Style;\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"],"mappings":"kFAKM,IAAOA,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,CACjG,KAAK,aAAa,CAAE,QAAAA,EAAS,SAAUD,EAAQ,MAAM,CAAE,IACvD,KAAK,SAAWA,EAAQ,OAAO,MAAK,EACpC,KAAK,QAAUC,EAEvB,CAEO,mBAAmB,CACtB,SAAAC,CAAQ,EAGX,CAtBL,IAAAC,EAuBQ,GAAI,KAAK,SAAW,MAAQ,KAAK,UAAY,KACzC,MAAO,CACH,QAAS,KAAK,QACd,OAAQ,KAAK,SAAS,uBAAsB,GAGpD,MAAMA,EAAA,KAAK,MAAL,KAAAA,EAAY,IAAI,MAAM,4CAA4CD,EAAS,MAAM,IAAIA,EAAS,IAAI,GAAG,CAC/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,CACG,OAAOG,EAAS,SAAS,SAAWH,EAAe,QAAUG,EAAS,SAAS,OAASH,EAAe,IAC3G,GC5nBJ,IAAYwB,GAAZ,SAAYA,EAAK,CAEbA,EAAA,QAAA,UAGAA,EAAA,KAAA,MACJ,GANYA,IAAAA,EAAK,CAAA,EAAA,ECHV,IAAMC,EAAQ,CACjB,eAAgB,iBAChB,gBAAiB,kBACjB,QAAS,UACT,YAAa","names":["Result","__publicField","context","snippet","endpoint","_a","reporter","_b","AbstractDynamicSnippetsGenerator","context","__publicField","request","options","endpoints","result","Result","endpoint","snippetGenerator","snippet","error","lastError","Severity","ErrorReporter","_ErrorReporter","__publicField","err","__spreadProps","__spreadValues","path","severity","clone","result","item","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","Style","Scope"]}
1
+ {"version":3,"sources":["../../../../browser-compatible-base/src/dynamic-snippets/Result.ts","../../../../browser-compatible-base/src/dynamic-snippets/AbstractDynamicSnippetsGenerator.ts","../../../../browser-compatible-base/src/dynamic-snippets/ErrorReporter.ts","../../../../../packages/cli/fern-definition/schema/src/utils/HttpEndpointReferenceParser.ts","../../../../browser-compatible-base/src/dynamic-snippets/AbstractDynamicSnippetsGeneratorContext.ts","../../../../browser-compatible-base/src/dynamic-snippets/Options.ts","../../../../browser-compatible-base/src/dynamic-snippets/Scope.ts"],"sourcesContent":["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","import { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { AbstractAstNode } from \"../ast\";\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 async generateSnippetAst(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): Promise<AbstractAstNode> {\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 let lastError: Error | undefined = undefined;\n for (const endpoint of endpoints) {\n const context = this.context.clone() as Context;\n const snippetGenerator = this.createSnippetGenerator(context);\n try {\n const ast = await snippetGenerator.generateSnippetAst({ endpoint, request, options });\n return ast;\n } catch (error) {\n lastError = error as Error;\n }\n }\n if (lastError != null) {\n throw lastError;\n }\n throw new Error(\n `Failed to generate snippet AST for endpoint: ${request.endpoint.method} ${request.endpoint.path}`\n );\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","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","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","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","import { AbstractFormatter } from \"../ast/AbstractFormatter\";\n\n// Style of the generated snippets.\nexport enum Style {\n // Use a concise style for the snippet (top-level statements).\n Concise = \"concise\",\n\n // Use the full style for the snippet (a `main` function that can be run).\n Full = \"full\"\n}\n\n// Options used to customize the behavior of any dynamic snippets generator\nexport interface Options {\n // Config to use for a specific generator. This is independent of the customConfig\n // used by the generator, and is primarily used in testing environments.\n config?: unknown;\n\n // The formatter to use for the generated snippets.\n formatter?: AbstractFormatter;\n\n // Style of the generated snippets. By default, the executable style is used.\n style?: Style;\n\n // Skip client instantiation in the generated snippet. Useful for wire tests\n // where the client is already instantiated in the test setup.\n skipClientInstantiation?: boolean;\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"],"mappings":"kFAKM,IAAOA,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,CACjG,KAAK,aAAa,CAAE,QAAAA,EAAS,SAAUD,EAAQ,MAAM,CAAE,IACvD,KAAK,SAAWA,EAAQ,OAAO,MAAK,EACpC,KAAK,QAAUC,EAEvB,CAEO,mBAAmB,CACtB,SAAAC,CAAQ,EAGX,CAtBL,IAAAC,EAuBQ,GAAI,KAAK,SAAW,MAAQ,KAAK,UAAY,KACzC,MAAO,CACH,QAAS,KAAK,QACd,OAAQ,KAAK,SAAS,uBAAsB,GAGpD,MAAMA,EAAA,KAAK,MAAL,KAAAA,EAAY,IA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,KACnE,CAEQ,sBAAsB,CAC1B,SAAAf,EACA,eAAAH,CAAc,EAIjB,CACG,OAAOG,EAAS,SAAS,SAAWH,EAAe,QAAUG,EAAS,SAAS,OAASH,EAAe,IAC3G,GC5nBJ,IAAYwB,GAAZ,SAAYA,EAAK,CAEbA,EAAA,QAAA,UAGAA,EAAA,KAAA,MACJ,GANYA,IAAAA,EAAK,CAAA,EAAA,ECHV,IAAMC,EAAQ,CACjB,eAAgB,iBAChB,gBAAiB,kBACjB,QAAS,UACT,YAAa","names":["Result","__publicField","context","snippet","endpoint","_a","reporter","_b","AbstractDynamicSnippetsGenerator","context","__publicField","request","options","endpoints","result","Result","endpoint","snippetGenerator","snippet","error","lastError","Severity","ErrorReporter","_ErrorReporter","__publicField","err","__spreadProps","__spreadValues","path","severity","clone","result","item","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","Style","Scope"]}
@@ -1,6 +1,6 @@
1
1
  import '@fern-api/csharp-codegen';
2
2
  import '@fern-api/dynamic-ir-sdk';
3
- export { a as DynamicLiteralMapper } from '../DynamicSnippetsGeneratorContext-DhvOZIoP.js';
3
+ export { a as DynamicLiteralMapper } from '../DynamicSnippetsGeneratorContext-pehoeH_w.js';
4
4
  import '@fern-api/csharp-codegen/lib/ast';
5
5
  import '@fern-api/csharp-codegen/lib/ast/types/Type';
6
6
  import '@fern-api/csharp-codegen/lib/context/model-navigator';
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-LWJEMG53.js";import"../chunk-PRAGN765.js";import"../chunk-QALVTPA5.js";export{a as DynamicLiteralMapper};
1
+ import{a}from"../chunk-3XDW3MPR.js";import"../chunk-KIW23CQ5.js";import"../chunk-CEB5TOCF.js";export{a as DynamicLiteralMapper};
2
2
  //# sourceMappingURL=DynamicLiteralMapper.js.map
@@ -4,4 +4,4 @@ import '@fern-api/csharp-codegen/lib/context/model-navigator';
4
4
  import '@fern-api/csharp-codegen';
5
5
  import '@fern-api/browser-compatible-base-generator';
6
6
  import '@fern-api/dynamic-ir-sdk';
7
- export { D as DynamicSnippetsGeneratorContext } from '../DynamicSnippetsGeneratorContext-DhvOZIoP.js';
7
+ export { D as DynamicSnippetsGeneratorContext } from '../DynamicSnippetsGeneratorContext-pehoeH_w.js';
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-TOOGWICF.js";import"../chunk-LWJEMG53.js";import"../chunk-PRAGN765.js";import"../chunk-TVSKLWL4.js";import"../chunk-WP3GAWOR.js";import"../chunk-QALVTPA5.js";export{a as DynamicSnippetsGeneratorContext};
1
+ import{a}from"../chunk-GEII674B.js";import"../chunk-3XDW3MPR.js";import"../chunk-KIW23CQ5.js";import"../chunk-EUEE2577.js";import"../chunk-DBQMCX7L.js";import"../chunk-CEB5TOCF.js";export{a as DynamicSnippetsGeneratorContext};
2
2
  //# sourceMappingURL=DynamicSnippetsGeneratorContext.js.map
@@ -1,6 +1,6 @@
1
1
  import '@fern-api/csharp-codegen';
2
2
  import '@fern-api/dynamic-ir-sdk';
3
- export { b as DynamicTypeMapper } from '../DynamicSnippetsGeneratorContext-DhvOZIoP.js';
3
+ export { b as DynamicTypeMapper } from '../DynamicSnippetsGeneratorContext-pehoeH_w.js';
4
4
  import '@fern-api/csharp-codegen/lib/ast';
5
5
  import '@fern-api/csharp-codegen/lib/ast/types/Type';
6
6
  import '@fern-api/csharp-codegen/lib/context/model-navigator';
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-TVSKLWL4.js";import"../chunk-QALVTPA5.js";export{a as DynamicTypeMapper};
1
+ import{a}from"../chunk-EUEE2577.js";import"../chunk-CEB5TOCF.js";export{a as DynamicTypeMapper};
2
2
  //# sourceMappingURL=DynamicTypeMapper.js.map
@@ -1,6 +1,6 @@
1
1
  import '@fern-api/csharp-codegen';
2
2
  import '@fern-api/dynamic-ir-sdk';
3
- export { F as FilePropertyInfo, c as FilePropertyMapper } from '../DynamicSnippetsGeneratorContext-DhvOZIoP.js';
3
+ export { F as FilePropertyInfo, c as FilePropertyMapper } from '../DynamicSnippetsGeneratorContext-pehoeH_w.js';
4
4
  import '@fern-api/csharp-codegen/lib/ast';
5
5
  import '@fern-api/csharp-codegen/lib/ast/types/Type';
6
6
  import '@fern-api/csharp-codegen/lib/context/model-navigator';
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-WP3GAWOR.js";import"../chunk-QALVTPA5.js";export{a as FilePropertyMapper};
1
+ import{a}from"../chunk-DBQMCX7L.js";import"../chunk-CEB5TOCF.js";export{a as FilePropertyMapper};
2
2
  //# sourceMappingURL=FilePropertyMapper.js.map
package/esm/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { Config } from './Config.js';
2
2
  export { DynamicSnippetsGenerator } from './DynamicSnippetsGenerator.js';
3
3
  import '@fern-api/browser-compatible-base-generator';
4
4
  import '@fern-api/dynamic-ir-sdk';
5
- import './DynamicSnippetsGeneratorContext-DhvOZIoP.js';
5
+ import './DynamicSnippetsGeneratorContext-pehoeH_w.js';
6
6
  import '@fern-api/csharp-codegen/lib/ast';
7
7
  import '@fern-api/csharp-codegen/lib/ast/types/Type';
8
8
  import '@fern-api/csharp-codegen/lib/context/model-navigator';
package/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-KHCIVF5J.js";import{a as e}from"./chunk-A53BGSGD.js";import"./chunk-ZEEJAJ4K.js";import"./chunk-TOOGWICF.js";import"./chunk-LWJEMG53.js";import"./chunk-PRAGN765.js";import"./chunk-TVSKLWL4.js";import"./chunk-WP3GAWOR.js";import"./chunk-QALVTPA5.js";export{e as DynamicSnippetsGenerator};
1
+ import"./chunk-KHCIVF5J.js";import{a as e}from"./chunk-KFPJC632.js";import"./chunk-EC2FLIE6.js";import"./chunk-GEII674B.js";import"./chunk-3XDW3MPR.js";import"./chunk-KIW23CQ5.js";import"./chunk-EUEE2577.js";import"./chunk-DBQMCX7L.js";import"./chunk-CEB5TOCF.js";export{e as DynamicSnippetsGenerator};
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fern-api/csharp-dynamic-snippets",
3
- "version": "0.0.6",
3
+ "version": "2.11.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",