@fern-api/go-dynamic-snippets 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DiscriminatedUnionTypeInstance.cjs +11 -1
- package/cjs/DynamicSnippetsGenerator.cjs +19 -9
- package/cjs/DynamicSnippetsGenerator.d.cts +1 -1
- package/cjs/{DynamicSnippetsGeneratorContext-DuDerGxa.d.cts → DynamicSnippetsGeneratorContext-f4OAff1R.d.cts} +5 -1
- package/cjs/EndpointSnippetGenerator.cjs +19 -9
- package/cjs/EndpointSnippetGenerator.d.cts +3 -1
- package/cjs/Result.cjs +11 -1
- package/cjs/Result.d.cts +1 -1
- package/cjs/Scope.cjs +11 -1
- package/cjs/TypeInstance.cjs +11 -1
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +18 -8
- package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
- package/cjs/context/DynamicTypeInstantiationMapper.cjs +25 -15
- package/cjs/context/DynamicTypeInstantiationMapper.d.cts +1 -1
- package/cjs/context/DynamicTypeMapper.cjs +18 -8
- package/cjs/context/DynamicTypeMapper.d.cts +1 -1
- package/cjs/context/ErrorReporter.cjs +11 -1
- package/cjs/context/FilePropertyMapper.cjs +25 -15
- package/cjs/context/FilePropertyMapper.d.cts +1 -1
- package/cjs/index.cjs +30 -8
- package/cjs/index.d.cts +1 -1
- package/esm/DiscriminatedUnionTypeInstance.js +1 -0
- package/esm/DynamicSnippetsGenerator.d.ts +1 -1
- package/esm/DynamicSnippetsGenerator.js +1 -1
- package/esm/{DynamicSnippetsGeneratorContext-DKWsHJSo.d.ts → DynamicSnippetsGeneratorContext-Dyk9qWMy.d.ts} +5 -1
- package/esm/EndpointSnippetGenerator.d.ts +3 -1
- package/esm/EndpointSnippetGenerator.js +1 -1
- package/esm/Result.d.ts +1 -1
- package/esm/Result.js +1 -1
- package/esm/Scope.js +1 -1
- package/esm/TypeInstance.js +1 -0
- package/esm/chunk-2AZXIWKY.js +11 -0
- package/esm/chunk-575DWQWD.js +1 -0
- package/esm/chunk-5TA7XQOD.js +1 -0
- package/esm/chunk-DMDZDIA7.js +1 -0
- package/esm/chunk-E5FOYV6P.js +19 -0
- package/esm/chunk-HBFOF5YT.js +1 -0
- package/esm/chunk-IIKN6XQS.js +1 -0
- package/esm/chunk-LLE63BZO.js +1 -0
- package/esm/chunk-M3DYFCFN.js +1 -0
- package/esm/chunk-VLNKANS2.js +1 -0
- package/esm/chunk-ZI6CAI2V.js +1 -0
- package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
- package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
- package/esm/context/DynamicTypeInstantiationMapper.d.ts +1 -1
- package/esm/context/DynamicTypeInstantiationMapper.js +1 -1
- package/esm/context/DynamicTypeMapper.d.ts +1 -1
- package/esm/context/DynamicTypeMapper.js +1 -1
- package/esm/context/ErrorReporter.js +1 -1
- package/esm/context/FilePropertyMapper.d.ts +1 -1
- package/esm/context/FilePropertyMapper.js +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +13 -1
- package/package.json +3 -6
- package/esm/chunk-4PKXKUYU.js +0 -1
- package/esm/chunk-5XUC5IOB.js +0 -1
- package/esm/chunk-6JCPJA27.js +0 -1
- package/esm/chunk-BC35GX6S.js +0 -1
- package/esm/chunk-COBOWL3P.js +0 -1
- package/esm/chunk-IQODEXPX.js +0 -1
- package/esm/chunk-KJOW5AZT.js +0 -1
- package/esm/chunk-UVYC4FWB.js +0 -1
- package/esm/chunk-VAYOWHUI.js +0 -19
- package/esm/chunk-ZQRLKIRW.js +0 -1
- package/esm/chunk-ZYGZ4VN4.js +0 -1
package/cjs/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DynamicSnippetsGenerator } from './DynamicSnippetsGenerator.cjs';
|
|
2
2
|
import '@fern-api/browser-compatible-base-generator';
|
|
3
|
-
import './DynamicSnippetsGeneratorContext-
|
|
3
|
+
import './DynamicSnippetsGeneratorContext-f4OAff1R.cjs';
|
|
4
4
|
import '@fern-api/go-ast';
|
|
5
5
|
import '@fern-fern/ir-sdk/api';
|
|
6
6
|
import './TypeInstance.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as i,m as n}from"./chunk-2AZXIWKY.js";i();n();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, AbstractFormatter } from '@fern-api/browser-compatible-base-generator';
|
|
2
|
-
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-
|
|
2
|
+
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-Dyk9qWMy.js';
|
|
3
3
|
import { dynamic } from '@fern-fern/ir-sdk/api';
|
|
4
4
|
import '@fern-api/go-ast';
|
|
5
5
|
import './TypeInstance.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-HBFOF5YT.js";import"./chunk-575DWQWD.js";import"./chunk-5TA7XQOD.js";import"./chunk-IIKN6XQS.js";import"./chunk-M3DYFCFN.js";import"./chunk-DMDZDIA7.js";import"./chunk-VLNKANS2.js";import"./chunk-LLE63BZO.js";import"./chunk-E5FOYV6P.js";import"./chunk-ZI6CAI2V.js";import"./chunk-2AZXIWKY.js";export{a as DynamicSnippetsGenerator};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractDynamicSnippetsGeneratorContext, FernGeneratorExec } from '@fern-api/browser-compatible-base-generator';
|
|
2
2
|
import { go, BaseGoCustomConfigSchema } from '@fern-api/go-ast';
|
|
3
|
-
import { dynamic, TypeId, Name, FernFilepath } from '@fern-fern/ir-sdk/api';
|
|
3
|
+
import { dynamic, TypeId, Name, FernFilepath, EnvironmentId } from '@fern-fern/ir-sdk/api';
|
|
4
4
|
import { TypeInstance } from './TypeInstance.js';
|
|
5
5
|
import { DiscriminatedUnionTypeInstance } from './DiscriminatedUnionTypeInstance.js';
|
|
6
6
|
import { ErrorReporter } from './context/ErrorReporter.js';
|
|
@@ -135,7 +135,11 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
|
|
|
135
135
|
getGoTypeReferenceFromDeclaration({ declaration }: {
|
|
136
136
|
declaration: dynamic.Declaration;
|
|
137
137
|
}): go.TypeReference;
|
|
138
|
+
getEnvironmentTypeReferenceFromID(environmentID: string): go.TypeReference | undefined;
|
|
139
|
+
isSingleEnvironmentID(environment: dynamic.EnvironmentValues): environment is EnvironmentId;
|
|
140
|
+
isMultiEnvironmentValues(environment: dynamic.EnvironmentValues): environment is dynamic.MultipleEnvironmentUrlValues;
|
|
138
141
|
newParameterNotRecognizedError(parameterName: string): Error;
|
|
142
|
+
private getEnvironmentTypeReference;
|
|
139
143
|
private isListTypeReference;
|
|
140
144
|
private parsedEndpointMatches;
|
|
141
145
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractFormatter } from '@fern-api/browser-compatible-base-generator';
|
|
2
|
-
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-
|
|
2
|
+
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-Dyk9qWMy.js';
|
|
3
3
|
import { dynamic } from '@fern-fern/ir-sdk/api';
|
|
4
4
|
import '@fern-api/go-ast';
|
|
5
5
|
import './TypeInstance.js';
|
|
@@ -27,6 +27,8 @@ declare class EndpointSnippetGenerator {
|
|
|
27
27
|
private getConstructorArgs;
|
|
28
28
|
private getConstructorAuthArg;
|
|
29
29
|
private getConstructorBasicAuthArg;
|
|
30
|
+
private getConstructorBaseUrlArg;
|
|
31
|
+
private getBaseUrlArg;
|
|
30
32
|
private getConstructorBearerAuthArg;
|
|
31
33
|
private getConstructorHeaderAuthArg;
|
|
32
34
|
private getConstructorHeaderArgs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-575DWQWD.js";import"./chunk-IIKN6XQS.js";import"./chunk-E5FOYV6P.js";import"./chunk-ZI6CAI2V.js";import"./chunk-2AZXIWKY.js";export{a as EndpointSnippetGenerator};
|
package/esm/Result.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-
|
|
1
|
+
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-Dyk9qWMy.js';
|
|
2
2
|
import { ErrorReporter } from './context/ErrorReporter.js';
|
|
3
3
|
import { dynamic } from '@fern-fern/ir-sdk/api';
|
|
4
4
|
import '@fern-api/browser-compatible-base-generator';
|
package/esm/Result.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-5TA7XQOD.js";import"./chunk-2AZXIWKY.js";export{a as Result};
|
package/esm/Scope.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-IIKN6XQS.js";import"./chunk-2AZXIWKY.js";export{a as Scope};
|
package/esm/TypeInstance.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as e,m as n}from"./chunk-2AZXIWKY.js";e();n();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var Tr=Object.create;var S=Object.defineProperty,Rr=Object.defineProperties,_r=Object.getOwnPropertyDescriptor,Ir=Object.getOwnPropertyDescriptors,vr=Object.getOwnPropertyNames,P=Object.getOwnPropertySymbols,Ur=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var W=(n,r,i)=>r in n?S(n,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[r]=i,Yi=(n,r)=>{for(var i in r||(r={}))H.call(r,i)&&W(n,i,r[i]);if(P)for(var i of P(r))q.call(r,i)&&W(n,i,r[i]);return n},Si=(n,r)=>Rr(n,Ir(r));var Pi=n=>typeof n=="symbol"?n:n+"",Mi=(n,r)=>{var i={};for(var e in n)H.call(n,e)&&r.indexOf(e)<0&&(i[e]=n[e]);if(n!=null&&P)for(var e of P(n))r.indexOf(e)<0&&q.call(n,e)&&(i[e]=n[e]);return i};var V=(n,r)=>()=>(n&&(r=n(n=0)),r);var Di=(n,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports),Ci=(n,r)=>{for(var i in r)S(n,i,{get:r[i],enumerable:!0})},Z=(n,r,i,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of vr(r))!H.call(n,t)&&t!==i&&S(n,t,{get:()=>r[t],enumerable:!(e=_r(r,t))||e.enumerable});return n};var ki=(n,r,i)=>(i=n!=null?Tr(Ur(n)):{},Z(r||!n||!n.__esModule?S(i,"default",{value:n,enumerable:!0}):i,n)),Ni=n=>Z(S({},"__esModule",{value:!0}),n);var Li=(n,r,i)=>W(n,typeof r!="symbol"?r+"":r,i);function $(){throw new Error("setTimeout has not been defined")}function b(){throw new Error("clearTimeout has not been defined")}function j(n){if(R===setTimeout)return setTimeout(n,0);if((R===$||!R)&&setTimeout)return R=setTimeout,setTimeout(n,0);try{return R(n,0)}catch(r){try{return R.call(null,n,0)}catch(i){return R.call(this,n,0)}}}function Br(n){if(_===clearTimeout)return clearTimeout(n);if((_===b||!_)&&clearTimeout)return _=clearTimeout,clearTimeout(n);try{return _(n)}catch(r){try{return _.call(null,n)}catch(i){return _.call(this,n)}}}function dr(){!Y||!I||(Y=!1,I.length?y=I.concat(y):M=-1,y.length&&rr())}function rr(){if(!Y){var n=j(dr);Y=!0;for(var r=y.length;r;){for(I=y,y=[];++M<r;)I&&I[M].run();M=-1,r=y.length}I=null,Y=!1,Br(n)}}function Yr(n){var r=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)r[i-1]=arguments[i];y.push(new ir(n,r)),y.length===1&&!Y&&j(rr)}function ir(n,r){this.fun=n,this.array=r}function v(){}function Qr(n){throw new Error("process.binding is not supported")}function Xr(){return"/"}function qr(n){throw new Error("process.chdir is not supported")}function Zr(){return 0}function $r(n){var r=Kr.call(d)*.001,i=Math.floor(r),e=Math.floor(r%1*1e9);return n&&(i=i-n[0],e=e-n[1],e<0&&(i--,e+=1e9)),[i,e]}function jr(){var n=new Date,r=n-br;return r/1e3}var R,_,y,Y,I,M,Sr,Pr,Mr,Dr,Cr,kr,Nr,Lr,Fr,Wr,Hr,Vr,zr,Gr,Jr,Or,d,Kr,br,nr,K,z=V(()=>{"use strict";R=$,_=b;typeof globalThis.setTimeout=="function"&&(R=setTimeout);typeof globalThis.clearTimeout=="function"&&(_=clearTimeout);y=[],Y=!1,M=-1;ir.prototype.run=function(){this.fun.apply(null,this.array)};Sr="browser",Pr="browser",Mr=!0,Dr={},Cr=[],kr="",Nr={},Lr={},Fr={};Wr=v,Hr=v,Vr=v,zr=v,Gr=v,Jr=v,Or=v;d=globalThis.performance||{},Kr=d.now||d.mozNow||d.msNow||d.oNow||d.webkitNow||function(){return new Date().getTime()};br=new Date;nr={nextTick:Yr,title:Sr,browser:Mr,env:Dr,argv:Cr,version:kr,versions:Nr,on:Wr,addListener:Hr,once:Vr,off:zr,removeListener:Gr,removeAllListeners:Jr,emit:Or,binding:Qr,cwd:Xr,chdir:qr,umask:Zr,hrtime:$r,platform:Pr,release:Lr,config:Fr,uptime:jr},K={};Object.keys(K).forEach(n=>{let r=n.split("."),i=nr;for(let e=0;e<r.length;e++){let t=r[e];e===r.length-1?i[t]=K[n]:i=i[t]||(i[t]={})}})});function ur(){O=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,i=n.length;r<i;++r)A[r]=n[r],E[n.charCodeAt(r)]=r;E[45]=62,E[95]=63}function ii(n){O||ur();var r,i,e,t,f,u,h=n.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");f=n[h-2]==="="?2:n[h-1]==="="?1:0,u=new ri(h*3/4-f),e=f>0?h-4:h;var a=0;for(r=0,i=0;r<e;r+=4,i+=3)t=E[n.charCodeAt(r)]<<18|E[n.charCodeAt(r+1)]<<12|E[n.charCodeAt(r+2)]<<6|E[n.charCodeAt(r+3)],u[a++]=t>>16&255,u[a++]=t>>8&255,u[a++]=t&255;return f===2?(t=E[n.charCodeAt(r)]<<2|E[n.charCodeAt(r+1)]>>4,u[a++]=t&255):f===1&&(t=E[n.charCodeAt(r)]<<10|E[n.charCodeAt(r+1)]<<4|E[n.charCodeAt(r+2)]>>2,u[a++]=t>>8&255,u[a++]=t&255),u}function ni(n){return A[n>>18&63]+A[n>>12&63]+A[n>>6&63]+A[n&63]}function ei(n,r,i){for(var e,t=[],f=r;f<i;f+=3)e=(n[f]<<16)+(n[f+1]<<8)+n[f+2],t.push(ni(e));return t.join("")}function er(n){O||ur();for(var r,i=n.length,e=i%3,t="",f=[],u=16383,h=0,a=i-e;h<a;h+=u)f.push(ei(n,h,h+u>a?a:h+u));return e===1?(r=n[i-1],t+=A[r>>2],t+=A[r<<4&63],t+="=="):e===2&&(r=(n[i-2]<<8)+n[i-1],t+=A[r>>10],t+=A[r>>4&63],t+=A[r<<2&63],t+="="),f.push(t),f.join("")}function D(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function T(n,r){if(D()<r)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(r),n.__proto__=o.prototype):(n===null&&(n=new o(r)),n.length=r),n}function o(n,r,i){if(!o.TYPED_ARRAY_SUPPORT&&!(this instanceof o))return new o(n,r,i);if(typeof n=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return Q(this,n)}return or(this,n,r,i)}function or(n,r,i,e){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&r instanceof ArrayBuffer?ui(n,r,i,e):typeof r=="string"?fi(n,r,i):oi(n,r)}function hr(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 ti(n,r,i,e){return hr(r),r<=0?T(n,r):i!==void 0?typeof e=="string"?T(n,r).fill(i,e):T(n,r).fill(i):T(n,r)}function Q(n,r){if(hr(r),n=T(n,r<0?0:X(r)|0),!o.TYPED_ARRAY_SUPPORT)for(var i=0;i<r;++i)n[i]=0;return n}function fi(n,r,i){if((typeof i!="string"||i==="")&&(i="utf8"),!o.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var e=ar(r,i)|0;n=T(n,e);var t=n.write(r,i);return t!==e&&(n=n.slice(0,t)),n}function G(n,r){var i=r.length<0?0:X(r.length)|0;n=T(n,i);for(var e=0;e<i;e+=1)n[e]=r[e]&255;return n}function ui(n,r,i,e){if(r.byteLength,i<0||r.byteLength<i)throw new RangeError("'offset' is out of bounds");if(r.byteLength<i+(e||0))throw new RangeError("'length' is out of bounds");return i===void 0&&e===void 0?r=new Uint8Array(r):e===void 0?r=new Uint8Array(r,i):r=new Uint8Array(r,i,e),o.TYPED_ARRAY_SUPPORT?(n=r,n.__proto__=o.prototype):n=G(n,r),n}function oi(n,r){if(g(r)){var i=X(r.length)|0;return n=T(n,i),n.length===0||r.copy(n,0,0,i),n}if(r){if(typeof ArrayBuffer!="undefined"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Ui(r.length)?T(n,0):G(n,r);if(r.type==="Buffer"&&Array.isArray(r.data))return G(n,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function X(n){if(n>=D())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+D().toString(16)+" bytes");return n|0}function g(n){return!!(n!=null&&n._isBuffer)}function ar(n,r){if(g(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 i=n.length;if(i===0)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return C(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return Er(n).length;default:if(e)return C(n).length;r=(""+r).toLowerCase(),e=!0}}function hi(n,r,i){var e=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((i===void 0||i>this.length)&&(i=this.length),i<=0)||(i>>>=0,r>>>=0,i<=r))return"";for(n||(n="utf8");;)switch(n){case"hex":return Ai(this,r,i);case"utf8":case"utf-8":return pr(this,r,i);case"ascii":return Ei(this,r,i);case"latin1":case"binary":return mi(this,r,i);case"base64":return wi(this,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gi(this,r,i);default:if(e)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),e=!0}}function U(n,r,i){var e=n[r];n[r]=n[i],n[i]=e}function cr(n,r,i,e,t){if(n.length===0)return-1;if(typeof i=="string"?(e=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=t?0:n.length-1),i<0&&(i=n.length+i),i>=n.length){if(t)return-1;i=n.length-1}else if(i<0)if(t)i=0;else return-1;if(typeof r=="string"&&(r=o.from(r,e)),g(r))return r.length===0?-1:tr(n,r,i,e,t);if(typeof r=="number")return r=r&255,o.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?t?Uint8Array.prototype.indexOf.call(n,r,i):Uint8Array.prototype.lastIndexOf.call(n,r,i):tr(n,[r],i,e,t);throw new TypeError("val must be string, number or Buffer")}function tr(n,r,i,e,t){var f=1,u=n.length,h=r.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(n.length<2||r.length<2)return-1;f=2,u/=2,h/=2,i/=2}function a(x,B){return f===1?x[B]:x.readUInt16BE(B*f)}var l;if(t){var p=-1;for(l=i;l<u;l++)if(a(n,l)===a(r,p===-1?0:l-p)){if(p===-1&&(p=l),l-p+1===h)return p*f}else p!==-1&&(l-=l-p),p=-1}else for(i+h>u&&(i=u-h),l=i;l>=0;l--){for(var c=!0,m=0;m<h;m++)if(a(n,l+m)!==a(r,m)){c=!1;break}if(c)return l}return-1}function ai(n,r,i,e){i=Number(i)||0;var t=n.length-i;e?(e=Number(e),e>t&&(e=t)):e=t;var f=r.length;if(f%2!==0)throw new TypeError("Invalid hex string");e>f/2&&(e=f/2);for(var u=0;u<e;++u){var h=parseInt(r.substr(u*2,2),16);if(isNaN(h))return u;n[i+u]=h}return u}function ci(n,r,i,e){return L(C(r,n.length-i),n,i,e)}function lr(n,r,i,e){return L(Ii(r),n,i,e)}function li(n,r,i,e){return lr(n,r,i,e)}function pi(n,r,i,e){return L(Er(r),n,i,e)}function si(n,r,i,e){return L(vi(r,n.length-i),n,i,e)}function wi(n,r,i){return r===0&&i===n.length?er(n):er(n.slice(r,i))}function pr(n,r,i){i=Math.min(n.length,i);for(var e=[],t=r;t<i;){var f=n[t],u=null,h=f>239?4:f>223?3:f>191?2:1;if(t+h<=i){var a,l,p,c;switch(h){case 1:f<128&&(u=f);break;case 2:a=n[t+1],(a&192)===128&&(c=(f&31)<<6|a&63,c>127&&(u=c));break;case 3:a=n[t+1],l=n[t+2],(a&192)===128&&(l&192)===128&&(c=(f&15)<<12|(a&63)<<6|l&63,c>2047&&(c<55296||c>57343)&&(u=c));break;case 4:a=n[t+1],l=n[t+2],p=n[t+3],(a&192)===128&&(l&192)===128&&(p&192)===128&&(c=(f&15)<<18|(a&63)<<12|(l&63)<<6|p&63,c>65535&&c<1114112&&(u=c))}}u===null?(u=65533,h=1):u>65535&&(u-=65536,e.push(u>>>10&1023|55296),u=56320|u&1023),e.push(u),t+=h}return xi(e)}function xi(n){var r=n.length;if(r<=fr)return String.fromCharCode.apply(String,n);for(var i="",e=0;e<r;)i+=String.fromCharCode.apply(String,n.slice(e,e+=fr));return i}function Ei(n,r,i){var e="";i=Math.min(n.length,i);for(var t=r;t<i;++t)e+=String.fromCharCode(n[t]&127);return e}function mi(n,r,i){var e="";i=Math.min(n.length,i);for(var t=r;t<i;++t)e+=String.fromCharCode(n[t]);return e}function Ai(n,r,i){var e=n.length;(!r||r<0)&&(r=0),(!i||i<0||i>e)&&(i=e);for(var t="",f=r;f<i;++f)t+=_i(n[f]);return t}function gi(n,r,i){for(var e=n.slice(r,i),t="",f=0;f<e.length;f+=2)t+=String.fromCharCode(e[f]+e[f+1]*256);return t}function s(n,r,i){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+r>i)throw new RangeError("Trying to access beyond buffer length")}function w(n,r,i,e,t,f){if(!g(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<f)throw new RangeError('"value" argument is out of bounds');if(i+e>n.length)throw new RangeError("Index out of range")}function k(n,r,i,e){r<0&&(r=65535+r+1);for(var t=0,f=Math.min(n.length-i,2);t<f;++t)n[i+t]=(r&255<<8*(e?t:1-t))>>>(e?t:1-t)*8}function N(n,r,i,e){r<0&&(r=4294967295+r+1);for(var t=0,f=Math.min(n.length-i,4);t<f;++t)n[i+t]=r>>>(e?t:3-t)*8&255}function sr(n,r,i,e,t,f){if(i+e>n.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function wr(n,r,i,e,t){return t||sr(n,r,i,4,34028234663852886e22,-34028234663852886e22),Ar(n,r,i,e,23,4),i+4}function xr(n,r,i,e,t){return t||sr(n,r,i,8,17976931348623157e292,-17976931348623157e292),Ar(n,r,i,e,52,8),i+8}function Ti(n){if(n=Ri(n).replace(yi,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Ri(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function _i(n){return n<16?"0"+n.toString(16):n.toString(16)}function C(n,r){r=r||1/0;for(var i,e=n.length,t=null,f=[],u=0;u<e;++u){if(i=n.charCodeAt(u),i>55295&&i<57344){if(!t){if(i>56319){(r-=3)>-1&&f.push(239,191,189);continue}else if(u+1===e){(r-=3)>-1&&f.push(239,191,189);continue}t=i;continue}if(i<56320){(r-=3)>-1&&f.push(239,191,189),t=i;continue}i=(t-55296<<10|i-56320)+65536}else t&&(r-=3)>-1&&f.push(239,191,189);if(t=null,i<128){if((r-=1)<0)break;f.push(i)}else if(i<2048){if((r-=2)<0)break;f.push(i>>6|192,i&63|128)}else if(i<65536){if((r-=3)<0)break;f.push(i>>12|224,i>>6&63|128,i&63|128)}else if(i<1114112){if((r-=4)<0)break;f.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else throw new Error("Invalid code point")}return f}function Ii(n){for(var r=[],i=0;i<n.length;++i)r.push(n.charCodeAt(i)&255);return r}function vi(n,r){for(var i,e,t,f=[],u=0;u<n.length&&!((r-=2)<0);++u)i=n.charCodeAt(u),e=i>>8,t=i%256,f.push(t),f.push(e);return f}function Er(n){return ii(Ti(n))}function L(n,r,i,e){for(var t=0;t<e&&!(t+i>=r.length||t>=n.length);++t)r[t+i]=n[t];return t}function Ui(n){return n!==n}function Bi(n){return n!=null&&(!!n._isBuffer||mr(n)||di(n))}function mr(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function di(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&mr(n.slice(0,0))}function F(n,r,i,e,t){var f,u,h=t*8-e-1,a=(1<<h)-1,l=a>>1,p=-7,c=i?t-1:0,m=i?-1:1,x=n[r+c];for(c+=m,f=x&(1<<-p)-1,x>>=-p,p+=h;p>0;f=f*256+n[r+c],c+=m,p-=8);for(u=f&(1<<-p)-1,f>>=-p,p+=e;p>0;u=u*256+n[r+c],c+=m,p-=8);if(f===0)f=1-l;else{if(f===a)return u?NaN:(x?-1:1)*(1/0);u=u+Math.pow(2,e),f=f-l}return(x?-1:1)*u*Math.pow(2,f-e)}function Ar(n,r,i,e,t,f){var u,h,a,l=f*8-t-1,p=(1<<l)-1,c=p>>1,m=t===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=e?0:f-1,B=e?1:-1,yr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(h=isNaN(r)?1:0,u=p):(u=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-u))<1&&(u--,a*=2),u+c>=1?r+=m/a:r+=m*Math.pow(2,1-c),r*a>=2&&(u++,a/=2),u+c>=p?(h=0,u=p):u+c>=1?(h=(r*a-1)*Math.pow(2,t),u=u+c):(h=r*Math.pow(2,c-1)*Math.pow(2,t),u=0));t>=8;n[i+x]=h&255,x+=B,h/=256,t-=8);for(u=u<<t|h,l+=t;l>0;n[i+x]=u&255,x+=B,u/=256,l-=8);n[i+x-B]|=yr*128}var A,E,ri,O,fr,yi,gr=V(()=>{"use strict";z();J();A=[],E=[],ri=typeof Uint8Array!="undefined"?Uint8Array:Array,O=!1;o.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;o.poolSize=8192;o._augment=function(n){return n.__proto__=o.prototype,n};o.from=function(n,r,i){return or(null,n,r,i)};o.kMaxLength=D();o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&o[Symbol.species]);o.alloc=function(n,r,i){return ti(null,n,r,i)};o.allocUnsafe=function(n){return Q(null,n)};o.allocUnsafeSlow=function(n){return Q(null,n)};o.isBuffer=Bi;o.compare=function(r,i){if(!g(r)||!g(i))throw new TypeError("Arguments must be Buffers");if(r===i)return 0;for(var e=r.length,t=i.length,f=0,u=Math.min(e,t);f<u;++f)if(r[f]!==i[f]){e=r[f],t=i[f];break}return e<t?-1:t<e?1:0};o.isEncoding=function(r){switch(String(r).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}};o.concat=function(r,i){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return o.alloc(0);var e;if(i===void 0)for(i=0,e=0;e<r.length;++e)i+=r[e].length;var t=o.allocUnsafe(i),f=0;for(e=0;e<r.length;++e){var u=r[e];if(!g(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(t,f),f+=u.length}return t};o.byteLength=ar;o.prototype._isBuffer=!0;o.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var i=0;i<r;i+=2)U(this,i,i+1);return this};o.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var i=0;i<r;i+=4)U(this,i,i+3),U(this,i+1,i+2);return this};o.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var i=0;i<r;i+=8)U(this,i,i+7),U(this,i+1,i+6),U(this,i+2,i+5),U(this,i+3,i+4);return this};o.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?pr(this,0,r):hi.apply(this,arguments)};o.prototype.equals=function(r){if(!g(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:o.compare(this,r)===0};o.prototype.compare=function(r,i,e,t,f){if(!g(r))throw new TypeError("Argument must be a Buffer");if(i===void 0&&(i=0),e===void 0&&(e=r?r.length:0),t===void 0&&(t=0),f===void 0&&(f=this.length),i<0||e>r.length||t<0||f>this.length)throw new RangeError("out of range index");if(t>=f&&i>=e)return 0;if(t>=f)return-1;if(i>=e)return 1;if(i>>>=0,e>>>=0,t>>>=0,f>>>=0,this===r)return 0;for(var u=f-t,h=e-i,a=Math.min(u,h),l=this.slice(t,f),p=r.slice(i,e),c=0;c<a;++c)if(l[c]!==p[c]){u=l[c],h=p[c];break}return u<h?-1:h<u?1:0};o.prototype.includes=function(r,i,e){return this.indexOf(r,i,e)!==-1};o.prototype.indexOf=function(r,i,e){return cr(this,r,i,e,!0)};o.prototype.lastIndexOf=function(r,i,e){return cr(this,r,i,e,!1)};o.prototype.write=function(r,i,e,t){if(i===void 0)t="utf8",e=this.length,i=0;else if(e===void 0&&typeof i=="string")t=i,e=this.length,i=0;else if(isFinite(i))i=i|0,isFinite(e)?(e=e|0,t===void 0&&(t="utf8")):(t=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var f=this.length-i;if((e===void 0||e>f)&&(e=f),r.length>0&&(e<0||i<0)||i>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var u=!1;;)switch(t){case"hex":return ai(this,r,i,e);case"utf8":case"utf-8":return ci(this,r,i,e);case"ascii":return lr(this,r,i,e);case"latin1":case"binary":return li(this,r,i,e);case"base64":return pi(this,r,i,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return si(this,r,i,e);default:if(u)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),u=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};fr=4096;o.prototype.slice=function(r,i){var e=this.length;r=~~r,i=i===void 0?e:~~i,r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),i<0?(i+=e,i<0&&(i=0)):i>e&&(i=e),i<r&&(i=r);var t;if(o.TYPED_ARRAY_SUPPORT)t=this.subarray(r,i),t.__proto__=o.prototype;else{var f=i-r;t=new o(f,void 0);for(var u=0;u<f;++u)t[u]=this[u+r]}return t};o.prototype.readUIntLE=function(r,i,e){r=r|0,i=i|0,e||s(r,i,this.length);for(var t=this[r],f=1,u=0;++u<i&&(f*=256);)t+=this[r+u]*f;return t};o.prototype.readUIntBE=function(r,i,e){r=r|0,i=i|0,e||s(r,i,this.length);for(var t=this[r+--i],f=1;i>0&&(f*=256);)t+=this[r+--i]*f;return t};o.prototype.readUInt8=function(r,i){return i||s(r,1,this.length),this[r]};o.prototype.readUInt16LE=function(r,i){return i||s(r,2,this.length),this[r]|this[r+1]<<8};o.prototype.readUInt16BE=function(r,i){return i||s(r,2,this.length),this[r]<<8|this[r+1]};o.prototype.readUInt32LE=function(r,i){return i||s(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};o.prototype.readUInt32BE=function(r,i){return i||s(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};o.prototype.readIntLE=function(r,i,e){r=r|0,i=i|0,e||s(r,i,this.length);for(var t=this[r],f=1,u=0;++u<i&&(f*=256);)t+=this[r+u]*f;return f*=128,t>=f&&(t-=Math.pow(2,8*i)),t};o.prototype.readIntBE=function(r,i,e){r=r|0,i=i|0,e||s(r,i,this.length);for(var t=i,f=1,u=this[r+--t];t>0&&(f*=256);)u+=this[r+--t]*f;return f*=128,u>=f&&(u-=Math.pow(2,8*i)),u};o.prototype.readInt8=function(r,i){return i||s(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};o.prototype.readInt16LE=function(r,i){i||s(r,2,this.length);var e=this[r]|this[r+1]<<8;return e&32768?e|4294901760:e};o.prototype.readInt16BE=function(r,i){i||s(r,2,this.length);var e=this[r+1]|this[r]<<8;return e&32768?e|4294901760:e};o.prototype.readInt32LE=function(r,i){return i||s(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};o.prototype.readInt32BE=function(r,i){return i||s(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};o.prototype.readFloatLE=function(r,i){return i||s(r,4,this.length),F(this,r,!0,23,4)};o.prototype.readFloatBE=function(r,i){return i||s(r,4,this.length),F(this,r,!1,23,4)};o.prototype.readDoubleLE=function(r,i){return i||s(r,8,this.length),F(this,r,!0,52,8)};o.prototype.readDoubleBE=function(r,i){return i||s(r,8,this.length),F(this,r,!1,52,8)};o.prototype.writeUIntLE=function(r,i,e,t){if(r=+r,i=i|0,e=e|0,!t){var f=Math.pow(2,8*e)-1;w(this,r,i,e,f,0)}var u=1,h=0;for(this[i]=r&255;++h<e&&(u*=256);)this[i+h]=r/u&255;return i+e};o.prototype.writeUIntBE=function(r,i,e,t){if(r=+r,i=i|0,e=e|0,!t){var f=Math.pow(2,8*e)-1;w(this,r,i,e,f,0)}var u=e-1,h=1;for(this[i+u]=r&255;--u>=0&&(h*=256);)this[i+u]=r/h&255;return i+e};o.prototype.writeUInt8=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,1,255,0),o.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[i]=r&255,i+1};o.prototype.writeUInt16LE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[i]=r&255,this[i+1]=r>>>8):k(this,r,i,!0),i+2};o.prototype.writeUInt16BE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[i]=r>>>8,this[i+1]=r&255):k(this,r,i,!1),i+2};o.prototype.writeUInt32LE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[i+3]=r>>>24,this[i+2]=r>>>16,this[i+1]=r>>>8,this[i]=r&255):N(this,r,i,!0),i+4};o.prototype.writeUInt32BE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[i]=r>>>24,this[i+1]=r>>>16,this[i+2]=r>>>8,this[i+3]=r&255):N(this,r,i,!1),i+4};o.prototype.writeIntLE=function(r,i,e,t){if(r=+r,i=i|0,!t){var f=Math.pow(2,8*e-1);w(this,r,i,e,f-1,-f)}var u=0,h=1,a=0;for(this[i]=r&255;++u<e&&(h*=256);)r<0&&a===0&&this[i+u-1]!==0&&(a=1),this[i+u]=(r/h>>0)-a&255;return i+e};o.prototype.writeIntBE=function(r,i,e,t){if(r=+r,i=i|0,!t){var f=Math.pow(2,8*e-1);w(this,r,i,e,f-1,-f)}var u=e-1,h=1,a=0;for(this[i+u]=r&255;--u>=0&&(h*=256);)r<0&&a===0&&this[i+u+1]!==0&&(a=1),this[i+u]=(r/h>>0)-a&255;return i+e};o.prototype.writeInt8=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,1,127,-128),o.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[i]=r&255,i+1};o.prototype.writeInt16LE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[i]=r&255,this[i+1]=r>>>8):k(this,r,i,!0),i+2};o.prototype.writeInt16BE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[i]=r>>>8,this[i+1]=r&255):k(this,r,i,!1),i+2};o.prototype.writeInt32LE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[i]=r&255,this[i+1]=r>>>8,this[i+2]=r>>>16,this[i+3]=r>>>24):N(this,r,i,!0),i+4};o.prototype.writeInt32BE=function(r,i,e){return r=+r,i=i|0,e||w(this,r,i,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),o.TYPED_ARRAY_SUPPORT?(this[i]=r>>>24,this[i+1]=r>>>16,this[i+2]=r>>>8,this[i+3]=r&255):N(this,r,i,!1),i+4};o.prototype.writeFloatLE=function(r,i,e){return wr(this,r,i,!0,e)};o.prototype.writeFloatBE=function(r,i,e){return wr(this,r,i,!1,e)};o.prototype.writeDoubleLE=function(r,i,e){return xr(this,r,i,!0,e)};o.prototype.writeDoubleBE=function(r,i,e){return xr(this,r,i,!1,e)};o.prototype.copy=function(r,i,e,t){if(e||(e=0),!t&&t!==0&&(t=this.length),i>=r.length&&(i=r.length),i||(i=0),t>0&&t<e&&(t=e),t===e||r.length===0||this.length===0)return 0;if(i<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),r.length-i<t-e&&(t=r.length-i+e);var f=t-e,u;if(this===r&&e<i&&i<t)for(u=f-1;u>=0;--u)r[u+i]=this[u+e];else if(f<1e3||!o.TYPED_ARRAY_SUPPORT)for(u=0;u<f;++u)r[u+i]=this[u+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+f),i);return f};o.prototype.fill=function(r,i,e,t){if(typeof r=="string"){if(typeof i=="string"?(t=i,i=0,e=this.length):typeof e=="string"&&(t=e,e=this.length),r.length===1){var f=r.charCodeAt(0);f<256&&(r=f)}if(t!==void 0&&typeof t!="string")throw new TypeError("encoding must be a string");if(typeof t=="string"&&!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t)}else typeof r=="number"&&(r=r&255);if(i<0||this.length<i||this.length<e)throw new RangeError("Out of range index");if(e<=i)return this;i=i>>>0,e=e===void 0?this.length:e>>>0,r||(r=0);var u;if(typeof r=="number")for(u=i;u<e;++u)this[u]=r;else{var h=g(r)?r:C(new o(r,t).toString()),a=h.length;for(u=0;u<e-i;++u)this[u+i]=h[u%a]}return this};yi=/[^+\/0-9A-Za-z-_]/g});var J=V(()=>{"use strict";gr()});export{Yi as a,Si as b,Pi as c,Mi as d,V as e,Di as f,Ci as g,ki as h,Ni as i,Li as j,z as k,o as l,J as m};
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|
|
5
|
+
(*!
|
|
6
|
+
* The buffer module from node.js, for the browser.
|
|
7
|
+
*
|
|
8
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
9
|
+
* @license MIT
|
|
10
|
+
*)
|
|
11
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as p}from"./chunk-IIKN6XQS.js";import{c as r}from"./chunk-E5FOYV6P.js";import{a}from"./chunk-ZI6CAI2V.js";import{j as d,k as g,m as f}from"./chunk-2AZXIWKY.js";g();f();var P="example",v="fern",I="do",S="client",A=class{constructor({context:e,formatter:t}){d(this,"context");d(this,"formatter");this.context=e,this.formatter=t}async generateSnippet({endpoint:e,request:t}){var i;return await this.buildCodeBlock({endpoint:e,snippet:t}).toString({packageName:P,importPath:v,rootImportPath:this.context.rootImportPath,customConfig:(i=this.context.customConfig)!=null?i:{},formatter:this.formatter})}generateSnippetSync({endpoint:e,request:t}){var i;return this.buildCodeBlock({endpoint:e,snippet:t}).toStringSync({packageName:P,importPath:v,rootImportPath:this.context.rootImportPath,customConfig:(i=this.context.customConfig)!=null?i:{},formatter:this.formatter})}buildCodeBlock({endpoint:e,snippet:t}){return r.func({name:I,parameters:[],return_:[],body:r.codeblock(n=>{n.writeNode(this.constructClient({endpoint:e,snippet:t})),n.writeLine(),n.writeNode(this.callMethod({endpoint:e,snippet:t}))})})}constructClient({endpoint:e,snippet:t}){return r.codeblock(n=>{n.write(`${S} := `),n.writeNode(this.getRootClientFuncInvocation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){return r.invokeMethod({on:r.codeblock(S),method:this.getMethod({endpoint:e}),arguments_:[this.context.getContextTodoFunctionInvocation(),...this.getMethodArgs({endpoint:e,snippet:t})]})}getConstructorArgs({endpoint:e,snippet:t}){let n=[],i=this.getConstructorBaseUrlArg({baseUrl:t.baseUrl,environment:t.environment});return i!=null&&n.push(i),e.auth!=null&&(t.auth!=null?n.push(this.getConstructorAuthArg({auth:e.auth,values:t.auth})):this.context.errors.add({severity:a.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(p.Headers),this.context.ir.headers!=null&&t.headers!=null&&n.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),n}getConstructorAuthArg({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.context.errors.add({severity:a.Critical,message:this.newAuthMismatchError({auth:e,values:t}).message}),r.TypeInstantiation.nop()):this.getConstructorBasicAuthArg({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.context.errors.add({severity:a.Critical,message:this.newAuthMismatchError({auth:e,values:t}).message}),r.TypeInstantiation.nop()):this.getConstructorBearerAuthArg({auth:e,values:t});case"header":return t.type!=="header"?(this.context.errors.add({severity:a.Critical,message:this.newAuthMismatchError({auth:e,values:t}).message}),r.TypeInstantiation.nop()):this.getConstructorHeaderAuthArg({auth:e,values:t})}}getConstructorBasicAuthArg({auth:e,values:t}){return r.codeblock(n=>{n.writeNode(r.invokeFunc({func:r.typeReference({name:"WithBasicAuth",importPath:this.context.getOptionImportPath()}),arguments_:[r.TypeInstantiation.string(t.username),r.TypeInstantiation.string(t.password)]}))})}getConstructorBaseUrlArg({baseUrl:e,environment:t}){let n=this.getBaseUrlArg({baseUrl:e,environment:t});if(n!=null)return r.codeblock(i=>{i.writeNode(r.invokeFunc({func:r.typeReference({name:"WithBaseURL",importPath:this.context.getOptionImportPath()}),arguments_:[n]}))})}getBaseUrlArg({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:a.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return r.TypeInstantiation.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let n=this.context.getEnvironmentTypeReferenceFromID(t);if(n==null){this.context.errors.add({severity:a.Warning,message:`Environment "${t}" was not found`});return}return r.TypeInstantiation.reference(n)}this.context.isMultiEnvironmentValues(t)&&this.context.errors.add({severity:a.Warning,message:"The Go SDK doesn't support a multi-environment client option yet; use the baseUrl option instead"})}}getConstructorBearerAuthArg({auth:e,values:t}){return r.codeblock(n=>{n.writeNode(r.invokeFunc({func:r.typeReference({name:`With${e.token.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[r.TypeInstantiation.string(t.token)]}))})}getConstructorHeaderAuthArg({auth:e,values:t}){return r.codeblock(n=>{n.writeNode(r.invokeFunc({func:r.typeReference({name:`With${e.header.name.name.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.header.typeReference,value:t.value})]}))})}getConstructorHeaderArgs({headers:e,values:t}){let n=[];for(let i of e){let o=this.getConstructorHeaderArg({header:i,value:t.value});o!=null&&n.push(o)}return n}getConstructorHeaderArg({header:e,value:t}){let n=this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.typeReference,value:t});if(!r.TypeInstantiation.isNop(n))return r.codeblock(i=>{i.writeNode(r.invokeFunc({func:r.typeReference({name:`With${e.name.name.pascalCase.unsafeName}`,importPath:this.context.getOptionImportPath()}),arguments_:[n]}))})}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})}}getMethodArgsForBodyRequest({request:e,snippet:t}){let n=[];if(this.context.errors.scope(p.PathParameters),e.pathParameters!=null){let i=this.getPathParameters({namedParameters:e.pathParameters,snippet:t});n.push(...i.map(o=>o.value))}return this.context.errors.unscope(),this.context.errors.scope(p.RequestBody),e.body!=null&&n.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),n}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.value,value:t})}}getBytesBodyRequestArg({value:e}){return typeof e!="string"?(this.context.errors.add({severity:a.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),r.TypeInstantiation.nop()):r.TypeInstantiation.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){var s;let n=[];this.context.errors.scope(p.PathParameters);let i=[];e.pathParameters!=null&&i.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(p.RequestBody);let o=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e})||n.push(...i.map(u=>u.value)),(s=this.context.customConfig)!=null&&s.inlineFileProperties||n.push(...o.fileFields.map(u=>u.value)),this.context.needsRequestParameter({request:e})&&n.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e})?i:[],filePropertyInfo:o})),n}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:n,filePropertyInfo:i}){var h,m,y,l;this.context.errors.scope(p.QueryParameters);let s=this.context.associateQueryParametersByWireValue({parameters:(h=e.queryParameters)!=null?h:[],values:(m=t.queryParameters)!=null?m:{}}).map(c=>({name:c.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(c)}));this.context.errors.unscope(),this.context.errors.scope(p.Headers);let x=this.context.associateByWireValue({parameters:(y=e.headers)!=null?y:[],values:(l=t.headers)!=null?l:{}}).map(c=>({name:c.name.name.pascalCase.unsafeName,value:this.context.dynamicTypeInstantiationMapper.convert(c)}));this.context.errors.unscope(),this.context.errors.scope(p.RequestBody);let R=e.body!=null?this.getInlinedRequestBodyStructFields({body:e.body,value:t.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),r.TypeInstantiation.structPointer({typeReference:r.typeReference({name:this.context.getMethodName(e.declaration.name),importPath:this.context.getImportPath(e.declaration.fernFilepath)}),fields:[...n,...s,...x,...R]})}getInlinedRequestBodyStructFields({body:e,value:t,filePropertyInfo:n}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyStructFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyStructField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyStructFields({filePropertyInfo:n})}}getFileUploadRequestBodyStructFields({filePropertyInfo:e}){var t;return(t=this.context.customConfig)!=null&&t.inlineFileProperties?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyStructField({body:e,value:t}){return{name:this.context.getTypeName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeInstantiation({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeInstantiation({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeInstantiationMapper.convert({typeReference:e.value,value:t})}}getInlinedRequestBodyPropertyStructFields({parameters:e,value:t}){var o;let n=[],i=this.context.associateByWireValue({parameters:e,values:(o=this.context.getRecord(t))!=null?o:{}});for(let s of i)n.push({name:this.context.getTypeName(s.name.name),value:this.context.dynamicTypeInstantiationMapper.convert(s)});return n}getPathParameters({namedParameters:e,snippet:t}){var o;let n=[],i=this.context.associateByWireValue({parameters:e,values:(o=t.pathParameters)!=null?o:{}});for(let s of i)n.push({name:this.context.getTypeName(s.name.name),value:this.context.dynamicTypeInstantiationMapper.convert(s)});return n}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getMethodName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getRootClientFuncInvocation(e){return r.invokeFunc({func:r.typeReference({name:this.context.getClientConstructorName(),importPath:this.context.getClientImportPath()}),arguments_:e})}newAuthMismatchError({auth:e,values:t}){return new Error(`Expected auth type ${e.type}, got ${t.type}`)}};export{A as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,k as i,m as n}from"./chunk-2AZXIWKY.js";i();n();var p=class{constructor(){t(this,"reporter");t(this,"snippet");t(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:r,snippet:e}){(this.reporter==null||this.reporter.size()>r.errors.size())&&(this.reporter=r.errors.clone(),this.snippet=e)}getResponseOrThrow({endpoint:r}){var e;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(e=this.err)!=null?e:new Error(`Failed to generate snippet for endpoint "${r.method} ${r.path}"`)}};export{p as a};
|