@fern-api/go-dynamic-snippets 0.0.18 → 1.19.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 (65) hide show
  1. package/dist/index.cjs +32 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/{esm/DynamicSnippetsGeneratorContext-D8VcLYKk.d.ts → dist/index.d.cts} +77 -2
  4. package/{cjs/DynamicSnippetsGeneratorContext-D8VcLYKk.d.cts → dist/index.d.ts} +77 -2
  5. package/dist/index.js +32 -0
  6. package/dist/index.js.map +1 -0
  7. package/package.json +9 -10
  8. package/cjs/DynamicSnippetsGenerator.cjs +0 -37
  9. package/cjs/DynamicSnippetsGenerator.cjs.map +0 -1
  10. package/cjs/DynamicSnippetsGenerator.d.cts +0 -20
  11. package/cjs/EndpointSnippetGenerator.cjs +0 -37
  12. package/cjs/EndpointSnippetGenerator.cjs.map +0 -1
  13. package/cjs/EndpointSnippetGenerator.d.cts +0 -66
  14. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +0 -37
  15. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +0 -1
  16. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +0 -4
  17. package/cjs/context/DynamicTypeInstantiationMapper.cjs +0 -37
  18. package/cjs/context/DynamicTypeInstantiationMapper.cjs.map +0 -1
  19. package/cjs/context/DynamicTypeInstantiationMapper.d.cts +0 -4
  20. package/cjs/context/DynamicTypeMapper.cjs +0 -37
  21. package/cjs/context/DynamicTypeMapper.cjs.map +0 -1
  22. package/cjs/context/DynamicTypeMapper.d.cts +0 -4
  23. package/cjs/context/FilePropertyMapper.cjs +0 -37
  24. package/cjs/context/FilePropertyMapper.cjs.map +0 -1
  25. package/cjs/context/FilePropertyMapper.d.cts +0 -4
  26. package/cjs/index.cjs +0 -37
  27. package/cjs/index.cjs.map +0 -1
  28. package/cjs/index.d.cts +0 -6
  29. package/esm/DynamicSnippetsGenerator.d.ts +0 -20
  30. package/esm/DynamicSnippetsGenerator.js +0 -2
  31. package/esm/DynamicSnippetsGenerator.js.map +0 -1
  32. package/esm/EndpointSnippetGenerator.d.ts +0 -66
  33. package/esm/EndpointSnippetGenerator.js +0 -2
  34. package/esm/EndpointSnippetGenerator.js.map +0 -1
  35. package/esm/chunk-3Z2URLHB.js +0 -2
  36. package/esm/chunk-3Z2URLHB.js.map +0 -1
  37. package/esm/chunk-B2A7QNZM.js +0 -2
  38. package/esm/chunk-B2A7QNZM.js.map +0 -1
  39. package/esm/chunk-DVDVP26D.js +0 -2
  40. package/esm/chunk-DVDVP26D.js.map +0 -1
  41. package/esm/chunk-JHIUGKJ4.js +0 -37
  42. package/esm/chunk-JHIUGKJ4.js.map +0 -1
  43. package/esm/chunk-MYN2HZVH.js +0 -2
  44. package/esm/chunk-MYN2HZVH.js.map +0 -1
  45. package/esm/chunk-SVPRIX53.js +0 -2
  46. package/esm/chunk-SVPRIX53.js.map +0 -1
  47. package/esm/chunk-TXVHHFW3.js +0 -2
  48. package/esm/chunk-TXVHHFW3.js.map +0 -1
  49. package/esm/chunk-ZNTXZ3YV.js +0 -2
  50. package/esm/chunk-ZNTXZ3YV.js.map +0 -1
  51. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +0 -4
  52. package/esm/context/DynamicSnippetsGeneratorContext.js +0 -2
  53. package/esm/context/DynamicSnippetsGeneratorContext.js.map +0 -1
  54. package/esm/context/DynamicTypeInstantiationMapper.d.ts +0 -4
  55. package/esm/context/DynamicTypeInstantiationMapper.js +0 -2
  56. package/esm/context/DynamicTypeInstantiationMapper.js.map +0 -1
  57. package/esm/context/DynamicTypeMapper.d.ts +0 -4
  58. package/esm/context/DynamicTypeMapper.js +0 -2
  59. package/esm/context/DynamicTypeMapper.js.map +0 -1
  60. package/esm/context/FilePropertyMapper.d.ts +0 -4
  61. package/esm/context/FilePropertyMapper.js +0 -2
  62. package/esm/context/FilePropertyMapper.js.map +0 -1
  63. package/esm/index.d.ts +0 -6
  64. package/esm/index.js +0 -2
  65. package/esm/index.js.map +0 -1
