@fern-api/csharp-dynamic-snippets 0.0.2 → 0.0.3
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/Config.cjs +2 -11
- package/cjs/Config.cjs.map +1 -0
- package/cjs/DynamicSnippetsGenerator.cjs +31 -19
- package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
- package/cjs/DynamicSnippetsGenerator.d.cts +4 -1
- package/cjs/DynamicSnippetsGeneratorContext-DQDI25Nx.d.cts +395 -0
- package/cjs/EndpointSnippetGenerator.cjs +30 -19
- package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
- package/cjs/EndpointSnippetGenerator.d.cts +7 -3
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +31 -32
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
- package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +4 -2
- package/cjs/context/DynamicTypeLiteralMapper.cjs +2 -34
- package/cjs/context/DynamicTypeLiteralMapper.cjs.map +1 -0
- package/cjs/context/DynamicTypeLiteralMapper.d.cts +3 -1
- package/cjs/context/DynamicTypeMapper.cjs +2 -34
- package/cjs/context/DynamicTypeMapper.cjs.map +1 -0
- package/cjs/context/DynamicTypeMapper.d.cts +3 -1
- package/cjs/context/FilePropertyMapper.cjs +26 -32
- package/cjs/context/FilePropertyMapper.cjs.map +1 -0
- package/cjs/context/FilePropertyMapper.d.cts +3 -1
- package/cjs/index.cjs +34 -31
- package/cjs/index.cjs.map +1 -0
- package/cjs/index.d.cts +4 -2
- package/esm/Config.js +2 -1
- package/esm/Config.js.map +1 -0
- package/esm/DynamicSnippetsGenerator.d.ts +4 -1
- package/esm/DynamicSnippetsGenerator.js +2 -1
- package/esm/DynamicSnippetsGenerator.js.map +1 -0
- package/esm/DynamicSnippetsGeneratorContext-DQDI25Nx.d.ts +395 -0
- package/esm/EndpointSnippetGenerator.d.ts +7 -3
- package/esm/EndpointSnippetGenerator.js +2 -1
- package/esm/EndpointSnippetGenerator.js.map +1 -0
- package/esm/chunk-2ZIORSVG.js +2 -0
- package/esm/chunk-2ZIORSVG.js.map +1 -0
- package/esm/chunk-7V3DJGVI.js +2 -0
- package/esm/chunk-7V3DJGVI.js.map +1 -0
- package/esm/chunk-C6VL3KCZ.js +33 -0
- package/esm/chunk-C6VL3KCZ.js.map +1 -0
- package/esm/chunk-E3QSX5HZ.js +2 -0
- package/esm/chunk-E3QSX5HZ.js.map +1 -0
- package/esm/chunk-E4DWHIH4.js +2 -0
- package/esm/chunk-E4DWHIH4.js.map +1 -0
- package/esm/chunk-GYLRU3VR.js +2 -0
- package/esm/chunk-GYLRU3VR.js.map +1 -0
- package/esm/chunk-HWTWQNRE.js +15 -0
- package/esm/chunk-HWTWQNRE.js.map +1 -0
- package/esm/chunk-KHCIVF5J.js +1 -0
- package/esm/chunk-KHCIVF5J.js.map +1 -0
- package/esm/chunk-MPTA2ZER.js +2 -0
- package/esm/chunk-MPTA2ZER.js.map +1 -0
- package/esm/context/DynamicSnippetsGeneratorContext.d.ts +4 -2
- package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
- package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
- package/esm/context/DynamicTypeLiteralMapper.d.ts +3 -1
- package/esm/context/DynamicTypeLiteralMapper.js +2 -1
- package/esm/context/DynamicTypeLiteralMapper.js.map +1 -0
- package/esm/context/DynamicTypeMapper.d.ts +3 -1
- package/esm/context/DynamicTypeMapper.js +2 -1
- package/esm/context/DynamicTypeMapper.js.map +1 -0
- package/esm/context/FilePropertyMapper.d.ts +3 -1
- package/esm/context/FilePropertyMapper.js +2 -1
- package/esm/context/FilePropertyMapper.js.map +1 -0
- package/esm/index.d.ts +4 -2
- package/esm/index.js +5 -13
- package/esm/index.js.map +1 -0
- package/package.json +1 -1
- package/cjs/DynamicSnippetsGeneratorContext-DbMhuHoi.d.cts +0 -116
- package/esm/DynamicSnippetsGeneratorContext-DbMhuHoi.d.ts +0 -116
- package/esm/chunk-2AZXIWKY.js +0 -11
- package/esm/chunk-ARC6F6E6.js +0 -1
- package/esm/chunk-CIENX2JS.js +0 -1
- package/esm/chunk-DVOWBIEL.js +0 -1
- package/esm/chunk-HN67B7VQ.js +0 -1
- package/esm/chunk-IIP7VDG4.js +0 -1
- package/esm/chunk-ME2YBVEY.js +0 -1
- package/esm/chunk-PJC2VZIA.js +0 -26
- package/esm/chunk-QKK5PTVJ.js +0 -1
- package/esm/chunk-YL3JFOME.js +0 -1
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { AbstractDynamicSnippetsGeneratorContext, FernGeneratorExec, Options } from '@fern-api/browser-compatible-base-generator';
|
|
2
|
-
import { csharp, BaseCsharpCustomConfigSchema } from '@fern-api/csharp-codegen';
|
|
3
|
-
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
4
|
-
|
|
5
|
-
declare namespace DynamicTypeLiteralMapper {
|
|
6
|
-
interface Args {
|
|
7
|
-
typeReference: FernIr.dynamic.TypeReference;
|
|
8
|
-
value: unknown;
|
|
9
|
-
as?: ConvertedAs;
|
|
10
|
-
}
|
|
11
|
-
type ConvertedAs = "key";
|
|
12
|
-
}
|
|
13
|
-
declare class DynamicTypeLiteralMapper {
|
|
14
|
-
private context;
|
|
15
|
-
constructor({ context }: {
|
|
16
|
-
context: DynamicSnippetsGeneratorContext;
|
|
17
|
-
});
|
|
18
|
-
convert(args: DynamicTypeLiteralMapper.Args): csharp.TypeLiteral;
|
|
19
|
-
private convertList;
|
|
20
|
-
private convertSet;
|
|
21
|
-
private convertMap;
|
|
22
|
-
private convertNamed;
|
|
23
|
-
private convertDiscriminatedUnion;
|
|
24
|
-
private getBaseProperties;
|
|
25
|
-
private instantiateUnionWithBaseProperties;
|
|
26
|
-
private convertEnum;
|
|
27
|
-
private getEnumValueName;
|
|
28
|
-
private convertObject;
|
|
29
|
-
private convertUndiscriminatedUnion;
|
|
30
|
-
private findMatchingUndiscriminatedUnionType;
|
|
31
|
-
private convertUnknown;
|
|
32
|
-
private convertPrimitive;
|
|
33
|
-
private getValueAsNumber;
|
|
34
|
-
private getValueAsBoolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
declare namespace DynamicTypeMapper {
|
|
38
|
-
interface Args {
|
|
39
|
-
typeReference: FernIr.dynamic.TypeReference;
|
|
40
|
-
unboxOptionals?: boolean;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
declare class DynamicTypeMapper {
|
|
44
|
-
private context;
|
|
45
|
-
constructor({ context }: {
|
|
46
|
-
context: DynamicSnippetsGeneratorContext;
|
|
47
|
-
});
|
|
48
|
-
convert(args: DynamicTypeMapper.Args): csharp.Type;
|
|
49
|
-
private convertNamed;
|
|
50
|
-
private convertLiteral;
|
|
51
|
-
private convertUnknown;
|
|
52
|
-
private convertPrimitive;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
interface FilePropertyInfo {
|
|
56
|
-
fileFields: csharp.ConstructorField[];
|
|
57
|
-
bodyPropertyFields: csharp.ConstructorField[];
|
|
58
|
-
}
|
|
59
|
-
declare class FilePropertyMapper {
|
|
60
|
-
private context;
|
|
61
|
-
constructor({ context }: {
|
|
62
|
-
context: DynamicSnippetsGeneratorContext;
|
|
63
|
-
});
|
|
64
|
-
getFilePropertyInfo({ body, value }: {
|
|
65
|
-
body: FernIr.dynamic.FileUploadRequestBody;
|
|
66
|
-
value: unknown;
|
|
67
|
-
}): FilePropertyInfo;
|
|
68
|
-
private getSingleFileProperty;
|
|
69
|
-
private getArrayFileProperty;
|
|
70
|
-
private getBodyProperty;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGeneratorContext {
|
|
74
|
-
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
75
|
-
customConfig: BaseCsharpCustomConfigSchema | undefined;
|
|
76
|
-
dynamicTypeMapper: DynamicTypeMapper;
|
|
77
|
-
dynamicTypeLiteralMapper: DynamicTypeLiteralMapper;
|
|
78
|
-
filePropertyMapper: FilePropertyMapper;
|
|
79
|
-
rootNamespace: string;
|
|
80
|
-
constructor({ ir, config, options }: {
|
|
81
|
-
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
82
|
-
config: FernGeneratorExec.GeneratorConfig;
|
|
83
|
-
options?: Options;
|
|
84
|
-
});
|
|
85
|
-
clone(): DynamicSnippetsGeneratorContext;
|
|
86
|
-
getFileParameterForString(str: string): csharp.TypeLiteral;
|
|
87
|
-
getMemoryStreamForString(str: string): csharp.ClassInstantiation;
|
|
88
|
-
getClassName(name: FernIr.Name): string;
|
|
89
|
-
getParameterName(name: FernIr.Name): string;
|
|
90
|
-
getPropertyName(name: FernIr.Name): string;
|
|
91
|
-
getMethodName(name: FernIr.Name): string;
|
|
92
|
-
getEnvironmentClassName(): string;
|
|
93
|
-
shouldUseDiscriminatedUnions(): boolean;
|
|
94
|
-
getRootClientClassName(): string;
|
|
95
|
-
getRootClientClassReference(): csharp.ClassReference;
|
|
96
|
-
getBaseExceptionClassReference(): csharp.ClassReference;
|
|
97
|
-
getBaseApiExceptionClassReference(): csharp.ClassReference;
|
|
98
|
-
getExceptionClassReference(declaration: FernIr.dynamic.Declaration): csharp.ClassReference;
|
|
99
|
-
getClientOptionsClassReference(): csharp.ClassReference;
|
|
100
|
-
getRequestOptionsClassReference(): csharp.ClassReference;
|
|
101
|
-
getFileParameterClassReference(): csharp.ClassReference;
|
|
102
|
-
getMemoryStreamClassReference(): csharp.ClassReference;
|
|
103
|
-
getEncodingUtf8ClassReference(): csharp.ClassReference;
|
|
104
|
-
getNamespace(fernFilepath: FernIr.FernFilepath, suffix?: string): string;
|
|
105
|
-
getRootNamespace(): string;
|
|
106
|
-
getCoreNamespace(): string;
|
|
107
|
-
getNamespaceForPublicCoreClasses(): string;
|
|
108
|
-
getEnvironmentTypeReferenceFromID(environmentID: string): csharp.ClassReference | undefined;
|
|
109
|
-
getEnvironmentClassReference(): csharp.ClassReference;
|
|
110
|
-
private getEnvironmentClassReferenceForEnumName;
|
|
111
|
-
private getClientPrefix;
|
|
112
|
-
private getNamespaceSegments;
|
|
113
|
-
private getComputedClientName;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export { DynamicSnippetsGeneratorContext as D, type FilePropertyInfo as F, DynamicTypeLiteralMapper as a, DynamicTypeMapper as b, FilePropertyMapper as c };
|
package/esm/chunk-2AZXIWKY.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
*/
|
package/esm/chunk-ARC6F6E6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as y,e as n}from"./chunk-PJC2VZIA.js";import{j as l,k as p,m as s}from"./chunk-2AZXIWKY.js";p();s();var c=class{constructor({context:r}){l(this,"context");this.context=r}getFilePropertyInfo({body:r,value:o}){var a;let e={fileFields:[],bodyPropertyFields:[]},i=(a=this.context.getRecord(o))!=null?a:{};for(let t of r.properties)switch(t.type){case"file":e.fileFields.push({name:this.context.getPropertyName(t.name),value:this.getSingleFileProperty({property:t,record:i})});break;case"fileArray":e.fileFields.push({name:this.context.getPropertyName(t.name),value:this.getArrayFileProperty({property:t,record:i})});break;case"bodyProperty":e.bodyPropertyFields.push({name:this.context.getPropertyName(t.name.name),value:this.getBodyProperty({property:t,record:i})});break;default:y(t)}return e}getSingleFileProperty({property:r,record:o}){let e=this.context.getSingleFileValue({property:r,record:o});return e==null?n.TypeLiteral.nop():this.context.getFileParameterForString(e)}getArrayFileProperty({property:r,record:o}){let e=this.context.getFileArrayValues({property:r,record:o});return e==null?n.TypeLiteral.nop():n.TypeLiteral.list({valueType:n.Type.reference(this.context.getFileParameterClassReference()),values:e.map(i=>this.context.getFileParameterForString(i))})}getBodyProperty({property:r,record:o}){let e=o[r.name.wireValue];return e==null?n.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:r.typeReference,value:e})}};export{c as a};
|
package/esm/chunk-CIENX2JS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as c}from"./chunk-IIP7VDG4.js";import{a as p,e as r}from"./chunk-PJC2VZIA.js";import{j as l,k as u,m as y}from"./chunk-2AZXIWKY.js";u();y();var m=class{constructor({context:e}){l(this,"context");this.context=e}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?r.TypeLiteral.null():(this.context.errors.add({severity:c.Critical,message:"Expected non-null value, but got null"}),r.TypeLiteral.nop());if(e.value===void 0)return r.TypeLiteral.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value});case"literal":return r.TypeLiteral.nop();case"map":return this.convertMap({map:e.typeReference,value:e.value});case"named":{let n=this.context.resolveNamedType({typeId:e.typeReference.value});return n==null?r.TypeLiteral.nop():this.convertNamed({named:n,value:e.value,as:e.as})}case"nullable":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertSet({set:e.typeReference.value,value:e.value});case"unknown":return this.convertUnknown({value:e.value});default:p(e.typeReference)}}convertList({list:e,value:n}){return Array.isArray(n)?r.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e,unboxOptionals:!0}),values:n.map((i,t)=>{this.context.errors.scope({index:t});try{return this.convert({typeReference:e,value:i})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:c.Critical,message:`Expected array but got: ${typeof n}`}),r.TypeLiteral.nop())}convertSet({set:e,value:n}){return Array.isArray(n)?r.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e,unboxOptionals:!0}),values:n.map((i,t)=>{this.context.errors.scope({index:t});try{return this.convert({typeReference:e,value:i})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:c.Critical,message:`Expected array but got: ${typeof n}`}),r.TypeLiteral.nop())}convertMap({map:e,value:n}){return typeof n!="object"||n==null?(this.context.errors.add({severity:c.Critical,message:`Expected object but got: ${n==null?"null":typeof n}`}),r.TypeLiteral.nop()):r.TypeLiteral.dictionary({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(n).map(([i,t])=>{this.context.errors.scope(i);try{return{key:this.convert({typeReference:e.key,value:i,as:"key"}),value:this.convert({typeReference:e.value,value:t})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:n,as:i}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:n,as:i});case"discriminatedUnion":return this.context.shouldUseDiscriminatedUnions()?this.convertDiscriminatedUnion({discriminatedUnion:e,value:n}):this.convertUnknown({value:n});case"enum":return this.convertEnum({enum_:e,value:n});case"object":return this.convertObject({object_:e,value:n});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:n});default:p(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:n}){let i=r.classReference({name:this.context.getClassName(e.declaration.name),namespace:this.context.getNamespace(e.declaration.fernFilepath)}),t=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:n});if(t==null)return r.TypeLiteral.nop();let a=t.singleDiscriminatedUnionType,s=this.getBaseProperties({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:a});switch(a.type){case"samePropertiesAsObject":{let o=this.context.resolveNamedType({typeId:a.typeId});return o==null?r.TypeLiteral.nop():this.instantiateUnionWithBaseProperties({classReference:i,baseProperties:s,arguments_:[this.convertNamed({named:o,value:t.value})]})}case"singleProperty":{let o=this.context.getRecord(t.value);if(o==null)return r.TypeLiteral.nop();try{return this.context.errors.scope(a.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:i,baseProperties:s,arguments_:[this.convert({typeReference:a.typeReference,value:o[a.discriminantValue.wireValue]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:i,baseProperties:s,arguments_:[]});default:p(a)}}getBaseProperties({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:n}){var t,a;return this.context.associateByWireValue({parameters:(t=n.properties)!=null?t:[],values:(a=this.context.getRecord(e.value))!=null?a:{},ignoreMissingParameters:!0}).map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getPropertyName(s.name.name),assignment:this.convert(s)}}finally{this.context.errors.unscope()}})}instantiateUnionWithBaseProperties({classReference:e,arguments_:n,baseProperties:i}){let t=r.instantiateClass({classReference:e,arguments_:n,multiline:!0});return i.length===0?r.TypeLiteral.reference(t):r.TypeLiteral.reference(r.codeblock(a=>{a.writeNode(t),a.writeLine(" {"),a.indent();for(let s of i)a.write(s.name),a.write(" = "),a.writeNodeOrString(s.assignment),a.writeLine(",");a.dedent(),a.write("}")}))}convertEnum({enum_:e,value:n}){let i=this.getEnumValueName({enum_:e,value:n});return i==null?r.TypeLiteral.nop():r.TypeLiteral.reference(r.classReference({name:i,namespace:this.context.getNamespace(e.declaration.fernFilepath)}))}getEnumValueName({enum_:e,value:n}){if(typeof n!="string"){this.context.errors.add({severity:c.Critical,message:`Expected enum value string, got: ${typeof n}`});return}let i=e.values.find(t=>t.wireValue===n);if(i==null){this.context.errors.add({severity:c.Critical,message:`An enum value named "${n}" does not exist in this context`});return}return`${this.context.getClassName(e.declaration.name)}.${this.context.getClassName(i.name)}`}convertObject({object_:e,value:n}){var t;let i=this.context.associateByWireValue({parameters:e.properties,values:(t=this.context.getRecord(n))!=null?t:{}});return r.TypeLiteral.class_({reference:r.classReference({name:this.context.getClassName(e.declaration.name),namespace:this.context.getNamespace(e.declaration.fernFilepath)}),fields:i.map(a=>{this.context.errors.scope(a.name.wireValue);try{return{name:this.context.getClassName(a.name.name),value:this.convert(a)}}finally{this.context.errors.unscope()}})})}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:n}){let i=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:n});return i==null?r.TypeLiteral.nop():i.typeLiteral}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:n}){for(let i of e.types)try{let t=this.convert({typeReference:i,value:n});return{valueTypeReference:i,typeLiteral:t}}catch(t){continue}this.context.errors.add({severity:c.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof n}" value`})}convertUnknown({value:e}){return r.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:n,as:i}){switch(e){case"INTEGER":{let t=this.getValueAsNumber({value:n,as:i});return t==null?r.TypeLiteral.nop():r.TypeLiteral.integer(t)}case"LONG":{let t=this.getValueAsNumber({value:n,as:i});return t==null?r.TypeLiteral.nop():r.TypeLiteral.long(t)}case"UINT":{let t=this.getValueAsNumber({value:n,as:i});return t==null?r.TypeLiteral.nop():r.TypeLiteral.uint(t)}case"UINT_64":{let t=this.getValueAsNumber({value:n,as:i});return t==null?r.TypeLiteral.nop():r.TypeLiteral.ulong(t)}case"FLOAT":{let t=this.getValueAsNumber({value:n,as:i});return t==null?r.TypeLiteral.nop():r.TypeLiteral.float(t)}case"DOUBLE":{let t=this.getValueAsNumber({value:n,as:i});return t==null?r.TypeLiteral.nop():r.TypeLiteral.double(t)}case"BOOLEAN":{let t=this.getValueAsBoolean({value:n,as:i});return t==null?r.TypeLiteral.nop():r.TypeLiteral.boolean(t)}case"STRING":{let t=this.context.getValueAsString({value:n});return t==null?r.TypeLiteral.nop():r.TypeLiteral.string(t)}case"DATE":{let t=this.context.getValueAsString({value:n});return t==null?r.TypeLiteral.nop():r.TypeLiteral.date(t)}case"DATE_TIME":{let t=this.context.getValueAsString({value:n});return t==null?r.TypeLiteral.nop():r.TypeLiteral.datetime(t)}case"UUID":{let t=this.context.getValueAsString({value:n});return t==null?r.TypeLiteral.nop():r.TypeLiteral.string(t)}case"BASE_64":{let t=this.context.getValueAsString({value:n});return t==null?r.TypeLiteral.nop():r.TypeLiteral.string(t)}case"BIG_INTEGER":{let t=this.context.getValueAsString({value:n});return t==null?r.TypeLiteral.nop():r.TypeLiteral.string(t)}default:p(e)}}getValueAsNumber({value:e,as:n}){let i=n==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:i})}getValueAsBoolean({value:e,as:n}){let i=n==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:i})}};export{m as a};
|
package/esm/chunk-DVOWBIEL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as o,d as f,e as c}from"./chunk-IIP7VDG4.js";import{a as u,c as R,d as I,e as a}from"./chunk-PJC2VZIA.js";import{j as x,k as A,m as C}from"./chunk-2AZXIWKY.js";A();C();var F="Usage",B="Example",T="Do",P="client",q={type:"primitive",value:"STRING"},N=class{constructor({context:e}){x(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t,options:r}){var n;return this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toString({namespace:F,rootNamespace:this.context.getRootNamespace(),customConfig:(n=this.context.customConfig)!=null?n:{},allNamespaceSegments:new Set,allTypeClassReferences:new Map})}generateSnippetSync({endpoint:e,request:t,options:r}){var n;return this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toString({namespace:F,rootNamespace:this.context.getRootNamespace(),customConfig:(n=this.context.customConfig)!=null?n:{},allNamespaceSegments:new Set,allTypeClassReferences:new Map})}buildCodeBlock({endpoint:e,snippet:t,options:r}){let s=a.codeblock(i=>{i.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),i.newLine(),i.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))}),n=this.getStyle(r);switch(n){case f.Concise:return s;case f.Full:return this.buildFullCodeBlock({body:s,options:r});default:u(n)}}buildFullCodeBlock({body:e,options:t}){var n;let r=this.getConfig(t),s=a.class_({name:(n=r.fullStyleClassName)!=null?n:B,namespace:F,access:a.Access.Public});return s.addMethod(a.method({name:T,access:a.Access.Public,isAsync:!0,parameters:[],body:e})),s}constructClient({endpoint:e,snippet:t}){return a.codeblock(r=>{r.write(`var ${P} = `),r.writeNode(this.getRootClientConstructorInvocation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){return a.invokeMethod({on:a.codeblock(P),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t}),async:!0,configureAwait:!0,multiline:!0})}getConstructorArgs({endpoint:e,snippet:t}){let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:o.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let s=[],n=this.getConstructorBaseUrlArgs({baseUrl:t.baseURL,environment:t.environment});n.length>0&&s.push(...n),this.context.errors.scope(c.Headers);let i=[];return this.context.ir.headers!=null&&t.headers!=null&&i.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),s.length===0?[...r,...i]:[...r,...i,{name:"clientOptions",assignment:a.instantiateClass({classReference:this.context.getClientOptionsClassReference(),arguments_:s.map(p=>({name:p.name,assignment:p.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:e,environment:t}){let r=this.getBaseUrlArg({baseUrl:e,environment:t});return a.TypeLiteral.isNop(r)?[]:[{name:this.getBaseUrlOptionName(),assignment:r}]}getBaseUrlArg({baseUrl:e,environment:t}){var r;if(e!=null&&t!=null)return this.context.errors.add({severity:o.Critical,message:"Cannot specify both baseUrl and environment options"}),a.TypeLiteral.nop();if(e!=null)return((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls"?(this.context.errors.add({severity:o.Critical,message:"The C# SDK doesn't support a baseUrl when multiple URL environments are configured"}),a.TypeLiteral.nop()):a.TypeLiteral.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let s=this.context.getEnvironmentTypeReferenceFromID(t);return s==null?(this.context.errors.add({severity:o.Warning,message:`Environment ${JSON.stringify(t)} was not found`}),a.TypeLiteral.nop()):a.TypeLiteral.reference(s)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?a.TypeLiteral.reference(a.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.entries(t).map(([s,n])=>({name:R(I(s)),assignment:this.context.dynamicTypeLiteralMapper.convert({typeReference:q,value:n})})),multiline:!0})):a.TypeLiteral.nop()}return a.TypeLiteral.nop()}getConstructorAuthArgs({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorBasicAuthArg({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorBearerAuthArgs({auth:e,values:t});case"header":return t.type!=="header"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorHeaderAuthArgs({auth:e,values:t});case"oauth":return t.type!=="oauth"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorOAuthArgs({auth:e,values:t});default:u(e)}}getConstructorBasicAuthArg({auth:e,values:t}){return[{name:this.context.getParameterName(e.username),assignment:a.TypeLiteral.string(t.username)},{name:this.context.getParameterName(e.password),assignment:a.TypeLiteral.string(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.token),assignment:a.TypeLiteral.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.header.name.name),assignment:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getConstructorOAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.clientId),assignment:a.TypeLiteral.string(t.clientId)},{name:this.context.getParameterName(e.clientSecret),assignment:a.TypeLiteral.string(t.clientSecret)}]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let s of e){let n=this.getConstructorHeaderArg({header:s,value:t.value});n!=null&&r.push({name:this.context.getParameterName(s.name.name),assignment:n})}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!a.TypeLiteral.isNop(r))return r}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:u(e.request)}}getMethodArgsForInlinedRequest({request:e,snippet:t}){var h,y,d,l;let r=[],s=(y=(h=this.context.customConfig)==null?void 0:h["inline-path-parameters"])!=null?y:!1;this.context.errors.scope(c.PathParameters);let n=[],i=[...(d=this.context.ir.pathParameters)!=null?d:[],...(l=e.pathParameters)!=null?l:[]];i.length>0&&n.push(...this.getPathParameters({namedParameters:i,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(c.RequestBody);let p=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:s})||r.push(...n.map(g=>g.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:s})?n:[],filePropertyInfo:p})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:s}){var d,l,g,v;this.context.errors.scope(c.QueryParameters);let i=this.context.associateQueryParametersByWireValue({parameters:(d=e.queryParameters)!=null?d:[],values:(l=t.queryParameters)!=null?l:{}}).map(m=>({name:this.context.getPropertyName(m.name.name),value:this.context.dynamicTypeLiteralMapper.convert(m)}));this.context.errors.unscope(),this.context.errors.scope(c.Headers);let h=this.context.associateByWireValue({parameters:(g=e.headers)!=null?g:[],values:(v=t.headers)!=null?v:{}}).map(m=>({name:this.context.getPropertyName(m.name.name),value:this.context.dynamicTypeLiteralMapper.convert(m)}));this.context.errors.unscope(),this.context.errors.scope(c.RequestBody);let y=e.body!=null?this.getInlinedRequestBodyConstructorFields({body:e.body,value:t.requestBody,filePropertyInfo:s}):[];return this.context.errors.unscope(),a.TypeLiteral.class_({reference:a.classReference({name:this.context.getClassName(e.declaration.name),namespace:this.context.getNamespace(e.declaration.fernFilepath)}),fields:[...r,...i,...h,...y]})}getInlinedRequestBodyConstructorFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:r});default:u(e)}}getInlinedRequestBodyPropertyConstructorFields({parameters:e,value:t}){var n;let r=[],s=this.context.associateByWireValue({parameters:e,values:(n=this.context.getRecord(t))!=null?n:{}});for(let i of s)r.push({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getFileUploadRequestBodyConstructorFields({filePropertyInfo:e}){return[...e.fileFields,...e.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:e,value:t}){return{name:this.context.getPropertyName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:u(e)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var n,i;let r=[];this.context.errors.scope(c.PathParameters);let s=[...(n=this.context.ir.pathParameters)!=null?n:[],...(i=e.pathParameters)!=null?i:[]];return s.length>0&&r.push(...this.getPathParameters({namedParameters:s,snippet:t}).map(p=>p.value)),this.context.errors.unscope(),this.context.errors.scope(c.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:u(e)}}getBytesBodyRequestArg({value:e}){let t=this.context.getValueAsString({value:e});return t==null?(this.context.errors.add({severity:o.Critical,message:"The bytes request body must be provided in string format"}),a.TypeLiteral.nop()):a.TypeLiteral.reference(this.context.getMemoryStreamForString(t))}getRootClientConstructorInvocation(e){return a.instantiateClass({classReference:this.context.getRootClientClassReference(),arguments_:e,forceUseConstructor:!0,multiline:!0})}getPathParameters({namedParameters:e,snippet:t}){var n;let r=[],s=this.context.associateByWireValue({parameters:e,values:(n=t.pathParameters)!=null?n:{}});for(let i of s)r.push({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getClassName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getBaseUrlOptionName(){var e;return((e=this.context.ir.environments)==null?void 0:e.environments.type)==="multipleBaseUrls"?"Environment":"BaseUrl"}getStyle(e){var t,r;return(r=(t=e.style)!=null?t:this.context.options.style)!=null?r:f.Full}getConfig(e){var t,r;return(r=(t=e.config)!=null?t:this.context.options.config)!=null?r:{}}};export{N as a};
|
package/esm/chunk-HN67B7VQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{k as e,m as l}from"./chunk-2AZXIWKY.js";e();l();
|
package/esm/chunk-IIP7VDG4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as m,b as E}from"./chunk-PJC2VZIA.js";import{a as T,b as S,c as b,d as A,j as l,k as o,m as a}from"./chunk-2AZXIWKY.js";o();a();o();a();var y=class{constructor(){l(this,"reporter");l(this,"snippet");l(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){this.shouldUpdate({snippet:r,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=r)}getResponseOrThrow({endpoint:e}){var r;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(r=this.err)!=null?r:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:r}){var t,n;return this.reporter==null||this.reporter.size()>0&&r.size()===0?!0:e.length>((n=(t=this.snippet)==null?void 0:t.length)!=null?n:0)}};var R=class{constructor(e){l(this,"context");this.context=e}async generate(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new y;for(let i of t){let s=this.context.clone(),d=this.createSnippetGenerator(s);try{let u=await d.generateSnippet({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:u,errors:void 0};n.update({context:s,snippet:u})}catch(u){n.err==null&&(n.err=u)}}return n.getResponseOrThrow({endpoint:e.endpoint})}generateSync(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new y;for(let i of t){let s=this.context.clone(),d=this.createSnippetGenerator(s);try{let u=d.generateSnippetSync({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:u,errors:void 0};n.update({context:s,snippet:u})}catch(u){n.err==null&&(n.err=u)}}return n.getResponseOrThrow({endpoint:e.endpoint})}};o();a();var p={Critical:"CRITICAL",Warning:"WARNING"},g=class c{constructor(){l(this,"errors");l(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(S(T({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new c;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};o();a();o();a();o();a();var v=class{constructor(){l(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH)\s(\/[a-zA-Z0-9\/{}_-]*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let t=e.match(this.REFERENCE_REGEX);if(!(t==null||t[1]==null||t[2]==null))return{method:t[1],path:t[2]}}};var w=class{constructor({ir:e,config:r,options:t={}}){l(this,"config");l(this,"options");l(this,"errors");l(this,"_ir");l(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.options=t,this.errors=new g,this.httpEndpointReferenceParser=new v}associateQueryParametersByWireValue({parameters:e,values:r}){let t=[];for(let[n,i]of Object.entries(r)){this.errors.scope(n);try{let s=e.find(u=>u.name.wireValue===n);if(s==null)throw this.newParameterNotRecognizedError(n);let d=this.isListTypeReference(s.typeReference)&&!Array.isArray(i)?[i]:i;t.push({name:s.name,typeReference:s.typeReference,value:d})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let n=[];for(let[i,s]of Object.entries(r)){this.errors.scope(i);try{let d=e.find(u=>u.name.wireValue===i);if(d==null){if(t)continue;this.errors.add({severity:p.Critical,message:this.newParameterNotRecognizedError(i).message});continue}n.push({name:d.name,typeReference:d.typeReference,value:s})}finally{this.errors.unscope()}}return n}getSingleFileValue({property:e,record:r}){let t=r[e.wireValue];if(t!=null){if(typeof t!="string"){this.errors.add({severity:p.Critical,message:`Expected file value to be a string, got ${typeof t}`});return}return t}}getFileArrayValues({property:e,record:r}){let t=r[e.wireValue];if(t==null)return;if(!Array.isArray(t)){this.errors.add({severity:p.Critical,message:`Expected file array value to be an array of strings, got ${typeof t}`});return}let n=[];for(let i of t){if(typeof i!="string"){this.errors.add({severity:p.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}n.push(i)}return n}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:p.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:p.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let t=this.getRecord(r);if(t==null)return;let n=e.discriminant.wireValue,i=t[n];if(i==null){this.errors.add({severity:p.Critical,message:this.newParameterNotRecognizedError(n).message});return}if(typeof i!="string"){this.errors.add({severity:p.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let s=e.types[i];if(s==null){this.errors.add({severity:p.Critical,message:`No type found for discriminant value "${i}"`});return}let P=t,{[n]:d}=P,u=A(P,[b(n)]);return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:u}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocationOrThrow(e){let r=[];for(let t of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:t,parsedEndpoint:e})&&r.push(t);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:t}){var n;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:t}):!((n=e.metadata)!=null&&n.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var t,n;return r&&((n=(t=e.metadata)==null?void 0:t.includePathParameters)!=null?n:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:m(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}case"multipleBaseUrls":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}default:m(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:p.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:p.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let t=r.environments[0];if(t==null)return this.errors.add({severity:p.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let n=new Set(E(t.urls));for(let i of E(e))n.has(i)&&n.delete(i);return n.size>0?(this.errors.add({severity:p.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${E(t.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:p.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:p.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:p.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:m(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:m(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:m(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};o();a();var x;(function(c){c.Concise="concise",c.Full="full"})(x||(x={}));o();a();var C={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};o();a();export{R as a,p as b,w as c,x as d,C as e};
|
package/esm/chunk-ME2YBVEY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as o}from"./chunk-DVOWBIEL.js";import{a as i}from"./chunk-YL3JFOME.js";import{a as p}from"./chunk-IIP7VDG4.js";import{k as t,m as r}from"./chunk-2AZXIWKY.js";t();r();var a=class extends p{constructor({ir:e,config:n,options:s={}}){super(new i({ir:e,config:n,options:s}))}async generate(e,n={}){return super.generate(e,n)}generateSync(e,n={}){return super.generateSync(e,n)}createSnippetGenerator(e){return new o({context:e})}};export{a};
|