@@ -1,20 +0,0 @@
1
- import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, AbstractFormatter, Options, AbstractAstNode } from '@fern-api/browser-compatible-base-generator';
2
- import { FernIr } from '@fern-api/dynamic-ir-sdk';
3
- import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-D8VcLYKk.cjs';
4
- import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.cjs';
5
- import '@fern-api/go-ast';
6
-
7
- declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, EndpointSnippetGenerator> {
8
- private formatter;
9
- constructor({ ir, config, formatter }: {
10
- ir: FernIr.dynamic.DynamicIntermediateRepresentation;
11
- config: FernGeneratorExec.GeneratorConfig;
12
- formatter?: AbstractFormatter;
13
- });
14
- generate(request: FernIr.dynamic.EndpointSnippetRequest, options?: Options): Promise<FernIr.dynamic.EndpointSnippetResponse>;
15
- generateSync(request: FernIr.dynamic.EndpointSnippetRequest, options?: Options): FernIr.dynamic.EndpointSnippetResponse;
16
- generateSnippetAst(request: FernIr.dynamic.EndpointSnippetRequest): Promise<AbstractAstNode>;
17
- protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator;
18
- }
19
-
20
- export { DynamicSnippetsGenerator };
@@ -1,37 +0,0 @@
1
- "use strict";var Te=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var It=Object.getOwnPropertyNames;var Nt=Object.prototype.hasOwnProperty;var vt=(n,t,e)=>t in n?Te(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var _e=(n,t)=>()=>(n&&(t=n(n=0)),t);var Ve=(n,t)=>{for(var e in t)Te(n,e,{get:t[e],enumerable:!0})},kt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of It(t))!Nt.call(n,i)&&i!==e&&Te(n,i,{get:()=>t[i],enumerable:!(r=At(t,i))||r.enumerable});return n};var Et=n=>kt(Te({},"__esModule",{value:!0}),n);var c=(n,t,e)=>vt(n,typeof t!="symbol"?t+"":t,e);function He(){throw new Error("setTimeout has not been defined")}function Ke(){throw new Error("clearTimeout has not been defined")}function je(n){if(Y===setTimeout)return setTimeout(n,0);if((Y===He||!Y)&&setTimeout)return Y=setTimeout,setTimeout(n,0);try{return Y(n,0)}catch(t){try{return Y.call(null,n,0)}catch(e){return Y.call(this,n,0)}}}function Rt(n){if(V===clearTimeout)return clearTimeout(n);if((V===Ke||!V)&&clearTimeout)return V=clearTimeout,clearTimeout(n);try{return V(n)}catch(t){try{return V.call(null,n)}catch(e){return V.call(this,n)}}}function bt(){!ce||!H||(ce=!1,H.length?M=H.concat(M):Ae=-1,M.length&&Je())}function Je(){if(!ce){var n=je(bt);ce=!0;for(var t=M.length;t;){for(H=M,M=[];++Ae<t;)H&&H[Ae].run();Ae=-1,t=M.length}H=null,ce=!1,Rt(n)}}function St(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];M.push(new ze(n,t)),M.length===1&&!ce&&je(Je)}function ze(n,t){this.fun=n,this.array=t}function K(){}function Ht(n){throw new Error("process.binding is not supported")}function Kt(){return"/"}function jt(n){throw new Error("process.chdir is not supported")}function Jt(){return 0}function Qt(n){var t=zt.call(ae)*.001,e=Math.floor(t),r=Math.floor(t%1*1e9);return n&&(e=e-n[0],r=r-n[1],r<0&&(e--,r+=1e9)),[e,r]}function Xt(){var n=new Date,t=n-Zt;return t/1e3}var Y,V,M,ce,H,Ae,Ft,Pt,Ct,_t,Bt,Lt,Mt,Ut,Wt,qt,$t,Dt,Ot,Yt,Vt,Gt,ae,zt,Zt,g,Ge,u=_e(()=>{"use strict";Y=He,V=Ke;typeof globalThis.setTimeout=="function"&&(Y=setTimeout);typeof globalThis.clearTimeout=="function"&&(V=clearTimeout);M=[],ce=!1,Ae=-1;ze.prototype.run=function(){this.fun.apply(null,this.array)};Ft="browser",Pt="browser",Ct=!0,_t={},Bt=[],Lt="",Mt={},Ut={},Wt={};qt=K,$t=K,Dt=K,Ot=K,Yt=K,Vt=K,Gt=K;ae=globalThis.performance||{},zt=ae.now||ae.mozNow||ae.msNow||ae.oNow||ae.webkitNow||function(){return new Date().getTime()};Zt=new Date;g={nextTick:St,title:Ft,browser:Ct,env:_t,argv:Bt,version:Lt,versions:Mt,on:qt,addListener:$t,once:Dt,off:Ot,removeListener:Yt,removeAllListeners:Vt,emit:Gt,binding:Ht,cwd:Kt,chdir:jt,umask:Jt,hrtime:Qt,platform:Pt,release:Ut,config:Wt,uptime:Xt},Ge={};Object.keys(Ge).forEach(n=>{let t=n.split("."),e=g;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=Ge[n]:e=e[i]||(e[i]={})}})});function et(){Le=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)P[t]=n[t],R[n.charCodeAt(t)]=t;R[45]=62,R[95]=63}function tr(n){Le||et();var t,e,r,i,o,s,h=n.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=n[h-2]==="="?2:n[h-1]==="="?1:0,s=new er(h*3/4-o),r=o>0?h-4:h;var l=0;for(t=0,e=0;t<r;t+=4,e+=3)i=R[n.charCodeAt(t)]<<18|R[n.charCodeAt(t+1)]<<12|R[n.charCodeAt(t+2)]<<6|R[n.charCodeAt(t+3)],s[l++]=i>>16&255,s[l++]=i>>8&255,s[l++]=i&255;return o===2?(i=R[n.charCodeAt(t)]<<2|R[n.charCodeAt(t+1)]>>4,s[l++]=i&255):o===1&&(i=R[n.charCodeAt(t)]<<10|R[n.charCodeAt(t+1)]<<4|R[n.charCodeAt(t+2)]>>2,s[l++]=i>>8&255,s[l++]=i&255),s}function rr(n){return P[n>>18&63]+P[n>>12&63]+P[n>>6&63]+P[n&63]}function nr(n,t,e){for(var r,i=[],o=t;o<e;o+=3)r=(n[o]<<16)+(n[o+1]<<8)+n[o+2],i.push(rr(r));return i.join("")}function Qe(n){Le||et();for(var t,e=n.length,r=e%3,i="",o=[],s=16383,h=0,l=e-r;h<l;h+=s)o.push(nr(n,h,h+s>l?l:h+s));return r===1?(t=n[e-1],i+=P[t>>2],i+=P[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=P[t>>10],i+=P[t>>4&63],i+=P[t<<2&63],i+="="),o.push(i),o.join("")}function Ie(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function U(n,t){if(Ie()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=a.prototype):(n===null&&(n=new a(t)),n.length=t),n}function a(n,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Me(this,n)}return tt(this,n,t,e)}function tt(n,t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?sr(n,t,e,r):typeof t=="string"?or(n,t,e):ar(n,t)}function rt(n){if(typeof n!="number")throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative')}function ir(n,t,e,r){return rt(t),t<=0?U(n,t):e!==void 0?typeof r=="string"?U(n,t).fill(e,r):U(n,t).fill(e):U(n,t)}function Me(n,t){if(rt(t),n=U(n,t<0?0:Ue(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function or(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=nt(t,e)|0;n=U(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Be(n,t){var e=t.length<0?0:Ue(t.length)|0;n=U(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function sr(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),a.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=a.prototype):n=Be(n,t),n}function ar(n,t){if(C(t)){var e=Ue(t.length)|0;return n=U(n,e),n.length===0||t.copy(n,0,0,e),n}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||Er(t.length)?U(n,0):Be(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Be(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Ue(n){if(n>=Ie())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ie().toString(16)+" bytes");return n|0}function C(n){return!!(n!=null&&n._isBuffer)}function nt(n,t){if(C(n))return n.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(n)||n instanceof ArrayBuffer))return n.byteLength;typeof n!="string"&&(n=""+n);var e=n.length;if(e===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Ne(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return pt(n).length;default:if(r)return Ne(n).length;t=(""+t).toLowerCase(),r=!0}}function cr(n,t,e){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(n||(n="utf8");;)switch(n){case"hex":return wr(this,t,e);case"utf8":case"utf-8":return st(this,t,e);case"ascii":return yr(this,t,e);case"latin1":case"binary":return gr(this,t,e);case"base64":return dr(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xr(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function j(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function it(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,r)),C(t))return t.length===0?-1:Ze(n,t,e,r,i);if(typeof t=="number")return t=t&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):Ze(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function Ze(n,t,e,r,i){var o=1,s=n.length,h=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;o=2,s/=2,h/=2,e/=2}function l(T,A){return o===1?T[A]:T.readUInt16BE(A*o)}var m;if(i){var d=-1;for(m=e;m<s;m++)if(l(n,m)===l(t,d===-1?0:m-d)){if(d===-1&&(d=m),m-d+1===h)return d*o}else d!==-1&&(m-=m-d),d=-1}else for(e+h>s&&(e=s-h),m=e;m>=0;m--){for(var y=!0,x=0;x<h;x++)if(l(n,m+x)!==l(t,x)){y=!1;break}if(y)return m}return-1}function ur(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var h=parseInt(t.substr(s*2,2),16);if(isNaN(h))return s;n[e+s]=h}return s}function pr(n,t,e,r){return Ee(Ne(t,n.length-e),n,e,r)}function ot(n,t,e,r){return Ee(vr(t),n,e,r)}function hr(n,t,e,r){return ot(n,t,e,r)}function fr(n,t,e,r){return Ee(pt(t),n,e,r)}function lr(n,t,e,r){return Ee(kr(t,n.length-e),n,e,r)}function dr(n,t,e){return t===0&&e===n.length?Qe(n):Qe(n.slice(t,e))}function st(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var o=n[i],s=null,h=o>239?4:o>223?3:o>191?2:1;if(i+h<=e){var l,m,d,y;switch(h){case 1:o<128&&(s=o);break;case 2:l=n[i+1],(l&192)===128&&(y=(o&31)<<6|l&63,y>127&&(s=y));break;case 3:l=n[i+1],m=n[i+2],(l&192)===128&&(m&192)===128&&(y=(o&15)<<12|(l&63)<<6|m&63,y>2047&&(y<55296||y>57343)&&(s=y));break;case 4:l=n[i+1],m=n[i+2],d=n[i+3],(l&192)===128&&(m&192)===128&&(d&192)===128&&(y=(o&15)<<18|(l&63)<<12|(m&63)<<6|d&63,y>65535&&y<1114112&&(s=y))}}s===null?(s=65533,h=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=h}return mr(r)}function mr(n){var t=n.length;if(t<=Xe)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=Xe));return e}function yr(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function gr(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function wr(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",o=t;o<e;++o)i+=Nr(n[o]);return i}function xr(n,t,e){for(var r=n.slice(t,e),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+r[o+1]*256);return i}function I(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function E(n,t,e,r,i,o){if(!C(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function ve(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(n.length-e,2);i<o;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function ke(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(n.length-e,4);i<o;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function at(n,t,e,r,i,o){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function ct(n,t,e,r,i){return i||at(n,t,e,4,34028234663852886e22,-34028234663852886e22),ft(n,t,e,r,23,4),e+4}function ut(n,t,e,r,i){return i||at(n,t,e,8,17976931348623157e292,-17976931348623157e292),ft(n,t,e,r,52,8),e+8}function Ar(n){if(n=Ir(n).replace(Tr,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Ir(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Nr(n){return n<16?"0"+n.toString(16):n.toString(16)}function Ne(n,t){t=t||1/0;for(var e,r=n.length,i=null,o=[],s=0;s<r;++s){if(e=n.charCodeAt(s),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function vr(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function kr(n,t){for(var e,r,i,o=[],s=0;s<n.length&&!((t-=2)<0);++s)e=n.charCodeAt(s),r=e>>8,i=e%256,o.push(i),o.push(r);return o}function pt(n){return tr(Ar(n))}function Ee(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function Er(n){return n!==n}function Rr(n){return n!=null&&(!!n._isBuffer||ht(n)||br(n))}function ht(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function br(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&ht(n.slice(0,0))}function Re(n,t,e,r,i){var o,s,h=i*8-r-1,l=(1<<h)-1,m=l>>1,d=-7,y=e?i-1:0,x=e?-1:1,T=n[t+y];for(y+=x,o=T&(1<<-d)-1,T>>=-d,d+=h;d>0;o=o*256+n[t+y],y+=x,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=s*256+n[t+y],y+=x,d-=8);if(o===0)o=1-m;else{if(o===l)return s?NaN:(T?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-m}return(T?-1:1)*s*Math.pow(2,o-r)}function ft(n,t,e,r,i,o){var s,h,l,m=o*8-i-1,d=(1<<m)-1,y=d>>1,x=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=r?0:o-1,A=r?1:-1,G=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(h=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+y>=1?t+=x/l:t+=x*Math.pow(2,1-y),t*l>=2&&(s++,l/=2),s+y>=d?(h=0,s=d):s+y>=1?(h=(t*l-1)*Math.pow(2,i),s=s+y):(h=t*Math.pow(2,y-1)*Math.pow(2,i),s=0));i>=8;n[e+T]=h&255,T+=A,h/=256,i-=8);for(s=s<<i|h,m+=i;m>0;n[e+T]=s&255,T+=A,s/=256,m-=8);n[e+T-A]|=G*128}var P,R,er,Le,Xe,Tr,lt=_e(()=>{"use strict";u();p();P=[],R=[],er=typeof Uint8Array!="undefined"?Uint8Array:Array,Le=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(n){return n.__proto__=a.prototype,n};a.from=function(n,t,e){return tt(null,n,t,e)};a.kMaxLength=Ie();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(n,t,e){return ir(null,n,t,e)};a.allocUnsafe=function(n){return Me(null,n)};a.allocUnsafeSlow=function(n){return Me(null,n)};a.isBuffer=Rr;a.compare=function(t,e){if(!C(t)||!C(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,o=0,s=Math.min(r,i);o<s;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0};a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=a.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!C(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,o),o+=s.length}return i};a.byteLength=nt;a.prototype._isBuffer=!0;a.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)j(this,e,e+1);return this};a.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)j(this,e,e+3),j(this,e+1,e+2);return this};a.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)j(this,e,e+7),j(this,e+1,e+6),j(this,e+2,e+5),j(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?st(this,0,t):cr.apply(this,arguments)};a.prototype.equals=function(t){if(!C(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,r,i,o){if(!C(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=r)return 0;if(i>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,h=r-e,l=Math.min(s,h),m=this.slice(i,o),d=t.slice(e,r),y=0;y<l;++y)if(m[y]!==d[y]){s=m[y],h=d[y];break}return s<h?-1:h<s?1:0};a.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};a.prototype.indexOf=function(t,e,r){return it(this,t,e,r,!0)};a.prototype.lastIndexOf=function(t,e,r){return it(this,t,e,r,!1)};a.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((r===void 0||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return ur(this,t,e,r);case"utf8":case"utf-8":return pr(this,t,e,r);case"ascii":return ot(this,t,e,r);case"latin1":case"binary":return hr(this,t,e,r);case"base64":return fr(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lr(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Xe=4096;a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(a.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=a.prototype;else{var o=e-t;i=new a(o,void 0);for(var s=0;s<o;++s)i[s]=this[s+t]}return i};a.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||I(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return i};a.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||I(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};a.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||I(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};a.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||I(t,e,this.length);for(var i=e,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*e)),s};a.prototype.readInt8=function(t,e){return e||I(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};a.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};a.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),Re(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),Re(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),Re(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),Re(this,t,!1,52,8)};a.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;E(this,t,e,r,o,0)}var s=1,h=0;for(this[e]=t&255;++h<r&&(s*=256);)this[e+h]=t/s&255;return e+r};a.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var o=Math.pow(2,8*r)-1;E(this,t,e,r,o,0)}var s=r-1,h=1;for(this[e+s]=t&255;--s>=0&&(h*=256);)this[e+s]=t/h&255;return e+r};a.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||E(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||E(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ve(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||E(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ve(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||E(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):ke(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||E(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ke(this,t,e,!1),e+4};a.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);E(this,t,e,r,o-1,-o)}var s=0,h=1,l=0;for(this[e]=t&255;++s<r&&(h*=256);)t<0&&l===0&&this[e+s-1]!==0&&(l=1),this[e+s]=(t/h>>0)-l&255;return e+r};a.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*r-1);E(this,t,e,r,o-1,-o)}var s=r-1,h=1,l=0;for(this[e+s]=t&255;--s>=0&&(h*=256);)t<0&&l===0&&this[e+s+1]!==0&&(l=1),this[e+s]=(t/h>>0)-l&255;return e+r};a.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||E(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};a.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||E(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ve(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||E(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ve(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||E(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ke(this,t,e,!0),e+4};a.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||E(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ke(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,r){return ct(this,t,e,!0,r)};a.prototype.writeFloatBE=function(t,e,r){return ct(this,t,e,!1,r)};a.prototype.writeDoubleLE=function(t,e,r){return ut(this,t,e,!0,r)};a.prototype.writeDoubleBE=function(t,e,r){return ut(this,t,e,!1,r)};a.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var o=i-r,s;if(this===t&&r<e&&e<i)for(s=o-1;s>=0;--s)t[s+e]=this[s+r];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o};a.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var s;if(typeof t=="number")for(s=e;s<r;++s)this[s]=t;else{var h=C(t)?t:Ne(new a(t,i).toString()),l=h.length;for(s=0;s<r-e;++s)this[s+e]=h[s%l]}return this};Tr=/[^+\/0-9A-Za-z-_]/g});var p=_e(()=>{"use strict";lt()});var fn={};Ve(fn,{EndpointSnippetGenerator:()=>Ye});module.exports=Et(fn);u();p();u();p();u();p();function b(n){throw new Error("Unexpected value: "+JSON.stringify(n))}u();p();u();p();u();p();var dt,mt,fe=(mt=(dt=g.env.FERN_STACK_TRACK)==null?void 0:dt.toLowerCase())!=null?mt:"",_=fe!==""&&fe!=="0"&&fe!=="false",We=["single","multiline","box"].includes(fe)?fe:"single";_&&(Error.stackTraceLimit=50);var Sr=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Fr=new Set(["stacktrace"]);function Se({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:o=!0,filterJs:s=!0,formatFilename:h=l=>l}={}){var m;if(!_)return[];r=[...r,...Sr],e=[...e,...Fr],i=[...i,"runInteractiveTask"];let l=!1;return((m=new Error().stack)!=null?m:"").split(`
2
- `).map(d=>{let y=d.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(y&&y.length===5){let[,x,T,A,G]=y;if(!x||!T||!A||!G)return;if(l||i.some(he=>x==null?void 0:x.includes(he))){l=!0;return}switch(x){case"Object.<anonymous>":x="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":x=`${x.substring(x.indexOf(".")+1)}()=> { ... }`;break}return{fn:x,path:h(T),position:`${A}:${G}`}}}).filter(d=>{var y,x;return d&&!r.some(T=>d.fn.includes(T))&&!(o&&((y=d.path)!=null&&y.startsWith("node:")))&&!(s&&((x=d.path)!=null&&x.endsWith(".js")))&&!e.some(T=>d.path.includes(T))}).slice(t,t+n)}var be=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:r=[],filterFunctions:i=[],stopOn:o=[],filterNode:s=!0,filterJs:h=!0,multiline:l=!1,formatFilename:m=d=>d}={}){c(this,"maxFrames");c(this,"skip");c(this,"filterPaths");c(this,"filterFunctions");c(this,"stopOn");c(this,"filterNode");c(this,"filterJs");c(this,"multiline");c(this,"formatFilename");c(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=r,this.filterFunctions=i,this.stopOn=o,this.filterNode=s,this.filterJs=h,this.multiline=l,this.formatFilename=m}tag(t){let e=this.tracking.get(t)||new Set;Se({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(r=>e.add(r)),this.tracking.set(t,e)}trace(t){if(!_)return"";let e=this.tracking.get(t);return e?[...e].map(r=>`${this.multiline?`
3
- `:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},W;function yt({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:o=!0,filterJs:s=!0,multiline:h=!1,formatFilename:l=m=>m}={}){_&&(W!=null||(W=new be({maxFrames:n,skip:t,filterPaths:e,filterFunctions:r,stopOn:i,filterNode:o,filterJs:s,multiline:h,formatFilename:l})))}function gt(n){W==null||W.tag(n)}function qe(n){var t;return(t=W==null?void 0:W.frames(n))!=null?t:[]}var J=class{constructor(){gt(this)}};u();p();var Fe=class{formatMultiple(t){return Promise.all(t.map(e=>this.format(e)))}formatMultipleSync(t){return t.map(e=>this.formatSync(e))}},le=class extends Fe{async format(t){return t}formatSync(t){return t}};u();p();u();p();u();p();var S=class extends J{constructor(e){super();c(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):typeof this.value=="function"?this.value(e):this.value.write(e)}};var Pr=4;yt({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var de=class{constructor(){c(this,"lineBuffer",[]);c(this,"indentLevel",0);c(this,"hasWrittenAnything",!1);c(this,"lastCharacterIsSemicolon",!1);c(this,"lastCharacterIsNewline",!1);c(this,"nodeStackFrames",[])}get buffer(){return _&&this.nodeStackFrames.length>0&&this.writeInternal(`
4
- `),this.lineBuffer.join(`
5
- `)+(this.lastCharacterIsNewline?`
6
- `:"")}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let r=e.length>0&&e.endsWith(`
7
- `),i=r?e.substring(0,e.length-1):e,o=this.getIndentString(),s=i.replaceAll(`
8
- `,`
9
- ${o}`);this.isAtStartOfLine()&&(s=o+s),r&&(s+=`
10
- `),this.writeInternal(s)}else this.writeNode(e)}writeStatement(...t){this.write(...t),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){_&&this.nodeStackFrames.push(...qe(t)),t.write(this),_&&We!=="single"&&this.writeInternal(`
11
- `)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){this.writeNode(t),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new S(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new S(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new S(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new S(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new S(t).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(t=!0){this.dedent(),this.writeNewLineIfLastLineNot(),t?this.writeLine("}"):this.write("}")}writeLine(...t){this.write(...t.length===0?[""]:t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
12
- `)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
13
- `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let i=t[0];i!=null&&r(i);for(let o=1;o<t.length;o++){this.write(e);let s=t[o];s!=null&&r(s)}}}toString(){return this.buffer}writeInternal(t){if(t.length===0)return;let e=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
14
- `),this.lastCharacterIsSemicolon=t.endsWith(";");let r=t.split(`
15
- `),i=_&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),i&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(r=>`${e?`(${e}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(Se({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,We){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Pr}};u();p();u();p();var q={Critical:"CRITICAL",Warning:"WARNING"};u();p();var B={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};u();p();u();p();function $e(n,t){var r,i;let e=(r=n.split("/").pop())!=null?r:n;return t!=null&&t.stripExtension&&(i=e.split(".")[0])!=null?i:e}u();p();u();p();u();p();var Cr=/[^0-9a-zA-Z_]/g,_r=["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],z=class extends de{constructor({packageName:e,rootImportPath:r,importPath:i,customConfig:o,formatter:s}){super();c(this,"packageName");c(this,"rootImportPath");c(this,"importPath");c(this,"customConfig");c(this,"formatter");c(this,"imports",{});this.packageName=e,this.rootImportPath=r,this.importPath=i,this.customConfig=o,this.formatter=s!=null?s:new le}addImport(e){let r=this.imports[e];if(r!=null)return r;if(e===this.rootImportPath&&this.customConfig.packageName!=null)return this.imports[e]=this.customConfig.packageName,this.customConfig.packageName;let i=new Set(Object.values(this.imports)),o=e.split("/");for(let h=1;h<=o.length;h++){let l=o.slice(-h),m=this.getValidAlias(l.join(""));if(!i.has(m))return this.imports[e]=m,m}let s=this.getValidAlias($e(e));for(;i.has(s);)s="_"+s;return this.imports[e]=s,s}isValidAlias(e){return!_r.includes(e)}getValidAlias(e){let r=e.split("-");if(r[0]==null)return e;let i=r.map(o=>o.replace(Cr,"")).join("");return this.isValidAlias(i)?i:"_"+i}};var me=class extends z{constructor({packageName:t,rootImportPath:e,importPath:r,customConfig:i,formatter:o}){super({packageName:t,rootImportPath:e,importPath:r,customConfig:i,formatter:o})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(e){throw new Error(`Failed to format Go file: ${e}
16
- ${t}`)}return t}toString(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(t)}catch(e){throw new Error(`Failed to format Go file: ${e}
17
- ${t}`)}return t}getContent(){let t=`package ${this.packageName}
18
-
19
- `,e=this.stringifyImports();return e.length>0?`${t}${e}
20
-
21
- ${this.buffer}`:t+this.buffer}stringifyImports(){let t=Object.entries(this.imports).filter(([e,r])=>e!==this.importPath).map(([e,r])=>` ${r} "${e}"`).join(`
22
- `);return t?`import (
23
- ${t}
24
- )`:""}};var f={};Ve(f,{Alias:()=>Q,AstNode:()=>w,CodeBlock:()=>L,Enum:()=>Z,Field:()=>X,File:()=>ee,Func:()=>te,FuncInvocation:()=>F,IoReaderTypeReference:()=>De,Method:()=>O,MethodInvocation:()=>D,MultiNode:()=>ye,Parameter:()=>re,Pointer:()=>ne,Selector:()=>ie,Struct:()=>oe,TimeTypeReference:()=>Pe,Type:()=>we,TypeDeclaration:()=>se,TypeInstantiation:()=>v,TypeReference:()=>k,UuidTypeReference:()=>Ce,Writer:()=>z,alias:()=>Gr,codeblock:()=>Hr,enum_:()=>Kr,field:()=>jr,file:()=>Jr,func:()=>zr,identifier:()=>Qr,invokeFunc:()=>Zr,invokeMethod:()=>Xr,method:()=>en,parameter:()=>tn,pointer:()=>rn,selector:()=>nn,struct:()=>on,switch_:()=>sn,typeDeclaration:()=>an,typeReference:()=>cn});u();p();u();p();u();p();u();p();u();p();var w=class extends J{async toStringAsync({packageName:t,rootImportPath:e,importPath:r,customConfig:i,formatter:o}){let s=new me({packageName:t,rootImportPath:e,importPath:r,customConfig:i,formatter:o});return this.write(s),s.toStringAsync()}toString({packageName:t,rootImportPath:e,importPath:r,customConfig:i,formatter:o}){let s=new me({packageName:t,rootImportPath:e,importPath:r,customConfig:i,formatter:o});return this.write(s),s.toString()}};var N=class extends w{constructor({docs:e}={}){super();c(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
25
- `).forEach(r=>{e.writeLine(`// ${r}`)})}};var Q=class extends w{constructor({name:e,type:r,docs:i}){super();c(this,"name");c(this,"type");c(this,"docs");this.name=e,this.type=r,this.docs=i}write(e){e.writeNode(new N({docs:this.docs})),e.write("type "),e.write(this.name),e.write(" = "),e.writeNode(this.type)}};u();p();var L=class extends w{constructor(e){super();c(this,"arg");this.arg=e}write(e){return new S(this.arg).write(e)}};u();p();u();p();var $=class extends w{constructor(e){super();c(this,"name");this.name=e}write(e){e.write(this.name)}};u();p();u();p();u();p();function ue({writer:n,arguments_:t,multiline:e=!0}){let r=t.map(i=>i instanceof v&&v.isNop(i)?v.nil():i);if(r.length===0){n.write("()");return}if(e){Br({writer:n,arguments_:r});return}Lr({writer:n,arguments_:r})}function Br({writer:n,arguments_:t}){n.writeLine("("),n.indent();for(let e of t)e.write(n),n.writeLine(",");n.dedent(),n.write(")")}function Lr({writer:n,arguments_:t}){n.write("("),t.forEach((e,r)=>{r>0&&n.write(", "),e.write(n)}),n.write(")")}var F=class extends w{constructor({func:e,arguments_:r,multiline:i=!0}){super();c(this,"func");c(this,"arguments_");c(this,"multiline");this.func=e,this.arguments_=r,this.multiline=i}write(e){e.writeNode(this.func),ue({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};u();p();u();p();function wt({writer:n,generics:t}){t.length!==0&&(n.write("["),t.forEach((e,r)=>{r>0&&n.write(", "),e!=null&&n.writeNode(e)}),n.write("]"))}var k=class extends w{constructor({name:e,importPath:r,generics:i}){super();c(this,"name");c(this,"importPath");c(this,"generics");this.name=e,this.importPath=r,this.generics=i}write(e){if(this.importPath==null||e.importPath===this.importPath){e.write(this.name);return}let r=e.addImport(this.importPath);e.write(`${r}.${this.name}`),this.generics!=null&&wt({writer:e,generics:this.generics})}};u();p();var D=class extends w{constructor({method:e,arguments_:r,on:i,multiline:o}){super();c(this,"on");c(this,"method");c(this,"arguments_");c(this,"multiline");this.on=i,this.method=e,this.arguments_=r,this.multiline=o}write(e){this.on.write(e),e.write("."),e.write(this.method),ue({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};var Mr=new Set(["bool","date","dateTime","float64","int","int64","string","uuid"]),xt=new Set(["any","bytes","map","slice"]),v=class n extends w{constructor(e){super();c(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"any":this.writeAny({writer:e,value:this.internalType.value});break;case"bool":e.write(this.internalType.value.toString());break;case"bytes":e.write(`[]byte("${this.internalType.value}")`);break;case"date":case"dateTime":e.writeNode(qr({writer:e,type:this.internalType}));break;case"enum":e.writeNode(this.internalType.typeReference);break;case"float64":e.write(this.internalType.value.toString());break;case"int":case"int64":e.write(this.internalType.value.toString());break;case"map":this.writeMap({writer:e,map:this.internalType});break;case"nil":e.write("nil");break;case"nop":break;case"optional":this.writeOptional({writer:e,type:this.internalType.value});break;case"reference":e.writeNode(this.internalType.value);break;case"slice":this.writeSlice({writer:e,slice:this.internalType});break;case"string":e.write(this.internalType.value.includes('"')||this.internalType.value.includes(`
26
- `)?`\`${this.internalType.value}\``:`"${this.internalType.value}"`);break;case"struct":this.writeStruct({writer:e,struct:this.internalType});break;case"uuid":e.writeNode($r({value:this.internalType.value}));break;default:b(this.internalType)}}static any(e){return new this({type:"any",value:e})}static bool(e){return new this({type:"bool",value:e})}static bytes(e){return new this({type:"bytes",value:e})}static date(e){return new this({type:"date",value:e})}static dateTime(e){return new this({type:"dateTime",value:e})}static enum(e){return new this({type:"enum",typeReference:e})}static float64(e){return new this({type:"float64",value:e})}static int(e){return new this({type:"int",value:e})}static int64(e){return new this({type:"int64",value:e})}static map({keyType:e,valueType:r,entries:i}){return new this({type:"map",keyType:e,valueType:r,entries:i})}static nil(){return new this({type:"nil"})}static nop(){return new this({type:"nop"})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static reference(e){return new this({type:"reference",value:e})}static slice({valueType:e,values:r}){return new this({type:"slice",valueType:e,values:r})}static string(e){return new this({type:"string",value:e})}static struct({typeReference:e,fields:r}){return new this({type:"struct",typeReference:e,fields:r})}static structPointer({typeReference:e,fields:r,generics:i}){return new this({type:"optional",value:new this({type:"struct",typeReference:e,fields:r,generics:i})})}static uuid(e){return new this({type:"uuid",value:e})}static isNop(e){return e.internalType.type==="optional"?this.isNop(e.internalType.value):e.internalType.type==="nop"}writeAny({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r.toString());return;case"string":e.write(r.includes('"')?`\`${r}\``:`"${r}"`);return;case"number":e.write(r.toString());return;case"object":if(r==null){e.write("nil");return}if(Array.isArray(r)){this.writeAnyArray({writer:e,value:r});return}this.writeAnyObject({writer:e,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeAnyArray({writer:e,value:r}){if(e.write("[]any"),r.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let i of r)e.writeNode(n.any(i)),e.writeLine(",");e.dedent(),e.write("}")}writeAnyObject({writer:e,value:r}){e.write("map[string]any");let i=Object.entries(r);if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[o,s]of i)e.write(`"${o}": `),e.writeNode(n.any(s)),e.writeLine(",");e.dedent(),e.write("}")}writeMap({writer:e,map:r}){e.write("map["),e.writeNode(r.keyType),e.write("]"),e.writeNode(r.valueType);let i=Dr({entries:r.entries});if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let o of i)o.key.write(e),e.write(": "),o.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}writeOptional({writer:e,type:r}){if(Mr.has(r.internalType.type)){e.writeNode(Ur({writer:e,type:r}));return}if(xt.has(r.internalType.type)){r.write(e);return}if(r.internalType.type==="enum"){e.writeNode(new D({on:r.internalType.typeReference,method:"Ptr",arguments_:[]}));return}e.write("&"),r.write(e)}static isAlreadyOptional(e){return e.internalType.type==="optional"||xt.has(e.internalType.type)}writeSlice({writer:e,slice:r}){e.write("[]"),e.writeNode(r.valueType);let i=Yr({values:r.values});if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let o of i)o.write(e),e.writeLine(",");e.dedent(),e.write("}")}writeStruct({writer:e,struct:r}){e.writeNode(r.typeReference),r.generics!=null&&(e.write("["),r.generics.forEach((o,s)=>{s>0&&e.write(", "),e.writeNode(o)}),e.write("]"));let i=Or({fields:r.fields});if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let o of i)e.write(`${o.name}: `),o.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}};function Ur({writer:n,type:t}){return new F({func:new k({name:Wr({type:t}),importPath:n.rootImportPath}),arguments_:[t]})}function Wr({type:n}){switch(n.internalType.type){case"bool":return"Bool";case"date":case"dateTime":return"Time";case"float64":return"Float64";case"int":return"Int";case"int64":return"Int64";case"string":return"String";case"uuid":return"UUID";default:return""}}function qr({writer:n,type:t}){let e=t.type==="date"?"MustParseDate":"MustParseDateTime";return new F({func:new k({name:e,importPath:n.rootImportPath}),arguments_:[new L(`"${t.value}"`)]})}function $r({value:n}){return new F({func:new k({name:"MustParse",importPath:"github.com/google/uuid"}),arguments_:[new L(`"${n}"`)]})}function Dr({entries:n}){return n.filter(t=>!v.isNop(t.key)&&!v.isNop(t.value))}function Or({fields:n}){return n.filter(t=>!v.isNop(t.value))}function Yr({values:n}){return n.filter(t=>!v.isNop(t))}var Z=class n extends w{constructor({name:e,docs:r}){super();c(this,"name");c(this,"docs");c(this,"members",[]);c(this,"methods",[]);c(this,"constructor_");this.name=e,this.docs=r}addConstructor(e){this.constructor_=e}addMember(e){this.members.push(e)}addMethod(e){this.methods.push(e)}write(e){this.writeType({writer:e}),this.writeMembers({writer:e}),this.writeConstructor({writer:e}),this.writeMethods({writer:e})}writeType({writer:e}){e.writeNode(new N({docs:this.docs})),e.writeLine(`type ${this.name} string`)}writeMembers({writer:e}){if(this.members.length!==0){e.newLine(),e.writeLine("const ("),e.indent();for(let r of this.members)e.writeNode(new N({docs:r.docs})),e.writeNode(n.getMemberIdentifier({name:this.name,member:r})),e.write(" = "),e.writeNode(v.string(r.value)),e.newLine();e.dedent(),e.write(")")}}writeConstructor({writer:e}){this.constructor_!=null&&(e.newLine(),e.writeNode(this.constructor_))}writeMethods({writer:e}){e.newLine();for(let r of this.methods)e.newLine(),e.writeNode(r),e.newLine()}static getMemberIdentifier({name:e,member:r}){return new $(`${e}${r.name}`)}};u();p();var X=class extends w{constructor({name:e,type:r,docs:i,tags:o}){super();c(this,"name");c(this,"type");c(this,"docs");c(this,"tags",[]);this.name=e,this.type=r,this.docs=i,this.tags=o!=null?o:[]}addTags(...e){this.tags.push(...e)}write(e){e.writeNode(new N({docs:this.docs})),e.write(`${this.name} `),this.type.write(e),this.writeTags({writer:e})}writeTags({writer:e}){this.tags.length!==0&&(e.write(" `"),this.tags.forEach((r,i)=>{i>0&&e.write(" "),e.write(`${r.name}:"${r.value}"`)}),e.write("`"))}};u();p();var ee=class extends w{constructor({nodes:e}={nodes:[]}){super();c(this,"nodes");this.nodes=e!=null?e:[]}add(...e){this.nodes.push(...e)}write(e){for(let r of this.nodes)r.write(e)}};u();p();u();p();var O=class extends w{constructor({name:e,parameters:r,return_:i,body:o,docs:s,typeReference:h,multiline:l,receiver:m,pointerReceiver:d}){super();c(this,"parameters");c(this,"return_");c(this,"name");c(this,"body");c(this,"docs");c(this,"typeReference");c(this,"multiline");c(this,"receiver");c(this,"pointerReceiver");this.name=e,this.parameters=r,this.return_=i,this.body=o,this.docs=s,this.typeReference=h,this.multiline=l,this.receiver=m,this.pointerReceiver=d}write(e){var r;e.writeNode(new N({docs:this.docs})),e.write("func"),this.typeReference!=null&&this.writeReceiver({writer:e,typeReference:this.typeReference,receiver:this.receiver}),this.name!=null&&e.write(` ${this.name}`),ue({writer:e,arguments_:this.parameters,multiline:this.multiline}),this.return_!=null&&(e.write(" "),this.return_.length>1&&e.write("("),this.return_.forEach((i,o)=>{o>0&&e.write(", "),e.writeNode(i)}),this.return_.length>1&&e.write(")")),e.writeLine("{"),e.indent(),(r=this.body)==null||r.write(e),e.dedent(),e.writeNewLineIfLastLineNot(),e.write("}")}writeReceiver({writer:e,typeReference:r,receiver:i}){e.write(` (${this.getReceiverName({typeReference:r,receiver:i})} `),this.pointerReceiver&&e.write("*"),r.write(e),e.write(")")}getReceiverName({typeReference:e,receiver:r}){return r!=null?r:e.name.charAt(0).toLowerCase()}};var te=class extends w{constructor({name:e,parameters:r,return_:i,body:o,docs:s,multiline:h}){super();c(this,"func");this.func=new O({name:e,parameters:r,return_:i,body:o,docs:s,multiline:h})}get parameters(){return this.func.parameters}get return_(){return this.func.return_}get name(){return this.func.name}get body(){return this.func.body}get docs(){return this.func.docs}write(e){e.writeNode(this.func)}};u();p();var ye=class extends w{constructor({nodes:e}){super();c(this,"nodes");this.nodes=e}write(e){for(let r of this.nodes)e.newLine(),r.write(e),e.newLine()}};u();p();var re=class extends w{constructor({name:e,type:r,docs:i}){super();c(this,"name");c(this,"type");c(this,"docs");this.name=e,this.type=r,this.docs=i}write(e){e.writeNode(new N({docs:this.docs})),e.write(`${this.name} `),this.type.write(e)}};u();p();var ne=class extends w{constructor({node:e}){super();c(this,"node");this.node=e}write(e){e.write("*"),this.node.write(e)}};u();p();var ie=class extends w{constructor({on:e,selector:r}){super();c(this,"on");c(this,"selector");this.on=e,this.selector=r}write(e){e.writeNode(this.on),e.write("."),e.writeNode(this.selector)}};u();p();var oe=class extends w{constructor({name:e,embeds:r,fields:i,docs:o}){super();c(this,"name");c(this,"embeds",[]);c(this,"fields",[]);c(this,"docs");c(this,"methods",[]);c(this,"constructor_");this.name=e,this.docs=o,this.embeds=r!=null?r:[],this.fields=i!=null?i:[]}addConstructor(e){this.constructor_=e}addField(...e){this.fields.push(...e)}addMethod(...e){this.methods.push(...e)}write(e){this.writeType({writer:e}),this.constructor_!=null&&(e.newLine(),e.newLine(),this.writeConstructor({writer:e,constructor:this.constructor_})),this.writeMethods({writer:e})}writeType({writer:e}){if(e.writeNode(new N({docs:this.docs})),this.name!=null?e.write(`type ${this.name} struct {`):e.write("struct{"),this.embeds.length===0&&this.fields.length===0){e.writeLine("}");return}e.newLine(),e.indent();for(let o of this.embeds)e.writeNode(o),e.newLine();let r=this.fields.filter(o=>this.isExported(o));for(let o of r)e.writeNode(o),e.newLine();let i=this.fields.filter(o=>!this.isExported(o));r.length>0&&i.length>0&&e.newLine();for(let o of i)e.writeNode(o),e.newLine();e.dedent(),e.write("}")}writeConstructor({writer:e,constructor:r}){r.name!=null?e.write(`func ${r.name}(`):e.write(`func New${this.name}(`),r.parameters.forEach((i,o)=>{o>0&&e.write(", "),e.writeNode(i)}),e.write(`) *${this.name} {`),e.newLine(),e.indent(),e.writeNode(r.body),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeMethods({writer:e}){if(this.methods.length!==0){e.writeNewLineIfLastLineNot();for(let r of this.methods)e.newLine(),e.writeNode(r),e.newLine()}}isExported(e){let r=e.name.charAt(0);return r===r.toUpperCase()}};u();p();var ge=class extends w{constructor({on:e,cases:r,default:i}){super();c(this,"on");c(this,"cases");c(this,"default");this.on=e,this.cases=r,this.default=i}write(e){let r=this.cases;this.default!=null&&r.push({on:new $("default"),body:this.default}),e.write("switch "),e.writeNode(this.on),e.writeLine("{"),e.indent();for(let i of r)e.write("case "),e.writeNode(i.on),e.writeLine(":"),e.indent(),e.writeNode(i.body),e.dedent(),e.writeNewLineIfLastLineNot();e.dedent(),e.write("}")}};u();p();var Vr=new Set(["any","bytes","map","slice"]),we=class n extends w{constructor(e){super();c(this,"internalType");this.internalType=e}write(e,{comment:r}={}){switch(this.internalType.type){case"any":e.write("any");break;case"bool":e.write("bool");break;case"bytes":e.write("[]byte");break;case"date":case"dateTime":e.writeNode(Pe);break;case"error":e.write("error");break;case"float64":e.write("float64");break;case"int":e.write("int");break;case"int64":e.write("int64");break;case"map":{e.write("map["),this.internalType.keyType.write(e),e.write("]"),this.internalType.valueType.write(e);break}case"optional":{e.write("*"),this.internalType.value.write(e);break}case"reference":e.writeNode(this.internalType.value);break;case"slice":e.write("[]"),this.internalType.value.write(e);break;case"string":e.write("string");break;case"uuid":e.writeNode(Ce);break;case"variadic":e.write("..."),this.internalType.value.write(e);break;default:b(this.internalType)}}isOptional(){return this.internalType.type==="optional"}isIterable(){return this.internalType.type==="slice"||this.internalType.type==="variadic"}iterableElement(){if(this.internalType.type==="slice"||this.internalType.type==="variadic")return this.internalType.value}underlying(){return this.internalType.type==="optional"?this.internalType.value:this}static any(){return new this({type:"any"})}static bool(){return new this({type:"bool"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static dereference(e){return e.internalType.type==="optional"?e.internalType.value:e}static error(){return new this({type:"error"})}static float64(){return new this({type:"float64"})}static int(){return new this({type:"int"})}static int64(){return new this({type:"int64"})}static map(e,r){return new this({type:"map",keyType:e,valueType:r})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static pointer(e){return n.optional(e)}static reference(e){return new this({type:"reference",value:e})}static slice(e){return new this({type:"slice",value:e})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static variadic(e){return this.isAlreadyVariadic(e)?e:new this({type:"variadic",value:e})}static isAlreadyOptional(e){return e.internalType.type==="optional"||Vr.has(e.internalType.type)}static isAlreadyVariadic(e){return e.internalType.type==="variadic"}},Pe=new k({importPath:"time",name:"Time"}),Ce=new k({importPath:"github.com/google/uuid",name:"UUID"}),De=new k({importPath:"io",name:"Reader"});u();p();var se=class extends w{constructor({name:e,type:r,docs:i}){super();c(this,"name");c(this,"type");c(this,"docs");this.name=e,this.type=r,this.docs=i}write(e){e.writeNode(new N({docs:this.docs})),e.write("type "),e.write(this.name),e.write(" "),e.writeNode(this.type)}};function Gr(n){return new Q(n)}function Hr(n){return new L(n)}function Kr(n){return new Z(n)}function jr(n){return new X(n)}function Jr(n={}){return new ee(n)}function zr(n){return new te(n)}function Qr(n){return new $(n)}function Zr(n){return new F(n)}function Xr(n){return new D(n)}function en(n){return new O(n)}function tn(n){return new re(n)}function rn(n){return new ne(n)}function nn(n){return new ie(n)}function on(n={}){return new oe(n)}function sn(n){return new ge(n)}function an(n){return new se(n)}function cn(n){return new k(n)}var Tt="example",Oe="fern",un="do",xe="client",pe=f.TypeInstantiation,pn="WireMockBaseURL",hn="WireMockClient",Ye=class{constructor({context:t,formatter:e}){c(this,"context");c(this,"formatter");this.context=t,this.formatter=e}async generateSnippet({endpoint:t,request:e,options:r}){var s,h,l;return((h=(s=r==null?void 0:r.config)==null?void 0:s.outputWiremockTests)!=null?h:!1)?this.generateWiremockTest({endpoint:t,snippet:e}):await this.buildCodeBlock({endpoint:t,snippet:e}).toStringAsync({packageName:Tt,importPath:Oe,rootImportPath:this.context.rootImportPath,customConfig:(l=this.context.customConfig)!=null?l:{},formatter:this.formatter})}generateSnippetSync({endpoint:t,request:e,options:r}){var s,h,l;return((h=(s=r==null?void 0:r.config)==null?void 0:s.outputWiremockTests)!=null?h:!1)?this.generateWiremockTest({endpoint:t,snippet:e}):this.buildCodeBlock({endpoint:t,snippet:e}).toString({packageName:Tt,importPath:Oe,rootImportPath:this.context.rootImportPath,customConfig:(l=this.context.customConfig)!=null?l:{},formatter:this.formatter})}async generateSnippetAst({endpoint:t,request:e,options:r}){throw new Error("Unsupported")}generateWiremockTest({endpoint:t,snippet:e}){var i;return this.buildWiremockTestCodeBlock({endpoint:t,snippet:e}).toString({packageName:"wiremock",importPath:Oe,rootImportPath:this.context.rootImportPath,customConfig:(i=this.context.customConfig)!=null?i:{},formatter:this.formatter})}buildCodeBlock({endpoint:t,snippet:e}){return f.codeblock(r=>{r.writeNode(f.func({name:un,parameters:[],return_:[],body:f.codeblock(i=>{i.writeNode(this.constructClient({endpoint:t,snippet:e})),i.writeLine(),i.writeNode(this.callMethod({endpoint:t,snippet:e}))})})),r.writeNewLineIfLastLineNot()})}buildWiremockTestCodeBlock({endpoint:t,snippet:e}){return f.codeblock(r=>{r.writeNode(f.func({name:"Test"+this.context.getTestMethodName(t)+"WithWireMock",parameters:[f.parameter({name:"t",type:f.Type.pointer(f.Type.reference(this.context.getTestingTypeReference()))})],return_:[],body:f.codeblock(i=>{for(let o of this.buildWiremockTestSetup({endpoint:t}))i.writeNode(o),i.writeLine();i.writeLine(),i.writeNode(this.constructWiremockTestClient({endpoint:t,snippet:e})),i.writeLine(),i.writeNode(this.callClientMethodAndAssert({endpoint:t,snippet:e}))})})),r.writeNewLineIfLastLineNot()})}constructClient({endpoint:t,snippet:e}){return f.codeblock(r=>{r.write(`${xe} := `),r.writeNode(this.getRootClientFuncInvocation(this.getConstructorArgs({endpoint:t,snippet:e})))})}constructWiremockTestClient({endpoint:t,snippet:e}){return f.codeblock(r=>{r.write(`${xe} := `),r.writeNode(this.getRootClientFuncInvocation(this.getWiremockTestConstructorArgs()))})}writeMethodInvocation({writer:t,endpoint:e,snippet:r}){let{otherArgs:i,requestArg:o}=this.getMethodArgs({endpoint:e,snippet:r});if(o!=null)if(o instanceof f.TypeInstantiation&&f.TypeInstantiation.isNop(o))t.writeNode(f.invokeMethod({on:f.codeblock(xe),method:this.getMethod({endpoint:e}),arguments_:[this.context.getContextTodoFunctionInvocation(),...i,f.codeblock("nil")]}));else{t.write("request := "),t.writeNode(o),t.writeLine();let s=f.codeblock("request");t.writeNode(f.invokeMethod({on:f.codeblock(xe),method:this.getMethod({endpoint:e}),arguments_:[this.context.getContextTodoFunctionInvocation(),...i,s]}))}else t.writeNode(f.invokeMethod({on:f.codeblock(xe),method:this.getMethod({endpoint:e}),arguments_:[this.context.getContextTodoFunctionInvocation(),...i]}))}callMethod({endpoint:t,snippet:e}){return f.codeblock(r=>{this.writeMethodInvocation({writer:r,endpoint:t,snippet:e})})}getConstructorArgs({endpoint:t,snippet:e}){let r=[],i=this.getConstructorBaseUrlArg({baseUrl:e.baseURL,environment:e.environment});return i!=null&&r.push(i),t.auth!=null&&(e.auth!=null?r.push(this.getConstructorAuthArg({auth:t.auth,values:e.auth})):this.context.errors.add({severity:q.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(B.Headers),this.context.ir.headers!=null&&e.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),r}getWiremockTestConstructorArgs(){return[f.codeblock(t=>{t.writeNode(f.invokeFunc({func:f.typeReference({name:"WithBaseURL",importPath:this.context.getOptionImportPath()}),arguments_:[f.codeblock(pn)]}))})]}getConstructorAuthArg({auth:t,values:e}){if(e.type!==t.type)return this.addError(this.context.newAuthMismatchError({auth:t,values:e}).message),pe.nop();switch(t.type){case"basic":return e.type==="basic"?this.getConstructorBasicAuthArg({auth:t,values:e}):pe.nop();case"bearer":return e.type==="bearer"?this.getConstructorBearerAuthArg({auth:t,values:e}):pe.nop();case"header":return e.type==="header"?this.getConstructorHeaderAuthArg({auth:t,values:e}):pe.nop();case"oauth":return this.addWarning("The Go SDK doesn't support OAuth client credentials yet"),pe.nop();case"inferred":return this.addWarning("The Go SDK Generator does not support Inferred auth scheme yet"),pe.nop();default:b(t)}}addError(t){this.context.errors.add({severity:q.Critical,message:t})}addWarning(t){this.context.errors.add({severity:q.Warning,message:t})}getConstructorBasicAuthArg({auth:t,values:e}){return f.codeblock(r=>{r.writeNode(f.invokeFunc({func:f.typeReference({name:"WithBasicAuth",importPath:this.context.getOptionImportPath()}),arguments_:[f.TypeInstantiation.string(e.username),f.TypeInstantiation.string(e.password)]}))})}getConstructorBaseUrlArg({baseUrl:t,environment:e}){let r=this.getBaseUrlArg({baseUrl:t,environment:e});if(r!=null)return f.codeblock(i=>{i.writeNode(f.invokeFunc({func:f.typeReference({name:"WithBaseURL",importPath:this.context.getOptionImportPath()}),arguments_:[r]}))})}getBaseUrlArg({baseUrl:t,environment:e}){if(t!=null&&e!=null){this.context.errors.add({severity:q.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return f.TypeInstantiation.string(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let r=this.context.getEnvironmentTypeReferenceFromID(e);if(r==null){this.context.errors.add({severity:q.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return f.TypeInstantiation.reference(r)}this.context.isMultiEnvironmentValues(e)&&this.context.errors.add({severity:q.Warning,message:"The Go SDK doesn't support a multi-environment client option yet; use the baseUrl option instead"})}}getConstructorBearerAuthArg({auth:t,values:e}){return f.codeblock(r=>{r.writeNode(f.invokeFunc({func:f.typeReference({name:`With${t.token.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[f.TypeInstantiation.string(e.token)]}))})}getConstructorHeaderAuthArg({auth:t,values:e}){return f.codeblock(r=>{r.writeNode(f.invokeFunc({func:f.typeReference({name:`With${t.header.name.name.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[this.context.dynamicTypeInstantiationMapper.convert({typeReference:t.header.typeReference,value:e.value})]}))})}getConstructorHeaderArgs({headers:t,values:e}){let r=[];for(let i of t){let o=this.getConstructorHeaderArg({header:i,value:e.value});o!=null&&r.push(o)}return r}getConstructorHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeInstantiationMapper.convert({typeReference:t.typeReference,value:e});if(!f.TypeInstantiation.isNop(r))return f.codeblock(i=>{i.writeNode(f.invokeFunc({func:f.typeReference({name:`With${t.name.name.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[r]}))})}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:b(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var s,h;let r=[];this.context.errors.scope(B.PathParameters);let i=[...(s=this.context.ir.pathParameters)!=null?s:[],...(h=t.pathParameters)!=null?h:[]];i.length>0&&r.push(...this.getPathParameters({namedParameters:i,snippet:e}).map(l=>l.value)),this.context.errors.unscope(),this.context.errors.scope(B.RequestBody);let o=t.body!=null?this.getBodyRequestArg({body:t.body,value:e.requestBody}):void 0;return this.context.errors.unscope(),{otherArgs:r,requestArg:o}}getBodyRequestArg({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeInstantiationMapper.convert({typeReference:t.value,value:e});default:b(t)}}getBytesBodyRequestArg({value:t}){return typeof t!="string"?(this.context.errors.add({severity:q.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),f.TypeInstantiation.nop()):f.TypeInstantiation.bytes(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){var d,y,x,T,A,G;let r=[],{inlinePathParameters:i,inlineFileProperties:o}={inlinePathParameters:(y=(d=this.context.customConfig)==null?void 0:d.inlinePathParameters)!=null?y:!0,inlineFileProperties:(T=(x=this.context.customConfig)==null?void 0:x.inlineFileProperties)!=null?T:!0};this.context.errors.scope(B.PathParameters);let s=[],h=[...(A=this.context.ir.pathParameters)!=null?A:[],...(G=t.pathParameters)!=null?G:[]];h.length>0&&s.push(...this.getPathParameters({namedParameters:h,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(B.RequestBody);let l=this.getFilePropertyInfo({request:t,snippet:e});this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||r.push(...s.map(he=>he.value)),o||r.push(...l.fileFields.map(he=>he.value));let m=this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:o})?this.getInlinedRequestArg({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?s:[],filePropertyInfo:l}):void 0;return{otherArgs:r,requestArg:m}}getFilePropertyInfo({request:t,snippet:e}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:e.requestBody})}getInlinedRequestArg({request:t,snippet:e,pathParameterFields:r,filePropertyInfo:i}){var d,y,x,T;this.context.errors.scope(B.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:(d=t.queryParameters)!=null?d:[],values:(y=e.queryParameters)!=null?y:{}}).map(A=>({name:A.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(A)}));this.context.errors.unscope(),this.context.errors.scope(B.Headers);let l=this.context.associateByWireValue({parameters:(x=t.headers)!=null?x:[],values:(T=e.headers)!=null?T:{}}).map(A=>({name:A.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(A)}));this.context.errors.unscope(),this.context.errors.scope(B.RequestBody);let m=t.body!=null?this.getInlinedRequestBodyStructFields({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),f.TypeInstantiation.structPointer({typeReference:f.typeReference({name:this.context.getMethodName(t.declaration.name),importPath:this.context.getImportPathForRequest(t.declaration.fernFilepath)}),fields:[...r,...s,...l,...m]})}getInlinedRequestBodyStructFields({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyStructFields({parameters:t.value,value:e});case"referenced":return[this.getReferencedRequestBodyPropertyStructField({body:t,value:e})];case"fileUpload":return this.getFileUploadRequestBodyStructFields({filePropertyInfo:r});default:b(t)}}getFileUploadRequestBodyStructFields({filePropertyInfo:t}){var e;return(e=this.context.customConfig)!=null&&e.inlineFileProperties?[...t.fileFields,...t.bodyPropertyFields]:t.bodyPropertyFields}getReferencedRequestBodyPropertyStructField({body:t,value:e}){return{name:this.context.getTypeName(t.bodyKey),value:this.getReferencedRequestBodyPropertyTypeInstantiation({body:t.bodyType,value:e})}}getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:e}){switch(t.type){case"bytes":return this.getBytesBodyRequestArg({value:e});case"typeReference":return this.context.dynamicTypeInstantiationMapper.convert({typeReference:t.value,value:e});default:b(t)}}getInlinedRequestBodyPropertyStructFields({parameters:t,value:e}){var o;let r=[],i=this.context.associateByWireValue({parameters:t,values:(o=this.context.getRecord(e))!=null?o:{}});for(let s of i)r.push({name:this.context.getTypeName(s.name.name),value:this.context.dynamicTypeInstantiationMapper.convert(s)});return r}getPathParameters({namedParameters:t,snippet:e}){var o;let r=[],i=this.context.associateByWireValue({parameters:t,values:(o=e.pathParameters)!=null?o:{}});for(let s of i)r.push({name:this.context.getTypeName(s.name.name),value:this.context.dynamicTypeInstantiationMapper.convertToPointerIfPossible(s)});return r}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>this.context.getMethodName(e)).join(".")}.${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}getRootClientFuncInvocation(t){return f.invokeFunc({func:f.typeReference({name:this.context.getClientConstructorName(),importPath:this.context.getClientImportPath()}),arguments_:t})}buildWiremockTestSetup({endpoint:t,errorCase:e}){let r="stub";return[]}callClientMethodAndAssert({endpoint:t,snippet:e}){return f.codeblock(r=>{this.writeMethodInvocation({writer:r,endpoint:t,snippet:e}),r.writeLine(),r.writeLine(),r.write("ok, countErr := "),r.writeNode(f.invokeMethod({on:f.codeblock(hn),method:"Verify",arguments_:[f.invokeMethod({on:f.codeblock("stub"),method:"Request",arguments_:[],multiline:!1}),f.codeblock("1")],multiline:!1})),r.writeLine(),r.writeNode(f.invokeFunc({func:f.typeReference({name:"NoError",importPath:"github.com/stretchr/testify/require"}),arguments_:[f.codeblock("t"),f.codeblock("countErr"),f.TypeInstantiation.string("Failed to verify WireMock request was matched")],multiline:!1})),r.writeLine(),r.writeNode(f.invokeFunc({func:f.typeReference({name:"True",importPath:"github.com/stretchr/testify/require"}),arguments_:[f.codeblock("t"),f.codeblock("ok"),f.TypeInstantiation.string("WireMock request was not matched")],multiline:!1})),r.writeLine()})}};0&&(module.exports={EndpointSnippetGenerator});
27
- /*! Bundled license information:
28
-
29
- @esbuild-plugins/node-globals-polyfill/Buffer.js:
30
- (*!
31
- * The buffer module from node.js, for the browser.
32
- *
33
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
34
- * @license MIT
35
- *)
36
- */
37
- //# sourceMappingURL=EndpointSnippetGenerator.cjs.map